@tap-payments/auth-jsconnect 2.1.75-test → 2.1.77-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 (129) hide show
  1. package/build/@types/app.d.ts +24 -0
  2. package/build/@types/app.js +13 -0
  3. package/build/@types/form.d.ts +15 -1
  4. package/build/@types/index.d.ts +1 -0
  5. package/build/@types/index.js +1 -0
  6. package/build/@types/user.d.ts +141 -0
  7. package/build/@types/user.js +1 -0
  8. package/build/api/board.d.ts +16 -0
  9. package/build/api/board.js +10 -1
  10. package/build/api/country.d.ts +4 -0
  11. package/build/api/country.js +9 -1
  12. package/build/api/index.d.ts +8 -3
  13. package/build/api/individual.d.ts +43 -1
  14. package/build/api/individual.js +9 -1
  15. package/build/api/user.d.ts +6 -0
  16. package/build/api/user.js +9 -1
  17. package/build/assets/locales/ar.json +22 -2
  18. package/build/assets/locales/en.json +22 -1
  19. package/build/components/SimpleList/SimpleList.d.ts +2 -0
  20. package/build/constants/api.d.ts +1 -0
  21. package/build/constants/api.js +3 -1
  22. package/build/constants/app.d.ts +1 -0
  23. package/build/constants/app.js +20 -7
  24. package/build/constants/assets.d.ts +4 -0
  25. package/build/constants/assets.js +4 -0
  26. package/build/features/app/bank/bankStore.d.ts +1 -0
  27. package/build/features/app/bank/bankStore.js +2 -1
  28. package/build/features/app/brand/brandStore.d.ts +2 -0
  29. package/build/features/app/brand/brandStore.js +3 -1
  30. package/build/features/app/business/businessStore.js +1 -1
  31. package/build/features/app/entity/entityStore.d.ts +2 -0
  32. package/build/features/app/entity/entityStore.js +3 -1
  33. package/build/features/app/individual/individualStore.d.ts +28 -3
  34. package/build/features/app/individual/individualStore.js +466 -118
  35. package/build/features/app/password/passwordStore.js +2 -2
  36. package/build/features/app/tax/taxStore.js +30 -29
  37. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  38. package/build/features/brand/screens/BrandActivities/ActivitiesList.d.ts +3 -3
  39. package/build/features/brand/screens/BrandActivities/CustomerBase.d.ts +2 -2
  40. package/build/features/brand/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  41. package/build/features/business/screens/Activities/ActivitiesList.d.ts +3 -3
  42. package/build/features/business/screens/BusinessType/LicenseType.d.ts +2 -2
  43. package/build/features/business/screens/Customers/CustomerLocations.d.ts +2 -2
  44. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  45. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.d.ts +2 -2
  46. package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  47. package/build/features/entity/screens/EntityCapital/ActivityList.d.ts +3 -3
  48. package/build/features/entity/screens/EntityName/EntityTypeList.d.ts +3 -3
  49. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  50. package/build/features/featuresScreens.js +10 -0
  51. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.d.ts +13 -0
  52. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +43 -8
  53. package/build/features/individual/screens/AdditionalIndividualInfo/EmployerLocation.js +3 -13
  54. package/build/features/individual/screens/AdditionalIndividualInfo/InfluencerSwitch.js +9 -2
  55. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +11 -17
  56. package/build/features/individual/screens/AdditionalIndividualInfo/Occupation.js +12 -16
  57. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.d.ts +2 -2
  58. package/build/features/individual/screens/AdditionalIndividualInfo/PEPSwitch.js +9 -2
  59. package/build/features/individual/screens/AdditionalIndividualInfo/ShareCount.d.ts +6 -0
  60. package/build/features/individual/screens/AdditionalIndividualInfo/ShareCount.js +35 -0
  61. package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.d.ts +6 -0
  62. package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +41 -0
  63. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +9 -6
  64. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +20 -17
  65. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +18 -25
  66. package/build/features/individual/screens/IndividualList/IndividualList.d.ts +31 -0
  67. package/build/features/individual/screens/IndividualList/IndividualList.js +59 -0
  68. package/build/features/individual/screens/IndividualList/UserList.d.ts +5 -0
  69. package/build/features/individual/screens/IndividualList/UserList.js +138 -0
  70. package/build/features/individual/screens/IndividualList/index.d.ts +3 -0
  71. package/build/features/individual/screens/IndividualList/index.js +2 -0
  72. package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.d.ts +8 -0
  73. package/build/features/individual/screens/IndividualPersonalInfo/BirthCity.js +90 -0
  74. package/build/features/individual/screens/IndividualPersonalInfo/BirthCountry.d.ts +10 -0
  75. package/build/features/individual/screens/IndividualPersonalInfo/BirthCountry.js +82 -0
  76. package/build/features/individual/screens/IndividualPersonalInfo/DOB.d.ts +7 -0
  77. package/build/features/individual/screens/IndividualPersonalInfo/DOB.js +46 -0
  78. package/build/features/individual/screens/IndividualPersonalInfo/Email.d.ts +6 -0
  79. package/build/features/individual/screens/IndividualPersonalInfo/Email.js +50 -0
  80. package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.d.ts +7 -0
  81. package/build/features/individual/screens/IndividualPersonalInfo/ExpiryDate.js +49 -0
  82. package/build/features/individual/screens/IndividualPersonalInfo/Gender.d.ts +34 -0
  83. package/build/features/individual/screens/IndividualPersonalInfo/Gender.js +81 -0
  84. package/build/features/individual/screens/IndividualPersonalInfo/ID.d.ts +6 -0
  85. package/build/features/individual/screens/IndividualPersonalInfo/ID.js +48 -0
  86. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.d.ts +21 -0
  87. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +126 -0
  88. package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.d.ts +10 -0
  89. package/build/features/individual/screens/IndividualPersonalInfo/IssuedCountry.js +88 -0
  90. package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.d.ts +10 -0
  91. package/build/features/individual/screens/IndividualPersonalInfo/MobileNumber.js +145 -0
  92. package/build/features/individual/screens/IndividualPersonalInfo/Name.d.ts +6 -0
  93. package/build/features/individual/screens/IndividualPersonalInfo/Name.js +52 -0
  94. package/build/features/individual/screens/IndividualPersonalInfo/Nationality.d.ts +10 -0
  95. package/build/features/individual/screens/IndividualPersonalInfo/Nationality.js +88 -0
  96. package/build/features/individual/screens/IndividualPersonalInfo/index.d.ts +3 -0
  97. package/build/features/individual/screens/IndividualPersonalInfo/index.js +2 -0
  98. package/build/features/individual/screens/IndividualPersonalInfo/validation.d.ts +38 -0
  99. package/build/features/individual/screens/IndividualPersonalInfo/validation.js +68 -0
  100. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  101. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  102. package/build/features/shared/Address/Address.d.ts +6 -1
  103. package/build/features/shared/Address/Address.js +40 -30
  104. package/build/features/shared/Address/CountryList.d.ts +1 -1
  105. package/build/features/shared/Address/InputSelect.d.ts +1 -1
  106. package/build/features/shared/Address/InputText.d.ts +2 -1
  107. package/build/features/shared/Address/InputText.js +2 -2
  108. package/build/features/shared/Button/FlowsButtons.d.ts +1 -0
  109. package/build/features/shared/Button/FlowsButtons.js +2 -2
  110. package/build/features/shared/Button/ListButton.d.ts +17 -0
  111. package/build/features/shared/Button/ListButton.js +107 -0
  112. package/build/features/shared/Button/index.d.ts +2 -1
  113. package/build/features/shared/Button/index.js +2 -1
  114. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.d.ts +2 -1
  115. package/build/features/shared/SuccessFlowButtons/SuccessFlowButtons.js +6 -4
  116. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  117. package/build/features/tax/screens/TaxDetails/TaxDetails.js +2 -1
  118. package/build/features/tax/screens/TaxDetails/VATId.js +8 -3
  119. package/build/features/tax/screens/TaxDetails/validation.d.ts +4 -4
  120. package/build/features/tax/screens/TaxDetails/validation.js +10 -5
  121. package/build/utils/string.d.ts +3 -2
  122. package/build/utils/string.js +16 -3
  123. package/package.json +1 -1
  124. package/build/features/individual/screens/ShowIndividualInfo/ShowOwnerInfo.d.ts +0 -19
  125. package/build/features/individual/screens/ShowIndividualInfo/ShowOwnerInfo.js +0 -52
  126. package/build/features/individual/screens/ShowIndividualInfo/index.d.ts +0 -3
  127. package/build/features/individual/screens/ShowIndividualInfo/index.js +0 -2
  128. package/build/features/individual/screens/ShowIndividualInfo/info.d.ts +0 -7
  129. package/build/features/individual/screens/ShowIndividualInfo/info.js +0 -28
@@ -45,19 +45,40 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
45
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
46
  }
47
47
  };
48
+ var __rest = (this && this.__rest) || function (s, e) {
49
+ var t = {};
50
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
51
+ t[p] = s[p];
52
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
53
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
54
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
55
+ t[p[i]] = s[p[i]];
56
+ }
57
+ return t;
58
+ };
59
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
60
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
61
+ if (ar || !(i in from)) {
62
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
63
+ ar[i] = from[i];
64
+ }
65
+ }
66
+ return to.concat(ar || Array.prototype.slice.call(from));
67
+ };
48
68
  var _a;
49
69
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
70
  import API from '../../../api';
51
- import { FlowsTypes } from '../../../@types';
71
+ import { FlowsTypes, IndividualGender, IndividualType, FieldType } from '../../../@types';
52
72
  import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
53
- import { INDIVIDUAl_STEP_NAMES } from '../../../constants';
73
+ import { defaultCountry, IDENTIFICATION_TYPE, INDIVIDUAl_STEP_NAMES } from '../../../constants';
74
+ import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, getEighteenYearsAgo, getIndividualName, getUserName, sleep } from '../../../utils';
54
75
  export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', function (_a, thunkApi) {
55
76
  var token = _a.token, isInternally = _a.isInternally;
56
77
  return __awaiter(void 0, void 0, void 0, function () {
57
- var payload, settings, data, boardData, individualData, countryCode, boardInfoData, boardInfoStatus, countries, board_id, board_info_id, notification, _b, id, type, info, hasIndividualCompleted;
58
- var _c, _d, _e, _f;
59
- return __generator(this, function (_g) {
60
- switch (_g.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;
79
+ var _c, _d, _e, _f, _g, _h, _j;
80
+ return __generator(this, function (_k) {
81
+ switch (_k.label) {
61
82
  case 0:
62
83
  payload = {
63
84
  service_name: 'tap_email',
@@ -66,70 +87,82 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
66
87
  settings = thunkApi.getState().settings;
67
88
  return [4, API.leadService.verifyLeadToken(payload)];
68
89
  case 1:
69
- data = (_g.sent()).data;
90
+ data = (_k.sent()).data;
70
91
  boardInfoStatus = undefined;
71
92
  countries = settings.data.countries;
72
- if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 11];
93
+ if (((_c = data.errors) === null || _c === void 0 ? void 0 : _c.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
94
+ throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
73
95
  if (isInternally)
74
96
  data.step_name = INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO;
75
97
  if (data === null || data === void 0 ? void 0 : data.country_code) {
76
98
  countryCode = data === null || data === void 0 ? void 0 : data.country_code;
77
99
  thunkApi.dispatch(handleSetCountryByIso2(countryCode));
78
100
  }
79
- if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 11];
101
+ if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 14];
80
102
  board_id = data === null || data === void 0 ? void 0 : data.id;
81
103
  board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
82
104
  if (!(board_id && board_info_id)) return [3, 4];
83
105
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
84
106
  case 2:
85
- boardInfoData = _g.sent();
107
+ boardInfoData = _k.sent();
86
108
  notification = (boardInfoData || {}).notification;
87
109
  _b = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _b.id, type = _b.type;
88
110
  if (!(id && type)) return [3, 4];
89
- return [4, API.individualService.retrieveIndividual(id, type)];
111
+ return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode }))];
90
112
  case 3:
91
- individualData = _g.sent();
92
- _g.label = 4;
113
+ payload_1 = (_k.sent()).payload;
114
+ individualData = payload_1.data || {};
115
+ _k.label = 4;
93
116
  case 4:
94
117
  if (!board_id) return [3, 7];
95
118
  return [4, API.boardService.retrieveBoardDetails(board_id)];
96
119
  case 5:
97
- boardData = _g.sent();
120
+ boardData = _k.sent();
98
121
  return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
99
122
  case 6:
100
- boardInfoStatus = _g.sent();
101
- _g.label = 7;
123
+ boardInfoStatus = _k.sent();
124
+ _k.label = 7;
102
125
  case 7:
103
126
  if (!countryCode) {
104
- countryCode = (_c = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _c === void 0 ? void 0 : _c.country;
127
+ countryCode = (_d = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _d === void 0 ? void 0 : _d.country;
105
128
  if (countryCode)
106
129
  thunkApi.dispatch(handleSetCountryByIso2(countryCode));
107
130
  }
108
131
  info = (boardInfoStatus || {}).info;
109
- hasIndividualCompleted = ((_d = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _d === void 0 ? void 0 : _d.status) === 'completed';
132
+ hasIndividualCompleted = ((_e = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _e === void 0 ? void 0 : _e.status) === 'completed';
110
133
  if (!hasIndividualCompleted) return [3, 8];
111
134
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
112
- return [3, 11];
135
+ return [3, 14];
113
136
  case 8:
114
- if (!countryCode) return [3, 10];
115
- return [4, thunkApi.dispatch(retrieveDataList(countryCode))];
137
+ if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 11];
138
+ if (!((_f = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _f === void 0 ? void 0 : _f.id)) return [3, 10];
139
+ return [4, thunkApi.dispatch(getIndividualList((_g = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _g === void 0 ? void 0 : _g.id))];
116
140
  case 9:
117
- _g.sent();
118
- _g.label = 10;
141
+ _k.sent();
142
+ _k.label = 10;
119
143
  case 10:
120
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
121
- _g.label = 11;
122
- case 11: return [2, {
144
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
145
+ return [3, 14];
146
+ case 11:
147
+ if (!countryCode) return [3, 13];
148
+ return [4, thunkApi.dispatch(getCityList(countryCode))];
149
+ case 12:
150
+ _k.sent();
151
+ _k.label = 13;
152
+ case 13:
153
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
154
+ _k.label = 14;
155
+ case 14: return [2, {
123
156
  data: data,
124
157
  boardResponse: {
125
- user: individualData === null || individualData === void 0 ? void 0 : individualData.user,
126
158
  brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
127
159
  bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
128
160
  entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
129
161
  merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
130
162
  merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
131
- name: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _e === void 0 ? void 0 : _e.names,
132
- contact: (_f = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _f === void 0 ? void 0 : _f.contact,
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,
165
+ individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
133
166
  countries: countries,
134
167
  countryCode: countryCode,
135
168
  notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
@@ -158,6 +191,114 @@ export var resendOTP = createAsyncThunk('resendOTPIndividual', function (params,
158
191
  }
159
192
  });
160
193
  }); });
194
+ 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
+ return __generator(this, function (_a) {
197
+ switch (_a.label) {
198
+ case 0:
199
+ settings = thunkApi.getState().settings;
200
+ user = params.user, userList = params.userList;
201
+ id = user.id, type = user.type;
202
+ countryCode = settings.data.businessCountry.iso2;
203
+ if (!countryCode) return [3, 2];
204
+ return [4, thunkApi.dispatch(getCityList(countryCode))];
205
+ case 1:
206
+ _a.sent();
207
+ _a.label = 2;
208
+ case 2: return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type }))];
209
+ case 3:
210
+ _a.sent();
211
+ sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP')); });
212
+ return [2, { userList: userList }];
213
+ }
214
+ });
215
+ }); });
216
+ export var requestDetailsByEmail = createAsyncThunk('individual/requestDetailsByEmail', function (user, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
217
+ var individual, _a, merchant_id, board_id, id, type, payload, data;
218
+ return __generator(this, function (_b) {
219
+ switch (_b.label) {
220
+ case 0:
221
+ individual = thunkApi.getState().individual;
222
+ _a = individual.data.verify.responseBody || {}, merchant_id = _a.merchant_id, board_id = _a.board_id;
223
+ id = user.id, type = user.type;
224
+ payload = {
225
+ id: board_id,
226
+ merchant_id: merchant_id,
227
+ info: [
228
+ {
229
+ name: 'individual'
230
+ }
231
+ ],
232
+ notification: {
233
+ recipient: {
234
+ id: id,
235
+ type: type
236
+ },
237
+ channel: ['email']
238
+ }
239
+ };
240
+ return [4, API.boardService.requestDetailsByEmail(payload)];
241
+ case 1:
242
+ data = _b.sent();
243
+ return [2, data];
244
+ }
245
+ });
246
+ }); });
247
+ export var getIndividualList = createAsyncThunk('individual/getIndividualList', function (businessId) { return __awaiter(void 0, void 0, void 0, function () {
248
+ var payload, _a, users, shareholders, board_members, userList, shareHolderList, boardMemberList, individualList;
249
+ return __generator(this, function (_b) {
250
+ switch (_b.label) {
251
+ case 0:
252
+ payload = {
253
+ page: 1,
254
+ limit: 10,
255
+ business_id: businessId
256
+ };
257
+ return [4, API.individualService.getIndividualList(payload)];
258
+ case 1:
259
+ _a = _b.sent(), users = _a.users, shareholders = _a.shareholders, board_members = _a.board_members;
260
+ userList = (users || []).map(function (user) { return (__assign(__assign({}, user), { type: IndividualType.USER })); });
261
+ shareHolderList = (shareholders || []).map(function (shareholder) { return (__assign(__assign({}, shareholder), { type: IndividualType.SHARE_HOLDER })); });
262
+ boardMemberList = (board_members || []).map(function (board_member) { return (__assign(__assign({}, board_member), { type: IndividualType.BOARD_MEMBER })); });
263
+ individualList = __spreadArray(__spreadArray(__spreadArray([], userList, true), shareHolderList, true), boardMemberList, true);
264
+ return [2, individualList];
265
+ }
266
+ });
267
+ }); });
268
+ export var getCityList = createAsyncThunk('individual/getCityList', function (countryCode) { return __awaiter(void 0, void 0, void 0, function () {
269
+ var cityBody, list;
270
+ return __generator(this, function (_a) {
271
+ switch (_a.label) {
272
+ case 0:
273
+ cityBody = {
274
+ country: [countryCode]
275
+ };
276
+ return [4, API.countryService.getCities(cityBody)];
277
+ case 1:
278
+ list = (_a.sent()).list;
279
+ return [2, list || []];
280
+ }
281
+ });
282
+ }); });
283
+ export var retrieveIndividualInfo = createAsyncThunk('individual/retrieveIndividualInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
284
+ var id, type, countryCode, settings, data, individualData;
285
+ return __generator(this, function (_a) {
286
+ switch (_a.label) {
287
+ case 0:
288
+ id = params.id, type = params.type, countryCode = params.countryCode;
289
+ settings = thunkApi.getState().settings;
290
+ return [4, API.individualService.retrieveIndividual(id, type)];
291
+ case 1:
292
+ data = _a.sent();
293
+ individualData = data === null || data === void 0 ? void 0 : data.user;
294
+ if (type === IndividualType.SHARE_HOLDER)
295
+ individualData = data === null || data === void 0 ? void 0 : data.shareholder;
296
+ else if (type === IndividualType.BOARD_MEMBER)
297
+ individualData = data === null || data === void 0 ? void 0 : data.board_member;
298
+ return [2, { data: __assign(__assign({}, (individualData || {})), { type: type }), countryCode: countryCode, countries: settings.data.countries }];
299
+ }
300
+ });
301
+ }); });
161
302
  export var retrieveDataList = createAsyncThunk('individualRetrieveDataList', function (countryCode) { return __awaiter(void 0, void 0, void 0, function () {
162
303
  var monthlyIncomeBody, dataBody, _a, sourceIncome, monthlyIncome, occupation;
163
304
  return __generator(this, function (_b) {
@@ -186,24 +327,24 @@ export var retrieveDataList = createAsyncThunk('individualRetrieveDataList', fun
186
327
  });
187
328
  }); });
188
329
  export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetails', function (boardId) { return __awaiter(void 0, void 0, void 0, function () {
189
- var data;
190
- var _a, _b;
191
- return __generator(this, function (_c) {
192
- switch (_c.label) {
330
+ var _a, user, data;
331
+ var _b, _c;
332
+ return __generator(this, function (_d) {
333
+ switch (_d.label) {
193
334
  case 0: return [4, API.boardService.retrieveBoardDetails(boardId)];
194
335
  case 1:
195
- data = _c.sent();
336
+ _a = _d.sent(), user = _a.user, data = __rest(_a, ["user"]);
196
337
  return [2, {
197
- data: __assign(__assign({}, data), { user: data === null || data === void 0 ? void 0 : data.user, brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.names, contact: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.contact })
338
+ data: __assign(__assign({}, data), { brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.names, individuals: data === null || data === void 0 ? void 0 : data.individuals, contact: (_c = data === null || data === void 0 ? void 0 : data.user) === null || _c === void 0 ? void 0 : _c.contact })
198
339
  }];
199
340
  }
200
341
  });
201
342
  }); });
202
343
  export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
203
- var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData, individualData, boardData, countryCode, boardInfoStatus, notification, _c, id, type, info, hasIndividualCompleted;
204
- var _d, _e, _f, _g, _h, _j, _k;
205
- return __generator(this, function (_l) {
206
- switch (_l.label) {
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) {
207
348
  case 0:
208
349
  _a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
209
350
  responseBody = individual.data.verify.responseBody;
@@ -218,57 +359,68 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
218
359
  };
219
360
  return [4, API.leadService.verifyLeadOTP(payload)];
220
361
  case 1:
221
- data = (_l.sent()).data;
362
+ data = (_o.sent()).data;
222
363
  boardInfoStatus = undefined;
223
- if (!!(data === null || data === void 0 ? void 0 : data.errors)) return [3, 11];
224
- if (!(board_id && board_info_id)) return [3, 4];
225
- return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
364
+ if (!!(data === null || data === void 0 ? void 0 : data.errors)) return [3, 14];
365
+ if (!board_id) return [3, 4];
366
+ return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
226
367
  case 2:
227
- boardInfoData = _l.sent();
228
- notification = (boardInfoData || {}).notification;
229
- _c = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
230
- if (!(id && type)) return [3, 4];
231
- return [4, API.individualService.retrieveIndividual(id, type)];
368
+ boardInfoStatus = _o.sent();
369
+ return [4, API.boardService.retrieveBoardDetails(board_id)];
232
370
  case 3:
233
- individualData = _l.sent();
234
- _l.label = 4;
371
+ boardData = _o.sent();
372
+ _o.label = 4;
235
373
  case 4:
236
- if (!board_id) return [3, 7];
237
- return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
374
+ countryCode = (_e = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _e === void 0 ? void 0 : _e.country;
375
+ if (!(board_id && board_info_id)) return [3, 7];
376
+ return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
238
377
  case 5:
239
- boardInfoStatus = _l.sent();
240
- return [4, API.boardService.retrieveBoardDetails(board_id)];
378
+ boardInfoData = _o.sent();
379
+ notification = (boardInfoData || {}).notification;
380
+ _c = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
381
+ if (!(id && type)) return [3, 7];
382
+ return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode }))];
241
383
  case 6:
242
- boardData = _l.sent();
243
- _l.label = 7;
384
+ payload_2 = (_o.sent()).payload;
385
+ individualData = payload_2.data || {};
386
+ _o.label = 7;
244
387
  case 7:
245
- countryCode = (_e = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _e === void 0 ? void 0 : _e.country;
246
388
  info = (boardInfoStatus || {}).info;
247
389
  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';
248
390
  (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
249
391
  if (!hasIndividualCompleted) return [3, 8];
250
392
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
251
- return [3, 11];
393
+ return [3, 14];
252
394
  case 8:
253
- if (!countryCode) return [3, 10];
254
- return [4, thunkApi.dispatch(retrieveDataList(countryCode))];
395
+ if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 11];
396
+ if (!((_j = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _j === void 0 ? void 0 : _j.id)) return [3, 10];
397
+ return [4, thunkApi.dispatch(getIndividualList((_k = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _k === void 0 ? void 0 : _k.id))];
255
398
  case 9:
256
- _l.sent();
257
- _l.label = 10;
399
+ _o.sent();
400
+ _o.label = 10;
258
401
  case 10:
259
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
260
- _l.label = 11;
261
- case 11: return [2, {
402
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
403
+ return [3, 14];
404
+ case 11:
405
+ if (!countryCode) return [3, 13];
406
+ return [4, thunkApi.dispatch(getCityList(countryCode))];
407
+ case 12:
408
+ _o.sent();
409
+ _o.label = 13;
410
+ case 13:
411
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
412
+ _o.label = 14;
413
+ case 14: return [2, {
262
414
  data: data,
263
415
  boardResponse: {
264
- user: individualData === null || individualData === void 0 ? void 0 : individualData.user,
265
416
  brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
266
417
  bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
267
418
  entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
268
419
  merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
269
420
  merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
270
- name: (_j = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _j === void 0 ? void 0 : _j.names,
271
- contact: (_k = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _k === void 0 ? void 0 : _k.contact,
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
+ individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
272
424
  countries: countries,
273
425
  countryCode: countryCode,
274
426
  notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
@@ -279,14 +431,85 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
279
431
  }
280
432
  });
281
433
  }); });
434
+ 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;
436
+ var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
437
+ return __generator(this, function (_s) {
438
+ switch (_s.label) {
439
+ case 0:
440
+ _a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
441
+ _b = individual.data.verify.responseBody || {}, notification = _b.notification, user = _b.user, entity = _b.entity;
442
+ _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;
443
+ name = params.name, email = params.email, mobile = params.mobile, countryCode = params.countryCode, gender = params.gender, nid = params.nid, issuedCountry = params.issuedCountry, expiryDate = params.expiryDate, dob = params.dob, placeOfBirthCountry = params.placeOfBirthCountry, placeOfBirthCity = params.placeOfBirthCity, nationality = params.nationality;
444
+ code = entity === null || entity === void 0 ? void 0 : entity.country;
445
+ data_status = (user || {}).data_status;
446
+ 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
+ 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;
451
+ 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;
453
+ 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
+ isNationalityEditable = (data_status === null || data_status === void 0 ? void 0 : data_status.nationality) === FieldType.EDITABLE;
457
+ requestBody = {
458
+ id: id,
459
+ type: type,
460
+ names: isNameEditable
461
+ ? {
462
+ en: userName,
463
+ ar: userName
464
+ }
465
+ : 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
+ date_of_birth: dob,
480
+ birth: {
481
+ city: (_p = placeOfBirthCity === null || placeOfBirthCity === void 0 ? void 0 : placeOfBirthCity.name) === null || _p === void 0 ? void 0 : _p.en,
482
+ country: placeOfBirthCountry === null || placeOfBirthCountry === void 0 ? void 0 : placeOfBirthCountry.iso2
483
+ },
484
+ nationality: isNationalityEditable ? nationality === null || nationality === void 0 ? void 0 : nationality.iso2 : undefined,
485
+ encryption_contract: [],
486
+ step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_PERSONAL_INFO
487
+ };
488
+ return [4, API.individualService.updateIndividual(requestBody)];
489
+ case 1:
490
+ data = (_s.sent()).data;
491
+ return [4, thunkApi.dispatch(retrieveDataList(code))];
492
+ case 2:
493
+ _s.sent();
494
+ thunkApi.dispatch(handleNextScreenStep());
495
+ (_r = (_q = settings.data.appConfig).onStepCompleted) === null || _r === void 0 ? void 0 : _r.call(_q, settings.data.activeScreen.name, requestBody);
496
+ return [2, { data: data, formData: params }];
497
+ }
498
+ });
499
+ }); });
282
500
  export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
283
- var _a, settings, individual, _b, id, type, civilID, signatureFileId, businessCountry, documentsList, requestBody, documentBody, data;
284
- var _c, _d, _e, _f, _g, _h, _j, _k;
285
- return __generator(this, function (_l) {
286
- switch (_l.label) {
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) {
287
505
  case 0:
288
506
  _a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
289
- _b = ((_d = (_c = individual.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.notification) === null || _d === void 0 ? void 0 : _d.recipient) || {}, id = _b.id, type = _b.type;
507
+ _b = individual.data.verify.responseBody || {}, notification = _b.notification, user = _b.user;
508
+ isOccupationEditable = ((_d = user === null || user === void 0 ? void 0 : user.data_status) === null || _d === void 0 ? void 0 : _d.occupation) === FieldType.EDITABLE;
509
+ 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
+ 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
+ isInfluencerEditable = ((_g = user === null || user === void 0 ? void 0 : user.data_status) === null || _g === void 0 ? void 0 : _g.is_influencer) === FieldType.EDITABLE;
512
+ _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;
290
513
  civilID = params.civilID, signatureFileId = params.signatureFileId;
291
514
  businessCountry = settings.data.businessCountry;
292
515
  documentsList = [];
@@ -297,13 +520,13 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
297
520
  requestBody = {
298
521
  id: id,
299
522
  type: type,
300
- occupation: { id: (_e = params.occupation) === null || _e === void 0 ? void 0 : _e.id },
523
+ occupation: isOccupationEditable ? { id: (_h = params.occupation) === null || _h === void 0 ? void 0 : _h.id } : undefined,
301
524
  employer_name: params.employerName,
302
- employer_country: (_f = params.employerLocation) === null || _f === void 0 ? void 0 : _f.iso2,
303
- source_income: [{ id: (_g = params.sourceIncome) === null || _g === void 0 ? void 0 : _g.id }],
304
- monthly_income: { id: (_h = params.monthlyIncome) === null || _h === void 0 ? void 0 : _h.id },
305
- is_relative_PEP: params.isPEP,
306
- is_influencer: params.isInfluencer,
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,
307
530
  encryption_contract: ['employer_name', 'employer_country'],
308
531
  step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO
309
532
  };
@@ -315,13 +538,13 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
315
538
  if (!(documentsList.length > 0)) return [3, 2];
316
539
  return [4, API.entityService.updateDocumentInfo(documentBody)];
317
540
  case 1:
318
- _l.sent();
319
- _l.label = 2;
541
+ _p.sent();
542
+ _p.label = 2;
320
543
  case 2: return [4, API.individualService.updateIndividual(requestBody)];
321
544
  case 3:
322
- data = (_l.sent()).data;
545
+ data = (_p.sent()).data;
323
546
  thunkApi.dispatch(handleNextScreenStep());
324
- (_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, requestBody);
547
+ (_o = (_m = settings.data.appConfig).onStepCompleted) === null || _o === void 0 ? void 0 : _o.call(_m, settings.data.activeScreen.name, requestBody);
325
548
  return [2, { data: data, formData: params }];
326
549
  }
327
550
  });
@@ -368,6 +591,20 @@ var initialState = {
368
591
  otpData: {
369
592
  otp: ''
370
593
  },
594
+ individualPersonalData: {
595
+ name: '',
596
+ email: '',
597
+ mobile: '',
598
+ countryCode: defaultCountry,
599
+ gender: IndividualGender.MALE,
600
+ nid: '',
601
+ issuedCountry: undefined,
602
+ expiryDate: '',
603
+ dob: getEighteenYearsAgo(),
604
+ placeOfBirthCountry: undefined,
605
+ placeOfBirthCity: undefined,
606
+ nationality: undefined
607
+ },
371
608
  individualData: {
372
609
  occupation: undefined,
373
610
  sourceIncome: undefined,
@@ -406,38 +643,11 @@ export var individualSlice = createSlice({
406
643
  state.customLoading = true;
407
644
  })
408
645
  .addCase(verifyLeadToken.fulfilled, function (state, action) {
409
- var _a;
410
646
  state.error = null;
411
647
  state.customLoading = false;
412
- var _b = action.payload, data = _b.data, token = _b.token, boardResponse = _b.boardResponse;
413
- var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
414
- if (description) {
415
- state.error = description;
416
- return;
417
- }
648
+ var _a = action.payload, data = _a.data, token = _a.token, boardResponse = _a.boardResponse;
418
649
  state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id });
419
650
  state.data.verify.token = token;
420
- var _c = boardResponse || {}, countries = _c.countries, user = _c.user, countryCode = _c.countryCode;
421
- var _d = user || {}, source_income = _d.source_income, monthly_income = _d.monthly_income, occupation = _d.occupation, is_relative_PEP = _d.is_relative_PEP, is_influencer = _d.is_influencer;
422
- var _e = state.data.individualData.responseBody || {}, sourceIncomeList = _e.sourceIncomeList, monthlyIncomeList = _e.monthlyIncomeList, occupationList = _e.occupationList;
423
- var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a; return (source === null || source === void 0 ? void 0 : source.id) === ((_a = source_income === null || source_income === void 0 ? void 0 : source_income[0]) === null || _a === void 0 ? void 0 : _a.id); })) || (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
424
- if (!!selectedSourceIncome)
425
- state.data.individualData.sourceIncome = selectedSourceIncome;
426
- var code = (user === null || user === void 0 ? void 0 : user.employer_country) || countryCode;
427
- if (!!code) {
428
- var employerLocation = (countries || []).find(function (country) { return country.iso2 === code; });
429
- state.data.individualData.employerLocation = employerLocation;
430
- }
431
- var selectedMonthlyIncome = monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) {
432
- return income.id === (monthly_income === null || monthly_income === void 0 ? void 0 : monthly_income.id);
433
- });
434
- var selectedOccupation = occupationList === null || occupationList === void 0 ? void 0 : occupationList.find(function (occup) {
435
- return occup.id === (occupation === null || occupation === void 0 ? void 0 : occupation.id);
436
- });
437
- state.data.individualData.monthlyIncome = selectedMonthlyIncome;
438
- state.data.individualData.occupation = selectedOccupation;
439
- state.data.individualData.isPEP = is_relative_PEP;
440
- state.data.individualData.isInfluencer = is_influencer;
441
651
  })
442
652
  .addCase(verifyLeadToken.rejected, function (state, action) {
443
653
  state.error = action.error.message;
@@ -477,13 +687,93 @@ export var individualSlice = createSlice({
477
687
  state.data.otpData = formData;
478
688
  state.data.otpData.responseBody = data;
479
689
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), boardResponse);
480
- var _c = boardResponse || {}, countries = _c.countries, user = _c.user, countryCode = _c.countryCode;
481
- var _d = user || {}, source_income = _d.source_income, monthly_income = _d.monthly_income, occupation = _d.occupation, is_relative_PEP = _d.is_relative_PEP, is_influencer = _d.is_influencer;
482
- var _e = state.data.individualData.responseBody || {}, sourceIncomeList = _e.sourceIncomeList, monthlyIncomeList = _e.monthlyIncomeList, occupationList = _e.occupationList;
690
+ })
691
+ .addCase(verifyLeadOTP.rejected, function (state, action) {
692
+ state.loading = false;
693
+ state.error = action.error.message;
694
+ })
695
+ .addCase(addDetailsAsync.pending, function (state) {
696
+ state.loading = true;
697
+ state.error = null;
698
+ })
699
+ .addCase(addDetailsAsync.fulfilled, function (state, action) {
700
+ state.loading = false;
701
+ state.error = null;
702
+ var userList = action.payload.userList;
703
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { userList: userList });
704
+ })
705
+ .addCase(addDetailsAsync.rejected, function (state, action) {
706
+ state.loading = false;
707
+ state.error = action.error.message;
708
+ })
709
+ .addCase(requestDetailsByEmail.pending, function (state) {
710
+ state.loading = true;
711
+ state.error = null;
712
+ })
713
+ .addCase(requestDetailsByEmail.fulfilled, function (state, action) {
714
+ state.loading = false;
715
+ state.error = null;
716
+ var data = action.payload;
717
+ var userList = (state.data.verify.responseBody || {}).userList;
718
+ var list = userList || [];
719
+ list = list.map(function (user) { var _a, _b; return (user.id === ((_b = (_a = data === null || data === void 0 ? void 0 : data.notification) === null || _a === void 0 ? void 0 : _a.recipient) === null || _b === void 0 ? void 0 : _b.id) ? __assign(__assign({}, user), { isRequestedEmail: true }) : user); });
720
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { requestEmailData: data, userList: list });
721
+ })
722
+ .addCase(requestDetailsByEmail.rejected, function (state, action) {
723
+ state.loading = false;
724
+ state.error = action.error.message;
725
+ })
726
+ .addCase(retrieveIndividualInfo.pending, function (state) {
727
+ state.loading = true;
728
+ state.error = null;
729
+ })
730
+ .addCase(retrieveIndividualInfo.fulfilled, function (state, action) {
731
+ var _a, _b, _c, _d;
732
+ state.loading = false;
733
+ state.error = null;
734
+ var _e = action.payload, data = _e.data, countries = _e.countries, countryCode = _e.countryCode;
735
+ var user = (state.data.verify.responseBody || {}).user;
736
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { user: __assign(__assign({}, data), { is_authorized: data.is_authorized !== undefined ? data.is_authorized : user === null || user === void 0 ? void 0 : user.is_authorized }) });
737
+ var _f = data || {}, source_income = _f.source_income, monthly_income = _f.monthly_income, occupation = _f.occupation, is_relative_PEP = _f.is_relative_PEP, is_influencer = _f.is_influencer, birth = _f.birth, contact = _f.contact, identification = _f.identification, nationality = _f.nationality, gender = _f.gender, employer_country = _f.employer_country;
738
+ var _g = state.data.individualData.responseBody || {}, sourceIncomeList = _g.sourceIncomeList, monthlyIncomeList = _g.monthlyIncomeList, occupationList = _g.occupationList;
739
+ var cityList = (state.data.verify.responseBody || {}).cityList;
740
+ if (data)
741
+ state.data.individualPersonalData.name = getUserName(data, false);
742
+ if (contact === null || contact === void 0 ? void 0 : contact.email)
743
+ state.data.individualPersonalData.email = contact === null || contact === void 0 ? void 0 : contact.email;
744
+ if ((_a = contact === null || contact === void 0 ? void 0 : contact.phone) === null || _a === void 0 ? void 0 : _a.number)
745
+ state.data.individualPersonalData.mobile = (_b = contact === null || contact === void 0 ? void 0 : contact.phone) === null || _b === void 0 ? void 0 : _b.number;
746
+ if ((_c = contact === null || contact === void 0 ? void 0 : contact.phone) === null || _c === void 0 ? void 0 : _c.country_code) {
747
+ state.data.individualPersonalData.countryCode = findCountryByIddPrefix(countries, (_d = contact === null || contact === void 0 ? void 0 : contact.phone) === null || _d === void 0 ? void 0 : _d.country_code) || defaultCountry;
748
+ }
749
+ if (gender)
750
+ state.data.individualPersonalData.gender = gender.toLowerCase();
751
+ if (identification === null || identification === void 0 ? void 0 : identification.id)
752
+ state.data.individualPersonalData.nid = identification === null || identification === void 0 ? void 0 : identification.id;
753
+ state.data.individualPersonalData.issuedCountry = identification === null || identification === void 0 ? void 0 : identification.issued_country_code;
754
+ if (identification === null || identification === void 0 ? void 0 : identification.issued_country_code) {
755
+ state.data.individualPersonalData.issuedCountry = findCountryByIso2(countries, identification === null || identification === void 0 ? void 0 : identification.issued_country_code);
756
+ }
757
+ var expiryDate = (identification === null || identification === void 0 ? void 0 : identification.expiry) || new Date().getTime();
758
+ state.data.individualPersonalData.expiryDate = convertNumbers2English(dateFormat(expiryDate));
759
+ if (birth === null || birth === void 0 ? void 0 : birth.date)
760
+ state.data.individualPersonalData.dob = convertNumbers2English(dateFormat(birth === null || birth === void 0 ? void 0 : birth.date));
761
+ if (birth === null || birth === void 0 ? void 0 : birth.country) {
762
+ state.data.individualPersonalData.placeOfBirthCountry = findCountryByIso2(countries, birth === null || birth === void 0 ? void 0 : birth.country);
763
+ }
764
+ if (birth === null || birth === void 0 ? void 0 : birth.city) {
765
+ var selectedCity = cityList === null || cityList === void 0 ? void 0 : cityList.find(function (city) {
766
+ return city.name.en === (birth === null || birth === void 0 ? void 0 : birth.city);
767
+ });
768
+ state.data.individualPersonalData.placeOfBirthCity = selectedCity;
769
+ }
770
+ if (nationality) {
771
+ state.data.individualPersonalData.nationality = findCountryByIso2(countries, nationality);
772
+ }
483
773
  var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a; return (source === null || source === void 0 ? void 0 : source.id) === ((_a = source_income === null || source_income === void 0 ? void 0 : source_income[0]) === null || _a === void 0 ? void 0 : _a.id); })) || (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
484
774
  if (!!selectedSourceIncome)
485
775
  state.data.individualData.sourceIncome = selectedSourceIncome;
486
- var code = (user === null || user === void 0 ? void 0 : user.employer_country) || countryCode;
776
+ var code = employer_country || countryCode;
487
777
  if (!!code) {
488
778
  var employerLocation = (countries || []).find(function (country) { return country.iso2 === code; });
489
779
  state.data.individualData.employerLocation = employerLocation;
@@ -499,7 +789,20 @@ export var individualSlice = createSlice({
499
789
  state.data.individualData.isPEP = is_relative_PEP;
500
790
  state.data.individualData.isInfluencer = is_influencer;
501
791
  })
502
- .addCase(verifyLeadOTP.rejected, function (state, action) {
792
+ .addCase(retrieveIndividualInfo.rejected, function (state, action) {
793
+ state.loading = false;
794
+ state.error = action.error.message;
795
+ })
796
+ .addCase(getIndividualList.pending, function (state) {
797
+ state.loading = true;
798
+ state.error = null;
799
+ })
800
+ .addCase(getIndividualList.fulfilled, function (state, action) {
801
+ state.loading = false;
802
+ state.error = null;
803
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { userList: action.payload });
804
+ })
805
+ .addCase(getIndividualList.rejected, function (state, action) {
503
806
  state.loading = false;
504
807
  state.error = action.error.message;
505
808
  })
@@ -508,15 +811,60 @@ export var individualSlice = createSlice({
508
811
  state.error = null;
509
812
  })
510
813
  .addCase(retrieveDataList.fulfilled, function (state, action) {
814
+ var _a;
511
815
  state.loading = false;
512
816
  state.error = null;
513
- var _a = action.payload, sourceIncome = _a.sourceIncome, monthlyIncome = _a.monthlyIncome, occupation = _a.occupation;
817
+ var _b = action.payload, sourceIncome = _b.sourceIncome, monthlyIncome = _b.monthlyIncome, occupationData = _b.occupation;
514
818
  var data = state.data.individualData.responseBody;
515
- state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: (sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome.list) || [], monthlyIncomeList: (monthlyIncome === null || monthlyIncome === void 0 ? void 0 : monthlyIncome.list) || [], occupationList: (occupation === null || occupation === void 0 ? void 0 : occupation.list) || [] });
819
+ var sourceIncomeList = (sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome.list) || [];
820
+ var monthlyIncomeList = (monthlyIncome === null || monthlyIncome === void 0 ? void 0 : monthlyIncome.list) || [];
821
+ var occupationList = (occupationData === null || occupationData === void 0 ? void 0 : occupationData.list) || [];
822
+ state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: sourceIncomeList, monthlyIncomeList: monthlyIncomeList, occupationList: occupationList });
823
+ var _c = ((_a = state.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.user) || {}, source_income = _c.source_income, monthly_income = _c.monthly_income, occupation = _c.occupation;
824
+ var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a; return (source === null || source === void 0 ? void 0 : source.id) === ((_a = source_income === null || source_income === void 0 ? void 0 : source_income[0]) === null || _a === void 0 ? void 0 : _a.id); })) || (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
825
+ if (!!selectedSourceIncome)
826
+ state.data.individualData.sourceIncome = selectedSourceIncome;
827
+ var selectedMonthlyIncome = monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) {
828
+ return income.id === (monthly_income === null || monthly_income === void 0 ? void 0 : monthly_income.id);
829
+ });
830
+ var selectedOccupation = occupationList === null || occupationList === void 0 ? void 0 : occupationList.find(function (occup) {
831
+ return occup.id === (occupation === null || occupation === void 0 ? void 0 : occupation.id);
832
+ });
833
+ state.data.individualData.monthlyIncome = selectedMonthlyIncome;
834
+ state.data.individualData.occupation = selectedOccupation;
516
835
  })
517
836
  .addCase(retrieveDataList.rejected, function (state, action) {
518
837
  state.loading = false;
519
838
  state.error = action.error.message;
839
+ })
840
+ .addCase(getCityList.pending, function (state) {
841
+ state.loading = true;
842
+ state.error = null;
843
+ })
844
+ .addCase(getCityList.fulfilled, function (state, action) {
845
+ state.loading = false;
846
+ state.error = null;
847
+ var data = state.data.verify.responseBody;
848
+ state.data.verify.responseBody = __assign(__assign({}, data), { cityList: action.payload });
849
+ })
850
+ .addCase(getCityList.rejected, function (state, action) {
851
+ state.loading = false;
852
+ state.error = action.error.message;
853
+ })
854
+ .addCase(updateIndividualPersonalInfo.pending, function (state) {
855
+ state.loading = true;
856
+ state.error = null;
857
+ })
858
+ .addCase(updateIndividualPersonalInfo.fulfilled, function (state, action) {
859
+ state.loading = false;
860
+ state.error = null;
861
+ var _a = action.payload, data = _a.data, formData = _a.formData;
862
+ state.data.individualPersonalData = formData;
863
+ state.data.individualPersonalData.responseBody = data;
864
+ })
865
+ .addCase(updateIndividualPersonalInfo.rejected, function (state, action) {
866
+ state.loading = false;
867
+ state.error = action.error.message;
520
868
  })
521
869
  .addCase(updateIndividualInfo.pending, function (state) {
522
870
  state.loading = true;