@tap-payments/auth-jsconnect 2.0.54-test → 2.0.56-test
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/app.d.ts +39 -14
- package/build/@types/app.js +9 -0
- package/build/@types/form.d.ts +11 -0
- package/build/api/auth.d.ts +14 -1
- package/build/api/auth.js +24 -1
- package/build/api/axios.js +2 -2
- package/build/api/data.d.ts +33 -7
- package/build/api/data.js +41 -16
- package/build/api/entity.d.ts +2 -0
- package/build/api/index.d.ts +11 -8
- package/build/api/individual.d.ts +1 -1
- package/build/app/rootReducer.d.ts +3 -0
- package/build/app/rootReducer.js +7 -1
- package/build/app/settings.js +8 -2
- package/build/app/store.d.ts +7 -1
- package/build/assets/locales/ar.json +14 -4
- package/build/assets/locales/en.json +14 -4
- package/build/components/AnimationFlow/AnimationFlow.d.ts +4 -1
- package/build/components/AnimationFlow/AnimationFlow.js +5 -7
- package/build/components/AnimationFlow/BottomSheet.js +2 -1
- package/build/components/AnimationFlow/Dialog.d.ts +4 -1
- package/build/components/AnimationFlow/Dialog.js +9 -4
- package/build/components/FileInput/DragAndDrop.d.ts +9 -1
- package/build/components/FileInput/DragAndDrop.js +113 -8
- package/build/components/Lottie/Lottie.d.ts +878 -0
- package/build/components/Lottie/Lottie.js +58 -0
- package/build/components/Lottie/files/pulsating_circle_waves.json +236 -0
- package/build/components/Lottie/files/success.json +425 -0
- package/build/components/Lottie/index.d.ts +3 -0
- package/build/components/Lottie/index.js +3 -0
- package/build/components/ProgressBar/CircularProgressBar.d.ts +14 -0
- package/build/components/ProgressBar/CircularProgressBar.js +48 -0
- package/build/components/ProgressBar/index.d.ts +2 -0
- package/build/components/ProgressBar/index.js +2 -0
- package/build/components/SocialMediaGroup/SocialMediaGroup.d.ts +2 -1
- package/build/components/SocialMediaGroup/SocialMediaGroup.js +27 -34
- package/build/constants/api.d.ts +1 -0
- package/build/constants/api.js +10 -7
- package/build/constants/app.d.ts +15 -0
- package/build/constants/app.js +75 -3
- package/build/constants/assets.d.ts +17 -1
- package/build/constants/assets.js +22 -6
- package/build/constants/validation.d.ts +1 -0
- package/build/constants/validation.js +1 -0
- package/build/features/app/auth/authStore.d.ts +35 -0
- package/build/features/app/auth/authStore.js +148 -0
- package/build/features/app/bank/bankStore.d.ts +4 -0
- package/build/features/app/bank/bankStore.js +42 -22
- package/build/features/app/business/businessStore.js +53 -43
- package/build/features/app/connect/connectStore.d.ts +13 -1
- package/build/features/app/connect/connectStore.js +164 -4
- package/build/features/app/entity/entityStore.d.ts +53 -0
- package/build/features/app/entity/entityStore.js +461 -0
- package/build/features/app/individual/individualStore.js +19 -11
- package/build/features/app/otp/otpStore.d.ts +28 -0
- package/build/features/app/otp/otpStore.js +153 -0
- package/build/features/app/signIn/signInStore.js +2 -2
- package/build/features/auth/Auth.d.ts +10 -0
- package/build/features/auth/Auth.js +87 -0
- package/build/features/auth/index.d.ts +1 -0
- package/build/features/auth/index.js +1 -0
- package/build/features/auth/screens/OTP/OTP.d.ts +5 -0
- package/build/features/auth/screens/OTP/OTP.js +72 -0
- package/build/features/auth/screens/OTP/OTPInput.d.ts +5 -0
- package/build/features/auth/screens/OTP/OTPInput.js +44 -0
- package/build/features/auth/screens/OTP/index.d.ts +3 -0
- package/build/features/auth/screens/OTP/index.js +2 -0
- package/build/features/auth/screens/OTP/validation.d.ts +8 -0
- package/build/features/auth/screens/OTP/validation.js +4 -0
- package/build/features/bank/Bank.js +10 -4
- package/build/features/bank/screens/BankDetails/BankDetails.js +2 -2
- package/build/features/bank/screens/BankDetails/BankStatement.js +33 -8
- package/build/features/business/Business.d.ts +1 -1
- package/build/features/business/Business.js +12 -5
- package/build/features/business/screens/Activities/ActivitiesList.d.ts +1 -1
- package/build/features/business/screens/Activities/SalesChannels.js +1 -1
- package/build/features/business/screens/Customers/CustomerLocations.d.ts +2 -2
- package/build/features/business/screens/Customers/CustomerLocations.js +25 -7
- package/build/features/business/screens/Customers/ExpectedCustomers.js +16 -4
- package/build/features/business/screens/Customers/ExpectedSalesRange.js +32 -14
- package/build/features/connect/Connect.d.ts +2 -1
- package/build/features/connect/Connect.js +40 -10
- package/build/features/connect/screens/CivilID/CivilID.d.ts +5 -0
- package/build/features/connect/screens/CivilID/CivilID.js +85 -0
- package/build/features/connect/screens/CivilID/IDNumber.d.ts +7 -0
- package/build/features/connect/screens/CivilID/IDNumber.js +59 -0
- package/build/features/connect/screens/CivilID/index.d.ts +3 -0
- package/build/features/connect/screens/CivilID/index.js +2 -0
- package/build/features/connect/screens/CivilID/validation.d.ts +8 -0
- package/build/features/connect/screens/CivilID/validation.js +4 -0
- package/build/features/connect/screens/Individual/Individual.js +6 -2
- package/build/features/connect/screens/Merchant/Merchant.js +35 -11
- package/build/features/connect/screens/Merchant/SalesChannels.d.ts +5 -0
- package/build/features/connect/screens/Merchant/SalesChannels.js +114 -0
- package/build/features/connect/screens/Merchant/SocialMedia.js +56 -11
- package/build/features/connect/screens/Merchant/validation.d.ts +87 -0
- package/build/features/connect/screens/Merchant/validation.js +68 -2
- package/build/features/connect/screens/Mobile/Mobile.js +7 -4
- package/build/features/connect/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +169 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.d.ts +5 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.js +22 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
- package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
- package/build/features/connect/screens/VerifyPACI/index.d.ts +3 -0
- package/build/features/connect/screens/VerifyPACI/index.js +2 -0
- package/build/features/entity/Entity.d.ts +7 -0
- package/build/features/entity/Entity.js +70 -0
- package/build/features/entity/index.d.ts +1 -0
- package/build/features/entity/index.js +1 -0
- package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.d.ts +54 -0
- package/build/features/entity/screens/EntityInfoConfirm/ActivitiesList.js +139 -0
- package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.d.ts +5 -0
- package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +56 -0
- package/build/features/entity/screens/EntityInfoConfirm/LicenseName.d.ts +5 -0
- package/build/features/entity/screens/EntityInfoConfirm/LicenseName.js +17 -0
- package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.d.ts +5 -0
- package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.js +28 -0
- package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.d.ts +6 -0
- package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.js +38 -0
- package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.d.ts +5 -0
- package/build/features/entity/screens/EntityInfoConfirm/SalesChannels.js +112 -0
- package/build/features/entity/screens/EntityInfoConfirm/index.d.ts +2 -0
- package/build/features/entity/screens/EntityInfoConfirm/index.js +2 -0
- package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +107 -0
- package/build/features/entity/screens/EntityInfoConfirm/validation.js +17 -0
- package/build/features/entity/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
- package/build/features/entity/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
- package/build/features/entity/screens/ResetPasswordSuccess/index.d.ts +3 -0
- package/build/features/entity/screens/ResetPasswordSuccess/index.js +2 -0
- package/build/features/entity/screens/Success/Success.d.ts +5 -0
- package/build/features/entity/screens/Success/Success.js +16 -0
- package/build/features/entity/screens/Success/index.d.ts +3 -0
- package/build/features/entity/screens/Success/index.js +2 -0
- package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +3 -0
- package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +109 -0
- package/build/features/entity/screens/SuccessWithFlowButtons/index.d.ts +2 -0
- package/build/features/entity/screens/SuccessWithFlowButtons/index.js +2 -0
- package/build/features/entity/screens/Verify/OTPInput.d.ts +7 -0
- package/build/features/entity/screens/Verify/OTPInput.js +47 -0
- package/build/features/entity/screens/Verify/Verify.d.ts +5 -0
- package/build/features/entity/screens/Verify/Verify.js +78 -0
- package/build/features/entity/screens/Verify/index.d.ts +2 -0
- package/build/features/entity/screens/Verify/index.js +2 -0
- package/build/features/entity/screens/Verify/validation.d.ts +8 -0
- package/build/features/entity/screens/Verify/validation.js +4 -0
- package/build/features/featuresScreens.d.ts +3 -0
- package/build/features/featuresScreens.js +48 -0
- package/build/features/individual/Individual.d.ts +1 -1
- package/build/features/individual/Individual.js +12 -5
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +1 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +14 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +11 -3
- package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +2 -2
- package/build/features/otp/OTP.d.ts +7 -0
- package/build/features/otp/OTP.js +58 -0
- package/build/features/otp/index.d.ts +0 -0
- package/build/features/otp/index.js +1 -0
- package/build/features/otp/screens/OTPVerify/OTPInput.d.ts +6 -0
- package/build/features/otp/screens/OTPVerify/OTPInput.js +47 -0
- package/build/features/otp/screens/OTPVerify/Verify.d.ts +5 -0
- package/build/features/otp/screens/OTPVerify/Verify.js +49 -0
- package/build/features/otp/screens/OTPVerify/index.d.ts +2 -0
- package/build/features/otp/screens/OTPVerify/index.js +2 -0
- package/build/features/otp/screens/OTPVerify/validation.d.ts +8 -0
- package/build/features/otp/screens/OTPVerify/validation.js +4 -0
- package/build/features/password/Password.d.ts +1 -1
- package/build/features/password/Password.js +12 -5
- package/build/features/shared/Background/Background.d.ts +7 -5
- package/build/features/shared/Background/Background.js +16 -5
- package/build/features/shared/Dialog/CloseDialog.d.ts +11 -0
- package/build/features/shared/Dialog/CloseDialog.js +62 -0
- package/build/features/shared/Dialog/DialogContainer.d.ts +8 -0
- package/build/features/shared/Dialog/DialogContainer.js +56 -0
- package/build/features/shared/Dialog/index.d.ts +4 -0
- package/build/features/shared/Dialog/index.js +4 -0
- package/build/features/shared/Input/Input.d.ts +1 -1
- package/build/features/shared/Input/Input.js +2 -2
- package/build/features/shared/UploadFile/UploadFile.d.ts +8 -3
- package/build/features/shared/UploadFile/UploadFile.js +23 -8
- package/build/features/signIn/SignIn.d.ts +1 -1
- package/build/features/signIn/SignIn.js +12 -4
- package/build/features/tax/Tax.d.ts +1 -1
- package/build/features/tax/Tax.js +12 -4
- package/build/hooks/index.d.ts +1 -0
- package/build/hooks/index.js +1 -0
- package/build/hooks/useAppConfig.js +2 -0
- package/build/hooks/useAppDispatch.d.ts +3 -0
- package/build/hooks/useErrorListener.js +3 -2
- package/build/hooks/useScreen.d.ts +3 -0
- package/build/hooks/useScreen.js +14 -0
- package/build/index.d.ts +5 -2
- package/build/index.js +11 -2
- package/build/utils/device.d.ts +1 -0
- package/build/utils/device.js +13 -0
- package/build/utils/html.d.ts +1 -0
- package/build/utils/html.js +6 -0
- package/build/utils/locale.js +1 -1
- package/build/utils/rsa.d.ts +2 -2
- package/build/utils/rsa.js +1 -1
- package/build/utils/string.d.ts +22 -20
- package/build/utils/string.js +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,78 @@
|
|
|
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 { useAppDispatch } from '../../../../hooks';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
16
|
+
import { useForm, FormProvider } from 'react-hook-form';
|
|
17
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
|
+
import Box from '@mui/material/Box/Box';
|
|
19
|
+
import { styled } from '@mui/material/styles';
|
|
20
|
+
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
21
|
+
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
22
|
+
import { maskPhone } from '../../../../utils';
|
|
23
|
+
import Form from '../../../../components/Form';
|
|
24
|
+
import Text from '../../../../components/Text';
|
|
25
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
26
|
+
import { entitySelector, clearError, resetOTPScreen, verifyEntityLeadOTP } from '../../../app/entity/entityStore';
|
|
27
|
+
import Button from '../../../shared/Button';
|
|
28
|
+
import { OTPValidation } from './validation';
|
|
29
|
+
import OTPInput from './OTPInput';
|
|
30
|
+
var OTPTitleContainerStyled = styled(Box)(function (_a) {
|
|
31
|
+
var theme = _a.theme;
|
|
32
|
+
return ({
|
|
33
|
+
background: theme.palette.common.white,
|
|
34
|
+
border: '1px solid',
|
|
35
|
+
borderColor: theme.palette.divider,
|
|
36
|
+
direction: theme.direction,
|
|
37
|
+
borderRadius: theme.spacing(0, 0, 1.25, 1.25),
|
|
38
|
+
marginBottom: theme.spacing(5.75)
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
var OTPTitleStyled = styled(Text)(function (_a) {
|
|
42
|
+
var theme = _a.theme;
|
|
43
|
+
return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightLight, marginBlock: theme.spacing(1.75), marginInlineStart: theme.spacing(2.5), lineHeight: 1.75 }));
|
|
44
|
+
});
|
|
45
|
+
var FormStyled = styled(Form)(function () { return ({
|
|
46
|
+
display: 'flex',
|
|
47
|
+
flexDirection: 'column'
|
|
48
|
+
}); });
|
|
49
|
+
var VerifyNumber = function (_a) {
|
|
50
|
+
var _b, _c, _d;
|
|
51
|
+
var dispatch = useAppDispatch();
|
|
52
|
+
var _e = useAppSelector(entitySelector), data = _e.data, loading = _e.loading, error = _e.error;
|
|
53
|
+
var methods = useForm({
|
|
54
|
+
resolver: yupResolver(OTPValidation),
|
|
55
|
+
defaultValues: data.otpData,
|
|
56
|
+
mode: 'onChange'
|
|
57
|
+
});
|
|
58
|
+
var t = useTranslation().t;
|
|
59
|
+
var isAr = useLanguage().isAr;
|
|
60
|
+
var _f = React.useState(false), resendLoading = _f[0], setResendLoading = _f[1];
|
|
61
|
+
var phone = (_d = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.contact) === null || _c === void 0 ? void 0 : _c.phone) === null || _d === void 0 ? void 0 : _d.number;
|
|
62
|
+
React.useEffect(function () {
|
|
63
|
+
if (error && methods.formState.isValid && phone)
|
|
64
|
+
dispatch(clearError());
|
|
65
|
+
return function () {
|
|
66
|
+
dispatch(resetOTPScreen());
|
|
67
|
+
};
|
|
68
|
+
}, [methods.formState.isValid]);
|
|
69
|
+
var onSubmit = function (formData) {
|
|
70
|
+
dispatch(verifyEntityLeadOTP(formData));
|
|
71
|
+
};
|
|
72
|
+
var onBack = function () {
|
|
73
|
+
dispatch(handlePrevScreenStep());
|
|
74
|
+
};
|
|
75
|
+
var disabled = !methods.formState.isValid || !!error || !phone || resendLoading;
|
|
76
|
+
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('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, { loading: resendLoading, setLoading: setResendLoading }), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
77
|
+
};
|
|
78
|
+
export default React.memo(VerifyNumber);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export declare const OTPValidation: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
otp: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
4
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
5
|
+
otp: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
6
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
7
|
+
otp: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
8
|
+
}>>>;
|
|
@@ -6,3 +6,6 @@ export declare const individualFeatureScreens: Array<FeatureScreenStep>;
|
|
|
6
6
|
export declare const bankFeatureScreens: Array<FeatureScreenStep>;
|
|
7
7
|
export declare const taxFeatureScreens: Array<FeatureScreenStep>;
|
|
8
8
|
export declare const signInFeatureScreens: Array<FeatureScreenStep>;
|
|
9
|
+
export declare const entityFeatureScreens: Array<FeatureScreenStep>;
|
|
10
|
+
export declare const otpFeatureScreens: Array<FeatureScreenStep>;
|
|
11
|
+
export declare const authFeatureScreens: Array<FeatureScreenStep>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import MobileScreen from './connect/screens/Mobile';
|
|
2
2
|
import NIDScreen from './connect/screens/NID';
|
|
3
|
+
import CivilIDScreen from '../features/connect/screens/CivilID';
|
|
4
|
+
import VerifyPACIScreen from './connect/screens/VerifyPACI';
|
|
3
5
|
import IndividualScreen from './connect/screens/Individual';
|
|
4
6
|
import MerchantInfoScreen from './connect/screens/Merchant';
|
|
5
7
|
import ConnectOTPScreen from './connect/screens/OTP';
|
|
@@ -38,11 +40,22 @@ import SignInMobilePage from './signIn/screens/Mobile';
|
|
|
38
40
|
import SignInEmailPage from './signIn/screens/Email';
|
|
39
41
|
import SignInOTPPage from './signIn/screens/OTP';
|
|
40
42
|
import SignInPasswordPage from './signIn/screens/Password';
|
|
43
|
+
import EntityVerifyPage from './entity/screens/Verify';
|
|
44
|
+
import EntityInfoConfirmPage from './entity/screens/EntityInfoConfirm';
|
|
45
|
+
import EntitySuccessPage from './entity/screens/Success';
|
|
46
|
+
import EntitySuccessWithFlowPage from './entity/screens/SuccessWithFlowButtons';
|
|
47
|
+
import EntityResetPasswordSuccessPage from './entity/screens/ResetPasswordSuccess';
|
|
48
|
+
import OtpVerifyPage from '../features/otp/screens/OTPVerify';
|
|
49
|
+
import AuthVerifyPage from './auth/screens/OTP';
|
|
41
50
|
export var connectFeatureScreens = [
|
|
42
51
|
{
|
|
43
52
|
name: 'CONNECT_NID_STEP',
|
|
44
53
|
element: NIDScreen
|
|
45
54
|
},
|
|
55
|
+
{
|
|
56
|
+
name: 'CONNECT_CIVIL_ID_STEP',
|
|
57
|
+
element: CivilIDScreen
|
|
58
|
+
},
|
|
46
59
|
{
|
|
47
60
|
name: 'CONNECT_MOBILE_STEP',
|
|
48
61
|
element: MobileScreen
|
|
@@ -51,6 +64,10 @@ export var connectFeatureScreens = [
|
|
|
51
64
|
name: 'CONNECT_OTP_STEP',
|
|
52
65
|
element: ConnectOTPScreen
|
|
53
66
|
},
|
|
67
|
+
{
|
|
68
|
+
name: 'CONNECT_VERIFY_PACI_STEP',
|
|
69
|
+
element: VerifyPACIScreen
|
|
70
|
+
},
|
|
54
71
|
{
|
|
55
72
|
name: 'CONNECT_INDIVIDUAL_STEP',
|
|
56
73
|
element: IndividualScreen
|
|
@@ -191,3 +208,34 @@ export var signInFeatureScreens = [
|
|
|
191
208
|
element: SignInPasswordPage
|
|
192
209
|
}
|
|
193
210
|
];
|
|
211
|
+
export var entityFeatureScreens = [
|
|
212
|
+
{
|
|
213
|
+
name: 'ENTITY_VERIFY_STEP',
|
|
214
|
+
element: EntityVerifyPage
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
name: 'ENTITY_INFO_STEP',
|
|
218
|
+
element: EntityInfoConfirmPage
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
name: 'ENTITY_DETAILS_SUCCESS_STEP',
|
|
222
|
+
element: EntitySuccessPage
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: 'ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
|
|
226
|
+
element: EntitySuccessWithFlowPage
|
|
227
|
+
},
|
|
228
|
+
{ name: 'ENTITY_RESET_PASSWORD_SUCCESS', element: EntityResetPasswordSuccessPage }
|
|
229
|
+
];
|
|
230
|
+
export var otpFeatureScreens = [
|
|
231
|
+
{
|
|
232
|
+
name: 'OTP_VERIFY_STEP',
|
|
233
|
+
element: OtpVerifyPage
|
|
234
|
+
}
|
|
235
|
+
];
|
|
236
|
+
export var authFeatureScreens = [
|
|
237
|
+
{
|
|
238
|
+
name: 'AUTH_VERIFY_STEP',
|
|
239
|
+
element: AuthVerifyPage
|
|
240
|
+
}
|
|
241
|
+
];
|
|
@@ -4,4 +4,4 @@ export interface IndividualLibProps extends LibConfig {
|
|
|
4
4
|
}
|
|
5
5
|
export declare function IndividualLib(props: IndividualLibProps): JSX.Element;
|
|
6
6
|
export declare function renderIndividualLib(config: IndividualLibProps, elementId: string): void;
|
|
7
|
-
export declare function unmountIndividualLib(elementId: string): void;
|
|
7
|
+
export declare function unmountIndividualLib(elementId: string, unmountTimeout?: number): void;
|
|
@@ -17,9 +17,9 @@ import AnimationFlow from '../../components/AnimationFlow';
|
|
|
17
17
|
import { store } from '../../app/store';
|
|
18
18
|
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
19
19
|
import Collapse from '../../components/Collapse';
|
|
20
|
-
import { getParameterByName, reactElement } from '../../utils';
|
|
20
|
+
import { getParameterByName, reactElement, removeElement } from '../../utils';
|
|
21
21
|
import { FeatureContainer } from '../shared/Containers';
|
|
22
|
-
import { INDIVIDUAL_SCREENS_NAVIGATION } from '../../constants';
|
|
22
|
+
import { DIALOG_ID, INDIVIDUAL_SCREENS_NAVIGATION } from '../../constants';
|
|
23
23
|
import { individualFeatureScreens } from '../featuresScreens';
|
|
24
24
|
import { individualSelector, verifyLeadToken } from '../app/individual/individualStore';
|
|
25
25
|
import CustomFooter from '../shared/Footer';
|
|
@@ -46,7 +46,7 @@ var Individual = memo(function (props) {
|
|
|
46
46
|
if (!settingLoading)
|
|
47
47
|
verifyToken();
|
|
48
48
|
}, [settingLoading]);
|
|
49
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: individualFeatureScreens.map(function (_a, index) {
|
|
49
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: individualFeatureScreens.map(function (_a, index) {
|
|
50
50
|
var Element = _a.element, name = _a.name;
|
|
51
51
|
var isActive = activeScreen.name === name;
|
|
52
52
|
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
@@ -58,6 +58,13 @@ export function IndividualLib(props) {
|
|
|
58
58
|
export function renderIndividualLib(config, elementId) {
|
|
59
59
|
reactElement(elementId).render(_jsx(IndividualLib, __assign({}, config)));
|
|
60
60
|
}
|
|
61
|
-
export function unmountIndividualLib(elementId) {
|
|
62
|
-
|
|
61
|
+
export function unmountIndividualLib(elementId, unmountTimeout) {
|
|
62
|
+
if (unmountTimeout === void 0) { unmountTimeout = 1000; }
|
|
63
|
+
var element = document.getElementById(elementId);
|
|
64
|
+
setTimeout(function () {
|
|
65
|
+
var _a;
|
|
66
|
+
((_a = element === null || element === void 0 ? void 0 : element.children) === null || _a === void 0 ? void 0 : _a.length) && element.removeChild(element.children[0]);
|
|
67
|
+
removeElement(DIALOG_ID);
|
|
68
|
+
reactElement(elementId).unmount();
|
|
69
|
+
}, unmountTimeout);
|
|
63
70
|
}
|
package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js
CHANGED
|
@@ -55,7 +55,7 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
55
55
|
var _e = React.useState(false), employerFieldsActive = _e[0], setEmployerFieldsActive = _e[1];
|
|
56
56
|
React.useEffect(function () {
|
|
57
57
|
var _a, _b;
|
|
58
|
-
if (((_b = (_a = methods.getValues('sourceIncome')) === null || _a === void 0 ? void 0 : _a.
|
|
58
|
+
if (((_b = (_a = methods.getValues('sourceIncome')) === null || _a === void 0 ? void 0 : _a.name.en) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'salary')
|
|
59
59
|
setEmployerFieldsActive(true);
|
|
60
60
|
else {
|
|
61
61
|
setEmployerFieldsActive(false);
|
|
@@ -35,6 +35,7 @@ import { individualSelector } from '../../../app/individual/individualStore';
|
|
|
35
35
|
import Text from '../../../../components/Text';
|
|
36
36
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
37
37
|
import SimpleList from '../../../../components/SimpleList';
|
|
38
|
+
import Search from '../../../../features/shared/Search';
|
|
38
39
|
var Container = styled(Box)(function () { return ({
|
|
39
40
|
display: 'flex'
|
|
40
41
|
}); });
|
|
@@ -75,15 +76,25 @@ var MonthlyIncome = function (_a) {
|
|
|
75
76
|
var _a;
|
|
76
77
|
setAnchorEl(null);
|
|
77
78
|
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
79
|
+
if ((monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.length) > 0) {
|
|
80
|
+
setIncomeList(monthlyIncomeList);
|
|
81
|
+
}
|
|
78
82
|
};
|
|
79
83
|
var onSelectItem = function (source) {
|
|
80
84
|
onCloseList();
|
|
81
85
|
monthlyIncomeControl.field.onChange(source);
|
|
82
86
|
};
|
|
87
|
+
var handleSearch = function (value) {
|
|
88
|
+
var filteredList = monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.filter(function (income) {
|
|
89
|
+
return income.name.en.toLowerCase().startsWith(value.toLowerCase()) ||
|
|
90
|
+
income.name.ar.toLowerCase().startsWith(value.toLowerCase());
|
|
91
|
+
});
|
|
92
|
+
setIncomeList(filteredList);
|
|
93
|
+
};
|
|
83
94
|
var income = monthlyIncomeControl.field.value;
|
|
84
95
|
var error = (_b = monthlyIncomeControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
85
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 0 } }, { children: [_jsx(Input, { label: t('please_enter_actual_income'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_source_of_income'), value: (isAr ? income === null || income === void 0 ? void 0 : income.
|
|
86
|
-
|
|
87
|
-
|
|
96
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 0 } }, { children: [_jsx(Input, { label: t('please_enter_actual_income'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_source_of_income'), value: (isAr ? income === null || income === void 0 ? void 0 : income.range.ar : income === null || income === void 0 ? void 0 : income.range.en) || '', warningMessage: error && t(error) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'range.en', list: incomeList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
97
|
+
return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (income === null || income === void 0 ? void 0 : income.id) }, { children: isAr ? item.range.ar : item === null || item === void 0 ? void 0 : item.range.en })) }), item.id === (income === null || income === void 0 ? void 0 : income.id) && _jsx(CheckIconStyled, {})] }));
|
|
98
|
+
} })] }))] })) })));
|
|
88
99
|
};
|
|
89
100
|
export default React.memo(MonthlyIncome);
|
|
@@ -35,6 +35,7 @@ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
|
35
35
|
import Input from '../../../shared/Input';
|
|
36
36
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
37
37
|
import SimpleList from '../../../../components/SimpleList';
|
|
38
|
+
import Search from '../../../../features/shared/Search';
|
|
38
39
|
var Container = styled(Box)(function () { return ({
|
|
39
40
|
display: 'flex'
|
|
40
41
|
}); });
|
|
@@ -80,10 +81,17 @@ var Occupation = function (_a) {
|
|
|
80
81
|
onCloseList();
|
|
81
82
|
occupationControl.field.onChange(occupation);
|
|
82
83
|
};
|
|
84
|
+
var handleSearch = function (value) {
|
|
85
|
+
var filteredList = occupationsList === null || occupationsList === void 0 ? void 0 : occupationsList.filter(function (occupation) {
|
|
86
|
+
return occupation.name.en.toLowerCase().startsWith(value.toLowerCase()) ||
|
|
87
|
+
occupation.name.ar.toLowerCase().startsWith(value.toLowerCase());
|
|
88
|
+
});
|
|
89
|
+
setOccupationList(filteredList);
|
|
90
|
+
};
|
|
83
91
|
var occupation = occupationControl.field.value;
|
|
84
92
|
var error = (_c = occupationControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
|
|
85
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 2.5 } }, { children: [_jsx(Input, { required: true, label: t('occupation_title'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_occupation'), value: (isAr ? occupation === null || occupation === void 0 ? void 0 : occupation.
|
|
86
|
-
|
|
87
|
-
|
|
93
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 2.5 } }, { children: [_jsx(Input, { required: true, label: t('occupation_title'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_occupation'), value: (isAr ? occupation === null || occupation === void 0 ? void 0 : occupation.name.ar : occupation === null || occupation === void 0 ? void 0 : occupation.name.en) || '', warningMessage: error && t(error) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.en', list: occupationList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
94
|
+
return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (occupation === null || occupation === void 0 ? void 0 : occupation.id) }, { children: isAr ? item.name.ar : item === null || item === void 0 ? void 0 : item.name.en })) }), item.id === (occupation === null || occupation === void 0 ? void 0 : occupation.id) && _jsx(CheckIconStyled, {})] }));
|
|
95
|
+
} })] }))] })) })));
|
|
88
96
|
};
|
|
89
97
|
export default Occupation;
|
|
@@ -82,8 +82,8 @@ var SourceOfIncome = function (_a) {
|
|
|
82
82
|
};
|
|
83
83
|
var source = sourceIncomeControl.field.value;
|
|
84
84
|
var error = (_c = sourceIncomeControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
|
|
85
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 2.5 } }, { children: [_jsx(Input, { required: true, label: t('tap_js_source_of_income'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_source_of_income'), value: (isAr ? source === null || source === void 0 ? void 0 : source.
|
|
86
|
-
return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (source === null || source === void 0 ? void 0 : source.id) }, { children: isAr ? item.
|
|
85
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 2.5 } }, { children: [_jsx(Input, { required: true, label: t('tap_js_source_of_income'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_source_of_income'), value: (isAr ? source === null || source === void 0 ? void 0 : source.name.ar : source === null || source === void 0 ? void 0 : source.name.en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.en', list: sourceList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
86
|
+
return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (source === null || source === void 0 ? void 0 : source.id) }, { children: isAr ? item.name.ar : item === null || item === void 0 ? void 0 : item.name.en })) }), item.id === (source === null || source === void 0 ? void 0 : source.id) && _jsx(CheckIconStyled, {})] }));
|
|
87
87
|
} }) }))] })) })));
|
|
88
88
|
};
|
|
89
89
|
export default React.memo(SourceOfIncome);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { LibConfig } from '../../@types';
|
|
3
|
+
export interface OTPLibProps extends LibConfig {
|
|
4
|
+
}
|
|
5
|
+
export declare function OTPLib(props: OTPLibProps): JSX.Element;
|
|
6
|
+
export declare function renderOTPLib(config: OTPLibProps, elementId: string): void;
|
|
7
|
+
export declare function unmountOTPLib(elementId: string): void;
|
|
@@ -0,0 +1,58 @@
|
|
|
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 { memo } from 'react';
|
|
14
|
+
import { styled } from '@mui/material/styles';
|
|
15
|
+
import { useAppTheme, useAppSelector, useAppConfig, useErrorListener, useStepStartedListener } from '../../hooks';
|
|
16
|
+
import { settingsSelector } from '../../app/settings';
|
|
17
|
+
import { store } from '../../app/store';
|
|
18
|
+
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
19
|
+
import Collapse from '../../components/Collapse';
|
|
20
|
+
import { reactElement } from '../../utils';
|
|
21
|
+
import { FeatureContainer } from '../shared/Containers';
|
|
22
|
+
import { OTP_SCREENS_NAVIGATION } from '../../constants';
|
|
23
|
+
import { otpSelector } from '../app/otp/otpStore';
|
|
24
|
+
import { otpFeatureScreens } from '../featuresScreens';
|
|
25
|
+
var Container = styled(FeatureContainer)(function (_a) {
|
|
26
|
+
var theme = _a.theme;
|
|
27
|
+
return ({
|
|
28
|
+
borderRadius: theme.spacing(1.5),
|
|
29
|
+
backgroundColor: 'inherit',
|
|
30
|
+
color: theme.palette.text.primary,
|
|
31
|
+
maxHeight: "calc(100% - ".concat(theme.spacing(10), ") !important"),
|
|
32
|
+
width: theme.spacing(46.875),
|
|
33
|
+
maxWidth: theme.spacing(46.875)
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
var OTP = memo(function (props) {
|
|
37
|
+
var theme = useAppTheme().theme;
|
|
38
|
+
var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error;
|
|
39
|
+
var otpError = useAppSelector(otpSelector).error;
|
|
40
|
+
useAppConfig(__assign({ navigation: OTP_SCREENS_NAVIGATION }, props));
|
|
41
|
+
useErrorListener(otpError || error);
|
|
42
|
+
useStepStartedListener();
|
|
43
|
+
var activeScreen = data.activeScreen;
|
|
44
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Container, { children: otpFeatureScreens.map(function (_a, index) {
|
|
45
|
+
var Element = _a.element, name = _a.name;
|
|
46
|
+
var isActive = activeScreen.name === name;
|
|
47
|
+
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
48
|
+
}) }) })));
|
|
49
|
+
});
|
|
50
|
+
export function OTPLib(props) {
|
|
51
|
+
return (_jsx(ReduxProvider, __assign({ store: store }, { children: _jsx(OTP, __assign({}, props)) })));
|
|
52
|
+
}
|
|
53
|
+
export function renderOTPLib(config, elementId) {
|
|
54
|
+
reactElement(elementId).render(_jsx(OTPLib, __assign({}, config)));
|
|
55
|
+
}
|
|
56
|
+
export function unmountOTPLib(elementId) {
|
|
57
|
+
reactElement(elementId).unmount();
|
|
58
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -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 } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import Box from '@mui/material/Box/Box';
|
|
15
|
+
import { styled } from '@mui/material/styles';
|
|
16
|
+
import OTPField from '../../../shared/OTP';
|
|
17
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
18
|
+
import { useTranslation } from 'react-i18next';
|
|
19
|
+
import { DEFAULT_TIMER_VALUE } from '../../../../constants';
|
|
20
|
+
import { useAppDispatch } from '../../../../hooks';
|
|
21
|
+
import { resendOTP } from '../../../app/otp/otpStore';
|
|
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 loading = _a.loading;
|
|
32
|
+
var _b = useFormContext(), control = _b.control, setValue = _b.setValue;
|
|
33
|
+
var t = useTranslation().t;
|
|
34
|
+
var otpControl = useController({ name: 'otp', control: control });
|
|
35
|
+
var dispatch = useAppDispatch();
|
|
36
|
+
var handleOnOTPChange = function (otp) {
|
|
37
|
+
otpControl.field.onChange(otp);
|
|
38
|
+
};
|
|
39
|
+
var handleOnResendOTP = function () {
|
|
40
|
+
if (otpControl.field.value)
|
|
41
|
+
setValue('otp', '', { shouldValidate: true });
|
|
42
|
+
dispatch(resendOTP());
|
|
43
|
+
};
|
|
44
|
+
var otpValue = otpControl.field.value;
|
|
45
|
+
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
46
|
+
};
|
|
47
|
+
export default React.memo(OTPInput);
|
|
@@ -0,0 +1,49 @@
|
|
|
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 { useAppDispatch } from '../../../../hooks';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
16
|
+
import { useForm, FormProvider } from 'react-hook-form';
|
|
17
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
|
+
import { styled } from '@mui/material/styles';
|
|
19
|
+
import { useLanguage, useAppSelector } from '../../../../hooks';
|
|
20
|
+
import Form from '../../../../components/Form';
|
|
21
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
22
|
+
import { otpSelector, clearError, resetOTPScreen } from '../../../app/otp/otpStore';
|
|
23
|
+
import { OTPValidation } from './validation';
|
|
24
|
+
import OTPInput from './OTPInput';
|
|
25
|
+
var FormStyled = styled(Form)(function () { return ({
|
|
26
|
+
display: 'flex',
|
|
27
|
+
flexDirection: 'column'
|
|
28
|
+
}); });
|
|
29
|
+
var Verify = function (_a) {
|
|
30
|
+
var dispatch = useAppDispatch();
|
|
31
|
+
var _b = useAppSelector(otpSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
32
|
+
var methods = useForm({
|
|
33
|
+
resolver: yupResolver(OTPValidation),
|
|
34
|
+
defaultValues: data.otpData,
|
|
35
|
+
mode: 'onChange'
|
|
36
|
+
});
|
|
37
|
+
var t = useTranslation().t;
|
|
38
|
+
var isAr = useLanguage().isAr;
|
|
39
|
+
React.useEffect(function () {
|
|
40
|
+
if (methods.formState.isValid)
|
|
41
|
+
dispatch(clearError());
|
|
42
|
+
return function () {
|
|
43
|
+
dispatch(resetOTPScreen());
|
|
44
|
+
};
|
|
45
|
+
}, [methods.formState.isValid]);
|
|
46
|
+
var disabled = !methods.formState.isValid || !!error;
|
|
47
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsx(FormStyled, { children: _jsx(OTPInput, { loading: false }) }) })) }));
|
|
48
|
+
};
|
|
49
|
+
export default React.memo(Verify);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export declare const OTPValidation: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
otp: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
4
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
5
|
+
otp: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
6
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
7
|
+
otp: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
8
|
+
}>>>;
|
|
@@ -4,4 +4,4 @@ export interface PasswordLibProps extends LibConfig {
|
|
|
4
4
|
}
|
|
5
5
|
export declare function PasswordLib(props: PasswordLibProps): JSX.Element;
|
|
6
6
|
export declare function renderPasswordLib(config: PasswordLibProps, elementId: string): void;
|
|
7
|
-
export declare function unmountPasswordLib(elementId: string): void;
|
|
7
|
+
export declare function unmountPasswordLib(elementId: string, unmountTimeout?: number): void;
|
|
@@ -18,8 +18,8 @@ import { store } from '../../app/store';
|
|
|
18
18
|
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
19
19
|
import Collapse from '../../components/Collapse';
|
|
20
20
|
import { FeatureContainer } from '../shared/Containers';
|
|
21
|
-
import { getParameterByName, reactElement } from '../../utils';
|
|
22
|
-
import { PASSWORD_OPERATION_TYPE, PASSWORD_SCREENS_NAVIGATION } from '../../constants';
|
|
21
|
+
import { getParameterByName, reactElement, removeElement } from '../../utils';
|
|
22
|
+
import { DIALOG_ID, PASSWORD_OPERATION_TYPE, PASSWORD_SCREENS_NAVIGATION } from '../../constants';
|
|
23
23
|
import { passwordFeatureScreens } from '../featuresScreens';
|
|
24
24
|
import { passwordSelector, verifyLeadToken, verifyOperationToken } from '../app/password/passwordStore';
|
|
25
25
|
import CustomFooter from '../shared/Footer';
|
|
@@ -53,7 +53,7 @@ var Password = memo(function (props) {
|
|
|
53
53
|
if (!settingLoading)
|
|
54
54
|
verifyToken();
|
|
55
55
|
}, [settingLoading]);
|
|
56
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: passwordFeatureScreens.map(function (_a, index) {
|
|
56
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: passwordFeatureScreens.map(function (_a, index) {
|
|
57
57
|
var Element = _a.element, name = _a.name;
|
|
58
58
|
var isActive = activeScreen.name === name;
|
|
59
59
|
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
@@ -65,6 +65,13 @@ export function PasswordLib(props) {
|
|
|
65
65
|
export function renderPasswordLib(config, elementId) {
|
|
66
66
|
reactElement(elementId).render(_jsx(PasswordLib, __assign({}, config)));
|
|
67
67
|
}
|
|
68
|
-
export function unmountPasswordLib(elementId) {
|
|
69
|
-
|
|
68
|
+
export function unmountPasswordLib(elementId, unmountTimeout) {
|
|
69
|
+
if (unmountTimeout === void 0) { unmountTimeout = 1000; }
|
|
70
|
+
var element = document.getElementById(elementId);
|
|
71
|
+
setTimeout(function () {
|
|
72
|
+
var _a;
|
|
73
|
+
((_a = element === null || element === void 0 ? void 0 : element.children) === null || _a === void 0 ? void 0 : _a.length) && element.removeChild(element.children[0]);
|
|
74
|
+
removeElement(DIALOG_ID);
|
|
75
|
+
reactElement(elementId).unmount();
|
|
76
|
+
}, unmountTimeout);
|
|
70
77
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
interface BackgroundProps extends TapOrigin {
|
|
2
|
+
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
+
interface BackgroundProps {
|
|
6
4
|
children: React.ReactNode;
|
|
7
5
|
loading?: boolean;
|
|
6
|
+
hideLogo?: boolean;
|
|
7
|
+
sx?: SxProps<Theme>;
|
|
8
|
+
open: boolean;
|
|
9
|
+
isTapOrigin: boolean;
|
|
8
10
|
}
|
|
9
|
-
declare const _default: React.MemoExoticComponent<({ children, isTapOrigin, loading }: BackgroundProps) => JSX.Element>;
|
|
11
|
+
declare const _default: React.MemoExoticComponent<({ children, isTapOrigin, loading, hideLogo, sx, open }: BackgroundProps) => JSX.Element>;
|
|
10
12
|
export default _default;
|