@tap-payments/auth-jsconnect 1.0.79 → 1.0.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/build/api/entity.d.ts +1 -2
  2. package/build/assets/locales/ar.json +2 -1
  3. package/build/assets/locales/en.json +2 -1
  4. package/build/constants/app.js +8 -12
  5. package/build/constants/assets.d.ts +1 -0
  6. package/build/constants/assets.js +2 -1
  7. package/build/features/app/bank/bankStore.d.ts +1 -1
  8. package/build/features/app/bank/bankStore.js +40 -41
  9. package/build/features/app/business/businessStore.js +29 -28
  10. package/build/features/app/connect/connectStore.js +9 -7
  11. package/build/features/app/individual/individualStore.d.ts +1 -1
  12. package/build/features/app/individual/individualStore.js +29 -29
  13. package/build/features/app/password/passwordStore.d.ts +1 -1
  14. package/build/features/app/password/passwordStore.js +34 -36
  15. package/build/features/app/tax/taxStore.d.ts +1 -1
  16. package/build/features/app/tax/taxStore.js +34 -35
  17. package/build/features/bank/Bank.js +3 -2
  18. package/build/features/bank/screens/Success/Success.js +2 -2
  19. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +25 -11
  20. package/build/features/business/screens/Success/Success.js +2 -2
  21. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +25 -11
  22. package/build/features/connect/screens/Merchant/Merchant.js +5 -3
  23. package/build/features/connect/screens/Merchant/SocialMedia.js +11 -7
  24. package/build/features/connect/screens/Merchant/validation.js +9 -3
  25. package/build/features/individual/screens/Success/Success.js +2 -2
  26. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +25 -11
  27. package/build/features/password/Password.js +3 -2
  28. package/build/features/password/screens/Success/Success.js +2 -2
  29. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +25 -11
  30. package/build/features/shared/AcceptancePayouts/AcceptancePayouts.d.ts +7 -0
  31. package/build/features/shared/AcceptancePayouts/AcceptancePayouts.js +65 -0
  32. package/build/features/shared/AcceptancePayouts/index.d.ts +2 -0
  33. package/build/features/shared/AcceptancePayouts/index.js +2 -0
  34. package/build/features/shared/Button/Button.d.ts +2 -1
  35. package/build/features/shared/Button/Button.js +4 -2
  36. package/build/features/shared/Button/FlowsButtons.js +22 -7
  37. package/build/features/shared/Button/index.d.ts +1 -1
  38. package/build/features/shared/Button/index.js +1 -1
  39. package/build/features/shared/SuccessScreen/SuccessScreen.d.ts +3 -2
  40. package/build/features/shared/SuccessScreen/SuccessScreen.js +3 -3
  41. package/build/features/tax/Tax.js +3 -2
  42. package/build/features/tax/screens/Success/Success.js +2 -2
  43. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +26 -11
  44. package/package.json +1 -1
@@ -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,9 +21,11 @@ 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) {
26
+ var _b;
25
27
  var theme = _a.theme;
26
- 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' }));
28
+ return (__assign(__assign({}, theme.typography.body1), (_b = { fontWeight: theme.typography.fontWeightBold, color: theme.palette.text.primary, lineHeight: 1.75, paddingBottom: theme.spacing(3) }, _b[theme.breakpoints.down('sm')] = {}, _b)));
27
29
  });
28
30
  var ContainerStyled = styled(Container)(function (_a) {
29
31
  var theme = _a.theme;
@@ -36,37 +38,46 @@ var ContainerStyled = styled(Container)(function (_a) {
36
38
  var ButtonGroupStyled = styled(Box)(function (_a) {
37
39
  var theme = _a.theme;
38
40
  return ({
39
- width: '100%'
41
+ width: '100%',
42
+ paddingTop: theme.spacing(3)
40
43
  });
41
44
  });
42
45
  var SuccessWithFlowButtons = function () {
43
- var _a;
46
+ var _a, _b, _c;
44
47
  var t = useTranslation().t;
45
48
  var isAr = useLanguage().isAr;
49
+ var _d = React.useState(false), isAcceptance = _d[0], setIsAcceptance = _d[1];
50
+ var _e = React.useState(false), isPayout = _e[0], setIsPayout = _e[1];
46
51
  var data = useAppSelector(individualSelector).data;
47
- var _b = data.verify.responseBody || {}, flows = _b.flows, nameObj = _b.name, entity = _b.entity, businessType = _b.business_type, bank = _b.bank;
48
- var _c = useState([]), buttons = _c[0], setButtons = _c[1];
52
+ var _f = data.verify.responseBody || {}, flows = _f.flows, nameObj = _f.name, entity = _f.entity, brand = _f.brand, bank = _f.bank_account;
53
+ var _g = useState([]), buttons = _g[0], setButtons = _g[1];
49
54
  var username = ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.first) || '') + ' ' + ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.last) || '');
50
55
  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.name) || '';
52
- var iban = (bank === null || bank === void 0 ? void 0 : bank.name) || '';
56
+ var bankName = (bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
57
+ var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
53
58
  var taxID = (entity === null || entity === void 0 ? void 0 : entity.tax_number) || '';
59
+ 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
60
  var reMapFlowData = function (flows) {
55
61
  if (flows === void 0) { flows = []; }
56
62
  var images = ICONS_NAMES;
63
+ var statuses = [];
57
64
  var mappedFlows = flows.map(function (_a) {
58
65
  var name = _a.name, url = _a.url, status = _a.status;
59
66
  var type = status === 'initiated' ? 'pending' : 'completed';
60
67
  var title = t("".concat(name, "_flow_").concat(type), {
61
68
  individual_name: username.toLowerCase(),
62
- business_type: businessType,
69
+ business_type: brandName,
63
70
  license_number: t('masking_symbols') + showLastFour(licenseNumber),
64
71
  bank_name: bankName,
65
72
  iban: t('masking_symbols') + iban,
66
- tax_id: t('masking_symbols') + taxID
73
+ tax_id: t('masking_symbols') + showLastFour(taxID)
67
74
  });
75
+ if ("business_flow_completed" === "".concat(name, "_flow_").concat(type))
76
+ setIsAcceptance(true);
68
77
  var isCompleted = status === 'completed' && name !== 'password';
69
78
  var isIndividual = name === 'individual';
79
+ if (name !== 'password')
80
+ statuses.push(isCompleted);
70
81
  var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
71
82
  var hoverSrc = "".concat(name, "_white_icon");
72
83
  return {
@@ -79,11 +90,14 @@ var SuccessWithFlowButtons = function () {
79
90
  };
80
91
  });
81
92
  setButtons(mappedFlows);
93
+ var isAllCompleted = statuses.filter(function (status) { return status; }).length === flows.length;
94
+ if (isAllCompleted)
95
+ setIsPayout(true);
82
96
  };
83
97
  useEffect(function () {
84
98
  if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
85
99
  reMapFlowData(flows);
86
100
  }, [flows, isAr]);
87
- return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons }) })] }));
101
+ return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons }) })] }));
88
102
  };
89
103
  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 loading = useAppSelector(passwordSelector).loading;
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'), disabledSuccessButton: loading }));
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,9 +21,11 @@ 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) {
26
+ var _b;
25
27
  var theme = _a.theme;
26
- 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' }));
28
+ return (__assign(__assign({}, theme.typography.body1), (_b = { fontWeight: theme.typography.fontWeightBold, color: theme.palette.text.primary, lineHeight: 1.75, paddingBottom: theme.spacing(3) }, _b[theme.breakpoints.down('sm')] = {}, _b)));
27
29
  });
28
30
  var ContainerStyled = styled(Container)(function (_a) {
29
31
  var theme = _a.theme;
@@ -36,37 +38,46 @@ var ContainerStyled = styled(Container)(function (_a) {
36
38
  var ButtonGroupStyled = styled(Box)(function (_a) {
37
39
  var theme = _a.theme;
38
40
  return ({
39
- width: '100%'
41
+ width: '100%',
42
+ paddingTop: theme.spacing(3)
40
43
  });
41
44
  });
42
45
  var SuccessWithFlowButtons = function () {
43
- var _a;
46
+ var _a, _b, _c;
44
47
  var t = useTranslation().t;
45
48
  var isAr = useLanguage().isAr;
49
+ var _d = React.useState(false), isAcceptance = _d[0], setIsAcceptance = _d[1];
50
+ var _e = React.useState(false), isPayout = _e[0], setIsPayout = _e[1];
46
51
  var data = useAppSelector(passwordSelector).data;
47
- var _b = data.verify.responseBody || {}, flows = _b.flows, nameObj = _b.name, entity = _b.entity, businessType = _b.business_type, bank = _b.bank;
48
- var _c = useState([]), buttons = _c[0], setButtons = _c[1];
52
+ var _f = data.verify.responseBody || {}, flows = _f.flows, nameObj = _f.name, entity = _f.entity, brand = _f.brand, bank = _f.bank_account;
53
+ var _g = useState([]), buttons = _g[0], setButtons = _g[1];
49
54
  var username = ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.first) || '') + ' ' + ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.last) || '');
50
55
  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.name) || '';
52
- var iban = (bank === null || bank === void 0 ? void 0 : bank.name) || '';
56
+ var bankName = (bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
57
+ var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
53
58
  var taxID = (entity === null || entity === void 0 ? void 0 : entity.tax_number) || '';
59
+ 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
60
  var reMapFlowData = function (flows) {
55
61
  if (flows === void 0) { flows = []; }
56
62
  var images = ICONS_NAMES;
63
+ var statuses = [];
57
64
  var mappedFlows = flows.map(function (_a) {
58
65
  var name = _a.name, url = _a.url, status = _a.status;
59
66
  var type = status === 'initiated' ? 'pending' : 'completed';
60
67
  var title = t("".concat(name, "_flow_").concat(type), {
61
68
  individual_name: username.toLowerCase(),
62
- business_type: businessType,
69
+ business_type: brandName,
63
70
  license_number: t('masking_symbols') + showLastFour(licenseNumber),
64
71
  bank_name: bankName,
65
72
  iban: t('masking_symbols') + iban,
66
- tax_id: t('masking_symbols') + taxID
73
+ tax_id: t('masking_symbols') + showLastFour(taxID)
67
74
  });
75
+ if ("business_flow_completed" === "".concat(name, "_flow_").concat(type))
76
+ setIsAcceptance(true);
68
77
  var isCompleted = status === 'completed' && name !== 'password';
69
78
  var isIndividual = name === 'individual';
79
+ if (name !== 'password')
80
+ statuses.push(isCompleted);
70
81
  var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
71
82
  var hoverSrc = "".concat(name, "_white_icon");
72
83
  return {
@@ -79,11 +90,14 @@ var SuccessWithFlowButtons = function () {
79
90
  };
80
91
  });
81
92
  setButtons(mappedFlows);
93
+ var isAllCompleted = statuses.filter(function (status) { return status; }).length === flows.length;
94
+ if (isAllCompleted)
95
+ setIsPayout(true);
82
96
  };
83
97
  useEffect(function () {
84
98
  if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
85
99
  reMapFlowData(flows);
86
100
  }, [flows, isAr]);
87
- return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons }) })] }));
101
+ return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons }) })] }));
88
102
  };
89
103
  export default memo(SuccessWithFlowButtons);
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ interface AcceptancePayoutsProps {
3
+ showAcceptance: boolean;
4
+ showPayout: boolean;
5
+ }
6
+ declare const AcceptancePayouts: ({ showAcceptance, showPayout }: AcceptancePayoutsProps) => JSX.Element;
7
+ export default AcceptancePayouts;
@@ -0,0 +1,65 @@
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
+ import { useLanguage } from '../../../hooks';
20
+ var BoxStyled = styled(Box, { shouldForwardProp: function (prop) { return prop !== 'enabled'; } })(function (_a) {
21
+ var _b;
22
+ var theme = _a.theme, enabled = _a.enabled, isAr = _a.isAr;
23
+ return (_b = {
24
+ backgroundColor: enabled ? alpha(theme.palette.success.main, 0.1) : alpha(theme.palette.text.primary, 0.1),
25
+ color: enabled ? theme.palette.success.main : alpha(theme.palette.text.primary, 0.6),
26
+ borderRadius: theme.spacing(12.625),
27
+ padding: theme.spacing(0.6, 1, 0.6, 1),
28
+ display: 'flex',
29
+ minHeight: theme.spacing(3.125),
30
+ minWidth: isAr ? theme.spacing(19.3) : theme.spacing(14.5),
31
+ alignItems: 'center'
32
+ },
33
+ _b[theme.breakpoints.down('sm')] = {
34
+ minWidth: theme.spacing(14.5)
35
+ },
36
+ _b);
37
+ });
38
+ var TextStyled = styled(Text)(function (_a) {
39
+ var theme = _a.theme;
40
+ return (__assign(__assign({}, theme.typography.subtitle2), { fontWeight: theme.typography.fontWeightMedium, lineHeight: theme.spacing(2.125) }));
41
+ });
42
+ var TextContainer = styled(Box)(function (_a) {
43
+ var theme = _a.theme;
44
+ return ({
45
+ display: 'flex',
46
+ alignItems: 'center',
47
+ width: '100%',
48
+ justifyContent: 'center',
49
+ paddingInlineStart: theme.spacing(0.6)
50
+ });
51
+ });
52
+ var IconStyled = styled(Icon)(function (_a) {
53
+ var theme = _a.theme;
54
+ return ({
55
+ width: theme.spacing(2),
56
+ height: theme.spacing(2)
57
+ });
58
+ });
59
+ var AcceptancePayouts = function (_a) {
60
+ var showAcceptance = _a.showAcceptance, showPayout = _a.showPayout;
61
+ var t = useTranslation().t;
62
+ var isAr = useLanguage().isAr;
63
+ return (_jsxs(Box, __assign({ sx: { display: 'flex' } }, { children: [_jsxs(BoxStyled, __assign({ isAr: isAr, enabled: showAcceptance, sx: { marginInlineEnd: '10px' } }, { children: [_jsx(IconStyled, { src: showAcceptance ? ICONS_NAMES.SUCCESS : ICONS_NAMES.UNFINISHED }), _jsx(TextContainer, { children: _jsxs(TextStyled, { children: [t('acceptance_btn_text'), " "] }) })] })), _jsxs(BoxStyled, __assign({ isAr: isAr, enabled: showPayout }, { children: [_jsx(IconStyled, { src: showPayout ? ICONS_NAMES.SUCCESS : ICONS_NAMES.UNFINISHED }), _jsx(TextContainer, { children: _jsxs(TextStyled, { children: [t('payouts_btn_text'), " "] }) })] }))] })));
64
+ };
65
+ export default AcceptancePayouts;
@@ -0,0 +1,2 @@
1
+ import AcceptancePayouts from './AcceptancePayouts';
2
+ export default AcceptancePayouts;
@@ -0,0 +1,2 @@
1
+ import AcceptancePayouts from './AcceptancePayouts';
2
+ 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: !btnLoading && _jsx(IconStyled, { isAr: isAr, src: ICONS_NAMES.WHITE_ARROW }) }, props, { children: !btnLoading ? (_jsxs(Text, __assign({ sx: { marginInlineEnd: isBackEnabled ? '-24px' : '-15px' } }, { children: [" ", children] }))) : (_jsx(Loader, { innerColor: 'white', outerColor: 'white', size: 15, toggleAnimation: !!loading })) }))] })] }));
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, { shouldForwardProp: function (prop) { return prop !== 'isCompleted'; } })(function (_a) {
38
- var theme = _a.theme, isCompleted = _a.isCompleted;
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: '13px',
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
- })), '&:disabled': {
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
- disabledSuccessButton?: boolean;
7
+ loading?: boolean;
8
+ error?: string;
8
9
  description?: string;
9
10
  }
10
- declare const _default: React.MemoExoticComponent<({ title, description, showEmailProviders, onSuccess, successTitle, disabledSuccessButton }: ThankYouProps) => JSX.Element>;
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, SuccessButton } from '../../shared/Button';
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, disabledSuccessButton = _a.disabledSuccessButton;
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(SuccessButton, __assign({ disabled: disabledSuccessButton, hideIcon: true, isAr: isAr, onClick: onSuccess }, { children: t(successTitle || 'open_mail_box') })) }))] }));
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 loading = useAppSelector(taxSelector).loading;
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'), disabledSuccessButton: loading }));
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,9 +21,11 @@ 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) {
26
+ var _b;
25
27
  var theme = _a.theme;
26
- 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' }));
28
+ return (__assign(__assign({}, theme.typography.body1), (_b = { fontWeight: theme.typography.fontWeightBold, color: theme.palette.text.primary, lineHeight: 1.75, paddingBottom: theme.spacing(3) }, _b[theme.breakpoints.down('sm')] = {}, _b)));
27
29
  });
28
30
  var ContainerStyled = styled(Container)(function (_a) {
29
31
  var theme = _a.theme;
@@ -36,37 +38,47 @@ var ContainerStyled = styled(Container)(function (_a) {
36
38
  var ButtonGroupStyled = styled(Box)(function (_a) {
37
39
  var theme = _a.theme;
38
40
  return ({
39
- width: '100%'
41
+ width: '100%',
42
+ paddingTop: theme.spacing(3)
40
43
  });
41
44
  });
42
45
  var SuccessWithFlowButtons = function () {
43
- var _a;
46
+ var _a, _b, _c;
44
47
  var t = useTranslation().t;
45
48
  var isAr = useLanguage().isAr;
49
+ var _d = React.useState(false), isAcceptance = _d[0], setIsAcceptance = _d[1];
50
+ var _e = React.useState(false), isPayout = _e[0], setIsPayout = _e[1];
46
51
  var data = useAppSelector(taxSelector).data;
47
- var _b = data.verify.responseBody || {}, flows = _b.flows, nameObj = _b.name, entity = _b.entity, businessType = _b.business_type, bank = _b.bank;
48
- var _c = useState([]), buttons = _c[0], setButtons = _c[1];
52
+ var _f = data.verify.responseBody || {}, flows = _f.flows, nameObj = _f.name, entity = _f.entity, brand = _f.brand, bank = _f.bank_account;
53
+ var _g = useState([]), buttons = _g[0], setButtons = _g[1];
49
54
  var username = ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.first) || '') + ' ' + ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.last) || '');
50
55
  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.name) || '';
52
- var iban = (bank === null || bank === void 0 ? void 0 : bank.name) || '';
56
+ var bankName = (bank === null || bank === void 0 ? void 0 : bank.bank_name) || t('bank');
57
+ var iban = showLastFour((bank === null || bank === void 0 ? void 0 : bank.iban) || '');
53
58
  var taxID = (entity === null || entity === void 0 ? void 0 : entity.tax_number) || '';
59
+ 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
60
  var reMapFlowData = function (flows) {
55
61
  if (flows === void 0) { flows = []; }
56
62
  var images = ICONS_NAMES;
63
+ var statuses = [];
57
64
  var mappedFlows = flows.map(function (_a) {
58
65
  var name = _a.name, url = _a.url, status = _a.status;
59
66
  var type = status === 'initiated' ? 'pending' : 'completed';
60
67
  var title = t("".concat(name, "_flow_").concat(type), {
61
68
  individual_name: username.toLowerCase(),
62
- business_type: businessType,
69
+ business_type: brandName,
63
70
  license_number: t('masking_symbols') + showLastFour(licenseNumber),
64
71
  bank_name: bankName,
65
72
  iban: t('masking_symbols') + iban,
66
- tax_id: t('masking_symbols') + taxID
73
+ tax_id: t('masking_symbols') + showLastFour(taxID)
67
74
  });
75
+ if ("business_flow_completed" === "".concat(name, "_flow_").concat(type))
76
+ setIsAcceptance(true);
68
77
  var isCompleted = status === 'completed' && name !== 'password';
69
78
  var isIndividual = name === 'individual';
79
+ if (name !== 'password')
80
+ if (name !== 'password')
81
+ statuses.push(isCompleted);
70
82
  var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
71
83
  var hoverSrc = "".concat(name, "_white_icon");
72
84
  return {
@@ -79,11 +91,14 @@ var SuccessWithFlowButtons = function () {
79
91
  };
80
92
  });
81
93
  setButtons(mappedFlows);
94
+ var isAllCompleted = statuses.filter(function (status) { return status; }).length === flows.length;
95
+ if (isAllCompleted)
96
+ setIsPayout(true);
82
97
  };
83
98
  useEffect(function () {
84
99
  if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
85
100
  reMapFlowData(flows);
86
101
  }, [flows, isAr]);
87
- return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons }) })] }));
102
+ return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(AcceptancePayouts, { showAcceptance: isAcceptance, showPayout: isPayout }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons }) })] }));
88
103
  };
89
104
  export default memo(SuccessWithFlowButtons);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "1.0.79",
3
+ "version": "1.0.84",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",