@tap-payments/auth-jsconnect 1.0.72 → 1.0.77

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 (70) hide show
  1. package/build/@types/app.d.ts +7 -6
  2. package/build/@types/form.d.ts +2 -2
  3. package/build/api/auth.d.ts +7 -0
  4. package/build/api/auth.js +5 -1
  5. package/build/api/data.d.ts +1 -0
  6. package/build/api/data.js +5 -1
  7. package/build/api/entity.d.ts +1 -0
  8. package/build/api/entity.js +5 -1
  9. package/build/api/index.d.ts +9 -2
  10. package/build/api/index.js +3 -1
  11. package/build/api/individual.d.ts +8 -0
  12. package/build/api/individual.js +9 -0
  13. package/build/components/SimpleList/SimpleList.js +2 -2
  14. package/build/constants/api.d.ts +3 -0
  15. package/build/constants/api.js +10 -4
  16. package/build/constants/app.js +18 -6
  17. package/build/constants/assets.js +1 -1
  18. package/build/features/app/bank/bankStore.d.ts +3 -0
  19. package/build/features/app/bank/bankStore.js +45 -9
  20. package/build/features/app/business/businessStore.d.ts +4 -5
  21. package/build/features/app/business/businessStore.js +90 -54
  22. package/build/features/app/connect/connectStore.d.ts +1 -0
  23. package/build/features/app/connect/connectStore.js +19 -10
  24. package/build/features/app/individual/individualStore.d.ts +7 -1
  25. package/build/features/app/individual/individualStore.js +79 -30
  26. package/build/features/app/password/passwordStore.d.ts +4 -0
  27. package/build/features/app/password/passwordStore.js +71 -15
  28. package/build/features/bank/screens/Success/Success.js +4 -1
  29. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +3 -0
  30. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +87 -0
  31. package/build/features/bank/screens/SuccessWithFlowButtons/index.d.ts +2 -0
  32. package/build/features/bank/screens/SuccessWithFlowButtons/index.js +2 -0
  33. package/build/features/business/screens/Activities/ActivitiesList.d.ts +1 -1
  34. package/build/features/business/screens/Activities/SalesChannels.js +1 -1
  35. package/build/features/business/screens/Activities/validation.d.ts +24 -24
  36. package/build/features/business/screens/Activities/validation.js +2 -2
  37. package/build/features/business/screens/Customers/CustomerLocations.d.ts +1 -1
  38. package/build/features/business/screens/Customers/CustomerLocations.js +2 -2
  39. package/build/features/business/screens/Customers/ExpectedCustomers.js +2 -2
  40. package/build/features/business/screens/Customers/ExpectedSalesRange.js +30 -12
  41. package/build/features/business/screens/Customers/validation.js +2 -2
  42. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +20 -12
  43. package/build/features/connect/screens/Individual/MobileNumber.js +11 -2
  44. package/build/features/connect/screens/Merchant/Merchant.js +9 -2
  45. package/build/features/connect/screens/Mobile/MobileNumber.js +11 -2
  46. package/build/features/featuresScreens.js +10 -0
  47. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +14 -2
  48. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.d.ts +5 -1
  49. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +62 -9
  50. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.d.ts +3 -1
  51. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +5 -9
  52. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +3 -6
  53. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +1 -11
  54. package/build/features/individual/screens/Success/Success.js +4 -1
  55. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +3 -0
  56. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +87 -0
  57. package/build/features/individual/screens/SuccessWithFlowButtons/index.d.ts +2 -0
  58. package/build/features/individual/screens/SuccessWithFlowButtons/index.js +2 -0
  59. package/build/features/password/screens/CreatePassword/CreatePassword.js +9 -10
  60. package/build/features/password/screens/Success/Success.js +6 -0
  61. package/build/features/shared/Button/FlowsButtons.d.ts +2 -0
  62. package/build/features/shared/Button/FlowsButtons.js +2 -2
  63. package/build/features/shared/Input/Input.d.ts +1 -1
  64. package/build/features/shared/Search/Search.d.ts +1 -1
  65. package/build/features/shared/Search/Search.js +2 -14
  66. package/build/utils/array.d.ts +1 -0
  67. package/build/utils/array.js +6 -0
  68. package/build/utils/string.d.ts +1 -0
  69. package/build/utils/string.js +7 -0
  70. package/package.json +1 -1
@@ -13,13 +13,14 @@ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
13
13
  import { memo, useEffect, useState } from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { styled } from '@mui/material/styles';
16
- import Box from '@mui/material/Box';
17
- import Text from '../../../../components/Text';
18
- import Container from '../../../shared/Containers/ScreenContainer';
19
16
  import { FlowsButtons } from '../../../shared/Button';
20
17
  import { ICONS_NAMES } from '../../../../constants';
21
18
  import { useAppSelector, useLanguage } from '../../../../hooks';
22
19
  import { businessSelector } from '../../../app/business/businessStore';
20
+ import { showLastFour } from '../../../../utils';
21
+ import Box from '@mui/material/Box';
22
+ import Text from '../../../../components/Text';
23
+ import Container from '../../../shared/Containers/ScreenContainer';
23
24
  var TitleStyled = styled(Text)(function (_a) {
24
25
  var theme = _a.theme;
25
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' }));
@@ -39,12 +40,17 @@ var ButtonGroupStyled = styled(Box)(function (_a) {
39
40
  });
40
41
  });
41
42
  var SuccessWithFlowButtons = function () {
43
+ var _a;
42
44
  var t = useTranslation().t;
43
45
  var isAr = useLanguage().isAr;
44
46
  var data = useAppSelector(businessSelector).data;
45
- var _a = data.verify.responseBody || {}, flows = _a.flows, nameObj = _a.name;
46
- var _b = useState([]), buttons = _b[0], setButtons = _b[1];
47
+ var _b = data.verify.responseBody || {}, flows = _b.flows, nameObj = _b.name, entity = _b.entity, businessType = _b.business_type, bank = _b.bank, tax = _b.tax_id;
48
+ var _c = useState([]), buttons = _c[0], setButtons = _c[1];
47
49
  var username = ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.first) || '') + ' ' + ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.last) || '');
50
+ 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) || '';
53
+ var taxID = tax || '';
48
54
  var reMapFlowData = function (flows) {
49
55
  if (flows === void 0) { flows = []; }
50
56
  var images = ICONS_NAMES;
@@ -52,14 +58,15 @@ var SuccessWithFlowButtons = function () {
52
58
  var name = _a.name, url = _a.url, status = _a.status;
53
59
  var type = status === 'initiated' ? 'pending' : 'completed';
54
60
  var title = t("".concat(name, "_flow_").concat(type), {
55
- individual_name: username,
56
- business_type: 'placeholder',
57
- license_number: 'xxxxxx0000',
58
- bank_name: 'placeholder',
59
- iban: 'xxxxxx0000',
60
- tax_id: 'xxxxxx0000'
61
+ individual_name: username.toLowerCase(),
62
+ business_type: businessType,
63
+ license_number: t('masking_symbols') + showLastFour(licenseNumber),
64
+ bank_name: bankName,
65
+ iban: t('masking_symbols') + iban,
66
+ tax_id: t('masking_symbols') + taxID
61
67
  });
62
68
  var isCompleted = status === 'completed' && name !== 'password';
69
+ var isIndividual = name === 'individual';
63
70
  var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
64
71
  var hoverSrc = "".concat(name, "_white_icon");
65
72
  return {
@@ -67,7 +74,8 @@ var SuccessWithFlowButtons = function () {
67
74
  href: url,
68
75
  src: images[src],
69
76
  hoverSrc: images[hoverSrc],
70
- isCompleted: isCompleted
77
+ isCompleted: isCompleted,
78
+ sx: isIndividual ? { textTransform: 'capitalize' } : {}
71
79
  };
72
80
  });
73
81
  setButtons(mappedFlows);
@@ -72,6 +72,15 @@ var ExpandIconStyled = styled(ExpandIcon)(function (_a) {
72
72
  marginInlineStart: theme.spacing(1)
73
73
  });
74
74
  });
75
+ var InputStyled = styled(Input)(function (_a) {
76
+ var theme = _a.theme;
77
+ return ({
78
+ direction: 'ltr',
79
+ '& .MuiInputBase-input': {
80
+ cursor: 'auto'
81
+ }
82
+ });
83
+ });
75
84
  var MobileNumber = React.forwardRef(function (_a, ref) {
76
85
  var _b, _c, _d;
77
86
  var countries = _a.countries, rest = __rest(_a, ["countries"]);
@@ -85,7 +94,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
85
94
  var countryCodeValue = countryCodeControl.field.value;
86
95
  var mobileValue = phoneControl.field.value || '';
87
96
  var countryName = (isAr ? (_b = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _b === void 0 ? void 0 : _b.arabic : (_c = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _c === void 0 ? void 0 : _c.english) || '';
88
- var error = (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message;
97
+ var error = !!mobileValue ? (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message : '';
89
98
  var isSA = countryCodeValue.iso2 === 'SA';
90
99
  var mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
91
100
  var isStartsWith5 = mobileValue.startsWith('5');
@@ -130,7 +139,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
130
139
  });
131
140
  setCountries(filteredCountries);
132
141
  };
133
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 3 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(Input, { sx: { direction: 'ltr' }, inputProps: { maxLength: requiredLen }, type: 'tel', onChange: onPhoneNumberChange, 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: error && t(error, { length: requiredLen, number: '05|5' }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
142
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 3 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredLen }, type: 'tel', disabled: !!anchorEl, onChange: onPhoneNumberChange, 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: error && t(error, { length: requiredLen, number: '05|5' }) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
134
143
  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, {})] }));
135
144
  } })] }))] })) })));
136
145
  });
@@ -69,18 +69,25 @@ var Merchant = function (_a) {
69
69
  methods.setError('brandName', { message: 'Profile Name already exists' });
70
70
  }, [responseBody]);
71
71
  React.useEffect(function () {
72
+ var _a, _b;
72
73
  if (isNewUser === true) {
73
74
  setUserType(ValidationOptions.NEW_USER);
74
75
  }
75
76
  if (isNewUser === false && methods.getValues('selectedBrandItem').id === 'other') {
76
77
  setUserType(ValidationOptions.EXISTING_USER_WITH_OTHER_BRAND);
77
78
  methods.clearErrors();
78
- setTimeout(function () { return methods.setValue('brandName', '', { shouldValidate: true }); }, 100);
79
+ setTimeout(function () {
80
+ var sites = { website: '', twitter: '', instagram: '' };
81
+ methods.setValue('brandName', '', { shouldValidate: true });
82
+ methods.setValue('links', sites);
83
+ }, 100);
79
84
  }
80
85
  if (isNewUser === false && methods.getValues('selectedBrandItem').id !== 'other') {
81
86
  setUserType(ValidationOptions.EXISTING_USER_WITH_EXIST_BRAND);
82
87
  methods.clearErrors();
83
- var sites_1 = __assign(__assign({}, links), { website: selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.website });
88
+ var twitter = ((_a = selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.social) === null || _a === void 0 ? void 0 : _a.find(function (item) { return item.includes('twitter.com'); })) || '';
89
+ var instagram = ((_b = selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.social) === null || _b === void 0 ? void 0 : _b.find(function (item) { return item.includes('instagram.com'); })) || '';
90
+ var sites_1 = __assign(__assign({}, links), { website: selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.website, twitter: twitter, instagram: instagram });
84
91
  setTimeout(function () { return methods.setValue('links', sites_1, { shouldValidate: true }); }, 100);
85
92
  }
86
93
  }, [methods.getValues('selectedBrandItem'), isNewUser]);
@@ -73,6 +73,15 @@ var ExpandIconStyled = styled(ExpandIcon)(function (_a) {
73
73
  marginInlineStart: theme.spacing(1)
74
74
  });
75
75
  });
76
+ var InputStyled = styled(Input)(function (_a) {
77
+ var theme = _a.theme;
78
+ return ({
79
+ direction: 'ltr',
80
+ '& .MuiInputBase-input': {
81
+ cursor: 'auto'
82
+ }
83
+ });
84
+ });
76
85
  var MobileNumber = React.forwardRef(function (_a, ref) {
77
86
  var _b, _c, _d;
78
87
  var countries = _a.countries, rest = __rest(_a, ["countries"]);
@@ -87,7 +96,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
87
96
  var countryCodeValue = countryCodeControl.field.value;
88
97
  var mobileValue = phoneControl.field.value || '';
89
98
  var countryName = (isAr ? (_b = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _b === void 0 ? void 0 : _b.arabic : (_c = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.name) === null || _c === void 0 ? void 0 : _c.english) || '';
90
- var error = (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message;
99
+ var error = !!mobileValue ? (_d = phoneControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message : '';
91
100
  var isSA = countryCodeValue.iso2 === 'SA';
92
101
  var mobileLen = countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.digits;
93
102
  var isStartsWith5 = mobileValue.startsWith('5');
@@ -132,7 +141,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
132
141
  });
133
142
  setCountries(filteredCountries);
134
143
  };
135
- 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(Input, { sx: { direction: 'ltr' }, inputProps: { maxLength: requiredLen }, type: 'tel', required: true, 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, { list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
144
+ 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, 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) {
136
145
  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, {})] }));
137
146
  } })] }))] })) })));
138
147
  });
@@ -18,9 +18,11 @@ import SuccessPasswordPage from './password/screens/Success';
18
18
  import IndividualVerifyPage from './individual/screens/Verify';
19
19
  import AdditionalIndividualInfoPage from './individual/screens/AdditionalIndividualInfo';
20
20
  import SuccessOwnerPage from './individual/screens/Success';
21
+ import IndividualSuccessWithFlowPage from './individual/screens/SuccessWithFlowButtons';
21
22
  import BankVerifyPage from './bank/screens/Verify';
22
23
  import BankDetailsPage from './bank/screens/BankDetails';
23
24
  import BankSuccessPage from './bank/screens/Success';
25
+ import BankSuccessWithFlowPage from './bank/screens/SuccessWithFlowButtons';
24
26
  import TaxVerifyPage from './tax/screens/Verify';
25
27
  import TaxDetailsPage from './tax/screens/TaxDetails';
26
28
  import TaxSuccessPage from './tax/screens/Success';
@@ -105,6 +107,10 @@ export var individualFeatureScreens = [
105
107
  {
106
108
  name: 'INDIVIDUAL_SUCCESS_STEP',
107
109
  element: SuccessOwnerPage
110
+ },
111
+ {
112
+ name: 'INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
113
+ element: IndividualSuccessWithFlowPage
108
114
  }
109
115
  ];
110
116
  export var bankFeatureScreens = [
@@ -119,6 +125,10 @@ export var bankFeatureScreens = [
119
125
  {
120
126
  name: 'BANK_DETAILS_SUCCESS_STEP',
121
127
  element: BankSuccessPage
128
+ },
129
+ {
130
+ name: 'BANK_SUCCESS_FOUR_FLOWS_BUTTONS_STEP',
131
+ element: BankSuccessWithFlowPage
122
132
  }
123
133
  ];
124
134
  export var taxFeatureScreens = [
@@ -53,6 +53,12 @@ var ButtonStyled = styled(Button)(function (_a) {
53
53
  marginBlockStart: theme.spacing(-5)
54
54
  });
55
55
  });
56
+ var ListType;
57
+ (function (ListType) {
58
+ ListType["SourceOfIncomeList"] = "SourceOfIncomeList";
59
+ ListType["EmployerLocationList"] = "EmployerLocationList";
60
+ ListType["MonthlyIncomeList"] = "MonthlyIncomeList";
61
+ })(ListType || (ListType = {}));
56
62
  var AdditionalIndividualInfo = function (_a) {
57
63
  var t = useTranslation().t;
58
64
  var isAr = useLanguage().isAr;
@@ -63,7 +69,7 @@ var AdditionalIndividualInfo = function (_a) {
63
69
  defaultValues: data.individualData,
64
70
  mode: 'onChange'
65
71
  });
66
- var _c = React.useState(false), listActive = _c[0], setListActive = _c[1];
72
+ var _c = React.useState(), listActive = _c[0], setListActive = _c[1];
67
73
  var _d = React.useState(false), employerFieldsActive = _d[0], setEmployerFieldsActive = _d[1];
68
74
  React.useEffect(function () {
69
75
  var _a, _b;
@@ -84,7 +90,13 @@ var AdditionalIndividualInfo = function (_a) {
84
90
  var onBack = function () {
85
91
  dispatch(handlePrevScreenStep());
86
92
  };
87
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(InputsContainerStyled, __assign({ listActive: listActive }, { children: [_jsx(SourceOfIncome, { show: !listActive }), _jsx(MonthlyIncome, { show: !listActive }), _jsx(EmployerName, { show: !listActive && employerFieldsActive }), _jsx(EmployerLocation, { show: employerFieldsActive, countries: data.countries, onListOpen: function () { return setListActive(true); }, onListClose: function () { return setListActive(false); } }), _jsx(PEPSwitch, { show: !listActive }), _jsx(InfluencerSwitch, { show: !listActive })] })), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(ButtonStyled, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
93
+ var handleMenuClick = function (flag) {
94
+ setListActive(flag);
95
+ };
96
+ var isSourceOfIncomeListActive = listActive === ListType.SourceOfIncomeList;
97
+ var isEmployerLocationListActive = listActive === ListType.EmployerLocationList;
98
+ var isMonthlyIncomeListActive = listActive === ListType.MonthlyIncomeList;
99
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(InputsContainerStyled, __assign({ listActive: !!listActive }, { 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(ButtonStyled, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
88
100
  };
89
101
  export default React.memo(AdditionalIndividualInfo);
90
102
  AdditionalIndividualInfo.defaultProps = {};
@@ -1,6 +1,10 @@
1
1
  import * as React from 'react';
2
+ import { MonthlyIncome as MonthlyIncomeType } from '../../../../@types';
2
3
  interface MonthlyIncomeProps {
3
4
  show: boolean;
5
+ onSelectSource?: (country: MonthlyIncomeType) => void;
6
+ onListOpen?: () => void;
7
+ onListClose?: () => void;
4
8
  }
5
- declare const _default: React.MemoExoticComponent<({ show }: MonthlyIncomeProps) => JSX.Element>;
9
+ declare const _default: React.MemoExoticComponent<({ ...rest }: MonthlyIncomeProps) => JSX.Element>;
6
10
  export default _default;
@@ -9,28 +9,81 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { jsx as _jsx } from "react/jsx-runtime";
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";
13
24
  import * as React from 'react';
14
25
  import { useTranslation } from 'react-i18next';
15
26
  import { useController, useFormContext } from 'react-hook-form';
16
- import { removeAllCharsFromNumber } from '../../../../utils';
27
+ import Box from '@mui/material/Box';
28
+ import { styled } from '@mui/material/styles';
17
29
  import { ScreenContainer } from '../../../shared/Containers';
18
30
  import Input from '../../../shared/Input';
19
31
  import CheckIcon from '../../../shared/CheckIcon';
20
32
  import Collapse from '../../../../components/Collapse';
33
+ import { useAppSelector, useLanguage } from '../../../../hooks';
34
+ import { individualSelector } from '../../../app/individual/individualStore';
35
+ import Text from '../../../../components/Text';
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
+ });
21
53
  var MonthlyIncome = function (_a) {
22
54
  var _b;
23
- var show = _a.show;
55
+ var rest = __rest(_a, []);
56
+ var _c = React.useState([]), incomeList = _c[0], setIncomeList = _c[1];
57
+ var _d = React.useState(null), anchorEl = _d[0], setAnchorEl = _d[1];
24
58
  var t = useTranslation().t;
59
+ var isAr = useLanguage().isAr;
60
+ var data = useAppSelector(individualSelector).data;
25
61
  var control = useFormContext().control;
62
+ var monthlyIncomeList = (data.individualData.responseBody || {}).monthlyIncomeList;
26
63
  var monthlyIncomeControl = useController({ control: control, name: 'monthlyIncome' });
27
- var handleMonthlyIncomeChange = function (_a) {
28
- var target = _a.target;
29
- var value = removeAllCharsFromNumber(target.value);
30
- monthlyIncomeControl.field.onChange(value);
64
+ React.useEffect(function () {
65
+ if ((monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.length) > 0) {
66
+ setIncomeList(monthlyIncomeList);
67
+ }
68
+ }, [monthlyIncomeList]);
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 (source) {
80
+ onCloseList();
81
+ monthlyIncomeControl.field.onChange(source);
31
82
  };
32
- var monthlyIncomeValue = monthlyIncomeControl.field.value;
83
+ var income = monthlyIncomeControl.field.value;
33
84
  var error = (_b = monthlyIncomeControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
34
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { label: t('please_enter_actual_income'), onChange: handleMonthlyIncomeChange, value: monthlyIncomeValue, endAdornment: monthlyIncomeValue && _jsx(CheckIcon, {}), placeholder: '0', warningType: 'alert', warningMessage: error && t(error) }) }) })));
85
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 0 } }, { children: [_jsx(Input, { label: t('please_enter_actual_income'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_source_of_income'), value: (isAr ? income === null || income === void 0 ? void 0 : income.name_ar : income === null || income === void 0 ? void 0 : income.name_en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name_en', list: incomeList, onSelectItem: onSelectItem, renderItem: function (item) {
86
+ return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (income === null || income === void 0 ? void 0 : income.id) }, { children: isAr ? item.name_ar : item === null || item === void 0 ? void 0 : item.name_en })) }), item.id === (income === null || income === void 0 ? void 0 : income.id) && _jsx(CheckIconStyled, {})] }));
87
+ } }) }))] })) })));
35
88
  };
36
89
  export default React.memo(MonthlyIncome);
@@ -2,7 +2,9 @@ import * as React from 'react';
2
2
  import { SourceOfIncome as SourceOfIncomeType } from '../../../../@types';
3
3
  interface SourceOfIncomeProps {
4
4
  show: boolean;
5
- onSelectSource?: (country: SourceOfIncomeType) => void;
5
+ onSelectSource?: (source: SourceOfIncomeType) => void;
6
+ onListOpen?: () => void;
7
+ onListClose?: () => void;
6
8
  }
7
9
  declare const _default: React.MemoExoticComponent<({ ...rest }: SourceOfIncomeProps) => JSX.Element>;
8
10
  export default _default;
@@ -38,14 +38,6 @@ import SimpleList from '../../../../components/SimpleList';
38
38
  var Container = styled(Box)(function () { return ({
39
39
  display: 'flex'
40
40
  }); });
41
- var SimpleListStyled = styled((SimpleList))(function (_a) {
42
- var theme = _a.theme;
43
- return ({
44
- height: 'fit-content',
45
- backgroundColor: theme.palette.common.white,
46
- borderBottom: "".concat(theme.spacing(0.125), " solid ").concat(theme.palette.divider)
47
- });
48
- });
49
41
  var IncomeText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
50
42
  var theme = _a.theme, isSelected = _a.isSelected;
51
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) }));
@@ -75,10 +67,14 @@ var SourceOfIncome = function (_a) {
75
67
  }
76
68
  }, [sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.sourceIncome]);
77
69
  var onOpenList = function (event) {
70
+ var _a;
78
71
  setAnchorEl(event.currentTarget);
72
+ (_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
79
73
  };
80
74
  var onCloseList = function () {
75
+ var _a;
81
76
  setAnchorEl(null);
77
+ (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
82
78
  };
83
79
  var onSelectItem = function (source) {
84
80
  onCloseList();
@@ -86,7 +82,7 @@ var SourceOfIncome = function (_a) {
86
82
  };
87
83
  var source = sourceIncomeControl.field.value;
88
84
  var error = (_c = sourceIncomeControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
89
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 2.5 } }, { children: [_jsx(Input, { required: true, label: t('tap_js_source_of_income'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_source_of_income'), value: (isAr ? source === null || source === void 0 ? void 0 : source.name_ar : source === null || source === void 0 ? void 0 : source.name_en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name_en', list: sourceList, onSelectItem: onSelectItem, renderItem: function (item) {
85
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 2.5 } }, { children: [_jsx(Input, { required: true, label: t('tap_js_source_of_income'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_source_of_income'), value: (isAr ? source === null || source === void 0 ? void 0 : source.name_ar : source === null || source === void 0 ? void 0 : source.name_en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name_en', list: sourceList, onSelectItem: onSelectItem, renderItem: function (item) {
90
86
  return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (source === null || source === void 0 ? void 0 : source.id) }, { children: isAr ? item.name_ar : item === null || item === void 0 ? void 0 : item.name_en })) }), item.id === (source === null || source === void 0 ? void 0 : source.id) && _jsx(CheckIconStyled, {})] }));
91
87
  } }) }))] })) })));
92
88
  };
@@ -3,22 +3,19 @@ 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
5
  sourceIncome: import("yup/lib/object").RequiredObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
6
- monthlyIncome: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
7
- employerName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
6
+ monthlyIncome: import("yup/lib/object").OptionalObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
8
7
  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>>>>>;
9
8
  isPEP: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
10
9
  isInfluencer: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
11
10
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<ObjectShape, {
12
11
  sourceIncome: import("yup/lib/object").RequiredObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
13
- monthlyIncome: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
14
- employerName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
12
+ monthlyIncome: import("yup/lib/object").OptionalObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
15
13
  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>>>>>;
16
14
  isPEP: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
17
15
  isInfluencer: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
18
16
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<ObjectShape, {
19
17
  sourceIncome: import("yup/lib/object").RequiredObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
20
- monthlyIncome: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
21
- employerName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
18
+ monthlyIncome: import("yup/lib/object").OptionalObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
22
19
  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>>>>>;
23
20
  isPEP: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
24
21
  isInfluencer: import("yup/lib/boolean").RequiredBooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject>;
@@ -1,17 +1,7 @@
1
1
  import * as yup from 'yup';
2
- import { REGEX_FULL_NAME } from '../../../../constants';
3
2
  export var IndividualInfoValidationSchema = yup.object().shape({
4
3
  sourceIncome: yup.object().required('choose_any_source_of_income'),
5
- monthlyIncome: yup.string().optional(),
6
- employerName: yup.string().when('sourceIncome', function (sourceIncomeValue) {
7
- var _a;
8
- if (((_a = sourceIncomeValue === null || sourceIncomeValue === void 0 ? void 0 : sourceIncomeValue.title) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'salary') {
9
- return yup.string().matches(REGEX_FULL_NAME, 'employer_name_invalid').required('please_enter_employer_name');
10
- }
11
- else {
12
- return yup.string().optional();
13
- }
14
- }),
4
+ monthlyIncome: yup.object().optional(),
15
5
  employerLocation: yup.object().when('sourceIncome', function (sourceIncome) {
16
6
  var _a;
17
7
  if (((_a = sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome.title) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'salary') {
@@ -4,13 +4,16 @@ import { useTranslation } from 'react-i18next';
4
4
  import { useAppDispatch } from '../../../../hooks';
5
5
  import { updateLeadSuccess } from '../../../app/individual/individualStore';
6
6
  import SuccessScreen from '../../../shared/SuccessScreen';
7
+ import { handleNextScreenStep } from '../../../../app/settings';
7
8
  var Success = function (_a) {
8
9
  var t = useTranslation().t;
9
10
  var dispatch = useAppDispatch();
10
11
  React.useEffect(function () {
11
12
  dispatch(updateLeadSuccess());
12
13
  }, []);
13
- var onSuccess = function () { };
14
+ var onSuccess = function () {
15
+ dispatch(handleNextScreenStep());
16
+ };
14
17
  return _jsx(SuccessScreen, { title: t('individual_success_title'), onSuccess: onSuccess, successTitle: t('continue') });
15
18
  };
16
19
  export default React.memo(Success);
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const _default: React.MemoExoticComponent<() => JSX.Element>;
3
+ export default _default;
@@ -0,0 +1,87 @@
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 { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
13
+ import { memo, useEffect, useState } from 'react';
14
+ import { useTranslation } from 'react-i18next';
15
+ import { styled } from '@mui/material/styles';
16
+ import { FlowsButtons } from '../../../shared/Button';
17
+ import { ICONS_NAMES } from '../../../../constants';
18
+ import { useAppSelector, useLanguage } from '../../../../hooks';
19
+ import { showLastFour } from '../../../../utils';
20
+ import { individualSelector } from '../../../app/individual/individualStore';
21
+ import Box from '@mui/material/Box';
22
+ import Text from '../../../../components/Text';
23
+ import Container from '../../../shared/Containers/ScreenContainer';
24
+ var TitleStyled = styled(Text)(function (_a) {
25
+ 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' }));
27
+ });
28
+ var ContainerStyled = styled(Container)(function (_a) {
29
+ var theme = _a.theme;
30
+ return ({
31
+ justifyContent: 'space-between',
32
+ minHeight: theme.spacing(30),
33
+ alignItems: 'center'
34
+ });
35
+ });
36
+ var ButtonGroupStyled = styled(Box)(function (_a) {
37
+ var theme = _a.theme;
38
+ return ({
39
+ width: '100%'
40
+ });
41
+ });
42
+ var SuccessWithFlowButtons = function () {
43
+ var _a;
44
+ var t = useTranslation().t;
45
+ var isAr = useLanguage().isAr;
46
+ 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, tax = _b.tax_id;
48
+ var _c = useState([]), buttons = _c[0], setButtons = _c[1];
49
+ var username = ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.first) || '') + ' ' + ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.last) || '');
50
+ var licenseNumber = ((_a = 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) || '';
53
+ var taxID = tax || '';
54
+ var reMapFlowData = function (flows) {
55
+ if (flows === void 0) { flows = []; }
56
+ var images = ICONS_NAMES;
57
+ var mappedFlows = flows.map(function (_a) {
58
+ var name = _a.name, url = _a.url, status = _a.status;
59
+ var type = status === 'initiated' ? 'pending' : 'completed';
60
+ var title = t("".concat(name, "_flow_").concat(type), {
61
+ individual_name: username,
62
+ business_type: businessType,
63
+ license_number: t('masking_symbols') + showLastFour(licenseNumber),
64
+ bank_name: bankName,
65
+ iban: t('masking_symbols') + iban,
66
+ tax_id: t('masking_symbols') + taxID
67
+ });
68
+ var isCompleted = status === 'completed' && name !== 'password';
69
+ var src = isCompleted ? "".concat(name, "_green_icon") : "".concat(name, "_filled_icon");
70
+ var hoverSrc = "".concat(name, "_white_icon");
71
+ return {
72
+ title: title,
73
+ href: url,
74
+ src: images[src],
75
+ hoverSrc: images[hoverSrc],
76
+ isCompleted: isCompleted
77
+ };
78
+ });
79
+ setButtons(mappedFlows);
80
+ };
81
+ useEffect(function () {
82
+ if ((flows === null || flows === void 0 ? void 0 : flows.length) > 0)
83
+ reMapFlowData(flows);
84
+ }, [flows, isAr]);
85
+ return (_jsxs(ContainerStyled, { children: [_jsxs(TitleStyled, { children: [t('account_details'), " "] }), _jsx(ButtonGroupStyled, { children: _jsx(FlowsButtons, { buttons: buttons }) })] }));
86
+ };
87
+ export default memo(SuccessWithFlowButtons);
@@ -0,0 +1,2 @@
1
+ import SuccessWithFlowButtons from './SuccessWithFlowButtons';
2
+ export default SuccessWithFlowButtons;
@@ -0,0 +1,2 @@
1
+ import SuccessWithFlowButtons from './SuccessWithFlowButtons';
2
+ export default SuccessWithFlowButtons;