@novu/js 3.10.1 → 3.11.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
@@ -26,4 +26,58 @@ const novu = new Novu({
26
26
  const { data: notifications, error } = await novu.notifications.list();
27
27
  ```
28
28
 
29
- | Info: you can find the `applicationIdentifier` in the Novu dashboard under the API keys page.
29
+ || Info: you can find the `applicationIdentifier` in the Novu dashboard under the API keys page.
30
+
31
+ ## HMAC Encryption
32
+
33
+ When HMAC encryption is enabled in your Novu environment, you need to provide both `subscriberHash` and optionally `contextHash` to secure your requests.
34
+
35
+ ### Subscriber HMAC
36
+
37
+ Generate a subscriber hash on your backend:
38
+
39
+ ```ts
40
+ import { createHmac } from 'crypto';
41
+
42
+ const subscriberHash = createHmac('sha256', process.env.NOVU_API_KEY)
43
+ .update(subscriberId)
44
+ .digest('hex');
45
+ ```
46
+
47
+ Pass it to the Novu instance:
48
+
49
+ ```ts
50
+ const novu = new Novu({
51
+ applicationIdentifier: 'YOUR_NOVU_APPLICATION_IDENTIFIER',
52
+ subscriber: 'SUBSCRIBER_ID',
53
+ subscriberHash: 'SUBSCRIBER_HASH_VALUE',
54
+ });
55
+ ```
56
+
57
+ ### Context HMAC (Optional)
58
+
59
+ If you're using the `context` option to pass additional data, generate a context hash on your backend:
60
+
61
+ ```ts
62
+ import { createHmac } from 'crypto';
63
+ import { canonicalize } from '@tufjs/canonical-json';
64
+
65
+ const context = { tenant: 'acme', app: 'dashboard' };
66
+ const contextHash = createHmac('sha256', process.env.NOVU_API_KEY)
67
+ .update(canonicalize(context))
68
+ .digest('hex');
69
+ ```
70
+
71
+ Pass both context and contextHash to the Novu instance:
72
+
73
+ ```ts
74
+ const novu = new Novu({
75
+ applicationIdentifier: 'YOUR_NOVU_APPLICATION_IDENTIFIER',
76
+ subscriber: 'SUBSCRIBER_ID',
77
+ subscriberHash: 'SUBSCRIBER_HASH_VALUE',
78
+ context: { tenant: 'acme', app: 'dashboard' },
79
+ contextHash: 'CONTEXT_HASH_VALUE',
80
+ });
81
+ ```
82
+
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}`.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkZB7IPCHY_js = require('./chunk-ZB7IPCHY.js');
3
+ var chunkVWSQDNZX_js = require('./chunk-VWSQDNZX.js');
4
4
  var chunk7B52C2XE_js = require('./chunk-7B52C2XE.js');
5
5
  var mitt = require('mitt');
6
6
  require('event-target-polyfill');
@@ -148,7 +148,7 @@ function checkNotificationMatchesFilter(notification, filter) {
148
148
 
149
149
  // src/api/http-client.ts
150
150
  var DEFAULT_API_VERSION = "v1";
151
- var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.10.1"}`;
151
+ var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.11.0"}`;
152
152
  var HttpClient = class {
153
153
  constructor(options = {}) {
154
154
  // Environment variable for local development that overrides the default API endpoint without affecting the Inbox DX
@@ -276,14 +276,18 @@ var InboxService = class {
276
276
  return chunk7B52C2XE_js.__async(this, arguments, function* ({
277
277
  applicationIdentifier,
278
278
  subscriberHash,
279
+ contextHash,
279
280
  subscriber,
280
- defaultSchedule
281
+ defaultSchedule,
282
+ context
281
283
  }) {
282
284
  const response = yield chunk7B52C2XE_js.__privateGet(this, _httpClient).post(`${INBOX_ROUTE}/session`, {
283
285
  applicationIdentifier,
284
286
  subscriberHash,
287
+ contextHash,
285
288
  subscriber,
286
- defaultSchedule
289
+ defaultSchedule,
290
+ context
287
291
  });
288
292
  chunk7B52C2XE_js.__privateGet(this, _httpClient).setAuthorizationToken(response.token);
289
293
  chunk7B52C2XE_js.__privateGet(this, _httpClient).setKeylessHeader(response.applicationIdentifier);
@@ -2498,6 +2502,18 @@ var Session = class {
2498
2502
  var _a;
2499
2503
  return (_a = chunk7B52C2XE_js.__privateGet(this, _options).subscriber) == null ? void 0 : _a.subscriberId;
2500
2504
  }
2505
+ get context() {
2506
+ return chunk7B52C2XE_js.__privateGet(this, _options).context;
2507
+ }
2508
+ get subscriberHash() {
2509
+ return chunk7B52C2XE_js.__privateGet(this, _options).subscriberHash;
2510
+ }
2511
+ get contextHash() {
2512
+ return chunk7B52C2XE_js.__privateGet(this, _options).contextHash;
2513
+ }
2514
+ get subscriber() {
2515
+ return chunk7B52C2XE_js.__privateGet(this, _options).subscriber;
2516
+ }
2501
2517
  handleApplicationIdentifier(method, identifier) {
2502
2518
  if (typeof window === "undefined" || !window.localStorage) {
2503
2519
  return null;
@@ -2524,14 +2540,16 @@ var Session = class {
2524
2540
  initialize(options) {
2525
2541
  return chunk7B52C2XE_js.__async(this, null, function* () {
2526
2542
  var _a, _b, _c, _d, _e, _f;
2527
- if (((_a = chunk7B52C2XE_js.__privateGet(this, _options).subscriber) == null ? void 0 : _a.subscriberId) === ((_b = options == null ? void 0 : options.subscriber) == null ? void 0 : _b.subscriberId)) {
2543
+ const subscriberUnchanged = ((_a = chunk7B52C2XE_js.__privateGet(this, _options).subscriber) == null ? void 0 : _a.subscriberId) === ((_b = options == null ? void 0 : options.subscriber) == null ? void 0 : _b.subscriberId);
2544
+ const contextUnchanged = JSON.stringify(chunk7B52C2XE_js.__privateGet(this, _options).context) === JSON.stringify(options == null ? void 0 : options.context);
2545
+ if (subscriberUnchanged && contextUnchanged) {
2528
2546
  return;
2529
2547
  }
2530
2548
  try {
2531
2549
  if (options) {
2532
2550
  chunk7B52C2XE_js.__privateSet(this, _options, options);
2533
2551
  }
2534
- const { subscriber, subscriberHash, applicationIdentifier, defaultSchedule } = chunk7B52C2XE_js.__privateGet(this, _options);
2552
+ const { subscriber, subscriberHash, contextHash, applicationIdentifier, defaultSchedule, context } = chunk7B52C2XE_js.__privateGet(this, _options);
2535
2553
  let currentTimezone;
2536
2554
  if (isBrowser()) {
2537
2555
  currentTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
@@ -2549,11 +2567,13 @@ var Session = class {
2549
2567
  const response = yield chunk7B52C2XE_js.__privateGet(this, _inboxService2).initializeSession({
2550
2568
  applicationIdentifier: finalApplicationIdentifier,
2551
2569
  subscriberHash,
2570
+ contextHash,
2552
2571
  subscriber: chunk7B52C2XE_js.__spreadProps(chunk7B52C2XE_js.__spreadValues({}, subscriber), {
2553
2572
  subscriberId: (_c = subscriber == null ? void 0 : subscriber.subscriberId) != null ? _c : "",
2554
2573
  timezone: (_d = subscriber == null ? void 0 : subscriber.timezone) != null ? _d : currentTimezone
2555
2574
  }),
2556
- defaultSchedule
2575
+ defaultSchedule,
2576
+ context
2557
2577
  });
2558
2578
  if ((_e = response == null ? void 0 : response.applicationIdentifier) == null ? void 0 : _e.startsWith("pk_keyless_")) {
2559
2579
  this.handleApplicationIdentifier("store", response.applicationIdentifier);
@@ -3071,8 +3091,10 @@ var Novu = class {
3071
3091
  {
3072
3092
  applicationIdentifier: options.applicationIdentifier || "",
3073
3093
  subscriberHash: options.subscriberHash,
3074
- subscriber: chunkZB7IPCHY_js.buildSubscriber({ subscriberId: options.subscriberId, subscriber: options.subscriber }),
3075
- defaultSchedule: options.defaultSchedule
3094
+ subscriber: chunkVWSQDNZX_js.buildSubscriber({ subscriberId: options.subscriberId, subscriber: options.subscriber }),
3095
+ defaultSchedule: options.defaultSchedule,
3096
+ context: options.context,
3097
+ contextHash: options.contextHash
3076
3098
  },
3077
3099
  chunk7B52C2XE_js.__privateGet(this, _inboxService3),
3078
3100
  chunk7B52C2XE_js.__privateGet(this, _emitter10)
@@ -3112,13 +3134,48 @@ var Novu = class {
3112
3134
  get subscriberId() {
3113
3135
  return chunk7B52C2XE_js.__privateGet(this, _session).subscriberId;
3114
3136
  }
3137
+ get context() {
3138
+ return chunk7B52C2XE_js.__privateGet(this, _session).context;
3139
+ }
3140
+ get contextKey() {
3141
+ return chunkVWSQDNZX_js.buildContextKey(chunk7B52C2XE_js.__privateGet(this, _session).context);
3142
+ }
3115
3143
  changeSubscriber(options) {
3116
3144
  return chunk7B52C2XE_js.__async(this, null, function* () {
3117
3145
  yield chunk7B52C2XE_js.__privateGet(this, _session).initialize({
3118
3146
  applicationIdentifier: chunk7B52C2XE_js.__privateGet(this, _session).applicationIdentifier || "",
3119
3147
  subscriberHash: options.subscriberHash,
3120
- subscriber: options.subscriber
3148
+ subscriber: options.subscriber,
3149
+ // Preserve existing context and contextHash
3150
+ context: chunk7B52C2XE_js.__privateGet(this, _session).context,
3151
+ contextHash: chunk7B52C2XE_js.__privateGet(this, _session).contextHash
3121
3152
  });
3153
+ this.notifications.cache.clearAll();
3154
+ const disconnectResult = yield this.socket.disconnect();
3155
+ if (!disconnectResult.error) {
3156
+ yield this.socket.connect();
3157
+ }
3158
+ });
3159
+ }
3160
+ changeContext(options) {
3161
+ return chunk7B52C2XE_js.__async(this, null, function* () {
3162
+ const currentSubscriber = chunk7B52C2XE_js.__privateGet(this, _session).subscriber;
3163
+ if (!currentSubscriber) {
3164
+ throw new Error("Cannot change context without an active subscriber");
3165
+ }
3166
+ yield chunk7B52C2XE_js.__privateGet(this, _session).initialize({
3167
+ applicationIdentifier: chunk7B52C2XE_js.__privateGet(this, _session).applicationIdentifier || "",
3168
+ // Preserve existing subscriber and subscriberHash
3169
+ subscriberHash: chunk7B52C2XE_js.__privateGet(this, _session).subscriberHash,
3170
+ subscriber: currentSubscriber,
3171
+ context: options.context,
3172
+ contextHash: options.contextHash
3173
+ });
3174
+ this.notifications.cache.clearAll();
3175
+ const disconnectResult = yield this.socket.disconnect();
3176
+ if (!disconnectResult.error) {
3177
+ yield this.socket.connect();
3178
+ }
3122
3179
  });
3123
3180
  }
3124
3181
  };
@@ -1,5 +1,20 @@
1
1
  'use strict';
2
2
 
3
+ // src/ui/internal/buildContextKey.ts
4
+ function buildContextKey(context) {
5
+ if (!context) {
6
+ return "";
7
+ }
8
+ const keys = [];
9
+ for (const [type, value] of Object.entries(context)) {
10
+ if (value) {
11
+ const id = typeof value === "string" ? value : value.id;
12
+ keys.push(`${type}:${id}`);
13
+ }
14
+ }
15
+ return keys.sort().join(",");
16
+ }
17
+
3
18
  // src/ui/internal/buildSubscriber.ts
4
19
  function buildSubscriber({
5
20
  subscriberId,
@@ -46,5 +61,6 @@ var parseMarkdownIntoTokens = (text) => {
46
61
  return tokens;
47
62
  };
48
63
 
64
+ exports.buildContextKey = buildContextKey;
49
65
  exports.buildSubscriber = buildSubscriber;
50
66
  exports.parseMarkdownIntoTokens = parseMarkdownIntoTokens;
@@ -1,7 +1,7 @@
1
- import { N as Notification } from './novu--9_BeIj6.js';
2
- export { E as EventHandler, a as Events, F as FiltersCountResponse, L as ListNotificationsResponse, b as Novu, P as Preference, c as Schedule, S as SocketEventNames } from './novu--9_BeIj6.js';
3
- import { S as SeverityLevelEnum, N as NotificationFilter } from './types-DKMAoSfo.js';
4
- export { C as ChannelPreference, a as ChannelType, D as DaySchedule, b as DefaultSchedule, I as InboxNotification, c as NotificationStatus, d as NovuError, e as NovuOptions, P as PreferenceLevel, f as PreferencesResponse, g as StandardNovuOptions, h as Subscriber, T as TimeRange, U as UnreadCount, W as WebSocketEvent, i as WeeklySchedule, j as WorkflowCriticalityEnum } from './types-DKMAoSfo.js';
1
+ import { N as Notification } from './novu-ThMWeiRt.js';
2
+ export { E as EventHandler, a as Events, F as FiltersCountResponse, L as ListNotificationsResponse, b as Novu, P as Preference, c as Schedule, S as SocketEventNames } from './novu-ThMWeiRt.js';
3
+ import { S as SeverityLevelEnum, N as NotificationFilter } from './types-BM_9Xx5Z.js';
4
+ export { C as ChannelPreference, a as ChannelType, b as Context, D as DaySchedule, c as DefaultSchedule, I as InboxNotification, d as NotificationStatus, e as NovuError, f as NovuOptions, P as PreferenceLevel, g as PreferencesResponse, h as StandardNovuOptions, i as Subscriber, T as TimeRange, U as UnreadCount, W as WebSocketEvent, j as WeeklySchedule, k as WorkflowCriticalityEnum } from './types-BM_9Xx5Z.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,56 +1,56 @@
1
1
  'use strict';
2
2
 
3
- var chunkU6OU7N23_js = require('./chunk-U6OU7N23.js');
4
- require('./chunk-ZB7IPCHY.js');
3
+ var chunkQQNKEWGC_js = require('./chunk-QQNKEWGC.js');
4
+ require('./chunk-VWSQDNZX.js');
5
5
  require('./chunk-7B52C2XE.js');
6
6
 
7
7
 
8
8
 
9
9
  Object.defineProperty(exports, "ChannelType", {
10
10
  enumerable: true,
11
- get: function () { return chunkU6OU7N23_js.ChannelType; }
11
+ get: function () { return chunkQQNKEWGC_js.ChannelType; }
12
12
  });
13
13
  Object.defineProperty(exports, "NotificationStatus", {
14
14
  enumerable: true,
15
- get: function () { return chunkU6OU7N23_js.NotificationStatus; }
15
+ get: function () { return chunkQQNKEWGC_js.NotificationStatus; }
16
16
  });
17
17
  Object.defineProperty(exports, "Novu", {
18
18
  enumerable: true,
19
- get: function () { return chunkU6OU7N23_js.Novu; }
19
+ get: function () { return chunkQQNKEWGC_js.Novu; }
20
20
  });
21
21
  Object.defineProperty(exports, "PreferenceLevel", {
22
22
  enumerable: true,
23
- get: function () { return chunkU6OU7N23_js.PreferenceLevel; }
23
+ get: function () { return chunkQQNKEWGC_js.PreferenceLevel; }
24
24
  });
25
25
  Object.defineProperty(exports, "SeverityLevelEnum", {
26
26
  enumerable: true,
27
- get: function () { return chunkU6OU7N23_js.SeverityLevelEnum; }
27
+ get: function () { return chunkQQNKEWGC_js.SeverityLevelEnum; }
28
28
  });
29
29
  Object.defineProperty(exports, "WebSocketEvent", {
30
30
  enumerable: true,
31
- get: function () { return chunkU6OU7N23_js.WebSocketEvent; }
31
+ get: function () { return chunkQQNKEWGC_js.WebSocketEvent; }
32
32
  });
33
33
  Object.defineProperty(exports, "WorkflowCriticalityEnum", {
34
34
  enumerable: true,
35
- get: function () { return chunkU6OU7N23_js.WorkflowCriticalityEnum; }
35
+ get: function () { return chunkQQNKEWGC_js.WorkflowCriticalityEnum; }
36
36
  });
37
37
  Object.defineProperty(exports, "areSeveritiesEqual", {
38
38
  enumerable: true,
39
- get: function () { return chunkU6OU7N23_js.areSeveritiesEqual; }
39
+ get: function () { return chunkQQNKEWGC_js.areSeveritiesEqual; }
40
40
  });
41
41
  Object.defineProperty(exports, "areTagsEqual", {
42
42
  enumerable: true,
43
- get: function () { return chunkU6OU7N23_js.areTagsEqual; }
43
+ get: function () { return chunkQQNKEWGC_js.areTagsEqual; }
44
44
  });
45
45
  Object.defineProperty(exports, "checkNotificationDataFilter", {
46
46
  enumerable: true,
47
- get: function () { return chunkU6OU7N23_js.checkNotificationDataFilter; }
47
+ get: function () { return chunkQQNKEWGC_js.checkNotificationDataFilter; }
48
48
  });
49
49
  Object.defineProperty(exports, "checkNotificationMatchesFilter", {
50
50
  enumerable: true,
51
- get: function () { return chunkU6OU7N23_js.checkNotificationMatchesFilter; }
51
+ get: function () { return chunkQQNKEWGC_js.checkNotificationMatchesFilter; }
52
52
  });
53
53
  Object.defineProperty(exports, "isSameFilter", {
54
54
  enumerable: true,
55
- get: function () { return chunkU6OU7N23_js.isSameFilter; }
55
+ get: function () { return chunkQQNKEWGC_js.isSameFilter; }
56
56
  });
@@ -1,4 +1,18 @@
1
- import { h as Subscriber } from '../types-DKMAoSfo.js';
1
+ import { b as Context, i as Subscriber } from '../types-BM_9Xx5Z.js';
2
+
3
+ /**
4
+ * Builds a compact, stable string key from context objects by extracting only type:id pairs.
5
+ *
6
+ * This avoids including large `data` payloads in:
7
+ * - React dependency arrays (useMemo)
8
+ * - Web Locks API channel names (prevents duplicate subscriptions)
9
+ *
10
+ * @example
11
+ * buildContextKey({ tenant: { id: "inbox-1", data: {...} } }) // "tenant:inbox-1"
12
+ * buildContextKey({ tenant: "inbox-1" }) // "tenant:inbox-1"
13
+ * buildContextKey(undefined) // ""
14
+ */
15
+ declare function buildContextKey(context: Context | undefined): string;
2
16
 
3
17
  declare function buildSubscriber({ subscriberId, subscriber, }: {
4
18
  subscriberId: string | undefined;
@@ -11,4 +25,4 @@ interface Token {
11
25
  }
12
26
  declare const parseMarkdownIntoTokens: (text: string) => Token[];
13
27
 
14
- export { type Token, buildSubscriber, parseMarkdownIntoTokens };
28
+ export { type Token, buildContextKey, buildSubscriber, parseMarkdownIntoTokens };
@@ -1,15 +1,19 @@
1
1
  'use strict';
2
2
 
3
- var chunkZB7IPCHY_js = require('../chunk-ZB7IPCHY.js');
3
+ var chunkVWSQDNZX_js = require('../chunk-VWSQDNZX.js');
4
4
  require('../chunk-7B52C2XE.js');
5
5
 
6
6
 
7
7
 
8
+ Object.defineProperty(exports, "buildContextKey", {
9
+ enumerable: true,
10
+ get: function () { return chunkVWSQDNZX_js.buildContextKey; }
11
+ });
8
12
  Object.defineProperty(exports, "buildSubscriber", {
9
13
  enumerable: true,
10
- get: function () { return chunkZB7IPCHY_js.buildSubscriber; }
14
+ get: function () { return chunkVWSQDNZX_js.buildSubscriber; }
11
15
  });
12
16
  Object.defineProperty(exports, "parseMarkdownIntoTokens", {
13
17
  enumerable: true,
14
- get: function () { return chunkZB7IPCHY_js.parseMarkdownIntoTokens; }
18
+ get: function () { return chunkVWSQDNZX_js.parseMarkdownIntoTokens; }
15
19
  });
@@ -1,4 +1,4 @@
1
- import { i as WeeklySchedule, S as SeverityLevelEnum, j as WorkflowCriticalityEnum, C as ChannelPreference, k as Session, R as Result, P as PreferenceLevel, l as Workflow, m as Prettify, h as Subscriber, b as DefaultSchedule, I as InboxNotification, N as NotificationFilter, A as ActionTypeEnum, f as PreferencesResponse, W as WebSocketEvent, e as NovuOptions } from './types-DKMAoSfo.mjs';
1
+ import { j as WeeklySchedule, S as SeverityLevelEnum, k as WorkflowCriticalityEnum, C as ChannelPreference, l as Session, R as Result, P as PreferenceLevel, m as Workflow, n as Prettify, i as Subscriber, c as DefaultSchedule, b as Context, I as InboxNotification, N as NotificationFilter, A as ActionTypeEnum, g as PreferencesResponse, W as WebSocketEvent, o as ContextValue, f as NovuOptions } from './types-BM_9Xx5Z.js';
2
2
 
3
3
  type HttpClientOptions = {
4
4
  apiVersion?: string;
@@ -139,11 +139,13 @@ declare class InboxService {
139
139
  #private;
140
140
  isSessionInitialized: boolean;
141
141
  constructor(options?: InboxServiceOptions);
142
- initializeSession({ applicationIdentifier, subscriberHash, subscriber, defaultSchedule, }: {
142
+ initializeSession({ applicationIdentifier, subscriberHash, contextHash, subscriber, defaultSchedule, context, }: {
143
143
  applicationIdentifier?: string;
144
144
  subscriberHash?: string;
145
+ contextHash?: string;
145
146
  subscriber?: Subscriber;
146
147
  defaultSchedule?: DefaultSchedule;
148
+ context?: Context;
147
149
  }): Promise<Session>;
148
150
  fetchNotifications({ after, archived, limit, offset, read, tags, snoozed, seen, data, severity, }: {
149
151
  tags?: string[];
@@ -444,7 +446,9 @@ type InitializeSessionArgs = KeylessInitializeSessionArgs | {
444
446
  applicationIdentifier: string;
445
447
  subscriber: Subscriber;
446
448
  subscriberHash?: string;
449
+ contextHash?: string;
447
450
  defaultSchedule?: DefaultSchedule;
451
+ context?: Context;
448
452
  };
449
453
 
450
454
  type NovuPendingEvent<A, D = undefined> = {
@@ -468,7 +472,7 @@ type NotificationUnreadEvents = BaseEvents<'notification.unread', UnreadArgs, No
468
472
  type NotificationSeenEvents = BaseEvents<'notification.seen', SeenArgs, Notification>;
469
473
  type NotificationArchiveEvents = BaseEvents<'notification.archive', ArchivedArgs, Notification>;
470
474
  type NotificationUnarchiveEvents = BaseEvents<'notification.unarchive', UnarchivedArgs, Notification>;
471
- type NotificationDeleteEvents = BaseEvents<'notification.delete', DeletedArgs, void>;
475
+ type NotificationDeleteEvents = BaseEvents<'notification.delete', DeletedArgs, Notification>;
472
476
  type NotificationSnoozeEvents = BaseEvents<'notification.snooze', SnoozeArgs, Notification>;
473
477
  type NotificationUnsnoozeEvents = BaseEvents<'notification.unsnooze', UnsnoozeArgs, Notification>;
474
478
  type NotificationCompleteActionEvents = BaseEvents<'notification.complete_action', CompleteArgs, Notification>;
@@ -578,11 +582,17 @@ declare class Novu implements Pick<NovuEventEmitter, 'on'> {
578
582
  off: <Key extends EventNames>(eventName: Key, listener: EventHandler<Events[Key]>) => void;
579
583
  get applicationIdentifier(): string | undefined;
580
584
  get subscriberId(): string | undefined;
585
+ get context(): Partial<Record<string, ContextValue>> | undefined;
586
+ get contextKey(): string;
581
587
  constructor(options: NovuOptions);
582
588
  changeSubscriber(options: {
583
589
  subscriber: Subscriber;
584
590
  subscriberHash?: string;
585
591
  }): Promise<void>;
592
+ changeContext(options: {
593
+ context: Context;
594
+ contextHash?: string;
595
+ }): Promise<void>;
586
596
  }
587
597
 
588
598
  export { type EventHandler as E, type FiltersCountResponse as F, type ListNotificationsResponse as L, Notification as N, Preference as P, type SocketEventNames as S, type Events as a, Novu as b, Schedule as c };
@@ -1,6 +1,6 @@
1
- import { r as Theme } from '../types-CvebLpsG.js';
2
- import '../types-DKMAoSfo.js';
3
- import '../novu--9_BeIj6.js';
1
+ import { r as Theme } from '../types-BjANCN3c.js';
2
+ import '../types-BM_9Xx5Z.js';
3
+ import '../novu-ThMWeiRt.js';
4
4
 
5
5
  declare const dark: Theme;
6
6
 
@@ -61,6 +61,7 @@ type Session = {
61
61
  isDevelopmentMode: boolean;
62
62
  maxSnoozeDurationHours: number;
63
63
  applicationIdentifier?: string;
64
+ contextKeys?: string[];
64
65
  };
65
66
  type Subscriber = {
66
67
  id?: string;
@@ -158,6 +159,11 @@ type DefaultSchedule = {
158
159
  isEnabled?: boolean;
159
160
  weeklySchedule?: WeeklySchedule;
160
161
  };
162
+ type ContextValue = string | {
163
+ id: string;
164
+ data?: Record<string, unknown>;
165
+ };
166
+ type Context = Partial<Record<string, ContextValue>>;
161
167
  type PreferencesResponse = {
162
168
  level: PreferenceLevel;
163
169
  enabled: boolean;
@@ -192,10 +198,12 @@ type StandardNovuOptions = {
192
198
  __userAgent?: string;
193
199
  applicationIdentifier: string;
194
200
  subscriberHash?: string;
201
+ contextHash?: string;
195
202
  apiUrl?: string;
196
203
  socketUrl?: string;
197
204
  useCache?: boolean;
198
205
  defaultSchedule?: DefaultSchedule;
206
+ context?: Context;
199
207
  } & ({
200
208
  /** @deprecated Use subscriber prop instead */
201
209
  subscriberId: string;
@@ -209,4 +217,4 @@ type Prettify<T> = {
209
217
  [K in keyof T]: T[K];
210
218
  } & {};
211
219
 
212
- export { ActionTypeEnum as A, type ChannelPreference as C, type DaySchedule as D, type InboxNotification as I, type NotificationFilter as N, PreferenceLevel as P, type Result as R, SeverityLevelEnum as S, type TimeRange as T, type UnreadCount as U, WebSocketEvent as W, ChannelType as a, type DefaultSchedule as b, NotificationStatus as c, NovuError as d, type NovuOptions as e, type PreferencesResponse as f, type StandardNovuOptions as g, type Subscriber as h, type WeeklySchedule as i, WorkflowCriticalityEnum as j, type Session as k, type Workflow as l, type Prettify as m };
220
+ export { ActionTypeEnum as A, type ChannelPreference as C, type DaySchedule as D, type InboxNotification as I, type NotificationFilter as N, PreferenceLevel as P, type Result as R, SeverityLevelEnum as S, type TimeRange as T, type UnreadCount as U, WebSocketEvent as W, ChannelType as a, type Context as b, type DefaultSchedule as c, NotificationStatus as d, NovuError as e, type NovuOptions as f, type PreferencesResponse as g, type StandardNovuOptions as h, type Subscriber as i, type WeeklySchedule as j, WorkflowCriticalityEnum as k, type Session as l, type Workflow as m, type Prettify as n, type ContextValue as o };
@@ -1,5 +1,5 @@
1
- import { U as UnreadCount, N as NotificationFilter, j as WorkflowCriticalityEnum, e as NovuOptions } from './types-DKMAoSfo.js';
2
- import { N as Notification, P as Preference, c as Schedule, b as Novu } from './novu--9_BeIj6.js';
1
+ import { U as UnreadCount, N as NotificationFilter, k as WorkflowCriticalityEnum, f as NovuOptions } from './types-BM_9Xx5Z.js';
2
+ import { N as Notification, P as Preference, c as Schedule, b as Novu } from './novu-ThMWeiRt.js';
3
3
 
4
4
  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", "lockIcon", "bellContainer", "severityHigh__bellContainer", "severityMedium__bellContainer", "severityLow__bellContainer", "bellSeverityGlow", "severityGlowHigh__bellSeverityGlow", "severityGlowMedium__bellSeverityGlow", "severityGlowLow__bellSeverityGlow", "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", "severityHigh__notification", "severityMedium__notification", "severityLow__notification", "notificationBar", "severityHigh__notificationBar", "severityMedium__notificationBar", "severityLow__notificationBar", "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", "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"];
5
5
 
@@ -1,7 +1,7 @@
1
- export { N as Notification } from '../novu--9_BeIj6.js';
2
- import { e as NovuOptions } from '../types-DKMAoSfo.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 Appearance, L as Localization, T as Tab, P as PreferencesFilter, g as PreferenceGroups, h as PreferencesSort, R as RouterPush } from '../types-CvebLpsG.js';
4
- export { i as AppearanceCallback, j as AppearanceCallbackFunction, k as AppearanceCallbackKeys, l as AppearanceKey, E as ElementStyles, m as Elements, I as IconKey, n as IconOverrides, o as IconRenderer, p as LocalizationKey, q as NotificationStatus, r as Theme, V as Variables } from '../types-CvebLpsG.js';
1
+ export { N as Notification } from '../novu-ThMWeiRt.js';
2
+ import { f as NovuOptions } from '../types-BM_9Xx5Z.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 Appearance, L as Localization, T as Tab, P as PreferencesFilter, g as PreferenceGroups, h as PreferencesSort, R as RouterPush } from '../types-BjANCN3c.js';
4
+ export { i as AppearanceCallback, j as AppearanceCallbackFunction, k as AppearanceCallbackKeys, l as AppearanceKey, E as ElementStyles, m as Elements, I as IconKey, n as IconOverrides, o as IconRenderer, p as LocalizationKey, q as NotificationStatus, r as Theme, V as Variables } from '../types-BjANCN3c.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';