@novu/js 3.15.0-rc.cd43306f31 → 3.16.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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkYPTYVCVE_js = require('./chunk-YPTYVCVE.js');
3
+ var chunkWDGG3OER_js = require('./chunk-WDGG3OER.js');
4
4
  var chunk7B52C2XE_js = require('./chunk-7B52C2XE.js');
5
5
  var mitt = require('mitt');
6
6
  require('event-target-polyfill');
@@ -299,7 +299,7 @@ var TopicSubscription = class {
299
299
  return chunk7B52C2XE_js.__async(this, null, function* () {
300
300
  if (chunk7B52C2XE_js.__privateGet(this, _isStale)) {
301
301
  return {
302
- error: new chunkYPTYVCVE_js.NovuError("Cannot update a deleted subscription", new Error("Subscription is stale"))
302
+ error: new chunkWDGG3OER_js.NovuError("Cannot update a deleted subscription", new Error("Subscription is stale"))
303
303
  };
304
304
  }
305
305
  return updateSubscriptionPreference({
@@ -315,7 +315,7 @@ var TopicSubscription = class {
315
315
  return chunk7B52C2XE_js.__async(this, null, function* () {
316
316
  if (chunk7B52C2XE_js.__privateGet(this, _isStale)) {
317
317
  return {
318
- error: new chunkYPTYVCVE_js.NovuError("Cannot bulk update a deleted subscription", new Error("Subscription is stale"))
318
+ error: new chunkWDGG3OER_js.NovuError("Cannot bulk update a deleted subscription", new Error("Subscription is stale"))
319
319
  };
320
320
  }
321
321
  return bulkUpdateSubscriptionPreference({
@@ -331,7 +331,7 @@ var TopicSubscription = class {
331
331
  return chunk7B52C2XE_js.__async(this, null, function* () {
332
332
  if (chunk7B52C2XE_js.__privateGet(this, _isStale)) {
333
333
  return {
334
- error: new chunkYPTYVCVE_js.NovuError("Cannot delete an already deleted subscription", new Error("Subscription is stale"))
334
+ error: new chunkWDGG3OER_js.NovuError("Cannot delete an already deleted subscription", new Error("Subscription is stale"))
335
335
  };
336
336
  }
337
337
  return deleteSubscription({
@@ -374,7 +374,7 @@ var listSubscriptions = (_0) => chunk7B52C2XE_js.__async(null, [_0], function* (
374
374
  return { data };
375
375
  } catch (error) {
376
376
  emitter.emit("subscriptions.list.resolved", { args, error });
377
- return { error: new chunkYPTYVCVE_js.NovuError("Failed to fetch subscriptions", error) };
377
+ return { error: new chunkWDGG3OER_js.NovuError("Failed to fetch subscriptions", error) };
378
378
  }
379
379
  });
380
380
  var getSubscription = (_0) => chunk7B52C2XE_js.__async(null, [_0], function* ({
@@ -404,7 +404,7 @@ var getSubscription = (_0) => chunk7B52C2XE_js.__async(null, [_0], function* ({
404
404
  return { data };
405
405
  } catch (error) {
406
406
  emitter.emit("subscription.get.resolved", { args, error });
407
- return { error: new chunkYPTYVCVE_js.NovuError("Failed to fetch subscription", error) };
407
+ return { error: new chunkWDGG3OER_js.NovuError("Failed to fetch subscription", error) };
408
408
  }
409
409
  });
410
410
  var createSubscription = (_0) => chunk7B52C2XE_js.__async(null, [_0], function* ({
@@ -435,7 +435,7 @@ var createSubscription = (_0) => chunk7B52C2XE_js.__async(null, [_0], function*
435
435
  return { data: subscription };
436
436
  } catch (error) {
437
437
  emitter.emit("subscription.create.resolved", { args, error });
438
- return { error: new chunkYPTYVCVE_js.NovuError("Failed to create subscription", error) };
438
+ return { error: new chunkWDGG3OER_js.NovuError("Failed to create subscription", error) };
439
439
  }
440
440
  });
441
441
  var updateSubscription = (_0) => chunk7B52C2XE_js.__async(null, [_0], function* ({
@@ -462,7 +462,7 @@ var updateSubscription = (_0) => chunk7B52C2XE_js.__async(null, [_0], function*
462
462
  return { data: updatedSubscription };
463
463
  } catch (error) {
464
464
  emitter.emit("subscription.update.resolved", { args, error });
465
- return { error: new chunkYPTYVCVE_js.NovuError("Failed to update subscription", error) };
465
+ return { error: new chunkWDGG3OER_js.NovuError("Failed to update subscription", error) };
466
466
  }
467
467
  });
468
468
  var updateSubscriptionPreference = (_0) => chunk7B52C2XE_js.__async(null, [_0], function* ({
@@ -501,7 +501,7 @@ var updateSubscriptionPreference = (_0) => chunk7B52C2XE_js.__async(null, [_0],
501
501
  return { data: updatedSubscription };
502
502
  } catch (error) {
503
503
  emitter.emit("subscription.preference.update.resolved", { args, error });
504
- return { error: new chunkYPTYVCVE_js.NovuError("Failed to update subscription", error) };
504
+ return { error: new chunkWDGG3OER_js.NovuError("Failed to update subscription", error) };
505
505
  }
506
506
  });
507
507
  var bulkUpdateSubscriptionPreference = (_0) => chunk7B52C2XE_js.__async(null, [_0], function* ({
@@ -538,7 +538,7 @@ var bulkUpdateSubscriptionPreference = (_0) => chunk7B52C2XE_js.__async(null, [_
538
538
  return { data: preferences };
539
539
  } catch (error) {
540
540
  emitter.emit("subscription.preferences.bulk_update.resolved", { args, error });
541
- return { error: new chunkYPTYVCVE_js.NovuError("Failed to bulk update subscription preferences", error) };
541
+ return { error: new chunkWDGG3OER_js.NovuError("Failed to bulk update subscription preferences", error) };
542
542
  }
543
543
  });
544
544
  var deleteSubscription = (_0) => chunk7B52C2XE_js.__async(null, [_0], function* ({
@@ -555,7 +555,7 @@ var deleteSubscription = (_0) => chunk7B52C2XE_js.__async(null, [_0], function*
555
555
  return { data: void 0 };
556
556
  } catch (error) {
557
557
  emitter.emit("subscription.delete.resolved", { args, error });
558
- return { error: new chunkYPTYVCVE_js.NovuError("Failed to delete subscription", error) };
558
+ return { error: new chunkWDGG3OER_js.NovuError("Failed to delete subscription", error) };
559
559
  }
560
560
  });
561
561
 
@@ -622,7 +622,7 @@ var BaseModule = class {
622
622
  this.onSessionError(error);
623
623
  chunk7B52C2XE_js.__privateSet(this, _sessionError, error);
624
624
  chunk7B52C2XE_js.__privateGet(this, _callsQueue).forEach(({ resolve }) => {
625
- resolve({ error: new chunkYPTYVCVE_js.NovuError("Failed to initialize session, please contact the support", error) });
625
+ resolve({ error: new chunkWDGG3OER_js.NovuError("Failed to initialize session, please contact the support", error) });
626
626
  });
627
627
  chunk7B52C2XE_js.__privateSet(this, _callsQueue, []);
628
628
  }
@@ -639,7 +639,7 @@ var BaseModule = class {
639
639
  }
640
640
  if (chunk7B52C2XE_js.__privateGet(this, _sessionError)) {
641
641
  return Promise.resolve({
642
- error: new chunkYPTYVCVE_js.NovuError("Failed to initialize session, please contact the support", chunk7B52C2XE_js.__privateGet(this, _sessionError))
642
+ error: new chunkWDGG3OER_js.NovuError("Failed to initialize session, please contact the support", chunk7B52C2XE_js.__privateGet(this, _sessionError))
643
643
  });
644
644
  }
645
645
  return new Promise((resolve, reject) => {
@@ -988,7 +988,7 @@ var Subscriptions = class extends BaseModule {
988
988
  useCache: (_a = options == null ? void 0 : options.useCache) != null ? _a : chunk7B52C2XE_js.__privateGet(this, _useCache4)
989
989
  }),
990
990
  args: chunk7B52C2XE_js.__spreadProps(chunk7B52C2XE_js.__spreadValues({}, args), {
991
- identifier: (_b = args.identifier) != null ? _b : chunkYPTYVCVE_js.buildSubscriptionIdentifier({
991
+ identifier: (_b = args.identifier) != null ? _b : chunkWDGG3OER_js.buildSubscriptionIdentifier({
992
992
  topicKey: args.topicKey,
993
993
  subscriberId: chunk7B52C2XE_js.__privateGet(this, _subscriber).subscriberId,
994
994
  contextKey: chunk7B52C2XE_js.__privateGet(this, _contextKey)
@@ -1043,7 +1043,7 @@ _contextKey = new WeakMap();
1043
1043
 
1044
1044
  // src/api/http-client.ts
1045
1045
  var DEFAULT_API_VERSION = "v1";
1046
- var DEFAULT_CLIENT_VERSION = `${"@novu/js"}@${"3.15.0-rc.cd43306f31"}`;
1046
+ var DEFAULT_CLIENT_VERSION = `${"@novu/js"}@${"3.16.0"}`;
1047
1047
  var HttpClient = class {
1048
1048
  constructor(options = {}) {
1049
1049
  // Environment variable for local development that overrides the default API endpoint without affecting the Inbox DX
@@ -1157,6 +1157,30 @@ function combineUrl(...args) {
1157
1157
  // src/api/inbox-service.ts
1158
1158
  var INBOX_ROUTE = "/inbox";
1159
1159
  var INBOX_NOTIFICATIONS_ROUTE = `${INBOX_ROUTE}/notifications`;
1160
+ var CHAT_OAUTH_ROUTE = `${INBOX_ROUTE}/chat/oauth`;
1161
+ var CHANNEL_CONNECTIONS_ROUTE = `${INBOX_ROUTE}/channel-connections`;
1162
+ var CHANNEL_ENDPOINTS_ROUTE = `${INBOX_ROUTE}/channel-endpoints`;
1163
+ function buildChannelListSearchParams(args) {
1164
+ const searchParams = new URLSearchParams();
1165
+ if (args.subscriberId) searchParams.append("subscriberId", args.subscriberId);
1166
+ if (args.integrationIdentifier) searchParams.append("integrationIdentifier", args.integrationIdentifier);
1167
+ if (args.connectionIdentifier) searchParams.append("connectionIdentifier", args.connectionIdentifier);
1168
+ if (args.channel) searchParams.append("channel", args.channel);
1169
+ if (args.providerId) searchParams.append("providerId", args.providerId);
1170
+ if (args.contextKeys !== void 0) {
1171
+ if (args.contextKeys.length === 0) {
1172
+ searchParams.append("contextKeys", "");
1173
+ } else {
1174
+ for (const key of args.contextKeys) {
1175
+ searchParams.append("contextKeys", key);
1176
+ }
1177
+ }
1178
+ }
1179
+ if (args.limit) searchParams.append("limit", String(args.limit));
1180
+ if (args.after) searchParams.append("after", args.after);
1181
+ if (args.before) searchParams.append("before", args.before);
1182
+ return searchParams.size ? `?${searchParams.toString()}` : "";
1183
+ }
1160
1184
  function appendTagsToSearchParams(searchParams, tags) {
1161
1185
  if (tags === void 0) {
1162
1186
  return;
@@ -1474,8 +1498,319 @@ var InboxService = class {
1474
1498
  deleteSubscription({ topicKey, identifier }) {
1475
1499
  return chunk7B52C2XE_js.__privateGet(this, _httpClient).delete(`${INBOX_ROUTE}/topics/${topicKey}/subscriptions/${identifier}`);
1476
1500
  }
1501
+ generateChatOAuthUrl({
1502
+ integrationIdentifier,
1503
+ connectionIdentifier,
1504
+ subscriberId,
1505
+ context,
1506
+ scope,
1507
+ userScope,
1508
+ mode,
1509
+ connectionMode
1510
+ }) {
1511
+ return chunk7B52C2XE_js.__privateGet(this, _httpClient).post(CHAT_OAUTH_ROUTE, {
1512
+ integrationIdentifier,
1513
+ connectionIdentifier,
1514
+ subscriberId,
1515
+ context,
1516
+ scope,
1517
+ userScope,
1518
+ mode,
1519
+ connectionMode
1520
+ });
1521
+ }
1522
+ listChannelConnections(args = {}) {
1523
+ const query = buildChannelListSearchParams(args);
1524
+ return chunk7B52C2XE_js.__privateGet(this, _httpClient).get(`${CHANNEL_CONNECTIONS_ROUTE}${query}`, void 0, false);
1525
+ }
1526
+ getChannelConnection(identifier) {
1527
+ return chunk7B52C2XE_js.__privateGet(this, _httpClient).get(`${CHANNEL_CONNECTIONS_ROUTE}/${identifier}`);
1528
+ }
1529
+ createChannelConnection({
1530
+ identifier,
1531
+ integrationIdentifier,
1532
+ subscriberId,
1533
+ context,
1534
+ workspace,
1535
+ auth
1536
+ }) {
1537
+ return chunk7B52C2XE_js.__privateGet(this, _httpClient).post(CHANNEL_CONNECTIONS_ROUTE, {
1538
+ identifier,
1539
+ integrationIdentifier,
1540
+ subscriberId,
1541
+ context,
1542
+ workspace,
1543
+ auth
1544
+ });
1545
+ }
1546
+ deleteChannelConnection(identifier) {
1547
+ return chunk7B52C2XE_js.__privateGet(this, _httpClient).delete(`${CHANNEL_CONNECTIONS_ROUTE}/${identifier}`);
1548
+ }
1549
+ listChannelEndpoints(args = {}) {
1550
+ const query = buildChannelListSearchParams(args);
1551
+ return chunk7B52C2XE_js.__privateGet(this, _httpClient).get(`${CHANNEL_ENDPOINTS_ROUTE}${query}`, void 0, false);
1552
+ }
1553
+ getChannelEndpoint(identifier) {
1554
+ return chunk7B52C2XE_js.__privateGet(this, _httpClient).get(`${CHANNEL_ENDPOINTS_ROUTE}/${identifier}`);
1555
+ }
1556
+ createChannelEndpoint({
1557
+ identifier,
1558
+ integrationIdentifier,
1559
+ connectionIdentifier,
1560
+ subscriberId,
1561
+ context,
1562
+ type,
1563
+ endpoint
1564
+ }) {
1565
+ return chunk7B52C2XE_js.__privateGet(this, _httpClient).post(CHANNEL_ENDPOINTS_ROUTE, {
1566
+ identifier,
1567
+ integrationIdentifier,
1568
+ connectionIdentifier,
1569
+ subscriberId,
1570
+ context,
1571
+ type,
1572
+ endpoint
1573
+ });
1574
+ }
1575
+ deleteChannelEndpoint(identifier) {
1576
+ return chunk7B52C2XE_js.__privateGet(this, _httpClient).delete(`${CHANNEL_ENDPOINTS_ROUTE}/${identifier}`);
1577
+ }
1477
1578
  };
1478
1579
  _httpClient = new WeakMap();
1580
+
1581
+ // src/channel-connections/helpers.ts
1582
+ var generateChatOAuthUrl = (_0) => chunk7B52C2XE_js.__async(null, [_0], function* ({
1583
+ emitter,
1584
+ apiService,
1585
+ args
1586
+ }) {
1587
+ try {
1588
+ emitter.emit("channel-connection.oauth-url.pending", { args });
1589
+ const data = yield apiService.generateChatOAuthUrl(args);
1590
+ emitter.emit("channel-connection.oauth-url.resolved", { args, data });
1591
+ return { data };
1592
+ } catch (error) {
1593
+ emitter.emit("channel-connection.oauth-url.resolved", { args, error });
1594
+ return { error: new chunkWDGG3OER_js.NovuError("Failed to generate chat OAuth URL", error) };
1595
+ }
1596
+ });
1597
+ var listChannelConnections = (_0) => chunk7B52C2XE_js.__async(null, [_0], function* ({
1598
+ emitter,
1599
+ apiService,
1600
+ args
1601
+ }) {
1602
+ try {
1603
+ emitter.emit("channel-connections.list.pending", { args });
1604
+ const response = yield apiService.listChannelConnections(args);
1605
+ const data = response.data;
1606
+ emitter.emit("channel-connections.list.resolved", { args, data });
1607
+ return { data };
1608
+ } catch (error) {
1609
+ emitter.emit("channel-connections.list.resolved", { args, error });
1610
+ return { error: new chunkWDGG3OER_js.NovuError("Failed to list channel connections", error) };
1611
+ }
1612
+ });
1613
+ var getChannelConnection = (_0) => chunk7B52C2XE_js.__async(null, [_0], function* ({
1614
+ emitter,
1615
+ apiService,
1616
+ args
1617
+ }) {
1618
+ try {
1619
+ emitter.emit("channel-connection.get.pending", { args });
1620
+ const data = yield apiService.getChannelConnection(args.identifier);
1621
+ emitter.emit("channel-connection.get.resolved", { args, data });
1622
+ return { data };
1623
+ } catch (error) {
1624
+ emitter.emit("channel-connection.get.resolved", { args, error });
1625
+ return { error: new chunkWDGG3OER_js.NovuError("Failed to get channel connection", error) };
1626
+ }
1627
+ });
1628
+ var deleteChannelConnection = (_0) => chunk7B52C2XE_js.__async(null, [_0], function* ({
1629
+ emitter,
1630
+ apiService,
1631
+ args
1632
+ }) {
1633
+ try {
1634
+ emitter.emit("channel-connection.delete.pending", { args });
1635
+ yield apiService.deleteChannelConnection(args.identifier);
1636
+ emitter.emit("channel-connection.delete.resolved", { args });
1637
+ return { data: void 0 };
1638
+ } catch (error) {
1639
+ emitter.emit("channel-connection.delete.resolved", { args, error });
1640
+ return { error: new chunkWDGG3OER_js.NovuError("Failed to delete channel connection", error) };
1641
+ }
1642
+ });
1643
+
1644
+ // src/channel-connections/channel-connections.ts
1645
+ var ChannelConnections = class extends BaseModule {
1646
+ constructor({
1647
+ inboxServiceInstance,
1648
+ eventEmitterInstance
1649
+ }) {
1650
+ super({ inboxServiceInstance, eventEmitterInstance });
1651
+ }
1652
+ generateOAuthUrl(args) {
1653
+ return chunk7B52C2XE_js.__async(this, null, function* () {
1654
+ return this.callWithSession(
1655
+ () => generateChatOAuthUrl({
1656
+ emitter: this._emitter,
1657
+ apiService: this._inboxService,
1658
+ args
1659
+ })
1660
+ );
1661
+ });
1662
+ }
1663
+ list() {
1664
+ return chunk7B52C2XE_js.__async(this, arguments, function* (args = {}) {
1665
+ return this.callWithSession(
1666
+ () => listChannelConnections({
1667
+ emitter: this._emitter,
1668
+ apiService: this._inboxService,
1669
+ args
1670
+ })
1671
+ );
1672
+ });
1673
+ }
1674
+ get(args) {
1675
+ return chunk7B52C2XE_js.__async(this, null, function* () {
1676
+ return this.callWithSession(
1677
+ () => getChannelConnection({
1678
+ emitter: this._emitter,
1679
+ apiService: this._inboxService,
1680
+ args
1681
+ })
1682
+ );
1683
+ });
1684
+ }
1685
+ delete(args) {
1686
+ return chunk7B52C2XE_js.__async(this, null, function* () {
1687
+ return this.callWithSession(
1688
+ () => deleteChannelConnection({
1689
+ emitter: this._emitter,
1690
+ apiService: this._inboxService,
1691
+ args
1692
+ })
1693
+ );
1694
+ });
1695
+ }
1696
+ };
1697
+
1698
+ // src/channel-endpoints/helpers.ts
1699
+ var listChannelEndpoints = (_0) => chunk7B52C2XE_js.__async(null, [_0], function* ({
1700
+ emitter,
1701
+ apiService,
1702
+ args
1703
+ }) {
1704
+ try {
1705
+ emitter.emit("channel-endpoints.list.pending", { args });
1706
+ const response = yield apiService.listChannelEndpoints(args);
1707
+ const data = response.data;
1708
+ emitter.emit("channel-endpoints.list.resolved", { args, data });
1709
+ return { data };
1710
+ } catch (error) {
1711
+ emitter.emit("channel-endpoints.list.resolved", { args, error });
1712
+ return { error: new chunkWDGG3OER_js.NovuError("Failed to list channel endpoints", error) };
1713
+ }
1714
+ });
1715
+ var getChannelEndpoint = (_0) => chunk7B52C2XE_js.__async(null, [_0], function* ({
1716
+ emitter,
1717
+ apiService,
1718
+ args
1719
+ }) {
1720
+ try {
1721
+ emitter.emit("channel-endpoint.get.pending", { args });
1722
+ const data = yield apiService.getChannelEndpoint(args.identifier);
1723
+ emitter.emit("channel-endpoint.get.resolved", { args, data });
1724
+ return { data };
1725
+ } catch (error) {
1726
+ emitter.emit("channel-endpoint.get.resolved", { args, error });
1727
+ return { error: new chunkWDGG3OER_js.NovuError("Failed to get channel endpoint", error) };
1728
+ }
1729
+ });
1730
+ var createChannelEndpoint = (_0) => chunk7B52C2XE_js.__async(null, [_0], function* ({
1731
+ emitter,
1732
+ apiService,
1733
+ args
1734
+ }) {
1735
+ try {
1736
+ emitter.emit("channel-endpoint.create.pending", { args });
1737
+ const data = yield apiService.createChannelEndpoint(args);
1738
+ emitter.emit("channel-endpoint.create.resolved", { args, data });
1739
+ return { data };
1740
+ } catch (error) {
1741
+ emitter.emit("channel-endpoint.create.resolved", { args, error });
1742
+ return { error: new chunkWDGG3OER_js.NovuError("Failed to create channel endpoint", error) };
1743
+ }
1744
+ });
1745
+ var deleteChannelEndpoint = (_0) => chunk7B52C2XE_js.__async(null, [_0], function* ({
1746
+ emitter,
1747
+ apiService,
1748
+ args
1749
+ }) {
1750
+ try {
1751
+ emitter.emit("channel-endpoint.delete.pending", { args });
1752
+ yield apiService.deleteChannelEndpoint(args.identifier);
1753
+ emitter.emit("channel-endpoint.delete.resolved", { args });
1754
+ return { data: void 0 };
1755
+ } catch (error) {
1756
+ emitter.emit("channel-endpoint.delete.resolved", { args, error });
1757
+ return { error: new chunkWDGG3OER_js.NovuError("Failed to delete channel endpoint", error) };
1758
+ }
1759
+ });
1760
+
1761
+ // src/channel-endpoints/channel-endpoints.ts
1762
+ var ChannelEndpoints = class extends BaseModule {
1763
+ constructor({
1764
+ inboxServiceInstance,
1765
+ eventEmitterInstance
1766
+ }) {
1767
+ super({ inboxServiceInstance, eventEmitterInstance });
1768
+ }
1769
+ list() {
1770
+ return chunk7B52C2XE_js.__async(this, arguments, function* (args = {}) {
1771
+ return this.callWithSession(
1772
+ () => listChannelEndpoints({
1773
+ emitter: this._emitter,
1774
+ apiService: this._inboxService,
1775
+ args
1776
+ })
1777
+ );
1778
+ });
1779
+ }
1780
+ get(args) {
1781
+ return chunk7B52C2XE_js.__async(this, null, function* () {
1782
+ return this.callWithSession(
1783
+ () => getChannelEndpoint({
1784
+ emitter: this._emitter,
1785
+ apiService: this._inboxService,
1786
+ args
1787
+ })
1788
+ );
1789
+ });
1790
+ }
1791
+ create(args) {
1792
+ return chunk7B52C2XE_js.__async(this, null, function* () {
1793
+ return this.callWithSession(
1794
+ () => createChannelEndpoint({
1795
+ emitter: this._emitter,
1796
+ apiService: this._inboxService,
1797
+ args
1798
+ })
1799
+ );
1800
+ });
1801
+ }
1802
+ delete(args) {
1803
+ return chunk7B52C2XE_js.__async(this, null, function* () {
1804
+ return this.callWithSession(
1805
+ () => deleteChannelEndpoint({
1806
+ emitter: this._emitter,
1807
+ apiService: this._inboxService,
1808
+ args
1809
+ })
1810
+ );
1811
+ });
1812
+ }
1813
+ };
1479
1814
  var _mittEmitter;
1480
1815
  var NovuEventEmitter = class {
1481
1816
  constructor() {
@@ -1705,7 +2040,7 @@ var NotificationsCache = class {
1705
2040
  filter: getFilter(cacheKey),
1706
2041
  notifications: []
1707
2042
  };
1708
- const notificationInstance = chunkYPTYVCVE_js.createNotification({
2043
+ const notificationInstance = chunkWDGG3OER_js.createNotification({
1709
2044
  notification: chunk7B52C2XE_js.__spreadValues({}, notification),
1710
2045
  emitter: chunk7B52C2XE_js.__privateGet(this, _emitter4),
1711
2046
  inboxService: chunk7B52C2XE_js.__privateGet(this, _inboxService4)
@@ -1812,7 +2147,7 @@ var Notifications = class extends BaseModule {
1812
2147
  data = {
1813
2148
  hasMore: response.hasMore,
1814
2149
  filter: response.filter,
1815
- notifications: response.data.map((el) => new chunkYPTYVCVE_js.Notification(el, this._emitter, this._inboxService))
2150
+ notifications: response.data.map((el) => new chunkWDGG3OER_js.Notification(el, this._emitter, this._inboxService))
1816
2151
  };
1817
2152
  if (shouldUseCache) {
1818
2153
  this.cache.set(args, data);
@@ -1823,7 +2158,7 @@ var Notifications = class extends BaseModule {
1823
2158
  return { data };
1824
2159
  } catch (error) {
1825
2160
  this._emitter.emit("notifications.list.resolved", { args, error });
1826
- return { error: new chunkYPTYVCVE_js.NovuError("Failed to fetch notifications", error) };
2161
+ return { error: new chunkWDGG3OER_js.NovuError("Failed to fetch notifications", error) };
1827
2162
  }
1828
2163
  }));
1829
2164
  });
@@ -1845,7 +2180,7 @@ var Notifications = class extends BaseModule {
1845
2180
  return { data };
1846
2181
  } catch (error) {
1847
2182
  this._emitter.emit("notifications.count.resolved", { args, error });
1848
- return { error: new chunkYPTYVCVE_js.NovuError("Failed to count notifications", error) };
2183
+ return { error: new chunkWDGG3OER_js.NovuError("Failed to count notifications", error) };
1849
2184
  }
1850
2185
  }));
1851
2186
  });
@@ -1854,7 +2189,7 @@ var Notifications = class extends BaseModule {
1854
2189
  return chunk7B52C2XE_js.__async(this, null, function* () {
1855
2190
  return this.callWithSession(
1856
2191
  () => chunk7B52C2XE_js.__async(this, null, function* () {
1857
- return chunkYPTYVCVE_js.read({
2192
+ return chunkWDGG3OER_js.read({
1858
2193
  emitter: this._emitter,
1859
2194
  apiService: this._inboxService,
1860
2195
  args
@@ -1867,7 +2202,7 @@ var Notifications = class extends BaseModule {
1867
2202
  return chunk7B52C2XE_js.__async(this, null, function* () {
1868
2203
  return this.callWithSession(
1869
2204
  () => chunk7B52C2XE_js.__async(this, null, function* () {
1870
- return chunkYPTYVCVE_js.unread({
2205
+ return chunkWDGG3OER_js.unread({
1871
2206
  emitter: this._emitter,
1872
2207
  apiService: this._inboxService,
1873
2208
  args
@@ -1880,7 +2215,7 @@ var Notifications = class extends BaseModule {
1880
2215
  return chunk7B52C2XE_js.__async(this, null, function* () {
1881
2216
  return this.callWithSession(
1882
2217
  () => chunk7B52C2XE_js.__async(this, null, function* () {
1883
- return chunkYPTYVCVE_js.seen({
2218
+ return chunkWDGG3OER_js.seen({
1884
2219
  emitter: this._emitter,
1885
2220
  apiService: this._inboxService,
1886
2221
  args
@@ -1893,7 +2228,7 @@ var Notifications = class extends BaseModule {
1893
2228
  return chunk7B52C2XE_js.__async(this, null, function* () {
1894
2229
  return this.callWithSession(
1895
2230
  () => chunk7B52C2XE_js.__async(this, null, function* () {
1896
- return chunkYPTYVCVE_js.archive({
2231
+ return chunkWDGG3OER_js.archive({
1897
2232
  emitter: this._emitter,
1898
2233
  apiService: this._inboxService,
1899
2234
  args
@@ -1906,7 +2241,7 @@ var Notifications = class extends BaseModule {
1906
2241
  return chunk7B52C2XE_js.__async(this, null, function* () {
1907
2242
  return this.callWithSession(
1908
2243
  () => chunk7B52C2XE_js.__async(this, null, function* () {
1909
- return chunkYPTYVCVE_js.unarchive({
2244
+ return chunkWDGG3OER_js.unarchive({
1910
2245
  emitter: this._emitter,
1911
2246
  apiService: this._inboxService,
1912
2247
  args
@@ -1919,7 +2254,7 @@ var Notifications = class extends BaseModule {
1919
2254
  return chunk7B52C2XE_js.__async(this, null, function* () {
1920
2255
  return this.callWithSession(
1921
2256
  () => chunk7B52C2XE_js.__async(this, null, function* () {
1922
- return chunkYPTYVCVE_js.deleteNotification({
2257
+ return chunkWDGG3OER_js.deleteNotification({
1923
2258
  emitter: this._emitter,
1924
2259
  apiService: this._inboxService,
1925
2260
  args
@@ -1932,7 +2267,7 @@ var Notifications = class extends BaseModule {
1932
2267
  return chunk7B52C2XE_js.__async(this, null, function* () {
1933
2268
  return this.callWithSession(
1934
2269
  () => chunk7B52C2XE_js.__async(this, null, function* () {
1935
- return chunkYPTYVCVE_js.snooze({
2270
+ return chunkWDGG3OER_js.snooze({
1936
2271
  emitter: this._emitter,
1937
2272
  apiService: this._inboxService,
1938
2273
  args
@@ -1945,7 +2280,7 @@ var Notifications = class extends BaseModule {
1945
2280
  return chunk7B52C2XE_js.__async(this, null, function* () {
1946
2281
  return this.callWithSession(
1947
2282
  () => chunk7B52C2XE_js.__async(this, null, function* () {
1948
- return chunkYPTYVCVE_js.unsnooze({
2283
+ return chunkWDGG3OER_js.unsnooze({
1949
2284
  emitter: this._emitter,
1950
2285
  apiService: this._inboxService,
1951
2286
  args
@@ -1958,7 +2293,7 @@ var Notifications = class extends BaseModule {
1958
2293
  return chunk7B52C2XE_js.__async(this, null, function* () {
1959
2294
  return this.callWithSession(
1960
2295
  () => chunk7B52C2XE_js.__async(this, null, function* () {
1961
- return chunkYPTYVCVE_js.completeAction({
2296
+ return chunkWDGG3OER_js.completeAction({
1962
2297
  emitter: this._emitter,
1963
2298
  apiService: this._inboxService,
1964
2299
  args,
@@ -1972,7 +2307,7 @@ var Notifications = class extends BaseModule {
1972
2307
  return chunk7B52C2XE_js.__async(this, null, function* () {
1973
2308
  return this.callWithSession(
1974
2309
  () => chunk7B52C2XE_js.__async(this, null, function* () {
1975
- return chunkYPTYVCVE_js.completeAction({
2310
+ return chunkWDGG3OER_js.completeAction({
1976
2311
  emitter: this._emitter,
1977
2312
  apiService: this._inboxService,
1978
2313
  args,
@@ -1986,7 +2321,7 @@ var Notifications = class extends BaseModule {
1986
2321
  return chunk7B52C2XE_js.__async(this, null, function* () {
1987
2322
  return this.callWithSession(
1988
2323
  () => chunk7B52C2XE_js.__async(this, null, function* () {
1989
- return chunkYPTYVCVE_js.revertAction({
2324
+ return chunkWDGG3OER_js.revertAction({
1990
2325
  emitter: this._emitter,
1991
2326
  apiService: this._inboxService,
1992
2327
  args,
@@ -2000,7 +2335,7 @@ var Notifications = class extends BaseModule {
2000
2335
  return chunk7B52C2XE_js.__async(this, null, function* () {
2001
2336
  return this.callWithSession(
2002
2337
  () => chunk7B52C2XE_js.__async(this, null, function* () {
2003
- return chunkYPTYVCVE_js.revertAction({
2338
+ return chunkWDGG3OER_js.revertAction({
2004
2339
  emitter: this._emitter,
2005
2340
  apiService: this._inboxService,
2006
2341
  args,
@@ -2017,7 +2352,7 @@ var Notifications = class extends BaseModule {
2017
2352
  } = {}) {
2018
2353
  return this.callWithSession(
2019
2354
  () => chunk7B52C2XE_js.__async(this, null, function* () {
2020
- return chunkYPTYVCVE_js.readAll({
2355
+ return chunkWDGG3OER_js.readAll({
2021
2356
  emitter: this._emitter,
2022
2357
  inboxService: this._inboxService,
2023
2358
  notificationsCache: this.cache,
@@ -2032,14 +2367,14 @@ var Notifications = class extends BaseModule {
2032
2367
  return chunk7B52C2XE_js.__async(this, arguments, function* (args = {}) {
2033
2368
  return this.callWithSession(() => chunk7B52C2XE_js.__async(this, null, function* () {
2034
2369
  if ("notificationIds" in args) {
2035
- return chunkYPTYVCVE_js.seenAll({
2370
+ return chunkWDGG3OER_js.seenAll({
2036
2371
  emitter: this._emitter,
2037
2372
  inboxService: this._inboxService,
2038
2373
  notificationsCache: this.cache,
2039
2374
  notificationIds: args.notificationIds
2040
2375
  });
2041
2376
  } else {
2042
- return chunkYPTYVCVE_js.seenAll({
2377
+ return chunkWDGG3OER_js.seenAll({
2043
2378
  emitter: this._emitter,
2044
2379
  inboxService: this._inboxService,
2045
2380
  notificationsCache: this.cache,
@@ -2057,7 +2392,7 @@ var Notifications = class extends BaseModule {
2057
2392
  } = {}) {
2058
2393
  return this.callWithSession(
2059
2394
  () => chunk7B52C2XE_js.__async(this, null, function* () {
2060
- return chunkYPTYVCVE_js.archiveAll({
2395
+ return chunkWDGG3OER_js.archiveAll({
2061
2396
  emitter: this._emitter,
2062
2397
  inboxService: this._inboxService,
2063
2398
  notificationsCache: this.cache,
@@ -2075,7 +2410,7 @@ var Notifications = class extends BaseModule {
2075
2410
  } = {}) {
2076
2411
  return this.callWithSession(
2077
2412
  () => chunk7B52C2XE_js.__async(this, null, function* () {
2078
- return chunkYPTYVCVE_js.archiveAllRead({
2413
+ return chunkWDGG3OER_js.archiveAllRead({
2079
2414
  emitter: this._emitter,
2080
2415
  inboxService: this._inboxService,
2081
2416
  notificationsCache: this.cache,
@@ -2093,7 +2428,7 @@ var Notifications = class extends BaseModule {
2093
2428
  } = {}) {
2094
2429
  return this.callWithSession(
2095
2430
  () => chunk7B52C2XE_js.__async(this, null, function* () {
2096
- return chunkYPTYVCVE_js.deleteAll({
2431
+ return chunkWDGG3OER_js.deleteAll({
2097
2432
  emitter: this._emitter,
2098
2433
  inboxService: this._inboxService,
2099
2434
  notificationsCache: this.cache,
@@ -2262,7 +2597,7 @@ var updatePreference = (_0) => chunk7B52C2XE_js.__async(null, [_0], function* ({
2262
2597
  return { data: preference };
2263
2598
  } catch (error) {
2264
2599
  emitter.emit("preference.update.resolved", { args, error });
2265
- return { error: new chunkYPTYVCVE_js.NovuError("Failed to update preference", error) };
2600
+ return { error: new chunkWDGG3OER_js.NovuError("Failed to update preference", error) };
2266
2601
  }
2267
2602
  });
2268
2603
  var bulkUpdatePreference = (_0) => chunk7B52C2XE_js.__async(null, [_0], function* ({
@@ -2275,7 +2610,7 @@ var bulkUpdatePreference = (_0) => chunk7B52C2XE_js.__async(null, [_0], function
2275
2610
  }) {
2276
2611
  const globalPreference = args.find((arg) => "preference" in arg && arg.preference.level === "global" /* GLOBAL */);
2277
2612
  if (globalPreference) {
2278
- return { error: new chunkYPTYVCVE_js.NovuError("Global preference is not supported in bulk update", "") };
2613
+ return { error: new chunkWDGG3OER_js.NovuError("Global preference is not supported in bulk update", "") };
2279
2614
  }
2280
2615
  try {
2281
2616
  const optimisticallyUpdatedPreferences = args.map(
@@ -2316,7 +2651,7 @@ var bulkUpdatePreference = (_0) => chunk7B52C2XE_js.__async(null, [_0], function
2316
2651
  return { data: preferences };
2317
2652
  } catch (error) {
2318
2653
  emitter.emit("preferences.bulk_update.resolved", { args, error });
2319
- return { error: new chunkYPTYVCVE_js.NovuError("Failed to bulk update preferences", error) };
2654
+ return { error: new chunkWDGG3OER_js.NovuError("Failed to bulk update preferences", error) };
2320
2655
  }
2321
2656
  });
2322
2657
  var optimisticUpdateWorkflowPreferences = ({
@@ -2406,7 +2741,7 @@ var updateSchedule = (_0) => chunk7B52C2XE_js.__async(null, [_0], function* ({
2406
2741
  return { data: updatedSchedule };
2407
2742
  } catch (error) {
2408
2743
  emitter.emit("preference.schedule.update.resolved", { args, error });
2409
- return { error: new chunkYPTYVCVE_js.NovuError("Failed to update preference", error) };
2744
+ return { error: new chunkWDGG3OER_js.NovuError("Failed to update preference", error) };
2410
2745
  }
2411
2746
  });
2412
2747
 
@@ -2996,7 +3331,7 @@ var PartySocketClient = class extends BaseModule {
2996
3331
  const data = JSON.parse(event.data);
2997
3332
  if (data.event === "notification_received" /* RECEIVED */) {
2998
3333
  chunk7B52C2XE_js.__privateGet(this, _emitter10).emit(NOTIFICATION_RECEIVED, {
2999
- result: new chunkYPTYVCVE_js.Notification(mapToNotification(data.data.message), chunk7B52C2XE_js.__privateGet(this, _emitter10), this._inboxService)
3334
+ result: new chunkWDGG3OER_js.Notification(mapToNotification(data.data.message), chunk7B52C2XE_js.__privateGet(this, _emitter10), this._inboxService)
3000
3335
  });
3001
3336
  }
3002
3337
  } catch (error) {
@@ -3105,7 +3440,7 @@ handleConnectSocket_fn = function() {
3105
3440
  yield chunk7B52C2XE_js.__privateMethod(this, _PartySocketClient_instances, initializeSocket_fn).call(this);
3106
3441
  return {};
3107
3442
  } catch (error) {
3108
- return { error: new chunkYPTYVCVE_js.NovuError("Failed to initialize the PartySocket", error) };
3443
+ return { error: new chunkWDGG3OER_js.NovuError("Failed to initialize the PartySocket", error) };
3109
3444
  }
3110
3445
  });
3111
3446
  };
@@ -3117,7 +3452,7 @@ handleDisconnectSocket_fn = function() {
3117
3452
  chunk7B52C2XE_js.__privateSet(this, _partySocket, void 0);
3118
3453
  return {};
3119
3454
  } catch (error) {
3120
- return { error: new chunkYPTYVCVE_js.NovuError("Failed to disconnect from the PartySocket", error) };
3455
+ return { error: new chunkWDGG3OER_js.NovuError("Failed to disconnect from the PartySocket", error) };
3121
3456
  }
3122
3457
  });
3123
3458
  };
@@ -3232,7 +3567,7 @@ var Socket = class extends BaseModule {
3232
3567
  chunk7B52C2XE_js.__privateAdd(this, _socketOptions2);
3233
3568
  chunk7B52C2XE_js.__privateAdd(this, _notificationReceived2, ({ message }) => {
3234
3569
  chunk7B52C2XE_js.__privateGet(this, _emitter11).emit(NOTIFICATION_RECEIVED2, {
3235
- result: new chunkYPTYVCVE_js.Notification(mapToNotification2(message), chunk7B52C2XE_js.__privateGet(this, _emitter11), this._inboxService)
3570
+ result: new chunkWDGG3OER_js.Notification(mapToNotification2(message), chunk7B52C2XE_js.__privateGet(this, _emitter11), this._inboxService)
3236
3571
  });
3237
3572
  });
3238
3573
  chunk7B52C2XE_js.__privateAdd(this, _unseenCountChanged2, ({ unseenCount }) => {
@@ -3313,7 +3648,7 @@ handleConnectSocket_fn2 = function() {
3313
3648
  yield chunk7B52C2XE_js.__privateMethod(this, _Socket_instances, initializeSocket_fn2).call(this);
3314
3649
  return {};
3315
3650
  } catch (error) {
3316
- return { error: new chunkYPTYVCVE_js.NovuError("Failed to initialize the socket", error) };
3651
+ return { error: new chunkWDGG3OER_js.NovuError("Failed to initialize the socket", error) };
3317
3652
  }
3318
3653
  });
3319
3654
  };
@@ -3325,7 +3660,7 @@ handleDisconnectSocket_fn2 = function() {
3325
3660
  chunk7B52C2XE_js.__privateSet(this, _socketIo, void 0);
3326
3661
  return {};
3327
3662
  } catch (error) {
3328
- return { error: new chunkYPTYVCVE_js.NovuError("Failed to disconnect from the socket", error) };
3663
+ return { error: new chunkWDGG3OER_js.NovuError("Failed to disconnect from the socket", error) };
3329
3664
  }
3330
3665
  });
3331
3666
  };
@@ -3401,8 +3736,8 @@ var Novu = class {
3401
3736
  apiUrl: options.apiUrl || options.backendUrl
3402
3737
  }));
3403
3738
  chunk7B52C2XE_js.__privateSet(this, _emitter12, new NovuEventEmitter());
3404
- const subscriber = chunkYPTYVCVE_js.buildSubscriber({ subscriberId: options.subscriberId, subscriber: options.subscriber });
3405
- const contextKey = chunkYPTYVCVE_js.buildContextKey(options.context);
3739
+ const subscriber = chunkWDGG3OER_js.buildSubscriber({ subscriberId: options.subscriberId, subscriber: options.subscriber });
3740
+ const contextKey = chunkWDGG3OER_js.buildContextKey(options.context);
3406
3741
  chunk7B52C2XE_js.__privateSet(this, _session, new Session(
3407
3742
  {
3408
3743
  applicationIdentifier: options.applicationIdentifier || "",
@@ -3433,6 +3768,14 @@ var Novu = class {
3433
3768
  inboxServiceInstance: chunk7B52C2XE_js.__privateGet(this, _inboxService6),
3434
3769
  eventEmitterInstance: chunk7B52C2XE_js.__privateGet(this, _emitter12)
3435
3770
  });
3771
+ this.channelConnections = new ChannelConnections({
3772
+ inboxServiceInstance: chunk7B52C2XE_js.__privateGet(this, _inboxService6),
3773
+ eventEmitterInstance: chunk7B52C2XE_js.__privateGet(this, _emitter12)
3774
+ });
3775
+ this.channelEndpoints = new ChannelEndpoints({
3776
+ inboxServiceInstance: chunk7B52C2XE_js.__privateGet(this, _inboxService6),
3777
+ eventEmitterInstance: chunk7B52C2XE_js.__privateGet(this, _emitter12)
3778
+ });
3436
3779
  this.socket = createSocket({
3437
3780
  socketUrl: options.socketUrl,
3438
3781
  socketOptions: options.socketOptions,
@@ -3465,7 +3808,7 @@ var Novu = class {
3465
3808
  return chunk7B52C2XE_js.__privateGet(this, _options2);
3466
3809
  }
3467
3810
  get contextKey() {
3468
- return chunkYPTYVCVE_js.buildContextKey(chunk7B52C2XE_js.__privateGet(this, _session).context);
3811
+ return chunkWDGG3OER_js.buildContextKey(chunk7B52C2XE_js.__privateGet(this, _session).context);
3469
3812
  }
3470
3813
  clearCache() {
3471
3814
  this.notifications.cache.clearAll();