@novu/js 2.6.6 → 3.0.0-canary.0

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.
@@ -1,5 +1,5 @@
1
- import { N as NotificationFilter } from './novu-DbpFmjhC.mjs';
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, u as Notification, e as NotificationActionStatus, d as NotificationButton, c as NotificationStatus, b as Novu, w as NovuError, s as NovuOptions, n as PaginatedResponse, v as Preference, P as PreferenceLevel, g as PreferenceOverrideSource, p as PreferenceOverrideSourceEnum, o as PreferencesResponse, t as Prettify, 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-DbpFmjhC.mjs';
1
+ import { N as NotificationFilter } from './novu-C2hAbM3b.mjs';
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, u as Notification, e as NotificationActionStatus, d as NotificationButton, c as NotificationStatus, b as Novu, w as NovuError, s as NovuOptions, n as PaginatedResponse, v as Preference, P as PreferenceLevel, g as PreferenceOverrideSource, p as PreferenceOverrideSourceEnum, o as PreferencesResponse, t as Prettify, 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-C2hAbM3b.mjs';
3
3
 
4
4
  declare const areTagsEqual: (tags1?: string[], tags2?: string[]) => boolean;
5
5
  declare const isSameFilter: (filter1: NotificationFilter, filter2: NotificationFilter) => boolean;
@@ -1,2 +1,2 @@
1
- export { ActionTypeEnum, ChannelType, CtaType, NotificationActionStatus, NotificationButton, NotificationStatus, Novu, PreferenceLevel, PreferenceOverrideSource, PreferenceOverrideSourceEnum, WebSocketEvent, areTagsEqual, isSameFilter } from './chunk-JJC36NOH.mjs';
1
+ export { ActionTypeEnum, ChannelType, CtaType, NotificationActionStatus, NotificationButton, NotificationStatus, Novu, PreferenceLevel, PreferenceOverrideSource, PreferenceOverrideSourceEnum, WebSocketEvent, areTagsEqual, isSameFilter } from './chunk-B2OUPMZV.mjs';
2
2
  import './chunk-STZMOEWR.mjs';
@@ -9,6 +9,7 @@ type ListPreferencesArgs = {
9
9
  type UpdatePreferencesArgs = {
10
10
  workflowId?: string;
11
11
  channels: ChannelPreference;
12
+ /** @deprecated Use channels instead */
12
13
  channelPreferences?: ChannelPreference;
13
14
  preference?: {
14
15
  level: PreferenceLevel;
@@ -44,7 +45,9 @@ declare class Preference {
44
45
  cache: PreferencesCache;
45
46
  useCache: boolean;
46
47
  });
47
- update({ channels, channelPreferences, }: Prettify<Pick<UpdatePreferencesArgs, 'channels' | 'channelPreferences'>>): Result<Preference>;
48
+ update({ channels,
49
+ /** @deprecated Use channels instead */
50
+ channelPreferences, }: Prettify<Pick<UpdatePreferencesArgs, 'channels' | 'channelPreferences'>>): Result<Preference>;
48
51
  }
49
52
 
50
53
  declare enum NotificationStatus {
@@ -192,13 +195,12 @@ type NovuOptions = {
192
195
  applicationIdentifier: string;
193
196
  subscriberId: string;
194
197
  subscriberHash?: string;
198
+ /** @deprecated Use apiUrl instead */
195
199
  backendUrl?: string;
196
200
  apiUrl?: string;
197
201
  socketUrl?: string;
198
202
  useCache?: boolean;
199
- /**
200
- * @internal Should be used internally
201
- */
203
+ /** @internal Should be used internally for testing purposes */
202
204
  __userAgent?: string;
203
205
  };
204
206
  type Prettify<T> = {
@@ -538,10 +540,24 @@ declare class Preferences extends BaseModule {
538
540
  list(args?: ListPreferencesArgs): Result<Preference[]>;
539
541
  }
540
542
 
543
+ declare class Socket extends BaseModule {
544
+ #private;
545
+ constructor({ socketUrl, inboxServiceInstance, eventEmitterInstance, }: {
546
+ socketUrl?: string;
547
+ inboxServiceInstance: InboxService;
548
+ eventEmitterInstance: NovuEventEmitter;
549
+ });
550
+ protected onSessionSuccess({ token }: Session): void;
551
+ isSocketEvent(eventName: string): eventName is SocketEventNames;
552
+ connect(): Result<void>;
553
+ disconnect(): Result<void>;
554
+ }
555
+
541
556
  declare class Novu implements Pick<NovuEventEmitter, 'on'> {
542
557
  #private;
543
558
  readonly notifications: Notifications;
544
559
  readonly preferences: Preferences;
560
+ readonly socket: Socket;
545
561
  on: <Key extends EventNames>(eventName: Key, listener: EventHandler<Events[Key]>) => () => void;
546
562
  /**
547
563
  * @deprecated
@@ -1,5 +1,5 @@
1
- import { g as Theme } from '../types-DVZXB5KI.mjs';
2
- import '../novu-DbpFmjhC.mjs';
1
+ import { h as Theme } from '../types-Bi5NkU2g.mjs';
2
+ import '../novu-C2hAbM3b.mjs';
3
3
 
4
4
  declare const dark: Theme;
5
5
 
@@ -4,11 +4,12 @@ import '../chunk-STZMOEWR.mjs';
4
4
  var dark = {
5
5
  variables: {
6
6
  colorNeutral: "white",
7
- colorBackground: "#161618",
7
+ colorBackground: "#1A1A1A",
8
8
  colorForeground: "#EDEDEF",
9
- colorSecondary: "#7E7D86",
9
+ colorSecondary: "#383838",
10
10
  colorSecondaryForeground: "#EDEDEF",
11
- colorShadow: "black"
11
+ colorShadow: "black",
12
+ colorRing: "#E1E4EA"
12
13
  }
13
14
  };
14
15
 
@@ -0,0 +1,102 @@
1
+ import { u as Notification, N as NotificationFilter, s as NovuOptions, b as Novu } from './novu-C2hAbM3b.mjs';
2
+
3
+ declare const appearanceKeys: readonly ["button", "icon", "popoverContent", "popoverTrigger", "dropdownContent", "dropdownTrigger", "dropdownItem", "dropdownItemLabel", "dropdownItemLabelContainer", "dropdownItemLeft__icon", "dropdownItemRight__icon", "dropdownItem__icon", "collapsible", "tooltipContent", "tooltipTrigger", "back__button", "skeletonText", "skeletonAvatar", "skeletonSwitch", "skeletonSwitchThumb", "tabsRoot", "tabsList", "tabsContent", "tabsTrigger", "dots", "root", "bellIcon", "bellContainer", "bellDot", "preferences__button", "preferencesContainer", "inboxHeader", "loading", "inboxContent", "inbox__popoverTrigger", "inbox__popoverContent", "notificationListContainer", "notificationList", "notificationListEmptyNoticeContainer", "notificationListEmptyNoticeOverlay", "notificationListEmptyNoticeIcon", "notificationListEmptyNotice", "notificationList__skeleton", "notificationList__skeletonContent", "notificationList__skeletonItem", "notificationList__skeletonAvatar", "notificationList__skeletonText", "notificationListNewNotificationsNotice__button", "notification", "notificationContent", "notificationTextContainer", "notificationDot", "notificationSubject", "notificationSubject__strong", "notificationBody", "notificationBody__strong", "notificationBodyContainer", "notificationImage", "notificationImageLoadingFallback", "notificationDate", "notificationDateActionsContainer", "notificationDefaultActions", "notificationCustomActions", "notificationPrimaryAction__button", "notificationSecondaryAction__button", "notificationRead__button", "notificationUnread__button", "notificationArchive__button", "notificationUnarchive__button", "notificationRead__icon", "notificationUnread__icon", "notificationArchive__icon", "notificationUnarchive__icon", "notificationsTabs__tabsRoot", "notificationsTabs__tabsList", "notificationsTabs__tabsContent", "notificationsTabs__tabsTrigger", "notificationsTabsTriggerLabel", "notificationsTabsTriggerCount", "inboxStatus__title", "inboxStatus__dropdownTrigger", "inboxStatus__dropdownContent", "inboxStatus__dropdownItem", "inboxStatus__dropdownItemLabel", "inboxStatus__dropdownItemLabelContainer", "inboxStatus__dropdownItemLeft__icon", "inboxStatus__dropdownItemRight__icon", "inboxStatus__dropdownItem__icon", "inboxStatus__dropdownItemCheck__icon", "moreActionsContainer", "moreActions__dropdownTrigger", "moreActions__dropdownContent", "moreActions__dropdownItem", "moreActions__dropdownItemLabel", "moreActions__dropdownItemLeft__icon", "moreActions__dots", "moreTabs__button", "moreTabs__icon", "moreTabs__dropdownTrigger", "moreTabs__dropdownContent", "moreTabs__dropdownItem", "moreTabs__dropdownItemLabel", "moreTabs__dropdownItemRight__icon", "workflowContainer", "workflowLabel", "workflowLabelHeader", "workflowLabelContainer", "workflowContainerDisabledNotice", "workflowLabelDisabled__icon", "workflowContainerRight__icon", "workflowArrow__icon", "workflowDescription", "channelContainer", "channelIconContainer", "channel__icon", "channelsContainerCollapsible", "channelsContainer", "channelLabel", "channelLabelContainer", "channelName", "channelSwitchContainer", "channelSwitch", "channelSwitchThumb", "preferencesHeader", "preferencesHeader__back__button", "preferencesHeader__back__button__icon", "preferencesHeader__title", "preferencesHeader__icon", "preferencesListEmptyNoticeContainer", "preferencesListEmptyNotice", "preferencesList__skeleton", "preferencesList__skeletonContent", "preferencesList__skeletonItem", "preferencesList__skeletonIcon", "preferencesList__skeletonSwitch", "preferencesList__skeletonSwitchThumb", "preferencesList__skeletonText", "strong"];
4
+
5
+ declare const defaultLocalization: {
6
+ readonly locale: "en-US";
7
+ readonly 'inbox.filters.dropdownOptions.unread': "Unread only";
8
+ readonly 'inbox.filters.dropdownOptions.default': "Unread & read";
9
+ readonly 'inbox.filters.dropdownOptions.archived': "Archived";
10
+ readonly 'inbox.filters.labels.unread': "Unread";
11
+ readonly 'inbox.filters.labels.default': "Inbox";
12
+ readonly 'inbox.filters.labels.archived': "Archived";
13
+ readonly 'notifications.emptyNotice': "Quiet for now. Check back later.";
14
+ readonly 'notifications.actions.readAll': "Mark all as read";
15
+ readonly 'notifications.actions.archiveAll': "Archive all";
16
+ readonly 'notifications.actions.archiveRead': "Archive read";
17
+ readonly 'notifications.newNotifications': ({ notificationCount }: {
18
+ notificationCount: number;
19
+ }) => string;
20
+ readonly 'notification.actions.read.tooltip': "Mark as read";
21
+ readonly 'notification.actions.unread.tooltip': "Mark as unread";
22
+ readonly 'notification.actions.archive.tooltip': "Archive";
23
+ readonly 'notification.actions.unarchive.tooltip': "Unarchive";
24
+ readonly 'preferences.title': "Preferences";
25
+ readonly 'preferences.emptyNotice': "No notification specific preferences yet.";
26
+ readonly 'preferences.global': "Global Preferences";
27
+ readonly 'preferences.workflow.disabled.notice': "Contact admin to enable subscription management for this critical notification.";
28
+ readonly 'preferences.workflow.disabled.tooltip': "Contact admin to edit";
29
+ };
30
+
31
+ type LocalizationKey = keyof typeof defaultLocalization;
32
+ type Localization = {
33
+ [K in LocalizationKey]?: (typeof defaultLocalization)[K] extends (...args: infer P) => any ? ((...args: P) => ReturnType<(typeof defaultLocalization)[K]>) | string : string;
34
+ } & {
35
+ dynamic?: Record<string, string>;
36
+ };
37
+
38
+ type NotificationClickHandler = (notification: Notification) => void;
39
+ type NotificationActionClickHandler = (notification: Notification) => void;
40
+ type NotificationRenderer = (el: HTMLDivElement, notification: Notification) => () => void;
41
+ type SubjectRenderer = (el: HTMLDivElement, notification: Notification) => () => void;
42
+ type BodyRenderer = (el: HTMLDivElement, notification: Notification) => () => void;
43
+ type BellRenderer = (el: HTMLDivElement, unreadCount: number) => () => void;
44
+ type RouterPush = (path: string) => void;
45
+ type Tab = {
46
+ label: string;
47
+ /**
48
+ * @deprecated Use `filter` instead
49
+ */
50
+ value?: Array<string>;
51
+ filter?: Pick<NotificationFilter, 'tags'>;
52
+ };
53
+ type CSSProperties = {
54
+ [key: string]: string | number;
55
+ };
56
+ type ElementStyles = string | CSSProperties;
57
+ type Variables = {
58
+ colorBackground?: string;
59
+ colorForeground?: string;
60
+ colorPrimary?: string;
61
+ colorPrimaryForeground?: string;
62
+ colorSecondary?: string;
63
+ colorSecondaryForeground?: string;
64
+ colorCounter?: string;
65
+ colorCounterForeground?: string;
66
+ colorNeutral?: string;
67
+ colorShadow?: string;
68
+ colorRing?: string;
69
+ fontSize?: string;
70
+ borderRadius?: string;
71
+ };
72
+ type AppearanceKey = (typeof appearanceKeys)[number];
73
+ type Elements = Partial<Record<AppearanceKey, ElementStyles>>;
74
+ type Theme = {
75
+ variables?: Variables;
76
+ elements?: Elements;
77
+ animations?: boolean;
78
+ };
79
+ type Appearance = Theme & {
80
+ baseTheme?: Theme | Theme[];
81
+ };
82
+ type BaseNovuProviderProps = {
83
+ appearance?: Appearance;
84
+ localization?: Localization;
85
+ options: NovuOptions;
86
+ tabs?: Array<Tab>;
87
+ preferencesFilter?: PreferencesFilter;
88
+ routerPush?: RouterPush;
89
+ novu?: Novu;
90
+ };
91
+ type NovuProviderProps = BaseNovuProviderProps & {
92
+ renderNotification?: NotificationRenderer;
93
+ renderBell?: BellRenderer;
94
+ };
95
+ declare enum NotificationStatus {
96
+ UNREAD_READ = "unreadRead",
97
+ UNREAD = "unread",
98
+ ARCHIVED = "archived"
99
+ }
100
+ type PreferencesFilter = Pick<NotificationFilter, 'tags'>;
101
+
102
+ export { type Appearance as A, type BellRenderer as B, type CSSProperties as C, type ElementStyles as E, type Localization as L, type NotificationClickHandler as N, type PreferencesFilter as P, type RouterPush as R, type SubjectRenderer as S, type Tab as T, type Variables as V, type NotificationActionClickHandler as a, type NotificationRenderer as b, type BodyRenderer as c, type NovuProviderProps as d, type BaseNovuProviderProps as e, type AppearanceKey as f, type Elements as g, type Theme as h, NotificationStatus as i, type LocalizationKey as j };
@@ -1,34 +1,47 @@
1
- import { s as NovuOptions } from '../novu-DbpFmjhC.mjs';
2
- export { u as Notification } from '../novu-DbpFmjhC.mjs';
3
- import { N as NotificationRenderer, B as BellRenderer, a as NotificationClickHandler, b as NotificationActionClickHandler, c as NovuProviderProps, d as BaseNovuProviderProps, A as Appearance, L as Localization, T as Tab, P as PreferencesFilter, R as RouterPush } from '../types-DVZXB5KI.mjs';
4
- export { e as AppearanceKey, C as CSSProperties, E as ElementStyles, f as Elements, i as LocalizationKey, h as NotificationStatus, g as Theme, V as Variables } from '../types-DVZXB5KI.mjs';
1
+ import { s as NovuOptions } from '../novu-C2hAbM3b.mjs';
2
+ export { u as Notification } from '../novu-C2hAbM3b.mjs';
3
+ import { B as BellRenderer, N as NotificationClickHandler, a as NotificationActionClickHandler, b as NotificationRenderer, S as SubjectRenderer, c as BodyRenderer, d as NovuProviderProps, e as BaseNovuProviderProps, A as Appearance, L as Localization, T as Tab, P as PreferencesFilter, R as RouterPush } from '../types-Bi5NkU2g.mjs';
4
+ export { f as AppearanceKey, C as CSSProperties, E as ElementStyles, g as Elements, j as LocalizationKey, i as NotificationStatus, h as Theme, V as Variables } from '../types-Bi5NkU2g.mjs';
5
5
  import { Placement, OffsetOptions } from '@floating-ui/dom';
6
6
  import * as solid_js from 'solid-js';
7
7
  import { ComponentProps } from 'solid-js';
8
8
  import { MountableElement } from 'solid-js/web';
9
9
 
10
+ type NotificationRendererProps = {
11
+ renderNotification: NotificationRenderer;
12
+ renderSubject?: never;
13
+ renderBody?: never;
14
+ };
15
+ type SubjectBodyRendererProps = {
16
+ renderNotification?: never;
17
+ renderSubject?: SubjectRenderer;
18
+ renderBody?: BodyRenderer;
19
+ };
20
+ type NoRendererProps = {
21
+ renderNotification?: undefined;
22
+ renderSubject?: undefined;
23
+ renderBody?: undefined;
24
+ };
10
25
  type InboxProps = {
11
26
  open?: boolean;
12
- renderNotification?: NotificationRenderer;
13
27
  renderBell?: BellRenderer;
14
28
  onNotificationClick?: NotificationClickHandler;
15
29
  onPrimaryActionClick?: NotificationActionClickHandler;
16
30
  onSecondaryActionClick?: NotificationActionClickHandler;
17
31
  placement?: Placement;
18
32
  placementOffset?: OffsetOptions;
19
- };
33
+ } & (NotificationRendererProps | SubjectBodyRendererProps | NoRendererProps);
20
34
  declare enum InboxPage {
21
35
  Notifications = "notifications",
22
36
  Preferences = "preferences"
23
37
  }
24
38
  type InboxContentProps = {
25
- renderNotification?: NotificationRenderer;
26
39
  onNotificationClick?: NotificationClickHandler;
27
40
  onPrimaryActionClick?: NotificationActionClickHandler;
28
41
  onSecondaryActionClick?: NotificationActionClickHandler;
29
42
  initialPage?: InboxPage;
30
43
  hideNav?: boolean;
31
- };
44
+ } & (NotificationRendererProps | SubjectBodyRendererProps | NoRendererProps);
32
45
 
33
46
  declare const novuComponents: {
34
47
  Inbox: (props: InboxProps) => solid_js.JSX.Element;
@@ -62,4 +75,4 @@ declare class NovuUI {
62
75
  unmount(): void;
63
76
  }
64
77
 
65
- export { Appearance, BaseNovuProviderProps, type BaseNovuUIOptions, BellRenderer, InboxPage, type InboxProps, Localization, NotificationActionClickHandler, NotificationClickHandler, NotificationRenderer, NovuProviderProps, NovuUI, type NovuUIOptions, PreferencesFilter, RouterPush, Tab };
78
+ export { Appearance, BaseNovuProviderProps, type BaseNovuUIOptions, BellRenderer, BodyRenderer, InboxPage, type InboxProps, Localization, NotificationActionClickHandler, NotificationClickHandler, NotificationRenderer, NovuProviderProps, NovuUI, type NovuUIOptions, PreferencesFilter, RouterPush, SubjectRenderer, Tab };