@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
|
@@ -1,47 +0,0 @@
|
|
|
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, authSelector } from '../../../app/auth/authStore';
|
|
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(authSelector).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;
|
|
@@ -1,90 +0,0 @@
|
|
|
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
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
-
import * as React from 'react';
|
|
25
|
-
import { useAppDispatch, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
|
|
26
|
-
import { useTranslation } from 'react-i18next';
|
|
27
|
-
import { useForm, FormProvider } from 'react-hook-form';
|
|
28
|
-
import { yupResolver } from '@hookform/resolvers/yup';
|
|
29
|
-
import Box from '@mui/material/Box/Box';
|
|
30
|
-
import { styled } from '@mui/material/styles';
|
|
31
|
-
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
32
|
-
import { useLanguage } from '../../../../hooks';
|
|
33
|
-
import Form from '../../../../components/Form';
|
|
34
|
-
import Text from '../../../../components/Text';
|
|
35
|
-
import { ScreenContainer } from '../../../shared/Containers';
|
|
36
|
-
import { businessSelector, clearError, resetOTPScreen, verifyLeadOTP } from '../../../app/business/businessStore';
|
|
37
|
-
import Button from '../../../shared/Button';
|
|
38
|
-
import { deepCopy, maskID } from '../../../../utils';
|
|
39
|
-
import { OTPValidation } from './validation';
|
|
40
|
-
import OTPInput from './OTPInput';
|
|
41
|
-
var OTPTitleContainerStyled = styled(Box)(function (_a) {
|
|
42
|
-
var theme = _a.theme;
|
|
43
|
-
return ({
|
|
44
|
-
background: theme.palette.common.white,
|
|
45
|
-
border: '1px solid',
|
|
46
|
-
borderColor: theme.palette.divider,
|
|
47
|
-
direction: theme.direction,
|
|
48
|
-
borderRadius: theme.spacing(0, 0, 1.25, 1.25),
|
|
49
|
-
marginBottom: theme.spacing(5.75)
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
var OTPTitleStyled = styled(Text)(function (_a) {
|
|
53
|
-
var theme = _a.theme;
|
|
54
|
-
return (__assign(__assign({}, theme.typography.body1), { fontWeight: theme.typography.fontWeightLight, color: theme.palette.text.primary, marginBlock: theme.spacing(1.75), marginInline: theme.spacing(2.5), lineHeight: 1.75, whiteSpace: 'pre-line' }));
|
|
55
|
-
});
|
|
56
|
-
var FormStyled = styled(Form)(function () { return ({
|
|
57
|
-
display: 'flex',
|
|
58
|
-
flexDirection: 'column'
|
|
59
|
-
}); });
|
|
60
|
-
var OTP = function (_a) {
|
|
61
|
-
var _b = useAppSelector(businessSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
62
|
-
var dispatch = useAppDispatch();
|
|
63
|
-
var _c = data.otpData, responseBody = _c.responseBody, defaultValues = __rest(_c, ["responseBody"]);
|
|
64
|
-
var methods = useForm({
|
|
65
|
-
resolver: yupResolver(OTPValidation),
|
|
66
|
-
defaultValues: defaultValues,
|
|
67
|
-
mode: 'onChange'
|
|
68
|
-
});
|
|
69
|
-
useSetFromDefaultValues(methods, defaultValues);
|
|
70
|
-
var t = useTranslation().t;
|
|
71
|
-
var isAr = useLanguage().isAr;
|
|
72
|
-
React.useEffect(function () {
|
|
73
|
-
if (error)
|
|
74
|
-
dispatch(clearError());
|
|
75
|
-
return function () {
|
|
76
|
-
dispatch(resetOTPScreen());
|
|
77
|
-
};
|
|
78
|
-
}, [methods.formState.isValid]);
|
|
79
|
-
var onSubmit = function (formData) {
|
|
80
|
-
dispatch(verifyLeadOTP(deepCopy(formData)));
|
|
81
|
-
};
|
|
82
|
-
var onBack = function () {
|
|
83
|
-
dispatch(handlePrevScreenStep());
|
|
84
|
-
};
|
|
85
|
-
var disabled = !methods.formState.isValid;
|
|
86
|
-
var idNumber = data.nidData.nid;
|
|
87
|
-
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') : t('opt_nid_sent_title', { provider: 'ABSHER' }), ' ', !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskID(idNumber || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
88
|
-
};
|
|
89
|
-
OTP.defaultProps = {};
|
|
90
|
-
export default React.memo(OTP);
|
|
@@ -1,49 +0,0 @@
|
|
|
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 { businessSelector, clearError, resendOTPLeadIdentity } from '../../../app/business/businessStore';
|
|
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 error = useAppSelector(businessSelector).error;
|
|
35
|
-
var otpControl = useController({ name: 'otp', control: control });
|
|
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(resendOTPLeadIdentity());
|
|
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);
|
|
@@ -1,8 +0,0 @@
|
|
|
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
|
-
}>>>;
|
|
@@ -1,47 +0,0 @@
|
|
|
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 Text from '../../../../components/Text';
|
|
19
|
-
import Calender from '../../../shared/Calender';
|
|
20
|
-
import { clearError, connectSelector } from '../../../app/connect/connectStore';
|
|
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;
|
|
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(connectSelector).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, defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleBirthDateChange })] }));
|
|
46
|
-
};
|
|
47
|
-
export default DOB;
|
|
@@ -1,88 +0,0 @@
|
|
|
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);
|
|
@@ -1,56 +0,0 @@
|
|
|
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);
|
|
@@ -1,8 +0,0 @@
|
|
|
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
|
-
}>>>;
|
|
@@ -1,47 +0,0 @@
|
|
|
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;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ButtonProps } from '../../../components/Button';
|
|
2
|
-
interface AbsherButtonProps extends ButtonProps {
|
|
3
|
-
loading?: boolean;
|
|
4
|
-
hideIcon?: boolean;
|
|
5
|
-
}
|
|
6
|
-
export default function AbsherButton({ children, hideIcon, disabled, ...props }: AbsherButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export {};
|