@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
|
@@ -129,11 +129,11 @@ var IndividualPersonalInfo = function (_a) {
|
|
|
129
129
|
var isBirthCountryListActive = listActive === ListType.BirthCountryList;
|
|
130
130
|
var isBirthCityListActive = listActive === ListType.BirthCityList;
|
|
131
131
|
var isNationalityListActive = listActive === ListType.NationalityList;
|
|
132
|
-
return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: showField && !!(user === null || user === void 0 ? void 0 : user.is_authorized), timeout: 500 }, { children: _jsxs(TextBoxStyled, { children: [getUserName() || '', _jsx(RoleTextStyled, { children: getUserOccupation() || '' })] }) })), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Name, { show: showField }), _jsx(MobileNumber, { show: !isDateFieldActive && !isBirthCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.MobileCountryList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Email, { show: showField }), _jsx(Gender, { show: showField }), _jsx(ID, { show: showField }), _jsx(IssuedCountry, { show: !isMobileCountryListActive && !isDateFieldActive && !isBirthCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.IssuedCountryList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ExpiryDate, { show: !listActive && !dobActive, onDateClicked: handleExpiryDateActive }), _jsx(DOB, { show: !listActive && !expiryDateActive, onDateClicked: handleDobActive }), _jsx(BirthCountry, { show: !isMobileCountryListActive && !isDateFieldActive && !isIssuedCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.BirthCountryList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(BirthCity, { show: !isMobileCountryListActive &&
|
|
132
|
+
return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: showField && !!(user === null || user === void 0 ? void 0 : user.is_authorized), timeout: 500 }, { children: _jsxs(TextBoxStyled, { children: [getUserName() || '', _jsx(RoleTextStyled, { children: getUserOccupation() || '' })] }) })), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Name, { show: showField, readOnly: !settingsData.boardMaturity && !!name }), _jsx(MobileNumber, { readOnly: !settingsData.boardMaturity && !!mobile, show: !isDateFieldActive && !isBirthCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.MobileCountryList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Email, { show: showField, readOnly: !settingsData.boardMaturity && !!email }), _jsx(Gender, { show: showField, readOnly: !settingsData.boardMaturity && !!gender }), _jsx(ID, { show: showField, readOnly: !settingsData.boardMaturity && !!nid }), _jsx(IssuedCountry, { readOnly: !settingsData.boardMaturity && !!issuedCountry, show: !isMobileCountryListActive && !isDateFieldActive && !isBirthCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.IssuedCountryList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ExpiryDate, { show: !listActive && !dobActive, onDateClicked: handleExpiryDateActive, readOnly: !settingsData.boardMaturity && !!expiryDate }), _jsx(DOB, { show: !listActive && !expiryDateActive, onDateClicked: handleDobActive, readOnly: !settingsData.boardMaturity && !!dob }), _jsx(BirthCountry, { readOnly: !settingsData.boardMaturity && !!placeOfBirthCountry, show: !isMobileCountryListActive && !isDateFieldActive && !isIssuedCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.BirthCountryList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(BirthCity, { readOnly: !settingsData.boardMaturity && !!placeOfBirthCity, show: !isMobileCountryListActive &&
|
|
133
133
|
!isDateFieldActive &&
|
|
134
134
|
!isIssuedCountryListActive &&
|
|
135
135
|
!isBirthCountryListActive &&
|
|
136
|
-
!isNationalityListActive, onListOpen: function () { return handleMenuClick(ListType.BirthCityList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Nationality, { show: !isMobileCountryListActive && !isDateFieldActive && !isIssuedCountryListActive && !isBirthCityListActive && !isBirthCountryListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.NationalityList); }, onListClose: function () { return handleMenuClick(); } })] }), _jsx(Collapse, __assign({ in: showField, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: !(user === null || user === void 0 ? void 0 : user.is_authorized), disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) }))] }));
|
|
136
|
+
!isNationalityListActive, onListOpen: function () { return handleMenuClick(ListType.BirthCityList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Nationality, { readOnly: !settingsData.boardMaturity && !!nationality, show: !isMobileCountryListActive && !isDateFieldActive && !isIssuedCountryListActive && !isBirthCityListActive && !isBirthCountryListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.NationalityList); }, onListClose: function () { return handleMenuClick(); } })] }), _jsx(Collapse, __assign({ in: showField, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: !(user === null || user === void 0 ? void 0 : user.is_authorized), disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) }))] }));
|
|
137
137
|
};
|
|
138
|
-
export default React.memo(IndividualPersonalInfo);
|
|
139
138
|
IndividualPersonalInfo.defaultProps = {};
|
|
139
|
+
export default React.memo(IndividualPersonalInfo);
|
|
@@ -5,6 +5,7 @@ interface IssuedCountryProps {
|
|
|
5
5
|
show: boolean;
|
|
6
6
|
onListOpen?: () => void;
|
|
7
7
|
onListClose?: () => void;
|
|
8
|
+
readOnly?: boolean;
|
|
8
9
|
}
|
|
9
10
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<IssuedCountryProps & React.RefAttributes<unknown>>>;
|
|
10
11
|
export default _default;
|
|
@@ -27,14 +27,13 @@ import { useTranslation } from 'react-i18next';
|
|
|
27
27
|
import { useController, useFormContext } from 'react-hook-form';
|
|
28
28
|
import { styled } from '@mui/material/styles';
|
|
29
29
|
import CheckIcon from '@mui/icons-material/Check';
|
|
30
|
-
import { useLanguage
|
|
30
|
+
import { useLanguage } from '../../../../hooks';
|
|
31
31
|
import Collapse from '../../../../components/Collapse';
|
|
32
32
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
33
33
|
import Text from '../../../../components/Text';
|
|
34
34
|
import SimpleList from '../../../../components/SimpleList';
|
|
35
35
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
36
36
|
import Input from '../../../shared/Input';
|
|
37
|
-
import { individualSelector } from '../../../app/individual/individualStore';
|
|
38
37
|
var CountryItemContainer = styled(Box)(function () { return ({
|
|
39
38
|
display: 'flex'
|
|
40
39
|
}); });
|
|
@@ -52,19 +51,18 @@ var CheckIconStyled = styled(CheckIcon)(function (_a) {
|
|
|
52
51
|
});
|
|
53
52
|
var IssuedCountry = React.forwardRef(function (_a, ref) {
|
|
54
53
|
var _b, _c, _d;
|
|
55
|
-
var countries = _a.countries, rest = __rest(_a, ["countries"]);
|
|
54
|
+
var countries = _a.countries, readOnly = _a.readOnly, rest = __rest(_a, ["countries", "readOnly"]);
|
|
56
55
|
var _e = React.useState(countries), locationCountries = _e[0], setCountries = _e[1];
|
|
57
56
|
var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
|
|
58
57
|
var t = useTranslation().t;
|
|
59
58
|
var isAr = useLanguage().isAr;
|
|
60
59
|
var control = useFormContext().control;
|
|
61
|
-
var data = useAppSelector(individualSelector).data;
|
|
62
|
-
var verify = data.verify;
|
|
63
|
-
var user = (verify.responseBody || {}).user;
|
|
64
60
|
var issuedCountryControl = useController({ control: control, name: 'issuedCountry' });
|
|
65
61
|
var disabled = false;
|
|
66
62
|
var onOpenCountrySelect = function (event) {
|
|
67
63
|
var _a;
|
|
64
|
+
if (readOnly)
|
|
65
|
+
return;
|
|
68
66
|
setAnchorEl(event.currentTarget);
|
|
69
67
|
(_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
70
68
|
};
|
|
@@ -5,6 +5,7 @@ interface MobileNumberProps {
|
|
|
5
5
|
show: boolean;
|
|
6
6
|
onListOpen?: () => void;
|
|
7
7
|
onListClose?: () => void;
|
|
8
|
+
readOnly?: boolean;
|
|
8
9
|
}
|
|
9
10
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<MobileNumberProps & React.RefAttributes<unknown>>>;
|
|
10
11
|
export default _default;
|
|
@@ -80,7 +80,7 @@ var InputStyled = styled(Input)(function () { return ({
|
|
|
80
80
|
}); });
|
|
81
81
|
var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
82
82
|
var _b, _c, _d;
|
|
83
|
-
var countries = _a.countries, rest = __rest(_a, ["countries"]);
|
|
83
|
+
var countries = _a.countries, readOnly = _a.readOnly, rest = __rest(_a, ["countries", "readOnly"]);
|
|
84
84
|
var _e = React.useState(countries || []), countriesCode = _e[0], setCountries = _e[1];
|
|
85
85
|
var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
|
|
86
86
|
var t = useTranslation().t;
|
|
@@ -97,8 +97,6 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
97
97
|
var mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
|
|
98
98
|
var isStartsWith5 = mobileValue.startsWith('5');
|
|
99
99
|
var requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
|
|
100
|
-
var verify = data.verify;
|
|
101
|
-
var user = (verify.responseBody || {}).user;
|
|
102
100
|
var disabled = false;
|
|
103
101
|
React.useEffect(function () {
|
|
104
102
|
if (mobileValue)
|
|
@@ -137,7 +135,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
137
135
|
setValue('mobile', '');
|
|
138
136
|
countryCodeControl.field.onChange(country);
|
|
139
137
|
};
|
|
140
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 3 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredLen }, type: 'tel', disabled: disabled || !!anchorEl, onClick: onCloseCountryList, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: disabled ? undefined : function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: disabled ? (_jsx(_Fragment, {})) : !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { length: requiredLen, number: '05|5' }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', searchValuePath: ['name.arabic', 'name.english'], list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
138
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 3 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { readOnly: readOnly, inputProps: { maxLength: requiredLen }, type: 'tel', disabled: disabled || !!anchorEl, onClick: onCloseCountryList, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: disabled || readOnly ? undefined : function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: disabled ? (_jsx(_Fragment, {})) : !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { length: requiredLen, number: '05|5' }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', searchValuePath: ['name.arabic', 'name.english'], list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
141
139
|
return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsxs(CountryCodeText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: ["+", item.idd_prefix] })), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) && _jsx(CheckIcon, {})] }));
|
|
142
140
|
} }) }))] })) })));
|
|
143
141
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export interface NameProps {
|
|
3
3
|
show: boolean;
|
|
4
|
+
readOnly?: boolean;
|
|
4
5
|
}
|
|
5
|
-
declare const _default: React.MemoExoticComponent<({ show }: NameProps) => JSX.Element>;
|
|
6
|
+
declare const _default: React.MemoExoticComponent<({ show, readOnly }: NameProps) => JSX.Element>;
|
|
6
7
|
export default _default;
|
|
@@ -29,7 +29,7 @@ var InputStyled = styled(Input)(function () { return ({
|
|
|
29
29
|
}); });
|
|
30
30
|
var Name = function (_a) {
|
|
31
31
|
var _b;
|
|
32
|
-
var show = _a.show;
|
|
32
|
+
var show = _a.show, readOnly = _a.readOnly;
|
|
33
33
|
var t = useTranslation().t;
|
|
34
34
|
var control = useFormContext().control;
|
|
35
35
|
var nameControl = useController({ name: 'name', control: control });
|
|
@@ -46,6 +46,6 @@ var Name = function (_a) {
|
|
|
46
46
|
var clearNumber = function () {
|
|
47
47
|
nameControl.field.onChange('');
|
|
48
48
|
};
|
|
49
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mb: 3, mt: 2.5 } }, { children: _jsx(InputStyled, { label: t('signup_merchant_name_label'), value: nameValue, disabled: disabled, onChange: handleNameChange, placeholder: t('signup_merchant_name_label'), warningType: 'alert', warningMessage: error && t(error), endAdornment: !error && nameValue ? _jsx(CheckIcon, {}) : nameValue && _jsx(ClearIcon, { onClick: clearNumber }) }) })) })));
|
|
49
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mb: 3, mt: 2.5 } }, { children: _jsx(InputStyled, { readOnly: readOnly, label: t('signup_merchant_name_label'), value: nameValue, disabled: disabled, onChange: handleNameChange, placeholder: t('signup_merchant_name_label'), warningType: 'alert', warningMessage: error && t(error), endAdornment: !error && nameValue ? _jsx(CheckIcon, {}) : nameValue && _jsx(ClearIcon, { onClick: clearNumber }) }) })) })));
|
|
50
50
|
};
|
|
51
51
|
export default React.memo(Name);
|
|
@@ -5,6 +5,7 @@ interface NationalityProps {
|
|
|
5
5
|
show: boolean;
|
|
6
6
|
onListOpen?: () => void;
|
|
7
7
|
onListClose?: () => void;
|
|
8
|
+
readOnly?: boolean;
|
|
8
9
|
}
|
|
9
10
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<NationalityProps & React.RefAttributes<unknown>>>;
|
|
10
11
|
export default _default;
|
|
@@ -27,14 +27,13 @@ import { useTranslation } from 'react-i18next';
|
|
|
27
27
|
import { useController, useFormContext } from 'react-hook-form';
|
|
28
28
|
import { styled } from '@mui/material/styles';
|
|
29
29
|
import CheckIcon from '@mui/icons-material/Check';
|
|
30
|
-
import { useLanguage
|
|
30
|
+
import { useLanguage } from '../../../../hooks';
|
|
31
31
|
import Collapse from '../../../../components/Collapse';
|
|
32
32
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
33
33
|
import Text from '../../../../components/Text';
|
|
34
34
|
import SimpleList from '../../../../components/SimpleList';
|
|
35
35
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
36
36
|
import Input from '../../../shared/Input';
|
|
37
|
-
import { individualSelector } from '../../../app/individual/individualStore';
|
|
38
37
|
var CountryItemContainer = styled(Box)(function () { return ({
|
|
39
38
|
display: 'flex'
|
|
40
39
|
}); });
|
|
@@ -52,19 +51,18 @@ var CheckIconStyled = styled(CheckIcon)(function (_a) {
|
|
|
52
51
|
});
|
|
53
52
|
var Nationality = React.forwardRef(function (_a, ref) {
|
|
54
53
|
var _b, _c, _d;
|
|
55
|
-
var countries = _a.countries, rest = __rest(_a, ["countries"]);
|
|
54
|
+
var countries = _a.countries, readOnly = _a.readOnly, rest = __rest(_a, ["countries", "readOnly"]);
|
|
56
55
|
var _e = React.useState(countries), locationCountries = _e[0], setCountries = _e[1];
|
|
57
56
|
var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
|
|
58
57
|
var t = useTranslation().t;
|
|
59
58
|
var isAr = useLanguage().isAr;
|
|
60
59
|
var control = useFormContext().control;
|
|
61
|
-
var data = useAppSelector(individualSelector).data;
|
|
62
|
-
var verify = data.verify;
|
|
63
|
-
var user = (verify.responseBody || {}).user;
|
|
64
60
|
var nationalityControl = useController({ control: control, name: 'nationality' });
|
|
65
61
|
var disabled = false;
|
|
66
62
|
var onOpenCountrySelect = function (event) {
|
|
67
63
|
var _a;
|
|
64
|
+
if (readOnly)
|
|
65
|
+
return;
|
|
68
66
|
setAnchorEl(event.currentTarget);
|
|
69
67
|
(_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
70
68
|
};
|
|
@@ -7,6 +7,7 @@ interface MobileNumberProps {
|
|
|
7
7
|
onListOpen?: () => void;
|
|
8
8
|
onListClose?: () => void;
|
|
9
9
|
sx?: SxProps<Theme>;
|
|
10
|
+
readOnly?: boolean;
|
|
10
11
|
}
|
|
11
12
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<MobileNumberProps & React.RefAttributes<unknown>>>;
|
|
12
13
|
export default _default;
|
|
@@ -80,7 +80,7 @@ var InputStyled = styled(Input)(function () { return ({
|
|
|
80
80
|
}); });
|
|
81
81
|
var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
82
82
|
var _b, _c, _d;
|
|
83
|
-
var countries = _a.countries, sx = _a.sx, rest = __rest(_a, ["countries", "sx"]);
|
|
83
|
+
var countries = _a.countries, sx = _a.sx, readOnly = _a.readOnly, rest = __rest(_a, ["countries", "sx", "readOnly"]);
|
|
84
84
|
var _e = React.useState(countries || []), countriesCode = _e[0], setCountries = _e[1];
|
|
85
85
|
var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
|
|
86
86
|
var t = useTranslation().t;
|
|
@@ -98,7 +98,6 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
98
98
|
var isStartsWith5 = mobileValue.startsWith('5');
|
|
99
99
|
var requiredLen = isSA && isStartsWith5 ? mobileLen - 1 : mobileLen;
|
|
100
100
|
var verify = data.verify;
|
|
101
|
-
var user = (verify.responseBody || {}).user;
|
|
102
101
|
React.useEffect(function () {
|
|
103
102
|
if (mobileValue)
|
|
104
103
|
setValue('mobile', mobileValue, { shouldValidate: true });
|
|
@@ -136,7 +135,11 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
136
135
|
setValue('mobile', '');
|
|
137
136
|
countryCodeControl.field.onChange(country);
|
|
138
137
|
};
|
|
139
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: sx }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredLen }, type: 'tel', disabled: !!anchorEl, onClick: onCloseCountryList, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () {
|
|
138
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: sx }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { readOnly: readOnly, inputProps: { maxLength: requiredLen }, type: 'tel', disabled: !!anchorEl, onClick: onCloseCountryList, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () {
|
|
139
|
+
if (readOnly)
|
|
140
|
+
return;
|
|
141
|
+
toggleCountryList();
|
|
142
|
+
} }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { length: requiredLen, number: '05|5' }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', searchValuePath: ['name.arabic', 'name.english'], list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
140
143
|
return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsxs(CountryCodeText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: ["+", item.idd_prefix] })), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) && _jsx(CheckIcon, {})] }));
|
|
141
144
|
} }) }))] })) })));
|
|
142
145
|
});
|
|
@@ -55,6 +55,6 @@ var PhoneInfo = function (_a) {
|
|
|
55
55
|
dispatch(clearError());
|
|
56
56
|
}, [methods.formState.isValid]);
|
|
57
57
|
var disabled = !methods.formState.isValid || !!error;
|
|
58
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(MobileNumber, { show: true, sx: { mb: 7.5 }, countries: countries, onListOpen: function () { return setListActive(true); }, onListClose: function () { return setListActive(false); } }), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
58
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(MobileNumber, { readOnly: !settingsData.boardMaturity && !!mobile, show: true, sx: { mb: 7.5 }, countries: countries, onListOpen: function () { return setListActive(true); }, onListClose: function () { return setListActive(false); } }), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
59
59
|
};
|
|
60
60
|
export default React.memo(PhoneInfo);
|
|
@@ -6,6 +6,7 @@ interface SaleChannelIconsInputProps {
|
|
|
6
6
|
selectedIconId: string;
|
|
7
7
|
onChangeValue: (val: string, id: string) => void;
|
|
8
8
|
error: string | undefined;
|
|
9
|
+
readOnly?: boolean;
|
|
9
10
|
}
|
|
10
|
-
export default function SaleChannelIconsInput({ selectedChannels, onSelectIcon, selectedIconId, onChangeValue, error }: SaleChannelIconsInputProps): JSX.Element;
|
|
11
|
+
export default function SaleChannelIconsInput({ selectedChannels, onSelectIcon, selectedIconId, onChangeValue, error, readOnly }: SaleChannelIconsInputProps): JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -67,7 +67,7 @@ var SocialMediaButtonStyled = styled(ToggleButton, {
|
|
|
67
67
|
});
|
|
68
68
|
});
|
|
69
69
|
export default function SaleChannelIconsInput(_a) {
|
|
70
|
-
var selectedChannels = _a.selectedChannels, onSelectIcon = _a.onSelectIcon, selectedIconId = _a.selectedIconId, onChangeValue = _a.onChangeValue, error = _a.error;
|
|
70
|
+
var selectedChannels = _a.selectedChannels, onSelectIcon = _a.onSelectIcon, selectedIconId = _a.selectedIconId, onChangeValue = _a.onChangeValue, error = _a.error, readOnly = _a.readOnly;
|
|
71
71
|
var isAr = useLanguage().isAr;
|
|
72
72
|
var t = useTranslation().t;
|
|
73
73
|
var getPlaceHolder = function (item) {
|
|
@@ -90,10 +90,10 @@ export default function SaleChannelIconsInput(_a) {
|
|
|
90
90
|
var isActive = selectedIconId === channel.id;
|
|
91
91
|
return ((_a = channel.sub) === null || _a === void 0 ? void 0 : _a.length) ? (channel.sub.map(function (sub, subIndex) {
|
|
92
92
|
var isSubActive = selectedIconId === sub.id;
|
|
93
|
-
return (_jsx(Collapse, __assign({ in: isSubActive, timeout: 300 }, { children: _jsx(InputStyled, { onChange: function (e) {
|
|
93
|
+
return (_jsx(Collapse, __assign({ in: isSubActive, timeout: 300 }, { children: _jsx(InputStyled, { readOnly: readOnly, onChange: function (e) {
|
|
94
94
|
onChangeValue(e.target.value, sub.id);
|
|
95
95
|
}, value: sub.address || '', startAdornment: _jsx(TextStyled, __assign({ sx: __assign({}, (isTwitter(sub.code) && { fontSize: '20px' })) }, { children: isWebsite(sub.code) ? "https://www." : isTwitter(sub.code) ? "@" : '' })), placeholder: t(getPlaceHolder(sub)) }) }), "sub_".concat(subIndex)));
|
|
96
|
-
})) : (_jsx(Collapse, __assign({ in: isActive, timeout: 300 }, { children: _jsx(InputStyled, { onChange: function (e) {
|
|
96
|
+
})) : (_jsx(Collapse, __assign({ in: isActive, timeout: 300 }, { children: _jsx(InputStyled, { readOnly: readOnly, onChange: function (e) {
|
|
97
97
|
onChangeValue(e.target.value, channel.id);
|
|
98
98
|
}, value: channel.address || '', startAdornment: _jsx(TextStyled, __assign({ sx: __assign({}, (isTwitter(channel.code) && { fontSize: '20px' })) }, { children: isWebsite(channel.code) ? "https://www." : isTwitter(channel.code) ? "@" : '' })), placeholder: t(getPlaceHolder(channel)) }) }), index));
|
|
99
99
|
}), _jsx(Collapse, __assign({ in: !!(error && error !== 'choose_atleast_one_channel') }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: t(error) })) }))] })) })));
|
|
@@ -7,6 +7,7 @@ interface SalesChannelProps {
|
|
|
7
7
|
defaultValue?: SaleChannel[];
|
|
8
8
|
selectFirstIconListener?: string | number | boolean;
|
|
9
9
|
disabled?: boolean;
|
|
10
|
+
readOnly?: boolean;
|
|
10
11
|
}
|
|
11
|
-
declare const _default: React.MemoExoticComponent<({ list, onChange, error, disabled, defaultValue, selectFirstIconListener }: SalesChannelProps) => JSX.Element>;
|
|
12
|
+
declare const _default: React.MemoExoticComponent<({ list, onChange, error, disabled, readOnly, defaultValue, selectFirstIconListener }: SalesChannelProps) => JSX.Element>;
|
|
12
13
|
export default _default;
|
|
@@ -74,7 +74,7 @@ var CollapseStyled = styled(Collapse)(function (_a) {
|
|
|
74
74
|
});
|
|
75
75
|
});
|
|
76
76
|
var SalesChannel = function (_a) {
|
|
77
|
-
var _b = _a.list, list = _b === void 0 ? [] : _b, onChange = _a.onChange, error = _a.error, disabled = _a.disabled, _c = _a.defaultValue, defaultValue = _c === void 0 ? [] : _c, _d = _a.selectFirstIconListener, selectFirstIconListener = _d === void 0 ? '' : _d;
|
|
77
|
+
var _b = _a.list, list = _b === void 0 ? [] : _b, onChange = _a.onChange, error = _a.error, disabled = _a.disabled, readOnly = _a.readOnly, _c = _a.defaultValue, defaultValue = _c === void 0 ? [] : _c, _d = _a.selectFirstIconListener, selectFirstIconListener = _d === void 0 ? '' : _d;
|
|
78
78
|
var _e = React.useState(''), activeSaleIconId = _e[0], setActiveSaleIconId = _e[1];
|
|
79
79
|
var _f = React.useState([]), selectedSalas = _f[0], setSelectedSales = _f[1];
|
|
80
80
|
var t = useTranslation().t;
|
|
@@ -143,7 +143,7 @@ var SalesChannel = function (_a) {
|
|
|
143
143
|
}, [selectFirstIconListener]);
|
|
144
144
|
return (_jsxs(_Fragment, { children: [_jsxs(Box, __assign({ sx: { mb: 3 } }, { children: [_jsxs(InputLabelStyled, { children: [t('channel_of_service'), " ", _jsx(MandatoryStyled, { children: "*" })] }), list.map(function (channel, index) {
|
|
145
145
|
var _a, _b;
|
|
146
|
-
return (_jsxs(ContainerStyled, { children: [_jsx(CheckBoxStyled, { id: channel.id, disableRipple: true, disabled: disabled, disableFocusRipple: true, focusRipple: false, checked: isChecked(channel.id), onChange: function () { return onSelectSalesChannel(channel); } }), _jsxs(TextStyled, { children: [isAr ? (_a = channel === null || channel === void 0 ? void 0 : channel.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = channel === null || channel === void 0 ? void 0 : channel.name) === null || _b === void 0 ? void 0 : _b.en, " "] })] }, "".concat(channel.id, "-indx").concat(index)));
|
|
147
|
-
}), _jsx(CollapseStyled, __assign({ in: error === 'choose_atleast_one_channel' }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: t(error) })) }))] }), 'salesChannels'), _jsx(SaleChannelIconsInput, { error: error, selectedIconId: activeSaleIconId, onSelectIcon: onChangeActiveSaleIcon, onChangeValue: onValueChange, selectedChannels: selectedSalas }, 'saleChannelIconsInput')] }));
|
|
146
|
+
return (_jsxs(ContainerStyled, { children: [_jsx(CheckBoxStyled, { id: channel.id, disableRipple: true, disabled: disabled || readOnly, disableFocusRipple: true, focusRipple: false, checked: isChecked(channel.id), onChange: function () { return onSelectSalesChannel(channel); } }), _jsxs(TextStyled, { children: [isAr ? (_a = channel === null || channel === void 0 ? void 0 : channel.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = channel === null || channel === void 0 ? void 0 : channel.name) === null || _b === void 0 ? void 0 : _b.en, " "] })] }, "".concat(channel.id, "-indx").concat(index)));
|
|
147
|
+
}), _jsx(CollapseStyled, __assign({ in: error === 'choose_atleast_one_channel' }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: t(error) })) }))] }), 'salesChannels'), _jsx(SaleChannelIconsInput, { readOnly: readOnly, error: error, selectedIconId: activeSaleIconId, onSelectIcon: onChangeActiveSaleIcon, onChangeValue: onValueChange, selectedChannels: selectedSalas }, 'saleChannelIconsInput')] }));
|
|
148
148
|
};
|
|
149
149
|
export default React.memo(SalesChannel);
|
|
@@ -24,6 +24,8 @@ export declare type FileUploadProps = {
|
|
|
24
24
|
sx?: SxProps<Theme> | undefined;
|
|
25
25
|
isSubmitting?: boolean;
|
|
26
26
|
initialFileId?: string;
|
|
27
|
+
validFileFormats?: Array<string>;
|
|
28
|
+
readOnly?: boolean;
|
|
27
29
|
};
|
|
28
|
-
declare const FileUpload: ({ key, show, title, file, uploadedFile, onSuccess, onDelete, onUpdate, sx, purpose, isSubmitting, fileRemoveType, initialFileId }: FileUploadProps) => JSX.Element;
|
|
30
|
+
declare const FileUpload: ({ key, show, title, file, uploadedFile, onSuccess, onDelete, onUpdate, sx, purpose, isSubmitting, fileRemoveType, initialFileId, validFileFormats, readOnly }: FileUploadProps) => JSX.Element;
|
|
29
31
|
export default FileUpload;
|
|
@@ -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:
|
|
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: 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,11 +108,11 @@ 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 FileUpload = function (_a) {
|
|
111
|
-
var key = _a.key, show = _a.show, title = _a.title, file = _a.file, uploadedFile = _a.uploadedFile, onSuccess = _a.onSuccess, onDelete = _a.onDelete, onUpdate = _a.onUpdate, sx = _a.sx, purpose = _a.purpose, isSubmitting = _a.isSubmitting, fileRemoveType = _a.fileRemoveType, initialFileId = _a.initialFileId;
|
|
111
|
+
var key = _a.key, show = _a.show, title = _a.title, file = _a.file, uploadedFile = _a.uploadedFile, onSuccess = _a.onSuccess, onDelete = _a.onDelete, onUpdate = _a.onUpdate, sx = _a.sx, purpose = _a.purpose, isSubmitting = _a.isSubmitting, fileRemoveType = _a.fileRemoveType, initialFileId = _a.initialFileId, _b = _a.validFileFormats, validFileFormats = _b === void 0 ? VALID_FILE_FORMATS : _b, readOnly = _a.readOnly;
|
|
112
112
|
var theme = useTheme();
|
|
113
113
|
var t = useTranslation().t;
|
|
114
|
-
var
|
|
115
|
-
var
|
|
114
|
+
var _c = file || {}, name = _c.name, size = _c.size, type = _c.type;
|
|
115
|
+
var _d = uploadedFile || {}, status = _d.status, progress = _d.progress, error = _d.error, fileId = _d.fileId, deleteStatus = _d.deleteStatus, docId = _d.docId;
|
|
116
116
|
var uploadFile = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
117
117
|
var uploadPayload, onUploadProgress, data, fileId;
|
|
118
118
|
return __generator(this, function (_a) {
|
|
@@ -188,7 +188,7 @@ var FileUpload = function (_a) {
|
|
|
188
188
|
onUpdate(uploadedFile, true);
|
|
189
189
|
if (!(fileRemoveType === FileRemoveType.AOA_FILE_ID)) return [3, 2];
|
|
190
190
|
payload = (_b = {
|
|
191
|
-
id:
|
|
191
|
+
id: docId
|
|
192
192
|
},
|
|
193
193
|
_b[fileRemoveType] = '',
|
|
194
194
|
_b);
|
|
@@ -217,7 +217,7 @@ var FileUpload = function (_a) {
|
|
|
217
217
|
});
|
|
218
218
|
}); };
|
|
219
219
|
var handleDeleteFile = function () {
|
|
220
|
-
if (initialFileId === uploadedFile.fileId) {
|
|
220
|
+
if (initialFileId === uploadedFile.fileId && docId) {
|
|
221
221
|
deleteFile();
|
|
222
222
|
return;
|
|
223
223
|
}
|
|
@@ -237,7 +237,7 @@ var FileUpload = function (_a) {
|
|
|
237
237
|
React.useEffect(function () {
|
|
238
238
|
if (!file)
|
|
239
239
|
return;
|
|
240
|
-
else if (!
|
|
240
|
+
else if (!validFileFormats.includes(type)) {
|
|
241
241
|
uploadedFile = __assign(__assign({}, uploadedFile), { status: FileStatus.ERROR, error: t('file_not_supported_alert') });
|
|
242
242
|
onUpdate(uploadedFile, false);
|
|
243
243
|
}
|
|
@@ -258,6 +258,10 @@ var FileUpload = function (_a) {
|
|
|
258
258
|
flexDirection: 'column',
|
|
259
259
|
padding: theme.spacing(1.5, 0, 1.5),
|
|
260
260
|
width: '100%'
|
|
261
|
-
} }, { 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: name && 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 || status === FileStatus.DOWNLOADING, onClick:
|
|
261
|
+
} }, { 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: name && 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 || status === FileStatus.DOWNLOADING, onClick: function () {
|
|
262
|
+
if (readOnly)
|
|
263
|
+
return;
|
|
264
|
+
canDeleteFile && handleDeleteFile();
|
|
265
|
+
} }, { children: deleteStatus === DeleteFileStatus.DELETING ? (_jsx(MUICircularProgress, { size: 25, thickness: 5, sx: { color: theme.palette.common.white } })) : (_jsx(ClearIconStyled, {})) }))] })) }), key) })));
|
|
262
266
|
};
|
|
263
267
|
export default FileUpload;
|
|
@@ -28,6 +28,8 @@ interface UploadWrapperProps {
|
|
|
28
28
|
fileUploadingStatus?: (uploading: boolean) => void;
|
|
29
29
|
onDeleteFile: () => void;
|
|
30
30
|
defaultFile?: FileDetails;
|
|
31
|
+
validFileFormats?: Array<string>;
|
|
32
|
+
readOnly?: boolean;
|
|
31
33
|
}
|
|
32
|
-
declare const _default: React.MemoExoticComponent<({ id, label, control, required, fileRemoveType, title, subTitle, dragDescription, uploadingTitle, successTitle, isSubmitting, onFileUploaded, fileUploadingStatus, onDeleteFile, purpose, fileTitle, defaultFile }: UploadWrapperProps) => JSX.Element>;
|
|
34
|
+
declare const _default: React.MemoExoticComponent<({ id, label, control, required, fileRemoveType, title, subTitle, dragDescription, uploadingTitle, successTitle, isSubmitting, onFileUploaded, fileUploadingStatus, onDeleteFile, purpose, fileTitle, defaultFile, validFileFormats, readOnly }: UploadWrapperProps) => JSX.Element>;
|
|
33
35
|
export default _default;
|
|
@@ -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';
|
|
@@ -39,7 +40,7 @@ var TaxDetails = function () {
|
|
|
39
40
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
40
41
|
var _b = data.taxData, vatId = _b.vatId, confirmPolicy = _b.confirmPolicy, documentId = _b.documentId;
|
|
41
42
|
var methods = useForm({
|
|
42
|
-
resolver: yupResolver(Validation(
|
|
43
|
+
resolver: yupResolver(Validation()),
|
|
43
44
|
defaultValues: {
|
|
44
45
|
vatId: vatId,
|
|
45
46
|
confirmPolicy: confirmPolicy,
|
|
@@ -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;
|