@tap-payments/auth-jsconnect 2.6.93-test → 2.6.95-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 +1 -0
- package/build/features/app/individual/individualStore.d.ts +4 -0
- package/build/features/app/individual/individualStore.js +145 -94
- package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +14 -7
- package/build/features/individual/screens/AdditionalIndividualInfo/IsAuthorizedSwitch.d.ts +36 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/IsAuthorizedSwitch.js +76 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +4 -1
- package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +3 -2
- package/build/features/individual/screens/IndividualList/UserList.js +7 -3
- package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +3 -2
- package/build/features/shared/Button/FlowsButtons.js +3 -2
- package/build/utils/string.d.ts +1 -1
- package/build/utils/string.js +2 -2
- package/package.json +1 -1
package/build/@types/form.d.ts
CHANGED
|
@@ -109,6 +109,7 @@ export interface IndividualExtraFormValues extends IndividualAttachmentsFormValu
|
|
|
109
109
|
isInfluencer: boolean | null;
|
|
110
110
|
shareCount: string;
|
|
111
111
|
shareValue: string;
|
|
112
|
+
isAuthorized: boolean;
|
|
112
113
|
}
|
|
113
114
|
export type IndividualAttachmentsFormValues = {
|
|
114
115
|
civilID?: Array<string>;
|
|
@@ -24,6 +24,7 @@ export declare const verifyToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
24
24
|
flows: any;
|
|
25
25
|
};
|
|
26
26
|
token: string;
|
|
27
|
+
userList: User[];
|
|
27
28
|
}, VerifyLeadTokenProps, {
|
|
28
29
|
state?: unknown;
|
|
29
30
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
@@ -191,6 +192,7 @@ export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
191
192
|
formData: {
|
|
192
193
|
otp: string;
|
|
193
194
|
};
|
|
195
|
+
userList: User[] | undefined;
|
|
194
196
|
}, OTPFormValues, {
|
|
195
197
|
state?: unknown;
|
|
196
198
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
@@ -232,6 +234,8 @@ export declare const updateIndividualInfo: import("@reduxjs/toolkit").AsyncThunk
|
|
|
232
234
|
data: any;
|
|
233
235
|
formData: IndividualExtraFormValues;
|
|
234
236
|
individualData: User;
|
|
237
|
+
userList: any;
|
|
238
|
+
isKWOrSACountry: boolean;
|
|
235
239
|
}, AsyncThunkParams<IndividualExtraFormValues>, {
|
|
236
240
|
state?: unknown;
|
|
237
241
|
dispatch?: import("redux").Dispatch<import("redux").AnyAction> | undefined;
|
|
@@ -71,14 +71,14 @@ import API from '../../../api';
|
|
|
71
71
|
import { FlowsTypes, IndividualGender, DocumentPurpose } from '../../../@types';
|
|
72
72
|
import { handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../../app/settings';
|
|
73
73
|
import { defaultCountry, IDENTIFICATION_TYPE, INDIVIDUAl_STEP_NAMES, MONTHLY_INCOME_LIST } from '../../../constants';
|
|
74
|
-
import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, hasNoneEditableValue, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose, formatNumberAsCurrency, removeAllCharsFromNumber, mapUserList, sortUserList, getIndividualType, isOtherThanKWOrSA } from '../../../utils';
|
|
74
|
+
import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, hasNoneEditableValue, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose, formatNumberAsCurrency, removeAllCharsFromNumber, mapUserList, sortUserList, getIndividualType, isOtherThanKWOrSA, isKWOrSA } 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 () {
|
|
78
|
-
var payload, settings, data,
|
|
79
|
-
var _d, _e, _f, _g, _h, _j, _k, _l;
|
|
80
|
-
return __generator(this, function (
|
|
81
|
-
switch (
|
|
78
|
+
var payload, settings, data, individualData, boardData, countryCode, boardInfoData, userList, boardInfoStatus, countries, publicKey, board_id, board_info_id, notification, _b, id, type, data_1, birthCountry, individuals, _c, is_authorized, data_state;
|
|
79
|
+
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
80
|
+
return __generator(this, function (_p) {
|
|
81
|
+
switch (_p.label) {
|
|
82
82
|
case 0:
|
|
83
83
|
payload = __assign({ service_name: 'tap_email', verify_token: token }, (isInternally && {
|
|
84
84
|
notification: {
|
|
@@ -88,7 +88,8 @@ export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a
|
|
|
88
88
|
settings = thunkApi.getState().settings;
|
|
89
89
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
90
90
|
case 1:
|
|
91
|
-
data = (
|
|
91
|
+
data = (_p.sent()).data;
|
|
92
|
+
individualData = undefined;
|
|
92
93
|
boardInfoStatus = undefined;
|
|
93
94
|
countries = settings.data.countries;
|
|
94
95
|
if (((_d = data.errors) === null || _d === void 0 ? void 0 : _d.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
|
|
@@ -105,63 +106,77 @@ export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a
|
|
|
105
106
|
}
|
|
106
107
|
if (!(data.step_name === INDIVIDUAl_STEP_NAMES.PHONE_INFO)) return [3, 2];
|
|
107
108
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PHONE_INFO_STEP'));
|
|
108
|
-
return [3,
|
|
109
|
+
return [3, 20];
|
|
109
110
|
case 2:
|
|
110
|
-
if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3,
|
|
111
|
+
if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 19];
|
|
111
112
|
board_id = data === null || data === void 0 ? void 0 : data.id;
|
|
112
113
|
board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
|
|
113
114
|
if (!(board_id && board_info_id)) return [3, 5];
|
|
114
115
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
115
116
|
case 3:
|
|
116
|
-
boardInfoData =
|
|
117
|
+
boardInfoData = _p.sent();
|
|
117
118
|
notification = (boardInfoData || {}).notification;
|
|
118
119
|
_b = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _b.id, type = _b.type;
|
|
119
120
|
if (!(id && type)) return [3, 5];
|
|
120
121
|
return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode })).unwrap()];
|
|
121
122
|
case 4:
|
|
122
|
-
data_1 = (
|
|
123
|
+
data_1 = (_p.sent()).data;
|
|
123
124
|
individualData = data_1 || {};
|
|
124
|
-
|
|
125
|
+
_p.label = 5;
|
|
125
126
|
case 5:
|
|
126
127
|
if (!board_id) return [3, 7];
|
|
127
128
|
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
128
129
|
case 6:
|
|
129
|
-
boardData =
|
|
130
|
-
|
|
130
|
+
boardData = _p.sent();
|
|
131
|
+
_p.label = 7;
|
|
131
132
|
case 7:
|
|
132
133
|
if (!countryCode) {
|
|
133
134
|
countryCode = (_f = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _f === void 0 ? void 0 : _f.country;
|
|
134
135
|
if (countryCode)
|
|
135
136
|
thunkApi.dispatch(handleSetCountryByIso2(countryCode));
|
|
136
137
|
}
|
|
137
|
-
if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 11];
|
|
138
|
+
if (!(!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && !isKWOrSA(countryCode))) return [3, 11];
|
|
138
139
|
if (!((_g = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _g === void 0 ? void 0 : _g.id)) return [3, 9];
|
|
139
|
-
return [4, thunkApi.dispatch(getIndividualList((_h = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _h === void 0 ? void 0 : _h.id))];
|
|
140
|
+
return [4, thunkApi.dispatch(getIndividualList((_h = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _h === void 0 ? void 0 : _h.id)).unwrap()];
|
|
140
141
|
case 8:
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
case 9:
|
|
142
|
+
userList = _p.sent();
|
|
143
|
+
_p.label = 9;
|
|
144
|
+
case 9:
|
|
145
|
+
userList = userList === null || userList === void 0 ? void 0 : userList.filter(function (user) { return user.id === (individualData === null || individualData === void 0 ? void 0 : individualData.id); });
|
|
146
|
+
return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
144
147
|
case 10:
|
|
145
|
-
boardInfoStatus =
|
|
148
|
+
boardInfoStatus = _p.sent();
|
|
146
149
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
|
|
147
|
-
return [3,
|
|
150
|
+
return [3, 18];
|
|
148
151
|
case 11:
|
|
149
|
-
|
|
150
|
-
if (!
|
|
151
|
-
return [4, thunkApi.dispatch(
|
|
152
|
+
if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 15];
|
|
153
|
+
if (!((_j = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _j === void 0 ? void 0 : _j.id)) return [3, 13];
|
|
154
|
+
return [4, thunkApi.dispatch(getIndividualList((_k = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _k === void 0 ? void 0 : _k.id)).unwrap()];
|
|
152
155
|
case 12:
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
case 13:
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
userList = _p.sent();
|
|
157
|
+
_p.label = 13;
|
|
158
|
+
case 13: return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
159
|
+
case 14:
|
|
160
|
+
boardInfoStatus = _p.sent();
|
|
161
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
|
|
162
|
+
return [3, 18];
|
|
159
163
|
case 15:
|
|
164
|
+
birthCountry = ((_l = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _l === void 0 ? void 0 : _l.country) || countryCode;
|
|
165
|
+
if (!birthCountry) return [3, 17];
|
|
166
|
+
return [4, thunkApi.dispatch(getCityList(birthCountry))];
|
|
167
|
+
case 16:
|
|
168
|
+
_p.sent();
|
|
169
|
+
_p.label = 17;
|
|
170
|
+
case 17:
|
|
171
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
|
|
172
|
+
_p.label = 18;
|
|
173
|
+
case 18: return [3, 20];
|
|
174
|
+
case 19:
|
|
160
175
|
if (isUpdatePhoneInfo) {
|
|
161
176
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_VERIFY_STEP'));
|
|
162
177
|
}
|
|
163
|
-
|
|
164
|
-
case
|
|
178
|
+
_p.label = 20;
|
|
179
|
+
case 20:
|
|
165
180
|
individuals = (boardData || {}).individuals;
|
|
166
181
|
_c = individualData || {}, is_authorized = _c.is_authorized, data_state = _c.data_state;
|
|
167
182
|
return [2, {
|
|
@@ -172,8 +187,8 @@ export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a
|
|
|
172
187
|
entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
|
|
173
188
|
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
174
189
|
merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
|
|
175
|
-
name: (
|
|
176
|
-
contact: (
|
|
190
|
+
name: (_m = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _m === void 0 ? void 0 : _m.names,
|
|
191
|
+
contact: (_o = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _o === void 0 ? void 0 : _o.contact,
|
|
177
192
|
individuals: is_authorized ? individuals : __assign(__assign({}, individuals), (!!data_state && { data_state: data_state })),
|
|
178
193
|
countries: countries,
|
|
179
194
|
countryCode: countryCode,
|
|
@@ -181,7 +196,8 @@ export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a
|
|
|
181
196
|
business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
|
|
182
197
|
flows: (boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || []
|
|
183
198
|
},
|
|
184
|
-
token: token
|
|
199
|
+
token: token,
|
|
200
|
+
userList: userList || []
|
|
185
201
|
}];
|
|
186
202
|
}
|
|
187
203
|
});
|
|
@@ -424,10 +440,10 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetai
|
|
|
424
440
|
});
|
|
425
441
|
}); });
|
|
426
442
|
export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
427
|
-
var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData,
|
|
428
|
-
var _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
429
|
-
return __generator(this, function (
|
|
430
|
-
switch (
|
|
443
|
+
var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, individualData, boardInfoData, userList, boardData, boardInfoStatus, publicKey, countryCode, notification, _c, id, type, data_3, birthCountry, individuals, _d, is_authorized, data_state;
|
|
444
|
+
var _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
445
|
+
return __generator(this, function (_t) {
|
|
446
|
+
switch (_t.label) {
|
|
431
447
|
case 0:
|
|
432
448
|
_a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
|
|
433
449
|
responseBody = individual.data.verify.responseBody;
|
|
@@ -442,7 +458,8 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
|
|
|
442
458
|
};
|
|
443
459
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
444
460
|
case 1:
|
|
445
|
-
data = (
|
|
461
|
+
data = (_t.sent()).data;
|
|
462
|
+
individualData = undefined;
|
|
446
463
|
boardInfoStatus = undefined;
|
|
447
464
|
if ((_f = data.errors) === null || _f === void 0 ? void 0 : _f.length)
|
|
448
465
|
throw new Error(data.errors[0].description);
|
|
@@ -453,48 +470,62 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
|
|
|
453
470
|
if (!board_id) return [3, 3];
|
|
454
471
|
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
455
472
|
case 2:
|
|
456
|
-
boardData =
|
|
457
|
-
|
|
473
|
+
boardData = _t.sent();
|
|
474
|
+
_t.label = 3;
|
|
458
475
|
case 3:
|
|
459
476
|
countryCode = (_h = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _h === void 0 ? void 0 : _h.country;
|
|
460
477
|
if (!(board_id && board_info_id)) return [3, 6];
|
|
461
478
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
462
479
|
case 4:
|
|
463
|
-
boardInfoData =
|
|
480
|
+
boardInfoData = _t.sent();
|
|
464
481
|
notification = (boardInfoData || {}).notification;
|
|
465
482
|
_c = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
|
|
466
483
|
if (!(id && type)) return [3, 6];
|
|
467
484
|
return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode })).unwrap()];
|
|
468
485
|
case 5:
|
|
469
|
-
data_3 = (
|
|
486
|
+
data_3 = (_t.sent()).data;
|
|
470
487
|
individualData = data_3 || {};
|
|
471
|
-
|
|
488
|
+
_t.label = 6;
|
|
472
489
|
case 6:
|
|
473
490
|
if (countryCode)
|
|
474
491
|
thunkApi.dispatch(handleSetCountryByIso2(countryCode));
|
|
475
|
-
if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 10];
|
|
492
|
+
if (!(!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && !isKWOrSA(countryCode))) return [3, 10];
|
|
476
493
|
if (!((_j = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _j === void 0 ? void 0 : _j.id)) return [3, 8];
|
|
477
|
-
return [4, thunkApi.dispatch(getIndividualList((_k = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _k === void 0 ? void 0 : _k.id))];
|
|
494
|
+
return [4, thunkApi.dispatch(getIndividualList((_k = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _k === void 0 ? void 0 : _k.id)).unwrap()];
|
|
478
495
|
case 7:
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
case 8:
|
|
496
|
+
userList = _t.sent();
|
|
497
|
+
_t.label = 8;
|
|
498
|
+
case 8:
|
|
499
|
+
userList = userList === null || userList === void 0 ? void 0 : userList.filter(function (user) { return user.id === (individualData === null || individualData === void 0 ? void 0 : individualData.id); });
|
|
500
|
+
return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
482
501
|
case 9:
|
|
483
|
-
boardInfoStatus =
|
|
502
|
+
boardInfoStatus = _t.sent();
|
|
484
503
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
|
|
485
|
-
return [3,
|
|
504
|
+
return [3, 17];
|
|
486
505
|
case 10:
|
|
487
|
-
|
|
488
|
-
if (!
|
|
489
|
-
return [4, thunkApi.dispatch(
|
|
506
|
+
if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 14];
|
|
507
|
+
if (!((_l = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _l === void 0 ? void 0 : _l.id)) return [3, 12];
|
|
508
|
+
return [4, thunkApi.dispatch(getIndividualList((_m = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _m === void 0 ? void 0 : _m.id))];
|
|
490
509
|
case 11:
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
case 12:
|
|
494
|
-
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP')); });
|
|
495
|
-
_r.label = 13;
|
|
510
|
+
_t.sent();
|
|
511
|
+
_t.label = 12;
|
|
512
|
+
case 12: return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
496
513
|
case 13:
|
|
497
|
-
|
|
514
|
+
boardInfoStatus = _t.sent();
|
|
515
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
|
|
516
|
+
return [3, 17];
|
|
517
|
+
case 14:
|
|
518
|
+
birthCountry = ((_o = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _o === void 0 ? void 0 : _o.country) || countryCode;
|
|
519
|
+
if (!birthCountry) return [3, 16];
|
|
520
|
+
return [4, thunkApi.dispatch(getCityList(birthCountry))];
|
|
521
|
+
case 15:
|
|
522
|
+
_t.sent();
|
|
523
|
+
_t.label = 16;
|
|
524
|
+
case 16:
|
|
525
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP')); });
|
|
526
|
+
_t.label = 17;
|
|
527
|
+
case 17:
|
|
528
|
+
(_q = (_p = settings.data.appConfig).onStepCompleted) === null || _q === void 0 ? void 0 : _q.call(_p, settings.data.activeScreen.name, { otp: params.otp });
|
|
498
529
|
individuals = (boardData || {}).individuals;
|
|
499
530
|
_d = individualData || {}, is_authorized = _d.is_authorized, data_state = _d.data_state;
|
|
500
531
|
return [2, {
|
|
@@ -505,8 +536,8 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
|
|
|
505
536
|
entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
|
|
506
537
|
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
507
538
|
merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
|
|
508
|
-
name: (
|
|
509
|
-
contact: (
|
|
539
|
+
name: (_r = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _r === void 0 ? void 0 : _r.names,
|
|
540
|
+
contact: (_s = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _s === void 0 ? void 0 : _s.contact,
|
|
510
541
|
individuals: is_authorized ? individuals : __assign(__assign({}, individuals), (!!data_state && { data_state: data_state })),
|
|
511
542
|
countries: countries,
|
|
512
543
|
countryCode: countryCode,
|
|
@@ -514,7 +545,8 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
|
|
|
514
545
|
business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
|
|
515
546
|
flows: (boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || []
|
|
516
547
|
},
|
|
517
|
-
formData: __assign({}, params)
|
|
548
|
+
formData: __assign({}, params),
|
|
549
|
+
userList: userList
|
|
518
550
|
}];
|
|
519
551
|
}
|
|
520
552
|
});
|
|
@@ -659,27 +691,30 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
|
|
|
659
691
|
export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (_a, thunkApi) {
|
|
660
692
|
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
661
693
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
662
|
-
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, _e, isUser, isShareholder, isBoardMember, isBuyer, isCustomer, isUserORBuyerType, payload,
|
|
694
|
+
var _b, settings, individual, _c, notification, user, userList, business, id, _d, objects, ids, isKWOrSAValue, occupation, sourceIncome, monthlyIncome, isPEP, isInfluencer, shareCount, shareValue, civilID, signatureFileId, isAuthorized, isOccupationNonEditable, isSourceIncomeNonEditable, isPEPNonEditable, isInfluencerNonEditable, isMonthlyIncomeNonEditable, isAuthorizedNonEditable, isSharesAvailable, pepInfo, influencerInfo, occupationInfo, sourceIncomeInfo, monthlyIncomeInfo, isAuthorizedInfo, userPayload, shareHolderPayload, boardMemberPayload, buyerMemberPayload, _e, isUser, isShareholder, isBoardMember, isBuyer, isCustomer, isUserORBuyerType, payload, businessCountry, hasCivilIdDocument, hasSignatureDocument, isSendSignatureFile, civilIdDocument, signatureDocument, documentBody, documentBody, documentsList, documentBody, requestBody, data, individualData, userListRes;
|
|
663
695
|
var _f, _g;
|
|
664
696
|
return __generator(this, function (_h) {
|
|
665
697
|
switch (_h.label) {
|
|
666
698
|
case 0:
|
|
667
699
|
_b = thunkApi.getState(), settings = _b.settings, individual = _b.individual;
|
|
668
|
-
_c = individual.data.verify.responseBody || {}, notification = _c.notification, user = _c.user;
|
|
700
|
+
_c = individual.data.verify.responseBody || {}, notification = _c.notification, user = _c.user, userList = _c.userList, business = _c.business;
|
|
669
701
|
id = (((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : notification === null || notification === void 0 ? void 0 : notification.recipient) || {}).id;
|
|
670
702
|
_d = user || {}, objects = _d.objects, ids = _d.ids;
|
|
671
|
-
|
|
703
|
+
isKWOrSAValue = isKWOrSA(settings.data.businessCountry.iso2);
|
|
704
|
+
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, isAuthorized = formData.isAuthorized;
|
|
672
705
|
isOccupationNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'occupation');
|
|
673
706
|
isSourceIncomeNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'source_of_income');
|
|
674
707
|
isPEPNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'is_relative_PEP');
|
|
675
708
|
isInfluencerNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'is_influencer');
|
|
676
709
|
isMonthlyIncomeNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'monthly_income');
|
|
710
|
+
isAuthorizedNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'is_authorized');
|
|
677
711
|
isSharesAvailable = shareCount || shareValue;
|
|
678
712
|
pepInfo = isPEPNonEditable || isPEP === null ? undefined : isPEP;
|
|
679
713
|
influencerInfo = isInfluencerNonEditable || isInfluencer === null ? undefined : isInfluencer;
|
|
680
714
|
occupationInfo = isOccupationNonEditable || !(occupation === null || occupation === void 0 ? void 0 : occupation.id) ? undefined : { chapter: { id: occupation.id } };
|
|
681
715
|
sourceIncomeInfo = isSourceIncomeNonEditable || !(sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome.id) ? undefined : [{ id: sourceIncome.id }];
|
|
682
716
|
monthlyIncomeInfo = isMonthlyIncomeNonEditable || !(monthlyIncome === null || monthlyIncome === void 0 ? void 0 : monthlyIncome.id) ? undefined : { id: monthlyIncome.id };
|
|
717
|
+
isAuthorizedInfo = isAuthorizedNonEditable || isKWOrSAValue ? undefined : { is_authorized: isAuthorized };
|
|
683
718
|
userPayload = {
|
|
684
719
|
occupation: occupationInfo,
|
|
685
720
|
source_income: sourceIncomeInfo,
|
|
@@ -708,58 +743,65 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
|
|
|
708
743
|
isUserORBuyerType = isUser || isBuyer;
|
|
709
744
|
payload = userPayload;
|
|
710
745
|
if (objects === null || objects === void 0 ? void 0 : objects.length) {
|
|
711
|
-
payload = __assign(__assign(__assign(__assign(__assign({}, (isUser && payload)), (isShareholder && shareHolderPayload)), (isBoardMember && boardMemberPayload)), (isBuyer && buyerMemberPayload)), (isCustomer && {}));
|
|
746
|
+
payload = __assign(__assign(__assign(__assign(__assign(__assign({}, (isUser && payload)), (isShareholder && shareHolderPayload)), (isBoardMember && boardMemberPayload)), (isBuyer && buyerMemberPayload)), (isCustomer && {})), (isAuthorizedInfo && isAuthorizedInfo));
|
|
712
747
|
}
|
|
713
|
-
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 });
|
|
714
|
-
return [4, API.individualService.updateMultipleIndividual(requestBody)];
|
|
715
|
-
case 1:
|
|
716
|
-
data = _h.sent();
|
|
717
748
|
businessCountry = settings.data.businessCountry;
|
|
718
749
|
hasCivilIdDocument = (civilID || []).length > 0;
|
|
719
750
|
hasSignatureDocument = (signatureFileId || []).length > 0;
|
|
720
|
-
isSendSignatureFile =
|
|
751
|
+
isSendSignatureFile = isAuthorized && isUserORBuyerType;
|
|
721
752
|
civilIdDocument = getRecentDocumentBasedOnPurpose(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.IDENTITY_DOCUMENT);
|
|
722
753
|
signatureDocument = getRecentDocumentBasedOnPurpose(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.CUSTOMER_SIGNATURE);
|
|
723
|
-
if (!((civilIdDocument === null || civilIdDocument === void 0 ? void 0 : civilIdDocument.id) && hasCivilIdDocument)) return [3,
|
|
754
|
+
if (!((civilIdDocument === null || civilIdDocument === void 0 ? void 0 : civilIdDocument.id) && hasCivilIdDocument)) return [3, 2];
|
|
724
755
|
documentBody = {
|
|
725
756
|
id: civilIdDocument.id,
|
|
726
757
|
images: civilID
|
|
727
758
|
};
|
|
728
759
|
return [4, API.documentService.addFilesToExistingDocument(documentBody)];
|
|
729
|
-
case
|
|
760
|
+
case 1:
|
|
730
761
|
_h.sent();
|
|
731
|
-
_h.label =
|
|
732
|
-
case
|
|
733
|
-
if (!((signatureDocument === null || signatureDocument === void 0 ? void 0 : signatureDocument.id) && hasSignatureDocument && isSendSignatureFile)) return [3,
|
|
762
|
+
_h.label = 2;
|
|
763
|
+
case 2:
|
|
764
|
+
if (!((signatureDocument === null || signatureDocument === void 0 ? void 0 : signatureDocument.id) && hasSignatureDocument && isSendSignatureFile)) return [3, 4];
|
|
734
765
|
documentBody = {
|
|
735
766
|
id: signatureDocument.id,
|
|
736
767
|
images: signatureFileId
|
|
737
768
|
};
|
|
738
769
|
return [4, API.documentService.addFilesToExistingDocument(documentBody)];
|
|
739
|
-
case
|
|
770
|
+
case 3:
|
|
740
771
|
_h.sent();
|
|
741
|
-
_h.label =
|
|
742
|
-
case
|
|
772
|
+
_h.label = 4;
|
|
773
|
+
case 4:
|
|
743
774
|
documentsList = [];
|
|
744
775
|
if (hasCivilIdDocument && !(civilIdDocument === null || civilIdDocument === void 0 ? void 0 : civilIdDocument.id))
|
|
745
776
|
documentsList.push({ type: DocumentPurpose.IDENTITY_DOCUMENT, images: civilID });
|
|
746
777
|
if (isSendSignatureFile && hasSignatureDocument && !(signatureDocument === null || signatureDocument === void 0 ? void 0 : signatureDocument.id))
|
|
747
778
|
documentsList.push({ type: DocumentPurpose.CUSTOMER_SIGNATURE, images: signatureFileId });
|
|
748
|
-
if (!(documentsList.length > 0)) return [3,
|
|
779
|
+
if (!(documentsList.length > 0)) return [3, 6];
|
|
749
780
|
documentBody = {
|
|
750
781
|
individual_type_id: ((ids === null || ids === void 0 ? void 0 : ids.length) ? ids.find(function (i) { return i.includes('usr_'); }) : id) || '',
|
|
751
782
|
country: businessCountry.iso2,
|
|
752
783
|
documents: documentsList
|
|
753
784
|
};
|
|
754
785
|
return [4, API.documentService.updateDocumentInfo(documentBody)];
|
|
755
|
-
case
|
|
786
|
+
case 5:
|
|
756
787
|
_h.sent();
|
|
757
|
-
_h.label =
|
|
788
|
+
_h.label = 6;
|
|
789
|
+
case 6:
|
|
790
|
+
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 });
|
|
791
|
+
return [4, API.individualService.updateMultipleIndividual(requestBody)];
|
|
758
792
|
case 7:
|
|
793
|
+
data = _h.sent();
|
|
759
794
|
individualData = (sortUserList(mapUserList(data === null || data === void 0 ? void 0 : data.individuals)) || [])[0];
|
|
795
|
+
userListRes = userList || [];
|
|
796
|
+
if (!((user === null || user === void 0 ? void 0 : user.id) === (individualData === null || individualData === void 0 ? void 0 : individualData.id) && !(user === null || user === void 0 ? void 0 : user.is_authorized) && isAuthorized && (business === null || business === void 0 ? void 0 : business.id))) return [3, 9];
|
|
797
|
+
return [4, thunkApi.dispatch(getIndividualList(business === null || business === void 0 ? void 0 : business.id)).unwrap()];
|
|
798
|
+
case 8:
|
|
799
|
+
userListRes = _h.sent();
|
|
800
|
+
_h.label = 9;
|
|
801
|
+
case 9:
|
|
760
802
|
thunkApi.dispatch(handleNextScreenStep());
|
|
761
803
|
(_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, requestBody);
|
|
762
|
-
return [2, { data: data, formData: originalFormData, individualData: individualData }];
|
|
804
|
+
return [2, { data: data, formData: originalFormData, individualData: individualData, userList: userListRes, isKWOrSACountry: isKWOrSAValue }];
|
|
763
805
|
}
|
|
764
806
|
});
|
|
765
807
|
});
|
|
@@ -888,7 +930,8 @@ var initialState = {
|
|
|
888
930
|
isPEP: null,
|
|
889
931
|
isInfluencer: null,
|
|
890
932
|
shareCount: '',
|
|
891
|
-
shareValue: ''
|
|
933
|
+
shareValue: '',
|
|
934
|
+
isAuthorized: false
|
|
892
935
|
}
|
|
893
936
|
}
|
|
894
937
|
};
|
|
@@ -923,8 +966,8 @@ export var individualSlice = createSlice({
|
|
|
923
966
|
})
|
|
924
967
|
.addCase(verifyToken.fulfilled, function (state, action) {
|
|
925
968
|
state.error = null;
|
|
926
|
-
var _a = action.payload, data = _a.data, token = _a.token, boardResponse = _a.boardResponse;
|
|
927
|
-
state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id });
|
|
969
|
+
var _a = action.payload, data = _a.data, token = _a.token, boardResponse = _a.boardResponse, userList = _a.userList;
|
|
970
|
+
state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id, userList: userList });
|
|
928
971
|
state.data.verify.token = token;
|
|
929
972
|
})
|
|
930
973
|
.addCase(verifyToken.rejected, function (state, action) {
|
|
@@ -967,7 +1010,7 @@ export var individualSlice = createSlice({
|
|
|
967
1010
|
var _a;
|
|
968
1011
|
state.loading = false;
|
|
969
1012
|
state.error = null;
|
|
970
|
-
var _b = action.payload, data = _b.data, formData = _b.formData, boardResponse = _b.boardResponse;
|
|
1013
|
+
var _b = action.payload, data = _b.data, formData = _b.formData, boardResponse = _b.boardResponse, userList = _b.userList;
|
|
971
1014
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
972
1015
|
if (description) {
|
|
973
1016
|
state.error = description;
|
|
@@ -975,7 +1018,7 @@ export var individualSlice = createSlice({
|
|
|
975
1018
|
}
|
|
976
1019
|
state.data.otpData = formData;
|
|
977
1020
|
state.data.otpData.responseBody = data;
|
|
978
|
-
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), boardResponse);
|
|
1021
|
+
state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), boardResponse), { userList: userList });
|
|
979
1022
|
})
|
|
980
1023
|
.addCase(verifyLeadOTP.rejected, function (state, action) {
|
|
981
1024
|
state.loading = false;
|
|
@@ -994,7 +1037,7 @@ export var individualSlice = createSlice({
|
|
|
994
1037
|
var user = (userList || []).find(function (user) { return user.individual_id === individualId; });
|
|
995
1038
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { userList: userList });
|
|
996
1039
|
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 }) });
|
|
997
|
-
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;
|
|
1040
|
+
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, is_authorized = _f.is_authorized;
|
|
998
1041
|
var _g = state.data.individualData.responseBody || {}, sourceIncomeList = _g.sourceIncomeList, monthlyIncomeList = _g.monthlyIncomeList;
|
|
999
1042
|
var cityList = (state.data.verify.responseBody || {}).cityList;
|
|
1000
1043
|
if (user)
|
|
@@ -1052,6 +1095,8 @@ export var individualSlice = createSlice({
|
|
|
1052
1095
|
state.data.individualData.isPEP = is_relative_PEP;
|
|
1053
1096
|
if (is_influencer !== undefined)
|
|
1054
1097
|
state.data.individualData.isInfluencer = is_influencer;
|
|
1098
|
+
if (is_authorized !== undefined)
|
|
1099
|
+
state.data.individualData.isAuthorized = is_authorized;
|
|
1055
1100
|
})
|
|
1056
1101
|
.addCase(addDetailsAsync.rejected, function (state, action) {
|
|
1057
1102
|
state.loading = false;
|
|
@@ -1087,7 +1132,7 @@ export var individualSlice = createSlice({
|
|
|
1087
1132
|
var _e = action.payload, data = _e.data, countries = _e.countries;
|
|
1088
1133
|
var user = (state.data.verify.responseBody || {}).user;
|
|
1089
1134
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { primaryUser: data, user: __assign(__assign({}, data), { is_authorized: data.is_authorized !== undefined ? data.is_authorized : user === null || user === void 0 ? void 0 : user.is_authorized }) });
|
|
1090
|
-
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;
|
|
1135
|
+
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, is_authorized = _f.is_authorized;
|
|
1091
1136
|
var _g = state.data.individualData.responseBody || {}, sourceIncomeList = _g.sourceIncomeList, monthlyIncomeList = _g.monthlyIncomeList;
|
|
1092
1137
|
var cityList = (state.data.verify.responseBody || {}).cityList;
|
|
1093
1138
|
if (data)
|
|
@@ -1143,6 +1188,8 @@ export var individualSlice = createSlice({
|
|
|
1143
1188
|
state.data.individualData.occupation = selectedOccupation;
|
|
1144
1189
|
state.data.individualData.isPEP = is_relative_PEP;
|
|
1145
1190
|
state.data.individualData.isInfluencer = is_influencer;
|
|
1191
|
+
if (is_authorized !== undefined)
|
|
1192
|
+
state.data.individualData.isAuthorized = is_authorized;
|
|
1146
1193
|
})
|
|
1147
1194
|
.addCase(retrieveIndividualInfo.rejected, function (state, action) {
|
|
1148
1195
|
state.error = action.error.message;
|
|
@@ -1253,16 +1300,20 @@ export var individualSlice = createSlice({
|
|
|
1253
1300
|
.addCase(updateIndividualInfo.fulfilled, function (state, action) {
|
|
1254
1301
|
state.loading = false;
|
|
1255
1302
|
state.error = null;
|
|
1256
|
-
var _a = action.payload, data = _a.data, formData = _a.formData, individualData = _a.individualData;
|
|
1303
|
+
var _a = action.payload, data = _a.data, formData = _a.formData, individualData = _a.individualData, userList = _a.userList, isKWOrSACountry = _a.isKWOrSACountry;
|
|
1257
1304
|
state.data.individualData = formData;
|
|
1258
1305
|
state.data.individualData.responseBody = data;
|
|
1259
|
-
var
|
|
1306
|
+
var user = (state.data.verify.responseBody || {}).user;
|
|
1307
|
+
var isSameUser = (user === null || user === void 0 ? void 0 : user.id) === (individualData === null || individualData === void 0 ? void 0 : individualData.id);
|
|
1308
|
+
var userInfo = __assign(__assign({}, user), (isSameUser && (individualData === null || individualData === void 0 ? void 0 : individualData.documents) && { documents: individualData === null || individualData === void 0 ? void 0 : individualData.documents }));
|
|
1309
|
+
if (isSameUser && !isKWOrSACountry)
|
|
1310
|
+
userInfo = __assign(__assign({}, user), { is_authorized: individualData.is_authorized });
|
|
1260
1311
|
var list = userList || [];
|
|
1261
1312
|
list = list.map(function (user) {
|
|
1262
1313
|
var userInfo = user.id === (individualData === null || individualData === void 0 ? void 0 : individualData.id) ? individualData : user;
|
|
1263
1314
|
return userInfo;
|
|
1264
1315
|
});
|
|
1265
|
-
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { userList: list });
|
|
1316
|
+
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { user: userInfo, userList: list });
|
|
1266
1317
|
})
|
|
1267
1318
|
.addCase(updateIndividualInfo.rejected, function (state, action) {
|
|
1268
1319
|
state.loading = false;
|
package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js
CHANGED
|
@@ -19,7 +19,7 @@ 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
21
|
import { DocumentPurpose, IndividualType } from '../../../../@types';
|
|
22
|
-
import { deepCopy, getIndividualType, isKW } from '../../../../utils';
|
|
22
|
+
import { deepCopy, getIndividualType, isKW, isKWOrSA } from '../../../../utils';
|
|
23
23
|
import Form from '../../../../components/Form';
|
|
24
24
|
import Collapse from '../../../../components/Collapse';
|
|
25
25
|
import Text from '../../../../components/Text';
|
|
@@ -37,6 +37,7 @@ import SignatureFile from './SignatureFile';
|
|
|
37
37
|
import ShareCount from './ShareCount';
|
|
38
38
|
import ShareValue from './ShareValue';
|
|
39
39
|
import { getFileDetailsFromDocument } from '../../../../utils';
|
|
40
|
+
import IsAuthorizedSwitch from './IsAuthorizedSwitch';
|
|
40
41
|
var TextBoxStyled = styled(Box)(function (_a) {
|
|
41
42
|
var theme = _a.theme;
|
|
42
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 }));
|
|
@@ -60,11 +61,13 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
60
61
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
61
62
|
var verify = data.verify;
|
|
62
63
|
var user = (verify.responseBody || {}).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 _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, isAuthorized = _d.isAuthorized;
|
|
64
65
|
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
66
|
var isKWCountry = React.useMemo(function () { return isKW(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
67
|
+
var isOtherThanKWAndSa = React.useMemo(function () { return !isKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
68
|
+
var showIsAuthorized = isOtherThanKWAndSa;
|
|
66
69
|
var methods = useForm({
|
|
67
|
-
resolver: yupResolver(IndividualInfoValidationSchema(objects, isKWCountry)),
|
|
70
|
+
resolver: yupResolver(IndividualInfoValidationSchema(objects, isKWCountry, showIsAuthorized)),
|
|
68
71
|
defaultValues: {
|
|
69
72
|
occupation: occupation,
|
|
70
73
|
sourceIncome: sourceIncome,
|
|
@@ -77,7 +80,8 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
77
80
|
civilIDUploading: civilIDUploading,
|
|
78
81
|
signatureFileUploading: signatureFileUploading,
|
|
79
82
|
shareCount: shareCount,
|
|
80
|
-
shareValue: shareValue
|
|
83
|
+
shareValue: shareValue,
|
|
84
|
+
isAuthorized: isAuthorized
|
|
81
85
|
},
|
|
82
86
|
mode: 'onChange'
|
|
83
87
|
});
|
|
@@ -96,7 +100,8 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
96
100
|
'source_of_income',
|
|
97
101
|
'monthly_income',
|
|
98
102
|
'is_relative_PEP',
|
|
99
|
-
'is_influencer'
|
|
103
|
+
'is_influencer',
|
|
104
|
+
'is_authorized'
|
|
100
105
|
]);
|
|
101
106
|
var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
|
|
102
107
|
var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
|
|
@@ -104,9 +109,10 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
104
109
|
var isOccupationVerified = dataVerified['occupation'] && (occupationRes === null || occupationRes === void 0 ? void 0 : occupationRes.id) === ((_b = watch('occupation')) === null || _b === void 0 ? void 0 : _b.id);
|
|
105
110
|
var isPEPSwitchVerified = dataVerified['is_relative_PEP'] && is_relative_PEP === watch('isPEP');
|
|
106
111
|
var isInfluencerSwitchVerified = dataVerified['is_influencer'] && is_influencer === watch('isInfluencer');
|
|
112
|
+
var isAuthorizedSwitchVerified = dataVerified['is_authorized'] && is_authorized === watch('isAuthorized');
|
|
107
113
|
var _f = React.useState(), listActive = _f[0], setListActive = _f[1];
|
|
108
114
|
var onSubmit = function (data) {
|
|
109
|
-
dispatch(updateIndividualInfo(deepCopy(getFelids(data))));
|
|
115
|
+
dispatch(updateIndividualInfo(deepCopy(getFelids(__assign(__assign({}, data), { signatureFileUploading: signatureFileUploading, civilIDUploading: civilIDUploading })))));
|
|
110
116
|
};
|
|
111
117
|
var onBack = function () {
|
|
112
118
|
dispatch(handleCurrentActiveScreen('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
|
|
@@ -134,6 +140,7 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
134
140
|
var _g = React.useMemo(function () { return getIndividualType(objects); }, [objects]), isUser = _g.isUser, isShareholder = _g.isShareholder, isBoardMember = _g.isBoardMember, isBuyer = _g.isBuyer;
|
|
135
141
|
var isUserORBuyerType = isUser || isBuyer;
|
|
136
142
|
var isUserORBoardMemberType = isUser || isBoardMember;
|
|
143
|
+
var isAuthorizedValue = watch('isAuthorized');
|
|
137
144
|
var showSignatureFile = isUserORBuyerType;
|
|
138
145
|
var showOccupationFile = isUserORBuyerType;
|
|
139
146
|
var showSourceOfIncome = isUserORBuyerType;
|
|
@@ -144,7 +151,7 @@ var AdditionalIndividualInfo = function (_a) {
|
|
|
144
151
|
var isMonthlyIncomeListActive = listActive === ListType.MonthlyIncomeList;
|
|
145
152
|
var isOccupationListActive = listActive === ListType.OccupationList;
|
|
146
153
|
var disabled = !methods.formState.isValid || civilIDUploading || signatureFileUploading;
|
|
147
|
-
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: isKWCountry, readOnly: readOnly['civilID'], defaultFiles: defaultCivilIdFiles }), _jsx(SignatureFile, { show:
|
|
154
|
+
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'] }), _jsx(IsAuthorizedSwitch, { show: !listActive && showIsAuthorized, readOnly: readOnly['isAuthorized'] || noneEditable['is_authorized'], isVerified: isAuthorizedSwitchVerified }), _jsxs(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: [_jsx(CivilIDFile, { show: isKWCountry, readOnly: readOnly['civilID'], defaultFiles: defaultCivilIdFiles }), _jsx(SignatureFile, { show: isAuthorizedValue && showSignatureFile, readOnly: readOnly['signatureFileId'], defaultFiles: defaultSignatureFiles })] })), _jsx(PEPSwitch, { show: showIsPEP && !listActive, readOnly: readOnly['isPEP'] || noneEditable['is_relative_PEP'], isVerified: isPEPSwitchVerified }), _jsx(InfluencerSwitch, { show: showIsInfluencer && isKWCountry && !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') })) }))] })) }))] }));
|
|
148
155
|
};
|
|
149
156
|
export default React.memo(AdditionalIndividualInfo);
|
|
150
157
|
AdditionalIndividualInfo.defaultProps = {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const InfoIconStyled: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
|
|
5
|
+
color?: "inherit" | "disabled" | "error" | "info" | "success" | "action" | "primary" | "secondary" | "warning" | undefined;
|
|
6
|
+
fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
|
|
7
|
+
htmlColor?: string | undefined;
|
|
8
|
+
inheritViewBox?: boolean | undefined;
|
|
9
|
+
shapeRendering?: string | undefined;
|
|
10
|
+
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
11
|
+
titleAccess?: string | undefined;
|
|
12
|
+
viewBox?: string | undefined;
|
|
13
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<React.SVGProps<SVGSVGElement>, "ref"> & {
|
|
14
|
+
ref?: ((instance: SVGSVGElement | null) => void) | React.RefObject<SVGSVGElement> | null | undefined;
|
|
15
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "color" | "fontSize" | "shapeRendering" | "children" | "sx" | "htmlColor" | "inheritViewBox" | "titleAccess" | "viewBox"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
16
|
+
export declare const InfoOutlinedIconStyled: import("@emotion/styled").StyledComponent<{
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
|
|
19
|
+
color?: "inherit" | "disabled" | "error" | "info" | "success" | "action" | "primary" | "secondary" | "warning" | undefined;
|
|
20
|
+
fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
|
|
21
|
+
htmlColor?: string | undefined;
|
|
22
|
+
inheritViewBox?: boolean | undefined;
|
|
23
|
+
shapeRendering?: string | undefined;
|
|
24
|
+
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
25
|
+
titleAccess?: string | undefined;
|
|
26
|
+
viewBox?: string | undefined;
|
|
27
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<React.SVGProps<SVGSVGElement>, "ref"> & {
|
|
28
|
+
ref?: ((instance: SVGSVGElement | null) => void) | React.RefObject<SVGSVGElement> | null | undefined;
|
|
29
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "color" | "fontSize" | "shapeRendering" | "children" | "sx" | "htmlColor" | "inheritViewBox" | "titleAccess" | "viewBox"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
30
|
+
export interface IsAuthorizedSwitchProps {
|
|
31
|
+
show: boolean;
|
|
32
|
+
readOnly?: boolean;
|
|
33
|
+
isVerified?: boolean;
|
|
34
|
+
}
|
|
35
|
+
declare const _default: React.MemoExoticComponent<({ show, readOnly, isVerified }: IsAuthorizedSwitchProps) => import("react/jsx-runtime").JSX.Element>;
|
|
36
|
+
export default _default;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { useTranslation } from 'react-i18next';
|
|
15
|
+
import { useFormContext, useController } from 'react-hook-form';
|
|
16
|
+
import { styled, alpha } from '@mui/material/styles';
|
|
17
|
+
import InfoIcon from '@mui/icons-material/Info';
|
|
18
|
+
import Box from '@mui/material/Box';
|
|
19
|
+
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
|
|
20
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
|
+
import { useAppSelector, useAppDispatch } from '../../../../hooks';
|
|
22
|
+
import Collapse from '../../../../components/Collapse';
|
|
23
|
+
import RadioGroup from '../../../../components/RadioGroup';
|
|
24
|
+
import RadioLabel from '../../../../components/RadioLabel';
|
|
25
|
+
import Text from '../../../../components/Text';
|
|
26
|
+
import Mandatory from '../../../shared/Mandatory';
|
|
27
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
28
|
+
import { individualSelector, clearError } from '../../../app/individual/individualStore';
|
|
29
|
+
var LabelTextStyled = styled(Text)(function (_a) {
|
|
30
|
+
var theme = _a.theme;
|
|
31
|
+
return (__assign(__assign({}, theme.typography.caption), { color: alpha(theme.palette.text.primary, 0.6), marginBlockEnd: theme.spacing(0.625) }));
|
|
32
|
+
});
|
|
33
|
+
var RadioGroupStyled = styled(RadioGroup)(function (_a) {
|
|
34
|
+
var theme = _a.theme;
|
|
35
|
+
return ({
|
|
36
|
+
marginInlineStart: theme.spacing(0.25)
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
export var InfoIconStyled = styled(InfoIcon)(function (_a) {
|
|
40
|
+
var theme = _a.theme;
|
|
41
|
+
return ({
|
|
42
|
+
width: theme.spacing(2.75),
|
|
43
|
+
height: theme.spacing(2.125),
|
|
44
|
+
cursor: 'pointer',
|
|
45
|
+
color: alpha(theme.palette.text.primary, 0.4)
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
export var InfoOutlinedIconStyled = styled(InfoOutlinedIcon)(function (_a) {
|
|
49
|
+
var theme = _a.theme;
|
|
50
|
+
return ({
|
|
51
|
+
width: theme.spacing(2.75),
|
|
52
|
+
height: theme.spacing(2.125),
|
|
53
|
+
cursor: 'pointer',
|
|
54
|
+
color: alpha(theme.palette.text.primary, 0.4)
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
var RadioLabelStyled = styled('span')(function () { return ({
|
|
58
|
+
display: 'flex'
|
|
59
|
+
}); });
|
|
60
|
+
var IsAuthorizedSwitch = function (_a) {
|
|
61
|
+
var show = _a.show, readOnly = _a.readOnly, isVerified = _a.isVerified;
|
|
62
|
+
var control = useFormContext().control;
|
|
63
|
+
var t = useTranslation().t;
|
|
64
|
+
var authorizedControl = useController({ name: 'isAuthorized', control: control });
|
|
65
|
+
var error = useAppSelector(individualSelector).error;
|
|
66
|
+
var dispatch = useAppDispatch();
|
|
67
|
+
var handleOnChange = function (_a) {
|
|
68
|
+
var target = _a.target;
|
|
69
|
+
if (error)
|
|
70
|
+
dispatch(clearError());
|
|
71
|
+
authorizedControl.field.onChange(target.value === 'yes');
|
|
72
|
+
};
|
|
73
|
+
var authorizedValue = authorizedControl.field.value;
|
|
74
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pt: 2.5, pl: 2.5, pr: 2.5 } }, { children: [_jsx(Box, __assign({ style: { display: 'flex', justifyContent: 'space-between' } }, { children: _jsxs(LabelTextStyled, { children: [t('is_authorized_user_label'), _jsx(Mandatory, {})] }) })), _jsxs(RadioGroupStyled, __assign({ readOnly: readOnly, value: authorizedValue ? 'yes' : 'no', onChange: readOnly ? undefined : handleOnChange }, { children: [_jsx(RadioLabel, { value: 'yes', label: _jsxs(RadioLabelStyled, { children: [t('yes'), authorizedValue && isVerified && _jsx(CheckIcon, { sx: { marginInlineStart: '5px' }, isVerified: isVerified })] }) }), _jsx(RadioLabel, { value: 'no', label: _jsxs(RadioLabelStyled, { children: [t('no'), authorizedValue === false && isVerified && _jsx(CheckIcon, { sx: { marginInlineStart: '5px' }, isVerified: isVerified })] }) })] }))] })) })));
|
|
75
|
+
};
|
|
76
|
+
export default React.memo(IsAuthorizedSwitch);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
import { IndividualType } from '../../../../@types';
|
|
3
|
-
export declare const IndividualInfoValidationSchema: (objects: Array<IndividualType>, isKWCountry: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
export declare const IndividualInfoValidationSchema: (objects: Array<IndividualType>, isKWCountry: boolean, hasAuthorizedField: boolean) => 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>>;
|
|
@@ -10,6 +10,7 @@ export declare const IndividualInfoValidationSchema: (objects: Array<IndividualT
|
|
|
10
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
|
+
isAuthorized: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
13
14
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
14
15
|
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>>;
|
|
15
16
|
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>>;
|
|
@@ -20,6 +21,7 @@ export declare const IndividualInfoValidationSchema: (objects: Array<IndividualT
|
|
|
20
21
|
isInfluencer: yup.BooleanSchema<boolean | null | undefined, import("yup/lib/types").AnyObject, boolean | null | undefined>;
|
|
21
22
|
shareCount: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
22
23
|
shareValue: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
24
|
+
isAuthorized: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
23
25
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
24
26
|
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>>;
|
|
25
27
|
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>>;
|
|
@@ -30,4 +32,5 @@ export declare const IndividualInfoValidationSchema: (objects: Array<IndividualT
|
|
|
30
32
|
isInfluencer: yup.BooleanSchema<boolean | null | undefined, import("yup/lib/types").AnyObject, boolean | null | undefined>;
|
|
31
33
|
shareCount: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
32
34
|
shareValue: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
35
|
+
isAuthorized: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
|
|
33
36
|
}>>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
import { getIndividualType } from '../../../../utils';
|
|
3
|
-
export var IndividualInfoValidationSchema = function (objects, isKWCountry) {
|
|
3
|
+
export var IndividualInfoValidationSchema = function (objects, isKWCountry, hasAuthorizedField) {
|
|
4
4
|
var isUserType = getIndividualType(objects).isUser;
|
|
5
5
|
return yup.object().shape({
|
|
6
6
|
occupation: isUserType ? yup.object().required('alert_choose_occupation') : yup.object().optional(),
|
|
@@ -11,6 +11,7 @@ export var IndividualInfoValidationSchema = function (objects, isKWCountry) {
|
|
|
11
11
|
isPEP: isUserType ? yup.boolean().required('please_choose_relative_pep') : yup.boolean().optional().nullable(),
|
|
12
12
|
isInfluencer: isUserType && isKWCountry ? yup.boolean().required('please_choose_are_you_influncer') : yup.boolean().optional().nullable(),
|
|
13
13
|
shareCount: yup.string().optional(),
|
|
14
|
-
shareValue: yup.string().optional()
|
|
14
|
+
shareValue: yup.string().optional(),
|
|
15
|
+
isAuthorized: hasAuthorizedField ? yup.boolean().required('please_choose_is_authorized') : yup.boolean().optional()
|
|
15
16
|
});
|
|
16
17
|
};
|
|
@@ -25,7 +25,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
25
25
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
26
26
|
import { alpha, styled, useTheme } from '@mui/material/styles';
|
|
27
27
|
import Box from '@mui/material/Box';
|
|
28
|
-
import { getUserName, isValidEmail } from '../../../../utils';
|
|
28
|
+
import { getUserName, isKWOrSA, isValidEmail } from '../../../../utils';
|
|
29
29
|
import { useLanguage, useAppSelector, useAppDispatch, useSetFromDefaultValues } from '../../../../hooks';
|
|
30
30
|
import { IndividualType } from '../../../../@types';
|
|
31
31
|
import Collapse from '../../../../components/Collapse';
|
|
@@ -35,9 +35,10 @@ import Text from '../../../../components/Text';
|
|
|
35
35
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
36
36
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
37
37
|
import { addDetailsAsync, individualSelector, requestDetailsByEmail, resetIndividualData } from '../../../app/individual/individualStore';
|
|
38
|
-
import IndividualActionButtons from '
|
|
38
|
+
import IndividualActionButtons from '../../../shared/Button/IndividualActionButtons';
|
|
39
39
|
import { IndividualCollectInfoValidationSchema } from './validation';
|
|
40
40
|
import CollectPhoneEmail from './CollectPhoneEmail';
|
|
41
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
41
42
|
var ScreenContainerStyled = styled(ScreenContainer)(function (_a) {
|
|
42
43
|
var theme = _a.theme;
|
|
43
44
|
return ({
|
|
@@ -85,10 +86,11 @@ var UserList = function (_a) {
|
|
|
85
86
|
var _j = React.useState(false), emailChecking = _j[0], setEmailChecking = _j[1];
|
|
86
87
|
var theme = useTheme();
|
|
87
88
|
var _k = useAppSelector(individualSelector), data = _k.data, loading = _k.loading, error = _k.error;
|
|
89
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
88
90
|
var _l = data.individualCollectData, email = _l.email, mobile = _l.mobile, responseBody = _l.responseBody;
|
|
89
91
|
var is_available = (responseBody || {}).is_available;
|
|
90
92
|
var verify = data.verify;
|
|
91
|
-
var _m = verify.responseBody || {}, userList = _m.userList, notification = _m.notification;
|
|
93
|
+
var _m = verify.responseBody || {}, userList = _m.userList, notification = _m.notification, userRes = _m.user;
|
|
92
94
|
var methods = useForm({
|
|
93
95
|
resolver: yupResolver(IndividualCollectInfoValidationSchema(activeUser)),
|
|
94
96
|
defaultValues: {
|
|
@@ -158,6 +160,8 @@ var UserList = function (_a) {
|
|
|
158
160
|
};
|
|
159
161
|
var isSameUserRequestedBefore = function (user) {
|
|
160
162
|
var _a, _b;
|
|
163
|
+
if (!(userRes === null || userRes === void 0 ? void 0 : userRes.is_authorized) && !isKWOrSA(settingsData.businessCountry.iso2))
|
|
164
|
+
return false;
|
|
161
165
|
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
166
|
};
|
|
163
167
|
var getUserStatus = function (user) {
|
|
@@ -18,7 +18,7 @@ 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 { convertToEnglishDateFormat, deepCopy, getUserName, isOtherThanKWOrSA } from '../../../../utils';
|
|
21
|
+
import { convertToEnglishDateFormat, deepCopy, getUserName, isKWOrSA, isOtherThanKWOrSA } from '../../../../utils';
|
|
22
22
|
import Form from '../../../../components/Form';
|
|
23
23
|
import Collapse from '../../../../components/Collapse';
|
|
24
24
|
import Text from '../../../../components/Text';
|
|
@@ -144,9 +144,10 @@ var IndividualPersonalInfo = function (_a) {
|
|
|
144
144
|
dispatch(clearError());
|
|
145
145
|
}, [methods.formState.isValid]);
|
|
146
146
|
var onBack = function () {
|
|
147
|
+
var isKWOrSaCountry = isKWOrSA(settingsData.businessCountry.iso2);
|
|
147
148
|
if (error)
|
|
148
149
|
dispatch(clearError());
|
|
149
|
-
if (is_authorized) {
|
|
150
|
+
if (is_authorized || !isKWOrSaCountry) {
|
|
150
151
|
dispatch(handleCurrentActiveScreen('INDIVIDUAL_LIST_STEP'));
|
|
151
152
|
return;
|
|
152
153
|
}
|
|
@@ -57,7 +57,7 @@ import { ICONS_NAMES } from '../../../constants';
|
|
|
57
57
|
import CheckIcon from '@mui/icons-material/Check';
|
|
58
58
|
import { useAppDispatch, useAppSelector, useLanguage } from '../../../hooks';
|
|
59
59
|
import { handleOpen, handleCurrentActiveScreen, handleNextScreenStep, settingsSelector } from '../../../app/settings';
|
|
60
|
-
import { dangerousMessage, getScreenNameBasedOnFlow } from '../../../utils';
|
|
60
|
+
import { dangerousMessage, getScreenNameBasedOnFlow, isKWOrSA } from '../../../utils';
|
|
61
61
|
import API from '../../../api';
|
|
62
62
|
import Text from '../../../components/Text';
|
|
63
63
|
import Dot from '../Dot';
|
|
@@ -161,7 +161,8 @@ export default function FlowsButtons(_a) {
|
|
|
161
161
|
if (!item.href)
|
|
162
162
|
return;
|
|
163
163
|
if (flowName === item.name && item.name !== 'password') {
|
|
164
|
-
|
|
164
|
+
var isOtherThanSAOrKWCountry = !isKWOrSA(settingsData.businessCountry.iso2);
|
|
165
|
+
dispatch(handleCurrentActiveScreen(getScreenNameBasedOnFlow(item.name, isAuthorizedUser, isOtherThanSAOrKWCountry)));
|
|
165
166
|
return;
|
|
166
167
|
}
|
|
167
168
|
if (typeof settingsData.appConfig.onBoardButtonClick === 'function') {
|
package/build/utils/string.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ export declare const getRequestHeaders: (deviceInfo: DeviceInfo) => {
|
|
|
42
42
|
};
|
|
43
43
|
export declare const removeRequestHeaders: () => void;
|
|
44
44
|
export declare const getBaseUrl: () => string;
|
|
45
|
-
export declare const getScreenNameBasedOnFlow: (flow: string, isAuthorizedUser?: boolean) => "CONNECT_NID_STEP" | "" | "BUSINESS_BUSINESS_TYPE_STEP" | "INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP" | "INDIVIDUAL_LIST_STEP" | "BANK_BANK_DETAILS_STEP" | "TAX_TAX_DETAILS_STEP" | "ENTITY_NAME_STEP" | "BRAND_INFO_STEP";
|
|
45
|
+
export declare const getScreenNameBasedOnFlow: (flow: string, isAuthorizedUser?: boolean, isOtherThanSAOrKWCountry?: boolean) => "CONNECT_NID_STEP" | "" | "BUSINESS_BUSINESS_TYPE_STEP" | "INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP" | "INDIVIDUAL_LIST_STEP" | "BANK_BANK_DETAILS_STEP" | "TAX_TAX_DETAILS_STEP" | "ENTITY_NAME_STEP" | "BRAND_INFO_STEP";
|
|
46
46
|
export declare const getEighteenYearsAgo: () => string;
|
|
47
47
|
export declare const isKW: (flag: string) => boolean;
|
|
48
48
|
export declare const isSA: (flag: string) => boolean;
|
package/build/utils/string.js
CHANGED
|
@@ -172,7 +172,7 @@ export var getBaseUrl = function () {
|
|
|
172
172
|
}
|
|
173
173
|
return ENDPOINT_PATHS.PRODUCTION_BASE_URL;
|
|
174
174
|
};
|
|
175
|
-
export var getScreenNameBasedOnFlow = function (flow, isAuthorizedUser) {
|
|
175
|
+
export var getScreenNameBasedOnFlow = function (flow, isAuthorizedUser, isOtherThanSAOrKWCountry) {
|
|
176
176
|
if (flow === FlowsTypes.BANK) {
|
|
177
177
|
return 'BANK_BANK_DETAILS_STEP';
|
|
178
178
|
}
|
|
@@ -180,7 +180,7 @@ export var getScreenNameBasedOnFlow = function (flow, isAuthorizedUser) {
|
|
|
180
180
|
return 'BUSINESS_BUSINESS_TYPE_STEP';
|
|
181
181
|
}
|
|
182
182
|
if (flow === FlowsTypes.INDIVIDUAL) {
|
|
183
|
-
return isAuthorizedUser ? 'INDIVIDUAL_LIST_STEP' : 'INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP';
|
|
183
|
+
return isAuthorizedUser || isOtherThanSAOrKWCountry ? 'INDIVIDUAL_LIST_STEP' : 'INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP';
|
|
184
184
|
}
|
|
185
185
|
if (flow === FlowsTypes.CONNECT) {
|
|
186
186
|
return 'CONNECT_NID_STEP';
|