@novu/js 3.4.0 → 3.5.0-rc.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-WZT5QCVB.js → chunk-OGEM74YA.js} +96 -42
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +8 -8
- package/dist/{esm/novu-Nrvpy3Z1.d.mts → cjs/novu-q3jzGeyW.d.ts} +25 -10
- package/dist/cjs/themes/index.d.ts +2 -2
- package/dist/cjs/{types-Bj3h0WFq.d.ts → types-DdImrpw7.d.ts} +2 -2
- package/dist/cjs/ui/index.d.ts +4 -4
- package/dist/cjs/ui/index.js +127 -70
- package/dist/esm/{chunk-LVZEXMKC.mjs → chunk-GPGRFVOZ.mjs} +96 -42
- package/dist/esm/index.d.mts +2 -2
- package/dist/esm/index.mjs +1 -1
- package/dist/{cjs/novu-Nrvpy3Z1.d.ts → esm/novu-q3jzGeyW.d.mts} +25 -10
- package/dist/esm/themes/index.d.mts +2 -2
- package/dist/esm/{types-C13lyN-Z.d.mts → types-CTQLJWIf.d.mts} +2 -2
- package/dist/esm/ui/index.d.mts +4 -4
- package/dist/esm/ui/index.mjs +124 -67
- package/dist/novu.min.js +11 -11
- package/dist/novu.min.js.gz +0 -0
- package/package.json +16 -16
|
@@ -48,14 +48,27 @@ var arrayValuesEqual = (arr1, arr2) => {
|
|
|
48
48
|
var areTagsEqual = (tags1, tags2) => {
|
|
49
49
|
return arrayValuesEqual(tags1, tags2) || !tags1 && (tags2 == null ? void 0 : tags2.length) === 0 || (tags1 == null ? void 0 : tags1.length) === 0 && !tags2;
|
|
50
50
|
};
|
|
51
|
+
var areDataEqual = (data1, data2) => {
|
|
52
|
+
if (!data1 && !data2) {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
if (!data1 || !data2) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
return JSON.stringify(data1) === JSON.stringify(data2);
|
|
60
|
+
} catch (e) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
51
64
|
var isSameFilter = (filter1, filter2) => {
|
|
52
|
-
return areTagsEqual(filter1.tags, filter2.tags) && filter1.read === filter2.read && filter1.archived === filter2.archived && filter1.snoozed === filter2.snoozed;
|
|
65
|
+
return areDataEqual(filter1.data, filter2.data) && areTagsEqual(filter1.tags, filter2.tags) && filter1.read === filter2.read && filter1.archived === filter2.archived && filter1.snoozed === filter2.snoozed;
|
|
53
66
|
};
|
|
54
67
|
|
|
55
68
|
// src/api/http-client.ts
|
|
56
69
|
var DEFAULT_API_VERSION = "v1";
|
|
57
70
|
var DEFAULT_BACKEND_URL = "https://api.novu.co";
|
|
58
|
-
var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.
|
|
71
|
+
var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.5.0-rc.2"}`;
|
|
59
72
|
var HttpClient = class {
|
|
60
73
|
constructor(options = {}) {
|
|
61
74
|
const {
|
|
@@ -190,7 +203,8 @@ var InboxService = class {
|
|
|
190
203
|
offset,
|
|
191
204
|
read: read2,
|
|
192
205
|
tags,
|
|
193
|
-
snoozed
|
|
206
|
+
snoozed,
|
|
207
|
+
data
|
|
194
208
|
}) {
|
|
195
209
|
const searchParams = new URLSearchParams(`limit=${limit}`);
|
|
196
210
|
if (after) {
|
|
@@ -211,9 +225,14 @@ var InboxService = class {
|
|
|
211
225
|
if (snoozed !== void 0) {
|
|
212
226
|
searchParams.append("snoozed", `${snoozed}`);
|
|
213
227
|
}
|
|
228
|
+
if (data !== void 0) {
|
|
229
|
+
searchParams.append("data", JSON.stringify(data));
|
|
230
|
+
}
|
|
214
231
|
return __privateGet(this, _httpClient).get(INBOX_NOTIFICATIONS_ROUTE, searchParams, false);
|
|
215
232
|
}
|
|
216
|
-
count({
|
|
233
|
+
count({
|
|
234
|
+
filters
|
|
235
|
+
}) {
|
|
217
236
|
return __privateGet(this, _httpClient).get(
|
|
218
237
|
`${INBOX_NOTIFICATIONS_ROUTE}/count`,
|
|
219
238
|
new URLSearchParams({
|
|
@@ -240,14 +259,23 @@ var InboxService = class {
|
|
|
240
259
|
unsnooze(notificationId) {
|
|
241
260
|
return __privateGet(this, _httpClient).patch(`${INBOX_NOTIFICATIONS_ROUTE}/${notificationId}/unsnooze`);
|
|
242
261
|
}
|
|
243
|
-
readAll({ tags }) {
|
|
244
|
-
return __privateGet(this, _httpClient).post(`${INBOX_NOTIFICATIONS_ROUTE}/read`, {
|
|
262
|
+
readAll({ tags, data }) {
|
|
263
|
+
return __privateGet(this, _httpClient).post(`${INBOX_NOTIFICATIONS_ROUTE}/read`, {
|
|
264
|
+
tags,
|
|
265
|
+
data: data ? JSON.stringify(data) : void 0
|
|
266
|
+
});
|
|
245
267
|
}
|
|
246
|
-
archiveAll({ tags }) {
|
|
247
|
-
return __privateGet(this, _httpClient).post(`${INBOX_NOTIFICATIONS_ROUTE}/archive`, {
|
|
268
|
+
archiveAll({ tags, data }) {
|
|
269
|
+
return __privateGet(this, _httpClient).post(`${INBOX_NOTIFICATIONS_ROUTE}/archive`, {
|
|
270
|
+
tags,
|
|
271
|
+
data: data ? JSON.stringify(data) : void 0
|
|
272
|
+
});
|
|
248
273
|
}
|
|
249
|
-
archiveAllRead({ tags }) {
|
|
250
|
-
return __privateGet(this, _httpClient).post(`${INBOX_NOTIFICATIONS_ROUTE}/read-archive`, {
|
|
274
|
+
archiveAllRead({ tags, data }) {
|
|
275
|
+
return __privateGet(this, _httpClient).post(`${INBOX_NOTIFICATIONS_ROUTE}/read-archive`, {
|
|
276
|
+
tags,
|
|
277
|
+
data: data ? JSON.stringify(data) : void 0
|
|
278
|
+
});
|
|
251
279
|
}
|
|
252
280
|
completeAction({
|
|
253
281
|
actionType,
|
|
@@ -793,10 +821,11 @@ var readAll = (_0) => __async(void 0, [_0], function* ({
|
|
|
793
821
|
emitter,
|
|
794
822
|
inboxService,
|
|
795
823
|
notificationsCache,
|
|
796
|
-
tags
|
|
824
|
+
tags,
|
|
825
|
+
data
|
|
797
826
|
}) {
|
|
798
827
|
try {
|
|
799
|
-
const notifications = notificationsCache.getUniqueNotifications({ tags });
|
|
828
|
+
const notifications = notificationsCache.getUniqueNotifications({ tags, data });
|
|
800
829
|
const optimisticNotifications = notifications.map(
|
|
801
830
|
(notification) => new Notification(
|
|
802
831
|
__spreadProps(__spreadValues({}, notification), {
|
|
@@ -809,12 +838,12 @@ var readAll = (_0) => __async(void 0, [_0], function* ({
|
|
|
809
838
|
inboxService
|
|
810
839
|
)
|
|
811
840
|
);
|
|
812
|
-
emitter.emit("notifications.read_all.pending", { args: { tags }, data: optimisticNotifications });
|
|
813
|
-
yield inboxService.readAll({ tags });
|
|
814
|
-
emitter.emit("notifications.read_all.resolved", { args: { tags }, data: optimisticNotifications });
|
|
841
|
+
emitter.emit("notifications.read_all.pending", { args: { tags, data }, data: optimisticNotifications });
|
|
842
|
+
yield inboxService.readAll({ tags, data });
|
|
843
|
+
emitter.emit("notifications.read_all.resolved", { args: { tags, data }, data: optimisticNotifications });
|
|
815
844
|
return {};
|
|
816
845
|
} catch (error) {
|
|
817
|
-
emitter.emit("notifications.read_all.resolved", { args: { tags }, error });
|
|
846
|
+
emitter.emit("notifications.read_all.resolved", { args: { tags, data }, error });
|
|
818
847
|
return { error: new NovuError("Failed to read all notifications", error) };
|
|
819
848
|
}
|
|
820
849
|
});
|
|
@@ -822,10 +851,11 @@ var archiveAll = (_0) => __async(void 0, [_0], function* ({
|
|
|
822
851
|
emitter,
|
|
823
852
|
inboxService,
|
|
824
853
|
notificationsCache,
|
|
825
|
-
tags
|
|
854
|
+
tags,
|
|
855
|
+
data
|
|
826
856
|
}) {
|
|
827
857
|
try {
|
|
828
|
-
const notifications = notificationsCache.getUniqueNotifications({ tags });
|
|
858
|
+
const notifications = notificationsCache.getUniqueNotifications({ tags, data });
|
|
829
859
|
const optimisticNotifications = notifications.map(
|
|
830
860
|
(notification) => new Notification(
|
|
831
861
|
__spreadProps(__spreadValues({}, notification), {
|
|
@@ -838,12 +868,12 @@ var archiveAll = (_0) => __async(void 0, [_0], function* ({
|
|
|
838
868
|
inboxService
|
|
839
869
|
)
|
|
840
870
|
);
|
|
841
|
-
emitter.emit("notifications.archive_all.pending", { args: { tags }, data: optimisticNotifications });
|
|
842
|
-
yield inboxService.archiveAll({ tags });
|
|
843
|
-
emitter.emit("notifications.archive_all.resolved", { args: { tags }, data: optimisticNotifications });
|
|
871
|
+
emitter.emit("notifications.archive_all.pending", { args: { tags, data }, data: optimisticNotifications });
|
|
872
|
+
yield inboxService.archiveAll({ tags, data });
|
|
873
|
+
emitter.emit("notifications.archive_all.resolved", { args: { tags, data }, data: optimisticNotifications });
|
|
844
874
|
return {};
|
|
845
875
|
} catch (error) {
|
|
846
|
-
emitter.emit("notifications.archive_all.resolved", { args: { tags }, error });
|
|
876
|
+
emitter.emit("notifications.archive_all.resolved", { args: { tags, data }, error });
|
|
847
877
|
return { error: new NovuError("Failed to archive all notifications", error) };
|
|
848
878
|
}
|
|
849
879
|
});
|
|
@@ -851,10 +881,11 @@ var archiveAllRead = (_0) => __async(void 0, [_0], function* ({
|
|
|
851
881
|
emitter,
|
|
852
882
|
inboxService,
|
|
853
883
|
notificationsCache,
|
|
854
|
-
tags
|
|
884
|
+
tags,
|
|
885
|
+
data
|
|
855
886
|
}) {
|
|
856
887
|
try {
|
|
857
|
-
const notifications = notificationsCache.getUniqueNotifications({ tags, read: true });
|
|
888
|
+
const notifications = notificationsCache.getUniqueNotifications({ tags, data, read: true });
|
|
858
889
|
const optimisticNotifications = notifications.map(
|
|
859
890
|
(notification) => new Notification(
|
|
860
891
|
__spreadProps(__spreadValues({}, notification), { isArchived: true, archivedAt: (/* @__PURE__ */ new Date()).toISOString() }),
|
|
@@ -862,12 +893,12 @@ var archiveAllRead = (_0) => __async(void 0, [_0], function* ({
|
|
|
862
893
|
inboxService
|
|
863
894
|
)
|
|
864
895
|
);
|
|
865
|
-
emitter.emit("notifications.archive_all_read.pending", { args: { tags }, data: optimisticNotifications });
|
|
866
|
-
yield inboxService.archiveAllRead({ tags });
|
|
867
|
-
emitter.emit("notifications.archive_all_read.resolved", { args: { tags }, data: optimisticNotifications });
|
|
896
|
+
emitter.emit("notifications.archive_all_read.pending", { args: { tags, data }, data: optimisticNotifications });
|
|
897
|
+
yield inboxService.archiveAllRead({ tags, data });
|
|
898
|
+
emitter.emit("notifications.archive_all_read.resolved", { args: { tags, data }, data: optimisticNotifications });
|
|
868
899
|
return {};
|
|
869
900
|
} catch (error) {
|
|
870
|
-
emitter.emit("notifications.archive_all_read.resolved", { args: { tags }, error });
|
|
901
|
+
emitter.emit("notifications.archive_all_read.resolved", { args: { tags, data }, error });
|
|
871
902
|
return { error: new NovuError("Failed to archive all read notifications", error) };
|
|
872
903
|
}
|
|
873
904
|
});
|
|
@@ -904,20 +935,21 @@ var InMemoryCache = class {
|
|
|
904
935
|
_cache = new WeakMap();
|
|
905
936
|
|
|
906
937
|
// src/cache/notifications-cache.ts
|
|
907
|
-
var excludeEmpty = ({ tags, read: read2, archived, snoozed, limit, offset, after }) => Object.entries({ tags, read: read2, archived, snoozed, limit, offset, after }).filter(([_, value]) => value !== null && value !== void 0 && !(Array.isArray(value) && value.length === 0)).reduce((acc, [key, value]) => {
|
|
938
|
+
var excludeEmpty = ({ tags, data, read: read2, archived, snoozed, limit, offset, after }) => Object.entries({ tags, data, read: read2, archived, snoozed, limit, offset, after }).filter(([_, value]) => value !== null && value !== void 0 && !(Array.isArray(value) && value.length === 0)).reduce((acc, [key, value]) => {
|
|
908
939
|
acc[key] = value;
|
|
909
940
|
return acc;
|
|
910
941
|
}, {});
|
|
911
|
-
var getCacheKey = ({ tags, read: read2, archived, snoozed, limit, offset, after }) => {
|
|
912
|
-
return JSON.stringify(excludeEmpty({ tags, read: read2, archived, snoozed, limit, offset, after }));
|
|
942
|
+
var getCacheKey = ({ tags, data, read: read2, archived, snoozed, limit, offset, after }) => {
|
|
943
|
+
return JSON.stringify(excludeEmpty({ tags, data, read: read2, archived, snoozed, limit, offset, after }));
|
|
913
944
|
};
|
|
914
945
|
var getFilterKey = ({
|
|
915
946
|
tags,
|
|
947
|
+
data,
|
|
916
948
|
read: read2,
|
|
917
949
|
archived,
|
|
918
950
|
snoozed
|
|
919
951
|
}) => {
|
|
920
|
-
return JSON.stringify(excludeEmpty({ tags, read: read2, archived, snoozed }));
|
|
952
|
+
return JSON.stringify(excludeEmpty({ tags, data, read: read2, archived, snoozed }));
|
|
921
953
|
};
|
|
922
954
|
var getFilter = (key) => {
|
|
923
955
|
return JSON.parse(key);
|
|
@@ -1049,19 +1081,29 @@ var NotificationsCache = class {
|
|
|
1049
1081
|
}
|
|
1050
1082
|
getAll(args) {
|
|
1051
1083
|
if (this.has(args)) {
|
|
1052
|
-
return this.getAggregated({
|
|
1084
|
+
return this.getAggregated({
|
|
1085
|
+
tags: args.tags,
|
|
1086
|
+
data: args.data,
|
|
1087
|
+
read: args.read,
|
|
1088
|
+
snoozed: args.snoozed,
|
|
1089
|
+
archived: args.archived
|
|
1090
|
+
});
|
|
1053
1091
|
}
|
|
1054
1092
|
}
|
|
1055
1093
|
/**
|
|
1056
1094
|
* Get unique notifications based on specified filter fields.
|
|
1057
|
-
* The same tags can be applied to multiple filters which means that the same notification can be duplicated.
|
|
1095
|
+
* The same tags and data can be applied to multiple filters which means that the same notification can be duplicated.
|
|
1058
1096
|
*/
|
|
1059
|
-
getUniqueNotifications({
|
|
1097
|
+
getUniqueNotifications({
|
|
1098
|
+
tags,
|
|
1099
|
+
read: read2,
|
|
1100
|
+
data
|
|
1101
|
+
}) {
|
|
1060
1102
|
const keys = __privateGet(this, _cache2).keys();
|
|
1061
1103
|
const uniqueNotifications = /* @__PURE__ */ new Map();
|
|
1062
1104
|
keys.forEach((key) => {
|
|
1063
1105
|
const filter = getFilter(key);
|
|
1064
|
-
if (areTagsEqual(tags, filter.tags)) {
|
|
1106
|
+
if (areTagsEqual(tags, filter.tags) && areDataEqual(data, filter.data)) {
|
|
1065
1107
|
const value = __privateGet(this, _cache2).get(key);
|
|
1066
1108
|
if (!value) {
|
|
1067
1109
|
return;
|
|
@@ -1293,42 +1335,54 @@ var Notifications = class extends BaseModule {
|
|
|
1293
1335
|
});
|
|
1294
1336
|
}
|
|
1295
1337
|
readAll() {
|
|
1296
|
-
return __async(this, arguments, function* ({
|
|
1338
|
+
return __async(this, arguments, function* ({
|
|
1339
|
+
tags,
|
|
1340
|
+
data
|
|
1341
|
+
} = {}) {
|
|
1297
1342
|
return this.callWithSession(
|
|
1298
1343
|
() => __async(this, null, function* () {
|
|
1299
1344
|
return readAll({
|
|
1300
1345
|
emitter: this._emitter,
|
|
1301
1346
|
inboxService: this._inboxService,
|
|
1302
1347
|
notificationsCache: this.cache,
|
|
1303
|
-
tags
|
|
1348
|
+
tags,
|
|
1349
|
+
data
|
|
1304
1350
|
});
|
|
1305
1351
|
})
|
|
1306
1352
|
);
|
|
1307
1353
|
});
|
|
1308
1354
|
}
|
|
1309
1355
|
archiveAll() {
|
|
1310
|
-
return __async(this, arguments, function* ({
|
|
1356
|
+
return __async(this, arguments, function* ({
|
|
1357
|
+
tags,
|
|
1358
|
+
data
|
|
1359
|
+
} = {}) {
|
|
1311
1360
|
return this.callWithSession(
|
|
1312
1361
|
() => __async(this, null, function* () {
|
|
1313
1362
|
return archiveAll({
|
|
1314
1363
|
emitter: this._emitter,
|
|
1315
1364
|
inboxService: this._inboxService,
|
|
1316
1365
|
notificationsCache: this.cache,
|
|
1317
|
-
tags
|
|
1366
|
+
tags,
|
|
1367
|
+
data
|
|
1318
1368
|
});
|
|
1319
1369
|
})
|
|
1320
1370
|
);
|
|
1321
1371
|
});
|
|
1322
1372
|
}
|
|
1323
1373
|
archiveAllRead() {
|
|
1324
|
-
return __async(this, arguments, function* ({
|
|
1374
|
+
return __async(this, arguments, function* ({
|
|
1375
|
+
tags,
|
|
1376
|
+
data
|
|
1377
|
+
} = {}) {
|
|
1325
1378
|
return this.callWithSession(
|
|
1326
1379
|
() => __async(this, null, function* () {
|
|
1327
1380
|
return archiveAllRead({
|
|
1328
1381
|
emitter: this._emitter,
|
|
1329
1382
|
inboxService: this._inboxService,
|
|
1330
1383
|
notificationsCache: this.cache,
|
|
1331
|
-
tags
|
|
1384
|
+
tags,
|
|
1385
|
+
data
|
|
1332
1386
|
});
|
|
1333
1387
|
})
|
|
1334
1388
|
);
|
package/dist/esm/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { N as NotificationFilter } from './novu-
|
|
2
|
-
export { C as ChannelPreference, c as ChannelType, E as EventHandler, a as Events, F as FiltersCountResponse, I as InboxNotification, L as ListNotificationsResponse, d as Notification, e as NotificationStatus, b as Novu, f as NovuError, g as NovuOptions, P as Preference, h as PreferenceLevel, i as PreferencesResponse, S as SocketEventNames, j as Subscriber, W as WebSocketEvent } from './novu-
|
|
1
|
+
import { N as NotificationFilter } from './novu-q3jzGeyW.mjs';
|
|
2
|
+
export { C as ChannelPreference, c as ChannelType, E as EventHandler, a as Events, F as FiltersCountResponse, I as InboxNotification, L as ListNotificationsResponse, d as Notification, e as NotificationStatus, b as Novu, f as NovuError, g as NovuOptions, P as Preference, h as PreferenceLevel, i as PreferencesResponse, S as SocketEventNames, j as Subscriber, W as WebSocketEvent } from './novu-q3jzGeyW.mjs';
|
|
3
3
|
|
|
4
4
|
declare const areTagsEqual: (tags1?: string[], tags2?: string[]) => boolean;
|
|
5
5
|
declare const isSameFilter: (filter1: NotificationFilter, filter2: NotificationFilter) => boolean;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { ChannelType, NotificationStatus, Novu, PreferenceLevel, WebSocketEvent, areTagsEqual, isSameFilter } from './chunk-
|
|
1
|
+
export { ChannelType, NotificationStatus, Novu, PreferenceLevel, WebSocketEvent, areTagsEqual, isSameFilter } from './chunk-GPGRFVOZ.mjs';
|
|
2
2
|
import './chunk-STZMOEWR.mjs';
|
|
@@ -148,6 +148,7 @@ type NotificationFilter = {
|
|
|
148
148
|
read?: boolean;
|
|
149
149
|
archived?: boolean;
|
|
150
150
|
snoozed?: boolean;
|
|
151
|
+
data?: Record<string, unknown>;
|
|
151
152
|
};
|
|
152
153
|
type ChannelPreference = {
|
|
153
154
|
email?: boolean;
|
|
@@ -214,7 +215,7 @@ declare class InboxService {
|
|
|
214
215
|
subscriberHash?: string;
|
|
215
216
|
subscriber: Subscriber;
|
|
216
217
|
}): Promise<Session>;
|
|
217
|
-
fetchNotifications({ after, archived, limit, offset, read, tags, snoozed, }: {
|
|
218
|
+
fetchNotifications({ after, archived, limit, offset, read, tags, snoozed, data, }: {
|
|
218
219
|
tags?: string[];
|
|
219
220
|
read?: boolean;
|
|
220
221
|
archived?: boolean;
|
|
@@ -222,16 +223,18 @@ declare class InboxService {
|
|
|
222
223
|
limit?: number;
|
|
223
224
|
after?: string;
|
|
224
225
|
offset?: number;
|
|
226
|
+
data?: Record<string, unknown>;
|
|
225
227
|
}): Promise<{
|
|
226
228
|
data: InboxNotification[];
|
|
227
229
|
hasMore: boolean;
|
|
228
230
|
filter: NotificationFilter;
|
|
229
231
|
}>;
|
|
230
|
-
count({ filters }: {
|
|
232
|
+
count({ filters, }: {
|
|
231
233
|
filters: Array<{
|
|
232
234
|
tags?: string[];
|
|
233
235
|
read?: boolean;
|
|
234
236
|
archived?: boolean;
|
|
237
|
+
data?: Record<string, unknown>;
|
|
235
238
|
}>;
|
|
236
239
|
}): Promise<{
|
|
237
240
|
data: Array<{
|
|
@@ -245,14 +248,17 @@ declare class InboxService {
|
|
|
245
248
|
unarchive(notificationId: string): Promise<InboxNotification>;
|
|
246
249
|
snooze(notificationId: string, snoozeUntil: string): Promise<InboxNotification>;
|
|
247
250
|
unsnooze(notificationId: string): Promise<InboxNotification>;
|
|
248
|
-
readAll({ tags }: {
|
|
251
|
+
readAll({ tags, data }: {
|
|
249
252
|
tags?: string[];
|
|
253
|
+
data?: Record<string, unknown>;
|
|
250
254
|
}): Promise<void>;
|
|
251
|
-
archiveAll({ tags }: {
|
|
255
|
+
archiveAll({ tags, data }: {
|
|
252
256
|
tags?: string[];
|
|
257
|
+
data?: Record<string, unknown>;
|
|
253
258
|
}): Promise<void>;
|
|
254
|
-
archiveAllRead({ tags }: {
|
|
259
|
+
archiveAllRead({ tags, data }: {
|
|
255
260
|
tags?: string[];
|
|
261
|
+
data?: Record<string, unknown>;
|
|
256
262
|
}): Promise<void>;
|
|
257
263
|
completeAction({ actionType, notificationId, }: {
|
|
258
264
|
notificationId: string;
|
|
@@ -330,6 +336,7 @@ declare class Notification implements Pick<NovuEventEmitter, 'on'>, InboxNotific
|
|
|
330
336
|
type ListNotificationsArgs = {
|
|
331
337
|
tags?: string[];
|
|
332
338
|
read?: boolean;
|
|
339
|
+
data?: Record<string, unknown>;
|
|
333
340
|
archived?: boolean;
|
|
334
341
|
snoozed?: boolean;
|
|
335
342
|
limit?: number;
|
|
@@ -344,6 +351,7 @@ type ListNotificationsResponse = {
|
|
|
344
351
|
};
|
|
345
352
|
type FilterCountArgs = {
|
|
346
353
|
tags?: string[];
|
|
354
|
+
data?: Record<string, unknown>;
|
|
347
355
|
read?: boolean;
|
|
348
356
|
archived?: boolean;
|
|
349
357
|
snoozed?: boolean;
|
|
@@ -354,6 +362,7 @@ type FiltersCountArgs = {
|
|
|
354
362
|
read?: boolean;
|
|
355
363
|
archived?: boolean;
|
|
356
364
|
snoozed?: boolean;
|
|
365
|
+
data?: Record<string, unknown>;
|
|
357
366
|
}>;
|
|
358
367
|
};
|
|
359
368
|
type CountArgs = undefined | FilterCountArgs | FiltersCountArgs;
|
|
@@ -400,9 +409,9 @@ declare class NotificationsCache {
|
|
|
400
409
|
getAll(args: ListNotificationsArgs): ListNotificationsResponse | undefined;
|
|
401
410
|
/**
|
|
402
411
|
* Get unique notifications based on specified filter fields.
|
|
403
|
-
* The same tags can be applied to multiple filters which means that the same notification can be duplicated.
|
|
412
|
+
* The same tags and data can be applied to multiple filters which means that the same notification can be duplicated.
|
|
404
413
|
*/
|
|
405
|
-
getUniqueNotifications({ tags, read }: Pick<ListNotificationsArgs, 'tags' | 'read'>): Array<Notification>;
|
|
414
|
+
getUniqueNotifications({ tags, read, data, }: Pick<ListNotificationsArgs, 'tags' | 'read' | 'data'>): Array<Notification>;
|
|
406
415
|
clear(filter: NotificationFilter): void;
|
|
407
416
|
clearAll(): void;
|
|
408
417
|
}
|
|
@@ -437,14 +446,17 @@ declare class Notifications extends BaseModule {
|
|
|
437
446
|
revertPrimary(args: InstanceArgs): Result<Notification>;
|
|
438
447
|
revertSecondary(args: BaseArgs): Result<Notification>;
|
|
439
448
|
revertSecondary(args: InstanceArgs): Result<Notification>;
|
|
440
|
-
readAll({ tags }?: {
|
|
449
|
+
readAll({ tags, data, }?: {
|
|
441
450
|
tags?: NotificationFilter['tags'];
|
|
451
|
+
data?: Record<string, unknown>;
|
|
442
452
|
}): Result<void>;
|
|
443
|
-
archiveAll({ tags }?: {
|
|
453
|
+
archiveAll({ tags, data, }?: {
|
|
444
454
|
tags?: NotificationFilter['tags'];
|
|
455
|
+
data?: Record<string, unknown>;
|
|
445
456
|
}): Result<void>;
|
|
446
|
-
archiveAllRead({ tags }?: {
|
|
457
|
+
archiveAllRead({ tags, data, }?: {
|
|
447
458
|
tags?: NotificationFilter['tags'];
|
|
459
|
+
data?: Record<string, unknown>;
|
|
448
460
|
}): Result<void>;
|
|
449
461
|
clearCache({ filter }?: {
|
|
450
462
|
filter?: NotificationFilter;
|
|
@@ -483,12 +495,15 @@ type NotificationCompleteActionEvents = BaseEvents<'notification.complete_action
|
|
|
483
495
|
type NotificationRevertActionEvents = BaseEvents<'notification.revert_action', RevertArgs, Notification>;
|
|
484
496
|
type NotificationsReadAllEvents = BaseEvents<'notifications.read_all', {
|
|
485
497
|
tags?: string[];
|
|
498
|
+
data?: Record<string, unknown>;
|
|
486
499
|
}, Notification[]>;
|
|
487
500
|
type NotificationsArchivedAllEvents = BaseEvents<'notifications.archive_all', {
|
|
488
501
|
tags?: string[];
|
|
502
|
+
data?: Record<string, unknown>;
|
|
489
503
|
}, Notification[]>;
|
|
490
504
|
type NotificationsReadArchivedAllEvents = BaseEvents<'notifications.archive_all_read', {
|
|
491
505
|
tags?: string[];
|
|
506
|
+
data?: Record<string, unknown>;
|
|
492
507
|
}, Notification[]>;
|
|
493
508
|
type PreferencesFetchEvents = BaseEvents<'preferences.list', ListPreferencesArgs, Preference[]>;
|
|
494
509
|
type PreferenceUpdateEvents = BaseEvents<'preference.update', UpdatePreferenceArgs, Preference>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as Notification, N as NotificationFilter, g as NovuOptions, b as Novu, P as Preference } from './novu-
|
|
1
|
+
import { d as Notification, N as NotificationFilter, g as NovuOptions, b as Novu, P as Preference } from './novu-q3jzGeyW.mjs';
|
|
2
2
|
|
|
3
3
|
declare const appearanceKeys: readonly ["button", "input", "icon", "badge", "popoverContent", "popoverTrigger", "popoverClose", "dropdownContent", "dropdownTrigger", "dropdownItem", "dropdownItemLabel", "dropdownItemLabelContainer", "dropdownItemLeft__icon", "dropdownItemRight__icon", "dropdownItem__icon", "collapsible", "tooltipContent", "tooltipTrigger", "datePicker", "datePickerGrid", "datePickerGridRow", "datePickerGridCell", "datePickerGridCellTrigger", "datePickerTrigger", "datePickerGridHeader", "datePickerControl", "datePickerControlPrevTrigger", "datePickerControlNextTrigger", "datePickerControlPrevTrigger__icon", "datePickerControlNextTrigger__icon", "datePickerCalendar", "datePickerHeaderMonth", "datePickerCalendarDay__button", "timePicker", "timePicker__hourSelect", "timePicker__minuteSelect", "timePicker__periodSelect", "timePicker__separator", "timePickerHour__input", "timePickerMinute__input", "snoozeDatePicker", "snoozeDatePicker__actions", "snoozeDatePickerCancel__button", "snoozeDatePickerApply__button", "snoozeDatePicker__timePickerContainer", "snoozeDatePicker__timePickerLabel", "back__button", "skeletonText", "skeletonAvatar", "skeletonSwitch", "skeletonSwitchThumb", "tabsRoot", "tabsList", "tabsContent", "tabsTrigger", "dots", "root", "bellIcon", "bellContainer", "bellDot", "preferences__button", "preferencesContainer", "inboxHeader", "loading", "inboxContent", "inbox__popoverTrigger", "inbox__popoverContent", "notificationListContainer", "notificationList", "notificationListEmptyNoticeContainer", "notificationListEmptyNoticeOverlay", "notificationListEmptyNoticeIcon", "notificationListEmptyNotice", "notificationList__skeleton", "notificationList__skeletonContent", "notificationList__skeletonItem", "notificationList__skeletonAvatar", "notificationList__skeletonText", "notificationListNewNotificationsNotice__button", "notification", "notificationContent", "notificationTextContainer", "notificationDot", "notificationSubject", "notificationSubject__strong", "notificationBody", "notificationBody__strong", "notificationBodyContainer", "notificationImage", "notificationImageLoadingFallback", "notificationDate", "notificationDateActionsContainer", "notificationDefaultActions", "notificationCustomActions", "notificationPrimaryAction__button", "notificationSecondaryAction__button", "notificationRead__button", "notificationUnread__button", "notificationArchive__button", "notificationUnarchive__button", "notificationSnooze__button", "notificationUnsnooze__button", "notificationRead__icon", "notificationUnread__icon", "notificationArchive__icon", "notificationUnarchive__icon", "notificationSnooze__icon", "notificationUnsnooze__icon", "notificationsTabs__tabsRoot", "notificationsTabs__tabsList", "notificationsTabs__tabsContent", "notificationsTabs__tabsTrigger", "notificationsTabsTriggerLabel", "notificationsTabsTriggerCount", "inboxStatus__title", "inboxStatus__dropdownTrigger", "inboxStatus__dropdownContent", "inboxStatus__dropdownItem", "inboxStatus__dropdownItemLabel", "inboxStatus__dropdownItemLabelContainer", "inboxStatus__dropdownItemLeft__icon", "inboxStatus__dropdownItemRight__icon", "inboxStatus__dropdownItem__icon", "inboxStatus__dropdownItemCheck__icon", "moreActionsContainer", "moreActions__dropdownTrigger", "moreActions__dropdownContent", "moreActions__dropdownItem", "moreActions__dropdownItemLabel", "moreActions__dropdownItemLeft__icon", "moreActions__dots", "moreTabs__button", "moreTabs__icon", "moreTabs__dropdownTrigger", "moreTabs__dropdownContent", "moreTabs__dropdownItem", "moreTabs__dropdownItemLabel", "moreTabs__dropdownItemRight__icon", "workflowContainer", "workflowLabel", "workflowLabelHeader", "workflowLabelHeaderContainer", "workflowLabelIcon", "workflowLabelContainer", "workflowContainerDisabledNotice", "workflowLabelDisabled__icon", "workflowContainerRight__icon", "workflowArrow__icon", "workflowDescription", "preferencesGroupContainer", "preferencesGroupHeader", "preferencesGroupLabelContainer", "preferencesGroupLabelIcon", "preferencesGroupLabel", "preferencesGroupActionsContainer", "preferencesGroupActionsContainerRight__icon", "preferencesGroupBody", "preferencesGroupChannels", "preferencesGroupInfo", "preferencesGroupInfoIcon", "preferencesGroupWorkflows", "channelContainer", "channelIconContainer", "channel__icon", "channelsContainerCollapsible", "channelsContainer", "channelLabel", "channelLabelContainer", "channelName", "channelSwitchContainer", "channelSwitch", "channelSwitchThumb", "preferencesHeader", "preferencesHeader__back__button", "preferencesHeader__back__button__icon", "preferencesHeader__title", "preferencesHeader__icon", "preferencesListEmptyNoticeContainer", "preferencesListEmptyNotice", "preferencesList__skeleton", "preferencesList__skeletonContent", "preferencesList__skeletonItem", "preferencesList__skeletonIcon", "preferencesList__skeletonSwitch", "preferencesList__skeletonSwitchThumb", "preferencesList__skeletonText", "notificationSnooze__dropdownContent", "notificationSnooze__dropdownItem", "notificationSnooze__dropdownItem__icon", "notificationSnoozeCustomTime_popoverContent", "notificationDeliveredAt__badge", "notificationDeliveredAt__icon", "notificationSnoozedUntil__icon", "strong"];
|
|
4
4
|
|
|
@@ -66,7 +66,7 @@ type Tab = {
|
|
|
66
66
|
* @deprecated Use `filter` instead
|
|
67
67
|
*/
|
|
68
68
|
value?: Array<string>;
|
|
69
|
-
filter?: Pick<NotificationFilter, 'tags'>;
|
|
69
|
+
filter?: Pick<NotificationFilter, 'tags' | 'data'>;
|
|
70
70
|
};
|
|
71
71
|
type CSSProperties = {
|
|
72
72
|
[key: string]: string | number;
|
package/dist/esm/ui/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as NovuOptions } from '../novu-
|
|
2
|
-
export { d as Notification } from '../novu-
|
|
3
|
-
import { B as BellRenderer, N as NotificationClickHandler, a as NotificationActionClickHandler, b as NotificationRenderer, S as SubjectRenderer, c as BodyRenderer, d as NovuProviderProps, e as BaseNovuProviderProps, A as Appearance, L as Localization, T as Tab, P as PreferencesFilter, f as PreferenceGroups, R as RouterPush } from '../types-
|
|
4
|
-
export { g as AppearanceKey, h as ElementStyles, E as Elements, I as IconKey, i as IconOverrides, j as IconRenderer, k as LocalizationKey, l as NotificationStatus, m as Theme, V as Variables } from '../types-
|
|
1
|
+
import { g as NovuOptions } from '../novu-q3jzGeyW.mjs';
|
|
2
|
+
export { d as Notification } from '../novu-q3jzGeyW.mjs';
|
|
3
|
+
import { B as BellRenderer, N as NotificationClickHandler, a as NotificationActionClickHandler, b as NotificationRenderer, S as SubjectRenderer, c as BodyRenderer, d as NovuProviderProps, e as BaseNovuProviderProps, A as Appearance, L as Localization, T as Tab, P as PreferencesFilter, f as PreferenceGroups, R as RouterPush } from '../types-CTQLJWIf.mjs';
|
|
4
|
+
export { g as AppearanceKey, h as ElementStyles, E as Elements, I as IconKey, i as IconOverrides, j as IconRenderer, k as LocalizationKey, l as NotificationStatus, m as Theme, V as Variables } from '../types-CTQLJWIf.mjs';
|
|
5
5
|
import { Placement, OffsetOptions } from '@floating-ui/dom';
|
|
6
6
|
import * as solid_js from 'solid-js';
|
|
7
7
|
import { ComponentProps } from 'solid-js';
|