@tap-payments/auth-jsconnect 2.0.3 → 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 +127 -127
|
@@ -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 { bankSelector } from '../../../app/bank/bankStore';
|
|
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);
|
|
@@ -36,18 +36,17 @@ var Business = 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 (!settingLoading)
|
|
48
47
|
verifyToken();
|
|
49
48
|
}, [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: businessFeatureScreens.map(function (_a, index) {
|
|
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: businessFeatureScreens.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));
|
|
@@ -72,6 +72,6 @@ var Activities = function () {
|
|
|
72
72
|
anchorEl ? setAnchorEl(false) : setAnchorEl(true);
|
|
73
73
|
};
|
|
74
74
|
var disabled = !methods.formState.isValid || !!error;
|
|
75
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Collapse, __assign({ in: !collapse }, { children: [_jsx(ActivitiesList, { onListOpen: function () { return handleMenuClick(); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(SalesChannels, {}) }))] })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(OperationStartDate, { onDateClicked: handleCollapseOpenClose }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
75
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Collapse, __assign({ in: !collapse }, { children: [_jsx(ActivitiesList, { onListOpen: function () { return handleMenuClick(); }, onListClose: function () { return handleMenuClick(); } }), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(SalesChannels, {}) }))] })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(OperationStartDate, { onDateClicked: handleCollapseOpenClose }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
76
76
|
};
|
|
77
77
|
export default Activities;
|
|
@@ -44,7 +44,7 @@ var IDBOD = function (_a) {
|
|
|
44
44
|
dispatch(clearError());
|
|
45
45
|
}, [methods.formState.isValid]);
|
|
46
46
|
var onSubmit = function (data) {
|
|
47
|
-
dispatch(updateLeadIdentity(
|
|
47
|
+
dispatch(updateLeadIdentity(data));
|
|
48
48
|
};
|
|
49
49
|
var handleCollapseOpenClose = function (flag) {
|
|
50
50
|
setCollapse(flag);
|
|
@@ -17,8 +17,8 @@ import Box from '@mui/material/Box/Box';
|
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
18
|
import OTPField from '../../../shared/OTP';
|
|
19
19
|
import { DEFAULT_TIMER_VALUE } from '../../../../constants';
|
|
20
|
-
import {
|
|
21
|
-
import { useAppDispatch
|
|
20
|
+
import { resendOTPLeadIdentity } from '../../../app/business/businessStore';
|
|
21
|
+
import { useAppDispatch } from '../../../../hooks';
|
|
22
22
|
var BoxStyled = styled(Box)(function (_a) {
|
|
23
23
|
var theme = _a.theme;
|
|
24
24
|
return ({
|
|
@@ -32,19 +32,13 @@ var OTPInput = function (_a) {
|
|
|
32
32
|
var t = useTranslation().t;
|
|
33
33
|
var dispatch = useAppDispatch();
|
|
34
34
|
var otpControl = useController({ name: 'otp', control: control });
|
|
35
|
-
var data = useAppSelector(businessSelector).data;
|
|
36
|
-
var nidData = data.nidData;
|
|
37
35
|
var handleOnOTPChange = function (otp) {
|
|
38
36
|
otpControl.field.onChange(otp);
|
|
39
37
|
};
|
|
40
38
|
var handleOnResendOTP = function () {
|
|
41
39
|
if (otpControl.field.value)
|
|
42
40
|
setValue('otp', '', { shouldValidate: true });
|
|
43
|
-
|
|
44
|
-
nid: nidData.nid,
|
|
45
|
-
dob: nidData.dob
|
|
46
|
-
};
|
|
47
|
-
dispatch(updateLeadIdentity(__assign(__assign({}, params), { isResend: true })));
|
|
41
|
+
dispatch(resendOTPLeadIdentity());
|
|
48
42
|
};
|
|
49
43
|
var otpValue = otpControl.field.value;
|
|
50
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()); } }) })));
|
|
@@ -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';
|
|
18
|
-
import {
|
|
17
|
+
import { ICONS_NAMES, PASSWORD_OPERATION_TYPE } from '../../../../constants';
|
|
18
|
+
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
19
19
|
import { businessSelector } from '../../../app/business/businessStore';
|
|
20
|
-
import { allAreTruthy, showLastFour } from '../../../../utils';
|
|
20
|
+
import { allAreTruthy, getResetFlowUrl, showLastFour } from '../../../../utils';
|
|
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;
|
|
@@ -46,7 +47,6 @@ var SuccessWithFlowButtons = function () {
|
|
|
46
47
|
var _a, _b, _c;
|
|
47
48
|
var t = useTranslation().t;
|
|
48
49
|
var isAr = useLanguage().isAr;
|
|
49
|
-
var dispatch = useAppDispatch();
|
|
50
50
|
var _d = React.useState(false), isAcceptance = _d[0], setIsAcceptance = _d[1];
|
|
51
51
|
var _e = React.useState(false), isPayout = _e[0], setIsPayout = _e[1];
|
|
52
52
|
var data = useAppSelector(businessSelector).data;
|
|
@@ -58,10 +58,16 @@ var SuccessWithFlowButtons = function () {
|
|
|
58
58
|
var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
|
|
59
59
|
var taxID = (entity === null || entity === void 0 ? void 0 : entity.tax_number) || '';
|
|
60
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);
|
|
61
65
|
var reMapFlowData = function (flows) {
|
|
62
66
|
if (flows === void 0) { flows = []; }
|
|
63
67
|
var images = ICONS_NAMES;
|
|
64
|
-
var mappedFlows = flows
|
|
68
|
+
var mappedFlows = flows
|
|
69
|
+
.filter(function (item) { return item.name; })
|
|
70
|
+
.map(function (_a) {
|
|
65
71
|
var name = _a.name, url = _a.url, status = _a.status;
|
|
66
72
|
var type = status === 'initiated' ? 'pending' : 'completed';
|
|
67
73
|
var title = t("".concat(name, "_flow_").concat(type), {
|
|
@@ -80,6 +86,7 @@ var SuccessWithFlowButtons = function () {
|
|
|
80
86
|
var hoverSrc = "".concat(name, "_white_icon");
|
|
81
87
|
return {
|
|
82
88
|
name: name,
|
|
89
|
+
status: status,
|
|
83
90
|
title: title,
|
|
84
91
|
href: url,
|
|
85
92
|
src: images[src],
|
|
@@ -97,6 +104,10 @@ var SuccessWithFlowButtons = function () {
|
|
|
97
104
|
if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
|
|
98
105
|
reMapFlowData(flows);
|
|
99
106
|
}, [flows, isAr]);
|
|
100
|
-
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
|
+
} }) })] }));
|
|
101
112
|
};
|
|
102
113
|
export default memo(SuccessWithFlowButtons);
|
|
@@ -32,7 +32,7 @@ var Connect = memo(function (props) {
|
|
|
32
32
|
useErrorListener(connectError || error);
|
|
33
33
|
useStepStartedListener();
|
|
34
34
|
var activeScreen = data.activeScreen, isTapOrigin = data.isTapOrigin, open = data.open;
|
|
35
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading, error: error, open: open, footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: connectFeatureScreens.map(function (_a, index) {
|
|
35
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading }, { children: _jsx(AnimationFlow, __assign({ isTapOrigin: isTapOrigin, loading: settingLoading, error: error, open: open, footer: _jsx(CustomFooter, {}), screenId: activeScreen.name }, { children: _jsx(FeatureContainer, { children: connectFeatureScreens.map(function (_a, index) {
|
|
36
36
|
var Element = _a.element, name = _a.name;
|
|
37
37
|
var isActive = activeScreen.name === name;
|
|
38
38
|
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
@@ -96,7 +96,7 @@ var Mobile = function (_a) {
|
|
|
96
96
|
dispatch(clearError());
|
|
97
97
|
}, [methods.formState.isValid]);
|
|
98
98
|
var onSubmit = function (formData) {
|
|
99
|
-
dispatch(createMobileAuth(
|
|
99
|
+
dispatch(createMobileAuth(formData));
|
|
100
100
|
};
|
|
101
101
|
var onBack = function () {
|
|
102
102
|
dispatch(handlePrevScreenStep());
|
|
@@ -107,6 +107,6 @@ var Mobile = function (_a) {
|
|
|
107
107
|
var disabled = !methods.formState.isValid || !!error;
|
|
108
108
|
var title = t('join_our_community');
|
|
109
109
|
var subTitle = t('ide_terms_and_conditions_description');
|
|
110
|
-
return (_jsxs(ScreenContainer, { children: [(title || subTitle) && _jsx(MIDTitle, { show: !listActive, title: title, description: subTitle }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { show: !isBusinessListActive, countries: settingsStore.data.countries, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } }) }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(AbsherButton, __assign({ disabled: settingsStore.loading || loading, onClick: function () { return onBack(); } }, { children: t('absher_button_label') }))] }))] })) }))] }));
|
|
110
|
+
return (_jsxs(ScreenContainer, { children: [(title || subTitle) && _jsx(MIDTitle, { show: !listActive, title: title, description: subTitle }), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(InputsContainerStyled, { children: _jsx(MobileNumber, { show: !isBusinessListActive, countries: settingsStore.data.countries, onListOpen: function () { return handleMenuListClick(ListType.CountryCodeList); }, onListClose: function () { return handleMenuListClick(); } }) }), _jsxs(Collapse, __assign({ in: !listActive }, { children: [_jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, loading: loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: !methods.watch('mobile') }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(AbsherButton, __assign({ disabled: settingsStore.loading || loading, onClick: function () { return onBack(); } }, { children: t('absher_button_label') }))] }))] }))] })) }))] }));
|
|
111
111
|
};
|
|
112
112
|
export default React.memo(Mobile);
|
|
@@ -147,7 +147,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
|
|
|
147
147
|
});
|
|
148
148
|
setCountries(filteredCountries);
|
|
149
149
|
};
|
|
150
|
-
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredLen }, type: 'tel', readOnly: !!anchorEl, required: true, onClick: onCloseCountryList, onChange: onPhoneNumberChange, onEnterPressed: function (e) { return loading && e.preventDefault(); }, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: !anchorEl ? error && t(error, { length: requiredLen, number: '05|5' }) : undefined }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
150
|
+
return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { minHeight: mobileValue ? '133px' : '0px' } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredLen }, type: 'tel', readOnly: !!anchorEl, required: true, onClick: onCloseCountryList, onChange: onPhoneNumberChange, onEnterPressed: function (e) { return loading && e.preventDefault(); }, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: !anchorEl ? error && t(error, { length: requiredLen, number: '05|5' }) : undefined }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
151
151
|
return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsxs(CountryCodeText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: ["+", item.idd_prefix] })), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) && _jsx(CheckIcon, {})] }));
|
|
152
152
|
} })] }))] })) })));
|
|
153
153
|
});
|
|
@@ -55,6 +55,6 @@ var IDNumber = React.forwardRef(function (_a, ref) {
|
|
|
55
55
|
};
|
|
56
56
|
var nidValue = nidControl.field.value;
|
|
57
57
|
var error = (_b = nidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
58
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { dir: 'ltr', type: 'tel', inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: !error && nidValue ? _jsx(CheckIcon, {}) : nidValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: '
|
|
58
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { dir: 'ltr', type: 'tel', inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: !error && nidValue ? _jsx(CheckIcon, {}) : nidValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
|
|
59
59
|
});
|
|
60
60
|
export default React.memo(IDNumber);
|
|
@@ -72,7 +72,7 @@ var NID = function (_a) {
|
|
|
72
72
|
handleClearError();
|
|
73
73
|
}, [methods.formState.isValid]);
|
|
74
74
|
var onSubmit = function (data) {
|
|
75
|
-
dispatch(createNIDAuth(
|
|
75
|
+
dispatch(createNIDAuth(data));
|
|
76
76
|
};
|
|
77
77
|
var handleCollapseOpenClose = function (flag) {
|
|
78
78
|
setCollapse(flag);
|
|
@@ -85,6 +85,6 @@ var NID = function (_a) {
|
|
|
85
85
|
dispatch(handlePrevScreenStep('CONNECT_MOBILE_STEP'));
|
|
86
86
|
};
|
|
87
87
|
var disabled = !methods.formState.isValid || !!error;
|
|
88
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(IDNumber, { show: !collapse }) })), _jsx(DOB, { onDateClicked: handleCollapseOpenClose }), _jsxs(Collapse, __assign({ in: !collapse }, { children: [_jsx(Button, __assign({ loading: loading, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, error: t(error || '') }, { children: t('next') })), _jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(MobileButton, __assign({ onClick: function () { return onBack(); }, disabled: loading || settingsStore.loading }, { children: t('mobile_button_label') }))] }))] })) })) }));
|
|
88
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(IDNumber, { show: !collapse }) })), _jsx(DOB, { onDateClicked: handleCollapseOpenClose }), _jsxs(Collapse, __assign({ in: !collapse }, { children: [_jsx(Button, __assign({ loading: loading, isAr: isAr, disableBack: true, disabled: disabled || settingsStore.loading, error: t(error || '') }, { children: t('next') })), _jsxs(Collapse, __assign({ in: !methods.watch('nid') }, { children: [_jsxs(OrBoxStyled, { children: [_jsx(DividerStyled, {}), _jsx(TextStyled, { children: t('or') }), _jsx(DividerStyled, {})] }), _jsx(MobileButton, __assign({ onClick: function () { return onBack(); }, disabled: loading || settingsStore.loading }, { children: t('mobile_button_label') }))] }))] }))] })) })) }));
|
|
89
89
|
};
|
|
90
90
|
export default React.memo(NID);
|
|
@@ -17,7 +17,7 @@ import Box from '@mui/material/Box/Box';
|
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
18
|
import OTPField from '../../../shared/OTP';
|
|
19
19
|
import { DEFAULT_TIMER_VALUE } from '../../../../constants';
|
|
20
|
-
import { connectSelector,
|
|
20
|
+
import { connectSelector, resendOTPMobile, resendOTPNID } from '../../../app/connect/connectStore';
|
|
21
21
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
22
22
|
var BoxStyled = styled(Box)(function (_a) {
|
|
23
23
|
var theme = _a.theme;
|
|
@@ -33,8 +33,6 @@ var OTPInput = function (_a) {
|
|
|
33
33
|
var dispatch = useAppDispatch();
|
|
34
34
|
var otpControl = useController({ name: 'otp', control: control });
|
|
35
35
|
var data = useAppSelector(connectSelector).data;
|
|
36
|
-
var mobileData = data.mobileData;
|
|
37
|
-
var nidData = data.nidData;
|
|
38
36
|
var isAbsher = data.otpData.isAbsher;
|
|
39
37
|
var handleOnOTPChange = function (otp) {
|
|
40
38
|
otpControl.field.onChange(otp);
|
|
@@ -42,20 +40,12 @@ var OTPInput = function (_a) {
|
|
|
42
40
|
var handleOnResendOTP = function () {
|
|
43
41
|
if (otpControl.field.value)
|
|
44
42
|
setValue('otp', '', { shouldValidate: true });
|
|
45
|
-
|
|
46
|
-
countryCode: mobileData.countryCode,
|
|
47
|
-
mobile: mobileData.mobile
|
|
48
|
-
};
|
|
49
|
-
dispatch(createMobileAuth(__assign(__assign({}, params), { isResend: true })));
|
|
43
|
+
dispatch(resendOTPMobile());
|
|
50
44
|
};
|
|
51
45
|
var handleOnResendAbsherOTP = function () {
|
|
52
46
|
if (otpControl.field.value)
|
|
53
47
|
setValue('otp', '', { shouldValidate: true });
|
|
54
|
-
|
|
55
|
-
nid: nidData.nid,
|
|
56
|
-
dob: nidData.dob
|
|
57
|
-
};
|
|
58
|
-
dispatch(createNIDAuth(__assign(__assign({}, params), { isResend: true })));
|
|
48
|
+
dispatch(resendOTPNID());
|
|
59
49
|
};
|
|
60
50
|
var otpValue = otpControl.field.value;
|
|
61
51
|
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: isAbsher ? handleOnResendAbsherOTP : handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
@@ -14,6 +14,7 @@ import SuccessPage from './business/screens/Success';
|
|
|
14
14
|
import SuccessWithFlowButtonsPage from './business/screens/SuccessWithFlowButtons';
|
|
15
15
|
import PasswordVerifyPage from './password/screens/Verify';
|
|
16
16
|
import CreatePasswordPage from './password/screens/CreatePassword';
|
|
17
|
+
import PasswordOTPPage from './password/screens/OTP';
|
|
17
18
|
import SuccessPasswordPage from './password/screens/Success';
|
|
18
19
|
import PasswordSuccessWithFlowPage from './password/screens/SuccessWithFlowButtons';
|
|
19
20
|
import IndividualVerifyPage from './individual/screens/Verify';
|
|
@@ -91,6 +92,10 @@ export var passwordFeatureScreens = [
|
|
|
91
92
|
name: 'PASSWORD_CREATE_PASSWORD_STEP',
|
|
92
93
|
element: CreatePasswordPage
|
|
93
94
|
},
|
|
95
|
+
{
|
|
96
|
+
name: 'PASSWORD_RESET_PASSWORD_OTP_STEP',
|
|
97
|
+
element: PasswordOTPPage
|
|
98
|
+
},
|
|
94
99
|
{
|
|
95
100
|
name: 'PASSWORD_SUCCESS_STEP',
|
|
96
101
|
element: SuccessPasswordPage
|
|
@@ -36,18 +36,17 @@ var Individual = 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 (!settingLoading)
|
|
48
47
|
verifyToken();
|
|
49
48
|
}, [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: individualFeatureScreens.map(function (_a, index) {
|
|
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) {
|
|
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));
|
package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js
CHANGED
|
@@ -30,11 +30,13 @@ import EmployerName from './EmployerName';
|
|
|
30
30
|
import EmployerLocation from './EmployerLocation';
|
|
31
31
|
import SourceOfIncome from './SourceOfIncome';
|
|
32
32
|
import { individualSelector, updateIndividualInfo } from '../../../app/individual/individualStore';
|
|
33
|
+
import Occupation from './Occupation';
|
|
33
34
|
var ListType;
|
|
34
35
|
(function (ListType) {
|
|
35
36
|
ListType["SourceOfIncomeList"] = "SourceOfIncomeList";
|
|
36
37
|
ListType["EmployerLocationList"] = "EmployerLocationList";
|
|
37
38
|
ListType["MonthlyIncomeList"] = "MonthlyIncomeList";
|
|
39
|
+
ListType["OccupationList"] = "OccupationList";
|
|
38
40
|
})(ListType || (ListType = {}));
|
|
39
41
|
var AdditionalIndividualInfo = function (_a) {
|
|
40
42
|
var t = useTranslation().t;
|
|
@@ -75,7 +77,11 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
75
77
|
var isSourceOfIncomeListActive = listActive === ListType.SourceOfIncomeList;
|
|
76
78
|
var isEmployerLocationListActive = listActive === ListType.EmployerLocationList;
|
|
77
79
|
var isMonthlyIncomeListActive = listActive === ListType.MonthlyIncomeList;
|
|
78
|
-
|
|
80
|
+
var isOccupationListActive = listActive === ListType.OccupationList;
|
|
81
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Occupation, { onListOpen: function () { return handleMenuClick(ListType.OccupationList); }, onListClose: function () { return handleMenuClick(); }, show: !isEmployerLocationListActive && !isMonthlyIncomeListActive && !isSourceOfIncomeListActive }), _jsx(SourceOfIncome, { onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: !isEmployerLocationListActive && !isMonthlyIncomeListActive && !isOccupationListActive }), _jsx(MonthlyIncome, { show: !isEmployerLocationListActive && !isSourceOfIncomeListActive && !isOccupationListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(EmployerName, { show: false }), _jsx(EmployerLocation, { show: !isSourceOfIncomeListActive &&
|
|
82
|
+
employerFieldsActive &&
|
|
83
|
+
!isMonthlyIncomeListActive &&
|
|
84
|
+
!isOccupationListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.EmployerLocationList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(PEPSwitch, { show: !listActive }), _jsx(InfluencerSwitch, { show: !listActive })] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
79
85
|
};
|
|
80
86
|
export default React.memo(AdditionalIndividualInfo);
|
|
81
87
|
AdditionalIndividualInfo.defaultProps = {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Occupation as OccupationType } from '../../../../@types';
|
|
3
|
+
interface OccupationProps {
|
|
4
|
+
show: boolean;
|
|
5
|
+
onSelectOccupation?: (occupation: OccupationType) => void;
|
|
6
|
+
onListOpen?: () => void;
|
|
7
|
+
onListClose?: () => void;
|
|
8
|
+
}
|
|
9
|
+
declare const Occupation: ({ ...rest }: OccupationProps) => JSX.Element;
|
|
10
|
+
export default Occupation;
|
|
@@ -0,0 +1,89 @@
|
|
|
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, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
import * as React from 'react';
|
|
25
|
+
import Box from '@mui/material/Box';
|
|
26
|
+
import { styled } from '@mui/material/styles';
|
|
27
|
+
import { useTranslation } from 'react-i18next';
|
|
28
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
29
|
+
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
30
|
+
import { individualSelector } from '../../../app/individual/individualStore';
|
|
31
|
+
import Text from '../../../../components/Text';
|
|
32
|
+
import Collapse from '../../../../components/Collapse';
|
|
33
|
+
import CheckIcon from '@mui/icons-material/Check';
|
|
34
|
+
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
35
|
+
import Input from '../../../shared/Input';
|
|
36
|
+
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
37
|
+
import SimpleList from '../../../../components/SimpleList';
|
|
38
|
+
var Container = styled(Box)(function () { return ({
|
|
39
|
+
display: 'flex'
|
|
40
|
+
}); });
|
|
41
|
+
var IncomeText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
|
|
42
|
+
var theme = _a.theme, isSelected = _a.isSelected;
|
|
43
|
+
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25) }));
|
|
44
|
+
});
|
|
45
|
+
var CheckIconStyled = styled(CheckIcon)(function (_a) {
|
|
46
|
+
var theme = _a.theme;
|
|
47
|
+
return ({
|
|
48
|
+
color: theme.palette.success.main,
|
|
49
|
+
display: 'flex',
|
|
50
|
+
alignItems: 'flex-end'
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
var Occupation = function (_a) {
|
|
54
|
+
var _b, _c;
|
|
55
|
+
var rest = __rest(_a, []);
|
|
56
|
+
var _d = React.useState([]), occupationList = _d[0], setOccupationList = _d[1];
|
|
57
|
+
var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
|
|
58
|
+
var t = useTranslation().t;
|
|
59
|
+
var isAr = useLanguage().isAr;
|
|
60
|
+
var data = useAppSelector(individualSelector).data;
|
|
61
|
+
var control = useFormContext().control;
|
|
62
|
+
var occupationsList = ((_b = data.individualData.responseBody) === null || _b === void 0 ? void 0 : _b.occupationList) || [];
|
|
63
|
+
var occupationControl = useController({ control: control, name: 'occupation' });
|
|
64
|
+
React.useEffect(function () {
|
|
65
|
+
if ((occupationsList === null || occupationsList === void 0 ? void 0 : occupationsList.length) > 0) {
|
|
66
|
+
setOccupationList(occupationsList);
|
|
67
|
+
}
|
|
68
|
+
}, [occupationsList === null || occupationsList === void 0 ? void 0 : occupationsList.occupation]);
|
|
69
|
+
var onOpenList = function (event) {
|
|
70
|
+
var _a;
|
|
71
|
+
setAnchorEl(event.currentTarget);
|
|
72
|
+
(_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
73
|
+
};
|
|
74
|
+
var onCloseList = function () {
|
|
75
|
+
var _a;
|
|
76
|
+
setAnchorEl(null);
|
|
77
|
+
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
78
|
+
};
|
|
79
|
+
var onSelectItem = function (occupation) {
|
|
80
|
+
onCloseList();
|
|
81
|
+
occupationControl.field.onChange(occupation);
|
|
82
|
+
};
|
|
83
|
+
var occupation = occupationControl.field.value;
|
|
84
|
+
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.name_ar : occupation === null || occupation === void 0 ? void 0 : occupation.name_en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name_en', list: occupationList, onSelectItem: onSelectItem, renderItem: function (item) {
|
|
86
|
+
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, {})] }));
|
|
87
|
+
} }) }))] })) })));
|
|
88
|
+
};
|
|
89
|
+
export default Occupation;
|
|
@@ -2,18 +2,21 @@ import * as yup from 'yup';
|
|
|
2
2
|
import { ObjectShape } from 'yup/lib/object';
|
|
3
3
|
import { CountryCode } from '../../../../@types';
|
|
4
4
|
export declare const IndividualInfoValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<ObjectShape, {
|
|
5
|
+
occupation: import("yup/lib/object").RequiredObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
|
|
5
6
|
sourceIncome: import("yup/lib/object").RequiredObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
|
|
6
7
|
monthlyIncome: import("yup/lib/object").OptionalObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
|
|
7
8
|
employerLocation: import("yup/lib/object").OptionalObjectSchema<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>>>;
|
|
8
9
|
isPEP: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
|
|
9
10
|
isInfluencer: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
|
|
10
11
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<ObjectShape, {
|
|
12
|
+
occupation: import("yup/lib/object").RequiredObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
|
|
11
13
|
sourceIncome: import("yup/lib/object").RequiredObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
|
|
12
14
|
monthlyIncome: import("yup/lib/object").OptionalObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
|
|
13
15
|
employerLocation: import("yup/lib/object").OptionalObjectSchema<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>>>;
|
|
14
16
|
isPEP: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
|
|
15
17
|
isInfluencer: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
|
|
16
18
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<ObjectShape, {
|
|
19
|
+
occupation: import("yup/lib/object").RequiredObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
|
|
17
20
|
sourceIncome: import("yup/lib/object").RequiredObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
|
|
18
21
|
monthlyIncome: import("yup/lib/object").OptionalObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
|
|
19
22
|
employerLocation: import("yup/lib/object").OptionalObjectSchema<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<Partial<Record<keyof CountryCode, yup.AnySchema<any, any, any> | import("yup/lib/Reference").default<unknown> | import("yup/lib/Lazy").default<any, any>>>>>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
export var IndividualInfoValidationSchema = yup.object().shape({
|
|
3
|
+
occupation: yup.object().required('alert_choose_occupation'),
|
|
3
4
|
sourceIncome: yup.object().required('choose_any_source_of_income'),
|
|
4
5
|
monthlyIncome: yup.object().optional(),
|
|
5
6
|
employerLocation: yup.object().when('sourceIncome', function (sourceIncome) {
|
|
@@ -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 { individualSelector } from '../../../app/individual/individualStore';
|
|
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);
|