sceyt-chat-react-uikit 1.7.6-beta.5 → 1.7.6-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.modern.js CHANGED
@@ -9101,15 +9101,6 @@ var query = {
9101
9101
  ReactionsQuery: null,
9102
9102
  PollVotesQueries: {}
9103
9103
  };
9104
- var unreadScrollTo = {
9105
- isScrolled: true
9106
- };
9107
- function getUnreadScrollTo() {
9108
- return unreadScrollTo.isScrolled;
9109
- }
9110
- function setUnreadScrollTo(state) {
9111
- unreadScrollTo.isScrolled = state;
9112
- }
9113
9104
  function getUploadImageIcon() {
9114
9105
  return UploadImageIcon;
9115
9106
  }
@@ -10314,6 +10305,11 @@ function showScrollToNewMessageButtonAC(state) {
10314
10305
  state: state
10315
10306
  });
10316
10307
  }
10308
+ function setUnreadScrollToAC(state) {
10309
+ return setUnreadScrollTo({
10310
+ state: state
10311
+ });
10312
+ }
10317
10313
  function loadMoreMessagesAC(channelId, limit, direction, messageId, hasNext) {
10318
10314
  return {
10319
10315
  type: LOAD_MORE_MESSAGES,
@@ -10646,6 +10642,51 @@ var MESSAGE_LOAD_DIRECTION = {
10646
10642
  PREV: 'prev',
10647
10643
  NEXT: 'next'
10648
10644
  };
10645
+ var shouldSkipDeliveryStatusUpdate = function shouldSkipDeliveryStatusUpdate(markerName, currentDeliveryStatus) {
10646
+ if (markerName === MESSAGE_DELIVERY_STATUS.SENT && (currentDeliveryStatus === MESSAGE_DELIVERY_STATUS.SENT || currentDeliveryStatus === MESSAGE_DELIVERY_STATUS.DELIVERED || currentDeliveryStatus === MESSAGE_DELIVERY_STATUS.READ || currentDeliveryStatus === MESSAGE_DELIVERY_STATUS.PLAYED)) {
10647
+ return true;
10648
+ }
10649
+ if (markerName === MESSAGE_DELIVERY_STATUS.DELIVERED && (currentDeliveryStatus === MESSAGE_DELIVERY_STATUS.DELIVERED || currentDeliveryStatus === MESSAGE_DELIVERY_STATUS.READ || currentDeliveryStatus === MESSAGE_DELIVERY_STATUS.PLAYED)) {
10650
+ return true;
10651
+ }
10652
+ if (markerName === MESSAGE_DELIVERY_STATUS.READ && (currentDeliveryStatus === MESSAGE_DELIVERY_STATUS.READ || currentDeliveryStatus === MESSAGE_DELIVERY_STATUS.PLAYED)) {
10653
+ return true;
10654
+ }
10655
+ if (markerName === MESSAGE_DELIVERY_STATUS.PLAYED && currentDeliveryStatus === MESSAGE_DELIVERY_STATUS.PLAYED) {
10656
+ return true;
10657
+ }
10658
+ return false;
10659
+ };
10660
+ var updateMessageDeliveryStatusAndMarkers = function updateMessageDeliveryStatusAndMarkers(message, markerName) {
10661
+ var _message$markerTotals;
10662
+ if (shouldSkipDeliveryStatusUpdate(markerName, message.deliveryStatus)) {
10663
+ return {
10664
+ markerTotals: message.markerTotals,
10665
+ deliveryStatus: message.deliveryStatus
10666
+ };
10667
+ }
10668
+ var markerInMarkersTotal = message === null || message === void 0 ? void 0 : (_message$markerTotals = message.markerTotals) === null || _message$markerTotals === void 0 ? void 0 : _message$markerTotals.find(function (marker) {
10669
+ return marker.name === markerName;
10670
+ });
10671
+ if (!markerInMarkersTotal) {
10672
+ return {
10673
+ markerTotals: [].concat(message.markerTotals || [], [{
10674
+ name: markerName,
10675
+ count: 1
10676
+ }]),
10677
+ deliveryStatus: markerName
10678
+ };
10679
+ } else {
10680
+ return {
10681
+ markerTotals: message.markerTotals.map(function (marker) {
10682
+ return marker.name === markerName ? _extends({}, marker, {
10683
+ count: marker.count + 1
10684
+ }) : marker;
10685
+ }),
10686
+ deliveryStatus: markerName
10687
+ };
10688
+ }
10689
+ };
10649
10690
  var sendMessageHandler;
10650
10691
  var setSendMessageHandler = function setSendMessageHandler(handler) {
10651
10692
  sendMessageHandler = handler;
@@ -10677,7 +10718,8 @@ var updateMessageOnAllMessages = function updateMessageOnAllMessages(messageId,
10677
10718
  if (updatedParams.state === MESSAGE_STATUS.DELETE) {
10678
10719
  return _extends({}, updatedParams);
10679
10720
  }
10680
- var updatedMessage = _extends({}, message, updatedParams);
10721
+ var statusUpdatedMessage = updateMessageDeliveryStatusAndMarkers(message, updatedParams.deliveryStatus);
10722
+ var updatedMessage = _extends({}, message, updatedParams, statusUpdatedMessage);
10681
10723
  if (voteDetails) {
10682
10724
  updatedMessage = _extends({}, updatedMessage, {
10683
10725
  pollDetails: handleVoteDetails(voteDetails, updatedMessage)
@@ -10688,6 +10730,15 @@ var updateMessageOnAllMessages = function updateMessageOnAllMessages(messageId,
10688
10730
  return message;
10689
10731
  });
10690
10732
  };
10733
+ var updateMessageStatusOnAllMessages = function updateMessageStatusOnAllMessages(name, markersMap) {
10734
+ activeChannelAllMessages = activeChannelAllMessages.map(function (message) {
10735
+ if (markersMap[message.id]) {
10736
+ var statusUpdatedMessage = updateMessageDeliveryStatusAndMarkers(message, name);
10737
+ return _extends({}, message, statusUpdatedMessage);
10738
+ }
10739
+ return message;
10740
+ });
10741
+ };
10691
10742
  var removeMessageFromAllMessages = function removeMessageFromAllMessages(messageId) {
10692
10743
  activeChannelAllMessages = [].concat(activeChannelAllMessages).filter(function (msg) {
10693
10744
  return !(msg.id === messageId || msg.tid === messageId);
@@ -10695,12 +10746,11 @@ var removeMessageFromAllMessages = function removeMessageFromAllMessages(message
10695
10746
  };
10696
10747
  var updateMarkersOnAllMessages = function updateMarkersOnAllMessages(markersMap, name) {
10697
10748
  activeChannelAllMessages = activeChannelAllMessages.map(function (message) {
10698
- if (markersMap[message.id] && (message.deliveryStatus === MESSAGE_DELIVERY_STATUS.SENT || name === MESSAGE_DELIVERY_STATUS.READ)) {
10699
- return _extends({}, message, {
10700
- deliveryStatus: name
10701
- });
10749
+ if (!markersMap[message.id]) {
10750
+ return message;
10702
10751
  }
10703
- return message;
10752
+ var statusUpdatedMessage = updateMessageDeliveryStatusAndMarkers(message, name);
10753
+ return _extends({}, message, statusUpdatedMessage);
10704
10754
  });
10705
10755
  };
10706
10756
  var getAllMessages = function getAllMessages() {
@@ -10778,7 +10828,8 @@ function updateMessageOnMap(channelId, updatedMessage, voteDetails) {
10778
10828
  var _pendingMessagesMap$c;
10779
10829
  var updatedPendingMessages = (_pendingMessagesMap$c = pendingMessagesMap[channelId]) === null || _pendingMessagesMap$c === void 0 ? void 0 : _pendingMessagesMap$c.map(function (msg) {
10780
10830
  if (msg.tid === updatedMessage.messageId) {
10781
- return _extends({}, msg, updatedMessage.params);
10831
+ var statusUpdatedMessage = updateMessageDeliveryStatusAndMarkers(msg, updatedMessage.params.deliveryStatus);
10832
+ return _extends({}, msg, updatedMessage.params, statusUpdatedMessage);
10782
10833
  }
10783
10834
  return msg;
10784
10835
  });
@@ -10800,7 +10851,8 @@ function updateMessageOnMap(channelId, updatedMessage, voteDetails) {
10800
10851
  messagesList.push(_extends({}, mes, updatedMessageData));
10801
10852
  continue;
10802
10853
  } else {
10803
- updatedMessageData = _extends({}, mes, updatedMessage.params);
10854
+ var statusUpdatedMessage = updateMessageDeliveryStatusAndMarkers(mes, updatedMessage.params.deliveryStatus);
10855
+ updatedMessageData = _extends({}, mes, updatedMessage.params, statusUpdatedMessage);
10804
10856
  var voteDetailsData = void 0;
10805
10857
  if (voteDetails) {
10806
10858
  voteDetailsData = handleVoteDetails(voteDetails, updatedMessageData);
@@ -10899,12 +10951,11 @@ function updateMessageStatusOnMap(channelId, newMarkers) {
10899
10951
  messagesMap[channelId] = messagesMap[channelId].map(function (mes) {
10900
10952
  var name = newMarkers.name;
10901
10953
  var markersMap = newMarkers.markersMap;
10902
- if (markersMap[mes.id] && (mes.deliveryStatus === MESSAGE_DELIVERY_STATUS.SENT || name === MESSAGE_DELIVERY_STATUS.READ)) {
10903
- return _extends({}, mes, {
10904
- deliveryStatus: name
10905
- });
10954
+ if (!markersMap[mes.id]) {
10955
+ return mes;
10906
10956
  }
10907
- return mes;
10957
+ var statusUpdatedMessage = updateMessageDeliveryStatusAndMarkers(mes, name);
10958
+ return _extends({}, mes, statusUpdatedMessage);
10908
10959
  });
10909
10960
  }
10910
10961
  }
@@ -11125,7 +11176,8 @@ var initialState$1 = {
11125
11176
  pollVotesLoadingState: {},
11126
11177
  pollVotesInitialCount: null,
11127
11178
  pendingPollActions: {},
11128
- pendingMessagesMap: {}
11179
+ pendingMessagesMap: {},
11180
+ unreadScrollTo: true
11129
11181
  };
11130
11182
  var messageSlice = createSlice({
11131
11183
  name: 'messages',
@@ -11159,6 +11211,9 @@ var messageSlice = createSlice({
11159
11211
  setShowScrollToNewMessageButton: function setShowScrollToNewMessageButton(state, action) {
11160
11212
  state.showScrollToNewMessageButton = action.payload.state;
11161
11213
  },
11214
+ setUnreadScrollTo: function setUnreadScrollTo(state, action) {
11215
+ state.unreadScrollTo = action.payload.state;
11216
+ },
11162
11217
  setMessages: function setMessages(state, action) {
11163
11218
  state.activeChannelMessages = action.payload.messages;
11164
11219
  },
@@ -11219,8 +11274,18 @@ var messageSlice = createSlice({
11219
11274
  markersMap = _action$payload2.markersMap;
11220
11275
  var markerName = name;
11221
11276
  for (var index = 0; index < state.activeChannelMessages.length; index++) {
11222
- if (markersMap[state.activeChannelMessages[index].id] && (state.activeChannelMessages[index].deliveryStatus === MESSAGE_DELIVERY_STATUS.SENT || markerName === MESSAGE_DELIVERY_STATUS.READ) && state.activeChannelMessages[index].state !== 'Deleted') {
11223
- state.activeChannelMessages[index].deliveryStatus = markerName;
11277
+ if (!markersMap[state.activeChannelMessages[index].id]) {
11278
+ continue;
11279
+ }
11280
+ if (state.activeChannelMessages[index].state !== 'Deleted') {
11281
+ var message = state.activeChannelMessages[index];
11282
+ var _updateMessageDeliver = updateMessageDeliveryStatusAndMarkers(message, markerName),
11283
+ markerTotals = _updateMessageDeliver.markerTotals,
11284
+ deliveryStatus = _updateMessageDeliver.deliveryStatus;
11285
+ state.activeChannelMessages[index] = _extends({}, message, {
11286
+ markerTotals: markerTotals,
11287
+ deliveryStatus: deliveryStatus
11288
+ });
11224
11289
  }
11225
11290
  }
11226
11291
  },
@@ -11237,10 +11302,15 @@ var messageSlice = createSlice({
11237
11302
  if (params.state === MESSAGE_STATUS.DELETE) {
11238
11303
  return _extends({}, params);
11239
11304
  } else {
11240
- var messageData = _extends({}, message, params);
11305
+ var statusUpdatedMessage = null;
11306
+ if (params !== null && params !== void 0 && params.deliveryStatus) {
11307
+ statusUpdatedMessage = updateMessageDeliveryStatusAndMarkers(message, params.deliveryStatus);
11308
+ }
11309
+ var messageOldData = _extends({}, message, params, statusUpdatedMessage);
11310
+ var messageData = _extends({}, messageOldData);
11241
11311
  if (voteDetails) {
11242
- messageData = _extends({}, messageData, {
11243
- pollDetails: handleVoteDetails(voteDetails, messageData)
11312
+ messageData = _extends({}, messageOldData, {
11313
+ pollDetails: handleVoteDetails(voteDetails, messageOldData)
11244
11314
  });
11245
11315
  }
11246
11316
  if (messageData.deliveryStatus !== MESSAGE_DELIVERY_STATUS.PENDING) {
@@ -11684,6 +11754,7 @@ var _messageSlice$actions = messageSlice.actions,
11684
11754
  setScrollToMentionedMessage = _messageSlice$actions.setScrollToMentionedMessage,
11685
11755
  setScrollToNewMessage = _messageSlice$actions.setScrollToNewMessage,
11686
11756
  setShowScrollToNewMessageButton = _messageSlice$actions.setShowScrollToNewMessageButton,
11757
+ setUnreadScrollTo = _messageSlice$actions.setUnreadScrollTo,
11687
11758
  setMessages = _messageSlice$actions.setMessages,
11688
11759
  addMessages = _messageSlice$actions.addMessages,
11689
11760
  updateMessagesStatus = _messageSlice$actions.updateMessagesStatus,
@@ -14777,9 +14848,7 @@ function watchForEvents() {
14777
14848
  _context2.n = 58;
14778
14849
  return put(scrollToNewMessageAC(true, false, true));
14779
14850
  case 58:
14780
- if (getMessagesFromMap(_channel5.id) && getMessagesFromMap(_channel5.id).length) {
14781
- addMessageToMap(_channel5.id, message);
14782
- }
14851
+ addMessageToMap(_channel5.id, message);
14783
14852
  _context2.n = 59;
14784
14853
  return put(updateChannelDataAC(_channel5.id, {
14785
14854
  messageCount: channelForAdd.messageCount,
@@ -14979,6 +15048,7 @@ function watchForEvents() {
14979
15048
  name: markerList.name,
14980
15049
  markersMap: markersMap
14981
15050
  });
15051
+ updateMessageStatusOnAllMessages(markerList.name, markersMap);
14982
15052
  _context2.n = 77;
14983
15053
  return put(updateMessagesMarkersAC(channelId, markerList.name, markerList));
14984
15054
  case 77:
@@ -16847,7 +16917,7 @@ function switchChannel(action) {
16847
16917
  }
16848
16918
  currentActiveChannel = getChannelFromMap(getActiveChannelId());
16849
16919
  _context10.n = 11;
16850
- return call(setUnreadScrollTo, true);
16920
+ return put(setUnreadScrollToAC(true));
16851
16921
  case 11:
16852
16922
  _context10.n = 12;
16853
16923
  return call(setActiveChannelId, channel && channel.id);
@@ -18491,6 +18561,9 @@ var pendingPollActionsSelector = function pendingPollActionsSelector(store) {
18491
18561
  var pendingMessagesMapSelector = function pendingMessagesMapSelector(store) {
18492
18562
  return store.MessageReducer.pendingMessagesMap;
18493
18563
  };
18564
+ var unreadScrollToSelector = function unreadScrollToSelector(store) {
18565
+ return store.MessageReducer.unreadScrollTo;
18566
+ };
18494
18567
 
18495
18568
  var getFrame = function getFrame(videoSrc, time) {
18496
18569
  try {
@@ -19212,15 +19285,12 @@ function sendTextMessage(action) {
19212
19285
  throw new Error('Connection required to send message');
19213
19286
  case 17:
19214
19287
  _context4.n = 18;
19215
- return put(getMessagesAC(channel, true, channel.lastMessage.id, undefined, undefined, false));
19216
- case 18:
19217
- _context4.n = 19;
19218
19288
  return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
19219
- case 19:
19220
- _context4.n = 22;
19289
+ case 18:
19290
+ _context4.n = 21;
19221
19291
  break;
19222
- case 20:
19223
- _context4.p = 20;
19292
+ case 19:
19293
+ _context4.p = 19;
19224
19294
  _t3 = _context4.v;
19225
19295
  log.error('error on send text message ... ', _t3);
19226
19296
  updateMessageOnMap(channel.id, {
@@ -19230,23 +19300,23 @@ function sendTextMessage(action) {
19230
19300
  }
19231
19301
  });
19232
19302
  if (!(activeChannelId === channel.id)) {
19233
- _context4.n = 21;
19303
+ _context4.n = 20;
19234
19304
  break;
19235
19305
  }
19236
19306
  updateMessageOnAllMessages(sendMessageTid, {
19237
19307
  state: MESSAGE_STATUS.FAILED
19238
19308
  });
19239
- _context4.n = 21;
19309
+ _context4.n = 20;
19240
19310
  return put(updateMessageAC(sendMessageTid, {
19241
19311
  state: MESSAGE_STATUS.FAILED
19242
19312
  }));
19243
- case 21:
19244
- _context4.n = 22;
19313
+ case 20:
19314
+ _context4.n = 21;
19245
19315
  return put(setMessagesLoadingStateAC(LOADING_STATE.LOADED));
19246
- case 22:
19316
+ case 21:
19247
19317
  return _context4.a(2);
19248
19318
  }
19249
- }, _marked2$2, null, [[3, 20]]);
19319
+ }, _marked2$2, null, [[3, 19]]);
19250
19320
  }
19251
19321
  function forwardMessage(action) {
19252
19322
  var payload, message, channelId, connectionState, isForward, channel, SceytChatClient, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, pollDetails, messageToSend, pendingMessage, activeChannelId, isCachedChannel, hasNextMessages, messageResponse, messageUpdateData, messageToUpdate, channelUpdateParam, _t4;
@@ -19918,7 +19988,7 @@ function editMessage(action) {
19918
19988
  }, _marked6$1, null, [[0, 5]]);
19919
19989
  }
19920
19990
  function getMessagesQuery(action) {
19921
- var _action$payload, channel, loadWithLastMessage, messageId, limit, withDeliveredMessages, highlight, behavior, SceytChatClient, messageQueryBuilder, messageQuery, cachedMessages, result, allMessages, havLastMessage, secondResult, sentMessages, messagesMap, filteredSentMessages, _allMessages, messageIndex, maxLengthPart, _secondResult, thirdResult, _secondResult2, _thirdResult, _secondResult3, _secondResult4, updatedMessages, pendingMessages, _messagesMap, filteredPendingMessages, _t9;
19991
+ var _action$payload, channel, loadWithLastMessage, messageId, limit, withDeliveredMessages, highlight, behavior, SceytChatClient, messageQueryBuilder, messageQuery, cachedMessages, result, allMessages, havLastMessage, secondResult, sentMessages, messagesMap, filteredSentMessages, _allMessages, messageIndex, maxLengthPart, _secondResult, thirdResult, _secondResult2, _thirdResult, _secondResult3, _secondResult4, updatedMessages, lastMessageId, _allMessages2, allMessagesAfterLastMessage, pendingMessages, _messagesMap, filteredPendingMessages, _t9;
19922
19992
  return _regenerator().w(function (_context9) {
19923
19993
  while (1) switch (_context9.p = _context9.n) {
19924
19994
  case 0:
@@ -20199,13 +20269,19 @@ function getMessagesQuery(action) {
20199
20269
  updateMessageOnAllMessages(msg.id, updatedMessage || msg);
20200
20270
  updatedMessages.push(updatedMessage || msg);
20201
20271
  });
20272
+ lastMessageId = updatedMessages[updatedMessages.length - 1].id;
20273
+ _allMessages2 = getAllMessages();
20274
+ allMessagesAfterLastMessage = _allMessages2.filter(function (msg) {
20275
+ return msg.id > lastMessageId;
20276
+ });
20277
+ updatedMessages = [].concat(updatedMessages, allMessagesAfterLastMessage);
20202
20278
  setMessagesToMap(channel.id, updatedMessages);
20203
- setAllMessages([].concat(updatedMessages));
20279
+ setAllMessages(updatedMessages);
20204
20280
  _context9.n = 44;
20205
20281
  return put(setMessagesAC(JSON.parse(JSON.stringify(updatedMessages))));
20206
20282
  case 44:
20207
20283
  _context9.n = 45;
20208
- return put(setMessagesHasPrevAC(result.hasNext));
20284
+ return put(setMessagesHasPrevAC(true));
20209
20285
  case 45:
20210
20286
  _context9.n = 46;
20211
20287
  return put(setMessagesHasNextAC(false));
@@ -34761,7 +34837,8 @@ var OGMetadata = function OGMetadata(_ref) {
34761
34837
  var _useColor = useColors(),
34762
34838
  incomingMessageBackgroundX = _useColor[THEME_COLORS.INCOMING_MESSAGE_BACKGROUND_X],
34763
34839
  outgoingMessageBackgroundX = _useColor[THEME_COLORS.OUTGOING_MESSAGE_BACKGROUND_X],
34764
- textSecondary = _useColor[THEME_COLORS.TEXT_SECONDARY];
34840
+ textSecondary = _useColor[THEME_COLORS.TEXT_SECONDARY],
34841
+ textPrimary = _useColor[THEME_COLORS.TEXT_PRIMARY];
34765
34842
  var attachment = useMemo(function () {
34766
34843
  return attachments.find(function (attachment) {
34767
34844
  return attachment.type === attachmentTypes.link;
@@ -34887,7 +34964,7 @@ var OGMetadata = function OGMetadata(_ref) {
34887
34964
  }
34888
34965
  }, []);
34889
34966
  useEffect(function () {
34890
- if (attachment !== null && attachment !== void 0 && attachment.id && attachment !== null && attachment !== void 0 && attachment.url && !metadata) {
34967
+ if (attachment !== null && attachment !== void 0 && attachment.id && attachment !== null && attachment !== void 0 && attachment.url && !(oGMetadata !== null && oGMetadata !== void 0 && oGMetadata[attachment === null || attachment === void 0 ? void 0 : attachment.url])) {
34891
34968
  setShouldAnimate(true);
34892
34969
  var url = attachment === null || attachment === void 0 ? void 0 : attachment.url;
34893
34970
  if (url) {
@@ -34895,6 +34972,7 @@ var OGMetadata = function OGMetadata(_ref) {
34895
34972
  try {
34896
34973
  if (cachedMetadata) {
34897
34974
  handleMetadata(cachedMetadata);
34975
+ setMetadataLoaded(true);
34898
34976
  }
34899
34977
  ogMetadataQueryBuilder(url);
34900
34978
  return Promise.resolve();
@@ -34907,7 +34985,7 @@ var OGMetadata = function OGMetadata(_ref) {
34907
34985
  });
34908
34986
  }
34909
34987
  }
34910
- }, [attachment, metadata]);
34988
+ }, [attachment, oGMetadata === null || oGMetadata === void 0 ? void 0 : oGMetadata[attachment === null || attachment === void 0 ? void 0 : attachment.url]]);
34911
34989
  var ogUrl = useMemo(function () {
34912
34990
  var url = attachment === null || attachment === void 0 ? void 0 : attachment.url;
34913
34991
  var urlObj = validateUrl(url);
@@ -34942,18 +35020,23 @@ var OGMetadata = function OGMetadata(_ref) {
34942
35020
  link: 4
34943
35021
  };
34944
35022
  }, [order]);
35023
+ var MIN_IMAGE_HEIGHT = 180;
35024
+ var MAX_IMAGE_HEIGHT = 400;
35025
+ var showImage = useMemo(function () {
35026
+ return hasImage && calculatedImageHeight >= MIN_IMAGE_HEIGHT && calculatedImageHeight <= MAX_IMAGE_HEIGHT;
35027
+ }, [hasImage, calculatedImageHeight]);
34945
35028
  useEffect(function () {
34946
35029
  if (metadataLoaded || oGMetadata !== null && oGMetadata !== void 0 && oGMetadata[attachment === null || attachment === void 0 ? void 0 : attachment.url]) {
34947
- if (metadata && metadataGetSuccessCallback && (hasImage || faviconUrl)) {
34948
- metadataGetSuccessCallback(attachment === null || attachment === void 0 ? void 0 : attachment.url, true, hasImage);
35030
+ if (oGMetadata !== null && oGMetadata !== void 0 && oGMetadata[attachment === null || attachment === void 0 ? void 0 : attachment.url] && metadataGetSuccessCallback && metadata) {
35031
+ metadataGetSuccessCallback(attachment === null || attachment === void 0 ? void 0 : attachment.url, true, showImage, metadata);
34949
35032
  } else {
34950
- metadataGetSuccessCallback === null || metadataGetSuccessCallback === void 0 ? void 0 : metadataGetSuccessCallback(attachment === null || attachment === void 0 ? void 0 : attachment.url, false, false);
35033
+ metadataGetSuccessCallback === null || metadataGetSuccessCallback === void 0 ? void 0 : metadataGetSuccessCallback(attachment === null || attachment === void 0 ? void 0 : attachment.url, false, false, metadata);
34951
35034
  }
34952
35035
  }
34953
- }, [metadata, metadataLoaded, oGMetadata, attachment === null || attachment === void 0 ? void 0 : attachment.url, hasImage]);
35036
+ }, [metadataLoaded, oGMetadata, attachment === null || attachment === void 0 ? void 0 : attachment.url, metadata]);
34954
35037
  var elements = useMemo(function () {
34955
- var _resolvedOrder$image, _metadata$og11, _metadata$og11$image, _metadata$og11$image$, _resolvedOrder$title, _metadata$og12, _metadata$og13, _resolvedOrder$descri, _metadata$og14, _metadata$og15, _resolvedOrder$link;
34956
- return [hasImage ? {
35038
+ var _resolvedOrder$image, _metadata$og11, _metadata$og11$image, _metadata$og11$image$, _resolvedOrder$title, _metadata$og12, _metadata$og13, _metadata$og13$title, _resolvedOrder$descri, _metadata$og14, _metadata$og15, _metadata$og15$descri, _resolvedOrder$link;
35039
+ return [showImage ? {
34957
35040
  key: 'image',
34958
35041
  order: (_resolvedOrder$image = resolvedOrder === null || resolvedOrder === void 0 ? void 0 : resolvedOrder.image) != null ? _resolvedOrder$image : 1,
34959
35042
  render: (/*#__PURE__*/React__default.createElement(ImageContainer, {
@@ -34974,8 +35057,9 @@ var OGMetadata = function OGMetadata(_ref) {
34974
35057
  render: ogShowTitle && (metadata === null || metadata === void 0 ? void 0 : (_metadata$og12 = metadata.og) === null || _metadata$og12 === void 0 ? void 0 : _metadata$og12.title) && (/*#__PURE__*/React__default.createElement(Title$3, {
34975
35058
  maxWidth: maxWidth,
34976
35059
  shouldAnimate: shouldAnimate,
34977
- padding: infoPadding
34978
- }, /*#__PURE__*/React__default.createElement("span", null, metadata === null || metadata === void 0 ? void 0 : (_metadata$og13 = metadata.og) === null || _metadata$og13 === void 0 ? void 0 : _metadata$og13.title)))
35060
+ padding: infoPadding,
35061
+ color: textPrimary
35062
+ }, /*#__PURE__*/React__default.createElement("span", null, metadata === null || metadata === void 0 ? void 0 : (_metadata$og13 = metadata.og) === null || _metadata$og13 === void 0 ? void 0 : (_metadata$og13$title = _metadata$og13.title) === null || _metadata$og13$title === void 0 ? void 0 : _metadata$og13$title.trim())))
34979
35063
  }, {
34980
35064
  key: 'description',
34981
35065
  order: (_resolvedOrder$descri = resolvedOrder === null || resolvedOrder === void 0 ? void 0 : resolvedOrder.description) != null ? _resolvedOrder$descri : 3,
@@ -34984,7 +35068,7 @@ var OGMetadata = function OGMetadata(_ref) {
34984
35068
  shouldAnimate: shouldAnimate,
34985
35069
  color: textSecondary,
34986
35070
  padding: infoPadding
34987
- }, metadata === null || metadata === void 0 ? void 0 : (_metadata$og15 = metadata.og) === null || _metadata$og15 === void 0 ? void 0 : _metadata$og15.description))
35071
+ }, metadata === null || metadata === void 0 ? void 0 : (_metadata$og15 = metadata.og) === null || _metadata$og15 === void 0 ? void 0 : (_metadata$og15$descri = _metadata$og15.description) === null || _metadata$og15$descri === void 0 ? void 0 : _metadata$og15$descri.trim()))
34988
35072
  }, {
34989
35073
  key: 'link',
34990
35074
  order: (_resolvedOrder$link = resolvedOrder === null || resolvedOrder === void 0 ? void 0 : resolvedOrder.link) != null ? _resolvedOrder$link : 4,
@@ -35042,7 +35126,8 @@ var OGMetadata = function OGMetadata(_ref) {
35042
35126
  borderRadius: ogContainerBorderRadius,
35043
35127
  padding: ogContainerPadding,
35044
35128
  className: ogContainerClassName,
35045
- containerMargin: ogContainerMargin
35129
+ containerMargin: ogContainerMargin,
35130
+ maxWidth: maxWidth
35046
35131
  }, isInviteLink ? {
35047
35132
  as: 'div',
35048
35133
  onClick: function onClick() {
@@ -35056,84 +35141,90 @@ var OGMetadata = function OGMetadata(_ref) {
35056
35141
  }), content);
35057
35142
  };
35058
35143
  var sharedKeyframes = "\n @keyframes fadeInSlideUp {\n from {\n opacity: 0;\n transform: translateY(10px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n\n @keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n\n @keyframes expandHeight {\n from {\n max-height: 0;\n opacity: 0;\n }\n to {\n max-height: 1000px;\n opacity: 1;\n }\n }\n";
35059
- var OGMetadataContainer = styled.div(_templateObject$F || (_templateObject$F = _taggedTemplateLiteralLoose(["\n min-width: inherit;\n max-width: inherit;\n width: 100%;\n display: grid;\n grid-template-columns: 1fr;\n background-color: ", ";\n border-radius: ", ";\n margin: ", ";\n // margin-bottom: ", ";\n padding: ", ";\n text-decoration: none;\n color: inherit;\n &:hover {\n opacity: 0.9;\n cursor: pointer;\n }\n"])), function (_ref2) {
35060
- var showBackground = _ref2.showBackground,
35061
- customBg = _ref2.customBg,
35062
- bgColor = _ref2.bgColor;
35063
- return showBackground ? customBg != null ? customBg : bgColor : 'transparent';
35144
+ var OGMetadataContainer = styled.div(_templateObject$F || (_templateObject$F = _taggedTemplateLiteralLoose(["\n min-width: inherit;\n max-width: ", ";\n width: 100%;\n display: grid;\n grid-template-columns: 1fr;\n border-radius: 8px;\n background-color: ", ";\n border-radius: ", ";\n margin: ", ";\n // margin-bottom: ", ";\n padding: ", ";\n text-decoration: none;\n // color: inherit;\n &:hover {\n opacity: 0.9;\n cursor: pointer;\n }\n"])), function (_ref2) {
35145
+ var maxWidth = _ref2.maxWidth;
35146
+ return maxWidth ? maxWidth + "px" : 'inherit';
35064
35147
  }, function (_ref3) {
35065
- var borderRadius = _ref3.borderRadius;
35066
- return borderRadius !== undefined ? borderRadius : '8px';
35148
+ var showBackground = _ref3.showBackground,
35149
+ customBg = _ref3.customBg,
35150
+ bgColor = _ref3.bgColor;
35151
+ return showBackground ? customBg != null ? customBg : bgColor : 'transparent';
35067
35152
  }, function (_ref4) {
35068
- var containerMargin = _ref4.containerMargin;
35069
- return containerMargin != null ? containerMargin : '0.8rem auto 0';
35153
+ var borderRadius = _ref4.borderRadius;
35154
+ return borderRadius !== undefined ? borderRadius : '8px';
35070
35155
  }, function (_ref5) {
35071
- var showOGMetadata = _ref5.showOGMetadata;
35072
- return showOGMetadata ? '0.4rem' : '0';
35156
+ var containerMargin = _ref5.containerMargin;
35157
+ return containerMargin != null ? containerMargin : '0.8rem auto 0';
35073
35158
  }, function (_ref6) {
35074
- var padding = _ref6.padding;
35159
+ var showOGMetadata = _ref6.showOGMetadata;
35160
+ return showOGMetadata ? '0.4rem' : '0';
35161
+ }, function (_ref7) {
35162
+ var padding = _ref7.padding;
35075
35163
  return padding != null ? padding : '0';
35076
35164
  });
35077
- var ImageContainer = styled.div(_templateObject2$A || (_templateObject2$A = _taggedTemplateLiteralLoose(["\n ", "\n width: 100%;\n height: ", ";\n opacity: ", ";\n margin: 0 auto;\n overflow: hidden;\n ", "\n"])), sharedKeyframes, function (_ref7) {
35078
- var containerHeight = _ref7.containerHeight;
35165
+ var ImageContainer = styled.div(_templateObject2$A || (_templateObject2$A = _taggedTemplateLiteralLoose(["\n ", "\n width: 100%;\n height: ", ";\n opacity: ", ";\n margin: 0 auto;\n border-radius: 8px 8px 0 0;\n overflow: hidden;\n ", "\n"])), sharedKeyframes, function (_ref8) {
35166
+ var containerHeight = _ref8.containerHeight;
35079
35167
  return containerHeight ? containerHeight + "px" : '0px';
35080
- }, function (_ref8) {
35081
- var showOGMetadata = _ref8.showOGMetadata,
35082
- containerHeight = _ref8.containerHeight;
35083
- return showOGMetadata && containerHeight ? 1 : 0;
35084
35168
  }, function (_ref9) {
35085
- var shouldAnimate = _ref9.shouldAnimate,
35086
- showOGMetadata = _ref9.showOGMetadata,
35169
+ var showOGMetadata = _ref9.showOGMetadata,
35087
35170
  containerHeight = _ref9.containerHeight;
35171
+ return showOGMetadata && containerHeight ? 1 : 0;
35172
+ }, function (_ref0) {
35173
+ var shouldAnimate = _ref0.shouldAnimate,
35174
+ showOGMetadata = _ref0.showOGMetadata,
35175
+ containerHeight = _ref0.containerHeight;
35088
35176
  return shouldAnimate && showOGMetadata && containerHeight && "\n animation: expandHeight 0.3s ease-out forwards;\n ";
35089
35177
  });
35090
- var OGText = styled.div(_templateObject3$u || (_templateObject3$u = _taggedTemplateLiteralLoose(["\n ", "\n display: flex;\n flex-direction: column;\n gap: 0;\n ", "\n ", ";\n"])), sharedKeyframes, function (_ref0) {
35091
- var shouldAnimate = _ref0.shouldAnimate;
35178
+ var OGText = styled.div(_templateObject3$u || (_templateObject3$u = _taggedTemplateLiteralLoose(["\n ", "\n display: flex;\n flex-direction: column;\n gap: 0;\n ", "\n ", ";\n"])), sharedKeyframes, function (_ref1) {
35179
+ var shouldAnimate = _ref1.shouldAnimate;
35092
35180
  return shouldAnimate && "\n animation: fadeInSlideUp 0.3s ease-out forwards;\n ";
35093
- }, function (_ref1) {
35094
- var margin = _ref1.margin;
35181
+ }, function (_ref10) {
35182
+ var margin = _ref10.margin;
35095
35183
  return margin ? '12px' : '0';
35096
35184
  });
35097
- var Title$3 = styled.p(_templateObject4$q || (_templateObject4$q = _taggedTemplateLiteralLoose(["\n ", "\n font-weight: bold;\n font-size: 13px;\n line-height: 16px;\n margin: 8px 0 0 0;\n padding: ", ";\n box-sizing: border-box;\n ", "\n ", "\n"])), sharedKeyframes, function (_ref10) {
35098
- var padding = _ref10.padding;
35185
+ var Title$3 = styled.p(_templateObject4$q || (_templateObject4$q = _taggedTemplateLiteralLoose(["\n ", "\n // font-family: Inter;\n font-weight: 500;\n font-size: 14px;\n line-height: 18px;\n letter-spacing: 0px;\n color: ", ";\n margin: 4px 0 0 0;\n padding: ", ";\n box-sizing: border-box;\n ", "\n ", "\n"])), sharedKeyframes, function (_ref11) {
35186
+ var color = _ref11.color;
35187
+ return color;
35188
+ }, function (_ref12) {
35189
+ var padding = _ref12.padding;
35099
35190
  return padding != null ? padding : '0';
35100
- }, function (_ref11) {
35101
- var maxWidth = _ref11.maxWidth;
35191
+ }, function (_ref13) {
35192
+ var maxWidth = _ref13.maxWidth;
35102
35193
  return maxWidth && "\n max-width: " + maxWidth + "px;\n ";
35103
- }, function (_ref12) {
35104
- var shouldAnimate = _ref12.shouldAnimate;
35194
+ }, function (_ref14) {
35195
+ var shouldAnimate = _ref14.shouldAnimate;
35105
35196
  return shouldAnimate && "\n animation: fadeInSlideUp 0.3s ease-out 0.1s backwards;\n ";
35106
35197
  });
35107
- var Desc = styled.p(_templateObject5$l || (_templateObject5$l = _taggedTemplateLiteralLoose(["\n ", "\n font-weight: normal;\n font-size: 13px;\n line-height: 16px;\n margin: 0 0 8px 0;\n padding: ", ";\n color: ", ";\n display: -webkit-box;\n -webkit-line-clamp: 3;\n -webkit-box-orient: vertical;\n overflow: hidden;\n box-sizing: border-box;\n ", "\n ", "\n"])), sharedKeyframes, function (_ref13) {
35108
- var padding = _ref13.padding;
35198
+ var Desc = styled.p(_templateObject5$l || (_templateObject5$l = _taggedTemplateLiteralLoose(["\n ", "\n font-weight: normal;\n font-size: 13px;\n line-height: 16px;\n margin: 4px 0 4px 0;\n padding: ", ";\n color: ", ";\n display: -webkit-box;\n -webkit-line-clamp: 3;\n -webkit-box-orient: vertical;\n overflow: hidden;\n box-sizing: border-box;\n ", "\n ", "\n"])), sharedKeyframes, function (_ref15) {
35199
+ var padding = _ref15.padding;
35109
35200
  return padding != null ? padding : '0';
35110
- }, function (_ref14) {
35111
- var color = _ref14.color;
35201
+ }, function (_ref16) {
35202
+ var color = _ref16.color;
35112
35203
  return color;
35113
- }, function (_ref15) {
35114
- var maxWidth = _ref15.maxWidth;
35204
+ }, function (_ref17) {
35205
+ var maxWidth = _ref17.maxWidth;
35115
35206
  return maxWidth && "\n max-width: " + maxWidth + "px;\n ";
35116
- }, function (_ref16) {
35117
- var shouldAnimate = _ref16.shouldAnimate;
35207
+ }, function (_ref18) {
35208
+ var shouldAnimate = _ref18.shouldAnimate;
35118
35209
  return shouldAnimate && "\n animation: fadeInSlideUp 0.3s ease-out 0.2s backwards;\n ";
35119
35210
  });
35120
- var Url = styled.p(_templateObject6$j || (_templateObject6$j = _taggedTemplateLiteralLoose(["\n ", "\n font-weight: normal;\n font-size: 13px;\n line-height: 16px;\n margin: 0 0 12px 0;\n padding: ", ";\n color: gray;\n box-sizing: border-box;\n ", "\n ", "\n"])), sharedKeyframes, function (_ref17) {
35121
- var padding = _ref17.padding;
35211
+ var Url = styled.p(_templateObject6$j || (_templateObject6$j = _taggedTemplateLiteralLoose(["\n ", "\n font-weight: normal;\n font-size: 13px;\n line-height: 16px;\n margin: 0 0 12px 0;\n padding: ", ";\n color: gray;\n box-sizing: border-box;\n ", "\n ", "\n"])), sharedKeyframes, function (_ref19) {
35212
+ var padding = _ref19.padding;
35122
35213
  return padding != null ? padding : '0';
35123
- }, function (_ref18) {
35124
- var maxWidth = _ref18.maxWidth;
35214
+ }, function (_ref20) {
35215
+ var maxWidth = _ref20.maxWidth;
35125
35216
  return maxWidth && "\n max-width: " + maxWidth + "px;\n ";
35126
- }, function (_ref19) {
35127
- var shouldAnimate = _ref19.shouldAnimate;
35217
+ }, function (_ref21) {
35218
+ var shouldAnimate = _ref21.shouldAnimate;
35128
35219
  return shouldAnimate && "\n animation: fadeInSlideUp 0.3s ease-out 0.3s backwards;\n ";
35129
35220
  });
35130
- var Img = styled.img(_templateObject7$h || (_templateObject7$h = _taggedTemplateLiteralLoose(["\n ", "\n width: 100%;\n height: 100%;\n object-fit: cover;\n display: block;\n border-radius: inherit;\n ", "\n"])), sharedKeyframes, function (_ref20) {
35131
- var shouldAnimate = _ref20.shouldAnimate;
35221
+ var Img = styled.img(_templateObject7$h || (_templateObject7$h = _taggedTemplateLiteralLoose(["\n ", "\n width: 100%;\n height: 100%;\n object-fit: cover;\n display: block;\n // object-fit: cover;\n // object-position: center;\n // image-rendering: auto;\n border-radius: inherit;\n ", "\n"])), sharedKeyframes, function (_ref22) {
35222
+ var shouldAnimate = _ref22.shouldAnimate;
35132
35223
  return shouldAnimate && "\n animation: fadeIn 0.4s ease-out forwards;\n ";
35133
35224
  });
35134
- var OGRow = styled.div(_templateObject8$g || (_templateObject8$g = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n"])));
35225
+ var OGRow = styled.div(_templateObject8$g || (_templateObject8$g = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n padding: 0;\n"])));
35135
35226
  var OGTextWrapper = styled.div(_templateObject9$e || (_templateObject9$e = _taggedTemplateLiteralLoose(["\n flex: 1 1 auto;\n"])));
35136
- var FaviconContainer = styled.div(_templateObject0$d || (_templateObject0$d = _taggedTemplateLiteralLoose(["\n width: 52px;\n height: 52px;\n border-radius: 8px;\n overflow: hidden;\n margin: 12px;\n flex: 0 0 52px;\n"])));
35227
+ var FaviconContainer = styled.div(_templateObject0$d || (_templateObject0$d = _taggedTemplateLiteralLoose(["\n width: 52px;\n height: 52px;\n border-radius: 8px;\n overflow: hidden;\n margin: 8px;\n flex: 0 0 52px;\n"])));
35137
35228
  var FaviconImg = styled.img(_templateObject1$a || (_templateObject1$a = _taggedTemplateLiteralLoose(["\n width: 100%;\n height: 100%;\n object-fit: cover;\n display: block;\n"])));
35138
35229
 
35139
35230
  var _templateObject$G, _templateObject2$B, _templateObject3$v, _templateObject4$r, _templateObject5$m;
@@ -35362,6 +35453,41 @@ var MessageBody = function MessageBody(_ref) {
35362
35453
  var selectionIsActive = useMemo(function () {
35363
35454
  return selectedMessagesMap && selectedMessagesMap.size > 0;
35364
35455
  }, [selectedMessagesMap]);
35456
+ var hasLongLinkAttachmentUrl = useMemo(function () {
35457
+ if (!linkAttachment || !linkAttachment.url) return false;
35458
+ return linkAttachment.url.length > 100;
35459
+ }, [linkAttachment]);
35460
+ var oGMetadata = useSelector(function (state) {
35461
+ return state.MessageReducer.oGMetadata;
35462
+ });
35463
+ var linkMetadata = useMemo(function () {
35464
+ if (!(linkAttachment !== null && linkAttachment !== void 0 && linkAttachment.url)) return null;
35465
+ return (oGMetadata === null || oGMetadata === void 0 ? void 0 : oGMetadata[linkAttachment.url]) || null;
35466
+ }, [oGMetadata, linkAttachment === null || linkAttachment === void 0 ? void 0 : linkAttachment.url]);
35467
+ var ogMetadataContainerWidth = useMemo(function () {
35468
+ var _linkMetadata$og, _linkMetadata$og$imag, _linkMetadata$og$imag2, _linkMetadata$og2, _linkMetadata$og3, _linkMetadata$og3$fav;
35469
+ if (!linkMetadata || !linkAttachment) return (ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.maxWidth) || 400;
35470
+ if (hasLongLinkAttachmentUrl) {
35471
+ return 400;
35472
+ }
35473
+ var hasImage = (linkMetadata === null || linkMetadata === void 0 ? void 0 : (_linkMetadata$og = linkMetadata.og) === null || _linkMetadata$og === void 0 ? void 0 : (_linkMetadata$og$imag = _linkMetadata$og.image) === null || _linkMetadata$og$imag === void 0 ? void 0 : (_linkMetadata$og$imag2 = _linkMetadata$og$imag[0]) === null || _linkMetadata$og$imag2 === void 0 ? void 0 : _linkMetadata$og$imag2.url) && (linkMetadata === null || linkMetadata === void 0 ? void 0 : linkMetadata.imageWidth) && (linkMetadata === null || linkMetadata === void 0 ? void 0 : linkMetadata.imageHeight);
35474
+ var imageWidth = linkMetadata === null || linkMetadata === void 0 ? void 0 : linkMetadata.imageWidth;
35475
+ var imageHeight = linkMetadata === null || linkMetadata === void 0 ? void 0 : linkMetadata.imageHeight;
35476
+ var calculatedImageHeight = imageWidth && imageHeight ? imageHeight / (imageWidth / ((ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.maxWidth) || 400)) : 0;
35477
+ var showImage = hasImage && calculatedImageHeight >= 180 && calculatedImageHeight <= 400;
35478
+ var hasDescription = linkMetadata === null || linkMetadata === void 0 ? void 0 : (_linkMetadata$og2 = linkMetadata.og) === null || _linkMetadata$og2 === void 0 ? void 0 : _linkMetadata$og2.description;
35479
+ var hasFavicon = (ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.ogShowFavicon) && (linkMetadata === null || linkMetadata === void 0 ? void 0 : linkMetadata.faviconLoaded) && (linkMetadata === null || linkMetadata === void 0 ? void 0 : (_linkMetadata$og3 = linkMetadata.og) === null || _linkMetadata$og3 === void 0 ? void 0 : (_linkMetadata$og3$fav = _linkMetadata$og3.favicon) === null || _linkMetadata$og3$fav === void 0 ? void 0 : _linkMetadata$og3$fav.url);
35480
+ if (showImage) {
35481
+ return 400;
35482
+ }
35483
+ if (hasDescription && hasFavicon) {
35484
+ return 336;
35485
+ }
35486
+ if (hasDescription) {
35487
+ return 356;
35488
+ }
35489
+ return (ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.maxWidth) || 400;
35490
+ }, [linkMetadata, linkAttachment, ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.maxWidth, ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.ogShowFavicon, hasLongLinkAttachmentUrl]);
35365
35491
  var handleRemoveFailedAttachment = function handleRemoveFailedAttachment(attachmentId) {
35366
35492
  log.info('remove attachment .. ', attachmentId);
35367
35493
  };
@@ -35379,7 +35505,10 @@ var MessageBody = function MessageBody(_ref) {
35379
35505
  },
35380
35506
  borderRadius: borderRadius,
35381
35507
  withAttachments: notLinkAttachment,
35382
- attachmentWidth: withAttachments ? mediaAttachment ? attachmentMetas && getSendAttachmentsAsSeparateMessages() && attachmentMetas.szw && calculateRenderedImageWidth(attachmentMetas.szw, attachmentMetas.szh, mediaAttachment.type === attachmentTypes.image ? imageAttachmentMaxWidth : videoAttachmentMaxWidth, mediaAttachment.type === attachmentTypes.image ? imageAttachmentMaxHeight : videoAttachmentMaxHeight)[0] || 420 : message.attachments[0].type === attachmentTypes.voice ? 254 : message.attachments[0].type === attachmentTypes.file ? fileAttachmentsBoxWidth : undefined : undefined,
35508
+ hasLinkAttachment: !!linkAttachment,
35509
+ hasLongLinkAttachmentUrl: hasLongLinkAttachmentUrl,
35510
+ attachmentWidth: withAttachments ? mediaAttachment ? attachmentMetas && getSendAttachmentsAsSeparateMessages() && attachmentMetas.szw && calculateRenderedImageWidth(attachmentMetas.szw, attachmentMetas.szh, mediaAttachment.type === attachmentTypes.image ? imageAttachmentMaxWidth : videoAttachmentMaxWidth, mediaAttachment.type === attachmentTypes.image ? imageAttachmentMaxHeight : videoAttachmentMaxHeight)[0] || 400 : message.attachments[0].type === attachmentTypes.voice ? 254 : message.attachments[0].type === attachmentTypes.file ? fileAttachmentsBoxWidth : undefined : undefined,
35511
+ ogMetadataMaxWidth: ogMetadataContainerWidth,
35383
35512
  noBody: !message.body && !withAttachments,
35384
35513
  onMouseEnter: handleMouseEnter,
35385
35514
  onMouseLeave: handleMouseLeave
@@ -35535,7 +35664,7 @@ var MessageBody = function MessageBody(_ref) {
35535
35664
  unsupportedMessage: unsupportedMessage,
35536
35665
  unsupportedMessageColor: textSecondary
35537
35666
  }, ogContainerFirst && linkAttachment && !mediaAttachment && !withMediaAttachment && !fileAttachment && (/*#__PURE__*/React__default.createElement(OGMetadata, {
35538
- maxWidth: (ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.maxWidth) || 400,
35667
+ maxWidth: ogMetadataContainerWidth,
35539
35668
  maxHeight: ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.maxHeight,
35540
35669
  attachments: [linkAttachment],
35541
35670
  state: message.state,
@@ -35574,7 +35703,7 @@ var MessageBody = function MessageBody(_ref) {
35574
35703
  }))), !withAttachments && message.state === MESSAGE_STATUS.DELETE ? (/*#__PURE__*/React__default.createElement(MessageStatusDeleted$1, {
35575
35704
  color: textSecondary
35576
35705
  }, " Message was deleted. ")) : '', !ogContainerFirst && linkAttachment && !mediaAttachment && !withMediaAttachment && !fileAttachment && (/*#__PURE__*/React__default.createElement(OGMetadata, {
35577
- maxWidth: (ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.maxWidth) || 400,
35706
+ maxWidth: ogMetadataContainerWidth,
35578
35707
  maxHeight: ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.maxHeight,
35579
35708
  attachments: [linkAttachment],
35580
35709
  state: message.state,
@@ -35596,7 +35725,7 @@ var MessageBody = function MessageBody(_ref) {
35596
35725
  ogContainerBackground: ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.ogContainerBackground,
35597
35726
  infoPadding: ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.infoPadding,
35598
35727
  isInviteLink: ogMetadataProps === null || ogMetadataProps === void 0 ? void 0 : ogMetadataProps.isInviteLink
35599
- })), messageStatusAndTimePosition === 'onMessage' && !notLinkAttachment && (messageStatusVisible || messageTimeVisible) ? (/*#__PURE__*/React__default.createElement(MessageStatusAndTime$1, {
35728
+ })), messageStatusAndTimePosition === 'onMessage' && !notLinkAttachment && !!linkAttachment && (messageStatusVisible || messageTimeVisible) ? (/*#__PURE__*/React__default.createElement(MessageStatusAndTime$1, {
35600
35729
  message: message,
35601
35730
  showMessageTimeAndStatusOnlyOnHover: showMessageTimeAndStatusOnlyOnHover,
35602
35731
  messageStatusDisplayingType: messageStatusDisplayingType,
@@ -35612,25 +35741,31 @@ var MessageBody = function MessageBody(_ref) {
35612
35741
  messageStatusVisible: !!messageStatusVisible,
35613
35742
  leftMargin: true,
35614
35743
  messageTimeColorOnAttachment: messageTimeColorOnAttachment || textSecondary
35615
- })) : null), notLinkAttachment && messageStatusAndTimePosition === 'onMessage' && (messageStatusVisible || messageTimeVisible) && (/*#__PURE__*/React__default.createElement(MessageStatusAndTime$1, {
35616
- message: message,
35617
- showMessageTimeAndStatusOnlyOnHover: showMessageTimeAndStatusOnlyOnHover,
35618
- messageStatusDisplayingType: messageStatusDisplayingType,
35619
- messageStatusSize: messageStatusSize,
35620
- messageStatusColor: message.attachments[0].type === 'voice' ? textSecondary : message.attachments[0].type === 'image' || message.attachments[0].type === 'video' ? textOnPrimary : messageStateColor || textSecondary,
35621
- messageReadStatusColor: messageReadStatusColor,
35622
- messageStateFontSize: messageStateFontSize,
35623
- messageStateColor: messageStateColor,
35624
- messageTimeFontSize: messageTimeFontSize,
35625
- messageTimeColor: messageTimeColor,
35626
- messageStatusAndTimeLineHeight: messageStatusAndTimeLineHeight,
35627
- messageTimeVisible: !!messageTimeVisible,
35628
- messageStatusVisible: !!messageStatusVisible,
35629
- withAttachment: withAttachments,
35630
- leftMargin: true,
35631
- fileAttachment: withAttachments && (message.attachments[0].type === 'file' || message.attachments[0].type === 'voice'),
35632
- messageTimeColorOnAttachment: message.attachments[0].type === 'voice' ? textSecondary : message.attachments[0].type === 'image' || message.attachments[0].type === 'video' ? textOnPrimary : textSecondary
35633
- })), withAttachments && message.attachments.map(function (attachment) {
35744
+ })) : null), notLinkAttachment && messageStatusAndTimePosition === 'onMessage' && (messageStatusVisible || messageTimeVisible) && function () {
35745
+ var nonLinkAttachment = message.attachments.find(function (a) {
35746
+ return a.type !== attachmentTypes.link;
35747
+ });
35748
+ var attachmentType = nonLinkAttachment === null || nonLinkAttachment === void 0 ? void 0 : nonLinkAttachment.type;
35749
+ return /*#__PURE__*/React__default.createElement(MessageStatusAndTime$1, {
35750
+ message: message,
35751
+ showMessageTimeAndStatusOnlyOnHover: showMessageTimeAndStatusOnlyOnHover,
35752
+ messageStatusDisplayingType: messageStatusDisplayingType,
35753
+ messageStatusSize: messageStatusSize,
35754
+ messageStatusColor: attachmentType === 'voice' ? textSecondary : attachmentType === 'image' || attachmentType === 'video' ? textOnPrimary : messageStateColor || textSecondary,
35755
+ messageReadStatusColor: messageReadStatusColor,
35756
+ messageStateFontSize: messageStateFontSize,
35757
+ messageStateColor: messageStateColor,
35758
+ messageTimeFontSize: messageTimeFontSize,
35759
+ messageTimeColor: messageTimeColor,
35760
+ messageStatusAndTimeLineHeight: messageStatusAndTimeLineHeight,
35761
+ messageTimeVisible: !!messageTimeVisible,
35762
+ messageStatusVisible: !!messageStatusVisible,
35763
+ withAttachment: withAttachments,
35764
+ leftMargin: true,
35765
+ fileAttachment: withAttachments && (attachmentType === 'file' || attachmentType === 'voice'),
35766
+ messageTimeColorOnAttachment: attachmentType === 'voice' ? textSecondary : attachmentType === 'image' || attachmentType === 'video' ? textOnPrimary : textSecondary
35767
+ });
35768
+ }(), withAttachments && message.attachments.map(function (attachment) {
35634
35769
  return /*#__PURE__*/React__default.createElement(Attachment$1, {
35635
35770
  key: attachment.tid || attachment.url,
35636
35771
  handleMediaItemClick: selectionIsActive ? undefined : handleMediaItemClick,
@@ -35703,7 +35838,7 @@ var MessageStatusDeleted$1 = styled.span(_templateObject2$B || (_templateObject2
35703
35838
  }, function (props) {
35704
35839
  return props.fontSize;
35705
35840
  });
35706
- var MessageBodyContainer = styled.div(_templateObject3$v || (_templateObject3$v = _taggedTemplateLiteralLoose(["\n position: relative;\n background-color: ", ";\n //display: inline-block;\n border-radius: ", ";\n direction: ", ";\n max-width: ", ";\n width: max-content;\n padding: ", ";\n //direction: ", ";\n //overflow: ", ";\n transition: all 0.3s;\n transform-origin: right;\n"])), function (props) {
35841
+ var MessageBodyContainer = styled.div(_templateObject3$v || (_templateObject3$v = _taggedTemplateLiteralLoose(["\n position: relative;\n background-color: ", ";\n //display: inline-block;\n border-radius: ", ";\n direction: ", ";\n max-width: ", ";\n width: ", ";\n overflow-wrap: break-word;\n word-break: break-word;\n\n ", "\n padding: ", ";\n //direction: ", ";\n //overflow: ", ";\n transition: all 0.3s;\n transform-origin: right;\n"])), function (props) {
35707
35842
  var _props$outgoingMessag, _props$incomingMessag;
35708
35843
  return props.isSelfMessage ? (_props$outgoingMessag = props.outgoingMessageStyles) === null || _props$outgoingMessag === void 0 ? void 0 : _props$outgoingMessag.background : (_props$incomingMessag = props.incomingMessageStyles) === null || _props$incomingMessag === void 0 ? void 0 : _props$incomingMessag.background;
35709
35844
  }, function (props) {
@@ -35711,10 +35846,14 @@ var MessageBodyContainer = styled.div(_templateObject3$v || (_templateObject3$v
35711
35846
  }, function (props) {
35712
35847
  return props.rtlDirection ? 'initial' : '';
35713
35848
  }, function (props) {
35714
- return props.withAttachments ? props.attachmentWidth && props.attachmentWidth < 420 ? props.attachmentWidth < 165 ? props.isReplyMessage ? '210px' : '165px' : props.attachmentWidth + "px" : '420px' : '100%';
35849
+ return props.hasLinkAttachment && !props.withAttachments ? props.ogMetadataMaxWidth ? props.ogMetadataMaxWidth + "px" : '416px' : props.hasLongLinkAttachmentUrl && !props.withAttachments ? '400px' : props.withAttachments ? props.attachmentWidth && props.attachmentWidth < 400 ? props.attachmentWidth < 165 ? props.isReplyMessage ? '210px' : '165px' : props.attachmentWidth + "px" : '400px' : '100%';
35850
+ }, function (props) {
35851
+ return props.hasLinkAttachment && !props.withAttachments && props.ogMetadataMaxWidth ? props.ogMetadataMaxWidth + "px" : props.hasLongLinkAttachmentUrl && !props.withAttachments ? '416px' : 'max-content';
35852
+ }, function (props) {
35853
+ return props.hasLongLinkAttachmentUrl && "\n & a {\n overflow-wrap: anywhere;\n word-break: break-all;\n white-space: normal;\n max-width: " + (props.withAttachments ? '400px' : props.hasLinkAttachment && props.ogMetadataMaxWidth ? props.ogMetadataMaxWidth + "px" : '416px') + ";\n }\n ";
35715
35854
  }, function (props) {
35716
35855
  var _props$outgoingMessag2, _props$incomingMessag2;
35717
- return props.withAttachments ? props.isReplyMessage ? '1px 0 0 ' : '0' : props.isSelfMessage ? ((_props$outgoingMessag2 = props.outgoingMessageStyles) === null || _props$outgoingMessag2 === void 0 ? void 0 : _props$outgoingMessag2.background) === 'inherit' ? '0' : '8px 12px' : ((_props$incomingMessag2 = props.incomingMessageStyles) === null || _props$incomingMessag2 === void 0 ? void 0 : _props$incomingMessag2.background) === 'inherit' ? ' 0' : '8px 12px';
35856
+ return props.withAttachments ? props.isReplyMessage ? '1px 0 0 ' : '0' : props.hasLinkAttachment ? '8px' : props.isSelfMessage ? ((_props$outgoingMessag2 = props.outgoingMessageStyles) === null || _props$outgoingMessag2 === void 0 ? void 0 : _props$outgoingMessag2.background) === 'inherit' ? '0' : '8px 12px' : ((_props$incomingMessag2 = props.incomingMessageStyles) === null || _props$incomingMessag2 === void 0 ? void 0 : _props$incomingMessag2.background) === 'inherit' ? ' 0' : '8px 12px';
35718
35857
  }, function (props) {
35719
35858
  return props.isSelfMessage ? 'initial' : '';
35720
35859
  }, function (props) {
@@ -36381,6 +36520,7 @@ var Message$1 = function Message(_ref) {
36381
36520
  reactionsPopupHorizontalPosition = _useState10[0],
36382
36521
  setReactionsPopupHorizontalPosition = _useState10[1];
36383
36522
  var scrollToNewMessage = useSelector(scrollToNewMessageSelector, shallowEqual);
36523
+ var unreadScrollTo = useSelector(unreadScrollToSelector, shallowEqual);
36384
36524
  var messageItemRef = useRef();
36385
36525
  var isVisible = useOnScreen(messageItemRef);
36386
36526
  var reactionsCount = message.reactionTotals && message.reactionTotals.reduce(function (prevValue, currentValue) {
@@ -36534,11 +36674,6 @@ var Message$1 = function Message(_ref) {
36534
36674
  setFrequentlyEmojisOpen(false);
36535
36675
  };
36536
36676
  var handleSendReadMarker = function handleSendReadMarker() {
36537
- if (isVisible && message.incoming && !(message.userMarkers && message.userMarkers.length && message.userMarkers.find(function (marker) {
36538
- return marker.name === MESSAGE_DELIVERY_STATUS.READ;
36539
- })) && channel.newMessageCount && channel.newMessageCount > 0 && connectionStatus === CONNECTION_STATUS.CONNECTED) {
36540
- dispatch(markMessagesAsReadAC(channel.id, [message.id]));
36541
- }
36542
36677
  if (!message.userMarkers.find(function (marker) {
36543
36678
  return marker.name === MESSAGE_DELIVERY_STATUS.DELIVERED;
36544
36679
  })) {
@@ -36548,6 +36683,11 @@ var Message$1 = function Message(_ref) {
36548
36683
  dispatch(markMessagesAsDeliveredAC(channel.id, [message.id]));
36549
36684
  }
36550
36685
  }
36686
+ if (isVisible && message.incoming && !(message.userMarkers && message.userMarkers.length && message.userMarkers.find(function (marker) {
36687
+ return marker.name === MESSAGE_DELIVERY_STATUS.READ;
36688
+ })) && channel.newMessageCount && channel.newMessageCount > 0 && connectionStatus === CONNECTION_STATUS.CONNECTED && !unreadScrollTo) {
36689
+ dispatch(markMessagesAsReadAC(channel.id, [message.id]));
36690
+ }
36551
36691
  };
36552
36692
  var handleForwardMessage = function handleForwardMessage(channelIds) {
36553
36693
  if (channelIds && channelIds.length) {
@@ -36585,7 +36725,7 @@ var Message$1 = function Message(_ref) {
36585
36725
  }
36586
36726
  };
36587
36727
  useEffect(function () {
36588
- if (isVisible) {
36728
+ if (isVisible && !unreadScrollTo) {
36589
36729
  var _channel$lastMessage;
36590
36730
  if (setLastVisibleMessageId) {
36591
36731
  setLastVisibleMessageId(message.id);
@@ -37283,6 +37423,9 @@ var MessageList = function MessageList(_ref2) {
37283
37423
  var dispatch = useDispatch();
37284
37424
  var theme = useSelector(themeSelector);
37285
37425
  var channel = useSelector(activeChannelSelector);
37426
+ var _useState = useState(false),
37427
+ scrollIntoView = _useState[0],
37428
+ setScrollIntoView = _useState[1];
37286
37429
  var contactsMap = useSelector(contactsMapSelector, shallowEqual);
37287
37430
  var connectionStatus = useSelector(connectionStatusSelector, shallowEqual);
37288
37431
  var openedMessageMenuId = useSelector(openedMessageMenuSelector, shallowEqual);
@@ -37301,43 +37444,44 @@ var MessageList = function MessageList(_ref2) {
37301
37444
  var pollPendingPollActions = useSelector(pendingPollActionsSelector, shallowEqual);
37302
37445
  var pendingMessagesMap = useSelector(pendingMessagesMapSelector, shallowEqual);
37303
37446
  var showScrollToNewMessageButton = useSelector(showScrollToNewMessageButtonSelector, shallowEqual);
37447
+ var unreadScrollTo = useSelector(unreadScrollToSelector, shallowEqual);
37304
37448
  var messages = useSelector(activeChannelMessagesSelector, shallowEqual) || [];
37305
- var _useState = useState(''),
37306
- unreadMessageId = _useState[0],
37307
- setUnreadMessageId = _useState[1];
37308
- var _useState2 = useState(null),
37309
- mediaFile = _useState2[0],
37310
- setMediaFile = _useState2[1];
37449
+ var _useState2 = useState(''),
37450
+ unreadMessageId = _useState2[0],
37451
+ setUnreadMessageId = _useState2[1];
37311
37452
  var _useState3 = useState(null),
37312
- isDragging = _useState3[0],
37313
- setIsDragging = _useState3[1];
37453
+ mediaFile = _useState3[0],
37454
+ setMediaFile = _useState3[1];
37314
37455
  var _useState4 = useState(null),
37315
- showTopDate = _useState4[0],
37316
- setShowTopDate = _useState4[1];
37317
- var _useState5 = useState(false),
37318
- stopScrolling = _useState5[0],
37319
- setStopScrolling = _useState5[1];
37456
+ isDragging = _useState4[0],
37457
+ setIsDragging = _useState4[1];
37458
+ var _useState5 = useState(null),
37459
+ showTopDate = _useState5[0],
37460
+ setShowTopDate = _useState5[1];
37320
37461
  var _useState6 = useState(false),
37321
- isScrolling = _useState6[0],
37322
- setIsScrolling = _useState6[1];
37462
+ stopScrolling = _useState6[0],
37463
+ setStopScrolling = _useState6[1];
37464
+ var _useState7 = useState(false),
37465
+ isScrolling = _useState7[0],
37466
+ setIsScrolling = _useState7[1];
37323
37467
  var hideTopDateTimeout = useRef(null);
37324
- var _useState7 = useState(''),
37325
- lastVisibleMessageId = _useState7[0],
37326
- _setLastVisibleMessageId = _useState7[1];
37327
- var _useState8 = useState(null),
37328
- scrollToReply = _useState8[0],
37329
- setScrollToReply = _useState8[1];
37330
- var _useState9 = useState(0),
37331
- previousScrollTop = _useState9[0],
37332
- setPreviousScrollTop = _useState9[1];
37333
- var _useState0 = useState(false),
37334
- shouldPreserveScroll = _useState0[0],
37335
- setShouldPreserveScroll = _useState0[1];
37468
+ var _useState8 = useState(''),
37469
+ lastVisibleMessageId = _useState8[0],
37470
+ _setLastVisibleMessageId = _useState8[1];
37471
+ var _useState9 = useState(null),
37472
+ scrollToReply = _useState9[0],
37473
+ setScrollToReply = _useState9[1];
37474
+ var _useState0 = useState(0),
37475
+ previousScrollTop = _useState0[0],
37476
+ setPreviousScrollTop = _useState0[1];
37477
+ var _useState1 = useState(false),
37478
+ shouldPreserveScroll = _useState1[0],
37479
+ setShouldPreserveScroll = _useState1[1];
37336
37480
  var messageForReply = {};
37337
37481
  var attachmentsSelected = false;
37338
- var _useState1 = useState(''),
37339
- topDateLabel = _useState1[0],
37340
- setTopDateLabel = _useState1[1];
37482
+ var _useState10 = useState(''),
37483
+ topDateLabel = _useState10[0],
37484
+ setTopDateLabel = _useState10[1];
37341
37485
  var scrollRef = useRef(null);
37342
37486
  var loadFromServerRef = useRef(false);
37343
37487
  var loadDirectionRef = useRef('');
@@ -37826,6 +37970,8 @@ var MessageList = function MessageList(_ref2) {
37826
37970
  };
37827
37971
  }, [messagesLoading, messages, lastVisibleMessageId]);
37828
37972
  useEffect(function () {
37973
+ var interval = null;
37974
+ log.info('connection status is changed.. .... ', connectionStatus, 'channel ... ', channel);
37829
37975
  if (connectionStatus === CONNECTION_STATUS.CONNECTED) {
37830
37976
  Object.keys(pendingMessagesMap).forEach(function (key) {
37831
37977
  pendingMessagesMap[key].forEach(function (msg) {
@@ -37835,37 +37981,49 @@ var MessageList = function MessageList(_ref2) {
37835
37981
  if (Object.keys(pollPendingPollActions).length > 0) {
37836
37982
  dispatch(resendPendingPollActionsAC(connectionStatus));
37837
37983
  }
37984
+ var count = 0;
37985
+ interval = setInterval(function () {
37986
+ if (count > 20) {
37987
+ clearInterval(interval);
37988
+ }
37989
+ count++;
37990
+ if (channel.id && Object.keys(pollPendingPollActions).length === 0 && Object.keys(pendingMessagesMap).length === 0) {
37991
+ clearInterval(interval);
37992
+ loadingRef.current = false;
37993
+ prevDisableRef.current = false;
37994
+ nextDisableRef.current = false;
37995
+ clearMessagesMap();
37996
+ removeAllMessages();
37997
+ dispatch(getMessagesAC(channel));
37998
+ }
37999
+ }, 100);
37838
38000
  }
37839
- }, [connectionStatus]);
37840
- useEffect(function () {
37841
- log.info('connection status is changed.. .... ', connectionStatus, 'channel ... ', channel);
37842
- if (connectionStatus === CONNECTION_STATUS.CONNECTED) {
37843
- if (channel.id && Object.keys(pollPendingPollActions).length === 0 && Object.keys(pendingMessagesMap).length === 0) {
37844
- loadingRef.current = false;
37845
- prevDisableRef.current = false;
37846
- nextDisableRef.current = false;
37847
- clearMessagesMap();
37848
- removeAllMessages();
37849
- dispatch(getMessagesAC(channel));
38001
+ return function () {
38002
+ if (interval) {
38003
+ clearInterval(interval);
37850
38004
  }
37851
- }
37852
- }, [connectionStatus, pollPendingPollActions, pendingMessagesMap]);
38005
+ };
38006
+ }, [connectionStatus]);
37853
38007
  useEffect(function () {
37854
- var unreadScrollTo = getUnreadScrollTo();
37855
38008
  if (channel.newMessageCount && channel.newMessageCount > 0 && unreadScrollTo) {
37856
- if (scrollRef.current) {
37857
- scrollRef.current.style.scrollBehavior = 'inherit';
38009
+ var scrollElement = document.getElementById('scrollableDiv');
38010
+ if (scrollElement) {
38011
+ scrollElement.style.scrollBehavior = 'inherit';
37858
38012
  }
37859
38013
  var lastReadMessageNode = document.getElementById(channel.lastDisplayedMessageId);
37860
- if (lastReadMessageNode) {
37861
- scrollRef.current.scrollTop = lastReadMessageNode.offsetTop;
37862
- if (scrollRef.current) {
37863
- scrollRef.current.style.scrollBehavior = 'smooth';
37864
- }
37865
- setUnreadScrollTo(false);
38014
+ if (lastReadMessageNode && scrollElement) {
38015
+ scrollElement.scrollTo({
38016
+ top: lastReadMessageNode.offsetTop - 200,
38017
+ behavior: 'smooth'
38018
+ });
38019
+ setScrollIntoView(true);
38020
+ setTimeout(function () {
38021
+ dispatch(setUnreadScrollToAC(false));
38022
+ setScrollIntoView(false);
38023
+ }, 100);
37866
38024
  }
37867
38025
  }
37868
- }, [channel.id, channel.newMessageCount, channel.lastDisplayedMessageId]);
38026
+ }, [channel.id, channel.newMessageCount, scrollRef.current, unreadScrollTo, channel.lastDisplayedMessageId, scrollIntoView, messages.length]);
37869
38027
  useEffect(function () {
37870
38028
  return function () {
37871
38029
  if (hideTopDateTimeout.current) {