@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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { buildSubscriber } from './chunk-QOD7NZ77.mjs';
|
|
2
2
|
import { __privateAdd, __privateSet, __privateGet, __async, __objRest, __spreadValues, __spreadProps, __privateMethod } from './chunk-STZMOEWR.mjs';
|
|
3
3
|
import mitt from 'mitt';
|
|
4
|
+
import 'event-target-polyfill';
|
|
4
5
|
import { WebSocket } from 'partysocket';
|
|
5
6
|
import io from 'socket.io-client';
|
|
6
7
|
|
|
@@ -33,6 +34,19 @@ var WebSocketEvent = /* @__PURE__ */ ((WebSocketEvent2) => {
|
|
|
33
34
|
WebSocketEvent2["UNSEEN"] = "unseen_count_changed";
|
|
34
35
|
return WebSocketEvent2;
|
|
35
36
|
})(WebSocketEvent || {});
|
|
37
|
+
var SeverityLevelEnum = /* @__PURE__ */ ((SeverityLevelEnum2) => {
|
|
38
|
+
SeverityLevelEnum2["HIGH"] = "high";
|
|
39
|
+
SeverityLevelEnum2["MEDIUM"] = "medium";
|
|
40
|
+
SeverityLevelEnum2["LOW"] = "low";
|
|
41
|
+
SeverityLevelEnum2["NONE"] = "none";
|
|
42
|
+
return SeverityLevelEnum2;
|
|
43
|
+
})(SeverityLevelEnum || {});
|
|
44
|
+
var WorkflowCriticalityEnum = /* @__PURE__ */ ((WorkflowCriticalityEnum2) => {
|
|
45
|
+
WorkflowCriticalityEnum2["CRITICAL"] = "critical";
|
|
46
|
+
WorkflowCriticalityEnum2["NON_CRITICAL"] = "nonCritical";
|
|
47
|
+
WorkflowCriticalityEnum2["ALL"] = "all";
|
|
48
|
+
return WorkflowCriticalityEnum2;
|
|
49
|
+
})(WorkflowCriticalityEnum || {});
|
|
36
50
|
|
|
37
51
|
// src/utils/arrays.ts
|
|
38
52
|
var arrayValuesEqual = (arr1, arr2) => {
|
|
@@ -50,6 +64,11 @@ var arrayValuesEqual = (arr1, arr2) => {
|
|
|
50
64
|
var areTagsEqual = (tags1, tags2) => {
|
|
51
65
|
return arrayValuesEqual(tags1, tags2) || !tags1 && (tags2 == null ? void 0 : tags2.length) === 0 || (tags1 == null ? void 0 : tags1.length) === 0 && !tags2;
|
|
52
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
|
+
};
|
|
53
72
|
var areDataEqual = (data1, data2) => {
|
|
54
73
|
if (!data1 && !data2) {
|
|
55
74
|
return true;
|
|
@@ -64,7 +83,7 @@ var areDataEqual = (data1, data2) => {
|
|
|
64
83
|
}
|
|
65
84
|
};
|
|
66
85
|
var isSameFilter = (filter1, filter2) => {
|
|
67
|
-
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);
|
|
68
87
|
};
|
|
69
88
|
function checkNotificationDataFilter(notificationData, filterData) {
|
|
70
89
|
if (!filterData || Object.keys(filterData).length === 0) {
|
|
@@ -122,7 +141,7 @@ function checkNotificationMatchesFilter(notification, filter) {
|
|
|
122
141
|
|
|
123
142
|
// src/api/http-client.ts
|
|
124
143
|
var DEFAULT_API_VERSION = "v1";
|
|
125
|
-
var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.
|
|
144
|
+
var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.9.2"}`;
|
|
126
145
|
var HttpClient = class {
|
|
127
146
|
constructor(options = {}) {
|
|
128
147
|
// Environment variable for local development that overrides the default API endpoint without affecting the Inbox DX
|
|
@@ -272,7 +291,8 @@ var InboxService = class {
|
|
|
272
291
|
tags,
|
|
273
292
|
snoozed,
|
|
274
293
|
seen: seen2,
|
|
275
|
-
data
|
|
294
|
+
data,
|
|
295
|
+
severity
|
|
276
296
|
}) {
|
|
277
297
|
const searchParams = new URLSearchParams(`limit=${limit}`);
|
|
278
298
|
if (after) {
|
|
@@ -282,7 +302,9 @@ var InboxService = class {
|
|
|
282
302
|
searchParams.append("offset", `${offset}`);
|
|
283
303
|
}
|
|
284
304
|
if (tags) {
|
|
285
|
-
|
|
305
|
+
for (const tag of tags) {
|
|
306
|
+
searchParams.append("tags[]", tag);
|
|
307
|
+
}
|
|
286
308
|
}
|
|
287
309
|
if (read2 !== void 0) {
|
|
288
310
|
searchParams.append("read", `${read2}`);
|
|
@@ -299,6 +321,13 @@ var InboxService = class {
|
|
|
299
321
|
if (data !== void 0) {
|
|
300
322
|
searchParams.append("data", JSON.stringify(data));
|
|
301
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
|
+
}
|
|
302
331
|
return __privateGet(this, _httpClient).get(INBOX_NOTIFICATIONS_ROUTE, searchParams, false);
|
|
303
332
|
}
|
|
304
333
|
count({
|
|
@@ -343,7 +372,7 @@ var InboxService = class {
|
|
|
343
372
|
});
|
|
344
373
|
}
|
|
345
374
|
archiveAllRead({ tags, data }) {
|
|
346
|
-
return __privateGet(this, _httpClient).post(`${INBOX_NOTIFICATIONS_ROUTE}/archive
|
|
375
|
+
return __privateGet(this, _httpClient).post(`${INBOX_NOTIFICATIONS_ROUTE}/read-archive`, {
|
|
347
376
|
tags,
|
|
348
377
|
data: data ? JSON.stringify(data) : void 0
|
|
349
378
|
});
|
|
@@ -378,10 +407,26 @@ var InboxService = class {
|
|
|
378
407
|
actionType
|
|
379
408
|
});
|
|
380
409
|
}
|
|
381
|
-
fetchPreferences(
|
|
410
|
+
fetchPreferences({
|
|
411
|
+
tags,
|
|
412
|
+
severity,
|
|
413
|
+
criticality
|
|
414
|
+
}) {
|
|
382
415
|
const queryParams = new URLSearchParams();
|
|
383
416
|
if (tags) {
|
|
384
|
-
|
|
417
|
+
for (const tag of tags) {
|
|
418
|
+
queryParams.append("tags[]", tag);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
if (severity && Array.isArray(severity)) {
|
|
422
|
+
for (const el of severity) {
|
|
423
|
+
queryParams.append("severity[]", el);
|
|
424
|
+
}
|
|
425
|
+
} else if (severity) {
|
|
426
|
+
queryParams.append("severity", severity);
|
|
427
|
+
}
|
|
428
|
+
if (criticality) {
|
|
429
|
+
queryParams.append("criticality", criticality);
|
|
385
430
|
}
|
|
386
431
|
const query = queryParams.size ? `?${queryParams.toString()}` : "";
|
|
387
432
|
return __privateGet(this, _httpClient).get(`${INBOX_ROUTE}/preferences${query}`);
|
|
@@ -902,6 +947,7 @@ var Notification = class {
|
|
|
902
947
|
this.redirect = notification.redirect;
|
|
903
948
|
this.data = notification.data;
|
|
904
949
|
this.workflow = notification.workflow;
|
|
950
|
+
this.severity = notification.severity;
|
|
905
951
|
}
|
|
906
952
|
read() {
|
|
907
953
|
return read({
|
|
@@ -1117,7 +1163,18 @@ var InMemoryCache = class {
|
|
|
1117
1163
|
_cache = new WeakMap();
|
|
1118
1164
|
|
|
1119
1165
|
// src/cache/notifications-cache.ts
|
|
1120
|
-
var excludeEmpty = ({
|
|
1166
|
+
var excludeEmpty = ({
|
|
1167
|
+
tags,
|
|
1168
|
+
data,
|
|
1169
|
+
read: read2,
|
|
1170
|
+
archived,
|
|
1171
|
+
snoozed,
|
|
1172
|
+
seen: seen2,
|
|
1173
|
+
severity,
|
|
1174
|
+
limit,
|
|
1175
|
+
offset,
|
|
1176
|
+
after
|
|
1177
|
+
}) => 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]) => {
|
|
1121
1178
|
acc[key] = value;
|
|
1122
1179
|
return acc;
|
|
1123
1180
|
}, {});
|
|
@@ -1128,11 +1185,12 @@ var getCacheKey = ({
|
|
|
1128
1185
|
archived,
|
|
1129
1186
|
snoozed,
|
|
1130
1187
|
seen: seen2,
|
|
1188
|
+
severity,
|
|
1131
1189
|
limit,
|
|
1132
1190
|
offset,
|
|
1133
1191
|
after
|
|
1134
1192
|
}) => {
|
|
1135
|
-
return JSON.stringify(excludeEmpty({ tags, data, read: read2, archived, snoozed, seen: seen2, limit, offset, after }));
|
|
1193
|
+
return JSON.stringify(excludeEmpty({ tags, data, read: read2, archived, snoozed, seen: seen2, severity, limit, offset, after }));
|
|
1136
1194
|
};
|
|
1137
1195
|
var getFilterKey = ({
|
|
1138
1196
|
tags,
|
|
@@ -1140,9 +1198,10 @@ var getFilterKey = ({
|
|
|
1140
1198
|
read: read2,
|
|
1141
1199
|
archived,
|
|
1142
1200
|
snoozed,
|
|
1143
|
-
seen: seen2
|
|
1201
|
+
seen: seen2,
|
|
1202
|
+
severity
|
|
1144
1203
|
}) => {
|
|
1145
|
-
return JSON.stringify(excludeEmpty({ tags, data, read: read2, archived, snoozed, seen: seen2 }));
|
|
1204
|
+
return JSON.stringify(excludeEmpty({ tags, data, read: read2, archived, snoozed, seen: seen2, severity }));
|
|
1146
1205
|
};
|
|
1147
1206
|
var getFilter = (key) => {
|
|
1148
1207
|
return JSON.parse(key);
|
|
@@ -1280,7 +1339,8 @@ var NotificationsCache = class {
|
|
|
1280
1339
|
read: args.read,
|
|
1281
1340
|
snoozed: args.snoozed,
|
|
1282
1341
|
archived: args.archived,
|
|
1283
|
-
seen: args.seen
|
|
1342
|
+
seen: args.seen,
|
|
1343
|
+
severity: args.severity
|
|
1284
1344
|
});
|
|
1285
1345
|
}
|
|
1286
1346
|
}
|
|
@@ -1302,7 +1362,9 @@ var NotificationsCache = class {
|
|
|
1302
1362
|
if (!value) {
|
|
1303
1363
|
return;
|
|
1304
1364
|
}
|
|
1305
|
-
value.notifications.filter((el) => typeof read2 === "undefined" || read2 === el.isRead).forEach((notification) =>
|
|
1365
|
+
value.notifications.filter((el) => typeof read2 === "undefined" || read2 === el.isRead).forEach((notification) => {
|
|
1366
|
+
uniqueNotifications.set(notification.id, notification);
|
|
1367
|
+
});
|
|
1306
1368
|
}
|
|
1307
1369
|
});
|
|
1308
1370
|
return Array.from(uniqueNotifications.values());
|
|
@@ -1638,15 +1700,15 @@ var updateEvents2 = [
|
|
|
1638
1700
|
"preferences.bulk_update.pending",
|
|
1639
1701
|
"preferences.bulk_update.resolved"
|
|
1640
1702
|
];
|
|
1641
|
-
var excludeEmpty2 = ({ tags }) => Object.entries({ tags }).reduce((acc, [key, value]) => {
|
|
1703
|
+
var excludeEmpty2 = ({ tags, severity }) => Object.entries({ tags, severity }).reduce((acc, [key, value]) => {
|
|
1642
1704
|
if (value === null || value === void 0 || Array.isArray(value) && value.length === 0) {
|
|
1643
1705
|
return acc;
|
|
1644
1706
|
}
|
|
1645
1707
|
acc[key] = value;
|
|
1646
1708
|
return acc;
|
|
1647
1709
|
}, {});
|
|
1648
|
-
var getCacheKey2 = ({ tags }) => {
|
|
1649
|
-
return JSON.stringify(excludeEmpty2({ tags }));
|
|
1710
|
+
var getCacheKey2 = ({ tags, severity }) => {
|
|
1711
|
+
return JSON.stringify(excludeEmpty2({ tags, severity }));
|
|
1650
1712
|
};
|
|
1651
1713
|
var _emitter3, _cache3;
|
|
1652
1714
|
var PreferencesCache = class {
|
|
@@ -1920,11 +1982,16 @@ var Preferences = class extends BaseModule {
|
|
|
1920
1982
|
list() {
|
|
1921
1983
|
return __async(this, arguments, function* (args = {}) {
|
|
1922
1984
|
return this.callWithSession(() => __async(this, null, function* () {
|
|
1985
|
+
var _a;
|
|
1923
1986
|
try {
|
|
1924
1987
|
let data = __privateGet(this, _useCache3) ? this.cache.getAll(args) : void 0;
|
|
1925
1988
|
this._emitter.emit("preferences.list.pending", { args, data });
|
|
1926
1989
|
if (!data) {
|
|
1927
|
-
const response = yield this._inboxService.fetchPreferences(
|
|
1990
|
+
const response = yield this._inboxService.fetchPreferences({
|
|
1991
|
+
tags: args.tags,
|
|
1992
|
+
severity: args.severity,
|
|
1993
|
+
criticality: (_a = args.criticality) != null ? _a : "nonCritical" /* NON_CRITICAL */
|
|
1994
|
+
});
|
|
1928
1995
|
data = response.map(
|
|
1929
1996
|
(el) => new Preference(el, {
|
|
1930
1997
|
emitterInstance: this._emitter,
|
|
@@ -2095,7 +2162,8 @@ var mapToNotification = ({
|
|
|
2095
2162
|
cta,
|
|
2096
2163
|
tags,
|
|
2097
2164
|
data,
|
|
2098
|
-
workflow
|
|
2165
|
+
workflow,
|
|
2166
|
+
severity
|
|
2099
2167
|
}) => {
|
|
2100
2168
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2101
2169
|
const to = {
|
|
@@ -2157,7 +2225,8 @@ var mapToNotification = ({
|
|
|
2157
2225
|
target: cta.data.target
|
|
2158
2226
|
} : void 0,
|
|
2159
2227
|
data,
|
|
2160
|
-
workflow
|
|
2228
|
+
workflow,
|
|
2229
|
+
severity
|
|
2161
2230
|
});
|
|
2162
2231
|
};
|
|
2163
2232
|
var _token, _emitter6, _partySocket, _socketUrl, _notificationReceived, _unseenCountChanged, _unreadCountChanged, _handleMessage, _PartySocketClient_instances, initializeSocket_fn, handleConnectSocket_fn, handleDisconnectSocket_fn;
|
|
@@ -2204,7 +2273,7 @@ var PartySocketClient = class extends BaseModule {
|
|
|
2204
2273
|
const data = JSON.parse(event.data);
|
|
2205
2274
|
if (data.event === "unread_count_changed" /* UNREAD */) {
|
|
2206
2275
|
__privateGet(this, _emitter6).emit(UNREAD_COUNT_CHANGED, {
|
|
2207
|
-
result: data.data.
|
|
2276
|
+
result: data.data.counts
|
|
2208
2277
|
});
|
|
2209
2278
|
}
|
|
2210
2279
|
} catch (error) {
|
|
@@ -2328,7 +2397,8 @@ var mapToNotification2 = ({
|
|
|
2328
2397
|
cta,
|
|
2329
2398
|
tags,
|
|
2330
2399
|
data,
|
|
2331
|
-
workflow
|
|
2400
|
+
workflow,
|
|
2401
|
+
severity
|
|
2332
2402
|
}) => {
|
|
2333
2403
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2334
2404
|
const to = {
|
|
@@ -2390,7 +2460,8 @@ var mapToNotification2 = ({
|
|
|
2390
2460
|
target: cta.data.target
|
|
2391
2461
|
} : void 0,
|
|
2392
2462
|
data,
|
|
2393
|
-
workflow
|
|
2463
|
+
workflow,
|
|
2464
|
+
severity
|
|
2394
2465
|
});
|
|
2395
2466
|
};
|
|
2396
2467
|
var _token2, _emitter7, _socketIo, _socketUrl2, _notificationReceived2, _unseenCountChanged2, _unreadCountChanged2, _Socket_instances, initializeSocket_fn2, handleConnectSocket_fn2, handleDisconnectSocket_fn2;
|
|
@@ -2419,9 +2490,9 @@ var Socket = class extends BaseModule {
|
|
|
2419
2490
|
result: unseenCount
|
|
2420
2491
|
});
|
|
2421
2492
|
});
|
|
2422
|
-
__privateAdd(this, _unreadCountChanged2, ({
|
|
2493
|
+
__privateAdd(this, _unreadCountChanged2, ({ counts }) => {
|
|
2423
2494
|
__privateGet(this, _emitter7).emit(UNREAD_COUNT_CHANGED2, {
|
|
2424
|
-
result:
|
|
2495
|
+
result: counts
|
|
2425
2496
|
});
|
|
2426
2497
|
});
|
|
2427
2498
|
__privateSet(this, _emitter7, eventEmitterInstance);
|
|
@@ -2621,4 +2692,4 @@ _emitter8 = new WeakMap();
|
|
|
2621
2692
|
_session = new WeakMap();
|
|
2622
2693
|
_inboxService3 = new WeakMap();
|
|
2623
2694
|
|
|
2624
|
-
export { ChannelType, DEFAULT_API_VERSION, NotificationStatus, Novu, PreferenceLevel, WebSocketEvent, areTagsEqual, checkNotificationDataFilter, checkNotificationMatchesFilter, checkNotificationTagFilter, isBrowser, isSameFilter };
|
|
2695
|
+
export { ChannelType, DEFAULT_API_VERSION, NotificationStatus, Novu, PreferenceLevel, SeverityLevelEnum, WebSocketEvent, WorkflowCriticalityEnum, areSeveritiesEqual, areTagsEqual, checkNotificationDataFilter, checkNotificationMatchesFilter, checkNotificationTagFilter, isBrowser, isSameFilter };
|
package/dist/esm/index.d.mts
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-BOlS1PMv.mjs';
|
|
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-BOlS1PMv.mjs';
|
|
3
|
+
import { S as SeverityLevelEnum, N as NotificationFilter } from './types-CbmZeAf8.mjs';
|
|
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.mjs';
|
|
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/esm/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { ChannelType, NotificationStatus, Novu, PreferenceLevel, WebSocketEvent, areTagsEqual, checkNotificationDataFilter, checkNotificationMatchesFilter, isSameFilter } from './chunk-
|
|
1
|
+
export { ChannelType, NotificationStatus, Novu, PreferenceLevel, SeverityLevelEnum, WebSocketEvent, WorkflowCriticalityEnum, areSeveritiesEqual, areTagsEqual, checkNotificationDataFilter, checkNotificationMatchesFilter, isSameFilter } from './chunk-3CKXF2I4.mjs';
|
|
2
2
|
import './chunk-QOD7NZ77.mjs';
|
|
3
3
|
import './chunk-STZMOEWR.mjs';
|
|
@@ -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.mjs';
|
|
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-C9c_ID-G.mjs';
|
|
2
|
+
import '../novu-BOlS1PMv.mjs';
|
|
3
|
+
import '../types-CbmZeAf8.mjs';
|
|
4
4
|
|
|
5
5
|
declare const dark: Theme;
|
|
6
6
|
|
|
@@ -11,6 +11,16 @@ var dark = {
|
|
|
11
11
|
colorShadow: "black",
|
|
12
12
|
colorRing: "#E1E4EA",
|
|
13
13
|
colorStripes: "#FF8447"
|
|
14
|
+
},
|
|
15
|
+
elements: {
|
|
16
|
+
severityHigh__bellContainer: "[--bell-gradient-start:var(--nv-color-severity-high)] [--bell-gradient-end:oklch(from_var(--nv-color-severity-high)_80%_c_h)]",
|
|
17
|
+
severityMedium__bellContainer: "[--bell-gradient-start:var(--nv-color-severity-medium)] [--bell-gradient-end:oklch(from_var(--nv-color-severity-medium)_80%_c_h)]",
|
|
18
|
+
severityLow__bellContainer: "[--bell-gradient-start:var(--nv-color-severity-low)] [--bell-gradient-end:oklch(from_var(--nv-color-severity-low)_80%_c_h)]",
|
|
19
|
+
bellContainer: "[--bell-gradient-start:var(--nv-color-foreground)] [--bell-gradient-end:oklch(from_var(--nv-color-foreground)_80%_c_h)]",
|
|
20
|
+
severityGlowHigh__bellSeverityGlow: "nt-bg-severity-high-alpha-300 before:nt-bg-severity-high-alpha-300",
|
|
21
|
+
severityGlowMedium__bellSeverityGlow: "nt-bg-severity-medium-alpha-300 before:nt-bg-severity-medium-alpha-300",
|
|
22
|
+
severityGlowLow__bellSeverityGlow: "nt-bg-severity-low-alpha-300 before:nt-bg-severity-low-alpha-300",
|
|
23
|
+
bellSeverityGlow: "nt-bg-severity-none-alpha-300 before:nt-bg-severity-none-alpha-300"
|
|
14
24
|
}
|
|
15
25
|
};
|
|
16
26
|
|