@tap-payments/auth-jsconnect 2.8.93-development → 2.8.95-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 +3 -0
- package/build/constants/app.d.ts +5 -0
- package/build/constants/app.js +43 -8
- package/build/features/app/auth/authStore.d.ts +6 -1
- package/build/features/app/auth/authStore.js +86 -28
- package/build/features/app/business/businessStore.d.ts +16 -3
- package/build/features/app/business/businessStore.js +54 -7
- package/build/features/app/connect/connectStore.d.ts +11 -2
- package/build/features/app/connect/connectStore.js +52 -5
- package/build/features/app/connectExpress/connectExpressStore.d.ts +23 -4
- package/build/features/app/connectExpress/connectExpressStore.js +73 -13
- package/build/features/auth/screens/DOB/DOB.d.ts +6 -0
- package/build/features/auth/screens/DOB/DOB.js +47 -0
- package/build/features/auth/screens/DOB/DOBForm.d.ts +5 -0
- package/build/features/auth/screens/DOB/DOBForm.js +59 -0
- package/build/features/auth/screens/DOB/index.d.ts +3 -0
- package/build/features/auth/screens/DOB/index.js +2 -0
- package/build/features/auth/screens/DOB/validation.d.ts +8 -0
- package/build/features/auth/screens/DOB/validation.js +4 -0
- package/build/features/business/screens/BusinessType/BusinessType.js +2 -2
- package/build/features/business/screens/DOB/DOB.d.ts +6 -0
- package/build/features/business/screens/DOB/DOB.js +45 -0
- package/build/features/business/screens/DOB/DOBForm.d.ts +5 -0
- package/build/features/business/screens/DOB/DOBForm.js +69 -0
- package/build/features/business/screens/DOB/index.d.ts +3 -0
- package/build/features/business/screens/DOB/index.js +2 -0
- package/build/features/business/screens/DOB/validation.d.ts +8 -0
- package/build/features/business/screens/DOB/validation.js +4 -0
- package/build/features/connect/screens/DOB/DOB.d.ts +6 -0
- package/build/features/connect/screens/DOB/DOB.js +47 -0
- package/build/features/connect/screens/DOB/DOBForm.d.ts +5 -0
- package/build/features/connect/screens/DOB/DOBForm.js +59 -0
- package/build/features/connect/screens/DOB/index.d.ts +3 -0
- package/build/features/connect/screens/DOB/index.js +2 -0
- package/build/features/connect/screens/DOB/validation.d.ts +8 -0
- package/build/features/connect/screens/DOB/validation.js +4 -0
- package/build/features/connect/screens/Individual/Individual.js +10 -3
- package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +21 -4
- package/build/features/connectExpress/screens/DOB/DOB.d.ts +6 -0
- package/build/features/connectExpress/screens/DOB/DOB.js +47 -0
- package/build/features/connectExpress/screens/DOB/DOBForm.d.ts +5 -0
- package/build/features/connectExpress/screens/DOB/DOBForm.js +63 -0
- package/build/features/connectExpress/screens/DOB/index.d.ts +3 -0
- package/build/features/connectExpress/screens/DOB/index.js +2 -0
- package/build/features/connectExpress/screens/DOB/validation.d.ts +8 -0
- package/build/features/connectExpress/screens/DOB/validation.js +4 -0
- package/build/features/featuresScreens.js +20 -0
- package/package.json +1 -1
|
@@ -0,0 +1,69 @@
|
|
|
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 * as React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { useForm, FormProvider } from 'react-hook-form';
|
|
16
|
+
import { styled } from '@mui/material/styles';
|
|
17
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
|
+
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
19
|
+
import { useAppDispatch, useLanguage, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
|
|
20
|
+
import Form from '../../../../components/Form';
|
|
21
|
+
import Button from '../../../shared/Button';
|
|
22
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
23
|
+
import { businessSelector, clearError, updateLeadDOB } from '../../../app/business/businessStore';
|
|
24
|
+
import Collapse from '../../../../components/Collapse';
|
|
25
|
+
import { deepCopy, sendCustomEventToGTM } from '../../../../utils';
|
|
26
|
+
import { DOBValidationSchema } from './validation';
|
|
27
|
+
import DOB from './DOB';
|
|
28
|
+
var FormStyled = styled(Form)(function () { return ({
|
|
29
|
+
display: 'flex',
|
|
30
|
+
flexDirection: 'column'
|
|
31
|
+
}); });
|
|
32
|
+
var DOBForm = function (_a) {
|
|
33
|
+
var _b = React.useState(false), collapse = _b[0], setCollapse = _b[1];
|
|
34
|
+
var isAr = useLanguage().isAr;
|
|
35
|
+
var dispatch = useAppDispatch();
|
|
36
|
+
var t = useTranslation().t;
|
|
37
|
+
var _c = useAppSelector(businessSelector), data = _c.data, loading = _c.loading, error = _c.error;
|
|
38
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
39
|
+
var methods = useForm({
|
|
40
|
+
resolver: yupResolver(DOBValidationSchema),
|
|
41
|
+
defaultValues: data.dobData,
|
|
42
|
+
mode: 'onChange'
|
|
43
|
+
});
|
|
44
|
+
useSetFromDefaultValues(methods, data.dobData);
|
|
45
|
+
React.useEffect(function () {
|
|
46
|
+
sendCustomEventToGTM({
|
|
47
|
+
event: 'Send Event',
|
|
48
|
+
event_category: 'Account Creation Flow',
|
|
49
|
+
event_action: 'DOB Details Step',
|
|
50
|
+
event_label: settingsData.businessCountry.iso2
|
|
51
|
+
});
|
|
52
|
+
}, []);
|
|
53
|
+
React.useEffect(function () {
|
|
54
|
+
if (error)
|
|
55
|
+
dispatch(clearError());
|
|
56
|
+
}, [methods.formState.isValid]);
|
|
57
|
+
var onSubmit = function (data) {
|
|
58
|
+
dispatch(updateLeadDOB(deepCopy(data)));
|
|
59
|
+
};
|
|
60
|
+
var handleCollapseOpenClose = function (flag) {
|
|
61
|
+
setCollapse(flag);
|
|
62
|
+
};
|
|
63
|
+
var onBack = function () {
|
|
64
|
+
dispatch(handlePrevScreenStep());
|
|
65
|
+
};
|
|
66
|
+
var disabled = !methods.formState.isValid;
|
|
67
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(DOB, { onDateClicked: handleCollapseOpenClose }), _jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(Button, __assign({ sx: { mt: 10 }, loading: loading, onBackClicked: onBack, isAr: isAr, disabled: disabled, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
68
|
+
};
|
|
69
|
+
export default React.memo(DOBForm);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export declare const DOBValidationSchema: 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
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
5
|
+
dob: 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
|
+
dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
8
|
+
}>>>;
|
|
@@ -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, connectSelector } from '../../../app/connect/connectStore';
|
|
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;
|
|
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(0, 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;
|
|
@@ -0,0 +1,59 @@
|
|
|
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 * as React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { styled } from '@mui/material/styles';
|
|
16
|
+
import { useForm, FormProvider } from 'react-hook-form';
|
|
17
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
|
+
import { DOBValidationSchema } from './validation';
|
|
19
|
+
import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
|
|
20
|
+
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
21
|
+
import { clearError, connectSelector, updateLeadDOB } from '../../../app/connect/connectStore';
|
|
22
|
+
import Form from '../../../../components/Form';
|
|
23
|
+
import Button from '../../../shared/Button';
|
|
24
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
25
|
+
import Collapse from '../../../../components/Collapse';
|
|
26
|
+
import DOB from './DOB';
|
|
27
|
+
import { deepCopy } from '../../../../utils';
|
|
28
|
+
var FormStyled = styled(Form)(function () { return ({
|
|
29
|
+
display: 'flex',
|
|
30
|
+
flexDirection: 'column'
|
|
31
|
+
}); });
|
|
32
|
+
var DOBForm = function (_a) {
|
|
33
|
+
var _b = React.useState(false), collapse = _b[0], setCollapse = _b[1];
|
|
34
|
+
var isAr = useLanguage().isAr;
|
|
35
|
+
var dispatch = useAppDispatch();
|
|
36
|
+
var t = useTranslation().t;
|
|
37
|
+
var _c = useAppSelector(connectSelector), data = _c.data, loading = _c.loading, error = _c.error;
|
|
38
|
+
var methods = useForm({
|
|
39
|
+
resolver: yupResolver(DOBValidationSchema),
|
|
40
|
+
defaultValues: data.dobData,
|
|
41
|
+
mode: 'onChange'
|
|
42
|
+
});
|
|
43
|
+
React.useEffect(function () {
|
|
44
|
+
if (error)
|
|
45
|
+
dispatch(clearError());
|
|
46
|
+
}, [methods.formState.isValid]);
|
|
47
|
+
var onSubmit = function (data) {
|
|
48
|
+
dispatch(updateLeadDOB(deepCopy(data)));
|
|
49
|
+
};
|
|
50
|
+
var handleCollapseOpenClose = function (flag) {
|
|
51
|
+
setCollapse(flag);
|
|
52
|
+
};
|
|
53
|
+
var onBack = function () {
|
|
54
|
+
dispatch(handlePrevScreenStep());
|
|
55
|
+
};
|
|
56
|
+
var disabled = !methods.formState.isValid;
|
|
57
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(DOB, { onDateClicked: handleCollapseOpenClose }), _jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(Button, __assign({ sx: { mt: 10 }, loading: loading, isAr: isAr, onBackClicked: onBack, disabled: disabled, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
58
|
+
};
|
|
59
|
+
export default React.memo(DOBForm);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export declare const DOBValidationSchema: 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
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
5
|
+
dob: 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
|
+
dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
8
|
+
}>>>;
|
|
@@ -54,7 +54,7 @@ var Individual = function (_a) {
|
|
|
54
54
|
var dispatch = useAppDispatch();
|
|
55
55
|
var t = useTranslation().t;
|
|
56
56
|
var isAr = useLanguage().isAr;
|
|
57
|
-
var individualData = data.individualData, otpData = data.otpData, mobileData = data.mobileData;
|
|
57
|
+
var individualData = data.individualData, otpData = data.otpData, mobileData = data.mobileData, dobData = data.dobData;
|
|
58
58
|
var startWithNID = otpData.authFor === AuthForType.NATIONAL_ID;
|
|
59
59
|
var isMobile = mobileData.mobile;
|
|
60
60
|
var contact = (otpData.responseBody || {}).contact;
|
|
@@ -82,9 +82,16 @@ var Individual = function (_a) {
|
|
|
82
82
|
};
|
|
83
83
|
var onBack = function () {
|
|
84
84
|
var _a;
|
|
85
|
-
|
|
85
|
+
if (!individualData.isPrevDob) {
|
|
86
|
+
dispatch(resetIndividualScreen());
|
|
87
|
+
}
|
|
86
88
|
var code = (_a = settingsData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2;
|
|
87
|
-
var screen =
|
|
89
|
+
var screen = 'CONNECT_MOBILE_STEP';
|
|
90
|
+
if (startWithNID) {
|
|
91
|
+
screen = individualData.isPrevDob ? 'CONNECT_DOB_STEP' : 'CONNECT_NID_STEP';
|
|
92
|
+
if (isKW(code))
|
|
93
|
+
screen = 'CONNECT_CIVIL_ID_STEP';
|
|
94
|
+
}
|
|
88
95
|
dispatch(handlePrevScreenStep(screen));
|
|
89
96
|
};
|
|
90
97
|
React.useEffect(function () {
|
package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js
CHANGED
|
@@ -48,7 +48,7 @@ var CollectIndividualInfo = function (_a) {
|
|
|
48
48
|
var startWithNID = otpData.authFor === AuthForType.NATIONAL_ID;
|
|
49
49
|
var startWithNIDMissed = otpData.authFor === AuthForType.NATIONAL_ID_MISSED;
|
|
50
50
|
var contact = ((responseData === null || responseData === void 0 ? void 0 : responseData.leadData) || {}).contact;
|
|
51
|
-
var countryCode = individualData.countryCode;
|
|
51
|
+
var countryCode = individualData.countryCode, isPrevDob = individualData.isPrevDob;
|
|
52
52
|
var isEmailAvailable = (responseData || {}).isEmailAvailable;
|
|
53
53
|
var methods = useForm({
|
|
54
54
|
resolver: yupResolver(CollectIndividualInfoValidation),
|
|
@@ -75,11 +75,28 @@ var CollectIndividualInfo = function (_a) {
|
|
|
75
75
|
};
|
|
76
76
|
var onBack = function () {
|
|
77
77
|
var _a;
|
|
78
|
-
|
|
78
|
+
if (!individualData.isPrevDob) {
|
|
79
|
+
dispatch(resetIndividualScreen());
|
|
80
|
+
}
|
|
79
81
|
var code = (_a = settingsData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2;
|
|
80
|
-
var screen =
|
|
82
|
+
var screen = 'CONNECT_EXPRESS_MOBILE_STEP';
|
|
83
|
+
if (startWithNID) {
|
|
84
|
+
if (isKW(code))
|
|
85
|
+
screen = 'CONNECT_EXPRESS_CIVIL_ID_STEP';
|
|
86
|
+
else {
|
|
87
|
+
screen = 'CONNECT_EXPRESS_NID_STEP';
|
|
88
|
+
if (isPrevDob)
|
|
89
|
+
screen = 'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP';
|
|
90
|
+
}
|
|
91
|
+
}
|
|
81
92
|
if (startWithNIDMissed) {
|
|
82
|
-
|
|
93
|
+
if (isKW(code))
|
|
94
|
+
screen = 'CONNECT_EXPRESS_CIVIL_ID_MISSED_STEP';
|
|
95
|
+
else {
|
|
96
|
+
screen = 'CONNECT_EXPRESS_NID_MISSED_STEP';
|
|
97
|
+
if (isPrevDob)
|
|
98
|
+
screen = 'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP';
|
|
99
|
+
}
|
|
83
100
|
}
|
|
84
101
|
dispatch(handlePrevScreenStep(screen));
|
|
85
102
|
};
|
|
@@ -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;
|
|
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(0, 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;
|
|
@@ -0,0 +1,63 @@
|
|
|
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 * as React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { styled } from '@mui/material/styles';
|
|
16
|
+
import { useForm, FormProvider } from 'react-hook-form';
|
|
17
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
|
+
import { DOBValidationSchema } from './validation';
|
|
19
|
+
import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
|
|
20
|
+
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
21
|
+
import { clearError, connectExpressSelector, updateLeadDOBAsync } from '../../../app/connectExpress/connectExpressStore';
|
|
22
|
+
import Form from '../../../../components/Form';
|
|
23
|
+
import Button from '../../../shared/Button';
|
|
24
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
25
|
+
import { AuthForType } from '../../../../@types';
|
|
26
|
+
import Collapse from '../../../../components/Collapse';
|
|
27
|
+
import DOB from './DOB';
|
|
28
|
+
import { deepCopy } from '../../../../utils';
|
|
29
|
+
var FormStyled = styled(Form)(function () { return ({
|
|
30
|
+
display: 'flex',
|
|
31
|
+
flexDirection: 'column'
|
|
32
|
+
}); });
|
|
33
|
+
var DOBForm = function (_a) {
|
|
34
|
+
var _b = React.useState(false), collapse = _b[0], setCollapse = _b[1];
|
|
35
|
+
var isAr = useLanguage().isAr;
|
|
36
|
+
var dispatch = useAppDispatch();
|
|
37
|
+
var t = useTranslation().t;
|
|
38
|
+
var _c = useAppSelector(connectExpressSelector), data = _c.data, loading = _c.loading, error = _c.error;
|
|
39
|
+
var dobData = data.dobData, otpData = data.otpData;
|
|
40
|
+
var startWithNIDMissed = otpData.authFor === AuthForType.NATIONAL_ID_MISSED;
|
|
41
|
+
var methods = useForm({
|
|
42
|
+
resolver: yupResolver(DOBValidationSchema),
|
|
43
|
+
defaultValues: dobData,
|
|
44
|
+
mode: 'onChange'
|
|
45
|
+
});
|
|
46
|
+
React.useEffect(function () {
|
|
47
|
+
if (error)
|
|
48
|
+
dispatch(clearError());
|
|
49
|
+
}, [methods.formState.isValid]);
|
|
50
|
+
var onSubmit = function (data) {
|
|
51
|
+
dispatch(updateLeadDOBAsync(deepCopy(data)));
|
|
52
|
+
};
|
|
53
|
+
var handleCollapseOpenClose = function (flag) {
|
|
54
|
+
setCollapse(flag);
|
|
55
|
+
};
|
|
56
|
+
var onBack = function () {
|
|
57
|
+
var screen = startWithNIDMissed ? 'CONNECT_EXPRESS_NID_MISSED_STEP' : 'CONNECT_EXPRESS_NID_STEP';
|
|
58
|
+
dispatch(handlePrevScreenStep(screen));
|
|
59
|
+
};
|
|
60
|
+
var disabled = !methods.formState.isValid;
|
|
61
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(DOB, { onDateClicked: handleCollapseOpenClose }), _jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(Button, __assign({ sx: { mt: 10 }, loading: loading, isAr: isAr, onBackClicked: onBack, disabled: disabled, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
62
|
+
};
|
|
63
|
+
export default React.memo(DOBForm);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export declare const DOBValidationSchema: 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
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
5
|
+
dob: 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
|
+
dob: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
8
|
+
}>>>;
|
|
@@ -4,6 +4,7 @@ import NIDScreen from './connect/screens/NID';
|
|
|
4
4
|
import ConnectCivilIDScreen from '../features/connect/screens/CivilID';
|
|
5
5
|
import ConnectVerifyPACIScreen from './connect/screens/VerifyPACI';
|
|
6
6
|
import ConnectVerifyNafathScreen from './connect/screens/VerifyNafath';
|
|
7
|
+
import DobScreen from './connect/screens/DOB';
|
|
7
8
|
import IndividualScreen from './connect/screens/Individual';
|
|
8
9
|
import MerchantInfoScreen from './connect/screens/Merchant';
|
|
9
10
|
import BrandSegmentInfoScreen from './connect/screens/BrandSegment';
|
|
@@ -22,6 +23,7 @@ import ConnectExpressCivilIDMissedScreen from './connectExpress/screens/CivilIDM
|
|
|
22
23
|
import ConnectExpressIdentityVerifyPACIScreen from './connectExpress/screens/IdentityVerifyPACI';
|
|
23
24
|
import ConnectExpressIdentityVerifyNafathScreen from './connectExpress/screens/IdentityVerifyNafath';
|
|
24
25
|
import ConnectExpressCollectIndividualScreen from './connectExpress/screens/CollectIndividualInfo';
|
|
26
|
+
import ConnectExpressCollectDobScreen from './connectExpress/screens/DOB';
|
|
25
27
|
import ConnectExpressCollectBusinessScreen from './connectExpress/screens/CollectBusinessInfo';
|
|
26
28
|
import ConnectExpressCreateAccountLoaderScreen from './connectExpress/screens/CreateAccountLoader';
|
|
27
29
|
import ConnectExpressPreparingDataLoaderScreen from './connectExpress/screens/PrepareDataLoading';
|
|
@@ -39,6 +41,7 @@ import AuthEmailScreen from './auth/screens/Email';
|
|
|
39
41
|
import AuthCivilIDScreen from './auth/screens/CivilID';
|
|
40
42
|
import AuthVerifyPACIScreen from './auth/screens/VerifyPACI';
|
|
41
43
|
import AuthVerifyNafathScreen from './auth/screens/VerifyNafath';
|
|
44
|
+
import AuthDOBPage from './auth/screens/DOB';
|
|
42
45
|
import AuthOTPScreen from './auth/screens/OTP';
|
|
43
46
|
import AuthPasswordScreen from './auth/screens/Password';
|
|
44
47
|
import AuthResetPasswordMessageScreen from './auth/screens/ResetPasswordMessage';
|
|
@@ -54,6 +57,7 @@ import CustomersPage from './business/screens/Customers';
|
|
|
54
57
|
import IDBODPage from './business/screens/IDBOD';
|
|
55
58
|
import BusinessVerifyPage from './business/screens/Verify';
|
|
56
59
|
import BusinessVerifyNafathPage from './business/screens/VerifyNafath';
|
|
60
|
+
import DOBPage from './business/screens/DOB';
|
|
57
61
|
import BusinessTypePage from './business/screens/BusinessType';
|
|
58
62
|
import ActivitiesPage from './business/screens/Activities';
|
|
59
63
|
import SuccessPage from './business/screens/Success';
|
|
@@ -151,6 +155,10 @@ export var connectFeatureScreens = [
|
|
|
151
155
|
name: 'CONNECT_VERIFY_NAFATH_STEP',
|
|
152
156
|
element: ConnectVerifyNafathScreen
|
|
153
157
|
},
|
|
158
|
+
{
|
|
159
|
+
name: 'CONNECT_DOB_STEP',
|
|
160
|
+
element: DobScreen
|
|
161
|
+
},
|
|
154
162
|
{
|
|
155
163
|
name: 'CONNECT_INDIVIDUAL_STEP',
|
|
156
164
|
element: IndividualScreen
|
|
@@ -229,6 +237,10 @@ export var connectExpressFeatureScreens = [
|
|
|
229
237
|
name: 'CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP',
|
|
230
238
|
element: ConnectExpressCollectIndividualScreen
|
|
231
239
|
},
|
|
240
|
+
{
|
|
241
|
+
name: 'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP',
|
|
242
|
+
element: ConnectExpressCollectDobScreen
|
|
243
|
+
},
|
|
232
244
|
{
|
|
233
245
|
name: 'CONNECT_EXPRESS_COLLECT_BUSINESS_INFO_STEP',
|
|
234
246
|
element: ConnectExpressCollectBusinessScreen
|
|
@@ -303,6 +315,10 @@ export var authFeatureScreens = [
|
|
|
303
315
|
name: 'AUTH_NAFATH_VERIFY_STEP',
|
|
304
316
|
element: AuthVerifyNafathScreen
|
|
305
317
|
},
|
|
318
|
+
{
|
|
319
|
+
name: 'AUTH_DOB_STEP',
|
|
320
|
+
element: AuthDOBPage
|
|
321
|
+
},
|
|
306
322
|
{
|
|
307
323
|
name: 'AUTH_ACCOUNT_NOT_FOUND_STEP',
|
|
308
324
|
element: AccountNotFoundScreen
|
|
@@ -357,6 +373,10 @@ export var businessFeatureScreens = [
|
|
|
357
373
|
name: 'BUSINESS_VERIFY_NAFATH_STEP',
|
|
358
374
|
element: BusinessVerifyNafathPage
|
|
359
375
|
},
|
|
376
|
+
{
|
|
377
|
+
name: 'BUSINESS_DOB_STEP',
|
|
378
|
+
element: DOBPage
|
|
379
|
+
},
|
|
360
380
|
{
|
|
361
381
|
name: 'BUSINESS_BUSINESS_TYPE_STEP',
|
|
362
382
|
element: BusinessTypePage
|