@novu/js 2.0.1 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{chunk-PMLVIUWC.cjs → chunk-D7P7KCZI.js} +342 -255
- package/dist/cjs/index.d.ts +8 -0
- package/dist/cjs/index.js +58 -0
- package/dist/cjs/novu-04KlkBy4.d.ts +528 -0
- package/dist/cjs/ui/index.d.ts +145 -0
- package/dist/cjs/ui/{index.cjs → index.js} +218 -141
- package/dist/esm/{chunk-LDGUT6MH.mjs → chunk-APRCCICD.mjs} +342 -256
- package/dist/esm/index.d.mts +8 -0
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/novu-04KlkBy4.d.mts +528 -0
- package/dist/esm/ui/index.d.mts +145 -0
- package/dist/esm/ui/index.mjs +131 -54
- package/dist/novu.min.js +10 -10
- package/dist/novu.min.js.gz +0 -0
- package/package.json +24 -16
- package/ui/package.json +5 -0
- package/dist/cjs/index.cjs +0 -50
- package/dist/types/api/inbox-service.d.ts +0 -65
- package/dist/types/api/inbox-service.d.ts.map +0 -1
- package/dist/types/api/index.d.ts +0 -2
- package/dist/types/api/index.d.ts.map +0 -1
- package/dist/types/base-module.d.ts +0 -13
- package/dist/types/base-module.d.ts.map +0 -1
- package/dist/types/cache/in-memory-cache.d.ts +0 -13
- package/dist/types/cache/in-memory-cache.d.ts.map +0 -1
- package/dist/types/cache/index.d.ts +0 -2
- package/dist/types/cache/index.d.ts.map +0 -1
- package/dist/types/cache/notifications-cache.d.ts +0 -22
- package/dist/types/cache/notifications-cache.d.ts.map +0 -1
- package/dist/types/cache/preferences-cache.d.ts +0 -11
- package/dist/types/cache/preferences-cache.d.ts.map +0 -1
- package/dist/types/cache/types.d.ts +0 -10
- package/dist/types/cache/types.d.ts.map +0 -1
- package/dist/types/event-emitter/index.d.ts +0 -3
- package/dist/types/event-emitter/index.d.ts.map +0 -1
- package/dist/types/event-emitter/novu-event-emitter.d.ts +0 -14
- package/dist/types/event-emitter/novu-event-emitter.d.ts.map +0 -1
- package/dist/types/event-emitter/types.d.ts +0 -85
- package/dist/types/event-emitter/types.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -3
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/notifications/helpers.d.ts +0 -57
- package/dist/types/notifications/helpers.d.ts.map +0 -1
- package/dist/types/notifications/index.d.ts +0 -4
- package/dist/types/notifications/index.d.ts.map +0 -1
- package/dist/types/notifications/notification.d.ts +0 -33
- package/dist/types/notifications/notification.d.ts.map +0 -1
- package/dist/types/notifications/notifications.d.ts +0 -44
- package/dist/types/notifications/notifications.d.ts.map +0 -1
- package/dist/types/notifications/types.d.ts +0 -55
- package/dist/types/notifications/types.d.ts.map +0 -1
- package/dist/types/novu.d.ts +0 -14
- package/dist/types/novu.d.ts.map +0 -1
- package/dist/types/preferences/helpers.d.ts +0 -11
- package/dist/types/preferences/helpers.d.ts.map +0 -1
- package/dist/types/preferences/index.d.ts +0 -2
- package/dist/types/preferences/index.d.ts.map +0 -1
- package/dist/types/preferences/preference.d.ts +0 -15
- package/dist/types/preferences/preference.d.ts.map +0 -1
- package/dist/types/preferences/preferences.d.ts +0 -15
- package/dist/types/preferences/preferences.d.ts.map +0 -1
- package/dist/types/preferences/types.d.ts +0 -15
- package/dist/types/preferences/types.d.ts.map +0 -1
- package/dist/types/session/index.d.ts +0 -3
- package/dist/types/session/index.d.ts.map +0 -1
- package/dist/types/session/session.d.ts +0 -7
- package/dist/types/session/session.d.ts.map +0 -1
- package/dist/types/session/types.d.ts +0 -6
- package/dist/types/session/types.d.ts.map +0 -1
- package/dist/types/types.d.ts +0 -150
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/ui/api/hooks/index.d.ts +0 -6
- package/dist/types/ui/api/hooks/index.d.ts.map +0 -1
- package/dist/types/ui/api/hooks/useArchiveAll.d.ts +0 -10
- package/dist/types/ui/api/hooks/useArchiveAll.d.ts.map +0 -1
- package/dist/types/ui/api/hooks/useArchiveAllRead.d.ts +0 -10
- package/dist/types/ui/api/hooks/useArchiveAllRead.d.ts.map +0 -1
- package/dist/types/ui/api/hooks/useNotifications.d.ts +0 -17
- package/dist/types/ui/api/hooks/useNotifications.d.ts.map +0 -1
- package/dist/types/ui/api/hooks/usePreferences.d.ts +0 -9
- package/dist/types/ui/api/hooks/usePreferences.d.ts.map +0 -1
- package/dist/types/ui/api/hooks/useReadAll.d.ts +0 -10
- package/dist/types/ui/api/hooks/useReadAll.d.ts.map +0 -1
- package/dist/types/ui/api/index.d.ts +0 -2
- package/dist/types/ui/api/index.d.ts.map +0 -1
- package/dist/types/ui/components/ExternalElementRenderer.d.ts +0 -7
- package/dist/types/ui/components/ExternalElementRenderer.d.ts.map +0 -1
- package/dist/types/ui/components/Inbox.d.ts +0 -24
- package/dist/types/ui/components/Inbox.d.ts.map +0 -1
- package/dist/types/ui/components/InboxTabs/InboxTab.d.ts +0 -16
- package/dist/types/ui/components/InboxTabs/InboxTab.d.ts.map +0 -1
- package/dist/types/ui/components/InboxTabs/InboxTabs.d.ts +0 -11
- package/dist/types/ui/components/InboxTabs/InboxTabs.d.ts.map +0 -1
- package/dist/types/ui/components/InboxTabs/index.d.ts +0 -2
- package/dist/types/ui/components/InboxTabs/index.d.ts.map +0 -1
- package/dist/types/ui/components/InboxTabs/useTabsDropdown.d.ts +0 -11
- package/dist/types/ui/components/InboxTabs/useTabsDropdown.d.ts.map +0 -1
- package/dist/types/ui/components/Notification/DefaultNotification.d.ts +0 -12
- package/dist/types/ui/components/Notification/DefaultNotification.d.ts.map +0 -1
- package/dist/types/ui/components/Notification/NewMessagesCta.d.ts +0 -6
- package/dist/types/ui/components/Notification/NewMessagesCta.d.ts.map +0 -1
- package/dist/types/ui/components/Notification/Notification.d.ts +0 -12
- package/dist/types/ui/components/Notification/Notification.d.ts.map +0 -1
- package/dist/types/ui/components/Notification/NotificationList.d.ts +0 -14
- package/dist/types/ui/components/Notification/NotificationList.d.ts.map +0 -1
- package/dist/types/ui/components/Notification/NotificationListSkeleton.d.ts +0 -7
- package/dist/types/ui/components/Notification/NotificationListSkeleton.d.ts.map +0 -1
- package/dist/types/ui/components/Notification/index.d.ts +0 -3
- package/dist/types/ui/components/Notification/index.d.ts.map +0 -1
- package/dist/types/ui/components/Renderer.d.ts +0 -44
- package/dist/types/ui/components/Renderer.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Bell/Bell.d.ts +0 -8
- package/dist/types/ui/components/elements/Bell/Bell.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Bell/DefaultBellContainer.d.ts +0 -6
- package/dist/types/ui/components/elements/Bell/DefaultBellContainer.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Bell/index.d.ts +0 -2
- package/dist/types/ui/components/elements/Bell/index.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Footer.d.ts +0 -2
- package/dist/types/ui/components/elements/Footer.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Header/ActionsContainer.d.ts +0 -6
- package/dist/types/ui/components/elements/Header/ActionsContainer.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Header/Header.d.ts +0 -6
- package/dist/types/ui/components/elements/Header/Header.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Header/MoreActionsDropdown.d.ts +0 -2
- package/dist/types/ui/components/elements/Header/MoreActionsDropdown.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Header/MoreActionsOptions.d.ts +0 -9
- package/dist/types/ui/components/elements/Header/MoreActionsOptions.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Header/PreferencesHeader.d.ts +0 -6
- package/dist/types/ui/components/elements/Header/PreferencesHeader.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Header/index.d.ts +0 -3
- package/dist/types/ui/components/elements/Header/index.d.ts.map +0 -1
- package/dist/types/ui/components/elements/InboxStatus/InboxStatusDropdown.d.ts +0 -2
- package/dist/types/ui/components/elements/InboxStatus/InboxStatusDropdown.d.ts.map +0 -1
- package/dist/types/ui/components/elements/InboxStatus/InboxStatusOptions.d.ts +0 -14
- package/dist/types/ui/components/elements/InboxStatus/InboxStatusOptions.d.ts.map +0 -1
- package/dist/types/ui/components/elements/InboxStatus/constants.d.ts +0 -11
- package/dist/types/ui/components/elements/InboxStatus/constants.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Preferences/ChannelRow.d.ts +0 -18
- package/dist/types/ui/components/elements/Preferences/ChannelRow.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Preferences/LoadingScreen.d.ts +0 -2
- package/dist/types/ui/components/elements/Preferences/LoadingScreen.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Preferences/Preferences.d.ts +0 -2
- package/dist/types/ui/components/elements/Preferences/Preferences.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Preferences/Switch.d.ts +0 -8
- package/dist/types/ui/components/elements/Preferences/Switch.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Preferences/index.d.ts +0 -2
- package/dist/types/ui/components/elements/Preferences/index.d.ts.map +0 -1
- package/dist/types/ui/components/elements/Root.d.ts +0 -3
- package/dist/types/ui/components/elements/Root.d.ts.map +0 -1
- package/dist/types/ui/components/elements/index.d.ts +0 -6
- package/dist/types/ui/components/elements/index.d.ts.map +0 -1
- package/dist/types/ui/components/index.d.ts +0 -4
- package/dist/types/ui/components/index.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Button.d.ts +0 -13
- package/dist/types/ui/components/primitives/Button.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Dropdown/DropdownContent.d.ts +0 -8
- package/dist/types/ui/components/primitives/Dropdown/DropdownContent.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Dropdown/DropdownItem.d.ts +0 -9
- package/dist/types/ui/components/primitives/Dropdown/DropdownItem.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Dropdown/DropdownRoot.d.ts +0 -4
- package/dist/types/ui/components/primitives/Dropdown/DropdownRoot.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Dropdown/DropdownTrigger.d.ts +0 -8
- package/dist/types/ui/components/primitives/Dropdown/DropdownTrigger.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Dropdown/index.d.ts +0 -44
- package/dist/types/ui/components/primitives/Dropdown/index.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Popover/PopoverClose.d.ts +0 -7
- package/dist/types/ui/components/primitives/Popover/PopoverClose.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Popover/PopoverContent.d.ts +0 -9
- package/dist/types/ui/components/primitives/Popover/PopoverContent.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Popover/PopoverRoot.d.ts +0 -23
- package/dist/types/ui/components/primitives/Popover/PopoverRoot.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Popover/PopoverTrigger.d.ts +0 -9
- package/dist/types/ui/components/primitives/Popover/PopoverTrigger.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Popover/index.d.ts +0 -28
- package/dist/types/ui/components/primitives/Popover/index.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Skeleton.d.ts +0 -14
- package/dist/types/ui/components/primitives/Skeleton.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Tabs/TabsContent.d.ts +0 -10
- package/dist/types/ui/components/primitives/Tabs/TabsContent.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Tabs/TabsList.d.ts +0 -11
- package/dist/types/ui/components/primitives/Tabs/TabsList.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Tabs/TabsRoot.d.ts +0 -20
- package/dist/types/ui/components/primitives/Tabs/TabsRoot.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Tabs/TabsTrigger.d.ts +0 -13
- package/dist/types/ui/components/primitives/Tabs/TabsTrigger.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Tabs/index.d.ts +0 -35
- package/dist/types/ui/components/primitives/Tabs/index.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Tabs/useKeyboardNavigation.d.ts +0 -7
- package/dist/types/ui/components/primitives/Tabs/useKeyboardNavigation.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Tooltip/TooltipContent.d.ts +0 -9
- package/dist/types/ui/components/primitives/Tooltip/TooltipContent.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Tooltip/TooltipRoot.d.ts +0 -21
- package/dist/types/ui/components/primitives/Tooltip/TooltipRoot.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Tooltip/TooltipTrigger.d.ts +0 -9
- package/dist/types/ui/components/primitives/Tooltip/TooltipTrigger.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/Tooltip/index.d.ts +0 -21
- package/dist/types/ui/components/primitives/Tooltip/index.d.ts.map +0 -1
- package/dist/types/ui/components/primitives/index.d.ts +0 -5
- package/dist/types/ui/components/primitives/index.d.ts.map +0 -1
- package/dist/types/ui/config/appearanceKeys.d.ts +0 -2
- package/dist/types/ui/config/appearanceKeys.d.ts.map +0 -1
- package/dist/types/ui/config/defaultLocalization.d.ts +0 -26
- package/dist/types/ui/config/defaultLocalization.d.ts.map +0 -1
- package/dist/types/ui/config/defaultVariables.d.ts +0 -3
- package/dist/types/ui/config/defaultVariables.d.ts.map +0 -1
- package/dist/types/ui/config/index.d.ts +0 -4
- package/dist/types/ui/config/index.d.ts.map +0 -1
- package/dist/types/ui/context/AppearanceContext.d.ts +0 -17
- package/dist/types/ui/context/AppearanceContext.d.ts.map +0 -1
- package/dist/types/ui/context/CountContext.d.ts +0 -23
- package/dist/types/ui/context/CountContext.d.ts.map +0 -1
- package/dist/types/ui/context/FocusManagerContext.d.ts +0 -12
- package/dist/types/ui/context/FocusManagerContext.d.ts.map +0 -1
- package/dist/types/ui/context/InboxContext.d.ts +0 -25
- package/dist/types/ui/context/InboxContext.d.ts.map +0 -1
- package/dist/types/ui/context/LocalizationContext.d.ts +0 -24
- package/dist/types/ui/context/LocalizationContext.d.ts.map +0 -1
- package/dist/types/ui/context/NovuContext.d.ts +0 -11
- package/dist/types/ui/context/NovuContext.d.ts.map +0 -1
- package/dist/types/ui/context/index.d.ts +0 -7
- package/dist/types/ui/context/index.d.ts.map +0 -1
- package/dist/types/ui/helpers/browser.d.ts +0 -2
- package/dist/types/ui/helpers/browser.d.ts.map +0 -1
- package/dist/types/ui/helpers/constants.d.ts +0 -5
- package/dist/types/ui/helpers/constants.d.ts.map +0 -1
- package/dist/types/ui/helpers/createDelayedLoading.d.ts +0 -3
- package/dist/types/ui/helpers/createDelayedLoading.d.ts.map +0 -1
- package/dist/types/ui/helpers/createInfiniteScroll.d.ts +0 -19
- package/dist/types/ui/helpers/createInfiniteScroll.d.ts.map +0 -1
- package/dist/types/ui/helpers/formatToRelativeTime.d.ts +0 -6
- package/dist/types/ui/helpers/formatToRelativeTime.d.ts.map +0 -1
- package/dist/types/ui/helpers/index.d.ts +0 -7
- package/dist/types/ui/helpers/index.d.ts.map +0 -1
- package/dist/types/ui/helpers/types.d.ts +0 -4
- package/dist/types/ui/helpers/types.d.ts.map +0 -1
- package/dist/types/ui/helpers/useBrowserTabsChannel.d.ts +0 -7
- package/dist/types/ui/helpers/useBrowserTabsChannel.d.ts.map +0 -1
- package/dist/types/ui/helpers/useFocusTrap.d.ts +0 -7
- package/dist/types/ui/helpers/useFocusTrap.d.ts.map +0 -1
- package/dist/types/ui/helpers/useNovuEvent.d.ts +0 -6
- package/dist/types/ui/helpers/useNovuEvent.d.ts.map +0 -1
- package/dist/types/ui/helpers/useStyle.d.ts +0 -3
- package/dist/types/ui/helpers/useStyle.d.ts.map +0 -1
- package/dist/types/ui/helpers/useUncontrolledState.d.ts +0 -9
- package/dist/types/ui/helpers/useUncontrolledState.d.ts.map +0 -1
- package/dist/types/ui/helpers/useWebSocketEvent.d.ts +0 -6
- package/dist/types/ui/helpers/useWebSocketEvent.d.ts.map +0 -1
- package/dist/types/ui/helpers/utils.d.ts +0 -33
- package/dist/types/ui/helpers/utils.d.ts.map +0 -1
- package/dist/types/ui/icons/Archive.d.ts +0 -3
- package/dist/types/ui/icons/Archive.d.ts.map +0 -1
- package/dist/types/ui/icons/ArchiveRead.d.ts +0 -3
- package/dist/types/ui/icons/ArchiveRead.d.ts.map +0 -1
- package/dist/types/ui/icons/ArrowDropDown.d.ts +0 -3
- package/dist/types/ui/icons/ArrowDropDown.d.ts.map +0 -1
- package/dist/types/ui/icons/ArrowLeft.d.ts +0 -3
- package/dist/types/ui/icons/ArrowLeft.d.ts.map +0 -1
- package/dist/types/ui/icons/BellIcon.d.ts +0 -3
- package/dist/types/ui/icons/BellIcon.d.ts.map +0 -1
- package/dist/types/ui/icons/Chat.d.ts +0 -3
- package/dist/types/ui/icons/Chat.d.ts.map +0 -1
- package/dist/types/ui/icons/Check.d.ts +0 -3
- package/dist/types/ui/icons/Check.d.ts.map +0 -1
- package/dist/types/ui/icons/Dots.d.ts +0 -3
- package/dist/types/ui/icons/Dots.d.ts.map +0 -1
- package/dist/types/ui/icons/Email.d.ts +0 -3
- package/dist/types/ui/icons/Email.d.ts.map +0 -1
- package/dist/types/ui/icons/EmptyIcon.d.ts +0 -3
- package/dist/types/ui/icons/EmptyIcon.d.ts.map +0 -1
- package/dist/types/ui/icons/InApp.d.ts +0 -3
- package/dist/types/ui/icons/InApp.d.ts.map +0 -1
- package/dist/types/ui/icons/Inbox.d.ts +0 -3
- package/dist/types/ui/icons/Inbox.d.ts.map +0 -1
- package/dist/types/ui/icons/Lock.d.ts +0 -2
- package/dist/types/ui/icons/Lock.d.ts.map +0 -1
- package/dist/types/ui/icons/Novu.d.ts +0 -3
- package/dist/types/ui/icons/Novu.d.ts.map +0 -1
- package/dist/types/ui/icons/Push.d.ts +0 -3
- package/dist/types/ui/icons/Push.d.ts.map +0 -1
- package/dist/types/ui/icons/ReadAll.d.ts +0 -3
- package/dist/types/ui/icons/ReadAll.d.ts.map +0 -1
- package/dist/types/ui/icons/Settings.d.ts +0 -3
- package/dist/types/ui/icons/Settings.d.ts.map +0 -1
- package/dist/types/ui/icons/Sms.d.ts +0 -3
- package/dist/types/ui/icons/Sms.d.ts.map +0 -1
- package/dist/types/ui/icons/Unarchive.d.ts +0 -3
- package/dist/types/ui/icons/Unarchive.d.ts.map +0 -1
- package/dist/types/ui/icons/Unread.d.ts +0 -3
- package/dist/types/ui/icons/Unread.d.ts.map +0 -1
- package/dist/types/ui/icons/index.d.ts +0 -20
- package/dist/types/ui/icons/index.d.ts.map +0 -1
- package/dist/types/ui/index.d.ts +0 -6
- package/dist/types/ui/index.d.ts.map +0 -1
- package/dist/types/ui/novuUI.d.ts +0 -25
- package/dist/types/ui/novuUI.d.ts.map +0 -1
- package/dist/types/ui/themes/dark.d.ts +0 -3
- package/dist/types/ui/themes/dark.d.ts.map +0 -1
- package/dist/types/ui/themes/index.d.ts +0 -2
- package/dist/types/ui/themes/index.d.ts.map +0 -1
- package/dist/types/ui/types.d.ts +0 -57
- package/dist/types/ui/types.d.ts.map +0 -1
- package/dist/types/umd.d.ts +0 -2
- package/dist/types/umd.d.ts.map +0 -1
- package/dist/types/utils/arrays.d.ts +0 -2
- package/dist/types/utils/arrays.d.ts.map +0 -1
- package/dist/types/utils/config.d.ts +0 -2
- package/dist/types/utils/config.d.ts.map +0 -1
- package/dist/types/utils/errors.d.ts +0 -5
- package/dist/types/utils/errors.d.ts.map +0 -1
- package/dist/types/utils/inbox-service-singleton.d.ts +0 -6
- package/dist/types/utils/inbox-service-singleton.d.ts.map +0 -1
- package/dist/types/utils/notification-utils.d.ts +0 -6
- package/dist/types/utils/notification-utils.d.ts.map +0 -1
- package/dist/types/ws/index.d.ts +0 -2
- package/dist/types/ws/index.d.ts.map +0 -1
- package/dist/types/ws/socket.d.ts +0 -13
- package/dist/types/ws/socket.d.ts.map +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { N as NotificationFilter } from './novu-04KlkBy4.js';
|
|
2
|
+
export { k as Action, A as ActionTypeEnum, m as ChannelPreference, f as ChannelType, C as CtaType, E as EventHandler, a as Events, F as FiltersCountResponse, q as IPreferenceOverride, I as InboxNotification, L as ListNotificationsResponse, i as MessageAction, M as MessageButton, t as Notification, e as NotificationActionStatus, d as NotificationButton, c as NotificationStatus, b as Novu, v as NovuError, s as NovuOptions, n as PaginatedResponse, u as Preference, P as PreferenceLevel, g as PreferenceOverrideSource, p as PreferenceOverrideSourceEnum, o as PreferencesResponse, R as Redirect, r as Result, h as Session, S as SocketEventNames, j as Subscriber, T as TODO, W as WebSocketEvent, l as Workflow } from './novu-04KlkBy4.js';
|
|
3
|
+
import '@novu/client';
|
|
4
|
+
|
|
5
|
+
declare const areTagsEqual: (tags1?: string[], tags2?: string[]) => boolean;
|
|
6
|
+
declare const isSameFilter: (filter1: NotificationFilter, filter2: NotificationFilter) => boolean;
|
|
7
|
+
|
|
8
|
+
export { NotificationFilter, areTagsEqual, isSameFilter };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkD7P7KCZI_js = require('./chunk-D7P7KCZI.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "ActionTypeEnum", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkD7P7KCZI_js.ActionTypeEnum; }
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(exports, "ChannelType", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunkD7P7KCZI_js.ChannelType; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "CtaType", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunkD7P7KCZI_js.CtaType; }
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "NotificationActionStatus", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return chunkD7P7KCZI_js.NotificationActionStatus; }
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports, "NotificationButton", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () { return chunkD7P7KCZI_js.NotificationButton; }
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(exports, "NotificationStatus", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () { return chunkD7P7KCZI_js.NotificationStatus; }
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(exports, "Novu", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: function () { return chunkD7P7KCZI_js.Novu; }
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(exports, "PreferenceLevel", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function () { return chunkD7P7KCZI_js.PreferenceLevel; }
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(exports, "PreferenceOverrideSource", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () { return chunkD7P7KCZI_js.PreferenceOverrideSource; }
|
|
42
|
+
});
|
|
43
|
+
Object.defineProperty(exports, "PreferenceOverrideSourceEnum", {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () { return chunkD7P7KCZI_js.PreferenceOverrideSourceEnum; }
|
|
46
|
+
});
|
|
47
|
+
Object.defineProperty(exports, "WebSocketEvent", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function () { return chunkD7P7KCZI_js.WebSocketEvent; }
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(exports, "areTagsEqual", {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () { return chunkD7P7KCZI_js.areTagsEqual; }
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(exports, "isSameFilter", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () { return chunkD7P7KCZI_js.isSameFilter; }
|
|
58
|
+
});
|
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
import { ApiOptions } from '@novu/client';
|
|
2
|
+
|
|
3
|
+
declare class NovuError extends Error {
|
|
4
|
+
originalError: Error;
|
|
5
|
+
constructor(message: string, originalError: unknown);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
type PreferenceLike = Pick<Preference, 'level' | 'enabled' | 'channels' | 'workflow'>;
|
|
9
|
+
declare class Preference {
|
|
10
|
+
#private;
|
|
11
|
+
readonly level: PreferenceLevel;
|
|
12
|
+
readonly enabled: boolean;
|
|
13
|
+
readonly channels: ChannelPreference;
|
|
14
|
+
readonly workflow?: Workflow;
|
|
15
|
+
constructor(preference: PreferenceLike, { emitterInstance, inboxServiceInstance }: {
|
|
16
|
+
emitterInstance: NovuEventEmitter;
|
|
17
|
+
inboxServiceInstance: InboxService;
|
|
18
|
+
});
|
|
19
|
+
update({ channelPreferences }: {
|
|
20
|
+
channelPreferences: ChannelPreference;
|
|
21
|
+
}): Result<Preference>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare enum NotificationStatus {
|
|
25
|
+
READ = "read",
|
|
26
|
+
SEEN = "seen",
|
|
27
|
+
UNREAD = "unread",
|
|
28
|
+
UNSEEN = "unseen"
|
|
29
|
+
}
|
|
30
|
+
declare enum NotificationButton {
|
|
31
|
+
PRIMARY = "primary",
|
|
32
|
+
SECONDARY = "secondary"
|
|
33
|
+
}
|
|
34
|
+
declare enum NotificationActionStatus {
|
|
35
|
+
PENDING = "pending",
|
|
36
|
+
DONE = "done"
|
|
37
|
+
}
|
|
38
|
+
declare enum CtaType {
|
|
39
|
+
REDIRECT = "redirect"
|
|
40
|
+
}
|
|
41
|
+
declare enum PreferenceLevel {
|
|
42
|
+
GLOBAL = "global",
|
|
43
|
+
TEMPLATE = "template"
|
|
44
|
+
}
|
|
45
|
+
declare enum ChannelType {
|
|
46
|
+
IN_APP = "in_app",
|
|
47
|
+
EMAIL = "email",
|
|
48
|
+
SMS = "sms",
|
|
49
|
+
CHAT = "chat",
|
|
50
|
+
PUSH = "push"
|
|
51
|
+
}
|
|
52
|
+
declare enum PreferenceOverrideSource {
|
|
53
|
+
SUBSCRIBER = "subscriber",
|
|
54
|
+
TEMPLATE = "template",
|
|
55
|
+
WORKFLOW_OVERRIDE = "workflowOverride"
|
|
56
|
+
}
|
|
57
|
+
declare enum WebSocketEvent {
|
|
58
|
+
RECEIVED = "notification_received",
|
|
59
|
+
UNREAD = "unread_count_changed",
|
|
60
|
+
UNSEEN = "unseen_count_changed"
|
|
61
|
+
}
|
|
62
|
+
declare enum ActionTypeEnum {
|
|
63
|
+
PRIMARY = "primary",
|
|
64
|
+
SECONDARY = "secondary"
|
|
65
|
+
}
|
|
66
|
+
type Session = {
|
|
67
|
+
token: string;
|
|
68
|
+
totalUnreadCount: number;
|
|
69
|
+
};
|
|
70
|
+
type MessageButton = {
|
|
71
|
+
type: NotificationButton;
|
|
72
|
+
content: string;
|
|
73
|
+
resultContent?: string;
|
|
74
|
+
};
|
|
75
|
+
type MessageAction = {
|
|
76
|
+
status?: NotificationActionStatus;
|
|
77
|
+
buttons?: MessageButton[];
|
|
78
|
+
result: {
|
|
79
|
+
payload?: Record<string, unknown>;
|
|
80
|
+
type?: NotificationButton;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
type Subscriber = {
|
|
84
|
+
id: string;
|
|
85
|
+
firstName?: string;
|
|
86
|
+
lastName?: string;
|
|
87
|
+
avatar?: string;
|
|
88
|
+
subscriberId: string;
|
|
89
|
+
};
|
|
90
|
+
type Redirect = {
|
|
91
|
+
url: string;
|
|
92
|
+
target?: '_self' | '_blank' | '_parent' | '_top' | '_unfencedTop';
|
|
93
|
+
};
|
|
94
|
+
type Action = {
|
|
95
|
+
label: string;
|
|
96
|
+
isCompleted: boolean;
|
|
97
|
+
redirect?: Redirect;
|
|
98
|
+
};
|
|
99
|
+
type InboxNotification = {
|
|
100
|
+
id: string;
|
|
101
|
+
subject?: string;
|
|
102
|
+
body: string;
|
|
103
|
+
to: Subscriber;
|
|
104
|
+
isRead: boolean;
|
|
105
|
+
isArchived: boolean;
|
|
106
|
+
createdAt: string;
|
|
107
|
+
readAt?: string | null;
|
|
108
|
+
archivedAt?: string | null;
|
|
109
|
+
avatar?: string;
|
|
110
|
+
primaryAction?: Action;
|
|
111
|
+
secondaryAction?: Action;
|
|
112
|
+
channelType: ChannelType;
|
|
113
|
+
tags?: string[];
|
|
114
|
+
data?: Record<string, unknown>;
|
|
115
|
+
redirect?: Redirect;
|
|
116
|
+
};
|
|
117
|
+
type NotificationFilter = {
|
|
118
|
+
tags?: string[];
|
|
119
|
+
read?: boolean;
|
|
120
|
+
archived?: boolean;
|
|
121
|
+
};
|
|
122
|
+
type Workflow = {
|
|
123
|
+
id: string;
|
|
124
|
+
identifier: string;
|
|
125
|
+
name: string;
|
|
126
|
+
critical: boolean;
|
|
127
|
+
tags?: string[];
|
|
128
|
+
};
|
|
129
|
+
type ChannelPreference = {
|
|
130
|
+
email?: boolean;
|
|
131
|
+
sms?: boolean;
|
|
132
|
+
in_app?: boolean;
|
|
133
|
+
chat?: boolean;
|
|
134
|
+
push?: boolean;
|
|
135
|
+
};
|
|
136
|
+
type PaginatedResponse<T = unknown> = {
|
|
137
|
+
data: T[];
|
|
138
|
+
hasMore: boolean;
|
|
139
|
+
totalCount: number;
|
|
140
|
+
pageSize: number;
|
|
141
|
+
page: number;
|
|
142
|
+
};
|
|
143
|
+
type PreferencesResponse = {
|
|
144
|
+
level: PreferenceLevel;
|
|
145
|
+
enabled: boolean;
|
|
146
|
+
channels: ChannelPreference;
|
|
147
|
+
overrides?: IPreferenceOverride[];
|
|
148
|
+
workflow?: Workflow;
|
|
149
|
+
};
|
|
150
|
+
declare enum PreferenceOverrideSourceEnum {
|
|
151
|
+
SUBSCRIBER = "subscriber",
|
|
152
|
+
TEMPLATE = "template",
|
|
153
|
+
WORKFLOW_OVERRIDE = "workflowOverride"
|
|
154
|
+
}
|
|
155
|
+
type IPreferenceOverride = {
|
|
156
|
+
channel: ChannelType;
|
|
157
|
+
source: PreferenceOverrideSourceEnum;
|
|
158
|
+
};
|
|
159
|
+
type TODO = any;
|
|
160
|
+
type Result<D = undefined, E = NovuError> = Promise<{
|
|
161
|
+
data?: D;
|
|
162
|
+
error?: E;
|
|
163
|
+
}>;
|
|
164
|
+
type NovuOptions = {
|
|
165
|
+
applicationIdentifier: string;
|
|
166
|
+
subscriberId: string;
|
|
167
|
+
subscriberHash?: string;
|
|
168
|
+
backendUrl?: string;
|
|
169
|
+
socketUrl?: string;
|
|
170
|
+
useCache?: boolean;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
type InboxServiceOptions = ApiOptions;
|
|
174
|
+
declare class InboxService {
|
|
175
|
+
#private;
|
|
176
|
+
isSessionInitialized: boolean;
|
|
177
|
+
constructor(options?: InboxServiceOptions);
|
|
178
|
+
initializeSession({ applicationIdentifier, subscriberId, subscriberHash, }: {
|
|
179
|
+
applicationIdentifier: string;
|
|
180
|
+
subscriberId: string;
|
|
181
|
+
subscriberHash?: string;
|
|
182
|
+
}): Promise<Session>;
|
|
183
|
+
fetchNotifications({ after, archived, limit, offset, read, tags, }: {
|
|
184
|
+
tags?: string[];
|
|
185
|
+
read?: boolean;
|
|
186
|
+
archived?: boolean;
|
|
187
|
+
limit?: number;
|
|
188
|
+
after?: string;
|
|
189
|
+
offset?: number;
|
|
190
|
+
}): Promise<{
|
|
191
|
+
data: InboxNotification[];
|
|
192
|
+
hasMore: boolean;
|
|
193
|
+
filter: NotificationFilter;
|
|
194
|
+
}>;
|
|
195
|
+
count({ filters }: {
|
|
196
|
+
filters: Array<{
|
|
197
|
+
tags?: string[];
|
|
198
|
+
read?: boolean;
|
|
199
|
+
archived?: boolean;
|
|
200
|
+
}>;
|
|
201
|
+
}): Promise<{
|
|
202
|
+
data: Array<{
|
|
203
|
+
count: number;
|
|
204
|
+
filter: NotificationFilter;
|
|
205
|
+
}>;
|
|
206
|
+
}>;
|
|
207
|
+
read(notificationId: string): Promise<InboxNotification>;
|
|
208
|
+
unread(notificationId: string): Promise<InboxNotification>;
|
|
209
|
+
archive(notificationId: string): Promise<InboxNotification>;
|
|
210
|
+
unarchive(notificationId: string): Promise<InboxNotification>;
|
|
211
|
+
readAll({ tags }: {
|
|
212
|
+
tags?: string[];
|
|
213
|
+
}): Promise<void>;
|
|
214
|
+
archiveAll({ tags }: {
|
|
215
|
+
tags?: string[];
|
|
216
|
+
}): Promise<void>;
|
|
217
|
+
archiveAllRead({ tags }: {
|
|
218
|
+
tags?: string[];
|
|
219
|
+
}): Promise<void>;
|
|
220
|
+
completeAction({ actionType, notificationId, }: {
|
|
221
|
+
notificationId: string;
|
|
222
|
+
actionType: ActionTypeEnum;
|
|
223
|
+
}): Promise<InboxNotification>;
|
|
224
|
+
revertAction({ actionType, notificationId, }: {
|
|
225
|
+
notificationId: string;
|
|
226
|
+
actionType: ActionTypeEnum;
|
|
227
|
+
}): Promise<InboxNotification>;
|
|
228
|
+
fetchPreferences(): Promise<PreferencesResponse[]>;
|
|
229
|
+
updateGlobalPreferences(channelPreferences: ChannelPreference): Promise<PreferencesResponse>;
|
|
230
|
+
updateWorkflowPreferences({ workflowId, channelPreferences, }: {
|
|
231
|
+
workflowId: string;
|
|
232
|
+
channelPreferences: ChannelPreference;
|
|
233
|
+
}): Promise<PreferencesResponse>;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
declare class BaseModule {
|
|
237
|
+
#private;
|
|
238
|
+
protected _inboxService: InboxService;
|
|
239
|
+
protected _emitter: NovuEventEmitter;
|
|
240
|
+
constructor({ inboxServiceInstance, eventEmitterInstance, }: {
|
|
241
|
+
inboxServiceInstance: InboxService;
|
|
242
|
+
eventEmitterInstance: NovuEventEmitter;
|
|
243
|
+
});
|
|
244
|
+
protected onSessionSuccess(_: Session): void;
|
|
245
|
+
protected onSessionError(_: unknown): void;
|
|
246
|
+
callWithSession<T>(fn: () => Result<T>): Result<T>;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
declare class Notification implements Pick<NovuEventEmitter, 'on' | 'off'>, InboxNotification {
|
|
250
|
+
#private;
|
|
251
|
+
readonly id: InboxNotification['id'];
|
|
252
|
+
readonly subject?: InboxNotification['subject'];
|
|
253
|
+
readonly body: InboxNotification['body'];
|
|
254
|
+
readonly to: InboxNotification['to'];
|
|
255
|
+
readonly isRead: InboxNotification['isRead'];
|
|
256
|
+
readonly isArchived: InboxNotification['isArchived'];
|
|
257
|
+
readonly createdAt: InboxNotification['createdAt'];
|
|
258
|
+
readonly readAt?: InboxNotification['readAt'];
|
|
259
|
+
readonly archivedAt?: InboxNotification['archivedAt'];
|
|
260
|
+
readonly avatar?: InboxNotification['avatar'];
|
|
261
|
+
readonly primaryAction?: InboxNotification['primaryAction'];
|
|
262
|
+
readonly secondaryAction?: InboxNotification['secondaryAction'];
|
|
263
|
+
readonly channelType: InboxNotification['channelType'];
|
|
264
|
+
readonly tags: InboxNotification['tags'];
|
|
265
|
+
readonly redirect: InboxNotification['redirect'];
|
|
266
|
+
readonly data?: InboxNotification['data'];
|
|
267
|
+
constructor(notification: InboxNotification, emitter: NovuEventEmitter, inboxService: InboxService);
|
|
268
|
+
read(): Result<Notification>;
|
|
269
|
+
unread(): Result<Notification>;
|
|
270
|
+
archive(): Result<Notification>;
|
|
271
|
+
unarchive(): Result<Notification>;
|
|
272
|
+
completePrimary(): Result<Notification>;
|
|
273
|
+
completeSecondary(): Result<Notification>;
|
|
274
|
+
revertPrimary(): Result<Notification>;
|
|
275
|
+
revertSecondary(): Result<Notification>;
|
|
276
|
+
on<Key extends EventNames>(eventName: Key, listener: EventHandler<Events[Key]>): void;
|
|
277
|
+
off<Key extends EventNames>(eventName: Key, listener: EventHandler<Events[Key]>): void;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
type ListNotificationsArgs = {
|
|
281
|
+
tags?: string[];
|
|
282
|
+
read?: boolean;
|
|
283
|
+
archived?: boolean;
|
|
284
|
+
limit?: number;
|
|
285
|
+
after?: string;
|
|
286
|
+
offset?: number;
|
|
287
|
+
};
|
|
288
|
+
type ListNotificationsResponse = {
|
|
289
|
+
notifications: Notification[];
|
|
290
|
+
hasMore: boolean;
|
|
291
|
+
filter: NotificationFilter;
|
|
292
|
+
};
|
|
293
|
+
type FilterCountArgs = {
|
|
294
|
+
tags?: string[];
|
|
295
|
+
read?: boolean;
|
|
296
|
+
archived?: boolean;
|
|
297
|
+
};
|
|
298
|
+
type FiltersCountArgs = {
|
|
299
|
+
filters: Array<{
|
|
300
|
+
tags?: string[];
|
|
301
|
+
read?: boolean;
|
|
302
|
+
archived?: boolean;
|
|
303
|
+
}>;
|
|
304
|
+
};
|
|
305
|
+
type CountArgs = undefined | FilterCountArgs | FiltersCountArgs;
|
|
306
|
+
type FilterCountResponse = {
|
|
307
|
+
count: number;
|
|
308
|
+
filter: NotificationFilter;
|
|
309
|
+
};
|
|
310
|
+
type FiltersCountResponse = {
|
|
311
|
+
counts: Array<{
|
|
312
|
+
count: number;
|
|
313
|
+
filter: NotificationFilter;
|
|
314
|
+
}>;
|
|
315
|
+
};
|
|
316
|
+
type CountResponse = FilterCountResponse | FiltersCountResponse;
|
|
317
|
+
type BaseArgs = {
|
|
318
|
+
notificationId: string;
|
|
319
|
+
};
|
|
320
|
+
type InstanceArgs = {
|
|
321
|
+
notification: Notification;
|
|
322
|
+
};
|
|
323
|
+
type ReadArgs = BaseArgs | InstanceArgs;
|
|
324
|
+
type UnreadArgs = BaseArgs | InstanceArgs;
|
|
325
|
+
type ArchivedArgs = BaseArgs | InstanceArgs;
|
|
326
|
+
type UnarchivedArgs = BaseArgs | InstanceArgs;
|
|
327
|
+
type CompleteArgs = BaseArgs | InstanceArgs;
|
|
328
|
+
type RevertArgs = BaseArgs | InstanceArgs;
|
|
329
|
+
|
|
330
|
+
declare class NotificationsCache {
|
|
331
|
+
#private;
|
|
332
|
+
constructor({ emitter }: {
|
|
333
|
+
emitter: NovuEventEmitter;
|
|
334
|
+
});
|
|
335
|
+
private updateNotification;
|
|
336
|
+
private removeNotification;
|
|
337
|
+
private handleNotificationEvent;
|
|
338
|
+
private getAggregated;
|
|
339
|
+
has(args: ListNotificationsArgs): boolean;
|
|
340
|
+
set(args: ListNotificationsArgs, data: ListNotificationsResponse): void;
|
|
341
|
+
update(args: ListNotificationsArgs, data: ListNotificationsResponse): void;
|
|
342
|
+
getAll(args: ListNotificationsArgs): ListNotificationsResponse | undefined;
|
|
343
|
+
/**
|
|
344
|
+
* Get unique notifications based on specified filter fields.
|
|
345
|
+
* The same tags can be applied to multiple filters which means that the same notification can be duplicated.
|
|
346
|
+
*/
|
|
347
|
+
getUniqueNotifications({ tags, read }: Pick<ListNotificationsArgs, 'tags' | 'read'>): Array<Notification>;
|
|
348
|
+
clear(filter: NotificationFilter): void;
|
|
349
|
+
clearAll(): void;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
declare class Notifications extends BaseModule {
|
|
353
|
+
#private;
|
|
354
|
+
readonly cache: NotificationsCache;
|
|
355
|
+
constructor({ useCache, inboxServiceInstance, eventEmitterInstance, }: {
|
|
356
|
+
useCache: boolean;
|
|
357
|
+
inboxServiceInstance: InboxService;
|
|
358
|
+
eventEmitterInstance: NovuEventEmitter;
|
|
359
|
+
});
|
|
360
|
+
list({ limit, ...restOptions }?: ListNotificationsArgs): Result<ListNotificationsResponse>;
|
|
361
|
+
count(args?: FilterCountArgs): Result<FilterCountResponse>;
|
|
362
|
+
count(args?: FiltersCountArgs): Result<FiltersCountResponse>;
|
|
363
|
+
read(args: BaseArgs): Result<Notification>;
|
|
364
|
+
read(args: InstanceArgs): Result<Notification>;
|
|
365
|
+
unread(args: BaseArgs): Result<Notification>;
|
|
366
|
+
unread(args: InstanceArgs): Result<Notification>;
|
|
367
|
+
archive(args: BaseArgs): Result<Notification>;
|
|
368
|
+
archive(args: InstanceArgs): Result<Notification>;
|
|
369
|
+
unarchive(args: BaseArgs): Result<Notification>;
|
|
370
|
+
unarchive(args: InstanceArgs): Result<Notification>;
|
|
371
|
+
completePrimary(args: BaseArgs): Result<Notification>;
|
|
372
|
+
completePrimary(args: InstanceArgs): Result<Notification>;
|
|
373
|
+
completeSecondary(args: BaseArgs): Result<Notification>;
|
|
374
|
+
completeSecondary(args: InstanceArgs): Result<Notification>;
|
|
375
|
+
revertPrimary(args: BaseArgs): Result<Notification>;
|
|
376
|
+
revertPrimary(args: InstanceArgs): Result<Notification>;
|
|
377
|
+
revertSecondary(args: BaseArgs): Result<Notification>;
|
|
378
|
+
revertSecondary(args: InstanceArgs): Result<Notification>;
|
|
379
|
+
readAll({ tags }?: {
|
|
380
|
+
tags?: NotificationFilter['tags'];
|
|
381
|
+
}): Result<void>;
|
|
382
|
+
archiveAll({ tags }?: {
|
|
383
|
+
tags?: NotificationFilter['tags'];
|
|
384
|
+
}): Result<void>;
|
|
385
|
+
archiveAllRead({ tags }?: {
|
|
386
|
+
tags?: NotificationFilter['tags'];
|
|
387
|
+
}): Result<void>;
|
|
388
|
+
clearCache({ filter }?: {
|
|
389
|
+
filter?: NotificationFilter;
|
|
390
|
+
}): void;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
type UpdatePreferencesArgs = {
|
|
394
|
+
workflowId?: string;
|
|
395
|
+
channelPreferences: ChannelPreference;
|
|
396
|
+
preference?: {
|
|
397
|
+
level: PreferenceLevel;
|
|
398
|
+
enabled: boolean;
|
|
399
|
+
channels: ChannelPreference;
|
|
400
|
+
workflow?: Workflow;
|
|
401
|
+
};
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
type InitializeSessionArgs = {
|
|
405
|
+
applicationIdentifier: string;
|
|
406
|
+
subscriberId: string;
|
|
407
|
+
subscriberHash?: string;
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
type NovuPendingEvent<A, D = undefined> = {
|
|
411
|
+
args: A;
|
|
412
|
+
data?: D;
|
|
413
|
+
};
|
|
414
|
+
type NovuResolvedEvent<A, D> = NovuPendingEvent<A, D> & {
|
|
415
|
+
error?: unknown;
|
|
416
|
+
};
|
|
417
|
+
type EventName<T extends string> = `${T}.pending` | `${T}.resolved`;
|
|
418
|
+
type EventStatus<T extends string> = `${T extends `${infer _}.${infer __}.${infer V}` ? V : never}`;
|
|
419
|
+
type EventObject<K extends string, ARGS, DATA, EVENT_STATUS = EventStatus<K>> = EVENT_STATUS extends 'pending' ? NovuPendingEvent<ARGS, DATA> : NovuResolvedEvent<ARGS, DATA>;
|
|
420
|
+
type BaseEvents<T extends string, ARGS, DATA> = {
|
|
421
|
+
[key in `${EventName<T>}`]: EventObject<key, ARGS, DATA>;
|
|
422
|
+
};
|
|
423
|
+
type SessionInitializeEvents = BaseEvents<'session.initialize', InitializeSessionArgs, Session>;
|
|
424
|
+
type NotificationsFetchEvents = BaseEvents<'notifications.list', ListNotificationsArgs, ListNotificationsResponse>;
|
|
425
|
+
type NotificationsFetchCountEvents = BaseEvents<'notifications.count', CountArgs, CountResponse>;
|
|
426
|
+
type NotificationReadEvents = BaseEvents<'notification.read', ReadArgs, Notification>;
|
|
427
|
+
type NotificationUnreadEvents = BaseEvents<'notification.unread', UnreadArgs, Notification>;
|
|
428
|
+
type NotificationArchiveEvents = BaseEvents<'notification.archive', ArchivedArgs, Notification>;
|
|
429
|
+
type NotificationUnarchiveEvents = BaseEvents<'notification.unarchive', UnarchivedArgs, Notification>;
|
|
430
|
+
type NotificationCompleteActionEvents = BaseEvents<'notification.complete_action', CompleteArgs, Notification>;
|
|
431
|
+
type NotificationRevertActionEvents = BaseEvents<'notification.revert_action', RevertArgs, Notification>;
|
|
432
|
+
type NotificationsReadAllEvents = BaseEvents<'notifications.read_all', {
|
|
433
|
+
tags?: string[];
|
|
434
|
+
}, Notification[]>;
|
|
435
|
+
type NotificationsArchivedAllEvents = BaseEvents<'notifications.archive_all', {
|
|
436
|
+
tags?: string[];
|
|
437
|
+
}, Notification[]>;
|
|
438
|
+
type NotificationsReadArchivedAllEvents = BaseEvents<'notifications.archive_all_read', {
|
|
439
|
+
tags?: string[];
|
|
440
|
+
}, Notification[]>;
|
|
441
|
+
type PreferencesFetchEvents = BaseEvents<'preferences.list', undefined, Preference[]>;
|
|
442
|
+
type PreferenceUpdateEvents = BaseEvents<'preference.update', UpdatePreferencesArgs, Preference>;
|
|
443
|
+
type SocketConnectEvents = BaseEvents<'socket.connect', {
|
|
444
|
+
socketUrl: string;
|
|
445
|
+
}, undefined>;
|
|
446
|
+
type NotificationReceivedEvent = `notifications.${WebSocketEvent.RECEIVED}`;
|
|
447
|
+
type NotificationUnseenEvent = `notifications.${WebSocketEvent.UNSEEN}`;
|
|
448
|
+
type NotificationUnreadEvent = `notifications.${WebSocketEvent.UNREAD}`;
|
|
449
|
+
type SocketEvents = {
|
|
450
|
+
[key in NotificationReceivedEvent]: {
|
|
451
|
+
result: Notification;
|
|
452
|
+
};
|
|
453
|
+
} & {
|
|
454
|
+
[key in NotificationUnseenEvent]: {
|
|
455
|
+
result: number;
|
|
456
|
+
};
|
|
457
|
+
} & {
|
|
458
|
+
[key in NotificationUnreadEvent]: {
|
|
459
|
+
result: number;
|
|
460
|
+
};
|
|
461
|
+
};
|
|
462
|
+
/**
|
|
463
|
+
* Events that are emitted by Novu Event Emitter.
|
|
464
|
+
*
|
|
465
|
+
* The event name consists of second pattern: module.action.status
|
|
466
|
+
* - module: the name of the module
|
|
467
|
+
* - action: the action that is being performed
|
|
468
|
+
* - status: the status of the action, could be pending or resolved
|
|
469
|
+
*
|
|
470
|
+
* Each event has a corresponding payload that is associated with the event:
|
|
471
|
+
* - pending: the args that are passed to the action and the optional optimistic value
|
|
472
|
+
* - resolved: the args that are passed to the action and the result of the action or the error that is thrown
|
|
473
|
+
*/
|
|
474
|
+
type Events = SessionInitializeEvents & NotificationsFetchEvents & {
|
|
475
|
+
'notifications.list.updated': {
|
|
476
|
+
data: ListNotificationsResponse;
|
|
477
|
+
};
|
|
478
|
+
} & NotificationsFetchCountEvents & PreferencesFetchEvents & {
|
|
479
|
+
'preferences.list.updated': {
|
|
480
|
+
data: Preference[];
|
|
481
|
+
};
|
|
482
|
+
} & PreferenceUpdateEvents & SocketConnectEvents & SocketEvents & NotificationReadEvents & NotificationUnreadEvents & NotificationArchiveEvents & NotificationUnarchiveEvents & NotificationCompleteActionEvents & NotificationRevertActionEvents & NotificationsReadAllEvents & NotificationsArchivedAllEvents & NotificationsReadArchivedAllEvents;
|
|
483
|
+
type EventNames = keyof Events;
|
|
484
|
+
type SocketEventNames = keyof SocketEvents;
|
|
485
|
+
type EventHandler<T = unknown> = (event: T) => void;
|
|
486
|
+
|
|
487
|
+
declare class NovuEventEmitter {
|
|
488
|
+
#private;
|
|
489
|
+
constructor();
|
|
490
|
+
on<Key extends EventNames>(eventName: Key, listener: EventHandler<Events[Key]>): void;
|
|
491
|
+
off<Key extends EventNames>(eventName: Key, listener: EventHandler<Events[Key]>): void;
|
|
492
|
+
emit<Key extends EventNames>(type: Key, event?: Events[Key]): void;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
declare class PreferencesCache {
|
|
496
|
+
#private;
|
|
497
|
+
constructor({ emitterInstance }: {
|
|
498
|
+
emitterInstance: NovuEventEmitter;
|
|
499
|
+
});
|
|
500
|
+
private updatePreference;
|
|
501
|
+
private handlePreferenceEvent;
|
|
502
|
+
set(data: Preference[]): void;
|
|
503
|
+
getAll(): Preference[] | undefined;
|
|
504
|
+
clearAll(): void;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
declare class Preferences extends BaseModule {
|
|
508
|
+
#private;
|
|
509
|
+
readonly cache: PreferencesCache;
|
|
510
|
+
constructor({ useCache, inboxServiceInstance, eventEmitterInstance, }: {
|
|
511
|
+
useCache: boolean;
|
|
512
|
+
inboxServiceInstance: InboxService;
|
|
513
|
+
eventEmitterInstance: NovuEventEmitter;
|
|
514
|
+
});
|
|
515
|
+
list(): Result<Preference[]>;
|
|
516
|
+
update(args: UpdatePreferencesArgs): Result<Preference>;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
declare class Novu implements Pick<NovuEventEmitter, 'on' | 'off'> {
|
|
520
|
+
#private;
|
|
521
|
+
readonly notifications: Notifications;
|
|
522
|
+
readonly preferences: Preferences;
|
|
523
|
+
on: <Key extends EventNames>(eventName: Key, listener: EventHandler<Events[Key]>) => void;
|
|
524
|
+
off: <Key extends EventNames>(eventName: Key, listener: EventHandler<Events[Key]>) => void;
|
|
525
|
+
constructor(options: NovuOptions);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
export { ActionTypeEnum as A, CtaType as C, type EventHandler as E, type FiltersCountResponse as F, type InboxNotification as I, type ListNotificationsResponse as L, type MessageButton as M, type NotificationFilter as N, PreferenceLevel as P, type Redirect as R, type SocketEventNames as S, type TODO as T, WebSocketEvent as W, type Events as a, Novu as b, NotificationStatus as c, NotificationButton as d, NotificationActionStatus as e, ChannelType as f, PreferenceOverrideSource as g, type Session as h, type MessageAction as i, type Subscriber as j, type Action as k, type Workflow as l, type ChannelPreference as m, type PaginatedResponse as n, type PreferencesResponse as o, PreferenceOverrideSourceEnum as p, type IPreferenceOverride as q, type Result as r, type NovuOptions as s, Notification as t, Preference as u, NovuError as v };
|