@tap-payments/auth-jsconnect 2.1.23-test → 2.1.25-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/build/@types/app.d.ts +48 -1
  2. package/build/@types/app.js +12 -0
  3. package/build/@types/form.d.ts +24 -8
  4. package/build/api/axios.js +2 -2
  5. package/build/api/data.d.ts +8 -0
  6. package/build/api/data.js +16 -0
  7. package/build/api/entity.d.ts +28 -1
  8. package/build/api/entity.js +26 -1
  9. package/build/api/index.d.ts +13 -3
  10. package/build/api/index.js +2 -2
  11. package/build/api/individual.d.ts +4 -0
  12. package/build/api/location.d.ts +5 -0
  13. package/build/api/location.js +19 -0
  14. package/build/app/rootReducer.d.ts +1 -0
  15. package/build/app/rootReducer.js +3 -1
  16. package/build/app/settings.js +1 -1
  17. package/build/app/store.d.ts +2 -0
  18. package/build/assets/locales/ar.json +21 -1
  19. package/build/assets/locales/en.json +21 -1
  20. package/build/components/SimpleList/SimpleList.d.ts +2 -1
  21. package/build/components/SimpleList/SimpleList.js +22 -10
  22. package/build/constants/api.d.ts +3 -0
  23. package/build/constants/api.js +7 -1
  24. package/build/constants/app.d.ts +7 -1
  25. package/build/constants/app.js +51 -8
  26. package/build/constants/validation.d.ts +1 -0
  27. package/build/constants/validation.js +1 -0
  28. package/build/features/app/brand/brandStore.d.ts +97 -0
  29. package/build/features/app/brand/brandStore.js +618 -0
  30. package/build/features/app/entity/entityStore.d.ts +11 -23
  31. package/build/features/app/entity/entityStore.js +212 -295
  32. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +3 -2
  33. package/build/features/brand/Brand.d.ts +7 -0
  34. package/build/features/brand/Brand.js +69 -0
  35. package/build/features/brand/index.d.ts +1 -0
  36. package/build/features/brand/index.js +1 -0
  37. package/build/features/{entity/screens/Customers/CustomerLocations.d.ts → brand/screens/BrandActivities/ActivitiesList.d.ts} +34 -61
  38. package/build/features/{entity/screens/EntityInfoConfirm → brand/screens/BrandActivities}/ActivitiesList.js +59 -40
  39. package/build/features/brand/screens/BrandActivities/BrandActivities.d.ts +5 -0
  40. package/build/features/brand/screens/BrandActivities/BrandActivities.js +72 -0
  41. package/build/features/brand/screens/BrandActivities/CustomerBase.d.ts +82 -0
  42. package/build/features/{entity/screens/Customers/CustomerLocations.js → brand/screens/BrandActivities/CustomerBase.js} +8 -35
  43. package/build/features/{entity/screens/Customers → brand/screens/BrandActivities}/ExpectedCustomers.d.ts +0 -0
  44. package/build/features/{entity/screens/Customers → brand/screens/BrandActivities}/ExpectedCustomers.js +6 -6
  45. package/build/features/{entity/screens/Customers → brand/screens/BrandActivities}/ExpectedSalesRange.d.ts +0 -0
  46. package/build/features/{entity/screens/Customers → brand/screens/BrandActivities}/ExpectedSalesRange.js +6 -6
  47. package/build/features/brand/screens/BrandActivities/OperationStartDate.d.ts +20 -0
  48. package/build/features/brand/screens/BrandActivities/OperationStartDate.js +45 -0
  49. package/build/features/{entity/screens/Customers → brand/screens/BrandActivities}/RefundPolicy.d.ts +0 -0
  50. package/build/features/{entity/screens/Customers → brand/screens/BrandActivities}/RefundPolicy.js +2 -2
  51. package/build/features/brand/screens/BrandActivities/TAC.d.ts +6 -0
  52. package/build/features/brand/screens/BrandActivities/TAC.js +87 -0
  53. package/build/features/{entity/screens/Customers → brand/screens/BrandActivities}/TransactionPolicy.d.ts +0 -0
  54. package/build/features/{entity/screens/Customers → brand/screens/BrandActivities}/TransactionPolicy.js +0 -0
  55. package/build/features/brand/screens/BrandActivities/index.d.ts +2 -0
  56. package/build/features/brand/screens/BrandActivities/index.js +2 -0
  57. package/build/features/brand/screens/BrandActivities/validation.d.ts +71 -0
  58. package/build/features/{entity/screens/Customers → brand/screens/BrandActivities}/validation.js +9 -1
  59. package/build/features/brand/screens/BrandInfo/BrandInfo.d.ts +5 -0
  60. package/build/features/brand/screens/BrandInfo/BrandInfo.js +72 -0
  61. package/build/features/brand/screens/BrandInfo/BrandName.d.ts +8 -0
  62. package/build/features/brand/screens/BrandInfo/BrandName.js +142 -0
  63. package/build/features/brand/screens/BrandInfo/SalesChannels.d.ts +5 -0
  64. package/build/features/brand/screens/BrandInfo/SalesChannels.js +30 -0
  65. package/build/features/brand/screens/BrandInfo/Segments.d.ts +8 -0
  66. package/build/features/brand/screens/BrandInfo/Segments.js +83 -0
  67. package/build/features/brand/screens/BrandInfo/TeamSize.d.ts +8 -0
  68. package/build/features/brand/screens/BrandInfo/TeamSize.js +83 -0
  69. package/build/features/brand/screens/BrandInfo/index.d.ts +2 -0
  70. package/build/features/brand/screens/BrandInfo/index.js +2 -0
  71. package/build/features/brand/screens/BrandInfo/validation.d.ts +41 -0
  72. package/build/features/brand/screens/BrandInfo/validation.js +106 -0
  73. package/build/features/brand/screens/ResetPasswordSuccess/ResetPasswordSuccess.d.ts +5 -0
  74. package/build/features/brand/screens/ResetPasswordSuccess/ResetPasswordSuccess.js +9 -0
  75. package/build/features/brand/screens/ResetPasswordSuccess/index.d.ts +3 -0
  76. package/build/features/brand/screens/ResetPasswordSuccess/index.js +2 -0
  77. package/build/features/brand/screens/Success/Success.d.ts +5 -0
  78. package/build/features/brand/screens/Success/Success.js +20 -0
  79. package/build/features/brand/screens/Success/index.d.ts +3 -0
  80. package/build/features/brand/screens/Success/index.js +2 -0
  81. package/build/features/brand/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +3 -0
  82. package/build/features/brand/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +117 -0
  83. package/build/features/brand/screens/SuccessWithFlowButtons/index.d.ts +2 -0
  84. package/build/features/brand/screens/SuccessWithFlowButtons/index.js +2 -0
  85. package/build/features/brand/screens/Verify/OTPInput.d.ts +7 -0
  86. package/build/features/brand/screens/Verify/OTPInput.js +47 -0
  87. package/build/features/brand/screens/Verify/Verify.d.ts +5 -0
  88. package/build/features/brand/screens/Verify/Verify.js +91 -0
  89. package/build/features/brand/screens/Verify/index.d.ts +2 -0
  90. package/build/features/brand/screens/Verify/index.js +2 -0
  91. package/build/features/brand/screens/Verify/validation.d.ts +8 -0
  92. package/build/features/brand/screens/Verify/validation.js +4 -0
  93. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +4 -2
  94. package/build/features/connect/screens/Merchant/validation.js +2 -2
  95. package/build/features/entity/screens/EntityCapital/ActivityList.d.ts +90 -0
  96. package/build/features/entity/screens/EntityCapital/ActivityList.js +178 -0
  97. package/build/features/entity/screens/EntityCapital/CapitalPaid.d.ts +5 -0
  98. package/build/features/entity/screens/EntityCapital/CapitalPaid.js +47 -0
  99. package/build/features/entity/screens/EntityCapital/CapitalShareCount.d.ts +5 -0
  100. package/build/features/entity/screens/EntityCapital/CapitalShareCount.js +42 -0
  101. package/build/features/entity/screens/EntityCapital/CapitalShareValue.d.ts +5 -0
  102. package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +47 -0
  103. package/build/features/entity/screens/EntityCapital/EntityCapital.d.ts +5 -0
  104. package/build/features/entity/screens/EntityCapital/EntityCapital.js +75 -0
  105. package/build/features/entity/screens/EntityCapital/index.d.ts +2 -0
  106. package/build/features/entity/screens/EntityCapital/index.js +2 -0
  107. package/build/features/entity/screens/EntityCapital/validation.d.ts +62 -0
  108. package/build/features/entity/screens/EntityCapital/validation.js +25 -0
  109. package/build/features/entity/screens/EntityName/EntityName.d.ts +5 -0
  110. package/build/features/entity/screens/EntityName/EntityName.js +87 -0
  111. package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +90 -0
  112. package/build/features/entity/screens/EntityName/EntityTypeList.js +151 -0
  113. package/build/features/entity/screens/EntityName/ExpiryDate.d.ts +19 -0
  114. package/build/features/entity/screens/EntityName/ExpiryDate.js +46 -0
  115. package/build/features/entity/screens/EntityName/IssuingDate.d.ts +19 -0
  116. package/build/features/entity/screens/EntityName/IssuingDate.js +46 -0
  117. package/build/features/entity/screens/EntityName/LegalName.d.ts +5 -0
  118. package/build/features/entity/screens/EntityName/LegalName.js +48 -0
  119. package/build/features/entity/screens/{EntityInfoConfirm → EntityName}/LicenseNumber.d.ts +0 -0
  120. package/build/features/entity/screens/{EntityInfoConfirm → EntityName}/LicenseNumber.js +12 -18
  121. package/build/features/entity/screens/EntityName/UnifiedNumber.d.ts +6 -0
  122. package/build/features/entity/screens/EntityName/UnifiedNumber.js +43 -0
  123. package/build/features/entity/screens/EntityName/index.d.ts +2 -0
  124. package/build/features/entity/screens/EntityName/index.js +2 -0
  125. package/build/features/entity/screens/EntityName/validation.d.ts +48 -0
  126. package/build/features/entity/screens/EntityName/validation.js +112 -0
  127. package/build/features/featuresScreens.d.ts +1 -0
  128. package/build/features/featuresScreens.js +35 -6
  129. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +4 -2
  130. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +4 -2
  131. package/build/features/shared/AcceptancePayouts/AcceptancePayouts.js +1 -1
  132. package/build/features/shared/Address/Address.d.ts +11 -0
  133. package/build/features/shared/Address/Address.js +63 -0
  134. package/build/features/shared/Address/CountryList.d.ts +72 -0
  135. package/build/features/shared/Address/CountryList.js +89 -0
  136. package/build/features/{entity/screens/EntityInfoConfirm/ActivitiesList.d.ts → shared/Address/InputSelect.d.ts} +27 -11
  137. package/build/features/shared/Address/InputSelect.js +172 -0
  138. package/build/features/shared/Address/InputText.d.ts +11 -0
  139. package/build/features/shared/Address/InputText.js +12 -0
  140. package/build/features/shared/Address/index.d.ts +2 -0
  141. package/build/features/shared/Address/index.js +2 -0
  142. package/build/features/shared/Input/Input.d.ts +7 -5
  143. package/build/features/shared/Input/Input.js +2 -2
  144. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +4 -2
  145. package/build/hooks/useAppDispatch.d.ts +1 -0
  146. package/build/index.d.ts +3 -2
  147. package/build/index.js +4 -1
  148. package/package.json +1 -1
  149. package/build/api/ip.d.ts +0 -4
  150. package/build/api/ip.js +0 -12
  151. package/build/features/entity/screens/Customers/Customers.d.ts +0 -5
  152. package/build/features/entity/screens/Customers/Customers.js +0 -90
  153. package/build/features/entity/screens/Customers/index.d.ts +0 -3
  154. package/build/features/entity/screens/Customers/index.js +0 -2
  155. package/build/features/entity/screens/Customers/validation.d.ts +0 -20
  156. package/build/features/entity/screens/EntityInfoConfirm/Article.d.ts +0 -3
  157. package/build/features/entity/screens/EntityInfoConfirm/Article.js +0 -76
  158. package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.d.ts +0 -5
  159. package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +0 -84
  160. package/build/features/entity/screens/EntityInfoConfirm/LicenseName.d.ts +0 -5
  161. package/build/features/entity/screens/EntityInfoConfirm/LicenseName.js +0 -32
  162. package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.d.ts +0 -6
  163. package/build/features/entity/screens/EntityInfoConfirm/OperationStartDate.js +0 -33
  164. package/build/features/entity/screens/EntityInfoConfirm/index.d.ts +0 -2
  165. package/build/features/entity/screens/EntityInfoConfirm/index.js +0 -2
  166. package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +0 -141
  167. package/build/features/entity/screens/EntityInfoConfirm/validation.js +0 -83
@@ -0,0 +1,178 @@
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 __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
24
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
25
+ if (ar || !(i in from)) {
26
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
27
+ ar[i] = from[i];
28
+ }
29
+ }
30
+ return to.concat(ar || Array.prototype.slice.call(from));
31
+ };
32
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
33
+ import * as React from 'react';
34
+ import { useTranslation } from 'react-i18next';
35
+ import { useController, useFormContext } from 'react-hook-form';
36
+ import Box from '@mui/material/Box';
37
+ import { alpha, styled } from '@mui/material/styles';
38
+ import InfoIcon from '@mui/icons-material/Info';
39
+ import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
40
+ import CheckIcon from '@mui/icons-material/Check';
41
+ import { useLanguage, useAppSelector } from '../../../../hooks';
42
+ import { BusinessType, FieldType } from '../../../../@types';
43
+ import Text from '../../../../components/Text';
44
+ import Input from '../../../../components/Input';
45
+ import Tooltip from '../../../../components/Tooltip';
46
+ import Collapse from '../../../../components/Collapse';
47
+ import SimpleList from '../../../../components/SimpleList';
48
+ import ExpandIcon from '../../../../components/ExpandIcon';
49
+ import { ScreenContainer } from '../../../shared/Containers';
50
+ import { entitySelector } from '../../../app/entity/entityStore';
51
+ import Search from '../../../shared/Search';
52
+ export var InputLabelStyled = styled(Text)(function (_a) {
53
+ var theme = _a.theme;
54
+ return (__assign({ color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption));
55
+ });
56
+ export var InputStyled = styled(Input)(function (_a) {
57
+ var theme = _a.theme;
58
+ return ({
59
+ paddingInlineEnd: theme.spacing(2.5),
60
+ '& .MuiInputBase-input': {
61
+ cursor: 'pointer'
62
+ }
63
+ });
64
+ });
65
+ export var InfoOutlinedIconStyled = styled(InfoOutlinedIcon)(function (_a) {
66
+ var theme = _a.theme;
67
+ return ({
68
+ width: theme.spacing(2.75),
69
+ height: theme.spacing(2.125),
70
+ cursor: 'pointer',
71
+ color: alpha(theme.palette.text.primary, 0.4)
72
+ });
73
+ });
74
+ export var InfoIconStyled = styled(InfoIcon)(function (_a) {
75
+ var theme = _a.theme;
76
+ return ({
77
+ width: theme.spacing(2.75),
78
+ height: theme.spacing(2.125),
79
+ cursor: 'pointer',
80
+ color: alpha(theme.palette.text.primary, 0.4)
81
+ });
82
+ });
83
+ export var LabelContainerStyled = styled(Box)(function (_a) {
84
+ var theme = _a.theme;
85
+ return ({
86
+ display: 'flex',
87
+ justifyContent: 'space-between',
88
+ margin: theme.spacing(2.5, 2.5, 1.5, 2.5)
89
+ });
90
+ });
91
+ var SimpleListStyled = styled((SimpleList))(function () { return ({}); });
92
+ export var CheckIconStyled = styled(CheckIcon)(function (_a) {
93
+ var theme = _a.theme;
94
+ return ({
95
+ color: theme.palette.primary.main,
96
+ display: 'flex',
97
+ alignItems: 'flex-end'
98
+ });
99
+ });
100
+ export var NameContainer = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
101
+ var theme = _a.theme, isSelected = _a.isSelected;
102
+ return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight, paddingInlineStart: theme.spacing(1.25), textAlign: 'start' }));
103
+ });
104
+ var ActivitiesList = function (_a) {
105
+ var _b, _c;
106
+ var rest = __rest(_a, []);
107
+ var _d = React.useState([]), activitiesMenuList = _d[0], setActivitiesMenuList = _d[1];
108
+ var _e = React.useState(null), anchorEl = _e[0], setAnchorEl = _e[1];
109
+ var t = useTranslation().t;
110
+ var isAr = useLanguage().isAr;
111
+ var control = useFormContext().control;
112
+ var data = useAppSelector(entitySelector).data;
113
+ var activitiesControl = useController({ name: 'activities', control: control });
114
+ var controlValue = activitiesControl.field.value;
115
+ var _f = React.useState(false), isHovered = _f[0], setIsHovered = _f[1];
116
+ var verify = data.verify;
117
+ var _g = verify.responseBody || {}, activityList = _g.activityList, entity = _g.entity;
118
+ var licenseType = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.type;
119
+ var type = licenseType === 'freelance' ? BusinessType.FL : BusinessType.CR;
120
+ var isCR = type === BusinessType.CR;
121
+ var disabled = ((_c = entity === null || entity === void 0 ? void 0 : entity.data_status) === null || _c === void 0 ? void 0 : _c.activities) === FieldType.NON_EDITABLE;
122
+ React.useEffect(function () {
123
+ if ((activityList === null || activityList === void 0 ? void 0 : activityList.length) > 0) {
124
+ var sortedList = (activityList || [])
125
+ .map(function (activity) { return activity; })
126
+ .sort(function (a, b) { var _a, _b, _c, _d, _e; return (_c = (_b = (_a = a === null || a === void 0 ? void 0 : a.name) === null || _a === void 0 ? void 0 : _a.en) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === null || _c === void 0 ? void 0 : _c.localeCompare((_e = (_d = b === null || b === void 0 ? void 0 : b.name) === null || _d === void 0 ? void 0 : _d.en) === null || _e === void 0 ? void 0 : _e.toLowerCase()); });
127
+ setActivitiesMenuList(sortedList);
128
+ }
129
+ }, [activityList]);
130
+ var onOpenList = function (event) {
131
+ var _a;
132
+ setAnchorEl(event.currentTarget);
133
+ (_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
134
+ };
135
+ var onCloseList = function () {
136
+ var _a;
137
+ setAnchorEl(null);
138
+ (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
139
+ };
140
+ var onSelectItem = function (item) {
141
+ var _a;
142
+ var isActivityExistInBackend = (_a = entity === null || entity === void 0 ? void 0 : entity.activities) === null || _a === void 0 ? void 0 : _a.find(function (activity) { return activity.id === item.id; });
143
+ if (isActivityExistInBackend)
144
+ return;
145
+ var isActivityExists = controlValue === null || controlValue === void 0 ? void 0 : controlValue.find(function (activity) { return activity.id === item.id; });
146
+ if (isActivityExists) {
147
+ var updatedIdList = controlValue === null || controlValue === void 0 ? void 0 : controlValue.filter(function (activity) { return activity.id !== (item === null || item === void 0 ? void 0 : item.id); });
148
+ if (updatedIdList.length >= 1)
149
+ activitiesControl.field.onChange(updatedIdList);
150
+ return;
151
+ }
152
+ activitiesControl.field.onChange(__spreadArray(__spreadArray([], controlValue, true), [item], false));
153
+ };
154
+ var getSelectedActivities = function () {
155
+ var _a, _b;
156
+ if ((controlValue === null || controlValue === void 0 ? void 0 : controlValue.length) > 1) {
157
+ return (controlValue === null || controlValue === void 0 ? void 0 : controlValue.length) + ' ' + t('activities_selected');
158
+ }
159
+ var item = controlValue[0];
160
+ return 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;
161
+ };
162
+ var getSelectedActivityFlag = function (item) {
163
+ return controlValue === null || controlValue === void 0 ? void 0 : controlValue.find(function (activity) { return activity.id === item.id; });
164
+ };
165
+ var handleSearch = function (value) {
166
+ var filteredList = activityList === null || activityList === void 0 ? void 0 : activityList.filter(function (activity) {
167
+ var _a, _b, _c, _d;
168
+ return ((_b = (_a = activity === null || activity === void 0 ? void 0 : activity.name) === null || _a === void 0 ? void 0 : _a.en) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(value.toLowerCase())) ||
169
+ ((_d = (_c = activity === null || activity === void 0 ? void 0 : activity.name) === null || _c === void 0 ? void 0 : _c.ar) === null || _d === void 0 ? void 0 : _d.toLowerCase().includes(value.toLowerCase()));
170
+ }).sort(function (a, b) { var _a, _b, _c, _d, _e; return (_c = (_b = (_a = a === null || a === void 0 ? void 0 : a.name) === null || _a === void 0 ? void 0 : _a.en) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === null || _c === void 0 ? void 0 : _c.localeCompare((_e = (_d = b === null || b === void 0 ? void 0 : b.name) === null || _d === void 0 ? void 0 : _d.en) === null || _e === void 0 ? void 0 : _e.toLowerCase()); });
171
+ setActivitiesMenuList(filteredList);
172
+ };
173
+ return (_jsxs(ScreenContainer, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t(isCR ? 'activities' : 'category') }), _jsx(Tooltip, __assign({ title: t('activities_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsxs(Box, { children: [_jsx(InputStyled, { readOnly: true, disabled: disabled, value: getSelectedActivities() || '', placeholder: isCR ? t('choose_activities') : t('category_name'), onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsxs(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: [_jsx(Search, { onSearchValue: handleSearch }), _jsx(SimpleListStyled, { searchKeyPath: 'name', list: activitiesMenuList, onSelectItem: onSelectItem, renderItem: function (item) {
174
+ var _a, _b, _c;
175
+ return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(NameContainer, __assign({ isSelected: item.id === ((_a = getSelectedActivityFlag(item)) === null || _a === void 0 ? void 0 : _a.id) }, { children: isAr ? (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = item === null || item === void 0 ? void 0 : item.name) === null || _c === void 0 ? void 0 : _c.en })) })), getSelectedActivityFlag(item) && _jsx(CheckIconStyled, {})] }));
176
+ } })] }))] })] }));
177
+ };
178
+ export default ActivitiesList;
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ interface CapitalPaidProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: CapitalPaidProps) => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,47 @@
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 { useAppSelector } from '../../../../hooks';
18
+ import { FieldType } from '../../../../@types';
19
+ import { settingsSelector } from '../../../../app/settings';
20
+ import { findCurrencyByIso2, removeAllCharsFromNumber } from '../../../../utils';
21
+ import { ScreenContainer } from '../../../shared/Containers';
22
+ import Input from '../../../shared/Input';
23
+ import { entitySelector } from '../../../app/entity/entityStore';
24
+ var CapitalPaid = function (_a) {
25
+ var _b, _c, _d, _e;
26
+ var t = useTranslation().t;
27
+ var data = useAppSelector(entitySelector).data;
28
+ var settingsData = useAppSelector(settingsSelector).data;
29
+ var control = useFormContext().control;
30
+ var entity = (data.verify.responseBody || {}).entity;
31
+ var paid = (_b = entity === null || entity === void 0 ? void 0 : entity.capital) === null || _b === void 0 ? void 0 : _b.paid;
32
+ var countryCode = settingsData.businessCountry.iso2;
33
+ var disabled = ((_d = (_c = entity === null || entity === void 0 ? void 0 : entity.data_status) === null || _c === void 0 ? void 0 : _c.capital) === null || _d === void 0 ? void 0 : _d.paid) === FieldType.NON_EDITABLE;
34
+ var handleChange = function (_a) {
35
+ var target = _a.target;
36
+ var value = removeAllCharsFromNumber(target.value);
37
+ capitalPaidControl.field.onChange(value);
38
+ };
39
+ var capitalPaidControl = useController({ control: control, name: 'capitalPaid' });
40
+ var capitalPaidValue = capitalPaidControl.field.value;
41
+ var error = (_e = capitalPaidControl.fieldState.error) === null || _e === void 0 ? void 0 : _e.message;
42
+ var hide = !paid && disabled;
43
+ return (_jsx(Collapse, __assign({ in: !hide }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { label: t('capital_paid_label', {
44
+ currency: findCurrencyByIso2(countryCode)
45
+ }), onChange: handleChange, disabled: disabled, value: capitalPaidValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('capital_paid_hint'), warningType: 'alert', warningMessage: error && t(error) }) })) })));
46
+ };
47
+ export default React.memo(CapitalPaid);
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ interface CapitalShareCountProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: CapitalShareCountProps) => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,42 @@
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 { useAppSelector } from '../../../../hooks';
18
+ import { removeAllCharsFromNumber } from '../../../../utils';
19
+ import { FieldType } from '../../../../@types';
20
+ import { ScreenContainer } from '../../../shared/Containers';
21
+ import Input from '../../../shared/Input';
22
+ import { entitySelector } from '../../../app/entity/entityStore';
23
+ var CapitalShareCount = function (_a) {
24
+ var _b, _c, _d, _e, _f;
25
+ var t = useTranslation().t;
26
+ var data = useAppSelector(entitySelector).data;
27
+ var control = useFormContext().control;
28
+ var entity = (data.verify.responseBody || {}).entity;
29
+ var shareCount = (_c = (_b = entity === null || entity === void 0 ? void 0 : entity.capital) === null || _b === void 0 ? void 0 : _b.shares) === null || _c === void 0 ? void 0 : _c.count;
30
+ var disabled = ((_e = (_d = entity === null || entity === void 0 ? void 0 : entity.data_status) === null || _d === void 0 ? void 0 : _d.capital) === null || _e === void 0 ? void 0 : _e.shares) === FieldType.NON_EDITABLE;
31
+ var hide = !shareCount && disabled;
32
+ var handleChange = function (_a) {
33
+ var target = _a.target;
34
+ var value = removeAllCharsFromNumber(target.value);
35
+ capitalShareCountControl.field.onChange(value);
36
+ };
37
+ var capitalShareCountControl = useController({ control: control, name: 'capitalShareCount' });
38
+ var capitalShareCountValue = capitalShareCountControl.field.value;
39
+ var error = (_f = capitalShareCountControl.fieldState.error) === null || _f === void 0 ? void 0 : _f.message;
40
+ return (_jsx(Collapse, __assign({ in: !hide }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { label: t('capital_share_count_label'), onChange: handleChange, disabled: disabled, value: capitalShareCountValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('capital_share_count_hint'), warningType: 'alert', warningMessage: error && t(error) }) })) })));
41
+ };
42
+ export default React.memo(CapitalShareCount);
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ interface CapitalShareValueProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: CapitalShareValueProps) => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,47 @@
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 { ScreenContainer } from '../../../shared/Containers';
18
+ import Input from '../../../shared/Input';
19
+ import { useAppSelector } from '../../../../hooks';
20
+ import { entitySelector } from '../../../app/entity/entityStore';
21
+ import { findCurrencyByIso2, removeAllCharsFromNumber } from '../../../../utils';
22
+ import { settingsSelector } from '../../../../app/settings';
23
+ import { FieldType } from '../../../../@types';
24
+ var CapitalShareValue = function (_a) {
25
+ var _b, _c, _d, _e, _f;
26
+ var t = useTranslation().t;
27
+ var data = useAppSelector(entitySelector).data;
28
+ var settingsData = useAppSelector(settingsSelector).data;
29
+ var control = useFormContext().control;
30
+ var entity = (data.verify.responseBody || {}).entity;
31
+ var shareValue = (_c = (_b = entity === null || entity === void 0 ? void 0 : entity.capital) === null || _b === void 0 ? void 0 : _b.shares) === null || _c === void 0 ? void 0 : _c.value;
32
+ var countryCode = settingsData.businessCountry.iso2;
33
+ var disabled = ((_e = (_d = entity === null || entity === void 0 ? void 0 : entity.data_status) === null || _d === void 0 ? void 0 : _d.capital) === null || _e === void 0 ? void 0 : _e.shares) === FieldType.NON_EDITABLE;
34
+ var hide = !shareValue && disabled;
35
+ var handleChange = function (_a) {
36
+ var target = _a.target;
37
+ var value = removeAllCharsFromNumber(target.value);
38
+ capitalShareValueControl.field.onChange(value);
39
+ };
40
+ var capitalShareValueControl = useController({ control: control, name: 'capitalShareValue' });
41
+ var capitalShareValueValue = capitalShareValueControl.field.value;
42
+ var error = (_f = capitalShareValueControl.fieldState.error) === null || _f === void 0 ? void 0 : _f.message;
43
+ return (_jsx(Collapse, __assign({ in: !hide }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { label: t('capital_share_value_label', {
44
+ currency: findCurrencyByIso2(countryCode)
45
+ }), onChange: handleChange, disabled: disabled, value: capitalShareValueValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('capital_share_value_hint'), warningType: 'alert', warningMessage: error && t(error) }) })) })));
46
+ };
47
+ export default React.memo(CapitalShareValue);
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export interface EntityCapitalProps {
3
+ }
4
+ declare const EntityCapital: ({}: EntityCapitalProps) => JSX.Element;
5
+ export default EntityCapital;
@@ -0,0 +1,75 @@
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 __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
+ import * as React from 'react';
25
+ import { FormProvider, useForm } from 'react-hook-form';
26
+ import { useTranslation } from 'react-i18next';
27
+ import { styled } from '@mui/material/styles';
28
+ import Collapse from '@mui/material/Collapse';
29
+ import { useAppDispatch, useAppSelector, useLanguage, useSetFromDefaultValues } from '../../../../hooks';
30
+ import { clearError, entitySelector, updateEntityCapital } from '../../../app/entity/entityStore';
31
+ import { yupResolver } from '@hookform/resolvers/yup';
32
+ import { handlePrevScreenStep } from '../../../../app/settings';
33
+ import { ScreenContainer } from '../../../shared/Containers';
34
+ import Form from '../../../../components/Form';
35
+ import Button from '../../../shared/Button';
36
+ import { EntityCapitalValidationSchema } from './validation';
37
+ import CapitalPaid from './CapitalPaid';
38
+ import CapitalShareCount from './CapitalShareCount';
39
+ import CapitalShareValue from './CapitalShareValue';
40
+ import ActivityList from './ActivityList';
41
+ var FormStyled = styled(Form)(function () { return ({
42
+ display: 'flex',
43
+ flexDirection: 'column'
44
+ }); });
45
+ var EntityCapital = function (_a) {
46
+ var _b = React.useState(false), anchorEl = _b[0], setAnchorEl = _b[1];
47
+ var _c = useAppSelector(entitySelector), data = _c.data, loading = _c.loading, error = _c.error, uploading = _c.uploading;
48
+ var isAr = useLanguage().isAr;
49
+ var t = useTranslation().t;
50
+ var dispatch = useAppDispatch();
51
+ var _d = data.entityCapitalData, responseBody = _d.responseBody, defaultValues = __rest(_d, ["responseBody"]);
52
+ var entity = (data.verify.responseBody || {}).entity;
53
+ var methods = useForm({
54
+ resolver: yupResolver(EntityCapitalValidationSchema(entity)),
55
+ defaultValues: defaultValues,
56
+ mode: 'onChange'
57
+ });
58
+ useSetFromDefaultValues(methods, defaultValues);
59
+ var onSubmit = function (data) {
60
+ dispatch(updateEntityCapital(data));
61
+ };
62
+ var onBack = function () {
63
+ dispatch(handlePrevScreenStep());
64
+ };
65
+ React.useEffect(function () {
66
+ if (error)
67
+ dispatch(clearError());
68
+ }, [methods.formState.isValid]);
69
+ var handleActivitiesOpenClose = function (flag) {
70
+ setAnchorEl(flag);
71
+ };
72
+ var disabled = !methods.formState.isValid || !!error || uploading;
73
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(ActivityList, { onListOpen: function () { return handleActivitiesOpenClose(true); }, onListClose: function () { return handleActivitiesOpenClose(false); } }), _jsxs(Collapse, __assign({ in: !anchorEl }, { children: [_jsx(CapitalPaid, {}), _jsx(CapitalShareCount, {}), _jsx(CapitalShareValue, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] }))] })) })) }));
74
+ };
75
+ export default EntityCapital;
@@ -0,0 +1,2 @@
1
+ import EntityCapital from './EntityCapital';
2
+ export default EntityCapital;
@@ -0,0 +1,2 @@
1
+ import EntityCapital from './EntityCapital';
2
+ export default EntityCapital;
@@ -0,0 +1,62 @@
1
+ import * as yup from 'yup';
2
+ export declare const EntityCapitalValidationSchema: (entity: any) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
4
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
5
+ en: 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
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
8
+ en: 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
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
11
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
12
+ }>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
13
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
14
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
15
+ }>>[] | undefined, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
16
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
17
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
18
+ }>>[] | undefined>;
19
+ capitalPaid: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
20
+ capitalShareCount: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
21
+ capitalShareValue: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
22
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
23
+ activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
24
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
25
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
26
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
27
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
28
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
29
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
30
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
31
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
32
+ }>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
33
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
34
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
35
+ }>>[] | undefined, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
36
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
37
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
38
+ }>>[] | undefined>;
39
+ capitalPaid: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
40
+ capitalShareCount: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
41
+ capitalShareValue: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
42
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
43
+ activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
44
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
45
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
46
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
47
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
48
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
49
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
50
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
51
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
52
+ }>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
53
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
54
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
55
+ }>>[] | undefined, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
56
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
57
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
58
+ }>>[] | undefined>;
59
+ capitalPaid: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
60
+ capitalShareCount: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
61
+ capitalShareValue: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
62
+ }>>>;
@@ -0,0 +1,25 @@
1
+ import * as yup from 'yup';
2
+ import { FieldType } from '../../../../@types';
3
+ export var EntityCapitalValidationSchema = function (entity) {
4
+ var _a, _b, _c, _d, _e;
5
+ var _f = entity || {}, capital = _f.capital, data_status = _f.data_status;
6
+ var isCapitalPaidOptional = !(capital === null || capital === void 0 ? void 0 : capital.paid) && ((_a = data_status === null || data_status === void 0 ? void 0 : data_status.capital) === null || _a === void 0 ? void 0 : _a.paid) === FieldType.NON_EDITABLE;
7
+ var isCapitalShareCountOptional = !((_b = capital === null || capital === void 0 ? void 0 : capital.shares) === null || _b === void 0 ? void 0 : _b.count) && ((_c = data_status === null || data_status === void 0 ? void 0 : data_status.capital) === null || _c === void 0 ? void 0 : _c.shares) === FieldType.NON_EDITABLE;
8
+ var isCapitalShareValueOptional = !((_d = capital === null || capital === void 0 ? void 0 : capital.shares) === null || _d === void 0 ? void 0 : _d.value) && ((_e = data_status === null || data_status === void 0 ? void 0 : data_status.capital) === null || _e === void 0 ? void 0 : _e.shares) === FieldType.NON_EDITABLE;
9
+ return yup.object().shape({
10
+ activities: yup
11
+ .array()
12
+ .min(1, 'activities_list_alert')
13
+ .of(yup.object().shape({
14
+ ar: yup.string(),
15
+ en: yup.string()
16
+ })),
17
+ capitalPaid: isCapitalPaidOptional ? yup.string().optional() : yup.string().required('capital_paid_required'),
18
+ capitalShareCount: isCapitalShareCountOptional
19
+ ? yup.string().optional()
20
+ : yup.string().required('capital_share_count_required'),
21
+ capitalShareValue: isCapitalShareValueOptional
22
+ ? yup.string().optional()
23
+ : yup.string().required('capital_share_value_required')
24
+ });
25
+ };
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export interface EntityProps {
3
+ }
4
+ declare const EntityName: ({}: EntityProps) => JSX.Element;
5
+ export default EntityName;
@@ -0,0 +1,87 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import { FormProvider, useForm } from 'react-hook-form';
15
+ import { useTranslation } from 'react-i18next';
16
+ import { yupResolver } from '@hookform/resolvers/yup';
17
+ import { styled } from '@mui/material/styles';
18
+ import { useAppDispatch, useAppSelector, useLanguage, useSetFromDefaultValues } from '../../../../hooks';
19
+ import { settingsSelector } from '../../../../app/settings';
20
+ import { isSA } from '../../../../utils';
21
+ import { BusinessType } from '../../../../@types';
22
+ import Form from '../../../../components/Form';
23
+ import Collapse from '../../../../components/Collapse';
24
+ import { clearError, entitySelector, updateEntityName } from '../../../app/entity/entityStore';
25
+ import { ScreenContainer } from '../../../shared/Containers';
26
+ import Button from '../../../shared/Button';
27
+ import { EntityNameValidationSchema, EntityNameKWValidationSchema } from './validation';
28
+ import LegalName from './LegalName';
29
+ import LicenseNumber from './LicenseNumber';
30
+ import IssuingDate from './IssuingDate';
31
+ import ExpiryDate from './ExpiryDate';
32
+ import EntityTypeList from './EntityTypeList';
33
+ import UnifiedNumber from './UnifiedNumber';
34
+ var FormStyled = styled(Form)(function () { return ({
35
+ display: 'flex',
36
+ flexDirection: 'column'
37
+ }); });
38
+ var EntityName = function (_a) {
39
+ var _b = React.useState(false), issueAnchorEl = _b[0], setIssueAnchorEl = _b[1];
40
+ var _c = React.useState(false), expiryAnchorEl = _c[0], setExpiryAnchorEl = _c[1];
41
+ var _d = React.useState(false), entityTypeAnchorEl = _d[0], setEntityTypeAnchorEl = _d[1];
42
+ var _e = useAppSelector(entitySelector), data = _e.data, loading = _e.loading, error = _e.error;
43
+ var settingsData = useAppSelector(settingsSelector).data;
44
+ var isAr = useLanguage().isAr;
45
+ var t = useTranslation().t;
46
+ var dispatch = useAppDispatch();
47
+ var _f = data.entityNameData, legalName = _f.legalName, licenseNumber = _f.licenseNumber, licenseType = _f.licenseType, entityType = _f.entityType, issuingDate = _f.issuingDate, expiryDate = _f.expiryDate, unifiedNumber = _f.unifiedNumber;
48
+ var country_code = settingsData.businessCountry.iso2;
49
+ var isSACountry = React.useMemo(function () { return isSA(country_code); }, [country_code]);
50
+ var isCR = licenseType === BusinessType.CR;
51
+ var entity = (data.verify.responseBody || {}).entity;
52
+ var methods = useForm({
53
+ resolver: yupResolver(isSACountry ? EntityNameValidationSchema(entity) : EntityNameKWValidationSchema(entity)),
54
+ defaultValues: {
55
+ legalName: legalName,
56
+ licenseNumber: licenseNumber,
57
+ licenseType: licenseType,
58
+ entityType: entityType,
59
+ issuingDate: issuingDate,
60
+ expiryDate: expiryDate,
61
+ unifiedNumber: unifiedNumber
62
+ },
63
+ mode: 'onChange'
64
+ });
65
+ useSetFromDefaultValues(methods, data.entityNameData, true);
66
+ var onSubmit = function (data) {
67
+ dispatch(updateEntityName(data));
68
+ };
69
+ var handleIssueDateOpenClose = function (flag) {
70
+ setIssueAnchorEl(flag);
71
+ };
72
+ var handleExpiryDateOpenClose = function (flag) {
73
+ setExpiryAnchorEl(flag);
74
+ };
75
+ var handleEntityOpenClose = function (flag) {
76
+ setEntityTypeAnchorEl(flag);
77
+ };
78
+ React.useEffect(function () {
79
+ if (error)
80
+ dispatch(clearError());
81
+ }, [methods.formState.isValid]);
82
+ var disabled = !methods.formState.isValid || !!error;
83
+ var showLicenseNumber = !isSACountry ? isCR : true;
84
+ var showUnifiedNumber = isSACountry ? isCR : false;
85
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(LegalName, {}) })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl }, { children: _jsx(EntityTypeList, { onListOpen: function () { return handleEntityOpenClose(true); }, onListClose: function () { return handleEntityOpenClose(false); } }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(LicenseNumber, { show: showLicenseNumber }), _jsx(UnifiedNumber, { show: showUnifiedNumber })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !entityTypeAnchorEl }, { children: _jsx(IssuingDate, { onDateClicked: handleIssueDateOpenClose }) })), _jsx(Collapse, __assign({ in: !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(ExpiryDate, { onDateClicked: handleExpiryDateOpenClose }) })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(Button, __assign({ disableBack: true, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
86
+ };
87
+ export default EntityName;