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