@tap-payments/auth-jsconnect 2.1.77-test → 2.1.79-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 (34) hide show
  1. package/build/@types/app.d.ts +6 -2
  2. package/build/api/entity.d.ts +3 -3
  3. package/build/api/individual.d.ts +7 -3
  4. package/build/assets/locales/ar.json +6 -1
  5. package/build/assets/locales/en.json +6 -1
  6. package/build/features/app/bank/bankStore.js +17 -12
  7. package/build/features/app/brand/brandStore.js +9 -9
  8. package/build/features/app/connect/connectStore.js +6 -6
  9. package/build/features/app/individual/individualStore.d.ts +1 -0
  10. package/build/features/app/individual/individualStore.js +102 -86
  11. package/build/features/bank/screens/BankDetails/BankDetails.js +8 -7
  12. package/build/features/bank/screens/BankDetails/BankName.js +13 -10
  13. package/build/features/bank/screens/BankDetails/Beneficiary.js +12 -13
  14. package/build/features/bank/screens/BankDetails/IBAN.js +14 -10
  15. package/build/features/bank/screens/BankDetails/validation.d.ts +14 -14
  16. package/build/features/bank/screens/BankDetails/validation.js +34 -15
  17. package/build/features/connect/screens/Merchant/BrandList.js +4 -4
  18. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +1 -1
  19. package/build/features/individual/screens/AdditionalIndividualInfo/CivilIDFile.js +2 -3
  20. package/build/features/individual/screens/AdditionalIndividualInfo/EmployerLocation.js +1 -1
  21. package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +2 -2
  22. package/build/features/individual/screens/AdditionalIndividualInfo/SignatureFile.js +1 -1
  23. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +2 -2
  24. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +6 -5
  25. package/build/features/individual/screens/IndividualList/IndividualList.js +2 -3
  26. package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.js +23 -5
  27. package/build/features/individual/screens/IndividualPersonalInfo/BirthCountry.js +1 -1
  28. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +9 -3
  29. package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.js +1 -1
  30. package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.js +1 -1
  31. package/build/features/individual/screens/IndividualPersonalInfo/Nationality.js +1 -1
  32. package/build/features/individual/screens/Verify/Verify.js +10 -17
  33. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +1 -1
  34. package/package.json +1 -1
@@ -241,8 +241,12 @@ export interface LocalProps {
241
241
  }
242
242
  export declare type BrandInfo = {
243
243
  segment?: {
244
- type: string;
245
- team: string;
244
+ type: {
245
+ id: string;
246
+ };
247
+ team: {
248
+ id: string;
249
+ };
246
250
  };
247
251
  id: string;
248
252
  name: {
@@ -44,10 +44,10 @@ export declare type BankDocumentInfo = {
44
44
  export declare type EntityBankUpdateBody = {
45
45
  wallet_id: string;
46
46
  bank_account: {
47
- bank_name: string;
48
- beneficiary_name: string;
47
+ bank_name?: string;
48
+ beneficiary_name?: string;
49
49
  bank_statement_file_id?: string;
50
- iban: string;
50
+ iban?: string;
51
51
  swift_code?: string;
52
52
  account_number?: string;
53
53
  is_acknowledged: boolean;
@@ -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,10 @@
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",
390
+ "brand": "الاسم التجاري"
386
391
  }
@@ -412,5 +412,10 @@
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",
420
+ "brand": "Brand"
416
421
  }
@@ -48,7 +48,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
48
48
  var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
- import { FlowsTypes } from '../../../@types';
51
+ import { FieldType, FlowsTypes } from '../../../@types';
52
52
  import { handleCurrentActiveScreen, handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
53
53
  import { BANK_STEP_NAMES } from '../../../constants';
54
54
  export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_a, thunkApi) {
@@ -180,21 +180,26 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveBankEntityInfo', fun
180
180
  });
181
181
  }); });
182
182
  export var createBankAccount = createAsyncThunk('createBankAccount', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
183
- var _a, settings, bank, iban, beneficiaryName, bankName, bankStatementId, confirmPolicy, requestBody, data;
184
- var _b, _c, _d, _e, _f, _g, _h;
185
- return __generator(this, function (_j) {
186
- switch (_j.label) {
183
+ var _a, settings, bank, iban, beneficiaryName, bankName, bankStatementId, confirmPolicy, bank_account, isIBANEditable, isBeneficiaryNameEditable, isBankNameEditable, isBankStatementIdEditable, requestBody, data;
184
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
185
+ return __generator(this, function (_o) {
186
+ switch (_o.label) {
187
187
  case 0:
188
188
  _a = thunkApi.getState(), settings = _a.settings, bank = _a.bank;
189
189
  iban = params.iban, beneficiaryName = params.beneficiaryName, bankName = params.bankName, bankStatementId = params.bankStatementId, confirmPolicy = params.confirmPolicy;
190
+ bank_account = (bank.data.verify.responseBody || {}).bank_account;
191
+ isIBANEditable = ((_b = bank_account === null || bank_account === void 0 ? void 0 : bank_account.data_status) === null || _b === void 0 ? void 0 : _b.iban) === FieldType.EDITABLE;
192
+ isBeneficiaryNameEditable = ((_c = bank_account === null || bank_account === void 0 ? void 0 : bank_account.data_status) === null || _c === void 0 ? void 0 : _c.beneficiary_name) === FieldType.EDITABLE;
193
+ isBankNameEditable = ((_d = bank_account === null || bank_account === void 0 ? void 0 : bank_account.data_status) === null || _d === void 0 ? void 0 : _d.bank_name) === FieldType.EDITABLE;
194
+ isBankStatementIdEditable = ((_e = bank_account === null || bank_account === void 0 ? void 0 : bank_account.data_status) === null || _e === void 0 ? void 0 : _e.bank_statement_file_id) === FieldType.EDITABLE;
190
195
  requestBody = {
191
- wallet_id: (_f = (_e = (_d = (_c = (_b = bank.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.business) === null || _c === void 0 ? void 0 : _c.entity) === null || _d === void 0 ? void 0 : _d.merchant) === null || _e === void 0 ? void 0 : _e.wallet) === null || _f === void 0 ? void 0 : _f.id,
196
+ wallet_id: (_k = (_j = (_h = (_g = (_f = bank.data.verify.responseBody) === null || _f === void 0 ? void 0 : _f.business) === null || _g === void 0 ? void 0 : _g.entity) === null || _h === void 0 ? void 0 : _h.merchant) === null || _j === void 0 ? void 0 : _j.wallet) === null || _k === void 0 ? void 0 : _k.id,
192
197
  bank_account: {
193
- iban: iban,
194
- beneficiary_name: beneficiaryName,
195
- bank_name: bankName,
198
+ iban: isIBANEditable ? iban : undefined,
199
+ beneficiary_name: isBeneficiaryNameEditable ? beneficiaryName : undefined,
200
+ bank_name: isBankNameEditable ? bankName : undefined,
196
201
  is_acknowledged: confirmPolicy,
197
- document: (bankStatementId || []).length > 0
202
+ document: isBankStatementIdEditable && (bankStatementId || []).length > 0
198
203
  ? {
199
204
  type: 'bank_statement',
200
205
  files: bankStatementId || []
@@ -206,10 +211,10 @@ export var createBankAccount = createAsyncThunk('createBankAccount', function (p
206
211
  };
207
212
  return [4, API.entityService.createBankAccount(requestBody)];
208
213
  case 1:
209
- data = (_j.sent()).data;
214
+ data = (_o.sent()).data;
210
215
  if (!data.errors) {
211
216
  thunkApi.dispatch(handleNextScreenStep());
212
- (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, requestBody);
217
+ (_m = (_l = settings.data.appConfig).onStepCompleted) === null || _m === void 0 ? void 0 : _m.call(_l, settings.data.activeScreen.name, requestBody);
213
218
  }
214
219
  return [2, { data: data, formData: params }];
215
220
  }
@@ -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)];
@@ -463,12 +463,12 @@ export var brandSlice = createSlice({
463
463
  var brand = boardResponse.brand, entity = boardResponse.entity;
464
464
  state.data.brandData.brandName = (_a = brand === null || brand === void 0 ? void 0 : brand.name) === null || _a === void 0 ? void 0 : _a.en;
465
465
  var selectedSegment = (_b = segmentsList === null || segmentsList === void 0 ? void 0 : segmentsList.filter(function (segment) {
466
- var _a;
467
- return segment.id === ((_a = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _a === void 0 ? void 0 : _a.type);
466
+ var _a, _b;
467
+ return segment.id === ((_b = (_a = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.id);
468
468
  })) === null || _b === void 0 ? void 0 : _b[0];
469
469
  var selectedTeamSize = (_c = teamSizeList === null || teamSizeList === void 0 ? void 0 : teamSizeList.filter(function (team) {
470
- var _a;
471
- return team.id === ((_a = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _a === void 0 ? void 0 : _a.team);
470
+ var _a, _b;
471
+ return team.id === ((_b = (_a = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _a === void 0 ? void 0 : _a.team) === null || _b === void 0 ? void 0 : _b.id);
472
472
  })) === null || _c === void 0 ? void 0 : _c[0];
473
473
  (_d = brand === null || brand === void 0 ? void 0 : brand.terms) === null || _d === void 0 ? void 0 : _d.forEach(function (element) {
474
474
  if ((element === null || element === void 0 ? void 0 : element.term) === 'general') {
@@ -515,12 +515,12 @@ export var brandSlice = createSlice({
515
515
  state.data.otpData.responseBody = data;
516
516
  state.data.brandData.brandName = (_a = brand === null || brand === void 0 ? void 0 : brand.name) === null || _a === void 0 ? void 0 : _a.en;
517
517
  var selectedSegment = (_b = segmentsList === null || segmentsList === void 0 ? void 0 : segmentsList.filter(function (segment) {
518
- var _a;
519
- return segment.id === ((_a = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _a === void 0 ? void 0 : _a.type);
518
+ var _a, _b;
519
+ return segment.id === ((_b = (_a = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.id);
520
520
  })) === null || _b === void 0 ? void 0 : _b[0];
521
521
  var selectedTeamSize = (_c = teamSizeList === null || teamSizeList === void 0 ? void 0 : teamSizeList.filter(function (team) {
522
- var _a;
523
- return team.id === ((_a = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _a === void 0 ? void 0 : _a.team);
522
+ var _a, _b;
523
+ return team.id === ((_b = (_a = brand === null || brand === void 0 ? void 0 : brand.segment) === null || _a === void 0 ? void 0 : _a.team) === null || _b === void 0 ? void 0 : _b.id);
524
524
  })) === null || _c === void 0 ? void 0 : _c[0];
525
525
  state.data.brandData.segment = selectedSegment;
526
526
  state.data.brandData.teamSize = selectedTeamSize;
@@ -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:
@@ -834,14 +834,14 @@ export var connectSlice = createSlice({
834
834
  var selectedBrand = ((_b = (_a = state.data.brandData) === null || _a === void 0 ? void 0 : _a.responseBody) === null || _b === void 0 ? void 0 : _b.brand_list[0]) || leadResponse.brand;
835
835
  state.data.brandData.brandName = (_c = selectedBrand === null || selectedBrand === void 0 ? void 0 : selectedBrand.name) === null || _c === void 0 ? void 0 : _c.en;
836
836
  state.data.brandData.segment = rest.segments_list.find(function (_a) {
837
- var _b;
837
+ var _b, _c;
838
838
  var id = _a.id;
839
- return ((_b = selectedBrand === null || selectedBrand === void 0 ? void 0 : selectedBrand.segment) === null || _b === void 0 ? void 0 : _b.type) === id;
839
+ return ((_c = (_b = selectedBrand === null || selectedBrand === void 0 ? void 0 : selectedBrand.segment) === null || _b === void 0 ? void 0 : _b.type) === null || _c === void 0 ? void 0 : _c.id) === id;
840
840
  });
841
841
  state.data.brandData.teamSize = rest.team_size_list.find(function (_a) {
842
- var _b;
842
+ var _b, _c;
843
843
  var id = _a.id;
844
- return ((_b = selectedBrand === null || selectedBrand === void 0 ? void 0 : selectedBrand.segment) === null || _b === void 0 ? void 0 : _b.team) === id;
844
+ return ((_c = (_b = selectedBrand === null || selectedBrand === void 0 ? void 0 : selectedBrand.segment) === null || _b === void 0 ? void 0 : _b.team) === null || _c === void 0 ? void 0 : _c.id) === id;
845
845
  });
846
846
  state.data.individualData = formData;
847
847
  state.data.individualData.responseBody = rest;
@@ -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) {