sceyt-chat-react-uikit 1.9.2-beta.3 → 1.9.2-beta.4
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 +27 -13
- package/index.modern.js +27 -13
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -42353,18 +42353,22 @@ var Attachment = function Attachment(_ref) {
|
|
|
42353
42353
|
var _useState8 = React.useState(false),
|
|
42354
42354
|
downloadIsCancelled = _useState8[0],
|
|
42355
42355
|
setDownloadIsCancelled = _useState8[1];
|
|
42356
|
-
var _useState9 = React.useState(
|
|
42357
|
-
|
|
42358
|
-
|
|
42356
|
+
var _useState9 = React.useState(false),
|
|
42357
|
+
fileDownloadFailed = _useState9[0],
|
|
42358
|
+
setFileDownloadFailed = _useState9[1];
|
|
42359
|
+
var fileDownloadCancelledRef = React.useRef(false);
|
|
42359
42360
|
var _useState0 = React.useState(0),
|
|
42360
|
-
|
|
42361
|
-
|
|
42362
|
-
var _useState1 = React.useState(
|
|
42363
|
-
|
|
42364
|
-
|
|
42361
|
+
videoDownloadRetry = _useState0[0],
|
|
42362
|
+
setVideoDownloadRetry = _useState0[1];
|
|
42363
|
+
var _useState1 = React.useState(0),
|
|
42364
|
+
imageDownloadRetry = _useState1[0],
|
|
42365
|
+
setImageDownloadRetry = _useState1[1];
|
|
42365
42366
|
var _useState10 = React.useState(false),
|
|
42366
|
-
|
|
42367
|
-
|
|
42367
|
+
isOriginalImageRestarting = _useState10[0],
|
|
42368
|
+
setIsOriginalImageRestarting = _useState10[1];
|
|
42369
|
+
var _useState11 = React.useState(false),
|
|
42370
|
+
isOriginalVideoRestarting = _useState11[0],
|
|
42371
|
+
setIsOriginalVideoRestarting = _useState11[1];
|
|
42368
42372
|
var originalVideoDownloadStartedRef = React.useRef(false);
|
|
42369
42373
|
var videoDownloadRequestRef = React.useRef(0);
|
|
42370
42374
|
var imageDownloadRequestRef = React.useRef(0);
|
|
@@ -42400,7 +42404,8 @@ var Attachment = function Attachment(_ref) {
|
|
|
42400
42404
|
var isPreparingVideo = attachmentCompilationState[attachment.tid] === UPLOAD_STATE.PREPARING;
|
|
42401
42405
|
var isSharedOriginalVideoDownloading = sharedOriginalVideoDownload.state === 'loading';
|
|
42402
42406
|
var isSharedOriginalVideoCancelled = sharedOriginalVideoDownload.state === 'cancelled';
|
|
42403
|
-
var
|
|
42407
|
+
var isSharedOriginalVideoFailed = sharedOriginalVideoDownload.state === 'failed';
|
|
42408
|
+
var shouldShowVideoDownloadRetry = !isSharedOriginalVideoDownloading && !isOriginalVideoRestarting && (isSharedOriginalVideoCancelled || isSharedOriginalVideoFailed || !originalVideoDownloadKey && downloadIsCancelled);
|
|
42404
42409
|
var isVideoDownloading = downloadingFile || isSharedOriginalVideoDownloading;
|
|
42405
42410
|
var isVideoDownloadActive = isVideoDownloading || isOriginalVideoRestarting;
|
|
42406
42411
|
var shouldRenderVideoDownloadProgress = Boolean(!isRepliedMessage && !isPreview && (isInUploadingState || isVideoDownloadActive));
|
|
@@ -42490,9 +42495,10 @@ var Attachment = function Attachment(_ref) {
|
|
|
42490
42495
|
closeMessageActions(enter);
|
|
42491
42496
|
}
|
|
42492
42497
|
};
|
|
42493
|
-
var handleCompleteDownload = function handleCompleteDownload(attachmentId) {
|
|
42498
|
+
var handleCompleteDownload = function handleCompleteDownload(attachmentId, failed) {
|
|
42494
42499
|
if (attachmentId === attachment.id) {
|
|
42495
42500
|
setDownloadingFile(false);
|
|
42501
|
+
setFileDownloadFailed(!!failed && !fileDownloadCancelledRef.current);
|
|
42496
42502
|
}
|
|
42497
42503
|
};
|
|
42498
42504
|
var handleStopStartDownloadFile = function handleStopStartDownloadFile(att) {
|
|
@@ -42506,6 +42512,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
42506
42512
|
}
|
|
42507
42513
|
} else {
|
|
42508
42514
|
setDownloadIsCancelled(true);
|
|
42515
|
+
fileDownloadCancelledRef.current = true;
|
|
42509
42516
|
var attachmentId = att ? att.id : attachment.id;
|
|
42510
42517
|
cancelDownloadFile(attachmentId || '');
|
|
42511
42518
|
}
|
|
@@ -42522,6 +42529,8 @@ var Attachment = function Attachment(_ref) {
|
|
|
42522
42529
|
var handleDownloadFileToDevice = function handleDownloadFileToDevice(attachment) {
|
|
42523
42530
|
setDownloadingFile(true);
|
|
42524
42531
|
setDownloadIsCancelled(false);
|
|
42532
|
+
setFileDownloadFailed(false);
|
|
42533
|
+
fileDownloadCancelledRef.current = false;
|
|
42525
42534
|
downloadFile(attachment, true, handleCompleteDownload, function (progress) {
|
|
42526
42535
|
var loadedRes = progress.loaded && progress.loaded / progress.total;
|
|
42527
42536
|
var uploadPercent = loadedRes && loadedRes * 100;
|
|
@@ -43402,6 +43411,9 @@ var Attachment = function Attachment(_ref) {
|
|
|
43402
43411
|
})) : isPreview && attachment.attachmentUrl ? (/*#__PURE__*/React__default.createElement(FileThumbnail, {
|
|
43403
43412
|
src: attachment.attachmentUrl || attachmentUrl
|
|
43404
43413
|
})) : attachmentCompilationState[attachment.tid] !== UPLOAD_STATE.UPLOADING && attachmentCompilationState[attachment.tid] !== UPLOAD_STATE.PAUSED && (selectedFileAttachmentsIcon || /*#__PURE__*/React__default.createElement(SvgFileIcon, null)))), !isRepliedMessage && !isPreview && (/*#__PURE__*/React__default.createElement(DownloadFile$1, {
|
|
43414
|
+
role: 'button',
|
|
43415
|
+
"aria-label": fileDownloadFailed ? 'Download failed, retry' : 'Download file',
|
|
43416
|
+
visible: fileDownloadFailed && !downloadingFile,
|
|
43405
43417
|
widthThumb: !!attachmentThumb,
|
|
43406
43418
|
backgroundColor: attachmentThumb ? overlayBackground2 : accentColor,
|
|
43407
43419
|
onClick: function onClick() {
|
|
@@ -43497,7 +43509,9 @@ var FileThumbnailSkeleton = styled__default.div(_templateObject5$h || (_template
|
|
|
43497
43509
|
}, function (props) {
|
|
43498
43510
|
return props.color;
|
|
43499
43511
|
}, fileThumbnailShimmer);
|
|
43500
|
-
var DownloadFile$1 = styled__default.span(_templateObject6$c || (_templateObject6$c = _taggedTemplateLiteralLoose(["\n display:
|
|
43512
|
+
var DownloadFile$1 = styled__default.span(_templateObject6$c || (_templateObject6$c = _taggedTemplateLiteralLoose(["\n display: ", ";\n align-items: center;\n justify-content: center;\n cursor: pointer;\n background-color: ", ";\n min-width: 40px;\n max-width: 40px;\n height: 40px;\n position: ", ";\n border-radius: ", ";\n\n & > svg {\n width: 20px;\n height: 20px;\n }\n"])), function (props) {
|
|
43513
|
+
return props.visible ? 'flex' : 'none';
|
|
43514
|
+
}, function (props) {
|
|
43501
43515
|
return props.backgroundColor;
|
|
43502
43516
|
}, function (props) {
|
|
43503
43517
|
return props.widthThumb && 'absolute';
|
package/index.modern.js
CHANGED
|
@@ -42334,18 +42334,22 @@ var Attachment = function Attachment(_ref) {
|
|
|
42334
42334
|
var _useState8 = useState(false),
|
|
42335
42335
|
downloadIsCancelled = _useState8[0],
|
|
42336
42336
|
setDownloadIsCancelled = _useState8[1];
|
|
42337
|
-
var _useState9 = useState(
|
|
42338
|
-
|
|
42339
|
-
|
|
42337
|
+
var _useState9 = useState(false),
|
|
42338
|
+
fileDownloadFailed = _useState9[0],
|
|
42339
|
+
setFileDownloadFailed = _useState9[1];
|
|
42340
|
+
var fileDownloadCancelledRef = useRef(false);
|
|
42340
42341
|
var _useState0 = useState(0),
|
|
42341
|
-
|
|
42342
|
-
|
|
42343
|
-
var _useState1 = useState(
|
|
42344
|
-
|
|
42345
|
-
|
|
42342
|
+
videoDownloadRetry = _useState0[0],
|
|
42343
|
+
setVideoDownloadRetry = _useState0[1];
|
|
42344
|
+
var _useState1 = useState(0),
|
|
42345
|
+
imageDownloadRetry = _useState1[0],
|
|
42346
|
+
setImageDownloadRetry = _useState1[1];
|
|
42346
42347
|
var _useState10 = useState(false),
|
|
42347
|
-
|
|
42348
|
-
|
|
42348
|
+
isOriginalImageRestarting = _useState10[0],
|
|
42349
|
+
setIsOriginalImageRestarting = _useState10[1];
|
|
42350
|
+
var _useState11 = useState(false),
|
|
42351
|
+
isOriginalVideoRestarting = _useState11[0],
|
|
42352
|
+
setIsOriginalVideoRestarting = _useState11[1];
|
|
42349
42353
|
var originalVideoDownloadStartedRef = useRef(false);
|
|
42350
42354
|
var videoDownloadRequestRef = useRef(0);
|
|
42351
42355
|
var imageDownloadRequestRef = useRef(0);
|
|
@@ -42381,7 +42385,8 @@ var Attachment = function Attachment(_ref) {
|
|
|
42381
42385
|
var isPreparingVideo = attachmentCompilationState[attachment.tid] === UPLOAD_STATE.PREPARING;
|
|
42382
42386
|
var isSharedOriginalVideoDownloading = sharedOriginalVideoDownload.state === 'loading';
|
|
42383
42387
|
var isSharedOriginalVideoCancelled = sharedOriginalVideoDownload.state === 'cancelled';
|
|
42384
|
-
var
|
|
42388
|
+
var isSharedOriginalVideoFailed = sharedOriginalVideoDownload.state === 'failed';
|
|
42389
|
+
var shouldShowVideoDownloadRetry = !isSharedOriginalVideoDownloading && !isOriginalVideoRestarting && (isSharedOriginalVideoCancelled || isSharedOriginalVideoFailed || !originalVideoDownloadKey && downloadIsCancelled);
|
|
42385
42390
|
var isVideoDownloading = downloadingFile || isSharedOriginalVideoDownloading;
|
|
42386
42391
|
var isVideoDownloadActive = isVideoDownloading || isOriginalVideoRestarting;
|
|
42387
42392
|
var shouldRenderVideoDownloadProgress = Boolean(!isRepliedMessage && !isPreview && (isInUploadingState || isVideoDownloadActive));
|
|
@@ -42471,9 +42476,10 @@ var Attachment = function Attachment(_ref) {
|
|
|
42471
42476
|
closeMessageActions(enter);
|
|
42472
42477
|
}
|
|
42473
42478
|
};
|
|
42474
|
-
var handleCompleteDownload = function handleCompleteDownload(attachmentId) {
|
|
42479
|
+
var handleCompleteDownload = function handleCompleteDownload(attachmentId, failed) {
|
|
42475
42480
|
if (attachmentId === attachment.id) {
|
|
42476
42481
|
setDownloadingFile(false);
|
|
42482
|
+
setFileDownloadFailed(!!failed && !fileDownloadCancelledRef.current);
|
|
42477
42483
|
}
|
|
42478
42484
|
};
|
|
42479
42485
|
var handleStopStartDownloadFile = function handleStopStartDownloadFile(att) {
|
|
@@ -42487,6 +42493,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
42487
42493
|
}
|
|
42488
42494
|
} else {
|
|
42489
42495
|
setDownloadIsCancelled(true);
|
|
42496
|
+
fileDownloadCancelledRef.current = true;
|
|
42490
42497
|
var attachmentId = att ? att.id : attachment.id;
|
|
42491
42498
|
cancelDownloadFile(attachmentId || '');
|
|
42492
42499
|
}
|
|
@@ -42503,6 +42510,8 @@ var Attachment = function Attachment(_ref) {
|
|
|
42503
42510
|
var handleDownloadFileToDevice = function handleDownloadFileToDevice(attachment) {
|
|
42504
42511
|
setDownloadingFile(true);
|
|
42505
42512
|
setDownloadIsCancelled(false);
|
|
42513
|
+
setFileDownloadFailed(false);
|
|
42514
|
+
fileDownloadCancelledRef.current = false;
|
|
42506
42515
|
downloadFile(attachment, true, handleCompleteDownload, function (progress) {
|
|
42507
42516
|
var loadedRes = progress.loaded && progress.loaded / progress.total;
|
|
42508
42517
|
var uploadPercent = loadedRes && loadedRes * 100;
|
|
@@ -43383,6 +43392,9 @@ var Attachment = function Attachment(_ref) {
|
|
|
43383
43392
|
})) : isPreview && attachment.attachmentUrl ? (/*#__PURE__*/React__default.createElement(FileThumbnail, {
|
|
43384
43393
|
src: attachment.attachmentUrl || attachmentUrl
|
|
43385
43394
|
})) : attachmentCompilationState[attachment.tid] !== UPLOAD_STATE.UPLOADING && attachmentCompilationState[attachment.tid] !== UPLOAD_STATE.PAUSED && (selectedFileAttachmentsIcon || /*#__PURE__*/React__default.createElement(SvgFileIcon, null)))), !isRepliedMessage && !isPreview && (/*#__PURE__*/React__default.createElement(DownloadFile$1, {
|
|
43395
|
+
role: 'button',
|
|
43396
|
+
"aria-label": fileDownloadFailed ? 'Download failed, retry' : 'Download file',
|
|
43397
|
+
visible: fileDownloadFailed && !downloadingFile,
|
|
43386
43398
|
widthThumb: !!attachmentThumb,
|
|
43387
43399
|
backgroundColor: attachmentThumb ? overlayBackground2 : accentColor,
|
|
43388
43400
|
onClick: function onClick() {
|
|
@@ -43478,7 +43490,9 @@ var FileThumbnailSkeleton = styled.div(_templateObject5$h || (_templateObject5$h
|
|
|
43478
43490
|
}, function (props) {
|
|
43479
43491
|
return props.color;
|
|
43480
43492
|
}, fileThumbnailShimmer);
|
|
43481
|
-
var DownloadFile$1 = styled.span(_templateObject6$c || (_templateObject6$c = _taggedTemplateLiteralLoose(["\n display:
|
|
43493
|
+
var DownloadFile$1 = styled.span(_templateObject6$c || (_templateObject6$c = _taggedTemplateLiteralLoose(["\n display: ", ";\n align-items: center;\n justify-content: center;\n cursor: pointer;\n background-color: ", ";\n min-width: 40px;\n max-width: 40px;\n height: 40px;\n position: ", ";\n border-radius: ", ";\n\n & > svg {\n width: 20px;\n height: 20px;\n }\n"])), function (props) {
|
|
43494
|
+
return props.visible ? 'flex' : 'none';
|
|
43495
|
+
}, function (props) {
|
|
43482
43496
|
return props.backgroundColor;
|
|
43483
43497
|
}, function (props) {
|
|
43484
43498
|
return props.widthThumb && 'absolute';
|