@novu/js 3.8.1 → 3.9.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-JOKRZMGH.js → chunk-TAYTG4H3.js} +77 -23
- package/dist/cjs/index.d.ts +6 -5
- package/dist/cjs/index.js +18 -10
- package/dist/cjs/internal/index.d.ts +1 -1
- package/dist/{esm/novu-CktM1OXQ.d.mts → cjs/novu-_TLnMLv6.d.ts} +14 -4
- package/dist/cjs/themes/index.d.ts +3 -3
- package/dist/cjs/themes/index.js +10 -0
- package/dist/{esm/types-CiFWY1AG.d.mts → cjs/types-DfB6oB2v.d.ts} +16 -1
- package/dist/cjs/types-DhzxFu7R.d.ts +443 -0
- package/dist/cjs/ui/index.d.ts +13 -4
- package/dist/cjs/ui/index.js +1314 -365
- package/dist/esm/{chunk-HL3WZM2B.mjs → chunk-SH2NZJC6.mjs} +76 -24
- package/dist/esm/index.d.mts +6 -5
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/index.d.mts +1 -1
- package/dist/{cjs/novu-D6fucMvr.d.ts → esm/novu-uWXW2_yT.d.mts} +14 -4
- package/dist/esm/themes/index.d.mts +3 -3
- package/dist/esm/themes/index.mjs +10 -0
- package/dist/{cjs/types-CiFWY1AG.d.ts → esm/types-DfB6oB2v.d.mts} +16 -1
- package/dist/esm/types-KJGvXLvJ.d.mts +443 -0
- package/dist/esm/ui/index.d.mts +13 -4
- package/dist/esm/ui/index.mjs +1307 -358
- package/dist/index.css +1 -1
- package/dist/novu.min.js +12 -12
- package/dist/novu.min.js.gz +0 -0
- package/package.json +1 -1
- package/dist/cjs/types-B3PJouaR.d.ts +0 -143
- package/dist/esm/types-C8yNgqZQ.d.mts +0 -143
|
@@ -40,6 +40,13 @@ var WebSocketEvent = /* @__PURE__ */ ((WebSocketEvent2) => {
|
|
|
40
40
|
WebSocketEvent2["UNSEEN"] = "unseen_count_changed";
|
|
41
41
|
return WebSocketEvent2;
|
|
42
42
|
})(WebSocketEvent || {});
|
|
43
|
+
var SeverityLevelEnum = /* @__PURE__ */ ((SeverityLevelEnum2) => {
|
|
44
|
+
SeverityLevelEnum2["HIGH"] = "high";
|
|
45
|
+
SeverityLevelEnum2["MEDIUM"] = "medium";
|
|
46
|
+
SeverityLevelEnum2["LOW"] = "low";
|
|
47
|
+
SeverityLevelEnum2["NONE"] = "none";
|
|
48
|
+
return SeverityLevelEnum2;
|
|
49
|
+
})(SeverityLevelEnum || {});
|
|
43
50
|
|
|
44
51
|
// src/utils/arrays.ts
|
|
45
52
|
var arrayValuesEqual = (arr1, arr2) => {
|
|
@@ -57,6 +64,11 @@ var arrayValuesEqual = (arr1, arr2) => {
|
|
|
57
64
|
var areTagsEqual = (tags1, tags2) => {
|
|
58
65
|
return arrayValuesEqual(tags1, tags2) || !tags1 && (tags2 == null ? void 0 : tags2.length) === 0 || (tags1 == null ? void 0 : tags1.length) === 0 && !tags2;
|
|
59
66
|
};
|
|
67
|
+
var areSeveritiesEqual = (el1, el2) => {
|
|
68
|
+
const severity1 = Array.isArray(el1) ? el1 : el1 ? [el1] : [];
|
|
69
|
+
const severity2 = Array.isArray(el2) ? el2 : el2 ? [el2] : [];
|
|
70
|
+
return arrayValuesEqual(severity1, severity2);
|
|
71
|
+
};
|
|
60
72
|
var areDataEqual = (data1, data2) => {
|
|
61
73
|
if (!data1 && !data2) {
|
|
62
74
|
return true;
|
|
@@ -71,7 +83,7 @@ var areDataEqual = (data1, data2) => {
|
|
|
71
83
|
}
|
|
72
84
|
};
|
|
73
85
|
var isSameFilter = (filter1, filter2) => {
|
|
74
|
-
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;
|
|
86
|
+
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);
|
|
75
87
|
};
|
|
76
88
|
function checkNotificationDataFilter(notificationData, filterData) {
|
|
77
89
|
if (!filterData || Object.keys(filterData).length === 0) {
|
|
@@ -129,7 +141,7 @@ function checkNotificationMatchesFilter(notification, filter) {
|
|
|
129
141
|
|
|
130
142
|
// src/api/http-client.ts
|
|
131
143
|
var DEFAULT_API_VERSION = "v1";
|
|
132
|
-
var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.
|
|
144
|
+
var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.9.1"}`;
|
|
133
145
|
var HttpClient = class {
|
|
134
146
|
constructor(options = {}) {
|
|
135
147
|
// Environment variable for local development that overrides the default API endpoint without affecting the Inbox DX
|
|
@@ -279,7 +291,8 @@ var InboxService = class {
|
|
|
279
291
|
tags,
|
|
280
292
|
snoozed,
|
|
281
293
|
seen: seen2,
|
|
282
|
-
data
|
|
294
|
+
data,
|
|
295
|
+
severity
|
|
283
296
|
}) {
|
|
284
297
|
const searchParams = new URLSearchParams(`limit=${limit}`);
|
|
285
298
|
if (after) {
|
|
@@ -289,7 +302,9 @@ var InboxService = class {
|
|
|
289
302
|
searchParams.append("offset", `${offset}`);
|
|
290
303
|
}
|
|
291
304
|
if (tags) {
|
|
292
|
-
|
|
305
|
+
for (const tag of tags) {
|
|
306
|
+
searchParams.append("tags[]", tag);
|
|
307
|
+
}
|
|
293
308
|
}
|
|
294
309
|
if (read2 !== void 0) {
|
|
295
310
|
searchParams.append("read", `${read2}`);
|
|
@@ -306,6 +321,13 @@ var InboxService = class {
|
|
|
306
321
|
if (data !== void 0) {
|
|
307
322
|
searchParams.append("data", JSON.stringify(data));
|
|
308
323
|
}
|
|
324
|
+
if (severity && Array.isArray(severity)) {
|
|
325
|
+
for (const el of severity) {
|
|
326
|
+
searchParams.append("severity[]", el);
|
|
327
|
+
}
|
|
328
|
+
} else if (severity) {
|
|
329
|
+
searchParams.append("severity", severity);
|
|
330
|
+
}
|
|
309
331
|
return chunk7B52C2XE_js.__privateGet(this, _httpClient).get(INBOX_NOTIFICATIONS_ROUTE, searchParams, false);
|
|
310
332
|
}
|
|
311
333
|
count({
|
|
@@ -385,10 +407,19 @@ var InboxService = class {
|
|
|
385
407
|
actionType
|
|
386
408
|
});
|
|
387
409
|
}
|
|
388
|
-
fetchPreferences(tags) {
|
|
410
|
+
fetchPreferences(tags, severity) {
|
|
389
411
|
const queryParams = new URLSearchParams();
|
|
390
412
|
if (tags) {
|
|
391
|
-
|
|
413
|
+
for (const tag of tags) {
|
|
414
|
+
queryParams.append("tags[]", tag);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
if (severity && Array.isArray(severity)) {
|
|
418
|
+
for (const el of severity) {
|
|
419
|
+
queryParams.append("severity[]", el);
|
|
420
|
+
}
|
|
421
|
+
} else if (severity) {
|
|
422
|
+
queryParams.append("severity", severity);
|
|
392
423
|
}
|
|
393
424
|
const query = queryParams.size ? `?${queryParams.toString()}` : "";
|
|
394
425
|
return chunk7B52C2XE_js.__privateGet(this, _httpClient).get(`${INBOX_ROUTE}/preferences${query}`);
|
|
@@ -909,6 +940,7 @@ var Notification = class {
|
|
|
909
940
|
this.redirect = notification.redirect;
|
|
910
941
|
this.data = notification.data;
|
|
911
942
|
this.workflow = notification.workflow;
|
|
943
|
+
this.severity = notification.severity;
|
|
912
944
|
}
|
|
913
945
|
read() {
|
|
914
946
|
return read({
|
|
@@ -1124,7 +1156,18 @@ var InMemoryCache = class {
|
|
|
1124
1156
|
_cache = new WeakMap();
|
|
1125
1157
|
|
|
1126
1158
|
// src/cache/notifications-cache.ts
|
|
1127
|
-
var excludeEmpty = ({
|
|
1159
|
+
var excludeEmpty = ({
|
|
1160
|
+
tags,
|
|
1161
|
+
data,
|
|
1162
|
+
read: read2,
|
|
1163
|
+
archived,
|
|
1164
|
+
snoozed,
|
|
1165
|
+
seen: seen2,
|
|
1166
|
+
severity,
|
|
1167
|
+
limit,
|
|
1168
|
+
offset,
|
|
1169
|
+
after
|
|
1170
|
+
}) => 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]) => {
|
|
1128
1171
|
acc[key] = value;
|
|
1129
1172
|
return acc;
|
|
1130
1173
|
}, {});
|
|
@@ -1135,11 +1178,12 @@ var getCacheKey = ({
|
|
|
1135
1178
|
archived,
|
|
1136
1179
|
snoozed,
|
|
1137
1180
|
seen: seen2,
|
|
1181
|
+
severity,
|
|
1138
1182
|
limit,
|
|
1139
1183
|
offset,
|
|
1140
1184
|
after
|
|
1141
1185
|
}) => {
|
|
1142
|
-
return JSON.stringify(excludeEmpty({ tags, data, read: read2, archived, snoozed, seen: seen2, limit, offset, after }));
|
|
1186
|
+
return JSON.stringify(excludeEmpty({ tags, data, read: read2, archived, snoozed, seen: seen2, severity, limit, offset, after }));
|
|
1143
1187
|
};
|
|
1144
1188
|
var getFilterKey = ({
|
|
1145
1189
|
tags,
|
|
@@ -1147,9 +1191,10 @@ var getFilterKey = ({
|
|
|
1147
1191
|
read: read2,
|
|
1148
1192
|
archived,
|
|
1149
1193
|
snoozed,
|
|
1150
|
-
seen: seen2
|
|
1194
|
+
seen: seen2,
|
|
1195
|
+
severity
|
|
1151
1196
|
}) => {
|
|
1152
|
-
return JSON.stringify(excludeEmpty({ tags, data, read: read2, archived, snoozed, seen: seen2 }));
|
|
1197
|
+
return JSON.stringify(excludeEmpty({ tags, data, read: read2, archived, snoozed, seen: seen2, severity }));
|
|
1153
1198
|
};
|
|
1154
1199
|
var getFilter = (key) => {
|
|
1155
1200
|
return JSON.parse(key);
|
|
@@ -1287,7 +1332,8 @@ var NotificationsCache = class {
|
|
|
1287
1332
|
read: args.read,
|
|
1288
1333
|
snoozed: args.snoozed,
|
|
1289
1334
|
archived: args.archived,
|
|
1290
|
-
seen: args.seen
|
|
1335
|
+
seen: args.seen,
|
|
1336
|
+
severity: args.severity
|
|
1291
1337
|
});
|
|
1292
1338
|
}
|
|
1293
1339
|
}
|
|
@@ -1309,7 +1355,9 @@ var NotificationsCache = class {
|
|
|
1309
1355
|
if (!value) {
|
|
1310
1356
|
return;
|
|
1311
1357
|
}
|
|
1312
|
-
value.notifications.filter((el) => typeof read2 === "undefined" || read2 === el.isRead).forEach((notification) =>
|
|
1358
|
+
value.notifications.filter((el) => typeof read2 === "undefined" || read2 === el.isRead).forEach((notification) => {
|
|
1359
|
+
uniqueNotifications.set(notification.id, notification);
|
|
1360
|
+
});
|
|
1313
1361
|
}
|
|
1314
1362
|
});
|
|
1315
1363
|
return Array.from(uniqueNotifications.values());
|
|
@@ -1645,15 +1693,15 @@ var updateEvents2 = [
|
|
|
1645
1693
|
"preferences.bulk_update.pending",
|
|
1646
1694
|
"preferences.bulk_update.resolved"
|
|
1647
1695
|
];
|
|
1648
|
-
var excludeEmpty2 = ({ tags }) => Object.entries({ tags }).reduce((acc, [key, value]) => {
|
|
1696
|
+
var excludeEmpty2 = ({ tags, severity }) => Object.entries({ tags, severity }).reduce((acc, [key, value]) => {
|
|
1649
1697
|
if (value === null || value === void 0 || Array.isArray(value) && value.length === 0) {
|
|
1650
1698
|
return acc;
|
|
1651
1699
|
}
|
|
1652
1700
|
acc[key] = value;
|
|
1653
1701
|
return acc;
|
|
1654
1702
|
}, {});
|
|
1655
|
-
var getCacheKey2 = ({ tags }) => {
|
|
1656
|
-
return JSON.stringify(excludeEmpty2({ tags }));
|
|
1703
|
+
var getCacheKey2 = ({ tags, severity }) => {
|
|
1704
|
+
return JSON.stringify(excludeEmpty2({ tags, severity }));
|
|
1657
1705
|
};
|
|
1658
1706
|
var _emitter3, _cache3;
|
|
1659
1707
|
var PreferencesCache = class {
|
|
@@ -1931,7 +1979,7 @@ var Preferences = class extends BaseModule {
|
|
|
1931
1979
|
let data = chunk7B52C2XE_js.__privateGet(this, _useCache3) ? this.cache.getAll(args) : void 0;
|
|
1932
1980
|
this._emitter.emit("preferences.list.pending", { args, data });
|
|
1933
1981
|
if (!data) {
|
|
1934
|
-
const response = yield this._inboxService.fetchPreferences(args.tags);
|
|
1982
|
+
const response = yield this._inboxService.fetchPreferences(args.tags, args.severity);
|
|
1935
1983
|
data = response.map(
|
|
1936
1984
|
(el) => new Preference(el, {
|
|
1937
1985
|
emitterInstance: this._emitter,
|
|
@@ -2102,7 +2150,8 @@ var mapToNotification = ({
|
|
|
2102
2150
|
cta,
|
|
2103
2151
|
tags,
|
|
2104
2152
|
data,
|
|
2105
|
-
workflow
|
|
2153
|
+
workflow,
|
|
2154
|
+
severity
|
|
2106
2155
|
}) => {
|
|
2107
2156
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2108
2157
|
const to = {
|
|
@@ -2164,7 +2213,8 @@ var mapToNotification = ({
|
|
|
2164
2213
|
target: cta.data.target
|
|
2165
2214
|
} : void 0,
|
|
2166
2215
|
data,
|
|
2167
|
-
workflow
|
|
2216
|
+
workflow,
|
|
2217
|
+
severity
|
|
2168
2218
|
});
|
|
2169
2219
|
};
|
|
2170
2220
|
var _token, _emitter6, _partySocket, _socketUrl, _notificationReceived, _unseenCountChanged, _unreadCountChanged, _handleMessage, _PartySocketClient_instances, initializeSocket_fn, handleConnectSocket_fn, handleDisconnectSocket_fn;
|
|
@@ -2211,7 +2261,7 @@ var PartySocketClient = class extends BaseModule {
|
|
|
2211
2261
|
const data = JSON.parse(event.data);
|
|
2212
2262
|
if (data.event === "unread_count_changed" /* UNREAD */) {
|
|
2213
2263
|
chunk7B52C2XE_js.__privateGet(this, _emitter6).emit(UNREAD_COUNT_CHANGED, {
|
|
2214
|
-
result: data.data.
|
|
2264
|
+
result: data.data.counts
|
|
2215
2265
|
});
|
|
2216
2266
|
}
|
|
2217
2267
|
} catch (error) {
|
|
@@ -2335,7 +2385,8 @@ var mapToNotification2 = ({
|
|
|
2335
2385
|
cta,
|
|
2336
2386
|
tags,
|
|
2337
2387
|
data,
|
|
2338
|
-
workflow
|
|
2388
|
+
workflow,
|
|
2389
|
+
severity
|
|
2339
2390
|
}) => {
|
|
2340
2391
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2341
2392
|
const to = {
|
|
@@ -2397,7 +2448,8 @@ var mapToNotification2 = ({
|
|
|
2397
2448
|
target: cta.data.target
|
|
2398
2449
|
} : void 0,
|
|
2399
2450
|
data,
|
|
2400
|
-
workflow
|
|
2451
|
+
workflow,
|
|
2452
|
+
severity
|
|
2401
2453
|
});
|
|
2402
2454
|
};
|
|
2403
2455
|
var _token2, _emitter7, _socketIo, _socketUrl2, _notificationReceived2, _unseenCountChanged2, _unreadCountChanged2, _Socket_instances, initializeSocket_fn2, handleConnectSocket_fn2, handleDisconnectSocket_fn2;
|
|
@@ -2426,9 +2478,9 @@ var Socket = class extends BaseModule {
|
|
|
2426
2478
|
result: unseenCount
|
|
2427
2479
|
});
|
|
2428
2480
|
});
|
|
2429
|
-
chunk7B52C2XE_js.__privateAdd(this, _unreadCountChanged2, ({
|
|
2481
|
+
chunk7B52C2XE_js.__privateAdd(this, _unreadCountChanged2, ({ counts }) => {
|
|
2430
2482
|
chunk7B52C2XE_js.__privateGet(this, _emitter7).emit(UNREAD_COUNT_CHANGED2, {
|
|
2431
|
-
result:
|
|
2483
|
+
result: counts
|
|
2432
2484
|
});
|
|
2433
2485
|
});
|
|
2434
2486
|
chunk7B52C2XE_js.__privateSet(this, _emitter7, eventEmitterInstance);
|
|
@@ -2633,7 +2685,9 @@ exports.DEFAULT_API_VERSION = DEFAULT_API_VERSION;
|
|
|
2633
2685
|
exports.NotificationStatus = NotificationStatus;
|
|
2634
2686
|
exports.Novu = Novu;
|
|
2635
2687
|
exports.PreferenceLevel = PreferenceLevel;
|
|
2688
|
+
exports.SeverityLevelEnum = SeverityLevelEnum;
|
|
2636
2689
|
exports.WebSocketEvent = WebSocketEvent;
|
|
2690
|
+
exports.areSeveritiesEqual = areSeveritiesEqual;
|
|
2637
2691
|
exports.areTagsEqual = areTagsEqual;
|
|
2638
2692
|
exports.checkNotificationDataFilter = checkNotificationDataFilter;
|
|
2639
2693
|
exports.checkNotificationMatchesFilter = checkNotificationMatchesFilter;
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { N as Notification } from './novu-
|
|
2
|
-
export { E as EventHandler, a as Events, F as FiltersCountResponse, L as ListNotificationsResponse, b as Novu, P as Preference, S as SocketEventNames } from './novu-
|
|
3
|
-
import { N as NotificationFilter } from './types-
|
|
4
|
-
export { C as ChannelPreference, a as ChannelType, I as InboxNotification, b as NotificationStatus, c as NovuError, d as NovuOptions, P as PreferenceLevel, e as PreferencesResponse,
|
|
1
|
+
import { N as Notification } from './novu-_TLnMLv6.js';
|
|
2
|
+
export { E as EventHandler, a as Events, F as FiltersCountResponse, L as ListNotificationsResponse, b as Novu, P as Preference, S as SocketEventNames } from './novu-_TLnMLv6.js';
|
|
3
|
+
import { S as SeverityLevelEnum, N as NotificationFilter } from './types-DfB6oB2v.js';
|
|
4
|
+
export { C as ChannelPreference, a as ChannelType, I as InboxNotification, b as NotificationStatus, c as NovuError, d as NovuOptions, P as PreferenceLevel, e as PreferencesResponse, f as StandardNovuOptions, g as Subscriber, U as UnreadCount, W as WebSocketEvent } from './types-DfB6oB2v.js';
|
|
5
5
|
|
|
6
6
|
declare const areTagsEqual: (tags1?: string[], tags2?: string[]) => boolean;
|
|
7
|
+
declare const areSeveritiesEqual: (el1?: SeverityLevelEnum | SeverityLevelEnum[], el2?: SeverityLevelEnum | SeverityLevelEnum[]) => boolean;
|
|
7
8
|
declare const isSameFilter: (filter1: NotificationFilter, filter2: NotificationFilter) => boolean;
|
|
8
9
|
declare function checkNotificationDataFilter(notificationData: Notification['data'], filterData: NotificationFilter['data']): boolean;
|
|
9
10
|
/**
|
|
@@ -12,4 +13,4 @@ declare function checkNotificationDataFilter(notificationData: Notification['dat
|
|
|
12
13
|
*/
|
|
13
14
|
declare function checkNotificationMatchesFilter(notification: Notification, filter: NotificationFilter): boolean;
|
|
14
15
|
|
|
15
|
-
export { Notification, NotificationFilter, areTagsEqual, checkNotificationDataFilter, checkNotificationMatchesFilter, isSameFilter };
|
|
16
|
+
export { Notification, NotificationFilter, SeverityLevelEnum, areSeveritiesEqual, areTagsEqual, checkNotificationDataFilter, checkNotificationMatchesFilter, isSameFilter };
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkTAYTG4H3_js = require('./chunk-TAYTG4H3.js');
|
|
4
4
|
require('./chunk-ZB7IPCHY.js');
|
|
5
5
|
require('./chunk-7B52C2XE.js');
|
|
6
6
|
|
|
@@ -8,37 +8,45 @@ require('./chunk-7B52C2XE.js');
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "ChannelType", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkTAYTG4H3_js.ChannelType; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "NotificationStatus", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkTAYTG4H3_js.NotificationStatus; }
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "Novu", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkTAYTG4H3_js.Novu; }
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(exports, "PreferenceLevel", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkTAYTG4H3_js.PreferenceLevel; }
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "SeverityLevelEnum", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () { return chunkTAYTG4H3_js.SeverityLevelEnum; }
|
|
24
28
|
});
|
|
25
29
|
Object.defineProperty(exports, "WebSocketEvent", {
|
|
26
30
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkTAYTG4H3_js.WebSocketEvent; }
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports, "areSeveritiesEqual", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () { return chunkTAYTG4H3_js.areSeveritiesEqual; }
|
|
28
36
|
});
|
|
29
37
|
Object.defineProperty(exports, "areTagsEqual", {
|
|
30
38
|
enumerable: true,
|
|
31
|
-
get: function () { return
|
|
39
|
+
get: function () { return chunkTAYTG4H3_js.areTagsEqual; }
|
|
32
40
|
});
|
|
33
41
|
Object.defineProperty(exports, "checkNotificationDataFilter", {
|
|
34
42
|
enumerable: true,
|
|
35
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunkTAYTG4H3_js.checkNotificationDataFilter; }
|
|
36
44
|
});
|
|
37
45
|
Object.defineProperty(exports, "checkNotificationMatchesFilter", {
|
|
38
46
|
enumerable: true,
|
|
39
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkTAYTG4H3_js.checkNotificationMatchesFilter; }
|
|
40
48
|
});
|
|
41
49
|
Object.defineProperty(exports, "isSameFilter", {
|
|
42
50
|
enumerable: true,
|
|
43
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunkTAYTG4H3_js.isSameFilter; }
|
|
44
52
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ChannelPreference, P as PreferenceLevel,
|
|
1
|
+
import { S as SeverityLevelEnum, C as ChannelPreference, P as PreferenceLevel, h as Workflow, i as Prettify, R as Result, g as Subscriber, j as Session, I as InboxNotification, N as NotificationFilter, A as ActionTypeEnum, e as PreferencesResponse, W as WebSocketEvent, d as NovuOptions } from './types-DfB6oB2v.js';
|
|
2
2
|
|
|
3
3
|
type HttpClientOptions = {
|
|
4
4
|
apiVersion?: string;
|
|
@@ -9,6 +9,7 @@ type HttpClientOptions = {
|
|
|
9
9
|
|
|
10
10
|
type ListPreferencesArgs = {
|
|
11
11
|
tags?: string[];
|
|
12
|
+
severity?: SeverityLevelEnum | SeverityLevelEnum[];
|
|
12
13
|
};
|
|
13
14
|
type BasePreferenceArgs = {
|
|
14
15
|
workflowId: string;
|
|
@@ -62,7 +63,7 @@ declare class InboxService {
|
|
|
62
63
|
subscriberHash?: string;
|
|
63
64
|
subscriber?: Subscriber;
|
|
64
65
|
}): Promise<Session>;
|
|
65
|
-
fetchNotifications({ after, archived, limit, offset, read, tags, snoozed, seen, data, }: {
|
|
66
|
+
fetchNotifications({ after, archived, limit, offset, read, tags, snoozed, seen, data, severity, }: {
|
|
66
67
|
tags?: string[];
|
|
67
68
|
read?: boolean;
|
|
68
69
|
archived?: boolean;
|
|
@@ -72,6 +73,7 @@ declare class InboxService {
|
|
|
72
73
|
after?: string;
|
|
73
74
|
offset?: number;
|
|
74
75
|
data?: Record<string, unknown>;
|
|
76
|
+
severity?: SeverityLevelEnum | SeverityLevelEnum[];
|
|
75
77
|
}): Promise<{
|
|
76
78
|
data: InboxNotification[];
|
|
77
79
|
hasMore: boolean;
|
|
@@ -85,6 +87,7 @@ declare class InboxService {
|
|
|
85
87
|
snoozed?: boolean;
|
|
86
88
|
seen?: boolean;
|
|
87
89
|
data?: Record<string, unknown>;
|
|
90
|
+
severity?: SeverityLevelEnum | SeverityLevelEnum[];
|
|
88
91
|
}>;
|
|
89
92
|
}): Promise<{
|
|
90
93
|
data: Array<{
|
|
@@ -124,7 +127,7 @@ declare class InboxService {
|
|
|
124
127
|
notificationId: string;
|
|
125
128
|
actionType: ActionTypeEnum;
|
|
126
129
|
}): Promise<InboxNotification>;
|
|
127
|
-
fetchPreferences(tags?: string[]): Promise<PreferencesResponse[]>;
|
|
130
|
+
fetchPreferences(tags?: string[], severity?: SeverityLevelEnum | SeverityLevelEnum[]): Promise<PreferencesResponse[]>;
|
|
128
131
|
bulkUpdatePreferences(preferences: Array<{
|
|
129
132
|
workflowId: string;
|
|
130
133
|
} & ChannelPreference>): Promise<PreferencesResponse[]>;
|
|
@@ -161,6 +164,7 @@ declare class Notification implements Pick<NovuEventEmitter, 'on'>, InboxNotific
|
|
|
161
164
|
readonly redirect: InboxNotification['redirect'];
|
|
162
165
|
readonly data?: InboxNotification['data'];
|
|
163
166
|
readonly workflow?: InboxNotification['workflow'];
|
|
167
|
+
readonly severity: InboxNotification['severity'];
|
|
164
168
|
constructor(notification: InboxNotification, emitter: NovuEventEmitter, inboxService: InboxService);
|
|
165
169
|
read(): Result<Notification>;
|
|
166
170
|
unread(): Result<Notification>;
|
|
@@ -223,6 +227,7 @@ type ListNotificationsArgs = {
|
|
|
223
227
|
archived?: boolean;
|
|
224
228
|
snoozed?: boolean;
|
|
225
229
|
seen?: boolean;
|
|
230
|
+
severity?: SeverityLevelEnum | SeverityLevelEnum[];
|
|
226
231
|
limit?: number;
|
|
227
232
|
after?: string;
|
|
228
233
|
offset?: number;
|
|
@@ -240,6 +245,7 @@ type FilterCountArgs = {
|
|
|
240
245
|
archived?: boolean;
|
|
241
246
|
snoozed?: boolean;
|
|
242
247
|
seen?: boolean;
|
|
248
|
+
severity?: SeverityLevelEnum | SeverityLevelEnum[];
|
|
243
249
|
};
|
|
244
250
|
type FiltersCountArgs = {
|
|
245
251
|
filters: Array<{
|
|
@@ -249,6 +255,7 @@ type FiltersCountArgs = {
|
|
|
249
255
|
snoozed?: boolean;
|
|
250
256
|
seen?: boolean;
|
|
251
257
|
data?: Record<string, unknown>;
|
|
258
|
+
severity?: SeverityLevelEnum | SeverityLevelEnum[];
|
|
252
259
|
}>;
|
|
253
260
|
};
|
|
254
261
|
type CountArgs = undefined | FilterCountArgs | FiltersCountArgs;
|
|
@@ -409,7 +416,10 @@ type SocketEvents = {
|
|
|
409
416
|
};
|
|
410
417
|
} & {
|
|
411
418
|
[key in NotificationUnreadEvent]: {
|
|
412
|
-
result:
|
|
419
|
+
result: {
|
|
420
|
+
total: number;
|
|
421
|
+
severity: Record<string, number>;
|
|
422
|
+
};
|
|
413
423
|
};
|
|
414
424
|
};
|
|
415
425
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import '../novu-
|
|
3
|
-
import '../types-
|
|
1
|
+
import { q as Theme } from '../types-DhzxFu7R.js';
|
|
2
|
+
import '../novu-_TLnMLv6.js';
|
|
3
|
+
import '../types-DfB6oB2v.js';
|
|
4
4
|
|
|
5
5
|
declare const dark: Theme;
|
|
6
6
|
|
package/dist/cjs/themes/index.js
CHANGED
|
@@ -13,6 +13,16 @@ var dark = {
|
|
|
13
13
|
colorShadow: "black",
|
|
14
14
|
colorRing: "#E1E4EA",
|
|
15
15
|
colorStripes: "#FF8447"
|
|
16
|
+
},
|
|
17
|
+
elements: {
|
|
18
|
+
severityHigh__bellContainer: "[--bell-gradient-start:var(--nv-color-severity-high)] [--bell-gradient-end:oklch(from_var(--nv-color-severity-high)_80%_c_h)]",
|
|
19
|
+
severityMedium__bellContainer: "[--bell-gradient-start:var(--nv-color-severity-medium)] [--bell-gradient-end:oklch(from_var(--nv-color-severity-medium)_80%_c_h)]",
|
|
20
|
+
severityLow__bellContainer: "[--bell-gradient-start:var(--nv-color-severity-low)] [--bell-gradient-end:oklch(from_var(--nv-color-severity-low)_80%_c_h)]",
|
|
21
|
+
bellContainer: "[--bell-gradient-start:var(--nv-color-foreground)] [--bell-gradient-end:oklch(from_var(--nv-color-foreground)_80%_c_h)]",
|
|
22
|
+
severityGlowHigh__bellSeverityGlow: "nt-bg-severity-high-alpha-300 before:nt-bg-severity-high-alpha-300",
|
|
23
|
+
severityGlowMedium__bellSeverityGlow: "nt-bg-severity-medium-alpha-300 before:nt-bg-severity-medium-alpha-300",
|
|
24
|
+
severityGlowLow__bellSeverityGlow: "nt-bg-severity-low-alpha-300 before:nt-bg-severity-low-alpha-300",
|
|
25
|
+
bellSeverityGlow: "nt-bg-severity-none-alpha-300 before:nt-bg-severity-none-alpha-300"
|
|
16
26
|
}
|
|
17
27
|
};
|
|
18
28
|
|
|
@@ -37,9 +37,21 @@ declare enum WebSocketEvent {
|
|
|
37
37
|
UNREAD = "unread_count_changed",
|
|
38
38
|
UNSEEN = "unseen_count_changed"
|
|
39
39
|
}
|
|
40
|
+
declare enum SeverityLevelEnum {
|
|
41
|
+
HIGH = "high",
|
|
42
|
+
MEDIUM = "medium",
|
|
43
|
+
LOW = "low",
|
|
44
|
+
NONE = "none"
|
|
45
|
+
}
|
|
46
|
+
type UnreadCount = {
|
|
47
|
+
total: number;
|
|
48
|
+
severity: Record<SeverityLevelEnum, number>;
|
|
49
|
+
};
|
|
40
50
|
type Session = {
|
|
41
51
|
token: string;
|
|
52
|
+
/** @deprecated Use unreadCount.total instead */
|
|
42
53
|
totalUnreadCount: number;
|
|
54
|
+
unreadCount: UnreadCount;
|
|
43
55
|
removeNovuBranding: boolean;
|
|
44
56
|
isDevelopmentMode: boolean;
|
|
45
57
|
maxSnoozeDurationHours: number;
|
|
@@ -76,6 +88,7 @@ type Workflow = {
|
|
|
76
88
|
name: string;
|
|
77
89
|
critical: boolean;
|
|
78
90
|
tags?: string[];
|
|
91
|
+
severity: SeverityLevelEnum;
|
|
79
92
|
};
|
|
80
93
|
type InboxNotification = {
|
|
81
94
|
id: string;
|
|
@@ -101,6 +114,7 @@ type InboxNotification = {
|
|
|
101
114
|
data?: NotificationData;
|
|
102
115
|
redirect?: Redirect;
|
|
103
116
|
workflow?: Workflow;
|
|
117
|
+
severity: SeverityLevelEnum;
|
|
104
118
|
};
|
|
105
119
|
type NotificationFilter = {
|
|
106
120
|
tags?: string[];
|
|
@@ -109,6 +123,7 @@ type NotificationFilter = {
|
|
|
109
123
|
snoozed?: boolean;
|
|
110
124
|
seen?: boolean;
|
|
111
125
|
data?: Record<string, unknown>;
|
|
126
|
+
severity?: SeverityLevelEnum | SeverityLevelEnum[];
|
|
112
127
|
};
|
|
113
128
|
type ChannelPreference = {
|
|
114
129
|
email?: boolean;
|
|
@@ -163,4 +178,4 @@ type Prettify<T> = {
|
|
|
163
178
|
[K in keyof T]: T[K];
|
|
164
179
|
} & {};
|
|
165
180
|
|
|
166
|
-
export { ActionTypeEnum as A, type ChannelPreference as C, type InboxNotification as I, type NotificationFilter as N, PreferenceLevel as P, type Result as R, type
|
|
181
|
+
export { ActionTypeEnum as A, type ChannelPreference as C, type InboxNotification as I, type NotificationFilter as N, PreferenceLevel as P, type Result as R, SeverityLevelEnum as S, type UnreadCount as U, WebSocketEvent as W, ChannelType as a, NotificationStatus as b, NovuError as c, type NovuOptions as d, type PreferencesResponse as e, type StandardNovuOptions as f, type Subscriber as g, type Workflow as h, type Prettify as i, type Session as j };
|