@tap-payments/auth-jsconnect 2.1.75-test → 2.1.76-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 (129) hide show
  1. package/build/@types/app.d.ts +24 -0
  2. package/build/@types/app.js +13 -0
  3. package/build/@types/form.d.ts +15 -1
  4. package/build/@types/index.d.ts +1 -0
  5. package/build/@types/index.js +1 -0
  6. package/build/@types/user.d.ts +141 -0
  7. package/build/@types/user.js +1 -0
  8. package/build/api/board.d.ts +16 -0
  9. package/build/api/board.js +10 -1
  10. package/build/api/country.d.ts +4 -0
  11. package/build/api/country.js +9 -1
  12. package/build/api/index.d.ts +8 -3
  13. package/build/api/individual.d.ts +43 -1
  14. package/build/api/individual.js +9 -1
  15. package/build/api/user.d.ts +6 -0
  16. package/build/api/user.js +9 -1
  17. package/build/assets/locales/ar.json +22 -2
  18. package/build/assets/locales/en.json +22 -1
  19. package/build/components/SimpleList/SimpleList.d.ts +2 -0
  20. package/build/constants/api.d.ts +1 -0
  21. package/build/constants/api.js +3 -1
  22. package/build/constants/app.d.ts +1 -0
  23. package/build/constants/app.js +20 -7
  24. package/build/constants/assets.d.ts +4 -0
  25. package/build/constants/assets.js +4 -0
  26. package/build/features/app/bank/bankStore.d.ts +1 -0
  27. package/build/features/app/bank/bankStore.js +2 -1
  28. package/build/features/app/brand/brandStore.d.ts +2 -0
  29. package/build/features/app/brand/brandStore.js +3 -1
  30. package/build/features/app/business/businessStore.js +1 -1
  31. package/build/features/app/entity/entityStore.d.ts +2 -0
  32. package/build/features/app/entity/entityStore.js +3 -1
  33. package/build/features/app/individual/individualStore.d.ts +28 -3
  34. package/build/features/app/individual/individualStore.js +461 -118
  35. package/build/features/app/password/passwordStore.js +2 -2
  36. package/build/features/app/tax/taxStore.js +30 -29
  37. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  38. package/build/features/brand/screens/BrandActivities/ActivitiesList.d.ts +3 -3
  39. package/build/features/brand/screens/BrandActivities/CustomerBase.d.ts +2 -2
  40. package/build/features/brand/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  41. package/build/features/business/screens/Activities/ActivitiesList.d.ts +3 -3
  42. package/build/features/business/screens/BusinessType/LicenseType.d.ts +2 -2
  43. package/build/features/business/screens/Customers/CustomerLocations.d.ts +2 -2
  44. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  45. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.d.ts +2 -2
  46. package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  47. package/build/features/entity/screens/EntityCapital/ActivityList.d.ts +3 -3
  48. package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +3 -3
  49. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  50. package/build/features/featuresScreens.js +10 -0
  51. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.d.ts +13 -0
  52. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +43 -8
  53. package/build/features/individual/screens/AdditionalIndividualInfo/EmployerLocation.js +3 -13
  54. package/build/features/individual/screens/AdditionalIndividualInfo/InfluencerSwitch.js +9 -2
  55. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +11 -17
  56. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +12 -16
  57. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.d.ts +2 -2
  58. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.js +9 -2
  59. package/build/features/individual/screens/AdditionalIndividualInfo/ShareCount.d.ts +6 -0
  60. package/build/features/individual/screens/AdditionalIndividualInfo/ShareCount.js +35 -0
  61. package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.d.ts +6 -0
  62. package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +41 -0
  63. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +9 -6
  64. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +20 -17
  65. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +18 -25
  66. package/build/features/individual/screens/IndividualList/IndividualList.d.ts +31 -0
  67. package/build/features/individual/screens/IndividualList/IndividualList.js +59 -0
  68. package/build/features/individual/screens/IndividualList/UserList.d.ts +5 -0
  69. package/build/features/individual/screens/IndividualList/UserList.js +138 -0
  70. package/build/features/individual/screens/IndividualList/index.d.ts +3 -0
  71. package/build/features/individual/screens/IndividualList/index.js +2 -0
  72. package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.d.ts +8 -0
  73. package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.js +90 -0
  74. package/build/features/individual/screens/IndividualPersonalInfo/BirthCountry.d.ts +10 -0
  75. package/build/features/individual/screens/IndividualPersonalInfo/BirthCountry.js +82 -0
  76. package/build/features/individual/screens/IndividualPersonalInfo/DOB.d.ts +7 -0
  77. package/build/features/individual/screens/IndividualPersonalInfo/DOB.js +46 -0
  78. package/build/features/individual/screens/IndividualPersonalInfo/Email.d.ts +6 -0
  79. package/build/features/individual/screens/IndividualPersonalInfo/Email.js +50 -0
  80. package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.d.ts +7 -0
  81. package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.js +49 -0
  82. package/build/features/individual/screens/IndividualPersonalInfo/Gender.d.ts +34 -0
  83. package/build/features/individual/screens/IndividualPersonalInfo/Gender.js +81 -0
  84. package/build/features/individual/screens/IndividualPersonalInfo/ID.d.ts +6 -0
  85. package/build/features/individual/screens/IndividualPersonalInfo/ID.js +48 -0
  86. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.d.ts +21 -0
  87. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +126 -0
  88. package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.d.ts +10 -0
  89. package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.js +88 -0
  90. package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.d.ts +10 -0
  91. package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.js +145 -0
  92. package/build/features/individual/screens/IndividualPersonalInfo/Name.d.ts +6 -0
  93. package/build/features/individual/screens/IndividualPersonalInfo/Name.js +52 -0
  94. package/build/features/individual/screens/IndividualPersonalInfo/Nationality.d.ts +10 -0
  95. package/build/features/individual/screens/IndividualPersonalInfo/Nationality.js +88 -0
  96. package/build/features/individual/screens/IndividualPersonalInfo/index.d.ts +3 -0
  97. package/build/features/individual/screens/IndividualPersonalInfo/index.js +2 -0
  98. package/build/features/individual/screens/IndividualPersonalInfo/validation.d.ts +38 -0
  99. package/build/features/individual/screens/IndividualPersonalInfo/validation.js +68 -0
  100. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  101. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  102. package/build/features/shared/Address/Address.d.ts +6 -1
  103. package/build/features/shared/Address/Address.js +40 -30
  104. package/build/features/shared/Address/CountryList.d.ts +1 -1
  105. package/build/features/shared/Address/InputSelect.d.ts +1 -1
  106. package/build/features/shared/Address/InputText.d.ts +2 -1
  107. package/build/features/shared/Address/InputText.js +2 -2
  108. package/build/features/shared/Button/FlowsButtons.d.ts +1 -0
  109. package/build/features/shared/Button/FlowsButtons.js +2 -2
  110. package/build/features/shared/Button/ListButton.d.ts +17 -0
  111. package/build/features/shared/Button/ListButton.js +107 -0
  112. package/build/features/shared/Button/index.d.ts +2 -1
  113. package/build/features/shared/Button/index.js +2 -1
  114. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.d.ts +2 -1
  115. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +6 -4
  116. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  117. package/build/features/tax/screens/TaxDetails/TaxDetails.js +2 -1
  118. package/build/features/tax/screens/TaxDetails/VATId.js +8 -3
  119. package/build/features/tax/screens/TaxDetails/validation.d.ts +4 -4
  120. package/build/features/tax/screens/TaxDetails/validation.js +10 -5
  121. package/build/utils/string.d.ts +3 -2
  122. package/build/utils/string.js +16 -3
  123. package/package.json +1 -1
  124. package/build/features/individual/screens/ShowIndividualInfo/ShowOwnerInfo.d.ts +0 -19
  125. package/build/features/individual/screens/ShowIndividualInfo/ShowOwnerInfo.js +0 -52
  126. package/build/features/individual/screens/ShowIndividualInfo/index.d.ts +0 -3
  127. package/build/features/individual/screens/ShowIndividualInfo/index.js +0 -2
  128. package/build/features/individual/screens/ShowIndividualInfo/info.d.ts +0 -7
  129. package/build/features/individual/screens/ShowIndividualInfo/info.js +0 -28
@@ -149,14 +149,14 @@ export default function FlowsButtons(_a) {
149
149
  var buttons = _a.buttons, data = _a.data;
150
150
  var dispatch = useAppDispatch();
151
151
  var settingsData = useAppSelector(settingsSelector).data;
152
- var flowName = data.flowName, email = data.email, emailUrl = data.emailUrl, brandName = data.brandName;
152
+ var flowName = data.flowName, email = data.email, emailUrl = data.emailUrl, brandName = data.brandName, isAuthorizedUser = data.isAuthorizedUser;
153
153
  var _b = useState(false), loading = _b[0], setLoading = _b[1];
154
154
  var isAr = useLanguage().isAr;
155
155
  var onRedirect = function (item) {
156
156
  if (item.isCompleted)
157
157
  return;
158
158
  if (flowName === item.name && item.name !== 'password') {
159
- dispatch(handleCurrentActiveScreen(getScreenNameBasedOnFlow(item.name)));
159
+ dispatch(handleCurrentActiveScreen(getScreenNameBasedOnFlow(item.name, isAuthorizedUser)));
160
160
  return;
161
161
  }
162
162
  if (typeof settingsData.appConfig.onBoardButtonClick === 'function') {
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { ButtonProps } from '../../../components/Button';
3
+ declare type buttonProps = {
4
+ title: string;
5
+ loading: boolean;
6
+ show: boolean;
7
+ onClick?: React.MouseEventHandler<HTMLButtonElement>;
8
+ };
9
+ interface ListButtonProps extends ButtonProps {
10
+ isAr: boolean;
11
+ requestEmail: buttonProps & {
12
+ isRequested: boolean;
13
+ };
14
+ addDetails: buttonProps;
15
+ }
16
+ export default function ListButton({ isAr, requestEmail, addDetails }: ListButtonProps): JSX.Element;
17
+ export {};
@@ -0,0 +1,107 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { useTranslation } from 'react-i18next';
14
+ import { styled, useTheme } from '@mui/material/styles';
15
+ import Box from '@mui/material/Box';
16
+ import { ICONS_NAMES } from '../../../constants';
17
+ import Loader from '../../../components/Loader';
18
+ import Button from '../../../components/Button';
19
+ import Icon from '../../../components/Icon';
20
+ import CheckIcon from '../CheckIcon';
21
+ import Collapse from '../../../components/Collapse';
22
+ var ArrowIconStyled = styled(Icon, { shouldForwardProp: function (prop) { return prop !== 'isAr'; } })(function (_a) {
23
+ var theme = _a.theme, isAr = _a.isAr;
24
+ return ({
25
+ width: theme.spacing(2),
26
+ height: theme.spacing(2),
27
+ transform: isAr ? 'scaleX(-1)' : 'scaleX(1)',
28
+ marginInlineEnd: theme.spacing(-0.375),
29
+ verticalAlign: 'middle'
30
+ });
31
+ });
32
+ var CheckIconStyled = styled(CheckIcon)(function (_a) {
33
+ var theme = _a.theme;
34
+ return ({
35
+ width: theme.spacing(2),
36
+ height: theme.spacing(2),
37
+ verticalAlign: 'middle'
38
+ });
39
+ });
40
+ var ButtonBoxStyled = styled(Box)(function (_a) {
41
+ var theme = _a.theme;
42
+ return ({
43
+ margin: theme.spacing(0, 2.5, 2.5, 2.5),
44
+ display: 'flex',
45
+ alignItems: 'center',
46
+ justifyContent: 'center',
47
+ flexDirection: 'column'
48
+ });
49
+ });
50
+ var ButtonStyled = styled(Button, {
51
+ shouldForwardProp: function (prop) { return prop !== 'isLoading'; }
52
+ })(function (_a) {
53
+ var theme = _a.theme, isLoading = _a.isLoading;
54
+ return (__assign({ paddingLeft: isLoading ? 0 : 'auto', paddingRight: isLoading ? 0 : 'auto', textTransform: 'none', transition: theme.transitions.create(['width', 'padding'], {
55
+ easing: theme.transitions.easing.easeInOut,
56
+ duration: theme.transitions.duration.complex * 2
57
+ }) }, (isLoading && {
58
+ minWidth: 0,
59
+ width: theme.spacing(6),
60
+ borderRadius: 30
61
+ })));
62
+ });
63
+ var Image = styled('img')(function (_a) {
64
+ var theme = _a.theme;
65
+ return ({
66
+ width: theme.spacing(3),
67
+ height: theme.spacing(3),
68
+ fontSize: theme.spacing(3),
69
+ marginInlineStart: theme.spacing(1),
70
+ verticalAlign: 'middle'
71
+ });
72
+ });
73
+ var TextStyled = styled('span')(function () { return ({
74
+ whiteSpace: 'pre',
75
+ overflow: 'auto'
76
+ }); });
77
+ export default function ListButton(_a) {
78
+ var isAr = _a.isAr, requestEmail = _a.requestEmail, addDetails = _a.addDetails;
79
+ var t = useTranslation().t;
80
+ var theme = useTheme();
81
+ var requestEmailLoaderColor = requestEmail.isRequested && !requestEmail.loading ? theme.palette.success.main : theme.palette.primary.main;
82
+ return (_jsxs(ButtonBoxStyled, { children: [_jsxs(ButtonStyled, __assign({ isLoading: addDetails.loading, sx: { mb: 1.5 }, type: 'button', variant: 'outlined', onClick: addDetails.onClick, startIcon: _jsx(Collapse, __assign({ in: !addDetails.loading }, { children: _jsx(Image, { src: ICONS_NAMES.ADD_DETAIL }) })), endIcon: _jsx(Collapse, __assign({ in: !addDetails.loading }, { children: _jsx(ArrowIconStyled, { isAr: isAr, src: ICONS_NAMES.BLUE_ARROW }) })) }, { children: [_jsx(Collapse, __assign({ in: addDetails.loading }, { children: _jsx(Loader, { style: {
83
+ width: theme.spacing(3.75),
84
+ height: theme.spacing(3.75)
85
+ }, innerColor: theme.palette.primary.main, outerColor: theme.palette.primary.main, size: 15, toggleAnimation: addDetails.loading }) })), _jsx(Collapse, __assign({ in: !addDetails.loading }, { children: _jsx(TextStyled, { children: t(addDetails.title) }) }))] })), requestEmail.show && (_jsxs(ButtonStyled, __assign({ isLoading: requestEmail.loading, variant: 'outlined', type: 'button', sx: requestEmail.isRequested && !requestEmail.loading
86
+ ? {
87
+ '&.MuiButton-outlined': {
88
+ backgroundColor: theme.palette.common.white,
89
+ border: "1px solid ".concat(theme.palette.success.main),
90
+ color: theme.palette.success.main,
91
+ '&:hover': {
92
+ backgroundColor: theme.palette.success.main,
93
+ color: theme.palette.common.white,
94
+ img: {
95
+ filter: 'brightness(0) invert(1)'
96
+ },
97
+ svg: {
98
+ filter: 'brightness(0) invert(1)'
99
+ }
100
+ }
101
+ }
102
+ }
103
+ : {}, onClick: requestEmail.onClick, startIcon: _jsx(Collapse, __assign({ in: !requestEmail.loading }, { children: _jsx(Image, { src: requestEmail.isRequested && !requestEmail.loading ? ICONS_NAMES.REQUEST_EMAIL_GREEN : ICONS_NAMES.REQUEST_EMAIL }) })), endIcon: _jsx(Collapse, __assign({ in: !requestEmail.loading }, { children: requestEmail.isRequested && !requestEmail.loading ? _jsx(CheckIconStyled, {}) : _jsx(ArrowIconStyled, { isAr: isAr, src: ICONS_NAMES.BLUE_ARROW }) })) }, { children: [_jsx(Collapse, __assign({ in: requestEmail.loading }, { children: _jsx(Loader, { style: {
104
+ width: theme.spacing(3.75),
105
+ height: theme.spacing(3.75)
106
+ }, innerColor: requestEmailLoaderColor, outerColor: requestEmailLoaderColor, size: 15, toggleAnimation: requestEmail.loading }) })), _jsx(Collapse, __assign({ in: !requestEmail.loading }, { children: _jsx(TextStyled, { children: t(requestEmail.title) }) }))] })))] }));
107
+ }
@@ -4,5 +4,6 @@ import MobileButton from './MobileButton';
4
4
  import EmailProvidersButton from './EmailProvidersButtons';
5
5
  import FlowsButtons from './FlowsButtons';
6
6
  import SuccessButton from './SuccessButton';
7
- export { AbsherButton, MobileButton, EmailProvidersButton, FlowsButtons, SuccessButton, Button };
7
+ import ListButton from './ListButton';
8
+ export { AbsherButton, MobileButton, EmailProvidersButton, FlowsButtons, SuccessButton, Button, ListButton };
8
9
  export default Button;
@@ -4,5 +4,6 @@ import MobileButton from './MobileButton';
4
4
  import EmailProvidersButton from './EmailProvidersButtons';
5
5
  import FlowsButtons from './FlowsButtons';
6
6
  import SuccessButton from './SuccessButton';
7
- export { AbsherButton, MobileButton, EmailProvidersButton, FlowsButtons, SuccessButton, Button };
7
+ import ListButton from './ListButton';
8
+ export { AbsherButton, MobileButton, EmailProvidersButton, FlowsButtons, SuccessButton, Button, ListButton };
8
9
  export default Button;
@@ -7,10 +7,11 @@ interface SuccessFlowButtonsProps {
7
7
  merchant: any;
8
8
  bank: any;
9
9
  user: any;
10
+ individuals: any;
10
11
  flows: any[];
11
12
  boardInfoId: string;
12
13
  boardId: string;
13
14
  flowName: FlowsTypes;
14
15
  }
15
- declare const _default: React.MemoExoticComponent<({ brand, entity, business, merchant, bank, user, flows, boardInfoId, boardId, flowName }: SuccessFlowButtonsProps) => JSX.Element>;
16
+ declare const _default: React.MemoExoticComponent<({ brand, entity, business, merchant, bank, user, flows, boardInfoId, boardId, flowName, individuals }: SuccessFlowButtonsProps) => JSX.Element>;
16
17
  export default _default;
@@ -44,14 +44,15 @@ var ButtonGroupStyled = styled(Box)(function (_a) {
44
44
  });
45
45
  var SuccessFlowButtons = function (_a) {
46
46
  var _b, _c, _d;
47
- var brand = _a.brand, entity = _a.entity, business = _a.business, merchant = _a.merchant, bank = _a.bank, user = _a.user, flows = _a.flows, boardInfoId = _a.boardInfoId, boardId = _a.boardId, flowName = _a.flowName;
47
+ var brand = _a.brand, entity = _a.entity, business = _a.business, merchant = _a.merchant, bank = _a.bank, user = _a.user, flows = _a.flows, boardInfoId = _a.boardInfoId, boardId = _a.boardId, flowName = _a.flowName, individuals = _a.individuals;
48
48
  var _e = useState([]), buttons = _e[0], setButtons = _e[1];
49
49
  var t = useTranslation().t;
50
50
  var isAr = useLanguage().isAr;
51
51
  var settings = useAppSelector(settingsSelector);
52
- var _f = user || {}, names = _f.names, identification = _f.identification;
52
+ var _f = user || {}, names = _f.names, identification = _f.identification, is_authorized = _f.is_authorized;
53
53
  var primary_contact = (business || {}).primary_contact;
54
54
  var _g = entity || {}, license = _g.license, vat_id = _g.vat_id, legal_name = _g.legal_name;
55
+ var count = (individuals || {}).count;
55
56
  var username = isAr ? concatenateObjectValues((names === null || names === void 0 ? void 0 : names.ar) || (names === null || names === void 0 ? void 0 : names.en), ['first', 'last']) : concatenateObjectValues(names === null || names === void 0 ? void 0 : names.en, ['first', 'last']);
56
57
  var licenseNumber = (license === null || license === void 0 ? void 0 : license.number) || '';
57
58
  var bankName = shortenString(bank === null || bank === void 0 ? void 0 : bank.name, 20) || t('bank');
@@ -73,7 +74,7 @@ var SuccessFlowButtons = function (_a) {
73
74
  var name = _a.name, url = _a.url, status = _a.status, token = _a.token;
74
75
  var type = status === 'completed' ? 'completed' : 'pending';
75
76
  var title = t("".concat(name, "_flow_").concat(type), {
76
- individual_name: username.toLowerCase() + maskedId,
77
+ individual_name: is_authorized && count > 1 ? t('company_individuals_details', { count: count }) : username.toLowerCase() + maskedId,
77
78
  brand: brandName,
78
79
  business_type: entityLegalName,
79
80
  license_number: licenseNumber ? t('masking_symbols') + showLastFour(licenseNumber) : '',
@@ -107,7 +108,8 @@ var SuccessFlowButtons = function (_a) {
107
108
  flowName: flowName,
108
109
  email: email || '',
109
110
  emailUrl: url,
110
- brandName: shortenBrand(brandName)
111
+ brandName: shortenBrand(brandName),
112
+ isAuthorizedUser: is_authorized
111
113
  } }) })] }));
112
114
  };
113
115
  export default memo(SuccessFlowButtons);
@@ -16,7 +16,7 @@ import { taxSelector } from '../../../app/tax/taxStore';
16
16
  import SuccessFlowButtons from '../../../shared/SuccessFlowButtons';
17
17
  var SuccessWithFlowButtons = function () {
18
18
  var data = useAppSelector(taxSelector).data;
19
- var _a = data.verify.responseBody || {}, flows = _a.flows, entity = _a.entity, brand = _a.brand, bank = _a.bank_account, merchant = _a.merchant, user = _a.user, business = _a.business, board_id = _a.board_id, board_info_id = _a.board_info_id, name = _a.name;
20
- return (_jsx(SuccessFlowButtons, { flowName: data.flowName, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, flows: flows || [] }));
19
+ var _a = data.verify.responseBody || {}, flows = _a.flows, entity = _a.entity, brand = _a.brand, bank = _a.bank_account, merchant = _a.merchant, user = _a.user, business = _a.business, board_id = _a.board_id, board_info_id = _a.board_info_id, name = _a.name, individuals = _a.individuals;
20
+ return (_jsx(SuccessFlowButtons, { flowName: data.flowName, bank: bank, brand: brand, entity: entity, merchant: merchant, user: __assign({ names: { en: name } }, user), business: business, boardId: board_id, boardInfoId: board_info_id, individuals: individuals, flows: flows || [] }));
21
21
  };
22
22
  export default memo(SuccessWithFlowButtons);
@@ -35,10 +35,11 @@ var FormStyled = styled(Form)(function () { return ({
35
35
  var TaxDetails = function () {
36
36
  var dispatch = useAppDispatch();
37
37
  var _a = useAppSelector(taxSelector), data = _a.data, loading = _a.loading, error = _a.error, uploading = _a.uploading;
38
+ var entity = (data.verify.responseBody || {}).entity;
38
39
  var settingsData = useAppSelector(settingsSelector).data;
39
40
  var _b = data.taxData, vatId = _b.vatId, confirmPolicy = _b.confirmPolicy, documentId = _b.documentId;
40
41
  var methods = useForm({
41
- resolver: yupResolver(Validation),
42
+ resolver: yupResolver(Validation(entity)),
42
43
  defaultValues: {
43
44
  vatId: vatId,
44
45
  confirmPolicy: confirmPolicy,
@@ -17,26 +17,31 @@ import { useTranslation } from 'react-i18next';
17
17
  import { useController, useFormContext } from 'react-hook-form';
18
18
  import { VAT_ID_LENGTH } from '../../../../constants';
19
19
  import { useAppSelector } from '../../../../hooks';
20
+ import { FieldType } from '../../../../@types';
20
21
  import { isSA, removeAllCharsFromNumber } from '../../../../utils';
21
22
  import { settingsSelector } from '../../../../app/settings';
22
23
  import ClearIcon from '../../../shared/ClearIcon';
23
24
  import CheckIcon from '../../../shared/CheckIcon';
25
+ import { taxSelector } from '../../../app/tax/taxStore';
24
26
  var VATId = function () {
25
- var _a;
27
+ var _a, _b;
26
28
  var t = useTranslation().t;
27
29
  var control = useFormContext().control;
28
30
  var vatControl = useController({ name: 'vatId', control: control });
29
31
  var settingsData = useAppSelector(settingsSelector).data;
30
32
  var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
33
+ var data = useAppSelector(taxSelector).data;
34
+ var entity = (data.verify.responseBody || {}).entity;
35
+ var disabled = ((_a = entity === null || entity === void 0 ? void 0 : entity.data_status) === null || _a === void 0 ? void 0 : _a.tax_number) === FieldType.NON_EDITABLE;
31
36
  var handleOnChange = function (vat) {
32
37
  var value = removeAllCharsFromNumber(vat);
33
38
  vatControl.field.onChange(value);
34
39
  };
35
40
  var vatValue = vatControl.field.value;
36
- var vatError = (_a = vatControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
41
+ var vatError = (_b = vatControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
37
42
  var clearValue = function () {
38
43
  vatControl.field.onChange('');
39
44
  };
40
- return (_jsx(Box, __assign({ sx: isSACountry ? {} : { height: '200px' } }, { children: _jsx(Input, { 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: !vatError && vatValue ? _jsx(CheckIcon, {}) : vatValue && _jsx(ClearIcon, { onClick: clearValue }) }) })));
45
+ return (_jsx(Box, __assign({ sx: isSACountry ? {} : { height: '200px' } }, { children: _jsx(Input, { 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 }) }) })));
41
46
  };
42
47
  export default VATId;
@@ -1,14 +1,14 @@
1
1
  import * as yup from 'yup';
2
- export declare const Validation: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
- vatId: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
2
+ export declare const Validation: (entity: any) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ vatId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
4
4
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
5
5
  documentId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
6
6
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
7
- vatId: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
7
+ vatId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
8
8
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
9
9
  documentId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
10
10
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
11
- vatId: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
11
+ vatId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
12
12
  confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
13
13
  documentId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
14
14
  }>>>;
@@ -1,6 +1,11 @@
1
1
  import * as yup from 'yup';
2
- export var Validation = yup.object().shape({
3
- vatId: yup.string().min(9, 'alert_vat').max(15, 'alert_vat').required('alert_vat'),
4
- confirmPolicy: yup.boolean().required('alert_tax_confirm').isTrue('alert_tax_confirm'),
5
- documentId: yup.array().optional()
6
- });
2
+ import { FieldType } from '../../../../@types';
3
+ export var Validation = function (entity) {
4
+ var _a = entity || {}, vat_id = _a.vat_id, data_status = _a.data_status;
5
+ var isTaxNumberOptional = !vat_id && (data_status === null || data_status === void 0 ? void 0 : data_status.tax_number) === FieldType.NON_EDITABLE;
6
+ return yup.object().shape({
7
+ vatId: isTaxNumberOptional ? yup.string().optional() : yup.string().min(9, 'alert_vat').max(15, 'alert_vat').required('alert_vat'),
8
+ confirmPolicy: yup.boolean().required('alert_tax_confirm').isTrue('alert_tax_confirm'),
9
+ documentId: yup.array().optional()
10
+ });
11
+ };
@@ -1,4 +1,4 @@
1
- import { DeviceInfo } from '../@types';
1
+ import { DeviceInfo, User } from '../@types';
2
2
  export declare const maskPhone: (str?: string) => string;
3
3
  export declare const shortenString: (str: string, length: number) => string;
4
4
  export declare const maskID: (str: string) => string;
@@ -42,7 +42,7 @@ export declare const getRequestHeaders: (deviceInfo: DeviceInfo) => {
42
42
  };
43
43
  export declare const removeRequestHeaders: () => void;
44
44
  export declare const getBaseUrl: () => string;
45
- export declare const getScreenNameBasedOnFlow: (flow: string) => "CONNECT_NID_STEP" | "" | "BUSINESS_BUSINESS_TYPE_STEP" | "INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP" | "BANK_BANK_DETAILS_STEP" | "TAX_TAX_DETAILS_STEP";
45
+ export declare const getScreenNameBasedOnFlow: (flow: string, isAuthorizedUser?: boolean) => "CONNECT_NID_STEP" | "" | "BUSINESS_BUSINESS_TYPE_STEP" | "INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP" | "INDIVIDUAL_LIST_STEP" | "BANK_BANK_DETAILS_STEP" | "TAX_TAX_DETAILS_STEP";
46
46
  export declare const getEighteenYearsAgo: () => string;
47
47
  export declare const isKW: (flag: string) => boolean;
48
48
  export declare const isSA: (flag: string) => boolean;
@@ -56,3 +56,4 @@ export declare const isInstagram: (flag: string) => boolean;
56
56
  export declare const isPhysicalStore: (flag: string) => boolean;
57
57
  export declare const isCallCenter: (flag: string) => boolean;
58
58
  export declare const getChannelIcon: (channel: string) => string;
59
+ export declare const getUserName: (user: User, isAr: boolean) => string;
@@ -1,5 +1,5 @@
1
1
  import { FlowsTypes } from '../@types';
2
- import { encryptString } from '.';
2
+ import { concatenateObjectValues, encryptString } from '.';
3
3
  import { removeAxiosGlobalHeaders } from '../api';
4
4
  import { ENDPOINT_PATHS, ICONS_FULL_PATH } from '../constants';
5
5
  import moment from 'moment';
@@ -172,7 +172,7 @@ export var getBaseUrl = function () {
172
172
  }
173
173
  return ENDPOINT_PATHS.PRODUCTION_BASE_URL;
174
174
  };
175
- export var getScreenNameBasedOnFlow = function (flow) {
175
+ export var getScreenNameBasedOnFlow = function (flow, isAuthorizedUser) {
176
176
  if (flow === FlowsTypes.BANK) {
177
177
  return 'BANK_BANK_DETAILS_STEP';
178
178
  }
@@ -180,7 +180,7 @@ export var getScreenNameBasedOnFlow = function (flow) {
180
180
  return 'BUSINESS_BUSINESS_TYPE_STEP';
181
181
  }
182
182
  if (flow === FlowsTypes.INDIVIDUAL) {
183
- return 'INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP';
183
+ return isAuthorizedUser ? 'INDIVIDUAL_LIST_STEP' : 'INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP';
184
184
  }
185
185
  if (flow === FlowsTypes.CONNECT) {
186
186
  return 'CONNECT_NID_STEP';
@@ -258,3 +258,16 @@ export var getChannelIcon = function (channel) {
258
258
  }
259
259
  return '';
260
260
  };
261
+ export var getUserName = function (user, isAr) {
262
+ var _a, _b;
263
+ var fullNameEn = concatenateObjectValues((_a = user === null || user === void 0 ? void 0 : user.names) === null || _a === void 0 ? void 0 : _a.en, ['first', 'middle', 'last']);
264
+ var fullNameAR = concatenateObjectValues((_b = user === null || user === void 0 ? void 0 : user.names) === null || _b === void 0 ? void 0 : _b.ar, ['first', 'middle', 'last']);
265
+ var nameEN = '';
266
+ var nameAR = '';
267
+ if (fullNameEn)
268
+ nameEN = capitalizeTheFirstLetterOfEachWord(fullNameEn);
269
+ if (fullNameAR)
270
+ nameAR = capitalizeTheFirstLetterOfEachWord(fullNameAR);
271
+ var name = isAr ? nameAR || nameEN : nameEN;
272
+ return name;
273
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.1.75-test",
3
+ "version": "2.1.76-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",
@@ -1,19 +0,0 @@
1
- import * as React from 'react';
2
- export interface ShowOwnerInfoProps {
3
- citizenship: string;
4
- nationalAddr: string;
5
- birthDate: string;
6
- placeOfBirth: string;
7
- maritalStatus: string;
8
- }
9
- declare const _default: React.MemoExoticComponent<{
10
- ({ citizenship, nationalAddr, birthDate, placeOfBirth, maritalStatus }: ShowOwnerInfoProps): JSX.Element;
11
- defaultProps: {
12
- citizenship: string;
13
- nationalAddr: string;
14
- birthDate: string;
15
- placeOfBirth: string;
16
- maritalStatus: string;
17
- };
18
- }>;
19
- export default _default;
@@ -1,52 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import * as React from 'react';
14
- import Box from '@mui/material/Box';
15
- import { useTranslation } from 'react-i18next';
16
- import { useAppDispatch } from '../../../../hooks';
17
- import { handleNextScreenStep } from '../../../../app/settings';
18
- import { styled } from '@mui/material/styles';
19
- import Collapse from '../../../../components/Collapse';
20
- import Button from '../../../shared/Button';
21
- import ScreenContainer from '../../../shared/Containers/ScreenContainer';
22
- import { useLanguage } from '../../../../hooks';
23
- import Info from './info';
24
- var InputsContainerStyled = styled(Box)(function (_a) {
25
- var _b;
26
- var theme = _a.theme;
27
- return (_b = {
28
- paddingBottom: theme.spacing(5)
29
- },
30
- _b[theme.transitions.create(['padding-bottom'])] = {
31
- duration: theme.transitions.duration.standard
32
- },
33
- _b);
34
- });
35
- var ShowOwnerInfo = function (_a) {
36
- var citizenship = _a.citizenship, nationalAddr = _a.nationalAddr, birthDate = _a.birthDate, placeOfBirth = _a.placeOfBirth, maritalStatus = _a.maritalStatus;
37
- var t = useTranslation().t;
38
- var isAr = useLanguage().isAr;
39
- var dispatch = useAppDispatch();
40
- var handleClickNext = function () {
41
- dispatch(handleNextScreenStep());
42
- };
43
- return (_jsxs(ScreenContainer, { children: [_jsxs(InputsContainerStyled, { children: [_jsx(Collapse, __assign({ in: !!citizenship }, { children: _jsx(Info, { label: 'citizenship', value: citizenship }) })), _jsx(Collapse, __assign({ in: !!nationalAddr }, { children: _jsx(Info, { label: 'national_address', value: nationalAddr }) })), _jsx(Info, { label: t('birthdate'), value: birthDate }), _jsx(Info, { label: 'place_of_birth', value: placeOfBirth }), _jsx(Collapse, __assign({ in: !!maritalStatus }, { children: _jsx(Info, { label: 'marital_status', value: maritalStatus }) }))] }), _jsx(Button, __assign({ disableBack: true, isAr: isAr, disabled: false, loading: false, onClick: handleClickNext }, { children: t('next') }))] }));
44
- };
45
- export default React.memo(ShowOwnerInfo);
46
- ShowOwnerInfo.defaultProps = {
47
- citizenship: '',
48
- nationalAddr: 'Kuwait',
49
- birthDate: '18-12-1983',
50
- placeOfBirth: 'Kuwait',
51
- maritalStatus: ''
52
- };
@@ -1,3 +0,0 @@
1
- import ShowOwnerInfo, { ShowOwnerInfoProps } from './ShowOwnerInfo';
2
- export type { ShowOwnerInfoProps };
3
- export default ShowOwnerInfo;
@@ -1,2 +0,0 @@
1
- import ShowOwnerInfo from './ShowOwnerInfo';
2
- export default ShowOwnerInfo;
@@ -1,7 +0,0 @@
1
- /// <reference types="react" />
2
- interface InfoProps {
3
- label: string;
4
- value: string;
5
- }
6
- export default function Info({ label, value }: InfoProps): JSX.Element;
7
- export {};
@@ -1,28 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { useTranslation } from 'react-i18next';
14
- import { styled, alpha } from '@mui/material/styles';
15
- import Text from '../../../../components/Text';
16
- var LabelTextStyled = styled(Text)(function (_a) {
17
- var theme = _a.theme;
18
- return (__assign(__assign({}, theme.typography.caption), { color: alpha(theme.palette.text.primary, 0.6), paddingInlineStart: theme.spacing(2.5), marginBlockStart: theme.spacing(3.5), marginBlockEnd: theme.spacing(1.25) }));
19
- });
20
- var ValueTextStyled = styled(Text)(function (_a) {
21
- var theme = _a.theme;
22
- return (__assign(__assign({ background: theme.palette.common.white, color: theme.palette.text.primary, border: "".concat(theme.spacing(0.125), " solid ").concat(theme.palette.divider), maxHeight: theme.spacing(5.5), paddingBlock: theme.spacing(1.75), paddingInlineStart: theme.spacing(2.5), fontWeight: theme.typography.fontWeightLight }, theme.typography.body2), { lineHeight: theme.spacing(2.125) }));
23
- });
24
- export default function Info(_a) {
25
- var label = _a.label, value = _a.value;
26
- var t = useTranslation().t;
27
- return (_jsxs(_Fragment, { children: [_jsx(LabelTextStyled, { children: t(label) }), _jsx(ValueTextStyled, { children: value })] }));
28
- }