webitel-sdk 0.1.170 → 0.1.172

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.
@@ -27052,7 +27052,7 @@ async function getMediaStream(constraints) {
27052
27052
 
27053
27053
  const getVersion = () => {
27054
27054
  // @ts-ignore
27055
- return '"0.1.170"';
27055
+ return '"0.1.172"';
27056
27056
  };
27057
27057
  var version = getVersion();
27058
27058
 
@@ -27986,6 +27986,7 @@ var ChatActions;
27986
27986
  ChatActions["Decline"] = "decline_invite";
27987
27987
  ChatActions["Update"] = "update_channel";
27988
27988
  ChatActions["Destroy"] = "destroy";
27989
+ ChatActions["MessageDeleted"] = "message_deleted";
27989
27990
  })(ChatActions || (ChatActions = {}));
27990
27991
  var ConversationState;
27991
27992
  (function (ConversationState) {
@@ -28064,6 +28065,15 @@ class Conversation {
28064
28065
  setLeave(e) {
28065
28066
  this.setClosed(e.timestamp);
28066
28067
  }
28068
+ setDeletedMessage(d) {
28069
+ const messages = this._messages;
28070
+ for (let i = 0; i < messages.length; i++) {
28071
+ if (messages[i].id === d.id) {
28072
+ d.created_at = messages[i].created_at;
28073
+ messages.splice(i, 1, d);
28074
+ }
28075
+ }
28076
+ }
28067
28077
  get id() {
28068
28078
  return this.channelId || this.inviteId || this.conversationId;
28069
28079
  }
@@ -28085,8 +28095,10 @@ class Conversation {
28085
28095
  contact: null,
28086
28096
  };
28087
28097
  if (i.hasOwnProperty('file')) {
28088
- i.file.url = this.client.fileUrlDownload(i.file.id);
28089
- i.file.streamUrl = this.client.fileUrlStream(i.file.id);
28098
+ if (i.file && i.file.id > 0) {
28099
+ i.file.url = this.client.fileUrlDownload(i.file.id);
28100
+ i.file.streamUrl = this.client.fileUrlStream(i.file.id);
28101
+ }
28090
28102
  msg.file = i.file;
28091
28103
  }
28092
28104
  if (i.hasOwnProperty('text')) {
@@ -29109,6 +29121,19 @@ class Client extends EventEmitter {
29109
29121
  conversation.setInvite(inv.invite_id, timestamp);
29110
29122
  this.conversationStore.set(conversation.id, conversation);
29111
29123
  break;
29124
+ case ChatActions.MessageDeleted:
29125
+ const deleted = event.data;
29126
+ // fixme
29127
+ for (const v of this.allConversations()) {
29128
+ if (!v.closedAt && v.membersId.indexOf(deleted.channel_id) > -1) {
29129
+ conversation = v;
29130
+ break;
29131
+ }
29132
+ }
29133
+ if (conversation) {
29134
+ conversation.setDeletedMessage(deleted);
29135
+ }
29136
+ return;
29112
29137
  case ChatActions.Joined:
29113
29138
  const joined = event.data;
29114
29139
  conversation = this.conversationById(joined.member.id);