@tap-payments/auth-jsconnect 2.0.43-test → 2.0.44
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 +50 -20
- package/build/@types/app.js +9 -3
- package/build/@types/form.d.ts +21 -12
- package/build/api/auth.d.ts +28 -5
- package/build/api/auth.js +36 -1
- package/build/api/axios.js +2 -2
- package/build/api/brand.d.ts +2 -1
- package/build/api/brand.js +10 -1
- package/build/api/country.d.ts +3 -1
- package/build/api/country.js +3 -1
- package/build/api/data.d.ts +38 -7
- package/build/api/data.js +57 -17
- package/build/api/entity.d.ts +51 -5
- package/build/api/entity.js +39 -9
- package/build/api/firebase.d.ts +1 -1
- package/build/api/firebase.js +3 -1
- package/build/api/index.d.ts +44 -14
- package/build/api/individual.d.ts +76 -19
- package/build/api/individual.js +29 -2
- package/build/api/lead.d.ts +9 -6
- package/build/api/lead.js +8 -1
- package/build/app/rootReducer.d.ts +0 -1
- package/build/app/rootReducer.js +0 -2
- package/build/app/settings.d.ts +9 -2
- package/build/app/settings.js +22 -11
- package/build/app/store.d.ts +0 -2
- package/build/assets/locales/ar.json +258 -183
- package/build/assets/locales/en.json +190 -108
- package/build/components/AnimationFlow/AnimationFlow.d.ts +4 -1
- package/build/components/AnimationFlow/AnimationFlow.js +6 -8
- package/build/components/AnimationFlow/BottomSheet.d.ts +2 -1
- package/build/components/AnimationFlow/BottomSheet.js +4 -3
- package/build/components/AnimationFlow/Dialog.d.ts +4 -1
- package/build/components/AnimationFlow/Dialog.js +5 -3
- package/build/components/ArabicDatePicker/ArabicDatePicker.d.ts +13 -0
- package/build/components/ArabicDatePicker/ArabicDatePicker.js +94 -0
- package/build/components/ArabicDatePicker/index.d.ts +2 -0
- package/build/components/ArabicDatePicker/index.js +2 -0
- package/build/components/ArabicDatePicker/style.css +24 -0
- package/build/components/FileInput/DragAndDrop.d.ts +10 -1
- package/build/components/FileInput/DragAndDrop.js +108 -8
- package/build/components/Lottie/Lottie.d.ts +878 -0
- package/build/components/Lottie/Lottie.js +58 -0
- package/build/components/Lottie/files/pulsating_circle_waves.json +236 -0
- package/build/components/Lottie/files/success.json +425 -0
- package/build/components/Lottie/index.d.ts +3 -0
- package/build/components/Lottie/index.js +3 -0
- package/build/components/OTPField/OTPField.d.ts +2 -1
- package/build/components/OTPField/OTPField.js +2 -2
- package/build/components/OTPTimer/OTPTimer.js +1 -1
- package/build/components/ProgressBar/CircularProgressBar.d.ts +14 -0
- package/build/components/ProgressBar/CircularProgressBar.js +48 -0
- package/build/components/ProgressBar/index.d.ts +2 -0
- package/build/components/ProgressBar/index.js +2 -0
- package/build/components/RadioLabel/RadioLabel.d.ts +2 -1
- package/build/components/RadioLabel/RadioLabel.js +2 -2
- package/build/components/SocialMediaGroup/SocialMediaGroup.d.ts +2 -6
- package/build/components/SocialMediaGroup/SocialMediaGroup.js +4 -49
- package/build/constants/api.d.ts +6 -0
- package/build/constants/api.js +14 -1
- package/build/constants/app.d.ts +5 -5
- package/build/constants/app.js +62 -32
- package/build/constants/assets.d.ts +14 -0
- package/build/constants/assets.js +16 -2
- package/build/constants/dummy.d.ts +1 -1
- package/build/constants/dummy.js +2 -2
- package/build/constants/validation.d.ts +10 -0
- package/build/constants/validation.js +11 -1
- package/build/features/app/auth/authStore.d.ts +30 -4
- package/build/features/app/auth/authStore.js +182 -20
- package/build/features/app/bank/bankStore.d.ts +16 -0
- package/build/features/app/bank/bankStore.js +88 -41
- package/build/features/app/business/businessStore.d.ts +22 -3
- package/build/features/app/business/businessStore.js +445 -296
- package/build/features/app/connect/connectStore.d.ts +34 -31
- package/build/features/app/connect/connectStore.js +427 -300
- package/build/features/app/entity/entityStore.d.ts +40 -8
- package/build/features/app/entity/entityStore.js +389 -149
- package/build/features/app/individual/individualStore.d.ts +18 -0
- package/build/features/app/individual/individualStore.js +178 -85
- package/build/features/app/password/passwordStore.d.ts +1 -7
- package/build/features/app/password/passwordStore.js +31 -20
- package/build/features/app/tax/taxStore.js +23 -16
- package/build/features/auth/Auth.d.ts +2 -1
- package/build/features/auth/Auth.js +37 -9
- package/build/features/auth/screens/NID/DOB.d.ts +7 -0
- package/build/features/auth/screens/NID/DOB.js +47 -0
- package/build/features/auth/screens/NID/IDNumber.d.ts +3 -0
- package/build/features/auth/screens/NID/IDNumber.js +64 -0
- package/build/features/auth/screens/NID/NID.d.ts +5 -0
- package/build/features/auth/screens/NID/NID.js +68 -0
- package/build/features/auth/screens/NID/TAC.d.ts +3 -0
- package/build/features/auth/screens/NID/TAC.js +87 -0
- package/build/features/auth/screens/NID/index.d.ts +3 -0
- package/build/features/auth/screens/NID/index.js +2 -0
- package/build/features/auth/screens/NID/validation.d.ts +27 -0
- package/build/features/auth/screens/NID/validation.js +19 -0
- package/build/features/auth/screens/OTP/OTP.js +8 -4
- package/build/features/auth/screens/OTP/OTPInput.js +9 -2
- package/build/features/bank/Bank.js +4 -4
- package/build/features/bank/screens/BankDetails/BankDetails.js +18 -5
- package/build/features/bank/screens/BankDetails/BankName.js +2 -1
- package/build/features/bank/screens/BankDetails/BankStatement.js +41 -8
- package/build/features/bank/screens/BankDetails/Beneficiary.js +10 -11
- package/build/features/bank/screens/BankDetails/validation.js +2 -2
- package/build/features/bank/screens/Success/Success.js +7 -3
- package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -11
- package/build/features/business/Business.js +4 -4
- package/build/features/business/screens/Activities/Activities.js +16 -17
- package/build/features/business/screens/Activities/ActivitiesList.d.ts +37 -1
- package/build/features/business/screens/Activities/ActivitiesList.js +51 -12
- package/build/features/business/screens/Activities/OperationStartDate.d.ts +15 -1
- package/build/features/business/screens/Activities/OperationStartDate.js +21 -2
- package/build/features/business/screens/Activities/validation.d.ts +0 -51
- package/build/features/business/screens/Activities/validation.js +0 -9
- package/build/features/business/screens/BusinessType/BusinessType.js +20 -7
- package/build/features/business/screens/BusinessType/EntityName.d.ts +6 -0
- package/build/features/business/screens/BusinessType/EntityName.js +56 -0
- package/build/features/business/screens/BusinessType/LicenseCertificate.d.ts +6 -0
- package/build/features/business/screens/BusinessType/LicenseCertificate.js +76 -0
- package/build/features/business/screens/BusinessType/LicenseList.js +26 -7
- package/build/features/business/screens/BusinessType/LicenseNumber.js +12 -6
- package/build/features/business/screens/BusinessType/LicenseType.d.ts +6 -0
- package/build/features/business/screens/BusinessType/LicenseType.js +78 -0
- package/build/features/business/screens/BusinessType/validation.d.ts +19 -0
- package/build/features/business/screens/BusinessType/validation.js +52 -3
- package/build/features/business/screens/CivilID/CivilID.d.ts +5 -0
- package/build/features/business/screens/CivilID/CivilID.js +67 -0
- package/build/features/business/screens/CivilID/IDNumber.d.ts +7 -0
- package/build/features/business/screens/CivilID/IDNumber.js +59 -0
- package/build/features/business/screens/CivilID/index.d.ts +3 -0
- package/build/features/business/screens/CivilID/index.js +2 -0
- package/build/features/business/screens/CivilID/validation.d.ts +8 -0
- package/build/features/business/screens/CivilID/validation.js +4 -0
- package/build/features/business/screens/Customers/CustomerLocations.d.ts +15 -2
- package/build/features/business/screens/Customers/CustomerLocations.js +32 -8
- package/build/features/business/screens/Customers/Customers.js +15 -9
- package/build/features/business/screens/Customers/ExpectedCustomers.js +16 -4
- package/build/features/business/screens/Customers/ExpectedSalesRange.js +32 -14
- package/build/features/business/screens/Customers/RefundPolicy.js +8 -2
- package/build/features/business/screens/Customers/TransactionPolicy.js +8 -2
- package/build/features/business/screens/IDBOD/IDBOD.js +15 -2
- package/build/features/business/screens/OTP/OTP.js +15 -2
- package/build/features/business/screens/Success/Success.js +10 -3
- package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +13 -10
- package/build/features/business/screens/Verify/Verify.js +4 -4
- package/build/features/business/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACI.js +159 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACILoading.d.ts +6 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACILoading.js +23 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
- package/build/features/business/screens/VerifyPACI/index.d.ts +3 -0
- package/build/features/business/screens/VerifyPACI/index.js +2 -0
- package/build/features/connect/Connect.d.ts +1 -0
- package/build/features/connect/Connect.js +38 -10
- package/build/features/connect/screens/CivilID/CivilID.d.ts +5 -0
- package/build/features/connect/screens/CivilID/CivilID.js +102 -0
- package/build/features/connect/screens/CivilID/IDNumber.d.ts +7 -0
- package/build/features/connect/screens/CivilID/IDNumber.js +59 -0
- package/build/features/connect/screens/CivilID/index.d.ts +3 -0
- package/build/features/connect/screens/CivilID/index.js +2 -0
- package/build/features/connect/screens/CivilID/validation.d.ts +8 -0
- package/build/features/connect/screens/CivilID/validation.js +4 -0
- package/build/features/connect/screens/Individual/Email.js +11 -3
- package/build/features/connect/screens/Individual/Individual.js +48 -28
- package/build/features/connect/screens/Merchant/BrandList.js +15 -7
- package/build/features/connect/screens/Merchant/BrandName.js +7 -4
- package/build/features/connect/screens/Merchant/Merchant.js +41 -64
- package/build/features/connect/screens/Merchant/SalesChannels.d.ts +3 -1
- package/build/features/connect/screens/Merchant/SalesChannels.js +30 -31
- package/build/features/connect/screens/Merchant/SocialMedia.d.ts +1 -4
- package/build/features/connect/screens/Merchant/SocialMedia.js +129 -109
- package/build/features/connect/screens/Merchant/TAC.js +8 -2
- package/build/features/connect/screens/Merchant/validation.d.ts +13 -123
- package/build/features/connect/screens/Merchant/validation.js +108 -173
- package/build/features/connect/screens/Mobile/Mobile.js +33 -12
- package/build/features/connect/screens/NID/NID.js +5 -1
- package/build/features/connect/screens/OTP/OTP.js +20 -6
- package/build/features/connect/screens/OTP/OTPInput.js +3 -2
- package/build/features/connect/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +159 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.d.ts +6 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.js +23 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
- package/build/features/connect/screens/VerifyPACI/index.d.ts +3 -0
- package/build/features/connect/screens/VerifyPACI/index.js +2 -0
- package/build/features/entity/Entity.js +6 -6
- package/build/features/entity/screens/Customers/CustomerLocations.d.ts +118 -0
- package/build/features/entity/screens/Customers/CustomerLocations.js +171 -0
- package/build/features/entity/screens/Customers/Customers.d.ts +5 -0
- package/build/features/entity/screens/Customers/Customers.js +90 -0
- package/build/features/entity/screens/Customers/ExpectedCustomers.d.ts +8 -0
- package/build/features/entity/screens/Customers/ExpectedCustomers.js +98 -0
- package/build/features/entity/screens/Customers/ExpectedSalesRange.d.ts +8 -0
- package/build/features/entity/screens/Customers/ExpectedSalesRange.js +127 -0
- package/build/features/entity/screens/Customers/RefundPolicy.d.ts +36 -0
- package/build/features/entity/screens/Customers/RefundPolicy.js +84 -0
- package/build/features/entity/screens/Customers/TransactionPolicy.d.ts +3 -0
- package/build/features/entity/screens/Customers/TransactionPolicy.js +44 -0
- package/build/features/entity/screens/Customers/index.d.ts +3 -0
- package/build/features/entity/screens/Customers/index.js +2 -0
- package/build/features/entity/screens/Customers/validation.d.ts +20 -0
- package/build/features/entity/screens/Customers/validation.js +13 -0
- package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.d.ts +2 -1
- package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.js +25 -15
- package/build/features/entity/screens/EntityInfoConfirm/Article.d.ts +3 -0
- package/build/features/entity/screens/EntityInfoConfirm/Article.js +73 -0
- package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +38 -10
- package/build/features/entity/screens/EntityInfoConfirm/LicenseName.js +20 -5
- package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.d.ts +2 -1
- package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.js +34 -5
- package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.js +13 -18
- package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +75 -41
- package/build/features/entity/screens/EntityInfoConfirm/validation.js +76 -10
- package/build/features/entity/screens/Success/Success.js +7 -3
- package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +9 -8
- package/build/features/entity/screens/Verify/Verify.js +18 -5
- package/build/features/featuresScreens.d.ts +0 -1
- package/build/features/featuresScreens.js +30 -7
- package/build/features/individual/Individual.js +4 -4
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +18 -25
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +15 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +11 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +2 -2
- package/build/features/individual/screens/Success/Success.js +7 -3
- package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -11
- package/build/features/individual/screens/Verify/Verify.js +18 -5
- package/build/features/password/Password.js +4 -4
- package/build/features/password/screens/CreatePassword/CreatePassword.js +16 -3
- package/build/features/password/screens/OTP/OTP.js +15 -2
- package/build/features/password/screens/Success/Success.js +7 -3
- package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +15 -12
- package/build/features/password/screens/Verify/Verify.js +16 -3
- package/build/features/shared/Background/Background.d.ts +2 -5
- package/build/features/shared/Background/Background.js +7 -3
- package/build/features/shared/Button/EmailProvidersButtons.d.ts +2 -1
- package/build/features/shared/Button/EmailProvidersButtons.js +7 -2
- package/build/features/shared/Button/MobileButton.d.ts +2 -1
- package/build/features/shared/Button/MobileButton.js +2 -2
- package/build/features/shared/Dialog/CloseDialog.d.ts +11 -0
- package/build/features/shared/Dialog/CloseDialog.js +71 -0
- package/build/features/shared/Dialog/DialogContainer.d.ts +8 -0
- package/build/features/shared/Dialog/DialogContainer.js +56 -0
- package/build/features/shared/Dialog/index.d.ts +4 -0
- package/build/features/shared/Dialog/index.js +4 -0
- package/build/features/shared/Input/Input.d.ts +1 -1
- package/build/features/shared/Input/Input.js +2 -2
- package/build/features/shared/SuccessScreen/SuccessScreen.js +3 -2
- package/build/features/shared/UploadFile/UploadFile.d.ts +10 -3
- package/build/features/shared/UploadFile/UploadFile.js +24 -9
- package/build/features/signIn/SignIn.js +4 -4
- package/build/features/signIn/screens/Email/Email.js +4 -2
- package/build/features/signIn/screens/Mobile/Mobile.js +5 -1
- package/build/features/signIn/screens/OTP/OTP.js +14 -1
- package/build/features/signIn/screens/Password/Password.js +15 -2
- package/build/features/tax/Tax.js +6 -6
- package/build/features/tax/screens/Success/Success.js +9 -3
- package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +14 -10
- package/build/features/tax/screens/TaxDetails/TaxDetails.js +16 -3
- package/build/features/tax/screens/Verify/Verify.js +16 -3
- package/build/hooks/index.d.ts +2 -0
- package/build/hooks/index.js +2 -0
- package/build/hooks/useAppConfig.d.ts +3 -1
- package/build/hooks/useAppConfig.js +2 -2
- package/build/hooks/useAppDispatch.d.ts +0 -1
- package/build/hooks/useErrorListener.js +0 -6
- package/build/hooks/useScreen.d.ts +3 -0
- package/build/hooks/useScreen.js +14 -0
- package/build/hooks/useSetFromDefaultValues.d.ts +2 -0
- package/build/hooks/useSetFromDefaultValues.js +24 -0
- package/build/index.d.ts +2 -3
- package/build/index.js +1 -4
- package/build/utils/array.d.ts +49 -1
- package/build/utils/array.js +58 -0
- package/build/utils/common.d.ts +1 -0
- package/build/utils/common.js +3 -0
- package/build/utils/device.d.ts +1 -0
- package/build/utils/device.js +13 -0
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.js +1 -0
- package/build/utils/locale.js +1 -1
- package/build/utils/object.d.ts +1 -0
- package/build/utils/object.js +12 -0
- package/build/utils/string.d.ts +13 -0
- package/build/utils/string.js +71 -1
- package/build/utils/validation.d.ts +2 -0
- package/build/utils/validation.js +6 -0
- package/package.json +4 -3
- package/build/features/app/otp/otpStore.d.ts +0 -28
- package/build/features/app/otp/otpStore.js +0 -153
- package/build/features/business/screens/Activities/SalesChannels.d.ts +0 -5
- package/build/features/business/screens/Activities/SalesChannels.js +0 -112
- package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.d.ts +0 -5
- package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.js +0 -112
- package/build/features/otp/OTP.d.ts +0 -7
- package/build/features/otp/OTP.js +0 -58
- package/build/features/otp/index.d.ts +0 -0
- package/build/features/otp/index.js +0 -1
- package/build/features/otp/screens/OTPVerify/OTPInput.d.ts +0 -6
- package/build/features/otp/screens/OTPVerify/OTPInput.js +0 -47
- package/build/features/otp/screens/OTPVerify/Verify.d.ts +0 -5
- package/build/features/otp/screens/OTPVerify/Verify.js +0 -49
- package/build/features/otp/screens/OTPVerify/index.d.ts +0 -2
- package/build/features/otp/screens/OTPVerify/index.js +0 -2
- package/build/features/otp/screens/OTPVerify/validation.d.ts +0 -8
- package/build/features/otp/screens/OTPVerify/validation.js +0 -4
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
7
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
8
|
+
import { entitySelector, uploadArticle } from '../../../app/entity/entityStore';
|
|
9
|
+
import UploadFile from '../../../shared/UploadFile';
|
|
10
|
+
import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
|
|
11
|
+
import { maskFileName } from '../../../../utils';
|
|
12
|
+
var FeatureStyled = styled(ScreenContainer)(function (_a) {
|
|
13
|
+
var theme = _a.theme;
|
|
14
|
+
return ({
|
|
15
|
+
marginBlockStart: theme.spacing(3)
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
var Article = function () {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
var _c = React.useState(0), progress = _c[0], setProgress = _c[1];
|
|
21
|
+
var t = useTranslation().t;
|
|
22
|
+
var _d = useFormContext(), control = _d.control, setError = _d.setError, clearErrors = _d.clearErrors, setValue = _d.setValue;
|
|
23
|
+
var articleFileControl = useController({ name: 'articleFile', control: control });
|
|
24
|
+
var articleIdControl = useController({ name: 'articleId', control: control });
|
|
25
|
+
var _e = useAppSelector(entitySelector), loading = _e.loading, uploading = _e.uploading, sysError = _e.error, data = _e.data;
|
|
26
|
+
var dispatch = useAppDispatch();
|
|
27
|
+
var articleValue = articleFileControl.field.value;
|
|
28
|
+
var error = ((_a = articleFileControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message) || ((_b = articleIdControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message);
|
|
29
|
+
var entityData = data.entityData;
|
|
30
|
+
var articleFile = entityData.articleFile, articleId = entityData.articleId;
|
|
31
|
+
React.useEffect(function () {
|
|
32
|
+
if (!articleValue) {
|
|
33
|
+
setValue('articleFile', articleFile);
|
|
34
|
+
setValue('articleId', articleId);
|
|
35
|
+
}
|
|
36
|
+
}, [articleFile, articleId]);
|
|
37
|
+
var handleArticleChange = function (file) {
|
|
38
|
+
if (!VALID_FILE_FORMATS.includes(file === null || file === void 0 ? void 0 : file.type)) {
|
|
39
|
+
setError('articleFile', { message: 'file_not_supported_alert' });
|
|
40
|
+
}
|
|
41
|
+
else if ((file === null || file === void 0 ? void 0 : file.size) > MAX_FILE_SIZE) {
|
|
42
|
+
setError('articleFile', { message: 'file_size_alert' });
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
articleFileControl.field.onChange(file);
|
|
46
|
+
dispatch(uploadArticle({
|
|
47
|
+
file: file,
|
|
48
|
+
onProgress: function (value) {
|
|
49
|
+
setProgress(value);
|
|
50
|
+
}
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var handleReset = function () {
|
|
55
|
+
articleFileControl.field.onChange(null);
|
|
56
|
+
articleIdControl.field.onChange('');
|
|
57
|
+
setProgress(0);
|
|
58
|
+
};
|
|
59
|
+
React.useEffect(function () {
|
|
60
|
+
if (sysError === 'file_upload_error') {
|
|
61
|
+
setError('articleId', { message: sysError });
|
|
62
|
+
articleFileControl.field.onChange(null);
|
|
63
|
+
setProgress(0);
|
|
64
|
+
}
|
|
65
|
+
}, [sysError]);
|
|
66
|
+
React.useEffect(function () {
|
|
67
|
+
if ((articleFileControl.formState.isValid || !!articleValue) && error != 'file_upload_error')
|
|
68
|
+
clearErrors();
|
|
69
|
+
}, [articleFileControl.formState.isValid, articleValue]);
|
|
70
|
+
var fileName = articleValue ? maskFileName(articleValue === null || articleValue === void 0 ? void 0 : articleValue.name) : '';
|
|
71
|
+
return (_jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_article'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('article_of_association'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleArticleChange, isFileUploaded: !uploading && !!articleValue, isSubmitting: loading, isUploading: uploading, progress: progress, onReset: handleReset, error: error && t(error), initialFileName: fileName }) }));
|
|
72
|
+
};
|
|
73
|
+
export default Article;
|
|
@@ -9,48 +9,76 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
12
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
24
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
14
25
|
import LicenseName from './LicenseName';
|
|
15
26
|
import * as React from 'react';
|
|
16
27
|
import LicenseNumber from './LicenseNumber';
|
|
17
28
|
import ActivitiesList from './ActivitiesList';
|
|
18
|
-
import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
|
|
19
|
-
import { entitySelector,
|
|
29
|
+
import { useAppDispatch, useAppSelector, useLanguage, useSetFromDefaultValues } from '../../../../hooks';
|
|
30
|
+
import { entitySelector, updateEntity } from '../../../app/entity/entityStore';
|
|
20
31
|
import { FormProvider, useForm } from 'react-hook-form';
|
|
21
32
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
22
|
-
import {
|
|
33
|
+
import { BusinessType } from '../../../../@types';
|
|
34
|
+
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
23
35
|
import { styled } from '@mui/system';
|
|
24
|
-
import { EntityInfoValidationSchema } from './validation';
|
|
36
|
+
import { EntityInfoValidationSchema, EntityInfoKWValidationSchema } from './validation';
|
|
25
37
|
import Form from '../../../../components/Form';
|
|
26
38
|
import Collapse from '../../../../components/Collapse';
|
|
27
39
|
import Button from '../../../shared/Button';
|
|
28
40
|
import { useTranslation } from 'react-i18next';
|
|
29
41
|
import OperationStartDate from './OperationStartDate';
|
|
42
|
+
import Article from './Article';
|
|
43
|
+
import { isKW } from '../../../../utils';
|
|
30
44
|
var FormStyled = styled(Form)(function () { return ({
|
|
31
45
|
display: 'flex',
|
|
32
46
|
flexDirection: 'column'
|
|
33
47
|
}); });
|
|
34
48
|
var EntityInfo = function (_a) {
|
|
35
49
|
var _b = React.useState(false), anchorEl = _b[0], setAnchorEl = _b[1];
|
|
36
|
-
var _c =
|
|
50
|
+
var _c = React.useState(false), collapse = _c[0], setCollapse = _c[1];
|
|
51
|
+
var _d = useAppSelector(entitySelector), data = _d.data, loading = _d.loading, error = _d.error, uploading = _d.uploading;
|
|
52
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
37
53
|
var isAr = useLanguage().isAr;
|
|
38
54
|
var t = useTranslation().t;
|
|
39
55
|
var dispatch = useAppDispatch();
|
|
56
|
+
var defaultValues = __rest(data.entityData, []);
|
|
57
|
+
var country_code = settingsData.businessCountry.iso2;
|
|
58
|
+
var licenseType = defaultValues.licenseType;
|
|
59
|
+
var isKWCountry = React.useMemo(function () { return isKW(country_code); }, [country_code]);
|
|
60
|
+
var isCR = React.useMemo(function () { return licenseType === BusinessType.CR; }, [licenseType]);
|
|
40
61
|
var methods = useForm({
|
|
41
|
-
resolver: yupResolver(EntityInfoValidationSchema),
|
|
42
|
-
defaultValues:
|
|
62
|
+
resolver: yupResolver(isKWCountry ? EntityInfoKWValidationSchema : EntityInfoValidationSchema),
|
|
63
|
+
defaultValues: defaultValues,
|
|
43
64
|
mode: 'onChange'
|
|
44
65
|
});
|
|
66
|
+
useSetFromDefaultValues(methods, defaultValues);
|
|
45
67
|
var onSubmit = function (data) {
|
|
46
|
-
dispatch(
|
|
68
|
+
dispatch(updateEntity(__assign({}, data)));
|
|
69
|
+
};
|
|
70
|
+
var handleCollapseOpenClose = function (flag) {
|
|
71
|
+
setCollapse(flag);
|
|
47
72
|
};
|
|
48
73
|
var onBack = function () {
|
|
49
|
-
dispatch(handlePrevScreenStep());
|
|
74
|
+
dispatch(handlePrevScreenStep('ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
50
75
|
};
|
|
51
76
|
var handleMenuClick = function () {
|
|
52
77
|
anchorEl ? setAnchorEl(false) : setAnchorEl(true);
|
|
53
78
|
};
|
|
54
|
-
|
|
79
|
+
var disabled = !methods.formState.isValid || !!error || uploading;
|
|
80
|
+
var showLicenseNumber = isKWCountry ? isCR : true;
|
|
81
|
+
var showCertificate = isCR;
|
|
82
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Collapse, __assign({ in: !collapse && !anchorEl }, { children: [_jsx(LicenseName, {}), _jsx(LicenseNumber, { show: showLicenseNumber })] })), _jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(ActivitiesList, { onListOpen: function () { return handleMenuClick(); }, onListClose: function () { return handleMenuClick(); } }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl && showCertificate }, { children: _jsx(Article, {}) })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(OperationStartDate, { onDateClicked: handleCollapseOpenClose }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
55
83
|
};
|
|
56
84
|
export default EntityInfo;
|
|
@@ -2,16 +2,31 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
5
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
5
6
|
import Input from '../../../shared/Input';
|
|
6
7
|
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
8
|
+
import { removeAllOtherThanCharsNumbersAndSpace } from '../../../../utils';
|
|
7
9
|
import { entitySelector } from '../../../app/entity/entityStore';
|
|
8
10
|
var LicenseName = function (_a) {
|
|
9
|
-
var _b, _c
|
|
11
|
+
var _b, _c;
|
|
10
12
|
var t = useTranslation().t;
|
|
11
|
-
var isAr = useLanguage()
|
|
13
|
+
var isAr = useLanguage();
|
|
14
|
+
var _d = useFormContext(), control = _d.control, setValue = _d.setValue;
|
|
12
15
|
var data = useAppSelector(entitySelector).data;
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
+
var verify = data.verify;
|
|
17
|
+
var legalName = (_c = (_b = verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.legal_name;
|
|
18
|
+
var name = isAr ? legalName === null || legalName === void 0 ? void 0 : legalName.ar : legalName === null || legalName === void 0 ? void 0 : legalName.en;
|
|
19
|
+
var licenseNameControl = useController({ control: control, name: 'licenseName' });
|
|
20
|
+
var licenseNameValue = licenseNameControl.field.value;
|
|
21
|
+
React.useEffect(function () {
|
|
22
|
+
if (name && !licenseNameValue)
|
|
23
|
+
setValue('licenseName', name, { shouldValidate: true });
|
|
24
|
+
}, [name]);
|
|
25
|
+
var handleChange = function (_a) {
|
|
26
|
+
var target = _a.target;
|
|
27
|
+
var value = removeAllOtherThanCharsNumbersAndSpace(target.value);
|
|
28
|
+
licenseNameControl.field.onChange(value);
|
|
29
|
+
};
|
|
30
|
+
return (_jsx(ScreenContainer, { children: _jsx(Input, { onChange: handleChange, value: licenseNameValue, label: t('license_name_label'), placeholder: t('license_name_label'), sx: { '& .MuiInputBase-input': { cursor: 'auto' } } }) }));
|
|
16
31
|
};
|
|
17
32
|
export default React.memo(LicenseName);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
interface LicenseNumberProps {
|
|
3
|
+
show: boolean;
|
|
3
4
|
}
|
|
4
|
-
declare const _default: React.MemoExoticComponent<({}: LicenseNumberProps) => JSX.Element>;
|
|
5
|
+
declare const _default: React.MemoExoticComponent<({ show }: LicenseNumberProps) => JSX.Element>;
|
|
5
6
|
export default _default;
|
|
@@ -12,17 +12,46 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
15
16
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
16
17
|
import Input from '../../../shared/Input';
|
|
17
|
-
import Collapse from '../../../../components/Collapse';
|
|
18
18
|
import { useAppSelector } from '../../../../hooks';
|
|
19
19
|
import { entitySelector } from '../../../app/entity/entityStore';
|
|
20
|
+
import { isSA, removeAllOtherThanCharsAndNumber } from '../../../../utils';
|
|
21
|
+
import { BusinessType } from '../../../../@types';
|
|
22
|
+
import { CR_NUMBER_LENGTH, FL_NUMBER_LENGTH, KW_MAX_LICENSE_LENGTH, KW_MIN_LICENSE_LENGTH } from '../../../../constants';
|
|
23
|
+
import Collapse from '../../../../components/Collapse';
|
|
24
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
20
25
|
var LicenseNumber = function (_a) {
|
|
21
|
-
var _b, _c;
|
|
26
|
+
var _b, _c, _d, _e;
|
|
27
|
+
var show = _a.show;
|
|
22
28
|
var t = useTranslation().t;
|
|
23
29
|
var data = useAppSelector(entitySelector).data;
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
|
|
30
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
31
|
+
var _f = useFormContext(), control = _f.control, setValue = _f.setValue;
|
|
32
|
+
var entity = (data.verify.responseBody || {}).entity;
|
|
33
|
+
var licenseType = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.type;
|
|
34
|
+
var type = licenseType === 'freelance' ? BusinessType.FL : BusinessType.CR;
|
|
35
|
+
var isLicensedTrue = entity === null || entity === void 0 ? void 0 : entity.is_licensed;
|
|
36
|
+
var hasLicenseNumber = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.number;
|
|
37
|
+
var resLicenseNumber = (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.number;
|
|
38
|
+
var licenseNumber = data.entityData.licenseNumber;
|
|
39
|
+
var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
40
|
+
React.useEffect(function () {
|
|
41
|
+
setValue('licenseNumber', licenseNumber, { shouldValidate: true });
|
|
42
|
+
}, [licenseNumber]);
|
|
43
|
+
var handleChange = function (_a) {
|
|
44
|
+
var target = _a.target;
|
|
45
|
+
var value = removeAllOtherThanCharsAndNumber(target.value);
|
|
46
|
+
licenseNumberControl.field.onChange(value);
|
|
47
|
+
};
|
|
48
|
+
var licenseNumberControl = useController({ control: control, name: 'licenseNumber' });
|
|
49
|
+
var licenseNumberValue = licenseNumberControl.field.value;
|
|
50
|
+
var error = (_e = licenseNumberControl.fieldState.error) === null || _e === void 0 ? void 0 : _e.message;
|
|
51
|
+
var isCR = type === BusinessType.CR;
|
|
52
|
+
var length = !isSACountry ? KW_MAX_LICENSE_LENGTH : isCR ? CR_NUMBER_LENGTH : FL_NUMBER_LENGTH;
|
|
53
|
+
var minLength = !isSACountry ? KW_MIN_LICENSE_LENGTH : length;
|
|
54
|
+
var disabled = hasLicenseNumber && isLicensedTrue && (resLicenseNumber === null || resLicenseNumber === void 0 ? void 0 : resLicenseNumber.length) >= minLength;
|
|
55
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { label: t('license_number_label'), onChange: handleChange, disabled: disabled, inputProps: { maxLength: length }, value: licenseNumberValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: isCR ? t('cr_number_hint') : t('fl_number_hint'), warningType: 'alert', warningMessage: error && t(error, { length: minLength }) }) })) })));
|
|
27
56
|
};
|
|
28
57
|
export default React.memo(LicenseNumber);
|
|
@@ -1,38 +1,33 @@
|
|
|
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
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
13
3
|
import { useTranslation } from 'react-i18next';
|
|
14
4
|
import { useController, useFormContext } from 'react-hook-form';
|
|
15
|
-
import Input from '../../../shared/Input';
|
|
16
5
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
17
6
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
18
7
|
import { entitySelector, clearError } from '../../../app/entity/entityStore';
|
|
19
8
|
import DatePicker from '../../../../components/DatePicker';
|
|
20
9
|
import { InputLabelStyled } from './ActivitiesList';
|
|
21
10
|
var OperationStartDate = function (_a) {
|
|
22
|
-
var _b
|
|
11
|
+
var _b;
|
|
23
12
|
var onDateClicked = _a.onDateClicked;
|
|
24
13
|
var t = useTranslation().t;
|
|
25
14
|
var dispatch = useAppDispatch();
|
|
26
|
-
var
|
|
27
|
-
var
|
|
15
|
+
var _c = useFormContext(), control = _c.control, setValue = _c.setValue;
|
|
16
|
+
var _d = useAppSelector(entitySelector), data = _d.data, error = _d.error;
|
|
17
|
+
var operationStartDate = (data.entityData.responseBody || {}).operationStartDate;
|
|
28
18
|
var oDateControl = useController({ control: control, name: 'operationStartDate' });
|
|
19
|
+
var dateValue = (_b = oDateControl === null || oDateControl === void 0 ? void 0 : oDateControl.field) === null || _b === void 0 ? void 0 : _b.value;
|
|
20
|
+
React.useEffect(function () {
|
|
21
|
+
if (!dateValue) {
|
|
22
|
+
var date = operationStartDate || new Date().toString();
|
|
23
|
+
setValue('operationStartDate', date, { shouldValidate: true });
|
|
24
|
+
}
|
|
25
|
+
}, [operationStartDate]);
|
|
29
26
|
var handleOperationStartDateChange = function (data) {
|
|
30
27
|
if (error)
|
|
31
28
|
dispatch(clearError());
|
|
32
29
|
oDateControl.field.onChange(data);
|
|
33
30
|
};
|
|
34
|
-
|
|
35
|
-
var storedDate = (_d = (_c = data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.brand) === null || _d === void 0 ? void 0 : _d.business_operation_start_at;
|
|
36
|
-
return (_jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: !!storedDate ? (_jsx(Input, { label: t('business_start_date'), readOnly: true, value: dateValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } } })) : (_jsxs(_Fragment, { children: [_jsx(InputLabelStyled, { children: t('business_start_date') }), _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 })] })) })));
|
|
31
|
+
return (_jsx(ScreenContainer, { children: _jsxs(_Fragment, { children: [_jsx(InputLabelStyled, { children: t('business_start_date') }), _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 })] }) }));
|
|
37
32
|
};
|
|
38
33
|
export default OperationStartDate;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
export declare const EntityInfoValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
licenseName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
4
|
+
licenseType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
5
|
+
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
3
6
|
activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
4
7
|
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
5
8
|
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
@@ -16,25 +19,36 @@ export declare const EntityInfoValidationSchema: yup.ObjectSchema<import("yup/li
|
|
|
16
19
|
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
17
20
|
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
18
21
|
}>>[] | undefined>;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
operationStartDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
23
|
+
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
24
|
+
articleFile: any;
|
|
25
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
26
|
+
licenseName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
27
|
+
licenseType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
28
|
+
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
29
|
+
activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
30
|
+
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
31
|
+
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
23
32
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
33
|
+
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
34
|
+
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
27
35
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
36
|
+
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
37
|
+
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
31
38
|
}>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
39
|
+
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
40
|
+
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
41
|
+
}>>[] | undefined, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
42
|
+
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
43
|
+
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
35
44
|
}>>[] | undefined>;
|
|
36
45
|
operationStartDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
37
|
-
|
|
46
|
+
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
47
|
+
articleFile: any;
|
|
48
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
49
|
+
licenseName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
50
|
+
licenseType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
51
|
+
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
38
52
|
activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
39
53
|
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
40
54
|
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
@@ -51,25 +65,37 @@ export declare const EntityInfoValidationSchema: yup.ObjectSchema<import("yup/li
|
|
|
51
65
|
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
52
66
|
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
53
67
|
}>>[] | undefined>;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
68
|
+
operationStartDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
69
|
+
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
70
|
+
articleFile: any;
|
|
71
|
+
}>>>;
|
|
72
|
+
export declare const EntityInfoKWValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
73
|
+
licenseName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
74
|
+
licenseType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
75
|
+
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
76
|
+
activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
77
|
+
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
78
|
+
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
58
79
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
80
|
+
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
81
|
+
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
62
82
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
83
|
+
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
84
|
+
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
66
85
|
}>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
86
|
+
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
87
|
+
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
88
|
+
}>>[] | undefined, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
89
|
+
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
90
|
+
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
70
91
|
}>>[] | undefined>;
|
|
71
92
|
operationStartDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
72
|
-
|
|
93
|
+
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
94
|
+
articleFile: any;
|
|
95
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
96
|
+
licenseName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
97
|
+
licenseType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
98
|
+
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
73
99
|
activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
74
100
|
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
75
101
|
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
@@ -86,22 +112,30 @@ export declare const EntityInfoValidationSchema: yup.ObjectSchema<import("yup/li
|
|
|
86
112
|
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
87
113
|
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
88
114
|
}>>[] | undefined>;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
115
|
+
operationStartDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
116
|
+
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
117
|
+
articleFile: any;
|
|
118
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
119
|
+
licenseName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
120
|
+
licenseType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
121
|
+
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
122
|
+
activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
123
|
+
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
124
|
+
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
93
125
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
126
|
+
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
127
|
+
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
97
128
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
129
|
+
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
130
|
+
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
101
131
|
}>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
132
|
+
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
133
|
+
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
134
|
+
}>>[] | undefined, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
135
|
+
ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
136
|
+
en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
105
137
|
}>>[] | undefined>;
|
|
106
138
|
operationStartDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
139
|
+
articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
140
|
+
articleFile: any;
|
|
107
141
|
}>>>;
|
|
@@ -1,17 +1,83 @@
|
|
|
1
|
+
import { KW_MIN_LICENSE_LENGTH, MAX_FILE_SIZE, VALID_FILE_FORMATS, CR_MIN_LICENSE_LENGTH, FL_MIN_LICENSE_LENGTH } from '../../../../constants';
|
|
2
|
+
import { BusinessType } from '../../../../@types';
|
|
1
3
|
import * as yup from 'yup';
|
|
2
4
|
export var EntityInfoValidationSchema = yup.object().shape({
|
|
5
|
+
licenseName: yup.string().required(''),
|
|
6
|
+
licenseType: yup.string().required(''),
|
|
7
|
+
licenseNumber: yup
|
|
8
|
+
.string()
|
|
9
|
+
.test({
|
|
10
|
+
test: function (value) {
|
|
11
|
+
var type = this.parent.licenseType;
|
|
12
|
+
var isCR = type === BusinessType.CR;
|
|
13
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
14
|
+
if (length === 0)
|
|
15
|
+
return true;
|
|
16
|
+
if (isCR) {
|
|
17
|
+
return length > CR_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_max_length' });
|
|
18
|
+
}
|
|
19
|
+
return length > FL_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
.required(''),
|
|
3
23
|
activities: yup.array().of(yup.object().shape({
|
|
4
24
|
ar: yup.string(),
|
|
5
25
|
en: yup.string()
|
|
6
26
|
})),
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
27
|
+
operationStartDate: yup.string().required('choose_any_business_date'),
|
|
28
|
+
articleId: yup.string().optional(),
|
|
29
|
+
articleFile: yup
|
|
30
|
+
.mixed()
|
|
31
|
+
.test({
|
|
32
|
+
test: function (value) {
|
|
33
|
+
if (!!value)
|
|
34
|
+
return VALID_FILE_FORMATS.includes(value === null || value === void 0 ? void 0 : value.type) && (value === null || value === void 0 ? void 0 : value.size) < MAX_FILE_SIZE
|
|
35
|
+
? true
|
|
36
|
+
: this.createError({ message: 'alert_file_upload' });
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
.optional()
|
|
41
|
+
});
|
|
42
|
+
export var EntityInfoKWValidationSchema = yup.object().shape({
|
|
43
|
+
licenseName: yup.string().required(''),
|
|
44
|
+
licenseType: yup.string().required(''),
|
|
45
|
+
licenseNumber: yup
|
|
46
|
+
.string()
|
|
47
|
+
.when('licenseType', function (licenseType) {
|
|
48
|
+
var isCR = licenseType === BusinessType.CR;
|
|
49
|
+
if (!isCR) {
|
|
50
|
+
return yup.string().optional();
|
|
51
|
+
}
|
|
52
|
+
return yup
|
|
53
|
+
.string()
|
|
54
|
+
.required('')
|
|
55
|
+
.test({
|
|
56
|
+
test: function (value) {
|
|
57
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
58
|
+
if (length === 0)
|
|
59
|
+
return true;
|
|
60
|
+
return length >= KW_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_kw_max_length' });
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
})
|
|
64
|
+
.required(''),
|
|
65
|
+
activities: yup.array().of(yup.object().shape({
|
|
66
|
+
ar: yup.string(),
|
|
67
|
+
en: yup.string()
|
|
68
|
+
})),
|
|
69
|
+
operationStartDate: yup.string().required('choose_any_business_date'),
|
|
70
|
+
articleId: yup.string().optional(),
|
|
71
|
+
articleFile: yup
|
|
72
|
+
.mixed()
|
|
73
|
+
.test({
|
|
74
|
+
test: function (value) {
|
|
75
|
+
if (!!value)
|
|
76
|
+
return VALID_FILE_FORMATS.includes(value === null || value === void 0 ? void 0 : value.type) && (value === null || value === void 0 ? void 0 : value.size) < MAX_FILE_SIZE
|
|
77
|
+
? true
|
|
78
|
+
: this.createError({ message: 'alert_file_upload' });
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
})
|
|
82
|
+
.optional()
|
|
17
83
|
});
|
|
@@ -7,10 +7,14 @@ import SuccessScreen from '../../../shared/SuccessScreen';
|
|
|
7
7
|
var Success = function (_a) {
|
|
8
8
|
var t = useTranslation().t;
|
|
9
9
|
var dispatch = useAppDispatch();
|
|
10
|
-
var _b = useAppSelector(entitySelector),
|
|
11
|
-
var
|
|
10
|
+
var _b = useAppSelector(entitySelector), error = _b.error, loading = _b.loading;
|
|
11
|
+
var _c = React.useState(false), clicked = _c[0], setClicked = _c[1];
|
|
12
|
+
React.useEffect(function () {
|
|
12
13
|
dispatch(updateBoardSuccess());
|
|
14
|
+
}, []);
|
|
15
|
+
var onSuccess = function () {
|
|
16
|
+
setClicked(true);
|
|
13
17
|
};
|
|
14
|
-
return (_jsx(SuccessScreen, { title: t('entity_success_title'), onSuccess: onSuccess, successTitle: t('continue'), loading: loading, error: error || '' }));
|
|
18
|
+
return (_jsx(SuccessScreen, { title: t('entity_success_title'), onSuccess: onSuccess, successTitle: t('continue'), loading: clicked && loading, error: error || '' }));
|
|
15
19
|
};
|
|
16
20
|
export default React.memo(Success);
|