@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.
Files changed (102) hide show
  1. package/build/@types/form.d.ts +1 -1
  2. package/build/api/auth.d.ts +13 -0
  3. package/build/api/index.d.ts +2 -2
  4. package/build/api/lead.d.ts +6 -0
  5. package/build/assets/locales/ar.json +10 -1
  6. package/build/assets/locales/en.json +10 -1
  7. package/build/constants/app.d.ts +1 -0
  8. package/build/constants/app.js +35 -12
  9. package/build/constants/assets.d.ts +2 -0
  10. package/build/constants/assets.js +2 -0
  11. package/build/features/app/auth/authStore.d.ts +5 -15
  12. package/build/features/app/auth/authStore.js +58 -113
  13. package/build/features/app/business/businessStore.d.ts +16 -11
  14. package/build/features/app/business/businessStore.js +58 -44
  15. package/build/features/app/connect/connectStore.d.ts +19 -12
  16. package/build/features/app/connect/connectStore.js +151 -82
  17. package/build/features/app/connectExpress/connectExpressStore.d.ts +10 -33
  18. package/build/features/app/connectExpress/connectExpressStore.js +156 -251
  19. package/build/features/app/individual/individualStore.js +4 -1
  20. package/build/features/auth/screens/AuthSwitch/AuthSwitch.js +2 -2
  21. package/build/features/auth/screens/NID/IDNumber.js +1 -1
  22. package/build/features/auth/screens/NID/NID.js +4 -10
  23. package/build/features/auth/screens/NID/validation.d.ts +0 -3
  24. package/build/features/auth/screens/NID/validation.js +0 -1
  25. package/build/features/auth/screens/OTP/OTP.js +1 -5
  26. package/build/features/auth/screens/OTP/OTPInput.js +2 -13
  27. package/build/features/{connectExpress/screens/IdentityOTP/OTP.d.ts → auth/screens/VerifyNafath/VerifyNafath.d.ts} +2 -2
  28. package/build/features/auth/screens/VerifyNafath/VerifyNafath.js +34 -0
  29. package/build/features/auth/screens/VerifyNafath/index.d.ts +3 -0
  30. package/build/features/auth/screens/VerifyNafath/index.js +2 -0
  31. package/build/features/business/screens/VerifyNafath/VerifyNafath.d.ts +5 -0
  32. package/build/features/business/screens/VerifyNafath/VerifyNafath.js +34 -0
  33. package/build/features/business/screens/VerifyNafath/index.d.ts +3 -0
  34. package/build/features/business/screens/VerifyNafath/index.js +2 -0
  35. package/build/features/connect/screens/Mobile/Mobile.js +2 -2
  36. package/build/features/connect/screens/NID/IDNumber.d.ts +1 -0
  37. package/build/features/connect/screens/NID/IDNumber.js +2 -2
  38. package/build/features/connect/screens/NID/NID.js +5 -11
  39. package/build/features/connect/screens/NID/validation.d.ts +0 -3
  40. package/build/features/connect/screens/NID/validation.js +0 -1
  41. package/build/features/connect/screens/OTP/OTPInput.js +3 -11
  42. package/build/features/connect/screens/VerifyNafath/VerifyNafath.d.ts +5 -0
  43. package/build/features/connect/screens/VerifyNafath/VerifyNafath.js +34 -0
  44. package/build/features/connect/screens/VerifyNafath/index.d.ts +3 -0
  45. package/build/features/connect/screens/VerifyNafath/index.js +2 -0
  46. package/build/features/connectExpress/screens/IdentityVerifyNafath/IdentityVerifyNafath.d.ts +5 -0
  47. package/build/features/connectExpress/screens/IdentityVerifyNafath/IdentityVerifyNafath.js +34 -0
  48. package/build/features/connectExpress/screens/IdentityVerifyNafath/index.d.ts +3 -0
  49. package/build/features/connectExpress/screens/IdentityVerifyNafath/index.js +2 -0
  50. package/build/features/connectExpress/screens/Mobile/Mobile.js +2 -2
  51. package/build/features/connectExpress/screens/NID/IDNumber.d.ts +1 -0
  52. package/build/features/connectExpress/screens/NID/IDNumber.js +2 -2
  53. package/build/features/connectExpress/screens/NID/NID.js +4 -9
  54. package/build/features/connectExpress/screens/NID/validation.d.ts +0 -3
  55. package/build/features/connectExpress/screens/NID/validation.js +0 -2
  56. package/build/features/connectExpress/screens/NIDMissed/NID.js +2 -2
  57. package/build/features/connectExpress/screens/OTP/OTP.js +5 -13
  58. package/build/features/connectExpress/screens/OTP/OTPInput.js +3 -11
  59. package/build/features/connectExpress/screens/VerifyNafath/VerifyNafath.d.ts +5 -0
  60. package/build/features/connectExpress/screens/VerifyNafath/VerifyNafath.js +34 -0
  61. package/build/features/connectExpress/screens/VerifyNafath/index.d.ts +3 -0
  62. package/build/features/connectExpress/screens/VerifyNafath/index.js +2 -0
  63. package/build/features/featuresScreens.js +21 -6
  64. package/build/features/shared/Button/NafathButton.d.ts +7 -0
  65. package/build/features/shared/Button/{AbsherButton.js → NafathButton.js} +13 -3
  66. package/build/features/shared/Button/index.d.ts +2 -2
  67. package/build/features/shared/Button/index.js +2 -2
  68. package/build/features/shared/NafathVerification/NafathVerification.d.ts +13 -0
  69. package/build/features/shared/NafathVerification/NafathVerification.js +92 -0
  70. package/build/features/shared/NafathVerification/VerifyNafathLoading.d.ts +8 -0
  71. package/build/features/shared/NafathVerification/VerifyNafathLoading.js +53 -0
  72. package/build/features/shared/NafathVerification/VerifyNafathSuccess.d.ts +5 -0
  73. package/build/features/shared/NafathVerification/VerifyNafathSuccess.js +8 -0
  74. package/build/features/shared/NafathVerification/index.d.ts +2 -0
  75. package/build/features/shared/NafathVerification/index.js +2 -0
  76. package/build/hooks/useAppTheme.js +4 -3
  77. package/build/theme/palette.js +2 -1
  78. package/build/theme/theme.d.ts +1 -1
  79. package/build/theme/theme.js +2 -2
  80. package/package.json +1 -1
  81. package/build/features/auth/screens/NID/DOB.d.ts +0 -6
  82. package/build/features/auth/screens/NID/DOB.js +0 -47
  83. package/build/features/business/screens/OTP/OTP.d.ts +0 -8
  84. package/build/features/business/screens/OTP/OTP.js +0 -90
  85. package/build/features/business/screens/OTP/OTPInput.d.ts +0 -5
  86. package/build/features/business/screens/OTP/OTPInput.js +0 -49
  87. package/build/features/business/screens/OTP/index.d.ts +0 -3
  88. package/build/features/business/screens/OTP/index.js +0 -2
  89. package/build/features/business/screens/OTP/validation.d.ts +0 -8
  90. package/build/features/business/screens/OTP/validation.js +0 -4
  91. package/build/features/connect/screens/NID/DOB.d.ts +0 -5
  92. package/build/features/connect/screens/NID/DOB.js +0 -47
  93. package/build/features/connectExpress/screens/IdentityOTP/OTP.js +0 -88
  94. package/build/features/connectExpress/screens/IdentityOTP/OTPInput.d.ts +0 -5
  95. package/build/features/connectExpress/screens/IdentityOTP/OTPInput.js +0 -56
  96. package/build/features/connectExpress/screens/IdentityOTP/index.d.ts +0 -3
  97. package/build/features/connectExpress/screens/IdentityOTP/index.js +0 -2
  98. package/build/features/connectExpress/screens/IdentityOTP/validation.d.ts +0 -8
  99. package/build/features/connectExpress/screens/IdentityOTP/validation.js +0 -4
  100. package/build/features/connectExpress/screens/NID/DOB.d.ts +0 -6
  101. package/build/features/connectExpress/screens/NID/DOB.js +0 -47
  102. 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,8 +0,0 @@
1
- import * as React from 'react';
2
- export interface OTPProps {
3
- }
4
- declare const _default: React.MemoExoticComponent<{
5
- ({}: OTPProps): import("react/jsx-runtime").JSX.Element;
6
- defaultProps: {};
7
- }>;
8
- export default _default;
@@ -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,5 +0,0 @@
1
- import * as React from 'react';
2
- export interface OTPProps {
3
- }
4
- declare const _default: React.MemoExoticComponent<({}: OTPProps) => import("react/jsx-runtime").JSX.Element>;
5
- export default _default;
@@ -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,3 +0,0 @@
1
- import OTP, { OTPProps } from './OTP';
2
- export type { OTPProps };
3
- export default OTP;
@@ -1,2 +0,0 @@
1
- import OTP from './OTP';
2
- export default OTP;
@@ -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,4 +0,0 @@
1
- import * as yup from 'yup';
2
- export var OTPValidation = yup.object().shape({
3
- otp: yup.string().min(6, 'otp_min_length').required('otp_required')
4
- });
@@ -1,5 +0,0 @@
1
- interface DOBProps {
2
- onDateClicked?: (flag: boolean) => void;
3
- }
4
- declare const DOB: ({ onDateClicked }: DOBProps) => import("react/jsx-runtime").JSX.Element;
5
- export default DOB;
@@ -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,5 +0,0 @@
1
- import * as React from 'react';
2
- export interface OTPProps {
3
- }
4
- declare const _default: React.MemoExoticComponent<({}: OTPProps) => import("react/jsx-runtime").JSX.Element>;
5
- export default _default;
@@ -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,3 +0,0 @@
1
- import OTP, { OTPProps } from './OTP';
2
- export type { OTPProps };
3
- export default OTP;
@@ -1,2 +0,0 @@
1
- import OTP from './OTP';
2
- export default OTP;
@@ -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,4 +0,0 @@
1
- import * as yup from 'yup';
2
- export var OTPValidation = yup.object().shape({
3
- otp: yup.string().min(6, 'otp_min_length').required('otp_required')
4
- });
@@ -1,6 +0,0 @@
1
- interface DOBProps {
2
- onDateClicked?: (flag: boolean) => void;
3
- readOnly?: boolean;
4
- }
5
- declare const DOB: ({ onDateClicked, readOnly }: DOBProps) => import("react/jsx-runtime").JSX.Element;
6
- export default DOB;
@@ -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 {};