@tap-payments/auth-jsconnect 2.4.30-test → 2.4.32-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.
@@ -63,14 +63,14 @@ import { BusinessType, DocumentPurpose, FlowsTypes, LicenseType } from '../../..
63
63
  import { handleNextScreenStep, handlePrevScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
64
64
  import { ENTITY_STEP_NAMES } from '../../../constants';
65
65
  import moment from 'moment';
66
- import { convertNumbers2English, getRecentDocumentBasedOnPurpose, hasVerifiedValue, hasNoneEditableValue, sleep, formatNumberAsCurrency, removeAllCharsFromNumber } from '../../../utils';
66
+ import { convertNumbers2English, getRecentDocumentBasedOnPurpose, hasVerifiedValue, hasNoneEditableValue, sleep, formatNumberAsCurrency, removeAllCharsFromNumber, retrieveIndividualData } from '../../../utils';
67
67
  export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function (_a, thunkApi) {
68
68
  var token = _a.token, isInternally = _a.isInternally;
69
69
  return __awaiter(void 0, void 0, void 0, function () {
70
- var payload, data, boardData, entityData, entityTypes, countryIso2, board_id, entityId;
71
- var _b, _c, _d;
72
- return __generator(this, function (_e) {
73
- switch (_e.label) {
70
+ var payload, data, boardData, boardInfoData, entityData, entityTypes, individualData, countryIso2, _b, board_id, board_info_id, _c, id_1, type_1, serviceCallBack, _d, boardRes, individualRes, entityId;
71
+ var _e, _f, _g, _h;
72
+ return __generator(this, function (_j) {
73
+ switch (_j.label) {
74
74
  case 0:
75
75
  payload = {
76
76
  service_name: 'tap_email',
@@ -78,9 +78,9 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
78
78
  };
79
79
  return [4, API.leadService.verifyLeadToken(payload)];
80
80
  case 1:
81
- data = (_e.sent()).data;
81
+ data = (_j.sent()).data;
82
82
  countryIso2 = undefined;
83
- if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 7];
83
+ if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 10];
84
84
  if (isInternally)
85
85
  data.step_name = ENTITY_STEP_NAMES.ENTITY_INFO;
86
86
  if (data === null || data === void 0 ? void 0 : data.country_code) {
@@ -88,44 +88,59 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
88
88
  if (countryIso2)
89
89
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
90
90
  }
91
- if (!(data.step_name !== ENTITY_STEP_NAMES.PHONE_AUTH)) return [3, 7];
92
- board_id = data === null || data === void 0 ? void 0 : data.id;
93
- if (!board_id) return [3, 3];
91
+ if (!(data.step_name !== ENTITY_STEP_NAMES.PHONE_AUTH)) return [3, 10];
92
+ _b = data || {}, board_id = _b.id, board_info_id = _b.board_info_id;
93
+ if (!board_id) return [3, 6];
94
94
  return [4, API.boardService.retrieveBoardDetails(board_id)];
95
95
  case 2:
96
- boardData = _e.sent();
97
- _e.label = 3;
96
+ boardData = _j.sent();
97
+ if (!board_info_id) return [3, 4];
98
+ return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
98
99
  case 3:
99
- entityId = (_b = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _b === void 0 ? void 0 : _b.id;
100
- if (!entityId) return [3, 5];
101
- return [4, API.entityService.retrieveEntity(entityId)];
100
+ boardInfoData = _j.sent();
101
+ _j.label = 4;
102
102
  case 4:
103
- entityData = _e.sent();
104
- _e.label = 5;
103
+ _c = ((_e = boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification) === null || _e === void 0 ? void 0 : _e.recipient) || {}, id_1 = _c.id, type_1 = _c.type;
104
+ serviceCallBack = function () { return API.individualService.retrieveIndividual(id_1, type_1); };
105
+ return [4, retrieveIndividualData(type_1, boardData, serviceCallBack)];
105
106
  case 5:
107
+ _d = _j.sent(), boardRes = _d.boardRes, individualRes = _d.individualRes;
108
+ boardData = boardRes;
109
+ individualData = individualRes;
110
+ _j.label = 6;
111
+ case 6:
112
+ entityId = (_f = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _f === void 0 ? void 0 : _f.id;
113
+ if (!entityId) return [3, 8];
114
+ return [4, API.entityService.retrieveEntity(entityId)];
115
+ case 7:
116
+ entityData = _j.sent();
117
+ _j.label = 8;
118
+ case 8:
106
119
  if (!countryIso2) {
107
120
  countryIso2 = entityData.country;
108
121
  if (countryIso2)
109
122
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
110
123
  }
111
124
  return [4, API.entityService.retrieveEntityType()];
112
- case 6:
113
- entityTypes = _e.sent();
125
+ case 9:
126
+ entityTypes = _j.sent();
114
127
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('ENTITY_NAME_STEP')); });
115
- _e.label = 7;
116
- case 7: return [2, {
128
+ _j.label = 10;
129
+ case 10: return [2, {
117
130
  data: data,
131
+ individualData: individualData,
118
132
  boardResponse: {
119
133
  user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
120
134
  brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
121
135
  bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
122
136
  entity: entityData === null || entityData === void 0 ? void 0 : entityData.entity,
123
137
  merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
124
- name: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.names,
125
- contact: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.contact,
138
+ name: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _g === void 0 ? void 0 : _g.names,
139
+ contact: (_h = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _h === void 0 ? void 0 : _h.contact,
126
140
  individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
127
141
  business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
128
- entityTypes: entityTypes
142
+ entityTypes: entityTypes,
143
+ notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification
129
144
  },
130
145
  token: token
131
146
  }];
@@ -151,58 +166,73 @@ export var resendOTP = createAsyncThunk('entityResendOTP', function (params, thu
151
166
  });
152
167
  }); });
153
168
  export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
154
- var _a, entity, settings, responseBody, payload, data, boardData, entityData, entityTypes, board_id, entityId;
155
- var _b, _c, _d, _e, _f, _g;
156
- return __generator(this, function (_h) {
157
- switch (_h.label) {
169
+ var _a, entity, settings, responseBody, payload, data, boardData, entityData, entityTypes, boardInfoData, individualData, _b, board_id, board_info_id, _c, id_2, type_2, serviceCallBack, _d, boardRes, individualRes, entityId;
170
+ var _e, _f, _g, _h, _j, _k, _l;
171
+ return __generator(this, function (_m) {
172
+ switch (_m.label) {
158
173
  case 0:
159
174
  _a = thunkApi.getState(), entity = _a.entity, settings = _a.settings;
160
175
  responseBody = entity.data.verify.responseBody;
161
176
  payload = {
162
177
  data: params.otp,
163
- service_name: (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _b === void 0 ? void 0 : _b.service_name,
178
+ service_name: (_e = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _e === void 0 ? void 0 : _e.service_name,
164
179
  verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
165
180
  step_name: ENTITY_STEP_NAMES.PHONE_AUTH,
166
181
  encryption_contract: ['data']
167
182
  };
168
183
  return [4, API.leadService.verifyLeadOTP(payload)];
169
184
  case 1:
170
- data = (_h.sent()).data;
171
- entityTypes = undefined;
172
- if (!!data.errors) return [3, 7];
173
- board_id = responseBody === null || responseBody === void 0 ? void 0 : responseBody.id;
174
- if (!board_id) return [3, 3];
185
+ data = (_m.sent()).data;
186
+ individualData = undefined;
187
+ if (!!data.errors) return [3, 10];
188
+ _b = data || {}, board_id = _b.id, board_info_id = _b.board_info_id;
189
+ if (!board_id) return [3, 6];
175
190
  return [4, API.boardService.retrieveBoardDetails(board_id)];
176
191
  case 2:
177
- boardData = _h.sent();
178
- _h.label = 3;
192
+ boardData = _m.sent();
193
+ if (!board_info_id) return [3, 4];
194
+ return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
179
195
  case 3:
180
- entityId = (_c = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _c === void 0 ? void 0 : _c.id;
181
- if (!entityId) return [3, 5];
182
- return [4, API.entityService.retrieveEntity(entityId)];
196
+ boardInfoData = _m.sent();
197
+ _m.label = 4;
183
198
  case 4:
184
- entityData = _h.sent();
185
- _h.label = 5;
199
+ _c = ((_f = boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification) === null || _f === void 0 ? void 0 : _f.recipient) || {}, id_2 = _c.id, type_2 = _c.type;
200
+ serviceCallBack = function () { return API.individualService.retrieveIndividual(id_2, type_2); };
201
+ return [4, retrieveIndividualData(type_2, boardData, serviceCallBack)];
186
202
  case 5:
187
- (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
188
- return [4, API.entityService.retrieveEntityType()];
203
+ _d = _m.sent(), boardRes = _d.boardRes, individualRes = _d.individualRes;
204
+ boardData = boardRes;
205
+ individualData = individualRes;
206
+ _m.label = 6;
189
207
  case 6:
190
- entityTypes = _h.sent();
208
+ entityId = (_g = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _g === void 0 ? void 0 : _g.id;
209
+ if (!entityId) return [3, 8];
210
+ return [4, API.entityService.retrieveEntity(entityId)];
211
+ case 7:
212
+ entityData = _m.sent();
213
+ _m.label = 8;
214
+ case 8:
215
+ (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, { otp: params.otp });
216
+ return [4, API.entityService.retrieveEntityType()];
217
+ case 9:
218
+ entityTypes = _m.sent();
191
219
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('ENTITY_NAME_STEP')); });
192
- _h.label = 7;
193
- case 7: return [2, {
220
+ _m.label = 10;
221
+ case 10: return [2, {
194
222
  data: data,
223
+ individualData: individualData,
195
224
  boardResponse: {
196
225
  user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
197
226
  brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
198
227
  bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
199
228
  entity: entityData === null || entityData === void 0 ? void 0 : entityData.entity,
200
229
  merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
201
- name: (_f = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _f === void 0 ? void 0 : _f.names,
202
- contact: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _g === void 0 ? void 0 : _g.contact,
230
+ name: (_k = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _k === void 0 ? void 0 : _k.names,
231
+ contact: (_l = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _l === void 0 ? void 0 : _l.contact,
203
232
  individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
204
233
  business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
205
- entityTypes: entityTypes
234
+ entityTypes: entityTypes,
235
+ notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification
206
236
  },
207
237
  formData: params
208
238
  }];
@@ -479,13 +509,13 @@ export var entitySlice = createSlice({
479
509
  var _a, _b, _c, _d;
480
510
  state.error = null;
481
511
  state.customLoading = false;
482
- var _e = action.payload, data = _e.data, token = _e.token, boardResponse = _e.boardResponse;
512
+ var _e = action.payload, data = _e.data, token = _e.token, boardResponse = _e.boardResponse, individualData = _e.individualData;
483
513
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
484
514
  if (description) {
485
515
  state.error = description;
486
516
  return;
487
517
  }
488
- state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id });
518
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id, individualData: individualData });
489
519
  state.data.verify.token = token;
490
520
  var _f = boardResponse || {}, entity = _f.entity, entityTypes = _f.entityTypes;
491
521
  if (entity) {
@@ -560,7 +590,7 @@ export var entitySlice = createSlice({
560
590
  var _a, _b, _c, _d;
561
591
  state.loading = false;
562
592
  state.error = null;
563
- var _e = action.payload, data = _e.data, boardResponse = _e.boardResponse, formData = _e.formData;
593
+ var _e = action.payload, data = _e.data, boardResponse = _e.boardResponse, formData = _e.formData, individualData = _e.individualData;
564
594
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
565
595
  if (description) {
566
596
  state.error = description;
@@ -568,7 +598,7 @@ export var entitySlice = createSlice({
568
598
  }
569
599
  state.data.otpData = formData;
570
600
  state.data.otpData.responseBody = data;
571
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), boardResponse);
601
+ state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), boardResponse), { individualData: individualData });
572
602
  var _f = boardResponse || {}, entity = _f.entity, entityTypes = _f.entityTypes;
573
603
  var _g = entity || {}, license = _g.license, type = _g.type, capital = _g.capital, activities = _g.activities, legal_name = _g.legal_name;
574
604
  var legalName = legal_name;
@@ -688,7 +718,11 @@ export var entitySlice = createSlice({
688
718
  return;
689
719
  }
690
720
  var flows = response.flows;
691
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows });
721
+ var _b = state.data.verify.responseBody || {}, individuals = _b.individuals, individualData = _b.individualData;
722
+ var data_state = (individualData || {}).data_state;
723
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, state.data.verify.responseBody), { flows: flows }), (individualData && { user: individualData })), (data_state && {
724
+ individuals: __assign(__assign({}, individuals), { data_state: data_state })
725
+ }));
692
726
  })
693
727
  .addCase(updateBoardSuccess.pending, function (state) {
694
728
  state.loading = true;
@@ -68,7 +68,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
68
68
  var _a;
69
69
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
70
70
  import API from '../../../api';
71
- import { FlowsTypes, IndividualGender, IndividualType, DocumentPurpose } from '../../../@types';
71
+ import { FlowsTypes, IndividualGender, DocumentPurpose } from '../../../@types';
72
72
  import { handleNextScreenStep, handlePrevScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
73
73
  import { defaultCountry, IDENTIFICATION_TYPE, INDIVIDUAl_STEP_NAMES } from '../../../constants';
74
74
  import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, hasNoneEditableValue, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose, formatNumberAsCurrency, removeAllCharsFromNumber, mapUserList, sortUserList, getIndividualType } from '../../../utils';
@@ -330,23 +330,24 @@ export var getCityList = createAsyncThunk('individual/getCityList', function (co
330
330
  });
331
331
  }); });
332
332
  export var retrieveIndividualInfo = createAsyncThunk('individual/retrieveIndividualInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
333
- var id, type, countryCode, settings, data, individualData;
334
- return __generator(this, function (_a) {
335
- switch (_a.label) {
333
+ var id, type, countryCode, settings, data, _a, isShareholder, isBoardMember, isBuyer, isCustomer, individualData;
334
+ return __generator(this, function (_b) {
335
+ switch (_b.label) {
336
336
  case 0:
337
337
  id = params.id, type = params.type, countryCode = params.countryCode;
338
338
  settings = thunkApi.getState().settings;
339
339
  return [4, API.individualService.retrieveIndividual(id, type)];
340
340
  case 1:
341
- data = _a.sent();
341
+ data = _b.sent();
342
+ _a = getIndividualType([type]), isShareholder = _a.isShareholder, isBoardMember = _a.isBoardMember, isBuyer = _a.isBuyer, isCustomer = _a.isCustomer;
342
343
  individualData = data === null || data === void 0 ? void 0 : data.user;
343
- if (type === IndividualType.SHARE_HOLDER)
344
+ if (isShareholder)
344
345
  individualData = data === null || data === void 0 ? void 0 : data.shareholder;
345
- else if (type === IndividualType.BOARD_MEMBER)
346
+ else if (isBoardMember)
346
347
  individualData = data === null || data === void 0 ? void 0 : data.board_member;
347
- else if (type === IndividualType.BUYER)
348
+ else if (isBuyer)
348
349
  individualData = data === null || data === void 0 ? void 0 : data.buyer;
349
- else if (type === IndividualType.CUSTOMER)
350
+ else if (isCustomer)
350
351
  individualData = data === null || data === void 0 ? void 0 : data.customer;
351
352
  return [2, {
352
353
  data: __assign(__assign({}, (individualData || {})), { objects: [type], individual_data_state: individualData === null || individualData === void 0 ? void 0 : individualData.data_state, object: type }),
@@ -2,6 +2,7 @@ import { RootState } from '../../../app/store';
2
2
  import { FlowsTypes, OTPFormValues, PasswordCreateFormValues, ResponseData, SharedState } from '../../../@types';
3
3
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
4
  data: any;
5
+ individualData: any;
5
6
  boardResponse: any;
6
7
  token: string;
7
8
  }, string, {}>;
@@ -30,6 +31,7 @@ export declare const verifyOperationToken: import("@reduxjs/toolkit").AsyncThunk
30
31
  token: string;
31
32
  boardId: string;
32
33
  boardInfoId: string;
34
+ individualData: any;
33
35
  boardResponse: any;
34
36
  flows: any;
35
37
  }, {
@@ -51,11 +51,12 @@ import API from '../../../api';
51
51
  import { FlowsTypes } from '../../../@types';
52
52
  import { handleCurrentActiveScreen, handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
53
53
  import { PASSWORD_OPERATION_TYPE, PASSWORD_STEP_NAMES } from '../../../constants';
54
+ import { retrieveIndividualData } from '../../../utils';
54
55
  export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
55
- var payload, data, boardInfoData, boardData, board_id, countryIso2, info, hasPasswordCompleted;
56
- var _a, _b, _c, _d;
57
- return __generator(this, function (_e) {
58
- switch (_e.label) {
56
+ var payload, data, boardStatusData, boardInfoData, boardData, individualData, _a, board_id, board_info_id, _b, id_1, type_1, serviceCallBack, _c, boardRes, individualRes, countryIso2, info, hasPasswordCompleted;
57
+ var _d, _e, _f, _g, _h;
58
+ return __generator(this, function (_j) {
59
+ switch (_j.label) {
59
60
  case 0:
60
61
  payload = {
61
62
  service_name: 'tap_email',
@@ -63,24 +64,36 @@ export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', functio
63
64
  };
64
65
  return [4, API.leadService.verifyLeadToken(payload)];
65
66
  case 1:
66
- data = (_e.sent()).data;
67
- boardData = undefined;
68
- if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 5];
69
- board_id = data === null || data === void 0 ? void 0 : data.id;
70
- if (!board_id) return [3, 4];
71
- return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
67
+ data = (_j.sent()).data;
68
+ individualData = undefined;
69
+ if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 8];
70
+ _a = data || {}, board_id = _a.id, board_info_id = _a.board_info_id;
71
+ if (!board_id) return [3, 7];
72
+ if (!board_info_id) return [3, 3];
73
+ return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
72
74
  case 2:
73
- boardInfoData = _e.sent();
74
- return [4, API.boardService.retrieveBoardDetails(board_id)];
75
- case 3:
76
- boardData = _e.sent();
77
- _e.label = 4;
75
+ boardInfoData = _j.sent();
76
+ _j.label = 3;
77
+ case 3: return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
78
78
  case 4:
79
- countryIso2 = (_a = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _a === void 0 ? void 0 : _a.country;
79
+ boardStatusData = _j.sent();
80
+ return [4, API.boardService.retrieveBoardDetails(board_id)];
81
+ case 5:
82
+ boardData = _j.sent();
83
+ _b = ((_d = boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification) === null || _d === void 0 ? void 0 : _d.recipient) || {}, id_1 = _b.id, type_1 = _b.type;
84
+ serviceCallBack = function () { return API.individualService.retrieveIndividual(id_1, type_1); };
85
+ return [4, retrieveIndividualData(type_1, boardData, serviceCallBack)];
86
+ case 6:
87
+ _c = _j.sent(), boardRes = _c.boardRes, individualRes = _c.individualRes;
88
+ boardData = boardRes;
89
+ individualData = individualRes;
90
+ _j.label = 7;
91
+ case 7:
92
+ countryIso2 = (_e = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _e === void 0 ? void 0 : _e.country;
80
93
  if (countryIso2)
81
94
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
82
- info = (boardInfoData || {}).info;
83
- hasPasswordCompleted = ((_b = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'password'; })) === null || _b === void 0 ? void 0 : _b.status) === 'completed';
95
+ info = (boardStatusData || {}).info;
96
+ hasPasswordCompleted = ((_f = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'password'; })) === null || _f === void 0 ? void 0 : _f.status) === 'completed';
84
97
  if (data.step_name === PASSWORD_STEP_NAMES.PHONE_AUTH) {
85
98
  thunkApi.dispatch(handleCurrentActiveScreen('PASSWORD_VERIFY_STEP'));
86
99
  }
@@ -90,10 +103,11 @@ export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', functio
90
103
  else if (data.step_name === PASSWORD_STEP_NAMES.PASSWORD_INFO) {
91
104
  thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
92
105
  }
93
- _e.label = 5;
94
- case 5: return [2, {
106
+ _j.label = 8;
107
+ case 8: return [2, {
95
108
  data: data,
96
- boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || [], user: boardData === null || boardData === void 0 ? void 0 : boardData.user, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals, name: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.names, contact: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.contact, business: boardData === null || boardData === void 0 ? void 0 : boardData.business }),
109
+ individualData: individualData,
110
+ boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { flows: (boardStatusData === null || boardStatusData === void 0 ? void 0 : boardStatusData.info) || [], user: boardData === null || boardData === void 0 ? void 0 : boardData.user, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals, name: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _g === void 0 ? void 0 : _g.names, contact: (_h = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _h === void 0 ? void 0 : _h.contact, business: boardData === null || boardData === void 0 ? void 0 : boardData.business, notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification }),
97
111
  token: token
98
112
  }];
99
113
  }
@@ -217,10 +231,10 @@ export var updateBoardSuccess = createAsyncThunk('passwordUpdateBoardSuccess', f
217
231
  });
218
232
  }); });
219
233
  export var verifyOperationToken = createAsyncThunk('verifyOperationToken', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
220
- var token, boardId, boardInfoId, boardInfoData, boardData, payload, data;
221
- var _a, _b;
222
- return __generator(this, function (_c) {
223
- switch (_c.label) {
234
+ var token, boardId, boardInfoId, boardInfoData, boardStatusData, individualData, boardData, payload, data, _a, id_2, type_2, serviceCallBack, _b, boardRes, individualRes;
235
+ var _c, _d, _e;
236
+ return __generator(this, function (_f) {
237
+ switch (_f.label) {
224
238
  case 0:
225
239
  token = params.token, boardId = params.boardId, boardInfoId = params.boardInfoId;
226
240
  boardData = undefined;
@@ -230,24 +244,38 @@ export var verifyOperationToken = createAsyncThunk('verifyOperationToken', funct
230
244
  };
231
245
  return [4, API.authService.verifyAuth(payload)];
232
246
  case 1:
233
- data = (_c.sent()).data;
234
- if (!boardId) return [3, 4];
247
+ data = (_f.sent()).data;
248
+ if (!boardId) return [3, 7];
235
249
  return [4, API.boardService.retrieveBoardInfoStatus(boardId)];
236
250
  case 2:
237
- boardInfoData = _c.sent();
251
+ boardStatusData = _f.sent();
238
252
  return [4, API.boardService.retrieveBoardDetails(boardId)];
239
253
  case 3:
240
- boardData = _c.sent();
241
- _c.label = 4;
254
+ boardData = _f.sent();
255
+ if (!boardInfoId) return [3, 5];
256
+ return [4, API.boardService.retrieveBoardInfo({ id: boardId, infoId: boardInfoId })];
242
257
  case 4:
258
+ boardInfoData = _f.sent();
259
+ _f.label = 5;
260
+ case 5:
261
+ _a = ((_c = boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification) === null || _c === void 0 ? void 0 : _c.recipient) || {}, id_2 = _a.id, type_2 = _a.type;
262
+ serviceCallBack = function () { return API.individualService.retrieveIndividual(id_2, type_2); };
263
+ return [4, retrieveIndividualData(type_2, boardData, serviceCallBack)];
264
+ case 6:
265
+ _b = _f.sent(), boardRes = _b.boardRes, individualRes = _b.individualRes;
266
+ boardData = boardRes;
267
+ individualData = individualRes;
268
+ _f.label = 7;
269
+ case 7:
243
270
  thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
244
271
  return [2, {
245
272
  data: data,
246
273
  token: token,
247
274
  boardId: boardId,
248
275
  boardInfoId: boardInfoId,
249
- boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { user: boardData === null || boardData === void 0 ? void 0 : boardData.user, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals, name: (_a = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _a === void 0 ? void 0 : _a.names, contact: (_b = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _b === void 0 ? void 0 : _b.contact, business: boardData === null || boardData === void 0 ? void 0 : boardData.business }),
250
- flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || []
276
+ individualData: individualData,
277
+ boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { user: boardData === null || boardData === void 0 ? void 0 : boardData.user, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals, name: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.names, contact: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _e === void 0 ? void 0 : _e.contact, business: boardData === null || boardData === void 0 ? void 0 : boardData.business, notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification }),
278
+ flows: (boardStatusData === null || boardStatusData === void 0 ? void 0 : boardStatusData.info) || []
251
279
  }];
252
280
  }
253
281
  });
@@ -456,7 +484,11 @@ export var passwordSlice = createSlice({
456
484
  state.error = null;
457
485
  var response = (action.payload || {}).response;
458
486
  var flows = response.flows;
459
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows });
487
+ var _a = state.data.verify.responseBody || {}, individuals = _a.individuals, individualData = _a.individualData;
488
+ var data_state = (individualData || {}).data_state;
489
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, state.data.verify.responseBody), { flows: flows }), (individualData && { user: individualData })), (data_state && {
490
+ individuals: __assign(__assign({}, individuals), { data_state: data_state })
491
+ }));
460
492
  })
461
493
  .addCase(updateBoardSuccess.pending, function (state) {
462
494
  state.loading = true;
@@ -533,7 +565,11 @@ export var passwordSlice = createSlice({
533
565
  state.error = null;
534
566
  var response = (action.payload || {}).response;
535
567
  var flows = response.flows;
536
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows });
568
+ var _a = state.data.verify.responseBody || {}, individuals = _a.individuals, individualData = _a.individualData;
569
+ var data_state = (individualData || {}).data_state;
570
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, state.data.verify.responseBody), { flows: flows }), (individualData && { user: individualData })), (data_state && {
571
+ individuals: __assign(__assign({}, individuals), { data_state: data_state })
572
+ }));
537
573
  })
538
574
  .addCase(retrieveBoardResetPasswordSuccess.pending, function (state) {
539
575
  state.loading = true;
@@ -6,6 +6,7 @@ interface VerifyLeadTokenProps {
6
6
  }
7
7
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
8
8
  data: any;
9
+ individualData: any;
9
10
  boardResponse: any;
10
11
  token: string;
11
12
  }, VerifyLeadTokenProps, {}>;
@@ -51,14 +51,14 @@ import API from '../../../api';
51
51
  import { DocumentPurpose, FlowsTypes } from '../../../@types';
52
52
  import { handleNextScreenStep, handleCurrentActiveScreen, handleSetCountryByIso2, handlePrevScreenStep } from '../../../app/settings';
53
53
  import { TAX_STEP_NAMES } from '../../../constants';
54
- import { getRecentDocumentBasedOnPurpose, hasNoneEditableValue, sleep } from '../../../utils';
54
+ import { getRecentDocumentBasedOnPurpose, hasNoneEditableValue, retrieveIndividualData, sleep } from '../../../utils';
55
55
  export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a, thunkApi) {
56
56
  var token = _a.token, isInternally = _a.isInternally;
57
57
  return __awaiter(void 0, void 0, void 0, function () {
58
- var payload, data, boardData, boardInfoData, countryIso2;
59
- var _b, _c, _d;
60
- return __generator(this, function (_e) {
61
- switch (_e.label) {
58
+ var payload, data, boardData, boardInfoData, individualData, _b, id_1, type_1, serviceCallBack, _c, boardRes, individualRes, countryIso2;
59
+ var _d, _e, _f, _g;
60
+ return __generator(this, function (_h) {
61
+ switch (_h.label) {
62
62
  case 0:
63
63
  payload = {
64
64
  service_name: 'tap_email',
@@ -66,24 +66,31 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a
66
66
  };
67
67
  return [4, API.leadService.verifyLeadToken(payload)];
68
68
  case 1:
69
- data = (_e.sent()).data;
70
- boardInfoData = undefined;
71
- if (((_b = data === null || data === void 0 ? void 0 : data.errors) === null || _b === void 0 ? void 0 : _b.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
69
+ data = (_h.sent()).data;
70
+ individualData = undefined;
71
+ if (((_d = data === null || data === void 0 ? void 0 : data.errors) === null || _d === void 0 ? void 0 : _d.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
72
72
  throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
73
73
  if (isInternally)
74
74
  data.step_name = TAX_STEP_NAMES.TAX_INFO;
75
- if (!(data === null || data === void 0 ? void 0 : data.id)) return [3, 5];
75
+ if (!(data === null || data === void 0 ? void 0 : data.id)) return [3, 6];
76
76
  if (!data.board_info_id) return [3, 3];
77
77
  return [4, API.boardService.retrieveBoardInfo({ id: data.id, infoId: data.board_info_id })];
78
78
  case 2:
79
- boardInfoData = _e.sent();
80
- _e.label = 3;
79
+ boardInfoData = _h.sent();
80
+ _h.label = 3;
81
81
  case 3: return [4, API.boardService.retrieveBoardDetails(data.id)];
82
82
  case 4:
83
- boardData = _e.sent();
84
- _e.label = 5;
83
+ boardData = _h.sent();
84
+ _b = ((_e = boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification) === null || _e === void 0 ? void 0 : _e.recipient) || {}, id_1 = _b.id, type_1 = _b.type;
85
+ serviceCallBack = function () { return API.individualService.retrieveIndividual(id_1, type_1); };
86
+ return [4, retrieveIndividualData(type_1, boardData, serviceCallBack)];
85
87
  case 5:
86
- countryIso2 = (_c = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _c === void 0 ? void 0 : _c.country;
88
+ _c = _h.sent(), boardRes = _c.boardRes, individualRes = _c.individualRes;
89
+ boardData = boardRes;
90
+ individualData = individualRes;
91
+ _h.label = 6;
92
+ case 6:
93
+ countryIso2 = (_f = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _f === void 0 ? void 0 : _f.country;
87
94
  if (countryIso2)
88
95
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
89
96
  if (data.step_name === TAX_STEP_NAMES.PHONE_AUTH) {
@@ -94,7 +101,8 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a
94
101
  }
95
102
  return [2, {
96
103
  data: data,
97
- boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _d === void 0 ? void 0 : _d.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals, business: boardData === null || boardData === void 0 ? void 0 : boardData.business, notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification }),
104
+ individualData: individualData,
105
+ boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _g === void 0 ? void 0 : _g.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals, business: boardData === null || boardData === void 0 ? void 0 : boardData.business, notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification }),
98
106
  token: token
99
107
  }];
100
108
  }
@@ -302,9 +310,9 @@ export var taxSlice = createSlice({
302
310
  .addCase(verifyLeadToken.fulfilled, function (state, action) {
303
311
  state.error = null;
304
312
  state.customLoading = false;
305
- var _a = action.payload, data = _a.data, token = _a.token, boardResponse = _a.boardResponse;
313
+ var _a = action.payload, data = _a.data, token = _a.token, boardResponse = _a.boardResponse, individualData = _a.individualData;
306
314
  var user = boardResponse.user, bank_account = boardResponse.bank_account, vatID = boardResponse.vatID, merchant = boardResponse.merchant, individuals = boardResponse.individuals, entity = boardResponse.entity;
307
- state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: data.id, name: user === null || user === void 0 ? void 0 : user.names, bank_account: bank_account, vatID: vatID, merchant: merchant, individuals: individuals });
315
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: data.id, name: user === null || user === void 0 ? void 0 : user.names, bank_account: bank_account, vatID: vatID, merchant: merchant, individuals: individuals, individualData: individualData });
308
316
  state.data.verify.token = token;
309
317
  state.data.taxData.vatId = vatID;
310
318
  if (entity === null || entity === void 0 ? void 0 : entity.is_vat_acknowledged)
@@ -410,8 +418,11 @@ export var taxSlice = createSlice({
410
418
  state.error = description;
411
419
  return;
412
420
  }
413
- var flows = response.flows, steps = response.steps, user = response.user, bank_account = response.bank_account, vatID = response.vatID, merchant = response.merchant, individuals = response.individuals, entity = response.entity, brand = response.brand;
414
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps, bank_account: bank_account, name: user === null || user === void 0 ? void 0 : user.names, vatID: vatID, merchant: merchant, individuals: individuals, entity: entity, brand: brand });
421
+ var flows = response.flows, steps = response.steps, user = response.user, bank_account = response.bank_account, vatID = response.vatID, merchant = response.merchant, individuals = response.individuals, entity = response.entity, brand = response.brand, individualData = response.individualData;
422
+ var data_state = (individualData || {}).data_state;
423
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps, bank_account: bank_account, name: user === null || user === void 0 ? void 0 : user.names, vatID: vatID, merchant: merchant, individuals: individuals, entity: entity, brand: brand }), (individualData && { user: individualData })), (data_state && {
424
+ individuals: __assign(__assign({}, individuals), { data_state: data_state })
425
+ }));
415
426
  })
416
427
  .addCase(updateLeadSuccess.pending, function (state) {
417
428
  state.loading = true;
@@ -24,7 +24,6 @@ import Box from '@mui/material/Box';
24
24
  import { alpha, styled } from '@mui/material/styles';
25
25
  import { useTranslation } from 'react-i18next';
26
26
  import { useController, useFormContext } from 'react-hook-form';
27
- import { settingsSelector } from '../../../../app/settings';
28
27
  import { useLanguage, useAppSelector } from '../../../../hooks';
29
28
  import SimpleList from '../../../../components/SimpleList';
30
29
  import Collapse from '../../../../components/Collapse';
@@ -101,10 +100,8 @@ var ActivityList = function (_a) {
101
100
  var control = useFormContext().control;
102
101
  var activitiesControl = useController({ name: 'activities', control: control });
103
102
  var data = useAppSelector(entitySelector).data;
104
- var settingsData = useAppSelector(settingsSelector).data;
105
103
  var _g = data.verify.responseBody || {}, activityList = _g.activityList, entity = _g.entity;
106
104
  var controlValue = activitiesControl.field.value;
107
- var countryCode = settingsData.businessCountry;
108
105
  var handleOpenActivityMenu = function (event) {
109
106
  setActivityAnchorEl(event.currentTarget);
110
107
  };