@tap-payments/auth-jsconnect 2.1.77-test → 2.1.78-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (21) hide show
  1. package/build/api/individual.d.ts +7 -3
  2. package/build/assets/locales/ar.json +5 -1
  3. package/build/assets/locales/en.json +5 -1
  4. package/build/features/app/brand/brandStore.js +1 -1
  5. package/build/features/app/connect/connectStore.js +2 -2
  6. package/build/features/app/individual/individualStore.d.ts +1 -0
  7. package/build/features/app/individual/individualStore.js +102 -86
  8. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +1 -1
  9. package/build/features/individual/screens/AdditionalIndividualInfo/EmployerLocation.js +1 -1
  10. package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +2 -2
  11. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +2 -2
  12. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +6 -5
  13. package/build/features/individual/screens/IndividualList/IndividualList.js +2 -3
  14. package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.js +23 -5
  15. package/build/features/individual/screens/IndividualPersonalInfo/BirthCountry.js +1 -1
  16. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +9 -3
  17. package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.js +1 -1
  18. package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.js +1 -1
  19. package/build/features/individual/screens/IndividualPersonalInfo/Nationality.js +1 -1
  20. package/build/features/individual/screens/Verify/Verify.js +10 -17
  21. package/package.json +1 -1
@@ -53,8 +53,12 @@ export declare type UpdateBrandBody = {
53
53
  };
54
54
  };
55
55
  segment?: {
56
- type: string;
57
- team: string;
56
+ type: {
57
+ id: string;
58
+ };
59
+ team: {
60
+ id: string;
61
+ };
58
62
  };
59
63
  term?: Array<string>;
60
64
  step_name?: string;
@@ -102,7 +106,7 @@ export declare type UpdateIndividualBody = {
102
106
  identification?: {
103
107
  id?: string;
104
108
  issued_country_code?: string;
105
- expiry?: string;
109
+ expiry?: number;
106
110
  type?: string;
107
111
  };
108
112
  nationality?: string;
@@ -382,5 +382,9 @@
382
382
  "place_birth_city_label": "مكان الميلاد",
383
383
  "Choose_place_birth_city": "- اختر -",
384
384
  "nationality_label": "الجنسية",
385
- "Choose_nationality": "- اختر -"
385
+ "Choose_nationality": "- اختر -",
386
+ "share_count_label": "عدد الأسهم",
387
+ "share_count_hint": "0",
388
+ "share_value_label": "قيمة السهم",
389
+ "share_value_hint": "0000"
386
390
  }
@@ -412,5 +412,9 @@
412
412
  "place_birth_city_label": "Place of Birth City",
413
413
  "choose_place_birth_city": "- Please select -",
414
414
  "nationality_label": "Nationality",
415
- "choose_nationality": "- Please select -"
415
+ "choose_nationality": "- Please select -",
416
+ "share_count_label": "Share Count",
417
+ "share_count_hint": "0",
418
+ "share_value_label": "Share Value",
419
+ "share_value_hint": "0000"
416
420
  }
@@ -271,7 +271,7 @@ export var updateBrand = createAsyncThunk('brandUpdateBrand', function (params,
271
271
  requestBody = {
272
272
  id: id,
273
273
  name: { en: params === null || params === void 0 ? void 0 : params.brandName, ar: params === null || params === void 0 ? void 0 : params.brandName },
274
- segment: { type: ((_d = params.segment) === null || _d === void 0 ? void 0 : _d.id) || '', team: ((_e = params.teamSize) === null || _e === void 0 ? void 0 : _e.id) || '' },
274
+ segment: { type: { id: ((_d = params.segment) === null || _d === void 0 ? void 0 : _d.id) || '' }, team: { id: ((_e = params.teamSize) === null || _e === void 0 ? void 0 : _e.id) || '' } },
275
275
  channel_services: channel_services
276
276
  };
277
277
  return [4, API.brandService.updateBrandInfo(requestBody)];
@@ -455,7 +455,7 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
455
455
  brandReqBody_1 = {
456
456
  id: (selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.id) || '',
457
457
  channel_services: channel_services,
458
- segment: { type: ((_b = params.segment) === null || _b === void 0 ? void 0 : _b.id) || '', team: ((_c = params.teamSize) === null || _c === void 0 ? void 0 : _c.id) || '' },
458
+ segment: { type: { id: ((_b = params.segment) === null || _b === void 0 ? void 0 : _b.id) || '' }, team: { id: ((_c = params.teamSize) === null || _c === void 0 ? void 0 : _c.id) || '' } },
459
459
  step_name: CONNECT_STEP_NAMES.UPDATE_BRAND_INFO
460
460
  };
461
461
  return [4, API.brandService.updateBrandInfo(brandReqBody_1)];
@@ -491,7 +491,7 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
491
491
  channel_services: channel_services,
492
492
  term: ['general'],
493
493
  step_name: CONNECT_STEP_NAMES.UPDATE_BRAND_INFO,
494
- segment: { type: ((_g = params.segment) === null || _g === void 0 ? void 0 : _g.id) || '', team: ((_h = params.teamSize) === null || _h === void 0 ? void 0 : _h.id) || '' }
494
+ segment: { type: { id: ((_g = params.segment) === null || _g === void 0 ? void 0 : _g.id) || '' }, team: { id: ((_h = params.teamSize) === null || _h === void 0 ? void 0 : _h.id) || '' } }
495
495
  };
496
496
  return [4, API.brandService.updateBrandInfo(brandReqBody)];
497
497
  case 6:
@@ -97,6 +97,7 @@ export interface IndividualData {
97
97
  }
98
98
  export interface IndividualState extends SharedState<IndividualData> {
99
99
  customLoading?: boolean;
100
+ cityLoading?: boolean;
100
101
  }
101
102
  export declare const individualSlice: import("@reduxjs/toolkit").Slice<IndividualState, {
102
103
  clearError: (state: IndividualState) => void;
@@ -75,10 +75,10 @@ import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountry
75
75
  export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', function (_a, thunkApi) {
76
76
  var token = _a.token, isInternally = _a.isInternally;
77
77
  return __awaiter(void 0, void 0, void 0, function () {
78
- var payload, settings, data, boardData, individualData, countryCode, boardInfoData, boardInfoStatus, countries, board_id, board_info_id, notification, _b, id, type, payload_1, info, hasIndividualCompleted;
79
- var _c, _d, _e, _f, _g, _h, _j;
80
- return __generator(this, function (_k) {
81
- switch (_k.label) {
78
+ var payload, settings, data, boardData, individualData, countryCode, boardInfoData, boardInfoStatus, countries, board_id, board_info_id, notification, _b, id, type, payload_1, info, hasIndividualCompleted, birthCountry;
79
+ var _c, _d, _e, _f, _g, _h, _j, _k;
80
+ return __generator(this, function (_l) {
81
+ switch (_l.label) {
82
82
  case 0:
83
83
  payload = {
84
84
  service_name: 'tap_email',
@@ -87,7 +87,7 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
87
87
  settings = thunkApi.getState().settings;
88
88
  return [4, API.leadService.verifyLeadToken(payload)];
89
89
  case 1:
90
- data = (_k.sent()).data;
90
+ data = (_l.sent()).data;
91
91
  boardInfoStatus = undefined;
92
92
  countries = settings.data.countries;
93
93
  if (((_c = data.errors) === null || _c === void 0 ? void 0 : _c.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
@@ -104,24 +104,24 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
104
104
  if (!(board_id && board_info_id)) return [3, 4];
105
105
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
106
106
  case 2:
107
- boardInfoData = _k.sent();
107
+ boardInfoData = _l.sent();
108
108
  notification = (boardInfoData || {}).notification;
109
109
  _b = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _b.id, type = _b.type;
110
110
  if (!(id && type)) return [3, 4];
111
111
  return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode }))];
112
112
  case 3:
113
- payload_1 = (_k.sent()).payload;
113
+ payload_1 = (_l.sent()).payload;
114
114
  individualData = payload_1.data || {};
115
- _k.label = 4;
115
+ _l.label = 4;
116
116
  case 4:
117
117
  if (!board_id) return [3, 7];
118
118
  return [4, API.boardService.retrieveBoardDetails(board_id)];
119
119
  case 5:
120
- boardData = _k.sent();
120
+ boardData = _l.sent();
121
121
  return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
122
122
  case 6:
123
- boardInfoStatus = _k.sent();
124
- _k.label = 7;
123
+ boardInfoStatus = _l.sent();
124
+ _l.label = 7;
125
125
  case 7:
126
126
  if (!countryCode) {
127
127
  countryCode = (_d = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _d === void 0 ? void 0 : _d.country;
@@ -138,20 +138,21 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
138
138
  if (!((_f = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _f === void 0 ? void 0 : _f.id)) return [3, 10];
139
139
  return [4, thunkApi.dispatch(getIndividualList((_g = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _g === void 0 ? void 0 : _g.id))];
140
140
  case 9:
141
- _k.sent();
142
- _k.label = 10;
141
+ _l.sent();
142
+ _l.label = 10;
143
143
  case 10:
144
144
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
145
145
  return [3, 14];
146
146
  case 11:
147
- if (!countryCode) return [3, 13];
148
- return [4, thunkApi.dispatch(getCityList(countryCode))];
147
+ birthCountry = ((_h = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _h === void 0 ? void 0 : _h.country) || countryCode;
148
+ if (!birthCountry) return [3, 13];
149
+ return [4, thunkApi.dispatch(getCityList(birthCountry))];
149
150
  case 12:
150
- _k.sent();
151
- _k.label = 13;
151
+ _l.sent();
152
+ _l.label = 13;
152
153
  case 13:
153
154
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
154
- _k.label = 14;
155
+ _l.label = 14;
155
156
  case 14: return [2, {
156
157
  data: data,
157
158
  boardResponse: {
@@ -160,8 +161,8 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
160
161
  entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
161
162
  merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
162
163
  merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
163
- name: (_h = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _h === void 0 ? void 0 : _h.names,
164
- contact: (_j = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _j === void 0 ? void 0 : _j.contact,
164
+ name: (_j = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _j === void 0 ? void 0 : _j.names,
165
+ contact: (_k = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _k === void 0 ? void 0 : _k.contact,
165
166
  individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
166
167
  countries: countries,
167
168
  countryCode: countryCode,
@@ -192,14 +193,14 @@ export var resendOTP = createAsyncThunk('resendOTPIndividual', function (params,
192
193
  });
193
194
  }); });
194
195
  export var addDetailsAsync = createAsyncThunk('individual/addDetailsAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
195
- var settings, user, userList, id, type, countryCode;
196
+ var settings, user, userList, id, type, birth, countryCode;
196
197
  return __generator(this, function (_a) {
197
198
  switch (_a.label) {
198
199
  case 0:
199
200
  settings = thunkApi.getState().settings;
200
201
  user = params.user, userList = params.userList;
201
- id = user.id, type = user.type;
202
- countryCode = settings.data.businessCountry.iso2;
202
+ id = user.id, type = user.type, birth = user.birth;
203
+ countryCode = (birth === null || birth === void 0 ? void 0 : birth.country) || settings.data.businessCountry.iso2;
203
204
  if (!countryCode) return [3, 2];
204
205
  return [4, thunkApi.dispatch(getCityList(countryCode))];
205
206
  case 1:
@@ -341,10 +342,10 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetai
341
342
  });
342
343
  }); });
343
344
  export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
344
- var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData, individualData, boardData, countryCode, boardInfoStatus, notification, _c, id, type, payload_2, info, hasIndividualCompleted;
345
- var _d, _e, _f, _g, _h, _j, _k, _l, _m;
346
- return __generator(this, function (_o) {
347
- switch (_o.label) {
345
+ var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData, individualData, boardData, countryCode, boardInfoStatus, notification, _c, id, type, payload_2, info, hasIndividualCompleted, birthCountry;
346
+ var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
347
+ return __generator(this, function (_p) {
348
+ switch (_p.label) {
348
349
  case 0:
349
350
  _a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
350
351
  responseBody = individual.data.verify.responseBody;
@@ -359,31 +360,31 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
359
360
  };
360
361
  return [4, API.leadService.verifyLeadOTP(payload)];
361
362
  case 1:
362
- data = (_o.sent()).data;
363
+ data = (_p.sent()).data;
363
364
  boardInfoStatus = undefined;
364
365
  if (!!(data === null || data === void 0 ? void 0 : data.errors)) return [3, 14];
365
366
  if (!board_id) return [3, 4];
366
367
  return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
367
368
  case 2:
368
- boardInfoStatus = _o.sent();
369
+ boardInfoStatus = _p.sent();
369
370
  return [4, API.boardService.retrieveBoardDetails(board_id)];
370
371
  case 3:
371
- boardData = _o.sent();
372
- _o.label = 4;
372
+ boardData = _p.sent();
373
+ _p.label = 4;
373
374
  case 4:
374
375
  countryCode = (_e = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _e === void 0 ? void 0 : _e.country;
375
376
  if (!(board_id && board_info_id)) return [3, 7];
376
377
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
377
378
  case 5:
378
- boardInfoData = _o.sent();
379
+ boardInfoData = _p.sent();
379
380
  notification = (boardInfoData || {}).notification;
380
381
  _c = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
381
382
  if (!(id && type)) return [3, 7];
382
383
  return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode }))];
383
384
  case 6:
384
- payload_2 = (_o.sent()).payload;
385
+ payload_2 = (_p.sent()).payload;
385
386
  individualData = payload_2.data || {};
386
- _o.label = 7;
387
+ _p.label = 7;
387
388
  case 7:
388
389
  info = (boardInfoStatus || {}).info;
389
390
  hasIndividualCompleted = ((_f = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _f === void 0 ? void 0 : _f.status) === 'completed';
@@ -396,20 +397,21 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
396
397
  if (!((_j = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _j === void 0 ? void 0 : _j.id)) return [3, 10];
397
398
  return [4, thunkApi.dispatch(getIndividualList((_k = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _k === void 0 ? void 0 : _k.id))];
398
399
  case 9:
399
- _o.sent();
400
- _o.label = 10;
400
+ _p.sent();
401
+ _p.label = 10;
401
402
  case 10:
402
403
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
403
404
  return [3, 14];
404
405
  case 11:
405
- if (!countryCode) return [3, 13];
406
- return [4, thunkApi.dispatch(getCityList(countryCode))];
406
+ birthCountry = ((_l = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _l === void 0 ? void 0 : _l.country) || countryCode;
407
+ if (!birthCountry) return [3, 13];
408
+ return [4, thunkApi.dispatch(getCityList(birthCountry))];
407
409
  case 12:
408
- _o.sent();
409
- _o.label = 13;
410
+ _p.sent();
411
+ _p.label = 13;
410
412
  case 13:
411
413
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
412
- _o.label = 14;
414
+ _p.label = 14;
413
415
  case 14: return [2, {
414
416
  data: data,
415
417
  boardResponse: {
@@ -418,8 +420,8 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
418
420
  entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
419
421
  merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
420
422
  merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
421
- name: (_l = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _l === void 0 ? void 0 : _l.names,
422
- contact: (_m = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _m === void 0 ? void 0 : _m.contact,
423
+ name: (_m = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _m === void 0 ? void 0 : _m.names,
424
+ contact: (_o = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _o === void 0 ? void 0 : _o.contact,
423
425
  individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
424
426
  countries: countries,
425
427
  countryCode: countryCode,
@@ -432,7 +434,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
432
434
  });
433
435
  }); });
434
436
  export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateIndividualPersonalInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
435
- var _a, settings, individual, _b, notification, user, entity, _c, id, type, name, email, mobile, countryCode, gender, nid, issuedCountry, expiryDate, dob, placeOfBirthCountry, placeOfBirthCity, nationality, code, data_status, userName, identification_id_type, isNameEditable, isEmailEditable, isMobileNumberEditable, isMobileCountryEditable, isNidEditable, isIssuedCountryEditable, isExpiryEditable, isIdTypeEditable, isNationalityEditable, requestBody, data;
437
+ var _a, settings, individual, _b, notification, user, entity, _c, id, type, name, email, mobile, countryCode, gender, nid, issuedCountry, expiryDate, dob, placeOfBirthCountry, placeOfBirthCity, nationality, code, data_status, userName, identification_id_type, isNameEditable, isEmailEditable, isMobileNumberEditable, isMobileCountryEditable, isNidEditable, isIssuedCountryEditable, isExpiryEditable, isIdTypeEditable, isNationalityEditable, hasContact, hasPhone, hasIdentification, hasBirth, names, contact, requestBody, data;
436
438
  var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
437
439
  return __generator(this, function (_s) {
438
440
  switch (_s.label) {
@@ -444,40 +446,53 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
444
446
  code = entity === null || entity === void 0 ? void 0 : entity.country;
445
447
  data_status = (user || {}).data_status;
446
448
  userName = getIndividualName(name);
447
- identification_id_type = params.nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
448
- isNameEditable = (data_status === null || data_status === void 0 ? void 0 : data_status.name) === FieldType.EDITABLE;
449
+ identification_id_type = nid && (nid === null || nid === void 0 ? void 0 : nid.startsWith('1')) ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA;
450
+ isNameEditable = (data_status === null || data_status === void 0 ? void 0 : data_status.name) === FieldType.EDITABLE && userName;
449
451
  isEmailEditable = ((_d = data_status === null || data_status === void 0 ? void 0 : data_status.contact) === null || _d === void 0 ? void 0 : _d.email) === FieldType.EDITABLE;
450
- isMobileNumberEditable = ((_f = (_e = data_status === null || data_status === void 0 ? void 0 : data_status.contact) === null || _e === void 0 ? void 0 : _e.phone) === null || _f === void 0 ? void 0 : _f.number) === FieldType.EDITABLE;
452
+ isMobileNumberEditable = ((_f = (_e = data_status === null || data_status === void 0 ? void 0 : data_status.contact) === null || _e === void 0 ? void 0 : _e.phone) === null || _f === void 0 ? void 0 : _f.number) === FieldType.EDITABLE && mobile;
451
453
  isMobileCountryEditable = ((_h = (_g = data_status === null || data_status === void 0 ? void 0 : data_status.contact) === null || _g === void 0 ? void 0 : _g.phone) === null || _h === void 0 ? void 0 : _h.country_code) === FieldType.EDITABLE;
452
- isNidEditable = ((_j = data_status === null || data_status === void 0 ? void 0 : data_status.identification) === null || _j === void 0 ? void 0 : _j.id) === FieldType.EDITABLE;
454
+ isNidEditable = ((_j = data_status === null || data_status === void 0 ? void 0 : data_status.identification) === null || _j === void 0 ? void 0 : _j.id) === FieldType.EDITABLE && nid;
453
455
  isIssuedCountryEditable = ((_k = data_status === null || data_status === void 0 ? void 0 : data_status.identification) === null || _k === void 0 ? void 0 : _k.issuer_country) === FieldType.EDITABLE;
454
- isExpiryEditable = ((_l = data_status === null || data_status === void 0 ? void 0 : data_status.identification) === null || _l === void 0 ? void 0 : _l.expiry) === FieldType.EDITABLE;
455
- isIdTypeEditable = ((_m = data_status === null || data_status === void 0 ? void 0 : data_status.identification) === null || _m === void 0 ? void 0 : _m.type) === FieldType.EDITABLE;
456
+ isExpiryEditable = ((_l = data_status === null || data_status === void 0 ? void 0 : data_status.identification) === null || _l === void 0 ? void 0 : _l.expiry) === FieldType.EDITABLE && expiryDate;
457
+ isIdTypeEditable = ((_m = data_status === null || data_status === void 0 ? void 0 : data_status.identification) === null || _m === void 0 ? void 0 : _m.type) === FieldType.EDITABLE && identification_id_type;
456
458
  isNationalityEditable = (data_status === null || data_status === void 0 ? void 0 : data_status.nationality) === FieldType.EDITABLE;
459
+ hasContact = email || mobile || countryCode;
460
+ hasPhone = mobile && (countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix);
461
+ hasIdentification = nid || issuedCountry || identification_id_type || expiryDate;
462
+ hasBirth = placeOfBirthCity || placeOfBirthCountry;
463
+ names = isNameEditable
464
+ ? {
465
+ en: userName,
466
+ ar: userName
467
+ }
468
+ : undefined;
469
+ contact = hasContact
470
+ ? {
471
+ email: isEmailEditable ? email : undefined,
472
+ phone: hasPhone
473
+ ? {
474
+ country_code: isMobileCountryEditable ? (_o = countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix) === null || _o === void 0 ? void 0 : _o.toString() : undefined,
475
+ number: isMobileNumberEditable ? mobile : undefined
476
+ }
477
+ : undefined
478
+ }
479
+ : undefined;
457
480
  requestBody = {
458
481
  id: id,
459
482
  type: type,
460
- names: isNameEditable
483
+ names: names,
484
+ gender: gender || undefined,
485
+ contact: contact,
486
+ identification: hasIdentification
461
487
  ? {
462
- en: userName,
463
- ar: userName
488
+ id: isNidEditable ? nid : undefined,
489
+ issued_country_code: isIssuedCountryEditable ? issuedCountry === null || issuedCountry === void 0 ? void 0 : issuedCountry.iso2 : undefined,
490
+ expiry: isExpiryEditable ? new Date(expiryDate).getTime() : undefined,
491
+ type: isIdTypeEditable ? identification_id_type : undefined
464
492
  }
465
493
  : undefined,
466
- gender: gender || '',
467
- contact: {
468
- email: isEmailEditable ? email : undefined,
469
- phone: {
470
- country_code: isMobileCountryEditable ? (_o = countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix) === null || _o === void 0 ? void 0 : _o.toString() : undefined,
471
- number: isMobileNumberEditable ? mobile || '' : undefined
472
- }
473
- },
474
- identification: {
475
- id: isNidEditable ? nid : undefined,
476
- issued_country_code: isIssuedCountryEditable ? issuedCountry === null || issuedCountry === void 0 ? void 0 : issuedCountry.iso2 : undefined,
477
- type: isIdTypeEditable ? identification_id_type : undefined
478
- },
479
494
  date_of_birth: dob,
480
- birth: {
495
+ birth: hasBirth && {
481
496
  city: (_p = placeOfBirthCity === null || placeOfBirthCity === void 0 ? void 0 : placeOfBirthCity.name) === null || _p === void 0 ? void 0 : _p.en,
482
497
  country: placeOfBirthCountry === null || placeOfBirthCountry === void 0 ? void 0 : placeOfBirthCountry.iso2
483
498
  },
@@ -498,10 +513,10 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
498
513
  });
499
514
  }); });
500
515
  export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
501
- var _a, settings, individual, _b, notification, user, isOccupationEditable, isSourceIncomeEditable, isPEPEditable, isInfluencerEditable, _c, id, type, civilID, signatureFileId, businessCountry, documentsList, requestBody, documentBody, data;
502
- var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
503
- return __generator(this, function (_p) {
504
- switch (_p.label) {
516
+ var _a, settings, individual, _b, notification, user, isOccupationEditable, isSourceIncomeEditable, isPEPEditable, isInfluencerEditable, occupation, employerName, sourceIncome, monthlyIncome, isPEP, isInfluencer, _c, id, type, civilID, signatureFileId, businessCountry, documentsList, requestBody, documentBody, data;
517
+ var _d, _e, _f, _g, _h, _j;
518
+ return __generator(this, function (_k) {
519
+ switch (_k.label) {
505
520
  case 0:
506
521
  _a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
507
522
  _b = individual.data.verify.responseBody || {}, notification = _b.notification, user = _b.user;
@@ -509,6 +524,7 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
509
524
  isSourceIncomeEditable = ((_e = user === null || user === void 0 ? void 0 : user.data_status) === null || _e === void 0 ? void 0 : _e.source_of_income) === FieldType.EDITABLE;
510
525
  isPEPEditable = ((_f = user === null || user === void 0 ? void 0 : user.data_status) === null || _f === void 0 ? void 0 : _f.is_relative_PEP) === FieldType.EDITABLE;
511
526
  isInfluencerEditable = ((_g = user === null || user === void 0 ? void 0 : user.data_status) === null || _g === void 0 ? void 0 : _g.is_influencer) === FieldType.EDITABLE;
527
+ occupation = params.occupation, employerName = params.employerName, sourceIncome = params.sourceIncome, monthlyIncome = params.monthlyIncome, isPEP = params.isPEP, isInfluencer = params.isInfluencer;
512
528
  _c = ((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
513
529
  civilID = params.civilID, signatureFileId = params.signatureFileId;
514
530
  businessCountry = settings.data.businessCountry;
@@ -520,14 +536,13 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
520
536
  requestBody = {
521
537
  id: id,
522
538
  type: type,
523
- occupation: isOccupationEditable ? { id: (_h = params.occupation) === null || _h === void 0 ? void 0 : _h.id } : undefined,
524
- employer_name: params.employerName,
525
- employer_country: (_j = params.employerLocation) === null || _j === void 0 ? void 0 : _j.iso2,
526
- source_income: isSourceIncomeEditable ? [{ id: (_k = params.sourceIncome) === null || _k === void 0 ? void 0 : _k.id }] : undefined,
527
- monthly_income: { id: (_l = params.monthlyIncome) === null || _l === void 0 ? void 0 : _l.id },
528
- is_relative_PEP: isPEPEditable ? params.isPEP : undefined,
529
- is_influencer: isInfluencerEditable ? params.isInfluencer : undefined,
530
- encryption_contract: ['employer_name', 'employer_country'],
539
+ occupation: isOccupationEditable ? { id: occupation === null || occupation === void 0 ? void 0 : occupation.id } : undefined,
540
+ employer_name: employerName,
541
+ source_income: isSourceIncomeEditable ? [{ id: sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome.id }] : undefined,
542
+ monthly_income: { id: monthlyIncome === null || monthlyIncome === void 0 ? void 0 : monthlyIncome.id },
543
+ is_relative_PEP: isPEPEditable ? isPEP : undefined,
544
+ is_influencer: isInfluencerEditable ? isInfluencer : undefined,
545
+ encryption_contract: ['employer_name'],
531
546
  step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO
532
547
  };
533
548
  documentBody = {
@@ -538,13 +553,13 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
538
553
  if (!(documentsList.length > 0)) return [3, 2];
539
554
  return [4, API.entityService.updateDocumentInfo(documentBody)];
540
555
  case 1:
541
- _p.sent();
542
- _p.label = 2;
556
+ _k.sent();
557
+ _k.label = 2;
543
558
  case 2: return [4, API.individualService.updateIndividual(requestBody)];
544
559
  case 3:
545
- data = (_p.sent()).data;
560
+ data = (_k.sent()).data;
546
561
  thunkApi.dispatch(handleNextScreenStep());
547
- (_o = (_m = settings.data.appConfig).onStepCompleted) === null || _o === void 0 ? void 0 : _o.call(_m, settings.data.activeScreen.name, requestBody);
562
+ (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, requestBody);
548
563
  return [2, { data: data, formData: params }];
549
564
  }
550
565
  });
@@ -583,6 +598,7 @@ export var updateBoardSuccess = createAsyncThunk('individualUpdateBoardSuccess',
583
598
  var initialState = {
584
599
  error: null,
585
600
  loading: false,
601
+ cityLoading: false,
586
602
  data: {
587
603
  flowName: FlowsTypes.INDIVIDUAL,
588
604
  verify: {
@@ -838,17 +854,17 @@ export var individualSlice = createSlice({
838
854
  state.error = action.error.message;
839
855
  })
840
856
  .addCase(getCityList.pending, function (state) {
841
- state.loading = true;
857
+ state.cityLoading = true;
842
858
  state.error = null;
843
859
  })
844
860
  .addCase(getCityList.fulfilled, function (state, action) {
845
- state.loading = false;
861
+ state.cityLoading = false;
846
862
  state.error = null;
847
863
  var data = state.data.verify.responseBody;
848
864
  state.data.verify.responseBody = __assign(__assign({}, data), { cityList: action.payload });
849
865
  })
850
866
  .addCase(getCityList.rejected, function (state, action) {
851
- state.loading = false;
867
+ state.cityLoading = false;
852
868
  state.error = action.error.message;
853
869
  })
854
870
  .addCase(updateIndividualPersonalInfo.pending, function (state) {
@@ -64,7 +64,7 @@ var AdditionalIndividualInfo = function (_a) {
64
64
  var isAuthorizedUser = user === null || user === void 0 ? void 0 : user.is_authorized;
65
65
  var _c = data.individualData, occupation = _c.occupation, sourceIncome = _c.sourceIncome, monthlyIncome = _c.monthlyIncome, employerName = _c.employerName, employerLocation = _c.employerLocation, isPEP = _c.isPEP, isInfluencer = _c.isInfluencer, civilID = _c.civilID, signatureFileId = _c.signatureFileId, civilIDUploading = _c.civilIDUploading, signatureFileUploading = _c.signatureFileUploading;
66
66
  var methods = useForm({
67
- resolver: yupResolver(IndividualInfoValidationSchema(isAuthorizedUser, user === null || user === void 0 ? void 0 : user.type, user === null || user === void 0 ? void 0 : user.data_status)),
67
+ resolver: yupResolver(IndividualInfoValidationSchema(isAuthorizedUser, user)),
68
68
  defaultValues: {
69
69
  occupation: occupation,
70
70
  sourceIncome: sourceIncome,
@@ -75,7 +75,7 @@ var EmployerLocation = React.forwardRef(function (_a, ref) {
75
75
  };
76
76
  var location = employerLocationControl.field.value;
77
77
  var error = (_b = employerLocationControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
78
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(Input, { required: true, label: t('tap_js_employer_address_city'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseCountrySelect(); } : onOpenCountrySelect, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_employee_location'), value: (isAr ? (_c = location === null || location === void 0 ? void 0 : location.name) === null || _c === void 0 ? void 0 : _c.arabic : (_d = location === null || location === void 0 ? void 0 : location.name) === null || _d === void 0 ? void 0 : _d.english) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', searchValuePath: ['idd_prefix', 'capital', 'name.arabic', 'name.english'], list: locationCountries, onSelectItem: onSelectItem, renderItem: function (item) {
78
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(Input, { required: true, label: t('tap_js_employer_address_city'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseCountrySelect(); } : onOpenCountrySelect, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_employee_location'), value: (isAr ? (_c = location === null || location === void 0 ? void 0 : location.name) === null || _c === void 0 ? void 0 : _c.arabic : (_d = location === null || location === void 0 ? void 0 : location.name) === null || _d === void 0 ? void 0 : _d.english) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', searchValuePath: ['name.arabic', 'name.english'], list: locationCountries, onSelectItem: onSelectItem, renderItem: function (item) {
79
79
  return (_jsxs(_Fragment, { children: [_jsx(CountryItemContainer, { children: _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (location === null || location === void 0 ? void 0 : location.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english })) }), item.idd_prefix === (location === null || location === void 0 ? void 0 : location.idd_prefix) && _jsx(CheckIconStyled, {})] }));
80
80
  } }) }))] })) })));
81
81
  });
@@ -34,8 +34,8 @@ var ShareValue = function (_a) {
34
34
  var shareValueControl = useController({ control: control, name: 'shareValue' });
35
35
  var shareValueValue = shareValueControl.field.value;
36
36
  var error = (_b = shareValueControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
37
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { label: t('capital_share_value_label', {
37
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { label: t('share_value_label', {
38
38
  currency: t(findCurrencyByIso2(countryCode))
39
- }), onChange: handleChange, value: shareValueValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('capital_share_value_hint'), warningType: 'alert', warningMessage: error && t(error) }) })) })));
39
+ }), onChange: handleChange, value: shareValueValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: t('share_value_hint'), warningType: 'alert', warningMessage: error && t(error) }) })) })));
40
40
  };
41
41
  export default React.memo(ShareValue);
@@ -1,7 +1,7 @@
1
1
  import * as yup from 'yup';
2
2
  import { ObjectShape } from 'yup/lib/object';
3
- import { IndividualType } from '../../../../@types';
4
- export declare const IndividualInfoValidationSchema: (isAuthorizedUser: boolean, type: IndividualType, dataStatus: any) => yup.ObjectSchema<import("yup/lib/object").Assign<ObjectShape, {
3
+ import { User } from '../../../../@types';
4
+ export declare const IndividualInfoValidationSchema: (isAuthorizedUser: boolean, user: User) => yup.ObjectSchema<import("yup/lib/object").Assign<ObjectShape, {
5
5
  occupation: import("yup/lib/object").OptionalObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
6
6
  sourceIncome: import("yup/lib/object").OptionalObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
7
7
  monthlyIncome: import("yup/lib/object").OptionalObjectSchema<ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<ObjectShape>>;
@@ -1,10 +1,11 @@
1
1
  import * as yup from 'yup';
2
2
  import { IndividualType, FieldType } from '../../../../@types';
3
- export var IndividualInfoValidationSchema = function (isAuthorizedUser, type, dataStatus) {
4
- var isOccupationOptional = (dataStatus === null || dataStatus === void 0 ? void 0 : dataStatus.occupation) === FieldType.NON_EDITABLE;
5
- var isSourceIncomeOptional = (dataStatus === null || dataStatus === void 0 ? void 0 : dataStatus.source_of_income) === FieldType.NON_EDITABLE;
6
- var isPEPOptional = (dataStatus === null || dataStatus === void 0 ? void 0 : dataStatus.is_relative_PEP) === FieldType.NON_EDITABLE;
7
- var isInfluencerOptional = (dataStatus === null || dataStatus === void 0 ? void 0 : dataStatus.is_influencer) === FieldType.NON_EDITABLE;
3
+ export var IndividualInfoValidationSchema = function (isAuthorizedUser, user) {
4
+ var _a = user || {}, type = _a.type, data_status = _a.data_status, occupation = _a.occupation, source_income = _a.source_income, is_relative_PEP = _a.is_relative_PEP, is_influencer = _a.is_influencer;
5
+ var isOccupationOptional = !occupation && (data_status === null || data_status === void 0 ? void 0 : data_status.occupation) === FieldType.NON_EDITABLE;
6
+ var isSourceIncomeOptional = !source_income && (data_status === null || data_status === void 0 ? void 0 : data_status.source_of_income) === FieldType.NON_EDITABLE;
7
+ var isPEPOptional = is_relative_PEP === undefined && (data_status === null || data_status === void 0 ? void 0 : data_status.is_relative_PEP) === FieldType.NON_EDITABLE;
8
+ var isInfluencerOptional = is_influencer === undefined && (data_status === null || data_status === void 0 ? void 0 : data_status.is_influencer) === FieldType.NON_EDITABLE;
8
9
  return yup.object().shape({
9
10
  occupation: type === IndividualType.USER && !isOccupationOptional ? yup.object().required('alert_choose_occupation') : yup.object().optional(),
10
11
  sourceIncome: type === IndividualType.USER && !isSourceIncomeOptional ? yup.object().required('choose_any_source_of_income') : yup.object().optional(),
@@ -14,7 +14,7 @@ import { useTranslation } from 'react-i18next';
14
14
  import { styled } from '@mui/material/styles';
15
15
  import Box from '@mui/material/Box';
16
16
  import { handlePrevScreenStep } from '../../../../app/settings';
17
- import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
17
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
18
18
  import Text from '../../../../components/Text';
19
19
  import Button from '../../../../components/Button';
20
20
  import Collapse from '../../../../components/Collapse';
@@ -48,9 +48,8 @@ export var SubTitleStyled = styled(Text)(function (_a) {
48
48
  });
49
49
  var IndividualList = function () {
50
50
  var dispatch = useAppDispatch();
51
- var isAr = useLanguage().isAr;
52
51
  var t = useTranslation().t;
53
- var _a = useAppSelector(individualSelector), data = _a.data, loading = _a.loading, error = _a.error;
52
+ var error = useAppSelector(individualSelector).error;
54
53
  var onBack = function () {
55
54
  dispatch(handlePrevScreenStep());
56
55
  };
@@ -25,14 +25,15 @@ import { useTranslation } from 'react-i18next';
25
25
  import { useController, useFormContext } from 'react-hook-form';
26
26
  import { styled } from '@mui/material/styles';
27
27
  import CheckIcon from '@mui/icons-material/Check';
28
- import { useAppSelector } from '../../../../hooks';
28
+ import CircularProgress from '@mui/material/CircularProgress';
29
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
29
30
  import Collapse from '../../../../components/Collapse';
30
31
  import ExpandIcon from '../../../../components/ExpandIcon';
31
32
  import Text from '../../../../components/Text';
32
33
  import SimpleList from '../../../../components/SimpleList';
33
34
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
34
35
  import Input from '../../../shared/Input';
35
- import { individualSelector } from '../../../app/individual/individualStore';
36
+ import { getCityList, individualSelector } from '../../../app/individual/individualStore';
36
37
  var CountryItemContainer = styled(Box)(function () { return ({
37
38
  display: 'flex'
38
39
  }); });
@@ -54,16 +55,33 @@ var BirthCity = React.forwardRef(function (_a, ref) {
54
55
  var _c = React.useState([]), locationCities = _c[0], setCities = _c[1];
55
56
  var _d = React.useState(null), anchorEl = _d[0], setAnchorEl = _d[1];
56
57
  var t = useTranslation().t;
57
- var control = useFormContext().control;
58
- var data = useAppSelector(individualSelector).data;
58
+ var dispatch = useAppDispatch();
59
+ var _e = useFormContext(), control = _e.control, getValues = _e.getValues, setValue = _e.setValue;
60
+ var _f = useAppSelector(individualSelector), data = _f.data, cityLoading = _f.cityLoading;
59
61
  var cityList = (data.verify.responseBody || {}).cityList;
60
62
  var placeOfBirthCityControl = useController({ control: control, name: 'placeOfBirthCity' });
63
+ var birthCountry = getValues('placeOfBirthCountry');
61
64
  React.useEffect(function () {
65
+ var _a;
62
66
  if ((cityList === null || cityList === void 0 ? void 0 : cityList.length) > 0) {
67
+ var listCountry = (_a = cityList[0]) === null || _a === void 0 ? void 0 : _a.country;
68
+ if (cityValue && listCountry !== cityValue.country)
69
+ setValue('placeOfBirthCity', undefined);
63
70
  var list = __spreadArray([], cityList, true);
64
71
  setCities(list);
65
72
  }
66
73
  }, [cityList]);
74
+ React.useEffect(function () {
75
+ var _a, _b;
76
+ var user = (data.verify.responseBody || {}).user;
77
+ var listCountry = (cityList === null || cityList === void 0 ? void 0 : cityList.length) > 0 ? (_a = cityList[0]) === null || _a === void 0 ? void 0 : _a.country : (_b = user === null || user === void 0 ? void 0 : user.birth) === null || _b === void 0 ? void 0 : _b.country;
78
+ var iso2 = (birthCountry || {}).iso2;
79
+ if (!listCountry || !iso2)
80
+ return;
81
+ if (listCountry !== iso2) {
82
+ dispatch(getCityList(iso2));
83
+ }
84
+ }, [birthCountry]);
67
85
  var onOpenCitySelect = function (event) {
68
86
  setAnchorEl(event.currentTarget);
69
87
  onListOpen === null || onListOpen === void 0 ? void 0 : onListOpen();
@@ -83,7 +101,7 @@ var BirthCity = React.forwardRef(function (_a, ref) {
83
101
  };
84
102
  var cityValue = placeOfBirthCityControl.field.value;
85
103
  var error = (_b = placeOfBirthCityControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
86
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(Input, { label: t('place_birth_city_label'), readOnly: true, placeholder: t('choose_place_birth_city'), value: getName(cityValue) || '', warningMessage: error && t(error), onClick: !!anchorEl ? function () { return onCloseCitySelect(); } : onOpenCitySelect, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.en', searchValuePath: ['name.en'], list: locationCities, onSelectItem: onSelectItem, renderItem: function (item) {
104
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(Input, { label: t('place_birth_city_label'), readOnly: true, placeholder: t('choose_place_birth_city'), value: getName(cityValue) || '', warningMessage: error && t(error), onClick: cityLoading ? undefined : !!anchorEl ? function () { return onCloseCitySelect(); } : onOpenCitySelect, endAdornment: cityLoading ? _jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } }) : _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.en', searchValuePath: ['name.en'], list: locationCities, onSelectItem: onSelectItem, renderItem: function (item) {
87
105
  return (_jsxs(_Fragment, { children: [_jsx(CountryItemContainer, { children: _jsx(CountryNameText, __assign({ isSelected: item.id === (cityValue === null || cityValue === void 0 ? void 0 : cityValue.id) }, { children: getName(item) })) }), item.id === (cityValue === null || cityValue === void 0 ? void 0 : cityValue.id) && _jsx(CheckIconStyled, {})] }));
88
106
  } }) }))] })) })));
89
107
  });
@@ -75,7 +75,7 @@ var BirthCountry = React.forwardRef(function (_a, ref) {
75
75
  };
76
76
  var location = placeOfBirthCountryControl.field.value;
77
77
  var error = (_b = placeOfBirthCountryControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
78
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(Input, { label: t('place_of_birth_country_label'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseCountrySelect(); } : onOpenCountrySelect, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_place_of_birth_country'), value: (isAr ? (_c = location === null || location === void 0 ? void 0 : location.name) === null || _c === void 0 ? void 0 : _c.arabic : (_d = location === null || location === void 0 ? void 0 : location.name) === null || _d === void 0 ? void 0 : _d.english) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', searchValuePath: ['idd_prefix', 'capital', 'name.arabic', 'name.english'], list: locationCountries, onSelectItem: onSelectItem, renderItem: function (item) {
78
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(Input, { label: t('place_of_birth_country_label'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseCountrySelect(); } : onOpenCountrySelect, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_place_of_birth_country'), value: (isAr ? (_c = location === null || location === void 0 ? void 0 : location.name) === null || _c === void 0 ? void 0 : _c.arabic : (_d = location === null || location === void 0 ? void 0 : location.name) === null || _d === void 0 ? void 0 : _d.english) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', searchValuePath: ['name.arabic', 'name.english'], list: locationCountries, onSelectItem: onSelectItem, renderItem: function (item) {
79
79
  return (_jsxs(_Fragment, { children: [_jsx(CountryItemContainer, { children: _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (location === null || location === void 0 ? void 0 : location.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english })) }), item.idd_prefix === (location === null || location === void 0 ? void 0 : location.idd_prefix) && _jsx(CheckIconStyled, {})] }));
80
80
  } }) }))] })) })));
81
81
  });
@@ -22,7 +22,7 @@ import { IndividualType } from '../../../../@types';
22
22
  import Form from '../../../../components/Form';
23
23
  import Collapse from '../../../../components/Collapse';
24
24
  import Text from '../../../../components/Text';
25
- import { individualSelector, updateIndividualPersonalInfo } from '../../../app/individual/individualStore';
25
+ import { clearError, individualSelector, updateIndividualPersonalInfo } from '../../../app/individual/individualStore';
26
26
  import Button from '../../../shared/Button';
27
27
  import ScreenContainer from '../../../shared/Containers/ScreenContainer';
28
28
  import { IndividualInfoValidationSchema } from './validation';
@@ -56,7 +56,7 @@ var IndividualPersonalInfo = function (_a) {
56
56
  var t = useTranslation().t;
57
57
  var isAr = useLanguage().isAr;
58
58
  var dispatch = useAppDispatch();
59
- var _b = useAppSelector(individualSelector), data = _b.data, loading = _b.loading, error = _b.error;
59
+ var _b = useAppSelector(individualSelector), data = _b.data, loading = _b.loading, error = _b.error, cityLoading = _b.cityLoading;
60
60
  var settingsData = useAppSelector(settingsSelector).data;
61
61
  var countries = settingsData.countries;
62
62
  var verify = data.verify, individualPersonalData = data.individualPersonalData;
@@ -87,7 +87,13 @@ var IndividualPersonalInfo = function (_a) {
87
87
  var onSubmit = function (data) {
88
88
  dispatch(updateIndividualPersonalInfo(data));
89
89
  };
90
+ React.useEffect(function () {
91
+ if (error)
92
+ dispatch(clearError());
93
+ }, [methods.formState.isValid]);
90
94
  var onBack = function () {
95
+ if (error)
96
+ dispatch(clearError());
91
97
  dispatch(handleCurrentActiveScreen('INDIVIDUAL_LIST_STEP'));
92
98
  };
93
99
  var handleMenuClick = function (flag) {
@@ -114,7 +120,7 @@ var IndividualPersonalInfo = function (_a) {
114
120
  return t('type_board_member');
115
121
  return t('type_user');
116
122
  };
117
- var disabled = !methods.formState.isValid;
123
+ var disabled = !methods.formState.isValid || cityLoading;
118
124
  var showField = !listActive && !dobActive && !expiryDateActive;
119
125
  var isIssuedCountryListActive = listActive === ListType.IssuedCountryList;
120
126
  var isBirthCountryListActive = listActive === ListType.BirthCountryList;
@@ -81,7 +81,7 @@ var IssuedCountry = React.forwardRef(function (_a, ref) {
81
81
  };
82
82
  var location = issuedCountryControl.field.value;
83
83
  var error = (_d = issuedCountryControl.fieldState.error) === null || _d === void 0 ? void 0 : _d.message;
84
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(Input, { label: t('issued_country_label'), readOnly: true, disabled: disabled, onClick: disabled ? undefined : !!anchorEl ? function () { return onCloseCountrySelect(); } : onOpenCountrySelect, endAdornment: disabled ? _jsx(_Fragment, {}) : _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_issued_country'), value: (isAr ? (_e = location === null || location === void 0 ? void 0 : location.name) === null || _e === void 0 ? void 0 : _e.arabic : (_f = location === null || location === void 0 ? void 0 : location.name) === null || _f === void 0 ? void 0 : _f.english) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', searchValuePath: ['idd_prefix', 'capital', 'name.arabic', 'name.english'], list: locationCountries, onSelectItem: onSelectItem, renderItem: function (item) {
84
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(Input, { label: t('issued_country_label'), readOnly: true, disabled: disabled, onClick: disabled ? undefined : !!anchorEl ? function () { return onCloseCountrySelect(); } : onOpenCountrySelect, endAdornment: disabled ? _jsx(_Fragment, {}) : _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_issued_country'), value: (isAr ? (_e = location === null || location === void 0 ? void 0 : location.name) === null || _e === void 0 ? void 0 : _e.arabic : (_f = location === null || location === void 0 ? void 0 : location.name) === null || _f === void 0 ? void 0 : _f.english) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', searchValuePath: ['name.arabic', 'name.english'], list: locationCountries, onSelectItem: onSelectItem, renderItem: function (item) {
85
85
  return (_jsxs(_Fragment, { children: [_jsx(CountryItemContainer, { children: _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (location === null || location === void 0 ? void 0 : location.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english })) }), item.idd_prefix === (location === null || location === void 0 ? void 0 : location.idd_prefix) && _jsx(CheckIconStyled, {})] }));
86
86
  } }) }))] })) })));
87
87
  });
@@ -138,7 +138,7 @@ var MobileNumber = React.forwardRef(function (_a, ref) {
138
138
  setValue('mobile', '');
139
139
  countryCodeControl.field.onChange(country);
140
140
  };
141
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 3 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredLen }, type: 'tel', disabled: disabled || !!anchorEl, onClick: onCloseCountryList, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: disabled ? undefined : function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: disabled ? (_jsx(_Fragment, {})) : !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { length: requiredLen, number: '05|5' }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', searchValuePath: ['idd_prefix', 'capital', 'name.arabic', 'name.english'], list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
141
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { mb: 3 } }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_enter_mobile') }) }), _jsx(InputStyled, { inputProps: { maxLength: requiredLen }, type: 'tel', disabled: disabled || !!anchorEl, onClick: onCloseCountryList, onChange: onPhoneNumberChange, value: !!anchorEl ? countryName : mobileValue, startAdornment: _jsxs(CountryCodeStyled, __assign({ onClick: disabled ? undefined : function () { return toggleCountryList(); } }, { children: ["+".concat(countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix), !anchorEl && _jsx(ExpandIconStyled, { anchorEl: !!anchorEl })] })), endAdornment: disabled ? (_jsx(_Fragment, {})) : !!anchorEl ? (_jsx(ExpandIconStyled, { onClick: function () { return toggleCountryList(); }, anchorEl: !!anchorEl })) : !error && mobileValue ? (_jsx(CheckIcon, {})) : (mobileValue && _jsx(ClearIcon, { onClick: clearMobileNumber })), placeholder: "".concat(isSA ? '5' : '0', "00000000"), warningType: 'alert', warningMessage: error && t(error, { length: requiredLen, number: '05|5' }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', searchValuePath: ['name.arabic', 'name.english'], list: countriesCode, onSelectItem: onSelectItem, renderItem: function (item) {
142
142
  return (_jsxs(_Fragment, { children: [_jsxs(CountryItemContainer, { children: [_jsxs(CountryCodeText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: ["+", item.idd_prefix] })), _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english }))] }), item.idd_prefix === (countryCodeValue === null || countryCodeValue === void 0 ? void 0 : countryCodeValue.idd_prefix) && _jsx(CheckIcon, {})] }));
143
143
  } }) }))] })) })));
144
144
  });
@@ -81,7 +81,7 @@ var Nationality = React.forwardRef(function (_a, ref) {
81
81
  };
82
82
  var location = nationalityControl.field.value;
83
83
  var error = (_c = nationalityControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message;
84
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(Input, { label: t('nationality_label'), readOnly: true, disabled: disabled, onClick: disabled ? undefined : !!anchorEl ? function () { return onCloseCountrySelect(); } : onOpenCountrySelect, endAdornment: disabled ? _jsx(_Fragment, {}) : _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_nationality'), value: (isAr ? (_d = location === null || location === void 0 ? void 0 : location.name) === null || _d === void 0 ? void 0 : _d.arabic : (_e = location === null || location === void 0 ? void 0 : location.name) === null || _e === void 0 ? void 0 : _e.english) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', searchValuePath: ['idd_prefix', 'capital', 'name.arabic', 'name.english'], list: locationCountries, onSelectItem: onSelectItem, renderItem: function (item) {
84
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, __assign({ ref: ref, sx: { pt: 2.5 } }, { children: [_jsx(Input, { label: t('nationality_label'), readOnly: true, disabled: disabled, onClick: disabled ? undefined : !!anchorEl ? function () { return onCloseCountrySelect(); } : onOpenCountrySelect, endAdornment: disabled ? _jsx(_Fragment, {}) : _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_nationality'), value: (isAr ? (_d = location === null || location === void 0 ? void 0 : location.name) === null || _d === void 0 ? void 0 : _d.arabic : (_e = location === null || location === void 0 ? void 0 : location.name) === null || _e === void 0 ? void 0 : _e.english) || '', warningMessage: error && t(error) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'name.english', searchValuePath: ['name.arabic', 'name.english'], list: locationCountries, onSelectItem: onSelectItem, renderItem: function (item) {
85
85
  return (_jsxs(_Fragment, { children: [_jsx(CountryItemContainer, { children: _jsx(CountryNameText, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.idd_prefix) === (location === null || location === void 0 ? void 0 : location.idd_prefix) }, { children: isAr ? item.name.arabic : item.name.english })) }), item.idd_prefix === (location === null || location === void 0 ? void 0 : location.idd_prefix) && _jsx(CheckIconStyled, {})] }));
86
86
  } }) }))] })) })));
87
87
  });
@@ -9,17 +9,6 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
13
  import * as React from 'react';
25
14
  import { useAppDispatch, useSetFromDefaultValues } from '../../../../hooks';
@@ -60,17 +49,19 @@ var FormStyled = styled(Form)(function () { return ({
60
49
  var VerifyNumber = function (_a) {
61
50
  var _b, _c;
62
51
  var dispatch = useAppDispatch();
63
- var _d = useAppSelector(individualSelector), data = _d.data, loading = _d.loading, error = _d.error;
64
- var _e = data.otpData, responseBody = _e.responseBody, defaultValues = __rest(_e, ["responseBody"]);
52
+ var _d = useAppSelector(individualSelector), data = _d.data, loading = _d.loading, error = _d.error, cityLoading = _d.cityLoading;
53
+ var otp = data.otpData.otp;
65
54
  var methods = useForm({
66
55
  resolver: yupResolver(OTPValidation),
67
- defaultValues: defaultValues,
56
+ defaultValues: {
57
+ otp: otp
58
+ },
68
59
  mode: 'onChange'
69
60
  });
70
- useSetFromDefaultValues(methods, defaultValues);
61
+ useSetFromDefaultValues(methods, data.otpData);
71
62
  var t = useTranslation().t;
72
63
  var isAr = useLanguage().isAr;
73
- var _f = React.useState(false), resendLoading = _f[0], setResendLoading = _f[1];
64
+ var _e = React.useState(false), resendLoading = _e[0], setResendLoading = _e[1];
74
65
  var phone = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.verification_by) === null || _c === void 0 ? void 0 : _c.sent_to;
75
66
  React.useEffect(function () {
76
67
  if (error && methods.formState.isValid && phone)
@@ -86,6 +77,8 @@ var VerifyNumber = function (_a) {
86
77
  dispatch(handlePrevScreenStep());
87
78
  };
88
79
  var disabled = !methods.formState.isValid || !!error || !phone || resendLoading;
89
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), !loading && phone && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, { loading: resendLoading, setLoading: setResendLoading }), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
80
+ var dataLoading = loading || cityLoading;
81
+ var showMobileNumber = !loading && !cityLoading && phone;
82
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [dataLoading ? t('ide_otp_waiting_title') : t('ide_opt_sent_title'), showMobileNumber && _jsx("span", __assign({ dir: 'ltr' }, { children: "".concat(maskPhone(phone || '')) }))] }) }), _jsx(OTPInput, { loading: resendLoading, setLoading: setResendLoading }), _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') }))] })) })) }));
90
83
  };
91
84
  export default React.memo(VerifyNumber);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.1.77-test",
3
+ "version": "2.1.78-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",