@novu/js 3.3.1 → 3.4.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.
@@ -55,7 +55,7 @@ var isSameFilter = (filter1, filter2) => {
55
55
  // src/api/http-client.ts
56
56
  var DEFAULT_API_VERSION = "v1";
57
57
  var DEFAULT_BACKEND_URL = "https://api.novu.co";
58
- var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.3.1"}`;
58
+ var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.4.0"}`;
59
59
  var HttpClient = class {
60
60
  constructor(options = {}) {
61
61
  const {
@@ -273,6 +273,9 @@ var InboxService = class {
273
273
  const query = queryParams.size ? `?${queryParams.toString()}` : "";
274
274
  return __privateGet(this, _httpClient).get(`${INBOX_ROUTE}/preferences${query}`);
275
275
  }
276
+ bulkUpdatePreferences(preferences) {
277
+ return __privateGet(this, _httpClient).patch(`${INBOX_ROUTE}/preferences/bulk`, { preferences });
278
+ }
276
279
  updateGlobalPreferences(channels) {
277
280
  return __privateGet(this, _httpClient).patch(`${INBOX_ROUTE}/preferences`, channels);
278
281
  }
@@ -1348,11 +1351,13 @@ var updatePreference = (_0) => __async(void 0, [_0], function* ({
1348
1351
  useCache,
1349
1352
  args
1350
1353
  }) {
1351
- const { workflowId, channels } = args;
1354
+ var _a;
1355
+ const { channels } = args;
1356
+ const workflowId = "workflowId" in args ? args.workflowId : (_a = args.preference.workflow) == null ? void 0 : _a.id;
1352
1357
  try {
1353
1358
  emitter.emit("preference.update.pending", {
1354
1359
  args,
1355
- data: args.preference ? new Preference(
1360
+ data: "preference" in args ? new Preference(
1356
1361
  __spreadProps(__spreadValues({}, args.preference), {
1357
1362
  channels: __spreadValues(__spreadValues({}, args.preference.channels), channels)
1358
1363
  }),
@@ -1381,7 +1386,58 @@ var updatePreference = (_0) => __async(void 0, [_0], function* ({
1381
1386
  return { data: preference };
1382
1387
  } catch (error) {
1383
1388
  emitter.emit("preference.update.resolved", { args, error });
1384
- return { error: new NovuError("Failed to fetch notifications", error) };
1389
+ return { error: new NovuError("Failed to update preference", error) };
1390
+ }
1391
+ });
1392
+ var bulkUpdatePreference = (_0) => __async(void 0, [_0], function* ({
1393
+ emitter,
1394
+ apiService,
1395
+ cache,
1396
+ useCache,
1397
+ args
1398
+ }) {
1399
+ const globalPreference = args.find((arg) => "preference" in arg && arg.preference.level === "global" /* GLOBAL */);
1400
+ if (globalPreference) {
1401
+ return { error: new NovuError("Global preference is not supported in bulk update", "") };
1402
+ }
1403
+ try {
1404
+ const optimisticallyUpdatedPreferences = args.map(
1405
+ (arg) => "preference" in arg ? new Preference(
1406
+ __spreadProps(__spreadValues({}, arg.preference), {
1407
+ channels: __spreadValues(__spreadValues({}, arg.preference.channels), arg.channels)
1408
+ }),
1409
+ {
1410
+ emitterInstance: emitter,
1411
+ inboxServiceInstance: apiService,
1412
+ cache,
1413
+ useCache
1414
+ }
1415
+ ) : void 0
1416
+ ).filter((el) => el !== void 0);
1417
+ emitter.emit("preferences.bulk_update.pending", {
1418
+ args,
1419
+ data: optimisticallyUpdatedPreferences
1420
+ });
1421
+ const preferencesToUpdate = args.map((arg) => {
1422
+ var _a, _b, _c, _d;
1423
+ return __spreadValues({
1424
+ workflowId: "workflowId" in arg ? arg.workflowId : (_d = (_c = (_a = arg.preference.workflow) == null ? void 0 : _a.id) != null ? _c : (_b = arg.preference.workflow) == null ? void 0 : _b.identifier) != null ? _d : ""
1425
+ }, arg.channels);
1426
+ });
1427
+ const response = yield apiService.bulkUpdatePreferences(preferencesToUpdate);
1428
+ const preferences = response.map(
1429
+ (el) => new Preference(el, {
1430
+ emitterInstance: emitter,
1431
+ inboxServiceInstance: apiService,
1432
+ cache,
1433
+ useCache
1434
+ })
1435
+ );
1436
+ emitter.emit("preferences.bulk_update.resolved", { args, data: preferences });
1437
+ return { data: preferences };
1438
+ } catch (error) {
1439
+ emitter.emit("preferences.bulk_update.resolved", { args, error });
1440
+ return { error: new NovuError("Failed to bulk update preferences", error) };
1385
1441
  }
1386
1442
  });
1387
1443
  var optimisticUpdateWorkflowPreferences = ({
@@ -1393,7 +1449,7 @@ var optimisticUpdateWorkflowPreferences = ({
1393
1449
  }) => {
1394
1450
  const allPreferences = useCache ? cache == null ? void 0 : cache.getAll({}) : void 0;
1395
1451
  allPreferences == null ? void 0 : allPreferences.forEach((el) => {
1396
- var _a;
1452
+ var _a, _b;
1397
1453
  if (el.level === "template" /* TEMPLATE */) {
1398
1454
  const mergedPreference = __spreadProps(__spreadValues({}, el), {
1399
1455
  channels: Object.entries(el.channels).reduce((acc, [key, value]) => {
@@ -1403,7 +1459,7 @@ var optimisticUpdateWorkflowPreferences = ({
1403
1459
  return acc;
1404
1460
  }, {})
1405
1461
  });
1406
- const updatedPreference = args.preference ? new Preference(mergedPreference, {
1462
+ const updatedPreference = "preference" in args ? new Preference(mergedPreference, {
1407
1463
  emitterInstance: emitter,
1408
1464
  inboxServiceInstance: apiService,
1409
1465
  cache,
@@ -1412,7 +1468,7 @@ var optimisticUpdateWorkflowPreferences = ({
1412
1468
  if (updatedPreference) {
1413
1469
  emitter.emit("preference.update.pending", {
1414
1470
  args: {
1415
- workflowId: (_a = el.workflow) == null ? void 0 : _a.id,
1471
+ workflowId: (_b = (_a = el.workflow) == null ? void 0 : _a.id) != null ? _b : "",
1416
1472
  channels: updatedPreference.channels
1417
1473
  },
1418
1474
  data: updatedPreference
@@ -1446,7 +1502,6 @@ var Preference = class {
1446
1502
  }
1447
1503
  update({
1448
1504
  channels,
1449
- /** @deprecated Use channels instead */
1450
1505
  channelPreferences
1451
1506
  }) {
1452
1507
  var _a;
@@ -1458,12 +1513,7 @@ var Preference = class {
1458
1513
  args: {
1459
1514
  workflowId: (_a = this.workflow) == null ? void 0 : _a.id,
1460
1515
  channels: channels || channelPreferences,
1461
- preference: {
1462
- level: this.level,
1463
- enabled: this.enabled,
1464
- channels: this.channels,
1465
- workflow: this.workflow
1466
- }
1516
+ preference: this
1467
1517
  }
1468
1518
  });
1469
1519
  }
@@ -1474,7 +1524,12 @@ _cache3 = new WeakMap();
1474
1524
  _useCache2 = new WeakMap();
1475
1525
 
1476
1526
  // src/cache/preferences-cache.ts
1477
- var updateEvents2 = ["preference.update.pending", "preference.update.resolved"];
1527
+ var updateEvents2 = [
1528
+ "preference.update.pending",
1529
+ "preference.update.resolved",
1530
+ "preferences.bulk_update.pending",
1531
+ "preferences.bulk_update.resolved"
1532
+ ];
1478
1533
  var excludeEmpty2 = ({ tags }) => Object.entries({ tags }).reduce((acc, [key, value]) => {
1479
1534
  if (value === null || value === void 0 || Array.isArray(value) && value.length === 0) {
1480
1535
  return acc;
@@ -1513,14 +1568,22 @@ var PreferencesCache = class {
1513
1568
  if (!data) {
1514
1569
  return;
1515
1570
  }
1571
+ const preferences = Array.isArray(data) ? data : [data];
1572
+ const uniqueFilterKeys = /* @__PURE__ */ new Set();
1516
1573
  __privateGet(this, _cache4).keys().forEach((key) => {
1517
- const hasUpdatedPreference = this.updatePreference(key, data);
1518
- const updatedPreference = __privateGet(this, _cache4).get(key);
1519
- if (!hasUpdatedPreference || !updatedPreference) {
1520
- return;
1521
- }
1574
+ preferences.forEach((preference) => {
1575
+ const hasUpdatedPreference = this.updatePreference(key, preference);
1576
+ const updatedPreference = __privateGet(this, _cache4).get(key);
1577
+ if (!hasUpdatedPreference || !updatedPreference) {
1578
+ return;
1579
+ }
1580
+ uniqueFilterKeys.add(key);
1581
+ });
1582
+ });
1583
+ uniqueFilterKeys.forEach((key) => {
1584
+ var _a;
1522
1585
  __privateGet(this, _emitter4).emit("preferences.list.updated", {
1523
- data: updatedPreference
1586
+ data: (_a = __privateGet(this, _cache4).get(key)) != null ? _a : []
1524
1587
  });
1525
1588
  });
1526
1589
  };
@@ -1596,6 +1659,32 @@ var Preferences = class extends BaseModule {
1596
1659
  }));
1597
1660
  });
1598
1661
  }
1662
+ update(args) {
1663
+ return __async(this, null, function* () {
1664
+ return this.callWithSession(
1665
+ () => updatePreference({
1666
+ emitter: this._emitter,
1667
+ apiService: this._inboxService,
1668
+ cache: this.cache,
1669
+ useCache: __privateGet(this, _useCache3),
1670
+ args
1671
+ })
1672
+ );
1673
+ });
1674
+ }
1675
+ bulkUpdate(args) {
1676
+ return __async(this, null, function* () {
1677
+ return this.callWithSession(
1678
+ () => bulkUpdatePreference({
1679
+ emitter: this._emitter,
1680
+ apiService: this._inboxService,
1681
+ cache: this.cache,
1682
+ useCache: __privateGet(this, _useCache3),
1683
+ args
1684
+ })
1685
+ );
1686
+ });
1687
+ }
1599
1688
  };
1600
1689
  _useCache3 = new WeakMap();
1601
1690
 
@@ -1,5 +1,5 @@
1
- import { N as NotificationFilter } from './novu-DJTVB7VN.mjs';
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.mjs';
1
+ import { N as NotificationFilter } from './novu-Nrvpy3Z1.mjs';
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-Nrvpy3Z1.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 { ChannelType, NotificationStatus, Novu, PreferenceLevel, WebSocketEvent, areTagsEqual, isSameFilter } from './chunk-JKFCSXQM.mjs';
1
+ export { ChannelType, NotificationStatus, Novu, PreferenceLevel, WebSocketEvent, areTagsEqual, isSameFilter } from './chunk-LVZEXMKC.mjs';
2
2
  import './chunk-STZMOEWR.mjs';
@@ -6,18 +6,15 @@ declare class NovuError extends Error {
6
6
  type ListPreferencesArgs = {
7
7
  tags?: string[];
8
8
  };
9
- type UpdatePreferencesArgs = {
10
- workflowId?: string;
9
+ type BasePreferenceArgs = {
10
+ workflowId: string;
11
11
  channels: ChannelPreference;
12
- /** @deprecated Use channels instead */
13
- channelPreferences?: ChannelPreference;
14
- preference?: {
15
- level: PreferenceLevel;
16
- enabled: boolean;
17
- channels: ChannelPreference;
18
- workflow?: Workflow;
19
- };
20
12
  };
13
+ type InstancePreferenceArgs = {
14
+ preference: Preference;
15
+ channels: ChannelPreference;
16
+ };
17
+ type UpdatePreferenceArgs = BasePreferenceArgs | InstancePreferenceArgs;
21
18
 
22
19
  declare class PreferencesCache {
23
20
  #private;
@@ -45,9 +42,10 @@ declare class Preference {
45
42
  cache: PreferencesCache;
46
43
  useCache: boolean;
47
44
  });
48
- update({ channels,
49
- /** @deprecated Use channels instead */
50
- channelPreferences, }: Prettify<Pick<UpdatePreferencesArgs, 'channels' | 'channelPreferences'>>): Result<Preference>;
45
+ update({ channels, channelPreferences, }: Prettify<Pick<UpdatePreferenceArgs, 'channels'> & {
46
+ /** @deprecated Use channels instead */
47
+ channelPreferences?: ChannelPreference;
48
+ }>): Result<Preference>;
51
49
  }
52
50
 
53
51
  declare global {
@@ -265,6 +263,9 @@ declare class InboxService {
265
263
  actionType: ActionTypeEnum;
266
264
  }): Promise<InboxNotification>;
267
265
  fetchPreferences(tags?: string[]): Promise<PreferencesResponse[]>;
266
+ bulkUpdatePreferences(preferences: Array<{
267
+ workflowId: string;
268
+ } & ChannelPreference>): Promise<PreferencesResponse[]>;
268
269
  updateGlobalPreferences(channels: ChannelPreference): Promise<PreferencesResponse>;
269
270
  updateWorkflowPreferences({ workflowId, channels, }: {
270
271
  workflowId: string;
@@ -490,7 +491,8 @@ type NotificationsReadArchivedAllEvents = BaseEvents<'notifications.archive_all_
490
491
  tags?: string[];
491
492
  }, Notification[]>;
492
493
  type PreferencesFetchEvents = BaseEvents<'preferences.list', ListPreferencesArgs, Preference[]>;
493
- type PreferenceUpdateEvents = BaseEvents<'preference.update', UpdatePreferencesArgs, Preference>;
494
+ type PreferenceUpdateEvents = BaseEvents<'preference.update', UpdatePreferenceArgs, Preference>;
495
+ type PreferencesBulkUpdateEvents = BaseEvents<'preferences.bulk_update', Array<UpdatePreferenceArgs>, Preference[]>;
494
496
  type SocketConnectEvents = BaseEvents<'socket.connect', {
495
497
  socketUrl: string;
496
498
  }, undefined>;
@@ -530,7 +532,7 @@ type Events = SessionInitializeEvents & NotificationsFetchEvents & {
530
532
  'preferences.list.updated': {
531
533
  data: Preference[];
532
534
  };
533
- } & PreferenceUpdateEvents & SocketConnectEvents & SocketEvents & NotificationReadEvents & NotificationUnreadEvents & NotificationArchiveEvents & NotificationUnarchiveEvents & NotificationSnoozeEvents & NotificationUnsnoozeEvents & NotificationCompleteActionEvents & NotificationRevertActionEvents & NotificationsReadAllEvents & NotificationsArchivedAllEvents & NotificationsReadArchivedAllEvents;
535
+ } & PreferenceUpdateEvents & PreferencesBulkUpdateEvents & SocketConnectEvents & SocketEvents & NotificationReadEvents & NotificationUnreadEvents & NotificationArchiveEvents & NotificationUnarchiveEvents & NotificationSnoozeEvents & NotificationUnsnoozeEvents & NotificationCompleteActionEvents & NotificationRevertActionEvents & NotificationsReadAllEvents & NotificationsArchivedAllEvents & NotificationsReadArchivedAllEvents;
534
536
  type EventNames = keyof Events;
535
537
  type SocketEventNames = keyof SocketEvents;
536
538
  type EventHandler<T = unknown> = (event: T) => void;
@@ -552,6 +554,10 @@ declare class Preferences extends BaseModule {
552
554
  eventEmitterInstance: NovuEventEmitter;
553
555
  });
554
556
  list(args?: ListPreferencesArgs): Result<Preference[]>;
557
+ update(args: BasePreferenceArgs): Result<Preference>;
558
+ update(args: InstancePreferenceArgs): Result<Preference>;
559
+ bulkUpdate(args: Array<BasePreferenceArgs>): Result<Preference[]>;
560
+ bulkUpdate(args: Array<InstancePreferenceArgs>): Result<Preference[]>;
555
561
  }
556
562
 
557
563
  declare class Socket extends BaseModule {
@@ -1,5 +1,5 @@
1
- import { j as Theme } from '../types-CYgpCW2I.mjs';
2
- import '../novu-DJTVB7VN.mjs';
1
+ import { m as Theme } from '../types-C13lyN-Z.mjs';
2
+ import '../novu-Nrvpy3Z1.mjs';
3
3
 
4
4
  declare const dark: Theme;
5
5
 
@@ -1,6 +1,6 @@
1
- import { d as Notification, N as NotificationFilter, g as NovuOptions, b as Novu } from './novu-DJTVB7VN.mjs';
1
+ import { d as Notification, N as NotificationFilter, g as NovuOptions, b as Novu, P as Preference } from './novu-Nrvpy3Z1.mjs';
2
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"];
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", "workflowLabelHeaderContainer", "workflowLabelIcon", "workflowLabelContainer", "workflowContainerDisabledNotice", "workflowLabelDisabled__icon", "workflowContainerRight__icon", "workflowArrow__icon", "workflowDescription", "preferencesGroupContainer", "preferencesGroupHeader", "preferencesGroupLabelContainer", "preferencesGroupLabelIcon", "preferencesGroupLabel", "preferencesGroupActionsContainer", "preferencesGroupActionsContainerRight__icon", "preferencesGroupBody", "preferencesGroupChannels", "preferencesGroupInfo", "preferencesGroupInfoIcon", "preferencesGroupWorkflows", "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
4
 
5
5
  declare const defaultLocalization: {
6
6
  readonly locale: "en-US";
@@ -31,6 +31,7 @@ declare const defaultLocalization: {
31
31
  readonly 'preferences.global': "Global Preferences";
32
32
  readonly 'preferences.workflow.disabled.notice': "Contact admin to enable subscription management for this critical notification.";
33
33
  readonly 'preferences.workflow.disabled.tooltip': "Contact admin to edit";
34
+ readonly 'preferences.group.info': "Applies to all notifications under this group.";
34
35
  readonly 'snooze.datePicker.timePickerLabel': "Time";
35
36
  readonly 'snooze.datePicker.apply': "Apply";
36
37
  readonly 'snooze.datePicker.cancel': "Cancel";
@@ -89,20 +90,30 @@ type Variables = {
89
90
  };
90
91
  type AppearanceKey = (typeof appearanceKeys)[number];
91
92
  type Elements = Partial<Record<AppearanceKey, ElementStyles>>;
93
+ type IconKey = 'bell' | 'clock' | 'arrowDropDown' | 'dots' | 'markAsRead' | 'cogs' | 'trash' | 'markAsArchived' | 'markAsArchivedRead' | 'markAsUnread' | 'markAsUnarchived' | 'unsnooze' | 'arrowRight' | 'arrowLeft' | 'unread' | 'sms' | 'inApp' | 'email' | 'push' | 'chat' | 'check' | 'arrowDown' | 'routeFill' | 'info' | 'nodeTree';
94
+ type IconRenderer = (el: HTMLDivElement, props: {
95
+ class?: string;
96
+ }) => () => void;
97
+ type IconOverrides = {
98
+ [key in IconKey]?: IconRenderer;
99
+ };
92
100
  type Theme = {
93
101
  variables?: Variables;
94
102
  elements?: Elements;
95
103
  animations?: boolean;
104
+ icons?: IconOverrides;
96
105
  };
97
106
  type Appearance = Theme & {
98
107
  baseTheme?: Theme | Theme[];
99
108
  };
100
109
  type BaseNovuProviderProps = {
110
+ container?: Node | string | null;
101
111
  appearance?: Appearance;
102
112
  localization?: Localization;
103
113
  options: NovuOptions;
104
114
  tabs?: Array<Tab>;
105
115
  preferencesFilter?: PreferencesFilter;
116
+ preferenceGroups?: PreferenceGroups;
106
117
  routerPush?: RouterPush;
107
118
  novu?: Novu;
108
119
  };
@@ -117,5 +128,15 @@ declare enum NotificationStatus {
117
128
  SNOOZED = "snoozed"
118
129
  }
119
130
  type PreferencesFilter = Pick<NotificationFilter, 'tags'>;
131
+ type PreferenceFilterFunction = (args: {
132
+ preferences: Preference[];
133
+ }) => Preference[];
134
+ type PreferenceGroupFilter = (PreferencesFilter & {
135
+ workflowIds?: string[];
136
+ }) | PreferenceFilterFunction;
137
+ type PreferenceGroups = Array<{
138
+ name: string;
139
+ filter: PreferenceGroupFilter;
140
+ }>;
120
141
 
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 };
142
+ export { type Appearance as A, type BellRenderer as B, type Elements as E, type IconKey as I, 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 PreferenceGroups as f, type AppearanceKey as g, type ElementStyles as h, type IconOverrides as i, type IconRenderer as j, type LocalizationKey as k, NotificationStatus as l, type Theme as m };
@@ -1,7 +1,7 @@
1
- import { g as NovuOptions } from '../novu-DJTVB7VN.mjs';
2
- export { d as Notification } from '../novu-DJTVB7VN.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-CYgpCW2I.mjs';
4
- export { f as AppearanceKey, g as ElementStyles, E as Elements, h as LocalizationKey, i as NotificationStatus, V as Variables } from '../types-CYgpCW2I.mjs';
1
+ import { g as NovuOptions } from '../novu-Nrvpy3Z1.mjs';
2
+ export { d as Notification } from '../novu-Nrvpy3Z1.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, f as PreferenceGroups, R as RouterPush } from '../types-C13lyN-Z.mjs';
4
+ export { g as AppearanceKey, h as ElementStyles, E as Elements, I as IconKey, i as IconOverrides, j as IconRenderer, k as LocalizationKey, l as NotificationStatus, m as Theme, V as Variables } from '../types-C13lyN-Z.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';
@@ -71,8 +71,10 @@ declare class NovuUI {
71
71
  updateOptions(options: NovuOptions): void;
72
72
  updateTabs(tabs?: Array<Tab>): void;
73
73
  updatePreferencesFilter(preferencesFilter?: PreferencesFilter): void;
74
+ updatePreferenceGroups(preferenceGroups?: PreferenceGroups): void;
74
75
  updateRouterPush(routerPush?: RouterPush): void;
76
+ updateContainer(container?: Node | string | null): void;
75
77
  unmount(): void;
76
78
  }
77
79
 
78
- export { Appearance, type BaseNovuUIOptions, BellRenderer, BodyRenderer, InboxPage, type InboxProps, Localization, NotificationActionClickHandler, NotificationClickHandler, NotificationRenderer, NovuProviderProps, NovuUI, type NovuUIOptions, PreferencesFilter, RouterPush, SubjectRenderer, Tab };
80
+ export { Appearance, type BaseNovuUIOptions, BellRenderer, BodyRenderer, InboxPage, type InboxProps, Localization, NotificationActionClickHandler, NotificationClickHandler, NotificationRenderer, NovuProviderProps, NovuUI, type NovuUIOptions, PreferenceGroups, PreferencesFilter, RouterPush, SubjectRenderer, Tab };