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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +74 -61
  2. package/index.modern.js +74 -61
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -9289,7 +9289,8 @@ var channelSlice = createSlice({
9289
9289
  config = _action$payload3.config,
9290
9290
  channelId = _action$payload3.channelId,
9291
9291
  moveUp = _action$payload3.moveUp,
9292
- sort = _action$payload3.sort;
9292
+ sort = _action$payload3.sort,
9293
+ add = _action$payload3.add;
9293
9294
  if (moveUp) {
9294
9295
  var updateChannel;
9295
9296
  var updatedChannels = state.channels.filter(function (chan) {
@@ -9298,8 +9299,8 @@ var channelSlice = createSlice({
9298
9299
  }
9299
9300
  return chan.id !== channelId;
9300
9301
  });
9301
- if (updateChannel) {
9302
- updateChannel = _extends({}, updateChannel, config);
9302
+ if (updateChannel || add) {
9303
+ updateChannel = _extends({}, updateChannel || {}, config);
9303
9304
  state.channels = sortChannelByLastMessage([updateChannel].concat(updatedChannels));
9304
9305
  }
9305
9306
  } else {
@@ -13565,12 +13566,13 @@ var updateChannelAC = function updateChannelAC(channelId, config) {
13565
13566
  }
13566
13567
  };
13567
13568
  };
13568
- var updateChannelDataAC = function updateChannelDataAC(channelId, config, moveUp, sort) {
13569
+ var updateChannelDataAC = function updateChannelDataAC(channelId, config, moveUp, sort, add) {
13569
13570
  return updateChannelData({
13570
13571
  config: config,
13571
13572
  channelId: channelId,
13572
13573
  moveUp: moveUp,
13573
- sort: sort
13574
+ sort: sort,
13575
+ add: add
13574
13576
  });
13575
13577
  };
13576
13578
  var updateChannelsMembersAC = function updateChannelsMembersAC(members) {
@@ -16667,7 +16669,7 @@ function sendTextMessage(action) {
16667
16669
  }
16668
16670
  function forwardMessage(action) {
16669
16671
  var _message$user;
16670
- var payload, message, channelId, connectionState, isForward, showOwnMessageForward, SceytChatClient, isNotShowOwnMessageForward, pendingMessage, channel, activeChannelId, messageTid, _SceytChatClient, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, pollDetails, messageToSend, _getStoredChannel8, messageResponse, messageUpdateData, messageToUpdate, resolvedLastMessage, channelUpdateParam, _channel5, isErrorResendable, _t4;
16672
+ var payload, message, channelId, connectionState, isForward, showOwnMessageForward, SceytChatClient, isNotShowOwnMessageForward, pendingMessage, channel, activeChannelId, messageTid, _SceytChatClient, parsedChannel, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, pollDetails, messageToSend, _getStoredChannel8, messageResponse, messageUpdateData, messageToUpdate, resolvedLastMessage, channelUpdateParam, _channel5, isErrorResendable, _t4;
16671
16673
  return _regenerator().w(function (_context15) {
16672
16674
  while (1) switch (_context15.p = _context15.n) {
16673
16675
  case 0:
@@ -16686,12 +16688,12 @@ function forwardMessage(action) {
16686
16688
  case 2:
16687
16689
  channel = _context15.v;
16688
16690
  if (channel) {
16689
- _context15.n = 5;
16691
+ _context15.n = 7;
16690
16692
  break;
16691
16693
  }
16692
16694
  channel = getChannelFromAllChannels(channelId) || null;
16693
16695
  if (channel) {
16694
- _context15.n = 4;
16696
+ _context15.n = 5;
16695
16697
  break;
16696
16698
  }
16697
16699
  _SceytChatClient = getClient();
@@ -16699,26 +16701,37 @@ function forwardMessage(action) {
16699
16701
  return effects.call(_SceytChatClient.getChannel, channelId);
16700
16702
  case 3:
16701
16703
  channel = _context15.v;
16702
- case 4:
16703
- if (channel) {
16704
- setChannelInMap(channel);
16704
+ if (!channel) {
16705
+ _context15.n = 4;
16706
+ break;
16705
16707
  }
16708
+ setChannelInMap(channel);
16709
+ addChannelToAllChannels(_extends({}, channel));
16710
+ parsedChannel = JSON.parse(JSON.stringify(channel));
16711
+ _context15.n = 4;
16712
+ return effects.put(addChannelAC(parsedChannel));
16713
+ case 4:
16714
+ _context15.n = 6;
16715
+ break;
16716
+ case 5:
16717
+ setChannelInMap(channel);
16718
+ case 6:
16706
16719
  if (!channel) {
16707
16720
  channel = getChannelFromAllChannelsMap(channelId);
16708
16721
  }
16709
- case 5:
16722
+ case 7:
16710
16723
  if (channel) {
16711
- _context15.n = 6;
16724
+ _context15.n = 8;
16712
16725
  break;
16713
16726
  }
16714
16727
  throw new Error('Channel not found');
16715
- case 6:
16728
+ case 8:
16716
16729
  mentionedUserIds = message.mentionedUsers ? message.mentionedUsers.map(function (member) {
16717
16730
  return member.id;
16718
16731
  }) : [];
16719
16732
  attachments = message.attachments;
16720
16733
  if ((channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST || channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC) && !(channel.userRole === 'admin' || channel.userRole === 'owner')) {
16721
- _context15.n = 15;
16734
+ _context15.n = 17;
16722
16735
  break;
16723
16736
  }
16724
16737
  if (message.attachments && message.attachments.length && action.type !== RESEND_MESSAGE) {
@@ -16766,51 +16779,51 @@ function forwardMessage(action) {
16766
16779
  pendingMessage.forwardingDetails.hops = message.forwardingDetails ? message.forwardingDetails.hops : 1;
16767
16780
  }
16768
16781
  if (!pendingMessage) {
16769
- _context15.n = 8;
16782
+ _context15.n = 10;
16770
16783
  break;
16771
16784
  }
16772
16785
  if (!(action.type !== RESEND_MESSAGE)) {
16773
- _context15.n = 8;
16786
+ _context15.n = 10;
16774
16787
  break;
16775
16788
  }
16776
- _context15.n = 7;
16789
+ _context15.n = 9;
16777
16790
  return effects.call(loadOGMetadataForLinkMessages, [pendingMessage], true);
16778
- case 7:
16779
- _context15.n = 8;
16791
+ case 9:
16792
+ _context15.n = 10;
16780
16793
  return effects.call(updateMessage$1, action.type, pendingMessage, channel.id, channelId === activeChannelId, message, isNotShowOwnMessageForward);
16781
- case 8:
16794
+ case 10:
16782
16795
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
16783
- _context15.n = 14;
16796
+ _context15.n = 16;
16784
16797
  break;
16785
16798
  }
16786
- _context15.n = 9;
16799
+ _context15.n = 11;
16787
16800
  return effects.call(channel.sendMessage, _extends({}, messageToSend, isNotShowOwnMessageForward ? {
16788
16801
  forwardingDetails: null
16789
16802
  } : {}));
16790
- case 9:
16803
+ case 11:
16791
16804
  messageResponse = _context15.v;
16792
16805
  messageUpdateData = _extends({}, messageResponse, {
16793
16806
  channelId: channel.id
16794
16807
  });
16795
16808
  if (!(channelId === activeChannelId)) {
16796
- _context15.n = 10;
16809
+ _context15.n = 12;
16797
16810
  break;
16798
16811
  }
16799
- _context15.n = 10;
16812
+ _context15.n = 12;
16800
16813
  return effects.put(updateMessageAC(messageToSend.tid, JSON.parse(JSON.stringify(messageUpdateData)), true));
16801
- case 10:
16814
+ case 12:
16802
16815
  addConfirmedMessageToCache(channel.id, JSON.parse(JSON.stringify(messageUpdateData)));
16803
16816
  messageToUpdate = JSON.parse(JSON.stringify(messageResponse));
16804
16817
  if (!channel.unread) {
16805
- _context15.n = 11;
16818
+ _context15.n = 13;
16806
16819
  break;
16807
16820
  }
16808
- _context15.n = 11;
16821
+ _context15.n = 13;
16809
16822
  return effects.put(markChannelAsReadAC(channel.id));
16810
- case 11:
16823
+ case 13:
16811
16824
  resolvedLastMessage = getResolvedChannelLastMessage(channel.id, messageToUpdate, messageToSend);
16812
16825
  if (!lastMessageNeedsUpdate((_getStoredChannel8 = getStoredChannel(channel.id)) === null || _getStoredChannel8 === void 0 ? void 0 : _getStoredChannel8.lastMessage, resolvedLastMessage)) {
16813
- _context15.n = 13;
16826
+ _context15.n = 15;
16814
16827
  break;
16815
16828
  }
16816
16829
  updateChannelLastMessageOnAllChannels(channel.id, resolvedLastMessage);
@@ -16818,36 +16831,36 @@ function forwardMessage(action) {
16818
16831
  lastMessage: resolvedLastMessage,
16819
16832
  lastReactedMessage: null
16820
16833
  };
16821
- _context15.n = 12;
16822
- return effects.put(updateChannelDataAC(channel.id, channelUpdateParam, true));
16823
- case 12:
16824
- updateChannelOnAllChannels(channel.id, channelUpdateParam);
16825
- case 13:
16826
- _context15.n = 15;
16827
- break;
16834
+ _context15.n = 14;
16835
+ return effects.put(updateChannelDataAC(channel.id, _extends({}, channel, channelUpdateParam), true, false, true));
16828
16836
  case 14:
16829
- throw new Error('Connection required to forward message');
16837
+ updateChannelOnAllChannels(channel.id, channelUpdateParam);
16830
16838
  case 15:
16831
- _context15.n = 18;
16839
+ _context15.n = 17;
16832
16840
  break;
16833
16841
  case 16:
16834
- _context15.p = 16;
16842
+ throw new Error('Connection required to forward message');
16843
+ case 17:
16844
+ _context15.n = 20;
16845
+ break;
16846
+ case 18:
16847
+ _context15.p = 18;
16835
16848
  _t4 = _context15.v;
16836
16849
  isErrorResendable = isResendableError(_t4 === null || _t4 === void 0 ? void 0 : _t4.type);
16837
16850
  if (!((_channel5 = channel) !== null && _channel5 !== void 0 && _channel5.id && messageTid)) {
16838
- _context15.n = 17;
16851
+ _context15.n = 19;
16839
16852
  break;
16840
16853
  }
16841
- _context15.n = 17;
16854
+ _context15.n = 19;
16842
16855
  return effects.call(syncFailedMessageState, channel, messageTid, pendingMessage || _extends({}, message, {
16843
16856
  tid: messageTid
16844
16857
  }), isErrorResendable);
16845
- case 17:
16858
+ case 19:
16846
16859
  log.error('error on forward message ... ', _t4);
16847
- case 18:
16860
+ case 20:
16848
16861
  return _context15.a(2);
16849
16862
  }
16850
- }, _marked11, null, [[1, 16]]);
16863
+ }, _marked11, null, [[1, 18]]);
16851
16864
  }
16852
16865
  function resendMessage(action) {
16853
16866
  var _message$attachments;
@@ -44139,6 +44152,7 @@ function useChatController(_ref5) {
44139
44152
  var viewIsAtLatestRef = React.useRef(true);
44140
44153
  var jumpLockUntilRef = React.useRef(0);
44141
44154
  var jumpLockModeRef = React.useRef(null);
44155
+ var jumpLockHighWaterMarkRef = React.useRef(0);
44142
44156
  var jumpUnlockTimeoutRef = React.useRef(null);
44143
44157
  var isJumping = React.useRef(false);
44144
44158
  var currentJumpIdRef = React.useRef(0);
@@ -44345,6 +44359,7 @@ function useChatController(_ref5) {
44345
44359
  var clearJumpScrollingLock = React.useCallback(function () {
44346
44360
  jumpLockUntilRef.current = 0;
44347
44361
  jumpLockModeRef.current = null;
44362
+ jumpLockHighWaterMarkRef.current = 0;
44348
44363
  historyLoadArmedRef.current = true;
44349
44364
  latestLoadArmedRef.current = true;
44350
44365
  if (historyArmTimerRef.current !== null) {
@@ -44362,9 +44377,11 @@ function useChatController(_ref5) {
44362
44377
  isJumping.current = false;
44363
44378
  }, []);
44364
44379
  var lockJumpScrolling = React.useCallback(function (smooth, mode) {
44380
+ var _scrollRef$current$sc, _scrollRef$current;
44365
44381
  var lockDuration = smooth ? JUMP_SCROLL_LOCK_MS : 250;
44366
44382
  jumpLockUntilRef.current = Date.now() + lockDuration;
44367
44383
  jumpLockModeRef.current = mode;
44384
+ jumpLockHighWaterMarkRef.current = (_scrollRef$current$sc = (_scrollRef$current = scrollRef.current) === null || _scrollRef$current === void 0 ? void 0 : _scrollRef$current.scrollTop) != null ? _scrollRef$current$sc : 0;
44368
44385
  if (jumpUnlockTimeoutRef.current !== null) {
44369
44386
  clearTimeout(jumpUnlockTimeoutRef.current);
44370
44387
  }
@@ -45127,7 +45144,8 @@ function useChatController(_ref5) {
45127
45144
  if (isJumping.current) {
45128
45145
  return;
45129
45146
  }
45130
- if (currentScrollTop <= historyEdgeScrollTop + PRELOAD_TRIGGER_PX) {
45147
+ var jumpLockActive = Date.now() < jumpLockUntilRef.current;
45148
+ if (!jumpLockActive && currentScrollTop <= historyEdgeScrollTop + PRELOAD_TRIGGER_PX) {
45131
45149
  currentScrollTop = historyEdgeScrollTop;
45132
45150
  }
45133
45151
  if (currentScrollTop !== container.scrollTop) {
@@ -45135,9 +45153,14 @@ function useChatController(_ref5) {
45135
45153
  }
45136
45154
  var distanceFromLatest = latestEdgeScrollTop - currentScrollTop;
45137
45155
  lastMeasuredLatestEdgeRef.current = latestEdgeScrollTop;
45138
- if (Date.now() < jumpLockUntilRef.current) {
45156
+ if (jumpLockActive) {
45157
+ jumpLockHighWaterMarkRef.current = Math.max(jumpLockHighWaterMarkRef.current, currentScrollTop);
45139
45158
  if (jumpLockModeRef.current === 'latest' && distanceFromLatest > PRELOAD_RESET_PX) {
45140
- clearJumpScrollingLock();
45159
+ if (currentScrollTop < jumpLockHighWaterMarkRef.current - PRELOAD_RESET_PX) {
45160
+ clearJumpScrollingLock();
45161
+ } else {
45162
+ return;
45163
+ }
45141
45164
  } else {
45142
45165
  return;
45143
45166
  }
@@ -45386,12 +45409,12 @@ function useChatController(_ref5) {
45386
45409
  }, [channel.id, clearScrollIdleTimer, dispatch]);
45387
45410
  var departingChannelId = activeChannelIdRef.current;
45388
45411
  if (departingChannelId) {
45389
- var _scrollRef$current$sc, _scrollRef$current;
45412
+ var _scrollRef$current$sc2, _scrollRef$current2;
45390
45413
  var currentMessages = messagesRef.current;
45391
45414
  var startId = getFirstConfirmedMessageId(currentMessages);
45392
45415
  var endId = getLastConfirmedMessageId(currentMessages);
45393
45416
  var anchorId = lastVisibleAnchorIdRef.current;
45394
- var scrollTop = (_scrollRef$current$sc = (_scrollRef$current = scrollRef.current) === null || _scrollRef$current === void 0 ? void 0 : _scrollRef$current.scrollTop) != null ? _scrollRef$current$sc : 0;
45417
+ var scrollTop = (_scrollRef$current$sc2 = (_scrollRef$current2 = scrollRef.current) === null || _scrollRef$current2 === void 0 ? void 0 : _scrollRef$current2.scrollTop) != null ? _scrollRef$current$sc2 : 0;
45395
45418
  if (startId && endId && anchorId) {
45396
45419
  var confirmedMessages = currentMessages.filter(function (m) {
45397
45420
  return !!m.id;
@@ -45822,16 +45845,6 @@ function useChatController(_ref5) {
45822
45845
  return m.sortKey === latestLocalRef || m.localRef === latestLocalRef;
45823
45846
  });
45824
45847
  var shouldShow = !isLatestInView || !isViewingLatest && (pendingNewestCount > 0 || !!scrollToMentionedMessage);
45825
- console.log('[scrollToNewMsg]', {
45826
- latestLocalRef: latestLocalRef,
45827
- isLatestInView: !!isLatestInView,
45828
- isViewingLatest: isViewingLatest,
45829
- pendingNewestCount: pendingNewestCount,
45830
- scrollToMentionedMessage: scrollToMentionedMessage,
45831
- shouldShow: shouldShow,
45832
- showScrollToNewMessageButton: showScrollToNewMessageButton,
45833
- latestVisibleMessages: latestVisibleMessages
45834
- });
45835
45848
  if (showScrollToNewMessageButton !== shouldShow) {
45836
45849
  dispatch(showScrollToNewMessageButtonAC(shouldShow));
45837
45850
  }
package/index.modern.js CHANGED
@@ -9288,7 +9288,8 @@ var channelSlice = createSlice({
9288
9288
  config = _action$payload3.config,
9289
9289
  channelId = _action$payload3.channelId,
9290
9290
  moveUp = _action$payload3.moveUp,
9291
- sort = _action$payload3.sort;
9291
+ sort = _action$payload3.sort,
9292
+ add = _action$payload3.add;
9292
9293
  if (moveUp) {
9293
9294
  var updateChannel;
9294
9295
  var updatedChannels = state.channels.filter(function (chan) {
@@ -9297,8 +9298,8 @@ var channelSlice = createSlice({
9297
9298
  }
9298
9299
  return chan.id !== channelId;
9299
9300
  });
9300
- if (updateChannel) {
9301
- updateChannel = _extends({}, updateChannel, config);
9301
+ if (updateChannel || add) {
9302
+ updateChannel = _extends({}, updateChannel || {}, config);
9302
9303
  state.channels = sortChannelByLastMessage([updateChannel].concat(updatedChannels));
9303
9304
  }
9304
9305
  } else {
@@ -13564,12 +13565,13 @@ var updateChannelAC = function updateChannelAC(channelId, config) {
13564
13565
  }
13565
13566
  };
13566
13567
  };
13567
- var updateChannelDataAC = function updateChannelDataAC(channelId, config, moveUp, sort) {
13568
+ var updateChannelDataAC = function updateChannelDataAC(channelId, config, moveUp, sort, add) {
13568
13569
  return updateChannelData({
13569
13570
  config: config,
13570
13571
  channelId: channelId,
13571
13572
  moveUp: moveUp,
13572
- sort: sort
13573
+ sort: sort,
13574
+ add: add
13573
13575
  });
13574
13576
  };
13575
13577
  var updateChannelsMembersAC = function updateChannelsMembersAC(members) {
@@ -16666,7 +16668,7 @@ function sendTextMessage(action) {
16666
16668
  }
16667
16669
  function forwardMessage(action) {
16668
16670
  var _message$user;
16669
- var payload, message, channelId, connectionState, isForward, showOwnMessageForward, SceytChatClient, isNotShowOwnMessageForward, pendingMessage, channel, activeChannelId, messageTid, _SceytChatClient, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, pollDetails, messageToSend, _getStoredChannel8, messageResponse, messageUpdateData, messageToUpdate, resolvedLastMessage, channelUpdateParam, _channel5, isErrorResendable, _t4;
16671
+ var payload, message, channelId, connectionState, isForward, showOwnMessageForward, SceytChatClient, isNotShowOwnMessageForward, pendingMessage, channel, activeChannelId, messageTid, _SceytChatClient, parsedChannel, mentionedUserIds, attachments, attachmentBuilder, att, messageBuilder, pollDetails, messageToSend, _getStoredChannel8, messageResponse, messageUpdateData, messageToUpdate, resolvedLastMessage, channelUpdateParam, _channel5, isErrorResendable, _t4;
16670
16672
  return _regenerator().w(function (_context15) {
16671
16673
  while (1) switch (_context15.p = _context15.n) {
16672
16674
  case 0:
@@ -16685,12 +16687,12 @@ function forwardMessage(action) {
16685
16687
  case 2:
16686
16688
  channel = _context15.v;
16687
16689
  if (channel) {
16688
- _context15.n = 5;
16690
+ _context15.n = 7;
16689
16691
  break;
16690
16692
  }
16691
16693
  channel = getChannelFromAllChannels(channelId) || null;
16692
16694
  if (channel) {
16693
- _context15.n = 4;
16695
+ _context15.n = 5;
16694
16696
  break;
16695
16697
  }
16696
16698
  _SceytChatClient = getClient();
@@ -16698,26 +16700,37 @@ function forwardMessage(action) {
16698
16700
  return call(_SceytChatClient.getChannel, channelId);
16699
16701
  case 3:
16700
16702
  channel = _context15.v;
16701
- case 4:
16702
- if (channel) {
16703
- setChannelInMap(channel);
16703
+ if (!channel) {
16704
+ _context15.n = 4;
16705
+ break;
16704
16706
  }
16707
+ setChannelInMap(channel);
16708
+ addChannelToAllChannels(_extends({}, channel));
16709
+ parsedChannel = JSON.parse(JSON.stringify(channel));
16710
+ _context15.n = 4;
16711
+ return put(addChannelAC(parsedChannel));
16712
+ case 4:
16713
+ _context15.n = 6;
16714
+ break;
16715
+ case 5:
16716
+ setChannelInMap(channel);
16717
+ case 6:
16705
16718
  if (!channel) {
16706
16719
  channel = getChannelFromAllChannelsMap(channelId);
16707
16720
  }
16708
- case 5:
16721
+ case 7:
16709
16722
  if (channel) {
16710
- _context15.n = 6;
16723
+ _context15.n = 8;
16711
16724
  break;
16712
16725
  }
16713
16726
  throw new Error('Channel not found');
16714
- case 6:
16727
+ case 8:
16715
16728
  mentionedUserIds = message.mentionedUsers ? message.mentionedUsers.map(function (member) {
16716
16729
  return member.id;
16717
16730
  }) : [];
16718
16731
  attachments = message.attachments;
16719
16732
  if ((channel.type === DEFAULT_CHANNEL_TYPE.BROADCAST || channel.type === DEFAULT_CHANNEL_TYPE.PUBLIC) && !(channel.userRole === 'admin' || channel.userRole === 'owner')) {
16720
- _context15.n = 15;
16733
+ _context15.n = 17;
16721
16734
  break;
16722
16735
  }
16723
16736
  if (message.attachments && message.attachments.length && action.type !== RESEND_MESSAGE) {
@@ -16765,51 +16778,51 @@ function forwardMessage(action) {
16765
16778
  pendingMessage.forwardingDetails.hops = message.forwardingDetails ? message.forwardingDetails.hops : 1;
16766
16779
  }
16767
16780
  if (!pendingMessage) {
16768
- _context15.n = 8;
16781
+ _context15.n = 10;
16769
16782
  break;
16770
16783
  }
16771
16784
  if (!(action.type !== RESEND_MESSAGE)) {
16772
- _context15.n = 8;
16785
+ _context15.n = 10;
16773
16786
  break;
16774
16787
  }
16775
- _context15.n = 7;
16788
+ _context15.n = 9;
16776
16789
  return call(loadOGMetadataForLinkMessages, [pendingMessage], true);
16777
- case 7:
16778
- _context15.n = 8;
16790
+ case 9:
16791
+ _context15.n = 10;
16779
16792
  return call(updateMessage$1, action.type, pendingMessage, channel.id, channelId === activeChannelId, message, isNotShowOwnMessageForward);
16780
- case 8:
16793
+ case 10:
16781
16794
  if (!(connectionState === CONNECTION_STATUS.CONNECTED)) {
16782
- _context15.n = 14;
16795
+ _context15.n = 16;
16783
16796
  break;
16784
16797
  }
16785
- _context15.n = 9;
16798
+ _context15.n = 11;
16786
16799
  return call(channel.sendMessage, _extends({}, messageToSend, isNotShowOwnMessageForward ? {
16787
16800
  forwardingDetails: null
16788
16801
  } : {}));
16789
- case 9:
16802
+ case 11:
16790
16803
  messageResponse = _context15.v;
16791
16804
  messageUpdateData = _extends({}, messageResponse, {
16792
16805
  channelId: channel.id
16793
16806
  });
16794
16807
  if (!(channelId === activeChannelId)) {
16795
- _context15.n = 10;
16808
+ _context15.n = 12;
16796
16809
  break;
16797
16810
  }
16798
- _context15.n = 10;
16811
+ _context15.n = 12;
16799
16812
  return put(updateMessageAC(messageToSend.tid, JSON.parse(JSON.stringify(messageUpdateData)), true));
16800
- case 10:
16813
+ case 12:
16801
16814
  addConfirmedMessageToCache(channel.id, JSON.parse(JSON.stringify(messageUpdateData)));
16802
16815
  messageToUpdate = JSON.parse(JSON.stringify(messageResponse));
16803
16816
  if (!channel.unread) {
16804
- _context15.n = 11;
16817
+ _context15.n = 13;
16805
16818
  break;
16806
16819
  }
16807
- _context15.n = 11;
16820
+ _context15.n = 13;
16808
16821
  return put(markChannelAsReadAC(channel.id));
16809
- case 11:
16822
+ case 13:
16810
16823
  resolvedLastMessage = getResolvedChannelLastMessage(channel.id, messageToUpdate, messageToSend);
16811
16824
  if (!lastMessageNeedsUpdate((_getStoredChannel8 = getStoredChannel(channel.id)) === null || _getStoredChannel8 === void 0 ? void 0 : _getStoredChannel8.lastMessage, resolvedLastMessage)) {
16812
- _context15.n = 13;
16825
+ _context15.n = 15;
16813
16826
  break;
16814
16827
  }
16815
16828
  updateChannelLastMessageOnAllChannels(channel.id, resolvedLastMessage);
@@ -16817,36 +16830,36 @@ function forwardMessage(action) {
16817
16830
  lastMessage: resolvedLastMessage,
16818
16831
  lastReactedMessage: null
16819
16832
  };
16820
- _context15.n = 12;
16821
- return put(updateChannelDataAC(channel.id, channelUpdateParam, true));
16822
- case 12:
16823
- updateChannelOnAllChannels(channel.id, channelUpdateParam);
16824
- case 13:
16825
- _context15.n = 15;
16826
- break;
16833
+ _context15.n = 14;
16834
+ return put(updateChannelDataAC(channel.id, _extends({}, channel, channelUpdateParam), true, false, true));
16827
16835
  case 14:
16828
- throw new Error('Connection required to forward message');
16836
+ updateChannelOnAllChannels(channel.id, channelUpdateParam);
16829
16837
  case 15:
16830
- _context15.n = 18;
16838
+ _context15.n = 17;
16831
16839
  break;
16832
16840
  case 16:
16833
- _context15.p = 16;
16841
+ throw new Error('Connection required to forward message');
16842
+ case 17:
16843
+ _context15.n = 20;
16844
+ break;
16845
+ case 18:
16846
+ _context15.p = 18;
16834
16847
  _t4 = _context15.v;
16835
16848
  isErrorResendable = isResendableError(_t4 === null || _t4 === void 0 ? void 0 : _t4.type);
16836
16849
  if (!((_channel5 = channel) !== null && _channel5 !== void 0 && _channel5.id && messageTid)) {
16837
- _context15.n = 17;
16850
+ _context15.n = 19;
16838
16851
  break;
16839
16852
  }
16840
- _context15.n = 17;
16853
+ _context15.n = 19;
16841
16854
  return call(syncFailedMessageState, channel, messageTid, pendingMessage || _extends({}, message, {
16842
16855
  tid: messageTid
16843
16856
  }), isErrorResendable);
16844
- case 17:
16857
+ case 19:
16845
16858
  log.error('error on forward message ... ', _t4);
16846
- case 18:
16859
+ case 20:
16847
16860
  return _context15.a(2);
16848
16861
  }
16849
- }, _marked11, null, [[1, 16]]);
16862
+ }, _marked11, null, [[1, 18]]);
16850
16863
  }
16851
16864
  function resendMessage(action) {
16852
16865
  var _message$attachments;
@@ -44138,6 +44151,7 @@ function useChatController(_ref5) {
44138
44151
  var viewIsAtLatestRef = useRef(true);
44139
44152
  var jumpLockUntilRef = useRef(0);
44140
44153
  var jumpLockModeRef = useRef(null);
44154
+ var jumpLockHighWaterMarkRef = useRef(0);
44141
44155
  var jumpUnlockTimeoutRef = useRef(null);
44142
44156
  var isJumping = useRef(false);
44143
44157
  var currentJumpIdRef = useRef(0);
@@ -44344,6 +44358,7 @@ function useChatController(_ref5) {
44344
44358
  var clearJumpScrollingLock = useCallback(function () {
44345
44359
  jumpLockUntilRef.current = 0;
44346
44360
  jumpLockModeRef.current = null;
44361
+ jumpLockHighWaterMarkRef.current = 0;
44347
44362
  historyLoadArmedRef.current = true;
44348
44363
  latestLoadArmedRef.current = true;
44349
44364
  if (historyArmTimerRef.current !== null) {
@@ -44361,9 +44376,11 @@ function useChatController(_ref5) {
44361
44376
  isJumping.current = false;
44362
44377
  }, []);
44363
44378
  var lockJumpScrolling = useCallback(function (smooth, mode) {
44379
+ var _scrollRef$current$sc, _scrollRef$current;
44364
44380
  var lockDuration = smooth ? JUMP_SCROLL_LOCK_MS : 250;
44365
44381
  jumpLockUntilRef.current = Date.now() + lockDuration;
44366
44382
  jumpLockModeRef.current = mode;
44383
+ jumpLockHighWaterMarkRef.current = (_scrollRef$current$sc = (_scrollRef$current = scrollRef.current) === null || _scrollRef$current === void 0 ? void 0 : _scrollRef$current.scrollTop) != null ? _scrollRef$current$sc : 0;
44367
44384
  if (jumpUnlockTimeoutRef.current !== null) {
44368
44385
  clearTimeout(jumpUnlockTimeoutRef.current);
44369
44386
  }
@@ -45126,7 +45143,8 @@ function useChatController(_ref5) {
45126
45143
  if (isJumping.current) {
45127
45144
  return;
45128
45145
  }
45129
- if (currentScrollTop <= historyEdgeScrollTop + PRELOAD_TRIGGER_PX) {
45146
+ var jumpLockActive = Date.now() < jumpLockUntilRef.current;
45147
+ if (!jumpLockActive && currentScrollTop <= historyEdgeScrollTop + PRELOAD_TRIGGER_PX) {
45130
45148
  currentScrollTop = historyEdgeScrollTop;
45131
45149
  }
45132
45150
  if (currentScrollTop !== container.scrollTop) {
@@ -45134,9 +45152,14 @@ function useChatController(_ref5) {
45134
45152
  }
45135
45153
  var distanceFromLatest = latestEdgeScrollTop - currentScrollTop;
45136
45154
  lastMeasuredLatestEdgeRef.current = latestEdgeScrollTop;
45137
- if (Date.now() < jumpLockUntilRef.current) {
45155
+ if (jumpLockActive) {
45156
+ jumpLockHighWaterMarkRef.current = Math.max(jumpLockHighWaterMarkRef.current, currentScrollTop);
45138
45157
  if (jumpLockModeRef.current === 'latest' && distanceFromLatest > PRELOAD_RESET_PX) {
45139
- clearJumpScrollingLock();
45158
+ if (currentScrollTop < jumpLockHighWaterMarkRef.current - PRELOAD_RESET_PX) {
45159
+ clearJumpScrollingLock();
45160
+ } else {
45161
+ return;
45162
+ }
45140
45163
  } else {
45141
45164
  return;
45142
45165
  }
@@ -45385,12 +45408,12 @@ function useChatController(_ref5) {
45385
45408
  }, [channel.id, clearScrollIdleTimer, dispatch]);
45386
45409
  var departingChannelId = activeChannelIdRef.current;
45387
45410
  if (departingChannelId) {
45388
- var _scrollRef$current$sc, _scrollRef$current;
45411
+ var _scrollRef$current$sc2, _scrollRef$current2;
45389
45412
  var currentMessages = messagesRef.current;
45390
45413
  var startId = getFirstConfirmedMessageId(currentMessages);
45391
45414
  var endId = getLastConfirmedMessageId(currentMessages);
45392
45415
  var anchorId = lastVisibleAnchorIdRef.current;
45393
- var scrollTop = (_scrollRef$current$sc = (_scrollRef$current = scrollRef.current) === null || _scrollRef$current === void 0 ? void 0 : _scrollRef$current.scrollTop) != null ? _scrollRef$current$sc : 0;
45416
+ var scrollTop = (_scrollRef$current$sc2 = (_scrollRef$current2 = scrollRef.current) === null || _scrollRef$current2 === void 0 ? void 0 : _scrollRef$current2.scrollTop) != null ? _scrollRef$current$sc2 : 0;
45394
45417
  if (startId && endId && anchorId) {
45395
45418
  var confirmedMessages = currentMessages.filter(function (m) {
45396
45419
  return !!m.id;
@@ -45821,16 +45844,6 @@ function useChatController(_ref5) {
45821
45844
  return m.sortKey === latestLocalRef || m.localRef === latestLocalRef;
45822
45845
  });
45823
45846
  var shouldShow = !isLatestInView || !isViewingLatest && (pendingNewestCount > 0 || !!scrollToMentionedMessage);
45824
- console.log('[scrollToNewMsg]', {
45825
- latestLocalRef: latestLocalRef,
45826
- isLatestInView: !!isLatestInView,
45827
- isViewingLatest: isViewingLatest,
45828
- pendingNewestCount: pendingNewestCount,
45829
- scrollToMentionedMessage: scrollToMentionedMessage,
45830
- shouldShow: shouldShow,
45831
- showScrollToNewMessageButton: showScrollToNewMessageButton,
45832
- latestVisibleMessages: latestVisibleMessages
45833
- });
45834
45847
  if (showScrollToNewMessageButton !== shouldShow) {
45835
45848
  dispatch(showScrollToNewMessageButtonAC(shouldShow));
45836
45849
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sceyt-chat-react-uikit",
3
- "version": "1.8.8-beta.5",
3
+ "version": "1.8.8-beta.6",
4
4
  "description": "Interactive React UI Components for Sceyt Chat.",
5
5
  "author": "Sceyt",
6
6
  "license": "MIT",