@novu/js 3.12.0 → 3.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{chunk-XGEYPCN4.js → chunk-BDYEMGVY.js} +66 -53
- package/dist/cjs/{chunk-X5BLMMWE.js → chunk-CCAUG7YI.js} +10 -2
- package/dist/cjs/index.d.ts +3 -3
- package/dist/cjs/index.js +17 -17
- package/dist/cjs/internal/index.d.ts +3 -2
- package/dist/cjs/internal/index.js +6 -6
- package/dist/{esm/novu-zLkOK2Fj.d.mts → cjs/novu-D_YIntb9.d.ts} +3 -2
- package/dist/{esm/novu-event-emitter-DX_OWiCd.d.mts → cjs/novu-event-emitter-BFZmnC3B.d.ts} +3 -0
- package/dist/cjs/themes/index.d.ts +3 -3
- package/dist/cjs/{types-BV1NrRha.d.ts → types-BxUhsMdy.d.ts} +2 -2
- package/dist/cjs/ui/index.d.ts +5 -5
- package/dist/cjs/ui/index.js +18 -12
- package/dist/esm/{chunk-JZN3ZGEY.mjs → chunk-QFTC4N7O.mjs} +20 -7
- package/dist/esm/{chunk-3RXG4I3K.mjs → chunk-W4JUMCRN.mjs} +10 -2
- package/dist/esm/index.d.mts +3 -3
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/internal/index.d.mts +3 -2
- package/dist/esm/internal/index.mjs +1 -1
- package/dist/{cjs/novu-CR_rdPby.d.ts → esm/novu-Dnzb16Le.d.mts} +3 -2
- package/dist/{cjs/novu-event-emitter-DX_OWiCd.d.ts → esm/novu-event-emitter-BFZmnC3B.d.mts} +3 -0
- package/dist/esm/themes/index.d.mts +3 -3
- package/dist/esm/{types-N9H5yP7c.d.mts → types-DxJq-5Sy.d.mts} +2 -2
- package/dist/esm/ui/index.d.mts +5 -5
- package/dist/esm/ui/index.mjs +10 -4
- package/dist/novu.min.js +12 -12
- package/dist/novu.min.js.gz +0 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkCCAUG7YI_js = require('./chunk-CCAUG7YI.js');
|
|
4
4
|
var chunk7B52C2XE_js = require('./chunk-7B52C2XE.js');
|
|
5
5
|
var mitt = require('mitt');
|
|
6
6
|
require('event-target-polyfill');
|
|
@@ -139,7 +139,7 @@ var TopicSubscription = class {
|
|
|
139
139
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
140
140
|
if (chunk7B52C2XE_js.__privateGet(this, _isStale)) {
|
|
141
141
|
return {
|
|
142
|
-
error: new
|
|
142
|
+
error: new chunkCCAUG7YI_js.NovuError("Cannot update a deleted subscription", new Error("Subscription is stale"))
|
|
143
143
|
};
|
|
144
144
|
}
|
|
145
145
|
return updateSubscriptionPreference({
|
|
@@ -155,7 +155,7 @@ var TopicSubscription = class {
|
|
|
155
155
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
156
156
|
if (chunk7B52C2XE_js.__privateGet(this, _isStale)) {
|
|
157
157
|
return {
|
|
158
|
-
error: new
|
|
158
|
+
error: new chunkCCAUG7YI_js.NovuError("Cannot bulk update a deleted subscription", new Error("Subscription is stale"))
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
161
|
return bulkUpdateSubscriptionPreference({
|
|
@@ -171,7 +171,7 @@ var TopicSubscription = class {
|
|
|
171
171
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
172
172
|
if (chunk7B52C2XE_js.__privateGet(this, _isStale)) {
|
|
173
173
|
return {
|
|
174
|
-
error: new
|
|
174
|
+
error: new chunkCCAUG7YI_js.NovuError("Cannot delete an already deleted subscription", new Error("Subscription is stale"))
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
177
|
return deleteSubscription({
|
|
@@ -214,7 +214,7 @@ var listSubscriptions = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function*
|
|
|
214
214
|
return { data };
|
|
215
215
|
} catch (error) {
|
|
216
216
|
emitter.emit("subscriptions.list.resolved", { args, error });
|
|
217
|
-
return { error: new
|
|
217
|
+
return { error: new chunkCCAUG7YI_js.NovuError("Failed to fetch subscriptions", error) };
|
|
218
218
|
}
|
|
219
219
|
});
|
|
220
220
|
var getSubscription = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
@@ -244,7 +244,7 @@ var getSubscription = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* (
|
|
|
244
244
|
return { data };
|
|
245
245
|
} catch (error) {
|
|
246
246
|
emitter.emit("subscription.get.resolved", { args, error });
|
|
247
|
-
return { error: new
|
|
247
|
+
return { error: new chunkCCAUG7YI_js.NovuError("Failed to fetch subscription", error) };
|
|
248
248
|
}
|
|
249
249
|
});
|
|
250
250
|
var createSubscription = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
@@ -275,7 +275,7 @@ var createSubscription = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function
|
|
|
275
275
|
return { data: subscription };
|
|
276
276
|
} catch (error) {
|
|
277
277
|
emitter.emit("subscription.create.resolved", { args, error });
|
|
278
|
-
return { error: new
|
|
278
|
+
return { error: new chunkCCAUG7YI_js.NovuError("Failed to create subscription", error) };
|
|
279
279
|
}
|
|
280
280
|
});
|
|
281
281
|
var updateSubscription = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
@@ -302,7 +302,7 @@ var updateSubscription = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function
|
|
|
302
302
|
return { data: updatedSubscription };
|
|
303
303
|
} catch (error) {
|
|
304
304
|
emitter.emit("subscription.update.resolved", { args, error });
|
|
305
|
-
return { error: new
|
|
305
|
+
return { error: new chunkCCAUG7YI_js.NovuError("Failed to update subscription", error) };
|
|
306
306
|
}
|
|
307
307
|
});
|
|
308
308
|
var updateSubscriptionPreference = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
@@ -341,7 +341,7 @@ var updateSubscriptionPreference = (_0) => chunk7B52C2XE_js.__async(void 0, [_0]
|
|
|
341
341
|
return { data: updatedSubscription };
|
|
342
342
|
} catch (error) {
|
|
343
343
|
emitter.emit("subscription.preference.update.resolved", { args, error });
|
|
344
|
-
return { error: new
|
|
344
|
+
return { error: new chunkCCAUG7YI_js.NovuError("Failed to update subscription", error) };
|
|
345
345
|
}
|
|
346
346
|
});
|
|
347
347
|
var bulkUpdateSubscriptionPreference = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
@@ -378,7 +378,7 @@ var bulkUpdateSubscriptionPreference = (_0) => chunk7B52C2XE_js.__async(void 0,
|
|
|
378
378
|
return { data: preferences };
|
|
379
379
|
} catch (error) {
|
|
380
380
|
emitter.emit("subscription.preferences.bulk_update.resolved", { args, error });
|
|
381
|
-
return { error: new
|
|
381
|
+
return { error: new chunkCCAUG7YI_js.NovuError("Failed to bulk update subscription preferences", error) };
|
|
382
382
|
}
|
|
383
383
|
});
|
|
384
384
|
var deleteSubscription = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
@@ -395,7 +395,7 @@ var deleteSubscription = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function
|
|
|
395
395
|
return { data: void 0 };
|
|
396
396
|
} catch (error) {
|
|
397
397
|
emitter.emit("subscription.delete.resolved", { args, error });
|
|
398
|
-
return { error: new
|
|
398
|
+
return { error: new chunkCCAUG7YI_js.NovuError("Failed to delete subscription", error) };
|
|
399
399
|
}
|
|
400
400
|
});
|
|
401
401
|
|
|
@@ -462,7 +462,7 @@ var BaseModule = class {
|
|
|
462
462
|
this.onSessionError(error);
|
|
463
463
|
chunk7B52C2XE_js.__privateSet(this, _sessionError, error);
|
|
464
464
|
chunk7B52C2XE_js.__privateGet(this, _callsQueue).forEach(({ resolve }) => {
|
|
465
|
-
resolve({ error: new
|
|
465
|
+
resolve({ error: new chunkCCAUG7YI_js.NovuError("Failed to initialize session, please contact the support", error) });
|
|
466
466
|
});
|
|
467
467
|
chunk7B52C2XE_js.__privateSet(this, _callsQueue, []);
|
|
468
468
|
}
|
|
@@ -479,7 +479,7 @@ var BaseModule = class {
|
|
|
479
479
|
}
|
|
480
480
|
if (chunk7B52C2XE_js.__privateGet(this, _sessionError)) {
|
|
481
481
|
return Promise.resolve({
|
|
482
|
-
error: new
|
|
482
|
+
error: new chunkCCAUG7YI_js.NovuError("Failed to initialize session, please contact the support", chunk7B52C2XE_js.__privateGet(this, _sessionError))
|
|
483
483
|
});
|
|
484
484
|
}
|
|
485
485
|
return new Promise((resolve, reject) => {
|
|
@@ -772,13 +772,14 @@ _itemCache = new WeakMap();
|
|
|
772
772
|
_inboxService3 = new WeakMap();
|
|
773
773
|
|
|
774
774
|
// src/subscriptions/subscriptions.ts
|
|
775
|
-
var _useCache4, _subscriber;
|
|
775
|
+
var _useCache4, _subscriber, _contextKey;
|
|
776
776
|
var Subscriptions = class extends BaseModule {
|
|
777
777
|
constructor({
|
|
778
778
|
useCache,
|
|
779
779
|
inboxServiceInstance,
|
|
780
780
|
eventEmitterInstance,
|
|
781
|
-
subscriber
|
|
781
|
+
subscriber,
|
|
782
|
+
contextKey
|
|
782
783
|
}) {
|
|
783
784
|
super({
|
|
784
785
|
eventEmitterInstance,
|
|
@@ -786,6 +787,7 @@ var Subscriptions = class extends BaseModule {
|
|
|
786
787
|
});
|
|
787
788
|
chunk7B52C2XE_js.__privateAdd(this, _useCache4);
|
|
788
789
|
chunk7B52C2XE_js.__privateAdd(this, _subscriber);
|
|
790
|
+
chunk7B52C2XE_js.__privateAdd(this, _contextKey);
|
|
789
791
|
this.cache = new SubscriptionsCache({
|
|
790
792
|
emitterInstance: this._emitter,
|
|
791
793
|
inboxServiceInstance: this._inboxService,
|
|
@@ -793,6 +795,7 @@ var Subscriptions = class extends BaseModule {
|
|
|
793
795
|
});
|
|
794
796
|
chunk7B52C2XE_js.__privateSet(this, _useCache4, useCache);
|
|
795
797
|
chunk7B52C2XE_js.__privateSet(this, _subscriber, subscriber);
|
|
798
|
+
chunk7B52C2XE_js.__privateSet(this, _contextKey, contextKey);
|
|
796
799
|
}
|
|
797
800
|
list(args, options) {
|
|
798
801
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
@@ -825,7 +828,11 @@ var Subscriptions = class extends BaseModule {
|
|
|
825
828
|
useCache: (_a = options == null ? void 0 : options.useCache) != null ? _a : chunk7B52C2XE_js.__privateGet(this, _useCache4)
|
|
826
829
|
}),
|
|
827
830
|
args: chunk7B52C2XE_js.__spreadProps(chunk7B52C2XE_js.__spreadValues({}, args), {
|
|
828
|
-
identifier: (_b = args.identifier) != null ? _b :
|
|
831
|
+
identifier: (_b = args.identifier) != null ? _b : chunkCCAUG7YI_js.buildSubscriptionIdentifier({
|
|
832
|
+
topicKey: args.topicKey,
|
|
833
|
+
subscriberId: chunk7B52C2XE_js.__privateGet(this, _subscriber).subscriberId,
|
|
834
|
+
contextKey: chunk7B52C2XE_js.__privateGet(this, _contextKey)
|
|
835
|
+
})
|
|
829
836
|
})
|
|
830
837
|
});
|
|
831
838
|
}
|
|
@@ -872,10 +879,11 @@ var Subscriptions = class extends BaseModule {
|
|
|
872
879
|
};
|
|
873
880
|
_useCache4 = new WeakMap();
|
|
874
881
|
_subscriber = new WeakMap();
|
|
882
|
+
_contextKey = new WeakMap();
|
|
875
883
|
|
|
876
884
|
// src/api/http-client.ts
|
|
877
885
|
var DEFAULT_API_VERSION = "v1";
|
|
878
|
-
var
|
|
886
|
+
var DEFAULT_CLIENT_VERSION = `${"@novu/js"}@${"3.13.0"}`;
|
|
879
887
|
var HttpClient = class {
|
|
880
888
|
constructor(options = {}) {
|
|
881
889
|
// Environment variable for local development that overrides the default API endpoint without affecting the Inbox DX
|
|
@@ -883,13 +891,14 @@ var HttpClient = class {
|
|
|
883
891
|
const {
|
|
884
892
|
apiVersion = DEFAULT_API_VERSION,
|
|
885
893
|
apiUrl = this.DEFAULT_BACKEND_URL,
|
|
886
|
-
userAgent =
|
|
894
|
+
userAgent = DEFAULT_CLIENT_VERSION,
|
|
887
895
|
headers = {}
|
|
888
896
|
} = options || {};
|
|
889
897
|
this.apiVersion = apiVersion;
|
|
890
898
|
this.apiUrl = `${apiUrl}/${apiVersion}`;
|
|
891
899
|
this.headers = chunk7B52C2XE_js.__spreadValues({
|
|
892
900
|
"Novu-API-Version": "2024-06-26",
|
|
901
|
+
"Novu-Client-Version": DEFAULT_CLIENT_VERSION,
|
|
893
902
|
"Content-Type": "application/json",
|
|
894
903
|
"User-Agent": userAgent
|
|
895
904
|
}, headers);
|
|
@@ -970,7 +979,9 @@ var HttpClient = class {
|
|
|
970
979
|
const response = yield fetch(fullUrl, reqInit);
|
|
971
980
|
if (!response.ok) {
|
|
972
981
|
const errorData = yield response.json();
|
|
973
|
-
throw new Error(
|
|
982
|
+
throw new Error(
|
|
983
|
+
`${this.headers["Novu-Client-Version"]} error. Status: ${response.status}, Message: ${errorData.message}`
|
|
984
|
+
);
|
|
974
985
|
}
|
|
975
986
|
if (response.status === 204) {
|
|
976
987
|
return void 0;
|
|
@@ -1495,7 +1506,7 @@ var NotificationsCache = class {
|
|
|
1495
1506
|
filter: getFilter(cacheKey),
|
|
1496
1507
|
notifications: []
|
|
1497
1508
|
};
|
|
1498
|
-
const notificationInstance =
|
|
1509
|
+
const notificationInstance = chunkCCAUG7YI_js.createNotification({
|
|
1499
1510
|
notification: chunk7B52C2XE_js.__spreadValues({}, notification),
|
|
1500
1511
|
emitter: chunk7B52C2XE_js.__privateGet(this, _emitter4),
|
|
1501
1512
|
inboxService: chunk7B52C2XE_js.__privateGet(this, _inboxService4)
|
|
@@ -1600,7 +1611,7 @@ var Notifications = class extends BaseModule {
|
|
|
1600
1611
|
data = {
|
|
1601
1612
|
hasMore: response.hasMore,
|
|
1602
1613
|
filter: response.filter,
|
|
1603
|
-
notifications: response.data.map((el) => new
|
|
1614
|
+
notifications: response.data.map((el) => new chunkCCAUG7YI_js.Notification(el, this._emitter, this._inboxService))
|
|
1604
1615
|
};
|
|
1605
1616
|
if (shouldUseCache) {
|
|
1606
1617
|
this.cache.set(args, data);
|
|
@@ -1611,7 +1622,7 @@ var Notifications = class extends BaseModule {
|
|
|
1611
1622
|
return { data };
|
|
1612
1623
|
} catch (error) {
|
|
1613
1624
|
this._emitter.emit("notifications.list.resolved", { args, error });
|
|
1614
|
-
return { error: new
|
|
1625
|
+
return { error: new chunkCCAUG7YI_js.NovuError("Failed to fetch notifications", error) };
|
|
1615
1626
|
}
|
|
1616
1627
|
}));
|
|
1617
1628
|
});
|
|
@@ -1633,7 +1644,7 @@ var Notifications = class extends BaseModule {
|
|
|
1633
1644
|
return { data };
|
|
1634
1645
|
} catch (error) {
|
|
1635
1646
|
this._emitter.emit("notifications.count.resolved", { args, error });
|
|
1636
|
-
return { error: new
|
|
1647
|
+
return { error: new chunkCCAUG7YI_js.NovuError("Failed to count notifications", error) };
|
|
1637
1648
|
}
|
|
1638
1649
|
}));
|
|
1639
1650
|
});
|
|
@@ -1642,7 +1653,7 @@ var Notifications = class extends BaseModule {
|
|
|
1642
1653
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1643
1654
|
return this.callWithSession(
|
|
1644
1655
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1645
|
-
return
|
|
1656
|
+
return chunkCCAUG7YI_js.read({
|
|
1646
1657
|
emitter: this._emitter,
|
|
1647
1658
|
apiService: this._inboxService,
|
|
1648
1659
|
args
|
|
@@ -1655,7 +1666,7 @@ var Notifications = class extends BaseModule {
|
|
|
1655
1666
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1656
1667
|
return this.callWithSession(
|
|
1657
1668
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1658
|
-
return
|
|
1669
|
+
return chunkCCAUG7YI_js.unread({
|
|
1659
1670
|
emitter: this._emitter,
|
|
1660
1671
|
apiService: this._inboxService,
|
|
1661
1672
|
args
|
|
@@ -1668,7 +1679,7 @@ var Notifications = class extends BaseModule {
|
|
|
1668
1679
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1669
1680
|
return this.callWithSession(
|
|
1670
1681
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1671
|
-
return
|
|
1682
|
+
return chunkCCAUG7YI_js.seen({
|
|
1672
1683
|
emitter: this._emitter,
|
|
1673
1684
|
apiService: this._inboxService,
|
|
1674
1685
|
args
|
|
@@ -1681,7 +1692,7 @@ var Notifications = class extends BaseModule {
|
|
|
1681
1692
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1682
1693
|
return this.callWithSession(
|
|
1683
1694
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1684
|
-
return
|
|
1695
|
+
return chunkCCAUG7YI_js.archive({
|
|
1685
1696
|
emitter: this._emitter,
|
|
1686
1697
|
apiService: this._inboxService,
|
|
1687
1698
|
args
|
|
@@ -1694,7 +1705,7 @@ var Notifications = class extends BaseModule {
|
|
|
1694
1705
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1695
1706
|
return this.callWithSession(
|
|
1696
1707
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1697
|
-
return
|
|
1708
|
+
return chunkCCAUG7YI_js.unarchive({
|
|
1698
1709
|
emitter: this._emitter,
|
|
1699
1710
|
apiService: this._inboxService,
|
|
1700
1711
|
args
|
|
@@ -1707,7 +1718,7 @@ var Notifications = class extends BaseModule {
|
|
|
1707
1718
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1708
1719
|
return this.callWithSession(
|
|
1709
1720
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1710
|
-
return
|
|
1721
|
+
return chunkCCAUG7YI_js.deleteNotification({
|
|
1711
1722
|
emitter: this._emitter,
|
|
1712
1723
|
apiService: this._inboxService,
|
|
1713
1724
|
args
|
|
@@ -1720,7 +1731,7 @@ var Notifications = class extends BaseModule {
|
|
|
1720
1731
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1721
1732
|
return this.callWithSession(
|
|
1722
1733
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1723
|
-
return
|
|
1734
|
+
return chunkCCAUG7YI_js.snooze({
|
|
1724
1735
|
emitter: this._emitter,
|
|
1725
1736
|
apiService: this._inboxService,
|
|
1726
1737
|
args
|
|
@@ -1733,7 +1744,7 @@ var Notifications = class extends BaseModule {
|
|
|
1733
1744
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1734
1745
|
return this.callWithSession(
|
|
1735
1746
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1736
|
-
return
|
|
1747
|
+
return chunkCCAUG7YI_js.unsnooze({
|
|
1737
1748
|
emitter: this._emitter,
|
|
1738
1749
|
apiService: this._inboxService,
|
|
1739
1750
|
args
|
|
@@ -1746,7 +1757,7 @@ var Notifications = class extends BaseModule {
|
|
|
1746
1757
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1747
1758
|
return this.callWithSession(
|
|
1748
1759
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1749
|
-
return
|
|
1760
|
+
return chunkCCAUG7YI_js.completeAction({
|
|
1750
1761
|
emitter: this._emitter,
|
|
1751
1762
|
apiService: this._inboxService,
|
|
1752
1763
|
args,
|
|
@@ -1760,7 +1771,7 @@ var Notifications = class extends BaseModule {
|
|
|
1760
1771
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1761
1772
|
return this.callWithSession(
|
|
1762
1773
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1763
|
-
return
|
|
1774
|
+
return chunkCCAUG7YI_js.completeAction({
|
|
1764
1775
|
emitter: this._emitter,
|
|
1765
1776
|
apiService: this._inboxService,
|
|
1766
1777
|
args,
|
|
@@ -1774,7 +1785,7 @@ var Notifications = class extends BaseModule {
|
|
|
1774
1785
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1775
1786
|
return this.callWithSession(
|
|
1776
1787
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1777
|
-
return
|
|
1788
|
+
return chunkCCAUG7YI_js.revertAction({
|
|
1778
1789
|
emitter: this._emitter,
|
|
1779
1790
|
apiService: this._inboxService,
|
|
1780
1791
|
args,
|
|
@@ -1788,7 +1799,7 @@ var Notifications = class extends BaseModule {
|
|
|
1788
1799
|
return chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1789
1800
|
return this.callWithSession(
|
|
1790
1801
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1791
|
-
return
|
|
1802
|
+
return chunkCCAUG7YI_js.revertAction({
|
|
1792
1803
|
emitter: this._emitter,
|
|
1793
1804
|
apiService: this._inboxService,
|
|
1794
1805
|
args,
|
|
@@ -1805,7 +1816,7 @@ var Notifications = class extends BaseModule {
|
|
|
1805
1816
|
} = {}) {
|
|
1806
1817
|
return this.callWithSession(
|
|
1807
1818
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1808
|
-
return
|
|
1819
|
+
return chunkCCAUG7YI_js.readAll({
|
|
1809
1820
|
emitter: this._emitter,
|
|
1810
1821
|
inboxService: this._inboxService,
|
|
1811
1822
|
notificationsCache: this.cache,
|
|
@@ -1820,14 +1831,14 @@ var Notifications = class extends BaseModule {
|
|
|
1820
1831
|
return chunk7B52C2XE_js.__async(this, arguments, function* (args = {}) {
|
|
1821
1832
|
return this.callWithSession(() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1822
1833
|
if ("notificationIds" in args) {
|
|
1823
|
-
return
|
|
1834
|
+
return chunkCCAUG7YI_js.seenAll({
|
|
1824
1835
|
emitter: this._emitter,
|
|
1825
1836
|
inboxService: this._inboxService,
|
|
1826
1837
|
notificationsCache: this.cache,
|
|
1827
1838
|
notificationIds: args.notificationIds
|
|
1828
1839
|
});
|
|
1829
1840
|
} else {
|
|
1830
|
-
return
|
|
1841
|
+
return chunkCCAUG7YI_js.seenAll({
|
|
1831
1842
|
emitter: this._emitter,
|
|
1832
1843
|
inboxService: this._inboxService,
|
|
1833
1844
|
notificationsCache: this.cache,
|
|
@@ -1845,7 +1856,7 @@ var Notifications = class extends BaseModule {
|
|
|
1845
1856
|
} = {}) {
|
|
1846
1857
|
return this.callWithSession(
|
|
1847
1858
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1848
|
-
return
|
|
1859
|
+
return chunkCCAUG7YI_js.archiveAll({
|
|
1849
1860
|
emitter: this._emitter,
|
|
1850
1861
|
inboxService: this._inboxService,
|
|
1851
1862
|
notificationsCache: this.cache,
|
|
@@ -1860,7 +1871,7 @@ var Notifications = class extends BaseModule {
|
|
|
1860
1871
|
return chunk7B52C2XE_js.__async(this, arguments, function* ({ tags, data } = {}) {
|
|
1861
1872
|
return this.callWithSession(
|
|
1862
1873
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1863
|
-
return
|
|
1874
|
+
return chunkCCAUG7YI_js.archiveAllRead({
|
|
1864
1875
|
emitter: this._emitter,
|
|
1865
1876
|
inboxService: this._inboxService,
|
|
1866
1877
|
notificationsCache: this.cache,
|
|
@@ -1878,7 +1889,7 @@ var Notifications = class extends BaseModule {
|
|
|
1878
1889
|
} = {}) {
|
|
1879
1890
|
return this.callWithSession(
|
|
1880
1891
|
() => chunk7B52C2XE_js.__async(this, null, function* () {
|
|
1881
|
-
return
|
|
1892
|
+
return chunkCCAUG7YI_js.deleteAll({
|
|
1882
1893
|
emitter: this._emitter,
|
|
1883
1894
|
inboxService: this._inboxService,
|
|
1884
1895
|
notificationsCache: this.cache,
|
|
@@ -2047,7 +2058,7 @@ var updatePreference = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function*
|
|
|
2047
2058
|
return { data: preference };
|
|
2048
2059
|
} catch (error) {
|
|
2049
2060
|
emitter.emit("preference.update.resolved", { args, error });
|
|
2050
|
-
return { error: new
|
|
2061
|
+
return { error: new chunkCCAUG7YI_js.NovuError("Failed to update preference", error) };
|
|
2051
2062
|
}
|
|
2052
2063
|
});
|
|
2053
2064
|
var bulkUpdatePreference = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
@@ -2060,7 +2071,7 @@ var bulkUpdatePreference = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], functi
|
|
|
2060
2071
|
}) {
|
|
2061
2072
|
const globalPreference = args.find((arg) => "preference" in arg && arg.preference.level === "global" /* GLOBAL */);
|
|
2062
2073
|
if (globalPreference) {
|
|
2063
|
-
return { error: new
|
|
2074
|
+
return { error: new chunkCCAUG7YI_js.NovuError("Global preference is not supported in bulk update", "") };
|
|
2064
2075
|
}
|
|
2065
2076
|
try {
|
|
2066
2077
|
const optimisticallyUpdatedPreferences = args.map(
|
|
@@ -2101,7 +2112,7 @@ var bulkUpdatePreference = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], functi
|
|
|
2101
2112
|
return { data: preferences };
|
|
2102
2113
|
} catch (error) {
|
|
2103
2114
|
emitter.emit("preferences.bulk_update.resolved", { args, error });
|
|
2104
|
-
return { error: new
|
|
2115
|
+
return { error: new chunkCCAUG7YI_js.NovuError("Failed to bulk update preferences", error) };
|
|
2105
2116
|
}
|
|
2106
2117
|
});
|
|
2107
2118
|
var optimisticUpdateWorkflowPreferences = ({
|
|
@@ -2191,7 +2202,7 @@ var updateSchedule = (_0) => chunk7B52C2XE_js.__async(void 0, [_0], function* ({
|
|
|
2191
2202
|
return { data: updatedSchedule };
|
|
2192
2203
|
} catch (error) {
|
|
2193
2204
|
emitter.emit("preference.schedule.update.resolved", { args, error });
|
|
2194
|
-
return { error: new
|
|
2205
|
+
return { error: new chunkCCAUG7YI_js.NovuError("Failed to update preference", error) };
|
|
2195
2206
|
}
|
|
2196
2207
|
});
|
|
2197
2208
|
|
|
@@ -2779,7 +2790,7 @@ var PartySocketClient = class extends BaseModule {
|
|
|
2779
2790
|
const data = JSON.parse(event.data);
|
|
2780
2791
|
if (data.event === "notification_received" /* RECEIVED */) {
|
|
2781
2792
|
chunk7B52C2XE_js.__privateGet(this, _emitter10).emit(NOTIFICATION_RECEIVED, {
|
|
2782
|
-
result: new
|
|
2793
|
+
result: new chunkCCAUG7YI_js.Notification(mapToNotification(data.data.message), chunk7B52C2XE_js.__privateGet(this, _emitter10), this._inboxService)
|
|
2783
2794
|
});
|
|
2784
2795
|
}
|
|
2785
2796
|
} catch (error) {
|
|
@@ -2886,7 +2897,7 @@ handleConnectSocket_fn = function() {
|
|
|
2886
2897
|
yield chunk7B52C2XE_js.__privateMethod(this, _PartySocketClient_instances, initializeSocket_fn).call(this);
|
|
2887
2898
|
return {};
|
|
2888
2899
|
} catch (error) {
|
|
2889
|
-
return { error: new
|
|
2900
|
+
return { error: new chunkCCAUG7YI_js.NovuError("Failed to initialize the PartySocket", error) };
|
|
2890
2901
|
}
|
|
2891
2902
|
});
|
|
2892
2903
|
};
|
|
@@ -2898,7 +2909,7 @@ handleDisconnectSocket_fn = function() {
|
|
|
2898
2909
|
chunk7B52C2XE_js.__privateSet(this, _partySocket, void 0);
|
|
2899
2910
|
return {};
|
|
2900
2911
|
} catch (error) {
|
|
2901
|
-
return { error: new
|
|
2912
|
+
return { error: new chunkCCAUG7YI_js.NovuError("Failed to disconnect from the PartySocket", error) };
|
|
2902
2913
|
}
|
|
2903
2914
|
});
|
|
2904
2915
|
};
|
|
@@ -3011,7 +3022,7 @@ var Socket = class extends BaseModule {
|
|
|
3011
3022
|
chunk7B52C2XE_js.__privateAdd(this, _socketUrl2);
|
|
3012
3023
|
chunk7B52C2XE_js.__privateAdd(this, _notificationReceived2, ({ message }) => {
|
|
3013
3024
|
chunk7B52C2XE_js.__privateGet(this, _emitter11).emit(NOTIFICATION_RECEIVED2, {
|
|
3014
|
-
result: new
|
|
3025
|
+
result: new chunkCCAUG7YI_js.Notification(mapToNotification2(message), chunk7B52C2XE_js.__privateGet(this, _emitter11), this._inboxService)
|
|
3015
3026
|
});
|
|
3016
3027
|
});
|
|
3017
3028
|
chunk7B52C2XE_js.__privateAdd(this, _unseenCountChanged2, ({ unseenCount }) => {
|
|
@@ -3090,7 +3101,7 @@ handleConnectSocket_fn2 = function() {
|
|
|
3090
3101
|
yield chunk7B52C2XE_js.__privateMethod(this, _Socket_instances, initializeSocket_fn2).call(this);
|
|
3091
3102
|
return {};
|
|
3092
3103
|
} catch (error) {
|
|
3093
|
-
return { error: new
|
|
3104
|
+
return { error: new chunkCCAUG7YI_js.NovuError("Failed to initialize the socket", error) };
|
|
3094
3105
|
}
|
|
3095
3106
|
});
|
|
3096
3107
|
};
|
|
@@ -3102,7 +3113,7 @@ handleDisconnectSocket_fn2 = function() {
|
|
|
3102
3113
|
chunk7B52C2XE_js.__privateSet(this, _socketIo, void 0);
|
|
3103
3114
|
return {};
|
|
3104
3115
|
} catch (error) {
|
|
3105
|
-
return { error: new
|
|
3116
|
+
return { error: new chunkCCAUG7YI_js.NovuError("Failed to disconnect from the socket", error) };
|
|
3106
3117
|
}
|
|
3107
3118
|
});
|
|
3108
3119
|
};
|
|
@@ -3165,7 +3176,8 @@ var Novu = class {
|
|
|
3165
3176
|
userAgent: options.__userAgent
|
|
3166
3177
|
}));
|
|
3167
3178
|
chunk7B52C2XE_js.__privateSet(this, _emitter12, new NovuEventEmitter());
|
|
3168
|
-
const subscriber =
|
|
3179
|
+
const subscriber = chunkCCAUG7YI_js.buildSubscriber({ subscriberId: options.subscriberId, subscriber: options.subscriber });
|
|
3180
|
+
const contextKey = chunkCCAUG7YI_js.buildContextKey(options.context);
|
|
3169
3181
|
chunk7B52C2XE_js.__privateSet(this, _session, new Session(
|
|
3170
3182
|
{
|
|
3171
3183
|
applicationIdentifier: options.applicationIdentifier || "",
|
|
@@ -3191,6 +3203,7 @@ var Novu = class {
|
|
|
3191
3203
|
});
|
|
3192
3204
|
this.subscriptions = new Subscriptions({
|
|
3193
3205
|
subscriber,
|
|
3206
|
+
contextKey,
|
|
3194
3207
|
useCache: (_c = options.useCache) != null ? _c : true,
|
|
3195
3208
|
inboxServiceInstance: chunk7B52C2XE_js.__privateGet(this, _inboxService6),
|
|
3196
3209
|
eventEmitterInstance: chunk7B52C2XE_js.__privateGet(this, _emitter12)
|
|
@@ -3226,7 +3239,7 @@ var Novu = class {
|
|
|
3226
3239
|
return chunk7B52C2XE_js.__privateGet(this, _options2);
|
|
3227
3240
|
}
|
|
3228
3241
|
get contextKey() {
|
|
3229
|
-
return
|
|
3242
|
+
return chunkCCAUG7YI_js.buildContextKey(chunk7B52C2XE_js.__privateGet(this, _session).context);
|
|
3230
3243
|
}
|
|
3231
3244
|
clearCache() {
|
|
3232
3245
|
this.notifications.cache.clearAll();
|
|
@@ -32,8 +32,16 @@ function buildSubscriber({
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
// src/ui/internal/buildSubscriptionIdentifier.ts
|
|
35
|
-
function buildSubscriptionIdentifier({
|
|
36
|
-
|
|
35
|
+
function buildSubscriptionIdentifier({
|
|
36
|
+
topicKey,
|
|
37
|
+
subscriberId,
|
|
38
|
+
contextKey
|
|
39
|
+
}) {
|
|
40
|
+
const base = `tk_${topicKey}:si_${subscriberId}`;
|
|
41
|
+
if (contextKey && contextKey.length > 0) {
|
|
42
|
+
return `${base}:ctx_${contextKey}`;
|
|
43
|
+
}
|
|
44
|
+
return base;
|
|
37
45
|
}
|
|
38
46
|
|
|
39
47
|
// src/types.ts
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from 'json-logic-js';
|
|
2
|
-
import { S as SeverityLevelEnum, N as NotificationFilter, a as Notification } from './novu-event-emitter-
|
|
3
|
-
export { B as BaseDeleteSubscriptionArgs, f as BaseUpdateSubscriptionArgs, j as ChannelPreference, k as ChannelType, l as Context, C as CreateSubscriptionArgs, m as DaySchedule, n as DefaultSchedule, D as DeleteSubscriptionArgs, E as EventHandler, b as Events, F as FiltersCountResponse, G as GetSubscriptionArgs, o as InboxNotification, I as InstanceDeleteSubscriptionArgs, g as InstanceUpdateSubscriptionArgs, p as ListNotificationsResponse, L as ListSubscriptionsArgs, q as NotificationStatus, K as NovuError, r as NovuOptions, s as Preference, P as PreferenceFilter, t as PreferenceLevel, u as PreferencesResponse, v as Schedule, c as SocketEventNames, w as StandardNovuOptions, x as Subscriber, h as SubscriptionPreference, y as TimeRange, T as TopicSubscription, z as UnreadCount, U as UpdateSubscriptionArgs, i as UpdateSubscriptionPreferenceArgs, A as WebSocketEvent, H as WeeklySchedule, J as WorkflowCriticalityEnum, W as WorkflowFilter, d as WorkflowGroupFilter, e as WorkflowIdentifierOrId } from './novu-event-emitter-
|
|
4
|
-
export { N as Novu } from './novu-
|
|
2
|
+
import { S as SeverityLevelEnum, N as NotificationFilter, a as Notification } from './novu-event-emitter-BFZmnC3B.js';
|
|
3
|
+
export { B as BaseDeleteSubscriptionArgs, f as BaseUpdateSubscriptionArgs, j as ChannelPreference, k as ChannelType, l as Context, C as CreateSubscriptionArgs, m as DaySchedule, n as DefaultSchedule, D as DeleteSubscriptionArgs, E as EventHandler, b as Events, F as FiltersCountResponse, G as GetSubscriptionArgs, o as InboxNotification, I as InstanceDeleteSubscriptionArgs, g as InstanceUpdateSubscriptionArgs, p as ListNotificationsResponse, L as ListSubscriptionsArgs, q as NotificationStatus, K as NovuError, r as NovuOptions, s as Preference, P as PreferenceFilter, t as PreferenceLevel, u as PreferencesResponse, v as Schedule, c as SocketEventNames, w as StandardNovuOptions, x as Subscriber, h as SubscriptionPreference, y as TimeRange, T as TopicSubscription, z as UnreadCount, U as UpdateSubscriptionArgs, i as UpdateSubscriptionPreferenceArgs, A as WebSocketEvent, H as WeeklySchedule, J as WorkflowCriticalityEnum, W as WorkflowFilter, d as WorkflowGroupFilter, e as WorkflowIdentifierOrId } from './novu-event-emitter-BFZmnC3B.js';
|
|
4
|
+
export { N as Novu } from './novu-D_YIntb9.js';
|
|
5
5
|
|
|
6
6
|
declare const areTagsEqual: (tags1?: string[], tags2?: string[]) => boolean;
|
|
7
7
|
declare const areSeveritiesEqual: (el1?: SeverityLevelEnum | SeverityLevelEnum[], el2?: SeverityLevelEnum | SeverityLevelEnum[]) => boolean;
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkBDYEMGVY_js = require('./chunk-BDYEMGVY.js');
|
|
4
|
+
var chunkCCAUG7YI_js = require('./chunk-CCAUG7YI.js');
|
|
5
5
|
require('./chunk-7B52C2XE.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "Novu", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunkBDYEMGVY_js.Novu; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "SubscriptionPreference", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunkBDYEMGVY_js.SubscriptionPreference; }
|
|
16
16
|
});
|
|
17
17
|
Object.defineProperty(exports, "TopicSubscription", {
|
|
18
18
|
enumerable: true,
|
|
19
|
-
get: function () { return
|
|
19
|
+
get: function () { return chunkBDYEMGVY_js.TopicSubscription; }
|
|
20
20
|
});
|
|
21
21
|
Object.defineProperty(exports, "areSeveritiesEqual", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkBDYEMGVY_js.areSeveritiesEqual; }
|
|
24
24
|
});
|
|
25
25
|
Object.defineProperty(exports, "areTagsEqual", {
|
|
26
26
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunkBDYEMGVY_js.areTagsEqual; }
|
|
28
28
|
});
|
|
29
29
|
Object.defineProperty(exports, "checkNotificationDataFilter", {
|
|
30
30
|
enumerable: true,
|
|
31
|
-
get: function () { return
|
|
31
|
+
get: function () { return chunkBDYEMGVY_js.checkNotificationDataFilter; }
|
|
32
32
|
});
|
|
33
33
|
Object.defineProperty(exports, "checkNotificationMatchesFilter", {
|
|
34
34
|
enumerable: true,
|
|
35
|
-
get: function () { return
|
|
35
|
+
get: function () { return chunkBDYEMGVY_js.checkNotificationMatchesFilter; }
|
|
36
36
|
});
|
|
37
37
|
Object.defineProperty(exports, "isSameFilter", {
|
|
38
38
|
enumerable: true,
|
|
39
|
-
get: function () { return
|
|
39
|
+
get: function () { return chunkBDYEMGVY_js.isSameFilter; }
|
|
40
40
|
});
|
|
41
41
|
Object.defineProperty(exports, "ChannelType", {
|
|
42
42
|
enumerable: true,
|
|
43
|
-
get: function () { return
|
|
43
|
+
get: function () { return chunkCCAUG7YI_js.ChannelType; }
|
|
44
44
|
});
|
|
45
45
|
Object.defineProperty(exports, "NotificationStatus", {
|
|
46
46
|
enumerable: true,
|
|
47
|
-
get: function () { return
|
|
47
|
+
get: function () { return chunkCCAUG7YI_js.NotificationStatus; }
|
|
48
48
|
});
|
|
49
49
|
Object.defineProperty(exports, "NovuError", {
|
|
50
50
|
enumerable: true,
|
|
51
|
-
get: function () { return
|
|
51
|
+
get: function () { return chunkCCAUG7YI_js.NovuError; }
|
|
52
52
|
});
|
|
53
53
|
Object.defineProperty(exports, "PreferenceLevel", {
|
|
54
54
|
enumerable: true,
|
|
55
|
-
get: function () { return
|
|
55
|
+
get: function () { return chunkCCAUG7YI_js.PreferenceLevel; }
|
|
56
56
|
});
|
|
57
57
|
Object.defineProperty(exports, "SeverityLevelEnum", {
|
|
58
58
|
enumerable: true,
|
|
59
|
-
get: function () { return
|
|
59
|
+
get: function () { return chunkCCAUG7YI_js.SeverityLevelEnum; }
|
|
60
60
|
});
|
|
61
61
|
Object.defineProperty(exports, "WebSocketEvent", {
|
|
62
62
|
enumerable: true,
|
|
63
|
-
get: function () { return
|
|
63
|
+
get: function () { return chunkCCAUG7YI_js.WebSocketEvent; }
|
|
64
64
|
});
|
|
65
65
|
Object.defineProperty(exports, "WorkflowCriticalityEnum", {
|
|
66
66
|
enumerable: true,
|
|
67
|
-
get: function () { return
|
|
67
|
+
get: function () { return chunkCCAUG7YI_js.WorkflowCriticalityEnum; }
|
|
68
68
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as Context, x as Subscriber, O as NovuEventEmitter, M as InboxService, o as InboxNotification, a as Notification } from '../novu-event-emitter-
|
|
1
|
+
import { l as Context, x as Subscriber, O as NovuEventEmitter, M as InboxService, o as InboxNotification, a as Notification } from '../novu-event-emitter-BFZmnC3B.js';
|
|
2
2
|
import 'json-logic-js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -20,9 +20,10 @@ declare function buildSubscriber({ subscriberId, subscriber, }: {
|
|
|
20
20
|
subscriber: Subscriber | string | undefined;
|
|
21
21
|
}): Subscriber;
|
|
22
22
|
|
|
23
|
-
declare function buildSubscriptionIdentifier({ topicKey, subscriberId }: {
|
|
23
|
+
declare function buildSubscriptionIdentifier({ topicKey, subscriberId, contextKey, }: {
|
|
24
24
|
topicKey: string;
|
|
25
25
|
subscriberId?: string;
|
|
26
|
+
contextKey?: string;
|
|
26
27
|
}): string;
|
|
27
28
|
|
|
28
29
|
declare function createNotification({ emitter, inboxService, notification, }: {
|