sceyt-chat-react-uikit 1.9.0-beta.5 → 1.9.0-beta.6

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 +397 -306
  2. package/index.modern.js +397 -306
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -11896,6 +11896,82 @@ var formatDisappearingMessageTime = function formatDisappearingMessageTime(perio
11896
11896
  return parts.join(' ');
11897
11897
  };
11898
11898
 
11899
+ var preparations = new Map();
11900
+ var beginVideoPreparation = function beginVideoPreparation(tid, file) {
11901
+ var resolvePreparation;
11902
+ var promise = new Promise(function (resolve) {
11903
+ resolvePreparation = resolve;
11904
+ });
11905
+ preparations.set(tid, {
11906
+ file: file,
11907
+ status: 'loading',
11908
+ promise: promise,
11909
+ resolve: resolvePreparation
11910
+ });
11911
+ };
11912
+ var completeVideoPreparation = function completeVideoPreparation(tid, preparation) {
11913
+ var entry = preparations.get(tid);
11914
+ if (!entry || entry.status !== 'loading') return;
11915
+ var completed = _extends({}, preparation, {
11916
+ status: 'ready'
11917
+ });
11918
+ preparations.set(tid, _extends({}, entry, completed));
11919
+ entry.resolve(completed);
11920
+ };
11921
+ var failVideoPreparation = function failVideoPreparation(tid) {
11922
+ var entry = preparations.get(tid);
11923
+ if (!entry || entry.status !== 'loading') return;
11924
+ var failed = {
11925
+ file: entry.file,
11926
+ status: 'failed'
11927
+ };
11928
+ preparations.set(tid, _extends({}, entry, failed));
11929
+ entry.resolve(failed);
11930
+ };
11931
+ var waitForVideoPreparation = function waitForVideoPreparation(tid, timeoutMs) {
11932
+ try {
11933
+ var _temp2 = function _temp2(_result) {
11934
+ return _exit ? _result : Promise.resolve(new Promise(function (resolve) {
11935
+ var timeout = setTimeout(function () {
11936
+ return resolve({
11937
+ file: entry.file,
11938
+ status: 'failed'
11939
+ });
11940
+ }, timeoutMs);
11941
+ entry.promise.then(function (prepared) {
11942
+ clearTimeout(timeout);
11943
+ resolve(prepared);
11944
+ });
11945
+ }));
11946
+ };
11947
+ var _exit = false;
11948
+ var entry = preparations.get(tid);
11949
+ if (!entry) return Promise.resolve(null);
11950
+ if (entry.status !== 'loading') return Promise.resolve(entry);
11951
+ var _temp = function () {
11952
+ if (timeoutMs === undefined) {
11953
+ return Promise.resolve(entry.promise).then(function (_await$entry$promise) {
11954
+ _exit = true;
11955
+ return _await$entry$promise;
11956
+ });
11957
+ }
11958
+ }();
11959
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
11960
+ } catch (e) {
11961
+ return Promise.reject(e);
11962
+ }
11963
+ };
11964
+ var clearVideoPreparation = function clearVideoPreparation(tid) {
11965
+ var entry = preparations.get(tid);
11966
+ if ((entry === null || entry === void 0 ? void 0 : entry.status) === 'loading') {
11967
+ entry.resolve({
11968
+ file: entry.file,
11969
+ status: 'failed'
11970
+ });
11971
+ }
11972
+ preparations["delete"](tid);
11973
+ };
11974
+
11899
11975
  var LOAD_LATEST_MESSAGES = 'LOAD_LATEST_MESSAGES';
11900
11976
  var LOAD_AROUND_MESSAGE = 'LOAD_AROUND_MESSAGE';
11901
11977
  var REFRESH_CACHE_AROUND_MESSAGE = 'REFRESH_CACHE_AROUND_MESSAGE';
@@ -13121,6 +13197,7 @@ var setSendMessageHandler = function setSendMessageHandler(handler) {
13121
13197
  sendMessageHandler = handler;
13122
13198
  };
13123
13199
  var pendingAttachments = {};
13200
+ var deletedPendingMessageTids = new Set();
13124
13201
  var messagesMap = {};
13125
13202
  var activeSegment = null;
13126
13203
  var activeSegmentChannelId = null;
@@ -13872,6 +13949,7 @@ function clearMessagesMap() {
13872
13949
  messagesMap = {};
13873
13950
  loadedSegmentsMap = {};
13874
13951
  channelVisitOrder = [];
13952
+ deletedPendingMessageTids.clear();
13875
13953
  clearActiveSegment();
13876
13954
  }
13877
13955
  function checkChannelExistsOnMessagesMap(channelId) {
@@ -13880,6 +13958,15 @@ function checkChannelExistsOnMessagesMap(channelId) {
13880
13958
  var setPendingAttachment = function setPendingAttachment(attachmentId, data) {
13881
13959
  pendingAttachments[attachmentId] = _extends({}, pendingAttachments[attachmentId], data);
13882
13960
  };
13961
+ var deletedPendingMessageKey = function deletedPendingMessageKey(channelId, messageTid) {
13962
+ return channelId + ":" + messageTid;
13963
+ };
13964
+ var markPendingMessageDeleted = function markPendingMessageDeleted(channelId, messageTid) {
13965
+ deletedPendingMessageTids.add(deletedPendingMessageKey(channelId, messageTid));
13966
+ };
13967
+ var isPendingMessageDeleted = function isPendingMessageDeleted(channelId, messageTid) {
13968
+ return deletedPendingMessageTids.has(deletedPendingMessageKey(channelId, messageTid));
13969
+ };
13883
13970
  var getPendingAttachment = function getPendingAttachment(attachmentId) {
13884
13971
  return pendingAttachments[attachmentId];
13885
13972
  };
@@ -13887,13 +13974,18 @@ var deletePendingAttachment = function deletePendingAttachment(attachmentId) {
13887
13974
  return delete pendingAttachments[attachmentId];
13888
13975
  };
13889
13976
  var deletePendingMessage = function deletePendingMessage(channelId, message) {
13977
+ var messageTid = message.tid || message.id;
13978
+ if (messageTid) {
13979
+ markPendingMessageDeleted(channelId, messageTid);
13980
+ }
13890
13981
  if (message.attachments && message.attachments.length) {
13891
13982
  var customUploader = getCustomUploader();
13892
13983
  message.attachments.forEach(function (att) {
13893
13984
  if (customUploader) {
13894
13985
  cancelUpload(att.tid);
13895
- deletePendingAttachment(att.tid);
13896
13986
  }
13987
+ deletePendingAttachment(att.tid);
13988
+ clearVideoPreparation(att.tid);
13897
13989
  releaseBlobUrls(["compose_" + att.tid]);
13898
13990
  });
13899
13991
  }
@@ -16508,75 +16600,6 @@ var createAttachmentUnavailableError = function createAttachmentUnavailableError
16508
16600
  return error;
16509
16601
  };
16510
16602
 
16511
- var preparations = new Map();
16512
- var beginVideoPreparation = function beginVideoPreparation(tid, file) {
16513
- var resolvePreparation;
16514
- var promise = new Promise(function (resolve) {
16515
- resolvePreparation = resolve;
16516
- });
16517
- preparations.set(tid, {
16518
- file: file,
16519
- status: 'loading',
16520
- promise: promise,
16521
- resolve: resolvePreparation
16522
- });
16523
- };
16524
- var completeVideoPreparation = function completeVideoPreparation(tid, preparation) {
16525
- var entry = preparations.get(tid);
16526
- if (!entry || entry.status !== 'loading') return;
16527
- var completed = _extends({}, preparation, {
16528
- status: 'ready'
16529
- });
16530
- preparations.set(tid, _extends({}, entry, completed));
16531
- entry.resolve(completed);
16532
- };
16533
- var failVideoPreparation = function failVideoPreparation(tid) {
16534
- var entry = preparations.get(tid);
16535
- if (!entry || entry.status !== 'loading') return;
16536
- var failed = {
16537
- file: entry.file,
16538
- status: 'failed'
16539
- };
16540
- preparations.set(tid, _extends({}, entry, failed));
16541
- entry.resolve(failed);
16542
- };
16543
- var waitForVideoPreparation = function waitForVideoPreparation(tid, timeoutMs) {
16544
- try {
16545
- var _temp2 = function _temp2(_result) {
16546
- return _exit ? _result : Promise.resolve(new Promise(function (resolve) {
16547
- var timeout = setTimeout(function () {
16548
- return resolve({
16549
- file: entry.file,
16550
- status: 'failed'
16551
- });
16552
- }, timeoutMs);
16553
- entry.promise.then(function (prepared) {
16554
- clearTimeout(timeout);
16555
- resolve(prepared);
16556
- });
16557
- }));
16558
- };
16559
- var _exit = false;
16560
- var entry = preparations.get(tid);
16561
- if (!entry) return Promise.resolve(null);
16562
- if (entry.status !== 'loading') return Promise.resolve(entry);
16563
- var _temp = function () {
16564
- if (timeoutMs === undefined) {
16565
- return Promise.resolve(entry.promise).then(function (_await$entry$promise) {
16566
- _exit = true;
16567
- return _await$entry$promise;
16568
- });
16569
- }
16570
- }();
16571
- return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
16572
- } catch (e) {
16573
- return Promise.reject(e);
16574
- }
16575
- };
16576
- var clearVideoPreparation = function clearVideoPreparation(tid) {
16577
- preparations["delete"](tid);
16578
- };
16579
-
16580
16603
  var idleSnapshot = {
16581
16604
  state: 'idle',
16582
16605
  loaded: 0,
@@ -16968,6 +16991,16 @@ var prefetchCompletionWaiters = new Map();
16968
16991
  var prefetchCancelVersions = new Map();
16969
16992
  var ACTIVE_CHANNEL_RECONNECT_REFRESH_TIMEOUT_MS = 1500;
16970
16993
  var VIDEO_PREPARATION_TIMEOUT_MS = 10000;
16994
+ var hasLivePendingAttachment = function hasLivePendingAttachment(message) {
16995
+ var _message$attachments;
16996
+ return Boolean(message.tid && ((_message$attachments = message.attachments) === null || _message$attachments === void 0 ? void 0 : _message$attachments.some(function (attachment) {
16997
+ var _getPendingAttachment;
16998
+ return Boolean(attachment.tid && ((_getPendingAttachment = getPendingAttachment(attachment.tid)) === null || _getPendingAttachment === void 0 ? void 0 : _getPendingAttachment.file));
16999
+ })));
17000
+ };
17001
+ var retractDeletedPendingMessage = function retractDeletedPendingMessage(channel, messageId) {
17002
+ return channel.deleteMessageById(messageId, false);
17003
+ };
16971
17004
  var applyPreparedVideoAttachments = function applyPreparedVideoAttachments(attachments) {
16972
17005
  try {
16973
17006
  return Promise.resolve(Promise.all(attachments.map(function (attachment) {
@@ -17428,8 +17461,8 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
17428
17461
  };
17429
17462
  var shouldRecoverVideoSource = attachment.type === attachmentTypes.video && !(attachment.url instanceof Blob);
17430
17463
  if ((!attachment.cachedUrl || shouldRecoverVideoSource) && !(attachment.url instanceof Blob)) {
17431
- var _getPendingAttachment;
17432
- var pendingFile = (_getPendingAttachment = getPendingAttachment(attachment.tid)) === null || _getPendingAttachment === void 0 ? void 0 : _getPendingAttachment.file;
17464
+ var _getPendingAttachment2;
17465
+ var pendingFile = (_getPendingAttachment2 = getPendingAttachment(attachment.tid)) === null || _getPendingAttachment2 === void 0 ? void 0 : _getPendingAttachment2.file;
17433
17466
  if (pendingFile instanceof Blob) {
17434
17467
  attachment = _extends({}, attachment, {
17435
17468
  url: pendingFile,
@@ -17871,7 +17904,7 @@ var syncFailedMessageState = /*#__PURE__*/_regenerator().m(function _callee2(cha
17871
17904
  }, _callee2);
17872
17905
  });
17873
17906
  function sendMessage(action) {
17874
- var payload, message, connectionState, channelId, sendAttachmentsAsSeparateMessage, pendingMessages, channel, _channel, SceytChatClient, createChannelData, mentionedUserIds, customUploader, linkAttachment, attachmentsToSend, messagesToSend, mediaAttachments, _loop2, i, messageBuilder, messageToSend, pending, _loop3, _i2, _t2;
17907
+ var payload, message, connectionState, channelId, sendAttachmentsAsSeparateMessage, pendingMessages, channel, _channel, SceytChatClient, createChannelData, mentionedUserIds, customUploader, linkAttachment, attachmentsToSend, messagesToSend, mediaAttachments, _loop2, i, messageBuilder, messageToSend, pending, _loop3, _ret, _i2, _t3;
17875
17908
  return _regenerator().w(function (_context13) {
17876
17909
  while (1) switch (_context13.p = _context13.n) {
17877
17910
  case 0:
@@ -17921,7 +17954,7 @@ function sendMessage(action) {
17921
17954
  }) : [];
17922
17955
  customUploader = getCustomUploader();
17923
17956
  if (!(message.attachments && message.attachments.length)) {
17924
- _context13.n = 15;
17957
+ _context13.n = 16;
17925
17958
  break;
17926
17959
  }
17927
17960
  linkAttachment = null;
@@ -17938,13 +17971,13 @@ function sendMessage(action) {
17938
17971
  break;
17939
17972
  }
17940
17973
  _loop2 = /*#__PURE__*/_regenerator().m(function _callee3() {
17941
- var attachment, _getPendingAttachment2, pendingFile, sourceFile, uri, attachmentBuilder, messageAttachment, handleUpdateUploadProgress, _messageBuilder, _messageToSend, _sourceFile, messageForSend, _pending;
17974
+ var attachment, _getPendingAttachment3, pendingFile, sourceFile, uri, attachmentBuilder, messageAttachment, handleUpdateUploadProgress, _messageBuilder, _messageToSend, _sourceFile, messageForSend, _pending;
17942
17975
  return _regenerator().w(function (_context11) {
17943
17976
  while (1) switch (_context11.n) {
17944
17977
  case 0:
17945
17978
  attachment = mediaAttachments[i];
17946
17979
  if (!attachment.cachedUrl && !(attachment.data instanceof Blob)) {
17947
- pendingFile = (_getPendingAttachment2 = getPendingAttachment(attachment.tid)) === null || _getPendingAttachment2 === void 0 ? void 0 : _getPendingAttachment2.file;
17980
+ pendingFile = (_getPendingAttachment3 = getPendingAttachment(attachment.tid)) === null || _getPendingAttachment3 === void 0 ? void 0 : _getPendingAttachment3.file;
17948
17981
  if (pendingFile instanceof Blob) {
17949
17982
  attachment = _extends({}, attachment, {
17950
17983
  data: pendingFile
@@ -18219,7 +18252,7 @@ function sendMessage(action) {
18219
18252
  messagesToSend.push(messageToSend);
18220
18253
  case 12:
18221
18254
  _loop3 = /*#__PURE__*/_regenerator().m(function _callee4(_i2) {
18222
- var messageAttachment, messageToSend, pendingState, pendingAttachments, messageCopy, attachmentIndex, preparedVideoAttachment, _attachmentsToSend, linkAttachmentToSend, linkAttachmentBuilder, messageResponse, k, attachmentsToUpdate, currentAttachmentsMap, messageUpdateData, activeChannelId, messageToUpdate, resolvedLastMessage, channelUpdateParam, _channel2, _messageToSend2, isErrorResendable, _messageToSend$attach, _iterator2, _step2, att, _t;
18255
+ var messageAttachment, messageToSend, pendingState, pendingAttachments, messageCopy, attachmentIndex, preparedVideoAttachment, _attachmentsToSend, linkAttachmentToSend, linkAttachmentBuilder, messageResponse, k, attachmentsToUpdate, currentAttachmentsMap, messageUpdateData, activeChannelId, messageToUpdate, resolvedLastMessage, channelUpdateParam, _channel2, _messageToSend2, isErrorResendable, _messageToSend$attach, _iterator2, _step2, att, _t, _t2;
18223
18256
  return _regenerator().w(function (_context12) {
18224
18257
  while (1) switch (_context12.p = _context12.n) {
18225
18258
  case 0:
@@ -18243,12 +18276,18 @@ function sendMessage(action) {
18243
18276
  case 2:
18244
18277
  _context12.p = 2;
18245
18278
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
18246
- _context12.n = 21;
18279
+ _context12.n = 30;
18247
18280
  break;
18248
18281
  }
18249
- _context12.n = 3;
18250
- return effects.call(applyPreparedVideoAttachments, messageAttachment);
18282
+ if (!(messageToSend.tid && isPendingMessageDeleted(channel.id, messageToSend.tid))) {
18283
+ _context12.n = 3;
18284
+ break;
18285
+ }
18286
+ return _context12.a(2, 0);
18251
18287
  case 3:
18288
+ _context12.n = 4;
18289
+ return effects.call(applyPreparedVideoAttachments, messageAttachment);
18290
+ case 4:
18252
18291
  pendingAttachments = messageAttachment.map(function (attachment) {
18253
18292
  return _extends({}, attachment, {
18254
18293
  data: attachment.data || attachment.url
@@ -18260,52 +18299,70 @@ function sendMessage(action) {
18260
18299
  attachments: pendingAttachments
18261
18300
  }
18262
18301
  });
18263
- _context12.n = 4;
18302
+ _context12.n = 5;
18264
18303
  return effects.put(updateMessageAC(messageToSend.tid, {
18265
18304
  attachments: pendingAttachments
18266
18305
  }));
18267
- case 4:
18306
+ case 5:
18268
18307
  messageCopy = JSON.parse(JSON.stringify(messagesToSend[_i2]));
18308
+ if (!(messageToSend.tid && isPendingMessageDeleted(channel.id, messageToSend.tid))) {
18309
+ _context12.n = 6;
18310
+ break;
18311
+ }
18312
+ return _context12.a(2, 0);
18313
+ case 6:
18269
18314
  if (customUploader) {
18270
- _context12.n = 8;
18315
+ _context12.n = 10;
18271
18316
  break;
18272
18317
  }
18273
18318
  attachmentIndex = 0;
18274
- case 5:
18319
+ case 7:
18275
18320
  if (!(attachmentIndex < messageAttachment.length)) {
18276
- _context12.n = 8;
18321
+ _context12.n = 10;
18277
18322
  break;
18278
18323
  }
18279
18324
  if (!(messageAttachment[attachmentIndex].type === attachmentTypes.video)) {
18280
- _context12.n = 7;
18325
+ _context12.n = 9;
18281
18326
  break;
18282
18327
  }
18283
- _context12.n = 6;
18328
+ _context12.n = 8;
18284
18329
  return effects.call(prepareAndUploadVideoPreview, messageAttachment[attachmentIndex], message.type);
18285
- case 6:
18330
+ case 8:
18286
18331
  preparedVideoAttachment = _context12.v;
18287
18332
  messageAttachment[attachmentIndex] = _extends({}, messageAttachment[attachmentIndex], preparedVideoAttachment);
18288
18333
  if (!messageAttachment[attachmentIndex].upload) {
18289
- _context12.n = 7;
18334
+ _context12.n = 9;
18290
18335
  break;
18291
18336
  }
18292
- _context12.n = 7;
18337
+ _context12.n = 9;
18293
18338
  return effects.put(updateAttachmentUploadingStateAC(UPLOAD_STATE.UPLOADING, messageAttachment[attachmentIndex].tid));
18294
- case 7:
18339
+ case 9:
18295
18340
  attachmentIndex++;
18296
- _context12.n = 5;
18341
+ _context12.n = 7;
18297
18342
  break;
18298
- case 8:
18343
+ case 10:
18344
+ if (!(messageToSend.tid && isPendingMessageDeleted(channel.id, messageToSend.tid))) {
18345
+ _context12.n = 11;
18346
+ break;
18347
+ }
18348
+ return _context12.a(2, 0);
18349
+ case 11:
18299
18350
  _attachmentsToSend = messageAttachment;
18300
18351
  if (!customUploader) {
18301
- _context12.n = 10;
18352
+ _context12.n = 13;
18302
18353
  break;
18303
18354
  }
18304
- _context12.n = 9;
18355
+ _context12.n = 12;
18305
18356
  return effects.call(handleUploadAttachments, messageAttachment || [], messageCopy, channel);
18306
- case 9:
18357
+ case 12:
18307
18358
  _attachmentsToSend = _context12.v;
18308
- case 10:
18359
+ case 13:
18360
+ if (!(messageToSend.tid && isPendingMessageDeleted(channel.id, messageToSend.tid))) {
18361
+ _context12.n = 14;
18362
+ break;
18363
+ }
18364
+ return _context12.a(2, 0);
18365
+ case 14:
18309
18366
  linkAttachmentToSend = null;
18310
18367
  if (_i2 === 0 && linkAttachment) {
18311
18368
  linkAttachmentBuilder = channel.createAttachmentBuilder(linkAttachment.data, linkAttachment.type);
@@ -18320,40 +18377,61 @@ function sendMessage(action) {
18320
18377
  attachments: [].concat(_attachmentsToSend)
18321
18378
  });
18322
18379
  }
18323
- _context12.n = 11;
18380
+ _context12.n = 15;
18324
18381
  return effects.call(channel.sendMessage, messageToSend);
18325
- case 11:
18382
+ case 15:
18326
18383
  messageResponse = _context12.v;
18384
+ if (!(messageToSend.tid && isPendingMessageDeleted(channel.id, messageToSend.tid))) {
18385
+ _context12.n = 20;
18386
+ break;
18387
+ }
18388
+ if (!(messageResponse !== null && messageResponse !== void 0 && messageResponse.id && typeof channel.deleteMessageById === 'function')) {
18389
+ _context12.n = 19;
18390
+ break;
18391
+ }
18392
+ _context12.p = 16;
18393
+ _context12.n = 17;
18394
+ return effects.call(retractDeletedPendingMessage, channel, messageResponse.id);
18395
+ case 17:
18396
+ _context12.n = 19;
18397
+ break;
18398
+ case 18:
18399
+ _context12.p = 18;
18400
+ _t = _context12.v;
18401
+ log.warn('Unable to retract a deleted pending message:', _t);
18402
+ case 19:
18403
+ return _context12.a(2, 0);
18404
+ case 20:
18327
18405
  if (messageToSend.tid) {
18328
18406
  autoResendAttempts["delete"](messageToSend.tid);
18329
18407
  }
18330
18408
  if (!customUploader) {
18331
- _context12.n = 16;
18409
+ _context12.n = 25;
18332
18410
  break;
18333
18411
  }
18334
18412
  k = 0;
18335
- case 12:
18413
+ case 21:
18336
18414
  if (!(k < messageAttachment.length)) {
18337
- _context12.n = 16;
18415
+ _context12.n = 25;
18338
18416
  break;
18339
18417
  }
18340
18418
  messageResponse.attachments[k] = _extends({}, messageResponse.attachments[k], {
18341
18419
  user: JSON.parse(JSON.stringify(messageResponse.user)),
18342
18420
  tid: messageAttachment[k].tid
18343
18421
  });
18344
- _context12.n = 13;
18422
+ _context12.n = 22;
18345
18423
  return effects.put(removeAttachmentProgressAC(messageAttachment[k].tid));
18346
- case 13:
18347
- _context12.n = 14;
18424
+ case 22:
18425
+ _context12.n = 23;
18348
18426
  return effects.put(removeAttachmentUploadingStateAC(messageAttachment[k].tid));
18349
- case 14:
18427
+ case 23:
18350
18428
  deletePendingAttachment(messageAttachment[k].tid);
18351
18429
  releaseBlobUrls(["compose_" + messageAttachment[k].tid]);
18352
- case 15:
18430
+ case 24:
18353
18431
  k++;
18354
- _context12.n = 12;
18432
+ _context12.n = 21;
18355
18433
  break;
18356
- case 16:
18434
+ case 25:
18357
18435
  attachmentsToUpdate = [];
18358
18436
  if (messageResponse.attachments && messageResponse.attachments.length > 0) {
18359
18437
  currentAttachmentsMap = {};
@@ -18404,27 +18482,27 @@ function sendMessage(action) {
18404
18482
  });
18405
18483
  activeChannelId = getActiveChannelId();
18406
18484
  if (!(activeChannelId === channel.id)) {
18407
- _context12.n = 17;
18485
+ _context12.n = 26;
18408
18486
  break;
18409
18487
  }
18410
- _context12.n = 17;
18488
+ _context12.n = 26;
18411
18489
  return effects.put(updateMessageAC(messageToSend.tid, messageUpdateData, true));
18412
- case 17:
18490
+ case 26:
18413
18491
  messageToUpdate = JSON.parse(JSON.stringify(_extends({}, messageResponse, {
18414
18492
  attachments: attachmentsToUpdate
18415
18493
  })));
18416
18494
  addConfirmedMessageToCache(channel.id, messageToUpdate);
18417
18495
  updateTabAttachmentCache(channel.id, attachmentsToUpdate, messageResponse.user);
18418
18496
  if (!channel.unread) {
18419
- _context12.n = 18;
18497
+ _context12.n = 27;
18420
18498
  break;
18421
18499
  }
18422
- _context12.n = 18;
18500
+ _context12.n = 27;
18423
18501
  return effects.put(markChannelAsReadAC(channel.id));
18424
- case 18:
18502
+ case 27:
18425
18503
  resolvedLastMessage = getResolvedChannelLastMessage(channel.id, messageToUpdate, messageToSend);
18426
18504
  if (!lastMessageNeedsUpdate(getReduxChannelLastMessage(channel.id), resolvedLastMessage)) {
18427
- _context12.n = 20;
18505
+ _context12.n = 29;
18428
18506
  break;
18429
18507
  }
18430
18508
  updateChannelLastMessageOnAllChannels(channel.id, resolvedLastMessage);
@@ -18432,80 +18510,93 @@ function sendMessage(action) {
18432
18510
  lastMessage: resolvedLastMessage,
18433
18511
  lastReactedMessage: null
18434
18512
  };
18435
- _context12.n = 19;
18513
+ _context12.n = 28;
18436
18514
  return effects.put(updateChannelDataAC(channel.id, channelUpdateParam, true));
18437
- case 19:
18515
+ case 28:
18438
18516
  updateChannelOnAllChannels(channel.id, channelUpdateParam);
18439
- case 20:
18440
- _context12.n = 22;
18517
+ case 29:
18518
+ _context12.n = 31;
18441
18519
  break;
18442
- case 21:
18520
+ case 30:
18443
18521
  throw new Error('Connection required to send message');
18444
- case 22:
18445
- _context12.n = 27;
18522
+ case 31:
18523
+ _context12.n = 37;
18446
18524
  break;
18447
- case 23:
18448
- _context12.p = 23;
18449
- _t = _context12.v;
18450
- isErrorResendable = isResendableError(_t === null || _t === void 0 ? void 0 : _t.type);
18525
+ case 32:
18526
+ _context12.p = 32;
18527
+ _t2 = _context12.v;
18528
+ if (!(messageToSend.tid && isPendingMessageDeleted(channel.id, messageToSend.tid))) {
18529
+ _context12.n = 33;
18530
+ break;
18531
+ }
18532
+ return _context12.a(2, 0);
18533
+ case 33:
18534
+ isErrorResendable = isResendableError(_t2 === null || _t2 === void 0 ? void 0 : _t2.type);
18451
18535
  if (!((_channel2 = channel) !== null && _channel2 !== void 0 && _channel2.id && (_messageToSend2 = messageToSend) !== null && _messageToSend2 !== void 0 && _messageToSend2.tid)) {
18452
- _context12.n = 27;
18536
+ _context12.n = 37;
18453
18537
  break;
18454
18538
  }
18455
- log.error('Error on uploading attachment', messageToSend.tid, _t);
18539
+ log.error('Error on uploading attachment', messageToSend.tid, _t2);
18456
18540
  if (!((_messageToSend$attach = messageToSend.attachments) !== null && _messageToSend$attach !== void 0 && _messageToSend$attach.length)) {
18457
- _context12.n = 26;
18541
+ _context12.n = 36;
18458
18542
  break;
18459
18543
  }
18460
18544
  _iterator2 = _createForOfIteratorHelperLoose(messageToSend.attachments);
18461
- case 24:
18545
+ case 34:
18462
18546
  if ((_step2 = _iterator2()).done) {
18463
- _context12.n = 26;
18547
+ _context12.n = 36;
18464
18548
  break;
18465
18549
  }
18466
18550
  att = _step2.value;
18467
18551
  if (!att.tid) {
18468
- _context12.n = 25;
18552
+ _context12.n = 35;
18469
18553
  break;
18470
18554
  }
18471
- _context12.n = 25;
18555
+ _context12.n = 35;
18472
18556
  return effects.put(updateAttachmentUploadingStateAC(UPLOAD_STATE.FAIL, att.tid));
18473
- case 25:
18474
- _context12.n = 24;
18557
+ case 35:
18558
+ _context12.n = 34;
18475
18559
  break;
18476
- case 26:
18477
- _context12.n = 27;
18560
+ case 36:
18561
+ _context12.n = 37;
18478
18562
  return effects.call(syncFailedMessageState, channel, messageToSend.tid, pendingMessages[_i2] || messageToSend, isErrorResendable);
18479
- case 27:
18563
+ case 37:
18480
18564
  return _context12.a(2);
18481
18565
  }
18482
- }, _callee4, null, [[2, 23]]);
18566
+ }, _callee4, null, [[16, 18], [2, 32]]);
18483
18567
  });
18484
18568
  _i2 = 0;
18485
18569
  case 13:
18486
18570
  if (!(_i2 < messagesToSend.length)) {
18487
- _context13.n = 15;
18571
+ _context13.n = 16;
18488
18572
  break;
18489
18573
  }
18490
18574
  return _context13.d(_regeneratorValues(_loop3(_i2)), 14);
18491
18575
  case 14:
18576
+ _ret = _context13.v;
18577
+ if (!(_ret === 0)) {
18578
+ _context13.n = 15;
18579
+ break;
18580
+ }
18581
+ return _context13.a(3, 15);
18582
+ case 15:
18492
18583
  _i2++;
18493
18584
  _context13.n = 13;
18494
18585
  break;
18495
- case 15:
18496
- _context13.n = 17;
18497
- break;
18498
18586
  case 16:
18499
- _context13.p = 16;
18500
- _t2 = _context13.v;
18501
- log.error('error on send message ... ', _t2);
18587
+ _context13.n = 18;
18588
+ break;
18502
18589
  case 17:
18590
+ _context13.p = 17;
18591
+ _t3 = _context13.v;
18592
+ log.error('error on send message ... ', _t3);
18593
+ case 18:
18503
18594
  return _context13.a(2);
18504
18595
  }
18505
- }, _marked1, null, [[1, 16]]);
18596
+ }, _marked1, null, [[1, 17]]);
18506
18597
  }
18507
18598
  function sendTextMessage(action) {
18508
- var payload, message, connectionState, channelId, channel, sendMessageTid, pendingMessage, _channel3, SceytChatClient, createChannelData, mentionedUserIds, attachments, _attachments$, attachmentBuilder, att, messageBuilder, createdMessage, messageToSend, _messageResponse$atta, messageResponse, messageUpdateData, activeChannelId, stringifiedMessageUpdateData, messageToUpdate, resolvedLastMessage, shouldUpdateChannelList, channelUpdateParam, _channel4, isErrorResendable, _t3;
18599
+ var payload, message, connectionState, channelId, channel, sendMessageTid, pendingMessage, _channel3, SceytChatClient, createChannelData, mentionedUserIds, attachments, _attachments$, attachmentBuilder, att, messageBuilder, createdMessage, messageToSend, _messageResponse$atta, messageResponse, messageUpdateData, activeChannelId, stringifiedMessageUpdateData, messageToUpdate, resolvedLastMessage, shouldUpdateChannelList, channelUpdateParam, _channel4, isErrorResendable, _t4;
18509
18600
  return _regenerator().w(function (_context14) {
18510
18601
  while (1) switch (_context14.p = _context14.n) {
18511
18602
  case 0:
@@ -18673,9 +18764,9 @@ function sendTextMessage(action) {
18673
18764
  break;
18674
18765
  case 20:
18675
18766
  _context14.p = 20;
18676
- _t3 = _context14.v;
18677
- log.error('error on send text message ... ', _t3 === null || _t3 === void 0 ? void 0 : _t3.type, _t3);
18678
- isErrorResendable = isResendableError(_t3 === null || _t3 === void 0 ? void 0 : _t3.type);
18767
+ _t4 = _context14.v;
18768
+ log.error('error on send text message ... ', _t4 === null || _t4 === void 0 ? void 0 : _t4.type, _t4);
18769
+ isErrorResendable = isResendableError(_t4 === null || _t4 === void 0 ? void 0 : _t4.type);
18679
18770
  if (!((_channel4 = channel) !== null && _channel4 !== void 0 && _channel4.id && sendMessageTid)) {
18680
18771
  _context14.n = 21;
18681
18772
  break;
@@ -18691,7 +18782,7 @@ function sendTextMessage(action) {
18691
18782
  }
18692
18783
  function forwardMessage(action) {
18693
18784
  var _message$user;
18694
- var payload, message, channelId, connectionState, isForward, accompanyingMessage, showOwnMessageForward, SceytChatClient, isNotShowOwnMessageForward, pendingMessage, channel, activeChannelId, messageTid, _SceytChatClient, parsedChannel, mentionedUserIds, attachments, messageBuilder, pollDetails, messageToSend, _pendingMessage, messageResponse, responseAttachments, messageUpdateData, confirmedForward, messageToUpdate, resolvedLastMessage, channelUpdateParam, _channel5, isErrorResendable, _t4;
18785
+ var payload, message, channelId, connectionState, isForward, accompanyingMessage, showOwnMessageForward, SceytChatClient, isNotShowOwnMessageForward, pendingMessage, channel, activeChannelId, messageTid, _SceytChatClient, parsedChannel, mentionedUserIds, attachments, messageBuilder, pollDetails, messageToSend, _pendingMessage, messageResponse, responseAttachments, messageUpdateData, confirmedForward, messageToUpdate, resolvedLastMessage, channelUpdateParam, _channel5, isErrorResendable, _t5;
18695
18786
  return _regenerator().w(function (_context15) {
18696
18787
  while (1) switch (_context15.p = _context15.n) {
18697
18788
  case 0:
@@ -18901,8 +18992,8 @@ function forwardMessage(action) {
18901
18992
  break;
18902
18993
  case 19:
18903
18994
  _context15.p = 19;
18904
- _t4 = _context15.v;
18905
- isErrorResendable = isResendableError(_t4 === null || _t4 === void 0 ? void 0 : _t4.type);
18995
+ _t5 = _context15.v;
18996
+ isErrorResendable = isResendableError(_t5 === null || _t5 === void 0 ? void 0 : _t5.type);
18906
18997
  if (!((_channel5 = channel) !== null && _channel5 !== void 0 && _channel5.id && messageTid)) {
18907
18998
  _context15.n = 20;
18908
18999
  break;
@@ -18912,14 +19003,14 @@ function forwardMessage(action) {
18912
19003
  tid: messageTid
18913
19004
  }), isErrorResendable);
18914
19005
  case 20:
18915
- log.error('error on forward message ... ', _t4);
19006
+ log.error('error on forward message ... ', _t5);
18916
19007
  case 21:
18917
19008
  return _context15.a(2);
18918
19009
  }
18919
19010
  }, _marked11, null, [[1, 19]]);
18920
19011
  }
18921
19012
  function resendMessage(action) {
18922
- var _message$attachments;
19013
+ var _message$attachments2;
18923
19014
  var payload, payloadMessage, connectionState, channelId, liveMessage, message, attachments, sendAttachmentsAsSeparateMessage, isVoiceMessage;
18924
19015
  return _regenerator().w(function (_context16) {
18925
19016
  while (1) switch (_context16.n) {
@@ -18931,7 +19022,7 @@ function resendMessage(action) {
18931
19022
  if (message !== null && message !== void 0 && message.tid || message !== null && message !== void 0 && message.id) {
18932
19023
  autoResendAttempts["delete"](message.tid || message.id);
18933
19024
  }
18934
- attachments = message === null || message === void 0 ? void 0 : (_message$attachments = message.attachments) === null || _message$attachments === void 0 ? void 0 : _message$attachments.filter(function (att) {
19025
+ attachments = message === null || message === void 0 ? void 0 : (_message$attachments2 = message.attachments) === null || _message$attachments2 === void 0 ? void 0 : _message$attachments2.filter(function (att) {
18935
19026
  return (att === null || att === void 0 ? void 0 : att.type) !== attachmentTypes.link;
18936
19027
  });
18937
19028
  if (!message.forwardingDetails) {
@@ -18987,7 +19078,7 @@ function resendMessage(action) {
18987
19078
  }, _marked12);
18988
19079
  }
18989
19080
  function deleteMessage(action) {
18990
- var payload, messageId, channelId, deleteOption, channel, currentMessage, existingMutation, queuedMutation, _t5;
19081
+ var payload, messageId, channelId, deleteOption, channel, currentMessage, existingMutation, queuedMutation, _t6;
18991
19082
  return _regenerator().w(function (_context17) {
18992
19083
  while (1) switch (_context17.p = _context17.n) {
18993
19084
  case 0:
@@ -19014,7 +19105,7 @@ function deleteMessage(action) {
19014
19105
  case 3:
19015
19106
  return _context17.a(2);
19016
19107
  case 4:
19017
- if (!(!currentMessage.id && currentMessage.tid)) {
19108
+ if (!(!currentMessage.id && currentMessage.tid || hasLivePendingAttachment(currentMessage))) {
19018
19109
  _context17.n = 6;
19019
19110
  break;
19020
19111
  }
@@ -19057,15 +19148,15 @@ function deleteMessage(action) {
19057
19148
  break;
19058
19149
  case 12:
19059
19150
  _context17.p = 12;
19060
- _t5 = _context17.v;
19061
- log.error('ERROR in delete message', _t5.message);
19151
+ _t6 = _context17.v;
19152
+ log.error('ERROR in delete message', _t6.message);
19062
19153
  case 13:
19063
19154
  return _context17.a(2);
19064
19155
  }
19065
19156
  }, _marked13, null, [[0, 12]]);
19066
19157
  }
19067
19158
  function editMessage(action) {
19068
- var payload, message, channelId, channel, currentMessage, existingMutation, queuedMutation, _t6;
19159
+ var payload, message, channelId, channel, currentMessage, existingMutation, queuedMutation, _t7;
19069
19160
  return _regenerator().w(function (_context18) {
19070
19161
  while (1) switch (_context18.p = _context18.n) {
19071
19162
  case 0:
@@ -19117,26 +19208,26 @@ function editMessage(action) {
19117
19208
  break;
19118
19209
  case 8:
19119
19210
  _context18.p = 8;
19120
- _t6 = _context18.v;
19121
- log.error('ERROR in edit message', _t6.message);
19211
+ _t7 = _context18.v;
19212
+ log.error('ERROR in edit message', _t7.message);
19122
19213
  case 9:
19123
19214
  return _context18.a(2);
19124
19215
  }
19125
19216
  }, _marked14, null, [[0, 8]]);
19126
19217
  }
19127
19218
  var sendPendingMessages = /*#__PURE__*/_regenerator().m(function _callee5(connectionState) {
19128
- var pendingMessagesMap, channelId, _iterator3, _step3, _msg$attachments, msg, attachments, resendKey, attempts, pendingPollActionsMap, _t7, _t8, _t9;
19219
+ var pendingMessagesMap, channelId, _iterator3, _step3, _msg$attachments, msg, attachments, resendKey, attempts, pendingPollActionsMap, _t8, _t9, _t0;
19129
19220
  return _regenerator().w(function (_context19) {
19130
19221
  while (1) switch (_context19.p = _context19.n) {
19131
19222
  case 0:
19132
19223
  pendingMessagesMap = getAllPendingFromMap();
19133
- _t7 = _regeneratorKeys(pendingMessagesMap);
19224
+ _t8 = _regeneratorKeys(pendingMessagesMap);
19134
19225
  case 1:
19135
- if ((_t8 = _t7()).done) {
19226
+ if ((_t9 = _t8()).done) {
19136
19227
  _context19.n = 13;
19137
19228
  break;
19138
19229
  }
19139
- channelId = _t8.value;
19230
+ channelId = _t9.value;
19140
19231
  _iterator3 = _createForOfIteratorHelperLoose(pendingMessagesMap[channelId]);
19141
19232
  case 2:
19142
19233
  if ((_step3 = _iterator3()).done) {
@@ -19213,8 +19304,8 @@ var sendPendingMessages = /*#__PURE__*/_regenerator().m(function _callee5(connec
19213
19304
  break;
19214
19305
  case 10:
19215
19306
  _context19.p = 10;
19216
- _t9 = _context19.v;
19217
- log.error("Failed to send pending message " + (msg.tid || msg.id) + ":", _t9);
19307
+ _t0 = _context19.v;
19308
+ log.error("Failed to send pending message " + (msg.tid || msg.id) + ":", _t0);
19218
19309
  case 11:
19219
19310
  _context19.n = 2;
19220
19311
  break;
@@ -19484,7 +19575,7 @@ function loadOGMetadataForLinkMessages(messages, getFromServer) {
19484
19575
  getFromServer = true;
19485
19576
  }
19486
19577
  return /*#__PURE__*/_regenerator().m(function _callee6() {
19487
- var i, _message$attachments2, message, isOnlyLinkAttachments, firstAttachment, j, _attachment, _firstAttachment, _store$getState$Messa, _firstAttachment2, _firstAttachment3, _firstAttachment4, metadata, storedData;
19578
+ var i, _message$attachments3, message, isOnlyLinkAttachments, firstAttachment, j, _attachment, _firstAttachment, _store$getState$Messa, _firstAttachment2, _firstAttachment3, _firstAttachment4, metadata, storedData;
19488
19579
  return _regenerator().w(function (_context23) {
19489
19580
  while (1) switch (_context23.n) {
19490
19581
  case 0:
@@ -19501,7 +19592,7 @@ function loadOGMetadataForLinkMessages(messages, getFromServer) {
19501
19592
  break;
19502
19593
  }
19503
19594
  message = messages[i];
19504
- if (!(message !== null && message !== void 0 && (_message$attachments2 = message.attachments) !== null && _message$attachments2 !== void 0 && _message$attachments2.length)) {
19595
+ if (!(message !== null && message !== void 0 && (_message$attachments3 = message.attachments) !== null && _message$attachments3 !== void 0 && _message$attachments3.length)) {
19505
19596
  _context23.n = 10;
19506
19597
  break;
19507
19598
  }
@@ -19712,7 +19803,7 @@ function loadOGMetadataForLinkSaga(action) {
19712
19803
  }, _marked19);
19713
19804
  }
19714
19805
  function reloadActiveChannelAfterReconnect(action) {
19715
- var _store$getState$Chann3, _reconnectChannel, _action$payload3, channel, _action$payload3$visi, visibleAnchorId, _action$payload3$wasV, wasViewingLatest, _action$payload3$appl, applyVisibleWindow, _action$payload3$isAt, isAtHistoryTop, reconnectChannel, initialSignature, sawChannelsLoading, elapsed, _store$getState$Chann4, snapshot, snapshotSignature, resolvedChannelUpdateData, channelsLoadingState, _resolvedChannelUpdateData, latestSnapshot, _resolvedChannelUpdateData2, reloadAction, _t12;
19806
+ var _store$getState$Chann3, _reconnectChannel, _action$payload3, channel, _action$payload3$visi, visibleAnchorId, _action$payload3$wasV, wasViewingLatest, _action$payload3$appl, applyVisibleWindow, _action$payload3$isAt, isAtHistoryTop, reconnectChannel, initialSignature, sawChannelsLoading, elapsed, _store$getState$Chann4, snapshot, snapshotSignature, resolvedChannelUpdateData, channelsLoadingState, _resolvedChannelUpdateData, latestSnapshot, _resolvedChannelUpdateData2, reloadAction, _t13;
19716
19807
  return _regenerator().w(function (_context26) {
19717
19808
  while (1) switch (_context26.p = _context26.n) {
19718
19809
  case 0:
@@ -19802,15 +19893,15 @@ function reloadActiveChannelAfterReconnect(action) {
19802
19893
  break;
19803
19894
  case 11:
19804
19895
  _context26.p = 11;
19805
- _t12 = _context26.v;
19806
- log.error('error in reload active channel after reconnect', _t12);
19896
+ _t13 = _context26.v;
19897
+ log.error('error in reload active channel after reconnect', _t13);
19807
19898
  case 12:
19808
19899
  return _context26.a(2);
19809
19900
  }
19810
19901
  }, _marked20, null, [[0, 11]]);
19811
19902
  }
19812
19903
  function loadAroundMessageFromServer(channel, anchorId, prevCount, nextCount, connectionState) {
19813
- var SceytChatClient, messageQueryBuilder, messageQuery, firstResult, pivotId, secondResult, resultMessages, firstConfirmedMessageId, lastConfirmedMessageId, appliedMessages, filteredPendingMessages, waitToSendPendingMessages, _t13, _t14, _t15;
19904
+ var SceytChatClient, messageQueryBuilder, messageQuery, firstResult, pivotId, secondResult, resultMessages, firstConfirmedMessageId, lastConfirmedMessageId, appliedMessages, filteredPendingMessages, waitToSendPendingMessages, _t14, _t15, _t16;
19814
19905
  return _regenerator().w(function (_context27) {
19815
19906
  while (1) switch (_context27.n) {
19816
19907
  case 0:
@@ -19825,13 +19916,13 @@ function loadAroundMessageFromServer(channel, anchorId, prevCount, nextCount, co
19825
19916
  _context27.n = 1;
19826
19917
  return effects.call(messageQueryBuilder.build);
19827
19918
  case 1:
19828
- _t13 = _context27.v;
19919
+ _t14 = _context27.v;
19829
19920
  _context27.n = 3;
19830
19921
  break;
19831
19922
  case 2:
19832
- _t13 = null;
19923
+ _t14 = null;
19833
19924
  case 3:
19834
- messageQuery = _t13;
19925
+ messageQuery = _t14;
19835
19926
  query.messageQuery = messageQuery;
19836
19927
  messageQuery.limit = prevCount || MESSAGES_MAX_PAGE_COUNT / 2;
19837
19928
  if (!(anchorId && connectionState === CONNECTION_STATUS.CONNECTED)) {
@@ -19841,16 +19932,16 @@ function loadAroundMessageFromServer(channel, anchorId, prevCount, nextCount, co
19841
19932
  _context27.n = 4;
19842
19933
  return effects.call(messageQuery.loadPreviousMessageId, anchorId);
19843
19934
  case 4:
19844
- _t14 = _context27.v;
19935
+ _t15 = _context27.v;
19845
19936
  _context27.n = 6;
19846
19937
  break;
19847
19938
  case 5:
19848
- _t14 = {
19939
+ _t15 = {
19849
19940
  messages: [],
19850
19941
  hasNext: false
19851
19942
  };
19852
19943
  case 6:
19853
- firstResult = _t14;
19944
+ firstResult = _t15;
19854
19945
  pivotId = firstResult.messages.length > 0 ? getLastConfirmedMessageId(firstResult.messages) : anchorId || '0';
19855
19946
  messageQuery.reverse = false;
19856
19947
  messageQuery.limit = nextCount || MESSAGES_MAX_PAGE_COUNT / 2;
@@ -19861,16 +19952,16 @@ function loadAroundMessageFromServer(channel, anchorId, prevCount, nextCount, co
19861
19952
  _context27.n = 7;
19862
19953
  return effects.call(messageQuery.loadNextMessageId, pivotId);
19863
19954
  case 7:
19864
- _t15 = _context27.v;
19955
+ _t16 = _context27.v;
19865
19956
  _context27.n = 9;
19866
19957
  break;
19867
19958
  case 8:
19868
- _t15 = {
19959
+ _t16 = {
19869
19960
  messages: [],
19870
19961
  hasNext: false
19871
19962
  };
19872
19963
  case 9:
19873
- secondResult = _t15;
19964
+ secondResult = _t16;
19874
19965
  resultMessages = [].concat(firstResult.messages, secondResult.messages);
19875
19966
  firstConfirmedMessageId = getFirstConfirmedMessageId(resultMessages);
19876
19967
  lastConfirmedMessageId = getLastConfirmedMessageId(resultMessages);
@@ -19919,7 +20010,7 @@ function loadAroundMessageFromServer(channel, anchorId, prevCount, nextCount, co
19919
20010
  }, _marked21);
19920
20011
  }
19921
20012
  function backgroundRefreshRestoreWindow(channel, restoreWindow, cachedMessages) {
19922
- var connectionState, SceytChatClient, messageQueryBuilder, messageQuery, prevResult, pivotId, nextResult, refreshedMessages, firstId, lastId, cachedConfirmed, changedMessages, appliedMessages, filteredPendingMessages, _t16, _t17, _t18;
20013
+ var connectionState, SceytChatClient, messageQueryBuilder, messageQuery, prevResult, pivotId, nextResult, refreshedMessages, firstId, lastId, cachedConfirmed, changedMessages, appliedMessages, filteredPendingMessages, _t17, _t18, _t19;
19923
20014
  return _regenerator().w(function (_context28) {
19924
20015
  while (1) switch (_context28.p = _context28.n) {
19925
20016
  case 0:
@@ -19953,16 +20044,16 @@ function backgroundRefreshRestoreWindow(channel, restoreWindow, cachedMessages)
19953
20044
  _context28.n = 4;
19954
20045
  return effects.call(messageQuery.loadPreviousMessageId, restoreWindow.anchorId);
19955
20046
  case 4:
19956
- _t16 = _context28.v;
20047
+ _t17 = _context28.v;
19957
20048
  _context28.n = 6;
19958
20049
  break;
19959
20050
  case 5:
19960
- _t16 = {
20051
+ _t17 = {
19961
20052
  messages: [],
19962
20053
  hasNext: false
19963
20054
  };
19964
20055
  case 6:
19965
- prevResult = _t16;
20056
+ prevResult = _t17;
19966
20057
  pivotId = prevResult.messages.length > 0 ? getLastConfirmedMessageId(prevResult.messages) : restoreWindow.anchorId || '0';
19967
20058
  messageQuery.reverse = false;
19968
20059
  messageQuery.limit = restoreWindow.nextCount || MESSAGES_MAX_PAGE_COUNT / 2;
@@ -19973,16 +20064,16 @@ function backgroundRefreshRestoreWindow(channel, restoreWindow, cachedMessages)
19973
20064
  _context28.n = 7;
19974
20065
  return effects.call(messageQuery.loadNextMessageId, pivotId);
19975
20066
  case 7:
19976
- _t17 = _context28.v;
20067
+ _t18 = _context28.v;
19977
20068
  _context28.n = 9;
19978
20069
  break;
19979
20070
  case 8:
19980
- _t17 = {
20071
+ _t18 = {
19981
20072
  messages: [],
19982
20073
  hasNext: false
19983
20074
  };
19984
20075
  case 9:
19985
- nextResult = _t17;
20076
+ nextResult = _t18;
19986
20077
  refreshedMessages = [].concat(prevResult.messages, nextResult.messages);
19987
20078
  if (refreshedMessages.length) {
19988
20079
  _context28.n = 10;
@@ -20041,15 +20132,15 @@ function backgroundRefreshRestoreWindow(channel, restoreWindow, cachedMessages)
20041
20132
  break;
20042
20133
  case 19:
20043
20134
  _context28.p = 19;
20044
- _t18 = _context28.v;
20045
- log.error('error in backgroundRefreshRestoreWindow', _t18);
20135
+ _t19 = _context28.v;
20136
+ log.error('error in backgroundRefreshRestoreWindow', _t19);
20046
20137
  case 20:
20047
20138
  return _context28.a(2);
20048
20139
  }
20049
20140
  }, _marked22, null, [[0, 19]]);
20050
20141
  }
20051
20142
  function loadAroundMessageWorker(action) {
20052
- var _action$payload4, channel, messageId, networkChanged, restoreWindow, connectionState, messages, cachedWindow, _filteredPendingMessages, cachedAroundWindow, _firstConfirmedMessageId, _lastConfirmedMessageId, _filteredPendingMessages2, _waitToSendPendingMessages, SceytChatClient, messageQueryBuilder, messageQuery, loadNextMessageId, loadPreviousMessageId, nextLoadLimit, previousLoadLimit, centerMessageIndex, firstResult, secondResult, resultMessages, _result2, firstConfirmedMessageId, lastConfirmedMessageId, appliedMessages, filteredPendingMessages, waitToSendPendingMessages, _t19, _t20, _t21;
20143
+ var _action$payload4, channel, messageId, networkChanged, restoreWindow, connectionState, messages, cachedWindow, _filteredPendingMessages, cachedAroundWindow, _firstConfirmedMessageId, _lastConfirmedMessageId, _filteredPendingMessages2, _waitToSendPendingMessages, SceytChatClient, messageQueryBuilder, messageQuery, loadNextMessageId, loadPreviousMessageId, nextLoadLimit, previousLoadLimit, centerMessageIndex, firstResult, secondResult, resultMessages, _result2, firstConfirmedMessageId, lastConfirmedMessageId, appliedMessages, filteredPendingMessages, waitToSendPendingMessages, _t20, _t21, _t22;
20053
20144
  return _regenerator().w(function (_context29) {
20054
20145
  while (1) switch (_context29.p = _context29.n) {
20055
20146
  case 0:
@@ -20192,16 +20283,16 @@ function loadAroundMessageWorker(action) {
20192
20283
  _context29.n = 24;
20193
20284
  return effects.call(messageQuery.loadPreviousMessageId, loadPreviousMessageId);
20194
20285
  case 24:
20195
- _t19 = _context29.v;
20286
+ _t20 = _context29.v;
20196
20287
  _context29.n = 26;
20197
20288
  break;
20198
20289
  case 25:
20199
- _t19 = {
20290
+ _t20 = {
20200
20291
  messages: [],
20201
20292
  hasNext: false
20202
20293
  };
20203
20294
  case 26:
20204
- firstResult = _t19;
20295
+ firstResult = _t20;
20205
20296
  if (!loadNextMessageId && firstResult.messages.length > 0) {
20206
20297
  loadNextMessageId = getLastConfirmedMessageId(firstResult.messages);
20207
20298
  } else if (!networkChanged && !loadNextMessageId && !firstResult.messages.length) {
@@ -20216,16 +20307,16 @@ function loadAroundMessageWorker(action) {
20216
20307
  _context29.n = 27;
20217
20308
  return effects.call(messageQuery.loadNextMessageId, loadNextMessageId);
20218
20309
  case 27:
20219
- _t20 = _context29.v;
20310
+ _t21 = _context29.v;
20220
20311
  _context29.n = 29;
20221
20312
  break;
20222
20313
  case 28:
20223
- _t20 = {
20314
+ _t21 = {
20224
20315
  messages: [],
20225
20316
  hasNext: false
20226
20317
  };
20227
20318
  case 29:
20228
- secondResult = _t20;
20319
+ secondResult = _t21;
20229
20320
  resultMessages = networkChanged && !firstResult.messages.length && !secondResult.messages.length ? messages : [].concat(firstResult.messages, secondResult.messages);
20230
20321
  _result2 = {
20231
20322
  messages: resultMessages,
@@ -20277,8 +20368,8 @@ function loadAroundMessageWorker(action) {
20277
20368
  break;
20278
20369
  case 39:
20279
20370
  _context29.p = 39;
20280
- _t21 = _context29.v;
20281
- log.error('error in loadAroundMessage', _t21);
20371
+ _t22 = _context29.v;
20372
+ log.error('error in loadAroundMessage', _t22);
20282
20373
  case 40:
20283
20374
  _context29.p = 40;
20284
20375
  _context29.n = 41;
@@ -20291,7 +20382,7 @@ function loadAroundMessageWorker(action) {
20291
20382
  }, _marked23, null, [[0, 39, 40, 42]]);
20292
20383
  }
20293
20384
  function backgroundCacheAroundMessage(action) {
20294
- var _action$payload5, channel, messageId, waited, SceytChatClient, messageQueryBuilder, messageQuery, firstResult, loadNextMessageId, secondResult, resultMessages, firstConfirmedMessageId, lastConfirmedMessageId, _t22;
20385
+ var _action$payload5, channel, messageId, waited, SceytChatClient, messageQueryBuilder, messageQuery, firstResult, loadNextMessageId, secondResult, resultMessages, firstConfirmedMessageId, lastConfirmedMessageId, _t23;
20295
20386
  return _regenerator().w(function (_context30) {
20296
20387
  while (1) switch (_context30.p = _context30.n) {
20297
20388
  case 0:
@@ -20353,8 +20444,8 @@ function backgroundCacheAroundMessage(action) {
20353
20444
  break;
20354
20445
  case 9:
20355
20446
  _context30.p = 9;
20356
- _t22 = _context30.v;
20357
- log.error('error in backgroundCacheAroundMessage', _t22);
20447
+ _t23 = _context30.v;
20448
+ log.error('error in backgroundCacheAroundMessage', _t23);
20358
20449
  case 10:
20359
20450
  return _context30.a(2);
20360
20451
  }
@@ -20384,7 +20475,7 @@ function loadAroundMessage(action) {
20384
20475
  }, _marked25);
20385
20476
  }
20386
20477
  function loadNearUnread(action) {
20387
- var channel, connectionState, _channel$lastMessage5, _channel$lastMessage6, _channel$lastMessage7, cachedNearWindow, cacheWasShown, cachedLastConfirmedMessageId, cachedHasPrevMessages, cachedHasNextMessages, filteredPendingMessages, SceytChatClient, messageQueryBuilder, messageQuery, _result3, firstConfirmedMessageId, lastConfirmedMessageId, refreshedCachedNearWindow, lastAppliedWindow, appliedMessages, hasPrevMessages, refreshedLastConfirmedMessageId, hasNextMessages, changedMessages, _filteredPendingMessages3, waitToSendPendingMessages, _t23;
20478
+ var channel, connectionState, _channel$lastMessage5, _channel$lastMessage6, _channel$lastMessage7, cachedNearWindow, cacheWasShown, cachedLastConfirmedMessageId, cachedHasPrevMessages, cachedHasNextMessages, filteredPendingMessages, SceytChatClient, messageQueryBuilder, messageQuery, _result3, firstConfirmedMessageId, lastConfirmedMessageId, refreshedCachedNearWindow, lastAppliedWindow, appliedMessages, hasPrevMessages, refreshedLastConfirmedMessageId, hasNextMessages, changedMessages, _filteredPendingMessages3, waitToSendPendingMessages, _t24;
20388
20479
  return _regenerator().w(function (_context32) {
20389
20480
  while (1) switch (_context32.p = _context32.n) {
20390
20481
  case 0:
@@ -20549,8 +20640,8 @@ function loadNearUnread(action) {
20549
20640
  break;
20550
20641
  case 32:
20551
20642
  _context32.p = 32;
20552
- _t23 = _context32.v;
20553
- log.error('error in loadNearUnread', _t23);
20643
+ _t24 = _context32.v;
20644
+ log.error('error in loadNearUnread', _t24);
20554
20645
  case 33:
20555
20646
  _context32.p = 33;
20556
20647
  _context32.n = 34;
@@ -20563,7 +20654,7 @@ function loadNearUnread(action) {
20563
20654
  }, _marked26, null, [[0, 32, 33, 35]]);
20564
20655
  }
20565
20656
  function loadDefaultMessages(action) {
20566
- var channel, connectionState, _channel$lastMessage8, _channel$lastMessage9, _channel$lastMessage0, _result4$messages, SceytChatClient, messageQueryBuilder, messageQuery, cachedMessages, messages, _filteredPendingMessages4, _result4, updatedMessages, appliedMessages, messageIdForLoad, firstConfirmedMessageId, lastConfirmedMessageId, shouldPatchShownCache, changedMessages, _iterator4, _step4, message, filteredPendingMessages, waitToSendPendingMessages, _t24, _t25, _t26, _t27;
20657
+ var channel, connectionState, _channel$lastMessage8, _channel$lastMessage9, _channel$lastMessage0, _result4$messages, SceytChatClient, messageQueryBuilder, messageQuery, cachedMessages, messages, _filteredPendingMessages4, _result4, updatedMessages, appliedMessages, messageIdForLoad, firstConfirmedMessageId, lastConfirmedMessageId, shouldPatchShownCache, changedMessages, _iterator4, _step4, message, filteredPendingMessages, waitToSendPendingMessages, _t25, _t26, _t27, _t28;
20567
20658
  return _regenerator().w(function (_context33) {
20568
20659
  while (1) switch (_context33.p = _context33.n) {
20569
20660
  case 0:
@@ -20588,13 +20679,13 @@ function loadDefaultMessages(action) {
20588
20679
  _context33.n = 2;
20589
20680
  return effects.call(messageQueryBuilder.build);
20590
20681
  case 2:
20591
- _t24 = _context33.v;
20682
+ _t25 = _context33.v;
20592
20683
  _context33.n = 4;
20593
20684
  break;
20594
20685
  case 3:
20595
- _t24 = null;
20686
+ _t25 = null;
20596
20687
  case 4:
20597
- messageQuery = _t24;
20688
+ messageQuery = _t25;
20598
20689
  query.messageQuery = messageQuery;
20599
20690
  cachedMessages = getLatestContiguousMessagesFromMap(channel.id, MESSAGES_MAX_PAGE_COUNT);
20600
20691
  if (!(cachedMessages && cachedMessages.length)) {
@@ -20638,16 +20729,16 @@ function loadDefaultMessages(action) {
20638
20729
  _context33.n = 11;
20639
20730
  return effects.call(messageQuery.loadPreviousMessageId, channel === null || channel === void 0 ? void 0 : channel.lastDisplayedMessageId);
20640
20731
  case 11:
20641
- _t25 = _context33.v;
20732
+ _t26 = _context33.v;
20642
20733
  _context33.n = 13;
20643
20734
  break;
20644
20735
  case 12:
20645
- _t25 = {
20736
+ _t26 = {
20646
20737
  messages: [],
20647
20738
  hasNext: false
20648
20739
  };
20649
20740
  case 13:
20650
- _result4 = _t25;
20741
+ _result4 = _t26;
20651
20742
  _context33.n = 18;
20652
20743
  break;
20653
20744
  case 14:
@@ -20658,16 +20749,16 @@ function loadDefaultMessages(action) {
20658
20749
  _context33.n = 15;
20659
20750
  return effects.call(messageQuery.loadPrevious);
20660
20751
  case 15:
20661
- _t26 = _context33.v;
20752
+ _t27 = _context33.v;
20662
20753
  _context33.n = 17;
20663
20754
  break;
20664
20755
  case 16:
20665
- _t26 = {
20756
+ _t27 = {
20666
20757
  messages: [],
20667
20758
  hasNext: false
20668
20759
  };
20669
20760
  case 17:
20670
- _result4 = _t26;
20761
+ _result4 = _t27;
20671
20762
  case 18:
20672
20763
  updatedMessages = [];
20673
20764
  _result4.messages.forEach(function (msg) {
@@ -20770,8 +20861,8 @@ function loadDefaultMessages(action) {
20770
20861
  break;
20771
20862
  case 35:
20772
20863
  _context33.p = 35;
20773
- _t27 = _context33.v;
20774
- log.error('error in loadDefaultMessages', _t27);
20864
+ _t28 = _context33.v;
20865
+ log.error('error in loadDefaultMessages', _t28);
20775
20866
  case 36:
20776
20867
  _context33.p = 36;
20777
20868
  _context33.n = 37;
@@ -20784,7 +20875,7 @@ function loadDefaultMessages(action) {
20784
20875
  }, _marked27, null, [[0, 35, 36, 38]]);
20785
20876
  }
20786
20877
  function getMessagesQuery(action) {
20787
- var _action$payload6, channel, limit, networkChanged, _action$payload6$appl, applyVisibleWindow, _action$payload6$forc, forceLatestWindow, channelNewMessageCount, connectionState, SceytChatClient, messageQueryBuilder, messageQuery, _result5, appliedMessages, firstConfirmedMessageId, lastConfirmedMessageId, _channel$lastMessage1, cachedMessages, cacheIsCurrent, _firstConfirmedMessageId2, _lastConfirmedMessageId2, activeMessages, latestLoadedMessageId, messagesReceivedDuringLoad, messagesById, firstAppliedMessageId, lastAppliedMessageId, activeConfirmedMessages, sameVisibleWindow, filteredPendingMessages, activeById, changedMessages, waitToSendPendingMessages, _t28, _t29, _t30, _t31;
20878
+ var _action$payload6, channel, limit, networkChanged, _action$payload6$appl, applyVisibleWindow, _action$payload6$forc, forceLatestWindow, channelNewMessageCount, connectionState, SceytChatClient, messageQueryBuilder, messageQuery, _result5, appliedMessages, firstConfirmedMessageId, lastConfirmedMessageId, _channel$lastMessage1, cachedMessages, cacheIsCurrent, _firstConfirmedMessageId2, _lastConfirmedMessageId2, activeMessages, latestLoadedMessageId, messagesReceivedDuringLoad, messagesById, firstAppliedMessageId, lastAppliedMessageId, activeConfirmedMessages, sameVisibleWindow, filteredPendingMessages, activeById, changedMessages, waitToSendPendingMessages, _t29, _t30, _t31, _t32;
20788
20879
  return _regenerator().w(function (_context34) {
20789
20880
  while (1) switch (_context34.p = _context34.n) {
20790
20881
  case 0:
@@ -20821,13 +20912,13 @@ function getMessagesQuery(action) {
20821
20912
  _context34.n = 3;
20822
20913
  return effects.call(messageQueryBuilder.build);
20823
20914
  case 3:
20824
- _t28 = _context34.v;
20915
+ _t29 = _context34.v;
20825
20916
  _context34.n = 5;
20826
20917
  break;
20827
20918
  case 4:
20828
- _t28 = null;
20919
+ _t29 = null;
20829
20920
  case 5:
20830
- messageQuery = _t28;
20921
+ messageQuery = _t29;
20831
20922
  query.messageQuery = messageQuery;
20832
20923
  _result5 = {
20833
20924
  messages: [],
@@ -20850,16 +20941,16 @@ function getMessagesQuery(action) {
20850
20941
  _context34.n = 6;
20851
20942
  return effects.call(messageQuery.loadNearMessageId, channel.lastDisplayedMessageId);
20852
20943
  case 6:
20853
- _t29 = _context34.v;
20944
+ _t30 = _context34.v;
20854
20945
  _context34.n = 8;
20855
20946
  break;
20856
20947
  case 7:
20857
- _t29 = {
20948
+ _t30 = {
20858
20949
  messages: [],
20859
20950
  hasNext: false
20860
20951
  };
20861
20952
  case 8:
20862
- _result5 = _t29;
20953
+ _result5 = _t30;
20863
20954
  _context34.n = 13;
20864
20955
  break;
20865
20956
  case 9:
@@ -20870,16 +20961,16 @@ function getMessagesQuery(action) {
20870
20961
  _context34.n = 10;
20871
20962
  return effects.call(messageQuery.loadPrevious);
20872
20963
  case 10:
20873
- _t30 = _context34.v;
20964
+ _t31 = _context34.v;
20874
20965
  _context34.n = 12;
20875
20966
  break;
20876
20967
  case 11:
20877
- _t30 = {
20968
+ _t31 = {
20878
20969
  messages: [],
20879
20970
  hasNext: false
20880
20971
  };
20881
20972
  case 12:
20882
- _result5 = _t30;
20973
+ _result5 = _t31;
20883
20974
  case 13:
20884
20975
  _context34.n = 14;
20885
20976
  return effects.call(loadOGMetadataForLinkMessages, _result5.messages, true);
@@ -21037,8 +21128,8 @@ function getMessagesQuery(action) {
21037
21128
  break;
21038
21129
  case 35:
21039
21130
  _context34.p = 35;
21040
- _t31 = _context34.v;
21041
- log.error('error in message query', _t31);
21131
+ _t32 = _context34.v;
21132
+ log.error('error in message query', _t32);
21042
21133
  case 36:
21043
21134
  _context34.p = 36;
21044
21135
  _context34.n = 37;
@@ -21051,7 +21142,7 @@ function getMessagesQuery(action) {
21051
21142
  }, _marked28, null, [[0, 35, 36, 38]]);
21052
21143
  }
21053
21144
  function getMessageQuery(action) {
21054
- var payload, channelId, messageId, channel, connectionState, messages, fetchedMessage, _t32;
21145
+ var payload, channelId, messageId, channel, connectionState, messages, fetchedMessage, _t33;
21055
21146
  return _regenerator().w(function (_context35) {
21056
21147
  while (1) switch (_context35.p = _context35.n) {
21057
21148
  case 0:
@@ -21097,15 +21188,15 @@ function getMessageQuery(action) {
21097
21188
  break;
21098
21189
  case 6:
21099
21190
  _context35.p = 6;
21100
- _t32 = _context35.v;
21101
- log.error('error in message query', _t32);
21191
+ _t33 = _context35.v;
21192
+ log.error('error in message query', _t33);
21102
21193
  case 7:
21103
21194
  return _context35.a(2);
21104
21195
  }
21105
21196
  }, _marked29, null, [[0, 6]]);
21106
21197
  }
21107
21198
  function prefetchMessages(channelId, fromMessageId, direction, pages) {
21108
- var key, cancelVersion, SceytChatClient, request, currentFromId, i, cached, mqb, mq, _result6, _cached, _mqb, _mq, _result7, _t33;
21199
+ var key, cancelVersion, SceytChatClient, request, currentFromId, i, cached, mqb, mq, _result6, _cached, _mqb, _mq, _result7, _t34;
21109
21200
  return _regenerator().w(function (_context36) {
21110
21201
  while (1) switch (_context36.p = _context36.n) {
21111
21202
  case 0:
@@ -21273,8 +21364,8 @@ function prefetchMessages(channelId, fromMessageId, direction, pages) {
21273
21364
  break;
21274
21365
  case 24:
21275
21366
  _context36.p = 24;
21276
- _t33 = _context36.v;
21277
- log.error('[PREFETCH] prefetchMessages error:', _t33);
21367
+ _t34 = _context36.v;
21368
+ log.error('[PREFETCH] prefetchMessages error:', _t34);
21278
21369
  case 25:
21279
21370
  _context36.p = 25;
21280
21371
  queuedPrefetchRequests["delete"](key);
@@ -21306,7 +21397,7 @@ function prefetchMessagesFromAction(action) {
21306
21397
  }, _marked31);
21307
21398
  }
21308
21399
  function loadMoreMessages(action) {
21309
- var acquiredLock, loadingScope, payload, limit, direction, channelId, messageId, hasNext, requestId, inFlightKey, SceytChatClient, messageQueryBuilder, messageQuery, connectionState, _result8, reachedLatestConfirmedEdge, nextHasPrevState, nextHasNextState, currentConfirmedMessages, prefetchKey, mapCached, aheadCached, pagesToFetch, fromId, _result8$messages$, _result8$messages, nextWindowConfirmedCount, _mapCached, lastConfirmedMsg, lastConfirmedId, _aheadCached, confirmedAheadCount, hasCachedNext, canLoadServerNext, _pagesToFetch, _reverse$find, lastAheadConfirmedId, _fromId, _result8$messages$2, _result8$messages2, shouldApplyVisibleResult, filteredPendingMessages, _t34;
21400
+ var acquiredLock, loadingScope, payload, limit, direction, channelId, messageId, hasNext, requestId, inFlightKey, SceytChatClient, messageQueryBuilder, messageQuery, connectionState, _result8, reachedLatestConfirmedEdge, nextHasPrevState, nextHasNextState, currentConfirmedMessages, prefetchKey, mapCached, aheadCached, pagesToFetch, fromId, _result8$messages$, _result8$messages, nextWindowConfirmedCount, _mapCached, lastConfirmedMsg, lastConfirmedId, _aheadCached, confirmedAheadCount, hasCachedNext, canLoadServerNext, _pagesToFetch, _reverse$find, lastAheadConfirmedId, _fromId, _result8$messages$2, _result8$messages2, shouldApplyVisibleResult, filteredPendingMessages, _t35;
21310
21401
  return _regenerator().w(function (_context38) {
21311
21402
  while (1) switch (_context38.p = _context38.n) {
21312
21403
  case 0:
@@ -21593,8 +21684,8 @@ function loadMoreMessages(action) {
21593
21684
  break;
21594
21685
  case 38:
21595
21686
  _context38.p = 38;
21596
- _t34 = _context38.v;
21597
- log.error('[MESSAGE_LIST] loadMoreMessages ERROR:', _t34 === null || _t34 === void 0 ? void 0 : _t34.type);
21687
+ _t35 = _context38.v;
21688
+ log.error('[MESSAGE_LIST] loadMoreMessages ERROR:', _t35 === null || _t35 === void 0 ? void 0 : _t35.type);
21598
21689
  case 39:
21599
21690
  _context38.p = 39;
21600
21691
  if (acquiredLock) {
@@ -21614,7 +21705,7 @@ function loadMoreMessages(action) {
21614
21705
  }, _marked32, null, [[1, 38, 39, 40]]);
21615
21706
  }
21616
21707
  function addReaction(action) {
21617
- var payload, channelId, messageId, key, score, reason, enforceUnique, user, channel, _yield$call, message, reaction, channelUpdateParam, _t35;
21708
+ var payload, channelId, messageId, key, score, reason, enforceUnique, user, channel, _yield$call, message, reaction, channelUpdateParam, _t36;
21618
21709
  return _regenerator().w(function (_context39) {
21619
21710
  while (1) switch (_context39.p = _context39.n) {
21620
21711
  case 0:
@@ -21671,15 +21762,15 @@ function addReaction(action) {
21671
21762
  break;
21672
21763
  case 8:
21673
21764
  _context39.p = 8;
21674
- _t35 = _context39.v;
21675
- log.error('ERROR in add reaction', _t35.message);
21765
+ _t36 = _context39.v;
21766
+ log.error('ERROR in add reaction', _t36.message);
21676
21767
  case 9:
21677
21768
  return _context39.a(2);
21678
21769
  }
21679
21770
  }, _marked33, null, [[0, 8]]);
21680
21771
  }
21681
21772
  function deleteReaction(action) {
21682
- var payload, channelId, messageId, key, isLastReaction, channel, _yield$call2, message, reaction, channelUpdateParam, _t36;
21773
+ var payload, channelId, messageId, key, isLastReaction, channel, _yield$call2, message, reaction, channelUpdateParam, _t37;
21683
21774
  return _regenerator().w(function (_context40) {
21684
21775
  while (1) switch (_context40.p = _context40.n) {
21685
21776
  case 0:
@@ -21726,15 +21817,15 @@ function deleteReaction(action) {
21726
21817
  break;
21727
21818
  case 7:
21728
21819
  _context40.p = 7;
21729
- _t36 = _context40.v;
21730
- log.error('ERROR in delete reaction', _t36.message);
21820
+ _t37 = _context40.v;
21821
+ log.error('ERROR in delete reaction', _t37.message);
21731
21822
  case 8:
21732
21823
  return _context40.a(2);
21733
21824
  }
21734
21825
  }, _marked34, null, [[0, 7]]);
21735
21826
  }
21736
21827
  function getReactions(action) {
21737
- var payload, messageId, key, limit, SceytChatClient, reactionQueryBuilder, reactionQuery, _result9, _t37;
21828
+ var payload, messageId, key, limit, SceytChatClient, reactionQueryBuilder, reactionQuery, _result9, _t38;
21738
21829
  return _regenerator().w(function (_context41) {
21739
21830
  while (1) switch (_context41.p = _context41.n) {
21740
21831
  case 0:
@@ -21769,15 +21860,15 @@ function getReactions(action) {
21769
21860
  break;
21770
21861
  case 6:
21771
21862
  _context41.p = 6;
21772
- _t37 = _context41.v;
21773
- log.error('ERROR in get reactions', _t37.message);
21863
+ _t38 = _context41.v;
21864
+ log.error('ERROR in get reactions', _t38.message);
21774
21865
  case 7:
21775
21866
  return _context41.a(2);
21776
21867
  }
21777
21868
  }, _marked35, null, [[0, 6]]);
21778
21869
  }
21779
21870
  function loadMoreReactions(action) {
21780
- var payload, limit, ReactionQuery, _result0, _t38;
21871
+ var payload, limit, ReactionQuery, _result0, _t39;
21781
21872
  return _regenerator().w(function (_context42) {
21782
21873
  while (1) switch (_context42.p = _context42.n) {
21783
21874
  case 0:
@@ -21805,8 +21896,8 @@ function loadMoreReactions(action) {
21805
21896
  break;
21806
21897
  case 5:
21807
21898
  _context42.p = 5;
21808
- _t38 = _context42.v;
21809
- log.error('ERROR in load more reactions', _t38.message);
21899
+ _t39 = _context42.v;
21900
+ log.error('ERROR in load more reactions', _t39.message);
21810
21901
  case 6:
21811
21902
  return _context42.a(2);
21812
21903
  }
@@ -21814,7 +21905,7 @@ function loadMoreReactions(action) {
21814
21905
  }
21815
21906
  function getMessageAttachments(action) {
21816
21907
  var _store$getState$Messa2;
21817
- var _action$payload8, channelId, attachmentType, limit, direction, attachmentId, forPopup, cacheKey, cachedAttachments, SceytChatClient, typeList, AttachmentByTypeQueryBuilder, AttachmentByTypeQuery, _result1, attachments, attachmentIndex, hasPrev, hasNext, freshAttachments, _t39;
21908
+ var _action$payload8, channelId, attachmentType, limit, direction, attachmentId, forPopup, cacheKey, cachedAttachments, SceytChatClient, typeList, AttachmentByTypeQueryBuilder, AttachmentByTypeQuery, _result1, attachments, attachmentIndex, hasPrev, hasNext, freshAttachments, _t40;
21818
21909
  return _regenerator().w(function (_context43) {
21819
21910
  while (1) switch (_context43.p = _context43.n) {
21820
21911
  case 0:
@@ -21932,8 +22023,8 @@ function getMessageAttachments(action) {
21932
22023
  break;
21933
22024
  case 18:
21934
22025
  _context43.p = 18;
21935
- _t39 = _context43.v;
21936
- log.error('error in message attachment query', _t39);
22026
+ _t40 = _context43.v;
22027
+ log.error('error in message attachment query', _t40);
21937
22028
  case 19:
21938
22029
  _context43.p = 19;
21939
22030
  _context43.n = 20;
@@ -21946,7 +22037,7 @@ function getMessageAttachments(action) {
21946
22037
  }, _marked37, null, [[1, 18, 19, 21]]);
21947
22038
  }
21948
22039
  function loadMoreMessageAttachments(action) {
21949
- var _action$payload9, limit, direction, forPopup, attachmentId, AttachmentQuery, _result10, _result11, attachments, hasNext, _t40;
22040
+ var _action$payload9, limit, direction, forPopup, attachmentId, AttachmentQuery, _result10, _result11, attachments, hasNext, _t41;
21950
22041
  return _regenerator().w(function (_context44) {
21951
22042
  while (1) switch (_context44.p = _context44.n) {
21952
22043
  case 0:
@@ -22051,8 +22142,8 @@ function loadMoreMessageAttachments(action) {
22051
22142
  break;
22052
22143
  case 21:
22053
22144
  _context44.p = 21;
22054
- _t40 = _context44.v;
22055
- log.error('error in message attachment query', _t40);
22145
+ _t41 = _context44.v;
22146
+ log.error('error in message attachment query', _t41);
22056
22147
  case 22:
22057
22148
  _context44.p = 22;
22058
22149
  _context44.n = 23;
@@ -22065,7 +22156,7 @@ function loadMoreMessageAttachments(action) {
22065
22156
  }, _marked38, null, [[1, 21, 22, 24]]);
22066
22157
  }
22067
22158
  function pauseAttachmentUploading(action) {
22068
- var attachmentId, isPaused, _t41;
22159
+ var attachmentId, isPaused, _t42;
22069
22160
  return _regenerator().w(function (_context45) {
22070
22161
  while (1) switch (_context45.p = _context45.n) {
22071
22162
  case 0:
@@ -22087,15 +22178,15 @@ function pauseAttachmentUploading(action) {
22087
22178
  break;
22088
22179
  case 2:
22089
22180
  _context45.p = 2;
22090
- _t41 = _context45.v;
22091
- log.error('error in pause attachment uploading', _t41);
22181
+ _t42 = _context45.v;
22182
+ log.error('error in pause attachment uploading', _t42);
22092
22183
  case 3:
22093
22184
  return _context45.a(2);
22094
22185
  }
22095
22186
  }, _marked39, null, [[0, 2]]);
22096
22187
  }
22097
22188
  function resumeAttachmentUploading(action) {
22098
- var attachmentId, isResumed, _t42;
22189
+ var attachmentId, isResumed, _t43;
22099
22190
  return _regenerator().w(function (_context46) {
22100
22191
  while (1) switch (_context46.p = _context46.n) {
22101
22192
  case 0:
@@ -22118,15 +22209,15 @@ function resumeAttachmentUploading(action) {
22118
22209
  break;
22119
22210
  case 2:
22120
22211
  _context46.p = 2;
22121
- _t42 = _context46.v;
22122
- log.error('error in resume attachment uploading', _t42);
22212
+ _t43 = _context46.v;
22213
+ log.error('error in resume attachment uploading', _t43);
22123
22214
  case 3:
22124
22215
  return _context46.a(2);
22125
22216
  }
22126
22217
  }, _marked40, null, [[0, 2]]);
22127
22218
  }
22128
22219
  function getMessageMarkers(action) {
22129
- var _action$payload0, messageId, channelId, deliveryStatuses, sceytChatClient, deliveryStatusesArray, messageMarkers, _iterator5, _step5, deliveryStatus, messageMarkerListQueryBuilder, messageMarkerListQuery, messageMarkersResult, _t43;
22220
+ var _action$payload0, messageId, channelId, deliveryStatuses, sceytChatClient, deliveryStatusesArray, messageMarkers, _iterator5, _step5, deliveryStatus, messageMarkerListQueryBuilder, messageMarkerListQuery, messageMarkersResult, _t44;
22130
22221
  return _regenerator().w(function (_context47) {
22131
22222
  while (1) switch (_context47.p = _context47.n) {
22132
22223
  case 0:
@@ -22174,8 +22265,8 @@ function getMessageMarkers(action) {
22174
22265
  break;
22175
22266
  case 8:
22176
22267
  _context47.p = 8;
22177
- _t43 = _context47.v;
22178
- log.error('error in get message markers', _t43);
22268
+ _t44 = _context47.v;
22269
+ log.error('error in get message markers', _t44);
22179
22270
  case 9:
22180
22271
  _context47.p = 9;
22181
22272
  _context47.n = 10;
@@ -22272,7 +22363,7 @@ function updateMessageOptimisticallyForAddPollVote(channelId, message, vote) {
22272
22363
  }, _marked43);
22273
22364
  }
22274
22365
  function addPollVote(action) {
22275
- var payload, channelId, pollId, optionId, message, isResend, sceytChatClient, _user$presence, user, vote, pendingAction, conflictCheck, channel, _store$getState$Messa3, _currentMessage$pollD, _currentMessage$pollD2, _currentMessage$pollD3, currentMessage, hasNext, obj, _t44;
22366
+ var payload, channelId, pollId, optionId, message, isResend, sceytChatClient, _user$presence, user, vote, pendingAction, conflictCheck, channel, _store$getState$Messa3, _currentMessage$pollD, _currentMessage$pollD2, _currentMessage$pollD3, currentMessage, hasNext, obj, _t45;
22276
22367
  return _regenerator().w(function (_context50) {
22277
22368
  while (1) switch (_context50.p = _context50.n) {
22278
22369
  case 0:
@@ -22362,8 +22453,8 @@ function addPollVote(action) {
22362
22453
  break;
22363
22454
  case 7:
22364
22455
  _context50.p = 7;
22365
- _t44 = _context50.v;
22366
- log.error('error in add poll vote', _t44);
22456
+ _t45 = _context50.v;
22457
+ log.error('error in add poll vote', _t45);
22367
22458
  case 8:
22368
22459
  return _context50.a(2);
22369
22460
  }
@@ -22445,7 +22536,7 @@ function updateMessageOptimisticallyForDeletePollVote(channelId, message, vote)
22445
22536
  }, _marked46);
22446
22537
  }
22447
22538
  function deletePollVote(action) {
22448
- var payload, channelId, pollId, optionId, message, isResend, sceytChatClient, _message$pollDetails1, _message$pollDetails10, _message$pollDetails11, vote, pendingAction, conflictCheck, channel, _currentMessage$pollD4, _currentMessage$pollD5, _currentMessage$pollD6, currentMessage, obj, _t45;
22539
+ var payload, channelId, pollId, optionId, message, isResend, sceytChatClient, _message$pollDetails1, _message$pollDetails10, _message$pollDetails11, vote, pendingAction, conflictCheck, channel, _currentMessage$pollD4, _currentMessage$pollD5, _currentMessage$pollD6, currentMessage, obj, _t46;
22449
22540
  return _regenerator().w(function (_context53) {
22450
22541
  while (1) switch (_context53.p = _context53.n) {
22451
22542
  case 0:
@@ -22521,8 +22612,8 @@ function deletePollVote(action) {
22521
22612
  break;
22522
22613
  case 8:
22523
22614
  _context53.p = 8;
22524
- _t45 = _context53.v;
22525
- log.error('error in delete poll vote', _t45);
22615
+ _t46 = _context53.v;
22616
+ log.error('error in delete poll vote', _t46);
22526
22617
  case 9:
22527
22618
  return _context53.a(2);
22528
22619
  }
@@ -22595,7 +22686,7 @@ function updateMessageOptimisticallyForClosePoll(channelId, message) {
22595
22686
  }, _marked49);
22596
22687
  }
22597
22688
  function closePoll(action) {
22598
- var payload, channelId, pollId, message, sceytChatClient, connectionState, _t46;
22689
+ var payload, channelId, pollId, message, sceytChatClient, connectionState, _t47;
22599
22690
  return _regenerator().w(function (_context56) {
22600
22691
  while (1) switch (_context56.p = _context56.n) {
22601
22692
  case 0:
@@ -22630,8 +22721,8 @@ function closePoll(action) {
22630
22721
  break;
22631
22722
  case 4:
22632
22723
  _context56.p = 4;
22633
- _t46 = _context56.v;
22634
- log.error('error in close poll', _t46);
22724
+ _t47 = _context56.v;
22725
+ log.error('error in close poll', _t47);
22635
22726
  case 5:
22636
22727
  return _context56.a(2);
22637
22728
  }
@@ -22718,7 +22809,7 @@ function updateMessageOptimisticallyForRetractPollVote(channelId, message, objs)
22718
22809
  }, _marked52);
22719
22810
  }
22720
22811
  function retractPollVote(action) {
22721
- var payload, channelId, pollId, message, isResend, sceytChatClient, connectionState, objs, _iterator8, _step8, _message$pollDetails12, _message$pollDetails13, vote, _t47;
22812
+ var payload, channelId, pollId, message, isResend, sceytChatClient, connectionState, objs, _iterator8, _step8, _message$pollDetails12, _message$pollDetails13, vote, _t48;
22722
22813
  return _regenerator().w(function (_context59) {
22723
22814
  while (1) switch (_context59.p = _context59.n) {
22724
22815
  case 0:
@@ -22761,15 +22852,15 @@ function retractPollVote(action) {
22761
22852
  break;
22762
22853
  case 4:
22763
22854
  _context59.p = 4;
22764
- _t47 = _context59.v;
22765
- log.error('error in retract poll vote', _t47);
22855
+ _t48 = _context59.v;
22856
+ log.error('error in retract poll vote', _t48);
22766
22857
  case 5:
22767
22858
  return _context59.a(2);
22768
22859
  }
22769
22860
  }, _marked53, null, [[0, 4]]);
22770
22861
  }
22771
22862
  function resendPendingPollActions(action) {
22772
- var payload, connectionState, sceytChatClient, pendingPollActionsMap, pendingPollActionsMapCopy, _t48;
22863
+ var payload, connectionState, sceytChatClient, pendingPollActionsMap, pendingPollActionsMapCopy, _t49;
22773
22864
  return _regenerator().w(function (_context60) {
22774
22865
  while (1) switch (_context60.p = _context60.n) {
22775
22866
  case 0:
@@ -22818,15 +22909,15 @@ function resendPendingPollActions(action) {
22818
22909
  break;
22819
22910
  case 2:
22820
22911
  _context60.p = 2;
22821
- _t48 = _context60.v;
22822
- log.error('error in resend pending poll actions', _t48);
22912
+ _t49 = _context60.v;
22913
+ log.error('error in resend pending poll actions', _t49);
22823
22914
  case 3:
22824
22915
  return _context60.a(2);
22825
22916
  }
22826
22917
  }, _marked54, null, [[0, 2]]);
22827
22918
  }
22828
22919
  function resendPendingMessageMutations(action) {
22829
- var payload, connectionState, pendingMutations, _iterator9, _step9, mutation, currentMutation, channel, _t49, _t50;
22920
+ var payload, connectionState, pendingMutations, _iterator9, _step9, mutation, currentMutation, channel, _t50, _t51;
22830
22921
  return _regenerator().w(function (_context61) {
22831
22922
  while (1) switch (_context61.p = _context61.n) {
22832
22923
  case 0:
@@ -22893,7 +22984,7 @@ function resendPendingMessageMutations(action) {
22893
22984
  break;
22894
22985
  case 11:
22895
22986
  _context61.p = 11;
22896
- _t49 = _context61.v;
22987
+ _t50 = _context61.v;
22897
22988
  if (isMessageMutationConnected()) {
22898
22989
  _context61.n = 12;
22899
22990
  break;
@@ -22906,7 +22997,7 @@ function resendPendingMessageMutations(action) {
22906
22997
  _context61.n = 14;
22907
22998
  return effects.put(removePendingMessageMutationAC(mutation.messageId));
22908
22999
  case 14:
22909
- log.error('error in resend pending message mutations', _t49);
23000
+ log.error('error in resend pending message mutations', _t50);
22910
23001
  case 15:
22911
23002
  _context61.n = 2;
22912
23003
  break;
@@ -22915,15 +23006,15 @@ function resendPendingMessageMutations(action) {
22915
23006
  break;
22916
23007
  case 17:
22917
23008
  _context61.p = 17;
22918
- _t50 = _context61.v;
22919
- log.error('error in resend pending message mutations', _t50);
23009
+ _t51 = _context61.v;
23010
+ log.error('error in resend pending message mutations', _t51);
22920
23011
  case 18:
22921
23012
  return _context61.a(2);
22922
23013
  }
22923
23014
  }, _marked55, null, [[7, 11], [0, 17]]);
22924
23015
  }
22925
23016
  function getPollVotes(action) {
22926
- var payload, messageId, pollId, optionId, limit, key, SceytChatClient, queryBuilder, pollVotesQuery, _result12, formattedVotes, _t51;
23017
+ var payload, messageId, pollId, optionId, limit, key, SceytChatClient, queryBuilder, pollVotesQuery, _result12, formattedVotes, _t52;
22927
23018
  return _regenerator().w(function (_context62) {
22928
23019
  while (1) switch (_context62.p = _context62.n) {
22929
23020
  case 0:
@@ -22989,8 +23080,8 @@ function getPollVotes(action) {
22989
23080
  break;
22990
23081
  case 7:
22991
23082
  _context62.p = 7;
22992
- _t51 = _context62.v;
22993
- log.error('ERROR in get poll votes', _t51);
23083
+ _t52 = _context62.v;
23084
+ log.error('ERROR in get poll votes', _t52);
22994
23085
  _context62.n = 8;
22995
23086
  return effects.put(setPollVotesLoadingStateAC(action.payload.pollId, action.payload.optionId, LOADING_STATE.LOADED));
22996
23087
  case 8:
@@ -22999,7 +23090,7 @@ function getPollVotes(action) {
22999
23090
  }, _marked56, null, [[0, 7]]);
23000
23091
  }
23001
23092
  function loadMorePollVotes(action) {
23002
- var payload, pollId, optionId, limit, key, pollVotesQuery, _result13, formattedVotes, _t52;
23093
+ var payload, pollId, optionId, limit, key, pollVotesQuery, _result13, formattedVotes, _t53;
23003
23094
  return _regenerator().w(function (_context63) {
23004
23095
  while (1) switch (_context63.p = _context63.n) {
23005
23096
  case 0:
@@ -23057,8 +23148,8 @@ function loadMorePollVotes(action) {
23057
23148
  break;
23058
23149
  case 6:
23059
23150
  _context63.p = 6;
23060
- _t52 = _context63.v;
23061
- log.error('ERROR in load more poll votes', _t52);
23151
+ _t53 = _context63.v;
23152
+ log.error('ERROR in load more poll votes', _t53);
23062
23153
  _context63.n = 7;
23063
23154
  return effects.put(setPollVotesLoadingStateAC(action.payload.pollId, action.payload.optionId, LOADING_STATE.LOADED));
23064
23155
  case 7:
@@ -23068,7 +23159,7 @@ function loadMorePollVotes(action) {
23068
23159
  }
23069
23160
  var REFRESH_WINDOW_HALF = 30;
23070
23161
  function refreshCacheAroundMessage(action) {
23071
- var _action$payload1, channelId, messageId, _action$payload1$appl, applyVisibleWindow, connectionState, activeChannelId, activeMessages, activeConfirmedMessages, centerMessageIndex, refreshAnchorId, previousLimit, nextLimit, SceytChatClient, messageQueryBuilder, messageQuery, prevResult, pivotId, nextResult, loadedMessages, firstId, lastId, currentActiveMessages, currentActiveConfirmedMessages, activeById, changed, filteredPendingMessages, _t53, _t54, _t55;
23162
+ var _action$payload1, channelId, messageId, _action$payload1$appl, applyVisibleWindow, connectionState, activeChannelId, activeMessages, activeConfirmedMessages, centerMessageIndex, refreshAnchorId, previousLimit, nextLimit, SceytChatClient, messageQueryBuilder, messageQuery, prevResult, pivotId, nextResult, loadedMessages, firstId, lastId, currentActiveMessages, currentActiveConfirmedMessages, activeById, changed, filteredPendingMessages, _t54, _t55, _t56;
23072
23163
  return _regenerator().w(function (_context64) {
23073
23164
  while (1) switch (_context64.p = _context64.n) {
23074
23165
  case 0:
@@ -23124,16 +23215,16 @@ function refreshCacheAroundMessage(action) {
23124
23215
  _context64.n = 6;
23125
23216
  return effects.call(messageQuery.loadPreviousMessageId, refreshAnchorId);
23126
23217
  case 6:
23127
- _t53 = _context64.v;
23218
+ _t54 = _context64.v;
23128
23219
  _context64.n = 8;
23129
23220
  break;
23130
23221
  case 7:
23131
- _t53 = {
23222
+ _t54 = {
23132
23223
  messages: [],
23133
23224
  hasNext: false
23134
23225
  };
23135
23226
  case 8:
23136
- prevResult = _t53;
23227
+ prevResult = _t54;
23137
23228
  pivotId = prevResult.messages.length > 0 ? getLastConfirmedMessageId(prevResult.messages) : refreshAnchorId;
23138
23229
  messageQuery.reverse = false;
23139
23230
  messageQuery.limit = nextLimit;
@@ -23144,16 +23235,16 @@ function refreshCacheAroundMessage(action) {
23144
23235
  _context64.n = 9;
23145
23236
  return effects.call(messageQuery.loadNextMessageId, pivotId);
23146
23237
  case 9:
23147
- _t54 = _context64.v;
23238
+ _t55 = _context64.v;
23148
23239
  _context64.n = 11;
23149
23240
  break;
23150
23241
  case 10:
23151
- _t54 = {
23242
+ _t55 = {
23152
23243
  messages: [],
23153
23244
  hasNext: false
23154
23245
  };
23155
23246
  case 11:
23156
- nextResult = _t54;
23247
+ nextResult = _t55;
23157
23248
  loadedMessages = [].concat(prevResult.messages, nextResult.messages);
23158
23249
  if (!(loadedMessages.length === 0)) {
23159
23250
  _context64.n = 12;
@@ -23226,8 +23317,8 @@ function refreshCacheAroundMessage(action) {
23226
23317
  break;
23227
23318
  case 21:
23228
23319
  _context64.p = 21;
23229
- _t55 = _context64.v;
23230
- log.error('error in refreshCacheAroundMessage', _t55);
23320
+ _t56 = _context64.v;
23321
+ log.error('error in refreshCacheAroundMessage', _t56);
23231
23322
  case 22:
23232
23323
  return _context64.a(2);
23233
23324
  }
@@ -39635,7 +39726,7 @@ var Attachment = function Attachment(_ref) {
39635
39726
  backgroundColor: overlayBackground2
39636
39727
  }, isInUploadingState ? (/*#__PURE__*/React__default.createElement(CancelResumeWrapper, {
39637
39728
  onClick: handlePauseResumeUpload
39638
- }, attachmentCompilationState[attachment.tid] === UPLOAD_STATE.UPLOADING ? (/*#__PURE__*/React__default.createElement(SvgCancel, null)) : (/*#__PURE__*/React__default.createElement(SvgUpload, null)))) : (/*#__PURE__*/React__default.createElement(CancelResumeWrapper, {
39729
+ }, attachmentCompilationState[attachment.tid] === UPLOAD_STATE.UPLOADING || isPreparingVideo ? (/*#__PURE__*/React__default.createElement(SvgCancel, null)) : (/*#__PURE__*/React__default.createElement(SvgUpload, null)))) : (/*#__PURE__*/React__default.createElement(CancelResumeWrapper, {
39639
39730
  onClick: handleCancelOriginalVideoDownload
39640
39731
  }, downloadIsCancelled ? /*#__PURE__*/React__default.createElement(SvgDownload, null) : /*#__PURE__*/React__default.createElement(SvgCancel, null))), (isPreparingVideo || attachmentCompilationState[attachment.tid] === UPLOAD_STATE.UPLOADING || isVideoDownloadActive && !downloadIsCancelled) && (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ProgressWrapper, null, /*#__PURE__*/React__default.createElement(reactCircularProgressbar.CircularProgressbar, {
39641
39732
  minValue: 0,