sceyt-chat-react-uikit 1.7.7-beta.15 → 1.7.7-beta.17

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.
package/index.modern.js CHANGED
@@ -2676,42 +2676,6 @@ var FIXED_TIMER_OPTIONS = {
2676
2676
  '1month': 60 * 60 * 24 * 30,
2677
2677
  custom: 60 * 60 * 24 * 2
2678
2678
  };
2679
- var CUSTOM_OPTIONS = [{
2680
- label: '1 day',
2681
- value: '1day',
2682
- seconds: 60 * 60 * 24
2683
- }, {
2684
- label: '2 days',
2685
- value: '2days',
2686
- seconds: 60 * 60 * 24 * 2
2687
- }, {
2688
- label: '3 days',
2689
- value: '3days',
2690
- seconds: 60 * 60 * 24 * 3
2691
- }, {
2692
- label: '4 days',
2693
- value: '4days',
2694
- seconds: 60 * 60 * 24 * 4
2695
- }, {
2696
- label: '5 days',
2697
- value: '5days',
2698
- seconds: 60 * 60 * 24 * 5
2699
- }, {
2700
- label: '1 week',
2701
- value: '1week',
2702
- seconds: 60 * 60 * 24 * 7
2703
- }, {
2704
- label: '2 weeks',
2705
- value: '2weeks',
2706
- seconds: 60 * 60 * 24 * 14
2707
- }, {
2708
- label: '1 month',
2709
- value: '1month',
2710
- seconds: 60 * 60 * 24 * 30
2711
- }];
2712
- var CUSTOM_SECONDS_MAP = Object.fromEntries(CUSTOM_OPTIONS.map(function (o) {
2713
- return [o.value, o.seconds];
2714
- }));
2715
2679
 
2716
2680
  // A type of promise-like that resolves synchronously and supports only one observer
2717
2681
  const _Pact = /*#__PURE__*/(function() {
@@ -9078,7 +9042,7 @@ var memberCount = 10;
9078
9042
  var disableFrowardMentionsCount = false;
9079
9043
  var onUpdateChannel = function onUpdateChannel() {};
9080
9044
  var useInviteLink = false;
9081
- var enableDisappearingMessages = true;
9045
+ var disappearingSettings;
9082
9046
  var inviteLinkOptions = null;
9083
9047
  function setBaseUrlForInviteMembers(url) {
9084
9048
  baseUrlForInviteMembers = url;
@@ -9297,11 +9261,11 @@ var setShowChannelDetails = function setShowChannelDetails(state) {
9297
9261
  var getShowChannelDetails = function getShowChannelDetails() {
9298
9262
  return showChannelDetails;
9299
9263
  };
9300
- var setEnableDisappearingMessages = function setEnableDisappearingMessages(state) {
9301
- enableDisappearingMessages = state;
9264
+ var setDisappearingSettings = function setDisappearingSettings(settings) {
9265
+ disappearingSettings = settings;
9302
9266
  };
9303
- var getEnableDisappearingMessages = function getEnableDisappearingMessages() {
9304
- return enableDisappearingMessages;
9267
+ var getDisappearingSettings = function getDisappearingSettings() {
9268
+ return disappearingSettings;
9305
9269
  };
9306
9270
  var sortChannelByLastMessage = function sortChannelByLastMessage(channels) {
9307
9271
  return channels.sort(function (a, b) {
@@ -10093,6 +10057,7 @@ var hashString = function hashString(str) {
10093
10057
  }
10094
10058
  };
10095
10059
  var formatDisappearingMessageTime = function formatDisappearingMessageTime(periodInMilliseconds) {
10060
+ var _getDisappearingSetti;
10096
10061
  if (!periodInMilliseconds) return 'Off';
10097
10062
  var periodInSeconds = periodInMilliseconds / 1000;
10098
10063
  switch (periodInSeconds) {
@@ -10103,7 +10068,8 @@ var formatDisappearingMessageTime = function formatDisappearingMessageTime(perio
10103
10068
  case FIXED_TIMER_OPTIONS['1month']:
10104
10069
  return '1 month';
10105
10070
  }
10106
- var customMatch = CUSTOM_OPTIONS.find(function (option) {
10071
+ var customOptions = ((_getDisappearingSetti = getDisappearingSettings()) === null || _getDisappearingSetti === void 0 ? void 0 : _getDisappearingSetti.customOptions) || [];
10072
+ var customMatch = customOptions.find(function (option) {
10107
10073
  return option.seconds === periodInSeconds;
10108
10074
  });
10109
10075
  if (customMatch) return customMatch.label;
@@ -10251,10 +10217,13 @@ function setMessageToEditAC(message) {
10251
10217
  message: message
10252
10218
  });
10253
10219
  }
10254
- function getMessagesAC(channel, loadWithLastMessage, messageId, limit, withDeliveredMessages, highlight, behavior) {
10220
+ function getMessagesAC(channel, loadWithLastMessage, messageId, limit, withDeliveredMessages, highlight, behavior, scrollToMessage) {
10255
10221
  if (highlight === void 0) {
10256
10222
  highlight = true;
10257
10223
  }
10224
+ if (scrollToMessage === void 0) {
10225
+ scrollToMessage = true;
10226
+ }
10258
10227
  return {
10259
10228
  type: GET_MESSAGES,
10260
10229
  payload: {
@@ -10264,7 +10233,8 @@ function getMessagesAC(channel, loadWithLastMessage, messageId, limit, withDeliv
10264
10233
  limit: limit,
10265
10234
  withDeliveredMessages: withDeliveredMessages,
10266
10235
  highlight: highlight,
10267
- behavior: behavior
10236
+ behavior: behavior,
10237
+ scrollToMessage: scrollToMessage
10268
10238
  }
10269
10239
  };
10270
10240
  }
@@ -19002,9 +18972,6 @@ var addPendingMessage = function addPendingMessage(message, messageCopy, channel
19002
18972
  parentMessage: message.parentMessage
19003
18973
  });
19004
18974
  setPendingMessage(channel.id, messageToAdd);
19005
- if (!(messageToAdd !== null && messageToAdd !== void 0 && messageToAdd.forwardingDetails)) {
19006
- store.dispatch(scrollToNewMessageAC(true));
19007
- }
19008
18975
  return Promise.resolve();
19009
18976
  } catch (e) {
19010
18977
  return Promise.reject(e);
@@ -19014,41 +18981,55 @@ var updateMessage$1 = function updateMessage(actionType, pending, channel, scrol
19014
18981
  if (scrollToNewMessage === void 0) {
19015
18982
  scrollToNewMessage = true;
19016
18983
  }
19017
- try {
19018
- var activeChannelId = getActiveChannelId();
19019
- if (actionType !== RESEND_MESSAGE) {
19020
- addMessageToMap(channel.id, pending);
19021
- if (activeChannelId === channel.id) {
19022
- addAllMessages([pending], MESSAGE_LOAD_DIRECTION.NEXT);
19023
- }
19024
- if (activeChannelId === channel.id) {
19025
- store.dispatch(addMessageAC(pending));
19026
- }
19027
- if (scrollToNewMessage) {
19028
- store.dispatch(scrollToNewMessageAC(true));
18984
+ return /*#__PURE__*/_regenerator().m(function _callee() {
18985
+ var activeChannelId;
18986
+ return _regenerator().w(function (_context) {
18987
+ while (1) switch (_context.n) {
18988
+ case 0:
18989
+ activeChannelId = getActiveChannelId();
18990
+ if (!(actionType !== RESEND_MESSAGE)) {
18991
+ _context.n = 2;
18992
+ break;
18993
+ }
18994
+ addMessageToMap(channel.id, pending);
18995
+ if (activeChannelId === channel.id) {
18996
+ addAllMessages([pending], MESSAGE_LOAD_DIRECTION.NEXT);
18997
+ }
18998
+ if (!(activeChannelId === channel.id)) {
18999
+ _context.n = 1;
19000
+ break;
19001
+ }
19002
+ _context.n = 1;
19003
+ return put(addMessageAC(pending));
19004
+ case 1:
19005
+ if (!scrollToNewMessage) {
19006
+ _context.n = 2;
19007
+ break;
19008
+ }
19009
+ _context.n = 2;
19010
+ return put(scrollToNewMessageAC(true, true));
19011
+ case 2:
19012
+ return _context.a(2);
19029
19013
  }
19030
- }
19031
- return Promise.resolve();
19032
- } catch (e) {
19033
- return Promise.reject(e);
19034
- }
19014
+ }, _callee);
19015
+ })();
19035
19016
  };
19036
19017
  function sendMessage(action) {
19037
19018
  var payload, message, connectionState, channelId, sendAttachmentsAsSeparateMessage, isAddToPendingMessagesMap, pendingMessages, channel, SceytChatClient, createChannelData, mentionedUserIds, customUploader, linkAttachment, attachmentsToSend, messagesToSend, mediaAttachments, _loop, i, messageBuilder, messageToSend, pending, _loop2, _i, _t2;
19038
- return _regenerator().w(function (_context3) {
19039
- while (1) switch (_context3.p = _context3.n) {
19019
+ return _regenerator().w(function (_context4) {
19020
+ while (1) switch (_context4.p = _context4.n) {
19040
19021
  case 0:
19041
19022
  payload = action.payload;
19042
19023
  message = payload.message, connectionState = payload.connectionState, channelId = payload.channelId, sendAttachmentsAsSeparateMessage = payload.sendAttachmentsAsSeparateMessage, isAddToPendingMessagesMap = payload.isAddToPendingMessagesMap;
19043
19024
  pendingMessages = [];
19044
- _context3.p = 1;
19045
- _context3.n = 2;
19025
+ _context4.p = 1;
19026
+ _context4.n = 2;
19046
19027
  return put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
19047
19028
  case 2:
19048
- _context3.n = 3;
19029
+ _context4.n = 3;
19049
19030
  return call(getChannelFromMap, channelId);
19050
19031
  case 3:
19051
- channel = _context3.v;
19032
+ channel = _context4.v;
19052
19033
  if (!channel) {
19053
19034
  channel = getChannelFromAllChannels(channelId);
19054
19035
  if (channel) {
@@ -19056,7 +19037,7 @@ function sendMessage(action) {
19056
19037
  }
19057
19038
  }
19058
19039
  if (!channel.isMockChannel) {
19059
- _context3.n = 6;
19040
+ _context4.n = 6;
19060
19041
  break;
19061
19042
  }
19062
19043
  SceytChatClient = getClient();
@@ -19066,17 +19047,17 @@ function sendMessage(action) {
19066
19047
  members: channel.members,
19067
19048
  metadata: ''
19068
19049
  };
19069
- _context3.n = 4;
19050
+ _context4.n = 4;
19070
19051
  return call(SceytChatClient.Channel.create, createChannelData);
19071
19052
  case 4:
19072
- channel = _context3.v;
19073
- _context3.n = 5;
19053
+ channel = _context4.v;
19054
+ _context4.n = 5;
19074
19055
  return put(switchChannelActionAC(JSON.parse(JSON.stringify(channel))));
19075
19056
  case 5:
19076
19057
  addChannelToAllChannels(channel);
19077
19058
  setChannelInMap(channel);
19078
19059
  case 6:
19079
- _context3.n = 7;
19060
+ _context4.n = 7;
19080
19061
  return put(addChannelAC(JSON.parse(JSON.stringify(channel))));
19081
19062
  case 7:
19082
19063
  mentionedUserIds = message.mentionedUsers ? message.mentionedUsers.map(function (member) {
@@ -19084,7 +19065,7 @@ function sendMessage(action) {
19084
19065
  }) : [];
19085
19066
  customUploader = getCustomUploader();
19086
19067
  if (!(message.attachments && message.attachments.length)) {
19087
- _context3.n = 14;
19068
+ _context4.n = 15;
19088
19069
  break;
19089
19070
  }
19090
19071
  linkAttachment = null;
@@ -19097,13 +19078,13 @@ function sendMessage(action) {
19097
19078
  return att.type !== attachmentTypes.link;
19098
19079
  });
19099
19080
  if (!(mediaAttachments && mediaAttachments.length)) {
19100
- _context3.n = 11;
19081
+ _context4.n = 12;
19101
19082
  break;
19102
19083
  }
19103
- _loop = /*#__PURE__*/_regenerator().m(function _callee() {
19084
+ _loop = /*#__PURE__*/_regenerator().m(function _callee2() {
19104
19085
  var attachment, uri, attachmentBuilder, messageAttachment, handleUpdateUploadProgress, _messageBuilder, _messageToSend, messageForSend, _pending;
19105
- return _regenerator().w(function (_context) {
19106
- while (1) switch (_context.n) {
19086
+ return _regenerator().w(function (_context2) {
19087
+ while (1) switch (_context2.n) {
19107
19088
  case 0:
19108
19089
  attachment = mediaAttachments[i];
19109
19090
  if (attachment.cachedUrl) {
@@ -19147,101 +19128,112 @@ function sendMessage(action) {
19147
19128
  if (customUploader) {
19148
19129
  messageAttachment.url = attachment.data;
19149
19130
  }
19150
- if (sendAttachmentsAsSeparateMessage) {
19151
- _messageBuilder = channel.createMessageBuilder();
19152
- _messageBuilder.setBody(i === 0 ? message.body : '').setAttachments([]).setBodyAttributes(i === 0 ? message.bodyAttributes : {}).setMentionUserIds(i === 0 ? mentionedUserIds : []).setType(message.type).setDisplayCount(message.type === MESSAGE_TYPE.SYSTEM ? 0 : 1).setSilent(message.type === MESSAGE_TYPE.SYSTEM).setMetadata(i === 0 ? JSON.stringify(message.metadata) : '');
19153
- if (message.parentMessage) {
19154
- _messageBuilder.setParentMessageId(message.parentMessage ? message.parentMessage.id : null);
19155
- }
19156
- if (message.repliedInThread) {
19157
- _messageBuilder.setReplyInThread();
19158
- }
19159
- _messageToSend = action.type === RESEND_MESSAGE ? action.payload.message : _messageBuilder.create();
19160
- setPendingAttachment(messageAttachment.tid, _extends({}, messageAttachment.data, {
19161
- messageTid: _messageToSend.tid,
19162
- channelId: channel.id
19163
- }));
19164
- messageForSend = _extends({}, _messageToSend, {
19165
- attachments: [messageAttachment],
19166
- createdAt: new Date(Date.now())
19167
- });
19168
- messagesToSend.push(messageForSend);
19169
- _pending = _extends({}, messageForSend, {
19170
- attachments: [attachment],
19171
- createdAt: new Date(Date.now())
19172
- });
19173
- pendingMessages.push(_pending);
19174
- updateMessage$1(action.type, _pending, channel);
19175
- } else {
19176
- attachmentsToSend.push(messageAttachment);
19131
+ if (!sendAttachmentsAsSeparateMessage) {
19132
+ _context2.n = 2;
19133
+ break;
19177
19134
  }
19135
+ _messageBuilder = channel.createMessageBuilder();
19136
+ _messageBuilder.setBody(i === 0 ? message.body : '').setAttachments([]).setBodyAttributes(i === 0 ? message.bodyAttributes : {}).setMentionUserIds(i === 0 ? mentionedUserIds : []).setType(message.type).setDisplayCount(message.type === MESSAGE_TYPE.SYSTEM ? 0 : 1).setSilent(message.type === MESSAGE_TYPE.SYSTEM).setMetadata(i === 0 ? JSON.stringify(message.metadata) : '');
19137
+ if (message.parentMessage) {
19138
+ _messageBuilder.setParentMessageId(message.parentMessage ? message.parentMessage.id : null);
19139
+ }
19140
+ if (message.repliedInThread) {
19141
+ _messageBuilder.setReplyInThread();
19142
+ }
19143
+ _messageToSend = action.type === RESEND_MESSAGE ? action.payload.message : _messageBuilder.create();
19144
+ setPendingAttachment(messageAttachment.tid, _extends({}, messageAttachment.data, {
19145
+ messageTid: _messageToSend.tid,
19146
+ channelId: channel.id
19147
+ }));
19148
+ messageForSend = _extends({}, _messageToSend, {
19149
+ attachments: [messageAttachment],
19150
+ createdAt: new Date(Date.now())
19151
+ });
19152
+ messagesToSend.push(messageForSend);
19153
+ _pending = _extends({}, messageForSend, {
19154
+ attachments: [attachment],
19155
+ createdAt: new Date(Date.now())
19156
+ });
19157
+ pendingMessages.push(_pending);
19158
+ _context2.n = 1;
19159
+ return call(updateMessage$1, action.type, _pending, channel);
19160
+ case 1:
19161
+ _context2.n = 3;
19162
+ break;
19163
+ case 2:
19164
+ attachmentsToSend.push(messageAttachment);
19165
+ case 3:
19178
19166
  if (!(!messageAttachment.cachedUrl && customUploader)) {
19179
- _context.n = 1;
19167
+ _context2.n = 4;
19180
19168
  break;
19181
19169
  }
19182
- _context.n = 1;
19170
+ _context2.n = 4;
19183
19171
  return put(updateAttachmentUploadingStateAC(UPLOAD_STATE.UPLOADING, messageAttachment.tid));
19184
- case 1:
19185
- return _context.a(2);
19172
+ case 4:
19173
+ return _context2.a(2);
19186
19174
  }
19187
- }, _callee);
19175
+ }, _callee2);
19188
19176
  });
19189
19177
  i = 0;
19190
19178
  case 8:
19191
19179
  if (!(i < mediaAttachments.length)) {
19192
- _context3.n = 10;
19180
+ _context4.n = 10;
19193
19181
  break;
19194
19182
  }
19195
- return _context3.d(_regeneratorValues(_loop()), 9);
19183
+ return _context4.d(_regeneratorValues(_loop()), 9);
19196
19184
  case 9:
19197
19185
  i++;
19198
- _context3.n = 8;
19186
+ _context4.n = 8;
19199
19187
  break;
19200
19188
  case 10:
19201
- if (!sendAttachmentsAsSeparateMessage) {
19202
- messageBuilder = channel.createMessageBuilder();
19203
- messageBuilder.setBody(message.body).setBodyAttributes(message.bodyAttributes).setAttachments(message.attachments).setMentionUserIds(mentionedUserIds).setType(message.type).setDisplayCount(message.type === MESSAGE_TYPE.SYSTEM ? 0 : 1).setSilent(message.type === MESSAGE_TYPE.SYSTEM).setMetadata(JSON.stringify(message.metadata));
19204
- if (message.parentMessage) {
19205
- messageBuilder.setParentMessageId(message.parentMessage ? message.parentMessage.id : null);
19206
- }
19207
- if (message.repliedInThread) {
19208
- messageBuilder.setReplyInThread();
19209
- }
19210
- messageToSend = action.type === RESEND_MESSAGE ? action.payload.message : messageBuilder.create();
19211
- pending = _extends({}, messageToSend, {
19212
- attachments: message.attachments,
19213
- createdAt: new Date(Date.now())
19214
- });
19215
- pendingMessages.push(pending);
19216
- updateMessage$1(action.type, pending, channel);
19217
- messageToSend = _extends({}, messageToSend, {
19218
- attachments: attachmentsToSend
19219
- });
19220
- messagesToSend.push(messageToSend);
19189
+ if (sendAttachmentsAsSeparateMessage) {
19190
+ _context4.n = 12;
19191
+ break;
19221
19192
  }
19193
+ messageBuilder = channel.createMessageBuilder();
19194
+ messageBuilder.setBody(message.body).setBodyAttributes(message.bodyAttributes).setAttachments(message.attachments).setMentionUserIds(mentionedUserIds).setType(message.type).setDisplayCount(message.type === MESSAGE_TYPE.SYSTEM ? 0 : 1).setSilent(message.type === MESSAGE_TYPE.SYSTEM).setMetadata(JSON.stringify(message.metadata));
19195
+ if (message.parentMessage) {
19196
+ messageBuilder.setParentMessageId(message.parentMessage ? message.parentMessage.id : null);
19197
+ }
19198
+ if (message.repliedInThread) {
19199
+ messageBuilder.setReplyInThread();
19200
+ }
19201
+ messageToSend = action.type === RESEND_MESSAGE ? action.payload.message : messageBuilder.create();
19202
+ pending = _extends({}, messageToSend, {
19203
+ attachments: message.attachments,
19204
+ createdAt: new Date(Date.now())
19205
+ });
19206
+ pendingMessages.push(pending);
19207
+ _context4.n = 11;
19208
+ return call(updateMessage$1, action.type, pending, channel);
19222
19209
  case 11:
19223
- _loop2 = /*#__PURE__*/_regenerator().m(function _callee2() {
19224
- var messageAttachment, messageToSend, messageCopy, _attachmentsToSend, linkAttachmentToSend, linkAttachmentBuilder, messageResponse, k, pendingAttachment, attachmentsToUpdate, currentAttachmentsMap, messageUpdateData, messageToUpdate, channelUpdateParam, pendingMessage, _t;
19225
- return _regenerator().w(function (_context2) {
19226
- while (1) switch (_context2.p = _context2.n) {
19210
+ messageToSend = _extends({}, messageToSend, {
19211
+ attachments: attachmentsToSend
19212
+ });
19213
+ messagesToSend.push(messageToSend);
19214
+ case 12:
19215
+ _loop2 = /*#__PURE__*/_regenerator().m(function _callee3() {
19216
+ var messageAttachment, messageToSend, messageCopy, _attachmentsToSend, linkAttachmentToSend, linkAttachmentBuilder, messageResponse, k, pendingAttachment, attachmentsToUpdate, currentAttachmentsMap, messageUpdateData, messageToUpdate, channelUpdateParam, pendingMessage, connectionIsDisconnected, _t;
19217
+ return _regenerator().w(function (_context3) {
19218
+ while (1) switch (_context3.p = _context3.n) {
19227
19219
  case 0:
19228
19220
  messageAttachment = messagesToSend[_i].attachments;
19229
19221
  messageToSend = messagesToSend[_i];
19230
- _context2.p = 1;
19222
+ _context3.p = 1;
19231
19223
  messageCopy = JSON.parse(JSON.stringify(messagesToSend[_i]));
19232
19224
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
19233
- _context2.n = 12;
19225
+ _context3.n = 12;
19234
19226
  break;
19235
19227
  }
19236
19228
  _attachmentsToSend = messageAttachment;
19237
19229
  if (!customUploader) {
19238
- _context2.n = 3;
19230
+ _context3.n = 3;
19239
19231
  break;
19240
19232
  }
19241
- _context2.n = 2;
19233
+ _context3.n = 2;
19242
19234
  return call(handleUploadAttachments, messageAttachment || [], messageCopy, channel);
19243
19235
  case 2:
19244
- _attachmentsToSend = _context2.v;
19236
+ _attachmentsToSend = _context3.v;
19245
19237
  case 3:
19246
19238
  linkAttachmentToSend = null;
19247
19239
  if (_i === 0 && linkAttachment) {
@@ -19257,18 +19249,18 @@ function sendMessage(action) {
19257
19249
  attachments: [].concat(_attachmentsToSend)
19258
19250
  });
19259
19251
  }
19260
- _context2.n = 4;
19252
+ _context3.n = 4;
19261
19253
  return call(channel.sendMessage, messageToSend);
19262
19254
  case 4:
19263
- messageResponse = _context2.v;
19255
+ messageResponse = _context3.v;
19264
19256
  if (!customUploader) {
19265
- _context2.n = 8;
19257
+ _context3.n = 8;
19266
19258
  break;
19267
19259
  }
19268
19260
  k = 0;
19269
19261
  case 5:
19270
19262
  if (!(k < messageAttachment.length)) {
19271
- _context2.n = 8;
19263
+ _context3.n = 8;
19272
19264
  break;
19273
19265
  }
19274
19266
  messageResponse.attachments[k] = _extends({}, messageResponse.attachments[k], {
@@ -19282,13 +19274,13 @@ function sendMessage(action) {
19282
19274
  checksum: pendingAttachment.checksum || (pendingAttachment === null || pendingAttachment === void 0 ? void 0 : pendingAttachment.file)
19283
19275
  })], 'checksum');
19284
19276
  }
19285
- _context2.n = 6;
19277
+ _context3.n = 6;
19286
19278
  return put(removeAttachmentProgressAC(messageAttachment[k].tid));
19287
19279
  case 6:
19288
19280
  deletePendingAttachment(messageAttachment[k].tid);
19289
19281
  case 7:
19290
19282
  k++;
19291
- _context2.n = 5;
19283
+ _context3.n = 5;
19292
19284
  break;
19293
19285
  case 8:
19294
19286
  if (action.type === RESEND_MESSAGE) {
@@ -19326,7 +19318,7 @@ function sendMessage(action) {
19326
19318
  createdAt: messageResponse.createdAt,
19327
19319
  channelId: channel.id
19328
19320
  };
19329
- _context2.n = 9;
19321
+ _context3.n = 9;
19330
19322
  return put(updateMessageAC(messageToSend.tid, JSON.parse(JSON.stringify(messageUpdateData))));
19331
19323
  case 9:
19332
19324
  updateMessageOnMap(channel.id, {
@@ -19341,48 +19333,55 @@ function sendMessage(action) {
19341
19333
  lastReactedMessage: null
19342
19334
  };
19343
19335
  if (!channel.unread) {
19344
- _context2.n = 10;
19336
+ _context3.n = 10;
19345
19337
  break;
19346
19338
  }
19347
- _context2.n = 10;
19339
+ _context3.n = 10;
19348
19340
  return put(markChannelAsReadAC(channel.id));
19349
19341
  case 10:
19350
- _context2.n = 11;
19342
+ _context3.n = 11;
19351
19343
  return put(updateChannelDataAC(channel.id, channelUpdateParam, true));
19352
19344
  case 11:
19353
19345
  updateChannelOnAllChannels(channel.id, channelUpdateParam);
19354
- _context2.n = 13;
19346
+ _context3.n = 13;
19355
19347
  break;
19356
19348
  case 12:
19357
19349
  throw new Error('Connection required to send message');
19358
19350
  case 13:
19359
- _context2.n = 17;
19351
+ _context3.n = 19;
19360
19352
  break;
19361
19353
  case 14:
19362
- _context2.p = 14;
19363
- _t = _context2.v;
19354
+ _context3.p = 14;
19355
+ _t = _context3.v;
19364
19356
  pendingMessage = pendingMessages === null || pendingMessages === void 0 ? void 0 : pendingMessages.find(function (pendingMessage) {
19365
19357
  return pendingMessage.tid === messageToSend.tid;
19366
19358
  });
19367
19359
  if (!(channel && pendingMessage && action.type !== RESEND_MESSAGE)) {
19368
- _context2.n = 15;
19360
+ _context3.n = 17;
19369
19361
  break;
19370
19362
  }
19371
- if (!isAddToPendingMessagesMap) {
19372
- _context2.n = 15;
19363
+ connectionIsDisconnected = store.getState().UserReducer.connectionStatus !== CONNECTION_STATUS.CONNECTED;
19364
+ if (!(isAddToPendingMessagesMap && connectionIsDisconnected)) {
19365
+ _context3.n = 16;
19373
19366
  break;
19374
19367
  }
19375
- _context2.n = 15;
19368
+ _context3.n = 15;
19376
19369
  return call(addPendingMessage, message, pendingMessage, channel);
19377
19370
  case 15:
19371
+ _context3.n = 17;
19372
+ break;
19373
+ case 16:
19374
+ _context3.n = 17;
19375
+ return put(removePendingMessageAC(channel.id, pendingMessage.tid));
19376
+ case 17:
19378
19377
  log.error('Error on uploading attachment', messageToSend.tid, _t);
19379
19378
  if (!(messageToSend.attachments && messageToSend.attachments.length)) {
19380
- _context2.n = 16;
19379
+ _context3.n = 18;
19381
19380
  break;
19382
19381
  }
19383
- _context2.n = 16;
19382
+ _context3.n = 18;
19384
19383
  return put(updateAttachmentUploadingStateAC(UPLOAD_STATE.FAIL, messageToSend.attachments[0].tid));
19385
- case 16:
19384
+ case 18:
19386
19385
  updateMessageOnMap(channel.id, {
19387
19386
  messageId: messageToSend.tid,
19388
19387
  params: {
@@ -19392,52 +19391,58 @@ function sendMessage(action) {
19392
19391
  updateMessageOnAllMessages(messageToSend.tid, {
19393
19392
  state: MESSAGE_STATUS.FAILED
19394
19393
  });
19395
- _context2.n = 17;
19394
+ _context3.n = 19;
19396
19395
  return put(updateMessageAC(messageToSend.tid, {
19397
19396
  state: MESSAGE_STATUS.FAILED
19398
19397
  }));
19399
- case 17:
19400
- return _context2.a(2);
19398
+ case 19:
19399
+ return _context3.a(2);
19401
19400
  }
19402
- }, _callee2, null, [[1, 14]]);
19401
+ }, _callee3, null, [[1, 14]]);
19403
19402
  });
19404
19403
  _i = 0;
19405
- case 12:
19404
+ case 13:
19406
19405
  if (!(_i < messagesToSend.length)) {
19407
- _context3.n = 14;
19406
+ _context4.n = 15;
19408
19407
  break;
19409
19408
  }
19410
- return _context3.d(_regeneratorValues(_loop2()), 13);
19411
- case 13:
19412
- _i++;
19413
- _context3.n = 12;
19414
- break;
19409
+ return _context4.d(_regeneratorValues(_loop2()), 14);
19415
19410
  case 14:
19416
- _context3.n = 16;
19411
+ _i++;
19412
+ _context4.n = 13;
19417
19413
  break;
19418
19414
  case 15:
19419
- _context3.p = 15;
19420
- _t2 = _context3.v;
19421
- log.error('error on send message ... ', _t2);
19415
+ _context4.n = 17;
19416
+ break;
19422
19417
  case 16:
19423
- return _context3.a(2);
19418
+ _context4.p = 16;
19419
+ _t2 = _context4.v;
19420
+ log.error('error on send message ... ', _t2);
19421
+ case 17:
19422
+ _context4.p = 17;
19423
+ _context4.n = 18;
19424
+ return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
19425
+ case 18:
19426
+ return _context4.f(17);
19427
+ case 19:
19428
+ return _context4.a(2);
19424
19429
  }
19425
- }, _marked$3, null, [[1, 15]]);
19430
+ }, _marked$3, null, [[1, 16, 17, 19]]);
19426
19431
  }
19427
19432
  function sendTextMessage(action) {
19428
- var payload, message, connectionState, channelId, isAddToPendingMessagesMap, channel, sendMessageTid, pendingMessage, activeChannelId, SceytChatClient, createChannelData, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, createdMessage, messageToSend, _messageResponse, messageResponse, messageUpdateData, messageToUpdate, channelUpdateParam, _t3;
19429
- return _regenerator().w(function (_context4) {
19430
- while (1) switch (_context4.p = _context4.n) {
19433
+ var payload, message, connectionState, channelId, isAddToPendingMessagesMap, channel, sendMessageTid, pendingMessage, activeChannelId, SceytChatClient, createChannelData, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, createdMessage, messageToSend, _messageResponse, messageResponse, messageUpdateData, messageToUpdate, channelUpdateParam, connectionIsDisconnected, _t3;
19434
+ return _regenerator().w(function (_context5) {
19435
+ while (1) switch (_context5.p = _context5.n) {
19431
19436
  case 0:
19432
19437
  payload = action.payload;
19433
19438
  message = payload.message, connectionState = payload.connectionState, channelId = payload.channelId, isAddToPendingMessagesMap = payload.isAddToPendingMessagesMap;
19434
- _context4.n = 1;
19439
+ _context5.n = 1;
19435
19440
  return put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
19436
19441
  case 1:
19437
- _context4.n = 2;
19442
+ _context5.n = 2;
19438
19443
  return call(getChannelFromMap, channelId);
19439
19444
  case 2:
19440
- channel = _context4.v;
19445
+ channel = _context5.v;
19441
19446
  if (!channel) {
19442
19447
  channel = getChannelFromAllChannels(channelId);
19443
19448
  if (channel) {
@@ -19446,9 +19451,9 @@ function sendTextMessage(action) {
19446
19451
  }
19447
19452
  pendingMessage = null;
19448
19453
  activeChannelId = getActiveChannelId();
19449
- _context4.p = 3;
19454
+ _context5.p = 3;
19450
19455
  if (!channel.isMockChannel) {
19451
- _context4.n = 6;
19456
+ _context5.n = 6;
19452
19457
  break;
19453
19458
  }
19454
19459
  SceytChatClient = getClient();
@@ -19458,17 +19463,17 @@ function sendTextMessage(action) {
19458
19463
  members: channel.members,
19459
19464
  metadata: ''
19460
19465
  };
19461
- _context4.n = 4;
19466
+ _context5.n = 4;
19462
19467
  return call(SceytChatClient.Channel.create, createChannelData);
19463
19468
  case 4:
19464
- channel = _context4.v;
19465
- _context4.n = 5;
19469
+ channel = _context5.v;
19470
+ _context5.n = 5;
19466
19471
  return put(switchChannelActionAC(JSON.parse(JSON.stringify(channel))));
19467
19472
  case 5:
19468
19473
  addChannelToAllChannels(channel);
19469
19474
  setChannelInMap(channel);
19470
19475
  case 6:
19471
- _context4.n = 7;
19476
+ _context5.n = 7;
19472
19477
  return put(addChannelAC(JSON.parse(JSON.stringify(channel))));
19473
19478
  case 7:
19474
19479
  mentionedUserIds = message.mentionedUsers ? message.mentionedUsers.map(function (member) {
@@ -19501,29 +19506,33 @@ function sendTextMessage(action) {
19501
19506
  if (pendingMessage && pendingMessage.metadata) {
19502
19507
  pendingMessage.metadata = JSON.parse(pendingMessage.metadata);
19503
19508
  }
19504
- if (pendingMessage) {
19505
- updateMessage$1(action.type, pendingMessage, channel);
19509
+ if (!pendingMessage) {
19510
+ _context5.n = 8;
19511
+ break;
19506
19512
  }
19513
+ _context5.n = 8;
19514
+ return call(updateMessage$1, action.type, pendingMessage, channel);
19515
+ case 8:
19507
19516
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
19508
- _context4.n = 15;
19517
+ _context5.n = 16;
19509
19518
  break;
19510
19519
  }
19511
19520
  if (!sendMessageHandler) {
19512
- _context4.n = 9;
19521
+ _context5.n = 10;
19513
19522
  break;
19514
19523
  }
19515
- _context4.n = 8;
19524
+ _context5.n = 9;
19516
19525
  return call(sendMessageHandler, messageToSend, channel.id);
19517
- case 8:
19518
- messageResponse = _context4.v;
19519
- _context4.n = 11;
19520
- break;
19521
19526
  case 9:
19522
- _context4.n = 10;
19523
- return call(channel.sendMessage, messageToSend);
19527
+ messageResponse = _context5.v;
19528
+ _context5.n = 12;
19529
+ break;
19524
19530
  case 10:
19525
- messageResponse = _context4.v;
19531
+ _context5.n = 11;
19532
+ return call(channel.sendMessage, messageToSend);
19526
19533
  case 11:
19534
+ messageResponse = _context5.v;
19535
+ case 12:
19527
19536
  messageUpdateData = {
19528
19537
  id: messageResponse.id,
19529
19538
  body: messageResponse.body,
@@ -19542,12 +19551,12 @@ function sendTextMessage(action) {
19542
19551
  channelId: channel.id
19543
19552
  };
19544
19553
  if (!(activeChannelId === channel.id)) {
19545
- _context4.n = 12;
19554
+ _context5.n = 13;
19546
19555
  break;
19547
19556
  }
19548
- _context4.n = 12;
19557
+ _context5.n = 13;
19549
19558
  return put(updateMessageAC(messageToSend.tid, messageUpdateData));
19550
- case 12:
19559
+ case 13:
19551
19560
  updateMessageOnMap(channel.id, {
19552
19561
  messageId: !isAddToPendingMessagesMap ? message.tid : messageToSend.tid,
19553
19562
  params: messageUpdateData
@@ -19561,45 +19570,49 @@ function sendTextMessage(action) {
19561
19570
  lastMessage: messageToUpdate,
19562
19571
  lastReactedMessage: null
19563
19572
  };
19564
- _context4.n = 13;
19573
+ _context5.n = 14;
19565
19574
  return put(updateChannelDataAC(channel.id, channelUpdateParam, true));
19566
- case 13:
19575
+ case 14:
19567
19576
  updateChannelOnAllChannels(channel.id, channelUpdateParam);
19568
19577
  if (!channel.unread) {
19569
- _context4.n = 14;
19578
+ _context5.n = 15;
19570
19579
  break;
19571
19580
  }
19572
- _context4.n = 14;
19581
+ _context5.n = 15;
19573
19582
  return put(markChannelAsReadAC(channel.id));
19574
- case 14:
19583
+ case 15:
19575
19584
  channel.lastMessage = messageToUpdate;
19576
19585
  if (action.type === RESEND_MESSAGE) {
19577
19586
  messageToSend.tid && store.dispatch(removePendingMessageAC(channel.id, messageToSend.tid));
19578
19587
  }
19579
- _context4.n = 16;
19588
+ _context5.n = 17;
19580
19589
  break;
19581
- case 15:
19582
- throw new Error('Connection required to send message');
19583
19590
  case 16:
19584
- _context4.n = 17;
19585
- return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
19591
+ throw new Error('Connection required to send message');
19586
19592
  case 17:
19587
- _context4.n = 21;
19593
+ _context5.n = 22;
19588
19594
  break;
19589
19595
  case 18:
19590
- _context4.p = 18;
19591
- _t3 = _context4.v;
19596
+ _context5.p = 18;
19597
+ _t3 = _context5.v;
19592
19598
  if (!(activeChannelId === channel.id && pendingMessage && action.type !== RESEND_MESSAGE)) {
19593
- _context4.n = 19;
19599
+ _context5.n = 21;
19594
19600
  break;
19595
19601
  }
19596
- if (!isAddToPendingMessagesMap) {
19597
- _context4.n = 19;
19602
+ connectionIsDisconnected = store.getState().UserReducer.connectionStatus !== CONNECTION_STATUS.CONNECTED;
19603
+ if (!(isAddToPendingMessagesMap && connectionIsDisconnected)) {
19604
+ _context5.n = 20;
19598
19605
  break;
19599
19606
  }
19600
- _context4.n = 19;
19607
+ _context5.n = 19;
19601
19608
  return call(addPendingMessage, message, pendingMessage, channel);
19602
19609
  case 19:
19610
+ _context5.n = 21;
19611
+ break;
19612
+ case 20:
19613
+ _context5.n = 21;
19614
+ return put(removePendingMessageAC(channel.id, pendingMessage.tid));
19615
+ case 21:
19603
19616
  log.error('error on send text message ... ', _t3);
19604
19617
  updateMessageOnMap(channel.id, {
19605
19618
  messageId: sendMessageTid,
@@ -19608,28 +19621,31 @@ function sendTextMessage(action) {
19608
19621
  }
19609
19622
  });
19610
19623
  if (!(activeChannelId === channel.id)) {
19611
- _context4.n = 20;
19624
+ _context5.n = 22;
19612
19625
  break;
19613
19626
  }
19614
19627
  updateMessageOnAllMessages(sendMessageTid, {
19615
19628
  state: MESSAGE_STATUS.FAILED
19616
19629
  });
19617
- _context4.n = 20;
19630
+ _context5.n = 22;
19618
19631
  return put(updateMessageAC(sendMessageTid, {
19619
19632
  state: MESSAGE_STATUS.FAILED
19620
19633
  }));
19621
- case 20:
19622
- _context4.n = 21;
19634
+ case 22:
19635
+ _context5.p = 22;
19636
+ _context5.n = 23;
19623
19637
  return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
19624
- case 21:
19625
- return _context4.a(2);
19638
+ case 23:
19639
+ return _context5.f(22);
19640
+ case 24:
19641
+ return _context5.a(2);
19626
19642
  }
19627
- }, _marked2$2, null, [[3, 18]]);
19643
+ }, _marked2$2, null, [[3, 18, 22, 24]]);
19628
19644
  }
19629
19645
  function forwardMessage(action) {
19630
- var payload, message, channelId, connectionState, isForward, isAddToPendingMessagesMap, pendingMessage, channel, activeChannelId, messageTid, SceytChatClient, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, pollDetails, messageToSend, hasNextMessages, messageResponse, messageUpdateData, messageToUpdate, channelUpdateParam, _t4;
19631
- return _regenerator().w(function (_context5) {
19632
- while (1) switch (_context5.p = _context5.n) {
19646
+ var payload, message, channelId, connectionState, isForward, isAddToPendingMessagesMap, pendingMessage, channel, activeChannelId, messageTid, SceytChatClient, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, pollDetails, messageToSend, hasNextMessages, messageResponse, messageUpdateData, messageToUpdate, channelUpdateParam, connectionIsDisconnected, _t4;
19647
+ return _regenerator().w(function (_context6) {
19648
+ while (1) switch (_context6.p = _context6.n) {
19633
19649
  case 0:
19634
19650
  payload = action.payload;
19635
19651
  message = payload.message, channelId = payload.channelId, connectionState = payload.connectionState, isForward = payload.isForward, isAddToPendingMessagesMap = payload.isAddToPendingMessagesMap;
@@ -19637,35 +19653,35 @@ function forwardMessage(action) {
19637
19653
  channel = null;
19638
19654
  activeChannelId = getActiveChannelId();
19639
19655
  messageTid = null;
19640
- _context5.p = 1;
19641
- _context5.n = 2;
19656
+ _context6.p = 1;
19657
+ _context6.n = 2;
19642
19658
  return put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
19643
19659
  case 2:
19644
- _context5.n = 3;
19660
+ _context6.n = 3;
19645
19661
  return call(getChannelFromMap, channelId);
19646
19662
  case 3:
19647
- channel = _context5.v;
19663
+ channel = _context6.v;
19648
19664
  if (channel) {
19649
- _context5.n = 6;
19665
+ _context6.n = 6;
19650
19666
  break;
19651
19667
  }
19652
19668
  channel = getChannelFromAllChannels(channelId) || null;
19653
19669
  if (channel) {
19654
- _context5.n = 5;
19670
+ _context6.n = 5;
19655
19671
  break;
19656
19672
  }
19657
19673
  SceytChatClient = getClient();
19658
- _context5.n = 4;
19674
+ _context6.n = 4;
19659
19675
  return call(SceytChatClient.getChannel, channelId);
19660
19676
  case 4:
19661
- channel = _context5.v;
19677
+ channel = _context6.v;
19662
19678
  case 5:
19663
19679
  if (channel) {
19664
19680
  setChannelInMap(channel);
19665
19681
  }
19666
19682
  case 6:
19667
19683
  if (channel) {
19668
- _context5.n = 7;
19684
+ _context6.n = 7;
19669
19685
  break;
19670
19686
  }
19671
19687
  throw new Error('Channel not found');
@@ -19675,7 +19691,7 @@ function forwardMessage(action) {
19675
19691
  }) : [];
19676
19692
  attachments = message.attachments;
19677
19693
  if ((channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST || channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC) && !(channel.userRole === 'admin' || channel.userRole === 'owner')) {
19678
- _context5.n = 15;
19694
+ _context6.n = 16;
19679
19695
  break;
19680
19696
  }
19681
19697
  if (message.attachments && message.attachments.length) {
@@ -19719,32 +19735,36 @@ function forwardMessage(action) {
19719
19735
  pendingMessage.forwardingDetails.hops = message.forwardingDetails ? message.forwardingDetails.hops : 1;
19720
19736
  }
19721
19737
  if (!(channelId === activeChannelId)) {
19722
- _context5.n = 8;
19738
+ _context6.n = 8;
19723
19739
  break;
19724
19740
  }
19725
19741
  hasNextMessages = store.getState().MessageReducer.messagesHasNext;
19726
19742
  if (getHasNextCached()) {
19727
- _context5.n = 8;
19743
+ _context6.n = 8;
19728
19744
  break;
19729
19745
  }
19730
19746
  if (!hasNextMessages) {
19731
- _context5.n = 8;
19747
+ _context6.n = 8;
19732
19748
  break;
19733
19749
  }
19734
- _context5.n = 8;
19750
+ _context6.n = 8;
19735
19751
  return put(getMessagesAC(channel));
19736
19752
  case 8:
19737
- if (pendingMessage) {
19738
- updateMessage$1(action.type, pendingMessage, channel, false);
19753
+ if (!pendingMessage) {
19754
+ _context6.n = 9;
19755
+ break;
19739
19756
  }
19757
+ _context6.n = 9;
19758
+ return call(updateMessage$1, action.type, pendingMessage, channel, false);
19759
+ case 9:
19740
19760
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
19741
- _context5.n = 14;
19761
+ _context6.n = 15;
19742
19762
  break;
19743
19763
  }
19744
- _context5.n = 9;
19764
+ _context6.n = 10;
19745
19765
  return call(channel.sendMessage, messageToSend);
19746
- case 9:
19747
- messageResponse = _context5.v;
19766
+ case 10:
19767
+ messageResponse = _context6.v;
19748
19768
  messageUpdateData = {
19749
19769
  id: messageResponse.id,
19750
19770
  type: messageResponse.type,
@@ -19760,14 +19780,14 @@ function forwardMessage(action) {
19760
19780
  channelId: channel.id
19761
19781
  };
19762
19782
  if (!(channelId === activeChannelId)) {
19763
- _context5.n = 11;
19783
+ _context6.n = 12;
19764
19784
  break;
19765
19785
  }
19766
- _context5.n = 10;
19786
+ _context6.n = 11;
19767
19787
  return put(updateMessageAC(messageToSend.tid, JSON.parse(JSON.stringify(messageUpdateData))));
19768
- case 10:
19769
- updateMessageOnAllMessages(messageToSend.tid, messageUpdateData);
19770
19788
  case 11:
19789
+ updateMessageOnAllMessages(messageToSend.tid, messageUpdateData);
19790
+ case 12:
19771
19791
  if (action.type === RESEND_MESSAGE) {
19772
19792
  messageToSend.tid && store.dispatch(removePendingMessageAC(channel.id, messageToSend.tid));
19773
19793
  }
@@ -19781,40 +19801,47 @@ function forwardMessage(action) {
19781
19801
  lastMessage: messageToUpdate,
19782
19802
  lastReactedMessage: null
19783
19803
  };
19784
- _context5.n = 12;
19804
+ _context6.n = 13;
19785
19805
  return put(updateChannelDataAC(channel.id, channelUpdateParam, true));
19786
- case 12:
19806
+ case 13:
19787
19807
  updateChannelOnAllChannels(channel.id, channelUpdateParam);
19788
19808
  if (!channel.unread) {
19789
- _context5.n = 13;
19809
+ _context6.n = 14;
19790
19810
  break;
19791
19811
  }
19792
- _context5.n = 13;
19812
+ _context6.n = 14;
19793
19813
  return put(markChannelAsReadAC(channel.id));
19794
- case 13:
19795
- _context5.n = 15;
19796
- break;
19797
19814
  case 14:
19798
- throw new Error('Connection required to forward message');
19799
- case 15:
19800
- _context5.n = 20;
19815
+ _context6.n = 16;
19801
19816
  break;
19817
+ case 15:
19818
+ throw new Error('Connection required to forward message');
19802
19819
  case 16:
19803
- _context5.p = 16;
19804
- _t4 = _context5.v;
19820
+ _context6.n = 22;
19821
+ break;
19822
+ case 17:
19823
+ _context6.p = 17;
19824
+ _t4 = _context6.v;
19805
19825
  if (!(pendingMessage && channel && action.type !== RESEND_MESSAGE)) {
19806
- _context5.n = 17;
19826
+ _context6.n = 20;
19807
19827
  break;
19808
19828
  }
19809
- if (!isAddToPendingMessagesMap) {
19810
- _context5.n = 17;
19829
+ connectionIsDisconnected = store.getState().UserReducer.connectionStatus !== CONNECTION_STATUS.CONNECTED;
19830
+ if (!(isAddToPendingMessagesMap && connectionIsDisconnected)) {
19831
+ _context6.n = 19;
19811
19832
  break;
19812
19833
  }
19813
- _context5.n = 17;
19834
+ _context6.n = 18;
19814
19835
  return call(addPendingMessage, message, pendingMessage, channel);
19815
- case 17:
19836
+ case 18:
19837
+ _context6.n = 20;
19838
+ break;
19839
+ case 19:
19840
+ _context6.n = 20;
19841
+ return put(removePendingMessageAC(channel.id, pendingMessage.tid));
19842
+ case 20:
19816
19843
  if (!(channel && messageTid)) {
19817
- _context5.n = 18;
19844
+ _context6.n = 21;
19818
19845
  break;
19819
19846
  }
19820
19847
  updateMessageOnMap(channel.id, {
@@ -19824,33 +19851,33 @@ function forwardMessage(action) {
19824
19851
  }
19825
19852
  });
19826
19853
  if (!(activeChannelId === channel.id)) {
19827
- _context5.n = 18;
19854
+ _context6.n = 21;
19828
19855
  break;
19829
19856
  }
19830
19857
  updateMessageOnAllMessages(messageTid, {
19831
19858
  state: MESSAGE_STATUS.FAILED
19832
19859
  });
19833
- _context5.n = 18;
19860
+ _context6.n = 21;
19834
19861
  return put(updateMessageAC(messageTid, {
19835
19862
  state: MESSAGE_STATUS.FAILED
19836
19863
  }));
19837
- case 18:
19838
- _context5.n = 19;
19839
- return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
19840
- case 19:
19864
+ case 21:
19841
19865
  log.error('error on forward message ... ', _t4);
19842
- case 20:
19843
- _context5.n = 21;
19866
+ case 22:
19867
+ _context6.p = 22;
19868
+ _context6.n = 23;
19844
19869
  return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
19845
- case 21:
19846
- return _context5.a(2);
19870
+ case 23:
19871
+ return _context6.f(22);
19872
+ case 24:
19873
+ return _context6.a(2);
19847
19874
  }
19848
- }, _marked3$1, null, [[1, 16]]);
19875
+ }, _marked3$1, null, [[1, 17, 22, 24]]);
19849
19876
  }
19850
19877
  function resendMessage(action) {
19851
19878
  var payload, message, connectionState, channelId, sendAttachmentsAsSeparateMessage, isVoiceMessage;
19852
- return _regenerator().w(function (_context6) {
19853
- while (1) switch (_context6.n) {
19879
+ return _regenerator().w(function (_context7) {
19880
+ while (1) switch (_context7.n) {
19854
19881
  case 0:
19855
19882
  payload = action.payload;
19856
19883
  message = payload.message, connectionState = payload.connectionState, channelId = payload.channelId;
@@ -19864,33 +19891,33 @@ function resendMessage(action) {
19864
19891
  store.dispatch(sendTextMessageAC(message, channelId, connectionState, false));
19865
19892
  }
19866
19893
  case 1:
19867
- return _context6.a(2);
19894
+ return _context7.a(2);
19868
19895
  }
19869
19896
  }, _marked4$1);
19870
19897
  }
19871
19898
  function deleteMessage(action) {
19872
19899
  var payload, messageId, channelId, deleteOption, channel, deletedMessage, messageToUpdate, _t5;
19873
- return _regenerator().w(function (_context7) {
19874
- while (1) switch (_context7.p = _context7.n) {
19900
+ return _regenerator().w(function (_context8) {
19901
+ while (1) switch (_context8.p = _context8.n) {
19875
19902
  case 0:
19876
- _context7.p = 0;
19903
+ _context8.p = 0;
19877
19904
  payload = action.payload;
19878
19905
  messageId = payload.messageId, channelId = payload.channelId, deleteOption = payload.deleteOption;
19879
- _context7.n = 1;
19906
+ _context8.n = 1;
19880
19907
  return call(getChannelFromMap, channelId);
19881
19908
  case 1:
19882
- channel = _context7.v;
19909
+ channel = _context8.v;
19883
19910
  if (!channel) {
19884
19911
  channel = getChannelFromAllChannels(channelId);
19885
19912
  if (channel) {
19886
19913
  setChannelInMap(channel);
19887
19914
  }
19888
19915
  }
19889
- _context7.n = 2;
19916
+ _context8.n = 2;
19890
19917
  return call(channel.deleteMessageById, messageId, deleteOption === 'forMe');
19891
19918
  case 2:
19892
- deletedMessage = _context7.v;
19893
- _context7.n = 3;
19919
+ deletedMessage = _context8.v;
19920
+ _context8.n = 3;
19894
19921
  return put(updateMessageAC(deletedMessage.id, deletedMessage));
19895
19922
  case 3:
19896
19923
  updateMessageOnMap(channel.id, {
@@ -19901,35 +19928,35 @@ function deleteMessage(action) {
19901
19928
  messageToUpdate = JSON.parse(JSON.stringify(deletedMessage));
19902
19929
  updateChannelLastMessageOnAllChannels(channel.id, messageToUpdate);
19903
19930
  if (!(channel.lastMessage.id === messageId)) {
19904
- _context7.n = 4;
19931
+ _context8.n = 4;
19905
19932
  break;
19906
19933
  }
19907
- _context7.n = 4;
19934
+ _context8.n = 4;
19908
19935
  return put(updateChannelLastMessageAC(messageToUpdate, channel));
19909
19936
  case 4:
19910
- _context7.n = 6;
19937
+ _context8.n = 6;
19911
19938
  break;
19912
19939
  case 5:
19913
- _context7.p = 5;
19914
- _t5 = _context7.v;
19940
+ _context8.p = 5;
19941
+ _t5 = _context8.v;
19915
19942
  log.error('ERROR in delete message', _t5.message);
19916
19943
  case 6:
19917
- return _context7.a(2);
19944
+ return _context8.a(2);
19918
19945
  }
19919
19946
  }, _marked5$1, null, [[0, 5]]);
19920
19947
  }
19921
19948
  function editMessage(action) {
19922
19949
  var payload, message, channelId, channel, linkAttachments, anotherAttachments, linkAttachmentsToSend, editedMessage, messageToUpdate, _t6;
19923
- return _regenerator().w(function (_context8) {
19924
- while (1) switch (_context8.p = _context8.n) {
19950
+ return _regenerator().w(function (_context9) {
19951
+ while (1) switch (_context9.p = _context9.n) {
19925
19952
  case 0:
19926
- _context8.p = 0;
19953
+ _context9.p = 0;
19927
19954
  payload = action.payload;
19928
19955
  message = payload.message, channelId = payload.channelId;
19929
- _context8.n = 1;
19956
+ _context9.n = 1;
19930
19957
  return call(getChannelFromMap, channelId);
19931
19958
  case 1:
19932
- channel = _context8.v;
19959
+ channel = _context9.v;
19933
19960
  if (!channel) {
19934
19961
  channel = getChannelFromAllChannels(channelId);
19935
19962
  if (channel) {
@@ -19951,7 +19978,7 @@ function editMessage(action) {
19951
19978
  });
19952
19979
  message.attachments = [].concat(anotherAttachments, linkAttachmentsToSend);
19953
19980
  }
19954
- _context8.n = 2;
19981
+ _context9.n = 2;
19955
19982
  return call(channel.editMessage, _extends({}, message, {
19956
19983
  metadata: isJSON(message.metadata) ? message.metadata : JSON.stringify(message.metadata),
19957
19984
  attachments: message.attachments.map(function (att) {
@@ -19961,8 +19988,8 @@ function editMessage(action) {
19961
19988
  })
19962
19989
  }));
19963
19990
  case 2:
19964
- editedMessage = _context8.v;
19965
- _context8.n = 3;
19991
+ editedMessage = _context9.v;
19992
+ _context9.n = 3;
19966
19993
  return put(updateMessageAC(editedMessage.id, editedMessage));
19967
19994
  case 3:
19968
19995
  updateMessageOnMap(channel.id, {
@@ -19971,54 +19998,54 @@ function editMessage(action) {
19971
19998
  });
19972
19999
  updateMessageOnAllMessages(message.id, editedMessage);
19973
20000
  if (!(channel.lastMessage.id === message.id)) {
19974
- _context8.n = 4;
20001
+ _context9.n = 4;
19975
20002
  break;
19976
20003
  }
19977
20004
  messageToUpdate = JSON.parse(JSON.stringify(editedMessage));
19978
20005
  updateChannelLastMessageOnAllChannels(channel.id, messageToUpdate);
19979
- _context8.n = 4;
20006
+ _context9.n = 4;
19980
20007
  return put(updateChannelLastMessageAC(messageToUpdate, channel));
19981
20008
  case 4:
19982
- _context8.n = 6;
20009
+ _context9.n = 6;
19983
20010
  break;
19984
20011
  case 5:
19985
- _context8.p = 5;
19986
- _t6 = _context8.v;
20012
+ _context9.p = 5;
20013
+ _t6 = _context9.v;
19987
20014
  log.error('ERROR in edit message', _t6.message);
19988
20015
  case 6:
19989
- return _context8.a(2);
20016
+ return _context9.a(2);
19990
20017
  }
19991
20018
  }, _marked6$1, null, [[0, 5]]);
19992
20019
  }
19993
- var sendPendingMessages = /*#__PURE__*/_regenerator().m(function _callee3(connectionState) {
20020
+ var sendPendingMessages = /*#__PURE__*/_regenerator().m(function _callee4(connectionState) {
19994
20021
  var pendingMessagesMap, channelId, _iterator, _step, _msg$attachments, msg, attachments, pendingPollActionsMap, _t7, _t8, _t9;
19995
- return _regenerator().w(function (_context9) {
19996
- while (1) switch (_context9.p = _context9.n) {
20022
+ return _regenerator().w(function (_context0) {
20023
+ while (1) switch (_context0.p = _context0.n) {
19997
20024
  case 0:
19998
20025
  pendingMessagesMap = _extends({}, getPendingMessagesMap());
19999
20026
  _t7 = _regeneratorKeys(pendingMessagesMap);
20000
20027
  case 1:
20001
20028
  if ((_t8 = _t7()).done) {
20002
- _context9.n = 12;
20029
+ _context0.n = 12;
20003
20030
  break;
20004
20031
  }
20005
20032
  channelId = _t8.value;
20006
20033
  _iterator = _createForOfIteratorHelperLoose(pendingMessagesMap[channelId]);
20007
20034
  case 2:
20008
20035
  if ((_step = _iterator()).done) {
20009
- _context9.n = 11;
20036
+ _context0.n = 11;
20010
20037
  break;
20011
20038
  }
20012
20039
  msg = _step.value;
20013
20040
  attachments = msg === null || msg === void 0 ? void 0 : (_msg$attachments = msg.attachments) === null || _msg$attachments === void 0 ? void 0 : _msg$attachments.filter(function (att) {
20014
20041
  return (att === null || att === void 0 ? void 0 : att.type) !== attachmentTypes.link;
20015
20042
  });
20016
- _context9.p = 3;
20043
+ _context0.p = 3;
20017
20044
  if (!(msg !== null && msg !== void 0 && msg.forwardingDetails)) {
20018
- _context9.n = 5;
20045
+ _context0.n = 5;
20019
20046
  break;
20020
20047
  }
20021
- _context9.n = 4;
20048
+ _context0.n = 4;
20022
20049
  return call(forwardMessage, {
20023
20050
  type: RESEND_MESSAGE,
20024
20051
  payload: {
@@ -20030,14 +20057,14 @@ var sendPendingMessages = /*#__PURE__*/_regenerator().m(function _callee3(connec
20030
20057
  }
20031
20058
  });
20032
20059
  case 4:
20033
- _context9.n = 8;
20060
+ _context0.n = 8;
20034
20061
  break;
20035
20062
  case 5:
20036
20063
  if (!(attachments && attachments.length > 0)) {
20037
- _context9.n = 7;
20064
+ _context0.n = 7;
20038
20065
  break;
20039
20066
  }
20040
- _context9.n = 6;
20067
+ _context0.n = 6;
20041
20068
  return call(sendMessage, {
20042
20069
  type: RESEND_MESSAGE,
20043
20070
  payload: {
@@ -20050,10 +20077,10 @@ var sendPendingMessages = /*#__PURE__*/_regenerator().m(function _callee3(connec
20050
20077
  }
20051
20078
  });
20052
20079
  case 6:
20053
- _context9.n = 8;
20080
+ _context0.n = 8;
20054
20081
  break;
20055
20082
  case 7:
20056
- _context9.n = 8;
20083
+ _context0.n = 8;
20057
20084
  return call(sendTextMessage, {
20058
20085
  type: RESEND_MESSAGE,
20059
20086
  payload: {
@@ -20064,44 +20091,72 @@ var sendPendingMessages = /*#__PURE__*/_regenerator().m(function _callee3(connec
20064
20091
  }
20065
20092
  });
20066
20093
  case 8:
20067
- _context9.n = 10;
20094
+ _context0.n = 10;
20068
20095
  break;
20069
20096
  case 9:
20070
- _context9.p = 9;
20071
- _t9 = _context9.v;
20097
+ _context0.p = 9;
20098
+ _t9 = _context0.v;
20072
20099
  log.error("Failed to send pending message " + (msg.tid || msg.id) + ":", _t9);
20073
20100
  case 10:
20074
- _context9.n = 2;
20101
+ _context0.n = 2;
20075
20102
  break;
20076
20103
  case 11:
20077
- _context9.n = 1;
20104
+ _context0.n = 1;
20078
20105
  break;
20079
20106
  case 12:
20080
20107
  pendingPollActionsMap = store.getState().MessageReducer.pendingPollActions;
20081
20108
  if (!(pendingPollActionsMap && Object.keys(pendingPollActionsMap).length > 0)) {
20082
- _context9.n = 13;
20109
+ _context0.n = 13;
20083
20110
  break;
20084
20111
  }
20085
- _context9.n = 13;
20112
+ _context0.n = 13;
20086
20113
  return put(resendPendingPollActionsAC(connectionState));
20087
20114
  case 13:
20088
- return _context9.a(2);
20115
+ return _context0.a(2);
20089
20116
  }
20090
- }, _callee3, null, [[3, 9]]);
20117
+ }, _callee4, null, [[3, 9]]);
20118
+ });
20119
+ var updateMessages = /*#__PURE__*/_regenerator().m(function _callee5(channel, updatedMessages) {
20120
+ var _messages, _Object$values;
20121
+ var previousAllMessages, messages, lastMessageId, setMappedAllMessages, allMessagesAfterLastMessage;
20122
+ return _regenerator().w(function (_context1) {
20123
+ while (1) switch (_context1.n) {
20124
+ case 0:
20125
+ previousAllMessages = getAllMessages();
20126
+ messages = [].concat(updatedMessages);
20127
+ lastMessageId = (_messages = messages[messages.length - 1]) === null || _messages === void 0 ? void 0 : _messages.id;
20128
+ setMappedAllMessages = {};
20129
+ previousAllMessages.forEach(function (msg) {
20130
+ if (msg.channelId === channel.id) {
20131
+ setMappedAllMessages[msg.id || msg.tid || ''] = msg;
20132
+ }
20133
+ });
20134
+ allMessagesAfterLastMessage = lastMessageId ? (_Object$values = Object.values(setMappedAllMessages || {})) === null || _Object$values === void 0 ? void 0 : _Object$values.filter(function (msg) {
20135
+ return msg.id > lastMessageId || !msg.id;
20136
+ }) : Object.values(setMappedAllMessages || {});
20137
+ messages = [].concat(messages, allMessagesAfterLastMessage || []);
20138
+ setMessagesToMap(channel.id, messages);
20139
+ setAllMessages(messages);
20140
+ _context1.n = 1;
20141
+ return put(setMessagesAC(JSON.parse(JSON.stringify(messages))));
20142
+ case 1:
20143
+ return _context1.a(2);
20144
+ }
20145
+ }, _callee5);
20091
20146
  });
20092
20147
  function getMessagesQuery(action) {
20093
- var _action$payload, channel, loadWithLastMessage, messageId, limit, withDeliveredMessages, highlight, behavior, connectionState, SceytChatClient, messageQueryBuilder, messageQuery, cachedMessages, result, allMessages, havLastMessage, secondResult, sentMessages, messagesMap, filteredSentMessages, _allMessages, messageIndex, maxLengthPart, _secondResult, thirdResult, _secondResult2, _thirdResult, _secondResult3, _updatedMessages, _Object$values, previousAllMessages, _secondResult4, updatedMessages, lastMessageId, _allMessages2, setMappedAllMessages, allMessagesAfterLastMessage, pendingMessages, _messagesMap, filteredPendingMessages, waitToSendPendingMessages, _t0, _t1, _t10, _t11, _t12, _t13, _t14, _t15, _t16, _t17, _t18, _t19, _t20, _t21;
20094
- return _regenerator().w(function (_context0) {
20095
- while (1) switch (_context0.p = _context0.n) {
20148
+ var _action$payload, channel, loadWithLastMessage, messageId, limit, withDeliveredMessages, highlight, behavior, scrollToMessage, connectionState, SceytChatClient, messageQueryBuilder, messageQuery, cachedMessages, result, allMessages, havLastMessage, secondResult, sentMessages, messagesMap, filteredSentMessages, _allMessages, messageIndex, maxLengthPart, _secondResult, thirdResult, _secondResult2, _thirdResult, _secondResult3, _secondResult4, updatedMessages, pendingMessages, _messagesMap, filteredPendingMessages, waitToSendPendingMessages, _t0, _t1, _t10, _t11, _t12, _t13, _t14, _t15, _t16, _t17, _t18, _t19, _t20, _t21;
20149
+ return _regenerator().w(function (_context10) {
20150
+ while (1) switch (_context10.p = _context10.n) {
20096
20151
  case 0:
20097
- _context0.p = 0;
20098
- _context0.n = 1;
20152
+ _context10.p = 0;
20153
+ _context10.n = 1;
20099
20154
  return put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
20100
20155
  case 1:
20101
- _action$payload = action.payload, channel = _action$payload.channel, loadWithLastMessage = _action$payload.loadWithLastMessage, messageId = _action$payload.messageId, limit = _action$payload.limit, withDeliveredMessages = _action$payload.withDeliveredMessages, highlight = _action$payload.highlight, behavior = _action$payload.behavior;
20156
+ _action$payload = action.payload, channel = _action$payload.channel, loadWithLastMessage = _action$payload.loadWithLastMessage, messageId = _action$payload.messageId, limit = _action$payload.limit, withDeliveredMessages = _action$payload.withDeliveredMessages, highlight = _action$payload.highlight, behavior = _action$payload.behavior, scrollToMessage = _action$payload.scrollToMessage;
20102
20157
  connectionState = store.getState().UserReducer.connectionStatus;
20103
20158
  if (!(channel.id && !channel.isMockChannel)) {
20104
- _context0.n = 76;
20159
+ _context10.n = 76;
20105
20160
  break;
20106
20161
  }
20107
20162
  SceytChatClient = getClient();
@@ -20109,14 +20164,14 @@ function getMessagesQuery(action) {
20109
20164
  messageQueryBuilder.limit(limit || MESSAGES_MAX_LENGTH);
20110
20165
  messageQueryBuilder.reverse(true);
20111
20166
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
20112
- _context0.n = 3;
20167
+ _context10.n = 3;
20113
20168
  break;
20114
20169
  }
20115
- _context0.n = 2;
20170
+ _context10.n = 2;
20116
20171
  return call(messageQueryBuilder.build);
20117
20172
  case 2:
20118
- _t0 = _context0.v;
20119
- _context0.n = 4;
20173
+ _t0 = _context10.v;
20174
+ _context10.n = 4;
20120
20175
  break;
20121
20176
  case 3:
20122
20177
  _t0 = null;
@@ -20131,27 +20186,27 @@ function getMessagesQuery(action) {
20131
20186
  hasNext: false
20132
20187
  };
20133
20188
  if (!loadWithLastMessage) {
20134
- _context0.n = 19;
20189
+ _context10.n = 19;
20135
20190
  break;
20136
20191
  }
20137
20192
  allMessages = getAllMessages();
20138
20193
  havLastMessage = allMessages && allMessages.length && channel.lastMessage && allMessages[allMessages.length - 1] && allMessages[allMessages.length - 1].id === channel.lastMessage.id;
20139
20194
  if (!(channel.newMessageCount && channel.newMessageCount > 0 || !havLastMessage)) {
20140
- _context0.n = 14;
20195
+ _context10.n = 14;
20141
20196
  break;
20142
20197
  }
20143
20198
  setHasPrevCached(false);
20144
20199
  setMessagesToMap(channel.id, []);
20145
20200
  setAllMessages([]);
20146
20201
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
20147
- _context0.n = 6;
20202
+ _context10.n = 6;
20148
20203
  break;
20149
20204
  }
20150
- _context0.n = 5;
20205
+ _context10.n = 5;
20151
20206
  return call(messageQuery.loadPreviousMessageId, '0');
20152
20207
  case 5:
20153
- _t1 = _context0.v;
20154
- _context0.n = 7;
20208
+ _t1 = _context10.v;
20209
+ _context10.n = 7;
20155
20210
  break;
20156
20211
  case 6:
20157
20212
  _t1 = {
@@ -20161,19 +20216,19 @@ function getMessagesQuery(action) {
20161
20216
  case 7:
20162
20217
  result = _t1;
20163
20218
  if (!(result.messages.length === 50)) {
20164
- _context0.n = 11;
20219
+ _context10.n = 11;
20165
20220
  break;
20166
20221
  }
20167
20222
  messageQuery.limit = 30;
20168
20223
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
20169
- _context0.n = 9;
20224
+ _context10.n = 9;
20170
20225
  break;
20171
20226
  }
20172
- _context0.n = 8;
20227
+ _context10.n = 8;
20173
20228
  return call(messageQuery.loadPreviousMessageId, result.messages[0].id);
20174
20229
  case 8:
20175
- _t10 = _context0.v;
20176
- _context0.n = 10;
20230
+ _t10 = _context10.v;
20231
+ _context10.n = 10;
20177
20232
  break;
20178
20233
  case 9:
20179
20234
  _t10 = {
@@ -20197,40 +20252,40 @@ function getMessagesQuery(action) {
20197
20252
  return !messagesMap[msg.tid || ''];
20198
20253
  });
20199
20254
  result.messages = [].concat(result.messages, filteredSentMessages).slice(filteredSentMessages.length);
20200
- _context0.n = 12;
20255
+ _context10.n = 12;
20201
20256
  return put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
20202
20257
  case 12:
20203
20258
  setMessagesToMap(channel.id, result.messages);
20204
20259
  setAllMessages(result.messages);
20205
- _context0.n = 13;
20260
+ _context10.n = 13;
20206
20261
  return put(setMessagesHasPrevAC(true));
20207
20262
  case 13:
20208
- _context0.n = 16;
20263
+ _context10.n = 16;
20209
20264
  break;
20210
20265
  case 14:
20211
20266
  result.messages = getFromAllMessagesByMessageId('', '', true);
20212
- _context0.n = 15;
20267
+ _context10.n = 15;
20213
20268
  return put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
20214
20269
  case 15:
20215
- _context0.n = 16;
20270
+ _context10.n = 16;
20216
20271
  return put(setMessagesHasPrevAC(true));
20217
20272
  case 16:
20218
- _context0.n = 17;
20273
+ _context10.n = 17;
20219
20274
  return put(setMessagesHasNextAC(false));
20220
20275
  case 17:
20221
20276
  setHasNextCached(false);
20222
- if (!messageId) {
20223
- _context0.n = 18;
20277
+ if (!(messageId && scrollToMessage)) {
20278
+ _context10.n = 18;
20224
20279
  break;
20225
20280
  }
20226
- _context0.n = 18;
20281
+ _context10.n = 18;
20227
20282
  return put(setScrollToMessagesAC(messageId, highlight, behavior));
20228
20283
  case 18:
20229
- _context0.n = 72;
20284
+ _context10.n = 72;
20230
20285
  break;
20231
20286
  case 19:
20232
20287
  if (!messageId) {
20233
- _context0.n = 38;
20288
+ _context10.n = 38;
20234
20289
  break;
20235
20290
  }
20236
20291
  _allMessages = getAllMessages();
@@ -20239,32 +20294,32 @@ function getMessagesQuery(action) {
20239
20294
  });
20240
20295
  maxLengthPart = MESSAGES_MAX_LENGTH / 2;
20241
20296
  if (!(messageIndex >= maxLengthPart)) {
20242
- _context0.n = 22;
20297
+ _context10.n = 22;
20243
20298
  break;
20244
20299
  }
20245
20300
  result.messages = _allMessages.slice(messageIndex - maxLengthPart, messageIndex + maxLengthPart);
20246
- _context0.n = 20;
20301
+ _context10.n = 20;
20247
20302
  return put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
20248
20303
  case 20:
20249
20304
  setHasPrevCached(messageIndex > maxLengthPart);
20250
20305
  setHasNextCached(_allMessages.length > maxLengthPart);
20251
- _context0.n = 21;
20306
+ _context10.n = 21;
20252
20307
  return put(setMessagesHasPrevAC(true));
20253
20308
  case 21:
20254
- _context0.n = 34;
20309
+ _context10.n = 34;
20255
20310
  break;
20256
20311
  case 22:
20257
20312
  messageQuery.limit = MESSAGES_MAX_LENGTH;
20258
20313
  log.info('load by message id from server ...............', messageId);
20259
20314
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
20260
- _context0.n = 24;
20315
+ _context10.n = 24;
20261
20316
  break;
20262
20317
  }
20263
- _context0.n = 23;
20318
+ _context10.n = 23;
20264
20319
  return call(messageQuery.loadNearMessageId, messageId);
20265
20320
  case 23:
20266
- _t11 = _context0.v;
20267
- _context0.n = 25;
20321
+ _t11 = _context10.v;
20322
+ _context10.n = 25;
20268
20323
  break;
20269
20324
  case 24:
20270
20325
  _t11 = {
@@ -20274,19 +20329,19 @@ function getMessagesQuery(action) {
20274
20329
  case 25:
20275
20330
  result = _t11;
20276
20331
  if (!(result.messages.length === 50)) {
20277
- _context0.n = 32;
20332
+ _context10.n = 32;
20278
20333
  break;
20279
20334
  }
20280
20335
  messageQuery.limit = MESSAGES_MAX_LENGTH - 50;
20281
20336
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
20282
- _context0.n = 27;
20337
+ _context10.n = 27;
20283
20338
  break;
20284
20339
  }
20285
- _context0.n = 26;
20340
+ _context10.n = 26;
20286
20341
  return call(messageQuery.loadPreviousMessageId, result.messages[0].id);
20287
20342
  case 26:
20288
- _t12 = _context0.v;
20289
- _context0.n = 28;
20343
+ _t12 = _context10.v;
20344
+ _context10.n = 28;
20290
20345
  break;
20291
20346
  case 27:
20292
20347
  _t12 = {
@@ -20297,14 +20352,14 @@ function getMessagesQuery(action) {
20297
20352
  _secondResult = _t12;
20298
20353
  messageQuery.reverse = false;
20299
20354
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
20300
- _context0.n = 30;
20355
+ _context10.n = 30;
20301
20356
  break;
20302
20357
  }
20303
- _context0.n = 29;
20358
+ _context10.n = 29;
20304
20359
  return call(messageQuery.loadNextMessageId, result.messages[result.messages.length - 1].id);
20305
20360
  case 29:
20306
- _t13 = _context0.v;
20307
- _context0.n = 31;
20361
+ _t13 = _context10.v;
20362
+ _context10.n = 31;
20308
20363
  break;
20309
20364
  case 30:
20310
20365
  _t13 = {
@@ -20316,10 +20371,10 @@ function getMessagesQuery(action) {
20316
20371
  result.messages = [].concat(_secondResult.messages, result.messages, thirdResult.messages);
20317
20372
  result.hasNext = _secondResult.hasNext;
20318
20373
  messageQuery.reverse = true;
20319
- _context0.n = 32;
20374
+ _context10.n = 32;
20320
20375
  return put(setMessagesHasPrevAC(_secondResult.hasNext));
20321
20376
  case 32:
20322
- _context0.n = 33;
20377
+ _context10.n = 33;
20323
20378
  return put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
20324
20379
  case 33:
20325
20380
  setMessagesToMap(channel.id, result.messages);
@@ -20327,38 +20382,42 @@ function getMessagesQuery(action) {
20327
20382
  setHasPrevCached(false);
20328
20383
  setHasNextCached(false);
20329
20384
  case 34:
20330
- _context0.n = 35;
20385
+ _context10.n = 35;
20331
20386
  return put(setMessagesHasNextAC(true));
20332
20387
  case 35:
20333
- _context0.n = 36;
20388
+ if (!scrollToMessage) {
20389
+ _context10.n = 36;
20390
+ break;
20391
+ }
20392
+ _context10.n = 36;
20334
20393
  return put(setScrollToMessagesAC(messageId, true, behavior));
20335
20394
  case 36:
20336
- _context0.n = 37;
20395
+ _context10.n = 37;
20337
20396
  return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
20338
20397
  case 37:
20339
- _context0.n = 72;
20398
+ _context10.n = 72;
20340
20399
  break;
20341
20400
  case 38:
20342
20401
  if (!(channel.newMessageCount && channel.lastDisplayedMessageId)) {
20343
- _context0.n = 61;
20402
+ _context10.n = 61;
20344
20403
  break;
20345
20404
  }
20346
20405
  setMessagesToMap(channel.id, []);
20347
20406
  setAllMessages([]);
20348
20407
  messageQuery.limit = MESSAGES_MAX_LENGTH;
20349
20408
  if (!Number(channel.lastDisplayedMessageId)) {
20350
- _context0.n = 50;
20409
+ _context10.n = 50;
20351
20410
  break;
20352
20411
  }
20353
20412
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
20354
- _context0.n = 40;
20413
+ _context10.n = 40;
20355
20414
  break;
20356
20415
  }
20357
- _context0.n = 39;
20416
+ _context10.n = 39;
20358
20417
  return call(messageQuery.loadNearMessageId, channel.lastDisplayedMessageId);
20359
20418
  case 39:
20360
- _t14 = _context0.v;
20361
- _context0.n = 41;
20419
+ _t14 = _context10.v;
20420
+ _context10.n = 41;
20362
20421
  break;
20363
20422
  case 40:
20364
20423
  _t14 = {
@@ -20368,19 +20427,19 @@ function getMessagesQuery(action) {
20368
20427
  case 41:
20369
20428
  result = _t14;
20370
20429
  if (!(result.messages.length === 50)) {
20371
- _context0.n = 49;
20430
+ _context10.n = 49;
20372
20431
  break;
20373
20432
  }
20374
20433
  messageQuery.limit = channel.newMessageCount > 25 ? (MESSAGES_MAX_LENGTH - 50) / 2 : MESSAGES_MAX_LENGTH - 50;
20375
20434
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
20376
- _context0.n = 43;
20435
+ _context10.n = 43;
20377
20436
  break;
20378
20437
  }
20379
- _context0.n = 42;
20438
+ _context10.n = 42;
20380
20439
  return call(messageQuery.loadPreviousMessageId, result.messages[0].id);
20381
20440
  case 42:
20382
- _t15 = _context0.v;
20383
- _context0.n = 44;
20441
+ _t15 = _context10.v;
20442
+ _context10.n = 44;
20384
20443
  break;
20385
20444
  case 43:
20386
20445
  _t15 = {
@@ -20390,19 +20449,19 @@ function getMessagesQuery(action) {
20390
20449
  case 44:
20391
20450
  _secondResult2 = _t15;
20392
20451
  if (!(channel.newMessageCount > 25)) {
20393
- _context0.n = 48;
20452
+ _context10.n = 48;
20394
20453
  break;
20395
20454
  }
20396
20455
  messageQuery.reverse = false;
20397
20456
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
20398
- _context0.n = 46;
20457
+ _context10.n = 46;
20399
20458
  break;
20400
20459
  }
20401
- _context0.n = 45;
20460
+ _context10.n = 45;
20402
20461
  return call(messageQuery.loadNextMessageId, result.messages[result.messages.length - 1].id);
20403
20462
  case 45:
20404
- _t16 = _context0.v;
20405
- _context0.n = 47;
20463
+ _t16 = _context10.v;
20464
+ _context10.n = 47;
20406
20465
  break;
20407
20466
  case 46:
20408
20467
  _t16 = {
@@ -20413,23 +20472,23 @@ function getMessagesQuery(action) {
20413
20472
  _thirdResult = _t16;
20414
20473
  result.messages = [].concat(_secondResult2.messages, result.messages, _thirdResult.messages);
20415
20474
  messageQuery.reverse = true;
20416
- _context0.n = 49;
20475
+ _context10.n = 49;
20417
20476
  break;
20418
20477
  case 48:
20419
20478
  result.messages = [].concat(_secondResult2.messages, result.messages);
20420
20479
  case 49:
20421
- _context0.n = 57;
20480
+ _context10.n = 57;
20422
20481
  break;
20423
20482
  case 50:
20424
20483
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
20425
- _context0.n = 52;
20484
+ _context10.n = 52;
20426
20485
  break;
20427
20486
  }
20428
- _context0.n = 51;
20487
+ _context10.n = 51;
20429
20488
  return call(messageQuery.loadPrevious);
20430
20489
  case 51:
20431
- _t17 = _context0.v;
20432
- _context0.n = 53;
20490
+ _t17 = _context10.v;
20491
+ _context10.n = 53;
20433
20492
  break;
20434
20493
  case 52:
20435
20494
  _t17 = {
@@ -20439,19 +20498,19 @@ function getMessagesQuery(action) {
20439
20498
  case 53:
20440
20499
  result = _t17;
20441
20500
  if (!(result.messages.length === 50)) {
20442
- _context0.n = 57;
20501
+ _context10.n = 57;
20443
20502
  break;
20444
20503
  }
20445
20504
  messageQuery.limit = MESSAGES_MAX_LENGTH - 50;
20446
20505
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
20447
- _context0.n = 55;
20506
+ _context10.n = 55;
20448
20507
  break;
20449
20508
  }
20450
- _context0.n = 54;
20509
+ _context10.n = 54;
20451
20510
  return call(messageQuery.loadPreviousMessageId, result.messages[0].id);
20452
20511
  case 54:
20453
- _t18 = _context0.v;
20454
- _context0.n = 56;
20512
+ _t18 = _context10.v;
20513
+ _context10.n = 56;
20455
20514
  break;
20456
20515
  case 55:
20457
20516
  _t18 = {
@@ -20463,42 +20522,41 @@ function getMessagesQuery(action) {
20463
20522
  result.messages = [].concat(_secondResult3.messages, result.messages);
20464
20523
  result.hasNext = _secondResult3.hasNext;
20465
20524
  case 57:
20466
- _context0.n = 58;
20525
+ _context10.n = 58;
20467
20526
  return put(setMessagesHasPrevAC(true));
20468
20527
  case 58:
20469
- _context0.n = 59;
20528
+ _context10.n = 59;
20470
20529
  return put(setMessagesHasNextAC(channel.lastMessage && result.messages.length > 0 && channel.lastMessage.id !== result.messages[result.messages.length - 1].id));
20471
20530
  case 59:
20472
20531
  setMessagesToMap(channel.id, result.messages);
20473
20532
  setAllMessages([].concat(result.messages));
20474
- _context0.n = 60;
20533
+ _context10.n = 60;
20475
20534
  return put(setMessagesAC(JSON.parse(JSON.stringify(result.messages))));
20476
20535
  case 60:
20477
- _context0.n = 72;
20536
+ _context10.n = 72;
20478
20537
  break;
20479
20538
  case 61:
20480
- previousAllMessages = getAllMessages();
20481
20539
  setMessagesToMap(channel.id, []);
20482
20540
  setAllMessages([]);
20483
20541
  if (!(cachedMessages && cachedMessages.length)) {
20484
- _context0.n = 62;
20542
+ _context10.n = 62;
20485
20543
  break;
20486
20544
  }
20487
20545
  setMessagesToMap(channel.id, []);
20488
20546
  setAllMessages([].concat(cachedMessages));
20489
- _context0.n = 62;
20547
+ _context10.n = 62;
20490
20548
  return put(setMessagesAC(JSON.parse(JSON.stringify(cachedMessages))));
20491
20549
  case 62:
20492
20550
  log.info('load message from server');
20493
20551
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
20494
- _context0.n = 64;
20552
+ _context10.n = 64;
20495
20553
  break;
20496
20554
  }
20497
- _context0.n = 63;
20555
+ _context10.n = 63;
20498
20556
  return call(messageQuery.loadPrevious);
20499
20557
  case 63:
20500
- _t19 = _context0.v;
20501
- _context0.n = 65;
20558
+ _t19 = _context10.v;
20559
+ _context10.n = 65;
20502
20560
  break;
20503
20561
  case 64:
20504
20562
  _t19 = {
@@ -20508,19 +20566,19 @@ function getMessagesQuery(action) {
20508
20566
  case 65:
20509
20567
  result = _t19;
20510
20568
  if (!(result.messages.length === 50)) {
20511
- _context0.n = 69;
20569
+ _context10.n = 69;
20512
20570
  break;
20513
20571
  }
20514
20572
  messageQuery.limit = MESSAGES_MAX_LENGTH - 50;
20515
20573
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
20516
- _context0.n = 67;
20574
+ _context10.n = 67;
20517
20575
  break;
20518
20576
  }
20519
- _context0.n = 66;
20577
+ _context10.n = 66;
20520
20578
  return call(messageQuery.loadPreviousMessageId, result.messages[0].id);
20521
20579
  case 66:
20522
- _t20 = _context0.v;
20523
- _context0.n = 68;
20580
+ _t20 = _context10.v;
20581
+ _context10.n = 68;
20524
20582
  break;
20525
20583
  case 67:
20526
20584
  _t20 = {
@@ -20541,37 +20599,18 @@ function getMessagesQuery(action) {
20541
20599
  updateMessageOnAllMessages(msg.id, updatedMessage || msg);
20542
20600
  updatedMessages.push(updatedMessage || msg);
20543
20601
  });
20544
- lastMessageId = (_updatedMessages = updatedMessages[updatedMessages.length - 1]) === null || _updatedMessages === void 0 ? void 0 : _updatedMessages.id;
20545
- _allMessages2 = getAllMessages();
20546
- setMappedAllMessages = {};
20547
- previousAllMessages.forEach(function (msg) {
20548
- if (msg.channelId === channel.id) {
20549
- setMappedAllMessages[msg.id] = msg;
20550
- }
20551
- });
20552
- _allMessages2.forEach(function (msg) {
20553
- if (msg.channelId === channel.id) {
20554
- setMappedAllMessages[msg.id] = msg;
20555
- }
20556
- });
20557
- allMessagesAfterLastMessage = lastMessageId ? (_Object$values = Object.values(setMappedAllMessages || {})) === null || _Object$values === void 0 ? void 0 : _Object$values.filter(function (msg) {
20558
- return msg.id > lastMessageId;
20559
- }) : Object.values(setMappedAllMessages || {});
20560
- updatedMessages = [].concat(updatedMessages, allMessagesAfterLastMessage || []);
20561
- setMessagesToMap(channel.id, updatedMessages);
20562
- setAllMessages(updatedMessages);
20563
- _context0.n = 70;
20564
- return put(setMessagesAC(JSON.parse(JSON.stringify(updatedMessages))));
20602
+ _context10.n = 70;
20603
+ return call(updateMessages, channel, updatedMessages);
20565
20604
  case 70:
20566
- _context0.n = 71;
20605
+ _context10.n = 71;
20567
20606
  return put(setMessagesHasPrevAC(true));
20568
20607
  case 71:
20569
- _context0.n = 72;
20608
+ _context10.n = 72;
20570
20609
  return put(setMessagesHasNextAC(false));
20571
20610
  case 72:
20572
20611
  pendingMessages = getPendingMessages(channel.id);
20573
20612
  if (!(pendingMessages && pendingMessages.length)) {
20574
- _context0.n = 73;
20613
+ _context10.n = 73;
20575
20614
  break;
20576
20615
  }
20577
20616
  _messagesMap = {};
@@ -20581,76 +20620,76 @@ function getMessagesQuery(action) {
20581
20620
  filteredPendingMessages = pendingMessages.filter(function (msg) {
20582
20621
  return !_messagesMap[msg.tid || ''];
20583
20622
  });
20584
- _context0.n = 73;
20623
+ _context10.n = 73;
20585
20624
  return put(addMessagesAC(filteredPendingMessages, MESSAGE_LOAD_DIRECTION.NEXT));
20586
20625
  case 73:
20587
20626
  waitToSendPendingMessages = store.getState().UserReducer.waitToSendPendingMessages;
20588
20627
  if (!(connectionState === CONNECTION_STATUS.CONNECTED && waitToSendPendingMessages)) {
20589
- _context0.n = 75;
20628
+ _context10.n = 75;
20590
20629
  break;
20591
20630
  }
20592
- _context0.n = 74;
20631
+ _context10.n = 74;
20593
20632
  return put(setWaitToSendPendingMessagesAC(false));
20594
20633
  case 74:
20595
- _context0.n = 75;
20634
+ _context10.n = 75;
20596
20635
  return spawn(sendPendingMessages, connectionState);
20597
20636
  case 75:
20598
- _context0.n = 77;
20637
+ _context10.n = 77;
20599
20638
  break;
20600
20639
  case 76:
20601
20640
  if (!channel.isMockChannel) {
20602
- _context0.n = 77;
20641
+ _context10.n = 77;
20603
20642
  break;
20604
20643
  }
20605
- _context0.n = 77;
20644
+ _context10.n = 77;
20606
20645
  return put(setMessagesAC([]));
20607
20646
  case 77:
20608
- _context0.n = 79;
20647
+ _context10.n = 79;
20609
20648
  break;
20610
20649
  case 78:
20611
- _context0.p = 78;
20612
- _t21 = _context0.v;
20650
+ _context10.p = 78;
20651
+ _t21 = _context10.v;
20613
20652
  log.error('error in message query', _t21);
20614
20653
  case 79:
20615
- _context0.p = 79;
20616
- _context0.n = 80;
20654
+ _context10.p = 79;
20655
+ _context10.n = 80;
20617
20656
  return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
20618
20657
  case 80:
20619
- return _context0.f(79);
20658
+ return _context10.f(79);
20620
20659
  case 81:
20621
- return _context0.a(2);
20660
+ return _context10.a(2);
20622
20661
  }
20623
20662
  }, _marked7$1, null, [[0, 78, 79, 81]]);
20624
20663
  }
20625
20664
  function getMessageQuery(action) {
20626
20665
  var payload, channelId, messageId, channel, connectionState, messages, fetchedMessage, _t22;
20627
- return _regenerator().w(function (_context1) {
20628
- while (1) switch (_context1.p = _context1.n) {
20666
+ return _regenerator().w(function (_context11) {
20667
+ while (1) switch (_context11.p = _context11.n) {
20629
20668
  case 0:
20630
- _context1.p = 0;
20669
+ _context11.p = 0;
20631
20670
  payload = action.payload;
20632
20671
  channelId = payload.channelId, messageId = payload.messageId;
20633
- _context1.n = 1;
20672
+ _context11.n = 1;
20634
20673
  return call(getChannelFromAllChannels, channelId);
20635
20674
  case 1:
20636
- channel = _context1.v;
20675
+ channel = _context11.v;
20637
20676
  connectionState = store.getState().UserReducer.connectionStatus;
20638
20677
  if (!(!channel || connectionState !== CONNECTION_STATUS.CONNECTED)) {
20639
- _context1.n = 2;
20678
+ _context11.n = 2;
20640
20679
  break;
20641
20680
  }
20642
- return _context1.a(2);
20681
+ return _context11.a(2);
20643
20682
  case 2:
20644
- _context1.n = 3;
20683
+ _context11.n = 3;
20645
20684
  return call(channel.getMessagesById, [messageId]);
20646
20685
  case 3:
20647
- messages = _context1.v;
20686
+ messages = _context11.v;
20648
20687
  fetchedMessage = messages && messages[0] ? JSON.parse(JSON.stringify(messages[0])) : null;
20649
20688
  if (!fetchedMessage) {
20650
- _context1.n = 6;
20689
+ _context11.n = 6;
20651
20690
  break;
20652
20691
  }
20653
- _context1.n = 4;
20692
+ _context11.n = 4;
20654
20693
  return put(updateMessageAC(messageId, fetchedMessage));
20655
20694
  case 4:
20656
20695
  updateMessageOnMap(channel.id, {
@@ -20658,45 +20697,45 @@ function getMessageQuery(action) {
20658
20697
  params: fetchedMessage
20659
20698
  });
20660
20699
  updateMessageOnAllMessages(messageId, fetchedMessage);
20661
- _context1.n = 5;
20700
+ _context11.n = 5;
20662
20701
  return put(setScrollToMessagesAC(messageId, false));
20663
20702
  case 5:
20664
20703
  if (!(channel.lastMessage && channel.lastMessage.id === messageId)) {
20665
- _context1.n = 6;
20704
+ _context11.n = 6;
20666
20705
  break;
20667
20706
  }
20668
20707
  updateChannelLastMessageOnAllChannels(channel.id, fetchedMessage);
20669
- _context1.n = 6;
20708
+ _context11.n = 6;
20670
20709
  return put(updateChannelLastMessageAC(fetchedMessage, channel));
20671
20710
  case 6:
20672
- _context1.n = 8;
20711
+ _context11.n = 8;
20673
20712
  break;
20674
20713
  case 7:
20675
- _context1.p = 7;
20676
- _t22 = _context1.v;
20714
+ _context11.p = 7;
20715
+ _t22 = _context11.v;
20677
20716
  log.error('error in message query', _t22);
20678
20717
  case 8:
20679
- return _context1.a(2);
20718
+ return _context11.a(2);
20680
20719
  }
20681
20720
  }, _marked8$1, null, [[0, 7]]);
20682
20721
  }
20683
20722
  function loadMoreMessages(action) {
20684
20723
  var payload, limit, direction, channelId, messageId, hasNext, SceytChatClient, messageQueryBuilder, messageQuery, result, _t23;
20685
- return _regenerator().w(function (_context10) {
20686
- while (1) switch (_context10.p = _context10.n) {
20724
+ return _regenerator().w(function (_context12) {
20725
+ while (1) switch (_context12.p = _context12.n) {
20687
20726
  case 0:
20688
- _context10.p = 0;
20727
+ _context12.p = 0;
20689
20728
  payload = action.payload;
20690
20729
  limit = payload.limit, direction = payload.direction, channelId = payload.channelId, messageId = payload.messageId, hasNext = payload.hasNext;
20691
20730
  SceytChatClient = getClient();
20692
20731
  messageQueryBuilder = new SceytChatClient.MessageListQueryBuilder(channelId);
20693
20732
  messageQueryBuilder.reverse(true);
20694
- _context10.n = 1;
20733
+ _context12.n = 1;
20695
20734
  return call(messageQueryBuilder.build);
20696
20735
  case 1:
20697
- messageQuery = _context10.v;
20736
+ messageQuery = _context12.v;
20698
20737
  messageQuery.limit = limit || 5;
20699
- _context10.n = 2;
20738
+ _context12.n = 2;
20700
20739
  return put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
20701
20740
  case 2:
20702
20741
  result = {
@@ -20704,130 +20743,130 @@ function loadMoreMessages(action) {
20704
20743
  hasNext: false
20705
20744
  };
20706
20745
  if (!(direction === MESSAGE_LOAD_DIRECTION.PREV)) {
20707
- _context10.n = 6;
20746
+ _context12.n = 6;
20708
20747
  break;
20709
20748
  }
20710
20749
  if (!getHasPrevCached()) {
20711
- _context10.n = 3;
20750
+ _context12.n = 3;
20712
20751
  break;
20713
20752
  }
20714
20753
  result.messages = getFromAllMessagesByMessageId(messageId, MESSAGE_LOAD_DIRECTION.PREV);
20715
- _context10.n = 5;
20754
+ _context12.n = 5;
20716
20755
  break;
20717
20756
  case 3:
20718
20757
  if (!hasNext) {
20719
- _context10.n = 5;
20758
+ _context12.n = 5;
20720
20759
  break;
20721
20760
  }
20722
- _context10.n = 4;
20761
+ _context12.n = 4;
20723
20762
  return call(messageQuery.loadPreviousMessageId, messageId);
20724
20763
  case 4:
20725
- result = _context10.v;
20764
+ result = _context12.v;
20726
20765
  if (result.messages.length) {
20727
20766
  addAllMessages(result.messages, MESSAGE_LOAD_DIRECTION.PREV);
20728
20767
  setMessagesToMap(channelId, result.messages);
20729
20768
  }
20730
- _context10.n = 5;
20769
+ _context12.n = 5;
20731
20770
  return put(setMessagesHasPrevAC(result.hasNext));
20732
20771
  case 5:
20733
- _context10.n = 10;
20772
+ _context12.n = 10;
20734
20773
  break;
20735
20774
  case 6:
20736
20775
  if (!getHasNextCached()) {
20737
- _context10.n = 7;
20776
+ _context12.n = 7;
20738
20777
  break;
20739
20778
  }
20740
20779
  result.messages = getFromAllMessagesByMessageId(messageId, MESSAGE_LOAD_DIRECTION.NEXT);
20741
- _context10.n = 9;
20780
+ _context12.n = 9;
20742
20781
  break;
20743
20782
  case 7:
20744
20783
  if (!hasNext) {
20745
- _context10.n = 9;
20784
+ _context12.n = 9;
20746
20785
  break;
20747
20786
  }
20748
20787
  log.info('saga load next from server ... ', messageId);
20749
20788
  messageQuery.reverse = false;
20750
- _context10.n = 8;
20789
+ _context12.n = 8;
20751
20790
  return call(messageQuery.loadNextMessageId, messageId);
20752
20791
  case 8:
20753
- result = _context10.v;
20792
+ result = _context12.v;
20754
20793
  if (result.messages.length) {
20755
20794
  addAllMessages(result.messages, MESSAGE_LOAD_DIRECTION.NEXT);
20756
20795
  setMessagesToMap(channelId, result.messages);
20757
20796
  }
20758
- _context10.n = 9;
20797
+ _context12.n = 9;
20759
20798
  return put(setMessagesHasNextAC(result.hasNext));
20760
20799
  case 9:
20761
- _context10.n = 10;
20800
+ _context12.n = 10;
20762
20801
  return put(setMessagesHasPrevAC(true));
20763
20802
  case 10:
20764
20803
  if (!(result.messages && result.messages.length && result.messages.length > 0)) {
20765
- _context10.n = 12;
20804
+ _context12.n = 12;
20766
20805
  break;
20767
20806
  }
20768
- _context10.n = 11;
20807
+ _context12.n = 11;
20769
20808
  return put(addMessagesAC(JSON.parse(JSON.stringify(result.messages)), direction));
20770
20809
  case 11:
20771
- _context10.n = 16;
20810
+ _context12.n = 16;
20772
20811
  break;
20773
20812
  case 12:
20774
- _context10.n = 13;
20813
+ _context12.n = 13;
20775
20814
  return put(addMessagesAC([], direction));
20776
20815
  case 13:
20777
20816
  if (!(direction === MESSAGE_LOAD_DIRECTION.NEXT)) {
20778
- _context10.n = 15;
20817
+ _context12.n = 15;
20779
20818
  break;
20780
20819
  }
20781
- _context10.n = 14;
20820
+ _context12.n = 14;
20782
20821
  return put(setMessagesHasNextAC(false));
20783
20822
  case 14:
20784
- _context10.n = 16;
20823
+ _context12.n = 16;
20785
20824
  break;
20786
20825
  case 15:
20787
- _context10.n = 16;
20826
+ _context12.n = 16;
20788
20827
  return put(setMessagesHasPrevAC(false));
20789
20828
  case 16:
20790
- _context10.n = 17;
20829
+ _context12.n = 17;
20791
20830
  return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
20792
20831
  case 17:
20793
- _context10.n = 19;
20832
+ _context12.n = 19;
20794
20833
  break;
20795
20834
  case 18:
20796
- _context10.p = 18;
20797
- _t23 = _context10.v;
20835
+ _context12.p = 18;
20836
+ _t23 = _context12.v;
20798
20837
  log.error('error in load more messages', _t23);
20799
20838
  case 19:
20800
- return _context10.a(2);
20839
+ return _context12.a(2);
20801
20840
  }
20802
20841
  }, _marked9$1, null, [[0, 18]]);
20803
20842
  }
20804
20843
  function addReaction(action) {
20805
20844
  var payload, channelId, messageId, key, score, reason, enforceUnique, user, channel, _yield$call, message, reaction, channelUpdateParam, _t24;
20806
- return _regenerator().w(function (_context11) {
20807
- while (1) switch (_context11.p = _context11.n) {
20845
+ return _regenerator().w(function (_context13) {
20846
+ while (1) switch (_context13.p = _context13.n) {
20808
20847
  case 0:
20809
- _context11.p = 0;
20848
+ _context13.p = 0;
20810
20849
  payload = action.payload;
20811
20850
  channelId = payload.channelId, messageId = payload.messageId, key = payload.key, score = payload.score, reason = payload.reason, enforceUnique = payload.enforceUnique;
20812
20851
  user = getClient().user;
20813
- _context11.n = 1;
20852
+ _context13.n = 1;
20814
20853
  return call(getChannelFromMap, channelId);
20815
20854
  case 1:
20816
- channel = _context11.v;
20855
+ channel = _context13.v;
20817
20856
  if (!channel) {
20818
20857
  channel = getChannelFromAllChannels(channelId);
20819
20858
  if (channel) {
20820
20859
  setChannelInMap(channel);
20821
20860
  }
20822
20861
  }
20823
- _context11.n = 2;
20862
+ _context13.n = 2;
20824
20863
  return call(channel.addReaction, messageId, key, score, reason, enforceUnique);
20825
20864
  case 2:
20826
- _yield$call = _context11.v;
20865
+ _yield$call = _context13.v;
20827
20866
  message = _yield$call.message;
20828
20867
  reaction = _yield$call.reaction;
20829
20868
  if (!(user.id === message.user.id)) {
20830
- _context11.n = 4;
20869
+ _context13.n = 4;
20831
20870
  break;
20832
20871
  }
20833
20872
  channelUpdateParam = {
@@ -20835,99 +20874,99 @@ function addReaction(action) {
20835
20874
  lastReactedMessage: message,
20836
20875
  newReactions: [reaction]
20837
20876
  };
20838
- _context11.n = 3;
20877
+ _context13.n = 3;
20839
20878
  return put(updateChannelDataAC(channel.id, channelUpdateParam));
20840
20879
  case 3:
20841
20880
  updateChannelOnAllChannels(channel.id, channelUpdateParam);
20842
20881
  case 4:
20843
- _context11.n = 5;
20882
+ _context13.n = 5;
20844
20883
  return put(addChannelAC(JSON.parse(JSON.stringify(channel))));
20845
20884
  case 5:
20846
- _context11.n = 6;
20885
+ _context13.n = 6;
20847
20886
  return put(addReactionToListAC(reaction));
20848
20887
  case 6:
20849
- _context11.n = 7;
20888
+ _context13.n = 7;
20850
20889
  return put(addReactionToMessageAC(message, reaction, true));
20851
20890
  case 7:
20852
20891
  addReactionToMessageOnMap(channelId, message, reaction, true);
20853
20892
  addReactionOnAllMessages(message, reaction, true);
20854
- _context11.n = 9;
20893
+ _context13.n = 9;
20855
20894
  break;
20856
20895
  case 8:
20857
- _context11.p = 8;
20858
- _t24 = _context11.v;
20896
+ _context13.p = 8;
20897
+ _t24 = _context13.v;
20859
20898
  log.error('ERROR in add reaction', _t24.message);
20860
20899
  case 9:
20861
- return _context11.a(2);
20900
+ return _context13.a(2);
20862
20901
  }
20863
20902
  }, _marked0$1, null, [[0, 8]]);
20864
20903
  }
20865
20904
  function deleteReaction(action) {
20866
20905
  var payload, channelId, messageId, key, isLastReaction, channel, _yield$call2, message, reaction, channelUpdateParam, _t25;
20867
- return _regenerator().w(function (_context12) {
20868
- while (1) switch (_context12.p = _context12.n) {
20906
+ return _regenerator().w(function (_context14) {
20907
+ while (1) switch (_context14.p = _context14.n) {
20869
20908
  case 0:
20870
- _context12.p = 0;
20909
+ _context14.p = 0;
20871
20910
  payload = action.payload;
20872
20911
  channelId = payload.channelId, messageId = payload.messageId, key = payload.key, isLastReaction = payload.isLastReaction;
20873
- _context12.n = 1;
20912
+ _context14.n = 1;
20874
20913
  return call(getChannelFromMap, channelId);
20875
20914
  case 1:
20876
- channel = _context12.v;
20915
+ channel = _context14.v;
20877
20916
  if (!channel) {
20878
20917
  channel = getChannelFromAllChannels(channelId);
20879
20918
  if (channel) {
20880
20919
  setChannelInMap(channel);
20881
20920
  }
20882
20921
  }
20883
- _context12.n = 2;
20922
+ _context14.n = 2;
20884
20923
  return call(channel.deleteReaction, messageId, key);
20885
20924
  case 2:
20886
- _yield$call2 = _context12.v;
20925
+ _yield$call2 = _context14.v;
20887
20926
  message = _yield$call2.message;
20888
20927
  reaction = _yield$call2.reaction;
20889
20928
  if (!isLastReaction) {
20890
- _context12.n = 4;
20929
+ _context14.n = 4;
20891
20930
  break;
20892
20931
  }
20893
20932
  channelUpdateParam = {
20894
20933
  userMessageReactions: [],
20895
20934
  lastReactedMessage: null
20896
20935
  };
20897
- _context12.n = 3;
20936
+ _context14.n = 3;
20898
20937
  return put(updateChannelDataAC(channel.id, channelUpdateParam));
20899
20938
  case 3:
20900
20939
  updateChannelOnAllChannels(channel.id, channelUpdateParam);
20901
20940
  case 4:
20902
- _context12.n = 5;
20941
+ _context14.n = 5;
20903
20942
  return put(deleteReactionFromListAC(reaction));
20904
20943
  case 5:
20905
- _context12.n = 6;
20944
+ _context14.n = 6;
20906
20945
  return put(deleteReactionFromMessageAC(message, reaction, true));
20907
20946
  case 6:
20908
20947
  removeReactionToMessageOnMap(channelId, message, reaction, true);
20909
20948
  removeReactionOnAllMessages(message, reaction, true);
20910
- _context12.n = 8;
20949
+ _context14.n = 8;
20911
20950
  break;
20912
20951
  case 7:
20913
- _context12.p = 7;
20914
- _t25 = _context12.v;
20952
+ _context14.p = 7;
20953
+ _t25 = _context14.v;
20915
20954
  log.error('ERROR in delete reaction', _t25.message);
20916
20955
  case 8:
20917
- return _context12.a(2);
20956
+ return _context14.a(2);
20918
20957
  }
20919
20958
  }, _marked1$1, null, [[0, 7]]);
20920
20959
  }
20921
20960
  function getReactions(action) {
20922
20961
  var payload, messageId, key, limit, SceytChatClient, reactionQueryBuilder, reactionQuery, result, _t26;
20923
- return _regenerator().w(function (_context13) {
20924
- while (1) switch (_context13.p = _context13.n) {
20962
+ return _regenerator().w(function (_context15) {
20963
+ while (1) switch (_context15.p = _context15.n) {
20925
20964
  case 0:
20926
- _context13.p = 0;
20965
+ _context15.p = 0;
20927
20966
  payload = action.payload;
20928
20967
  messageId = payload.messageId, key = payload.key, limit = payload.limit;
20929
20968
  SceytChatClient = getClient();
20930
- _context13.n = 1;
20969
+ _context15.n = 1;
20931
20970
  return put(setReactionsLoadingStateAC(LOADING_STATE.LOADING));
20932
20971
  case 1:
20933
20972
  reactionQueryBuilder = new SceytChatClient.ReactionListQueryBuilder(messageId);
@@ -20935,74 +20974,74 @@ function getReactions(action) {
20935
20974
  if (key) {
20936
20975
  reactionQueryBuilder.setKey(key);
20937
20976
  }
20938
- _context13.n = 2;
20977
+ _context15.n = 2;
20939
20978
  return call(reactionQueryBuilder.build);
20940
20979
  case 2:
20941
- reactionQuery = _context13.v;
20942
- _context13.n = 3;
20980
+ reactionQuery = _context15.v;
20981
+ _context15.n = 3;
20943
20982
  return call(reactionQuery.loadNext);
20944
20983
  case 3:
20945
- result = _context13.v;
20984
+ result = _context15.v;
20946
20985
  query.ReactionsQuery = reactionQuery;
20947
- _context13.n = 4;
20986
+ _context15.n = 4;
20948
20987
  return put(setReactionsListAC(result.reactions, result.hasNext));
20949
20988
  case 4:
20950
- _context13.n = 5;
20989
+ _context15.n = 5;
20951
20990
  return put(setReactionsLoadingStateAC(LOADING_STATE.LOADED));
20952
20991
  case 5:
20953
- _context13.n = 7;
20992
+ _context15.n = 7;
20954
20993
  break;
20955
20994
  case 6:
20956
- _context13.p = 6;
20957
- _t26 = _context13.v;
20995
+ _context15.p = 6;
20996
+ _t26 = _context15.v;
20958
20997
  log.error('ERROR in get reactions', _t26.message);
20959
20998
  case 7:
20960
- return _context13.a(2);
20999
+ return _context15.a(2);
20961
21000
  }
20962
21001
  }, _marked10$1, null, [[0, 6]]);
20963
21002
  }
20964
21003
  function loadMoreReactions(action) {
20965
21004
  var payload, limit, ReactionQuery, result, _t27;
20966
- return _regenerator().w(function (_context14) {
20967
- while (1) switch (_context14.p = _context14.n) {
21005
+ return _regenerator().w(function (_context16) {
21006
+ while (1) switch (_context16.p = _context16.n) {
20968
21007
  case 0:
20969
- _context14.p = 0;
21008
+ _context16.p = 0;
20970
21009
  payload = action.payload;
20971
21010
  limit = payload.limit;
20972
- _context14.n = 1;
21011
+ _context16.n = 1;
20973
21012
  return put(setReactionsLoadingStateAC(LOADING_STATE.LOADING));
20974
21013
  case 1:
20975
21014
  ReactionQuery = query.ReactionsQuery;
20976
21015
  if (limit) {
20977
21016
  ReactionQuery.limit = limit;
20978
21017
  }
20979
- _context14.n = 2;
21018
+ _context16.n = 2;
20980
21019
  return call(ReactionQuery.loadNext);
20981
21020
  case 2:
20982
- result = _context14.v;
20983
- _context14.n = 3;
21021
+ result = _context16.v;
21022
+ _context16.n = 3;
20984
21023
  return put(addReactionsToListAC(result.reactions, result.hasNext));
20985
21024
  case 3:
20986
- _context14.n = 4;
21025
+ _context16.n = 4;
20987
21026
  return put(setReactionsLoadingStateAC(LOADING_STATE.LOADED));
20988
21027
  case 4:
20989
- _context14.n = 6;
21028
+ _context16.n = 6;
20990
21029
  break;
20991
21030
  case 5:
20992
- _context14.p = 5;
20993
- _t27 = _context14.v;
21031
+ _context16.p = 5;
21032
+ _t27 = _context16.v;
20994
21033
  log.error('ERROR in load more reactions', _t27.message);
20995
21034
  case 6:
20996
- return _context14.a(2);
21035
+ return _context16.a(2);
20997
21036
  }
20998
21037
  }, _marked11$1, null, [[0, 5]]);
20999
21038
  }
21000
21039
  function getMessageAttachments(action) {
21001
21040
  var _action$payload2, channelId, attachmentType, limit, direction, attachmentId, forPopup, SceytChatClient, typeList, AttachmentByTypeQueryBuilder, AttachmentByTypeQuery, result, _t28;
21002
- return _regenerator().w(function (_context15) {
21003
- while (1) switch (_context15.p = _context15.n) {
21041
+ return _regenerator().w(function (_context17) {
21042
+ while (1) switch (_context17.p = _context17.n) {
21004
21043
  case 0:
21005
- _context15.p = 0;
21044
+ _context17.p = 0;
21006
21045
  _action$payload2 = action.payload, channelId = _action$payload2.channelId, attachmentType = _action$payload2.attachmentType, limit = _action$payload2.limit, direction = _action$payload2.direction, attachmentId = _action$payload2.attachmentId, forPopup = _action$payload2.forPopup;
21007
21046
  SceytChatClient = getClient();
21008
21047
  typeList = [attachmentTypes.video, attachmentTypes.image, attachmentTypes.file, attachmentTypes.link, attachmentTypes.voice];
@@ -21017,244 +21056,244 @@ function getMessageAttachments(action) {
21017
21056
  }
21018
21057
  AttachmentByTypeQueryBuilder = new SceytChatClient.AttachmentListQueryBuilder(channelId, typeList);
21019
21058
  AttachmentByTypeQueryBuilder.limit(limit || 34);
21020
- _context15.n = 1;
21059
+ _context17.n = 1;
21021
21060
  return call(AttachmentByTypeQueryBuilder.build);
21022
21061
  case 1:
21023
- AttachmentByTypeQuery = _context15.v;
21062
+ AttachmentByTypeQuery = _context17.v;
21024
21063
  if (forPopup) {
21025
21064
  AttachmentByTypeQuery.reverse = true;
21026
21065
  }
21027
21066
  if (!(direction === queryDirection.NEXT)) {
21028
- _context15.n = 3;
21067
+ _context17.n = 3;
21029
21068
  break;
21030
21069
  }
21031
- _context15.n = 2;
21070
+ _context17.n = 2;
21032
21071
  return call(AttachmentByTypeQuery.loadPrevious);
21033
21072
  case 2:
21034
- result = _context15.v;
21035
- _context15.n = 7;
21073
+ result = _context17.v;
21074
+ _context17.n = 7;
21036
21075
  break;
21037
21076
  case 3:
21038
21077
  if (!(direction === queryDirection.NEAR)) {
21039
- _context15.n = 5;
21078
+ _context17.n = 5;
21040
21079
  break;
21041
21080
  }
21042
- _context15.n = 4;
21081
+ _context17.n = 4;
21043
21082
  return call(AttachmentByTypeQuery.loadNearMessageId, attachmentId);
21044
21083
  case 4:
21045
- result = _context15.v;
21046
- _context15.n = 7;
21084
+ result = _context17.v;
21085
+ _context17.n = 7;
21047
21086
  break;
21048
21087
  case 5:
21049
- _context15.n = 6;
21088
+ _context17.n = 6;
21050
21089
  return call(AttachmentByTypeQuery.loadPrevious);
21051
21090
  case 6:
21052
- result = _context15.v;
21091
+ result = _context17.v;
21053
21092
  case 7:
21054
21093
  if (!forPopup) {
21055
- _context15.n = 10;
21094
+ _context17.n = 10;
21056
21095
  break;
21057
21096
  }
21058
21097
  query.AttachmentByTypeQueryForPopup = AttachmentByTypeQuery;
21059
- _context15.n = 8;
21098
+ _context17.n = 8;
21060
21099
  return put(setAttachmentsForPopupAC(JSON.parse(JSON.stringify(result.attachments))));
21061
21100
  case 8:
21062
- _context15.n = 9;
21101
+ _context17.n = 9;
21063
21102
  return put(setAttachmentsCompleteForPopupAC(result.hasNext));
21064
21103
  case 9:
21065
- _context15.n = 12;
21104
+ _context17.n = 12;
21066
21105
  break;
21067
21106
  case 10:
21068
21107
  query.AttachmentByTypeQuery = AttachmentByTypeQuery;
21069
- _context15.n = 11;
21108
+ _context17.n = 11;
21070
21109
  return put(setAttachmentsCompleteAC(result.hasNext));
21071
21110
  case 11:
21072
- _context15.n = 12;
21111
+ _context17.n = 12;
21073
21112
  return put(setAttachmentsAC(JSON.parse(JSON.stringify(result.attachments))));
21074
21113
  case 12:
21075
- _context15.n = 14;
21114
+ _context17.n = 14;
21076
21115
  break;
21077
21116
  case 13:
21078
- _context15.p = 13;
21079
- _t28 = _context15.v;
21117
+ _context17.p = 13;
21118
+ _t28 = _context17.v;
21080
21119
  log.error('error in message attachment query', _t28);
21081
21120
  case 14:
21082
- return _context15.a(2);
21121
+ return _context17.a(2);
21083
21122
  }
21084
21123
  }, _marked12$1, null, [[0, 13]]);
21085
21124
  }
21086
21125
  function loadMoreMessageAttachments(action) {
21087
21126
  var _action$payload3, limit, direction, forPopup, AttachmentQuery, _yield$call3, attachments, hasNext, _t29;
21088
- return _regenerator().w(function (_context16) {
21089
- while (1) switch (_context16.p = _context16.n) {
21127
+ return _regenerator().w(function (_context18) {
21128
+ while (1) switch (_context18.p = _context18.n) {
21090
21129
  case 0:
21091
- _context16.p = 0;
21130
+ _context18.p = 0;
21092
21131
  _action$payload3 = action.payload, limit = _action$payload3.limit, direction = _action$payload3.direction, forPopup = _action$payload3.forPopup;
21093
21132
  if (forPopup) {
21094
21133
  AttachmentQuery = query.AttachmentByTypeQueryForPopup;
21095
21134
  } else {
21096
21135
  AttachmentQuery = query.AttachmentByTypeQuery;
21097
21136
  }
21098
- _context16.n = 1;
21137
+ _context18.n = 1;
21099
21138
  return put(setMessagesLoadingStateAC(LOADING_STATE.LOADING));
21100
21139
  case 1:
21101
21140
  AttachmentQuery.limit = limit;
21102
- _context16.n = 2;
21141
+ _context18.n = 2;
21103
21142
  return call(AttachmentQuery.loadPrevious);
21104
21143
  case 2:
21105
- _yield$call3 = _context16.v;
21144
+ _yield$call3 = _context18.v;
21106
21145
  attachments = _yield$call3.attachments;
21107
21146
  hasNext = _yield$call3.hasNext;
21108
21147
  if (!forPopup) {
21109
- _context16.n = 4;
21148
+ _context18.n = 4;
21110
21149
  break;
21111
21150
  }
21112
- _context16.n = 3;
21151
+ _context18.n = 3;
21113
21152
  return put(addAttachmentsForPopupAC(attachments, direction));
21114
21153
  case 3:
21115
- _context16.n = 7;
21154
+ _context18.n = 7;
21116
21155
  break;
21117
21156
  case 4:
21118
- _context16.n = 5;
21157
+ _context18.n = 5;
21119
21158
  return put(setAttachmentsCompleteAC(hasNext));
21120
21159
  case 5:
21121
- _context16.n = 6;
21160
+ _context18.n = 6;
21122
21161
  return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
21123
21162
  case 6:
21124
- _context16.n = 7;
21163
+ _context18.n = 7;
21125
21164
  return put(addAttachmentsAC(attachments));
21126
21165
  case 7:
21127
- _context16.n = 9;
21166
+ _context18.n = 9;
21128
21167
  break;
21129
21168
  case 8:
21130
- _context16.p = 8;
21131
- _t29 = _context16.v;
21169
+ _context18.p = 8;
21170
+ _t29 = _context18.v;
21132
21171
  log.error('error in message attachment query', _t29);
21133
21172
  case 9:
21134
- return _context16.a(2);
21173
+ return _context18.a(2);
21135
21174
  }
21136
21175
  }, _marked13$1, null, [[0, 8]]);
21137
21176
  }
21138
21177
  function pauseAttachmentUploading(action) {
21139
21178
  var attachmentId, isPaused, _t30;
21140
- return _regenerator().w(function (_context17) {
21141
- while (1) switch (_context17.p = _context17.n) {
21179
+ return _regenerator().w(function (_context19) {
21180
+ while (1) switch (_context19.p = _context19.n) {
21142
21181
  case 0:
21143
- _context17.p = 0;
21182
+ _context19.p = 0;
21144
21183
  attachmentId = action.payload.attachmentId;
21145
21184
  if (!getCustomUploader()) {
21146
- _context17.n = 1;
21185
+ _context19.n = 1;
21147
21186
  break;
21148
21187
  }
21149
21188
  isPaused = pauseUpload(attachmentId);
21150
21189
  if (!isPaused) {
21151
- _context17.n = 1;
21190
+ _context19.n = 1;
21152
21191
  break;
21153
21192
  }
21154
- _context17.n = 1;
21193
+ _context19.n = 1;
21155
21194
  return put(updateAttachmentUploadingStateAC(UPLOAD_STATE.PAUSED, attachmentId));
21156
21195
  case 1:
21157
- _context17.n = 3;
21196
+ _context19.n = 3;
21158
21197
  break;
21159
21198
  case 2:
21160
- _context17.p = 2;
21161
- _t30 = _context17.v;
21199
+ _context19.p = 2;
21200
+ _t30 = _context19.v;
21162
21201
  log.error('error in pause attachment uploading', _t30);
21163
21202
  case 3:
21164
- return _context17.a(2);
21203
+ return _context19.a(2);
21165
21204
  }
21166
21205
  }, _marked14$1, null, [[0, 2]]);
21167
21206
  }
21168
21207
  function resumeAttachmentUploading(action) {
21169
21208
  var attachmentId, isResumed, _t31;
21170
- return _regenerator().w(function (_context18) {
21171
- while (1) switch (_context18.p = _context18.n) {
21209
+ return _regenerator().w(function (_context20) {
21210
+ while (1) switch (_context20.p = _context20.n) {
21172
21211
  case 0:
21173
- _context18.p = 0;
21212
+ _context20.p = 0;
21174
21213
  attachmentId = action.payload.attachmentId;
21175
21214
  log.info('resume for attachment ... ', attachmentId);
21176
21215
  if (!getCustomUploader()) {
21177
- _context18.n = 1;
21216
+ _context20.n = 1;
21178
21217
  break;
21179
21218
  }
21180
21219
  isResumed = resumeUpload(attachmentId);
21181
21220
  if (!isResumed) {
21182
- _context18.n = 1;
21221
+ _context20.n = 1;
21183
21222
  break;
21184
21223
  }
21185
- _context18.n = 1;
21224
+ _context20.n = 1;
21186
21225
  return put(updateAttachmentUploadingStateAC(UPLOAD_STATE.UPLOADING, attachmentId));
21187
21226
  case 1:
21188
- _context18.n = 3;
21227
+ _context20.n = 3;
21189
21228
  break;
21190
21229
  case 2:
21191
- _context18.p = 2;
21192
- _t31 = _context18.v;
21230
+ _context20.p = 2;
21231
+ _t31 = _context20.v;
21193
21232
  log.error('error in resume attachment uploading', _t31);
21194
21233
  case 3:
21195
- return _context18.a(2);
21234
+ return _context20.a(2);
21196
21235
  }
21197
21236
  }, _marked15$1, null, [[0, 2]]);
21198
21237
  }
21199
21238
  function getMessageMarkers(action) {
21200
21239
  var _action$payload4, messageId, channelId, deliveryStatus, sceytChatClient, messageMarkerListQueryBuilder, messageMarkerListQuery, messageMarkers, _t32;
21201
- return _regenerator().w(function (_context19) {
21202
- while (1) switch (_context19.p = _context19.n) {
21240
+ return _regenerator().w(function (_context21) {
21241
+ while (1) switch (_context21.p = _context21.n) {
21203
21242
  case 0:
21204
- _context19.p = 0;
21205
- _context19.n = 1;
21243
+ _context21.p = 0;
21244
+ _context21.n = 1;
21206
21245
  return put(setMessagesMarkersLoadingStateAC(LOADING_STATE.LOADING));
21207
21246
  case 1:
21208
21247
  _action$payload4 = action.payload, messageId = _action$payload4.messageId, channelId = _action$payload4.channelId, deliveryStatus = _action$payload4.deliveryStatus;
21209
21248
  sceytChatClient = getClient();
21210
21249
  if (!sceytChatClient) {
21211
- _context19.n = 4;
21250
+ _context21.n = 4;
21212
21251
  break;
21213
21252
  }
21214
21253
  messageMarkerListQueryBuilder = new sceytChatClient.MessageMarkerListQueryBuilder(channelId, String(messageId), deliveryStatus);
21215
- _context19.n = 2;
21254
+ _context21.n = 2;
21216
21255
  return call(messageMarkerListQueryBuilder.build);
21217
21256
  case 2:
21218
- messageMarkerListQuery = _context19.v;
21219
- _context19.n = 3;
21257
+ messageMarkerListQuery = _context21.v;
21258
+ _context21.n = 3;
21220
21259
  return call(messageMarkerListQuery.loadNext);
21221
21260
  case 3:
21222
- messageMarkers = _context19.v;
21223
- _context19.n = 4;
21261
+ messageMarkers = _context21.v;
21262
+ _context21.n = 4;
21224
21263
  return put(setMessageMarkersAC(channelId, messageId, messageMarkers.markers, deliveryStatus));
21225
21264
  case 4:
21226
- _context19.n = 6;
21265
+ _context21.n = 6;
21227
21266
  break;
21228
21267
  case 5:
21229
- _context19.p = 5;
21230
- _t32 = _context19.v;
21268
+ _context21.p = 5;
21269
+ _t32 = _context21.v;
21231
21270
  log.error('error in get message markers', _t32);
21232
21271
  case 6:
21233
- _context19.p = 6;
21234
- _context19.n = 7;
21272
+ _context21.p = 6;
21273
+ _context21.n = 7;
21235
21274
  return put(setMessagesMarkersLoadingStateAC(LOADING_STATE.LOADED));
21236
21275
  case 7:
21237
- return _context19.f(6);
21276
+ return _context21.f(6);
21238
21277
  case 8:
21239
- return _context19.a(2);
21278
+ return _context21.a(2);
21240
21279
  }
21241
21280
  }, _marked16$1, null, [[0, 5, 6, 8]]);
21242
21281
  }
21243
21282
  function executeAddPollVote(channelId, pollId, optionId, message, isResend) {
21244
21283
  var _user$presence, _message$pollDetails, _message$pollDetails2, _message$pollDetails3, _message$pollDetails4;
21245
21284
  var channel, user, vote, objs, _message$pollDetails5, _message$pollDetails6, _message$pollDetails7, _iterator2, _step2, obj;
21246
- return _regenerator().w(function (_context20) {
21247
- while (1) switch (_context20.n) {
21285
+ return _regenerator().w(function (_context22) {
21286
+ while (1) switch (_context22.n) {
21248
21287
  case 0:
21249
- _context20.n = 1;
21288
+ _context22.n = 1;
21250
21289
  return call(getChannelFromMap, channelId);
21251
21290
  case 1:
21252
- channel = _context20.v;
21291
+ channel = _context22.v;
21253
21292
  if (message.pollDetails) {
21254
- _context20.n = 2;
21293
+ _context22.n = 2;
21255
21294
  break;
21256
21295
  }
21257
- return _context20.a(2);
21296
+ return _context22.a(2);
21258
21297
  case 2:
21259
21298
  user = getClient().user;
21260
21299
  vote = {
@@ -21292,13 +21331,13 @@ function executeAddPollVote(channelId, pollId, optionId, message, isResend) {
21292
21331
  incrementVotesPerOptionCount: 1
21293
21332
  });
21294
21333
  if (isResend) {
21295
- _context20.n = 5;
21334
+ _context22.n = 5;
21296
21335
  break;
21297
21336
  }
21298
21337
  _iterator2 = _createForOfIteratorHelperLoose(objs);
21299
21338
  case 3:
21300
21339
  if ((_step2 = _iterator2()).done) {
21301
- _context20.n = 5;
21340
+ _context22.n = 5;
21302
21341
  break;
21303
21342
  }
21304
21343
  obj = _step2.value;
@@ -21307,46 +21346,46 @@ function executeAddPollVote(channelId, pollId, optionId, message, isResend) {
21307
21346
  params: {}
21308
21347
  }, obj);
21309
21348
  updateMessageOnAllMessages(message.id, {}, obj);
21310
- _context20.n = 4;
21349
+ _context22.n = 4;
21311
21350
  return put(updateMessageAC(message.id, {}, undefined, obj));
21312
21351
  case 4:
21313
- _context20.n = 3;
21352
+ _context22.n = 3;
21314
21353
  break;
21315
21354
  case 5:
21316
21355
  if (!channel) {
21317
- _context20.n = 7;
21356
+ _context22.n = 7;
21318
21357
  break;
21319
21358
  }
21320
- _context20.n = 6;
21359
+ _context22.n = 6;
21321
21360
  return call(channel.addVote, message.id, pollId, [optionId]);
21322
21361
  case 6:
21323
- _context20.n = 7;
21362
+ _context22.n = 7;
21324
21363
  return put(removePendingPollActionAC(message.id, 'ADD_POLL_VOTE', optionId));
21325
21364
  case 7:
21326
- return _context20.a(2);
21365
+ return _context22.a(2);
21327
21366
  }
21328
21367
  }, _marked17$1);
21329
21368
  }
21330
21369
  function updateMessageOptimisticallyForAddPollVote(channelId, message, vote) {
21331
21370
  var channel, obj;
21332
- return _regenerator().w(function (_context21) {
21333
- while (1) switch (_context21.n) {
21371
+ return _regenerator().w(function (_context23) {
21372
+ while (1) switch (_context23.n) {
21334
21373
  case 0:
21335
- _context21.n = 1;
21374
+ _context23.n = 1;
21336
21375
  return call(getChannelFromMap, channelId);
21337
21376
  case 1:
21338
- channel = _context21.v;
21377
+ channel = _context23.v;
21339
21378
  if (channel) {
21340
- _context21.n = 2;
21379
+ _context23.n = 2;
21341
21380
  break;
21342
21381
  }
21343
- return _context21.a(2);
21382
+ return _context23.a(2);
21344
21383
  case 2:
21345
21384
  if (message.pollDetails) {
21346
- _context21.n = 3;
21385
+ _context23.n = 3;
21347
21386
  break;
21348
21387
  }
21349
- return _context21.a(2);
21388
+ return _context23.a(2);
21350
21389
  case 3:
21351
21390
  obj = {
21352
21391
  type: 'addOwn',
@@ -21358,24 +21397,24 @@ function updateMessageOptimisticallyForAddPollVote(channelId, message, vote) {
21358
21397
  params: {}
21359
21398
  }, obj);
21360
21399
  updateMessageOnAllMessages(message.id, {}, obj);
21361
- _context21.n = 4;
21400
+ _context23.n = 4;
21362
21401
  return put(updateMessageAC(message.id, {}, undefined, obj));
21363
21402
  case 4:
21364
- return _context21.a(2);
21403
+ return _context23.a(2);
21365
21404
  }
21366
21405
  }, _marked18$1);
21367
21406
  }
21368
21407
  function addPollVote(action) {
21369
21408
  var payload, channelId, pollId, optionId, message, isResend, sceytChatClient, _user$presence2, connectionState, user, vote, pendingAction, conflictCheck, channel, _Object$values2, _store$getState$Messa, _currentMessage$pollD, _currentMessage$pollD2, _currentMessage$pollD3, currentMessage, hasNext, obj, _t33;
21370
- return _regenerator().w(function (_context22) {
21371
- while (1) switch (_context22.p = _context22.n) {
21409
+ return _regenerator().w(function (_context24) {
21410
+ while (1) switch (_context24.p = _context24.n) {
21372
21411
  case 0:
21373
- _context22.p = 0;
21412
+ _context24.p = 0;
21374
21413
  payload = action.payload;
21375
21414
  channelId = payload.channelId, pollId = payload.pollId, optionId = payload.optionId, message = payload.message, isResend = payload.isResend;
21376
21415
  sceytChatClient = getClient();
21377
21416
  if (!sceytChatClient) {
21378
- _context22.n = 7;
21417
+ _context24.n = 7;
21379
21418
  break;
21380
21419
  }
21381
21420
  connectionState = sceytChatClient.connectionState;
@@ -21402,7 +21441,7 @@ function addPollVote(action) {
21402
21441
  }
21403
21442
  };
21404
21443
  if (!(connectionState !== CONNECTION_STATUS.CONNECTED)) {
21405
- _context22.n = 6;
21444
+ _context24.n = 6;
21406
21445
  break;
21407
21446
  }
21408
21447
  pendingAction = {
@@ -21414,22 +21453,22 @@ function addPollVote(action) {
21414
21453
  };
21415
21454
  conflictCheck = checkPendingPollActionConflict(pendingAction);
21416
21455
  if (!(conflictCheck.hasConflict && !conflictCheck.shouldSkip)) {
21417
- _context22.n = 4;
21456
+ _context24.n = 4;
21418
21457
  break;
21419
21458
  }
21420
- _context22.n = 1;
21459
+ _context24.n = 1;
21421
21460
  return call(getChannelFromMap, channelId);
21422
21461
  case 1:
21423
- channel = _context22.v;
21462
+ channel = _context24.v;
21424
21463
  if (!channel) {
21425
- _context22.n = 3;
21464
+ _context24.n = 3;
21426
21465
  break;
21427
21466
  }
21428
21467
  currentMessage = ((_Object$values2 = Object.values(getMessagesFromMap(channelId) || {})) === null || _Object$values2 === void 0 ? void 0 : _Object$values2.find(function (msg) {
21429
21468
  return msg.id === message.id || msg.tid === message.id;
21430
21469
  })) || message;
21431
21470
  hasNext = ((_store$getState$Messa = store.getState().MessageReducer.pollVotesHasMore) === null || _store$getState$Messa === void 0 ? void 0 : _store$getState$Messa[pollId]) || false;
21432
- _context22.n = 2;
21471
+ _context24.n = 2;
21433
21472
  return put(addPollVotesToListAC(pollId, optionId, [(_currentMessage$pollD = currentMessage.pollDetails) === null || _currentMessage$pollD === void 0 ? void 0 : (_currentMessage$pollD2 = _currentMessage$pollD.voteDetails) === null || _currentMessage$pollD2 === void 0 ? void 0 : (_currentMessage$pollD3 = _currentMessage$pollD2.ownVotes) === null || _currentMessage$pollD3 === void 0 ? void 0 : _currentMessage$pollD3[0]], hasNext, message.id));
21434
21473
  case 2:
21435
21474
  obj = {
@@ -21442,60 +21481,60 @@ function addPollVote(action) {
21442
21481
  params: {}
21443
21482
  }, obj);
21444
21483
  updateMessageOnAllMessages(message.id, {}, obj);
21445
- _context22.n = 3;
21484
+ _context24.n = 3;
21446
21485
  return put(updateMessageAC(message.id, {}, undefined, obj));
21447
21486
  case 3:
21448
- _context22.n = 5;
21487
+ _context24.n = 5;
21449
21488
  break;
21450
21489
  case 4:
21451
21490
  if (conflictCheck.shouldSkip) {
21452
- _context22.n = 5;
21491
+ _context24.n = 5;
21453
21492
  break;
21454
21493
  }
21455
- return _context22.d(_regeneratorValues(updateMessageOptimisticallyForAddPollVote(channelId, message, vote)), 5);
21494
+ return _context24.d(_regeneratorValues(updateMessageOptimisticallyForAddPollVote(channelId, message, vote)), 5);
21456
21495
  case 5:
21457
21496
  if (!conflictCheck.shouldSkip) {
21458
21497
  setPendingPollAction(pendingAction);
21459
21498
  }
21460
- return _context22.a(2);
21499
+ return _context24.a(2);
21461
21500
  case 6:
21462
- return _context22.d(_regeneratorValues(executeAddPollVote(channelId, pollId, optionId, message, isResend)), 7);
21501
+ return _context24.d(_regeneratorValues(executeAddPollVote(channelId, pollId, optionId, message, isResend)), 7);
21463
21502
  case 7:
21464
- _context22.n = 9;
21503
+ _context24.n = 9;
21465
21504
  break;
21466
21505
  case 8:
21467
- _context22.p = 8;
21468
- _t33 = _context22.v;
21506
+ _context24.p = 8;
21507
+ _t33 = _context24.v;
21469
21508
  log.error('error in add poll vote', _t33);
21470
21509
  case 9:
21471
- return _context22.a(2);
21510
+ return _context24.a(2);
21472
21511
  }
21473
21512
  }, _marked19$1, null, [[0, 8]]);
21474
21513
  }
21475
21514
  function executeDeletePollVote(channelId, pollId, optionId, message, isResend) {
21476
21515
  var _message$pollDetails8, _message$pollDetails9, _message$pollDetails0;
21477
21516
  var channel, vote, obj;
21478
- return _regenerator().w(function (_context23) {
21479
- while (1) switch (_context23.n) {
21517
+ return _regenerator().w(function (_context25) {
21518
+ while (1) switch (_context25.n) {
21480
21519
  case 0:
21481
- _context23.n = 1;
21520
+ _context25.n = 1;
21482
21521
  return call(getChannelFromMap, channelId);
21483
21522
  case 1:
21484
- channel = _context23.v;
21523
+ channel = _context25.v;
21485
21524
  if (message.pollDetails) {
21486
- _context23.n = 2;
21525
+ _context25.n = 2;
21487
21526
  break;
21488
21527
  }
21489
- return _context23.a(2);
21528
+ return _context25.a(2);
21490
21529
  case 2:
21491
21530
  vote = (_message$pollDetails8 = message.pollDetails) === null || _message$pollDetails8 === void 0 ? void 0 : (_message$pollDetails9 = _message$pollDetails8.voteDetails) === null || _message$pollDetails9 === void 0 ? void 0 : (_message$pollDetails0 = _message$pollDetails9.ownVotes) === null || _message$pollDetails0 === void 0 ? void 0 : _message$pollDetails0.find(function (vote) {
21492
21531
  return vote.optionId === optionId;
21493
21532
  });
21494
21533
  if (vote) {
21495
- _context23.n = 3;
21534
+ _context25.n = 3;
21496
21535
  break;
21497
21536
  }
21498
- return _context23.a(2);
21537
+ return _context25.a(2);
21499
21538
  case 3:
21500
21539
  obj = {
21501
21540
  type: 'deleteOwn',
@@ -21503,7 +21542,7 @@ function executeDeletePollVote(channelId, pollId, optionId, message, isResend) {
21503
21542
  incrementVotesPerOptionCount: -1
21504
21543
  };
21505
21544
  if (isResend) {
21506
- _context23.n = 4;
21545
+ _context25.n = 4;
21507
21546
  break;
21508
21547
  }
21509
21548
  updateMessageOnMap(channel.id, {
@@ -21511,43 +21550,43 @@ function executeDeletePollVote(channelId, pollId, optionId, message, isResend) {
21511
21550
  params: {}
21512
21551
  }, obj);
21513
21552
  updateMessageOnAllMessages(message.id, {}, obj);
21514
- _context23.n = 4;
21553
+ _context25.n = 4;
21515
21554
  return put(updateMessageAC(message.id, {}, undefined, obj));
21516
21555
  case 4:
21517
21556
  if (!channel) {
21518
- _context23.n = 6;
21557
+ _context25.n = 6;
21519
21558
  break;
21520
21559
  }
21521
- _context23.n = 5;
21560
+ _context25.n = 5;
21522
21561
  return call(channel.deleteVote, message.id, pollId, [optionId]);
21523
21562
  case 5:
21524
- _context23.n = 6;
21563
+ _context25.n = 6;
21525
21564
  return put(removePendingPollActionAC(message.id, 'DELETE_POLL_VOTE', optionId));
21526
21565
  case 6:
21527
- return _context23.a(2);
21566
+ return _context25.a(2);
21528
21567
  }
21529
21568
  }, _marked20$1);
21530
21569
  }
21531
21570
  function updateMessageOptimisticallyForDeletePollVote(channelId, message, vote) {
21532
21571
  var channel, obj;
21533
- return _regenerator().w(function (_context24) {
21534
- while (1) switch (_context24.n) {
21572
+ return _regenerator().w(function (_context26) {
21573
+ while (1) switch (_context26.n) {
21535
21574
  case 0:
21536
- _context24.n = 1;
21575
+ _context26.n = 1;
21537
21576
  return call(getChannelFromMap, channelId);
21538
21577
  case 1:
21539
- channel = _context24.v;
21578
+ channel = _context26.v;
21540
21579
  if (channel) {
21541
- _context24.n = 2;
21580
+ _context26.n = 2;
21542
21581
  break;
21543
21582
  }
21544
- return _context24.a(2);
21583
+ return _context26.a(2);
21545
21584
  case 2:
21546
21585
  if (message.pollDetails) {
21547
- _context24.n = 3;
21586
+ _context26.n = 3;
21548
21587
  break;
21549
21588
  }
21550
- return _context24.a(2);
21589
+ return _context26.a(2);
21551
21590
  case 3:
21552
21591
  obj = {
21553
21592
  type: 'deleteOwn',
@@ -21559,24 +21598,24 @@ function updateMessageOptimisticallyForDeletePollVote(channelId, message, vote)
21559
21598
  params: {}
21560
21599
  }, obj);
21561
21600
  updateMessageOnAllMessages(message.id, {}, obj);
21562
- _context24.n = 4;
21601
+ _context26.n = 4;
21563
21602
  return put(updateMessageAC(message.id, {}, undefined, obj));
21564
21603
  case 4:
21565
- return _context24.a(2);
21604
+ return _context26.a(2);
21566
21605
  }
21567
21606
  }, _marked21$1);
21568
21607
  }
21569
21608
  function deletePollVote(action) {
21570
21609
  var payload, channelId, pollId, optionId, message, isResend, sceytChatClient, _message$pollDetails1, _message$pollDetails10, _message$pollDetails11, connectionState, vote, pendingAction, conflictCheck, channel, _Object$values3, _currentMessage$pollD4, _currentMessage$pollD5, _currentMessage$pollD6, currentMessage, obj, _t34;
21571
- return _regenerator().w(function (_context25) {
21572
- while (1) switch (_context25.p = _context25.n) {
21610
+ return _regenerator().w(function (_context27) {
21611
+ while (1) switch (_context27.p = _context27.n) {
21573
21612
  case 0:
21574
- _context25.p = 0;
21613
+ _context27.p = 0;
21575
21614
  payload = action.payload;
21576
21615
  channelId = payload.channelId, pollId = payload.pollId, optionId = payload.optionId, message = payload.message, isResend = payload.isResend;
21577
21616
  sceytChatClient = getClient();
21578
21617
  if (!sceytChatClient) {
21579
- _context25.n = 8;
21618
+ _context27.n = 8;
21580
21619
  break;
21581
21620
  }
21582
21621
  connectionState = sceytChatClient.connectionState;
@@ -21584,13 +21623,13 @@ function deletePollVote(action) {
21584
21623
  return vote.optionId === optionId;
21585
21624
  });
21586
21625
  if (vote) {
21587
- _context25.n = 1;
21626
+ _context27.n = 1;
21588
21627
  break;
21589
21628
  }
21590
- return _context25.a(2);
21629
+ return _context27.a(2);
21591
21630
  case 1:
21592
21631
  if (!(connectionState !== CONNECTION_STATUS.CONNECTED)) {
21593
- _context25.n = 7;
21632
+ _context27.n = 7;
21594
21633
  break;
21595
21634
  }
21596
21635
  pendingAction = {
@@ -21602,21 +21641,21 @@ function deletePollVote(action) {
21602
21641
  };
21603
21642
  conflictCheck = checkPendingPollActionConflict(pendingAction);
21604
21643
  if (!(conflictCheck.hasConflict && conflictCheck.shouldSkip)) {
21605
- _context25.n = 5;
21644
+ _context27.n = 5;
21606
21645
  break;
21607
21646
  }
21608
- _context25.n = 2;
21647
+ _context27.n = 2;
21609
21648
  return call(getChannelFromMap, channelId);
21610
21649
  case 2:
21611
- channel = _context25.v;
21650
+ channel = _context27.v;
21612
21651
  if (!channel) {
21613
- _context25.n = 4;
21652
+ _context27.n = 4;
21614
21653
  break;
21615
21654
  }
21616
21655
  currentMessage = ((_Object$values3 = Object.values(getMessagesFromMap(channelId) || {})) === null || _Object$values3 === void 0 ? void 0 : _Object$values3.find(function (msg) {
21617
21656
  return msg.id === message.id || msg.tid === message.id;
21618
21657
  })) || message;
21619
- _context25.n = 3;
21658
+ _context27.n = 3;
21620
21659
  return put(deletePollVotesFromListAC(pollId, optionId, [(_currentMessage$pollD4 = currentMessage.pollDetails) === null || _currentMessage$pollD4 === void 0 ? void 0 : (_currentMessage$pollD5 = _currentMessage$pollD4.voteDetails) === null || _currentMessage$pollD5 === void 0 ? void 0 : (_currentMessage$pollD6 = _currentMessage$pollD5.ownVotes) === null || _currentMessage$pollD6 === void 0 ? void 0 : _currentMessage$pollD6[0]], message.id));
21621
21660
  case 3:
21622
21661
  obj = {
@@ -21629,45 +21668,45 @@ function deletePollVote(action) {
21629
21668
  params: {}
21630
21669
  }, obj);
21631
21670
  updateMessageOnAllMessages(message.id, {}, obj);
21632
- _context25.n = 4;
21671
+ _context27.n = 4;
21633
21672
  return put(updateMessageAC(message.id, {}, undefined, obj));
21634
21673
  case 4:
21635
- _context25.n = 6;
21674
+ _context27.n = 6;
21636
21675
  break;
21637
21676
  case 5:
21638
21677
  if (conflictCheck.shouldSkip) {
21639
- _context25.n = 6;
21678
+ _context27.n = 6;
21640
21679
  break;
21641
21680
  }
21642
- return _context25.d(_regeneratorValues(updateMessageOptimisticallyForDeletePollVote(channelId, message, vote)), 6);
21681
+ return _context27.d(_regeneratorValues(updateMessageOptimisticallyForDeletePollVote(channelId, message, vote)), 6);
21643
21682
  case 6:
21644
21683
  if (!conflictCheck.shouldSkip) {
21645
21684
  setPendingPollAction(pendingAction);
21646
21685
  }
21647
- return _context25.a(2);
21686
+ return _context27.a(2);
21648
21687
  case 7:
21649
- return _context25.d(_regeneratorValues(executeDeletePollVote(channelId, pollId, optionId, message, isResend)), 8);
21688
+ return _context27.d(_regeneratorValues(executeDeletePollVote(channelId, pollId, optionId, message, isResend)), 8);
21650
21689
  case 8:
21651
- _context25.n = 10;
21690
+ _context27.n = 10;
21652
21691
  break;
21653
21692
  case 9:
21654
- _context25.p = 9;
21655
- _t34 = _context25.v;
21693
+ _context27.p = 9;
21694
+ _t34 = _context27.v;
21656
21695
  log.error('error in delete poll vote', _t34);
21657
21696
  case 10:
21658
- return _context25.a(2);
21697
+ return _context27.a(2);
21659
21698
  }
21660
21699
  }, _marked22$1, null, [[0, 9]]);
21661
21700
  }
21662
21701
  function executeClosePoll(channelId, pollId, message) {
21663
21702
  var channel, obj;
21664
- return _regenerator().w(function (_context26) {
21665
- while (1) switch (_context26.n) {
21703
+ return _regenerator().w(function (_context28) {
21704
+ while (1) switch (_context28.n) {
21666
21705
  case 0:
21667
- _context26.n = 1;
21706
+ _context28.n = 1;
21668
21707
  return call(getChannelFromMap, channelId);
21669
21708
  case 1:
21670
- channel = _context26.v;
21709
+ channel = _context28.v;
21671
21710
  obj = {
21672
21711
  type: 'close',
21673
21712
  incrementVotesPerOptionCount: 0
@@ -21677,37 +21716,37 @@ function executeClosePoll(channelId, pollId, message) {
21677
21716
  params: {}
21678
21717
  }, obj);
21679
21718
  updateMessageOnAllMessages(message.id, {}, obj);
21680
- _context26.n = 2;
21719
+ _context28.n = 2;
21681
21720
  return put(updateMessageAC(message.id, {}, undefined, obj));
21682
21721
  case 2:
21683
21722
  if (!channel) {
21684
- _context26.n = 4;
21723
+ _context28.n = 4;
21685
21724
  break;
21686
21725
  }
21687
- _context26.n = 3;
21726
+ _context28.n = 3;
21688
21727
  return call(channel.closePoll, message.id, pollId);
21689
21728
  case 3:
21690
- _context26.n = 4;
21729
+ _context28.n = 4;
21691
21730
  return put(removePendingPollActionAC(message.id, 'CLOSE_POLL'));
21692
21731
  case 4:
21693
- return _context26.a(2);
21732
+ return _context28.a(2);
21694
21733
  }
21695
21734
  }, _marked23$1);
21696
21735
  }
21697
21736
  function updateMessageOptimisticallyForClosePoll(channelId, message) {
21698
21737
  var channel, pollDetails;
21699
- return _regenerator().w(function (_context27) {
21700
- while (1) switch (_context27.n) {
21738
+ return _regenerator().w(function (_context29) {
21739
+ while (1) switch (_context29.n) {
21701
21740
  case 0:
21702
- _context27.n = 1;
21741
+ _context29.n = 1;
21703
21742
  return call(getChannelFromMap, channelId);
21704
21743
  case 1:
21705
- channel = _context27.v;
21744
+ channel = _context29.v;
21706
21745
  if (channel) {
21707
- _context27.n = 2;
21746
+ _context29.n = 2;
21708
21747
  break;
21709
21748
  }
21710
- return _context27.a(2);
21749
+ return _context29.a(2);
21711
21750
  case 2:
21712
21751
  pollDetails = JSON.parse(JSON.stringify(message.pollDetails));
21713
21752
  pollDetails.closed = true;
@@ -21721,34 +21760,34 @@ function updateMessageOptimisticallyForClosePoll(channelId, message) {
21721
21760
  updateMessageOnAllMessages(message.id, {
21722
21761
  pollDetails: pollDetails
21723
21762
  });
21724
- _context27.n = 3;
21763
+ _context29.n = 3;
21725
21764
  return put(updateMessageAC(message.id, {
21726
21765
  pollDetails: pollDetails
21727
21766
  }));
21728
21767
  case 3:
21729
- return _context27.a(2);
21768
+ return _context29.a(2);
21730
21769
  }
21731
21770
  }, _marked24$1);
21732
21771
  }
21733
21772
  function closePoll(action) {
21734
21773
  var payload, channelId, pollId, message, sceytChatClient, connectionState, _t35;
21735
- return _regenerator().w(function (_context28) {
21736
- while (1) switch (_context28.p = _context28.n) {
21774
+ return _regenerator().w(function (_context30) {
21775
+ while (1) switch (_context30.p = _context30.n) {
21737
21776
  case 0:
21738
- _context28.p = 0;
21777
+ _context30.p = 0;
21739
21778
  payload = action.payload;
21740
21779
  channelId = payload.channelId, pollId = payload.pollId, message = payload.message;
21741
21780
  sceytChatClient = getClient();
21742
21781
  if (!sceytChatClient) {
21743
- _context28.n = 3;
21782
+ _context30.n = 3;
21744
21783
  break;
21745
21784
  }
21746
21785
  connectionState = sceytChatClient.connectionState;
21747
21786
  if (!(connectionState !== CONNECTION_STATUS.CONNECTED)) {
21748
- _context28.n = 2;
21787
+ _context30.n = 2;
21749
21788
  break;
21750
21789
  }
21751
- return _context28.d(_regeneratorValues(updateMessageOptimisticallyForClosePoll(channelId, message)), 1);
21790
+ return _context30.d(_regeneratorValues(updateMessageOptimisticallyForClosePoll(channelId, message)), 1);
21752
21791
  case 1:
21753
21792
  setPendingPollAction({
21754
21793
  type: 'CLOSE_POLL',
@@ -21756,38 +21795,38 @@ function closePoll(action) {
21756
21795
  pollId: pollId,
21757
21796
  message: message
21758
21797
  });
21759
- return _context28.a(2);
21798
+ return _context30.a(2);
21760
21799
  case 2:
21761
- return _context28.d(_regeneratorValues(executeClosePoll(channelId, pollId, message)), 3);
21800
+ return _context30.d(_regeneratorValues(executeClosePoll(channelId, pollId, message)), 3);
21762
21801
  case 3:
21763
- _context28.n = 5;
21802
+ _context30.n = 5;
21764
21803
  break;
21765
21804
  case 4:
21766
- _context28.p = 4;
21767
- _t35 = _context28.v;
21805
+ _context30.p = 4;
21806
+ _t35 = _context30.v;
21768
21807
  log.error('error in close poll', _t35);
21769
21808
  case 5:
21770
- return _context28.a(2);
21809
+ return _context30.a(2);
21771
21810
  }
21772
21811
  }, _marked25$1, null, [[0, 4]]);
21773
21812
  }
21774
21813
  function executeRetractPollVote(channelId, pollId, message, objs, isResend) {
21775
21814
  var channel, _iterator3, _step3, obj;
21776
- return _regenerator().w(function (_context29) {
21777
- while (1) switch (_context29.n) {
21815
+ return _regenerator().w(function (_context31) {
21816
+ while (1) switch (_context31.n) {
21778
21817
  case 0:
21779
- _context29.n = 1;
21818
+ _context31.n = 1;
21780
21819
  return call(getChannelFromMap, channelId);
21781
21820
  case 1:
21782
- channel = _context29.v;
21821
+ channel = _context31.v;
21783
21822
  if (isResend) {
21784
- _context29.n = 4;
21823
+ _context31.n = 4;
21785
21824
  break;
21786
21825
  }
21787
21826
  _iterator3 = _createForOfIteratorHelperLoose(objs);
21788
21827
  case 2:
21789
21828
  if ((_step3 = _iterator3()).done) {
21790
- _context29.n = 4;
21829
+ _context31.n = 4;
21791
21830
  break;
21792
21831
  }
21793
21832
  obj = _step3.value;
@@ -21796,45 +21835,45 @@ function executeRetractPollVote(channelId, pollId, message, objs, isResend) {
21796
21835
  params: {}
21797
21836
  }, obj);
21798
21837
  updateMessageOnAllMessages(message.id, {}, obj);
21799
- _context29.n = 3;
21838
+ _context31.n = 3;
21800
21839
  return put(updateMessageAC(message.id, {}, undefined, obj));
21801
21840
  case 3:
21802
- _context29.n = 2;
21841
+ _context31.n = 2;
21803
21842
  break;
21804
21843
  case 4:
21805
21844
  if (!channel) {
21806
- _context29.n = 6;
21845
+ _context31.n = 6;
21807
21846
  break;
21808
21847
  }
21809
- _context29.n = 5;
21848
+ _context31.n = 5;
21810
21849
  return call(channel.retractVote, message.id, pollId);
21811
21850
  case 5:
21812
- _context29.n = 6;
21851
+ _context31.n = 6;
21813
21852
  return put(removePendingPollActionAC(message.id || '', 'RETRACT_POLL_VOTE'));
21814
21853
  case 6:
21815
- return _context29.a(2);
21854
+ return _context31.a(2);
21816
21855
  }
21817
21856
  }, _marked26$1);
21818
21857
  }
21819
21858
  function updateMessageOptimisticallyForRetractPollVote(channelId, message, objs) {
21820
21859
  var channel, _iterator4, _step4, obj;
21821
- return _regenerator().w(function (_context30) {
21822
- while (1) switch (_context30.n) {
21860
+ return _regenerator().w(function (_context32) {
21861
+ while (1) switch (_context32.n) {
21823
21862
  case 0:
21824
- _context30.n = 1;
21863
+ _context32.n = 1;
21825
21864
  return call(getChannelFromMap, channelId);
21826
21865
  case 1:
21827
- channel = _context30.v;
21866
+ channel = _context32.v;
21828
21867
  if (channel) {
21829
- _context30.n = 2;
21868
+ _context32.n = 2;
21830
21869
  break;
21831
21870
  }
21832
- return _context30.a(2);
21871
+ return _context32.a(2);
21833
21872
  case 2:
21834
21873
  _iterator4 = _createForOfIteratorHelperLoose(objs);
21835
21874
  case 3:
21836
21875
  if ((_step4 = _iterator4()).done) {
21837
- _context30.n = 5;
21876
+ _context32.n = 5;
21838
21877
  break;
21839
21878
  }
21840
21879
  obj = _step4.value;
@@ -21843,27 +21882,27 @@ function updateMessageOptimisticallyForRetractPollVote(channelId, message, objs)
21843
21882
  params: {}
21844
21883
  });
21845
21884
  updateMessageOnAllMessages(message.id, {}, obj);
21846
- _context30.n = 4;
21885
+ _context32.n = 4;
21847
21886
  return put(updateMessageAC(message.id, {}, undefined, obj));
21848
21887
  case 4:
21849
- _context30.n = 3;
21888
+ _context32.n = 3;
21850
21889
  break;
21851
21890
  case 5:
21852
- return _context30.a(2);
21891
+ return _context32.a(2);
21853
21892
  }
21854
21893
  }, _marked27$1);
21855
21894
  }
21856
21895
  function retractPollVote(action) {
21857
21896
  var payload, channelId, pollId, message, isResend, sceytChatClient, connectionState, objs, _iterator5, _step5, _message$pollDetails12, _message$pollDetails13, vote, _t36;
21858
- return _regenerator().w(function (_context31) {
21859
- while (1) switch (_context31.p = _context31.n) {
21897
+ return _regenerator().w(function (_context33) {
21898
+ while (1) switch (_context33.p = _context33.n) {
21860
21899
  case 0:
21861
- _context31.p = 0;
21900
+ _context33.p = 0;
21862
21901
  payload = action.payload;
21863
21902
  channelId = payload.channelId, pollId = payload.pollId, message = payload.message, isResend = payload.isResend;
21864
21903
  sceytChatClient = getClient();
21865
21904
  if (!sceytChatClient) {
21866
- _context31.n = 3;
21905
+ _context33.n = 3;
21867
21906
  break;
21868
21907
  }
21869
21908
  connectionState = sceytChatClient.connectionState;
@@ -21877,10 +21916,10 @@ function retractPollVote(action) {
21877
21916
  });
21878
21917
  }
21879
21918
  if (!(connectionState !== CONNECTION_STATUS.CONNECTED)) {
21880
- _context31.n = 2;
21919
+ _context33.n = 2;
21881
21920
  break;
21882
21921
  }
21883
- return _context31.d(_regeneratorValues(updateMessageOptimisticallyForRetractPollVote(channelId, message, objs)), 1);
21922
+ return _context33.d(_regeneratorValues(updateMessageOptimisticallyForRetractPollVote(channelId, message, objs)), 1);
21884
21923
  case 1:
21885
21924
  setPendingPollAction({
21886
21925
  type: 'RETRACT_POLL_VOTE',
@@ -21888,39 +21927,39 @@ function retractPollVote(action) {
21888
21927
  pollId: pollId,
21889
21928
  message: message
21890
21929
  });
21891
- return _context31.a(2);
21930
+ return _context33.a(2);
21892
21931
  case 2:
21893
- return _context31.d(_regeneratorValues(executeRetractPollVote(channelId, pollId, message, objs, isResend)), 3);
21932
+ return _context33.d(_regeneratorValues(executeRetractPollVote(channelId, pollId, message, objs, isResend)), 3);
21894
21933
  case 3:
21895
- _context31.n = 5;
21934
+ _context33.n = 5;
21896
21935
  break;
21897
21936
  case 4:
21898
- _context31.p = 4;
21899
- _t36 = _context31.v;
21937
+ _context33.p = 4;
21938
+ _t36 = _context33.v;
21900
21939
  log.error('error in retract poll vote', _t36);
21901
21940
  case 5:
21902
- return _context31.a(2);
21941
+ return _context33.a(2);
21903
21942
  }
21904
21943
  }, _marked28$1, null, [[0, 4]]);
21905
21944
  }
21906
21945
  function resendPendingPollActions(action) {
21907
21946
  var payload, connectionState, sceytChatClient, pendingPollActionsMap, pendingPollActionsMapCopy, _t37;
21908
- return _regenerator().w(function (_context32) {
21909
- while (1) switch (_context32.p = _context32.n) {
21947
+ return _regenerator().w(function (_context34) {
21948
+ while (1) switch (_context34.p = _context34.n) {
21910
21949
  case 0:
21911
- _context32.p = 0;
21950
+ _context34.p = 0;
21912
21951
  payload = action.payload;
21913
21952
  connectionState = payload.connectionState;
21914
21953
  sceytChatClient = getClient();
21915
21954
  if (!(!sceytChatClient || connectionState !== CONNECTION_STATUS.CONNECTED)) {
21916
- _context32.n = 1;
21955
+ _context34.n = 1;
21917
21956
  break;
21918
21957
  }
21919
- return _context32.a(2);
21958
+ return _context34.a(2);
21920
21959
  case 1:
21921
21960
  pendingPollActionsMap = store.getState().MessageReducer.pendingPollActions;
21922
21961
  pendingPollActionsMapCopy = JSON.parse(JSON.stringify(pendingPollActionsMap));
21923
- _context32.n = 2;
21962
+ _context34.n = 2;
21924
21963
  return call(function () {
21925
21964
  return new Promise(function (resolve) {
21926
21965
  return setTimeout(resolve, 1000);
@@ -21956,32 +21995,32 @@ function resendPendingPollActions(action) {
21956
21995
  }
21957
21996
  });
21958
21997
  });
21959
- _context32.n = 4;
21998
+ _context34.n = 4;
21960
21999
  break;
21961
22000
  case 3:
21962
- _context32.p = 3;
21963
- _t37 = _context32.v;
22001
+ _context34.p = 3;
22002
+ _t37 = _context34.v;
21964
22003
  log.error('error in resend pending poll actions', _t37);
21965
22004
  case 4:
21966
- return _context32.a(2);
22005
+ return _context34.a(2);
21967
22006
  }
21968
22007
  }, _marked29$1, null, [[0, 3]]);
21969
22008
  }
21970
22009
  function getPollVotes(action) {
21971
22010
  var payload, messageId, pollId, optionId, limit, key, SceytChatClient, queryBuilder, pollVotesQuery, result, formattedVotes, _t38;
21972
- return _regenerator().w(function (_context33) {
21973
- while (1) switch (_context33.p = _context33.n) {
22011
+ return _regenerator().w(function (_context35) {
22012
+ while (1) switch (_context35.p = _context35.n) {
21974
22013
  case 0:
21975
- _context33.p = 0;
22014
+ _context35.p = 0;
21976
22015
  payload = action.payload;
21977
22016
  messageId = payload.messageId, pollId = payload.pollId, optionId = payload.optionId, limit = payload.limit;
21978
22017
  key = pollId + "_" + optionId;
21979
- _context33.n = 1;
22018
+ _context35.n = 1;
21980
22019
  return put(setPollVotesLoadingStateAC(pollId, optionId, LOADING_STATE.LOADING));
21981
22020
  case 1:
21982
22021
  SceytChatClient = getClient();
21983
22022
  if (!(!SceytChatClient || !SceytChatClient.PollVotesQueryBuilder)) {
21984
- _context33.n = 2;
22023
+ _context35.n = 2;
21985
22024
  break;
21986
22025
  }
21987
22026
  throw new Error('SceytChatClient or PollVotesQueryBuilder not available');
@@ -21989,14 +22028,14 @@ function getPollVotes(action) {
21989
22028
  queryBuilder = new SceytChatClient.PollVotesQueryBuilder(messageId, pollId);
21990
22029
  queryBuilder.setOptionId(optionId);
21991
22030
  queryBuilder.limit(limit || 20);
21992
- _context33.n = 3;
22031
+ _context35.n = 3;
21993
22032
  return call(queryBuilder.build);
21994
22033
  case 3:
21995
- pollVotesQuery = _context33.v;
21996
- _context33.n = 4;
22034
+ pollVotesQuery = _context35.v;
22035
+ _context35.n = 4;
21997
22036
  return call(pollVotesQuery.loadNext);
21998
22037
  case 4:
21999
- result = _context33.v;
22038
+ result = _context35.v;
22000
22039
  if (!query.PollVotesQueries) {
22001
22040
  query.PollVotesQueries = {};
22002
22041
  }
@@ -22024,39 +22063,39 @@ function getPollVotes(action) {
22024
22063
  }
22025
22064
  };
22026
22065
  });
22027
- _context33.n = 5;
22066
+ _context35.n = 5;
22028
22067
  return put(setPollVotesListAC(pollId, optionId, formattedVotes, result.hasNext || false));
22029
22068
  case 5:
22030
- _context33.n = 6;
22069
+ _context35.n = 6;
22031
22070
  return put(setPollVotesLoadingStateAC(pollId, optionId, LOADING_STATE.LOADED));
22032
22071
  case 6:
22033
- _context33.n = 8;
22072
+ _context35.n = 8;
22034
22073
  break;
22035
22074
  case 7:
22036
- _context33.p = 7;
22037
- _t38 = _context33.v;
22075
+ _context35.p = 7;
22076
+ _t38 = _context35.v;
22038
22077
  log.error('ERROR in get poll votes', _t38);
22039
- _context33.n = 8;
22078
+ _context35.n = 8;
22040
22079
  return put(setPollVotesLoadingStateAC(action.payload.pollId, action.payload.optionId, LOADING_STATE.LOADED));
22041
22080
  case 8:
22042
- return _context33.a(2);
22081
+ return _context35.a(2);
22043
22082
  }
22044
22083
  }, _marked30$1, null, [[0, 7]]);
22045
22084
  }
22046
22085
  function loadMorePollVotes(action) {
22047
22086
  var payload, pollId, optionId, limit, key, pollVotesQuery, result, formattedVotes, _t39;
22048
- return _regenerator().w(function (_context34) {
22049
- while (1) switch (_context34.p = _context34.n) {
22087
+ return _regenerator().w(function (_context36) {
22088
+ while (1) switch (_context36.p = _context36.n) {
22050
22089
  case 0:
22051
- _context34.p = 0;
22090
+ _context36.p = 0;
22052
22091
  payload = action.payload;
22053
22092
  pollId = payload.pollId, optionId = payload.optionId, limit = payload.limit;
22054
22093
  key = pollId + "_" + optionId;
22055
- _context34.n = 1;
22094
+ _context36.n = 1;
22056
22095
  return put(setPollVotesLoadingStateAC(pollId, optionId, LOADING_STATE.LOADING));
22057
22096
  case 1:
22058
22097
  if (!(!query.PollVotesQueries || !query.PollVotesQueries[key])) {
22059
- _context34.n = 2;
22098
+ _context36.n = 2;
22060
22099
  break;
22061
22100
  }
22062
22101
  throw new Error('Poll votes query not found');
@@ -22065,10 +22104,10 @@ function loadMorePollVotes(action) {
22065
22104
  if (limit && pollVotesQuery.limit < limit) {
22066
22105
  pollVotesQuery.limit = limit;
22067
22106
  }
22068
- _context34.n = 3;
22107
+ _context36.n = 3;
22069
22108
  return call(pollVotesQuery.loadNext);
22070
22109
  case 3:
22071
- result = _context34.v;
22110
+ result = _context36.v;
22072
22111
  formattedVotes = (result.votes || []).map(function (vote) {
22073
22112
  return {
22074
22113
  optionId: vote.optionId || optionId,
@@ -22092,105 +22131,105 @@ function loadMorePollVotes(action) {
22092
22131
  }
22093
22132
  };
22094
22133
  });
22095
- _context34.n = 4;
22134
+ _context36.n = 4;
22096
22135
  return put(addPollVotesToListAC(pollId, optionId, formattedVotes, result.hasNext || false));
22097
22136
  case 4:
22098
- _context34.n = 5;
22137
+ _context36.n = 5;
22099
22138
  return put(setPollVotesLoadingStateAC(pollId, optionId, LOADING_STATE.LOADED));
22100
22139
  case 5:
22101
- _context34.n = 7;
22140
+ _context36.n = 7;
22102
22141
  break;
22103
22142
  case 6:
22104
- _context34.p = 6;
22105
- _t39 = _context34.v;
22143
+ _context36.p = 6;
22144
+ _t39 = _context36.v;
22106
22145
  log.error('ERROR in load more poll votes', _t39);
22107
- _context34.n = 7;
22146
+ _context36.n = 7;
22108
22147
  return put(setPollVotesLoadingStateAC(action.payload.pollId, action.payload.optionId, LOADING_STATE.LOADED));
22109
22148
  case 7:
22110
- return _context34.a(2);
22149
+ return _context36.a(2);
22111
22150
  }
22112
22151
  }, _marked31$1, null, [[0, 6]]);
22113
22152
  }
22114
22153
  function MessageSaga() {
22115
- return _regenerator().w(function (_context35) {
22116
- while (1) switch (_context35.n) {
22154
+ return _regenerator().w(function (_context37) {
22155
+ while (1) switch (_context37.n) {
22117
22156
  case 0:
22118
- _context35.n = 1;
22157
+ _context37.n = 1;
22119
22158
  return takeEvery(SEND_MESSAGE, sendMessage);
22120
22159
  case 1:
22121
- _context35.n = 2;
22160
+ _context37.n = 2;
22122
22161
  return takeEvery(SEND_TEXT_MESSAGE, sendTextMessage);
22123
22162
  case 2:
22124
- _context35.n = 3;
22163
+ _context37.n = 3;
22125
22164
  return takeEvery(FORWARD_MESSAGE, forwardMessage);
22126
22165
  case 3:
22127
- _context35.n = 4;
22166
+ _context37.n = 4;
22128
22167
  return takeEvery(RESEND_MESSAGE, resendMessage);
22129
22168
  case 4:
22130
- _context35.n = 5;
22169
+ _context37.n = 5;
22131
22170
  return takeLatest(EDIT_MESSAGE, editMessage);
22132
22171
  case 5:
22133
- _context35.n = 6;
22172
+ _context37.n = 6;
22134
22173
  return takeEvery(DELETE_MESSAGE, deleteMessage);
22135
22174
  case 6:
22136
- _context35.n = 7;
22175
+ _context37.n = 7;
22137
22176
  return takeLatest(GET_MESSAGES, getMessagesQuery);
22138
22177
  case 7:
22139
- _context35.n = 8;
22178
+ _context37.n = 8;
22140
22179
  return takeEvery(GET_MESSAGE, getMessageQuery);
22141
22180
  case 8:
22142
- _context35.n = 9;
22181
+ _context37.n = 9;
22143
22182
  return takeLatest(GET_MESSAGE_MARKERS, getMessageMarkers);
22144
22183
  case 9:
22145
- _context35.n = 10;
22184
+ _context37.n = 10;
22146
22185
  return takeLatest(GET_MESSAGES_ATTACHMENTS, getMessageAttachments);
22147
22186
  case 10:
22148
- _context35.n = 11;
22187
+ _context37.n = 11;
22149
22188
  return takeLatest(LOAD_MORE_MESSAGES_ATTACHMENTS, loadMoreMessageAttachments);
22150
22189
  case 11:
22151
- _context35.n = 12;
22190
+ _context37.n = 12;
22152
22191
  return takeLatest(ADD_REACTION, addReaction);
22153
22192
  case 12:
22154
- _context35.n = 13;
22193
+ _context37.n = 13;
22155
22194
  return takeLatest(DELETE_REACTION, deleteReaction);
22156
22195
  case 13:
22157
- _context35.n = 14;
22196
+ _context37.n = 14;
22158
22197
  return takeEvery(LOAD_MORE_MESSAGES, loadMoreMessages);
22159
22198
  case 14:
22160
- _context35.n = 15;
22199
+ _context37.n = 15;
22161
22200
  return takeEvery(GET_REACTIONS, getReactions);
22162
22201
  case 15:
22163
- _context35.n = 16;
22202
+ _context37.n = 16;
22164
22203
  return takeEvery(LOAD_MORE_REACTIONS, loadMoreReactions);
22165
22204
  case 16:
22166
- _context35.n = 17;
22205
+ _context37.n = 17;
22167
22206
  return takeEvery(PAUSE_ATTACHMENT_UPLOADING, pauseAttachmentUploading);
22168
22207
  case 17:
22169
- _context35.n = 18;
22208
+ _context37.n = 18;
22170
22209
  return takeEvery(RESUME_ATTACHMENT_UPLOADING, resumeAttachmentUploading);
22171
22210
  case 18:
22172
- _context35.n = 19;
22211
+ _context37.n = 19;
22173
22212
  return takeEvery(ADD_POLL_VOTE, addPollVote);
22174
22213
  case 19:
22175
- _context35.n = 20;
22214
+ _context37.n = 20;
22176
22215
  return takeEvery(DELETE_POLL_VOTE, deletePollVote);
22177
22216
  case 20:
22178
- _context35.n = 21;
22217
+ _context37.n = 21;
22179
22218
  return takeEvery(CLOSE_POLL, closePoll);
22180
22219
  case 21:
22181
- _context35.n = 22;
22220
+ _context37.n = 22;
22182
22221
  return takeEvery(RETRACT_POLL_VOTE, retractPollVote);
22183
22222
  case 22:
22184
- _context35.n = 23;
22223
+ _context37.n = 23;
22185
22224
  return takeEvery(GET_POLL_VOTES, getPollVotes);
22186
22225
  case 23:
22187
- _context35.n = 24;
22226
+ _context37.n = 24;
22188
22227
  return takeEvery(LOAD_MORE_POLL_VOTES, loadMorePollVotes);
22189
22228
  case 24:
22190
- _context35.n = 25;
22229
+ _context37.n = 25;
22191
22230
  return takeEvery(RESEND_PENDING_POLL_ACTIONS, resendPendingPollActions);
22192
22231
  case 25:
22193
- return _context35.a(2);
22232
+ return _context37.a(2);
22194
22233
  }
22195
22234
  }, _marked32$1);
22196
22235
  }
@@ -23962,21 +24001,31 @@ var SceytChatContainer = function SceytChatContainer(_ref) {
23962
24001
  _ref$embeddedJoinGrou = _ref.embeddedJoinGroupPopup,
23963
24002
  embeddedJoinGroupPopup = _ref$embeddedJoinGrou === void 0 ? false : _ref$embeddedJoinGrou,
23964
24003
  onUpdateChannel = _ref.onUpdateChannel,
23965
- _ref$enableDisappeari = _ref.enableDisappearingMessages,
23966
- enableDisappearingMessages = _ref$enableDisappeari === void 0 ? false : _ref$enableDisappeari;
24004
+ _ref$disappearingSett = _ref.disappearingSettings,
24005
+ disappearingSettings = _ref$disappearingSett === void 0 ? null : _ref$disappearingSett;
23967
24006
  useEffect(function () {
23968
24007
  log.setLevel(logLevel);
24008
+ }, [logLevel]);
24009
+ useEffect(function () {
23969
24010
  if (baseUrlForInviteMembers) {
23970
24011
  setBaseUrlForInviteMembers(baseUrlForInviteMembers);
23971
24012
  }
24013
+ }, [baseUrlForInviteMembers]);
24014
+ useEffect(function () {
23972
24015
  if (useInviteLink) {
23973
24016
  setUseInviteLink(useInviteLink);
23974
24017
  }
24018
+ }, [useInviteLink]);
24019
+ useEffect(function () {
23975
24020
  if (inviteLinkOptions) {
23976
24021
  setInviteLinkOptions(inviteLinkOptions);
23977
24022
  }
23978
- setEnableDisappearingMessages(enableDisappearingMessages);
23979
- }, [baseUrlForInviteMembers, useInviteLink, inviteLinkOptions, enableDisappearingMessages]);
24023
+ }, [inviteLinkOptions]);
24024
+ useEffect(function () {
24025
+ if (disappearingSettings) {
24026
+ setDisappearingSettings(disappearingSettings);
24027
+ }
24028
+ }, [disappearingSettings]);
23980
24029
  return /*#__PURE__*/React__default.createElement(Provider, {
23981
24030
  store: store,
23982
24031
  context: SceytReduxContext
@@ -24344,7 +24393,7 @@ var ChannelMessageText = function ChannelMessageText(_ref2) {
24344
24393
  return mem === user.id ? ' You' : " " + systemMessageUserName(mem, contactsMap && contactsMap[mem], lastMessage.mentionedUsers);
24345
24394
  })) + " " + (lastMessageMetas && lastMessageMetas.m && lastMessageMetas.m.length > 5 ? "and " + (lastMessageMetas.m.length - 5) + " more" : '') : lastMessage.body === 'RM' ? " removed " + (lastMessageMetas && lastMessageMetas.m && lastMessageMetas.m.slice(0, 5).map(function (mem) {
24346
24395
  return mem === user.id ? ' You' : " " + systemMessageUserName(mem, contactsMap && contactsMap[mem], lastMessage.mentionedUsers);
24347
- })) + " " + (lastMessageMetas && lastMessageMetas.m && lastMessageMetas.m.length > 5 ? "and " + (lastMessageMetas.m.length - 5) + " more" : '') : lastMessage.body === 'LG' ? 'Left this group' : lastMessage.body === 'JL' ? 'joined via invite link' : lastMessage.body === 'ADM' && getEnableDisappearingMessages() ? !Number(lastMessageMetas === null || lastMessageMetas === void 0 ? void 0 : lastMessageMetas.autoDeletePeriod) ? 'disabled disappearing messages' : "set disappearing message time to " + formatDisappearingMessageTime(lastMessageMetas !== null && lastMessageMetas !== void 0 && lastMessageMetas.autoDeletePeriod ? Number(lastMessageMetas.autoDeletePeriod) : null) : '') : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(LastMessageDescription, {
24396
+ })) + " " + (lastMessageMetas && lastMessageMetas.m && lastMessageMetas.m.length > 5 ? "and " + (lastMessageMetas.m.length - 5) + " more" : '') : lastMessage.body === 'LG' ? 'Left this group' : lastMessage.body === 'JL' ? 'joined via invite link' : lastMessage.body === 'ADM' ? !Number(lastMessageMetas === null || lastMessageMetas === void 0 ? void 0 : lastMessageMetas.autoDeletePeriod) ? 'disabled disappearing messages' : "set the disappearing messages timer to " + formatDisappearingMessageTime(lastMessageMetas !== null && lastMessageMetas !== void 0 && lastMessageMetas.autoDeletePeriod ? Number(lastMessageMetas.autoDeletePeriod) : null) : '') : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(LastMessageDescription, {
24348
24397
  poll: (lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.pollDetails) && (lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.type) === MESSAGE_TYPE.POLL
24349
24398
  }, channel.lastReactedMessage && (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, "Reacted", /*#__PURE__*/React__default.createElement(ReactionItem, null, channel.newReactions && channel.newReactions[0] && channel.newReactions[0].key), "to", ' "')), LastMessageAttachments({
24350
24399
  lastMessage: lastMessage
@@ -29573,7 +29622,7 @@ var Message = function Message(_ref) {
29573
29622
  return mem === user.id ? 'You' : " " + systemMessageUserName(mem, contactsMap[mem], message.mentionedUsers);
29574
29623
  })) + " " + (messageMetas && messageMetas.m && messageMetas.m.length > 5 ? "and " + (messageMetas.m.length - 5) + " more" : '') : message.body === 'RM' ? " removed " + (messageMetas && messageMetas.m && messageMetas.m.slice(0, 5).map(function (mem) {
29575
29624
  return mem === user.id ? 'You' : " " + systemMessageUserName(mem, contactsMap[mem], message.mentionedUsers);
29576
- })) + " " + (messageMetas && messageMetas.m && messageMetas.m.length > 5 ? "and " + (messageMetas.m.length - 5) + " more" : '') : message.body === 'LG' ? ' left the group' : message.body === 'JL' ? " joined via invite link" : message.body === 'ADM' && getEnableDisappearingMessages() ? !Number(messageMetas === null || messageMetas === void 0 ? void 0 : messageMetas.autoDeletePeriod) ? ' disabled disappearing messages' : " set disappearing message time to " + formatDisappearingMessageTime(messageMetas !== null && messageMetas !== void 0 && messageMetas.autoDeletePeriod ? Number(messageMetas.autoDeletePeriod) : null) : ''));
29625
+ })) + " " + (messageMetas && messageMetas.m && messageMetas.m.length > 5 ? "and " + (messageMetas.m.length - 5) + " more" : '') : message.body === 'LG' ? ' left the group' : message.body === 'JL' ? " joined via invite link" : message.body === 'ADM' ? !Number(messageMetas === null || messageMetas === void 0 ? void 0 : messageMetas.autoDeletePeriod) ? ' disabled disappearing messages' : " set the disappearing messages timer to " + formatDisappearingMessageTime(messageMetas !== null && messageMetas !== void 0 && messageMetas.autoDeletePeriod ? Number(messageMetas.autoDeletePeriod) : null) : ''));
29577
29626
  };
29578
29627
  var SystemMessage = /*#__PURE__*/React__default.memo(Message, function (prevProps, nextProps) {
29579
29628
  return prevProps.message.deliveryStatus === nextProps.message.deliveryStatus && prevProps.message.state === nextProps.message.state && prevProps.message.userMarkers === nextProps.message.userMarkers && prevProps.nextMessage === nextProps.nextMessage && prevProps.connectionStatus === nextProps.connectionStatus && prevProps.tabIsActive === nextProps.tabIsActive;
@@ -32761,45 +32810,44 @@ var AudioVisualization = function AudioVisualization(_ref) {
32761
32810
  return Math.max(2, normalized);
32762
32811
  });
32763
32812
  }, [tmb, height]);
32764
- var progressPercentage = duration > 0 ? currentTime / duration * 100 : 0;
32765
- var lastPlayedBarIndex = useMemo(function () {
32766
- if (progressPercentage === 0) return -1;
32767
- var barIndex = Math.floor(progressPercentage / 100 * normalizedBars.length);
32768
- return Math.min(barIndex, normalizedBars.length - 1);
32769
- }, [progressPercentage, normalizedBars.length]);
32813
+ var exactIndex = duration > 0 ? currentTime / duration * normalizedBars.length : 0;
32814
+ var floorIndex = Math.floor(exactIndex);
32815
+ var fractionalPart = exactIndex - floorIndex;
32770
32816
  return /*#__PURE__*/React__default.createElement(Container$e, {
32771
32817
  height: height
32772
32818
  }, normalizedBars.map(function (barHeight, index) {
32773
- var barPosition = index / normalizedBars.length * 100;
32774
- var isPlayed = barPosition < progressPercentage;
32775
- var isLastPlayed = index === lastPlayedBarIndex;
32776
- var finalHeight = isLastPlayed ? Math.min(barHeight * 1.3, height) : barHeight;
32819
+ var progressRatio = index < floorIndex ? 1 : index === floorIndex ? fractionalPart : 0;
32820
+ var barOpacity = progressRatio > 0 ? 0.8 + progressRatio * 0.2 : 0.8;
32777
32821
  return /*#__PURE__*/React__default.createElement(Bar, {
32778
32822
  key: index,
32779
- height: finalHeight,
32823
+ height: barHeight,
32780
32824
  width: barWidth,
32781
32825
  gap: barGap,
32782
32826
  radius: barRadius,
32783
- color: isPlayed ? progressColor : waveColor,
32784
- isBold: isLastPlayed
32827
+ waveColor: waveColor,
32828
+ progressColor: progressColor,
32829
+ progressRatio: progressRatio,
32830
+ barOpacity: barOpacity
32785
32831
  });
32786
32832
  }));
32787
32833
  };
32788
32834
  var Container$e = styled.div(_templateObject$v || (_templateObject$v = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n height: ", "px;\n width: 100%;\n gap: 2px;\n"])), function (props) {
32789
32835
  return props.height;
32790
32836
  });
32791
- var Bar = styled.div(_templateObject2$r || (_templateObject2$r = _taggedTemplateLiteralLoose(["\n width: ", "px;\n height: ", "px;\n background-color: ", ";\n border-radius: ", "px;\n min-height: 2px;\n transition:\n background-color 0.1s ease,\n height 0.1s ease,\n opacity 0.1s ease;\n opacity: ", ";\n ", "\n"])), function (props) {
32837
+ var Bar = styled.div(_templateObject2$r || (_templateObject2$r = _taggedTemplateLiteralLoose(["\n position: relative;\n width: ", "px;\n height: ", "px;\n border-radius: ", "px;\n min-height: 2px;\n overflow: hidden;\n background-color: ", ";\n opacity: ", ";\n\n &::before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n width: ", "%;\n height: 100%;\n background-color: ", ";\n border-radius: inherit;\n will-change: width;\n transform: translateZ(0);\n }\n"])), function (props) {
32792
32838
  return props.width;
32793
32839
  }, function (props) {
32794
32840
  return props.height;
32795
- }, function (props) {
32796
- return props.color;
32797
32841
  }, function (props) {
32798
32842
  return props.radius;
32799
32843
  }, function (props) {
32800
- return props.isBold ? 1 : 0.8;
32844
+ return props.waveColor;
32845
+ }, function (props) {
32846
+ return props.barOpacity;
32801
32847
  }, function (props) {
32802
- return props.isBold ? "\n box-shadow: 0 0 4px " + props.color + ";\n filter: brightness(1.2);\n " : '';
32848
+ return props.progressRatio * 100;
32849
+ }, function (props) {
32850
+ return props.progressColor;
32803
32851
  });
32804
32852
 
32805
32853
  var _templateObject$w, _templateObject2$s, _templateObject3$m, _templateObject4$i, _templateObject5$f, _templateObject6$d, _templateObject7$c;
@@ -33054,7 +33102,7 @@ var AudioVisualizationPlaceholder = styled.div(_templateObject4$i || (_templateO
33054
33102
  }, function (props) {
33055
33103
  return props.hidden ? 'none' : 'auto';
33056
33104
  });
33057
- var AudioRate = styled.div(_templateObject5$f || (_templateObject5$f = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: ", ";\n width: 30px;\n min-width: 30px;\n border-radius: 12px;\n font-weight: 600;\n font-size: 12px;\n line-height: 14px;\n color: ", ";\n height: 18px;\n box-sizing: border-box;\n margin-left: 14px;\n cursor: pointer;\n\n & > span {\n margin-top: auto;\n line-height: 16px;\n font-size: 9px;\n }\n"])), function (props) {
33105
+ var AudioRate = styled.div(_templateObject5$f || (_templateObject5$f = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: 10px;\n right: 12px;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: ", ";\n width: 30px;\n min-width: 30px;\n border-radius: 12px;\n font-weight: 600;\n font-size: 12px;\n line-height: 14px;\n color: ", ";\n height: 18px;\n box-sizing: border-box;\n margin-left: 14px;\n cursor: pointer;\n\n & > span {\n margin-top: auto;\n line-height: 16px;\n font-size: 9px;\n }\n"])), function (props) {
33058
33106
  return props.backgroundColor;
33059
33107
  }, function (props) {
33060
33108
  return props.color;
@@ -38733,7 +38781,7 @@ var MessageList = function MessageList(_ref2) {
38733
38781
  nextDisableRef.current = false;
38734
38782
  clearMessagesMap();
38735
38783
  removeAllMessages();
38736
- dispatch(getMessagesAC(channel));
38784
+ dispatch(getMessagesAC(channel, false, lastVisibleMessageId, 0, false, false, 'instant', false));
38737
38785
  }
38738
38786
  }, [connectionStatus]);
38739
38787
  useEffect(function () {
@@ -44282,7 +44330,7 @@ function DisappearingMessagesPopup(_ref) {
44282
44330
  var _useState = useState('off'),
44283
44331
  selectedOption = _useState[0],
44284
44332
  setSelectedOption = _useState[1];
44285
- var _useState2 = useState('2days'),
44333
+ var _useState2 = useState(''),
44286
44334
  customValue = _useState2[0],
44287
44335
  setCustomValue = _useState2[1];
44288
44336
  var _useState3 = useState(true),
@@ -44293,6 +44341,22 @@ function DisappearingMessagesPopup(_ref) {
44293
44341
  setDropdownOpen = _useState4[1];
44294
44342
  var previousTimerRef = useRef(currentTimer);
44295
44343
  var hasInitializedRef = useRef(false);
44344
+ var CUSTOM_OPTIONS = useMemo(function () {
44345
+ var _getDisappearingSetti;
44346
+ return ((_getDisappearingSetti = getDisappearingSettings()) === null || _getDisappearingSetti === void 0 ? void 0 : _getDisappearingSetti.customOptions) || [];
44347
+ }, []);
44348
+ useEffect(function () {
44349
+ var _CUSTOM_OPTIONS$;
44350
+ if (CUSTOM_OPTIONS.length > 0 && (_CUSTOM_OPTIONS$ = CUSTOM_OPTIONS[0]) !== null && _CUSTOM_OPTIONS$ !== void 0 && _CUSTOM_OPTIONS$.label) {
44351
+ var _CUSTOM_OPTIONS$2;
44352
+ setCustomValue(((_CUSTOM_OPTIONS$2 = CUSTOM_OPTIONS[0]) === null || _CUSTOM_OPTIONS$2 === void 0 ? void 0 : _CUSTOM_OPTIONS$2.label) || '');
44353
+ }
44354
+ }, [CUSTOM_OPTIONS]);
44355
+ var CUSTOM_SECONDS_MAP = useMemo(function () {
44356
+ return Object.fromEntries(CUSTOM_OPTIONS.map(function (o) {
44357
+ return [o.label, o.seconds];
44358
+ }));
44359
+ }, [CUSTOM_OPTIONS]);
44296
44360
  useEffect(function () {
44297
44361
  if (previousTimerRef.current !== currentTimer) {
44298
44362
  setInitialRender(true);
@@ -44303,16 +44367,16 @@ function DisappearingMessagesPopup(_ref) {
44303
44367
  setSelectedOption('off');
44304
44368
  } else {
44305
44369
  var fixedMatch = Object.keys(FIXED_TIMER_OPTIONS).find(function (key) {
44306
- return FIXED_TIMER_OPTIONS[key] === currentTimer;
44370
+ return (FIXED_TIMER_OPTIONS[key] || 0) * 1000 === currentTimer;
44307
44371
  });
44308
44372
  if (fixedMatch) {
44309
44373
  setSelectedOption(fixedMatch);
44310
44374
  } else {
44311
44375
  var customMatch = CUSTOM_OPTIONS.find(function (o) {
44312
- return o.seconds === currentTimer;
44376
+ return o.seconds * 1000 === currentTimer;
44313
44377
  });
44314
44378
  setSelectedOption('custom');
44315
- setCustomValue((customMatch === null || customMatch === void 0 ? void 0 : customMatch.value) || '2days');
44379
+ setCustomValue((customMatch === null || customMatch === void 0 ? void 0 : customMatch.label) || '2days');
44316
44380
  }
44317
44381
  }
44318
44382
  }, [currentTimer]);
@@ -44327,9 +44391,10 @@ function DisappearingMessagesPopup(_ref) {
44327
44391
  }, [selectedOption, customValue]);
44328
44392
  var isValueUnchanged = useMemo(function () {
44329
44393
  if (initialRender) return true;
44330
- var normalizedCurrent = currentTimer === 0 ? null : currentTimer != null ? currentTimer : null;
44331
- var normalizedSelected = selectedTimerValue === 0 ? null : selectedTimerValue != null ? selectedTimerValue : null;
44332
- return normalizedCurrent === normalizedSelected;
44394
+ if ((selectedTimerValue || 0) * 1000 === (currentTimer || 0)) {
44395
+ return true;
44396
+ }
44397
+ return false;
44333
44398
  }, [currentTimer, selectedTimerValue, initialRender]);
44334
44399
  var handleSet = useCallback(function () {
44335
44400
  if (selectedOption === 'custom') {
@@ -44342,9 +44407,9 @@ function DisappearingMessagesPopup(_ref) {
44342
44407
  var selectedCustomLabel = useMemo(function () {
44343
44408
  var _CUSTOM_OPTIONS$find;
44344
44409
  return ((_CUSTOM_OPTIONS$find = CUSTOM_OPTIONS.find(function (o) {
44345
- return o.value === customValue;
44410
+ return o.label === customValue;
44346
44411
  })) === null || _CUSTOM_OPTIONS$find === void 0 ? void 0 : _CUSTOM_OPTIONS$find.label) || '2 days';
44347
- }, [customValue]);
44412
+ }, [customValue, CUSTOM_OPTIONS]);
44348
44413
  return /*#__PURE__*/React__default.createElement(PopupContainer, null, /*#__PURE__*/React__default.createElement(Popup, {
44349
44414
  theme: theme,
44350
44415
  backgroundColor: background,
@@ -44390,7 +44455,7 @@ function DisappearingMessagesPopup(_ref) {
44390
44455
  borderRadius: '4px',
44391
44456
  variant: 'checkbox'
44392
44457
  }), option.label);
44393
- }), /*#__PURE__*/React__default.createElement(TimerOptionItem, {
44458
+ }), CUSTOM_OPTIONS.length > 0 && (/*#__PURE__*/React__default.createElement(TimerOptionItem, {
44394
44459
  color: textPrimary,
44395
44460
  onClick: function onClick() {
44396
44461
  return setSelectedOption('custom');
@@ -44406,7 +44471,7 @@ function DisappearingMessagesPopup(_ref) {
44406
44471
  borderColor: iconInactive,
44407
44472
  borderRadius: '4px',
44408
44473
  variant: 'checkbox'
44409
- }), "Custom"), selectedOption === 'custom' && (/*#__PURE__*/React__default.createElement(CustomTimerSection, null, /*#__PURE__*/React__default.createElement(Label, {
44474
+ }), "Custom")), selectedOption === 'custom' && (/*#__PURE__*/React__default.createElement(CustomTimerSection, null, /*#__PURE__*/React__default.createElement(Label, {
44410
44475
  color: textPrimary,
44411
44476
  marginTop: '0'
44412
44477
  }, "Auto-delete after"), /*#__PURE__*/React__default.createElement(CustomSelectWrapper, {
@@ -44435,9 +44500,9 @@ function DisappearingMessagesPopup(_ref) {
44435
44500
  }, CUSTOM_OPTIONS.map(function (o) {
44436
44501
  return /*#__PURE__*/React__default.createElement(CustomDropdownOptionLi, {
44437
44502
  hoverBackground: backgroundHovered,
44438
- key: o.value,
44503
+ key: o.label,
44439
44504
  onClick: function onClick() {
44440
- return setCustomValue(o.value);
44505
+ return setCustomValue(o.label);
44441
44506
  },
44442
44507
  textColor: textPrimary
44443
44508
  }, o.label);
@@ -44476,6 +44541,7 @@ var SetButton = styled(Button)(_templateObject8$n || (_templateObject8$n = _tagg
44476
44541
 
44477
44542
  var _templateObject$T, _templateObject2$O, _templateObject3$H, _templateObject4$B, _templateObject5$w, _templateObject6$s, _templateObject7$r, _templateObject8$o, _templateObject9$k, _templateObject0$i, _templateObject1$f, _templateObject10$9, _templateObject11$7, _templateObject12$6, _templateObject13$4, _templateObject14$3, _templateObject15$3, _templateObject16$3, _templateObject17$3, _templateObject18$3, _templateObject19$3, _templateObject20$3;
44478
44543
  var Actions = function Actions(_ref) {
44544
+ var _getDisappearingSetti;
44479
44545
  var setActionsHeight = _ref.setActionsHeight,
44480
44546
  channel = _ref.channel,
44481
44547
  actionMenuOpen = _ref.actionMenuOpen,
@@ -44784,7 +44850,7 @@ var Actions = function Actions(_ref) {
44784
44850
  color: staredMessagesTextColor || textPrimary,
44785
44851
  hoverColor: staredMessagesTextColor || textPrimary,
44786
44852
  fontSize: actionItemsFontSize
44787
- }, /*#__PURE__*/React__default.createElement(React__default.Fragment, null, staredMessagesIcon || /*#__PURE__*/React__default.createElement(DefaultStarIcon, null), " Starred messages "))), getEnableDisappearingMessages() && !channel.isMockChannel && canToggleDisappearingMessages && (isDirectChannel && directChannelUser ? directChannelUser.state !== USER_STATE.DELETED : true) && (/*#__PURE__*/React__default.createElement(ActionItem, {
44853
+ }, /*#__PURE__*/React__default.createElement(React__default.Fragment, null, staredMessagesIcon || /*#__PURE__*/React__default.createElement(DefaultStarIcon, null), " Starred messages "))), ((_getDisappearingSetti = getDisappearingSettings()) === null || _getDisappearingSetti === void 0 ? void 0 : _getDisappearingSetti.show) && !channel.isMockChannel && canToggleDisappearingMessages && (isDirectChannel && directChannelUser ? directChannelUser.state !== USER_STATE.DELETED : true) && (/*#__PURE__*/React__default.createElement(ActionItem, {
44788
44854
  key: 1.5,
44789
44855
  onClick: handleToggleDisappearingMessagesPopup,
44790
44856
  iconColor: iconPrimary,