@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
|
@@ -55,14 +55,27 @@ var arrayValuesEqual = (arr1, arr2) => {
|
|
|
55
55
|
var areTagsEqual = (tags1, tags2) => {
|
|
56
56
|
return arrayValuesEqual(tags1, tags2) || !tags1 && (tags2 == null ? void 0 : tags2.length) === 0 || (tags1 == null ? void 0 : tags1.length) === 0 && !tags2;
|
|
57
57
|
};
|
|
58
|
+
var areDataEqual = (data1, data2) => {
|
|
59
|
+
if (!data1 && !data2) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
if (!data1 || !data2) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
return JSON.stringify(data1) === JSON.stringify(data2);
|
|
67
|
+
} catch (e) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
58
71
|
var isSameFilter = (filter1, filter2) => {
|
|
59
|
-
return areTagsEqual(filter1.tags, filter2.tags) && filter1.read === filter2.read && filter1.archived === filter2.archived && filter1.snoozed === filter2.snoozed;
|
|
72
|
+
return areDataEqual(filter1.data, filter2.data) && areTagsEqual(filter1.tags, filter2.tags) && filter1.read === filter2.read && filter1.archived === filter2.archived && filter1.snoozed === filter2.snoozed;
|
|
60
73
|
};
|
|
61
74
|
|
|
62
75
|
// src/api/http-client.ts
|
|
63
76
|
var DEFAULT_API_VERSION = "v1";
|
|
64
77
|
var DEFAULT_BACKEND_URL = "https://api.novu.co";
|
|
65
|
-
var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.
|
|
78
|
+
var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.5.0-rc.2"}`;
|
|
66
79
|
var HttpClient = class {
|
|
67
80
|
constructor(options = {}) {
|
|
68
81
|
const {
|
|
@@ -197,7 +210,8 @@ var InboxService = class {
|
|
|
197
210
|
offset,
|
|
198
211
|
read: read2,
|
|
199
212
|
tags,
|
|
200
|
-
snoozed
|
|
213
|
+
snoozed,
|
|
214
|
+
data
|
|
201
215
|
}) {
|
|
202
216
|
const searchParams = new URLSearchParams(`limit=${limit}`);
|
|
203
217
|
if (after) {
|
|
@@ -218,9 +232,14 @@ var InboxService = class {
|
|
|
218
232
|
if (snoozed !== void 0) {
|
|
219
233
|
searchParams.append("snoozed", `${snoozed}`);
|
|
220
234
|
}
|
|
235
|
+
if (data !== void 0) {
|
|
236
|
+
searchParams.append("data", JSON.stringify(data));
|
|
237
|
+
}
|
|
221
238
|
return chunk7B52C2XE_js.__privateGet(this, _httpClient).get(INBOX_NOTIFICATIONS_ROUTE, searchParams, false);
|
|
222
239
|
}
|
|
223
|
-
count({
|
|
240
|
+
count({
|
|
241
|
+
filters
|
|
242
|
+
}) {
|
|
224
243
|
return chunk7B52C2XE_js.__privateGet(this, _httpClient).get(
|
|
225
244
|
`${INBOX_NOTIFICATIONS_ROUTE}/count`,
|
|
226
245
|
new URLSearchParams({
|
|
@@ -247,14 +266,23 @@ var InboxService = class {
|
|
|
247
266
|
unsnooze(notificationId) {
|
|
248
267
|
return chunk7B52C2XE_js.__privateGet(this, _httpClient).patch(`${INBOX_NOTIFICATIONS_ROUTE}/${notificationId}/unsnooze`);
|
|
249
268
|
}
|
|
250
|
-
readAll({ tags }) {
|
|
251
|
-
return chunk7B52C2XE_js.__privateGet(this, _httpClient).post(`${INBOX_NOTIFICATIONS_ROUTE}/read`, {
|
|
269
|
+
readAll({ tags, data }) {
|
|
270
|
+
return chunk7B52C2XE_js.__privateGet(this, _httpClient).post(`${INBOX_NOTIFICATIONS_ROUTE}/read`, {
|
|
271
|
+
tags,
|
|
272
|
+
data: data ? JSON.stringify(data) : void 0
|
|
273
|
+
});
|
|
252
274
|
}
|
|
253
|
-
archiveAll({ tags }) {
|
|
254
|
-
return chunk7B52C2XE_js.__privateGet(this, _httpClient).post(`${INBOX_NOTIFICATIONS_ROUTE}/archive`, {
|
|
275
|
+
archiveAll({ tags, data }) {
|
|
276
|
+
return chunk7B52C2XE_js.__privateGet(this, _httpClient).post(`${INBOX_NOTIFICATIONS_ROUTE}/archive`, {
|
|
277
|
+
tags,
|
|
278
|
+
data: data ? JSON.stringify(data) : void 0
|
|
279
|
+
});
|
|
255
280
|
}
|
|
256
|
-
archiveAllRead({ tags }) {
|
|
257
|
-
return chunk7B52C2XE_js.__privateGet(this, _httpClient).post(`${INBOX_NOTIFICATIONS_ROUTE}/read-archive`, {
|
|
281
|
+
archiveAllRead({ tags, data }) {
|
|
282
|
+
return chunk7B52C2XE_js.__privateGet(this, _httpClient).post(`${INBOX_NOTIFICATIONS_ROUTE}/read-archive`, {
|
|
283
|
+
tags,
|
|
284
|
+
data: data ? JSON.stringify(data) : void 0
|
|
285
|
+
});
|
|
258
286
|
}
|
|
259
287
|
completeAction({
|
|
260
288
|
actionType,
|
|
@@ -800,10 +828,11 @@ var readAll = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
|
800
828
|
emitter,
|
|
801
829
|
inboxService,
|
|
802
830
|
notificationsCache,
|
|
803
|
-
tags
|
|
831
|
+
tags,
|
|
832
|
+
data
|
|
804
833
|
}) {
|
|
805
834
|
try {
|
|
806
|
-
const notifications = notificationsCache.getUniqueNotifications({ tags });
|
|
835
|
+
const notifications = notificationsCache.getUniqueNotifications({ tags, data });
|
|
807
836
|
const optimisticNotifications = notifications.map(
|
|
808
837
|
(notification) => new Notification(
|
|
809
838
|
chunk7B52C2XE_js.__spreadProps(chunk7B52C2XE_js.__spreadValues({}, notification), {
|
|
@@ -816,12 +845,12 @@ var readAll = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
|
816
845
|
inboxService
|
|
817
846
|
)
|
|
818
847
|
);
|
|
819
|
-
emitter.emit("notifications.read_all.pending", { args: { tags }, data: optimisticNotifications });
|
|
820
|
-
yield inboxService.readAll({ tags });
|
|
821
|
-
emitter.emit("notifications.read_all.resolved", { args: { tags }, data: optimisticNotifications });
|
|
848
|
+
emitter.emit("notifications.read_all.pending", { args: { tags, data }, data: optimisticNotifications });
|
|
849
|
+
yield inboxService.readAll({ tags, data });
|
|
850
|
+
emitter.emit("notifications.read_all.resolved", { args: { tags, data }, data: optimisticNotifications });
|
|
822
851
|
return {};
|
|
823
852
|
} catch (error) {
|
|
824
|
-
emitter.emit("notifications.read_all.resolved", { args: { tags }, error });
|
|
853
|
+
emitter.emit("notifications.read_all.resolved", { args: { tags, data }, error });
|
|
825
854
|
return { error: new NovuError("Failed to read all notifications", error) };
|
|
826
855
|
}
|
|
827
856
|
});
|
|
@@ -829,10 +858,11 @@ var archiveAll = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
|
829
858
|
emitter,
|
|
830
859
|
inboxService,
|
|
831
860
|
notificationsCache,
|
|
832
|
-
tags
|
|
861
|
+
tags,
|
|
862
|
+
data
|
|
833
863
|
}) {
|
|
834
864
|
try {
|
|
835
|
-
const notifications = notificationsCache.getUniqueNotifications({ tags });
|
|
865
|
+
const notifications = notificationsCache.getUniqueNotifications({ tags, data });
|
|
836
866
|
const optimisticNotifications = notifications.map(
|
|
837
867
|
(notification) => new Notification(
|
|
838
868
|
chunk7B52C2XE_js.__spreadProps(chunk7B52C2XE_js.__spreadValues({}, notification), {
|
|
@@ -845,12 +875,12 @@ var archiveAll = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
|
845
875
|
inboxService
|
|
846
876
|
)
|
|
847
877
|
);
|
|
848
|
-
emitter.emit("notifications.archive_all.pending", { args: { tags }, data: optimisticNotifications });
|
|
849
|
-
yield inboxService.archiveAll({ tags });
|
|
850
|
-
emitter.emit("notifications.archive_all.resolved", { args: { tags }, data: optimisticNotifications });
|
|
878
|
+
emitter.emit("notifications.archive_all.pending", { args: { tags, data }, data: optimisticNotifications });
|
|
879
|
+
yield inboxService.archiveAll({ tags, data });
|
|
880
|
+
emitter.emit("notifications.archive_all.resolved", { args: { tags, data }, data: optimisticNotifications });
|
|
851
881
|
return {};
|
|
852
882
|
} catch (error) {
|
|
853
|
-
emitter.emit("notifications.archive_all.resolved", { args: { tags }, error });
|
|
883
|
+
emitter.emit("notifications.archive_all.resolved", { args: { tags, data }, error });
|
|
854
884
|
return { error: new NovuError("Failed to archive all notifications", error) };
|
|
855
885
|
}
|
|
856
886
|
});
|
|
@@ -858,10 +888,11 @@ var archiveAllRead = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
|
858
888
|
emitter,
|
|
859
889
|
inboxService,
|
|
860
890
|
notificationsCache,
|
|
861
|
-
tags
|
|
891
|
+
tags,
|
|
892
|
+
data
|
|
862
893
|
}) {
|
|
863
894
|
try {
|
|
864
|
-
const notifications = notificationsCache.getUniqueNotifications({ tags, read: true });
|
|
895
|
+
const notifications = notificationsCache.getUniqueNotifications({ tags, data, read: true });
|
|
865
896
|
const optimisticNotifications = notifications.map(
|
|
866
897
|
(notification) => new Notification(
|
|
867
898
|
chunk7B52C2XE_js.__spreadProps(chunk7B52C2XE_js.__spreadValues({}, notification), { isArchived: true, archivedAt: (/* @__PURE__ */ new Date()).toISOString() }),
|
|
@@ -869,12 +900,12 @@ var archiveAllRead = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
|
869
900
|
inboxService
|
|
870
901
|
)
|
|
871
902
|
);
|
|
872
|
-
emitter.emit("notifications.archive_all_read.pending", { args: { tags }, data: optimisticNotifications });
|
|
873
|
-
yield inboxService.archiveAllRead({ tags });
|
|
874
|
-
emitter.emit("notifications.archive_all_read.resolved", { args: { tags }, data: optimisticNotifications });
|
|
903
|
+
emitter.emit("notifications.archive_all_read.pending", { args: { tags, data }, data: optimisticNotifications });
|
|
904
|
+
yield inboxService.archiveAllRead({ tags, data });
|
|
905
|
+
emitter.emit("notifications.archive_all_read.resolved", { args: { tags, data }, data: optimisticNotifications });
|
|
875
906
|
return {};
|
|
876
907
|
} catch (error) {
|
|
877
|
-
emitter.emit("notifications.archive_all_read.resolved", { args: { tags }, error });
|
|
908
|
+
emitter.emit("notifications.archive_all_read.resolved", { args: { tags, data }, error });
|
|
878
909
|
return { error: new NovuError("Failed to archive all read notifications", error) };
|
|
879
910
|
}
|
|
880
911
|
});
|
|
@@ -911,20 +942,21 @@ var InMemoryCache = class {
|
|
|
911
942
|
_cache = new WeakMap();
|
|
912
943
|
|
|
913
944
|
// src/cache/notifications-cache.ts
|
|
914
|
-
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]) => {
|
|
945
|
+
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]) => {
|
|
915
946
|
acc[key] = value;
|
|
916
947
|
return acc;
|
|
917
948
|
}, {});
|
|
918
|
-
var getCacheKey = ({ tags, read: read2, archived, snoozed, limit, offset, after }) => {
|
|
919
|
-
return JSON.stringify(excludeEmpty({ tags, read: read2, archived, snoozed, limit, offset, after }));
|
|
949
|
+
var getCacheKey = ({ tags, data, read: read2, archived, snoozed, limit, offset, after }) => {
|
|
950
|
+
return JSON.stringify(excludeEmpty({ tags, data, read: read2, archived, snoozed, limit, offset, after }));
|
|
920
951
|
};
|
|
921
952
|
var getFilterKey = ({
|
|
922
953
|
tags,
|
|
954
|
+
data,
|
|
923
955
|
read: read2,
|
|
924
956
|
archived,
|
|
925
957
|
snoozed
|
|
926
958
|
}) => {
|
|
927
|
-
return JSON.stringify(excludeEmpty({ tags, read: read2, archived, snoozed }));
|
|
959
|
+
return JSON.stringify(excludeEmpty({ tags, data, read: read2, archived, snoozed }));
|
|
928
960
|
};
|
|
929
961
|
var getFilter = (key) => {
|
|
930
962
|
return JSON.parse(key);
|
|
@@ -1056,19 +1088,29 @@ var NotificationsCache = class {
|
|
|
1056
1088
|
}
|
|
1057
1089
|
getAll(args) {
|
|
1058
1090
|
if (this.has(args)) {
|
|
1059
|
-
return this.getAggregated({
|
|
1091
|
+
return this.getAggregated({
|
|
1092
|
+
tags: args.tags,
|
|
1093
|
+
data: args.data,
|
|
1094
|
+
read: args.read,
|
|
1095
|
+
snoozed: args.snoozed,
|
|
1096
|
+
archived: args.archived
|
|
1097
|
+
});
|
|
1060
1098
|
}
|
|
1061
1099
|
}
|
|
1062
1100
|
/**
|
|
1063
1101
|
* Get unique notifications based on specified filter fields.
|
|
1064
|
-
* The same tags can be applied to multiple filters which means that the same notification can be duplicated.
|
|
1102
|
+
* The same tags and data can be applied to multiple filters which means that the same notification can be duplicated.
|
|
1065
1103
|
*/
|
|
1066
|
-
getUniqueNotifications({
|
|
1104
|
+
getUniqueNotifications({
|
|
1105
|
+
tags,
|
|
1106
|
+
read: read2,
|
|
1107
|
+
data
|
|
1108
|
+
}) {
|
|
1067
1109
|
const keys = chunk7B52C2XE_js.__privateGet(this, _cache2).keys();
|
|
1068
1110
|
const uniqueNotifications = /* @__PURE__ */ new Map();
|
|
1069
1111
|
keys.forEach((key) => {
|
|
1070
1112
|
const filter = getFilter(key);
|
|
1071
|
-
if (areTagsEqual(tags, filter.tags)) {
|
|
1113
|
+
if (areTagsEqual(tags, filter.tags) && areDataEqual(data, filter.data)) {
|
|
1072
1114
|
const value = chunk7B52C2XE_js.__privateGet(this, _cache2).get(key);
|
|
1073
1115
|
if (!value) {
|
|
1074
1116
|
return;
|
|
@@ -1300,42 +1342,54 @@ var Notifications = class extends BaseModule {
|
|
|
1300
1342
|
});
|
|
1301
1343
|
}
|
|
1302
1344
|
readAll() {
|
|
1303
|
-
return chunk7B52C2XE_js.__async(this, arguments, function* ({
|
|
1345
|
+
return chunk7B52C2XE_js.__async(this, arguments, function* ({
|
|
1346
|
+
tags,
|
|
1347
|
+
data
|
|
1348
|
+
} = {}) {
|
|
1304
1349
|
return this.callWithSession(
|
|
1305
1350
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1306
1351
|
return readAll({
|
|
1307
1352
|
emitter: this._emitter,
|
|
1308
1353
|
inboxService: this._inboxService,
|
|
1309
1354
|
notificationsCache: this.cache,
|
|
1310
|
-
tags
|
|
1355
|
+
tags,
|
|
1356
|
+
data
|
|
1311
1357
|
});
|
|
1312
1358
|
})
|
|
1313
1359
|
);
|
|
1314
1360
|
});
|
|
1315
1361
|
}
|
|
1316
1362
|
archiveAll() {
|
|
1317
|
-
return chunk7B52C2XE_js.__async(this, arguments, function* ({
|
|
1363
|
+
return chunk7B52C2XE_js.__async(this, arguments, function* ({
|
|
1364
|
+
tags,
|
|
1365
|
+
data
|
|
1366
|
+
} = {}) {
|
|
1318
1367
|
return this.callWithSession(
|
|
1319
1368
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1320
1369
|
return archiveAll({
|
|
1321
1370
|
emitter: this._emitter,
|
|
1322
1371
|
inboxService: this._inboxService,
|
|
1323
1372
|
notificationsCache: this.cache,
|
|
1324
|
-
tags
|
|
1373
|
+
tags,
|
|
1374
|
+
data
|
|
1325
1375
|
});
|
|
1326
1376
|
})
|
|
1327
1377
|
);
|
|
1328
1378
|
});
|
|
1329
1379
|
}
|
|
1330
1380
|
archiveAllRead() {
|
|
1331
|
-
return chunk7B52C2XE_js.__async(this, arguments, function* ({
|
|
1381
|
+
return chunk7B52C2XE_js.__async(this, arguments, function* ({
|
|
1382
|
+
tags,
|
|
1383
|
+
data
|
|
1384
|
+
} = {}) {
|
|
1332
1385
|
return this.callWithSession(
|
|
1333
1386
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1334
1387
|
return archiveAllRead({
|
|
1335
1388
|
emitter: this._emitter,
|
|
1336
1389
|
inboxService: this._inboxService,
|
|
1337
1390
|
notificationsCache: this.cache,
|
|
1338
|
-
tags
|
|
1391
|
+
tags,
|
|
1392
|
+
data
|
|
1339
1393
|
});
|
|
1340
1394
|
})
|
|
1341
1395
|
);
|
package/dist/cjs/index.d.ts
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.js';
|
|
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.js';
|
|
3
3
|
|
|
4
4
|
declare const areTagsEqual: (tags1?: string[], tags2?: string[]) => boolean;
|
|
5
5
|
declare const isSameFilter: (filter1: NotificationFilter, filter2: NotificationFilter) => boolean;
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkOGEM74YA_js = require('./chunk-OGEM74YA.js');
|
|
4
4
|
require('./chunk-7B52C2XE.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "ChannelType", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkOGEM74YA_js.ChannelType; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "NotificationStatus", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkOGEM74YA_js.NotificationStatus; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "Novu", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkOGEM74YA_js.Novu; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "PreferenceLevel", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkOGEM74YA_js.PreferenceLevel; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "WebSocketEvent", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkOGEM74YA_js.WebSocketEvent; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "areTagsEqual", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkOGEM74YA_js.areTagsEqual; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "isSameFilter", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkOGEM74YA_js.isSameFilter; }
|
|
35
35
|
});
|
|
@@ -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.js';
|
|
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/cjs/ui/index.d.ts
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.js';
|
|
2
|
+
export { d as Notification } from '../novu-q3jzGeyW.js';
|
|
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-DdImrpw7.js';
|
|
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-DdImrpw7.js';
|
|
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';
|