@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
|
@@ -33,6 +33,13 @@ var WebSocketEvent = /* @__PURE__ */ ((WebSocketEvent2) => {
|
|
|
33
33
|
WebSocketEvent2["UNSEEN"] = "unseen_count_changed";
|
|
34
34
|
return WebSocketEvent2;
|
|
35
35
|
})(WebSocketEvent || {});
|
|
36
|
+
var SeverityLevelEnum = /* @__PURE__ */ ((SeverityLevelEnum2) => {
|
|
37
|
+
SeverityLevelEnum2["HIGH"] = "high";
|
|
38
|
+
SeverityLevelEnum2["MEDIUM"] = "medium";
|
|
39
|
+
SeverityLevelEnum2["LOW"] = "low";
|
|
40
|
+
SeverityLevelEnum2["NONE"] = "none";
|
|
41
|
+
return SeverityLevelEnum2;
|
|
42
|
+
})(SeverityLevelEnum || {});
|
|
36
43
|
|
|
37
44
|
// src/utils/arrays.ts
|
|
38
45
|
var arrayValuesEqual = (arr1, arr2) => {
|
|
@@ -50,6 +57,11 @@ var arrayValuesEqual = (arr1, arr2) => {
|
|
|
50
57
|
var areTagsEqual = (tags1, tags2) => {
|
|
51
58
|
return arrayValuesEqual(tags1, tags2) || !tags1 && (tags2 == null ? void 0 : tags2.length) === 0 || (tags1 == null ? void 0 : tags1.length) === 0 && !tags2;
|
|
52
59
|
};
|
|
60
|
+
var areSeveritiesEqual = (el1, el2) => {
|
|
61
|
+
const severity1 = Array.isArray(el1) ? el1 : el1 ? [el1] : [];
|
|
62
|
+
const severity2 = Array.isArray(el2) ? el2 : el2 ? [el2] : [];
|
|
63
|
+
return arrayValuesEqual(severity1, severity2);
|
|
64
|
+
};
|
|
53
65
|
var areDataEqual = (data1, data2) => {
|
|
54
66
|
if (!data1 && !data2) {
|
|
55
67
|
return true;
|
|
@@ -64,7 +76,7 @@ var areDataEqual = (data1, data2) => {
|
|
|
64
76
|
}
|
|
65
77
|
};
|
|
66
78
|
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;
|
|
79
|
+
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
80
|
};
|
|
69
81
|
function checkNotificationDataFilter(notificationData, filterData) {
|
|
70
82
|
if (!filterData || Object.keys(filterData).length === 0) {
|
|
@@ -122,7 +134,7 @@ function checkNotificationMatchesFilter(notification, filter) {
|
|
|
122
134
|
|
|
123
135
|
// src/api/http-client.ts
|
|
124
136
|
var DEFAULT_API_VERSION = "v1";
|
|
125
|
-
var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.
|
|
137
|
+
var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.9.1"}`;
|
|
126
138
|
var HttpClient = class {
|
|
127
139
|
constructor(options = {}) {
|
|
128
140
|
// Environment variable for local development that overrides the default API endpoint without affecting the Inbox DX
|
|
@@ -272,7 +284,8 @@ var InboxService = class {
|
|
|
272
284
|
tags,
|
|
273
285
|
snoozed,
|
|
274
286
|
seen: seen2,
|
|
275
|
-
data
|
|
287
|
+
data,
|
|
288
|
+
severity
|
|
276
289
|
}) {
|
|
277
290
|
const searchParams = new URLSearchParams(`limit=${limit}`);
|
|
278
291
|
if (after) {
|
|
@@ -282,7 +295,9 @@ var InboxService = class {
|
|
|
282
295
|
searchParams.append("offset", `${offset}`);
|
|
283
296
|
}
|
|
284
297
|
if (tags) {
|
|
285
|
-
|
|
298
|
+
for (const tag of tags) {
|
|
299
|
+
searchParams.append("tags[]", tag);
|
|
300
|
+
}
|
|
286
301
|
}
|
|
287
302
|
if (read2 !== void 0) {
|
|
288
303
|
searchParams.append("read", `${read2}`);
|
|
@@ -299,6 +314,13 @@ var InboxService = class {
|
|
|
299
314
|
if (data !== void 0) {
|
|
300
315
|
searchParams.append("data", JSON.stringify(data));
|
|
301
316
|
}
|
|
317
|
+
if (severity && Array.isArray(severity)) {
|
|
318
|
+
for (const el of severity) {
|
|
319
|
+
searchParams.append("severity[]", el);
|
|
320
|
+
}
|
|
321
|
+
} else if (severity) {
|
|
322
|
+
searchParams.append("severity", severity);
|
|
323
|
+
}
|
|
302
324
|
return __privateGet(this, _httpClient).get(INBOX_NOTIFICATIONS_ROUTE, searchParams, false);
|
|
303
325
|
}
|
|
304
326
|
count({
|
|
@@ -378,10 +400,19 @@ var InboxService = class {
|
|
|
378
400
|
actionType
|
|
379
401
|
});
|
|
380
402
|
}
|
|
381
|
-
fetchPreferences(tags) {
|
|
403
|
+
fetchPreferences(tags, severity) {
|
|
382
404
|
const queryParams = new URLSearchParams();
|
|
383
405
|
if (tags) {
|
|
384
|
-
|
|
406
|
+
for (const tag of tags) {
|
|
407
|
+
queryParams.append("tags[]", tag);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
if (severity && Array.isArray(severity)) {
|
|
411
|
+
for (const el of severity) {
|
|
412
|
+
queryParams.append("severity[]", el);
|
|
413
|
+
}
|
|
414
|
+
} else if (severity) {
|
|
415
|
+
queryParams.append("severity", severity);
|
|
385
416
|
}
|
|
386
417
|
const query = queryParams.size ? `?${queryParams.toString()}` : "";
|
|
387
418
|
return __privateGet(this, _httpClient).get(`${INBOX_ROUTE}/preferences${query}`);
|
|
@@ -902,6 +933,7 @@ var Notification = class {
|
|
|
902
933
|
this.redirect = notification.redirect;
|
|
903
934
|
this.data = notification.data;
|
|
904
935
|
this.workflow = notification.workflow;
|
|
936
|
+
this.severity = notification.severity;
|
|
905
937
|
}
|
|
906
938
|
read() {
|
|
907
939
|
return read({
|
|
@@ -1117,7 +1149,18 @@ var InMemoryCache = class {
|
|
|
1117
1149
|
_cache = new WeakMap();
|
|
1118
1150
|
|
|
1119
1151
|
// src/cache/notifications-cache.ts
|
|
1120
|
-
var excludeEmpty = ({
|
|
1152
|
+
var excludeEmpty = ({
|
|
1153
|
+
tags,
|
|
1154
|
+
data,
|
|
1155
|
+
read: read2,
|
|
1156
|
+
archived,
|
|
1157
|
+
snoozed,
|
|
1158
|
+
seen: seen2,
|
|
1159
|
+
severity,
|
|
1160
|
+
limit,
|
|
1161
|
+
offset,
|
|
1162
|
+
after
|
|
1163
|
+
}) => 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
1164
|
acc[key] = value;
|
|
1122
1165
|
return acc;
|
|
1123
1166
|
}, {});
|
|
@@ -1128,11 +1171,12 @@ var getCacheKey = ({
|
|
|
1128
1171
|
archived,
|
|
1129
1172
|
snoozed,
|
|
1130
1173
|
seen: seen2,
|
|
1174
|
+
severity,
|
|
1131
1175
|
limit,
|
|
1132
1176
|
offset,
|
|
1133
1177
|
after
|
|
1134
1178
|
}) => {
|
|
1135
|
-
return JSON.stringify(excludeEmpty({ tags, data, read: read2, archived, snoozed, seen: seen2, limit, offset, after }));
|
|
1179
|
+
return JSON.stringify(excludeEmpty({ tags, data, read: read2, archived, snoozed, seen: seen2, severity, limit, offset, after }));
|
|
1136
1180
|
};
|
|
1137
1181
|
var getFilterKey = ({
|
|
1138
1182
|
tags,
|
|
@@ -1140,9 +1184,10 @@ var getFilterKey = ({
|
|
|
1140
1184
|
read: read2,
|
|
1141
1185
|
archived,
|
|
1142
1186
|
snoozed,
|
|
1143
|
-
seen: seen2
|
|
1187
|
+
seen: seen2,
|
|
1188
|
+
severity
|
|
1144
1189
|
}) => {
|
|
1145
|
-
return JSON.stringify(excludeEmpty({ tags, data, read: read2, archived, snoozed, seen: seen2 }));
|
|
1190
|
+
return JSON.stringify(excludeEmpty({ tags, data, read: read2, archived, snoozed, seen: seen2, severity }));
|
|
1146
1191
|
};
|
|
1147
1192
|
var getFilter = (key) => {
|
|
1148
1193
|
return JSON.parse(key);
|
|
@@ -1280,7 +1325,8 @@ var NotificationsCache = class {
|
|
|
1280
1325
|
read: args.read,
|
|
1281
1326
|
snoozed: args.snoozed,
|
|
1282
1327
|
archived: args.archived,
|
|
1283
|
-
seen: args.seen
|
|
1328
|
+
seen: args.seen,
|
|
1329
|
+
severity: args.severity
|
|
1284
1330
|
});
|
|
1285
1331
|
}
|
|
1286
1332
|
}
|
|
@@ -1302,7 +1348,9 @@ var NotificationsCache = class {
|
|
|
1302
1348
|
if (!value) {
|
|
1303
1349
|
return;
|
|
1304
1350
|
}
|
|
1305
|
-
value.notifications.filter((el) => typeof read2 === "undefined" || read2 === el.isRead).forEach((notification) =>
|
|
1351
|
+
value.notifications.filter((el) => typeof read2 === "undefined" || read2 === el.isRead).forEach((notification) => {
|
|
1352
|
+
uniqueNotifications.set(notification.id, notification);
|
|
1353
|
+
});
|
|
1306
1354
|
}
|
|
1307
1355
|
});
|
|
1308
1356
|
return Array.from(uniqueNotifications.values());
|
|
@@ -1638,15 +1686,15 @@ var updateEvents2 = [
|
|
|
1638
1686
|
"preferences.bulk_update.pending",
|
|
1639
1687
|
"preferences.bulk_update.resolved"
|
|
1640
1688
|
];
|
|
1641
|
-
var excludeEmpty2 = ({ tags }) => Object.entries({ tags }).reduce((acc, [key, value]) => {
|
|
1689
|
+
var excludeEmpty2 = ({ tags, severity }) => Object.entries({ tags, severity }).reduce((acc, [key, value]) => {
|
|
1642
1690
|
if (value === null || value === void 0 || Array.isArray(value) && value.length === 0) {
|
|
1643
1691
|
return acc;
|
|
1644
1692
|
}
|
|
1645
1693
|
acc[key] = value;
|
|
1646
1694
|
return acc;
|
|
1647
1695
|
}, {});
|
|
1648
|
-
var getCacheKey2 = ({ tags }) => {
|
|
1649
|
-
return JSON.stringify(excludeEmpty2({ tags }));
|
|
1696
|
+
var getCacheKey2 = ({ tags, severity }) => {
|
|
1697
|
+
return JSON.stringify(excludeEmpty2({ tags, severity }));
|
|
1650
1698
|
};
|
|
1651
1699
|
var _emitter3, _cache3;
|
|
1652
1700
|
var PreferencesCache = class {
|
|
@@ -1924,7 +1972,7 @@ var Preferences = class extends BaseModule {
|
|
|
1924
1972
|
let data = __privateGet(this, _useCache3) ? this.cache.getAll(args) : void 0;
|
|
1925
1973
|
this._emitter.emit("preferences.list.pending", { args, data });
|
|
1926
1974
|
if (!data) {
|
|
1927
|
-
const response = yield this._inboxService.fetchPreferences(args.tags);
|
|
1975
|
+
const response = yield this._inboxService.fetchPreferences(args.tags, args.severity);
|
|
1928
1976
|
data = response.map(
|
|
1929
1977
|
(el) => new Preference(el, {
|
|
1930
1978
|
emitterInstance: this._emitter,
|
|
@@ -2095,7 +2143,8 @@ var mapToNotification = ({
|
|
|
2095
2143
|
cta,
|
|
2096
2144
|
tags,
|
|
2097
2145
|
data,
|
|
2098
|
-
workflow
|
|
2146
|
+
workflow,
|
|
2147
|
+
severity
|
|
2099
2148
|
}) => {
|
|
2100
2149
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2101
2150
|
const to = {
|
|
@@ -2157,7 +2206,8 @@ var mapToNotification = ({
|
|
|
2157
2206
|
target: cta.data.target
|
|
2158
2207
|
} : void 0,
|
|
2159
2208
|
data,
|
|
2160
|
-
workflow
|
|
2209
|
+
workflow,
|
|
2210
|
+
severity
|
|
2161
2211
|
});
|
|
2162
2212
|
};
|
|
2163
2213
|
var _token, _emitter6, _partySocket, _socketUrl, _notificationReceived, _unseenCountChanged, _unreadCountChanged, _handleMessage, _PartySocketClient_instances, initializeSocket_fn, handleConnectSocket_fn, handleDisconnectSocket_fn;
|
|
@@ -2204,7 +2254,7 @@ var PartySocketClient = class extends BaseModule {
|
|
|
2204
2254
|
const data = JSON.parse(event.data);
|
|
2205
2255
|
if (data.event === "unread_count_changed" /* UNREAD */) {
|
|
2206
2256
|
__privateGet(this, _emitter6).emit(UNREAD_COUNT_CHANGED, {
|
|
2207
|
-
result: data.data.
|
|
2257
|
+
result: data.data.counts
|
|
2208
2258
|
});
|
|
2209
2259
|
}
|
|
2210
2260
|
} catch (error) {
|
|
@@ -2328,7 +2378,8 @@ var mapToNotification2 = ({
|
|
|
2328
2378
|
cta,
|
|
2329
2379
|
tags,
|
|
2330
2380
|
data,
|
|
2331
|
-
workflow
|
|
2381
|
+
workflow,
|
|
2382
|
+
severity
|
|
2332
2383
|
}) => {
|
|
2333
2384
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2334
2385
|
const to = {
|
|
@@ -2390,7 +2441,8 @@ var mapToNotification2 = ({
|
|
|
2390
2441
|
target: cta.data.target
|
|
2391
2442
|
} : void 0,
|
|
2392
2443
|
data,
|
|
2393
|
-
workflow
|
|
2444
|
+
workflow,
|
|
2445
|
+
severity
|
|
2394
2446
|
});
|
|
2395
2447
|
};
|
|
2396
2448
|
var _token2, _emitter7, _socketIo, _socketUrl2, _notificationReceived2, _unseenCountChanged2, _unreadCountChanged2, _Socket_instances, initializeSocket_fn2, handleConnectSocket_fn2, handleDisconnectSocket_fn2;
|
|
@@ -2419,9 +2471,9 @@ var Socket = class extends BaseModule {
|
|
|
2419
2471
|
result: unseenCount
|
|
2420
2472
|
});
|
|
2421
2473
|
});
|
|
2422
|
-
__privateAdd(this, _unreadCountChanged2, ({
|
|
2474
|
+
__privateAdd(this, _unreadCountChanged2, ({ counts }) => {
|
|
2423
2475
|
__privateGet(this, _emitter7).emit(UNREAD_COUNT_CHANGED2, {
|
|
2424
|
-
result:
|
|
2476
|
+
result: counts
|
|
2425
2477
|
});
|
|
2426
2478
|
});
|
|
2427
2479
|
__privateSet(this, _emitter7, eventEmitterInstance);
|
|
@@ -2621,4 +2673,4 @@ _emitter8 = new WeakMap();
|
|
|
2621
2673
|
_session = new WeakMap();
|
|
2622
2674
|
_inboxService3 = new WeakMap();
|
|
2623
2675
|
|
|
2624
|
-
export { ChannelType, DEFAULT_API_VERSION, NotificationStatus, Novu, PreferenceLevel, WebSocketEvent, areTagsEqual, checkNotificationDataFilter, checkNotificationMatchesFilter, checkNotificationTagFilter, isBrowser, isSameFilter };
|
|
2676
|
+
export { ChannelType, DEFAULT_API_VERSION, NotificationStatus, Novu, PreferenceLevel, SeverityLevelEnum, WebSocketEvent, 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-uWXW2_yT.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-uWXW2_yT.mjs';
|
|
3
|
+
import { S as SeverityLevelEnum, N as NotificationFilter } from './types-DfB6oB2v.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 } from './types-DfB6oB2v.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, areSeveritiesEqual, areTagsEqual, checkNotificationDataFilter, checkNotificationMatchesFilter, isSameFilter } from './chunk-SH2NZJC6.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, 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.mjs';
|
|
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-KJGvXLvJ.mjs';
|
|
2
|
+
import '../novu-uWXW2_yT.mjs';
|
|
3
|
+
import '../types-DfB6oB2v.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
|
|
|
@@ -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 };
|