@tap-payments/auth-jsconnect 2.8.63-development → 2.8.64-beta

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 (53) hide show
  1. package/build/@types/redux.d.ts +0 -1
  2. package/build/api/entity.d.ts +2 -2
  3. package/build/api/entity.js +4 -12
  4. package/build/api/index.d.ts +2 -2
  5. package/build/app/settings.js +2 -3
  6. package/build/components/Tooltip/Tooltip.js +1 -1
  7. package/build/constants/api.d.ts +1 -0
  8. package/build/constants/api.js +2 -0
  9. package/build/constants/app.d.ts +3 -0
  10. package/build/constants/app.js +3 -0
  11. package/build/features/app/bank/bankStore.d.ts +19 -13
  12. package/build/features/app/bank/bankStore.js +165 -183
  13. package/build/features/app/board/boardStore.js +10 -16
  14. package/build/features/app/brand/brandStore.d.ts +31 -16
  15. package/build/features/app/brand/brandStore.js +239 -243
  16. package/build/features/app/business/businessStore.js +1 -7
  17. package/build/features/app/entity/entityStore.d.ts +34 -20
  18. package/build/features/app/entity/entityStore.js +249 -204
  19. package/build/features/app/individual/individualStore.d.ts +36 -17
  20. package/build/features/app/individual/individualStore.js +270 -221
  21. package/build/features/app/password/passwordStore.d.ts +25 -21
  22. package/build/features/app/password/passwordStore.js +219 -196
  23. package/build/features/app/tax/taxStore.d.ts +7 -13
  24. package/build/features/app/tax/taxStore.js +147 -168
  25. package/build/features/auth/screens/AuthenticationList/LicenseNumber.js +2 -2
  26. package/build/features/bank/screens/BankDetails/BankDetails.js +4 -17
  27. package/build/features/brand/screens/BrandActivities/BrandActivities.js +11 -48
  28. package/build/features/brand/screens/BrandInfo/BrandInfo.js +4 -22
  29. package/build/features/brand/screens/BrandSegmentInfo/BrandSegmentInfo.js +6 -22
  30. package/build/features/business/screens/Activities/Activities.js +1 -9
  31. package/build/features/business/screens/BusinessType/LicenseNumber.js +2 -2
  32. package/build/features/business/screens/Customers/Customers.js +1 -9
  33. package/build/features/connect/screens/BusinessCountry/BusinessCountry.js +1 -7
  34. package/build/features/connectExpress/screens/AuthenticationList/LicenseNumber.js +2 -2
  35. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +2 -2
  36. package/build/features/entity/screens/EntityCapital/EntityCapital.js +9 -33
  37. package/build/features/entity/screens/EntityName/EntityName.js +14 -31
  38. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +10 -43
  39. package/build/features/individual/screens/IndividualList/IndividualList.js +0 -7
  40. package/build/features/individual/screens/IndividualList/UserList.js +3 -3
  41. package/build/features/individual/screens/IndividualPersonalInfo/IndividualPersonalInfo.js +18 -73
  42. package/build/features/password/Password.js +1 -1
  43. package/build/features/shared/Button/FlowsButtons.js +1 -7
  44. package/build/features/signIn/SignIn.js +2 -10
  45. package/build/features/tax/screens/TaxDetails/TaxDetails.js +2 -7
  46. package/build/hooks/index.d.ts +0 -1
  47. package/build/hooks/index.js +0 -1
  48. package/build/utils/common.js +4 -4
  49. package/build/utils/validation.d.ts +1 -0
  50. package/build/utils/validation.js +3 -0
  51. package/package.json +2 -2
  52. package/build/hooks/useFormDirtyCheck.d.ts +0 -10
  53. package/build/hooks/useFormDirtyCheck.js +0 -66
@@ -75,109 +75,132 @@ import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountry
75
75
  export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a, thunkApi) {
76
76
  var token = _a.token, isInternally = _a.isInternally, isUpdatePhoneInfo = _a.isUpdatePhoneInfo;
77
77
  return __awaiter(void 0, void 0, void 0, function () {
78
- var settings, payload, data, userList, recipientData, countries, _b, country_code, config, boardId, countryCode, publicKey, data_1, _c, business_id, recipient, board_id, board_info_id, notification, _d, id_1, type, individualData, birthCountry;
79
- var _e, _f, _g, _h;
80
- return __generator(this, function (_j) {
81
- switch (_j.label) {
78
+ var payload, settings, data, individualData, boardData, countryCode, boardInfoData, userList, boardInfoStatus, countries, publicKey, board_id, board_info_id, notification, _b, id, type, data_1, birthCountry, individuals, _c, is_authorized, data_state;
79
+ var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
80
+ return __generator(this, function (_p) {
81
+ switch (_p.label) {
82
82
  case 0:
83
- settings = thunkApi.getState().settings;
84
83
  payload = __assign({ service_name: 'tap_email', verify_token: token }, (isInternally && {
85
84
  notification: {
86
85
  sms: false
87
86
  }
88
87
  }));
88
+ settings = thunkApi.getState().settings;
89
89
  return [4, API.leadService.verifyLeadToken(payload)];
90
90
  case 1:
91
- data = (_j.sent()).data;
92
- recipientData = undefined;
91
+ data = (_p.sent()).data;
92
+ individualData = undefined;
93
+ boardInfoStatus = undefined;
93
94
  countries = settings.data.countries;
94
- if (((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
95
+ if (((_d = data.errors) === null || _d === void 0 ? void 0 : _d.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
95
96
  throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
96
97
  if (isInternally)
97
98
  data.step_name = INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO;
98
- _b = data || {}, country_code = _b.country_code, config = _b.config, boardId = _b.id;
99
- countryCode = country_code;
100
- publicKey = config === null || config === void 0 ? void 0 : config.public_key;
101
- if (country_code)
102
- thunkApi.dispatch(handleSetCountryByIso2(country_code));
103
- if (publicKey)
99
+ if (data === null || data === void 0 ? void 0 : data.country_code) {
100
+ countryCode = data === null || data === void 0 ? void 0 : data.country_code;
101
+ thunkApi.dispatch(handleSetCountryByIso2(countryCode));
102
+ }
103
+ publicKey = (_e = data === null || data === void 0 ? void 0 : data.config) === null || _e === void 0 ? void 0 : _e.public_key;
104
+ if (publicKey) {
104
105
  thunkApi.dispatch(handlePublicKey(publicKey));
105
- if (!!country_code) return [3, 3];
106
- return [4, API.boardService.retrieveBoardDetails(boardId)];
106
+ }
107
+ if (!(data.step_name === INDIVIDUAl_STEP_NAMES.PHONE_INFO)) return [3, 2];
108
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PHONE_INFO_STEP'));
109
+ return [3, 20];
107
110
  case 2:
108
- data_1 = _j.sent();
109
- countryCode = (_f = data_1 === null || data_1 === void 0 ? void 0 : data_1.entity) === null || _f === void 0 ? void 0 : _f.country;
110
- if (countryCode)
111
- thunkApi.dispatch(handleSetCountryByIso2(countryCode));
112
- _j.label = 3;
111
+ if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 19];
112
+ board_id = data === null || data === void 0 ? void 0 : data.id;
113
+ board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
114
+ if (!(board_id && board_info_id)) return [3, 5];
115
+ return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
113
116
  case 3:
114
- if (!(data.step_name === INDIVIDUAl_STEP_NAMES.PHONE_INFO)) return [3, 4];
115
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PHONE_INFO_STEP'));
116
- return [3, 18];
117
+ boardInfoData = _p.sent();
118
+ notification = (boardInfoData || {}).notification;
119
+ _b = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _b.id, type = _b.type;
120
+ if (!(id && type)) return [3, 5];
121
+ return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode })).unwrap()];
117
122
  case 4:
118
- if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 17];
119
- _c = data || {}, business_id = _c.business_id, recipient = _c.recipient, board_id = _c.id, board_info_id = _c.board_info_id;
120
- recipientData = recipient;
121
- if (!!((_g = data === null || data === void 0 ? void 0 : data.recipient) === null || _g === void 0 ? void 0 : _g.id)) return [3, 6];
122
- if (!(board_id && board_info_id)) return [3, 6];
123
- return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
123
+ data_1 = (_p.sent()).data;
124
+ individualData = data_1 || {};
125
+ _p.label = 5;
124
126
  case 5:
125
- notification = (_j.sent()).notification;
126
- recipientData = notification === null || notification === void 0 ? void 0 : notification.recipient;
127
- if (!(recipientData === null || recipientData === void 0 ? void 0 : recipientData.id))
128
- throw new Error('individual_id_missing');
129
- _j.label = 6;
127
+ if (!board_id) return [3, 7];
128
+ return [4, API.boardService.retrieveBoardDetails(board_id)];
130
129
  case 6:
131
- _d = recipientData || {}, id_1 = _d.id, type = _d.type;
132
- return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id_1, type: type, countryCode: countryCode })).unwrap()];
130
+ boardData = _p.sent();
131
+ _p.label = 7;
133
132
  case 7:
134
- individualData = (_j.sent()).data;
135
- if (!(!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && !isKWOrSA(countryCode))) return [3, 10];
136
- if (!business_id) return [3, 9];
137
- return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
133
+ if (!countryCode && ((_f = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _f === void 0 ? void 0 : _f.country)) {
134
+ countryCode = boardData.entity.country;
135
+ thunkApi.dispatch(handleSetCountryByIso2(countryCode));
136
+ }
137
+ if (!(!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && !isKWOrSA(countryCode))) return [3, 11];
138
+ if (!((_g = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _g === void 0 ? void 0 : _g.id)) return [3, 9];
139
+ return [4, thunkApi.dispatch(getIndividualList((_h = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _h === void 0 ? void 0 : _h.id)).unwrap()];
138
140
  case 8:
139
- userList = _j.sent();
140
- _j.label = 9;
141
+ userList = _p.sent();
142
+ _p.label = 9;
141
143
  case 9:
142
- userList = userList === null || userList === void 0 ? void 0 : userList.filter(function (user) { return user.id === id_1; });
143
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
144
- return [3, 16];
144
+ userList = userList === null || userList === void 0 ? void 0 : userList.filter(function (user) { return user.id === (individualData === null || individualData === void 0 ? void 0 : individualData.id); });
145
+ return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
145
146
  case 10:
146
- if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 13];
147
- if (!business_id) return [3, 12];
148
- return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
147
+ boardInfoStatus = _p.sent();
148
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
149
+ return [3, 18];
149
150
  case 11:
150
- userList = _j.sent();
151
- _j.label = 12;
151
+ if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 15];
152
+ if (!((_j = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _j === void 0 ? void 0 : _j.id)) return [3, 13];
153
+ return [4, thunkApi.dispatch(getIndividualList((_k = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _k === void 0 ? void 0 : _k.id)).unwrap()];
152
154
  case 12:
153
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
154
- return [3, 16];
155
- case 13:
156
- birthCountry = ((_h = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _h === void 0 ? void 0 : _h.country) || countryCode;
157
- if (!birthCountry) return [3, 15];
158
- return [4, thunkApi.dispatch(getCityList(birthCountry))];
155
+ userList = _p.sent();
156
+ _p.label = 13;
157
+ case 13: return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
159
158
  case 14:
160
- _j.sent();
161
- _j.label = 15;
159
+ boardInfoStatus = _p.sent();
160
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
161
+ return [3, 18];
162
162
  case 15:
163
+ birthCountry = ((_l = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _l === void 0 ? void 0 : _l.country) || countryCode;
164
+ if (!birthCountry) return [3, 17];
165
+ return [4, thunkApi.dispatch(getCityList(birthCountry))];
166
+ case 16:
167
+ _p.sent();
168
+ _p.label = 17;
169
+ case 17:
163
170
  if (isInternally)
164
171
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP')); });
165
172
  else
166
173
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
167
- _j.label = 16;
168
- case 16: return [3, 18];
169
- case 17:
174
+ _p.label = 18;
175
+ case 18: return [3, 20];
176
+ case 19:
170
177
  if (isUpdatePhoneInfo) {
171
178
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_VERIFY_STEP'));
172
179
  }
173
- _j.label = 18;
174
- case 18: return [2, {
175
- data: data,
176
- countries: countries,
177
- countryCode: countryCode,
178
- token: token,
179
- userList: userList || []
180
- }];
180
+ _p.label = 20;
181
+ case 20:
182
+ individuals = (boardData || {}).individuals;
183
+ _c = individualData || {}, is_authorized = _c.is_authorized, data_state = _c.data_state;
184
+ return [2, {
185
+ data: data,
186
+ boardResponse: {
187
+ brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
188
+ bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
189
+ entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
190
+ merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
191
+ merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
192
+ name: (_m = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _m === void 0 ? void 0 : _m.names,
193
+ contact: (_o = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _o === void 0 ? void 0 : _o.contact,
194
+ individuals: is_authorized ? individuals : __assign(__assign({}, individuals), (!!data_state && { data_state: data_state })),
195
+ countries: countries,
196
+ countryCode: countryCode,
197
+ notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
198
+ business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
199
+ flows: (boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || []
200
+ },
201
+ token: token,
202
+ userList: userList || []
203
+ }];
181
204
  }
182
205
  });
183
206
  });
@@ -390,139 +413,147 @@ export var retrieveDataList = createAsyncThunk('individualRetrieveDataList', fun
390
413
  });
391
414
  }); });
392
415
  export var retrieveBoardStatus = createAsyncThunk('individual/retrieveBoardStatus', function (parmas, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
393
- var individual, _a, board_id, board_info_id, data;
394
- return __generator(this, function (_b) {
395
- switch (_b.label) {
416
+ var individual, board_id, data;
417
+ return __generator(this, function (_a) {
418
+ switch (_a.label) {
396
419
  case 0:
397
420
  individual = thunkApi.getState().individual;
398
- _a = individual.data.verify.responseBody || {}, board_id = _a.board_id, board_info_id = _a.board_info_id;
399
- if (!board_id || !board_info_id)
400
- throw new Error('Internal server error');
421
+ board_id = (individual.data.verify.responseBody || {}).board_id;
401
422
  return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
402
423
  case 1:
403
- data = _b.sent();
404
- return [4, thunkApi.dispatch(retrieveBoardDetails({ boardId: board_id })).unwrap()];
405
- case 2:
406
- _b.sent();
424
+ data = _a.sent();
407
425
  thunkApi.dispatch(handlePrevScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
408
426
  return [2, { flows: (data === null || data === void 0 ? void 0 : data.info) || [] }];
409
427
  }
410
428
  });
411
429
  }); });
412
- export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetails', function (_a, thunkApi) {
413
- var boardId = _a.boardId, id = _a.individualId, type = _a.individualType;
414
- return __awaiter(void 0, void 0, void 0, function () {
415
- var _b, individual, settings, individualData, _c, user, data, data_3, data_state;
416
- var _d, _e, _f;
417
- return __generator(this, function (_g) {
418
- switch (_g.label) {
419
- case 0:
420
- _b = thunkApi.getState(), individual = _b.individual, settings = _b.settings;
421
- individualData = (_d = individual.data.verify.responseBody) === null || _d === void 0 ? void 0 : _d.user;
422
- return [4, API.boardService.retrieveBoardDetails(boardId)];
423
- case 1:
424
- _c = _g.sent(), user = _c.user, data = __rest(_c, ["user"]);
425
- if (!((individualData === null || individualData === void 0 ? void 0 : individualData.id) === (user === null || user === void 0 ? void 0 : user.id))) return [3, 2];
426
- individualData = user;
427
- return [3, 4];
428
- case 2:
429
- if (!(!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && id && type)) return [3, 4];
430
- return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: settings.data.businessCountry.iso2 })).unwrap()];
431
- case 3:
432
- data_3 = (_g.sent()).data;
433
- individualData = data_3;
434
- _g.label = 4;
435
- case 4:
436
- data_state = (((individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && (data === null || data === void 0 ? void 0 : data.individuals) ? data === null || data === void 0 ? void 0 : data.individuals : individualData) || {}).data_state;
437
- return [2, {
438
- data: __assign(__assign(__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: (_e = data === null || data === void 0 ? void 0 : data.user) === null || _e === void 0 ? void 0 : _e.names, individuals: data === null || data === void 0 ? void 0 : data.individuals, contact: (_f = data === null || data === void 0 ? void 0 : data.user) === null || _f === void 0 ? void 0 : _f.contact }), (data_state && {
439
- individuals: __assign(__assign({}, data === null || data === void 0 ? void 0 : data.individuals), { data_state: data_state })
440
- })), { board_status: data === null || data === void 0 ? void 0 : data.status })
441
- }];
442
- }
443
- });
430
+ export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetails', function (boardId) { return __awaiter(void 0, void 0, void 0, function () {
431
+ var _a, user, data;
432
+ var _b, _c;
433
+ return __generator(this, function (_d) {
434
+ switch (_d.label) {
435
+ case 0: return [4, API.boardService.retrieveBoardDetails(boardId)];
436
+ case 1:
437
+ _a = _d.sent(), user = _a.user, data = __rest(_a, ["user"]);
438
+ return [2, {
439
+ 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, board_status: data === null || data === void 0 ? void 0 : data.status })
440
+ }];
441
+ }
444
442
  });
445
- });
443
+ }); });
446
444
  export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
447
- var _a, individual, settings, responseBody, countries, payload, data, userList, recipientData, publicKey, countryCode, _b, business_id, recipient, board_id, board_info_id, notification, _c, id, type, individualData, birthCountry;
448
- var _d, _e, _f, _g, _h, _j, _k, _l;
449
- return __generator(this, function (_m) {
450
- switch (_m.label) {
445
+ var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, individualData, boardInfoData, userList, boardData, boardInfoStatus, countryCode, publicKey, notification, _c, id, type, data_3, birthCountry, individuals, _d, is_authorized, data_state;
446
+ var _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
447
+ return __generator(this, function (_t) {
448
+ switch (_t.label) {
451
449
  case 0:
452
450
  _a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
453
451
  responseBody = individual.data.verify.responseBody;
452
+ _b = responseBody || {}, board_id = _b.board_id, board_info_id = _b.board_info_id;
454
453
  countries = settings.data.countries;
455
454
  payload = {
456
455
  data: params.otp,
457
- service_name: (_d = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _d === void 0 ? void 0 : _d.service_name,
456
+ service_name: (_e = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _e === void 0 ? void 0 : _e.service_name,
458
457
  verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
459
458
  step_name: INDIVIDUAl_STEP_NAMES.PHONE_AUTH,
460
459
  encryption_contract: ['data']
461
460
  };
462
461
  return [4, API.leadService.verifyLeadOTP(payload)];
463
462
  case 1:
464
- data = (_m.sent()).data;
465
- recipientData = undefined;
466
- if ((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length)
463
+ data = (_t.sent()).data;
464
+ individualData = undefined;
465
+ countryCode = undefined;
466
+ if ((_f = data.errors) === null || _f === void 0 ? void 0 : _f.length)
467
467
  throw new Error(data.errors[0].description);
468
- publicKey = (_f = data === null || data === void 0 ? void 0 : data.config) === null || _f === void 0 ? void 0 : _f.public_key;
469
- countryCode = data === null || data === void 0 ? void 0 : data.country_code;
470
- if (publicKey)
468
+ publicKey = (_g = data === null || data === void 0 ? void 0 : data.config) === null || _g === void 0 ? void 0 : _g.public_key;
469
+ if (publicKey) {
471
470
  thunkApi.dispatch(handlePublicKey(publicKey));
472
- if (!((_g = settings.data.businessCountry) === null || _g === void 0 ? void 0 : _g.iso2) && countryCode)
473
- thunkApi.dispatch(handleSetCountryByIso2(countryCode));
474
- _b = data || {}, business_id = _b.business_id, recipient = _b.recipient, board_id = _b.id, board_info_id = _b.board_info_id;
475
- recipientData = recipient;
476
- if (!!((_h = data === null || data === void 0 ? void 0 : data.recipient) === null || _h === void 0 ? void 0 : _h.id)) return [3, 3];
477
- if (!(board_id && board_info_id)) return [3, 3];
478
- return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
471
+ }
472
+ if (data === null || data === void 0 ? void 0 : data.country_code) {
473
+ countryCode = data.country_code;
474
+ thunkApi.dispatch(handleSetCountryByIso2(data.country_code));
475
+ }
476
+ if (!board_id) return [3, 3];
477
+ return [4, API.boardService.retrieveBoardDetails(board_id)];
479
478
  case 2:
480
- notification = (_m.sent()).notification;
481
- recipientData = notification === null || notification === void 0 ? void 0 : notification.recipient;
482
- if (!(recipientData === null || recipientData === void 0 ? void 0 : recipientData.id))
483
- throw new Error('individual_id_missing');
484
- _m.label = 3;
479
+ boardData = _t.sent();
480
+ _t.label = 3;
485
481
  case 3:
486
- _c = recipientData || {}, id = _c.id, type = _c.type;
487
- return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode })).unwrap()];
482
+ if (!countryCode && ((_h = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _h === void 0 ? void 0 : _h.country)) {
483
+ countryCode = boardData.entity.country;
484
+ thunkApi.dispatch(handleSetCountryByIso2(countryCode));
485
+ }
486
+ if (!(board_id && board_info_id)) return [3, 6];
487
+ return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
488
488
  case 4:
489
- individualData = (_m.sent()).data;
490
- if (!(!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && !isKWOrSA(countryCode))) return [3, 7];
491
- if (!business_id) return [3, 6];
492
- return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
489
+ boardInfoData = _t.sent();
490
+ notification = (boardInfoData || {}).notification;
491
+ _c = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
492
+ if (!(id && type)) return [3, 6];
493
+ return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode })).unwrap()];
493
494
  case 5:
494
- userList = _m.sent();
495
- _m.label = 6;
495
+ data_3 = (_t.sent()).data;
496
+ individualData = data_3 || {};
497
+ _t.label = 6;
496
498
  case 6:
497
- userList = userList === null || userList === void 0 ? void 0 : userList.filter(function (user) { return user.id === id; });
498
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
499
- return [3, 13];
499
+ if (countryCode)
500
+ thunkApi.dispatch(handleSetCountryByIso2(countryCode));
501
+ if (!(!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && !isKWOrSA(countryCode))) return [3, 10];
502
+ if (!((_j = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _j === void 0 ? void 0 : _j.id)) return [3, 8];
503
+ return [4, thunkApi.dispatch(getIndividualList((_k = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _k === void 0 ? void 0 : _k.id)).unwrap()];
500
504
  case 7:
501
- if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 10];
502
- if (!business_id) return [3, 9];
503
- return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
505
+ userList = _t.sent();
506
+ _t.label = 8;
504
507
  case 8:
505
- userList = _m.sent();
506
- _m.label = 9;
508
+ userList = userList === null || userList === void 0 ? void 0 : userList.filter(function (user) { return user.id === (individualData === null || individualData === void 0 ? void 0 : individualData.id); });
509
+ return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
507
510
  case 9:
511
+ boardInfoStatus = _t.sent();
508
512
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
509
- return [3, 13];
513
+ return [3, 17];
510
514
  case 10:
511
- birthCountry = ((_j = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _j === void 0 ? void 0 : _j.country) || countryCode;
512
- if (!birthCountry) return [3, 12];
513
- return [4, thunkApi.dispatch(getCityList(birthCountry))];
515
+ if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 14];
516
+ if (!((_l = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _l === void 0 ? void 0 : _l.id)) return [3, 12];
517
+ return [4, thunkApi.dispatch(getIndividualList((_m = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _m === void 0 ? void 0 : _m.id))];
514
518
  case 11:
515
- _m.sent();
516
- _m.label = 12;
517
- case 12:
518
- sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP')); });
519
- _m.label = 13;
519
+ _t.sent();
520
+ _t.label = 12;
521
+ case 12: return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
520
522
  case 13:
521
- (_l = (_k = settings.data.appConfig).onStepCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, settings.data.activeScreen.name, { otp: params.otp });
523
+ boardInfoStatus = _t.sent();
524
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
525
+ return [3, 17];
526
+ case 14:
527
+ birthCountry = ((_o = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _o === void 0 ? void 0 : _o.country) || countryCode;
528
+ if (!birthCountry) return [3, 16];
529
+ return [4, thunkApi.dispatch(getCityList(birthCountry))];
530
+ case 15:
531
+ _t.sent();
532
+ _t.label = 16;
533
+ case 16:
534
+ sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP')); });
535
+ _t.label = 17;
536
+ case 17:
537
+ (_q = (_p = settings.data.appConfig).onStepCompleted) === null || _q === void 0 ? void 0 : _q.call(_p, settings.data.activeScreen.name, { otp: params.otp });
538
+ individuals = (boardData || {}).individuals;
539
+ _d = individualData || {}, is_authorized = _d.is_authorized, data_state = _d.data_state;
522
540
  return [2, {
523
541
  data: data,
524
- countries: countries,
525
- countryCode: countryCode,
542
+ boardResponse: {
543
+ brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
544
+ bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
545
+ entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
546
+ merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
547
+ merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
548
+ name: (_r = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _r === void 0 ? void 0 : _r.names,
549
+ contact: (_s = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _s === void 0 ? void 0 : _s.contact,
550
+ individuals: is_authorized ? individuals : __assign(__assign({}, individuals), (!!data_state && { data_state: data_state })),
551
+ countries: countries,
552
+ countryCode: countryCode,
553
+ notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
554
+ business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
555
+ flows: (boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || []
556
+ },
526
557
  formData: __assign({}, params),
527
558
  userList: userList
528
559
  }];
@@ -562,20 +593,21 @@ export var updatePhoneInfo = createAsyncThunk('individual/updatePhoneInfo', func
562
593
  });
563
594
  });
564
595
  export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateIndividualPersonalInfo', function (_a, thunkApi) {
565
- var formData = _a.formData, originalFormData = _a.originalFormData, isDirty = _a.isDirty;
596
+ var formData = _a.formData, originalFormData = _a.originalFormData;
566
597
  return __awaiter(void 0, void 0, void 0, function () {
567
- var _b, settings, individual, _c, recipient, user, entity, id, countryCode, name, email, mobile, gender, nid, issuedCountry, expiryDate, dob, placeOfBirthCountry, placeOfBirthCity, nationality, code, _d, data_status, objects, ids, userName, identification_id_type, isGenderNonEditable, isNameENNonEditable, isNameARNonEditable, isEmailNonEditable, isMobileNumberNonEditable, isMobileCountryNonEditable, isNidNonEditable, isIssuedCountryNonEditable, isExpiryNonEditable, isIdTypeNonEditable, isNationalityNonEditable, isDOBNonEditable, isBirthCityNonEditable, isBirthCountryNonEditable, hasContact, hasPhone, hasIdentification, hasBirth, nameIsEditable, contact, requestBody, individualData, data, _e, isUser, isBuyer, isUserORBuyerType;
598
+ var _b, settings, individual, _c, notification, user, entity, id, _d, objects, ids, countryCode, name, email, mobile, gender, nid, issuedCountry, expiryDate, dob, placeOfBirthCountry, placeOfBirthCity, nationality, code, data_status, userName, identification_id_type, isGenderNonEditable, isNameENNonEditable, isNameARNonEditable, isEmailNonEditable, isMobileNumberNonEditable, isMobileCountryNonEditable, isNidNonEditable, isIssuedCountryNonEditable, isExpiryNonEditable, isIdTypeNonEditable, isNationalityNonEditable, isDOBNonEditable, isBirthCityNonEditable, isBirthCountryNonEditable, hasContact, hasPhone, hasIdentification, hasBirth, nameIsEditable, contact, requestBody, data, _e, isUser, isBuyer, isUserORBuyerType;
568
599
  var _f, _g, _h, _j, _k;
569
600
  return __generator(this, function (_l) {
570
601
  switch (_l.label) {
571
602
  case 0:
572
603
  _b = thunkApi.getState(), settings = _b.settings, individual = _b.individual;
573
- _c = individual.data.verify.responseBody || {}, recipient = _c.recipient, user = _c.user, entity = _c.entity;
574
- id = (((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : recipient) || {}).id;
604
+ _c = individual.data.verify.responseBody || {}, notification = _c.notification, user = _c.user, entity = _c.entity;
605
+ id = (((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : notification === null || notification === void 0 ? void 0 : notification.recipient) || {}).id;
606
+ _d = user || {}, objects = _d.objects, ids = _d.ids;
575
607
  countryCode = (originalFormData || {}).countryCode;
576
608
  name = formData.name, email = formData.email, mobile = formData.mobile, gender = formData.gender, nid = formData.nid, issuedCountry = formData.issuedCountry, expiryDate = formData.expiryDate, dob = formData.dob, placeOfBirthCountry = formData.placeOfBirthCountry, placeOfBirthCity = formData.placeOfBirthCity, nationality = formData.nationality;
577
609
  code = entity === null || entity === void 0 ? void 0 : entity.country;
578
- _d = user || {}, data_status = _d.data_status, objects = _d.objects, ids = _d.ids;
610
+ data_status = (user || {}).data_status;
579
611
  userName = getUserNameObject(name);
580
612
  identification_id_type = nid ? (nid.startsWith('1') ? IDENTIFICATION_TYPE.NID : IDENTIFICATION_TYPE.IQAMA) : undefined;
581
613
  if (isOtherThanKWOrSA(settings.data.businessCountry.iso2)) {
@@ -598,7 +630,7 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
598
630
  hasContact = email || mobile;
599
631
  hasPhone = mobile && (countryCode === null || countryCode === void 0 ? void 0 : countryCode.idd_prefix);
600
632
  hasIdentification = nid && (issuedCountry || identification_id_type || expiryDate);
601
- hasBirth = (placeOfBirthCity === null || placeOfBirthCity === void 0 ? void 0 : placeOfBirthCity.id) || (placeOfBirthCountry === null || placeOfBirthCountry === void 0 ? void 0 : placeOfBirthCountry.iso2);
633
+ hasBirth = placeOfBirthCity || placeOfBirthCountry;
602
634
  nameIsEditable = userName.first && !(isNameENNonEditable && isNameARNonEditable);
603
635
  contact = hasContact && !(isEmailNonEditable && isMobileCountryNonEditable && isMobileNumberNonEditable)
604
636
  ? __assign({ email: isEmailNonEditable ? undefined : email }, (!(isMobileCountryNonEditable && isMobileNumberNonEditable) &&
@@ -644,40 +676,35 @@ export var updateIndividualPersonalInfo = createAsyncThunk('individual/updateInd
644
676
  'date_of_birth',
645
677
  'nationality'
646
678
  ], step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_PERSONAL_INFO });
647
- individualData = undefined;
648
- if (!isDirty) return [3, 2];
649
679
  return [4, API.individualService.updateMultipleIndividual(requestBody)];
650
680
  case 1:
651
681
  data = _l.sent();
652
- individualData = data;
653
- _l.label = 2;
654
- case 2:
655
682
  _e = getIndividualType(objects), isUser = _e.isUser, isBuyer = _e.isBuyer;
656
683
  isUserORBuyerType = isUser || isBuyer;
657
- if (!isUserORBuyerType) return [3, 4];
684
+ if (!isUserORBuyerType) return [3, 3];
658
685
  return [4, thunkApi.dispatch(retrieveDataList(code))];
659
- case 3:
686
+ case 2:
660
687
  _l.sent();
661
- _l.label = 4;
662
- case 4:
688
+ _l.label = 3;
689
+ case 3:
663
690
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep()); });
664
691
  (_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, requestBody);
665
- return [2, { data: individualData, formData: originalFormData }];
692
+ return [2, { data: data, formData: originalFormData }];
666
693
  }
667
694
  });
668
695
  });
669
696
  });
670
697
  export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (_a, thunkApi) {
671
- var formData = _a.formData, originalFormData = _a.originalFormData, isDirty = _a.isDirty;
698
+ var formData = _a.formData, originalFormData = _a.originalFormData;
672
699
  return __awaiter(void 0, void 0, void 0, function () {
673
- var _b, settings, individual, _c, recipient, user, userList, business, id, _d, objects, ids, isKWOrSAValue, occupation, sourceIncome, monthlyIncome, isPEP, isInfluencer, shareCount, shareValue, civilID, signatureFileId, isAuthorized, isOccupationNonEditable, isSourceIncomeNonEditable, isPEPNonEditable, isInfluencerNonEditable, isMonthlyIncomeNonEditable, isAuthorizedNonEditable, isSharesAvailable, pepInfo, influencerInfo, occupationInfo, sourceIncomeInfo, monthlyIncomeInfo, isAuthorizedInfo, userPayload, shareHolderPayload, boardMemberPayload, buyerMemberPayload, _e, isUser, isShareholder, isBoardMember, isBuyer, isCustomer, isUserORBuyerType, payload, businessCountry, hasCivilIdDocument, hasSignatureDocument, isSendSignatureFile, civilIdDocument, signatureDocument, documentBody, documentBody, documentsList, documentBody, data, individualData, requestBody, user_2, userListRes;
700
+ var _b, settings, individual, _c, notification, user, userList, business, id, _d, objects, ids, isKWOrSAValue, occupation, sourceIncome, monthlyIncome, isPEP, isInfluencer, shareCount, shareValue, civilID, signatureFileId, isAuthorized, isOccupationNonEditable, isSourceIncomeNonEditable, isPEPNonEditable, isInfluencerNonEditable, isMonthlyIncomeNonEditable, isAuthorizedNonEditable, isSharesAvailable, pepInfo, influencerInfo, occupationInfo, sourceIncomeInfo, monthlyIncomeInfo, isAuthorizedInfo, userPayload, shareHolderPayload, boardMemberPayload, buyerMemberPayload, _e, isUser, isShareholder, isBoardMember, isBuyer, isCustomer, isUserORBuyerType, payload, businessCountry, hasCivilIdDocument, hasSignatureDocument, isSendSignatureFile, civilIdDocument, signatureDocument, documentBody, documentBody, documentsList, documentBody, requestBody, data, individualData, userListRes;
674
701
  var _f, _g;
675
702
  return __generator(this, function (_h) {
676
703
  switch (_h.label) {
677
704
  case 0:
678
705
  _b = thunkApi.getState(), settings = _b.settings, individual = _b.individual;
679
- _c = individual.data.verify.responseBody || {}, recipient = _c.recipient, user = _c.user, userList = _c.userList, business = _c.business;
680
- id = (((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : recipient) || {}).id;
706
+ _c = individual.data.verify.responseBody || {}, notification = _c.notification, user = _c.user, userList = _c.userList, business = _c.business;
707
+ id = (((user === null || user === void 0 ? void 0 : user.is_authorized) ? user : notification === null || notification === void 0 ? void 0 : notification.recipient) || {}).id;
681
708
  _d = user || {}, objects = _d.objects, ids = _d.ids;
682
709
  isKWOrSAValue = isKWOrSA(settings.data.businessCountry.iso2);
683
710
  occupation = formData.occupation, sourceIncome = formData.sourceIncome, monthlyIncome = formData.monthlyIncome, isPEP = formData.isPEP, isInfluencer = formData.isInfluencer, shareCount = formData.shareCount, shareValue = formData.shareValue, civilID = formData.civilID, signatureFileId = formData.signatureFileId, isAuthorized = formData.isAuthorized;
@@ -766,23 +793,18 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
766
793
  _h.sent();
767
794
  _h.label = 6;
768
795
  case 6:
769
- data = undefined, individualData = user || {};
770
796
  requestBody = __assign(__assign({ ids: (ids === null || ids === void 0 ? void 0 : ids.length) ? ids : [id] }, payload), { encryption_contract: [], step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO });
771
- if (!isDirty) return [3, 8];
772
797
  return [4, API.individualService.updateMultipleIndividual(requestBody)];
773
798
  case 7:
774
799
  data = _h.sent();
775
- user_2 = (sortUserList(mapUserList(data === null || data === void 0 ? void 0 : data.individuals)) || [])[0];
776
- individualData = user_2;
777
- _h.label = 8;
778
- case 8:
800
+ individualData = (sortUserList(mapUserList(data === null || data === void 0 ? void 0 : data.individuals)) || [])[0];
779
801
  userListRes = userList || [];
780
- if (!((user === null || user === void 0 ? void 0 : user.id) === (individualData === null || individualData === void 0 ? void 0 : individualData.id) && !(user === null || user === void 0 ? void 0 : user.is_authorized) && isAuthorized && (business === null || business === void 0 ? void 0 : business.id))) return [3, 10];
802
+ if (!((user === null || user === void 0 ? void 0 : user.id) === (individualData === null || individualData === void 0 ? void 0 : individualData.id) && !(user === null || user === void 0 ? void 0 : user.is_authorized) && isAuthorized && (business === null || business === void 0 ? void 0 : business.id))) return [3, 9];
781
803
  return [4, thunkApi.dispatch(getIndividualList(business === null || business === void 0 ? void 0 : business.id)).unwrap()];
782
- case 9:
804
+ case 8:
783
805
  userListRes = _h.sent();
784
- _h.label = 10;
785
- case 10:
806
+ _h.label = 9;
807
+ case 9:
786
808
  thunkApi.dispatch(handleNextScreenStep());
787
809
  (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, requestBody);
788
810
  return [2, { data: data, formData: originalFormData, individualData: individualData, userList: userListRes, isKWOrSACountry: isKWOrSAValue }];
@@ -816,39 +838,49 @@ export var checkEmailAvailability = createAsyncThunk('checkEmailAvailability', f
816
838
  });
817
839
  });
818
840
  export var updateBoardSuccess = createAsyncThunk('individualUpdateBoardSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
819
- var _a, settings, individual, _b, board_id, infoId, _c, showBoard, mode, payload, data, _d, id, iType, boardInfoStatusData;
820
- var _e, _f, _g, _h, _j, _k, _l, _m, _o;
821
- return __generator(this, function (_p) {
822
- switch (_p.label) {
841
+ var _a, settings, individual, _b, id, infoId, primaryUser, _c, showBoard, mode, payload, data, boardInfoStatus, individualDataRes, _d, is_authorized, userId, type;
842
+ var _e, _f, _g, _h, _j, _k, _l, _m;
843
+ return __generator(this, function (_o) {
844
+ switch (_o.label) {
823
845
  case 0:
824
846
  _a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
825
- _b = individual.data.verify.responseBody || {}, board_id = _b.board_id, infoId = _b.board_info_id;
847
+ _b = individual.data.verify.responseBody || {}, id = _b.board_id, infoId = _b.board_info_id, primaryUser = _b.primaryUser;
826
848
  _c = settings.data.appConfig, showBoard = _c.showBoard, mode = _c.mode;
827
- if (!board_id)
849
+ if (!id)
828
850
  return [2];
829
851
  payload = {
830
852
  lang: settings.data.language,
831
- step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS
853
+ step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS,
854
+ id: id
832
855
  };
833
- return [4, API.boardService.updateBoardInfo(__assign({ id: board_id, infoId: infoId }, payload))];
856
+ return [4, API.boardService.updateBoardInfo(__assign({ id: id, infoId: infoId }, payload))];
834
857
  case 1:
835
- data = _p.sent();
858
+ data = _o.sent();
836
859
  if (!showBoard && mode === 'content') {
837
860
  (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, {});
838
861
  (_h = (_g = settings.data.appConfig).onFlowCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, { data: data });
839
862
  return [2, { response: __assign({}, data), formData: params }];
840
863
  }
841
- _d = ((_j = data === null || data === void 0 ? void 0 : data.notification) === null || _j === void 0 ? void 0 : _j.recipient) || {}, id = _d.id, iType = _d.type;
842
- return [4, Promise.all([
843
- API.boardService.retrieveBoardInfoStatus(board_id),
844
- thunkApi.dispatch(retrieveBoardDetails({ boardId: board_id, individualId: id, individualType: iType })).unwrap()
845
- ])];
864
+ return [4, API.boardService.retrieveBoardInfoStatus(id)];
846
865
  case 2:
847
- boardInfoStatusData = (_p.sent())[0];
848
- (_l = (_k = settings.data.appConfig).onStepCompleted) === null || _l === void 0 ? void 0 : _l.call(_k, settings.data.activeScreen.name, {});
849
- (_o = (_m = settings.data.appConfig).onFlowCompleted) === null || _o === void 0 ? void 0 : _o.call(_m, { data: data });
866
+ boardInfoStatus = _o.sent();
867
+ return [4, thunkApi.dispatch(retrieveBoardDetails(id))];
868
+ case 3:
869
+ _o.sent();
870
+ individualDataRes = undefined;
871
+ _d = primaryUser || {}, is_authorized = _d.is_authorized, userId = _d.id, type = _d.object;
872
+ if (!!is_authorized) return [3, 5];
873
+ return [4, thunkApi
874
+ .dispatch(retrieveIndividualInfo({ id: userId, type: type, countryCode: settings.data.businessCountry.iso2 }))
875
+ .unwrap()];
876
+ case 4:
877
+ individualDataRes = _o.sent();
878
+ _o.label = 5;
879
+ case 5:
880
+ (_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, {});
881
+ (_m = (_l = settings.data.appConfig).onFlowCompleted) === null || _m === void 0 ? void 0 : _m.call(_l, { data: data });
850
882
  thunkApi.dispatch(handleNextScreenStep());
851
- return [2, { data: data, flows: (boardInfoStatusData === null || boardInfoStatusData === void 0 ? void 0 : boardInfoStatusData.info) || [] }];
883
+ return [2, { response: __assign(__assign({}, data), { flows: (boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || [] }), formData: params, individualData: individualDataRes === null || individualDataRes === void 0 ? void 0 : individualDataRes.data }];
852
884
  }
853
885
  });
854
886
  }); });
@@ -946,8 +978,8 @@ export var individualSlice = createSlice({
946
978
  })
947
979
  .addCase(verifyToken.fulfilled, function (state, action) {
948
980
  state.error = null;
949
- var _a = action.payload, data = _a.data, token = _a.token, countries = _a.countries, countryCode = _a.countryCode, userList = _a.userList;
950
- state.data.verify.responseBody = __assign(__assign(__assign({}, data), state.data.verify.responseBody), { countries: countries, countryCode: countryCode, board_id: data.id, userList: userList });
981
+ var _a = action.payload, data = _a.data, token = _a.token, boardResponse = _a.boardResponse, userList = _a.userList;
982
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id, userList: userList });
951
983
  state.data.verify.token = token;
952
984
  })
953
985
  .addCase(verifyToken.rejected, function (state, action) {
@@ -987,12 +1019,18 @@ export var individualSlice = createSlice({
987
1019
  state.error = null;
988
1020
  })
989
1021
  .addCase(verifyLeadOTP.fulfilled, function (state, action) {
1022
+ var _a;
990
1023
  state.loading = false;
991
1024
  state.error = null;
992
- var _a = action.payload, data = _a.data, countries = _a.countries, countryCode = _a.countryCode, userList = _a.userList, formData = _a.formData;
1025
+ var _b = action.payload, data = _b.data, formData = _b.formData, boardResponse = _b.boardResponse, userList = _b.userList;
1026
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
1027
+ if (description) {
1028
+ state.error = description;
1029
+ return;
1030
+ }
993
1031
  state.data.otpData = formData;
994
1032
  state.data.otpData.responseBody = data;
995
- state.data.verify.responseBody = __assign(__assign(__assign({}, data), state.data.verify.responseBody), { countries: countries, countryCode: countryCode, userList: userList });
1033
+ state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), boardResponse), { userList: userList });
996
1034
  })
997
1035
  .addCase(verifyLeadOTP.rejected, function (state, action) {
998
1036
  state.loading = false;
@@ -1094,7 +1132,7 @@ export var individualSlice = createSlice({
1094
1132
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { requestEmailData: data, userList: list });
1095
1133
  })
1096
1134
  .addCase(requestDetailsByEmail.rejected, function (state, action) {
1097
- state.addOrRequestDetailLoading = false;
1135
+ state.loading = false;
1098
1136
  state.error = action.error.message;
1099
1137
  })
1100
1138
  .addCase(retrieveIndividualInfo.pending, function (state) {
@@ -1166,6 +1204,7 @@ export var individualSlice = createSlice({
1166
1204
  state.data.individualData.isAuthorized = is_authorized;
1167
1205
  })
1168
1206
  .addCase(retrieveIndividualInfo.rejected, function (state, action) {
1207
+ state.addOrRequestDetailLoading = false;
1169
1208
  state.error = action.error.message;
1170
1209
  })
1171
1210
  .addCase(getIndividualList.pending, function (state) {
@@ -1272,11 +1311,11 @@ export var individualSlice = createSlice({
1272
1311
  state.loading = false;
1273
1312
  state.error = null;
1274
1313
  var _a = action.payload, data = _a.data, formData = _a.formData, individualData = _a.individualData, userList = _a.userList, isKWOrSACountry = _a.isKWOrSACountry;
1275
- state.data.individualData = __assign(__assign({}, formData), { civilID: undefined, signatureFileId: undefined });
1314
+ state.data.individualData = formData;
1276
1315
  state.data.individualData.responseBody = data;
1277
1316
  var user = (state.data.verify.responseBody || {}).user;
1278
1317
  var isSameUser = (user === null || user === void 0 ? void 0 : user.id) === (individualData === null || individualData === void 0 ? void 0 : individualData.id);
1279
- var userInfo = __assign(__assign({}, user), (isSameUser && individualData && __assign({}, individualData)));
1318
+ var userInfo = __assign(__assign({}, user), (isSameUser && (individualData === null || individualData === void 0 ? void 0 : individualData.documents) && { documents: individualData === null || individualData === void 0 ? void 0 : individualData.documents }));
1280
1319
  if (isSameUser && !isKWOrSACountry)
1281
1320
  userInfo = __assign(__assign({}, user), { is_authorized: individualData.is_authorized });
1282
1321
  var list = userList || [];
@@ -1336,8 +1375,18 @@ export var individualSlice = createSlice({
1336
1375
  var _a;
1337
1376
  state.loading = false;
1338
1377
  state.error = null;
1339
- var _b = action.payload || {}, flows = _b.flows, data = _b.data;
1340
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, recipient: (_a = data === null || data === void 0 ? void 0 : data.notification) === null || _a === void 0 ? void 0 : _a.recipient });
1378
+ var _b = action.payload || {}, response = _b.response, individualData = _b.individualData;
1379
+ var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
1380
+ if (description) {
1381
+ state.error = description;
1382
+ return;
1383
+ }
1384
+ var flows = response.flows;
1385
+ var individuals = (state.data.verify.responseBody || {}).individuals;
1386
+ var data_state = (((individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) ? individuals : individualData) || {}).data_state;
1387
+ state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), { flows: flows }), (data_state && {
1388
+ individuals: __assign(__assign({}, individuals), { data_state: data_state })
1389
+ }));
1341
1390
  })
1342
1391
  .addCase(updateBoardSuccess.pending, function (state) {
1343
1392
  state.loading = true;