@novu/js 2.1.0 → 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.
@@ -1,5 +1,5 @@
1
- import { N as NotificationFilter } from './novu-PgupDkfH.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-PgupDkfH.js';
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
3
  import '@novu/client';
4
4
 
5
5
  declare const areTagsEqual: (tags1?: string[], tags2?: string[]) => boolean;
package/dist/cjs/index.js CHANGED
@@ -1,58 +1,58 @@
1
1
  'use strict';
2
2
 
3
- var chunkUUYKXZBW_js = require('./chunk-UUYKXZBW.js');
3
+ var chunkD7P7KCZI_js = require('./chunk-D7P7KCZI.js');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "ActionTypeEnum", {
8
8
  enumerable: true,
9
- get: function () { return chunkUUYKXZBW_js.ActionTypeEnum; }
9
+ get: function () { return chunkD7P7KCZI_js.ActionTypeEnum; }
10
10
  });
11
11
  Object.defineProperty(exports, "ChannelType", {
12
12
  enumerable: true,
13
- get: function () { return chunkUUYKXZBW_js.ChannelType; }
13
+ get: function () { return chunkD7P7KCZI_js.ChannelType; }
14
14
  });
15
15
  Object.defineProperty(exports, "CtaType", {
16
16
  enumerable: true,
17
- get: function () { return chunkUUYKXZBW_js.CtaType; }
17
+ get: function () { return chunkD7P7KCZI_js.CtaType; }
18
18
  });
19
19
  Object.defineProperty(exports, "NotificationActionStatus", {
20
20
  enumerable: true,
21
- get: function () { return chunkUUYKXZBW_js.NotificationActionStatus; }
21
+ get: function () { return chunkD7P7KCZI_js.NotificationActionStatus; }
22
22
  });
23
23
  Object.defineProperty(exports, "NotificationButton", {
24
24
  enumerable: true,
25
- get: function () { return chunkUUYKXZBW_js.NotificationButton; }
25
+ get: function () { return chunkD7P7KCZI_js.NotificationButton; }
26
26
  });
27
27
  Object.defineProperty(exports, "NotificationStatus", {
28
28
  enumerable: true,
29
- get: function () { return chunkUUYKXZBW_js.NotificationStatus; }
29
+ get: function () { return chunkD7P7KCZI_js.NotificationStatus; }
30
30
  });
31
31
  Object.defineProperty(exports, "Novu", {
32
32
  enumerable: true,
33
- get: function () { return chunkUUYKXZBW_js.Novu; }
33
+ get: function () { return chunkD7P7KCZI_js.Novu; }
34
34
  });
35
35
  Object.defineProperty(exports, "PreferenceLevel", {
36
36
  enumerable: true,
37
- get: function () { return chunkUUYKXZBW_js.PreferenceLevel; }
37
+ get: function () { return chunkD7P7KCZI_js.PreferenceLevel; }
38
38
  });
39
39
  Object.defineProperty(exports, "PreferenceOverrideSource", {
40
40
  enumerable: true,
41
- get: function () { return chunkUUYKXZBW_js.PreferenceOverrideSource; }
41
+ get: function () { return chunkD7P7KCZI_js.PreferenceOverrideSource; }
42
42
  });
43
43
  Object.defineProperty(exports, "PreferenceOverrideSourceEnum", {
44
44
  enumerable: true,
45
- get: function () { return chunkUUYKXZBW_js.PreferenceOverrideSourceEnum; }
45
+ get: function () { return chunkD7P7KCZI_js.PreferenceOverrideSourceEnum; }
46
46
  });
47
47
  Object.defineProperty(exports, "WebSocketEvent", {
48
48
  enumerable: true,
49
- get: function () { return chunkUUYKXZBW_js.WebSocketEvent; }
49
+ get: function () { return chunkD7P7KCZI_js.WebSocketEvent; }
50
50
  });
51
51
  Object.defineProperty(exports, "areTagsEqual", {
52
52
  enumerable: true,
53
- get: function () { return chunkUUYKXZBW_js.areTagsEqual; }
53
+ get: function () { return chunkD7P7KCZI_js.areTagsEqual; }
54
54
  });
55
55
  Object.defineProperty(exports, "isSameFilter", {
56
56
  enumerable: true,
57
- get: function () { return chunkUUYKXZBW_js.isSameFilter; }
57
+ get: function () { return chunkD7P7KCZI_js.isSameFilter; }
58
58
  });
@@ -12,7 +12,10 @@ declare class Preference {
12
12
  readonly enabled: boolean;
13
13
  readonly channels: ChannelPreference;
14
14
  readonly workflow?: Workflow;
15
- constructor(preference: PreferenceLike);
15
+ constructor(preference: PreferenceLike, { emitterInstance, inboxServiceInstance }: {
16
+ emitterInstance: NovuEventEmitter;
17
+ inboxServiceInstance: InboxService;
18
+ });
16
19
  update({ channelPreferences }: {
17
20
  channelPreferences: ChannelPreference;
18
21
  }): Result<Preference>;
@@ -232,9 +235,12 @@ declare class InboxService {
232
235
 
233
236
  declare class BaseModule {
234
237
  #private;
235
- _inboxService: InboxService;
236
- _emitter: NovuEventEmitter;
237
- constructor();
238
+ protected _inboxService: InboxService;
239
+ protected _emitter: NovuEventEmitter;
240
+ constructor({ inboxServiceInstance, eventEmitterInstance, }: {
241
+ inboxServiceInstance: InboxService;
242
+ eventEmitterInstance: NovuEventEmitter;
243
+ });
238
244
  protected onSessionSuccess(_: Session): void;
239
245
  protected onSessionError(_: unknown): void;
240
246
  callWithSession<T>(fn: () => Result<T>): Result<T>;
@@ -258,7 +264,7 @@ declare class Notification implements Pick<NovuEventEmitter, 'on' | 'off'>, Inbo
258
264
  readonly tags: InboxNotification['tags'];
259
265
  readonly redirect: InboxNotification['redirect'];
260
266
  readonly data?: InboxNotification['data'];
261
- constructor(notification: InboxNotification);
267
+ constructor(notification: InboxNotification, emitter: NovuEventEmitter, inboxService: InboxService);
262
268
  read(): Result<Notification>;
263
269
  unread(): Result<Notification>;
264
270
  archive(): Result<Notification>;
@@ -323,7 +329,9 @@ type RevertArgs = BaseArgs | InstanceArgs;
323
329
 
324
330
  declare class NotificationsCache {
325
331
  #private;
326
- constructor();
332
+ constructor({ emitter }: {
333
+ emitter: NovuEventEmitter;
334
+ });
327
335
  private updateNotification;
328
336
  private removeNotification;
329
337
  private handleNotificationEvent;
@@ -344,8 +352,10 @@ declare class NotificationsCache {
344
352
  declare class Notifications extends BaseModule {
345
353
  #private;
346
354
  readonly cache: NotificationsCache;
347
- constructor({ useCache }: {
355
+ constructor({ useCache, inboxServiceInstance, eventEmitterInstance, }: {
348
356
  useCache: boolean;
357
+ inboxServiceInstance: InboxService;
358
+ eventEmitterInstance: NovuEventEmitter;
349
359
  });
350
360
  list({ limit, ...restOptions }?: ListNotificationsArgs): Result<ListNotificationsResponse>;
351
361
  count(args?: FilterCountArgs): Result<FilterCountResponse>;
@@ -474,13 +484,9 @@ type EventNames = keyof Events;
474
484
  type SocketEventNames = keyof SocketEvents;
475
485
  type EventHandler<T = unknown> = (event: T) => void;
476
486
 
477
- type SingletonOptions = {
478
- recreate: true;
479
- };
480
487
  declare class NovuEventEmitter {
481
488
  #private;
482
- static getInstance(options?: SingletonOptions): NovuEventEmitter;
483
- private constructor();
489
+ constructor();
484
490
  on<Key extends EventNames>(eventName: Key, listener: EventHandler<Events[Key]>): void;
485
491
  off<Key extends EventNames>(eventName: Key, listener: EventHandler<Events[Key]>): void;
486
492
  emit<Key extends EventNames>(type: Key, event?: Events[Key]): void;
@@ -488,7 +494,9 @@ declare class NovuEventEmitter {
488
494
 
489
495
  declare class PreferencesCache {
490
496
  #private;
491
- constructor();
497
+ constructor({ emitterInstance }: {
498
+ emitterInstance: NovuEventEmitter;
499
+ });
492
500
  private updatePreference;
493
501
  private handlePreferenceEvent;
494
502
  set(data: Preference[]): void;
@@ -499,8 +507,10 @@ declare class PreferencesCache {
499
507
  declare class Preferences extends BaseModule {
500
508
  #private;
501
509
  readonly cache: PreferencesCache;
502
- constructor({ useCache }: {
510
+ constructor({ useCache, inboxServiceInstance, eventEmitterInstance, }: {
503
511
  useCache: boolean;
512
+ inboxServiceInstance: InboxService;
513
+ eventEmitterInstance: NovuEventEmitter;
504
514
  });
505
515
  list(): Result<Preference[]>;
506
516
  update(args: UpdatePreferencesArgs): Result<Preference>;
@@ -1,4 +1,4 @@
1
- import { t as Notification, s as NovuOptions, b as Novu } from '../novu-PgupDkfH.js';
1
+ import { t as Notification, s as NovuOptions, b as Novu } from '../novu-04KlkBy4.js';
2
2
  import * as solid_js from 'solid-js';
3
3
  import { ComponentProps } from 'solid-js';
4
4
  import { MountableElement } from 'solid-js/web';
@@ -29,7 +29,7 @@ declare const defaultLocalization: {
29
29
  readonly 'preferences.workflow.disabled.tooltip': "Contact admin to edit";
30
30
  };
31
31
 
32
- declare const appearanceKeys: readonly ["button", "popoverContent", "popoverTrigger", "dropdownContent", "dropdownTrigger", "dropdownItem", "dropdownItemLabel", "dropdownItemLabelContainer", "dropdownItemLeftIcon", "dropdownItemRightIcon", "tooltipContent", "tooltipTrigger", "back__button", "skeletonText", "skeletonAvatar", "tabsRoot", "tabsList", "tabsContent", "tabsTrigger", "dots", "root", "bellIcon", "bellContainer", "bellDot", "preferences__button", "preferencesContainer", "inboxHeader", "loading", "inboxContent", "inbox__popoverTrigger", "inbox__popoverContent", "notificationListContainer", "notificationList", "notificationListEmptyNoticeContainer", "notificationListEmptyNotice", "notificationListEmptyNoticeIcon", "notificationListNewNotificationsNotice__button", "notification", "notificationDot", "notificationSubject", "notificationBody", "notificationBodyContainer", "notificationImage", "notificationDate", "notificationDefaultActions", "notificationCustomActions", "notificationPrimaryAction__button", "notificationSecondaryAction__button", "notificationRead__button", "notificationUnread__button", "notificationArchive__button", "notificationUnarchive__button", "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", "moreActionsContainer", "moreActions__dropdownTrigger", "moreActions__dropdownContent", "moreActions__dropdownItem", "moreActions__dropdownItemLabel", "moreActions__dropdownItemLeft__icon", "moreActions__dots", "moreTabs__button", "moreTabs__dots", "moreTabs__dropdownTrigger", "moreTabs__dropdownContent", "moreTabs__dropdownItem", "moreTabs__dropdownItemLabel", "moreTabs__dropdownItemRight__icon", "workflowContainer", "workflowLabel", "workflowLabelContainer", "workflowContainerDisabledNotice", "workflowLabelDisabled__icon", "workflowContainerRight__icon", "workflowArrow__icon", "channelContainer", "channelsContainer", "channelLabel", "channelLabelContainer", "channelDescription", "channelName", "channelSwitchContainer", "channelSwitch", "channelSwitchThumb", "preferencesHeader", "preferencesHeader__back__button", "preferencesHeader__title", "preferencesLoadingContainer"];
32
+ declare const appearanceKeys: readonly ["button", "popoverContent", "popoverTrigger", "dropdownContent", "dropdownTrigger", "dropdownItem", "dropdownItemLabel", "dropdownItemLabelContainer", "dropdownItemLeftIcon", "dropdownItemRightIcon", "tooltipContent", "tooltipTrigger", "back__button", "skeletonText", "skeletonAvatar", "tabsRoot", "tabsList", "tabsContent", "tabsTrigger", "dots", "root", "bellIcon", "bellContainer", "bellDot", "preferences__button", "preferencesContainer", "inboxHeader", "loading", "inboxContent", "inbox__popoverTrigger", "inbox__popoverContent", "notificationListContainer", "notificationList", "notificationListEmptyNoticeContainer", "notificationListEmptyNotice", "notificationListEmptyNoticeIcon", "notificationListNewNotificationsNotice__button", "notification", "notificationDot", "notificationSubject", "notificationSubject__strong", "notificationBody", "notificationBody__strong", "notificationBodyContainer", "notificationImage", "notificationDate", "notificationDefaultActions", "notificationCustomActions", "notificationPrimaryAction__button", "notificationSecondaryAction__button", "notificationRead__button", "notificationUnread__button", "notificationArchive__button", "notificationUnarchive__button", "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", "moreActionsContainer", "moreActions__dropdownTrigger", "moreActions__dropdownContent", "moreActions__dropdownItem", "moreActions__dropdownItemLabel", "moreActions__dropdownItemLeft__icon", "moreActions__dots", "moreTabs__button", "moreTabs__dots", "moreTabs__dropdownTrigger", "moreTabs__dropdownContent", "moreTabs__dropdownItem", "moreTabs__dropdownItemLabel", "moreTabs__dropdownItemRight__icon", "workflowContainer", "workflowLabel", "workflowLabelContainer", "workflowContainerDisabledNotice", "workflowLabelDisabled__icon", "workflowContainerRight__icon", "workflowArrow__icon", "channelContainer", "channelsContainer", "channelLabel", "channelLabelContainer", "channelDescription", "channelName", "channelSwitchContainer", "channelSwitch", "channelSwitchThumb", "preferencesHeader", "preferencesHeader__back__button", "preferencesHeader__title", "preferencesLoadingContainer", "strong"];
33
33
 
34
34
  type LocalizationKey = keyof typeof defaultLocalization;
35
35
  type Localization = {