@azure/communication-react 1.16.0-alpha-202405080011 → 1.16.0-alpha-202405132302

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 (203) hide show
  1. package/dist/communication-react.d.ts +109 -117
  2. package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-MqUGJDlB.js → ChatMessageComponentAsRichTextEditBox-Vvv1aBkI.js} +23 -14
  3. package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-Vvv1aBkI.js.map +1 -0
  4. package/dist/dist-cjs/communication-react/{index-CY4kAQ6s.js → index-DdWRffLC.js} +742 -906
  5. package/dist/dist-cjs/communication-react/index-DdWRffLC.js.map +1 -0
  6. package/dist/dist-cjs/communication-react/index.js +1 -1
  7. package/dist/dist-esm/acs-ui-common/src/common.d.ts +74 -0
  8. package/dist/dist-esm/acs-ui-common/src/common.js.map +1 -1
  9. package/dist/dist-esm/acs-ui-common/src/index.d.ts +2 -0
  10. package/dist/dist-esm/acs-ui-common/src/index.js.map +1 -1
  11. package/dist/dist-esm/acs-ui-common/src/memoizeFnAll.d.ts +1 -1
  12. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  13. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  14. package/dist/dist-esm/calling-component-bindings/src/hooks/usePropsFor.d.ts +1 -1
  15. package/dist/dist-esm/calling-stateful-client/src/CallDeclarativeCommon.js +24 -4
  16. package/dist/dist-esm/calling-stateful-client/src/CallDeclarativeCommon.js.map +1 -1
  17. package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.d.ts +3 -6
  18. package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js +43 -26
  19. package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js.map +1 -1
  20. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js +0 -2
  21. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js.map +1 -1
  22. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListMessages.d.ts +1 -1
  23. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListParticipants.d.ts +1 -1
  24. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListReadReceipts.d.ts +1 -1
  25. package/dist/dist-esm/chat-stateful-client/src/iterators/createDecoratedListThreads.d.ts +1 -1
  26. package/dist/dist-esm/communication-react/src/index.d.ts +5 -3
  27. package/dist/dist-esm/communication-react/src/index.js.map +1 -1
  28. package/dist/dist-esm/react-components/src/components/Announcer/AnnouncerMessage.d.ts +1 -1
  29. package/dist/dist-esm/react-components/src/components/{AttachmentCard.d.ts → Attachment/AttachmentCard.d.ts} +3 -2
  30. package/dist/dist-esm/react-components/src/components/{AttachmentCard.js → Attachment/AttachmentCard.js} +17 -16
  31. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCard.js.map +1 -0
  32. package/dist/dist-esm/react-components/src/components/{AttachmentCardGroup.js → Attachment/AttachmentCardGroup.js} +1 -1
  33. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCardGroup.js.map +1 -0
  34. package/dist/dist-esm/react-components/src/components/{AttachmentDownloadCards.d.ts → Attachment/AttachmentDownloadCards.d.ts} +3 -2
  35. package/dist/dist-esm/react-components/src/components/{AttachmentDownloadCards.js → Attachment/AttachmentDownloadCards.js} +2 -2
  36. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.js.map +1 -0
  37. package/dist/dist-esm/react-components/src/components/{AttachmentUploadCards.d.ts → Attachment/AttachmentUploadCards.d.ts} +3 -3
  38. package/dist/dist-esm/react-components/src/components/{AttachmentUploadCards.js → Attachment/AttachmentUploadCards.js} +3 -3
  39. package/dist/dist-esm/react-components/src/components/Attachment/AttachmentUploadCards.js.map +1 -0
  40. package/dist/dist-esm/react-components/src/components/Caption.js.map +1 -1
  41. package/dist/dist-esm/react-components/src/components/CaptionsBanner.js.map +1 -1
  42. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.d.ts +3 -2
  43. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js.map +1 -1
  44. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.d.ts +1 -1
  45. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js.map +1 -1
  46. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.d.ts +3 -2
  47. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js.map +1 -1
  48. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.d.ts +2 -4
  49. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.js +21 -12
  50. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBox.js.map +1 -1
  51. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.d.ts +2 -4
  52. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsEditBoxPicker.js.map +1 -1
  53. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.d.ts +2 -4
  54. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js +25 -14
  55. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMessageComponentAsRichTextEditBox.js.map +1 -1
  56. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.d.ts +6 -3
  57. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js +31 -13
  58. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js.map +1 -1
  59. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.d.ts +3 -2
  60. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js.map +1 -1
  61. package/dist/dist-esm/react-components/src/components/LocalVideoTile.d.ts +29 -29
  62. package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +6 -7
  63. package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
  64. package/dist/dist-esm/react-components/src/components/RemoteVideoTile.d.ts +28 -28
  65. package/dist/dist-esm/react-components/src/components/ResponsiveHorizontalGallery.d.ts +3 -3
  66. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.d.ts +30 -23
  67. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js +43 -27
  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.d.ts +4 -4
  70. package/dist/dist-esm/react-components/src/components/SendBox.js +42 -17
  71. package/dist/dist-esm/react-components/src/components/SendBox.js.map +1 -1
  72. package/dist/dist-esm/react-components/src/components/VideoGallery/OverflowGallery.d.ts +10 -10
  73. package/dist/dist-esm/react-components/src/components/VideoGallery/RemoteScreenShare.d.ts +13 -13
  74. package/dist/dist-esm/react-components/src/components/VideoGallery/ScrollableHorizontalGallery.d.ts +2 -2
  75. package/dist/dist-esm/react-components/src/components/VideoGallery/useVideoTileContextualMenuProps.d.ts +28 -28
  76. package/dist/dist-esm/react-components/src/components/index.d.ts +6 -6
  77. package/dist/dist-esm/react-components/src/components/index.js +3 -3
  78. package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
  79. package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.d.ts +4 -0
  80. package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.js +4 -0
  81. package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.js.map +1 -1
  82. package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js +0 -1
  83. package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js.map +1 -1
  84. package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.js +2 -1
  85. package/dist/dist-esm/react-components/src/components/styles/VideoTile.styles.js.map +1 -1
  86. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.d.ts +27 -2
  87. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js +14 -2
  88. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentAsEditBoxUtils.js.map +1 -1
  89. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.d.ts +4 -3
  90. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js +6 -5
  91. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js.map +1 -1
  92. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorStringsUtils.js +18 -18
  93. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorStringsUtils.js.map +1 -1
  94. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.d.ts +3 -3
  95. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js +1 -1
  96. package/dist/dist-esm/react-components/src/components/utils/SendBoxUtils.js.map +1 -1
  97. package/dist/dist-esm/react-components/src/components/utils/common.d.ts +1 -1
  98. package/dist/dist-esm/react-components/src/components/utils/common.js.map +1 -1
  99. package/dist/dist-esm/react-components/src/localization/locales/ar-SA/strings.json +18 -18
  100. package/dist/dist-esm/react-components/src/localization/locales/cs-CZ/strings.json +18 -18
  101. package/dist/dist-esm/react-components/src/localization/locales/de-DE/strings.json +18 -18
  102. package/dist/dist-esm/react-components/src/localization/locales/en-GB/strings.json +18 -18
  103. package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +38 -19
  104. package/dist/dist-esm/react-components/src/localization/locales/es-ES/strings.json +18 -18
  105. package/dist/dist-esm/react-components/src/localization/locales/fi-FI/strings.json +18 -18
  106. package/dist/dist-esm/react-components/src/localization/locales/fr-FR/strings.json +18 -18
  107. package/dist/dist-esm/react-components/src/localization/locales/he-IL/strings.json +18 -18
  108. package/dist/dist-esm/react-components/src/localization/locales/it-IT/strings.json +18 -18
  109. package/dist/dist-esm/react-components/src/localization/locales/ja-JP/strings.json +18 -18
  110. package/dist/dist-esm/react-components/src/localization/locales/ko-KR/strings.json +18 -18
  111. package/dist/dist-esm/react-components/src/localization/locales/nb-NO/strings.json +18 -18
  112. package/dist/dist-esm/react-components/src/localization/locales/nl-NL/strings.json +18 -18
  113. package/dist/dist-esm/react-components/src/localization/locales/pl-PL/strings.json +18 -18
  114. package/dist/dist-esm/react-components/src/localization/locales/pt-BR/strings.json +18 -18
  115. package/dist/dist-esm/react-components/src/localization/locales/ru-RU/strings.json +18 -18
  116. package/dist/dist-esm/react-components/src/localization/locales/sv-SE/strings.json +18 -18
  117. package/dist/dist-esm/react-components/src/localization/locales/tr-TR/strings.json +18 -18
  118. package/dist/dist-esm/react-components/src/localization/locales/zh-CN/strings.json +18 -18
  119. package/dist/dist-esm/react-components/src/localization/locales/zh-TW/strings.json +18 -18
  120. package/dist/dist-esm/react-components/src/theming/icons.js +3 -3
  121. package/dist/dist-esm/react-components/src/theming/icons.js.map +1 -1
  122. package/dist/dist-esm/react-components/src/types/Attachment.d.ts +21 -49
  123. package/dist/dist-esm/react-components/src/types/Attachment.js.map +1 -1
  124. package/dist/dist-esm/react-components/src/types/ChatMessage.d.ts +1 -1
  125. package/dist/dist-esm/react-components/src/types/ChatMessage.js.map +1 -1
  126. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +7 -6
  127. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +57 -30
  128. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
  129. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.d.ts +7 -0
  130. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js.map +1 -1
  131. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js +9 -4
  132. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js.map +1 -1
  133. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallReadinessModal.d.ts +6 -6
  134. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/usePeoplePane.d.ts +14 -14
  135. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/buttons/Camera.d.ts +7 -7
  136. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.d.ts +6 -2
  137. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.js +4 -0
  138. package/dist/dist-esm/react-composites/src/composites/CallComposite/selectors/baseSelectors.js.map +1 -1
  139. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.d.ts +1 -1
  140. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/spotlightUtils.d.ts +6 -6
  141. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +4 -15
  142. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +5 -76
  143. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
  144. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.d.ts +3 -23
  145. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.js.map +1 -1
  146. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.js +1 -0
  147. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.js.map +1 -1
  148. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.d.ts +5 -11
  149. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js +22 -40
  150. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedChatAdapter.js.map +1 -1
  151. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.d.ts +2 -9
  152. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.js +3 -6
  153. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.js.map +1 -1
  154. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +73 -15
  155. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
  156. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.d.ts +4 -17
  157. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +29 -89
  158. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js.map +1 -1
  159. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.d.ts +6 -19
  160. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapter.js.map +1 -1
  161. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.d.ts +0 -5
  162. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.js +0 -31
  163. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/ChatAdapterProvider.js.map +1 -1
  164. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.d.ts +66 -61
  165. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.js +33 -44
  166. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUpload.js.map +1 -1
  167. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.js +2 -2
  168. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.js.map +1 -1
  169. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.d.ts +1 -8
  170. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.js.map +1 -1
  171. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js +22 -10
  172. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useHandlers.js.map +1 -1
  173. package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.d.ts +1 -2
  174. package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.js.map +1 -1
  175. package/dist/dist-esm/react-composites/src/composites/ChatComposite/styles/Chat.styles.js +1 -1
  176. package/dist/dist-esm/react-composites/src/composites/ChatComposite/styles/Chat.styles.js.map +1 -1
  177. package/dist/dist-esm/react-composites/src/composites/common/Drawer/CaptionLanguageSettingsDrawer.d.ts +2 -2
  178. package/dist/dist-esm/react-composites/src/composites/common/Drawer/SpokenLanguageSettingsDrawer.d.ts +2 -2
  179. package/dist/dist-esm/react-composites/src/composites/common/PeoplePaneContent.d.ts +6 -6
  180. package/dist/dist-esm/react-composites/src/composites/common/Survey.d.ts +20 -7
  181. package/dist/dist-esm/react-composites/src/composites/common/SurveyContent.d.ts +1 -1
  182. package/dist/dist-esm/react-composites/src/composites/common/TagsSurvey.d.ts +2 -2
  183. package/dist/dist-esm/react-composites/src/composites/common/VideoEffectsPane.d.ts +1 -1
  184. package/package.json +5 -5
  185. package/dist/dist-cjs/communication-react/ChatMessageComponentAsRichTextEditBox-MqUGJDlB.js.map +0 -1
  186. package/dist/dist-cjs/communication-react/index-CY4kAQ6s.js.map +0 -1
  187. package/dist/dist-esm/react-components/src/components/AttachmentCard.js.map +0 -1
  188. package/dist/dist-esm/react-components/src/components/AttachmentCardGroup.js.map +0 -1
  189. package/dist/dist-esm/react-components/src/components/AttachmentDownloadCards.js.map +0 -1
  190. package/dist/dist-esm/react-components/src/components/AttachmentUploadCards.js.map +0 -1
  191. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationAttachmentUploadAdapter.d.ts +0 -48
  192. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationAttachmentUploadAdapter.js +0 -188
  193. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationAttachmentUploadAdapter.js.map +0 -1
  194. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useSelector.d.ts +0 -6
  195. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useSelector.js +0 -11
  196. package/dist/dist-esm/react-composites/src/composites/ChatComposite/hooks/useSelector.js.map +0 -1
  197. package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/attachmentUploadsSelector.d.ts +0 -29
  198. package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/attachmentUploadsSelector.js +0 -12
  199. package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/attachmentUploadsSelector.js.map +0 -1
  200. package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.d.ts +0 -12
  201. package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.js +0 -15
  202. package/dist/dist-esm/react-composites/src/composites/ChatComposite/selectors/baseSelectors.js.map +0 -1
  203. /package/dist/dist-esm/react-components/src/components/{AttachmentCardGroup.d.ts → Attachment/AttachmentCardGroup.d.ts} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"AttachmentCard.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/AttachmentCard.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO;AACL,iDAAiD;AACjD,IAAI,EACL,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,IAAI,EACJ,U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O,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC,GACD,CACH,CAAC,CAAC,CAAC,CACF,oBAAC,OAAO;QACN,oBAAC,IAAI;YACH,oBAAC,WAAW;gBACV,oBAAC,aAAa,IAAC,IAAI,EAAE,oBAAC,IAAI,IAAC,QAAQ,EAAC,oBAAoB,gBAAa,aAAa,CAAC,kBAAkB,GAAI,GAAI,CACjG;YACd,oBAAC,WAAW;gBACV,oBAAC,QAAQ,QACN,WAAW,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC,CACpC,oBAAC,QAAQ,IACP,GAAG,EAAE,KAAK,EACV,IAAI,EAAE,QAAQ,CAAC,IAAI,EACnB,OAAO,EAAE,GAAS,EAAE;wBAClB,IAAI,CAAC;4BACH,MAAM,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;wBACrC,CAAC;wBAAC,OAAO,CAAC,EAAE,CAAC;4BACX,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAI,CAAW,CAAC,OAAO,CAAC,CAAC;wBAC7C,CAAC;oBACH,CAAC,CAAA,IAEA,QAAQ,CAAC,IAAI,CACL,CACZ,CAAC,CACO,CACC,CACT,CACC,CACX,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport {\n // eslint-disable-next-line no-restricted-imports\n Icon\n} from '@fluentui/react';\nimport {\n Card,\n CardHeader,\n Text,\n Menu,\n MenuTrigger,\n ToolbarButton,\n MenuPopover,\n MenuItem,\n MenuList,\n Toolbar,\n CardFooter,\n ProgressBar\n} from '@fluentui/react-components';\nimport { getFileTypeIconProps } from '@fluentui/react-file-type-icons';\nimport React from 'react';\nimport { _pxToRem } from '@internal/acs-ui-common';\nimport { Announcer } from './Announcer';\nimport { useEffect, useState, useMemo } from 'react';\nimport { _AttachmentUploadCardsStrings } from './AttachmentUploadCards';\nimport { useLocaleAttachmentCardStringsTrampoline } from './utils/common';\nimport { AttachmentMetadata, AttachmentMenuAction, AttachmentMetadataWithProgress } from '../types/Attachment';\nimport { useAttachmentCardStyles, attachmentNameContainerClassName } from './styles/AttachmentCard.styles';\n\n/**\n * @internal\n * AttachmentCard Component Props.\n */\nexport interface _AttachmentCardProps {\n /**\n * Attachment details including name, extension, url, etc.\n */\n attachment: AttachmentMetadata | AttachmentMetadataWithProgress;\n /**\n * An array of menu actions to be displayed in the attachment card.\n */\n menuActions: AttachmentMenuAction[];\n /**\n * Optional aria label strings for attachment upload cards\n */\n strings?: _AttachmentUploadCardsStrings;\n /**\n * Optional callback that runs if menu bar action onclick throws.\n */\n onActionHandlerFailed?: (errMsg: string) => void;\n}\n\n/**\n * @internal\n * A component for displaying an attachment card with attachment icon and progress bar.\n *\n * `_AttachmentCard` internally uses the `Card` component from `@fluentui/react-components`. You can checkout the details about these components [here](https://react.fluentui.dev/?path=/docs/components-card).\n */\nexport const _AttachmentCard = (props: _AttachmentCardProps): JSX.Element => {\n const { attachment, menuActions, onActionHandlerFailed } = props;\n const attachmentCardStyles = useAttachmentCardStyles();\n\n const progress = useMemo(() => {\n return 'progress' in attachment ? attachment.progress : undefined;\n }, [attachment]);\n\n const isUploadComplete = useMemo(() => {\n return progress !== undefined && progress > 0 && progress < 1;\n }, [progress]);\n\n const [announcerString, setAnnouncerString] = useState<string | undefined>(undefined);\n const localeStrings = useLocaleAttachmentCardStringsTrampoline();\n const uploadStartedString = props.strings?.uploading ?? localeStrings.uploading;\n const uploadCompletedString = props.strings?.uploadCompleted ?? localeStrings.uploadCompleted;\n\n const showProgressIndicator = progress !== undefined && progress > 0 && progress < 1;\n\n useEffect(() => {\n if (showProgressIndicator) {\n setAnnouncerString(`${uploadStartedString} ${attachment.name}`);\n } else if (progress === 1) {\n setAnnouncerString(`${attachment.name} ${uploadCompletedString}`);\n } else {\n setAnnouncerString(undefined);\n }\n }, [progress, showProgressIndicator, attachment.name, uploadStartedString, uploadCompletedString]);\n\n return (\n <div data-is-focusable={true}>\n <Announcer announcementString={announcerString} ariaLive={'polite'} />\n <Card\n className={attachmentCardStyles.root}\n size=\"small\"\n role=\"listitem\"\n appearance=\"filled-alternative\"\n aria-label={attachment.name}\n >\n <CardHeader\n image={\n <Icon\n data-ui-id={'attachmenttype-icon'}\n iconName={\n getFileTypeIconProps({\n extension: useMemo((): string => {\n return attachment.extension ?? attachment.name.split('.').pop() ?? '';\n }, [attachment]),\n size: 24,\n imageFileType: 'svg'\n }).iconName\n }\n />\n }\n header={\n <div className={attachmentNameContainerClassName}>\n <Text title={attachment.name}>{attachment.name}</Text>\n </div>\n }\n action={MappedMenuItems(menuActions, attachment, onActionHandlerFailed)}\n />\n </Card>\n {isUploadComplete ? (\n <CardFooter>\n <ProgressBar thickness=\"medium\" value={progress} shape=\"rounded\" />\n </CardFooter>\n ) : (\n <> </>\n )}\n </div>\n );\n};\n\nconst MappedMenuItems = (\n menuActions: AttachmentMenuAction[],\n attachment: AttachmentMetadata,\n handleOnClickError?: (errMsg: string) => void\n): JSX.Element => {\n const localeStrings = useLocaleAttachmentCardStringsTrampoline();\n\n if (menuActions.length === 0) {\n return <></>;\n }\n return menuActions.length === 1 ? (\n <ToolbarButton\n aria-label={menuActions[0].name}\n icon={menuActions[0].icon}\n onClick={() => {\n try {\n menuActions[0].onClick(attachment);\n } catch (e) {\n handleOnClickError?.((e as Error).message);\n }\n }}\n />\n ) : (\n <Toolbar>\n <Menu>\n <MenuTrigger>\n <ToolbarButton icon={<Icon iconName=\"AttachmentMoreMenu\" aria-label={localeStrings.attachmentMoreMenu} />} />\n </MenuTrigger>\n <MenuPopover>\n <MenuList>\n {menuActions.map((menuItem, index) => (\n <MenuItem\n key={index}\n icon={menuItem.icon}\n onClick={async () => {\n try {\n await menuItem.onClick(attachment);\n } catch (e) {\n handleOnClickError?.((e as Error).message);\n }\n }}\n >\n {menuItem.name}\n </MenuItem>\n ))}\n </MenuList>\n </MenuPopover>\n </Menu>\n </Toolbar>\n );\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"AttachmentCardGroup.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/AttachmentCardGroup.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,mCAAgC;AACnD,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B;;;;GAIG;AAEH,MAAM,4BAA4B,GAAG,WAAW,CAAC;IAC/C,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE;QACP,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;KACpB;IACD;;OAEG;IACH,yBAAyB,EAAE;QACzB,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;KACxB;CACF,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAgC,EAAe,EAAE;IACpF,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IACtC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,yCAAK,CAAC;IACf,CAAC;IAED,OAAO,CACL,oBAAC,KAAK,IAAC,UAAU,QAAC,SAAS,EAAE,4BAA4B,gBAAc,SAAS,IAC7E,QAAQ,CACH,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { mergeStyles, Stack } from '@fluentui/react';\nimport { _pxToRem } from '@internal/acs-ui-common';\nimport React from 'react';\n\n/**\n * @internal\n * Props for `_AttachmentCardGroup` component.\n */\nexport interface _AttachmentCardGroupProps {\n children: React.ReactNode;\n ariaLabel?: string;\n}\n\n/**\n * Note: If we use stack tokens.childrenGap, when child elements are wrapped and moved to the next line,\n * an extra margin is added to the left of each line.\n * This is a workaround to avoid this issue.\n */\n\nconst attachmentCardGroupClassName = mergeStyles({\n flexFlow: 'row wrap',\n '& > *': {\n margin: _pxToRem(2)\n },\n /**\n * margin for children is overriden by parent stack, so adding left margin for each child\n */\n '& > *:not(:first-child)': {\n marginLeft: _pxToRem(2)\n }\n});\n\n/**\n * @internal\n * Used with `_AttachmentCard` component where `_AttachmentCard` components are passed as children.\n * Renders the children equally spaced in multiple rows.\n */\nexport const _AttachmentCardGroup = (props: _AttachmentCardGroupProps): JSX.Element => {\n const { children, ariaLabel } = props;\n if (!children) {\n return <></>;\n }\n\n return (\n <Stack horizontal className={attachmentCardGroupClassName} aria-label={ariaLabel}>\n {children}\n </Stack>\n );\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"AttachmentDownloadCards.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/AttachmentDownloadCards.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,qGAAqG;AACrG,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,sDAAsD;AACtD,OAAO,EAAE,6BAA6B,EAAE,MAAM,kCAAkC,CAAC;AAqDjF,MAAM,4BAA4B,GAAG;IACnC,SAAS,EAAE,SAAS;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,KAAoC,EAAe,EAAE;;IAC5F,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IACvC,MAAM,aAAa,GAAG,0BAA0B,EAAE,CAAC;IAEnD,MAAM,cAAc,GAAG,WAAW,CAChC,CACE,UAA8B,E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CAEA,2BAA2B,KAC9B,IAAI,EAAE,MAAM,CAAC,kBAAkB;KAElC,CAAC;AACJ,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAyB;IAC/D;;;;;;;;;;OAUG;IACH,IAAI,EAAE,UAAU;IAChB,6DAA6D;IAC7D,IAAI,EAAE,oBAAC,IAAI,IAAC,QAAQ,EAAC,oBAAoB,gBAAY,wCAAwC,GAAG;IAChG,wDAAwD;IACxD,OAAO,EAAE,CAAC,UAA8B,EAAE,EAAE;QAC1C,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YACnC,MAAM,CAAC,IAAI,CAAE,UAAiC,CAAC,GAAG,EAAE,QAAQ,EAAE,qBAAqB,CAAC,CAAC;YACrF,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Icon, TooltipHost } from '@fluentui/react';\nimport React, { useCallback } from 'react';\nimport { useMemo } from 'react';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { useLocale } from '../localization';\nimport { _AttachmentCard } from './AttachmentCard';\nimport { _AttachmentCardGroup } from './AttachmentCardGroup';\n/* @conditional-compile-remove(attachment-download) */\nimport { getAttachmentCountLiveMessage } from './ChatMessage/ChatMessageContent';\nimport { _formatString } from '@internal/acs-ui-common';\nimport { AttachmentMenuAction, AttachmentMetadata } from '../types/Attachment';\nimport { ChatMessage } from '../types';\n\n/**\n * Represents the type of attachment\n * @public\n */\nexport type ChatAttachmentType =\n | 'unknown'\n | 'image'\n | /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */ 'file';\n\n/**\n * Strings of _AttachmentDownloadCards that can be overridden.\n *\n * @internal\n */\nexport interface _AttachmentDownloadCardsStrings {\n /** Aria label to notify user when focus is on attachment download button. */\n downloadAttachment: string;\n /** Aria label to notify user when focus is on attachment open button. */\n openAttachment: string;\n attachmentCardGroupMessage: string;\n}\n\n/**\n * @internal\n */\nexport interface _AttachmentDownloadCardsProps {\n /**\n * A chat message metadata that includes attachment metadata\n */\n attachments?: AttachmentMetadata[];\n /**\n * A chat message metadata that includes attachment metadata\n */\n message?: ChatMessage;\n /**\n * Optional callback to handle attachment download\n */\n actionsForAttachment?: (attachment: AttachmentMetadata, message?: ChatMessage) => AttachmentMenuAction[];\n /**\n * Optional callback that runs if downloadHandler returns an error.\n */\n onActionHandlerFailed?: (errMsg: string) => void;\n /**\n * Optional aria label strings for attachment download cards\n */\n strings?: _AttachmentDownloadCardsStrings;\n}\n\nconst attachmentDownloadCardsStyle = {\n marginTop: '0.25rem'\n};\n\n/**\n * @internal\n */\nexport const _AttachmentDownloadCards = (props: _AttachmentDownloadCardsProps): JSX.Element => {\n const { attachments, message } = props;\n const localeStrings = useLocaleStringsTrampoline();\n\n const getMenuActions = useCallback(\n (\n attachment: AttachmentMetadata,\n localeStrings: _AttachmentDownloadCardsStrings,\n message?: ChatMessage,\n action?: (attachment: AttachmentMetadata, message?: ChatMessage) => AttachmentMenuAction[]\n ): AttachmentMenuAction[] => {\n const defaultMenuActions = getDefaultMenuActions(localeStrings, message);\n try {\n const actions = action?.(attachment, message);\n if (actions && actions.length > 0) {\n return actions;\n } else {\n return defaultMenuActions;\n }\n } catch (error) {\n return defaultMenuActions;\n }\n },\n []\n );\n\n const downloadAttachmentButtonString = useMemo(\n () => () => {\n return props.strings?.downloadAttachment ?? localeStrings.downloadAttachment;\n },\n [props.strings?.downloadAttachment, localeStrings.downloadAttachment]\n );\n\n const attachmentCardGroupDescription = useMemo(\n () => () => {\n /* @conditional-compile-remove(attachment-download) */\n return getAttachmentCountLiveMessage(\n attachments ?? [],\n props.strings?.attachmentCardGroupMessage ?? localeStrings.attachmentCardGroupMessage\n );\n return '';\n },\n [props.strings?.attachmentCardGroupMessage, localeStrings.attachmentCardGroupMessage, attachments]\n );\n\n if (!attachments || attachments.length === 0 || !attachments) {\n return <></>;\n }\n\n return (\n <div style={attachmentDownloadCardsStyle} data-ui-id=\"attachment-download-card-group\">\n <_AttachmentCardGroup ariaLabel={attachmentCardGroupDescription()}>\n {attachments &&\n attachments.map((attachment) => (\n <TooltipHost content={downloadAttachmentButtonString()} key={attachment.name}>\n <_AttachmentCard\n attachment={attachment}\n key={attachment.id}\n menuActions={getMenuActions(attachment, localeStrings, message, props.actionsForAttachment)}\n onActionHandlerFailed={props.onActionHandlerFailed}\n />\n </TooltipHost>\n ))}\n </_AttachmentCardGroup>\n </div>\n );\n};\n\n/**\n * @private\n */\nconst useLocaleStringsTrampoline = (): _AttachmentDownloadCardsStrings => {\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n return useLocale().strings.messageThread;\n return { downloadAttachment: '', openAttachment: '', attachmentCardGroupMessage: '' };\n};\n\n/**\n * @private\n */\nconst getDefaultMenuActions = (\n locale: _AttachmentDownloadCardsStrings,\n chatMessage?: ChatMessage\n): AttachmentMenuAction[] => {\n // if message is sent by a Teams user, we need to use a different icon (\"open\")\n if (chatMessage?.senderId?.includes('8:orgid:')) {\n return [\n {\n ...defaultAttachmentMenuAction,\n name: locale.openAttachment,\n icon: <Icon iconName=\"OpenAttachment\" />\n }\n ];\n }\n // otherwise, use the default icon (\"download\")\n return [\n {\n ...defaultAttachmentMenuAction,\n name: locale.downloadAttachment\n }\n ];\n};\n\n/**\n * @beta\n *\n * The default menu action for downloading attachments. This action will open the attachment's URL in a new tab.\n */\nexport const defaultAttachmentMenuAction: AttachmentMenuAction = {\n /**\n *\n * name is used for aria-label only when there's one button. For multiple buttons, it's used as a label.\n * by default it's an unlocalized string when this is used as a imported constant,\n * but you can overwrite it with your own localized string.\n *\n * i.e. defaultAttachmentMenuAction.name = localize('Download');\n *\n * when no action is provided, the UI library will overwrite this name\n * with a localized string this string when it's used in the UI.\n */\n name: 'Download',\n // this is the icon shown on the right of the attachment card\n icon: <Icon iconName=\"DownloadAttachment\" data-ui-id=\"attachment-download-card-download-icon\" />,\n // this is the action that runs when the icon is clicked\n onClick: (attachment: AttachmentMetadata) => {\n return new Promise<void>((resolve) => {\n window.open((attachment as AttachmentMetadata).url, '_blank', 'noopener,noreferrer');\n resolve();\n });\n }\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"AttachmentUploadCards.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/AttachmentUploadCards.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EAAE,wCAAwC,EAAE,MAAM,gBAAgB,CAAC;AAqC1E,MAAM,eAAe,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAE3C;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAiC,EAAe,EAAE;;IACvF,MAAM,WAAW,GAAG,KAAK,CAAC,uBAAuB,CAAC;IAClD,MAAM,aAAa,GAAG,wCAAwC,EAAE,CAAC;IACjE,MAAM,4BAA4B,GAAG,OAAO,CAC1C,GAAG,EAAE,CAAC,GAAG,EAAE;;QACT,OAAO,MAAA,MAAA,KAAK,CAAC,OAAO,0CAAE,gBAAgB,mCAAI,aAAa,CAAC,gBAAgB,CAAC;IAC3E,CAAC,EACD,CAAC,MAAA,KAAK,CAAC,OAAO,0CAAE,gBAAgB,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAClE,CAAC;IAEF,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7C,OAAO,yCAAK,CAAC;IACf,CAAC;IAED,OAAO,CACL,oBAAC,oBAAoB,QAClB,WAAW;QACV,WAAW;aACR,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC;aACzC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE;;YAAC,OAAA,CACnB,oBAAC,eAAe,IACd,UAAU,EAAE,UAAU,EACtB,GAAG,EAAE,UAAU,CAAC,EAAE,EAClB,WAAW,EAAE;oBACX;wBACE,IAAI,EAAE,MAAA,MAAA,KAAK,CAAC,OAAO,0CAAE,gBAAgB,mCAAI,QAAQ;wBACjD,IAAI,EAAE,CACJ,2CAAiB,4BAA4B,EAAE;4BAC7C,oBAAC,IAAI,IAAC,QAAQ,EAAC,wBAAwB,EAAC,SAAS,EAAE,WAAW,CAAC,eAAe,CAAC,GAAI,CAC/E,CACP;wBACD,OAAO,EAAE,CAAC,UAAU,EAAE,EAAE;4BACtB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gCACrC,IAAI,CAAC;oCACH,KAAK,CAAC,wBAAwB,IAAI,KAAK,CAAC,wBAAwB,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;oCAChF,OAAO,EAAE,CAAC;gCACZ,CAAC;gCAAC,OAAO,CAAC,EAAE,CAAC;oCACX,MAAM,CAAE,CAAW,CAAC,OAAO,CAAC,CAAC;gCAC/B,CAAC;4BACH,CAAC,CAAC,CAAC;wBACL,CAAC;qBACF;iBACF,EACD,OAAO,EAAE,KAAK,CAAC,OAAO,GACtB,CACH,CAAA;SAAA,CAAC,CACe,CACxB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Icon, mergeStyles } from '@fluentui/react';\nimport React, { useMemo } from 'react';\nimport { _AttachmentCard } from './AttachmentCard';\nimport { _AttachmentCardGroup } from './AttachmentCardGroup';\nimport { AttachmentMetadataWithProgress } from '../types/Attachment';\nimport { useLocaleAttachmentCardStringsTrampoline } from './utils/common';\n\n/**\n * Strings of _AttachmentUploadCards that can be overridden.\n *\n * @internal\n */\nexport interface _AttachmentUploadCardsStrings {\n /** Aria label to notify user when focus is on cancel attachment upload button. */\n removeAttachment: string;\n /** Aria label to notify user attachment uploading starts. */\n uploading: string;\n /** Aria label to notify user attachment is uploaded. */\n uploadCompleted: string;\n /** Aria label to notify user more attachment action menu. */\n attachmentMoreMenu: string;\n}\n\n/**\n * @internal\n */\nexport interface AttachmentUploadCardsProps {\n /**\n * Optional array of {@link AttachmentMetadataWithProgress}\n */\n attachmentsWithProgress?: AttachmentMetadataWithProgress[];\n /**\n * Optional callback to remove the attachment upload before sending by clicking on\n * cancel icon.\n */\n onCancelAttachmentUpload?: (attachmentId: string) => void;\n /**\n * Optional arialabel strings for attachment upload cards\n */\n strings?: _AttachmentUploadCardsStrings;\n}\n\nconst actionIconStyle = { height: '1rem' };\n\n/**\n * @internal\n */\nexport const _AttachmentUploadCards = (props: AttachmentUploadCardsProps): JSX.Element => {\n const attachments = props.attachmentsWithProgress;\n const localeStrings = useLocaleAttachmentCardStringsTrampoline();\n const removeAttachmentButtonString = useMemo(\n () => () => {\n return props.strings?.removeAttachment ?? localeStrings.removeAttachment;\n },\n [props.strings?.removeAttachment, localeStrings.removeAttachment]\n );\n\n if (!attachments || attachments.length === 0) {\n return <></>;\n }\n\n return (\n <_AttachmentCardGroup>\n {attachments &&\n attachments\n .filter((attachment) => !attachment.error)\n .map((attachment) => (\n <_AttachmentCard\n attachment={attachment}\n key={attachment.id}\n menuActions={[\n {\n name: props.strings?.removeAttachment ?? 'Remove',\n icon: (\n <div aria-label={removeAttachmentButtonString()}>\n <Icon iconName=\"CancelAttachmentUpload\" className={mergeStyles(actionIconStyle)} />\n </div>\n ),\n onClick: (attachment) => {\n return new Promise((resolve, reject) => {\n try {\n props.onCancelAttachmentUpload && props.onCancelAttachmentUpload(attachment.id);\n resolve();\n } catch (e) {\n reject((e as Error).message);\n }\n });\n }\n }\n ]}\n strings={props.strings}\n />\n ))}\n </_AttachmentCardGroup>\n );\n};\n"]}
@@ -1,48 +0,0 @@
1
- import { AttachmentUploadTask, AttachmentMetadata, AttachmentMetadataWithProgress } from "../../../../../react-components/src";
2
- import { FileSharingMetadata } from '../file-sharing';
3
- import { ChatContext } from './AzureCommunicationChatAdapter';
4
- /**
5
- * A record containing {@link AttachmentMetadata} mapped to unique attachment upload task ids.
6
- * @internal
7
- */
8
- export type _AttachmentUploadsUiState = Record<string, AttachmentMetadataWithProgress>;
9
- /**
10
- * @internal
11
- */
12
- export interface _AttachmentUploadAdapter {
13
- registerActiveUploads: (files: File[]) => AttachmentUploadTask[];
14
- registerCompletedUploads: (metadata: AttachmentMetadata[]) => AttachmentUploadTask[];
15
- clearUploads: () => void;
16
- cancelUpload: (id: string) => void;
17
- updateUploadProgress: (id: string, progress: number) => void;
18
- updateUploadStatusMessage: (id: string, errorMessage: string) => void;
19
- updateUploadMetadata: (id: string, metadata: AttachmentMetadata) => void;
20
- }
21
- /**
22
- * @internal
23
- */
24
- export declare class AzureCommunicationAttachmentUploadAdapter implements _AttachmentUploadAdapter {
25
- private context;
26
- private attachmentUploads;
27
- constructor(chatContext: ChatContext);
28
- private findAttachmentUpload;
29
- private deleteAttachmentUploads;
30
- private deleteErroneousAttachmentUploads;
31
- private registerAttachmentUploads;
32
- registerActiveUploads(files: File[]): AttachmentUploadTask[];
33
- registerCompletedUploads(metadata: AttachmentMetadata[]): AttachmentUploadTask[];
34
- clearUploads(): void;
35
- cancelUpload(id: string): void;
36
- updateUploadProgress(id: string, progress: number): void;
37
- updateUploadStatusMessage(id: string, errorMessage: string): void;
38
- updateUploadMetadata(id: string, metadata: AttachmentMetadata): void;
39
- setAttachmentMetadata(taskId: string, attachmentId: string, attachmentUrl: string): void;
40
- private subscribeAllEvents;
41
- private unsubscribeAllEvents;
42
- }
43
- /**
44
- * @param attachmentUploadUiState {@link _AttachmentUploadsUiState}
45
- * @private
46
- */
47
- export declare const convertAttachmentUploadsUiStateToMessageMetadata: (attachmentUploads?: _AttachmentUploadsUiState) => FileSharingMetadata | undefined;
48
- //# sourceMappingURL=AzureCommunicationAttachmentUploadAdapter.d.ts.map
@@ -1,188 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
- /* @conditional-compile-remove(attachment-upload) */
4
- import { produce } from 'immer';
5
- /* @conditional-compile-remove(attachment-upload) */
6
- import { AttachmentUpload } from '../file-sharing';
7
- /* @conditional-compile-remove(attachment-upload) */
8
- /**
9
- * @internal
10
- */
11
- class AttachmentUploadContext {
12
- constructor(chatContext) {
13
- this.chatContext = chatContext;
14
- }
15
- getAttachmentUploads() {
16
- return this.chatContext.getState()._attachmentUploads;
17
- }
18
- addAttachmentUploads(attachmentUploads) {
19
- const attachmentUploadsMap = convertObservableAttachmentUploadToAttachmentUploadsUiState(attachmentUploads);
20
- this.chatContext.setState(produce(this.chatContext.getState(), (draft) => {
21
- draft._attachmentUploads = draft._attachmentUploads || {};
22
- draft._attachmentUploads = Object.assign(Object.assign({}, draft._attachmentUploads), attachmentUploadsMap);
23
- }));
24
- }
25
- clearUploads() {
26
- this.chatContext.setState(produce(this.chatContext.getState(), (draft) => {
27
- draft._attachmentUploads = {};
28
- }));
29
- }
30
- updateAttachmentUpload(id, data) {
31
- this.chatContext.setState(produce(this.chatContext.getState(), (draft) => {
32
- var _a, _b, _c, _d;
33
- if ((_a = draft._attachmentUploads) === null || _a === void 0 ? void 0 : _a[id]) {
34
- draft._attachmentUploads[(_b = data.id) !== null && _b !== void 0 ? _b : id] = Object.assign(Object.assign({}, (_c = draft._attachmentUploads) === null || _c === void 0 ? void 0 : _c[id]), data);
35
- if (data.id) {
36
- (_d = draft._attachmentUploads) === null || _d === void 0 ? true : delete _d[id];
37
- }
38
- }
39
- }));
40
- }
41
- deleteAttachmentUploads(ids) {
42
- this.chatContext.setState(produce(this.chatContext.getState(), (draft) => {
43
- ids.forEach((id) => {
44
- var _a;
45
- const keys = Object.keys((_a = draft === null || draft === void 0 ? void 0 : draft._attachmentUploads) !== null && _a !== void 0 ? _a : []).filter((rawID) => { var _a; return ((_a = draft._attachmentUploads) === null || _a === void 0 ? void 0 : _a[rawID].id) === id; });
46
- keys.forEach((key) => {
47
- var _a;
48
- (_a = draft._attachmentUploads) === null || _a === void 0 ? true : delete _a[key];
49
- });
50
- });
51
- }));
52
- }
53
- }
54
- /* @conditional-compile-remove(attachment-upload) */
55
- /**
56
- * @internal
57
- */
58
- export class AzureCommunicationAttachmentUploadAdapter {
59
- constructor(chatContext) {
60
- this.attachmentUploads = [];
61
- this.context = new AttachmentUploadContext(chatContext);
62
- }
63
- findAttachmentUpload(id) {
64
- return this.attachmentUploads.find((attachmentUpload) => attachmentUpload.taskId === id);
65
- }
66
- deleteAttachmentUploads(ids) {
67
- this.attachmentUploads = this.attachmentUploads.filter((attachmentUpload) => !ids.includes(attachmentUpload.taskId));
68
- this.context.deleteAttachmentUploads(ids);
69
- }
70
- deleteErroneousAttachmentUploads() {
71
- const attachmentUploads = this.context.getAttachmentUploads() || {};
72
- const ids = Object.values(attachmentUploads)
73
- .filter((item) => item.error)
74
- .map((item) => item.id);
75
- ids.forEach((id) => {
76
- const attachmentUpload = this.findAttachmentUpload(id);
77
- this.unsubscribeAllEvents(attachmentUpload);
78
- });
79
- this.deleteAttachmentUploads(ids);
80
- }
81
- registerAttachmentUploads(files) {
82
- this.deleteErroneousAttachmentUploads();
83
- const attachmentUploads = [];
84
- files.forEach((file) => attachmentUploads.push(new AttachmentUpload(file)));
85
- attachmentUploads.forEach((attachmentUpload) => this.subscribeAllEvents(attachmentUpload));
86
- this.attachmentUploads = this.attachmentUploads.concat(attachmentUploads);
87
- this.context.addAttachmentUploads(attachmentUploads);
88
- return attachmentUploads;
89
- }
90
- registerActiveUploads(files) {
91
- return this.registerAttachmentUploads(files);
92
- }
93
- registerCompletedUploads(metadata) {
94
- return this.registerAttachmentUploads(metadata);
95
- }
96
- clearUploads() {
97
- this.context.clearUploads();
98
- this.attachmentUploads.forEach((attachmentUpload) => this.unsubscribeAllEvents(attachmentUpload));
99
- this.attachmentUploads = [];
100
- }
101
- cancelUpload(id) {
102
- this.deleteErroneousAttachmentUploads();
103
- const attachmentUpload = this.findAttachmentUpload(id);
104
- this.unsubscribeAllEvents(attachmentUpload);
105
- this.deleteAttachmentUploads([id]);
106
- }
107
- updateUploadProgress(id, progress) {
108
- this.context.updateAttachmentUpload(id, { progress });
109
- }
110
- updateUploadStatusMessage(id, errorMessage) {
111
- this.context.updateAttachmentUpload(id, {
112
- error: {
113
- message: errorMessage
114
- }
115
- });
116
- }
117
- updateUploadMetadata(id, metadata) {
118
- this.context.updateAttachmentUpload(id, {
119
- progress: 1,
120
- id: metadata.id,
121
- name: metadata.name,
122
- url: metadata.url,
123
- extension: metadata.extension
124
- });
125
- }
126
- setAttachmentMetadata(taskId, attachmentId, attachmentUrl) {
127
- const attachmentUpload = this.findAttachmentUpload(taskId);
128
- this.context.updateAttachmentUpload(taskId, {
129
- progress: 1,
130
- id: attachmentId,
131
- name: attachmentUpload === null || attachmentUpload === void 0 ? void 0 : attachmentUpload.name,
132
- url: attachmentUrl,
133
- extension: (attachmentUpload === null || attachmentUpload === void 0 ? void 0 : attachmentUpload.name.split('.').pop()) || ''
134
- });
135
- }
136
- subscribeAllEvents(attachmentUpload) {
137
- attachmentUpload.on('uploadProgressChange', this.updateUploadProgress.bind(this));
138
- attachmentUpload.on('uploadComplete', this.setAttachmentMetadata.bind(this));
139
- attachmentUpload.on('uploadFail', this.updateUploadStatusMessage.bind(this));
140
- }
141
- unsubscribeAllEvents(attachmentUpload) {
142
- attachmentUpload === null || attachmentUpload === void 0 ? void 0 : attachmentUpload.off('uploadProgressChange', this.updateUploadProgress.bind(this));
143
- attachmentUpload === null || attachmentUpload === void 0 ? void 0 : attachmentUpload.off('uploadComplete', this.setAttachmentMetadata.bind(this));
144
- attachmentUpload === null || attachmentUpload === void 0 ? void 0 : attachmentUpload.off('uploadFail', this.updateUploadStatusMessage.bind(this));
145
- }
146
- }
147
- /* @conditional-compile-remove(attachment-upload) */
148
- /**
149
- * @param attachmentUploadUiState {@link _AttachmentUploadsUiState}
150
- * @private
151
- */
152
- export const convertAttachmentUploadsUiStateToMessageMetadata = (attachmentUploads) => {
153
- if (attachmentUploads) {
154
- const attachmentMetadata = [];
155
- Object.keys(attachmentUploads).forEach((key) => {
156
- const attachment = attachmentUploads[key];
157
- if (attachment && !attachment.error) {
158
- attachmentMetadata.push({
159
- id: attachment.id,
160
- name: attachment.name,
161
- extension: attachment.extension,
162
- url: attachment.url,
163
- progress: attachment.progress
164
- });
165
- }
166
- });
167
- if (attachmentMetadata.length > 0) {
168
- return { fileSharingMetadata: JSON.stringify(attachmentMetadata) };
169
- }
170
- }
171
- return undefined;
172
- };
173
- /* @conditional-compile-remove(attachment-upload) */
174
- /**
175
- * @private
176
- */
177
- const convertObservableAttachmentUploadToAttachmentUploadsUiState = (attachmentUploads) => {
178
- return attachmentUploads.reduce((map, attachmentUpload) => {
179
- map[attachmentUpload.taskId] = {
180
- id: attachmentUpload.taskId,
181
- name: attachmentUpload.name,
182
- progress: 0,
183
- extension: attachmentUpload.name.split('.').pop() || ''
184
- };
185
- return map;
186
- }, {});
187
- };
188
- //# sourceMappingURL=AzureCommunicationAttachmentUploadAdapter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AzureCommunicationAttachmentUploadAdapter.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/adapter/AzureCommunicationAttachmentUploadAdapter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,oDAAoD;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,oDAAoD;AACpD,OAAO,EAAuB,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAyBxE,oDAAoD;AACpD;;GAEG;AACH,MAAM,uBAAuB;IAG3B,YAAY,WAAwB;QAClC,IAAI,CAAC,WAAW,GAAG,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E,gBAAgB,EAAE,EAAE;QACnF,GAAG,CAAC,gBAAgB,CAAC,MAAM,CAAC,GAAG;YAC7B,EAAE,EAAE,gBAAgB,CAAC,MAAM;YAC3B,IAAI,EAAE,gBAAgB,CAAC,IAAI;YAC3B,QAAQ,EAAE,CAAC;YACX,SAAS,EAAE,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE;SACxD,CAAC;QACF,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AttachmentUploadTask, AttachmentMetadata, AttachmentMetadataWithProgress } from '@internal/react-components';\n/* @conditional-compile-remove(attachment-upload) */\nimport { produce } from 'immer';\n/* @conditional-compile-remove(attachment-upload) */\nimport { FileSharingMetadata, AttachmentUpload } from '../file-sharing';\n/* @conditional-compile-remove(attachment-upload) */\nimport { ChatContext } from './AzureCommunicationChatAdapter';\n/* @conditional-compile-remove(attachment-upload) */\nimport { ChatAdapterState } from './ChatAdapter';\n\n/**\n * A record containing {@link AttachmentMetadata} mapped to unique attachment upload task ids.\n * @internal\n */\nexport type _AttachmentUploadsUiState = Record<string, AttachmentMetadataWithProgress>;\n\n/**\n * @internal\n */\nexport interface _AttachmentUploadAdapter {\n registerActiveUploads: (files: File[]) => AttachmentUploadTask[];\n registerCompletedUploads: (metadata: AttachmentMetadata[]) => AttachmentUploadTask[];\n clearUploads: () => void;\n cancelUpload: (id: string) => void;\n updateUploadProgress: (id: string, progress: number) => void;\n updateUploadStatusMessage: (id: string, errorMessage: string) => void;\n updateUploadMetadata: (id: string, metadata: AttachmentMetadata) => void;\n}\n\n/* @conditional-compile-remove(attachment-upload) */\n/**\n * @internal\n */\nclass AttachmentUploadContext {\n private chatContext: ChatContext;\n\n constructor(chatContext: ChatContext) {\n this.chatContext = chatContext;\n }\n\n public getAttachmentUploads(): _AttachmentUploadsUiState | undefined {\n return this.chatContext.getState()._attachmentUploads;\n }\n\n public addAttachmentUploads(attachmentUploads: AttachmentUpload[]): void {\n const attachmentUploadsMap = convertObservableAttachmentUploadToAttachmentUploadsUiState(attachmentUploads);\n this.chatContext.setState(\n produce(this.chatContext.getState(), (draft) => {\n draft._attachmentUploads = draft._attachmentUploads || {};\n draft._attachmentUploads = { ...draft._attachmentUploads, ...attachmentUploadsMap };\n })\n );\n }\n\n public clearUploads(): void {\n this.chatContext.setState(\n produce(this.chatContext.getState(), (draft: ChatAdapterState) => {\n draft._attachmentUploads = {};\n })\n );\n }\n\n public updateAttachmentUpload(\n id: string,\n data: Partial<Pick<AttachmentMetadataWithProgress, 'progress' | 'id' | 'name' | 'extension' | 'error' | 'url'>>\n ): void {\n this.chatContext.setState(\n produce(this.chatContext.getState(), (draft: ChatAdapterState) => {\n if (draft._attachmentUploads?.[id]) {\n draft._attachmentUploads[data.id ?? id] = {\n ...draft._attachmentUploads?.[id],\n ...data\n };\n if (data.id) {\n delete draft._attachmentUploads?.[id];\n }\n }\n })\n );\n }\n\n public deleteAttachmentUploads(ids: string[]): void {\n this.chatContext.setState(\n produce(this.chatContext.getState(), (draft: ChatAdapterState) => {\n ids.forEach((id) => {\n const keys = Object.keys(draft?._attachmentUploads ?? []).filter(\n (rawID) => draft._attachmentUploads?.[rawID].id === id\n );\n keys.forEach((key) => {\n delete draft._attachmentUploads?.[key];\n });\n });\n })\n );\n }\n}\n\n/* @conditional-compile-remove(attachment-upload) */\n/**\n * @internal\n */\nexport class AzureCommunicationAttachmentUploadAdapter implements _AttachmentUploadAdapter {\n private context: AttachmentUploadContext;\n private attachmentUploads: AttachmentUpload[] = [];\n\n constructor(chatContext: ChatContext) {\n this.context = new AttachmentUploadContext(chatContext);\n }\n\n private findAttachmentUpload(id: string): AttachmentUpload | undefined {\n return this.attachmentUploads.find((attachmentUpload) => attachmentUpload.taskId === id);\n }\n\n private deleteAttachmentUploads(ids: string[]): void {\n this.attachmentUploads = this.attachmentUploads.filter(\n (attachmentUpload) => !ids.includes(attachmentUpload.taskId)\n );\n this.context.deleteAttachmentUploads(ids);\n }\n\n private deleteErroneousAttachmentUploads(): void {\n const attachmentUploads = this.context.getAttachmentUploads() || {};\n const ids = Object.values(attachmentUploads)\n .filter((item: AttachmentMetadataWithProgress) => item.error)\n .map((item: AttachmentMetadataWithProgress) => item.id);\n\n ids.forEach((id) => {\n const attachmentUpload = this.findAttachmentUpload(id);\n this.unsubscribeAllEvents(attachmentUpload);\n });\n\n this.deleteAttachmentUploads(ids);\n }\n\n private registerAttachmentUploads(files: File[] | AttachmentMetadata[]): AttachmentUploadTask[] {\n this.deleteErroneousAttachmentUploads();\n const attachmentUploads: AttachmentUpload[] = [];\n files.forEach((file) => attachmentUploads.push(new AttachmentUpload(file)));\n attachmentUploads.forEach((attachmentUpload) => this.subscribeAllEvents(attachmentUpload));\n this.attachmentUploads = this.attachmentUploads.concat(attachmentUploads);\n this.context.addAttachmentUploads(attachmentUploads);\n return attachmentUploads;\n }\n\n registerActiveUploads(files: File[]): AttachmentUploadTask[] {\n return this.registerAttachmentUploads(files);\n }\n\n registerCompletedUploads(metadata: AttachmentMetadata[]): AttachmentUploadTask[] {\n return this.registerAttachmentUploads(metadata);\n }\n\n clearUploads(): void {\n this.context.clearUploads();\n this.attachmentUploads.forEach((attachmentUpload) => this.unsubscribeAllEvents(attachmentUpload));\n this.attachmentUploads = [];\n }\n\n cancelUpload(id: string): void {\n this.deleteErroneousAttachmentUploads();\n const attachmentUpload = this.findAttachmentUpload(id);\n this.unsubscribeAllEvents(attachmentUpload);\n this.deleteAttachmentUploads([id]);\n }\n\n updateUploadProgress(id: string, progress: number): void {\n this.context.updateAttachmentUpload(id, { progress });\n }\n\n updateUploadStatusMessage(id: string, errorMessage: string): void {\n this.context.updateAttachmentUpload(id, {\n error: {\n message: errorMessage\n }\n });\n }\n\n updateUploadMetadata(id: string, metadata: AttachmentMetadata): void {\n this.context.updateAttachmentUpload(id, {\n progress: 1,\n id: metadata.id,\n name: metadata.name,\n url: metadata.url,\n extension: metadata.extension\n });\n }\n\n setAttachmentMetadata(taskId: string, attachmentId: string, attachmentUrl: string): void {\n const attachmentUpload = this.findAttachmentUpload(taskId);\n this.context.updateAttachmentUpload(taskId, {\n progress: 1,\n id: attachmentId,\n name: attachmentUpload?.name,\n url: attachmentUrl,\n extension: attachmentUpload?.name.split('.').pop() || ''\n });\n }\n\n private subscribeAllEvents(attachmentUpload: AttachmentUpload): void {\n attachmentUpload.on('uploadProgressChange', this.updateUploadProgress.bind(this));\n attachmentUpload.on('uploadComplete', this.setAttachmentMetadata.bind(this));\n attachmentUpload.on('uploadFail', this.updateUploadStatusMessage.bind(this));\n }\n\n private unsubscribeAllEvents(attachmentUpload?: AttachmentUpload): void {\n attachmentUpload?.off('uploadProgressChange', this.updateUploadProgress.bind(this));\n attachmentUpload?.off('uploadComplete', this.setAttachmentMetadata.bind(this));\n attachmentUpload?.off('uploadFail', this.updateUploadStatusMessage.bind(this));\n }\n}\n\n/* @conditional-compile-remove(attachment-upload) */\n/**\n * @param attachmentUploadUiState {@link _AttachmentUploadsUiState}\n * @private\n */\nexport const convertAttachmentUploadsUiStateToMessageMetadata = (\n attachmentUploads?: _AttachmentUploadsUiState\n): FileSharingMetadata | undefined => {\n if (attachmentUploads) {\n const attachmentMetadata: AttachmentMetadataWithProgress[] = [];\n Object.keys(attachmentUploads).forEach((key) => {\n const attachment = attachmentUploads[key];\n if (attachment && !attachment.error) {\n attachmentMetadata.push({\n id: attachment.id,\n name: attachment.name,\n extension: attachment.extension,\n url: attachment.url,\n progress: attachment.progress\n });\n }\n });\n if (attachmentMetadata.length > 0) {\n return { fileSharingMetadata: JSON.stringify(attachmentMetadata) };\n }\n }\n return undefined;\n};\n\n/* @conditional-compile-remove(attachment-upload) */\n/**\n * @private\n */\nconst convertObservableAttachmentUploadToAttachmentUploadsUiState = (\n attachmentUploads: AttachmentUpload[]\n): _AttachmentUploadsUiState => {\n return attachmentUploads.reduce((map: _AttachmentUploadsUiState, attachmentUpload) => {\n map[attachmentUpload.taskId] = {\n id: attachmentUpload.taskId,\n name: attachmentUpload.name,\n progress: 0,\n extension: attachmentUpload.name.split('.').pop() || ''\n };\n return map;\n }, {});\n};\n"]}
@@ -1,6 +0,0 @@
1
- import { ChatAdapterState } from '../adapter/ChatAdapter';
2
- /**
3
- * @private
4
- */
5
- export declare const useSelector: <SelectorT extends (state: ChatAdapterState, props: any) => any>(selector: SelectorT, selectorProps?: Parameters<SelectorT>[1]) => ReturnType<SelectorT>;
6
- //# sourceMappingURL=useSelector.d.ts.map
@@ -1,11 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
- import { useSelectorWithAdaptation } from './useAdaptedSelector';
4
- /**
5
- * @private
6
- */
7
- export const useSelector = (selector, selectorProps) => {
8
- // use selector with no adaptation
9
- return useSelectorWithAdaptation(selector, (state) => state, selectorProps);
10
- };
11
- //# sourceMappingURL=useSelector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useSelector.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/hooks/useSelector.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,QAAmB,EACnB,aAAwC,EACjB,EAAE;IACzB,kCAAkC;IAClC,OAAO,yBAAyB,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;AAC9E,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { ChatAdapterState } from '../adapter/ChatAdapter';\nimport { useSelectorWithAdaptation } from './useAdaptedSelector';\n\n/**\n * @private\n */\nexport const useSelector = <SelectorT extends (state: ChatAdapterState, props: any) => any>(\n selector: SelectorT,\n selectorProps?: Parameters<SelectorT>[1]\n): ReturnType<SelectorT> => {\n // use selector with no adaptation\n return useSelectorWithAdaptation(selector, (state) => state, selectorProps);\n};\n"]}
@@ -1,29 +0,0 @@
1
- /**
2
- * @private
3
- */
4
- export declare const attachmentUploadsSelector: ((state: import("index").ChatAdapterUiState & import("index").ChatCompositeClientState) => {
5
- attachments: {
6
- uploadComplete: boolean;
7
- progress?: number | undefined;
8
- error?: import("index").AttachmentProgressError | undefined;
9
- extension?: string | undefined;
10
- id: string;
11
- name: string;
12
- url?: string | undefined;
13
- }[];
14
- }) & import("reselect").OutputSelectorFields<(args_0: import("index")._AttachmentUploadsUiState | undefined) => {
15
- attachments: {
16
- uploadComplete: boolean;
17
- progress?: number | undefined;
18
- error?: import("index").AttachmentProgressError | undefined;
19
- extension?: string | undefined;
20
- id: string;
21
- name: string;
22
- url?: string | undefined;
23
- }[];
24
- }, {
25
- clearCache: () => void;
26
- }> & {
27
- clearCache: () => void;
28
- };
29
- //# sourceMappingURL=attachmentUploadsSelector.d.ts.map
@@ -1,12 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
- import { createSelector } from 'reselect';
4
- import { getAttachmentUploads } from './baseSelectors';
5
- /**
6
- * @private
7
- */
8
- export const attachmentUploadsSelector = createSelector([getAttachmentUploads], (attachmentUploads) => {
9
- const attachments = Object.values(attachmentUploads || {}).map((attachmentUpload) => (Object.assign(Object.assign({}, attachmentUpload), { uploadComplete: !!attachmentUpload })));
10
- return { attachments };
11
- });
12
- //# sourceMappingURL=attachmentUploadsSelector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"attachmentUploadsSelector.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/selectors/attachmentUploadsSelector.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,cAAc,CAAC,CAAC,oBAAoB,CAAC,EAAE,CAAC,iBAAiB,EAAE,EAAE;IACpG,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,gBAAgB,EAAE,EAAE,CAAC,iCAChF,gBAAgB,KACnB,cAAc,EAAE,CAAC,CAAC,gBAAgB,IAClC,CAAC,CAAC;IACJ,OAAO,EAAE,WAAW,EAAE,CAAC;AACzB,CAAC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createSelector } from 'reselect';\nimport { getAttachmentUploads } from './baseSelectors';\n\n/**\n * @private\n */\nexport const attachmentUploadsSelector = createSelector([getAttachmentUploads], (attachmentUploads) => {\n const attachments = Object.values(attachmentUploads || {}).map((attachmentUpload) => ({\n ...attachmentUpload,\n uploadComplete: !!attachmentUpload\n }));\n return { attachments };\n});\n"]}
@@ -1,12 +0,0 @@
1
- import { CommunicationIdentifierKind } from '@azure/communication-common';
2
- import { ChatAdapterState } from '../adapter/ChatAdapter';
3
- import { _AttachmentUploadsUiState } from '../adapter/AzureCommunicationAttachmentUploadAdapter';
4
- /**
5
- * @private
6
- */
7
- export declare const getUserId: (state: ChatAdapterState) => CommunicationIdentifierKind;
8
- /**
9
- * @private
10
- */
11
- export declare const getAttachmentUploads: (state: ChatAdapterState) => _AttachmentUploadsUiState | undefined;
12
- //# sourceMappingURL=baseSelectors.d.ts.map
@@ -1,15 +0,0 @@
1
- // Copyright (c) Microsoft Corporation.
2
- // Licensed under the MIT License.
3
- /**
4
- * @private
5
- */
6
- export const getUserId = (state) => state.userId;
7
- /**
8
- * @private
9
- */
10
- export const getAttachmentUploads = (state) => {
11
- /* @conditional-compile-remove(attachment-upload) */
12
- return state === null || state === void 0 ? void 0 : state._attachmentUploads;
13
- return undefined;
14
- };
15
- //# sourceMappingURL=baseSelectors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"baseSelectors.js","sourceRoot":"","sources":["../../../../../../../../react-composites/src/composites/ChatComposite/selectors/baseSelectors.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAuB,EAA+B,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;AAEhG;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAuB,EAAyC,EAAE;IACrG,oDAAoD;IACpD,OAAO,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,kBAAkB,CAAC;IACjC,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { CommunicationIdentifierKind } from '@azure/communication-common';\nimport { ChatAdapterState } from '../adapter/ChatAdapter';\nimport { _AttachmentUploadsUiState } from '../adapter/AzureCommunicationAttachmentUploadAdapter';\n\n/**\n * @private\n */\nexport const getUserId = (state: ChatAdapterState): CommunicationIdentifierKind => state.userId;\n\n/**\n * @private\n */\nexport const getAttachmentUploads = (state: ChatAdapterState): _AttachmentUploadsUiState | undefined => {\n /* @conditional-compile-remove(attachment-upload) */\n return state?._attachmentUploads;\n return undefined;\n};\n"]}