@novu/js 3.11.0-rc.1 → 3.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{chunk-TROJWAJA.js → chunk-MKYWGA37.js} +131 -809
- package/dist/cjs/chunk-WFVHYVDM.js +793 -0
- package/dist/cjs/index.d.ts +3 -4
- package/dist/cjs/index.js +26 -26
- package/dist/cjs/internal/index.d.ts +8 -2
- package/dist/cjs/internal/index.js +8 -4
- package/dist/cjs/novu-CKWESYFZ.d.ts +165 -0
- package/dist/cjs/{novu-ThMWeiRt.d.ts → novu-event-emitter-C7GZ7-r1.d.ts} +220 -163
- package/dist/cjs/themes/index.d.ts +3 -3
- package/dist/cjs/{types-BjANCN3c.d.ts → types-CeLsxWJg.d.ts} +2 -2
- package/dist/cjs/ui/index.d.ts +5 -4
- package/dist/cjs/ui/index.js +13 -13
- package/dist/esm/{chunk-D4W52D4A.mjs → chunk-76A4RQYD.mjs} +99 -771
- package/dist/esm/chunk-GY4JXBST.mjs +765 -0
- package/dist/esm/index.d.mts +3 -4
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/internal/index.d.mts +8 -2
- package/dist/esm/internal/index.mjs +1 -1
- package/dist/esm/novu-3CfttQ8e.d.mts +165 -0
- package/dist/esm/{novu-DY-mm8Og.d.mts → novu-event-emitter-C7GZ7-r1.d.mts} +220 -163
- package/dist/esm/themes/index.d.mts +3 -3
- package/dist/esm/{types-C5eX1GmB.d.mts → types-4YuozpWu.d.mts} +2 -2
- package/dist/esm/ui/index.d.mts +5 -4
- package/dist/esm/ui/index.mjs +5 -5
- package/dist/novu.min.js +12 -12
- package/dist/novu.min.js.gz +0 -0
- package/package.json +17 -17
- package/dist/cjs/chunk-VWSQDNZX.js +0 -66
- package/dist/cjs/types-BM_9Xx5Z.d.ts +0 -220
- package/dist/esm/chunk-RZWQYM3H.mjs +0 -62
- package/dist/esm/types-BM_9Xx5Z.d.mts +0 -220
|
@@ -1,53 +1,10 @@
|
|
|
1
|
-
import { buildSubscriber, buildContextKey } from './chunk-
|
|
1
|
+
import { buildSubscriber, buildContextKey, Notification, NovuError, read, unread, seen, archive, unarchive, deleteNotification, snooze, unsnooze, completeAction, revertAction, readAll, seenAll, archiveAll, archiveAllRead, deleteAll, createNotification } from './chunk-GY4JXBST.mjs';
|
|
2
2
|
import { __privateAdd, __privateSet, __privateGet, __async, __objRest, __spreadValues, __spreadProps, __privateMethod } from './chunk-STZMOEWR.mjs';
|
|
3
3
|
import mitt from 'mitt';
|
|
4
4
|
import 'event-target-polyfill';
|
|
5
5
|
import { WebSocket } from 'partysocket';
|
|
6
6
|
import io from 'socket.io-client';
|
|
7
7
|
|
|
8
|
-
// src/types.ts
|
|
9
|
-
var NotificationStatus = /* @__PURE__ */ ((NotificationStatus2) => {
|
|
10
|
-
NotificationStatus2["READ"] = "read";
|
|
11
|
-
NotificationStatus2["SEEN"] = "seen";
|
|
12
|
-
NotificationStatus2["SNOOZED"] = "snoozed";
|
|
13
|
-
NotificationStatus2["UNREAD"] = "unread";
|
|
14
|
-
NotificationStatus2["UNSEEN"] = "unseen";
|
|
15
|
-
NotificationStatus2["UNSNOOZED"] = "unsnoozed";
|
|
16
|
-
return NotificationStatus2;
|
|
17
|
-
})(NotificationStatus || {});
|
|
18
|
-
var PreferenceLevel = /* @__PURE__ */ ((PreferenceLevel2) => {
|
|
19
|
-
PreferenceLevel2["GLOBAL"] = "global";
|
|
20
|
-
PreferenceLevel2["TEMPLATE"] = "template";
|
|
21
|
-
return PreferenceLevel2;
|
|
22
|
-
})(PreferenceLevel || {});
|
|
23
|
-
var ChannelType = /* @__PURE__ */ ((ChannelType2) => {
|
|
24
|
-
ChannelType2["IN_APP"] = "in_app";
|
|
25
|
-
ChannelType2["EMAIL"] = "email";
|
|
26
|
-
ChannelType2["SMS"] = "sms";
|
|
27
|
-
ChannelType2["CHAT"] = "chat";
|
|
28
|
-
ChannelType2["PUSH"] = "push";
|
|
29
|
-
return ChannelType2;
|
|
30
|
-
})(ChannelType || {});
|
|
31
|
-
var WebSocketEvent = /* @__PURE__ */ ((WebSocketEvent2) => {
|
|
32
|
-
WebSocketEvent2["RECEIVED"] = "notification_received";
|
|
33
|
-
WebSocketEvent2["UNREAD"] = "unread_count_changed";
|
|
34
|
-
WebSocketEvent2["UNSEEN"] = "unseen_count_changed";
|
|
35
|
-
return WebSocketEvent2;
|
|
36
|
-
})(WebSocketEvent || {});
|
|
37
|
-
var SeverityLevelEnum = /* @__PURE__ */ ((SeverityLevelEnum2) => {
|
|
38
|
-
SeverityLevelEnum2["HIGH"] = "high";
|
|
39
|
-
SeverityLevelEnum2["MEDIUM"] = "medium";
|
|
40
|
-
SeverityLevelEnum2["LOW"] = "low";
|
|
41
|
-
SeverityLevelEnum2["NONE"] = "none";
|
|
42
|
-
return SeverityLevelEnum2;
|
|
43
|
-
})(SeverityLevelEnum || {});
|
|
44
|
-
var WorkflowCriticalityEnum = /* @__PURE__ */ ((WorkflowCriticalityEnum2) => {
|
|
45
|
-
WorkflowCriticalityEnum2["CRITICAL"] = "critical";
|
|
46
|
-
WorkflowCriticalityEnum2["NON_CRITICAL"] = "nonCritical";
|
|
47
|
-
WorkflowCriticalityEnum2["ALL"] = "all";
|
|
48
|
-
return WorkflowCriticalityEnum2;
|
|
49
|
-
})(WorkflowCriticalityEnum || {});
|
|
50
|
-
|
|
51
8
|
// src/utils/arrays.ts
|
|
52
9
|
var arrayValuesEqual = (arr1, arr2) => {
|
|
53
10
|
if (arr1 === arr2) {
|
|
@@ -141,7 +98,7 @@ function checkNotificationMatchesFilter(notification, filter) {
|
|
|
141
98
|
|
|
142
99
|
// src/api/http-client.ts
|
|
143
100
|
var DEFAULT_API_VERSION = "v1";
|
|
144
|
-
var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.11.
|
|
101
|
+
var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.11.1"}`;
|
|
145
102
|
var HttpClient = class {
|
|
146
103
|
constructor(options = {}) {
|
|
147
104
|
// Environment variable for local development that overrides the default API endpoint without affecting the Inbox DX
|
|
@@ -501,655 +458,6 @@ var NovuEventEmitter = class {
|
|
|
501
458
|
};
|
|
502
459
|
_mittEmitter = new WeakMap();
|
|
503
460
|
|
|
504
|
-
// src/utils/errors.ts
|
|
505
|
-
var NovuError = class extends Error {
|
|
506
|
-
constructor(message, originalError) {
|
|
507
|
-
super(message);
|
|
508
|
-
this.originalError = originalError;
|
|
509
|
-
}
|
|
510
|
-
};
|
|
511
|
-
|
|
512
|
-
// src/notifications/helpers.ts
|
|
513
|
-
var read = (_0) => __async(void 0, [_0], function* ({
|
|
514
|
-
emitter,
|
|
515
|
-
apiService,
|
|
516
|
-
args
|
|
517
|
-
}) {
|
|
518
|
-
const { notificationId, optimisticValue } = getNotificationDetails(
|
|
519
|
-
args,
|
|
520
|
-
{
|
|
521
|
-
isRead: true,
|
|
522
|
-
readAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
523
|
-
isArchived: false,
|
|
524
|
-
archivedAt: void 0
|
|
525
|
-
},
|
|
526
|
-
{
|
|
527
|
-
emitter,
|
|
528
|
-
apiService
|
|
529
|
-
}
|
|
530
|
-
);
|
|
531
|
-
try {
|
|
532
|
-
emitter.emit("notification.read.pending", {
|
|
533
|
-
args,
|
|
534
|
-
data: optimisticValue
|
|
535
|
-
});
|
|
536
|
-
const response = yield apiService.read(notificationId);
|
|
537
|
-
const updatedNotification = new Notification(response, emitter, apiService);
|
|
538
|
-
emitter.emit("notification.read.resolved", { args, data: updatedNotification });
|
|
539
|
-
return { data: updatedNotification };
|
|
540
|
-
} catch (error) {
|
|
541
|
-
emitter.emit("notification.read.resolved", { args, error });
|
|
542
|
-
return { error: new NovuError("Failed to read notification", error) };
|
|
543
|
-
}
|
|
544
|
-
});
|
|
545
|
-
var unread = (_0) => __async(void 0, [_0], function* ({
|
|
546
|
-
emitter,
|
|
547
|
-
apiService,
|
|
548
|
-
args
|
|
549
|
-
}) {
|
|
550
|
-
const { notificationId, optimisticValue } = getNotificationDetails(
|
|
551
|
-
args,
|
|
552
|
-
{
|
|
553
|
-
isRead: false,
|
|
554
|
-
readAt: null,
|
|
555
|
-
isArchived: false,
|
|
556
|
-
archivedAt: void 0
|
|
557
|
-
},
|
|
558
|
-
{
|
|
559
|
-
emitter,
|
|
560
|
-
apiService
|
|
561
|
-
}
|
|
562
|
-
);
|
|
563
|
-
try {
|
|
564
|
-
emitter.emit("notification.unread.pending", {
|
|
565
|
-
args,
|
|
566
|
-
data: optimisticValue
|
|
567
|
-
});
|
|
568
|
-
const response = yield apiService.unread(notificationId);
|
|
569
|
-
const updatedNotification = new Notification(response, emitter, apiService);
|
|
570
|
-
emitter.emit("notification.unread.resolved", { args, data: updatedNotification });
|
|
571
|
-
return { data: updatedNotification };
|
|
572
|
-
} catch (error) {
|
|
573
|
-
emitter.emit("notification.unread.resolved", { args, error });
|
|
574
|
-
return { error: new NovuError("Failed to unread notification", error) };
|
|
575
|
-
}
|
|
576
|
-
});
|
|
577
|
-
var seen = (_0) => __async(void 0, [_0], function* ({
|
|
578
|
-
emitter,
|
|
579
|
-
apiService,
|
|
580
|
-
args
|
|
581
|
-
}) {
|
|
582
|
-
const { notificationId, optimisticValue } = getNotificationDetails(
|
|
583
|
-
args,
|
|
584
|
-
{
|
|
585
|
-
isSeen: true
|
|
586
|
-
},
|
|
587
|
-
{
|
|
588
|
-
emitter,
|
|
589
|
-
apiService
|
|
590
|
-
}
|
|
591
|
-
);
|
|
592
|
-
try {
|
|
593
|
-
emitter.emit("notification.seen.pending", {
|
|
594
|
-
args,
|
|
595
|
-
data: optimisticValue
|
|
596
|
-
});
|
|
597
|
-
yield apiService.seen(notificationId);
|
|
598
|
-
if (!optimisticValue) {
|
|
599
|
-
throw new Error("Failed to create optimistic value for notification");
|
|
600
|
-
}
|
|
601
|
-
const updatedNotification = new Notification(optimisticValue, emitter, apiService);
|
|
602
|
-
emitter.emit("notification.seen.resolved", { args, data: updatedNotification });
|
|
603
|
-
return { data: updatedNotification };
|
|
604
|
-
} catch (error) {
|
|
605
|
-
emitter.emit("notification.seen.resolved", { args, error });
|
|
606
|
-
return { error: new NovuError("Failed to mark notification as seen", error) };
|
|
607
|
-
}
|
|
608
|
-
});
|
|
609
|
-
var archive = (_0) => __async(void 0, [_0], function* ({
|
|
610
|
-
emitter,
|
|
611
|
-
apiService,
|
|
612
|
-
args
|
|
613
|
-
}) {
|
|
614
|
-
const { notificationId, optimisticValue } = getNotificationDetails(
|
|
615
|
-
args,
|
|
616
|
-
{
|
|
617
|
-
isArchived: true,
|
|
618
|
-
archivedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
619
|
-
isRead: true,
|
|
620
|
-
readAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
621
|
-
},
|
|
622
|
-
{
|
|
623
|
-
emitter,
|
|
624
|
-
apiService
|
|
625
|
-
}
|
|
626
|
-
);
|
|
627
|
-
try {
|
|
628
|
-
emitter.emit("notification.archive.pending", {
|
|
629
|
-
args,
|
|
630
|
-
data: optimisticValue
|
|
631
|
-
});
|
|
632
|
-
const response = yield apiService.archive(notificationId);
|
|
633
|
-
const updatedNotification = new Notification(response, emitter, apiService);
|
|
634
|
-
emitter.emit("notification.archive.resolved", { args, data: updatedNotification });
|
|
635
|
-
return { data: updatedNotification };
|
|
636
|
-
} catch (error) {
|
|
637
|
-
emitter.emit("notification.archive.resolved", { args, error });
|
|
638
|
-
return { error: new NovuError("Failed to archive notification", error) };
|
|
639
|
-
}
|
|
640
|
-
});
|
|
641
|
-
var unarchive = (_0) => __async(void 0, [_0], function* ({
|
|
642
|
-
emitter,
|
|
643
|
-
apiService,
|
|
644
|
-
args
|
|
645
|
-
}) {
|
|
646
|
-
const { notificationId, optimisticValue } = getNotificationDetails(
|
|
647
|
-
args,
|
|
648
|
-
{
|
|
649
|
-
isArchived: false,
|
|
650
|
-
archivedAt: null,
|
|
651
|
-
isRead: true,
|
|
652
|
-
readAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
653
|
-
},
|
|
654
|
-
{
|
|
655
|
-
emitter,
|
|
656
|
-
apiService
|
|
657
|
-
}
|
|
658
|
-
);
|
|
659
|
-
try {
|
|
660
|
-
emitter.emit("notification.unarchive.pending", {
|
|
661
|
-
args,
|
|
662
|
-
data: optimisticValue
|
|
663
|
-
});
|
|
664
|
-
const response = yield apiService.unarchive(notificationId);
|
|
665
|
-
const updatedNotification = new Notification(response, emitter, apiService);
|
|
666
|
-
emitter.emit("notification.unarchive.resolved", { args, data: updatedNotification });
|
|
667
|
-
return { data: updatedNotification };
|
|
668
|
-
} catch (error) {
|
|
669
|
-
emitter.emit("notification.unarchive.resolved", { args, error });
|
|
670
|
-
return { error: new NovuError("Failed to unarchive notification", error) };
|
|
671
|
-
}
|
|
672
|
-
});
|
|
673
|
-
var snooze = (_0) => __async(void 0, [_0], function* ({
|
|
674
|
-
emitter,
|
|
675
|
-
apiService,
|
|
676
|
-
args
|
|
677
|
-
}) {
|
|
678
|
-
const { notificationId, optimisticValue } = getNotificationDetails(
|
|
679
|
-
args,
|
|
680
|
-
{
|
|
681
|
-
isSnoozed: true,
|
|
682
|
-
snoozedUntil: args.snoozeUntil
|
|
683
|
-
},
|
|
684
|
-
{
|
|
685
|
-
emitter,
|
|
686
|
-
apiService
|
|
687
|
-
}
|
|
688
|
-
);
|
|
689
|
-
try {
|
|
690
|
-
emitter.emit("notification.snooze.pending", {
|
|
691
|
-
args,
|
|
692
|
-
data: optimisticValue
|
|
693
|
-
});
|
|
694
|
-
const response = yield apiService.snooze(notificationId, args.snoozeUntil);
|
|
695
|
-
const updatedNotification = new Notification(response, emitter, apiService);
|
|
696
|
-
emitter.emit("notification.snooze.resolved", { args, data: updatedNotification });
|
|
697
|
-
return { data: updatedNotification };
|
|
698
|
-
} catch (error) {
|
|
699
|
-
emitter.emit("notification.snooze.resolved", { args, error });
|
|
700
|
-
return { error: new NovuError("Failed to snooze notification", error) };
|
|
701
|
-
}
|
|
702
|
-
});
|
|
703
|
-
var unsnooze = (_0) => __async(void 0, [_0], function* ({
|
|
704
|
-
emitter,
|
|
705
|
-
apiService,
|
|
706
|
-
args
|
|
707
|
-
}) {
|
|
708
|
-
const { notificationId, optimisticValue } = getNotificationDetails(
|
|
709
|
-
args,
|
|
710
|
-
{
|
|
711
|
-
isSnoozed: false,
|
|
712
|
-
snoozedUntil: null
|
|
713
|
-
},
|
|
714
|
-
{
|
|
715
|
-
emitter,
|
|
716
|
-
apiService
|
|
717
|
-
}
|
|
718
|
-
);
|
|
719
|
-
try {
|
|
720
|
-
emitter.emit("notification.unsnooze.pending", {
|
|
721
|
-
args,
|
|
722
|
-
data: optimisticValue
|
|
723
|
-
});
|
|
724
|
-
const response = yield apiService.unsnooze(notificationId);
|
|
725
|
-
const updatedNotification = new Notification(response, emitter, apiService);
|
|
726
|
-
emitter.emit("notification.unsnooze.resolved", { args, data: updatedNotification });
|
|
727
|
-
return { data: updatedNotification };
|
|
728
|
-
} catch (error) {
|
|
729
|
-
emitter.emit("notification.unsnooze.resolved", { args, error });
|
|
730
|
-
return { error: new NovuError("Failed to unsnooze notification", error) };
|
|
731
|
-
}
|
|
732
|
-
});
|
|
733
|
-
var completeAction = (_0) => __async(void 0, [_0], function* ({
|
|
734
|
-
emitter,
|
|
735
|
-
apiService,
|
|
736
|
-
args,
|
|
737
|
-
actionType
|
|
738
|
-
}) {
|
|
739
|
-
const optimisticUpdate = actionType === "primary" /* PRIMARY */ ? {
|
|
740
|
-
primaryAction: __spreadProps(__spreadValues({}, "notification" in args ? args.notification.primaryAction : {}), {
|
|
741
|
-
isCompleted: true
|
|
742
|
-
})
|
|
743
|
-
} : {
|
|
744
|
-
secondaryAction: __spreadProps(__spreadValues({}, "notification" in args ? args.notification.secondaryAction : {}), {
|
|
745
|
-
isCompleted: true
|
|
746
|
-
})
|
|
747
|
-
};
|
|
748
|
-
const { notificationId, optimisticValue } = getNotificationDetails(args, optimisticUpdate, {
|
|
749
|
-
emitter,
|
|
750
|
-
apiService
|
|
751
|
-
});
|
|
752
|
-
try {
|
|
753
|
-
emitter.emit("notification.complete_action.pending", {
|
|
754
|
-
args,
|
|
755
|
-
data: optimisticValue
|
|
756
|
-
});
|
|
757
|
-
const response = yield apiService.completeAction({ actionType, notificationId });
|
|
758
|
-
const updatedNotification = new Notification(response, emitter, apiService);
|
|
759
|
-
emitter.emit("notification.complete_action.resolved", { args, data: updatedNotification });
|
|
760
|
-
return { data: updatedNotification };
|
|
761
|
-
} catch (error) {
|
|
762
|
-
emitter.emit("notification.complete_action.resolved", { args, error });
|
|
763
|
-
return { error: new NovuError(`Failed to complete ${actionType} action on the notification`, error) };
|
|
764
|
-
}
|
|
765
|
-
});
|
|
766
|
-
var revertAction = (_0) => __async(void 0, [_0], function* ({
|
|
767
|
-
emitter,
|
|
768
|
-
apiService,
|
|
769
|
-
args,
|
|
770
|
-
actionType
|
|
771
|
-
}) {
|
|
772
|
-
const optimisticUpdate = actionType === "primary" /* PRIMARY */ ? {
|
|
773
|
-
primaryAction: __spreadProps(__spreadValues({}, "notification" in args ? args.notification.primaryAction : {}), {
|
|
774
|
-
isCompleted: false
|
|
775
|
-
})
|
|
776
|
-
} : {
|
|
777
|
-
secondaryAction: __spreadProps(__spreadValues({}, "notification" in args ? args.notification.secondaryAction : {}), {
|
|
778
|
-
isCompleted: false
|
|
779
|
-
})
|
|
780
|
-
};
|
|
781
|
-
const { notificationId, optimisticValue } = getNotificationDetails(args, optimisticUpdate, {
|
|
782
|
-
emitter,
|
|
783
|
-
apiService
|
|
784
|
-
});
|
|
785
|
-
try {
|
|
786
|
-
emitter.emit("notification.revert_action.pending", {
|
|
787
|
-
args,
|
|
788
|
-
data: optimisticValue
|
|
789
|
-
});
|
|
790
|
-
const response = yield apiService.revertAction({ actionType, notificationId });
|
|
791
|
-
const updatedNotification = new Notification(response, emitter, apiService);
|
|
792
|
-
emitter.emit("notification.revert_action.resolved", { args, data: updatedNotification });
|
|
793
|
-
return { data: updatedNotification };
|
|
794
|
-
} catch (error) {
|
|
795
|
-
emitter.emit("notification.revert_action.resolved", { args, error });
|
|
796
|
-
return { error: new NovuError("Failed to fetch notifications", error) };
|
|
797
|
-
}
|
|
798
|
-
});
|
|
799
|
-
var getNotificationDetails = (args, update, dependencies) => {
|
|
800
|
-
if ("notification" in args) {
|
|
801
|
-
return {
|
|
802
|
-
notificationId: args.notification.id,
|
|
803
|
-
optimisticValue: new Notification(
|
|
804
|
-
__spreadValues(__spreadValues({}, args.notification), update),
|
|
805
|
-
dependencies.emitter,
|
|
806
|
-
dependencies.apiService
|
|
807
|
-
)
|
|
808
|
-
};
|
|
809
|
-
} else {
|
|
810
|
-
return {
|
|
811
|
-
notificationId: args.notificationId
|
|
812
|
-
};
|
|
813
|
-
}
|
|
814
|
-
};
|
|
815
|
-
var readAll = (_0) => __async(void 0, [_0], function* ({
|
|
816
|
-
emitter,
|
|
817
|
-
inboxService,
|
|
818
|
-
notificationsCache,
|
|
819
|
-
tags,
|
|
820
|
-
data
|
|
821
|
-
}) {
|
|
822
|
-
try {
|
|
823
|
-
const notifications = notificationsCache.getUniqueNotifications({ tags, data });
|
|
824
|
-
const optimisticNotifications = notifications.map(
|
|
825
|
-
(notification) => new Notification(
|
|
826
|
-
__spreadProps(__spreadValues({}, notification), {
|
|
827
|
-
isRead: true,
|
|
828
|
-
readAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
829
|
-
isArchived: false,
|
|
830
|
-
archivedAt: void 0
|
|
831
|
-
}),
|
|
832
|
-
emitter,
|
|
833
|
-
inboxService
|
|
834
|
-
)
|
|
835
|
-
);
|
|
836
|
-
emitter.emit("notifications.read_all.pending", { args: { tags, data }, data: optimisticNotifications });
|
|
837
|
-
yield inboxService.readAll({ tags, data });
|
|
838
|
-
emitter.emit("notifications.read_all.resolved", { args: { tags, data }, data: optimisticNotifications });
|
|
839
|
-
return {};
|
|
840
|
-
} catch (error) {
|
|
841
|
-
emitter.emit("notifications.read_all.resolved", { args: { tags, data }, error });
|
|
842
|
-
return { error: new NovuError("Failed to read all notifications", error) };
|
|
843
|
-
}
|
|
844
|
-
});
|
|
845
|
-
var seenAll = (_0) => __async(void 0, [_0], function* ({
|
|
846
|
-
emitter,
|
|
847
|
-
inboxService,
|
|
848
|
-
notificationsCache,
|
|
849
|
-
notificationIds,
|
|
850
|
-
tags,
|
|
851
|
-
data
|
|
852
|
-
}) {
|
|
853
|
-
try {
|
|
854
|
-
const notifications = notificationsCache.getUniqueNotifications({ tags, data });
|
|
855
|
-
const filteredNotifications = notificationIds && notificationIds.length > 0 ? notifications.filter((notification) => notificationIds.includes(notification.id)) : notifications;
|
|
856
|
-
const optimisticNotifications = filteredNotifications.map(
|
|
857
|
-
(notification) => new Notification(
|
|
858
|
-
__spreadProps(__spreadValues({}, notification), {
|
|
859
|
-
isSeen: true,
|
|
860
|
-
firstSeenAt: notification.firstSeenAt || (/* @__PURE__ */ new Date()).toISOString()
|
|
861
|
-
}),
|
|
862
|
-
emitter,
|
|
863
|
-
inboxService
|
|
864
|
-
)
|
|
865
|
-
);
|
|
866
|
-
emitter.emit("notifications.seen_all.pending", {
|
|
867
|
-
args: { notificationIds, tags, data },
|
|
868
|
-
data: optimisticNotifications
|
|
869
|
-
});
|
|
870
|
-
yield inboxService.markAsSeen({ notificationIds, tags, data });
|
|
871
|
-
emitter.emit("notifications.seen_all.resolved", {
|
|
872
|
-
args: { notificationIds, tags, data },
|
|
873
|
-
data: optimisticNotifications
|
|
874
|
-
});
|
|
875
|
-
return {};
|
|
876
|
-
} catch (error) {
|
|
877
|
-
emitter.emit("notifications.seen_all.resolved", { args: { notificationIds, tags, data }, error });
|
|
878
|
-
return { error: new NovuError("Failed to mark all notifications as seen", error) };
|
|
879
|
-
}
|
|
880
|
-
});
|
|
881
|
-
var archiveAll = (_0) => __async(void 0, [_0], function* ({
|
|
882
|
-
emitter,
|
|
883
|
-
inboxService,
|
|
884
|
-
notificationsCache,
|
|
885
|
-
tags,
|
|
886
|
-
data
|
|
887
|
-
}) {
|
|
888
|
-
try {
|
|
889
|
-
const notifications = notificationsCache.getUniqueNotifications({ tags, data });
|
|
890
|
-
const optimisticNotifications = notifications.map(
|
|
891
|
-
(notification) => new Notification(
|
|
892
|
-
__spreadProps(__spreadValues({}, notification), {
|
|
893
|
-
isRead: true,
|
|
894
|
-
readAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
895
|
-
isArchived: true,
|
|
896
|
-
archivedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
897
|
-
}),
|
|
898
|
-
emitter,
|
|
899
|
-
inboxService
|
|
900
|
-
)
|
|
901
|
-
);
|
|
902
|
-
emitter.emit("notifications.archive_all.pending", { args: { tags, data }, data: optimisticNotifications });
|
|
903
|
-
yield inboxService.archiveAll({ tags, data });
|
|
904
|
-
emitter.emit("notifications.archive_all.resolved", { args: { tags, data }, data: optimisticNotifications });
|
|
905
|
-
return {};
|
|
906
|
-
} catch (error) {
|
|
907
|
-
emitter.emit("notifications.archive_all.resolved", { args: { tags, data }, error });
|
|
908
|
-
return { error: new NovuError("Failed to archive all notifications", error) };
|
|
909
|
-
}
|
|
910
|
-
});
|
|
911
|
-
var archiveAllRead = (_0) => __async(void 0, [_0], function* ({
|
|
912
|
-
emitter,
|
|
913
|
-
inboxService,
|
|
914
|
-
notificationsCache,
|
|
915
|
-
tags,
|
|
916
|
-
data
|
|
917
|
-
}) {
|
|
918
|
-
try {
|
|
919
|
-
const notifications = notificationsCache.getUniqueNotifications({ tags, data, read: true });
|
|
920
|
-
const optimisticNotifications = notifications.map(
|
|
921
|
-
(notification) => new Notification(
|
|
922
|
-
__spreadProps(__spreadValues({}, notification), { isArchived: true, archivedAt: (/* @__PURE__ */ new Date()).toISOString() }),
|
|
923
|
-
emitter,
|
|
924
|
-
inboxService
|
|
925
|
-
)
|
|
926
|
-
);
|
|
927
|
-
emitter.emit("notifications.archive_all_read.pending", { args: { tags, data }, data: optimisticNotifications });
|
|
928
|
-
yield inboxService.archiveAllRead({ tags, data });
|
|
929
|
-
emitter.emit("notifications.archive_all_read.resolved", { args: { tags, data }, data: optimisticNotifications });
|
|
930
|
-
return {};
|
|
931
|
-
} catch (error) {
|
|
932
|
-
emitter.emit("notifications.archive_all_read.resolved", { args: { tags, data }, error });
|
|
933
|
-
return { error: new NovuError("Failed to archive all read notifications", error) };
|
|
934
|
-
}
|
|
935
|
-
});
|
|
936
|
-
var deleteNotification = (_0) => __async(void 0, [_0], function* ({
|
|
937
|
-
emitter,
|
|
938
|
-
apiService,
|
|
939
|
-
args
|
|
940
|
-
}) {
|
|
941
|
-
const { notificationId } = getNotificationDetails(
|
|
942
|
-
args,
|
|
943
|
-
{},
|
|
944
|
-
{
|
|
945
|
-
emitter,
|
|
946
|
-
apiService
|
|
947
|
-
}
|
|
948
|
-
);
|
|
949
|
-
try {
|
|
950
|
-
emitter.emit("notification.delete.pending", {
|
|
951
|
-
args
|
|
952
|
-
});
|
|
953
|
-
yield apiService.delete(notificationId);
|
|
954
|
-
emitter.emit("notification.delete.resolved", { args });
|
|
955
|
-
return {};
|
|
956
|
-
} catch (error) {
|
|
957
|
-
emitter.emit("notification.delete.resolved", { args, error });
|
|
958
|
-
return { error: new NovuError("Failed to delete notification", error) };
|
|
959
|
-
}
|
|
960
|
-
});
|
|
961
|
-
var deleteAll = (_0) => __async(void 0, [_0], function* ({
|
|
962
|
-
emitter,
|
|
963
|
-
inboxService,
|
|
964
|
-
notificationsCache,
|
|
965
|
-
tags,
|
|
966
|
-
data
|
|
967
|
-
}) {
|
|
968
|
-
try {
|
|
969
|
-
const notifications = notificationsCache.getUniqueNotifications({ tags, data });
|
|
970
|
-
emitter.emit("notifications.delete_all.pending", { args: { tags, data }, data: notifications });
|
|
971
|
-
yield inboxService.deleteAll({ tags, data });
|
|
972
|
-
emitter.emit("notifications.delete_all.resolved", { args: { tags, data } });
|
|
973
|
-
return {};
|
|
974
|
-
} catch (error) {
|
|
975
|
-
emitter.emit("notifications.delete_all.resolved", { args: { tags, data }, error });
|
|
976
|
-
return { error: new NovuError("Failed to delete all notifications", error) };
|
|
977
|
-
}
|
|
978
|
-
});
|
|
979
|
-
|
|
980
|
-
// src/notifications/notification.ts
|
|
981
|
-
var _emitter, _inboxService;
|
|
982
|
-
var Notification = class {
|
|
983
|
-
constructor(notification, emitter, inboxService) {
|
|
984
|
-
__privateAdd(this, _emitter);
|
|
985
|
-
__privateAdd(this, _inboxService);
|
|
986
|
-
__privateSet(this, _emitter, emitter);
|
|
987
|
-
__privateSet(this, _inboxService, inboxService);
|
|
988
|
-
this.id = notification.id;
|
|
989
|
-
this.transactionId = notification.transactionId;
|
|
990
|
-
this.subject = notification.subject;
|
|
991
|
-
this.body = notification.body;
|
|
992
|
-
this.to = notification.to;
|
|
993
|
-
this.isRead = notification.isRead;
|
|
994
|
-
this.isSeen = notification.isSeen;
|
|
995
|
-
this.isArchived = notification.isArchived;
|
|
996
|
-
this.isSnoozed = notification.isSnoozed;
|
|
997
|
-
this.snoozedUntil = notification.snoozedUntil;
|
|
998
|
-
this.deliveredAt = notification.deliveredAt;
|
|
999
|
-
this.createdAt = notification.createdAt;
|
|
1000
|
-
this.readAt = notification.readAt;
|
|
1001
|
-
this.firstSeenAt = notification.firstSeenAt;
|
|
1002
|
-
this.archivedAt = notification.archivedAt;
|
|
1003
|
-
this.avatar = notification.avatar;
|
|
1004
|
-
this.primaryAction = notification.primaryAction;
|
|
1005
|
-
this.secondaryAction = notification.secondaryAction;
|
|
1006
|
-
this.channelType = notification.channelType;
|
|
1007
|
-
this.tags = notification.tags;
|
|
1008
|
-
this.redirect = notification.redirect;
|
|
1009
|
-
this.data = notification.data;
|
|
1010
|
-
this.workflow = notification.workflow;
|
|
1011
|
-
this.severity = notification.severity;
|
|
1012
|
-
}
|
|
1013
|
-
read() {
|
|
1014
|
-
return read({
|
|
1015
|
-
emitter: __privateGet(this, _emitter),
|
|
1016
|
-
apiService: __privateGet(this, _inboxService),
|
|
1017
|
-
args: {
|
|
1018
|
-
notification: this
|
|
1019
|
-
}
|
|
1020
|
-
});
|
|
1021
|
-
}
|
|
1022
|
-
unread() {
|
|
1023
|
-
return unread({
|
|
1024
|
-
emitter: __privateGet(this, _emitter),
|
|
1025
|
-
apiService: __privateGet(this, _inboxService),
|
|
1026
|
-
args: {
|
|
1027
|
-
notification: this
|
|
1028
|
-
}
|
|
1029
|
-
});
|
|
1030
|
-
}
|
|
1031
|
-
seen() {
|
|
1032
|
-
return seen({
|
|
1033
|
-
emitter: __privateGet(this, _emitter),
|
|
1034
|
-
apiService: __privateGet(this, _inboxService),
|
|
1035
|
-
args: {
|
|
1036
|
-
notification: this
|
|
1037
|
-
}
|
|
1038
|
-
});
|
|
1039
|
-
}
|
|
1040
|
-
archive() {
|
|
1041
|
-
return archive({
|
|
1042
|
-
emitter: __privateGet(this, _emitter),
|
|
1043
|
-
apiService: __privateGet(this, _inboxService),
|
|
1044
|
-
args: {
|
|
1045
|
-
notification: this
|
|
1046
|
-
}
|
|
1047
|
-
});
|
|
1048
|
-
}
|
|
1049
|
-
unarchive() {
|
|
1050
|
-
return unarchive({
|
|
1051
|
-
emitter: __privateGet(this, _emitter),
|
|
1052
|
-
apiService: __privateGet(this, _inboxService),
|
|
1053
|
-
args: {
|
|
1054
|
-
notification: this
|
|
1055
|
-
}
|
|
1056
|
-
});
|
|
1057
|
-
}
|
|
1058
|
-
delete() {
|
|
1059
|
-
return deleteNotification({
|
|
1060
|
-
emitter: __privateGet(this, _emitter),
|
|
1061
|
-
apiService: __privateGet(this, _inboxService),
|
|
1062
|
-
args: {
|
|
1063
|
-
notification: this
|
|
1064
|
-
}
|
|
1065
|
-
});
|
|
1066
|
-
}
|
|
1067
|
-
snooze(snoozeUntil) {
|
|
1068
|
-
return snooze({
|
|
1069
|
-
emitter: __privateGet(this, _emitter),
|
|
1070
|
-
apiService: __privateGet(this, _inboxService),
|
|
1071
|
-
args: {
|
|
1072
|
-
notification: this,
|
|
1073
|
-
snoozeUntil
|
|
1074
|
-
}
|
|
1075
|
-
});
|
|
1076
|
-
}
|
|
1077
|
-
unsnooze() {
|
|
1078
|
-
return unsnooze({
|
|
1079
|
-
emitter: __privateGet(this, _emitter),
|
|
1080
|
-
apiService: __privateGet(this, _inboxService),
|
|
1081
|
-
args: { notification: this }
|
|
1082
|
-
});
|
|
1083
|
-
}
|
|
1084
|
-
completePrimary() {
|
|
1085
|
-
if (!this.primaryAction) {
|
|
1086
|
-
throw new Error("Primary action is not available");
|
|
1087
|
-
}
|
|
1088
|
-
return completeAction({
|
|
1089
|
-
emitter: __privateGet(this, _emitter),
|
|
1090
|
-
apiService: __privateGet(this, _inboxService),
|
|
1091
|
-
args: {
|
|
1092
|
-
notification: this
|
|
1093
|
-
},
|
|
1094
|
-
actionType: "primary" /* PRIMARY */
|
|
1095
|
-
});
|
|
1096
|
-
}
|
|
1097
|
-
completeSecondary() {
|
|
1098
|
-
if (!this.primaryAction) {
|
|
1099
|
-
throw new Error("Secondary action is not available");
|
|
1100
|
-
}
|
|
1101
|
-
return completeAction({
|
|
1102
|
-
emitter: __privateGet(this, _emitter),
|
|
1103
|
-
apiService: __privateGet(this, _inboxService),
|
|
1104
|
-
args: {
|
|
1105
|
-
notification: this
|
|
1106
|
-
},
|
|
1107
|
-
actionType: "secondary" /* SECONDARY */
|
|
1108
|
-
});
|
|
1109
|
-
}
|
|
1110
|
-
revertPrimary() {
|
|
1111
|
-
if (!this.primaryAction) {
|
|
1112
|
-
throw new Error("Primary action is not available");
|
|
1113
|
-
}
|
|
1114
|
-
return revertAction({
|
|
1115
|
-
emitter: __privateGet(this, _emitter),
|
|
1116
|
-
apiService: __privateGet(this, _inboxService),
|
|
1117
|
-
args: {
|
|
1118
|
-
notification: this
|
|
1119
|
-
},
|
|
1120
|
-
actionType: "primary" /* PRIMARY */
|
|
1121
|
-
});
|
|
1122
|
-
}
|
|
1123
|
-
revertSecondary() {
|
|
1124
|
-
if (!this.primaryAction) {
|
|
1125
|
-
throw new Error("Secondary action is not available");
|
|
1126
|
-
}
|
|
1127
|
-
return revertAction({
|
|
1128
|
-
emitter: __privateGet(this, _emitter),
|
|
1129
|
-
apiService: __privateGet(this, _inboxService),
|
|
1130
|
-
args: {
|
|
1131
|
-
notification: this
|
|
1132
|
-
},
|
|
1133
|
-
actionType: "secondary" /* SECONDARY */
|
|
1134
|
-
});
|
|
1135
|
-
}
|
|
1136
|
-
on(eventName, listener) {
|
|
1137
|
-
const cleanup = __privateGet(this, _emitter).on(eventName, listener);
|
|
1138
|
-
return () => {
|
|
1139
|
-
cleanup();
|
|
1140
|
-
};
|
|
1141
|
-
}
|
|
1142
|
-
/**
|
|
1143
|
-
* @deprecated
|
|
1144
|
-
* Use the cleanup function returned by the "on" method instead.
|
|
1145
|
-
*/
|
|
1146
|
-
off(eventName, listener) {
|
|
1147
|
-
__privateGet(this, _emitter).off(eventName, listener);
|
|
1148
|
-
}
|
|
1149
|
-
};
|
|
1150
|
-
_emitter = new WeakMap();
|
|
1151
|
-
_inboxService = new WeakMap();
|
|
1152
|
-
|
|
1153
461
|
// src/base-module.ts
|
|
1154
462
|
var _callsQueue, _sessionError;
|
|
1155
463
|
var BaseModule = class {
|
|
@@ -1298,10 +606,11 @@ var removeEvents = [
|
|
|
1298
606
|
"notifications.archive_all_read.pending",
|
|
1299
607
|
"notifications.delete_all.pending"
|
|
1300
608
|
];
|
|
1301
|
-
var
|
|
609
|
+
var _emitter, _inboxService, _cache2;
|
|
1302
610
|
var NotificationsCache = class {
|
|
1303
|
-
constructor({ emitter }) {
|
|
1304
|
-
__privateAdd(this,
|
|
611
|
+
constructor({ emitter, inboxService }) {
|
|
612
|
+
__privateAdd(this, _emitter);
|
|
613
|
+
__privateAdd(this, _inboxService);
|
|
1305
614
|
/**
|
|
1306
615
|
* The key is the stringified notifications filter, the values are the paginated notifications.
|
|
1307
616
|
*/
|
|
@@ -1381,17 +690,18 @@ var NotificationsCache = class {
|
|
|
1381
690
|
});
|
|
1382
691
|
uniqueFilterKeys.forEach((key) => {
|
|
1383
692
|
const notificationsResponse = this.getAggregated(getFilter(key));
|
|
1384
|
-
__privateGet(this,
|
|
693
|
+
__privateGet(this, _emitter).emit("notifications.list.updated", {
|
|
1385
694
|
data: notificationsResponse
|
|
1386
695
|
});
|
|
1387
696
|
});
|
|
1388
697
|
};
|
|
1389
|
-
__privateSet(this,
|
|
698
|
+
__privateSet(this, _emitter, emitter);
|
|
699
|
+
__privateSet(this, _inboxService, inboxService);
|
|
1390
700
|
updateEvents.forEach((event) => {
|
|
1391
|
-
__privateGet(this,
|
|
701
|
+
__privateGet(this, _emitter).on(event, this.handleNotificationEvent());
|
|
1392
702
|
});
|
|
1393
703
|
removeEvents.forEach((event) => {
|
|
1394
|
-
__privateGet(this,
|
|
704
|
+
__privateGet(this, _emitter).on(event, this.handleNotificationEvent({ remove: true }));
|
|
1395
705
|
});
|
|
1396
706
|
__privateSet(this, _cache2, new InMemoryCache());
|
|
1397
707
|
}
|
|
@@ -1414,16 +724,35 @@ var NotificationsCache = class {
|
|
|
1414
724
|
{ hasMore: false, filter: {}, notifications: [] }
|
|
1415
725
|
);
|
|
1416
726
|
}
|
|
727
|
+
get(args) {
|
|
728
|
+
return __privateGet(this, _cache2).get(getCacheKey(args));
|
|
729
|
+
}
|
|
1417
730
|
has(args) {
|
|
1418
731
|
return __privateGet(this, _cache2).get(getCacheKey(args)) !== void 0;
|
|
1419
732
|
}
|
|
1420
733
|
set(args, data) {
|
|
1421
734
|
__privateGet(this, _cache2).set(getCacheKey(args), data);
|
|
1422
735
|
}
|
|
736
|
+
unshift(args, notification) {
|
|
737
|
+
const cacheKey = getCacheKey(args);
|
|
738
|
+
const cachedData = __privateGet(this, _cache2).get(cacheKey) || {
|
|
739
|
+
hasMore: false,
|
|
740
|
+
filter: getFilter(cacheKey),
|
|
741
|
+
notifications: []
|
|
742
|
+
};
|
|
743
|
+
const notificationInstance = createNotification({
|
|
744
|
+
notification: __spreadValues({}, notification),
|
|
745
|
+
emitter: __privateGet(this, _emitter),
|
|
746
|
+
inboxService: __privateGet(this, _inboxService)
|
|
747
|
+
});
|
|
748
|
+
this.update(args, __spreadProps(__spreadValues({}, cachedData), {
|
|
749
|
+
notifications: [notificationInstance, ...cachedData.notifications]
|
|
750
|
+
}));
|
|
751
|
+
}
|
|
1423
752
|
update(args, data) {
|
|
1424
753
|
this.set(args, data);
|
|
1425
754
|
const notificationsResponse = this.getAggregated(getFilter(getCacheKey(args)));
|
|
1426
|
-
__privateGet(this,
|
|
755
|
+
__privateGet(this, _emitter).emit("notifications.list.updated", {
|
|
1427
756
|
data: notificationsResponse
|
|
1428
757
|
});
|
|
1429
758
|
}
|
|
@@ -1477,7 +806,8 @@ var NotificationsCache = class {
|
|
|
1477
806
|
__privateGet(this, _cache2).clear();
|
|
1478
807
|
}
|
|
1479
808
|
};
|
|
1480
|
-
|
|
809
|
+
_emitter = new WeakMap();
|
|
810
|
+
_inboxService = new WeakMap();
|
|
1481
811
|
_cache2 = new WeakMap();
|
|
1482
812
|
|
|
1483
813
|
// src/notifications/notifications.ts
|
|
@@ -1494,13 +824,11 @@ var Notifications = class extends BaseModule {
|
|
|
1494
824
|
});
|
|
1495
825
|
__privateAdd(this, _useCache);
|
|
1496
826
|
this.cache = new NotificationsCache({
|
|
1497
|
-
emitter: eventEmitterInstance
|
|
827
|
+
emitter: eventEmitterInstance,
|
|
828
|
+
inboxService: inboxServiceInstance
|
|
1498
829
|
});
|
|
1499
830
|
__privateSet(this, _useCache, useCache);
|
|
1500
831
|
}
|
|
1501
|
-
get inboxService() {
|
|
1502
|
-
return this._inboxService;
|
|
1503
|
-
}
|
|
1504
832
|
list() {
|
|
1505
833
|
return __async(this, arguments, function* (_a = {}) {
|
|
1506
834
|
var _b = _a, { limit = 10 } = _b, restOptions = __objRest(_b, ["limit"]);
|
|
@@ -1822,7 +1150,7 @@ var Notifications = class extends BaseModule {
|
|
|
1822
1150
|
_useCache = new WeakMap();
|
|
1823
1151
|
|
|
1824
1152
|
// src/preferences/schedule.ts
|
|
1825
|
-
var
|
|
1153
|
+
var _emitter2, _apiService, _cache3, _useCache2;
|
|
1826
1154
|
var Schedule = class {
|
|
1827
1155
|
constructor(schedule, {
|
|
1828
1156
|
emitterInstance,
|
|
@@ -1830,11 +1158,11 @@ var Schedule = class {
|
|
|
1830
1158
|
cache,
|
|
1831
1159
|
useCache
|
|
1832
1160
|
}) {
|
|
1833
|
-
__privateAdd(this,
|
|
1161
|
+
__privateAdd(this, _emitter2);
|
|
1834
1162
|
__privateAdd(this, _apiService);
|
|
1835
1163
|
__privateAdd(this, _cache3);
|
|
1836
1164
|
__privateAdd(this, _useCache2);
|
|
1837
|
-
__privateSet(this,
|
|
1165
|
+
__privateSet(this, _emitter2, emitterInstance);
|
|
1838
1166
|
__privateSet(this, _apiService, inboxServiceInstance);
|
|
1839
1167
|
__privateSet(this, _cache3, cache);
|
|
1840
1168
|
__privateSet(this, _useCache2, useCache);
|
|
@@ -1846,7 +1174,7 @@ var Schedule = class {
|
|
|
1846
1174
|
var _a;
|
|
1847
1175
|
const hasWeeklySchedule = !!args.weeklySchedule || !!this.weeklySchedule;
|
|
1848
1176
|
return updateSchedule({
|
|
1849
|
-
emitter: __privateGet(this,
|
|
1177
|
+
emitter: __privateGet(this, _emitter2),
|
|
1850
1178
|
apiService: __privateGet(this, _apiService),
|
|
1851
1179
|
cache: __privateGet(this, _cache3),
|
|
1852
1180
|
useCache: __privateGet(this, _useCache2),
|
|
@@ -1859,13 +1187,13 @@ var Schedule = class {
|
|
|
1859
1187
|
});
|
|
1860
1188
|
}
|
|
1861
1189
|
};
|
|
1862
|
-
|
|
1190
|
+
_emitter2 = new WeakMap();
|
|
1863
1191
|
_apiService = new WeakMap();
|
|
1864
1192
|
_cache3 = new WeakMap();
|
|
1865
1193
|
_useCache2 = new WeakMap();
|
|
1866
1194
|
|
|
1867
1195
|
// src/preferences/preference.ts
|
|
1868
|
-
var
|
|
1196
|
+
var _emitter3, _apiService2, _cache4, _scheduleCache, _useCache3;
|
|
1869
1197
|
var Preference = class {
|
|
1870
1198
|
constructor(preference, {
|
|
1871
1199
|
emitterInstance,
|
|
@@ -1874,12 +1202,12 @@ var Preference = class {
|
|
|
1874
1202
|
scheduleCache,
|
|
1875
1203
|
useCache
|
|
1876
1204
|
}) {
|
|
1877
|
-
__privateAdd(this,
|
|
1205
|
+
__privateAdd(this, _emitter3);
|
|
1878
1206
|
__privateAdd(this, _apiService2);
|
|
1879
1207
|
__privateAdd(this, _cache4);
|
|
1880
1208
|
__privateAdd(this, _scheduleCache);
|
|
1881
1209
|
__privateAdd(this, _useCache3);
|
|
1882
|
-
__privateSet(this,
|
|
1210
|
+
__privateSet(this, _emitter3, emitterInstance);
|
|
1883
1211
|
__privateSet(this, _apiService2, inboxServiceInstance);
|
|
1884
1212
|
__privateSet(this, _cache4, cache);
|
|
1885
1213
|
__privateSet(this, _scheduleCache, scheduleCache);
|
|
@@ -1899,7 +1227,7 @@ var Preference = class {
|
|
|
1899
1227
|
}) {
|
|
1900
1228
|
var _a;
|
|
1901
1229
|
return updatePreference({
|
|
1902
|
-
emitter: __privateGet(this,
|
|
1230
|
+
emitter: __privateGet(this, _emitter3),
|
|
1903
1231
|
apiService: __privateGet(this, _apiService2),
|
|
1904
1232
|
cache: __privateGet(this, _cache4),
|
|
1905
1233
|
scheduleCache: __privateGet(this, _scheduleCache),
|
|
@@ -1912,7 +1240,7 @@ var Preference = class {
|
|
|
1912
1240
|
});
|
|
1913
1241
|
}
|
|
1914
1242
|
};
|
|
1915
|
-
|
|
1243
|
+
_emitter3 = new WeakMap();
|
|
1916
1244
|
_apiService2 = new WeakMap();
|
|
1917
1245
|
_cache4 = new WeakMap();
|
|
1918
1246
|
_scheduleCache = new WeakMap();
|
|
@@ -2204,10 +1532,10 @@ var excludeEmpty2 = ({ tags, severity }) => Object.entries({ tags, severity }).r
|
|
|
2204
1532
|
var getCacheKey2 = ({ tags, severity }) => {
|
|
2205
1533
|
return JSON.stringify(excludeEmpty2({ tags, severity }));
|
|
2206
1534
|
};
|
|
2207
|
-
var
|
|
1535
|
+
var _emitter4, _cache5;
|
|
2208
1536
|
var PreferencesCache = class {
|
|
2209
1537
|
constructor({ emitterInstance }) {
|
|
2210
|
-
__privateAdd(this,
|
|
1538
|
+
__privateAdd(this, _emitter4);
|
|
2211
1539
|
__privateAdd(this, _cache5);
|
|
2212
1540
|
this.updatePreference = (key, data) => {
|
|
2213
1541
|
const preferences = __privateGet(this, _cache5).get(key);
|
|
@@ -2258,7 +1586,7 @@ var PreferencesCache = class {
|
|
|
2258
1586
|
uniqueFilterKeys.add(key);
|
|
2259
1587
|
}
|
|
2260
1588
|
for (const key of uniqueFilterKeys) {
|
|
2261
|
-
__privateGet(this,
|
|
1589
|
+
__privateGet(this, _emitter4).emit("preferences.list.updated", {
|
|
2262
1590
|
data: (_a = __privateGet(this, _cache5).get(key)) != null ? _a : []
|
|
2263
1591
|
});
|
|
2264
1592
|
}
|
|
@@ -2281,17 +1609,17 @@ var PreferencesCache = class {
|
|
|
2281
1609
|
});
|
|
2282
1610
|
uniqueFilterKeys.forEach((key) => {
|
|
2283
1611
|
var _a;
|
|
2284
|
-
__privateGet(this,
|
|
1612
|
+
__privateGet(this, _emitter4).emit("preferences.list.updated", {
|
|
2285
1613
|
data: (_a = __privateGet(this, _cache5).get(key)) != null ? _a : []
|
|
2286
1614
|
});
|
|
2287
1615
|
});
|
|
2288
1616
|
};
|
|
2289
|
-
__privateSet(this,
|
|
1617
|
+
__privateSet(this, _emitter4, emitterInstance);
|
|
2290
1618
|
for (const event of updateEvents2) {
|
|
2291
|
-
__privateGet(this,
|
|
1619
|
+
__privateGet(this, _emitter4).on(event, this.handlePreferenceEvent);
|
|
2292
1620
|
}
|
|
2293
1621
|
for (const event of scheduleUpdateEvents) {
|
|
2294
|
-
__privateGet(this,
|
|
1622
|
+
__privateGet(this, _emitter4).on(event, this.handleScheduleEvent);
|
|
2295
1623
|
}
|
|
2296
1624
|
__privateSet(this, _cache5, new InMemoryCache());
|
|
2297
1625
|
}
|
|
@@ -2310,7 +1638,7 @@ var PreferencesCache = class {
|
|
|
2310
1638
|
__privateGet(this, _cache5).clear();
|
|
2311
1639
|
}
|
|
2312
1640
|
};
|
|
2313
|
-
|
|
1641
|
+
_emitter4 = new WeakMap();
|
|
2314
1642
|
_cache5 = new WeakMap();
|
|
2315
1643
|
|
|
2316
1644
|
// src/cache/schedule-cache.ts
|
|
@@ -2321,10 +1649,10 @@ var updateEvents3 = [
|
|
|
2321
1649
|
var getCacheKey3 = () => {
|
|
2322
1650
|
return "schedule";
|
|
2323
1651
|
};
|
|
2324
|
-
var
|
|
1652
|
+
var _emitter5, _cache6;
|
|
2325
1653
|
var ScheduleCache = class {
|
|
2326
1654
|
constructor({ emitterInstance }) {
|
|
2327
|
-
__privateAdd(this,
|
|
1655
|
+
__privateAdd(this, _emitter5);
|
|
2328
1656
|
__privateAdd(this, _cache6);
|
|
2329
1657
|
this.updateScheduleInCache = (key, data) => {
|
|
2330
1658
|
const schedule = __privateGet(this, _cache6).get(key);
|
|
@@ -2349,14 +1677,14 @@ var ScheduleCache = class {
|
|
|
2349
1677
|
uniqueFilterKeys.add(key);
|
|
2350
1678
|
}
|
|
2351
1679
|
for (const key of uniqueFilterKeys) {
|
|
2352
|
-
__privateGet(this,
|
|
1680
|
+
__privateGet(this, _emitter5).emit("preference.schedule.get.updated", {
|
|
2353
1681
|
data: __privateGet(this, _cache6).get(key)
|
|
2354
1682
|
});
|
|
2355
1683
|
}
|
|
2356
1684
|
};
|
|
2357
|
-
__privateSet(this,
|
|
1685
|
+
__privateSet(this, _emitter5, emitterInstance);
|
|
2358
1686
|
for (const event of updateEvents3) {
|
|
2359
|
-
__privateGet(this,
|
|
1687
|
+
__privateGet(this, _emitter5).on(event, this.handleScheduleEvent);
|
|
2360
1688
|
}
|
|
2361
1689
|
__privateSet(this, _cache6, new InMemoryCache());
|
|
2362
1690
|
}
|
|
@@ -2375,7 +1703,7 @@ var ScheduleCache = class {
|
|
|
2375
1703
|
__privateGet(this, _cache6).clear();
|
|
2376
1704
|
}
|
|
2377
1705
|
};
|
|
2378
|
-
|
|
1706
|
+
_emitter5 = new WeakMap();
|
|
2379
1707
|
_cache6 = new WeakMap();
|
|
2380
1708
|
|
|
2381
1709
|
// src/preferences/preferences.ts
|
|
@@ -2478,13 +1806,13 @@ function isBrowser() {
|
|
|
2478
1806
|
}
|
|
2479
1807
|
|
|
2480
1808
|
// src/session/session.ts
|
|
2481
|
-
var
|
|
1809
|
+
var _emitter6, _inboxService2, _options;
|
|
2482
1810
|
var Session = class {
|
|
2483
1811
|
constructor(options, inboxServiceInstance, eventEmitterInstance) {
|
|
2484
|
-
__privateAdd(this,
|
|
1812
|
+
__privateAdd(this, _emitter6);
|
|
2485
1813
|
__privateAdd(this, _inboxService2);
|
|
2486
1814
|
__privateAdd(this, _options);
|
|
2487
|
-
__privateSet(this,
|
|
1815
|
+
__privateSet(this, _emitter6, eventEmitterInstance);
|
|
2488
1816
|
__privateSet(this, _inboxService2, inboxServiceInstance);
|
|
2489
1817
|
__privateSet(this, _options, options);
|
|
2490
1818
|
}
|
|
@@ -2556,7 +1884,7 @@ var Session = class {
|
|
|
2556
1884
|
} else {
|
|
2557
1885
|
this.handleApplicationIdentifier("delete");
|
|
2558
1886
|
}
|
|
2559
|
-
__privateGet(this,
|
|
1887
|
+
__privateGet(this, _emitter6).emit("session.initialize.pending", { args: __privateGet(this, _options) });
|
|
2560
1888
|
const response = yield __privateGet(this, _inboxService2).initializeSession({
|
|
2561
1889
|
applicationIdentifier: finalApplicationIdentifier,
|
|
2562
1890
|
subscriberHash,
|
|
@@ -2574,14 +1902,14 @@ var Session = class {
|
|
|
2574
1902
|
if (!((_f = response == null ? void 0 : response.applicationIdentifier) == null ? void 0 : _f.startsWith("pk_keyless_"))) {
|
|
2575
1903
|
this.handleApplicationIdentifier("delete");
|
|
2576
1904
|
}
|
|
2577
|
-
__privateGet(this,
|
|
1905
|
+
__privateGet(this, _emitter6).emit("session.initialize.resolved", { args: __privateGet(this, _options), data: response });
|
|
2578
1906
|
} catch (error) {
|
|
2579
|
-
__privateGet(this,
|
|
1907
|
+
__privateGet(this, _emitter6).emit("session.initialize.resolved", { args: __privateGet(this, _options), error });
|
|
2580
1908
|
}
|
|
2581
1909
|
});
|
|
2582
1910
|
}
|
|
2583
1911
|
};
|
|
2584
|
-
|
|
1912
|
+
_emitter6 = new WeakMap();
|
|
2585
1913
|
_inboxService2 = new WeakMap();
|
|
2586
1914
|
_options = new WeakMap();
|
|
2587
1915
|
var PRODUCTION_SOCKET_URL = "wss://socket.novu.co";
|
|
@@ -2675,7 +2003,7 @@ var mapToNotification = ({
|
|
|
2675
2003
|
severity
|
|
2676
2004
|
});
|
|
2677
2005
|
};
|
|
2678
|
-
var _token,
|
|
2006
|
+
var _token, _emitter7, _partySocket, _socketUrl, _notificationReceived, _unseenCountChanged, _unreadCountChanged, _handleMessage, _PartySocketClient_instances, initializeSocket_fn, handleConnectSocket_fn, handleDisconnectSocket_fn;
|
|
2679
2007
|
var PartySocketClient = class extends BaseModule {
|
|
2680
2008
|
constructor({
|
|
2681
2009
|
socketUrl,
|
|
@@ -2688,15 +2016,15 @@ var PartySocketClient = class extends BaseModule {
|
|
|
2688
2016
|
});
|
|
2689
2017
|
__privateAdd(this, _PartySocketClient_instances);
|
|
2690
2018
|
__privateAdd(this, _token);
|
|
2691
|
-
__privateAdd(this,
|
|
2019
|
+
__privateAdd(this, _emitter7);
|
|
2692
2020
|
__privateAdd(this, _partySocket);
|
|
2693
2021
|
__privateAdd(this, _socketUrl);
|
|
2694
2022
|
__privateAdd(this, _notificationReceived, (event) => {
|
|
2695
2023
|
try {
|
|
2696
2024
|
const data = JSON.parse(event.data);
|
|
2697
2025
|
if (data.event === "notification_received" /* RECEIVED */) {
|
|
2698
|
-
__privateGet(this,
|
|
2699
|
-
result: new Notification(mapToNotification(data.data.message), __privateGet(this,
|
|
2026
|
+
__privateGet(this, _emitter7).emit(NOTIFICATION_RECEIVED, {
|
|
2027
|
+
result: new Notification(mapToNotification(data.data.message), __privateGet(this, _emitter7), this._inboxService)
|
|
2700
2028
|
});
|
|
2701
2029
|
}
|
|
2702
2030
|
} catch (error) {
|
|
@@ -2707,7 +2035,7 @@ var PartySocketClient = class extends BaseModule {
|
|
|
2707
2035
|
try {
|
|
2708
2036
|
const data = JSON.parse(event.data);
|
|
2709
2037
|
if (data.event === "unseen_count_changed" /* UNSEEN */) {
|
|
2710
|
-
__privateGet(this,
|
|
2038
|
+
__privateGet(this, _emitter7).emit(UNSEEN_COUNT_CHANGED, {
|
|
2711
2039
|
result: data.data.unseenCount
|
|
2712
2040
|
});
|
|
2713
2041
|
}
|
|
@@ -2718,7 +2046,7 @@ var PartySocketClient = class extends BaseModule {
|
|
|
2718
2046
|
try {
|
|
2719
2047
|
const data = JSON.parse(event.data);
|
|
2720
2048
|
if (data.event === "unread_count_changed" /* UNREAD */) {
|
|
2721
|
-
__privateGet(this,
|
|
2049
|
+
__privateGet(this, _emitter7).emit(UNREAD_COUNT_CHANGED, {
|
|
2722
2050
|
result: data.data.counts
|
|
2723
2051
|
});
|
|
2724
2052
|
}
|
|
@@ -2743,7 +2071,7 @@ var PartySocketClient = class extends BaseModule {
|
|
|
2743
2071
|
} catch (error) {
|
|
2744
2072
|
}
|
|
2745
2073
|
});
|
|
2746
|
-
__privateSet(this,
|
|
2074
|
+
__privateSet(this, _emitter7, eventEmitterInstance);
|
|
2747
2075
|
__privateSet(this, _socketUrl, socketUrl != null ? socketUrl : PRODUCTION_SOCKET_URL);
|
|
2748
2076
|
}
|
|
2749
2077
|
onSessionSuccess({ token }) {
|
|
@@ -2770,7 +2098,7 @@ var PartySocketClient = class extends BaseModule {
|
|
|
2770
2098
|
}
|
|
2771
2099
|
};
|
|
2772
2100
|
_token = new WeakMap();
|
|
2773
|
-
|
|
2101
|
+
_emitter7 = new WeakMap();
|
|
2774
2102
|
_partySocket = new WeakMap();
|
|
2775
2103
|
_socketUrl = new WeakMap();
|
|
2776
2104
|
_notificationReceived = new WeakMap();
|
|
@@ -2784,15 +2112,15 @@ initializeSocket_fn = function() {
|
|
|
2784
2112
|
return;
|
|
2785
2113
|
}
|
|
2786
2114
|
const args = { socketUrl: __privateGet(this, _socketUrl) };
|
|
2787
|
-
__privateGet(this,
|
|
2115
|
+
__privateGet(this, _emitter7).emit("socket.connect.pending", { args });
|
|
2788
2116
|
const url = new URL(__privateGet(this, _socketUrl));
|
|
2789
2117
|
url.searchParams.set("token", __privateGet(this, _token));
|
|
2790
2118
|
__privateSet(this, _partySocket, new WebSocket(url.toString()));
|
|
2791
2119
|
__privateGet(this, _partySocket).addEventListener("open", () => {
|
|
2792
|
-
__privateGet(this,
|
|
2120
|
+
__privateGet(this, _emitter7).emit("socket.connect.resolved", { args });
|
|
2793
2121
|
});
|
|
2794
2122
|
__privateGet(this, _partySocket).addEventListener("error", (error) => {
|
|
2795
|
-
__privateGet(this,
|
|
2123
|
+
__privateGet(this, _emitter7).emit("socket.connect.resolved", { args, error });
|
|
2796
2124
|
});
|
|
2797
2125
|
__privateGet(this, _partySocket).addEventListener("message", __privateGet(this, _handleMessage));
|
|
2798
2126
|
});
|
|
@@ -2910,7 +2238,7 @@ var mapToNotification2 = ({
|
|
|
2910
2238
|
severity
|
|
2911
2239
|
});
|
|
2912
2240
|
};
|
|
2913
|
-
var _token2,
|
|
2241
|
+
var _token2, _emitter8, _socketIo, _socketUrl2, _notificationReceived2, _unseenCountChanged2, _unreadCountChanged2, _Socket_instances, initializeSocket_fn2, handleConnectSocket_fn2, handleDisconnectSocket_fn2;
|
|
2914
2242
|
var Socket = class extends BaseModule {
|
|
2915
2243
|
constructor({
|
|
2916
2244
|
socketUrl,
|
|
@@ -2923,25 +2251,25 @@ var Socket = class extends BaseModule {
|
|
|
2923
2251
|
});
|
|
2924
2252
|
__privateAdd(this, _Socket_instances);
|
|
2925
2253
|
__privateAdd(this, _token2);
|
|
2926
|
-
__privateAdd(this,
|
|
2254
|
+
__privateAdd(this, _emitter8);
|
|
2927
2255
|
__privateAdd(this, _socketIo);
|
|
2928
2256
|
__privateAdd(this, _socketUrl2);
|
|
2929
2257
|
__privateAdd(this, _notificationReceived2, ({ message }) => {
|
|
2930
|
-
__privateGet(this,
|
|
2931
|
-
result: new Notification(mapToNotification2(message), __privateGet(this,
|
|
2258
|
+
__privateGet(this, _emitter8).emit(NOTIFICATION_RECEIVED2, {
|
|
2259
|
+
result: new Notification(mapToNotification2(message), __privateGet(this, _emitter8), this._inboxService)
|
|
2932
2260
|
});
|
|
2933
2261
|
});
|
|
2934
2262
|
__privateAdd(this, _unseenCountChanged2, ({ unseenCount }) => {
|
|
2935
|
-
__privateGet(this,
|
|
2263
|
+
__privateGet(this, _emitter8).emit(UNSEEN_COUNT_CHANGED2, {
|
|
2936
2264
|
result: unseenCount
|
|
2937
2265
|
});
|
|
2938
2266
|
});
|
|
2939
2267
|
__privateAdd(this, _unreadCountChanged2, ({ counts }) => {
|
|
2940
|
-
__privateGet(this,
|
|
2268
|
+
__privateGet(this, _emitter8).emit(UNREAD_COUNT_CHANGED2, {
|
|
2941
2269
|
result: counts
|
|
2942
2270
|
});
|
|
2943
2271
|
});
|
|
2944
|
-
__privateSet(this,
|
|
2272
|
+
__privateSet(this, _emitter8, eventEmitterInstance);
|
|
2945
2273
|
__privateSet(this, _socketUrl2, socketUrl != null ? socketUrl : PRODUCTION_SOCKET_URL2);
|
|
2946
2274
|
}
|
|
2947
2275
|
onSessionSuccess({ token }) {
|
|
@@ -2968,7 +2296,7 @@ var Socket = class extends BaseModule {
|
|
|
2968
2296
|
}
|
|
2969
2297
|
};
|
|
2970
2298
|
_token2 = new WeakMap();
|
|
2971
|
-
|
|
2299
|
+
_emitter8 = new WeakMap();
|
|
2972
2300
|
_socketIo = new WeakMap();
|
|
2973
2301
|
_socketUrl2 = new WeakMap();
|
|
2974
2302
|
_notificationReceived2 = new WeakMap();
|
|
@@ -2982,7 +2310,7 @@ initializeSocket_fn2 = function() {
|
|
|
2982
2310
|
return;
|
|
2983
2311
|
}
|
|
2984
2312
|
const args = { socketUrl: __privateGet(this, _socketUrl2) };
|
|
2985
|
-
__privateGet(this,
|
|
2313
|
+
__privateGet(this, _emitter8).emit("socket.connect.pending", { args });
|
|
2986
2314
|
__privateSet(this, _socketIo, io(__privateGet(this, _socketUrl2), {
|
|
2987
2315
|
reconnectionDelayMax: 1e4,
|
|
2988
2316
|
transports: ["websocket"],
|
|
@@ -2991,10 +2319,10 @@ initializeSocket_fn2 = function() {
|
|
|
2991
2319
|
}
|
|
2992
2320
|
}));
|
|
2993
2321
|
__privateGet(this, _socketIo).on("connect", () => {
|
|
2994
|
-
__privateGet(this,
|
|
2322
|
+
__privateGet(this, _emitter8).emit("socket.connect.resolved", { args });
|
|
2995
2323
|
});
|
|
2996
2324
|
__privateGet(this, _socketIo).on("connect_error", (error) => {
|
|
2997
|
-
__privateGet(this,
|
|
2325
|
+
__privateGet(this, _emitter8).emit("socket.connect.resolved", { args, error });
|
|
2998
2326
|
});
|
|
2999
2327
|
(_a = __privateGet(this, _socketIo)) == null ? void 0 : _a.on("notification_received" /* RECEIVED */, __privateGet(this, _notificationReceived2));
|
|
3000
2328
|
(_b = __privateGet(this, _socketIo)) == null ? void 0 : _b.on("unseen_count_changed" /* UNSEEN */, __privateGet(this, _unseenCountChanged2));
|
|
@@ -3068,10 +2396,10 @@ function createSocket({
|
|
|
3068
2396
|
}
|
|
3069
2397
|
|
|
3070
2398
|
// src/novu.ts
|
|
3071
|
-
var
|
|
2399
|
+
var _emitter9, _session, _inboxService3;
|
|
3072
2400
|
var Novu = class {
|
|
3073
2401
|
constructor(options) {
|
|
3074
|
-
__privateAdd(this,
|
|
2402
|
+
__privateAdd(this, _emitter9);
|
|
3075
2403
|
__privateAdd(this, _session);
|
|
3076
2404
|
__privateAdd(this, _inboxService3);
|
|
3077
2405
|
var _a, _b;
|
|
@@ -3079,7 +2407,7 @@ var Novu = class {
|
|
|
3079
2407
|
apiUrl: options.apiUrl || options.backendUrl,
|
|
3080
2408
|
userAgent: options.__userAgent
|
|
3081
2409
|
}));
|
|
3082
|
-
__privateSet(this,
|
|
2410
|
+
__privateSet(this, _emitter9, new NovuEventEmitter());
|
|
3083
2411
|
__privateSet(this, _session, new Session(
|
|
3084
2412
|
{
|
|
3085
2413
|
applicationIdentifier: options.applicationIdentifier || "",
|
|
@@ -3090,35 +2418,35 @@ var Novu = class {
|
|
|
3090
2418
|
contextHash: options.contextHash
|
|
3091
2419
|
},
|
|
3092
2420
|
__privateGet(this, _inboxService3),
|
|
3093
|
-
__privateGet(this,
|
|
2421
|
+
__privateGet(this, _emitter9)
|
|
3094
2422
|
));
|
|
3095
2423
|
__privateGet(this, _session).initialize();
|
|
3096
2424
|
this.notifications = new Notifications({
|
|
3097
2425
|
useCache: (_a = options.useCache) != null ? _a : true,
|
|
3098
2426
|
inboxServiceInstance: __privateGet(this, _inboxService3),
|
|
3099
|
-
eventEmitterInstance: __privateGet(this,
|
|
2427
|
+
eventEmitterInstance: __privateGet(this, _emitter9)
|
|
3100
2428
|
});
|
|
3101
2429
|
this.preferences = new Preferences({
|
|
3102
2430
|
useCache: (_b = options.useCache) != null ? _b : true,
|
|
3103
2431
|
inboxServiceInstance: __privateGet(this, _inboxService3),
|
|
3104
|
-
eventEmitterInstance: __privateGet(this,
|
|
2432
|
+
eventEmitterInstance: __privateGet(this, _emitter9)
|
|
3105
2433
|
});
|
|
3106
2434
|
this.socket = createSocket({
|
|
3107
2435
|
socketUrl: options.socketUrl,
|
|
3108
|
-
eventEmitterInstance: __privateGet(this,
|
|
2436
|
+
eventEmitterInstance: __privateGet(this, _emitter9),
|
|
3109
2437
|
inboxServiceInstance: __privateGet(this, _inboxService3)
|
|
3110
2438
|
});
|
|
3111
2439
|
this.on = (eventName, listener) => {
|
|
3112
2440
|
if (this.socket.isSocketEvent(eventName)) {
|
|
3113
2441
|
this.socket.connect();
|
|
3114
2442
|
}
|
|
3115
|
-
const cleanup = __privateGet(this,
|
|
2443
|
+
const cleanup = __privateGet(this, _emitter9).on(eventName, listener);
|
|
3116
2444
|
return () => {
|
|
3117
2445
|
cleanup();
|
|
3118
2446
|
};
|
|
3119
2447
|
};
|
|
3120
2448
|
this.off = (eventName, listener) => {
|
|
3121
|
-
__privateGet(this,
|
|
2449
|
+
__privateGet(this, _emitter9).off(eventName, listener);
|
|
3122
2450
|
};
|
|
3123
2451
|
}
|
|
3124
2452
|
get applicationIdentifier() {
|
|
@@ -3172,8 +2500,8 @@ var Novu = class {
|
|
|
3172
2500
|
});
|
|
3173
2501
|
}
|
|
3174
2502
|
};
|
|
3175
|
-
|
|
2503
|
+
_emitter9 = new WeakMap();
|
|
3176
2504
|
_session = new WeakMap();
|
|
3177
2505
|
_inboxService3 = new WeakMap();
|
|
3178
2506
|
|
|
3179
|
-
export {
|
|
2507
|
+
export { DEFAULT_API_VERSION, Novu, areSeveritiesEqual, areTagsEqual, checkNotificationDataFilter, checkNotificationMatchesFilter, checkNotificationTagFilter, isBrowser, isSameFilter };
|