@tap-payments/auth-jsconnect 2.4.5-test → 2.4.10-test

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 (36) hide show
  1. package/build/@types/app.d.ts +27 -0
  2. package/build/features/bank/screens/BankDetails/BankDetails.js +16 -12
  3. package/build/features/bank/screens/BankDetails/BankStatement.js +2 -1
  4. package/build/features/business/screens/Activities/ActivitiesList.d.ts +0 -14
  5. package/build/features/business/screens/Activities/ActivitiesList.js +2 -10
  6. package/build/features/business/screens/BusinessType/EntityName.js +2 -3
  7. package/build/features/business/screens/CivilID/IDNumber.js +2 -3
  8. package/build/features/business/screens/Customers/CustomerLocations.d.ts +2 -26
  9. package/build/features/business/screens/Customers/CustomerLocations.js +2 -10
  10. package/build/features/business/screens/Customers/ExpectedCustomers.js +4 -3
  11. package/build/features/business/screens/Customers/ExpectedSalesRange.js +6 -5
  12. package/build/features/business/screens/IDBOD/ID.js +2 -3
  13. package/build/features/connect/screens/CivilID/CivilID.js +5 -13
  14. package/build/features/connect/screens/CivilID/IDNumber.js +5 -6
  15. package/build/features/connect/screens/Individual/Email.js +8 -10
  16. package/build/features/connect/screens/Individual/MobileNumber.js +6 -9
  17. package/build/features/connect/screens/Individual/Name.js +11 -15
  18. package/build/features/connect/screens/Merchant/BrandName.js +2 -4
  19. package/build/features/connect/screens/Merchant/Segments.js +2 -10
  20. package/build/features/connect/screens/Merchant/TeamSize.js +10 -18
  21. package/build/features/connect/screens/Mobile/MobileNumber.js +6 -9
  22. package/build/features/connect/screens/NID/IDNumber.js +6 -7
  23. package/build/features/connectExpress/screens/CivilID/IDNumber.js +6 -7
  24. package/build/features/connectExpress/screens/CivilIDMissed/IDNumber.js +6 -7
  25. package/build/features/connectExpress/screens/CollectBusinessInfo/BrandName.js +3 -5
  26. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +1 -1
  27. package/build/features/connectExpress/screens/CollectIndividualInfo/Email.js +2 -4
  28. package/build/features/connectExpress/screens/CollectIndividualInfo/Name.js +2 -3
  29. package/build/features/connectExpress/screens/NID/IDNumber.js +2 -3
  30. package/build/features/connectExpress/screens/NIDMissed/IDNumber.js +2 -3
  31. package/build/features/tax/screens/TaxDetails/TaxDetails.js +8 -5
  32. package/build/features/tax/screens/TaxDetails/TaxDocument.js +8 -2
  33. package/build/features/tax/screens/TaxDetails/VATId.d.ts +2 -1
  34. package/build/features/tax/screens/TaxDetails/VATId.js +3 -5
  35. package/build/utils/array.js +1 -1
  36. package/package.json +1 -1
@@ -12,22 +12,18 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import * as React from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
- import { ScreenContainer } from '../../../shared/Containers';
16
- import Input from '../../../shared/Input';
17
- import { removeAllOtherThanAlphabetAndSpace } from '../../../../utils';
18
15
  import { useController, useFormContext } from 'react-hook-form';
19
- import ClearIcon from '../../../shared/ClearIcon';
20
- import CheckIcon from '../../../shared/CheckIcon';
21
- import Collapse from '../../../../components/Collapse';
22
16
  import { styled } from '@mui/material/styles';
23
- var InputStyled = styled(Input)(function (_a) {
24
- var theme = _a.theme;
25
- return ({
26
- input: {
27
- textTransform: 'capitalize'
28
- }
29
- });
30
- });
17
+ import { ScreenContainer } from '../../../shared/Containers';
18
+ import Collapse from '../../../../components/Collapse';
19
+ import { removeAllOtherThanAlphabetAndSpace } from '../../../../utils';
20
+ import Input from '../../../shared/Input';
21
+ import { EndAdornment } from '../../../shared/EndAdornment';
22
+ var InputStyled = styled(Input)(function () { return ({
23
+ input: {
24
+ textTransform: 'capitalize'
25
+ }
26
+ }); });
31
27
  var Name = function (_a) {
32
28
  var _b;
33
29
  var show = _a.show;
@@ -43,6 +39,6 @@ var Name = function (_a) {
43
39
  var clearNumber = function () {
44
40
  nameControl.field.onChange('');
45
41
  };
46
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mb: 3, mt: 2.5 } }, { children: _jsx(InputStyled, { label: t('signup_merchant_name_label'), value: nameValue, onChange: handleNameChange, placeholder: t('signup_merchant_name_label'), warningType: 'alert', warningMessage: error && t(error), endAdornment: !error && nameValue ? _jsx(CheckIcon, {}) : nameValue && _jsx(ClearIcon, { onClick: clearNumber }) }) })) })));
42
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mb: 3, mt: 2.5 } }, { children: _jsx(InputStyled, { label: t('signup_merchant_name_label'), value: nameValue, onChange: handleNameChange, placeholder: t('signup_merchant_name_label'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: nameValue, error: error, onClear: clearNumber }) }) })) })));
47
43
  };
48
44
  export default React.memo(Name);
@@ -55,16 +55,14 @@ import { styled, alpha } from '@mui/material/styles';
55
55
  import InfoIcon from '@mui/icons-material/Info';
56
56
  import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
57
57
  import { ScreenContainer } from '../../../shared/Containers';
58
- import CircularProgress from '@mui/material/CircularProgress';
59
58
  import Text from '../../../../components/Text';
60
59
  import Input from '../../../shared/Input';
61
- import ClearIcon from '../../../shared/ClearIcon';
62
60
  import Tooltip from '../../../../components/Tooltip';
63
61
  import Collapse from '../../../../components/Collapse';
64
- import CheckIcon from '../../../shared/CheckIcon';
65
62
  import { checkBrandNameAvailability, connectSelector } from '../../../app/connect/connectStore';
66
63
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
67
64
  import { debounce } from 'lodash-es';
65
+ import { EndAdornment } from '../../../shared/EndAdornment';
68
66
  var LabelContainerStyled = styled(Box)(function (_a) {
69
67
  var theme = _a.theme;
70
68
  return ({
@@ -137,6 +135,6 @@ var BrandName = function (_a) {
137
135
  var clearBrandName = function () {
138
136
  brandControl.field.onChange('');
139
137
  };
140
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('signup_brand_name_label') }), _jsx(Tooltip, __assign({ title: t('brand_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(Input, { onChange: handleBrandNameChange, value: brandNameValue || '', placeholder: t('signup_brand_name_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: brandNameChecking ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : !error && brandNameValue ? (_jsx(CheckIcon, {})) : (brandNameValue && _jsx(ClearIcon, { onClick: clearBrandName })) })] })) })));
138
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('signup_brand_name_label') }), _jsx(Tooltip, __assign({ title: t('brand_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(Input, { onChange: handleBrandNameChange, value: brandNameValue || '', placeholder: t('signup_brand_name_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: brandNameValue, loading: brandNameChecking, error: error, onClear: clearBrandName }) })] })) })));
141
139
  };
142
140
  export default React.memo(BrandName);
@@ -20,10 +20,10 @@ import { useTranslation } from 'react-i18next';
20
20
  import { useController, useFormContext } from 'react-hook-form';
21
21
  import SimpleList from '../../../../components/SimpleList';
22
22
  import ExpandIcon from '../../../../components/ExpandIcon';
23
+ import CheckIcon from '../../../shared/CheckIcon';
23
24
  import Box from '@mui/material/Box';
24
25
  import { styled } from '@mui/material/styles';
25
26
  import Text from '../../../../components/Text';
26
- import CheckIcon from '@mui/icons-material/Check';
27
27
  var InputStyled = styled(Input)(function () { return ({
28
28
  '& .MuiInputBase-input': {
29
29
  cursor: 'pointer'
@@ -33,14 +33,6 @@ var IncomeText = styled(Text, { shouldForwardProp: function (prop) { return prop
33
33
  var theme = _a.theme, isSelected = _a.isSelected;
34
34
  return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25), textAlign: 'start' }));
35
35
  });
36
- var CheckIconStyled = styled(CheckIcon)(function (_a) {
37
- var theme = _a.theme;
38
- return ({
39
- color: theme.palette.success.main,
40
- display: 'flex',
41
- alignItems: 'flex-end'
42
- });
43
- });
44
36
  var Segments = function (_a) {
45
37
  var _b, _c, _d, _e;
46
38
  var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose;
@@ -73,7 +65,7 @@ var Segments = function (_a) {
73
65
  };
74
66
  return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsx(InputStyled, { required: true, label: t('segment_title'), onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_segment'), value: (isAr ? (_d = segment === null || segment === void 0 ? void 0 : segment.name) === null || _d === void 0 ? void 0 : _d.ar : (_e = segment === null || segment === void 0 ? void 0 : segment.name) === null || _e === void 0 ? void 0 : _e.en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.en', searchValuePath: ['name.ar', 'name.en'], list: segmentList, onSelectItem: onSelectItem, renderItem: function (item) {
75
67
  var _a, _b;
76
- return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (segment === null || segment === void 0 ? void 0 : segment.id) }, { children: isAr ? (_a = item === null || item === void 0 ? void 0 : item.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.en })) })), item.id === (segment === null || segment === void 0 ? void 0 : segment.id) && _jsx(CheckIconStyled, {})] }));
68
+ return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (segment === null || segment === void 0 ? void 0 : segment.id) }, { children: isAr ? (_a = item === null || item === void 0 ? void 0 : item.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.en })) })), item.id === (segment === null || segment === void 0 ? void 0 : segment.id) && _jsx(CheckIcon, {})] }));
77
69
  } }) }))] })) })));
78
70
  };
79
71
  export default Segments;
@@ -10,20 +10,20 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { connectSelector } from '../../../app/connect/connectStore';
14
- import Box from '@mui/material/Box';
15
- import Collapse from '../../../../components/Collapse';
16
- import { ScreenContainer } from '../../../../features/shared/Containers';
17
- import Input from '../../../../features/shared/Input';
18
- import { useAppSelector, useLanguage } from '../../../../hooks';
19
13
  import React from 'react';
20
- import { useTranslation } from 'react-i18next';
21
14
  import { useController, useFormContext } from 'react-hook-form';
15
+ import { useTranslation } from 'react-i18next';
16
+ import Box from '@mui/material/Box';
17
+ import { styled } from '@mui/material/styles';
18
+ import { useAppSelector, useLanguage } from '../../../../hooks';
22
19
  import SimpleList from '../../../../components/SimpleList';
23
20
  import ExpandIcon from '../../../../components/ExpandIcon';
24
- import { styled } from '@mui/material/styles';
21
+ import Collapse from '../../../../components/Collapse';
25
22
  import Text from '../../../../components/Text';
26
- import CheckIcon from '@mui/icons-material/Check';
23
+ import { connectSelector } from '../../../app/connect/connectStore';
24
+ import { ScreenContainer } from '../../../shared/Containers';
25
+ import Input from '../../../shared/Input';
26
+ import CheckIcon from '../../../shared/CheckIcon';
27
27
  var InputStyled = styled(Input)(function () { return ({
28
28
  '& .MuiInputBase-input': {
29
29
  cursor: 'pointer'
@@ -33,14 +33,6 @@ var IncomeText = styled(Text, { shouldForwardProp: function (prop) { return prop
33
33
  var theme = _a.theme, isSelected = _a.isSelected;
34
34
  return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25), textAlign: 'start' }));
35
35
  });
36
- var CheckIconStyled = styled(CheckIcon)(function (_a) {
37
- var theme = _a.theme;
38
- return ({
39
- color: theme.palette.success.main,
40
- display: 'flex',
41
- alignItems: 'flex-end'
42
- });
43
- });
44
36
  var TeamSize = function (_a) {
45
37
  var _b, _c, _d, _e;
46
38
  var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose;
@@ -73,7 +65,7 @@ var TeamSize = function (_a) {
73
65
  };
74
66
  return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 0 } }, { children: [_jsx(InputStyled, { required: true, label: t('team_size_title'), onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_team_size'), value: (isAr ? (_d = teamSize === null || teamSize === void 0 ? void 0 : teamSize.name) === null || _d === void 0 ? void 0 : _d.ar : (_e = teamSize === null || teamSize === void 0 ? void 0 : teamSize.name) === null || _e === void 0 ? void 0 : _e.en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.en', searchValuePath: ['name.en', 'name.ar'], list: teamSizeList, onSelectItem: onSelectItem, renderItem: function (item) {
75
67
  var _a, _b;
76
- return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (teamSize === null || teamSize === void 0 ? void 0 : teamSize.id) }, { children: isAr ? (_a = item === null || item === void 0 ? void 0 : item.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.en })) })), item.id === (teamSize === null || teamSize === void 0 ? void 0 : teamSize.id) && _jsx(CheckIconStyled, {})] }));
68
+ return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (teamSize === null || teamSize === void 0 ? void 0 : teamSize.id) }, { children: isAr ? (_a = item === null || item === void 0 ? void 0 : item.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.en })) })), item.id === (teamSize === null || teamSize === void 0 ? void 0 : teamSize.id) && _jsx(CheckIcon, {})] }));
77
69
  } }) }))] })) })));
78
70
  };
79
71
  export default TeamSize;
@@ -73,15 +73,12 @@ 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
+ var InputStyled = styled(Input)(function () { return ({
77
+ direction: 'ltr',
78
+ '& .MuiInputBase-input': {
79
+ cursor: 'auto'
80
+ }
81
+ }); });
85
82
  var MobileNumber = React.forwardRef(function (_a, ref) {
86
83
  var _b, _c, _d;
87
84
  var countries = _a.countries, rest = __rest(_a, ["countries"]);
@@ -11,18 +11,17 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import * as React from 'react';
14
- import Box from '@mui/material/Box';
15
14
  import { useTranslation } from 'react-i18next';
16
15
  import { useController, useFormContext } from 'react-hook-form';
17
16
  import { styled, alpha } from '@mui/material/styles';
17
+ import Box from '@mui/material/Box';
18
+ import { removeAllCharsFromNumber } from '../../../../utils';
19
+ import { ID_NUMBER_LENGTH } from '../../../../constants';
18
20
  import Text from '../../../../components/Text';
19
- import Input from '../../../shared/Input';
20
- import ClearIcon from '../../../shared/ClearIcon';
21
- import CheckIcon from '../../../shared/CheckIcon';
22
21
  import Collapse from '../../../../components/Collapse';
22
+ import Input from '../../../shared/Input';
23
23
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
24
- import { removeAllCharsFromNumber } from '../../../../utils';
25
- import { ID_NUMBER_LENGTH } from '../../../../constants';
24
+ import { EndAdornment } from '../../../shared/EndAdornment';
26
25
  var LabelContainerStyled = styled(Box)(function (_a) {
27
26
  var theme = _a.theme;
28
27
  return ({
@@ -55,6 +54,6 @@ var IDNumber = React.forwardRef(function (_a, ref) {
55
54
  };
56
55
  var nidValue = nidControl.field.value;
57
56
  var error = (_b = nidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
58
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { dir: 'ltr', type: 'tel', inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: !error && nidValue ? _jsx(CheckIcon, {}) : nidValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
57
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { dir: 'ltr', type: 'tel', inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: _jsx(EndAdornment, { value: nidValue, error: error, onClear: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
59
58
  });
60
59
  export default React.memo(IDNumber);
@@ -11,17 +11,16 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import * as React from 'react';
14
- import Box from '@mui/material/Box';
15
14
  import { useTranslation } from 'react-i18next';
16
15
  import { useController, useFormContext } from 'react-hook-form';
16
+ import Box from '@mui/material/Box';
17
17
  import { styled, alpha } from '@mui/material/styles';
18
18
  import Text from '../../../../components/Text';
19
- import Input from '../../../shared/Input';
20
- import ClearIcon from '../../../shared/ClearIcon';
21
- import CheckIcon from '../../../shared/CheckIcon';
22
- import ScreenContainer from '../../../shared/Containers/ScreenContainer';
23
19
  import { removeAllOtherThanCharsAndNumber } from '../../../../utils';
24
20
  import { CIVIL_ID_NUMBER_LENGTH } from '../../../../constants';
21
+ import Input from '../../../shared/Input';
22
+ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
23
+ import { EndAdornment } from '../../../shared/EndAdornment';
25
24
  var LabelContainerStyled = styled(Box)(function (_a) {
26
25
  var theme = _a.theme;
27
26
  return ({
@@ -38,7 +37,7 @@ var IDNumber = React.forwardRef(function (_a, ref) {
38
37
  var _b;
39
38
  var sx = _a.sx;
40
39
  var t = useTranslation().t;
41
- var _c = useFormContext(), control = _c.control, setValue = _c.setValue;
40
+ var control = useFormContext().control;
42
41
  var civilIdControl = useController({ control: control, name: 'civilId' });
43
42
  var handleIdChange = function (_a) {
44
43
  var target = _a.target;
@@ -50,6 +49,6 @@ var IDNumber = React.forwardRef(function (_a, ref) {
50
49
  };
51
50
  var idValue = civilIdControl.field.value;
52
51
  var error = (_b = civilIdControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
53
- return (_jsxs(ScreenContainer, __assign({ ref: ref, sx: sx }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_civil_id') }) }), _jsx(Input, { dir: 'ltr', type: 'text', inputProps: { maxLength: CIVIL_ID_NUMBER_LENGTH }, onChange: handleIdChange, value: idValue, endAdornment: !error && idValue ? _jsx(CheckIcon, {}) : idValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: t('civil_id_placeholder'), warningType: 'alert', warningMessage: error && t(error), required: true })] })));
52
+ return (_jsxs(ScreenContainer, __assign({ ref: ref, sx: sx }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_civil_id') }) }), _jsx(Input, { dir: 'ltr', type: 'text', inputProps: { maxLength: CIVIL_ID_NUMBER_LENGTH }, onChange: handleIdChange, value: idValue, endAdornment: _jsx(EndAdornment, { value: idValue, error: error, onClear: clearIdNumber }), placeholder: t('civil_id_placeholder'), warningType: 'alert', warningMessage: error && t(error), required: true })] })));
54
53
  });
55
54
  export default React.memo(IDNumber);
@@ -11,17 +11,16 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import * as React from 'react';
14
- import Box from '@mui/material/Box';
15
14
  import { useTranslation } from 'react-i18next';
16
15
  import { useController, useFormContext } from 'react-hook-form';
16
+ import Box from '@mui/material/Box';
17
17
  import { styled, alpha } from '@mui/material/styles';
18
18
  import Text from '../../../../components/Text';
19
- import Input from '../../../shared/Input';
20
- import ClearIcon from '../../../shared/ClearIcon';
21
- import CheckIcon from '../../../shared/CheckIcon';
22
- import ScreenContainer from '../../../shared/Containers/ScreenContainer';
23
19
  import { removeAllOtherThanCharsAndNumber } from '../../../../utils';
24
20
  import { CIVIL_ID_NUMBER_LENGTH } from '../../../../constants';
21
+ import Input from '../../../shared/Input';
22
+ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
23
+ import { EndAdornment } from '../../../shared/EndAdornment';
25
24
  var LabelContainerStyled = styled(Box)(function (_a) {
26
25
  var theme = _a.theme;
27
26
  return ({
@@ -38,7 +37,7 @@ var IDNumber = React.forwardRef(function (_a, ref) {
38
37
  var _b;
39
38
  var sx = _a.sx;
40
39
  var t = useTranslation().t;
41
- var _c = useFormContext(), control = _c.control, setValue = _c.setValue;
40
+ var control = useFormContext().control;
42
41
  var civilIdControl = useController({ control: control, name: 'civilId' });
43
42
  var handleIdChange = function (_a) {
44
43
  var target = _a.target;
@@ -50,6 +49,6 @@ var IDNumber = React.forwardRef(function (_a, ref) {
50
49
  };
51
50
  var idValue = civilIdControl.field.value;
52
51
  var error = (_b = civilIdControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
53
- return (_jsxs(ScreenContainer, __assign({ ref: ref, sx: sx }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_civil_id') }) }), _jsx(Input, { dir: 'ltr', type: 'text', inputProps: { maxLength: CIVIL_ID_NUMBER_LENGTH }, onChange: handleIdChange, value: idValue, endAdornment: !error && idValue ? _jsx(CheckIcon, {}) : idValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: t('civil_id_placeholder'), warningType: 'alert', warningMessage: error && t(error), required: true })] })));
52
+ return (_jsxs(ScreenContainer, __assign({ ref: ref, sx: sx }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_civil_id') }) }), _jsx(Input, { dir: 'ltr', type: 'text', inputProps: { maxLength: CIVIL_ID_NUMBER_LENGTH }, onChange: handleIdChange, value: idValue, endAdornment: _jsx(EndAdornment, { value: idValue, error: error, onClear: clearIdNumber }), placeholder: t('civil_id_placeholder'), warningType: 'alert', warningMessage: error && t(error), required: true })] })));
54
53
  });
55
54
  export default React.memo(IDNumber);
@@ -54,16 +54,14 @@ import axios from 'axios';
54
54
  import Box from '@mui/material/Box';
55
55
  import { styled, alpha } from '@mui/material/styles';
56
56
  import InfoIcon from '@mui/icons-material/Info';
57
- import CircularProgress from '@mui/material/CircularProgress';
58
57
  import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
59
- import { ScreenContainer } from '../../../shared/Containers';
60
58
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
61
59
  import Text from '../../../../components/Text';
62
60
  import Tooltip from '../../../../components/Tooltip';
63
61
  import Collapse from '../../../../components/Collapse';
64
62
  import Input from '../../../shared/Input';
65
- import ClearIcon from '../../../shared/ClearIcon';
66
- import CheckIcon from '../../../shared/CheckIcon';
63
+ import { EndAdornment } from '../../../shared/EndAdornment';
64
+ import { ScreenContainer } from '../../../shared/Containers';
67
65
  import { checkBrandNameAvailabilityAsync, connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
68
66
  var LabelContainerStyled = styled(Box)(function (_a) {
69
67
  var theme = _a.theme;
@@ -135,6 +133,6 @@ var BrandName = function (_a) {
135
133
  var clearBrandName = function () {
136
134
  brandControl.field.onChange('');
137
135
  };
138
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 2.5 } }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('signup_brand_name_label') }), _jsx(Tooltip, __assign({ title: t('brand_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(Input, { onChange: handleBrandNameChange, readOnly: readOnly, value: brandNameValue || '', placeholder: t('signup_brand_name_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: brandNameChecking ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : !error && brandNameValue ? (_jsx(CheckIcon, {})) : (brandNameValue && _jsx(ClearIcon, { onClick: clearBrandName })) })] })) })));
136
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 2.5 } }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('signup_brand_name_label') }), _jsx(Tooltip, __assign({ title: t('brand_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(Input, { onChange: handleBrandNameChange, readOnly: readOnly, value: brandNameValue || '', placeholder: t('signup_brand_name_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: brandNameValue, loading: brandNameChecking, error: error, onClear: clearBrandName }) })] })) })));
139
137
  };
140
138
  export default React.memo(BrandName);
@@ -47,6 +47,6 @@ var LicenseNumber = function (_a) {
47
47
  var minLength = !isSACountry ? KW_MIN_LICENSE_LENGTH : length;
48
48
  var label = isCR ? 'cr_number' : 'fl_number';
49
49
  var showCheckIcon = !isSACountry ? (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) >= minLength : (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) === length;
50
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t(label), required: !isSACountry, onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue, endAdornment: showCheckIcon || readOnly ? _jsx(CheckIcon, {}) : licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber }), placeholder: isCR ? t('cr_number_hint') : t('fl_number_hint'), warningType: 'alert', warningMessage: error && t(error, { length: minLength }) }) }) })));
50
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t(label), required: !isSACountry, onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue, endAdornment: showCheckIcon || (readOnly && licenseNumberValue) ? _jsx(CheckIcon, {}) : licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber }), placeholder: isCR ? t('cr_number_hint') : t('fl_number_hint'), warningType: 'alert', warningMessage: error && t(error, { length: minLength }) }) }) })));
51
51
  };
52
52
  export default React.memo(LicenseNumber);
@@ -52,13 +52,11 @@ import { debounce } from 'lodash-es';
52
52
  import { useController, useFormContext } from 'react-hook-form';
53
53
  import axios from 'axios';
54
54
  import { styled } from '@mui/material/styles';
55
- import CircularProgress from '@mui/material/CircularProgress';
56
55
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
57
56
  import Collapse from '../../../../components/Collapse';
58
57
  import { ScreenContainer } from '../../../shared/Containers';
59
58
  import Input from '../../../shared/Input';
60
- import ClearIcon from '../../../shared/ClearIcon';
61
- import CheckIcon from '../../../shared/CheckIcon';
59
+ import { EndAdornment } from '../../../shared/EndAdornment';
62
60
  import { checkEmailAvailabilityAsync, connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
63
61
  var InputStyled = styled(Input)(function () { return ({
64
62
  input: {
@@ -102,6 +100,6 @@ var Email = function (_a) {
102
100
  var clearNumber = function () {
103
101
  emailControl.field.onChange('');
104
102
  };
105
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(InputStyled, { label: t('signup_email_lable'), value: emailValue, readOnly: readOnly, onEnterPressed: function (e) { return e.preventDefault(); }, onChange: handleEmailChange, type: 'email', placeholder: t('signup_email_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: emailChecking ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : !error && emailValue ? (_jsx(CheckIcon, {})) : (emailValue && _jsx(ClearIcon, { onClick: clearNumber })) }) }) })));
103
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(InputStyled, { label: t('signup_email_lable'), value: emailValue, readOnly: readOnly, onEnterPressed: function (e) { return e.preventDefault(); }, onChange: handleEmailChange, type: 'email', placeholder: t('signup_email_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: emailValue, loading: emailChecking, error: error, onClear: clearNumber }) }) }) })));
106
104
  };
107
105
  export default React.memo(Email);
@@ -18,8 +18,7 @@ import { removeAllOtherThanAlphabetAndSpace } from '../../../../utils';
18
18
  import Collapse from '../../../../components/Collapse';
19
19
  import { ScreenContainer } from '../../../shared/Containers';
20
20
  import Input from '../../../shared/Input';
21
- import ClearIcon from '../../../shared/ClearIcon';
22
- import CheckIcon from '../../../shared/CheckIcon';
21
+ import { EndAdornment } from '../../../shared/EndAdornment';
23
22
  var InputStyled = styled(Input)(function () { return ({
24
23
  input: {
25
24
  textTransform: 'capitalize'
@@ -40,6 +39,6 @@ var Name = function (_a) {
40
39
  var clearNumber = function () {
41
40
  nameControl.field.onChange('');
42
41
  };
43
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mb: 3, mt: 2.5 } }, { children: _jsx(InputStyled, { label: t('signup_merchant_name_label'), value: nameValue, readOnly: readOnly, onChange: handleNameChange, placeholder: t('signup_merchant_name_label'), warningType: 'alert', warningMessage: error && t(error), endAdornment: !error && nameValue ? _jsx(CheckIcon, {}) : nameValue && _jsx(ClearIcon, { onClick: clearNumber }) }) })) })));
42
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mb: 3, mt: 2.5 } }, { children: _jsx(InputStyled, { label: t('signup_merchant_name_label'), value: nameValue, readOnly: readOnly, onChange: handleNameChange, placeholder: t('signup_merchant_name_label'), warningType: 'alert', warningMessage: error && t(error), endAdornment: _jsx(EndAdornment, { value: nameValue, error: error, onClear: clearNumber }) }) })) })));
44
43
  };
45
44
  export default React.memo(Name);
@@ -18,12 +18,11 @@ import { useAppSelector } from '../../../../hooks';
18
18
  import { styled, alpha } from '@mui/material/styles';
19
19
  import Text from '../../../../components/Text';
20
20
  import Input from '../../../shared/Input';
21
- import ClearIcon from '../../../shared/ClearIcon';
22
- import CheckIcon from '../../../shared/CheckIcon';
23
21
  import Collapse from '../../../../components/Collapse';
24
22
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
25
23
  import { removeAllCharsFromNumber } from '../../../../utils';
26
24
  import { ID_NUMBER_LENGTH } from '../../../../constants';
25
+ import { EndAdornment } from '../../../shared/EndAdornment';
27
26
  import { connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
28
27
  var LabelContainerStyled = styled(Box)(function (_a) {
29
28
  var theme = _a.theme;
@@ -56,6 +55,6 @@ var IDNumber = React.forwardRef(function (_a, ref) {
56
55
  var error = (_b = nidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
57
56
  var isLeadIdPassed = data.isLeadIdPassed, responseData = data.responseData;
58
57
  var isLeadIdentityIdAvailable = !!((_d = (_c = responseData === null || responseData === void 0 ? void 0 : responseData.leadData) === null || _c === void 0 ? void 0 : _c.identification) === null || _d === void 0 ? void 0 : _d.id);
59
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { readOnly: readOnly, dir: 'ltr', type: 'tel', inputProps: { maxLength: ID_NUMBER_LENGTH }, disabled: isLeadIdPassed && isLeadIdentityIdAvailable, onChange: handleIdChange, value: nidValue, endAdornment: !error && nidValue ? _jsx(CheckIcon, {}) : nidValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
58
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { readOnly: readOnly, dir: 'ltr', type: 'tel', inputProps: { maxLength: ID_NUMBER_LENGTH }, disabled: isLeadIdPassed && isLeadIdentityIdAvailable, onChange: handleIdChange, value: nidValue, endAdornment: _jsx(EndAdornment, { value: nidValue, error: error, onClear: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
60
59
  });
61
60
  export default React.memo(IDNumber);
@@ -17,12 +17,11 @@ import { useController, useFormContext } from 'react-hook-form';
17
17
  import { styled, alpha } from '@mui/material/styles';
18
18
  import Text from '../../../../components/Text';
19
19
  import Input from '../../../shared/Input';
20
- import ClearIcon from '../../../shared/ClearIcon';
21
- import CheckIcon from '../../../shared/CheckIcon';
22
20
  import Collapse from '../../../../components/Collapse';
23
21
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
24
22
  import { removeAllCharsFromNumber } from '../../../../utils';
25
23
  import { ID_NUMBER_LENGTH } from '../../../../constants';
24
+ import { EndAdornment } from '../../../shared/EndAdornment';
26
25
  var LabelContainerStyled = styled(Box)(function (_a) {
27
26
  var theme = _a.theme;
28
27
  return ({
@@ -51,6 +50,6 @@ var IDNumber = React.forwardRef(function (_a, ref) {
51
50
  };
52
51
  var nidValue = nidControl.field.value;
53
52
  var error = (_b = nidControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
54
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { dir: 'ltr', type: 'tel', inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: !error && nidValue ? _jsx(CheckIcon, {}) : nidValue && _jsx(ClearIcon, { onClick: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
53
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('enter_national_id') }) }), _jsx(Input, { dir: 'ltr', type: 'tel', inputProps: { maxLength: ID_NUMBER_LENGTH }, onChange: handleIdChange, value: nidValue, endAdornment: _jsx(EndAdornment, { value: nidValue, error: error, onClear: clearIdNumber }), placeholder: t('national_id_placeholder'), warningType: 'alert', warningMessage: error && t(error, { number: '1' }), required: true })] })) })));
55
54
  });
56
55
  export default React.memo(IDNumber);
@@ -16,7 +16,7 @@ import { useForm, FormProvider } from 'react-hook-form';
16
16
  import { yupResolver } from '@hookform/resolvers/yup';
17
17
  import { styled } from '@mui/material/styles';
18
18
  import Form from '../../../../components/Form';
19
- import { useAppDispatch, useLanguage, useAppSelector, useSetFromDefaultValues, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids } from '../../../../hooks';
19
+ import { useAppDispatch, useLanguage, useAppSelector, useSetFromDefaultValues, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
20
20
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
21
21
  import { DocumentPurpose } from '../../../../@types';
22
22
  import { getFileDetailsFromDocument, isSA } from '../../../../utils';
@@ -37,8 +37,9 @@ var TaxDetails = function () {
37
37
  var dispatch = useAppDispatch();
38
38
  var _a = useAppSelector(taxSelector), data = _a.data, loading = _a.loading, error = _a.error, uploading = _a.uploading;
39
39
  var _b = data.verify.responseBody || {}, entity = _b.entity, flows = _b.flows;
40
+ var _c = entity || {}, documents = _c.documents, data_status = _c.data_status, data_verification = _c.data_verification, vat_id = _c.vat_id;
40
41
  var settingsData = useAppSelector(settingsSelector).data;
41
- var _c = data.taxData, vatId = _c.vatId, confirmPolicy = _c.confirmPolicy, documentId = _c.documentId;
42
+ var _d = data.taxData, vatId = _d.vatId, confirmPolicy = _d.confirmPolicy, documentId = _d.documentId;
42
43
  var methods = useForm({
43
44
  resolver: yupResolver(Validation()),
44
45
  defaultValues: {
@@ -49,11 +50,13 @@ var TaxDetails = function () {
49
50
  mode: 'onChange'
50
51
  });
51
52
  useSetFromDefaultValues(methods, data.taxData);
52
- var defaultTaxFiles = React.useMemo(function () { return getFileDetailsFromDocument(entity === null || entity === void 0 ? void 0 : entity.documents, DocumentPurpose.TAX_DOCUMENT); }, [entity === null || entity === void 0 ? void 0 : entity.documents]);
53
+ var defaultTaxFiles = React.useMemo(function () { return getFileDetailsFromDocument(documents, DocumentPurpose.TAX_DOCUMENT); }, [documents]);
53
54
  var originalReadOnly = useFormReadOnly(methods, { documentId: defaultTaxFiles });
54
- var noneEditable = useDataNoneEditable(entity === null || entity === void 0 ? void 0 : entity.data_status, ['tax_number', 'documents', 'is_vat_acknowledged']);
55
+ var noneEditable = useDataNoneEditable(data_status, ['tax_number', 'documents', 'is_vat_acknowledged']);
55
56
  var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
57
+ var dataVerified = useDataVerified(data_verification, ['tax_number']);
56
58
  var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
59
+ var isVatIdVerified = dataVerified['tax_number'] && vat_id === methods.watch('vatId');
57
60
  var t = useTranslation().t;
58
61
  var isAr = useLanguage().isAr;
59
62
  var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
@@ -67,6 +70,6 @@ var TaxDetails = function () {
67
70
  }
68
71
  dispatch(retrieveBoardStatus());
69
72
  };
70
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(VATId, { readOnly: readOnly['vatId'] || noneEditable['tax_number'] }), _jsx(TaxDocument, { show: isSACountry, defaultFiles: defaultTaxFiles, readOnly: readOnly['documentId'] || noneEditable['documents'] }), _jsx(ConfirmPolicy, { readOnly: readOnly['confirmPolicy'] || noneEditable['is_vat_acknowledged'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid || uploading, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
73
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(VATId, { readOnly: readOnly['vatId'] || noneEditable['tax_number'], isVerified: isVatIdVerified }), _jsx(TaxDocument, { show: isSACountry, defaultFiles: defaultTaxFiles, readOnly: readOnly['documentId'] || noneEditable['documents'] }), _jsx(ConfirmPolicy, { readOnly: readOnly['confirmPolicy'] || noneEditable['is_vat_acknowledged'] }), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: !methods.formState.isValid || uploading, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
71
74
  };
72
75
  export default TaxDetails;
@@ -10,6 +10,7 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
+ import React from 'react';
13
14
  import { useTranslation } from 'react-i18next';
14
15
  import { useController, useFormContext } from 'react-hook-form';
15
16
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
@@ -20,6 +21,7 @@ import { FileType } from '../../../../constants';
20
21
  import { ScreenContainer } from '../../../shared/Containers';
21
22
  import { taxSelector, uploadingStatus } from '../../../app/tax/taxStore';
22
23
  import UploadMultipleFile from '../../../shared/UploadMultipleFile';
24
+ import { hasVerifiedValue } from '../../../../utils';
23
25
  var FeatureStyled = styled(ScreenContainer)(function (_a) {
24
26
  var theme = _a.theme;
25
27
  return ({
@@ -27,18 +29,22 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
27
29
  });
28
30
  });
29
31
  var TaxDocument = function (_a) {
32
+ var _b;
30
33
  var show = _a.show, readOnly = _a.readOnly, defaultFiles = _a.defaultFiles;
31
34
  var t = useTranslation().t;
32
35
  var control = useFormContext().control;
33
36
  var dispatch = useAppDispatch();
34
37
  var documentIdControl = useController({ name: 'documentId', control: control });
35
- var loading = useAppSelector(taxSelector).loading;
38
+ var _c = useAppSelector(taxSelector), loading = _c.loading, data = _c.data;
39
+ var data_verification = (((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) || {}).data_verification;
40
+ var uploadedIds = documentIdControl.field.value;
36
41
  var handleTaxDocumentChange = function (ids) {
37
42
  documentIdControl.field.onChange(ids);
38
43
  };
39
44
  var handleReset = function (ids) {
40
45
  documentIdControl.field.onChange(ids);
41
46
  };
42
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, __assign({ sx: { mb: 2.5 } }, { children: _jsx(UploadMultipleFile, { readOnly: readOnly, id: 'documentId', control: control, label: t('title_tax_document'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_tax_document'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleTaxDocumentChange, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, defaultFiles: defaultFiles, purpose: DocumentPurpose.TAX_DOCUMENT, fileUploadingStatus: function (uploading) { return dispatch(uploadingStatus(uploading)); }, fileType: FileType.IMAGES }) })) })));
47
+ var isDocumentVerified = React.useMemo(function () { var _a; return !!((_a = defaultFiles === null || defaultFiles === void 0 ? void 0 : defaultFiles[0]) === null || _a === void 0 ? void 0 : _a.docId) && hasVerifiedValue(data_verification, "documents.".concat(defaultFiles[0].docId)); }, [data_verification]);
48
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, __assign({ sx: { mb: 2.5 } }, { children: _jsx(UploadMultipleFile, { readOnly: readOnly, id: 'documentId', control: control, label: t('title_tax_document'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_tax_document'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleTaxDocumentChange, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, defaultFiles: defaultFiles, purpose: DocumentPurpose.TAX_DOCUMENT, fileUploadingStatus: function (uploading) { return dispatch(uploadingStatus(uploading)); }, fileType: FileType.IMAGES, isVerified: !(uploadedIds === null || uploadedIds === void 0 ? void 0 : uploadedIds.length) && isDocumentVerified }) })) })));
43
49
  };
44
50
  export default TaxDocument;
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  declare type VATIdProps = {
3
3
  readOnly?: boolean;
4
+ isVerified?: boolean;
4
5
  };
5
- declare const VATId: ({ readOnly }: VATIdProps) => JSX.Element;
6
+ declare const VATId: ({ readOnly, isVerified }: VATIdProps) => JSX.Element;
6
7
  export default VATId;
@@ -19,17 +19,15 @@ import { VAT_ID_LENGTH } from '../../../../constants';
19
19
  import { useAppSelector } from '../../../../hooks';
20
20
  import { isSA, removeAllCharsFromNumber } from '../../../../utils';
21
21
  import { settingsSelector } from '../../../../app/settings';
22
- import ClearIcon from '../../../shared/ClearIcon';
23
- import CheckIcon from '../../../shared/CheckIcon';
22
+ import { EndAdornment } from '../../../shared/EndAdornment';
24
23
  var VATId = function (_a) {
25
24
  var _b;
26
- var readOnly = _a.readOnly;
25
+ var readOnly = _a.readOnly, isVerified = _a.isVerified;
27
26
  var t = useTranslation().t;
28
27
  var control = useFormContext().control;
29
28
  var vatControl = useController({ name: 'vatId', control: control });
30
29
  var settingsData = useAppSelector(settingsSelector).data;
31
30
  var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
32
- var disabled = false;
33
31
  var handleOnChange = function (vat) {
34
32
  var value = removeAllCharsFromNumber(vat);
35
33
  vatControl.field.onChange(value);
@@ -39,6 +37,6 @@ var VATId = function (_a) {
39
37
  var clearValue = function () {
40
38
  vatControl.field.onChange('');
41
39
  };
42
- return (_jsx(Box, __assign({ sx: isSACountry ? {} : { height: '200px' } }, { children: _jsx(Input, { readOnly: readOnly, label: t('vat_id'), disabled: disabled, inputProps: { maxLength: VAT_ID_LENGTH }, value: vatValue || '', onChange: function (event) { return handleOnChange(event.target.value); }, placeholder: t('vat_id_placeholder'), warningType: 'alert', warningMessage: vatError && t(vatError), required: true, endAdornment: !vatError && vatValue ? _jsx(CheckIcon, {}) : vatValue && _jsx(ClearIcon, { onClick: clearValue }) }) })));
40
+ return (_jsx(Box, __assign({ sx: isSACountry ? {} : { height: '200px' } }, { children: _jsx(Input, { readOnly: readOnly, label: t('vat_id'), inputProps: { maxLength: VAT_ID_LENGTH }, value: vatValue || '', onChange: function (event) { return handleOnChange(event.target.value); }, placeholder: t('vat_id_placeholder'), warningType: 'alert', warningMessage: vatError && t(vatError), required: true, endAdornment: _jsx(EndAdornment, { value: vatValue, isVerified: isVerified, error: vatError, onClear: clearValue }) }) })));
43
41
  };
44
42
  export default VATId;
@@ -170,7 +170,7 @@ export var getRecentDocumentBasedOnPurpose = function (documents, purpose) {
170
170
  }
171
171
  else {
172
172
  return documents
173
- .filter(function (doc) { var _a; return ((_a = doc.file_details) === null || _a === void 0 ? void 0 : _a.length) === 0 && doc.id; })
173
+ .filter(function (doc) { var _a; return !((_a = doc.file_details) === null || _a === void 0 ? void 0 : _a.length) && (doc.type === purpose || doc.id); })
174
174
  .sort(function (a, b) { return b.created - a.created; })[0];
175
175
  }
176
176
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.4.5-test",
3
+ "version": "2.4.10-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",