@novu/js 3.2.0 → 3.3.0
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-4KMXR5HJ.js → chunk-KIOGWIKT.js} +144 -11
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +8 -8
- package/dist/{esm/novu-jtIKy6p0.d.mts → cjs/novu-DJTVB7VN.d.ts} +30 -3
- package/dist/cjs/themes/index.d.ts +2 -2
- package/dist/cjs/types-BPv1rvbm.d.ts +121 -0
- package/dist/cjs/ui/index.d.ts +4 -4
- package/dist/cjs/ui/index.js +1529 -343
- package/dist/esm/{chunk-3SPOLIN3.mjs → chunk-GTZM2EDR.mjs} +144 -11
- package/dist/esm/index.d.mts +2 -2
- package/dist/esm/index.mjs +1 -1
- package/dist/{cjs/novu-jtIKy6p0.d.ts → esm/novu-DJTVB7VN.d.mts} +30 -3
- package/dist/esm/themes/index.d.mts +2 -2
- package/dist/esm/types-CYgpCW2I.d.mts +121 -0
- package/dist/esm/ui/index.d.mts +4 -4
- package/dist/esm/ui/index.mjs +1527 -341
- package/dist/index.css +1 -1
- package/dist/novu.min.js +10 -10
- package/dist/novu.min.js.gz +0 -0
- package/package.json +3 -3
- package/dist/cjs/types-qgZnJ8j8.d.ts +0 -103
- package/dist/esm/types-Bi1DqOQ-.d.mts +0 -103
|
@@ -6,8 +6,10 @@ import io from 'socket.io-client';
|
|
|
6
6
|
var NotificationStatus = /* @__PURE__ */ ((NotificationStatus2) => {
|
|
7
7
|
NotificationStatus2["READ"] = "read";
|
|
8
8
|
NotificationStatus2["SEEN"] = "seen";
|
|
9
|
+
NotificationStatus2["SNOOZED"] = "snoozed";
|
|
9
10
|
NotificationStatus2["UNREAD"] = "unread";
|
|
10
11
|
NotificationStatus2["UNSEEN"] = "unseen";
|
|
12
|
+
NotificationStatus2["UNSNOOZED"] = "unsnoozed";
|
|
11
13
|
return NotificationStatus2;
|
|
12
14
|
})(NotificationStatus || {});
|
|
13
15
|
var PreferenceLevel = /* @__PURE__ */ ((PreferenceLevel2) => {
|
|
@@ -47,13 +49,13 @@ var areTagsEqual = (tags1, tags2) => {
|
|
|
47
49
|
return arrayValuesEqual(tags1, tags2) || !tags1 && (tags2 == null ? void 0 : tags2.length) === 0 || (tags1 == null ? void 0 : tags1.length) === 0 && !tags2;
|
|
48
50
|
};
|
|
49
51
|
var isSameFilter = (filter1, filter2) => {
|
|
50
|
-
return areTagsEqual(filter1.tags, filter2.tags) && filter1.read === filter2.read && filter1.archived === filter2.archived;
|
|
52
|
+
return areTagsEqual(filter1.tags, filter2.tags) && filter1.read === filter2.read && filter1.archived === filter2.archived && filter1.snoozed === filter2.snoozed;
|
|
51
53
|
};
|
|
52
54
|
|
|
53
55
|
// src/api/http-client.ts
|
|
54
56
|
var DEFAULT_API_VERSION = "v1";
|
|
55
57
|
var DEFAULT_BACKEND_URL = "https://api.novu.co";
|
|
56
|
-
var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.
|
|
58
|
+
var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.3.0"}`;
|
|
57
59
|
var HttpClient = class {
|
|
58
60
|
constructor(options = {}) {
|
|
59
61
|
const {
|
|
@@ -187,7 +189,8 @@ var InboxService = class {
|
|
|
187
189
|
limit = 10,
|
|
188
190
|
offset,
|
|
189
191
|
read: read2,
|
|
190
|
-
tags
|
|
192
|
+
tags,
|
|
193
|
+
snoozed
|
|
191
194
|
}) {
|
|
192
195
|
const searchParams = new URLSearchParams(`limit=${limit}`);
|
|
193
196
|
if (after) {
|
|
@@ -205,6 +208,9 @@ var InboxService = class {
|
|
|
205
208
|
if (archived !== void 0) {
|
|
206
209
|
searchParams.append("archived", `${archived}`);
|
|
207
210
|
}
|
|
211
|
+
if (snoozed !== void 0) {
|
|
212
|
+
searchParams.append("snoozed", `${snoozed}`);
|
|
213
|
+
}
|
|
208
214
|
return __privateGet(this, _httpClient).get(INBOX_NOTIFICATIONS_ROUTE, searchParams, false);
|
|
209
215
|
}
|
|
210
216
|
count({ filters }) {
|
|
@@ -228,6 +234,12 @@ var InboxService = class {
|
|
|
228
234
|
unarchive(notificationId) {
|
|
229
235
|
return __privateGet(this, _httpClient).patch(`${INBOX_NOTIFICATIONS_ROUTE}/${notificationId}/unarchive`);
|
|
230
236
|
}
|
|
237
|
+
snooze(notificationId, snoozeUntil) {
|
|
238
|
+
return __privateGet(this, _httpClient).patch(`${INBOX_NOTIFICATIONS_ROUTE}/${notificationId}/snooze`, { snoozeUntil });
|
|
239
|
+
}
|
|
240
|
+
unsnooze(notificationId) {
|
|
241
|
+
return __privateGet(this, _httpClient).patch(`${INBOX_NOTIFICATIONS_ROUTE}/${notificationId}/unsnooze`);
|
|
242
|
+
}
|
|
231
243
|
readAll({ tags }) {
|
|
232
244
|
return __privateGet(this, _httpClient).post(`${INBOX_NOTIFICATIONS_ROUTE}/read`, { tags });
|
|
233
245
|
}
|
|
@@ -366,6 +378,9 @@ var Notification = class {
|
|
|
366
378
|
this.to = notification.to;
|
|
367
379
|
this.isRead = notification.isRead;
|
|
368
380
|
this.isArchived = notification.isArchived;
|
|
381
|
+
this.isSnoozed = notification.isSnoozed;
|
|
382
|
+
this.snoozedUntil = notification.snoozedUntil;
|
|
383
|
+
this.deliveredAt = notification.deliveredAt;
|
|
369
384
|
this.createdAt = notification.createdAt;
|
|
370
385
|
this.readAt = notification.readAt;
|
|
371
386
|
this.archivedAt = notification.archivedAt;
|
|
@@ -414,6 +429,23 @@ var Notification = class {
|
|
|
414
429
|
}
|
|
415
430
|
});
|
|
416
431
|
}
|
|
432
|
+
snooze(snoozeUntil) {
|
|
433
|
+
return snooze({
|
|
434
|
+
emitter: __privateGet(this, _emitter),
|
|
435
|
+
apiService: __privateGet(this, _inboxService),
|
|
436
|
+
args: {
|
|
437
|
+
notification: this,
|
|
438
|
+
snoozeUntil
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
unsnooze() {
|
|
443
|
+
return unsnooze({
|
|
444
|
+
emitter: __privateGet(this, _emitter),
|
|
445
|
+
apiService: __privateGet(this, _inboxService),
|
|
446
|
+
args: { notification: this }
|
|
447
|
+
});
|
|
448
|
+
}
|
|
417
449
|
completePrimary() {
|
|
418
450
|
if (!this.primaryAction) {
|
|
419
451
|
throw new Error("Primary action is not available");
|
|
@@ -612,6 +644,66 @@ var unarchive = (_0) => __async(void 0, [_0], function* ({
|
|
|
612
644
|
return { error: new NovuError("Failed to unarchive notification", error) };
|
|
613
645
|
}
|
|
614
646
|
});
|
|
647
|
+
var snooze = (_0) => __async(void 0, [_0], function* ({
|
|
648
|
+
emitter,
|
|
649
|
+
apiService,
|
|
650
|
+
args
|
|
651
|
+
}) {
|
|
652
|
+
const { notificationId, optimisticValue } = getNotificationDetails(
|
|
653
|
+
args,
|
|
654
|
+
{
|
|
655
|
+
isSnoozed: true,
|
|
656
|
+
snoozedUntil: args.snoozeUntil
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
emitter,
|
|
660
|
+
apiService
|
|
661
|
+
}
|
|
662
|
+
);
|
|
663
|
+
try {
|
|
664
|
+
emitter.emit("notification.snooze.pending", {
|
|
665
|
+
args,
|
|
666
|
+
data: optimisticValue
|
|
667
|
+
});
|
|
668
|
+
const response = yield apiService.snooze(notificationId, args.snoozeUntil);
|
|
669
|
+
const updatedNotification = new Notification(response, emitter, apiService);
|
|
670
|
+
emitter.emit("notification.snooze.resolved", { args, data: updatedNotification });
|
|
671
|
+
return { data: updatedNotification };
|
|
672
|
+
} catch (error) {
|
|
673
|
+
emitter.emit("notification.snooze.resolved", { args, error });
|
|
674
|
+
return { error: new NovuError("Failed to snooze notification", error) };
|
|
675
|
+
}
|
|
676
|
+
});
|
|
677
|
+
var unsnooze = (_0) => __async(void 0, [_0], function* ({
|
|
678
|
+
emitter,
|
|
679
|
+
apiService,
|
|
680
|
+
args
|
|
681
|
+
}) {
|
|
682
|
+
const { notificationId, optimisticValue } = getNotificationDetails(
|
|
683
|
+
args,
|
|
684
|
+
{
|
|
685
|
+
isSnoozed: false,
|
|
686
|
+
snoozedUntil: null
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
emitter,
|
|
690
|
+
apiService
|
|
691
|
+
}
|
|
692
|
+
);
|
|
693
|
+
try {
|
|
694
|
+
emitter.emit("notification.unsnooze.pending", {
|
|
695
|
+
args,
|
|
696
|
+
data: optimisticValue
|
|
697
|
+
});
|
|
698
|
+
const response = yield apiService.unsnooze(notificationId);
|
|
699
|
+
const updatedNotification = new Notification(response, emitter, apiService);
|
|
700
|
+
emitter.emit("notification.unsnooze.resolved", { args, data: updatedNotification });
|
|
701
|
+
return { data: updatedNotification };
|
|
702
|
+
} catch (error) {
|
|
703
|
+
emitter.emit("notification.unsnooze.resolved", { args, error });
|
|
704
|
+
return { error: new NovuError("Failed to unsnooze notification", error) };
|
|
705
|
+
}
|
|
706
|
+
});
|
|
615
707
|
var completeAction = (_0) => __async(void 0, [_0], function* ({
|
|
616
708
|
emitter,
|
|
617
709
|
apiService,
|
|
@@ -809,15 +901,20 @@ var InMemoryCache = class {
|
|
|
809
901
|
_cache = new WeakMap();
|
|
810
902
|
|
|
811
903
|
// src/cache/notifications-cache.ts
|
|
812
|
-
var excludeEmpty = ({ tags, read: read2, archived, limit, offset, after }) => Object.entries({ tags, read: read2, archived, limit, offset, after }).filter(([_, value]) => value !== null && value !== void 0 && !(Array.isArray(value) && value.length === 0)).reduce((acc, [key, value]) => {
|
|
904
|
+
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]) => {
|
|
813
905
|
acc[key] = value;
|
|
814
906
|
return acc;
|
|
815
907
|
}, {});
|
|
816
|
-
var getCacheKey = ({ tags, read: read2, archived, limit, offset, after }) => {
|
|
817
|
-
return JSON.stringify(excludeEmpty({ tags, read: read2, archived, limit, offset, after }));
|
|
908
|
+
var getCacheKey = ({ tags, read: read2, archived, snoozed, limit, offset, after }) => {
|
|
909
|
+
return JSON.stringify(excludeEmpty({ tags, read: read2, archived, snoozed, limit, offset, after }));
|
|
818
910
|
};
|
|
819
|
-
var getFilterKey = ({
|
|
820
|
-
|
|
911
|
+
var getFilterKey = ({
|
|
912
|
+
tags,
|
|
913
|
+
read: read2,
|
|
914
|
+
archived,
|
|
915
|
+
snoozed
|
|
916
|
+
}) => {
|
|
917
|
+
return JSON.stringify(excludeEmpty({ tags, read: read2, archived, snoozed }));
|
|
821
918
|
};
|
|
822
919
|
var getFilter = (key) => {
|
|
823
920
|
return JSON.parse(key);
|
|
@@ -837,6 +934,8 @@ var updateEvents = [
|
|
|
837
934
|
var removeEvents = [
|
|
838
935
|
"notification.archive.pending",
|
|
839
936
|
"notification.unarchive.pending",
|
|
937
|
+
"notification.snooze.pending",
|
|
938
|
+
"notification.unsnooze.pending",
|
|
840
939
|
"notifications.archive_all.pending",
|
|
841
940
|
"notifications.archive_all_read.pending"
|
|
842
941
|
];
|
|
@@ -947,7 +1046,7 @@ var NotificationsCache = class {
|
|
|
947
1046
|
}
|
|
948
1047
|
getAll(args) {
|
|
949
1048
|
if (this.has(args)) {
|
|
950
|
-
return this.getAggregated({ tags: args.tags, read: args.read, archived: args.archived });
|
|
1049
|
+
return this.getAggregated({ tags: args.tags, read: args.read, snoozed: args.snoozed, archived: args.archived });
|
|
951
1050
|
}
|
|
952
1051
|
}
|
|
953
1052
|
/**
|
|
@@ -1108,6 +1207,32 @@ var Notifications = class extends BaseModule {
|
|
|
1108
1207
|
);
|
|
1109
1208
|
});
|
|
1110
1209
|
}
|
|
1210
|
+
snooze(args) {
|
|
1211
|
+
return __async(this, null, function* () {
|
|
1212
|
+
return this.callWithSession(
|
|
1213
|
+
() => __async(this, null, function* () {
|
|
1214
|
+
return snooze({
|
|
1215
|
+
emitter: this._emitter,
|
|
1216
|
+
apiService: this._inboxService,
|
|
1217
|
+
args
|
|
1218
|
+
});
|
|
1219
|
+
})
|
|
1220
|
+
);
|
|
1221
|
+
});
|
|
1222
|
+
}
|
|
1223
|
+
unsnooze(args) {
|
|
1224
|
+
return __async(this, null, function* () {
|
|
1225
|
+
return this.callWithSession(
|
|
1226
|
+
() => __async(this, null, function* () {
|
|
1227
|
+
return unsnooze({
|
|
1228
|
+
emitter: this._emitter,
|
|
1229
|
+
apiService: this._inboxService,
|
|
1230
|
+
args
|
|
1231
|
+
});
|
|
1232
|
+
})
|
|
1233
|
+
);
|
|
1234
|
+
});
|
|
1235
|
+
}
|
|
1111
1236
|
completePrimary(args) {
|
|
1112
1237
|
return __async(this, null, function* () {
|
|
1113
1238
|
return this.callWithSession(
|
|
@@ -1520,6 +1645,8 @@ var mapToNotification = ({
|
|
|
1520
1645
|
content,
|
|
1521
1646
|
read: read2,
|
|
1522
1647
|
archived,
|
|
1648
|
+
snoozedUntil,
|
|
1649
|
+
deliveredAt,
|
|
1523
1650
|
createdAt,
|
|
1524
1651
|
lastReadDate,
|
|
1525
1652
|
archivedAt,
|
|
@@ -1549,13 +1676,19 @@ var mapToNotification = ({
|
|
|
1549
1676
|
const secondaryCta = (_d = (_c = cta.action) == null ? void 0 : _c.buttons) == null ? void 0 : _d.find((button) => button.type === "secondary" /* SECONDARY */);
|
|
1550
1677
|
const actionType = (_f = (_e = cta.action) == null ? void 0 : _e.result) == null ? void 0 : _f.type;
|
|
1551
1678
|
const actionStatus = (_g = cta.action) == null ? void 0 : _g.status;
|
|
1552
|
-
return {
|
|
1679
|
+
return __spreadProps(__spreadValues(__spreadValues({
|
|
1553
1680
|
id: _id,
|
|
1554
1681
|
subject,
|
|
1555
1682
|
body: content,
|
|
1556
1683
|
to,
|
|
1557
1684
|
isRead: read2,
|
|
1558
1685
|
isArchived: archived,
|
|
1686
|
+
isSnoozed: !!snoozedUntil
|
|
1687
|
+
}, deliveredAt && {
|
|
1688
|
+
deliveredAt
|
|
1689
|
+
}), snoozedUntil && {
|
|
1690
|
+
snoozedUntil
|
|
1691
|
+
}), {
|
|
1559
1692
|
createdAt,
|
|
1560
1693
|
readAt: lastReadDate,
|
|
1561
1694
|
archivedAt,
|
|
@@ -1584,7 +1717,7 @@ var mapToNotification = ({
|
|
|
1584
1717
|
} : void 0,
|
|
1585
1718
|
data,
|
|
1586
1719
|
workflow
|
|
1587
|
-
};
|
|
1720
|
+
});
|
|
1588
1721
|
};
|
|
1589
1722
|
var _token, _emitter6, _socketIo, _socketUrl, _notificationReceived, _unseenCountChanged, _unreadCountChanged, _Socket_instances, initializeSocket_fn, handleConnectSocket_fn, handleDisconnectSocket_fn;
|
|
1590
1723
|
var Socket = class extends BaseModule {
|
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-DJTVB7VN.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-DJTVB7VN.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-GTZM2EDR.mjs';
|
|
2
2
|
import './chunk-STZMOEWR.mjs';
|
|
@@ -63,8 +63,10 @@ declare global {
|
|
|
63
63
|
declare enum NotificationStatus {
|
|
64
64
|
READ = "read",
|
|
65
65
|
SEEN = "seen",
|
|
66
|
+
SNOOZED = "snoozed",
|
|
66
67
|
UNREAD = "unread",
|
|
67
|
-
UNSEEN = "unseen"
|
|
68
|
+
UNSEEN = "unseen",
|
|
69
|
+
UNSNOOZED = "unsnoozed"
|
|
68
70
|
}
|
|
69
71
|
declare enum PreferenceLevel {
|
|
70
72
|
GLOBAL = "global",
|
|
@@ -87,6 +89,7 @@ type Session = {
|
|
|
87
89
|
totalUnreadCount: number;
|
|
88
90
|
removeNovuBranding: boolean;
|
|
89
91
|
isDevelopmentMode: boolean;
|
|
92
|
+
maxSnoozeDurationHours: number;
|
|
90
93
|
};
|
|
91
94
|
type Subscriber = {
|
|
92
95
|
id?: string;
|
|
@@ -127,6 +130,9 @@ type InboxNotification = {
|
|
|
127
130
|
to: Subscriber;
|
|
128
131
|
isRead: boolean;
|
|
129
132
|
isArchived: boolean;
|
|
133
|
+
isSnoozed: boolean;
|
|
134
|
+
snoozedUntil?: string | null;
|
|
135
|
+
deliveredAt?: string[];
|
|
130
136
|
createdAt: string;
|
|
131
137
|
readAt?: string | null;
|
|
132
138
|
archivedAt?: string | null;
|
|
@@ -143,6 +149,7 @@ type NotificationFilter = {
|
|
|
143
149
|
tags?: string[];
|
|
144
150
|
read?: boolean;
|
|
145
151
|
archived?: boolean;
|
|
152
|
+
snoozed?: boolean;
|
|
146
153
|
};
|
|
147
154
|
type ChannelPreference = {
|
|
148
155
|
email?: boolean;
|
|
@@ -209,10 +216,11 @@ declare class InboxService {
|
|
|
209
216
|
subscriberHash?: string;
|
|
210
217
|
subscriber: Subscriber;
|
|
211
218
|
}): Promise<Session>;
|
|
212
|
-
fetchNotifications({ after, archived, limit, offset, read, tags, }: {
|
|
219
|
+
fetchNotifications({ after, archived, limit, offset, read, tags, snoozed, }: {
|
|
213
220
|
tags?: string[];
|
|
214
221
|
read?: boolean;
|
|
215
222
|
archived?: boolean;
|
|
223
|
+
snoozed?: boolean;
|
|
216
224
|
limit?: number;
|
|
217
225
|
after?: string;
|
|
218
226
|
offset?: number;
|
|
@@ -237,6 +245,8 @@ declare class InboxService {
|
|
|
237
245
|
unread(notificationId: string): Promise<InboxNotification>;
|
|
238
246
|
archive(notificationId: string): Promise<InboxNotification>;
|
|
239
247
|
unarchive(notificationId: string): Promise<InboxNotification>;
|
|
248
|
+
snooze(notificationId: string, snoozeUntil: string): Promise<InboxNotification>;
|
|
249
|
+
unsnooze(notificationId: string): Promise<InboxNotification>;
|
|
240
250
|
readAll({ tags }: {
|
|
241
251
|
tags?: string[];
|
|
242
252
|
}): Promise<void>;
|
|
@@ -283,6 +293,9 @@ declare class Notification implements Pick<NovuEventEmitter, 'on'>, InboxNotific
|
|
|
283
293
|
readonly to: InboxNotification['to'];
|
|
284
294
|
readonly isRead: InboxNotification['isRead'];
|
|
285
295
|
readonly isArchived: InboxNotification['isArchived'];
|
|
296
|
+
readonly isSnoozed: InboxNotification['isSnoozed'];
|
|
297
|
+
readonly snoozedUntil?: InboxNotification['snoozedUntil'];
|
|
298
|
+
readonly deliveredAt?: InboxNotification['deliveredAt'];
|
|
286
299
|
readonly createdAt: InboxNotification['createdAt'];
|
|
287
300
|
readonly readAt?: InboxNotification['readAt'];
|
|
288
301
|
readonly archivedAt?: InboxNotification['archivedAt'];
|
|
@@ -299,6 +312,8 @@ declare class Notification implements Pick<NovuEventEmitter, 'on'>, InboxNotific
|
|
|
299
312
|
unread(): Result<Notification>;
|
|
300
313
|
archive(): Result<Notification>;
|
|
301
314
|
unarchive(): Result<Notification>;
|
|
315
|
+
snooze(snoozeUntil: string): Result<Notification>;
|
|
316
|
+
unsnooze(): Result<Notification>;
|
|
302
317
|
completePrimary(): Result<Notification>;
|
|
303
318
|
completeSecondary(): Result<Notification>;
|
|
304
319
|
revertPrimary(): Result<Notification>;
|
|
@@ -315,6 +330,7 @@ type ListNotificationsArgs = {
|
|
|
315
330
|
tags?: string[];
|
|
316
331
|
read?: boolean;
|
|
317
332
|
archived?: boolean;
|
|
333
|
+
snoozed?: boolean;
|
|
318
334
|
limit?: number;
|
|
319
335
|
after?: string;
|
|
320
336
|
offset?: number;
|
|
@@ -329,12 +345,14 @@ type FilterCountArgs = {
|
|
|
329
345
|
tags?: string[];
|
|
330
346
|
read?: boolean;
|
|
331
347
|
archived?: boolean;
|
|
348
|
+
snoozed?: boolean;
|
|
332
349
|
};
|
|
333
350
|
type FiltersCountArgs = {
|
|
334
351
|
filters: Array<{
|
|
335
352
|
tags?: string[];
|
|
336
353
|
read?: boolean;
|
|
337
354
|
archived?: boolean;
|
|
355
|
+
snoozed?: boolean;
|
|
338
356
|
}>;
|
|
339
357
|
};
|
|
340
358
|
type CountArgs = undefined | FilterCountArgs | FiltersCountArgs;
|
|
@@ -359,6 +377,10 @@ type ReadArgs = BaseArgs | InstanceArgs;
|
|
|
359
377
|
type UnreadArgs = BaseArgs | InstanceArgs;
|
|
360
378
|
type ArchivedArgs = BaseArgs | InstanceArgs;
|
|
361
379
|
type UnarchivedArgs = BaseArgs | InstanceArgs;
|
|
380
|
+
type SnoozeArgs = (BaseArgs | InstanceArgs) & {
|
|
381
|
+
snoozeUntil: string;
|
|
382
|
+
};
|
|
383
|
+
type UnsnoozeArgs = BaseArgs | InstanceArgs;
|
|
362
384
|
type CompleteArgs = BaseArgs | InstanceArgs;
|
|
363
385
|
type RevertArgs = BaseArgs | InstanceArgs;
|
|
364
386
|
|
|
@@ -403,6 +425,9 @@ declare class Notifications extends BaseModule {
|
|
|
403
425
|
archive(args: InstanceArgs): Result<Notification>;
|
|
404
426
|
unarchive(args: BaseArgs): Result<Notification>;
|
|
405
427
|
unarchive(args: InstanceArgs): Result<Notification>;
|
|
428
|
+
snooze(args: SnoozeArgs): Result<Notification>;
|
|
429
|
+
unsnooze(args: BaseArgs): Result<Notification>;
|
|
430
|
+
unsnooze(args: InstanceArgs): Result<Notification>;
|
|
406
431
|
completePrimary(args: BaseArgs): Result<Notification>;
|
|
407
432
|
completePrimary(args: InstanceArgs): Result<Notification>;
|
|
408
433
|
completeSecondary(args: BaseArgs): Result<Notification>;
|
|
@@ -451,6 +476,8 @@ type NotificationReadEvents = BaseEvents<'notification.read', ReadArgs, Notifica
|
|
|
451
476
|
type NotificationUnreadEvents = BaseEvents<'notification.unread', UnreadArgs, Notification>;
|
|
452
477
|
type NotificationArchiveEvents = BaseEvents<'notification.archive', ArchivedArgs, Notification>;
|
|
453
478
|
type NotificationUnarchiveEvents = BaseEvents<'notification.unarchive', UnarchivedArgs, Notification>;
|
|
479
|
+
type NotificationSnoozeEvents = BaseEvents<'notification.snooze', SnoozeArgs, Notification>;
|
|
480
|
+
type NotificationUnsnoozeEvents = BaseEvents<'notification.unsnooze', UnsnoozeArgs, Notification>;
|
|
454
481
|
type NotificationCompleteActionEvents = BaseEvents<'notification.complete_action', CompleteArgs, Notification>;
|
|
455
482
|
type NotificationRevertActionEvents = BaseEvents<'notification.revert_action', RevertArgs, Notification>;
|
|
456
483
|
type NotificationsReadAllEvents = BaseEvents<'notifications.read_all', {
|
|
@@ -503,7 +530,7 @@ type Events = SessionInitializeEvents & NotificationsFetchEvents & {
|
|
|
503
530
|
'preferences.list.updated': {
|
|
504
531
|
data: Preference[];
|
|
505
532
|
};
|
|
506
|
-
} & PreferenceUpdateEvents & SocketConnectEvents & SocketEvents & NotificationReadEvents & NotificationUnreadEvents & NotificationArchiveEvents & NotificationUnarchiveEvents & NotificationCompleteActionEvents & NotificationRevertActionEvents & NotificationsReadAllEvents & NotificationsArchivedAllEvents & NotificationsReadArchivedAllEvents;
|
|
533
|
+
} & PreferenceUpdateEvents & SocketConnectEvents & SocketEvents & NotificationReadEvents & NotificationUnreadEvents & NotificationArchiveEvents & NotificationUnarchiveEvents & NotificationSnoozeEvents & NotificationUnsnoozeEvents & NotificationCompleteActionEvents & NotificationRevertActionEvents & NotificationsReadAllEvents & NotificationsArchivedAllEvents & NotificationsReadArchivedAllEvents;
|
|
507
534
|
type EventNames = keyof Events;
|
|
508
535
|
type SocketEventNames = keyof SocketEvents;
|
|
509
536
|
type EventHandler<T = unknown> = (event: T) => void;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { d as Notification, N as NotificationFilter, g as NovuOptions, b as Novu } from './novu-DJTVB7VN.mjs';
|
|
2
|
+
|
|
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", "workflowLabelContainer", "workflowContainerDisabledNotice", "workflowLabelDisabled__icon", "workflowContainerRight__icon", "workflowArrow__icon", "workflowDescription", "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
|
+
|
|
5
|
+
declare const defaultLocalization: {
|
|
6
|
+
readonly locale: "en-US";
|
|
7
|
+
readonly 'inbox.filters.dropdownOptions.unread': "Unread only";
|
|
8
|
+
readonly 'inbox.filters.dropdownOptions.default': "Unread & read";
|
|
9
|
+
readonly 'inbox.filters.dropdownOptions.archived': "Archived";
|
|
10
|
+
readonly 'inbox.filters.dropdownOptions.snoozed': "Snoozed";
|
|
11
|
+
readonly 'inbox.filters.labels.unread': "Unread";
|
|
12
|
+
readonly 'inbox.filters.labels.default': "Inbox";
|
|
13
|
+
readonly 'inbox.filters.labels.archived': "Archived";
|
|
14
|
+
readonly 'inbox.filters.labels.snoozed': "Snoozed";
|
|
15
|
+
readonly 'notifications.emptyNotice': "Quiet for now. Check back later.";
|
|
16
|
+
readonly 'notifications.actions.readAll': "Mark all as read";
|
|
17
|
+
readonly 'notifications.actions.archiveAll': "Archive all";
|
|
18
|
+
readonly 'notifications.actions.archiveRead': "Archive read";
|
|
19
|
+
readonly 'notifications.newNotifications': ({ notificationCount }: {
|
|
20
|
+
notificationCount: number;
|
|
21
|
+
}) => string;
|
|
22
|
+
readonly 'notification.actions.read.tooltip': "Mark as read";
|
|
23
|
+
readonly 'notification.actions.unread.tooltip': "Mark as unread";
|
|
24
|
+
readonly 'notification.actions.archive.tooltip': "Archive";
|
|
25
|
+
readonly 'notification.actions.unarchive.tooltip': "Unarchive";
|
|
26
|
+
readonly 'notification.actions.snooze.tooltip': "Snooze";
|
|
27
|
+
readonly 'notification.actions.unsnooze.tooltip': "Unsnooze";
|
|
28
|
+
readonly 'notification.snoozedUntil': "Snoozed until";
|
|
29
|
+
readonly 'preferences.title': "Preferences";
|
|
30
|
+
readonly 'preferences.emptyNotice': "No notification specific preferences yet.";
|
|
31
|
+
readonly 'preferences.global': "Global Preferences";
|
|
32
|
+
readonly 'preferences.workflow.disabled.notice': "Contact admin to enable subscription management for this critical notification.";
|
|
33
|
+
readonly 'preferences.workflow.disabled.tooltip': "Contact admin to edit";
|
|
34
|
+
readonly 'snooze.datePicker.timePickerLabel': "Time";
|
|
35
|
+
readonly 'snooze.datePicker.apply': "Apply";
|
|
36
|
+
readonly 'snooze.datePicker.cancel': "Cancel";
|
|
37
|
+
readonly 'snooze.options.anHourFromNow': "An hour from now";
|
|
38
|
+
readonly 'snooze.datePicker.pastDateTooltip': "Selected time must be at least 3 minutes in the future";
|
|
39
|
+
readonly 'snooze.datePicker.noDateSelectedTooltip': "Please select a date";
|
|
40
|
+
readonly 'snooze.datePicker.exceedingLimitTooltip': ({ days }: {
|
|
41
|
+
days: number;
|
|
42
|
+
}) => string;
|
|
43
|
+
readonly 'snooze.options.customTime': "Custom time...";
|
|
44
|
+
readonly 'snooze.options.inOneDay': "Tomorrow";
|
|
45
|
+
readonly 'snooze.options.inOneWeek': "Next week";
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
type LocalizationKey = keyof typeof defaultLocalization;
|
|
49
|
+
type Localization = {
|
|
50
|
+
[K in LocalizationKey]?: (typeof defaultLocalization)[K] extends (...args: infer P) => any ? ((...args: P) => ReturnType<(typeof defaultLocalization)[K]>) | string : string;
|
|
51
|
+
} & {
|
|
52
|
+
dynamic?: Record<string, string>;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
type NotificationClickHandler = (notification: Notification) => void;
|
|
56
|
+
type NotificationActionClickHandler = (notification: Notification) => void;
|
|
57
|
+
type NotificationRenderer = (el: HTMLDivElement, notification: Notification) => () => void;
|
|
58
|
+
type SubjectRenderer = (el: HTMLDivElement, notification: Notification) => () => void;
|
|
59
|
+
type BodyRenderer = (el: HTMLDivElement, notification: Notification) => () => void;
|
|
60
|
+
type BellRenderer = (el: HTMLDivElement, unreadCount: number) => () => void;
|
|
61
|
+
type RouterPush = (path: string) => void;
|
|
62
|
+
type Tab = {
|
|
63
|
+
label: string;
|
|
64
|
+
/**
|
|
65
|
+
* @deprecated Use `filter` instead
|
|
66
|
+
*/
|
|
67
|
+
value?: Array<string>;
|
|
68
|
+
filter?: Pick<NotificationFilter, 'tags'>;
|
|
69
|
+
};
|
|
70
|
+
type CSSProperties = {
|
|
71
|
+
[key: string]: string | number;
|
|
72
|
+
};
|
|
73
|
+
type ElementStyles = string | CSSProperties;
|
|
74
|
+
type Variables = {
|
|
75
|
+
colorBackground?: string;
|
|
76
|
+
colorForeground?: string;
|
|
77
|
+
colorPrimary?: string;
|
|
78
|
+
colorPrimaryForeground?: string;
|
|
79
|
+
colorSecondary?: string;
|
|
80
|
+
colorSecondaryForeground?: string;
|
|
81
|
+
colorCounter?: string;
|
|
82
|
+
colorCounterForeground?: string;
|
|
83
|
+
colorNeutral?: string;
|
|
84
|
+
colorShadow?: string;
|
|
85
|
+
colorRing?: string;
|
|
86
|
+
fontSize?: string;
|
|
87
|
+
borderRadius?: string;
|
|
88
|
+
colorStripes?: string;
|
|
89
|
+
};
|
|
90
|
+
type AppearanceKey = (typeof appearanceKeys)[number];
|
|
91
|
+
type Elements = Partial<Record<AppearanceKey, ElementStyles>>;
|
|
92
|
+
type Theme = {
|
|
93
|
+
variables?: Variables;
|
|
94
|
+
elements?: Elements;
|
|
95
|
+
animations?: boolean;
|
|
96
|
+
};
|
|
97
|
+
type Appearance = Theme & {
|
|
98
|
+
baseTheme?: Theme | Theme[];
|
|
99
|
+
};
|
|
100
|
+
type BaseNovuProviderProps = {
|
|
101
|
+
appearance?: Appearance;
|
|
102
|
+
localization?: Localization;
|
|
103
|
+
options: NovuOptions;
|
|
104
|
+
tabs?: Array<Tab>;
|
|
105
|
+
preferencesFilter?: PreferencesFilter;
|
|
106
|
+
routerPush?: RouterPush;
|
|
107
|
+
novu?: Novu;
|
|
108
|
+
};
|
|
109
|
+
type NovuProviderProps = BaseNovuProviderProps & {
|
|
110
|
+
renderNotification?: NotificationRenderer;
|
|
111
|
+
renderBell?: BellRenderer;
|
|
112
|
+
};
|
|
113
|
+
declare enum NotificationStatus {
|
|
114
|
+
UNREAD_READ = "unreadRead",
|
|
115
|
+
UNREAD = "unread",
|
|
116
|
+
ARCHIVED = "archived",
|
|
117
|
+
SNOOZED = "snoozed"
|
|
118
|
+
}
|
|
119
|
+
type PreferencesFilter = Pick<NotificationFilter, 'tags'>;
|
|
120
|
+
|
|
121
|
+
export { type Appearance as A, type BellRenderer as B, type Elements as E, type Localization as L, type NotificationClickHandler as N, type PreferencesFilter as P, type RouterPush as R, type SubjectRenderer as S, type Tab as T, type Variables as V, type NotificationActionClickHandler as a, type NotificationRenderer as b, type BodyRenderer as c, type NovuProviderProps as d, type BaseNovuProviderProps as e, type AppearanceKey as f, type ElementStyles as g, type LocalizationKey as h, NotificationStatus as i, type Theme as j };
|
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, R as RouterPush } from '../types-
|
|
4
|
-
export { f as AppearanceKey, g as ElementStyles, E as Elements, h as LocalizationKey, i as NotificationStatus, V as Variables } from '../types-
|
|
1
|
+
import { g as NovuOptions } from '../novu-DJTVB7VN.mjs';
|
|
2
|
+
export { d as Notification } from '../novu-DJTVB7VN.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, R as RouterPush } from '../types-CYgpCW2I.mjs';
|
|
4
|
+
export { f as AppearanceKey, g as ElementStyles, E as Elements, h as LocalizationKey, i as NotificationStatus, V as Variables } from '../types-CYgpCW2I.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';
|