sceyt-chat-react-uikit 1.7.7-beta.16 → 1.7.7-beta.18

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