@novu/js 3.2.0 → 3.3.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.
@@ -13,8 +13,10 @@ var io__default = /*#__PURE__*/_interopDefault(io);
13
13
  var NotificationStatus = /* @__PURE__ */ ((NotificationStatus2) => {
14
14
  NotificationStatus2["READ"] = "read";
15
15
  NotificationStatus2["SEEN"] = "seen";
16
+ NotificationStatus2["SNOOZED"] = "snoozed";
16
17
  NotificationStatus2["UNREAD"] = "unread";
17
18
  NotificationStatus2["UNSEEN"] = "unseen";
19
+ NotificationStatus2["UNSNOOZED"] = "unsnoozed";
18
20
  return NotificationStatus2;
19
21
  })(NotificationStatus || {});
20
22
  var PreferenceLevel = /* @__PURE__ */ ((PreferenceLevel2) => {
@@ -54,13 +56,13 @@ var areTagsEqual = (tags1, tags2) => {
54
56
  return arrayValuesEqual(tags1, tags2) || !tags1 && (tags2 == null ? void 0 : tags2.length) === 0 || (tags1 == null ? void 0 : tags1.length) === 0 && !tags2;
55
57
  };
56
58
  var isSameFilter = (filter1, filter2) => {
57
- return areTagsEqual(filter1.tags, filter2.tags) && filter1.read === filter2.read && filter1.archived === filter2.archived;
59
+ return areTagsEqual(filter1.tags, filter2.tags) && filter1.read === filter2.read && filter1.archived === filter2.archived && filter1.snoozed === filter2.snoozed;
58
60
  };
59
61
 
60
62
  // src/api/http-client.ts
61
63
  var DEFAULT_API_VERSION = "v1";
62
64
  var DEFAULT_BACKEND_URL = "https://api.novu.co";
63
- var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.2.0"}`;
65
+ var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.3.0"}`;
64
66
  var HttpClient = class {
65
67
  constructor(options = {}) {
66
68
  const {
@@ -194,7 +196,8 @@ var InboxService = class {
194
196
  limit = 10,
195
197
  offset,
196
198
  read: read2,
197
- tags
199
+ tags,
200
+ snoozed
198
201
  }) {
199
202
  const searchParams = new URLSearchParams(`limit=${limit}`);
200
203
  if (after) {
@@ -212,6 +215,9 @@ var InboxService = class {
212
215
  if (archived !== void 0) {
213
216
  searchParams.append("archived", `${archived}`);
214
217
  }
218
+ if (snoozed !== void 0) {
219
+ searchParams.append("snoozed", `${snoozed}`);
220
+ }
215
221
  return chunk7B52C2XE_js.__privateGet(this, _httpClient).get(INBOX_NOTIFICATIONS_ROUTE, searchParams, false);
216
222
  }
217
223
  count({ filters }) {
@@ -235,6 +241,12 @@ var InboxService = class {
235
241
  unarchive(notificationId) {
236
242
  return chunk7B52C2XE_js.__privateGet(this, _httpClient).patch(`${INBOX_NOTIFICATIONS_ROUTE}/${notificationId}/unarchive`);
237
243
  }
244
+ snooze(notificationId, snoozeUntil) {
245
+ return chunk7B52C2XE_js.__privateGet(this, _httpClient).patch(`${INBOX_NOTIFICATIONS_ROUTE}/${notificationId}/snooze`, { snoozeUntil });
246
+ }
247
+ unsnooze(notificationId) {
248
+ return chunk7B52C2XE_js.__privateGet(this, _httpClient).patch(`${INBOX_NOTIFICATIONS_ROUTE}/${notificationId}/unsnooze`);
249
+ }
238
250
  readAll({ tags }) {
239
251
  return chunk7B52C2XE_js.__privateGet(this, _httpClient).post(`${INBOX_NOTIFICATIONS_ROUTE}/read`, { tags });
240
252
  }
@@ -373,6 +385,9 @@ var Notification = class {
373
385
  this.to = notification.to;
374
386
  this.isRead = notification.isRead;
375
387
  this.isArchived = notification.isArchived;
388
+ this.isSnoozed = notification.isSnoozed;
389
+ this.snoozedUntil = notification.snoozedUntil;
390
+ this.deliveredAt = notification.deliveredAt;
376
391
  this.createdAt = notification.createdAt;
377
392
  this.readAt = notification.readAt;
378
393
  this.archivedAt = notification.archivedAt;
@@ -421,6 +436,23 @@ var Notification = class {
421
436
  }
422
437
  });
423
438
  }
439
+ snooze(snoozeUntil) {
440
+ return snooze({
441
+ emitter: chunk7B52C2XE_js.__privateGet(this, _emitter),
442
+ apiService: chunk7B52C2XE_js.__privateGet(this, _inboxService),
443
+ args: {
444
+ notification: this,
445
+ snoozeUntil
446
+ }
447
+ });
448
+ }
449
+ unsnooze() {
450
+ return unsnooze({
451
+ emitter: chunk7B52C2XE_js.__privateGet(this, _emitter),
452
+ apiService: chunk7B52C2XE_js.__privateGet(this, _inboxService),
453
+ args: { notification: this }
454
+ });
455
+ }
424
456
  completePrimary() {
425
457
  if (!this.primaryAction) {
426
458
  throw new Error("Primary action is not available");
@@ -619,6 +651,66 @@ var unarchive = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
619
651
  return { error: new NovuError("Failed to unarchive notification", error) };
620
652
  }
621
653
  });
654
+ var snooze = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
655
+ emitter,
656
+ apiService,
657
+ args
658
+ }) {
659
+ const { notificationId, optimisticValue } = getNotificationDetails(
660
+ args,
661
+ {
662
+ isSnoozed: true,
663
+ snoozedUntil: args.snoozeUntil
664
+ },
665
+ {
666
+ emitter,
667
+ apiService
668
+ }
669
+ );
670
+ try {
671
+ emitter.emit("notification.snooze.pending", {
672
+ args,
673
+ data: optimisticValue
674
+ });
675
+ const response = yield apiService.snooze(notificationId, args.snoozeUntil);
676
+ const updatedNotification = new Notification(response, emitter, apiService);
677
+ emitter.emit("notification.snooze.resolved", { args, data: updatedNotification });
678
+ return { data: updatedNotification };
679
+ } catch (error) {
680
+ emitter.emit("notification.snooze.resolved", { args, error });
681
+ return { error: new NovuError("Failed to snooze notification", error) };
682
+ }
683
+ });
684
+ var unsnooze = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
685
+ emitter,
686
+ apiService,
687
+ args
688
+ }) {
689
+ const { notificationId, optimisticValue } = getNotificationDetails(
690
+ args,
691
+ {
692
+ isSnoozed: false,
693
+ snoozedUntil: null
694
+ },
695
+ {
696
+ emitter,
697
+ apiService
698
+ }
699
+ );
700
+ try {
701
+ emitter.emit("notification.unsnooze.pending", {
702
+ args,
703
+ data: optimisticValue
704
+ });
705
+ const response = yield apiService.unsnooze(notificationId);
706
+ const updatedNotification = new Notification(response, emitter, apiService);
707
+ emitter.emit("notification.unsnooze.resolved", { args, data: updatedNotification });
708
+ return { data: updatedNotification };
709
+ } catch (error) {
710
+ emitter.emit("notification.unsnooze.resolved", { args, error });
711
+ return { error: new NovuError("Failed to unsnooze notification", error) };
712
+ }
713
+ });
622
714
  var completeAction = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
623
715
  emitter,
624
716
  apiService,
@@ -816,15 +908,20 @@ var InMemoryCache = class {
816
908
  _cache = new WeakMap();
817
909
 
818
910
  // src/cache/notifications-cache.ts
819
- var excludeEmpty = ({ tags, read: read2, archived, limit, offset, after }) => Object.entries({ tags, read: read2, archived, limit, offset, after }).filter(([_, value]) => value !== null && value !== void 0 && !(Array.isArray(value) && value.length === 0)).reduce((acc, [key, value]) => {
911
+ var excludeEmpty = ({ tags, read: read2, archived, snoozed, limit, offset, after }) => Object.entries({ tags, read: read2, archived, snoozed, limit, offset, after }).filter(([_, value]) => value !== null && value !== void 0 && !(Array.isArray(value) && value.length === 0)).reduce((acc, [key, value]) => {
820
912
  acc[key] = value;
821
913
  return acc;
822
914
  }, {});
823
- var getCacheKey = ({ tags, read: read2, archived, limit, offset, after }) => {
824
- return JSON.stringify(excludeEmpty({ tags, read: read2, archived, limit, offset, after }));
915
+ var getCacheKey = ({ tags, read: read2, archived, snoozed, limit, offset, after }) => {
916
+ return JSON.stringify(excludeEmpty({ tags, read: read2, archived, snoozed, limit, offset, after }));
825
917
  };
826
- var getFilterKey = ({ tags, read: read2, archived }) => {
827
- return JSON.stringify(excludeEmpty({ tags, read: read2, archived }));
918
+ var getFilterKey = ({
919
+ tags,
920
+ read: read2,
921
+ archived,
922
+ snoozed
923
+ }) => {
924
+ return JSON.stringify(excludeEmpty({ tags, read: read2, archived, snoozed }));
828
925
  };
829
926
  var getFilter = (key) => {
830
927
  return JSON.parse(key);
@@ -844,6 +941,8 @@ var updateEvents = [
844
941
  var removeEvents = [
845
942
  "notification.archive.pending",
846
943
  "notification.unarchive.pending",
944
+ "notification.snooze.pending",
945
+ "notification.unsnooze.pending",
847
946
  "notifications.archive_all.pending",
848
947
  "notifications.archive_all_read.pending"
849
948
  ];
@@ -954,7 +1053,7 @@ var NotificationsCache = class {
954
1053
  }
955
1054
  getAll(args) {
956
1055
  if (this.has(args)) {
957
- return this.getAggregated({ tags: args.tags, read: args.read, archived: args.archived });
1056
+ return this.getAggregated({ tags: args.tags, read: args.read, snoozed: args.snoozed, archived: args.archived });
958
1057
  }
959
1058
  }
960
1059
  /**
@@ -1115,6 +1214,32 @@ var Notifications = class extends BaseModule {
1115
1214
  );
1116
1215
  });
1117
1216
  }
1217
+ snooze(args) {
1218
+ return chunk7B52C2XE_js.__async(this, null, function* () {
1219
+ return this.callWithSession(
1220
+ () => chunk7B52C2XE_js.__async(this, null, function* () {
1221
+ return snooze({
1222
+ emitter: this._emitter,
1223
+ apiService: this._inboxService,
1224
+ args
1225
+ });
1226
+ })
1227
+ );
1228
+ });
1229
+ }
1230
+ unsnooze(args) {
1231
+ return chunk7B52C2XE_js.__async(this, null, function* () {
1232
+ return this.callWithSession(
1233
+ () => chunk7B52C2XE_js.__async(this, null, function* () {
1234
+ return unsnooze({
1235
+ emitter: this._emitter,
1236
+ apiService: this._inboxService,
1237
+ args
1238
+ });
1239
+ })
1240
+ );
1241
+ });
1242
+ }
1118
1243
  completePrimary(args) {
1119
1244
  return chunk7B52C2XE_js.__async(this, null, function* () {
1120
1245
  return this.callWithSession(
@@ -1527,6 +1652,8 @@ var mapToNotification = ({
1527
1652
  content,
1528
1653
  read: read2,
1529
1654
  archived,
1655
+ snoozedUntil,
1656
+ deliveredAt,
1530
1657
  createdAt,
1531
1658
  lastReadDate,
1532
1659
  archivedAt,
@@ -1556,13 +1683,19 @@ var mapToNotification = ({
1556
1683
  const secondaryCta = (_d = (_c = cta.action) == null ? void 0 : _c.buttons) == null ? void 0 : _d.find((button) => button.type === "secondary" /* SECONDARY */);
1557
1684
  const actionType = (_f = (_e = cta.action) == null ? void 0 : _e.result) == null ? void 0 : _f.type;
1558
1685
  const actionStatus = (_g = cta.action) == null ? void 0 : _g.status;
1559
- return {
1686
+ return chunk7B52C2XE_js.__spreadProps(chunk7B52C2XE_js.__spreadValues(chunk7B52C2XE_js.__spreadValues({
1560
1687
  id: _id,
1561
1688
  subject,
1562
1689
  body: content,
1563
1690
  to,
1564
1691
  isRead: read2,
1565
1692
  isArchived: archived,
1693
+ isSnoozed: !!snoozedUntil
1694
+ }, deliveredAt && {
1695
+ deliveredAt
1696
+ }), snoozedUntil && {
1697
+ snoozedUntil
1698
+ }), {
1566
1699
  createdAt,
1567
1700
  readAt: lastReadDate,
1568
1701
  archivedAt,
@@ -1591,7 +1724,7 @@ var mapToNotification = ({
1591
1724
  } : void 0,
1592
1725
  data,
1593
1726
  workflow
1594
- };
1727
+ });
1595
1728
  };
1596
1729
  var _token, _emitter6, _socketIo, _socketUrl, _notificationReceived, _unseenCountChanged, _unreadCountChanged, _Socket_instances, initializeSocket_fn, handleConnectSocket_fn, handleDisconnectSocket_fn;
1597
1730
  var Socket = class extends BaseModule {
@@ -1,5 +1,5 @@
1
- import { N as NotificationFilter } from './novu-jtIKy6p0.js';
2
- export { C as ChannelPreference, c as ChannelType, E as EventHandler, a as Events, F as FiltersCountResponse, I as InboxNotification, L as ListNotificationsResponse, d as Notification, e as NotificationStatus, b as Novu, f as NovuError, g as NovuOptions, P as Preference, h as PreferenceLevel, i as PreferencesResponse, S as SocketEventNames, j as Subscriber, W as WebSocketEvent } from './novu-jtIKy6p0.js';
1
+ import { N as NotificationFilter } from './novu-DJTVB7VN.js';
2
+ export { C as ChannelPreference, c as ChannelType, E as EventHandler, a as Events, F as FiltersCountResponse, I as InboxNotification, L as ListNotificationsResponse, d as Notification, e as NotificationStatus, b as Novu, f as NovuError, g as NovuOptions, P as Preference, h as PreferenceLevel, i as PreferencesResponse, S as SocketEventNames, j as Subscriber, W as WebSocketEvent } from './novu-DJTVB7VN.js';
3
3
 
4
4
  declare const areTagsEqual: (tags1?: string[], tags2?: string[]) => boolean;
5
5
  declare const isSameFilter: (filter1: NotificationFilter, filter2: NotificationFilter) => boolean;
package/dist/cjs/index.js CHANGED
@@ -1,35 +1,35 @@
1
1
  'use strict';
2
2
 
3
- var chunk4KMXR5HJ_js = require('./chunk-4KMXR5HJ.js');
3
+ var chunkKIOGWIKT_js = require('./chunk-KIOGWIKT.js');
4
4
  require('./chunk-7B52C2XE.js');
5
5
 
6
6
 
7
7
 
8
8
  Object.defineProperty(exports, "ChannelType", {
9
9
  enumerable: true,
10
- get: function () { return chunk4KMXR5HJ_js.ChannelType; }
10
+ get: function () { return chunkKIOGWIKT_js.ChannelType; }
11
11
  });
12
12
  Object.defineProperty(exports, "NotificationStatus", {
13
13
  enumerable: true,
14
- get: function () { return chunk4KMXR5HJ_js.NotificationStatus; }
14
+ get: function () { return chunkKIOGWIKT_js.NotificationStatus; }
15
15
  });
16
16
  Object.defineProperty(exports, "Novu", {
17
17
  enumerable: true,
18
- get: function () { return chunk4KMXR5HJ_js.Novu; }
18
+ get: function () { return chunkKIOGWIKT_js.Novu; }
19
19
  });
20
20
  Object.defineProperty(exports, "PreferenceLevel", {
21
21
  enumerable: true,
22
- get: function () { return chunk4KMXR5HJ_js.PreferenceLevel; }
22
+ get: function () { return chunkKIOGWIKT_js.PreferenceLevel; }
23
23
  });
24
24
  Object.defineProperty(exports, "WebSocketEvent", {
25
25
  enumerable: true,
26
- get: function () { return chunk4KMXR5HJ_js.WebSocketEvent; }
26
+ get: function () { return chunkKIOGWIKT_js.WebSocketEvent; }
27
27
  });
28
28
  Object.defineProperty(exports, "areTagsEqual", {
29
29
  enumerable: true,
30
- get: function () { return chunk4KMXR5HJ_js.areTagsEqual; }
30
+ get: function () { return chunkKIOGWIKT_js.areTagsEqual; }
31
31
  });
32
32
  Object.defineProperty(exports, "isSameFilter", {
33
33
  enumerable: true,
34
- get: function () { return chunk4KMXR5HJ_js.isSameFilter; }
34
+ get: function () { return chunkKIOGWIKT_js.isSameFilter; }
35
35
  });
@@ -63,8 +63,10 @@ declare global {
63
63
  declare enum NotificationStatus {
64
64
  READ = "read",
65
65
  SEEN = "seen",
66
+ SNOOZED = "snoozed",
66
67
  UNREAD = "unread",
67
- UNSEEN = "unseen"
68
+ UNSEEN = "unseen",
69
+ UNSNOOZED = "unsnoozed"
68
70
  }
69
71
  declare enum PreferenceLevel {
70
72
  GLOBAL = "global",
@@ -87,6 +89,7 @@ type Session = {
87
89
  totalUnreadCount: number;
88
90
  removeNovuBranding: boolean;
89
91
  isDevelopmentMode: boolean;
92
+ maxSnoozeDurationHours: number;
90
93
  };
91
94
  type Subscriber = {
92
95
  id?: string;
@@ -127,6 +130,9 @@ type InboxNotification = {
127
130
  to: Subscriber;
128
131
  isRead: boolean;
129
132
  isArchived: boolean;
133
+ isSnoozed: boolean;
134
+ snoozedUntil?: string | null;
135
+ deliveredAt?: string[];
130
136
  createdAt: string;
131
137
  readAt?: string | null;
132
138
  archivedAt?: string | null;
@@ -143,6 +149,7 @@ type NotificationFilter = {
143
149
  tags?: string[];
144
150
  read?: boolean;
145
151
  archived?: boolean;
152
+ snoozed?: boolean;
146
153
  };
147
154
  type ChannelPreference = {
148
155
  email?: boolean;
@@ -209,10 +216,11 @@ declare class InboxService {
209
216
  subscriberHash?: string;
210
217
  subscriber: Subscriber;
211
218
  }): Promise<Session>;
212
- fetchNotifications({ after, archived, limit, offset, read, tags, }: {
219
+ fetchNotifications({ after, archived, limit, offset, read, tags, snoozed, }: {
213
220
  tags?: string[];
214
221
  read?: boolean;
215
222
  archived?: boolean;
223
+ snoozed?: boolean;
216
224
  limit?: number;
217
225
  after?: string;
218
226
  offset?: number;
@@ -237,6 +245,8 @@ declare class InboxService {
237
245
  unread(notificationId: string): Promise<InboxNotification>;
238
246
  archive(notificationId: string): Promise<InboxNotification>;
239
247
  unarchive(notificationId: string): Promise<InboxNotification>;
248
+ snooze(notificationId: string, snoozeUntil: string): Promise<InboxNotification>;
249
+ unsnooze(notificationId: string): Promise<InboxNotification>;
240
250
  readAll({ tags }: {
241
251
  tags?: string[];
242
252
  }): Promise<void>;
@@ -283,6 +293,9 @@ declare class Notification implements Pick<NovuEventEmitter, 'on'>, InboxNotific
283
293
  readonly to: InboxNotification['to'];
284
294
  readonly isRead: InboxNotification['isRead'];
285
295
  readonly isArchived: InboxNotification['isArchived'];
296
+ readonly isSnoozed: InboxNotification['isSnoozed'];
297
+ readonly snoozedUntil?: InboxNotification['snoozedUntil'];
298
+ readonly deliveredAt?: InboxNotification['deliveredAt'];
286
299
  readonly createdAt: InboxNotification['createdAt'];
287
300
  readonly readAt?: InboxNotification['readAt'];
288
301
  readonly archivedAt?: InboxNotification['archivedAt'];
@@ -299,6 +312,8 @@ declare class Notification implements Pick<NovuEventEmitter, 'on'>, InboxNotific
299
312
  unread(): Result<Notification>;
300
313
  archive(): Result<Notification>;
301
314
  unarchive(): Result<Notification>;
315
+ snooze(snoozeUntil: string): Result<Notification>;
316
+ unsnooze(): Result<Notification>;
302
317
  completePrimary(): Result<Notification>;
303
318
  completeSecondary(): Result<Notification>;
304
319
  revertPrimary(): Result<Notification>;
@@ -315,6 +330,7 @@ type ListNotificationsArgs = {
315
330
  tags?: string[];
316
331
  read?: boolean;
317
332
  archived?: boolean;
333
+ snoozed?: boolean;
318
334
  limit?: number;
319
335
  after?: string;
320
336
  offset?: number;
@@ -329,12 +345,14 @@ type FilterCountArgs = {
329
345
  tags?: string[];
330
346
  read?: boolean;
331
347
  archived?: boolean;
348
+ snoozed?: boolean;
332
349
  };
333
350
  type FiltersCountArgs = {
334
351
  filters: Array<{
335
352
  tags?: string[];
336
353
  read?: boolean;
337
354
  archived?: boolean;
355
+ snoozed?: boolean;
338
356
  }>;
339
357
  };
340
358
  type CountArgs = undefined | FilterCountArgs | FiltersCountArgs;
@@ -359,6 +377,10 @@ type ReadArgs = BaseArgs | InstanceArgs;
359
377
  type UnreadArgs = BaseArgs | InstanceArgs;
360
378
  type ArchivedArgs = BaseArgs | InstanceArgs;
361
379
  type UnarchivedArgs = BaseArgs | InstanceArgs;
380
+ type SnoozeArgs = (BaseArgs | InstanceArgs) & {
381
+ snoozeUntil: string;
382
+ };
383
+ type UnsnoozeArgs = BaseArgs | InstanceArgs;
362
384
  type CompleteArgs = BaseArgs | InstanceArgs;
363
385
  type RevertArgs = BaseArgs | InstanceArgs;
364
386
 
@@ -403,6 +425,9 @@ declare class Notifications extends BaseModule {
403
425
  archive(args: InstanceArgs): Result<Notification>;
404
426
  unarchive(args: BaseArgs): Result<Notification>;
405
427
  unarchive(args: InstanceArgs): Result<Notification>;
428
+ snooze(args: SnoozeArgs): Result<Notification>;
429
+ unsnooze(args: BaseArgs): Result<Notification>;
430
+ unsnooze(args: InstanceArgs): Result<Notification>;
406
431
  completePrimary(args: BaseArgs): Result<Notification>;
407
432
  completePrimary(args: InstanceArgs): Result<Notification>;
408
433
  completeSecondary(args: BaseArgs): Result<Notification>;
@@ -451,6 +476,8 @@ type NotificationReadEvents = BaseEvents<'notification.read', ReadArgs, Notifica
451
476
  type NotificationUnreadEvents = BaseEvents<'notification.unread', UnreadArgs, Notification>;
452
477
  type NotificationArchiveEvents = BaseEvents<'notification.archive', ArchivedArgs, Notification>;
453
478
  type NotificationUnarchiveEvents = BaseEvents<'notification.unarchive', UnarchivedArgs, Notification>;
479
+ type NotificationSnoozeEvents = BaseEvents<'notification.snooze', SnoozeArgs, Notification>;
480
+ type NotificationUnsnoozeEvents = BaseEvents<'notification.unsnooze', UnsnoozeArgs, Notification>;
454
481
  type NotificationCompleteActionEvents = BaseEvents<'notification.complete_action', CompleteArgs, Notification>;
455
482
  type NotificationRevertActionEvents = BaseEvents<'notification.revert_action', RevertArgs, Notification>;
456
483
  type NotificationsReadAllEvents = BaseEvents<'notifications.read_all', {
@@ -503,7 +530,7 @@ type Events = SessionInitializeEvents & NotificationsFetchEvents & {
503
530
  'preferences.list.updated': {
504
531
  data: Preference[];
505
532
  };
506
- } & PreferenceUpdateEvents & SocketConnectEvents & SocketEvents & NotificationReadEvents & NotificationUnreadEvents & NotificationArchiveEvents & NotificationUnarchiveEvents & NotificationCompleteActionEvents & NotificationRevertActionEvents & NotificationsReadAllEvents & NotificationsArchivedAllEvents & NotificationsReadArchivedAllEvents;
533
+ } & PreferenceUpdateEvents & SocketConnectEvents & SocketEvents & NotificationReadEvents & NotificationUnreadEvents & NotificationArchiveEvents & NotificationUnarchiveEvents & NotificationSnoozeEvents & NotificationUnsnoozeEvents & NotificationCompleteActionEvents & NotificationRevertActionEvents & NotificationsReadAllEvents & NotificationsArchivedAllEvents & NotificationsReadArchivedAllEvents;
507
534
  type EventNames = keyof Events;
508
535
  type SocketEventNames = keyof SocketEvents;
509
536
  type EventHandler<T = unknown> = (event: T) => void;
@@ -1,5 +1,5 @@
1
- import { j as Theme } from '../types-qgZnJ8j8.js';
2
- import '../novu-jtIKy6p0.js';
1
+ import { j as Theme } from '../types-BPv1rvbm.js';
2
+ import '../novu-DJTVB7VN.js';
3
3
 
4
4
  declare const dark: Theme;
5
5
 
@@ -0,0 +1,121 @@
1
+ import { d as Notification, N as NotificationFilter, g as NovuOptions, b as Novu } from './novu-DJTVB7VN.js';
2
+
3
+ declare const appearanceKeys: readonly ["button", "input", "icon", "badge", "popoverContent", "popoverTrigger", "popoverClose", "dropdownContent", "dropdownTrigger", "dropdownItem", "dropdownItemLabel", "dropdownItemLabelContainer", "dropdownItemLeft__icon", "dropdownItemRight__icon", "dropdownItem__icon", "collapsible", "tooltipContent", "tooltipTrigger", "datePicker", "datePickerGrid", "datePickerGridRow", "datePickerGridCell", "datePickerGridCellTrigger", "datePickerTrigger", "datePickerGridHeader", "datePickerControl", "datePickerControlPrevTrigger", "datePickerControlNextTrigger", "datePickerControlPrevTrigger__icon", "datePickerControlNextTrigger__icon", "datePickerCalendar", "datePickerHeaderMonth", "datePickerCalendarDay__button", "timePicker", "timePicker__hourSelect", "timePicker__minuteSelect", "timePicker__periodSelect", "timePicker__separator", "timePickerHour__input", "timePickerMinute__input", "snoozeDatePicker", "snoozeDatePicker__actions", "snoozeDatePickerCancel__button", "snoozeDatePickerApply__button", "snoozeDatePicker__timePickerContainer", "snoozeDatePicker__timePickerLabel", "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", "notificationSnooze__button", "notificationUnsnooze__button", "notificationRead__icon", "notificationUnread__icon", "notificationArchive__icon", "notificationUnarchive__icon", "notificationSnooze__icon", "notificationUnsnooze__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", "notificationSnooze__dropdownContent", "notificationSnooze__dropdownItem", "notificationSnooze__dropdownItem__icon", "notificationSnoozeCustomTime_popoverContent", "notificationDeliveredAt__badge", "notificationDeliveredAt__icon", "notificationSnoozedUntil__icon", "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.dropdownOptions.snoozed': "Snoozed";
11
+ readonly 'inbox.filters.labels.unread': "Unread";
12
+ readonly 'inbox.filters.labels.default': "Inbox";
13
+ readonly 'inbox.filters.labels.archived': "Archived";
14
+ readonly 'inbox.filters.labels.snoozed': "Snoozed";
15
+ readonly 'notifications.emptyNotice': "Quiet for now. Check back later.";
16
+ readonly 'notifications.actions.readAll': "Mark all as read";
17
+ readonly 'notifications.actions.archiveAll': "Archive all";
18
+ readonly 'notifications.actions.archiveRead': "Archive read";
19
+ readonly 'notifications.newNotifications': ({ notificationCount }: {
20
+ notificationCount: number;
21
+ }) => string;
22
+ readonly 'notification.actions.read.tooltip': "Mark as read";
23
+ readonly 'notification.actions.unread.tooltip': "Mark as unread";
24
+ readonly 'notification.actions.archive.tooltip': "Archive";
25
+ readonly 'notification.actions.unarchive.tooltip': "Unarchive";
26
+ readonly 'notification.actions.snooze.tooltip': "Snooze";
27
+ readonly 'notification.actions.unsnooze.tooltip': "Unsnooze";
28
+ readonly 'notification.snoozedUntil': "Snoozed until";
29
+ readonly 'preferences.title': "Preferences";
30
+ readonly 'preferences.emptyNotice': "No notification specific preferences yet.";
31
+ readonly 'preferences.global': "Global Preferences";
32
+ readonly 'preferences.workflow.disabled.notice': "Contact admin to enable subscription management for this critical notification.";
33
+ readonly 'preferences.workflow.disabled.tooltip': "Contact admin to edit";
34
+ readonly 'snooze.datePicker.timePickerLabel': "Time";
35
+ readonly 'snooze.datePicker.apply': "Apply";
36
+ readonly 'snooze.datePicker.cancel': "Cancel";
37
+ readonly 'snooze.options.anHourFromNow': "An hour from now";
38
+ readonly 'snooze.datePicker.pastDateTooltip': "Selected time must be at least 3 minutes in the future";
39
+ readonly 'snooze.datePicker.noDateSelectedTooltip': "Please select a date";
40
+ readonly 'snooze.datePicker.exceedingLimitTooltip': ({ days }: {
41
+ days: number;
42
+ }) => string;
43
+ readonly 'snooze.options.customTime': "Custom time...";
44
+ readonly 'snooze.options.inOneDay': "Tomorrow";
45
+ readonly 'snooze.options.inOneWeek': "Next week";
46
+ };
47
+
48
+ type LocalizationKey = keyof typeof defaultLocalization;
49
+ type Localization = {
50
+ [K in LocalizationKey]?: (typeof defaultLocalization)[K] extends (...args: infer P) => any ? ((...args: P) => ReturnType<(typeof defaultLocalization)[K]>) | string : string;
51
+ } & {
52
+ dynamic?: Record<string, string>;
53
+ };
54
+
55
+ type NotificationClickHandler = (notification: Notification) => void;
56
+ type NotificationActionClickHandler = (notification: Notification) => void;
57
+ type NotificationRenderer = (el: HTMLDivElement, notification: Notification) => () => void;
58
+ type SubjectRenderer = (el: HTMLDivElement, notification: Notification) => () => void;
59
+ type BodyRenderer = (el: HTMLDivElement, notification: Notification) => () => void;
60
+ type BellRenderer = (el: HTMLDivElement, unreadCount: number) => () => void;
61
+ type RouterPush = (path: string) => void;
62
+ type Tab = {
63
+ label: string;
64
+ /**
65
+ * @deprecated Use `filter` instead
66
+ */
67
+ value?: Array<string>;
68
+ filter?: Pick<NotificationFilter, 'tags'>;
69
+ };
70
+ type CSSProperties = {
71
+ [key: string]: string | number;
72
+ };
73
+ type ElementStyles = string | CSSProperties;
74
+ type Variables = {
75
+ colorBackground?: string;
76
+ colorForeground?: string;
77
+ colorPrimary?: string;
78
+ colorPrimaryForeground?: string;
79
+ colorSecondary?: string;
80
+ colorSecondaryForeground?: string;
81
+ colorCounter?: string;
82
+ colorCounterForeground?: string;
83
+ colorNeutral?: string;
84
+ colorShadow?: string;
85
+ colorRing?: string;
86
+ fontSize?: string;
87
+ borderRadius?: string;
88
+ colorStripes?: string;
89
+ };
90
+ type AppearanceKey = (typeof appearanceKeys)[number];
91
+ type Elements = Partial<Record<AppearanceKey, ElementStyles>>;
92
+ type Theme = {
93
+ variables?: Variables;
94
+ elements?: Elements;
95
+ animations?: boolean;
96
+ };
97
+ type Appearance = Theme & {
98
+ baseTheme?: Theme | Theme[];
99
+ };
100
+ type BaseNovuProviderProps = {
101
+ appearance?: Appearance;
102
+ localization?: Localization;
103
+ options: NovuOptions;
104
+ tabs?: Array<Tab>;
105
+ preferencesFilter?: PreferencesFilter;
106
+ routerPush?: RouterPush;
107
+ novu?: Novu;
108
+ };
109
+ type NovuProviderProps = BaseNovuProviderProps & {
110
+ renderNotification?: NotificationRenderer;
111
+ renderBell?: BellRenderer;
112
+ };
113
+ declare enum NotificationStatus {
114
+ UNREAD_READ = "unreadRead",
115
+ UNREAD = "unread",
116
+ ARCHIVED = "archived",
117
+ SNOOZED = "snoozed"
118
+ }
119
+ type PreferencesFilter = Pick<NotificationFilter, 'tags'>;
120
+
121
+ export { type Appearance as A, type BellRenderer as B, type Elements 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 ElementStyles as g, type LocalizationKey as h, NotificationStatus as i, type Theme as j };
@@ -1,7 +1,7 @@
1
- import { g as NovuOptions } from '../novu-jtIKy6p0.js';
2
- export { d as Notification } from '../novu-jtIKy6p0.js';
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-qgZnJ8j8.js';
4
- export { f as AppearanceKey, g as ElementStyles, E as Elements, h as LocalizationKey, i as NotificationStatus, V as Variables } from '../types-qgZnJ8j8.js';
1
+ import { g as NovuOptions } from '../novu-DJTVB7VN.js';
2
+ export { d as Notification } from '../novu-DJTVB7VN.js';
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-BPv1rvbm.js';
4
+ export { f as AppearanceKey, g as ElementStyles, E as Elements, h as LocalizationKey, i as NotificationStatus, V as Variables } from '../types-BPv1rvbm.js';
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';