sceyt-chat-react-uikit 1.9.2-beta.1 → 1.9.2-beta.2

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.
@@ -19,7 +19,7 @@ export interface IUploadTask {
19
19
  }
20
20
  export interface ICustomUploader {
21
21
  upload: (attachment: IAttachment, uploadTask: IUploadTask, messageType: string | null | undefined) => void;
22
- download: (uri: string, download: boolean, progressCallback: (progress: any) => void, messageType: string | null | undefined) => Promise<any>;
22
+ download: (uri: string, download: boolean, progressCallback: (progress: any) => void, messageType: string | null | undefined, messageId?: string | null) => Promise<any>;
23
23
  cancelRequest: (requestPromise: any) => void;
24
24
  }
25
25
  export declare type ThemeColors = 'accent' | 'avatarBrand1' | 'avatarBrand2' | 'avatarBrand3' | 'avatarBrand4' | 'textPrimary' | 'textSecondary' | 'textFootnote' | 'textOnPrimary' | 'border' | 'iconInactive' | 'iconPrimary' | 'background' | 'backgroundSections' | 'backgroundFocused' | 'backgroundHovered' | 'overlayBackground' | 'overlayBackground2' | 'surface1' | 'surface2' | 'surfaceX' | 'warning' | 'attention' | 'onlineStatus' | 'success' | 'outgoingMessageBackground' | 'outgoingMessageBackgroundX' | 'incomingMessageBackground' | 'incomingMessageBackgroundX' | 'linkColor' | 'highlightedBackground';
package/index.js CHANGED
@@ -11381,7 +11381,7 @@ var downloadFile = function downloadFile(attachment, download, done, progressCal
11381
11381
  if (progressCallback) {
11382
11382
  progressCallback(progress);
11383
11383
  }
11384
- }, messageType);
11384
+ }, messageType, attachment.messageId);
11385
11385
  filesPromisesOnDownload[attachment.id] = urlPromise;
11386
11386
  return Promise.resolve(urlPromise).then(function (result) {
11387
11387
  FileSaver.saveAs(result.Body, attachment.name);
@@ -17754,7 +17754,7 @@ var download = function download(request, job) {
17754
17754
  if (customDownloader) {
17755
17755
  var _request$customDownlo;
17756
17756
  var requestBlob = (_request$customDownlo = request.customDownload) != null ? _request$customDownlo : true;
17757
- var customRequest = customDownloader(request.url, requestBlob, reportProgress, request.messageType);
17757
+ var customRequest = customDownloader(request.url, requestBlob, reportProgress, request.messageType, request.messageId);
17758
17758
  job.customRequest = customRequest;
17759
17759
  return Promise.resolve(customRequest).then(function (result) {
17760
17760
  var body = (result === null || result === void 0 ? void 0 : result.Body) || result;
@@ -17953,7 +17953,7 @@ var getVideoAttachmentCacheKeys = function getVideoAttachmentCacheKeys(videoUrl,
17953
17953
  originalVideo: videoUrl + "_original_video_url"
17954
17954
  };
17955
17955
  };
17956
- var downloadVideoThumb = function downloadVideoThumb(videoThumb, downloader, messageType) {
17956
+ var downloadVideoThumb = function downloadVideoThumb(videoThumb, downloader, messageType, messageId) {
17957
17957
  try {
17958
17958
  return Promise.resolve(getAttachmentUrlFromCache(videoThumb)["catch"](function () {
17959
17959
  return false;
@@ -17964,6 +17964,7 @@ var downloadVideoThumb = function downloadVideoThumb(videoThumb, downloader, mes
17964
17964
  cacheKey: videoThumb,
17965
17965
  kind: 'video-thumbnail',
17966
17966
  messageType: messageType,
17967
+ messageId: messageId,
17967
17968
  downloader: downloader,
17968
17969
  customDownload: true,
17969
17970
  skipCacheLookup: true
@@ -42018,7 +42019,7 @@ var VideoPreview = /*#__PURE__*/React.memo(function VideoPreview(_ref) {
42018
42019
  React.useEffect(function () {
42019
42020
  if (!videoThumb || downloadedPreviewImage) return;
42020
42021
  var cancelled = false;
42021
- downloadVideoThumb(videoThumb, getCustomDownloader(), messageType).then(function (localPreviewUrl) {
42022
+ downloadVideoThumb(videoThumb, getCustomDownloader(), messageType, file.messageId).then(function (localPreviewUrl) {
42022
42023
  if (!cancelled) {
42023
42024
  dispatch(setUpdateMessageAttachmentAC(videoThumb, localPreviewUrl));
42024
42025
  }
@@ -42454,18 +42455,8 @@ var Attachment = function Attachment(_ref) {
42454
42455
  e.stopPropagation();
42455
42456
  if (downloadIsCancelled) {
42456
42457
  setDownloadIsCancelled(false);
42457
- if (customDownloader) {
42458
- customDownloader(attachment.url, false, function (progress) {
42459
- var loadedRes = progress.loaded && progress.loaded / progress.total;
42460
- var uploadPercent = loadedRes && loadedRes * 100;
42461
- setSizeProgress({
42462
- loaded: progress.loaded || 0,
42463
- total: progress.total || 0
42464
- });
42465
- setProgress(uploadPercent);
42466
- }, messageType).then(function (url) {
42467
- downloadImage(url);
42468
- });
42458
+ if (getCustomUploader()) {
42459
+ handleResumeOriginalImageDownload(e);
42469
42460
  } else {
42470
42461
  downloadImage(attachment.url);
42471
42462
  }
@@ -42555,7 +42546,7 @@ var Attachment = function Attachment(_ref) {
42555
42546
  total: progress.total || 0
42556
42547
  });
42557
42548
  setProgress(uploadPercent);
42558
- }, messageType);
42549
+ }, messageType, attachment.messageId);
42559
42550
  setDownloadFilePromise(attachment.id, urlPromise);
42560
42551
  return Promise.resolve(urlPromise).then(function (result) {
42561
42552
  function _temp8(body) {
@@ -42802,6 +42793,7 @@ var Attachment = function Attachment(_ref) {
42802
42793
  cacheKey: originalVideoCacheKey,
42803
42794
  kind: 'original-video',
42804
42795
  messageType: messageType,
42796
+ messageId: attachment.messageId,
42805
42797
  size: Number(attachment.size) || 0
42806
42798
  }).then(function (_ref4) {
42807
42799
  var objectUrl = _ref4.objectUrl;
@@ -42864,6 +42856,7 @@ var Attachment = function Attachment(_ref) {
42864
42856
  cacheKey: originalVideoCacheKey,
42865
42857
  kind: 'original-video',
42866
42858
  messageType: messageType,
42859
+ messageId: attachment.messageId,
42867
42860
  size: Number(attachment.size) || 0
42868
42861
  }).then(function (_ref5) {
42869
42862
  var objectUrl = _ref5.objectUrl;
@@ -42897,6 +42890,7 @@ var Attachment = function Attachment(_ref) {
42897
42890
  cacheKeys: [attachment.url + '_original_image_url'],
42898
42891
  kind: 'original-image',
42899
42892
  messageType: messageType,
42893
+ messageId: attachment.messageId,
42900
42894
  size: Number(attachment.size) || 0
42901
42895
  }).then(function (_ref6) {
42902
42896
  var objectUrl = _ref6.objectUrl;
@@ -42958,6 +42952,7 @@ var Attachment = function Attachment(_ref) {
42958
42952
  cacheKeys: [attachment.url + '_original_image_url'],
42959
42953
  kind: 'original-image',
42960
42954
  messageType: messageType,
42955
+ messageId: attachment.messageId,
42961
42956
  size: Number(attachment.size) || 0
42962
42957
  }).then(function (_ref7) {
42963
42958
  var objectUrl = _ref7.objectUrl;
@@ -42997,6 +42992,7 @@ var Attachment = function Attachment(_ref) {
42997
42992
  cacheKey: attachment.url,
42998
42993
  kind: kind,
42999
42994
  messageType: messageType,
42995
+ messageId: attachment.messageId,
43000
42996
  size: Number(attachment.size) || 0
43001
42997
  }).then(function (_ref8) {
43002
42998
  var objectUrl = _ref8.objectUrl;
@@ -43027,7 +43023,7 @@ var Attachment = function Attachment(_ref) {
43027
43023
  total: progress.total || 0
43028
43024
  });
43029
43025
  setProgress(uploadPercent);
43030
- }, messageType).then(function (url) {
43026
+ }, messageType, attachment.messageId).then(function (url) {
43031
43027
  try {
43032
43028
  var _temp20 = function _temp20() {
43033
43029
  setAttachmentUrl(downloadingUrl);
@@ -45138,6 +45134,7 @@ var SliderPopup = function SliderPopup(_ref) {
45138
45134
  cacheKey: attachmentKey,
45139
45135
  kind: kind,
45140
45136
  messageType: messageType,
45137
+ messageId: currentFile === null || currentFile === void 0 ? void 0 : currentFile.messageId,
45141
45138
  size: Number(currentFileSize) || 0
45142
45139
  }).then(function (_ref3) {
45143
45140
  var objectUrl = _ref3.objectUrl;
@@ -62846,6 +62843,7 @@ var startMediaVideoDownload = function startMediaVideoDownload(file) {
62846
62843
  url: file.url,
62847
62844
  cacheKey: originalVideo,
62848
62845
  kind: 'original-video',
62846
+ messageId: file.messageId,
62849
62847
  size: Number(file.size) || 0
62850
62848
  });
62851
62849
  };
@@ -63656,6 +63654,7 @@ var VoiceItem = function VoiceItem(_ref) {
63656
63654
  cacheKey: file.url,
63657
63655
  kind: 'voice',
63658
63656
  messageType: messageType,
63657
+ messageId: file.messageId,
63659
63658
  size: Number(file.size) || 0
63660
63659
  });
63661
63660
  }).then(function (result) {
package/index.modern.js CHANGED
@@ -11362,7 +11362,7 @@ var downloadFile = function downloadFile(attachment, download, done, progressCal
11362
11362
  if (progressCallback) {
11363
11363
  progressCallback(progress);
11364
11364
  }
11365
- }, messageType);
11365
+ }, messageType, attachment.messageId);
11366
11366
  filesPromisesOnDownload[attachment.id] = urlPromise;
11367
11367
  return Promise.resolve(urlPromise).then(function (result) {
11368
11368
  FileSaver.saveAs(result.Body, attachment.name);
@@ -17735,7 +17735,7 @@ var download = function download(request, job) {
17735
17735
  if (customDownloader) {
17736
17736
  var _request$customDownlo;
17737
17737
  var requestBlob = (_request$customDownlo = request.customDownload) != null ? _request$customDownlo : true;
17738
- var customRequest = customDownloader(request.url, requestBlob, reportProgress, request.messageType);
17738
+ var customRequest = customDownloader(request.url, requestBlob, reportProgress, request.messageType, request.messageId);
17739
17739
  job.customRequest = customRequest;
17740
17740
  return Promise.resolve(customRequest).then(function (result) {
17741
17741
  var body = (result === null || result === void 0 ? void 0 : result.Body) || result;
@@ -17934,7 +17934,7 @@ var getVideoAttachmentCacheKeys = function getVideoAttachmentCacheKeys(videoUrl,
17934
17934
  originalVideo: videoUrl + "_original_video_url"
17935
17935
  };
17936
17936
  };
17937
- var downloadVideoThumb = function downloadVideoThumb(videoThumb, downloader, messageType) {
17937
+ var downloadVideoThumb = function downloadVideoThumb(videoThumb, downloader, messageType, messageId) {
17938
17938
  try {
17939
17939
  return Promise.resolve(getAttachmentUrlFromCache(videoThumb)["catch"](function () {
17940
17940
  return false;
@@ -17945,6 +17945,7 @@ var downloadVideoThumb = function downloadVideoThumb(videoThumb, downloader, mes
17945
17945
  cacheKey: videoThumb,
17946
17946
  kind: 'video-thumbnail',
17947
17947
  messageType: messageType,
17948
+ messageId: messageId,
17948
17949
  downloader: downloader,
17949
17950
  customDownload: true,
17950
17951
  skipCacheLookup: true
@@ -41999,7 +42000,7 @@ var VideoPreview = /*#__PURE__*/memo(function VideoPreview(_ref) {
41999
42000
  useEffect(function () {
42000
42001
  if (!videoThumb || downloadedPreviewImage) return;
42001
42002
  var cancelled = false;
42002
- downloadVideoThumb(videoThumb, getCustomDownloader(), messageType).then(function (localPreviewUrl) {
42003
+ downloadVideoThumb(videoThumb, getCustomDownloader(), messageType, file.messageId).then(function (localPreviewUrl) {
42003
42004
  if (!cancelled) {
42004
42005
  dispatch(setUpdateMessageAttachmentAC(videoThumb, localPreviewUrl));
42005
42006
  }
@@ -42435,18 +42436,8 @@ var Attachment = function Attachment(_ref) {
42435
42436
  e.stopPropagation();
42436
42437
  if (downloadIsCancelled) {
42437
42438
  setDownloadIsCancelled(false);
42438
- if (customDownloader) {
42439
- customDownloader(attachment.url, false, function (progress) {
42440
- var loadedRes = progress.loaded && progress.loaded / progress.total;
42441
- var uploadPercent = loadedRes && loadedRes * 100;
42442
- setSizeProgress({
42443
- loaded: progress.loaded || 0,
42444
- total: progress.total || 0
42445
- });
42446
- setProgress(uploadPercent);
42447
- }, messageType).then(function (url) {
42448
- downloadImage(url);
42449
- });
42439
+ if (getCustomUploader()) {
42440
+ handleResumeOriginalImageDownload(e);
42450
42441
  } else {
42451
42442
  downloadImage(attachment.url);
42452
42443
  }
@@ -42536,7 +42527,7 @@ var Attachment = function Attachment(_ref) {
42536
42527
  total: progress.total || 0
42537
42528
  });
42538
42529
  setProgress(uploadPercent);
42539
- }, messageType);
42530
+ }, messageType, attachment.messageId);
42540
42531
  setDownloadFilePromise(attachment.id, urlPromise);
42541
42532
  return Promise.resolve(urlPromise).then(function (result) {
42542
42533
  function _temp8(body) {
@@ -42783,6 +42774,7 @@ var Attachment = function Attachment(_ref) {
42783
42774
  cacheKey: originalVideoCacheKey,
42784
42775
  kind: 'original-video',
42785
42776
  messageType: messageType,
42777
+ messageId: attachment.messageId,
42786
42778
  size: Number(attachment.size) || 0
42787
42779
  }).then(function (_ref4) {
42788
42780
  var objectUrl = _ref4.objectUrl;
@@ -42845,6 +42837,7 @@ var Attachment = function Attachment(_ref) {
42845
42837
  cacheKey: originalVideoCacheKey,
42846
42838
  kind: 'original-video',
42847
42839
  messageType: messageType,
42840
+ messageId: attachment.messageId,
42848
42841
  size: Number(attachment.size) || 0
42849
42842
  }).then(function (_ref5) {
42850
42843
  var objectUrl = _ref5.objectUrl;
@@ -42878,6 +42871,7 @@ var Attachment = function Attachment(_ref) {
42878
42871
  cacheKeys: [attachment.url + '_original_image_url'],
42879
42872
  kind: 'original-image',
42880
42873
  messageType: messageType,
42874
+ messageId: attachment.messageId,
42881
42875
  size: Number(attachment.size) || 0
42882
42876
  }).then(function (_ref6) {
42883
42877
  var objectUrl = _ref6.objectUrl;
@@ -42939,6 +42933,7 @@ var Attachment = function Attachment(_ref) {
42939
42933
  cacheKeys: [attachment.url + '_original_image_url'],
42940
42934
  kind: 'original-image',
42941
42935
  messageType: messageType,
42936
+ messageId: attachment.messageId,
42942
42937
  size: Number(attachment.size) || 0
42943
42938
  }).then(function (_ref7) {
42944
42939
  var objectUrl = _ref7.objectUrl;
@@ -42978,6 +42973,7 @@ var Attachment = function Attachment(_ref) {
42978
42973
  cacheKey: attachment.url,
42979
42974
  kind: kind,
42980
42975
  messageType: messageType,
42976
+ messageId: attachment.messageId,
42981
42977
  size: Number(attachment.size) || 0
42982
42978
  }).then(function (_ref8) {
42983
42979
  var objectUrl = _ref8.objectUrl;
@@ -43008,7 +43004,7 @@ var Attachment = function Attachment(_ref) {
43008
43004
  total: progress.total || 0
43009
43005
  });
43010
43006
  setProgress(uploadPercent);
43011
- }, messageType).then(function (url) {
43007
+ }, messageType, attachment.messageId).then(function (url) {
43012
43008
  try {
43013
43009
  var _temp20 = function _temp20() {
43014
43010
  setAttachmentUrl(downloadingUrl);
@@ -45119,6 +45115,7 @@ var SliderPopup = function SliderPopup(_ref) {
45119
45115
  cacheKey: attachmentKey,
45120
45116
  kind: kind,
45121
45117
  messageType: messageType,
45118
+ messageId: currentFile === null || currentFile === void 0 ? void 0 : currentFile.messageId,
45122
45119
  size: Number(currentFileSize) || 0
45123
45120
  }).then(function (_ref3) {
45124
45121
  var objectUrl = _ref3.objectUrl;
@@ -62827,6 +62824,7 @@ var startMediaVideoDownload = function startMediaVideoDownload(file) {
62827
62824
  url: file.url,
62828
62825
  cacheKey: originalVideo,
62829
62826
  kind: 'original-video',
62827
+ messageId: file.messageId,
62830
62828
  size: Number(file.size) || 0
62831
62829
  });
62832
62830
  };
@@ -63637,6 +63635,7 @@ var VoiceItem = function VoiceItem(_ref) {
63637
63635
  cacheKey: file.url,
63638
63636
  kind: 'voice',
63639
63637
  messageType: messageType,
63638
+ messageId: file.messageId,
63640
63639
  size: Number(file.size) || 0
63641
63640
  });
63642
63641
  }).then(function (result) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sceyt-chat-react-uikit",
3
- "version": "1.9.2-beta.1",
3
+ "version": "1.9.2-beta.2",
4
4
  "description": "Interactive React UI Components for Sceyt Chat.",
5
5
  "author": "Sceyt",
6
6
  "license": "MIT",