@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
@@ -0,0 +1,186 @@
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
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
+ if (ar || !(i in from)) {
15
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
+ ar[i] = from[i];
17
+ }
18
+ }
19
+ return to.concat(ar || Array.prototype.slice.call(from));
20
+ };
21
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
22
+ import * as React from 'react';
23
+ import { useForm, FormProvider } from 'react-hook-form';
24
+ import { useTranslation } from 'react-i18next';
25
+ import { yupResolver } from '@hookform/resolvers/yup';
26
+ import { alpha, styled, useTheme } from '@mui/material/styles';
27
+ import Box from '@mui/material/Box';
28
+ import { getUserName, isValidEmail } from '../../../../utils';
29
+ import { useLanguage, useAppSelector, useAppDispatch, useSetFromDefaultValues } from '../../../../hooks';
30
+ import { IndividualType } from '../../../../@types';
31
+ import Collapse from '../../../../components/Collapse';
32
+ import ExpandIcon from '../../../../components/ExpandIcon';
33
+ import Form from '../../../../components/Form';
34
+ import Text from '../../../../components/Text';
35
+ import CheckIcon from '../../../shared/CheckIcon';
36
+ import { ScreenContainer } from '../../../shared/Containers';
37
+ import { addDetailsAsync, individualSelector, requestDetailsByEmail, resetIndividualData } from '../../../app/individual/individualStore';
38
+ import ListButton from '../../../shared/Button/ListButton';
39
+ import { IndividualCollectInfoValidationSchema } from './validation';
40
+ import CollectPhoneEmail from './CollectPhoneEmail';
41
+ var ScreenContainerStyled = styled(ScreenContainer)(function (_a) {
42
+ var theme = _a.theme;
43
+ return ({
44
+ background: theme.palette.background.default,
45
+ borderTop: "1px solid ".concat(alpha(theme.palette.divider, 0.8)),
46
+ borderBottom: "1px solid ".concat(alpha(theme.palette.divider, 0.8))
47
+ });
48
+ });
49
+ var TextBoxStyled = styled(Box)(function (_a) {
50
+ var theme = _a.theme;
51
+ return ({
52
+ display: 'flex',
53
+ justifyContent: 'space-between',
54
+ flexDirection: 'row',
55
+ padding: theme.spacing(1.8, 2.5, 1.8, 2.5)
56
+ });
57
+ });
58
+ var TextStyled = styled(Box)(function (_a) {
59
+ var theme = _a.theme;
60
+ return (__assign(__assign({}, theme.typography.subtitle2), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightRegular, background: theme.palette.background.default }));
61
+ });
62
+ var RoleTextStyled = styled(Text)(function (_a) {
63
+ var theme = _a.theme;
64
+ return (__assign(__assign({}, theme.typography.subtitle2), { display: 'inline', paddingInlineStart: theme.spacing(1.5), color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightRegular, background: theme.palette.background.default }));
65
+ });
66
+ var CollapseStyled = styled(Collapse)(function () { return ({
67
+ width: '100%'
68
+ }); });
69
+ var IndividualRequestType;
70
+ (function (IndividualRequestType) {
71
+ IndividualRequestType[IndividualRequestType["ADD"] = 0] = "ADD";
72
+ IndividualRequestType[IndividualRequestType["REQUEST_EMAIL"] = 1] = "REQUEST_EMAIL";
73
+ IndividualRequestType[IndividualRequestType["COLLECT_EMAIL_MOBILE"] = 2] = "COLLECT_EMAIL_MOBILE";
74
+ })(IndividualRequestType || (IndividualRequestType = {}));
75
+ var UserList = function (_a) {
76
+ var _b = React.useState([]), usersMenuList = _b[0], setUsersMenuList = _b[1];
77
+ var _c = React.useState(null), anchorEl = _c[0], setAnchorEl = _c[1];
78
+ var _d = React.useState(false), showCollectForm = _d[0], setShowCollectForm = _d[1];
79
+ var _e = React.useState(), activeUser = _e[0], setActiveUser = _e[1];
80
+ var _f = React.useState(IndividualRequestType.ADD), type = _f[0], setType = _f[1];
81
+ var t = useTranslation().t;
82
+ var isAr = useLanguage().isAr;
83
+ var dispatch = useAppDispatch();
84
+ var theme = useTheme();
85
+ var _g = useAppSelector(individualSelector), data = _g.data, loading = _g.loading;
86
+ var _h = data.individualCollectData, email = _h.email, mobile = _h.mobile;
87
+ var verify = data.verify;
88
+ var userList = (verify.responseBody || {}).userList;
89
+ var methods = useForm({
90
+ resolver: yupResolver(IndividualCollectInfoValidationSchema(activeUser)),
91
+ defaultValues: {
92
+ email: email,
93
+ mobile: mobile
94
+ },
95
+ mode: 'onChange'
96
+ });
97
+ useSetFromDefaultValues(methods, data.individualCollectData);
98
+ React.useEffect(function () {
99
+ if ((userList === null || userList === void 0 ? void 0 : userList.length) > 0) {
100
+ var list = __spreadArray([], userList, true);
101
+ setUsersMenuList(list);
102
+ var user = list.find(function (user) { return user.id === (activeUser === null || activeUser === void 0 ? void 0 : activeUser.id); }) || list[0];
103
+ setActiveUser(user);
104
+ if (!isPhoneAndEmailAvailable(user))
105
+ resetFormData();
106
+ }
107
+ }, [userList]);
108
+ var onOpenUserAction = function (event) {
109
+ setAnchorEl(event.currentTarget);
110
+ };
111
+ var onCloseUserAction = function () {
112
+ setAnchorEl(null);
113
+ };
114
+ var resetFormData = function () {
115
+ if (showCollectForm) {
116
+ methods.setValue('email', '', { shouldValidate: true });
117
+ methods.setValue('mobile', '', { shouldValidate: true });
118
+ setShowCollectForm(false);
119
+ }
120
+ };
121
+ var onClickUser = function (user, e) {
122
+ resetFormData();
123
+ setAnchorEl(null);
124
+ setActiveUser(user);
125
+ onOpenUserAction(e);
126
+ };
127
+ var onAddDetails = function () {
128
+ setType(IndividualRequestType.ADD);
129
+ if (activeUser) {
130
+ dispatch(resetIndividualData());
131
+ dispatch(addDetailsAsync({ user: activeUser, userList: usersMenuList }));
132
+ }
133
+ };
134
+ var onRequestEmail = function () {
135
+ if (!isPhoneAndEmailAvailable(activeUser) && !methods.formState.isValid) {
136
+ setShowCollectForm(true);
137
+ return;
138
+ }
139
+ setType(IndividualRequestType.REQUEST_EMAIL);
140
+ if (activeUser) {
141
+ var values = methods.getValues();
142
+ dispatch(requestDetailsByEmail({ user: activeUser, collectInfo: __assign({}, values) }));
143
+ }
144
+ };
145
+ var getName = function (user) {
146
+ var name = getUserName(user, isAr);
147
+ return name;
148
+ };
149
+ var isActiveUser = function (user) {
150
+ return (activeUser === null || activeUser === void 0 ? void 0 : activeUser.id) === user.id;
151
+ };
152
+ var isPhoneAndEmailAvailable = function (user) {
153
+ var _a = (user === null || user === void 0 ? void 0 : user.contact) || { email: '' }, resEmail = _a.email, phone = _a.phone;
154
+ return isValidEmail(resEmail) && (phone === null || phone === void 0 ? void 0 : phone.country_code) && (phone === null || phone === void 0 ? void 0 : phone.number);
155
+ };
156
+ var getUserRole = function (user) {
157
+ var _a, _b, _c, _d, _e;
158
+ if ((((_a = user === null || user === void 0 ? void 0 : user.role) === null || _a === void 0 ? void 0 : _a.length) || 0) > 0)
159
+ 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;
160
+ if ((user === null || user === void 0 ? void 0 : user.type) === IndividualType.SHARE_HOLDER)
161
+ return t('type_share_holder');
162
+ if ((user === null || user === void 0 ? void 0 : user.type) === IndividualType.BOARD_MEMBER)
163
+ return t('type_board_member');
164
+ return t('type_user');
165
+ };
166
+ var getCollectForm = function (user) {
167
+ var show = showCollectForm && isActiveUser(user);
168
+ return (_jsx(CollapseStyled, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mb: 1.5, mt: 0 } }, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsx(Form, { children: _jsx(CollectPhoneEmail, { activeUser: activeUser }) }) })) })) })));
169
+ };
170
+ var disabled = showCollectForm && !isPhoneAndEmailAvailable(activeUser) && !methods.formState.isValid;
171
+ return (_jsx(ScreenContainerStyled, { children: usersMenuList.map(function (user, index) {
172
+ return (_jsxs(Box, __assign({ sx: index !== usersMenuList.length - 1 ? { borderBottom: "1px solid ".concat(alpha(theme.palette.divider, 0.8)) } : {} }, { children: [_jsxs(TextBoxStyled, __assign({ onClick: !!anchorEl && isActiveUser(user) ? function () { return onCloseUserAction(); } : function (e) { return onClickUser(user, e); } }, { children: [_jsxs(TextStyled, { children: [getName(user) || '', _jsx(RoleTextStyled, { children: getUserRole(user) || '' })] }), (user === null || user === void 0 ? void 0 : user.isRequestedEmail) ? _jsx(CheckIcon, {}) : _jsx(ExpandIcon, { anchorEl: !!anchorEl && isActiveUser(user) })] })), _jsx(Collapse, __assign({ in: !!anchorEl && isActiveUser(user), timeout: 300 }, { children: _jsx(ListButton, { isAr: isAr, addDetails: {
173
+ title: t('add_details'),
174
+ onClick: onAddDetails,
175
+ loading: isActiveUser(user) && loading && type === IndividualRequestType.ADD
176
+ }, requestEmail: {
177
+ children: getCollectForm(user),
178
+ title: t('request_details_by_email'),
179
+ isRequested: (user === null || user === void 0 ? void 0 : user.isRequestedEmail) || false,
180
+ disabled: disabled,
181
+ onClick: onRequestEmail,
182
+ loading: isActiveUser(user) && loading && type === IndividualRequestType.REQUEST_EMAIL
183
+ } }) }))] }), index));
184
+ }) }));
185
+ };
186
+ export default UserList;
@@ -0,0 +1,3 @@
1
+ import IndividualList, { IndividualListProps } from './IndividualList';
2
+ export type { IndividualListProps };
3
+ export default IndividualList;
@@ -0,0 +1,2 @@
1
+ import IndividualList from './IndividualList';
2
+ export default IndividualList;
@@ -0,0 +1,12 @@
1
+ import * as yup from 'yup';
2
+ import { User } from '../../../../@types';
3
+ export declare const IndividualCollectInfoValidationSchema: (activeUser?: User) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
4
+ mobile: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
5
+ email: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
6
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
7
+ mobile: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
8
+ email: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
9
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
10
+ mobile: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
11
+ email: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
12
+ }>>>;
@@ -0,0 +1,39 @@
1
+ import * as yup from 'yup';
2
+ export var IndividualCollectInfoValidationSchema = function (activeUser) {
3
+ var _a = (activeUser === null || activeUser === void 0 ? void 0 : activeUser.contact) || {}, phone = _a.phone, email = _a.email;
4
+ var isPhoneAvailable = (phone === null || phone === void 0 ? void 0 : phone.number) && (phone === null || phone === void 0 ? void 0 : phone.country_code);
5
+ var isEmailAvailable = !!email;
6
+ return yup.object().shape({
7
+ mobile: isPhoneAvailable
8
+ ? yup.string().optional()
9
+ : yup
10
+ .string()
11
+ .test({
12
+ test: function (value) {
13
+ if (((value === null || value === void 0 ? void 0 : value.length) || 0) > 0) {
14
+ var countryCode = this.parent.countryCode;
15
+ var isSA = countryCode.iso2 === 'SA';
16
+ var digits = countryCode.digits;
17
+ var mobileValue = value || '';
18
+ var valueLen = mobileValue.length;
19
+ var isNumber = mobileValue.match(/^[0-9]/g);
20
+ if (!isNumber)
21
+ return this.createError({ message: 'enter_valid_mobile_number' });
22
+ var isStartWithZero = mobileValue.startsWith('05');
23
+ var isStartWith5 = mobileValue.startsWith('5');
24
+ var isSaudiNumber = isStartWith5 || isStartWithZero;
25
+ if (isSA) {
26
+ if (!isSaudiNumber)
27
+ return this.createError({ message: 'start_with_number' });
28
+ var requiredLen = isStartWith5 ? digits - 1 : digits;
29
+ return valueLen === requiredLen ? true : this.createError({ message: 'enter_valid_mobile_number' });
30
+ }
31
+ return valueLen === digits ? true : this.createError({ message: 'enter_valid_mobile_number' });
32
+ }
33
+ return true;
34
+ }
35
+ })
36
+ .required(),
37
+ email: isEmailAvailable ? yup.string().optional() : yup.string().email('email_not_valid').required()
38
+ });
39
+ };
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ interface BirthCityProps {
3
+ show: boolean;
4
+ onListOpen?: () => void;
5
+ onListClose?: () => void;
6
+ }
7
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<BirthCityProps & React.RefAttributes<unknown>>>;
8
+ export default _default;
@@ -0,0 +1,109 @@
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
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
+ if (ar || !(i in from)) {
15
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
+ ar[i] = from[i];
17
+ }
18
+ }
19
+ return to.concat(ar || Array.prototype.slice.call(from));
20
+ };
21
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
22
+ import * as React from 'react';
23
+ import Box from '@mui/material/Box';
24
+ import { useTranslation } from 'react-i18next';
25
+ import { useController, useFormContext } from 'react-hook-form';
26
+ import { styled } from '@mui/material/styles';
27
+ import CheckIcon from '@mui/icons-material/Check';
28
+ import CircularProgress from '@mui/material/CircularProgress';
29
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
30
+ import Collapse from '../../../../components/Collapse';
31
+ import ExpandIcon from '../../../../components/ExpandIcon';
32
+ import Text from '../../../../components/Text';
33
+ import SimpleList from '../../../../components/SimpleList';
34
+ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
35
+ import Input from '../../../shared/Input';
36
+ import { getCityList, individualSelector } from '../../../app/individual/individualStore';
37
+ var CountryItemContainer = styled(Box)(function () { return ({
38
+ display: 'flex'
39
+ }); });
40
+ var CountryNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
41
+ var theme = _a.theme, isSelected = _a.isSelected;
42
+ return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25) }));
43
+ });
44
+ var CheckIconStyled = styled(CheckIcon)(function (_a) {
45
+ var theme = _a.theme;
46
+ return ({
47
+ color: theme.palette.success.main,
48
+ display: 'flex',
49
+ alignItems: 'flex-end'
50
+ });
51
+ });
52
+ var BirthCity = React.forwardRef(function (_a, ref) {
53
+ var _b;
54
+ var show = _a.show, onListOpen = _a.onListOpen, onListClose = _a.onListClose;
55
+ var _c = React.useState([]), locationCities = _c[0], setCities = _c[1];
56
+ var _d = React.useState(null), anchorEl = _d[0], setAnchorEl = _d[1];
57
+ var t = useTranslation().t;
58
+ var dispatch = useAppDispatch();
59
+ var _e = useFormContext(), control = _e.control, getValues = _e.getValues, setValue = _e.setValue;
60
+ var _f = useAppSelector(individualSelector), data = _f.data, cityLoading = _f.cityLoading;
61
+ var _g = data.verify.responseBody || {}, cityList = _g.cityList, user = _g.user;
62
+ var placeOfBirthCityControl = useController({ control: control, name: 'placeOfBirthCity' });
63
+ var birthCountry = getValues('placeOfBirthCountry');
64
+ var cityValue = placeOfBirthCityControl.field.value;
65
+ var error = (_b = placeOfBirthCityControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
66
+ React.useEffect(function () {
67
+ var _a;
68
+ if ((cityList === null || cityList === void 0 ? void 0 : cityList.length) > 0) {
69
+ var city_1 = (_a = cityValue === null || cityValue === void 0 ? void 0 : cityValue.name) === null || _a === void 0 ? void 0 : _a.en;
70
+ var selectedCity = cityList.find(function (c) {
71
+ return c.name.en.toLowerCase() === (city_1 === null || city_1 === void 0 ? void 0 : city_1.toLowerCase());
72
+ }) || {};
73
+ setValue('placeOfBirthCity', selectedCity, { shouldValidate: true });
74
+ var list = __spreadArray([], cityList, true);
75
+ setCities(list);
76
+ }
77
+ }, [cityList]);
78
+ React.useEffect(function () {
79
+ var _a, _b;
80
+ var listCountry = (cityList === null || cityList === void 0 ? void 0 : cityList.length) > 0 ? (_a = cityList[0]) === null || _a === void 0 ? void 0 : _a.country : (_b = user === null || user === void 0 ? void 0 : user.birth) === null || _b === void 0 ? void 0 : _b.country;
81
+ var iso2 = (birthCountry || {}).iso2;
82
+ if (!listCountry || !iso2)
83
+ return;
84
+ if ((listCountry === null || listCountry === void 0 ? void 0 : listCountry.toLowerCase()) !== (iso2 === null || iso2 === void 0 ? void 0 : iso2.toLowerCase())) {
85
+ dispatch(getCityList(iso2));
86
+ }
87
+ }, [birthCountry]);
88
+ var onOpenCitySelect = function (event) {
89
+ setAnchorEl(event.currentTarget);
90
+ onListOpen === null || onListOpen === void 0 ? void 0 : onListOpen();
91
+ };
92
+ var onCloseCitySelect = function () {
93
+ setAnchorEl(null);
94
+ onListClose === null || onListClose === void 0 ? void 0 : onListClose();
95
+ setCities(cityList);
96
+ };
97
+ var onSelectItem = function (city) {
98
+ onCloseCitySelect();
99
+ placeOfBirthCityControl.field.onChange(city);
100
+ };
101
+ var getName = function (city) {
102
+ var _a;
103
+ return (_a = city === null || city === void 0 ? void 0 : city.name) === null || _a === void 0 ? void 0 : _a.en;
104
+ };
105
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(Input, { label: t('place_birth_city_label'), readOnly: true, placeholder: t('choose_place_birth_city'), value: getName(cityValue) || '', warningMessage: error && t(error), onClick: cityLoading ? undefined : !!anchorEl ? function () { return onCloseCitySelect(); } : onOpenCitySelect, endAdornment: cityLoading ? _jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } }) : _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.en', searchValuePath: ['name.en'], list: locationCities, onSelectItem: onSelectItem, renderItem: function (item) {
106
+ return (_jsxs(_Fragment, { children: [_jsx(CountryItemContainer, { children: _jsx(CountryNameText, __assign({ isSelected: item.id === (cityValue === null || cityValue === void 0 ? void 0 : cityValue.id) }, { children: getName(item) })) }), item.id === (cityValue === null || cityValue === void 0 ? void 0 : cityValue.id) && _jsx(CheckIconStyled, {})] }));
107
+ } }) }))] })) })));
108
+ });
109
+ export default React.memo(BirthCity);
@@ -1,10 +1,10 @@
1
1
  import * as React from 'react';
2
2
  import { CountryCode } from '../../../../@types';
3
- interface EmployerLocationProps {
3
+ interface BirthCountryProps {
4
4
  countries: Array<CountryCode>;
5
5
  show: boolean;
6
6
  onListOpen?: () => void;
7
7
  onListClose?: () => void;
8
8
  }
9
- declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<EmployerLocationProps & React.RefAttributes<unknown>>>;
9
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<BirthCountryProps & React.RefAttributes<unknown>>>;
10
10
  export default _default;
@@ -23,18 +23,17 @@ var __rest = (this && this.__rest) || function (s, e) {
23
23
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
24
24
  import * as React from 'react';
25
25
  import Box from '@mui/material/Box';
26
- import { styled } from '@mui/material/styles';
27
26
  import { useTranslation } from 'react-i18next';
28
27
  import { useController, useFormContext } from 'react-hook-form';
29
- import Text from '../../../../components/Text';
28
+ import { styled } from '@mui/material/styles';
29
+ import CheckIcon from '@mui/icons-material/Check';
30
+ import { useLanguage } from '../../../../hooks';
30
31
  import Collapse from '../../../../components/Collapse';
31
32
  import ExpandIcon from '../../../../components/ExpandIcon';
32
- import CheckIcon from '@mui/icons-material/Check';
33
+ import Text from '../../../../components/Text';
34
+ import SimpleList from '../../../../components/SimpleList';
33
35
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
34
36
  import Input from '../../../shared/Input';
35
- import SimpleList from '../../../../components/SimpleList';
36
- import { useLanguage } from '../../../../hooks';
37
- import Search from '../../../shared/Search';
38
37
  var CountryItemContainer = styled(Box)(function () { return ({
39
38
  display: 'flex'
40
39
  }); });
@@ -50,7 +49,7 @@ var CheckIconStyled = styled(CheckIcon)(function (_a) {
50
49
  alignItems: 'flex-end'
51
50
  });
52
51
  });
53
- var EmployerLocation = React.forwardRef(function (_a, ref) {
52
+ var BirthCountry = React.forwardRef(function (_a, ref) {
54
53
  var _b, _c, _d;
55
54
  var countries = _a.countries, rest = __rest(_a, ["countries"]);
56
55
  var _e = React.useState(countries), locationCountries = _e[0], setCountries = _e[1];
@@ -58,7 +57,7 @@ var EmployerLocation = React.forwardRef(function (_a, ref) {
58
57
  var t = useTranslation().t;
59
58
  var isAr = useLanguage().isAr;
60
59
  var control = useFormContext().control;
61
- var employerLocationControl = useController({ control: control, name: 'employerLocation' });
60
+ var placeOfBirthCountryControl = useController({ control: control, name: 'placeOfBirthCountry' });
62
61
  var onOpenCountrySelect = function (event) {
63
62
  var _a;
64
63
  setAnchorEl(event.currentTarget);
@@ -72,21 +71,12 @@ var EmployerLocation = React.forwardRef(function (_a, ref) {
72
71
  };
73
72
  var onSelectItem = function (country) {
74
73
  onCloseCountrySelect();
75
- employerLocationControl.field.onChange(country);
76
- };
77
- var handleSearch = function (value) {
78
- var filteredCountries = countries.filter(function (country) {
79
- return country.idd_prefix.toString().toLowerCase().startsWith(value.replace('+', '').toLowerCase()) ||
80
- country.capital.toLowerCase().startsWith(value.toLowerCase()) ||
81
- country.name.arabic.toLowerCase().startsWith(value.toLowerCase()) ||
82
- country.name.english.toLowerCase().startsWith(value.toLowerCase());
83
- });
84
- setCountries(filteredCountries);
74
+ placeOfBirthCountryControl.field.onChange(country);
85
75
  };
86
- var location = employerLocationControl.field.value;
87
- var error = (_b = employerLocationControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
88
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(Input, { required: true, label: t('tap_js_employer_address_city'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseCountrySelect(); } : onOpenCountrySelect, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_employee_location'), value: (isAr ? (_c = location === null || location === void 0 ? void 0 : location.name) === null || _c === void 0 ? void 0 : _c.arabic : (_d = location === null || location === void 0 ? void 0 : location.name) === null || _d === void 0 ? void 0 : _d.english) || '', warningMessage: error && t(error) }), _jsxs(Collapse, __assign({ in: !!anchorEl }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleList, { searchKeyPath: 'name.english', list: locationCountries, onSelectItem: onSelectItem, renderItem: function (item) {
89
- return (_jsxs(_Fragment, { children: [_jsx(CountryItemContainer, { children: _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (location === null || location === void 0 ? void 0 : location.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english })) }), item.idd_prefix === (location === null || location === void 0 ? void 0 : location.idd_prefix) && _jsx(CheckIconStyled, {})] }));
90
- } })] }))] })) })));
76
+ var location = placeOfBirthCountryControl.field.value;
77
+ var error = (_b = placeOfBirthCountryControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
78
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(Input, { label: t('place_of_birth_country_label'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseCountrySelect(); } : onOpenCountrySelect, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_place_of_birth_country'), value: (isAr ? (_c = location === null || location === void 0 ? void 0 : location.name) === null || _c === void 0 ? void 0 : _c.arabic : (_d = location === null || location === void 0 ? void 0 : location.name) === null || _d === void 0 ? void 0 : _d.english) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', searchValuePath: ['name.arabic', 'name.english'], list: locationCountries, onSelectItem: onSelectItem, renderItem: function (item) {
79
+ return (_jsxs(_Fragment, { children: [_jsx(CountryItemContainer, { children: _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (location === null || location === void 0 ? void 0 : location.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english })) }), item.idd_prefix === (location === null || location === void 0 ? void 0 : location.idd_prefix) && _jsx(CheckIconStyled, {})] }));
80
+ } }) }))] })) })));
91
81
  });
92
- export default React.memo(EmployerLocation);
82
+ export default React.memo(BirthCountry);
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ interface BODProps {
3
+ show: boolean;
4
+ onDateClicked?: (flag: boolean) => void;
5
+ }
6
+ declare const _default: React.MemoExoticComponent<({ onDateClicked, show }: BODProps) => JSX.Element>;
7
+ export default _default;
@@ -0,0 +1,46 @@
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 { useTranslation } from 'react-i18next';
15
+ import { useController, useFormContext } from 'react-hook-form';
16
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
17
+ import { styled, alpha } from '@mui/material/styles';
18
+ import Text from '../../../../components/Text';
19
+ import Collapse from '../../../../components/Collapse';
20
+ import DatePicker from '../../../../components/DatePicker';
21
+ import { ScreenContainer } from '../../../shared/Containers';
22
+ import { individualSelector, clearError } from '../../../app/individual/individualStore';
23
+ var InputLabelStyled = styled(Text)(function (_a) {
24
+ var theme = _a.theme;
25
+ return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption), { cursor: 'pointer' }));
26
+ });
27
+ var BOD = function (_a) {
28
+ var _b;
29
+ var onDateClicked = _a.onDateClicked, show = _a.show;
30
+ var t = useTranslation().t;
31
+ var control = useFormContext().control;
32
+ var dispatch = useAppDispatch();
33
+ var dobControl = useController({ control: control, name: 'dob' });
34
+ var error = useAppSelector(individualSelector).error;
35
+ var handleBirthDateChange = function (data) {
36
+ if (error)
37
+ dispatch(clearError());
38
+ dobControl.field.onChange(data);
39
+ };
40
+ var dateValue = (_b = dobControl === null || dobControl === void 0 ? void 0 : dobControl.field) === null || _b === void 0 ? void 0 : _b.value;
41
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
42
+ var spacing = _a.spacing;
43
+ return spacing(2.5, 2.5, 2.5, 2.5);
44
+ } } }, { children: t('enter_birth_date') })), _jsx(DatePicker, { readOnly: true, defaultValue: dateValue ? new Date(dateValue) : new Date(), dir: 'ltr', locale: 'en', onClick: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); }, onDateChange: handleBirthDateChange })] }) })));
45
+ };
46
+ export default React.memo(BOD);
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ export interface EmailProps {
3
+ show: boolean;
4
+ }
5
+ declare const _default: React.MemoExoticComponent<({ show }: EmailProps) => JSX.Element>;
6
+ export default _default;
@@ -0,0 +1,50 @@
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 { styled } from '@mui/material/styles';
17
+ import { useAppSelector } from '../../../../hooks';
18
+ import { FieldType } from '../../../../@types';
19
+ import Collapse from '../../../../components/Collapse';
20
+ import { ScreenContainer } from '../../../shared/Containers';
21
+ import Input from '../../../shared/Input';
22
+ import ClearIcon from '../../../shared/ClearIcon';
23
+ import CheckIcon from '../../../shared/CheckIcon';
24
+ import { individualSelector } from '../../../app/individual/individualStore';
25
+ var InputStyled = styled(Input)(function () { return ({
26
+ input: {
27
+ textTransform: 'lowercase'
28
+ }
29
+ }); });
30
+ var Email = function (_a) {
31
+ var _b, _c, _d;
32
+ var show = _a.show;
33
+ var t = useTranslation().t;
34
+ var control = useFormContext().control;
35
+ var emailControl = useController({ name: 'email', control: control });
36
+ var data = useAppSelector(individualSelector).data;
37
+ var emailValue = emailControl.field.value;
38
+ var error = (_b = emailControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
39
+ var verify = data.verify;
40
+ var user = (verify.responseBody || {}).user;
41
+ var handleEmailChange = function (event) {
42
+ emailControl.field.onChange(event.target.value);
43
+ };
44
+ var clearNumber = function () {
45
+ emailControl.field.onChange('');
46
+ };
47
+ var disabled = ((_d = (_c = user === null || user === void 0 ? void 0 : user.data_status) === null || _c === void 0 ? void 0 : _c.contact) === null || _d === void 0 ? void 0 : _d.email) === FieldType.NON_EDITABLE;
48
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(InputStyled, { label: t('signup_email_lable'), value: emailValue, onChange: handleEmailChange, type: 'email', disabled: disabled, placeholder: t('signup_email_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: !error && emailValue ? _jsx(CheckIcon, {}) : emailValue && _jsx(ClearIcon, { onClick: clearNumber }) }) }) })));
49
+ };
50
+ export default React.memo(Email);
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ interface ExpiryDateProps {
3
+ show: boolean;
4
+ onDateClicked?: (flag: boolean) => void;
5
+ }
6
+ declare const _default: React.MemoExoticComponent<({ onDateClicked, show }: ExpiryDateProps) => JSX.Element>;
7
+ export default _default;
@@ -0,0 +1,50 @@
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 { useTranslation } from 'react-i18next';
15
+ import { useController, useFormContext } from 'react-hook-form';
16
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
17
+ import { FieldType } from '../../../../@types';
18
+ import { getFutureDate } from '../../../../utils';
19
+ import { styled, alpha } from '@mui/material/styles';
20
+ import Text from '../../../../components/Text';
21
+ import Collapse from '../../../../components/Collapse';
22
+ import DatePicker from '../../../../components/DatePicker';
23
+ import { ScreenContainer } from '../../../shared/Containers';
24
+ import { individualSelector, clearError } from '../../../app/individual/individualStore';
25
+ var InputLabelStyled = styled(Text)(function (_a) {
26
+ var theme = _a.theme;
27
+ return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption), { cursor: 'pointer' }));
28
+ });
29
+ var ExpiryDate = function (_a) {
30
+ var _b, _c, _d;
31
+ var onDateClicked = _a.onDateClicked, show = _a.show;
32
+ var t = useTranslation().t;
33
+ var control = useFormContext().control;
34
+ var dispatch = useAppDispatch();
35
+ var dobControl = useController({ control: control, name: 'expiryDate' });
36
+ var _e = useAppSelector(individualSelector), error = _e.error, data = _e.data;
37
+ var user = (data.verify.responseBody || {}).user;
38
+ var handleBirthDateChange = function (data) {
39
+ if (error)
40
+ dispatch(clearError());
41
+ dobControl.field.onChange(data);
42
+ };
43
+ var dateValue = (_b = dobControl === null || dobControl === void 0 ? void 0 : dobControl.field) === null || _b === void 0 ? void 0 : _b.value;
44
+ var disabled = ((_d = (_c = user === null || user === void 0 ? void 0 : user.data_status) === null || _c === void 0 ? void 0 : _c.identification) === null || _d === void 0 ? void 0 : _d.expiry) === FieldType.NON_EDITABLE;
45
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, __assign({ sx: { p: function (_a) {
46
+ var spacing = _a.spacing;
47
+ return spacing(2.5, 2.5, 2.5, 2.5);
48
+ } } }, { children: t('enter_expiry_date') })), _jsx(DatePicker, { readOnly: true, disabled: disabled, defaultValue: dateValue ? new Date(dateValue) : new Date(), dir: 'ltr', locale: 'en', maxDate: getFutureDate(), onClick: disabled ? undefined : function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(true); }, onDatePicked: function () { return onDateClicked === null || onDateClicked === void 0 ? void 0 : onDateClicked(false); }, onDateChange: handleBirthDateChange })] }) })));
49
+ };
50
+ export default React.memo(ExpiryDate);