@azure/communication-react 1.18.0-alpha-202406150014 → 1.18.0-alpha-202406191739
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.
- package/dist/communication-react.d.ts +54 -28
- package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-XMNUmuTx.js → ChatMessageComponentAsRichTextEditBox-HBSSHZ2s.js} +2 -2
- package/dist/dist-cjs/communication-react/{ChatMessageComponentAsRichTextEditBox-XMNUmuTx.js.map → ChatMessageComponentAsRichTextEditBox-HBSSHZ2s.js.map} +1 -1
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-BLmR8ku0.js → RichTextSendBoxWrapper-DDN8Weyb.js} +2 -2
- package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-BLmR8ku0.js.map → RichTextSendBoxWrapper-DDN8Weyb.js.map} +1 -1
- package/dist/dist-cjs/communication-react/{index-CzkriUUT.js → index-CAm6Qb1t.js} +638 -197
- package/dist/dist-cjs/communication-react/index-CAm6Qb1t.js.map +1 -0
- package/dist/dist-cjs/communication-react/index.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/errorNotificationsSelector.d.ts +22 -0
- package/dist/dist-esm/calling-component-bindings/src/errorNotificationsSelector.js +146 -0
- package/dist/dist-esm/calling-component-bindings/src/errorNotificationsSelector.js.map +1 -0
- package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.d.ts +1 -0
- package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js +7 -1
- package/dist/dist-esm/calling-component-bindings/src/handlers/createCommonHandlers.js.map +1 -1
- package/dist/dist-esm/calling-component-bindings/src/index.d.ts +2 -0
- package/dist/dist-esm/calling-component-bindings/src/index.js +2 -0
- package/dist/dist-esm/calling-component-bindings/src/index.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js +2 -1
- package/dist/dist-esm/chat-component-bindings/src/handlers/createHandlers.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCard.js +5 -4
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCard.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCardGroup.d.ts +1 -0
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCardGroup.js +3 -3
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentCardGroup.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.js +1 -10
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentUploadCards.d.ts +4 -0
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentUploadCards.js +18 -21
- package/dist/dist-esm/react-components/src/components/Attachment/AttachmentUploadCards.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ErrorBar.js +1 -1
- package/dist/dist-esm/react-components/src/components/ErrorBar.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/Notifications.d.ts +23 -28
- package/dist/dist-esm/react-components/src/components/Notifications.js +17 -7
- package/dist/dist-esm/react-components/src/components/Notifications.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ParticipantList.js +3 -2
- package/dist/dist-esm/react-components/src/components/ParticipantList.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/PlaceholderPlugin.d.ts +2 -2
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/PlaceholderPlugin.js +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/Plugins/PlaceholderPlugin.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js +16 -29
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextEditor.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js +10 -4
- package/dist/dist-esm/react-components/src/components/RichTextEditor/RichTextSendBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/SendBox.js +9 -3
- package/dist/dist-esm/react-components/src/components/SendBox.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/TroubleshootingGuideErrorBar.js +1 -1
- package/dist/dist-esm/react-components/src/components/TroubleshootingGuideErrorBar.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoEffects/VideoBackgroundEffectsPicker.js +1 -1
- package/dist/dist-esm/react-components/src/components/VideoEffects/VideoBackgroundEffectsPicker.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery/useVideoTileContextualMenuProps.d.ts +1 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery/useVideoTileContextualMenuProps.js +3 -3
- package/dist/dist-esm/react-components/src/components/VideoGallery/useVideoTileContextualMenuProps.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/VideoGallery.d.ts +2 -0
- package/dist/dist-esm/react-components/src/components/VideoGallery.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.d.ts +1 -1
- package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.js +10 -0
- package/dist/dist-esm/react-components/src/components/styles/AttachmentCard.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/AttachmentCardGroup.styles.d.ts +4 -0
- package/dist/dist-esm/react-components/src/components/styles/AttachmentCardGroup.styles.js +8 -0
- package/dist/dist-esm/react-components/src/components/styles/AttachmentCardGroup.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js +1 -1
- package/dist/dist-esm/react-components/src/components/styles/MessageThread.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.js +24 -13
- package/dist/dist-esm/react-components/src/components/styles/RichTextEditor.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.d.ts +4 -0
- package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js +9 -0
- package/dist/dist-esm/react-components/src/components/styles/SendBox.styles.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/utils.d.ts +32 -1
- package/dist/dist-esm/react-components/src/components/utils.js +84 -0
- package/dist/dist-esm/react-components/src/components/utils.js.map +1 -1
- package/dist/dist-esm/react-components/src/localization/locales/ar-SA/strings.json +170 -3
- package/dist/dist-esm/react-components/src/localization/locales/cs-CZ/strings.json +168 -1
- package/dist/dist-esm/react-components/src/localization/locales/de-DE/strings.json +170 -3
- package/dist/dist-esm/react-components/src/localization/locales/en-GB/strings.json +168 -1
- package/dist/dist-esm/react-components/src/localization/locales/en-US/strings.json +2 -23
- package/dist/dist-esm/react-components/src/localization/locales/es-ES/strings.json +170 -3
- package/dist/dist-esm/react-components/src/localization/locales/fi-FI/strings.json +168 -1
- package/dist/dist-esm/react-components/src/localization/locales/fr-FR/strings.json +170 -3
- package/dist/dist-esm/react-components/src/localization/locales/he-IL/strings.json +168 -1
- package/dist/dist-esm/react-components/src/localization/locales/it-IT/strings.json +170 -3
- package/dist/dist-esm/react-components/src/localization/locales/ja-JP/strings.json +168 -1
- package/dist/dist-esm/react-components/src/localization/locales/ko-KR/strings.json +168 -1
- package/dist/dist-esm/react-components/src/localization/locales/nb-NO/strings.json +168 -1
- package/dist/dist-esm/react-components/src/localization/locales/nl-NL/strings.json +168 -1
- package/dist/dist-esm/react-components/src/localization/locales/pl-PL/strings.json +168 -1
- package/dist/dist-esm/react-components/src/localization/locales/pt-BR/strings.json +170 -3
- package/dist/dist-esm/react-components/src/localization/locales/ru-RU/strings.json +168 -1
- package/dist/dist-esm/react-components/src/localization/locales/sv-SE/strings.json +170 -3
- package/dist/dist-esm/react-components/src/localization/locales/tr-TR/strings.json +170 -3
- package/dist/dist-esm/react-components/src/localization/locales/zh-CN/strings.json +170 -3
- package/dist/dist-esm/react-components/src/localization/locales/zh-TW/strings.json +170 -3
- package/dist/dist-esm/react-components/src/theming/FluentV9ThemeProvider.d.ts +1 -0
- package/dist/dist-esm/react-components/src/theming/FluentV9ThemeProvider.js +4 -4
- package/dist/dist-esm/react-components/src/theming/FluentV9ThemeProvider.js.map +1 -1
- package/dist/dist-esm/react-components/src/theming/themes.js +13 -12
- package/dist/dist-esm/react-components/src/theming/themes.js.map +1 -1
- package/dist/dist-esm/react-components/src/theming/v9ThemeShim.js +1 -1
- package/dist/dist-esm/react-components/src/theming/v9ThemeShim.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js +24 -5
- package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.d.ts +20 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +1 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +8 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.d.ts +4 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.d.ts +4 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js +33 -5
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/usePeoplePane.d.ts +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/usePeoplePane.js +68 -4
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/usePeoplePane.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/useVideoEffectsPane.d.ts +3 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/useVideoEffectsPane.js +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/components/SidePane/useVideoEffectsPane.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js +4 -0
- package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.d.ts +3 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js +5 -3
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js +4 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.js +4 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/TransferPage.js +4 -2
- package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/TransferPage.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.d.ts +1 -0
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +6 -0
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.d.ts +4 -0
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.d.ts +1 -0
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.js +6 -0
- package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/CallWithChatBackedCallAdapter.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +26 -6
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.js +5 -4
- package/dist/dist-esm/react-composites/src/composites/ChatComposite/file-sharing/AttachmentUploadButton.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.d.ts +1 -0
- package/dist/dist-esm/react-composites/src/composites/common/Drawer/MoreDrawer.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/common/VideoEffectsPane.d.ts +3 -2
- package/dist/dist-esm/react-composites/src/composites/common/VideoEffectsPane.js +40 -2
- package/dist/dist-esm/react-composites/src/composites/common/VideoEffectsPane.js.map +1 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/ar-SA/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/cs-CZ/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/de-DE/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/en-GB/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/en-US/strings.json +6 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/es-ES/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/fi-FI/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/fr-FR/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/he-IL/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/it-IT/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/ja-JP/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/ko-KR/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/nb-NO/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/nl-NL/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/pl-PL/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/pt-BR/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/ru-RU/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/sv-SE/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/tr-TR/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-CN/strings.json +7 -1
- package/dist/dist-esm/react-composites/src/composites/localization/locales/zh-TW/strings.json +7 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/package.json +10 -10
- package/dist/dist-cjs/communication-react/index-CzkriUUT.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createHandlers.js","sourceRoot":"","sources":["../../../../../../chat-component-bindings/src/handlers/createHandlers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAIlC,OAAO,EAAU,+BAA+B,EAAE,mCAAgC;AAKlF,OAAO,UAAU,MAAM,aAAa,CAAC;AA+BrC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,UAAU,CACjD,CAAC,UAA8B,EAAE,gBAAkC,EAAgB,EAAE;IACnF,IAAI,eAAe,GAAwD,SAAS,CAAC;IACrF,IAAI,mBAAmB,GAAmE,SAAS,CAAC;IACpG,OAAO;QACL,0DAA0D;QAC1D,0DAA0D;QAC1D,aAAa,EAAE,UACb,OAAe,EACf,OAAiG;;gBAEjG,MAAM,kBAAkB,GAAG;oBACzB,OAAO;oBACP,iBAAiB,EAAE,UAAU,CAAC,QAAQ,EAAE,CAAC,WAAW;iBACrD,CAAC;gBACF,mDAAmD;gBACnD,IACE,OAAO;oBACP,aAAa,IAAI,OAAO;oBACxB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AC,KAAK,0CAAE,IAAI,KAAI,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;oBACzD,sBAAsB,EAAE,CAAC;gBAC3B,CAAC;gBAED,gDAAgD;gBAChD,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;oBACjB,uBAAuB,GAAG,IAAI,CAAC;oBAC/B,MAAM;gBACR,CAAC;YACH,CAAC;YACD,6EAA6E;YAC7E,IAAI,WAAW,GAAG,MAAM,mBAAmB,CAAC,IAAI,EAAE,CAAC;YACnD,OAAO,CAAC,WAAW,CAAC,IAAI,IAAI,QAAQ,CAAC,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,0CAAE,aAAa,CAAC,IAAI,YAAY,EAAE,CAAC;gBACxF,WAAW,GAAG,MAAM,mBAAmB,CAAC,IAAI,EAAE,CAAC;YACjD,CAAC;YAED,OAAO,uBAAuB,CAAC;QACjC,CAAC,CAAA;KACF,CAAC;AACJ,CAAC,CACF,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,CACnD,UAA8B,EAC9B,gBAAkC,EAClC,CAAwC,EACX,EAAE;IAC/B,OAAO,yBAAyB,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;AACjE,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { PagedAsyncIterableIterator } from '@azure/core-paging';\nimport { ReactElement } from 'react';\nimport { Common, fromFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { StatefulChatClient } from '@internal/chat-stateful-client';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { ChatAttachment } from '@azure/communication-chat';\nimport { ChatMessage, ChatMessageReadReceipt, ChatThreadClient, SendMessageOptions } from '@azure/communication-chat';\nimport memoizeOne from 'memoize-one';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { MessageOptions } from '@internal/acs-ui-common';\n\n/**\n * Object containing all the handlers required for chat components.\n *\n * Chat related components from this package are able to pick out relevant handlers from this object.\n * See {@link useHandlers} and {@link usePropsFor}.\n *\n * @public\n */\nexport type ChatHandlers = {\n onSendMessage: (\n content: string,\n options?: SendMessageOptions | /* @conditional-compile-remove(file-sharing-acs) */ MessageOptions\n ) => Promise<void>;\n onMessageSeen: (chatMessageId: string) => Promise<void>;\n onTyping: () => Promise<void>;\n onRemoveParticipant: (userId: string) => Promise<void>;\n updateThreadTopicName: (topicName: string) => Promise<void>;\n onLoadPreviousChatMessages: (messagesToLoad: number) => Promise<boolean>;\n onUpdateMessage: (\n messageId: string,\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) => Promise<void>;\n onDeleteMessage: (messageId: string) => Promise<void>;\n};\n\n/**\n * Create the default implementation of {@link ChatHandlers}.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * Returned object is memoized to avoid rerenders when used as props for React Components.\n *\n * @public\n */\nexport const createDefaultChatHandlers = memoizeOne(\n (chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient): ChatHandlers => {\n let messageIterator: PagedAsyncIterableIterator<ChatMessage> | undefined = undefined;\n let readReceiptIterator: PagedAsyncIterableIterator<ChatMessageReadReceipt> | undefined = undefined;\n return {\n // due to a bug in babel, we can't use arrow function here\n // affecting conditional-compile-remove(attachment-upload)\n onSendMessage: async function (\n content: string,\n options?: SendMessageOptions | /* @conditional-compile-remove(file-sharing-acs) */ MessageOptions\n ) {\n const sendMessageRequest = {\n content,\n senderDisplayName: chatClient.getState().displayName\n };\n /* @conditional-compile-remove(file-sharing-acs) */\n if (\n options &&\n 'attachments' in options &&\n options.attachments &&\n options.attachments[0] &&\n !(options.attachments[0] as ChatAttachment).attachmentType\n ) {\n const chatSDKOptions = {\n metadata: {\n ...options?.metadata,\n fileSharingMetadata: JSON.stringify(options?.attachments)\n }\n };\n await chatThreadClient.sendMessage(sendMessageRequest, chatSDKOptions);\n return;\n }\n await chatThreadClient.sendMessage(sendMessageRequest, options as SendMessageOptions);\n },\n // due to a bug in babel, we can't use arrow function here\n // affecting conditional-compile-remove(attachment-upload)\n onUpdateMessage: async function (\n messageId: string,\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) {\n const updateMessageOptions = {\n content,\n /* @conditional-compile-remove(file-sharing-acs) */\n metadata: {\n ...options?.metadata,\n fileSharingMetadata: JSON.stringify(options?.attachments)\n }\n };\n await chatThreadClient.updateMessage(messageId, updateMessageOptions);\n },\n onDeleteMessage: async (messageId: string) => {\n await chatThreadClient.deleteMessage(messageId);\n },\n // This handler is designed for chatThread to consume\n onMessageSeen: async (chatMessageId: string) => {\n await chatThreadClient.sendReadReceipt({ chatMessageId });\n },\n onTyping: async () => {\n await chatThreadClient.sendTypingNotification();\n },\n onRemoveParticipant: async (userId: string) => {\n await chatThreadClient.removeParticipant(fromFlatCommunicationIdentifier(userId));\n },\n updateThreadTopicName: async (topicName: string) => {\n await chatThreadClient.updateTopic(topicName);\n },\n onLoadPreviousChatMessages: async (messagesToLoad: number) => {\n if (messageIterator === undefined) {\n // Lazy definition so that errors in the method call are reported correctly.\n // Also allows recovery via retries in case of transient errors.\n messageIterator = chatThreadClient.listMessages({ maxPageSize: 50 });\n }\n if (readReceiptIterator === undefined) {\n readReceiptIterator = chatThreadClient.listReadReceipts();\n }\n // get the earliest message time\n let remainingMessagesToGet = messagesToLoad;\n let isAllChatMessagesLoaded = false;\n let earliestTime = Number.MAX_SAFE_INTEGER;\n while (remainingMessagesToGet >= 1) {\n const message = await messageIterator.next();\n if (message?.value?.id) {\n if (parseInt(message.value.id) < earliestTime) {\n earliestTime = parseInt(message.value.id);\n }\n }\n\n if (message.value?.type && message.value.type === 'text') {\n remainingMessagesToGet--;\n }\n\n // We have traversed all messages in this thread\n if (message.done) {\n isAllChatMessagesLoaded = true;\n break;\n }\n }\n // keep fetching read receipts until read receipt time < earlist message time\n let readReceipt = await readReceiptIterator.next();\n while (!readReceipt.done && parseInt(readReceipt?.value?.chatMessageId) >= earliestTime) {\n readReceipt = await readReceiptIterator.next();\n }\n\n return isAllChatMessagesLoaded;\n }\n };\n }\n);\n\n/**\n * Create a set of default handlers for given component.\n *\n * Returned object is memoized (with reference to the arguments) to avoid\n * renders when used as props for React Components.\n *\n * @public\n */\nexport const createDefaultChatHandlersForComponent = <Props>(\n chatClient: StatefulChatClient,\n chatThreadClient: ChatThreadClient,\n _: (props: Props) => ReactElement | null\n): Common<ChatHandlers, Props> => {\n return createDefaultChatHandlers(chatClient, chatThreadClient);\n};\n"]}
|
1
|
+
{"version":3,"file":"createHandlers.js","sourceRoot":"","sources":["../../../../../../chat-component-bindings/src/handlers/createHandlers.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAIlC,OAAO,EAAU,+BAA+B,EAAE,mCAAgC;AAKlF,OAAO,UAAU,MAAM,aAAa,CAAC;AA+BrC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,UAAU,CACjD,CAAC,UAA8B,EAAE,gBAAkC,EAAgB,EAAE;IACnF,IAAI,eAAe,GAAwD,SAAS,CAAC;IACrF,IAAI,mBAAmB,GAAmE,SAAS,CAAC;IACpG,OAAO;QACL,0DAA0D;QAC1D,0DAA0D;QAC1D,aAAa,EAAE,UACb,OAAe,EACf,OAAiG;;gBAEjG,MAAM,kBAAkB,GAAG;oBACzB,OAAO;oBACP,iBAAiB,EAAE,UAAU,CAAC,QAAQ,EAAE,CAAC,WAAW;iBACrD,CAAC;gBACF,mDAAmD;gBACnD,IACE,OAAO;oBACP,aAAa,IAAI,OAAO;oBACxB,OAAO,CAAC,WAAW;oBACnB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;oBACtB,CAAE,OAAO,CAAC,WAAW,CAAC,CAAC,CAAoB,CAAC,cAAc,EAC1D,CAAC;oBACD,MAAM,cAAc,GAAG;wBACrB,QAAQ,kCACH,OAAO,aAAP,OAAO,uBAAP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,EAAE,CAAC;oBACjB,uBAAuB,GAAG,IAAI,CAAC;oBAC/B,MAAM;gBACR,CAAC;YACH,CAAC;YACD,6EAA6E;YAC7E,IAAI,WAAW,GAAG,MAAM,mBAAmB,CAAC,IAAI,EAAE,CAAC;YACnD,OAAO,CAAC,WAAW,CAAC,IAAI,IAAI,QAAQ,CAAC,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,0CAAE,aAAa,CAAC,IAAI,YAAY,EAAE,CAAC;gBACxF,WAAW,GAAG,MAAM,mBAAmB,CAAC,IAAI,EAAE,CAAC;YACjD,CAAC;YAED,OAAO,uBAAuB,CAAC;QACjC,CAAC,CAAA;KACF,CAAC;AACJ,CAAC,CACF,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,CACnD,UAA8B,EAC9B,gBAAkC,EAClC,CAAwC,EACX,EAAE;IAC/B,OAAO,yBAAyB,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;AACjE,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { PagedAsyncIterableIterator } from '@azure/core-paging';\nimport { ReactElement } from 'react';\nimport { Common, fromFlatCommunicationIdentifier } from '@internal/acs-ui-common';\nimport { StatefulChatClient } from '@internal/chat-stateful-client';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { ChatAttachment } from '@azure/communication-chat';\nimport { ChatMessage, ChatMessageReadReceipt, ChatThreadClient, SendMessageOptions } from '@azure/communication-chat';\nimport memoizeOne from 'memoize-one';\n/* @conditional-compile-remove(file-sharing-acs) */\nimport { MessageOptions } from '@internal/acs-ui-common';\n\n/**\n * Object containing all the handlers required for chat components.\n *\n * Chat related components from this package are able to pick out relevant handlers from this object.\n * See {@link useHandlers} and {@link usePropsFor}.\n *\n * @public\n */\nexport type ChatHandlers = {\n onSendMessage: (\n content: string,\n options?: SendMessageOptions | /* @conditional-compile-remove(file-sharing-acs) */ MessageOptions\n ) => Promise<void>;\n onMessageSeen: (chatMessageId: string) => Promise<void>;\n onTyping: () => Promise<void>;\n onRemoveParticipant: (userId: string) => Promise<void>;\n updateThreadTopicName: (topicName: string) => Promise<void>;\n onLoadPreviousChatMessages: (messagesToLoad: number) => Promise<boolean>;\n onUpdateMessage: (\n messageId: string,\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) => Promise<void>;\n onDeleteMessage: (messageId: string) => Promise<void>;\n};\n\n/**\n * Create the default implementation of {@link ChatHandlers}.\n *\n * Useful when implementing a custom component that utilizes the providers\n * exported from this library.\n *\n * Returned object is memoized to avoid rerenders when used as props for React Components.\n *\n * @public\n */\nexport const createDefaultChatHandlers = memoizeOne(\n (chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient): ChatHandlers => {\n let messageIterator: PagedAsyncIterableIterator<ChatMessage> | undefined = undefined;\n let readReceiptIterator: PagedAsyncIterableIterator<ChatMessageReadReceipt> | undefined = undefined;\n return {\n // due to a bug in babel, we can't use arrow function here\n // affecting conditional-compile-remove(attachment-upload)\n onSendMessage: async function (\n content: string,\n options?: SendMessageOptions | /* @conditional-compile-remove(file-sharing-acs) */ MessageOptions\n ) {\n const sendMessageRequest = {\n content,\n senderDisplayName: chatClient.getState().displayName\n };\n /* @conditional-compile-remove(file-sharing-acs) */\n if (\n options &&\n 'attachments' in options &&\n options.attachments &&\n options.attachments[0] &&\n !(options.attachments[0] as ChatAttachment).attachmentType\n ) {\n const chatSDKOptions = {\n metadata: {\n ...options?.metadata,\n fileSharingMetadata: JSON.stringify(options?.attachments)\n },\n type: options.type\n };\n await chatThreadClient.sendMessage(sendMessageRequest, chatSDKOptions);\n return;\n }\n await chatThreadClient.sendMessage(sendMessageRequest, options as SendMessageOptions);\n },\n // due to a bug in babel, we can't use arrow function here\n // affecting conditional-compile-remove(attachment-upload)\n onUpdateMessage: async function (\n messageId: string,\n content: string,\n /* @conditional-compile-remove(file-sharing-acs) */\n options?: MessageOptions\n ) {\n const updateMessageOptions = {\n content,\n /* @conditional-compile-remove(file-sharing-acs) */\n metadata: {\n ...options?.metadata,\n fileSharingMetadata: JSON.stringify(options?.attachments)\n }\n };\n await chatThreadClient.updateMessage(messageId, updateMessageOptions);\n },\n onDeleteMessage: async (messageId: string) => {\n await chatThreadClient.deleteMessage(messageId);\n },\n // This handler is designed for chatThread to consume\n onMessageSeen: async (chatMessageId: string) => {\n await chatThreadClient.sendReadReceipt({ chatMessageId });\n },\n onTyping: async () => {\n await chatThreadClient.sendTypingNotification();\n },\n onRemoveParticipant: async (userId: string) => {\n await chatThreadClient.removeParticipant(fromFlatCommunicationIdentifier(userId));\n },\n updateThreadTopicName: async (topicName: string) => {\n await chatThreadClient.updateTopic(topicName);\n },\n onLoadPreviousChatMessages: async (messagesToLoad: number) => {\n if (messageIterator === undefined) {\n // Lazy definition so that errors in the method call are reported correctly.\n // Also allows recovery via retries in case of transient errors.\n messageIterator = chatThreadClient.listMessages({ maxPageSize: 50 });\n }\n if (readReceiptIterator === undefined) {\n readReceiptIterator = chatThreadClient.listReadReceipts();\n }\n // get the earliest message time\n let remainingMessagesToGet = messagesToLoad;\n let isAllChatMessagesLoaded = false;\n let earliestTime = Number.MAX_SAFE_INTEGER;\n while (remainingMessagesToGet >= 1) {\n const message = await messageIterator.next();\n if (message?.value?.id) {\n if (parseInt(message.value.id) < earliestTime) {\n earliestTime = parseInt(message.value.id);\n }\n }\n\n if (message.value?.type && message.value.type === 'text') {\n remainingMessagesToGet--;\n }\n\n // We have traversed all messages in this thread\n if (message.done) {\n isAllChatMessagesLoaded = true;\n break;\n }\n }\n // keep fetching read receipts until read receipt time < earlist message time\n let readReceipt = await readReceiptIterator.next();\n while (!readReceipt.done && parseInt(readReceipt?.value?.chatMessageId) >= earliestTime) {\n readReceipt = await readReceiptIterator.next();\n }\n\n return isAllChatMessagesLoaded;\n }\n };\n }\n);\n\n/**\n * Create a set of default handlers for given component.\n *\n * Returned object is memoized (with reference to the arguments) to avoid\n * renders when used as props for React Components.\n *\n * @public\n */\nexport const createDefaultChatHandlersForComponent = <Props>(\n chatClient: StatefulChatClient,\n chatThreadClient: ChatThreadClient,\n _: (props: Props) => ReactElement | null\n): Common<ChatHandlers, Props> => {\n return createDefaultChatHandlers(chatClient, chatThreadClient);\n};\n"]}
|
@@ -66,7 +66,8 @@ export const _AttachmentCard = (props) => {
|
|
66
66
|
gapSpace: 0,
|
67
67
|
target: '#attachment-' + attachment.id
|
68
68
|
} },
|
69
|
-
React.createElement(
|
69
|
+
React.createElement("div", { className: attachmentCardStyles.fileNameLabel },
|
70
|
+
React.createElement(Text, { className: attachmentCardStyles.title, "aria-label": attachment.name }, attachment.name)))), action: React.createElement("div", { className: attachmentCardStyles.focusState }, MappedMenuItems(menuActions, Object.assign(Object.assign({}, attachment), { url: (_e = attachment.url) !== null && _e !== void 0 ? _e : '' }), onActionHandlerFailed)) })),
|
70
71
|
isUploadInProgress ? (React.createElement(CardFooter, null,
|
71
72
|
React.createElement(ProgressBar, { thickness: "medium", value: Math.max(progress !== null && progress !== void 0 ? progress : 0, ATTACHMENT_CARD_MIN_PROGRESS), shape: "rounded" }))) : (React.createElement(React.Fragment, null, " "))));
|
72
73
|
};
|
@@ -76,7 +77,7 @@ const MappedMenuItems = (menuActions, attachment, handleOnClickError) => {
|
|
76
77
|
return React.createElement(React.Fragment, null);
|
77
78
|
}
|
78
79
|
return menuActions.length === 1 ? (React.createElement(TooltipHost, { content: menuActions[0].name },
|
79
|
-
React.createElement(ToolbarButton, { "aria-label": menuActions[0].name, icon: menuActions[0].icon, onClick: () => {
|
80
|
+
React.createElement(ToolbarButton, { "aria-label": menuActions[0].name, role: "button", icon: menuActions[0].icon, onClick: () => {
|
80
81
|
try {
|
81
82
|
menuActions[0].onClick(attachment);
|
82
83
|
}
|
@@ -87,9 +88,9 @@ const MappedMenuItems = (menuActions, attachment, handleOnClickError) => {
|
|
87
88
|
React.createElement(Menu, null,
|
88
89
|
React.createElement(TooltipHost, { content: localeStrings.attachmentMoreMenu },
|
89
90
|
React.createElement(MenuTrigger, null,
|
90
|
-
React.createElement(ToolbarButton, { icon: React.createElement(Icon, { iconName: "AttachmentMoreMenu"
|
91
|
+
React.createElement(ToolbarButton, { "aria-label": localeStrings.attachmentMoreMenu, role: "button", icon: React.createElement(Icon, { iconName: "AttachmentMoreMenu" }) }))),
|
91
92
|
React.createElement(MenuPopover, null,
|
92
|
-
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* () {
|
93
|
+
React.createElement(MenuList, null, menuActions.map((menuItem, index) => (React.createElement(MenuItem, { "aria-label": menuItem.name, key: index, icon: menuItem.icon, onClick: () => __awaiter(void 0, void 0, void 0, function* () {
|
93
94
|
try {
|
94
95
|
yield menuItem.onClick(attachment);
|
95
96
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AttachmentCard.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Attachment/AttachmentCard.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpD,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,EACX,YAAY,EACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,wCAAwC,EAAE,MAAM,iBAAiB,CAAC;AAG3E,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ipHost } 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 mergeClasses\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 { AttachmentMenuAction } from '../../types/Attachment';\nimport { AttachmentMetadata, AttachmentMetadataInProgress } from '@internal/acs-ui-common';\nimport {\n useAttachmentCardStyles,\n attachmentNameContainerClassName,\n ATTACHMENT_CARD_MIN_PROGRESS\n} 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 | AttachmentMetadataInProgress;\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 * Optional flag to enable self resizing of the attachment card.\n */\n selfResizing?: boolean;\n}\n\n/**\n * @internal\n * A component for displaying an attachment card with attachment icon and progress bar.\n *\n * `_AttachmentCard` internally uses the `Card` component from `@fluentui/react-components`. You can checkout the details about these components [here](https://react.fluentui.dev/?path=/docs/components-card).\n */\nexport const _AttachmentCard = (props: _AttachmentCardProps): JSX.Element => {\n const { attachment, menuActions, onActionHandlerFailed, selfResizing } = props;\n const attachmentCardStyles = useAttachmentCardStyles();\n\n const progress = useMemo(() => {\n return 'progress' in attachment ? attachment.progress : undefined;\n }, [attachment]);\n\n const isUploadInProgress = 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 useEffect(() => {\n if (isUploadInProgress) {\n setAnnouncerString(`${uploadStartedString} ${attachment.name}`);\n } else if (progress === 1) {\n setAnnouncerString(`${attachment.name} ${uploadCompletedString}`);\n } else {\n setAnnouncerString(undefined);\n }\n }, [progress, isUploadInProgress, attachment.name, uploadStartedString, uploadCompletedString]);\n\n const extension = useMemo((): string => {\n const re = /(?:\\.([^.]+))?$/;\n const match = re.exec(attachment.name);\n return match && match[1] ? match[1] : '';\n }, [attachment]);\n return (\n <div data-is-focusable={true}>\n <Announcer announcementString={announcerString} ariaLive={'polite'} />\n <Card\n className={mergeClasses(\n attachmentCardStyles.root,\n selfResizing ? attachmentCardStyles.dynamicWidth : attachmentCardStyles.staticWidth\n )}\n size=\"small\"\n role=\"listitem\"\n appearance=\"filled-alternative\"\n aria-label={attachment.name}\n data-testid={'attachment-card'}\n >\n <CardHeader\n className={attachmentCardStyles.content}\n image={\n <div className={attachmentCardStyles.fileIcon}>\n <Icon\n data-ui-id={'attachmenttype-icon'}\n iconName={\n getFileTypeIconProps({\n extension: extension,\n size: 24,\n imageFileType: 'svg'\n }).iconName\n }\n />\n </div>\n }\n header={\n <div className={attachmentNameContainerClassName} id={'attachment-' + attachment.id}>\n <TooltipHost\n content={attachment.name}\n calloutProps={{\n gapSpace: 0,\n target: '#attachment-' + attachment.id\n }}\n >\n <Text className={attachmentCardStyles.title} title={attachment.name}>\n {attachment.name}\n </Text>\n </TooltipHost>\n </div>\n }\n action={MappedMenuItems(\n menuActions,\n {\n ...attachment,\n url: attachment.url ?? ''\n },\n onActionHandlerFailed\n )}\n />\n </Card>\n {isUploadInProgress ? (\n <CardFooter>\n <ProgressBar\n thickness=\"medium\"\n value={Math.max(progress ?? 0, ATTACHMENT_CARD_MIN_PROGRESS)}\n shape=\"rounded\"\n />\n </CardFooter>\n ) : (\n <> </>\n )}\n </div>\n );\n};\n\nconst MappedMenuItems = (\n menuActions: AttachmentMenuAction[],\n attachment: AttachmentMetadata,\n handleOnClickError?: (errMsg: string) => void\n): JSX.Element => {\n const localeStrings = useLocaleAttachmentCardStringsTrampoline();\n\n if (menuActions.length === 0) {\n return <></>;\n }\n return menuActions.length === 1 ? (\n <TooltipHost content={menuActions[0].name}>\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 </TooltipHost>\n ) : (\n <Toolbar>\n <Menu>\n <TooltipHost content={localeStrings.attachmentMoreMenu}>\n <MenuTrigger>\n <ToolbarButton\n icon={<Icon iconName=\"AttachmentMoreMenu\" aria-label={localeStrings.attachmentMoreMenu} />}\n />\n </MenuTrigger>\n </TooltipHost>\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
|
+
{"version":3,"file":"AttachmentCard.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Attachment/AttachmentCard.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;AAElC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EACL,IAAI,EACJ,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,WAAW,EACX,aAAa,EACb,WAAW,EACX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,CACpC,oBAAC,QAAQ,kBACK,QAAQ,CAAC,IAAI,EACzB,GAAG,EAAE,KAAK,EACV,IAAI,EAAE,QAAQ,CAAC,IAAI,EACnB,OAAO,EAAE,GAAS,EAAE;wBAClB,IAAI,CAAC;4BACH,MAAM,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;wBACrC,CAAC;wBAAC,OAAO,CAAC,EAAE,CAAC;4BACX,kBAAkB,aAAlB,kBAAkB,uBAAlB,kBAAkB,CAAI,CAAW,CAAC,OAAO,CAAC,CAAC;wBAC7C,CAAC;oBACH,CAAC,CAAA,IAEA,QAAQ,CAAC,IAAI,CACL,CACZ,CAAC,CACO,CACC,CACT,CACC,CACX,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Icon, TooltipHost } 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 mergeClasses\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 { AttachmentMenuAction } from '../../types/Attachment';\nimport { AttachmentMetadata, AttachmentMetadataInProgress } from '@internal/acs-ui-common';\nimport {\n useAttachmentCardStyles,\n attachmentNameContainerClassName,\n ATTACHMENT_CARD_MIN_PROGRESS\n} 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 | AttachmentMetadataInProgress;\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 * Optional flag to enable self resizing of the attachment card.\n */\n selfResizing?: boolean;\n}\n\n/**\n * @internal\n * A component for displaying an attachment card with attachment icon and progress bar.\n *\n * `_AttachmentCard` internally uses the `Card` component from `@fluentui/react-components`. You can checkout the details about these components [here](https://react.fluentui.dev/?path=/docs/components-card).\n */\nexport const _AttachmentCard = (props: _AttachmentCardProps): JSX.Element => {\n const { attachment, menuActions, onActionHandlerFailed, selfResizing } = props;\n const attachmentCardStyles = useAttachmentCardStyles();\n\n const progress = useMemo(() => {\n return 'progress' in attachment ? attachment.progress : undefined;\n }, [attachment]);\n\n const isUploadInProgress = 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 useEffect(() => {\n if (isUploadInProgress) {\n setAnnouncerString(`${uploadStartedString} ${attachment.name}`);\n } else if (progress === 1) {\n setAnnouncerString(`${attachment.name} ${uploadCompletedString}`);\n } else {\n setAnnouncerString(undefined);\n }\n }, [progress, isUploadInProgress, attachment.name, uploadStartedString, uploadCompletedString]);\n\n const extension = useMemo((): string => {\n const re = /(?:\\.([^.]+))?$/;\n const match = re.exec(attachment.name);\n return match && match[1] ? match[1] : '';\n }, [attachment]);\n return (\n <div data-is-focusable={true}>\n <Announcer announcementString={announcerString} ariaLive={'polite'} />\n <Card\n className={mergeClasses(\n attachmentCardStyles.root,\n selfResizing ? attachmentCardStyles.dynamicWidth : attachmentCardStyles.staticWidth\n )}\n size=\"small\"\n role=\"listitem\"\n appearance=\"filled-alternative\"\n aria-label={attachment.name}\n data-testid={'attachment-card'}\n >\n <CardHeader\n className={attachmentCardStyles.content}\n image={\n <div className={attachmentCardStyles.fileIcon}>\n <Icon\n data-ui-id={'attachmenttype-icon'}\n iconName={\n getFileTypeIconProps({\n extension: extension,\n size: 24,\n imageFileType: 'svg'\n }).iconName\n }\n />\n </div>\n }\n header={\n <div className={attachmentNameContainerClassName} id={'attachment-' + attachment.id}>\n <TooltipHost\n content={attachment.name}\n calloutProps={{\n gapSpace: 0,\n target: '#attachment-' + attachment.id\n }}\n >\n <div className={attachmentCardStyles.fileNameLabel}>\n <Text className={attachmentCardStyles.title} aria-label={attachment.name}>\n {attachment.name}\n </Text>\n </div>\n </TooltipHost>\n </div>\n }\n action={\n <div className={attachmentCardStyles.focusState}>\n {MappedMenuItems(\n menuActions,\n {\n ...attachment,\n url: attachment.url ?? ''\n },\n onActionHandlerFailed\n )}\n </div>\n }\n />\n </Card>\n {isUploadInProgress ? (\n <CardFooter>\n <ProgressBar\n thickness=\"medium\"\n value={Math.max(progress ?? 0, ATTACHMENT_CARD_MIN_PROGRESS)}\n shape=\"rounded\"\n />\n </CardFooter>\n ) : (\n <> </>\n )}\n </div>\n );\n};\n\nconst MappedMenuItems = (\n menuActions: AttachmentMenuAction[],\n attachment: AttachmentMetadata,\n handleOnClickError?: (errMsg: string) => void\n): JSX.Element => {\n const localeStrings = useLocaleAttachmentCardStringsTrampoline();\n\n if (menuActions.length === 0) {\n return <></>;\n }\n return menuActions.length === 1 ? (\n <TooltipHost content={menuActions[0].name}>\n <ToolbarButton\n aria-label={menuActions[0].name}\n role=\"button\"\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 </TooltipHost>\n ) : (\n <Toolbar>\n <Menu>\n <TooltipHost content={localeStrings.attachmentMoreMenu}>\n <MenuTrigger>\n <ToolbarButton\n aria-label={localeStrings.attachmentMoreMenu}\n role=\"button\"\n icon={<Icon iconName=\"AttachmentMoreMenu\" />}\n />\n </MenuTrigger>\n </TooltipHost>\n <MenuPopover>\n <MenuList>\n {menuActions.map((menuItem, index) => (\n <MenuItem\n aria-label={menuItem.name}\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"]}
|
@@ -2,7 +2,7 @@
|
|
2
2
|
// Licensed under the MIT License.
|
3
3
|
import { mergeStyles, Stack } from '@fluentui/react';
|
4
4
|
import React from 'react';
|
5
|
-
import { attachmentCardBaseStyles, attachmentCardFlexLayout, attachmentCardGirdLayout } from '../styles/AttachmentCardGroup.styles';
|
5
|
+
import { attachmentCardBaseStyles, attachmentCardFlexLayout, attachmentCardGirdLayout, attachmentGroupDisabled } from '../styles/AttachmentCardGroup.styles';
|
6
6
|
/**
|
7
7
|
* @internal
|
8
8
|
* Props for `_AttachmentCardGroup` component.
|
@@ -24,10 +24,10 @@ export var _AttachmentCardGroupLayout;
|
|
24
24
|
* Renders the children equally spaced in multiple rows.
|
25
25
|
*/
|
26
26
|
export const _AttachmentCardGroup = (props) => {
|
27
|
-
const { children, ariaLabel, attachmentGroupLayout } = props;
|
27
|
+
const { children, ariaLabel, attachmentGroupLayout, disabled } = props;
|
28
28
|
if (!children) {
|
29
29
|
return React.createElement(React.Fragment, null);
|
30
30
|
}
|
31
|
-
return (React.createElement(Stack, { horizontal: true, className: mergeStyles(attachmentCardBaseStyles, attachmentGroupLayout === _AttachmentCardGroupLayout.Grid ? attachmentCardGirdLayout : attachmentCardFlexLayout), "aria-label": ariaLabel }, children));
|
31
|
+
return (React.createElement(Stack, { horizontal: true, className: mergeStyles(disabled && attachmentGroupDisabled, attachmentCardBaseStyles, attachmentGroupLayout === _AttachmentCardGroupLayout.Grid ? attachmentCardGirdLayout : attachmentCardFlexLayout), "aria-label": ariaLabel, role: "list" }, children));
|
32
32
|
};
|
33
33
|
//# sourceMappingURL=AttachmentCardGroup.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AttachmentCardGroup.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Attachment/AttachmentCardGroup.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,
|
1
|
+
{"version":3,"file":"AttachmentCardGroup.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Attachment/AttachmentCardGroup.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,sCAAsC,CAAC;AAE9C;;;GAGG;AACH,MAAM,CAAN,IAAY,0BASX;AATD,WAAY,0BAA0B;IACpC;;OAEG;IACH,2CAAa,CAAA;IACb;;OAEG;IACH,2CAAa,CAAA;AACf,CAAC,EATW,0BAA0B,KAA1B,0BAA0B,QASrC;AAaD;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAgC,EAAe,EAAE;IACpF,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,qBAAqB,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACvE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,yCAAK,CAAC;IACf,CAAC;IACD,OAAO,CACL,oBAAC,KAAK,IACJ,UAAU,QACV,SAAS,EAAE,WAAW,CACpB,QAAQ,IAAI,uBAAuB,EACnC,wBAAwB,EACxB,qBAAqB,KAAK,0BAA0B,CAAC,IAAI,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,wBAAwB,CAChH,gBACW,SAAS,EACrB,IAAI,EAAC,MAAM,IAEV,QAAQ,CACH,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { mergeStyles, Stack } from '@fluentui/react';\nimport { _pxToRem } from '@internal/acs-ui-common';\nimport React from 'react';\nimport { _ATTACHMENT_CARD_MARGIN_IN_PX, _ATTACHMENT_CARD_WIDTH_IN_REM } from '../styles/AttachmentCard.styles';\nimport {\n attachmentCardBaseStyles,\n attachmentCardFlexLayout,\n attachmentCardGirdLayout,\n attachmentGroupDisabled\n} from '../styles/AttachmentCardGroup.styles';\n\n/**\n * @internal\n * Props for `_AttachmentCardGroup` component.\n */\nexport enum _AttachmentCardGroupLayout {\n /**\n * Children are rendered in a grid layout with self resizing.\n */\n Grid = 'grid',\n /**\n * Children are rendered in a flex layout with no resizing.\n */\n Flex = 'flex'\n}\n\n/**\n * @internal\n * Props for `_AttachmentCardGroup` component.\n */\nexport interface _AttachmentCardGroupProps {\n children: React.ReactNode;\n ariaLabel?: string;\n attachmentGroupLayout?: _AttachmentCardGroupLayout;\n disabled?: boolean;\n}\n\n/**\n * @internal\n * Used with `_AttachmentCard` component where `_AttachmentCard` components are passed as children.\n * Renders the children equally spaced in multiple rows.\n */\nexport const _AttachmentCardGroup = (props: _AttachmentCardGroupProps): JSX.Element => {\n const { children, ariaLabel, attachmentGroupLayout, disabled } = props;\n if (!children) {\n return <></>;\n }\n return (\n <Stack\n horizontal\n className={mergeStyles(\n disabled && attachmentGroupDisabled,\n attachmentCardBaseStyles,\n attachmentGroupLayout === _AttachmentCardGroupLayout.Grid ? attachmentCardGirdLayout : attachmentCardFlexLayout\n )}\n aria-label={ariaLabel}\n role=\"list\"\n >\n {children}\n </Stack>\n );\n};\n"]}
|
@@ -7,15 +7,12 @@ import { useMemo } from 'react';
|
|
7
7
|
import { useLocale } from '../../localization';
|
8
8
|
import { _AttachmentCard } from './AttachmentCard';
|
9
9
|
import { _AttachmentCardGroup, _AttachmentCardGroupLayout } from './AttachmentCardGroup';
|
10
|
-
/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
|
11
|
-
import { getAttachmentCountLiveMessage } from '../ChatMessage/ChatMessageContent';
|
12
10
|
import { mergeClasses } from '@griffel/react';
|
13
11
|
import { useAttachmentCardGroupStyles } from '../styles/AttachmentCardGroup.styles';
|
14
12
|
/**
|
15
13
|
* @internal
|
16
14
|
*/
|
17
15
|
export const _AttachmentDownloadCards = (props) => {
|
18
|
-
var _a;
|
19
16
|
const { attachments, message } = props;
|
20
17
|
const localeStrings = useLocaleStringsTrampoline();
|
21
18
|
const attachmentCardGroupStyles = useAttachmentCardGroupStyles();
|
@@ -34,12 +31,6 @@ export const _AttachmentDownloadCards = (props) => {
|
|
34
31
|
return defaultMenuActions;
|
35
32
|
}
|
36
33
|
}, []);
|
37
|
-
const attachmentCardGroupDescription = useMemo(() => () => {
|
38
|
-
var _a, _b;
|
39
|
-
/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */
|
40
|
-
return getAttachmentCountLiveMessage(attachments !== null && attachments !== void 0 ? attachments : [], (_b = (_a = props.strings) === null || _a === void 0 ? void 0 : _a.attachmentCardGroupMessage) !== null && _b !== void 0 ? _b : localeStrings.attachmentCardGroupMessage);
|
41
|
-
return '';
|
42
|
-
}, [(_a = props.strings) === null || _a === void 0 ? void 0 : _a.attachmentCardGroupMessage, localeStrings.attachmentCardGroupMessage, attachments]);
|
43
34
|
const hasMultipleAttachments = useMemo(() => {
|
44
35
|
var _a, _b;
|
45
36
|
return ((_b = (_a = props.attachments) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 1;
|
@@ -50,7 +41,7 @@ export const _AttachmentDownloadCards = (props) => {
|
|
50
41
|
return (React.createElement("div", { className: mergeClasses(attachmentCardGroupStyles.root, hasMultipleAttachments
|
51
42
|
? attachmentCardGroupStyles.multipleAttachments
|
52
43
|
: attachmentCardGroupStyles.singleAttachment), "data-ui-id": "attachment-download-card-group" },
|
53
|
-
React.createElement(_AttachmentCardGroup, {
|
44
|
+
React.createElement(_AttachmentCardGroup, { attachmentGroupLayout: _AttachmentCardGroupLayout.Grid }, attachments &&
|
54
45
|
attachments.map((attachment) => (React.createElement(_AttachmentCard, { attachment: attachment, key: attachment.id, menuActions: getMenuActions(attachment, localeStrings, message, props.actionsForAttachment), onActionHandlerFailed: props.onActionHandlerFailed, selfResizing: hasMultipleAttachments }))))));
|
55
46
|
};
|
56
47
|
/**
|
package/dist/dist-esm/react-components/src/components/Attachment/AttachmentDownloadCards.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AttachmentDownloadCards.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Attachment/AttachmentDownloadCards.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,2GAA2G;AAC3G,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACzF,2GAA2G;AAC3G,OAAO,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAKlF,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAs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AAG,CAC5B,MAAuC,EACvC,WAAyB,EACD,EAAE;;IAC1B,IAAI,UAAU,GAAG,MAAM,CAAC,cAAc,CAAC;IACvC,+EAA+E;IAC/E,IAAI,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,QAAQ,0CAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QAChD,OAAO;YACL;gBACE,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,oBAAC,IAAI,IAAC,QAAQ,EAAC,gBAAgB,GAAG;gBACxC,OAAO,EAAE,qBAAqB;aAC/B;SACF,CAAC;IACJ,CAAC;IACD,+CAA+C;IAC/C,mDAAmD;IACnD,UAAU,GAAG,MAAM,CAAC,kBAAkB,CAAC;IACvC,OAAO;wCAEA,2BAA2B,KAC9B,IAAI,EAAE,UAAU;KAEnB,CAAC;AACJ,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,qBAAqB,GAAG,CAAC,UAA8B,EAAiB,EAAE;IAC9E,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QACnC,MAAM,CAAC,IAAI,CAAE,UAAiC,CAAC,GAAG,EAAE,QAAQ,EAAE,qBAAqB,CAAC,CAAC;QACrF,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,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,qBAAqB;CAC/B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Icon } from '@fluentui/react';\nimport React, { useCallback } from 'react';\nimport { useMemo } from 'react';\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nimport { useLocale } from '../../localization';\nimport { _AttachmentCard } from './AttachmentCard';\nimport { _AttachmentCardGroup, _AttachmentCardGroupLayout } from './AttachmentCardGroup';\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nimport { getAttachmentCountLiveMessage } from '../ChatMessage/ChatMessageContent';\nimport { _formatString } from '@internal/acs-ui-common';\nimport { AttachmentMenuAction } from '../../types/Attachment';\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { ChatMessage } from '../../types';\nimport { mergeClasses } from '@griffel/react';\nimport { _ATTACHMENT_CARD_WIDTH_IN_REM } from '../styles/AttachmentCard.styles';\nimport { useAttachmentCardGroupStyles } from '../styles/AttachmentCardGroup.styles';\n\n/**\n * Represents the type of attachment\n * @public\n */\nexport type ChatAttachmentType =\n | 'unknown'\n | 'image'\n | /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */ 'file';\n\n/**\n * Strings of _AttachmentDownloadCards that can be overridden.\n *\n * @internal\n */\nexport interface _AttachmentDownloadCardsStrings {\n /* @conditional-compile-remove(file-sharing-acs) */\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\n/**\n * @internal\n */\nexport const _AttachmentDownloadCards = (props: _AttachmentDownloadCardsProps): JSX.Element => {\n const { attachments, message } = props;\n const localeStrings = useLocaleStringsTrampoline();\n const attachmentCardGroupStyles = useAttachmentCardGroupStyles();\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 attachmentCardGroupDescription = useMemo(\n () => () => {\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n return getAttachmentCountLiveMessage(\n attachments ?? [],\n props.strings?.attachmentCardGroupMessage ?? localeStrings.attachmentCardGroupMessage\n );\n return '';\n },\n [props.strings?.attachmentCardGroupMessage, localeStrings.attachmentCardGroupMessage, attachments]\n );\n\n const hasMultipleAttachments = useMemo(() => {\n return (props.attachments?.length ?? 0) > 1;\n }, [props.attachments]);\n\n if (!attachments || attachments.length === 0 || !attachments) {\n return <></>;\n }\n\n return (\n <div\n className={mergeClasses(\n attachmentCardGroupStyles.root,\n hasMultipleAttachments\n ? attachmentCardGroupStyles.multipleAttachments\n : attachmentCardGroupStyles.singleAttachment\n )}\n data-ui-id=\"attachment-download-card-group\"\n >\n <_AttachmentCardGroup\n ariaLabel={attachmentCardGroupDescription()}\n attachmentGroupLayout={_AttachmentCardGroupLayout.Grid}\n >\n {attachments &&\n attachments.map((attachment) => (\n <_AttachmentCard\n attachment={attachment}\n key={attachment.id}\n menuActions={getMenuActions(attachment, localeStrings, message, props.actionsForAttachment)}\n onActionHandlerFailed={props.onActionHandlerFailed}\n selfResizing={hasMultipleAttachments}\n />\n ))}\n </_AttachmentCardGroup>\n </div>\n );\n};\n\n/**\n * @private\n */\nconst useLocaleStringsTrampoline = (): _AttachmentDownloadCardsStrings => {\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n return useLocale().strings.messageThread;\n return {\n /* @conditional-compile-remove(file-sharing-acs) */\n downloadAttachment: '',\n openAttachment: '',\n attachmentCardGroupMessage: ''\n };\n};\n\n/**\n * @private\n */\nconst getDefaultMenuActions = (\n locale: _AttachmentDownloadCardsStrings,\n chatMessage?: ChatMessage\n): AttachmentMenuAction[] => {\n let actionName = locale.openAttachment;\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 name: actionName,\n icon: <Icon iconName=\"OpenAttachment\" />,\n onClick: defaultOnClickHandler\n }\n ];\n }\n // otherwise, use the default icon (\"download\")\n /* @conditional-compile-remove(file-sharing-acs) */\n actionName = locale.downloadAttachment;\n return [\n {\n ...defaultAttachmentMenuAction,\n name: actionName\n }\n ];\n};\n\n/**\n *\n * The default action handler for downloading attachments. This handler will open the attachment's URL in a new tab.\n */\nconst defaultOnClickHandler = (attachment: AttachmentMetadata): Promise<void> => {\n return new Promise<void>((resolve) => {\n window.open((attachment as AttachmentMetadata).url, '_blank', 'noopener,noreferrer');\n resolve();\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: defaultOnClickHandler\n};\n"]}
|
1
|
+
{"version":3,"file":"AttachmentDownloadCards.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Attachment/AttachmentDownloadCards.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,2GAA2G;AAC3G,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAKzF,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AAmDpF;;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;IACnD,MAAM,yBAAyB,GAAG,4BAA4B,EAAE,CAAC;IAEjE,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,MAAM,uBAAN,MAAM,CAAG,UAAU,EAAE,OAAO,CAAC,CAAC;YAC9C,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAClC,OAAO,OAAO,CAAC;YACjB,CAAC;iBAAM,CAAC;gBACN,OAAO,kBAAkB,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) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { Icon } from '@fluentui/react';\nimport React, { useCallback } from 'react';\nimport { useMemo } from 'react';\n/* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\nimport { useLocale } from '../../localization';\nimport { _AttachmentCard } from './AttachmentCard';\nimport { _AttachmentCardGroup, _AttachmentCardGroupLayout } from './AttachmentCardGroup';\nimport { _formatString } from '@internal/acs-ui-common';\nimport { AttachmentMenuAction } from '../../types/Attachment';\nimport { AttachmentMetadata } from '@internal/acs-ui-common';\nimport { ChatMessage } from '../../types';\nimport { mergeClasses } from '@griffel/react';\nimport { _ATTACHMENT_CARD_WIDTH_IN_REM } from '../styles/AttachmentCard.styles';\nimport { useAttachmentCardGroupStyles } from '../styles/AttachmentCardGroup.styles';\n\n/**\n * Represents the type of attachment\n * @public\n */\nexport type ChatAttachmentType =\n | 'unknown'\n | 'image'\n | /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */ 'file';\n\n/**\n * Strings of _AttachmentDownloadCards that can be overridden.\n *\n * @internal\n */\nexport interface _AttachmentDownloadCardsStrings {\n /* @conditional-compile-remove(file-sharing-acs) */\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\n/**\n * @internal\n */\nexport const _AttachmentDownloadCards = (props: _AttachmentDownloadCardsProps): JSX.Element => {\n const { attachments, message } = props;\n const localeStrings = useLocaleStringsTrampoline();\n const attachmentCardGroupStyles = useAttachmentCardGroupStyles();\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 hasMultipleAttachments = useMemo(() => {\n return (props.attachments?.length ?? 0) > 1;\n }, [props.attachments]);\n\n if (!attachments || attachments.length === 0 || !attachments) {\n return <></>;\n }\n\n return (\n <div\n className={mergeClasses(\n attachmentCardGroupStyles.root,\n hasMultipleAttachments\n ? attachmentCardGroupStyles.multipleAttachments\n : attachmentCardGroupStyles.singleAttachment\n )}\n data-ui-id=\"attachment-download-card-group\"\n >\n <_AttachmentCardGroup attachmentGroupLayout={_AttachmentCardGroupLayout.Grid}>\n {attachments &&\n attachments.map((attachment) => (\n <_AttachmentCard\n attachment={attachment}\n key={attachment.id}\n menuActions={getMenuActions(attachment, localeStrings, message, props.actionsForAttachment)}\n onActionHandlerFailed={props.onActionHandlerFailed}\n selfResizing={hasMultipleAttachments}\n />\n ))}\n </_AttachmentCardGroup>\n </div>\n );\n};\n\n/**\n * @private\n */\nconst useLocaleStringsTrampoline = (): _AttachmentDownloadCardsStrings => {\n /* @conditional-compile-remove(file-sharing-teams-interop) @conditional-compile-remove(file-sharing-acs) */\n return useLocale().strings.messageThread;\n return {\n /* @conditional-compile-remove(file-sharing-acs) */\n downloadAttachment: '',\n openAttachment: '',\n attachmentCardGroupMessage: ''\n };\n};\n\n/**\n * @private\n */\nconst getDefaultMenuActions = (\n locale: _AttachmentDownloadCardsStrings,\n chatMessage?: ChatMessage\n): AttachmentMenuAction[] => {\n let actionName = locale.openAttachment;\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 name: actionName,\n icon: <Icon iconName=\"OpenAttachment\" />,\n onClick: defaultOnClickHandler\n }\n ];\n }\n // otherwise, use the default icon (\"download\")\n /* @conditional-compile-remove(file-sharing-acs) */\n actionName = locale.downloadAttachment;\n return [\n {\n ...defaultAttachmentMenuAction,\n name: actionName\n }\n ];\n};\n\n/**\n *\n * The default action handler for downloading attachments. This handler will open the attachment's URL in a new tab.\n */\nconst defaultOnClickHandler = (attachment: AttachmentMetadata): Promise<void> => {\n return new Promise<void>((resolve) => {\n window.open((attachment as AttachmentMetadata).url, '_blank', 'noopener,noreferrer');\n resolve();\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: defaultOnClickHandler\n};\n"]}
|
@@ -32,6 +32,10 @@ export interface AttachmentUploadCardsProps {
|
|
32
32
|
* Optional arialabel strings for attachment upload cards
|
33
33
|
*/
|
34
34
|
strings?: _AttachmentUploadCardsStrings;
|
35
|
+
/**
|
36
|
+
* Optional flag to disable attachment cards.
|
37
|
+
*/
|
38
|
+
disabled?: boolean;
|
35
39
|
}
|
36
40
|
/**
|
37
41
|
* @internal
|
@@ -20,29 +20,26 @@ export const _AttachmentUploadCards = (props) => {
|
|
20
20
|
if (!attachments || attachments.length === 0) {
|
21
21
|
return React.createElement(React.Fragment, null);
|
22
22
|
}
|
23
|
-
return (React.createElement(_AttachmentCardGroup, { attachmentGroupLayout: _AttachmentCardGroupLayout.Flex }, attachments &&
|
23
|
+
return (React.createElement(_AttachmentCardGroup, { attachmentGroupLayout: _AttachmentCardGroupLayout.Flex, disabled: props.disabled }, attachments &&
|
24
24
|
attachments
|
25
25
|
.filter((attachment) => !attachment.error)
|
26
|
-
.map((attachment) => {
|
27
|
-
|
28
|
-
|
29
|
-
{
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
}
|
42
|
-
});
|
43
|
-
}
|
26
|
+
.map((attachment) => (React.createElement(_AttachmentCard, { attachment: attachment, key: attachment.id, menuActions: [
|
27
|
+
{
|
28
|
+
name: removeAttachmentButtonString(),
|
29
|
+
icon: (React.createElement("div", { "data-testid": "attachment-upload-card-remove" },
|
30
|
+
React.createElement(Icon, { iconName: "CancelAttachmentUpload", className: mergeStyles(actionIconStyle) }))),
|
31
|
+
onClick: (attachment) => {
|
32
|
+
return new Promise((resolve, reject) => {
|
33
|
+
try {
|
34
|
+
props.onCancelAttachmentUpload && props.onCancelAttachmentUpload(attachment.id);
|
35
|
+
resolve();
|
36
|
+
}
|
37
|
+
catch (e) {
|
38
|
+
reject(e.message);
|
39
|
+
}
|
40
|
+
});
|
44
41
|
}
|
45
|
-
|
46
|
-
|
42
|
+
}
|
43
|
+
], strings: props.strings })))));
|
47
44
|
};
|
48
45
|
//# sourceMappingURL=AttachmentUploadCards.js.map
|
package/dist/dist-esm/react-components/src/components/Attachment/AttachmentUploadCards.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"AttachmentUploadCards.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Attachment/AttachmentUploadCards.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEzF,OAAO,EAAE,wCAAwC,EAAE,MAAM,iBAAiB,CAAC;
|
1
|
+
{"version":3,"file":"AttachmentUploadCards.js","sourceRoot":"","sources":["../../../../../../../react-components/src/components/Attachment/AttachmentUploadCards.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEzF,OAAO,EAAE,wCAAwC,EAAE,MAAM,iBAAiB,CAAC;AAyC3E,MAAM,eAAe,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAE3C;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAiC,EAAe,EAAE;;IACvF,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;IACtC,MAAM,aAAa,GAAG,wCAAwC,EAAE,CAAC;IACjE,MAAM,4BAA4B,GAAG,OAAO,CAC1C,GAAG,EAAE,CAAC,GAAG,EAAE;;QACT,OAAO,MAAA,MAAA,KAAK,CAAC,OAAO,0CAAE,gBAAgB,mCAAI,aAAa,CAAC,gBAAgB,CAAC;IAC3E,CAAC,EACD,CAAC,MAAA,KAAK,CAAC,OAA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\n// Licensed under the MIT License.\n\nimport { Icon, mergeStyles } from '@fluentui/react';\nimport React, { useMemo } from 'react';\nimport { _AttachmentCard } from './AttachmentCard';\nimport { _AttachmentCardGroup, _AttachmentCardGroupLayout } from './AttachmentCardGroup';\nimport { AttachmentMetadataInProgress } from '@internal/acs-ui-common';\nimport { useLocaleAttachmentCardStringsTrampoline } from '../utils/common';\n\n/**\n * Strings of _AttachmentUploadCards that can be overridden.\n *\n * @internal\n */\nexport interface _AttachmentUploadCardsStrings {\n /** Aria label to notify user when focus is on cancel attachment upload button. */\n removeAttachment: string;\n /** Aria label to notify user attachment uploading starts. */\n uploading: string;\n /** Aria label to notify user attachment is uploaded. */\n uploadCompleted: string;\n /** Aria label to notify user more attachment action menu. */\n attachmentMoreMenu: string;\n}\n\n/**\n * @internal\n */\nexport interface AttachmentUploadCardsProps {\n /**\n * Optional array of {@link AttachmentMetadataInProgress}\n */\n attachments?: AttachmentMetadataInProgress[];\n /**\n * Optional callback to remove the attachment upload before sending by clicking on\n * cancel icon.\n */\n onCancelAttachmentUpload?: (attachmentId: string) => void;\n /**\n * Optional arialabel strings for attachment upload cards\n */\n strings?: _AttachmentUploadCardsStrings;\n /**\n * Optional flag to disable attachment cards.\n */\n disabled?: boolean;\n}\n\nconst actionIconStyle = { height: '1rem' };\n\n/**\n * @internal\n */\nexport const _AttachmentUploadCards = (props: AttachmentUploadCardsProps): JSX.Element => {\n const attachments = props.attachments;\n const localeStrings = useLocaleAttachmentCardStringsTrampoline();\n const removeAttachmentButtonString = useMemo(\n () => () => {\n return props.strings?.removeAttachment ?? localeStrings.removeAttachment;\n },\n [props.strings?.removeAttachment, localeStrings.removeAttachment]\n );\n\n if (!attachments || attachments.length === 0) {\n return <></>;\n }\n\n return (\n <_AttachmentCardGroup attachmentGroupLayout={_AttachmentCardGroupLayout.Flex} disabled={props.disabled}>\n {attachments &&\n attachments\n .filter((attachment) => !attachment.error)\n .map((attachment) => (\n <_AttachmentCard\n attachment={attachment}\n key={attachment.id}\n menuActions={[\n {\n name: removeAttachmentButtonString(),\n icon: (\n <div data-testid=\"attachment-upload-card-remove\">\n <Icon iconName=\"CancelAttachmentUpload\" className={mergeStyles(actionIconStyle)} />\n </div>\n ),\n onClick: (attachment) => {\n return new Promise((resolve, reject) => {\n try {\n props.onCancelAttachmentUpload && props.onCancelAttachmentUpload(attachment.id);\n resolve();\n } catch (e) {\n reject((e as Error).message);\n }\n });\n }\n }\n ]}\n strings={props.strings}\n />\n ))}\n </_AttachmentCardGroup>\n );\n};\n"]}
|
@@ -34,7 +34,7 @@ export const ErrorBar = (props) => {
|
|
34
34
|
setDismissedErrors(dropDismissalsForInactiveErrors(props.activeErrorMessages, dismissedErrors));
|
35
35
|
}, [props.activeErrorMessages, dismissedErrors, trackDismissedErrorsInternally]);
|
36
36
|
const toShow = errorsToShow(props.activeErrorMessages, dismissedErrors, props.ignorePremountErrors ? mountTimestamp.current : undefined);
|
37
|
-
return (React.createElement(Stack, { "data-ui-id": "
|
37
|
+
return (React.createElement(Stack, { "data-ui-id": "notifications-stack" }, toShow.map((error) => (React.createElement(MessageBar, Object.assign({}, props, { styles: {
|
38
38
|
innerText: {
|
39
39
|
alignSelf: 'center'
|
40
40
|
},
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ErrorBar.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/ErrorBar.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAoB,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAEL,YAAY,EACZ,+BAA+B,EAC/B,YAAY,EACZ,mBAAmB,EACnB,cAAc,EACf,MAAM,SAAS,CAAC;AAqPjB;;;;;;;;;;;;;GAaG;AACH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AE,QAAQ;aACrB;SACF,EACD,GAAG,EAAE,KAAK,CAAC,IAAI,EACf,cAAc,EAAE,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,EAC1C,mBAAmB,EAAE,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC,EACpD,SAAS,EAAE,GAAG,EAAE;;YACd,OAAA,8BAA8B;gBAC5B,CAAC,CAAC,kBAAkB,CAAC,YAAY,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;gBAC1D,CAAC,CAAC,MAAA,KAAK,CAAC,cAAc,sDAAG,KAAK,CAAC,CAAA;SAAA,EAEnC,sBAAsB,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,OAAO,CAAC,sBAAsB,EAAE,EACnF,gBAAgB,EAAE,EAAE,QAAQ,EAAE,eAAe,EAAE,KAE9C,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CACT,CACd,CAAC,CACI,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useEffect, useRef, useState } from 'react';\nimport { IMessageBarProps, MessageBar, Stack } from '@fluentui/react';\nimport { useLocale } from '../localization';\nimport {\n DismissedError,\n dismissError,\n dropDismissalsForInactiveErrors,\n errorsToShow,\n messageBarIconProps,\n messageBarType\n} from './utils';\n\n/**\n * Props for {@link ErrorBar}.\n *\n * In addition to the following, {@link ErrorBar} forwards all\n * {@link @fluentui/react#IMessageBarProps} to the underlying {@link @fluentui/react#MessageBar}.\n *\n * @public\n */\nexport interface ErrorBarProps extends IMessageBarProps {\n /**\n * Strings shown on the UI on errors.\n */\n strings?: ErrorBarStrings;\n\n /**\n * Currently active errors.\n */\n activeErrorMessages: ActiveErrorMessage[];\n\n /**\n * If set, errors with {@link ActiveErrorMessage.timestamp} older than the time this component is mounted\n * are not shown.\n *\n * This is useful when using the {@link ErrorBar} with a stateful client that handles more than one call\n * or chat thread. Set this prop to ignore errors from previous call or chat.\n *\n * @defaultValue false\n */\n ignorePremountErrors?: boolean;\n\n /**\n * Callback called when the dismiss button is triggered.\n * Use this to control errors shown when they dismissed by the user.\n */\n onDismissError?: (dismissedError: ActiveErrorMessage) => void;\n}\n\n/**\n * All strings that may be shown on the UI in the {@link ErrorBar}.\n *\n * @public\n */\nexport interface ErrorBarStrings {\n /**\n * Unable to reach Chat service.\n *\n * This can mean:\n * - Incorrect Azure Communication Services endpoint was provided.\n * - User's network connection is down.\n */\n unableToReachChatService: string;\n\n /**\n * User does not have access to the Chat service.\n * This usually means that either the Azure Communication Services endpiont or the token provided are incorrect.\n */\n accessDenied: string;\n\n /**\n * User is no longer on the thread.\n *\n * See also: {@link ErrorBarStrings.sendMessageNotInChatThread} for a more specific error.\n */\n userNotInChatThread: string;\n\n /**\n * Sending message failed because user is no longer on the thread.\n */\n sendMessageNotInChatThread: string;\n\n /**\n * A generic message when sending message fails.\n * Prefer more specific error strings when possible.\n */\n sendMessageGeneric: string;\n\n /**\n * A generic message when starting video fails.\n */\n startVideoGeneric: string;\n\n /**\n * A generic message when starting video fails.\n */\n stopVideoGeneric: string;\n\n /**\n * A generic message when muting microphone fails.\n */\n muteGeneric: string;\n\n /**\n * A generic message when unmuting microphone fails.\n */\n unmuteGeneric: string;\n\n /**\n * A generic message when starting screenshare fails.\n */\n startScreenShareGeneric: string;\n\n /**\n * A generic message when stopping screenshare fails.\n */\n stopScreenShareGeneric: string;\n\n /**\n * Message shown when poor network quality is detected during a call.\n */\n callNetworkQualityLow: string;\n\n /**\n * Message shown on failure to detect audio output devices.\n */\n callNoSpeakerFound: string;\n\n /**\n * Message shown on failure to detect audio input devices.\n */\n callNoMicrophoneFound: string;\n\n /**\n * Message shown when microphone can be enumerated but access is blocked by the system.\n */\n callMicrophoneAccessDenied: string;\n\n /**\n * Message shown when microphone can be enumerated but access is blocked by the system, for safari browsers\n */\n callMicrophoneAccessDeniedSafari: string;\n\n /**\n * Message shown when microphone is muted by the system (not by local or remote participants)\n */\n callMicrophoneMutedBySystem: string;\n\n /**\n * Message shown when microphone is unmuted by the system (not by local or remote participants).\n * This typically occurs if the system recovers from an unexpected mute.\n */\n callMicrophoneUnmutedBySystem: string;\n\n /**\n * Mac OS specific message shown when microphone can be enumerated but access is\n * blocked by the system.\n */\n callMacOsMicrophoneAccessDenied: string;\n\n /**\n * Message shown when poor network causes local video stream to be frozen.\n */\n callLocalVideoFreeze: string;\n\n /**\n * Message shown when camera can be enumerated but access is blocked by the system.\n */\n callCameraAccessDenied: string;\n\n /**\n * Message shown when camera can be enumerated but access is blocked by the system, for safari browsers\n */\n callCameraAccessDeniedSafari: string;\n\n /**\n * Message shown when local video fails to start because camera is already in use by\n * another applciation.\n */\n callCameraAlreadyInUse: string;\n\n /**\n * Message shown when local video is stopped by the system (not by local or remote participants)\n */\n callVideoStoppedBySystem: string;\n\n /**\n * Message shown when local video was recovered by the system (not by the local participant)\n */\n callVideoRecoveredBySystem: string;\n\n /**\n * Mac OS specific message shown when system denies access to camera.\n */\n callMacOsCameraAccessDenied: string;\n\n /**\n * Mac OS specific message shown when system denies sharing local screen on a call.\n */\n callMacOsScreenShareAccessDenied: string;\n /**\n * Dimiss errorbar button aria label read by screen reader accessibility tools\n */\n dismissButtonAriaLabel?: string;\n\n /**\n * An error message when joining a call fails.\n */\n failedToJoinCallGeneric?: string;\n\n /**\n * An error message when joining a call fails specifically due to an invalid meeting link.\n */\n failedToJoinCallInvalidMeetingLink?: string;\n /**\n * Error bar string letting you know remote participants see a frozen stream for you.\n */\n cameraFrozenForRemoteParticipants?: string;\n\n /**\n * Unable to start effect\n */\n unableToStartVideoEffect?: string;\n /**\n * An error message when starting spotlight while max participants are spotlighted\n */\n startSpotlightWhileMaxParticipantsAreSpotlighted: string;\n}\n\n/**\n * All errors that can be shown in the {@link ErrorBar}.\n *\n * @public\n */\nexport type ErrorType = keyof ErrorBarStrings;\n\n/**\n * Active error messages to be shown via {@link ErrorBar}.\n *\n * @public\n */\nexport interface ActiveErrorMessage {\n /**\n * Type of error that is active.\n */\n type: ErrorType;\n /**\n * The latest timestamp when this error was observed.\n *\n * When available, this is used to track errors that have already been seen and dismissed\n * by the user.\n */\n timestamp?: Date;\n}\n\n/**\n * A component to show error messages on the UI.\n * All strings that can be shown are accepted as the {@link ErrorBarProps.strings} so that they can be localized.\n * Active errors are selected by {@link ErrorBarProps.activeErrorMessages}.\n *\n * This component internally tracks dismissed by the user.\n * * Errors that have an associated timestamp: The error is shown on the UI again if it occurs after being dismissed.\n * * Errors that do not have a timestamp: The error is dismissed until it disappears from the props.\n * If the error recurs, it is shown in the UI.\n *\n * Uses {@link @fluentui/react#MessageBar} UI element.\n *\n * @public\n */\nexport const ErrorBar = (props: ErrorBarProps): JSX.Element => {\n const localeStrings = useLocale().strings.errorBar;\n const strings = props.strings ?? localeStrings;\n\n const trackDismissedErrorsInternally = !props.onDismissError;\n\n // Timestamp for when this comopnent is first mounted.\n // Never updated through the lifecycle of this component.\n const mountTimestamp = useRef(new Date(Date.now()));\n\n const [dismissedErrors, setDismissedErrors] = useState<DismissedError[]>([]);\n\n // dropDismissalsForInactiveErrors only returns a new object if `dismissedErrors` actually changes.\n // Without this behaviour, this `useEffect` block would cause a render loop.\n useEffect(() => {\n trackDismissedErrorsInternally &&\n setDismissedErrors(dropDismissalsForInactiveErrors(props.activeErrorMessages, dismissedErrors));\n }, [props.activeErrorMessages, dismissedErrors, trackDismissedErrorsInternally]);\n\n const toShow = errorsToShow(\n props.activeErrorMessages,\n dismissedErrors,\n props.ignorePremountErrors ? mountTimestamp.current : undefined\n );\n\n return (\n <Stack data-ui-id=\"error-bar-stack\">\n {toShow.map((error) => (\n <MessageBar\n {...props}\n styles={{\n innerText: {\n alignSelf: 'center'\n },\n icon: {\n height: 0\n },\n content: {\n lineHeight: 'inherit'\n },\n dismissal: {\n height: 0,\n paddingTop: '0.8rem'\n }\n }}\n key={error.type}\n messageBarType={messageBarType(error.type)}\n messageBarIconProps={messageBarIconProps(error.type)}\n onDismiss={() =>\n trackDismissedErrorsInternally\n ? setDismissedErrors(dismissError(dismissedErrors, error))\n : props.onDismissError?.(error)\n }\n dismissButtonAriaLabel={`${strings[error.type]}, ${strings.dismissButtonAriaLabel}`}\n dismissIconProps={{ iconName: 'ErrorBarClear' }}\n >\n {strings[error.type]}\n </MessageBar>\n ))}\n </Stack>\n );\n};\n"]}
|
1
|
+
{"version":3,"file":"ErrorBar.js","sourceRoot":"","sources":["../../../../../../react-components/src/components/ErrorBar.tsx"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAoB,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAEL,YAAY,EACZ,+BAA+B,EAC/B,YAAY,EACZ,mBAAmB,EACnB,cAAc,EACf,MAAM,SAAS,CAAC;AAqPjB;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAoB,EAAe,EAAE;;IAC5D,MAAM,aAAa,GAAG,SAAS,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;IACnD,MAAM,OAAO,GAAG,MAAA,KAAK,CAAC,OAAO,mCAAI,aAAa,CAAC;IAE/C,MAAM,8BAA8B,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC;IAE7D,sDAAsD;IACtD,yDAAyD;IACzD,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;IAEpD,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAmB,EAAE,CAAC,CAAC;IAE7E,mGAAmG;IACnG,4EAA4E;IAC5E,SAAS,CAAC,GAAG,EAAE;QACb,8BAA8B;YAC5B,kBAAk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,IAAI,CAAC,CACT,CACd,CAAC,CACI,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport React, { useEffect, useRef, useState } from 'react';\nimport { IMessageBarProps, MessageBar, Stack } from '@fluentui/react';\nimport { useLocale } from '../localization';\nimport {\n DismissedError,\n dismissError,\n dropDismissalsForInactiveErrors,\n errorsToShow,\n messageBarIconProps,\n messageBarType\n} from './utils';\n\n/**\n * Props for {@link ErrorBar}.\n *\n * In addition to the following, {@link ErrorBar} forwards all\n * {@link @fluentui/react#IMessageBarProps} to the underlying {@link @fluentui/react#MessageBar}.\n *\n * @public\n */\nexport interface ErrorBarProps extends IMessageBarProps {\n /**\n * Strings shown on the UI on errors.\n */\n strings?: ErrorBarStrings;\n\n /**\n * Currently active errors.\n */\n activeErrorMessages: ActiveErrorMessage[];\n\n /**\n * If set, errors with {@link ActiveErrorMessage.timestamp} older than the time this component is mounted\n * are not shown.\n *\n * This is useful when using the {@link ErrorBar} with a stateful client that handles more than one call\n * or chat thread. Set this prop to ignore errors from previous call or chat.\n *\n * @defaultValue false\n */\n ignorePremountErrors?: boolean;\n\n /**\n * Callback called when the dismiss button is triggered.\n * Use this to control errors shown when they dismissed by the user.\n */\n onDismissError?: (dismissedError: ActiveErrorMessage) => void;\n}\n\n/**\n * All strings that may be shown on the UI in the {@link ErrorBar}.\n *\n * @public\n */\nexport interface ErrorBarStrings {\n /**\n * Unable to reach Chat service.\n *\n * This can mean:\n * - Incorrect Azure Communication Services endpoint was provided.\n * - User's network connection is down.\n */\n unableToReachChatService: string;\n\n /**\n * User does not have access to the Chat service.\n * This usually means that either the Azure Communication Services endpiont or the token provided are incorrect.\n */\n accessDenied: string;\n\n /**\n * User is no longer on the thread.\n *\n * See also: {@link ErrorBarStrings.sendMessageNotInChatThread} for a more specific error.\n */\n userNotInChatThread: string;\n\n /**\n * Sending message failed because user is no longer on the thread.\n */\n sendMessageNotInChatThread: string;\n\n /**\n * A generic message when sending message fails.\n * Prefer more specific error strings when possible.\n */\n sendMessageGeneric: string;\n\n /**\n * A generic message when starting video fails.\n */\n startVideoGeneric: string;\n\n /**\n * A generic message when starting video fails.\n */\n stopVideoGeneric: string;\n\n /**\n * A generic message when muting microphone fails.\n */\n muteGeneric: string;\n\n /**\n * A generic message when unmuting microphone fails.\n */\n unmuteGeneric: string;\n\n /**\n * A generic message when starting screenshare fails.\n */\n startScreenShareGeneric: string;\n\n /**\n * A generic message when stopping screenshare fails.\n */\n stopScreenShareGeneric: string;\n\n /**\n * Message shown when poor network quality is detected during a call.\n */\n callNetworkQualityLow: string;\n\n /**\n * Message shown on failure to detect audio output devices.\n */\n callNoSpeakerFound: string;\n\n /**\n * Message shown on failure to detect audio input devices.\n */\n callNoMicrophoneFound: string;\n\n /**\n * Message shown when microphone can be enumerated but access is blocked by the system.\n */\n callMicrophoneAccessDenied: string;\n\n /**\n * Message shown when microphone can be enumerated but access is blocked by the system, for safari browsers\n */\n callMicrophoneAccessDeniedSafari: string;\n\n /**\n * Message shown when microphone is muted by the system (not by local or remote participants)\n */\n callMicrophoneMutedBySystem: string;\n\n /**\n * Message shown when microphone is unmuted by the system (not by local or remote participants).\n * This typically occurs if the system recovers from an unexpected mute.\n */\n callMicrophoneUnmutedBySystem: string;\n\n /**\n * Mac OS specific message shown when microphone can be enumerated but access is\n * blocked by the system.\n */\n callMacOsMicrophoneAccessDenied: string;\n\n /**\n * Message shown when poor network causes local video stream to be frozen.\n */\n callLocalVideoFreeze: string;\n\n /**\n * Message shown when camera can be enumerated but access is blocked by the system.\n */\n callCameraAccessDenied: string;\n\n /**\n * Message shown when camera can be enumerated but access is blocked by the system, for safari browsers\n */\n callCameraAccessDeniedSafari: string;\n\n /**\n * Message shown when local video fails to start because camera is already in use by\n * another applciation.\n */\n callCameraAlreadyInUse: string;\n\n /**\n * Message shown when local video is stopped by the system (not by local or remote participants)\n */\n callVideoStoppedBySystem: string;\n\n /**\n * Message shown when local video was recovered by the system (not by the local participant)\n */\n callVideoRecoveredBySystem: string;\n\n /**\n * Mac OS specific message shown when system denies access to camera.\n */\n callMacOsCameraAccessDenied: string;\n\n /**\n * Mac OS specific message shown when system denies sharing local screen on a call.\n */\n callMacOsScreenShareAccessDenied: string;\n /**\n * Dimiss errorbar button aria label read by screen reader accessibility tools\n */\n dismissButtonAriaLabel?: string;\n\n /**\n * An error message when joining a call fails.\n */\n failedToJoinCallGeneric?: string;\n\n /**\n * An error message when joining a call fails specifically due to an invalid meeting link.\n */\n failedToJoinCallInvalidMeetingLink?: string;\n /**\n * Error bar string letting you know remote participants see a frozen stream for you.\n */\n cameraFrozenForRemoteParticipants?: string;\n\n /**\n * Unable to start effect\n */\n unableToStartVideoEffect?: string;\n /**\n * An error message when starting spotlight while max participants are spotlighted\n */\n startSpotlightWhileMaxParticipantsAreSpotlighted: string;\n}\n\n/**\n * All errors that can be shown in the {@link ErrorBar}.\n *\n * @public\n */\nexport type ErrorType = keyof ErrorBarStrings;\n\n/**\n * Active error messages to be shown via {@link ErrorBar}.\n *\n * @public\n */\nexport interface ActiveErrorMessage {\n /**\n * Type of error that is active.\n */\n type: ErrorType;\n /**\n * The latest timestamp when this error was observed.\n *\n * When available, this is used to track errors that have already been seen and dismissed\n * by the user.\n */\n timestamp?: Date;\n}\n\n/**\n * A component to show error messages on the UI.\n * All strings that can be shown are accepted as the {@link ErrorBarProps.strings} so that they can be localized.\n * Active errors are selected by {@link ErrorBarProps.activeErrorMessages}.\n *\n * This component internally tracks dismissed by the user.\n * * Errors that have an associated timestamp: The error is shown on the UI again if it occurs after being dismissed.\n * * Errors that do not have a timestamp: The error is dismissed until it disappears from the props.\n * If the error recurs, it is shown in the UI.\n *\n * Uses {@link @fluentui/react#MessageBar} UI element.\n *\n * @public\n */\nexport const ErrorBar = (props: ErrorBarProps): JSX.Element => {\n const localeStrings = useLocale().strings.errorBar;\n const strings = props.strings ?? localeStrings;\n\n const trackDismissedErrorsInternally = !props.onDismissError;\n\n // Timestamp for when this comopnent is first mounted.\n // Never updated through the lifecycle of this component.\n const mountTimestamp = useRef(new Date(Date.now()));\n\n const [dismissedErrors, setDismissedErrors] = useState<DismissedError[]>([]);\n\n // dropDismissalsForInactiveErrors only returns a new object if `dismissedErrors` actually changes.\n // Without this behaviour, this `useEffect` block would cause a render loop.\n useEffect(() => {\n trackDismissedErrorsInternally &&\n setDismissedErrors(dropDismissalsForInactiveErrors(props.activeErrorMessages, dismissedErrors));\n }, [props.activeErrorMessages, dismissedErrors, trackDismissedErrorsInternally]);\n\n const toShow = errorsToShow(\n props.activeErrorMessages,\n dismissedErrors,\n props.ignorePremountErrors ? mountTimestamp.current : undefined\n );\n\n return (\n <Stack data-ui-id=\"notifications-stack\">\n {toShow.map((error) => (\n <MessageBar\n {...props}\n styles={{\n innerText: {\n alignSelf: 'center'\n },\n icon: {\n height: 0\n },\n content: {\n lineHeight: 'inherit'\n },\n dismissal: {\n height: 0,\n paddingTop: '0.8rem'\n }\n }}\n key={error.type}\n messageBarType={messageBarType(error.type)}\n messageBarIconProps={messageBarIconProps(error.type)}\n onDismiss={() =>\n trackDismissedErrorsInternally\n ? setDismissedErrors(dismissError(dismissedErrors, error))\n : props.onDismissError?.(error)\n }\n dismissButtonAriaLabel={`${strings[error.type]}, ${strings.dismissButtonAriaLabel}`}\n dismissIconProps={{ iconName: 'ErrorBarClear' }}\n >\n {strings[error.type]}\n </MessageBar>\n ))}\n </Stack>\n );\n};\n"]}
|
@@ -18,6 +18,22 @@ export interface NotificationsProps {
|
|
18
18
|
* @defaultValue 2
|
19
19
|
*/
|
20
20
|
maxNotificationsToShow?: number;
|
21
|
+
/**
|
22
|
+
* Callback called when the dismiss button is triggered.
|
23
|
+
* Use this to control notifications shown when they dismissed by the user.
|
24
|
+
* Note this onDismiss function will affect all notifications in the same stack
|
25
|
+
*/
|
26
|
+
onDismissNotification?: (dismissedNotifications: ActiveNotification) => void;
|
27
|
+
/**
|
28
|
+
* If set, notifications with {@link ActiveNotification.timestamp} older than the time this component is mounted
|
29
|
+
* are not shown.
|
30
|
+
*
|
31
|
+
* This is useful when using the {@link Notifications} with a stateful client that handles more than one call
|
32
|
+
* or chat thread. Set this prop to ignore notifications from previous call or chat.
|
33
|
+
*
|
34
|
+
* @defaultValue false
|
35
|
+
*/
|
36
|
+
ignorePremountNotifications?: boolean;
|
21
37
|
}
|
22
38
|
/**
|
23
39
|
* All strings that may be shown on the UI in the {@link Notifications}.
|
@@ -25,34 +41,6 @@ export interface NotificationsProps {
|
|
25
41
|
* @beta
|
26
42
|
*/
|
27
43
|
export interface NotificationsStrings {
|
28
|
-
/**
|
29
|
-
* Unable to reach Chat service.
|
30
|
-
*
|
31
|
-
* This can mean:
|
32
|
-
* - Incorrect Azure Communication Services endpoint was provided.
|
33
|
-
* - User's network connection is down.
|
34
|
-
*/
|
35
|
-
unableToReachChatService: NotificationBarStrings;
|
36
|
-
/**
|
37
|
-
* User does not have access to the Chat service.
|
38
|
-
* This usually means that either the Azure Communication Services endpiont or the token provided are incorrect.
|
39
|
-
*/
|
40
|
-
accessDenied: NotificationBarStrings;
|
41
|
-
/**
|
42
|
-
* User is no longer on the thread.
|
43
|
-
*
|
44
|
-
* See also: {@link NotificationsStrings.sendMessageNotInChatThread} for a more specific error.
|
45
|
-
*/
|
46
|
-
userNotInChatThread: NotificationBarStrings;
|
47
|
-
/**
|
48
|
-
* Sending message failed because user is no longer on the thread.
|
49
|
-
*/
|
50
|
-
sendMessageNotInChatThread: NotificationBarStrings;
|
51
|
-
/**
|
52
|
-
* A generic message when sending message fails.
|
53
|
-
* Prefer more specific error strings when possible.
|
54
|
-
*/
|
55
|
-
sendMessageGeneric: NotificationBarStrings;
|
56
44
|
/**
|
57
45
|
* A generic message when starting video fails.
|
58
46
|
*/
|
@@ -201,6 +189,13 @@ export interface ActiveNotification {
|
|
201
189
|
* If set, notification will automatically dismiss after 5 seconds
|
202
190
|
*/
|
203
191
|
autoDismiss?: boolean;
|
192
|
+
/**
|
193
|
+
* The latest timestamp when this notification was observed.
|
194
|
+
*
|
195
|
+
* When available, this is used to track notifications that have already been seen and dismissed
|
196
|
+
* by the user.
|
197
|
+
*/
|
198
|
+
timestamp?: Date;
|
204
199
|
}
|
205
200
|
/**
|
206
201
|
* A component to show notifications on the UI.
|
@@ -1,10 +1,10 @@
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
2
2
|
// Licensed under the MIT License.
|
3
|
-
import React, { useEffect, useState } from 'react';
|
3
|
+
import React, { useEffect, useRef, useState } from 'react';
|
4
4
|
import { Stack } from '@fluentui/react';
|
5
5
|
/* @conditional-compile-remove(notifications) */
|
6
6
|
import { useLocale } from '../localization';
|
7
|
-
import { NotificationIconProps } from './utils';
|
7
|
+
import { NotificationIconProps, dismissNotification, dropDismissalsForInactiveNotifications, notificationsToShow } from './utils';
|
8
8
|
import { NotificationBar } from './NotificationBar';
|
9
9
|
/**
|
10
10
|
* A component to show notifications on the UI.
|
@@ -25,18 +25,28 @@ export const Notifications = (props) => {
|
|
25
25
|
const localeStrings = useLocale().strings.notifications;
|
26
26
|
const strings = (_a = props.strings) !== null && _a !== void 0 ? _a : localeStrings;
|
27
27
|
const maxNotificationsToShow = (_b = props.maxNotificationsToShow) !== null && _b !== void 0 ? _b : 2;
|
28
|
-
const
|
28
|
+
const trackDismissedNotificationsInternally = !props.onDismissNotification;
|
29
|
+
// Timestamp for when this comopnent is first mounted.
|
30
|
+
// Never updated through the lifecycle of this component.
|
31
|
+
const mountTimestamp = useRef(new Date(Date.now()));
|
32
|
+
const [dismissedNotifications, setDismissedNotifications] = useState([]);
|
33
|
+
// dropDismissalsForInactiveNotifications only returns a new object if `dismissedErrors` actually changes.
|
34
|
+
// Without this behaviour, this `useEffect` block would cause a render loop.
|
29
35
|
useEffect(() => {
|
30
|
-
|
31
|
-
|
36
|
+
trackDismissedNotificationsInternally &&
|
37
|
+
setDismissedNotifications(dropDismissalsForInactiveNotifications(props.activeNotifications, dismissedNotifications));
|
38
|
+
}, [props.activeNotifications, dismissedNotifications, trackDismissedNotificationsInternally]);
|
39
|
+
const activeNotifications = notificationsToShow(props.activeNotifications, dismissedNotifications, props.ignorePremountNotifications ? mountTimestamp.current : undefined);
|
32
40
|
return (React.createElement(Stack, { "data-ui-id": "notifications-stack", style: {
|
33
41
|
width: 'fit-content'
|
34
42
|
} }, activeNotifications.map((notification, index) => {
|
35
43
|
if (index < maxNotificationsToShow) {
|
36
44
|
return (React.createElement("div", { key: index, style: { marginBottom: `${index === maxNotificationsToShow - 1 ? 0 : '0.25rem'}` } },
|
37
45
|
React.createElement(NotificationBar, { notificationBarStrings: strings ? strings[notification.type] : undefined, notificationBarIconProps: NotificationIconProps(notification.type), onClickPrimaryButton: () => { var _a; return (_a = notification.onClickPrimaryButton) === null || _a === void 0 ? void 0 : _a.call(notification); }, onClickSecondaryButton: () => { var _a; return (_a = notification.onClickSecondaryButton) === null || _a === void 0 ? void 0 : _a.call(notification); }, onDismiss: () => {
|
38
|
-
|
39
|
-
|
46
|
+
var _a;
|
47
|
+
trackDismissedNotificationsInternally
|
48
|
+
? setDismissedNotifications(dismissNotification(dismissedNotifications, notification))
|
49
|
+
: (_a = props.onDismissNotification) === null || _a === void 0 ? void 0 : _a.call(props, notification);
|
40
50
|
notification.onDismiss && notification.onDismiss();
|
41
51
|
}, showStackedEffect: index === maxNotificationsToShow - 1 && activeNotifications.length > maxNotificationsToShow, autoDismiss: notification.autoDismiss })));
|
42
52
|
}
|