@tap-payments/auth-jsconnect 2.8.93-development → 2.8.97-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.
Files changed (56) hide show
  1. package/build/@types/form.d.ts +3 -0
  2. package/build/components/ArabicDatePicker/ArabicDatePicker.d.ts +1 -1
  3. package/build/components/ArabicDatePicker/ArabicDatePicker.js +2 -2
  4. package/build/components/DatePicker/DatePicker.d.ts +1 -1
  5. package/build/components/DatePicker/DatePicker.js +2 -2
  6. package/build/constants/app.d.ts +5 -0
  7. package/build/constants/app.js +45 -9
  8. package/build/features/app/auth/authStore.d.ts +6 -1
  9. package/build/features/app/auth/authStore.js +86 -28
  10. package/build/features/app/business/businessStore.d.ts +20 -3
  11. package/build/features/app/business/businessStore.js +100 -35
  12. package/build/features/app/connect/connectStore.d.ts +11 -2
  13. package/build/features/app/connect/connectStore.js +52 -5
  14. package/build/features/app/connectExpress/connectExpressStore.d.ts +23 -4
  15. package/build/features/app/connectExpress/connectExpressStore.js +73 -13
  16. package/build/features/auth/screens/DOB/DOB.d.ts +6 -0
  17. package/build/features/auth/screens/DOB/DOB.js +47 -0
  18. package/build/features/auth/screens/DOB/DOBForm.d.ts +5 -0
  19. package/build/features/auth/screens/DOB/DOBForm.js +59 -0
  20. package/build/features/auth/screens/DOB/index.d.ts +3 -0
  21. package/build/features/auth/screens/DOB/index.js +2 -0
  22. package/build/features/auth/screens/DOB/validation.d.ts +8 -0
  23. package/build/features/auth/screens/DOB/validation.js +4 -0
  24. package/build/features/business/screens/BusinessType/BusinessType.js +2 -2
  25. package/build/features/business/screens/DOB/DOB.d.ts +6 -0
  26. package/build/features/business/screens/DOB/DOB.js +45 -0
  27. package/build/features/business/screens/DOB/DOBForm.d.ts +5 -0
  28. package/build/features/business/screens/DOB/DOBForm.js +72 -0
  29. package/build/features/business/screens/DOB/index.d.ts +3 -0
  30. package/build/features/business/screens/DOB/index.js +2 -0
  31. package/build/features/business/screens/DOB/validation.d.ts +8 -0
  32. package/build/features/business/screens/DOB/validation.js +4 -0
  33. package/build/features/connect/screens/DOB/DOB.d.ts +6 -0
  34. package/build/features/connect/screens/DOB/DOB.js +47 -0
  35. package/build/features/connect/screens/DOB/DOBForm.d.ts +5 -0
  36. package/build/features/connect/screens/DOB/DOBForm.js +59 -0
  37. package/build/features/connect/screens/DOB/index.d.ts +3 -0
  38. package/build/features/connect/screens/DOB/index.js +2 -0
  39. package/build/features/connect/screens/DOB/validation.d.ts +8 -0
  40. package/build/features/connect/screens/DOB/validation.js +4 -0
  41. package/build/features/connect/screens/Individual/Individual.js +10 -3
  42. package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +21 -4
  43. package/build/features/connectExpress/screens/DOB/DOB.d.ts +6 -0
  44. package/build/features/connectExpress/screens/DOB/DOB.js +47 -0
  45. package/build/features/connectExpress/screens/DOB/DOBForm.d.ts +5 -0
  46. package/build/features/connectExpress/screens/DOB/DOBForm.js +63 -0
  47. package/build/features/connectExpress/screens/DOB/index.d.ts +3 -0
  48. package/build/features/connectExpress/screens/DOB/index.js +2 -0
  49. package/build/features/connectExpress/screens/DOB/validation.d.ts +8 -0
  50. package/build/features/connectExpress/screens/DOB/validation.js +4 -0
  51. package/build/features/entity/screens/EntityName/ExpiryDate.js +9 -2
  52. package/build/features/entity/screens/EntityName/IssuingDate.js +10 -1
  53. package/build/features/featuresScreens.js +20 -0
  54. package/build/features/shared/Calender/Calender.d.ts +2 -1
  55. package/build/features/shared/Calender/Calender.js +3 -3
  56. package/package.json +1 -1
@@ -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,3 @@
1
+ import DOBForm, { DOBFormProps } from './DOBForm';
2
+ export type { DOBFormProps };
3
+ export default DOBForm;
@@ -0,0 +1,2 @@
1
+ import DOBForm from './DOBForm';
2
+ export default 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,4 @@
1
+ import * as yup from 'yup';
2
+ export var DOBValidationSchema = yup.object().shape({
3
+ dob: yup.string().min(5).required('enter_valid_birth_date')
4
+ });
@@ -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
- dispatch(resetIndividualScreen());
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 = startWithNID ? (isKW(code) ? 'CONNECT_CIVIL_ID_STEP' : 'CONNECT_NID_STEP') : 'CONNECT_MOBILE_STEP';
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 () {
@@ -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
- dispatch(resetIndividualScreen());
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 = startWithNID ? (isKW(code) ? 'CONNECT_EXPRESS_CIVIL_ID_STEP' : 'CONNECT_EXPRESS_NID_STEP') : 'CONNECT_EXPRESS_MOBILE_STEP';
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
- screen = isKW(code) ? 'CONNECT_EXPRESS_CIVIL_ID_MISSED_STEP' : 'CONNECT_EXPRESS_NID_MISSED_STEP';
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,6 @@
1
+ /// <reference types="react" />
2
+ interface DOBProps {
3
+ onDateClicked?: (flag: boolean) => void;
4
+ }
5
+ declare const DOB: ({ onDateClicked }: DOBProps) => JSX.Element;
6
+ export default DOB;
@@ -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,5 @@
1
+ import * as React from 'react';
2
+ export interface DOBFormProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: DOBFormProps) => JSX.Element>;
5
+ export default _default;
@@ -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,3 @@
1
+ import DOBForm, { DOBFormProps } from './DOBForm';
2
+ export type { DOBFormProps };
3
+ export default DOBForm;
@@ -0,0 +1,2 @@
1
+ import DOBForm from './DOBForm';
2
+ export default 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,4 @@
1
+ import * as yup from 'yup';
2
+ export var DOBValidationSchema = yup.object().shape({
3
+ dob: yup.string().min(5).required('enter_valid_birth_date')
4
+ });
@@ -29,15 +29,22 @@ var ExpiryDate = function (_a) {
29
29
  var onDateClicked = _a.onDateClicked, readOnly = _a.readOnly, isVerified = _a.isVerified;
30
30
  var t = useTranslation().t;
31
31
  var dispatch = useAppDispatch();
32
- var control = useFormContext().control;
32
+ var _c = useFormContext(), control = _c.control, watch = _c.watch, setValue = _c.setValue;
33
33
  var error = useAppSelector(entitySelector).error;
34
34
  var oDateControl = useController({ control: control, name: 'expiryDate' });
35
+ var issueDateValue = watch('issuingDate');
35
36
  var dateValue = (_b = oDateControl === null || oDateControl === void 0 ? void 0 : oDateControl.field) === null || _b === void 0 ? void 0 : _b.value;
37
+ var getMinDate = function () {
38
+ if (!issueDateValue)
39
+ return;
40
+ var issueDate = new Date(issueDateValue);
41
+ return new Date(issueDate.setDate(issueDate.getDate() + 1));
42
+ };
36
43
  var handleExpiryDateChange = function (data) {
37
44
  if (error)
38
45
  dispatch(clearError());
39
46
  oDateControl.field.onChange(data);
40
47
  };
41
- return (_jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsxs(InputLabelStyled, { children: [t('business_expiry_date'), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(Calender, { isVerified: isVerified, disabled: readOnly, maxDate: getFutureDate(), defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleExpiryDateChange })] })));
48
+ return (_jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsxs(InputLabelStyled, { children: [t('business_expiry_date'), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(Calender, { isVerified: isVerified, disabled: !issueDateValue ? true : readOnly, minDate: getMinDate(), maxDate: getFutureDate(), defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleExpiryDateChange })] })));
42
49
  };
43
50
  export default ExpiryDate;
@@ -28,14 +28,23 @@ var IssuingDate = function (_a) {
28
28
  var onDateClicked = _a.onDateClicked, readOnly = _a.readOnly, isVerified = _a.isVerified;
29
29
  var t = useTranslation().t;
30
30
  var dispatch = useAppDispatch();
31
- var control = useFormContext().control;
31
+ var _c = useFormContext(), control = _c.control, getValues = _c.getValues, setValue = _c.setValue;
32
32
  var error = useAppSelector(entitySelector).error;
33
33
  var oDateControl = useController({ control: control, name: 'issuingDate' });
34
34
  var dateValue = (_b = oDateControl === null || oDateControl === void 0 ? void 0 : oDateControl.field) === null || _b === void 0 ? void 0 : _b.value;
35
+ var isValidDate = function (date) { return date instanceof Date && !isNaN(date.getTime()); };
35
36
  var handleIssuingDateChange = function (data) {
36
37
  if (error)
37
38
  dispatch(clearError());
38
39
  oDateControl.field.onChange(data);
40
+ var expiryDateValue = getValues('expiryDate');
41
+ if (!expiryDateValue)
42
+ return;
43
+ var issueDate = new Date(data);
44
+ var expiryDate = new Date(expiryDateValue);
45
+ if (isValidDate(issueDate) && isValidDate(expiryDate) && expiryDate <= issueDate) {
46
+ setValue('expiryDate', '', { shouldValidate: true });
47
+ }
39
48
  };
40
49
  return (_jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsxs(InputLabelStyled, { children: [t('issue_date'), _jsx(MandatoryStyled, { children: "*" })] }), _jsx(Calender, { disabled: readOnly, isVerified: isVerified, defaultValue: dateValue ? new Date(dateValue) : undefined, onDateClicked: onDateClicked, onDateChange: handleIssuingDateChange })] })));
41
50
  };
@@ -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
@@ -8,6 +8,7 @@ interface CustomCalenderProps extends CalendarProps {
8
8
  disabled?: boolean;
9
9
  isVerified?: boolean;
10
10
  maxDate?: Date;
11
+ minDate?: Date;
11
12
  }
12
- declare const CustomCalender: ({ onDateClicked, onDateChange, defaultValue, isDob, disabled, isVerified, maxDate }: CustomCalenderProps) => JSX.Element;
13
+ declare const CustomCalender: ({ onDateClicked, onDateChange, defaultValue, isDob, disabled, isVerified, maxDate, minDate }: CustomCalenderProps) => JSX.Element;
13
14
  export default CustomCalender;
@@ -29,7 +29,7 @@ var SwitchBoxStyled = styled(Box)(function (_a) {
29
29
  } }));
30
30
  });
31
31
  var CustomCalender = function (_a) {
32
- var onDateClicked = _a.onDateClicked, onDateChange = _a.onDateChange, defaultValue = _a.defaultValue, isDob = _a.isDob, disabled = _a.disabled, isVerified = _a.isVerified, maxDate = _a.maxDate;
32
+ var onDateClicked = _a.onDateClicked, onDateChange = _a.onDateChange, defaultValue = _a.defaultValue, isDob = _a.isDob, disabled = _a.disabled, isVerified = _a.isVerified, maxDate = _a.maxDate, minDate = _a.minDate;
33
33
  var t = useTranslation().t;
34
34
  var theme = useTheme();
35
35
  var data = useAppSelector(settingsSelector).data;
@@ -39,13 +39,13 @@ var CustomCalender = function (_a) {
39
39
  var onSwitchCalender = function () {
40
40
  dispatch(handleSwitchCalender(!isHijriCalender));
41
41
  };
42
- return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: !isHijriCalender }, { children: _jsx(DatePicker, { open: open, defaultValue: defaultValue, readOnly: true, disabled: disabled, isVerified: isVerified, dir: 'ltr', locale: 'en', isDob: isDob, maxDate: maxDate, onDateChange: onDateChange, onClick: function () {
42
+ return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: !isHijriCalender }, { children: _jsx(DatePicker, { open: open, defaultValue: defaultValue, readOnly: true, disabled: disabled, isVerified: isVerified, dir: 'ltr', locale: 'en', isDob: isDob, maxDate: maxDate, minDate: minDate, onDateChange: onDateChange, onClick: function () {
43
43
  onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true);
44
44
  setOpen(true);
45
45
  }, onDatePicked: function () {
46
46
  onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false);
47
47
  setOpen(false);
48
- } }) })), _jsx(Collapse, __assign({ in: isHijriCalender }, { children: _jsx(ArabicDatePicker, { open: open, readOnly: true, disabled: disabled, isVerified: isVerified, dir: theme.direction, isDob: isDob, maxDate: maxDate, onClick: function () {
48
+ } }) })), _jsx(Collapse, __assign({ in: isHijriCalender }, { children: _jsx(ArabicDatePicker, { open: open, readOnly: true, disabled: disabled, isVerified: isVerified, dir: theme.direction, isDob: isDob, maxDate: maxDate, minDate: minDate, onClick: function () {
49
49
  onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true);
50
50
  setOpen(true);
51
51
  }, onDatePicked: function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.8.93-development",
3
+ "version": "2.8.97-development",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",