sceyt-chat-react-uikit 1.8.7-beta.12 → 1.8.7-beta.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +19 -31
  2. package/index.modern.js +19 -31
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -15331,7 +15331,7 @@ var isChannelStillActive = function isChannelStillActive(channelId) {
15331
15331
  var getReconnectReloadAction = function getReconnectReloadAction(channel, visibleAnchorId, wasViewingLatest, applyVisibleWindow, isAtHistoryTop) {
15332
15332
  if (visibleAnchorId) {
15333
15333
  if (wasViewingLatest) {
15334
- return loadLatestMessagesAC(channel, undefined, false, applyVisibleWindow);
15334
+ return loadLatestMessagesAC(channel, undefined, true, applyVisibleWindow);
15335
15335
  }
15336
15336
  if (isAtHistoryTop) {
15337
15337
  return loadAroundMessageAC(channel, visibleAnchorId);
@@ -15346,12 +15346,12 @@ var getReconnectReloadAction = function getReconnectReloadAction(channel, visibl
15346
15346
  };
15347
15347
  }
15348
15348
  if (wasViewingLatest) {
15349
- return loadLatestMessagesAC(channel, undefined, false, applyVisibleWindow);
15349
+ return loadLatestMessagesAC(channel, undefined, true, applyVisibleWindow);
15350
15350
  }
15351
15351
  if (channel.newMessageCount && channel.lastDisplayedMessageId) {
15352
15352
  return loadNearUnreadAC(channel);
15353
15353
  }
15354
- return loadLatestMessagesAC(channel);
15354
+ return loadLatestMessagesAC(channel, undefined, true);
15355
15355
  };
15356
15356
  var getReconnectChannelSnapshot = function getReconnectChannelSnapshot(channelId) {
15357
15357
  var _store$getState$Chann;
@@ -18595,7 +18595,7 @@ function loadDefaultMessages(action) {
18595
18595
  _context32.n = 30;
18596
18596
  return effects.call(loadOGMetadataForLinkMessages, filteredPendingMessages, true);
18597
18597
  case 30:
18598
- if (!(cachedMessages !== null && cachedMessages !== void 0 && cachedMessages.length && connectionState === CONNECTION_STATUS.CONNECTED)) {
18598
+ if (!(!(cachedMessages !== null && cachedMessages !== void 0 && cachedMessages.length) && connectionState === CONNECTION_STATUS.CONNECTED)) {
18599
18599
  _context32.n = 31;
18600
18600
  break;
18601
18601
  }
@@ -18748,7 +18748,7 @@ function getMessagesQuery(action) {
18748
18748
  break;
18749
18749
  case 17:
18750
18750
  cachedMessages = getLatestMessagesFromMap(channel.id, MESSAGES_MAX_PAGE_COUNT);
18751
- cacheIsCurrent = cachedMessages.length > 0 && getLastConfirmedMessageId(cachedMessages) === ((_channel$lastMessage1 = channel.lastMessage) === null || _channel$lastMessage1 === void 0 ? void 0 : _channel$lastMessage1.id);
18751
+ cacheIsCurrent = !networkChanged && cachedMessages.length > 0 && getLastConfirmedMessageId(cachedMessages) === ((_channel$lastMessage1 = channel.lastMessage) === null || _channel$lastMessage1 === void 0 ? void 0 : _channel$lastMessage1.id);
18752
18752
  if (!cacheIsCurrent) {
18753
18753
  _context33.n = 18;
18754
18754
  break;
@@ -44017,7 +44017,6 @@ function useChatController(_ref5) {
44017
44017
  var visibleUnreadReportedRef = React.useRef(new Set());
44018
44018
  var restoreRef = React.useRef(null);
44019
44019
  var lastBootKeyRef = React.useRef(null);
44020
- var pendingBootScrolledRef = React.useRef(false);
44021
44020
  var highlightedItemIdRef = React.useRef(null);
44022
44021
  var highlightTimeoutRef = React.useRef(null);
44023
44022
  var unreadRestoreCompletedRef = React.useRef(false);
@@ -45216,7 +45215,6 @@ function useChatController(_ref5) {
45216
45215
  currentJumpIdRef.current += 1;
45217
45216
  activeChannelIdRef.current = channel.id;
45218
45217
  lastBootKeyRef.current = null;
45219
- pendingBootScrolledRef.current = false;
45220
45218
  restoreRef.current = null;
45221
45219
  windowLoadScopeRef.current = null;
45222
45220
  activeEdgeIntentRef.current = null;
@@ -45313,26 +45311,13 @@ function useChatController(_ref5) {
45313
45311
  return;
45314
45312
  }
45315
45313
  if (!lastBootKeyRef.current) {
45316
- var hasConfirmedMessages = messages.some(function (m) {
45317
- return !!m.id;
45318
- });
45319
- if (hasConfirmedMessages) {
45320
- lastBootKeyRef.current = channel.id + ":" + getMessageLocalRef(messages[0]);
45321
- pendingBootScrolledRef.current = false;
45322
- var preservePendingHistoryEdge = pendingEdgeCheckAfterLoadRef.current && activeEdgeIntentRef.current === 'previous';
45323
- restoreRef.current = unreadScrollTo && unreadMessageId ? {
45324
- mode: 'reveal-unread-separator'
45325
- } : preservePendingHistoryEdge ? null : isScrollInteractionActive() ? null : {
45326
- mode: 'to-bottom'
45327
- };
45328
- } else if (!pendingBootScrolledRef.current) {
45329
- pendingBootScrolledRef.current = true;
45330
- if (!restoreRef.current) {
45331
- restoreRef.current = {
45332
- mode: 'to-bottom'
45333
- };
45334
- }
45335
- }
45314
+ lastBootKeyRef.current = channel.id + ":" + getMessageLocalRef(messages[0]);
45315
+ var preservePendingHistoryEdge = pendingEdgeCheckAfterLoadRef.current && activeEdgeIntentRef.current === 'previous';
45316
+ restoreRef.current = unreadScrollTo && unreadMessageId ? {
45317
+ mode: 'reveal-unread-separator'
45318
+ } : preservePendingHistoryEdge ? null : isScrollInteractionActive() ? null : {
45319
+ mode: 'to-bottom'
45320
+ };
45336
45321
  }
45337
45322
  var restoreState = restoreRef.current;
45338
45323
  if (!restoreState) {
@@ -45686,7 +45671,7 @@ function useChatController(_ref5) {
45686
45671
  return;
45687
45672
  }
45688
45673
  var forceLatest = scrollToNewMessage.updateMessageList;
45689
- if (!isViewingLatest && (forceLatest || scrollToNewMessage.isIncomingMessage)) {
45674
+ if (!forceLatest && scrollToNewMessage.isIncomingMessage && !isViewingLatest) {
45690
45675
  dispatch(scrollToNewMessageAC(false, false, false));
45691
45676
  return;
45692
45677
  }
@@ -50930,9 +50915,12 @@ var SendMessageInput = function SendMessageInput(_ref3) {
50930
50915
  });
50931
50916
  }
50932
50917
  }
50933
- var messageToSend = _extends({}, messageToEdit, linkAttachment ? {
50934
- attachments: [linkAttachment]
50935
- } : {}, {
50918
+ var existingMediaAttachments = (messageToEdit.attachments || []).filter(function (att) {
50919
+ return att.type !== attachmentTypes.link;
50920
+ });
50921
+ var updatedAttachments = linkAttachment ? [].concat(existingMediaAttachments, [linkAttachment]) : existingMediaAttachments;
50922
+ var messageToSend = _extends({}, messageToEdit, {
50923
+ attachments: updatedAttachments,
50936
50924
  metadata: mentionedUsersPositions,
50937
50925
  bodyAttributes: messageBodyAttributes,
50938
50926
  mentionedUsers: mentionUsersToSend,
package/index.modern.js CHANGED
@@ -15330,7 +15330,7 @@ var isChannelStillActive = function isChannelStillActive(channelId) {
15330
15330
  var getReconnectReloadAction = function getReconnectReloadAction(channel, visibleAnchorId, wasViewingLatest, applyVisibleWindow, isAtHistoryTop) {
15331
15331
  if (visibleAnchorId) {
15332
15332
  if (wasViewingLatest) {
15333
- return loadLatestMessagesAC(channel, undefined, false, applyVisibleWindow);
15333
+ return loadLatestMessagesAC(channel, undefined, true, applyVisibleWindow);
15334
15334
  }
15335
15335
  if (isAtHistoryTop) {
15336
15336
  return loadAroundMessageAC(channel, visibleAnchorId);
@@ -15345,12 +15345,12 @@ var getReconnectReloadAction = function getReconnectReloadAction(channel, visibl
15345
15345
  };
15346
15346
  }
15347
15347
  if (wasViewingLatest) {
15348
- return loadLatestMessagesAC(channel, undefined, false, applyVisibleWindow);
15348
+ return loadLatestMessagesAC(channel, undefined, true, applyVisibleWindow);
15349
15349
  }
15350
15350
  if (channel.newMessageCount && channel.lastDisplayedMessageId) {
15351
15351
  return loadNearUnreadAC(channel);
15352
15352
  }
15353
- return loadLatestMessagesAC(channel);
15353
+ return loadLatestMessagesAC(channel, undefined, true);
15354
15354
  };
15355
15355
  var getReconnectChannelSnapshot = function getReconnectChannelSnapshot(channelId) {
15356
15356
  var _store$getState$Chann;
@@ -18594,7 +18594,7 @@ function loadDefaultMessages(action) {
18594
18594
  _context32.n = 30;
18595
18595
  return call(loadOGMetadataForLinkMessages, filteredPendingMessages, true);
18596
18596
  case 30:
18597
- if (!(cachedMessages !== null && cachedMessages !== void 0 && cachedMessages.length && connectionState === CONNECTION_STATUS.CONNECTED)) {
18597
+ if (!(!(cachedMessages !== null && cachedMessages !== void 0 && cachedMessages.length) && connectionState === CONNECTION_STATUS.CONNECTED)) {
18598
18598
  _context32.n = 31;
18599
18599
  break;
18600
18600
  }
@@ -18747,7 +18747,7 @@ function getMessagesQuery(action) {
18747
18747
  break;
18748
18748
  case 17:
18749
18749
  cachedMessages = getLatestMessagesFromMap(channel.id, MESSAGES_MAX_PAGE_COUNT);
18750
- cacheIsCurrent = cachedMessages.length > 0 && getLastConfirmedMessageId(cachedMessages) === ((_channel$lastMessage1 = channel.lastMessage) === null || _channel$lastMessage1 === void 0 ? void 0 : _channel$lastMessage1.id);
18750
+ cacheIsCurrent = !networkChanged && cachedMessages.length > 0 && getLastConfirmedMessageId(cachedMessages) === ((_channel$lastMessage1 = channel.lastMessage) === null || _channel$lastMessage1 === void 0 ? void 0 : _channel$lastMessage1.id);
18751
18751
  if (!cacheIsCurrent) {
18752
18752
  _context33.n = 18;
18753
18753
  break;
@@ -44016,7 +44016,6 @@ function useChatController(_ref5) {
44016
44016
  var visibleUnreadReportedRef = useRef(new Set());
44017
44017
  var restoreRef = useRef(null);
44018
44018
  var lastBootKeyRef = useRef(null);
44019
- var pendingBootScrolledRef = useRef(false);
44020
44019
  var highlightedItemIdRef = useRef(null);
44021
44020
  var highlightTimeoutRef = useRef(null);
44022
44021
  var unreadRestoreCompletedRef = useRef(false);
@@ -45215,7 +45214,6 @@ function useChatController(_ref5) {
45215
45214
  currentJumpIdRef.current += 1;
45216
45215
  activeChannelIdRef.current = channel.id;
45217
45216
  lastBootKeyRef.current = null;
45218
- pendingBootScrolledRef.current = false;
45219
45217
  restoreRef.current = null;
45220
45218
  windowLoadScopeRef.current = null;
45221
45219
  activeEdgeIntentRef.current = null;
@@ -45312,26 +45310,13 @@ function useChatController(_ref5) {
45312
45310
  return;
45313
45311
  }
45314
45312
  if (!lastBootKeyRef.current) {
45315
- var hasConfirmedMessages = messages.some(function (m) {
45316
- return !!m.id;
45317
- });
45318
- if (hasConfirmedMessages) {
45319
- lastBootKeyRef.current = channel.id + ":" + getMessageLocalRef(messages[0]);
45320
- pendingBootScrolledRef.current = false;
45321
- var preservePendingHistoryEdge = pendingEdgeCheckAfterLoadRef.current && activeEdgeIntentRef.current === 'previous';
45322
- restoreRef.current = unreadScrollTo && unreadMessageId ? {
45323
- mode: 'reveal-unread-separator'
45324
- } : preservePendingHistoryEdge ? null : isScrollInteractionActive() ? null : {
45325
- mode: 'to-bottom'
45326
- };
45327
- } else if (!pendingBootScrolledRef.current) {
45328
- pendingBootScrolledRef.current = true;
45329
- if (!restoreRef.current) {
45330
- restoreRef.current = {
45331
- mode: 'to-bottom'
45332
- };
45333
- }
45334
- }
45313
+ lastBootKeyRef.current = channel.id + ":" + getMessageLocalRef(messages[0]);
45314
+ var preservePendingHistoryEdge = pendingEdgeCheckAfterLoadRef.current && activeEdgeIntentRef.current === 'previous';
45315
+ restoreRef.current = unreadScrollTo && unreadMessageId ? {
45316
+ mode: 'reveal-unread-separator'
45317
+ } : preservePendingHistoryEdge ? null : isScrollInteractionActive() ? null : {
45318
+ mode: 'to-bottom'
45319
+ };
45335
45320
  }
45336
45321
  var restoreState = restoreRef.current;
45337
45322
  if (!restoreState) {
@@ -45685,7 +45670,7 @@ function useChatController(_ref5) {
45685
45670
  return;
45686
45671
  }
45687
45672
  var forceLatest = scrollToNewMessage.updateMessageList;
45688
- if (!isViewingLatest && (forceLatest || scrollToNewMessage.isIncomingMessage)) {
45673
+ if (!forceLatest && scrollToNewMessage.isIncomingMessage && !isViewingLatest) {
45689
45674
  dispatch(scrollToNewMessageAC(false, false, false));
45690
45675
  return;
45691
45676
  }
@@ -50929,9 +50914,12 @@ var SendMessageInput = function SendMessageInput(_ref3) {
50929
50914
  });
50930
50915
  }
50931
50916
  }
50932
- var messageToSend = _extends({}, messageToEdit, linkAttachment ? {
50933
- attachments: [linkAttachment]
50934
- } : {}, {
50917
+ var existingMediaAttachments = (messageToEdit.attachments || []).filter(function (att) {
50918
+ return att.type !== attachmentTypes.link;
50919
+ });
50920
+ var updatedAttachments = linkAttachment ? [].concat(existingMediaAttachments, [linkAttachment]) : existingMediaAttachments;
50921
+ var messageToSend = _extends({}, messageToEdit, {
50922
+ attachments: updatedAttachments,
50935
50923
  metadata: mentionedUsersPositions,
50936
50924
  bodyAttributes: messageBodyAttributes,
50937
50925
  mentionedUsers: mentionUsersToSend,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sceyt-chat-react-uikit",
3
- "version": "1.8.7-beta.12",
3
+ "version": "1.8.7-beta.14",
4
4
  "description": "Interactive React UI Components for Sceyt Chat.",
5
5
  "author": "Sceyt",
6
6
  "license": "MIT",