@tap-payments/auth-jsconnect 2.4.21-test → 2.4.25-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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, getIndividualType } 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, id, type, birth, countryCode;
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
- id = user.id, type = user.type, birth = user.birth;
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: return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type }))];
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, type, _b, resEmail, resPhone, isPhoneAndEmailAvailable, email, mobile, countryCode, hasContact, individualData, hasPhone, requestBody, data_2, payload, data;
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, type = user.type;
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
- id: id,
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.updateIndividual(requestBody)];
266
+ return [4, API.individualService.updateMultipleIndividual(requestBody)];
270
267
  case 1:
271
268
  data_2 = _d.sent();
272
- individualData = data_2 === null || data_2 === void 0 ? void 0 : data_2.user;
273
- if (type === IndividualType.SHARE_HOLDER)
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: 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(__assign({}, individualData), { type: type }) }];
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, _a, users, shareholders, board_members, userList, shareHolderList, boardMemberList, individualList;
308
- return __generator(this, function (_b) {
309
- switch (_b.label) {
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
- _a = _b.sent(), users = _a.users, shareholders = _a.shareholders, board_members = _a.board_members;
319
- userList = (users || []).map(function (user) { return (__assign(__assign({}, user), { type: IndividualType.USER })); });
320
- shareHolderList = (shareholders || []).map(function (shareholder) { return (__assign(__assign({}, shareholder), { type: IndividualType.SHARE_HOLDER })); });
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, { data: __assign(__assign({}, (individualData || {})), { type: type }), countryCode: countryCode, countries: settings.data.countries }];
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, _c, id, type, mobile, countryCode, requestBody, data;
515
- var _d;
516
- return __generator(this, function (_e) {
517
- switch (_e.label) {
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
- _c = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.source) || {}, id = _c.id, type = _c.type;
512
+ id = ((responseBody === null || responseBody === void 0 ? void 0 : responseBody.source) || {}).id;
522
513
  mobile = formData.mobile, countryCode = formData.countryCode;
523
514
  requestBody = {
524
- id: id,
525
- type: type,
515
+ ids: [id],
526
516
  contact: {
527
517
  phone: {
528
- country_code: (_d = countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix) === null || _d === void 0 ? void 0 : _d.toString(),
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.updateIndividual(requestBody)];
523
+ return [4, API.individualService.updateMultipleIndividual(requestBody)];
534
524
  case 1:
535
- data = _e.sent();
525
+ data = _d.sent();
536
526
  return [4, thunkApi.dispatch(verifyToken({ token: token, isUpdatePhoneInfo: true }))];
537
527
  case 2:
538
- _e.sent();
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, id, type, 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
- var _e, _f, _g, _h, _j;
549
- return __generator(this, function (_k) {
550
- switch (_k.label) {
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, _e, isUser, isBuyer, isUserORBuyerType;
538
+ var _f, _g, _h, _j, _k;
539
+ return __generator(this, function (_l) {
540
+ switch (_l.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
- _d = ((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _d.id, type = _d.type;
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;
@@ -561,8 +552,8 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
561
552
  isNameENNonEditable = hasNoneEditableValue(data_status, 'name.en');
562
553
  isNameARNonEditable = hasNoneEditableValue(data_status, 'name.ar');
563
554
  isEmailNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.contact, 'email');
564
- isMobileNumberNonEditable = hasNoneEditableValue((_e = data_status === null || data_status === void 0 ? void 0 : data_status.contact) === null || _e === void 0 ? void 0 : _e.phone, 'number');
565
- isMobileCountryNonEditable = hasNoneEditableValue((_f = data_status === null || data_status === void 0 ? void 0 : data_status.contact) === null || _f === void 0 ? void 0 : _f.phone, 'country_code');
555
+ isMobileNumberNonEditable = hasNoneEditableValue((_f = data_status === null || data_status === void 0 ? void 0 : data_status.contact) === null || _f === void 0 ? void 0 : _f.phone, 'number');
556
+ isMobileCountryNonEditable = hasNoneEditableValue((_g = data_status === null || data_status === void 0 ? void 0 : data_status.contact) === null || _g === void 0 ? void 0 : _g.phone, 'country_code');
566
557
  isNidNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.identification, 'id');
567
558
  isIssuedCountryNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.identification, 'issuer_country');
568
559
  isExpiryNonEditable = hasNoneEditableValue(data_status === null || data_status === void 0 ? void 0 : data_status.identification, 'expiry');
@@ -573,17 +564,17 @@ 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 || issuedCountry || identification_id_type || expiryDate;
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)
580
571
  ? __assign({ email: isEmailNonEditable ? undefined : email }, (!((isMobileCountryNonEditable && isMobileNumberNonEditable) || !hasPhone) && {
581
572
  phone: {
582
- country_code: isMobileCountryNonEditable ? undefined : (_g = countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix) === null || _g === void 0 ? void 0 : _g.toString(),
573
+ country_code: isMobileCountryNonEditable ? undefined : (_h = countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix) === null || _h === void 0 ? void 0 : _h.toString(),
583
574
  number: isMobileNumberNonEditable || !mobile ? undefined : mobile
584
575
  }
585
576
  })) : undefined;
586
- requestBody = __assign(__assign(__assign(__assign(__assign(__assign(__assign({ id: id, type: type, gender: isGenderNonEditable || !gender ? undefined : gender }, (nameIsEditable && {
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,17 +610,19 @@ 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.updateIndividual(requestBody)];
613
+ return [4, API.individualService.updateMultipleIndividual(requestBody)];
623
614
  case 1:
624
- data = _k.sent();
625
- if (!(type === IndividualType.USER || type === IndividualType.BUYER)) return [3, 3];
615
+ data = _l.sent();
616
+ _e = getIndividualType(objects), isUser = _e.isUser, isBuyer = _e.isBuyer;
617
+ isUserORBuyerType = isUser || isBuyer;
618
+ if (!isUserORBuyerType) return [3, 3];
626
619
  return [4, thunkApi.dispatch(retrieveDataList(code))];
627
620
  case 2:
628
- _k.sent();
629
- _k.label = 3;
621
+ _l.sent();
622
+ _l.label = 3;
630
623
  case 3:
631
624
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
632
- (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, requestBody);
625
+ (_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, requestBody);
633
626
  return [2, { data: data, formData: originalFormData }];
634
627
  }
635
628
  });
@@ -638,14 +631,15 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
638
631
  export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (_a, thunkApi) {
639
632
  var formData = _a.formData, originalFormData = _a.originalFormData;
640
633
  return __awaiter(void 0, void 0, void 0, function () {
641
- var _b, settings, individual, _c, notification, user, _d, id, type, 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
- var _e, _f;
643
- return __generator(this, function (_g) {
644
- switch (_g.label) {
634
+ 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, requestBody, data, businessCountry, hasCivilIdDocument, hasSignatureDocument, isSendSignatureFile, civilIdDocument, signatureDocument, documentBody, documentBody, documentsList, documentBody;
635
+ var _f, _g;
636
+ return __generator(this, function (_h) {
637
+ switch (_h.label) {
645
638
  case 0:
646
639
  _b = thunkApi.getState(), settings = _b.settings, individual = _b.individual;
647
640
  _c = individual.data.verify.responseBody || {}, notification = _c.notification, user = _c.user;
648
- _d = ((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _d.id, type = _d.type;
641
+ id = (((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : notification === null || notification === void 0 ? void 0 : notification.recipient) || {}).id;
642
+ _d = user || {}, objects = _d.objects, ids = _d.ids;
649
643
  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
644
  isOccupationNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'occupation');
651
645
  isSourceIncomeNonEditable = hasNoneEditableValue(user === null || user === void 0 ? void 0 : user.data_status, 'source_of_income');
@@ -682,23 +676,20 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
682
676
  source_income: sourceIncomeInfo,
683
677
  monthly_income: monthlyIncomeInfo
684
678
  };
679
+ _e = getIndividualType(objects), isUser = _e.isUser, isShareholder = _e.isShareholder, isBoardMember = _e.isBoardMember, isBuyer = _e.isBuyer, isCustomer = _e.isCustomer;
680
+ isUserORBuyerType = isUser || isBuyer;
685
681
  payload = userPayload;
686
- if (type === IndividualType.SHARE_HOLDER)
687
- payload = shareHolderPayload;
688
- if (type === IndividualType.BOARD_MEMBER)
689
- payload = boardMemberPayload;
690
- if (type === IndividualType.BUYER)
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)];
682
+ if (objects === null || objects === void 0 ? void 0 : objects.length) {
683
+ payload = __assign(__assign(__assign(__assign(__assign({}, (isUser && payload)), (isShareholder && shareHolderPayload)), (isBoardMember && boardMemberPayload)), (isBuyer && buyerMemberPayload)), (isCustomer && {}));
684
+ }
685
+ 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 });
686
+ return [4, API.individualService.updateMultipleIndividual(requestBody)];
696
687
  case 1:
697
- data = _g.sent();
688
+ data = _h.sent();
698
689
  businessCountry = settings.data.businessCountry;
699
690
  hasCivilIdDocument = (civilID || []).length > 0;
700
691
  hasSignatureDocument = (signatureFileId || []).length > 0;
701
- isSendSignatureFile = (user === null || user === void 0 ? void 0 : user.is_authorized) && (type === IndividualType.USER || type === IndividualType.BUYER);
692
+ isSendSignatureFile = (user === null || user === void 0 ? void 0 : user.is_authorized) && isUserORBuyerType;
702
693
  civilIdDocument = getRecentDocumentBasedOnPurpose(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.IDENTITY_DOCUMENT);
703
694
  signatureDocument = getRecentDocumentBasedOnPurpose(user === null || user === void 0 ? void 0 : user.documents, DocumentPurpose.CUSTOMER_SIGNATURE);
704
695
  if (!((civilIdDocument === null || civilIdDocument === void 0 ? void 0 : civilIdDocument.id) && hasCivilIdDocument)) return [3, 3];
@@ -708,8 +699,8 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
708
699
  };
709
700
  return [4, API.documentService.addFilesToExistingDocument(documentBody)];
710
701
  case 2:
711
- _g.sent();
712
- _g.label = 3;
702
+ _h.sent();
703
+ _h.label = 3;
713
704
  case 3:
714
705
  if (!((signatureDocument === null || signatureDocument === void 0 ? void 0 : signatureDocument.id) && hasSignatureDocument && isSendSignatureFile)) return [3, 5];
715
706
  documentBody = {
@@ -718,8 +709,8 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
718
709
  };
719
710
  return [4, API.documentService.addFilesToExistingDocument(documentBody)];
720
711
  case 4:
721
- _g.sent();
722
- _g.label = 5;
712
+ _h.sent();
713
+ _h.label = 5;
723
714
  case 5:
724
715
  documentsList = [];
725
716
  if (hasCivilIdDocument && !(civilIdDocument === null || civilIdDocument === void 0 ? void 0 : civilIdDocument.id))
@@ -728,17 +719,17 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
728
719
  documentsList.push({ type: DocumentPurpose.CUSTOMER_SIGNATURE, images: signatureFileId });
729
720
  if (!(documentsList.length > 0)) return [3, 7];
730
721
  documentBody = {
731
- individual_type_id: id || '',
722
+ individual_type_id: ((ids === null || ids === void 0 ? void 0 : ids.length) ? ids.find(function (i) { return i.includes('usr_'); }) : id) || '',
732
723
  country: businessCountry.iso2,
733
724
  documents: documentsList
734
725
  };
735
726
  return [4, API.documentService.updateDocumentInfo(documentBody)];
736
727
  case 6:
737
- _g.sent();
738
- _g.label = 7;
728
+ _h.sent();
729
+ _h.label = 7;
739
730
  case 7:
740
731
  thunkApi.dispatch(handleNextScreenStep());
741
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, requestBody);
732
+ (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, requestBody);
742
733
  return [2, { data: data, formData: originalFormData }];
743
734
  }
744
735
  });
@@ -837,7 +828,6 @@ var initialState = {
837
828
  sourceIncome: undefined,
838
829
  monthlyIncome: undefined,
839
830
  employerName: '',
840
- employerLocation: undefined,
841
831
  isPEP: null,
842
832
  isInfluencer: null,
843
833
  shareCount: '',
@@ -939,10 +929,74 @@ export var individualSlice = createSlice({
939
929
  state.error = null;
940
930
  })
941
931
  .addCase(addDetailsAsync.fulfilled, function (state, action) {
932
+ var _a, _b, _c, _d;
942
933
  state.loading = false;
943
934
  state.error = null;
944
- var userList = action.payload.userList;
935
+ var _e = action.payload, userList = _e.userList, individualId = _e.individualId, countries = _e.countries;
936
+ var primaryUser = (state.data.verify.responseBody || {}).user;
937
+ var user = (userList || []).find(function (user) { return user.individual_id === individualId; });
945
938
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { userList: userList });
939
+ 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 }) });
940
+ 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;
941
+ var _g = state.data.individualData.responseBody || {}, sourceIncomeList = _g.sourceIncomeList, monthlyIncomeList = _g.monthlyIncomeList, occupationList = _g.occupationList;
942
+ var cityList = (state.data.verify.responseBody || {}).cityList;
943
+ if (user)
944
+ state.data.individualPersonalData.name = getUserName(user, false);
945
+ if (contact === null || contact === void 0 ? void 0 : contact.email)
946
+ state.data.individualPersonalData.email = contact === null || contact === void 0 ? void 0 : contact.email;
947
+ if ((_a = contact === null || contact === void 0 ? void 0 : contact.phone) === null || _a === void 0 ? void 0 : _a.number)
948
+ state.data.individualPersonalData.mobile = (_b = contact === null || contact === void 0 ? void 0 : contact.phone) === null || _b === void 0 ? void 0 : _b.number;
949
+ if ((_c = contact === null || contact === void 0 ? void 0 : contact.phone) === null || _c === void 0 ? void 0 : _c.country_code) {
950
+ 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;
951
+ }
952
+ if (gender)
953
+ state.data.individualPersonalData.gender = gender.toLowerCase();
954
+ if (identification === null || identification === void 0 ? void 0 : identification.id)
955
+ state.data.individualPersonalData.nid = identification === null || identification === void 0 ? void 0 : identification.id;
956
+ if (identification === null || identification === void 0 ? void 0 : identification.issued_country_code) {
957
+ state.data.individualPersonalData.issuedCountry = findCountryByIso2(countries, identification === null || identification === void 0 ? void 0 : identification.issued_country_code);
958
+ }
959
+ var expiryDate = new Date((identification === null || identification === void 0 ? void 0 : identification.expiry) || new Date().getTime());
960
+ state.data.individualPersonalData.expiryDate = convertNumbers2English(dateFormat(expiryDate));
961
+ if (birth === null || birth === void 0 ? void 0 : birth.date)
962
+ state.data.individualPersonalData.dob = convertNumbers2English(dateFormat(new Date(birth === null || birth === void 0 ? void 0 : birth.date)));
963
+ if (birth === null || birth === void 0 ? void 0 : birth.country) {
964
+ state.data.individualPersonalData.placeOfBirthCountry = findCountryByIso2(countries, birth === null || birth === void 0 ? void 0 : birth.country);
965
+ }
966
+ if (birth === null || birth === void 0 ? void 0 : birth.city) {
967
+ var selectedCity = cityList === null || cityList === void 0 ? void 0 : cityList.find(function (city) {
968
+ var _a;
969
+ return city.id === ((_a = birth === null || birth === void 0 ? void 0 : birth.city) === null || _a === void 0 ? void 0 : _a.cityId);
970
+ });
971
+ state.data.individualPersonalData.placeOfBirthCity = selectedCity;
972
+ }
973
+ if (nationality) {
974
+ state.data.individualPersonalData.nationality = findCountryByIso2(countries, nationality);
975
+ }
976
+ var _h = shares || {}, count = _h.count, value = _h.value;
977
+ var shareCount = count === null || count === void 0 ? void 0 : count.toString();
978
+ var shareValue = value === null || value === void 0 ? void 0 : value.toString();
979
+ if (shareCount) {
980
+ state.data.individualData.shareCount = shareCount;
981
+ }
982
+ if (shareValue) {
983
+ state.data.individualData.shareValue = formatNumberAsCurrency(shareValue);
984
+ }
985
+ 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]);
986
+ if (!!selectedSourceIncome)
987
+ state.data.individualData.sourceIncome = selectedSourceIncome;
988
+ var selectedMonthlyIncome = monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) {
989
+ return income.id === (monthly_income === null || monthly_income === void 0 ? void 0 : monthly_income.id);
990
+ });
991
+ var selectedOccupation = occupationList === null || occupationList === void 0 ? void 0 : occupationList.find(function (occup) {
992
+ return occup.id === (occupation === null || occupation === void 0 ? void 0 : occupation.id);
993
+ });
994
+ state.data.individualData.monthlyIncome = selectedMonthlyIncome;
995
+ state.data.individualData.occupation = selectedOccupation;
996
+ if (is_relative_PEP !== undefined)
997
+ state.data.individualData.isPEP = is_relative_PEP;
998
+ if (is_influencer !== undefined)
999
+ state.data.individualData.isInfluencer = is_influencer;
946
1000
  })
947
1001
  .addCase(addDetailsAsync.rejected, function (state, action) {
948
1002
  state.loading = false;
@@ -975,10 +1029,10 @@ export var individualSlice = createSlice({
975
1029
  .addCase(retrieveIndividualInfo.fulfilled, function (state, action) {
976
1030
  var _a, _b, _c, _d;
977
1031
  state.error = null;
978
- var _e = action.payload, data = _e.data, countries = _e.countries, countryCode = _e.countryCode;
1032
+ var _e = action.payload, data = _e.data, countries = _e.countries;
979
1033
  var user = (state.data.verify.responseBody || {}).user;
980
1034
  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, employer_country = _f.employer_country, shares = _f.shares;
1035
+ 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
1036
  var _g = state.data.individualData.responseBody || {}, sourceIncomeList = _g.sourceIncomeList, monthlyIncomeList = _g.monthlyIncomeList, occupationList = _g.occupationList;
983
1037
  var cityList = (state.data.verify.responseBody || {}).cityList;
984
1038
  if (data)
@@ -994,7 +1048,6 @@ export var individualSlice = createSlice({
994
1048
  state.data.individualPersonalData.gender = gender.toLowerCase();
995
1049
  if (identification === null || identification === void 0 ? void 0 : identification.id)
996
1050
  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
1051
  if (identification === null || identification === void 0 ? void 0 : identification.issued_country_code) {
999
1052
  state.data.individualPersonalData.issuedCountry = findCountryByIso2(countries, identification === null || identification === void 0 ? void 0 : identification.issued_country_code);
1000
1053
  }
@@ -1027,11 +1080,6 @@ export var individualSlice = createSlice({
1027
1080
  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
1081
  if (!!selectedSourceIncome)
1029
1082
  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
1083
  var selectedMonthlyIncome = monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) {
1036
1084
  return income.id === (monthly_income === null || monthly_income === void 0 ? void 0 : monthly_income.id);
1037
1085
  });
@@ -1102,10 +1150,10 @@ export var individualSlice = createSlice({
1102
1150
  var cityList = action.payload;
1103
1151
  state.data.verify.responseBody = __assign(__assign({}, data), { cityList: cityList });
1104
1152
  var birth = (((_a = state.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.user) || {}).birth;
1105
- var city = (birth || {}).city;
1106
- if (city) {
1107
- var selectedCity = cityList === null || cityList === void 0 ? void 0 : cityList.find(function (c) {
1108
- return c.name.en === city;
1153
+ if (birth === null || birth === void 0 ? void 0 : birth.city) {
1154
+ var selectedCity = cityList === null || cityList === void 0 ? void 0 : cityList.find(function (city) {
1155
+ var _a;
1156
+ return city.id === ((_a = birth === null || birth === void 0 ? void 0 : birth.city) === null || _a === void 0 ? void 0 : _a.cityId);
1109
1157
  });
1110
1158
  state.data.individualPersonalData.placeOfBirthCity = selectedCity;
1111
1159
  }
@@ -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 { isSA } from '../../../../utils';
22
+ import { getIndividualType, isSA } from '../../../../utils';
23
23
  import Form from '../../../../components/Form';
24
24
  import Collapse from '../../../../components/Collapse';
25
25
  import Text from '../../../../components/Text';
@@ -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, employerLocation = _d.employerLocation, 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 || {}, type = _e.type, 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;
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(user === null || user === void 0 ? void 0 : user.type)),
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,36 @@ var AdditionalIndividualInfo = function (_a) {
116
115
  setListActive(flag);
117
116
  };
118
117
  var getUserName = function () {
119
- var _a, _b;
120
- 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;
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 (type === IndividualType.SHARE_HOLDER)
128
+ if (objects === null || objects === void 0 ? void 0 : objects.includes(IndividualType.SHARE_HOLDER))
128
129
  return t('type_share_holder');
129
- if (type === IndividualType.BOARD_MEMBER)
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 = type === IndividualType.USER || type === IndividualType.BUYER;
134
- var showOccupationFile = type === IndividualType.USER || type === IndividualType.BUYER;
135
- var showSourceOfIncome = type === IndividualType.USER || type === IndividualType.BUYER;
136
- var showIsPEP = type === IndividualType.USER || type === IndividualType.BOARD_MEMBER;
137
- var showIsInfluencer = type === IndividualType.USER || type === IndividualType.BOARD_MEMBER;
138
- var showShares = type === IndividualType.SHARE_HOLDER;
134
+ var _g = React.useMemo(function () { return getIndividualType(objects); }, [objects]), isUser = _g.isUser, isShareholder = _g.isShareholder, isBoardMember = _g.isBoardMember, isBuyer = _g.isBuyer;
135
+ var isUserORBuyerType = isUser || isBuyer;
136
+ var isUserORBoardMemberType = isUser || isBoardMember;
137
+ var showSignatureFile = isUserORBuyerType;
138
+ var showOccupationFile = isUserORBuyerType;
139
+ var showSourceOfIncome = isUserORBuyerType;
140
+ var showIsPEP = isUserORBoardMemberType;
141
+ var showIsInfluencer = isUserORBoardMemberType;
142
+ var showShares = isShareholder;
139
143
  var isSourceOfIncomeListActive = listActive === ListType.SourceOfIncomeList;
140
144
  var isMonthlyIncomeListActive = listActive === ListType.MonthlyIncomeList;
141
145
  var isOccupationListActive = listActive === ListType.OccupationList;
142
146
  var disabled = !methods.formState.isValid || civilIDUploading || signatureFileUploading;
143
- return (_jsxs(ScreenContainer, { children: [_jsx(Collapse, __assign({ in: !listActive && !!is_authorized, timeout: 500 }, { children: _jsxs(TextBoxStyled, { children: [getUserName() || '', _jsx(RoleTextStyled, { children: getUserRole() || '' })] }) })), _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Box, { children: [_jsx(Occupation, { 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') })) }))] })) }))] }));
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: !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
148
  };
145
149
  export default React.memo(AdditionalIndividualInfo);
146
150
  AdditionalIndividualInfo.defaultProps = {};