@tap-payments/auth-jsconnect 2.3.26-test → 2.3.27-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.
- package/build/@types/app.d.ts +12 -1
- package/build/@types/app.js +1 -0
- package/build/@types/form.d.ts +2 -1
- package/build/app/settings.d.ts +3 -1
- package/build/app/settings.js +5 -1
- package/build/assets/locales/ar.json +3 -1
- package/build/assets/locales/en.json +3 -1
- package/build/constants/app.d.ts +2 -1
- package/build/constants/app.js +1 -0
- package/build/constants/validation.d.ts +1 -0
- package/build/constants/validation.js +1 -0
- package/build/features/app/brand/brandStore.d.ts +5 -2
- package/build/features/app/brand/brandStore.js +12 -3
- package/build/features/bank/screens/BankDetails/BankDetails.js +18 -4
- package/build/features/bank/screens/BankDetails/BankName.d.ts +4 -1
- package/build/features/bank/screens/BankDetails/BankName.js +8 -7
- package/build/features/bank/screens/BankDetails/BankStatement.d.ts +4 -1
- package/build/features/bank/screens/BankDetails/BankStatement.js +3 -8
- package/build/features/bank/screens/BankDetails/Beneficiary.d.ts +2 -1
- package/build/features/bank/screens/BankDetails/Beneficiary.js +8 -7
- package/build/features/bank/screens/BankDetails/ConfirmPolicy.d.ts +4 -1
- package/build/features/bank/screens/BankDetails/ConfirmPolicy.js +6 -3
- package/build/features/bank/screens/BankDetails/IBAN.d.ts +2 -1
- package/build/features/bank/screens/BankDetails/IBAN.js +2 -2
- package/build/features/brand/screens/BrandActivities/ActivitiesList.d.ts +3 -1
- package/build/features/brand/screens/BrandActivities/ActivitiesList.js +11 -6
- package/build/features/brand/screens/BrandActivities/BrandActivities.js +3 -1
- package/build/features/brand/screens/BrandActivities/CustomerBase.d.ts +2 -1
- package/build/features/brand/screens/BrandActivities/CustomerBase.js +12 -9
- package/build/features/brand/screens/BrandActivities/ExpectedCustomers.d.ts +2 -1
- package/build/features/brand/screens/BrandActivities/ExpectedCustomers.js +10 -7
- package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.d.ts +2 -1
- package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +9 -6
- package/build/features/brand/screens/BrandActivities/RefundPolicy.d.ts +4 -1
- package/build/features/brand/screens/BrandActivities/RefundPolicy.js +7 -4
- package/build/features/brand/screens/BrandActivities/TAC.d.ts +2 -1
- package/build/features/brand/screens/BrandActivities/TAC.js +3 -1
- package/build/features/brand/screens/BrandActivities/TransactionPolicy.d.ts +4 -1
- package/build/features/brand/screens/BrandActivities/TransactionPolicy.js +7 -4
- package/build/features/brand/screens/BrandInfo/BrandInfo.js +14 -9
- package/build/features/brand/screens/BrandInfo/BrandLogo.d.ts +9 -0
- package/build/features/brand/screens/BrandInfo/BrandLogo.js +52 -0
- package/build/features/brand/screens/BrandInfo/BrandName.d.ts +2 -1
- package/build/features/brand/screens/BrandInfo/BrandName.js +2 -2
- package/build/features/brand/screens/BrandInfo/SalesChannels.d.ts +2 -1
- package/build/features/brand/screens/BrandInfo/SalesChannels.js +2 -1
- package/build/features/brand/screens/BrandInfo/Segments.d.ts +2 -1
- package/build/features/brand/screens/BrandInfo/Segments.js +3 -1
- package/build/features/brand/screens/BrandInfo/TeamSize.d.ts +2 -1
- package/build/features/brand/screens/BrandInfo/TeamSize.js +3 -1
- package/build/features/brand/screens/BrandInfo/validation.d.ts +3 -0
- package/build/features/brand/screens/BrandInfo/validation.js +1 -0
- package/build/features/entity/screens/EntityCapital/ActivityList.d.ts +2 -1
- package/build/features/entity/screens/EntityCapital/ActivityList.js +12 -22
- package/build/features/entity/screens/EntityCapital/CapitalPaid.d.ts +2 -1
- package/build/features/entity/screens/EntityCapital/CapitalPaid.js +2 -1
- package/build/features/entity/screens/EntityCapital/CapitalShareCount.d.ts +2 -1
- package/build/features/entity/screens/EntityCapital/CapitalShareCount.js +2 -1
- package/build/features/entity/screens/EntityCapital/CapitalShareValue.d.ts +2 -1
- package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +2 -1
- package/build/features/entity/screens/EntityCapital/EntityCapital.js +3 -1
- package/build/features/entity/screens/EntityName/Article.d.ts +4 -1
- package/build/features/entity/screens/EntityName/Article.js +3 -4
- package/build/features/entity/screens/EntityName/EntityName.js +6 -3
- package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +2 -1
- package/build/features/entity/screens/EntityName/EntityTypeList.js +9 -19
- package/build/features/entity/screens/EntityName/ExpiryDate.d.ts +2 -1
- package/build/features/entity/screens/EntityName/ExpiryDate.js +2 -2
- package/build/features/entity/screens/EntityName/IssuingDate.d.ts +2 -1
- package/build/features/entity/screens/EntityName/IssuingDate.js +2 -2
- package/build/features/entity/screens/EntityName/LegalName.d.ts +2 -1
- package/build/features/entity/screens/EntityName/LegalName.js +2 -1
- package/build/features/entity/screens/EntityName/LicenseCertificate.d.ts +4 -1
- package/build/features/entity/screens/EntityName/LicenseCertificate.js +3 -8
- package/build/features/entity/screens/EntityName/LicenseNumber.d.ts +2 -1
- package/build/features/entity/screens/EntityName/LicenseNumber.js +2 -2
- package/build/features/entity/screens/EntityName/UnifiedNumber.d.ts +2 -1
- package/build/features/entity/screens/EntityName/UnifiedNumber.js +2 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +5 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.d.ts +6 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.js +3 -8
- package/build/features/individual/screens/AdditionalIndividualInfo/InfluencerSwitch.d.ts +2 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/InfluencerSwitch.js +3 -4
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.d.ts +2 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +11 -22
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.d.ts +2 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +12 -23
- package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.d.ts +2 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.js +3 -4
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareCount.d.ts +2 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareCount.js +2 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.d.ts +2 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +2 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.d.ts +4 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.js +3 -8
- package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.d.ts +2 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +12 -23
- package/build/features/individual/screens/IndividualList/MobileNumber.js +0 -1
- package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.d.ts +1 -0
- package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.js +3 -1
- package/build/features/individual/screens/IndividualPersonalInfo/BirthCountry.d.ts +1 -0
- package/build/features/individual/screens/IndividualPersonalInfo/BirthCountry.js +3 -1
- package/build/features/individual/screens/IndividualPersonalInfo/DOB.d.ts +2 -1
- package/build/features/individual/screens/IndividualPersonalInfo/DOB.js +2 -2
- package/build/features/individual/screens/IndividualPersonalInfo/Email.d.ts +2 -1
- package/build/features/individual/screens/IndividualPersonalInfo/Email.js +2 -4
- package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.d.ts +2 -1
- package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.js +3 -4
- package/build/features/individual/screens/IndividualPersonalInfo/Gender.d.ts +2 -1
- package/build/features/individual/screens/IndividualPersonalInfo/Gender.js +3 -1
- package/build/features/individual/screens/IndividualPersonalInfo/ID.d.ts +2 -1
- package/build/features/individual/screens/IndividualPersonalInfo/ID.js +2 -7
- package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +3 -3
- package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.d.ts +1 -0
- package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.js +4 -6
- package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.d.ts +1 -0
- package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.js +2 -4
- package/build/features/individual/screens/IndividualPersonalInfo/Name.d.ts +2 -1
- package/build/features/individual/screens/IndividualPersonalInfo/Name.js +2 -2
- package/build/features/individual/screens/IndividualPersonalInfo/Nationality.d.ts +1 -0
- package/build/features/individual/screens/IndividualPersonalInfo/Nationality.js +4 -6
- package/build/features/individual/screens/IndividualPhoneInfo/MobileNumber.d.ts +1 -0
- package/build/features/individual/screens/IndividualPhoneInfo/MobileNumber.js +6 -3
- package/build/features/individual/screens/IndividualPhoneInfo/PhoneInfo.js +1 -1
- package/build/features/shared/SalesChannels/SaleChannelIconsInput.d.ts +2 -1
- package/build/features/shared/SalesChannels/SaleChannelIconsInput.js +3 -3
- package/build/features/shared/SalesChannels/SalesChannel.d.ts +2 -1
- package/build/features/shared/SalesChannels/SalesChannel.js +3 -3
- package/build/features/shared/UploadFile/FileUpload.d.ts +3 -1
- package/build/features/shared/UploadFile/FileUpload.js +14 -10
- package/build/features/shared/UploadFile/UploadWrapper.d.ts +3 -1
- package/build/features/shared/UploadFile/UploadWrapper.js +3 -2
- package/build/features/shared/UploadMultipleFile/UploadFile.d.ts +2 -1
- package/build/features/shared/UploadMultipleFile/UploadFile.js +9 -5
- package/build/features/shared/UploadMultipleFile/UploadMultipleFile.d.ts +2 -1
- package/build/features/shared/UploadMultipleFile/UploadMultipleFile.js +3 -3
- package/build/features/tax/screens/TaxDetails/ConfirmPolicy.d.ts +4 -1
- package/build/features/tax/screens/TaxDetails/ConfirmPolicy.js +6 -3
- package/build/features/tax/screens/TaxDetails/TaxDetails.js +4 -2
- package/build/features/tax/screens/TaxDetails/TaxDocument.d.ts +4 -1
- package/build/features/tax/screens/TaxDetails/TaxDocument.js +3 -8
- package/build/features/tax/screens/TaxDetails/VATId.d.ts +4 -1
- package/build/features/tax/screens/TaxDetails/VATId.js +5 -7
- package/build/hooks/index.d.ts +2 -0
- package/build/hooks/index.js +2 -0
- package/build/hooks/useAppConfig.d.ts +1 -1
- package/build/hooks/useAppConfig.js +4 -2
- package/build/hooks/useDataNoneEditable.d.ts +2 -0
- package/build/hooks/useDataNoneEditable.js +19 -0
- package/build/hooks/useFormReadOnly.d.ts +6 -0
- package/build/hooks/useFormReadOnly.js +38 -0
- package/build/utils/string.js +7 -8
- package/package.json +1 -1
- package/build/features/brand/screens/BrandActivities/OperationStartDate.d.ts +0 -20
- package/build/features/brand/screens/BrandActivities/OperationStartDate.js +0 -45
|
@@ -44,7 +44,7 @@ export var InputContainerStyled = styled(Box)(function () { return ({
|
|
|
44
44
|
justifyContent: 'center'
|
|
45
45
|
}); });
|
|
46
46
|
var UploadWrapper = function (_a) {
|
|
47
|
-
var id = _a.id, label = _a.label, control = _a.control, required = _a.required, fileRemoveType = _a.fileRemoveType, title = _a.title, subTitle = _a.subTitle, dragDescription = _a.dragDescription, uploadingTitle = _a.uploadingTitle, successTitle = _a.successTitle, isSubmitting = _a.isSubmitting, onFileUploaded = _a.onFileUploaded, fileUploadingStatus = _a.fileUploadingStatus, onDeleteFile = _a.onDeleteFile, purpose = _a.purpose, fileTitle = _a.fileTitle, defaultFile = _a.defaultFile;
|
|
47
|
+
var id = _a.id, label = _a.label, control = _a.control, required = _a.required, fileRemoveType = _a.fileRemoveType, title = _a.title, subTitle = _a.subTitle, dragDescription = _a.dragDescription, uploadingTitle = _a.uploadingTitle, successTitle = _a.successTitle, isSubmitting = _a.isSubmitting, onFileUploaded = _a.onFileUploaded, fileUploadingStatus = _a.fileUploadingStatus, onDeleteFile = _a.onDeleteFile, purpose = _a.purpose, fileTitle = _a.fileTitle, defaultFile = _a.defaultFile, validFileFormats = _a.validFileFormats, readOnly = _a.readOnly;
|
|
48
48
|
var t = useTranslation().t;
|
|
49
49
|
var _b = React.useState(''), error = _b[0], setError = _b[1];
|
|
50
50
|
var fileControl = useController({ name: "".concat(id, "File"), control: control });
|
|
@@ -109,6 +109,7 @@ var UploadWrapper = function (_a) {
|
|
|
109
109
|
};
|
|
110
110
|
var fileExists = !!fileInfo;
|
|
111
111
|
var showUploadedInputField = (fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.status) === FileStatus.SUCCESS || (fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.status) === FileStatus.DOWNLOADING || (fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.deleteStatus) === DeleteFileStatus.DELETING;
|
|
112
|
-
|
|
112
|
+
var showDragAndDrop = !showUploadedInputField && !readOnly;
|
|
113
|
+
return (_jsxs(FeatureStyled, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: _jsxs(_Fragment, { children: [label, required && _jsx(Mandatory, {})] }) }) }), _jsx(Collapse, __assign({ in: showDragAndDrop }, { children: _jsx(InputContainerStyled, __assign({ sx: { mb: 2.5 } }, { children: _jsx(DragAndDrop, { title: title, subTitle: subTitle, description: dragDescription, fileExists: fileExists, uploadingTitle: uploadingTitle, successTitle: successTitle, progress: fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.progress, uploading: (fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.status) === FileStatus.UPLOADING, uploadSuccess: (fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.status) === FileStatus.SUCCESS, onSuccess: handleFileChange, error: (fileInfo === null || fileInfo === void 0 ? void 0 : fileInfo.error) || error, multiple: false }) })) })), _jsx(Collapse, __assign({ in: fileExists, timeout: 300 }, { children: _jsx(FileUpload, { validFileFormats: validFileFormats, readOnly: readOnly, show: showUploadedInputField, fileRemoveType: fileRemoveType, purpose: purpose, title: fileTitle || '', isSubmitting: isSubmitting, uploadedFile: fileInfo, file: fileData, onSuccess: handleSuccess, onDelete: handleDelete, onUpdate: handleUpdate, initialFileId: defaultFile === null || defaultFile === void 0 ? void 0 : defaultFile.id }) }))] }));
|
|
113
114
|
};
|
|
114
115
|
export default React.memo(UploadWrapper);
|
|
@@ -22,6 +22,7 @@ export declare type UploadFileProps = {
|
|
|
22
22
|
onUpdate: (index: number, file: FileInfo, loadingStatus: boolean) => void;
|
|
23
23
|
sx?: SxProps<Theme> | undefined;
|
|
24
24
|
isSubmitting?: boolean;
|
|
25
|
+
readOnly?: boolean;
|
|
25
26
|
};
|
|
26
|
-
declare const UploadFile: ({ index, title, file, fileType, uploadedFiles, onSuccess, onDelete, onUpdate, sx, purpose, isSubmitting }: UploadFileProps) => JSX.Element;
|
|
27
|
+
declare const UploadFile: ({ index, title, file, fileType, uploadedFiles, onSuccess, onDelete, onUpdate, sx, purpose, isSubmitting, readOnly }: UploadFileProps) => JSX.Element;
|
|
27
28
|
export default UploadFile;
|
|
@@ -64,9 +64,9 @@ var BoxStyled = styled(Box)(function (_a) {
|
|
|
64
64
|
var theme = _a.theme;
|
|
65
65
|
return (__assign(__assign({ direction: theme.direction }, theme.typography.subtitle2), { color: theme.palette.primary.main, fontWeight: theme.typography.fontWeightBold, background: theme.palette.background.default, padding: theme.spacing(0, 2.5, 0), width: '88%', wordBreak: 'break-all', display: 'flex', justifyContent: 'space-between' }));
|
|
66
66
|
});
|
|
67
|
-
var UploadBoxStyled = styled(Box, { shouldForwardProp: function (prop) { return
|
|
68
|
-
var theme = _a.theme, uploading = _a.uploading;
|
|
69
|
-
return (__assign(__assign({}, theme.typography.caption), { background: uploading ? alpha(theme.palette.primary.main, 0.5) : theme.palette.primary.main, color: theme.palette.common.white, fontWeight: theme.typography.fontWeightRegular, cursor: 'pointer', width: '12%', display: 'flex', justifyContent: 'center', alignItems: 'center' }));
|
|
67
|
+
var UploadBoxStyled = styled(Box, { shouldForwardProp: function (prop) { return !['uploading', 'readOnly'].includes(prop.toString()); } })(function (_a) {
|
|
68
|
+
var theme = _a.theme, uploading = _a.uploading, readOnly = _a.readOnly;
|
|
69
|
+
return (__assign(__assign(__assign({}, theme.typography.caption), { background: uploading ? alpha(theme.palette.primary.main, 0.5) : theme.palette.primary.main, color: theme.palette.common.white, fontWeight: theme.typography.fontWeightRegular, cursor: 'pointer', width: '12%', display: 'flex', justifyContent: 'center', alignItems: 'center' }), ((readOnly || uploading) && { background: alpha(theme.palette.primary.main, 0.5), cursor: 'default' })));
|
|
70
70
|
});
|
|
71
71
|
var ClearIconStyled = styled(ClearIcon)(function (_a) {
|
|
72
72
|
var theme = _a.theme;
|
|
@@ -108,7 +108,7 @@ var WarningContainer = styled(Box)(function (_a) {
|
|
|
108
108
|
return (__assign({ background: alpha(theme.palette.warning.main, 0.1), paddingBlock: theme.spacing(1.5), paddingInlineStart: theme.spacing(2.5), flexDirection: 'row', display: 'flex', justifyContent: 'center', color: theme.palette.warning.light, padding: theme.spacing(0.5, 1), borderRadius: '101px', alignItems: 'center', marginTop: theme.spacing(1.25) }, theme.typography.caption));
|
|
109
109
|
});
|
|
110
110
|
var UploadFile = function (_a) {
|
|
111
|
-
var index = _a.index, title = _a.title, file = _a.file, fileType = _a.fileType, uploadedFiles = _a.uploadedFiles, onSuccess = _a.onSuccess, onDelete = _a.onDelete, onUpdate = _a.onUpdate, sx = _a.sx, purpose = _a.purpose, isSubmitting = _a.isSubmitting;
|
|
111
|
+
var index = _a.index, title = _a.title, file = _a.file, fileType = _a.fileType, uploadedFiles = _a.uploadedFiles, onSuccess = _a.onSuccess, onDelete = _a.onDelete, onUpdate = _a.onUpdate, sx = _a.sx, purpose = _a.purpose, isSubmitting = _a.isSubmitting, readOnly = _a.readOnly;
|
|
112
112
|
var theme = useTheme();
|
|
113
113
|
var t = useTranslation().t;
|
|
114
114
|
var _b = file || {}, name = _b.name, size = _b.size, type = _b.type;
|
|
@@ -264,6 +264,10 @@ var UploadFile = function (_a) {
|
|
|
264
264
|
flexDirection: 'column',
|
|
265
265
|
padding: theme.spacing(1.5, 0, 1.5),
|
|
266
266
|
width: '100%'
|
|
267
|
-
} }, { 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 || (!!isAnyFileDoingDeleteUploadDownload && deleteStatus !== DeleteFileStatus.DELETING), onClick:
|
|
267
|
+
} }, { 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({ readOnly: readOnly, uploading: status === FileStatus.UPLOADING || (!!isAnyFileDoingDeleteUploadDownload && deleteStatus !== DeleteFileStatus.DELETING), onClick: function () {
|
|
268
|
+
if (readOnly)
|
|
269
|
+
return;
|
|
270
|
+
canDeleteFile && handleDeleteFile(index);
|
|
271
|
+
} }, { children: deleteStatus === DeleteFileStatus.DELETING ? (_jsx(MUICircularProgress, { size: 25, thickness: 5, sx: { color: theme.palette.common.white } })) : (_jsx(ClearIconStyled, {})) }))] })) }), index));
|
|
268
272
|
};
|
|
269
273
|
export default UploadFile;
|
|
@@ -29,6 +29,7 @@ interface UploadMultipleFileProps {
|
|
|
29
29
|
onDeleteFile: (fileIds: Array<string>) => void;
|
|
30
30
|
maxLimit?: number;
|
|
31
31
|
defaultFiles?: Array<FileDetails>;
|
|
32
|
+
readOnly?: boolean;
|
|
32
33
|
}
|
|
33
|
-
declare const UploadMultipleFile: ({ id, label, control, required, fileType, title, subTitle, dragDescription, uploadingTitle, successTitle, isSubmitting, onFileUploaded, fileUploadingStatus, onDeleteFile, maxLimit, purpose, fileTitle, defaultFiles }: UploadMultipleFileProps) => JSX.Element;
|
|
34
|
+
declare const UploadMultipleFile: ({ id, label, control, required, fileType, title, subTitle, dragDescription, uploadingTitle, successTitle, isSubmitting, onFileUploaded, fileUploadingStatus, onDeleteFile, maxLimit, purpose, fileTitle, defaultFiles, readOnly }: UploadMultipleFileProps) => JSX.Element;
|
|
34
35
|
export default UploadMultipleFile;
|
|
@@ -62,7 +62,7 @@ var UploadCountBox = styled(Box)(function (_a) {
|
|
|
62
62
|
});
|
|
63
63
|
});
|
|
64
64
|
var UploadMultipleFile = function (_a) {
|
|
65
|
-
var id = _a.id, label = _a.label, control = _a.control, required = _a.required, fileType = _a.fileType, title = _a.title, subTitle = _a.subTitle, dragDescription = _a.dragDescription, uploadingTitle = _a.uploadingTitle, successTitle = _a.successTitle, isSubmitting = _a.isSubmitting, onFileUploaded = _a.onFileUploaded, fileUploadingStatus = _a.fileUploadingStatus, onDeleteFile = _a.onDeleteFile, maxLimit = _a.maxLimit, purpose = _a.purpose, fileTitle = _a.fileTitle, defaultFiles = _a.defaultFiles;
|
|
65
|
+
var id = _a.id, label = _a.label, control = _a.control, required = _a.required, fileType = _a.fileType, title = _a.title, subTitle = _a.subTitle, dragDescription = _a.dragDescription, uploadingTitle = _a.uploadingTitle, successTitle = _a.successTitle, isSubmitting = _a.isSubmitting, onFileUploaded = _a.onFileUploaded, fileUploadingStatus = _a.fileUploadingStatus, onDeleteFile = _a.onDeleteFile, maxLimit = _a.maxLimit, purpose = _a.purpose, fileTitle = _a.fileTitle, defaultFiles = _a.defaultFiles, readOnly = _a.readOnly;
|
|
66
66
|
var t = useTranslation().t;
|
|
67
67
|
var theme = useTheme();
|
|
68
68
|
var _b = React.useState(''), error = _b[0], setError = _b[1];
|
|
@@ -169,8 +169,8 @@ var UploadMultipleFile = function (_a) {
|
|
|
169
169
|
}
|
|
170
170
|
};
|
|
171
171
|
var fileExists = fileInfoArray.length > 0;
|
|
172
|
-
return (_jsxs(FeatureStyled, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: _jsxs(_Fragment, { children: [label, required && _jsx(Mandatory, {})] }) }), _jsx(Collapse, __assign({ in: !!uploadedFileCount, timeout: 100, unmountOnExit: true }, { children: _jsx(UploadCountBox, { children: "".concat(uploadedFileCount, " ").concat(t('uploaded_file')) }) }))] }), _jsx(InputContainerStyled, __assign({ sx: { mb: 2.5 } }, { children: _jsx(DragAndDrop, { title: title, subTitle: subTitle, description: dragDescription, fileExists: fileExists, uploadingTitle: uploadingTitle, successTitle: successTitle, onSuccess: handleFileChange, multiple: true, error: error }) })), _jsx(Collapse, __assign({ in: fileExists, timeout: 300 }, { children: (fileArray || []).map(function (file, index) {
|
|
173
|
-
return (_jsx(UploadFile, { required: required, purpose: purpose, fileType: fileType, title: fileTitle, isSubmitting: isSubmitting, uploadedFiles: fileInfoArray, index: index, file: file, sx: {
|
|
172
|
+
return (_jsxs(FeatureStyled, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: _jsxs(_Fragment, { children: [label, required && _jsx(Mandatory, {})] }) }), _jsx(Collapse, __assign({ in: !!uploadedFileCount, timeout: 100, unmountOnExit: true }, { children: _jsx(UploadCountBox, { children: "".concat(uploadedFileCount, " ").concat(t('uploaded_file')) }) }))] }), _jsx(Collapse, __assign({ in: !readOnly }, { children: _jsx(InputContainerStyled, __assign({ sx: { mb: 2.5 } }, { children: _jsx(DragAndDrop, { title: title, subTitle: subTitle, description: dragDescription, fileExists: fileExists, uploadingTitle: uploadingTitle, successTitle: successTitle, onSuccess: handleFileChange, multiple: true, error: error }) })) })), _jsx(Collapse, __assign({ in: fileExists, timeout: 300 }, { children: (fileArray || []).map(function (file, index) {
|
|
173
|
+
return (_jsx(UploadFile, { readOnly: readOnly, required: required, purpose: purpose, fileType: fileType, title: fileTitle, isSubmitting: isSubmitting, uploadedFiles: fileInfoArray, index: index, file: file, sx: {
|
|
174
174
|
borderBottom: index === fileArray.length - 1 ? "1px solid ".concat(alpha(theme.palette.divider, 0.8)) : ''
|
|
175
175
|
}, onSuccess: handleSuccess, onDelete: handleDelete, onUpdate: handleUpdate }, index));
|
|
176
176
|
}) }))] }));
|
|
@@ -51,14 +51,17 @@ var CheckboxStyled = styled(CheckBox)(function (_a) {
|
|
|
51
51
|
var CollapseStyled = styled(Collapse)(function () { return ({
|
|
52
52
|
width: '100%'
|
|
53
53
|
}); });
|
|
54
|
-
var ConfirmPolicy = function () {
|
|
55
|
-
var
|
|
54
|
+
var ConfirmPolicy = function (_a) {
|
|
55
|
+
var _b;
|
|
56
|
+
var readOnly = _a.readOnly;
|
|
56
57
|
var t = useTranslation().t;
|
|
57
58
|
var control = useFormContext().control;
|
|
58
59
|
var confirmControl = useController({ control: control, name: 'confirmPolicy' });
|
|
59
60
|
var confirmChecked = confirmControl.field.value;
|
|
60
|
-
var warningMessage = (
|
|
61
|
+
var warningMessage = (_b = confirmControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
61
62
|
var handleConfirmCheckedChange = function (event, checked) {
|
|
63
|
+
if (readOnly)
|
|
64
|
+
return;
|
|
62
65
|
confirmControl.field.onChange(checked);
|
|
63
66
|
};
|
|
64
67
|
return (_jsxs(ScreenContainer, { children: [_jsxs(ConfirmContainerStyled, { children: [_jsx(CheckboxStyled, { disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: confirmChecked, onChange: handleConfirmCheckedChange }), _jsx(TextStyled, { children: t('tax_confirm_information') })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] }));
|
|
@@ -18,7 +18,8 @@ import { styled } from '@mui/material/styles';
|
|
|
18
18
|
import Form from '../../../../components/Form';
|
|
19
19
|
import { useAppDispatch, useLanguage, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
|
|
20
20
|
import { handleCurrentActiveScreen, settingsSelector } from '../../../../app/settings';
|
|
21
|
-
import {
|
|
21
|
+
import { DocumentPurpose } from '../../../../@types';
|
|
22
|
+
import { getFileDetailsFromDocument, isSA } from '../../../../utils';
|
|
22
23
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
23
24
|
import Button from '../../../shared/Button';
|
|
24
25
|
import { taxSelector, updateTaxInfo } from '../../../app/tax/taxStore';
|
|
@@ -57,6 +58,7 @@ var TaxDetails = function () {
|
|
|
57
58
|
var onBack = function () {
|
|
58
59
|
dispatch(handleCurrentActiveScreen('TAX_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
59
60
|
};
|
|
60
|
-
|
|
61
|
+
var defaultTaxFiles = React.useMemo(function () { return getFileDetailsFromDocument(entity === null || entity === void 0 ? void 0 : entity.documents, DocumentPurpose.TAX_DOCUMENT); }, [entity === null || entity === void 0 ? void 0 : entity.documents]);
|
|
62
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(VATId, { readOnly: !settingsData.boardMaturity && !!vatId }), _jsx(TaxDocument, { show: isSACountry, defaultFiles: defaultTaxFiles, readOnly: !settingsData.boardMaturity && !!defaultTaxFiles.length }), _jsx(ConfirmPolicy, { readOnly: !settingsData.boardMaturity && confirmPolicy === true }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: !methods.formState.isValid || uploading, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
61
63
|
};
|
|
62
64
|
export default TaxDetails;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { FileDetails } from '../../../../@types';
|
|
2
3
|
interface TaxDocumentProps {
|
|
3
4
|
show: boolean;
|
|
5
|
+
readOnly?: boolean;
|
|
6
|
+
defaultFiles?: Array<FileDetails>;
|
|
4
7
|
}
|
|
5
|
-
declare const TaxDocument: ({ show }: TaxDocumentProps) => JSX.Element;
|
|
8
|
+
declare const TaxDocument: ({ show, readOnly, defaultFiles }: TaxDocumentProps) => JSX.Element;
|
|
6
9
|
export default TaxDocument;
|
|
@@ -10,14 +10,12 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import React from 'react';
|
|
14
13
|
import { useTranslation } from 'react-i18next';
|
|
15
14
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
15
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
17
16
|
import { DocumentPurpose } from '../../../../@types';
|
|
18
17
|
import { styled } from '@mui/material/styles';
|
|
19
18
|
import Collapse from '../../../../components/Collapse';
|
|
20
|
-
import { getFileDetailsFromDocument } from '../../../../utils';
|
|
21
19
|
import { FileType } from '../../../../constants';
|
|
22
20
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
23
21
|
import { taxSelector, uploadingStatus } from '../../../app/tax/taxStore';
|
|
@@ -29,21 +27,18 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
|
29
27
|
});
|
|
30
28
|
});
|
|
31
29
|
var TaxDocument = function (_a) {
|
|
32
|
-
var
|
|
33
|
-
var show = _a.show;
|
|
30
|
+
var show = _a.show, readOnly = _a.readOnly, defaultFiles = _a.defaultFiles;
|
|
34
31
|
var t = useTranslation().t;
|
|
35
32
|
var control = useFormContext().control;
|
|
36
33
|
var dispatch = useAppDispatch();
|
|
37
34
|
var documentIdControl = useController({ name: 'documentId', control: control });
|
|
38
|
-
var
|
|
39
|
-
var documents = (((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) || {}).documents;
|
|
35
|
+
var loading = useAppSelector(taxSelector).loading;
|
|
40
36
|
var handleTaxDocumentChange = function (ids) {
|
|
41
37
|
documentIdControl.field.onChange(ids);
|
|
42
38
|
};
|
|
43
39
|
var handleReset = function (ids) {
|
|
44
40
|
documentIdControl.field.onChange(ids);
|
|
45
41
|
};
|
|
46
|
-
|
|
47
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, __assign({ sx: { mb: 2.5 } }, { children: _jsx(UploadMultipleFile, { id: 'documentId', control: control, label: t('title_tax_document'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_tax_document'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleTaxDocumentChange, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, defaultFiles: defaultFiles, purpose: DocumentPurpose.TAX_DOCUMENT, fileUploadingStatus: function (uploading) { return dispatch(uploadingStatus(uploading)); }, fileType: FileType.IMAGES }) })) })));
|
|
42
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, __assign({ sx: { mb: 2.5 } }, { children: _jsx(UploadMultipleFile, { readOnly: readOnly, id: 'documentId', control: control, label: t('title_tax_document'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_tax_document'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleTaxDocumentChange, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, defaultFiles: defaultFiles, purpose: DocumentPurpose.TAX_DOCUMENT, fileUploadingStatus: function (uploading) { return dispatch(uploadingStatus(uploading)); }, fileType: FileType.IMAGES }) })) })));
|
|
48
43
|
};
|
|
49
44
|
export default TaxDocument;
|
|
@@ -21,26 +21,24 @@ import { isSA, removeAllCharsFromNumber } from '../../../../utils';
|
|
|
21
21
|
import { settingsSelector } from '../../../../app/settings';
|
|
22
22
|
import ClearIcon from '../../../shared/ClearIcon';
|
|
23
23
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
24
|
-
|
|
25
|
-
var
|
|
26
|
-
var _a;
|
|
24
|
+
var VATId = function (_a) {
|
|
25
|
+
var _b;
|
|
26
|
+
var readOnly = _a.readOnly;
|
|
27
27
|
var t = useTranslation().t;
|
|
28
28
|
var control = useFormContext().control;
|
|
29
29
|
var vatControl = useController({ name: 'vatId', control: control });
|
|
30
30
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
31
31
|
var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
32
|
-
var data = useAppSelector(taxSelector).data;
|
|
33
|
-
var entity = (data.verify.responseBody || {}).entity;
|
|
34
32
|
var disabled = false;
|
|
35
33
|
var handleOnChange = function (vat) {
|
|
36
34
|
var value = removeAllCharsFromNumber(vat);
|
|
37
35
|
vatControl.field.onChange(value);
|
|
38
36
|
};
|
|
39
37
|
var vatValue = vatControl.field.value;
|
|
40
|
-
var vatError = (
|
|
38
|
+
var vatError = (_b = vatControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
41
39
|
var clearValue = function () {
|
|
42
40
|
vatControl.field.onChange('');
|
|
43
41
|
};
|
|
44
|
-
return (_jsx(Box, __assign({ sx: isSACountry ? {} : { height: '200px' } }, { children: _jsx(Input, { label: t('vat_id'), disabled: disabled, inputProps: { maxLength: VAT_ID_LENGTH }, value: vatValue, onChange: function (event) { return handleOnChange(event.target.value); }, placeholder: t('vat_id_placeholder'), warningType: 'alert', warningMessage: vatError && t(vatError), required: true, endAdornment: !vatError && vatValue ? _jsx(CheckIcon, {}) : vatValue && _jsx(ClearIcon, { onClick: clearValue }) }) })));
|
|
42
|
+
return (_jsx(Box, __assign({ sx: isSACountry ? {} : { height: '200px' } }, { children: _jsx(Input, { readOnly: readOnly, label: t('vat_id'), disabled: disabled, inputProps: { maxLength: VAT_ID_LENGTH }, value: vatValue, onChange: function (event) { return handleOnChange(event.target.value); }, placeholder: t('vat_id_placeholder'), warningType: 'alert', warningMessage: vatError && t(vatError), required: true, endAdornment: !vatError && vatValue ? _jsx(CheckIcon, {}) : vatValue && _jsx(ClearIcon, { onClick: clearValue }) }) })));
|
|
45
43
|
};
|
|
46
44
|
export default VATId;
|
package/build/hooks/index.d.ts
CHANGED
package/build/hooks/index.js
CHANGED
|
@@ -6,5 +6,5 @@ interface AppConfigProps extends LibConfig {
|
|
|
6
6
|
disableSettingFetching?: boolean;
|
|
7
7
|
maturity?: 'full' | 'express';
|
|
8
8
|
}
|
|
9
|
-
export declare const useAppConfig: ({ appInfo, navigation, publicKey, disableCountries, disableLocale, disableSettingFetching, maturity, ...rest }: AppConfigProps) => void;
|
|
9
|
+
export declare const useAppConfig: ({ appInfo, navigation, publicKey, disableCountries, disableLocale, disableSettingFetching, maturity, boardMaturity, ...rest }: AppConfigProps) => void;
|
|
10
10
|
export {};
|
|
@@ -21,13 +21,13 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import { useEffect } from 'react';
|
|
24
|
-
import { handleActiveFlowScreens, handleSetAppConfig, handleLanguage, handleOpen, handleIsTapOrigin, fetchAppSettingsSync } from '../app/settings';
|
|
24
|
+
import { handleActiveFlowScreens, handleSetAppConfig, handleLanguage, handleOpen, handleIsTapOrigin, fetchAppSettingsSync, handelBoardMaturity } from '../app/settings';
|
|
25
25
|
import { useAppDispatch } from './useAppDispatch';
|
|
26
26
|
import { axiosInstance } from '../api';
|
|
27
27
|
import { isTapDomain, removeRequestHeaders } from '../utils';
|
|
28
28
|
import { ENDPOINT_PATHS } from '../constants';
|
|
29
29
|
export var useAppConfig = function (_a) {
|
|
30
|
-
var appInfo = _a.appInfo, navigation = _a.navigation, publicKey = _a.publicKey, disableCountries = _a.disableCountries, disableLocale = _a.disableLocale, disableSettingFetching = _a.disableSettingFetching, maturity = _a.maturity, rest = __rest(_a, ["appInfo", "navigation", "publicKey", "disableCountries", "disableLocale", "disableSettingFetching", "maturity"]);
|
|
30
|
+
var appInfo = _a.appInfo, navigation = _a.navigation, publicKey = _a.publicKey, disableCountries = _a.disableCountries, disableLocale = _a.disableLocale, disableSettingFetching = _a.disableSettingFetching, maturity = _a.maturity, boardMaturity = _a.boardMaturity, rest = __rest(_a, ["appInfo", "navigation", "publicKey", "disableCountries", "disableLocale", "disableSettingFetching", "maturity", "boardMaturity"]);
|
|
31
31
|
var dispatch = useAppDispatch();
|
|
32
32
|
var setBaseUrl = function () {
|
|
33
33
|
var isProd = publicKey.includes('pk_live');
|
|
@@ -56,6 +56,8 @@ export var useAppConfig = function (_a) {
|
|
|
56
56
|
checkDomain();
|
|
57
57
|
setBaseUrl();
|
|
58
58
|
setAppConfig();
|
|
59
|
+
if (typeof boardMaturity === 'boolean')
|
|
60
|
+
dispatch(handelBoardMaturity(boardMaturity));
|
|
59
61
|
dispatch(handleLanguage(rest.language));
|
|
60
62
|
if (!disableSettingFetching)
|
|
61
63
|
dispatch(fetchAppSettingsSync({ disableCountries: disableCountries, disableLocale: disableLocale, mdn: rest.merchantDomain, maturity: maturity }));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import { hasNoneEditableValue } from '../utils';
|
|
3
|
+
export var useDataNoneEditable = function (dataStatus, noneEditableKeys) {
|
|
4
|
+
var _a = useState({}), dataNoneEditable = _a[0], setDataNoneEditable = _a[1];
|
|
5
|
+
var setNoneEditableValue = useCallback(function () {
|
|
6
|
+
if (!dataStatus)
|
|
7
|
+
return;
|
|
8
|
+
var obj = {};
|
|
9
|
+
noneEditableKeys.forEach(function (path) {
|
|
10
|
+
var isNoneEditable = hasNoneEditableValue(dataStatus, path);
|
|
11
|
+
obj[path] = isNoneEditable;
|
|
12
|
+
});
|
|
13
|
+
setDataNoneEditable(obj);
|
|
14
|
+
}, [dataStatus, noneEditableKeys, hasNoneEditableValue]);
|
|
15
|
+
useEffect(function () {
|
|
16
|
+
setNoneEditableValue();
|
|
17
|
+
}, [setDataNoneEditable]);
|
|
18
|
+
return dataNoneEditable;
|
|
19
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FieldValues, UseFormReturn } from 'react-hook-form';
|
|
2
|
+
declare type ReadOnly<TF, V> = {
|
|
3
|
+
[key in keyof TF]: V;
|
|
4
|
+
};
|
|
5
|
+
export declare const useFormReadOnly: <TF extends FieldValues = FieldValues>(methods: UseFormReturn<TF, any>, extraData?: { [key in keyof TF]?: any; }) => ReadOnly<TF, boolean>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import { settingsSelector } from '../app/settings';
|
|
3
|
+
import { useAppSelector } from './useAppSelector';
|
|
4
|
+
var isValidData = function (data) {
|
|
5
|
+
if (data === null || data === undefined)
|
|
6
|
+
return false;
|
|
7
|
+
if (typeof data === 'boolean')
|
|
8
|
+
return data === true;
|
|
9
|
+
if (typeof data === 'string' && data.trim() === '')
|
|
10
|
+
return false;
|
|
11
|
+
if (typeof data === 'object' && Object.keys(data).length === 0)
|
|
12
|
+
return false;
|
|
13
|
+
if (Array.isArray(data) && data.length === 0)
|
|
14
|
+
return false;
|
|
15
|
+
return true;
|
|
16
|
+
};
|
|
17
|
+
export var useFormReadOnly = function (methods, extraData) {
|
|
18
|
+
if (extraData === void 0) { extraData = {}; }
|
|
19
|
+
var _a = useState({}), readOnly = _a[0], setReadOnly = _a[1];
|
|
20
|
+
var data = useAppSelector(settingsSelector).data;
|
|
21
|
+
var setReadOnlyValues = useCallback(function () {
|
|
22
|
+
var values = methods.formState.defaultValues;
|
|
23
|
+
var readOnlyValues = {};
|
|
24
|
+
for (var key in values) {
|
|
25
|
+
var value = values === null || values === void 0 ? void 0 : values[key];
|
|
26
|
+
readOnlyValues[key] = !data.boardMaturity && isValidData(value);
|
|
27
|
+
}
|
|
28
|
+
for (var key in extraData) {
|
|
29
|
+
var value = extraData === null || extraData === void 0 ? void 0 : extraData[key];
|
|
30
|
+
readOnlyValues[key] = !data.boardMaturity && isValidData(value);
|
|
31
|
+
}
|
|
32
|
+
setReadOnly(readOnlyValues);
|
|
33
|
+
}, [methods.formState.defaultValues, data.boardMaturity]);
|
|
34
|
+
useEffect(function () {
|
|
35
|
+
setReadOnlyValues();
|
|
36
|
+
}, [setReadOnlyValues]);
|
|
37
|
+
return readOnly;
|
|
38
|
+
};
|
package/build/utils/string.js
CHANGED
|
@@ -29,14 +29,13 @@ export var maskEmail = function (str) {
|
|
|
29
29
|
return '';
|
|
30
30
|
};
|
|
31
31
|
export var shortenBrand = function (str) {
|
|
32
|
-
|
|
33
|
-
if (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return
|
|
38
|
-
|
|
39
|
-
return '';
|
|
32
|
+
var trimmedStr = str === null || str === void 0 ? void 0 : str.trim();
|
|
33
|
+
if (!trimmedStr)
|
|
34
|
+
return '';
|
|
35
|
+
var name = trimmedStr.split(' ');
|
|
36
|
+
if (name.length > 1)
|
|
37
|
+
return name[0][0].toUpperCase() + name[name.length - 1][0].toUpperCase();
|
|
38
|
+
return name[0][0].toUpperCase();
|
|
40
39
|
};
|
|
41
40
|
export var showLastFour = function (str) {
|
|
42
41
|
if (str && str.length >= 4) {
|
package/package.json
CHANGED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export declare const InputLabelStyled: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material/styles").Theme> & {
|
|
3
|
-
align?: "right" | "left" | "inherit" | "center" | "justify" | undefined;
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
classes?: Partial<import("@mui/material").TypographyClasses> | undefined;
|
|
6
|
-
gutterBottom?: boolean | undefined;
|
|
7
|
-
noWrap?: boolean | undefined;
|
|
8
|
-
paragraph?: boolean | undefined;
|
|
9
|
-
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
10
|
-
variant?: "button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "overline" | "subtitle1" | "subtitle2" | "body1" | "body2" | undefined;
|
|
11
|
-
variantMapping?: Partial<Record<"button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "overline" | "subtitle1" | "subtitle2" | "body1" | "body2", string>> | undefined;
|
|
12
|
-
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof React.HTMLAttributes<HTMLSpanElement>> & {
|
|
13
|
-
ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
|
|
14
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | ("border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "top" | "right" | "bottom" | "left" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform") | "children" | "sx" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
15
|
-
export declare const MandatoryStyled: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
16
|
-
export interface OperationStartDateProps {
|
|
17
|
-
onDateClicked?: (flag: boolean) => void;
|
|
18
|
-
}
|
|
19
|
-
declare const OperationStartDate: ({ onDateClicked }: OperationStartDateProps) => JSX.Element;
|
|
20
|
-
export default OperationStartDate;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { useTranslation } from 'react-i18next';
|
|
14
|
-
import { useController, useFormContext } from 'react-hook-form';
|
|
15
|
-
import DatePicker from '../../../../components/DatePicker';
|
|
16
|
-
import Text from '../../../../components/Text';
|
|
17
|
-
import { ScreenContainer } from '../../../shared/Containers';
|
|
18
|
-
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
19
|
-
import { brandSelector, clearError } from '../../../app/brand/brandStore';
|
|
20
|
-
import { alpha, styled } from '@mui/material/styles';
|
|
21
|
-
export var InputLabelStyled = styled(Text)(function (_a) {
|
|
22
|
-
var theme = _a.theme;
|
|
23
|
-
return (__assign({ margin: theme.spacing(2.5, 2.5, 1.5, 2.5), color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption));
|
|
24
|
-
});
|
|
25
|
-
export var MandatoryStyled = styled('span')(function (_a) {
|
|
26
|
-
var theme = _a.theme;
|
|
27
|
-
return (__assign(__assign({ color: alpha(theme.palette.error.light, 0.4) }, theme.typography.h6), { fontWeight: theme.typography.fontWeightLight, verticalAlign: 'sub' }));
|
|
28
|
-
});
|
|
29
|
-
var OperationStartDate = function (_a) {
|
|
30
|
-
var _b;
|
|
31
|
-
var onDateClicked = _a.onDateClicked;
|
|
32
|
-
var t = useTranslation().t;
|
|
33
|
-
var dispatch = useAppDispatch();
|
|
34
|
-
var control = useFormContext().control;
|
|
35
|
-
var error = useAppSelector(brandSelector).error;
|
|
36
|
-
var oDateControl = useController({ control: control, name: 'operationStartDate' });
|
|
37
|
-
var handleOperationStartDateChange = function (data) {
|
|
38
|
-
if (error)
|
|
39
|
-
dispatch(clearError());
|
|
40
|
-
oDateControl.field.onChange(data);
|
|
41
|
-
};
|
|
42
|
-
var dateValue = (_b = oDateControl === null || oDateControl === void 0 ? void 0 : oDateControl.field) === null || _b === void 0 ? void 0 : _b.value;
|
|
43
|
-
return (_jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('business_start_date'), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(DatePicker, { readOnly: true, defaultValue: dateValue ? new Date(dateValue) : new Date(), dir: 'ltr', locale: 'en', onClick: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); }, onDateChange: handleOperationStartDateChange })] }));
|
|
44
|
-
};
|
|
45
|
-
export default OperationStartDate;
|