@novu/js 3.7.1-nightly.20250723 → 3.8.1-nightly.20250813.014483f9e1
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-FZQYUNQH.js → chunk-HCIYXVYN.js} +571 -513
- package/dist/cjs/index.d.ts +11 -4
- package/dist/cjs/index.js +17 -9
- package/dist/cjs/internal/index.d.ts +6 -6
- package/dist/cjs/internal/index.js +3 -3
- package/dist/{esm/novu-DiZKRUW5.d.mts → cjs/novu-D6fucMvr.d.ts} +39 -38
- package/dist/cjs/themes/index.d.ts +3 -3
- package/dist/cjs/{types-C4qukwbH.d.ts → types-B3PJouaR.d.ts} +3 -3
- package/dist/cjs/{types-Y8PRbRbj.d.ts → types-CiFWY1AG.d.ts} +1 -0
- package/dist/cjs/ui/index.d.ts +4 -4
- package/dist/cjs/ui/index.js +543 -577
- package/dist/esm/{chunk-EO566EDU.mjs → chunk-LGVZ7VZR.mjs} +568 -513
- package/dist/esm/index.d.mts +11 -4
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/internal/index.d.mts +6 -6
- package/dist/esm/internal/index.mjs +1 -1
- package/dist/{cjs/novu-Gnea9ink.d.ts → esm/novu-CktM1OXQ.d.mts} +39 -38
- package/dist/esm/themes/index.d.mts +3 -3
- package/dist/esm/{types-D_hCZpTY.d.mts → types-C8yNgqZQ.d.mts} +3 -3
- package/dist/esm/{types-Y8PRbRbj.d.mts → types-CiFWY1AG.d.mts} +1 -0
- package/dist/esm/ui/index.d.mts +4 -4
- package/dist/esm/ui/index.mjs +537 -571
- package/dist/novu.min.js +12 -12
- package/dist/novu.min.js.gz +0 -0
- package/package.json +3 -4
- package/dist/cjs/{chunk-QFZ5WJGI.js → chunk-ZB7IPCHY.js} +14 -14
- package/dist/esm/{chunk-KYYDDVBR.mjs → chunk-QOD7NZ77.mjs} +14 -14
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { buildSubscriber } from './chunk-
|
|
1
|
+
import { buildSubscriber } from './chunk-QOD7NZ77.mjs';
|
|
2
2
|
import { __privateAdd, __privateSet, __privateGet, __async, __objRest, __spreadValues, __spreadProps, __privateMethod } from './chunk-STZMOEWR.mjs';
|
|
3
3
|
import mitt from 'mitt';
|
|
4
|
-
import io from 'socket.io-client';
|
|
5
4
|
import { WebSocket } from 'partysocket';
|
|
5
|
+
import io from 'socket.io-client';
|
|
6
6
|
|
|
7
7
|
// src/types.ts
|
|
8
8
|
var NotificationStatus = /* @__PURE__ */ ((NotificationStatus2) => {
|
|
@@ -66,10 +66,63 @@ var areDataEqual = (data1, data2) => {
|
|
|
66
66
|
var isSameFilter = (filter1, filter2) => {
|
|
67
67
|
return areDataEqual(filter1.data, filter2.data) && areTagsEqual(filter1.tags, filter2.tags) && filter1.read === filter2.read && filter1.archived === filter2.archived && filter1.snoozed === filter2.snoozed && filter1.seen === filter2.seen;
|
|
68
68
|
};
|
|
69
|
+
function checkNotificationDataFilter(notificationData, filterData) {
|
|
70
|
+
if (!filterData || Object.keys(filterData).length === 0) {
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
if (!notificationData) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
return Object.entries(filterData).every(([key, filterValue]) => {
|
|
77
|
+
const notifValue = notificationData[key];
|
|
78
|
+
if (notifValue === void 0 && filterValue !== void 0) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
if (Array.isArray(filterValue)) {
|
|
82
|
+
if (Array.isArray(notifValue)) {
|
|
83
|
+
if (filterValue.length !== notifValue.length) return false;
|
|
84
|
+
const sortedFilterValue = [...filterValue].sort();
|
|
85
|
+
const sortedNotifValue = [...notifValue].sort();
|
|
86
|
+
return sortedFilterValue.every((val, index) => val === sortedNotifValue[index]);
|
|
87
|
+
} else {
|
|
88
|
+
return filterValue.includes(notifValue);
|
|
89
|
+
}
|
|
90
|
+
} else {
|
|
91
|
+
return notifValue === filterValue;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function checkNotificationTagFilter(notificationTags, filterTags) {
|
|
96
|
+
if (!filterTags || filterTags.length === 0) {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
if (!notificationTags || notificationTags.length === 0) {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
return filterTags.some((tag) => notificationTags.includes(tag));
|
|
103
|
+
}
|
|
104
|
+
function checkBasicFilters(notification, filter) {
|
|
105
|
+
if (filter.read !== void 0 && notification.isRead !== filter.read) {
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
if (filter.seen !== void 0 && notification.isSeen !== filter.seen) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
if (filter.archived !== void 0 && notification.isArchived !== filter.archived) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
if (filter.snoozed !== void 0 && notification.isSnoozed !== filter.snoozed) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
function checkNotificationMatchesFilter(notification, filter) {
|
|
120
|
+
return checkBasicFilters(notification, filter) && checkNotificationTagFilter(notification.tags, filter.tags) && checkNotificationDataFilter(notification.data, filter.data);
|
|
121
|
+
}
|
|
69
122
|
|
|
70
123
|
// src/api/http-client.ts
|
|
71
124
|
var DEFAULT_API_VERSION = "v1";
|
|
72
|
-
var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.
|
|
125
|
+
var DEFAULT_USER_AGENT = `${"@novu/js"}@${"3.8.1-nightly.20250813.014483f9e1"}`;
|
|
73
126
|
var HttpClient = class {
|
|
74
127
|
constructor(options = {}) {
|
|
75
128
|
// Environment variable for local development that overrides the default API endpoint without affecting the Inbox DX
|
|
@@ -393,219 +446,6 @@ var NovuError = class extends Error {
|
|
|
393
446
|
}
|
|
394
447
|
};
|
|
395
448
|
|
|
396
|
-
// src/base-module.ts
|
|
397
|
-
var _callsQueue, _sessionError;
|
|
398
|
-
var BaseModule = class {
|
|
399
|
-
constructor({
|
|
400
|
-
inboxServiceInstance,
|
|
401
|
-
eventEmitterInstance
|
|
402
|
-
}) {
|
|
403
|
-
__privateAdd(this, _callsQueue, []);
|
|
404
|
-
__privateAdd(this, _sessionError);
|
|
405
|
-
this._emitter = eventEmitterInstance;
|
|
406
|
-
this._inboxService = inboxServiceInstance;
|
|
407
|
-
this._emitter.on("session.initialize.resolved", ({ error, data }) => {
|
|
408
|
-
if (data) {
|
|
409
|
-
this.onSessionSuccess(data);
|
|
410
|
-
__privateGet(this, _callsQueue).forEach((_0) => __async(this, [_0], function* ({ fn, resolve }) {
|
|
411
|
-
resolve(yield fn());
|
|
412
|
-
}));
|
|
413
|
-
__privateSet(this, _callsQueue, []);
|
|
414
|
-
} else if (error) {
|
|
415
|
-
this.onSessionError(error);
|
|
416
|
-
__privateSet(this, _sessionError, error);
|
|
417
|
-
__privateGet(this, _callsQueue).forEach(({ resolve }) => {
|
|
418
|
-
resolve({ error: new NovuError("Failed to initialize session, please contact the support", error) });
|
|
419
|
-
});
|
|
420
|
-
__privateSet(this, _callsQueue, []);
|
|
421
|
-
}
|
|
422
|
-
});
|
|
423
|
-
}
|
|
424
|
-
onSessionSuccess(_) {
|
|
425
|
-
}
|
|
426
|
-
onSessionError(_) {
|
|
427
|
-
}
|
|
428
|
-
callWithSession(fn) {
|
|
429
|
-
return __async(this, null, function* () {
|
|
430
|
-
if (this._inboxService.isSessionInitialized) {
|
|
431
|
-
return fn();
|
|
432
|
-
}
|
|
433
|
-
if (__privateGet(this, _sessionError)) {
|
|
434
|
-
return Promise.resolve({
|
|
435
|
-
error: new NovuError("Failed to initialize session, please contact the support", __privateGet(this, _sessionError))
|
|
436
|
-
});
|
|
437
|
-
}
|
|
438
|
-
return new Promise((resolve, reject) => {
|
|
439
|
-
__privateGet(this, _callsQueue).push({ fn, resolve, reject });
|
|
440
|
-
});
|
|
441
|
-
});
|
|
442
|
-
}
|
|
443
|
-
};
|
|
444
|
-
_callsQueue = new WeakMap();
|
|
445
|
-
_sessionError = new WeakMap();
|
|
446
|
-
|
|
447
|
-
// src/notifications/notification.ts
|
|
448
|
-
var _emitter, _inboxService;
|
|
449
|
-
var Notification = class {
|
|
450
|
-
constructor(notification, emitter, inboxService) {
|
|
451
|
-
__privateAdd(this, _emitter);
|
|
452
|
-
__privateAdd(this, _inboxService);
|
|
453
|
-
__privateSet(this, _emitter, emitter);
|
|
454
|
-
__privateSet(this, _inboxService, inboxService);
|
|
455
|
-
this.id = notification.id;
|
|
456
|
-
this.subject = notification.subject;
|
|
457
|
-
this.body = notification.body;
|
|
458
|
-
this.to = notification.to;
|
|
459
|
-
this.isRead = notification.isRead;
|
|
460
|
-
this.isSeen = notification.isSeen;
|
|
461
|
-
this.isArchived = notification.isArchived;
|
|
462
|
-
this.isSnoozed = notification.isSnoozed;
|
|
463
|
-
this.snoozedUntil = notification.snoozedUntil;
|
|
464
|
-
this.deliveredAt = notification.deliveredAt;
|
|
465
|
-
this.createdAt = notification.createdAt;
|
|
466
|
-
this.readAt = notification.readAt;
|
|
467
|
-
this.firstSeenAt = notification.firstSeenAt;
|
|
468
|
-
this.archivedAt = notification.archivedAt;
|
|
469
|
-
this.avatar = notification.avatar;
|
|
470
|
-
this.primaryAction = notification.primaryAction;
|
|
471
|
-
this.secondaryAction = notification.secondaryAction;
|
|
472
|
-
this.channelType = notification.channelType;
|
|
473
|
-
this.tags = notification.tags;
|
|
474
|
-
this.redirect = notification.redirect;
|
|
475
|
-
this.data = notification.data;
|
|
476
|
-
this.workflow = notification.workflow;
|
|
477
|
-
}
|
|
478
|
-
read() {
|
|
479
|
-
return read({
|
|
480
|
-
emitter: __privateGet(this, _emitter),
|
|
481
|
-
apiService: __privateGet(this, _inboxService),
|
|
482
|
-
args: {
|
|
483
|
-
notification: this
|
|
484
|
-
}
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
unread() {
|
|
488
|
-
return unread({
|
|
489
|
-
emitter: __privateGet(this, _emitter),
|
|
490
|
-
apiService: __privateGet(this, _inboxService),
|
|
491
|
-
args: {
|
|
492
|
-
notification: this
|
|
493
|
-
}
|
|
494
|
-
});
|
|
495
|
-
}
|
|
496
|
-
seen() {
|
|
497
|
-
return seen({
|
|
498
|
-
emitter: __privateGet(this, _emitter),
|
|
499
|
-
apiService: __privateGet(this, _inboxService),
|
|
500
|
-
args: {
|
|
501
|
-
notification: this
|
|
502
|
-
}
|
|
503
|
-
});
|
|
504
|
-
}
|
|
505
|
-
archive() {
|
|
506
|
-
return archive({
|
|
507
|
-
emitter: __privateGet(this, _emitter),
|
|
508
|
-
apiService: __privateGet(this, _inboxService),
|
|
509
|
-
args: {
|
|
510
|
-
notification: this
|
|
511
|
-
}
|
|
512
|
-
});
|
|
513
|
-
}
|
|
514
|
-
unarchive() {
|
|
515
|
-
return unarchive({
|
|
516
|
-
emitter: __privateGet(this, _emitter),
|
|
517
|
-
apiService: __privateGet(this, _inboxService),
|
|
518
|
-
args: {
|
|
519
|
-
notification: this
|
|
520
|
-
}
|
|
521
|
-
});
|
|
522
|
-
}
|
|
523
|
-
snooze(snoozeUntil) {
|
|
524
|
-
return snooze({
|
|
525
|
-
emitter: __privateGet(this, _emitter),
|
|
526
|
-
apiService: __privateGet(this, _inboxService),
|
|
527
|
-
args: {
|
|
528
|
-
notification: this,
|
|
529
|
-
snoozeUntil
|
|
530
|
-
}
|
|
531
|
-
});
|
|
532
|
-
}
|
|
533
|
-
unsnooze() {
|
|
534
|
-
return unsnooze({
|
|
535
|
-
emitter: __privateGet(this, _emitter),
|
|
536
|
-
apiService: __privateGet(this, _inboxService),
|
|
537
|
-
args: { notification: this }
|
|
538
|
-
});
|
|
539
|
-
}
|
|
540
|
-
completePrimary() {
|
|
541
|
-
if (!this.primaryAction) {
|
|
542
|
-
throw new Error("Primary action is not available");
|
|
543
|
-
}
|
|
544
|
-
return completeAction({
|
|
545
|
-
emitter: __privateGet(this, _emitter),
|
|
546
|
-
apiService: __privateGet(this, _inboxService),
|
|
547
|
-
args: {
|
|
548
|
-
notification: this
|
|
549
|
-
},
|
|
550
|
-
actionType: "primary" /* PRIMARY */
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
completeSecondary() {
|
|
554
|
-
if (!this.primaryAction) {
|
|
555
|
-
throw new Error("Secondary action is not available");
|
|
556
|
-
}
|
|
557
|
-
return completeAction({
|
|
558
|
-
emitter: __privateGet(this, _emitter),
|
|
559
|
-
apiService: __privateGet(this, _inboxService),
|
|
560
|
-
args: {
|
|
561
|
-
notification: this
|
|
562
|
-
},
|
|
563
|
-
actionType: "secondary" /* SECONDARY */
|
|
564
|
-
});
|
|
565
|
-
}
|
|
566
|
-
revertPrimary() {
|
|
567
|
-
if (!this.primaryAction) {
|
|
568
|
-
throw new Error("Primary action is not available");
|
|
569
|
-
}
|
|
570
|
-
return revertAction({
|
|
571
|
-
emitter: __privateGet(this, _emitter),
|
|
572
|
-
apiService: __privateGet(this, _inboxService),
|
|
573
|
-
args: {
|
|
574
|
-
notification: this
|
|
575
|
-
},
|
|
576
|
-
actionType: "primary" /* PRIMARY */
|
|
577
|
-
});
|
|
578
|
-
}
|
|
579
|
-
revertSecondary() {
|
|
580
|
-
if (!this.primaryAction) {
|
|
581
|
-
throw new Error("Secondary action is not available");
|
|
582
|
-
}
|
|
583
|
-
return revertAction({
|
|
584
|
-
emitter: __privateGet(this, _emitter),
|
|
585
|
-
apiService: __privateGet(this, _inboxService),
|
|
586
|
-
args: {
|
|
587
|
-
notification: this
|
|
588
|
-
},
|
|
589
|
-
actionType: "secondary" /* SECONDARY */
|
|
590
|
-
});
|
|
591
|
-
}
|
|
592
|
-
on(eventName, listener) {
|
|
593
|
-
const cleanup = __privateGet(this, _emitter).on(eventName, listener);
|
|
594
|
-
return () => {
|
|
595
|
-
cleanup();
|
|
596
|
-
};
|
|
597
|
-
}
|
|
598
|
-
/**
|
|
599
|
-
* @deprecated
|
|
600
|
-
* Use the cleanup function returned by the "on" method instead.
|
|
601
|
-
*/
|
|
602
|
-
off(eventName, listener) {
|
|
603
|
-
__privateGet(this, _emitter).off(eventName, listener);
|
|
604
|
-
}
|
|
605
|
-
};
|
|
606
|
-
_emitter = new WeakMap();
|
|
607
|
-
_inboxService = new WeakMap();
|
|
608
|
-
|
|
609
449
|
// src/notifications/helpers.ts
|
|
610
450
|
var read = (_0) => __async(void 0, [_0], function* ({
|
|
611
451
|
emitter,
|
|
@@ -1031,22 +871,236 @@ var archiveAllRead = (_0) => __async(void 0, [_0], function* ({
|
|
|
1031
871
|
}
|
|
1032
872
|
});
|
|
1033
873
|
|
|
1034
|
-
// src/
|
|
1035
|
-
var
|
|
1036
|
-
var
|
|
1037
|
-
constructor() {
|
|
1038
|
-
__privateAdd(this,
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
874
|
+
// src/notifications/notification.ts
|
|
875
|
+
var _emitter, _inboxService;
|
|
876
|
+
var Notification = class {
|
|
877
|
+
constructor(notification, emitter, inboxService) {
|
|
878
|
+
__privateAdd(this, _emitter);
|
|
879
|
+
__privateAdd(this, _inboxService);
|
|
880
|
+
__privateSet(this, _emitter, emitter);
|
|
881
|
+
__privateSet(this, _inboxService, inboxService);
|
|
882
|
+
this.id = notification.id;
|
|
883
|
+
this.transactionId = notification.transactionId;
|
|
884
|
+
this.subject = notification.subject;
|
|
885
|
+
this.body = notification.body;
|
|
886
|
+
this.to = notification.to;
|
|
887
|
+
this.isRead = notification.isRead;
|
|
888
|
+
this.isSeen = notification.isSeen;
|
|
889
|
+
this.isArchived = notification.isArchived;
|
|
890
|
+
this.isSnoozed = notification.isSnoozed;
|
|
891
|
+
this.snoozedUntil = notification.snoozedUntil;
|
|
892
|
+
this.deliveredAt = notification.deliveredAt;
|
|
893
|
+
this.createdAt = notification.createdAt;
|
|
894
|
+
this.readAt = notification.readAt;
|
|
895
|
+
this.firstSeenAt = notification.firstSeenAt;
|
|
896
|
+
this.archivedAt = notification.archivedAt;
|
|
897
|
+
this.avatar = notification.avatar;
|
|
898
|
+
this.primaryAction = notification.primaryAction;
|
|
899
|
+
this.secondaryAction = notification.secondaryAction;
|
|
900
|
+
this.channelType = notification.channelType;
|
|
901
|
+
this.tags = notification.tags;
|
|
902
|
+
this.redirect = notification.redirect;
|
|
903
|
+
this.data = notification.data;
|
|
904
|
+
this.workflow = notification.workflow;
|
|
905
|
+
}
|
|
906
|
+
read() {
|
|
907
|
+
return read({
|
|
908
|
+
emitter: __privateGet(this, _emitter),
|
|
909
|
+
apiService: __privateGet(this, _inboxService),
|
|
910
|
+
args: {
|
|
911
|
+
notification: this
|
|
912
|
+
}
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
unread() {
|
|
916
|
+
return unread({
|
|
917
|
+
emitter: __privateGet(this, _emitter),
|
|
918
|
+
apiService: __privateGet(this, _inboxService),
|
|
919
|
+
args: {
|
|
920
|
+
notification: this
|
|
921
|
+
}
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
seen() {
|
|
925
|
+
return seen({
|
|
926
|
+
emitter: __privateGet(this, _emitter),
|
|
927
|
+
apiService: __privateGet(this, _inboxService),
|
|
928
|
+
args: {
|
|
929
|
+
notification: this
|
|
930
|
+
}
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
archive() {
|
|
934
|
+
return archive({
|
|
935
|
+
emitter: __privateGet(this, _emitter),
|
|
936
|
+
apiService: __privateGet(this, _inboxService),
|
|
937
|
+
args: {
|
|
938
|
+
notification: this
|
|
939
|
+
}
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
unarchive() {
|
|
943
|
+
return unarchive({
|
|
944
|
+
emitter: __privateGet(this, _emitter),
|
|
945
|
+
apiService: __privateGet(this, _inboxService),
|
|
946
|
+
args: {
|
|
947
|
+
notification: this
|
|
948
|
+
}
|
|
949
|
+
});
|
|
950
|
+
}
|
|
951
|
+
snooze(snoozeUntil) {
|
|
952
|
+
return snooze({
|
|
953
|
+
emitter: __privateGet(this, _emitter),
|
|
954
|
+
apiService: __privateGet(this, _inboxService),
|
|
955
|
+
args: {
|
|
956
|
+
notification: this,
|
|
957
|
+
snoozeUntil
|
|
958
|
+
}
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
unsnooze() {
|
|
962
|
+
return unsnooze({
|
|
963
|
+
emitter: __privateGet(this, _emitter),
|
|
964
|
+
apiService: __privateGet(this, _inboxService),
|
|
965
|
+
args: { notification: this }
|
|
966
|
+
});
|
|
967
|
+
}
|
|
968
|
+
completePrimary() {
|
|
969
|
+
if (!this.primaryAction) {
|
|
970
|
+
throw new Error("Primary action is not available");
|
|
971
|
+
}
|
|
972
|
+
return completeAction({
|
|
973
|
+
emitter: __privateGet(this, _emitter),
|
|
974
|
+
apiService: __privateGet(this, _inboxService),
|
|
975
|
+
args: {
|
|
976
|
+
notification: this
|
|
977
|
+
},
|
|
978
|
+
actionType: "primary" /* PRIMARY */
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
completeSecondary() {
|
|
982
|
+
if (!this.primaryAction) {
|
|
983
|
+
throw new Error("Secondary action is not available");
|
|
984
|
+
}
|
|
985
|
+
return completeAction({
|
|
986
|
+
emitter: __privateGet(this, _emitter),
|
|
987
|
+
apiService: __privateGet(this, _inboxService),
|
|
988
|
+
args: {
|
|
989
|
+
notification: this
|
|
990
|
+
},
|
|
991
|
+
actionType: "secondary" /* SECONDARY */
|
|
992
|
+
});
|
|
993
|
+
}
|
|
994
|
+
revertPrimary() {
|
|
995
|
+
if (!this.primaryAction) {
|
|
996
|
+
throw new Error("Primary action is not available");
|
|
997
|
+
}
|
|
998
|
+
return revertAction({
|
|
999
|
+
emitter: __privateGet(this, _emitter),
|
|
1000
|
+
apiService: __privateGet(this, _inboxService),
|
|
1001
|
+
args: {
|
|
1002
|
+
notification: this
|
|
1003
|
+
},
|
|
1004
|
+
actionType: "primary" /* PRIMARY */
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
revertSecondary() {
|
|
1008
|
+
if (!this.primaryAction) {
|
|
1009
|
+
throw new Error("Secondary action is not available");
|
|
1010
|
+
}
|
|
1011
|
+
return revertAction({
|
|
1012
|
+
emitter: __privateGet(this, _emitter),
|
|
1013
|
+
apiService: __privateGet(this, _inboxService),
|
|
1014
|
+
args: {
|
|
1015
|
+
notification: this
|
|
1016
|
+
},
|
|
1017
|
+
actionType: "secondary" /* SECONDARY */
|
|
1018
|
+
});
|
|
1019
|
+
}
|
|
1020
|
+
on(eventName, listener) {
|
|
1021
|
+
const cleanup = __privateGet(this, _emitter).on(eventName, listener);
|
|
1022
|
+
return () => {
|
|
1023
|
+
cleanup();
|
|
1024
|
+
};
|
|
1025
|
+
}
|
|
1026
|
+
/**
|
|
1027
|
+
* @deprecated
|
|
1028
|
+
* Use the cleanup function returned by the "on" method instead.
|
|
1029
|
+
*/
|
|
1030
|
+
off(eventName, listener) {
|
|
1031
|
+
__privateGet(this, _emitter).off(eventName, listener);
|
|
1032
|
+
}
|
|
1033
|
+
};
|
|
1034
|
+
_emitter = new WeakMap();
|
|
1035
|
+
_inboxService = new WeakMap();
|
|
1036
|
+
|
|
1037
|
+
// src/base-module.ts
|
|
1038
|
+
var _callsQueue, _sessionError;
|
|
1039
|
+
var BaseModule = class {
|
|
1040
|
+
constructor({
|
|
1041
|
+
inboxServiceInstance,
|
|
1042
|
+
eventEmitterInstance
|
|
1043
|
+
}) {
|
|
1044
|
+
__privateAdd(this, _callsQueue, []);
|
|
1045
|
+
__privateAdd(this, _sessionError);
|
|
1046
|
+
this._emitter = eventEmitterInstance;
|
|
1047
|
+
this._inboxService = inboxServiceInstance;
|
|
1048
|
+
this._emitter.on("session.initialize.resolved", ({ error, data }) => {
|
|
1049
|
+
if (data) {
|
|
1050
|
+
this.onSessionSuccess(data);
|
|
1051
|
+
__privateGet(this, _callsQueue).forEach((_0) => __async(this, [_0], function* ({ fn, resolve }) {
|
|
1052
|
+
resolve(yield fn());
|
|
1053
|
+
}));
|
|
1054
|
+
__privateSet(this, _callsQueue, []);
|
|
1055
|
+
} else if (error) {
|
|
1056
|
+
this.onSessionError(error);
|
|
1057
|
+
__privateSet(this, _sessionError, error);
|
|
1058
|
+
__privateGet(this, _callsQueue).forEach(({ resolve }) => {
|
|
1059
|
+
resolve({ error: new NovuError("Failed to initialize session, please contact the support", error) });
|
|
1060
|
+
});
|
|
1061
|
+
__privateSet(this, _callsQueue, []);
|
|
1062
|
+
}
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
onSessionSuccess(_) {
|
|
1066
|
+
}
|
|
1067
|
+
onSessionError(_) {
|
|
1068
|
+
}
|
|
1069
|
+
callWithSession(fn) {
|
|
1070
|
+
return __async(this, null, function* () {
|
|
1071
|
+
if (this._inboxService.isSessionInitialized) {
|
|
1072
|
+
return fn();
|
|
1073
|
+
}
|
|
1074
|
+
if (__privateGet(this, _sessionError)) {
|
|
1075
|
+
return Promise.resolve({
|
|
1076
|
+
error: new NovuError("Failed to initialize session, please contact the support", __privateGet(this, _sessionError))
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1079
|
+
return new Promise((resolve, reject) => {
|
|
1080
|
+
__privateGet(this, _callsQueue).push({ fn, resolve, reject });
|
|
1081
|
+
});
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
};
|
|
1085
|
+
_callsQueue = new WeakMap();
|
|
1086
|
+
_sessionError = new WeakMap();
|
|
1087
|
+
|
|
1088
|
+
// src/cache/in-memory-cache.ts
|
|
1089
|
+
var _cache;
|
|
1090
|
+
var InMemoryCache = class {
|
|
1091
|
+
constructor() {
|
|
1092
|
+
__privateAdd(this, _cache);
|
|
1093
|
+
__privateSet(this, _cache, /* @__PURE__ */ new Map());
|
|
1094
|
+
}
|
|
1095
|
+
get(key) {
|
|
1096
|
+
return __privateGet(this, _cache).get(key);
|
|
1097
|
+
}
|
|
1098
|
+
getValues() {
|
|
1099
|
+
return Array.from(__privateGet(this, _cache).values());
|
|
1100
|
+
}
|
|
1101
|
+
entries() {
|
|
1102
|
+
return Array.from(__privateGet(this, _cache).entries());
|
|
1103
|
+
}
|
|
1050
1104
|
keys() {
|
|
1051
1105
|
return Array.from(__privateGet(this, _cache).keys());
|
|
1052
1106
|
}
|
|
@@ -1549,10 +1603,7 @@ var Notifications = class extends BaseModule {
|
|
|
1549
1603
|
});
|
|
1550
1604
|
}
|
|
1551
1605
|
archiveAllRead() {
|
|
1552
|
-
return __async(this, arguments, function* ({
|
|
1553
|
-
tags,
|
|
1554
|
-
data
|
|
1555
|
-
} = {}) {
|
|
1606
|
+
return __async(this, arguments, function* ({ tags, data } = {}) {
|
|
1556
1607
|
return this.callWithSession(
|
|
1557
1608
|
() => __async(this, null, function* () {
|
|
1558
1609
|
return archiveAllRead({
|
|
@@ -1580,29 +1631,162 @@ var Notifications = class extends BaseModule {
|
|
|
1580
1631
|
};
|
|
1581
1632
|
_useCache = new WeakMap();
|
|
1582
1633
|
|
|
1583
|
-
// src/preferences
|
|
1584
|
-
var
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
}) {
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1634
|
+
// src/cache/preferences-cache.ts
|
|
1635
|
+
var updateEvents2 = [
|
|
1636
|
+
"preference.update.pending",
|
|
1637
|
+
"preference.update.resolved",
|
|
1638
|
+
"preferences.bulk_update.pending",
|
|
1639
|
+
"preferences.bulk_update.resolved"
|
|
1640
|
+
];
|
|
1641
|
+
var excludeEmpty2 = ({ tags }) => Object.entries({ tags }).reduce((acc, [key, value]) => {
|
|
1642
|
+
if (value === null || value === void 0 || Array.isArray(value) && value.length === 0) {
|
|
1643
|
+
return acc;
|
|
1644
|
+
}
|
|
1645
|
+
acc[key] = value;
|
|
1646
|
+
return acc;
|
|
1647
|
+
}, {});
|
|
1648
|
+
var getCacheKey2 = ({ tags }) => {
|
|
1649
|
+
return JSON.stringify(excludeEmpty2({ tags }));
|
|
1650
|
+
};
|
|
1651
|
+
var _emitter3, _cache3;
|
|
1652
|
+
var PreferencesCache = class {
|
|
1653
|
+
constructor({ emitterInstance }) {
|
|
1654
|
+
__privateAdd(this, _emitter3);
|
|
1655
|
+
__privateAdd(this, _cache3);
|
|
1656
|
+
this.updatePreference = (key, data) => {
|
|
1657
|
+
const preferences = __privateGet(this, _cache3).get(key);
|
|
1658
|
+
if (!preferences) {
|
|
1659
|
+
return false;
|
|
1660
|
+
}
|
|
1661
|
+
const index = preferences.findIndex(
|
|
1662
|
+
(el) => {
|
|
1663
|
+
var _a, _b;
|
|
1664
|
+
return ((_a = el.workflow) == null ? void 0 : _a.id) === ((_b = data.workflow) == null ? void 0 : _b.id) || el.level === data.level && data.level === "global" /* GLOBAL */;
|
|
1665
|
+
}
|
|
1666
|
+
);
|
|
1667
|
+
if (index === -1) {
|
|
1668
|
+
return false;
|
|
1669
|
+
}
|
|
1670
|
+
const updatedPreferences = [...preferences];
|
|
1671
|
+
updatedPreferences[index] = data;
|
|
1672
|
+
__privateGet(this, _cache3).set(key, updatedPreferences);
|
|
1673
|
+
return true;
|
|
1674
|
+
};
|
|
1675
|
+
this.handlePreferenceEvent = ({ data }) => {
|
|
1676
|
+
if (!data) {
|
|
1677
|
+
return;
|
|
1678
|
+
}
|
|
1679
|
+
const preferences = Array.isArray(data) ? data : [data];
|
|
1680
|
+
const uniqueFilterKeys = /* @__PURE__ */ new Set();
|
|
1681
|
+
__privateGet(this, _cache3).keys().forEach((key) => {
|
|
1682
|
+
preferences.forEach((preference) => {
|
|
1683
|
+
const hasUpdatedPreference = this.updatePreference(key, preference);
|
|
1684
|
+
const updatedPreference = __privateGet(this, _cache3).get(key);
|
|
1685
|
+
if (!hasUpdatedPreference || !updatedPreference) {
|
|
1686
|
+
return;
|
|
1687
|
+
}
|
|
1688
|
+
uniqueFilterKeys.add(key);
|
|
1689
|
+
});
|
|
1690
|
+
});
|
|
1691
|
+
uniqueFilterKeys.forEach((key) => {
|
|
1692
|
+
var _a;
|
|
1693
|
+
__privateGet(this, _emitter3).emit("preferences.list.updated", {
|
|
1694
|
+
data: (_a = __privateGet(this, _cache3).get(key)) != null ? _a : []
|
|
1695
|
+
});
|
|
1696
|
+
});
|
|
1697
|
+
};
|
|
1698
|
+
__privateSet(this, _emitter3, emitterInstance);
|
|
1699
|
+
updateEvents2.forEach((event) => {
|
|
1700
|
+
__privateGet(this, _emitter3).on(event, this.handlePreferenceEvent);
|
|
1701
|
+
});
|
|
1702
|
+
__privateSet(this, _cache3, new InMemoryCache());
|
|
1703
|
+
}
|
|
1704
|
+
has(args) {
|
|
1705
|
+
return __privateGet(this, _cache3).get(getCacheKey2(args)) !== void 0;
|
|
1706
|
+
}
|
|
1707
|
+
set(args, data) {
|
|
1708
|
+
__privateGet(this, _cache3).set(getCacheKey2(args), data);
|
|
1709
|
+
}
|
|
1710
|
+
getAll(args) {
|
|
1711
|
+
if (this.has(args)) {
|
|
1712
|
+
return __privateGet(this, _cache3).get(getCacheKey2(args));
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
clearAll() {
|
|
1716
|
+
__privateGet(this, _cache3).clear();
|
|
1717
|
+
}
|
|
1718
|
+
};
|
|
1719
|
+
_emitter3 = new WeakMap();
|
|
1720
|
+
_cache3 = new WeakMap();
|
|
1721
|
+
|
|
1722
|
+
// src/preferences/preference.ts
|
|
1723
|
+
var _emitter4, _apiService, _cache4, _useCache2;
|
|
1724
|
+
var Preference = class {
|
|
1725
|
+
constructor(preference, {
|
|
1726
|
+
emitterInstance,
|
|
1727
|
+
inboxServiceInstance,
|
|
1728
|
+
cache,
|
|
1729
|
+
useCache
|
|
1730
|
+
}) {
|
|
1731
|
+
__privateAdd(this, _emitter4);
|
|
1732
|
+
__privateAdd(this, _apiService);
|
|
1733
|
+
__privateAdd(this, _cache4);
|
|
1734
|
+
__privateAdd(this, _useCache2);
|
|
1735
|
+
__privateSet(this, _emitter4, emitterInstance);
|
|
1736
|
+
__privateSet(this, _apiService, inboxServiceInstance);
|
|
1737
|
+
__privateSet(this, _cache4, cache);
|
|
1738
|
+
__privateSet(this, _useCache2, useCache);
|
|
1739
|
+
this.level = preference.level;
|
|
1740
|
+
this.enabled = preference.enabled;
|
|
1741
|
+
this.channels = preference.channels;
|
|
1742
|
+
this.workflow = preference.workflow;
|
|
1743
|
+
}
|
|
1744
|
+
update({
|
|
1745
|
+
channels,
|
|
1746
|
+
channelPreferences
|
|
1747
|
+
}) {
|
|
1748
|
+
var _a;
|
|
1749
|
+
return updatePreference({
|
|
1750
|
+
emitter: __privateGet(this, _emitter4),
|
|
1751
|
+
apiService: __privateGet(this, _apiService),
|
|
1752
|
+
cache: __privateGet(this, _cache4),
|
|
1753
|
+
useCache: __privateGet(this, _useCache2),
|
|
1754
|
+
args: {
|
|
1755
|
+
workflowId: (_a = this.workflow) == null ? void 0 : _a.id,
|
|
1756
|
+
channels: channels || channelPreferences,
|
|
1757
|
+
preference: this
|
|
1758
|
+
}
|
|
1759
|
+
});
|
|
1760
|
+
}
|
|
1761
|
+
};
|
|
1762
|
+
_emitter4 = new WeakMap();
|
|
1763
|
+
_apiService = new WeakMap();
|
|
1764
|
+
_cache4 = new WeakMap();
|
|
1765
|
+
_useCache2 = new WeakMap();
|
|
1766
|
+
|
|
1767
|
+
// src/preferences/helpers.ts
|
|
1768
|
+
var updatePreference = (_0) => __async(void 0, [_0], function* ({
|
|
1769
|
+
emitter,
|
|
1770
|
+
apiService,
|
|
1771
|
+
cache,
|
|
1772
|
+
useCache,
|
|
1773
|
+
args
|
|
1774
|
+
}) {
|
|
1775
|
+
var _a;
|
|
1776
|
+
const { channels } = args;
|
|
1777
|
+
const workflowId = "workflowId" in args ? args.workflowId : (_a = args.preference.workflow) == null ? void 0 : _a.id;
|
|
1778
|
+
try {
|
|
1779
|
+
emitter.emit("preference.update.pending", {
|
|
1780
|
+
args,
|
|
1781
|
+
data: "preference" in args ? new Preference(
|
|
1782
|
+
__spreadProps(__spreadValues({}, args.preference), {
|
|
1783
|
+
channels: __spreadValues(__spreadValues({}, args.preference.channels), channels)
|
|
1784
|
+
}),
|
|
1785
|
+
{
|
|
1786
|
+
emitterInstance: emitter,
|
|
1787
|
+
inboxServiceInstance: apiService,
|
|
1788
|
+
cache,
|
|
1789
|
+
useCache
|
|
1606
1790
|
}
|
|
1607
1791
|
) : void 0
|
|
1608
1792
|
});
|
|
@@ -1715,139 +1899,6 @@ var optimisticUpdateWorkflowPreferences = ({
|
|
|
1715
1899
|
});
|
|
1716
1900
|
};
|
|
1717
1901
|
|
|
1718
|
-
// src/preferences/preference.ts
|
|
1719
|
-
var _emitter3, _apiService, _cache3, _useCache2;
|
|
1720
|
-
var Preference = class {
|
|
1721
|
-
constructor(preference, {
|
|
1722
|
-
emitterInstance,
|
|
1723
|
-
inboxServiceInstance,
|
|
1724
|
-
cache,
|
|
1725
|
-
useCache
|
|
1726
|
-
}) {
|
|
1727
|
-
__privateAdd(this, _emitter3);
|
|
1728
|
-
__privateAdd(this, _apiService);
|
|
1729
|
-
__privateAdd(this, _cache3);
|
|
1730
|
-
__privateAdd(this, _useCache2);
|
|
1731
|
-
__privateSet(this, _emitter3, emitterInstance);
|
|
1732
|
-
__privateSet(this, _apiService, inboxServiceInstance);
|
|
1733
|
-
__privateSet(this, _cache3, cache);
|
|
1734
|
-
__privateSet(this, _useCache2, useCache);
|
|
1735
|
-
this.level = preference.level;
|
|
1736
|
-
this.enabled = preference.enabled;
|
|
1737
|
-
this.channels = preference.channels;
|
|
1738
|
-
this.workflow = preference.workflow;
|
|
1739
|
-
}
|
|
1740
|
-
update({
|
|
1741
|
-
channels,
|
|
1742
|
-
channelPreferences
|
|
1743
|
-
}) {
|
|
1744
|
-
var _a;
|
|
1745
|
-
return updatePreference({
|
|
1746
|
-
emitter: __privateGet(this, _emitter3),
|
|
1747
|
-
apiService: __privateGet(this, _apiService),
|
|
1748
|
-
cache: __privateGet(this, _cache3),
|
|
1749
|
-
useCache: __privateGet(this, _useCache2),
|
|
1750
|
-
args: {
|
|
1751
|
-
workflowId: (_a = this.workflow) == null ? void 0 : _a.id,
|
|
1752
|
-
channels: channels || channelPreferences,
|
|
1753
|
-
preference: this
|
|
1754
|
-
}
|
|
1755
|
-
});
|
|
1756
|
-
}
|
|
1757
|
-
};
|
|
1758
|
-
_emitter3 = new WeakMap();
|
|
1759
|
-
_apiService = new WeakMap();
|
|
1760
|
-
_cache3 = new WeakMap();
|
|
1761
|
-
_useCache2 = new WeakMap();
|
|
1762
|
-
|
|
1763
|
-
// src/cache/preferences-cache.ts
|
|
1764
|
-
var updateEvents2 = [
|
|
1765
|
-
"preference.update.pending",
|
|
1766
|
-
"preference.update.resolved",
|
|
1767
|
-
"preferences.bulk_update.pending",
|
|
1768
|
-
"preferences.bulk_update.resolved"
|
|
1769
|
-
];
|
|
1770
|
-
var excludeEmpty2 = ({ tags }) => Object.entries({ tags }).reduce((acc, [key, value]) => {
|
|
1771
|
-
if (value === null || value === void 0 || Array.isArray(value) && value.length === 0) {
|
|
1772
|
-
return acc;
|
|
1773
|
-
}
|
|
1774
|
-
acc[key] = value;
|
|
1775
|
-
return acc;
|
|
1776
|
-
}, {});
|
|
1777
|
-
var getCacheKey2 = ({ tags }) => {
|
|
1778
|
-
return JSON.stringify(excludeEmpty2({ tags }));
|
|
1779
|
-
};
|
|
1780
|
-
var _emitter4, _cache4;
|
|
1781
|
-
var PreferencesCache = class {
|
|
1782
|
-
constructor({ emitterInstance }) {
|
|
1783
|
-
__privateAdd(this, _emitter4);
|
|
1784
|
-
__privateAdd(this, _cache4);
|
|
1785
|
-
this.updatePreference = (key, data) => {
|
|
1786
|
-
const preferences = __privateGet(this, _cache4).get(key);
|
|
1787
|
-
if (!preferences) {
|
|
1788
|
-
return false;
|
|
1789
|
-
}
|
|
1790
|
-
const index = preferences.findIndex(
|
|
1791
|
-
(el) => {
|
|
1792
|
-
var _a, _b;
|
|
1793
|
-
return ((_a = el.workflow) == null ? void 0 : _a.id) === ((_b = data.workflow) == null ? void 0 : _b.id) || el.level === data.level && data.level === "global" /* GLOBAL */;
|
|
1794
|
-
}
|
|
1795
|
-
);
|
|
1796
|
-
if (index === -1) {
|
|
1797
|
-
return false;
|
|
1798
|
-
}
|
|
1799
|
-
const updatedPreferences = [...preferences];
|
|
1800
|
-
updatedPreferences[index] = data;
|
|
1801
|
-
__privateGet(this, _cache4).set(key, updatedPreferences);
|
|
1802
|
-
return true;
|
|
1803
|
-
};
|
|
1804
|
-
this.handlePreferenceEvent = ({ data }) => {
|
|
1805
|
-
if (!data) {
|
|
1806
|
-
return;
|
|
1807
|
-
}
|
|
1808
|
-
const preferences = Array.isArray(data) ? data : [data];
|
|
1809
|
-
const uniqueFilterKeys = /* @__PURE__ */ new Set();
|
|
1810
|
-
__privateGet(this, _cache4).keys().forEach((key) => {
|
|
1811
|
-
preferences.forEach((preference) => {
|
|
1812
|
-
const hasUpdatedPreference = this.updatePreference(key, preference);
|
|
1813
|
-
const updatedPreference = __privateGet(this, _cache4).get(key);
|
|
1814
|
-
if (!hasUpdatedPreference || !updatedPreference) {
|
|
1815
|
-
return;
|
|
1816
|
-
}
|
|
1817
|
-
uniqueFilterKeys.add(key);
|
|
1818
|
-
});
|
|
1819
|
-
});
|
|
1820
|
-
uniqueFilterKeys.forEach((key) => {
|
|
1821
|
-
var _a;
|
|
1822
|
-
__privateGet(this, _emitter4).emit("preferences.list.updated", {
|
|
1823
|
-
data: (_a = __privateGet(this, _cache4).get(key)) != null ? _a : []
|
|
1824
|
-
});
|
|
1825
|
-
});
|
|
1826
|
-
};
|
|
1827
|
-
__privateSet(this, _emitter4, emitterInstance);
|
|
1828
|
-
updateEvents2.forEach((event) => {
|
|
1829
|
-
__privateGet(this, _emitter4).on(event, this.handlePreferenceEvent);
|
|
1830
|
-
});
|
|
1831
|
-
__privateSet(this, _cache4, new InMemoryCache());
|
|
1832
|
-
}
|
|
1833
|
-
has(args) {
|
|
1834
|
-
return __privateGet(this, _cache4).get(getCacheKey2(args)) !== void 0;
|
|
1835
|
-
}
|
|
1836
|
-
set(args, data) {
|
|
1837
|
-
__privateGet(this, _cache4).set(getCacheKey2(args), data);
|
|
1838
|
-
}
|
|
1839
|
-
getAll(args) {
|
|
1840
|
-
if (this.has(args)) {
|
|
1841
|
-
return __privateGet(this, _cache4).get(getCacheKey2(args));
|
|
1842
|
-
}
|
|
1843
|
-
}
|
|
1844
|
-
clearAll() {
|
|
1845
|
-
__privateGet(this, _cache4).clear();
|
|
1846
|
-
}
|
|
1847
|
-
};
|
|
1848
|
-
_emitter4 = new WeakMap();
|
|
1849
|
-
_cache4 = new WeakMap();
|
|
1850
|
-
|
|
1851
1902
|
// src/preferences/preferences.ts
|
|
1852
1903
|
var _useCache3;
|
|
1853
1904
|
var Preferences = class extends BaseModule {
|
|
@@ -2020,12 +2071,13 @@ var Session = class {
|
|
|
2020
2071
|
_emitter5 = new WeakMap();
|
|
2021
2072
|
_inboxService2 = new WeakMap();
|
|
2022
2073
|
_options = new WeakMap();
|
|
2023
|
-
var PRODUCTION_SOCKET_URL = "
|
|
2074
|
+
var PRODUCTION_SOCKET_URL = "wss://socket.novu.co";
|
|
2024
2075
|
var NOTIFICATION_RECEIVED = "notifications.notification_received";
|
|
2025
2076
|
var UNSEEN_COUNT_CHANGED = "notifications.unseen_count_changed";
|
|
2026
2077
|
var UNREAD_COUNT_CHANGED = "notifications.unread_count_changed";
|
|
2027
2078
|
var mapToNotification = ({
|
|
2028
2079
|
_id,
|
|
2080
|
+
transactionId,
|
|
2029
2081
|
content,
|
|
2030
2082
|
read: read2,
|
|
2031
2083
|
seen: seen2,
|
|
@@ -2064,6 +2116,7 @@ var mapToNotification = ({
|
|
|
2064
2116
|
const actionStatus = (_g = cta.action) == null ? void 0 : _g.status;
|
|
2065
2117
|
return __spreadProps(__spreadValues(__spreadValues({
|
|
2066
2118
|
id: _id,
|
|
2119
|
+
transactionId,
|
|
2067
2120
|
subject,
|
|
2068
2121
|
body: content,
|
|
2069
2122
|
to,
|
|
@@ -2107,8 +2160,8 @@ var mapToNotification = ({
|
|
|
2107
2160
|
workflow
|
|
2108
2161
|
});
|
|
2109
2162
|
};
|
|
2110
|
-
var _token, _emitter6,
|
|
2111
|
-
var
|
|
2163
|
+
var _token, _emitter6, _partySocket, _socketUrl, _notificationReceived, _unseenCountChanged, _unreadCountChanged, _handleMessage, _PartySocketClient_instances, initializeSocket_fn, handleConnectSocket_fn, handleDisconnectSocket_fn;
|
|
2164
|
+
var PartySocketClient = class extends BaseModule {
|
|
2112
2165
|
constructor({
|
|
2113
2166
|
socketUrl,
|
|
2114
2167
|
inboxServiceInstance,
|
|
@@ -2118,25 +2171,62 @@ var Socket = class extends BaseModule {
|
|
|
2118
2171
|
eventEmitterInstance,
|
|
2119
2172
|
inboxServiceInstance
|
|
2120
2173
|
});
|
|
2121
|
-
__privateAdd(this,
|
|
2174
|
+
__privateAdd(this, _PartySocketClient_instances);
|
|
2122
2175
|
__privateAdd(this, _token);
|
|
2123
2176
|
__privateAdd(this, _emitter6);
|
|
2124
|
-
__privateAdd(this,
|
|
2177
|
+
__privateAdd(this, _partySocket);
|
|
2125
2178
|
__privateAdd(this, _socketUrl);
|
|
2126
|
-
__privateAdd(this, _notificationReceived, (
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2179
|
+
__privateAdd(this, _notificationReceived, (event) => {
|
|
2180
|
+
try {
|
|
2181
|
+
const data = JSON.parse(event.data);
|
|
2182
|
+
if (data.event === "notification_received" /* RECEIVED */) {
|
|
2183
|
+
__privateGet(this, _emitter6).emit(NOTIFICATION_RECEIVED, {
|
|
2184
|
+
result: new Notification(mapToNotification(data.data.message), __privateGet(this, _emitter6), this._inboxService)
|
|
2185
|
+
});
|
|
2186
|
+
}
|
|
2187
|
+
} catch (error) {
|
|
2188
|
+
console.log("error", error);
|
|
2189
|
+
}
|
|
2130
2190
|
});
|
|
2131
|
-
__privateAdd(this, _unseenCountChanged, (
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2191
|
+
__privateAdd(this, _unseenCountChanged, (event) => {
|
|
2192
|
+
try {
|
|
2193
|
+
const data = JSON.parse(event.data);
|
|
2194
|
+
if (data.event === "unseen_count_changed" /* UNSEEN */) {
|
|
2195
|
+
__privateGet(this, _emitter6).emit(UNSEEN_COUNT_CHANGED, {
|
|
2196
|
+
result: data.data.unseenCount
|
|
2197
|
+
});
|
|
2198
|
+
}
|
|
2199
|
+
} catch (error) {
|
|
2200
|
+
}
|
|
2135
2201
|
});
|
|
2136
|
-
__privateAdd(this, _unreadCountChanged, (
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2202
|
+
__privateAdd(this, _unreadCountChanged, (event) => {
|
|
2203
|
+
try {
|
|
2204
|
+
const data = JSON.parse(event.data);
|
|
2205
|
+
if (data.event === "unread_count_changed" /* UNREAD */) {
|
|
2206
|
+
__privateGet(this, _emitter6).emit(UNREAD_COUNT_CHANGED, {
|
|
2207
|
+
result: data.data.unreadCount
|
|
2208
|
+
});
|
|
2209
|
+
}
|
|
2210
|
+
} catch (error) {
|
|
2211
|
+
}
|
|
2212
|
+
});
|
|
2213
|
+
__privateAdd(this, _handleMessage, (event) => {
|
|
2214
|
+
try {
|
|
2215
|
+
const data = JSON.parse(event.data);
|
|
2216
|
+
switch (data.event) {
|
|
2217
|
+
case "notification_received" /* RECEIVED */:
|
|
2218
|
+
__privateGet(this, _notificationReceived).call(this, event);
|
|
2219
|
+
break;
|
|
2220
|
+
case "unseen_count_changed" /* UNSEEN */:
|
|
2221
|
+
__privateGet(this, _unseenCountChanged).call(this, event);
|
|
2222
|
+
break;
|
|
2223
|
+
case "unread_count_changed" /* UNREAD */:
|
|
2224
|
+
__privateGet(this, _unreadCountChanged).call(this, event);
|
|
2225
|
+
break;
|
|
2226
|
+
default:
|
|
2227
|
+
}
|
|
2228
|
+
} catch (error) {
|
|
2229
|
+
}
|
|
2140
2230
|
});
|
|
2141
2231
|
__privateSet(this, _emitter6, eventEmitterInstance);
|
|
2142
2232
|
__privateSet(this, _socketUrl, socketUrl != null ? socketUrl : PRODUCTION_SOCKET_URL);
|
|
@@ -2150,61 +2240,55 @@ var Socket = class extends BaseModule {
|
|
|
2150
2240
|
connect() {
|
|
2151
2241
|
return __async(this, null, function* () {
|
|
2152
2242
|
if (__privateGet(this, _token)) {
|
|
2153
|
-
return __privateMethod(this,
|
|
2243
|
+
return __privateMethod(this, _PartySocketClient_instances, handleConnectSocket_fn).call(this);
|
|
2154
2244
|
}
|
|
2155
|
-
return this.callWithSession(__privateMethod(this,
|
|
2245
|
+
return this.callWithSession(__privateMethod(this, _PartySocketClient_instances, handleConnectSocket_fn).bind(this));
|
|
2156
2246
|
});
|
|
2157
2247
|
}
|
|
2158
2248
|
disconnect() {
|
|
2159
2249
|
return __async(this, null, function* () {
|
|
2160
|
-
if (__privateGet(this,
|
|
2161
|
-
return __privateMethod(this,
|
|
2250
|
+
if (__privateGet(this, _partySocket)) {
|
|
2251
|
+
return __privateMethod(this, _PartySocketClient_instances, handleDisconnectSocket_fn).call(this);
|
|
2162
2252
|
}
|
|
2163
|
-
return this.callWithSession(__privateMethod(this,
|
|
2253
|
+
return this.callWithSession(__privateMethod(this, _PartySocketClient_instances, handleDisconnectSocket_fn).bind(this));
|
|
2164
2254
|
});
|
|
2165
2255
|
}
|
|
2166
2256
|
};
|
|
2167
2257
|
_token = new WeakMap();
|
|
2168
2258
|
_emitter6 = new WeakMap();
|
|
2169
|
-
|
|
2259
|
+
_partySocket = new WeakMap();
|
|
2170
2260
|
_socketUrl = new WeakMap();
|
|
2171
2261
|
_notificationReceived = new WeakMap();
|
|
2172
2262
|
_unseenCountChanged = new WeakMap();
|
|
2173
2263
|
_unreadCountChanged = new WeakMap();
|
|
2174
|
-
|
|
2264
|
+
_handleMessage = new WeakMap();
|
|
2265
|
+
_PartySocketClient_instances = new WeakSet();
|
|
2175
2266
|
initializeSocket_fn = function() {
|
|
2176
2267
|
return __async(this, null, function* () {
|
|
2177
|
-
|
|
2178
|
-
if (!!__privateGet(this, _socketIo)) {
|
|
2268
|
+
if (__privateGet(this, _partySocket)) {
|
|
2179
2269
|
return;
|
|
2180
2270
|
}
|
|
2181
2271
|
const args = { socketUrl: __privateGet(this, _socketUrl) };
|
|
2182
2272
|
__privateGet(this, _emitter6).emit("socket.connect.pending", { args });
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
token: `${__privateGet(this, _token)}`
|
|
2188
|
-
}
|
|
2189
|
-
}));
|
|
2190
|
-
__privateGet(this, _socketIo).on("connect", () => {
|
|
2273
|
+
const url = new URL(__privateGet(this, _socketUrl));
|
|
2274
|
+
url.searchParams.set("token", __privateGet(this, _token));
|
|
2275
|
+
__privateSet(this, _partySocket, new WebSocket(url.toString()));
|
|
2276
|
+
__privateGet(this, _partySocket).addEventListener("open", () => {
|
|
2191
2277
|
__privateGet(this, _emitter6).emit("socket.connect.resolved", { args });
|
|
2192
2278
|
});
|
|
2193
|
-
__privateGet(this,
|
|
2279
|
+
__privateGet(this, _partySocket).addEventListener("error", (error) => {
|
|
2194
2280
|
__privateGet(this, _emitter6).emit("socket.connect.resolved", { args, error });
|
|
2195
2281
|
});
|
|
2196
|
-
|
|
2197
|
-
(_b = __privateGet(this, _socketIo)) == null ? void 0 : _b.on("unseen_count_changed" /* UNSEEN */, __privateGet(this, _unseenCountChanged));
|
|
2198
|
-
(_c = __privateGet(this, _socketIo)) == null ? void 0 : _c.on("unread_count_changed" /* UNREAD */, __privateGet(this, _unreadCountChanged));
|
|
2282
|
+
__privateGet(this, _partySocket).addEventListener("message", __privateGet(this, _handleMessage));
|
|
2199
2283
|
});
|
|
2200
2284
|
};
|
|
2201
2285
|
handleConnectSocket_fn = function() {
|
|
2202
2286
|
return __async(this, null, function* () {
|
|
2203
2287
|
try {
|
|
2204
|
-
yield __privateMethod(this,
|
|
2288
|
+
yield __privateMethod(this, _PartySocketClient_instances, initializeSocket_fn).call(this);
|
|
2205
2289
|
return {};
|
|
2206
2290
|
} catch (error) {
|
|
2207
|
-
return { error: new NovuError("Failed to initialize the
|
|
2291
|
+
return { error: new NovuError("Failed to initialize the PartySocket", error) };
|
|
2208
2292
|
}
|
|
2209
2293
|
});
|
|
2210
2294
|
};
|
|
@@ -2212,20 +2296,21 @@ handleDisconnectSocket_fn = function() {
|
|
|
2212
2296
|
return __async(this, null, function* () {
|
|
2213
2297
|
var _a;
|
|
2214
2298
|
try {
|
|
2215
|
-
(_a = __privateGet(this,
|
|
2216
|
-
__privateSet(this,
|
|
2299
|
+
(_a = __privateGet(this, _partySocket)) == null ? void 0 : _a.close();
|
|
2300
|
+
__privateSet(this, _partySocket, void 0);
|
|
2217
2301
|
return {};
|
|
2218
2302
|
} catch (error) {
|
|
2219
|
-
return { error: new NovuError("Failed to disconnect from the
|
|
2303
|
+
return { error: new NovuError("Failed to disconnect from the PartySocket", error) };
|
|
2220
2304
|
}
|
|
2221
2305
|
});
|
|
2222
2306
|
};
|
|
2223
|
-
var PRODUCTION_SOCKET_URL2 = "
|
|
2307
|
+
var PRODUCTION_SOCKET_URL2 = "https://ws.novu.co";
|
|
2224
2308
|
var NOTIFICATION_RECEIVED2 = "notifications.notification_received";
|
|
2225
2309
|
var UNSEEN_COUNT_CHANGED2 = "notifications.unseen_count_changed";
|
|
2226
2310
|
var UNREAD_COUNT_CHANGED2 = "notifications.unread_count_changed";
|
|
2227
2311
|
var mapToNotification2 = ({
|
|
2228
2312
|
_id,
|
|
2313
|
+
transactionId,
|
|
2229
2314
|
content,
|
|
2230
2315
|
read: read2,
|
|
2231
2316
|
seen: seen2,
|
|
@@ -2264,6 +2349,7 @@ var mapToNotification2 = ({
|
|
|
2264
2349
|
const actionStatus = (_g = cta.action) == null ? void 0 : _g.status;
|
|
2265
2350
|
return __spreadProps(__spreadValues(__spreadValues({
|
|
2266
2351
|
id: _id,
|
|
2352
|
+
transactionId,
|
|
2267
2353
|
subject,
|
|
2268
2354
|
body: content,
|
|
2269
2355
|
to,
|
|
@@ -2307,8 +2393,8 @@ var mapToNotification2 = ({
|
|
|
2307
2393
|
workflow
|
|
2308
2394
|
});
|
|
2309
2395
|
};
|
|
2310
|
-
var _token2, _emitter7,
|
|
2311
|
-
var
|
|
2396
|
+
var _token2, _emitter7, _socketIo, _socketUrl2, _notificationReceived2, _unseenCountChanged2, _unreadCountChanged2, _Socket_instances, initializeSocket_fn2, handleConnectSocket_fn2, handleDisconnectSocket_fn2;
|
|
2397
|
+
var Socket = class extends BaseModule {
|
|
2312
2398
|
constructor({
|
|
2313
2399
|
socketUrl,
|
|
2314
2400
|
inboxServiceInstance,
|
|
@@ -2318,62 +2404,25 @@ var PartySocketClient = class extends BaseModule {
|
|
|
2318
2404
|
eventEmitterInstance,
|
|
2319
2405
|
inboxServiceInstance
|
|
2320
2406
|
});
|
|
2321
|
-
__privateAdd(this,
|
|
2407
|
+
__privateAdd(this, _Socket_instances);
|
|
2322
2408
|
__privateAdd(this, _token2);
|
|
2323
2409
|
__privateAdd(this, _emitter7);
|
|
2324
|
-
__privateAdd(this,
|
|
2410
|
+
__privateAdd(this, _socketIo);
|
|
2325
2411
|
__privateAdd(this, _socketUrl2);
|
|
2326
|
-
__privateAdd(this, _notificationReceived2, (
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
__privateGet(this, _emitter7).emit(NOTIFICATION_RECEIVED2, {
|
|
2331
|
-
result: new Notification(mapToNotification2(data.data.message), __privateGet(this, _emitter7), this._inboxService)
|
|
2332
|
-
});
|
|
2333
|
-
}
|
|
2334
|
-
} catch (error) {
|
|
2335
|
-
console.log("error", error);
|
|
2336
|
-
}
|
|
2337
|
-
});
|
|
2338
|
-
__privateAdd(this, _unseenCountChanged2, (event) => {
|
|
2339
|
-
try {
|
|
2340
|
-
const data = JSON.parse(event.data);
|
|
2341
|
-
if (data.event === "unseen_count_changed" /* UNSEEN */) {
|
|
2342
|
-
__privateGet(this, _emitter7).emit(UNSEEN_COUNT_CHANGED2, {
|
|
2343
|
-
result: data.data.unseenCount
|
|
2344
|
-
});
|
|
2345
|
-
}
|
|
2346
|
-
} catch (error) {
|
|
2347
|
-
}
|
|
2412
|
+
__privateAdd(this, _notificationReceived2, ({ message }) => {
|
|
2413
|
+
__privateGet(this, _emitter7).emit(NOTIFICATION_RECEIVED2, {
|
|
2414
|
+
result: new Notification(mapToNotification2(message), __privateGet(this, _emitter7), this._inboxService)
|
|
2415
|
+
});
|
|
2348
2416
|
});
|
|
2349
|
-
__privateAdd(this,
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
__privateGet(this, _emitter7).emit(UNREAD_COUNT_CHANGED2, {
|
|
2354
|
-
result: data.data.unreadCount
|
|
2355
|
-
});
|
|
2356
|
-
}
|
|
2357
|
-
} catch (error) {
|
|
2358
|
-
}
|
|
2417
|
+
__privateAdd(this, _unseenCountChanged2, ({ unseenCount }) => {
|
|
2418
|
+
__privateGet(this, _emitter7).emit(UNSEEN_COUNT_CHANGED2, {
|
|
2419
|
+
result: unseenCount
|
|
2420
|
+
});
|
|
2359
2421
|
});
|
|
2360
|
-
__privateAdd(this,
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
case "notification_received" /* RECEIVED */:
|
|
2365
|
-
__privateGet(this, _notificationReceived2).call(this, event);
|
|
2366
|
-
break;
|
|
2367
|
-
case "unseen_count_changed" /* UNSEEN */:
|
|
2368
|
-
__privateGet(this, _unseenCountChanged2).call(this, event);
|
|
2369
|
-
break;
|
|
2370
|
-
case "unread_count_changed" /* UNREAD */:
|
|
2371
|
-
__privateGet(this, _unreadCountChanged2).call(this, event);
|
|
2372
|
-
break;
|
|
2373
|
-
default:
|
|
2374
|
-
}
|
|
2375
|
-
} catch (error) {
|
|
2376
|
-
}
|
|
2422
|
+
__privateAdd(this, _unreadCountChanged2, ({ unreadCount }) => {
|
|
2423
|
+
__privateGet(this, _emitter7).emit(UNREAD_COUNT_CHANGED2, {
|
|
2424
|
+
result: unreadCount
|
|
2425
|
+
});
|
|
2377
2426
|
});
|
|
2378
2427
|
__privateSet(this, _emitter7, eventEmitterInstance);
|
|
2379
2428
|
__privateSet(this, _socketUrl2, socketUrl != null ? socketUrl : PRODUCTION_SOCKET_URL2);
|
|
@@ -2387,55 +2436,61 @@ var PartySocketClient = class extends BaseModule {
|
|
|
2387
2436
|
connect() {
|
|
2388
2437
|
return __async(this, null, function* () {
|
|
2389
2438
|
if (__privateGet(this, _token2)) {
|
|
2390
|
-
return __privateMethod(this,
|
|
2439
|
+
return __privateMethod(this, _Socket_instances, handleConnectSocket_fn2).call(this);
|
|
2391
2440
|
}
|
|
2392
|
-
return this.callWithSession(__privateMethod(this,
|
|
2441
|
+
return this.callWithSession(__privateMethod(this, _Socket_instances, handleConnectSocket_fn2).bind(this));
|
|
2393
2442
|
});
|
|
2394
2443
|
}
|
|
2395
2444
|
disconnect() {
|
|
2396
2445
|
return __async(this, null, function* () {
|
|
2397
|
-
if (__privateGet(this,
|
|
2398
|
-
return __privateMethod(this,
|
|
2446
|
+
if (__privateGet(this, _socketIo)) {
|
|
2447
|
+
return __privateMethod(this, _Socket_instances, handleDisconnectSocket_fn2).call(this);
|
|
2399
2448
|
}
|
|
2400
|
-
return this.callWithSession(__privateMethod(this,
|
|
2449
|
+
return this.callWithSession(__privateMethod(this, _Socket_instances, handleDisconnectSocket_fn2).bind(this));
|
|
2401
2450
|
});
|
|
2402
2451
|
}
|
|
2403
2452
|
};
|
|
2404
2453
|
_token2 = new WeakMap();
|
|
2405
2454
|
_emitter7 = new WeakMap();
|
|
2406
|
-
|
|
2455
|
+
_socketIo = new WeakMap();
|
|
2407
2456
|
_socketUrl2 = new WeakMap();
|
|
2408
2457
|
_notificationReceived2 = new WeakMap();
|
|
2409
2458
|
_unseenCountChanged2 = new WeakMap();
|
|
2410
2459
|
_unreadCountChanged2 = new WeakMap();
|
|
2411
|
-
|
|
2412
|
-
_PartySocketClient_instances = new WeakSet();
|
|
2460
|
+
_Socket_instances = new WeakSet();
|
|
2413
2461
|
initializeSocket_fn2 = function() {
|
|
2414
2462
|
return __async(this, null, function* () {
|
|
2415
|
-
|
|
2463
|
+
var _a, _b, _c;
|
|
2464
|
+
if (__privateGet(this, _socketIo)) {
|
|
2416
2465
|
return;
|
|
2417
2466
|
}
|
|
2418
2467
|
const args = { socketUrl: __privateGet(this, _socketUrl2) };
|
|
2419
2468
|
__privateGet(this, _emitter7).emit("socket.connect.pending", { args });
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2469
|
+
__privateSet(this, _socketIo, io(__privateGet(this, _socketUrl2), {
|
|
2470
|
+
reconnectionDelayMax: 1e4,
|
|
2471
|
+
transports: ["websocket"],
|
|
2472
|
+
query: {
|
|
2473
|
+
token: `${__privateGet(this, _token2)}`
|
|
2474
|
+
}
|
|
2475
|
+
}));
|
|
2476
|
+
__privateGet(this, _socketIo).on("connect", () => {
|
|
2424
2477
|
__privateGet(this, _emitter7).emit("socket.connect.resolved", { args });
|
|
2425
2478
|
});
|
|
2426
|
-
__privateGet(this,
|
|
2479
|
+
__privateGet(this, _socketIo).on("connect_error", (error) => {
|
|
2427
2480
|
__privateGet(this, _emitter7).emit("socket.connect.resolved", { args, error });
|
|
2428
2481
|
});
|
|
2429
|
-
__privateGet(this,
|
|
2482
|
+
(_a = __privateGet(this, _socketIo)) == null ? void 0 : _a.on("notification_received" /* RECEIVED */, __privateGet(this, _notificationReceived2));
|
|
2483
|
+
(_b = __privateGet(this, _socketIo)) == null ? void 0 : _b.on("unseen_count_changed" /* UNSEEN */, __privateGet(this, _unseenCountChanged2));
|
|
2484
|
+
(_c = __privateGet(this, _socketIo)) == null ? void 0 : _c.on("unread_count_changed" /* UNREAD */, __privateGet(this, _unreadCountChanged2));
|
|
2430
2485
|
});
|
|
2431
2486
|
};
|
|
2432
2487
|
handleConnectSocket_fn2 = function() {
|
|
2433
2488
|
return __async(this, null, function* () {
|
|
2434
2489
|
try {
|
|
2435
|
-
yield __privateMethod(this,
|
|
2490
|
+
yield __privateMethod(this, _Socket_instances, initializeSocket_fn2).call(this);
|
|
2436
2491
|
return {};
|
|
2437
2492
|
} catch (error) {
|
|
2438
|
-
return { error: new NovuError("Failed to initialize the
|
|
2493
|
+
return { error: new NovuError("Failed to initialize the socket", error) };
|
|
2439
2494
|
}
|
|
2440
2495
|
});
|
|
2441
2496
|
};
|
|
@@ -2443,11 +2498,11 @@ handleDisconnectSocket_fn2 = function() {
|
|
|
2443
2498
|
return __async(this, null, function* () {
|
|
2444
2499
|
var _a;
|
|
2445
2500
|
try {
|
|
2446
|
-
(_a = __privateGet(this,
|
|
2447
|
-
__privateSet(this,
|
|
2501
|
+
(_a = __privateGet(this, _socketIo)) == null ? void 0 : _a.disconnect();
|
|
2502
|
+
__privateSet(this, _socketIo, void 0);
|
|
2448
2503
|
return {};
|
|
2449
2504
|
} catch (error) {
|
|
2450
|
-
return { error: new NovuError("Failed to disconnect from the
|
|
2505
|
+
return { error: new NovuError("Failed to disconnect from the socket", error) };
|
|
2451
2506
|
}
|
|
2452
2507
|
});
|
|
2453
2508
|
};
|
|
@@ -2455,17 +2510,17 @@ handleDisconnectSocket_fn2 = function() {
|
|
|
2455
2510
|
// src/ws/socket-factory.ts
|
|
2456
2511
|
var PARTY_SOCKET_URLS = [
|
|
2457
2512
|
"wss://eu.socket.novu.co",
|
|
2458
|
-
|
|
2513
|
+
PRODUCTION_SOCKET_URL,
|
|
2459
2514
|
"wss://socket.novu-staging.co",
|
|
2460
2515
|
"wss://socket-worker-local.cli-shortener.workers.dev"
|
|
2461
2516
|
];
|
|
2462
2517
|
var URL_TRANSFORMATIONS = {
|
|
2463
2518
|
"https://eu.ws.novu.co": "wss://eu.socket.novu.co",
|
|
2464
|
-
"https://ws.novu.co":
|
|
2519
|
+
"https://ws.novu.co": PRODUCTION_SOCKET_URL,
|
|
2465
2520
|
"https://dev.ws.novu.co": "wss://socket.novu-staging.co"
|
|
2466
2521
|
};
|
|
2467
2522
|
function transformSocketUrl(socketUrl) {
|
|
2468
|
-
if (!socketUrl) return
|
|
2523
|
+
if (!socketUrl) return PRODUCTION_SOCKET_URL;
|
|
2469
2524
|
return URL_TRANSFORMATIONS[socketUrl] || socketUrl;
|
|
2470
2525
|
}
|
|
2471
2526
|
function shouldUsePartySocket(socketUrl) {
|
|
@@ -2566,4 +2621,4 @@ _emitter8 = new WeakMap();
|
|
|
2566
2621
|
_session = new WeakMap();
|
|
2567
2622
|
_inboxService3 = new WeakMap();
|
|
2568
2623
|
|
|
2569
|
-
export { ChannelType, DEFAULT_API_VERSION, NotificationStatus, Novu, PreferenceLevel, WebSocketEvent, areTagsEqual, isBrowser, isSameFilter };
|
|
2624
|
+
export { ChannelType, DEFAULT_API_VERSION, NotificationStatus, Novu, PreferenceLevel, WebSocketEvent, areTagsEqual, checkNotificationDataFilter, checkNotificationMatchesFilter, checkNotificationTagFilter, isBrowser, isSameFilter };
|