@novu/js 3.11.0 → 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-QQNKEWGC.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 +12 -12
- package/dist/esm/{chunk-UM35OVAD.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 +4 -4
- 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,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkWFVHYVDM_js = require('./chunk-WFVHYVDM.js');
|
|
4
4
|
var chunk7B52C2XE_js = require('./chunk-7B52C2XE.js');
|
|
5
5
|
var mitt = require('mitt');
|
|
6
6
|
require('event-target-polyfill');
|
|
@@ -12,49 +12,6 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
12
12
|
var mitt__default = /*#__PURE__*/_interopDefault(mitt);
|
|
13
13
|
var io__default = /*#__PURE__*/_interopDefault(io);
|
|
14
14
|
|
|
15
|
-
// src/types.ts
|
|
16
|
-
var NotificationStatus = /* @__PURE__ */ ((NotificationStatus2) => {
|
|
17
|
-
NotificationStatus2["READ"] = "read";
|
|
18
|
-
NotificationStatus2["SEEN"] = "seen";
|
|
19
|
-
NotificationStatus2["SNOOZED"] = "snoozed";
|
|
20
|
-
NotificationStatus2["UNREAD"] = "unread";
|
|
21
|
-
NotificationStatus2["UNSEEN"] = "unseen";
|
|
22
|
-
NotificationStatus2["UNSNOOZED"] = "unsnoozed";
|
|
23
|
-
return NotificationStatus2;
|
|
24
|
-
})(NotificationStatus || {});
|
|
25
|
-
var PreferenceLevel = /* @__PURE__ */ ((PreferenceLevel2) => {
|
|
26
|
-
PreferenceLevel2["GLOBAL"] = "global";
|
|
27
|
-
PreferenceLevel2["TEMPLATE"] = "template";
|
|
28
|
-
return PreferenceLevel2;
|
|
29
|
-
})(PreferenceLevel || {});
|
|
30
|
-
var ChannelType = /* @__PURE__ */ ((ChannelType2) => {
|
|
31
|
-
ChannelType2["IN_APP"] = "in_app";
|
|
32
|
-
ChannelType2["EMAIL"] = "email";
|
|
33
|
-
ChannelType2["SMS"] = "sms";
|
|
34
|
-
ChannelType2["CHAT"] = "chat";
|
|
35
|
-
ChannelType2["PUSH"] = "push";
|
|
36
|
-
return ChannelType2;
|
|
37
|
-
})(ChannelType || {});
|
|
38
|
-
var WebSocketEvent = /* @__PURE__ */ ((WebSocketEvent2) => {
|
|
39
|
-
WebSocketEvent2["RECEIVED"] = "notification_received";
|
|
40
|
-
WebSocketEvent2["UNREAD"] = "unread_count_changed";
|
|
41
|
-
WebSocketEvent2["UNSEEN"] = "unseen_count_changed";
|
|
42
|
-
return WebSocketEvent2;
|
|
43
|
-
})(WebSocketEvent || {});
|
|
44
|
-
var SeverityLevelEnum = /* @__PURE__ */ ((SeverityLevelEnum2) => {
|
|
45
|
-
SeverityLevelEnum2["HIGH"] = "high";
|
|
46
|
-
SeverityLevelEnum2["MEDIUM"] = "medium";
|
|
47
|
-
SeverityLevelEnum2["LOW"] = "low";
|
|
48
|
-
SeverityLevelEnum2["NONE"] = "none";
|
|
49
|
-
return SeverityLevelEnum2;
|
|
50
|
-
})(SeverityLevelEnum || {});
|
|
51
|
-
var WorkflowCriticalityEnum = /* @__PURE__ */ ((WorkflowCriticalityEnum2) => {
|
|
52
|
-
WorkflowCriticalityEnum2["CRITICAL"] = "critical";
|
|
53
|
-
WorkflowCriticalityEnum2["NON_CRITICAL"] = "nonCritical";
|
|
54
|
-
WorkflowCriticalityEnum2["ALL"] = "all";
|
|
55
|
-
return WorkflowCriticalityEnum2;
|
|
56
|
-
})(WorkflowCriticalityEnum || {});
|
|
57
|
-
|
|
58
15
|
// src/utils/arrays.ts
|
|
59
16
|
var arrayValuesEqual = (arr1, arr2) => {
|
|
60
17
|
if (arr1 === arr2) {
|
|
@@ -148,7 +105,7 @@ function checkNotificationMatchesFilter(notification, filter) {
|
|
|
148
105
|
|
|
149
106
|
// src/api/http-client.ts
|
|
150
107
|
var DEFAULT_API_VERSION = "v1";
|
|
151
|
-
var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.11.
|
|
108
|
+
var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.11.1"}`;
|
|
152
109
|
var HttpClient = class {
|
|
153
110
|
constructor(options = {}) {
|
|
154
111
|
// Environment variable for local development that overrides the default API endpoint without affecting the Inbox DX
|
|
@@ -508,655 +465,6 @@ var NovuEventEmitter = class {
|
|
|
508
465
|
};
|
|
509
466
|
_mittEmitter = new WeakMap();
|
|
510
467
|
|
|
511
|
-
// src/utils/errors.ts
|
|
512
|
-
var NovuError = class extends Error {
|
|
513
|
-
constructor(message, originalError) {
|
|
514
|
-
super(message);
|
|
515
|
-
this.originalError = originalError;
|
|
516
|
-
}
|
|
517
|
-
};
|
|
518
|
-
|
|
519
|
-
// src/notifications/helpers.ts
|
|
520
|
-
var read = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
521
|
-
emitter,
|
|
522
|
-
apiService,
|
|
523
|
-
args
|
|
524
|
-
}) {
|
|
525
|
-
const { notificationId, optimisticValue } = getNotificationDetails(
|
|
526
|
-
args,
|
|
527
|
-
{
|
|
528
|
-
isRead: true,
|
|
529
|
-
readAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
530
|
-
isArchived: false,
|
|
531
|
-
archivedAt: void 0
|
|
532
|
-
},
|
|
533
|
-
{
|
|
534
|
-
emitter,
|
|
535
|
-
apiService
|
|
536
|
-
}
|
|
537
|
-
);
|
|
538
|
-
try {
|
|
539
|
-
emitter.emit("notification.read.pending", {
|
|
540
|
-
args,
|
|
541
|
-
data: optimisticValue
|
|
542
|
-
});
|
|
543
|
-
const response = yield apiService.read(notificationId);
|
|
544
|
-
const updatedNotification = new Notification(response, emitter, apiService);
|
|
545
|
-
emitter.emit("notification.read.resolved", { args, data: updatedNotification });
|
|
546
|
-
return { data: updatedNotification };
|
|
547
|
-
} catch (error) {
|
|
548
|
-
emitter.emit("notification.read.resolved", { args, error });
|
|
549
|
-
return { error: new NovuError("Failed to read notification", error) };
|
|
550
|
-
}
|
|
551
|
-
});
|
|
552
|
-
var unread = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
553
|
-
emitter,
|
|
554
|
-
apiService,
|
|
555
|
-
args
|
|
556
|
-
}) {
|
|
557
|
-
const { notificationId, optimisticValue } = getNotificationDetails(
|
|
558
|
-
args,
|
|
559
|
-
{
|
|
560
|
-
isRead: false,
|
|
561
|
-
readAt: null,
|
|
562
|
-
isArchived: false,
|
|
563
|
-
archivedAt: void 0
|
|
564
|
-
},
|
|
565
|
-
{
|
|
566
|
-
emitter,
|
|
567
|
-
apiService
|
|
568
|
-
}
|
|
569
|
-
);
|
|
570
|
-
try {
|
|
571
|
-
emitter.emit("notification.unread.pending", {
|
|
572
|
-
args,
|
|
573
|
-
data: optimisticValue
|
|
574
|
-
});
|
|
575
|
-
const response = yield apiService.unread(notificationId);
|
|
576
|
-
const updatedNotification = new Notification(response, emitter, apiService);
|
|
577
|
-
emitter.emit("notification.unread.resolved", { args, data: updatedNotification });
|
|
578
|
-
return { data: updatedNotification };
|
|
579
|
-
} catch (error) {
|
|
580
|
-
emitter.emit("notification.unread.resolved", { args, error });
|
|
581
|
-
return { error: new NovuError("Failed to unread notification", error) };
|
|
582
|
-
}
|
|
583
|
-
});
|
|
584
|
-
var seen = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
585
|
-
emitter,
|
|
586
|
-
apiService,
|
|
587
|
-
args
|
|
588
|
-
}) {
|
|
589
|
-
const { notificationId, optimisticValue } = getNotificationDetails(
|
|
590
|
-
args,
|
|
591
|
-
{
|
|
592
|
-
isSeen: true
|
|
593
|
-
},
|
|
594
|
-
{
|
|
595
|
-
emitter,
|
|
596
|
-
apiService
|
|
597
|
-
}
|
|
598
|
-
);
|
|
599
|
-
try {
|
|
600
|
-
emitter.emit("notification.seen.pending", {
|
|
601
|
-
args,
|
|
602
|
-
data: optimisticValue
|
|
603
|
-
});
|
|
604
|
-
yield apiService.seen(notificationId);
|
|
605
|
-
if (!optimisticValue) {
|
|
606
|
-
throw new Error("Failed to create optimistic value for notification");
|
|
607
|
-
}
|
|
608
|
-
const updatedNotification = new Notification(optimisticValue, emitter, apiService);
|
|
609
|
-
emitter.emit("notification.seen.resolved", { args, data: updatedNotification });
|
|
610
|
-
return { data: updatedNotification };
|
|
611
|
-
} catch (error) {
|
|
612
|
-
emitter.emit("notification.seen.resolved", { args, error });
|
|
613
|
-
return { error: new NovuError("Failed to mark notification as seen", error) };
|
|
614
|
-
}
|
|
615
|
-
});
|
|
616
|
-
var archive = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
617
|
-
emitter,
|
|
618
|
-
apiService,
|
|
619
|
-
args
|
|
620
|
-
}) {
|
|
621
|
-
const { notificationId, optimisticValue } = getNotificationDetails(
|
|
622
|
-
args,
|
|
623
|
-
{
|
|
624
|
-
isArchived: true,
|
|
625
|
-
archivedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
626
|
-
isRead: true,
|
|
627
|
-
readAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
628
|
-
},
|
|
629
|
-
{
|
|
630
|
-
emitter,
|
|
631
|
-
apiService
|
|
632
|
-
}
|
|
633
|
-
);
|
|
634
|
-
try {
|
|
635
|
-
emitter.emit("notification.archive.pending", {
|
|
636
|
-
args,
|
|
637
|
-
data: optimisticValue
|
|
638
|
-
});
|
|
639
|
-
const response = yield apiService.archive(notificationId);
|
|
640
|
-
const updatedNotification = new Notification(response, emitter, apiService);
|
|
641
|
-
emitter.emit("notification.archive.resolved", { args, data: updatedNotification });
|
|
642
|
-
return { data: updatedNotification };
|
|
643
|
-
} catch (error) {
|
|
644
|
-
emitter.emit("notification.archive.resolved", { args, error });
|
|
645
|
-
return { error: new NovuError("Failed to archive notification", error) };
|
|
646
|
-
}
|
|
647
|
-
});
|
|
648
|
-
var unarchive = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
649
|
-
emitter,
|
|
650
|
-
apiService,
|
|
651
|
-
args
|
|
652
|
-
}) {
|
|
653
|
-
const { notificationId, optimisticValue } = getNotificationDetails(
|
|
654
|
-
args,
|
|
655
|
-
{
|
|
656
|
-
isArchived: false,
|
|
657
|
-
archivedAt: null,
|
|
658
|
-
isRead: true,
|
|
659
|
-
readAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
660
|
-
},
|
|
661
|
-
{
|
|
662
|
-
emitter,
|
|
663
|
-
apiService
|
|
664
|
-
}
|
|
665
|
-
);
|
|
666
|
-
try {
|
|
667
|
-
emitter.emit("notification.unarchive.pending", {
|
|
668
|
-
args,
|
|
669
|
-
data: optimisticValue
|
|
670
|
-
});
|
|
671
|
-
const response = yield apiService.unarchive(notificationId);
|
|
672
|
-
const updatedNotification = new Notification(response, emitter, apiService);
|
|
673
|
-
emitter.emit("notification.unarchive.resolved", { args, data: updatedNotification });
|
|
674
|
-
return { data: updatedNotification };
|
|
675
|
-
} catch (error) {
|
|
676
|
-
emitter.emit("notification.unarchive.resolved", { args, error });
|
|
677
|
-
return { error: new NovuError("Failed to unarchive notification", error) };
|
|
678
|
-
}
|
|
679
|
-
});
|
|
680
|
-
var snooze = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
681
|
-
emitter,
|
|
682
|
-
apiService,
|
|
683
|
-
args
|
|
684
|
-
}) {
|
|
685
|
-
const { notificationId, optimisticValue } = getNotificationDetails(
|
|
686
|
-
args,
|
|
687
|
-
{
|
|
688
|
-
isSnoozed: true,
|
|
689
|
-
snoozedUntil: args.snoozeUntil
|
|
690
|
-
},
|
|
691
|
-
{
|
|
692
|
-
emitter,
|
|
693
|
-
apiService
|
|
694
|
-
}
|
|
695
|
-
);
|
|
696
|
-
try {
|
|
697
|
-
emitter.emit("notification.snooze.pending", {
|
|
698
|
-
args,
|
|
699
|
-
data: optimisticValue
|
|
700
|
-
});
|
|
701
|
-
const response = yield apiService.snooze(notificationId, args.snoozeUntil);
|
|
702
|
-
const updatedNotification = new Notification(response, emitter, apiService);
|
|
703
|
-
emitter.emit("notification.snooze.resolved", { args, data: updatedNotification });
|
|
704
|
-
return { data: updatedNotification };
|
|
705
|
-
} catch (error) {
|
|
706
|
-
emitter.emit("notification.snooze.resolved", { args, error });
|
|
707
|
-
return { error: new NovuError("Failed to snooze notification", error) };
|
|
708
|
-
}
|
|
709
|
-
});
|
|
710
|
-
var unsnooze = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
711
|
-
emitter,
|
|
712
|
-
apiService,
|
|
713
|
-
args
|
|
714
|
-
}) {
|
|
715
|
-
const { notificationId, optimisticValue } = getNotificationDetails(
|
|
716
|
-
args,
|
|
717
|
-
{
|
|
718
|
-
isSnoozed: false,
|
|
719
|
-
snoozedUntil: null
|
|
720
|
-
},
|
|
721
|
-
{
|
|
722
|
-
emitter,
|
|
723
|
-
apiService
|
|
724
|
-
}
|
|
725
|
-
);
|
|
726
|
-
try {
|
|
727
|
-
emitter.emit("notification.unsnooze.pending", {
|
|
728
|
-
args,
|
|
729
|
-
data: optimisticValue
|
|
730
|
-
});
|
|
731
|
-
const response = yield apiService.unsnooze(notificationId);
|
|
732
|
-
const updatedNotification = new Notification(response, emitter, apiService);
|
|
733
|
-
emitter.emit("notification.unsnooze.resolved", { args, data: updatedNotification });
|
|
734
|
-
return { data: updatedNotification };
|
|
735
|
-
} catch (error) {
|
|
736
|
-
emitter.emit("notification.unsnooze.resolved", { args, error });
|
|
737
|
-
return { error: new NovuError("Failed to unsnooze notification", error) };
|
|
738
|
-
}
|
|
739
|
-
});
|
|
740
|
-
var completeAction = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
741
|
-
emitter,
|
|
742
|
-
apiService,
|
|
743
|
-
args,
|
|
744
|
-
actionType
|
|
745
|
-
}) {
|
|
746
|
-
const optimisticUpdate = actionType === "primary" /* PRIMARY */ ? {
|
|
747
|
-
primaryAction: chunk7B52C2XE_js.__spreadProps(chunk7B52C2XE_js.__spreadValues({}, "notification" in args ? args.notification.primaryAction : {}), {
|
|
748
|
-
isCompleted: true
|
|
749
|
-
})
|
|
750
|
-
} : {
|
|
751
|
-
secondaryAction: chunk7B52C2XE_js.__spreadProps(chunk7B52C2XE_js.__spreadValues({}, "notification" in args ? args.notification.secondaryAction : {}), {
|
|
752
|
-
isCompleted: true
|
|
753
|
-
})
|
|
754
|
-
};
|
|
755
|
-
const { notificationId, optimisticValue } = getNotificationDetails(args, optimisticUpdate, {
|
|
756
|
-
emitter,
|
|
757
|
-
apiService
|
|
758
|
-
});
|
|
759
|
-
try {
|
|
760
|
-
emitter.emit("notification.complete_action.pending", {
|
|
761
|
-
args,
|
|
762
|
-
data: optimisticValue
|
|
763
|
-
});
|
|
764
|
-
const response = yield apiService.completeAction({ actionType, notificationId });
|
|
765
|
-
const updatedNotification = new Notification(response, emitter, apiService);
|
|
766
|
-
emitter.emit("notification.complete_action.resolved", { args, data: updatedNotification });
|
|
767
|
-
return { data: updatedNotification };
|
|
768
|
-
} catch (error) {
|
|
769
|
-
emitter.emit("notification.complete_action.resolved", { args, error });
|
|
770
|
-
return { error: new NovuError(`Failed to complete ${actionType} action on the notification`, error) };
|
|
771
|
-
}
|
|
772
|
-
});
|
|
773
|
-
var revertAction = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
774
|
-
emitter,
|
|
775
|
-
apiService,
|
|
776
|
-
args,
|
|
777
|
-
actionType
|
|
778
|
-
}) {
|
|
779
|
-
const optimisticUpdate = actionType === "primary" /* PRIMARY */ ? {
|
|
780
|
-
primaryAction: chunk7B52C2XE_js.__spreadProps(chunk7B52C2XE_js.__spreadValues({}, "notification" in args ? args.notification.primaryAction : {}), {
|
|
781
|
-
isCompleted: false
|
|
782
|
-
})
|
|
783
|
-
} : {
|
|
784
|
-
secondaryAction: chunk7B52C2XE_js.__spreadProps(chunk7B52C2XE_js.__spreadValues({}, "notification" in args ? args.notification.secondaryAction : {}), {
|
|
785
|
-
isCompleted: false
|
|
786
|
-
})
|
|
787
|
-
};
|
|
788
|
-
const { notificationId, optimisticValue } = getNotificationDetails(args, optimisticUpdate, {
|
|
789
|
-
emitter,
|
|
790
|
-
apiService
|
|
791
|
-
});
|
|
792
|
-
try {
|
|
793
|
-
emitter.emit("notification.revert_action.pending", {
|
|
794
|
-
args,
|
|
795
|
-
data: optimisticValue
|
|
796
|
-
});
|
|
797
|
-
const response = yield apiService.revertAction({ actionType, notificationId });
|
|
798
|
-
const updatedNotification = new Notification(response, emitter, apiService);
|
|
799
|
-
emitter.emit("notification.revert_action.resolved", { args, data: updatedNotification });
|
|
800
|
-
return { data: updatedNotification };
|
|
801
|
-
} catch (error) {
|
|
802
|
-
emitter.emit("notification.revert_action.resolved", { args, error });
|
|
803
|
-
return { error: new NovuError("Failed to fetch notifications", error) };
|
|
804
|
-
}
|
|
805
|
-
});
|
|
806
|
-
var getNotificationDetails = (args, update, dependencies) => {
|
|
807
|
-
if ("notification" in args) {
|
|
808
|
-
return {
|
|
809
|
-
notificationId: args.notification.id,
|
|
810
|
-
optimisticValue: new Notification(
|
|
811
|
-
chunk7B52C2XE_js.__spreadValues(chunk7B52C2XE_js.__spreadValues({}, args.notification), update),
|
|
812
|
-
dependencies.emitter,
|
|
813
|
-
dependencies.apiService
|
|
814
|
-
)
|
|
815
|
-
};
|
|
816
|
-
} else {
|
|
817
|
-
return {
|
|
818
|
-
notificationId: args.notificationId
|
|
819
|
-
};
|
|
820
|
-
}
|
|
821
|
-
};
|
|
822
|
-
var readAll = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
823
|
-
emitter,
|
|
824
|
-
inboxService,
|
|
825
|
-
notificationsCache,
|
|
826
|
-
tags,
|
|
827
|
-
data
|
|
828
|
-
}) {
|
|
829
|
-
try {
|
|
830
|
-
const notifications = notificationsCache.getUniqueNotifications({ tags, data });
|
|
831
|
-
const optimisticNotifications = notifications.map(
|
|
832
|
-
(notification) => new Notification(
|
|
833
|
-
chunk7B52C2XE_js.__spreadProps(chunk7B52C2XE_js.__spreadValues({}, notification), {
|
|
834
|
-
isRead: true,
|
|
835
|
-
readAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
836
|
-
isArchived: false,
|
|
837
|
-
archivedAt: void 0
|
|
838
|
-
}),
|
|
839
|
-
emitter,
|
|
840
|
-
inboxService
|
|
841
|
-
)
|
|
842
|
-
);
|
|
843
|
-
emitter.emit("notifications.read_all.pending", { args: { tags, data }, data: optimisticNotifications });
|
|
844
|
-
yield inboxService.readAll({ tags, data });
|
|
845
|
-
emitter.emit("notifications.read_all.resolved", { args: { tags, data }, data: optimisticNotifications });
|
|
846
|
-
return {};
|
|
847
|
-
} catch (error) {
|
|
848
|
-
emitter.emit("notifications.read_all.resolved", { args: { tags, data }, error });
|
|
849
|
-
return { error: new NovuError("Failed to read all notifications", error) };
|
|
850
|
-
}
|
|
851
|
-
});
|
|
852
|
-
var seenAll = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
853
|
-
emitter,
|
|
854
|
-
inboxService,
|
|
855
|
-
notificationsCache,
|
|
856
|
-
notificationIds,
|
|
857
|
-
tags,
|
|
858
|
-
data
|
|
859
|
-
}) {
|
|
860
|
-
try {
|
|
861
|
-
const notifications = notificationsCache.getUniqueNotifications({ tags, data });
|
|
862
|
-
const filteredNotifications = notificationIds && notificationIds.length > 0 ? notifications.filter((notification) => notificationIds.includes(notification.id)) : notifications;
|
|
863
|
-
const optimisticNotifications = filteredNotifications.map(
|
|
864
|
-
(notification) => new Notification(
|
|
865
|
-
chunk7B52C2XE_js.__spreadProps(chunk7B52C2XE_js.__spreadValues({}, notification), {
|
|
866
|
-
isSeen: true,
|
|
867
|
-
firstSeenAt: notification.firstSeenAt || (/* @__PURE__ */ new Date()).toISOString()
|
|
868
|
-
}),
|
|
869
|
-
emitter,
|
|
870
|
-
inboxService
|
|
871
|
-
)
|
|
872
|
-
);
|
|
873
|
-
emitter.emit("notifications.seen_all.pending", {
|
|
874
|
-
args: { notificationIds, tags, data },
|
|
875
|
-
data: optimisticNotifications
|
|
876
|
-
});
|
|
877
|
-
yield inboxService.markAsSeen({ notificationIds, tags, data });
|
|
878
|
-
emitter.emit("notifications.seen_all.resolved", {
|
|
879
|
-
args: { notificationIds, tags, data },
|
|
880
|
-
data: optimisticNotifications
|
|
881
|
-
});
|
|
882
|
-
return {};
|
|
883
|
-
} catch (error) {
|
|
884
|
-
emitter.emit("notifications.seen_all.resolved", { args: { notificationIds, tags, data }, error });
|
|
885
|
-
return { error: new NovuError("Failed to mark all notifications as seen", error) };
|
|
886
|
-
}
|
|
887
|
-
});
|
|
888
|
-
var archiveAll = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
889
|
-
emitter,
|
|
890
|
-
inboxService,
|
|
891
|
-
notificationsCache,
|
|
892
|
-
tags,
|
|
893
|
-
data
|
|
894
|
-
}) {
|
|
895
|
-
try {
|
|
896
|
-
const notifications = notificationsCache.getUniqueNotifications({ tags, data });
|
|
897
|
-
const optimisticNotifications = notifications.map(
|
|
898
|
-
(notification) => new Notification(
|
|
899
|
-
chunk7B52C2XE_js.__spreadProps(chunk7B52C2XE_js.__spreadValues({}, notification), {
|
|
900
|
-
isRead: true,
|
|
901
|
-
readAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
902
|
-
isArchived: true,
|
|
903
|
-
archivedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
904
|
-
}),
|
|
905
|
-
emitter,
|
|
906
|
-
inboxService
|
|
907
|
-
)
|
|
908
|
-
);
|
|
909
|
-
emitter.emit("notifications.archive_all.pending", { args: { tags, data }, data: optimisticNotifications });
|
|
910
|
-
yield inboxService.archiveAll({ tags, data });
|
|
911
|
-
emitter.emit("notifications.archive_all.resolved", { args: { tags, data }, data: optimisticNotifications });
|
|
912
|
-
return {};
|
|
913
|
-
} catch (error) {
|
|
914
|
-
emitter.emit("notifications.archive_all.resolved", { args: { tags, data }, error });
|
|
915
|
-
return { error: new NovuError("Failed to archive all notifications", error) };
|
|
916
|
-
}
|
|
917
|
-
});
|
|
918
|
-
var archiveAllRead = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
919
|
-
emitter,
|
|
920
|
-
inboxService,
|
|
921
|
-
notificationsCache,
|
|
922
|
-
tags,
|
|
923
|
-
data
|
|
924
|
-
}) {
|
|
925
|
-
try {
|
|
926
|
-
const notifications = notificationsCache.getUniqueNotifications({ tags, data, read: true });
|
|
927
|
-
const optimisticNotifications = notifications.map(
|
|
928
|
-
(notification) => new Notification(
|
|
929
|
-
chunk7B52C2XE_js.__spreadProps(chunk7B52C2XE_js.__spreadValues({}, notification), { isArchived: true, archivedAt: (/* @__PURE__ */ new Date()).toISOString() }),
|
|
930
|
-
emitter,
|
|
931
|
-
inboxService
|
|
932
|
-
)
|
|
933
|
-
);
|
|
934
|
-
emitter.emit("notifications.archive_all_read.pending", { args: { tags, data }, data: optimisticNotifications });
|
|
935
|
-
yield inboxService.archiveAllRead({ tags, data });
|
|
936
|
-
emitter.emit("notifications.archive_all_read.resolved", { args: { tags, data }, data: optimisticNotifications });
|
|
937
|
-
return {};
|
|
938
|
-
} catch (error) {
|
|
939
|
-
emitter.emit("notifications.archive_all_read.resolved", { args: { tags, data }, error });
|
|
940
|
-
return { error: new NovuError("Failed to archive all read notifications", error) };
|
|
941
|
-
}
|
|
942
|
-
});
|
|
943
|
-
var deleteNotification = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
944
|
-
emitter,
|
|
945
|
-
apiService,
|
|
946
|
-
args
|
|
947
|
-
}) {
|
|
948
|
-
const { notificationId } = getNotificationDetails(
|
|
949
|
-
args,
|
|
950
|
-
{},
|
|
951
|
-
{
|
|
952
|
-
emitter,
|
|
953
|
-
apiService
|
|
954
|
-
}
|
|
955
|
-
);
|
|
956
|
-
try {
|
|
957
|
-
emitter.emit("notification.delete.pending", {
|
|
958
|
-
args
|
|
959
|
-
});
|
|
960
|
-
yield apiService.delete(notificationId);
|
|
961
|
-
emitter.emit("notification.delete.resolved", { args });
|
|
962
|
-
return {};
|
|
963
|
-
} catch (error) {
|
|
964
|
-
emitter.emit("notification.delete.resolved", { args, error });
|
|
965
|
-
return { error: new NovuError("Failed to delete notification", error) };
|
|
966
|
-
}
|
|
967
|
-
});
|
|
968
|
-
var deleteAll = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
969
|
-
emitter,
|
|
970
|
-
inboxService,
|
|
971
|
-
notificationsCache,
|
|
972
|
-
tags,
|
|
973
|
-
data
|
|
974
|
-
}) {
|
|
975
|
-
try {
|
|
976
|
-
const notifications = notificationsCache.getUniqueNotifications({ tags, data });
|
|
977
|
-
emitter.emit("notifications.delete_all.pending", { args: { tags, data }, data: notifications });
|
|
978
|
-
yield inboxService.deleteAll({ tags, data });
|
|
979
|
-
emitter.emit("notifications.delete_all.resolved", { args: { tags, data } });
|
|
980
|
-
return {};
|
|
981
|
-
} catch (error) {
|
|
982
|
-
emitter.emit("notifications.delete_all.resolved", { args: { tags, data }, error });
|
|
983
|
-
return { error: new NovuError("Failed to delete all notifications", error) };
|
|
984
|
-
}
|
|
985
|
-
});
|
|
986
|
-
|
|
987
|
-
// src/notifications/notification.ts
|
|
988
|
-
var _emitter, _inboxService;
|
|
989
|
-
var Notification = class {
|
|
990
|
-
constructor(notification, emitter, inboxService) {
|
|
991
|
-
chunk7B52C2XE_js.__privateAdd(this, _emitter);
|
|
992
|
-
chunk7B52C2XE_js.__privateAdd(this, _inboxService);
|
|
993
|
-
chunk7B52C2XE_js.__privateSet(this, _emitter, emitter);
|
|
994
|
-
chunk7B52C2XE_js.__privateSet(this, _inboxService, inboxService);
|
|
995
|
-
this.id = notification.id;
|
|
996
|
-
this.transactionId = notification.transactionId;
|
|
997
|
-
this.subject = notification.subject;
|
|
998
|
-
this.body = notification.body;
|
|
999
|
-
this.to = notification.to;
|
|
1000
|
-
this.isRead = notification.isRead;
|
|
1001
|
-
this.isSeen = notification.isSeen;
|
|
1002
|
-
this.isArchived = notification.isArchived;
|
|
1003
|
-
this.isSnoozed = notification.isSnoozed;
|
|
1004
|
-
this.snoozedUntil = notification.snoozedUntil;
|
|
1005
|
-
this.deliveredAt = notification.deliveredAt;
|
|
1006
|
-
this.createdAt = notification.createdAt;
|
|
1007
|
-
this.readAt = notification.readAt;
|
|
1008
|
-
this.firstSeenAt = notification.firstSeenAt;
|
|
1009
|
-
this.archivedAt = notification.archivedAt;
|
|
1010
|
-
this.avatar = notification.avatar;
|
|
1011
|
-
this.primaryAction = notification.primaryAction;
|
|
1012
|
-
this.secondaryAction = notification.secondaryAction;
|
|
1013
|
-
this.channelType = notification.channelType;
|
|
1014
|
-
this.tags = notification.tags;
|
|
1015
|
-
this.redirect = notification.redirect;
|
|
1016
|
-
this.data = notification.data;
|
|
1017
|
-
this.workflow = notification.workflow;
|
|
1018
|
-
this.severity = notification.severity;
|
|
1019
|
-
}
|
|
1020
|
-
read() {
|
|
1021
|
-
return read({
|
|
1022
|
-
emitter: chunk7B52C2XE_js.__privateGet(this, _emitter),
|
|
1023
|
-
apiService: chunk7B52C2XE_js.__privateGet(this, _inboxService),
|
|
1024
|
-
args: {
|
|
1025
|
-
notification: this
|
|
1026
|
-
}
|
|
1027
|
-
});
|
|
1028
|
-
}
|
|
1029
|
-
unread() {
|
|
1030
|
-
return unread({
|
|
1031
|
-
emitter: chunk7B52C2XE_js.__privateGet(this, _emitter),
|
|
1032
|
-
apiService: chunk7B52C2XE_js.__privateGet(this, _inboxService),
|
|
1033
|
-
args: {
|
|
1034
|
-
notification: this
|
|
1035
|
-
}
|
|
1036
|
-
});
|
|
1037
|
-
}
|
|
1038
|
-
seen() {
|
|
1039
|
-
return seen({
|
|
1040
|
-
emitter: chunk7B52C2XE_js.__privateGet(this, _emitter),
|
|
1041
|
-
apiService: chunk7B52C2XE_js.__privateGet(this, _inboxService),
|
|
1042
|
-
args: {
|
|
1043
|
-
notification: this
|
|
1044
|
-
}
|
|
1045
|
-
});
|
|
1046
|
-
}
|
|
1047
|
-
archive() {
|
|
1048
|
-
return archive({
|
|
1049
|
-
emitter: chunk7B52C2XE_js.__privateGet(this, _emitter),
|
|
1050
|
-
apiService: chunk7B52C2XE_js.__privateGet(this, _inboxService),
|
|
1051
|
-
args: {
|
|
1052
|
-
notification: this
|
|
1053
|
-
}
|
|
1054
|
-
});
|
|
1055
|
-
}
|
|
1056
|
-
unarchive() {
|
|
1057
|
-
return unarchive({
|
|
1058
|
-
emitter: chunk7B52C2XE_js.__privateGet(this, _emitter),
|
|
1059
|
-
apiService: chunk7B52C2XE_js.__privateGet(this, _inboxService),
|
|
1060
|
-
args: {
|
|
1061
|
-
notification: this
|
|
1062
|
-
}
|
|
1063
|
-
});
|
|
1064
|
-
}
|
|
1065
|
-
delete() {
|
|
1066
|
-
return deleteNotification({
|
|
1067
|
-
emitter: chunk7B52C2XE_js.__privateGet(this, _emitter),
|
|
1068
|
-
apiService: chunk7B52C2XE_js.__privateGet(this, _inboxService),
|
|
1069
|
-
args: {
|
|
1070
|
-
notification: this
|
|
1071
|
-
}
|
|
1072
|
-
});
|
|
1073
|
-
}
|
|
1074
|
-
snooze(snoozeUntil) {
|
|
1075
|
-
return snooze({
|
|
1076
|
-
emitter: chunk7B52C2XE_js.__privateGet(this, _emitter),
|
|
1077
|
-
apiService: chunk7B52C2XE_js.__privateGet(this, _inboxService),
|
|
1078
|
-
args: {
|
|
1079
|
-
notification: this,
|
|
1080
|
-
snoozeUntil
|
|
1081
|
-
}
|
|
1082
|
-
});
|
|
1083
|
-
}
|
|
1084
|
-
unsnooze() {
|
|
1085
|
-
return unsnooze({
|
|
1086
|
-
emitter: chunk7B52C2XE_js.__privateGet(this, _emitter),
|
|
1087
|
-
apiService: chunk7B52C2XE_js.__privateGet(this, _inboxService),
|
|
1088
|
-
args: { notification: this }
|
|
1089
|
-
});
|
|
1090
|
-
}
|
|
1091
|
-
completePrimary() {
|
|
1092
|
-
if (!this.primaryAction) {
|
|
1093
|
-
throw new Error("Primary action is not available");
|
|
1094
|
-
}
|
|
1095
|
-
return completeAction({
|
|
1096
|
-
emitter: chunk7B52C2XE_js.__privateGet(this, _emitter),
|
|
1097
|
-
apiService: chunk7B52C2XE_js.__privateGet(this, _inboxService),
|
|
1098
|
-
args: {
|
|
1099
|
-
notification: this
|
|
1100
|
-
},
|
|
1101
|
-
actionType: "primary" /* PRIMARY */
|
|
1102
|
-
});
|
|
1103
|
-
}
|
|
1104
|
-
completeSecondary() {
|
|
1105
|
-
if (!this.primaryAction) {
|
|
1106
|
-
throw new Error("Secondary action is not available");
|
|
1107
|
-
}
|
|
1108
|
-
return completeAction({
|
|
1109
|
-
emitter: chunk7B52C2XE_js.__privateGet(this, _emitter),
|
|
1110
|
-
apiService: chunk7B52C2XE_js.__privateGet(this, _inboxService),
|
|
1111
|
-
args: {
|
|
1112
|
-
notification: this
|
|
1113
|
-
},
|
|
1114
|
-
actionType: "secondary" /* SECONDARY */
|
|
1115
|
-
});
|
|
1116
|
-
}
|
|
1117
|
-
revertPrimary() {
|
|
1118
|
-
if (!this.primaryAction) {
|
|
1119
|
-
throw new Error("Primary action is not available");
|
|
1120
|
-
}
|
|
1121
|
-
return revertAction({
|
|
1122
|
-
emitter: chunk7B52C2XE_js.__privateGet(this, _emitter),
|
|
1123
|
-
apiService: chunk7B52C2XE_js.__privateGet(this, _inboxService),
|
|
1124
|
-
args: {
|
|
1125
|
-
notification: this
|
|
1126
|
-
},
|
|
1127
|
-
actionType: "primary" /* PRIMARY */
|
|
1128
|
-
});
|
|
1129
|
-
}
|
|
1130
|
-
revertSecondary() {
|
|
1131
|
-
if (!this.primaryAction) {
|
|
1132
|
-
throw new Error("Secondary action is not available");
|
|
1133
|
-
}
|
|
1134
|
-
return revertAction({
|
|
1135
|
-
emitter: chunk7B52C2XE_js.__privateGet(this, _emitter),
|
|
1136
|
-
apiService: chunk7B52C2XE_js.__privateGet(this, _inboxService),
|
|
1137
|
-
args: {
|
|
1138
|
-
notification: this
|
|
1139
|
-
},
|
|
1140
|
-
actionType: "secondary" /* SECONDARY */
|
|
1141
|
-
});
|
|
1142
|
-
}
|
|
1143
|
-
on(eventName, listener) {
|
|
1144
|
-
const cleanup = chunk7B52C2XE_js.__privateGet(this, _emitter).on(eventName, listener);
|
|
1145
|
-
return () => {
|
|
1146
|
-
cleanup();
|
|
1147
|
-
};
|
|
1148
|
-
}
|
|
1149
|
-
/**
|
|
1150
|
-
* @deprecated
|
|
1151
|
-
* Use the cleanup function returned by the "on" method instead.
|
|
1152
|
-
*/
|
|
1153
|
-
off(eventName, listener) {
|
|
1154
|
-
chunk7B52C2XE_js.__privateGet(this, _emitter).off(eventName, listener);
|
|
1155
|
-
}
|
|
1156
|
-
};
|
|
1157
|
-
_emitter = new WeakMap();
|
|
1158
|
-
_inboxService = new WeakMap();
|
|
1159
|
-
|
|
1160
468
|
// src/base-module.ts
|
|
1161
469
|
var _callsQueue, _sessionError;
|
|
1162
470
|
var BaseModule = class {
|
|
@@ -1179,7 +487,7 @@ var BaseModule = class {
|
|
|
1179
487
|
this.onSessionError(error);
|
|
1180
488
|
chunk7B52C2XE_js.__privateSet(this, _sessionError, error);
|
|
1181
489
|
chunk7B52C2XE_js.__privateGet(this, _callsQueue).forEach(({ resolve }) => {
|
|
1182
|
-
resolve({ error: new NovuError("Failed to initialize session, please contact the support", error) });
|
|
490
|
+
resolve({ error: new chunkWFVHYVDM_js.NovuError("Failed to initialize session, please contact the support", error) });
|
|
1183
491
|
});
|
|
1184
492
|
chunk7B52C2XE_js.__privateSet(this, _callsQueue, []);
|
|
1185
493
|
}
|
|
@@ -1196,7 +504,7 @@ var BaseModule = class {
|
|
|
1196
504
|
}
|
|
1197
505
|
if (chunk7B52C2XE_js.__privateGet(this, _sessionError)) {
|
|
1198
506
|
return Promise.resolve({
|
|
1199
|
-
error: new NovuError("Failed to initialize session, please contact the support", chunk7B52C2XE_js.__privateGet(this, _sessionError))
|
|
507
|
+
error: new chunkWFVHYVDM_js.NovuError("Failed to initialize session, please contact the support", chunk7B52C2XE_js.__privateGet(this, _sessionError))
|
|
1200
508
|
});
|
|
1201
509
|
}
|
|
1202
510
|
return new Promise((resolve, reject) => {
|
|
@@ -1305,10 +613,11 @@ var removeEvents = [
|
|
|
1305
613
|
"notifications.archive_all_read.pending",
|
|
1306
614
|
"notifications.delete_all.pending"
|
|
1307
615
|
];
|
|
1308
|
-
var
|
|
616
|
+
var _emitter, _inboxService, _cache2;
|
|
1309
617
|
var NotificationsCache = class {
|
|
1310
|
-
constructor({ emitter }) {
|
|
1311
|
-
chunk7B52C2XE_js.__privateAdd(this,
|
|
618
|
+
constructor({ emitter, inboxService }) {
|
|
619
|
+
chunk7B52C2XE_js.__privateAdd(this, _emitter);
|
|
620
|
+
chunk7B52C2XE_js.__privateAdd(this, _inboxService);
|
|
1312
621
|
/**
|
|
1313
622
|
* The key is the stringified notifications filter, the values are the paginated notifications.
|
|
1314
623
|
*/
|
|
@@ -1388,17 +697,18 @@ var NotificationsCache = class {
|
|
|
1388
697
|
});
|
|
1389
698
|
uniqueFilterKeys.forEach((key) => {
|
|
1390
699
|
const notificationsResponse = this.getAggregated(getFilter(key));
|
|
1391
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
700
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter).emit("notifications.list.updated", {
|
|
1392
701
|
data: notificationsResponse
|
|
1393
702
|
});
|
|
1394
703
|
});
|
|
1395
704
|
};
|
|
1396
|
-
chunk7B52C2XE_js.__privateSet(this,
|
|
705
|
+
chunk7B52C2XE_js.__privateSet(this, _emitter, emitter);
|
|
706
|
+
chunk7B52C2XE_js.__privateSet(this, _inboxService, inboxService);
|
|
1397
707
|
updateEvents.forEach((event) => {
|
|
1398
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
708
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter).on(event, this.handleNotificationEvent());
|
|
1399
709
|
});
|
|
1400
710
|
removeEvents.forEach((event) => {
|
|
1401
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
711
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter).on(event, this.handleNotificationEvent({ remove: true }));
|
|
1402
712
|
});
|
|
1403
713
|
chunk7B52C2XE_js.__privateSet(this, _cache2, new InMemoryCache());
|
|
1404
714
|
}
|
|
@@ -1421,16 +731,35 @@ var NotificationsCache = class {
|
|
|
1421
731
|
{ hasMore: false, filter: {}, notifications: [] }
|
|
1422
732
|
);
|
|
1423
733
|
}
|
|
734
|
+
get(args) {
|
|
735
|
+
return chunk7B52C2XE_js.__privateGet(this, _cache2).get(getCacheKey(args));
|
|
736
|
+
}
|
|
1424
737
|
has(args) {
|
|
1425
738
|
return chunk7B52C2XE_js.__privateGet(this, _cache2).get(getCacheKey(args)) !== void 0;
|
|
1426
739
|
}
|
|
1427
740
|
set(args, data) {
|
|
1428
741
|
chunk7B52C2XE_js.__privateGet(this, _cache2).set(getCacheKey(args), data);
|
|
1429
742
|
}
|
|
743
|
+
unshift(args, notification) {
|
|
744
|
+
const cacheKey = getCacheKey(args);
|
|
745
|
+
const cachedData = chunk7B52C2XE_js.__privateGet(this, _cache2).get(cacheKey) || {
|
|
746
|
+
hasMore: false,
|
|
747
|
+
filter: getFilter(cacheKey),
|
|
748
|
+
notifications: []
|
|
749
|
+
};
|
|
750
|
+
const notificationInstance = chunkWFVHYVDM_js.createNotification({
|
|
751
|
+
notification: chunk7B52C2XE_js.__spreadValues({}, notification),
|
|
752
|
+
emitter: chunk7B52C2XE_js.__privateGet(this, _emitter),
|
|
753
|
+
inboxService: chunk7B52C2XE_js.__privateGet(this, _inboxService)
|
|
754
|
+
});
|
|
755
|
+
this.update(args, chunk7B52C2XE_js.__spreadProps(chunk7B52C2XE_js.__spreadValues({}, cachedData), {
|
|
756
|
+
notifications: [notificationInstance, ...cachedData.notifications]
|
|
757
|
+
}));
|
|
758
|
+
}
|
|
1430
759
|
update(args, data) {
|
|
1431
760
|
this.set(args, data);
|
|
1432
761
|
const notificationsResponse = this.getAggregated(getFilter(getCacheKey(args)));
|
|
1433
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
762
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter).emit("notifications.list.updated", {
|
|
1434
763
|
data: notificationsResponse
|
|
1435
764
|
});
|
|
1436
765
|
}
|
|
@@ -1484,7 +813,8 @@ var NotificationsCache = class {
|
|
|
1484
813
|
chunk7B52C2XE_js.__privateGet(this, _cache2).clear();
|
|
1485
814
|
}
|
|
1486
815
|
};
|
|
1487
|
-
|
|
816
|
+
_emitter = new WeakMap();
|
|
817
|
+
_inboxService = new WeakMap();
|
|
1488
818
|
_cache2 = new WeakMap();
|
|
1489
819
|
|
|
1490
820
|
// src/notifications/notifications.ts
|
|
@@ -1501,13 +831,11 @@ var Notifications = class extends BaseModule {
|
|
|
1501
831
|
});
|
|
1502
832
|
chunk7B52C2XE_js.__privateAdd(this, _useCache);
|
|
1503
833
|
this.cache = new NotificationsCache({
|
|
1504
|
-
emitter: eventEmitterInstance
|
|
834
|
+
emitter: eventEmitterInstance,
|
|
835
|
+
inboxService: inboxServiceInstance
|
|
1505
836
|
});
|
|
1506
837
|
chunk7B52C2XE_js.__privateSet(this, _useCache, useCache);
|
|
1507
838
|
}
|
|
1508
|
-
get inboxService() {
|
|
1509
|
-
return this._inboxService;
|
|
1510
|
-
}
|
|
1511
839
|
list() {
|
|
1512
840
|
return chunk7B52C2XE_js.__async(this, arguments, function* (_a = {}) {
|
|
1513
841
|
var _b = _a, { limit = 10 } = _b, restOptions = chunk7B52C2XE_js.__objRest(_b, ["limit"]);
|
|
@@ -1524,7 +852,7 @@ var Notifications = class extends BaseModule {
|
|
|
1524
852
|
data = {
|
|
1525
853
|
hasMore: response.hasMore,
|
|
1526
854
|
filter: response.filter,
|
|
1527
|
-
notifications: response.data.map((el) => new Notification(el, this._emitter, this._inboxService))
|
|
855
|
+
notifications: response.data.map((el) => new chunkWFVHYVDM_js.Notification(el, this._emitter, this._inboxService))
|
|
1528
856
|
};
|
|
1529
857
|
if (shouldUseCache) {
|
|
1530
858
|
this.cache.set(args, data);
|
|
@@ -1535,7 +863,7 @@ var Notifications = class extends BaseModule {
|
|
|
1535
863
|
return { data };
|
|
1536
864
|
} catch (error) {
|
|
1537
865
|
this._emitter.emit("notifications.list.resolved", { args, error });
|
|
1538
|
-
return { error: new NovuError("Failed to fetch notifications", error) };
|
|
866
|
+
return { error: new chunkWFVHYVDM_js.NovuError("Failed to fetch notifications", error) };
|
|
1539
867
|
}
|
|
1540
868
|
}));
|
|
1541
869
|
});
|
|
@@ -1557,7 +885,7 @@ var Notifications = class extends BaseModule {
|
|
|
1557
885
|
return { data };
|
|
1558
886
|
} catch (error) {
|
|
1559
887
|
this._emitter.emit("notifications.count.resolved", { args, error });
|
|
1560
|
-
return { error: new NovuError("Failed to count notifications", error) };
|
|
888
|
+
return { error: new chunkWFVHYVDM_js.NovuError("Failed to count notifications", error) };
|
|
1561
889
|
}
|
|
1562
890
|
}));
|
|
1563
891
|
});
|
|
@@ -1566,7 +894,7 @@ var Notifications = class extends BaseModule {
|
|
|
1566
894
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1567
895
|
return this.callWithSession(
|
|
1568
896
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1569
|
-
return read({
|
|
897
|
+
return chunkWFVHYVDM_js.read({
|
|
1570
898
|
emitter: this._emitter,
|
|
1571
899
|
apiService: this._inboxService,
|
|
1572
900
|
args
|
|
@@ -1579,7 +907,7 @@ var Notifications = class extends BaseModule {
|
|
|
1579
907
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1580
908
|
return this.callWithSession(
|
|
1581
909
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1582
|
-
return unread({
|
|
910
|
+
return chunkWFVHYVDM_js.unread({
|
|
1583
911
|
emitter: this._emitter,
|
|
1584
912
|
apiService: this._inboxService,
|
|
1585
913
|
args
|
|
@@ -1592,7 +920,7 @@ var Notifications = class extends BaseModule {
|
|
|
1592
920
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1593
921
|
return this.callWithSession(
|
|
1594
922
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1595
|
-
return seen({
|
|
923
|
+
return chunkWFVHYVDM_js.seen({
|
|
1596
924
|
emitter: this._emitter,
|
|
1597
925
|
apiService: this._inboxService,
|
|
1598
926
|
args
|
|
@@ -1605,7 +933,7 @@ var Notifications = class extends BaseModule {
|
|
|
1605
933
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1606
934
|
return this.callWithSession(
|
|
1607
935
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1608
|
-
return archive({
|
|
936
|
+
return chunkWFVHYVDM_js.archive({
|
|
1609
937
|
emitter: this._emitter,
|
|
1610
938
|
apiService: this._inboxService,
|
|
1611
939
|
args
|
|
@@ -1618,7 +946,7 @@ var Notifications = class extends BaseModule {
|
|
|
1618
946
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1619
947
|
return this.callWithSession(
|
|
1620
948
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1621
|
-
return unarchive({
|
|
949
|
+
return chunkWFVHYVDM_js.unarchive({
|
|
1622
950
|
emitter: this._emitter,
|
|
1623
951
|
apiService: this._inboxService,
|
|
1624
952
|
args
|
|
@@ -1631,7 +959,7 @@ var Notifications = class extends BaseModule {
|
|
|
1631
959
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1632
960
|
return this.callWithSession(
|
|
1633
961
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1634
|
-
return deleteNotification({
|
|
962
|
+
return chunkWFVHYVDM_js.deleteNotification({
|
|
1635
963
|
emitter: this._emitter,
|
|
1636
964
|
apiService: this._inboxService,
|
|
1637
965
|
args
|
|
@@ -1644,7 +972,7 @@ var Notifications = class extends BaseModule {
|
|
|
1644
972
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1645
973
|
return this.callWithSession(
|
|
1646
974
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1647
|
-
return snooze({
|
|
975
|
+
return chunkWFVHYVDM_js.snooze({
|
|
1648
976
|
emitter: this._emitter,
|
|
1649
977
|
apiService: this._inboxService,
|
|
1650
978
|
args
|
|
@@ -1657,7 +985,7 @@ var Notifications = class extends BaseModule {
|
|
|
1657
985
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1658
986
|
return this.callWithSession(
|
|
1659
987
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1660
|
-
return unsnooze({
|
|
988
|
+
return chunkWFVHYVDM_js.unsnooze({
|
|
1661
989
|
emitter: this._emitter,
|
|
1662
990
|
apiService: this._inboxService,
|
|
1663
991
|
args
|
|
@@ -1670,7 +998,7 @@ var Notifications = class extends BaseModule {
|
|
|
1670
998
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1671
999
|
return this.callWithSession(
|
|
1672
1000
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1673
|
-
return completeAction({
|
|
1001
|
+
return chunkWFVHYVDM_js.completeAction({
|
|
1674
1002
|
emitter: this._emitter,
|
|
1675
1003
|
apiService: this._inboxService,
|
|
1676
1004
|
args,
|
|
@@ -1684,7 +1012,7 @@ var Notifications = class extends BaseModule {
|
|
|
1684
1012
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1685
1013
|
return this.callWithSession(
|
|
1686
1014
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1687
|
-
return completeAction({
|
|
1015
|
+
return chunkWFVHYVDM_js.completeAction({
|
|
1688
1016
|
emitter: this._emitter,
|
|
1689
1017
|
apiService: this._inboxService,
|
|
1690
1018
|
args,
|
|
@@ -1698,7 +1026,7 @@ var Notifications = class extends BaseModule {
|
|
|
1698
1026
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1699
1027
|
return this.callWithSession(
|
|
1700
1028
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1701
|
-
return revertAction({
|
|
1029
|
+
return chunkWFVHYVDM_js.revertAction({
|
|
1702
1030
|
emitter: this._emitter,
|
|
1703
1031
|
apiService: this._inboxService,
|
|
1704
1032
|
args,
|
|
@@ -1712,7 +1040,7 @@ var Notifications = class extends BaseModule {
|
|
|
1712
1040
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1713
1041
|
return this.callWithSession(
|
|
1714
1042
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1715
|
-
return revertAction({
|
|
1043
|
+
return chunkWFVHYVDM_js.revertAction({
|
|
1716
1044
|
emitter: this._emitter,
|
|
1717
1045
|
apiService: this._inboxService,
|
|
1718
1046
|
args,
|
|
@@ -1729,7 +1057,7 @@ var Notifications = class extends BaseModule {
|
|
|
1729
1057
|
} = {}) {
|
|
1730
1058
|
return this.callWithSession(
|
|
1731
1059
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1732
|
-
return readAll({
|
|
1060
|
+
return chunkWFVHYVDM_js.readAll({
|
|
1733
1061
|
emitter: this._emitter,
|
|
1734
1062
|
inboxService: this._inboxService,
|
|
1735
1063
|
notificationsCache: this.cache,
|
|
@@ -1744,14 +1072,14 @@ var Notifications = class extends BaseModule {
|
|
|
1744
1072
|
return chunk7B52C2XE_js.__async(this, arguments, function* (args = {}) {
|
|
1745
1073
|
return this.callWithSession(() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1746
1074
|
if ("notificationIds" in args) {
|
|
1747
|
-
return seenAll({
|
|
1075
|
+
return chunkWFVHYVDM_js.seenAll({
|
|
1748
1076
|
emitter: this._emitter,
|
|
1749
1077
|
inboxService: this._inboxService,
|
|
1750
1078
|
notificationsCache: this.cache,
|
|
1751
1079
|
notificationIds: args.notificationIds
|
|
1752
1080
|
});
|
|
1753
1081
|
} else {
|
|
1754
|
-
return seenAll({
|
|
1082
|
+
return chunkWFVHYVDM_js.seenAll({
|
|
1755
1083
|
emitter: this._emitter,
|
|
1756
1084
|
inboxService: this._inboxService,
|
|
1757
1085
|
notificationsCache: this.cache,
|
|
@@ -1769,7 +1097,7 @@ var Notifications = class extends BaseModule {
|
|
|
1769
1097
|
} = {}) {
|
|
1770
1098
|
return this.callWithSession(
|
|
1771
1099
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1772
|
-
return archiveAll({
|
|
1100
|
+
return chunkWFVHYVDM_js.archiveAll({
|
|
1773
1101
|
emitter: this._emitter,
|
|
1774
1102
|
inboxService: this._inboxService,
|
|
1775
1103
|
notificationsCache: this.cache,
|
|
@@ -1784,7 +1112,7 @@ var Notifications = class extends BaseModule {
|
|
|
1784
1112
|
return chunk7B52C2XE_js.__async(this, arguments, function* ({ tags, data } = {}) {
|
|
1785
1113
|
return this.callWithSession(
|
|
1786
1114
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1787
|
-
return archiveAllRead({
|
|
1115
|
+
return chunkWFVHYVDM_js.archiveAllRead({
|
|
1788
1116
|
emitter: this._emitter,
|
|
1789
1117
|
inboxService: this._inboxService,
|
|
1790
1118
|
notificationsCache: this.cache,
|
|
@@ -1802,7 +1130,7 @@ var Notifications = class extends BaseModule {
|
|
|
1802
1130
|
} = {}) {
|
|
1803
1131
|
return this.callWithSession(
|
|
1804
1132
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1805
|
-
return deleteAll({
|
|
1133
|
+
return chunkWFVHYVDM_js.deleteAll({
|
|
1806
1134
|
emitter: this._emitter,
|
|
1807
1135
|
inboxService: this._inboxService,
|
|
1808
1136
|
notificationsCache: this.cache,
|
|
@@ -1829,7 +1157,7 @@ var Notifications = class extends BaseModule {
|
|
|
1829
1157
|
_useCache = new WeakMap();
|
|
1830
1158
|
|
|
1831
1159
|
// src/preferences/schedule.ts
|
|
1832
|
-
var
|
|
1160
|
+
var _emitter2, _apiService, _cache3, _useCache2;
|
|
1833
1161
|
var Schedule = class {
|
|
1834
1162
|
constructor(schedule, {
|
|
1835
1163
|
emitterInstance,
|
|
@@ -1837,11 +1165,11 @@ var Schedule = class {
|
|
|
1837
1165
|
cache,
|
|
1838
1166
|
useCache
|
|
1839
1167
|
}) {
|
|
1840
|
-
chunk7B52C2XE_js.__privateAdd(this,
|
|
1168
|
+
chunk7B52C2XE_js.__privateAdd(this, _emitter2);
|
|
1841
1169
|
chunk7B52C2XE_js.__privateAdd(this, _apiService);
|
|
1842
1170
|
chunk7B52C2XE_js.__privateAdd(this, _cache3);
|
|
1843
1171
|
chunk7B52C2XE_js.__privateAdd(this, _useCache2);
|
|
1844
|
-
chunk7B52C2XE_js.__privateSet(this,
|
|
1172
|
+
chunk7B52C2XE_js.__privateSet(this, _emitter2, emitterInstance);
|
|
1845
1173
|
chunk7B52C2XE_js.__privateSet(this, _apiService, inboxServiceInstance);
|
|
1846
1174
|
chunk7B52C2XE_js.__privateSet(this, _cache3, cache);
|
|
1847
1175
|
chunk7B52C2XE_js.__privateSet(this, _useCache2, useCache);
|
|
@@ -1853,7 +1181,7 @@ var Schedule = class {
|
|
|
1853
1181
|
var _a;
|
|
1854
1182
|
const hasWeeklySchedule = !!args.weeklySchedule || !!this.weeklySchedule;
|
|
1855
1183
|
return updateSchedule({
|
|
1856
|
-
emitter: chunk7B52C2XE_js.__privateGet(this,
|
|
1184
|
+
emitter: chunk7B52C2XE_js.__privateGet(this, _emitter2),
|
|
1857
1185
|
apiService: chunk7B52C2XE_js.__privateGet(this, _apiService),
|
|
1858
1186
|
cache: chunk7B52C2XE_js.__privateGet(this, _cache3),
|
|
1859
1187
|
useCache: chunk7B52C2XE_js.__privateGet(this, _useCache2),
|
|
@@ -1866,13 +1194,13 @@ var Schedule = class {
|
|
|
1866
1194
|
});
|
|
1867
1195
|
}
|
|
1868
1196
|
};
|
|
1869
|
-
|
|
1197
|
+
_emitter2 = new WeakMap();
|
|
1870
1198
|
_apiService = new WeakMap();
|
|
1871
1199
|
_cache3 = new WeakMap();
|
|
1872
1200
|
_useCache2 = new WeakMap();
|
|
1873
1201
|
|
|
1874
1202
|
// src/preferences/preference.ts
|
|
1875
|
-
var
|
|
1203
|
+
var _emitter3, _apiService2, _cache4, _scheduleCache, _useCache3;
|
|
1876
1204
|
var Preference = class {
|
|
1877
1205
|
constructor(preference, {
|
|
1878
1206
|
emitterInstance,
|
|
@@ -1881,12 +1209,12 @@ var Preference = class {
|
|
|
1881
1209
|
scheduleCache,
|
|
1882
1210
|
useCache
|
|
1883
1211
|
}) {
|
|
1884
|
-
chunk7B52C2XE_js.__privateAdd(this,
|
|
1212
|
+
chunk7B52C2XE_js.__privateAdd(this, _emitter3);
|
|
1885
1213
|
chunk7B52C2XE_js.__privateAdd(this, _apiService2);
|
|
1886
1214
|
chunk7B52C2XE_js.__privateAdd(this, _cache4);
|
|
1887
1215
|
chunk7B52C2XE_js.__privateAdd(this, _scheduleCache);
|
|
1888
1216
|
chunk7B52C2XE_js.__privateAdd(this, _useCache3);
|
|
1889
|
-
chunk7B52C2XE_js.__privateSet(this,
|
|
1217
|
+
chunk7B52C2XE_js.__privateSet(this, _emitter3, emitterInstance);
|
|
1890
1218
|
chunk7B52C2XE_js.__privateSet(this, _apiService2, inboxServiceInstance);
|
|
1891
1219
|
chunk7B52C2XE_js.__privateSet(this, _cache4, cache);
|
|
1892
1220
|
chunk7B52C2XE_js.__privateSet(this, _scheduleCache, scheduleCache);
|
|
@@ -1906,7 +1234,7 @@ var Preference = class {
|
|
|
1906
1234
|
}) {
|
|
1907
1235
|
var _a;
|
|
1908
1236
|
return updatePreference({
|
|
1909
|
-
emitter: chunk7B52C2XE_js.__privateGet(this,
|
|
1237
|
+
emitter: chunk7B52C2XE_js.__privateGet(this, _emitter3),
|
|
1910
1238
|
apiService: chunk7B52C2XE_js.__privateGet(this, _apiService2),
|
|
1911
1239
|
cache: chunk7B52C2XE_js.__privateGet(this, _cache4),
|
|
1912
1240
|
scheduleCache: chunk7B52C2XE_js.__privateGet(this, _scheduleCache),
|
|
@@ -1919,7 +1247,7 @@ var Preference = class {
|
|
|
1919
1247
|
});
|
|
1920
1248
|
}
|
|
1921
1249
|
};
|
|
1922
|
-
|
|
1250
|
+
_emitter3 = new WeakMap();
|
|
1923
1251
|
_apiService2 = new WeakMap();
|
|
1924
1252
|
_cache4 = new WeakMap();
|
|
1925
1253
|
_scheduleCache = new WeakMap();
|
|
@@ -1971,7 +1299,7 @@ var updatePreference = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function*
|
|
|
1971
1299
|
return { data: preference };
|
|
1972
1300
|
} catch (error) {
|
|
1973
1301
|
emitter.emit("preference.update.resolved", { args, error });
|
|
1974
|
-
return { error: new NovuError("Failed to update preference", error) };
|
|
1302
|
+
return { error: new chunkWFVHYVDM_js.NovuError("Failed to update preference", error) };
|
|
1975
1303
|
}
|
|
1976
1304
|
});
|
|
1977
1305
|
var bulkUpdatePreference = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
@@ -1984,7 +1312,7 @@ var bulkUpdatePreference = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], functi
|
|
|
1984
1312
|
}) {
|
|
1985
1313
|
const globalPreference = args.find((arg) => "preference" in arg && arg.preference.level === "global" /* GLOBAL */);
|
|
1986
1314
|
if (globalPreference) {
|
|
1987
|
-
return { error: new NovuError("Global preference is not supported in bulk update", "") };
|
|
1315
|
+
return { error: new chunkWFVHYVDM_js.NovuError("Global preference is not supported in bulk update", "") };
|
|
1988
1316
|
}
|
|
1989
1317
|
try {
|
|
1990
1318
|
const optimisticallyUpdatedPreferences = args.map(
|
|
@@ -2025,7 +1353,7 @@ var bulkUpdatePreference = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], functi
|
|
|
2025
1353
|
return { data: preferences };
|
|
2026
1354
|
} catch (error) {
|
|
2027
1355
|
emitter.emit("preferences.bulk_update.resolved", { args, error });
|
|
2028
|
-
return { error: new NovuError("Failed to bulk update preferences", error) };
|
|
1356
|
+
return { error: new chunkWFVHYVDM_js.NovuError("Failed to bulk update preferences", error) };
|
|
2029
1357
|
}
|
|
2030
1358
|
});
|
|
2031
1359
|
var optimisticUpdateWorkflowPreferences = ({
|
|
@@ -2115,7 +1443,7 @@ var updateSchedule = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
|
2115
1443
|
return { data: updatedSchedule };
|
|
2116
1444
|
} catch (error) {
|
|
2117
1445
|
emitter.emit("preference.schedule.update.resolved", { args, error });
|
|
2118
|
-
return { error: new NovuError("Failed to update preference", error) };
|
|
1446
|
+
return { error: new chunkWFVHYVDM_js.NovuError("Failed to update preference", error) };
|
|
2119
1447
|
}
|
|
2120
1448
|
});
|
|
2121
1449
|
|
|
@@ -2211,10 +1539,10 @@ var excludeEmpty2 = ({ tags, severity }) => Object.entries({ tags, severity }).r
|
|
|
2211
1539
|
var getCacheKey2 = ({ tags, severity }) => {
|
|
2212
1540
|
return JSON.stringify(excludeEmpty2({ tags, severity }));
|
|
2213
1541
|
};
|
|
2214
|
-
var
|
|
1542
|
+
var _emitter4, _cache5;
|
|
2215
1543
|
var PreferencesCache = class {
|
|
2216
1544
|
constructor({ emitterInstance }) {
|
|
2217
|
-
chunk7B52C2XE_js.__privateAdd(this,
|
|
1545
|
+
chunk7B52C2XE_js.__privateAdd(this, _emitter4);
|
|
2218
1546
|
chunk7B52C2XE_js.__privateAdd(this, _cache5);
|
|
2219
1547
|
this.updatePreference = (key, data) => {
|
|
2220
1548
|
const preferences = chunk7B52C2XE_js.__privateGet(this, _cache5).get(key);
|
|
@@ -2265,7 +1593,7 @@ var PreferencesCache = class {
|
|
|
2265
1593
|
uniqueFilterKeys.add(key);
|
|
2266
1594
|
}
|
|
2267
1595
|
for (const key of uniqueFilterKeys) {
|
|
2268
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
1596
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter4).emit("preferences.list.updated", {
|
|
2269
1597
|
data: (_a = chunk7B52C2XE_js.__privateGet(this, _cache5).get(key)) != null ? _a : []
|
|
2270
1598
|
});
|
|
2271
1599
|
}
|
|
@@ -2288,17 +1616,17 @@ var PreferencesCache = class {
|
|
|
2288
1616
|
});
|
|
2289
1617
|
uniqueFilterKeys.forEach((key) => {
|
|
2290
1618
|
var _a;
|
|
2291
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
1619
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter4).emit("preferences.list.updated", {
|
|
2292
1620
|
data: (_a = chunk7B52C2XE_js.__privateGet(this, _cache5).get(key)) != null ? _a : []
|
|
2293
1621
|
});
|
|
2294
1622
|
});
|
|
2295
1623
|
};
|
|
2296
|
-
chunk7B52C2XE_js.__privateSet(this,
|
|
1624
|
+
chunk7B52C2XE_js.__privateSet(this, _emitter4, emitterInstance);
|
|
2297
1625
|
for (const event of updateEvents2) {
|
|
2298
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
1626
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter4).on(event, this.handlePreferenceEvent);
|
|
2299
1627
|
}
|
|
2300
1628
|
for (const event of scheduleUpdateEvents) {
|
|
2301
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
1629
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter4).on(event, this.handleScheduleEvent);
|
|
2302
1630
|
}
|
|
2303
1631
|
chunk7B52C2XE_js.__privateSet(this, _cache5, new InMemoryCache());
|
|
2304
1632
|
}
|
|
@@ -2317,7 +1645,7 @@ var PreferencesCache = class {
|
|
|
2317
1645
|
chunk7B52C2XE_js.__privateGet(this, _cache5).clear();
|
|
2318
1646
|
}
|
|
2319
1647
|
};
|
|
2320
|
-
|
|
1648
|
+
_emitter4 = new WeakMap();
|
|
2321
1649
|
_cache5 = new WeakMap();
|
|
2322
1650
|
|
|
2323
1651
|
// src/cache/schedule-cache.ts
|
|
@@ -2328,10 +1656,10 @@ var updateEvents3 = [
|
|
|
2328
1656
|
var getCacheKey3 = () => {
|
|
2329
1657
|
return "schedule";
|
|
2330
1658
|
};
|
|
2331
|
-
var
|
|
1659
|
+
var _emitter5, _cache6;
|
|
2332
1660
|
var ScheduleCache = class {
|
|
2333
1661
|
constructor({ emitterInstance }) {
|
|
2334
|
-
chunk7B52C2XE_js.__privateAdd(this,
|
|
1662
|
+
chunk7B52C2XE_js.__privateAdd(this, _emitter5);
|
|
2335
1663
|
chunk7B52C2XE_js.__privateAdd(this, _cache6);
|
|
2336
1664
|
this.updateScheduleInCache = (key, data) => {
|
|
2337
1665
|
const schedule = chunk7B52C2XE_js.__privateGet(this, _cache6).get(key);
|
|
@@ -2356,14 +1684,14 @@ var ScheduleCache = class {
|
|
|
2356
1684
|
uniqueFilterKeys.add(key);
|
|
2357
1685
|
}
|
|
2358
1686
|
for (const key of uniqueFilterKeys) {
|
|
2359
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
1687
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter5).emit("preference.schedule.get.updated", {
|
|
2360
1688
|
data: chunk7B52C2XE_js.__privateGet(this, _cache6).get(key)
|
|
2361
1689
|
});
|
|
2362
1690
|
}
|
|
2363
1691
|
};
|
|
2364
|
-
chunk7B52C2XE_js.__privateSet(this,
|
|
1692
|
+
chunk7B52C2XE_js.__privateSet(this, _emitter5, emitterInstance);
|
|
2365
1693
|
for (const event of updateEvents3) {
|
|
2366
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
1694
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter5).on(event, this.handleScheduleEvent);
|
|
2367
1695
|
}
|
|
2368
1696
|
chunk7B52C2XE_js.__privateSet(this, _cache6, new InMemoryCache());
|
|
2369
1697
|
}
|
|
@@ -2382,7 +1710,7 @@ var ScheduleCache = class {
|
|
|
2382
1710
|
chunk7B52C2XE_js.__privateGet(this, _cache6).clear();
|
|
2383
1711
|
}
|
|
2384
1712
|
};
|
|
2385
|
-
|
|
1713
|
+
_emitter5 = new WeakMap();
|
|
2386
1714
|
_cache6 = new WeakMap();
|
|
2387
1715
|
|
|
2388
1716
|
// src/preferences/preferences.ts
|
|
@@ -2485,13 +1813,13 @@ function isBrowser() {
|
|
|
2485
1813
|
}
|
|
2486
1814
|
|
|
2487
1815
|
// src/session/session.ts
|
|
2488
|
-
var
|
|
1816
|
+
var _emitter6, _inboxService2, _options;
|
|
2489
1817
|
var Session = class {
|
|
2490
1818
|
constructor(options, inboxServiceInstance, eventEmitterInstance) {
|
|
2491
|
-
chunk7B52C2XE_js.__privateAdd(this,
|
|
1819
|
+
chunk7B52C2XE_js.__privateAdd(this, _emitter6);
|
|
2492
1820
|
chunk7B52C2XE_js.__privateAdd(this, _inboxService2);
|
|
2493
1821
|
chunk7B52C2XE_js.__privateAdd(this, _options);
|
|
2494
|
-
chunk7B52C2XE_js.__privateSet(this,
|
|
1822
|
+
chunk7B52C2XE_js.__privateSet(this, _emitter6, eventEmitterInstance);
|
|
2495
1823
|
chunk7B52C2XE_js.__privateSet(this, _inboxService2, inboxServiceInstance);
|
|
2496
1824
|
chunk7B52C2XE_js.__privateSet(this, _options, options);
|
|
2497
1825
|
}
|
|
@@ -2563,7 +1891,7 @@ var Session = class {
|
|
|
2563
1891
|
} else {
|
|
2564
1892
|
this.handleApplicationIdentifier("delete");
|
|
2565
1893
|
}
|
|
2566
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
1894
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter6).emit("session.initialize.pending", { args: chunk7B52C2XE_js.__privateGet(this, _options) });
|
|
2567
1895
|
const response = yield chunk7B52C2XE_js.__privateGet(this, _inboxService2).initializeSession({
|
|
2568
1896
|
applicationIdentifier: finalApplicationIdentifier,
|
|
2569
1897
|
subscriberHash,
|
|
@@ -2581,14 +1909,14 @@ var Session = class {
|
|
|
2581
1909
|
if (!((_f = response == null ? void 0 : response.applicationIdentifier) == null ? void 0 : _f.startsWith("pk_keyless_"))) {
|
|
2582
1910
|
this.handleApplicationIdentifier("delete");
|
|
2583
1911
|
}
|
|
2584
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
1912
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter6).emit("session.initialize.resolved", { args: chunk7B52C2XE_js.__privateGet(this, _options), data: response });
|
|
2585
1913
|
} catch (error) {
|
|
2586
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
1914
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter6).emit("session.initialize.resolved", { args: chunk7B52C2XE_js.__privateGet(this, _options), error });
|
|
2587
1915
|
}
|
|
2588
1916
|
});
|
|
2589
1917
|
}
|
|
2590
1918
|
};
|
|
2591
|
-
|
|
1919
|
+
_emitter6 = new WeakMap();
|
|
2592
1920
|
_inboxService2 = new WeakMap();
|
|
2593
1921
|
_options = new WeakMap();
|
|
2594
1922
|
var PRODUCTION_SOCKET_URL = "wss://socket.novu.co";
|
|
@@ -2682,7 +2010,7 @@ var mapToNotification = ({
|
|
|
2682
2010
|
severity
|
|
2683
2011
|
});
|
|
2684
2012
|
};
|
|
2685
|
-
var _token,
|
|
2013
|
+
var _token, _emitter7, _partySocket, _socketUrl, _notificationReceived, _unseenCountChanged, _unreadCountChanged, _handleMessage, _PartySocketClient_instances, initializeSocket_fn, handleConnectSocket_fn, handleDisconnectSocket_fn;
|
|
2686
2014
|
var PartySocketClient = class extends BaseModule {
|
|
2687
2015
|
constructor({
|
|
2688
2016
|
socketUrl,
|
|
@@ -2695,15 +2023,15 @@ var PartySocketClient = class extends BaseModule {
|
|
|
2695
2023
|
});
|
|
2696
2024
|
chunk7B52C2XE_js.__privateAdd(this, _PartySocketClient_instances);
|
|
2697
2025
|
chunk7B52C2XE_js.__privateAdd(this, _token);
|
|
2698
|
-
chunk7B52C2XE_js.__privateAdd(this,
|
|
2026
|
+
chunk7B52C2XE_js.__privateAdd(this, _emitter7);
|
|
2699
2027
|
chunk7B52C2XE_js.__privateAdd(this, _partySocket);
|
|
2700
2028
|
chunk7B52C2XE_js.__privateAdd(this, _socketUrl);
|
|
2701
2029
|
chunk7B52C2XE_js.__privateAdd(this, _notificationReceived, (event) => {
|
|
2702
2030
|
try {
|
|
2703
2031
|
const data = JSON.parse(event.data);
|
|
2704
2032
|
if (data.event === "notification_received" /* RECEIVED */) {
|
|
2705
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
2706
|
-
result: new Notification(mapToNotification(data.data.message), chunk7B52C2XE_js.__privateGet(this,
|
|
2033
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter7).emit(NOTIFICATION_RECEIVED, {
|
|
2034
|
+
result: new chunkWFVHYVDM_js.Notification(mapToNotification(data.data.message), chunk7B52C2XE_js.__privateGet(this, _emitter7), this._inboxService)
|
|
2707
2035
|
});
|
|
2708
2036
|
}
|
|
2709
2037
|
} catch (error) {
|
|
@@ -2714,7 +2042,7 @@ var PartySocketClient = class extends BaseModule {
|
|
|
2714
2042
|
try {
|
|
2715
2043
|
const data = JSON.parse(event.data);
|
|
2716
2044
|
if (data.event === "unseen_count_changed" /* UNSEEN */) {
|
|
2717
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
2045
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter7).emit(UNSEEN_COUNT_CHANGED, {
|
|
2718
2046
|
result: data.data.unseenCount
|
|
2719
2047
|
});
|
|
2720
2048
|
}
|
|
@@ -2725,7 +2053,7 @@ var PartySocketClient = class extends BaseModule {
|
|
|
2725
2053
|
try {
|
|
2726
2054
|
const data = JSON.parse(event.data);
|
|
2727
2055
|
if (data.event === "unread_count_changed" /* UNREAD */) {
|
|
2728
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
2056
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter7).emit(UNREAD_COUNT_CHANGED, {
|
|
2729
2057
|
result: data.data.counts
|
|
2730
2058
|
});
|
|
2731
2059
|
}
|
|
@@ -2750,7 +2078,7 @@ var PartySocketClient = class extends BaseModule {
|
|
|
2750
2078
|
} catch (error) {
|
|
2751
2079
|
}
|
|
2752
2080
|
});
|
|
2753
|
-
chunk7B52C2XE_js.__privateSet(this,
|
|
2081
|
+
chunk7B52C2XE_js.__privateSet(this, _emitter7, eventEmitterInstance);
|
|
2754
2082
|
chunk7B52C2XE_js.__privateSet(this, _socketUrl, socketUrl != null ? socketUrl : PRODUCTION_SOCKET_URL);
|
|
2755
2083
|
}
|
|
2756
2084
|
onSessionSuccess({ token }) {
|
|
@@ -2777,7 +2105,7 @@ var PartySocketClient = class extends BaseModule {
|
|
|
2777
2105
|
}
|
|
2778
2106
|
};
|
|
2779
2107
|
_token = new WeakMap();
|
|
2780
|
-
|
|
2108
|
+
_emitter7 = new WeakMap();
|
|
2781
2109
|
_partySocket = new WeakMap();
|
|
2782
2110
|
_socketUrl = new WeakMap();
|
|
2783
2111
|
_notificationReceived = new WeakMap();
|
|
@@ -2791,15 +2119,15 @@ initializeSocket_fn = function() {
|
|
|
2791
2119
|
return;
|
|
2792
2120
|
}
|
|
2793
2121
|
const args = { socketUrl: chunk7B52C2XE_js.__privateGet(this, _socketUrl) };
|
|
2794
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
2122
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter7).emit("socket.connect.pending", { args });
|
|
2795
2123
|
const url = new URL(chunk7B52C2XE_js.__privateGet(this, _socketUrl));
|
|
2796
2124
|
url.searchParams.set("token", chunk7B52C2XE_js.__privateGet(this, _token));
|
|
2797
2125
|
chunk7B52C2XE_js.__privateSet(this, _partySocket, new partysocket.WebSocket(url.toString()));
|
|
2798
2126
|
chunk7B52C2XE_js.__privateGet(this, _partySocket).addEventListener("open", () => {
|
|
2799
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
2127
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter7).emit("socket.connect.resolved", { args });
|
|
2800
2128
|
});
|
|
2801
2129
|
chunk7B52C2XE_js.__privateGet(this, _partySocket).addEventListener("error", (error) => {
|
|
2802
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
2130
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter7).emit("socket.connect.resolved", { args, error });
|
|
2803
2131
|
});
|
|
2804
2132
|
chunk7B52C2XE_js.__privateGet(this, _partySocket).addEventListener("message", chunk7B52C2XE_js.__privateGet(this, _handleMessage));
|
|
2805
2133
|
});
|
|
@@ -2810,7 +2138,7 @@ handleConnectSocket_fn = function() {
|
|
|
2810
2138
|
yield chunk7B52C2XE_js.__privateMethod(this, _PartySocketClient_instances, initializeSocket_fn).call(this);
|
|
2811
2139
|
return {};
|
|
2812
2140
|
} catch (error) {
|
|
2813
|
-
return { error: new NovuError("Failed to initialize the PartySocket", error) };
|
|
2141
|
+
return { error: new chunkWFVHYVDM_js.NovuError("Failed to initialize the PartySocket", error) };
|
|
2814
2142
|
}
|
|
2815
2143
|
});
|
|
2816
2144
|
};
|
|
@@ -2822,7 +2150,7 @@ handleDisconnectSocket_fn = function() {
|
|
|
2822
2150
|
chunk7B52C2XE_js.__privateSet(this, _partySocket, void 0);
|
|
2823
2151
|
return {};
|
|
2824
2152
|
} catch (error) {
|
|
2825
|
-
return { error: new NovuError("Failed to disconnect from the PartySocket", error) };
|
|
2153
|
+
return { error: new chunkWFVHYVDM_js.NovuError("Failed to disconnect from the PartySocket", error) };
|
|
2826
2154
|
}
|
|
2827
2155
|
});
|
|
2828
2156
|
};
|
|
@@ -2917,7 +2245,7 @@ var mapToNotification2 = ({
|
|
|
2917
2245
|
severity
|
|
2918
2246
|
});
|
|
2919
2247
|
};
|
|
2920
|
-
var _token2,
|
|
2248
|
+
var _token2, _emitter8, _socketIo, _socketUrl2, _notificationReceived2, _unseenCountChanged2, _unreadCountChanged2, _Socket_instances, initializeSocket_fn2, handleConnectSocket_fn2, handleDisconnectSocket_fn2;
|
|
2921
2249
|
var Socket = class extends BaseModule {
|
|
2922
2250
|
constructor({
|
|
2923
2251
|
socketUrl,
|
|
@@ -2930,25 +2258,25 @@ var Socket = class extends BaseModule {
|
|
|
2930
2258
|
});
|
|
2931
2259
|
chunk7B52C2XE_js.__privateAdd(this, _Socket_instances);
|
|
2932
2260
|
chunk7B52C2XE_js.__privateAdd(this, _token2);
|
|
2933
|
-
chunk7B52C2XE_js.__privateAdd(this,
|
|
2261
|
+
chunk7B52C2XE_js.__privateAdd(this, _emitter8);
|
|
2934
2262
|
chunk7B52C2XE_js.__privateAdd(this, _socketIo);
|
|
2935
2263
|
chunk7B52C2XE_js.__privateAdd(this, _socketUrl2);
|
|
2936
2264
|
chunk7B52C2XE_js.__privateAdd(this, _notificationReceived2, ({ message }) => {
|
|
2937
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
2938
|
-
result: new Notification(mapToNotification2(message), chunk7B52C2XE_js.__privateGet(this,
|
|
2265
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter8).emit(NOTIFICATION_RECEIVED2, {
|
|
2266
|
+
result: new chunkWFVHYVDM_js.Notification(mapToNotification2(message), chunk7B52C2XE_js.__privateGet(this, _emitter8), this._inboxService)
|
|
2939
2267
|
});
|
|
2940
2268
|
});
|
|
2941
2269
|
chunk7B52C2XE_js.__privateAdd(this, _unseenCountChanged2, ({ unseenCount }) => {
|
|
2942
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
2270
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter8).emit(UNSEEN_COUNT_CHANGED2, {
|
|
2943
2271
|
result: unseenCount
|
|
2944
2272
|
});
|
|
2945
2273
|
});
|
|
2946
2274
|
chunk7B52C2XE_js.__privateAdd(this, _unreadCountChanged2, ({ counts }) => {
|
|
2947
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
2275
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter8).emit(UNREAD_COUNT_CHANGED2, {
|
|
2948
2276
|
result: counts
|
|
2949
2277
|
});
|
|
2950
2278
|
});
|
|
2951
|
-
chunk7B52C2XE_js.__privateSet(this,
|
|
2279
|
+
chunk7B52C2XE_js.__privateSet(this, _emitter8, eventEmitterInstance);
|
|
2952
2280
|
chunk7B52C2XE_js.__privateSet(this, _socketUrl2, socketUrl != null ? socketUrl : PRODUCTION_SOCKET_URL2);
|
|
2953
2281
|
}
|
|
2954
2282
|
onSessionSuccess({ token }) {
|
|
@@ -2975,7 +2303,7 @@ var Socket = class extends BaseModule {
|
|
|
2975
2303
|
}
|
|
2976
2304
|
};
|
|
2977
2305
|
_token2 = new WeakMap();
|
|
2978
|
-
|
|
2306
|
+
_emitter8 = new WeakMap();
|
|
2979
2307
|
_socketIo = new WeakMap();
|
|
2980
2308
|
_socketUrl2 = new WeakMap();
|
|
2981
2309
|
_notificationReceived2 = new WeakMap();
|
|
@@ -2989,7 +2317,7 @@ initializeSocket_fn2 = function() {
|
|
|
2989
2317
|
return;
|
|
2990
2318
|
}
|
|
2991
2319
|
const args = { socketUrl: chunk7B52C2XE_js.__privateGet(this, _socketUrl2) };
|
|
2992
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
2320
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter8).emit("socket.connect.pending", { args });
|
|
2993
2321
|
chunk7B52C2XE_js.__privateSet(this, _socketIo, io__default.default(chunk7B52C2XE_js.__privateGet(this, _socketUrl2), {
|
|
2994
2322
|
reconnectionDelayMax: 1e4,
|
|
2995
2323
|
transports: ["websocket"],
|
|
@@ -2998,10 +2326,10 @@ initializeSocket_fn2 = function() {
|
|
|
2998
2326
|
}
|
|
2999
2327
|
}));
|
|
3000
2328
|
chunk7B52C2XE_js.__privateGet(this, _socketIo).on("connect", () => {
|
|
3001
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
2329
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter8).emit("socket.connect.resolved", { args });
|
|
3002
2330
|
});
|
|
3003
2331
|
chunk7B52C2XE_js.__privateGet(this, _socketIo).on("connect_error", (error) => {
|
|
3004
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
2332
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter8).emit("socket.connect.resolved", { args, error });
|
|
3005
2333
|
});
|
|
3006
2334
|
(_a = chunk7B52C2XE_js.__privateGet(this, _socketIo)) == null ? void 0 : _a.on("notification_received" /* RECEIVED */, chunk7B52C2XE_js.__privateGet(this, _notificationReceived2));
|
|
3007
2335
|
(_b = chunk7B52C2XE_js.__privateGet(this, _socketIo)) == null ? void 0 : _b.on("unseen_count_changed" /* UNSEEN */, chunk7B52C2XE_js.__privateGet(this, _unseenCountChanged2));
|
|
@@ -3014,7 +2342,7 @@ handleConnectSocket_fn2 = function() {
|
|
|
3014
2342
|
yield chunk7B52C2XE_js.__privateMethod(this, _Socket_instances, initializeSocket_fn2).call(this);
|
|
3015
2343
|
return {};
|
|
3016
2344
|
} catch (error) {
|
|
3017
|
-
return { error: new NovuError("Failed to initialize the socket", error) };
|
|
2345
|
+
return { error: new chunkWFVHYVDM_js.NovuError("Failed to initialize the socket", error) };
|
|
3018
2346
|
}
|
|
3019
2347
|
});
|
|
3020
2348
|
};
|
|
@@ -3026,7 +2354,7 @@ handleDisconnectSocket_fn2 = function() {
|
|
|
3026
2354
|
chunk7B52C2XE_js.__privateSet(this, _socketIo, void 0);
|
|
3027
2355
|
return {};
|
|
3028
2356
|
} catch (error) {
|
|
3029
|
-
return { error: new NovuError("Failed to disconnect from the socket", error) };
|
|
2357
|
+
return { error: new chunkWFVHYVDM_js.NovuError("Failed to disconnect from the socket", error) };
|
|
3030
2358
|
}
|
|
3031
2359
|
});
|
|
3032
2360
|
};
|
|
@@ -3075,10 +2403,10 @@ function createSocket({
|
|
|
3075
2403
|
}
|
|
3076
2404
|
|
|
3077
2405
|
// src/novu.ts
|
|
3078
|
-
var
|
|
2406
|
+
var _emitter9, _session, _inboxService3;
|
|
3079
2407
|
var Novu = class {
|
|
3080
2408
|
constructor(options) {
|
|
3081
|
-
chunk7B52C2XE_js.__privateAdd(this,
|
|
2409
|
+
chunk7B52C2XE_js.__privateAdd(this, _emitter9);
|
|
3082
2410
|
chunk7B52C2XE_js.__privateAdd(this, _session);
|
|
3083
2411
|
chunk7B52C2XE_js.__privateAdd(this, _inboxService3);
|
|
3084
2412
|
var _a, _b;
|
|
@@ -3086,46 +2414,46 @@ var Novu = class {
|
|
|
3086
2414
|
apiUrl: options.apiUrl || options.backendUrl,
|
|
3087
2415
|
userAgent: options.__userAgent
|
|
3088
2416
|
}));
|
|
3089
|
-
chunk7B52C2XE_js.__privateSet(this,
|
|
2417
|
+
chunk7B52C2XE_js.__privateSet(this, _emitter9, new NovuEventEmitter());
|
|
3090
2418
|
chunk7B52C2XE_js.__privateSet(this, _session, new Session(
|
|
3091
2419
|
{
|
|
3092
2420
|
applicationIdentifier: options.applicationIdentifier || "",
|
|
3093
2421
|
subscriberHash: options.subscriberHash,
|
|
3094
|
-
subscriber:
|
|
2422
|
+
subscriber: chunkWFVHYVDM_js.buildSubscriber({ subscriberId: options.subscriberId, subscriber: options.subscriber }),
|
|
3095
2423
|
defaultSchedule: options.defaultSchedule,
|
|
3096
2424
|
context: options.context,
|
|
3097
2425
|
contextHash: options.contextHash
|
|
3098
2426
|
},
|
|
3099
2427
|
chunk7B52C2XE_js.__privateGet(this, _inboxService3),
|
|
3100
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
2428
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter9)
|
|
3101
2429
|
));
|
|
3102
2430
|
chunk7B52C2XE_js.__privateGet(this, _session).initialize();
|
|
3103
2431
|
this.notifications = new Notifications({
|
|
3104
2432
|
useCache: (_a = options.useCache) != null ? _a : true,
|
|
3105
2433
|
inboxServiceInstance: chunk7B52C2XE_js.__privateGet(this, _inboxService3),
|
|
3106
|
-
eventEmitterInstance: chunk7B52C2XE_js.__privateGet(this,
|
|
2434
|
+
eventEmitterInstance: chunk7B52C2XE_js.__privateGet(this, _emitter9)
|
|
3107
2435
|
});
|
|
3108
2436
|
this.preferences = new Preferences({
|
|
3109
2437
|
useCache: (_b = options.useCache) != null ? _b : true,
|
|
3110
2438
|
inboxServiceInstance: chunk7B52C2XE_js.__privateGet(this, _inboxService3),
|
|
3111
|
-
eventEmitterInstance: chunk7B52C2XE_js.__privateGet(this,
|
|
2439
|
+
eventEmitterInstance: chunk7B52C2XE_js.__privateGet(this, _emitter9)
|
|
3112
2440
|
});
|
|
3113
2441
|
this.socket = createSocket({
|
|
3114
2442
|
socketUrl: options.socketUrl,
|
|
3115
|
-
eventEmitterInstance: chunk7B52C2XE_js.__privateGet(this,
|
|
2443
|
+
eventEmitterInstance: chunk7B52C2XE_js.__privateGet(this, _emitter9),
|
|
3116
2444
|
inboxServiceInstance: chunk7B52C2XE_js.__privateGet(this, _inboxService3)
|
|
3117
2445
|
});
|
|
3118
2446
|
this.on = (eventName, listener) => {
|
|
3119
2447
|
if (this.socket.isSocketEvent(eventName)) {
|
|
3120
2448
|
this.socket.connect();
|
|
3121
2449
|
}
|
|
3122
|
-
const cleanup = chunk7B52C2XE_js.__privateGet(this,
|
|
2450
|
+
const cleanup = chunk7B52C2XE_js.__privateGet(this, _emitter9).on(eventName, listener);
|
|
3123
2451
|
return () => {
|
|
3124
2452
|
cleanup();
|
|
3125
2453
|
};
|
|
3126
2454
|
};
|
|
3127
2455
|
this.off = (eventName, listener) => {
|
|
3128
|
-
chunk7B52C2XE_js.__privateGet(this,
|
|
2456
|
+
chunk7B52C2XE_js.__privateGet(this, _emitter9).off(eventName, listener);
|
|
3129
2457
|
};
|
|
3130
2458
|
}
|
|
3131
2459
|
get applicationIdentifier() {
|
|
@@ -3138,7 +2466,7 @@ var Novu = class {
|
|
|
3138
2466
|
return chunk7B52C2XE_js.__privateGet(this, _session).context;
|
|
3139
2467
|
}
|
|
3140
2468
|
get contextKey() {
|
|
3141
|
-
return
|
|
2469
|
+
return chunkWFVHYVDM_js.buildContextKey(chunk7B52C2XE_js.__privateGet(this, _session).context);
|
|
3142
2470
|
}
|
|
3143
2471
|
changeSubscriber(options) {
|
|
3144
2472
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
@@ -3179,18 +2507,12 @@ var Novu = class {
|
|
|
3179
2507
|
});
|
|
3180
2508
|
}
|
|
3181
2509
|
};
|
|
3182
|
-
|
|
2510
|
+
_emitter9 = new WeakMap();
|
|
3183
2511
|
_session = new WeakMap();
|
|
3184
2512
|
_inboxService3 = new WeakMap();
|
|
3185
2513
|
|
|
3186
|
-
exports.ChannelType = ChannelType;
|
|
3187
2514
|
exports.DEFAULT_API_VERSION = DEFAULT_API_VERSION;
|
|
3188
|
-
exports.NotificationStatus = NotificationStatus;
|
|
3189
2515
|
exports.Novu = Novu;
|
|
3190
|
-
exports.PreferenceLevel = PreferenceLevel;
|
|
3191
|
-
exports.SeverityLevelEnum = SeverityLevelEnum;
|
|
3192
|
-
exports.WebSocketEvent = WebSocketEvent;
|
|
3193
|
-
exports.WorkflowCriticalityEnum = WorkflowCriticalityEnum;
|
|
3194
2516
|
exports.areSeveritiesEqual = areSeveritiesEqual;
|
|
3195
2517
|
exports.areTagsEqual = areTagsEqual;
|
|
3196
2518
|
exports.checkNotificationDataFilter = checkNotificationDataFilter;
|