@tap-payments/auth-jsconnect 2.10.7-beta → 2.10.7
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/README.md +2 -2
- package/build/@types/app.d.ts +8 -1
- package/build/@types/app.js +7 -0
- package/build/@types/form.d.ts +5 -0
- package/build/api/auth.d.ts +1 -0
- package/build/api/axios.d.ts +1 -1
- package/build/api/entity.d.ts +3 -0
- package/build/api/lead.d.ts +1 -0
- package/build/app/settings.d.ts +1 -0
- package/build/app/settings.js +8 -5
- package/build/assets/currencies/AEDSymbol.d.ts +7 -0
- package/build/assets/currencies/AEDSymbol.js +28 -0
- package/build/assets/currencies/SARSymbol.d.ts +7 -0
- package/build/assets/currencies/SARSymbol.js +28 -0
- package/build/assets/currencies/index.d.ts +2 -0
- package/build/assets/currencies/index.js +2 -0
- package/build/assets/currencies/utils.d.ts +4 -0
- package/build/assets/currencies/utils.js +6 -0
- package/build/assets/locales/ar.json +52 -7
- package/build/assets/locales/en.json +55 -9
- package/build/components/TextWithCurrency/TextWithCurrency.d.ts +7 -0
- package/build/components/TextWithCurrency/TextWithCurrency.js +14 -0
- package/build/components/TextWithCurrency/index.d.ts +2 -0
- package/build/components/TextWithCurrency/index.js +2 -0
- package/build/constants/api.d.ts +1 -0
- package/build/constants/api.js +2 -0
- package/build/constants/app.d.ts +12 -0
- package/build/constants/app.js +48 -15
- package/build/constants/assets.d.ts +12 -3
- package/build/constants/assets.js +123 -105
- package/build/constants/dummy.js +27 -20
- package/build/constants/validation.d.ts +1 -0
- package/build/constants/validation.js +1 -0
- package/build/features/app/auth/authStore.d.ts +24 -5
- package/build/features/app/auth/authStore.js +136 -71
- package/build/features/app/business/businessStore.js +15 -10
- package/build/features/app/connectExpress/connectExpressStore.d.ts +14 -3
- package/build/features/app/connectExpress/connectExpressStore.js +212 -53
- package/build/features/app/tax/taxStore.js +1 -1
- package/build/features/auth/Auth.d.ts +1 -1
- package/build/features/auth/screens/AuthenticationList/EntityList.js +2 -2
- package/build/features/auth/screens/OTP/OTP.d.ts +13 -2
- package/build/features/auth/screens/OTP/OTP.js +15 -3
- package/build/features/auth/screens/OTP/index.d.ts +1 -2
- package/build/features/auth/screens/Passcode/Passcode.d.ts +16 -0
- package/build/features/auth/screens/Passcode/Passcode.js +82 -0
- package/build/features/auth/screens/Passcode/PasscodeInput.d.ts +6 -0
- package/build/features/auth/screens/Passcode/PasscodeInput.js +42 -0
- package/build/features/auth/screens/Passcode/index.d.ts +2 -0
- package/build/features/auth/screens/Passcode/index.js +2 -0
- package/build/features/auth/screens/Passcode/validation.d.ts +8 -0
- package/build/features/auth/screens/Passcode/validation.js +4 -0
- package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +3 -8
- package/build/features/brand/screens/BrandActivities/RefundPolicy.d.ts +1 -1
- package/build/features/business/screens/BusinessType/BusinessType.js +13 -2
- package/build/features/business/screens/BusinessType/EntityLicenseList.js +11 -5
- package/build/features/business/screens/BusinessType/LicenseList.js +15 -7
- package/build/features/business/screens/BusinessType/UnifiedNumber.d.ts +35 -0
- package/build/features/business/screens/BusinessType/UnifiedNumber.js +84 -0
- package/build/features/business/screens/BusinessType/validation.d.ts +6 -3
- package/build/features/business/screens/BusinessType/validation.js +31 -10
- package/build/features/business/screens/Customers/ExpectedSalesRange.js +3 -8
- package/build/features/business/screens/Customers/RefundPolicy.d.ts +1 -1
- package/build/features/connectExpress/screens/AuthenticationList/EntityList.js +2 -2
- package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +1 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +23 -7
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +2 -2
- package/build/features/connectExpress/screens/CollectBusinessInfo/TAC.js +1 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.d.ts +36 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/UnifiedNumber.js +81 -0
- package/build/features/connectExpress/screens/CollectBusinessInfo/validation.d.ts +6 -3
- package/build/features/connectExpress/screens/CollectBusinessInfo/validation.js +57 -21
- package/build/features/connectExpress/screens/GenericPrepareDataLoading/GenericPrepareDataLoading.d.ts +3 -0
- package/build/features/connectExpress/screens/GenericPrepareDataLoading/GenericPrepareDataLoading.js +9 -0
- package/build/features/connectExpress/screens/GenericPrepareDataLoading/index.d.ts +2 -0
- package/build/features/connectExpress/screens/GenericPrepareDataLoading/index.js +2 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/OTPInput.d.ts +5 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/OTPInput.js +49 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/VerifyMobileAuthOTP.d.ts +5 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/VerifyMobileAuthOTP.js +88 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/index.d.ts +3 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/index.js +2 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/validation.d.ts +8 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/validation.js +4 -0
- package/build/features/connectExpress/screens/VerifyNafath/VerifyNafath.js +9 -3
- package/build/features/entity/screens/EntityCapital/CapitalPaid.js +3 -7
- package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +3 -7
- package/build/features/entity/screens/EntityName/EntityName.js +16 -15
- package/build/features/entity/screens/EntityName/UnifiedNumber.js +2 -2
- package/build/features/entity/screens/EntityName/validation.d.ts +50 -48
- package/build/features/entity/screens/EntityName/validation.js +100 -85
- package/build/features/featuresScreens.js +10 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +3 -8
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +3 -8
- package/build/features/shared/Background/LogoBackground.js +5 -17
- package/build/features/shared/Button/Button.js +1 -2
- package/build/features/shared/Input/Input.d.ts +1 -1
- package/build/hooks/useAppConfig.js +1 -1
- package/build/utils/common.d.ts +1 -1
- package/build/utils/common.js +18 -8
- package/build/utils/string.d.ts +3 -2
- package/build/utils/string.js +4 -1
- package/build/utils/validation.js +1 -1
- package/package.json +4 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
import { KW_MIN_LICENSE_LENGTH, FL_MIN_LICENSE_LENGTH,
|
|
2
|
+
import { KW_MIN_LICENSE_LENGTH, FL_MIN_LICENSE_LENGTH, BRAND_NAME_MAX_LENGTH, UNIFIED_NUMBER_MIN_LENGTH } from '../../../../constants';
|
|
3
3
|
import { BusinessType } from '../../../../@types';
|
|
4
4
|
var objectElements = {
|
|
5
5
|
legal_name: yup.object().shape({
|
|
@@ -7,7 +7,7 @@ var objectElements = {
|
|
|
7
7
|
en: yup.string()
|
|
8
8
|
}),
|
|
9
9
|
license: yup.object().shape({
|
|
10
|
-
number: yup.string()
|
|
10
|
+
number: yup.string().nullable()
|
|
11
11
|
}),
|
|
12
12
|
type: yup.string()
|
|
13
13
|
};
|
|
@@ -94,22 +94,40 @@ export var BusinessDataSchema = function (isLeadIdPassed) {
|
|
|
94
94
|
})
|
|
95
95
|
.required('enter_brand_name_english_chars_numbers_space'),
|
|
96
96
|
selectedLicense: yup.object().shape(objectElements).required(''),
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
unifiedNumber: yup.string().test({
|
|
98
|
+
name: 'unifiedNumber',
|
|
99
|
+
message: '',
|
|
100
100
|
test: function (value) {
|
|
101
|
+
var _a;
|
|
101
102
|
var selectedLicense = this.parent.selectedLicense;
|
|
102
|
-
var
|
|
103
|
+
var isFL = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.FL;
|
|
103
104
|
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
105
|
+
if (!((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === null || _a === void 0 ? void 0 : _a.length))
|
|
106
|
+
return false;
|
|
107
|
+
if (isFL || length >= UNIFIED_NUMBER_MIN_LENGTH)
|
|
108
|
+
return true;
|
|
104
109
|
if (length === 0)
|
|
110
|
+
return this.createError({ message: '' });
|
|
111
|
+
return this.createError({ message: 'unified_number_required' });
|
|
112
|
+
}
|
|
113
|
+
}),
|
|
114
|
+
licenseNumber: yup.string().test({
|
|
115
|
+
name: 'licenseNumber',
|
|
116
|
+
message: '',
|
|
117
|
+
test: function (value) {
|
|
118
|
+
var _a;
|
|
119
|
+
var selectedLicense = this.parent.selectedLicense;
|
|
120
|
+
var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
|
|
121
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
122
|
+
if (!((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === null || _a === void 0 ? void 0 : _a.length))
|
|
123
|
+
return false;
|
|
124
|
+
if (isCR || length >= FL_MIN_LICENSE_LENGTH)
|
|
105
125
|
return true;
|
|
106
|
-
if (
|
|
107
|
-
return
|
|
108
|
-
}
|
|
109
|
-
return length >= FL_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
|
|
126
|
+
if (length === 0)
|
|
127
|
+
return this.createError({ message: '' });
|
|
128
|
+
return this.createError({ message: 'fl_max_length' });
|
|
110
129
|
}
|
|
111
|
-
})
|
|
112
|
-
.required(''),
|
|
130
|
+
}),
|
|
113
131
|
termAndConditionChecked: yup.boolean().isTrue('check_terms_cond').required('check_terms_cond')
|
|
114
132
|
});
|
|
115
133
|
}
|
|
@@ -127,22 +145,40 @@ export var BusinessDataSchema = function (isLeadIdPassed) {
|
|
|
127
145
|
})
|
|
128
146
|
.required('enter_brand_name_english_chars_numbers_space'),
|
|
129
147
|
selectedLicense: yup.object().shape(objectElements).required(''),
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
148
|
+
unifiedNumber: yup.string().test({
|
|
149
|
+
name: 'unifiedNumber',
|
|
150
|
+
message: '',
|
|
133
151
|
test: function (value) {
|
|
152
|
+
var _a;
|
|
134
153
|
var selectedLicense = this.parent.selectedLicense;
|
|
135
|
-
var
|
|
154
|
+
var isFL = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.FL;
|
|
136
155
|
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
156
|
+
if (!((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === null || _a === void 0 ? void 0 : _a.length))
|
|
157
|
+
return false;
|
|
158
|
+
if (isFL || length >= UNIFIED_NUMBER_MIN_LENGTH)
|
|
159
|
+
return true;
|
|
137
160
|
if (length === 0)
|
|
161
|
+
return this.createError({ message: '' });
|
|
162
|
+
return this.createError({ message: 'unified_number_required' });
|
|
163
|
+
}
|
|
164
|
+
}),
|
|
165
|
+
licenseNumber: yup.string().test({
|
|
166
|
+
name: 'licenseNumber',
|
|
167
|
+
message: '',
|
|
168
|
+
test: function (value) {
|
|
169
|
+
var _a;
|
|
170
|
+
var selectedLicense = this.parent.selectedLicense;
|
|
171
|
+
var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
|
|
172
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
173
|
+
if (!((_a = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === null || _a === void 0 ? void 0 : _a.length))
|
|
174
|
+
return false;
|
|
175
|
+
if (isCR || length >= FL_MIN_LICENSE_LENGTH)
|
|
138
176
|
return true;
|
|
139
|
-
if (
|
|
140
|
-
return
|
|
141
|
-
}
|
|
142
|
-
return length >= FL_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
|
|
177
|
+
if (length === 0)
|
|
178
|
+
return this.createError({ message: '' });
|
|
179
|
+
return this.createError({ message: 'fl_max_length' });
|
|
143
180
|
}
|
|
144
181
|
})
|
|
145
|
-
.required('')
|
|
146
182
|
});
|
|
147
183
|
};
|
|
148
184
|
export var KWBusinessDataSchema = function (isLeadIdPassed) {
|
package/build/features/connectExpress/screens/GenericPrepareDataLoading/GenericPrepareDataLoading.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useAppSelector } from '../../../../hooks';
|
|
3
|
+
import DataLoading from '../../../shared/DataLoading';
|
|
4
|
+
import { connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
|
|
5
|
+
var GenericPrepareDataLoading = function () {
|
|
6
|
+
var error = useAppSelector(connectExpressSelector).error;
|
|
7
|
+
return _jsx(DataLoading, { error: error });
|
|
8
|
+
};
|
|
9
|
+
export default GenericPrepareDataLoading;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
16
|
+
import Box from '@mui/material/Box/Box';
|
|
17
|
+
import { styled } from '@mui/material/styles';
|
|
18
|
+
import OTPField from '../../../shared/OTP';
|
|
19
|
+
import { DEFAULT_TIMER_VALUE } from '../../../../constants';
|
|
20
|
+
import { connectExpressSelector, clearError, resendLeadMobileAuthOTP } from '../../../app/connectExpress/connectExpressStore';
|
|
21
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
22
|
+
var BoxStyled = styled(Box)(function (_a) {
|
|
23
|
+
var theme = _a.theme;
|
|
24
|
+
return ({
|
|
25
|
+
display: 'flex',
|
|
26
|
+
flexDirection: 'column',
|
|
27
|
+
fontFamily: theme.typography.fontFamily
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
var OTPInput = function (_a) {
|
|
31
|
+
var _b = useFormContext(), control = _b.control, setValue = _b.setValue;
|
|
32
|
+
var t = useTranslation().t;
|
|
33
|
+
var dispatch = useAppDispatch();
|
|
34
|
+
var otpControl = useController({ name: 'otp', control: control });
|
|
35
|
+
var error = useAppSelector(connectExpressSelector).error;
|
|
36
|
+
var handleOnOTPChange = function (otp) {
|
|
37
|
+
if (error)
|
|
38
|
+
dispatch(clearError());
|
|
39
|
+
otpControl.field.onChange(otp);
|
|
40
|
+
};
|
|
41
|
+
var handleOnResendOTP = function () {
|
|
42
|
+
if (otpControl.field.value)
|
|
43
|
+
setValue('otp', '', { shouldValidate: true });
|
|
44
|
+
dispatch(resendLeadMobileAuthOTP());
|
|
45
|
+
};
|
|
46
|
+
var otpValue = otpControl.field.value;
|
|
47
|
+
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
48
|
+
};
|
|
49
|
+
export default React.memo(OTPInput);
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import Box from '@mui/material/Box/Box';
|
|
14
|
+
import { styled } from '@mui/material/styles';
|
|
15
|
+
import * as React from 'react';
|
|
16
|
+
import { useTranslation } from 'react-i18next';
|
|
17
|
+
import Text from '../../../../components/Text';
|
|
18
|
+
import { clearError, connectExpressSelector, verifyAuthMobileOtpAsync, resetVerifyAuthOTPValue } from '../../../app/connectExpress/connectExpressStore';
|
|
19
|
+
import Button from '../../../shared/Button';
|
|
20
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
|
+
import { useAppDispatch, useAppSelector, useSanitizedTranslation } from '../../../../hooks';
|
|
22
|
+
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
23
|
+
import { useLanguage } from '../../../../hooks';
|
|
24
|
+
import { useForm, FormProvider } from 'react-hook-form';
|
|
25
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
26
|
+
import Form from '../../../../components/Form';
|
|
27
|
+
import { maskPhone, deepCopy } from '../../../../utils';
|
|
28
|
+
import { AuthForScreen } from '../../../../@types';
|
|
29
|
+
import { OTPValidation } from './validation';
|
|
30
|
+
import OTPInput from './OTPInput';
|
|
31
|
+
var OTPTitleContainerStyled = styled(Box)(function (_a) {
|
|
32
|
+
var theme = _a.theme;
|
|
33
|
+
return ({
|
|
34
|
+
background: theme.palette.common.white,
|
|
35
|
+
border: '1px solid',
|
|
36
|
+
borderColor: theme.palette.divider,
|
|
37
|
+
direction: theme.direction,
|
|
38
|
+
borderRadius: theme.spacing(0, 0, 1.25, 1.25),
|
|
39
|
+
marginBottom: theme.spacing(5.75)
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
var OTPTitleStyled = styled(Text)(function (_a) {
|
|
43
|
+
var theme = _a.theme;
|
|
44
|
+
return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightLight, marginBlock: theme.spacing(1.75), marginInline: theme.spacing(2.5), lineHeight: 1.75, whiteSpace: 'pre-line' }));
|
|
45
|
+
});
|
|
46
|
+
var FormStyled = styled(Form)(function () { return ({
|
|
47
|
+
display: 'flex',
|
|
48
|
+
flexDirection: 'column'
|
|
49
|
+
}); });
|
|
50
|
+
var VerifyMobileAuthOTP = function () {
|
|
51
|
+
var _a, _b, _c, _d, _e, _f;
|
|
52
|
+
var dispatch = useAppDispatch();
|
|
53
|
+
var _g = useAppSelector(connectExpressSelector), data = _g.data, loading = _g.loading, error = _g.error;
|
|
54
|
+
var t = useTranslation().t;
|
|
55
|
+
var st = useSanitizedTranslation();
|
|
56
|
+
var isAr = useLanguage().isAr;
|
|
57
|
+
var methods = useForm({
|
|
58
|
+
resolver: yupResolver(OTPValidation),
|
|
59
|
+
defaultValues: data.verifyAuthOtpData,
|
|
60
|
+
mode: 'onChange'
|
|
61
|
+
});
|
|
62
|
+
React.useEffect(function () {
|
|
63
|
+
if (error)
|
|
64
|
+
dispatch(clearError());
|
|
65
|
+
}, [methods.formState.isValid]);
|
|
66
|
+
React.useEffect(function () {
|
|
67
|
+
return function () {
|
|
68
|
+
dispatch(resetVerifyAuthOTPValue());
|
|
69
|
+
};
|
|
70
|
+
}, []);
|
|
71
|
+
var onSubmit = function (formData) {
|
|
72
|
+
dispatch(verifyAuthMobileOtpAsync(deepCopy(formData)));
|
|
73
|
+
};
|
|
74
|
+
var onBack = function () {
|
|
75
|
+
var authFor = data.verifyAuthOtpData.authFor;
|
|
76
|
+
var step_name = 'CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP';
|
|
77
|
+
if (authFor === AuthForScreen.DOB)
|
|
78
|
+
step_name = 'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP';
|
|
79
|
+
else if (authFor === AuthForScreen.MOBILE_OWNERSHIP)
|
|
80
|
+
step_name = 'COLLECT_MOBILE_OWNERSHIP';
|
|
81
|
+
dispatch(handlePrevScreenStep(step_name));
|
|
82
|
+
};
|
|
83
|
+
var disabled = !methods.formState.isValid;
|
|
84
|
+
var phone = ((_c = (_b = (_a = data.responseData) === null || _a === void 0 ? void 0 : _a.verifyAuthMobile) === null || _b === void 0 ? void 0 : _b.verification_by) === null || _c === void 0 ? void 0 : _c.sent_to) ? (_f = (_e = (_d = data.responseData) === null || _d === void 0 ? void 0 : _d.verifyAuthMobile) === null || _e === void 0 ? void 0 : _e.verification_by) === null || _f === void 0 ? void 0 : _f.sent_to : '';
|
|
85
|
+
var title = t('ide_opt_sent_title');
|
|
86
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? st('ide_otp_waiting_title') : title, !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: maskPhone(phone) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: st(error || '') }, { children: t('next') }))] })) })) }));
|
|
87
|
+
};
|
|
88
|
+
export default React.memo(VerifyMobileAuthOTP);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export declare const OTPValidation: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
otp: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
4
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
5
|
+
otp: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
6
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
7
|
+
otp: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
8
|
+
}>>>;
|
|
@@ -4,14 +4,16 @@ import { connectExpressSelector, verifyNafathAsync } from '../../../app/connectE
|
|
|
4
4
|
import NafathVerification from '../../../shared/NafathVerification';
|
|
5
5
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
6
6
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
7
|
+
import GenericPrepareDataLoading from '../GenericPrepareDataLoading';
|
|
7
8
|
var VerifyNafath = function () {
|
|
8
9
|
var _a = React.useState(false), success = _a[0], setSuccess = _a[1];
|
|
9
10
|
var _b = React.useState(false), failed = _b[0], setFailed = _b[1];
|
|
10
11
|
var _c = React.useState(false), isReady = _c[0], setIsReady = _c[1];
|
|
12
|
+
var _d = React.useState(false), showLoadingScreen = _d[0], setShowLoadingScreen = _d[1];
|
|
11
13
|
var dispatch = useAppDispatch();
|
|
12
14
|
var data = useAppSelector(connectExpressSelector).data;
|
|
13
15
|
var authData = (data.responseData || {}).authData;
|
|
14
|
-
var
|
|
16
|
+
var _e = authData || {}, expiry = _e.expiry, app_url_android = _e.app_url_android, app_url_ios = _e.app_url_ios, random = _e.random;
|
|
15
17
|
React.useEffect(function () {
|
|
16
18
|
if (authData && !isReady) {
|
|
17
19
|
setIsReady(true);
|
|
@@ -20,7 +22,11 @@ var VerifyNafath = function () {
|
|
|
20
22
|
React.useEffect(function () {
|
|
21
23
|
if (!isReady)
|
|
22
24
|
return;
|
|
23
|
-
var promise = dispatch(verifyNafathAsync({
|
|
25
|
+
var promise = dispatch(verifyNafathAsync({
|
|
26
|
+
onSuccess: function () { return setSuccess(true); },
|
|
27
|
+
onFailure: function () { return setFailed(true); },
|
|
28
|
+
showLoadingScreenAfterNafathSuccess: function () { return setShowLoadingScreen(true); }
|
|
29
|
+
}));
|
|
24
30
|
return function () {
|
|
25
31
|
promise === null || promise === void 0 ? void 0 : promise.abort();
|
|
26
32
|
};
|
|
@@ -30,6 +36,6 @@ var VerifyNafath = function () {
|
|
|
30
36
|
}, []);
|
|
31
37
|
if (!isReady)
|
|
32
38
|
return null;
|
|
33
|
-
return (_jsx(NafathVerification, { randomNumber: random, expiryInSeconds: expiry, success: success, failed: failed, urls: { android: app_url_android, ios: app_url_ios }, onFinish: function () { return onBack(); } }));
|
|
39
|
+
return showLoadingScreen ? (_jsx(GenericPrepareDataLoading, {})) : (_jsx(NafathVerification, { randomNumber: random, expiryInSeconds: expiry, success: success, failed: failed, urls: { android: app_url_android, ios: app_url_ios }, onFinish: function () { return onBack(); } }));
|
|
34
40
|
};
|
|
35
41
|
export default React.memo(VerifyNafath);
|
|
@@ -15,11 +15,12 @@ import { useTranslation } from 'react-i18next';
|
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
16
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
17
17
|
import { settingsSelector } from '../../../../app/settings';
|
|
18
|
-
import { formatNumberAsCurrency,
|
|
18
|
+
import { formatNumberAsCurrency, removeAllCharsFromNumber } from '../../../../utils';
|
|
19
19
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
20
20
|
import Input from '../../../shared/Input';
|
|
21
21
|
import { clearError } from '../../../app/entity/entityStore';
|
|
22
22
|
import { EndAdornment } from '../../../shared/EndAdornment';
|
|
23
|
+
import TextWithCurrency from '../../../../components/TextWithCurrency';
|
|
23
24
|
var CapitalPaid = function (_a) {
|
|
24
25
|
var _b;
|
|
25
26
|
var readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
@@ -34,14 +35,9 @@ var CapitalPaid = function (_a) {
|
|
|
34
35
|
var value = formatNumberAsCurrency(removeAllCharsFromNumber(target.value));
|
|
35
36
|
capitalPaidControl.field.onChange(value);
|
|
36
37
|
};
|
|
37
|
-
var getCurrency = React.useMemo(function () {
|
|
38
|
-
return t(getCurrencyByCountryIso2(settingsData.businessCountry.iso2));
|
|
39
|
-
}, [settingsData.businessCountry.iso2]);
|
|
40
38
|
var capitalPaidControl = useController({ control: control, name: 'capitalPaid' });
|
|
41
39
|
var capitalPaidValue = capitalPaidControl.field.value;
|
|
42
40
|
var error = (_b = capitalPaidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
43
|
-
return (_jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: t('
|
|
44
|
-
currency: getCurrency
|
|
45
|
-
}), required: true, onChange: handleChange, value: capitalPaidValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('capital_paid_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: capitalPaidValue, isVerified: isVerified }) }) })));
|
|
41
|
+
return (_jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: _jsx(TextWithCurrency, { text: t('capital_paid_input_label'), countryCode: settingsData.businessCountry.iso2 }), required: true, onChange: handleChange, value: capitalPaidValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('capital_paid_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: capitalPaidValue, isVerified: isVerified }) }) })));
|
|
46
42
|
};
|
|
47
43
|
export default React.memo(CapitalPaid);
|
|
@@ -13,13 +13,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import * as React from 'react';
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
-
import { formatNumberAsCurrency,
|
|
16
|
+
import { formatNumberAsCurrency, removeAllCharsFromNumber } from '../../../../utils';
|
|
17
17
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
18
18
|
import { settingsSelector } from '../../../../app/settings';
|
|
19
19
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
20
20
|
import Input from '../../../shared/Input';
|
|
21
21
|
import { clearError } from '../../../app/entity/entityStore';
|
|
22
22
|
import { EndAdornment } from '../../../shared/EndAdornment';
|
|
23
|
+
import TextWithCurrency from '../../../../components/TextWithCurrency';
|
|
23
24
|
var CapitalShareValue = function (_a) {
|
|
24
25
|
var _b;
|
|
25
26
|
var readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
@@ -34,14 +35,9 @@ var CapitalShareValue = function (_a) {
|
|
|
34
35
|
var value = formatNumberAsCurrency(removeAllCharsFromNumber(target.value));
|
|
35
36
|
capitalShareValueControl.field.onChange(value);
|
|
36
37
|
};
|
|
37
|
-
var getCurrency = React.useMemo(function () {
|
|
38
|
-
return t(getCurrencyByCountryIso2(settingsData.businessCountry.iso2));
|
|
39
|
-
}, [settingsData.businessCountry.iso2]);
|
|
40
38
|
var capitalShareValueControl = useController({ control: control, name: 'capitalShareValue' });
|
|
41
39
|
var capitalShareValueValue = capitalShareValueControl.field.value;
|
|
42
40
|
var error = (_b = capitalShareValueControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
43
|
-
return (_jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: t('
|
|
44
|
-
currency: getCurrency
|
|
45
|
-
}), required: true, onChange: handleChange, value: capitalShareValueValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('capital_share_value_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: capitalShareValueValue, isVerified: isVerified }) }) })));
|
|
41
|
+
return (_jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { readOnly: readOnly, label: _jsx(TextWithCurrency, { text: t('capital_share_value_input_label'), countryCode: settingsData.businessCountry.iso2 }), required: true, onChange: handleChange, value: capitalShareValueValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('capital_share_value_hint'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: capitalShareValueValue, isVerified: isVerified }) }) })));
|
|
46
42
|
};
|
|
47
43
|
export default React.memo(CapitalShareValue);
|
|
@@ -54,12 +54,23 @@ var EntityName = function (_a) {
|
|
|
54
54
|
var isCR = licenseType === BusinessType.CR;
|
|
55
55
|
var _j = data.verify.responseBody || {}, entity = _j.entity, flows = _j.flows, entityTypes = _j.entityTypes;
|
|
56
56
|
var _k = entity || {}, AOA_file = _k.AOA_file, id = _k.id, documents = _k.documents, data_status = _k.data_status, data_verification = _k.data_verification, legal_name = _k.legal_name, type = _k.type, license = _k.license;
|
|
57
|
+
var noneEditable = useDataNoneEditable(data_status, [
|
|
58
|
+
'legal_name.en',
|
|
59
|
+
'legal_name.ar',
|
|
60
|
+
'type',
|
|
61
|
+
'license.number',
|
|
62
|
+
'license.additional_info',
|
|
63
|
+
'license.issuing_date',
|
|
64
|
+
'license.expiry_date',
|
|
65
|
+
'documents',
|
|
66
|
+
'AOA_file_id'
|
|
67
|
+
]);
|
|
57
68
|
var getSchema = function () {
|
|
58
69
|
if (isSACountry)
|
|
59
|
-
return EntityNameValidationSchema();
|
|
70
|
+
return EntityNameValidationSchema(noneEditable);
|
|
60
71
|
if (isKWCountry)
|
|
61
|
-
return EntityNameKWValidationSchema();
|
|
62
|
-
return EntityNameOtherCountryValidationSchema();
|
|
72
|
+
return EntityNameKWValidationSchema(noneEditable);
|
|
73
|
+
return EntityNameOtherCountryValidationSchema(noneEditable);
|
|
63
74
|
};
|
|
64
75
|
var methods = useForm({
|
|
65
76
|
resolver: yupResolver(getSchema()),
|
|
@@ -93,17 +104,6 @@ var EntityName = function (_a) {
|
|
|
93
104
|
articleId: defaultArticleFile === null || defaultArticleFile === void 0 ? void 0 : defaultArticleFile.id
|
|
94
105
|
}).isDirty;
|
|
95
106
|
var originalReadOnly = useFormReadOnly(methods, { certificateId: defaultCertificateFiles, articleId: defaultArticleFile });
|
|
96
|
-
var noneEditable = useDataNoneEditable(data_status, [
|
|
97
|
-
'legal_name.en',
|
|
98
|
-
'legal_name.ar',
|
|
99
|
-
'type',
|
|
100
|
-
'license.number',
|
|
101
|
-
'license.additional_info',
|
|
102
|
-
'license.issuing_date',
|
|
103
|
-
'license.expiry_date',
|
|
104
|
-
'documents',
|
|
105
|
-
'AOA_file_id'
|
|
106
|
-
]);
|
|
107
107
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
108
108
|
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
109
109
|
var dataVerified = useDataVerified(data_verification, [
|
|
@@ -155,8 +155,9 @@ var EntityName = function (_a) {
|
|
|
155
155
|
}, [methods.formState.isValid]);
|
|
156
156
|
var disabled = !methods.formState.isValid || uploading || uploadingArticle;
|
|
157
157
|
var showLicenseNumber = isKWCountry ? isCR : true;
|
|
158
|
+
var showExpiryDate = isSACountry ? !isCR : true;
|
|
158
159
|
var showUnifiedNumber = isSACountry ? isCR : false;
|
|
159
160
|
var disableBack = settingsData.appConfig.mode === 'content';
|
|
160
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(LegalName, { readOnly: readOnly['legalName'] || (noneEditable['legal_name.en'] && noneEditable['legal_name.ar']), isVerified: isLegalNameVerified }) })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl }, { children: _jsx(EntityTypeList, { readOnly: readOnly['entityType'] || noneEditable['type'], onListOpen: function () { return handleEntityOpenClose(true); }, onListClose: function () { return handleEntityOpenClose(false); }, isVerified: isEntityTypeVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(
|
|
161
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(LegalName, { readOnly: readOnly['legalName'] || (noneEditable['legal_name.en'] && noneEditable['legal_name.ar']), isVerified: isLegalNameVerified }) })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl }, { children: _jsx(EntityTypeList, { readOnly: readOnly['entityType'] || noneEditable['type'], onListOpen: function () { return handleEntityOpenClose(true); }, onListClose: function () { return handleEntityOpenClose(false); }, isVerified: isEntityTypeVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(UnifiedNumber, { show: showUnifiedNumber, readOnly: readOnly['unifiedNumber'] || noneEditable['license.additional_info'], isVerified: isUnifiedNumberVerified }), _jsx(LicenseNumber, { show: showLicenseNumber, readOnly: readOnly['licenseNumber'] || noneEditable['license.number'], isVerified: isLicenseNumberVerified })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !entityTypeAnchorEl }, { children: _jsx(IssuingDate, { onDateClicked: handleIssueDateOpenClose, readOnly: readOnly['issuingDate'] || noneEditable['license.issuing_date'], isVerified: isIssuingDateVerified }) })), _jsx(Collapse, __assign({ in: !issueAnchorEl && !entityTypeAnchorEl && showExpiryDate }, { children: _jsx(ExpiryDate, { onDateClicked: handleExpiryDateOpenClose, readOnly: readOnly['expiryDate'] || noneEditable['license.expiry_date'], isVerified: isExpiryDateVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(LicenseCertificate, { defaultFiles: defaultCertificateFiles, show: isSACountry ? false : !isKWCountry || isCR, readOnly: readOnly['certificateId'] || noneEditable['documents'] }), _jsx(Article, { defaultFile: defaultArticleFile, show: !isSACountry, readOnly: readOnly['articleId'] || noneEditable['AOA_file_id'], isVerified: isArticleIdVerified })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(Button, __assign({ disableBack: disableBack, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
161
162
|
};
|
|
162
163
|
export default EntityName;
|
|
@@ -14,7 +14,7 @@ import * as React from 'react';
|
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
16
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
17
|
-
import {
|
|
17
|
+
import { removeAllCharsFromNumber } from '../../../../utils';
|
|
18
18
|
import Collapse from '../../../../components/Collapse';
|
|
19
19
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
20
20
|
import Input from '../../../shared/Input';
|
|
@@ -31,7 +31,7 @@ var UnifiedNumber = function (_a) {
|
|
|
31
31
|
var target = _a.target;
|
|
32
32
|
if (bckError)
|
|
33
33
|
dispatch(clearError());
|
|
34
|
-
var value =
|
|
34
|
+
var value = removeAllCharsFromNumber(target.value);
|
|
35
35
|
unifiedNumberControl.field.onChange(value);
|
|
36
36
|
};
|
|
37
37
|
var unifiedNumberControl = useController({ control: control, name: 'unifiedNumber' });
|