@tap-payments/auth-jsconnect 2.4.30-test → 2.4.31-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.
@@ -7,6 +7,7 @@ interface VerifyLeadTokenProps {
7
7
  }
8
8
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
9
9
  data: any;
10
+ individualData: any;
10
11
  boardResponse: {
11
12
  user: any;
12
13
  brand: any;
@@ -51,14 +51,14 @@ import API from '../../../api';
51
51
  import { DocumentPurpose, FlowsTypes } from '../../../@types';
52
52
  import { handleCurrentActiveScreen, handleNextScreenStep, handlePrevScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
53
53
  import { BANK_STEP_NAMES } from '../../../constants';
54
- import { hasNoneEditableValue, isStringHasOneAsterisk, sleep } from '../../../utils';
54
+ import { hasNoneEditableValue, isStringHasOneAsterisk, retrieveIndividualData, sleep } from '../../../utils';
55
55
  export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', 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, _b, board_id, board_info_id, countryIso2;
59
- var _c, _d, _e, _f;
60
- return __generator(this, function (_g) {
61
- switch (_g.label) {
58
+ var payload, data, boardData, boardInfoData, individualData, _b, board_id, board_info_id, _c, id_1, type_1, serviceCallBack, _d, boardRes, individualRes, countryIso2;
59
+ var _e, _f, _g, _h, _j;
60
+ return __generator(this, function (_k) {
61
+ switch (_k.label) {
62
62
  case 0:
63
63
  payload = {
64
64
  service_name: 'tap_email',
@@ -66,23 +66,30 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_
66
66
  };
67
67
  return [4, API.leadService.verifyLeadToken(payload)];
68
68
  case 1:
69
- data = (_g.sent()).data;
70
- boardInfoData = undefined;
71
- if ((_c = data.errors) === null || _c === void 0 ? void 0 : _c.length)
69
+ data = (_k.sent()).data;
70
+ individualData = undefined;
71
+ if ((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length)
72
72
  throw new Error(data.errors[0].description);
73
73
  _b = data || {}, board_id = _b.id, board_info_id = _b.board_info_id;
74
- if (!board_id) return [3, 5];
74
+ if (!board_id) return [3, 6];
75
75
  if (!board_info_id) return [3, 3];
76
76
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
77
77
  case 2:
78
- boardInfoData = _g.sent();
79
- _g.label = 3;
78
+ boardInfoData = _k.sent();
79
+ _k.label = 3;
80
80
  case 3: return [4, API.boardService.retrieveBoardDetails(board_id)];
81
81
  case 4:
82
- boardData = _g.sent();
83
- _g.label = 5;
82
+ boardData = _k.sent();
83
+ _c = ((_f = boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification) === null || _f === void 0 ? void 0 : _f.recipient) || {}, id_1 = _c.id, type_1 = _c.type;
84
+ serviceCallBack = function () { return API.individualService.retrieveIndividual(id_1, type_1); };
85
+ return [4, retrieveIndividualData(type_1, boardData, serviceCallBack)];
84
86
  case 5:
85
- countryIso2 = (_d = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _d === void 0 ? void 0 : _d.country;
87
+ _d = _k.sent(), boardRes = _d.boardRes, individualRes = _d.individualRes;
88
+ boardData = boardRes;
89
+ individualData = individualRes;
90
+ _k.label = 6;
91
+ case 6:
92
+ countryIso2 = (_g = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _g === void 0 ? void 0 : _g.country;
86
93
  if (countryIso2)
87
94
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
88
95
  if (isInternally)
@@ -95,14 +102,15 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_
95
102
  }
96
103
  return [2, {
97
104
  data: data,
105
+ individualData: individualData,
98
106
  boardResponse: {
99
107
  user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
100
108
  brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
101
109
  bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
102
110
  entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
103
111
  merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
104
- name: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _e === void 0 ? void 0 : _e.names,
105
- contact: (_f = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _f === void 0 ? void 0 : _f.contact,
112
+ name: (_h = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _h === void 0 ? void 0 : _h.names,
113
+ contact: (_j = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _j === void 0 ? void 0 : _j.contact,
106
114
  business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
107
115
  individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
108
116
  notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification
@@ -342,13 +350,13 @@ export var bankSlice = createSlice({
342
350
  var _a;
343
351
  state.error = null;
344
352
  state.customLoading = false;
345
- var _b = action.payload, data = _b.data, token = _b.token, boardResponse = _b.boardResponse;
353
+ var _b = action.payload, data = _b.data, token = _b.token, boardResponse = _b.boardResponse, individualData = _b.individualData;
346
354
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
347
355
  if (description) {
348
356
  state.error = description;
349
357
  return;
350
358
  }
351
- state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: data.id });
359
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: data.id, individualData: individualData });
352
360
  state.data.verify.token = token;
353
361
  var _c = (boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.bank_account) || {}, bank_name = _c.bank_name, beneficiary_name = _c.beneficiary_name, iban = _c.iban, is_acknowledged = _c.is_acknowledged;
354
362
  state.data.bankData.bankName = bank_name || '';
@@ -438,7 +446,11 @@ export var bankSlice = createSlice({
438
446
  return;
439
447
  }
440
448
  var flows = response.flows;
441
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows });
449
+ var _b = state.data.verify.responseBody || {}, individuals = _b.individuals, individualData = _b.individualData;
450
+ var data_state = (individualData || {}).data_state;
451
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, state.data.verify.responseBody), { flows: flows }), (individualData && { user: individualData })), (data_state && {
452
+ individuals: __assign(__assign({}, individuals), { data_state: data_state })
453
+ }));
442
454
  })
443
455
  .addCase(updateBoardSuccess.pending, function (state) {
444
456
  state.loading = true;
@@ -7,6 +7,7 @@ interface VerifyLeadTokenProps {
7
7
  }
8
8
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
9
9
  data: any;
10
+ individualData: any;
10
11
  boardResponse: {
11
12
  user: any;
12
13
  brand: any;
@@ -29,6 +30,7 @@ export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
29
30
  }, void, {}>;
30
31
  export declare const verifyBrandLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
31
32
  data: any;
33
+ individualData: any;
32
34
  boardResponse: {
33
35
  user: any;
34
36
  brand: any;
@@ -62,14 +62,14 @@ import API from '../../../api';
62
62
  import { FlowsTypes } from '../../../@types';
63
63
  import { handleNextScreenStep, handlePrevScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
64
64
  import { BRAND_STEP_NAMES } from '../../../constants';
65
- import { hasNoneEditableValue, isKW, isTwitter, isWebsite, mapSalesChannel, sleep } from '../../../utils';
65
+ import { hasNoneEditableValue, isKW, isTwitter, isWebsite, mapSalesChannel, retrieveIndividualData, sleep } from '../../../utils';
66
66
  export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (_a, thunkApi) {
67
67
  var token = _a.token, isInternally = _a.isInternally;
68
68
  return __awaiter(void 0, void 0, void 0, function () {
69
- var payload, data, countryIso2, _b, board_id, board_info_id, segmentsList, salesChannels, teamSizeList, boardData, boardInfoData;
70
- var _c, _d, _e;
71
- return __generator(this, function (_f) {
72
- switch (_f.label) {
69
+ var payload, data, countryIso2, _b, board_id, board_info_id, segmentsList, salesChannels, teamSizeList, boardData, boardInfoData, individualData, _c, id_1, type_1, serviceCallBack, _d, boardRes, individualRes;
70
+ var _e, _f, _g, _h;
71
+ return __generator(this, function (_j) {
72
+ switch (_j.label) {
73
73
  case 0:
74
74
  payload = {
75
75
  service_name: 'tap_email',
@@ -77,7 +77,7 @@ export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (
77
77
  };
78
78
  return [4, API.leadService.verifyLeadToken(payload)];
79
79
  case 1:
80
- data = (_f.sent()).data;
80
+ data = (_j.sent()).data;
81
81
  if ((data === null || data === void 0 ? void 0 : data.errors) && (data === null || data === void 0 ? void 0 : data.mw_error)) {
82
82
  throw new Error(data.errors[0].description);
83
83
  }
@@ -88,44 +88,52 @@ export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (
88
88
  if (!board_id) {
89
89
  throw new Error('Internal server error');
90
90
  }
91
- boardInfoData = undefined;
91
+ individualData = undefined;
92
92
  if (isInternally)
93
93
  data.step_name = BRAND_STEP_NAMES.BRAND_INFO;
94
- if (!(data.step_name !== BRAND_STEP_NAMES.PHONE_AUTH || isInternally)) return [3, 8];
94
+ if (!(data.step_name !== BRAND_STEP_NAMES.PHONE_AUTH || isInternally)) return [3, 9];
95
95
  if (!board_info_id) return [3, 3];
96
96
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
97
97
  case 2:
98
- boardInfoData = _f.sent();
99
- _f.label = 3;
98
+ boardInfoData = _j.sent();
99
+ _j.label = 3;
100
100
  case 3: return [4, API.boardService.retrieveBoardDetails(board_id)];
101
101
  case 4:
102
- boardData = _f.sent();
102
+ boardData = _j.sent();
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)];
106
+ case 5:
107
+ _d = _j.sent(), boardRes = _d.boardRes, individualRes = _d.individualRes;
108
+ boardData = boardRes;
109
+ individualData = individualRes;
103
110
  if (!countryIso2) {
104
- countryIso2 = (_c = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _c === void 0 ? void 0 : _c.country;
111
+ countryIso2 = (_f = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _f === void 0 ? void 0 : _f.country;
105
112
  if (countryIso2)
106
113
  thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
107
114
  }
108
115
  return [4, API.dataService.getSegments({ page: 0 })];
109
- case 5:
110
- segmentsList = _f.sent();
111
- return [4, API.dataService.getChannelsOfServices({ page: 0 })];
112
116
  case 6:
113
- salesChannels = _f.sent();
114
- return [4, API.dataService.getTeamSize({ page: 0 })];
117
+ segmentsList = _j.sent();
118
+ return [4, API.dataService.getChannelsOfServices({ page: 0 })];
115
119
  case 7:
116
- teamSizeList = _f.sent();
120
+ salesChannels = _j.sent();
121
+ return [4, API.dataService.getTeamSize({ page: 0 })];
122
+ case 8:
123
+ teamSizeList = _j.sent();
117
124
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP')); });
118
- _f.label = 8;
119
- case 8: return [2, {
125
+ _j.label = 9;
126
+ case 9: return [2, {
120
127
  data: data,
128
+ individualData: individualData,
121
129
  boardResponse: {
122
130
  user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
123
131
  brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
124
132
  entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
125
133
  bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
126
134
  merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
127
- name: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.names,
128
- contact: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _e === void 0 ? void 0 : _e.contact,
135
+ name: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _g === void 0 ? void 0 : _g.names,
136
+ contact: (_h = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _h === void 0 ? void 0 : _h.contact,
129
137
  individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
130
138
  business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
131
139
  notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification
@@ -157,59 +165,67 @@ export var resendOTP = createAsyncThunk('brandResendOTP', function (params, thun
157
165
  });
158
166
  }); });
159
167
  export var verifyBrandLeadOTP = createAsyncThunk('verifyBrandLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
160
- var _a, brand, settings, responseBody, payload, data, _b, board_id, board_info_id, boardInfoData, boardData, segmentsList, salesChannels, teamSizeList;
161
- var _c, _d, _e, _f, _g, _h;
162
- return __generator(this, function (_j) {
163
- switch (_j.label) {
168
+ var _a, brand, settings, responseBody, payload, data, _b, board_id, board_info_id, boardInfoData, individualData, boardData, _c, id, type, serviceCallBack, _d, boardRes, individualRes, segmentsList, salesChannels, teamSizeList;
169
+ var _e, _f, _g, _h, _j, _k, _l;
170
+ return __generator(this, function (_m) {
171
+ switch (_m.label) {
164
172
  case 0:
165
173
  _a = thunkApi.getState(), brand = _a.brand, settings = _a.settings;
166
174
  responseBody = brand.data.verify.responseBody;
167
175
  payload = {
168
176
  data: params.otp,
169
- service_name: (_c = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _c === void 0 ? void 0 : _c.service_name,
177
+ service_name: (_e = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _e === void 0 ? void 0 : _e.service_name,
170
178
  verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
171
179
  step_name: BRAND_STEP_NAMES.PHONE_AUTH,
172
180
  encryption_contract: ['data']
173
181
  };
174
182
  return [4, API.leadService.verifyLeadOTP(payload)];
175
183
  case 1:
176
- data = (_j.sent()).data;
177
- if ((_d = data.errors) === null || _d === void 0 ? void 0 : _d.length)
184
+ data = (_m.sent()).data;
185
+ if ((_f = data.errors) === null || _f === void 0 ? void 0 : _f.length)
178
186
  throw new Error(data.errors[0].description);
179
187
  _b = responseBody || {}, board_id = _b.id, board_info_id = _b.board_info_id;
180
188
  if (!board_id) {
181
189
  throw new Error('Internal server error');
182
190
  }
183
- boardInfoData = undefined;
191
+ individualData = undefined;
184
192
  if (!board_info_id) return [3, 3];
185
193
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
186
194
  case 2:
187
- boardInfoData = _j.sent();
188
- _j.label = 3;
195
+ boardInfoData = _m.sent();
196
+ _m.label = 3;
189
197
  case 3: return [4, API.boardService.retrieveBoardDetails(board_id)];
190
198
  case 4:
191
- boardData = _j.sent();
192
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
193
- return [4, API.dataService.getSegments({ page: 0 })];
199
+ boardData = _m.sent();
200
+ _c = ((_g = boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification) === null || _g === void 0 ? void 0 : _g.recipient) || {}, id = _c.id, type = _c.type;
201
+ serviceCallBack = function () { return API.individualService.retrieveIndividual(id, type); };
202
+ return [4, retrieveIndividualData(type, boardData, serviceCallBack)];
194
203
  case 5:
195
- segmentsList = _j.sent();
196
- return [4, API.dataService.getChannelsOfServices({ page: 0 })];
204
+ _d = _m.sent(), boardRes = _d.boardRes, individualRes = _d.individualRes;
205
+ boardData = boardRes;
206
+ individualData = individualRes;
207
+ (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, { otp: params.otp });
208
+ return [4, API.dataService.getSegments({ page: 0 })];
197
209
  case 6:
198
- salesChannels = _j.sent();
199
- return [4, API.dataService.getTeamSize({ page: 0 })];
210
+ segmentsList = _m.sent();
211
+ return [4, API.dataService.getChannelsOfServices({ page: 0 })];
200
212
  case 7:
201
- teamSizeList = _j.sent();
213
+ salesChannels = _m.sent();
214
+ return [4, API.dataService.getTeamSize({ page: 0 })];
215
+ case 8:
216
+ teamSizeList = _m.sent();
202
217
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP')); });
203
218
  return [2, {
204
219
  data: data,
220
+ individualData: individualData,
205
221
  boardResponse: {
206
222
  user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
207
223
  brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
208
224
  entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
209
225
  bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
210
226
  merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
211
- name: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _g === void 0 ? void 0 : _g.names,
212
- contact: (_h = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _h === void 0 ? void 0 : _h.contact,
227
+ name: (_k = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _k === void 0 ? void 0 : _k.names,
228
+ contact: (_l = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _l === void 0 ? void 0 : _l.contact,
213
229
  individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
214
230
  business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
215
231
  notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification
@@ -534,7 +550,7 @@ export var brandSlice = createSlice({
534
550
  var _a, _b, _c, _d;
535
551
  state.error = null;
536
552
  state.customLoading = false;
537
- var _e = action.payload, data = _e.data, token = _e.token, boardResponse = _e.boardResponse, segmentsList = _e.segmentsList, teamSizeList = _e.teamSizeList, salesChannels = _e.salesChannels;
553
+ var _e = action.payload, data = _e.data, token = _e.token, boardResponse = _e.boardResponse, segmentsList = _e.segmentsList, teamSizeList = _e.teamSizeList, salesChannels = _e.salesChannels, individualData = _e.individualData;
538
554
  var brand = boardResponse.brand, entity = boardResponse.entity;
539
555
  state.data.brandData.brandName = (((_a = brand === null || brand === void 0 ? void 0 : brand.name) === null || _a === void 0 ? void 0 : _a.en) || '').trim();
540
556
  var selectedSegment = (_b = segmentsList === null || segmentsList === void 0 ? void 0 : segmentsList.filter(function (segment) {
@@ -556,7 +572,7 @@ export var brandSlice = createSlice({
556
572
  state.data.brandData.teamSize = selectedTeamSize;
557
573
  var mappedSalesChannels = mapSalesChannel((brand === null || brand === void 0 ? void 0 : brand.channel_services) || []);
558
574
  state.data.brandData.salesChannels = mappedSalesChannels;
559
- state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id, channel_list: (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.list) || [], salesChannels: mappedSalesChannels, activities: entity === null || entity === void 0 ? void 0 : entity.activities, segmentsList: segmentsList, teamSizeList: teamSizeList });
575
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id, channel_list: (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.list) || [], salesChannels: mappedSalesChannels, activities: entity === null || entity === void 0 ? void 0 : entity.activities, segmentsList: segmentsList, teamSizeList: teamSizeList, individualData: individualData });
560
576
  state.data.verify.token = token;
561
577
  })
562
578
  .addCase(verifyLeadToken.rejected, function (state, action) {
@@ -582,7 +598,7 @@ export var brandSlice = createSlice({
582
598
  var _a, _b, _c, _d;
583
599
  state.loading = false;
584
600
  state.error = null;
585
- var _e = action.payload, data = _e.data, boardResponse = _e.boardResponse, formData = _e.formData, segmentsList = _e.segmentsList, teamSizeList = _e.teamSizeList, salesChannels = _e.salesChannels;
601
+ var _e = action.payload, data = _e.data, boardResponse = _e.boardResponse, formData = _e.formData, segmentsList = _e.segmentsList, teamSizeList = _e.teamSizeList, salesChannels = _e.salesChannels, individualData = _e.individualData;
586
602
  var brand = boardResponse.brand, entity = boardResponse.entity;
587
603
  state.data.otpData = formData;
588
604
  state.data.otpData.responseBody = data;
@@ -606,7 +622,7 @@ export var brandSlice = createSlice({
606
622
  state.data.brandActivities.refundPolicy = element.agree;
607
623
  }
608
624
  });
609
- state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), boardResponse), { board_id: data.id, channel_list: (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.list) || [], activities: entity === null || entity === void 0 ? void 0 : entity.activities, salesChannels: mappedSalesChannels, segmentsList: segmentsList, teamSizeList: teamSizeList });
625
+ state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), boardResponse), { board_id: data.id, channel_list: (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.list) || [], activities: entity === null || entity === void 0 ? void 0 : entity.activities, salesChannels: mappedSalesChannels, segmentsList: segmentsList, teamSizeList: teamSizeList, individualData: individualData });
610
626
  })
611
627
  .addCase(verifyBrandLeadOTP.rejected, function (state, action) {
612
628
  state.loading = false;
@@ -722,7 +738,11 @@ export var brandSlice = createSlice({
722
738
  state.loading = false;
723
739
  state.error = null;
724
740
  var flows = (((_a = action.payload) === null || _a === void 0 ? void 0 : _a.response) || {}).flows;
725
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows });
741
+ var _b = state.data.verify.responseBody || {}, individuals = _b.individuals, individualData = _b.individualData;
742
+ var data_state = (individualData || {}).data_state;
743
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, state.data.verify.responseBody), { flows: flows }), (individualData && { user: individualData })), (data_state && {
744
+ individuals: __assign(__assign({}, individuals), { data_state: data_state })
745
+ }));
726
746
  })
727
747
  .addCase(updateBoardSuccess.pending, function (state) {
728
748
  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: {
10
11
  user: any;
11
12
  brand: any;
@@ -17,6 +18,7 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
17
18
  individuals: any;
18
19
  business: any;
19
20
  entityTypes: any;
21
+ notification: any;
20
22
  };
21
23
  token: string;
22
24
  }, VerifyLeadTokenProps, {}>;
@@ -25,6 +27,7 @@ export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
25
27
  }, void, {}>;
26
28
  export declare const verifyEntityLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
27
29
  data: any;
30
+ individualData: any;
28
31
  boardResponse: {
29
32
  user: any;
30
33
  brand: any;
@@ -36,6 +39,7 @@ export declare const verifyEntityLeadOTP: import("@reduxjs/toolkit").AsyncThunk<
36
39
  individuals: any;
37
40
  business: any;
38
41
  entityTypes: any;
42
+ notification: any;
39
43
  };
40
44
  formData: OTPFormValues;
41
45
  }, OTPFormValues, {}>;
@@ -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;
@@ -76,3 +76,4 @@ export declare const getIndividualType: (objects: Array<string>) => {
76
76
  isBuyer: boolean;
77
77
  isCustomer: boolean;
78
78
  };
79
+ export declare function retrieveIndividualData(type: string, boardData: any, serviceCallback: () => Promise<any>): Promise<any>;
@@ -9,6 +9,42 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (_) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
12
48
  var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
49
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
50
  if (ar || !(i in from)) {
@@ -298,3 +334,33 @@ export var getIndividualType = function (objects) {
298
334
  });
299
335
  return { isUser: isUser, isShareholder: isShareholder, isBoardMember: isBoardMember, isBuyer: isBuyer, isCustomer: isCustomer };
300
336
  };
337
+ export function retrieveIndividualData(type, boardData, serviceCallback) {
338
+ return __awaiter(this, void 0, void 0, function () {
339
+ var _a, isShareholder, isBoardMember, isBuyer, isCustomer, data, individualRes, _b, data_state, is_authorized, boardRes, individuals;
340
+ return __generator(this, function (_c) {
341
+ switch (_c.label) {
342
+ case 0:
343
+ _a = getIndividualType([type]), isShareholder = _a.isShareholder, isBoardMember = _a.isBoardMember, isBuyer = _a.isBuyer, isCustomer = _a.isCustomer;
344
+ return [4, serviceCallback()];
345
+ case 1:
346
+ data = _c.sent();
347
+ individualRes = data === null || data === void 0 ? void 0 : data.user;
348
+ if (isShareholder)
349
+ individualRes = data === null || data === void 0 ? void 0 : data.shareholder;
350
+ else if (isBoardMember)
351
+ individualRes = data === null || data === void 0 ? void 0 : data.board_member;
352
+ else if (isBuyer)
353
+ individualRes = data === null || data === void 0 ? void 0 : data.buyer;
354
+ else if (isCustomer)
355
+ individualRes = data === null || data === void 0 ? void 0 : data.customer;
356
+ _b = individualRes || {}, data_state = _b.data_state, is_authorized = _b.is_authorized;
357
+ boardRes = boardData || {};
358
+ if (!is_authorized) {
359
+ individuals = (boardRes || {}).individuals;
360
+ boardRes = __assign(__assign(__assign({}, boardRes), (!is_authorized && { user: individualRes })), { individuals: __assign(__assign({}, individuals), (!!data_state && { data_state: data_state })) });
361
+ }
362
+ return [2, { boardRes: boardRes, individualRes: individualRes }];
363
+ }
364
+ });
365
+ });
366
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.4.30-test",
3
+ "version": "2.4.31-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",