@novu/js 3.8.1 → 3.9.2
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-VEX66SK3.js} +98 -24
- package/dist/cjs/index.d.ts +6 -5
- package/dist/cjs/index.js +22 -10
- package/dist/cjs/internal/index.d.ts +1 -1
- package/dist/{esm/novu-CktM1OXQ.d.mts → cjs/novu-Db46nHZP.d.ts} +19 -4
- package/dist/cjs/themes/index.d.ts +3 -3
- package/dist/cjs/themes/index.js +10 -0
- package/dist/cjs/types-B-VuVpSW.d.ts +445 -0
- package/dist/{esm/types-CiFWY1AG.d.mts → cjs/types-CbmZeAf8.d.ts} +21 -1
- package/dist/cjs/ui/index.d.ts +13 -4
- package/dist/cjs/ui/index.js +1322 -368
- package/dist/esm/{chunk-HL3WZM2B.mjs → chunk-3CKXF2I4.mjs} +96 -25
- 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-BOlS1PMv.d.mts} +19 -4
- package/dist/esm/themes/index.d.mts +3 -3
- package/dist/esm/themes/index.mjs +10 -0
- package/dist/esm/types-C9c_ID-G.d.mts +445 -0
- package/dist/{cjs/types-CiFWY1AG.d.ts → esm/types-CbmZeAf8.d.mts} +21 -1
- package/dist/esm/ui/index.d.mts +13 -4
- package/dist/esm/ui/index.mjs +1315 -361
- package/dist/index.css +1 -1
- package/dist/novu.min.js +12 -12
- package/dist/novu.min.js.gz +0 -0
- package/internal/package.json +2 -2
- package/package.json +2 -1
- package/themes/package.json +1 -1
- package/ui/package.json +1 -1
- package/dist/cjs/types-B3PJouaR.d.ts +0 -143
- package/dist/esm/types-C8yNgqZQ.d.mts +0 -143
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var chunkZB7IPCHY_js = require('./chunk-ZB7IPCHY.js');
|
|
4
4
|
var chunk7B52C2XE_js = require('./chunk-7B52C2XE.js');
|
|
5
5
|
var mitt = require('mitt');
|
|
6
|
+
require('event-target-polyfill');
|
|
6
7
|
var partysocket = require('partysocket');
|
|
7
8
|
var io = require('socket.io-client');
|
|
8
9
|
|
|
@@ -40,6 +41,19 @@ var WebSocketEvent = /* @__PURE__ */ ((WebSocketEvent2) => {
|
|
|
40
41
|
WebSocketEvent2["UNSEEN"] = "unseen_count_changed";
|
|
41
42
|
return WebSocketEvent2;
|
|
42
43
|
})(WebSocketEvent || {});
|
|
44
|
+
var SeverityLevelEnum = /* @__PURE__ */ ((SeverityLevelEnum2) => {
|
|
45
|
+
SeverityLevelEnum2["HIGH"] = "high";
|
|
46
|
+
SeverityLevelEnum2["MEDIUM"] = "medium";
|
|
47
|
+
SeverityLevelEnum2["LOW"] = "low";
|
|
48
|
+
SeverityLevelEnum2["NONE"] = "none";
|
|
49
|
+
return SeverityLevelEnum2;
|
|
50
|
+
})(SeverityLevelEnum || {});
|
|
51
|
+
var WorkflowCriticalityEnum = /* @__PURE__ */ ((WorkflowCriticalityEnum2) => {
|
|
52
|
+
WorkflowCriticalityEnum2["CRITICAL"] = "critical";
|
|
53
|
+
WorkflowCriticalityEnum2["NON_CRITICAL"] = "nonCritical";
|
|
54
|
+
WorkflowCriticalityEnum2["ALL"] = "all";
|
|
55
|
+
return WorkflowCriticalityEnum2;
|
|
56
|
+
})(WorkflowCriticalityEnum || {});
|
|
43
57
|
|
|
44
58
|
// src/utils/arrays.ts
|
|
45
59
|
var arrayValuesEqual = (arr1, arr2) => {
|
|
@@ -57,6 +71,11 @@ var arrayValuesEqual = (arr1, arr2) => {
|
|
|
57
71
|
var areTagsEqual = (tags1, tags2) => {
|
|
58
72
|
return arrayValuesEqual(tags1, tags2) || !tags1 && (tags2 == null ? void 0 : tags2.length) === 0 || (tags1 == null ? void 0 : tags1.length) === 0 && !tags2;
|
|
59
73
|
};
|
|
74
|
+
var areSeveritiesEqual = (el1, el2) => {
|
|
75
|
+
const severity1 = Array.isArray(el1) ? el1 : el1 ? [el1] : [];
|
|
76
|
+
const severity2 = Array.isArray(el2) ? el2 : el2 ? [el2] : [];
|
|
77
|
+
return arrayValuesEqual(severity1, severity2);
|
|
78
|
+
};
|
|
60
79
|
var areDataEqual = (data1, data2) => {
|
|
61
80
|
if (!data1 && !data2) {
|
|
62
81
|
return true;
|
|
@@ -71,7 +90,7 @@ var areDataEqual = (data1, data2) => {
|
|
|
71
90
|
}
|
|
72
91
|
};
|
|
73
92
|
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;
|
|
93
|
+
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
94
|
};
|
|
76
95
|
function checkNotificationDataFilter(notificationData, filterData) {
|
|
77
96
|
if (!filterData || Object.keys(filterData).length === 0) {
|
|
@@ -129,7 +148,7 @@ function checkNotificationMatchesFilter(notification, filter) {
|
|
|
129
148
|
|
|
130
149
|
// src/api/http-client.ts
|
|
131
150
|
var DEFAULT_API_VERSION = "v1";
|
|
132
|
-
var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.
|
|
151
|
+
var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.9.2"}`;
|
|
133
152
|
var HttpClient = class {
|
|
134
153
|
constructor(options = {}) {
|
|
135
154
|
// Environment variable for local development that overrides the default API endpoint without affecting the Inbox DX
|
|
@@ -279,7 +298,8 @@ var InboxService = class {
|
|
|
279
298
|
tags,
|
|
280
299
|
snoozed,
|
|
281
300
|
seen: seen2,
|
|
282
|
-
data
|
|
301
|
+
data,
|
|
302
|
+
severity
|
|
283
303
|
}) {
|
|
284
304
|
const searchParams = new URLSearchParams(`limit=${limit}`);
|
|
285
305
|
if (after) {
|
|
@@ -289,7 +309,9 @@ var InboxService = class {
|
|
|
289
309
|
searchParams.append("offset", `${offset}`);
|
|
290
310
|
}
|
|
291
311
|
if (tags) {
|
|
292
|
-
|
|
312
|
+
for (const tag of tags) {
|
|
313
|
+
searchParams.append("tags[]", tag);
|
|
314
|
+
}
|
|
293
315
|
}
|
|
294
316
|
if (read2 !== void 0) {
|
|
295
317
|
searchParams.append("read", `${read2}`);
|
|
@@ -306,6 +328,13 @@ var InboxService = class {
|
|
|
306
328
|
if (data !== void 0) {
|
|
307
329
|
searchParams.append("data", JSON.stringify(data));
|
|
308
330
|
}
|
|
331
|
+
if (severity && Array.isArray(severity)) {
|
|
332
|
+
for (const el of severity) {
|
|
333
|
+
searchParams.append("severity[]", el);
|
|
334
|
+
}
|
|
335
|
+
} else if (severity) {
|
|
336
|
+
searchParams.append("severity", severity);
|
|
337
|
+
}
|
|
309
338
|
return chunk7B52C2XE_js.__privateGet(this, _httpClient).get(INBOX_NOTIFICATIONS_ROUTE, searchParams, false);
|
|
310
339
|
}
|
|
311
340
|
count({
|
|
@@ -350,7 +379,7 @@ var InboxService = class {
|
|
|
350
379
|
});
|
|
351
380
|
}
|
|
352
381
|
archiveAllRead({ tags, data }) {
|
|
353
|
-
return chunk7B52C2XE_js.__privateGet(this, _httpClient).post(`${INBOX_NOTIFICATIONS_ROUTE}/archive
|
|
382
|
+
return chunk7B52C2XE_js.__privateGet(this, _httpClient).post(`${INBOX_NOTIFICATIONS_ROUTE}/read-archive`, {
|
|
354
383
|
tags,
|
|
355
384
|
data: data ? JSON.stringify(data) : void 0
|
|
356
385
|
});
|
|
@@ -385,10 +414,26 @@ var InboxService = class {
|
|
|
385
414
|
actionType
|
|
386
415
|
});
|
|
387
416
|
}
|
|
388
|
-
fetchPreferences(
|
|
417
|
+
fetchPreferences({
|
|
418
|
+
tags,
|
|
419
|
+
severity,
|
|
420
|
+
criticality
|
|
421
|
+
}) {
|
|
389
422
|
const queryParams = new URLSearchParams();
|
|
390
423
|
if (tags) {
|
|
391
|
-
|
|
424
|
+
for (const tag of tags) {
|
|
425
|
+
queryParams.append("tags[]", tag);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
if (severity && Array.isArray(severity)) {
|
|
429
|
+
for (const el of severity) {
|
|
430
|
+
queryParams.append("severity[]", el);
|
|
431
|
+
}
|
|
432
|
+
} else if (severity) {
|
|
433
|
+
queryParams.append("severity", severity);
|
|
434
|
+
}
|
|
435
|
+
if (criticality) {
|
|
436
|
+
queryParams.append("criticality", criticality);
|
|
392
437
|
}
|
|
393
438
|
const query = queryParams.size ? `?${queryParams.toString()}` : "";
|
|
394
439
|
return chunk7B52C2XE_js.__privateGet(this, _httpClient).get(`${INBOX_ROUTE}/preferences${query}`);
|
|
@@ -909,6 +954,7 @@ var Notification = class {
|
|
|
909
954
|
this.redirect = notification.redirect;
|
|
910
955
|
this.data = notification.data;
|
|
911
956
|
this.workflow = notification.workflow;
|
|
957
|
+
this.severity = notification.severity;
|
|
912
958
|
}
|
|
913
959
|
read() {
|
|
914
960
|
return read({
|
|
@@ -1124,7 +1170,18 @@ var InMemoryCache = class {
|
|
|
1124
1170
|
_cache = new WeakMap();
|
|
1125
1171
|
|
|
1126
1172
|
// src/cache/notifications-cache.ts
|
|
1127
|
-
var excludeEmpty = ({
|
|
1173
|
+
var excludeEmpty = ({
|
|
1174
|
+
tags,
|
|
1175
|
+
data,
|
|
1176
|
+
read: read2,
|
|
1177
|
+
archived,
|
|
1178
|
+
snoozed,
|
|
1179
|
+
seen: seen2,
|
|
1180
|
+
severity,
|
|
1181
|
+
limit,
|
|
1182
|
+
offset,
|
|
1183
|
+
after
|
|
1184
|
+
}) => 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
1185
|
acc[key] = value;
|
|
1129
1186
|
return acc;
|
|
1130
1187
|
}, {});
|
|
@@ -1135,11 +1192,12 @@ var getCacheKey = ({
|
|
|
1135
1192
|
archived,
|
|
1136
1193
|
snoozed,
|
|
1137
1194
|
seen: seen2,
|
|
1195
|
+
severity,
|
|
1138
1196
|
limit,
|
|
1139
1197
|
offset,
|
|
1140
1198
|
after
|
|
1141
1199
|
}) => {
|
|
1142
|
-
return JSON.stringify(excludeEmpty({ tags, data, read: read2, archived, snoozed, seen: seen2, limit, offset, after }));
|
|
1200
|
+
return JSON.stringify(excludeEmpty({ tags, data, read: read2, archived, snoozed, seen: seen2, severity, limit, offset, after }));
|
|
1143
1201
|
};
|
|
1144
1202
|
var getFilterKey = ({
|
|
1145
1203
|
tags,
|
|
@@ -1147,9 +1205,10 @@ var getFilterKey = ({
|
|
|
1147
1205
|
read: read2,
|
|
1148
1206
|
archived,
|
|
1149
1207
|
snoozed,
|
|
1150
|
-
seen: seen2
|
|
1208
|
+
seen: seen2,
|
|
1209
|
+
severity
|
|
1151
1210
|
}) => {
|
|
1152
|
-
return JSON.stringify(excludeEmpty({ tags, data, read: read2, archived, snoozed, seen: seen2 }));
|
|
1211
|
+
return JSON.stringify(excludeEmpty({ tags, data, read: read2, archived, snoozed, seen: seen2, severity }));
|
|
1153
1212
|
};
|
|
1154
1213
|
var getFilter = (key) => {
|
|
1155
1214
|
return JSON.parse(key);
|
|
@@ -1287,7 +1346,8 @@ var NotificationsCache = class {
|
|
|
1287
1346
|
read: args.read,
|
|
1288
1347
|
snoozed: args.snoozed,
|
|
1289
1348
|
archived: args.archived,
|
|
1290
|
-
seen: args.seen
|
|
1349
|
+
seen: args.seen,
|
|
1350
|
+
severity: args.severity
|
|
1291
1351
|
});
|
|
1292
1352
|
}
|
|
1293
1353
|
}
|
|
@@ -1309,7 +1369,9 @@ var NotificationsCache = class {
|
|
|
1309
1369
|
if (!value) {
|
|
1310
1370
|
return;
|
|
1311
1371
|
}
|
|
1312
|
-
value.notifications.filter((el) => typeof read2 === "undefined" || read2 === el.isRead).forEach((notification) =>
|
|
1372
|
+
value.notifications.filter((el) => typeof read2 === "undefined" || read2 === el.isRead).forEach((notification) => {
|
|
1373
|
+
uniqueNotifications.set(notification.id, notification);
|
|
1374
|
+
});
|
|
1313
1375
|
}
|
|
1314
1376
|
});
|
|
1315
1377
|
return Array.from(uniqueNotifications.values());
|
|
@@ -1645,15 +1707,15 @@ var updateEvents2 = [
|
|
|
1645
1707
|
"preferences.bulk_update.pending",
|
|
1646
1708
|
"preferences.bulk_update.resolved"
|
|
1647
1709
|
];
|
|
1648
|
-
var excludeEmpty2 = ({ tags }) => Object.entries({ tags }).reduce((acc, [key, value]) => {
|
|
1710
|
+
var excludeEmpty2 = ({ tags, severity }) => Object.entries({ tags, severity }).reduce((acc, [key, value]) => {
|
|
1649
1711
|
if (value === null || value === void 0 || Array.isArray(value) && value.length === 0) {
|
|
1650
1712
|
return acc;
|
|
1651
1713
|
}
|
|
1652
1714
|
acc[key] = value;
|
|
1653
1715
|
return acc;
|
|
1654
1716
|
}, {});
|
|
1655
|
-
var getCacheKey2 = ({ tags }) => {
|
|
1656
|
-
return JSON.stringify(excludeEmpty2({ tags }));
|
|
1717
|
+
var getCacheKey2 = ({ tags, severity }) => {
|
|
1718
|
+
return JSON.stringify(excludeEmpty2({ tags, severity }));
|
|
1657
1719
|
};
|
|
1658
1720
|
var _emitter3, _cache3;
|
|
1659
1721
|
var PreferencesCache = class {
|
|
@@ -1927,11 +1989,16 @@ var Preferences = class extends BaseModule {
|
|
|
1927
1989
|
list() {
|
|
1928
1990
|
return chunk7B52C2XE_js.__async(this, arguments, function* (args = {}) {
|
|
1929
1991
|
return this.callWithSession(() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1992
|
+
var _a;
|
|
1930
1993
|
try {
|
|
1931
1994
|
let data = chunk7B52C2XE_js.__privateGet(this, _useCache3) ? this.cache.getAll(args) : void 0;
|
|
1932
1995
|
this._emitter.emit("preferences.list.pending", { args, data });
|
|
1933
1996
|
if (!data) {
|
|
1934
|
-
const response = yield this._inboxService.fetchPreferences(
|
|
1997
|
+
const response = yield this._inboxService.fetchPreferences({
|
|
1998
|
+
tags: args.tags,
|
|
1999
|
+
severity: args.severity,
|
|
2000
|
+
criticality: (_a = args.criticality) != null ? _a : "nonCritical" /* NON_CRITICAL */
|
|
2001
|
+
});
|
|
1935
2002
|
data = response.map(
|
|
1936
2003
|
(el) => new Preference(el, {
|
|
1937
2004
|
emitterInstance: this._emitter,
|
|
@@ -2102,7 +2169,8 @@ var mapToNotification = ({
|
|
|
2102
2169
|
cta,
|
|
2103
2170
|
tags,
|
|
2104
2171
|
data,
|
|
2105
|
-
workflow
|
|
2172
|
+
workflow,
|
|
2173
|
+
severity
|
|
2106
2174
|
}) => {
|
|
2107
2175
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2108
2176
|
const to = {
|
|
@@ -2164,7 +2232,8 @@ var mapToNotification = ({
|
|
|
2164
2232
|
target: cta.data.target
|
|
2165
2233
|
} : void 0,
|
|
2166
2234
|
data,
|
|
2167
|
-
workflow
|
|
2235
|
+
workflow,
|
|
2236
|
+
severity
|
|
2168
2237
|
});
|
|
2169
2238
|
};
|
|
2170
2239
|
var _token, _emitter6, _partySocket, _socketUrl, _notificationReceived, _unseenCountChanged, _unreadCountChanged, _handleMessage, _PartySocketClient_instances, initializeSocket_fn, handleConnectSocket_fn, handleDisconnectSocket_fn;
|
|
@@ -2211,7 +2280,7 @@ var PartySocketClient = class extends BaseModule {
|
|
|
2211
2280
|
const data = JSON.parse(event.data);
|
|
2212
2281
|
if (data.event === "unread_count_changed" /* UNREAD */) {
|
|
2213
2282
|
chunk7B52C2XE_js.__privateGet(this, _emitter6).emit(UNREAD_COUNT_CHANGED, {
|
|
2214
|
-
result: data.data.
|
|
2283
|
+
result: data.data.counts
|
|
2215
2284
|
});
|
|
2216
2285
|
}
|
|
2217
2286
|
} catch (error) {
|
|
@@ -2335,7 +2404,8 @@ var mapToNotification2 = ({
|
|
|
2335
2404
|
cta,
|
|
2336
2405
|
tags,
|
|
2337
2406
|
data,
|
|
2338
|
-
workflow
|
|
2407
|
+
workflow,
|
|
2408
|
+
severity
|
|
2339
2409
|
}) => {
|
|
2340
2410
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2341
2411
|
const to = {
|
|
@@ -2397,7 +2467,8 @@ var mapToNotification2 = ({
|
|
|
2397
2467
|
target: cta.data.target
|
|
2398
2468
|
} : void 0,
|
|
2399
2469
|
data,
|
|
2400
|
-
workflow
|
|
2470
|
+
workflow,
|
|
2471
|
+
severity
|
|
2401
2472
|
});
|
|
2402
2473
|
};
|
|
2403
2474
|
var _token2, _emitter7, _socketIo, _socketUrl2, _notificationReceived2, _unseenCountChanged2, _unreadCountChanged2, _Socket_instances, initializeSocket_fn2, handleConnectSocket_fn2, handleDisconnectSocket_fn2;
|
|
@@ -2426,9 +2497,9 @@ var Socket = class extends BaseModule {
|
|
|
2426
2497
|
result: unseenCount
|
|
2427
2498
|
});
|
|
2428
2499
|
});
|
|
2429
|
-
chunk7B52C2XE_js.__privateAdd(this, _unreadCountChanged2, ({
|
|
2500
|
+
chunk7B52C2XE_js.__privateAdd(this, _unreadCountChanged2, ({ counts }) => {
|
|
2430
2501
|
chunk7B52C2XE_js.__privateGet(this, _emitter7).emit(UNREAD_COUNT_CHANGED2, {
|
|
2431
|
-
result:
|
|
2502
|
+
result: counts
|
|
2432
2503
|
});
|
|
2433
2504
|
});
|
|
2434
2505
|
chunk7B52C2XE_js.__privateSet(this, _emitter7, eventEmitterInstance);
|
|
@@ -2633,7 +2704,10 @@ exports.DEFAULT_API_VERSION = DEFAULT_API_VERSION;
|
|
|
2633
2704
|
exports.NotificationStatus = NotificationStatus;
|
|
2634
2705
|
exports.Novu = Novu;
|
|
2635
2706
|
exports.PreferenceLevel = PreferenceLevel;
|
|
2707
|
+
exports.SeverityLevelEnum = SeverityLevelEnum;
|
|
2636
2708
|
exports.WebSocketEvent = WebSocketEvent;
|
|
2709
|
+
exports.WorkflowCriticalityEnum = WorkflowCriticalityEnum;
|
|
2710
|
+
exports.areSeveritiesEqual = areSeveritiesEqual;
|
|
2637
2711
|
exports.areTagsEqual = areTagsEqual;
|
|
2638
2712
|
exports.checkNotificationDataFilter = checkNotificationDataFilter;
|
|
2639
2713
|
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-Db46nHZP.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-Db46nHZP.js';
|
|
3
|
+
import { S as SeverityLevelEnum, N as NotificationFilter } from './types-CbmZeAf8.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, h as WorkflowCriticalityEnum } from './types-CbmZeAf8.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 chunkVEX66SK3_js = require('./chunk-VEX66SK3.js');
|
|
4
4
|
require('./chunk-ZB7IPCHY.js');
|
|
5
5
|
require('./chunk-7B52C2XE.js');
|
|
6
6
|
|
|
@@ -8,37 +8,49 @@ require('./chunk-7B52C2XE.js');
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "ChannelType", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkVEX66SK3_js.ChannelType; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "NotificationStatus", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkVEX66SK3_js.NotificationStatus; }
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "Novu", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkVEX66SK3_js.Novu; }
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(exports, "PreferenceLevel", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkVEX66SK3_js.PreferenceLevel; }
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, "SeverityLevelEnum", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () { return chunkVEX66SK3_js.SeverityLevelEnum; }
|
|
24
28
|
});
|
|
25
29
|
Object.defineProperty(exports, "WebSocketEvent", {
|
|
26
30
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkVEX66SK3_js.WebSocketEvent; }
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports, "WorkflowCriticalityEnum", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () { return chunkVEX66SK3_js.WorkflowCriticalityEnum; }
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(exports, "areSeveritiesEqual", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () { return chunkVEX66SK3_js.areSeveritiesEqual; }
|
|
28
40
|
});
|
|
29
41
|
Object.defineProperty(exports, "areTagsEqual", {
|
|
30
42
|
enumerable: true,
|
|
31
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunkVEX66SK3_js.areTagsEqual; }
|
|
32
44
|
});
|
|
33
45
|
Object.defineProperty(exports, "checkNotificationDataFilter", {
|
|
34
46
|
enumerable: true,
|
|
35
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkVEX66SK3_js.checkNotificationDataFilter; }
|
|
36
48
|
});
|
|
37
49
|
Object.defineProperty(exports, "checkNotificationMatchesFilter", {
|
|
38
50
|
enumerable: true,
|
|
39
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunkVEX66SK3_js.checkNotificationMatchesFilter; }
|
|
40
52
|
});
|
|
41
53
|
Object.defineProperty(exports, "isSameFilter", {
|
|
42
54
|
enumerable: true,
|
|
43
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunkVEX66SK3_js.isSameFilter; }
|
|
44
56
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ChannelPreference, P as PreferenceLevel,
|
|
1
|
+
import { S as SeverityLevelEnum, h as WorkflowCriticalityEnum, C as ChannelPreference, P as PreferenceLevel, i as Workflow, j as Prettify, R as Result, g as Subscriber, k as Session, I as InboxNotification, N as NotificationFilter, A as ActionTypeEnum, e as PreferencesResponse, W as WebSocketEvent, d as NovuOptions } from './types-CbmZeAf8.js';
|
|
2
2
|
|
|
3
3
|
type HttpClientOptions = {
|
|
4
4
|
apiVersion?: string;
|
|
@@ -9,6 +9,8 @@ type HttpClientOptions = {
|
|
|
9
9
|
|
|
10
10
|
type ListPreferencesArgs = {
|
|
11
11
|
tags?: string[];
|
|
12
|
+
severity?: SeverityLevelEnum | SeverityLevelEnum[];
|
|
13
|
+
criticality?: WorkflowCriticalityEnum;
|
|
12
14
|
};
|
|
13
15
|
type BasePreferenceArgs = {
|
|
14
16
|
workflowId: string;
|
|
@@ -62,7 +64,7 @@ declare class InboxService {
|
|
|
62
64
|
subscriberHash?: string;
|
|
63
65
|
subscriber?: Subscriber;
|
|
64
66
|
}): Promise<Session>;
|
|
65
|
-
fetchNotifications({ after, archived, limit, offset, read, tags, snoozed, seen, data, }: {
|
|
67
|
+
fetchNotifications({ after, archived, limit, offset, read, tags, snoozed, seen, data, severity, }: {
|
|
66
68
|
tags?: string[];
|
|
67
69
|
read?: boolean;
|
|
68
70
|
archived?: boolean;
|
|
@@ -72,6 +74,7 @@ declare class InboxService {
|
|
|
72
74
|
after?: string;
|
|
73
75
|
offset?: number;
|
|
74
76
|
data?: Record<string, unknown>;
|
|
77
|
+
severity?: SeverityLevelEnum | SeverityLevelEnum[];
|
|
75
78
|
}): Promise<{
|
|
76
79
|
data: InboxNotification[];
|
|
77
80
|
hasMore: boolean;
|
|
@@ -85,6 +88,7 @@ declare class InboxService {
|
|
|
85
88
|
snoozed?: boolean;
|
|
86
89
|
seen?: boolean;
|
|
87
90
|
data?: Record<string, unknown>;
|
|
91
|
+
severity?: SeverityLevelEnum | SeverityLevelEnum[];
|
|
88
92
|
}>;
|
|
89
93
|
}): Promise<{
|
|
90
94
|
data: Array<{
|
|
@@ -124,7 +128,11 @@ declare class InboxService {
|
|
|
124
128
|
notificationId: string;
|
|
125
129
|
actionType: ActionTypeEnum;
|
|
126
130
|
}): Promise<InboxNotification>;
|
|
127
|
-
fetchPreferences(tags
|
|
131
|
+
fetchPreferences({ tags, severity, criticality, }: {
|
|
132
|
+
tags?: string[];
|
|
133
|
+
severity?: SeverityLevelEnum | SeverityLevelEnum[];
|
|
134
|
+
criticality: WorkflowCriticalityEnum;
|
|
135
|
+
}): Promise<PreferencesResponse[]>;
|
|
128
136
|
bulkUpdatePreferences(preferences: Array<{
|
|
129
137
|
workflowId: string;
|
|
130
138
|
} & ChannelPreference>): Promise<PreferencesResponse[]>;
|
|
@@ -161,6 +169,7 @@ declare class Notification implements Pick<NovuEventEmitter, 'on'>, InboxNotific
|
|
|
161
169
|
readonly redirect: InboxNotification['redirect'];
|
|
162
170
|
readonly data?: InboxNotification['data'];
|
|
163
171
|
readonly workflow?: InboxNotification['workflow'];
|
|
172
|
+
readonly severity: InboxNotification['severity'];
|
|
164
173
|
constructor(notification: InboxNotification, emitter: NovuEventEmitter, inboxService: InboxService);
|
|
165
174
|
read(): Result<Notification>;
|
|
166
175
|
unread(): Result<Notification>;
|
|
@@ -223,6 +232,7 @@ type ListNotificationsArgs = {
|
|
|
223
232
|
archived?: boolean;
|
|
224
233
|
snoozed?: boolean;
|
|
225
234
|
seen?: boolean;
|
|
235
|
+
severity?: SeverityLevelEnum | SeverityLevelEnum[];
|
|
226
236
|
limit?: number;
|
|
227
237
|
after?: string;
|
|
228
238
|
offset?: number;
|
|
@@ -240,6 +250,7 @@ type FilterCountArgs = {
|
|
|
240
250
|
archived?: boolean;
|
|
241
251
|
snoozed?: boolean;
|
|
242
252
|
seen?: boolean;
|
|
253
|
+
severity?: SeverityLevelEnum | SeverityLevelEnum[];
|
|
243
254
|
};
|
|
244
255
|
type FiltersCountArgs = {
|
|
245
256
|
filters: Array<{
|
|
@@ -249,6 +260,7 @@ type FiltersCountArgs = {
|
|
|
249
260
|
snoozed?: boolean;
|
|
250
261
|
seen?: boolean;
|
|
251
262
|
data?: Record<string, unknown>;
|
|
263
|
+
severity?: SeverityLevelEnum | SeverityLevelEnum[];
|
|
252
264
|
}>;
|
|
253
265
|
};
|
|
254
266
|
type CountArgs = undefined | FilterCountArgs | FiltersCountArgs;
|
|
@@ -409,7 +421,10 @@ type SocketEvents = {
|
|
|
409
421
|
};
|
|
410
422
|
} & {
|
|
411
423
|
[key in NotificationUnreadEvent]: {
|
|
412
|
-
result:
|
|
424
|
+
result: {
|
|
425
|
+
total: number;
|
|
426
|
+
severity: Record<string, number>;
|
|
427
|
+
};
|
|
413
428
|
};
|
|
414
429
|
};
|
|
415
430
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import '../novu-
|
|
3
|
-
import '../types-
|
|
1
|
+
import { q as Theme } from '../types-B-VuVpSW.js';
|
|
2
|
+
import '../novu-Db46nHZP.js';
|
|
3
|
+
import '../types-CbmZeAf8.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
|
|