@tap-payments/auth-jsconnect 2.8.73-development → 2.8.75-beta
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 +0 -13
- package/build/api/index.d.ts +2 -2
- package/build/api/lead.d.ts +0 -6
- package/build/assets/locales/ar.json +1 -10
- package/build/assets/locales/en.json +1 -10
- package/build/components/Tooltip/Tooltip.js +1 -1
- package/build/constants/api.d.ts +1 -0
- package/build/constants/api.js +2 -0
- package/build/constants/app.d.ts +2 -1
- package/build/constants/app.js +14 -35
- package/build/constants/assets.d.ts +0 -2
- package/build/constants/assets.js +0 -2
- package/build/features/app/auth/authStore.d.ts +15 -5
- package/build/features/app/auth/authStore.js +113 -58
- package/build/features/app/business/businessStore.d.ts +11 -16
- package/build/features/app/business/businessStore.js +44 -58
- package/build/features/app/connect/connectStore.d.ts +12 -19
- package/build/features/app/connect/connectStore.js +82 -151
- package/build/features/app/connectExpress/connectExpressStore.d.ts +33 -10
- package/build/features/app/connectExpress/connectExpressStore.js +251 -156
- package/build/features/app/individual/individualStore.js +2 -4
- package/build/features/auth/screens/AuthSwitch/AuthSwitch.js +2 -2
- package/build/features/auth/screens/AuthenticationList/LicenseNumber.js +2 -2
- package/build/features/auth/screens/NID/DOB.d.ts +6 -0
- package/build/features/auth/screens/NID/DOB.js +47 -0
- package/build/features/auth/screens/NID/IDNumber.js +1 -1
- package/build/features/auth/screens/NID/NID.js +10 -4
- package/build/features/auth/screens/NID/validation.d.ts +3 -0
- package/build/features/auth/screens/NID/validation.js +1 -0
- package/build/features/auth/screens/OTP/OTP.js +5 -1
- package/build/features/auth/screens/OTP/OTPInput.js +13 -2
- package/build/features/business/screens/BusinessType/LicenseNumber.js +2 -2
- package/build/features/business/screens/OTP/OTP.d.ts +8 -0
- package/build/features/business/screens/OTP/OTP.js +90 -0
- package/build/features/business/screens/OTP/OTPInput.d.ts +5 -0
- package/build/features/business/screens/OTP/OTPInput.js +49 -0
- package/build/features/business/screens/OTP/index.d.ts +3 -0
- package/build/features/business/screens/OTP/index.js +2 -0
- package/build/features/business/screens/OTP/validation.d.ts +8 -0
- package/build/features/business/screens/OTP/validation.js +4 -0
- package/build/features/connect/screens/Mobile/Mobile.js +2 -2
- package/build/features/connect/screens/NID/DOB.d.ts +5 -0
- package/build/features/connect/screens/NID/DOB.js +47 -0
- package/build/features/connect/screens/NID/IDNumber.d.ts +0 -1
- package/build/features/connect/screens/NID/IDNumber.js +2 -2
- package/build/features/connect/screens/NID/NID.js +11 -5
- package/build/features/connect/screens/NID/validation.d.ts +3 -0
- package/build/features/connect/screens/NID/validation.js +1 -0
- package/build/features/connect/screens/OTP/OTPInput.js +11 -3
- package/build/features/connectExpress/screens/AuthenticationList/LicenseNumber.js +2 -2
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +2 -2
- package/build/features/{auth/screens/VerifyNafath/VerifyNafath.d.ts → connectExpress/screens/IdentityOTP/OTP.d.ts} +2 -2
- package/build/features/connectExpress/screens/IdentityOTP/OTP.js +88 -0
- package/build/features/connectExpress/screens/IdentityOTP/OTPInput.d.ts +5 -0
- package/build/features/connectExpress/screens/IdentityOTP/OTPInput.js +56 -0
- package/build/features/connectExpress/screens/IdentityOTP/index.d.ts +3 -0
- package/build/features/connectExpress/screens/IdentityOTP/index.js +2 -0
- package/build/features/connectExpress/screens/IdentityOTP/validation.d.ts +8 -0
- package/build/features/connectExpress/screens/IdentityOTP/validation.js +4 -0
- package/build/features/connectExpress/screens/Mobile/Mobile.js +2 -2
- package/build/features/connectExpress/screens/NID/DOB.d.ts +6 -0
- package/build/features/connectExpress/screens/NID/DOB.js +47 -0
- package/build/features/connectExpress/screens/NID/IDNumber.d.ts +0 -1
- package/build/features/connectExpress/screens/NID/IDNumber.js +2 -2
- package/build/features/connectExpress/screens/NID/NID.js +9 -4
- package/build/features/connectExpress/screens/NID/validation.d.ts +3 -0
- package/build/features/connectExpress/screens/NID/validation.js +2 -0
- package/build/features/connectExpress/screens/NIDMissed/NID.js +2 -2
- package/build/features/connectExpress/screens/OTP/OTP.js +13 -5
- package/build/features/connectExpress/screens/OTP/OTPInput.js +11 -3
- package/build/features/entity/screens/EntityName/LicenseNumber.js +2 -2
- package/build/features/featuresScreens.js +6 -21
- package/build/features/shared/Button/AbsherButton.d.ts +7 -0
- package/build/features/shared/Button/{NafathButton.js → AbsherButton.js} +3 -13
- package/build/features/shared/Button/index.d.ts +2 -2
- package/build/features/shared/Button/index.js +2 -2
- package/build/theme/palette.js +1 -2
- package/build/utils/common.js +4 -4
- package/build/utils/validation.d.ts +1 -0
- package/build/utils/validation.js +3 -0
- package/package.json +2 -2
- package/build/features/auth/screens/VerifyNafath/VerifyNafath.js +0 -34
- package/build/features/auth/screens/VerifyNafath/index.d.ts +0 -3
- package/build/features/auth/screens/VerifyNafath/index.js +0 -2
- package/build/features/business/screens/VerifyNafath/VerifyNafath.d.ts +0 -5
- package/build/features/business/screens/VerifyNafath/VerifyNafath.js +0 -34
- package/build/features/business/screens/VerifyNafath/index.d.ts +0 -3
- package/build/features/business/screens/VerifyNafath/index.js +0 -2
- package/build/features/connect/screens/VerifyNafath/VerifyNafath.d.ts +0 -5
- package/build/features/connect/screens/VerifyNafath/VerifyNafath.js +0 -34
- package/build/features/connect/screens/VerifyNafath/index.d.ts +0 -3
- package/build/features/connect/screens/VerifyNafath/index.js +0 -2
- package/build/features/connectExpress/screens/IdentityVerifyNafath/IdentityVerifyNafath.d.ts +0 -5
- package/build/features/connectExpress/screens/IdentityVerifyNafath/IdentityVerifyNafath.js +0 -34
- package/build/features/connectExpress/screens/IdentityVerifyNafath/index.d.ts +0 -3
- package/build/features/connectExpress/screens/IdentityVerifyNafath/index.js +0 -2
- package/build/features/connectExpress/screens/VerifyNafath/VerifyNafath.d.ts +0 -5
- package/build/features/connectExpress/screens/VerifyNafath/VerifyNafath.js +0 -34
- package/build/features/connectExpress/screens/VerifyNafath/index.d.ts +0 -3
- package/build/features/connectExpress/screens/VerifyNafath/index.js +0 -2
- package/build/features/shared/Button/NafathButton.d.ts +0 -7
- package/build/features/shared/NafathVerification/NafathVerification.d.ts +0 -13
- package/build/features/shared/NafathVerification/NafathVerification.js +0 -92
- package/build/features/shared/NafathVerification/VerifyNafathLoading.d.ts +0 -8
- package/build/features/shared/NafathVerification/VerifyNafathLoading.js +0 -53
- package/build/features/shared/NafathVerification/VerifyNafathSuccess.d.ts +0 -5
- package/build/features/shared/NafathVerification/VerifyNafathSuccess.js +0 -8
- package/build/features/shared/NafathVerification/index.d.ts +0 -2
- package/build/features/shared/NafathVerification/index.js +0 -2
|
@@ -17,7 +17,8 @@ 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 {
|
|
20
|
+
import { AuthForType } from '../../../../@types';
|
|
21
|
+
import { clearError, connectSelector, resendOTPMobile, resendOTPNID } from '../../../app/connect/connectStore';
|
|
21
22
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
22
23
|
import { sendCustomEventToGTM } from '../../../../utils';
|
|
23
24
|
var BoxStyled = styled(Box)(function (_a) {
|
|
@@ -33,7 +34,8 @@ var OTPInput = function (_a) {
|
|
|
33
34
|
var t = useTranslation().t;
|
|
34
35
|
var dispatch = useAppDispatch();
|
|
35
36
|
var otpControl = useController({ name: 'otp', control: control });
|
|
36
|
-
var
|
|
37
|
+
var _c = useAppSelector(connectSelector), data = _c.data, error = _c.error;
|
|
38
|
+
var startWithNID = data.otpData.authFor === AuthForType.NATIONAL_ID;
|
|
37
39
|
var handleOnOTPChange = function (otp) {
|
|
38
40
|
if (error)
|
|
39
41
|
dispatch(clearError());
|
|
@@ -52,7 +54,13 @@ var OTPInput = function (_a) {
|
|
|
52
54
|
sendEventAskAnotherOTP();
|
|
53
55
|
dispatch(resendOTPMobile());
|
|
54
56
|
};
|
|
57
|
+
var handleOnResendAbsherOTP = function () {
|
|
58
|
+
if (otpControl.field.value)
|
|
59
|
+
setValue('otp', '', { shouldValidate: true });
|
|
60
|
+
sendEventAskAnotherOTP();
|
|
61
|
+
dispatch(resendOTPNID());
|
|
62
|
+
};
|
|
55
63
|
var otpValue = otpControl.field.value;
|
|
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()); } }) })));
|
|
64
|
+
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: startWithNID ? handleOnResendAbsherOTP : handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
57
65
|
};
|
|
58
66
|
export default React.memo(OTPInput);
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { useController, useFormContext } from 'react-hook-form';
|
|
5
5
|
import { KW_MAX_LICENSE_LENGTH, KW_MIN_LICENSE_LENGTH, LICENSE_NUMBER_MAX_LENGTH, LICENSE_NUMBER_MIN_LENGTH } from '../../../../constants';
|
|
6
|
-
import {
|
|
6
|
+
import { isSA, cleanFLandCRNumber } from '../../../../utils';
|
|
7
7
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
8
8
|
import ClearIcon from '../../../shared/ClearIcon';
|
|
9
9
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
@@ -19,7 +19,7 @@ var LicenseNumber = function () {
|
|
|
19
19
|
var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
20
20
|
var handleFLNumberChange = function (_a) {
|
|
21
21
|
var target = _a.target;
|
|
22
|
-
var value =
|
|
22
|
+
var value = cleanFLandCRNumber(target.value);
|
|
23
23
|
licenseNumberControl.field.onChange(value);
|
|
24
24
|
};
|
|
25
25
|
var clearLicenseNumber = function () {
|
|
@@ -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 { CR_MIN_LICENSE_LENGTH, CR_NUMBER_MAX_LENGTH, FL_MIN_LICENSE_LENGTH, FL_NUMBER_MAX_LENGTH, KW_MAX_LICENSE_LENGTH, KW_MIN_LICENSE_LENGTH } from '../../../../constants';
|
|
17
|
-
import {
|
|
17
|
+
import { isKW, isOtherThanKWOrSA, cleanFLandCRNumber } from '../../../../utils';
|
|
18
18
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
19
19
|
import ClearIcon from '../../../shared/ClearIcon';
|
|
20
20
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
@@ -36,7 +36,7 @@ var LicenseNumber = function (_a) {
|
|
|
36
36
|
var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
|
|
37
37
|
var handleFLNumberChange = function (_a) {
|
|
38
38
|
var target = _a.target;
|
|
39
|
-
var value =
|
|
39
|
+
var value = cleanFLandCRNumber(target.value);
|
|
40
40
|
licenseNumberControl.field.onChange(value);
|
|
41
41
|
};
|
|
42
42
|
var clearLicenseNumber = function () {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export interface
|
|
2
|
+
export interface OTPProps {
|
|
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>;
|
|
5
5
|
export default _default;
|
|
@@ -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, resetOTPValue, verifyNIDOtpLeadIdentityAsync } from '../../../app/connectExpress/connectExpressStore';
|
|
19
|
+
import Button from '../../../shared/Button';
|
|
20
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
22
|
+
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
23
|
+
import { useLanguage } from '../../../../hooks';
|
|
24
|
+
import { AuthForType } from '../../../../@types';
|
|
25
|
+
import { useForm, FormProvider } from 'react-hook-form';
|
|
26
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
27
|
+
import Form from '../../../../components/Form';
|
|
28
|
+
import { maskPhone, maskID, deepCopy, sendCustomEventToGTM } from '../../../../utils';
|
|
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 OTP = function () {
|
|
51
|
+
var _a;
|
|
52
|
+
var dispatch = useAppDispatch();
|
|
53
|
+
var _b = useAppSelector(connectExpressSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
54
|
+
var t = useTranslation().t;
|
|
55
|
+
var isAr = useLanguage().isAr;
|
|
56
|
+
var methods = useForm({
|
|
57
|
+
resolver: yupResolver(OTPValidation),
|
|
58
|
+
defaultValues: data.otpData,
|
|
59
|
+
mode: 'onChange'
|
|
60
|
+
});
|
|
61
|
+
var isNidAuth = data.otpData.authFor === AuthForType.NATIONAL_ID_MISSED;
|
|
62
|
+
React.useEffect(function () {
|
|
63
|
+
if (error)
|
|
64
|
+
dispatch(clearError());
|
|
65
|
+
}, [methods.formState.isValid]);
|
|
66
|
+
React.useEffect(function () {
|
|
67
|
+
sendCustomEventToGTM({
|
|
68
|
+
event: 'Send Event',
|
|
69
|
+
event_category: 'User Registration Flow',
|
|
70
|
+
event_action: 'Absher OTP Page Viewed'
|
|
71
|
+
});
|
|
72
|
+
return function () {
|
|
73
|
+
dispatch(resetOTPValue());
|
|
74
|
+
};
|
|
75
|
+
}, []);
|
|
76
|
+
var onSubmit = function (formData) {
|
|
77
|
+
dispatch(verifyNIDOtpLeadIdentityAsync(deepCopy(formData)));
|
|
78
|
+
};
|
|
79
|
+
var onBack = function () {
|
|
80
|
+
dispatch(handlePrevScreenStep());
|
|
81
|
+
};
|
|
82
|
+
var disabled = !methods.formState.isValid;
|
|
83
|
+
var phone = data.mobileData.mobile ? ((_a = data.mobileData.countryCode) === null || _a === void 0 ? void 0 : _a.idd_prefix) + data.mobileData.mobile : '';
|
|
84
|
+
var idNumber = data.nidData.nid;
|
|
85
|
+
var title = isNidAuth ? t('opt_nid_sent_title', { provider: 'ABSHER' }) : 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 ? t('ide_otp_waiting_title') : title, !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: isNidAuth ? maskID(idNumber) : maskPhone(phone) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
87
|
+
};
|
|
88
|
+
export default React.memo(OTP);
|
|
@@ -0,0 +1,56 @@
|
|
|
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 { resendNIDAuthIdentityOTP, connectExpressSelector, clearError } from '../../../app/connectExpress/connectExpressStore';
|
|
21
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
22
|
+
import { sendCustomEventToGTM } from '../../../../utils';
|
|
23
|
+
var BoxStyled = styled(Box)(function (_a) {
|
|
24
|
+
var theme = _a.theme;
|
|
25
|
+
return ({
|
|
26
|
+
display: 'flex',
|
|
27
|
+
flexDirection: 'column',
|
|
28
|
+
fontFamily: theme.typography.fontFamily
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
var OTPInput = function (_a) {
|
|
32
|
+
var _b = useFormContext(), control = _b.control, setValue = _b.setValue;
|
|
33
|
+
var t = useTranslation().t;
|
|
34
|
+
var dispatch = useAppDispatch();
|
|
35
|
+
var otpControl = useController({ name: 'otp', control: control });
|
|
36
|
+
var _c = useAppSelector(connectExpressSelector), data = _c.data, error = _c.error;
|
|
37
|
+
var nidData = data.nidData;
|
|
38
|
+
var handleOnOTPChange = function (otp) {
|
|
39
|
+
if (error)
|
|
40
|
+
dispatch(clearError());
|
|
41
|
+
otpControl.field.onChange(otp);
|
|
42
|
+
};
|
|
43
|
+
var handleOnResendAbsherOTP = function () {
|
|
44
|
+
if (otpControl.field.value)
|
|
45
|
+
setValue('otp', '', { shouldValidate: true });
|
|
46
|
+
sendCustomEventToGTM({
|
|
47
|
+
event: 'Send Event',
|
|
48
|
+
event_category: 'User Registration Flow',
|
|
49
|
+
event_action: 'Another Absher OTP asked'
|
|
50
|
+
});
|
|
51
|
+
dispatch(resendNIDAuthIdentityOTP(nidData));
|
|
52
|
+
};
|
|
53
|
+
var otpValue = otpControl.field.value;
|
|
54
|
+
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendAbsherOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
55
|
+
};
|
|
56
|
+
export default React.memo(OTPInput);
|
|
@@ -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
|
+
}>>>;
|
|
@@ -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, { AbsherButton, 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(AbsherButton, __assign({ disabled: loading, onClick: function () { return onBack(); } }, { children: t('absher_button_label') })))] }))] }))] })) })) }));
|
|
121
121
|
};
|
|
122
122
|
export default React.memo(Mobile);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { useTranslation } from 'react-i18next';
|
|
14
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
15
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
16
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
17
|
+
import { alpha, styled } from '@mui/material/styles';
|
|
18
|
+
import { clearError, connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
|
|
19
|
+
import Text from '../../../../components/Text';
|
|
20
|
+
import Calender from '../../../shared/Calender';
|
|
21
|
+
var InputLabelStyled = styled(Text)(function (_a) {
|
|
22
|
+
var theme = _a.theme;
|
|
23
|
+
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
|
|
24
|
+
});
|
|
25
|
+
var DOB = function (_a) {
|
|
26
|
+
var _b;
|
|
27
|
+
var onDateClicked = _a.onDateClicked, readOnly = _a.readOnly;
|
|
28
|
+
var t = useTranslation().t;
|
|
29
|
+
var control = useFormContext().control;
|
|
30
|
+
var dispatch = useAppDispatch();
|
|
31
|
+
var dobControl = useController({ control: control, name: 'dob' });
|
|
32
|
+
var error = useAppSelector(connectExpressSelector).error;
|
|
33
|
+
var handleBirthDateChange = function (data) {
|
|
34
|
+
dobControl.field.onChange(data);
|
|
35
|
+
handleClearError();
|
|
36
|
+
};
|
|
37
|
+
var handleClearError = function () {
|
|
38
|
+
if (error)
|
|
39
|
+
dispatch(clearError());
|
|
40
|
+
};
|
|
41
|
+
var dateValue = (_b = dobControl === null || dobControl === void 0 ? void 0 : dobControl.field) === null || _b === void 0 ? void 0 : _b.value;
|
|
42
|
+
return (_jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
|
|
43
|
+
var spacing = _a.spacing;
|
|
44
|
+
return spacing(2.5, 2.5, 1.5, 2.5);
|
|
45
|
+
} } }, { children: t('enter_birth_date') })), _jsx(Calender, { isDob: true, disabled: readOnly, defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleBirthDateChange })] }));
|
|
46
|
+
};
|
|
47
|
+
export default DOB;
|
|
@@ -2,7 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
interface IDNumberProps {
|
|
3
3
|
show: boolean;
|
|
4
4
|
readOnly?: boolean;
|
|
5
|
-
isValid: boolean;
|
|
6
5
|
}
|
|
7
6
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<IDNumberProps & React.RefAttributes<unknown>>>;
|
|
8
7
|
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;
|
|
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
|
|
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 })] })) })));
|
|
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, createNIDAuthAsync } 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,6 +27,7 @@ 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';
|
|
30
31
|
import TAC from './TAC';
|
|
31
32
|
import { deepCopy, sendCustomEventToGTM } from '../../../../utils';
|
|
32
33
|
var FormStyled = styled(Form)(function () { return ({
|
|
@@ -59,10 +60,11 @@ var OrBoxStyled = styled(Box)(function (_a) {
|
|
|
59
60
|
});
|
|
60
61
|
var NID = function (_a) {
|
|
61
62
|
var _b, _c;
|
|
63
|
+
var _d = React.useState(false), collapse = _d[0], setCollapse = _d[1];
|
|
62
64
|
var isAr = useLanguage().isAr;
|
|
63
65
|
var dispatch = useAppDispatch();
|
|
64
66
|
var t = useTranslation().t;
|
|
65
|
-
var
|
|
67
|
+
var _e = useAppSelector(connectExpressSelector), data = _e.data, loading = _e.loading, error = _e.error;
|
|
66
68
|
var isLeadIdPassed = data.isLeadIdPassed, responseData = data.responseData;
|
|
67
69
|
var methods = useForm({
|
|
68
70
|
resolver: yupResolver(NIDValidationSchema(isLeadIdPassed)),
|
|
@@ -76,7 +78,10 @@ var NID = function (_a) {
|
|
|
76
78
|
React.useEffect(function () {
|
|
77
79
|
}, []);
|
|
78
80
|
var onSubmit = function (data) {
|
|
79
|
-
dispatch(
|
|
81
|
+
dispatch(createNIDAuthAsync(deepCopy(data)));
|
|
82
|
+
};
|
|
83
|
+
var handleCollapseOpenClose = function (flag) {
|
|
84
|
+
setCollapse(flag);
|
|
80
85
|
};
|
|
81
86
|
var onBack = function () {
|
|
82
87
|
sendCustomEventToGTM({
|
|
@@ -93,6 +98,6 @@ var NID = function (_a) {
|
|
|
93
98
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly);
|
|
94
99
|
var disabled = !methods.formState.isValid;
|
|
95
100
|
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;
|
|
96
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(
|
|
101
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(IDNumber, { show: !collapse, readOnly: readOnly['nid'] }) })), _jsx(DOB, { onDateClicked: handleCollapseOpenClose, readOnly: readOnly['dob'] }), _jsxs(Collapse, __assign({ in: !collapse }, { children: [_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') }))] }))] }))] })) })) }));
|
|
97
102
|
};
|
|
98
103
|
export default React.memo(NID);
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
export declare const NIDValidationSchema: (isLeadIdPassed: boolean) => 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>;
|
|
3
4
|
nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
4
5
|
}>, 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>;
|
|
5
7
|
nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
6
8
|
}>>, 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>;
|
|
7
10
|
nid: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
8
11
|
}>>>;
|
|
@@ -2,6 +2,7 @@ import * as yup from 'yup';
|
|
|
2
2
|
export var NIDValidationSchema = function (isLeadIdPassed) {
|
|
3
3
|
if (isLeadIdPassed) {
|
|
4
4
|
return yup.object().shape({
|
|
5
|
+
dob: yup.string().min(5).required('enter_valid_birth_date'),
|
|
5
6
|
termAndConditionChecked: yup.boolean().isTrue('check_terms_cond').required('check_terms_cond'),
|
|
6
7
|
nid: yup
|
|
7
8
|
.string()
|
|
@@ -11,6 +12,7 @@ export var NIDValidationSchema = function (isLeadIdPassed) {
|
|
|
11
12
|
});
|
|
12
13
|
}
|
|
13
14
|
return yup.object().shape({
|
|
15
|
+
dob: yup.string().min(5).required('enter_valid_birth_date'),
|
|
14
16
|
nid: yup
|
|
15
17
|
.string()
|
|
16
18
|
.matches(/^(1|2)([0-9]{1,})$/g, 'signup_invalid_national_id_format')
|
|
@@ -18,7 +18,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
|
|
|
18
18
|
import { NIDOtherCountryValidationSchema, NIDValidationSchema } from './validation';
|
|
19
19
|
import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
|
|
20
20
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
21
|
-
import { clearError, connectExpressSelector,
|
|
21
|
+
import { clearError, connectExpressSelector, createNIDAuthIdentityAsync } from '../../../app/connectExpress/connectExpressStore';
|
|
22
22
|
import Form from '../../../../components/Form';
|
|
23
23
|
import Button from '../../../shared/Button';
|
|
24
24
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
@@ -48,7 +48,7 @@ var NID = function (_a) {
|
|
|
48
48
|
dispatch(clearError());
|
|
49
49
|
}, [methods.formState.isValid]);
|
|
50
50
|
var onSubmit = function (data) {
|
|
51
|
-
dispatch(
|
|
51
|
+
dispatch(createNIDAuthIdentityAsync(deepCopy(data)));
|
|
52
52
|
};
|
|
53
53
|
var handleCollapseOpenClose = function (flag) {
|
|
54
54
|
setCollapse(flag);
|
|
@@ -15,16 +15,17 @@ import { styled } from '@mui/material/styles';
|
|
|
15
15
|
import * as React from 'react';
|
|
16
16
|
import { useTranslation } from 'react-i18next';
|
|
17
17
|
import Text from '../../../../components/Text';
|
|
18
|
-
import { clearError, connectExpressSelector, verifyMobileOtpAsync, resetOTPValue } from '../../../app/connectExpress/connectExpressStore';
|
|
18
|
+
import { clearError, connectExpressSelector, verifyMobileOtpAsync, verifyNIDOtpAsync, resetOTPValue } from '../../../app/connectExpress/connectExpressStore';
|
|
19
19
|
import Button from '../../../shared/Button';
|
|
20
20
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
21
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
22
22
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
23
23
|
import { useLanguage } from '../../../../hooks';
|
|
24
|
+
import { AuthForType } from '../../../../@types';
|
|
24
25
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
25
26
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
26
27
|
import Form from '../../../../components/Form';
|
|
27
|
-
import { maskPhone, deepCopy, sendCustomEventToGTM } from '../../../../utils';
|
|
28
|
+
import { maskPhone, maskID, deepCopy, sendCustomEventToGTM } from '../../../../utils';
|
|
28
29
|
import { OTPValidation } from './validation';
|
|
29
30
|
import OTPInput from './OTPInput';
|
|
30
31
|
var OTPTitleContainerStyled = styled(Box)(function (_a) {
|
|
@@ -57,6 +58,7 @@ var OTP = function () {
|
|
|
57
58
|
defaultValues: data.otpData,
|
|
58
59
|
mode: 'onChange'
|
|
59
60
|
});
|
|
61
|
+
var isNidAuth = data.otpData.authFor === AuthForType.NATIONAL_ID;
|
|
60
62
|
React.useEffect(function () {
|
|
61
63
|
if (error)
|
|
62
64
|
dispatch(clearError());
|
|
@@ -72,14 +74,20 @@ var OTP = function () {
|
|
|
72
74
|
};
|
|
73
75
|
}, []);
|
|
74
76
|
var onSubmit = function (formData) {
|
|
77
|
+
if (isNidAuth) {
|
|
78
|
+
dispatch(verifyNIDOtpAsync(deepCopy(formData)));
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
75
81
|
dispatch(verifyMobileOtpAsync(deepCopy(formData)));
|
|
76
82
|
};
|
|
77
83
|
var onBack = function () {
|
|
78
|
-
|
|
84
|
+
var screen = isNidAuth ? 'CONNECT_EXPRESS_NID_STEP' : 'CONNECT_EXPRESS_MOBILE_STEP';
|
|
85
|
+
dispatch(handlePrevScreenStep(screen));
|
|
79
86
|
};
|
|
80
87
|
var disabled = !methods.formState.isValid;
|
|
81
88
|
var phone = data.mobileData.mobile ? ((_a = data.mobileData.countryCode) === null || _a === void 0 ? void 0 : _a.idd_prefix) + data.mobileData.mobile : '';
|
|
82
|
-
var
|
|
83
|
-
|
|
89
|
+
var idNumber = data.nidData.nid;
|
|
90
|
+
var title = isNidAuth ? t('opt_nid_sent_title', { provider: 'ABSHER' }) : t('ide_opt_sent_title');
|
|
91
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : title, !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: isNidAuth ? maskID(idNumber) : maskPhone(phone) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
84
92
|
};
|
|
85
93
|
export default React.memo(OTP);
|
|
@@ -17,7 +17,8 @@ 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 {
|
|
20
|
+
import { AuthForType } from '../../../../@types';
|
|
21
|
+
import { resendMobileAuthOTP, resendNIDAuthOTP, connectExpressSelector, clearError } from '../../../app/connectExpress/connectExpressStore';
|
|
21
22
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
22
23
|
import { sendCustomEventToGTM } from '../../../../utils';
|
|
23
24
|
var BoxStyled = styled(Box)(function (_a) {
|
|
@@ -34,7 +35,8 @@ var OTPInput = function (_a) {
|
|
|
34
35
|
var dispatch = useAppDispatch();
|
|
35
36
|
var otpControl = useController({ name: 'otp', control: control });
|
|
36
37
|
var _c = useAppSelector(connectExpressSelector), data = _c.data, error = _c.error;
|
|
37
|
-
var mobileData = data.mobileData;
|
|
38
|
+
var mobileData = data.mobileData, nidData = data.nidData;
|
|
39
|
+
var isNidAuth = data.otpData.authFor === AuthForType.NATIONAL_ID;
|
|
38
40
|
var sendEventAskAnotherOTP = function () {
|
|
39
41
|
sendCustomEventToGTM({
|
|
40
42
|
event: 'Send Event',
|
|
@@ -53,7 +55,13 @@ var OTPInput = function (_a) {
|
|
|
53
55
|
sendEventAskAnotherOTP();
|
|
54
56
|
dispatch(resendMobileAuthOTP(mobileData));
|
|
55
57
|
};
|
|
58
|
+
var handleOnResendAbsherOTP = function () {
|
|
59
|
+
if (otpControl.field.value)
|
|
60
|
+
setValue('otp', '', { shouldValidate: true });
|
|
61
|
+
sendEventAskAnotherOTP();
|
|
62
|
+
dispatch(resendNIDAuthOTP(nidData));
|
|
63
|
+
};
|
|
56
64
|
var otpValue = otpControl.field.value;
|
|
57
|
-
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
|
+
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: isNidAuth ? handleOnResendAbsherOTP : handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
58
66
|
};
|
|
59
67
|
export default React.memo(OTPInput);
|
|
@@ -15,7 +15,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
15
15
|
import { useController, useFormContext } from 'react-hook-form';
|
|
16
16
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
17
17
|
import { BusinessType } from '../../../../@types';
|
|
18
|
-
import { isKW, isOtherThanKWOrSA,
|
|
18
|
+
import { isKW, isOtherThanKWOrSA, cleanFLandCRNumber } from '../../../../utils';
|
|
19
19
|
import { settingsSelector } from '../../../../app/settings';
|
|
20
20
|
import { CR_MIN_LICENSE_LENGTH, CR_NUMBER_MAX_LENGTH, FL_MIN_LICENSE_LENGTH, FL_NUMBER_ENTITY_LENGTH, KW_MAX_LICENSE_LENGTH, KW_MIN_LICENSE_LENGTH } from '../../../../constants';
|
|
21
21
|
import Collapse from '../../../../components/Collapse';
|
|
@@ -38,7 +38,7 @@ var LicenseNumber = function (_a) {
|
|
|
38
38
|
var target = _a.target;
|
|
39
39
|
if (bckError)
|
|
40
40
|
dispatch(clearError());
|
|
41
|
-
var value =
|
|
41
|
+
var value = cleanFLandCRNumber(target.value);
|
|
42
42
|
licenseNumberControl.field.onChange(value);
|
|
43
43
|
};
|
|
44
44
|
var licenseNumberControl = useController({ control: control, name: 'licenseNumber' });
|