@novu/js 3.13.0 → 3.14.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.
package/README.md CHANGED
@@ -81,3 +81,20 @@ const novu = new Novu({
81
81
  ```
82
82
 
83
83
  > Note: When HMAC encryption is enabled and `context` is provided, the `contextHash` is required. The hash is order-independent, so `{a:1, b:2}` produces the same hash as `{b:2, a:1}`.
84
+
85
+ ## Socket Options
86
+
87
+ You can provide custom socket configuration options using the `socketOptions` parameter. These options will be merged with the default socket configuration when initializing the WebSocket connection.
88
+
89
+ ```ts
90
+ const novu = new Novu({
91
+ applicationIdentifier: 'YOUR_NOVU_APPLICATION_IDENTIFIER',
92
+ subscriber: 'YOUR_INTERNAL_SUBSCRIBER_ID',
93
+ socketOptions: {
94
+ reconnectionDelay: 5000,
95
+ timeout: 20000,
96
+ path: '/my-custom-path',
97
+ // ... other socket.io-client options
98
+ },
99
+ });
100
+ ```
@@ -47,7 +47,7 @@ var areDataEqual = (data1, data2) => {
47
47
  }
48
48
  };
49
49
  var isSameFilter = (filter1, filter2) => {
50
- return areDataEqual(filter1.data, filter2.data) && areTagsEqual(filter1.tags, filter2.tags) && filter1.read === filter2.read && filter1.archived === filter2.archived && filter1.snoozed === filter2.snoozed && filter1.seen === filter2.seen && areSeveritiesEqual(filter1.severity, filter2.severity);
50
+ return areDataEqual(filter1.data, filter2.data) && areTagsEqual(filter1.tags, filter2.tags) && filter1.read === filter2.read && filter1.archived === filter2.archived && filter1.snoozed === filter2.snoozed && filter1.seen === filter2.seen && areSeveritiesEqual(filter1.severity, filter2.severity) && filter1.createdGte === filter2.createdGte && filter1.createdLte === filter2.createdLte;
51
51
  };
52
52
  function checkNotificationDataFilter(notificationData, filterData) {
53
53
  if (!filterData || Object.keys(filterData).length === 0) {
@@ -99,8 +99,25 @@ function checkBasicFilters(notification, filter) {
99
99
  }
100
100
  return true;
101
101
  }
102
+ function checkNotificationTimeframeFilter(notificationCreatedAt, createdGte, createdLte) {
103
+ if (!createdGte && !createdLte) {
104
+ return true;
105
+ }
106
+ const createdAtDate = new Date(notificationCreatedAt).getTime();
107
+ if (createdGte) {
108
+ if (createdAtDate < createdGte) {
109
+ return false;
110
+ }
111
+ }
112
+ if (createdLte) {
113
+ if (createdAtDate > createdLte) {
114
+ return false;
115
+ }
116
+ }
117
+ return true;
118
+ }
102
119
  function checkNotificationMatchesFilter(notification, filter) {
103
- return checkBasicFilters(notification, filter) && checkNotificationTagFilter(notification.tags, filter.tags) && checkNotificationDataFilter(notification.data, filter.data);
120
+ return checkBasicFilters(notification, filter) && checkNotificationTagFilter(notification.tags, filter.tags) && checkNotificationDataFilter(notification.data, filter.data) && checkNotificationTimeframeFilter(notification.createdAt, filter.createdGte, filter.createdLte);
104
121
  }
105
122
 
106
123
  // src/subscriptions/subscription.ts
@@ -594,7 +611,7 @@ var SubscriptionsCache = class {
594
611
  if (!subscriptions) continue;
595
612
  let hasUpdates = false;
596
613
  const updatedSubscriptions = subscriptions.map((subscription) => {
597
- const subscriptionPreferences = preferencesBySubscription.get(subscription.id);
614
+ const subscriptionPreferences = preferencesBySubscription.get(subscription.identifier);
598
615
  if (subscriptionPreferences) {
599
616
  hasUpdates = true;
600
617
  return this.createUpdatedSubscription(subscription, subscriptionPreferences);
@@ -612,7 +629,7 @@ var SubscriptionsCache = class {
612
629
  for (const key of allItemKeys) {
613
630
  const subscription = chunk7B52C2XE_js.__privateGet(this, _itemCache).get(key);
614
631
  if (!subscription) continue;
615
- const subscriptionPreferences = preferencesBySubscription.get(subscription.id);
632
+ const subscriptionPreferences = preferencesBySubscription.get(subscription.identifier);
616
633
  if (subscriptionPreferences) {
617
634
  const updatedSubscription = this.createUpdatedSubscription(subscription, subscriptionPreferences);
618
635
  chunk7B52C2XE_js.__privateGet(this, _itemCache).set(key, updatedSubscription);
@@ -883,24 +900,18 @@ _contextKey = new WeakMap();
883
900
 
884
901
  // src/api/http-client.ts
885
902
  var DEFAULT_API_VERSION = "v1";
886
- var DEFAULT_CLIENT_VERSION = `${"@novu/js"}@${"3.13.0"}`;
903
+ var DEFAULT_CLIENT_VERSION = `${"@novu/js"}@${"3.14.0"}`;
887
904
  var HttpClient = class {
888
905
  constructor(options = {}) {
889
906
  // Environment variable for local development that overrides the default API endpoint without affecting the Inbox DX
890
907
  this.DEFAULT_BACKEND_URL = typeof window !== "undefined" && window.NOVU_LOCAL_BACKEND_URL || "https://api.novu.co";
891
- const {
892
- apiVersion = DEFAULT_API_VERSION,
893
- apiUrl = this.DEFAULT_BACKEND_URL,
894
- userAgent = DEFAULT_CLIENT_VERSION,
895
- headers = {}
896
- } = options || {};
908
+ const { apiVersion = DEFAULT_API_VERSION, apiUrl = this.DEFAULT_BACKEND_URL, headers = {} } = options || {};
897
909
  this.apiVersion = apiVersion;
898
910
  this.apiUrl = `${apiUrl}/${apiVersion}`;
899
911
  this.headers = chunk7B52C2XE_js.__spreadValues({
900
912
  "Novu-API-Version": "2024-06-26",
901
913
  "Novu-Client-Version": DEFAULT_CLIENT_VERSION,
902
- "Content-Type": "application/json",
903
- "User-Agent": userAgent
914
+ "Content-Type": "application/json"
904
915
  }, headers);
905
916
  }
906
917
  setAuthorizationToken(token) {
@@ -1043,7 +1054,9 @@ var InboxService = class {
1043
1054
  snoozed,
1044
1055
  seen: seen2,
1045
1056
  data,
1046
- severity
1057
+ severity,
1058
+ createdGte,
1059
+ createdLte
1047
1060
  }) {
1048
1061
  const searchParams = new URLSearchParams(`limit=${limit}`);
1049
1062
  if (after) {
@@ -1079,6 +1092,12 @@ var InboxService = class {
1079
1092
  } else if (severity) {
1080
1093
  searchParams.append("severity", severity);
1081
1094
  }
1095
+ if (createdGte) {
1096
+ searchParams.append("createdGte", `${createdGte}`);
1097
+ }
1098
+ if (createdLte) {
1099
+ searchParams.append("createdLte", `${createdLte}`);
1100
+ }
1082
1101
  return chunk7B52C2XE_js.__privateGet(this, _httpClient).get(INBOX_NOTIFICATIONS_ROUTE, searchParams, false);
1083
1102
  }
1084
1103
  count({
@@ -1317,8 +1336,10 @@ var excludeEmpty = ({
1317
1336
  severity,
1318
1337
  limit,
1319
1338
  offset,
1320
- after
1321
- }) => Object.entries({ tags, data, read: read2, archived, snoozed, seen: seen2, severity, limit, offset, after }).filter(([_, value]) => value !== null && value !== void 0 && !(Array.isArray(value) && value.length === 0)).reduce((acc, [key, value]) => {
1339
+ after,
1340
+ createdGte,
1341
+ createdLte
1342
+ }) => Object.entries({ tags, data, read: read2, archived, snoozed, seen: seen2, severity, limit, offset, after, createdGte, createdLte }).filter(([_, value]) => value !== null && value !== void 0 && !(Array.isArray(value) && value.length === 0)).reduce((acc, [key, value]) => {
1322
1343
  acc[key] = value;
1323
1344
  return acc;
1324
1345
  }, {});
@@ -1332,9 +1353,13 @@ var getCacheKey = ({
1332
1353
  severity,
1333
1354
  limit,
1334
1355
  offset,
1335
- after
1356
+ after,
1357
+ createdGte,
1358
+ createdLte
1336
1359
  }) => {
1337
- return JSON.stringify(excludeEmpty({ tags, data, read: read2, archived, snoozed, seen: seen2, severity, limit, offset, after }));
1360
+ return JSON.stringify(
1361
+ excludeEmpty({ tags, data, read: read2, archived, snoozed, seen: seen2, severity, limit, offset, after, createdGte, createdLte })
1362
+ );
1338
1363
  };
1339
1364
  var getFilterKey = ({
1340
1365
  tags,
@@ -1343,9 +1368,11 @@ var getFilterKey = ({
1343
1368
  archived,
1344
1369
  snoozed,
1345
1370
  seen: seen2,
1346
- severity
1371
+ severity,
1372
+ createdGte,
1373
+ createdLte
1347
1374
  }) => {
1348
- return JSON.stringify(excludeEmpty({ tags, data, read: read2, archived, snoozed, seen: seen2, severity }));
1375
+ return JSON.stringify(excludeEmpty({ tags, data, read: read2, archived, snoozed, seen: seen2, severity, createdGte, createdLte }));
1349
1376
  };
1350
1377
  var getFilter = (key) => {
1351
1378
  return JSON.parse(key);
@@ -1531,7 +1558,9 @@ var NotificationsCache = class {
1531
1558
  snoozed: args.snoozed,
1532
1559
  archived: args.archived,
1533
1560
  seen: args.seen,
1534
- severity: args.severity
1561
+ severity: args.severity,
1562
+ createdGte: args.createdGte,
1563
+ createdLte: args.createdLte
1535
1564
  });
1536
1565
  }
1537
1566
  }
@@ -2769,10 +2798,11 @@ var mapToNotification = ({
2769
2798
  severity
2770
2799
  });
2771
2800
  };
2772
- var _token, _emitter10, _partySocket, _socketUrl, _notificationReceived, _unseenCountChanged, _unreadCountChanged, _handleMessage, _PartySocketClient_instances, initializeSocket_fn, handleConnectSocket_fn, handleDisconnectSocket_fn;
2801
+ var _token, _emitter10, _partySocket, _socketUrl, _socketOptions, _notificationReceived, _unseenCountChanged, _unreadCountChanged, _handleMessage, _PartySocketClient_instances, initializeSocket_fn, handleConnectSocket_fn, handleDisconnectSocket_fn;
2773
2802
  var PartySocketClient = class extends BaseModule {
2774
2803
  constructor({
2775
2804
  socketUrl,
2805
+ socketOptions,
2776
2806
  inboxServiceInstance,
2777
2807
  eventEmitterInstance
2778
2808
  }) {
@@ -2785,6 +2815,7 @@ var PartySocketClient = class extends BaseModule {
2785
2815
  chunk7B52C2XE_js.__privateAdd(this, _emitter10);
2786
2816
  chunk7B52C2XE_js.__privateAdd(this, _partySocket);
2787
2817
  chunk7B52C2XE_js.__privateAdd(this, _socketUrl);
2818
+ chunk7B52C2XE_js.__privateAdd(this, _socketOptions);
2788
2819
  chunk7B52C2XE_js.__privateAdd(this, _notificationReceived, (event) => {
2789
2820
  try {
2790
2821
  const data = JSON.parse(event.data);
@@ -2839,6 +2870,7 @@ var PartySocketClient = class extends BaseModule {
2839
2870
  });
2840
2871
  chunk7B52C2XE_js.__privateSet(this, _emitter10, eventEmitterInstance);
2841
2872
  chunk7B52C2XE_js.__privateSet(this, _socketUrl, socketUrl != null ? socketUrl : PRODUCTION_SOCKET_URL);
2873
+ chunk7B52C2XE_js.__privateSet(this, _socketOptions, socketOptions);
2842
2874
  }
2843
2875
  onSessionSuccess({ token }) {
2844
2876
  chunk7B52C2XE_js.__privateSet(this, _token, token);
@@ -2867,6 +2899,7 @@ _token = new WeakMap();
2867
2899
  _emitter10 = new WeakMap();
2868
2900
  _partySocket = new WeakMap();
2869
2901
  _socketUrl = new WeakMap();
2902
+ _socketOptions = new WeakMap();
2870
2903
  _notificationReceived = new WeakMap();
2871
2904
  _unseenCountChanged = new WeakMap();
2872
2905
  _unreadCountChanged = new WeakMap();
@@ -2881,7 +2914,7 @@ initializeSocket_fn = function() {
2881
2914
  chunk7B52C2XE_js.__privateGet(this, _emitter10).emit("socket.connect.pending", { args });
2882
2915
  const url = new URL(chunk7B52C2XE_js.__privateGet(this, _socketUrl));
2883
2916
  url.searchParams.set("token", chunk7B52C2XE_js.__privateGet(this, _token));
2884
- chunk7B52C2XE_js.__privateSet(this, _partySocket, new partysocket.WebSocket(url.toString()));
2917
+ chunk7B52C2XE_js.__privateSet(this, _partySocket, new partysocket.WebSocket(url.toString(), void 0, chunk7B52C2XE_js.__privateGet(this, _socketOptions)));
2885
2918
  chunk7B52C2XE_js.__privateGet(this, _partySocket).addEventListener("open", () => {
2886
2919
  chunk7B52C2XE_js.__privateGet(this, _emitter10).emit("socket.connect.resolved", { args });
2887
2920
  });
@@ -3004,10 +3037,11 @@ var mapToNotification2 = ({
3004
3037
  severity
3005
3038
  });
3006
3039
  };
3007
- var _token2, _emitter11, _socketIo, _socketUrl2, _notificationReceived2, _unseenCountChanged2, _unreadCountChanged2, _Socket_instances, initializeSocket_fn2, handleConnectSocket_fn2, handleDisconnectSocket_fn2;
3040
+ var _token2, _emitter11, _socketIo, _socketUrl2, _socketOptions2, _notificationReceived2, _unseenCountChanged2, _unreadCountChanged2, _Socket_instances, initializeSocket_fn2, handleConnectSocket_fn2, handleDisconnectSocket_fn2;
3008
3041
  var Socket = class extends BaseModule {
3009
3042
  constructor({
3010
3043
  socketUrl,
3044
+ socketOptions,
3011
3045
  inboxServiceInstance,
3012
3046
  eventEmitterInstance
3013
3047
  }) {
@@ -3020,6 +3054,7 @@ var Socket = class extends BaseModule {
3020
3054
  chunk7B52C2XE_js.__privateAdd(this, _emitter11);
3021
3055
  chunk7B52C2XE_js.__privateAdd(this, _socketIo);
3022
3056
  chunk7B52C2XE_js.__privateAdd(this, _socketUrl2);
3057
+ chunk7B52C2XE_js.__privateAdd(this, _socketOptions2);
3023
3058
  chunk7B52C2XE_js.__privateAdd(this, _notificationReceived2, ({ message }) => {
3024
3059
  chunk7B52C2XE_js.__privateGet(this, _emitter11).emit(NOTIFICATION_RECEIVED2, {
3025
3060
  result: new chunkCCAUG7YI_js.Notification(mapToNotification2(message), chunk7B52C2XE_js.__privateGet(this, _emitter11), this._inboxService)
@@ -3037,6 +3072,7 @@ var Socket = class extends BaseModule {
3037
3072
  });
3038
3073
  chunk7B52C2XE_js.__privateSet(this, _emitter11, eventEmitterInstance);
3039
3074
  chunk7B52C2XE_js.__privateSet(this, _socketUrl2, socketUrl != null ? socketUrl : PRODUCTION_SOCKET_URL2);
3075
+ chunk7B52C2XE_js.__privateSet(this, _socketOptions2, socketOptions);
3040
3076
  }
3041
3077
  onSessionSuccess({ token }) {
3042
3078
  chunk7B52C2XE_js.__privateSet(this, _token2, token);
@@ -3065,34 +3101,35 @@ _token2 = new WeakMap();
3065
3101
  _emitter11 = new WeakMap();
3066
3102
  _socketIo = new WeakMap();
3067
3103
  _socketUrl2 = new WeakMap();
3104
+ _socketOptions2 = new WeakMap();
3068
3105
  _notificationReceived2 = new WeakMap();
3069
3106
  _unseenCountChanged2 = new WeakMap();
3070
3107
  _unreadCountChanged2 = new WeakMap();
3071
3108
  _Socket_instances = new WeakSet();
3072
3109
  initializeSocket_fn2 = function() {
3073
3110
  return chunk7B52C2XE_js.__async(this, null, function* () {
3074
- var _a, _b, _c;
3111
+ var _a, _b, _c, _d;
3075
3112
  if (chunk7B52C2XE_js.__privateGet(this, _socketIo)) {
3076
3113
  return;
3077
3114
  }
3078
3115
  const args = { socketUrl: chunk7B52C2XE_js.__privateGet(this, _socketUrl2) };
3079
3116
  chunk7B52C2XE_js.__privateGet(this, _emitter11).emit("socket.connect.pending", { args });
3080
- chunk7B52C2XE_js.__privateSet(this, _socketIo, io__default.default(chunk7B52C2XE_js.__privateGet(this, _socketUrl2), {
3117
+ chunk7B52C2XE_js.__privateSet(this, _socketIo, io__default.default(chunk7B52C2XE_js.__privateGet(this, _socketUrl2), chunk7B52C2XE_js.__spreadValues({
3081
3118
  reconnectionDelayMax: 1e4,
3082
3119
  transports: ["websocket"],
3083
3120
  query: {
3084
3121
  token: `${chunk7B52C2XE_js.__privateGet(this, _token2)}`
3085
3122
  }
3086
- }));
3123
+ }, (_a = chunk7B52C2XE_js.__privateGet(this, _socketOptions2)) != null ? _a : {})));
3087
3124
  chunk7B52C2XE_js.__privateGet(this, _socketIo).on("connect", () => {
3088
3125
  chunk7B52C2XE_js.__privateGet(this, _emitter11).emit("socket.connect.resolved", { args });
3089
3126
  });
3090
3127
  chunk7B52C2XE_js.__privateGet(this, _socketIo).on("connect_error", (error) => {
3091
3128
  chunk7B52C2XE_js.__privateGet(this, _emitter11).emit("socket.connect.resolved", { args, error });
3092
3129
  });
3093
- (_a = chunk7B52C2XE_js.__privateGet(this, _socketIo)) == null ? void 0 : _a.on("notification_received" /* RECEIVED */, chunk7B52C2XE_js.__privateGet(this, _notificationReceived2));
3094
- (_b = chunk7B52C2XE_js.__privateGet(this, _socketIo)) == null ? void 0 : _b.on("unseen_count_changed" /* UNSEEN */, chunk7B52C2XE_js.__privateGet(this, _unseenCountChanged2));
3095
- (_c = chunk7B52C2XE_js.__privateGet(this, _socketIo)) == null ? void 0 : _c.on("unread_count_changed" /* UNREAD */, chunk7B52C2XE_js.__privateGet(this, _unreadCountChanged2));
3130
+ (_b = chunk7B52C2XE_js.__privateGet(this, _socketIo)) == null ? void 0 : _b.on("notification_received" /* RECEIVED */, chunk7B52C2XE_js.__privateGet(this, _notificationReceived2));
3131
+ (_c = chunk7B52C2XE_js.__privateGet(this, _socketIo)) == null ? void 0 : _c.on("unseen_count_changed" /* UNSEEN */, chunk7B52C2XE_js.__privateGet(this, _unseenCountChanged2));
3132
+ (_d = chunk7B52C2XE_js.__privateGet(this, _socketIo)) == null ? void 0 : _d.on("unread_count_changed" /* UNREAD */, chunk7B52C2XE_js.__privateGet(this, _unreadCountChanged2));
3096
3133
  });
3097
3134
  };
3098
3135
  handleConnectSocket_fn2 = function() {
@@ -3139,6 +3176,7 @@ function shouldUsePartySocket(socketUrl) {
3139
3176
  }
3140
3177
  function createSocket({
3141
3178
  socketUrl,
3179
+ socketOptions,
3142
3180
  inboxServiceInstance,
3143
3181
  eventEmitterInstance
3144
3182
  }) {
@@ -3148,6 +3186,7 @@ function createSocket({
3148
3186
  case "partysocket" /* PARTY_SOCKET */:
3149
3187
  return new PartySocketClient({
3150
3188
  socketUrl: transformedSocketUrl,
3189
+ socketOptions,
3151
3190
  inboxServiceInstance,
3152
3191
  eventEmitterInstance
3153
3192
  });
@@ -3155,6 +3194,7 @@ function createSocket({
3155
3194
  default:
3156
3195
  return new Socket({
3157
3196
  socketUrl: transformedSocketUrl,
3197
+ socketOptions,
3158
3198
  inboxServiceInstance,
3159
3199
  eventEmitterInstance
3160
3200
  });
@@ -3172,8 +3212,7 @@ var Novu = class {
3172
3212
  var _a, _b, _c;
3173
3213
  chunk7B52C2XE_js.__privateSet(this, _options2, options);
3174
3214
  chunk7B52C2XE_js.__privateSet(this, _inboxService6, new InboxService({
3175
- apiUrl: options.apiUrl || options.backendUrl,
3176
- userAgent: options.__userAgent
3215
+ apiUrl: options.apiUrl || options.backendUrl
3177
3216
  }));
3178
3217
  chunk7B52C2XE_js.__privateSet(this, _emitter12, new NovuEventEmitter());
3179
3218
  const subscriber = chunkCCAUG7YI_js.buildSubscriber({ subscriberId: options.subscriberId, subscriber: options.subscriber });
@@ -3210,6 +3249,7 @@ var Novu = class {
3210
3249
  });
3211
3250
  this.socket = createSocket({
3212
3251
  socketUrl: options.socketUrl,
3252
+ socketOptions: options.socketOptions,
3213
3253
  eventEmitterInstance: chunk7B52C2XE_js.__privateGet(this, _emitter12),
3214
3254
  inboxServiceInstance: chunk7B52C2XE_js.__privateGet(this, _inboxService6)
3215
3255
  });
@@ -1,7 +1,7 @@
1
1
  export * from 'json-logic-js';
2
- import { S as SeverityLevelEnum, N as NotificationFilter, a as Notification } from './novu-event-emitter-BFZmnC3B.js';
3
- export { B as BaseDeleteSubscriptionArgs, f as BaseUpdateSubscriptionArgs, j as ChannelPreference, k as ChannelType, l as Context, C as CreateSubscriptionArgs, m as DaySchedule, n as DefaultSchedule, D as DeleteSubscriptionArgs, E as EventHandler, b as Events, F as FiltersCountResponse, G as GetSubscriptionArgs, o as InboxNotification, I as InstanceDeleteSubscriptionArgs, g as InstanceUpdateSubscriptionArgs, p as ListNotificationsResponse, L as ListSubscriptionsArgs, q as NotificationStatus, K as NovuError, r as NovuOptions, s as Preference, P as PreferenceFilter, t as PreferenceLevel, u as PreferencesResponse, v as Schedule, c as SocketEventNames, w as StandardNovuOptions, x as Subscriber, h as SubscriptionPreference, y as TimeRange, T as TopicSubscription, z as UnreadCount, U as UpdateSubscriptionArgs, i as UpdateSubscriptionPreferenceArgs, A as WebSocketEvent, H as WeeklySchedule, J as WorkflowCriticalityEnum, W as WorkflowFilter, d as WorkflowGroupFilter, e as WorkflowIdentifierOrId } from './novu-event-emitter-BFZmnC3B.js';
4
- export { N as Novu } from './novu-D_YIntb9.js';
2
+ import { S as SeverityLevelEnum, N as NotificationFilter, a as Notification } from './novu-event-emitter-C1W5HMjG.js';
3
+ export { B as BaseDeleteSubscriptionArgs, f as BaseUpdateSubscriptionArgs, j as ChannelPreference, k as ChannelType, l as Context, C as CreateSubscriptionArgs, m as DaySchedule, n as DefaultSchedule, D as DeleteSubscriptionArgs, E as EventHandler, b as Events, F as FiltersCountResponse, G as GetSubscriptionArgs, o as InboxNotification, I as InstanceDeleteSubscriptionArgs, g as InstanceUpdateSubscriptionArgs, p as ListNotificationsResponse, L as ListSubscriptionsArgs, q as NotificationStatus, K as NovuError, r as NovuOptions, s as Preference, P as PreferenceFilter, t as PreferenceLevel, u as PreferencesResponse, v as Schedule, c as SocketEventNames, w as StandardNovuOptions, x as Subscriber, h as SubscriptionPreference, y as TimeRange, T as TopicSubscription, z as UnreadCount, U as UpdateSubscriptionArgs, i as UpdateSubscriptionPreferenceArgs, A as WebSocketEvent, H as WeeklySchedule, J as WorkflowCriticalityEnum, W as WorkflowFilter, d as WorkflowGroupFilter, e as WorkflowIdentifierOrId } from './novu-event-emitter-C1W5HMjG.js';
4
+ export { N as Novu } from './novu-XeOUGuG1.js';
5
5
 
6
6
  declare const areTagsEqual: (tags1?: string[], tags2?: string[]) => boolean;
7
7
  declare const areSeveritiesEqual: (el1?: SeverityLevelEnum | SeverityLevelEnum[], el2?: SeverityLevelEnum | SeverityLevelEnum[]) => boolean;
package/dist/cjs/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkBDYEMGVY_js = require('./chunk-BDYEMGVY.js');
3
+ var chunkF4XZNXBN_js = require('./chunk-F4XZNXBN.js');
4
4
  var chunkCCAUG7YI_js = require('./chunk-CCAUG7YI.js');
5
5
  require('./chunk-7B52C2XE.js');
6
6
 
@@ -8,35 +8,35 @@ require('./chunk-7B52C2XE.js');
8
8
 
9
9
  Object.defineProperty(exports, "Novu", {
10
10
  enumerable: true,
11
- get: function () { return chunkBDYEMGVY_js.Novu; }
11
+ get: function () { return chunkF4XZNXBN_js.Novu; }
12
12
  });
13
13
  Object.defineProperty(exports, "SubscriptionPreference", {
14
14
  enumerable: true,
15
- get: function () { return chunkBDYEMGVY_js.SubscriptionPreference; }
15
+ get: function () { return chunkF4XZNXBN_js.SubscriptionPreference; }
16
16
  });
17
17
  Object.defineProperty(exports, "TopicSubscription", {
18
18
  enumerable: true,
19
- get: function () { return chunkBDYEMGVY_js.TopicSubscription; }
19
+ get: function () { return chunkF4XZNXBN_js.TopicSubscription; }
20
20
  });
21
21
  Object.defineProperty(exports, "areSeveritiesEqual", {
22
22
  enumerable: true,
23
- get: function () { return chunkBDYEMGVY_js.areSeveritiesEqual; }
23
+ get: function () { return chunkF4XZNXBN_js.areSeveritiesEqual; }
24
24
  });
25
25
  Object.defineProperty(exports, "areTagsEqual", {
26
26
  enumerable: true,
27
- get: function () { return chunkBDYEMGVY_js.areTagsEqual; }
27
+ get: function () { return chunkF4XZNXBN_js.areTagsEqual; }
28
28
  });
29
29
  Object.defineProperty(exports, "checkNotificationDataFilter", {
30
30
  enumerable: true,
31
- get: function () { return chunkBDYEMGVY_js.checkNotificationDataFilter; }
31
+ get: function () { return chunkF4XZNXBN_js.checkNotificationDataFilter; }
32
32
  });
33
33
  Object.defineProperty(exports, "checkNotificationMatchesFilter", {
34
34
  enumerable: true,
35
- get: function () { return chunkBDYEMGVY_js.checkNotificationMatchesFilter; }
35
+ get: function () { return chunkF4XZNXBN_js.checkNotificationMatchesFilter; }
36
36
  });
37
37
  Object.defineProperty(exports, "isSameFilter", {
38
38
  enumerable: true,
39
- get: function () { return chunkBDYEMGVY_js.isSameFilter; }
39
+ get: function () { return chunkF4XZNXBN_js.isSameFilter; }
40
40
  });
41
41
  Object.defineProperty(exports, "ChannelType", {
42
42
  enumerable: true,
@@ -1,4 +1,4 @@
1
- import { l as Context, x as Subscriber, O as NovuEventEmitter, M as InboxService, o as InboxNotification, a as Notification } from '../novu-event-emitter-BFZmnC3B.js';
1
+ import { l as Context, x as Subscriber, O as NovuEventEmitter, M as InboxService, o as InboxNotification, a as Notification } from '../novu-event-emitter-C1W5HMjG.js';
2
2
  import 'json-logic-js';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { M as InboxService, O as NovuEventEmitter, Q as Session, R as Result, V as ScheduleCache, v as Schedule, X as UpdateScheduleArgs, Y as PreferencesCache, Z as ListPreferencesArgs, s as Preference, _ as BasePreferenceArgs, $ as InstancePreferenceArgs, a0 as ListNotificationsArgs, p as ListNotificationsResponse, o as InboxNotification, a as Notification, N as NotificationFilter, a1 as FilterCountArgs, a2 as FilterCountResponse, a3 as FiltersCountArgs, F as FiltersCountResponse, a4 as BaseArgs, a5 as InstanceArgs, a6 as SnoozeArgs, a7 as SubscriptionsCache, x as Subscriber, L as ListSubscriptionsArgs, a8 as Options, T as TopicSubscription, G as GetSubscriptionArgs, C as CreateSubscriptionArgs, f as BaseUpdateSubscriptionArgs, g as InstanceUpdateSubscriptionArgs, B as BaseDeleteSubscriptionArgs, I as InstanceDeleteSubscriptionArgs, c as SocketEventNames, a9 as EventNames, E as EventHandler, b as Events, aa as ContextValue, r as NovuOptions, l as Context } from './novu-event-emitter-BFZmnC3B.js';
1
+ import { M as InboxService, O as NovuEventEmitter, Q as Session, R as Result, V as ScheduleCache, v as Schedule, X as UpdateScheduleArgs, Y as PreferencesCache, Z as ListPreferencesArgs, s as Preference, _ as BasePreferenceArgs, $ as InstancePreferenceArgs, a0 as ListNotificationsArgs, p as ListNotificationsResponse, o as InboxNotification, a as Notification, N as NotificationFilter, a1 as FilterCountArgs, a2 as FilterCountResponse, a3 as FiltersCountArgs, F as FiltersCountResponse, a4 as BaseArgs, a5 as InstanceArgs, a6 as SnoozeArgs, a7 as SubscriptionsCache, x as Subscriber, L as ListSubscriptionsArgs, a8 as Options, T as TopicSubscription, G as GetSubscriptionArgs, C as CreateSubscriptionArgs, f as BaseUpdateSubscriptionArgs, g as InstanceUpdateSubscriptionArgs, B as BaseDeleteSubscriptionArgs, I as InstanceDeleteSubscriptionArgs, c as SocketEventNames, a9 as EventNames, E as EventHandler, b as Events, aa as ContextValue, r as NovuOptions, l as Context } from './novu-event-emitter-C1W5HMjG.js';
2
2
 
3
3
  declare class BaseModule {
4
4
  #private;
@@ -3,10 +3,6 @@ import { RulesLogic } from 'json-logic-js';
3
3
  type HttpClientOptions = {
4
4
  apiVersion?: string;
5
5
  apiUrl?: string;
6
- /**
7
- * @deprecated User-Agent header is not reliable in browsers. Use Novu-Client-Version instead.
8
- */
9
- userAgent?: string;
10
6
  headers?: Record<string, string>;
11
7
  };
12
8
 
@@ -252,6 +248,8 @@ type NotificationFilter = {
252
248
  seen?: boolean;
253
249
  data?: Record<string, unknown>;
254
250
  severity?: SeverityLevelEnum | SeverityLevelEnum[];
251
+ createdGte?: number;
252
+ createdLte?: number;
255
253
  };
256
254
  type ChannelPreference = {
257
255
  email?: boolean;
@@ -332,13 +330,17 @@ type KeylessNovuOptions = {} & {
332
330
  type StandardNovuOptions = {
333
331
  /** @deprecated Use apiUrl instead */
334
332
  backendUrl?: string;
335
- /** @internal Should be used internally for testing purposes */
336
- __userAgent?: string;
337
333
  applicationIdentifier: string;
338
334
  subscriberHash?: string;
339
335
  contextHash?: string;
340
336
  apiUrl?: string;
341
337
  socketUrl?: string;
338
+ /**
339
+ * Custom socket configuration options. These options will be merged with the default socket configuration.
340
+ * For socket.io-client connections, supports all socket.io-client options (e.g., `path`, `reconnectionDelay`, `timeout`, etc.).
341
+ * For PartySocket connections, options are applied to the WebSocket instance.
342
+ */
343
+ socketOptions?: Record<string, unknown>;
342
344
  useCache?: boolean;
343
345
  defaultSchedule?: DefaultSchedule;
344
346
  context?: Context;
@@ -461,7 +463,7 @@ declare class InboxService {
461
463
  defaultSchedule?: DefaultSchedule;
462
464
  context?: Context;
463
465
  }): Promise<Session>;
464
- fetchNotifications({ after, archived, limit, offset, read, tags, snoozed, seen, data, severity, }: {
466
+ fetchNotifications({ after, archived, limit, offset, read, tags, snoozed, seen, data, severity, createdGte, createdLte, }: {
465
467
  tags?: string[];
466
468
  read?: boolean;
467
469
  archived?: boolean;
@@ -472,6 +474,8 @@ declare class InboxService {
472
474
  offset?: number;
473
475
  data?: Record<string, unknown>;
474
476
  severity?: SeverityLevelEnum | SeverityLevelEnum[];
477
+ createdGte?: number;
478
+ createdLte?: number;
475
479
  }): Promise<{
476
480
  data: InboxNotification[];
477
481
  hasMore: boolean;
@@ -652,6 +656,8 @@ type ListNotificationsArgs = {
652
656
  after?: string;
653
657
  offset?: number;
654
658
  useCache?: boolean;
659
+ createdGte?: number;
660
+ createdLte?: number;
655
661
  };
656
662
  type ListNotificationsResponse = {
657
663
  notifications: Notification[];
@@ -666,6 +672,8 @@ type FilterCountArgs = {
666
672
  snoozed?: boolean;
667
673
  seen?: boolean;
668
674
  severity?: SeverityLevelEnum | SeverityLevelEnum[];
675
+ createdGte?: number;
676
+ createdLte?: number;
669
677
  };
670
678
  type FiltersCountArgs = {
671
679
  filters: Array<{
@@ -676,6 +684,8 @@ type FiltersCountArgs = {
676
684
  seen?: boolean;
677
685
  data?: Record<string, unknown>;
678
686
  severity?: SeverityLevelEnum | SeverityLevelEnum[];
687
+ createdGte?: number;
688
+ createdLte?: number;
679
689
  }>;
680
690
  };
681
691
  type CountArgs = undefined | FilterCountArgs | FiltersCountArgs;
@@ -1,7 +1,7 @@
1
- import { G as InboxTheme, Y as SubscriptionTheme } from '../types-BxUhsMdy.js';
2
- import '../novu-event-emitter-BFZmnC3B.js';
1
+ import { G as InboxTheme, Y as SubscriptionTheme } from '../types-C8sN2lgH.js';
2
+ import '../novu-event-emitter-C1W5HMjG.js';
3
3
  import 'json-logic-js';
4
- import '../novu-D_YIntb9.js';
4
+ import '../novu-XeOUGuG1.js';
5
5
 
6
6
  declare const inboxDarkTheme: InboxTheme;
7
7
  /**
@@ -1,5 +1,5 @@
1
- import { a as Notification, z as UnreadCount, N as NotificationFilter, s as Preference, v as Schedule, T as TopicSubscription, h as SubscriptionPreference, J as WorkflowCriticalityEnum, r as NovuOptions } from './novu-event-emitter-BFZmnC3B.js';
2
- import { N as Novu } from './novu-D_YIntb9.js';
1
+ import { a as Notification, z as UnreadCount, N as NotificationFilter, s as Preference, v as Schedule, T as TopicSubscription, h as SubscriptionPreference, J as WorkflowCriticalityEnum, r as NovuOptions } from './novu-event-emitter-C1W5HMjG.js';
2
+ import { N as Novu } from './novu-XeOUGuG1.js';
3
3
 
4
4
  declare const commonAppearanceKeys: readonly ["root", "button", "input", "icon", "badge", "popoverContent", "popoverTrigger", "popoverClose", "collapsible", "tooltipContent", "tooltipTrigger"];
5
5
  declare const inboxAppearanceKeys: readonly ["bellIcon", "lockIcon", "bellContainer", "severityHigh__bellContainer", "severityMedium__bellContainer", "severityLow__bellContainer", "bellSeverityGlow", "severityGlowHigh__bellSeverityGlow", "severityGlowMedium__bellSeverityGlow", "severityGlowLow__bellSeverityGlow", "bellDot", "preferences__button", "preferencesContainer", "inboxHeader", "loading", "dropdownContent", "dropdownTrigger", "dropdownItem", "dropdownItemLabel", "dropdownItemLabelContainer", "dropdownItemLeft__icon", "dropdownItemRight__icon", "dropdownItem__icon", "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", "inboxContent", "inbox__popoverTrigger", "inbox__popoverContent", "notificationListContainer", "notificationList", "notificationListEmptyNoticeContainer", "notificationListEmptyNoticeOverlay", "notificationListEmptyNoticeIcon", "notificationListEmptyNotice", "notificationList__skeleton", "notificationList__skeletonContent", "notificationList__skeletonItem", "notificationList__skeletonAvatar", "notificationList__skeletonText", "notificationListNewNotificationsNotice__button", "notification", "severityHigh__notification", "severityMedium__notification", "severityLow__notification", "notificationBar", "severityHigh__notificationBar", "severityMedium__notificationBar", "severityLow__notificationBar", "notificationContent", "notificationTextContainer", "notificationDot", "notificationSubject", "notificationSubject__strong", "notificationSubject__em", "notificationBody", "notificationBody__strong", "notificationBody__em", "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", "scheduleContainer", "scheduleHeader", "scheduleLabelContainer", "scheduleLabelScheduleIcon", "scheduleLabelInfoIcon", "scheduleLabel", "scheduleActionsContainer", "scheduleActionsContainerRight", "scheduleBody", "scheduleDescription", "scheduleTable", "scheduleTableHeader", "scheduleHeaderColumn", "scheduleTableBody", "scheduleBodyRow", "scheduleBodyColumn", "scheduleInfoContainer", "scheduleInfoIcon", "scheduleInfo", "dayScheduleCopyTitle", "dayScheduleCopyIcon", "dayScheduleCopySelectAll", "dayScheduleCopyDay", "dayScheduleCopyFooterContainer", "dayScheduleCopy__dropdownTrigger", "dayScheduleCopy__dropdownContent", "timeSelect__dropdownTrigger", "timeSelect__time", "timeSelect__dropdownContent", "timeSelect__dropdownItem", "timeSelect__dropdownItemLabel", "timeSelect__dropdownItemLabelContainer", "timeSelect__dropdownItemCheck__icon", "notificationSnooze__dropdownContent", "notificationSnooze__dropdownItem", "notificationSnooze__dropdownItem__icon", "notificationSnoozeCustomTime_popoverContent", "notificationDeliveredAt__badge", "notificationDeliveredAt__icon", "notificationSnoozedUntil__icon", "strong", "em"];
@@ -1,12 +1,12 @@
1
- import { T as TopicSubscription, e as WorkflowIdentifierOrId, r as NovuOptions } from '../novu-event-emitter-BFZmnC3B.js';
2
- export { a as Notification } from '../novu-event-emitter-BFZmnC3B.js';
3
- import { B as BellRenderer, N as NotificationClickHandler, a as NotificationActionClickHandler, b as NotificationRenderer, A as AvatarRenderer, S as SubjectRenderer, c as BodyRenderer, D as DefaultActionsRenderer, C as CustomActionsRenderer, d as NovuProviderProps, e as BaseNovuProviderProps, f as AllAppearance, g as AllLocalization, T as Tab, P as PreferencesFilter, h as PreferenceGroups, i as PreferencesSort, R as RouterPush } from '../types-BxUhsMdy.js';
4
- export { j as AllAppearanceCallbackFunction, k as AllAppearanceCallbackKeys, l as AllAppearanceKey, m as AllElements, n as AllIconKey, o as AllIconOverrides, p as AllLocalizationKey, q as AllTheme, E as ElementStyles, I as IconRenderer, r as InboxAppearance, s as InboxAppearanceCallback, t as InboxAppearanceCallbackFunction, u as InboxAppearanceCallbackKeys, v as InboxAppearanceKey, w as InboxElements, x as InboxIconKey, y as InboxIconOverrides, z as InboxLocalization, F as InboxLocalizationKey, G as InboxTheme, H as NotificationStatus, J as SubscriptionAppearance, K as SubscriptionAppearanceCallback, L as SubscriptionAppearanceCallbackFunction, M as SubscriptionAppearanceCallbackKeys, O as SubscriptionAppearanceKey, Q as SubscriptionElements, U as SubscriptionIconKey, V as SubscriptionIconOverrides, W as SubscriptionLocalization, X as SubscriptionLocalizationKey, Y as SubscriptionTheme, Z as Variables } from '../types-BxUhsMdy.js';
1
+ import { T as TopicSubscription, e as WorkflowIdentifierOrId, r as NovuOptions } from '../novu-event-emitter-C1W5HMjG.js';
2
+ export { a as Notification } from '../novu-event-emitter-C1W5HMjG.js';
3
+ import { B as BellRenderer, N as NotificationClickHandler, a as NotificationActionClickHandler, b as NotificationRenderer, A as AvatarRenderer, S as SubjectRenderer, c as BodyRenderer, D as DefaultActionsRenderer, C as CustomActionsRenderer, d as NovuProviderProps, e as BaseNovuProviderProps, f as AllAppearance, g as AllLocalization, T as Tab, P as PreferencesFilter, h as PreferenceGroups, i as PreferencesSort, R as RouterPush } from '../types-C8sN2lgH.js';
4
+ export { j as AllAppearanceCallbackFunction, k as AllAppearanceCallbackKeys, l as AllAppearanceKey, m as AllElements, n as AllIconKey, o as AllIconOverrides, p as AllLocalizationKey, q as AllTheme, E as ElementStyles, I as IconRenderer, r as InboxAppearance, s as InboxAppearanceCallback, t as InboxAppearanceCallbackFunction, u as InboxAppearanceCallbackKeys, v as InboxAppearanceKey, w as InboxElements, x as InboxIconKey, y as InboxIconOverrides, z as InboxLocalization, F as InboxLocalizationKey, G as InboxTheme, H as NotificationStatus, J as SubscriptionAppearance, K as SubscriptionAppearanceCallback, L as SubscriptionAppearanceCallbackFunction, M as SubscriptionAppearanceCallbackKeys, O as SubscriptionAppearanceKey, Q as SubscriptionElements, U as SubscriptionIconKey, V as SubscriptionIconOverrides, W as SubscriptionLocalization, X as SubscriptionLocalizationKey, Y as SubscriptionTheme, Z as Variables } from '../types-C8sN2lgH.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';
8
8
  import { MountableElement } from 'solid-js/web';
9
- import { N as Novu } from '../novu-D_YIntb9.js';
9
+ import { N as Novu } from '../novu-XeOUGuG1.js';
10
10
  import 'json-logic-js';
11
11
 
12
12
  type NotificationRendererProps = {