@tap-payments/auth-jsconnect 2.0.1 → 2.0.4
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 +5 -0
- package/build/@types/form.d.ts +2 -1
- package/build/api/auth.d.ts +20 -3
- package/build/api/axios.js +8 -9
- package/build/api/data.d.ts +1 -0
- package/build/api/data.js +9 -2
- package/build/api/entity.d.ts +5 -1
- package/build/api/entity.js +11 -2
- package/build/api/index.d.ts +6 -4
- package/build/api/lead.d.ts +2 -1
- package/build/api/lead.js +14 -2
- package/build/components/AnimationFlow/AnimationFlow.d.ts +2 -1
- package/build/components/AnimationFlow/AnimationFlow.js +2 -2
- package/build/components/AnimationFlow/BottomSheet.d.ts +2 -1
- package/build/components/AnimationFlow/BottomSheet.js +16 -4
- package/build/constants/api.d.ts +2 -1
- package/build/constants/api.js +5 -3
- package/build/constants/app.d.ts +5 -0
- package/build/constants/app.js +21 -5
- package/build/features/app/bank/bankStore.js +17 -10
- package/build/features/app/business/businessStore.d.ts +3 -5
- package/build/features/app/business/businessStore.js +140 -48
- package/build/features/app/connect/connectStore.d.ts +5 -10
- package/build/features/app/connect/connectStore.js +117 -25
- package/build/features/app/individual/individualStore.d.ts +3 -2
- package/build/features/app/individual/individualStore.js +42 -30
- package/build/features/app/password/passwordStore.d.ts +29 -1
- package/build/features/app/password/passwordStore.js +194 -14
- package/build/features/app/tax/taxStore.js +19 -12
- package/build/features/bank/Bank.js +3 -4
- package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +16 -4
- package/build/features/business/Business.js +3 -4
- package/build/features/business/screens/Activities/Activities.js +1 -1
- package/build/features/business/screens/IDBOD/IDBOD.js +1 -1
- package/build/features/business/screens/OTP/OTPInput.js +3 -9
- package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +17 -6
- package/build/features/connect/Connect.js +1 -1
- package/build/features/connect/screens/Mobile/Mobile.js +2 -2
- package/build/features/connect/screens/Mobile/MobileNumber.js +1 -1
- package/build/features/connect/screens/NID/IDNumber.js +1 -1
- package/build/features/connect/screens/NID/NID.js +2 -2
- package/build/features/connect/screens/OTP/OTPInput.js +3 -13
- package/build/features/featuresScreens.js +5 -0
- package/build/features/individual/Individual.js +3 -4
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +7 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.d.ts +10 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +89 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +3 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +1 -0
- package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +16 -4
- package/build/features/password/Password.js +11 -6
- package/build/features/password/screens/CreatePassword/CreatePassword.js +9 -2
- package/build/features/password/screens/OTP/OTP.d.ts +8 -0
- package/build/features/password/screens/OTP/OTP.js +78 -0
- package/build/features/password/screens/OTP/OTPInput.d.ts +5 -0
- package/build/features/password/screens/OTP/OTPInput.js +46 -0
- package/build/features/password/screens/OTP/index.d.ts +3 -0
- package/build/features/password/screens/OTP/index.js +2 -0
- package/build/features/password/screens/OTP/validation.d.ts +8 -0
- package/build/features/password/screens/OTP/validation.js +4 -0
- package/build/features/password/screens/Success/Success.js +8 -2
- package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +17 -5
- package/build/features/password/screens/Verify/OTPInput.d.ts +2 -2
- package/build/features/password/screens/Verify/OTPInput.js +1 -1
- package/build/features/shared/Button/FlowsButtons.d.ts +8 -2
- package/build/features/shared/Button/FlowsButtons.js +92 -5
- package/build/features/shared/Button/SuccessButton.js +17 -13
- package/build/features/tax/Tax.js +3 -4
- package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +16 -4
- package/build/hooks/useAppTheme.js +3 -2
- package/build/index.css +4 -0
- package/build/theme/theme.d.ts +1 -1
- package/build/theme/theme.js +1 -2
- package/build/utils/string.d.ts +1 -0
- package/build/utils/string.js +4 -0
- package/package.json +1 -1
|
@@ -19,9 +19,9 @@ import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
|
19
19
|
import Collapse from '../../components/Collapse';
|
|
20
20
|
import { FeatureContainer } from '../shared/Containers';
|
|
21
21
|
import { getParameterByName, reactElement } from '../../utils';
|
|
22
|
-
import { PASSWORD_SCREENS_NAVIGATION } from '../../constants';
|
|
22
|
+
import { PASSWORD_OPERATION_TYPE, PASSWORD_SCREENS_NAVIGATION } from '../../constants';
|
|
23
23
|
import { passwordFeatureScreens } from '../featuresScreens';
|
|
24
|
-
import { passwordSelector, verifyLeadToken } from '../app/password/passwordStore';
|
|
24
|
+
import { passwordSelector, verifyLeadToken, verifyOperationToken } from '../app/password/passwordStore';
|
|
25
25
|
import CustomFooter from '../shared/Footer';
|
|
26
26
|
import Background from '../shared/Background';
|
|
27
27
|
var Password = memo(function (props) {
|
|
@@ -36,18 +36,23 @@ var Password = memo(function (props) {
|
|
|
36
36
|
var verifyToken = function () {
|
|
37
37
|
var token = getParameterByName('token');
|
|
38
38
|
var lang = getParameterByName('lang');
|
|
39
|
+
var operationType = getParameterByName('operation_type');
|
|
40
|
+
var leadId = getParameterByName('lead_id') || '';
|
|
41
|
+
if (lang)
|
|
42
|
+
dispatch(handleLanguage(lang));
|
|
39
43
|
if (!token)
|
|
40
44
|
throw new Error('Auth token is not found!');
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
if (operationType === PASSWORD_OPERATION_TYPE.RESET_PASSWORD) {
|
|
46
|
+
dispatch(verifyOperationToken({ token: token, leadId: leadId }));
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
44
49
|
dispatch(verifyLeadToken(token));
|
|
45
50
|
};
|
|
46
51
|
useEffect(function () {
|
|
47
52
|
if (!settingLoading)
|
|
48
53
|
verifyToken();
|
|
49
54
|
}, [settingLoading]);
|
|
50
|
-
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, {}) }, { children: _jsx(FeatureContainer, { children: passwordFeatureScreens.map(function (_a, index) {
|
|
55
|
+
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) {
|
|
51
56
|
var Element = _a.element, name = _a.name;
|
|
52
57
|
var isActive = activeScreen.name === name;
|
|
53
58
|
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
@@ -17,14 +17,15 @@ import { yupResolver } from '@hookform/resolvers/yup';
|
|
|
17
17
|
import Box from '@mui/material/Box';
|
|
18
18
|
import { styled } from '@mui/material/styles';
|
|
19
19
|
import { useAppDispatch } from '../../../../hooks';
|
|
20
|
-
import { handleCurrentActiveScreen } from '../../../../app/settings';
|
|
20
|
+
import { handleCurrentActiveScreen, handleNextScreenStep } from '../../../../app/settings';
|
|
21
21
|
import Form from '../../../../components/Form';
|
|
22
22
|
import { useLanguage } from '../../../../hooks';
|
|
23
|
+
import { PASSWORD_OPERATION_TYPE } from '../../../../constants';
|
|
23
24
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
24
25
|
import Button from '../../../shared/Button';
|
|
25
26
|
import { PasswordValidation } from './validation';
|
|
26
27
|
import Password from './Password';
|
|
27
|
-
import { createPassword, passwordSelector } from '../../../app/password/passwordStore';
|
|
28
|
+
import { createPassword, passwordSelector, storePasswordScreen } from '../../../app/password/passwordStore';
|
|
28
29
|
import { useSelector } from 'react-redux';
|
|
29
30
|
var InputsContainerStyled = styled(Box)(function (_a) {
|
|
30
31
|
var theme = _a.theme;
|
|
@@ -37,12 +38,18 @@ var CreatePassword = function (_a) {
|
|
|
37
38
|
var isAr = useLanguage().isAr;
|
|
38
39
|
var dispatch = useAppDispatch();
|
|
39
40
|
var _b = useSelector(passwordSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
41
|
+
var operationType = data.verify.operationType;
|
|
40
42
|
var methods = useForm({
|
|
41
43
|
resolver: yupResolver(PasswordValidation),
|
|
42
44
|
defaultValues: data.passwordData,
|
|
43
45
|
mode: 'onChange'
|
|
44
46
|
});
|
|
45
47
|
var onSubmit = function (data) {
|
|
48
|
+
if (operationType === PASSWORD_OPERATION_TYPE.RESET_PASSWORD) {
|
|
49
|
+
dispatch(storePasswordScreen(data));
|
|
50
|
+
dispatch(handleNextScreenStep('PASSWORD_RESET_PASSWORD_OTP_STEP'));
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
46
53
|
dispatch(createPassword(data));
|
|
47
54
|
};
|
|
48
55
|
var onBack = function () {
|
|
@@ -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, useAppSelector } 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 } from '../../../../hooks';
|
|
22
|
+
import Form from '../../../../components/Form';
|
|
23
|
+
import Text from '../../../../components/Text';
|
|
24
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
25
|
+
import { passwordSelector, clearError, resetOTPScreen, resetPassword } from '../../../app/password/passwordStore';
|
|
26
|
+
import Button from '../../../shared/Button';
|
|
27
|
+
import { maskPhone } from '../../../../utils';
|
|
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), { 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' }));
|
|
44
|
+
});
|
|
45
|
+
var FormStyled = styled(Form)(function () { return ({
|
|
46
|
+
display: 'flex',
|
|
47
|
+
flexDirection: 'column'
|
|
48
|
+
}); });
|
|
49
|
+
var OTP = function (_a) {
|
|
50
|
+
var _b, _c;
|
|
51
|
+
var _d = useAppSelector(passwordSelector), data = _d.data, loading = _d.loading, error = _d.error;
|
|
52
|
+
var dispatch = useAppDispatch();
|
|
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
|
+
React.useEffect(function () {
|
|
61
|
+
if (error)
|
|
62
|
+
dispatch(clearError());
|
|
63
|
+
return function () {
|
|
64
|
+
dispatch(resetOTPScreen());
|
|
65
|
+
};
|
|
66
|
+
}, [methods.formState.isValid]);
|
|
67
|
+
var onSubmit = function (formData) {
|
|
68
|
+
dispatch(resetPassword(formData));
|
|
69
|
+
};
|
|
70
|
+
var onBack = function () {
|
|
71
|
+
dispatch(handlePrevScreenStep());
|
|
72
|
+
};
|
|
73
|
+
var disabled = !methods.formState.isValid || !!error;
|
|
74
|
+
var phone = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.auth_info) === null || _c === void 0 ? void 0 : _c.phone;
|
|
75
|
+
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(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
76
|
+
};
|
|
77
|
+
OTP.defaultProps = {};
|
|
78
|
+
export default React.memo(OTP);
|
|
@@ -0,0 +1,46 @@
|
|
|
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 { useAppDispatch } from '../../../../hooks';
|
|
21
|
+
import { resendOperationOTP } from '../../../../features/app/password/passwordStore';
|
|
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 otpControl = useController({ name: 'otp', control: control });
|
|
35
|
+
var handleOnOTPChange = function (otp) {
|
|
36
|
+
otpControl.field.onChange(otp);
|
|
37
|
+
};
|
|
38
|
+
var handleOnResendOTP = function () {
|
|
39
|
+
if (otpControl.field.value)
|
|
40
|
+
setValue('otp', '', { shouldValidate: true });
|
|
41
|
+
dispatch(resendOperationOTP());
|
|
42
|
+
};
|
|
43
|
+
var otpValue = otpControl.field.value;
|
|
44
|
+
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()); } }) })));
|
|
45
|
+
};
|
|
46
|
+
export default React.memo(OTPInput);
|
|
@@ -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
|
+
}>>>;
|
|
@@ -2,13 +2,19 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
5
|
-
import { updateLeadSuccess, passwordSelector } from '../../../app/password/passwordStore';
|
|
5
|
+
import { updateLeadSuccess, passwordSelector, retrieveLead } from '../../../app/password/passwordStore';
|
|
6
6
|
import SuccessScreen from '../../../shared/SuccessScreen';
|
|
7
|
+
import { PASSWORD_OPERATION_TYPE } from '../../../../constants';
|
|
7
8
|
var Success = function (_a) {
|
|
8
9
|
var t = useTranslation().t;
|
|
9
10
|
var dispatch = useAppDispatch();
|
|
10
|
-
var _b = useAppSelector(passwordSelector), loading = _b.loading, error = _b.error;
|
|
11
|
+
var _b = useAppSelector(passwordSelector), loading = _b.loading, error = _b.error, data = _b.data;
|
|
12
|
+
var operationType = data.verify.operationType;
|
|
11
13
|
var onSuccess = function () {
|
|
14
|
+
if (operationType === PASSWORD_OPERATION_TYPE.RESET_PASSWORD) {
|
|
15
|
+
dispatch(retrieveLead());
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
12
18
|
dispatch(updateLeadSuccess());
|
|
13
19
|
};
|
|
14
20
|
return (_jsx(SuccessScreen, { title: t('password_success_title'), onSuccess: onSuccess, successTitle: t('continue'), loading: loading, error: error || '' }));
|
|
@@ -14,14 +14,15 @@ import React, { memo, useEffect, useState } from 'react';
|
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { styled } from '@mui/material/styles';
|
|
16
16
|
import { FlowsButtons } from '../../../shared/Button';
|
|
17
|
-
import { ICONS_NAMES } from '../../../../constants';
|
|
17
|
+
import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
|
|
18
18
|
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
19
|
-
import { allAreTruthy, showLastFour } from '../../../../utils';
|
|
19
|
+
import { allAreTruthy, getResetFlowUrl, showLastFour } from '../../../../utils';
|
|
20
20
|
import { passwordSelector } from '../../../app/password/passwordStore';
|
|
21
21
|
import Box from '@mui/material/Box';
|
|
22
22
|
import Text from '../../../../components/Text';
|
|
23
23
|
import Container from '../../../shared/Containers/ScreenContainer';
|
|
24
|
-
import AcceptancePayouts from '
|
|
24
|
+
import AcceptancePayouts from '../../../shared/AcceptancePayouts';
|
|
25
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
25
26
|
var TitleStyled = styled(Text)(function (_a) {
|
|
26
27
|
var _b;
|
|
27
28
|
var theme = _a.theme;
|
|
@@ -57,10 +58,16 @@ var SuccessWithFlowButtons = function () {
|
|
|
57
58
|
var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
|
|
58
59
|
var taxID = (entity === null || entity === void 0 ? void 0 : entity.tax_number) || '';
|
|
59
60
|
var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
|
|
61
|
+
var settings = useAppSelector(settingsSelector);
|
|
62
|
+
var _h = data.verify.responseBody || { contact: {}, id: '' }, contact = _h.contact, id = _h.id;
|
|
63
|
+
var email = (contact || { email: '' }).email;
|
|
64
|
+
var url = getResetFlowUrl('/password', settings.data.language, PASSWORD_OPERATION_TYPE.RESET_PASSWORD, id);
|
|
60
65
|
var reMapFlowData = function (flows) {
|
|
61
66
|
if (flows === void 0) { flows = []; }
|
|
62
67
|
var images = ICONS_NAMES;
|
|
63
|
-
var mappedFlows = flows
|
|
68
|
+
var mappedFlows = flows
|
|
69
|
+
.filter(function (item) { return item.name; })
|
|
70
|
+
.map(function (_a) {
|
|
64
71
|
var name = _a.name, url = _a.url, status = _a.status;
|
|
65
72
|
var type = status === 'initiated' ? 'pending' : 'completed';
|
|
66
73
|
var title = t("".concat(name, "_flow_").concat(type), {
|
|
@@ -79,6 +86,7 @@ var SuccessWithFlowButtons = function () {
|
|
|
79
86
|
var hoverSrc = "".concat(name, "_white_icon");
|
|
80
87
|
return {
|
|
81
88
|
name: name,
|
|
89
|
+
status: status,
|
|
82
90
|
title: title,
|
|
83
91
|
href: url,
|
|
84
92
|
src: images[src],
|
|
@@ -96,6 +104,10 @@ var SuccessWithFlowButtons = function () {
|
|
|
96
104
|
if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
|
|
97
105
|
reMapFlowData(flows);
|
|
98
106
|
}, [flows, isAr]);
|
|
99
|
-
return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons,
|
|
107
|
+
return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons, data: {
|
|
108
|
+
flowName: data.flowName,
|
|
109
|
+
email: email,
|
|
110
|
+
emailUrl: url
|
|
111
|
+
} }) })] }));
|
|
100
112
|
};
|
|
101
113
|
export default memo(SuccessWithFlowButtons);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export interface OTPProps {
|
|
3
3
|
loading: boolean;
|
|
4
|
-
setLoading
|
|
4
|
+
setLoading?: (flag: boolean) => void;
|
|
5
5
|
}
|
|
6
|
-
declare const _default: React.MemoExoticComponent<({ loading
|
|
6
|
+
declare const _default: React.MemoExoticComponent<({ loading }: OTPProps) => JSX.Element>;
|
|
7
7
|
export default _default;
|
|
@@ -28,7 +28,7 @@ var BoxStyled = styled(Box)(function (_a) {
|
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
var OTPInput = function (_a) {
|
|
31
|
-
var loading = _a.loading
|
|
31
|
+
var loading = _a.loading;
|
|
32
32
|
var _b = useFormContext(), control = _b.control, setValue = _b.setValue;
|
|
33
33
|
var t = useTranslation().t;
|
|
34
34
|
var otpControl = useController({ name: 'otp', control: control });
|
|
@@ -4,6 +4,7 @@ import { SxProps, Theme } from '@mui/material/styles';
|
|
|
4
4
|
import { FlowsTypes } from '../../../@types';
|
|
5
5
|
export declare type ButtonItemProps = {
|
|
6
6
|
name: string;
|
|
7
|
+
status: string;
|
|
7
8
|
title: string;
|
|
8
9
|
href: string;
|
|
9
10
|
src: string;
|
|
@@ -11,8 +12,13 @@ export declare type ButtonItemProps = {
|
|
|
11
12
|
isCompleted: boolean;
|
|
12
13
|
sx?: SxProps<Theme> | undefined;
|
|
13
14
|
};
|
|
15
|
+
export interface DataProps {
|
|
16
|
+
flowName: FlowsTypes;
|
|
17
|
+
email: string;
|
|
18
|
+
emailUrl: string;
|
|
19
|
+
}
|
|
14
20
|
export interface EmailProvidersButtonsProps extends ButtonProps {
|
|
15
21
|
buttons: ButtonItemProps[];
|
|
16
|
-
|
|
22
|
+
data: DataProps;
|
|
17
23
|
}
|
|
18
|
-
export default function FlowsButtons({ buttons,
|
|
24
|
+
export default function FlowsButtons({ buttons, data }: EmailProvidersButtonsProps): JSX.Element;
|
|
@@ -9,7 +9,44 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (_) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
49
|
+
import { useState } from 'react';
|
|
13
50
|
import Button from '../../../components/Button';
|
|
14
51
|
import { alpha, styled } from '@mui/material/styles';
|
|
15
52
|
import Box from '@mui/material/Box';
|
|
@@ -19,6 +56,7 @@ import CheckIcon from '@mui/icons-material/Check';
|
|
|
19
56
|
import { useAppDispatch, useLanguage } from '../../../hooks';
|
|
20
57
|
import { handleOpen, handleCurrentActiveScreen } from '../../../app/settings';
|
|
21
58
|
import { getScreenNameBasedOnFlow } from '../../../utils';
|
|
59
|
+
import API from '../../../api';
|
|
22
60
|
var Image = styled('img')(function (_a) {
|
|
23
61
|
var theme = _a.theme;
|
|
24
62
|
return ({
|
|
@@ -85,8 +123,11 @@ var CheckIconStyled = styled(CheckIcon)(function (_a) {
|
|
|
85
123
|
});
|
|
86
124
|
});
|
|
87
125
|
export default function FlowsButtons(_a) {
|
|
88
|
-
var
|
|
126
|
+
var _this = this;
|
|
127
|
+
var buttons = _a.buttons, data = _a.data;
|
|
89
128
|
var dispatch = useAppDispatch();
|
|
129
|
+
var flowName = data.flowName, email = data.email, emailUrl = data.emailUrl;
|
|
130
|
+
var _b = useState(false), loading = _b[0], setLoading = _b[1];
|
|
90
131
|
var isAr = useLanguage().isAr;
|
|
91
132
|
var onRedirect = function (item) {
|
|
92
133
|
if (item.isCompleted)
|
|
@@ -100,11 +141,57 @@ export default function FlowsButtons(_a) {
|
|
|
100
141
|
window.location.href = item.href;
|
|
101
142
|
}, 500);
|
|
102
143
|
};
|
|
144
|
+
var isResetPassword = function (name, status) {
|
|
145
|
+
return name === 'password' && status === 'completed';
|
|
146
|
+
};
|
|
147
|
+
var onResetPassword = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
148
|
+
var payload;
|
|
149
|
+
return __generator(this, function (_a) {
|
|
150
|
+
switch (_a.label) {
|
|
151
|
+
case 0:
|
|
152
|
+
setLoading(true);
|
|
153
|
+
payload = {
|
|
154
|
+
user_credentail: {
|
|
155
|
+
email: email
|
|
156
|
+
},
|
|
157
|
+
auth_type: 7,
|
|
158
|
+
email_url: emailUrl,
|
|
159
|
+
step_name: 'reset_password_auth',
|
|
160
|
+
encryption_contract: ['user_credentail.email']
|
|
161
|
+
};
|
|
162
|
+
return [4, API.authService
|
|
163
|
+
.createAuth(payload)
|
|
164
|
+
.then(function (response) {
|
|
165
|
+
var _a;
|
|
166
|
+
setLoading(false);
|
|
167
|
+
var data = response.data;
|
|
168
|
+
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
169
|
+
if (description) {
|
|
170
|
+
alert(description);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
})
|
|
174
|
+
.catch(function (error) {
|
|
175
|
+
alert(error);
|
|
176
|
+
setLoading(false);
|
|
177
|
+
})
|
|
178
|
+
.finally(function () {
|
|
179
|
+
setLoading(false);
|
|
180
|
+
})];
|
|
181
|
+
case 1:
|
|
182
|
+
_a.sent();
|
|
183
|
+
return [2];
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}); };
|
|
103
187
|
return (_jsx(ButtonBoxStyled, { children: buttons.map(function (_a, idx) {
|
|
104
|
-
var title = _a.title, href = _a.href, src = _a.src, hoverSrc = _a.hoverSrc, isCompleted = _a.isCompleted, sx = _a.sx, name = _a.name;
|
|
188
|
+
var title = _a.title, href = _a.href, src = _a.src, hoverSrc = _a.hoverSrc, isCompleted = _a.isCompleted, sx = _a.sx, name = _a.name, status = _a.status;
|
|
105
189
|
var isLast = idx === buttons.length - 1;
|
|
106
190
|
return (_jsx(Link, __assign({ underline: 'none', onClick: function () {
|
|
107
|
-
|
|
108
|
-
|
|
191
|
+
if (isResetPassword(name, status))
|
|
192
|
+
onResetPassword();
|
|
193
|
+
else
|
|
194
|
+
onRedirect({ title: title, href: href, src: src, hoverSrc: hoverSrc, isCompleted: isCompleted, name: name, status: status });
|
|
195
|
+
} }, { children: _jsx(ButtonStyled, __assign({ variant: 'outlined', disabled: isResetPassword(name, status) && loading, isCompleted: isCompleted, sx: __assign({ mb: isLast ? 2.5 : 1.8 }, sx), endIcon: isResetPassword(name, status) && loading ? (_jsx(_Fragment, {})) : isCompleted ? (_jsx(CheckIconStyled, {})) : (_jsx(Image, { sx: { height: 15, transform: isAr ? 'scale(-1)' : 'scale(1)' }, src: ICONS_NAMES.Arrow_filled_right_icon })), startIcon: isResetPassword(name, status) && loading ? _jsx(_Fragment, {}) : _jsx(Image, { src: src, alt: title }), type: 'button' }, { children: title })) }), idx));
|
|
109
196
|
}) }));
|
|
110
197
|
}
|
|
@@ -25,25 +25,29 @@ import React from 'react';
|
|
|
25
25
|
import Button from './Button';
|
|
26
26
|
import { styled } from '@mui/material/styles';
|
|
27
27
|
import Box from '@mui/material/Box';
|
|
28
|
-
var ButtonStyled = styled(Button
|
|
29
|
-
|
|
30
|
-
})(function (_a) {
|
|
31
|
-
var theme = _a.theme, isLoading = _a.isLoading;
|
|
28
|
+
var ButtonStyled = styled(Button)(function (_a) {
|
|
29
|
+
var theme = _a.theme;
|
|
32
30
|
return ({
|
|
33
|
-
'&.MuiButton-outlined':
|
|
31
|
+
'&.MuiButton-outlined': {
|
|
32
|
+
width: '100%',
|
|
33
|
+
textTransform: 'none',
|
|
34
|
+
paddingInlineStart: theme.spacing(0.75),
|
|
35
|
+
backgroundColor: theme.palette.common.white,
|
|
36
|
+
color: theme.palette.primary.main,
|
|
37
|
+
border: "1px solid ".concat(theme.palette.primary.main),
|
|
38
|
+
'&:hover': {
|
|
34
39
|
backgroundColor: theme.palette.common.white,
|
|
35
40
|
color: theme.palette.primary.main
|
|
36
|
-
},
|
|
41
|
+
},
|
|
42
|
+
'&:disabled': {
|
|
37
43
|
backgroundColor: theme.palette.primary.main,
|
|
38
44
|
color: theme.palette.common.white
|
|
39
|
-
},
|
|
45
|
+
},
|
|
46
|
+
transition: theme.transitions.create(['width', 'padding'], {
|
|
40
47
|
easing: theme.transitions.easing.easeInOut,
|
|
41
48
|
duration: theme.transitions.duration.complex * 2
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
width: theme.spacing(6),
|
|
45
|
-
borderRadius: 30
|
|
46
|
-
}))
|
|
49
|
+
})
|
|
50
|
+
}
|
|
47
51
|
});
|
|
48
52
|
});
|
|
49
53
|
var ButtonBoxStyled = styled(Box)(function (_a) {
|
|
@@ -64,5 +68,5 @@ export default function SuccessButton(_a) {
|
|
|
64
68
|
React.useEffect(function () {
|
|
65
69
|
setBtnLoading(false);
|
|
66
70
|
}, []);
|
|
67
|
-
return (_jsx(ButtonBoxStyled, { children: _jsx(ButtonStyled, __assign({ isAr: isAr,
|
|
71
|
+
return (_jsx(ButtonBoxStyled, { children: _jsx(ButtonStyled, __assign({ isAr: isAr, loading: btnLoading, disabled: disabled, type: 'button', variant: btnLoading ? 'contained' : 'outlined' }, props, { children: children })) }));
|
|
68
72
|
}
|
|
@@ -36,18 +36,17 @@ var Tax = memo(function (props) {
|
|
|
36
36
|
var verifyToken = function () {
|
|
37
37
|
var token = getParameterByName('token');
|
|
38
38
|
var lang = getParameterByName('lang');
|
|
39
|
+
if (lang)
|
|
40
|
+
dispatch(handleLanguage(lang));
|
|
39
41
|
if (!token)
|
|
40
42
|
throw new Error('Auth token is not found!');
|
|
41
|
-
if (!lang)
|
|
42
|
-
throw new Error('Language is not found!');
|
|
43
|
-
dispatch(handleLanguage(lang));
|
|
44
43
|
dispatch(verifyLeadToken(token));
|
|
45
44
|
};
|
|
46
45
|
useEffect(function () {
|
|
47
46
|
if (!loading)
|
|
48
47
|
verifyToken();
|
|
49
48
|
}, [loading]);
|
|
50
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: loading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, open: open, error: error, loading: loading || customLoading, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: taxFeatureScreens.map(function (_a, index) {
|
|
49
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: loading || customLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, open: open, error: error, loading: loading || customLoading, breakpoint: 'sm', footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: taxFeatureScreens.map(function (_a, index) {
|
|
51
50
|
var Element = _a.element, name = _a.name;
|
|
52
51
|
var isActive = activeScreen.name === name;
|
|
53
52
|
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
@@ -14,14 +14,15 @@ import React, { memo, useEffect, useState } from 'react';
|
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { styled } from '@mui/material/styles';
|
|
16
16
|
import { FlowsButtons } from '../../../shared/Button';
|
|
17
|
-
import { ICONS_NAMES } from '../../../../constants';
|
|
17
|
+
import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
|
|
18
18
|
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
19
|
-
import { allAreTruthy, showLastFour } from '../../../../utils';
|
|
19
|
+
import { allAreTruthy, getResetFlowUrl, showLastFour } from '../../../../utils';
|
|
20
20
|
import { taxSelector } from '../../../app/tax/taxStore';
|
|
21
21
|
import Box from '@mui/material/Box';
|
|
22
22
|
import Text from '../../../../components/Text';
|
|
23
23
|
import Container from '../../../shared/Containers/ScreenContainer';
|
|
24
24
|
import AcceptancePayouts from '../../../shared/AcceptancePayouts';
|
|
25
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
25
26
|
var TitleStyled = styled(Text)(function (_a) {
|
|
26
27
|
var _b;
|
|
27
28
|
var theme = _a.theme;
|
|
@@ -57,10 +58,16 @@ var SuccessWithFlowButtons = function () {
|
|
|
57
58
|
var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
|
|
58
59
|
var taxID = (entity === null || entity === void 0 ? void 0 : entity.tax_number) || '';
|
|
59
60
|
var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
|
|
61
|
+
var settings = useAppSelector(settingsSelector);
|
|
62
|
+
var _h = data.verify.responseBody || { contact: {}, id: '' }, contact = _h.contact, id = _h.id;
|
|
63
|
+
var email = (contact || { email: '' }).email;
|
|
64
|
+
var url = getResetFlowUrl('/password', settings.data.language, PASSWORD_OPERATION_TYPE.RESET_PASSWORD, id);
|
|
60
65
|
var reMapFlowData = function (flows) {
|
|
61
66
|
if (flows === void 0) { flows = []; }
|
|
62
67
|
var images = ICONS_NAMES;
|
|
63
|
-
var mappedFlows = flows
|
|
68
|
+
var mappedFlows = flows
|
|
69
|
+
.filter(function (item) { return item.name; })
|
|
70
|
+
.map(function (_a) {
|
|
64
71
|
var name = _a.name, url = _a.url, status = _a.status;
|
|
65
72
|
var type = status === 'initiated' ? 'pending' : 'completed';
|
|
66
73
|
var title = t("".concat(name, "_flow_").concat(type), {
|
|
@@ -79,6 +86,7 @@ var SuccessWithFlowButtons = function () {
|
|
|
79
86
|
var hoverSrc = "".concat(name, "_white_icon");
|
|
80
87
|
return {
|
|
81
88
|
name: name,
|
|
89
|
+
status: status,
|
|
82
90
|
title: title,
|
|
83
91
|
href: url,
|
|
84
92
|
src: images[src],
|
|
@@ -96,6 +104,10 @@ var SuccessWithFlowButtons = function () {
|
|
|
96
104
|
if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
|
|
97
105
|
reMapFlowData(flows);
|
|
98
106
|
}, [flows, isAr]);
|
|
99
|
-
return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons,
|
|
107
|
+
return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons, data: {
|
|
108
|
+
flowName: data.flowName,
|
|
109
|
+
email: email,
|
|
110
|
+
emailUrl: url
|
|
111
|
+
} }) })] }));
|
|
100
112
|
};
|
|
101
113
|
export default memo(SuccessWithFlowButtons);
|