@tap-payments/auth-jsconnect 2.4.21-test → 2.4.23-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.
- package/build/@types/form.d.ts +0 -1
- package/build/@types/user.d.ts +21 -2
- package/build/api/index.d.ts +4 -3
- package/build/api/individual.d.ts +9 -3
- package/build/api/individual.js +9 -1
- package/build/constants/assets.d.ts +2 -0
- package/build/constants/assets.js +2 -0
- package/build/features/app/individual/individualStore.d.ts +7 -4
- package/build/features/app/individual/individualStore.js +122 -78
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +16 -15
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +7 -7
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +6 -5
- package/build/features/individual/screens/IndividualList/UserList.js +10 -6
- package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +6 -26
- package/build/features/shared/Button/FlowsButtons.js +1 -13
- package/build/features/shared/Button/IndividualActionButtons.d.ts +3 -1
- package/build/features/shared/Button/IndividualActionButtons.js +26 -2
- package/build/features/shared/Dot/Dot.d.ts +8 -0
- package/build/features/shared/Dot/Dot.js +29 -0
- package/build/features/shared/Dot/index.d.ts +2 -0
- package/build/features/shared/Dot/index.js +2 -0
- package/build/utils/array.d.ts +1 -0
- package/build/utils/array.js +16 -0
- package/package.json +1 -1
package/build/@types/form.d.ts
CHANGED
|
@@ -101,7 +101,6 @@ export interface IndividualExtraFormValues extends IndividualAttachmentsFormValu
|
|
|
101
101
|
sourceIncome: SourceOfIncome | undefined;
|
|
102
102
|
monthlyIncome: MonthlyIncome | undefined;
|
|
103
103
|
employerName: string;
|
|
104
|
-
employerLocation: CountryCode | undefined;
|
|
105
104
|
isPEP: boolean | null;
|
|
106
105
|
isInfluencer: boolean | null;
|
|
107
106
|
shareCount: string;
|
package/build/@types/user.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export interface User {
|
|
2
2
|
id: string;
|
|
3
|
-
type: string;
|
|
4
3
|
status: string;
|
|
5
4
|
created: number;
|
|
6
5
|
names: Names;
|
|
@@ -24,6 +23,15 @@ export interface User {
|
|
|
24
23
|
individual_id: string;
|
|
25
24
|
data_status: DataStatus;
|
|
26
25
|
data_verification: DataVerification;
|
|
26
|
+
data_state: string;
|
|
27
|
+
object: string;
|
|
28
|
+
shares: {
|
|
29
|
+
count: string;
|
|
30
|
+
value: string;
|
|
31
|
+
};
|
|
32
|
+
ids: Array<string>;
|
|
33
|
+
individual_data_state: string;
|
|
34
|
+
objects: Array<string>;
|
|
27
35
|
isRequestedEmail?: boolean;
|
|
28
36
|
}
|
|
29
37
|
interface DataVerification {
|
|
@@ -110,8 +118,19 @@ interface Identification {
|
|
|
110
118
|
}
|
|
111
119
|
interface Birth {
|
|
112
120
|
date: number;
|
|
113
|
-
city:
|
|
121
|
+
city: BirthCity;
|
|
122
|
+
country: string;
|
|
123
|
+
}
|
|
124
|
+
interface BirthCity {
|
|
125
|
+
cityId: string;
|
|
114
126
|
country: string;
|
|
127
|
+
name: {
|
|
128
|
+
arabic: string;
|
|
129
|
+
english: string;
|
|
130
|
+
textId: string;
|
|
131
|
+
};
|
|
132
|
+
state: string;
|
|
133
|
+
un_locode: string;
|
|
115
134
|
}
|
|
116
135
|
interface Contact {
|
|
117
136
|
email: string;
|
package/build/api/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { CheckEmailBody, CheckBrandBody } from './availabilityServices';
|
|
|
6
6
|
import { EntityInfoBody, EntityBankUpdateBody, BankDocumentInfo, UpdateEntityBody, UpdateEntityActivityBody, UpdateEntityCapitalBody, UpdateEntityAOAFileBody, RemoveEntityActivity } from './entity';
|
|
7
7
|
import { CreateAccountBody, ExpressCreateAccountBody } from './account';
|
|
8
8
|
import { DataElementBody } from './data';
|
|
9
|
-
import { BrandListBody, UpdateBrandBody, UpdateIndividualBody, GetIndividualListBody } from './individual';
|
|
9
|
+
import { BrandListBody, UpdateBrandBody, UpdateIndividualBody, GetIndividualListBody, UpdateIndividualWithTypeBody, UpdateMultipleIndividualBody } from './individual';
|
|
10
10
|
import { UpdateBoardBody, RequestEmailBody } from './board';
|
|
11
11
|
import { GetUserListBody } from './user';
|
|
12
12
|
import { RemoveBrandActivity } from './brand';
|
|
@@ -113,8 +113,9 @@ declare const API: {
|
|
|
113
113
|
individualService: {
|
|
114
114
|
retrieveIndividualInfo: (id: string) => Promise<any>;
|
|
115
115
|
retrieveIndividual: (id: string, type: string) => Promise<any>;
|
|
116
|
-
updateIndividual: ({ id, type, ...data }:
|
|
116
|
+
updateIndividual: ({ id, type, ...data }: UpdateIndividualWithTypeBody) => Promise<any>;
|
|
117
117
|
getIndividualList: (data: GetIndividualListBody) => Promise<any>;
|
|
118
|
+
updateMultipleIndividual: (data: UpdateMultipleIndividualBody) => Promise<any>;
|
|
118
119
|
};
|
|
119
120
|
boardService: {
|
|
120
121
|
retrieveBoard: (id: string) => Promise<any>;
|
|
@@ -151,6 +152,6 @@ declare const API: {
|
|
|
151
152
|
getInitialData: (body: InitBody) => Promise<any>;
|
|
152
153
|
};
|
|
153
154
|
};
|
|
154
|
-
export type { ValidateOperatorBody, CreateAuthBody, ExpressCreateAccountBody, VerifyAuthBody, CreateLeadBody, UpdateLeadBody, LeadVerifyBody, LeadOTPVerifyBody, CheckEmailBody, CheckBrandBody, LeadIdentityUpdateBody, EntityInfoBody, CreateAccountBody, EntityBankUpdateBody, CreatePasswordBody, BrandListBody, VerifyOperationAuthBody, ResetPasswordVerifyAuthBody, UpdateBoardBody, UpdateBrandBody, DataElementBody, UploadFileBody, UpdateEntityBody, DocumentUpdateBody, DocumentInfo, VerifyAuthExpressOTPBody, UpdateIndividualBody, UpdateEntityActivityBody, UpdateEntityCapitalBody, BankDocumentInfo, GetUserListBody, GetIndividualListBody, RequestEmailBody, DocumentBody, UpdateEntityAOAFileBody, InitBody, RemoveBrandActivity, RemoveEntityActivity };
|
|
155
|
+
export type { ValidateOperatorBody, CreateAuthBody, ExpressCreateAccountBody, VerifyAuthBody, CreateLeadBody, UpdateLeadBody, LeadVerifyBody, LeadOTPVerifyBody, CheckEmailBody, CheckBrandBody, LeadIdentityUpdateBody, EntityInfoBody, CreateAccountBody, EntityBankUpdateBody, CreatePasswordBody, BrandListBody, VerifyOperationAuthBody, ResetPasswordVerifyAuthBody, UpdateBoardBody, UpdateBrandBody, DataElementBody, UploadFileBody, UpdateEntityBody, DocumentUpdateBody, DocumentInfo, VerifyAuthExpressOTPBody, UpdateIndividualBody, UpdateEntityActivityBody, UpdateEntityCapitalBody, BankDocumentInfo, GetUserListBody, GetIndividualListBody, RequestEmailBody, DocumentBody, UpdateEntityAOAFileBody, InitBody, RemoveBrandActivity, RemoveEntityActivity, UpdateIndividualWithTypeBody, UpdateMultipleIndividualBody };
|
|
155
156
|
export { setAxiosGlobalHeaders, removeAxiosGlobalHeaders, axiosInstance, getAxiosHeaders };
|
|
156
157
|
export default API;
|
|
@@ -73,8 +73,6 @@ export declare type UpdateSalesChannels = {
|
|
|
73
73
|
}>;
|
|
74
74
|
};
|
|
75
75
|
export declare type UpdateIndividualBody = {
|
|
76
|
-
id: string;
|
|
77
|
-
type: string;
|
|
78
76
|
names?: {
|
|
79
77
|
en?: {
|
|
80
78
|
title?: string;
|
|
@@ -132,6 +130,13 @@ export declare type UpdateIndividualBody = {
|
|
|
132
130
|
step_name?: string;
|
|
133
131
|
encryption_contract?: Array<string>;
|
|
134
132
|
};
|
|
133
|
+
export interface UpdateIndividualWithTypeBody extends UpdateIndividualBody {
|
|
134
|
+
id: string;
|
|
135
|
+
type: string;
|
|
136
|
+
}
|
|
137
|
+
export interface UpdateMultipleIndividualBody extends UpdateIndividualBody {
|
|
138
|
+
ids: Array<string>;
|
|
139
|
+
}
|
|
135
140
|
export declare type GetIndividualListBody = {
|
|
136
141
|
page: number;
|
|
137
142
|
limit: number;
|
|
@@ -140,7 +145,8 @@ export declare type GetIndividualListBody = {
|
|
|
140
145
|
declare const individualService: {
|
|
141
146
|
retrieveIndividualInfo: (id: string) => Promise<any>;
|
|
142
147
|
retrieveIndividual: (id: string, type: string) => Promise<any>;
|
|
143
|
-
updateIndividual: ({ id, type, ...data }:
|
|
148
|
+
updateIndividual: ({ id, type, ...data }: UpdateIndividualWithTypeBody) => Promise<any>;
|
|
144
149
|
getIndividualList: (data: GetIndividualListBody) => Promise<any>;
|
|
150
|
+
updateMultipleIndividual: (data: UpdateMultipleIndividualBody) => Promise<any>;
|
|
145
151
|
};
|
|
146
152
|
export { individualService };
|
package/build/api/individual.js
CHANGED
|
@@ -31,6 +31,13 @@ var updateIndividual = function (_a) {
|
|
|
31
31
|
data: data
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
|
+
var updateMultipleIndividual = function (data) {
|
|
35
|
+
return httpClient({
|
|
36
|
+
method: 'put',
|
|
37
|
+
url: "".concat(ENDPOINT_PATHS.INDIVIDUAL, "/multi"),
|
|
38
|
+
data: data
|
|
39
|
+
});
|
|
40
|
+
};
|
|
34
41
|
var getIndividualList = function (data) {
|
|
35
42
|
return httpClient({
|
|
36
43
|
method: 'post',
|
|
@@ -42,6 +49,7 @@ var individualService = {
|
|
|
42
49
|
retrieveIndividualInfo: retrieveIndividualInfo,
|
|
43
50
|
retrieveIndividual: retrieveIndividual,
|
|
44
51
|
updateIndividual: updateIndividual,
|
|
45
|
-
getIndividualList: getIndividualList
|
|
52
|
+
getIndividualList: getIndividualList,
|
|
53
|
+
updateMultipleIndividual: updateMultipleIndividual
|
|
46
54
|
};
|
|
47
55
|
export { individualService };
|
|
@@ -49,9 +49,11 @@ export declare const ICONS_NAMES: {
|
|
|
49
49
|
WHITE_ARROW: string;
|
|
50
50
|
BLACK_ARROW: string;
|
|
51
51
|
BLUE_ARROW: string;
|
|
52
|
+
GREEN_ARROW: string;
|
|
52
53
|
REQUEST_EMAIL: string;
|
|
53
54
|
REQUEST_EMAIL_GREEN: string;
|
|
54
55
|
ADD_DETAIL: string;
|
|
56
|
+
ADD_DETAIL_GREEN: string;
|
|
55
57
|
SUCCESS: string;
|
|
56
58
|
UNFINISHED: string;
|
|
57
59
|
ABSHER_LOGO: string;
|
|
@@ -49,9 +49,11 @@ export var ICONS_NAMES = {
|
|
|
49
49
|
WHITE_ARROW: 'https://tap-connecet.b-cdn.net/imgs/whiteArrow.svg',
|
|
50
50
|
BLACK_ARROW: 'https://dash.b-cdn.net/icons/menu/arrow_right_icon.svg',
|
|
51
51
|
BLUE_ARROW: 'https://dash.b-cdn.net/icons/menu/blue_arrow_next.svg',
|
|
52
|
+
GREEN_ARROW: 'https://dash.b-cdn.net/icons/menu/green_arrow_next.svg',
|
|
52
53
|
REQUEST_EMAIL: 'https://dash.b-cdn.net/icons/menu/request_email.svg',
|
|
53
54
|
REQUEST_EMAIL_GREEN: 'https://dash.b-cdn.net/icons/menu/request_email_green.svg',
|
|
54
55
|
ADD_DETAIL: 'https://dash.b-cdn.net/icons/menu/add_detail.svg',
|
|
56
|
+
ADD_DETAIL_GREEN: 'https://dash.b-cdn.net/icons/menu/add_detail_green.svg',
|
|
55
57
|
SUCCESS: 'https://dash.b-cdn.net/icons/menu/image.png',
|
|
56
58
|
UNFINISHED: 'https://dash.b-cdn.net/icons/menu/not-finished.png',
|
|
57
59
|
ABSHER_LOGO: 'https://dash.b-cdn.net/icons/menu/Absher.svg',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
|
-
import {
|
|
2
|
+
import { FlowsTypes, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState, ActionState, User, IndividualPersonalInfoFormValues, IndividualEmailMobileFormValues, IndividualMobileFormValues, AsyncThunkParams } from '../../../@types';
|
|
3
3
|
import { CancelToken } from 'axios';
|
|
4
4
|
interface VerifyLeadTokenProps {
|
|
5
5
|
token: string;
|
|
@@ -17,7 +17,7 @@ export declare const verifyToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
17
17
|
name: any;
|
|
18
18
|
contact: any;
|
|
19
19
|
individuals: any;
|
|
20
|
-
countries: CountryCode[];
|
|
20
|
+
countries: import("../../../@types").CountryCode[];
|
|
21
21
|
countryCode: any;
|
|
22
22
|
notification: any;
|
|
23
23
|
business: any;
|
|
@@ -35,6 +35,9 @@ declare type AddDetailsParams = {
|
|
|
35
35
|
};
|
|
36
36
|
export declare const addDetailsAsync: import("@reduxjs/toolkit").AsyncThunk<{
|
|
37
37
|
userList: User[];
|
|
38
|
+
individualId: string;
|
|
39
|
+
countryCode: string;
|
|
40
|
+
countries: import("../../../@types").CountryCode[];
|
|
38
41
|
}, AddDetailsParams, {}>;
|
|
39
42
|
declare type RequestEmail = {
|
|
40
43
|
user: User;
|
|
@@ -54,7 +57,7 @@ declare type RetrieveIndividualInfoParams = {
|
|
|
54
57
|
export declare const retrieveIndividualInfo: import("@reduxjs/toolkit").AsyncThunk<{
|
|
55
58
|
data: any;
|
|
56
59
|
countryCode: string | undefined;
|
|
57
|
-
countries: CountryCode[];
|
|
60
|
+
countries: import("../../../@types").CountryCode[];
|
|
58
61
|
}, RetrieveIndividualInfoParams, {}>;
|
|
59
62
|
export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<{
|
|
60
63
|
sourceIncome: any;
|
|
@@ -78,7 +81,7 @@ export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
78
81
|
name: any;
|
|
79
82
|
contact: any;
|
|
80
83
|
individuals: any;
|
|
81
|
-
countries: CountryCode[];
|
|
84
|
+
countries: import("../../../@types").CountryCode[];
|
|
82
85
|
countryCode: any;
|
|
83
86
|
notification: any;
|
|
84
87
|
business: any;
|
|
@@ -71,7 +71,7 @@ import API from '../../../api';
|
|
|
71
71
|
import { FlowsTypes, IndividualGender, IndividualType, DocumentPurpose } from '../../../@types';
|
|
72
72
|
import { handleNextScreenStep, handlePrevScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
|
|
73
73
|
import { defaultCountry, IDENTIFICATION_TYPE, INDIVIDUAl_STEP_NAMES } from '../../../constants';
|
|
74
|
-
import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, hasNoneEditableValue, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose, formatNumberAsCurrency, removeAllCharsFromNumber } from '../../../utils';
|
|
74
|
+
import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, hasNoneEditableValue, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose, formatNumberAsCurrency, removeAllCharsFromNumber, mapUserList } from '../../../utils';
|
|
75
75
|
export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a, thunkApi) {
|
|
76
76
|
var token = _a.token, isInternally = _a.isInternally, isUpdatePhoneInfo = _a.isUpdatePhoneInfo;
|
|
77
77
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -215,29 +215,27 @@ export var resendOTP = createAsyncThunk('resendOTPIndividual', function (params,
|
|
|
215
215
|
});
|
|
216
216
|
}); });
|
|
217
217
|
export var addDetailsAsync = createAsyncThunk('individual/addDetailsAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
218
|
-
var settings, user, userList,
|
|
218
|
+
var settings, user, userList, birth, individual_id, countryCode;
|
|
219
219
|
return __generator(this, function (_a) {
|
|
220
220
|
switch (_a.label) {
|
|
221
221
|
case 0:
|
|
222
222
|
settings = thunkApi.getState().settings;
|
|
223
223
|
user = params.user, userList = params.userList;
|
|
224
|
-
|
|
224
|
+
birth = user.birth, individual_id = user.individual_id;
|
|
225
225
|
countryCode = (birth === null || birth === void 0 ? void 0 : birth.country) || settings.data.businessCountry.iso2;
|
|
226
226
|
if (!countryCode) return [3, 2];
|
|
227
227
|
return [4, thunkApi.dispatch(getCityList(countryCode))];
|
|
228
228
|
case 1:
|
|
229
229
|
_a.sent();
|
|
230
230
|
_a.label = 2;
|
|
231
|
-
case 2:
|
|
232
|
-
case 3:
|
|
233
|
-
_a.sent();
|
|
231
|
+
case 2:
|
|
234
232
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP')); });
|
|
235
|
-
return [2, { userList: userList }];
|
|
233
|
+
return [2, { userList: userList, individualId: individual_id, countryCode: settings.data.businessCountry.iso2, countries: settings.data.countries }];
|
|
236
234
|
}
|
|
237
235
|
});
|
|
238
236
|
}); });
|
|
239
237
|
export var requestDetailsByEmail = createAsyncThunk('individual/requestDetailsByEmail', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
240
|
-
var individual, _a, merchant_id, board_id, user, collectInfo, id,
|
|
238
|
+
var individual, _a, merchant_id, board_id, user, collectInfo, id, objects, ids, _b, resEmail, resPhone, isPhoneAndEmailAvailable, email, mobile, countryCode, hasContact, individualData, hasPhone, requestBody, data_2, list, payload, data;
|
|
241
239
|
var _c;
|
|
242
240
|
return __generator(this, function (_d) {
|
|
243
241
|
switch (_d.label) {
|
|
@@ -245,7 +243,7 @@ export var requestDetailsByEmail = createAsyncThunk('individual/requestDetailsBy
|
|
|
245
243
|
individual = thunkApi.getState().individual;
|
|
246
244
|
_a = individual.data.verify.responseBody || {}, merchant_id = _a.merchant_id, board_id = _a.board_id;
|
|
247
245
|
user = params.user, collectInfo = params.collectInfo;
|
|
248
|
-
id = user.id,
|
|
246
|
+
id = user.id, objects = user.objects, ids = user.ids;
|
|
249
247
|
_b = (user === null || user === void 0 ? void 0 : user.contact) || {}, resEmail = _b.email, resPhone = _b.phone;
|
|
250
248
|
isPhoneAndEmailAvailable = isValidEmail(resEmail) && (resPhone === null || resPhone === void 0 ? void 0 : resPhone.country_code) && (resPhone === null || resPhone === void 0 ? void 0 : resPhone.number);
|
|
251
249
|
email = collectInfo.email, mobile = collectInfo.mobile, countryCode = collectInfo.countryCode;
|
|
@@ -254,8 +252,7 @@ export var requestDetailsByEmail = createAsyncThunk('individual/requestDetailsBy
|
|
|
254
252
|
if (!(!isPhoneAndEmailAvailable && hasContact)) return [3, 2];
|
|
255
253
|
hasPhone = mobile && (countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix);
|
|
256
254
|
requestBody = {
|
|
257
|
-
|
|
258
|
-
type: type,
|
|
255
|
+
ids: (ids === null || ids === void 0 ? void 0 : ids.length) ? ids : [id],
|
|
259
256
|
contact: {
|
|
260
257
|
email: email,
|
|
261
258
|
phone: hasPhone
|
|
@@ -266,18 +263,11 @@ export var requestDetailsByEmail = createAsyncThunk('individual/requestDetailsBy
|
|
|
266
263
|
: undefined
|
|
267
264
|
}
|
|
268
265
|
};
|
|
269
|
-
return [4, API.individualService.
|
|
266
|
+
return [4, API.individualService.updateMultipleIndividual(requestBody)];
|
|
270
267
|
case 1:
|
|
271
268
|
data_2 = _d.sent();
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
individualData = data_2 === null || data_2 === void 0 ? void 0 : data_2.shareholder;
|
|
275
|
-
else if (type === IndividualType.BOARD_MEMBER)
|
|
276
|
-
individualData = data_2 === null || data_2 === void 0 ? void 0 : data_2.board_member;
|
|
277
|
-
else if (type === IndividualType.BUYER)
|
|
278
|
-
individualData = data_2 === null || data_2 === void 0 ? void 0 : data_2.buyer;
|
|
279
|
-
else if (type === IndividualType.CUSTOMER)
|
|
280
|
-
individualData = data_2 === null || data_2 === void 0 ? void 0 : data_2.customer;
|
|
269
|
+
list = mapUserList(data_2 === null || data_2 === void 0 ? void 0 : data_2.individuals);
|
|
270
|
+
individualData = (list === null || list === void 0 ? void 0 : list[0]) && __assign({}, list[0]);
|
|
281
271
|
_d.label = 2;
|
|
282
272
|
case 2:
|
|
283
273
|
payload = {
|
|
@@ -291,7 +281,7 @@ export var requestDetailsByEmail = createAsyncThunk('individual/requestDetailsBy
|
|
|
291
281
|
notification: {
|
|
292
282
|
recipient: {
|
|
293
283
|
id: id,
|
|
294
|
-
type:
|
|
284
|
+
type: (objects === null || objects === void 0 ? void 0 : objects[0]) || ''
|
|
295
285
|
},
|
|
296
286
|
channel: ['email']
|
|
297
287
|
}
|
|
@@ -299,14 +289,14 @@ export var requestDetailsByEmail = createAsyncThunk('individual/requestDetailsBy
|
|
|
299
289
|
return [4, API.boardService.requestDetailsByEmail(payload)];
|
|
300
290
|
case 3:
|
|
301
291
|
data = _d.sent();
|
|
302
|
-
return [2, { data: data, userData: __assign(
|
|
292
|
+
return [2, { data: data, userData: __assign({}, individualData) }];
|
|
303
293
|
}
|
|
304
294
|
});
|
|
305
295
|
}); });
|
|
306
296
|
export var getIndividualList = createAsyncThunk('individual/getIndividualList', function (businessId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
307
|
-
var payload,
|
|
308
|
-
return __generator(this, function (
|
|
309
|
-
switch (
|
|
297
|
+
var payload, individuals, list;
|
|
298
|
+
return __generator(this, function (_a) {
|
|
299
|
+
switch (_a.label) {
|
|
310
300
|
case 0:
|
|
311
301
|
payload = {
|
|
312
302
|
page: 1,
|
|
@@ -315,12 +305,9 @@ export var getIndividualList = createAsyncThunk('individual/getIndividualList',
|
|
|
315
305
|
};
|
|
316
306
|
return [4, API.individualService.getIndividualList(payload)];
|
|
317
307
|
case 1:
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
boardMemberList = (board_members || []).map(function (board_member) { return (__assign(__assign({}, board_member), { type: IndividualType.BOARD_MEMBER })); });
|
|
322
|
-
individualList = __spreadArray(__spreadArray(__spreadArray([], userList, true), shareHolderList, true), boardMemberList, true);
|
|
323
|
-
return [2, individualList];
|
|
308
|
+
individuals = (_a.sent()).individuals;
|
|
309
|
+
list = mapUserList(individuals) || [];
|
|
310
|
+
return [2, __spreadArray([], list, true)];
|
|
324
311
|
}
|
|
325
312
|
});
|
|
326
313
|
}); });
|
|
@@ -358,7 +345,11 @@ export var retrieveIndividualInfo = createAsyncThunk('individual/retrieveIndivid
|
|
|
358
345
|
individualData = data === null || data === void 0 ? void 0 : data.buyer;
|
|
359
346
|
else if (type === IndividualType.CUSTOMER)
|
|
360
347
|
individualData = data === null || data === void 0 ? void 0 : data.customer;
|
|
361
|
-
return [2, {
|
|
348
|
+
return [2, {
|
|
349
|
+
data: __assign(__assign({}, (individualData || {})), { objects: [type], individual_data_state: individualData === null || individualData === void 0 ? void 0 : individualData.data_state }),
|
|
350
|
+
countryCode: countryCode,
|
|
351
|
+
countries: settings.data.countries
|
|
352
|
+
}];
|
|
362
353
|
}
|
|
363
354
|
});
|
|
364
355
|
}); });
|
|
@@ -511,31 +502,30 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
|
|
|
511
502
|
export var updatePhoneInfo = createAsyncThunk('individual/updatePhoneInfo', function (_a, thunkApi) {
|
|
512
503
|
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
513
504
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
514
|
-
var individual, _b, token, responseBody,
|
|
515
|
-
var
|
|
516
|
-
return __generator(this, function (
|
|
517
|
-
switch (
|
|
505
|
+
var individual, _b, token, responseBody, id, mobile, countryCode, requestBody, data;
|
|
506
|
+
var _c;
|
|
507
|
+
return __generator(this, function (_d) {
|
|
508
|
+
switch (_d.label) {
|
|
518
509
|
case 0:
|
|
519
510
|
individual = thunkApi.getState().individual;
|
|
520
511
|
_b = individual.data.verify, token = _b.token, responseBody = _b.responseBody;
|
|
521
|
-
|
|
512
|
+
id = ((responseBody === null || responseBody === void 0 ? void 0 : responseBody.source) || {}).id;
|
|
522
513
|
mobile = formData.mobile, countryCode = formData.countryCode;
|
|
523
514
|
requestBody = {
|
|
524
|
-
|
|
525
|
-
type: type,
|
|
515
|
+
ids: [id],
|
|
526
516
|
contact: {
|
|
527
517
|
phone: {
|
|
528
|
-
country_code: (
|
|
518
|
+
country_code: (_c = countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix) === null || _c === void 0 ? void 0 : _c.toString(),
|
|
529
519
|
number: mobile || ''
|
|
530
520
|
}
|
|
531
521
|
}
|
|
532
522
|
};
|
|
533
|
-
return [4, API.individualService.
|
|
523
|
+
return [4, API.individualService.updateMultipleIndividual(requestBody)];
|
|
534
524
|
case 1:
|
|
535
|
-
data =
|
|
525
|
+
data = _d.sent();
|
|
536
526
|
return [4, thunkApi.dispatch(verifyToken({ token: token, isUpdatePhoneInfo: true }))];
|
|
537
527
|
case 2:
|
|
538
|
-
|
|
528
|
+
_d.sent();
|
|
539
529
|
return [2, { data: data, formData: originalFormData }];
|
|
540
530
|
}
|
|
541
531
|
});
|
|
@@ -544,14 +534,15 @@ export var updatePhoneInfo = createAsyncThunk('individual/updatePhoneInfo', func
|
|
|
544
534
|
export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateIndividualPersonalInfo', function (_a, thunkApi) {
|
|
545
535
|
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
546
536
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
547
|
-
var _b, settings, individual, _c, notification, user, entity, _d,
|
|
537
|
+
var _b, settings, individual, _c, notification, user, entity, id, _d, objects, ids, name, email, mobile, countryCode, gender, nid, issuedCountry, expiryDate, dob, placeOfBirthCountry, placeOfBirthCity, nationality, code, data_status, userName, identification_id_type, isGenderNonEditable, isNameENNonEditable, isNameARNonEditable, isEmailNonEditable, isMobileNumberNonEditable, isMobileCountryNonEditable, isNidNonEditable, isIssuedCountryNonEditable, isExpiryNonEditable, isIdTypeNonEditable, isNationalityNonEditable, isDOBNonEditable, isBirthCityNonEditable, isBirthCountryNonEditable, hasContact, hasPhone, hasIdentification, hasBirth, nameIsEditable, contact, requestBody, data;
|
|
548
538
|
var _e, _f, _g, _h, _j;
|
|
549
539
|
return __generator(this, function (_k) {
|
|
550
540
|
switch (_k.label) {
|
|
551
541
|
case 0:
|
|
552
542
|
_b = thunkApi.getState(), settings = _b.settings, individual = _b.individual;
|
|
553
543
|
_c = individual.data.verify.responseBody || {}, notification = _c.notification, user = _c.user, entity = _c.entity;
|
|
554
|
-
|
|
544
|
+
id = (((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : notification === null || notification === void 0 ? void 0 : notification.recipient) || {}).id;
|
|
545
|
+
_d = user || {}, objects = _d.objects, ids = _d.ids;
|
|
555
546
|
name = formData.name, email = formData.email, mobile = formData.mobile, countryCode = formData.countryCode, gender = formData.gender, nid = formData.nid, issuedCountry = formData.issuedCountry, expiryDate = formData.expiryDate, dob = formData.dob, placeOfBirthCountry = formData.placeOfBirthCountry, placeOfBirthCity = formData.placeOfBirthCity, nationality = formData.nationality;
|
|
556
547
|
code = entity === null || entity === void 0 ? void 0 : entity.country;
|
|
557
548
|
data_status = (user || {}).data_status;
|
|
@@ -573,7 +564,7 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
|
|
|
573
564
|
isBirthCountryNonEditable = hasNoneEditableValue(data_status, 'birth.country');
|
|
574
565
|
hasContact = email || mobile || countryCode;
|
|
575
566
|
hasPhone = mobile && (countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix);
|
|
576
|
-
hasIdentification = nid
|
|
567
|
+
hasIdentification = nid && (issuedCountry || identification_id_type || expiryDate);
|
|
577
568
|
hasBirth = placeOfBirthCity || placeOfBirthCountry;
|
|
578
569
|
nameIsEditable = userName.first && !(isNameENNonEditable && isNameARNonEditable);
|
|
579
570
|
contact = hasContact && !(isEmailNonEditable && isMobileCountryNonEditable && isMobileNumberNonEditable)
|
|
@@ -583,7 +574,7 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
|
|
|
583
574
|
number: isMobileNumberNonEditable || !mobile ? undefined : mobile
|
|
584
575
|
}
|
|
585
576
|
})) : undefined;
|
|
586
|
-
requestBody = __assign(__assign(__assign(__assign(__assign(__assign(__assign({
|
|
577
|
+
requestBody = __assign(__assign(__assign(__assign(__assign(__assign(__assign({ ids: (ids === null || ids === void 0 ? void 0 : ids.length) ? ids : [id], gender: isGenderNonEditable || !gender ? undefined : gender }, (nameIsEditable && {
|
|
587
578
|
names: {
|
|
588
579
|
en: isNameENNonEditable ? undefined : userName,
|
|
589
580
|
ar: isNameARNonEditable ? undefined : userName
|
|
@@ -619,10 +610,10 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
|
|
|
619
610
|
'date_of_birth',
|
|
620
611
|
'nationality'
|
|
621
612
|
], step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_PERSONAL_INFO });
|
|
622
|
-
return [4, API.individualService.
|
|
613
|
+
return [4, API.individualService.updateMultipleIndividual(requestBody)];
|
|
623
614
|
case 1:
|
|
624
615
|
data = _k.sent();
|
|
625
|
-
if (!(
|
|
616
|
+
if (!(objects === null || objects === void 0 ? void 0 : objects.includes(IndividualType.USER || IndividualType.BUYER))) return [3, 3];
|
|
626
617
|
return [4, thunkApi.dispatch(retrieveDataList(code))];
|
|
627
618
|
case 2:
|
|
628
619
|
_k.sent();
|
|
@@ -638,14 +629,15 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
|
|
|
638
629
|
export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (_a, thunkApi) {
|
|
639
630
|
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
640
631
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
641
|
-
var _b, settings, individual, _c, notification, user, _d,
|
|
632
|
+
var _b, settings, individual, _c, notification, user, id, _d, objects, ids, occupation, sourceIncome, monthlyIncome, isPEP, isInfluencer, shareCount, shareValue, civilID, signatureFileId, isOccupationNonEditable, isSourceIncomeNonEditable, isPEPNonEditable, isInfluencerNonEditable, isMonthlyIncomeNonEditable, isSharesAvailable, pepInfo, influencerInfo, occupationInfo, sourceIncomeInfo, monthlyIncomeInfo, userPayload, shareHolderPayload, boardMemberPayload, buyerMemberPayload, payload, requestBody, data, businessCountry, hasCivilIdDocument, hasSignatureDocument, isSendSignatureFile, civilIdDocument, signatureDocument, documentBody, documentBody, documentsList, documentBody;
|
|
642
633
|
var _e, _f;
|
|
643
634
|
return __generator(this, function (_g) {
|
|
644
635
|
switch (_g.label) {
|
|
645
636
|
case 0:
|
|
646
637
|
_b = thunkApi.getState(), settings = _b.settings, individual = _b.individual;
|
|
647
638
|
_c = individual.data.verify.responseBody || {}, notification = _c.notification, user = _c.user;
|
|
648
|
-
|
|
639
|
+
id = (((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : notification === null || notification === void 0 ? void 0 : notification.recipient) || {}).id;
|
|
640
|
+
_d = user || {}, objects = _d.objects, ids = _d.ids;
|
|
649
641
|
occupation = formData.occupation, sourceIncome = formData.sourceIncome, monthlyIncome = formData.monthlyIncome, isPEP = formData.isPEP, isInfluencer = formData.isInfluencer, shareCount = formData.shareCount, shareValue = formData.shareValue, civilID = formData.civilID, signatureFileId = formData.signatureFileId;
|
|
650
642
|
isOccupationNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'occupation');
|
|
651
643
|
isSourceIncomeNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'source_of_income');
|
|
@@ -683,22 +675,17 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
|
|
|
683
675
|
monthly_income: monthlyIncomeInfo
|
|
684
676
|
};
|
|
685
677
|
payload = userPayload;
|
|
686
|
-
if (
|
|
687
|
-
payload = shareHolderPayload;
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
payload = buyerMemberPayload;
|
|
692
|
-
if (type === IndividualType.CUSTOMER)
|
|
693
|
-
payload = {};
|
|
694
|
-
requestBody = __assign(__assign({ id: id, type: type }, payload), { encryption_contract: [], step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO });
|
|
695
|
-
return [4, API.individualService.updateIndividual(requestBody)];
|
|
678
|
+
if (objects === null || objects === void 0 ? void 0 : objects.length) {
|
|
679
|
+
payload = __assign(__assign(__assign(__assign(__assign({}, (objects.includes(IndividualType.USER) && payload)), (objects.includes(IndividualType.SHARE_HOLDER) && shareHolderPayload)), (objects.includes(IndividualType.BOARD_MEMBER) && boardMemberPayload)), (objects.includes(IndividualType.BUYER) && buyerMemberPayload)), (objects.includes(IndividualType.CUSTOMER) && {}));
|
|
680
|
+
}
|
|
681
|
+
requestBody = __assign(__assign({ ids: (ids === null || ids === void 0 ? void 0 : ids.length) ? ids : [id] }, payload), { encryption_contract: [], step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO });
|
|
682
|
+
return [4, API.individualService.updateMultipleIndividual(requestBody)];
|
|
696
683
|
case 1:
|
|
697
684
|
data = _g.sent();
|
|
698
685
|
businessCountry = settings.data.businessCountry;
|
|
699
686
|
hasCivilIdDocument = (civilID || []).length > 0;
|
|
700
687
|
hasSignatureDocument = (signatureFileId || []).length > 0;
|
|
701
|
-
isSendSignatureFile = (user === null || user === void 0 ? void 0 : user.is_authorized) && (
|
|
688
|
+
isSendSignatureFile = (user === null || user === void 0 ? void 0 : user.is_authorized) && (objects === null || objects === void 0 ? void 0 : objects.includes(IndividualType.USER || IndividualType.BUYER));
|
|
702
689
|
civilIdDocument = getRecentDocumentBasedOnPurpose(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.IDENTITY_DOCUMENT);
|
|
703
690
|
signatureDocument = getRecentDocumentBasedOnPurpose(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.CUSTOMER_SIGNATURE);
|
|
704
691
|
if (!((civilIdDocument === null || civilIdDocument === void 0 ? void 0 : civilIdDocument.id) && hasCivilIdDocument)) return [3, 3];
|
|
@@ -728,7 +715,7 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
|
|
|
728
715
|
documentsList.push({ type: DocumentPurpose.CUSTOMER_SIGNATURE, images: signatureFileId });
|
|
729
716
|
if (!(documentsList.length > 0)) return [3, 7];
|
|
730
717
|
documentBody = {
|
|
731
|
-
individual_type_id: id || '',
|
|
718
|
+
individual_type_id: ((ids === null || ids === void 0 ? void 0 : ids.length) ? ids.find(function (i) { return i.includes('usr_'); }) : id) || '',
|
|
732
719
|
country: businessCountry.iso2,
|
|
733
720
|
documents: documentsList
|
|
734
721
|
};
|
|
@@ -837,7 +824,6 @@ var initialState = {
|
|
|
837
824
|
sourceIncome: undefined,
|
|
838
825
|
monthlyIncome: undefined,
|
|
839
826
|
employerName: '',
|
|
840
|
-
employerLocation: undefined,
|
|
841
827
|
isPEP: null,
|
|
842
828
|
isInfluencer: null,
|
|
843
829
|
shareCount: '',
|
|
@@ -939,10 +925,74 @@ export var individualSlice = createSlice({
|
|
|
939
925
|
state.error = null;
|
|
940
926
|
})
|
|
941
927
|
.addCase(addDetailsAsync.fulfilled, function (state, action) {
|
|
928
|
+
var _a, _b, _c, _d;
|
|
942
929
|
state.loading = false;
|
|
943
930
|
state.error = null;
|
|
944
|
-
var
|
|
931
|
+
var _e = action.payload, userList = _e.userList, individualId = _e.individualId, countries = _e.countries;
|
|
932
|
+
var primaryUser = (state.data.verify.responseBody || {}).user;
|
|
933
|
+
var user = (userList || []).find(function (user) { return user.individual_id === individualId; });
|
|
945
934
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { userList: userList });
|
|
935
|
+
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { userList: userList, user: __assign(__assign({}, user), { is_authorized: (user === null || user === void 0 ? void 0 : user.is_authorized) !== undefined ? user === null || user === void 0 ? void 0 : user.is_authorized : primaryUser === null || primaryUser === void 0 ? void 0 : primaryUser.is_authorized }) });
|
|
936
|
+
var _f = user || {}, source_income = _f.source_income, monthly_income = _f.monthly_income, occupation = _f.occupation, is_relative_PEP = _f.is_relative_PEP, is_influencer = _f.is_influencer, birth = _f.birth, contact = _f.contact, identification = _f.identification, nationality = _f.nationality, gender = _f.gender, shares = _f.shares;
|
|
937
|
+
var _g = state.data.individualData.responseBody || {}, sourceIncomeList = _g.sourceIncomeList, monthlyIncomeList = _g.monthlyIncomeList, occupationList = _g.occupationList;
|
|
938
|
+
var cityList = (state.data.verify.responseBody || {}).cityList;
|
|
939
|
+
if (user)
|
|
940
|
+
state.data.individualPersonalData.name = getUserName(user, false);
|
|
941
|
+
if (contact === null || contact === void 0 ? void 0 : contact.email)
|
|
942
|
+
state.data.individualPersonalData.email = contact === null || contact === void 0 ? void 0 : contact.email;
|
|
943
|
+
if ((_a = contact === null || contact === void 0 ? void 0 : contact.phone) === null || _a === void 0 ? void 0 : _a.number)
|
|
944
|
+
state.data.individualPersonalData.mobile = (_b = contact === null || contact === void 0 ? void 0 : contact.phone) === null || _b === void 0 ? void 0 : _b.number;
|
|
945
|
+
if ((_c = contact === null || contact === void 0 ? void 0 : contact.phone) === null || _c === void 0 ? void 0 : _c.country_code) {
|
|
946
|
+
state.data.individualPersonalData.countryCode = findCountryByIddPrefix(countries, (_d = contact === null || contact === void 0 ? void 0 : contact.phone) === null || _d === void 0 ? void 0 : _d.country_code) || defaultCountry;
|
|
947
|
+
}
|
|
948
|
+
if (gender)
|
|
949
|
+
state.data.individualPersonalData.gender = gender.toLowerCase();
|
|
950
|
+
if (identification === null || identification === void 0 ? void 0 : identification.id)
|
|
951
|
+
state.data.individualPersonalData.nid = identification === null || identification === void 0 ? void 0 : identification.id;
|
|
952
|
+
if (identification === null || identification === void 0 ? void 0 : identification.issued_country_code) {
|
|
953
|
+
state.data.individualPersonalData.issuedCountry = findCountryByIso2(countries, identification === null || identification === void 0 ? void 0 : identification.issued_country_code);
|
|
954
|
+
}
|
|
955
|
+
var expiryDate = new Date((identification === null || identification === void 0 ? void 0 : identification.expiry) || new Date().getTime());
|
|
956
|
+
state.data.individualPersonalData.expiryDate = convertNumbers2English(dateFormat(expiryDate));
|
|
957
|
+
if (birth === null || birth === void 0 ? void 0 : birth.date)
|
|
958
|
+
state.data.individualPersonalData.dob = convertNumbers2English(dateFormat(new Date(birth === null || birth === void 0 ? void 0 : birth.date)));
|
|
959
|
+
if (birth === null || birth === void 0 ? void 0 : birth.country) {
|
|
960
|
+
state.data.individualPersonalData.placeOfBirthCountry = findCountryByIso2(countries, birth === null || birth === void 0 ? void 0 : birth.country);
|
|
961
|
+
}
|
|
962
|
+
if (birth === null || birth === void 0 ? void 0 : birth.city) {
|
|
963
|
+
var selectedCity = cityList === null || cityList === void 0 ? void 0 : cityList.find(function (city) {
|
|
964
|
+
var _a;
|
|
965
|
+
return city.id === ((_a = birth === null || birth === void 0 ? void 0 : birth.city) === null || _a === void 0 ? void 0 : _a.cityId);
|
|
966
|
+
});
|
|
967
|
+
state.data.individualPersonalData.placeOfBirthCity = selectedCity;
|
|
968
|
+
}
|
|
969
|
+
if (nationality) {
|
|
970
|
+
state.data.individualPersonalData.nationality = findCountryByIso2(countries, nationality);
|
|
971
|
+
}
|
|
972
|
+
var _h = shares || {}, count = _h.count, value = _h.value;
|
|
973
|
+
var shareCount = count === null || count === void 0 ? void 0 : count.toString();
|
|
974
|
+
var shareValue = value === null || value === void 0 ? void 0 : value.toString();
|
|
975
|
+
if (shareCount) {
|
|
976
|
+
state.data.individualData.shareCount = shareCount;
|
|
977
|
+
}
|
|
978
|
+
if (shareValue) {
|
|
979
|
+
state.data.individualData.shareValue = formatNumberAsCurrency(shareValue);
|
|
980
|
+
}
|
|
981
|
+
var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a; return (source === null || source === void 0 ? void 0 : source.id) === ((_a = source_income === null || source_income === void 0 ? void 0 : source_income[0]) === null || _a === void 0 ? void 0 : _a.id); })) || (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
|
|
982
|
+
if (!!selectedSourceIncome)
|
|
983
|
+
state.data.individualData.sourceIncome = selectedSourceIncome;
|
|
984
|
+
var selectedMonthlyIncome = monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) {
|
|
985
|
+
return income.id === (monthly_income === null || monthly_income === void 0 ? void 0 : monthly_income.id);
|
|
986
|
+
});
|
|
987
|
+
var selectedOccupation = occupationList === null || occupationList === void 0 ? void 0 : occupationList.find(function (occup) {
|
|
988
|
+
return occup.id === (occupation === null || occupation === void 0 ? void 0 : occupation.id);
|
|
989
|
+
});
|
|
990
|
+
state.data.individualData.monthlyIncome = selectedMonthlyIncome;
|
|
991
|
+
state.data.individualData.occupation = selectedOccupation;
|
|
992
|
+
if (is_relative_PEP !== undefined)
|
|
993
|
+
state.data.individualData.isPEP = is_relative_PEP;
|
|
994
|
+
if (is_influencer !== undefined)
|
|
995
|
+
state.data.individualData.isInfluencer = is_influencer;
|
|
946
996
|
})
|
|
947
997
|
.addCase(addDetailsAsync.rejected, function (state, action) {
|
|
948
998
|
state.loading = false;
|
|
@@ -975,10 +1025,10 @@ export var individualSlice = createSlice({
|
|
|
975
1025
|
.addCase(retrieveIndividualInfo.fulfilled, function (state, action) {
|
|
976
1026
|
var _a, _b, _c, _d;
|
|
977
1027
|
state.error = null;
|
|
978
|
-
var _e = action.payload, data = _e.data, countries = _e.countries
|
|
1028
|
+
var _e = action.payload, data = _e.data, countries = _e.countries;
|
|
979
1029
|
var user = (state.data.verify.responseBody || {}).user;
|
|
980
1030
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { user: __assign(__assign({}, data), { is_authorized: data.is_authorized !== undefined ? data.is_authorized : user === null || user === void 0 ? void 0 : user.is_authorized }) });
|
|
981
|
-
var _f = data || {}, source_income = _f.source_income, monthly_income = _f.monthly_income, occupation = _f.occupation, is_relative_PEP = _f.is_relative_PEP, is_influencer = _f.is_influencer, birth = _f.birth, contact = _f.contact, identification = _f.identification, nationality = _f.nationality, gender = _f.gender,
|
|
1031
|
+
var _f = data || {}, source_income = _f.source_income, monthly_income = _f.monthly_income, occupation = _f.occupation, is_relative_PEP = _f.is_relative_PEP, is_influencer = _f.is_influencer, birth = _f.birth, contact = _f.contact, identification = _f.identification, nationality = _f.nationality, gender = _f.gender, shares = _f.shares;
|
|
982
1032
|
var _g = state.data.individualData.responseBody || {}, sourceIncomeList = _g.sourceIncomeList, monthlyIncomeList = _g.monthlyIncomeList, occupationList = _g.occupationList;
|
|
983
1033
|
var cityList = (state.data.verify.responseBody || {}).cityList;
|
|
984
1034
|
if (data)
|
|
@@ -994,7 +1044,6 @@ export var individualSlice = createSlice({
|
|
|
994
1044
|
state.data.individualPersonalData.gender = gender.toLowerCase();
|
|
995
1045
|
if (identification === null || identification === void 0 ? void 0 : identification.id)
|
|
996
1046
|
state.data.individualPersonalData.nid = identification === null || identification === void 0 ? void 0 : identification.id;
|
|
997
|
-
state.data.individualPersonalData.issuedCountry = identification === null || identification === void 0 ? void 0 : identification.issued_country_code;
|
|
998
1047
|
if (identification === null || identification === void 0 ? void 0 : identification.issued_country_code) {
|
|
999
1048
|
state.data.individualPersonalData.issuedCountry = findCountryByIso2(countries, identification === null || identification === void 0 ? void 0 : identification.issued_country_code);
|
|
1000
1049
|
}
|
|
@@ -1027,11 +1076,6 @@ export var individualSlice = createSlice({
|
|
|
1027
1076
|
var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a; return (source === null || source === void 0 ? void 0 : source.id) === ((_a = source_income === null || source_income === void 0 ? void 0 : source_income[0]) === null || _a === void 0 ? void 0 : _a.id); })) || (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
|
|
1028
1077
|
if (!!selectedSourceIncome)
|
|
1029
1078
|
state.data.individualData.sourceIncome = selectedSourceIncome;
|
|
1030
|
-
var code = employer_country || countryCode;
|
|
1031
|
-
if (!!code) {
|
|
1032
|
-
var employerLocation = (countries || []).find(function (country) { return country.iso2 === code; });
|
|
1033
|
-
state.data.individualData.employerLocation = employerLocation;
|
|
1034
|
-
}
|
|
1035
1079
|
var selectedMonthlyIncome = monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) {
|
|
1036
1080
|
return income.id === (monthly_income === null || monthly_income === void 0 ? void 0 : monthly_income.id);
|
|
1037
1081
|
});
|
|
@@ -1102,10 +1146,10 @@ export var individualSlice = createSlice({
|
|
|
1102
1146
|
var cityList = action.payload;
|
|
1103
1147
|
state.data.verify.responseBody = __assign(__assign({}, data), { cityList: cityList });
|
|
1104
1148
|
var birth = (((_a = state.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.user) || {}).birth;
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
return
|
|
1149
|
+
if (birth === null || birth === void 0 ? void 0 : birth.city) {
|
|
1150
|
+
var selectedCity = cityList === null || cityList === void 0 ? void 0 : cityList.find(function (city) {
|
|
1151
|
+
var _a;
|
|
1152
|
+
return city.id === ((_a = birth === null || birth === void 0 ? void 0 : birth.city) === null || _a === void 0 ? void 0 : _a.cityId);
|
|
1109
1153
|
});
|
|
1110
1154
|
state.data.individualPersonalData.placeOfBirthCity = selectedCity;
|
|
1111
1155
|
}
|
package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js
CHANGED
|
@@ -60,16 +60,15 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
60
60
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
61
61
|
var verify = data.verify;
|
|
62
62
|
var user = (verify.responseBody || {}).user;
|
|
63
|
-
var _d = data.individualData, occupation = _d.occupation, sourceIncome = _d.sourceIncome, monthlyIncome = _d.monthlyIncome, employerName = _d.employerName,
|
|
64
|
-
var _e = user || {},
|
|
63
|
+
var _d = data.individualData, occupation = _d.occupation, sourceIncome = _d.sourceIncome, monthlyIncome = _d.monthlyIncome, employerName = _d.employerName, isPEP = _d.isPEP, isInfluencer = _d.isInfluencer, civilID = _d.civilID, signatureFileId = _d.signatureFileId, civilIDUploading = _d.civilIDUploading, signatureFileUploading = _d.signatureFileUploading, shareCount = _d.shareCount, shareValue = _d.shareValue;
|
|
64
|
+
var _e = user || {}, documents = _e.documents, is_authorized = _e.is_authorized, data_status = _e.data_status, data_verification = _e.data_verification, names = _e.names, role = _e.role, occupationRes = _e.occupation, is_relative_PEP = _e.is_relative_PEP, is_influencer = _e.is_influencer, objects = _e.objects;
|
|
65
65
|
var methods = useForm({
|
|
66
|
-
resolver: yupResolver(IndividualInfoValidationSchema(
|
|
66
|
+
resolver: yupResolver(IndividualInfoValidationSchema(objects)),
|
|
67
67
|
defaultValues: {
|
|
68
68
|
occupation: occupation,
|
|
69
69
|
sourceIncome: sourceIncome,
|
|
70
70
|
monthlyIncome: monthlyIncome,
|
|
71
71
|
employerName: employerName,
|
|
72
|
-
employerLocation: employerLocation,
|
|
73
72
|
isPEP: isPEP,
|
|
74
73
|
isInfluencer: isInfluencer,
|
|
75
74
|
civilID: civilID,
|
|
@@ -116,31 +115,33 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
116
115
|
setListActive(flag);
|
|
117
116
|
};
|
|
118
117
|
var getUserName = function () {
|
|
119
|
-
var _a, _b;
|
|
120
|
-
var
|
|
118
|
+
var _a, _b, _c, _d;
|
|
119
|
+
var firstName = isAr ? (_a = names === null || names === void 0 ? void 0 : names.ar) === null || _a === void 0 ? void 0 : _a.first : (_b = names === null || names === void 0 ? void 0 : names.en) === null || _b === void 0 ? void 0 : _b.first;
|
|
120
|
+
var lastName = isAr ? (_c = names === null || names === void 0 ? void 0 : names.ar) === null || _c === void 0 ? void 0 : _c.last : (_d = names === null || names === void 0 ? void 0 : names.en) === null || _d === void 0 ? void 0 : _d.last;
|
|
121
|
+
var name = firstName && lastName ? "".concat(firstName, " ").concat(lastName) : firstName;
|
|
121
122
|
return name;
|
|
122
123
|
};
|
|
123
124
|
var getUserRole = function () {
|
|
124
125
|
var _a, _b, _c, _d;
|
|
125
126
|
if (((role === null || role === void 0 ? void 0 : role.length) || 0) > 0)
|
|
126
127
|
return isAr ? (_b = (_a = user.role[0]) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.ar : (_d = (_c = user.role[0]) === null || _c === void 0 ? void 0 : _c.name) === null || _d === void 0 ? void 0 : _d.en;
|
|
127
|
-
if (
|
|
128
|
+
if (objects === null || objects === void 0 ? void 0 : objects.includes(IndividualType.SHARE_HOLDER))
|
|
128
129
|
return t('type_share_holder');
|
|
129
|
-
if (
|
|
130
|
+
if (objects === null || objects === void 0 ? void 0 : objects.includes(IndividualType.BOARD_MEMBER))
|
|
130
131
|
return t('type_board_member');
|
|
131
132
|
return t('type_user');
|
|
132
133
|
};
|
|
133
|
-
var showSignatureFile =
|
|
134
|
-
var showOccupationFile =
|
|
135
|
-
var showSourceOfIncome =
|
|
136
|
-
var showIsPEP =
|
|
137
|
-
var showIsInfluencer =
|
|
138
|
-
var showShares =
|
|
134
|
+
var showSignatureFile = objects === null || objects === void 0 ? void 0 : objects.includes(IndividualType.USER || IndividualType.BUYER);
|
|
135
|
+
var showOccupationFile = objects === null || objects === void 0 ? void 0 : objects.includes(IndividualType.USER || IndividualType.BUYER);
|
|
136
|
+
var showSourceOfIncome = objects === null || objects === void 0 ? void 0 : objects.includes(IndividualType.USER || IndividualType.BUYER);
|
|
137
|
+
var showIsPEP = objects === null || objects === void 0 ? void 0 : objects.includes(IndividualType.USER || IndividualType.BOARD_MEMBER);
|
|
138
|
+
var showIsInfluencer = objects === null || objects === void 0 ? void 0 : objects.includes(IndividualType.USER || IndividualType.BOARD_MEMBER);
|
|
139
|
+
var showShares = objects === null || objects === void 0 ? void 0 : objects.includes(IndividualType.SHARE_HOLDER);
|
|
139
140
|
var isSourceOfIncomeListActive = listActive === ListType.SourceOfIncomeList;
|
|
140
141
|
var isMonthlyIncomeListActive = listActive === ListType.MonthlyIncomeList;
|
|
141
142
|
var isOccupationListActive = listActive === ListType.OccupationList;
|
|
142
143
|
var disabled = !methods.formState.isValid || civilIDUploading || signatureFileUploading;
|
|
143
|
-
return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: !listActive && !!is_authorized, timeout: 500 }, { children:
|
|
144
|
+
return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: !listActive && !!is_authorized, timeout: 500 }, { children: _jsx(TextBoxStyled, { children: getUserName() || '' }) })), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Occupation, { isVerified: isOccupationVerified, readOnly: readOnly['occupation'] || noneEditable['occupation'], onListOpen: function () { return handleMenuClick(ListType.OccupationList); }, onListClose: function () { return handleMenuClick(); }, show: showOccupationFile && !isMonthlyIncomeListActive && !isSourceOfIncomeListActive }), _jsx(SourceOfIncome, { readOnly: readOnly['sourceIncome'] || noneEditable['source_of_income'], onListOpen: function () { return handleMenuClick(ListType.SourceOfIncomeList); }, onListClose: function () { return handleMenuClick(); }, show: showSourceOfIncome && !isMonthlyIncomeListActive && !isOccupationListActive }), _jsx(MonthlyIncome, { readOnly: readOnly['monthlyIncome'] || noneEditable['monthly_income'], show: showSourceOfIncome && !isSourceOfIncomeListActive && !isOccupationListActive, onListOpen: function () { return handleMenuClick(ListType.MonthlyIncomeList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(ShareCount, { show: !listActive && showShares, readOnly: readOnly['shareCount'] }), _jsx(ShareValue, { show: !listActive && showShares, readOnly: readOnly['shareValue'] }), _jsxs(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: [_jsx(CivilIDFile, { show: !isSACountry, readOnly: readOnly['civilID'], defaultFiles: defaultCivilIdFiles }), _jsx(SignatureFile, { show: is_authorized && showSignatureFile, readOnly: readOnly['signatureFileId'], defaultFiles: defaultSignatureFiles })] })), _jsx(PEPSwitch, { show: showIsPEP && !listActive, readOnly: readOnly['isPEP'] || noneEditable['is_relative_PEP'], isVerified: isPEPSwitchVerified }), _jsx(InfluencerSwitch, { show: showIsInfluencer && !listActive, readOnly: readOnly['isInfluencer'] || noneEditable['is_influencer'], isVerified: isInfluencerSwitchVerified })] }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) }))] }));
|
|
144
145
|
};
|
|
145
146
|
export default React.memo(AdditionalIndividualInfo);
|
|
146
147
|
AdditionalIndividualInfo.defaultProps = {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
import { IndividualType } from '../../../../@types';
|
|
3
|
-
export declare const IndividualInfoValidationSchema: (
|
|
3
|
+
export declare const IndividualInfoValidationSchema: (objects: Array<IndividualType>) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
4
4
|
occupation: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
5
5
|
sourceIncome: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
6
6
|
monthlyIncome: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
7
7
|
civilID: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
8
8
|
signatureFileId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
9
|
-
isPEP: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
10
|
-
isInfluencer: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
9
|
+
isPEP: yup.BooleanSchema<boolean | null | undefined, import("yup/lib/types").AnyObject, boolean | null | undefined>;
|
|
10
|
+
isInfluencer: yup.BooleanSchema<boolean | null | undefined, import("yup/lib/types").AnyObject, boolean | null | undefined>;
|
|
11
11
|
shareCount: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
12
12
|
shareValue: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
13
13
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
@@ -16,8 +16,8 @@ export declare const IndividualInfoValidationSchema: (type: IndividualType) => y
|
|
|
16
16
|
monthlyIncome: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
17
17
|
civilID: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
18
18
|
signatureFileId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
19
|
-
isPEP: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
20
|
-
isInfluencer: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
19
|
+
isPEP: yup.BooleanSchema<boolean | null | undefined, import("yup/lib/types").AnyObject, boolean | null | undefined>;
|
|
20
|
+
isInfluencer: yup.BooleanSchema<boolean | null | undefined, import("yup/lib/types").AnyObject, boolean | null | undefined>;
|
|
21
21
|
shareCount: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
22
22
|
shareValue: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
23
23
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
@@ -26,8 +26,8 @@ export declare const IndividualInfoValidationSchema: (type: IndividualType) => y
|
|
|
26
26
|
monthlyIncome: import("yup/lib/object").OptionalObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
27
27
|
civilID: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
28
28
|
signatureFileId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
|
|
29
|
-
isPEP: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
30
|
-
isInfluencer: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
29
|
+
isPEP: yup.BooleanSchema<boolean | null | undefined, import("yup/lib/types").AnyObject, boolean | null | undefined>;
|
|
30
|
+
isInfluencer: yup.BooleanSchema<boolean | null | undefined, import("yup/lib/types").AnyObject, boolean | null | undefined>;
|
|
31
31
|
shareCount: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
32
32
|
shareValue: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
33
33
|
}>>>;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
import { IndividualType } from '../../../../@types';
|
|
3
|
-
export var IndividualInfoValidationSchema = function (
|
|
3
|
+
export var IndividualInfoValidationSchema = function (objects) {
|
|
4
|
+
var isUserType = !!(objects === null || objects === void 0 ? void 0 : objects.find(function (type) { return type === IndividualType.USER; }));
|
|
4
5
|
return yup.object().shape({
|
|
5
|
-
occupation:
|
|
6
|
-
sourceIncome:
|
|
6
|
+
occupation: isUserType ? yup.object().required('alert_choose_occupation') : yup.object().optional(),
|
|
7
|
+
sourceIncome: isUserType ? yup.object().required('choose_any_source_of_income') : yup.object().optional(),
|
|
7
8
|
monthlyIncome: yup.object().optional(),
|
|
8
9
|
civilID: yup.array().optional(),
|
|
9
10
|
signatureFileId: yup.array().optional(),
|
|
10
|
-
isPEP:
|
|
11
|
-
isInfluencer:
|
|
11
|
+
isPEP: isUserType ? yup.boolean().required('please_choose_relative_pep') : yup.boolean().optional().nullable(),
|
|
12
|
+
isInfluencer: isUserType ? yup.boolean().required('please_choose_are_you_influncer') : yup.boolean().optional().nullable(),
|
|
12
13
|
shareCount: yup.string().optional(),
|
|
13
14
|
shareValue: yup.string().optional()
|
|
14
15
|
});
|
|
@@ -157,20 +157,23 @@ var UserList = function (_a) {
|
|
|
157
157
|
return (activeUser === null || activeUser === void 0 ? void 0 : activeUser.id) === user.id;
|
|
158
158
|
};
|
|
159
159
|
var isSameUserRequestedBefore = function (user) {
|
|
160
|
-
var _a;
|
|
161
|
-
return (user === null || user === void 0 ? void 0 : user.
|
|
160
|
+
var _a, _b;
|
|
161
|
+
return (_a = user === null || user === void 0 ? void 0 : user.ids) === null || _a === void 0 ? void 0 : _a.includes((_b = notification === null || notification === void 0 ? void 0 : notification.recipient) === null || _b === void 0 ? void 0 : _b.id);
|
|
162
|
+
};
|
|
163
|
+
var getUserStatus = function (user) {
|
|
164
|
+
return user === null || user === void 0 ? void 0 : user.individual_data_state;
|
|
162
165
|
};
|
|
163
166
|
var isPhoneAndEmailAvailable = function (user) {
|
|
164
167
|
var _a = (user === null || user === void 0 ? void 0 : user.contact) || { email: '' }, resEmail = _a.email, phone = _a.phone;
|
|
165
168
|
return !!(isValidEmail(resEmail) && (phone === null || phone === void 0 ? void 0 : phone.country_code) && (phone === null || phone === void 0 ? void 0 : phone.number));
|
|
166
169
|
};
|
|
167
170
|
var getUserRole = function (user) {
|
|
168
|
-
var _a, _b, _c, _d, _e;
|
|
171
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
169
172
|
if ((((_a = user === null || user === void 0 ? void 0 : user.role) === null || _a === void 0 ? void 0 : _a.length) || 0) > 0)
|
|
170
173
|
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;
|
|
171
|
-
if ((user === null || user === void 0 ? void 0 : user.
|
|
174
|
+
if ((_f = user === null || user === void 0 ? void 0 : user.objects) === null || _f === void 0 ? void 0 : _f.includes(IndividualType.SHARE_HOLDER))
|
|
172
175
|
return t('type_share_holder');
|
|
173
|
-
if ((user === null || user === void 0 ? void 0 : user.
|
|
176
|
+
if ((_g = user === null || user === void 0 ? void 0 : user.objects) === null || _g === void 0 ? void 0 : _g.includes(IndividualType.BOARD_MEMBER))
|
|
174
177
|
return t('type_board_member');
|
|
175
178
|
return t('type_user');
|
|
176
179
|
};
|
|
@@ -185,7 +188,8 @@ var UserList = function (_a) {
|
|
|
185
188
|
return (_jsx(ScreenContainerStyled, { children: usersMenuList.map(function (user, index) {
|
|
186
189
|
return (_jsxs(Box, __assign({ sx: index !== usersMenuList.length - 1 ? { borderBottom: "1px solid ".concat(alpha(theme.palette.divider, 0.8)) } : {} }, { children: [_jsxs(TextBoxStyled, __assign({ sx: {
|
|
187
190
|
cursor: emailChecking ? 'default' : 'pointer'
|
|
188
|
-
}, onClick: !!anchorEl && isActiveUser(user) ? function () { return onCloseUserAction(); } : function (e) { return onClickUser(user, e); } }, { children: [
|
|
191
|
+
}, onClick: !!anchorEl && isActiveUser(user) ? function () { return onCloseUserAction(); } : function (e) { return onClickUser(user, e); } }, { children: [_jsx(TextStyled, { children: _jsx("span", { children: getName(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(IndividualActionButtons, { isAr: isAr, addDetails: {
|
|
192
|
+
status: getUserStatus(user),
|
|
189
193
|
title: t('add_details'),
|
|
190
194
|
onClick: onAddDetails,
|
|
191
195
|
loading: isActiveUser(user) && loading && type === IndividualRequestType.ADD
|
|
@@ -18,7 +18,6 @@ import { handleCurrentActiveScreen, handlePrevScreenStep, settingsSelector } fro
|
|
|
18
18
|
import Box from '@mui/material/Box';
|
|
19
19
|
import { alpha, styled } from '@mui/material/styles';
|
|
20
20
|
import { useAppDispatch, useAppSelector, useSetFromDefaultValues, useLanguage, useFormReadOnly, useDataNoneEditable, useFormErrorAndUpdateReadOnly, useExcludeReadOnlyFelids, useDataVerified } from '../../../../hooks';
|
|
21
|
-
import { IndividualType } from '../../../../@types';
|
|
22
21
|
import { convertToEnglishDateFormat, getUserName } from '../../../../utils';
|
|
23
22
|
import Form from '../../../../components/Form';
|
|
24
23
|
import Collapse from '../../../../components/Collapse';
|
|
@@ -38,10 +37,6 @@ import ExpiryDate from './ExpiryDate';
|
|
|
38
37
|
import BirthCountry from './BirthCountry';
|
|
39
38
|
import Nationality from './Nationality';
|
|
40
39
|
import BirthCity from './BirthCity';
|
|
41
|
-
var TextBoxStyled = styled(Box)(function (_a) {
|
|
42
|
-
var theme = _a.theme;
|
|
43
|
-
return (__assign(__assign({ display: 'flex', justifyContent: 'center', flexDirection: 'row', padding: theme.spacing(1.8, 2.5, 1.8, 2.5) }, theme.typography.body1), { lineHeight: theme.spacing(2.5), color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightMedium }));
|
|
44
|
-
});
|
|
45
40
|
export var RoleTextStyled = styled(Text)(function (_a) {
|
|
46
41
|
var theme = _a.theme;
|
|
47
42
|
return (__assign(__assign({}, theme.typography.body1), { display: 'inline', paddingInlineStart: theme.spacing(1.5), color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }));
|
|
@@ -65,7 +60,7 @@ var IndividualPersonalInfo = function (_a) {
|
|
|
65
60
|
var verify = data.verify, individualPersonalData = data.individualPersonalData;
|
|
66
61
|
var _m = verify.responseBody || {}, user = _m.user, flows = _m.flows;
|
|
67
62
|
var name = individualPersonalData.name, email = individualPersonalData.email, mobile = individualPersonalData.mobile, countryCode = individualPersonalData.countryCode, gender = individualPersonalData.gender, nid = individualPersonalData.nid, issuedCountry = individualPersonalData.issuedCountry, expiryDate = individualPersonalData.expiryDate, dob = individualPersonalData.dob, placeOfBirthCountry = individualPersonalData.placeOfBirthCountry, placeOfBirthCity = individualPersonalData.placeOfBirthCity, nationality = individualPersonalData.nationality;
|
|
68
|
-
var _o = user || {}, data_status = _o.data_status, is_authorized = _o.is_authorized, data_verification = _o.data_verification,
|
|
63
|
+
var _o = user || {}, data_status = _o.data_status, is_authorized = _o.is_authorized, data_verification = _o.data_verification, contact = _o.contact, genderRes = _o.gender, identification = _o.identification, birth = _o.birth, nationalityRes = _o.nationality;
|
|
69
64
|
var methods = useForm({
|
|
70
65
|
resolver: yupResolver(IndividualInfoValidationSchema),
|
|
71
66
|
defaultValues: {
|
|
@@ -169,21 +164,6 @@ var IndividualPersonalInfo = function (_a) {
|
|
|
169
164
|
var handleExpiryDateActive = function (flag) {
|
|
170
165
|
setExpiryDateActive(flag);
|
|
171
166
|
};
|
|
172
|
-
var getName = function () {
|
|
173
|
-
var _a, _b;
|
|
174
|
-
var name = isAr ? (_a = names === null || names === void 0 ? void 0 : names.ar) === null || _a === void 0 ? void 0 : _a.first : (_b = names === null || names === void 0 ? void 0 : names.en) === null || _b === void 0 ? void 0 : _b.first;
|
|
175
|
-
return name;
|
|
176
|
-
};
|
|
177
|
-
var getUserOccupation = function () {
|
|
178
|
-
var _a, _b, _c, _d;
|
|
179
|
-
if (((role === null || role === void 0 ? void 0 : role.length) || 0) > 0)
|
|
180
|
-
return isAr ? (_b = (_a = user.role[0]) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.ar : (_d = (_c = user.role[0]) === null || _c === void 0 ? void 0 : _c.name) === null || _d === void 0 ? void 0 : _d.en;
|
|
181
|
-
if (type === IndividualType.SHARE_HOLDER)
|
|
182
|
-
return t('type_share_holder');
|
|
183
|
-
if (type === IndividualType.BOARD_MEMBER)
|
|
184
|
-
return t('type_board_member');
|
|
185
|
-
return t('type_user');
|
|
186
|
-
};
|
|
187
167
|
var disabled = !methods.formState.isValid || cityLoading;
|
|
188
168
|
var isDateFieldActive = dobActive || expiryDateActive;
|
|
189
169
|
var showField = !listActive && !isDateFieldActive;
|
|
@@ -192,11 +172,11 @@ var IndividualPersonalInfo = function (_a) {
|
|
|
192
172
|
var isBirthCountryListActive = listActive === ListType.BirthCountryList;
|
|
193
173
|
var isBirthCityListActive = listActive === ListType.BirthCityList;
|
|
194
174
|
var isNationalityListActive = listActive === ListType.NationalityList;
|
|
195
|
-
return (
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
175
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Name, { show: showField, readOnly: readOnly['name'] || (noneEditable['name.en'] && noneEditable['name.ar']), isVerified: isNameVerified }), _jsx(MobileNumber, { readOnly: readOnly['mobile'] || noneEditable['contact.phone.number'] || noneEditable['contact.phone.country_code'], show: !isDateFieldActive && !isBirthCountryListActive && !isBirthCityListActive && !isNationalityListActive && !isIssuedCountryListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.MobileCountryList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isPhoneNumberVerified }), _jsx(Email, { show: showField, readOnly: readOnly['email'] || noneEditable['contact.email'], isVerified: isEmailVerified }), _jsx(Gender, { show: showField, readOnly: readOnly['gender'] || noneEditable['gender'], isVerified: isGenderVerified }), _jsx(ID, { show: showField, readOnly: readOnly['nid'] || noneEditable['identification.id'], isVerified: isIDVerified }), _jsx(IssuedCountry, { readOnly: readOnly['issuedCountry'] || noneEditable['identification.issuer_country'], show: !isMobileCountryListActive && !isDateFieldActive && !isBirthCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.IssuedCountryList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isIssuedCountryVerified }), _jsx(ExpiryDate, { show: !listActive && !dobActive, onDateClicked: handleExpiryDateActive, readOnly: readOnly['expiryDate'] || noneEditable['identification.expiry'], isVerified: isExpiryDateVerified }), _jsx(DOB, { show: !listActive && !expiryDateActive, onDateClicked: handleDobActive, readOnly: readOnly['dob'] || noneEditable['birth.date'], isVerified: isDOBVerified }), _jsx(BirthCountry, { readOnly: readOnly['placeOfBirthCountry'] || noneEditable['birth.country'], show: !isMobileCountryListActive && !isDateFieldActive && !isIssuedCountryListActive && !isBirthCityListActive && !isNationalityListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.BirthCountryList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isBirthCountryVerified }), _jsx(BirthCity, { readOnly: readOnly['placeOfBirthCity'] || noneEditable['birth.city'], show: !isMobileCountryListActive &&
|
|
176
|
+
!isDateFieldActive &&
|
|
177
|
+
!isIssuedCountryListActive &&
|
|
178
|
+
!isBirthCountryListActive &&
|
|
179
|
+
!isNationalityListActive, onListOpen: function () { return handleMenuClick(ListType.BirthCityList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isBirthCityVerified }), _jsx(Nationality, { readOnly: readOnly['nationality'] || noneEditable['nationality'], show: !isMobileCountryListActive && !isDateFieldActive && !isIssuedCountryListActive && !isBirthCityListActive && !isBirthCountryListActive, countries: countries, onListOpen: function () { return handleMenuClick(ListType.NationalityList); }, onListClose: function () { return handleMenuClick(); }, isVerified: isNationalityVerified })] }), _jsx(Collapse, __assign({ in: showField, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, isAr: isAr, disabled: disabled, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
200
180
|
};
|
|
201
181
|
IndividualPersonalInfo.defaultProps = {};
|
|
202
182
|
export default React.memo(IndividualPersonalInfo);
|
|
@@ -58,6 +58,7 @@ import { handleOpen, handleCurrentActiveScreen, handleNextScreenStep, settingsSe
|
|
|
58
58
|
import { dangerousMessage, getScreenNameBasedOnFlow } from '../../../utils';
|
|
59
59
|
import API from '../../../api';
|
|
60
60
|
import Text from '../../../components/Text';
|
|
61
|
+
import Dot from '../Dot';
|
|
61
62
|
var Image = styled('img')(function (_a) {
|
|
62
63
|
var theme = _a.theme;
|
|
63
64
|
return ({
|
|
@@ -145,19 +146,6 @@ var BrandNameStyled = styled(Text)(function (_a) {
|
|
|
145
146
|
fontWeight: 800
|
|
146
147
|
});
|
|
147
148
|
});
|
|
148
|
-
var Dot = styled('span', {
|
|
149
|
-
shouldForwardProp: function (prop) { return prop !== 'completed'; }
|
|
150
|
-
})(function (_a) {
|
|
151
|
-
var theme = _a.theme, completed = _a.completed;
|
|
152
|
-
return ({
|
|
153
|
-
height: theme.spacing(1),
|
|
154
|
-
width: theme.spacing(1),
|
|
155
|
-
backgroundColor: completed ? theme.palette.primary.main : theme.palette.text.secondary,
|
|
156
|
-
borderRadius: '50%',
|
|
157
|
-
marginInlineStart: theme.spacing(1),
|
|
158
|
-
marginInlineEnd: theme.spacing(-0.5)
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
149
|
export default function FlowsButtons(_a) {
|
|
162
150
|
var _this = this;
|
|
163
151
|
var buttons = _a.buttons, data = _a.data;
|
|
@@ -13,7 +13,9 @@ interface IndividualActionButtonsProps extends ButtonProps {
|
|
|
13
13
|
show: boolean;
|
|
14
14
|
children?: React.ReactNode;
|
|
15
15
|
};
|
|
16
|
-
addDetails: buttonProps
|
|
16
|
+
addDetails: buttonProps & {
|
|
17
|
+
status: string;
|
|
18
|
+
};
|
|
17
19
|
}
|
|
18
20
|
export default function IndividualActionButtons({ isAr, requestEmail, addDetails }: IndividualActionButtonsProps): JSX.Element;
|
|
19
21
|
export {};
|
|
@@ -17,8 +17,9 @@ import { ICONS_NAMES } from '../../../constants';
|
|
|
17
17
|
import Loader from '../../../components/Loader';
|
|
18
18
|
import Button from '../../../components/Button';
|
|
19
19
|
import Icon from '../../../components/Icon';
|
|
20
|
-
import CheckIcon from '../CheckIcon';
|
|
21
20
|
import Collapse from '../../../components/Collapse';
|
|
21
|
+
import CheckIcon from '../CheckIcon';
|
|
22
|
+
import Dot from '../Dot';
|
|
22
23
|
var ArrowIconStyled = styled(Icon, { shouldForwardProp: function (prop) { return prop !== 'isAr'; } })(function (_a) {
|
|
23
24
|
var theme = _a.theme, isAr = _a.isAr;
|
|
24
25
|
return ({
|
|
@@ -81,6 +82,29 @@ var LoaderStyled = styled(Loader)(function (_a) {
|
|
|
81
82
|
height: theme.spacing(3.75)
|
|
82
83
|
});
|
|
83
84
|
});
|
|
85
|
+
var AddDetailsButtonStyled = styled(ButtonStyled, {
|
|
86
|
+
shouldForwardProp: function (prop) { return prop !== 'isCompleted'; }
|
|
87
|
+
})(function (_a) {
|
|
88
|
+
var theme = _a.theme, isCompleted = _a.isCompleted;
|
|
89
|
+
return (__assign({}, (isCompleted && {
|
|
90
|
+
'&.MuiButton-outlined': {
|
|
91
|
+
backgroundColor: theme.palette.common.white,
|
|
92
|
+
border: "1px solid ".concat(theme.palette.success.main),
|
|
93
|
+
color: theme.palette.success.main,
|
|
94
|
+
'&:hover': {
|
|
95
|
+
cursor: 'pointer',
|
|
96
|
+
backgroundColor: theme.palette.success.main,
|
|
97
|
+
color: theme.palette.common.white,
|
|
98
|
+
img: {
|
|
99
|
+
filter: 'brightness(0) invert(1)'
|
|
100
|
+
},
|
|
101
|
+
svg: {
|
|
102
|
+
filter: 'brightness(0) invert(1)'
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
})));
|
|
107
|
+
});
|
|
84
108
|
var RequestEmailButtonStyled = styled(ButtonStyled, {
|
|
85
109
|
shouldForwardProp: function (prop) { return prop !== 'isRequested' && prop !== 'disabled'; }
|
|
86
110
|
})(function (_a) {
|
|
@@ -128,5 +152,5 @@ export default function IndividualActionButtons(_a) {
|
|
|
128
152
|
var theme = useTheme();
|
|
129
153
|
var isRequestedAndNotLoading = requestEmail.isRequested && !requestEmail.loading;
|
|
130
154
|
var requestEmailLoaderColor = isRequestedAndNotLoading ? theme.palette.success.main : theme.palette.primary.main;
|
|
131
|
-
return (_jsxs(ButtonBoxStyled, { children: [_jsxs(
|
|
155
|
+
return (_jsxs(ButtonBoxStyled, { children: [_jsxs(AddDetailsButtonStyled, __assign({ isCompleted: addDetails.status === 'verified', isLoading: addDetails.loading, type: 'button', variant: 'outlined', onClick: addDetails.onClick, startIcon: _jsx(Collapse, __assign({ in: !addDetails.loading }, { children: _jsx(Image, { src: addDetails.status === 'verified' ? ICONS_NAMES.ADD_DETAIL_GREEN : ICONS_NAMES.ADD_DETAIL }) })), endIcon: _jsx(Collapse, __assign({ in: !addDetails.loading }, { children: _jsxs("div", __assign({ style: { display: 'flex', alignItems: 'center' } }, { children: [addDetails.status !== 'verified' && _jsx(Dot, { sx: { margin: 0 }, completed: addDetails.status === 'complete' }), _jsx(ArrowIconStyled, { isAr: isAr, src: addDetails.status === 'verified' ? ICONS_NAMES.GREEN_ARROW : ICONS_NAMES.BLUE_ARROW })] })) })) }, { children: [_jsx(Collapse, __assign({ in: addDetails.loading }, { children: _jsx(LoaderStyled, { innerColor: addDetails.status === 'verified' ? theme.palette.success.main : theme.palette.primary.main, outerColor: addDetails.status === 'verified' ? theme.palette.success.main : theme.palette.primary.main, size: 15, toggleAnimation: addDetails.loading }) })), _jsx(Collapse, __assign({ in: !addDetails.loading }, { children: _jsx(TextStyled, { children: t(addDetails.title) }) }))] })), requestEmail.show && (_jsxs(_Fragment, { children: [requestEmail.children, _jsxs(RequestEmailButtonStyled, __assign({ isRequested: requestEmail.isRequested, isLoading: requestEmail.loading, variant: 'outlined', disabled: requestEmail.disabled, type: 'button', onClick: requestEmail.onClick, startIcon: _jsx(Collapse, __assign({ in: !requestEmail.loading }, { children: _jsx(Image, { src: isRequestedAndNotLoading ? ICONS_NAMES.REQUEST_EMAIL_GREEN : ICONS_NAMES.REQUEST_EMAIL }) })), endIcon: _jsx(Collapse, __assign({ in: !requestEmail.loading }, { children: isRequestedAndNotLoading ? _jsx(CheckIconStyled, {}) : _jsx(ArrowIconStyled, { isAr: isAr, src: ICONS_NAMES.BLUE_ARROW }) })) }, { children: [_jsx(Collapse, __assign({ in: requestEmail.loading }, { children: _jsx(LoaderStyled, { innerColor: requestEmailLoaderColor, outerColor: requestEmailLoaderColor, size: 15, toggleAnimation: requestEmail.loading }) })), _jsx(Collapse, __assign({ in: !requestEmail.loading }, { children: _jsx(TextStyled, { children: t(requestEmail.title) }) }))] }))] }))] }));
|
|
132
156
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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 { styled } from '@mui/material/styles';
|
|
14
|
+
var DotStyled = styled('span', {
|
|
15
|
+
shouldForwardProp: function (prop) { return prop !== 'completed'; }
|
|
16
|
+
})(function (_a) {
|
|
17
|
+
var theme = _a.theme, completed = _a.completed;
|
|
18
|
+
return ({
|
|
19
|
+
height: theme.spacing(1),
|
|
20
|
+
width: theme.spacing(1),
|
|
21
|
+
backgroundColor: completed ? theme.palette.primary.main : theme.palette.text.secondary,
|
|
22
|
+
borderRadius: '50%',
|
|
23
|
+
marginInlineStart: theme.spacing(1),
|
|
24
|
+
marginInlineEnd: theme.spacing(-0.5)
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
export default function Dot(props) {
|
|
28
|
+
return _jsx(DotStyled, __assign({}, props));
|
|
29
|
+
}
|
package/build/utils/array.d.ts
CHANGED
|
@@ -67,3 +67,4 @@ export declare const getRecentDocumentBasedOnPurpose: (documents: Array<any>, pu
|
|
|
67
67
|
export declare const findInArrayOrSubArray: (items: Array<any>, value: string | number) => null;
|
|
68
68
|
export declare const groupSectionWithSelectedActivitiesAtBeginning: (sections: Array<ActivitiesIsIc>, selectedActivities: Array<Activity>) => ActivitiesIsIc[];
|
|
69
69
|
export declare const filterActivitiesByName: (activityList: Array<ActivitiesIsIc>, value: string) => ActivityParams[];
|
|
70
|
+
export declare const mapUserList: (individuals: any) => any;
|
package/build/utils/array.js
CHANGED
|
@@ -260,3 +260,19 @@ export var filterActivitiesByName = function (activityList, value) {
|
|
|
260
260
|
return ((_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().includes(value.toLowerCase())) || ((_d = (_c = a === null || a === void 0 ? void 0 : a.name) === null || _c === void 0 ? void 0 : _c.ar) === null || _d === void 0 ? void 0 : _d.toLowerCase().includes(value.toLowerCase()));
|
|
261
261
|
});
|
|
262
262
|
};
|
|
263
|
+
export var mapUserList = function (individuals) {
|
|
264
|
+
return (individuals || []).map(function (_a) {
|
|
265
|
+
var list = _a.list, data_state = _a.data_state;
|
|
266
|
+
return list.reduce(function (acc, obj) {
|
|
267
|
+
var objects = acc.object ? [acc.object] : [];
|
|
268
|
+
var ids = acc.id ? [acc.id] : [];
|
|
269
|
+
if (obj.object) {
|
|
270
|
+
objects.push(obj.object);
|
|
271
|
+
}
|
|
272
|
+
if (obj.id) {
|
|
273
|
+
ids.push(obj.id);
|
|
274
|
+
}
|
|
275
|
+
return __assign(__assign(__assign({}, acc), obj), { individual_data_state: data_state, objects: objects, ids: ids });
|
|
276
|
+
}, {});
|
|
277
|
+
});
|
|
278
|
+
};
|