sceyt-chat-react-uikit 1.8.8-beta.16 → 1.8.8-beta.17

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
@@ -20614,7 +20614,7 @@ function loadMoreReactions(action) {
20614
20614
  }
20615
20615
  function getMessageAttachments(action) {
20616
20616
  var _store$getState$Messa2;
20617
- var _action$payload7, channelId, attachmentType, limit, direction, attachmentId, forPopup, cacheKey, cachedAttachments, SceytChatClient, typeList, AttachmentByTypeQueryBuilder, AttachmentByTypeQuery, result, attachments, attachmentIndex, hasPrev, hasNext, freshAttachments, _t39;
20617
+ var _action$payload7, channelId, attachmentType, limit, direction, attachmentId, forPopup, cacheKey, cachedAttachments, SceytChatClient, typeList, AttachmentByTypeQueryBuilder, AttachmentByTypeQuery, result, attachments, _attachments$2, _attachments, attachmentIndex, hasPrev, hasNext, freshAttachments, _t39;
20618
20618
  return _regenerator().w(function (_context42) {
20619
20619
  while (1) switch (_context42.p = _context42.n) {
20620
20620
  case 0:
@@ -20693,6 +20693,16 @@ function getMessageAttachments(action) {
20693
20693
  break;
20694
20694
  }
20695
20695
  query.AttachmentByTypeQueryForPopup = AttachmentByTypeQuery;
20696
+ console.log('[MEDIA_OPEN] 8.saga-forPopup ' + JSON.stringify({
20697
+ requestedAttId: attachmentId,
20698
+ direction: direction,
20699
+ returned: attachments.length,
20700
+ containsRequested: attachments.some(function (a) {
20701
+ return a.id === attachmentId;
20702
+ }),
20703
+ firstId: (_attachments$2 = attachments[0]) === null || _attachments$2 === void 0 ? void 0 : _attachments$2.id,
20704
+ lastId: (_attachments = attachments[attachments.length - 1]) === null || _attachments === void 0 ? void 0 : _attachments.id
20705
+ }));
20696
20706
  _context42.n = 12;
20697
20707
  return effects.put(setAttachmentsForPopupAC(JSON.parse(JSON.stringify(attachments))));
20698
20708
  case 12:
@@ -37007,18 +37017,36 @@ var SliderPopup = function SliderPopup(_ref) {
37007
37017
  log.error('Error getting initial attachment from cache:', error);
37008
37018
  });
37009
37019
  }
37010
- if (!attachmentsList.find(function (item) {
37020
+ var foundInStaleList = !!attachmentsList.find(function (item) {
37011
37021
  return item.id === currentMediaFile.id;
37012
- })) {
37022
+ });
37023
+ console.log('[MEDIA_OPEN] 4.slider-mount ' + JSON.stringify({
37024
+ attId: currentMediaFile.id,
37025
+ name: currentMediaFile.name,
37026
+ msgId: currentMediaFile.messageId,
37027
+ staleListLen: attachmentsList.length,
37028
+ foundInStaleList: foundInStaleList,
37029
+ staleListIds: attachmentsList.slice(0, 5).map(function (item) {
37030
+ return item.id;
37031
+ })
37032
+ }));
37033
+ if (!foundInStaleList) {
37013
37034
  dispatch(setAttachmentsForPopupAC([currentMediaFile]));
37014
37035
  }
37015
37036
  dispatch(getAttachmentsAC(channel.id, channelDetailsTabs.media, 34, queryDirection.NEAR, currentMediaFile.id, true));
37016
37037
  }, []);
37017
37038
  var activeFileIndex = React.useMemo(function () {
37018
37039
  if (!(currentFile !== null && currentFile !== void 0 && currentFile.id)) return -1;
37019
- return attachmentsList.findIndex(function (item) {
37040
+ var index = attachmentsList.findIndex(function (item) {
37020
37041
  return item.id === currentFile.id;
37021
37042
  });
37043
+ console.log('[MEDIA_OPEN] 5.activeIndex ' + JSON.stringify({
37044
+ index: index,
37045
+ attId: currentFile.id,
37046
+ name: currentFile.name,
37047
+ listLen: attachmentsList.length
37048
+ }));
37049
+ return index;
37022
37050
  }, [attachmentsList, currentFile]);
37023
37051
  React.useEffect(function () {
37024
37052
  var currentFileId = currentFile === null || currentFile === void 0 ? void 0 : currentFile.id;
@@ -37030,6 +37058,13 @@ var SliderPopup = function SliderPopup(_ref) {
37030
37058
  var newIndex = attachmentsList.findIndex(function (item) {
37031
37059
  return item.id === currentFileId;
37032
37060
  });
37061
+ console.log('[MEDIA_OPEN] 6.list-grew ' + JSON.stringify({
37062
+ prevLen: previousLength,
37063
+ newLen: newLength,
37064
+ attId: currentFileId,
37065
+ newIndex: newIndex,
37066
+ activeFileIndex: activeFileIndex
37067
+ }));
37033
37068
  if (newIndex >= 0) {
37034
37069
  if (newIndex !== activeFileIndex) {
37035
37070
  var newFile = attachmentsList[newIndex];
@@ -37171,6 +37206,12 @@ var SliderPopup = function SliderPopup(_ref) {
37171
37206
  clearTimeout(timeout);
37172
37207
  }, 400);
37173
37208
  if (pageIndex >= 0 && pageIndex < attachmentsList.length) {
37209
+ var _attachmentsList$page, _attachmentsList$page2;
37210
+ console.log('[MEDIA_OPEN] 7.carousel-change ' + JSON.stringify({
37211
+ pageIndex: pageIndex,
37212
+ attId: (_attachmentsList$page = attachmentsList[pageIndex]) === null || _attachmentsList$page === void 0 ? void 0 : _attachmentsList$page.id,
37213
+ name: (_attachmentsList$page2 = attachmentsList[pageIndex]) === null || _attachmentsList$page2 === void 0 ? void 0 : _attachmentsList$page2.name
37214
+ }));
37174
37215
  setCurrentFile(attachmentsList[pageIndex]);
37175
37216
  setNextButtonDisabled(!attachmentsList[pageIndex + 1]);
37176
37217
  setPrevButtonDisabled(!attachmentsList[pageIndex - 1]);
@@ -44741,6 +44782,12 @@ var Message$1 = function Message(_ref) {
44741
44782
  clearTimeout(messageActionsTimeout.current);
44742
44783
  }
44743
44784
  lastMediaItemClickTime = Date.now();
44785
+ console.log('[MEDIA_OPEN] 2.wrapper ' + JSON.stringify({
44786
+ msgId: message.id,
44787
+ attId: attachment === null || attachment === void 0 ? void 0 : attachment.id,
44788
+ name: attachment === null || attachment === void 0 ? void 0 : attachment.name,
44789
+ url: attachment === null || attachment === void 0 ? void 0 : attachment.url
44790
+ }));
44744
44791
  setMessageActionsShow(false);
44745
44792
  dispatch(setMessageMenuOpenedAC(message.id || message.tid));
44746
44793
  if (handleMediaItemClick) {
@@ -48045,6 +48092,11 @@ var MessageList = function MessageList(_ref) {
48045
48092
  setMediaFile(null);
48046
48093
  }, [channel.id]);
48047
48094
  var handleMediaItemClickStable = React.useCallback(function (attachment) {
48095
+ console.log('[MEDIA_OPEN] 3.setMediaFile ' + JSON.stringify({
48096
+ attId: attachment === null || attachment === void 0 ? void 0 : attachment.id,
48097
+ name: attachment === null || attachment === void 0 ? void 0 : attachment.name,
48098
+ skipped: !(attachment !== null && attachment !== void 0 && attachment.id)
48099
+ }));
48048
48100
  if (attachment !== null && attachment !== void 0 && attachment.id) setMediaFile(attachment);
48049
48101
  }, []);
48050
48102
  var renderTimelineMessage = function renderTimelineMessage(_ref2) {
package/index.modern.js CHANGED
@@ -20594,7 +20594,7 @@ function loadMoreReactions(action) {
20594
20594
  }
20595
20595
  function getMessageAttachments(action) {
20596
20596
  var _store$getState$Messa2;
20597
- var _action$payload7, channelId, attachmentType, limit, direction, attachmentId, forPopup, cacheKey, cachedAttachments, SceytChatClient, typeList, AttachmentByTypeQueryBuilder, AttachmentByTypeQuery, result, attachments, attachmentIndex, hasPrev, hasNext, freshAttachments, _t39;
20597
+ var _action$payload7, channelId, attachmentType, limit, direction, attachmentId, forPopup, cacheKey, cachedAttachments, SceytChatClient, typeList, AttachmentByTypeQueryBuilder, AttachmentByTypeQuery, result, attachments, _attachments$2, _attachments, attachmentIndex, hasPrev, hasNext, freshAttachments, _t39;
20598
20598
  return _regenerator().w(function (_context42) {
20599
20599
  while (1) switch (_context42.p = _context42.n) {
20600
20600
  case 0:
@@ -20673,6 +20673,16 @@ function getMessageAttachments(action) {
20673
20673
  break;
20674
20674
  }
20675
20675
  query.AttachmentByTypeQueryForPopup = AttachmentByTypeQuery;
20676
+ console.log('[MEDIA_OPEN] 8.saga-forPopup ' + JSON.stringify({
20677
+ requestedAttId: attachmentId,
20678
+ direction: direction,
20679
+ returned: attachments.length,
20680
+ containsRequested: attachments.some(function (a) {
20681
+ return a.id === attachmentId;
20682
+ }),
20683
+ firstId: (_attachments$2 = attachments[0]) === null || _attachments$2 === void 0 ? void 0 : _attachments$2.id,
20684
+ lastId: (_attachments = attachments[attachments.length - 1]) === null || _attachments === void 0 ? void 0 : _attachments.id
20685
+ }));
20676
20686
  _context42.n = 12;
20677
20687
  return put(setAttachmentsForPopupAC(JSON.parse(JSON.stringify(attachments))));
20678
20688
  case 12:
@@ -36987,18 +36997,36 @@ var SliderPopup = function SliderPopup(_ref) {
36987
36997
  log.error('Error getting initial attachment from cache:', error);
36988
36998
  });
36989
36999
  }
36990
- if (!attachmentsList.find(function (item) {
37000
+ var foundInStaleList = !!attachmentsList.find(function (item) {
36991
37001
  return item.id === currentMediaFile.id;
36992
- })) {
37002
+ });
37003
+ console.log('[MEDIA_OPEN] 4.slider-mount ' + JSON.stringify({
37004
+ attId: currentMediaFile.id,
37005
+ name: currentMediaFile.name,
37006
+ msgId: currentMediaFile.messageId,
37007
+ staleListLen: attachmentsList.length,
37008
+ foundInStaleList: foundInStaleList,
37009
+ staleListIds: attachmentsList.slice(0, 5).map(function (item) {
37010
+ return item.id;
37011
+ })
37012
+ }));
37013
+ if (!foundInStaleList) {
36993
37014
  dispatch(setAttachmentsForPopupAC([currentMediaFile]));
36994
37015
  }
36995
37016
  dispatch(getAttachmentsAC(channel.id, channelDetailsTabs.media, 34, queryDirection.NEAR, currentMediaFile.id, true));
36996
37017
  }, []);
36997
37018
  var activeFileIndex = useMemo(function () {
36998
37019
  if (!(currentFile !== null && currentFile !== void 0 && currentFile.id)) return -1;
36999
- return attachmentsList.findIndex(function (item) {
37020
+ var index = attachmentsList.findIndex(function (item) {
37000
37021
  return item.id === currentFile.id;
37001
37022
  });
37023
+ console.log('[MEDIA_OPEN] 5.activeIndex ' + JSON.stringify({
37024
+ index: index,
37025
+ attId: currentFile.id,
37026
+ name: currentFile.name,
37027
+ listLen: attachmentsList.length
37028
+ }));
37029
+ return index;
37002
37030
  }, [attachmentsList, currentFile]);
37003
37031
  useEffect(function () {
37004
37032
  var currentFileId = currentFile === null || currentFile === void 0 ? void 0 : currentFile.id;
@@ -37010,6 +37038,13 @@ var SliderPopup = function SliderPopup(_ref) {
37010
37038
  var newIndex = attachmentsList.findIndex(function (item) {
37011
37039
  return item.id === currentFileId;
37012
37040
  });
37041
+ console.log('[MEDIA_OPEN] 6.list-grew ' + JSON.stringify({
37042
+ prevLen: previousLength,
37043
+ newLen: newLength,
37044
+ attId: currentFileId,
37045
+ newIndex: newIndex,
37046
+ activeFileIndex: activeFileIndex
37047
+ }));
37013
37048
  if (newIndex >= 0) {
37014
37049
  if (newIndex !== activeFileIndex) {
37015
37050
  var newFile = attachmentsList[newIndex];
@@ -37151,6 +37186,12 @@ var SliderPopup = function SliderPopup(_ref) {
37151
37186
  clearTimeout(timeout);
37152
37187
  }, 400);
37153
37188
  if (pageIndex >= 0 && pageIndex < attachmentsList.length) {
37189
+ var _attachmentsList$page, _attachmentsList$page2;
37190
+ console.log('[MEDIA_OPEN] 7.carousel-change ' + JSON.stringify({
37191
+ pageIndex: pageIndex,
37192
+ attId: (_attachmentsList$page = attachmentsList[pageIndex]) === null || _attachmentsList$page === void 0 ? void 0 : _attachmentsList$page.id,
37193
+ name: (_attachmentsList$page2 = attachmentsList[pageIndex]) === null || _attachmentsList$page2 === void 0 ? void 0 : _attachmentsList$page2.name
37194
+ }));
37154
37195
  setCurrentFile(attachmentsList[pageIndex]);
37155
37196
  setNextButtonDisabled(!attachmentsList[pageIndex + 1]);
37156
37197
  setPrevButtonDisabled(!attachmentsList[pageIndex - 1]);
@@ -44721,6 +44762,12 @@ var Message$1 = function Message(_ref) {
44721
44762
  clearTimeout(messageActionsTimeout.current);
44722
44763
  }
44723
44764
  lastMediaItemClickTime = Date.now();
44765
+ console.log('[MEDIA_OPEN] 2.wrapper ' + JSON.stringify({
44766
+ msgId: message.id,
44767
+ attId: attachment === null || attachment === void 0 ? void 0 : attachment.id,
44768
+ name: attachment === null || attachment === void 0 ? void 0 : attachment.name,
44769
+ url: attachment === null || attachment === void 0 ? void 0 : attachment.url
44770
+ }));
44724
44771
  setMessageActionsShow(false);
44725
44772
  dispatch(setMessageMenuOpenedAC(message.id || message.tid));
44726
44773
  if (handleMediaItemClick) {
@@ -48025,6 +48072,11 @@ var MessageList = function MessageList(_ref) {
48025
48072
  setMediaFile(null);
48026
48073
  }, [channel.id]);
48027
48074
  var handleMediaItemClickStable = useCallback(function (attachment) {
48075
+ console.log('[MEDIA_OPEN] 3.setMediaFile ' + JSON.stringify({
48076
+ attId: attachment === null || attachment === void 0 ? void 0 : attachment.id,
48077
+ name: attachment === null || attachment === void 0 ? void 0 : attachment.name,
48078
+ skipped: !(attachment !== null && attachment !== void 0 && attachment.id)
48079
+ }));
48028
48080
  if (attachment !== null && attachment !== void 0 && attachment.id) setMediaFile(attachment);
48029
48081
  }, []);
48030
48082
  var renderTimelineMessage = function renderTimelineMessage(_ref2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sceyt-chat-react-uikit",
3
- "version": "1.8.8-beta.16",
3
+ "version": "1.8.8-beta.17",
4
4
  "description": "Interactive React UI Components for Sceyt Chat.",
5
5
  "author": "Sceyt",
6
6
  "license": "MIT",