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
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports.useNotificationApi = exports.hasSystemNotificationTag = exports.SYSTEM_NOTIFICATION_TAG = void 0;
|
|
6
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
7
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _ChatContext = require("../../../contexts/chatContext/ChatContext");
|
|
10
|
+
var _notificationTarget = require("../notificationTarget");
|
|
11
|
+
var _NotificationTargetContext = require("../NotificationTargetContext");
|
|
12
|
+
var SYSTEM_NOTIFICATION_TAG = exports.SYSTEM_NOTIFICATION_TAG = 'system';
|
|
13
|
+
var hasSystemNotificationTag = exports.hasSystemNotificationTag = function hasSystemNotificationTag(notification) {
|
|
14
|
+
var _notification$tags$in, _notification$tags;
|
|
15
|
+
return (_notification$tags$in = (_notification$tags = notification.tags) == null ? void 0 : _notification$tags.includes(SYSTEM_NOTIFICATION_TAG)) != null ? _notification$tags$in : false;
|
|
16
|
+
};
|
|
17
|
+
var getTargetTags = function getTargetTags(target, targetPanels, tags) {
|
|
18
|
+
if (targetPanels) {
|
|
19
|
+
return Array.from(new Set([].concat((0, _toConsumableArray2.default)(targetPanels.map(function (panel) {
|
|
20
|
+
return (0, _notificationTarget.getNotificationTargetTag)(panel);
|
|
21
|
+
})), (0, _toConsumableArray2.default)(tags != null ? tags : []))));
|
|
22
|
+
}
|
|
23
|
+
if (target) {
|
|
24
|
+
return (0, _notificationTarget.addExactNotificationTargetTag)(target, tags);
|
|
25
|
+
}
|
|
26
|
+
return tags != null ? tags : [];
|
|
27
|
+
};
|
|
28
|
+
var getTypeFromIncident = function getTypeFromIncident(_ref) {
|
|
29
|
+
var _incident$status;
|
|
30
|
+
var incident = _ref.incident,
|
|
31
|
+
severity = _ref.severity,
|
|
32
|
+
type = _ref.type;
|
|
33
|
+
if (type) return type;
|
|
34
|
+
if (!incident) return undefined;
|
|
35
|
+
var status = (_incident$status = incident.status) != null ? _incident$status : severity === 'error' ? 'failed' : severity === 'success' ? 'success' : severity;
|
|
36
|
+
return [incident.domain, incident.entity, incident.operation, status].filter(function (segment) {
|
|
37
|
+
return !!segment;
|
|
38
|
+
}).join(':');
|
|
39
|
+
};
|
|
40
|
+
var mergeNotificationOptions = function mergeNotificationOptions(payload, options) {
|
|
41
|
+
var mergedOptions = Object.assign({}, payload.options, options);
|
|
42
|
+
if (!payload.options && Object.keys(mergedOptions).length === 0) {
|
|
43
|
+
return payload;
|
|
44
|
+
}
|
|
45
|
+
return Object.assign({}, payload, {
|
|
46
|
+
options: mergedOptions
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
var useNotificationApi = exports.useNotificationApi = function useNotificationApi() {
|
|
50
|
+
var _useChatContext = (0, _ChatContext.useChatContext)(),
|
|
51
|
+
client = _useChatContext.client;
|
|
52
|
+
var contextTarget = (0, _NotificationTargetContext.useNotificationTargetContext)();
|
|
53
|
+
var notificationManager = client == null ? void 0 : client.notifications;
|
|
54
|
+
var addNotification = (0, _react.useCallback)(function (payload, options) {
|
|
55
|
+
var _options$target, _payload$options, _payload$options2, _payload$options3, _payload$options4;
|
|
56
|
+
if (!notificationManager) return;
|
|
57
|
+
var target = (_options$target = options == null ? void 0 : options.target) != null ? _options$target : options != null && options.targetPanels || (0, _notificationTarget.hasNotificationTargetTag)((_payload$options = payload.options) == null ? void 0 : _payload$options.tags) ? undefined : contextTarget;
|
|
58
|
+
var notificationTags = getTargetTags(target, options == null ? void 0 : options.targetPanels, (_payload$options2 = payload.options) == null ? void 0 : _payload$options2.tags);
|
|
59
|
+
var resolvedType = getTypeFromIncident({
|
|
60
|
+
incident: options == null ? void 0 : options.incident,
|
|
61
|
+
severity: (_payload$options3 = payload.options) == null ? void 0 : _payload$options3.severity,
|
|
62
|
+
type: (_payload$options4 = payload.options) == null ? void 0 : _payload$options4.type
|
|
63
|
+
});
|
|
64
|
+
notificationManager.add(mergeNotificationOptions(payload, Object.assign({}, notificationTags.length > 0 ? {
|
|
65
|
+
tags: notificationTags
|
|
66
|
+
} : {}, resolvedType ? {
|
|
67
|
+
type: resolvedType
|
|
68
|
+
} : {})));
|
|
69
|
+
}, [contextTarget, notificationManager]);
|
|
70
|
+
var addSystemNotification = (0, _react.useCallback)(function (payload, options) {
|
|
71
|
+
var _payload$options$tags, _payload$options5, _payload$options6, _payload$options7;
|
|
72
|
+
if (!notificationManager) return '';
|
|
73
|
+
var notificationTags = Array.from(new Set([SYSTEM_NOTIFICATION_TAG].concat((0, _toConsumableArray2.default)((_payload$options$tags = (_payload$options5 = payload.options) == null ? void 0 : _payload$options5.tags) != null ? _payload$options$tags : []))));
|
|
74
|
+
var resolvedType = getTypeFromIncident({
|
|
75
|
+
incident: options == null ? void 0 : options.incident,
|
|
76
|
+
severity: (_payload$options6 = payload.options) == null ? void 0 : _payload$options6.severity,
|
|
77
|
+
type: (_payload$options7 = payload.options) == null ? void 0 : _payload$options7.type
|
|
78
|
+
});
|
|
79
|
+
return notificationManager.add(mergeNotificationOptions(payload, Object.assign({}, notificationTags.length > 0 ? {
|
|
80
|
+
tags: notificationTags
|
|
81
|
+
} : {}, resolvedType ? {
|
|
82
|
+
type: resolvedType
|
|
83
|
+
} : {})));
|
|
84
|
+
}, [notificationManager]);
|
|
85
|
+
var removeNotification = (0, _react.useCallback)(function (id) {
|
|
86
|
+
if (!notificationManager) return;
|
|
87
|
+
notificationManager.remove(id);
|
|
88
|
+
}, [notificationManager]);
|
|
89
|
+
var removeNotificationsForCurrentPanel = (0, _react.useCallback)(function () {
|
|
90
|
+
if (!contextTarget || !notificationManager) return;
|
|
91
|
+
var notificationIds = notificationManager.notifications.filter(function (notification) {
|
|
92
|
+
return !hasSystemNotificationTag(notification) && (0, _notificationTarget.isNotificationForTarget)(notification, contextTarget);
|
|
93
|
+
}).map(function (_ref2) {
|
|
94
|
+
var id = _ref2.id;
|
|
95
|
+
return id;
|
|
96
|
+
});
|
|
97
|
+
notificationIds.forEach(removeNotification);
|
|
98
|
+
}, [contextTarget, notificationManager, removeNotification]);
|
|
99
|
+
var runWithNotificationTarget = (0, _react.useCallback)(function () {
|
|
100
|
+
var _ref3 = (0, _asyncToGenerator2.default)(function* (callback) {
|
|
101
|
+
var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : contextTarget;
|
|
102
|
+
if (!target || !notificationManager) {
|
|
103
|
+
return yield callback();
|
|
104
|
+
}
|
|
105
|
+
var unregisterActionTarget = (0, _notificationTarget.registerNotificationActionTarget)(notificationManager, target);
|
|
106
|
+
try {
|
|
107
|
+
return yield callback();
|
|
108
|
+
} finally {
|
|
109
|
+
unregisterActionTarget();
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
return function (_x) {
|
|
113
|
+
return _ref3.apply(this, arguments);
|
|
114
|
+
};
|
|
115
|
+
}(), [contextTarget, notificationManager]);
|
|
116
|
+
var startNotificationTimeout = (0, _react.useCallback)(function (id, durationOverride) {
|
|
117
|
+
if (!notificationManager) return;
|
|
118
|
+
if (typeof durationOverride === 'number') {
|
|
119
|
+
notificationManager.startTimeout(id, durationOverride);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
notificationManager.startTimeout(id);
|
|
123
|
+
}, [notificationManager]);
|
|
124
|
+
return {
|
|
125
|
+
addNotification: addNotification,
|
|
126
|
+
addSystemNotification: addSystemNotification,
|
|
127
|
+
removeNotification: removeNotification,
|
|
128
|
+
removeNotificationsForCurrentPanel: removeNotificationsForCurrentPanel,
|
|
129
|
+
runWithNotificationTarget: runWithNotificationTarget,
|
|
130
|
+
startNotificationTimeout: startNotificationTimeout
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
//# sourceMappingURL=useNotificationApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_ChatContext","_notificationTarget","_NotificationTargetContext","SYSTEM_NOTIFICATION_TAG","exports","hasSystemNotificationTag","notification","_notification$tags$in","_notification$tags","tags","includes","getTargetTags","target","targetPanels","Array","from","Set","concat","_toConsumableArray2","default","map","panel","getNotificationTargetTag","addExactNotificationTargetTag","getTypeFromIncident","_ref","_incident$status","incident","severity","type","undefined","status","domain","entity","operation","filter","segment","join","mergeNotificationOptions","payload","options","mergedOptions","Object","assign","keys","length","useNotificationApi","_useChatContext","useChatContext","client","contextTarget","useNotificationTargetContext","notificationManager","notifications","addNotification","useCallback","_options$target","_payload$options","_payload$options2","_payload$options3","_payload$options4","hasNotificationTargetTag","notificationTags","resolvedType","add","addSystemNotification","_payload$options$tags","_payload$options5","_payload$options6","_payload$options7","removeNotification","id","remove","removeNotificationsForCurrentPanel","notificationIds","isNotificationForTarget","_ref2","forEach","runWithNotificationTarget","_ref3","_asyncToGenerator2","callback","arguments","unregisterActionTarget","registerNotificationActionTarget","_x","apply","startNotificationTimeout","durationOverride","startTimeout"],"sourceRoot":"../../../../../src","sources":["components/Notifications/hooks/useNotificationApi.ts"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AASA,IAAAG,0BAAA,GAAAH,OAAA;AAEO,IAAMI,uBAAuB,GAA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EApC,mBAAmB,CAACqC,YAAY,CAAClB,EAAE,CAAC;EACtC,CAAC,EACD,CAACnB,mBAAmB,CACtB,CAAC;EAED,OAAO;IACLE,eAAe,EAAfA,eAAe;IACfW,qBAAqB,EAArBA,qBAAqB;IACrBK,kBAAkB,EAAlBA,kBAAkB;IAClBG,kCAAkC,EAAlCA,kCAAkC;IAClCK,yBAAyB,EAAzBA,yBAAyB;IACzBS,wBAAwB,EAAxBA;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.useNotificationListController = void 0;
|
|
5
|
+
var _react = require("react");
|
|
6
|
+
var _useNotificationApi2 = require("./useNotificationApi");
|
|
7
|
+
var _useNotifications = require("./useNotifications");
|
|
8
|
+
var _ChatContext = require("../../../contexts/chatContext/ChatContext");
|
|
9
|
+
var _useLazyRef = require("../../../hooks/useLazyRef");
|
|
10
|
+
var _useStableCallback = require("../../../hooks/useStableCallback");
|
|
11
|
+
var _notificationTarget = require("../notificationTarget");
|
|
12
|
+
var _NotificationTargetContext = require("../NotificationTargetContext");
|
|
13
|
+
var ACTION_NOTIFICATION_DURATION = 5000;
|
|
14
|
+
var getNewestNotification = function getNewestNotification(notifications) {
|
|
15
|
+
return notifications.reduce(function (newest, notification) {
|
|
16
|
+
return !newest || notification.createdAt >= newest.createdAt ? notification : newest;
|
|
17
|
+
}, null);
|
|
18
|
+
};
|
|
19
|
+
var isPersistentNotification = function isPersistentNotification(notification) {
|
|
20
|
+
return !notification.duration;
|
|
21
|
+
};
|
|
22
|
+
var getActiveNotification = function getActiveNotification(notifications) {
|
|
23
|
+
var persistentNotifications = notifications.filter(isPersistentNotification);
|
|
24
|
+
return getNewestNotification(persistentNotifications.length > 0 ? persistentNotifications : notifications);
|
|
25
|
+
};
|
|
26
|
+
var getNotificationDurationOverride = function getNotificationDurationOverride(notification) {
|
|
27
|
+
var _notification$actions, _notification$duratio;
|
|
28
|
+
if (isPersistentNotification(notification)) return undefined;
|
|
29
|
+
if (!((_notification$actions = notification.actions) != null && _notification$actions.length)) return undefined;
|
|
30
|
+
return Math.max((_notification$duratio = notification.duration) != null ? _notification$duratio : 0, ACTION_NOTIFICATION_DURATION);
|
|
31
|
+
};
|
|
32
|
+
var useNotificationListController = exports.useNotificationListController = function useNotificationListController() {
|
|
33
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
34
|
+
filter = _ref.filter,
|
|
35
|
+
hostId = _ref.hostId,
|
|
36
|
+
panel = _ref.panel;
|
|
37
|
+
var _useChatContext = (0, _ChatContext.useChatContext)(),
|
|
38
|
+
client = _useChatContext.client;
|
|
39
|
+
var _useNotificationApi = (0, _useNotificationApi2.useNotificationApi)(),
|
|
40
|
+
removeNotification = _useNotificationApi.removeNotification,
|
|
41
|
+
startNotificationTimeout = _useNotificationApi.startNotificationTimeout;
|
|
42
|
+
var target = (0, _NotificationTargetContext.useResolvedNotificationTarget)({
|
|
43
|
+
hostId: hostId,
|
|
44
|
+
panel: panel
|
|
45
|
+
});
|
|
46
|
+
var startedTimeoutIdsRef = (0, _useLazyRef.useLazyRef)(function () {
|
|
47
|
+
return new Set();
|
|
48
|
+
});
|
|
49
|
+
var combinedFilter = (0, _useStableCallback.useStableCallback)(function (notification) {
|
|
50
|
+
if ((0, _useNotificationApi2.hasSystemNotificationTag)(notification)) return false;
|
|
51
|
+
return filter ? filter(notification) : true;
|
|
52
|
+
});
|
|
53
|
+
var notifications = (0, _useNotifications.useNotifications)({
|
|
54
|
+
filter: combinedFilter,
|
|
55
|
+
requireTarget: true,
|
|
56
|
+
target: target
|
|
57
|
+
});
|
|
58
|
+
var notification = getActiveNotification(notifications);
|
|
59
|
+
var dismissNotification = (0, _useStableCallback.useStableCallback)(function () {
|
|
60
|
+
if (!notification) return;
|
|
61
|
+
startedTimeoutIdsRef.current.delete(notification.id);
|
|
62
|
+
removeNotification(notification.id);
|
|
63
|
+
});
|
|
64
|
+
var removeCurrentPanelNotifications = (0, _useStableCallback.useStableCallback)(function () {
|
|
65
|
+
if (!target) return;
|
|
66
|
+
startedTimeoutIdsRef.current.clear();
|
|
67
|
+
client.notifications.notifications.filter(function (notification) {
|
|
68
|
+
return !(0, _useNotificationApi2.hasSystemNotificationTag)(notification) && (0, _notificationTarget.isNotificationForTarget)(notification, target);
|
|
69
|
+
}).forEach(function (_ref2) {
|
|
70
|
+
var id = _ref2.id;
|
|
71
|
+
return removeNotification(id);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
(0, _react.useEffect)(function () {
|
|
75
|
+
return client.notifications.store.addPreprocessor(function (nextState, previousState) {
|
|
76
|
+
var _previousState$notifi;
|
|
77
|
+
var previousNotificationIds = new Set((_previousState$notifi = previousState == null ? void 0 : previousState.notifications.map(function (_ref3) {
|
|
78
|
+
var id = _ref3.id;
|
|
79
|
+
return id;
|
|
80
|
+
})) != null ? _previousState$notifi : []);
|
|
81
|
+
nextState.notifications.forEach(function (notification) {
|
|
82
|
+
if (previousNotificationIds.has(notification.id)) return;
|
|
83
|
+
if ((0, _useNotificationApi2.hasSystemNotificationTag)(notification)) return;
|
|
84
|
+
(0, _notificationTarget.resolveNotificationTargetTagIfNeeded)(client.notifications, notification);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}, [client.notifications]);
|
|
88
|
+
(0, _react.useEffect)(function () {
|
|
89
|
+
if (!target) return;
|
|
90
|
+
return (0, _notificationTarget.registerActiveNotificationTarget)(client.notifications, target);
|
|
91
|
+
}, [client.notifications, target]);
|
|
92
|
+
(0, _react.useEffect)(function () {
|
|
93
|
+
var notificationIds = new Set(notifications.map(function (_ref4) {
|
|
94
|
+
var id = _ref4.id;
|
|
95
|
+
return id;
|
|
96
|
+
}));
|
|
97
|
+
startedTimeoutIdsRef.current.forEach(function (id) {
|
|
98
|
+
if (!notificationIds.has(id)) {
|
|
99
|
+
startedTimeoutIdsRef.current.delete(id);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}, [notifications, startedTimeoutIdsRef]);
|
|
103
|
+
(0, _react.useEffect)(function () {
|
|
104
|
+
if (!notification || notifications.length <= 1) return;
|
|
105
|
+
notifications.forEach(function (_ref5) {
|
|
106
|
+
var id = _ref5.id;
|
|
107
|
+
if (id === notification.id) return;
|
|
108
|
+
startedTimeoutIdsRef.current.delete(id);
|
|
109
|
+
removeNotification(id);
|
|
110
|
+
});
|
|
111
|
+
}, [notification, notifications, removeNotification, startedTimeoutIdsRef]);
|
|
112
|
+
(0, _react.useEffect)(function () {
|
|
113
|
+
if (!notification) return;
|
|
114
|
+
if (startedTimeoutIdsRef.current.has(notification.id)) return;
|
|
115
|
+
startedTimeoutIdsRef.current.add(notification.id);
|
|
116
|
+
var durationOverride = getNotificationDurationOverride(notification);
|
|
117
|
+
if (typeof durationOverride === 'number') {
|
|
118
|
+
startNotificationTimeout(notification.id, durationOverride);
|
|
119
|
+
} else {
|
|
120
|
+
startNotificationTimeout(notification.id);
|
|
121
|
+
}
|
|
122
|
+
}, [notification, startNotificationTimeout, startedTimeoutIdsRef]);
|
|
123
|
+
(0, _react.useEffect)(function () {
|
|
124
|
+
return function () {
|
|
125
|
+
removeCurrentPanelNotifications();
|
|
126
|
+
};
|
|
127
|
+
}, [removeCurrentPanelNotifications]);
|
|
128
|
+
return {
|
|
129
|
+
dismissNotification: dismissNotification,
|
|
130
|
+
notification: notification
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
//# sourceMappingURL=useNotificationListController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_useNotificationApi2","_useNotifications","_ChatContext","_useLazyRef","_useStableCallback","_notificationTarget","_NotificationTargetContext","ACTION_NOTIFICATION_DURATION","getNewestNotification","notifications","reduce","newest","notification","createdAt","isPersistentNotification","duration","getActiveNotification","persistentNotifications","filter","length","getNotificationDurationOverride","_notification$actions","_notification$duratio","undefined","actions","Math","max","useNotificationListController","exports","_ref","arguments","hostId","panel","_useChatContext","useChatContext","client","_useNotificationApi","useNotificationApi","removeNotification","startNotificationTimeout","target","useResolvedNotificationTarget","startedTimeoutIdsRef","useLazyRef","Set","combinedFilter","useStableCallback","hasSystemNotificationTag","useNotifications","requireTarget","dismissNotification","current","delete","id","removeCurrentPanelNotifications","clear","isNotificationForTarget","forEach","_ref2","useEffect","store","addPreprocessor","nextState","previousState","_previousState$notifi","previousNotificationIds","map","_ref3","has","resolveNotificationTargetTagIfNeeded","registerActiveNotificationTarget","notificationIds","_ref4","_ref5","add","durationOverride"],"sourceRoot":"../../../../../src","sources":["components/Notifications/hooks/useNotificationListController.ts"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,oBAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAEA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,kBAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AAMA,IAAAO,0BAAA,GAAAP,OAAA;AAaA,IAAMQ,4BAA4B,GAAG,IAAI;AAEzC,IAAMC,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAIC,aAAiC;EAAA,OAC9DA,aAAa,CAACC,MAAM,CAClB,UAACC,MAAM,EAAEC,YAAY;IAAA,OACnB,CAACD,MAAM,IAAIC,YAAY,CAACC,SAAS,IAAIF,MAAM,CAACE,SAAS,GAAGD,YAAY,GAAGD,MAAM;EAAA,GAC/E,IACF,CAAC;AAAA;AAEH,IAAMG,wBAAwB,GAAG,SAA3BA,wBAAwBA,CAAIF,YAA8B;EAAA,OAAK,CAACA,YAAY,CAACG,QAAQ;AAAA;AAE3F,IAAMC,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAIP,aAAiC,EAAK;EACnE,IAAMQ,uBAAuB,GAAGR,aAAa,CAACS,MAAM,CAAC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AAC;IACnC,CAAC;EACH,CAAC,EAAE,CAACA,+BAA+B,CAAC,CAAC;EAErC,OAAO;IACLJ,mBAAmB,EAAnBA,mBAAmB;IACnBtC,YAAY,EAAZA;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.useNotificationTarget = void 0;
|
|
5
|
+
var _react = require("react");
|
|
6
|
+
var _ChannelContext = require("../../../contexts/channelContext/ChannelContext");
|
|
7
|
+
var _ChannelsContext = require("../../../contexts/channelsContext/ChannelsContext");
|
|
8
|
+
var _ThreadContext = require("../../../contexts/threadContext/ThreadContext");
|
|
9
|
+
var _ThreadsContext = require("../../../contexts/threadsContext/ThreadsContext");
|
|
10
|
+
var _defaultBaseContextValue = require("../../../contexts/utils/defaultBaseContextValue");
|
|
11
|
+
var isProvided = function isProvided(value) {
|
|
12
|
+
return value !== _defaultBaseContextValue.DEFAULT_BASE_CONTEXT_VALUE;
|
|
13
|
+
};
|
|
14
|
+
var useNotificationTarget = exports.useNotificationTarget = function useNotificationTarget() {
|
|
15
|
+
var channelContext = (0, _react.useContext)(_ChannelContext.ChannelContext);
|
|
16
|
+
var channelsContext = (0, _react.useContext)(_ChannelsContext.ChannelsContext);
|
|
17
|
+
var threadContext = (0, _react.useContext)(_ThreadContext.ThreadContext);
|
|
18
|
+
var threadsContext = (0, _react.useContext)(_ThreadsContext.ThreadsContext);
|
|
19
|
+
if (isProvided(channelContext) && channelContext.threadList) return 'thread';
|
|
20
|
+
if (isProvided(threadContext) && threadContext.threadInstance) return 'thread';
|
|
21
|
+
if (isProvided(channelContext) && channelContext.channel) return 'channel';
|
|
22
|
+
if (isProvided(threadsContext)) return 'thread-list';
|
|
23
|
+
if (isProvided(channelsContext)) return 'channel-list';
|
|
24
|
+
return undefined;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=useNotificationTarget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_ChannelContext","_ChannelsContext","_ThreadContext","_ThreadsContext","_defaultBaseContextValue","isProvided","value","DEFAULT_BASE_CONTEXT_VALUE","useNotificationTarget","exports","channelContext","useContext","ChannelContext","channelsContext","ChannelsContext","threadContext","ThreadContext","threadsContext","ThreadsContext","threadList","threadInstance","channel","undefined"],"sourceRoot":"../../../../../src","sources":["components/Notifications/hooks/useNotificationTarget.ts"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AAIA,IAAAE,gBAAA,GAAAF,OAAA;AAIA,IAAAG,cAAA,GAAAH,OAAA;AAIA,IAAAI,eAAA,GAAAJ,OAAA;AAIA,IAAAK,wBAAA,GAAAL,OAAA;AAGA,IAAMM,UAAU,GAAG,SAAbA,UAAUA,CAAOC,KAAQ;EAAA,OAAKA,KAAK,KAAMC,mDAAgC;AAAA;AAExE,IAAMC,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,GAAG,SAAxBA,qBAAqBA,CAAA,EAA8C;EAC9E,IAAME,cAAc,GAAG,IAAAC,iBAAU,EAACC,8BAAc,CAAwB;EACxE,IAAMC,eAAe,GAAG,IAAAF,iBAAU,EAACG,gCAAe,CAAyB;EAC3E,IAAMC,aAAa,GAAG,IAAAJ,iBAAU,EAACK,4BAAa,CAAuB;EACrE,IAAMC,cAAc,GAAG,IAAAN,iBAAU,EAACO,8BAAc,CAAwB;EAExE,IAAIb,UAAU,CAACK,cAAc,CAAC,IAAIA,cAAc,CAACS,UAAU,EAAE,OAAO,QAAQ;EAC5E,IAAId,UAAU,CAACU,aAAa,CAAC,IAAIA,aAAa,CAACK,cAAc,EAAE,OAAO,QAAQ;EAC9E,IAAIf,UAAU,CAACK,cAAc,CAAC,IAAIA,cAAc,CAACW,OAAO,EAAE,OAAO,SAAS;EAC1E,IAAIhB,UAAU,CAACY,cAAc,CAAC,EAAE,OAAO,aAAa;EACpD,IAAIZ,UAAU,CAACQ,eAAe,CAAC,EAAE,OAAO,cAAc;EAEtD,OAAOS,SAAS;AAClB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.useNotifications = void 0;
|
|
5
|
+
var _react = require("react");
|
|
6
|
+
var _ChatContext = require("../../../contexts/chatContext/ChatContext");
|
|
7
|
+
var _useStateStore2 = require("../../../hooks/useStateStore");
|
|
8
|
+
var _notificationTarget = require("../notificationTarget");
|
|
9
|
+
var useNotifications = exports.useNotifications = function useNotifications(options) {
|
|
10
|
+
var _useChatContext = (0, _ChatContext.useChatContext)(),
|
|
11
|
+
client = _useChatContext.client;
|
|
12
|
+
var selector = (0, _react.useCallback)(function (state) {
|
|
13
|
+
var notifications = state.notifications;
|
|
14
|
+
var target = options == null ? void 0 : options.target;
|
|
15
|
+
var byTarget = target ? notifications.filter(function (notification) {
|
|
16
|
+
return (0, _notificationTarget.isNotificationForTarget)(notification, target);
|
|
17
|
+
}) : options != null && options.requireTarget ? [] : notifications;
|
|
18
|
+
return {
|
|
19
|
+
notifications: options != null && options.filter ? byTarget.filter(options.filter) : byTarget
|
|
20
|
+
};
|
|
21
|
+
}, [options == null ? void 0 : options.filter, options == null ? void 0 : options.requireTarget, options == null ? void 0 : options.target]);
|
|
22
|
+
var _useStateStore = (0, _useStateStore2.useStateStore)(client.notifications.store, selector),
|
|
23
|
+
notifications = _useStateStore.notifications;
|
|
24
|
+
return notifications;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=useNotifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_ChatContext","_useStateStore2","_notificationTarget","useNotifications","exports","options","_useChatContext","useChatContext","client","selector","useCallback","state","notifications","target","byTarget","filter","notification","isNotificationForTarget","requireTarget","_useStateStore","useStateStore","store"],"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}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.useSystemNotifications = void 0;
|
|
5
|
+
var _react = require("react");
|
|
6
|
+
var _useNotificationApi = require("./useNotificationApi");
|
|
7
|
+
var _ChatContext = require("../../../contexts/chatContext/ChatContext");
|
|
8
|
+
var _useStateStore2 = require("../../../hooks/useStateStore");
|
|
9
|
+
var useSystemNotifications = exports.useSystemNotifications = function useSystemNotifications(options) {
|
|
10
|
+
var _useChatContext = (0, _ChatContext.useChatContext)(),
|
|
11
|
+
client = _useChatContext.client;
|
|
12
|
+
var selector = (0, _react.useCallback)(function (state) {
|
|
13
|
+
var withSystemTag = state.notifications.filter(_useNotificationApi.hasSystemNotificationTag);
|
|
14
|
+
return {
|
|
15
|
+
notifications: options != null && options.filter ? withSystemTag.filter(options.filter) : withSystemTag
|
|
16
|
+
};
|
|
17
|
+
}, [options == null ? void 0 : options.filter]);
|
|
18
|
+
var _useStateStore = (0, _useStateStore2.useStateStore)(client.notifications.store, selector),
|
|
19
|
+
notifications = _useStateStore.notifications;
|
|
20
|
+
return notifications;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=useSystemNotifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_useNotificationApi","_ChatContext","_useStateStore2","useSystemNotifications","exports","options","_useChatContext","useChatContext","client","selector","useCallback","state","withSystemTag","notifications","filter","hasSystemNotificationTag","_useStateStore","useStateStore","store"],"sourceRoot":"../../../../../src","sources":["components/Notifications/hooks/useSystemNotifications.ts"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,mBAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAUO,IAAMI,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,SAAzBA,sBAAsBA,CAAIE,OAAuC,EAAqB;EACjG,IAAAC,eAAA,GAAmB,IAAAC,2BAAc,EAAC,CAAC;IAA3BC,MAAM,GAAAF,eAAA,CAANE,MAAM;EACd,IAAMC,QAAQ,GAAG,IAAAC,kBAAW,EAC1B,UAACC,KAA+B,EAAK;IACnC,IAAMC,aAAa,GAAGD,KAAK,CAACE,aAAa,CAACC,MAAM,CAACC,4CAAwB,CAAC;IAC1E,OAAO;MACLF,aAAa,EAAER,OAAO,YAAPA,OAAO,CAAES,MAAM,GAAGF,aAAa,CAACE,MAAM,CAACT,OAAO,CAACS,MAAM,CAAC,GAAGF;IAC1E,CAAC;EACH,CAAC,EACD,CAACP,OAAO,oBAAPA,OAAO,CAAES,MAAM,CAClB,CAAC;EAED,IAAAE,cAAA,GAA0B,IAAAC,6BAAa,EAACT,MAAM,CAACK,aAAa,CAACK,KAAK,EAAET,QAAQ,CAAC;IAArEI,aAAa,GAAAG,cAAA,CAAbH,aAAa;EAErB,OAAOA,aAAa;AACtB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
var _Notification = require("./Notification");
|
|
5
|
+
Object.keys(_Notification).forEach(function (key) {
|
|
6
|
+
if (key === "default" || key === "__esModule") return;
|
|
7
|
+
if (key in exports && exports[key] === _Notification[key]) return;
|
|
8
|
+
Object.defineProperty(exports, key, {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _Notification[key];
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
var _NotificationList = require("./NotificationList");
|
|
16
|
+
Object.keys(_NotificationList).forEach(function (key) {
|
|
17
|
+
if (key === "default" || key === "__esModule") return;
|
|
18
|
+
if (key in exports && exports[key] === _NotificationList[key]) return;
|
|
19
|
+
Object.defineProperty(exports, key, {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function get() {
|
|
22
|
+
return _NotificationList[key];
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
var _NotificationTargetContext = require("./NotificationTargetContext");
|
|
27
|
+
Object.keys(_NotificationTargetContext).forEach(function (key) {
|
|
28
|
+
if (key === "default" || key === "__esModule") return;
|
|
29
|
+
if (key in exports && exports[key] === _NotificationTargetContext[key]) return;
|
|
30
|
+
Object.defineProperty(exports, key, {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _NotificationTargetContext[key];
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
var _hooks = require("./hooks");
|
|
38
|
+
Object.keys(_hooks).forEach(function (key) {
|
|
39
|
+
if (key === "default" || key === "__esModule") return;
|
|
40
|
+
if (key in exports && exports[key] === _hooks[key]) return;
|
|
41
|
+
Object.defineProperty(exports, key, {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function get() {
|
|
44
|
+
return _hooks[key];
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
var _notificationTarget = require("./notificationTarget");
|
|
49
|
+
Object.keys(_notificationTarget).forEach(function (key) {
|
|
50
|
+
if (key === "default" || key === "__esModule") return;
|
|
51
|
+
if (key in exports && exports[key] === _notificationTarget[key]) return;
|
|
52
|
+
Object.defineProperty(exports, key, {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function get() {
|
|
55
|
+
return _notificationTarget[key];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_Notification","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_NotificationList","_NotificationTargetContext","_hooks","_notificationTarget"],"sourceRoot":"../../../../src","sources":["components/Notifications/index.ts"],"mappings":";;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAAAC,M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