@azure/communication-react 1.14.1-alpha-202403270012 → 1.14.1-alpha-202403290012

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 (155) hide show
  1. package/dist/communication-react.d.ts +203 -63
  2. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-Yty3fOoA.js → RichTextSendBoxWrapper-CH6WvEGZ.js} +7 -4
  3. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-Yty3fOoA.js.map → RichTextSendBoxWrapper-CH6WvEGZ.js.map} +1 -1
  4. package/dist/dist-cjs/communication-react/{index-BEomNZbT.js → index-qxnuqL7s.js} +1017 -321
  5. package/dist/dist-cjs/communication-react/index-qxnuqL7s.js.map +1 -0
  6. package/dist/dist-cjs/communication-react/index.js +6 -3
  7. package/dist/dist-cjs/communication-react/index.js.map +1 -1
  8. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  9. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  10. package/dist/dist-esm/calling-stateful-client/src/CallClientState.d.ts +5 -0
  11. package/dist/dist-esm/calling-stateful-client/src/CallClientState.js.map +1 -1
  12. package/dist/dist-esm/calling-stateful-client/src/CallContext.js +2 -0
  13. package/dist/dist-esm/calling-stateful-client/src/CallContext.js.map +1 -1
  14. package/dist/dist-esm/calling-stateful-client/src/Converter.js +6 -2
  15. package/dist/dist-esm/calling-stateful-client/src/Converter.js.map +1 -1
  16. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js +1 -2
  17. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js.map +1 -1
  18. package/dist/dist-esm/communication-react/src/index.d.ts +1 -1
  19. package/dist/dist-esm/communication-react/src/index.js.map +1 -1
  20. package/dist/dist-esm/react-components/src/components/AttachmentCard.d.ts +11 -15
  21. package/dist/dist-esm/react-components/src/components/AttachmentCard.js +25 -41
  22. package/dist/dist-esm/react-components/src/components/AttachmentCard.js.map +1 -1
  23. package/dist/dist-esm/react-components/src/components/AttachmentDownloadCards.d.ts +18 -11
  24. package/dist/dist-esm/react-components/src/components/AttachmentDownloadCards.js +74 -62
  25. package/dist/dist-esm/react-components/src/components/AttachmentDownloadCards.js.map +1 -1
  26. package/dist/dist-esm/react-components/src/components/AttachmentUploadCards.js +37 -4
  27. package/dist/dist-esm/react-components/src/components/AttachmentUploadCards.js.map +1 -1
  28. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.d.ts +6 -3
  29. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageComponentWrapper.js.map +1 -1
  30. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.d.ts +5 -5
  31. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js +7 -7
  32. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/ChatMessageComponentAsMessageBubble.js.map +1 -1
  33. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/FluentChatMessageComponent.js +13 -18
  34. package/dist/dist-esm/react-components/src/components/ChatMessage/MessageComponents/FluentChatMessageComponent.js.map +1 -1
  35. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.d.ts +9 -9
  36. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponent.js.map +1 -1
  37. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.d.ts +9 -9
  38. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js +10 -10
  39. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/ChatMyMessageComponentAsMessageBubble.js.map +1 -1
  40. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/FluentChatMyMessageComponent.js +12 -10
  41. package/dist/dist-esm/react-components/src/components/ChatMessage/MyMessageComponents/FluentChatMyMessageComponent.js.map +1 -1
  42. package/dist/dist-esm/react-components/src/components/Dialpad/Dialpad.d.ts +4 -0
  43. package/dist/dist-esm/react-components/src/components/Dialpad/Dialpad.js +2 -2
  44. package/dist/dist-esm/react-components/src/components/Dialpad/Dialpad.js.map +1 -1
  45. package/dist/dist-esm/react-components/src/components/MessageStatusIcon.js +1 -1
  46. package/dist/dist-esm/react-components/src/components/MessageStatusIcon.js.map +1 -1
  47. package/dist/dist-esm/react-components/src/components/MessageThread.d.ts +10 -9
  48. package/dist/dist-esm/react-components/src/components/MessageThread.js +17 -13
  49. package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
  50. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/RichTextRibbonButtons.d.ts +7 -0
  51. package/dist/dist-esm/react-components/src/components/RichTextEditor/{RichTextRibbonButtons.js → Buttons/RichTextRibbonButtons.js} +16 -20
  52. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/RichTextRibbonButtons.js.map +1 -0
  53. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/RichTextInsertTableButton.d.ts +7 -0
  54. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/RichTextInsertTableButton.js +56 -0
  55. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/RichTextInsertTableButton.js.map +1 -0
  56. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/RichTextInsertTablePane.d.ts +16 -0
  57. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/RichTextInsertTablePane.js +62 -0
  58. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/RichTextInsertTablePane.js.map +1 -0
  59. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/RichTextTableContextMenu.d.ts +8 -0
  60. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/RichTextTableContextMenu.js +57 -0
  61. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/RichTextTableContextMenu.js.map +1 -0
  62. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/insertTableAction.d.ts +9 -0
  63. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/insertTableAction.js +34 -0
  64. package/dist/dist-esm/react-components/src/components/RichTextEditor/Buttons/Table/insertTableAction.js.map +1 -0
  65. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js +23 -11
  66. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js.map +1 -1
  67. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.d.ts +44 -0
  68. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js +16 -6
  69. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js.map +1 -1
  70. package/dist/dist-esm/react-components/src/components/VideoGallery/DefaultLayout.js +2 -2
  71. package/dist/dist-esm/react-components/src/components/VideoGallery/DefaultLayout.js.map +1 -1
  72. package/dist/dist-esm/react-components/src/components/VideoGallery/LargeGalleryLayout.js +5 -3
  73. package/dist/dist-esm/react-components/src/components/VideoGallery/LargeGalleryLayout.js.map +1 -1
  74. package/dist/dist-esm/react-components/src/components/index.d.ts +2 -2
  75. package/dist/dist-esm/react-components/src/components/index.js.map +1 -1
  76. package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.d.ts +1 -1
  77. package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.js +1 -1
  78. package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.js.map +1 -1
  79. package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.d.ts +25 -1
  80. package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.js +132 -2
  81. package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.js.map +1 -1
  82. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.d.ts +10 -2
  83. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js +20 -14
  84. package/dist/dist-esm/react-components/src/components/utils/ChatMessageComponentUtils.js.map +1 -1
  85. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorStringsUtils.d.ts +15 -0
  86. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorStringsUtils.js +39 -0
  87. package/dist/dist-esm/react-components/src/components/utils/RichTextEditorStringsUtils.js.map +1 -0
  88. package/dist/dist-esm/react-components/src/components/utils/RichTextTableUtils.d.ts +22 -0
  89. package/dist/dist-esm/react-components/src/components/utils/RichTextTableUtils.js +29 -0
  90. package/dist/dist-esm/react-components/src/components/utils/RichTextTableUtils.js.map +1 -0
  91. package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +13 -1
  92. package/dist/dist-esm/react-components/src/theming/icons.d.ts +7 -2
  93. package/dist/dist-esm/react-components/src/theming/icons.js +15 -5
  94. package/dist/dist-esm/react-components/src/theming/icons.js.map +1 -1
  95. package/dist/dist-esm/react-components/src/types/Attachment.d.ts +97 -37
  96. package/dist/dist-esm/react-components/src/types/Attachment.js.map +1 -1
  97. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js +2 -1
  98. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js.map +1 -1
  99. package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.d.ts +4 -0
  100. package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.js.map +1 -1
  101. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +2 -1
  102. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +22 -4
  103. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
  104. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalDeviceSettings.js +3 -3
  105. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalDeviceSettings.js.map +1 -1
  106. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalPreview.js +2 -2
  107. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalPreview.js.map +1 -1
  108. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.d.ts +1 -0
  109. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js +2 -2
  110. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js.map +1 -1
  111. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/DtmfDialpadPage.d.ts +1 -0
  112. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/DtmfDialpadPage.js +2 -2
  113. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/DtmfDialpadPage.js.map +1 -1
  114. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallConfiguration.styles.d.ts +1 -1
  115. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallConfiguration.styles.js +32 -17
  116. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/CallConfiguration.styles.js.map +1 -1
  117. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/LocalDeviceSettings.styles.d.ts +5 -1
  118. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/LocalDeviceSettings.styles.js +12 -0
  119. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/LocalDeviceSettings.styles.js.map +1 -1
  120. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/LocalPreview.styles.d.ts +2 -14
  121. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/LocalPreview.styles.js +14 -10
  122. package/dist/dist-esm/react-composites/src/composites/CallComposite/styles/LocalPreview.styles.js.map +1 -1
  123. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js +13 -1
  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/adapter/AzureCommunicationCallWithChatAdapter.d.ts +53 -3
  126. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +196 -57
  127. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
  128. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.d.ts +2 -2
  129. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.js +4 -5
  130. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/state/CallWithChatAdapterState.js.map +1 -1
  131. package/dist/dist-esm/react-composites/src/composites/ChatComposite/AttachmentDownloadErrorBar.d.ts +15 -0
  132. package/dist/dist-esm/react-composites/src/composites/ChatComposite/{FileDownloadErrorBar.js → AttachmentDownloadErrorBar.js} +5 -5
  133. package/dist/dist-esm/react-composites/src/composites/ChatComposite/AttachmentDownloadErrorBar.js.map +1 -0
  134. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.d.ts +4 -5
  135. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +10 -7
  136. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
  137. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.d.ts +6 -0
  138. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +22 -0
  139. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js.map +1 -1
  140. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/FileUploadButton.js +1 -1
  141. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/FileUploadButton.js.map +1 -1
  142. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.d.ts +2 -0
  143. package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/index.js.map +1 -1
  144. package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.d.ts +1 -1
  145. package/dist/dist-esm/react-composites/src/composites/ChatComposite/index.js.map +1 -1
  146. package/dist/dist-esm/react-composites/src/composites/common/PeoplePaneContent.js +11 -2
  147. package/dist/dist-esm/react-composites/src/composites/common/PeoplePaneContent.js.map +1 -1
  148. package/dist/dist-esm/react-composites/src/composites/common/icons.d.ts +7 -2
  149. package/dist/dist-esm/react-composites/src/composites/localization/locales/en-US/strings.json +2 -1
  150. package/package.json +2 -1
  151. package/dist/dist-cjs/communication-react/index-BEomNZbT.js.map +0 -1
  152. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextRibbonButtons.d.ts +0 -12
  153. package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextRibbonButtons.js.map +0 -1
  154. package/dist/dist-esm/react-composites/src/composites/ChatComposite/FileDownloadErrorBar.d.ts +0 -15
  155. package/dist/dist-esm/react-composites/src/composites/ChatComposite/FileDownloadErrorBar.js.map +0 -1
@@ -46,7 +46,7 @@ export type { Spotlight } from '../../react-components/src';
46
46
  export type { ImageOverlayProps, ImageOverlayStrings } from '../../react-components/src';
47
47
  export type { BlockedMessage } from '../../react-components/src';
48
48
  export type { DialpadMode, DialpadProps, DialpadStrings, DialpadStyles, DtmfTone, LongPressTrigger } from '../../react-components/src';
49
- export type { ActiveFileUpload, SendBoxErrorBarError, FileDownloadHandler, FileDownloadError } from '../../react-components/src';
49
+ export type { ActiveFileUpload, SendBoxErrorBarError, AttachmentMenuAction, AttachmentOptions } from '../../react-components/src';
50
50
  export type { AttachmentMetadata } from '../../react-components/src';
51
51
  export type { ChatAttachmentType } from '../../react-components/src';
52
52
  export type { InlineImageOptions, InlineImage } from '../../react-components/src';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,+BAA+B,EAAE,6BAA6B,EAAE,MAAM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EAClC,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AA0IpC,mDAAmD;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAuC7D,cAAc,iDAAiD,CAAC;AAChE,cAAc,oCAAoC,CAAC;AACnD,cAAc,gDAAgD,CAAC;AAG/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAe1E,cAAc,yCAAyC,CAAC;AACxD,cAAc,eAAe,CAAC;AAE9B,sDAAsD;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAGhE,sDAAsD;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAGvE,sDAAsD;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * `@azure/communication-react` is an npm package that exports the functionality of the Azure Communication Services - UI Library.\n *\n * This package makes it easy for you to build modern communications user experiences using Azure Communication Services. It gives you a library of production-ready UI components that you can drop into your applications:\n * - Composites: These components are turn-key solutions that implement common communication scenarios. You can quickly add video calling or chat experiences to your applications. Composites are open-source higher order components built using UI components.\n * - UI Components - These components are open-source building blocks that let you build custom communications experience. Components are offered for both calling and chat capabilities that can be combined to build experiences.\n *\n * These UI client libraries all use Microsoft's Fluent design language and assets. Fluent UI provides a foundational layer for the UI Library and is actively used across Microsoft products.\n *\n * In conjunction with the UI components, the UI Library exposes a stateful client library for calling and chat. This client is agnostic to any specific state management framework and can be integrated with common state managers like Redux or React Context.\n * This stateful client library can be used with the UI Components to pass props and methods for the UI Components to render data. For more information, see Stateful Client Overview.\n *\n * For more information visit: https://aka.ms/acsstorybook\n *\n * @packageDocumentation\n */\n\nexport { fromFlatCommunicationIdentifier, toFlatCommunicationIdentifier } from '../../acs-ui-common/src';\nexport type {\n AreEqual,\n CommonProperties,\n MessageStatus,\n Common,\n AreTypeEqual,\n AreParamEqual\n} from '../../acs-ui-common/src';\n\n// Not to export chat/calling specific hook from binding package\nexport type {\n CallClientProviderProps,\n CallAgentProviderProps,\n CallProviderProps,\n GetCallingSelector,\n CallingHandlers,\n CallingBaseSelectorProps,\n CommonCallingHandlers\n} from '../../calling-component-bindings/src';\n\nexport type { VideoBackgroundEffectsDependency, CallingHandlersOptions } from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(close-captions) */\nexport type { CaptionsOptions } from '../../calling-component-bindings/src';\n\nexport type {\n ChatClientProviderProps,\n ChatThreadClientProviderProps,\n GetChatSelector,\n ChatHandlers,\n ChatBaseSelectorProps\n} from '../../chat-component-bindings/src';\n\nexport {\n CallClientProvider,\n CallAgentProvider,\n CallProvider,\n useCallClient,\n useCallAgent,\n useCall,\n useDeviceManager,\n getCallingSelector,\n createDefaultCallingHandlers\n} from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(teams-identity-support) */\nexport {\n useTeamsCallAgent,\n useTeamsCall,\n createDefaultTeamsCallingHandlers\n} from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(teams-identity-support) */\nexport type { TeamsCallingHandlers } from '../../calling-component-bindings/src';\n\nexport type {\n ScreenShareButtonSelector,\n CameraButtonSelector,\n VideoGallerySelector,\n DevicesButtonSelector,\n EmptySelector,\n ErrorBarSelector as CallErrorBarSelector,\n ParticipantListSelector,\n MicrophoneButtonSelector,\n ParticipantsButtonSelector,\n CreateDefaultCallingHandlers\n} from '../../calling-component-bindings/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport type { HoldButtonSelector } from '../../calling-component-bindings/src';\n\nexport type { RaiseHandButtonSelector } from '../../calling-component-bindings/src';\n\nexport {\n ChatClientProvider,\n ChatThreadClientProvider,\n useChatClient,\n useChatThreadClient,\n getChatSelector,\n createDefaultChatHandlers\n} from '../../chat-component-bindings/src';\n\nexport type {\n MessageThreadSelector,\n TypingIndicatorSelector,\n ChatParticipantListSelector,\n SendBoxSelector,\n ErrorBarSelector as ChatErrorBarSelector\n} from '../../chat-component-bindings/src';\n\nexport {\n _IdentifierProvider,\n CameraButton,\n ControlBar,\n ControlBarButton,\n DevicesButton,\n EndCallButton,\n ErrorBar,\n GridLayout,\n LocalizationProvider,\n MessageStatusIndicator,\n MessageThread,\n MicrophoneButton,\n ParticipantItem,\n ParticipantList,\n ParticipantsButton,\n ScreenShareButton,\n SendBox,\n StreamMedia,\n TypingIndicator,\n VideoGallery,\n VideoTile,\n COMPONENT_LOCALE_EN_GB,\n COMPONENT_LOCALE_AR_SA,\n COMPONENT_LOCALE_CS_CZ,\n COMPONENT_LOCALE_DE_DE,\n COMPONENT_LOCALE_ES_ES,\n COMPONENT_LOCALE_FI_FI,\n COMPONENT_LOCALE_FR_FR,\n COMPONENT_LOCALE_HE_IL,\n COMPONENT_LOCALE_IT_IT,\n COMPONENT_LOCALE_JA_JP,\n COMPONENT_LOCALE_KO_KR,\n COMPONENT_LOCALE_NB_NO,\n COMPONENT_LOCALE_NL_NL,\n COMPONENT_LOCALE_PL_PL,\n COMPONENT_LOCALE_PT_BR,\n COMPONENT_LOCALE_RU_RU,\n COMPONENT_LOCALE_SV_SE,\n COMPONENT_LOCALE_TR_TR,\n COMPONENT_LOCALE_ZH_CN,\n COMPONENT_LOCALE_ZH_TW\n} from '../../react-components/src';\nexport { ImageOverlay } from '../../react-components/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport { HoldButton } from '../../react-components/src';\n\nexport { RaiseHandButton } from '../../react-components/src';\n\nexport { Dialpad } from '../../react-components/src';\n\n/* @conditional-compile-remove(call-readiness) */\nexport {\n CameraAndMicrophoneSitePermissions,\n MicrophoneSitePermissions,\n CameraSitePermissions\n} from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type {\n CameraAndMicrophoneSitePermissionsStrings,\n CameraAndMicrophoneSitePermissionsProps,\n CameraSitePermissionsStrings,\n CameraSitePermissionsProps,\n CommonSitePermissionsProps,\n SitePermissionsStrings,\n SitePermissionsStyles,\n MicrophoneSitePermissionsStrings,\n MicrophoneSitePermissionsProps\n} from '../../react-components/src';\n\n/* @conditional-compile-remove(total-participant-count) */\nexport type { ParticipantListStrings } from '../../react-components/src';\n\n/* @conditional-compile-remove(mention) */\nexport type {\n MentionOptions,\n MentionDisplayOptions,\n MentionLookupOptions,\n Mention,\n MentionPopoverStrings\n} from '../../react-components/src';\n\nexport type {\n _IdentifierProviderProps,\n _Identifiers,\n ActiveErrorMessage,\n BaseCustomStyles,\n CallParticipantListParticipant,\n CameraButtonContextualMenuStyles,\n CameraButtonProps,\n CameraButtonStrings,\n CameraButtonStyles,\n ChatMessage,\n CommunicationParticipant,\n ComponentLocale,\n ComponentSlotStyle,\n ComponentStrings,\n ContentSystemMessage,\n ControlBarButtonProps,\n ControlBarButtonStrings,\n ControlBarButtonStyles,\n ControlBarLayout,\n ControlBarProps,\n CreateVideoStreamViewResult,\n CustomAvatarOptions,\n CustomMessage,\n DevicesButtonContextualMenuStyles,\n DevicesButtonProps,\n DevicesButtonStrings,\n DevicesButtonStyles,\n EndCallButtonProps,\n EndCallButtonStrings,\n ErrorBarProps,\n ErrorBarStrings,\n ErrorType,\n GridLayoutProps,\n GridLayoutStyles,\n HorizontalGalleryStyles,\n JumpToNewMessageButtonProps,\n LocalizationProviderProps,\n LocalVideoCameraCycleButtonProps,\n LoadingState,\n Message,\n MessageAttachedStatus,\n MessageCommon,\n MessageContentType,\n MessageProps,\n MessageRenderer,\n MessageStatusIndicatorProps,\n MessageStatusIndicatorStrings,\n MessageThreadProps,\n MessageThreadStrings,\n MessageThreadStyles,\n MicrophoneButtonContextualMenuStyles,\n MicrophoneButtonProps,\n MicrophoneButtonStrings,\n MicrophoneButtonStyles,\n OnRenderAvatarCallback,\n OptionsDevice,\n ParticipantAddedSystemMessage,\n ParticipantItemProps,\n ParticipantItemStrings,\n ParticipantItemStyles,\n ParticipantListItemStyles,\n ParticipantListParticipant,\n ParticipantListProps,\n ParticipantListStyles,\n ParticipantMenuItemsCallback,\n ParticipantRemovedSystemMessage,\n ParticipantState,\n ParticipantsButtonContextualMenuStyles,\n ParticipantsButtonProps,\n ParticipantsButtonStrings,\n ParticipantsButtonStyles,\n ReadReceiptsBySenderId,\n ScreenShareButtonProps,\n ScreenShareButtonStrings,\n SendBoxProps,\n SendBoxStrings,\n SendBoxStylesProps,\n StreamMediaProps,\n SystemMessage,\n SystemMessageCommon,\n TopicUpdatedSystemMessage,\n TypingIndicatorProps,\n TypingIndicatorStrings,\n TypingIndicatorStylesProps,\n UpdateMessageCallback,\n CancelEditCallback,\n VideoGalleryLayout,\n VideoGalleryLocalParticipant,\n VideoGalleryParticipant,\n VideoGalleryProps,\n VideoGalleryRemoteParticipant,\n VideoGalleryStream,\n VideoGalleryStrings,\n VideoGalleryStyles,\n VideoStreamOptions,\n VideoTileProps,\n VideoTileStylesProps,\n ViewScalingMode,\n VideoTileContextualMenuProps,\n VideoTileDrawerMenuProps\n} from '../../react-components/src';\n\nexport type { RaiseHandButtonProps, RaiseHandButtonStrings, RaisedHand } from '../../react-components/src';\n/* @conditional-compile-remove(reaction) */\nexport type {\n ReactionButtonStrings,\n Reaction,\n ReactionButtonProps,\n ReactionResources,\n ReactionSprite\n} from '../../react-components/src';\n/* @conditional-compile-remove(rich-text-editor) */\nexport { RichTextSendBox } from '../../react-components/src';\n/* @conditional-compile-remove(rich-text-editor) */\nexport type { RichTextSendBoxProps, RichTextSendBoxStrings } from '../../react-components/src';\n/* @conditional-compile-remove(spotlight) */\nexport type { Spotlight } from '../../react-components/src';\nexport type { ImageOverlayProps, ImageOverlayStrings } from '../../react-components/src';\n/* @conditional-compile-remove(data-loss-prevention) */\nexport type { BlockedMessage } from '../../react-components/src';\nexport type {\n DialpadMode,\n DialpadProps,\n DialpadStrings,\n DialpadStyles,\n DtmfTone,\n LongPressTrigger\n} from '../../react-components/src';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nexport type {\n ActiveFileUpload,\n SendBoxErrorBarError,\n FileDownloadHandler,\n FileDownloadError\n} from '../../react-components/src';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nexport type { AttachmentMetadata } from '../../react-components/src';\nexport type { ChatAttachmentType } from '../../react-components/src';\nexport type { InlineImageOptions, InlineImage } from '../../react-components/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport type { HoldButtonProps, HoldButtonStrings, VideoTileStrings } from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type { BrowserPermissionDeniedStrings, BrowserPermissionDeniedProps } from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type {\n BrowserPermissionDeniedIOSStrings,\n BrowserPermissionDeniedStyles,\n BrowserPermissionDeniedIOSProps\n} from '../../react-components/src';\nexport type { OverflowGalleryPosition } from '../../react-components/src';\nexport type { LocalVideoTileSize } from '../../react-components/src';\nexport * from '../../react-components/src/localization/locales';\nexport * from '../../react-components/src/theming';\nexport * from '../../calling-stateful-client/src/index-public';\n/* @conditional-compile-remove(one-to-n-calling) */\nexport type { DeclarativeCallAgent } from '../../calling-stateful-client/src';\nexport { createStatefulChatClient } from '../../chat-stateful-client/src';\nexport type {\n StatefulChatClient,\n StatefulChatClientArgs,\n StatefulChatClientOptions,\n ChatMessageWithStatus,\n ChatClientState,\n ChatError,\n ChatErrors,\n ChatThreadClientState,\n ChatThreadProperties,\n ChatErrorTarget\n} from '../../chat-stateful-client/src';\n\nexport type { ResourceFetchResult } from '../../chat-stateful-client/src';\nexport * from '../../react-composites/src/index-public';\nexport * from './mergedHooks';\n\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedBrowser } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedBrowserStrings, UnsupportedBrowserProps } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedBrowserVersion } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedBrowserVersionStrings, UnsupportedBrowserVersionProps } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedOperatingSystem } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedOperatingSystemStrings, UnsupportedOperatingSystemProps } from '../../react-components/src';\nexport type {\n VerticalGalleryStyles,\n VerticalGalleryStrings,\n VerticalGalleryControlBarStyles\n} from '../../react-components/src';\n/* @conditional-compile-remove(close-captions) */\nexport type { SpokenLanguageStrings, CaptionLanguageStrings } from '../../react-components/src';\n/* @conditional-compile-remove(end-of-call-survey) */\nexport type { SurveyIssues } from '../../react-components/src';\n/* @conditional-compile-remove(end-of-call-survey) */\nexport type { SurveyIssuesHeadingStrings } from '../../react-components/src';\n/* @conditional-compile-remove(end-of-call-survey) */\nexport type { CallSurveyImprovementSuggestions } from '../../react-components/src';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,+BAA+B,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAkCzG,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,OAAO,EACP,gBAAgB,EAChB,kBAAkB,EAClB,4BAA4B,EAC7B,MAAM,sCAAsC,CAAC;AAE9C,yDAAyD;AACzD,OAAO,EACL,iBAAiB,EACjB,YAAY,EACZ,iCAAiC,EAClC,MAAM,sCAAsC,CAAC;AAsB9C,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,yBAAyB,EAC1B,MAAM,mCAAmC,CAAC;AAU3C,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,QAAQ,EACR,UAAU,EACV,oBAAoB,EACpB,sBA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Content":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * `@azure/communication-react` is an npm package that exports the functionality of the Azure Communication Services - UI Library.\n *\n * This package makes it easy for you to build modern communications user experiences using Azure Communication Services. It gives you a library of production-ready UI components that you can drop into your applications:\n * - Composites: These components are turn-key solutions that implement common communication scenarios. You can quickly add video calling or chat experiences to your applications. Composites are open-source higher order components built using UI components.\n * - UI Components - These components are open-source building blocks that let you build custom communications experience. Components are offered for both calling and chat capabilities that can be combined to build experiences.\n *\n * These UI client libraries all use Microsoft's Fluent design language and assets. Fluent UI provides a foundational layer for the UI Library and is actively used across Microsoft products.\n *\n * In conjunction with the UI components, the UI Library exposes a stateful client library for calling and chat. This client is agnostic to any specific state management framework and can be integrated with common state managers like Redux or React Context.\n * This stateful client library can be used with the UI Components to pass props and methods for the UI Components to render data. For more information, see Stateful Client Overview.\n *\n * For more information visit: https://aka.ms/acsstorybook\n *\n * @packageDocumentation\n */\n\nexport { fromFlatCommunicationIdentifier, toFlatCommunicationIdentifier } from '../../acs-ui-common/src';\nexport type {\n AreEqual,\n CommonProperties,\n MessageStatus,\n Common,\n AreTypeEqual,\n AreParamEqual\n} from '../../acs-ui-common/src';\n\n// Not to export chat/calling specific hook from binding package\nexport type {\n CallClientProviderProps,\n CallAgentProviderProps,\n CallProviderProps,\n GetCallingSelector,\n CallingHandlers,\n CallingBaseSelectorProps,\n CommonCallingHandlers\n} from '../../calling-component-bindings/src';\n\nexport type { VideoBackgroundEffectsDependency, CallingHandlersOptions } from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(close-captions) */\nexport type { CaptionsOptions } from '../../calling-component-bindings/src';\n\nexport type {\n ChatClientProviderProps,\n ChatThreadClientProviderProps,\n GetChatSelector,\n ChatHandlers,\n ChatBaseSelectorProps\n} from '../../chat-component-bindings/src';\n\nexport {\n CallClientProvider,\n CallAgentProvider,\n CallProvider,\n useCallClient,\n useCallAgent,\n useCall,\n useDeviceManager,\n getCallingSelector,\n createDefaultCallingHandlers\n} from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(teams-identity-support) */\nexport {\n useTeamsCallAgent,\n useTeamsCall,\n createDefaultTeamsCallingHandlers\n} from '../../calling-component-bindings/src';\n\n/* @conditional-compile-remove(teams-identity-support) */\nexport type { TeamsCallingHandlers } from '../../calling-component-bindings/src';\n\nexport type {\n ScreenShareButtonSelector,\n CameraButtonSelector,\n VideoGallerySelector,\n DevicesButtonSelector,\n EmptySelector,\n ErrorBarSelector as CallErrorBarSelector,\n ParticipantListSelector,\n MicrophoneButtonSelector,\n ParticipantsButtonSelector,\n CreateDefaultCallingHandlers\n} from '../../calling-component-bindings/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport type { HoldButtonSelector } from '../../calling-component-bindings/src';\n\nexport type { RaiseHandButtonSelector } from '../../calling-component-bindings/src';\n\nexport {\n ChatClientProvider,\n ChatThreadClientProvider,\n useChatClient,\n useChatThreadClient,\n getChatSelector,\n createDefaultChatHandlers\n} from '../../chat-component-bindings/src';\n\nexport type {\n MessageThreadSelector,\n TypingIndicatorSelector,\n ChatParticipantListSelector,\n SendBoxSelector,\n ErrorBarSelector as ChatErrorBarSelector\n} from '../../chat-component-bindings/src';\n\nexport {\n _IdentifierProvider,\n CameraButton,\n ControlBar,\n ControlBarButton,\n DevicesButton,\n EndCallButton,\n ErrorBar,\n GridLayout,\n LocalizationProvider,\n MessageStatusIndicator,\n MessageThread,\n MicrophoneButton,\n ParticipantItem,\n ParticipantList,\n ParticipantsButton,\n ScreenShareButton,\n SendBox,\n StreamMedia,\n TypingIndicator,\n VideoGallery,\n VideoTile,\n COMPONENT_LOCALE_EN_GB,\n COMPONENT_LOCALE_AR_SA,\n COMPONENT_LOCALE_CS_CZ,\n COMPONENT_LOCALE_DE_DE,\n COMPONENT_LOCALE_ES_ES,\n COMPONENT_LOCALE_FI_FI,\n COMPONENT_LOCALE_FR_FR,\n COMPONENT_LOCALE_HE_IL,\n COMPONENT_LOCALE_IT_IT,\n COMPONENT_LOCALE_JA_JP,\n COMPONENT_LOCALE_KO_KR,\n COMPONENT_LOCALE_NB_NO,\n COMPONENT_LOCALE_NL_NL,\n COMPONENT_LOCALE_PL_PL,\n COMPONENT_LOCALE_PT_BR,\n COMPONENT_LOCALE_RU_RU,\n COMPONENT_LOCALE_SV_SE,\n COMPONENT_LOCALE_TR_TR,\n COMPONENT_LOCALE_ZH_CN,\n COMPONENT_LOCALE_ZH_TW\n} from '../../react-components/src';\nexport { ImageOverlay } from '../../react-components/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport { HoldButton } from '../../react-components/src';\n\nexport { RaiseHandButton } from '../../react-components/src';\n\nexport { Dialpad } from '../../react-components/src';\n\n/* @conditional-compile-remove(call-readiness) */\nexport {\n CameraAndMicrophoneSitePermissions,\n MicrophoneSitePermissions,\n CameraSitePermissions\n} from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type {\n CameraAndMicrophoneSitePermissionsStrings,\n CameraAndMicrophoneSitePermissionsProps,\n CameraSitePermissionsStrings,\n CameraSitePermissionsProps,\n CommonSitePermissionsProps,\n SitePermissionsStrings,\n SitePermissionsStyles,\n MicrophoneSitePermissionsStrings,\n MicrophoneSitePermissionsProps\n} from '../../react-components/src';\n\n/* @conditional-compile-remove(total-participant-count) */\nexport type { ParticipantListStrings } from '../../react-components/src';\n\n/* @conditional-compile-remove(mention) */\nexport type {\n MentionOptions,\n MentionDisplayOptions,\n MentionLookupOptions,\n Mention,\n MentionPopoverStrings\n} from '../../react-components/src';\n\nexport type {\n _IdentifierProviderProps,\n _Identifiers,\n ActiveErrorMessage,\n BaseCustomStyles,\n CallParticipantListParticipant,\n CameraButtonContextualMenuStyles,\n CameraButtonProps,\n CameraButtonStrings,\n CameraButtonStyles,\n ChatMessage,\n CommunicationParticipant,\n ComponentLocale,\n ComponentSlotStyle,\n ComponentStrings,\n ContentSystemMessage,\n ControlBarButtonProps,\n ControlBarButtonStrings,\n ControlBarButtonStyles,\n ControlBarLayout,\n ControlBarProps,\n CreateVideoStreamViewResult,\n CustomAvatarOptions,\n CustomMessage,\n DevicesButtonContextualMenuStyles,\n DevicesButtonProps,\n DevicesButtonStrings,\n DevicesButtonStyles,\n EndCallButtonProps,\n EndCallButtonStrings,\n ErrorBarProps,\n ErrorBarStrings,\n ErrorType,\n GridLayoutProps,\n GridLayoutStyles,\n HorizontalGalleryStyles,\n JumpToNewMessageButtonProps,\n LocalizationProviderProps,\n LocalVideoCameraCycleButtonProps,\n LoadingState,\n Message,\n MessageAttachedStatus,\n MessageCommon,\n MessageContentType,\n MessageProps,\n MessageRenderer,\n MessageStatusIndicatorProps,\n MessageStatusIndicatorStrings,\n MessageThreadProps,\n MessageThreadStrings,\n MessageThreadStyles,\n MicrophoneButtonContextualMenuStyles,\n MicrophoneButtonProps,\n MicrophoneButtonStrings,\n MicrophoneButtonStyles,\n OnRenderAvatarCallback,\n OptionsDevice,\n ParticipantAddedSystemMessage,\n ParticipantItemProps,\n ParticipantItemStrings,\n ParticipantItemStyles,\n ParticipantListItemStyles,\n ParticipantListParticipant,\n ParticipantListProps,\n ParticipantListStyles,\n ParticipantMenuItemsCallback,\n ParticipantRemovedSystemMessage,\n ParticipantState,\n ParticipantsButtonContextualMenuStyles,\n ParticipantsButtonProps,\n ParticipantsButtonStrings,\n ParticipantsButtonStyles,\n ReadReceiptsBySenderId,\n ScreenShareButtonProps,\n ScreenShareButtonStrings,\n SendBoxProps,\n SendBoxStrings,\n SendBoxStylesProps,\n StreamMediaProps,\n SystemMessage,\n SystemMessageCommon,\n TopicUpdatedSystemMessage,\n TypingIndicatorProps,\n TypingIndicatorStrings,\n TypingIndicatorStylesProps,\n UpdateMessageCallback,\n CancelEditCallback,\n VideoGalleryLayout,\n VideoGalleryLocalParticipant,\n VideoGalleryParticipant,\n VideoGalleryProps,\n VideoGalleryRemoteParticipant,\n VideoGalleryStream,\n VideoGalleryStrings,\n VideoGalleryStyles,\n VideoStreamOptions,\n VideoTileProps,\n VideoTileStylesProps,\n ViewScalingMode,\n VideoTileContextualMenuProps,\n VideoTileDrawerMenuProps\n} from '../../react-components/src';\n\nexport type { RaiseHandButtonProps, RaiseHandButtonStrings, RaisedHand } from '../../react-components/src';\n/* @conditional-compile-remove(reaction) */\nexport type {\n ReactionButtonStrings,\n Reaction,\n ReactionButtonProps,\n ReactionResources,\n ReactionSprite\n} from '../../react-components/src';\n/* @conditional-compile-remove(rich-text-editor) */\nexport { RichTextSendBox } from '../../react-components/src';\n/* @conditional-compile-remove(rich-text-editor) */\nexport type { RichTextSendBoxProps, RichTextSendBoxStrings } from '../../react-components/src';\n/* @conditional-compile-remove(spotlight) */\nexport type { Spotlight } from '../../react-components/src';\nexport type { ImageOverlayProps, ImageOverlayStrings } from '../../react-components/src';\n/* @conditional-compile-remove(data-loss-prevention) */\nexport type { BlockedMessage } from '../../react-components/src';\nexport type {\n DialpadMode,\n DialpadProps,\n DialpadStrings,\n DialpadStyles,\n DtmfTone,\n LongPressTrigger\n} from '../../react-components/src';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nexport type {\n ActiveFileUpload,\n SendBoxErrorBarError,\n AttachmentMenuAction,\n AttachmentOptions\n} from '../../react-components/src';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nexport type { AttachmentMetadata } from '../../react-components/src';\nexport type { ChatAttachmentType } from '../../react-components/src';\nexport type { InlineImageOptions, InlineImage } from '../../react-components/src';\n/* @conditional-compile-remove(PSTN-calls) */\nexport type { HoldButtonProps, HoldButtonStrings, VideoTileStrings } from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type { BrowserPermissionDeniedStrings, BrowserPermissionDeniedProps } from '../../react-components/src';\n/* @conditional-compile-remove(call-readiness) */\nexport type {\n BrowserPermissionDeniedIOSStrings,\n BrowserPermissionDeniedStyles,\n BrowserPermissionDeniedIOSProps\n} from '../../react-components/src';\nexport type { OverflowGalleryPosition } from '../../react-components/src';\nexport type { LocalVideoTileSize } from '../../react-components/src';\nexport * from '../../react-components/src/localization/locales';\nexport * from '../../react-components/src/theming';\nexport * from '../../calling-stateful-client/src/index-public';\n/* @conditional-compile-remove(one-to-n-calling) */\nexport type { DeclarativeCallAgent } from '../../calling-stateful-client/src';\nexport { createStatefulChatClient } from '../../chat-stateful-client/src';\nexport type {\n StatefulChatClient,\n StatefulChatClientArgs,\n StatefulChatClientOptions,\n ChatMessageWithStatus,\n ChatClientState,\n ChatError,\n ChatErrors,\n ChatThreadClientState,\n ChatThreadProperties,\n ChatErrorTarget\n} from '../../chat-stateful-client/src';\n\nexport type { ResourceFetchResult } from '../../chat-stateful-client/src';\nexport * from '../../react-composites/src/index-public';\nexport * from './mergedHooks';\n\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedBrowser } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedBrowserStrings, UnsupportedBrowserProps } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedBrowserVersion } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedBrowserVersionStrings, UnsupportedBrowserVersionProps } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport { UnsupportedOperatingSystem } from '../../react-components/src';\n/* @conditional-compile-remove(unsupported-browser) */\nexport type { UnsupportedOperatingSystemStrings, UnsupportedOperatingSystemProps } from '../../react-components/src';\nexport type {\n VerticalGalleryStyles,\n VerticalGalleryStrings,\n VerticalGalleryControlBarStyles\n} from '../../react-components/src';\n/* @conditional-compile-remove(close-captions) */\nexport type { SpokenLanguageStrings, CaptionLanguageStrings } from '../../react-components/src';\n/* @conditional-compile-remove(end-of-call-survey) */\nexport type { SurveyIssues } from '../../react-components/src';\n/* @conditional-compile-remove(end-of-call-survey) */\nexport type { SurveyIssuesHeadingStrings } from '../../react-components/src';\n/* @conditional-compile-remove(end-of-call-survey) */\nexport type { CallSurveyImprovementSuggestions } from '../../react-components/src';\n"]}
@@ -1,35 +1,31 @@
1
1
  /// <reference types="react" />
2
2
  import { _AttachmentUploadCardsStrings } from './AttachmentUploadCards';
3
+ import { AttachmentMetadata, AttachmentMenuAction } from '../types/Attachment';
3
4
  /**
4
5
  * @internal
5
- * _AttachmentCard Component Props.
6
+ * AttachmentCard Component Props.
6
7
  */
7
8
  export interface _AttachmentCardProps {
8
9
  /**
9
- * Attachment name.
10
+ * Attachment details including name, extension, url, etc.
10
11
  */
11
- attachmentName: string;
12
+ attachment: AttachmentMetadata;
12
13
  /**
13
- * Extension of the attachment used for rendering the attachment icon.
14
- */
15
- attachmentExtension: string;
16
- /**
17
- * Attachment upload progress percentage between 0 and 1.
18
- * Attachment transfer progress indicator is only shown when the value is greater than 0 and less than 1.
14
+ * Optional property to indicate progress of attachment upload.
19
15
  */
20
16
  progress?: number;
21
17
  /**
22
- * Icon to display for actions like download, upload, etc. along the attachment name.
18
+ * An array of menu actions to be displayed in the attachment card.
23
19
  */
24
- actionIcon?: JSX.Element;
20
+ menuActions: AttachmentMenuAction[];
25
21
  /**
26
- * Function that runs when actionIcon is clicked
22
+ * Optional aria label strings for attachment upload cards
27
23
  */
28
- actionHandler?: () => void;
24
+ strings?: _AttachmentUploadCardsStrings;
29
25
  /**
30
- * Optional arialabel strings for attachment cards
26
+ * Optional callback that runs if menu bar action onclick throws.
31
27
  */
32
- strings?: _AttachmentUploadCardsStrings;
28
+ onActionHandlerFailed?: (errMsg: string) => void;
33
29
  }
34
30
  /**
35
31
  * @internal
@@ -1,5 +1,14 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
3
12
  import {
4
13
  // eslint-disable-next-line no-restricted-imports
5
14
  Icon } from '@fluentui/react';
@@ -7,10 +16,10 @@ import { Card, CardHeader, Text, Menu, MenuTrigger, ToolbarButton, MenuPopover,
7
16
  import { getFileTypeIconProps } from '@fluentui/react-file-type-icons';
8
17
  import React from 'react';
9
18
  import { Announcer } from './Announcer';
10
- import { useEffect, useState, useMemo, useCallback } from 'react';
19
+ import { useEffect, useState, useMemo } from 'react';
11
20
  import { useLocaleAttachmentCardStringsTrampoline } from './utils/common';
12
21
  import { MoreHorizontal24Filled } from '@fluentui/react-icons';
13
- import { useAttachmentCardStyles, fileNameContainerClassName } from './styles/AttachmentCard.styles';
22
+ import { useAttachmentCardStyles, attachmentNameContainerClassName } from './styles/AttachmentCard.styles';
14
23
  /**
15
24
  * @internal
16
25
  * A component for displaying an attachment card with attachment icon and progress bar.
@@ -19,36 +28,8 @@ import { useAttachmentCardStyles, fileNameContainerClassName } from './styles/At
19
28
  */
20
29
  export const _AttachmentCard = (props) => {
21
30
  var _a, _b, _c, _d;
22
- const { attachmentName, attachmentExtension, progress, actionIcon, actionHandler } = props;
31
+ const { attachment, progress, menuActions, onActionHandlerFailed } = props;
23
32
  const attachmentCardStyles = useAttachmentCardStyles();
24
- // default/placeholder before actual code implemented
25
- const menuActions = useMemo(() => {
26
- return [
27
- {
28
- name: actionIcon && (actionIcon === null || actionIcon === void 0 ? void 0 : actionIcon.props.ariaLabel),
29
- icon: actionIcon !== null && actionIcon !== void 0 ? actionIcon : React.createElement(React.Fragment, null),
30
- onClick: (attachment) => {
31
- if (attachment) {
32
- actionHandler === null || actionHandler === void 0 ? void 0 : actionHandler();
33
- }
34
- }
35
- }
36
- ];
37
- }, [actionIcon, actionHandler]);
38
- // placeholder before refactoring the props
39
- const attachment = useMemo(() => {
40
- return {
41
- /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
42
- id: 'attachmentId',
43
- extension: attachmentExtension,
44
- name: attachmentName,
45
- url: 'https://localhost' // placeholder not used
46
- };
47
- }, [attachmentExtension, attachmentName]);
48
- // placeholder before refactoring the props
49
- const onDownloadErrorMessage = useCallback((errorMessage) => {
50
- console.log(errorMessage);
51
- }, []);
52
33
  const isUploadComplete = useMemo(() => {
53
34
  return progress !== undefined && progress > 0 && progress < 1;
54
35
  }, [progress]);
@@ -59,24 +40,27 @@ export const _AttachmentCard = (props) => {
59
40
  const showProgressIndicator = progress !== undefined && progress > 0 && progress < 1;
60
41
  useEffect(() => {
61
42
  if (showProgressIndicator) {
62
- setAnnouncerString(`${uploadStartedString} ${attachmentName}`);
43
+ setAnnouncerString(`${uploadStartedString} ${attachment.name}`);
63
44
  }
64
45
  else if (progress === 1) {
65
- setAnnouncerString(`${attachmentName} ${uploadCompletedString}`);
46
+ setAnnouncerString(`${attachment.name} ${uploadCompletedString}`);
66
47
  }
67
48
  else {
68
49
  setAnnouncerString(undefined);
69
50
  }
70
- }, [progress, showProgressIndicator, attachmentName, uploadStartedString, uploadCompletedString]);
51
+ }, [progress, showProgressIndicator, attachment.name, uploadStartedString, uploadCompletedString]);
71
52
  return (React.createElement("div", { "data-is-focusable": true },
72
53
  React.createElement(Announcer, { announcementString: announcerString, ariaLive: 'polite' }),
73
54
  React.createElement(Card, { className: attachmentCardStyles.root, size: "small", role: "listitem" },
74
- React.createElement(CardHeader, { image: React.createElement(Icon, { "data-ui-id": 'filetype-icon', iconName: getFileTypeIconProps({
75
- extension: attachmentExtension,
55
+ React.createElement(CardHeader, { image: React.createElement(Icon, { "data-ui-id": 'attachmenttype-icon', iconName: getFileTypeIconProps({
56
+ extension: useMemo(() => {
57
+ var _a, _b;
58
+ return (_b = (_a = attachment.extension) !== null && _a !== void 0 ? _a : attachment.name.split('.').pop()) !== null && _b !== void 0 ? _b : '';
59
+ }, [attachment]),
76
60
  size: 24,
77
61
  imageFileType: 'svg'
78
- }).iconName }), header: React.createElement("div", { className: fileNameContainerClassName },
79
- React.createElement(Text, { title: attachmentName }, attachmentName)), action: getMenuItems(menuActions, attachment, onDownloadErrorMessage) })),
62
+ }).iconName }), header: React.createElement("div", { className: attachmentNameContainerClassName },
63
+ React.createElement(Text, { title: attachment.name }, attachment.name)), action: getMenuItems(menuActions, attachment, onActionHandlerFailed) })),
80
64
  isUploadComplete ? (React.createElement(CardFooter, null,
81
65
  React.createElement(ProgressBar, { thickness: "medium", value: progress, shape: "rounded" }))) : (React.createElement(React.Fragment, null, " "))));
82
66
  };
@@ -96,13 +80,13 @@ const getMenuItems = (menuActions, attachment, handleOnClickError) => {
96
80
  React.createElement(MenuTrigger, null,
97
81
  React.createElement(ToolbarButton, { "aria-label": "More", icon: React.createElement(MoreHorizontal24Filled, null) })),
98
82
  React.createElement(MenuPopover, null,
99
- React.createElement(MenuList, null, menuActions.map((menuItem, index) => (React.createElement(MenuItem, { key: index, icon: menuItem.icon, onClick: () => {
83
+ React.createElement(MenuList, null, menuActions.map((menuItem, index) => (React.createElement(MenuItem, { key: index, icon: menuItem.icon, onClick: () => __awaiter(void 0, void 0, void 0, function* () {
100
84
  try {
101
- menuItem.onClick(attachment);
85
+ yield menuItem.onClick(attachment);
102
86
  }
103
87
  catch (e) {
104
88
  handleOnClickError === null || handleOnClickError === void 0 ? void 0 : handleOnClickError(e.message);
105
89
  }
106
- } }, menuItem.name))))))));
90
+ }) }, menuItem.name))))))));
107
91
  };
108
92
  //# sourceMappingURL=AttachmentCard.js.map
@@ -1 +1 @@
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,UAAU,EACV,IAA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port {\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, useCallback } from 'react';\nimport { _AttachmentUploadCardsStrings } from './AttachmentUploadCards';\nimport { useLocaleAttachmentCardStringsTrampoline } from './utils/common';\nimport { AttachmentMetadata, AttachmentMenuAction } from '../types/Attachment';\nimport { MoreHorizontal24Filled } from '@fluentui/react-icons';\nimport { useAttachmentCardStyles, fileNameContainerClassName } from './styles/AttachmentCard.styles';\n\n/**\n * @internal\n * _AttachmentCard Component Props.\n */\nexport interface _AttachmentCardProps {\n /**\n * Attachment name.\n */\n attachmentName: string;\n /**\n * Extension of the attachment used for rendering the attachment icon.\n */\n attachmentExtension: string;\n /**\n * Attachment upload progress percentage between 0 and 1.\n * Attachment transfer progress indicator is only shown when the value is greater than 0 and less than 1.\n */\n progress?: number;\n /**\n * Icon to display for actions like download, upload, etc. along the attachment name.\n */\n actionIcon?: JSX.Element;\n /**\n * Function that runs when actionIcon is clicked\n */\n actionHandler?: () => void;\n /**\n * Optional arialabel strings for attachment cards\n */\n strings?: _AttachmentUploadCardsStrings;\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 { attachmentName, attachmentExtension, progress, actionIcon, actionHandler } = props;\n const attachmentCardStyles = useAttachmentCardStyles();\n\n // default/placeholder before actual code implemented\n const menuActions = useMemo(() => {\n return [\n {\n name: actionIcon && actionIcon?.props.ariaLabel,\n icon: actionIcon ?? <></>,\n onClick: (attachment: AttachmentMetadata) => {\n if (attachment) {\n actionHandler?.();\n }\n }\n }\n ];\n }, [actionIcon, actionHandler]);\n\n // placeholder before refactoring the props\n const attachment = useMemo(() => {\n return {\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n id: 'attachmentId',\n extension: attachmentExtension,\n name: attachmentName,\n url: 'https://localhost' // placeholder not used\n };\n }, [attachmentExtension, attachmentName]);\n\n // placeholder before refactoring the props\n const onDownloadErrorMessage = useCallback((errorMessage: string): void => {\n console.log(errorMessage);\n }, []);\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} ${attachmentName}`);\n } else if (progress === 1) {\n setAnnouncerString(`${attachmentName} ${uploadCompletedString}`);\n } else {\n setAnnouncerString(undefined);\n }\n }, [progress, showProgressIndicator, attachmentName, uploadStartedString, uploadCompletedString]);\n\n return (\n <div data-is-focusable={true}>\n <Announcer announcementString={announcerString} ariaLive={'polite'} />\n <Card className={attachmentCardStyles.root} size=\"small\" role=\"listitem\">\n <CardHeader\n image={\n <Icon\n data-ui-id={'filetype-icon'}\n iconName={\n getFileTypeIconProps({\n extension: attachmentExtension,\n size: 24,\n imageFileType: 'svg'\n }).iconName\n }\n />\n }\n header={\n <div className={fileNameContainerClassName}>\n <Text title={attachmentName}>{attachmentName}</Text>\n </div>\n }\n action={getMenuItems(menuActions, attachment, onDownloadErrorMessage)}\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 getMenuItems = (\n menuActions: AttachmentMenuAction[],\n attachment: AttachmentMetadata,\n handleOnClickError?: (errMsg: string) => void\n): JSX.Element => {\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 aria-label=\"More\" icon={<MoreHorizontal24Filled />} />\n </MenuTrigger>\n <MenuPopover>\n <MenuList>\n {menuActions.map((menuItem, index) => (\n <MenuItem\n key={index}\n icon={menuItem.icon}\n onClick={() => {\n try {\n 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
+ {"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,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,WAAW,EACX,aAAa,EACb,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,UAAU,EACV,WAAW,EACZ,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,O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AAC,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 } from '../types/Attachment';\nimport { MoreHorizontal24Filled } from '@fluentui/react-icons';\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;\n /**\n * Optional property to indicate progress of attachment upload.\n */\n progress?: number;\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, progress, menuActions, onActionHandlerFailed } = props;\n const attachmentCardStyles = useAttachmentCardStyles();\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 className={attachmentCardStyles.root} size=\"small\" role=\"listitem\">\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={getMenuItems(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 getMenuItems = (\n menuActions: AttachmentMenuAction[],\n attachment: AttachmentMetadata,\n handleOnClickError?: (errMsg: string) => void\n): JSX.Element => {\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 aria-label=\"More\" icon={<MoreHorizontal24Filled />} />\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,5 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { AttachmentMetadata, FileDownloadHandler } from '../types/Attachment';
2
+ import { AttachmentMenuAction, AttachmentMetadata } from '../types/Attachment';
3
+ import { ChatMessage } from '../types';
3
4
  /**
4
5
  * Represents the type of attachment
5
6
  * @public
@@ -13,6 +14,8 @@ export type ChatAttachmentType = 'unknown' | 'image' | /* @conditional-compile-r
13
14
  export interface _AttachmentDownloadCardsStrings {
14
15
  /** Aria label to notify user when focus is on attachment download button. */
15
16
  downloadAttachment: string;
17
+ /** Aria label to notify user when focus is on attachment open button. */
18
+ openAttachment: string;
16
19
  attachmentCardGroupMessage: string;
17
20
  }
18
21
  /**
@@ -20,23 +23,21 @@ export interface _AttachmentDownloadCardsStrings {
20
23
  */
21
24
  export interface _AttachmentDownloadCardsProps {
22
25
  /**
23
- * User id of the local participant
26
+ * A chat message metadata that includes attachment metadata
24
27
  */
25
- userId: string;
28
+ attachments?: AttachmentMetadata[];
26
29
  /**
27
- * A chat message metadata that includes file metadata
30
+ * A chat message metadata that includes attachment metadata
28
31
  */
29
- fileMetadata?: AttachmentMetadata[];
32
+ message?: ChatMessage;
30
33
  /**
31
- * A function of type {@link FileDownloadHandler} for handling attachment downloads.
32
- * If the function is not specified, the attachment's `url` will be opened in a new tab to
33
- * initiate the download.
34
+ * Optional callback to handle attachment download
34
35
  */
35
- downloadHandler?: FileDownloadHandler;
36
+ actionsForAttachment?: (attachment: AttachmentMetadata, message?: ChatMessage) => AttachmentMenuAction[];
36
37
  /**
37
- * Optional callback that runs if downloadHandler returns {@link FileDownloadError}.
38
+ * Optional callback that runs if downloadHandler returns an error.
38
39
  */
39
- onDownloadErrorMessage?: (errMsg: string) => void;
40
+ onActionHandlerFailed?: (errMsg: string) => void;
40
41
  /**
41
42
  * Optional aria label strings for attachment download cards
42
43
  */
@@ -46,4 +47,10 @@ export interface _AttachmentDownloadCardsProps {
46
47
  * @internal
47
48
  */
48
49
  export declare const _AttachmentDownloadCards: (props: _AttachmentDownloadCardsProps) => JSX.Element;
50
+ /**
51
+ * @beta
52
+ *
53
+ * The default menu action for downloading attachments. This action will open the attachment's URL in a new tab.
54
+ */
55
+ export declare const defaultAttachmentMenuAction: AttachmentMenuAction;
49
56
  //# sourceMappingURL=AttachmentDownloadCards.d.ts.map
@@ -1,99 +1,111 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
- return new (P || (P = Promise))(function (resolve, reject) {
6
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
- step((generator = generator.apply(thisArg, _arguments || [])).next());
10
- });
11
- };
12
- import { Icon, Spinner, SpinnerSize, TooltipHost } from '@fluentui/react';
13
- import React, { useCallback, useState } from 'react';
3
+ import { Icon, TooltipHost } from '@fluentui/react';
4
+ import React, { useCallback } from 'react';
14
5
  import { useMemo } from 'react';
15
6
  /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
16
7
  import { useLocale } from '../localization';
17
8
  import { _AttachmentCard } from './AttachmentCard';
18
9
  import { _AttachmentCardGroup } from './AttachmentCardGroup';
19
10
  import { _formatString } from "../../../acs-ui-common/src";
20
- import { Open20Regular } from '@fluentui/react-icons';
21
- /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
22
- import { ArrowDownload20Regular } from '@fluentui/react-icons';
23
11
  const attachmentDownloadCardsStyle = {
24
12
  marginTop: '0.25rem'
25
13
  };
26
- const actionIconStyle = { height: '1rem' };
27
14
  /**
28
15
  * @internal
29
16
  */
30
17
  export const _AttachmentDownloadCards = (props) => {
31
18
  var _a, _b;
32
- const { userId, fileMetadata } = props;
33
- const [showSpinner, setShowSpinner] = useState(false);
19
+ const { attachments, message } = props;
34
20
  const localeStrings = useLocaleStringsTrampoline();
21
+ const getMenuActions = useCallback((attachment, localeStrings, message, action) => {
22
+ const defaultMenuActions = getDefaultMenuActions(localeStrings, message);
23
+ try {
24
+ const actions = action === null || action === void 0 ? void 0 : action(attachment, message);
25
+ if (actions && actions.length > 0) {
26
+ return actions;
27
+ }
28
+ else {
29
+ return defaultMenuActions;
30
+ }
31
+ }
32
+ catch (error) {
33
+ return defaultMenuActions;
34
+ }
35
+ }, []);
35
36
  const downloadAttachmentButtonString = useMemo(() => () => {
36
37
  var _a, _b;
37
38
  return (_b = (_a = props.strings) === null || _a === void 0 ? void 0 : _a.downloadAttachment) !== null && _b !== void 0 ? _b : localeStrings.downloadAttachment;
38
39
  }, [(_a = props.strings) === null || _a === void 0 ? void 0 : _a.downloadAttachment, localeStrings.downloadAttachment]);
39
- const isShowDownloadIcon = useCallback((attachment) => {
40
- var _a;
41
- /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
42
- return ((_a = attachment.payload) === null || _a === void 0 ? void 0 : _a.teamsFileAttachment) !== 'true';
43
- return true;
44
- }, []);
45
40
  const attachmentCardGroupDescription = useMemo(() => () => {
46
41
  var _a, _b, _c, _d;
47
- const fileGroupLocaleString = (_b = (_a = props.strings) === null || _a === void 0 ? void 0 : _a.attachmentCardGroupMessage) !== null && _b !== void 0 ? _b : localeStrings.attachmentCardGroupMessage;
42
+ const attachmentGroupLocaleString = (_b = (_a = props.strings) === null || _a === void 0 ? void 0 : _a.attachmentCardGroupMessage) !== null && _b !== void 0 ? _b : localeStrings.attachmentCardGroupMessage;
48
43
  /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
49
- return _formatString(fileGroupLocaleString, {
50
- attachmentCount: `${(_c = fileMetadata === null || fileMetadata === void 0 ? void 0 : fileMetadata.length) !== null && _c !== void 0 ? _c : 0}`
44
+ return _formatString(attachmentGroupLocaleString, {
45
+ attachmentCount: `${(_c = attachments === null || attachments === void 0 ? void 0 : attachments.length) !== null && _c !== void 0 ? _c : 0}`
51
46
  });
52
- return _formatString(fileGroupLocaleString, {
53
- attachmentCount: `${(_d = fileMetadata === null || fileMetadata === void 0 ? void 0 : fileMetadata.length) !== null && _d !== void 0 ? _d : 0}`
47
+ return _formatString(attachmentGroupLocaleString, {
48
+ attachmentCount: `${(_d = attachments === null || attachments === void 0 ? void 0 : attachments.length) !== null && _d !== void 0 ? _d : 0}`
54
49
  });
55
- }, [(_b = props.strings) === null || _b === void 0 ? void 0 : _b.attachmentCardGroupMessage, localeStrings.attachmentCardGroupMessage, fileMetadata]);
56
- const fileDownloadHandler = useCallback((userId, file) => __awaiter(void 0, void 0, void 0, function* () {
57
- if (!props.downloadHandler) {
58
- window.open(file.url, '_blank', 'noopener,noreferrer');
59
- }
60
- else {
61
- setShowSpinner(true);
62
- try {
63
- const response = yield props.downloadHandler(userId, file);
64
- setShowSpinner(false);
65
- if (response instanceof URL) {
66
- window.open(response.toString(), '_blank', 'noopener,noreferrer');
67
- }
68
- else {
69
- props.onDownloadErrorMessage && props.onDownloadErrorMessage(response.errorMessage);
70
- }
71
- }
72
- finally {
73
- setShowSpinner(false);
74
- }
75
- }
76
- }), [props]);
77
- if (!fileMetadata || fileMetadata.length === 0 || !fileMetadata) {
50
+ }, [(_b = props.strings) === null || _b === void 0 ? void 0 : _b.attachmentCardGroupMessage, localeStrings.attachmentCardGroupMessage, attachments]);
51
+ if (!attachments || attachments.length === 0 || !attachments) {
78
52
  return React.createElement(React.Fragment, null);
79
53
  }
80
- return (React.createElement("div", { style: attachmentDownloadCardsStyle, "data-ui-id": "file-download-card-group" },
81
- React.createElement(_AttachmentCardGroup, { ariaLabel: attachmentCardGroupDescription() }, fileMetadata &&
82
- fileMetadata.map((attachment) => (React.createElement(TooltipHost, { content: downloadAttachmentButtonString(), key: attachment.name },
83
- React.createElement(_AttachmentCard, { attachmentName: attachment.name, key: attachment.name, attachmentExtension: attachment.extension, actionIcon: showSpinner ? (React.createElement(Spinner, { size: SpinnerSize.medium, "aria-live": 'polite', role: 'status' })) : true && isShowDownloadIcon(attachment) ? (React.createElement(DownloadIconTrampoline, null)) : (React.createElement(Open20Regular, null)), actionHandler: () => fileDownloadHandler(userId, attachment) })))))));
54
+ return (React.createElement("div", { style: attachmentDownloadCardsStyle, "data-ui-id": "attachment-download-card-group" },
55
+ React.createElement(_AttachmentCardGroup, { ariaLabel: attachmentCardGroupDescription() }, attachments &&
56
+ attachments.map((attachment) => (React.createElement(TooltipHost, { content: downloadAttachmentButtonString(), key: attachment.name },
57
+ React.createElement(_AttachmentCard, { attachment: attachment, key: attachment.id, menuActions: getMenuActions(attachment, localeStrings, message, props.actionsForAttachment), onActionHandlerFailed: props.onActionHandlerFailed })))))));
84
58
  };
85
59
  /**
86
60
  * @private
87
61
  */
88
- const DownloadIconTrampoline = () => {
89
- // @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload)
90
- return React.createElement(ArrowDownload20Regular, { "data-ui-id": 'file-download-card-download-icon' });
91
- // Return _some_ available icon, as the real icon is beta-only.
92
- return React.createElement(Icon, { iconName: "EditBoxCancel", style: actionIconStyle });
93
- };
94
62
  const useLocaleStringsTrampoline = () => {
95
63
  /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */
96
64
  return useLocale().strings.messageThread;
97
- return { downloadAttachment: '', attachmentCardGroupMessage: '' };
65
+ return { downloadAttachment: '', openAttachment: '', attachmentCardGroupMessage: '' };
66
+ };
67
+ /**
68
+ * @private
69
+ */
70
+ const getDefaultMenuActions = (locale, chatMessage) => {
71
+ var _a;
72
+ // if message is sent by a Teams user, we need to use a different icon ("open")
73
+ if ((_a = chatMessage === null || chatMessage === void 0 ? void 0 : chatMessage.senderId) === null || _a === void 0 ? void 0 : _a.includes('8:orgid:')) {
74
+ return [
75
+ Object.assign(Object.assign({}, defaultAttachmentMenuAction), { name: locale.openAttachment, icon: React.createElement(Icon, { iconName: "OpenAttachment" }) })
76
+ ];
77
+ }
78
+ // otherwise, use the default icon ("download")
79
+ return [
80
+ Object.assign(Object.assign({}, defaultAttachmentMenuAction), { name: locale.downloadAttachment })
81
+ ];
82
+ };
83
+ /**
84
+ * @beta
85
+ *
86
+ * The default menu action for downloading attachments. This action will open the attachment's URL in a new tab.
87
+ */
88
+ export const defaultAttachmentMenuAction = {
89
+ /**
90
+ *
91
+ * name is used for aria-label only when there's one button. For multiple buttons, it's used as a label.
92
+ * by default it's an unlocalized string when this is used as a imported constant,
93
+ * but you can overwrite it with your own localized string.
94
+ *
95
+ * i.e. defaultAttachmentMenuAction.name = localize('Download');
96
+ *
97
+ * when no action is provided, the UI library will overwrite this name
98
+ * with a localized string this string when it's used in the UI.
99
+ */
100
+ name: 'Download',
101
+ // this is the icon shown on the right of the attachment card
102
+ icon: React.createElement(Icon, { iconName: "DownloadAttachment", "data-ui-id": "attachment-download-card-download-icon" }),
103
+ // this is the action that runs when the icon is clicked
104
+ onClick: (attachment) => {
105
+ return new Promise((resolve) => {
106
+ window.open(attachment.url, '_blank', 'noopener,noreferrer');
107
+ resolve();
108
+ });
109
+ }
98
110
  };
99
111
  //# sourceMappingURL=AttachmentDownloadCards.js.map
@@ -1 +1 @@
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,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,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,OAAO,EAAE,aAAa,EAAE,mCAAgC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,qGAAqG;AACrG,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAkD/D,MAAM,4BAA4B,GAAG;IACnC,SAAS,EAAE,SAAS;CACrB,CAAC;AAEF,MAAM,eAAe,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAE3C;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,KAAoC,EAAe,EAAE;;IAC5F,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IACvC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,aAAa,GAAG,0BAA0B,EAAE,CAAC;IAEnD,MAAM,8BAA8B,GAAG,OAAO,CAC5C,GAAG,EAAE,CAAC,GAAG,EAAE;;QACT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C,MAAM,eAAa,QAAQ,EAAE,IAAI,EAAE,QAAQ,GAAI,CAC3E,CAAC,CAAC,CAAC,IAAI,IAAI,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAC3C,oBAAC,sBAAsB,OAAG,CAC3B,CAAC,CAAC,CAAC,CACF,oBAAC,aAAa,OAAG,CAClB,EAEH,aAAa,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC,MAAM,EAAE,UAAU,CAAC,GAC5D,CACU,CACf,CAAC,CACiB,CACnB,CACP,CAAC;AACJ,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,sBAAsB,GAAG,GAAgB,EAAE;IAC/C,kGAAkG;IAClG,OAAO,oBAAC,sBAAsB,kBAAa,kCAAkC,GAAI,CAAC;IAClF,+DAA+D;IAC/D,OAAO,oBAAC,IAAI,IAAC,QAAQ,EAAC,eAAe,EAAC,KAAK,EAAE,eAAe,GAAI,CAAC;AACnE,CAAC,CAAC;AAEF,MAAM,0BAA0B,GAAG,GAAoC,EAAE;IACvE,qGAAqG;IACrG,OAAO,SAAS,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC;IACzC,OAAO,EAAE,kBAAkB,EAAE,EAAE,EAAE,0BAA0B,EAAE,EAAE,EAAE,CAAC;AACpE,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Icon, Spinner, SpinnerSize, TooltipHost } from '@fluentui/react';\nimport React, { useCallback, useState } 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';\nimport { _formatString } from '@internal/acs-ui-common';\nimport { AttachmentMetadata, FileDownloadHandler } from '../types/Attachment';\nimport { Open20Regular } from '@fluentui/react-icons';\n/* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\nimport { ArrowDownload20Regular } from '@fluentui/react-icons';\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 attachmentCardGroupMessage: string;\n}\n\n/**\n * @internal\n */\nexport interface _AttachmentDownloadCardsProps {\n /**\n * User id of the local participant\n */\n userId: string;\n /**\n * A chat message metadata that includes file metadata\n */\n fileMetadata?: AttachmentMetadata[];\n /**\n * A function of type {@link FileDownloadHandler} for handling attachment downloads.\n * If the function is not specified, the attachment's `url` will be opened in a new tab to\n * initiate the download.\n */\n downloadHandler?: FileDownloadHandler;\n /**\n * Optional callback that runs if downloadHandler returns {@link FileDownloadError}.\n */\n onDownloadErrorMessage?: (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\nconst actionIconStyle = { height: '1rem' };\n\n/**\n * @internal\n */\nexport const _AttachmentDownloadCards = (props: _AttachmentDownloadCardsProps): JSX.Element => {\n const { userId, fileMetadata } = props;\n const [showSpinner, setShowSpinner] = useState(false);\n const localeStrings = useLocaleStringsTrampoline();\n\n const downloadAttachmentButtonString = useMemo(\n () => () => {\n return props.strings?.downloadAttachment ?? localeStrings.downloadAttachment;\n },\n [props.strings?.downloadAttachment, localeStrings.downloadAttachment]\n );\n\n const isShowDownloadIcon = useCallback((attachment: AttachmentMetadata): boolean => {\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n return attachment.payload?.teamsFileAttachment !== 'true';\n return true;\n }, []);\n\n const attachmentCardGroupDescription = useMemo(\n () => () => {\n const fileGroupLocaleString =\n props.strings?.attachmentCardGroupMessage ?? localeStrings.attachmentCardGroupMessage;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n return _formatString(fileGroupLocaleString, {\n attachmentCount: `${fileMetadata?.length ?? 0}`\n });\n return _formatString(fileGroupLocaleString, {\n attachmentCount: `${fileMetadata?.length ?? 0}`\n });\n },\n [props.strings?.attachmentCardGroupMessage, localeStrings.attachmentCardGroupMessage, fileMetadata]\n );\n\n const fileDownloadHandler = useCallback(\n async (userId: string, file: AttachmentMetadata) => {\n if (!props.downloadHandler) {\n window.open(file.url, '_blank', 'noopener,noreferrer');\n } else {\n setShowSpinner(true);\n try {\n const response = await props.downloadHandler(userId, file);\n setShowSpinner(false);\n if (response instanceof URL) {\n window.open(response.toString(), '_blank', 'noopener,noreferrer');\n } else {\n props.onDownloadErrorMessage && props.onDownloadErrorMessage(response.errorMessage);\n }\n } finally {\n setShowSpinner(false);\n }\n }\n },\n [props]\n );\n if (!fileMetadata || fileMetadata.length === 0 || !fileMetadata) {\n return <></>;\n }\n\n return (\n <div style={attachmentDownloadCardsStyle} data-ui-id=\"file-download-card-group\">\n <_AttachmentCardGroup ariaLabel={attachmentCardGroupDescription()}>\n {fileMetadata &&\n fileMetadata.map((attachment) => (\n <TooltipHost content={downloadAttachmentButtonString()} key={attachment.name}>\n <_AttachmentCard\n attachmentName={attachment.name}\n key={attachment.name}\n attachmentExtension={attachment.extension}\n actionIcon={\n showSpinner ? (\n <Spinner size={SpinnerSize.medium} aria-live={'polite'} role={'status'} />\n ) : true && isShowDownloadIcon(attachment) ? (\n <DownloadIconTrampoline />\n ) : (\n <Open20Regular />\n )\n }\n actionHandler={() => fileDownloadHandler(userId, attachment)}\n />\n </TooltipHost>\n ))}\n </_AttachmentCardGroup>\n </div>\n );\n};\n\n/**\n * @private\n */\nconst DownloadIconTrampoline = (): JSX.Element => {\n // @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload)\n return <ArrowDownload20Regular data-ui-id={'file-download-card-download-icon'} />;\n // Return _some_ available icon, as the real icon is beta-only.\n return <Icon iconName=\"EditBoxCancel\" style={actionIconStyle} />;\n};\n\nconst useLocaleStringsTrampoline = (): _AttachmentDownloadCardsStrings => {\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n return useLocale().strings.messageThread;\n return { downloadAttachment: '', attachmentCardGroupMessage: '' };\n};\n"]}
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,OAAO,EAAE,aAAa,EAAE,mCAAgC;AAoDxD,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,EAC9B,aAA8C,EAC9C,OAAqB,EACrB,MAA0F,EAClE,EAAE;QAC1B,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QACzE,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,aAAN,M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AC;IACJ,CAAC;IACD,+CAA+C;IAC/C,OAAO;wCAEA,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';\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 const attachmentGroupLocaleString =\n props.strings?.attachmentCardGroupMessage ?? localeStrings.attachmentCardGroupMessage;\n /* @conditional-compile-remove(attachment-download) @conditional-compile-remove(attachment-upload) */\n return _formatString(attachmentGroupLocaleString, {\n attachmentCount: `${attachments?.length ?? 0}`\n });\n return _formatString(attachmentGroupLocaleString, {\n attachmentCount: `${attachments?.length ?? 0}`\n });\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"]}