@tap-payments/auth-jsconnect 1.0.78 → 1.0.82
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/api/entity.d.ts +1 -2
- package/build/app/settings.d.ts +1 -0
- package/build/app/settings.js +1 -0
- package/build/assets/locales/ar.json +2 -1
- package/build/assets/locales/en.json +2 -1
- package/build/constants/app.js +8 -12
- package/build/constants/assets.d.ts +1 -0
- package/build/constants/assets.js +2 -1
- package/build/features/app/bank/bankStore.d.ts +1 -1
- package/build/features/app/bank/bankStore.js +40 -41
- package/build/features/app/business/businessStore.js +29 -28
- package/build/features/app/connect/connectStore.js +9 -7
- package/build/features/app/individual/individualStore.d.ts +1 -1
- package/build/features/app/individual/individualStore.js +29 -29
- package/build/features/app/password/passwordStore.d.ts +1 -1
- package/build/features/app/password/passwordStore.js +34 -36
- package/build/features/app/tax/taxStore.d.ts +1 -1
- package/build/features/app/tax/taxStore.js +34 -35
- package/build/features/bank/Bank.js +3 -2
- package/build/features/bank/screens/Success/Success.js +2 -2
- package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +20 -9
- package/build/features/business/screens/Success/Success.js +2 -2
- package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +20 -9
- package/build/features/connect/screens/Merchant/Merchant.js +5 -3
- package/build/features/connect/screens/Merchant/SocialMedia.js +11 -7
- package/build/features/connect/screens/Merchant/validation.js +9 -3
- package/build/features/connect/screens/Mobile/Mobile.js +0 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +1 -24
- package/build/features/individual/screens/Success/Success.js +2 -2
- package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +20 -9
- package/build/features/password/Password.js +3 -2
- package/build/features/password/screens/Success/Success.js +2 -2
- package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +20 -9
- package/build/features/shared/AcceptancePayouts/AcceptancePayouts.d.ts +7 -0
- package/build/features/shared/AcceptancePayouts/AcceptancePayouts.js +52 -0
- package/build/features/shared/AcceptancePayouts/index.d.ts +2 -0
- package/build/features/shared/AcceptancePayouts/index.js +2 -0
- package/build/features/shared/Button/Button.d.ts +2 -1
- package/build/features/shared/Button/Button.js +4 -2
- package/build/features/shared/Button/FlowsButtons.js +22 -7
- package/build/features/shared/Button/index.d.ts +1 -1
- package/build/features/shared/Button/index.js +1 -1
- package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +3 -2
- package/build/features/shared/SuccessScreen/SuccessScreen.js +3 -3
- package/build/features/tax/Tax.js +3 -2
- package/build/features/tax/screens/Success/Success.js +2 -2
- package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +21 -9
- package/package.json +1 -1
package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js
CHANGED
|
@@ -17,7 +17,6 @@ import Box from '@mui/material/Box';
|
|
|
17
17
|
import { useTranslation } from 'react-i18next';
|
|
18
18
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
19
19
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
20
|
-
import { styled } from '@mui/material/styles';
|
|
21
20
|
import Form from '../../../../components/Form';
|
|
22
21
|
import Collapse from '../../../../components/Collapse';
|
|
23
22
|
import Button from '../../../shared/Button';
|
|
@@ -31,28 +30,6 @@ import EmployerName from './EmployerName';
|
|
|
31
30
|
import EmployerLocation from './EmployerLocation';
|
|
32
31
|
import SourceOfIncome from './SourceOfIncome';
|
|
33
32
|
import { individualSelector, updateIndividualInfo } from '../../../app/individual/individualStore';
|
|
34
|
-
var InputsContainerStyled = styled(Box)(function (_a) {
|
|
35
|
-
var _b;
|
|
36
|
-
var theme = _a.theme, listActive = _a.listActive;
|
|
37
|
-
return (_b = {
|
|
38
|
-
paddingBottom: theme.spacing(listActive ? 0 : 5),
|
|
39
|
-
overflowY: 'scroll',
|
|
40
|
-
maxHeight: 'calc(100vh - 250px)',
|
|
41
|
-
'&::-webkit-scrollbar': {
|
|
42
|
-
display: 'none'
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
_b[theme.transitions.create(['padding-bottom'])] = {
|
|
46
|
-
duration: theme.transitions.duration.standard
|
|
47
|
-
},
|
|
48
|
-
_b);
|
|
49
|
-
});
|
|
50
|
-
var ButtonStyled = styled(Button)(function (_a) {
|
|
51
|
-
var theme = _a.theme;
|
|
52
|
-
return ({
|
|
53
|
-
marginBlockStart: theme.spacing(-5)
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
33
|
var ListType;
|
|
57
34
|
(function (ListType) {
|
|
58
35
|
ListType["SourceOfIncomeList"] = "SourceOfIncomeList";
|
|
@@ -96,7 +73,7 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
96
73
|
var isSourceOfIncomeListActive = listActive === ListType.SourceOfIncomeList;
|
|
97
74
|
var isEmployerLocationListActive = listActive === ListType.EmployerLocationList;
|
|
98
75
|
var isMonthlyIncomeListActive = listActive === ListType.MonthlyIncomeList;
|
|
99
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(
|
|
76
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(SourceOfIncome, { onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: !isEmployerLocationListActive && !isMonthlyIncomeListActive }), _jsx(MonthlyIncome, { show: !isEmployerLocationListActive && !isSourceOfIncomeListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(EmployerName, { show: false }), _jsx(EmployerLocation, { show: !isSourceOfIncomeListActive && employerFieldsActive && !isMonthlyIncomeListActive, countries: data.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({ disableBack: true, onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
100
77
|
};
|
|
101
78
|
export default React.memo(AdditionalIndividualInfo);
|
|
102
79
|
AdditionalIndividualInfo.defaultProps = {};
|
|
@@ -7,10 +7,10 @@ import SuccessScreen from '../../../shared/SuccessScreen';
|
|
|
7
7
|
var Success = function (_a) {
|
|
8
8
|
var t = useTranslation().t;
|
|
9
9
|
var dispatch = useAppDispatch();
|
|
10
|
-
var
|
|
10
|
+
var _b = useAppSelector(individualSelector), loading = _b.loading, error = _b.error;
|
|
11
11
|
var onSuccess = function () {
|
|
12
12
|
dispatch(updateLeadSuccess());
|
|
13
13
|
};
|
|
14
|
-
return (_jsx(SuccessScreen, { title: t('individual_success_title'), onSuccess: onSuccess, successTitle: t('continue'),
|
|
14
|
+
return (_jsx(SuccessScreen, { title: t('individual_success_title'), onSuccess: onSuccess, successTitle: t('continue'), loading: loading, error: error || '' }));
|
|
15
15
|
};
|
|
16
16
|
export default React.memo(Success);
|
|
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { memo, useEffect, useState } from 'react';
|
|
13
|
+
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';
|
|
@@ -21,6 +21,7 @@ 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
|
+
import AcceptancePayouts from '../../../shared/AcceptancePayouts';
|
|
24
25
|
var TitleStyled = styled(Text)(function (_a) {
|
|
25
26
|
var theme = _a.theme;
|
|
26
27
|
return (__assign(__assign({}, theme.typography.body1), { fontWeight: theme.typography.fontWeightBold, color: theme.palette.text.primary, marginBlockEnd: theme.spacing(2.375), marginBlockStart: theme.spacing(2.875), lineHeight: 1.75, padding: '0px 20px' }));
|
|
@@ -40,33 +41,40 @@ var ButtonGroupStyled = styled(Box)(function (_a) {
|
|
|
40
41
|
});
|
|
41
42
|
});
|
|
42
43
|
var SuccessWithFlowButtons = function () {
|
|
43
|
-
var _a;
|
|
44
|
+
var _a, _b, _c;
|
|
44
45
|
var t = useTranslation().t;
|
|
45
46
|
var isAr = useLanguage().isAr;
|
|
47
|
+
var _d = React.useState(false), isAcceptance = _d[0], setIsAcceptance = _d[1];
|
|
48
|
+
var _e = React.useState(false), isPayout = _e[0], setIsPayout = _e[1];
|
|
46
49
|
var data = useAppSelector(individualSelector).data;
|
|
47
|
-
var
|
|
48
|
-
var
|
|
50
|
+
var _f = data.verify.responseBody || {}, flows = _f.flows, nameObj = _f.name, entity = _f.entity, brand = _f.brand, bank = _f.bank_account;
|
|
51
|
+
var _g = useState([]), buttons = _g[0], setButtons = _g[1];
|
|
49
52
|
var username = ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.first) || '') + ' ' + ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.last) || '');
|
|
50
53
|
var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
|
|
51
|
-
var bankName = (bank === null || bank === void 0 ? void 0 : bank.
|
|
52
|
-
var iban = (bank === null || bank === void 0 ? void 0 : bank.
|
|
54
|
+
var bankName = (bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
|
|
55
|
+
var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
|
|
53
56
|
var taxID = (entity === null || entity === void 0 ? void 0 : entity.tax_number) || '';
|
|
57
|
+
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) || '';
|
|
54
58
|
var reMapFlowData = function (flows) {
|
|
55
59
|
if (flows === void 0) { flows = []; }
|
|
56
60
|
var images = ICONS_NAMES;
|
|
61
|
+
var statuses = [];
|
|
57
62
|
var mappedFlows = flows.map(function (_a) {
|
|
58
63
|
var name = _a.name, url = _a.url, status = _a.status;
|
|
59
64
|
var type = status === 'initiated' ? 'pending' : 'completed';
|
|
60
65
|
var title = t("".concat(name, "_flow_").concat(type), {
|
|
61
66
|
individual_name: username.toLowerCase(),
|
|
62
|
-
business_type:
|
|
67
|
+
business_type: brandName,
|
|
63
68
|
license_number: t('masking_symbols') + showLastFour(licenseNumber),
|
|
64
69
|
bank_name: bankName,
|
|
65
70
|
iban: t('masking_symbols') + iban,
|
|
66
|
-
tax_id: t('masking_symbols') + taxID
|
|
71
|
+
tax_id: t('masking_symbols') + showLastFour(taxID)
|
|
67
72
|
});
|
|
73
|
+
if ("business_flow_completed" === "".concat(name, "_flow_").concat(type))
|
|
74
|
+
setIsAcceptance(true);
|
|
68
75
|
var isCompleted = status === 'completed' && name !== 'password';
|
|
69
76
|
var isIndividual = name === 'individual';
|
|
77
|
+
statuses.push(isCompleted);
|
|
70
78
|
var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
|
|
71
79
|
var hoverSrc = "".concat(name, "_white_icon");
|
|
72
80
|
return {
|
|
@@ -79,11 +87,14 @@ var SuccessWithFlowButtons = function () {
|
|
|
79
87
|
};
|
|
80
88
|
});
|
|
81
89
|
setButtons(mappedFlows);
|
|
90
|
+
var isAllCompleted = statuses.filter(function (status) { return status; }).length === flows.length - 1;
|
|
91
|
+
if (isAllCompleted)
|
|
92
|
+
setIsPayout(true);
|
|
82
93
|
};
|
|
83
94
|
useEffect(function () {
|
|
84
95
|
if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
|
|
85
96
|
reMapFlowData(flows);
|
|
86
97
|
}, [flows, isAr]);
|
|
87
|
-
return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons }) })] }));
|
|
98
|
+
return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons }) })] }));
|
|
88
99
|
};
|
|
89
100
|
export default memo(SuccessWithFlowButtons);
|
|
@@ -21,13 +21,14 @@ import { FeatureContainer } from '../shared/Containers';
|
|
|
21
21
|
import { getParameterByName, reactElement } from '../../utils';
|
|
22
22
|
import { PASSWORD_SCREENS_NAVIGATION } from '../../constants';
|
|
23
23
|
import { passwordFeatureScreens } from '../featuresScreens';
|
|
24
|
-
import { verifyLeadToken } from '../app/password/passwordStore';
|
|
24
|
+
import { passwordSelector, verifyLeadToken } from '../app/password/passwordStore';
|
|
25
25
|
import CustomFooter from '../shared/Footer';
|
|
26
26
|
var Password = memo(function (props) {
|
|
27
27
|
var open = React.useState(true)[0];
|
|
28
28
|
var theme = useAppTheme().theme;
|
|
29
29
|
var dispatch = useAppDispatch();
|
|
30
30
|
var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
|
|
31
|
+
var customLoading = useAppSelector(passwordSelector).customLoading;
|
|
31
32
|
var loading = useAppConfig(__assign({ navigation: PASSWORD_SCREENS_NAVIGATION }, props)).loading;
|
|
32
33
|
useErrorListener();
|
|
33
34
|
var activeScreen = data.activeScreen;
|
|
@@ -41,7 +42,7 @@ var Password = memo(function (props) {
|
|
|
41
42
|
if (!loading)
|
|
42
43
|
verifyToken();
|
|
43
44
|
}, [loading]);
|
|
44
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ loading: settingLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: passwordFeatureScreens.map(function (_a, index) {
|
|
45
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ loading: settingLoading || customLoading, error: error, open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: passwordFeatureScreens.map(function (_a, index) {
|
|
45
46
|
var Element = _a.element, name = _a.name;
|
|
46
47
|
var isActive = activeScreen.name === name;
|
|
47
48
|
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
@@ -7,10 +7,10 @@ import SuccessScreen from '../../../shared/SuccessScreen';
|
|
|
7
7
|
var Success = function (_a) {
|
|
8
8
|
var t = useTranslation().t;
|
|
9
9
|
var dispatch = useAppDispatch();
|
|
10
|
-
var
|
|
10
|
+
var _b = useAppSelector(passwordSelector), loading = _b.loading, error = _b.error;
|
|
11
11
|
var onSuccess = function () {
|
|
12
12
|
dispatch(updateLeadSuccess());
|
|
13
13
|
};
|
|
14
|
-
return (_jsx(SuccessScreen, { title: t('password_success_title'), onSuccess: onSuccess, successTitle: t('continue'),
|
|
14
|
+
return (_jsx(SuccessScreen, { title: t('password_success_title'), onSuccess: onSuccess, successTitle: t('continue'), loading: loading, error: error || '' }));
|
|
15
15
|
};
|
|
16
16
|
export default React.memo(Success);
|
|
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { memo, useEffect, useState } from 'react';
|
|
13
|
+
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';
|
|
@@ -21,6 +21,7 @@ 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 '../../../../features/shared/AcceptancePayouts';
|
|
24
25
|
var TitleStyled = styled(Text)(function (_a) {
|
|
25
26
|
var theme = _a.theme;
|
|
26
27
|
return (__assign(__assign({}, theme.typography.body1), { fontWeight: theme.typography.fontWeightBold, color: theme.palette.text.primary, marginBlockEnd: theme.spacing(2.375), marginBlockStart: theme.spacing(2.875), lineHeight: 1.75, padding: '0px 20px' }));
|
|
@@ -40,33 +41,40 @@ var ButtonGroupStyled = styled(Box)(function (_a) {
|
|
|
40
41
|
});
|
|
41
42
|
});
|
|
42
43
|
var SuccessWithFlowButtons = function () {
|
|
43
|
-
var _a;
|
|
44
|
+
var _a, _b, _c;
|
|
44
45
|
var t = useTranslation().t;
|
|
45
46
|
var isAr = useLanguage().isAr;
|
|
47
|
+
var _d = React.useState(false), isAcceptance = _d[0], setIsAcceptance = _d[1];
|
|
48
|
+
var _e = React.useState(false), isPayout = _e[0], setIsPayout = _e[1];
|
|
46
49
|
var data = useAppSelector(passwordSelector).data;
|
|
47
|
-
var
|
|
48
|
-
var
|
|
50
|
+
var _f = data.verify.responseBody || {}, flows = _f.flows, nameObj = _f.name, entity = _f.entity, brand = _f.brand, bank = _f.bank_account;
|
|
51
|
+
var _g = useState([]), buttons = _g[0], setButtons = _g[1];
|
|
49
52
|
var username = ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.first) || '') + ' ' + ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.last) || '');
|
|
50
53
|
var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
|
|
51
|
-
var bankName = (bank === null || bank === void 0 ? void 0 : bank.
|
|
52
|
-
var iban = (bank === null || bank === void 0 ? void 0 : bank.
|
|
54
|
+
var bankName = (bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
|
|
55
|
+
var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
|
|
53
56
|
var taxID = (entity === null || entity === void 0 ? void 0 : entity.tax_number) || '';
|
|
57
|
+
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) || '';
|
|
54
58
|
var reMapFlowData = function (flows) {
|
|
55
59
|
if (flows === void 0) { flows = []; }
|
|
56
60
|
var images = ICONS_NAMES;
|
|
61
|
+
var statuses = [];
|
|
57
62
|
var mappedFlows = flows.map(function (_a) {
|
|
58
63
|
var name = _a.name, url = _a.url, status = _a.status;
|
|
59
64
|
var type = status === 'initiated' ? 'pending' : 'completed';
|
|
60
65
|
var title = t("".concat(name, "_flow_").concat(type), {
|
|
61
66
|
individual_name: username.toLowerCase(),
|
|
62
|
-
business_type:
|
|
67
|
+
business_type: brandName,
|
|
63
68
|
license_number: t('masking_symbols') + showLastFour(licenseNumber),
|
|
64
69
|
bank_name: bankName,
|
|
65
70
|
iban: t('masking_symbols') + iban,
|
|
66
|
-
tax_id: t('masking_symbols') + taxID
|
|
71
|
+
tax_id: t('masking_symbols') + showLastFour(taxID)
|
|
67
72
|
});
|
|
73
|
+
if ("business_flow_completed" === "".concat(name, "_flow_").concat(type))
|
|
74
|
+
setIsAcceptance(true);
|
|
68
75
|
var isCompleted = status === 'completed' && name !== 'password';
|
|
69
76
|
var isIndividual = name === 'individual';
|
|
77
|
+
statuses.push(isCompleted);
|
|
70
78
|
var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
|
|
71
79
|
var hoverSrc = "".concat(name, "_white_icon");
|
|
72
80
|
return {
|
|
@@ -79,11 +87,14 @@ var SuccessWithFlowButtons = function () {
|
|
|
79
87
|
};
|
|
80
88
|
});
|
|
81
89
|
setButtons(mappedFlows);
|
|
90
|
+
var isAllCompleted = statuses.filter(function (status) { return status; }).length === flows.length - 1;
|
|
91
|
+
if (isAllCompleted)
|
|
92
|
+
setIsPayout(true);
|
|
82
93
|
};
|
|
83
94
|
useEffect(function () {
|
|
84
95
|
if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
|
|
85
96
|
reMapFlowData(flows);
|
|
86
97
|
}, [flows, isAr]);
|
|
87
|
-
return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons }) })] }));
|
|
98
|
+
return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons }) })] }));
|
|
88
99
|
};
|
|
89
100
|
export default memo(SuccessWithFlowButtons);
|
|
@@ -0,0 +1,52 @@
|
|
|
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 { alpha, styled } from '@mui/material/styles';
|
|
14
|
+
import Box from '@mui/material/Box';
|
|
15
|
+
import Icon from '../../../components/Icon';
|
|
16
|
+
import Text from '../../../components/Text';
|
|
17
|
+
import { ICONS_NAMES } from '../../../constants';
|
|
18
|
+
import { useTranslation } from 'react-i18next';
|
|
19
|
+
var BoxStyled = styled(Box, { shouldForwardProp: function (prop) { return prop !== 'enabled'; } })(function (_a) {
|
|
20
|
+
var theme = _a.theme, enabled = _a.enabled;
|
|
21
|
+
return ({
|
|
22
|
+
backgroundColor: enabled ? alpha(theme.palette.success.main, 0.2) : alpha(theme.palette.text.primary, 0.2),
|
|
23
|
+
color: enabled ? theme.palette.success.main : alpha(theme.palette.text.primary, 0.6),
|
|
24
|
+
borderRadius: theme.spacing(12.625),
|
|
25
|
+
padding: theme.spacing(0.625, 1.125, 0.625, 1.125),
|
|
26
|
+
marginInline: theme.spacing(1.25),
|
|
27
|
+
marginBlock: theme.spacing(3),
|
|
28
|
+
display: 'flex',
|
|
29
|
+
minHeight: theme.spacing(3.125),
|
|
30
|
+
minWidth: theme.spacing(13.5),
|
|
31
|
+
alignItems: 'center'
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
var TextStyled = styled(Text)(function (_a) {
|
|
35
|
+
var theme = _a.theme;
|
|
36
|
+
return (__assign(__assign({}, theme.typography.subtitle2), { fontWeight: theme.typography.fontWeightMedium, lineHeight: theme.spacing(2.125) }));
|
|
37
|
+
});
|
|
38
|
+
var IconStyled = styled(Icon)(function (_a) {
|
|
39
|
+
var theme = _a.theme;
|
|
40
|
+
return ({
|
|
41
|
+
width: theme.spacing(2),
|
|
42
|
+
height: theme.spacing(2),
|
|
43
|
+
marginInlineEnd: theme.spacing(0.625),
|
|
44
|
+
marginInlineStart: theme.spacing(0.625)
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
var AcceptancePayouts = function (_a) {
|
|
48
|
+
var showAcceptance = _a.showAcceptance, showPayout = _a.showPayout;
|
|
49
|
+
var t = useTranslation().t;
|
|
50
|
+
return (_jsxs(Box, __assign({ sx: { display: 'flex' } }, { children: [_jsxs(BoxStyled, __assign({ enabled: showAcceptance }, { children: [_jsx(IconStyled, { src: showAcceptance ? ICONS_NAMES.SUCCESS : ICONS_NAMES.UNFINISHED }), _jsxs(TextStyled, { children: [t('acceptance_btn_text'), " "] })] })), _jsxs(BoxStyled, __assign({ enabled: showPayout }, { children: [_jsx(IconStyled, { src: showPayout ? ICONS_NAMES.SUCCESS : ICONS_NAMES.UNFINISHED }), _jsxs(TextStyled, { children: [t('payouts_btn_text'), " "] })] }))] })));
|
|
51
|
+
};
|
|
52
|
+
export default AcceptancePayouts;
|
|
@@ -4,8 +4,9 @@ interface CustomButtonProps extends ButtonProps {
|
|
|
4
4
|
isAr: boolean;
|
|
5
5
|
loading?: boolean;
|
|
6
6
|
disableBack?: boolean;
|
|
7
|
+
disableNextIcon?: boolean;
|
|
7
8
|
onBackClicked?: () => void;
|
|
8
9
|
error?: string;
|
|
9
10
|
}
|
|
10
|
-
export default function CustomButton({ children, disabled, isAr, loading, disableBack, onBackClicked, error, ...props }: CustomButtonProps): JSX.Element;
|
|
11
|
+
export default function CustomButton({ children, disabled, isAr, loading, disableBack, onBackClicked, error, disableNextIcon, ...props }: CustomButtonProps): JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -83,7 +83,7 @@ var BackButtonStyled = styled(Button, { shouldForwardProp: function (prop) { ret
|
|
|
83
83
|
});
|
|
84
84
|
});
|
|
85
85
|
export default function CustomButton(_a) {
|
|
86
|
-
var children = _a.children, disabled = _a.disabled, isAr = _a.isAr, loading = _a.loading, disableBack = _a.disableBack, onBackClicked = _a.onBackClicked, error = _a.error, props = __rest(_a, ["children", "disabled", "isAr", "loading", "disableBack", "onBackClicked", "error"]);
|
|
86
|
+
var children = _a.children, disabled = _a.disabled, isAr = _a.isAr, loading = _a.loading, disableBack = _a.disableBack, onBackClicked = _a.onBackClicked, error = _a.error, disableNextIcon = _a.disableNextIcon, props = __rest(_a, ["children", "disabled", "isAr", "loading", "disableBack", "onBackClicked", "error", "disableNextIcon"]);
|
|
87
87
|
var _b = React.useState(false), btnLoading = _b[0], setBtnLoading = _b[1];
|
|
88
88
|
var isBackEnabled = !disableBack && !btnLoading;
|
|
89
89
|
React.useEffect(function () {
|
|
@@ -95,5 +95,7 @@ export default function CustomButton(_a) {
|
|
|
95
95
|
React.useEffect(function () {
|
|
96
96
|
setBtnLoading(false);
|
|
97
97
|
}, []);
|
|
98
|
-
return (_jsxs(Fragment, { children: [_jsx(Collapse, __assign({ in: !!error }, { children: _jsx(Warning, __assign({ sx: { mb: 1 }, warningType: 'error' }, { children: error })) })), _jsxs(ButtonBoxStyled, { children: [isBackEnabled && (_jsx(BackButtonStyled, __assign({ onClick: function () { return onBackClicked === null || onBackClicked === void 0 ? void 0 : onBackClicked(); }, isAr: isAr, type: 'reset', startIcon: _jsx(BackIconStyled, { isAr: isAr, src: ICONS_NAMES.WHITE_ARROW }) }, props))), _jsx(ButtonStyled, __assign({ disabled: disabled, isLoading: btnLoading, type: !btnLoading ? 'submit' : 'button', isBack: isBackEnabled, endIcon:
|
|
98
|
+
return (_jsxs(Fragment, { children: [_jsx(Collapse, __assign({ in: !!error }, { children: _jsx(Warning, __assign({ sx: { mb: 1 }, warningType: 'error' }, { children: error })) })), _jsxs(ButtonBoxStyled, { children: [isBackEnabled && (_jsx(BackButtonStyled, __assign({ onClick: function () { return onBackClicked === null || onBackClicked === void 0 ? void 0 : onBackClicked(); }, isAr: isAr, type: 'reset', startIcon: _jsx(BackIconStyled, { isAr: isAr, src: ICONS_NAMES.WHITE_ARROW }) }, props))), _jsx(ButtonStyled, __assign({ disabled: disabled, isLoading: btnLoading, type: !btnLoading ? 'submit' : 'button', isBack: isBackEnabled, endIcon: btnLoading === false
|
|
99
|
+
? !disableNextIcon && _jsx(IconStyled, { isAr: isAr, src: ICONS_NAMES.WHITE_ARROW })
|
|
100
|
+
: undefined }, props, { children: !btnLoading ? (_jsxs(Text, __assign({ sx: { marginInlineEnd: isBackEnabled ? '-24px' : '-15px' } }, { children: [" ", children] }))) : (_jsx(Loader, { innerColor: 'white', outerColor: 'white', size: 15, toggleAnimation: !!loading })) }))] })] }));
|
|
99
101
|
}
|
|
@@ -34,18 +34,29 @@ var ButtonBoxStyled = styled(Box)(function (_a) {
|
|
|
34
34
|
margin: theme.spacing(0, 2.5, 2.5, 2.5)
|
|
35
35
|
});
|
|
36
36
|
});
|
|
37
|
-
var ButtonStyled = styled(Button, {
|
|
38
|
-
|
|
37
|
+
var ButtonStyled = styled(Button, {
|
|
38
|
+
shouldForwardProp: function (prop) { return !['isCompleted', 'touched'].includes(prop.toString()); }
|
|
39
|
+
})(function (_a) {
|
|
40
|
+
var _b;
|
|
41
|
+
var theme = _a.theme, isCompleted = _a.isCompleted, touched = _a.touched;
|
|
39
42
|
return (__assign(__assign({ width: '100%', textTransform: 'none', paddingInlineStart: theme.spacing(0.75), backgroundColor: theme.palette.common.white, border: "1px solid ".concat(theme.palette.primary.main), color: theme.palette.primary.main }, (isCompleted && {
|
|
40
|
-
paddingInlineEnd:
|
|
43
|
+
paddingInlineEnd: theme.spacing(1.625),
|
|
41
44
|
color: theme.palette.success.main,
|
|
42
45
|
border: "1px solid ".concat(theme.palette.success.main)
|
|
43
|
-
})), { '&:hover': __assign({ backgroundColor: theme.palette.primary.main, color: theme.palette.common.white }, (isCompleted && {
|
|
46
|
+
})), { '&:hover': __assign(__assign({ backgroundColor: theme.palette.primary.main, color: theme.palette.common.white }, (isCompleted && {
|
|
44
47
|
backgroundColor: theme.palette.common.white,
|
|
45
48
|
border: "1px solid ".concat(theme.palette.success.main),
|
|
46
49
|
color: theme.palette.success.main,
|
|
47
50
|
cursor: 'initial'
|
|
48
|
-
})), '
|
|
51
|
+
})), (_b = {}, _b[theme.breakpoints.down('sm')] = {
|
|
52
|
+
'&:hover': __assign({ backgroundColor: touched ? theme.palette.primary.main : theme.palette.common.white, border: "1px solid ".concat(theme.palette.primary.main), color: touched ? theme.palette.common.white : theme.palette.primary.main }, (isCompleted && {
|
|
53
|
+
backgroundColor: theme.palette.common.white,
|
|
54
|
+
border: "1px solid ".concat(theme.palette.success.main),
|
|
55
|
+
paddingInlineEnd: theme.spacing(1.625),
|
|
56
|
+
color: theme.palette.success.main,
|
|
57
|
+
cursor: 'initial'
|
|
58
|
+
}))
|
|
59
|
+
}, _b)), '&:disabled': {
|
|
49
60
|
backgroundColor: theme.palette.common.white,
|
|
50
61
|
color: alpha(theme.palette.primary.main, 0.3)
|
|
51
62
|
} }));
|
|
@@ -61,6 +72,10 @@ var CheckIconStyled = styled(CheckIcon)(function (_a) {
|
|
|
61
72
|
export default function FlowsButtons(_a) {
|
|
62
73
|
var buttons = _a.buttons;
|
|
63
74
|
var _b = React.useState(), index = _b[0], setIndex = _b[1];
|
|
75
|
+
var _c = React.useState(false), touched = _c[0], setTouched = _c[1];
|
|
76
|
+
var handleTouch = function () {
|
|
77
|
+
setTouched(true);
|
|
78
|
+
};
|
|
64
79
|
return (_jsx(ButtonBoxStyled, { children: buttons.map(function (_a, idx) {
|
|
65
80
|
var title = _a.title, href = _a.href, src = _a.src, hoverSrc = _a.hoverSrc, isCompleted = _a.isCompleted, sx = _a.sx;
|
|
66
81
|
var isLast = idx === buttons.length - 1;
|
|
@@ -68,7 +83,7 @@ export default function FlowsButtons(_a) {
|
|
|
68
83
|
href: href,
|
|
69
84
|
target: '_blank'
|
|
70
85
|
};
|
|
71
|
-
return (_createElement(Link, __assign({}, (!isCompleted && linkProps), { underline: 'none', key: idx, onMouseEnter: function () { return !isCompleted && setIndex(idx); }, onMouseLeave: function () { return setIndex(undefined); } }),
|
|
72
|
-
_jsx(ButtonStyled, __assign({ isCompleted: isCompleted, sx: __assign({ mb: isLast ? 0 : 1.8 }, sx), endIcon: isCompleted ? (_jsx(CheckIconStyled, {})) : (_jsx(Image, { sx: { height: 15 }, src: index === idx ? ICONS_NAMES.Arrow_white_right_icon : ICONS_NAMES.Arrow_filled_right_icon })), startIcon: _jsx(Image, { src: index === idx ? hoverSrc : src, alt: title }), type: 'button' }, { children: title }))));
|
|
86
|
+
return (_createElement(Link, __assign({}, (!isCompleted && linkProps), { underline: 'none', key: idx, onMouseEnter: function () { return !isCompleted && setIndex(idx); }, onMouseLeave: function () { return setIndex(undefined); }, onClick: function () { return setTouched(false); } }),
|
|
87
|
+
_jsx(ButtonStyled, __assign({ onTouchStart: handleTouch, touched: touched, isCompleted: isCompleted, sx: __assign({ mb: isLast ? 0 : 1.8 }, sx), endIcon: isCompleted ? (_jsx(CheckIconStyled, {})) : (_jsx(Image, { sx: { height: 15 }, src: index === idx ? ICONS_NAMES.Arrow_white_right_icon : ICONS_NAMES.Arrow_filled_right_icon })), startIcon: _jsx(Image, { src: index === idx ? hoverSrc : src, alt: title }), type: 'button' }, { children: title }))));
|
|
73
88
|
}) }));
|
|
74
89
|
}
|
|
@@ -4,5 +4,5 @@ import MobileButton from './MobileButton';
|
|
|
4
4
|
import EmailProvidersButton from './EmailProvidersButtons';
|
|
5
5
|
import FlowsButtons from './FlowsButtons';
|
|
6
6
|
import SuccessButton from './SuccessButton';
|
|
7
|
-
export { AbsherButton, MobileButton, EmailProvidersButton, FlowsButtons, SuccessButton };
|
|
7
|
+
export { AbsherButton, MobileButton, EmailProvidersButton, FlowsButtons, SuccessButton, Button };
|
|
8
8
|
export default Button;
|
|
@@ -4,5 +4,5 @@ import MobileButton from './MobileButton';
|
|
|
4
4
|
import EmailProvidersButton from './EmailProvidersButtons';
|
|
5
5
|
import FlowsButtons from './FlowsButtons';
|
|
6
6
|
import SuccessButton from './SuccessButton';
|
|
7
|
-
export { AbsherButton, MobileButton, EmailProvidersButton, FlowsButtons, SuccessButton };
|
|
7
|
+
export { AbsherButton, MobileButton, EmailProvidersButton, FlowsButtons, SuccessButton, Button };
|
|
8
8
|
export default Button;
|
|
@@ -4,8 +4,9 @@ export interface ThankYouProps {
|
|
|
4
4
|
onSuccess?: () => void;
|
|
5
5
|
showEmailProviders?: boolean;
|
|
6
6
|
successTitle?: string;
|
|
7
|
-
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
error?: string;
|
|
8
9
|
description?: string;
|
|
9
10
|
}
|
|
10
|
-
declare const _default: React.MemoExoticComponent<({ title, description, showEmailProviders, onSuccess, successTitle,
|
|
11
|
+
declare const _default: React.MemoExoticComponent<({ title, description, showEmailProviders, onSuccess, successTitle, loading, error }: ThankYouProps) => JSX.Element>;
|
|
11
12
|
export default _default;
|
|
@@ -16,7 +16,7 @@ import * as React from 'react';
|
|
|
16
16
|
import { useTranslation } from 'react-i18next';
|
|
17
17
|
import Text from '../../../components/Text';
|
|
18
18
|
import Container from '../Containers/ScreenContainer';
|
|
19
|
-
import { EmailProvidersButton,
|
|
19
|
+
import { EmailProvidersButton, Button } from '../../shared/Button';
|
|
20
20
|
import Icon from '../../../components/Icon';
|
|
21
21
|
import { ICONS_NAMES } from '../../../constants';
|
|
22
22
|
import { useLanguage } from '../../../hooks';
|
|
@@ -53,9 +53,9 @@ var IconStyled = styled(Icon)(function (_a) {
|
|
|
53
53
|
_b);
|
|
54
54
|
});
|
|
55
55
|
var ThankYou = function (_a) {
|
|
56
|
-
var title = _a.title, description = _a.description, showEmailProviders = _a.showEmailProviders, onSuccess = _a.onSuccess, successTitle = _a.successTitle,
|
|
56
|
+
var title = _a.title, description = _a.description, showEmailProviders = _a.showEmailProviders, onSuccess = _a.onSuccess, successTitle = _a.successTitle, loading = _a.loading, error = _a.error;
|
|
57
57
|
var t = useTranslation().t;
|
|
58
58
|
var isAr = useLanguage().isAr;
|
|
59
|
-
return (_jsxs(ContainerStyled, { children: [_jsx(IconStyled, { src: ICONS_NAMES.SUCCESS_GIF, alt: 'loading...' }), _jsxs(TitleStyled, { children: [title, " "] }), _jsx(DescriptionStyled, { children: description }), showEmailProviders && (_jsx(MailBoxStyled, { children: _jsx(EmailProvidersButton, { gmail: { title: t('gmail_btn_open_title'), href: 'https://mail.google.com/mail/u/0/#inbox' }, outlook: { title: t('outlook_btn_open_title'), href: 'https://outlook.live.com/mail/0/' }, apple: { title: t('apple_btn_open_title'), href: 'https://www.icloud.com/mail/' } }) })), onSuccess && !showEmailProviders && (_jsx(MailBoxStyled, { children: _jsx(
|
|
59
|
+
return (_jsxs(ContainerStyled, { children: [_jsx(IconStyled, { src: ICONS_NAMES.SUCCESS_GIF, alt: 'loading...' }), _jsxs(TitleStyled, { children: [title, " "] }), _jsx(DescriptionStyled, { children: description }), showEmailProviders && (_jsx(MailBoxStyled, { children: _jsx(EmailProvidersButton, { gmail: { title: t('gmail_btn_open_title'), href: 'https://mail.google.com/mail/u/0/#inbox' }, outlook: { title: t('outlook_btn_open_title'), href: 'https://outlook.live.com/mail/0/' }, apple: { title: t('apple_btn_open_title'), href: 'https://www.icloud.com/mail/' } }) })), onSuccess && !showEmailProviders && (_jsx(MailBoxStyled, { children: _jsx(Button, __assign({ onClick: onSuccess, disableBack: true, disableNextIcon: true, disabled: loading, isAr: isAr, loading: loading, error: t(error || '') }, { children: t(successTitle || '') })) }))] }));
|
|
60
60
|
};
|
|
61
61
|
export default React.memo(ThankYou);
|
|
@@ -22,12 +22,13 @@ import { FeatureContainer } from '../shared/Containers';
|
|
|
22
22
|
import { TAX_SCREENS_NAVIGATION } from '../../constants';
|
|
23
23
|
import { taxFeatureScreens } from '../featuresScreens';
|
|
24
24
|
import CustomFooter from '../shared/Footer';
|
|
25
|
-
import { verifyLeadToken } from '../app/tax/taxStore';
|
|
25
|
+
import { taxSelector, verifyLeadToken } from '../app/tax/taxStore';
|
|
26
26
|
var Tax = memo(function (props) {
|
|
27
27
|
var open = React.useState(true)[0];
|
|
28
28
|
var theme = useAppTheme().theme;
|
|
29
29
|
var dispatch = useAppDispatch();
|
|
30
30
|
var _a = useAppSelector(settingsSelector), data = _a.data, error = _a.error, settingLoading = _a.loading;
|
|
31
|
+
var customLoading = useAppSelector(taxSelector).customLoading;
|
|
31
32
|
var loading = useAppConfig(__assign({ navigation: TAX_SCREENS_NAVIGATION }, props)).loading;
|
|
32
33
|
useErrorListener();
|
|
33
34
|
var activeScreen = data.activeScreen;
|
|
@@ -41,7 +42,7 @@ var Tax = memo(function (props) {
|
|
|
41
42
|
if (!loading)
|
|
42
43
|
verifyToken();
|
|
43
44
|
}, [loading]);
|
|
44
|
-
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ open: open, error: error, loading: settingLoading, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: taxFeatureScreens.map(function (_a, index) {
|
|
45
|
+
return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ open: open, error: error, loading: settingLoading || customLoading, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: taxFeatureScreens.map(function (_a, index) {
|
|
45
46
|
var Element = _a.element, name = _a.name;
|
|
46
47
|
var isActive = activeScreen.name === name;
|
|
47
48
|
return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
|
|
@@ -7,10 +7,10 @@ import SuccessScreen from '../../../shared/SuccessScreen';
|
|
|
7
7
|
var Success = function (_a) {
|
|
8
8
|
var t = useTranslation().t;
|
|
9
9
|
var dispatch = useAppDispatch();
|
|
10
|
-
var
|
|
10
|
+
var _b = useAppSelector(taxSelector), loading = _b.loading, error = _b.error;
|
|
11
11
|
var onSuccess = function () {
|
|
12
12
|
dispatch(updateLeadSuccess());
|
|
13
13
|
};
|
|
14
|
-
return (_jsx(SuccessScreen, { title: t('tax_success_title'), onSuccess: onSuccess, successTitle: t('continue'),
|
|
14
|
+
return (_jsx(SuccessScreen, { title: t('tax_success_title'), onSuccess: onSuccess, successTitle: t('continue'), loading: loading, error: error || '' }));
|
|
15
15
|
};
|
|
16
16
|
export default React.memo(Success);
|
|
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { memo, useEffect, useState } from 'react';
|
|
13
|
+
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';
|
|
@@ -21,6 +21,7 @@ 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
|
+
import AcceptancePayouts from '../../../shared/AcceptancePayouts';
|
|
24
25
|
var TitleStyled = styled(Text)(function (_a) {
|
|
25
26
|
var theme = _a.theme;
|
|
26
27
|
return (__assign(__assign({}, theme.typography.body1), { fontWeight: theme.typography.fontWeightBold, color: theme.palette.text.primary, marginBlockEnd: theme.spacing(2.375), marginBlockStart: theme.spacing(2.875), lineHeight: 1.75, padding: '0px 20px' }));
|
|
@@ -40,33 +41,41 @@ var ButtonGroupStyled = styled(Box)(function (_a) {
|
|
|
40
41
|
});
|
|
41
42
|
});
|
|
42
43
|
var SuccessWithFlowButtons = function () {
|
|
43
|
-
var _a;
|
|
44
|
+
var _a, _b, _c;
|
|
44
45
|
var t = useTranslation().t;
|
|
45
46
|
var isAr = useLanguage().isAr;
|
|
47
|
+
var _d = React.useState(false), isAcceptance = _d[0], setIsAcceptance = _d[1];
|
|
48
|
+
var _e = React.useState(false), isPayout = _e[0], setIsPayout = _e[1];
|
|
46
49
|
var data = useAppSelector(taxSelector).data;
|
|
47
|
-
var
|
|
48
|
-
var
|
|
50
|
+
var _f = data.verify.responseBody || {}, flows = _f.flows, nameObj = _f.name, entity = _f.entity, brand = _f.brand, bank = _f.bank_account;
|
|
51
|
+
var _g = useState([]), buttons = _g[0], setButtons = _g[1];
|
|
49
52
|
var username = ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.first) || '') + ' ' + ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.last) || '');
|
|
50
53
|
var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
|
|
51
|
-
var bankName = (bank === null || bank === void 0 ? void 0 : bank.
|
|
52
|
-
var iban = (bank === null || bank === void 0 ? void 0 : bank.
|
|
54
|
+
var bankName = (bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
|
|
55
|
+
var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
|
|
53
56
|
var taxID = (entity === null || entity === void 0 ? void 0 : entity.tax_number) || '';
|
|
57
|
+
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) || '';
|
|
54
58
|
var reMapFlowData = function (flows) {
|
|
55
59
|
if (flows === void 0) { flows = []; }
|
|
56
60
|
var images = ICONS_NAMES;
|
|
61
|
+
var statuses = [];
|
|
57
62
|
var mappedFlows = flows.map(function (_a) {
|
|
58
63
|
var name = _a.name, url = _a.url, status = _a.status;
|
|
59
64
|
var type = status === 'initiated' ? 'pending' : 'completed';
|
|
60
65
|
var title = t("".concat(name, "_flow_").concat(type), {
|
|
61
66
|
individual_name: username.toLowerCase(),
|
|
62
|
-
business_type:
|
|
67
|
+
business_type: brandName,
|
|
63
68
|
license_number: t('masking_symbols') + showLastFour(licenseNumber),
|
|
64
69
|
bank_name: bankName,
|
|
65
70
|
iban: t('masking_symbols') + iban,
|
|
66
|
-
tax_id: t('masking_symbols') + taxID
|
|
71
|
+
tax_id: t('masking_symbols') + showLastFour(taxID)
|
|
67
72
|
});
|
|
73
|
+
if ("business_flow_completed" === "".concat(name, "_flow_").concat(type))
|
|
74
|
+
setIsAcceptance(true);
|
|
68
75
|
var isCompleted = status === 'completed' && name !== 'password';
|
|
69
76
|
var isIndividual = name === 'individual';
|
|
77
|
+
if (name !== 'password')
|
|
78
|
+
statuses.push(isCompleted);
|
|
70
79
|
var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
|
|
71
80
|
var hoverSrc = "".concat(name, "_white_icon");
|
|
72
81
|
return {
|
|
@@ -79,11 +88,14 @@ var SuccessWithFlowButtons = function () {
|
|
|
79
88
|
};
|
|
80
89
|
});
|
|
81
90
|
setButtons(mappedFlows);
|
|
91
|
+
var isAllCompleted = statuses.filter(function (status) { return status; }).length === flows.length - 1;
|
|
92
|
+
if (isAllCompleted)
|
|
93
|
+
setIsPayout(true);
|
|
82
94
|
};
|
|
83
95
|
useEffect(function () {
|
|
84
96
|
if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
|
|
85
97
|
reMapFlowData(flows);
|
|
86
98
|
}, [flows, isAr]);
|
|
87
|
-
return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons }) })] }));
|
|
99
|
+
return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons }) })] }));
|
|
88
100
|
};
|
|
89
101
|
export default memo(SuccessWithFlowButtons);
|