@novu/js 3.11.0-rc.1 → 3.11.1
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/dist/cjs/{chunk-TROJWAJA.js → chunk-MKYWGA37.js} +131 -809
- package/dist/cjs/chunk-WFVHYVDM.js +793 -0
- package/dist/cjs/index.d.ts +3 -4
- package/dist/cjs/index.js +26 -26
- package/dist/cjs/internal/index.d.ts +8 -2
- package/dist/cjs/internal/index.js +8 -4
- package/dist/cjs/novu-CKWESYFZ.d.ts +165 -0
- package/dist/cjs/{novu-ThMWeiRt.d.ts → novu-event-emitter-C7GZ7-r1.d.ts} +220 -163
- package/dist/cjs/themes/index.d.ts +3 -3
- package/dist/cjs/{types-BjANCN3c.d.ts → types-CeLsxWJg.d.ts} +2 -2
- package/dist/cjs/ui/index.d.ts +5 -4
- package/dist/cjs/ui/index.js +13 -13
- package/dist/esm/{chunk-D4W52D4A.mjs → chunk-76A4RQYD.mjs} +99 -771
- package/dist/esm/chunk-GY4JXBST.mjs +765 -0
- package/dist/esm/index.d.mts +3 -4
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/internal/index.d.mts +8 -2
- package/dist/esm/internal/index.mjs +1 -1
- package/dist/esm/novu-3CfttQ8e.d.mts +165 -0
- package/dist/esm/{novu-DY-mm8Og.d.mts → novu-event-emitter-C7GZ7-r1.d.mts} +220 -163
- package/dist/esm/themes/index.d.mts +3 -3
- package/dist/esm/{types-C5eX1GmB.d.mts → types-4YuozpWu.d.mts} +2 -2
- package/dist/esm/ui/index.d.mts +5 -4
- package/dist/esm/ui/index.mjs +5 -5
- package/dist/novu.min.js +12 -12
- package/dist/novu.min.js.gz +0 -0
- package/package.json +17 -17
- package/dist/cjs/chunk-VWSQDNZX.js +0 -66
- package/dist/cjs/types-BM_9Xx5Z.d.ts +0 -220
- package/dist/esm/chunk-RZWQYM3H.mjs +0 -62
- package/dist/esm/types-BM_9Xx5Z.d.mts +0 -220
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { N as Notification } from './novu-
|
|
2
|
-
export { E as EventHandler,
|
|
3
|
-
|
|
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';
|
|
1
|
+
import { S as SeverityLevelEnum, N as NotificationFilter, a as Notification } from './novu-event-emitter-C7GZ7-r1.js';
|
|
2
|
+
export { C as ChannelPreference, d as ChannelType, e as Context, D as DaySchedule, f as DefaultSchedule, E as EventHandler, b as Events, F as FiltersCountResponse, I as InboxNotification, L as ListNotificationsResponse, g as NotificationStatus, h as NovuError, i as NovuOptions, P as Preference, j as PreferenceLevel, k as PreferencesResponse, l as Schedule, c as SocketEventNames, m as StandardNovuOptions, n as Subscriber, T as TimeRange, U as UnreadCount, W as WebSocketEvent, o as WeeklySchedule, p as WorkflowCriticalityEnum } from './novu-event-emitter-C7GZ7-r1.js';
|
|
3
|
+
export { N as Novu } from './novu-CKWESYFZ.js';
|
|
5
4
|
|
|
6
5
|
declare const areTagsEqual: (tags1?: string[], tags2?: string[]) => boolean;
|
|
7
6
|
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
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunkMKYWGA37_js = require('./chunk-MKYWGA37.js');
|
|
4
|
+
var chunkWFVHYVDM_js = require('./chunk-WFVHYVDM.js');
|
|
5
5
|
require('./chunk-7B52C2XE.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
Object.defineProperty(exports, "
|
|
9
|
+
Object.defineProperty(exports, "Novu", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkMKYWGA37_js.Novu; }
|
|
12
12
|
});
|
|
13
|
-
Object.defineProperty(exports, "
|
|
13
|
+
Object.defineProperty(exports, "areSeveritiesEqual", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkMKYWGA37_js.areSeveritiesEqual; }
|
|
16
16
|
});
|
|
17
|
-
Object.defineProperty(exports, "
|
|
17
|
+
Object.defineProperty(exports, "areTagsEqual", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkMKYWGA37_js.areTagsEqual; }
|
|
20
20
|
});
|
|
21
|
-
Object.defineProperty(exports, "
|
|
21
|
+
Object.defineProperty(exports, "checkNotificationDataFilter", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkMKYWGA37_js.checkNotificationDataFilter; }
|
|
24
24
|
});
|
|
25
|
-
Object.defineProperty(exports, "
|
|
25
|
+
Object.defineProperty(exports, "checkNotificationMatchesFilter", {
|
|
26
26
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunkMKYWGA37_js.checkNotificationMatchesFilter; }
|
|
28
28
|
});
|
|
29
|
-
Object.defineProperty(exports, "
|
|
29
|
+
Object.defineProperty(exports, "isSameFilter", {
|
|
30
30
|
enumerable: true,
|
|
31
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkMKYWGA37_js.isSameFilter; }
|
|
32
32
|
});
|
|
33
|
-
Object.defineProperty(exports, "
|
|
33
|
+
Object.defineProperty(exports, "ChannelType", {
|
|
34
34
|
enumerable: true,
|
|
35
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunkWFVHYVDM_js.ChannelType; }
|
|
36
36
|
});
|
|
37
|
-
Object.defineProperty(exports, "
|
|
37
|
+
Object.defineProperty(exports, "NotificationStatus", {
|
|
38
38
|
enumerable: true,
|
|
39
|
-
get: function () { return
|
|
39
|
+
get: function () { return chunkWFVHYVDM_js.NotificationStatus; }
|
|
40
40
|
});
|
|
41
|
-
Object.defineProperty(exports, "
|
|
41
|
+
Object.defineProperty(exports, "PreferenceLevel", {
|
|
42
42
|
enumerable: true,
|
|
43
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunkWFVHYVDM_js.PreferenceLevel; }
|
|
44
44
|
});
|
|
45
|
-
Object.defineProperty(exports, "
|
|
45
|
+
Object.defineProperty(exports, "SeverityLevelEnum", {
|
|
46
46
|
enumerable: true,
|
|
47
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkWFVHYVDM_js.SeverityLevelEnum; }
|
|
48
48
|
});
|
|
49
|
-
Object.defineProperty(exports, "
|
|
49
|
+
Object.defineProperty(exports, "WebSocketEvent", {
|
|
50
50
|
enumerable: true,
|
|
51
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunkWFVHYVDM_js.WebSocketEvent; }
|
|
52
52
|
});
|
|
53
|
-
Object.defineProperty(exports, "
|
|
53
|
+
Object.defineProperty(exports, "WorkflowCriticalityEnum", {
|
|
54
54
|
enumerable: true,
|
|
55
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunkWFVHYVDM_js.WorkflowCriticalityEnum; }
|
|
56
56
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { e as Context, n as Subscriber, r as NovuEventEmitter, q as InboxService, I as InboxNotification, a as Notification } from '../novu-event-emitter-C7GZ7-r1.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Builds a compact, stable string key from context objects by extracting only type:id pairs.
|
|
@@ -19,10 +19,16 @@ declare function buildSubscriber({ subscriberId, subscriber, }: {
|
|
|
19
19
|
subscriber: Subscriber | string | undefined;
|
|
20
20
|
}): Subscriber;
|
|
21
21
|
|
|
22
|
+
declare function createNotification({ emitter, inboxService, notification, }: {
|
|
23
|
+
emitter: NovuEventEmitter;
|
|
24
|
+
inboxService: InboxService;
|
|
25
|
+
notification: InboxNotification;
|
|
26
|
+
}): Notification;
|
|
27
|
+
|
|
22
28
|
interface Token {
|
|
23
29
|
type: 'bold' | 'text';
|
|
24
30
|
content: string;
|
|
25
31
|
}
|
|
26
32
|
declare const parseMarkdownIntoTokens: (text: string) => Token[];
|
|
27
33
|
|
|
28
|
-
export { type Token, buildContextKey, buildSubscriber, parseMarkdownIntoTokens };
|
|
34
|
+
export { type Token, buildContextKey, buildSubscriber, createNotification, parseMarkdownIntoTokens };
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkWFVHYVDM_js = require('../chunk-WFVHYVDM.js');
|
|
4
4
|
require('../chunk-7B52C2XE.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "buildContextKey", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkWFVHYVDM_js.buildContextKey; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "buildSubscriber", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkWFVHYVDM_js.buildSubscriber; }
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "createNotification", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return chunkWFVHYVDM_js.createNotification; }
|
|
15
19
|
});
|
|
16
20
|
Object.defineProperty(exports, "parseMarkdownIntoTokens", {
|
|
17
21
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkWFVHYVDM_js.parseMarkdownIntoTokens; }
|
|
19
23
|
});
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { q as InboxService, r as NovuEventEmitter, s as Session, R as Result, t as ScheduleCache, l as Schedule, u as UpdateScheduleArgs, v as PreferencesCache, w as ListPreferencesArgs, P as Preference, B as BasePreferenceArgs, x as InstancePreferenceArgs, y as ListNotificationsArgs, L as ListNotificationsResponse, I as InboxNotification, a as Notification, N as NotificationFilter, z as FilterCountArgs, A as FilterCountResponse, G as FiltersCountArgs, F as FiltersCountResponse, H as BaseArgs, J as InstanceArgs, K as SnoozeArgs, c as SocketEventNames, M as EventNames, E as EventHandler, b as Events, O as ContextValue, i as NovuOptions, n as Subscriber, e as Context } from './novu-event-emitter-C7GZ7-r1.js';
|
|
2
|
+
|
|
3
|
+
declare class BaseModule {
|
|
4
|
+
#private;
|
|
5
|
+
_inboxService: InboxService;
|
|
6
|
+
_emitter: NovuEventEmitter;
|
|
7
|
+
constructor({ inboxServiceInstance, eventEmitterInstance, }: {
|
|
8
|
+
inboxServiceInstance: InboxService;
|
|
9
|
+
eventEmitterInstance: NovuEventEmitter;
|
|
10
|
+
});
|
|
11
|
+
protected onSessionSuccess(_: Session): void;
|
|
12
|
+
protected onSessionError(_: unknown): void;
|
|
13
|
+
callWithSession<T>(fn: () => Result<T>): Result<T>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare class PreferenceSchedule extends BaseModule {
|
|
17
|
+
#private;
|
|
18
|
+
readonly cache: ScheduleCache;
|
|
19
|
+
constructor({ cache, useCache, inboxServiceInstance, eventEmitterInstance, }: {
|
|
20
|
+
cache: ScheduleCache;
|
|
21
|
+
useCache: boolean;
|
|
22
|
+
inboxServiceInstance: InboxService;
|
|
23
|
+
eventEmitterInstance: NovuEventEmitter;
|
|
24
|
+
});
|
|
25
|
+
get(): Result<Schedule>;
|
|
26
|
+
update(args: UpdateScheduleArgs): Result<Schedule>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare class Preferences extends BaseModule {
|
|
30
|
+
#private;
|
|
31
|
+
readonly cache: PreferencesCache;
|
|
32
|
+
readonly scheduleCache: ScheduleCache;
|
|
33
|
+
readonly schedule: PreferenceSchedule;
|
|
34
|
+
constructor({ useCache, inboxServiceInstance, eventEmitterInstance, }: {
|
|
35
|
+
useCache: boolean;
|
|
36
|
+
inboxServiceInstance: InboxService;
|
|
37
|
+
eventEmitterInstance: NovuEventEmitter;
|
|
38
|
+
});
|
|
39
|
+
list(args?: ListPreferencesArgs): Result<Preference[]>;
|
|
40
|
+
update(args: BasePreferenceArgs): Result<Preference>;
|
|
41
|
+
update(args: InstancePreferenceArgs): Result<Preference>;
|
|
42
|
+
bulkUpdate(args: Array<BasePreferenceArgs>): Result<Preference[]>;
|
|
43
|
+
bulkUpdate(args: Array<InstancePreferenceArgs>): Result<Preference[]>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
declare class NotificationsCache {
|
|
47
|
+
#private;
|
|
48
|
+
constructor({ emitter, inboxService }: {
|
|
49
|
+
emitter: NovuEventEmitter;
|
|
50
|
+
inboxService: InboxService;
|
|
51
|
+
});
|
|
52
|
+
private updateNotification;
|
|
53
|
+
private removeNotification;
|
|
54
|
+
private handleNotificationEvent;
|
|
55
|
+
private getAggregated;
|
|
56
|
+
get(args: ListNotificationsArgs): ListNotificationsResponse | undefined;
|
|
57
|
+
has(args: ListNotificationsArgs): boolean;
|
|
58
|
+
set(args: ListNotificationsArgs, data: ListNotificationsResponse): void;
|
|
59
|
+
unshift(args: ListNotificationsArgs, notification: InboxNotification): void;
|
|
60
|
+
update(args: ListNotificationsArgs, data: ListNotificationsResponse): void;
|
|
61
|
+
getAll(args: ListNotificationsArgs): ListNotificationsResponse | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Get unique notifications based on specified filter fields.
|
|
64
|
+
* The same tags and data can be applied to multiple filters which means that the same notification can be duplicated.
|
|
65
|
+
*/
|
|
66
|
+
getUniqueNotifications({ tags, read, data, }: Pick<ListNotificationsArgs, 'tags' | 'read' | 'data'>): Array<Notification>;
|
|
67
|
+
clear(filter: NotificationFilter): void;
|
|
68
|
+
clearAll(): void;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
declare class Notifications extends BaseModule {
|
|
72
|
+
#private;
|
|
73
|
+
readonly cache: NotificationsCache;
|
|
74
|
+
constructor({ useCache, inboxServiceInstance, eventEmitterInstance, }: {
|
|
75
|
+
useCache: boolean;
|
|
76
|
+
inboxServiceInstance: InboxService;
|
|
77
|
+
eventEmitterInstance: NovuEventEmitter;
|
|
78
|
+
});
|
|
79
|
+
list({ limit, ...restOptions }?: ListNotificationsArgs): Result<ListNotificationsResponse>;
|
|
80
|
+
count(args?: FilterCountArgs): Result<FilterCountResponse>;
|
|
81
|
+
count(args?: FiltersCountArgs): Result<FiltersCountResponse>;
|
|
82
|
+
read(args: BaseArgs): Result<Notification>;
|
|
83
|
+
read(args: InstanceArgs): Result<Notification>;
|
|
84
|
+
unread(args: BaseArgs): Result<Notification>;
|
|
85
|
+
unread(args: InstanceArgs): Result<Notification>;
|
|
86
|
+
seen(args: BaseArgs): Result<Notification>;
|
|
87
|
+
seen(args: InstanceArgs): Result<Notification>;
|
|
88
|
+
archive(args: BaseArgs): Result<Notification>;
|
|
89
|
+
archive(args: InstanceArgs): Result<Notification>;
|
|
90
|
+
unarchive(args: BaseArgs): Result<Notification>;
|
|
91
|
+
unarchive(args: InstanceArgs): Result<Notification>;
|
|
92
|
+
delete(args: BaseArgs): Result<void>;
|
|
93
|
+
delete(args: InstanceArgs): Result<void>;
|
|
94
|
+
snooze(args: SnoozeArgs): Result<Notification>;
|
|
95
|
+
unsnooze(args: BaseArgs): Result<Notification>;
|
|
96
|
+
unsnooze(args: InstanceArgs): Result<Notification>;
|
|
97
|
+
completePrimary(args: BaseArgs): Result<Notification>;
|
|
98
|
+
completePrimary(args: InstanceArgs): Result<Notification>;
|
|
99
|
+
completeSecondary(args: BaseArgs): Result<Notification>;
|
|
100
|
+
completeSecondary(args: InstanceArgs): Result<Notification>;
|
|
101
|
+
revertPrimary(args: BaseArgs): Result<Notification>;
|
|
102
|
+
revertPrimary(args: InstanceArgs): Result<Notification>;
|
|
103
|
+
revertSecondary(args: BaseArgs): Result<Notification>;
|
|
104
|
+
revertSecondary(args: InstanceArgs): Result<Notification>;
|
|
105
|
+
readAll({ tags, data, }?: {
|
|
106
|
+
tags?: NotificationFilter['tags'];
|
|
107
|
+
data?: Record<string, unknown>;
|
|
108
|
+
}): Result<void>;
|
|
109
|
+
seenAll(args?: {
|
|
110
|
+
notificationIds: string[];
|
|
111
|
+
} | {
|
|
112
|
+
tags?: NotificationFilter['tags'];
|
|
113
|
+
data?: Record<string, unknown>;
|
|
114
|
+
} | {}): Result<void>;
|
|
115
|
+
archiveAll({ tags, data, }?: {
|
|
116
|
+
tags?: NotificationFilter['tags'];
|
|
117
|
+
data?: Record<string, unknown>;
|
|
118
|
+
}): Result<void>;
|
|
119
|
+
archiveAllRead({ tags, data }?: {
|
|
120
|
+
tags?: string[];
|
|
121
|
+
data?: Record<string, unknown>;
|
|
122
|
+
}): Result<void>;
|
|
123
|
+
deleteAll({ tags, data, }?: {
|
|
124
|
+
tags?: NotificationFilter['tags'];
|
|
125
|
+
data?: Record<string, unknown>;
|
|
126
|
+
}): Result<void>;
|
|
127
|
+
clearCache({ filter }?: {
|
|
128
|
+
filter?: NotificationFilter;
|
|
129
|
+
}): void;
|
|
130
|
+
triggerHelloWorldEvent(): Promise<any>;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
interface BaseSocketInterface {
|
|
134
|
+
isSocketEvent(eventName: string): eventName is SocketEventNames;
|
|
135
|
+
connect(): Result<void>;
|
|
136
|
+
disconnect(): Result<void>;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
declare class Novu implements Pick<NovuEventEmitter, 'on'> {
|
|
140
|
+
#private;
|
|
141
|
+
readonly notifications: Notifications;
|
|
142
|
+
readonly preferences: Preferences;
|
|
143
|
+
readonly socket: BaseSocketInterface;
|
|
144
|
+
on: <Key extends EventNames>(eventName: Key, listener: EventHandler<Events[Key]>) => () => void;
|
|
145
|
+
/**
|
|
146
|
+
* @deprecated
|
|
147
|
+
* Use the cleanup function returned by the "on" method instead.
|
|
148
|
+
*/
|
|
149
|
+
off: <Key extends EventNames>(eventName: Key, listener: EventHandler<Events[Key]>) => void;
|
|
150
|
+
get applicationIdentifier(): string | undefined;
|
|
151
|
+
get subscriberId(): string | undefined;
|
|
152
|
+
get context(): Partial<Record<string, ContextValue>> | undefined;
|
|
153
|
+
get contextKey(): string;
|
|
154
|
+
constructor(options: NovuOptions);
|
|
155
|
+
changeSubscriber(options: {
|
|
156
|
+
subscriber: Subscriber;
|
|
157
|
+
subscriberHash?: string;
|
|
158
|
+
}): Promise<void>;
|
|
159
|
+
changeContext(options: {
|
|
160
|
+
context: Context;
|
|
161
|
+
contextHash?: string;
|
|
162
|
+
}): Promise<void>;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export { Novu as N };
|