stream-chat-angular 4.33.0 → 4.34.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 +1 @@
1
- export declare const version = "4.33.0";
1
+ export declare const version = "4.34.0";
@@ -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.33.0';
359
+ var version = '4.34.0';
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.
@@ -6090,14 +6090,16 @@
6090
6090
  this.subscriptions = [];
6091
6091
  this.isLatestMessageInList = true;
6092
6092
  this.subscriptions.push(this.channelService.activeChannel$.subscribe(function (channel) {
6093
- var _a, _b, _c, _d;
6093
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
6094
+ (_b = (_a = _this.chatClientService.chatClient) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.call(_a, 'info', ((channel === null || channel === void 0 ? void 0 : channel.cid) || 'undefined') + " selected", { tags: "message list " + _this.mode });
6094
6095
  if (_this.channelId !== (channel === null || channel === void 0 ? void 0 : channel.id)) {
6096
+ (_e = (_d = (_c = _this.chatClientService) === null || _c === void 0 ? void 0 : _c.chatClient) === null || _d === void 0 ? void 0 : _d.logger) === null || _e === void 0 ? void 0 : _e.call(_d, 'info', "new channel is different from prev channel, reseting scroll state", { tags: "message list " + _this.mode });
6095
6097
  _this.resetScrollState();
6096
6098
  _this.channelId = channel === null || channel === void 0 ? void 0 : channel.id;
6097
6099
  if (_this.openMessageListAt === 'last-unread-message' &&
6098
6100
  _this.mode === 'main') {
6099
6101
  _this.lastReadMessageId =
6100
- (_b = channel === null || channel === void 0 ? void 0 : channel.state.read[((_a = _this.chatClientService.chatClient.user) === null || _a === void 0 ? void 0 : _a.id) || '']) === null || _b === void 0 ? void 0 : _b.last_read_message_id;
6102
+ (_g = channel === null || channel === void 0 ? void 0 : channel.state.read[((_f = _this.chatClientService.chatClient.user) === null || _f === void 0 ? void 0 : _f.id) || '']) === null || _g === void 0 ? void 0 : _g.last_read_message_id;
6101
6103
  if (_this.lastReadMessageId) {
6102
6104
  _this.isJumpingToLatestUnreadMessage = true;
6103
6105
  void _this.channelService.jumpToMessage(_this.lastReadMessageId);
@@ -6107,11 +6109,11 @@
6107
6109
  _this.lastReadMessageId = undefined;
6108
6110
  }
6109
6111
  }
6110
- var capabilites = (_c = channel === null || channel === void 0 ? void 0 : channel.data) === null || _c === void 0 ? void 0 : _c.own_capabilities;
6112
+ var capabilites = (_h = channel === null || channel === void 0 ? void 0 : channel.data) === null || _h === void 0 ? void 0 : _h.own_capabilities;
6111
6113
  if (capabilites) {
6112
6114
  _this.enabledMessageActions = capabilites;
6113
6115
  }
6114
- (_d = _this.newMessageSubscription) === null || _d === void 0 ? void 0 : _d.unsubscribe();
6116
+ (_j = _this.newMessageSubscription) === null || _j === void 0 ? void 0 : _j.unsubscribe();
6115
6117
  if (channel) {
6116
6118
  _this.newMessageSubscription = channel.on('message.new', function (event) {
6117
6119
  // If we display main channel messages and we're switched to an older message set -> use message.new event to update unread count and detect new messages sent by current user
@@ -6163,6 +6165,7 @@
6163
6165
  this.subscriptions.push(this.channelService.jumpToMessage$
6164
6166
  .pipe(operators.filter(function (config) { return !!config.id; }))
6165
6167
  .subscribe(function (config) {
6168
+ var _a, _b;
6166
6169
  var messageId = undefined;
6167
6170
  if (_this.mode === 'main') {
6168
6171
  messageId = config.parentId || config.id;
@@ -6170,6 +6173,7 @@
6170
6173
  else if (config.parentId) {
6171
6174
  messageId = config.id;
6172
6175
  }
6176
+ (_b = (_a = _this.chatClientService.chatClient) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.call(_a, 'info', "Jumping to " + (messageId || ''), { tags: "message list " + _this.mode });
6173
6177
  if (messageId) {
6174
6178
  if (messageId === 'latest') {
6175
6179
  _this.scrollToLatestMessage();
@@ -6182,6 +6186,7 @@
6182
6186
  }));
6183
6187
  };
6184
6188
  MessageListComponent.prototype.ngAfterViewChecked = function () {
6189
+ var _a, _b, _c, _d, _e, _f;
6185
6190
  if (this.highlightedMessageId) {
6186
6191
  // Turn off programatic scroll adjustments while jump to message is in progress
6187
6192
  this.hasNewMessages = false;
@@ -6200,6 +6205,7 @@
6200
6205
  else {
6201
6206
  if (this.hasNewMessages) {
6202
6207
  if (!this.isUserScrolled || this.isNewMessageSentByUser) {
6208
+ (_b = (_a = this.chatClientService.chatClient) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.call(_a, 'info', "User has new messages, and not scrolled or sent new messages, therefore we " + (this.isLatestMessageInList ? 'scroll' : 'jump') + " to latest message", { tags: "message list " + this.mode });
6203
6209
  this.isLatestMessageInList
6204
6210
  ? this.scrollToBottom()
6205
6211
  : this.jumpToLatestMessage();
@@ -6208,6 +6214,7 @@
6208
6214
  this.containerHeight = this.scrollContainer.nativeElement.scrollHeight;
6209
6215
  }
6210
6216
  else if (this.olderMassagesLoaded) {
6217
+ (_d = (_c = this.chatClientService.chatClient) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.call(_c, 'info', "Older messages are loaded, we preserve the scroll position", { tags: "message list " + this.mode });
6211
6218
  this.preserveScrollbarPosition();
6212
6219
  this.containerHeight = this.scrollContainer.nativeElement.scrollHeight;
6213
6220
  this.olderMassagesLoaded = false;
@@ -6215,6 +6222,7 @@
6215
6222
  else if (this.getScrollPosition() !== 'bottom' &&
6216
6223
  !this.isUserScrolled &&
6217
6224
  !this.highlightedMessageId) {
6225
+ (_f = (_e = this.chatClientService.chatClient) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.call(_e, 'info', "Container grew and user didn't scroll therefore we " + (this.isLatestMessageInList ? 'scroll' : 'jump') + " to latest message", { tags: "message list " + this.mode });
6218
6226
  this.isLatestMessageInList
6219
6227
  ? this.scrollToBottom()
6220
6228
  : this.jumpToLatestMessage();
@@ -6249,6 +6257,7 @@
6249
6257
  };
6250
6258
  MessageListComponent.prototype.scrolled = function () {
6251
6259
  var _this = this;
6260
+ var _a, _b;
6252
6261
  this.isScrollInProgress = true;
6253
6262
  if (this.scrollEndTimeout) {
6254
6263
  clearTimeout(this.scrollEndTimeout);
@@ -6261,6 +6270,7 @@
6261
6270
  return;
6262
6271
  }
6263
6272
  var scrollPosition = this.getScrollPosition();
6273
+ (_b = (_a = this.chatClientService.chatClient) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.call(_a, 'info', "Scrolled - scroll position: " + scrollPosition, { tags: "message list " + this.mode });
6264
6274
  this.isUserScrolled =
6265
6275
  (this.direction === 'bottom-to-top'
6266
6276
  ? scrollPosition !== 'bottom'
@@ -6355,11 +6365,18 @@
6355
6365
  this.messages$ = (this.mode === 'main'
6356
6366
  ? this.channelService.activeChannelMessages$
6357
6367
  : this.channelService.activeThreadMessages$).pipe(operators.tap(function (messages) {
6368
+ var _a, _b, _c, _d;
6358
6369
  _this.isLoading = false;
6359
6370
  if (messages.length === 0) {
6371
+ (_b = (_a = _this.chatClientService.chatClient) === null || _a === void 0 ? void 0 : _a.logger) === null || _b === void 0 ? void 0 : _b.call(_a, 'info', "Empty messages array, reseting scroll state", {
6372
+ tags: "message list " + _this.mode,
6373
+ });
6360
6374
  _this.resetScrollState();
6361
6375
  return;
6362
6376
  }
6377
+ (_d = (_c = _this.chatClientService.chatClient) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.call(_c, 'info', "Received one or more messages", {
6378
+ tags: "message list " + _this.mode,
6379
+ });
6363
6380
  var currentLatestMessage = messages[messages.length - 1];
6364
6381
  _this.newMessageReceived(currentLatestMessage);
6365
6382
  var currentOldestMessage = messages[0];
@@ -6450,13 +6467,14 @@
6450
6467
  }
6451
6468
  };
6452
6469
  MessageListComponent.prototype.newMessageReceived = function (message) {
6453
- var _a, _b, _c, _d;
6470
+ var _a, _b, _c, _d, _e, _f;
6454
6471
  if (!this.latestMessage ||
6455
6472
  ((_a = this.latestMessage.created_at) === null || _a === void 0 ? void 0 : _a.getTime()) < message.created_at.getTime()) {
6473
+ (_c = (_b = this.chatClientService.chatClient) === null || _b === void 0 ? void 0 : _b.logger) === null || _c === void 0 ? void 0 : _c.call(_b, 'info', "Received new message", { tags: "message list " + this.mode });
6456
6474
  this.latestMessage = message;
6457
6475
  this.hasNewMessages = true;
6458
6476
  this.isNewMessageSentByUser =
6459
- ((_b = message.user) === null || _b === void 0 ? void 0 : _b.id) === ((_d = (_c = this.chatClientService.chatClient) === null || _c === void 0 ? void 0 : _c.user) === null || _d === void 0 ? void 0 : _d.id);
6477
+ ((_d = message.user) === null || _d === void 0 ? void 0 : _d.id) === ((_f = (_e = this.chatClientService.chatClient) === null || _e === void 0 ? void 0 : _e.user) === null || _f === void 0 ? void 0 : _f.id);
6460
6478
  if (this.isUserScrolled) {
6461
6479
  this.unreadMessageCount++;
6462
6480
  }