@tap-payments/auth-jsconnect 2.8.65-development → 2.8.68-development
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/form.d.ts +1 -1
- package/build/api/auth.d.ts +13 -0
- package/build/api/index.d.ts +2 -2
- package/build/api/lead.d.ts +6 -0
- package/build/assets/locales/ar.json +10 -1
- package/build/assets/locales/en.json +10 -1
- package/build/constants/app.d.ts +1 -0
- package/build/constants/app.js +35 -12
- package/build/constants/assets.d.ts +2 -0
- package/build/constants/assets.js +2 -0
- package/build/features/app/auth/authStore.d.ts +5 -15
- package/build/features/app/auth/authStore.js +58 -113
- package/build/features/app/business/businessStore.d.ts +16 -11
- package/build/features/app/business/businessStore.js +58 -44
- package/build/features/app/connect/connectStore.d.ts +19 -12
- package/build/features/app/connect/connectStore.js +151 -82
- package/build/features/app/connectExpress/connectExpressStore.d.ts +10 -33
- package/build/features/app/connectExpress/connectExpressStore.js +156 -251
- package/build/features/app/individual/individualStore.js +4 -1
- package/build/features/auth/screens/AuthSwitch/AuthSwitch.js +2 -2
- package/build/features/auth/screens/NID/IDNumber.js +1 -1
- package/build/features/auth/screens/NID/NID.js +4 -10
- package/build/features/auth/screens/NID/validation.d.ts +0 -3
- package/build/features/auth/screens/NID/validation.js +0 -1
- package/build/features/auth/screens/OTP/OTP.js +1 -5
- package/build/features/auth/screens/OTP/OTPInput.js +2 -13
- package/build/features/{connectExpress/screens/IdentityOTP/OTP.d.ts → auth/screens/VerifyNafath/VerifyNafath.d.ts} +2 -2
- package/build/features/auth/screens/VerifyNafath/VerifyNafath.js +34 -0
- package/build/features/auth/screens/VerifyNafath/index.d.ts +3 -0
- package/build/features/auth/screens/VerifyNafath/index.js +2 -0
- package/build/features/business/screens/VerifyNafath/VerifyNafath.d.ts +5 -0
- package/build/features/business/screens/VerifyNafath/VerifyNafath.js +34 -0
- package/build/features/business/screens/VerifyNafath/index.d.ts +3 -0
- package/build/features/business/screens/VerifyNafath/index.js +2 -0
- package/build/features/connect/screens/Mobile/Mobile.js +2 -2
- package/build/features/connect/screens/NID/IDNumber.d.ts +1 -0
- package/build/features/connect/screens/NID/IDNumber.js +2 -2
- package/build/features/connect/screens/NID/NID.js +5 -11
- package/build/features/connect/screens/NID/validation.d.ts +0 -3
- package/build/features/connect/screens/NID/validation.js +0 -1
- package/build/features/connect/screens/OTP/OTPInput.js +3 -11
- package/build/features/connect/screens/VerifyNafath/VerifyNafath.d.ts +5 -0
- package/build/features/connect/screens/VerifyNafath/VerifyNafath.js +34 -0
- package/build/features/connect/screens/VerifyNafath/index.d.ts +3 -0
- package/build/features/connect/screens/VerifyNafath/index.js +2 -0
- package/build/features/connectExpress/screens/IdentityVerifyNafath/IdentityVerifyNafath.d.ts +5 -0
- package/build/features/connectExpress/screens/IdentityVerifyNafath/IdentityVerifyNafath.js +34 -0
- package/build/features/connectExpress/screens/IdentityVerifyNafath/index.d.ts +3 -0
- package/build/features/connectExpress/screens/IdentityVerifyNafath/index.js +2 -0
- package/build/features/connectExpress/screens/Mobile/Mobile.js +2 -2
- package/build/features/connectExpress/screens/NID/IDNumber.d.ts +1 -0
- package/build/features/connectExpress/screens/NID/IDNumber.js +2 -2
- package/build/features/connectExpress/screens/NID/NID.js +4 -9
- package/build/features/connectExpress/screens/NID/validation.d.ts +0 -3
- package/build/features/connectExpress/screens/NID/validation.js +0 -2
- package/build/features/connectExpress/screens/NIDMissed/NID.js +2 -2
- package/build/features/connectExpress/screens/OTP/OTP.js +5 -13
- package/build/features/connectExpress/screens/OTP/OTPInput.js +3 -11
- package/build/features/connectExpress/screens/VerifyNafath/VerifyNafath.d.ts +5 -0
- package/build/features/connectExpress/screens/VerifyNafath/VerifyNafath.js +34 -0
- package/build/features/connectExpress/screens/VerifyNafath/index.d.ts +3 -0
- package/build/features/connectExpress/screens/VerifyNafath/index.js +2 -0
- package/build/features/featuresScreens.js +21 -6
- package/build/features/shared/Button/NafathButton.d.ts +7 -0
- package/build/features/shared/Button/{AbsherButton.js → NafathButton.js} +13 -3
- package/build/features/shared/Button/index.d.ts +2 -2
- package/build/features/shared/Button/index.js +2 -2
- package/build/features/shared/NafathVerification/NafathVerification.d.ts +13 -0
- package/build/features/shared/NafathVerification/NafathVerification.js +92 -0
- package/build/features/shared/NafathVerification/VerifyNafathLoading.d.ts +8 -0
- package/build/features/shared/NafathVerification/VerifyNafathLoading.js +53 -0
- package/build/features/shared/NafathVerification/VerifyNafathSuccess.d.ts +5 -0
- package/build/features/shared/NafathVerification/VerifyNafathSuccess.js +8 -0
- package/build/features/shared/NafathVerification/index.d.ts +2 -0
- package/build/features/shared/NafathVerification/index.js +2 -0
- package/build/hooks/useAppTheme.js +4 -3
- package/build/theme/palette.js +2 -1
- package/build/theme/theme.d.ts +1 -1
- package/build/theme/theme.js +2 -2
- package/package.json +1 -1
- package/build/features/auth/screens/NID/DOB.d.ts +0 -6
- package/build/features/auth/screens/NID/DOB.js +0 -47
- package/build/features/business/screens/OTP/OTP.d.ts +0 -8
- package/build/features/business/screens/OTP/OTP.js +0 -90
- package/build/features/business/screens/OTP/OTPInput.d.ts +0 -5
- package/build/features/business/screens/OTP/OTPInput.js +0 -49
- package/build/features/business/screens/OTP/index.d.ts +0 -3
- package/build/features/business/screens/OTP/index.js +0 -2
- package/build/features/business/screens/OTP/validation.d.ts +0 -8
- package/build/features/business/screens/OTP/validation.js +0 -4
- package/build/features/connect/screens/NID/DOB.d.ts +0 -5
- package/build/features/connect/screens/NID/DOB.js +0 -47
- package/build/features/connectExpress/screens/IdentityOTP/OTP.js +0 -88
- package/build/features/connectExpress/screens/IdentityOTP/OTPInput.d.ts +0 -5
- package/build/features/connectExpress/screens/IdentityOTP/OTPInput.js +0 -56
- package/build/features/connectExpress/screens/IdentityOTP/index.d.ts +0 -3
- package/build/features/connectExpress/screens/IdentityOTP/index.js +0 -2
- package/build/features/connectExpress/screens/IdentityOTP/validation.d.ts +0 -8
- package/build/features/connectExpress/screens/IdentityOTP/validation.js +0 -4
- package/build/features/connectExpress/screens/NID/DOB.d.ts +0 -6
- package/build/features/connectExpress/screens/NID/DOB.js +0 -47
- package/build/features/shared/Button/AbsherButton.d.ts +0 -7
|
@@ -17,25 +17,22 @@ import { styled } from '@mui/material/styles';
|
|
|
17
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
18
|
import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
|
|
19
19
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
20
|
-
import { clearError, authSelector,
|
|
20
|
+
import { clearError, authSelector, createNafathAuth } from '../../../app/auth/authStore';
|
|
21
21
|
import Form from '../../../../components/Form';
|
|
22
22
|
import Button from '../../../shared/Button';
|
|
23
23
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
24
|
-
import Collapse from '../../../../components/Collapse';
|
|
25
24
|
import { deepCopy } from '../../../../utils';
|
|
26
25
|
import IDNumber from './IDNumber';
|
|
27
|
-
import DOB from './DOB';
|
|
28
26
|
import { NIDValidationSchema } from './validation';
|
|
29
27
|
var FormStyled = styled(Form)(function () { return ({
|
|
30
28
|
display: 'flex',
|
|
31
29
|
flexDirection: 'column'
|
|
32
30
|
}); });
|
|
33
31
|
var NID = function (_a) {
|
|
34
|
-
var _b = React.useState(false), collapse = _b[0], setCollapse = _b[1];
|
|
35
32
|
var isAr = useLanguage().isAr;
|
|
36
33
|
var dispatch = useAppDispatch();
|
|
37
34
|
var t = useTranslation().t;
|
|
38
|
-
var
|
|
35
|
+
var _b = useAppSelector(authSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
39
36
|
var methods = useForm({
|
|
40
37
|
resolver: yupResolver(NIDValidationSchema()),
|
|
41
38
|
defaultValues: data.nidData,
|
|
@@ -48,15 +45,12 @@ var NID = function (_a) {
|
|
|
48
45
|
React.useEffect(function () {
|
|
49
46
|
}, []);
|
|
50
47
|
var onSubmit = function (data) {
|
|
51
|
-
dispatch(
|
|
52
|
-
};
|
|
53
|
-
var handleCollapseOpenClose = function (flag) {
|
|
54
|
-
setCollapse(flag);
|
|
48
|
+
dispatch(createNafathAuth(deepCopy(data)));
|
|
55
49
|
};
|
|
56
50
|
var onBack = function () {
|
|
57
51
|
dispatch(handlePrevScreenStep());
|
|
58
52
|
};
|
|
59
53
|
var disabled = !methods.formState.isValid;
|
|
60
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(
|
|
54
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(IDNumber, { show: true }), _jsx(Button, __assign({ loading: loading, isAr: isAr, onBackClicked: onBack, disabled: disabled, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
61
55
|
};
|
|
62
56
|
export default React.memo(NID);
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
export declare const NIDValidationSchema: () => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
-
dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
4
3
|
nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
5
4
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
6
|
-
dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
7
5
|
nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
8
6
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
9
|
-
dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
10
7
|
nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
11
8
|
}>>>;
|
|
@@ -16,7 +16,7 @@ import { useForm, FormProvider } from 'react-hook-form';
|
|
|
16
16
|
import Box from '@mui/material/Box/Box';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
18
|
import Text from '../../../../components/Text';
|
|
19
|
-
import { clearError, authSelector, verifyMobileOtp,
|
|
19
|
+
import { clearError, authSelector, verifyMobileOtp, resetOTPValue, verifyEmailOtp } from '../../../app/auth/authStore';
|
|
20
20
|
import Button from '../../../shared/Button';
|
|
21
21
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
22
22
|
import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
|
|
@@ -99,10 +99,6 @@ var OTP = function () {
|
|
|
99
99
|
};
|
|
100
100
|
}, []);
|
|
101
101
|
var onSubmit = function (formData) {
|
|
102
|
-
if (isNidAuth) {
|
|
103
|
-
dispatch(verifyNIDOtp(deepCopy(formData)));
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
102
|
if (isEmailAuth) {
|
|
107
103
|
dispatch(verifyEmailOtp(deepCopy(formData)));
|
|
108
104
|
return;
|
|
@@ -18,7 +18,7 @@ import { styled } from '@mui/material/styles';
|
|
|
18
18
|
import OTPField from '../../../shared/OTP';
|
|
19
19
|
import { DEFAULT_TIMER_VALUE } from '../../../../constants';
|
|
20
20
|
import { AuthForType } from '../../../../@types';
|
|
21
|
-
import { resendMobileAuthOTP,
|
|
21
|
+
import { resendMobileAuthOTP, authSelector, clearError, resendEmailAuthOTP } from '../../../app/auth/authStore';
|
|
22
22
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
23
23
|
import { sendCustomEventToGTM } from '../../../../utils';
|
|
24
24
|
var BoxStyled = styled(Box)(function (_a) {
|
|
@@ -35,8 +35,7 @@ var OTPInput = function (_a) {
|
|
|
35
35
|
var dispatch = useAppDispatch();
|
|
36
36
|
var otpControl = useController({ name: 'otp', control: control });
|
|
37
37
|
var _c = useAppSelector(authSelector), data = _c.data, error = _c.error;
|
|
38
|
-
var mobileData = data.mobileData,
|
|
39
|
-
var isNidAuth = data.otpData.authFor === AuthForType.NATIONAL_ID;
|
|
38
|
+
var mobileData = data.mobileData, emailData = data.emailData;
|
|
40
39
|
var isEmailAuth = data.otpData.authFor === AuthForType.EMAIL;
|
|
41
40
|
var handleOnOTPChange = function (otp) {
|
|
42
41
|
if (error)
|
|
@@ -56,12 +55,6 @@ var OTPInput = function (_a) {
|
|
|
56
55
|
sendEventAskAnotherOTP();
|
|
57
56
|
dispatch(resendMobileAuthOTP(mobileData));
|
|
58
57
|
};
|
|
59
|
-
var handleOnResendAbsherOTP = function () {
|
|
60
|
-
if (otpControl.field.value)
|
|
61
|
-
setValue('otp', '', { shouldValidate: true });
|
|
62
|
-
sendEventAskAnotherOTP();
|
|
63
|
-
dispatch(resendNIDAuthOTP(nidData));
|
|
64
|
-
};
|
|
65
58
|
var handleOnResendEmailOTP = function () {
|
|
66
59
|
if (otpControl.field.value)
|
|
67
60
|
setValue('otp', '', { shouldValidate: true });
|
|
@@ -69,10 +62,6 @@ var OTPInput = function (_a) {
|
|
|
69
62
|
dispatch(resendEmailAuthOTP(emailData));
|
|
70
63
|
};
|
|
71
64
|
var onResendClick = function () {
|
|
72
|
-
if (isNidAuth) {
|
|
73
|
-
handleOnResendAbsherOTP();
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
65
|
if (isEmailAuth) {
|
|
77
66
|
handleOnResendEmailOTP();
|
|
78
67
|
return;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export interface
|
|
2
|
+
export interface VerifyNafathProps {
|
|
3
3
|
}
|
|
4
|
-
declare const _default: React.MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
|
|
4
|
+
declare const _default: React.MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element | null>;
|
|
5
5
|
export default _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { authSelector, verifyNafath as verifyNafathFun } from '../../../app/auth/authStore';
|
|
4
|
+
import NafathVerification from '../../../shared/NafathVerification';
|
|
5
|
+
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
6
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
7
|
+
var VerifyNafath = function () {
|
|
8
|
+
var _a;
|
|
9
|
+
var _b = React.useState(false), success = _b[0], setSuccess = _b[1];
|
|
10
|
+
var _c = React.useState(false), isReady = _c[0], setIsReady = _c[1];
|
|
11
|
+
var dispatch = useAppDispatch();
|
|
12
|
+
var data = useAppSelector(authSelector).data;
|
|
13
|
+
var _d = ((_a = data.responseData) === null || _a === void 0 ? void 0 : _a.authResponse) || {}, expiry = _d.expiry, app_url_android = _d.app_url_android, app_url_ios = _d.app_url_ios, random = _d.random;
|
|
14
|
+
React.useEffect(function () {
|
|
15
|
+
if (data.responseData && !isReady) {
|
|
16
|
+
setIsReady(true);
|
|
17
|
+
}
|
|
18
|
+
}, [data.responseData]);
|
|
19
|
+
React.useEffect(function () {
|
|
20
|
+
if (!isReady)
|
|
21
|
+
return;
|
|
22
|
+
var promise = dispatch(verifyNafathFun({ onSuccess: function () { return setSuccess(true); } }));
|
|
23
|
+
return function () {
|
|
24
|
+
promise === null || promise === void 0 ? void 0 : promise.abort();
|
|
25
|
+
};
|
|
26
|
+
}, [isReady]);
|
|
27
|
+
var onBack = React.useCallback(function () {
|
|
28
|
+
dispatch(handlePrevScreenStep());
|
|
29
|
+
}, []);
|
|
30
|
+
if (!isReady)
|
|
31
|
+
return null;
|
|
32
|
+
return (_jsx(NafathVerification, { randomNumber: random, expiryInSeconds: expiry, success: success, urls: { android: app_url_android, ios: app_url_ios }, onFinish: function () { return onBack(); } }));
|
|
33
|
+
};
|
|
34
|
+
export default React.memo(VerifyNafath);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { businessSelector, verifyNafath } from '../../../app/business/businessStore';
|
|
4
|
+
import NafathVerification from '../../../shared/NafathVerification';
|
|
5
|
+
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
6
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
7
|
+
var VerifyNafath = function () {
|
|
8
|
+
var _a = React.useState(false), success = _a[0], setSuccess = _a[1];
|
|
9
|
+
var _b = React.useState(false), isReady = _b[0], setIsReady = _b[1];
|
|
10
|
+
var dispatch = useAppDispatch();
|
|
11
|
+
var data = useAppSelector(businessSelector).data;
|
|
12
|
+
var responseBody = data.nidData.responseBody;
|
|
13
|
+
var _c = responseBody || {}, expiry = _c.expiry, app_url_android = _c.app_url_android, app_url_ios = _c.app_url_ios, random = _c.random;
|
|
14
|
+
React.useEffect(function () {
|
|
15
|
+
if (responseBody && !isReady) {
|
|
16
|
+
setIsReady(true);
|
|
17
|
+
}
|
|
18
|
+
}, [responseBody]);
|
|
19
|
+
React.useEffect(function () {
|
|
20
|
+
if (!isReady)
|
|
21
|
+
return;
|
|
22
|
+
var promise = dispatch(verifyNafath({ onSuccess: function () { return setSuccess(true); } }));
|
|
23
|
+
return function () {
|
|
24
|
+
promise === null || promise === void 0 ? void 0 : promise.abort();
|
|
25
|
+
};
|
|
26
|
+
}, [isReady]);
|
|
27
|
+
var onBack = React.useCallback(function () {
|
|
28
|
+
dispatch(handlePrevScreenStep());
|
|
29
|
+
}, []);
|
|
30
|
+
if (!isReady)
|
|
31
|
+
return null;
|
|
32
|
+
return (_jsx(NafathVerification, { randomNumber: random, expiryInSeconds: expiry, success: success, urls: { android: app_url_android, ios: app_url_ios }, onFinish: function () { return onBack(); } }));
|
|
33
|
+
};
|
|
34
|
+
export default React.memo(VerifyNafath);
|
|
@@ -18,7 +18,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
18
18
|
import { styled, alpha } from '@mui/material/styles';
|
|
19
19
|
import Collapse from '../../../../components/Collapse';
|
|
20
20
|
import Form from '../../../../components/Form';
|
|
21
|
-
import Button, {
|
|
21
|
+
import Button, { NafathButton, MobileButton } from '../../../shared/Button';
|
|
22
22
|
import { useAppDispatch, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
|
|
23
23
|
import { handleCurrentActiveScreen, handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
24
24
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
@@ -132,6 +132,6 @@ var Mobile = function (_a) {
|
|
|
132
132
|
var disabled = !methods.formState.isValid;
|
|
133
133
|
var title = t('join_our_community');
|
|
134
134
|
var subTitle = t('ide_terms_and_conditions_description');
|
|
135
|
-
return (_jsxs(ScreenContainer, { children: [(title || subTitle) && _jsx(MIDTitle, { show: !listActive, title: title, description: subTitle }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { show: !isBusinessListActive, countries: settingsStore.data.countries, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } }) }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(Button, __assign({ isAr: isAr, onBackClicked: onBackToCountryList, disableBack: !data.isStartFromBusinessCountry, disabled: disabled || settingsStore.loading, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: !methods.formState.isValid && !isOtherThanKWOrSACountry }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), isKWCountry ? (_jsx(MobileButton, __assign({ disabled: settingsStore.loading || loading, onClick: function () { return onBack(); }, icon: ICONS_NAMES.PACI_ICON }, { children: t('paci_button_label') }))) : (_jsx(
|
|
135
|
+
return (_jsxs(ScreenContainer, { children: [(title || subTitle) && _jsx(MIDTitle, { show: !listActive, title: title, description: subTitle }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { show: !isBusinessListActive, countries: settingsStore.data.countries, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } }) }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(Button, __assign({ isAr: isAr, onBackClicked: onBackToCountryList, disableBack: !data.isStartFromBusinessCountry, disabled: disabled || settingsStore.loading, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: !methods.formState.isValid && !isOtherThanKWOrSACountry }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), isKWCountry ? (_jsx(MobileButton, __assign({ disabled: settingsStore.loading || loading, onClick: function () { return onBack(); }, icon: ICONS_NAMES.PACI_ICON }, { children: t('paci_button_label') }))) : (_jsx(NafathButton, __assign({ disabled: settingsStore.loading || loading, onClick: function () { return onBack(); } }, { children: t('nafath_button_label') })))] }))] }))] })) }))] }));
|
|
136
136
|
};
|
|
137
137
|
export default React.memo(Mobile);
|
|
@@ -36,7 +36,7 @@ var InputLabelStyled = styled(Text)(function (_a) {
|
|
|
36
36
|
});
|
|
37
37
|
var IDNumber = React.forwardRef(function (_a, ref) {
|
|
38
38
|
var _b;
|
|
39
|
-
var show = _a.show;
|
|
39
|
+
var show = _a.show, isValid = _a.isValid;
|
|
40
40
|
var t = useTranslation().t;
|
|
41
41
|
var _c = useFormContext(), control = _c.control, setValue = _c.setValue;
|
|
42
42
|
var nidControl = useController({ control: control, name: 'nid' });
|
|
@@ -54,6 +54,6 @@ var IDNumber = React.forwardRef(function (_a, ref) {
|
|
|
54
54
|
};
|
|
55
55
|
var nidValue = nidControl.field.value;
|
|
56
56
|
var error = (_b = nidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
57
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { dir: 'ltr', type: 'tel', inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: _jsx(EndAdornment, { value: nidValue, error: error, onClear: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
|
|
57
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: isValid ? 5 : 0 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { dir: 'ltr', type: 'tel', inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: _jsx(EndAdornment, { value: nidValue, error: error, onClear: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
|
|
58
58
|
});
|
|
59
59
|
export default React.memo(IDNumber);
|
|
@@ -18,7 +18,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
|
|
|
18
18
|
import { NIDValidationSchema } from './validation';
|
|
19
19
|
import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
|
|
20
20
|
import { handleCurrentActiveScreen, handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
21
|
-
import { clearError, connectSelector,
|
|
21
|
+
import { clearError, connectSelector, createNafathAuth, resetMobileScreen, resetStore } from '../../../app/connect/connectStore';
|
|
22
22
|
import Form from '../../../../components/Form';
|
|
23
23
|
import Button, { MobileButton } from '../../../shared/Button';
|
|
24
24
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
@@ -28,7 +28,6 @@ import Box from '@mui/material/Box';
|
|
|
28
28
|
import Divider from '@mui/material/Divider';
|
|
29
29
|
import Text from '../../../../components/Text';
|
|
30
30
|
import IDNumber from './IDNumber';
|
|
31
|
-
import DOB from './DOB';
|
|
32
31
|
var FormStyled = styled(Form)(function () { return ({
|
|
33
32
|
display: 'flex',
|
|
34
33
|
flexDirection: 'column'
|
|
@@ -58,17 +57,15 @@ var OrBoxStyled = styled(Box)(function (_a) {
|
|
|
58
57
|
});
|
|
59
58
|
});
|
|
60
59
|
var NID = function (_a) {
|
|
61
|
-
var _b = React.useState(false), collapse = _b[0], setCollapse = _b[1];
|
|
62
60
|
var isAr = useLanguage().isAr;
|
|
63
61
|
var dispatch = useAppDispatch();
|
|
64
62
|
var t = useTranslation().t;
|
|
65
|
-
var
|
|
66
|
-
var
|
|
63
|
+
var _b = useAppSelector(connectSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
64
|
+
var nid = data.nidData.nid;
|
|
67
65
|
var settingsStore = useAppSelector(settingsSelector);
|
|
68
66
|
var methods = useForm({
|
|
69
67
|
resolver: yupResolver(NIDValidationSchema),
|
|
70
68
|
defaultValues: {
|
|
71
|
-
dob: dob,
|
|
72
69
|
nid: nid
|
|
73
70
|
},
|
|
74
71
|
mode: 'onChange'
|
|
@@ -77,12 +74,9 @@ var NID = function (_a) {
|
|
|
77
74
|
handleClearError();
|
|
78
75
|
}, [methods.formState.isValid]);
|
|
79
76
|
var onSubmit = function (data) {
|
|
80
|
-
dispatch(
|
|
77
|
+
dispatch(createNafathAuth(deepCopy(data)));
|
|
81
78
|
dispatch(resetMobileScreen(settingsStore.data.businessCountry));
|
|
82
79
|
};
|
|
83
|
-
var handleCollapseOpenClose = function (flag) {
|
|
84
|
-
setCollapse(flag);
|
|
85
|
-
};
|
|
86
80
|
var handleClearError = function () {
|
|
87
81
|
if (error)
|
|
88
82
|
dispatch(clearError());
|
|
@@ -102,6 +96,6 @@ var NID = function (_a) {
|
|
|
102
96
|
dispatch(resetStore());
|
|
103
97
|
}, []);
|
|
104
98
|
var disabled = !methods.formState.isValid;
|
|
105
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(
|
|
99
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(IDNumber, { isValid: methods.formState.isValid, show: true }), _jsx(Button, __assign({ loading: loading, isAr: isAr, onBackClicked: onBackToCountryList, disableBack: !data.isStartFromBusinessCountry, disabled: disabled || settingsStore.loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: !methods.formState.isValid }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(MobileButton, __assign({ onClick: function () { return onBack(); }, disabled: loading || settingsStore.loading }, { children: t('mobile_button_label') }))] }))] })) })) }));
|
|
106
100
|
};
|
|
107
101
|
export default React.memo(NID);
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
export declare const NIDValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
-
dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
4
3
|
nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
5
4
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
6
|
-
dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
7
5
|
nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
8
6
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
9
|
-
dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
10
7
|
nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
11
8
|
}>>>;
|
|
@@ -17,8 +17,7 @@ import Box from '@mui/material/Box/Box';
|
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
18
|
import OTPField from '../../../shared/OTP';
|
|
19
19
|
import { DEFAULT_TIMER_VALUE } from '../../../../constants';
|
|
20
|
-
import {
|
|
21
|
-
import { clearError, connectSelector, resendOTPMobile, resendOTPNID } from '../../../app/connect/connectStore';
|
|
20
|
+
import { clearError, connectSelector, resendOTPMobile } from '../../../app/connect/connectStore';
|
|
22
21
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
23
22
|
import { sendCustomEventToGTM } from '../../../../utils';
|
|
24
23
|
var BoxStyled = styled(Box)(function (_a) {
|
|
@@ -34,8 +33,7 @@ var OTPInput = function (_a) {
|
|
|
34
33
|
var t = useTranslation().t;
|
|
35
34
|
var dispatch = useAppDispatch();
|
|
36
35
|
var otpControl = useController({ name: 'otp', control: control });
|
|
37
|
-
var
|
|
38
|
-
var startWithNID = data.otpData.authFor === AuthForType.NATIONAL_ID;
|
|
36
|
+
var error = useAppSelector(connectSelector).error;
|
|
39
37
|
var handleOnOTPChange = function (otp) {
|
|
40
38
|
if (error)
|
|
41
39
|
dispatch(clearError());
|
|
@@ -54,13 +52,7 @@ var OTPInput = function (_a) {
|
|
|
54
52
|
sendEventAskAnotherOTP();
|
|
55
53
|
dispatch(resendOTPMobile());
|
|
56
54
|
};
|
|
57
|
-
var handleOnResendAbsherOTP = function () {
|
|
58
|
-
if (otpControl.field.value)
|
|
59
|
-
setValue('otp', '', { shouldValidate: true });
|
|
60
|
-
sendEventAskAnotherOTP();
|
|
61
|
-
dispatch(resendOTPNID());
|
|
62
|
-
};
|
|
63
55
|
var otpValue = otpControl.field.value;
|
|
64
|
-
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick:
|
|
56
|
+
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()); } }) })));
|
|
65
57
|
};
|
|
66
58
|
export default React.memo(OTPInput);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { connectSelector, verifyNafath as verifyNafathFun } from '../../../app/connect/connectStore';
|
|
4
|
+
import NafathVerification from '../../../shared/NafathVerification';
|
|
5
|
+
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
6
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
7
|
+
var VerifyNafath = function () {
|
|
8
|
+
var _a = React.useState(false), success = _a[0], setSuccess = _a[1];
|
|
9
|
+
var _b = React.useState(false), isReady = _b[0], setIsReady = _b[1];
|
|
10
|
+
var dispatch = useAppDispatch();
|
|
11
|
+
var data = useAppSelector(connectSelector).data;
|
|
12
|
+
var responseBody = data.nidData.responseBody;
|
|
13
|
+
var _c = responseBody || {}, expiry = _c.expiry, app_url_android = _c.app_url_android, app_url_ios = _c.app_url_ios, random = _c.random;
|
|
14
|
+
React.useEffect(function () {
|
|
15
|
+
if (responseBody && !isReady) {
|
|
16
|
+
setIsReady(true);
|
|
17
|
+
}
|
|
18
|
+
}, [responseBody]);
|
|
19
|
+
React.useEffect(function () {
|
|
20
|
+
if (!isReady)
|
|
21
|
+
return;
|
|
22
|
+
var promise = dispatch(verifyNafathFun({ onSuccess: function () { return setSuccess(true); } }));
|
|
23
|
+
return function () {
|
|
24
|
+
promise === null || promise === void 0 ? void 0 : promise.abort();
|
|
25
|
+
};
|
|
26
|
+
}, [isReady]);
|
|
27
|
+
var onBack = React.useCallback(function () {
|
|
28
|
+
dispatch(handlePrevScreenStep());
|
|
29
|
+
}, []);
|
|
30
|
+
if (!isReady)
|
|
31
|
+
return null;
|
|
32
|
+
return (_jsx(NafathVerification, { randomNumber: random, expiryInSeconds: expiry, success: success, urls: { android: app_url_android, ios: app_url_ios }, onFinish: function () { return onBack(); } }));
|
|
33
|
+
};
|
|
34
|
+
export default React.memo(VerifyNafath);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { connectExpressSelector, verifyNafathIdentityAsync } from '../../../app/connectExpress/connectExpressStore';
|
|
4
|
+
import NafathVerification from '../../../shared/NafathVerification';
|
|
5
|
+
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
6
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
7
|
+
var IdentityVerifyNafath = function () {
|
|
8
|
+
var _a = React.useState(false), success = _a[0], setSuccess = _a[1];
|
|
9
|
+
var _b = React.useState(false), isReady = _b[0], setIsReady = _b[1];
|
|
10
|
+
var dispatch = useAppDispatch();
|
|
11
|
+
var data = useAppSelector(connectExpressSelector).data;
|
|
12
|
+
var authData = (data.responseData || {}).authData;
|
|
13
|
+
var _c = authData || {}, expiry = _c.expiry, app_url_android = _c.app_url_android, app_url_ios = _c.app_url_ios, random = _c.random;
|
|
14
|
+
React.useEffect(function () {
|
|
15
|
+
if (authData && !isReady) {
|
|
16
|
+
setIsReady(true);
|
|
17
|
+
}
|
|
18
|
+
}, [authData]);
|
|
19
|
+
React.useEffect(function () {
|
|
20
|
+
if (!isReady)
|
|
21
|
+
return;
|
|
22
|
+
var promise = dispatch(verifyNafathIdentityAsync({ onSuccess: function () { return setSuccess(true); } }));
|
|
23
|
+
return function () {
|
|
24
|
+
promise === null || promise === void 0 ? void 0 : promise.abort();
|
|
25
|
+
};
|
|
26
|
+
}, [isReady]);
|
|
27
|
+
var onBack = React.useCallback(function () {
|
|
28
|
+
dispatch(handlePrevScreenStep());
|
|
29
|
+
}, []);
|
|
30
|
+
if (!isReady)
|
|
31
|
+
return null;
|
|
32
|
+
return (_jsx(NafathVerification, { randomNumber: random, expiryInSeconds: expiry, success: success, urls: { android: app_url_android, ios: app_url_ios }, onFinish: function () { return onBack(); } }));
|
|
33
|
+
};
|
|
34
|
+
export default React.memo(IdentityVerifyNafath);
|
|
@@ -18,7 +18,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
18
18
|
import { styled, alpha } from '@mui/material/styles';
|
|
19
19
|
import Collapse from '../../../../components/Collapse';
|
|
20
20
|
import Form from '../../../../components/Form';
|
|
21
|
-
import Button, {
|
|
21
|
+
import Button, { NafathButton, MobileButton } from '../../../shared/Button';
|
|
22
22
|
import { useAppDispatch, useAppSelector, useCountry, useFormErrorAndUpdateReadOnly, useFormReadOnly } from '../../../../hooks';
|
|
23
23
|
import { handleCurrentActiveScreen, handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
24
24
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
@@ -117,6 +117,6 @@ var Mobile = function (_a) {
|
|
|
117
117
|
var originalReadOnly = useFormReadOnly(methods);
|
|
118
118
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly);
|
|
119
119
|
var disabled = !methods.formState.isValid;
|
|
120
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { readOnly: readOnly['mobile'], show: true, countries: settingData.countries, onListOpen: handleCountryOpen, onListClose: handleCountryClose }) }), _jsxs(Collapse, __assign({ in: !anchor }, { children: [_jsx(TAC, { show: isLeadIdPassed, readOnly: readOnly['termAndConditionChecked'] }), _jsx(Button, __assign({ isAr: isAr, onBackClicked: onBackToCountryList, disableBack: !data.isStartFromBusinessCountry, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: (isLeadIdPassed ? !isLeadIdentityIdAvailable : !methods.formState.isValid) && !isOther }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), isKuwait ? (_jsx(MobileButton, __assign({ disabled: loading, onClick: function () { return onBack(); }, icon: ICONS_NAMES.PACI_ICON }, { children: t('paci_button_label') }))) : (_jsx(
|
|
120
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { readOnly: readOnly['mobile'], show: true, countries: settingData.countries, onListOpen: handleCountryOpen, onListClose: handleCountryClose }) }), _jsxs(Collapse, __assign({ in: !anchor }, { children: [_jsx(TAC, { show: isLeadIdPassed, readOnly: readOnly['termAndConditionChecked'] }), _jsx(Button, __assign({ isAr: isAr, onBackClicked: onBackToCountryList, disableBack: !data.isStartFromBusinessCountry, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: (isLeadIdPassed ? !isLeadIdentityIdAvailable : !methods.formState.isValid) && !isOther }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), isKuwait ? (_jsx(MobileButton, __assign({ disabled: loading, onClick: function () { return onBack(); }, icon: ICONS_NAMES.PACI_ICON }, { children: t('paci_button_label') }))) : (_jsx(NafathButton, __assign({ disabled: loading, onClick: function () { return onBack(); } }, { children: t('nafath_button_label') })))] }))] }))] })) })) }));
|
|
121
121
|
};
|
|
122
122
|
export default React.memo(Mobile);
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
interface IDNumberProps {
|
|
3
3
|
show: boolean;
|
|
4
4
|
readOnly?: boolean;
|
|
5
|
+
isValid: boolean;
|
|
5
6
|
}
|
|
6
7
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<IDNumberProps & React.RefAttributes<unknown>>>;
|
|
7
8
|
export default _default;
|
|
@@ -38,7 +38,7 @@ var InputLabelStyled = styled(Text)(function (_a) {
|
|
|
38
38
|
});
|
|
39
39
|
var IDNumber = React.forwardRef(function (_a, ref) {
|
|
40
40
|
var _b, _c, _d;
|
|
41
|
-
var show = _a.show, readOnly = _a.readOnly;
|
|
41
|
+
var show = _a.show, readOnly = _a.readOnly, isValid = _a.isValid;
|
|
42
42
|
var t = useTranslation().t;
|
|
43
43
|
var control = useFormContext().control;
|
|
44
44
|
var nidControl = useController({ control: control, name: 'nid' });
|
|
@@ -55,6 +55,6 @@ var IDNumber = React.forwardRef(function (_a, ref) {
|
|
|
55
55
|
var error = (_b = nidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
56
56
|
var isLeadIdPassed = data.isLeadIdPassed, responseData = data.responseData;
|
|
57
57
|
var isLeadIdentityIdAvailable = !!((_d = (_c = responseData === null || responseData === void 0 ? void 0 : responseData.leadData) === null || _c === void 0 ? void 0 : _c.identification) === null || _d === void 0 ? void 0 : _d.id);
|
|
58
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { readOnly: readOnly, dir: 'ltr', type: 'tel', inputProps: { maxLength: ID_NUMBER_LENGTH }, disabled: isLeadIdPassed && isLeadIdentityIdAvailable, onChange: handleIdChange, value: nidValue, endAdornment: _jsx(EndAdornment, { value: nidValue, error: error, onClear: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
|
|
58
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: isValid ? 5 : 0 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { readOnly: readOnly, dir: 'ltr', type: 'tel', inputProps: { maxLength: ID_NUMBER_LENGTH }, disabled: isLeadIdPassed && isLeadIdentityIdAvailable, onChange: handleIdChange, value: nidValue, endAdornment: _jsx(EndAdornment, { value: nidValue, error: error, onClear: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
|
|
59
59
|
});
|
|
60
60
|
export default React.memo(IDNumber);
|
|
@@ -18,7 +18,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
|
|
|
18
18
|
import { NIDValidationSchema } from './validation';
|
|
19
19
|
import { useAppDispatch, useLanguage, useAppSelector, useFormReadOnly, useFormErrorAndUpdateReadOnly } from '../../../../hooks';
|
|
20
20
|
import { handleCurrentActiveScreen, handlePrevScreenStep } from '../../../../app/settings';
|
|
21
|
-
import { clearError, connectExpressSelector,
|
|
21
|
+
import { clearError, connectExpressSelector, createNafathAuth } from '../../../app/connectExpress/connectExpressStore';
|
|
22
22
|
import Form from '../../../../components/Form';
|
|
23
23
|
import Button, { MobileButton } from '../../../shared/Button';
|
|
24
24
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
@@ -27,7 +27,6 @@ import Box from '@mui/material/Box';
|
|
|
27
27
|
import Divider from '@mui/material/Divider';
|
|
28
28
|
import Text from '../../../../components/Text';
|
|
29
29
|
import IDNumber from './IDNumber';
|
|
30
|
-
import DOB from './DOB';
|
|
31
30
|
import TAC from './TAC';
|
|
32
31
|
import { deepCopy, sendCustomEventToGTM } from '../../../../utils';
|
|
33
32
|
var FormStyled = styled(Form)(function () { return ({
|
|
@@ -60,11 +59,10 @@ var OrBoxStyled = styled(Box)(function (_a) {
|
|
|
60
59
|
});
|
|
61
60
|
var NID = function (_a) {
|
|
62
61
|
var _b, _c;
|
|
63
|
-
var _d = React.useState(false), collapse = _d[0], setCollapse = _d[1];
|
|
64
62
|
var isAr = useLanguage().isAr;
|
|
65
63
|
var dispatch = useAppDispatch();
|
|
66
64
|
var t = useTranslation().t;
|
|
67
|
-
var
|
|
65
|
+
var _d = useAppSelector(connectExpressSelector), data = _d.data, loading = _d.loading, error = _d.error;
|
|
68
66
|
var isLeadIdPassed = data.isLeadIdPassed, responseData = data.responseData;
|
|
69
67
|
var methods = useForm({
|
|
70
68
|
resolver: yupResolver(NIDValidationSchema(isLeadIdPassed)),
|
|
@@ -78,10 +76,7 @@ var NID = function (_a) {
|
|
|
78
76
|
React.useEffect(function () {
|
|
79
77
|
}, []);
|
|
80
78
|
var onSubmit = function (data) {
|
|
81
|
-
dispatch(
|
|
82
|
-
};
|
|
83
|
-
var handleCollapseOpenClose = function (flag) {
|
|
84
|
-
setCollapse(flag);
|
|
79
|
+
dispatch(createNafathAuth(deepCopy(data)));
|
|
85
80
|
};
|
|
86
81
|
var onBack = function () {
|
|
87
82
|
sendCustomEventToGTM({
|
|
@@ -98,6 +93,6 @@ var NID = function (_a) {
|
|
|
98
93
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly);
|
|
99
94
|
var disabled = !methods.formState.isValid;
|
|
100
95
|
var isLeadIdentityIdAvailable = (_c = (_b = responseData === null || responseData === void 0 ? void 0 : responseData.leadData) === null || _b === void 0 ? void 0 : _b.identification) === null || _c === void 0 ? void 0 : _c.id;
|
|
101
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(
|
|
96
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(IDNumber, { isValid: methods.formState.isValid, show: true, readOnly: readOnly['nid'] }), _jsx(TAC, { show: isLeadIdPassed, readOnly: readOnly['termAndConditionChecked'] }), _jsx(Button, __assign({ loading: loading, isAr: isAr, onBackClicked: onBackToCountryList, disableBack: !data.isStartFromBusinessCountry, disabled: disabled, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: isLeadIdPassed ? !isLeadIdentityIdAvailable && !methods.formState.isValid : !methods.formState.isValid }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(MobileButton, __assign({ onClick: function () { return onBack(); }, disabled: loading }, { children: t('mobile_button_label') }))] }))] })) })) }));
|
|
102
97
|
};
|
|
103
98
|
export default React.memo(NID);
|