@tap-payments/auth-jsconnect 2.3.26-test → 2.3.28-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/api/entity.d.ts +5 -5
- 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/bank/bankStore.js +26 -30
- package/build/features/app/brand/brandStore.d.ts +5 -2
- package/build/features/app/brand/brandStore.js +49 -39
- package/build/features/app/entity/entityStore.js +58 -68
- package/build/features/app/individual/individualStore.js +59 -65
- package/build/features/app/tax/taxStore.js +23 -22
- package/build/features/bank/screens/BankDetails/BankDetails.js +20 -5
- 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/bank/screens/BankDetails/validation.d.ts +14 -14
- package/build/features/bank/screens/BankDetails/validation.js +16 -21
- 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 +4 -3
- 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/BrandActivities/validation.d.ts +7 -7
- package/build/features/brand/screens/BrandActivities/validation.js +10 -19
- 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 +6 -6
- package/build/features/brand/screens/BrandInfo/validation.js +31 -37
- 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 +4 -2
- package/build/features/entity/screens/EntityCapital/validation.d.ts +10 -10
- package/build/features/entity/screens/EntityCapital/validation.js +4 -10
- 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 +7 -4
- 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/entity/screens/EntityName/validation.d.ts +35 -35
- package/build/features/entity/screens/EntityName/validation.js +68 -93
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +6 -3
- 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/AdditionalIndividualInfo/validation.d.ts +2 -2
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +6 -11
- 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 +5 -3
- 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/features/tax/screens/TaxDetails/validation.d.ts +4 -4
- package/build/features/tax/screens/TaxDetails/validation.js +2 -5
- package/build/hooks/index.d.ts +3 -0
- package/build/hooks/index.js +3 -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/useFormErrorAndUpdateReadOnly.d.ts +6 -0
- package/build/hooks/useFormErrorAndUpdateReadOnly.js +48 -0
- package/build/hooks/useFormReadOnly.d.ts +6 -0
- package/build/hooks/useFormReadOnly.js +40 -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
|
@@ -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;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
export declare const Validation: (
|
|
3
|
-
vatId: yup.
|
|
2
|
+
export declare const Validation: () => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
vatId: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
4
4
|
confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
5
5
|
documentId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
6
6
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
7
|
-
vatId: yup.
|
|
7
|
+
vatId: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
8
8
|
confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
9
9
|
documentId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
10
10
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
11
|
-
vatId: yup.
|
|
11
|
+
vatId: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
12
12
|
confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
13
13
|
documentId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
14
14
|
}>>>;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
|
|
3
|
-
export var Validation = function (entity) {
|
|
4
|
-
var _a = entity || {}, vat_id = _a.vat_id, data_status = _a.data_status;
|
|
5
|
-
var isTaxNumberOptional = !vat_id && (data_status === null || data_status === void 0 ? void 0 : data_status.tax_number) === FieldType.NON_EDITABLE;
|
|
2
|
+
export var Validation = function () {
|
|
6
3
|
return yup.object().shape({
|
|
7
|
-
vatId:
|
|
4
|
+
vatId: yup.string().min(9, 'alert_vat').max(15, 'alert_vat').required('alert_vat'),
|
|
8
5
|
confirmPolicy: yup.boolean().required('alert_tax_confirm').isTrue('alert_tax_confirm'),
|
|
9
6
|
documentId: yup.array().optional()
|
|
10
7
|
});
|
package/build/hooks/index.d.ts
CHANGED
|
@@ -15,3 +15,6 @@ export * from './useSetFromDefaultValues';
|
|
|
15
15
|
export * from './useCountUp';
|
|
16
16
|
export * from './useCountry';
|
|
17
17
|
export * from './useVerifyToken';
|
|
18
|
+
export * from './useFormReadOnly';
|
|
19
|
+
export * from './useDataNoneEditable';
|
|
20
|
+
export * from './useFormErrorAndUpdateReadOnly';
|
package/build/hooks/index.js
CHANGED
|
@@ -15,3 +15,6 @@ export * from './useSetFromDefaultValues';
|
|
|
15
15
|
export * from './useCountUp';
|
|
16
16
|
export * from './useCountry';
|
|
17
17
|
export * from './useVerifyToken';
|
|
18
|
+
export * from './useFormReadOnly';
|
|
19
|
+
export * from './useDataNoneEditable';
|
|
20
|
+
export * from './useFormErrorAndUpdateReadOnly';
|
|
@@ -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 useFormErrorAndUpdateReadOnly: <TF extends FieldValues = FieldValues>(methods: UseFormReturn<TF, any>, readOnlyData: { [key in keyof TF]: boolean; }, noneEditable?: Record<any, boolean>) => ReadOnly<TF, boolean>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
export var useFormErrorAndUpdateReadOnly = function (methods, readOnlyData, noneEditable) {
|
|
3
|
+
if (noneEditable === void 0) { noneEditable = {}; }
|
|
4
|
+
var _a = useState({}), readOnly = _a[0], setReadOnly = _a[1];
|
|
5
|
+
var reValidateReadOnly = useCallback(function () {
|
|
6
|
+
if (Object.keys(readOnlyData).length === 0)
|
|
7
|
+
return;
|
|
8
|
+
var defaultValues = methods.formState.defaultValues;
|
|
9
|
+
for (var key in readOnlyData) {
|
|
10
|
+
var value = readOnlyData === null || readOnlyData === void 0 ? void 0 : readOnlyData[key];
|
|
11
|
+
if (value === true) {
|
|
12
|
+
methods.setValue(key, defaultValues === null || defaultValues === void 0 ? void 0 : defaultValues[key], { shouldValidate: true });
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}, [readOnlyData, methods.setValue, methods.formState.defaultValues]);
|
|
16
|
+
var reValidateNoneEditable = useCallback(function () {
|
|
17
|
+
var hasNoneEditable = Object.values(noneEditable).some(function (value) { return value === true; });
|
|
18
|
+
if (!hasNoneEditable)
|
|
19
|
+
return;
|
|
20
|
+
var defaultValues = methods.formState.defaultValues;
|
|
21
|
+
for (var key in defaultValues) {
|
|
22
|
+
methods.setValue(key, defaultValues[key], { shouldValidate: true });
|
|
23
|
+
}
|
|
24
|
+
}, [noneEditable, methods.formState.defaultValues]);
|
|
25
|
+
var updateReadOnly = useCallback(function () {
|
|
26
|
+
var errors = methods.formState.errors;
|
|
27
|
+
var newReadOnly = {};
|
|
28
|
+
for (var key in readOnlyData) {
|
|
29
|
+
var error = errors === null || errors === void 0 ? void 0 : errors[key];
|
|
30
|
+
var value = readOnlyData === null || readOnlyData === void 0 ? void 0 : readOnlyData[key];
|
|
31
|
+
if (error)
|
|
32
|
+
newReadOnly[key] = false;
|
|
33
|
+
else
|
|
34
|
+
newReadOnly[key] = value;
|
|
35
|
+
}
|
|
36
|
+
setReadOnly(newReadOnly);
|
|
37
|
+
}, [readOnlyData, methods.formState.errors]);
|
|
38
|
+
useEffect(function () {
|
|
39
|
+
reValidateReadOnly();
|
|
40
|
+
}, [reValidateReadOnly]);
|
|
41
|
+
useEffect(function () {
|
|
42
|
+
reValidateNoneEditable();
|
|
43
|
+
}, [reValidateNoneEditable]);
|
|
44
|
+
useEffect(function () {
|
|
45
|
+
updateReadOnly();
|
|
46
|
+
}, [updateReadOnly]);
|
|
47
|
+
return readOnly;
|
|
48
|
+
};
|
|
@@ -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,40 @@
|
|
|
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
|
+
if (data.boardMaturity)
|
|
23
|
+
return;
|
|
24
|
+
var values = methods.formState.defaultValues;
|
|
25
|
+
var readOnlyValues = {};
|
|
26
|
+
for (var key in values) {
|
|
27
|
+
var value = values === null || values === void 0 ? void 0 : values[key];
|
|
28
|
+
readOnlyValues[key] = isValidData(value);
|
|
29
|
+
}
|
|
30
|
+
for (var key in extraData) {
|
|
31
|
+
var value = extraData === null || extraData === void 0 ? void 0 : extraData[key];
|
|
32
|
+
readOnlyValues[key] = isValidData(value);
|
|
33
|
+
}
|
|
34
|
+
setReadOnly(readOnlyValues);
|
|
35
|
+
}, [methods.formState.defaultValues, data.boardMaturity]);
|
|
36
|
+
useEffect(function () {
|
|
37
|
+
setReadOnlyValues();
|
|
38
|
+
}, [setReadOnlyValues]);
|
|
39
|
+
return readOnly;
|
|
40
|
+
};
|
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;
|