stream-chat-angular 4.58.1 → 4.58.2

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.
@@ -20,7 +20,7 @@ import transliterate from '@stream-io/transliterate';
20
20
  import * as i8 from 'angular-mentions';
21
21
  import { MentionModule } from 'angular-mentions';
22
22
 
23
- const version = '4.58.1';
23
+ const version = '4.58.2';
24
24
 
25
25
  /**
26
26
  * The `NotificationService` can be used to add or remove notifications. By default the [`NotificationList`](../components/NotificationListComponent.mdx) component displays the currently active notifications.
@@ -705,7 +705,7 @@ class ChannelService {
705
705
  return __awaiter(this, void 0, void 0, function* () {
706
706
  const channel = this.activeChannelSubject.getValue();
707
707
  channel.state.addMessageSorted(Object.assign(Object.assign({}, message), { errorStatusCode: undefined, status: 'sending' }), true);
708
- yield this.sendMessageRequest(message);
708
+ return this.sendMessageRequest(message, undefined, true);
709
709
  });
710
710
  }
711
711
  /**
@@ -898,8 +898,8 @@ class ChannelService {
898
898
  this.watchForChannelEvents(channel);
899
899
  }
900
900
  }
901
- sendMessageRequest(preview, customData) {
902
- var _a;
901
+ sendMessageRequest(preview, customData, isResend = false) {
902
+ var _a, _b, _c, _d;
903
903
  return __awaiter(this, void 0, void 0, function* () {
904
904
  const channel = this.activeChannelSubject.getValue();
905
905
  const isThreadReply = !!preview.parent_id;
@@ -925,10 +925,18 @@ class ChannelService {
925
925
  }
926
926
  catch (error) {
927
927
  const stringError = JSON.stringify(error);
928
- const parsedError = stringError
929
- ? JSON.parse(stringError)
930
- : {};
931
- channel.state.addMessageSorted(Object.assign(Object.assign({}, preview), { errorStatusCode: parsedError.status || undefined, status: 'failed' }), true);
928
+ const parsedError = stringError ? JSON.parse(stringError) : {};
929
+ let isAlreadyExists = false;
930
+ if (isResend) {
931
+ if (parsedError.status === 400 &&
932
+ parsedError.code === 4 &&
933
+ ((_d = (_c = (_b = parsedError === null || parsedError === void 0 ? void 0 : parsedError.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) === null || _d === void 0 ? void 0 : _d.includes('already exists'))) {
934
+ isAlreadyExists = true;
935
+ }
936
+ }
937
+ channel.state.addMessageSorted(Object.assign(Object.assign({}, preview), { errorStatusCode: isAlreadyExists
938
+ ? undefined
939
+ : parsedError.status || undefined, status: isAlreadyExists ? 'received' : 'failed' }), true);
932
940
  isThreadReply
933
941
  ? this.activeThreadMessagesSubject.next([
934
942
  ...channel.state.threads[preview.parent_id],