stream-chat-angular 4.68.1 → 4.68.3

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 = "4.68.1";
1
+ export declare const version = "4.68.3";
@@ -356,7 +356,7 @@
356
356
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
357
357
  }
358
358
 
359
- var version = '4.68.1';
359
+ var version = '4.68.3';
360
360
 
361
361
  /**
362
362
  * The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
@@ -789,6 +789,7 @@
789
789
  _this.activeParentMessageIdSubject.next(message === null || message === void 0 ? void 0 : message.id);
790
790
  };
791
791
  this.areReadEventsPaused = false;
792
+ this.markReadThrottleTime = 1050;
792
793
  this.channels$ = this.channelsSubject.asObservable().pipe(operators.shareReplay(1));
793
794
  this.activeChannel$ = this.activeChannelSubject
794
795
  .asObservable()
@@ -902,13 +903,15 @@
902
903
  return;
903
904
  }
904
905
  this.stopWatchForActiveChannelEvents(prevActiveChannel);
906
+ this.flushMarkReadQueue();
905
907
  this.areReadEventsPaused = false;
906
908
  var readState = channel.state.read[((_a = this.chatClientService.chatClient.user) === null || _a === void 0 ? void 0 : _a.id) || ''];
907
909
  this.activeChannelLastReadMessageId = readState === null || readState === void 0 ? void 0 : readState.last_read_message_id;
908
- if (((_b = channel.state.latestMessages[channel.state.latestMessages.length - 1]) === null || _b === void 0 ? void 0 : _b.id) === this.activeChannelLastReadMessageId) {
910
+ this.activeChannelUnreadCount = (readState === null || readState === void 0 ? void 0 : readState.unread_messages) || 0;
911
+ if (((_b = channel.state.latestMessages[channel.state.latestMessages.length - 1]) === null || _b === void 0 ? void 0 : _b.id) === this.activeChannelLastReadMessageId ||
912
+ this.activeChannelUnreadCount === 0) {
909
913
  this.activeChannelLastReadMessageId = undefined;
910
914
  }
911
- this.activeChannelUnreadCount = (readState === null || readState === void 0 ? void 0 : readState.unread_messages) || 0;
912
915
  this.watchForActiveChannelEvents(channel);
913
916
  this.addChannel(channel);
914
917
  this.activeChannelSubject.next(channel);
@@ -927,6 +930,7 @@
927
930
  return;
928
931
  }
929
932
  this.stopWatchForActiveChannelEvents(activeChannel);
933
+ this.flushMarkReadQueue();
930
934
  this.activeChannelMessagesSubject.next([]);
931
935
  this.activeChannelSubject.next(undefined);
932
936
  this.activeParentMessageIdSubject.next(undefined);
@@ -1876,6 +1880,9 @@
1876
1880
  _this.ngZone.run(function () {
1877
1881
  _this.activeChannelLastReadMessageId = e.last_read_message_id;
1878
1882
  _this.activeChannelUnreadCount = e.unread_messages;
1883
+ if (_this.activeChannelUnreadCount === 0) {
1884
+ _this.activeChannelLastReadMessageId = undefined;
1885
+ }
1879
1886
  _this.activeChannelSubject.next(_this.activeChannel);
1880
1887
  });
1881
1888
  }));
@@ -2469,13 +2476,43 @@
2469
2476
  this.usersTypingInChannelSubject.next([]);
2470
2477
  this.usersTypingInThreadSubject.next([]);
2471
2478
  };
2472
- ChannelService.prototype.markRead = function (channel) {
2479
+ ChannelService.prototype.markRead = function (channel, isThrottled) {
2480
+ if (isThrottled === void 0) { isThrottled = true; }
2473
2481
  if (this.canSendReadEvents &&
2474
2482
  this.shouldMarkActiveChannelAsRead &&
2475
- !this.areReadEventsPaused) {
2476
- void channel.markRead();
2483
+ !this.areReadEventsPaused &&
2484
+ channel.countUnread() > 0) {
2485
+ if (isThrottled) {
2486
+ this.markReadThrottled(channel);
2487
+ }
2488
+ else {
2489
+ void channel.markRead();
2490
+ }
2477
2491
  }
2478
2492
  };
2493
+ ChannelService.prototype.markReadThrottled = function (channel) {
2494
+ var _this = this;
2495
+ if (!this.markReadTimeout) {
2496
+ this.markRead(channel, false);
2497
+ this.markReadTimeout = setTimeout(function () {
2498
+ _this.flushMarkReadQueue();
2499
+ }, this.markReadThrottleTime);
2500
+ }
2501
+ else {
2502
+ clearTimeout(this.markReadTimeout);
2503
+ this.scheduledMarkReadRequest = function () { return _this.markRead(channel, false); };
2504
+ this.markReadTimeout = setTimeout(function () {
2505
+ _this.flushMarkReadQueue();
2506
+ }, this.markReadThrottleTime);
2507
+ }
2508
+ };
2509
+ ChannelService.prototype.flushMarkReadQueue = function () {
2510
+ var _a;
2511
+ (_a = this.scheduledMarkReadRequest) === null || _a === void 0 ? void 0 : _a.call(this);
2512
+ this.scheduledMarkReadRequest = undefined;
2513
+ clearTimeout(this.markReadTimeout);
2514
+ this.markReadTimeout = undefined;
2515
+ };
2479
2516
  ChannelService.prototype.setNextPageConfiguration = function (channelQueryResult) {
2480
2517
  var _a;
2481
2518
  if (this.customPaginator) {
@@ -3325,6 +3362,9 @@
3325
3362
  this.setFallbackChannelImage();
3326
3363
  }
3327
3364
  };
3365
+ AvatarComponent.prototype.ngOnDestroy = function () {
3366
+ this.subscriptions.forEach(function (s) { return s.unsubscribe(); });
3367
+ };
3328
3368
  AvatarComponent.prototype.setFallbackChannelImage = function () {
3329
3369
  if (this.type !== 'channel') {
3330
3370
  this.fallbackChannelImage = undefined;
@@ -7226,9 +7266,7 @@
7226
7266
  this.mentionedUsers.push((item.user ? item.user : item));
7227
7267
  this.userMentions.next(__spreadArray([], __read(this.mentionedUsers)));
7228
7268
  }
7229
- return (triggerChar +
7230
- item.autocompleteLabel +
7231
- (triggerChar === this.commandTriggerChar ? ' ' : ''));
7269
+ return triggerChar + item.autocompleteLabel + ' ';
7232
7270
  };
7233
7271
  AutocompleteTextareaComponent.prototype.autcompleteSearchTermChanged = function (searchTerm) {
7234
7272
  if (searchTerm === this.mentionTriggerChar) {