stream-chat-angular 4.36.2 → 4.37.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.36.2";
1
+ export declare const version = "4.37.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.36.2';
359
+ var version = '4.37.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.
@@ -1096,7 +1096,7 @@
1096
1096
  if (quotedMessageId === void 0) { quotedMessageId = undefined; }
1097
1097
  if (customData === void 0) { customData = undefined; }
1098
1098
  return __awaiter(this, void 0, void 0, function () {
1099
- var preview, channel;
1099
+ var preview, channel, response;
1100
1100
  return __generator(this, function (_h) {
1101
1101
  switch (_h.label) {
1102
1102
  case 0:
@@ -1106,8 +1106,8 @@
1106
1106
  channel.state.addMessageSorted(preview, true);
1107
1107
  return [4 /*yield*/, this.sendMessageRequest(preview, customData)];
1108
1108
  case 1:
1109
- _h.sent();
1110
- return [2 /*return*/];
1109
+ response = _h.sent();
1110
+ return [2 /*return*/, response];
1111
1111
  }
1112
1112
  });
1113
1113
  });
@@ -1137,8 +1137,9 @@
1137
1137
  * @param message Mesage to be updated
1138
1138
  */
1139
1139
  ChannelService.prototype.updateMessage = function (message) {
1140
+ var _a;
1140
1141
  return __awaiter(this, void 0, void 0, function () {
1141
- var messageToUpdate;
1142
+ var messageToUpdate, response, channel;
1142
1143
  return __generator(this, function (_h) {
1143
1144
  switch (_h.label) {
1144
1145
  case 0:
@@ -1146,8 +1147,10 @@
1146
1147
  delete messageToUpdate.i18n;
1147
1148
  return [4 /*yield*/, this.chatClientService.chatClient.updateMessage(messageToUpdate)];
1148
1149
  case 1:
1149
- _h.sent();
1150
- return [2 /*return*/];
1150
+ response = _h.sent();
1151
+ channel = (_a = this.channelsSubject
1152
+ .getValue()) === null || _a === void 0 ? void 0 : _a.find(function (c) { return c.cid === message.cid; });
1153
+ return [2 /*return*/, this.transformToStreamMessage(response.message, channel)];
1151
1154
  }
1152
1155
  });
1153
1156
  });
@@ -1332,7 +1335,7 @@
1332
1335
  ChannelService.prototype.sendMessageRequest = function (preview, customData) {
1333
1336
  var _a;
1334
1337
  return __awaiter(this, void 0, void 0, function () {
1335
- var channel, isThreadReply, response, error_2, stringError, parsedError;
1338
+ var channel, isThreadReply, response, messages_1, newMessage, error_2, stringError, parsedError, messages_2, newMessage;
1336
1339
  return __generator(this, function (_h) {
1337
1340
  switch (_h.label) {
1338
1341
  case 0:
@@ -1347,13 +1350,15 @@
1347
1350
  return [4 /*yield*/, channel.sendMessage(Object.assign({ id: preview.id, text: preview.text, attachments: preview.attachments, mentioned_users: (_a = preview.mentioned_users) === null || _a === void 0 ? void 0 : _a.map(function (u) { return u.id; }), parent_id: preview.parent_id, quoted_message_id: preview.quoted_message_id }, customData))];
1348
1351
  case 2:
1349
1352
  response = _h.sent();
1350
- if (response === null || response === void 0 ? void 0 : response.message) {
1351
- channel.state.addMessageSorted(Object.assign(Object.assign({}, response.message), { status: 'received' }), true);
1352
- isThreadReply
1353
- ? this.activeThreadMessagesSubject.next(__spreadArray([], __read(channel.state.threads[preview.parent_id])))
1354
- : this.activeChannelMessagesSubject.next(__spreadArray([], __read(channel.state.messages)));
1355
- }
1356
- return [3 /*break*/, 4];
1353
+ channel.state.addMessageSorted(Object.assign(Object.assign({}, response.message), { status: 'received' }), true);
1354
+ isThreadReply
1355
+ ? this.activeThreadMessagesSubject.next(__spreadArray([], __read(channel.state.threads[preview.parent_id])))
1356
+ : this.activeChannelMessagesSubject.next(__spreadArray([], __read(channel.state.messages)));
1357
+ (isThreadReply ? this.activeThreadMessages$ : this.activeChannelMessages$)
1358
+ .pipe(operators.take(1))
1359
+ .subscribe(function (m) { return (messages_1 = m); });
1360
+ newMessage = messages_1[messages_1.length - 1];
1361
+ return [2 /*return*/, newMessage];
1357
1362
  case 3:
1358
1363
  error_2 = _h.sent();
1359
1364
  stringError = JSON.stringify(error_2);
@@ -1364,7 +1369,11 @@
1364
1369
  isThreadReply
1365
1370
  ? this.activeThreadMessagesSubject.next(__spreadArray([], __read(channel.state.threads[preview.parent_id])))
1366
1371
  : this.activeChannelMessagesSubject.next(__spreadArray([], __read(channel.state.messages)));
1367
- return [3 /*break*/, 4];
1372
+ (isThreadReply ? this.activeThreadMessages$ : this.activeChannelMessages$)
1373
+ .pipe(operators.take(1))
1374
+ .subscribe(function (m) { return (messages_2 = m); });
1375
+ newMessage = messages_2[messages_2.length - 1];
1376
+ return [2 /*return*/, newMessage];
1368
1377
  case 4: return [2 /*return*/];
1369
1378
  }
1370
1379
  });
@@ -1950,11 +1959,19 @@
1950
1959
  message.quoted_message = Object.assign(Object.assign({}, message.quoted_message), { translation: getMessageTranslation(message.quoted_message, channel, this.chatClientService.chatClient.user) });
1951
1960
  }
1952
1961
  if (this.isFormatMessageResponse(message)) {
1953
- return Object.assign(Object.assign({}, message), { readBy: isThreadMessage ? [] : getReadBy(message, channel), translation: getMessageTranslation(message, channel, this.chatClientService.chatClient.user) });
1962
+ return Object.assign(Object.assign({}, message), { readBy: isThreadMessage
1963
+ ? []
1964
+ : channel
1965
+ ? getReadBy(message, channel)
1966
+ : [], translation: getMessageTranslation(message, channel, this.chatClientService.chatClient.user) });
1954
1967
  }
1955
1968
  else {
1956
1969
  var formatMessage = this.formatMessage(message);
1957
- return Object.assign(Object.assign({}, formatMessage), { readBy: isThreadMessage ? [] : getReadBy(formatMessage, channel), translation: getMessageTranslation(message, channel, this.chatClientService.chatClient.user) });
1970
+ return Object.assign(Object.assign({}, formatMessage), { readBy: isThreadMessage
1971
+ ? []
1972
+ : channel
1973
+ ? getReadBy(formatMessage, channel)
1974
+ : [], translation: getMessageTranslation(message, channel, this.chatClientService.chatClient.user) });
1958
1975
  }
1959
1976
  }
1960
1977
  };
@@ -3940,7 +3957,7 @@
3940
3957
  MessageInputComponent.prototype.messageSent = function () {
3941
3958
  var _a;
3942
3959
  return __awaiter(this, void 0, void 0, function () {
3943
- var attachmentUploadInProgressCounter, attachments, text, textContainsOnlySpaceChars, error_1;
3960
+ var attachmentUploadInProgressCounter, attachments, text, textContainsOnlySpaceChars, message, error_1;
3944
3961
  return __generator(this, function (_12) {
3945
3962
  switch (_12.label) {
3946
3963
  case 0:
@@ -3983,8 +4000,8 @@
3983
4000
  ? this.channelService.updateMessage(Object.assign(Object.assign({}, this.message), { text: text, attachments: attachments }))
3984
4001
  : this.channelService.sendMessage(text, attachments, this.mentionedUsers, this.parentMessageId, (_a = this.quotedMessage) === null || _a === void 0 ? void 0 : _a.id))];
3985
4002
  case 2:
3986
- _12.sent();
3987
- this.messageUpdate.emit();
4003
+ message = _12.sent();
4004
+ this.messageUpdate.emit({ message: message });
3988
4005
  if (!this.isUpdate) {
3989
4006
  this.attachmentService.resetAttachmentUploads();
3990
4007
  }