@tap-payments/auth-jsconnect 2.3.5-test → 2.3.6-test

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.
@@ -45,7 +45,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
45
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
46
  }
47
47
  };
48
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
48
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
49
49
  import React from 'react';
50
50
  import { useTranslation } from 'react-i18next';
51
51
  import { alpha, styled, useTheme } from '@mui/material/styles';
@@ -194,6 +194,8 @@ var UploadFile = function (_a) {
194
194
  return __generator(this, function (_b) {
195
195
  switch (_b.label) {
196
196
  case 0:
197
+ uploadedFile = __assign(__assign({}, uploadedFile), { progress: 0, status: FileStatus.DOWNLOADING });
198
+ onProgress(index, uploadedFile);
197
199
  onDownloadProgress = function (progressEvent) {
198
200
  var progress = ((progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.loaded) / (progressEvent === null || progressEvent === void 0 ? void 0 : progressEvent.total)) * 100;
199
201
  uploadedFile = __assign(__assign({}, uploadedFile), { progress: Math.floor(progress), status: FileStatus.DOWNLOADING });
@@ -227,6 +229,17 @@ var UploadFile = function (_a) {
227
229
  }
228
230
  onDelete(index);
229
231
  };
232
+ var getProgressComponent = function () {
233
+ if (status === FileStatus.ERROR)
234
+ return _jsx(ErrorIconStyled, { src: ICONS_NAMES.ERROR_ICON });
235
+ if (status === FileStatus.SUCCESS)
236
+ return _jsx(CheckIcon, {});
237
+ if (status === FileStatus.DOWNLOADING && !progress)
238
+ return _jsx(MUICircularProgress, { size: 25, thickness: 5 });
239
+ if (progress)
240
+ return (_jsx(CircularProgress, { sx: { backgroundColor: alpha(theme.palette.primary.main, 0.05), borderRadius: '32px' }, textSx: { fontSize: theme.spacing(1.125) }, value: progress, size: 35 }));
241
+ return _jsx(_Fragment, {});
242
+ };
230
243
  React.useEffect(function () {
231
244
  if (!file)
232
245
  return;
@@ -254,6 +267,6 @@ var UploadFile = function (_a) {
254
267
  flexDirection: 'column',
255
268
  padding: theme.spacing(1.5, 0, 1.5),
256
269
  width: '100%'
257
- } }, { children: [_jsxs(Box, __assign({ sx: { display: 'flex', flexDirection: 'row', cursor: canDownloadFile ? 'pointer' : 'auto' }, onClick: canDownloadFile ? function () { return downloadFile(); } : undefined }, { children: [_jsx(Icon, { src: ICONS_NAMES.DOC_ICON }), _jsx(Text, { children: maskFileName(name) })] })), _jsx(Box, __assign({ sx: { display: 'flex', flexDirection: 'row', justifyContent: 'center' } }, { children: _jsx(Collapse, __assign({ in: !!error, timeout: 400 }, { children: _jsxs(WarningContainer, { children: [_jsx(WarningIconStyled, { src: ICONS_NAMES.WARNING_ICON }), _jsx(Text, { children: t(error) })] }) })) }))] })), _jsx(ProgressBoxStyled, { children: status === FileStatus.ERROR ? (_jsx(ErrorIconStyled, { src: ICONS_NAMES.ERROR_ICON })) : status === FileStatus.SUCCESS ? (_jsx(CheckIcon, {})) : progress ? (_jsx(CircularProgress, { sx: { backgroundColor: alpha(theme.palette.primary.main, 0.05), borderRadius: '32px' }, textSx: { fontSize: theme.spacing(1.125) }, value: progress, size: 35 })) : (_jsx(_Fragment, {})) })] }), _jsx(UploadBoxStyled, __assign({ uploading: status === FileStatus.UPLOADING, onClick: status === FileStatus.UPLOADING || deleteStatus === DeleteFileStatus.DELETING ? undefined : function () { return handleDeleteFile(index); } }, { children: deleteStatus === DeleteFileStatus.DELETING ? (_jsx(MUICircularProgress, { size: 25, thickness: 5, sx: { color: theme.palette.common.white } })) : (_jsx(ClearIconStyled, {})) }))] })) }, index));
270
+ } }, { children: [_jsxs(Box, __assign({ sx: { display: 'flex', flexDirection: 'row', cursor: canDownloadFile ? 'pointer' : 'auto' }, onClick: canDownloadFile ? function () { return downloadFile(); } : undefined }, { children: [_jsx(Icon, { src: ICONS_NAMES.DOC_ICON }), _jsx(Text, { children: maskFileName(name) })] })), _jsx(Box, __assign({ sx: { display: 'flex', flexDirection: 'row', justifyContent: 'center' } }, { children: _jsx(Collapse, __assign({ in: !!error, timeout: 400 }, { children: _jsxs(WarningContainer, { children: [_jsx(WarningIconStyled, { src: ICONS_NAMES.WARNING_ICON }), _jsx(Text, { children: t(error) })] }) })) }))] })), _jsx(ProgressBoxStyled, { children: getProgressComponent() })] }), _jsx(UploadBoxStyled, __assign({ uploading: status === FileStatus.UPLOADING, onClick: status === FileStatus.UPLOADING || deleteStatus === DeleteFileStatus.DELETING ? undefined : function () { return handleDeleteFile(index); } }, { children: deleteStatus === DeleteFileStatus.DELETING ? (_jsx(MUICircularProgress, { size: 25, thickness: 5, sx: { color: theme.palette.common.white } })) : (_jsx(ClearIconStyled, {})) }))] })) }, index));
258
271
  };
259
272
  export default UploadFile;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.3.5-test",
3
+ "version": "2.3.6-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",