stream-chat-react-native-core 9.2.0-beta.2 → 9.2.0-beta.4
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/components/AttachmentPicker/components/AttachmentPickerContent.js +2 -2
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerContent.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/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/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 +27 -6
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecorder.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js +29 -9
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/OutputButtons/index.js +1 -1
- package/lib/commonjs/components/MessageList/MessageFlashList.js +5 -2
- package/lib/commonjs/components/MessageList/MessageFlashList.js.map +1 -1
- package/lib/commonjs/components/MessageList/MessageList.js +5 -2
- package/lib/commonjs/components/MessageList/MessageList.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 +230 -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/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/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/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 +60 -1
- package/lib/commonjs/i18n/es.json +62 -3
- package/lib/commonjs/i18n/fr.json +60 -1
- package/lib/commonjs/i18n/he.json +60 -1
- package/lib/commonjs/i18n/hi.json +60 -1
- package/lib/commonjs/i18n/it.json +60 -1
- package/lib/commonjs/i18n/ja.json +60 -1
- package/lib/commonjs/i18n/ko.json +60 -1
- package/lib/commonjs/i18n/nl.json +60 -1
- package/lib/commonjs/i18n/pt-br.json +60 -1
- package/lib/commonjs/i18n/ru.json +60 -1
- package/lib/commonjs/i18n/tr.json +60 -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/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/components/AttachmentPicker/components/AttachmentPickerContent.js +2 -2
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerContent.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/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/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 +27 -6
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecorder.js.map +1 -1
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js +29 -9
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js.map +1 -1
- package/lib/module/components/MessageInput/components/OutputButtons/index.js +1 -1
- package/lib/module/components/MessageList/MessageFlashList.js +5 -2
- package/lib/module/components/MessageList/MessageFlashList.js.map +1 -1
- package/lib/module/components/MessageList/MessageList.js +5 -2
- package/lib/module/components/MessageList/MessageList.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 +230 -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/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/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/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 +60 -1
- package/lib/module/i18n/es.json +62 -3
- package/lib/module/i18n/fr.json +60 -1
- package/lib/module/i18n/he.json +60 -1
- package/lib/module/i18n/hi.json +60 -1
- package/lib/module/i18n/it.json +60 -1
- package/lib/module/i18n/ja.json +60 -1
- package/lib/module/i18n/ko.json +60 -1
- package/lib/module/i18n/nl.json +60 -1
- package/lib/module/i18n/pt-br.json +60 -1
- package/lib/module/i18n/ru.json +60 -1
- package/lib/module/i18n/tr.json +60 -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/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/components/AttachmentPicker/components/AttachmentPickerContent.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/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/MessageList/MessageFlashList.d.ts.map +1 -1
- package/lib/typescript/components/MessageList/MessageList.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/PollOption.d.ts.map +1 -1
- package/lib/typescript/components/Poll/hooks/usePollState.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/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 +60 -1
- package/lib/typescript/i18n/es.json +62 -3
- package/lib/typescript/i18n/fr.json +60 -1
- package/lib/typescript/i18n/he.json +60 -1
- package/lib/typescript/i18n/hi.json +60 -1
- package/lib/typescript/i18n/it.json +60 -1
- package/lib/typescript/i18n/ja.json +60 -1
- package/lib/typescript/i18n/ko.json +60 -1
- package/lib/typescript/i18n/nl.json +60 -1
- package/lib/typescript/i18n/pt-br.json +60 -1
- package/lib/typescript/i18n/ru.json +60 -1
- package/lib/typescript/i18n/tr.json +60 -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/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 +59 -0
- package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/AttachmentPicker/components/AttachmentPickerContent.tsx +3 -3
- 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/hooks/__tests__/useChannelActions.test.tsx +123 -0
- package/src/components/ChannelList/hooks/useChannelActions.ts +181 -12
- 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/AttachmentUploadPreviewList.tsx +1 -10
- package/src/components/MessageInput/components/AudioRecorder/AudioRecorder.tsx +10 -2
- package/src/components/MessageInput/components/AudioRecorder/AudioRecordingButton.tsx +27 -13
- package/src/components/MessageInput/components/OutputButtons/index.tsx +1 -1
- package/src/components/MessageList/MessageFlashList.tsx +3 -1
- package/src/components/MessageList/MessageList.tsx +3 -1
- package/src/components/MessageList/__tests__/MessageList.test.tsx +35 -0
- package/src/components/MessageList/__tests__/__snapshots__/ScrollToBottomButton.test.tsx.snap +1 -1
- package/src/components/MessageMenu/hooks/useFetchReactions.ts +17 -2
- package/src/components/Notifications/Notification.tsx +253 -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/PollOption.tsx +10 -6
- package/src/components/Poll/hooks/usePollState.ts +26 -2
- package/src/components/Thread/Thread.tsx +24 -16
- package/src/components/ThreadList/ThreadList.tsx +33 -9
- package/src/components/index.ts +2 -0
- 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 +60 -1
- package/src/i18n/es.json +62 -3
- package/src/i18n/fr.json +60 -1
- package/src/i18n/he.json +60 -1
- package/src/i18n/hi.json +60 -1
- package/src/i18n/it.json +60 -1
- package/src/i18n/ja.json +60 -1
- package/src/i18n/ko.json +60 -1
- package/src/i18n/nl.json +60 -1
- package/src/i18n/pt-br.json +60 -1
- package/src/i18n/ru.json +60 -1
- package/src/i18n/tr.json +60 -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/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,120 @@
|
|
|
1
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports.NotificationList = void 0;
|
|
6
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _reactNativeReanimated = _interopRequireDefault(require("react-native-reanimated"));
|
|
9
|
+
var _useNotificationListController = require("./hooks/useNotificationListController");
|
|
10
|
+
var _ComponentsContext = require("../../contexts/componentsContext/ComponentsContext");
|
|
11
|
+
var _ThemeContext = require("../../contexts/themeContext/ThemeContext");
|
|
12
|
+
var _TranslationContext = require("../../contexts/translationContext/TranslationContext");
|
|
13
|
+
var _theme = require("../../theme");
|
|
14
|
+
var _transitions = require("../../utils/animations/transitions");
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
+
var _this = this,
|
|
17
|
+
_jsxFileName = "/home/runner/work/stream-chat-react-native/stream-chat-react-native/package/src/components/Notifications/NotificationList.tsx";
|
|
18
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
19
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
|
+
var isEnterFrom = function isEnterFrom(value) {
|
|
21
|
+
return value === 'bottom' || value === 'left' || value === 'right' || value === 'top';
|
|
22
|
+
};
|
|
23
|
+
var getNotificationEnterFrom = function getNotificationEnterFrom(notification, fallbackEnterFrom) {
|
|
24
|
+
var _notification$metadat, _notification$origin$;
|
|
25
|
+
var metadataEnterFrom = (_notification$metadat = notification.metadata) == null ? void 0 : _notification$metadat.entryDirection;
|
|
26
|
+
if (isEnterFrom(metadataEnterFrom)) return metadataEnterFrom;
|
|
27
|
+
var originEnterFrom = (_notification$origin$ = notification.origin.context) == null ? void 0 : _notification$origin$.entryDirection;
|
|
28
|
+
if (isEnterFrom(originEnterFrom)) return originEnterFrom;
|
|
29
|
+
return fallbackEnterFrom;
|
|
30
|
+
};
|
|
31
|
+
var getStringValue = function getStringValue(value) {
|
|
32
|
+
return typeof value === 'string' ? value : undefined;
|
|
33
|
+
};
|
|
34
|
+
var getNotificationPresentationKey = function getNotificationPresentationKey(notification) {
|
|
35
|
+
var _ref, _ref2, _notification$type, _notification$metadat2, _notification$origin$2;
|
|
36
|
+
return (_ref = (_ref2 = (_notification$type = notification.type) != null ? _notification$type : getStringValue((_notification$metadat2 = notification.metadata) == null ? void 0 : _notification$metadat2.dedupeKey)) != null ? _ref2 : getStringValue((_notification$origin$2 = notification.origin.context) == null ? void 0 : _notification$origin$2.dedupeKey)) != null ? _ref : [notification.origin.emitter, notification.severity, notification.message].filter(Boolean).join(':');
|
|
37
|
+
};
|
|
38
|
+
var NotificationList = exports.NotificationList = function NotificationList(_ref3) {
|
|
39
|
+
var bottomOffset = _ref3.bottomOffset,
|
|
40
|
+
_ref3$enterFrom = _ref3.enterFrom,
|
|
41
|
+
enterFrom = _ref3$enterFrom === void 0 ? 'bottom' : _ref3$enterFrom,
|
|
42
|
+
filter = _ref3.filter,
|
|
43
|
+
hostId = _ref3.hostId,
|
|
44
|
+
panel = _ref3.panel,
|
|
45
|
+
topOffset = _ref3.topOffset,
|
|
46
|
+
_ref3$verticalAlignme = _ref3.verticalAlignment,
|
|
47
|
+
verticalAlignment = _ref3$verticalAlignme === void 0 ? 'bottom' : _ref3$verticalAlignme;
|
|
48
|
+
var _useComponentsContext = (0, _ComponentsContext.useComponentsContext)(),
|
|
49
|
+
NotificationComponent = _useComponentsContext.Notification;
|
|
50
|
+
var styles = useStyles({
|
|
51
|
+
bottomOffset: bottomOffset,
|
|
52
|
+
topOffset: topOffset,
|
|
53
|
+
verticalAlignment: verticalAlignment
|
|
54
|
+
});
|
|
55
|
+
var _useTranslationContex = (0, _TranslationContext.useTranslationContext)(),
|
|
56
|
+
t = _useTranslationContex.t;
|
|
57
|
+
var _useNotificationListC = (0, _useNotificationListController.useNotificationListController)({
|
|
58
|
+
filter: filter,
|
|
59
|
+
hostId: hostId,
|
|
60
|
+
panel: panel
|
|
61
|
+
}),
|
|
62
|
+
dismissNotification = _useNotificationListC.dismissNotification,
|
|
63
|
+
notification = _useNotificationListC.notification;
|
|
64
|
+
if (!notification) return null;
|
|
65
|
+
var notificationEnterFrom = getNotificationEnterFrom(notification, enterFrom);
|
|
66
|
+
var notificationPresentationKey = getNotificationPresentationKey(notification);
|
|
67
|
+
return (0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
68
|
+
accessibilityLabel: t('a11y/Notifications'),
|
|
69
|
+
pointerEvents: "box-none",
|
|
70
|
+
layout: _transitions.transitions.layout200,
|
|
71
|
+
style: styles.container,
|
|
72
|
+
testID: "notification-list",
|
|
73
|
+
children: (0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
74
|
+
entering: _transitions.transitions.boundedZoomIn200[notificationEnterFrom],
|
|
75
|
+
exiting: _transitions.transitions.boundedZoomOut200[notificationEnterFrom],
|
|
76
|
+
style: styles.notificationWrapper,
|
|
77
|
+
testID: "notification-list-item",
|
|
78
|
+
children: (0, _jsxRuntime.jsx)(NotificationComponent, {
|
|
79
|
+
entryDirection: notificationEnterFrom,
|
|
80
|
+
notification: notification,
|
|
81
|
+
onDismiss: dismissNotification,
|
|
82
|
+
showClose: !notification.duration
|
|
83
|
+
})
|
|
84
|
+
}, notificationPresentationKey)
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
var useStyles = function useStyles(_ref4) {
|
|
88
|
+
var bottomOffset = _ref4.bottomOffset,
|
|
89
|
+
topOffset = _ref4.topOffset,
|
|
90
|
+
verticalAlignment = _ref4.verticalAlignment;
|
|
91
|
+
var _useTheme = (0, _ThemeContext.useTheme)(),
|
|
92
|
+
notificationListContainer = _useTheme.theme.notificationList.container;
|
|
93
|
+
return (0, _react.useMemo)(function () {
|
|
94
|
+
var containerAlignmentStyle = verticalAlignment === 'bottom' ? {
|
|
95
|
+
bottom: _theme.primitives.spacingMd
|
|
96
|
+
} : {
|
|
97
|
+
top: _theme.primitives.spacingMd
|
|
98
|
+
};
|
|
99
|
+
var containerOffsetStyle = verticalAlignment === 'bottom' && typeof bottomOffset === 'number' ? {
|
|
100
|
+
bottom: _theme.primitives.spacingMd + bottomOffset
|
|
101
|
+
} : verticalAlignment === 'top' && typeof topOffset === 'number' ? {
|
|
102
|
+
top: _theme.primitives.spacingMd + topOffset
|
|
103
|
+
} : undefined;
|
|
104
|
+
return _reactNative.StyleSheet.create({
|
|
105
|
+
container: Object.assign({
|
|
106
|
+
alignItems: 'center',
|
|
107
|
+
left: _theme.primitives.spacingMd,
|
|
108
|
+
maxHeight: '100%',
|
|
109
|
+
position: 'absolute',
|
|
110
|
+
right: _theme.primitives.spacingMd,
|
|
111
|
+
zIndex: 20
|
|
112
|
+
}, containerAlignmentStyle, notificationListContainer, containerOffsetStyle),
|
|
113
|
+
notificationWrapper: {
|
|
114
|
+
alignSelf: 'center',
|
|
115
|
+
maxWidth: '100%'
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}, [bottomOffset, notificationListContainer, topOffset, verticalAlignment]);
|
|
119
|
+
};
|
|
120
|
+
//# sourceMappingURL=NotificationList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_interopRequireDefault","_useNotificationListController","_ComponentsContext","_ThemeContext","_TranslationContext","_theme","_transitions","_jsxRuntime","_this","_jsxFileName","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","isEnterFrom","value","getNotificationEnterFrom","notification","fallbackEnterFrom","_notification$metadat","_notification$origin$","metadataEnterFrom","metadata","entryDirection","originEnterFrom","origin","context","getStringValue","undefined","getNotificationPresentationKey","_ref","_ref2","_notification$type","_notification$metadat2","_notification$origin$2","type","dedupeKey","emitter","severity","message","filter","Boolean","join","NotificationList","exports","_ref3","bottomOffset","_ref3$enterFrom","enterFrom","hostId","panel","topOffset","_ref3$verticalAlignme","verticalAlignment","_useComponentsContext","useComponentsContext","NotificationComponent","Notification","styles","useStyles","_useTranslationContex","useTranslationContext","_useNotificationListC","useNotificationListController","dismissNotification","notificationEnterFrom","notificationPresentationKey","jsx","View","accessibilityLabel","pointerEvents","layout","transitions","layout200","style","container","testID","children","entering","boundedZoomIn200","exiting","boundedZoomOut200","notificationWrapper","onDismiss","showClose","duration","_ref4","_useTheme","useTheme","notificationListContainer","theme","notificationList","useMemo","containerAlignmentStyle","bottom","primitives","spacingMd","top","containerOffsetStyle","StyleSheet","create","assign","alignItems","left","maxHeight","position","right","zIndex","alignSelf","maxWidth"],"sourceRoot":"../../../../src","sources":["components/Notifications/NotificationList.tsx"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IA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|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.useResolvedNotificationTarget = exports.useNotificationTargetContext = exports.NotificationTargetProvider = void 0;
|
|
5
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
var _this = this,
|
|
8
|
+
_jsxFileName = "/home/runner/work/stream-chat-react-native/stream-chat-react-native/package/src/components/Notifications/NotificationTargetContext.tsx";
|
|
9
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
10
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
+
var NotificationTargetContext = (0, _react.createContext)(undefined);
|
|
12
|
+
var NotificationTargetProvider = exports.NotificationTargetProvider = function NotificationTargetProvider(_ref) {
|
|
13
|
+
var children = _ref.children,
|
|
14
|
+
hostId = _ref.hostId,
|
|
15
|
+
panel = _ref.panel;
|
|
16
|
+
var value = (0, _react.useMemo)(function () {
|
|
17
|
+
return {
|
|
18
|
+
hostId: hostId,
|
|
19
|
+
panel: panel
|
|
20
|
+
};
|
|
21
|
+
}, [hostId, panel]);
|
|
22
|
+
return (0, _jsxRuntime.jsx)(NotificationTargetContext.Provider, {
|
|
23
|
+
value: value,
|
|
24
|
+
children: children
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
var useNotificationTargetContext = exports.useNotificationTargetContext = function useNotificationTargetContext() {
|
|
28
|
+
return (0, _react.useContext)(NotificationTargetContext);
|
|
29
|
+
};
|
|
30
|
+
var useResolvedNotificationTarget = exports.useResolvedNotificationTarget = function useResolvedNotificationTarget() {
|
|
31
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
32
|
+
hostId = _ref2.hostId,
|
|
33
|
+
panel = _ref2.panel;
|
|
34
|
+
var contextTarget = useNotificationTargetContext();
|
|
35
|
+
return (0, _react.useMemo)(function () {
|
|
36
|
+
if (hostId && panel) return {
|
|
37
|
+
hostId: hostId,
|
|
38
|
+
panel: panel
|
|
39
|
+
};
|
|
40
|
+
if (!hostId && !panel) return contextTarget;
|
|
41
|
+
if (panel && (contextTarget == null ? void 0 : contextTarget.panel) === panel) return contextTarget;
|
|
42
|
+
return undefined;
|
|
43
|
+
}, [contextTarget, hostId, panel]);
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=NotificationTargetContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_jsxRuntime","_this","_jsxFileName","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","NotificationTargetContext","createContext","undefined","NotificationTargetProvider","exports","_ref","children","hostId","panel","value","useMemo","jsx","Provider","useNotificationTargetContext","useContext","useResolvedNotificationTarget","_ref2","arguments","length","contextTarget"],"sourceRoot":"../../../../src","sources":["components/Notifications/NotificationTargetContext.tsx"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAqF,IAAAC,WAAA,GAAAD,OAAA;AAAA,IAAAE,KAAA;EAAAC,YAAA;AAAA,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OA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":[]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
var _useNotificationApi = require("./useNotificationApi");
|
|
5
|
+
Object.keys(_useNotificationApi).forEach(function (key) {
|
|
6
|
+
if (key === "default" || key === "__esModule") return;
|
|
7
|
+
if (key in exports && exports[key] === _useNotificationApi[key]) return;
|
|
8
|
+
Object.defineProperty(exports, key, {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _useNotificationApi[key];
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
var _useNotificationListController = require("./useNotificationListController");
|
|
16
|
+
Object.keys(_useNotificationListController).forEach(function (key) {
|
|
17
|
+
if (key === "default" || key === "__esModule") return;
|
|
18
|
+
if (key in exports && exports[key] === _useNotificationListController[key]) return;
|
|
19
|
+
Object.defineProperty(exports, key, {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function get() {
|
|
22
|
+
return _useNotificationListController[key];
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
var _useNotifications = require("./useNotifications");
|
|
27
|
+
Object.keys(_useNotifications).forEach(function (key) {
|
|
28
|
+
if (key === "default" || key === "__esModule") return;
|
|
29
|
+
if (key in exports && exports[key] === _useNotifications[key]) return;
|
|
30
|
+
Object.defineProperty(exports, key, {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function get() {
|
|
33
|
+
return _useNotifications[key];
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
var _useNotificationTarget = require("./useNotificationTarget");
|
|
38
|
+
Object.keys(_useNotificationTarget).forEach(function (key) {
|
|
39
|
+
if (key === "default" || key === "__esModule") return;
|
|
40
|
+
if (key in exports && exports[key] === _useNotificationTarget[key]) return;
|
|
41
|
+
Object.defineProperty(exports, key, {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function get() {
|
|
44
|
+
return _useNotificationTarget[key];
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
var _useSystemNotifications = require("./useSystemNotifications");
|
|
49
|
+
Object.keys(_useSystemNotifications).forEach(function (key) {
|
|
50
|
+
if (key === "default" || key === "__esModule") return;
|
|
51
|
+
if (key in exports && exports[key] === _useSystemNotifications[key]) return;
|
|
52
|
+
Object.defineProperty(exports, key, {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function get() {
|
|
55
|
+
return _useSystemNotifications[key];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_useNotificationApi","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_useNotificationListController","_useNotifications","_useNotificationTarget","_useSystemNotifications"],"sourceRoot":"../../../../../src","sources":["components/Notifications/hooks/index.ts"],"mappings":";;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,mBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,mBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAT,mBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,8BAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,8BAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,8BAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAA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
|
@@ -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,GAAAC,OAAA,CAAAD,uBAAA,GAAG,QAAiB;AAGjD,IAAME,wBAAwB,GAAAD,OAAA,CAAAC,wBAAA,GAAG,SAA3BA,wBAAwBA,CAAIC,YAA0B;EAAA,IAAAC,qBAAA,EAAAC,kBAAA;EAAA,QAAAD,qBAAA,IAAAC,kBAAA,GACjEF,YAAY,CAACG,IAAI,qBAAjBD,kBAAA,CAAmBE,QAAQ,CAACP,uBAAuB,CAAC,YAAAI,qBAAA,GAAI,KAAK;AAAA;AAwD/D,IAAMI,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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,CAACJ,wBAAwB,CAAC;EAC9E,OAAON,qBAAqB,CAC1BS,uBAAuB,CAACE,MAAM,GAAG,CAAC,GAAGF,uBAAuB,GAAGR,aACjE,CAAC;AACH,CAAC;AAED,IAAMW,+BAA+B,GAAG,SAAlCA,+BAA+BA,CAAIR,YAA8B,EAAK;EAAA,IAAAS,qBAAA,EAAAC,qBAAA;EAC1E,IAAIR,wBAAwB,CAACF,YAAY,CAAC,EAAE,OAAOW,SAAS;EAC5D,IAAI,GAAAF,qBAAA,GAACT,Y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AAE,GAAAoB,KAAA,CAAFpB,EAAE;MACzB,IAAIA,EAAE,KAAKzC,YAAY,CAACyC,EAAE,EAAE;MAE5BX,oBAAoB,CAACS,OAAO,CAACC,MAAM,CAACC,EAAE,CAAC;MACvCf,kBAAkB,CAACe,EAAE,CAAC;IACxB,CAAC,CAAC;EACJ,CAAC,EAAE,CAACzC,YAAY,EAAEH,aAAa,EAAE6B,kBAAkB,EAAEI,oBAAoB,CAAC,CAAC;EAE3E,IAAAiB,gBAAS,EAAC,YAAM;IACd,IAAI,CAAC/C,YAAY,EAAE;IACnB,IAAI8B,oBAAoB,CAACS,OAAO,CAACiB,GAAG,CAACxD,YAAY,CAACyC,EAAE,CAAC,EAAE;IAEvDX,oBAAoB,CAACS,OAAO,CAACuB,GAAG,CAAC9D,YAAY,CAACyC,EAAE,CAAC;IACjD,IAAMsB,gBAAgB,GAAGvD,+BAA+B,CAACR,YAAY,CAAC;IACtE,IAAI,OAAO+D,gBAAgB,KAAK,QAAQ,EAAE;MACxCpC,wBAAwB,CAAC3B,YAAY,CAACyC,EAAE,EAAEsB,gBAAgB,CAAC;IAC7D,CAAC,MAAM;MACLpC,wBAAwB,CAAC3B,YAAY,CAACyC,EAAE,CAAC;IAC3C;EACF,CAAC,EAAE,CAACzC,YAAY,EAAE2B,wBAAwB,EAAEG,oBAAoB,CAAC,CAAC;EAElE,IAAAiB,gBAAS,EAAC,YAAM;IACd,OAAO,YAAM;MACXL,+BAA+B,CAAC,CAAC;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"],"sourceRoot":"../../../../../src","sources":["components/Notifications/hooks/useNotifications.ts"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AAcO,IAAMI,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,SAAnBA,gBAAgBA,CAAIE,OAAiC,EAAqB;EACrF,IAAAC,eAAA,GAAmB,IAAAC,2BAA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