@novu/js 3.11.0 → 3.11.2-nightly.20251224.97b30e30dd

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.
Files changed (36) hide show
  1. package/dist/cjs/{chunk-QQNKEWGC.js → chunk-AFLPFCXM.js} +1338 -1241
  2. package/dist/cjs/chunk-CDGREQFE.js +799 -0
  3. package/dist/cjs/index.d.ts +4 -4
  4. package/dist/cjs/index.js +38 -26
  5. package/dist/cjs/internal/index.d.ts +14 -2
  6. package/dist/cjs/internal/index.js +12 -4
  7. package/dist/cjs/novu-DxuaDf-Z.d.ts +192 -0
  8. package/dist/{esm/novu-DY-mm8Og.d.mts → cjs/novu-event-emitter-BOA_6GfJ.d.ts} +413 -162
  9. package/dist/cjs/themes/index.d.ts +11 -5
  10. package/dist/cjs/themes/index.js +17 -1
  11. package/dist/cjs/types-Buzm23uF.d.ts +836 -0
  12. package/dist/cjs/ui/index.d.ts +74 -7
  13. package/dist/cjs/ui/index.js +1836 -261
  14. package/dist/esm/{chunk-UM35OVAD.mjs → chunk-GDLXUD4E.mjs} +1308 -1207
  15. package/dist/esm/chunk-SWKDFXVR.mjs +770 -0
  16. package/dist/esm/index.d.mts +4 -4
  17. package/dist/esm/index.mjs +2 -2
  18. package/dist/esm/internal/index.d.mts +14 -2
  19. package/dist/esm/internal/index.mjs +1 -1
  20. package/dist/esm/novu-DY8vwRGE.d.mts +192 -0
  21. package/dist/{cjs/novu-ThMWeiRt.d.ts → esm/novu-event-emitter-BOA_6GfJ.d.mts} +413 -162
  22. package/dist/esm/themes/index.d.mts +11 -5
  23. package/dist/esm/themes/index.mjs +16 -2
  24. package/dist/esm/types-xBjzv9ok.d.mts +836 -0
  25. package/dist/esm/ui/index.d.mts +74 -7
  26. package/dist/esm/ui/index.mjs +1833 -257
  27. package/dist/index.css +1 -1
  28. package/dist/novu.min.js +12 -12
  29. package/dist/novu.min.js.gz +0 -0
  30. package/package.json +18 -17
  31. package/dist/cjs/chunk-VWSQDNZX.js +0 -66
  32. package/dist/cjs/types-BM_9Xx5Z.d.ts +0 -220
  33. package/dist/cjs/types-BjANCN3c.d.ts +0 -537
  34. package/dist/esm/chunk-RZWQYM3H.mjs +0 -62
  35. package/dist/esm/types-BM_9Xx5Z.d.mts +0 -220
  36. package/dist/esm/types-C5eX1GmB.d.mts +0 -537
@@ -1,4 +1,4 @@
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.mjs';
1
+ import { RulesLogic } from 'json-logic-js';
2
2
 
3
3
  type HttpClientOptions = {
4
4
  apiVersion?: string;
@@ -7,6 +7,37 @@ type HttpClientOptions = {
7
7
  headers?: Record<string, string>;
8
8
  };
9
9
 
10
+ declare class SubscriptionsCache {
11
+ #private;
12
+ constructor({ emitterInstance, inboxServiceInstance, useCache, }: {
13
+ emitterInstance: NovuEventEmitter;
14
+ inboxServiceInstance: InboxService;
15
+ useCache: boolean;
16
+ });
17
+ private handleCreate;
18
+ private handleUpdate;
19
+ private handlePreferenceUpdate;
20
+ private handleBulkPreferenceUpdate;
21
+ private updateSubscriptionPreferences;
22
+ private createUpdatedSubscription;
23
+ private handleDelete;
24
+ private handleDeleteById;
25
+ has(args: ListSubscriptionsArgs): boolean;
26
+ set(args: ListSubscriptionsArgs, data: TopicSubscription[]): void;
27
+ setOne(args: GetSubscriptionArgs, data: TopicSubscription): void;
28
+ getAll(args: ListSubscriptionsArgs): TopicSubscription[] | undefined;
29
+ get(args: GetSubscriptionArgs): TopicSubscription | undefined;
30
+ invalidate(args: {
31
+ topicKey: string;
32
+ }): void;
33
+ clearAll(): void;
34
+ }
35
+
36
+ declare class NovuError extends Error {
37
+ originalError: Error;
38
+ constructor(message: string, originalError: unknown);
39
+ }
40
+
10
41
  type ListPreferencesArgs = {
11
42
  tags?: string[];
12
43
  severity?: SeverityLevelEnum | SeverityLevelEnum[];
@@ -41,19 +72,6 @@ declare class PreferencesCache {
41
72
  clearAll(): void;
42
73
  }
43
74
 
44
- declare class BaseModule {
45
- #private;
46
- protected _inboxService: InboxService;
47
- protected _emitter: NovuEventEmitter;
48
- constructor({ inboxServiceInstance, eventEmitterInstance, }: {
49
- inboxServiceInstance: InboxService;
50
- eventEmitterInstance: NovuEventEmitter;
51
- });
52
- protected onSessionSuccess(_: Session): void;
53
- protected onSessionError(_: unknown): void;
54
- callWithSession<T>(fn: () => Result<T>): Result<T>;
55
- }
56
-
57
75
  type ScheduleLike = Partial<Pick<Schedule, 'isEnabled' | 'weeklySchedule'>>;
58
76
  declare class Schedule {
59
77
  #private;
@@ -68,36 +86,6 @@ declare class Schedule {
68
86
  update(args: UpdateScheduleArgs): Result<Schedule>;
69
87
  }
70
88
 
71
- declare class PreferenceSchedule extends BaseModule {
72
- #private;
73
- readonly cache: ScheduleCache;
74
- constructor({ cache, useCache, inboxServiceInstance, eventEmitterInstance, }: {
75
- cache: ScheduleCache;
76
- useCache: boolean;
77
- inboxServiceInstance: InboxService;
78
- eventEmitterInstance: NovuEventEmitter;
79
- });
80
- get(): Result<Schedule>;
81
- update(args: UpdateScheduleArgs): Result<Schedule>;
82
- }
83
-
84
- declare class Preferences extends BaseModule {
85
- #private;
86
- readonly cache: PreferencesCache;
87
- readonly scheduleCache: ScheduleCache;
88
- readonly schedule: PreferenceSchedule;
89
- constructor({ useCache, inboxServiceInstance, eventEmitterInstance, }: {
90
- useCache: boolean;
91
- inboxServiceInstance: InboxService;
92
- eventEmitterInstance: NovuEventEmitter;
93
- });
94
- list(args?: ListPreferencesArgs): Result<Preference[]>;
95
- update(args: BasePreferenceArgs): Result<Preference>;
96
- update(args: InstancePreferenceArgs): Result<Preference>;
97
- bulkUpdate(args: Array<BasePreferenceArgs>): Result<Preference[]>;
98
- bulkUpdate(args: Array<InstancePreferenceArgs>): Result<Preference[]>;
99
- }
100
-
101
89
  declare class ScheduleCache {
102
90
  #private;
103
91
  constructor({ emitterInstance }: {
@@ -134,6 +122,329 @@ declare class Preference {
134
122
  }>): Result<Preference>;
135
123
  }
136
124
 
125
+ declare global {
126
+ /**
127
+ * If you want to provide custom types for the notification.data object,
128
+ * simply redeclare this rule in the global namespace.
129
+ * Every notification object will use the provided type.
130
+ */
131
+ interface NotificationData {
132
+ [k: string]: unknown;
133
+ }
134
+ }
135
+ declare enum NotificationStatus {
136
+ READ = "read",
137
+ SEEN = "seen",
138
+ SNOOZED = "snoozed",
139
+ UNREAD = "unread",
140
+ UNSEEN = "unseen",
141
+ UNSNOOZED = "unsnoozed"
142
+ }
143
+ declare enum PreferenceLevel {
144
+ GLOBAL = "global",
145
+ TEMPLATE = "template"
146
+ }
147
+ declare enum ChannelType {
148
+ IN_APP = "in_app",
149
+ EMAIL = "email",
150
+ SMS = "sms",
151
+ CHAT = "chat",
152
+ PUSH = "push"
153
+ }
154
+ declare enum WebSocketEvent {
155
+ RECEIVED = "notification_received",
156
+ UNREAD = "unread_count_changed",
157
+ UNSEEN = "unseen_count_changed"
158
+ }
159
+ declare enum SeverityLevelEnum {
160
+ HIGH = "high",
161
+ MEDIUM = "medium",
162
+ LOW = "low",
163
+ NONE = "none"
164
+ }
165
+ declare enum WorkflowCriticalityEnum {
166
+ CRITICAL = "critical",
167
+ NON_CRITICAL = "nonCritical",
168
+ ALL = "all"
169
+ }
170
+ type UnreadCount = {
171
+ total: number;
172
+ severity: Record<SeverityLevelEnum, number>;
173
+ };
174
+ type Session = {
175
+ token: string;
176
+ /** @deprecated Use unreadCount.total instead */
177
+ totalUnreadCount: number;
178
+ unreadCount: UnreadCount;
179
+ removeNovuBranding: boolean;
180
+ isDevelopmentMode: boolean;
181
+ maxSnoozeDurationHours: number;
182
+ applicationIdentifier?: string;
183
+ contextKeys?: string[];
184
+ };
185
+ type Subscriber = {
186
+ id?: string;
187
+ subscriberId: string;
188
+ firstName?: string;
189
+ lastName?: string;
190
+ email?: string;
191
+ phone?: string;
192
+ avatar?: string;
193
+ locale?: string;
194
+ data?: Record<string, unknown>;
195
+ timezone?: string;
196
+ };
197
+ type Redirect = {
198
+ url: string;
199
+ target?: '_self' | '_blank' | '_parent' | '_top' | '_unfencedTop';
200
+ };
201
+ declare enum ActionTypeEnum {
202
+ PRIMARY = "primary",
203
+ SECONDARY = "secondary"
204
+ }
205
+ type Action = {
206
+ label: string;
207
+ isCompleted: boolean;
208
+ redirect?: Redirect;
209
+ };
210
+ type Workflow = {
211
+ id: string;
212
+ identifier: string;
213
+ name: string;
214
+ critical: boolean;
215
+ tags?: string[];
216
+ severity: SeverityLevelEnum;
217
+ };
218
+ type InboxNotification = {
219
+ id: string;
220
+ transactionId: string;
221
+ subject?: string;
222
+ body: string;
223
+ to: Subscriber;
224
+ isRead: boolean;
225
+ isSeen: boolean;
226
+ isArchived: boolean;
227
+ isSnoozed: boolean;
228
+ snoozedUntil?: string | null;
229
+ deliveredAt?: string[];
230
+ createdAt: string;
231
+ readAt?: string | null;
232
+ firstSeenAt?: string | null;
233
+ archivedAt?: string | null;
234
+ avatar?: string;
235
+ primaryAction?: Action;
236
+ secondaryAction?: Action;
237
+ channelType: ChannelType;
238
+ tags?: string[];
239
+ data?: NotificationData;
240
+ redirect?: Redirect;
241
+ workflow?: Workflow;
242
+ severity: SeverityLevelEnum;
243
+ };
244
+ type NotificationFilter = {
245
+ tags?: string[];
246
+ read?: boolean;
247
+ archived?: boolean;
248
+ snoozed?: boolean;
249
+ seen?: boolean;
250
+ data?: Record<string, unknown>;
251
+ severity?: SeverityLevelEnum | SeverityLevelEnum[];
252
+ };
253
+ type ChannelPreference = {
254
+ email?: boolean;
255
+ sms?: boolean;
256
+ in_app?: boolean;
257
+ chat?: boolean;
258
+ push?: boolean;
259
+ };
260
+ type TimeRange = {
261
+ start: string;
262
+ end: string;
263
+ };
264
+ type DaySchedule = {
265
+ isEnabled: boolean;
266
+ hours?: Array<TimeRange>;
267
+ };
268
+ type WeeklySchedule = {
269
+ monday?: DaySchedule;
270
+ tuesday?: DaySchedule;
271
+ wednesday?: DaySchedule;
272
+ thursday?: DaySchedule;
273
+ friday?: DaySchedule;
274
+ saturday?: DaySchedule;
275
+ sunday?: DaySchedule;
276
+ };
277
+ type DefaultSchedule = {
278
+ isEnabled?: boolean;
279
+ weeklySchedule?: WeeklySchedule;
280
+ };
281
+ type ContextValue = string | {
282
+ id: string;
283
+ data?: Record<string, unknown>;
284
+ };
285
+ type Context = Partial<Record<string, ContextValue>>;
286
+ type PreferencesResponse = {
287
+ level: PreferenceLevel;
288
+ enabled: boolean;
289
+ condition?: RulesLogic;
290
+ subscriptionId?: string;
291
+ channels: ChannelPreference;
292
+ overrides?: IPreferenceOverride[];
293
+ workflow?: Workflow;
294
+ schedule?: {
295
+ isEnabled: boolean;
296
+ weeklySchedule?: WeeklySchedule;
297
+ };
298
+ };
299
+ declare enum PreferenceOverrideSourceEnum {
300
+ SUBSCRIBER = "subscriber",
301
+ TEMPLATE = "template",
302
+ WORKFLOW_OVERRIDE = "workflowOverride"
303
+ }
304
+ type IPreferenceOverride = {
305
+ channel: ChannelType;
306
+ source: PreferenceOverrideSourceEnum;
307
+ };
308
+ type SubscriptionPreferenceResponse = Omit<PreferencesResponse, 'subscriptionId' | 'workflow' | 'schedule' | 'level' | 'channels'> & {
309
+ subscriptionId: string;
310
+ workflow: Workflow;
311
+ };
312
+ type SubscriptionResponse = {
313
+ id: string;
314
+ identifier: string;
315
+ name?: string;
316
+ preferences?: Array<SubscriptionPreferenceResponse>;
317
+ };
318
+ type Options = {
319
+ refetch?: boolean;
320
+ useCache?: boolean;
321
+ };
322
+ type Result<D = undefined, E = NovuError> = Promise<{
323
+ data?: D;
324
+ error?: E;
325
+ }>;
326
+ type KeylessNovuOptions = {} & {
327
+ [K in string]?: never;
328
+ };
329
+ type StandardNovuOptions = {
330
+ /** @deprecated Use apiUrl instead */
331
+ backendUrl?: string;
332
+ /** @internal Should be used internally for testing purposes */
333
+ __userAgent?: string;
334
+ applicationIdentifier: string;
335
+ subscriberHash?: string;
336
+ contextHash?: string;
337
+ apiUrl?: string;
338
+ socketUrl?: string;
339
+ useCache?: boolean;
340
+ defaultSchedule?: DefaultSchedule;
341
+ context?: Context;
342
+ } & ({
343
+ /** @deprecated Use subscriber prop instead */
344
+ subscriberId: string;
345
+ subscriber?: never;
346
+ } | {
347
+ subscriber: Subscriber | string;
348
+ subscriberId?: never;
349
+ });
350
+ type NovuOptions = KeylessNovuOptions | StandardNovuOptions;
351
+ type Prettify<T> = {
352
+ [K in keyof T]: T[K];
353
+ } & {};
354
+
355
+ declare class SubscriptionPreference {
356
+ #private;
357
+ readonly subscriptionId: string;
358
+ readonly workflow: Workflow;
359
+ readonly enabled: boolean;
360
+ readonly condition?: RulesLogic;
361
+ constructor(preference: SubscriptionPreferenceResponse, emitter: NovuEventEmitter, inboxService: InboxService, cache: SubscriptionsCache, useCache?: boolean);
362
+ update(args: {
363
+ value: boolean | RulesLogic;
364
+ }): Result<SubscriptionPreference>;
365
+ }
366
+
367
+ declare class TopicSubscription {
368
+ #private;
369
+ readonly id: string;
370
+ readonly identifier: string;
371
+ readonly topicKey: string;
372
+ readonly preferences?: Array<SubscriptionPreference> | undefined;
373
+ constructor(subscription: SubscriptionResponse & {
374
+ topicKey: string;
375
+ }, emitter: NovuEventEmitter, inboxService: InboxService, cache: SubscriptionsCache, useCache?: boolean);
376
+ update(args: BaseUpdateSubscriptionArgs): Result<TopicSubscription>;
377
+ update(args: InstanceUpdateSubscriptionArgs): Result<TopicSubscription>;
378
+ updatePreference(args: BaseSubscriptionPreferenceArgs): Result<SubscriptionPreference>;
379
+ updatePreference(args: InstanceSubscriptionPreferenceArgs): Result<SubscriptionPreference>;
380
+ bulkUpdatePreferences(args: Array<BaseSubscriptionPreferenceArgs>): Result<SubscriptionPreference[]>;
381
+ bulkUpdatePreferences(args: Array<InstanceSubscriptionPreferenceArgs>): Result<SubscriptionPreference[]>;
382
+ delete(): Result<void>;
383
+ }
384
+
385
+ type WorkflowIdentifierOrId = string;
386
+ type WorkflowFilter = {
387
+ workflowId: WorkflowIdentifierOrId;
388
+ enabled?: boolean;
389
+ condition?: RulesLogic;
390
+ filter?: never;
391
+ };
392
+ type WorkflowGroupFilter = {
393
+ filter: {
394
+ workflowIds?: Array<WorkflowIdentifierOrId>;
395
+ tags?: string[];
396
+ };
397
+ enabled?: boolean;
398
+ condition?: RulesLogic;
399
+ workflowId?: never;
400
+ };
401
+ type PreferenceFilter = WorkflowIdentifierOrId | WorkflowFilter | WorkflowGroupFilter;
402
+ type ListSubscriptionsArgs = {
403
+ topicKey: string;
404
+ };
405
+ type GetSubscriptionArgs = {
406
+ topicKey: string;
407
+ identifier?: string;
408
+ workflowIds?: string[];
409
+ tags?: string[];
410
+ };
411
+ type CreateSubscriptionArgs = {
412
+ topicKey: string;
413
+ topicName?: string;
414
+ identifier?: string;
415
+ name?: string;
416
+ preferences?: Array<PreferenceFilter> | undefined;
417
+ };
418
+ type BaseUpdateSubscriptionArgs = {
419
+ topicKey: string;
420
+ subscriptionId: string;
421
+ name?: string;
422
+ preferences?: Array<PreferenceFilter>;
423
+ };
424
+ type InstanceUpdateSubscriptionArgs = {
425
+ subscription: TopicSubscription;
426
+ name?: string;
427
+ preferences?: Array<PreferenceFilter>;
428
+ };
429
+ type UpdateSubscriptionArgs = BaseUpdateSubscriptionArgs | InstanceUpdateSubscriptionArgs;
430
+ type BaseSubscriptionPreferenceArgs = {
431
+ workflowId: string;
432
+ value: boolean | RulesLogic;
433
+ };
434
+ type InstanceSubscriptionPreferenceArgs = {
435
+ preference: SubscriptionPreference;
436
+ value: boolean | RulesLogic;
437
+ };
438
+ type UpdateSubscriptionPreferenceArgs = BaseSubscriptionPreferenceArgs | InstanceSubscriptionPreferenceArgs;
439
+ type BaseDeleteSubscriptionArgs = {
440
+ subscriptionId: string;
441
+ topicKey: string;
442
+ };
443
+ type InstanceDeleteSubscriptionArgs = {
444
+ subscription: TopicSubscription;
445
+ };
446
+ type DeleteSubscriptionArgs = BaseDeleteSubscriptionArgs | InstanceDeleteSubscriptionArgs;
447
+
137
448
  type InboxServiceOptions = HttpClientOptions;
138
449
  declare class InboxService {
139
450
  #private;
@@ -236,6 +547,47 @@ declare class InboxService {
236
547
  }): Promise<PreferencesResponse>;
237
548
  fetchGlobalPreferences(): Promise<PreferencesResponse>;
238
549
  triggerHelloWorldEvent(): Promise<unknown>;
550
+ fetchSubscriptions(topicKey: string): Promise<SubscriptionResponse[]>;
551
+ getSubscription(topicKey: string, identifier?: string, workflowIds?: string[], tags?: string[]): Promise<SubscriptionResponse | undefined>;
552
+ createSubscription({ identifier, name, topicKey, topicName, preferences, }: {
553
+ identifier?: string;
554
+ name?: string;
555
+ topicKey: string;
556
+ topicName?: string;
557
+ preferences?: Array<PreferenceFilter>;
558
+ }): Promise<SubscriptionResponse>;
559
+ updateSubscription({ topicKey, subscriptionId, name, preferences, }: {
560
+ topicKey: string;
561
+ subscriptionId: string;
562
+ name?: string;
563
+ preferences?: Array<PreferenceFilter>;
564
+ }): Promise<SubscriptionResponse>;
565
+ updateSubscriptionPreference({ subscriptionId, workflowId, enabled, condition, email, sms, in_app, chat, push, }: {
566
+ subscriptionId: string;
567
+ workflowId: string;
568
+ enabled?: boolean;
569
+ condition?: RulesLogic;
570
+ email?: boolean;
571
+ sms?: boolean;
572
+ in_app?: boolean;
573
+ chat?: boolean;
574
+ push?: boolean;
575
+ }): Promise<SubscriptionPreferenceResponse>;
576
+ bulkUpdateSubscriptionPreferences(preferences: Array<{
577
+ subscriptionIdOrIdentifier: string;
578
+ workflowId: string;
579
+ enabled?: boolean;
580
+ condition?: RulesLogic;
581
+ email?: boolean;
582
+ sms?: boolean;
583
+ in_app?: boolean;
584
+ chat?: boolean;
585
+ push?: boolean;
586
+ }>): Promise<SubscriptionPreferenceResponse[]>;
587
+ deleteSubscription({ topicKey, subscriptionId }: {
588
+ topicKey: string;
589
+ subscriptionId: string;
590
+ }): Promise<void>;
239
591
  }
240
592
 
241
593
  declare class Notification implements Pick<NovuEventEmitter, 'on'>, InboxNotification {
@@ -285,28 +637,6 @@ declare class Notification implements Pick<NovuEventEmitter, 'on'>, InboxNotific
285
637
  off<Key extends EventNames>(eventName: Key, listener: EventHandler<Events[Key]>): void;
286
638
  }
287
639
 
288
- declare class NotificationsCache {
289
- #private;
290
- constructor({ emitter }: {
291
- emitter: NovuEventEmitter;
292
- });
293
- private updateNotification;
294
- private removeNotification;
295
- private handleNotificationEvent;
296
- private getAggregated;
297
- has(args: ListNotificationsArgs): boolean;
298
- set(args: ListNotificationsArgs, data: ListNotificationsResponse): void;
299
- update(args: ListNotificationsArgs, data: ListNotificationsResponse): void;
300
- getAll(args: ListNotificationsArgs): ListNotificationsResponse | undefined;
301
- /**
302
- * Get unique notifications based on specified filter fields.
303
- * The same tags and data can be applied to multiple filters which means that the same notification can be duplicated.
304
- */
305
- getUniqueNotifications({ tags, read, data, }: Pick<ListNotificationsArgs, 'tags' | 'read' | 'data'>): Array<Notification>;
306
- clear(filter: NotificationFilter): void;
307
- clearAll(): void;
308
- }
309
-
310
640
  type ListNotificationsArgs = {
311
641
  tags?: string[];
312
642
  read?: boolean;
@@ -376,69 +706,6 @@ type UnsnoozeArgs = BaseArgs | InstanceArgs;
376
706
  type CompleteArgs = BaseArgs | InstanceArgs;
377
707
  type RevertArgs = BaseArgs | InstanceArgs;
378
708
 
379
- declare class Notifications extends BaseModule {
380
- #private;
381
- readonly cache: NotificationsCache;
382
- constructor({ useCache, inboxServiceInstance, eventEmitterInstance, }: {
383
- useCache: boolean;
384
- inboxServiceInstance: InboxService;
385
- eventEmitterInstance: NovuEventEmitter;
386
- });
387
- get inboxService(): InboxService;
388
- list({ limit, ...restOptions }?: ListNotificationsArgs): Result<ListNotificationsResponse>;
389
- count(args?: FilterCountArgs): Result<FilterCountResponse>;
390
- count(args?: FiltersCountArgs): Result<FiltersCountResponse>;
391
- read(args: BaseArgs): Result<Notification>;
392
- read(args: InstanceArgs): Result<Notification>;
393
- unread(args: BaseArgs): Result<Notification>;
394
- unread(args: InstanceArgs): Result<Notification>;
395
- seen(args: BaseArgs): Result<Notification>;
396
- seen(args: InstanceArgs): Result<Notification>;
397
- archive(args: BaseArgs): Result<Notification>;
398
- archive(args: InstanceArgs): Result<Notification>;
399
- unarchive(args: BaseArgs): Result<Notification>;
400
- unarchive(args: InstanceArgs): Result<Notification>;
401
- delete(args: BaseArgs): Result<void>;
402
- delete(args: InstanceArgs): Result<void>;
403
- snooze(args: SnoozeArgs): Result<Notification>;
404
- unsnooze(args: BaseArgs): Result<Notification>;
405
- unsnooze(args: InstanceArgs): Result<Notification>;
406
- completePrimary(args: BaseArgs): Result<Notification>;
407
- completePrimary(args: InstanceArgs): Result<Notification>;
408
- completeSecondary(args: BaseArgs): Result<Notification>;
409
- completeSecondary(args: InstanceArgs): Result<Notification>;
410
- revertPrimary(args: BaseArgs): Result<Notification>;
411
- revertPrimary(args: InstanceArgs): Result<Notification>;
412
- revertSecondary(args: BaseArgs): Result<Notification>;
413
- revertSecondary(args: InstanceArgs): Result<Notification>;
414
- readAll({ tags, data, }?: {
415
- tags?: NotificationFilter['tags'];
416
- data?: Record<string, unknown>;
417
- }): Result<void>;
418
- seenAll(args?: {
419
- notificationIds: string[];
420
- } | {
421
- tags?: NotificationFilter['tags'];
422
- data?: Record<string, unknown>;
423
- } | {}): Result<void>;
424
- archiveAll({ tags, data, }?: {
425
- tags?: NotificationFilter['tags'];
426
- data?: Record<string, unknown>;
427
- }): Result<void>;
428
- archiveAllRead({ tags, data }?: {
429
- tags?: string[];
430
- data?: Record<string, unknown>;
431
- }): Result<void>;
432
- deleteAll({ tags, data, }?: {
433
- tags?: NotificationFilter['tags'];
434
- data?: Record<string, unknown>;
435
- }): Result<void>;
436
- clearCache({ filter }?: {
437
- filter?: NotificationFilter;
438
- }): void;
439
- triggerHelloWorldEvent(): Promise<any>;
440
- }
441
-
442
709
  type KeylessInitializeSessionArgs = {} & {
443
710
  [K in string]?: never;
444
711
  };
@@ -504,6 +771,15 @@ type PreferenceUpdateEvents = BaseEvents<'preference.update', UpdatePreferenceAr
504
771
  type PreferencesBulkUpdateEvents = BaseEvents<'preferences.bulk_update', Array<UpdatePreferenceArgs>, Preference[]>;
505
772
  type PreferenceScheduleGetEvents = BaseEvents<'preference.schedule.get', undefined, Schedule>;
506
773
  type PreferenceScheduleUpdateEvents = BaseEvents<'preference.schedule.update', UpdateScheduleArgs, Schedule>;
774
+ type SubscriptionsFetchEvents = BaseEvents<'subscriptions.list', ListSubscriptionsArgs, TopicSubscription[]>;
775
+ type SubscriptionGetEvents = BaseEvents<'subscription.get', GetSubscriptionArgs, TopicSubscription | null>;
776
+ type SubscriptionCreateEvents = BaseEvents<'subscription.create', CreateSubscriptionArgs, TopicSubscription>;
777
+ type SubscriptionUpdateEvents = BaseEvents<'subscription.update', UpdateSubscriptionArgs, TopicSubscription>;
778
+ type SubscriptionPreferenceUpdateEvents = BaseEvents<'subscription.preference.update', UpdateSubscriptionPreferenceArgs, SubscriptionPreference>;
779
+ type SubscriptionPreferencesBulkUpdateEvents = BaseEvents<'subscription.preferences.bulk_update', Array<UpdateSubscriptionPreferenceArgs & {
780
+ subscriptionId: string;
781
+ }>, SubscriptionPreference[]>;
782
+ type SubscriptionDeleteEvents = BaseEvents<'subscription.delete', DeleteSubscriptionArgs, void>;
507
783
  type SocketConnectEvents = BaseEvents<'socket.connect', {
508
784
  socketUrl: string;
509
785
  }, undefined>;
@@ -550,6 +826,13 @@ type Events = SessionInitializeEvents & NotificationsFetchEvents & {
550
826
  'preference.schedule.get.updated': {
551
827
  data: Schedule;
552
828
  };
829
+ } & SubscriptionsFetchEvents & SubscriptionGetEvents & SubscriptionCreateEvents & SubscriptionPreferenceUpdateEvents & SubscriptionUpdateEvents & SubscriptionPreferencesBulkUpdateEvents & SubscriptionDeleteEvents & {
830
+ 'subscriptions.list.updated': {
831
+ data: {
832
+ topicKey: string;
833
+ subscriptions: TopicSubscription[];
834
+ };
835
+ };
553
836
  } & SocketConnectEvents & SocketEvents & NotificationReadEvents & NotificationUnreadEvents & NotificationSeenEvents & NotificationArchiveEvents & NotificationUnarchiveEvents & NotificationDeleteEvents & NotificationSnoozeEvents & NotificationUnsnoozeEvents & NotificationCompleteActionEvents & NotificationRevertActionEvents & NotificationsReadAllEvents & NotificationsSeenAllEvents & NotificationsArchivedAllEvents & NotificationsReadArchivedAllEvents & NotificationsDeletedAllEvents;
554
837
  type EventNames = keyof Events;
555
838
  type SocketEventNames = keyof SocketEvents;
@@ -563,36 +846,4 @@ declare class NovuEventEmitter {
563
846
  emit<Key extends EventNames>(type: Key, event?: Events[Key]): void;
564
847
  }
565
848
 
566
- interface BaseSocketInterface {
567
- isSocketEvent(eventName: string): eventName is SocketEventNames;
568
- connect(): Result<void>;
569
- disconnect(): Result<void>;
570
- }
571
-
572
- declare class Novu implements Pick<NovuEventEmitter, 'on'> {
573
- #private;
574
- readonly notifications: Notifications;
575
- readonly preferences: Preferences;
576
- readonly socket: BaseSocketInterface;
577
- on: <Key extends EventNames>(eventName: Key, listener: EventHandler<Events[Key]>) => () => void;
578
- /**
579
- * @deprecated
580
- * Use the cleanup function returned by the "on" method instead.
581
- */
582
- off: <Key extends EventNames>(eventName: Key, listener: EventHandler<Events[Key]>) => void;
583
- get applicationIdentifier(): string | undefined;
584
- get subscriberId(): string | undefined;
585
- get context(): Partial<Record<string, ContextValue>> | undefined;
586
- get contextKey(): string;
587
- constructor(options: NovuOptions);
588
- changeSubscriber(options: {
589
- subscriber: Subscriber;
590
- subscriberHash?: string;
591
- }): Promise<void>;
592
- changeContext(options: {
593
- context: Context;
594
- contextHash?: string;
595
- }): Promise<void>;
596
- }
597
-
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 };
849
+ export { type InstancePreferenceArgs as $, WebSocketEvent as A, type BaseDeleteSubscriptionArgs as B, type CreateSubscriptionArgs as C, type DeleteSubscriptionArgs as D, type EventHandler as E, type FiltersCountResponse as F, type GetSubscriptionArgs as G, type WeeklySchedule as H, type InstanceDeleteSubscriptionArgs as I, WorkflowCriticalityEnum as J, NovuError as K, type ListSubscriptionsArgs as L, InboxService as M, type NotificationFilter as N, NovuEventEmitter as O, type PreferenceFilter as P, type Session as Q, type Result as R, SeverityLevelEnum as S, TopicSubscription as T, type UpdateSubscriptionArgs as U, ScheduleCache as V, type WorkflowFilter as W, type UpdateScheduleArgs as X, PreferencesCache as Y, type ListPreferencesArgs as Z, type BasePreferenceArgs as _, Notification as a, type ListNotificationsArgs as a0, type FilterCountArgs as a1, type FilterCountResponse as a2, type FiltersCountArgs as a3, type BaseArgs as a4, type InstanceArgs as a5, type SnoozeArgs as a6, SubscriptionsCache as a7, type Options as a8, type EventNames as a9, type ContextValue as aa, type Events as b, type SocketEventNames as c, type WorkflowGroupFilter as d, type WorkflowIdentifierOrId as e, type BaseUpdateSubscriptionArgs as f, type InstanceUpdateSubscriptionArgs as g, SubscriptionPreference as h, type UpdateSubscriptionPreferenceArgs as i, type ChannelPreference as j, ChannelType as k, type Context as l, type DaySchedule as m, type DefaultSchedule as n, type InboxNotification as o, type ListNotificationsResponse as p, NotificationStatus as q, type NovuOptions as r, Preference as s, PreferenceLevel as t, type PreferencesResponse as u, Schedule as v, type StandardNovuOptions as w, type Subscriber as x, type TimeRange as y, type UnreadCount as z };
@@ -1,7 +1,13 @@
1
- import { r as Theme } from '../types-BjANCN3c.js';
2
- import '../types-BM_9Xx5Z.js';
3
- import '../novu-ThMWeiRt.js';
1
+ import { G as InboxTheme, Y as SubscriptionTheme } from '../types-Buzm23uF.js';
2
+ import '../novu-event-emitter-BOA_6GfJ.js';
3
+ import 'json-logic-js';
4
+ import '../novu-DxuaDf-Z.js';
4
5
 
5
- declare const dark: Theme;
6
+ declare const inboxDarkTheme: InboxTheme;
7
+ /**
8
+ * @deprecated Use inboxDarkTheme instead
9
+ */
10
+ declare const dark: InboxTheme;
11
+ declare const subscriptionDarkTheme: SubscriptionTheme;
6
12
 
7
- export { dark };
13
+ export { dark, inboxDarkTheme, subscriptionDarkTheme };
@@ -3,7 +3,7 @@
3
3
  require('../chunk-7B52C2XE.js');
4
4
 
5
5
  // src/ui/themes/dark.ts
6
- var dark = {
6
+ var inboxDarkTheme = {
7
7
  variables: {
8
8
  colorNeutral: "white",
9
9
  colorBackground: "#1A1A1A",
@@ -25,5 +25,21 @@ var dark = {
25
25
  bellSeverityGlow: "nt-bg-severity-none-alpha-300 before:nt-bg-severity-none-alpha-300"
26
26
  }
27
27
  };
28
+ var dark = inboxDarkTheme;
29
+ var subscriptionDarkTheme = {
30
+ variables: {
31
+ colorNeutral: "white",
32
+ colorBackground: "#1A1A1A",
33
+ colorForeground: "#EDEDEF",
34
+ colorSecondary: "#383838",
35
+ colorSecondaryForeground: "#EDEDEF",
36
+ colorShadow: "black",
37
+ colorRing: "#E1E4EA",
38
+ colorStripes: "#FF8447"
39
+ },
40
+ elements: {}
41
+ };
28
42
 
29
43
  exports.dark = dark;
44
+ exports.inboxDarkTheme = inboxDarkTheme;
45
+ exports.subscriptionDarkTheme = subscriptionDarkTheme;