stream-chat-react-native-core 9.2.0-beta.1 → 9.2.0-beta.3
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/README.md +1 -1
- package/lib/commonjs/a11y/hooks/useA11yLabel.js +4 -3
- package/lib/commonjs/a11y/hooks/useA11yLabel.js.map +1 -1
- package/lib/commonjs/a11y/hooks/useAccessibilityActivateAction.js +25 -0
- package/lib/commonjs/a11y/hooks/useAccessibilityActivateAction.js.map +1 -0
- package/lib/commonjs/a11y/index.js +11 -0
- package/lib/commonjs/a11y/index.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js +20 -0
- package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.js +1 -0
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.js +19 -2
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerContent.js +4 -3
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerContent.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentTypePickerButton.js +9 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentTypePickerButton.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +10 -1
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useMessageListPagination.js +26 -3
- package/lib/commonjs/components/Channel/hooks/useMessageListPagination.js.map +1 -1
- package/lib/commonjs/components/ChannelList/ChannelList.js +29 -4
- package/lib/commonjs/components/ChannelList/ChannelList.js.map +1 -1
- package/lib/commonjs/components/ChannelList/hooks/useChannelActions.js +314 -11
- package/lib/commonjs/components/ChannelList/hooks/useChannelActions.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js +2 -2
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -1
- package/lib/commonjs/components/Message/hooks/useMessageActionHandlers.js +202 -15
- package/lib/commonjs/components/Message/hooks/useMessageActionHandlers.js.map +1 -1
- package/lib/commonjs/components/MessageInput/MessageComposer.js +1 -1
- package/lib/commonjs/components/MessageInput/MessageComposerLeadingView.js +1 -1
- package/lib/commonjs/components/MessageInput/MessageComposerLeadingView.js.map +1 -1
- package/lib/commonjs/components/MessageInput/MessageInputHeaderView.js +1 -1
- package/lib/commonjs/components/MessageInput/MessageInputHeaderView.js.map +1 -1
- package/lib/commonjs/components/MessageInput/MessageInputTrailingView.js +1 -1
- package/lib/commonjs/components/MessageInput/MessageInputTrailingView.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/AttachmentPreview/AttachmentRemoveControl.js +16 -4
- package/lib/commonjs/components/MessageInput/components/AttachmentPreview/AttachmentRemoveControl.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/AttachmentPreview/AttachmentUploadPreviewList.js +7 -13
- package/lib/commonjs/components/MessageInput/components/AttachmentPreview/AttachmentUploadPreviewList.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecorder.js +30 -6
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecorder.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js +34 -9
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/InputButtons/AttachButton.js +12 -3
- package/lib/commonjs/components/MessageInput/components/InputButtons/AttachButton.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/OutputButtons/EditButton.js +1 -0
- package/lib/commonjs/components/MessageInput/components/OutputButtons/EditButton.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/OutputButtons/SendButton.js +1 -0
- package/lib/commonjs/components/MessageInput/components/OutputButtons/SendButton.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/OutputButtons/index.js +1 -1
- package/lib/commonjs/components/MessageList/MessageFlashList.js +24 -4
- package/lib/commonjs/components/MessageList/MessageFlashList.js.map +1 -1
- package/lib/commonjs/components/MessageList/MessageList.js +24 -4
- package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
- package/lib/commonjs/components/MessageList/ScrollToBottomButton.js +12 -6
- package/lib/commonjs/components/MessageList/ScrollToBottomButton.js.map +1 -1
- package/lib/commonjs/components/MessageList/UnreadMessagesNotification.js +1 -0
- package/lib/commonjs/components/MessageList/UnreadMessagesNotification.js.map +1 -1
- package/lib/commonjs/components/MessageList/hooks/useScrollToBottomAccessibilityAction.js +47 -0
- package/lib/commonjs/components/MessageList/hooks/useScrollToBottomAccessibilityAction.js.map +1 -0
- package/lib/commonjs/components/MessageMenu/MessageActionListItem.js +12 -4
- package/lib/commonjs/components/MessageMenu/MessageActionListItem.js.map +1 -1
- package/lib/commonjs/components/MessageMenu/MessageReactionPicker.js +1 -0
- package/lib/commonjs/components/MessageMenu/MessageReactionPicker.js.map +1 -1
- package/lib/commonjs/components/MessageMenu/ReactionButton.js +9 -6
- package/lib/commonjs/components/MessageMenu/ReactionButton.js.map +1 -1
- package/lib/commonjs/components/MessageMenu/hooks/useFetchReactions.js +23 -2
- package/lib/commonjs/components/MessageMenu/hooks/useFetchReactions.js.map +1 -1
- package/lib/commonjs/components/Notifications/Notification.js +232 -0
- package/lib/commonjs/components/Notifications/Notification.js.map +1 -0
- package/lib/commonjs/components/Notifications/NotificationList.js +120 -0
- package/lib/commonjs/components/Notifications/NotificationList.js.map +1 -0
- package/lib/commonjs/components/Notifications/NotificationTargetContext.js +45 -0
- package/lib/commonjs/components/Notifications/NotificationTargetContext.js.map +1 -0
- package/lib/commonjs/components/Notifications/hooks/index.js +59 -0
- package/lib/commonjs/components/Notifications/hooks/index.js.map +1 -0
- package/lib/commonjs/components/Notifications/hooks/useNotificationApi.js +133 -0
- package/lib/commonjs/components/Notifications/hooks/useNotificationApi.js.map +1 -0
- package/lib/commonjs/components/Notifications/hooks/useNotificationListController.js +133 -0
- package/lib/commonjs/components/Notifications/hooks/useNotificationListController.js.map +1 -0
- package/lib/commonjs/components/Notifications/hooks/useNotificationTarget.js +26 -0
- package/lib/commonjs/components/Notifications/hooks/useNotificationTarget.js.map +1 -0
- package/lib/commonjs/components/Notifications/hooks/useNotifications.js +26 -0
- package/lib/commonjs/components/Notifications/hooks/useNotifications.js.map +1 -0
- package/lib/commonjs/components/Notifications/hooks/useSystemNotifications.js +22 -0
- package/lib/commonjs/components/Notifications/hooks/useSystemNotifications.js.map +1 -0
- package/lib/commonjs/components/Notifications/index.js +59 -0
- package/lib/commonjs/components/Notifications/index.js.map +1 -0
- package/lib/commonjs/components/Notifications/notificationTarget.js +220 -0
- package/lib/commonjs/components/Notifications/notificationTarget.js.map +1 -0
- package/lib/commonjs/components/Notifications/notificationTranslations.js +137 -0
- package/lib/commonjs/components/Notifications/notificationTranslations.js.map +1 -0
- package/lib/commonjs/components/Poll/components/CreatePollHeader.js +2 -0
- package/lib/commonjs/components/Poll/components/CreatePollHeader.js.map +1 -1
- package/lib/commonjs/components/Poll/components/MultipleVotesSettings.js +2 -0
- package/lib/commonjs/components/Poll/components/MultipleVotesSettings.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollModalHeader.js +1 -0
- package/lib/commonjs/components/Poll/components/PollModalHeader.js.map +1 -1
- package/lib/commonjs/components/Poll/components/PollOption.js +14 -9
- package/lib/commonjs/components/Poll/components/PollOption.js.map +1 -1
- package/lib/commonjs/components/Poll/hooks/usePollState.js +35 -3
- package/lib/commonjs/components/Poll/hooks/usePollState.js.map +1 -1
- package/lib/commonjs/components/Reply/Reply.js +1 -0
- package/lib/commonjs/components/Reply/Reply.js.map +1 -1
- package/lib/commonjs/components/Thread/Thread.js +19 -11
- package/lib/commonjs/components/Thread/Thread.js.map +1 -1
- package/lib/commonjs/components/ThreadList/ThreadList.js +30 -9
- package/lib/commonjs/components/ThreadList/ThreadList.js.map +1 -1
- package/lib/commonjs/components/index.js +11 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/components/ui/Avatar/Avatar.js +6 -3
- package/lib/commonjs/components/ui/Avatar/Avatar.js.map +1 -1
- package/lib/commonjs/components/ui/Button/Button.js +16 -3
- package/lib/commonjs/components/ui/Button/Button.js.map +1 -1
- package/lib/commonjs/contexts/accessibilityContext/AccessibilityContext.js +21 -1
- package/lib/commonjs/contexts/accessibilityContext/AccessibilityContext.js.map +1 -1
- package/lib/commonjs/contexts/componentsContext/defaultComponents.js +4 -0
- package/lib/commonjs/contexts/componentsContext/defaultComponents.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +37 -0
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js +13 -0
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/hooks/index.js +11 -0
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useAudioPlayer.js +34 -1
- package/lib/commonjs/hooks/useAudioPlayer.js.map +1 -1
- package/lib/commonjs/hooks/useInAppNotificationsState.js.map +1 -1
- package/lib/commonjs/hooks/useLazyRef.js +13 -0
- package/lib/commonjs/hooks/useLazyRef.js.map +1 -0
- package/lib/commonjs/i18n/en.json +94 -1
- package/lib/commonjs/i18n/es.json +96 -3
- package/lib/commonjs/i18n/fr.json +94 -1
- package/lib/commonjs/i18n/he.json +94 -1
- package/lib/commonjs/i18n/hi.json +94 -1
- package/lib/commonjs/i18n/it.json +94 -1
- package/lib/commonjs/i18n/ja.json +94 -1
- package/lib/commonjs/i18n/ko.json +94 -1
- package/lib/commonjs/i18n/nl.json +94 -1
- package/lib/commonjs/i18n/pt-br.json +94 -1
- package/lib/commonjs/i18n/ru.json +94 -1
- package/lib/commonjs/i18n/tr.json +94 -1
- package/lib/commonjs/mock-builders/DB/mock.js +3 -1
- package/lib/commonjs/mock-builders/DB/mock.js.map +1 -1
- package/lib/commonjs/state-store/audio-player-pool.js +1 -0
- package/lib/commonjs/state-store/audio-player-pool.js.map +1 -1
- package/lib/commonjs/state-store/audio-player.js +92 -13
- package/lib/commonjs/state-store/audio-player.js.map +1 -1
- package/lib/commonjs/test-utils/BetterSqlite.js +3 -2
- package/lib/commonjs/test-utils/BetterSqlite.js.map +1 -1
- package/lib/commonjs/theme/generated/dark/StreamTokens.android.js +16 -16
- package/lib/commonjs/theme/generated/dark/StreamTokens.android.js.map +1 -1
- package/lib/commonjs/theme/generated/dark/StreamTokens.ios.js +8 -8
- package/lib/commonjs/theme/generated/dark/StreamTokens.ios.js.map +1 -1
- package/lib/commonjs/theme/generated/dark/StreamTokens.web.js +8 -8
- package/lib/commonjs/theme/generated/dark/StreamTokens.web.js.map +1 -1
- package/lib/commonjs/theme/generated/light/StreamTokens.android.js +16 -16
- package/lib/commonjs/theme/generated/light/StreamTokens.android.js.map +1 -1
- package/lib/commonjs/theme/generated/light/StreamTokens.ios.js +8 -8
- package/lib/commonjs/theme/generated/light/StreamTokens.ios.js.map +1 -1
- package/lib/commonjs/theme/generated/light/StreamTokens.web.js +8 -8
- package/lib/commonjs/theme/generated/light/StreamTokens.web.js.map +1 -1
- package/lib/commonjs/utils/animations/createBoundedZoomTransition.js +151 -0
- package/lib/commonjs/utils/animations/createBoundedZoomTransition.js.map +1 -0
- package/lib/commonjs/utils/{transitions.js → animations/transitions.js} +6 -0
- package/lib/commonjs/utils/animations/transitions.js.map +1 -0
- package/lib/commonjs/version.json +1 -1
- package/lib/module/a11y/hooks/useA11yLabel.js +4 -3
- package/lib/module/a11y/hooks/useA11yLabel.js.map +1 -1
- package/lib/module/a11y/hooks/useAccessibilityActivateAction.js +25 -0
- package/lib/module/a11y/hooks/useAccessibilityActivateAction.js.map +1 -0
- package/lib/module/a11y/index.js +11 -0
- package/lib/module/a11y/index.js.map +1 -1
- package/lib/module/components/AttachmentPicker/AttachmentPicker.js +20 -0
- package/lib/module/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.js +1 -0
- package/lib/module/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.js +19 -2
- package/lib/module/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerContent.js +4 -3
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerContent.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentTypePickerButton.js +9 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentTypePickerButton.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +10 -1
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useMessageListPagination.js +26 -3
- package/lib/module/components/Channel/hooks/useMessageListPagination.js.map +1 -1
- package/lib/module/components/ChannelList/ChannelList.js +29 -4
- package/lib/module/components/ChannelList/ChannelList.js.map +1 -1
- package/lib/module/components/ChannelList/hooks/useChannelActions.js +314 -11
- package/lib/module/components/ChannelList/hooks/useChannelActions.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js +2 -2
- package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -1
- package/lib/module/components/Message/hooks/useMessageActionHandlers.js +202 -15
- package/lib/module/components/Message/hooks/useMessageActionHandlers.js.map +1 -1
- package/lib/module/components/MessageInput/MessageComposer.js +1 -1
- package/lib/module/components/MessageInput/MessageComposerLeadingView.js +1 -1
- package/lib/module/components/MessageInput/MessageComposerLeadingView.js.map +1 -1
- package/lib/module/components/MessageInput/MessageInputHeaderView.js +1 -1
- package/lib/module/components/MessageInput/MessageInputHeaderView.js.map +1 -1
- package/lib/module/components/MessageInput/MessageInputTrailingView.js +1 -1
- package/lib/module/components/MessageInput/MessageInputTrailingView.js.map +1 -1
- package/lib/module/components/MessageInput/components/AttachmentPreview/AttachmentRemoveControl.js +16 -4
- package/lib/module/components/MessageInput/components/AttachmentPreview/AttachmentRemoveControl.js.map +1 -1
- package/lib/module/components/MessageInput/components/AttachmentPreview/AttachmentUploadPreviewList.js +7 -13
- package/lib/module/components/MessageInput/components/AttachmentPreview/AttachmentUploadPreviewList.js.map +1 -1
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecorder.js +30 -6
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecorder.js.map +1 -1
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js +34 -9
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js.map +1 -1
- package/lib/module/components/MessageInput/components/InputButtons/AttachButton.js +12 -3
- package/lib/module/components/MessageInput/components/InputButtons/AttachButton.js.map +1 -1
- package/lib/module/components/MessageInput/components/OutputButtons/EditButton.js +1 -0
- package/lib/module/components/MessageInput/components/OutputButtons/EditButton.js.map +1 -1
- package/lib/module/components/MessageInput/components/OutputButtons/SendButton.js +1 -0
- package/lib/module/components/MessageInput/components/OutputButtons/SendButton.js.map +1 -1
- package/lib/module/components/MessageInput/components/OutputButtons/index.js +1 -1
- package/lib/module/components/MessageList/MessageFlashList.js +24 -4
- package/lib/module/components/MessageList/MessageFlashList.js.map +1 -1
- package/lib/module/components/MessageList/MessageList.js +24 -4
- package/lib/module/components/MessageList/MessageList.js.map +1 -1
- package/lib/module/components/MessageList/ScrollToBottomButton.js +12 -6
- package/lib/module/components/MessageList/ScrollToBottomButton.js.map +1 -1
- package/lib/module/components/MessageList/UnreadMessagesNotification.js +1 -0
- package/lib/module/components/MessageList/UnreadMessagesNotification.js.map +1 -1
- package/lib/module/components/MessageList/hooks/useScrollToBottomAccessibilityAction.js +47 -0
- package/lib/module/components/MessageList/hooks/useScrollToBottomAccessibilityAction.js.map +1 -0
- package/lib/module/components/MessageMenu/MessageActionListItem.js +12 -4
- package/lib/module/components/MessageMenu/MessageActionListItem.js.map +1 -1
- package/lib/module/components/MessageMenu/MessageReactionPicker.js +1 -0
- package/lib/module/components/MessageMenu/MessageReactionPicker.js.map +1 -1
- package/lib/module/components/MessageMenu/ReactionButton.js +9 -6
- package/lib/module/components/MessageMenu/ReactionButton.js.map +1 -1
- package/lib/module/components/MessageMenu/hooks/useFetchReactions.js +23 -2
- package/lib/module/components/MessageMenu/hooks/useFetchReactions.js.map +1 -1
- package/lib/module/components/Notifications/Notification.js +232 -0
- package/lib/module/components/Notifications/Notification.js.map +1 -0
- package/lib/module/components/Notifications/NotificationList.js +120 -0
- package/lib/module/components/Notifications/NotificationList.js.map +1 -0
- package/lib/module/components/Notifications/NotificationTargetContext.js +45 -0
- package/lib/module/components/Notifications/NotificationTargetContext.js.map +1 -0
- package/lib/module/components/Notifications/hooks/index.js +59 -0
- package/lib/module/components/Notifications/hooks/index.js.map +1 -0
- package/lib/module/components/Notifications/hooks/useNotificationApi.js +133 -0
- package/lib/module/components/Notifications/hooks/useNotificationApi.js.map +1 -0
- package/lib/module/components/Notifications/hooks/useNotificationListController.js +133 -0
- package/lib/module/components/Notifications/hooks/useNotificationListController.js.map +1 -0
- package/lib/module/components/Notifications/hooks/useNotificationTarget.js +26 -0
- package/lib/module/components/Notifications/hooks/useNotificationTarget.js.map +1 -0
- package/lib/module/components/Notifications/hooks/useNotifications.js +26 -0
- package/lib/module/components/Notifications/hooks/useNotifications.js.map +1 -0
- package/lib/module/components/Notifications/hooks/useSystemNotifications.js +22 -0
- package/lib/module/components/Notifications/hooks/useSystemNotifications.js.map +1 -0
- package/lib/module/components/Notifications/index.js +59 -0
- package/lib/module/components/Notifications/index.js.map +1 -0
- package/lib/module/components/Notifications/notificationTarget.js +220 -0
- package/lib/module/components/Notifications/notificationTarget.js.map +1 -0
- package/lib/module/components/Notifications/notificationTranslations.js +137 -0
- package/lib/module/components/Notifications/notificationTranslations.js.map +1 -0
- package/lib/module/components/Poll/components/CreatePollHeader.js +2 -0
- package/lib/module/components/Poll/components/CreatePollHeader.js.map +1 -1
- package/lib/module/components/Poll/components/MultipleVotesSettings.js +2 -0
- package/lib/module/components/Poll/components/MultipleVotesSettings.js.map +1 -1
- package/lib/module/components/Poll/components/PollModalHeader.js +1 -0
- package/lib/module/components/Poll/components/PollModalHeader.js.map +1 -1
- package/lib/module/components/Poll/components/PollOption.js +14 -9
- package/lib/module/components/Poll/components/PollOption.js.map +1 -1
- package/lib/module/components/Poll/hooks/usePollState.js +35 -3
- package/lib/module/components/Poll/hooks/usePollState.js.map +1 -1
- package/lib/module/components/Reply/Reply.js +1 -0
- package/lib/module/components/Reply/Reply.js.map +1 -1
- package/lib/module/components/Thread/Thread.js +19 -11
- package/lib/module/components/Thread/Thread.js.map +1 -1
- package/lib/module/components/ThreadList/ThreadList.js +30 -9
- package/lib/module/components/ThreadList/ThreadList.js.map +1 -1
- package/lib/module/components/index.js +11 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/ui/Avatar/Avatar.js +6 -3
- package/lib/module/components/ui/Avatar/Avatar.js.map +1 -1
- package/lib/module/components/ui/Button/Button.js +16 -3
- package/lib/module/components/ui/Button/Button.js.map +1 -1
- package/lib/module/contexts/accessibilityContext/AccessibilityContext.js +21 -1
- package/lib/module/contexts/accessibilityContext/AccessibilityContext.js.map +1 -1
- package/lib/module/contexts/componentsContext/defaultComponents.js +4 -0
- package/lib/module/contexts/componentsContext/defaultComponents.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js +37 -0
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/themeContext/utils/theme.js +13 -0
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/hooks/index.js +11 -0
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useAudioPlayer.js +34 -1
- package/lib/module/hooks/useAudioPlayer.js.map +1 -1
- package/lib/module/hooks/useInAppNotificationsState.js.map +1 -1
- package/lib/module/hooks/useLazyRef.js +13 -0
- package/lib/module/hooks/useLazyRef.js.map +1 -0
- package/lib/module/i18n/en.json +94 -1
- package/lib/module/i18n/es.json +96 -3
- package/lib/module/i18n/fr.json +94 -1
- package/lib/module/i18n/he.json +94 -1
- package/lib/module/i18n/hi.json +94 -1
- package/lib/module/i18n/it.json +94 -1
- package/lib/module/i18n/ja.json +94 -1
- package/lib/module/i18n/ko.json +94 -1
- package/lib/module/i18n/nl.json +94 -1
- package/lib/module/i18n/pt-br.json +94 -1
- package/lib/module/i18n/ru.json +94 -1
- package/lib/module/i18n/tr.json +94 -1
- package/lib/module/mock-builders/DB/mock.js +3 -1
- package/lib/module/mock-builders/DB/mock.js.map +1 -1
- package/lib/module/state-store/audio-player-pool.js +1 -0
- package/lib/module/state-store/audio-player-pool.js.map +1 -1
- package/lib/module/state-store/audio-player.js +92 -13
- package/lib/module/state-store/audio-player.js.map +1 -1
- package/lib/module/test-utils/BetterSqlite.js +3 -2
- package/lib/module/test-utils/BetterSqlite.js.map +1 -1
- package/lib/module/theme/generated/dark/StreamTokens.android.js +16 -16
- package/lib/module/theme/generated/dark/StreamTokens.android.js.map +1 -1
- package/lib/module/theme/generated/dark/StreamTokens.ios.js +8 -8
- package/lib/module/theme/generated/dark/StreamTokens.ios.js.map +1 -1
- package/lib/module/theme/generated/dark/StreamTokens.web.js +8 -8
- package/lib/module/theme/generated/dark/StreamTokens.web.js.map +1 -1
- package/lib/module/theme/generated/light/StreamTokens.android.js +16 -16
- package/lib/module/theme/generated/light/StreamTokens.android.js.map +1 -1
- package/lib/module/theme/generated/light/StreamTokens.ios.js +8 -8
- package/lib/module/theme/generated/light/StreamTokens.ios.js.map +1 -1
- package/lib/module/theme/generated/light/StreamTokens.web.js +8 -8
- package/lib/module/theme/generated/light/StreamTokens.web.js.map +1 -1
- package/lib/module/utils/animations/createBoundedZoomTransition.js +151 -0
- package/lib/module/utils/animations/createBoundedZoomTransition.js.map +1 -0
- package/lib/module/utils/{transitions.js → animations/transitions.js} +6 -0
- package/lib/module/utils/animations/transitions.js.map +1 -0
- package/lib/module/version.json +1 -1
- package/lib/typescript/a11y/a11yUtils.d.ts +3 -3
- package/lib/typescript/a11y/a11yUtils.d.ts.map +1 -1
- package/lib/typescript/a11y/hooks/useA11yLabel.d.ts +2 -1
- package/lib/typescript/a11y/hooks/useA11yLabel.d.ts.map +1 -1
- package/lib/typescript/a11y/hooks/useAccessibilityActivateAction.d.ts +17 -0
- package/lib/typescript/a11y/hooks/useAccessibilityActivateAction.d.ts.map +1 -0
- package/lib/typescript/a11y/index.d.ts +1 -0
- package/lib/typescript/a11y/index.d.ts.map +1 -1
- package/lib/typescript/components/AttachmentPicker/AttachmentPicker.d.ts.map +1 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.d.ts.map +1 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.d.ts.map +1 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerContent.d.ts.map +1 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentTypePickerButton.d.ts +2 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentTypePickerButton.d.ts.map +1 -1
- package/lib/typescript/components/Channel/Channel.d.ts +1 -0
- package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useMessageListPagination.d.ts.map +1 -1
- package/lib/typescript/components/ChannelList/ChannelList.d.ts +1 -0
- package/lib/typescript/components/ChannelList/ChannelList.d.ts.map +1 -1
- package/lib/typescript/components/ChannelList/hooks/useChannelActions.d.ts.map +1 -1
- package/lib/typescript/components/Message/hooks/useMessageActionHandlers.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/components/AttachmentPreview/AttachmentRemoveControl.d.ts +5 -2
- package/lib/typescript/components/MessageInput/components/AttachmentPreview/AttachmentRemoveControl.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/components/AttachmentPreview/AttachmentUploadPreviewList.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecorder.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingButton.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/components/InputButtons/AttachButton.d.ts +1 -0
- package/lib/typescript/components/MessageInput/components/InputButtons/AttachButton.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/components/OutputButtons/EditButton.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/components/OutputButtons/SendButton.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/MessageFlashList.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/MessageList.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/ScrollToBottomButton.d.ts +2 -0
- package/lib/typescript/components/MessageList/ScrollToBottomButton.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/UnreadMessagesNotification.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/hooks/useScrollToBottomAccessibilityAction.d.ts +20 -0
- package/lib/typescript/components/MessageList/hooks/useScrollToBottomAccessibilityAction.d.ts.map +1 -0
- package/lib/typescript/components/MessageMenu/MessageActionListItem.d.ts.map +1 -1
- package/lib/typescript/components/MessageMenu/MessageReactionPicker.d.ts.map +1 -1
- package/lib/typescript/components/MessageMenu/ReactionButton.d.ts.map +1 -1
- package/lib/typescript/components/MessageMenu/hooks/useFetchReactions.d.ts.map +1 -1
- package/lib/typescript/components/Notifications/Notification.d.ts +31 -0
- package/lib/typescript/components/Notifications/Notification.d.ts.map +1 -0
- package/lib/typescript/components/Notifications/NotificationList.d.ts +28 -0
- package/lib/typescript/components/Notifications/NotificationList.d.ts.map +1 -0
- package/lib/typescript/components/Notifications/NotificationTargetContext.d.ts +14 -0
- package/lib/typescript/components/Notifications/NotificationTargetContext.d.ts.map +1 -0
- package/lib/typescript/components/Notifications/hooks/index.d.ts +6 -0
- package/lib/typescript/components/Notifications/hooks/index.d.ts.map +1 -0
- package/lib/typescript/components/Notifications/hooks/useNotificationApi.d.ts +48 -0
- package/lib/typescript/components/Notifications/hooks/useNotificationApi.d.ts.map +1 -0
- package/lib/typescript/components/Notifications/hooks/useNotificationListController.d.ts +14 -0
- package/lib/typescript/components/Notifications/hooks/useNotificationListController.d.ts.map +1 -0
- package/lib/typescript/components/Notifications/hooks/useNotificationTarget.d.ts +3 -0
- package/lib/typescript/components/Notifications/hooks/useNotificationTarget.d.ts.map +1 -0
- package/lib/typescript/components/Notifications/hooks/useNotifications.d.ts +14 -0
- package/lib/typescript/components/Notifications/hooks/useNotifications.d.ts.map +1 -0
- package/lib/typescript/components/Notifications/hooks/useSystemNotifications.d.ts +9 -0
- package/lib/typescript/components/Notifications/hooks/useSystemNotifications.d.ts.map +1 -0
- package/lib/typescript/components/Notifications/index.d.ts +6 -0
- package/lib/typescript/components/Notifications/index.d.ts.map +1 -0
- package/lib/typescript/components/Notifications/notificationTarget.d.ts +55 -0
- package/lib/typescript/components/Notifications/notificationTarget.d.ts.map +1 -0
- package/lib/typescript/components/Notifications/notificationTranslations.d.ts +7 -0
- package/lib/typescript/components/Notifications/notificationTranslations.d.ts.map +1 -0
- package/lib/typescript/components/Poll/components/CreatePollHeader.d.ts.map +1 -1
- package/lib/typescript/components/Poll/components/MultipleVotesSettings.d.ts.map +1 -1
- package/lib/typescript/components/Poll/components/PollModalHeader.d.ts.map +1 -1
- package/lib/typescript/components/Poll/components/PollOption.d.ts.map +1 -1
- package/lib/typescript/components/Poll/hooks/usePollState.d.ts.map +1 -1
- package/lib/typescript/components/Reply/Reply.d.ts.map +1 -1
- package/lib/typescript/components/Thread/Thread.d.ts +1 -0
- package/lib/typescript/components/Thread/Thread.d.ts.map +1 -1
- package/lib/typescript/components/ThreadList/ThreadList.d.ts +3 -1
- package/lib/typescript/components/ThreadList/ThreadList.d.ts.map +1 -1
- package/lib/typescript/components/index.d.ts +1 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/components/ui/Avatar/Avatar.d.ts.map +1 -1
- package/lib/typescript/components/ui/Button/Button.d.ts +10 -1
- package/lib/typescript/components/ui/Button/Button.d.ts.map +1 -1
- package/lib/typescript/contexts/accessibilityContext/AccessibilityContext.d.ts +1 -1
- package/lib/typescript/contexts/accessibilityContext/AccessibilityContext.d.ts.map +1 -1
- package/lib/typescript/contexts/componentsContext/defaultComponents.d.ts +3 -0
- package/lib/typescript/contexts/componentsContext/defaultComponents.d.ts.map +1 -1
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts.map +1 -1
- package/lib/typescript/contexts/themeContext/ThemeContext.d.ts +13 -0
- package/lib/typescript/contexts/themeContext/ThemeContext.d.ts.map +1 -1
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +13 -0
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
- package/lib/typescript/hooks/index.d.ts +1 -0
- package/lib/typescript/hooks/index.d.ts.map +1 -1
- package/lib/typescript/hooks/useAudioPlayer.d.ts.map +1 -1
- package/lib/typescript/hooks/useInAppNotificationsState.d.ts +6 -0
- package/lib/typescript/hooks/useInAppNotificationsState.d.ts.map +1 -1
- package/lib/typescript/hooks/useLazyRef.d.ts +7 -0
- package/lib/typescript/hooks/useLazyRef.d.ts.map +1 -0
- package/lib/typescript/i18n/en.json +94 -1
- package/lib/typescript/i18n/es.json +96 -3
- package/lib/typescript/i18n/fr.json +94 -1
- package/lib/typescript/i18n/he.json +94 -1
- package/lib/typescript/i18n/hi.json +94 -1
- package/lib/typescript/i18n/it.json +94 -1
- package/lib/typescript/i18n/ja.json +94 -1
- package/lib/typescript/i18n/ko.json +94 -1
- package/lib/typescript/i18n/nl.json +94 -1
- package/lib/typescript/i18n/pt-br.json +94 -1
- package/lib/typescript/i18n/ru.json +94 -1
- package/lib/typescript/i18n/tr.json +94 -1
- package/lib/typescript/state-store/audio-player-pool.d.ts.map +1 -1
- package/lib/typescript/state-store/audio-player.d.ts +13 -0
- package/lib/typescript/state-store/audio-player.d.ts.map +1 -1
- package/lib/typescript/test-utils/BetterSqlite.d.ts.map +1 -1
- package/lib/typescript/utils/animations/createBoundedZoomTransition.d.ts +21 -0
- package/lib/typescript/utils/animations/createBoundedZoomTransition.d.ts.map +1 -0
- package/lib/typescript/utils/animations/transitions.d.ts +21 -0
- package/lib/typescript/utils/animations/transitions.d.ts.map +1 -0
- package/lib/typescript/utils/i18n/Streami18n.d.ts +93 -0
- package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/offline-support/offline-feature.tsx +40 -34
- package/src/a11y/a11yUtils.ts +2 -2
- package/src/a11y/hooks/useA11yLabel.ts +7 -4
- package/src/a11y/hooks/useAccessibilityActivateAction.ts +44 -0
- package/src/a11y/index.ts +1 -0
- package/src/components/AttachmentPicker/AttachmentPicker.tsx +23 -1
- package/src/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentMediaPicker.tsx +1 -0
- package/src/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.tsx +15 -2
- package/src/components/AttachmentPicker/components/AttachmentPickerContent.tsx +4 -3
- package/src/components/AttachmentPicker/components/AttachmentTypePickerButton.tsx +9 -0
- package/src/components/AttachmentPicker/components/__tests__/AttachmentPickerContent.test.tsx +19 -18
- package/src/components/Channel/Channel.tsx +15 -1
- package/src/components/Channel/__tests__/useMessageListPagination.test.tsx +34 -2
- package/src/components/Channel/hooks/useMessageListPagination.tsx +19 -3
- package/src/components/ChannelList/ChannelList.tsx +27 -5
- package/src/components/ChannelList/__tests__/ChannelListView.test.tsx +16 -5
- package/src/components/ChannelList/hooks/__tests__/useChannelActions.test.tsx +123 -0
- package/src/components/ChannelList/hooks/useChannelActions.ts +181 -12
- package/src/components/ImageGallery/__tests__/ImageGalleryFooter.test.tsx +9 -3
- package/src/components/ImageGallery/__tests__/ImageGalleryHeader.test.tsx +4 -1
- package/src/components/ImageGallery/components/ImageGalleryFooter.tsx +2 -2
- package/src/components/ImageGallery/components/ImageGalleryHeader.tsx +1 -1
- package/src/components/ImageGallery/components/ImageGalleryVideoControl.tsx +1 -1
- package/src/components/Message/hooks/__tests__/useMessageActionHandlers.test.tsx +131 -0
- package/src/components/Message/hooks/useMessageActionHandlers.ts +133 -23
- package/src/components/MessageInput/MessageComposer.tsx +1 -1
- package/src/components/MessageInput/MessageComposerLeadingView.tsx +1 -1
- package/src/components/MessageInput/MessageInputHeaderView.tsx +1 -1
- package/src/components/MessageInput/MessageInputTrailingView.tsx +1 -1
- package/src/components/MessageInput/components/AttachmentPreview/AttachmentRemoveControl.tsx +18 -2
- package/src/components/MessageInput/components/AttachmentPreview/AttachmentUploadPreviewList.tsx +1 -10
- package/src/components/MessageInput/components/AudioRecorder/AudioRecorder.tsx +13 -2
- package/src/components/MessageInput/components/AudioRecorder/AudioRecordingButton.tsx +35 -14
- package/src/components/MessageInput/components/InputButtons/AttachButton.tsx +13 -3
- package/src/components/MessageInput/components/OutputButtons/EditButton.tsx +1 -0
- package/src/components/MessageInput/components/OutputButtons/SendButton.tsx +1 -0
- package/src/components/MessageInput/components/OutputButtons/index.tsx +1 -1
- package/src/components/MessageList/MessageFlashList.tsx +26 -3
- package/src/components/MessageList/MessageList.tsx +26 -3
- package/src/components/MessageList/ScrollToBottomButton.tsx +18 -6
- package/src/components/MessageList/UnreadMessagesNotification.tsx +1 -0
- package/src/components/MessageList/__tests__/MessageList.test.tsx +221 -0
- package/src/components/MessageList/__tests__/ScrollToBottomButton.test.tsx +2 -2
- package/src/components/MessageList/__tests__/__snapshots__/ScrollToBottomButton.test.tsx.snap +3 -1
- package/src/components/MessageList/hooks/useScrollToBottomAccessibilityAction.ts +74 -0
- package/src/components/MessageMenu/MessageActionListItem.tsx +10 -4
- package/src/components/MessageMenu/MessageReactionPicker.tsx +1 -0
- package/src/components/MessageMenu/ReactionButton.tsx +7 -9
- package/src/components/MessageMenu/__tests__/MessageReactionPicker.test.tsx +13 -15
- package/src/components/MessageMenu/__tests__/MessageUserReactions.test.tsx +20 -18
- package/src/components/MessageMenu/__tests__/ReactionButton.test.tsx +18 -5
- package/src/components/MessageMenu/hooks/useFetchReactions.ts +17 -2
- package/src/components/Notifications/Notification.tsx +254 -0
- package/src/components/Notifications/NotificationList.tsx +160 -0
- package/src/components/Notifications/NotificationTargetContext.tsx +45 -0
- package/src/components/Notifications/__tests__/NotificationList.test.tsx +480 -0
- package/src/components/Notifications/__tests__/notificationTarget.test.ts +157 -0
- package/src/components/Notifications/hooks/__tests__/useNotificationApi.test.tsx +172 -0
- package/src/components/Notifications/hooks/__tests__/useNotificationTarget.test.tsx +85 -0
- package/src/components/Notifications/hooks/index.ts +5 -0
- package/src/components/Notifications/hooks/useNotificationApi.ts +248 -0
- package/src/components/Notifications/hooks/useNotificationListController.ts +160 -0
- package/src/components/Notifications/hooks/useNotificationTarget.ts +37 -0
- package/src/components/Notifications/hooks/useNotifications.ts +43 -0
- package/src/components/Notifications/hooks/useSystemNotifications.ts +33 -0
- package/src/components/Notifications/index.ts +5 -0
- package/src/components/Notifications/notificationTarget.ts +305 -0
- package/src/components/Notifications/notificationTranslations.ts +142 -0
- package/src/components/Poll/components/CreatePollHeader.tsx +2 -0
- package/src/components/Poll/components/MultipleVotesSettings.tsx +2 -0
- package/src/components/Poll/components/PollModalHeader.tsx +1 -0
- package/src/components/Poll/components/PollOption.tsx +10 -6
- package/src/components/Poll/hooks/usePollState.ts +26 -2
- package/src/components/Reply/Reply.tsx +4 -1
- package/src/components/Thread/Thread.tsx +24 -16
- package/src/components/Thread/__tests__/__snapshots__/Thread.test.tsx.snap +3 -0
- package/src/components/ThreadList/ThreadList.tsx +33 -9
- package/src/components/index.ts +2 -0
- package/src/components/ui/Avatar/Avatar.tsx +2 -1
- package/src/components/ui/Button/Button.tsx +26 -0
- package/src/components/ui/Button/__tests__/Button.test.tsx +44 -0
- package/src/contexts/accessibilityContext/AccessibilityContext.tsx +35 -1
- package/src/contexts/componentsContext/defaultComponents.ts +4 -0
- package/src/contexts/messageInputContext/MessageInputContext.tsx +36 -0
- package/src/contexts/themeContext/utils/theme.ts +26 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useAudioPlayer.ts +44 -3
- package/src/hooks/useInAppNotificationsState.ts +6 -0
- package/src/hooks/useLazyRef.ts +15 -0
- package/src/i18n/en.json +94 -1
- package/src/i18n/es.json +96 -3
- package/src/i18n/fr.json +94 -1
- package/src/i18n/he.json +94 -1
- package/src/i18n/hi.json +94 -1
- package/src/i18n/it.json +94 -1
- package/src/i18n/ja.json +94 -1
- package/src/i18n/ko.json +94 -1
- package/src/i18n/nl.json +94 -1
- package/src/i18n/pt-br.json +94 -1
- package/src/i18n/ru.json +94 -1
- package/src/i18n/tr.json +94 -1
- package/src/mock-builders/DB/mock.ts +2 -1
- package/src/state-store/__tests__/audio-player.test.ts +45 -0
- package/src/state-store/audio-player-pool.ts +1 -0
- package/src/state-store/audio-player.ts +108 -16
- package/src/test-utils/BetterSqlite.ts +3 -1
- package/src/theme/generated/dark/StreamTokens.android.ts +16 -16
- package/src/theme/generated/dark/StreamTokens.ios.ts +8 -8
- package/src/theme/generated/dark/StreamTokens.web.ts +8 -8
- package/src/theme/generated/light/StreamTokens.android.ts +16 -16
- package/src/theme/generated/light/StreamTokens.ios.ts +8 -8
- package/src/theme/generated/light/StreamTokens.web.ts +8 -8
- package/src/utils/animations/createBoundedZoomTransition.ts +117 -0
- package/src/utils/{transitions.ts → animations/transitions.ts} +6 -0
- package/src/version.json +1 -1
- package/lib/commonjs/utils/transitions.js.map +0 -1
- package/lib/module/utils/transitions.js.map +0 -1
- package/lib/typescript/utils/transitions.d.ts +0 -9
- package/lib/typescript/utils/transitions.d.ts.map +0 -1
|
@@ -14,7 +14,8 @@ import {
|
|
|
14
14
|
|
|
15
15
|
import { usePollStateStore } from './usePollStateStore';
|
|
16
16
|
|
|
17
|
-
import { usePollContext } from '../../../contexts';
|
|
17
|
+
import { usePollContext, useTranslationContext } from '../../../contexts';
|
|
18
|
+
import { useNotificationApi } from '../../Notifications';
|
|
18
19
|
|
|
19
20
|
export type UsePollStateSelectorReturnType = {
|
|
20
21
|
allowAnswers: boolean | undefined;
|
|
@@ -62,6 +63,8 @@ const selector = (nextValue: PollState): UsePollStateSelectorReturnType => ({
|
|
|
62
63
|
|
|
63
64
|
export const usePollState = (): UsePollStateReturnType => {
|
|
64
65
|
const { message, poll } = usePollContext();
|
|
66
|
+
const { addNotification } = useNotificationApi();
|
|
67
|
+
const { t } = useTranslationContext();
|
|
65
68
|
const {
|
|
66
69
|
allowAnswers,
|
|
67
70
|
allowUserSuggestedOptions,
|
|
@@ -91,7 +94,28 @@ export const usePollState = (): UsePollStateReturnType => {
|
|
|
91
94
|
(answerText: string) => poll.addAnswer(answerText, message.id),
|
|
92
95
|
[message.id, poll],
|
|
93
96
|
);
|
|
94
|
-
const endVote = useCallback(() =>
|
|
97
|
+
const endVote = useCallback(async () => {
|
|
98
|
+
try {
|
|
99
|
+
const response = await poll.close();
|
|
100
|
+
addNotification({
|
|
101
|
+
message: t('Poll ended'),
|
|
102
|
+
options: { severity: 'success', type: 'api:poll:end:success' },
|
|
103
|
+
origin: { emitter: 'PollActions' },
|
|
104
|
+
});
|
|
105
|
+
return response;
|
|
106
|
+
} catch (error) {
|
|
107
|
+
addNotification({
|
|
108
|
+
message: t('Failed to end the poll'),
|
|
109
|
+
options: {
|
|
110
|
+
...(error instanceof Error ? { originalError: error } : {}),
|
|
111
|
+
severity: 'error',
|
|
112
|
+
type: 'api:poll:end:failed',
|
|
113
|
+
},
|
|
114
|
+
origin: { emitter: 'PollActions' },
|
|
115
|
+
});
|
|
116
|
+
throw error;
|
|
117
|
+
}
|
|
118
|
+
}, [addNotification, poll, t]);
|
|
95
119
|
|
|
96
120
|
return {
|
|
97
121
|
addComment,
|
|
@@ -170,7 +170,10 @@ export const ReplyWithContext = (props: ReplyPropsWithContext) => {
|
|
|
170
170
|
</View>
|
|
171
171
|
{onDismiss ? (
|
|
172
172
|
<View style={[styles.dismissWrapper, dismissWrapper, stylesProp?.dismissWrapper]}>
|
|
173
|
-
<AttachmentRemoveControl
|
|
173
|
+
<AttachmentRemoveControl
|
|
174
|
+
accessibilityLabelKey={mode === 'edit' ? 'a11y/Remove edit' : 'a11y/Remove reply'}
|
|
175
|
+
onPress={onDismiss}
|
|
176
|
+
/>
|
|
174
177
|
</View>
|
|
175
178
|
) : null}
|
|
176
179
|
</View>
|
|
@@ -10,6 +10,8 @@ import { ThreadContextValue, useThreadContext } from '../../contexts/threadConte
|
|
|
10
10
|
import type { MessageComposerProps } from '../MessageInput/MessageComposer';
|
|
11
11
|
import { MessageFlashList, MessageFlashListProps } from '../MessageList/MessageFlashList';
|
|
12
12
|
import { MessageListProps } from '../MessageList/MessageList';
|
|
13
|
+
import { getThreadNotificationHostId } from '../Notifications/notificationTarget';
|
|
14
|
+
import { NotificationTargetProvider } from '../Notifications/NotificationTargetContext';
|
|
13
15
|
|
|
14
16
|
let FlashList;
|
|
15
17
|
|
|
@@ -56,6 +58,7 @@ type ThreadPropsWithContext = Pick<ChatContextValue, 'client'> &
|
|
|
56
58
|
* Call custom function on closing thread if handling thread state elsewhere
|
|
57
59
|
*/
|
|
58
60
|
onThreadDismount?: () => void;
|
|
61
|
+
notificationHostId?: string;
|
|
59
62
|
shouldUseFlashList?: boolean;
|
|
60
63
|
};
|
|
61
64
|
|
|
@@ -70,6 +73,7 @@ const ThreadWithContext = (props: ThreadPropsWithContext) => {
|
|
|
70
73
|
disabled,
|
|
71
74
|
loadMoreThread,
|
|
72
75
|
onThreadDismount,
|
|
76
|
+
notificationHostId: notificationHostIdProp,
|
|
73
77
|
parentMessagePreventPress = true,
|
|
74
78
|
thread,
|
|
75
79
|
threadInstance,
|
|
@@ -120,26 +124,30 @@ const ThreadWithContext = (props: ThreadPropsWithContext) => {
|
|
|
120
124
|
return null;
|
|
121
125
|
}
|
|
122
126
|
|
|
127
|
+
const notificationHostId = notificationHostIdProp ?? getThreadNotificationHostId(thread.id);
|
|
128
|
+
|
|
123
129
|
return (
|
|
124
130
|
<React.Fragment key={`thread-${thread.id}`}>
|
|
125
|
-
{
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
<NotificationTargetProvider hostId={notificationHostId} panel='thread'>
|
|
132
|
+
{FlashList && shouldUseFlashList ? (
|
|
133
|
+
<MessageFlashList
|
|
134
|
+
HeaderComponent={MemoizedThreadFooterComponent}
|
|
135
|
+
threadList
|
|
136
|
+
{...additionalMessageFlashListProps}
|
|
137
|
+
/>
|
|
138
|
+
) : (
|
|
139
|
+
<MessageList
|
|
140
|
+
FooterComponent={MemoizedThreadFooterComponent}
|
|
141
|
+
threadList
|
|
142
|
+
{...additionalMessageListProps}
|
|
143
|
+
/>
|
|
144
|
+
)}
|
|
145
|
+
<MessageComposer
|
|
146
|
+
additionalTextInputProps={additionalTextInputProps}
|
|
134
147
|
threadList
|
|
135
|
-
{...
|
|
148
|
+
{...additionalMessageComposerProps}
|
|
136
149
|
/>
|
|
137
|
-
|
|
138
|
-
<MessageComposer
|
|
139
|
-
additionalTextInputProps={additionalTextInputProps}
|
|
140
|
-
threadList
|
|
141
|
-
{...additionalMessageComposerProps}
|
|
142
|
-
/>
|
|
150
|
+
</NotificationTargetProvider>
|
|
143
151
|
</React.Fragment>
|
|
144
152
|
);
|
|
145
153
|
};
|
|
@@ -1734,6 +1734,9 @@ exports[`Thread should match thread snapshot 1`] = `
|
|
|
1734
1734
|
</View>
|
|
1735
1735
|
</RCTScrollView>
|
|
1736
1736
|
<View
|
|
1737
|
+
accessibilityElementsHidden={true}
|
|
1738
|
+
accessible={false}
|
|
1739
|
+
importantForAccessibility="no-hide-descendants"
|
|
1737
1740
|
style={
|
|
1738
1741
|
{
|
|
1739
1742
|
"left": 0,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
|
-
import { FlatList, View } from 'react-native';
|
|
2
|
+
import { FlatList, StyleSheet, View } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { Thread, ThreadManagerState } from 'stream-chat';
|
|
5
5
|
|
|
@@ -14,9 +14,12 @@ import {
|
|
|
14
14
|
useThreadsContext,
|
|
15
15
|
} from '../../contexts/threadsContext/ThreadsContext';
|
|
16
16
|
import { useStateStore } from '../../hooks';
|
|
17
|
+
import { useLazyRef } from '../../hooks/useLazyRef';
|
|
18
|
+
import { generateRandomId } from '../../utils/utils';
|
|
17
19
|
|
|
18
20
|
import { EmptyStateIndicator } from '../Indicators/EmptyStateIndicator';
|
|
19
21
|
import { LoadingIndicator } from '../Indicators/LoadingIndicator';
|
|
22
|
+
import { NotificationTargetProvider } from '../Notifications/NotificationTargetContext';
|
|
20
23
|
|
|
21
24
|
const selector = (nextValue: ThreadManagerState) =>
|
|
22
25
|
({
|
|
@@ -28,7 +31,9 @@ const selector = (nextValue: ThreadManagerState) =>
|
|
|
28
31
|
export type ThreadListProps = Pick<
|
|
29
32
|
ThreadsContextValue,
|
|
30
33
|
'additionalFlatListProps' | 'isFocused' | 'onThreadSelect'
|
|
31
|
-
|
|
34
|
+
> & {
|
|
35
|
+
notificationHostId?: string;
|
|
36
|
+
};
|
|
32
37
|
|
|
33
38
|
export const DefaultThreadListEmptyPlaceholder = () => <EmptyStateIndicator listType='threads' />;
|
|
34
39
|
|
|
@@ -76,9 +81,11 @@ export const DefaultThreadListComponent = () => {
|
|
|
76
81
|
};
|
|
77
82
|
|
|
78
83
|
export const ThreadList = (props: ThreadListProps) => {
|
|
79
|
-
const { isFocused = true } = props;
|
|
80
|
-
const { ThreadListComponent: ThreadListContent } = useComponentsContext();
|
|
84
|
+
const { isFocused = true, notificationHostId: notificationHostIdProp } = props;
|
|
85
|
+
const { NotificationList, ThreadListComponent: ThreadListContent } = useComponentsContext();
|
|
81
86
|
const { client } = useChatContext();
|
|
87
|
+
const fallbackNotificationHostIdRef = useLazyRef(() => `thread-list:${generateRandomId()}`);
|
|
88
|
+
const notificationHostId = notificationHostIdProp ?? fallbackNotificationHostIdRef.current;
|
|
82
89
|
|
|
83
90
|
useEffect(() => {
|
|
84
91
|
if (!client) {
|
|
@@ -109,10 +116,27 @@ export const ThreadList = (props: ThreadListProps) => {
|
|
|
109
116
|
const { isLoading, isLoadingNext, threads } = useStateStore(client.threads.state, selector);
|
|
110
117
|
|
|
111
118
|
return (
|
|
112
|
-
<
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
119
|
+
<NotificationTargetProvider hostId={notificationHostId} panel='thread-list'>
|
|
120
|
+
<ThreadsProvider
|
|
121
|
+
value={{
|
|
122
|
+
isLoading,
|
|
123
|
+
isLoadingNext,
|
|
124
|
+
loadMore: client.threads.loadNextPage,
|
|
125
|
+
threads,
|
|
126
|
+
...props,
|
|
127
|
+
}}
|
|
128
|
+
>
|
|
129
|
+
<View style={styles.container}>
|
|
130
|
+
<ThreadListContent />
|
|
131
|
+
<NotificationList />
|
|
132
|
+
</View>
|
|
133
|
+
</ThreadsProvider>
|
|
134
|
+
</NotificationTargetProvider>
|
|
117
135
|
);
|
|
118
136
|
};
|
|
137
|
+
|
|
138
|
+
const styles = StyleSheet.create({
|
|
139
|
+
container: {
|
|
140
|
+
flex: 1,
|
|
141
|
+
},
|
|
142
|
+
});
|
package/src/components/index.ts
CHANGED
|
@@ -175,6 +175,8 @@ export * from './MessageMenu/MessageReactionPicker';
|
|
|
175
175
|
export * from './MessageMenu/utils/toUnicodeScalarString';
|
|
176
176
|
export * from './MessageMenu/hooks/useFetchReactions';
|
|
177
177
|
|
|
178
|
+
export * from './Notifications';
|
|
179
|
+
|
|
178
180
|
export * from './ProgressControl/ProgressControl';
|
|
179
181
|
export * from './ProgressControl/WaveProgressBar';
|
|
180
182
|
export * from './Poll';
|
|
@@ -46,7 +46,8 @@ export const Avatar = (props: AvatarProps) => {
|
|
|
46
46
|
style,
|
|
47
47
|
} = props;
|
|
48
48
|
const styles = useStyles();
|
|
49
|
-
const
|
|
49
|
+
const accessibilityLabelParams = useMemo(() => ({ name: name ?? '' }), [name]);
|
|
50
|
+
const composedLabel = useA11yLabel('a11y/Avatar of {{name}}', accessibilityLabelParams);
|
|
50
51
|
const accessibilityLabel = accessibilityLabelOverride ?? (name ? composedLabel : undefined);
|
|
51
52
|
|
|
52
53
|
const onHandleError = useCallback(() => {
|
|
@@ -6,6 +6,8 @@ import { Pressable, PressableProps } from 'react-native-gesture-handler';
|
|
|
6
6
|
import { buttonPadding, buttonSizes } from './constants';
|
|
7
7
|
import { useButtonStyles } from './hooks/useButtonStyles';
|
|
8
8
|
|
|
9
|
+
import { useA11yLabel } from '../../../a11y/hooks/useA11yLabel';
|
|
10
|
+
import { useAccessibilityActivateAction } from '../../../a11y/hooks/useAccessibilityActivateAction';
|
|
9
11
|
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
|
|
10
12
|
import { IconProps } from '../../../icons/utils/base';
|
|
11
13
|
import { primitives } from '../../../theme';
|
|
@@ -34,6 +36,15 @@ const getButtonAccessibilityState = ({
|
|
|
34
36
|
};
|
|
35
37
|
|
|
36
38
|
export type ButtonProps = PressableProps & {
|
|
39
|
+
/**
|
|
40
|
+
* Translation key used for the button's accessibility label when SDK
|
|
41
|
+
* accessibility is enabled. Prefer this for SDK-owned icon-only buttons.
|
|
42
|
+
*/
|
|
43
|
+
accessibilityLabelKey?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Optional interpolation params for `accessibilityLabelKey`.
|
|
46
|
+
*/
|
|
47
|
+
accessibilityLabelParams?: Record<string, unknown>;
|
|
37
48
|
/**
|
|
38
49
|
* The style of the button.
|
|
39
50
|
*/
|
|
@@ -74,6 +85,9 @@ export type ButtonProps = PressableProps & {
|
|
|
74
85
|
};
|
|
75
86
|
|
|
76
87
|
export const Button = ({
|
|
88
|
+
accessibilityLabel,
|
|
89
|
+
accessibilityLabelKey,
|
|
90
|
+
accessibilityLabelParams,
|
|
77
91
|
variant,
|
|
78
92
|
type,
|
|
79
93
|
selected = false,
|
|
@@ -100,6 +114,15 @@ export const Button = ({
|
|
|
100
114
|
const IconOnlyIcon = LeadingIcon ?? TrailingIcon;
|
|
101
115
|
const PrimaryIcon = iconOnly ? IconOnlyIcon : LeftIcon;
|
|
102
116
|
const accessibilityState = getButtonAccessibilityState({ disabled: !!disabled, selected });
|
|
117
|
+
const translatedAccessibilityLabel = useA11yLabel(
|
|
118
|
+
accessibilityLabelKey ?? '',
|
|
119
|
+
accessibilityLabelParams,
|
|
120
|
+
);
|
|
121
|
+
const resolvedAccessibilityLabel = translatedAccessibilityLabel ?? accessibilityLabel;
|
|
122
|
+
const accessibilityActivateActionProps = useAccessibilityActivateAction({
|
|
123
|
+
onPress: rest.onPress,
|
|
124
|
+
shouldHandleActivate: !!rest.onPress && !disabled && !!resolvedAccessibilityLabel,
|
|
125
|
+
});
|
|
103
126
|
|
|
104
127
|
return (
|
|
105
128
|
<View
|
|
@@ -119,6 +142,8 @@ export const Button = ({
|
|
|
119
142
|
onLayout={onLayout}
|
|
120
143
|
>
|
|
121
144
|
<Pressable
|
|
145
|
+
accessible
|
|
146
|
+
accessibilityLabel={resolvedAccessibilityLabel}
|
|
122
147
|
accessibilityRole='button'
|
|
123
148
|
accessibilityState={accessibilityState}
|
|
124
149
|
style={({ pressed }) => [
|
|
@@ -133,6 +158,7 @@ export const Button = ({
|
|
|
133
158
|
styles.container,
|
|
134
159
|
]}
|
|
135
160
|
disabled={disabled}
|
|
161
|
+
{...accessibilityActivateActionProps}
|
|
136
162
|
{...rest}
|
|
137
163
|
>
|
|
138
164
|
{PrimaryIcon ? (
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { render, screen, waitFor } from '@testing-library/react-native';
|
|
4
|
+
|
|
5
|
+
import { OverlayProvider } from '../../../../contexts';
|
|
6
|
+
import { Button } from '../Button';
|
|
7
|
+
|
|
8
|
+
describe('Button accessibilityLabelKey', () => {
|
|
9
|
+
it('uses the translated accessibility label when accessibility is enabled', async () => {
|
|
10
|
+
render(
|
|
11
|
+
<OverlayProvider accessibility={{ enabled: true }}>
|
|
12
|
+
<Button
|
|
13
|
+
accessibilityLabelKey='a11y/Add attachment'
|
|
14
|
+
iconOnly
|
|
15
|
+
onPress={jest.fn()}
|
|
16
|
+
size='md'
|
|
17
|
+
type='outline'
|
|
18
|
+
variant='secondary'
|
|
19
|
+
/>
|
|
20
|
+
</OverlayProvider>,
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
await waitFor(() => {
|
|
24
|
+
expect(screen.getByLabelText('Add attachment')).toBeTruthy();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('supports a plain accessibilityLabel without the translation path', () => {
|
|
29
|
+
render(
|
|
30
|
+
<OverlayProvider>
|
|
31
|
+
<Button
|
|
32
|
+
accessibilityLabel='Legacy label'
|
|
33
|
+
iconOnly
|
|
34
|
+
onPress={jest.fn()}
|
|
35
|
+
size='md'
|
|
36
|
+
type='outline'
|
|
37
|
+
variant='secondary'
|
|
38
|
+
/>
|
|
39
|
+
</OverlayProvider>,
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
expect(screen.getByLabelText('Legacy label')).toBeTruthy();
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -162,4 +162,38 @@ export const AccessibilityProvider = ({
|
|
|
162
162
|
);
|
|
163
163
|
};
|
|
164
164
|
|
|
165
|
-
export const useAccessibilityContext = () =>
|
|
165
|
+
export const useAccessibilityContext = (): ResolvedAccessibilityConfig => {
|
|
166
|
+
const {
|
|
167
|
+
announceConnectionState,
|
|
168
|
+
announceNewMessages,
|
|
169
|
+
announceTypingIndicator,
|
|
170
|
+
audioRecorderTapMode,
|
|
171
|
+
enabled,
|
|
172
|
+
forceScreenReaderMode,
|
|
173
|
+
imageGalleryScreenReaderMode,
|
|
174
|
+
messageActionsTrigger,
|
|
175
|
+
} = useContext(AccessibilityContext);
|
|
176
|
+
|
|
177
|
+
return useMemo(
|
|
178
|
+
() => ({
|
|
179
|
+
announceConnectionState,
|
|
180
|
+
announceNewMessages,
|
|
181
|
+
announceTypingIndicator,
|
|
182
|
+
audioRecorderTapMode,
|
|
183
|
+
enabled,
|
|
184
|
+
forceScreenReaderMode,
|
|
185
|
+
imageGalleryScreenReaderMode,
|
|
186
|
+
messageActionsTrigger,
|
|
187
|
+
}),
|
|
188
|
+
[
|
|
189
|
+
announceConnectionState,
|
|
190
|
+
announceNewMessages,
|
|
191
|
+
announceTypingIndicator,
|
|
192
|
+
audioRecorderTapMode,
|
|
193
|
+
enabled,
|
|
194
|
+
forceScreenReaderMode,
|
|
195
|
+
imageGalleryScreenReaderMode,
|
|
196
|
+
messageActionsTrigger,
|
|
197
|
+
],
|
|
198
|
+
);
|
|
199
|
+
};
|
|
@@ -130,6 +130,7 @@ import { MessageReactionPicker } from '../../components/MessageMenu/MessageReact
|
|
|
130
130
|
import { MessageUserReactions } from '../../components/MessageMenu/MessageUserReactions';
|
|
131
131
|
import { MessageUserReactionsAvatar } from '../../components/MessageMenu/MessageUserReactionsAvatar';
|
|
132
132
|
import { MessageUserReactionsItem } from '../../components/MessageMenu/MessageUserReactionsItem';
|
|
133
|
+
import { Notification, NotificationIcon, NotificationList } from '../../components/Notifications';
|
|
133
134
|
import { PollAnswersListContent } from '../../components/Poll/components/PollAnswersList';
|
|
134
135
|
import { PollButtons } from '../../components/Poll/components/PollButtons';
|
|
135
136
|
import { PollAllOptionsContent } from '../../components/Poll/components/PollOption';
|
|
@@ -245,6 +246,9 @@ const components = {
|
|
|
245
246
|
MessageUserReactionsAvatar,
|
|
246
247
|
MessageUserReactionsItem,
|
|
247
248
|
NetworkDownIndicator,
|
|
249
|
+
Notification,
|
|
250
|
+
NotificationIcon,
|
|
251
|
+
NotificationList,
|
|
248
252
|
ChannelPreview: ChannelPreviewView,
|
|
249
253
|
ChannelPreviewAvatar: ChannelAvatar,
|
|
250
254
|
ChannelPreviewLastMessage: ChannelLastMessagePreview,
|
|
@@ -26,6 +26,7 @@ import { useMessageComposer } from './hooks/useMessageComposer';
|
|
|
26
26
|
import { dismissKeyboard } from '../../components/KeyboardCompatibleView/KeyboardControllerAvoidingView';
|
|
27
27
|
import { parseLinksFromText } from '../../components/Message/MessageItemView/utils/parseLinks';
|
|
28
28
|
import { useAudioRecorder } from '../../components/MessageInput/hooks/useAudioRecorder';
|
|
29
|
+
import { useNotificationApi } from '../../components/Notifications';
|
|
29
30
|
import { useStableCallback } from '../../hooks/useStableCallback';
|
|
30
31
|
import {
|
|
31
32
|
createAttachmentsCompositionMiddleware,
|
|
@@ -220,6 +221,7 @@ export const MessageInputProvider = ({
|
|
|
220
221
|
const { clearEditingState } = useMessageComposerAPIContext();
|
|
221
222
|
const { thread } = useThreadContext();
|
|
222
223
|
const { t } = useTranslationContext();
|
|
224
|
+
const { addNotification } = useNotificationApi();
|
|
223
225
|
const inputBoxRef = useRef<InputBoxRef | null>(null);
|
|
224
226
|
|
|
225
227
|
const [showPollCreationDialog, setShowPollCreationDialog] = useState(false);
|
|
@@ -407,6 +409,23 @@ export const MessageInputProvider = ({
|
|
|
407
409
|
clearEditingState();
|
|
408
410
|
await value.editMessage({ localMessage, options: sendOptions });
|
|
409
411
|
} catch (error) {
|
|
412
|
+
addNotification(
|
|
413
|
+
{
|
|
414
|
+
message: t('Edit message request failed'),
|
|
415
|
+
options: {
|
|
416
|
+
...(error instanceof Error ? { originalError: error } : {}),
|
|
417
|
+
severity: 'error',
|
|
418
|
+
},
|
|
419
|
+
origin: { emitter: 'MessageComposer' },
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
incident: {
|
|
423
|
+
domain: 'api',
|
|
424
|
+
entity: 'message',
|
|
425
|
+
operation: 'edit',
|
|
426
|
+
},
|
|
427
|
+
},
|
|
428
|
+
);
|
|
410
429
|
throw new Error('Error while editing message');
|
|
411
430
|
}
|
|
412
431
|
} else {
|
|
@@ -433,6 +452,23 @@ export const MessageInputProvider = ({
|
|
|
433
452
|
options: sendOptions,
|
|
434
453
|
});
|
|
435
454
|
} catch (error) {
|
|
455
|
+
addNotification(
|
|
456
|
+
{
|
|
457
|
+
message: t('Send message request failed'),
|
|
458
|
+
options: {
|
|
459
|
+
...(error instanceof Error ? { originalError: error } : {}),
|
|
460
|
+
severity: 'error',
|
|
461
|
+
},
|
|
462
|
+
origin: { emitter: 'MessageComposer' },
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
incident: {
|
|
466
|
+
domain: 'api',
|
|
467
|
+
entity: 'message',
|
|
468
|
+
operation: 'send',
|
|
469
|
+
},
|
|
470
|
+
},
|
|
471
|
+
);
|
|
436
472
|
throw new Error('Error while sending message');
|
|
437
473
|
}
|
|
438
474
|
}
|
|
@@ -532,6 +532,19 @@ export type Theme = {
|
|
|
532
532
|
rightButtonContainer: ViewStyle;
|
|
533
533
|
};
|
|
534
534
|
};
|
|
535
|
+
notification: {
|
|
536
|
+
actionButton: ViewStyle;
|
|
537
|
+
actionButtonText: TextStyle;
|
|
538
|
+
actionsContainer: ViewStyle;
|
|
539
|
+
closeButton: ViewStyle;
|
|
540
|
+
container: ViewStyle;
|
|
541
|
+
contentContainer: ViewStyle;
|
|
542
|
+
iconContainer: ViewStyle;
|
|
543
|
+
message: TextStyle;
|
|
544
|
+
};
|
|
545
|
+
notificationList: {
|
|
546
|
+
container: ViewStyle;
|
|
547
|
+
};
|
|
535
548
|
messageMenu: {
|
|
536
549
|
actionList: {
|
|
537
550
|
container: ViewStyle;
|
|
@@ -1457,6 +1470,19 @@ export const defaultTheme: Theme = {
|
|
|
1457
1470
|
},
|
|
1458
1471
|
unreadMessagesNotificationContainer: {},
|
|
1459
1472
|
},
|
|
1473
|
+
notification: {
|
|
1474
|
+
actionButton: {},
|
|
1475
|
+
actionButtonText: {},
|
|
1476
|
+
actionsContainer: {},
|
|
1477
|
+
closeButton: {},
|
|
1478
|
+
container: {},
|
|
1479
|
+
contentContainer: {},
|
|
1480
|
+
iconContainer: {},
|
|
1481
|
+
message: {},
|
|
1482
|
+
},
|
|
1483
|
+
notificationList: {
|
|
1484
|
+
container: {},
|
|
1485
|
+
},
|
|
1460
1486
|
messageMenu: {
|
|
1461
1487
|
actionList: {
|
|
1462
1488
|
container: {},
|
package/src/hooks/index.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from './useQueryReminders';
|
|
|
12
12
|
export * from './useAfterKeyboardOpenCallback';
|
|
13
13
|
export * from './useClientNotifications';
|
|
14
14
|
export * from './useInAppNotificationsState';
|
|
15
|
+
export * from '../components/Notifications/hooks';
|
|
15
16
|
export * from './usePortalSettledCallback';
|
|
16
17
|
export * from './useRAFCoalescedValue';
|
|
17
18
|
export * from './useAudioPlayer';
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
1
|
+
import { useCallback, useMemo } from 'react';
|
|
2
2
|
|
|
3
|
+
import { useNotificationApi } from '../components/Notifications';
|
|
3
4
|
import { useAudioPlayerContext } from '../contexts/audioPlayerContext/AudioPlayerContext';
|
|
4
|
-
import {
|
|
5
|
+
import { useChatContext } from '../contexts/chatContext/ChatContext';
|
|
6
|
+
import { useTranslationContext } from '../contexts/translationContext/TranslationContext';
|
|
7
|
+
import { AudioPlayerErrorCode, AudioPlayerOptions } from '../state-store/audio-player';
|
|
5
8
|
|
|
6
9
|
export type UseAudioPlayerProps = {
|
|
7
10
|
/**
|
|
@@ -40,19 +43,57 @@ export const useAudioPlayer = ({
|
|
|
40
43
|
id: fileId,
|
|
41
44
|
}: UseAudioPlayerProps) => {
|
|
42
45
|
const { audioPlayerPool } = useAudioPlayerContext();
|
|
46
|
+
const { addNotification } = useNotificationApi();
|
|
47
|
+
const { client } = useChatContext();
|
|
48
|
+
const { t } = useTranslationContext();
|
|
49
|
+
const hasNotificationManager = !!client?.notifications;
|
|
43
50
|
const id = makeAudioPlayerId({ id: fileId, requester, src: uri ?? '' });
|
|
51
|
+
const onError = useCallback(
|
|
52
|
+
({ errCode, error }: { errCode: AudioPlayerErrorCode; error?: Error }) => {
|
|
53
|
+
if (!hasNotificationManager) return;
|
|
54
|
+
|
|
55
|
+
const errorMessages: Record<AudioPlayerErrorCode, string> = {
|
|
56
|
+
'failed-to-start': t('Failed to play the recording'),
|
|
57
|
+
'not-playable': t('Recording format is not supported and cannot be reproduced'),
|
|
58
|
+
'seek-not-supported': t('Cannot seek in the recording'),
|
|
59
|
+
};
|
|
60
|
+
const message = errorMessages[errCode];
|
|
61
|
+
|
|
62
|
+
addNotification({
|
|
63
|
+
message,
|
|
64
|
+
options: {
|
|
65
|
+
originalError: error ?? new Error(message),
|
|
66
|
+
severity: 'error',
|
|
67
|
+
type: 'browser:audio:playback:error',
|
|
68
|
+
},
|
|
69
|
+
origin: { emitter: 'AudioPlayer' },
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
[addNotification, hasNotificationManager, t],
|
|
73
|
+
);
|
|
44
74
|
const audioPlayer = useMemo(
|
|
45
75
|
() =>
|
|
46
76
|
audioPlayerPool?.getOrAddPlayer({
|
|
47
77
|
duration: duration ?? 0,
|
|
48
78
|
id,
|
|
49
79
|
mimeType: mimeType ?? '',
|
|
80
|
+
onError,
|
|
50
81
|
playbackRates,
|
|
51
82
|
previewVoiceRecording,
|
|
52
83
|
type: type ?? 'audio',
|
|
53
84
|
uri: uri ?? '',
|
|
54
85
|
}),
|
|
55
|
-
[
|
|
86
|
+
[
|
|
87
|
+
audioPlayerPool,
|
|
88
|
+
duration,
|
|
89
|
+
id,
|
|
90
|
+
mimeType,
|
|
91
|
+
onError,
|
|
92
|
+
playbackRates,
|
|
93
|
+
previewVoiceRecording,
|
|
94
|
+
type,
|
|
95
|
+
uri,
|
|
96
|
+
],
|
|
56
97
|
);
|
|
57
98
|
|
|
58
99
|
return audioPlayer;
|
|
@@ -14,6 +14,12 @@ const selector = ({ notifications }: InAppNotificationsState) => ({
|
|
|
14
14
|
notifications,
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Prefer the client-backed notification APIs exported from
|
|
19
|
+
* `components/Notifications` (`useNotificationApi`, `useNotifications`, and
|
|
20
|
+
* `NotificationList`). This hook is kept for apps that already render their own
|
|
21
|
+
* legacy in-app notification store.
|
|
22
|
+
*/
|
|
17
23
|
export const useInAppNotificationsState = () => {
|
|
18
24
|
const { notifications } = useStateStore(inAppNotificationsStore, selector);
|
|
19
25
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type RefObject, useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates a stable ref whose initial value is computed only once.
|
|
5
|
+
* Use this when the initial ref value is expensive or allocates an object.
|
|
6
|
+
*/
|
|
7
|
+
export const useLazyRef = <T>(getInitialValue: () => T) => {
|
|
8
|
+
const ref = useRef<T | null>(null);
|
|
9
|
+
|
|
10
|
+
if (ref.current === null) {
|
|
11
|
+
ref.current = getInitialValue();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return ref as RefObject<T>;
|
|
15
|
+
};
|