stream-chat-angular 3.2.1 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- export declare const version = "3.2.1";
1
+ export declare const version = "3.3.1";
@@ -354,7 +354,7 @@
354
354
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
355
355
  }
356
356
 
357
- var version = '3.2.1';
357
+ var version = '3.3.1';
358
358
 
359
359
  /**
360
360
  * The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
@@ -671,6 +671,7 @@
671
671
  this.messageToQuoteSubject = new rxjs.BehaviorSubject(undefined);
672
672
  this.usersTypingInChannelSubject = new rxjs.BehaviorSubject([]);
673
673
  this.usersTypingInThreadSubject = new rxjs.BehaviorSubject([]);
674
+ this._shouldMarkActiveChannelAsRead = true;
674
675
  this.channelListSetter = function (channels) {
675
676
  var currentChannels = _this.channelsSubject.getValue() || [];
676
677
  var newChannels = channels.filter(function (c) { return !currentChannels.find(function (channel) { return channel.cid === c.cid; }); });
@@ -727,6 +728,26 @@
727
728
  this.latestMessageDateByUserByChannels$ =
728
729
  this.latestMessageDateByUserByChannelsSubject.asObservable();
729
730
  }
731
+ Object.defineProperty(ChannelService.prototype, "shouldMarkActiveChannelAsRead", {
732
+ /**
733
+ * If set to false, read events won't be sent as new messages are received. If set to true active channel (if any) will immediately be marked as read.
734
+ */
735
+ get: function () {
736
+ return this._shouldMarkActiveChannelAsRead;
737
+ },
738
+ /**
739
+ * If set to false, read events won't be sent as new messages are received. If set to true active channel (if any) will immediately be marked as read.
740
+ */
741
+ set: function (shouldMarkActiveChannelAsRead) {
742
+ var _a;
743
+ if (!this._shouldMarkActiveChannelAsRead && shouldMarkActiveChannelAsRead) {
744
+ (_a = this.activeChannelSubject.getValue()) === null || _a === void 0 ? void 0 : _a.markRead();
745
+ }
746
+ this._shouldMarkActiveChannelAsRead = shouldMarkActiveChannelAsRead;
747
+ },
748
+ enumerable: false,
749
+ configurable: true
750
+ });
730
751
  /**
731
752
  * Sets the given `channel` as active and marks it as read.
732
753
  * @param channel
@@ -739,7 +760,7 @@
739
760
  channel.state.messages.forEach(function (m) {
740
761
  m.readBy = getReadBy(m, channel);
741
762
  });
742
- if (this.canSendReadEvents) {
763
+ if (this.canSendReadEvents && this.shouldMarkActiveChannelAsRead) {
743
764
  void channel.markRead();
744
765
  }
745
766
  this.activeChannelMessagesSubject.next(__spreadArray([], __read(channel.state.messages)));
@@ -1307,7 +1328,7 @@
1307
1328
  ? _this.activeThreadMessagesSubject.next(__spreadArray([], __read(channel.state.threads[event.message.parent_id])))
1308
1329
  : _this.activeChannelMessagesSubject.next(__spreadArray([], __read(channel.state.messages)));
1309
1330
  _this.activeChannel$.pipe(operators.first()).subscribe(function (c) {
1310
- if (_this.canSendReadEvents) {
1331
+ if (_this.canSendReadEvents && _this.shouldMarkActiveChannelAsRead) {
1311
1332
  void (c === null || c === void 0 ? void 0 : c.markRead());
1312
1333
  }
1313
1334
  });
@@ -3859,7 +3880,7 @@
3859
3880
  this.chatClientService = chatClientService;
3860
3881
  this.isActive = false;
3861
3882
  this.isUnread = false;
3862
- this.latestMessage = 'Nothing yet...';
3883
+ this.latestMessage = 'streamChat.Nothing yet...';
3863
3884
  this.subscriptions = [];
3864
3885
  this.canSendReadEvents = true;
3865
3886
  }
@@ -3928,7 +3949,7 @@
3928
3949
  this.ngZone.run(function () {
3929
3950
  var _a, _b, _c;
3930
3951
  if (((_a = _this.channel) === null || _a === void 0 ? void 0 : _a.state.messages.length) === 0) {
3931
- _this.latestMessage = 'Nothing yet...';
3952
+ _this.latestMessage = 'streamChat.Nothing yet...';
3932
3953
  return;
3933
3954
  }
3934
3955
  if (!event.message ||