@tap-payments/auth-jsconnect 2.0.45 → 2.0.46

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 (203) hide show
  1. package/build/@types/app.d.ts +47 -2
  2. package/build/@types/app.js +22 -0
  3. package/build/@types/form.d.ts +19 -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/entity.d.ts +3 -3
  13. package/build/api/index.d.ts +8 -3
  14. package/build/api/individual.d.ts +54 -4
  15. package/build/api/individual.js +9 -1
  16. package/build/api/user.d.ts +6 -0
  17. package/build/api/user.js +9 -1
  18. package/build/app/settings.js +11 -8
  19. package/build/assets/locales/ar.json +28 -2
  20. package/build/assets/locales/en.json +28 -1
  21. package/build/components/SimpleList/SimpleList.d.ts +2 -0
  22. package/build/constants/api.d.ts +1 -0
  23. package/build/constants/api.js +3 -1
  24. package/build/constants/app.d.ts +1 -0
  25. package/build/constants/app.js +20 -7
  26. package/build/constants/assets.d.ts +4 -0
  27. package/build/constants/assets.js +4 -0
  28. package/build/features/app/bank/bankStore.d.ts +1 -0
  29. package/build/features/app/bank/bankStore.js +19 -13
  30. package/build/features/app/brand/brandStore.d.ts +2 -0
  31. package/build/features/app/brand/brandStore.js +69 -49
  32. package/build/features/app/business/businessStore.js +3 -3
  33. package/build/features/app/connect/connectStore.js +6 -6
  34. package/build/features/app/connectExpress/connectExpressStore.js +15 -9
  35. package/build/features/app/entity/entityStore.d.ts +2 -0
  36. package/build/features/app/entity/entityStore.js +5 -3
  37. package/build/features/app/individual/individualStore.d.ts +93 -4
  38. package/build/features/app/individual/individualStore.js +613 -129
  39. package/build/features/app/password/passwordStore.js +2 -2
  40. package/build/features/app/tax/taxStore.js +30 -29
  41. package/build/features/bank/Bank.js +2 -2
  42. package/build/features/bank/screens/BankDetails/BankDetails.js +8 -7
  43. package/build/features/bank/screens/BankDetails/BankName.js +13 -10
  44. package/build/features/bank/screens/BankDetails/BankStatement.js +8 -2
  45. package/build/features/bank/screens/BankDetails/Beneficiary.js +12 -13
  46. package/build/features/bank/screens/BankDetails/IBAN.js +14 -10
  47. package/build/features/bank/screens/BankDetails/validation.d.ts +14 -14
  48. package/build/features/bank/screens/BankDetails/validation.js +34 -15
  49. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  50. package/build/features/brand/Brand.js +2 -2
  51. package/build/features/brand/screens/BrandActivities/ActivitiesList.d.ts +3 -3
  52. package/build/features/brand/screens/BrandActivities/ActivitiesList.js +8 -6
  53. package/build/features/brand/screens/BrandActivities/BrandActivities.js +12 -2
  54. package/build/features/brand/screens/BrandActivities/CustomerBase.d.ts +2 -2
  55. package/build/features/brand/screens/BrandActivities/CustomerBase.js +9 -6
  56. package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +10 -7
  57. package/build/features/brand/screens/BrandActivities/validation.d.ts +7 -7
  58. package/build/features/brand/screens/BrandActivities/validation.js +26 -15
  59. package/build/features/brand/screens/BrandInfo/BrandInfo.js +11 -4
  60. package/build/features/brand/screens/BrandInfo/BrandName.js +13 -12
  61. package/build/features/brand/screens/BrandInfo/SalesChannels.js +21 -9
  62. package/build/features/brand/screens/BrandInfo/validation.d.ts +7 -7
  63. package/build/features/brand/screens/BrandInfo/validation.js +46 -36
  64. package/build/features/brand/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  65. package/build/features/business/Business.js +2 -2
  66. package/build/features/business/screens/Activities/ActivitiesList.d.ts +3 -3
  67. package/build/features/business/screens/BusinessType/LicenseCertificate.js +2 -1
  68. package/build/features/business/screens/BusinessType/LicenseType.d.ts +2 -2
  69. package/build/features/business/screens/Customers/CustomerLocations.d.ts +2 -2
  70. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  71. package/build/features/connect/Connect.js +2 -2
  72. package/build/features/connect/screens/Merchant/BrandList.js +4 -4
  73. package/build/features/connect/screens/Merchant/BrandName.js +6 -5
  74. package/build/features/connect/screens/Merchant/validation.js +2 -2
  75. package/build/features/connectExpress/ConnectExpress.js +2 -2
  76. package/build/features/connectExpress/screens/CollectBusinessInfo/BrandName.js +1 -3
  77. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.d.ts +2 -2
  78. package/build/features/connectExpress/screens/CollectBusinessInfo/validation.js +5 -5
  79. package/build/features/connectExpress/screens/CreateAccountLoader/CreateAccountLoader.js +23 -3
  80. package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +3 -3
  81. package/build/features/entity/Entity.js +2 -2
  82. package/build/features/entity/screens/EntityCapital/ActivityList.d.ts +3 -3
  83. package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +3 -3
  84. package/build/features/entity/screens/EntityName/LicenseCertificate.js +9 -3
  85. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  86. package/build/features/featuresScreens.js +10 -0
  87. package/build/features/individual/Individual.js +2 -2
  88. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.d.ts +13 -0
  89. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +48 -25
  90. package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.js +6 -1
  91. package/build/features/individual/screens/AdditionalIndividualInfo/InfluencerSwitch.js +9 -2
  92. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +11 -17
  93. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +12 -16
  94. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.d.ts +2 -2
  95. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.js +9 -2
  96. package/build/features/individual/screens/AdditionalIndividualInfo/ShareCount.d.ts +6 -0
  97. package/build/features/individual/screens/AdditionalIndividualInfo/ShareCount.js +35 -0
  98. package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.d.ts +6 -0
  99. package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +41 -0
  100. package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.js +8 -2
  101. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +9 -6
  102. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +25 -23
  103. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +19 -25
  104. package/build/features/individual/screens/IndividualList/CollectPhoneEmail.d.ts +10 -0
  105. package/build/features/individual/screens/IndividualList/CollectPhoneEmail.js +31 -0
  106. package/build/features/individual/screens/IndividualList/Email.d.ts +6 -0
  107. package/build/features/individual/screens/IndividualList/Email.js +48 -0
  108. package/build/features/individual/screens/IndividualList/IndividualList.d.ts +31 -0
  109. package/build/features/individual/screens/IndividualList/IndividualList.js +58 -0
  110. package/build/features/individual/screens/IndividualList/MobileNumber.d.ts +12 -0
  111. package/build/features/individual/screens/IndividualList/MobileNumber.js +143 -0
  112. package/build/features/individual/screens/IndividualList/UserList.d.ts +5 -0
  113. package/build/features/individual/screens/IndividualList/UserList.js +186 -0
  114. package/build/features/individual/screens/IndividualList/index.d.ts +3 -0
  115. package/build/features/individual/screens/IndividualList/index.js +2 -0
  116. package/build/features/individual/screens/IndividualList/validation.d.ts +12 -0
  117. package/build/features/individual/screens/IndividualList/validation.js +39 -0
  118. package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.d.ts +8 -0
  119. package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.js +109 -0
  120. package/build/features/individual/screens/{AdditionalIndividualInfo/EmployerLocation.d.ts → IndividualPersonalInfo/BirthCountry.d.ts} +2 -2
  121. package/build/features/individual/screens/{AdditionalIndividualInfo/EmployerLocation.js → IndividualPersonalInfo/BirthCountry.js} +14 -24
  122. package/build/features/individual/screens/IndividualPersonalInfo/DOB.d.ts +7 -0
  123. package/build/features/individual/screens/IndividualPersonalInfo/DOB.js +46 -0
  124. package/build/features/individual/screens/IndividualPersonalInfo/Email.d.ts +6 -0
  125. package/build/features/individual/screens/IndividualPersonalInfo/Email.js +50 -0
  126. package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.d.ts +7 -0
  127. package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.js +50 -0
  128. package/build/features/individual/screens/IndividualPersonalInfo/Gender.d.ts +34 -0
  129. package/build/features/individual/screens/IndividualPersonalInfo/Gender.js +81 -0
  130. package/build/features/individual/screens/IndividualPersonalInfo/ID.d.ts +6 -0
  131. package/build/features/individual/screens/IndividualPersonalInfo/ID.js +48 -0
  132. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.d.ts +21 -0
  133. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +139 -0
  134. package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.d.ts +10 -0
  135. package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.js +88 -0
  136. package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.d.ts +10 -0
  137. package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.js +145 -0
  138. package/build/features/individual/screens/IndividualPersonalInfo/Name.d.ts +6 -0
  139. package/build/features/individual/screens/IndividualPersonalInfo/Name.js +52 -0
  140. package/build/features/individual/screens/IndividualPersonalInfo/Nationality.d.ts +10 -0
  141. package/build/features/individual/screens/IndividualPersonalInfo/Nationality.js +88 -0
  142. package/build/features/individual/screens/IndividualPersonalInfo/index.d.ts +3 -0
  143. package/build/features/individual/screens/IndividualPersonalInfo/index.js +2 -0
  144. package/build/features/individual/screens/IndividualPersonalInfo/validation.d.ts +38 -0
  145. package/build/features/individual/screens/IndividualPersonalInfo/validation.js +68 -0
  146. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  147. package/build/features/individual/screens/Verify/Verify.js +10 -17
  148. package/build/features/password/Password.js +2 -2
  149. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  150. package/build/features/shared/Address/Address.d.ts +6 -1
  151. package/build/features/shared/Address/Address.js +40 -30
  152. package/build/features/shared/Address/CountryList.d.ts +1 -1
  153. package/build/features/shared/Address/InputSelect.d.ts +1 -1
  154. package/build/features/shared/Address/InputText.d.ts +2 -1
  155. package/build/features/shared/Address/InputText.js +2 -2
  156. package/build/features/shared/Button/Button.js +11 -0
  157. package/build/features/shared/Button/FlowsButtons.d.ts +1 -0
  158. package/build/features/shared/Button/FlowsButtons.js +5 -5
  159. package/build/features/shared/Button/ListButton.d.ts +18 -0
  160. package/build/features/shared/Button/ListButton.js +125 -0
  161. package/build/features/shared/Button/index.d.ts +2 -1
  162. package/build/features/shared/Button/index.js +2 -1
  163. package/build/features/shared/CreateAccountLoading/CreateAccountLoading.d.ts +2 -1
  164. package/build/features/shared/CreateAccountLoading/CreateAccountLoading.js +2 -2
  165. package/build/features/shared/SalesChannels/SalesChannel.d.ts +2 -1
  166. package/build/features/shared/SalesChannels/SalesChannel.js +2 -2
  167. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.d.ts +2 -1
  168. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +8 -6
  169. package/build/features/shared/UploadMultipleFile/UploadMultipleFile.d.ts +6 -1
  170. package/build/features/shared/UploadMultipleFile/UploadMultipleFile.js +33 -11
  171. package/build/features/signIn/SignIn.js +2 -2
  172. package/build/features/tax/Tax.js +2 -2
  173. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  174. package/build/features/tax/screens/TaxDetails/TaxDetails.js +2 -1
  175. package/build/features/tax/screens/TaxDetails/TaxDocument.js +8 -2
  176. package/build/features/tax/screens/TaxDetails/VATId.js +8 -3
  177. package/build/features/tax/screens/TaxDetails/validation.d.ts +4 -4
  178. package/build/features/tax/screens/TaxDetails/validation.js +10 -5
  179. package/build/utils/array.d.ts +1 -0
  180. package/build/utils/array.js +10 -2
  181. package/build/utils/common.d.ts +1 -0
  182. package/build/utils/common.js +6 -0
  183. package/build/utils/date.d.ts +1 -0
  184. package/build/utils/date.js +7 -1
  185. package/build/utils/error.d.ts +1 -0
  186. package/build/utils/error.js +3 -0
  187. package/build/utils/html.d.ts +1 -1
  188. package/build/utils/html.js +4 -1
  189. package/build/utils/index.d.ts +1 -0
  190. package/build/utils/index.js +1 -0
  191. package/build/utils/string.d.ts +15 -2
  192. package/build/utils/string.js +37 -3
  193. package/build/utils/validation.d.ts +1 -0
  194. package/build/utils/validation.js +3 -0
  195. package/package.json +129 -129
  196. package/build/features/individual/screens/AdditionalIndividualInfo/EmployerName.d.ts +0 -6
  197. package/build/features/individual/screens/AdditionalIndividualInfo/EmployerName.js +0 -46
  198. package/build/features/individual/screens/ShowIndividualInfo/ShowOwnerInfo.d.ts +0 -19
  199. package/build/features/individual/screens/ShowIndividualInfo/ShowOwnerInfo.js +0 -52
  200. package/build/features/individual/screens/ShowIndividualInfo/index.d.ts +0 -3
  201. package/build/features/individual/screens/ShowIndividualInfo/index.js +0 -2
  202. package/build/features/individual/screens/ShowIndividualInfo/info.d.ts +0 -7
  203. package/build/features/individual/screens/ShowIndividualInfo/info.js +0 -28
@@ -13,30 +13,39 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import * as React from 'react';
14
14
  import { yupResolver } from '@hookform/resolvers/yup';
15
15
  import { useForm, FormProvider } from 'react-hook-form';
16
- import Box from '@mui/material/Box';
17
16
  import { useTranslation } from 'react-i18next';
18
- import { useAppDispatch, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
19
- import { handleCurrentActiveScreen, settingsSelector } from '../../../../app/settings';
17
+ import { handleCurrentActiveScreen } from '../../../../app/settings';
18
+ import Box from '@mui/material/Box';
19
+ import { alpha, styled } from '@mui/material/styles';
20
+ import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage } from '../../../../hooks';
21
+ import { IndividualType } from '../../../../@types';
20
22
  import Form from '../../../../components/Form';
21
23
  import Collapse from '../../../../components/Collapse';
24
+ import Text from '../../../../components/Text';
25
+ import { individualSelector, updateIndividualInfo } from '../../../app/individual/individualStore';
22
26
  import Button from '../../../shared/Button';
23
27
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
24
- import { useLanguage } from '../../../../hooks';
25
28
  import PEPSwitch from './PEPSwitch';
26
29
  import { IndividualInfoValidationSchema } from './validation';
27
30
  import InfluencerSwitch from './InfluencerSwitch';
28
31
  import MonthlyIncome from './MonthlyIncome';
29
- import EmployerName from './EmployerName';
30
- import EmployerLocation from './EmployerLocation';
31
32
  import SourceOfIncome from './SourceOfIncome';
32
- import { individualSelector, updateIndividualInfo } from '../../../app/individual/individualStore';
33
33
  import Occupation from './Occupation';
34
34
  import CivilIDFile from './CivilIDFile';
35
35
  import SignatureFile from './SignatureFile';
36
+ import ShareCount from './ShareCount';
37
+ import ShareValue from './ShareValue';
38
+ var TextBoxStyled = styled(Box)(function (_a) {
39
+ var theme = _a.theme;
40
+ return (__assign(__assign({ display: 'flex', justifyContent: 'center', flexDirection: 'row', padding: theme.spacing(1.8, 2.5, 1.8, 2.5) }, theme.typography.body1), { lineHeight: theme.spacing(2.5), color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightMedium }));
41
+ });
42
+ export var RoleTextStyled = styled(Text)(function (_a) {
43
+ var theme = _a.theme;
44
+ return (__assign(__assign({}, theme.typography.body1), { display: 'inline', paddingInlineStart: theme.spacing(1.5), color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }));
45
+ });
36
46
  var ListType;
37
47
  (function (ListType) {
38
48
  ListType["SourceOfIncomeList"] = "SourceOfIncomeList";
39
- ListType["EmployerLocationList"] = "EmployerLocationList";
40
49
  ListType["MonthlyIncomeList"] = "MonthlyIncomeList";
41
50
  ListType["OccupationList"] = "OccupationList";
42
51
  })(ListType || (ListType = {}));
@@ -45,12 +54,12 @@ var AdditionalIndividualInfo = function (_a) {
45
54
  var isAr = useLanguage().isAr;
46
55
  var dispatch = useAppDispatch();
47
56
  var _b = useAppSelector(individualSelector), data = _b.data, loading = _b.loading, error = _b.error;
48
- var settingsData = useAppSelector(settingsSelector).data;
49
- var countries = settingsData.countries;
50
- var user = (data.verify.responseBody || {}).user;
51
- var _c = data.individualData, occupation = _c.occupation, sourceIncome = _c.sourceIncome, monthlyIncome = _c.monthlyIncome, employerName = _c.employerName, employerLocation = _c.employerLocation, isPEP = _c.isPEP, isInfluencer = _c.isInfluencer, civilID = _c.civilID, signatureFileId = _c.signatureFileId, civilIDUploading = _c.civilIDUploading, signatureFileUploading = _c.signatureFileUploading;
57
+ var verify = data.verify;
58
+ var user = (verify.responseBody || {}).user;
59
+ var isAuthorizedUser = user === null || user === void 0 ? void 0 : user.is_authorized;
60
+ var _c = data.individualData, occupation = _c.occupation, sourceIncome = _c.sourceIncome, monthlyIncome = _c.monthlyIncome, employerName = _c.employerName, employerLocation = _c.employerLocation, isPEP = _c.isPEP, isInfluencer = _c.isInfluencer, civilID = _c.civilID, signatureFileId = _c.signatureFileId, civilIDUploading = _c.civilIDUploading, signatureFileUploading = _c.signatureFileUploading, shareCount = _c.shareCount, shareValue = _c.shareValue;
52
61
  var methods = useForm({
53
- resolver: yupResolver(IndividualInfoValidationSchema),
62
+ resolver: yupResolver(IndividualInfoValidationSchema(isAuthorizedUser, user)),
54
63
  defaultValues: {
55
64
  occupation: occupation,
56
65
  sourceIncome: sourceIncome,
@@ -62,35 +71,49 @@ var AdditionalIndividualInfo = function (_a) {
62
71
  civilID: civilID,
63
72
  signatureFileId: signatureFileId,
64
73
  civilIDUploading: civilIDUploading,
65
- signatureFileUploading: signatureFileUploading
74
+ signatureFileUploading: signatureFileUploading,
75
+ shareCount: shareCount,
76
+ shareValue: shareValue
66
77
  },
67
78
  mode: 'onChange'
68
79
  });
69
80
  useSetFromDefaultValues(methods, data.individualData, true);
70
81
  var _d = React.useState(), listActive = _d[0], setListActive = _d[1];
71
- var _e = React.useState(false), employerFieldsActive = _e[0], setEmployerFieldsActive = _e[1];
72
- React.useEffect(function () {
73
- var _a, _b;
74
- if (((_b = (_a = methods.getValues('sourceIncome')) === null || _a === void 0 ? void 0 : _a.name.en) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'salary')
75
- setEmployerFieldsActive(true);
76
- else
77
- setEmployerFieldsActive(false);
78
- }, [methods.watch('sourceIncome')]);
79
82
  var onSubmit = function (data) {
80
83
  dispatch(updateIndividualInfo(data));
81
84
  };
82
85
  var onBack = function () {
83
- dispatch(handleCurrentActiveScreen('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
86
+ dispatch(handleCurrentActiveScreen('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
84
87
  };
85
88
  var handleMenuClick = function (flag) {
86
89
  setListActive(flag);
87
90
  };
91
+ var getUserName = function () {
92
+ var _a, _b, _c, _d;
93
+ var name = isAr ? (_b = (_a = user === null || user === void 0 ? void 0 : user.names) === null || _a === void 0 ? void 0 : _a.ar) === null || _b === void 0 ? void 0 : _b.first : (_d = (_c = user === null || user === void 0 ? void 0 : user.names) === null || _c === void 0 ? void 0 : _c.en) === null || _d === void 0 ? void 0 : _d.first;
94
+ return name;
95
+ };
96
+ var getUserRole = function () {
97
+ var _a, _b, _c, _d, _e;
98
+ if ((((_a = user === null || user === void 0 ? void 0 : user.role) === null || _a === void 0 ? void 0 : _a.length) || 0) > 0)
99
+ return isAr ? (_c = (_b = user.role[0]) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.ar : (_e = (_d = user.role[0]) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.en;
100
+ if ((user === null || user === void 0 ? void 0 : user.type) === IndividualType.SHARE_HOLDER)
101
+ return t('type_share_holder');
102
+ if ((user === null || user === void 0 ? void 0 : user.type) === IndividualType.BOARD_MEMBER)
103
+ return t('type_board_member');
104
+ return t('type_user');
105
+ };
106
+ var showSignatureFile = (user === null || user === void 0 ? void 0 : user.type) === IndividualType.USER || (user === null || user === void 0 ? void 0 : user.type) === IndividualType.BUYER;
107
+ var showOccupationFile = (user === null || user === void 0 ? void 0 : user.type) === IndividualType.USER || (user === null || user === void 0 ? void 0 : user.type) === IndividualType.BUYER;
108
+ var showSourceOfIncome = (user === null || user === void 0 ? void 0 : user.type) === IndividualType.USER || (user === null || user === void 0 ? void 0 : user.type) === IndividualType.BUYER;
109
+ var showIsPEP = (user === null || user === void 0 ? void 0 : user.type) === IndividualType.USER || (user === null || user === void 0 ? void 0 : user.type) === IndividualType.BOARD_MEMBER;
110
+ var showIsInfluencer = (user === null || user === void 0 ? void 0 : user.type) === IndividualType.USER || (user === null || user === void 0 ? void 0 : user.type) === IndividualType.BOARD_MEMBER;
111
+ var showShares = (user === null || user === void 0 ? void 0 : user.type) === IndividualType.SHARE_HOLDER;
88
112
  var isSourceOfIncomeListActive = listActive === ListType.SourceOfIncomeList;
89
- var isEmployerLocationListActive = listActive === ListType.EmployerLocationList;
90
113
  var isMonthlyIncomeListActive = listActive === ListType.MonthlyIncomeList;
91
114
  var isOccupationListActive = listActive === ListType.OccupationList;
92
115
  var disabled = !methods.formState.isValid || civilIDUploading || signatureFileUploading;
93
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Occupation, { onListOpen: function () { return handleMenuClick(ListType.OccupationList); }, onListClose: function () { return handleMenuClick(); }, show: !isEmployerLocationListActive && !isMonthlyIncomeListActive && !isSourceOfIncomeListActive }), _jsx(SourceOfIncome, { onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: !isEmployerLocationListActive && !isMonthlyIncomeListActive && !isOccupationListActive }), _jsx(MonthlyIncome, { show: !isEmployerLocationListActive && !isSourceOfIncomeListActive && !isOccupationListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(EmployerName, { show: false }), _jsx(EmployerLocation, { show: !isSourceOfIncomeListActive && employerFieldsActive && !isMonthlyIncomeListActive && !isOccupationListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.EmployerLocationList); }, onListClose: function () { return handleMenuClick(); } }), _jsxs(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: [_jsx(CivilIDFile, {}), _jsx(SignatureFile, { show: user === null || user === void 0 ? void 0 : user.is_authorized })] })), _jsx(PEPSwitch, { show: !listActive }), _jsx(InfluencerSwitch, { show: !listActive })] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disableBack: true, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
116
+ return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: !listActive && !!(user === null || user === void 0 ? void 0 : user.is_authorized), timeout: 500 }, { children: _jsxs(TextBoxStyled, { children: [getUserName() || '', _jsx(RoleTextStyled, { children: getUserRole() || '' })] }) })), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Occupation, { onListOpen: function () { return handleMenuClick(ListType.OccupationList); }, onListClose: function () { return handleMenuClick(); }, show: showOccupationFile && !isMonthlyIncomeListActive && !isSourceOfIncomeListActive }), _jsx(SourceOfIncome, { onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: showSourceOfIncome && !isMonthlyIncomeListActive && !isOccupationListActive }), _jsx(MonthlyIncome, { show: showSourceOfIncome && !isSourceOfIncomeListActive && !isOccupationListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ShareCount, { show: !listActive && showShares }), _jsx(ShareValue, { show: !listActive && showShares }), _jsxs(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: [_jsx(CivilIDFile, {}), _jsx(SignatureFile, { show: (user === null || user === void 0 ? void 0 : user.is_authorized) && showSignatureFile })] })), _jsx(PEPSwitch, { show: showIsPEP && !listActive }), _jsx(InfluencerSwitch, { show: showIsInfluencer && !listActive })] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) }))] }));
94
117
  };
95
118
  export default React.memo(AdditionalIndividualInfo);
96
119
  AdditionalIndividualInfo.defaultProps = {};
@@ -1,9 +1,12 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
2
3
  import { ScreenContainer } from '../../../../features/shared/Containers';
3
4
  import { styled } from '@mui/material/styles';
4
5
  import { useTranslation } from 'react-i18next';
5
6
  import { useController, useFormContext } from 'react-hook-form';
6
7
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
8
+ import { DocumentPurpose } from '../../../../@types';
9
+ import { getRecentDocumentFiles } from '../../../../utils';
7
10
  import { civilIDUploadingStatus, individualSelector } from '../../../app/individual/individualStore';
8
11
  import UploadMultipleFile from '../../../shared/UploadMultipleFile';
9
12
  var FeatureStyled = styled(ScreenContainer)(function (_a) {
@@ -19,12 +22,14 @@ var CivilIDFile = function () {
19
22
  var control = useFormContext().control;
20
23
  var civilIDFileIdControl = useController({ name: 'civilID', control: control });
21
24
  var _b = useAppSelector(individualSelector), loading = _b.loading, data = _b.data;
25
+ var documents = (((_a = data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.user) || {}).documents;
22
26
  var handleCivilIDChange = function (ids) {
23
27
  civilIDFileIdControl.field.onChange(ids);
24
28
  };
25
29
  var handleReset = function (ids) {
26
30
  civilIDFileIdControl.field.onChange(ids);
27
31
  };
28
- return (_jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { label: t('title_civil_id'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_civilID'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_civil_id'), onFileUploaded: handleCivilIDChange, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, fileTitle: (_a = data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.merchant_id, purpose: 'identity_document', fileUploadingStatus: function (uploading) { return dispatch(civilIDUploadingStatus(uploading)); } }) }));
32
+ var defaultFiles = React.useMemo(function () { return getRecentDocumentFiles(documents, DocumentPurpose.IDENTITY_DOCUMENT); }, [documents]);
33
+ return (_jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { id: 'civilID', control: control, label: t('title_civil_id'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_civilID'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_civil_id'), onFileUploaded: handleCivilIDChange, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, defaultFiles: defaultFiles, purpose: DocumentPurpose.IDENTITY_DOCUMENT, fileUploadingStatus: function (uploading) { return dispatch(civilIDUploadingStatus(uploading)); } }) }));
29
34
  };
30
35
  export default CivilIDFile;
@@ -15,6 +15,8 @@ import { useTranslation } from 'react-i18next';
15
15
  import { useFormContext, useController } from 'react-hook-form';
16
16
  import { ScreenContainer } from '../../../shared/Containers';
17
17
  import Collapse from '../../../../components/Collapse';
18
+ import { useAppSelector } from '../../../../hooks';
19
+ import { FieldType } from '../../../../@types';
18
20
  import { styled, alpha } from '@mui/material/styles';
19
21
  import Mandatory from '../../../shared/Mandatory';
20
22
  import Text from '../../../../components/Text';
@@ -23,6 +25,7 @@ import RadioLabel from '../../../../components/RadioLabel';
23
25
  import { InfoIconStyled, InfoOutlinedIconStyled } from './PEPSwitch';
24
26
  import Box from '@mui/material/Box';
25
27
  import Tooltip from '../../../../components/Tooltip';
28
+ import { individualSelector } from '../../../app/individual/individualStore';
26
29
  var LabelTextStyled = styled(Text)(function (_a) {
27
30
  var theme = _a.theme;
28
31
  return (__assign(__assign({}, theme.typography.caption), { color: alpha(theme.palette.text.primary, 0.6), marginBlockEnd: theme.spacing(0.625) }));
@@ -34,16 +37,20 @@ var RadioGroupStyled = styled(RadioGroup)(function (_a) {
34
37
  });
35
38
  });
36
39
  var InfluencerSwitch = function (_a) {
40
+ var _b;
37
41
  var show = _a.show;
38
- var _b = React.useState(false), isHovered = _b[0], setIsHovered = _b[1];
42
+ var _c = React.useState(false), isHovered = _c[0], setIsHovered = _c[1];
39
43
  var control = useFormContext().control;
40
44
  var t = useTranslation().t;
41
45
  var influencerControl = useController({ name: 'isInfluencer', control: control });
46
+ var data = useAppSelector(individualSelector).data;
47
+ var user = (data.verify.responseBody || {}).user;
48
+ var disabled = ((_b = user === null || user === void 0 ? void 0 : user.data_status) === null || _b === void 0 ? void 0 : _b.is_influencer) === FieldType.NON_EDITABLE;
42
49
  var handleOnChange = function (_a) {
43
50
  var target = _a.target;
44
51
  influencerControl.field.onChange(target.value === 'yes');
45
52
  };
46
53
  var influencerValue = influencerControl.field.value;
47
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pt: 2.5, pl: 2.5, pr: 2.5 } }, { children: [_jsxs(Box, __assign({ style: { display: 'flex', justifyContent: 'space-between' } }, { children: [_jsxs(LabelTextStyled, { children: [t('tap_js_are_you_an_influencer'), _jsx(Mandatory, {})] }), _jsx(Tooltip, __assign({ title: t('influencer_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] })), _jsxs(RadioGroupStyled, __assign({ value: influencerValue != null ? (influencerValue ? 'yes' : 'no') : false, onChange: handleOnChange }, { children: [_jsx(RadioLabel, { value: 'yes', label: t('yes') }), _jsx(RadioLabel, { value: 'no', label: t('no') })] }))] })) })));
54
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pt: 2.5, pl: 2.5, pr: 2.5 } }, { children: [_jsxs(Box, __assign({ style: { display: 'flex', justifyContent: 'space-between' } }, { children: [_jsxs(LabelTextStyled, { children: [t('tap_js_are_you_an_influencer'), _jsx(Mandatory, {})] }), _jsx(Tooltip, __assign({ title: t('influencer_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] })), _jsxs(RadioGroupStyled, __assign({ value: influencerValue != null ? (influencerValue ? 'yes' : 'no') : false, onChange: disabled ? undefined : handleOnChange }, { children: [_jsx(RadioLabel, { value: 'yes', label: t('yes') }), _jsx(RadioLabel, { value: 'no', label: t('no') })] }))] })) })));
48
55
  };
49
56
  export default React.memo(InfluencerSwitch);
@@ -20,7 +20,7 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  }
21
21
  return t;
22
22
  };
23
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
23
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
24
  import * as React from 'react';
25
25
  import { useTranslation } from 'react-i18next';
26
26
  import { useController, useFormContext } from 'react-hook-form';
@@ -31,11 +31,11 @@ import Input from '../../../shared/Input';
31
31
  import CheckIcon from '../../../shared/CheckIcon';
32
32
  import Collapse from '../../../../components/Collapse';
33
33
  import { useAppSelector, useLanguage } from '../../../../hooks';
34
+ import { FieldType } from '../../../../@types';
34
35
  import { individualSelector } from '../../../app/individual/individualStore';
35
36
  import Text from '../../../../components/Text';
36
37
  import ExpandIcon from '../../../../components/ExpandIcon';
37
38
  import SimpleList from '../../../../components/SimpleList';
38
- import Search from '../../../../features/shared/Search';
39
39
  import { findCurrencyByIso2 } from '../../../../utils';
40
40
  import { settingsSelector } from '../../../../app/settings';
41
41
  var Container = styled(Box)(function () { return ({
@@ -54,10 +54,10 @@ var CheckIconStyled = styled(CheckIcon)(function (_a) {
54
54
  });
55
55
  });
56
56
  var MonthlyIncome = function (_a) {
57
- var _b;
57
+ var _b, _c;
58
58
  var rest = __rest(_a, []);
59
- var _c = React.useState([]), incomeList = _c[0], setIncomeList = _c[1];
60
- var _d = React.useState(null), anchorEl = _d[0], setAnchorEl = _d[1];
59
+ var _d = React.useState([]), incomeList = _d[0], setIncomeList = _d[1];
60
+ var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
61
61
  var t = useTranslation().t;
62
62
  var isAr = useLanguage().isAr;
63
63
  var data = useAppSelector(individualSelector).data;
@@ -66,6 +66,8 @@ var MonthlyIncome = function (_a) {
66
66
  var monthlyIncomeList = (data.individualData.responseBody || {}).monthlyIncomeList;
67
67
  var monthlyIncomeControl = useController({ control: control, name: 'monthlyIncome' });
68
68
  var countryCode = settingsData.businessCountry;
69
+ var user = (data.verify.responseBody || {}).user;
70
+ var disabled = ((_b = user === null || user === void 0 ? void 0 : user.data_status) === null || _b === void 0 ? void 0 : _b.monthly_income) === FieldType.NON_EDITABLE;
69
71
  React.useEffect(function () {
70
72
  if ((monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.length) > 0) {
71
73
  setIncomeList(monthlyIncomeList);
@@ -88,20 +90,12 @@ var MonthlyIncome = function (_a) {
88
90
  onCloseList();
89
91
  monthlyIncomeControl.field.onChange(source);
90
92
  };
91
- var handleSearch = function (value) {
92
- var filteredList = monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.filter(function (income) {
93
- var _a, _b, _c, _d;
94
- return ((_b = (_a = income === null || income === void 0 ? void 0 : income.range) === null || _a === void 0 ? void 0 : _a.en) === null || _b === void 0 ? void 0 : _b.replace(',', '').toLowerCase().includes(value.toLowerCase())) ||
95
- ((_d = (_c = income === null || income === void 0 ? void 0 : income.range) === null || _c === void 0 ? void 0 : _c.ar) === null || _d === void 0 ? void 0 : _d.replace(',', '').toLowerCase().includes(value.toLowerCase()));
96
- });
97
- setIncomeList(filteredList);
98
- };
99
93
  var income = monthlyIncomeControl.field.value;
100
- var error = (_b = monthlyIncomeControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
94
+ var error = (_c = monthlyIncomeControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
101
95
  return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 0 } }, { children: [_jsx(Input, { label: t('please_enter_actual_income', {
102
96
  currency: t(findCurrencyByIso2(countryCode.iso2))
103
- }), 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.range.ar : income === null || income === void 0 ? void 0 : income.range.en) || '', warningMessage: error && t(error) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'range.en', list: incomeList, onSelectItem: onSelectItem, renderItem: function (item) {
104
- 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.range.ar : item === null || item === void 0 ? void 0 : item.range.en })) }), item.id === (income === null || income === void 0 ? void 0 : income.id) && _jsx(CheckIconStyled, {})] }));
105
- } })] }))] })) })));
97
+ }), disabled: disabled, readOnly: true, onClick: disabled ? undefined : !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: disabled ? _jsx(_Fragment, {}) : _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_source_of_income'), value: (isAr ? income === null || income === void 0 ? void 0 : income.range.ar : income === null || income === void 0 ? void 0 : income.range.en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'range.en', searchValuePath: ['range.en', 'range.ar'], list: incomeList, onSelectItem: onSelectItem, renderItem: function (item) {
98
+ 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.range.ar : item === null || item === void 0 ? void 0 : item.range.en })) }), item.id === (income === null || income === void 0 ? void 0 : income.id) && _jsx(CheckIconStyled, {})] }));
99
+ } }) }))] })) })));
106
100
  };
107
101
  export default React.memo(MonthlyIncome);
@@ -20,13 +20,14 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  }
21
21
  return t;
22
22
  };
23
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
23
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
24
  import * as React from 'react';
25
25
  import Box from '@mui/material/Box';
26
26
  import { styled } from '@mui/material/styles';
27
27
  import { useTranslation } from 'react-i18next';
28
28
  import { useController, useFormContext } from 'react-hook-form';
29
29
  import { useAppSelector, useLanguage } from '../../../../hooks';
30
+ import { FieldType } from '../../../../@types';
30
31
  import { individualSelector } from '../../../app/individual/individualStore';
31
32
  import Text from '../../../../components/Text';
32
33
  import Collapse from '../../../../components/Collapse';
@@ -35,7 +36,6 @@ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
35
36
  import Input from '../../../shared/Input';
36
37
  import ExpandIcon from '../../../../components/ExpandIcon';
37
38
  import SimpleList from '../../../../components/SimpleList';
38
- import Search from '../../../../features/shared/Search';
39
39
  var Container = styled(Box)(function () { return ({
40
40
  display: 'flex'
41
41
  }); });
@@ -52,16 +52,18 @@ var CheckIconStyled = styled(CheckIcon)(function (_a) {
52
52
  });
53
53
  });
54
54
  var Occupation = function (_a) {
55
- var _b, _c;
55
+ var _b, _c, _d;
56
56
  var rest = __rest(_a, []);
57
- var _d = React.useState([]), occupationList = _d[0], setOccupationList = _d[1];
58
- var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
57
+ var _e = React.useState([]), occupationList = _e[0], setOccupationList = _e[1];
58
+ var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
59
59
  var t = useTranslation().t;
60
60
  var isAr = useLanguage().isAr;
61
61
  var data = useAppSelector(individualSelector).data;
62
62
  var control = useFormContext().control;
63
63
  var occupationsList = ((_b = data.individualData.responseBody) === null || _b === void 0 ? void 0 : _b.occupationList) || [];
64
64
  var occupationControl = useController({ control: control, name: 'occupation' });
65
+ var user = (data.verify.responseBody || {}).user;
66
+ var disabled = ((_c = user === null || user === void 0 ? void 0 : user.data_status) === null || _c === void 0 ? void 0 : _c.occupation) === FieldType.NON_EDITABLE;
65
67
  React.useEffect(function () {
66
68
  if ((occupationsList === null || occupationsList === void 0 ? void 0 : occupationsList.length) > 0) {
67
69
  setOccupationList(occupationsList);
@@ -81,17 +83,11 @@ var Occupation = function (_a) {
81
83
  onCloseList();
82
84
  occupationControl.field.onChange(occupation);
83
85
  };
84
- var handleSearch = function (value) {
85
- var filteredList = occupationsList === null || occupationsList === void 0 ? void 0 : occupationsList.filter(function (occupation) {
86
- return occupation.name.en.toLowerCase().includes(value.toLowerCase()) || occupation.name.ar.toLowerCase().includes(value.toLowerCase());
87
- });
88
- setOccupationList(filteredList);
89
- };
90
86
  var occupation = occupationControl.field.value;
91
- var error = (_c = occupationControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
92
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 2.5 } }, { children: [_jsx(Input, { required: true, label: t('occupation_title'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_occupation'), value: (isAr ? occupation === null || occupation === void 0 ? void 0 : occupation.name.ar : occupation === null || occupation === void 0 ? void 0 : occupation.name.en) || '', warningMessage: error && t(error) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.en', list: occupationList, onSelectItem: onSelectItem, renderItem: function (item) {
93
- var _a, _b;
94
- return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (occupation === null || occupation === void 0 ? void 0 : occupation.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 === (occupation === null || occupation === void 0 ? void 0 : occupation.id) && _jsx(CheckIconStyled, {})] }));
95
- } })] }))] })) })));
87
+ var error = (_d = occupationControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message;
88
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 2.5 } }, { children: [_jsx(Input, { required: true, disabled: disabled, label: t('occupation_title'), readOnly: true, onClick: disabled ? undefined : !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: disabled ? _jsx(_Fragment, {}) : _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_any_occupation'), value: (isAr ? occupation === null || occupation === void 0 ? void 0 : occupation.name.ar : occupation === null || occupation === void 0 ? void 0 : occupation.name.en) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.en', searchValuePath: ['name.en', 'name.ar'], list: occupationList, onSelectItem: onSelectItem, renderItem: function (item) {
89
+ var _a, _b;
90
+ return (_jsxs(_Fragment, { children: [_jsx(Container, { children: _jsx(IncomeText, __assign({ isSelected: item.id === (occupation === null || occupation === void 0 ? void 0 : occupation.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 === (occupation === null || occupation === void 0 ? void 0 : occupation.id) && _jsx(CheckIconStyled, {})] }));
91
+ } }) }))] })) })));
96
92
  };
97
93
  export default Occupation;
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  export declare const InfoIconStyled: import("@emotion/styled").StyledComponent<{
3
3
  children?: React.ReactNode;
4
4
  classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
5
- color?: "inherit" | "disabled" | "error" | "success" | "info" | "primary" | "secondary" | "action" | "warning" | undefined;
5
+ color?: "inherit" | "disabled" | "error" | "info" | "success" | "primary" | "secondary" | "action" | "warning" | undefined;
6
6
  fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
7
7
  htmlColor?: string | undefined;
8
8
  inheritViewBox?: boolean | undefined;
@@ -16,7 +16,7 @@ export declare const InfoIconStyled: import("@emotion/styled").StyledComponent<{
16
16
  export declare const InfoOutlinedIconStyled: import("@emotion/styled").StyledComponent<{
17
17
  children?: React.ReactNode;
18
18
  classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
19
- color?: "inherit" | "disabled" | "error" | "success" | "info" | "primary" | "secondary" | "action" | "warning" | undefined;
19
+ color?: "inherit" | "disabled" | "error" | "info" | "success" | "primary" | "secondary" | "action" | "warning" | undefined;
20
20
  fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
21
21
  htmlColor?: string | undefined;
22
22
  inheritViewBox?: boolean | undefined;
@@ -18,12 +18,15 @@ import { ScreenContainer } from '../../../shared/Containers';
18
18
  import Collapse from '../../../../components/Collapse';
19
19
  import Mandatory from '../../../shared/Mandatory';
20
20
  import Text from '../../../../components/Text';
21
+ import { useAppSelector } from '../../../../hooks';
22
+ import { FieldType } from '../../../../@types';
21
23
  import RadioGroup from '../../../../components/RadioGroup';
22
24
  import RadioLabel from '../../../../components/RadioLabel';
23
25
  import Tooltip from '../../../../components/Tooltip';
24
26
  import InfoIcon from '@mui/icons-material/Info';
25
27
  import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
26
28
  import Box from '@mui/material/Box';
29
+ import { individualSelector } from '../../../app/individual/individualStore';
27
30
  var LabelTextStyled = styled(Text)(function (_a) {
28
31
  var theme = _a.theme;
29
32
  return (__assign(__assign({}, theme.typography.caption), { color: alpha(theme.palette.text.primary, 0.6), marginBlockEnd: theme.spacing(0.625) }));
@@ -53,16 +56,20 @@ export var InfoOutlinedIconStyled = styled(InfoOutlinedIcon)(function (_a) {
53
56
  });
54
57
  });
55
58
  var PEPSwitch = function (_a) {
59
+ var _b;
56
60
  var show = _a.show;
57
- var _b = React.useState(false), isHovered = _b[0], setIsHovered = _b[1];
61
+ var _c = React.useState(false), isHovered = _c[0], setIsHovered = _c[1];
58
62
  var control = useFormContext().control;
59
63
  var t = useTranslation().t;
60
64
  var pepControl = useController({ name: 'isPEP', control: control });
65
+ var data = useAppSelector(individualSelector).data;
66
+ var user = (data.verify.responseBody || {}).user;
67
+ var disabled = ((_b = user === null || user === void 0 ? void 0 : user.data_status) === null || _b === void 0 ? void 0 : _b.is_influencer) === FieldType.NON_EDITABLE;
61
68
  var handleOnChange = function (_a) {
62
69
  var target = _a.target;
63
70
  pepControl.field.onChange(target.value === 'yes');
64
71
  };
65
72
  var pepValue = pepControl.field.value;
66
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pt: 2.5, pl: 2.5, pr: 2.5 } }, { children: [_jsxs(Box, __assign({ style: { display: 'flex', justifyContent: 'space-between' } }, { children: [_jsxs(LabelTextStyled, { children: [t('tap_js_is_close_relative_in_pep'), _jsx(Mandatory, {})] }), _jsx(Tooltip, __assign({ title: t('pep_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] })), _jsxs(RadioGroupStyled, __assign({ value: pepValue != null ? (pepValue ? 'yes' : 'no') : false, onChange: handleOnChange }, { children: [_jsx(RadioLabel, { value: 'yes', label: t('yes') }), _jsx(RadioLabel, { value: 'no', label: t('no') })] }))] })) })));
73
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pt: 2.5, pl: 2.5, pr: 2.5 } }, { children: [_jsxs(Box, __assign({ style: { display: 'flex', justifyContent: 'space-between' } }, { children: [_jsxs(LabelTextStyled, { children: [t('tap_js_is_close_relative_in_pep'), _jsx(Mandatory, {})] }), _jsx(Tooltip, __assign({ title: t('pep_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] })), _jsxs(RadioGroupStyled, __assign({ value: pepValue != null ? (pepValue ? 'yes' : 'no') : false, onChange: disabled ? undefined : handleOnChange }, { children: [_jsx(RadioLabel, { value: 'yes', label: t('yes') }), _jsx(RadioLabel, { value: 'no', label: t('no') })] }))] })) })));
67
74
  };
68
75
  export default React.memo(PEPSwitch);
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ interface ShareCountProps {
3
+ show: boolean;
4
+ }
5
+ declare const _default: React.MemoExoticComponent<({ show }: ShareCountProps) => JSX.Element>;
6
+ export default _default;
@@ -0,0 +1,35 @@
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 } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import { useTranslation } from 'react-i18next';
15
+ import { useController, useFormContext } from 'react-hook-form';
16
+ import Collapse from '@mui/material/Collapse';
17
+ import { removeAllCharsFromNumber } from '../../../../utils';
18
+ import { ScreenContainer } from '../../../shared/Containers';
19
+ import Input from '../../../shared/Input';
20
+ var ShareCount = function (_a) {
21
+ var _b;
22
+ var show = _a.show;
23
+ var t = useTranslation().t;
24
+ var control = useFormContext().control;
25
+ var handleChange = function (_a) {
26
+ var target = _a.target;
27
+ var value = removeAllCharsFromNumber(target.value);
28
+ shareCountControl.field.onChange(value);
29
+ };
30
+ var shareCountControl = useController({ control: control, name: 'shareCount' });
31
+ var shareCountValue = shareCountControl.field.value;
32
+ var error = (_b = shareCountControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
33
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { label: t('share_count_label'), onChange: handleChange, value: shareCountValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('share_count_hint'), warningType: 'alert', warningMessage: error && t(error) }) })) })));
34
+ };
35
+ export default React.memo(ShareCount);
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ interface ShareValueProps {
3
+ show: boolean;
4
+ }
5
+ declare const _default: React.MemoExoticComponent<({ show }: ShareValueProps) => JSX.Element>;
6
+ export default _default;
@@ -0,0 +1,41 @@
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 } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import { useTranslation } from 'react-i18next';
15
+ import { useController, useFormContext } from 'react-hook-form';
16
+ import Collapse from '@mui/material/Collapse';
17
+ import { findCurrencyByIso2, removeAllCharsFromNumber } from '../../../../utils';
18
+ import { settingsSelector } from '../../../../app/settings';
19
+ import { useAppSelector } from '../../../../hooks';
20
+ import { ScreenContainer } from '../../../shared/Containers';
21
+ import Input from '../../../shared/Input';
22
+ var ShareValue = function (_a) {
23
+ var _b;
24
+ var show = _a.show;
25
+ var t = useTranslation().t;
26
+ var settingsData = useAppSelector(settingsSelector).data;
27
+ var control = useFormContext().control;
28
+ var countryCode = settingsData.businessCountry.iso2;
29
+ var handleChange = function (_a) {
30
+ var target = _a.target;
31
+ var value = removeAllCharsFromNumber(target.value);
32
+ shareValueControl.field.onChange(value);
33
+ };
34
+ var shareValueControl = useController({ control: control, name: 'shareValue' });
35
+ var shareValueValue = shareValueControl.field.value;
36
+ var error = (_b = shareValueControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
37
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { label: t('share_value_label', {
38
+ currency: t(findCurrencyByIso2(countryCode))
39
+ }), onChange: handleChange, value: shareValueValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('share_value_hint'), warningType: 'alert', warningMessage: error && t(error) }) })) })));
40
+ };
41
+ export default React.memo(ShareValue);
@@ -10,10 +10,13 @@ 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 { styled } from '@mui/material/styles';
16
17
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
18
+ import { DocumentPurpose } from '../../../../@types';
19
+ import { getRecentDocumentFiles } from '../../../../utils';
17
20
  import UploadMultipleFile from '../../../shared/UploadMultipleFile';
18
21
  import { ScreenContainer } from '../../../shared/Containers';
19
22
  import { individualSelector, signatureFileUploadingStatus } from '../../../app/individual/individualStore';
@@ -25,11 +28,13 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
25
28
  });
26
29
  });
27
30
  var SignatureFile = function (_a) {
31
+ var _b;
28
32
  var show = _a.show;
29
33
  var t = useTranslation().t;
30
34
  var control = useFormContext().control;
31
35
  var signatureFileIdControl = useController({ name: 'signatureFileId', control: control });
32
- var loading = useAppSelector(individualSelector).loading;
36
+ var _c = useAppSelector(individualSelector), loading = _c.loading, data = _c.data;
37
+ var documents = (((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.user) || {}).documents;
33
38
  var dispatch = useAppDispatch();
34
39
  var handleSignatureChange = function (ids) {
35
40
  signatureFileIdControl.field.onChange(ids);
@@ -37,6 +42,7 @@ var SignatureFile = function (_a) {
37
42
  var handleReset = function (ids) {
38
43
  signatureFileIdControl.field.onChange(ids);
39
44
  };
40
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { label: t('title_signature_file'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_signature'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_signature_file'), onFileUploaded: handleSignatureChange, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, purpose: 'customer_signature', fileTitle: 'Merchant Signature', fileUploadingStatus: function (uploading) { return dispatch(signatureFileUploadingStatus(uploading)); } }) }) })));
45
+ var defaultFiles = React.useMemo(function () { return getRecentDocumentFiles(documents, DocumentPurpose.CUSTOMER_SIGNATURE); }, [documents]);
46
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { id: 'signatureFileId', control: control, label: t('title_signature_file'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_signature'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_signature_file'), onFileUploaded: handleSignatureChange, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, defaultFiles: defaultFiles, purpose: DocumentPurpose.CUSTOMER_SIGNATURE, fileUploadingStatus: function (uploading) { return dispatch(signatureFileUploadingStatus(uploading)); } }) }) })));
41
47
  };
42
48
  export default SignatureFile;
@@ -20,13 +20,14 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  }
21
21
  return t;
22
22
  };
23
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
23
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
24
  import * as React from 'react';
25
25
  import Box from '@mui/material/Box';
26
26
  import { styled } from '@mui/material/styles';
27
27
  import { useTranslation } from 'react-i18next';
28
28
  import { useController, useFormContext } from 'react-hook-form';
29
29
  import { useAppSelector, useLanguage } from '../../../../hooks';
30
+ import { FieldType } from '../../../../@types';
30
31
  import { individualSelector } from '../../../app/individual/individualStore';
31
32
  import Text from '../../../../components/Text';
32
33
  import Collapse from '../../../../components/Collapse';
@@ -51,16 +52,18 @@ var CheckIconStyled = styled(CheckIcon)(function (_a) {
51
52
  });
52
53
  });
53
54
  var SourceOfIncome = function (_a) {
54
- var _b, _c;
55
+ var _b, _c, _d;
55
56
  var rest = __rest(_a, []);
56
- var _d = React.useState([]), sourceList = _d[0], setSourceList = _d[1];
57
- var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
57
+ var _e = React.useState([]), sourceList = _e[0], setSourceList = _e[1];
58
+ var _f = React.useState(null), anchorEl = _f[0], setAnchorEl = _f[1];
58
59
  var t = useTranslation().t;
59
60
  var isAr = useLanguage().isAr;
60
61
  var data = useAppSelector(individualSelector).data;
61
62
  var control = useFormContext().control;
62
63
  var sourceIncomeList = ((_b = data.individualData.responseBody) === null || _b === void 0 ? void 0 : _b.sourceIncomeList) || [];
63
64
  var sourceIncomeControl = useController({ control: control, name: 'sourceIncome' });
65
+ var user = (data.verify.responseBody || {}).user;
66
+ var disabled = ((_c = user === null || user === void 0 ? void 0 : user.data_status) === null || _c === void 0 ? void 0 : _c.source_of_income) === FieldType.NON_EDITABLE;
64
67
  React.useEffect(function () {
65
68
  if ((sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.length) > 0) {
66
69
  setSourceList(sourceIncomeList);
@@ -81,8 +84,8 @@ var SourceOfIncome = function (_a) {
81
84
  sourceIncomeControl.field.onChange(source);
82
85
  };
83
86
  var source = sourceIncomeControl.field.value;
84
- var error = (_c = sourceIncomeControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
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) {
87
+ var error = (_d = sourceIncomeControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message;
88
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 2.5 } }, { children: [_jsx(Input, { required: true, disabled: disabled, label: t('tap_js_source_of_income'), readOnly: true, onClick: disabled ? undefined : !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: disabled ? _jsx(_Fragment, {}) : _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) {
86
89
  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, {})] }));
87
90
  } }) }))] })) })));
88
91
  };