sceyt-chat-react-uikit 1.8.8 → 1.8.9-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -10490,7 +10490,7 @@ if (isBrowser) {
10490
10490
  } else {
10491
10491
  cacheAvailable = 'caches' in global;
10492
10492
  }
10493
- var ATTACHMENT_VERSION = "_1_0_1";
10493
+ var ATTACHMENT_VERSION = "_1_0_2";
10494
10494
  var setAttachmentToCache = function setAttachmentToCache(attachmentUrl, attachmentResponse) {
10495
10495
  try {
10496
10496
  var attachmentURLVersion = attachmentUrl + ATTACHMENT_VERSION;
@@ -11393,10 +11393,10 @@ function fetchOGMetadataForLinkAC(url) {
11393
11393
  };
11394
11394
  }
11395
11395
 
11396
- var _excluded = ["data"];
11397
11396
  var DB_NAME = 'sceyt-uikit-messages';
11398
- var DB_VERSION = 1;
11397
+ var DB_VERSION = 2;
11399
11398
  var CHANNELS_STORE = 'channels';
11399
+ var DRAFTS_STORE = 'drafts';
11400
11400
  var META_STORE = 'meta';
11401
11401
  var USER_META_KEY = 'userId';
11402
11402
  var IDB_MAX_STORED_CHANNELS = 200;
@@ -11420,6 +11420,11 @@ var openDb = function openDb() {
11420
11420
  });
11421
11421
  store.createIndex('savedAt', 'savedAt');
11422
11422
  }
11423
+ if (!db.objectStoreNames.contains(DRAFTS_STORE)) {
11424
+ db.createObjectStore(DRAFTS_STORE, {
11425
+ keyPath: 'channelId'
11426
+ });
11427
+ }
11423
11428
  if (!db.objectStoreNames.contains(META_STORE)) {
11424
11429
  db.createObjectStore(META_STORE);
11425
11430
  }
@@ -11458,8 +11463,8 @@ var sanitizeMessageForPersist = function sanitizeMessageForPersist(message) {
11458
11463
  }
11459
11464
  return _extends({}, message, {
11460
11465
  attachments: message.attachments.map(function (attachment) {
11461
- var _ref = attachment || {},
11462
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
11466
+ var rest = _extends({}, attachment || {});
11467
+ delete rest.data;
11463
11468
  if (rest.attachmentUrl && String(rest.attachmentUrl).startsWith('blob:')) {
11464
11469
  rest.attachmentUrl = undefined;
11465
11470
  }
@@ -11513,6 +11518,68 @@ var restoreChannelMessages = function restoreChannelMessages(channelId) {
11513
11518
  return Promise.reject(e);
11514
11519
  }
11515
11520
  };
11521
+ var persistDraft = function persistDraft(channelId, draft) {
11522
+ try {
11523
+ return Promise.resolve(openDb()).then(function (db) {
11524
+ if (!db || !channelId) return;
11525
+ try {
11526
+ var persistedDraft = _extends({}, draft || {});
11527
+ delete persistedDraft.editorState;
11528
+ db.transaction(DRAFTS_STORE, 'readwrite').objectStore(DRAFTS_STORE).put({
11529
+ channelId: channelId,
11530
+ draft: persistedDraft,
11531
+ savedAt: Date.now()
11532
+ });
11533
+ } catch (e) {
11534
+ log.info('messagesIdb: failed to persist draft', e);
11535
+ }
11536
+ });
11537
+ } catch (e) {
11538
+ return Promise.reject(e);
11539
+ }
11540
+ };
11541
+ var restoreDrafts = function restoreDrafts() {
11542
+ try {
11543
+ return Promise.resolve(openDb()).then(function (db) {
11544
+ return db ? _catch(function () {
11545
+ return Promise.resolve(requestToPromise(db.transaction(DRAFTS_STORE, 'readonly').objectStore(DRAFTS_STORE).getAll()));
11546
+ }, function (e) {
11547
+ log.info('messagesIdb: failed to restore drafts', e);
11548
+ return [];
11549
+ }) : [];
11550
+ });
11551
+ } catch (e) {
11552
+ return Promise.reject(e);
11553
+ }
11554
+ };
11555
+ var removePersistedDraft = function removePersistedDraft(channelId) {
11556
+ try {
11557
+ return Promise.resolve(openDb()).then(function (db) {
11558
+ if (!db || !channelId) return;
11559
+ try {
11560
+ db.transaction(DRAFTS_STORE, 'readwrite').objectStore(DRAFTS_STORE)["delete"](channelId);
11561
+ } catch (e) {
11562
+ log.info('messagesIdb: failed to remove draft', e);
11563
+ }
11564
+ });
11565
+ } catch (e) {
11566
+ return Promise.reject(e);
11567
+ }
11568
+ };
11569
+ var clearPersistedDrafts = function clearPersistedDrafts() {
11570
+ try {
11571
+ return Promise.resolve(openDb()).then(function (db) {
11572
+ if (!db) return;
11573
+ try {
11574
+ db.transaction(DRAFTS_STORE, 'readwrite').objectStore(DRAFTS_STORE).clear();
11575
+ } catch (e) {
11576
+ log.info('messagesIdb: failed to clear drafts', e);
11577
+ }
11578
+ });
11579
+ } catch (e) {
11580
+ return Promise.reject(e);
11581
+ }
11582
+ };
11516
11583
  var clearPersistedChannels = function clearPersistedChannels() {
11517
11584
  try {
11518
11585
  return Promise.resolve(openDb()).then(function (db) {
@@ -11570,8 +11637,10 @@ var initMessagesIdbForUser = function initMessagesIdbForUser(userId) {
11570
11637
  var _temp = function () {
11571
11638
  if (storedUserId !== userId) {
11572
11639
  return Promise.resolve(clearPersistedChannels()).then(function () {
11573
- db.transaction(META_STORE, 'readwrite').objectStore(META_STORE).put(userId, USER_META_KEY);
11574
- _exit = true;
11640
+ return Promise.resolve(clearPersistedDrafts()).then(function () {
11641
+ db.transaction(META_STORE, 'readwrite').objectStore(META_STORE).put(userId, USER_META_KEY);
11642
+ _exit = true;
11643
+ });
11575
11644
  });
11576
11645
  }
11577
11646
  }();
@@ -12498,6 +12567,22 @@ function getAllPendingFromMap() {
12498
12567
  return result;
12499
12568
  }
12500
12569
  var draftMessagesMap = {};
12570
+ var draftListeners = new Set();
12571
+ var draftMessagesHydrated = false;
12572
+ var notifyDraftListeners = function notifyDraftListeners() {
12573
+ return draftListeners.forEach(function (listener) {
12574
+ return listener();
12575
+ });
12576
+ };
12577
+ var subscribeToDraftMessages = function subscribeToDraftMessages(listener) {
12578
+ draftListeners.add(listener);
12579
+ return function () {
12580
+ draftListeners["delete"](listener);
12581
+ };
12582
+ };
12583
+ var areDraftMessagesHydrated = function areDraftMessagesHydrated() {
12584
+ return draftMessagesHydrated;
12585
+ };
12501
12586
  var audioRecordingMap = {};
12502
12587
  var getDraftMessageFromMap = function getDraftMessageFromMap(channelId) {
12503
12588
  return draftMessagesMap[channelId];
@@ -12513,12 +12598,63 @@ var setAudioRecordingToMap = function setAudioRecordingToMap(channelId, audioRec
12513
12598
  };
12514
12599
  var removeDraftMessageFromMap = function removeDraftMessageFromMap(channelId) {
12515
12600
  delete draftMessagesMap[channelId];
12601
+ Promise.resolve(removePersistedDraft(channelId))["catch"](function () {
12602
+ return undefined;
12603
+ });
12604
+ notifyDraftListeners();
12605
+ };
12606
+ var clearDraftMessagesMap = function clearDraftMessagesMap() {
12607
+ Object.keys(draftMessagesMap).forEach(function (channelId) {
12608
+ return delete draftMessagesMap[channelId];
12609
+ });
12610
+ notifyDraftListeners();
12516
12611
  };
12517
12612
  var removeAudioRecordingFromMap = function removeAudioRecordingFromMap(channelId) {
12518
12613
  delete audioRecordingMap[channelId];
12519
12614
  };
12520
- var setDraftMessageToMap = function setDraftMessageToMap(channelId, draftMessage) {
12615
+ var setDraftMessageToMap = function setDraftMessageToMap(channelId, draftMessage, options) {
12616
+ if (options === void 0) {
12617
+ options = {};
12618
+ }
12521
12619
  draftMessagesMap[channelId] = draftMessage;
12620
+ if (options.persist === false) {
12621
+ Promise.resolve(removePersistedDraft(channelId))["catch"](function () {
12622
+ return undefined;
12623
+ });
12624
+ } else {
12625
+ Promise.resolve(persistDraft(channelId, draftMessage))["catch"](function () {
12626
+ return undefined;
12627
+ });
12628
+ }
12629
+ notifyDraftListeners();
12630
+ };
12631
+ var hydrateDraftMessages = function hydrateDraftMessages() {
12632
+ try {
12633
+ return Promise.resolve(restoreDrafts()).then(function (persistedDrafts) {
12634
+ persistedDrafts.forEach(function (_ref) {
12635
+ var channelId = _ref.channelId,
12636
+ draft = _ref.draft;
12637
+ var attachments = (draft.attachments || []).map(function (attachment) {
12638
+ var data = attachment.data;
12639
+ var restoredData = data instanceof Blob && typeof File !== 'undefined' && !(data instanceof File) ? new File([data], attachment.name || 'attachment', {
12640
+ type: data.type || attachment.mimeType || 'application/octet-stream',
12641
+ lastModified: attachment.lastModified || Date.now()
12642
+ }) : data;
12643
+ return _extends({}, attachment, {
12644
+ data: restoredData,
12645
+ attachmentUrl: restoredData instanceof Blob && typeof URL !== 'undefined' ? URL.createObjectURL(restoredData) : attachment.attachmentUrl
12646
+ });
12647
+ });
12648
+ draftMessagesMap[channelId] = _extends({}, draft, {
12649
+ attachments: attachments
12650
+ });
12651
+ });
12652
+ draftMessagesHydrated = true;
12653
+ notifyDraftListeners();
12654
+ });
12655
+ } catch (e) {
12656
+ return Promise.reject(e);
12657
+ }
12522
12658
  };
12523
12659
  var checkPendingPollActionConflict = function checkPendingPollActionConflict(action) {
12524
12660
  var messageId = action.message.id || action.message.tid;
@@ -15179,7 +15315,7 @@ var resizeImageWithPica = function resizeImageWithPica(file, maxWidth, maxHeight
15179
15315
  maxHeight = 1600;
15180
15316
  }
15181
15317
  if (quality === void 0) {
15182
- quality = 0.82;
15318
+ quality = 1;
15183
15319
  }
15184
15320
  try {
15185
15321
  return Promise.resolve(_catch(function () {
@@ -15275,7 +15411,7 @@ var resizeImageWithPica = function resizeImageWithPica(file, maxWidth, maxHeight
15275
15411
  var MAX_WIDTH = 1280;
15276
15412
  var MAX_HEIGHT = 1080;
15277
15413
  var MIME_TYPE = 'image/jpeg';
15278
- var QUALITY = 0.9;
15414
+ var QUALITY = 1;
15279
15415
  var THUMBNAIL_MAX_WIDTH = 6;
15280
15416
  var THUMBNAIL_MAX_HEIGHT = 6;
15281
15417
  function resizeImage(file, maxWidth, maxHeight, quality) {
@@ -15702,11 +15838,11 @@ var getVideoFirstFrame = function getVideoFirstFrame(videoSrc, maxWidth, maxHeig
15702
15838
  var _exit4 = false;
15703
15839
  if (_exit3) return _result3;
15704
15840
  function _temp8(_result4) {
15705
- return _exit4 ? _result4 : Promise.resolve(extractFrameFromUrl(videoSrc, maxWidth, maxHeight, quality)).then(function (direct) {
15841
+ return _exit4 ? _result4 : Promise.resolve(extractFrameFromUrl(videoSrc, scaledMaxWidth, scaledMaxHeight, quality)).then(function (direct) {
15706
15842
  return direct ? direct : _catch(function () {
15707
15843
  return Promise.resolve(fetch(videoSrc)).then(function (response) {
15708
15844
  return Promise.resolve(response.blob()).then(function (blob) {
15709
- return Promise.resolve(_extractFrameFromBlob2(blob, maxWidth, maxHeight, quality));
15845
+ return Promise.resolve(_extractFrameFromBlob2(blob, scaledMaxWidth, scaledMaxHeight, quality));
15710
15846
  });
15711
15847
  });
15712
15848
  }, function (error) {
@@ -15720,7 +15856,7 @@ var getVideoFirstFrame = function getVideoFirstFrame(videoSrc, maxWidth, maxHeig
15720
15856
  return _catch(function () {
15721
15857
  return Promise.resolve(fetch(videoSrc)).then(function (_fetch) {
15722
15858
  return Promise.resolve(_fetch.blob()).then(function (blob) {
15723
- return Promise.resolve(_extractFrameFromBlob2(blob, maxWidth, maxHeight, quality)).then(function (_await$_extractFrameF2) {
15859
+ return Promise.resolve(_extractFrameFromBlob2(blob, scaledMaxWidth, scaledMaxHeight, quality)).then(function (_await$_extractFrameF2) {
15724
15860
  _exit4 = true;
15725
15861
  return _await$_extractFrameF2;
15726
15862
  });
@@ -15728,7 +15864,7 @@ var getVideoFirstFrame = function getVideoFirstFrame(videoSrc, maxWidth, maxHeig
15728
15864
  });
15729
15865
  }, function (error) {
15730
15866
  log.warn('getVideoFirstFrame: failed to re-fetch blob url, trying directly', error);
15731
- return Promise.resolve(extractFrameFromUrl(videoSrc, maxWidth, maxHeight, quality)).then(function (_await$extractFrameFr) {
15867
+ return Promise.resolve(extractFrameFromUrl(videoSrc, scaledMaxWidth, scaledMaxHeight, quality)).then(function (_await$extractFrameFr) {
15732
15868
  _exit4 = true;
15733
15869
  return _await$extractFrameFr;
15734
15870
  });
@@ -15737,9 +15873,11 @@ var getVideoFirstFrame = function getVideoFirstFrame(videoSrc, maxWidth, maxHeig
15737
15873
  }();
15738
15874
  return _temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7);
15739
15875
  }
15876
+ var scaledMaxWidth = scaleForDevicePixelRatio(maxWidth);
15877
+ var scaledMaxHeight = scaleForDevicePixelRatio(maxHeight);
15740
15878
  var _temp9 = function () {
15741
15879
  if (videoSrc instanceof Blob) {
15742
- return Promise.resolve(_extractFrameFromBlob2(videoSrc, maxWidth, maxHeight, quality)).then(function (_await$_extractFrameF) {
15880
+ return Promise.resolve(_extractFrameFromBlob2(videoSrc, scaledMaxWidth, scaledMaxHeight, quality)).then(function (_await$_extractFrameF) {
15743
15881
  _exit3 = true;
15744
15882
  return _await$_extractFrameF;
15745
15883
  });
@@ -15754,6 +15892,16 @@ var getVideoFirstFrame = function getVideoFirstFrame(videoSrc, maxWidth, maxHeig
15754
15892
  return Promise.reject(e);
15755
15893
  }
15756
15894
  };
15895
+ var scaleForDevicePixelRatio = function scaleForDevicePixelRatio(value, cap) {
15896
+ if (cap === void 0) {
15897
+ cap = 2;
15898
+ }
15899
+ if (!value) {
15900
+ return value;
15901
+ }
15902
+ var dpr = Math.min(window.devicePixelRatio || 1, cap);
15903
+ return value * dpr;
15904
+ };
15757
15905
  var normalizeVideoBlob = function normalizeVideoBlob(blob) {
15758
15906
  try {
15759
15907
  return Promise.resolve(inspectVideoBlob(blob)).then(function (info) {
@@ -15984,7 +16132,7 @@ var compressAndCacheImage = function compressAndCacheImage(url, cacheKey, maxWid
15984
16132
  var file = new File([blob], 'image.jpeg', {
15985
16133
  type: blob.type
15986
16134
  });
15987
- return Promise.resolve(resizeImageWithPica(file, maxWidth || 1280, maxHeight || 1080, quality || 1)).then(function (_ref2) {
16135
+ return Promise.resolve(resizeImageWithPica(file, scaleForDevicePixelRatio(maxWidth || 1280), scaleForDevicePixelRatio(maxHeight || 1080), quality || 1)).then(function (_ref2) {
15988
16136
  var compressedBlob = _ref2.blob;
15989
16137
  var returningUrl = compressedBlob ? URL.createObjectURL(compressedBlob) : '';
15990
16138
  if (compressedBlob) {
@@ -16071,7 +16219,76 @@ var createAttachmentUnavailableError = function createAttachmentUnavailableError
16071
16219
  return error;
16072
16220
  };
16073
16221
 
16074
- var _excluded$1 = ["lastMessage"];
16222
+ var preparations = new Map();
16223
+ var beginVideoPreparation = function beginVideoPreparation(tid, file) {
16224
+ var resolvePreparation;
16225
+ var promise = new Promise(function (resolve) {
16226
+ resolvePreparation = resolve;
16227
+ });
16228
+ preparations.set(tid, {
16229
+ file: file,
16230
+ status: 'loading',
16231
+ promise: promise,
16232
+ resolve: resolvePreparation
16233
+ });
16234
+ };
16235
+ var completeVideoPreparation = function completeVideoPreparation(tid, preparation) {
16236
+ var entry = preparations.get(tid);
16237
+ if (!entry || entry.status !== 'loading') return;
16238
+ var completed = _extends({}, preparation, {
16239
+ status: 'ready'
16240
+ });
16241
+ preparations.set(tid, _extends({}, entry, completed));
16242
+ entry.resolve(completed);
16243
+ };
16244
+ var failVideoPreparation = function failVideoPreparation(tid) {
16245
+ var entry = preparations.get(tid);
16246
+ if (!entry || entry.status !== 'loading') return;
16247
+ var failed = {
16248
+ file: entry.file,
16249
+ status: 'failed'
16250
+ };
16251
+ preparations.set(tid, _extends({}, entry, failed));
16252
+ entry.resolve(failed);
16253
+ };
16254
+ var waitForVideoPreparation = function waitForVideoPreparation(tid, timeoutMs) {
16255
+ try {
16256
+ var _temp2 = function _temp2(_result) {
16257
+ return _exit ? _result : Promise.resolve(new Promise(function (resolve) {
16258
+ var timeout = setTimeout(function () {
16259
+ return resolve({
16260
+ file: entry.file,
16261
+ status: 'failed'
16262
+ });
16263
+ }, timeoutMs);
16264
+ entry.promise.then(function (prepared) {
16265
+ clearTimeout(timeout);
16266
+ resolve(prepared);
16267
+ });
16268
+ }));
16269
+ };
16270
+ var _exit = false;
16271
+ var entry = preparations.get(tid);
16272
+ if (!entry) return Promise.resolve(null);
16273
+ if (entry.status !== 'loading') return Promise.resolve(entry);
16274
+ var _temp = function () {
16275
+ if (timeoutMs === undefined) {
16276
+ return Promise.resolve(entry.promise).then(function (_await$entry$promise) {
16277
+ _exit = true;
16278
+ return _await$entry$promise;
16279
+ });
16280
+ }
16281
+ }();
16282
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
16283
+ } catch (e) {
16284
+ return Promise.reject(e);
16285
+ }
16286
+ };
16287
+ var clearVideoPreparation = function clearVideoPreparation(tid) {
16288
+ preparations["delete"](tid);
16289
+ };
16290
+
16291
+ var _excluded = ["lastMessage"];
16075
16292
  var _marked = /*#__PURE__*/_regenerator().m(setMessageListLoading),
16076
16293
  _marked2 = /*#__PURE__*/_regenerator().m(cancelChannelMessageProcesses),
16077
16294
  _marked3 = /*#__PURE__*/_regenerator().m(getChannelForMessageMutation),
@@ -16140,6 +16357,31 @@ var queuedPrefetchRequests = new Map();
16140
16357
  var prefetchCompletionWaiters = new Map();
16141
16358
  var prefetchCancelVersions = new Map();
16142
16359
  var ACTIVE_CHANNEL_RECONNECT_REFRESH_TIMEOUT_MS = 1500;
16360
+ var applyPreparedVideoAttachments = function applyPreparedVideoAttachments(attachments) {
16361
+ try {
16362
+ return Promise.resolve(Promise.all(attachments.map(function (attachment) {
16363
+ try {
16364
+ if (!attachment.tid) return Promise.resolve();
16365
+ return Promise.resolve(waitForVideoPreparation(attachment.tid)).then(function (prepared) {
16366
+ if ((prepared === null || prepared === void 0 ? void 0 : prepared.status) === 'ready' && prepared.metadata) {
16367
+ attachment.url = prepared.file;
16368
+ attachment.data = prepared.file;
16369
+ attachment.name = prepared.file.name;
16370
+ attachment.size = prepared.file.size;
16371
+ attachment.metadata = prepared.metadata;
16372
+ }
16373
+ clearVideoPreparation(attachment.tid);
16374
+ });
16375
+ } catch (e) {
16376
+ return Promise.reject(e);
16377
+ }
16378
+ }))).then(function () {
16379
+ return attachments;
16380
+ });
16381
+ } catch (e) {
16382
+ return Promise.reject(e);
16383
+ }
16384
+ };
16143
16385
  var activeDisplayedCacheKey = null;
16144
16386
  var updateTabAttachmentCache = function updateTabAttachmentCache(channelId, attachments, messageUser) {
16145
16387
  if (!(attachments !== null && attachments !== void 0 && attachments.length)) return;
@@ -16358,8 +16600,8 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
16358
16600
  return Promise.resolve(Promise.all(attachments.map(function (attachment) {
16359
16601
  try {
16360
16602
  var _attachment$url, _attachment$url$type;
16361
- var _temp10 = function _temp10() {
16362
- function _temp0() {
16603
+ var _temp1 = function _temp1() {
16604
+ function _temp9() {
16363
16605
  store.dispatch(updateAttachmentUploadingStateAC(UPLOAD_STATE.SUCCESS, attachment.tid));
16364
16606
  var parsedAttachmentMeta = function () {
16365
16607
  if (!attachment.metadata) return {};
@@ -16378,68 +16620,55 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
16378
16620
  }
16379
16621
  return attachmentToSend;
16380
16622
  }
16381
- var _temp9 = function () {
16623
+ var _temp8 = function () {
16382
16624
  if (!attachment.cachedUrl && fileType === 'image') {
16383
16625
  return _catch(function () {
16384
- var _temp2 = function () {
16626
+ var _temp = function () {
16385
16627
  if (blobLocal && blobLocal.type.startsWith('image/')) {
16386
- var _attachment, _attachment2;
16387
16628
  var file = attachment.url instanceof File ? attachment.url : new File([attachment.url], attachment.name || 'image', {
16388
16629
  type: attachment.url.type || blobLocal.type
16389
16630
  });
16390
- var _calculateRenderedIma = calculateRenderedImageWidth(((_attachment = attachment) === null || _attachment === void 0 ? void 0 : _attachment.metadata.szw) || 1280, ((_attachment2 = attachment) === null || _attachment2 === void 0 ? void 0 : _attachment2.metadata.szh) || 1080),
16391
- newWidth = _calculateRenderedIma[0],
16392
- newHeight = _calculateRenderedIma[1];
16393
- return Promise.resolve(resizeImageWithPica(file, newWidth, newHeight, 1)).then(function (_ref) {
16394
- var resizedBlob = _ref.blob;
16395
- var _temp = function () {
16396
- if (resizedBlob) {
16397
- var resizedResponse = new Response(resizedBlob, {
16398
- headers: {
16399
- 'Content-Type': resizedBlob.type || blobLocal.type
16400
- }
16401
- });
16402
- return Promise.resolve(setAttachmentToCache(uriLocal, resizedResponse)).then(function () {
16403
- filePath = URL.createObjectURL(resizedBlob);
16404
- store.dispatch(setUpdateMessageAttachmentAC(uriLocal, filePath));
16405
- message.attachments[0] = _extends({}, message.attachments[0], {
16406
- attachmentUrl: filePath
16407
- });
16408
- setAttachmentToCache(uriLocal + "_original_image_url", new Response(blobLocal, {
16409
- headers: {
16410
- 'Content-Type': blobLocal.type
16411
- }
16412
- }));
16413
- var originalImageUrl = URL.createObjectURL(blobLocal);
16414
- store.dispatch(setUpdateMessageAttachmentAC(uriLocal + "_original_image_url", originalImageUrl));
16415
- });
16631
+ return Promise.resolve(setAttachmentToCache(uriLocal, new Response(file, {
16632
+ headers: {
16633
+ 'Content-Type': file.type
16634
+ }
16635
+ }))).then(function () {
16636
+ filePath = URL.createObjectURL(file);
16637
+ store.dispatch(setUpdateMessageAttachmentAC(uriLocal, filePath));
16638
+ message.attachments[0] = _extends({}, message.attachments[0], {
16639
+ attachmentUrl: filePath
16640
+ });
16641
+ setAttachmentToCache(uriLocal + "_original_image_url", new Response(blobLocal, {
16642
+ headers: {
16643
+ 'Content-Type': blobLocal.type
16416
16644
  }
16417
- }();
16418
- if (_temp && _temp.then) return _temp.then(function () {});
16645
+ }));
16646
+ var originalImageUrl = URL.createObjectURL(blobLocal);
16647
+ store.dispatch(setUpdateMessageAttachmentAC(uriLocal + "_original_image_url", originalImageUrl));
16419
16648
  });
16420
16649
  }
16421
16650
  }();
16422
- if (_temp2 && _temp2.then) return _temp2.then(function () {});
16651
+ if (_temp && _temp.then) return _temp.then(function () {});
16423
16652
  }, function (error) {
16424
16653
  log.error('Error resizing and caching image during upload:', error);
16425
16654
  });
16426
16655
  } else {
16427
- var _temp11 = function () {
16656
+ var _temp10 = function () {
16428
16657
  if (!attachment.cachedUrl && fileType === 'video') {
16429
- var _temp7 = function () {
16658
+ var _temp6 = function () {
16430
16659
  if (blobLocal) {
16431
- var _attachment3, _attachment4;
16432
- var _calculateRenderedIma2 = calculateRenderedImageWidth(((_attachment3 = attachment) === null || _attachment3 === void 0 ? void 0 : _attachment3.metadata.szw) || 1280, ((_attachment4 = attachment) === null || _attachment4 === void 0 ? void 0 : _attachment4.metadata.szh) || 1080),
16433
- newWidth = _calculateRenderedIma2[0],
16434
- newHeight = _calculateRenderedIma2[1];
16660
+ var _attachment, _attachment2;
16661
+ var _calculateRenderedIma = calculateRenderedImageWidth(((_attachment = attachment) === null || _attachment === void 0 ? void 0 : _attachment.metadata.szw) || 1280, ((_attachment2 = attachment) === null || _attachment2 === void 0 ? void 0 : _attachment2.metadata.szh) || 1080),
16662
+ newWidth = _calculateRenderedIma[0],
16663
+ newHeight = _calculateRenderedIma[1];
16435
16664
  return Promise.resolve(getVideoFirstFrame(blobLocal, newWidth, newHeight)).then(function (result) {
16436
- var _temp6 = function () {
16665
+ var _temp5 = function () {
16437
16666
  if (result) {
16438
16667
  var frameBlobUrl = result.frameBlobUrl,
16439
16668
  blob = result.blob;
16440
- var _temp5 = function () {
16669
+ var _temp4 = function () {
16441
16670
  if (frameBlobUrl && blob) {
16442
- var _temp4 = function _temp4() {
16671
+ var _temp3 = function _temp3() {
16443
16672
  return Promise.resolve(setAttachmentToCache(uriLocal, response)).then(function () {
16444
16673
  store.dispatch(setUpdateMessageAttachmentAC(uriLocal, frameBlobUrl));
16445
16674
  message.attachments[0] = _extends({}, message.attachments[0], {
@@ -16452,7 +16681,7 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
16452
16681
  'Content-Type': blob.type
16453
16682
  }
16454
16683
  });
16455
- var _temp3 = function () {
16684
+ var _temp2 = function () {
16456
16685
  if (blobLocal) {
16457
16686
  return Promise.resolve(setAttachmentToCache(uriLocal + "_original_video_url", new Response(blobLocal, {
16458
16687
  headers: {
@@ -16464,27 +16693,27 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
16464
16693
  });
16465
16694
  }
16466
16695
  }();
16467
- return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
16696
+ return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
16468
16697
  }
16469
16698
  }();
16470
- if (_temp5 && _temp5.then) return _temp5.then(function () {});
16699
+ if (_temp4 && _temp4.then) return _temp4.then(function () {});
16471
16700
  }
16472
16701
  }();
16473
- if (_temp6 && _temp6.then) return _temp6.then(function () {});
16702
+ if (_temp5 && _temp5.then) return _temp5.then(function () {});
16474
16703
  });
16475
16704
  }
16476
16705
  }();
16477
- if (_temp7 && _temp7.then) return _temp7.then(function () {});
16706
+ if (_temp6 && _temp6.then) return _temp6.then(function () {});
16478
16707
  }
16479
16708
  }();
16480
- if (_temp11 && _temp11.then) return _temp11.then(function () {});
16709
+ if (_temp10 && _temp10.then) return _temp10.then(function () {});
16481
16710
  }
16482
16711
  }();
16483
- return _temp9 && _temp9.then ? _temp9.then(_temp0) : _temp0(_temp9);
16712
+ return _temp8 && _temp8.then ? _temp8.then(_temp9) : _temp9(_temp8);
16484
16713
  };
16485
- var handleUploadProgress = function handleUploadProgress(_ref2) {
16486
- var loaded = _ref2.loaded,
16487
- total = _ref2.total;
16714
+ var handleUploadProgress = function handleUploadProgress(_ref) {
16715
+ var loaded = _ref.loaded,
16716
+ total = _ref.total;
16488
16717
  store.dispatch(updateAttachmentUploadingProgressAC(loaded, total, attachment.tid));
16489
16718
  };
16490
16719
  if (!attachment.cachedUrl && !(attachment.url instanceof Blob)) {
@@ -16509,16 +16738,16 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
16509
16738
  }
16510
16739
  };
16511
16740
  var blobLocal = null;
16512
- var _temp1 = function () {
16741
+ var _temp0 = function () {
16513
16742
  if (attachment.cachedUrl) {
16514
16743
  var _attachment$data;
16515
16744
  uriLocal = attachment.cachedUrl;
16516
16745
  var dataSize = ((_attachment$data = attachment.data) === null || _attachment$data === void 0 ? void 0 : _attachment$data.size) || 0;
16517
16746
  store.dispatch(updateAttachmentUploadingProgressAC(dataSize, dataSize, attachment.tid));
16518
16747
  } else {
16519
- return Promise.resolve(customUpload(attachment, handleUploadProgress, message.type, handleUpdateLocalPath)).then(function (_ref3) {
16520
- var uri = _ref3.uri,
16521
- blob = _ref3.blob;
16748
+ return Promise.resolve(customUpload(attachment, handleUploadProgress, message.type, handleUpdateLocalPath)).then(function (_ref2) {
16749
+ var uri = _ref2.uri,
16750
+ blob = _ref2.blob;
16522
16751
  uriLocal = uri;
16523
16752
  blobLocal = blob;
16524
16753
  if (blobLocal) {
@@ -16529,7 +16758,7 @@ var handleUploadAttachments = function handleUploadAttachments(attachments, mess
16529
16758
  });
16530
16759
  }
16531
16760
  }();
16532
- return Promise.resolve(_temp1 && _temp1.then ? _temp1.then(_temp10) : _temp10(_temp1));
16761
+ return Promise.resolve(_temp0 && _temp0.then ? _temp0.then(_temp1) : _temp1(_temp0));
16533
16762
  } catch (e) {
16534
16763
  return Promise.reject(e);
16535
16764
  }
@@ -16586,7 +16815,7 @@ var getResolvedChannelUpdateData = function getResolvedChannelUpdateData(channel
16586
16815
  return channelUpdateData;
16587
16816
  }
16588
16817
  var lastMessage = channelUpdateData.lastMessage,
16589
- restChannelUpdateData = _objectWithoutPropertiesLoose(channelUpdateData, _excluded$1);
16818
+ restChannelUpdateData = _objectWithoutPropertiesLoose(channelUpdateData, _excluded);
16590
16819
  var resolvedLastMessage = getResolvedChannelLastMessage(channelId, lastMessage, lastMessage);
16591
16820
  if (!lastMessageNeedsUpdate((_getStoredChannel4 = getStoredChannel(channelId)) === null || _getStoredChannel4 === void 0 ? void 0 : _getStoredChannel4.lastMessage, resolvedLastMessage)) {
16592
16821
  return restChannelUpdateData;
@@ -17040,19 +17269,19 @@ function sendMessage(action) {
17040
17269
  var fileType = (_attachment$data2 = attachment.data) === null || _attachment$data2 === void 0 ? void 0 : (_attachment$data2$typ = _attachment$data2.type) === null || _attachment$data2$typ === void 0 ? void 0 : _attachment$data2$typ.split('/')[0];
17041
17270
  var updateImage = function updateImage() {
17042
17271
  try {
17043
- var _temp18 = function () {
17272
+ var _temp17 = function () {
17044
17273
  if (!attachment.cachedUrl && fileType === 'image' && attachment.data) {
17045
- var _temp13 = _catch(function () {
17274
+ var _temp12 = _catch(function () {
17046
17275
  var parsedMetadata = isJSON(attachment.metadata) ? JSON.parse(attachment.metadata) : attachment.metadata;
17047
- var _calculateRenderedIma3 = calculateRenderedImageWidth((parsedMetadata === null || parsedMetadata === void 0 ? void 0 : parsedMetadata.szw) || 1280, (parsedMetadata === null || parsedMetadata === void 0 ? void 0 : parsedMetadata.szh) || 1080),
17048
- newWidth = _calculateRenderedIma3[0],
17049
- newHeight = _calculateRenderedIma3[1];
17276
+ var _calculateRenderedIma2 = calculateRenderedImageWidth((parsedMetadata === null || parsedMetadata === void 0 ? void 0 : parsedMetadata.szw) || 1280, (parsedMetadata === null || parsedMetadata === void 0 ? void 0 : parsedMetadata.szh) || 1080),
17277
+ newWidth = _calculateRenderedIma2[0],
17278
+ newHeight = _calculateRenderedIma2[1];
17050
17279
  var file = attachment.data instanceof File ? attachment.data : new File([attachment.data], attachment.name || 'image', {
17051
17280
  type: attachment.data.type
17052
17281
  });
17053
- return Promise.resolve(resizeImageWithPica(file, newWidth, newHeight, 1)).then(function (_ref4) {
17054
- var resizedBlob = _ref4.blob;
17055
- var _temp12 = function () {
17282
+ return Promise.resolve(resizeImageWithPica(file, newWidth, newHeight, 1)).then(function (_ref3) {
17283
+ var resizedBlob = _ref3.blob;
17284
+ var _temp11 = function () {
17056
17285
  if (resizedBlob) {
17057
17286
  return Promise.resolve(setAttachmentToCache(uriLocal, new Response(resizedBlob, {
17058
17287
  headers: {
@@ -17070,22 +17299,22 @@ function sendMessage(action) {
17070
17299
  });
17071
17300
  }
17072
17301
  }();
17073
- if (_temp12 && _temp12.then) return _temp12.then(function () {});
17302
+ if (_temp11 && _temp11.then) return _temp11.then(function () {});
17074
17303
  });
17075
17304
  }, function (err) {
17076
17305
  log.error('Error caching resized image on upload completion:', err);
17077
17306
  });
17078
- if (_temp13 && _temp13.then) return _temp13.then(function () {});
17307
+ if (_temp12 && _temp12.then) return _temp12.then(function () {});
17079
17308
  } else {
17080
- var _temp19 = function () {
17309
+ var _temp18 = function () {
17081
17310
  if (!attachment.cachedUrl && fileType === 'video' && attachment.data) {
17082
- var _temp16 = _catch(function () {
17311
+ var _temp15 = _catch(function () {
17083
17312
  var parsedMetadata = isJSON(attachment.metadata) ? JSON.parse(attachment.metadata) : attachment.metadata;
17084
- var _calculateRenderedIma4 = calculateRenderedImageWidth((parsedMetadata === null || parsedMetadata === void 0 ? void 0 : parsedMetadata.szw) || 1280, (parsedMetadata === null || parsedMetadata === void 0 ? void 0 : parsedMetadata.szh) || 1080),
17085
- newWidth = _calculateRenderedIma4[0],
17086
- newHeight = _calculateRenderedIma4[1];
17313
+ var _calculateRenderedIma3 = calculateRenderedImageWidth((parsedMetadata === null || parsedMetadata === void 0 ? void 0 : parsedMetadata.szw) || 1280, (parsedMetadata === null || parsedMetadata === void 0 ? void 0 : parsedMetadata.szh) || 1080),
17314
+ newWidth = _calculateRenderedIma3[0],
17315
+ newHeight = _calculateRenderedIma3[1];
17087
17316
  return Promise.resolve(getVideoFirstFrame(attachment.data, newWidth, newHeight)).then(function (result) {
17088
- var _temp15 = function () {
17317
+ var _temp14 = function () {
17089
17318
  if (result) {
17090
17319
  var frameBlobUrl = result.frameBlobUrl,
17091
17320
  blob = result.blob;
@@ -17095,7 +17324,7 @@ function sendMessage(action) {
17095
17324
  }
17096
17325
  }))).then(function () {
17097
17326
  store.dispatch(setUpdateMessageAttachmentAC(uriLocal, frameBlobUrl));
17098
- var _temp14 = function () {
17327
+ var _temp13 = function () {
17099
17328
  if (attachment.data) {
17100
17329
  return Promise.resolve(setAttachmentToCache(uriLocal + '_original_video_url', new Response(attachment.data, {
17101
17330
  headers: {
@@ -17106,22 +17335,22 @@ function sendMessage(action) {
17106
17335
  });
17107
17336
  }
17108
17337
  }();
17109
- if (_temp14 && _temp14.then) return _temp14.then(function () {});
17338
+ if (_temp13 && _temp13.then) return _temp13.then(function () {});
17110
17339
  });
17111
17340
  }
17112
17341
  }();
17113
- if (_temp15 && _temp15.then) return _temp15.then(function () {});
17342
+ if (_temp14 && _temp14.then) return _temp14.then(function () {});
17114
17343
  });
17115
17344
  }, function (err) {
17116
17345
  log.error('Error caching video frame on upload completion:', err);
17117
17346
  });
17118
- if (_temp16 && _temp16.then) return _temp16.then(function () {});
17347
+ if (_temp15 && _temp15.then) return _temp15.then(function () {});
17119
17348
  }
17120
17349
  }();
17121
- if (_temp19 && _temp19.then) return _temp19.then(function () {});
17350
+ if (_temp18 && _temp18.then) return _temp18.then(function () {});
17122
17351
  }
17123
17352
  }();
17124
- return Promise.resolve(_temp18 && _temp18.then ? _temp18.then(function () {}) : void 0);
17353
+ return Promise.resolve(_temp17 && _temp17.then ? _temp17.then(function () {}) : void 0);
17125
17354
  } catch (e) {
17126
17355
  return Promise.reject(e);
17127
17356
  }
@@ -17259,7 +17488,7 @@ function sendMessage(action) {
17259
17488
  messagesToSend.push(messageToSend);
17260
17489
  case 12:
17261
17490
  _loop3 = /*#__PURE__*/_regenerator().m(function _callee4() {
17262
- var messageAttachment, messageToSend, pendingState, messageCopy, _getStoredChannel6, _attachmentsToSend, linkAttachmentToSend, linkAttachmentBuilder, messageResponse, k, attachmentsToUpdate, currentAttachmentsMap, messageUpdateData, activeChannelId, messageToUpdate, resolvedLastMessage, channelUpdateParam, _channel2, _messageToSend2, isErrorResendable, _messageToSend$attach, _iterator2, _step2, att, _t;
17491
+ var messageAttachment, messageToSend, pendingState, pendingAttachments, messageCopy, _getStoredChannel6, _attachmentsToSend, linkAttachmentToSend, linkAttachmentBuilder, messageResponse, k, attachmentsToUpdate, currentAttachmentsMap, messageUpdateData, activeChannelId, messageToUpdate, resolvedLastMessage, channelUpdateParam, _channel2, _messageToSend2, isErrorResendable, _messageToSend$attach, _iterator2, _step2, att, _t;
17263
17492
  return _regenerator().w(function (_context12) {
17264
17493
  while (1) switch (_context12.p = _context12.n) {
17265
17494
  case 0:
@@ -17282,21 +17511,40 @@ function sendMessage(action) {
17282
17511
  messageToSend = _extends({}, messageToSend, pendingState);
17283
17512
  case 2:
17284
17513
  _context12.p = 2;
17514
+ _context12.n = 3;
17515
+ return effects.call(applyPreparedVideoAttachments, messageAttachment);
17516
+ case 3:
17517
+ pendingAttachments = messageAttachment.map(function (attachment) {
17518
+ return _extends({}, attachment, {
17519
+ data: attachment.data || attachment.url
17520
+ });
17521
+ });
17522
+ updateMessageOnMap(channel.id, {
17523
+ messageId: messageToSend.tid,
17524
+ params: {
17525
+ attachments: pendingAttachments
17526
+ }
17527
+ });
17528
+ _context12.n = 4;
17529
+ return effects.put(updateMessageAC(messageToSend.tid, {
17530
+ attachments: pendingAttachments
17531
+ }));
17532
+ case 4:
17285
17533
  messageCopy = JSON.parse(JSON.stringify(messagesToSend[_i2]));
17286
17534
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
17287
- _context12.n = 15;
17535
+ _context12.n = 17;
17288
17536
  break;
17289
17537
  }
17290
17538
  _attachmentsToSend = messageAttachment;
17291
17539
  if (!customUploader) {
17292
- _context12.n = 4;
17540
+ _context12.n = 6;
17293
17541
  break;
17294
17542
  }
17295
- _context12.n = 3;
17543
+ _context12.n = 5;
17296
17544
  return effects.call(handleUploadAttachments, messageAttachment || [], messageCopy, channel);
17297
- case 3:
17545
+ case 5:
17298
17546
  _attachmentsToSend = _context12.v;
17299
- case 4:
17547
+ case 6:
17300
17548
  linkAttachmentToSend = null;
17301
17549
  if (_i2 === 0 && linkAttachment) {
17302
17550
  linkAttachmentBuilder = channel.createAttachmentBuilder(linkAttachment.data, linkAttachment.type);
@@ -17311,40 +17559,40 @@ function sendMessage(action) {
17311
17559
  attachments: [].concat(_attachmentsToSend)
17312
17560
  });
17313
17561
  }
17314
- _context12.n = 5;
17562
+ _context12.n = 7;
17315
17563
  return effects.call(channel.sendMessage, messageToSend);
17316
- case 5:
17564
+ case 7:
17317
17565
  messageResponse = _context12.v;
17318
17566
  if (messageToSend.tid) {
17319
17567
  autoResendAttempts["delete"](messageToSend.tid);
17320
17568
  }
17321
17569
  if (!customUploader) {
17322
- _context12.n = 10;
17570
+ _context12.n = 12;
17323
17571
  break;
17324
17572
  }
17325
17573
  k = 0;
17326
- case 6:
17574
+ case 8:
17327
17575
  if (!(k < messageAttachment.length)) {
17328
- _context12.n = 10;
17576
+ _context12.n = 12;
17329
17577
  break;
17330
17578
  }
17331
17579
  messageResponse.attachments[k] = _extends({}, messageResponse.attachments[k], {
17332
17580
  user: JSON.parse(JSON.stringify(messageResponse.user)),
17333
17581
  tid: messageAttachment[k].tid
17334
17582
  });
17335
- _context12.n = 7;
17583
+ _context12.n = 9;
17336
17584
  return effects.put(removeAttachmentProgressAC(messageAttachment[k].tid));
17337
- case 7:
17338
- _context12.n = 8;
17585
+ case 9:
17586
+ _context12.n = 10;
17339
17587
  return effects.put(removeAttachmentUploadingStateAC(messageAttachment[k].tid));
17340
- case 8:
17588
+ case 10:
17341
17589
  deletePendingAttachment(messageAttachment[k].tid);
17342
17590
  releaseBlobUrls(["compose_" + messageAttachment[k].tid]);
17343
- case 9:
17591
+ case 11:
17344
17592
  k++;
17345
- _context12.n = 6;
17593
+ _context12.n = 8;
17346
17594
  break;
17347
- case 10:
17595
+ case 12:
17348
17596
  attachmentsToUpdate = [];
17349
17597
  if (messageResponse.attachments && messageResponse.attachments.length > 0) {
17350
17598
  currentAttachmentsMap = {};
@@ -17371,25 +17619,25 @@ function sendMessage(action) {
17371
17619
  });
17372
17620
  activeChannelId = getActiveChannelId();
17373
17621
  if (!(activeChannelId === channel.id)) {
17374
- _context12.n = 11;
17622
+ _context12.n = 13;
17375
17623
  break;
17376
17624
  }
17377
- _context12.n = 11;
17625
+ _context12.n = 13;
17378
17626
  return effects.put(updateMessageAC(messageToSend.tid, messageUpdateData, true));
17379
- case 11:
17627
+ case 13:
17380
17628
  messageToUpdate = JSON.parse(JSON.stringify(messageResponse));
17381
17629
  addConfirmedMessageToCache(channel.id, messageToUpdate);
17382
17630
  updateTabAttachmentCache(channel.id, attachmentsToUpdate, messageResponse.user);
17383
17631
  if (!channel.unread) {
17384
- _context12.n = 12;
17632
+ _context12.n = 14;
17385
17633
  break;
17386
17634
  }
17387
- _context12.n = 12;
17635
+ _context12.n = 14;
17388
17636
  return effects.put(markChannelAsReadAC(channel.id));
17389
- case 12:
17637
+ case 14:
17390
17638
  resolvedLastMessage = getResolvedChannelLastMessage(channel.id, messageToUpdate, messageToSend);
17391
17639
  if (!lastMessageNeedsUpdate((_getStoredChannel6 = getStoredChannel(channel.id)) === null || _getStoredChannel6 === void 0 ? void 0 : _getStoredChannel6.lastMessage, resolvedLastMessage)) {
17392
- _context12.n = 14;
17640
+ _context12.n = 16;
17393
17641
  break;
17394
17642
  }
17395
17643
  updateChannelLastMessageOnAllChannels(channel.id, resolvedLastMessage);
@@ -17397,54 +17645,54 @@ function sendMessage(action) {
17397
17645
  lastMessage: resolvedLastMessage,
17398
17646
  lastReactedMessage: null
17399
17647
  };
17400
- _context12.n = 13;
17648
+ _context12.n = 15;
17401
17649
  return effects.put(updateChannelDataAC(channel.id, channelUpdateParam, true));
17402
- case 13:
17403
- updateChannelOnAllChannels(channel.id, channelUpdateParam);
17404
- case 14:
17405
- _context12.n = 16;
17406
- break;
17407
17650
  case 15:
17408
- throw new Error('Connection required to send message');
17651
+ updateChannelOnAllChannels(channel.id, channelUpdateParam);
17409
17652
  case 16:
17410
- _context12.n = 21;
17653
+ _context12.n = 18;
17411
17654
  break;
17412
17655
  case 17:
17413
- _context12.p = 17;
17656
+ throw new Error('Connection required to send message');
17657
+ case 18:
17658
+ _context12.n = 23;
17659
+ break;
17660
+ case 19:
17661
+ _context12.p = 19;
17414
17662
  _t = _context12.v;
17415
17663
  isErrorResendable = isResendableError(_t === null || _t === void 0 ? void 0 : _t.type);
17416
17664
  if (!((_channel2 = channel) !== null && _channel2 !== void 0 && _channel2.id && (_messageToSend2 = messageToSend) !== null && _messageToSend2 !== void 0 && _messageToSend2.tid)) {
17417
- _context12.n = 21;
17665
+ _context12.n = 23;
17418
17666
  break;
17419
17667
  }
17420
17668
  log.error('Error on uploading attachment', messageToSend.tid, _t);
17421
17669
  if (!((_messageToSend$attach = messageToSend.attachments) !== null && _messageToSend$attach !== void 0 && _messageToSend$attach.length)) {
17422
- _context12.n = 20;
17670
+ _context12.n = 22;
17423
17671
  break;
17424
17672
  }
17425
17673
  _iterator2 = _createForOfIteratorHelperLoose(messageToSend.attachments);
17426
- case 18:
17674
+ case 20:
17427
17675
  if ((_step2 = _iterator2()).done) {
17428
- _context12.n = 20;
17676
+ _context12.n = 22;
17429
17677
  break;
17430
17678
  }
17431
17679
  att = _step2.value;
17432
17680
  if (!att.tid) {
17433
- _context12.n = 19;
17681
+ _context12.n = 21;
17434
17682
  break;
17435
17683
  }
17436
- _context12.n = 19;
17684
+ _context12.n = 21;
17437
17685
  return effects.put(updateAttachmentUploadingStateAC(UPLOAD_STATE.FAIL, att.tid));
17438
- case 19:
17439
- _context12.n = 18;
17686
+ case 21:
17687
+ _context12.n = 20;
17440
17688
  break;
17441
- case 20:
17442
- _context12.n = 21;
17689
+ case 22:
17690
+ _context12.n = 23;
17443
17691
  return effects.call(syncFailedMessageState, channel, messageToSend.tid, pendingMessages[_i2] || messageToSend, isErrorResendable);
17444
- case 21:
17692
+ case 23:
17445
17693
  return _context12.a(2);
17446
17694
  }
17447
- }, _callee4, null, [[2, 17]]);
17695
+ }, _callee4, null, [[2, 19]]);
17448
17696
  });
17449
17697
  _i2 = 0;
17450
17698
  case 13:
@@ -18387,7 +18635,7 @@ function loadOGMetadataForLinkMessages(messages, getFromServer) {
18387
18635
  getFromServer = true;
18388
18636
  }
18389
18637
  return /*#__PURE__*/_regenerator().m(function _callee6() {
18390
- var i, _message$attachments2, message, isOnlyLinkAttachments, firstAttachment, j, _attachment5, _firstAttachment, _store$getState$Messa, _firstAttachment2, _firstAttachment3, _firstAttachment4, metadata, storedData;
18638
+ var i, _message$attachments2, message, isOnlyLinkAttachments, firstAttachment, j, _attachment3, _firstAttachment, _store$getState$Messa, _firstAttachment2, _firstAttachment3, _firstAttachment4, metadata, storedData;
18391
18639
  return _regenerator().w(function (_context22) {
18392
18640
  while (1) switch (_context22.n) {
18393
18641
  case 0:
@@ -18416,13 +18664,13 @@ function loadOGMetadataForLinkMessages(messages, getFromServer) {
18416
18664
  _context22.n = 6;
18417
18665
  break;
18418
18666
  }
18419
- _attachment5 = message.attachments[j];
18420
- if (!(_attachment5.type === attachmentTypes.link)) {
18667
+ _attachment3 = message.attachments[j];
18668
+ if (!(_attachment3.type === attachmentTypes.link)) {
18421
18669
  _context22.n = 4;
18422
18670
  break;
18423
18671
  }
18424
18672
  if (!firstAttachment) {
18425
- firstAttachment = _attachment5;
18673
+ firstAttachment = _attachment3;
18426
18674
  }
18427
18675
  _context22.n = 5;
18428
18676
  break;
@@ -22789,7 +23037,7 @@ var UploadAvatarButton = styled__default.button(_templateObject23 || (_templateO
22789
23037
  var UploadAvatarHandler = styled__default.div(_templateObject24 || (_templateObject24 = _taggedTemplateLiteralLoose(["\n margin-left: 18px;\n font-size: 13px;\n color: ", ";\n"])), function (props) {
22790
23038
  return props.color;
22791
23039
  });
22792
- var StyledText = styled__default.span(_templateObject25 || (_templateObject25 = _taggedTemplateLiteralLoose(["\n font-weight: ", ";\n font-family: ", ";\n font-style: ", ";\n text-decoration: ", ";\n letter-spacing: ", ";\n\n &.mention {\n color: ", ";\n font-weight: ", ";\n cursor: ", ";\n }\n &.bold {\n font-weight: 600;\n }\n &.italic {\n font-style: italic;\n }\n &.underline {\n text-decoration: underline;\n }\n &.strikethrough {\n text-decoration: line-through;\n }\n &.underline.strikethrough {\n text-decoration: underline line-through;\n }\n &.monospace {\n letter-spacing: 4px;\n }\n"])), function (props) {
23040
+ var StyledText = styled__default.span(_templateObject25 || (_templateObject25 = _taggedTemplateLiteralLoose(["\n font-weight: ", ";\n font-family: ", ";\n font-style: ", ";\n text-decoration: ", ";\n letter-spacing: ", ";\n\n &.mention {\n color: ", ";\n font-weight: ", ";\n cursor: ", ";\n display: inline;\n user-select: text;\n -webkit-user-select: text;\n }\n &.bold {\n font-weight: 600;\n }\n &.italic {\n font-style: italic;\n }\n &.underline {\n text-decoration: underline;\n }\n &.strikethrough {\n text-decoration: line-through;\n }\n &.underline.strikethrough {\n text-decoration: underline line-through;\n }\n &.monospace {\n letter-spacing: 4px;\n }\n"])), function (props) {
22793
23041
  return props.fontWeight || props.isLastMessage && '500';
22794
23042
  }, function (props) {
22795
23043
  return props.fontFamily;
@@ -22978,6 +23226,10 @@ var PendingIconWrapper = styled__default(SvgPendingIcon)(_templateObject5$1 || (
22978
23226
  }, function (props) {
22979
23227
  return props.color;
22980
23228
  });
23229
+ var canActivateMention = function canActivateMention() {
23230
+ var selection = typeof window !== 'undefined' ? window.getSelection() : null;
23231
+ return !selection || selection.isCollapsed;
23232
+ };
22981
23233
  var MessageStatusIcon = function MessageStatusIcon(_ref) {
22982
23234
  var messageStatus = _ref.messageStatus,
22983
23235
  messageStatusDisplayingType = _ref.messageStatusDisplayingType,
@@ -23193,7 +23445,7 @@ var MessageTextFormat = function MessageTextFormat(_ref3) {
23193
23445
  key: attributeOffset + index,
23194
23446
  "data-mention": attribute.metadata,
23195
23447
  onClick: function onClick() {
23196
- if (onMentionNameClick && shouldOpenUserProfileForMention) {
23448
+ if (canActivateMention() && onMentionNameClick && shouldOpenUserProfileForMention) {
23197
23449
  onMentionNameClick(mentionDisplay);
23198
23450
  }
23199
23451
  }
@@ -23207,7 +23459,7 @@ var MessageTextFormat = function MessageTextFormat(_ref3) {
23207
23459
  key: attributeOffset,
23208
23460
  "data-mention": attribute.metadata,
23209
23461
  onClick: function onClick() {
23210
- if (onMentionNameClick && shouldOpenUserProfileForMention) {
23462
+ if (canActivateMention() && onMentionNameClick && shouldOpenUserProfileForMention) {
23211
23463
  onMentionNameClick(mentionDisplay);
23212
23464
  }
23213
23465
  },
@@ -25423,81 +25675,52 @@ function watchForEvents() {
25423
25675
  }, _marked0$1);
25424
25676
  }
25425
25677
 
25426
- var READ_MESSAGE_LOG_KEY_ALIASES = {
25427
- source: 's',
25428
- channelId: 'ch',
25429
- readAll: 'ra',
25430
- messageIds: 'mi',
25431
- messageId: 'm',
25432
- connectionStatus: 'cs',
25433
- attempts: 'at',
25434
- retryDelayMs: 'rd',
25435
- requestedMessageIds: 'rq',
25436
- confirmedMessageIds: 'cf',
25437
- isVisible: 'iv',
25438
- alreadyRead: 'ar',
25439
- disableAutoReadTracking: 'da',
25440
- isTabActive: 'ta',
25441
- newMessageCount: 'nm',
25442
- queued: 'q',
25443
- localRef: 'lr',
25444
- visibleCandidateIds: 'vc',
25445
- unreadScrollTo: 'us',
25446
- pendingFrameScheduled: 'pf'
25447
- };
25448
- var compactReadMessageLogData = function compactReadMessageLogData(data) {
25449
- return JSON.stringify(Object.fromEntries(Object.entries(data).map(function (_ref) {
25450
- var key = _ref[0],
25451
- value = _ref[1];
25452
- return [READ_MESSAGE_LOG_KEY_ALIASES[key] || key.slice(0, 2), value];
25453
- })));
25454
- };
25455
-
25456
25678
  var _marked$3 = /*#__PURE__*/_regenerator().m(applyChannelReadProgress),
25457
- _marked2$3 = /*#__PURE__*/_regenerator().m(createChannel),
25458
- _marked3$2 = /*#__PURE__*/_regenerator().m(getChannels),
25459
- _marked4$2 = /*#__PURE__*/_regenerator().m(searchChannels),
25460
- _marked5$2 = /*#__PURE__*/_regenerator().m(getChannelsForForward),
25461
- _marked6$2 = /*#__PURE__*/_regenerator().m(searchChannelsForForward),
25462
- _marked7$2 = /*#__PURE__*/_regenerator().m(channelsLoadMore),
25463
- _marked8$2 = /*#__PURE__*/_regenerator().m(getChannelMentions),
25464
- _marked9$2 = /*#__PURE__*/_regenerator().m(channelsForForwardLoadMore),
25465
- _marked0$2 = /*#__PURE__*/_regenerator().m(markMessagesRead),
25466
- _marked1$1 = /*#__PURE__*/_regenerator().m(markVoiceMessageAsPlayed),
25467
- _marked10$1 = /*#__PURE__*/_regenerator().m(updateMessageAsOpened),
25468
- _marked11$1 = /*#__PURE__*/_regenerator().m(markMessageAsOpened),
25469
- _marked12$1 = /*#__PURE__*/_regenerator().m(markMessagesDelivered),
25470
- _marked13$1 = /*#__PURE__*/_regenerator().m(switchChannel),
25471
- _marked14$1 = /*#__PURE__*/_regenerator().m(notificationsTurnOff),
25472
- _marked15$1 = /*#__PURE__*/_regenerator().m(notificationsTurnOn),
25473
- _marked16$1 = /*#__PURE__*/_regenerator().m(markChannelAsRead),
25474
- _marked17$1 = /*#__PURE__*/_regenerator().m(resendPendingChannelReads),
25475
- _marked18$1 = /*#__PURE__*/_regenerator().m(markChannelAsUnRead),
25476
- _marked19$1 = /*#__PURE__*/_regenerator().m(pinChannel),
25477
- _marked20$1 = /*#__PURE__*/_regenerator().m(unpinChannel),
25478
- _marked21$1 = /*#__PURE__*/_regenerator().m(removeChannelCaches),
25479
- _marked22$1 = /*#__PURE__*/_regenerator().m(leaveChannel),
25480
- _marked23$1 = /*#__PURE__*/_regenerator().m(deletePendingDeleteChannels),
25481
- _marked24$1 = /*#__PURE__*/_regenerator().m(deleteChannel),
25482
- _marked25$1 = /*#__PURE__*/_regenerator().m(blockChannel),
25483
- _marked26$1 = /*#__PURE__*/_regenerator().m(updateChannel),
25484
- _marked27$1 = /*#__PURE__*/_regenerator().m(checkUsersStatus),
25485
- _marked28$1 = /*#__PURE__*/_regenerator().m(sendTyping),
25486
- _marked29$1 = /*#__PURE__*/_regenerator().m(sendRecording),
25487
- _marked30$1 = /*#__PURE__*/_regenerator().m(clearHistory),
25488
- _marked31$1 = /*#__PURE__*/_regenerator().m(deleteAllMessages),
25489
- _marked32$1 = /*#__PURE__*/_regenerator().m(joinChannel),
25490
- _marked33$1 = /*#__PURE__*/_regenerator().m(watchForChannelEvents),
25491
- _marked34$1 = /*#__PURE__*/_regenerator().m(createChannelInviteKey),
25492
- _marked35$1 = /*#__PURE__*/_regenerator().m(getChannelInviteKeys),
25493
- _marked36$1 = /*#__PURE__*/_regenerator().m(regenerateChannelInviteKey),
25494
- _marked37$1 = /*#__PURE__*/_regenerator().m(updateChannelInviteKey),
25495
- _marked38$1 = /*#__PURE__*/_regenerator().m(getChannelByInviteKey),
25496
- _marked39$1 = /*#__PURE__*/_regenerator().m(joinChannelWithInviteKey),
25497
- _marked40$1 = /*#__PURE__*/_regenerator().m(setMessageRetentionPeriod),
25498
- _marked41$1 = /*#__PURE__*/_regenerator().m(getChannelsWithUser),
25499
- _marked42$1 = /*#__PURE__*/_regenerator().m(loadMoreMutualChannels),
25500
- _marked43$1 = /*#__PURE__*/_regenerator().m(ChannelsSaga);
25679
+ _marked2$3 = /*#__PURE__*/_regenerator().m(confirmDisplayedRead),
25680
+ _marked3$2 = /*#__PURE__*/_regenerator().m(createChannel),
25681
+ _marked4$2 = /*#__PURE__*/_regenerator().m(getChannels),
25682
+ _marked5$2 = /*#__PURE__*/_regenerator().m(searchChannels),
25683
+ _marked6$2 = /*#__PURE__*/_regenerator().m(getChannelsForForward),
25684
+ _marked7$2 = /*#__PURE__*/_regenerator().m(searchChannelsForForward),
25685
+ _marked8$2 = /*#__PURE__*/_regenerator().m(channelsLoadMore),
25686
+ _marked9$2 = /*#__PURE__*/_regenerator().m(getChannelMentions),
25687
+ _marked0$2 = /*#__PURE__*/_regenerator().m(channelsForForwardLoadMore),
25688
+ _marked1$1 = /*#__PURE__*/_regenerator().m(markMessagesRead),
25689
+ _marked10$1 = /*#__PURE__*/_regenerator().m(markVoiceMessageAsPlayed),
25690
+ _marked11$1 = /*#__PURE__*/_regenerator().m(updateMessageAsOpened),
25691
+ _marked12$1 = /*#__PURE__*/_regenerator().m(markMessageAsOpened),
25692
+ _marked13$1 = /*#__PURE__*/_regenerator().m(markMessagesDelivered),
25693
+ _marked14$1 = /*#__PURE__*/_regenerator().m(switchChannel),
25694
+ _marked15$1 = /*#__PURE__*/_regenerator().m(notificationsTurnOff),
25695
+ _marked16$1 = /*#__PURE__*/_regenerator().m(notificationsTurnOn),
25696
+ _marked17$1 = /*#__PURE__*/_regenerator().m(markChannelAsRead),
25697
+ _marked18$1 = /*#__PURE__*/_regenerator().m(resendPendingChannelReads),
25698
+ _marked19$1 = /*#__PURE__*/_regenerator().m(markChannelAsUnRead),
25699
+ _marked20$1 = /*#__PURE__*/_regenerator().m(pinChannel),
25700
+ _marked21$1 = /*#__PURE__*/_regenerator().m(unpinChannel),
25701
+ _marked22$1 = /*#__PURE__*/_regenerator().m(removeChannelCaches),
25702
+ _marked23$1 = /*#__PURE__*/_regenerator().m(leaveChannel),
25703
+ _marked24$1 = /*#__PURE__*/_regenerator().m(deletePendingDeleteChannels),
25704
+ _marked25$1 = /*#__PURE__*/_regenerator().m(deleteChannel),
25705
+ _marked26$1 = /*#__PURE__*/_regenerator().m(blockChannel),
25706
+ _marked27$1 = /*#__PURE__*/_regenerator().m(updateChannel),
25707
+ _marked28$1 = /*#__PURE__*/_regenerator().m(checkUsersStatus),
25708
+ _marked29$1 = /*#__PURE__*/_regenerator().m(sendTyping),
25709
+ _marked30$1 = /*#__PURE__*/_regenerator().m(sendRecording),
25710
+ _marked31$1 = /*#__PURE__*/_regenerator().m(clearHistory),
25711
+ _marked32$1 = /*#__PURE__*/_regenerator().m(deleteAllMessages),
25712
+ _marked33$1 = /*#__PURE__*/_regenerator().m(joinChannel),
25713
+ _marked34$1 = /*#__PURE__*/_regenerator().m(watchForChannelEvents),
25714
+ _marked35$1 = /*#__PURE__*/_regenerator().m(createChannelInviteKey),
25715
+ _marked36$1 = /*#__PURE__*/_regenerator().m(getChannelInviteKeys),
25716
+ _marked37$1 = /*#__PURE__*/_regenerator().m(regenerateChannelInviteKey),
25717
+ _marked38$1 = /*#__PURE__*/_regenerator().m(updateChannelInviteKey),
25718
+ _marked39$1 = /*#__PURE__*/_regenerator().m(getChannelByInviteKey),
25719
+ _marked40$1 = /*#__PURE__*/_regenerator().m(joinChannelWithInviteKey),
25720
+ _marked41$1 = /*#__PURE__*/_regenerator().m(setMessageRetentionPeriod),
25721
+ _marked42$1 = /*#__PURE__*/_regenerator().m(getChannelsWithUser),
25722
+ _marked43$1 = /*#__PURE__*/_regenerator().m(loadMoreMutualChannels),
25723
+ _marked44$1 = /*#__PURE__*/_regenerator().m(ChannelsSaga);
25501
25724
  var getUniqueMessageIds = function getUniqueMessageIds(messageIds) {
25502
25725
  if (messageIds === void 0) {
25503
25726
  messageIds = [];
@@ -25599,104 +25822,80 @@ function applyChannelReadProgress(channelId, updateData) {
25599
25822
  var shouldKeepQueuedPendingRead = function shouldKeepQueuedPendingRead(error) {
25600
25823
  return isResendableError(error === null || error === void 0 ? void 0 : error.type);
25601
25824
  };
25602
- var getReadMarkerLogContext = function getReadMarkerLogContext(pendingRead, source, messageIds) {
25603
- return {
25604
- source: source,
25605
- channelId: pendingRead.channelId,
25606
- readAll: pendingRead.readAll,
25607
- messageIds: messageIds
25608
- };
25609
- };
25610
- function confirmDisplayedRead(channel, pendingRead, source) {
25611
- if (source === void 0) {
25612
- source = 'initial';
25613
- }
25614
- return /*#__PURE__*/_regenerator().m(function _callee() {
25615
- var messageIds, logContext, attempt, connectionStatus, messageListMarker, _t;
25616
- return _regenerator().w(function (_context2) {
25617
- while (1) switch (_context2.p = _context2.n) {
25618
- case 0:
25619
- messageIds = getUniqueMessageIds(pendingRead.messageIds);
25620
- logContext = getReadMarkerLogContext(pendingRead, source, messageIds);
25621
- attempt = 0;
25622
- case 1:
25623
- if (!(attempt <= READ_MARKER_RETRY_DELAYS_MS.length)) {
25624
- _context2.n = 10;
25625
- break;
25626
- }
25627
- connectionStatus = store.getState().UserReducer.connectionStatus;
25628
- if (!(connectionStatus !== CONNECTION_STATUS.CONNECTED)) {
25629
- _context2.n = 2;
25630
- break;
25631
- }
25632
- log.warn('[READ_MESSAGE] Queued read marker because connection is not ready', compactReadMessageLogData(_extends({}, logContext, {
25633
- connectionStatus: connectionStatus
25634
- })));
25635
- return _context2.a(2, {
25636
- status: 'queued'
25637
- });
25638
- case 2:
25639
- _context2.p = 2;
25640
- if (!pendingRead.readAll) {
25641
- _context2.n = 4;
25642
- break;
25643
- }
25644
- _context2.n = 3;
25645
- return effects.call(channel.markAsRead);
25646
- case 3:
25647
- return _context2.a(2, {
25648
- status: 'success'
25649
- });
25650
- case 4:
25651
- _context2.n = 5;
25652
- return effects.call(channel.markMessagesAsDisplayed, messageIds);
25653
- case 5:
25654
- messageListMarker = _context2.v;
25655
- return _context2.a(2, {
25656
- status: 'success',
25657
- messageListMarker: messageListMarker
25658
- });
25659
- case 6:
25660
- _context2.p = 6;
25661
- _t = _context2.v;
25662
- if (shouldKeepQueuedPendingRead(_t)) {
25663
- _context2.n = 7;
25664
- break;
25665
- }
25666
- log.error(_t, '[READ_MESSAGE] Dropping read marker after non-resendable error', compactReadMessageLogData(logContext));
25667
- return _context2.a(2, {
25668
- status: 'drop',
25669
- error: _t
25670
- });
25671
- case 7:
25672
- if (!(attempt === READ_MARKER_RETRY_DELAYS_MS.length)) {
25673
- _context2.n = 8;
25674
- break;
25675
- }
25676
- log.error(_t, '[READ_MESSAGE] Exhausted read marker retries; keeping queued for replay', compactReadMessageLogData(_extends({}, logContext, {
25677
- attempts: attempt + 1
25678
- })));
25679
- return _context2.a(2, {
25680
- status: 'queued',
25681
- error: _t
25682
- });
25683
- case 8:
25684
- log.warn(_t, "[READ_MESSAGE] Retrying read marker (" + (attempt + 1) + "/" + READ_MARKER_RETRY_DELAYS_MS.length + ")", compactReadMessageLogData(_extends({}, logContext, {
25685
- retryDelayMs: READ_MARKER_RETRY_DELAYS_MS[attempt]
25686
- })));
25687
- _context2.n = 9;
25688
- return effects.call(waitForReadMarkerRetry, READ_MARKER_RETRY_DELAYS_MS[attempt]);
25689
- case 9:
25690
- attempt++;
25691
- _context2.n = 1;
25825
+ function confirmDisplayedRead(channel, pendingRead) {
25826
+ var messageIds, attempt, connectionStatus, messageListMarker, _t;
25827
+ return _regenerator().w(function (_context2) {
25828
+ while (1) switch (_context2.p = _context2.n) {
25829
+ case 0:
25830
+ messageIds = getUniqueMessageIds(pendingRead.messageIds);
25831
+ attempt = 0;
25832
+ case 1:
25833
+ if (!(attempt <= READ_MARKER_RETRY_DELAYS_MS.length)) {
25834
+ _context2.n = 10;
25692
25835
  break;
25693
- case 10:
25694
- return _context2.a(2, {
25695
- status: 'queued'
25696
- });
25697
- }
25698
- }, _callee, null, [[2, 6]]);
25699
- })();
25836
+ }
25837
+ connectionStatus = store.getState().UserReducer.connectionStatus;
25838
+ if (!(connectionStatus !== CONNECTION_STATUS.CONNECTED)) {
25839
+ _context2.n = 2;
25840
+ break;
25841
+ }
25842
+ return _context2.a(2, {
25843
+ status: 'queued'
25844
+ });
25845
+ case 2:
25846
+ _context2.p = 2;
25847
+ if (!pendingRead.readAll) {
25848
+ _context2.n = 4;
25849
+ break;
25850
+ }
25851
+ _context2.n = 3;
25852
+ return effects.call(channel.markAsRead);
25853
+ case 3:
25854
+ return _context2.a(2, {
25855
+ status: 'success'
25856
+ });
25857
+ case 4:
25858
+ _context2.n = 5;
25859
+ return effects.call(channel.markMessagesAsDisplayed, messageIds);
25860
+ case 5:
25861
+ messageListMarker = _context2.v;
25862
+ return _context2.a(2, {
25863
+ status: 'success',
25864
+ messageListMarker: messageListMarker
25865
+ });
25866
+ case 6:
25867
+ _context2.p = 6;
25868
+ _t = _context2.v;
25869
+ if (shouldKeepQueuedPendingRead(_t)) {
25870
+ _context2.n = 7;
25871
+ break;
25872
+ }
25873
+ return _context2.a(2, {
25874
+ status: 'drop',
25875
+ error: _t
25876
+ });
25877
+ case 7:
25878
+ if (!(attempt === READ_MARKER_RETRY_DELAYS_MS.length)) {
25879
+ _context2.n = 8;
25880
+ break;
25881
+ }
25882
+ return _context2.a(2, {
25883
+ status: 'queued',
25884
+ error: _t
25885
+ });
25886
+ case 8:
25887
+ _context2.n = 9;
25888
+ return effects.call(waitForReadMarkerRetry, READ_MARKER_RETRY_DELAYS_MS[attempt]);
25889
+ case 9:
25890
+ attempt++;
25891
+ _context2.n = 1;
25892
+ break;
25893
+ case 10:
25894
+ return _context2.a(2, {
25895
+ status: 'queued'
25896
+ });
25897
+ }
25898
+ }, _marked2$3, null, [[2, 6]]);
25700
25899
  }
25701
25900
  function createChannel(action) {
25702
25901
  var payload, channelData, dontCreateIfNotExists, callback, SceytChatClient, createChannelData, fileToUpload, isSelfChannel, channelIsExistOnAllChannels, createdChannel, allChannels, memberId, whoDoesNotAdded, checkChannelExist, messageToSend, _allChannels, _memberId, _t2;
@@ -25894,7 +26093,7 @@ function createChannel(action) {
25894
26093
  case 19:
25895
26094
  return _context3.a(2);
25896
26095
  }
25897
- }, _marked2$3, null, [[0, 18]]);
26096
+ }, _marked3$2, null, [[0, 18]]);
25898
26097
  }
25899
26098
  function getChannels(action) {
25900
26099
  var _params$filter, _types, _activeChannel, _mappedChannels, _mappedChannels3, _mappedChannels4, payload, params, SceytChatClient, connectionStatus, channelQueryBuilder, channelTypesFilter, types, limit, channelQuery, channelsData, channelList, channelId, activeChannel, pendingLastMessages, _yield$call, mappedChannels, channelsForUpdateLastReactionMessage, _loop, _i, _Object$keys, _Object$keys2, _Object$keys3, _mappedChannels2, channelMessageMap, _iterator, _step, _lastMsg$userMarkers, ch, lastMsg, _activeChannel2, _activeChannel3, hiddenList, allChannelsQueryBuilder, allChannelsQuery, hasNext, totalAllChannelsAdded, i, _connectionStatus, allChannelsData, allChannelList, _t3, _t4, _t5;
@@ -25992,7 +26191,7 @@ function getChannels(action) {
25992
26191
  _yield$call = _context5.v;
25993
26192
  mappedChannels = _yield$call.channels;
25994
26193
  channelsForUpdateLastReactionMessage = _yield$call.channelsForUpdateLastReactionMessage;
25995
- _loop = /*#__PURE__*/_regenerator().m(function _callee2() {
26194
+ _loop = /*#__PURE__*/_regenerator().m(function _callee() {
25996
26195
  var _store$getState$Chann;
25997
26196
  var channelId, pendingLastMessage, currentReduxLastMessage, resolvedLastMessage, mappedChannel, mapEntry;
25998
26197
  return _regenerator().w(function (_context4) {
@@ -26019,7 +26218,7 @@ function getChannels(action) {
26019
26218
  case 1:
26020
26219
  return _context4.a(2);
26021
26220
  }
26022
- }, _callee2);
26221
+ }, _callee);
26023
26222
  });
26024
26223
  _i = 0, _Object$keys = Object.keys(pendingLastMessages);
26025
26224
  case 14:
@@ -26213,7 +26412,7 @@ function getChannels(action) {
26213
26412
  case 38:
26214
26413
  return _context5.a(2);
26215
26414
  }
26216
- }, _marked3$2, null, [[27, 30], [1, 37]]);
26415
+ }, _marked4$2, null, [[27, 30], [1, 37]]);
26217
26416
  }
26218
26417
  function searchChannels(action) {
26219
26418
  var payload, params, contactsMap, SceytChatClient, getFromContacts, searchBy, _params$filter2, _types2, channelQueryBuilder, channelTypesFilter, types, allChannels, publicChannels, chatsGroups, contactsList, contactsWithChannelsMap, lowerCaseSearchBy, handleChannels, channelsMap, _iterator2, _step2, channel, channelQuery, channelsData, _iterator3, _step3, _channel, channelsToAdd, _t6;
@@ -26346,7 +26545,7 @@ function searchChannels(action) {
26346
26545
  case 8:
26347
26546
  return _context6.a(2);
26348
26547
  }
26349
- }, _marked4$2, null, [[0, 7]]);
26548
+ }, _marked5$2, null, [[0, 7]]);
26350
26549
  }
26351
26550
  function getChannelsForForward() {
26352
26551
  var _SceytChatClient, channelQueryBuilder, channelTypesFilter, channelQuery, channelsData, channelsToAdd, _yield$call2, mappedChannels, _t7;
@@ -26404,7 +26603,7 @@ function getChannelsForForward() {
26404
26603
  case 9:
26405
26604
  return _context7.a(2);
26406
26605
  }
26407
- }, _marked5$2, null, [[0, 8]]);
26606
+ }, _marked6$2, null, [[0, 8]]);
26408
26607
  }
26409
26608
  function searchChannelsForForward(action) {
26410
26609
  var payload, params, _contactsMap, _SceytChatClient2, _getFromContacts, searchBy, _params$filter3, _types3, channelQueryBuilder, channelTypesFilter, types, allChannels, _publicChannels, _chatsGroups, contactsList, _contactsWithChannelsMap, _lowerCaseSearchBy, handleChannels, channelsMap, _iterator4, _step4, channel, channelQuery, channelsData, _iterator5, _step5, _channel2, channelsToAdd, _t8;
@@ -26536,7 +26735,7 @@ function searchChannelsForForward(action) {
26536
26735
  case 8:
26537
26736
  return _context8.a(2);
26538
26737
  }
26539
- }, _marked6$2, null, [[0, 7]]);
26738
+ }, _marked7$2, null, [[0, 7]]);
26540
26739
  }
26541
26740
  function channelsLoadMore(action) {
26542
26741
  var _mappedChannels5, _mappedChannels7, _mappedChannels8, payload, limit, channelQuery, channelsData, channelList, _yield$call3, mappedChannels, channelsForUpdateLastReactionMessage, _Object$keys4, _mappedChannels6, channelMessageMap, _t9;
@@ -26657,7 +26856,7 @@ function channelsLoadMore(action) {
26657
26856
  case 13:
26658
26857
  return _context9.a(2);
26659
26858
  }
26660
- }, _marked7$2, null, [[1, 12]]);
26859
+ }, _marked8$2, null, [[1, 12]]);
26661
26860
  }
26662
26861
  function getChannelMentions(action) {
26663
26862
  var payload, channelId, _SceytChatClient3, mentionsQueryBuilder, mentionsQuery, mentions, _t0;
@@ -26694,7 +26893,7 @@ function getChannelMentions(action) {
26694
26893
  case 5:
26695
26894
  return _context0.a(2);
26696
26895
  }
26697
- }, _marked8$2, null, [[0, 4]]);
26896
+ }, _marked9$2, null, [[0, 4]]);
26698
26897
  }
26699
26898
  function channelsForForwardLoadMore(action) {
26700
26899
  var payload, limit, _SceytChatClient4, channelQueryForward, channelsData, channelsToAdd, _yield$call4, mappedChannels, _t1;
@@ -26745,10 +26944,10 @@ function channelsForForwardLoadMore(action) {
26745
26944
  case 8:
26746
26945
  return _context1.a(2);
26747
26946
  }
26748
- }, _marked9$2, null, [[0, 7]]);
26947
+ }, _marked0$2, null, [[0, 7]]);
26749
26948
  }
26750
26949
  function markMessagesRead(action) {
26751
- var payload, channelId, messageIds, requestedMessageIds, _confirmation$message, channel, optimisticUpdate, pendingRead, confirmation, queuedPendingRead, _queuedPendingRead, readMessageIds, _iterator6, _step6, _confirmation$message2, _confirmation$message3, messageId, updateParams, _t10;
26950
+ var payload, channelId, messageIds, requestedMessageIds, _confirmation$message, channel, optimisticUpdate, pendingRead, confirmation, queuedPendingRead, _queuedPendingRead, readMessageIds, _iterator6, _step6, _confirmation$message2, _confirmation$message3, messageId, updateParams;
26752
26951
  return _regenerator().w(function (_context10) {
26753
26952
  while (1) switch (_context10.p = _context10.n) {
26754
26953
  case 0:
@@ -26759,21 +26958,9 @@ function markMessagesRead(action) {
26759
26958
  _context10.n = 1;
26760
26959
  break;
26761
26960
  }
26762
- log.warn('[READ_MESSAGE] Skipping read marker because message id list is empty', compactReadMessageLogData({
26763
- source: 'initial',
26764
- channelId: channelId,
26765
- readAll: false,
26766
- messageIds: messageIds
26767
- }));
26768
26961
  return _context10.a(2);
26769
26962
  case 1:
26770
26963
  _context10.p = 1;
26771
- log.info('[READ_MESSAGE] Received markMessagesRead action', compactReadMessageLogData({
26772
- source: 'initial',
26773
- channelId: channelId,
26774
- readAll: false,
26775
- messageIds: requestedMessageIds
26776
- }));
26777
26964
  _context10.n = 2;
26778
26965
  return effects.call(getStoredChannel$2, channelId);
26779
26966
  case 2:
@@ -26782,10 +26969,6 @@ function markMessagesRead(action) {
26782
26969
  _context10.n = 3;
26783
26970
  break;
26784
26971
  }
26785
- log.warn('[READ_MESSAGE] Cannot mark messages as read because channel was not found', compactReadMessageLogData({
26786
- channelId: channelId,
26787
- messageIds: requestedMessageIds
26788
- }));
26789
26972
  return _context10.a(2);
26790
26973
  case 3:
26791
26974
  optimisticUpdate = deriveChannelReadProgressUpdate({
@@ -26800,7 +26983,7 @@ function markMessagesRead(action) {
26800
26983
  messageIds: requestedMessageIds
26801
26984
  });
26802
26985
  _context10.n = 5;
26803
- return effects.call(confirmDisplayedRead, channel, pendingRead, 'initial');
26986
+ return effects.call(confirmDisplayedRead, channel, pendingRead);
26804
26987
  case 5:
26805
26988
  confirmation = _context10.v;
26806
26989
  if (!(confirmation.status === 'success')) {
@@ -26827,13 +27010,6 @@ function markMessagesRead(action) {
26827
27010
  return _context10.a(2);
26828
27011
  case 8:
26829
27012
  readMessageIds = getUniqueMessageIds(((_confirmation$message = confirmation.messageListMarker) === null || _confirmation$message === void 0 ? void 0 : _confirmation$message.messageIds) || requestedMessageIds);
26830
- log.info('[READ_MESSAGE] Confirmed read marker', compactReadMessageLogData({
26831
- source: 'initial',
26832
- channelId: channel.id,
26833
- readAll: false,
26834
- requestedMessageIds: requestedMessageIds,
26835
- confirmedMessageIds: readMessageIds
26836
- }));
26837
27013
  _iterator6 = _createForOfIteratorHelperLoose(readMessageIds);
26838
27014
  case 9:
26839
27015
  if ((_step6 = _iterator6()).done) {
@@ -26865,12 +27041,10 @@ function markMessagesRead(action) {
26865
27041
  break;
26866
27042
  case 13:
26867
27043
  _context10.p = 13;
26868
- _t10 = _context10.v;
26869
- log.error(_t10, '[READ_MESSAGE] Error on mark messages read');
26870
27044
  case 14:
26871
27045
  return _context10.a(2);
26872
27046
  }
26873
- }, _marked0$2, null, [[1, 13]]);
27047
+ }, _marked1$1, null, [[1, 13]]);
26874
27048
  }
26875
27049
  function markVoiceMessageAsPlayed(action) {
26876
27050
  var payload, channelId, messageIds, connectionStatus, channel, messageListMarker, _iterator7, _step7, messageId, updateParams, _t11;
@@ -26941,7 +27115,7 @@ function markVoiceMessageAsPlayed(action) {
26941
27115
  case 9:
26942
27116
  return _context11.a(2);
26943
27117
  }
26944
- }, _marked1$1, null, [[1, 8]]);
27118
+ }, _marked10$1, null, [[1, 8]]);
26945
27119
  }
26946
27120
  function updateMessageAsOpened(action) {
26947
27121
  var payload, channelId, messageListMarker, connectionStatus, channel, _iterator8, _step8, messageId, updateParams;
@@ -27000,7 +27174,7 @@ function updateMessageAsOpened(action) {
27000
27174
  case 6:
27001
27175
  return _context12.a(2);
27002
27176
  }
27003
- }, _marked10$1);
27177
+ }, _marked11$1);
27004
27178
  }
27005
27179
  function markMessageAsOpened(action) {
27006
27180
  var payload, channelId, messageIds, shouldUpdateMessage, connectionStatus, channel, messageListMarker, _t12;
@@ -27051,7 +27225,7 @@ function markMessageAsOpened(action) {
27051
27225
  case 6:
27052
27226
  return _context13.a(2);
27053
27227
  }
27054
- }, _marked11$1, null, [[1, 5]]);
27228
+ }, _marked12$1, null, [[1, 5]]);
27055
27229
  }
27056
27230
  function markMessagesDelivered(action) {
27057
27231
  var payload, channelId, messageIds, connectionStatus, channel, messageListMarker, _iterator9, _step9, messageId, updateParams, _t13;
@@ -27122,7 +27296,7 @@ function markMessagesDelivered(action) {
27122
27296
  case 9:
27123
27297
  return _context14.a(2);
27124
27298
  }
27125
- }, _marked12$1, null, [[1, 8]]);
27299
+ }, _marked13$1, null, [[1, 8]]);
27126
27300
  }
27127
27301
  function switchChannel(action) {
27128
27302
  var payload, channel, updateActiveChannel, channelToSwitch, existingChannel, addChannel, _SceytChatClient5, fetchedChannel, channelFromMap, currentActiveChannel, _t14;
@@ -27218,7 +27392,7 @@ function switchChannel(action) {
27218
27392
  case 17:
27219
27393
  return _context15.a(2);
27220
27394
  }
27221
- }, _marked13$1, null, [[0, 16]]);
27395
+ }, _marked14$1, null, [[0, 16]]);
27222
27396
  }
27223
27397
  function notificationsTurnOff(action) {
27224
27398
  var expireTime, activeChannelId, channel, updatedChannel, _t15;
@@ -27258,7 +27432,7 @@ function notificationsTurnOff(action) {
27258
27432
  case 7:
27259
27433
  return _context16.a(2);
27260
27434
  }
27261
- }, _marked14$1, null, [[3, 6]]);
27435
+ }, _marked15$1, null, [[3, 6]]);
27262
27436
  }
27263
27437
  function notificationsTurnOn() {
27264
27438
  var activeChannelId, channel, updatedChannel, _t16;
@@ -27297,21 +27471,15 @@ function notificationsTurnOn() {
27297
27471
  case 7:
27298
27472
  return _context17.a(2);
27299
27473
  }
27300
- }, _marked15$1, null, [[3, 6]]);
27474
+ }, _marked16$1, null, [[3, 6]]);
27301
27475
  }
27302
27476
  function markChannelAsRead(action) {
27303
- var channelId, channel, optimisticUpdate, pendingRead, confirmation, queuedPendingRead, _queuedPendingRead2, _t17;
27477
+ var channelId, channel, optimisticUpdate, pendingRead, confirmation, queuedPendingRead, _queuedPendingRead2;
27304
27478
  return _regenerator().w(function (_context18) {
27305
27479
  while (1) switch (_context18.p = _context18.n) {
27306
27480
  case 0:
27307
27481
  _context18.p = 0;
27308
27482
  channelId = action.payload.channelId;
27309
- log.info('[READ_MESSAGE] Received markChannelAsRead action', compactReadMessageLogData({
27310
- source: 'initial',
27311
- channelId: channelId,
27312
- readAll: true,
27313
- messageIds: []
27314
- }));
27315
27483
  _context18.n = 1;
27316
27484
  return effects.call(getStoredChannel$2, channelId);
27317
27485
  case 1:
@@ -27320,9 +27488,6 @@ function markChannelAsRead(action) {
27320
27488
  _context18.n = 2;
27321
27489
  break;
27322
27490
  }
27323
- log.warn('[READ_MESSAGE] Cannot mark channel as read because channel was not found', compactReadMessageLogData({
27324
- channelId: channelId
27325
- }));
27326
27491
  return _context18.a(2);
27327
27492
  case 2:
27328
27493
  optimisticUpdate = deriveChannelReadProgressUpdate({
@@ -27337,7 +27502,7 @@ function markChannelAsRead(action) {
27337
27502
  readAll: true
27338
27503
  });
27339
27504
  _context18.n = 4;
27340
- return effects.call(confirmDisplayedRead, channel, pendingRead, 'initial');
27505
+ return effects.call(confirmDisplayedRead, channel, pendingRead);
27341
27506
  case 4:
27342
27507
  confirmation = _context18.v;
27343
27508
  if (!(confirmation.status === 'success')) {
@@ -27348,13 +27513,6 @@ function markChannelAsRead(action) {
27348
27513
  if ((queuedPendingRead === null || queuedPendingRead === void 0 ? void 0 : queuedPendingRead.queuedAt) === (pendingRead === null || pendingRead === void 0 ? void 0 : pendingRead.queuedAt)) {
27349
27514
  removePendingChannelRead(channel.id);
27350
27515
  }
27351
- log.info('[READ_MESSAGE] Confirmed read marker', compactReadMessageLogData({
27352
- source: 'initial',
27353
- channelId: channel.id,
27354
- readAll: true,
27355
- requestedMessageIds: [],
27356
- confirmedMessageIds: []
27357
- }));
27358
27516
  return _context18.a(2);
27359
27517
  case 5:
27360
27518
  if (confirmation.status === 'drop') {
@@ -27367,15 +27525,13 @@ function markChannelAsRead(action) {
27367
27525
  break;
27368
27526
  case 6:
27369
27527
  _context18.p = 6;
27370
- _t17 = _context18.v;
27371
- log.error(_t17, '[READ_MESSAGE] Error on mark channel as read');
27372
27528
  case 7:
27373
27529
  return _context18.a(2);
27374
27530
  }
27375
- }, _marked16$1, null, [[0, 6]]);
27531
+ }, _marked17$1, null, [[0, 6]]);
27376
27532
  }
27377
27533
  function resendPendingChannelReads(action) {
27378
- var connectionState, pendingReads, _iterator0, _step0, pendingRead, currentPendingRead, channel, confirmation, latestPendingRead, _confirmation$message4, readMessageIds, _iterator1, _step1, _confirmation$message5, _confirmation$message6, messageId, updateParams, _t18;
27534
+ var connectionState, pendingReads, _iterator0, _step0, pendingRead, currentPendingRead, channel, confirmation, latestPendingRead, _confirmation$message4, readMessageIds, _iterator1, _step1, _confirmation$message5, _confirmation$message6, messageId, updateParams;
27379
27535
  return _regenerator().w(function (_context19) {
27380
27536
  while (1) switch (_context19.p = _context19.n) {
27381
27537
  case 0:
@@ -27393,7 +27549,7 @@ function resendPendingChannelReads(action) {
27393
27549
  _iterator0 = _createForOfIteratorHelperLoose(pendingReads);
27394
27550
  case 2:
27395
27551
  if ((_step0 = _iterator0()).done) {
27396
- _context19.n = 16;
27552
+ _context19.n = 14;
27397
27553
  break;
27398
27554
  }
27399
27555
  pendingRead = _step0.value;
@@ -27408,20 +27564,14 @@ function resendPendingChannelReads(action) {
27408
27564
  _context19.n = 4;
27409
27565
  break;
27410
27566
  }
27411
- return _context19.a(3, 15);
27567
+ return _context19.a(3, 13);
27412
27568
  case 4:
27413
27569
  if (!(!pendingRead.readAll && !pendingRead.messageIds.length)) {
27414
27570
  _context19.n = 5;
27415
27571
  break;
27416
27572
  }
27417
- log.warn('[READ_MESSAGE] Dropping queued replay because it has no message ids', compactReadMessageLogData({
27418
- source: 'replay',
27419
- channelId: pendingRead.channelId,
27420
- readAll: pendingRead.readAll,
27421
- messageIds: pendingRead.messageIds
27422
- }));
27423
27573
  removePendingChannelRead(pendingRead.channelId);
27424
- return _context19.a(3, 15);
27574
+ return _context19.a(3, 13);
27425
27575
  case 5:
27426
27576
  _context19.n = 6;
27427
27577
  return effects.call(getStoredChannel$2, pendingRead.channelId);
@@ -27431,18 +27581,11 @@ function resendPendingChannelReads(action) {
27431
27581
  _context19.n = 7;
27432
27582
  break;
27433
27583
  }
27434
- log.warn('[READ_MESSAGE] Dropping queued replay because channel was not found', compactReadMessageLogData({
27435
- source: 'replay',
27436
- channelId: pendingRead.channelId,
27437
- readAll: pendingRead.readAll,
27438
- messageIds: pendingRead.messageIds
27439
- }));
27440
27584
  removePendingChannelRead(pendingRead.channelId);
27441
- return _context19.a(3, 15);
27585
+ return _context19.a(3, 13);
27442
27586
  case 7:
27443
- log.info('[READ_MESSAGE] Replaying queued read marker', compactReadMessageLogData(getReadMarkerLogContext(pendingRead, 'replay', pendingRead.messageIds)));
27444
27587
  _context19.n = 8;
27445
- return effects.call(confirmDisplayedRead, channel, pendingRead, 'replay');
27588
+ return effects.call(confirmDisplayedRead, channel, pendingRead);
27446
27589
  case 8:
27447
27590
  confirmation = _context19.v;
27448
27591
  latestPendingRead = getPendingChannelRead(pendingRead.channelId);
@@ -27450,23 +27593,16 @@ function resendPendingChannelReads(action) {
27450
27593
  _context19.n = 9;
27451
27594
  break;
27452
27595
  }
27453
- return _context19.a(3, 15);
27596
+ return _context19.a(3, 13);
27454
27597
  case 9:
27455
27598
  if (confirmation.status === 'success' || confirmation.status === 'drop') {
27456
27599
  removePendingChannelRead(pendingRead.channelId);
27457
27600
  }
27458
27601
  if (!(confirmation.status === 'success' && !pendingRead.readAll)) {
27459
- _context19.n = 14;
27602
+ _context19.n = 13;
27460
27603
  break;
27461
27604
  }
27462
27605
  readMessageIds = getUniqueMessageIds(((_confirmation$message4 = confirmation.messageListMarker) === null || _confirmation$message4 === void 0 ? void 0 : _confirmation$message4.messageIds) || pendingRead.messageIds);
27463
- log.info('[READ_MESSAGE] Confirmed read marker', compactReadMessageLogData({
27464
- source: 'replay',
27465
- channelId: channel.id,
27466
- readAll: false,
27467
- requestedMessageIds: pendingRead.messageIds,
27468
- confirmedMessageIds: readMessageIds
27469
- }));
27470
27606
  _iterator1 = _createForOfIteratorHelperLoose(readMessageIds);
27471
27607
  case 10:
27472
27608
  if ((_step1 = _iterator1()).done) {
@@ -27494,32 +27630,17 @@ function resendPendingChannelReads(action) {
27494
27630
  _context19.n = 10;
27495
27631
  break;
27496
27632
  case 13:
27497
- _context19.n = 15;
27633
+ _context19.n = 2;
27498
27634
  break;
27499
27635
  case 14:
27500
- if (confirmation.status === 'success' && pendingRead.readAll) {
27501
- log.info('[READ_MESSAGE] Confirmed read marker', compactReadMessageLogData({
27502
- source: 'replay',
27503
- channelId: channel.id,
27504
- readAll: true,
27505
- requestedMessageIds: [],
27506
- confirmedMessageIds: []
27507
- }));
27508
- }
27509
- case 15:
27510
- _context19.n = 2;
27636
+ _context19.n = 16;
27511
27637
  break;
27638
+ case 15:
27639
+ _context19.p = 15;
27512
27640
  case 16:
27513
- _context19.n = 18;
27514
- break;
27515
- case 17:
27516
- _context19.p = 17;
27517
- _t18 = _context19.v;
27518
- log.error(_t18, '[READ_MESSAGE] Error on resend pending channel reads');
27519
- case 18:
27520
27641
  return _context19.a(2);
27521
27642
  }
27522
- }, _marked17$1, null, [[0, 17]]);
27643
+ }, _marked18$1, null, [[0, 15]]);
27523
27644
  }
27524
27645
  function markChannelAsUnRead(action) {
27525
27646
  var channelId, channel, _t19;
@@ -27555,7 +27676,7 @@ function markChannelAsUnRead(action) {
27555
27676
  case 5:
27556
27677
  return _context20.a(2);
27557
27678
  }
27558
- }, _marked18$1, null, [[0, 4]]);
27679
+ }, _marked19$1, null, [[0, 4]]);
27559
27680
  }
27560
27681
  function pinChannel(action) {
27561
27682
  var channelId, channel, updatedChannel, _t20;
@@ -27592,7 +27713,7 @@ function pinChannel(action) {
27592
27713
  case 5:
27593
27714
  return _context21.a(2);
27594
27715
  }
27595
- }, _marked19$1, null, [[0, 4]]);
27716
+ }, _marked20$1, null, [[0, 4]]);
27596
27717
  }
27597
27718
  function unpinChannel(action) {
27598
27719
  var channelId, channel, updatedChannel, _t21;
@@ -27629,7 +27750,7 @@ function unpinChannel(action) {
27629
27750
  case 5:
27630
27751
  return _context22.a(2);
27631
27752
  }
27632
- }, _marked20$1, null, [[0, 4]]);
27753
+ }, _marked21$1, null, [[0, 4]]);
27633
27754
  }
27634
27755
  function removeChannelCaches(action) {
27635
27756
  var payload, channelId, activeChannelId, activeChannel;
@@ -27664,7 +27785,7 @@ function removeChannelCaches(action) {
27664
27785
  case 4:
27665
27786
  return _context23.a(2);
27666
27787
  }
27667
- }, _marked21$1);
27788
+ }, _marked22$1);
27668
27789
  }
27669
27790
  function leaveChannel(action) {
27670
27791
  var payload, channelId, channel, messageBuilder, messageToSend, _t22;
@@ -27674,49 +27795,56 @@ function leaveChannel(action) {
27674
27795
  _context24.p = 0;
27675
27796
  payload = action.payload;
27676
27797
  channelId = payload.channelId;
27677
- _context24.n = 1;
27678
- return effects.call(getChannelFromMap, channelId);
27798
+ if (!(store.getState().UserReducer.connectionStatus !== CONNECTION_STATUS.CONNECTED)) {
27799
+ _context24.n = 1;
27800
+ break;
27801
+ }
27802
+ log.warn('Cannot leave channel while offline');
27803
+ return _context24.a(2);
27679
27804
  case 1:
27805
+ _context24.n = 2;
27806
+ return effects.call(getChannelFromMap, channelId);
27807
+ case 2:
27680
27808
  channel = _context24.v;
27681
27809
  if (!channel) {
27682
27810
  channel = getChannelFromAllChannels(channelId);
27683
27811
  }
27684
27812
  if (!channel) {
27685
- _context24.n = 5;
27813
+ _context24.n = 6;
27686
27814
  break;
27687
27815
  }
27688
27816
  if (!(channel.type === DEFAULT_CHANNEL_TYPE.GROUP || channel.type === DEFAULT_CHANNEL_TYPE.PRIVATE)) {
27689
- _context24.n = 2;
27817
+ _context24.n = 3;
27690
27818
  break;
27691
27819
  }
27692
27820
  messageBuilder = channel.createMessageBuilder();
27693
27821
  messageBuilder.setBody('LG').setType('system').setDisplayCount(0).setSilent(true);
27694
27822
  messageToSend = messageBuilder.create();
27695
27823
  log.info('send message for left');
27696
- _context24.n = 2;
27697
- return effects.call(channel.sendMessage, messageToSend);
27698
- case 2:
27699
- log.info('leave');
27700
27824
  _context24.n = 3;
27701
- return effects.call(channel.leave);
27825
+ return effects.call(channel.sendMessage, messageToSend);
27702
27826
  case 3:
27827
+ log.info('leave');
27703
27828
  _context24.n = 4;
27704
- return effects.put(removeChannelAC(channelId));
27829
+ return effects.call(channel.leave);
27705
27830
  case 4:
27706
- deleteChannelFromAllChannels(channelId);
27707
27831
  _context24.n = 5;
27708
- return effects.put(removeChannelCachesAC(channelId));
27832
+ return effects.put(removeChannelAC(channelId));
27709
27833
  case 5:
27710
- _context24.n = 7;
27711
- break;
27834
+ deleteChannelFromAllChannels(channelId);
27835
+ _context24.n = 6;
27836
+ return effects.put(removeChannelCachesAC(channelId));
27712
27837
  case 6:
27713
- _context24.p = 6;
27838
+ _context24.n = 8;
27839
+ break;
27840
+ case 7:
27841
+ _context24.p = 7;
27714
27842
  _t22 = _context24.v;
27715
27843
  log.error('ERROR in leave channel - ', _t22.message);
27716
- case 7:
27844
+ case 8:
27717
27845
  return _context24.a(2);
27718
27846
  }
27719
- }, _marked22$1, null, [[0, 6]]);
27847
+ }, _marked23$1, null, [[0, 7]]);
27720
27848
  }
27721
27849
  function deletePendingDeleteChannels() {
27722
27850
  var pendingDeleteChannels, _iterator10, _step10, channel, resendableError, _t23;
@@ -27760,7 +27888,7 @@ function deletePendingDeleteChannels() {
27760
27888
  case 9:
27761
27889
  return _context25.a(2);
27762
27890
  }
27763
- }, _marked23$1, null, [[2, 7]]);
27891
+ }, _marked24$1, null, [[2, 7]]);
27764
27892
  }
27765
27893
  function deleteChannel(action) {
27766
27894
  var payload, channelId, channel, activeChannelId, lastChannel, _t24;
@@ -27854,7 +27982,7 @@ function deleteChannel(action) {
27854
27982
  case 19:
27855
27983
  return _context26.a(2);
27856
27984
  }
27857
- }, _marked24$1, null, [[0, 18]]);
27985
+ }, _marked25$1, null, [[0, 18]]);
27858
27986
  }
27859
27987
  function blockChannel(action) {
27860
27988
  var payload, channelId, channel, _t25;
@@ -27893,7 +28021,7 @@ function blockChannel(action) {
27893
28021
  case 6:
27894
28022
  return _context27.a(2);
27895
28023
  }
27896
- }, _marked25$1, null, [[0, 5]]);
28024
+ }, _marked26$1, null, [[0, 5]]);
27897
28025
  }
27898
28026
  function updateChannel(action) {
27899
28027
  var payload, channelId, config, _SceytChatClient6, channel, paramsToUpdate, fileToUpload, _yield$call5, subject, avatarUrl, metadata, onUpdateChannel, _channel3, _channel4, _channel5, fields, updatedChannel, _t26;
@@ -27990,7 +28118,7 @@ function updateChannel(action) {
27990
28118
  case 9:
27991
28119
  return _context28.a(2);
27992
28120
  }
27993
- }, _marked26$1, null, [[0, 8]]);
28121
+ }, _marked27$1, null, [[0, 8]]);
27994
28122
  }
27995
28123
  function checkUsersStatus() {
27996
28124
  var _SceytChatClient7, usersForUpdate, updatedUsers, usersToUpdateMap, update, updateData, _t27;
@@ -28041,7 +28169,7 @@ function checkUsersStatus() {
28041
28169
  case 7:
28042
28170
  return _context29.a(2);
28043
28171
  }
28044
- }, _marked27$1, null, [[0, 6]]);
28172
+ }, _marked28$1, null, [[0, 6]]);
28045
28173
  }
28046
28174
  function sendTyping(action) {
28047
28175
  var state, activeChannelId, channel, _t28;
@@ -28084,7 +28212,7 @@ function sendTyping(action) {
28084
28212
  case 8:
28085
28213
  return _context30.a(2);
28086
28214
  }
28087
- }, _marked28$1, null, [[3, 7]]);
28215
+ }, _marked29$1, null, [[3, 7]]);
28088
28216
  }
28089
28217
  function sendRecording(action) {
28090
28218
  var _action$payload, state, channelId, channel, _t29;
@@ -28127,7 +28255,7 @@ function sendRecording(action) {
28127
28255
  case 7:
28128
28256
  return _context31.a(2);
28129
28257
  }
28130
- }, _marked29$1, null, [[2, 6]]);
28258
+ }, _marked30$1, null, [[2, 6]]);
28131
28259
  }
28132
28260
  function clearHistory(action) {
28133
28261
  var payload, channelId, channel, activeChannelId, groupName, _t30;
@@ -28197,7 +28325,7 @@ function clearHistory(action) {
28197
28325
  case 10:
28198
28326
  return _context32.a(2);
28199
28327
  }
28200
- }, _marked30$1, null, [[0, 9]]);
28328
+ }, _marked31$1, null, [[0, 9]]);
28201
28329
  }
28202
28330
  function deleteAllMessages(action) {
28203
28331
  var payload, channelId, channel, activeChannelId, groupName, _t31;
@@ -28270,7 +28398,7 @@ function deleteAllMessages(action) {
28270
28398
  case 11:
28271
28399
  return _context33.a(2);
28272
28400
  }
28273
- }, _marked31$1, null, [[0, 10]]);
28401
+ }, _marked32$1, null, [[0, 10]]);
28274
28402
  }
28275
28403
  function joinChannel(action) {
28276
28404
  var payload, channelId, _SceytChatClient8, channel, joinedChannel, _t32;
@@ -28323,7 +28451,7 @@ function joinChannel(action) {
28323
28451
  case 10:
28324
28452
  return _context34.a(2);
28325
28453
  }
28326
- }, _marked32$1, null, [[0, 9]]);
28454
+ }, _marked33$1, null, [[0, 9]]);
28327
28455
  }
28328
28456
  function watchForChannelEvents() {
28329
28457
  return _regenerator().w(function (_context35) {
@@ -28334,7 +28462,7 @@ function watchForChannelEvents() {
28334
28462
  case 1:
28335
28463
  return _context35.a(2);
28336
28464
  }
28337
- }, _marked33$1);
28465
+ }, _marked34$1);
28338
28466
  }
28339
28467
  function createChannelInviteKey(action) {
28340
28468
  var payload, channelId, _SceytChatClient9, channel, inviteKey, _t33;
@@ -28376,7 +28504,7 @@ function createChannelInviteKey(action) {
28376
28504
  case 5:
28377
28505
  return _context36.a(2);
28378
28506
  }
28379
- }, _marked34$1, null, [[0, 4]]);
28507
+ }, _marked35$1, null, [[0, 4]]);
28380
28508
  }
28381
28509
  function getChannelInviteKeys(action) {
28382
28510
  var payload, channelId, channel, inviteKeys, _t34;
@@ -28413,7 +28541,7 @@ function getChannelInviteKeys(action) {
28413
28541
  case 5:
28414
28542
  return _context37.a(2);
28415
28543
  }
28416
- }, _marked35$1, null, [[0, 4]]);
28544
+ }, _marked36$1, null, [[0, 4]]);
28417
28545
  }
28418
28546
  function regenerateChannelInviteKey(action) {
28419
28547
  var payload, channelId, key, deletePermanently, channel, inviteKey, _t35;
@@ -28454,7 +28582,7 @@ function regenerateChannelInviteKey(action) {
28454
28582
  case 5:
28455
28583
  return _context38.a(2);
28456
28584
  }
28457
- }, _marked36$1, null, [[0, 4]]);
28585
+ }, _marked37$1, null, [[0, 4]]);
28458
28586
  }
28459
28587
  function updateChannelInviteKey(action) {
28460
28588
  var channelInviteKeys, channelId, payload, payloadChannelId, key, accessPriorHistory, expiresAt, maxUses, channel, copiedChannelInviteKeys, _t36;
@@ -28514,7 +28642,7 @@ function updateChannelInviteKey(action) {
28514
28642
  case 6:
28515
28643
  return _context39.a(2);
28516
28644
  }
28517
- }, _marked37$1, null, [[1, 5]]);
28645
+ }, _marked38$1, null, [[1, 5]]);
28518
28646
  }
28519
28647
  function getChannelByInviteKey(action) {
28520
28648
  var _channel$, _channel$2, payload, key, _SceytChatClient0, channel, _t37;
@@ -28565,7 +28693,7 @@ function getChannelByInviteKey(action) {
28565
28693
  case 8:
28566
28694
  return _context40.a(2);
28567
28695
  }
28568
- }, _marked38$1, null, [[0, 6]]);
28696
+ }, _marked39$1, null, [[0, 6]]);
28569
28697
  }
28570
28698
  function joinChannelWithInviteKey(action) {
28571
28699
  var payload, key, _SceytChatClient1, user, channel, messageToSend, _t38;
@@ -28609,7 +28737,7 @@ function joinChannelWithInviteKey(action) {
28609
28737
  case 7:
28610
28738
  return _context41.a(2);
28611
28739
  }
28612
- }, _marked39$1, null, [[0, 6]]);
28740
+ }, _marked40$1, null, [[0, 6]]);
28613
28741
  }
28614
28742
  function setMessageRetentionPeriod(action) {
28615
28743
  var payload, channelId, periodInMilliseconds, channel, messageToSend, _t39;
@@ -28662,7 +28790,7 @@ function setMessageRetentionPeriod(action) {
28662
28790
  case 6:
28663
28791
  return _context42.a(2);
28664
28792
  }
28665
- }, _marked40$1, null, [[0, 5]]);
28793
+ }, _marked41$1, null, [[0, 5]]);
28666
28794
  }
28667
28795
  function getChannelsWithUser(action) {
28668
28796
  var payload, userId, _SceytChatClient10, channelsQueryBuilder, channelsQuery, channelsData, channels, _t40;
@@ -28725,7 +28853,7 @@ function getChannelsWithUser(action) {
28725
28853
  case 12:
28726
28854
  return _context43.a(2);
28727
28855
  }
28728
- }, _marked41$1, null, [[2, 9, 10, 12]]);
28856
+ }, _marked42$1, null, [[2, 9, 10, 12]]);
28729
28857
  }
28730
28858
  function loadMoreMutualChannels(action) {
28731
28859
  var payload, limit, mutualChannelsQuery, channelsData, _t41;
@@ -28783,7 +28911,7 @@ function loadMoreMutualChannels(action) {
28783
28911
  case 11:
28784
28912
  return _context44.a(2);
28785
28913
  }
28786
- }, _marked42$1, null, [[1, 8, 9, 11]]);
28914
+ }, _marked43$1, null, [[1, 8, 9, 11]]);
28787
28915
  }
28788
28916
  function ChannelsSaga() {
28789
28917
  return _regenerator().w(function (_context45) {
@@ -28917,7 +29045,7 @@ function ChannelsSaga() {
28917
29045
  case 42:
28918
29046
  return _context45.a(2);
28919
29047
  }
28920
- }, _marked43$1);
29048
+ }, _marked44$1);
28921
29049
  }
28922
29050
 
28923
29051
  var _marked$4 = /*#__PURE__*/_regenerator().m(getMembers),
@@ -30914,7 +31042,9 @@ var SceytChat = function SceytChat(_ref) {
30914
31042
  if (client) {
30915
31043
  cleanupOldAttachmentCache();
30916
31044
  if (client.user && client.user.id) {
30917
- initMessagesIdbForUser(client.user.id);
31045
+ initMessagesIdbForUser(client.user.id).then(function () {
31046
+ return hydrateDraftMessages();
31047
+ });
30918
31048
  }
30919
31049
  setClient(client);
30920
31050
  setSceytChatClient(client);
@@ -30925,6 +31055,8 @@ var SceytChat = function SceytChat(_ref) {
30925
31055
  setActiveChannelId('');
30926
31056
  destroyChannelsMap();
30927
31057
  clearUsersMap();
31058
+ clearDraftMessagesMap();
31059
+ clearPersistedDrafts();
30928
31060
  releaseAllBlobUrls();
30929
31061
  dispatch(destroySession());
30930
31062
  }
@@ -31579,6 +31711,7 @@ var LastMessageAttachments = function LastMessageAttachments(_ref) {
31579
31711
  return !!(lastMessage.attachments && lastMessage.attachments.length || lastMessage !== null && lastMessage !== void 0 && lastMessage.pollDetails && (lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.type) === exports.MESSAGE_TYPE.POLL) && (lastMessage !== null && lastMessage !== void 0 && lastMessage.pollDetails && (lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.type) === exports.MESSAGE_TYPE.POLL ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(SvgPoll, null), lastMessage.body ? '' : 'Poll')) : lastMessage.attachments[0].type === attachmentTypes.image ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, isViewOnce ? /*#__PURE__*/React__default.createElement(SvgViewOnceLastMessage, null) : /*#__PURE__*/React__default.createElement(SvgPicture, null), lastMessage.body && !isViewOnce ? '' : 'Photo')) : lastMessage.attachments[0].type === attachmentTypes.video ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, isViewOnce ? /*#__PURE__*/React__default.createElement(SvgViewOnceLastMessage, null) : /*#__PURE__*/React__default.createElement(SvgVideoCall, null), lastMessage.body && !isViewOnce ? '' : 'Video')) : lastMessage.attachments[0].type === attachmentTypes.file ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(SvgChoseFile, null), lastMessage.body ? '' : 'File')) : lastMessage.attachments[0].type === attachmentTypes.voice ? (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, isViewOnce ? /*#__PURE__*/React__default.createElement(SvgViewOnceLastMessage, null) : /*#__PURE__*/React__default.createElement(SvgVoiceIcon, null), lastMessage.body && !isViewOnce ? '' : 'Voice')) : null);
31580
31712
  };
31581
31713
  var ChannelMessageText = function ChannelMessageText(_ref2) {
31714
+ var _lastMessage$attachme, _lastMessage$attachme2, _lastMessage$attachme3;
31582
31715
  var isTypingOrRecording = _ref2.isTypingOrRecording,
31583
31716
  textPrimary = _ref2.textPrimary,
31584
31717
  textSecondary = _ref2.textSecondary,
@@ -31601,8 +31734,10 @@ var ChannelMessageText = function ChannelMessageText(_ref2) {
31601
31734
  color: textPrimary
31602
31735
  }, ":"), typingOrRecording.isTyping ? 'typing' : 'recording', "...")), !isTypingOrRecording && (draftMessageText ? (/*#__PURE__*/React__default.createElement(DraftMessageText, {
31603
31736
  color: textSecondary
31604
- }, audioRecording && /*#__PURE__*/React__default.createElement(SvgVoiceIcon, null), MessageTextFormat({
31605
- text: draftMessageText,
31737
+ }, !lastMessage.body && (_lastMessage$attachme = lastMessage.attachments) !== null && _lastMessage$attachme !== void 0 && _lastMessage$attachme.length ? LastMessageAttachments({
31738
+ lastMessage: lastMessage
31739
+ }) : null, audioRecording && /*#__PURE__*/React__default.createElement(SvgVoiceIcon, null), (!((_lastMessage$attachme2 = lastMessage.attachments) !== null && _lastMessage$attachme2 !== void 0 && _lastMessage$attachme2.length) || lastMessage.body) && MessageTextFormat({
31740
+ text: (_lastMessage$attachme3 = lastMessage.attachments) !== null && _lastMessage$attachme3 !== void 0 && _lastMessage$attachme3.length ? lastMessage.body : draftMessageText,
31606
31741
  message: lastMessage,
31607
31742
  contactsMap: contactsMap,
31608
31743
  getFromContacts: getFromContacts,
@@ -31691,13 +31826,23 @@ var Channel = function Channel(_ref3) {
31691
31826
  var _useState2 = React.useState(),
31692
31827
  draftMessage = _useState2[0],
31693
31828
  setDraftMessage = _useState2[1];
31829
+ var _useState3 = React.useState(0),
31830
+ draftRevision = _useState3[0],
31831
+ setDraftRevision = _useState3[1];
31832
+ React.useEffect(function () {
31833
+ return subscribeToDraftMessages(function () {
31834
+ return setDraftRevision(function (revision) {
31835
+ return revision + 1;
31836
+ });
31837
+ });
31838
+ }, []);
31694
31839
  var lastMessage = React.useMemo(function () {
31695
31840
  return channel.lastReactedMessage || channel.lastMessage;
31696
31841
  }, [channel.lastReactedMessage, channel.lastMessage]);
31697
31842
  var lastMessageMetas = lastMessage && lastMessage.type === exports.MESSAGE_TYPE.SYSTEM && lastMessage.metadata && (isJSON(lastMessage.metadata) ? JSON.parse(lastMessage.metadata) : lastMessage.metadata);
31698
- var _useState3 = React.useState(0),
31699
- statusWidth = _useState3[0],
31700
- setStatusWidth = _useState3[1];
31843
+ var _useState4 = React.useState(0),
31844
+ statusWidth = _useState4[0],
31845
+ setStatusWidth = _useState4[1];
31701
31846
  var avatarName = channel.subject || (isDirectChannel && directChannelUser ? directChannelUser.firstName || directChannelUser.id : isSelfChannel ? showPhoneNumber ? "+" + user.id + " (You)" : 'Me' : '');
31702
31847
  var messageAuthorRef = React.useRef(null);
31703
31848
  var messageTimeAndStatusRef = React.useRef(null);
@@ -31713,12 +31858,27 @@ var Channel = function Channel(_ref3) {
31713
31858
  var draftAudioRecording = getAudioRecordingFromMap(channel.id);
31714
31859
  if (channelDraftMessage || draftAudioRecording) {
31715
31860
  if (channelDraftMessage) {
31716
- setDraftMessageText(channelDraftMessage.text);
31717
- setDraftMessage({
31718
- mentionedUsers: channelDraftMessage.mentionedUsers,
31719
- body: channelDraftMessage.text,
31720
- bodyAttributes: channelDraftMessage.bodyAttributes
31721
- });
31861
+ var _channelDraftMessage$, _ref4, _channelDraftMessage$2, _channelDraftMessage$3, _channelDraftMessage$4;
31862
+ var attachment = (_channelDraftMessage$ = channelDraftMessage.attachments) === null || _channelDraftMessage$ === void 0 ? void 0 : _channelDraftMessage$[0];
31863
+ var editText = (_ref4 = (_channelDraftMessage$2 = channelDraftMessage.editMessageText) != null ? _channelDraftMessage$2 : (_channelDraftMessage$3 = channelDraftMessage.messageToEdit) === null || _channelDraftMessage$3 === void 0 ? void 0 : _channelDraftMessage$3.body) != null ? _ref4 : '';
31864
+ var hasChangedEdit = !!channelDraftMessage.messageToEdit && !!editText.trim() && (editText !== channelDraftMessage.messageToEdit.body || JSON.stringify(channelDraftMessage.editBodyAttributes || []) !== JSON.stringify(channelDraftMessage.messageToEdit.bodyAttributes || []));
31865
+ var mediaLabel = (attachment === null || attachment === void 0 ? void 0 : attachment.type) === attachmentTypes.image ? 'Photo' : (attachment === null || attachment === void 0 ? void 0 : attachment.type) === attachmentTypes.video ? 'Video' : (attachment === null || attachment === void 0 ? void 0 : attachment.type) === attachmentTypes.voice ? 'Voice' : attachment ? 'File' : '';
31866
+ var draftText = ((_channelDraftMessage$4 = channelDraftMessage.text) === null || _channelDraftMessage$4 === void 0 ? void 0 : _channelDraftMessage$4.trim()) || mediaLabel;
31867
+ var isContextOnlyDraft = !!channelDraftMessage.messageForReply && !draftText || !!channelDraftMessage.messageToEdit && !hasChangedEdit;
31868
+ if (isContextOnlyDraft) {
31869
+ setDraftMessageText(undefined);
31870
+ setDraftMessage(undefined);
31871
+ } else {
31872
+ setDraftMessageText(draftText);
31873
+ setDraftMessage({
31874
+ mentionedUsers: channelDraftMessage.mentionedUsers,
31875
+ body: channelDraftMessage.text,
31876
+ bodyAttributes: channelDraftMessage.bodyAttributes,
31877
+ attachments: channelDraftMessage.attachments,
31878
+ viewOnce: channelDraftMessage.viewOnce,
31879
+ type: channelDraftMessage.viewOnce ? exports.MESSAGE_TYPE.VIEW_ONCE : undefined
31880
+ });
31881
+ }
31722
31882
  } else if (draftAudioRecording) {
31723
31883
  setDraftMessageText('Voice');
31724
31884
  setDraftMessage(undefined);
@@ -31728,7 +31888,7 @@ var Channel = function Channel(_ref3) {
31728
31888
  setDraftMessage(undefined);
31729
31889
  }
31730
31890
  }
31731
- }, [activeChannel.id]);
31891
+ }, [activeChannel.id, draftRevision]);
31732
31892
  React.useEffect(function () {
31733
31893
  if (channelDraftIsRemoved && channelDraftIsRemoved === channel.id) {
31734
31894
  setDraftMessageText(undefined);
@@ -31769,6 +31929,8 @@ var Channel = function Channel(_ref3) {
31769
31929
  var unsupportedMessage = React.useMemo(function () {
31770
31930
  return isMessageUnsupported(lastMessage);
31771
31931
  }, [lastMessage === null || lastMessage === void 0 ? void 0 : lastMessage.type]);
31932
+ var shouldShowDraft = !!draftMessageText && !(channel.newMessageCount > 0);
31933
+ var displayedLastMessage = shouldShowDraft ? draftMessage || lastMessage : lastMessage;
31772
31934
  var MessageText = React.useMemo(function () {
31773
31935
  return /*#__PURE__*/React__default.createElement(ChannelMessageText, {
31774
31936
  isTypingOrRecording: (typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isTyping) || (typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isRecording),
@@ -31781,29 +31943,29 @@ var Channel = function Channel(_ref3) {
31781
31943
  channel: channel,
31782
31944
  textPrimary: textPrimary,
31783
31945
  textSecondary: textSecondary,
31784
- draftMessageText: draftMessageText,
31785
- lastMessage: draftMessage || lastMessage,
31946
+ draftMessageText: shouldShowDraft ? draftMessageText : '',
31947
+ lastMessage: displayedLastMessage,
31786
31948
  isDirectChannel: isDirectChannel,
31787
31949
  unsupportedMessage: unsupportedMessage && !getCustomLatestMessage
31788
31950
  });
31789
- }, [typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isTyping, typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isRecording, draftMessageText, lastMessage, user, contactsMap, getFromContacts, lastMessageMetas, accentColor, typingOrRecording, channel, isDirectChannel, unsupportedMessage]);
31790
- var getCustomLatestMessageComponent = React.useCallback(function (_ref4) {
31791
- var lastMessage = _ref4.lastMessage,
31792
- typingOrRecording = _ref4.typingOrRecording,
31793
- draftMessageText = _ref4.draftMessageText,
31794
- textSecondary = _ref4.textSecondary,
31795
- channel = _ref4.channel,
31796
- channelLastMessageFontSize = _ref4.channelLastMessageFontSize,
31797
- channelLastMessageHeight = _ref4.channelLastMessageHeight,
31798
- isDirectChannel = _ref4.isDirectChannel,
31799
- textPrimary = _ref4.textPrimary,
31800
- messageAuthorRef = _ref4.messageAuthorRef,
31801
- contactsMap = _ref4.contactsMap,
31802
- getFromContacts = _ref4.getFromContacts,
31803
- warningColor = _ref4.warningColor,
31804
- user = _ref4.user,
31805
- MessageText = _ref4.MessageText,
31806
- unsupportedMessage = _ref4.unsupportedMessage;
31951
+ }, [typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isTyping, typingOrRecording === null || typingOrRecording === void 0 ? void 0 : typingOrRecording.isRecording, draftMessageText, shouldShowDraft, displayedLastMessage, lastMessage, user, contactsMap, getFromContacts, lastMessageMetas, accentColor, typingOrRecording, channel, isDirectChannel, unsupportedMessage]);
31952
+ var getCustomLatestMessageComponent = React.useCallback(function (_ref5) {
31953
+ var lastMessage = _ref5.lastMessage,
31954
+ typingOrRecording = _ref5.typingOrRecording,
31955
+ draftMessageText = _ref5.draftMessageText,
31956
+ textSecondary = _ref5.textSecondary,
31957
+ channel = _ref5.channel,
31958
+ channelLastMessageFontSize = _ref5.channelLastMessageFontSize,
31959
+ channelLastMessageHeight = _ref5.channelLastMessageHeight,
31960
+ isDirectChannel = _ref5.isDirectChannel,
31961
+ textPrimary = _ref5.textPrimary,
31962
+ messageAuthorRef = _ref5.messageAuthorRef,
31963
+ contactsMap = _ref5.contactsMap,
31964
+ getFromContacts = _ref5.getFromContacts,
31965
+ warningColor = _ref5.warningColor,
31966
+ user = _ref5.user,
31967
+ MessageText = _ref5.MessageText,
31968
+ unsupportedMessage = _ref5.unsupportedMessage;
31807
31969
  return getCustomLatestMessage && getCustomLatestMessage({
31808
31970
  lastMessage: lastMessage,
31809
31971
  typingOrRecording: typingOrRecording,
@@ -31877,7 +32039,7 @@ var Channel = function Channel(_ref3) {
31877
32039
  }, notificationsIsMutedIcon || /*#__PURE__*/React__default.createElement(SvgUnmuteNotifications, null))), getCustomLatestMessage && !typingOrRecording.items.length ? getCustomLatestMessageComponent({
31878
32040
  lastMessage: lastMessage,
31879
32041
  typingOrRecording: typingOrRecording,
31880
- draftMessageText: draftMessageText,
32042
+ draftMessageText: shouldShowDraft ? draftMessageText : undefined,
31881
32043
  textSecondary: textSecondary,
31882
32044
  channel: channel,
31883
32045
  channelLastMessageFontSize: channelLastMessageFontSize || '14px',
@@ -31891,7 +32053,7 @@ var Channel = function Channel(_ref3) {
31891
32053
  user: user,
31892
32054
  MessageText: MessageText,
31893
32055
  unsupportedMessage: unsupportedMessage
31894
- }) : (lastMessage || typingOrRecording.items.length > 0 || draftMessageText) && (/*#__PURE__*/React__default.createElement(LastMessage, {
32056
+ }) : (lastMessage || typingOrRecording.items.length > 0 || shouldShowDraft) && (/*#__PURE__*/React__default.createElement(LastMessage, {
31895
32057
  color: textSecondary,
31896
32058
  markedAsUnread: !!(channel.unread || channel.newMessageCount && channel.newMessageCount > 0),
31897
32059
  unreadMentions: !!(channel.newMentionCount && channel.newMentionCount > 0),
@@ -31907,7 +32069,7 @@ var Channel = function Channel(_ref3) {
31907
32069
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, {
31908
32070
  key: item.from.id
31909
32071
  }, makeUsername(contactsMap && contactsMap[item.from.id], item.from, getFromContacts, true), index < typingOrRecording.items.length - 1 && ', ');
31910
- })))) : null : draftMessageText ? (/*#__PURE__*/React__default.createElement(DraftMessageTitle, {
32072
+ })))) : null : shouldShowDraft ? (/*#__PURE__*/React__default.createElement(DraftMessageTitle, {
31911
32073
  color: warningColor
31912
32074
  }, "Draft")) : channel.lastReactedMessage && channel.newReactions && channel.newReactions[0] ? lastMessage.state !== MESSAGE_STATUS.DELETE && (channel.newReactions[0].user && channel.newReactions[0].user.id === user.id || !isDirectChannel) && lastMessage.type !== exports.MESSAGE_TYPE.SYSTEM && (/*#__PURE__*/React__default.createElement(LastMessageAuthor, {
31913
32075
  color: textPrimary
@@ -31917,8 +32079,8 @@ var Channel = function Channel(_ref3) {
31917
32079
  color: textPrimary
31918
32080
  }, /*#__PURE__*/React__default.createElement("span", {
31919
32081
  ref: messageAuthorRef
31920
- }, lastMessage.user.id === user.id ? 'You' : makeUsername(contactsMap && contactsMap[lastMessage.user.id], lastMessage.user, getFromContacts, true)))), !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping) && !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isRecording) && (isDirectChannel ? !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping) && !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isRecording) && (draftMessageText || lastMessage.user && lastMessage.state !== MESSAGE_STATUS.DELETE && (channel.lastReactedMessage && channel.newReactions && channel.newReactions[0] ? channel.newReactions[0].user && channel.newReactions[0].user.id === user.id : lastMessage.user.id === user.id && lastMessage.type !== exports.MESSAGE_TYPE.SYSTEM)) : draftMessageText || lastMessage && lastMessage.state !== MESSAGE_STATUS.DELETE && lastMessage.type !== exports.MESSAGE_TYPE.SYSTEM) && (/*#__PURE__*/React__default.createElement(Points, {
31921
- color: draftMessageText && warningColor || textPrimary
32082
+ }, lastMessage.user.id === user.id ? 'You' : makeUsername(contactsMap && contactsMap[lastMessage.user.id], lastMessage.user, getFromContacts, true)))), !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping) && !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isRecording) && (isDirectChannel ? !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping) && !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isRecording) && (shouldShowDraft || lastMessage.user && lastMessage.state !== MESSAGE_STATUS.DELETE && (channel.lastReactedMessage && channel.newReactions && channel.newReactions[0] ? channel.newReactions[0].user && channel.newReactions[0].user.id === user.id : lastMessage.user.id === user.id && lastMessage.type !== exports.MESSAGE_TYPE.SYSTEM)) : shouldShowDraft || lastMessage && lastMessage.state !== MESSAGE_STATUS.DELETE && lastMessage.type !== exports.MESSAGE_TYPE.SYSTEM) && (/*#__PURE__*/React__default.createElement(Points, {
32083
+ color: shouldShowDraft && warningColor || textPrimary
31922
32084
  }, ": ")), /*#__PURE__*/React__default.createElement(LastMessageText, {
31923
32085
  color: textSecondary,
31924
32086
  withAttachments: !!(lastMessage && lastMessage.attachments && lastMessage.attachments.length && lastMessage.attachments[0].type !== attachmentTypes.link) && (!(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isTyping) || !(typingOrRecording !== null && typingOrRecording !== void 0 && typingOrRecording.isRecording)),
@@ -31927,7 +32089,7 @@ var Channel = function Channel(_ref3) {
31927
32089
  }, MessageText)))), /*#__PURE__*/React__default.createElement(ChannelStatus, {
31928
32090
  color: iconInactive,
31929
32091
  ref: messageTimeAndStatusRef
31930
- }, lastMessage && lastMessage.state !== MESSAGE_STATUS.DELETE && !draftMessageText && (/*#__PURE__*/React__default.createElement(DeliveryIconCont, null, lastMessage && lastMessage.user && lastMessage.user.id === user.id && isTypeValid(lastMessage.type) && MessageStatusIcon({
32092
+ }, lastMessage && lastMessage.state !== MESSAGE_STATUS.DELETE && !shouldShowDraft && (/*#__PURE__*/React__default.createElement(DeliveryIconCont, null, lastMessage && lastMessage.user && lastMessage.user.id === user.id && isTypeValid(lastMessage.type) && MessageStatusIcon({
31931
32093
  messageStatus: lastMessage.deliveryStatus,
31932
32094
  messageStatusDisplayingType: 'ticks',
31933
32095
  readIconColor: accentColor,
@@ -31938,7 +32100,7 @@ var Channel = function Channel(_ref3) {
31938
32100
  color: textSecondary,
31939
32101
  fontSize: channelLastMessageTimeFontSize
31940
32102
  }, lastMessage && lastMessage.createdAt && lastMessageDateFormat(lastMessage.createdAt))), /*#__PURE__*/React__default.createElement(UnreadInfo, {
31941
- bottom: !(lastMessage || typingOrRecording.items.length > 0 || draftMessageText) ? '5px' : ''
32103
+ bottom: !(lastMessage || typingOrRecording.items.length > 0 || shouldShowDraft) ? '5px' : ''
31942
32104
  }, channel.pinnedAt && (/*#__PURE__*/React__default.createElement(PinnedIconWrapper, {
31943
32105
  color: iconInactive,
31944
32106
  margin: channel.newMessageCount || channel.unread || channel.newMentionCount && channel.newMentionCount > 0 ? '0 4px 0 4px' : ''
@@ -32014,9 +32176,9 @@ var Container$3 = styled__default.div(_templateObject7$2 || (_templateObject7$2
32014
32176
  return props.selectedChannel ? props.selectedBackgroundColor : props.backgroundColor;
32015
32177
  }, function (props) {
32016
32178
  return props.selectedChannel ? props.selectedBackgroundColor : props.backgroundColor;
32017
- }, function (_ref5) {
32018
- var selectedChannel = _ref5.selectedChannel,
32019
- hoverBackground = _ref5.hoverBackground;
32179
+ }, function (_ref6) {
32180
+ var selectedChannel = _ref6.selectedChannel,
32181
+ hoverBackground = _ref6.hoverBackground;
32020
32182
  return !selectedChannel && "\n background-color: " + hoverBackground + ";\n ";
32021
32183
  }, UserStatus, function (props) {
32022
32184
  return props.selectedChannel ? props.selectedBackgroundColor : props.hoverBackground;
@@ -32035,9 +32197,9 @@ var DraftMessageText = styled__default.span(_templateObject9$1 || (_templateObje
32035
32197
  });
32036
32198
  var LastMessageAuthor = styled__default.div(_templateObject0$1 || (_templateObject0$1 = _taggedTemplateLiteralLoose(["\n max-width: 120px;\n font-weight: 500;\n color: ", ";\n\n ", "\n & > span {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n max-width: 100%;\n }\n"])), function (props) {
32037
32199
  return props.color;
32038
- }, function (_ref6) {
32039
- var typing = _ref6.typing,
32040
- recording = _ref6.recording;
32200
+ }, function (_ref7) {
32201
+ var typing = _ref7.typing,
32202
+ recording = _ref7.recording;
32041
32203
  return (typing || recording) && "\n font-weight: 500;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n max-width: calc(100% - " + (typing ? 62 : 76) + "px);\n ";
32042
32204
  });
32043
32205
  var Points = styled__default.span(_templateObject1$1 || (_templateObject1$1 = _taggedTemplateLiteralLoose(["\n margin-right: 4px;\n color: ", ";\n font-style: normal;\n"])), function (props) {
@@ -32070,9 +32232,9 @@ var UnreadMentionIconWrapper = styled__default.span(_templateObject15$1 || (_tem
32070
32232
  return props.rightMargin && '8px';
32071
32233
  }, function (props) {
32072
32234
  return props.iconColor;
32073
- }, function (_ref7) {
32074
- var onAvatar = _ref7.onAvatar,
32075
- mainBg = _ref7.mainBg;
32235
+ }, function (_ref8) {
32236
+ var onAvatar = _ref8.onAvatar,
32237
+ mainBg = _ref8.mainBg;
32076
32238
  return onAvatar ? "\n position: absolute;\n right: 6px;\n bottom: 6px;\n border: 2px solid " + mainBg + ";\n min-width: 20px;\n height: 20px;\n border-radius: 50%;\n margin-right: 0;\n " : '';
32077
32239
  });
32078
32240
  var TypingIndicator = styled__default.span(_templateObject16$1 || (_templateObject16$1 = _taggedTemplateLiteralLoose(["\n font-style: italic;\n"])));
@@ -32092,9 +32254,9 @@ var UnreadCount = styled__default.span(_templateObject19$1 || (_templateObject19
32092
32254
  return props.textColor;
32093
32255
  }, function (props) {
32094
32256
  return props.isMuted && "background-color: " + props.mutedBackgroundColor + ";";
32095
- }, function (_ref8) {
32096
- var onAvatar = _ref8.onAvatar,
32097
- mainBg = _ref8.mainBg;
32257
+ }, function (_ref9) {
32258
+ var onAvatar = _ref9.onAvatar,
32259
+ mainBg = _ref9.mainBg;
32098
32260
  return onAvatar ? "\n position: absolute;\n right: 6px;\n bottom: 6px;\n border: 2px solid " + mainBg + ";\n min-width: 24px;\n height: 24px;\n max-width: 24px;\n border-radius: 50%;\n " : '';
32099
32261
  });
32100
32262
  var PinnedIconWrapper = styled__default.span(_templateObject20$1 || (_templateObject20$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n ", ";\n & > svg {\n color: ", ";\n }\n"])), function (props) {
@@ -39583,7 +39745,7 @@ var VideoIcon = styled__default.div(_templateObject8$a || (_templateObject8$a =
39583
39745
  return bg;
39584
39746
  });
39585
39747
 
39586
- var _templateObject$z, _templateObject2$v, _templateObject3$p, _templateObject4$l, _templateObject5$h, _templateObject6$e, _templateObject7$d, _templateObject8$b, _templateObject9$9, _templateObject0$8, _templateObject1$8, _templateObject10$6, _templateObject11$5;
39748
+ var _templateObject$z, _templateObject2$v, _templateObject3$p, _templateObject4$l, _templateObject5$h, _templateObject6$e, _templateObject7$d, _templateObject8$b, _templateObject9$9, _templateObject0$8, _templateObject1$8, _templateObject10$6, _templateObject11$5, _templateObject12$4, _templateObject13$4;
39587
39749
  var Attachment = function Attachment(_ref) {
39588
39750
  var attachment = _ref.attachment,
39589
39751
  _ref$isPreview = _ref.isPreview,
@@ -39645,6 +39807,10 @@ var Attachment = function Attachment(_ref) {
39645
39807
  var _useState3 = React.useState(attachmentUrlFromMap),
39646
39808
  attachmentUrl = _useState3[0],
39647
39809
  setAttachmentUrl = _useState3[1];
39810
+ var attachmentIdentity = attachment.id || attachment.tid || 'unknown-attachment';
39811
+ var attachmentKey = (channelId || 'unknown-channel') + ":" + attachmentIdentity + ":" + (attachment.url || '');
39812
+ var currentAttachmentKeyRef = React.useRef(attachmentKey);
39813
+ currentAttachmentKeyRef.current = attachmentKey;
39648
39814
  var _useState4 = React.useState(false),
39649
39815
  imageLoaded = _useState4[0],
39650
39816
  setImageLoaded = _useState4[1];
@@ -39704,6 +39870,18 @@ var Attachment = function Attachment(_ref) {
39704
39870
  log.error('error on get attachmentThumb', e);
39705
39871
  }
39706
39872
  }
39873
+ React.useEffect(function () {
39874
+ if (attachment.type !== attachmentTypes.image) return;
39875
+ log.info('[MEDIA_ISSUE] image thumbnail source', JSON.stringify({
39876
+ channelId: channelId || null,
39877
+ attachmentId: attachment.id || attachment.tid || null,
39878
+ attachmentUrl: attachment.url || null,
39879
+ mapUrl: attachmentUrlFromMap || null,
39880
+ propUrl: attachment.attachmentUrl || null,
39881
+ localUrl: attachmentUrl || null,
39882
+ renderedSource: attachmentUrlFromMap || attachment.attachmentUrl || attachmentUrl || attachmentThumb || null
39883
+ }));
39884
+ }, [attachment.id, attachment.tid, attachment.type, attachment.url, attachment.attachmentUrl, attachmentUrlFromMap, attachmentUrl, channelId]);
39707
39885
  React.useEffect(function () {
39708
39886
  var currentSrc = attachment.attachmentUrl || attachmentUrlFromMap || attachmentUrl || attachmentThumb;
39709
39887
  var wasThumbnail = previousImageSrcRef.current === attachmentThumb;
@@ -39993,12 +40171,23 @@ var Attachment = function Attachment(_ref) {
39993
40171
  }, [attachmentUrl]);
39994
40172
  React.useEffect(function () {
39995
40173
  if (!attachment.attachmentUrl && connectionStatus === CONNECTION_STATUS.CONNECTED && attachment.id && !attachmentUrlFromMap && !(attachment.type === attachmentTypes.file || attachment.type === attachmentTypes.link)) {
40174
+ var requestAttachmentKey = attachmentKey;
40175
+ log.info('[MEDIA_ISSUE] image thumbnail load started', JSON.stringify({
40176
+ channelId: channelId || null,
40177
+ attachmentId: attachment.id || attachment.tid || null,
40178
+ url: attachment.url
40179
+ }));
39996
40180
  getAttachmentUrlFromCache(attachment.url).then(function (cachedUrl) {
39997
40181
  try {
39998
40182
  var _temp16 = function () {
39999
40183
  if (attachment.type === attachmentTypes.image && !isPreview) {
40000
40184
  var _temp15 = function () {
40001
40185
  if (cachedUrl) {
40186
+ log.info('[MEDIA_ISSUE] image thumbnail cache resolved', JSON.stringify({
40187
+ requestAttachmentKey: requestAttachmentKey,
40188
+ currentAttachmentKey: currentAttachmentKeyRef.current,
40189
+ cachedUrl: cachedUrl
40190
+ }));
40002
40191
  setAttachmentUrl(cachedUrl);
40003
40192
  dispatch(setUpdateMessageAttachmentAC(attachment.url, cachedUrl));
40004
40193
  setIsCached(true);
@@ -40019,6 +40208,12 @@ var Attachment = function Attachment(_ref) {
40019
40208
  try {
40020
40209
  return Promise.resolve(compressAndCacheImage(url, attachment.url, renderWidth, renderHeight)).then(function (compressedUrl) {
40021
40210
  if (compressedUrl) {
40211
+ log.info('[MEDIA_ISSUE] image thumbnail download resolved', JSON.stringify({
40212
+ requestAttachmentKey: requestAttachmentKey,
40213
+ currentAttachmentKey: currentAttachmentKeyRef.current,
40214
+ sourceUrl: url,
40215
+ cachedUrl: compressedUrl
40216
+ }));
40022
40217
  setAttachmentUrl(compressedUrl);
40023
40218
  }
40024
40219
  downloadImage(compressedUrl || url);
@@ -40211,7 +40406,7 @@ var Attachment = function Attachment(_ref) {
40211
40406
  isPreview: isPreview,
40212
40407
  isRepliedMessage: isRepliedMessage,
40213
40408
  withBorder: !isPreview && !isDetailsView,
40214
- src: attachmentUrlFromMap || attachmentUrl || (withPrefix && attachmentThumb ? "data:image/jpeg;base64," + attachmentThumb : attachmentThumb),
40409
+ src: attachmentUrlFromMap || attachment.attachmentUrl || attachmentUrl || (withPrefix && attachmentThumb ? "data:image/jpeg;base64," + attachmentThumb : attachmentThumb),
40215
40410
  fitTheContainer: true,
40216
40411
  imageMaxHeight: (renderHeight || 400) + "px",
40217
40412
  isDetailsView: isDetailsView,
@@ -40382,7 +40577,9 @@ var Attachment = function Attachment(_ref) {
40382
40577
  border: selectedFileAttachmentsBoxBorder || (theme === THEME.DARK ? 'none' : ''),
40383
40578
  width: fileAttachmentWidth,
40384
40579
  borderColor: borderColor
40385
- }, attachmentThumb ? (/*#__PURE__*/React__default.createElement(FileThumbnail, {
40580
+ }, attachment.thumbnailState === 'loading' ? (/*#__PURE__*/React__default.createElement(FileThumbnailSkeleton, {
40581
+ color: overlayBackground2
40582
+ })) : attachmentThumb ? (/*#__PURE__*/React__default.createElement(FileThumbnail, {
40386
40583
  src: withPrefix ? "data:image/jpeg;base64," + attachmentThumb : attachmentThumb,
40387
40584
  loading: 'lazy',
40388
40585
  decoding: 'async',
@@ -40492,18 +40689,26 @@ var AttachmentImgCont = styled__default.div(_templateObject2$v || (_templateObje
40492
40689
  return props.isPreview && "\n width: 48px;\n min-width: 48px;\n height: 48px;\n ";
40493
40690
  });
40494
40691
  var FileThumbnail = styled__default.img(_templateObject3$p || (_templateObject3$p = _taggedTemplateLiteralLoose(["\n min-width: 40px;\n max-width: 40px;\n height: 40px;\n object-fit: cover;\n border-radius: 8px;\n"])));
40495
- var DownloadFile$1 = styled__default.span(_templateObject4$l || (_templateObject4$l = _taggedTemplateLiteralLoose(["\n display: none;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n background-color: ", ";\n min-width: 40px;\n max-width: 40px;\n height: 40px;\n position: ", ";\n border-radius: ", ";\n\n & > svg {\n width: 20px;\n height: 20px;\n }\n"])), function (props) {
40692
+ var fileThumbnailShimmer = styled.keyframes(_templateObject4$l || (_templateObject4$l = _taggedTemplateLiteralLoose(["\n 0% { background-position: -120px 0; }\n 100% { background-position: 120px 0; }\n"])));
40693
+ var FileThumbnailSkeleton = styled__default.div(_templateObject5$h || (_templateObject5$h = _taggedTemplateLiteralLoose(["\n min-width: 40px;\n max-width: 40px;\n height: 40px;\n border-radius: 8px;\n background-color: ", ";\n background-image: linear-gradient(\n 90deg,\n ", ",\n rgba(255, 255, 255, 0.55),\n ", "\n );\n background-size: 240px 100%;\n animation: ", " 1.1s ease infinite;\n"])), function (props) {
40694
+ return props.color;
40695
+ }, function (props) {
40696
+ return props.color;
40697
+ }, function (props) {
40698
+ return props.color;
40699
+ }, fileThumbnailShimmer);
40700
+ var DownloadFile$1 = styled__default.span(_templateObject6$e || (_templateObject6$e = _taggedTemplateLiteralLoose(["\n display: none;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n background-color: ", ";\n min-width: 40px;\n max-width: 40px;\n height: 40px;\n position: ", ";\n border-radius: ", ";\n\n & > svg {\n width: 20px;\n height: 20px;\n }\n"])), function (props) {
40496
40701
  return props.backgroundColor;
40497
40702
  }, function (props) {
40498
40703
  return props.widthThumb && 'absolute';
40499
40704
  }, function (props) {
40500
40705
  return props.widthThumb ? '7.3px' : '50%';
40501
40706
  });
40502
- var ProgressWrapper$1 = styled__default.span(_templateObject5$h || (_templateObject5$h = _taggedTemplateLiteralLoose(["\n width: 100%;\n height: 100%;\n animation: preloader 1.5s linear infinite;\n\n @keyframes preloader {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n"])));
40503
- var SizeProgress = styled__default.span(_templateObject6$e || (_templateObject6$e = _taggedTemplateLiteralLoose(["\n position: absolute;\n bottom: -26px;\n background-color: rgba(0, 0, 0, 0.4);\n color: ", ";\n font-size: 12px;\n border-radius: 12px;\n padding: 3px 6px;\n white-space: nowrap;\n"])), function (props) {
40707
+ var ProgressWrapper$1 = styled__default.span(_templateObject7$d || (_templateObject7$d = _taggedTemplateLiteralLoose(["\n width: 100%;\n height: 100%;\n animation: preloader 1.5s linear infinite;\n\n @keyframes preloader {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n"])));
40708
+ var SizeProgress = styled__default.span(_templateObject8$b || (_templateObject8$b = _taggedTemplateLiteralLoose(["\n position: absolute;\n bottom: -26px;\n background-color: rgba(0, 0, 0, 0.4);\n color: ", ";\n font-size: 12px;\n border-radius: 12px;\n padding: 3px 6px;\n white-space: nowrap;\n"])), function (props) {
40504
40709
  return props.color;
40505
40710
  });
40506
- var AttachmentFile$1 = styled__default.div(_templateObject7$d || (_templateObject7$d = _taggedTemplateLiteralLoose(["\n display: flex;\n position: relative;\n align-items: center;\n padding: ", ";\n //width: ", ";\n min-width: ", ";\n //height: 70px;\n background: ", ";\n border: ", ";\n box-sizing: border-box;\n margin-right: ", ";\n border-radius: ", ";\n\n ", "\n\n & > ", " svg {\n width: 40px;\n height: 40px;\n }\n"])), function (props) {
40711
+ var AttachmentFile$1 = styled__default.div(_templateObject9$9 || (_templateObject9$9 = _taggedTemplateLiteralLoose(["\n display: flex;\n position: relative;\n align-items: center;\n padding: ", ";\n //width: ", ";\n min-width: ", ";\n //height: 70px;\n background: ", ";\n border: ", ";\n box-sizing: border-box;\n margin-right: ", ";\n border-radius: ", ";\n\n ", "\n\n & > ", " svg {\n width: 40px;\n height: 40px;\n }\n"])), function (props) {
40507
40712
  return !props.isRepliedMessage && '8px 12px;';
40508
40713
  }, function (props) {
40509
40714
  return !props.isRepliedMessage && (props.width ? props.width + "px" : '350px');
@@ -40520,25 +40725,25 @@ var AttachmentFile$1 = styled__default.div(_templateObject7$d || (_templateObjec
40520
40725
  }, function (props) {
40521
40726
  return !props.isRepliedMessage && !props.isPreview && !props.isUploading && "\n &:hover " + DownloadFile$1 + " {\n display: flex;\n }\n\n &:hover " + UploadPercent + " {\n border-radius: 50%\n }\n\n &:hover " + FileThumbnail + " {\n }\n &:hover " + AttachmentIconCont + " {\n display: none;\n }\n ";
40522
40727
  }, AttachmentIconCont);
40523
- var RemoveChosenFile = styled__default(SvgDeleteUpload)(_templateObject8$b || (_templateObject8$b = _taggedTemplateLiteralLoose(["\n position: absolute;\n width: 20px;\n height: 20px !important;\n top: -11px;\n right: -11px;\n padding: 2px;\n cursor: pointer;\n color: ", ";\n z-index: 5;\n circle {\n stroke: ", ";\n }\n path {\n stroke: ", ";\n }\n"])), function (props) {
40728
+ var RemoveChosenFile = styled__default(SvgDeleteUpload)(_templateObject0$8 || (_templateObject0$8 = _taggedTemplateLiteralLoose(["\n position: absolute;\n width: 20px;\n height: 20px !important;\n top: -11px;\n right: -11px;\n padding: 2px;\n cursor: pointer;\n color: ", ";\n z-index: 5;\n circle {\n stroke: ", ";\n }\n path {\n stroke: ", ";\n }\n"])), function (props) {
40524
40729
  return props.color;
40525
40730
  }, function (props) {
40526
40731
  return props.$backgroundColor;
40527
40732
  }, function (props) {
40528
40733
  return props.$backgroundColor;
40529
40734
  });
40530
- var AttachmentName = styled__default.h3(_templateObject9$9 || (_templateObject9$9 = _taggedTemplateLiteralLoose(["\n font-size: 15px;\n font-weight: 500;\n line-height: 18px;\n color: ", ";\n max-width: 275px;\n white-space: nowrap;\n margin: 0;\n"])), function (props) {
40735
+ var AttachmentName = styled__default.h3(_templateObject1$8 || (_templateObject1$8 = _taggedTemplateLiteralLoose(["\n font-size: 15px;\n font-weight: 500;\n line-height: 18px;\n color: ", ";\n max-width: 275px;\n white-space: nowrap;\n margin: 0;\n"])), function (props) {
40531
40736
  return props.color;
40532
40737
  });
40533
- var AttachmentSize = styled__default.span(_templateObject0$8 || (_templateObject0$8 = _taggedTemplateLiteralLoose(["\n font-size: 13px;\n color: ", ";\n & > span {\n color: ", ";\n margin-left: 8px;\n }\n"])), function (props) {
40738
+ var AttachmentSize = styled__default.span(_templateObject10$6 || (_templateObject10$6 = _taggedTemplateLiteralLoose(["\n font-size: 13px;\n color: ", ";\n & > span {\n color: ", ";\n margin-left: 8px;\n }\n"])), function (props) {
40534
40739
  return props.color;
40535
40740
  }, function (props) {
40536
40741
  return props.errorColor;
40537
40742
  });
40538
- var AttachmentFileInfo = styled__default.div(_templateObject1$8 || (_templateObject1$8 = _taggedTemplateLiteralLoose(["\n margin-left: 12px;\n ", "\n"])), function (props) {
40743
+ var AttachmentFileInfo = styled__default.div(_templateObject11$5 || (_templateObject11$5 = _taggedTemplateLiteralLoose(["\n margin-left: 12px;\n ", "\n"])), function (props) {
40539
40744
  return props.isPreview && "line-height: 14px;\n max-width: calc(100% - 44px);\n ";
40540
40745
  });
40541
- var AttachmentImg = styled__default.img(_templateObject10$6 || (_templateObject10$6 = _taggedTemplateLiteralLoose(["\n position: ", ";\n border-radius: ", ";\n padding: ", ";\n box-sizing: border-box;\n width: ", ";\n height: ", ";\n object-fit: cover;\n visibility: ", ";\n z-index: 2;\n opacity: ", ";\n transition: opacity 0.3s ease-in-out;\n"])), function (props) {
40746
+ var AttachmentImg = styled__default.img(_templateObject12$4 || (_templateObject12$4 = _taggedTemplateLiteralLoose(["\n position: ", ";\n border-radius: ", ";\n padding: ", ";\n box-sizing: border-box;\n width: ", ";\n height: ", ";\n object-fit: cover;\n visibility: ", ";\n z-index: 2;\n opacity: ", ";\n transition: opacity 0.3s ease-in-out;\n"])), function (props) {
40542
40747
  return props.absolute && 'absolute';
40543
40748
  }, function (props) {
40544
40749
  return props.isRepliedMessage ? '4px' : props.borderRadius || '6px';
@@ -40553,7 +40758,7 @@ var AttachmentImg = styled__default.img(_templateObject10$6 || (_templateObject1
40553
40758
  }, function (props) {
40554
40759
  return props.$shouldAnimate && !props.$isLoaded ? 0 : 1;
40555
40760
  });
40556
- var VideoCont = styled__default.div(_templateObject11$5 || (_templateObject11$5 = _taggedTemplateLiteralLoose(["\n position: relative;\n cursor: pointer;\n height: ", ";\n"])), function (props) {
40761
+ var VideoCont = styled__default.div(_templateObject13$4 || (_templateObject13$4 = _taggedTemplateLiteralLoose(["\n position: relative;\n cursor: pointer;\n height: ", ";\n"])), function (props) {
40557
40762
  return props.isDetailsView && '100%';
40558
40763
  });
40559
40764
 
@@ -41936,7 +42141,7 @@ function SvgFilledCheckbox(props) {
41936
42141
  })));
41937
42142
  }
41938
42143
 
41939
- var _templateObject$G, _templateObject2$B, _templateObject3$v, _templateObject4$q, _templateObject5$l, _templateObject6$i, _templateObject7$h, _templateObject8$f, _templateObject9$c, _templateObject0$b, _templateObject1$b, _templateObject10$9, _templateObject11$6, _templateObject12$4;
42144
+ var _templateObject$G, _templateObject2$B, _templateObject3$v, _templateObject4$q, _templateObject5$l, _templateObject6$i, _templateObject7$h, _templateObject8$f, _templateObject9$c, _templateObject0$b, _templateObject1$b, _templateObject10$9, _templateObject11$6, _templateObject12$5;
41940
42145
  var PollMessage = function PollMessage(_ref) {
41941
42146
  var _poll$voteDetails3, _poll$voteDetails4, _poll$voteDetails5, _poll$voteDetails6, _poll$voteDetails7;
41942
42147
  var message = _ref.message,
@@ -42127,7 +42332,7 @@ var Bar = styled__default.div(_templateObject10$9 || (_templateObject10$9 = _tag
42127
42332
  return p.track;
42128
42333
  });
42129
42334
  var Fill = styled__default.div(_templateObject11$6 || (_templateObject11$6 = _taggedTemplateLiteralLoose(["\n height: 100%;\n border-radius: 6px;\n transition: width 0.3s ease-in-out;\n"])));
42130
- var UsersContainer = styled__default.div(_templateObject12$4 || (_templateObject12$4 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n margin-left: auto;\n padding-left: 16px;\n height: max-content;\n cursor: ", ";\n"])), function (p) {
42335
+ var UsersContainer = styled__default.div(_templateObject12$5 || (_templateObject12$5 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n margin-left: auto;\n padding-left: 16px;\n height: max-content;\n cursor: ", ";\n"])), function (p) {
42131
42336
  return p.cursor;
42132
42337
  });
42133
42338
 
@@ -43702,7 +43907,7 @@ function SvgCircleDashed(props) {
43702
43907
  })));
43703
43908
  }
43704
43909
 
43705
- var _templateObject$L, _templateObject2$G, _templateObject3$A, _templateObject4$v, _templateObject5$q, _templateObject6$m, _templateObject7$l, _templateObject8$j, _templateObject9$g, _templateObject0$f, _templateObject1$d, _templateObject10$a, _templateObject11$7, _templateObject12$5, _templateObject13$4;
43910
+ var _templateObject$L, _templateObject2$G, _templateObject3$A, _templateObject4$v, _templateObject5$q, _templateObject6$m, _templateObject7$l, _templateObject8$j, _templateObject9$g, _templateObject0$f, _templateObject1$d, _templateObject10$a, _templateObject11$7, _templateObject12$6, _templateObject13$5;
43706
43911
  var defaultFormatDate = function defaultFormatDate(date) {
43707
43912
  var m = moment(date);
43708
43913
  if (m.isSame(moment(), 'day')) {
@@ -44325,10 +44530,10 @@ var Content = styled__default.div(_templateObject1$d || (_templateObject1$d = _t
44325
44530
  });
44326
44531
  var P2PStatusList = styled__default.div(_templateObject10$a || (_templateObject10$a = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n"])));
44327
44532
  var P2PStatusRow = styled__default.div(_templateObject11$7 || (_templateObject11$7 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0 4px;\n height: 48px;\n"])));
44328
- var P2PStatusLabel = styled__default.div(_templateObject12$5 || (_templateObject12$5 = _taggedTemplateLiteralLoose(["\n color: ", ";\n font-family: Inter;\n font-weight: 500;\n font-size: 15px;\n line-height: 18px;\n letter-spacing: -0.2px;\n"])), function (p) {
44533
+ var P2PStatusLabel = styled__default.div(_templateObject12$6 || (_templateObject12$6 = _taggedTemplateLiteralLoose(["\n color: ", ";\n font-family: Inter;\n font-weight: 500;\n font-size: 15px;\n line-height: 18px;\n letter-spacing: -0.2px;\n"])), function (p) {
44329
44534
  return p.color;
44330
44535
  });
44331
- var P2PStatusDate = styled__default.div(_templateObject13$4 || (_templateObject13$4 = _taggedTemplateLiteralLoose(["\n color: ", ";\n min-width: max-content;\n font-family: Inter;\n font-weight: 400;\n font-size: 13px;\n line-height: 16px;\n letter-spacing: 0px;\n"])), function (p) {
44536
+ var P2PStatusDate = styled__default.div(_templateObject13$5 || (_templateObject13$5 = _taggedTemplateLiteralLoose(["\n color: ", ";\n min-width: max-content;\n font-family: Inter;\n font-weight: 400;\n font-size: 13px;\n line-height: 16px;\n letter-spacing: 0px;\n"])), function (p) {
44332
44537
  return p.color;
44333
44538
  });
44334
44539
 
@@ -45075,48 +45280,10 @@ var Message$1 = function Message(_ref) {
45075
45280
  return marker.name === MESSAGE_DELIVERY_STATUS.READ;
45076
45281
  }));
45077
45282
  var shouldSendReadMarker = isVisible && message.incoming && !alreadyRead && !disableAutoReadTracking && isTabActive && !!channel.newMessageCount && channel.newMessageCount > 0 && connectionStatus === CONNECTION_STATUS.CONNECTED;
45078
- if (message.incoming && isVisible) {
45079
- if (shouldSendReadMarker) {
45080
- log.info('[READ_MESSAGE] Message auto-read gate passed', compactReadMessageLogData({
45081
- source: 'message',
45082
- channelId: channel.id,
45083
- messageId: message.id,
45084
- isVisible: isVisible,
45085
- alreadyRead: alreadyRead,
45086
- disableAutoReadTracking: disableAutoReadTracking,
45087
- isTabActive: isTabActive,
45088
- newMessageCount: channel.newMessageCount || 0,
45089
- connectionStatus: connectionStatus,
45090
- queued: !!queueReadMarker
45091
- }));
45092
- } else {
45093
- log.info('[READ_MESSAGE] Message auto-read gate blocked', compactReadMessageLogData({
45094
- source: 'message',
45095
- channelId: channel.id,
45096
- messageId: message.id,
45097
- isVisible: isVisible,
45098
- alreadyRead: alreadyRead,
45099
- disableAutoReadTracking: disableAutoReadTracking,
45100
- isTabActive: isTabActive,
45101
- newMessageCount: channel.newMessageCount || 0,
45102
- connectionStatus: connectionStatus
45103
- }));
45104
- }
45105
- }
45106
45283
  if (shouldSendReadMarker) {
45107
45284
  if (queueReadMarker) {
45108
- log.info('[READ_MESSAGE] Queueing read marker from Message component', compactReadMessageLogData({
45109
- source: 'message',
45110
- channelId: channel.id,
45111
- messageId: message.id
45112
- }));
45113
45285
  queueReadMarker(channel.id, message.id);
45114
45286
  } else {
45115
- log.info('[READ_MESSAGE] Dispatching read marker directly from Message component', compactReadMessageLogData({
45116
- source: 'message',
45117
- channelId: channel.id,
45118
- messageId: message.id
45119
- }));
45120
45287
  dispatch(markMessagesAsReadAC(channel.id, [message.id]));
45121
45288
  }
45122
45289
  }
@@ -45159,14 +45326,6 @@ var Message$1 = function Message(_ref) {
45159
45326
  }, [dispatch, selectionIsActive]);
45160
45327
  React.useEffect(function () {
45161
45328
  if (isVisible) {
45162
- if (message.incoming) {
45163
- log.info('[READ_MESSAGE] Message row became visible', compactReadMessageLogData({
45164
- source: 'message',
45165
- channelId: channel.id,
45166
- messageId: message.id,
45167
- localRef: message.tid || message.id || ''
45168
- }));
45169
- }
45170
45329
  if (setLastVisibleMessageId) {
45171
45330
  setLastVisibleMessageId(message);
45172
45331
  }
@@ -46177,14 +46336,6 @@ function useChatController(_ref5) {
46177
46336
  }, [clearJumpScrollingLock]);
46178
46337
  var queueVisibleUnreadCheck = React.useCallback(function () {
46179
46338
  if (pendingVisibleUnreadFrameRef.current !== null || unreadScrollTo || !tabIsActive) {
46180
- if (!tabIsActive) {
46181
- log.info('[READ_MESSAGE] Visible unread scan skipped because tab is inactive', compactReadMessageLogData({
46182
- source: 'controller',
46183
- channelId: channel.id,
46184
- unreadScrollTo: unreadScrollTo,
46185
- pendingFrameScheduled: pendingVisibleUnreadFrameRef.current !== null
46186
- }));
46187
- }
46188
46339
  return;
46189
46340
  }
46190
46341
  pendingVisibleUnreadFrameRef.current = requestAnimationFrame(function () {
@@ -46219,35 +46370,13 @@ function useChatController(_ref5) {
46219
46370
  var ids = visibleUnreadMessages.filter(isUnreadIncomingMessage).map(function (message) {
46220
46371
  return message.id;
46221
46372
  });
46222
- if (visibleUnreadMessages.length && !ids.length) {
46223
- log.info('[READ_MESSAGE] Visible unread scan found messages, but none were unread incoming', compactReadMessageLogData({
46224
- source: 'controller',
46225
- channelId: channel.id,
46226
- visibleCandidateIds: visibleUnreadMessages.map(function (message) {
46227
- return message.id;
46228
- })
46229
- }));
46230
- }
46231
46373
  if (!ids.length || !channel.id || !channel.newMessageCount) {
46232
- if (ids.length && (!channel.id || !channel.newMessageCount)) {
46233
- log.info('[READ_MESSAGE] Visible unread scan blocked before dispatch', compactReadMessageLogData({
46234
- source: 'controller',
46235
- channelId: channel.id,
46236
- messageIds: ids,
46237
- newMessageCount: channel.newMessageCount || 0
46238
- }));
46239
- }
46240
46374
  return;
46241
46375
  }
46242
46376
  ids.forEach(function (id) {
46243
46377
  visibleUnreadReportedRef.current.add(id);
46244
46378
  });
46245
46379
  registerLocallyReadUnreadMessages(ids.length);
46246
- log.info('[READ_MESSAGE] Dispatching read marker from visible unread scan', compactReadMessageLogData({
46247
- source: 'controller',
46248
- channelId: channel.id,
46249
- messageIds: ids
46250
- }));
46251
46380
  dispatch(markMessagesAsReadAC(channel.id, ids));
46252
46381
  });
46253
46382
  }, [channel.id, channel.lastDisplayedMessageId, channel.newMessageCount, dispatch, hasNext, messages, registerLocallyReadUnreadMessages, unreadScrollTo, tabIsActive]);
@@ -50122,24 +50251,26 @@ var Action$1 = styled__default.button(_templateObject2$M || (_templateObject2$M
50122
50251
 
50123
50252
  function EditMessagePlugin(_ref) {
50124
50253
  var editMessage = _ref.editMessage,
50254
+ draftMessage = _ref.draftMessage,
50125
50255
  contactsMap = _ref.contactsMap,
50126
50256
  getFromContacts = _ref.getFromContacts,
50127
50257
  setMentionedMember = _ref.setMentionedMember;
50128
50258
  var _useLexicalComposerCo = LexicalComposerContext.useLexicalComposerContext(),
50129
50259
  editor = _useLexicalComposerCo[0];
50130
50260
  useDidUpdate(function () {
50131
- if (editMessage) {
50132
- if (editMessage.mentionedUsers && editMessage.mentionedUsers.length) {
50133
- setMentionedMember(editMessage.mentionedUsers);
50261
+ var editorMessage = draftMessage || editMessage;
50262
+ if (editorMessage) {
50263
+ if (editorMessage.mentionedUsers && editorMessage.mentionedUsers.length) {
50264
+ setMentionedMember(editorMessage.mentionedUsers);
50134
50265
  }
50135
50266
  editor.update(function () {
50136
50267
  var rootNode = lexical.$getRoot();
50137
50268
  lexical.$getRoot().clear();
50138
50269
  var paragraphNode = lexical.$createParagraphNode();
50139
- var textPart = editMessage.body;
50270
+ var textPart = editorMessage.body;
50140
50271
  var nextPartIndex;
50141
- if (editMessage.bodyAttributes && editMessage.bodyAttributes.length) {
50142
- var bodyAttributes = JSON.parse(JSON.stringify(editMessage.bodyAttributes));
50272
+ if (editorMessage.bodyAttributes && editorMessage.bodyAttributes.length) {
50273
+ var bodyAttributes = JSON.parse(JSON.stringify(editorMessage.bodyAttributes));
50143
50274
  var modifiedAttributes = [];
50144
50275
  bodyAttributes.sort(function (a, b) {
50145
50276
  return a.offset - b.offset;
@@ -50177,7 +50308,7 @@ function EditMessagePlugin(_ref) {
50177
50308
  var secondPart = "" + (textPart ? textPart === null || textPart === void 0 ? void 0 : textPart.substring(attributeOffset + attribute.length) : '');
50178
50309
  nextPartIndex = attribute.offset + attribute.length;
50179
50310
  if (attribute.type.includes('mention')) {
50180
- var mentionUser = editMessage.mentionedUsers.find(function (mention) {
50311
+ var mentionUser = editorMessage.mentionedUsers.find(function (mention) {
50181
50312
  return mention.id === attribute.metadata;
50182
50313
  });
50183
50314
  if (mentionUser) {
@@ -50279,13 +50410,13 @@ function EditMessagePlugin(_ref) {
50279
50410
  rootNode.append(paragraphNode);
50280
50411
  rootNode.selectEnd();
50281
50412
  } else {
50282
- paragraphNode.append(lexical.$createTextNode(editMessage.body));
50413
+ paragraphNode.append(lexical.$createTextNode(editorMessage.body));
50283
50414
  rootNode.append(paragraphNode);
50284
50415
  rootNode.selectEnd();
50285
50416
  }
50286
50417
  });
50287
50418
  }
50288
- }, [editMessage]);
50419
+ }, [editMessage, draftMessage]);
50289
50420
  return null;
50290
50421
  }
50291
50422
 
@@ -50504,25 +50635,12 @@ function useFormatMessage(editor, editorState, setMessageBodyAttributes, setMess
50504
50635
  }
50505
50636
  return true;
50506
50637
  }, [editor, contactsMap, setMentionedMember, getFromContacts, activeChannelMembers, processMentionsInPastedText]);
50507
- var onDelete = React.useCallback(function (event) {
50508
- event.preventDefault();
50509
- editor.update(function () {
50510
- var selection = lexical.$getSelection();
50511
- if (lexical.$isRangeSelection(selection)) {
50512
- var node = getSelectedNode(selection);
50513
- if ($isMentionNode(node)) {
50514
- node.remove();
50515
- }
50516
- }
50517
- });
50518
- return false;
50519
- }, [editor]);
50520
50638
  React.useEffect(function () {
50521
50639
  return mergeRegister(editor.registerCommand(lexical.PASTE_COMMAND, function (e) {
50522
50640
  handlePast(e);
50523
50641
  return true;
50524
- }, lexical.COMMAND_PRIORITY_NORMAL), editor.registerCommand(lexical.KEY_DELETE_COMMAND, onDelete, lexical.COMMAND_PRIORITY_LOW), editor.registerCommand(lexical.KEY_BACKSPACE_COMMAND, onDelete, lexical.COMMAND_PRIORITY_LOW));
50525
- }, [editor, handlePast, onDelete]);
50642
+ }, lexical.COMMAND_PRIORITY_NORMAL));
50643
+ }, [editor, handlePast]);
50526
50644
  useDidUpdate(function () {
50527
50645
  if (editorState) {
50528
50646
  editorState.read(function () {
@@ -50861,6 +50979,18 @@ var Emoji$1 = styled__default.li(_templateObject8$l || (_templateObject8$l = _ta
50861
50979
  return props.hoverBackgroundColor;
50862
50980
  });
50863
50981
 
50982
+ var getReplyLinkPreviewImage = function getReplyLinkPreviewImage(attachments) {
50983
+ var _attachments$;
50984
+ var attachment = attachments !== null && attachments !== void 0 && attachments.length && ((_attachments$ = attachments[0]) === null || _attachments$ === void 0 ? void 0 : _attachments$.type) === attachmentTypes.link ? attachments[0] : null;
50985
+ if (!(attachment !== null && attachment !== void 0 && attachment.metadata) || !isJSON(attachment.metadata)) return null;
50986
+ var compactMeta = JSON.parse(attachment.metadata);
50987
+ var imageUrl = compactMeta.iur || null;
50988
+ return !(compactMeta !== null && compactMeta !== void 0 && compactMeta.hld) ? imageUrl : null;
50989
+ };
50990
+ var shouldShowLinkPreviewErrorFallback = function shouldShowLinkPreviewErrorFallback(imageUrl, imageFailed) {
50991
+ return Boolean(imageUrl && imageFailed);
50992
+ };
50993
+
50864
50994
  var CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
50865
50995
 
50866
50996
  var _circle$6, _path$1j;
@@ -51170,8 +51300,10 @@ var AudioRecord = function AudioRecord(_ref) {
51170
51300
  warningColor = _useColor[THEME_COLORS.WARNING],
51171
51301
  iconPrimary = _useColor[THEME_COLORS.ICON_PRIMARY],
51172
51302
  surface1 = _useColor[THEME_COLORS.SURFACE_1],
51303
+ textPrimary = _useColor[THEME_COLORS.TEXT_PRIMARY],
51173
51304
  iconInactive = _useColor[THEME_COLORS.ICON_INACTIVE],
51174
- textOnPrimary = _useColor[THEME_COLORS.TEXT_ON_PRIMARY];
51305
+ textOnPrimary = _useColor[THEME_COLORS.TEXT_ON_PRIMARY],
51306
+ background = _useColor[THEME_COLORS.BACKGROUND];
51175
51307
  var _useState = React.useState(null),
51176
51308
  recording = _useState[0],
51177
51309
  setStartRecording = _useState[1];
@@ -51199,6 +51331,9 @@ var AudioRecord = function AudioRecord(_ref) {
51199
51331
  var _useState9 = React.useState(false),
51200
51332
  playAudio = _useState9[0],
51201
51333
  setPlayAudio = _useState9[1];
51334
+ var _useState0 = React.useState(false),
51335
+ microphonePermissionDenied = _useState0[0],
51336
+ setMicrophonePermissionDenied = _useState0[1];
51202
51337
  var recordButtonRef = React.useRef(null);
51203
51338
  var audioElements = React.useRef({});
51204
51339
  var intervalRef = React.useRef({});
@@ -51288,27 +51423,21 @@ var AudioRecord = function AudioRecord(_ref) {
51288
51423
  var startRecording = function startRecording(cId) {
51289
51424
  try {
51290
51425
  var id = cId || currentChannelId;
51291
- var _temp = _catch(function () {
51292
- return Promise.resolve(navigator.permissions.query({
51293
- name: 'microphone'
51294
- })).then(function (permissionStatus) {
51295
- if (permissionStatus.state === 'granted') {
51296
- setShowRecording(true);
51297
- } else {
51298
- recordButtonRef.current.style.pointerEvents = 'none';
51299
- }
51300
- if (recording) {
51301
- stopRecording(true, id, false, recorder);
51302
- } else if (currentRecordedFile) {
51303
- removeAudioRecordingFromMap(id);
51304
- setRecordedFile(null);
51305
- setPlayAudio(false);
51306
- cleanupAudioElement(id);
51307
- setStartRecording(false);
51308
- setShowRecording(false);
51309
- dispatch(setChannelDraftMessageIsRemovedAC(id));
51310
- sendRecordedFile(currentRecordedFile, id);
51311
- } else {
51426
+ try {
51427
+ if (recording) {
51428
+ stopRecording(true, id, false, recorder);
51429
+ } else if (currentRecordedFile) {
51430
+ removeAudioRecordingFromMap(id);
51431
+ setRecordedFile(null);
51432
+ setPlayAudio(false);
51433
+ cleanupAudioElement(id);
51434
+ setStartRecording(false);
51435
+ setShowRecording(false);
51436
+ dispatch(setChannelDraftMessageIsRemovedAC(id));
51437
+ sendRecordedFile(currentRecordedFile, id);
51438
+ } else {
51439
+ if (!recorder) return Promise.resolve();
51440
+ recorder.start().then(function () {
51312
51441
  handleStartRecording();
51313
51442
  setAudioRecordingToMap(id, {
51314
51443
  file: null,
@@ -51316,96 +51445,97 @@ var AudioRecord = function AudioRecord(_ref) {
51316
51445
  thumb: null,
51317
51446
  dur: 0
51318
51447
  });
51319
- recorder.start().then(function () {
51320
- recordButtonRef.current.style.pointerEvents = 'initial';
51321
- setShowRecording(true);
51322
- setStartRecording(true);
51323
- shouldDraw = true;
51324
- var stream = recorder.activeStream;
51325
- var obj = {};
51326
- var init = function init() {
51327
- obj.canvas = document.getElementById("waveform-" + id);
51328
- obj.ctx = obj.canvas.getContext('2d');
51329
- obj.width = 360;
51330
- obj.height = 28;
51331
- obj.canvas.width = obj.width;
51332
- obj.canvas.height = obj.height;
51333
- obj.canvas.style.width = obj.width + 'px';
51334
- obj.canvas.style.height = obj.height + 'px';
51335
- };
51336
- var timeOffset = 100;
51337
- var now = parseInt(performance.now()) / timeOffset;
51338
- var _loop = function loop() {
51339
- if (!shouldDraw) {
51340
- obj.x = 0;
51341
- obj.ctx.clearRect(0, 0, obj.canvas.width, obj.canvas.height);
51342
- if (obj.audioContext && obj.audioContext.state !== 'closed') {
51343
- obj.audioContext.close()["catch"](function () {
51344
- return undefined;
51345
- });
51346
- }
51347
- return;
51348
- }
51448
+ setShowRecording(true);
51449
+ setStartRecording(true);
51450
+ shouldDraw = true;
51451
+ var stream = recorder.activeStream;
51452
+ var obj = {};
51453
+ var init = function init() {
51454
+ obj.canvas = document.getElementById("waveform-" + id);
51455
+ obj.ctx = obj.canvas.getContext('2d');
51456
+ obj.width = 360;
51457
+ obj.height = 28;
51458
+ obj.canvas.width = obj.width;
51459
+ obj.canvas.height = obj.height;
51460
+ obj.canvas.style.width = obj.width + 'px';
51461
+ obj.canvas.style.height = obj.height + 'px';
51462
+ };
51463
+ var timeOffset = 100;
51464
+ var now = parseInt(performance.now()) / timeOffset;
51465
+ var _loop = function loop() {
51466
+ if (!shouldDraw) {
51467
+ obj.x = 0;
51349
51468
  obj.ctx.clearRect(0, 0, obj.canvas.width, obj.canvas.height);
51350
- var max = 0;
51351
- if (parseInt(performance.now() / timeOffset) > now) {
51352
- now = parseInt(performance.now() / timeOffset);
51353
- obj.analyser.getFloatTimeDomainData(obj.frequencyArray);
51354
- for (var i = 0; i < obj.frequencyArray.length; i++) {
51355
- if (obj.frequencyArray[i] > max) {
51356
- max = obj.frequencyArray[i];
51357
- }
51358
- }
51359
- var freq = Math.floor(max * 90);
51360
- if (freq === 0) {
51361
- freq = 1;
51362
- }
51363
- obj.bars.push({
51364
- x: obj.width,
51365
- y: obj.height / 2 - freq / 2,
51366
- height: freq,
51367
- width: 3
51469
+ if (obj.audioContext && obj.audioContext.state !== 'closed') {
51470
+ obj.audioContext.close()["catch"](function () {
51471
+ return undefined;
51368
51472
  });
51369
51473
  }
51370
- draw();
51371
- requestAnimationFrame(_loop);
51372
- };
51373
- obj.bars = [];
51374
- var draw = function draw() {
51375
- for (var i = 0; i < obj.bars.length; i++) {
51376
- var bar = obj.bars[i];
51377
- obj.ctx.fillStyle = textSecondary;
51378
- obj.ctx.fillRect(bar.x, bar.y, bar.width, bar.height);
51379
- bar.x = bar.x - 1;
51380
- if (bar.x < 1) {
51381
- obj.bars.splice(i, 1);
51474
+ return;
51475
+ }
51476
+ obj.ctx.clearRect(0, 0, obj.canvas.width, obj.canvas.height);
51477
+ var max = 0;
51478
+ if (parseInt(performance.now() / timeOffset) > now) {
51479
+ now = parseInt(performance.now() / timeOffset);
51480
+ obj.analyser.getFloatTimeDomainData(obj.frequencyArray);
51481
+ for (var i = 0; i < obj.frequencyArray.length; i++) {
51482
+ if (obj.frequencyArray[i] > max) {
51483
+ max = obj.frequencyArray[i];
51382
51484
  }
51383
51485
  }
51384
- };
51385
- var soundAllowed = function soundAllowed(stream) {
51386
- var AudioContext = window.AudioContext || window.webkitAudioContext;
51387
- var audioContent = new AudioContext();
51388
- obj.audioContext = audioContent;
51389
- var streamSource = audioContent.createMediaStreamSource(stream);
51390
- obj.analyser = audioContent.createAnalyser();
51391
- streamSource.connect(obj.analyser);
51392
- obj.analyser.fftSize = 512;
51393
- obj.frequencyArray = new Float32Array(obj.analyser.fftSize);
51394
- init();
51395
- _loop();
51396
- };
51397
- soundAllowed(stream);
51398
- })["catch"](function (e) {
51399
- handleStopRecording();
51400
- log.error(e);
51401
- });
51402
- }
51403
- });
51404
- }, function (e) {
51405
- handleStopRecording();
51486
+ var freq = Math.floor(max * 90);
51487
+ if (freq === 0) {
51488
+ freq = 1;
51489
+ }
51490
+ obj.bars.push({
51491
+ x: obj.width,
51492
+ y: obj.height / 2 - freq / 2,
51493
+ height: freq,
51494
+ width: 3
51495
+ });
51496
+ }
51497
+ draw();
51498
+ requestAnimationFrame(_loop);
51499
+ };
51500
+ obj.bars = [];
51501
+ var draw = function draw() {
51502
+ for (var i = 0; i < obj.bars.length; i++) {
51503
+ var bar = obj.bars[i];
51504
+ obj.ctx.fillStyle = textSecondary;
51505
+ obj.ctx.fillRect(bar.x, bar.y, bar.width, bar.height);
51506
+ bar.x = bar.x - 1;
51507
+ if (bar.x < 1) {
51508
+ obj.bars.splice(i, 1);
51509
+ }
51510
+ }
51511
+ };
51512
+ var soundAllowed = function soundAllowed(stream) {
51513
+ var AudioContext = window.AudioContext || window.webkitAudioContext;
51514
+ var audioContent = new AudioContext();
51515
+ obj.audioContext = audioContent;
51516
+ var streamSource = audioContent.createMediaStreamSource(stream);
51517
+ obj.analyser = audioContent.createAnalyser();
51518
+ streamSource.connect(obj.analyser);
51519
+ obj.analyser.fftSize = 512;
51520
+ obj.frequencyArray = new Float32Array(obj.analyser.fftSize);
51521
+ init();
51522
+ _loop();
51523
+ };
51524
+ soundAllowed(stream);
51525
+ })["catch"](function (e) {
51526
+ if ((e === null || e === void 0 ? void 0 : e.name) === 'NotAllowedError' || (e === null || e === void 0 ? void 0 : e.name) === 'PermissionDeniedError') {
51527
+ setMicrophonePermissionDenied(true);
51528
+ }
51529
+ log.error(e);
51530
+ });
51531
+ }
51532
+ } catch (e) {
51533
+ if ((e === null || e === void 0 ? void 0 : e.name) === 'NotAllowedError' || (e === null || e === void 0 ? void 0 : e.name) === 'PermissionDeniedError') {
51534
+ setMicrophonePermissionDenied(true);
51535
+ }
51406
51536
  log.error(e);
51407
- });
51408
- return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
51537
+ }
51538
+ return Promise.resolve();
51409
51539
  } catch (e) {
51410
51540
  return Promise.reject(e);
51411
51541
  }
@@ -51730,7 +51860,36 @@ var AudioRecord = function AudioRecord(_ref) {
51730
51860
  return startRecording(currentChannelId);
51731
51861
  },
51732
51862
  iconColor: accentColor
51733
- }, showRecording || currentRecordedFile ? /*#__PURE__*/React__default.createElement(SvgSend, null) : /*#__PURE__*/React__default.createElement(SvgRecordButton, null)));
51863
+ }, showRecording || currentRecordedFile ? /*#__PURE__*/React__default.createElement(SvgSend, null) : /*#__PURE__*/React__default.createElement(SvgRecordButton, null)), microphonePermissionDenied && (/*#__PURE__*/React__default.createElement(PopupContainer, null, /*#__PURE__*/React__default.createElement(Popup, {
51864
+ backgroundColor: background,
51865
+ maxWidth: '520px',
51866
+ minWidth: '520px',
51867
+ padding: '0'
51868
+ }, /*#__PURE__*/React__default.createElement(PopupBody, {
51869
+ paddingH: '24px',
51870
+ paddingV: '24px'
51871
+ }, /*#__PURE__*/React__default.createElement(CloseIcon, {
51872
+ color: iconPrimary,
51873
+ onClick: function onClick() {
51874
+ return setMicrophonePermissionDenied(false);
51875
+ }
51876
+ }), /*#__PURE__*/React__default.createElement(PopupName, {
51877
+ color: textPrimary,
51878
+ marginBottom: '20px'
51879
+ }, "Microphone Permission Denied"), /*#__PURE__*/React__default.createElement(PopupDescription, {
51880
+ color: textPrimary,
51881
+ highlightColor: textSecondary
51882
+ }, "We can't access your microphone. Enable microphone permission in your browser settings and try again.")), /*#__PURE__*/React__default.createElement(PopupFooter, {
51883
+ backgroundColor: surface1
51884
+ }, /*#__PURE__*/React__default.createElement(Button, {
51885
+ type: 'button',
51886
+ backgroundColor: accentColor,
51887
+ color: textOnPrimary,
51888
+ borderRadius: '8px',
51889
+ onClick: function onClick() {
51890
+ return setMicrophonePermissionDenied(false);
51891
+ }
51892
+ }, "Close"))))));
51734
51893
  };
51735
51894
  var AudioRecord$1 = /*#__PURE__*/React.memo(AudioRecord, function (prevProps, nextProps) {
51736
51895
  return prevProps.channelId === nextProps.channelId && prevProps.showRecording === nextProps.showRecording && prevProps.maxRecordingDuration === nextProps.maxRecordingDuration && prevProps.showViewOnceToggle === nextProps.showViewOnceToggle && prevProps.viewOnce === nextProps.viewOnce && prevProps.ViewOnceSelectedSVGIcon === nextProps.ViewOnceSelectedSVGIcon && prevProps.ViewOnceNotSelectedSVGIcon === nextProps.ViewOnceNotSelectedSVGIcon;
@@ -52255,7 +52414,7 @@ var SettingItem = styled__default.div(_templateObject9$i || (_templateObject9$i
52255
52414
  return props.color;
52256
52415
  });
52257
52416
 
52258
- var _templateObject$W, _templateObject2$R, _templateObject3$I, _templateObject4$C, _templateObject5$x, _templateObject6$t, _templateObject7$q, _templateObject8$n, _templateObject9$j, _templateObject0$h, _templateObject1$f, _templateObject10$c, _templateObject11$9, _templateObject12$6, _templateObject13$5, _templateObject14$4, _templateObject15$2, _templateObject16$2, _templateObject17$2, _templateObject18$2, _templateObject19$2, _templateObject20$2, _templateObject21$2, _templateObject22$1, _templateObject23$1, _templateObject24$1, _templateObject25$1, _templateObject26$1, _templateObject27$1, _templateObject28$1, _templateObject29$1, _templateObject30$1, _templateObject31$1, _templateObject32$1, _templateObject33$1, _templateObject34$1, _templateObject35$1, _templateObject36$1, _templateObject37$1, _templateObject38$1, _templateObject39$1, _templateObject40$1, _templateObject41$1, _templateObject42, _templateObject43, _templateObject44, _templateObject45;
52417
+ var _templateObject$W, _templateObject2$R, _templateObject3$I, _templateObject4$C, _templateObject5$x, _templateObject6$t, _templateObject7$q, _templateObject8$n, _templateObject9$j, _templateObject0$h, _templateObject1$f, _templateObject10$c, _templateObject11$9, _templateObject12$7, _templateObject13$6, _templateObject14$4, _templateObject15$2, _templateObject16$2, _templateObject17$2, _templateObject18$2, _templateObject19$2, _templateObject20$2, _templateObject21$2, _templateObject22$1, _templateObject23$1, _templateObject24$1, _templateObject25$1, _templateObject26$1, _templateObject27$1, _templateObject28$1, _templateObject29$1, _templateObject30$1, _templateObject31$1, _templateObject32$1, _templateObject33$1, _templateObject34$1, _templateObject35$1, _templateObject36$1, _templateObject37$1, _templateObject38$1, _templateObject39$1, _templateObject40$1, _templateObject41$1, _templateObject42, _templateObject43, _templateObject44, _templateObject45, _templateObject46;
52259
52418
  function AutoFocusPlugin(_ref) {
52260
52419
  var messageForReply = _ref.messageForReply;
52261
52420
  var _useLexicalComposerCo = LexicalComposerContext.useLexicalComposerContext(),
@@ -52273,12 +52432,16 @@ function ClearEditorPlugin(_ref2) {
52273
52432
  useDidUpdate(function () {
52274
52433
  if (shouldClearEditor.clear) {
52275
52434
  editor.update(function () {
52435
+ var _shouldClearEditor$dr;
52276
52436
  var rootNode = lexical.$getRoot();
52277
52437
  rootNode.clear();
52278
- if (shouldClearEditor.draftMessage) {
52438
+ if ((_shouldClearEditor$dr = shouldClearEditor.draftMessage) !== null && _shouldClearEditor$dr !== void 0 && _shouldClearEditor$dr.editorState) {
52439
+ editor.setEditorState(shouldClearEditor.draftMessage.editorState);
52440
+ } else if (shouldClearEditor.draftMessage) {
52279
52441
  var paragraphNode = lexical.$createParagraphNode();
52280
52442
  paragraphNode.append(lexical.$createTextNode(shouldClearEditor.draftMessage.text));
52281
- editor.setEditorState(shouldClearEditor.draftMessage.editorState);
52443
+ rootNode.append(paragraphNode);
52444
+ rootNode.selectEnd();
52282
52445
  } else {
52283
52446
  var _paragraphNode = lexical.$createParagraphNode();
52284
52447
  rootNode.append(_paragraphNode);
@@ -52318,7 +52481,7 @@ function onError(error) {
52318
52481
  var prevActiveChannelId;
52319
52482
  var attachmentsUpdate = [];
52320
52483
  var SendMessageInput = function SendMessageInput(_ref3) {
52321
- var _linkPreview$metadata9, _linkPreview$metadata0, _linkPreview$metadata1, _linkPreview$metadata10, _linkPreview$metadata11, _linkPreview$metadata12, _linkPreview$metadata13, _linkPreview$metadata14, _linkPreview$metadata15, _linkPreview$metadata16, _linkPreview$metadata17, _linkPreview$metadata18, _pollOptions$choosePo, _getAudioRecordingFro2;
52484
+ var _linkPreview$metadata9, _linkPreview$metadata0, _linkPreview$metadata1, _linkPreview$metadata10, _linkPreview$metadata11, _linkPreview$metadata12, _linkPreview$metadata13, _linkPreview$metadata14, _linkPreview$metadata15, _linkPreview$metadata16, _linkPreview$metadata17, _linkPreview$metadata18, _linkPreview$metadata19, _linkPreview$metadata20, _linkPreview$metadata21, _pollOptions$choosePo, _getAudioRecordingFro2;
52322
52485
  var handleAttachmentSelected = _ref3.handleAttachmentSelected,
52323
52486
  handleSendMessage = _ref3.handleSendMessage,
52324
52487
  _ref3$disabled = _ref3.disabled,
@@ -52455,84 +52618,90 @@ var SendMessageInput = function SendMessageInput(_ref3) {
52455
52618
  var _useState4 = React.useState(''),
52456
52619
  editMessageText = _useState4[0],
52457
52620
  setEditMessageText = _useState4[1];
52458
- var _useState5 = React.useState({}),
52459
- readyVideoAttachments = _useState5[0],
52460
- setReadyVideoAttachments = _useState5[1];
52461
- var _useState6 = React.useState(false),
52462
- showChooseAttachmentType = _useState6[0],
52463
- setShowChooseAttachmentType = _useState6[1];
52621
+ var _useState5 = React.useState(null),
52622
+ restoredEditMessage = _useState5[0],
52623
+ setRestoredEditMessage = _useState5[1];
52624
+ var _useState6 = React.useState({}),
52625
+ readyVideoAttachments = _useState6[0],
52626
+ setReadyVideoAttachments = _useState6[1];
52464
52627
  var _useState7 = React.useState(false),
52465
- isEmojisOpened = _useState7[0],
52466
- setIsEmojisOpened = _useState7[1];
52628
+ showChooseAttachmentType = _useState7[0],
52629
+ setShowChooseAttachmentType = _useState7[1];
52467
52630
  var _useState8 = React.useState(false),
52468
- emojisInRightSide = _useState8[0],
52469
- setEmojisInRightSide = _useState8[1];
52470
- var _useState9 = React.useState(0),
52471
- emojisPopupLeftPosition = _useState9[0],
52472
- setEmojisPopupLeftPosition = _useState9[1];
52631
+ isEmojisOpened = _useState8[0],
52632
+ setIsEmojisOpened = _useState8[1];
52633
+ var _useState9 = React.useState(false),
52634
+ emojisInRightSide = _useState9[0],
52635
+ setEmojisInRightSide = _useState9[1];
52473
52636
  var _useState0 = React.useState(0),
52474
- emojisPopupBottomPosition = _useState0[0],
52475
- setEmojisPopupBottomPosition = _useState0[1];
52476
- var _useState1 = React.useState(false),
52477
- addAttachmentsInRightSide = _useState1[0],
52478
- setAddAttachmentsInRightSide = _useState1[1];
52637
+ emojisPopupLeftPosition = _useState0[0],
52638
+ setEmojisPopupLeftPosition = _useState0[1];
52639
+ var _useState1 = React.useState(0),
52640
+ emojisPopupBottomPosition = _useState1[0],
52641
+ setEmojisPopupBottomPosition = _useState1[1];
52479
52642
  var _useState10 = React.useState(false),
52480
- showPoll = _useState10[0],
52481
- setShowPoll = _useState10[1];
52482
- var _useState11 = React.useState({
52643
+ addAttachmentsInRightSide = _useState10[0],
52644
+ setAddAttachmentsInRightSide = _useState10[1];
52645
+ var _useState11 = React.useState(false),
52646
+ showPoll = _useState11[0],
52647
+ setShowPoll = _useState11[1];
52648
+ var _useState12 = React.useState({
52483
52649
  clear: false
52484
52650
  }),
52485
- shouldClearEditor = _useState11[0],
52486
- setShouldClearEditor = _useState11[1];
52487
- var _useState12 = React.useState([]),
52488
- messageBodyAttributes = _useState12[0],
52489
- setMessageBodyAttributes = _useState12[1];
52651
+ shouldClearEditor = _useState12[0],
52652
+ setShouldClearEditor = _useState12[1];
52490
52653
  var _useState13 = React.useState([]),
52491
- mentionedUsers = _useState13[0],
52492
- setMentionedUsers = _useState13[1];
52493
- var _useState14 = React.useState(''),
52494
- browser = _useState14[0],
52495
- setBrowser = _useState14[1];
52496
- var _useState15 = React.useState(false),
52497
- mentionsIsOpen = _useState15[0],
52498
- setMentionsIsOpen = _useState15[1];
52499
- var _useState16 = React.useState(),
52500
- inputContainerHeight = _useState16[0],
52501
- setInputContainerHeight = _useState16[1];
52502
- var selectedText = React.useRef(null);
52654
+ messageBodyAttributes = _useState13[0],
52655
+ setMessageBodyAttributes = _useState13[1];
52656
+ var _useState14 = React.useState([]),
52657
+ mentionedUsers = _useState14[0],
52658
+ setMentionedUsers = _useState14[1];
52659
+ var _useState15 = React.useState(''),
52660
+ browser = _useState15[0],
52661
+ setBrowser = _useState15[1];
52662
+ var _useState16 = React.useState(false),
52663
+ mentionsIsOpen = _useState16[0],
52664
+ setMentionsIsOpen = _useState16[1];
52503
52665
  var _useState17 = React.useState(),
52504
- typingTimout = _useState17[0],
52505
- setTypingTimout = _useState17[1];
52666
+ inputContainerHeight = _useState17[0],
52667
+ setInputContainerHeight = _useState17[1];
52668
+ var selectedText = React.useRef(null);
52506
52669
  var _useState18 = React.useState(),
52507
- inTypingStateTimout = _useState18[0],
52508
- setInTypingStateTimout = _useState18[1];
52509
- var _useState19 = React.useState(false),
52510
- inTypingState = _useState19[0],
52511
- setInTypingState = _useState19[1];
52670
+ typingTimout = _useState18[0],
52671
+ setTypingTimout = _useState18[1];
52672
+ var _useState19 = React.useState(),
52673
+ inTypingStateTimout = _useState19[0],
52674
+ setInTypingStateTimout = _useState19[1];
52512
52675
  var _useState20 = React.useState(false),
52513
- sendMessageIsActive = _useState20[0],
52514
- setSendMessageIsActive = _useState20[1];
52515
- var _useState21 = React.useState([]),
52516
- attachments = _useState21[0],
52517
- setAttachments = _useState21[1];
52518
- var _useState22 = React.useState(false),
52519
- forwardPopupOpen = _useState22[0],
52520
- setForwardPopupOpen = _useState22[1];
52676
+ inTypingState = _useState20[0],
52677
+ setInTypingState = _useState20[1];
52678
+ var _useState21 = React.useState(false),
52679
+ sendMessageIsActive = _useState21[0],
52680
+ setSendMessageIsActive = _useState21[1];
52681
+ var _useState22 = React.useState([]),
52682
+ attachments = _useState22[0],
52683
+ setAttachments = _useState22[1];
52521
52684
  var _useState23 = React.useState(false),
52522
- deletePopupOpen = _useState23[0],
52523
- setDeletePopupOpen = _useState23[1];
52685
+ forwardPopupOpen = _useState23[0],
52686
+ setForwardPopupOpen = _useState23[1];
52524
52687
  var _useState24 = React.useState(false),
52525
- isIncomingMessage = _useState24[0],
52526
- setIsIncomingMessage = _useState24[1];
52527
- var _useState25 = React.useState('.jpg,.jpeg,.png,.gif,.mp4,.mov,.avi,.wmv,.flv,.webm,.jfif'),
52528
- mediaExtensions = _useState25[0],
52529
- setMediaExtensions = _useState25[1];
52530
- var _useState26 = React.useState(''),
52531
- uploadErrorMessage = _useState26[0],
52532
- setUploadErrorMessage = _useState26[1];
52533
- var _useState27 = React.useState(false),
52534
- viewOnce = _useState27[0],
52535
- setViewOnce = _useState27[1];
52688
+ deletePopupOpen = _useState24[0],
52689
+ setDeletePopupOpen = _useState24[1];
52690
+ var _useState25 = React.useState(false),
52691
+ isIncomingMessage = _useState25[0],
52692
+ setIsIncomingMessage = _useState25[1];
52693
+ var _useState26 = React.useState('.jpg,.jpeg,.png,.gif,.mp4,.mov,.avi,.wmv,.flv,.webm,.jfif'),
52694
+ mediaExtensions = _useState26[0],
52695
+ setMediaExtensions = _useState26[1];
52696
+ var _useState27 = React.useState(''),
52697
+ uploadErrorMessage = _useState27[0],
52698
+ setUploadErrorMessage = _useState27[1];
52699
+ var _useState28 = React.useState(false),
52700
+ viewOnce = _useState28[0],
52701
+ setViewOnce = _useState28[1];
52702
+ var _useState29 = React.useState(areDraftMessagesHydrated()),
52703
+ draftsHydrated = _useState29[0],
52704
+ setDraftsHydrated = _useState29[1];
52536
52705
  var typingOrRecordingIndicator = useSelector(typingOrRecordingIndicatorArraySelector(activeChannel.id));
52537
52706
  var contactsMap = useSelector(contactsMapSelector);
52538
52707
  var connectionStatus = useSelector(connectionStatusSelector, reactRedux.shallowEqual);
@@ -52544,35 +52713,91 @@ var SendMessageInput = function SendMessageInput(_ref3) {
52544
52713
  var addAttachmentsBtnRef = React.useRef(null);
52545
52714
  var metadataDebounceRef = React.useRef(null);
52546
52715
  var sendMessageWrapperRef = React.useRef(null);
52547
- var _useState28 = React.useState(),
52548
- realEditorState = _useState28[0],
52549
- setRealEditorState = _useState28[1];
52550
- var _useState29 = React.useState(null),
52551
- floatingAnchorElem = _useState29[0],
52552
- setFloatingAnchorElem = _useState29[1];
52553
- var _useState30 = React.useState(false),
52554
- isSmallWidthViewport = _useState30[0],
52555
- setIsSmallWidthViewport = _useState30[1];
52556
- var _useState31 = React.useState(false),
52557
- isScrolling = _useState31[0],
52558
- setIsScrolling = _useState31[1];
52559
- var _useState32 = React.useState(null),
52560
- linkPreview = _useState32[0],
52561
- setLinkPreview = _useState32[1];
52562
- var _useState33 = React.useState(null),
52563
- detectedUrl = _useState33[0],
52564
- setDetectedUrl = _useState33[1];
52565
- var _useState34 = React.useState(new Set()),
52566
- dismissedUrls = _useState34[0],
52567
- setDismissedUrls = _useState34[1];
52568
- var _useState35 = React.useState(false),
52569
- isClosingPreview = _useState35[0],
52570
- setIsClosingPreview = _useState35[1];
52716
+ var restoringDraftRef = React.useRef(false);
52717
+ var restoredDraftChannelIdRef = React.useRef(null);
52718
+ var isNavigatingChannelRef = React.useRef(false);
52719
+ var _useState30 = React.useState(),
52720
+ realEditorState = _useState30[0],
52721
+ setRealEditorState = _useState30[1];
52722
+ var _useState31 = React.useState(null),
52723
+ floatingAnchorElem = _useState31[0],
52724
+ setFloatingAnchorElem = _useState31[1];
52725
+ var _useState32 = React.useState(false),
52726
+ isSmallWidthViewport = _useState32[0],
52727
+ setIsSmallWidthViewport = _useState32[1];
52728
+ var _useState33 = React.useState(false),
52729
+ isScrolling = _useState33[0],
52730
+ setIsScrolling = _useState33[1];
52731
+ var _useState34 = React.useState(null),
52732
+ linkPreview = _useState34[0],
52733
+ setLinkPreview = _useState34[1];
52734
+ var _useState35 = React.useState(null),
52735
+ detectedUrl = _useState35[0],
52736
+ setDetectedUrl = _useState35[1];
52737
+ var _useState36 = React.useState(new Set()),
52738
+ dismissedUrls = _useState36[0],
52739
+ setDismissedUrls = _useState36[1];
52740
+ var _useState37 = React.useState(false),
52741
+ isClosingPreview = _useState37[0],
52742
+ setIsClosingPreview = _useState37[1];
52743
+ var _useState38 = React.useState(false),
52744
+ replyLinkPreviewImageFailed = _useState38[0],
52745
+ setReplyLinkPreviewImageFailed = _useState38[1];
52746
+ var _useState39 = React.useState(false),
52747
+ linkPreviewImageFailed = _useState39[0],
52748
+ setLinkPreviewImageFailed = _useState39[1];
52571
52749
  var addAttachmentByMenu = showChooseFileAttachment && showChooseMediaAttachment;
52572
52750
  var linkify = new LinkifyIt();
52573
52751
  var oGMetadata = useSelector(function (state) {
52574
52752
  return state.MessageReducer.oGMetadata;
52575
52753
  });
52754
+ React.useEffect(function () {
52755
+ return subscribeToDraftMessages(function () {
52756
+ return setDraftsHydrated(areDraftMessagesHydrated());
52757
+ });
52758
+ }, []);
52759
+ React.useEffect(function () {
52760
+ if (!draftsHydrated || !activeChannel.id) {
52761
+ return;
52762
+ }
52763
+ var draftMessage = getDraftMessageFromMap(activeChannel.id);
52764
+ if (!draftMessage) {
52765
+ return;
52766
+ }
52767
+ restoringDraftRef.current = true;
52768
+ if (draftMessage.messageToEdit) {
52769
+ var _ref4, _draftMessage$editMes, _draftMessage$editBod, _draftMessage$mention;
52770
+ var restoredText = (_ref4 = (_draftMessage$editMes = draftMessage.editMessageText) != null ? _draftMessage$editMes : draftMessage.messageToEdit.body) != null ? _ref4 : '';
52771
+ var restoredEdit = _extends({}, draftMessage.messageToEdit, {
52772
+ body: restoredText,
52773
+ bodyAttributes: (_draftMessage$editBod = draftMessage.editBodyAttributes) != null ? _draftMessage$editBod : draftMessage.messageToEdit.bodyAttributes,
52774
+ mentionedUsers: (_draftMessage$mention = draftMessage.mentionedUsers) != null ? _draftMessage$mention : draftMessage.messageToEdit.mentionedUsers
52775
+ });
52776
+ setEditMessageText(restoredText);
52777
+ setMessageBodyAttributes(restoredEdit.bodyAttributes || []);
52778
+ setMentionedUsers(restoredEdit.mentionedUsers || []);
52779
+ setRestoredEditMessage(restoredEdit);
52780
+ dispatch(setMessageToEditAC(draftMessage.messageToEdit));
52781
+ restoredDraftChannelIdRef.current = activeChannel.id;
52782
+ return;
52783
+ }
52784
+ setMessageText(draftMessage.text || '');
52785
+ setMentionedUsers(draftMessage.mentionedUsers || []);
52786
+ setAttachments(draftMessage.attachments || []);
52787
+ setViewOnce(!!draftMessage.viewOnce);
52788
+ if (draftMessage.messageForReply) dispatch(setMessageForReplyAC(draftMessage.messageForReply));
52789
+ setShouldClearEditor({
52790
+ clear: true,
52791
+ draftMessage: draftMessage
52792
+ });
52793
+ restoredDraftChannelIdRef.current = activeChannel.id;
52794
+ }, [draftsHydrated, activeChannel.id]);
52795
+ React.useEffect(function () {
52796
+ setReplyLinkPreviewImageFailed(false);
52797
+ }, [messageForReply === null || messageForReply === void 0 ? void 0 : messageForReply.id, messageForReply === null || messageForReply === void 0 ? void 0 : messageForReply.tid]);
52798
+ React.useEffect(function () {
52799
+ setLinkPreviewImageFailed(false);
52800
+ }, [linkPreview === null || linkPreview === void 0 ? void 0 : linkPreview.url]);
52576
52801
  var closePreviewWithAnimation = function closePreviewWithAnimation(callback) {
52577
52802
  if (linkPreview) {
52578
52803
  setIsClosingPreview(true);
@@ -52685,7 +52910,15 @@ var SendMessageInput = function SendMessageInput(_ref3) {
52685
52910
  dispatch(sendTypingAC(typingState));
52686
52911
  }
52687
52912
  };
52688
- var handleCloseReply = function handleCloseReply() {
52913
+ var handleCloseReply = function handleCloseReply(preserveDraft) {
52914
+ if (preserveDraft === void 0) {
52915
+ preserveDraft = false;
52916
+ }
52917
+ var shouldPreserveDraft = preserveDraft === true;
52918
+ if (!shouldPreserveDraft && !messageText.trim() && !attachments.length) {
52919
+ removeDraftMessageFromMap(activeChannel.id);
52920
+ dispatch(setChannelDraftMessageIsRemovedAC(activeChannel.id));
52921
+ }
52689
52922
  dispatch(setMessageForReplyAC(null));
52690
52923
  };
52691
52924
  var handleDoubleClick = function handleDoubleClick(e) {
@@ -52805,12 +53038,14 @@ var SendMessageInput = function SendMessageInput(_ref3) {
52805
53038
  return {
52806
53039
  name: attachment.data.name,
52807
53040
  data: attachment.data,
53041
+ attachmentUrl: attachment.attachmentUrl,
52808
53042
  tid: attachment.tid,
52809
53043
  cachedUrl: attachment.cachedUrl,
52810
53044
  upload: attachment.upload,
52811
53045
  metadata: attachment.metadata,
52812
53046
  type: attachment.type,
52813
- size: attachment.size
53047
+ size: attachment.size,
53048
+ thumbnailState: attachment.thumbnailState
52814
53049
  };
52815
53050
  });
52816
53051
  if (viewOnce && canShowViewOnceToggle) {
@@ -52834,6 +53069,8 @@ var SendMessageInput = function SendMessageInput(_ref3) {
52834
53069
  }
52835
53070
  setAttachments([]);
52836
53071
  attachmentsUpdate = [];
53072
+ removeDraftMessageFromMap(activeChannel.id);
53073
+ dispatch(setChannelDraftMessageIsRemovedAC(activeChannel.id));
52837
53074
  setViewOnce(false);
52838
53075
  handleCloseReply();
52839
53076
  setShouldClearEditor({
@@ -52944,8 +53181,16 @@ var SendMessageInput = function SendMessageInput(_ref3) {
52944
53181
  }
52945
53182
  handleCloseEditMode();
52946
53183
  };
52947
- var handleCloseEditMode = function handleCloseEditMode() {
53184
+ var handleCloseEditMode = function handleCloseEditMode(preserveDraft) {
53185
+ if (preserveDraft === void 0) {
53186
+ preserveDraft = false;
53187
+ }
53188
+ if (!preserveDraft && messageToEdit) {
53189
+ removeDraftMessageFromMap(activeChannel.id);
53190
+ dispatch(setChannelDraftMessageIsRemovedAC(activeChannel.id));
53191
+ }
52948
53192
  setEditMessageText('');
53193
+ setRestoredEditMessage(null);
52949
53194
  setMentionedUsers([]);
52950
53195
  dispatch(setMessageToEditAC(null));
52951
53196
  };
@@ -52954,10 +53199,14 @@ var SendMessageInput = function SendMessageInput(_ref3) {
52954
53199
  var updatedAttachments = attachmentsUpdate.filter(function (item) {
52955
53200
  return item.tid !== attachmentId;
52956
53201
  });
53202
+ clearVideoPreparation(attachmentId);
52957
53203
  releaseBlobUrls(["compose_" + attachmentId]);
52958
53204
  setAttachments(updatedAttachments);
52959
53205
  attachmentsUpdate = updatedAttachments;
52960
53206
  } else {
53207
+ attachmentsUpdate.forEach(function (attachment) {
53208
+ return clearVideoPreparation(attachment.tid);
53209
+ });
52961
53210
  releaseBlobUrls(attachmentsUpdate.map(function (item) {
52962
53211
  return "compose_" + item.tid;
52963
53212
  }));
@@ -53109,10 +53358,6 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53109
53358
  }
53110
53359
  }
53111
53360
  };
53112
- var handleCut = function handleCut() {
53113
- setMessageText('');
53114
- setMentionedUsers([]);
53115
- };
53116
53361
  var handleEmojiPopupToggle = function handleEmojiPopupToggle(bool) {
53117
53362
  setIsEmojisOpened(bool);
53118
53363
  };
@@ -53189,260 +53434,214 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53189
53434
  };
53190
53435
  var handleAddAttachment = function handleAddAttachment(file, isMediaAttachment) {
53191
53436
  try {
53192
- var _temp4 = function _temp4() {
53193
- var fileType = file.type.split('/')[0];
53194
- var tid = uuid.v4();
53195
- var reader = new FileReader();
53196
- var handleAttachmentImageForCache = function handleAttachmentImageForCache(attachment) {
53197
- try {
53198
- var _attachment$metadata;
53199
- var url = URL.createObjectURL(attachment.data);
53200
- dispatch(setUpdateMessageAttachmentAC((attachment === null || attachment === void 0 ? void 0 : (_attachment$metadata = attachment.metadata) === null || _attachment$metadata === void 0 ? void 0 : _attachment$metadata.tmb) || '', url));
53201
- return Promise.resolve();
53202
- } catch (e) {
53203
- return Promise.reject(e);
53204
- }
53205
- };
53206
- var handleAttachmentVideoForCache = function handleAttachmentVideoForCache(attachment) {
53207
- try {
53208
- var _calculateRenderedIma = calculateRenderedImageWidth(attachment.metadata.szh || 400, attachment.metadata.szh || 400),
53209
- newWidth = _calculateRenderedIma[0],
53210
- newHeight = _calculateRenderedIma[1];
53211
- return Promise.resolve(getVideoFirstFrame(attachment.data, newWidth, newHeight)).then(function (result) {
53212
- if (result) {
53213
- var _attachment$metadata2;
53214
- var frameBlobUrl = result.frameBlobUrl;
53215
- dispatch(setUpdateMessageAttachmentAC((attachment === null || attachment === void 0 ? void 0 : (_attachment$metadata2 = attachment.metadata) === null || _attachment$metadata2 === void 0 ? void 0 : _attachment$metadata2.tmb) || '', frameBlobUrl));
53216
- }
53217
- });
53218
- } catch (e) {
53219
- return Promise.reject(e);
53220
- }
53221
- };
53222
- reader.onload = function () {
53223
- try {
53224
- setPendingAttachment(tid, {
53225
- file: file
53226
- });
53227
- var _temp0 = function () {
53228
- if (customUploader) {
53229
- var _temp6 = function () {
53230
- if (fileType === 'image') {
53231
- resizeImage(file).then(function (resizedFile) {
53232
- try {
53233
- return Promise.resolve(createImageThumbnail(file)).then(function (_ref4) {
53234
- var _resizedFile$blob;
53235
- var thumbnail = _ref4.thumbnail,
53236
- imageWidth = _ref4.imageWidth,
53237
- imageHeight = _ref4.imageHeight;
53238
- var attachment = {
53239
- data: file,
53240
- upload: false,
53241
- type: isMediaAttachment ? fileType : 'file',
53242
- attachmentUrl: createComposePreviewUrl(tid, resizedFile.blob),
53243
- tid: tid,
53244
- size: isMediaAttachment ? resizedFile !== null && resizedFile !== void 0 && resizedFile.blob ? resizedFile === null || resizedFile === void 0 ? void 0 : (_resizedFile$blob = resizedFile.blob) === null || _resizedFile$blob === void 0 ? void 0 : _resizedFile$blob.size : file.size : file.size,
53245
- metadata: {
53246
- szw: imageWidth,
53247
- szh: imageHeight,
53248
- tmb: thumbnail
53249
- }
53250
- };
53251
- handleAttachmentImageForCache(attachment);
53252
- setAttachments(function (prevState) {
53253
- return [].concat(prevState, [attachment]);
53254
- });
53255
- });
53256
- } catch (e) {
53257
- return Promise.reject(e);
53258
- }
53259
- });
53260
- } else {
53261
- var _temp1 = function () {
53262
- if (fileType === 'video') {
53263
- return Promise.resolve(getFrame(file, 0)).then(function (_ref5) {
53264
- var thumb = _ref5.thumb,
53265
- width = _ref5.width,
53266
- height = _ref5.height,
53267
- duration = _ref5.duration;
53268
- var attachment = {
53269
- data: file,
53270
- upload: false,
53271
- type: isMediaAttachment ? fileType : 'file',
53272
- attachmentUrl: createComposePreviewUrl(tid, file),
53273
- tid: tid,
53274
- size: file.size,
53275
- metadata: {
53276
- szw: width,
53277
- szh: height,
53278
- tmb: thumb,
53279
- dur: duration
53280
- }
53281
- };
53282
- handleAttachmentVideoForCache(attachment);
53283
- setAttachments(function (prevState) {
53284
- return [].concat(prevState, [attachment]);
53285
- });
53286
- });
53287
- } else {
53288
- setAttachments(function (prevState) {
53289
- return [].concat(prevState, [{
53290
- data: file,
53291
- upload: false,
53292
- type: 'file',
53293
- tid: tid,
53294
- size: file.size
53295
- }]);
53296
- });
53297
- }
53298
- }();
53299
- if (_temp1 && _temp1.then) return _temp1.then(function () {});
53300
- }
53301
- }();
53302
- if (_temp6 && _temp6.then) return _temp6.then(function () {});
53303
- } else {
53304
- var _temp9 = function () {
53305
- if (fileType === 'image') {
53306
- var _temp7 = function () {
53307
- if (isMediaAttachment) {
53308
- return Promise.resolve(createImageThumbnail(file)).then(function (_ref6) {
53309
- var thumbnail = _ref6.thumbnail,
53310
- imageWidth = _ref6.imageWidth,
53311
- imageHeight = _ref6.imageHeight;
53312
- var metas = {
53313
- thumbnail: thumbnail,
53314
- imageWidth: imageWidth,
53315
- imageHeight: imageHeight
53316
- };
53317
- if (file.type === 'image/gif') {
53318
- setAttachments(function (prevState) {
53319
- return [].concat(prevState, [{
53320
- data: file,
53321
- upload: true,
53322
- attachmentUrl: createComposePreviewUrl(tid, file),
53323
- tid: tid,
53324
- type: fileType,
53325
- size: file.size,
53326
- metadata: JSON.stringify({
53327
- tmb: metas.thumbnail,
53328
- szw: metas.imageWidth,
53329
- szh: metas.imageHeight
53330
- })
53331
- }]);
53332
- });
53333
- } else {
53334
- resizeImage(file).then(function (resizedFileData) {
53335
- try {
53336
- var resizedFile = new File([resizedFileData.blob], resizedFileData.file.name);
53337
- var attachment = {
53338
- data: resizedFile,
53339
- upload: true,
53340
- attachmentUrl: createComposePreviewUrl(tid, resizedFile),
53341
- tid: tid,
53342
- type: fileType,
53343
- size: resizedFile.size,
53344
- metadata: JSON.stringify({
53345
- tmb: metas.thumbnail,
53346
- szw: resizedFileData.newWidth,
53347
- szh: resizedFileData.newHeight
53348
- })
53349
- };
53350
- handleAttachmentImageForCache(attachment);
53351
- setAttachments(function (prevState) {
53352
- return [].concat(prevState, [attachment]);
53353
- });
53354
- return Promise.resolve();
53355
- } catch (e) {
53356
- return Promise.reject(e);
53357
- }
53358
- });
53437
+ var customUploader = getCustomUploader();
53438
+ var fileType = file.type.split('/')[0];
53439
+ var tid = uuid.v4();
53440
+ var handleAttachmentImageForCache = function handleAttachmentImageForCache(attachment) {
53441
+ try {
53442
+ var _attachment$metadata;
53443
+ var url = URL.createObjectURL(attachment.data);
53444
+ dispatch(setUpdateMessageAttachmentAC((attachment === null || attachment === void 0 ? void 0 : (_attachment$metadata = attachment.metadata) === null || _attachment$metadata === void 0 ? void 0 : _attachment$metadata.tmb) || '', url));
53445
+ return Promise.resolve();
53446
+ } catch (e) {
53447
+ return Promise.reject(e);
53448
+ }
53449
+ };
53450
+ var handleAttachmentVideoForCache = function handleAttachmentVideoForCache(attachment) {
53451
+ try {
53452
+ var _calculateRenderedIma = calculateRenderedImageWidth(attachment.metadata.szh || 400, attachment.metadata.szh || 400),
53453
+ newWidth = _calculateRenderedIma[0],
53454
+ newHeight = _calculateRenderedIma[1];
53455
+ return Promise.resolve(getVideoFirstFrame(attachment.data, newWidth, newHeight)).then(function (result) {
53456
+ if (result) {
53457
+ var _attachment$metadata2;
53458
+ var frameBlobUrl = result.frameBlobUrl;
53459
+ dispatch(setUpdateMessageAttachmentAC((attachment === null || attachment === void 0 ? void 0 : (_attachment$metadata2 = attachment.metadata) === null || _attachment$metadata2 === void 0 ? void 0 : _attachment$metadata2.tmb) || '', frameBlobUrl));
53460
+ }
53461
+ });
53462
+ } catch (e) {
53463
+ return Promise.reject(e);
53464
+ }
53465
+ };
53466
+ setPendingAttachment(tid, {
53467
+ file: file
53468
+ });
53469
+ if (fileType === 'video') {
53470
+ beginVideoPreparation(tid, file);
53471
+ }
53472
+ var type = fileType === 'video' && (!customUploader || isMediaAttachment) ? 'video' : isMediaAttachment && fileType === 'image' ? 'image' : 'file';
53473
+ var attachment = _extends({
53474
+ data: file,
53475
+ name: file.name,
53476
+ upload: !customUploader,
53477
+ type: type,
53478
+ tid: tid,
53479
+ size: file.size
53480
+ }, fileType === 'video' && !isMediaAttachment ? {
53481
+ thumbnailState: 'loading'
53482
+ } : {}, fileType === 'image' || fileType === 'video' ? {
53483
+ attachmentUrl: createComposePreviewUrl(tid, file),
53484
+ metadata: customUploader ? {} : '{}'
53485
+ } : {});
53486
+ setAttachments(function (prevState) {
53487
+ return [].concat(prevState, [attachment]);
53488
+ });
53489
+ var updateAttachment = function updateAttachment(patch) {
53490
+ setAttachments(function (prevState) {
53491
+ return prevState.map(function (current) {
53492
+ return current.tid === tid ? _extends({}, current, patch) : current;
53493
+ });
53494
+ });
53495
+ };
53496
+ setTimeout(function () {
53497
+ try {
53498
+ var _temp1 = function () {
53499
+ if (fileType === 'image') {
53500
+ var _temp5 = _catch(function () {
53501
+ return Promise.resolve(createImageThumbnail(file)).then(function (_ref5) {
53502
+ var thumbnail = _ref5.thumbnail,
53503
+ imageWidth = _ref5.imageWidth,
53504
+ imageHeight = _ref5.imageHeight;
53505
+ var _temp4 = function () {
53506
+ if (customUploader) {
53507
+ return Promise.resolve(resizeImage(file)).then(function (resizedFile) {
53508
+ var patch = {
53509
+ size: isMediaAttachment && resizedFile !== null && resizedFile !== void 0 && resizedFile.blob ? resizedFile.blob.size : file.size,
53510
+ metadata: {
53511
+ szw: imageWidth,
53512
+ szh: imageHeight,
53513
+ tmb: thumbnail
53359
53514
  }
53360
- });
53361
- } else {
53362
- return Promise.resolve(createImageThumbnail(file, undefined, 50, 50)).then(function (_ref7) {
53363
- var thumbnail = _ref7.thumbnail;
53364
- setAttachments(function (prevState) {
53365
- return [].concat(prevState, [{
53366
- data: file,
53367
- type: 'file',
53368
- upload: true,
53369
- attachmentUrl: createComposePreviewUrl(tid, file),
53370
- tid: tid,
53371
- size: file.size,
53515
+ };
53516
+ updateAttachment(patch);
53517
+ handleAttachmentImageForCache(_extends({}, attachment, patch));
53518
+ });
53519
+ } else {
53520
+ var _temp10 = function () {
53521
+ if (isMediaAttachment && file.type !== 'image/gif') {
53522
+ return Promise.resolve(resizeImage(file)).then(function (resizedFileData) {
53523
+ var resizedFile = resizedFileData.blob ? new File([resizedFileData.blob], resizedFileData.file.name, {
53524
+ type: file.type
53525
+ }) : file;
53526
+ var patch = {
53527
+ data: resizedFile,
53528
+ size: resizedFile.size,
53372
53529
  metadata: JSON.stringify({
53373
- tmb: thumbnail
53530
+ tmb: thumbnail,
53531
+ szw: resizedFileData.newWidth,
53532
+ szh: resizedFileData.newHeight
53374
53533
  })
53375
- }]);
53534
+ };
53535
+ updateAttachment(patch);
53536
+ setPendingAttachment(tid, {
53537
+ file: resizedFile
53538
+ });
53539
+ handleAttachmentImageForCache(_extends({}, attachment, patch));
53540
+ });
53541
+ } else {
53542
+ updateAttachment({
53543
+ metadata: JSON.stringify({
53544
+ tmb: thumbnail,
53545
+ szw: imageWidth,
53546
+ szh: imageHeight
53547
+ })
53376
53548
  });
53549
+ }
53550
+ }();
53551
+ if (_temp10 && _temp10.then) return _temp10.then(function () {});
53552
+ }
53553
+ }();
53554
+ if (_temp4 && _temp4.then) return _temp4.then(function () {});
53555
+ });
53556
+ }, function (error) {
53557
+ log.warn('Unable to prepare image attachment preview:', error);
53558
+ });
53559
+ if (_temp5 && _temp5.then) return _temp5.then(function () {});
53560
+ } else {
53561
+ var _temp11 = function () {
53562
+ if (fileType === 'video') {
53563
+ var _temp9 = function _temp9() {
53564
+ return Promise.resolve(remuxPromise).then(function (uploadFile) {
53565
+ if (uploadFile !== file) {
53566
+ updateAttachment({
53567
+ data: uploadFile,
53568
+ size: uploadFile.size
53569
+ });
53570
+ setPendingAttachment(tid, {
53571
+ file: uploadFile
53377
53572
  });
53378
53573
  }
53379
- }();
53380
- if (_temp7 && _temp7.then) return _temp7.then(function () {});
53381
- } else {
53382
- var _temp10 = function () {
53383
- if (fileType === 'video') {
53384
- return Promise.resolve(getFrame(file, 0)).then(function (_ref8) {
53385
- var thumb = _ref8.thumb,
53386
- width = _ref8.width,
53387
- height = _ref8.height,
53388
- duration = _ref8.duration;
53389
- var metas = JSON.stringify({
53390
- tmb: thumb,
53391
- width: width,
53392
- height: height,
53393
- dur: duration
53394
- });
53395
- var attachment = {
53396
- data: file,
53397
- type: 'video',
53398
- upload: true,
53399
- size: file.size,
53400
- attachmentUrl: createComposePreviewUrl(tid, file),
53401
- tid: tid,
53402
- metadata: metas
53403
- };
53404
- handleAttachmentVideoForCache(attachment);
53405
- setAttachments(function (prevState) {
53406
- return [].concat(prevState, [attachment]);
53407
- });
53574
+ if (metadata) {
53575
+ completeVideoPreparation(tid, {
53576
+ file: uploadFile,
53577
+ metadata: metadata
53408
53578
  });
53409
53579
  } else {
53410
- setAttachments(function (prevState) {
53411
- return [].concat(prevState, [{
53412
- data: file,
53413
- upload: true,
53414
- type: 'file',
53415
- size: file.size,
53416
- tid: tid
53417
- }]);
53580
+ failVideoPreparation(tid);
53581
+ updateAttachment({
53582
+ thumbnailState: 'failed'
53418
53583
  });
53419
53584
  }
53420
- }();
53421
- if (_temp10 && _temp10.then) return _temp10.then(function () {});
53422
- }
53423
- }();
53424
- if (_temp9 && _temp9.then) return _temp9.then(function () {});
53425
- }
53426
- }();
53427
- return Promise.resolve(_temp0 && _temp0.then ? _temp0.then(function () {}) : void 0);
53428
- } catch (e) {
53429
- return Promise.reject(e);
53430
- }
53431
- };
53432
- reader.onerror = function (e) {
53433
- log.info(' error on read file onError', e);
53434
- };
53435
- reader.readAsBinaryString(file);
53436
- };
53437
- var customUploader = getCustomUploader();
53438
- var _temp3 = function () {
53439
- if (file.type.split('/')[0] === 'video') {
53440
- return Promise.resolve(remuxVideoFileForUpload(file)).then(function (_remuxVideoFileForUpl) {
53441
- file = _remuxVideoFileForUpl;
53442
- });
53585
+ });
53586
+ };
53587
+ var remuxPromise = remuxVideoFileForUpload(file);
53588
+ var thumbnailSource = file;
53589
+ var metadata;
53590
+ var _temp8 = _catch(function () {
53591
+ function _temp7() {
53592
+ var _frame = frame,
53593
+ thumb = _frame.thumb,
53594
+ width = _frame.width,
53595
+ height = _frame.height,
53596
+ duration = _frame.duration;
53597
+ metadata = customUploader ? {
53598
+ szw: width,
53599
+ szh: height,
53600
+ tmb: thumb,
53601
+ dur: duration
53602
+ } : JSON.stringify({
53603
+ tmb: thumb,
53604
+ szw: width,
53605
+ szh: height,
53606
+ dur: duration
53607
+ });
53608
+ updateAttachment({
53609
+ metadata: metadata,
53610
+ thumbnailState: 'ready'
53611
+ });
53612
+ handleAttachmentVideoForCache(_extends({}, attachment, {
53613
+ metadata: metadata
53614
+ }));
53615
+ }
53616
+ var frame;
53617
+ var _temp6 = _catch(function () {
53618
+ return Promise.resolve(getFrame(thumbnailSource, 0)).then(function (_getFrame) {
53619
+ frame = _getFrame;
53620
+ });
53621
+ }, function () {
53622
+ return Promise.resolve(remuxPromise).then(function (_remuxPromise) {
53623
+ thumbnailSource = _remuxPromise;
53624
+ return Promise.resolve(getFrame(thumbnailSource, 0)).then(function (_getFrame2) {
53625
+ frame = _getFrame2;
53626
+ });
53627
+ });
53628
+ });
53629
+ return _temp6 && _temp6.then ? _temp6.then(_temp7) : _temp7(_temp6);
53630
+ }, function (error) {
53631
+ log.warn('Unable to generate video thumbnail:', error);
53632
+ });
53633
+ return _temp8 && _temp8.then ? _temp8.then(_temp9) : _temp9(_temp8);
53634
+ }
53635
+ }();
53636
+ if (_temp11 && _temp11.then) return _temp11.then(function () {});
53637
+ }
53638
+ }();
53639
+ return Promise.resolve(_temp1 && _temp1.then ? _temp1.then(function () {}) : void 0);
53640
+ } catch (e) {
53641
+ return Promise.reject(e);
53443
53642
  }
53444
- }();
53445
- return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3));
53643
+ }, 0);
53644
+ return Promise.resolve();
53446
53645
  } catch (e) {
53447
53646
  return Promise.reject(e);
53448
53647
  }
@@ -53501,14 +53700,14 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53501
53700
  }
53502
53701
  }
53503
53702
  }
53504
- var _temp11 = function () {
53703
+ var _temp12 = function () {
53505
53704
  if (allowUpload) {
53506
53705
  return Promise.resolve(handleAddAttachmentWithViewOnceCheck(file, isMediaAttachment)).then(function () {});
53507
53706
  } else {
53508
53707
  showFileUploadError(errorMessage);
53509
53708
  }
53510
53709
  }();
53511
- return Promise.resolve(_temp11 && _temp11.then ? _temp11.then(function () {}) : void 0);
53710
+ return Promise.resolve(_temp12 && _temp12.then ? _temp12.then(function () {}) : void 0);
53512
53711
  } catch (e) {
53513
53712
  return Promise.reject(e);
53514
53713
  }
@@ -53582,23 +53781,53 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53582
53781
  React.useEffect(function () {
53583
53782
  if (prevActiveChannelId && activeChannel.id && prevActiveChannelId !== activeChannel.id) {
53584
53783
  setMessageText('');
53585
- handleCloseReply();
53784
+ if (messageForReply) {
53785
+ isNavigatingChannelRef.current = true;
53786
+ handleCloseReply(true);
53787
+ }
53586
53788
  setAttachments([]);
53587
53789
  attachmentsUpdate = [];
53588
- handleCloseEditMode();
53790
+ handleCloseEditMode(!!messageToEdit);
53589
53791
  clearTimeout(typingTimout);
53590
53792
  var draftMessage = getDraftMessageFromMap(activeChannel.id);
53591
53793
  if (draftMessage) {
53592
- if (draftMessage.messageForReply) {
53593
- dispatch(setMessageForReplyAC(draftMessage.messageForReply));
53794
+ restoringDraftRef.current = true;
53795
+ if (draftMessage.messageToEdit) {
53796
+ var _ref6, _draftMessage$editMes2, _draftMessage$editBod2, _draftMessage$mention2;
53797
+ var restoredText = (_ref6 = (_draftMessage$editMes2 = draftMessage.editMessageText) != null ? _draftMessage$editMes2 : draftMessage.messageToEdit.body) != null ? _ref6 : '';
53798
+ var restoredEdit = _extends({}, draftMessage.messageToEdit, {
53799
+ body: restoredText,
53800
+ bodyAttributes: (_draftMessage$editBod2 = draftMessage.editBodyAttributes) != null ? _draftMessage$editBod2 : draftMessage.messageToEdit.bodyAttributes,
53801
+ mentionedUsers: (_draftMessage$mention2 = draftMessage.mentionedUsers) != null ? _draftMessage$mention2 : draftMessage.messageToEdit.mentionedUsers
53802
+ });
53803
+ setEditMessageText(restoredText);
53804
+ setMessageBodyAttributes(restoredEdit.bodyAttributes || []);
53805
+ setMentionedUsers(restoredEdit.mentionedUsers || []);
53806
+ setRestoredEditMessage(restoredEdit);
53807
+ dispatch(setMessageToEditAC(draftMessage.messageToEdit));
53808
+ restoredDraftChannelIdRef.current = activeChannel.id;
53809
+ }
53810
+ if (!draftMessage.messageToEdit) {
53811
+ if (draftMessage.messageForReply) {
53812
+ dispatch(setMessageForReplyAC(draftMessage.messageForReply));
53813
+ }
53814
+ setMessageText(draftMessage.text);
53815
+ setMentionedUsers(draftMessage.mentionedUsers);
53816
+ setAttachments(draftMessage.attachments || []);
53817
+ setViewOnce(!!draftMessage.viewOnce);
53818
+ restoredDraftChannelIdRef.current = activeChannel.id;
53819
+ setShouldClearEditor({
53820
+ clear: true,
53821
+ draftMessage: draftMessage
53822
+ });
53594
53823
  }
53595
- setMessageText(draftMessage.text);
53596
- setMentionedUsers(draftMessage.mentionedUsers);
53824
+ } else {
53825
+ setMentionedUsers([]);
53826
+ setShouldClearEditor({
53827
+ clear: true,
53828
+ draftMessage: draftMessage
53829
+ });
53597
53830
  }
53598
- setShouldClearEditor({
53599
- clear: true,
53600
- draftMessage: draftMessage
53601
- });
53602
53831
  }
53603
53832
  if (activeChannel.id) {
53604
53833
  prevActiveChannelId = activeChannel.id;
@@ -53606,23 +53835,38 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53606
53835
  if (activeChannel.id && membersHasNext === undefined && !(activeChannel.type === DEFAULT_CHANNEL_TYPE.DIRECT && activeChannel.memberCount === 2)) {
53607
53836
  dispatch(getMembersAC(activeChannel.id));
53608
53837
  }
53609
- setMentionedUsers([]);
53610
53838
  }, [activeChannel.id]);
53611
53839
  React.useEffect(function () {
53840
+ if (!draftsHydrated) {
53841
+ return;
53842
+ }
53843
+ if (restoringDraftRef.current) {
53844
+ restoringDraftRef.current = false;
53845
+ return;
53846
+ }
53847
+ if (messageToEdit) {
53848
+ var persistedEditText = editMessageText || messageToEdit.body || '';
53849
+ var normalizeAttrs = function normalizeAttrs(attrs) {
53850
+ return !attrs || attrs.length === 0 ? [] : attrs;
53851
+ };
53852
+ var hasTextChanged = editMessageText !== messageToEdit.body;
53853
+ var hasAttributesChanged = !compareMessageBodyAttributes(normalizeAttrs(messageBodyAttributes), normalizeAttrs(messageToEdit.bodyAttributes));
53854
+ var canSubmitEdit = !!editMessageText.trim() && (hasTextChanged || hasAttributesChanged);
53855
+ setSendMessageIsActive(canSubmitEdit);
53856
+ setDraftMessageToMap(activeChannel.id, {
53857
+ text: persistedEditText || 'Edit message',
53858
+ mentionedUsers: mentionedUsers,
53859
+ messageToEdit: messageToEdit,
53860
+ editMessageText: persistedEditText,
53861
+ editBodyAttributes: messageBodyAttributes
53862
+ }, {
53863
+ persist: canSubmitEdit
53864
+ });
53865
+ return;
53866
+ }
53612
53867
  if (messageText.trim() || editMessageText !== null && editMessageText !== void 0 && editMessageText.trim() && editMessageText && (editMessageText === null || editMessageText === void 0 ? void 0 : editMessageText.trim()) !== (messageToEdit === null || messageToEdit === void 0 ? void 0 : messageToEdit.body) || attachments.length) {
53613
53868
  if (attachments.length) {
53614
- var videoAttachment = false;
53615
- attachments.forEach(function (att) {
53616
- if ((att.type === 'video' || att.data.type.split('/')[0] === 'video') && att.type !== 'file') {
53617
- videoAttachment = true;
53618
- if (readyVideoAttachments[att.tid]) {
53619
- setSendMessageIsActive(true);
53620
- }
53621
- }
53622
- });
53623
- if (!videoAttachment) {
53624
- setSendMessageIsActive(true);
53625
- }
53869
+ setSendMessageIsActive(true);
53626
53870
  } else {
53627
53871
  setSendMessageIsActive(true);
53628
53872
  }
@@ -53633,15 +53877,17 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53633
53877
  setSendMessageIsActive(false);
53634
53878
  }
53635
53879
  }
53636
- if (messageText.trim()) {
53637
- var draftMessage = getDraftMessageFromMap(activeChannel.id);
53880
+ var draftMessage = getDraftMessageFromMap(activeChannel.id);
53881
+ if (messageText.trim() || attachments.length) {
53638
53882
  if (draftMessage && draftMessage.mentionedUsers && draftMessage.mentionedUsers.length) {
53639
53883
  setDraftMessageToMap(activeChannel.id, {
53640
53884
  text: messageText,
53641
53885
  mentionedUsers: draftMessage.mentionedUsers,
53642
53886
  messageForReply: messageForReply,
53643
53887
  editorState: realEditorState,
53644
- bodyAttributes: messageBodyAttributes
53888
+ bodyAttributes: messageBodyAttributes,
53889
+ attachments: attachments,
53890
+ viewOnce: viewOnce
53645
53891
  });
53646
53892
  } else {
53647
53893
  setDraftMessageToMap(activeChannel.id, {
@@ -53649,14 +53895,30 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53649
53895
  mentionedUsers: mentionedUsers,
53650
53896
  messageForReply: messageForReply,
53651
53897
  editorState: realEditorState,
53652
- bodyAttributes: messageBodyAttributes
53898
+ bodyAttributes: messageBodyAttributes,
53899
+ attachments: attachments,
53900
+ viewOnce: viewOnce
53653
53901
  });
53654
53902
  }
53655
53903
  if (!listenerIsAdded) {
53656
53904
  setListenerIsAdded(true);
53657
53905
  document.body.setAttribute('onbeforeunload', "return () => 'reload?'");
53658
53906
  }
53659
- } else if (getDraftMessageFromMap(activeChannel.id)) {
53907
+ } else if (messageForReply || draftMessage !== null && draftMessage !== void 0 && draftMessage.messageForReply) {
53908
+ setDraftMessageToMap(activeChannel.id, {
53909
+ text: '',
53910
+ mentionedUsers: (draftMessage === null || draftMessage === void 0 ? void 0 : draftMessage.mentionedUsers) || mentionedUsers,
53911
+ messageForReply: messageForReply || (draftMessage === null || draftMessage === void 0 ? void 0 : draftMessage.messageForReply),
53912
+ bodyAttributes: messageBodyAttributes,
53913
+ attachments: [],
53914
+ viewOnce: false
53915
+ }, {
53916
+ persist: false
53917
+ });
53918
+ } else if (draftMessage) {
53919
+ if (restoredDraftChannelIdRef.current && restoredDraftChannelIdRef.current !== activeChannel.id) {
53920
+ return;
53921
+ }
53660
53922
  removeDraftMessageFromMap(activeChannel.id);
53661
53923
  dispatch(setChannelDraftMessageIsRemovedAC(activeChannel.id));
53662
53924
  if (checkDraftMessagesIsEmpty() && listenerIsAdded) {
@@ -53664,14 +53926,18 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53664
53926
  document.body.removeAttribute('onbeforeunload');
53665
53927
  }
53666
53928
  }
53667
- }, [messageText, attachments, editMessageText, readyVideoAttachments, messageBodyAttributes, messageToEdit]);
53929
+ }, [messageText, attachments, editMessageText, readyVideoAttachments, messageBodyAttributes, messageToEdit, viewOnce, draftsHydrated]);
53668
53930
  useDidUpdate(function () {
53669
- if (mentionedUsers && mentionedUsers.length) {
53931
+ if (!messageToEdit && mentionedUsers && mentionedUsers.length) {
53670
53932
  setDraftMessageToMap(activeChannel.id, {
53671
53933
  text: messageText,
53672
53934
  mentionedUsers: mentionedUsers,
53673
53935
  messageForReply: messageForReply,
53674
- bodyAttributes: messageBodyAttributes
53936
+ bodyAttributes: messageBodyAttributes,
53937
+ attachments: attachments,
53938
+ viewOnce: viewOnce
53939
+ }, {
53940
+ persist: !!(messageText.trim() || attachments.length)
53675
53941
  });
53676
53942
  }
53677
53943
  }, [mentionedUsers]);
@@ -53720,13 +53986,27 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53720
53986
  }
53721
53987
  });
53722
53988
  useDidUpdate(function () {
53723
- if (draftMessagesMap[activeChannel.id]) {
53989
+ var _draftMessagesMap$act;
53990
+ var persistedReply = (_draftMessagesMap$act = draftMessagesMap[activeChannel.id]) === null || _draftMessagesMap$act === void 0 ? void 0 : _draftMessagesMap$act.messageForReply;
53991
+ if (isNavigatingChannelRef.current) {
53992
+ isNavigatingChannelRef.current = false;
53993
+ return;
53994
+ }
53995
+ var hasDraftContent = !!(messageText.trim() || attachments.length || messageForReply || persistedReply);
53996
+ if (hasDraftContent) {
53724
53997
  setDraftMessageToMap(activeChannel.id, {
53725
53998
  text: messageText,
53726
53999
  mentionedUsers: mentionedUsers,
53727
- messageForReply: messageForReply,
53728
- bodyAttributes: messageBodyAttributes
54000
+ messageForReply: messageForReply || persistedReply,
54001
+ bodyAttributes: messageBodyAttributes,
54002
+ attachments: attachments,
54003
+ viewOnce: viewOnce
54004
+ }, {
54005
+ persist: !!(messageText.trim() || attachments.length)
53729
54006
  });
54007
+ } else if (draftMessagesMap[activeChannel.id]) {
54008
+ removeDraftMessageFromMap(activeChannel.id);
54009
+ dispatch(setChannelDraftMessageIsRemovedAC(activeChannel.id));
53730
54010
  }
53731
54011
  if (messageForReply && messageToEdit) {
53732
54012
  handleCloseEditMode();
@@ -53762,7 +54042,6 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53762
54042
  }, 800);
53763
54043
  }
53764
54044
  messageContRef.current.addEventListener('paste', handlePastAttachments);
53765
- messageContRef.current.addEventListener('cut', handleCut);
53766
54045
  document.addEventListener('mousedown', handleClick);
53767
54046
  return function () {
53768
54047
  if (inputHeightTimeout) {
@@ -53772,7 +54051,6 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53772
54051
  document.removeEventListener('mousedown', handleClick);
53773
54052
  if (messageContRef && messageContRef.current) {
53774
54053
  messageContRef.current.removeEventListener('paste', handlePastAttachments);
53775
- messageContRef.current.removeEventListener('cut', handleCut);
53776
54054
  }
53777
54055
  };
53778
54056
  }, []);
@@ -53919,7 +54197,9 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53919
54197
  borderColor: borderColor
53920
54198
  }, /*#__PURE__*/React__default.createElement(CloseEditMode, {
53921
54199
  color: textSecondary,
53922
- onClick: handleCloseEditMode
54200
+ onClick: function onClick() {
54201
+ return handleCloseEditMode();
54202
+ }
53923
54203
  }, /*#__PURE__*/React__default.createElement(SvgClose, null)), /*#__PURE__*/React__default.createElement(EditReplyMessageHeader, {
53924
54204
  color: accentColor
53925
54205
  }, editMessageIcon || /*#__PURE__*/React__default.createElement(SvgEditIcon, null), "Edit Message"), /*#__PURE__*/React__default.createElement(EditMessageText, null, MessageTextFormat({
@@ -53942,7 +54222,9 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53942
54222
  borderColor: borderColor
53943
54223
  }, /*#__PURE__*/React__default.createElement(CloseEditMode, {
53944
54224
  color: textSecondary,
53945
- onClick: handleCloseReply
54225
+ onClick: function onClick() {
54226
+ return handleCloseReply();
54227
+ }
53946
54228
  }, /*#__PURE__*/React__default.createElement(SvgClose, null)), CustomReplyMessageContainer && customReplyMessageTypes !== null && customReplyMessageTypes !== void 0 && customReplyMessageTypes.includes(messageForReply.type) ? (/*#__PURE__*/React__default.createElement(CustomReplyMessageContainer, {
53947
54229
  messageForReply: messageForReply,
53948
54230
  onClose: handleCloseReply
@@ -53950,14 +54232,26 @@ var SendMessageInput = function SendMessageInput(_ref3) {
53950
54232
  attachment: messageForReply.attachments[0],
53951
54233
  backgroundColor: selectedFileAttachmentsBoxBackground || '',
53952
54234
  isRepliedMessage: true
53953
- })) : messageForReply.attachments[0].type === attachmentTypes.file && (/*#__PURE__*/React__default.createElement(ReplyIconWrapper, {
54235
+ })) : messageForReply.attachments[0].type === attachmentTypes.file ? (/*#__PURE__*/React__default.createElement(ReplyIconWrapper, {
53954
54236
  backgroundColor: accentColor,
53955
54237
  iconColor: textOnPrimary
53956
- }, /*#__PURE__*/React__default.createElement(SvgChoseFile, null)))), /*#__PURE__*/React__default.createElement(ReplyMessageBody$1, {
54238
+ }, /*#__PURE__*/React__default.createElement(SvgChoseFile, null))) : getReplyLinkPreviewImage(messageForReply.attachments) && !shouldShowLinkPreviewErrorFallback(getReplyLinkPreviewImage(messageForReply.attachments), replyLinkPreviewImageFailed) ? (/*#__PURE__*/React__default.createElement(LinkPreviewImage, {
54239
+ bg: background,
54240
+ src: getReplyLinkPreviewImage(messageForReply.attachments),
54241
+ alt: 'Link preview',
54242
+ onError: function onError() {
54243
+ return setReplyLinkPreviewImageFailed(true);
54244
+ }
54245
+ })) : messageForReply.attachments[0].type === attachmentTypes.link && (/*#__PURE__*/React__default.createElement(LinkPreviewIconWrapper, {
54246
+ bg: background
54247
+ }, /*#__PURE__*/React__default.createElement(LinkPreviewIcon, {
54248
+ color: accentColor,
54249
+ bg: background
54250
+ })))), /*#__PURE__*/React__default.createElement(ReplyMessageBody$1, {
53957
54251
  linkColor: accentColor
53958
54252
  }, /*#__PURE__*/React__default.createElement(EditReplyMessageHeader, {
53959
54253
  color: accentColor
53960
- }, replyMessageIcon || /*#__PURE__*/React__default.createElement(SvgReplyIcon, null), " Reply to", /*#__PURE__*/React__default.createElement(UserName$1, null, user.id === messageForReply.user.id ? user.firstName ? user.firstName + " " + user.lastName : user.id : makeUsername(contactsMap[messageForReply.user.id], messageForReply.user, getFromContacts))), messageForReply.attachments && messageForReply.attachments.length ? messageForReply.attachments[0].type === attachmentTypes.voice ? (/*#__PURE__*/React__default.createElement(TextInOneLine, null, (messageForReply === null || messageForReply === void 0 ? void 0 : messageForReply.viewOnce) && /*#__PURE__*/React__default.createElement(SvgViewOnceLastMessage, {
54254
+ }, replyMessageIcon || /*#__PURE__*/React__default.createElement(SvgReplyIcon, null), user.id === messageForReply.user.id ? ' Reply You' : (/*#__PURE__*/React__default.createElement("span", null, ' Reply to', /*#__PURE__*/React__default.createElement(UserName$1, null, makeUsername(contactsMap[messageForReply.user.id], messageForReply.user, getFromContacts))))), messageForReply.attachments && messageForReply.attachments.length ? messageForReply.attachments[0].type === attachmentTypes.voice ? (/*#__PURE__*/React__default.createElement(TextInOneLine, null, (messageForReply === null || messageForReply === void 0 ? void 0 : messageForReply.viewOnce) && /*#__PURE__*/React__default.createElement(SvgViewOnceLastMessage, {
53961
54255
  style: {
53962
54256
  margin: '0 4px -3px 0'
53963
54257
  }
@@ -54009,7 +54303,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
54009
54303
  }, /*#__PURE__*/React__default.createElement(CloseEditMode, {
54010
54304
  color: textSecondary,
54011
54305
  onClick: handleRemoveLinkPreview
54012
- }, /*#__PURE__*/React__default.createElement(SvgClose, null)), /*#__PURE__*/React__default.createElement(LinkPreviewContent, null, (_linkPreview$metadata9 = linkPreview.metadata.og) !== null && _linkPreview$metadata9 !== void 0 && (_linkPreview$metadata0 = _linkPreview$metadata9.image) !== null && _linkPreview$metadata0 !== void 0 && (_linkPreview$metadata1 = _linkPreview$metadata0[0]) !== null && _linkPreview$metadata1 !== void 0 && _linkPreview$metadata1.url ? (/*#__PURE__*/React__default.createElement(LinkPreviewImage, {
54306
+ }, /*#__PURE__*/React__default.createElement(SvgClose, null)), /*#__PURE__*/React__default.createElement(LinkPreviewContent, null, (_linkPreview$metadata9 = linkPreview.metadata.og) !== null && _linkPreview$metadata9 !== void 0 && (_linkPreview$metadata0 = _linkPreview$metadata9.image) !== null && _linkPreview$metadata0 !== void 0 && (_linkPreview$metadata1 = _linkPreview$metadata0[0]) !== null && _linkPreview$metadata1 !== void 0 && _linkPreview$metadata1.url && !shouldShowLinkPreviewErrorFallback(linkPreview.metadata.og.image[0].url, linkPreviewImageFailed) ? (/*#__PURE__*/React__default.createElement(LinkPreviewImage, {
54013
54307
  onLoad: function onLoad(e) {
54014
54308
  var _e$target, _e$target2;
54015
54309
  if ((_e$target = e.target) !== null && _e$target !== void 0 && _e$target.naturalHeight && (_e$target2 = e.target) !== null && _e$target2 !== void 0 && _e$target2.naturalWidth) {
@@ -54020,18 +54314,24 @@ var SendMessageInput = function SendMessageInput(_ref3) {
54020
54314
  }
54021
54315
  },
54022
54316
  src: linkPreview.metadata.og.image[0].url,
54023
- alt: 'Link preview'
54024
- })) : (_linkPreview$metadata10 = linkPreview.metadata.og) !== null && _linkPreview$metadata10 !== void 0 && (_linkPreview$metadata11 = _linkPreview$metadata10.favicon) !== null && _linkPreview$metadata11 !== void 0 && _linkPreview$metadata11.url ? (/*#__PURE__*/React__default.createElement(LinkPreviewImage, {
54317
+ alt: 'Link preview',
54318
+ onError: function onError() {
54319
+ return setLinkPreviewImageFailed(true);
54320
+ }
54321
+ })) : shouldShowLinkPreviewErrorFallback((_linkPreview$metadata10 = linkPreview.metadata.og) === null || _linkPreview$metadata10 === void 0 ? void 0 : (_linkPreview$metadata11 = _linkPreview$metadata10.image) === null || _linkPreview$metadata11 === void 0 ? void 0 : (_linkPreview$metadata12 = _linkPreview$metadata11[0]) === null || _linkPreview$metadata12 === void 0 ? void 0 : _linkPreview$metadata12.url, linkPreviewImageFailed) ? (/*#__PURE__*/React__default.createElement(LinkPreviewIcon, {
54322
+ color: accentColor,
54323
+ bg: background
54324
+ })) : (_linkPreview$metadata13 = linkPreview.metadata.og) !== null && _linkPreview$metadata13 !== void 0 && (_linkPreview$metadata14 = _linkPreview$metadata13.favicon) !== null && _linkPreview$metadata14 !== void 0 && _linkPreview$metadata14.url ? (/*#__PURE__*/React__default.createElement(LinkPreviewImage, {
54025
54325
  src: linkPreview.metadata.og.favicon.url,
54026
54326
  alt: 'Favicon'
54027
54327
  })) : (/*#__PURE__*/React__default.createElement(LinkPreviewIcon, {
54028
54328
  color: accentColor,
54029
54329
  bg: background
54030
54330
  })), /*#__PURE__*/React__default.createElement(LinkPreviewTextContent, {
54031
- hasImage: !!((_linkPreview$metadata12 = linkPreview.metadata.og) !== null && _linkPreview$metadata12 !== void 0 && (_linkPreview$metadata13 = _linkPreview$metadata12.image) !== null && _linkPreview$metadata13 !== void 0 && (_linkPreview$metadata14 = _linkPreview$metadata13[0]) !== null && _linkPreview$metadata14 !== void 0 && _linkPreview$metadata14.url) || !!((_linkPreview$metadata15 = linkPreview.metadata.og) !== null && _linkPreview$metadata15 !== void 0 && (_linkPreview$metadata16 = _linkPreview$metadata15.favicon) !== null && _linkPreview$metadata16 !== void 0 && _linkPreview$metadata16.url)
54032
- }, ((_linkPreview$metadata17 = linkPreview.metadata.og) === null || _linkPreview$metadata17 === void 0 ? void 0 : _linkPreview$metadata17.title) && (/*#__PURE__*/React__default.createElement(LinkPreviewTitle, {
54331
+ hasImage: !!((_linkPreview$metadata15 = linkPreview.metadata.og) !== null && _linkPreview$metadata15 !== void 0 && (_linkPreview$metadata16 = _linkPreview$metadata15.image) !== null && _linkPreview$metadata16 !== void 0 && (_linkPreview$metadata17 = _linkPreview$metadata16[0]) !== null && _linkPreview$metadata17 !== void 0 && _linkPreview$metadata17.url) || !!((_linkPreview$metadata18 = linkPreview.metadata.og) !== null && _linkPreview$metadata18 !== void 0 && (_linkPreview$metadata19 = _linkPreview$metadata18.favicon) !== null && _linkPreview$metadata19 !== void 0 && _linkPreview$metadata19.url)
54332
+ }, ((_linkPreview$metadata20 = linkPreview.metadata.og) === null || _linkPreview$metadata20 === void 0 ? void 0 : _linkPreview$metadata20.title) && (/*#__PURE__*/React__default.createElement(LinkPreviewTitle, {
54033
54333
  color: accentColor
54034
- }, linkPreview.metadata.og.title)), ((_linkPreview$metadata18 = linkPreview.metadata.og) === null || _linkPreview$metadata18 === void 0 ? void 0 : _linkPreview$metadata18.description) && (/*#__PURE__*/React__default.createElement(LinkPreviewDescription, {
54334
+ }, linkPreview.metadata.og.title)), ((_linkPreview$metadata21 = linkPreview.metadata.og) === null || _linkPreview$metadata21 === void 0 ? void 0 : _linkPreview$metadata21.description) && (/*#__PURE__*/React__default.createElement(LinkPreviewDescription, {
54035
54335
  color: textPrimary
54036
54336
  }, linkPreview.metadata.og.description)))))), !!attachments.length && !sendAttachmentSeparately && (/*#__PURE__*/React__default.createElement(ChosenAttachments, null, [].concat(attachments).map(function (attachment) {
54037
54337
  return /*#__PURE__*/React__default.createElement("div", {
@@ -54157,6 +54457,7 @@ var SendMessageInput = function SendMessageInput(_ref3) {
54157
54457
  onChange: onChange
54158
54458
  }), /*#__PURE__*/React__default.createElement(EditMessagePlugin, {
54159
54459
  editMessage: messageToEdit,
54460
+ draftMessage: (restoredEditMessage === null || restoredEditMessage === void 0 ? void 0 : restoredEditMessage.id) === (messageToEdit === null || messageToEdit === void 0 ? void 0 : messageToEdit.id) ? restoredEditMessage : null,
54160
54461
  contactsMap: contactsMap,
54161
54462
  getFromContacts: getFromContacts,
54162
54463
  setMentionedMember: setMentionedUsers
@@ -54305,14 +54606,14 @@ var SendMessageInputContainer = styled__default.div(_templateObject11$9 || (_tem
54305
54606
  }, AddAttachmentIcon, function (props) {
54306
54607
  return props.iconColor;
54307
54608
  });
54308
- var MessageInputWrapper = styled__default.div(_templateObject12$6 || (_templateObject12$6 = _taggedTemplateLiteralLoose(["\n display: flex;\n width: 100%;\n max-width: calc(100% - 50px);\n //max-width: ", ";\n //max-width: calc(100% - 110px);\n background-color: ", ";\n border-radius: ", ";\n position: relative;\n"])), function (props) {
54609
+ var MessageInputWrapper = styled__default.div(_templateObject12$7 || (_templateObject12$7 = _taggedTemplateLiteralLoose(["\n display: flex;\n width: 100%;\n max-width: calc(100% - 50px);\n //max-width: ", ";\n //max-width: calc(100% - 110px);\n background-color: ", ";\n border-radius: ", ";\n position: relative;\n"])), function (props) {
54309
54610
  return props.channelDetailsIsOpen ? "calc(100% - " + (props.channelDetailsIsOpen ? 362 : 0) + "px)" : '';
54310
54611
  }, function (props) {
54311
54612
  return props.backgroundColor;
54312
54613
  }, function (props) {
54313
54614
  return props.borderRadius || '18px';
54314
54615
  });
54315
- var LexicalWrapper = styled__default.div(_templateObject13$5 || (_templateObject13$5 = _taggedTemplateLiteralLoose(["\n position: relative;\n width: 100%;\n\n & .rich_text_editor {\n width: 100%;\n max-height: 80px;\n min-height: 20px;\n display: block;\n border: none;\n box-sizing: border-box;\n outline: none !important;\n border-radius: ", ";\n background-color: ", ";\n padding: ", ";\n color: ", ";\n order: ", ";\n overflow-y: auto;\n overflow-x: hidden;\n scrollbar-width: none;\n scrollbar-color: transparent transparent;\n overscroll-behavior: none;\n\n @supports (overflow: overlay) {\n overflow-y: overlay;\n }\n\n &::-webkit-scrollbar {\n width: 8px;\n background: transparent;\n }\n &::-webkit-scrollbar-thumb {\n background: transparent;\n }\n\n &.show-scrollbar::-webkit-scrollbar-thumb {\n background: ", ";\n border-radius: 4px;\n }\n &.show-scrollbar::-webkit-scrollbar-track {\n background: transparent;\n }\n\n &.show-scrollbar {\n scrollbar-width: thin;\n scrollbar-color: ", " transparent;\n }\n\n & p {\n font-size: 15px;\n line-height: 20px;\n color: ", ";\n }\n\n &::selection {\n background-color: ", ";\n }\n\n & *::selection {\n background-color: ", ";\n }\n\n & span::selection {\n background-color: ", ";\n }\n\n &:empty:before {\n content: attr(data-placeholder);\n }\n\n & .content_editable_input {\n border: none !important;\n outline: none !important;\n }\n\n & .mention {\n color: ", ";\n background-color: inherit !important;\n user-modify: read-only;\n }\n\n & span.bold {\n font-weight: bold;\n }\n\n & .editor_paragraph {\n margin: 0;\n }\n\n & .text_bold {\n font-weight: 600;\n }\n\n & .text_italic {\n font-style: italic;\n }\n\n & .text_underline {\n text-decoration: underline;\n }\n\n & .text_strikethrough {\n text-decoration: line-through;\n }\n\n & .text_underlineStrikethrough {\n text-decoration: underline line-through;\n }\n\n & code {\n font-family: inherit;\n letter-spacing: 4px;\n }\n }\n"])), function (props) {
54616
+ var LexicalWrapper = styled__default.div(_templateObject13$6 || (_templateObject13$6 = _taggedTemplateLiteralLoose(["\n position: relative;\n width: 100%;\n\n & .rich_text_editor {\n width: 100%;\n max-height: 80px;\n min-height: 20px;\n display: block;\n border: none;\n box-sizing: border-box;\n outline: none !important;\n border-radius: ", ";\n background-color: ", ";\n padding: ", ";\n color: ", ";\n order: ", ";\n overflow-y: auto;\n overflow-x: hidden;\n scrollbar-width: none;\n scrollbar-color: transparent transparent;\n overscroll-behavior: none;\n\n @supports (overflow: overlay) {\n overflow-y: overlay;\n }\n\n &::-webkit-scrollbar {\n width: 8px;\n background: transparent;\n }\n &::-webkit-scrollbar-thumb {\n background: transparent;\n }\n\n &.show-scrollbar::-webkit-scrollbar-thumb {\n background: ", ";\n border-radius: 4px;\n }\n &.show-scrollbar::-webkit-scrollbar-track {\n background: transparent;\n }\n\n &.show-scrollbar {\n scrollbar-width: thin;\n scrollbar-color: ", " transparent;\n }\n\n & p {\n font-size: 15px;\n line-height: 20px;\n color: ", ";\n }\n\n &::selection {\n background-color: ", ";\n }\n\n & *::selection {\n background-color: ", ";\n }\n\n & span::selection {\n background-color: ", ";\n }\n\n &:empty:before {\n content: attr(data-placeholder);\n }\n\n & .content_editable_input {\n border: none !important;\n outline: none !important;\n }\n\n & .mention {\n color: ", ";\n background-color: inherit !important;\n user-select: text;\n -webkit-user-select: text;\n }\n\n & span.bold {\n font-weight: bold;\n }\n\n & .editor_paragraph {\n margin: 0;\n }\n\n & .text_bold {\n font-weight: 600;\n }\n\n & .text_italic {\n font-style: italic;\n }\n\n & .text_underline {\n text-decoration: underline;\n }\n\n & .text_strikethrough {\n text-decoration: line-through;\n }\n\n & .text_underlineStrikethrough {\n text-decoration: underline line-through;\n }\n\n & code {\n font-family: inherit;\n letter-spacing: 4px;\n }\n }\n"])), function (props) {
54316
54617
  return props.borderRadius;
54317
54618
  }, function (props) {
54318
54619
  return props.backgroundColor;
@@ -54355,7 +54656,7 @@ var SendMessageButton = styled__default.span(_templateObject16$2 || (_templateOb
54355
54656
  return !props.isCustomButton && "\n display: flex;\n height: " + (props.height ? props.height + "px" : '36px') + ";\n align-items: center;\n // margin: 0 8px 0 auto;\n cursor: " + (props.isActive && 'pointer') + ";\n line-height: 13px;\n order: " + (props.order === 0 || props.order ? props.order : 4) + ";\n -webkit-tap-highlight-color: transparent;\n\n color: " + (props.isActive ? props.activeColor : props.color) + ";\n & > svg {\n color: " + props.iconColor + ";\n }\n ";
54356
54657
  });
54357
54658
  var AudioCont = styled__default.div(_templateObject17$2 || (_templateObject17$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n width: 100%;\n justify-content: flex-end;\n"])));
54358
- var ChosenAttachments = styled__default.div(_templateObject18$2 || (_templateObject18$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n padding: 16px 16px 14px;\n overflow-x: auto;\n\n & ", " {\n width: 100%;\n height: 100%;\n border-radius: 4px;\n object-fit: cover;\n }\n\n & ", " {\n width: 240px;\n padding: 5px 12px;\n border-radius: 8px;\n height: 50px;\n }\n"])), AttachmentImg, AttachmentFile$1);
54659
+ var ChosenAttachments = styled__default.div(_templateObject18$2 || (_templateObject18$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n padding: 16px 16px 14px;\n overflow-x: auto;\n\n & ", " {\n width: 100%;\n height: 100%;\n border-radius: 4px;\n object-fit: cover;\n }\n\n & ", " {\n width: 240px;\n padding: 5px;\n border-radius: 8px;\n height: 50px;\n }\n"])), AttachmentImg, AttachmentFile$1);
54359
54660
  var TypingIndicator$1 = styled__default.div(_templateObject19$2 || (_templateObject19$2 = _taggedTemplateLiteralLoose(["\n position: absolute;\n bottom: 100%;\n left: 16px;\n"])));
54360
54661
  var TypingIndicatorCont = styled__default.div(_templateObject20$2 || (_templateObject20$2 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n margin-bottom: 12px;\n gap: 4px;\n"])));
54361
54662
  var TypingFrom = styled__default.h5(_templateObject21$2 || (_templateObject21$2 = _taggedTemplateLiteralLoose(["\n margin: 0 4px 0 0;\n font-weight: 400;\n font-size: 13px;\n line-height: 16px;\n letter-spacing: -0.2px;\n color: ", ";\n"])), function (props) {
@@ -54420,19 +54721,24 @@ var LinkPreviewContainer = styled__default.div(_templateObject39$1 || (_template
54420
54721
  return props.isClosing ? linkPreviewSlideOut : linkPreviewSlideIn;
54421
54722
  });
54422
54723
  var LinkPreviewContent = styled__default.div(_templateObject40$1 || (_templateObject40$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n gap: 12px;\n flex: 1;\n overflow: hidden;\n"])));
54423
- var LinkPreviewImage = styled__default.img(_templateObject41$1 || (_templateObject41$1 = _taggedTemplateLiteralLoose(["\n width: 40px;\n height: 40px;\n object-fit: cover;\n border-radius: 8px;\n flex-shrink: 0;\n"])));
54724
+ var LinkPreviewImage = styled__default.img(_templateObject41$1 || (_templateObject41$1 = _taggedTemplateLiteralLoose(["\n width: 40px;\n height: 40px;\n object-fit: cover;\n border-radius: 4px;\n flex-shrink: 0;\n margin-right: 8px;\n background: ", ";\n"])), function (props) {
54725
+ return props.bg;
54726
+ });
54424
54727
  var LinkPreviewIcon = styled__default(SvgLinkIcon)(_templateObject42 || (_templateObject42 = _taggedTemplateLiteralLoose(["\n color: ", ";\n rect {\n fill: ", ";\n fill-opacity: 1;\n }\n"])), function (props) {
54425
54728
  return props.color;
54426
54729
  }, function (props) {
54427
54730
  return props.bg;
54428
54731
  });
54429
- var LinkPreviewTextContent = styled__default.div(_templateObject43 || (_templateObject43 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n gap: 4px;\n overflow: hidden;\n flex: 1;\n justify-content: center;\n ", "\n"])), function (props) {
54732
+ var LinkPreviewIconWrapper = styled__default.div(_templateObject43 || (_templateObject43 = _taggedTemplateLiteralLoose(["\n width: 40px;\n height: 40px;\n border-radius: 4px;\n margin-right: 8px;\n background: ", ";\n"])), function (props) {
54733
+ return props.bg;
54734
+ });
54735
+ var LinkPreviewTextContent = styled__default.div(_templateObject44 || (_templateObject44 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n gap: 4px;\n overflow: hidden;\n flex: 1;\n justify-content: center;\n ", "\n"])), function (props) {
54430
54736
  return props.hasImage ? '' : 'padding-left: 0;';
54431
54737
  });
54432
- var LinkPreviewTitle = styled__default.div(_templateObject44 || (_templateObject44 = _taggedTemplateLiteralLoose(["\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-family: Inter;\n font-weight: 500;\n font-size: 13px;\n line-height: 16px;\n letter-spacing: 0px;\n"])), function (props) {
54738
+ var LinkPreviewTitle = styled__default.div(_templateObject45 || (_templateObject45 = _taggedTemplateLiteralLoose(["\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-family: Inter;\n font-weight: 500;\n font-size: 13px;\n line-height: 16px;\n letter-spacing: 0px;\n"])), function (props) {
54433
54739
  return props.color;
54434
54740
  });
54435
- var LinkPreviewDescription = styled__default.div(_templateObject45 || (_templateObject45 = _taggedTemplateLiteralLoose(["\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 1;\n -webkit-box-orient: vertical;\n font-weight: 400;\n font-size: 15px;\n line-height: 20px;\n letter-spacing: -0.2px;\n"])), function (props) {
54741
+ var LinkPreviewDescription = styled__default.div(_templateObject46 || (_templateObject46 = _taggedTemplateLiteralLoose(["\n color: ", ";\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 1;\n -webkit-box-orient: vertical;\n font-weight: 400;\n font-size: 15px;\n line-height: 20px;\n letter-spacing: -0.2px;\n"])), function (props) {
54436
54742
  return props.color;
54437
54743
  });
54438
54744
 
@@ -55184,7 +55490,7 @@ var EmptyText = styled__default.div(_templateObject7$s || (_templateObject7$s =
55184
55490
  });
55185
55491
  var ChevronRightIconWrapper = styled__default.span(_templateObject8$p || (_templateObject8$p = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n\n & > svg {\n width: 16px;\n height: 16px;\n transform: rotate(-90deg);\n }\n"])));
55186
55492
 
55187
- var _templateObject$_, _templateObject2$V, _templateObject3$M, _templateObject4$F, _templateObject5$A, _templateObject6$w, _templateObject7$t, _templateObject8$q, _templateObject9$k, _templateObject0$i, _templateObject1$g, _templateObject10$d, _templateObject11$a, _templateObject12$7, _templateObject13$6, _templateObject14$5, _templateObject15$3, _templateObject16$3, _templateObject17$3, _templateObject18$3, _templateObject19$3, _templateObject20$3;
55493
+ var _templateObject$_, _templateObject2$V, _templateObject3$M, _templateObject4$F, _templateObject5$A, _templateObject6$w, _templateObject7$t, _templateObject8$q, _templateObject9$k, _templateObject0$i, _templateObject1$g, _templateObject10$d, _templateObject11$a, _templateObject12$8, _templateObject13$7, _templateObject14$5, _templateObject15$3, _templateObject16$3, _templateObject17$3, _templateObject18$3, _templateObject19$3, _templateObject20$3;
55188
55494
  var Actions = function Actions(_ref) {
55189
55495
  var _getDisappearingSetti;
55190
55496
  var setActionsHeight = _ref.setActionsHeight,
@@ -55265,12 +55571,14 @@ var Actions = function Actions(_ref) {
55265
55571
  commonGroupsTextColor = _ref.commonGroupsTextColor,
55266
55572
  showGroupsInCommon = _ref.showGroupsInCommon;
55267
55573
  var _useColor = useColors(),
55574
+ accentColor = _useColor[THEME_COLORS.ACCENT],
55268
55575
  textPrimary = _useColor[THEME_COLORS.TEXT_PRIMARY],
55269
55576
  textSecondary = _useColor[THEME_COLORS.TEXT_SECONDARY],
55270
55577
  iconPrimary = _useColor[THEME_COLORS.ICON_PRIMARY],
55271
55578
  surface1 = _useColor[THEME_COLORS.SURFACE_1],
55272
55579
  warningColor = _useColor[THEME_COLORS.WARNING],
55273
- backgroundColor = _useColor[THEME_COLORS.BACKGROUND];
55580
+ backgroundColor = _useColor[THEME_COLORS.BACKGROUND],
55581
+ textOnPrimary = _useColor[THEME_COLORS.TEXT_ON_PRIMARY];
55274
55582
  var ChatClient = getClient();
55275
55583
  var user = ChatClient.user;
55276
55584
  var _useState = React.useState(false),
@@ -55283,35 +55591,39 @@ var Actions = function Actions(_ref) {
55283
55591
  leaveChannelPopupOpen = _useState3[0],
55284
55592
  setLeaveChannelPopupOpen = _useState3[1];
55285
55593
  var _useState4 = React.useState(false),
55286
- deleteChannelPopupOpen = _useState4[0],
55287
- setDeleteChannelPopupOpen = _useState4[1];
55594
+ leaveChannelOfflinePopupOpen = _useState4[0],
55595
+ setLeaveChannelOfflinePopupOpen = _useState4[1];
55288
55596
  var _useState5 = React.useState(false),
55289
- blockChannelPopupOpen = _useState5[0],
55290
- setBlockChannelPopupOpen = _useState5[1];
55597
+ deleteChannelPopupOpen = _useState5[0],
55598
+ setDeleteChannelPopupOpen = _useState5[1];
55291
55599
  var _useState6 = React.useState(false),
55292
- blockUserPopupOpen = _useState6[0],
55293
- setBlockUserPopupOpen = _useState6[1];
55600
+ blockChannelPopupOpen = _useState6[0],
55601
+ setBlockChannelPopupOpen = _useState6[1];
55294
55602
  var _useState7 = React.useState(false),
55295
- unblockUserPopupOpen = _useState7[0],
55296
- setUnblockUserPopupOpen = _useState7[1];
55603
+ blockUserPopupOpen = _useState7[0],
55604
+ setBlockUserPopupOpen = _useState7[1];
55297
55605
  var _useState8 = React.useState(false),
55298
- reportUserPopupOpen = _useState8[0],
55299
- setReportUserPopupOpen = _useState8[1];
55606
+ unblockUserPopupOpen = _useState8[0],
55607
+ setUnblockUserPopupOpen = _useState8[1];
55300
55608
  var _useState9 = React.useState(false),
55301
- disappearingMessagesPopupOpen = _useState9[0],
55302
- setDisappearingMessagesPopupOpen = _useState9[1];
55609
+ reportUserPopupOpen = _useState9[0],
55610
+ setReportUserPopupOpen = _useState9[1];
55303
55611
  var _useState0 = React.useState(false),
55304
- groupsInCommonPopupOpen = _useState0[0],
55305
- setGroupsInCommonPopupOpen = _useState0[1];
55612
+ disappearingMessagesPopupOpen = _useState0[0],
55613
+ setDisappearingMessagesPopupOpen = _useState0[1];
55614
+ var _useState1 = React.useState(false),
55615
+ groupsInCommonPopupOpen = _useState1[0],
55616
+ setGroupsInCommonPopupOpen = _useState1[1];
55306
55617
  var _usePermissions = usePermissions(channel.userRole),
55307
55618
  checkActionPermission = _usePermissions[0];
55308
- var _useState1 = React.useState(''),
55309
- popupButtonText = _useState1[0],
55310
- setPopupButtonText = _useState1[1];
55311
55619
  var _useState10 = React.useState(''),
55312
- popupTitle = _useState10[0],
55313
- setPopupTitle = _useState10[1];
55620
+ popupButtonText = _useState10[0],
55621
+ setPopupButtonText = _useState10[1];
55622
+ var _useState11 = React.useState(''),
55623
+ popupTitle = _useState11[0],
55624
+ setPopupTitle = _useState11[1];
55314
55625
  var dispatch = useDispatch();
55626
+ var connectionStatus = useSelector(connectionStatusSelector);
55315
55627
  var oneHour = 60 * 60 * 1000;
55316
55628
  var twoHours = oneHour * 2;
55317
55629
  var oneDay = oneHour * 24;
@@ -55356,6 +55668,10 @@ var Actions = function Actions(_ref) {
55356
55668
  }
55357
55669
  };
55358
55670
  var handleLeaveChannel = function handleLeaveChannel() {
55671
+ if (connectionStatus !== CONNECTION_STATUS.CONNECTED) {
55672
+ setLeaveChannelOfflinePopupOpen(true);
55673
+ return;
55674
+ }
55359
55675
  dispatch(leaveChannelAC(channel.id));
55360
55676
  };
55361
55677
  var handleDeleteChannel = function handleDeleteChannel() {
@@ -55657,7 +55973,37 @@ var Actions = function Actions(_ref) {
55657
55973
  buttonText: popupButtonText,
55658
55974
  description: channel.type === DEFAULT_CHANNEL_TYPE.GROUP || channel.type === DEFAULT_CHANNEL_TYPE.PRIVATE ? 'Once you leave this group it will be removed for you along with its entire history.' : 'Once you leave this channel it will be removed for you along with its entire history.',
55659
55975
  title: popupTitle
55660
- })), deleteChannelPopupOpen && (/*#__PURE__*/React__default.createElement(ConfirmPopup, {
55976
+ })), leaveChannelOfflinePopupOpen && (/*#__PURE__*/React__default.createElement(PopupContainer, null, /*#__PURE__*/React__default.createElement(Popup, {
55977
+ backgroundColor: backgroundColor,
55978
+ maxWidth: '520px',
55979
+ minWidth: '520px',
55980
+ padding: '0'
55981
+ }, /*#__PURE__*/React__default.createElement(PopupBody, {
55982
+ paddingH: '24px',
55983
+ paddingV: '24px'
55984
+ }, /*#__PURE__*/React__default.createElement(CloseIcon, {
55985
+ color: iconPrimary,
55986
+ onClick: function onClick() {
55987
+ return setLeaveChannelOfflinePopupOpen(false);
55988
+ }
55989
+ }), /*#__PURE__*/React__default.createElement(PopupName, {
55990
+ color: textPrimary,
55991
+ isDelete: true,
55992
+ marginBottom: '20px'
55993
+ }, "Failed to leave group"), /*#__PURE__*/React__default.createElement(PopupDescription, {
55994
+ color: textPrimary,
55995
+ highlightColor: textSecondary
55996
+ }, "You\u2019re offline. Reconnect and try again.")), /*#__PURE__*/React__default.createElement(PopupFooter, {
55997
+ backgroundColor: surface1
55998
+ }, /*#__PURE__*/React__default.createElement(Button, {
55999
+ type: 'button',
56000
+ backgroundColor: accentColor,
56001
+ color: textOnPrimary,
56002
+ borderRadius: '8px',
56003
+ onClick: function onClick() {
56004
+ return setLeaveChannelOfflinePopupOpen(false);
56005
+ }
56006
+ }, "Close"))))), deleteChannelPopupOpen && (/*#__PURE__*/React__default.createElement(ConfirmPopup, {
55661
56007
  handleFunction: handleDeleteChannel,
55662
56008
  togglePopup: handleToggleDeleteChannelPopupOpen,
55663
56009
  buttonText: popupButtonText,
@@ -55721,8 +56067,8 @@ var DefaultMarkAsRead = styled__default(SvgMarkAsRead)(_templateObject0$i || (_t
55721
56067
  var DefaultMarkAsUnRead = styled__default(SvgMarkAsUnRead)(_templateObject1$g || (_templateObject1$g = _taggedTemplateLiteralLoose([""])));
55722
56068
  var DefaultBlockIcon = styled__default(SvgBlockChannel)(_templateObject10$d || (_templateObject10$d = _taggedTemplateLiteralLoose([""])));
55723
56069
  var DefaultReportIcon = styled__default(SvgReport)(_templateObject11$a || (_templateObject11$a = _taggedTemplateLiteralLoose([""])));
55724
- var DefaultClearIcon = styled__default(SvgClear)(_templateObject12$7 || (_templateObject12$7 = _taggedTemplateLiteralLoose([""])));
55725
- var DefaultDeleteChannelIcon = styled__default(SvgDeleteChannel)(_templateObject13$6 || (_templateObject13$6 = _taggedTemplateLiteralLoose([""])));
56070
+ var DefaultClearIcon = styled__default(SvgClear)(_templateObject12$8 || (_templateObject12$8 = _taggedTemplateLiteralLoose([""])));
56071
+ var DefaultDeleteChannelIcon = styled__default(SvgDeleteChannel)(_templateObject13$7 || (_templateObject13$7 = _taggedTemplateLiteralLoose([""])));
55726
56072
  var DefaultBottomIcon = styled__default(SvgBottom)(_templateObject14$5 || (_templateObject14$5 = _taggedTemplateLiteralLoose([""])));
55727
56073
  var DefaultMarkAsReadIcon = styled__default(SvgLeave)(_templateObject15$3 || (_templateObject15$3 = _taggedTemplateLiteralLoose([""])));
55728
56074
  var DefaultWatchIcon = styled__default(SvgWatch)(_templateObject16$3 || (_templateObject16$3 = _taggedTemplateLiteralLoose(["\n width: 24px;\n height: 24px;\n\n path.watch-ticks,\n path:nth-child(2) {\n fill: ", " !important;\n }\n"])), function (props) {
@@ -55911,7 +56257,7 @@ function SvgDownloadFile(props) {
55911
56257
  })));
55912
56258
  }
55913
56259
 
55914
- var _templateObject$10, _templateObject2$X, _templateObject3$O, _templateObject4$H, _templateObject5$C, _templateObject6$y, _templateObject7$v, _templateObject8$s, _templateObject9$m, _templateObject0$k, _templateObject1$h, _templateObject10$e, _templateObject11$b, _templateObject12$8, _templateObject13$7, _templateObject14$6, _templateObject15$4;
56260
+ var _templateObject$10, _templateObject2$X, _templateObject3$O, _templateObject4$H, _templateObject5$C, _templateObject6$y, _templateObject7$v, _templateObject8$s, _templateObject9$m, _templateObject0$k, _templateObject1$h, _templateObject10$e, _templateObject11$b, _templateObject12$9, _templateObject13$8, _templateObject14$6, _templateObject15$4;
55915
56261
  var Files = function Files(_ref) {
55916
56262
  var channelId = _ref.channelId,
55917
56263
  filePreviewIcon = _ref.filePreviewIcon,
@@ -56126,12 +56472,12 @@ var FileIconCont = styled__default.span(_templateObject11$b || (_templateObject1
56126
56472
  }, function (props) {
56127
56473
  return props.fillColor;
56128
56474
  });
56129
- var FileHoverIconCont = styled__default.span(_templateObject12$8 || (_templateObject12$8 = _taggedTemplateLiteralLoose(["\n display: none;\n & > svg {\n width: 40px;\n height: 40px;\n color: ", ";\n rect {\n fill: ", ";\n }\n }\n"])), function (props) {
56475
+ var FileHoverIconCont = styled__default.span(_templateObject12$9 || (_templateObject12$9 = _taggedTemplateLiteralLoose(["\n display: none;\n & > svg {\n width: 40px;\n height: 40px;\n color: ", ";\n rect {\n fill: ", ";\n }\n }\n"])), function (props) {
56130
56476
  return props.iconColor;
56131
56477
  }, function (props) {
56132
56478
  return props.fillColor;
56133
56479
  });
56134
- var FileThumb = styled__default.img(_templateObject13$7 || (_templateObject13$7 = _taggedTemplateLiteralLoose(["\n width: 40px;\n height: 40px;\n border: 0.5px solid rgba(0, 0, 0, 0.1);\n border-radius: 8px;\n object-fit: cover;\n"])));
56480
+ var FileThumb = styled__default.img(_templateObject13$8 || (_templateObject13$8 = _taggedTemplateLiteralLoose(["\n width: 40px;\n height: 40px;\n border: 0.5px solid rgba(0, 0, 0, 0.1);\n border-radius: 8px;\n object-fit: cover;\n"])));
56135
56481
  var FileItem = styled__default.div(_templateObject14$6 || (_templateObject14$6 = _taggedTemplateLiteralLoose(["\n position: relative;\n padding: 11px 16px;\n display: flex;\n align-items: center;\n font-size: 15px;\n transition: all 0.2s;\n div {\n margin-left: 7px;\n width: calc(100% - 48px);\n }\n &:hover {\n background-color: ", ";\n ", " {\n visibility: visible;\n }\n & ", " {\n display: none;\n }\n & ", " {\n display: inline-flex;\n }\n }\n"])), function (props) {
56136
56482
  return props.hoverBackgroundColor;
56137
56483
  }, DownloadWrapper, FileIconCont, FileHoverIconCont);
@@ -56820,7 +57166,7 @@ function ResetLinkConfirmModal(_ref) {
56820
57166
  });
56821
57167
  }
56822
57168
 
56823
- var _templateObject$16, _templateObject2$11, _templateObject3$U, _templateObject4$M, _templateObject5$H, _templateObject6$C, _templateObject7$z, _templateObject8$w, _templateObject9$p, _templateObject0$m, _templateObject1$i, _templateObject10$f, _templateObject11$c, _templateObject12$9, _templateObject13$8;
57169
+ var _templateObject$16, _templateObject2$11, _templateObject3$U, _templateObject4$M, _templateObject5$H, _templateObject6$C, _templateObject7$z, _templateObject8$w, _templateObject9$p, _templateObject0$m, _templateObject1$i, _templateObject10$f, _templateObject11$c, _templateObject12$a, _templateObject13$9;
56824
57170
  function loadImage$1(src) {
56825
57171
  return new Promise(function (resolve, reject) {
56826
57172
  var img = document.createElement('img');
@@ -57437,16 +57783,16 @@ var Switch = styled__default.div(_templateObject10$f || (_templateObject10$f = _
57437
57783
  return p.active ? '22px' : '3px';
57438
57784
  });
57439
57785
  var ResetLink = styled__default.button(_templateObject11$c || (_templateObject11$c = _taggedTemplateLiteralLoose(["\n margin-top: 12px;\n border: none;\n background: transparent;\n color: #ff4d4f;\n cursor: pointer;\n"])));
57440
- var QRCodeBox = styled__default.div(_templateObject12$9 || (_templateObject12$9 = _taggedTemplateLiteralLoose(["\n border-radius: 8px;\n border: 1px solid ", ";\n background-color: ", ";\n display: flex;\n width: max-content;\n padding: 13.5px;\n margin: auto;\n position: relative;\n"])), function (p) {
57786
+ var QRCodeBox = styled__default.div(_templateObject12$a || (_templateObject12$a = _taggedTemplateLiteralLoose(["\n border-radius: 8px;\n border: 1px solid ", ";\n background-color: ", ";\n display: flex;\n width: max-content;\n padding: 13.5px;\n margin: auto;\n position: relative;\n"])), function (p) {
57441
57787
  return p.borderColor;
57442
57788
  }, function (p) {
57443
57789
  return p.backgroundColor;
57444
57790
  });
57445
- var QrHint = styled__default.p(_templateObject13$8 || (_templateObject13$8 = _taggedTemplateLiteralLoose(["\n text-align: center;\n font-size: 14px;\n line-height: 16px;\n color: ", ";\n margin: 12px 0 0;\n"])), function (p) {
57791
+ var QrHint = styled__default.p(_templateObject13$9 || (_templateObject13$9 = _taggedTemplateLiteralLoose(["\n text-align: center;\n font-size: 14px;\n line-height: 16px;\n color: ", ";\n margin: 12px 0 0;\n"])), function (p) {
57446
57792
  return p.color;
57447
57793
  });
57448
57794
 
57449
- var _templateObject$17, _templateObject2$12, _templateObject3$V, _templateObject4$N, _templateObject5$I, _templateObject6$D, _templateObject7$A, _templateObject8$x, _templateObject9$q, _templateObject0$n, _templateObject1$j, _templateObject10$g, _templateObject11$d, _templateObject12$a, _templateObject13$9;
57795
+ var _templateObject$17, _templateObject2$12, _templateObject3$V, _templateObject4$N, _templateObject5$I, _templateObject6$D, _templateObject7$A, _templateObject8$x, _templateObject9$q, _templateObject0$n, _templateObject1$j, _templateObject10$g, _templateObject11$d, _templateObject12$b, _templateObject13$a;
57450
57796
  var Members = function Members(_ref) {
57451
57797
  var _members$find;
57452
57798
  var channel = _ref.channel,
@@ -57804,12 +58150,12 @@ var SkeletonBlock$5 = styled__default.div(_templateObject0$n || (_templateObject
57804
58150
  var SkeletonMemberRow = styled__default.div(_templateObject1$j || (_templateObject1$j = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n padding: 6px 16px;\n gap: 12px;\n height: 56px;\n"])));
57805
58151
  var SkeletonAvatar$1 = styled__default(SkeletonBlock$5)(_templateObject10$g || (_templateObject10$g = _taggedTemplateLiteralLoose(["\n width: 40px;\n height: 40px;\n border-radius: 50%;\n flex-shrink: 0;\n"])));
57806
58152
  var SkeletonTextGroup$2 = styled__default.div(_templateObject11$d || (_templateObject11$d = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n gap: 6px;\n flex: 1;\n"])));
57807
- var SkeletonLine$4 = styled__default(SkeletonBlock$5)(_templateObject12$a || (_templateObject12$a = _taggedTemplateLiteralLoose(["\n width: ", ";\n height: ", ";\n border-radius: 7px;\n"])), function (p) {
58153
+ var SkeletonLine$4 = styled__default(SkeletonBlock$5)(_templateObject12$b || (_templateObject12$b = _taggedTemplateLiteralLoose(["\n width: ", ";\n height: ", ";\n border-radius: 7px;\n"])), function (p) {
57808
58154
  return p.width;
57809
58155
  }, function (p) {
57810
58156
  return p.height || '14px';
57811
58157
  });
57812
- var RoleBadge = styled__default.span(_templateObject13$9 || (_templateObject13$9 = _taggedTemplateLiteralLoose(["\n position: relative;\n padding: 2px 8px;\n border-radius: 12px;\n margin-left: 4px;\n font-weight: 500;\n font-size: 12px;\n line-height: 16px;\n color: ", ";\n\n &::after {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n border-radius: 12px;\n width: 100%;\n height: 100%;\n background-color: ", ";\n opacity: 0.1;\n }\n"])), function (props) {
58158
+ var RoleBadge = styled__default.span(_templateObject13$a || (_templateObject13$a = _taggedTemplateLiteralLoose(["\n position: relative;\n padding: 2px 8px;\n border-radius: 12px;\n margin-left: 4px;\n font-weight: 500;\n font-size: 12px;\n line-height: 16px;\n color: ", ";\n\n &::after {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n border-radius: 12px;\n width: 100%;\n height: 100%;\n background-color: ", ";\n opacity: 0.1;\n }\n"])), function (props) {
57813
58159
  return props.color;
57814
58160
  }, function (props) {
57815
58161
  return props.backgroundColor;
@@ -58789,7 +59135,7 @@ function SvgChevronDownSearch(props) {
58789
59135
  })));
58790
59136
  }
58791
59137
 
58792
- var _templateObject$1b, _templateObject2$16, _templateObject3$Y, _templateObject4$Q, _templateObject5$K, _templateObject6$F, _templateObject7$C, _templateObject8$z, _templateObject9$s, _templateObject0$p, _templateObject1$l, _templateObject10$i, _templateObject11$f, _templateObject12$b, _templateObject13$a, _templateObject14$7, _templateObject15$5, _templateObject16$4, _templateObject17$4, _templateObject18$4, _templateObject19$4, _templateObject20$4, _templateObject21$3, _templateObject22$2, _templateObject23$2, _templateObject24$2, _templateObject25$2;
59138
+ var _templateObject$1b, _templateObject2$16, _templateObject3$Y, _templateObject4$Q, _templateObject5$K, _templateObject6$F, _templateObject7$C, _templateObject8$z, _templateObject9$s, _templateObject0$p, _templateObject1$l, _templateObject10$i, _templateObject11$f, _templateObject12$c, _templateObject13$b, _templateObject14$7, _templateObject15$5, _templateObject16$4, _templateObject17$4, _templateObject18$4, _templateObject19$4, _templateObject20$4, _templateObject21$3, _templateObject22$2, _templateObject23$2, _templateObject24$2, _templateObject25$2;
58793
59139
  var SEARCH_DEBOUNCE_MS = 400;
58794
59140
  function formatMessageDate(date) {
58795
59141
  if (!date) return '';
@@ -59231,8 +59577,8 @@ var StatusText$1 = styled__default.p(_templateObject11$f || (_templateObject11$f
59231
59577
  }, function (props) {
59232
59578
  return props.full ? 'height: 100%;' : '';
59233
59579
  });
59234
- var GroupSection = styled__default.div(_templateObject12$b || (_templateObject12$b = _taggedTemplateLiteralLoose(["\n position: relative;\n"])));
59235
- var GroupLabel = styled__default.div(_templateObject13$a || (_templateObject13$a = _taggedTemplateLiteralLoose(["\n position: sticky;\n top: 0;\n z-index: 1;\n background-color: ", ";\n text-transform: capitalize;\n letter-spacing: 0.5px;\n color: ", ";\n padding: 12px 16px 4px;\n font-weight: 500;\n font-size: 13px;\n line-height: 16px;\n user-select: none;\n"])), function (p) {
59580
+ var GroupSection = styled__default.div(_templateObject12$c || (_templateObject12$c = _taggedTemplateLiteralLoose(["\n position: relative;\n"])));
59581
+ var GroupLabel = styled__default.div(_templateObject13$b || (_templateObject13$b = _taggedTemplateLiteralLoose(["\n position: sticky;\n top: 0;\n z-index: 1;\n background-color: ", ";\n text-transform: capitalize;\n letter-spacing: 0.5px;\n color: ", ";\n padding: 12px 16px 4px;\n font-weight: 500;\n font-size: 13px;\n line-height: 16px;\n user-select: none;\n"])), function (p) {
59236
59582
  return p.backgroundColor;
59237
59583
  }, function (p) {
59238
59584
  return p.color;