@tap-payments/auth-jsconnect 2.0.10 → 2.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/build/api/account.d.ts +1 -2
  2. package/build/api/account.js +7 -3
  3. package/build/api/board.d.ts +25 -0
  4. package/build/api/board.js +49 -0
  5. package/build/api/brand.d.ts +7 -0
  6. package/build/api/brand.js +40 -0
  7. package/build/api/entity.d.ts +0 -1
  8. package/build/api/entity.js +3 -10
  9. package/build/api/index.d.ts +19 -6
  10. package/build/api/index.js +7 -1
  11. package/build/api/individual.d.ts +25 -2
  12. package/build/api/individual.js +1 -5
  13. package/build/api/lead.d.ts +1 -5
  14. package/build/api/lead.js +10 -5
  15. package/build/api/user.d.ts +8 -0
  16. package/build/api/user.js +12 -0
  17. package/build/components/AnimationFlow/Loader.js +17 -9
  18. package/build/constants/api.d.ts +4 -1
  19. package/build/constants/api.js +14 -8
  20. package/build/constants/app.d.ts +1 -1
  21. package/build/constants/app.js +1 -1
  22. package/build/constants/validation.js +1 -1
  23. package/build/features/app/bank/bankStore.d.ts +2 -2
  24. package/build/features/app/bank/bankStore.js +45 -36
  25. package/build/features/app/business/businessStore.d.ts +2 -1
  26. package/build/features/app/business/businessStore.js +189 -123
  27. package/build/features/app/connect/connectStore.js +17 -26
  28. package/build/features/app/individual/individualStore.d.ts +2 -10
  29. package/build/features/app/individual/individualStore.js +69 -93
  30. package/build/features/app/password/passwordStore.d.ts +6 -5
  31. package/build/features/app/password/passwordStore.js +70 -54
  32. package/build/features/app/tax/taxStore.d.ts +1 -1
  33. package/build/features/app/tax/taxStore.js +44 -39
  34. package/build/features/bank/screens/Success/Success.js +2 -2
  35. package/build/features/business/screens/Activities/ActivitiesList.d.ts +1 -1
  36. package/build/features/business/screens/Customers/CustomerLocations.d.ts +2 -2
  37. package/build/features/connect/screens/Merchant/BrandName.js +2 -6
  38. package/build/features/individual/screens/Success/Success.js +2 -2
  39. package/build/features/password/Password.js +2 -2
  40. package/build/features/password/screens/Success/Success.js +2 -2
  41. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +1 -1
  42. package/build/index.css +140 -139
  43. package/build/utils/string.d.ts +2 -1
  44. package/build/utils/string.js +7 -2
  45. package/package.json +128 -128
@@ -2,7 +2,7 @@ import { RootState } from '../../../app/store';
2
2
  import { FlowsTypes, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
3
3
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
4
  data: any;
5
- leadData: any;
5
+ boardResponse: any;
6
6
  token: string;
7
7
  }, string, {}>;
8
8
  export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
@@ -13,14 +13,6 @@ export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<{
13
13
  monthlyIncome: any;
14
14
  occupation: any;
15
15
  }, string, {}>;
16
- export declare const retrieveIndividualInfo: import("@reduxjs/toolkit").AsyncThunk<{
17
- data: any;
18
- countries: import("../../../@types").CountryCode[];
19
- countryCode: string;
20
- }, {
21
- id: string;
22
- countryCode: string;
23
- }, {}>;
24
16
  export declare const retrieveEntityInfo: import("@reduxjs/toolkit").AsyncThunk<{
25
17
  data: any;
26
18
  }, string, {}>;
@@ -34,7 +26,7 @@ export declare const updateIndividualInfo: import("@reduxjs/toolkit").AsyncThunk
34
26
  data: any;
35
27
  formData: IndividualExtraFormValues;
36
28
  }, IndividualExtraFormValues, {}>;
37
- export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
29
+ export declare const updateBoardSuccess: import("@reduxjs/toolkit").AsyncThunk<{
38
30
  response: any;
39
31
  formData: void;
40
32
  } | undefined, void, {}>;
@@ -53,7 +53,7 @@ import { hasKey } from '../../../utils';
53
53
  import { handleCurrentActiveScreen, handleNextScreenStep } from '../../../app/settings';
54
54
  import { INDIVIDUAl_STEP_NAMES } from '../../../constants';
55
55
  export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
56
- var payload, data, leadResponse, _a, steps, entity, individual_id, hasTaxCompleted;
56
+ var payload, settings, data, boardData, userData, countryCode, boardInfoData, countries, board_id, board_info_id, _a, steps, entity, user, hasTaxCompleted;
57
57
  return __generator(this, function (_b) {
58
58
  switch (_b.label) {
59
59
  case 0:
@@ -61,37 +61,52 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
61
61
  service_name: 'tap_email',
62
62
  verify_token: token
63
63
  };
64
+ settings = thunkApi.getState().settings;
64
65
  return [4, API.leadService.verifyLeadToken(payload)];
65
66
  case 1:
66
67
  data = (_b.sent()).data;
67
- leadResponse = undefined;
68
- if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 8];
69
- return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
68
+ boardInfoData = undefined;
69
+ countries = settings.data.countries;
70
+ if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 10];
71
+ return [4, API.boardService.retrieveBoard(data === null || data === void 0 ? void 0 : data.id)];
70
72
  case 2:
71
- leadResponse = _b.sent();
72
- _a = leadResponse.data, steps = _a.steps, entity = _a.entity, individual_id = _a.individual_id;
73
+ boardData = _b.sent();
74
+ board_id = data === null || data === void 0 ? void 0 : data.id;
75
+ board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
76
+ if (!(!!board_id && !!board_info_id)) return [3, 4];
77
+ return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
78
+ case 3:
79
+ boardInfoData = _b.sent();
80
+ _b.label = 4;
81
+ case 4:
82
+ _a = (boardData === null || boardData === void 0 ? void 0 : boardData.business) || {}, steps = _a.steps, entity = _a.entity, user = _a.user;
83
+ countryCode = entity === null || entity === void 0 ? void 0 : entity.country;
84
+ return [4, API.userService.retrieveUserInfo(user === null || user === void 0 ? void 0 : user.id)];
85
+ case 5:
86
+ userData = _b.sent();
73
87
  hasTaxCompleted = hasKey(steps, INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS);
74
- if (!(data.step_name === INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 3];
88
+ if (!(data.step_name === INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 6];
75
89
  thunkApi.dispatch(handleCurrentActiveScreen('INDIVIDUAL_VERIFY_STEP'));
76
- return [3, 8];
77
- case 3:
78
- if (!hasTaxCompleted) return [3, 5];
90
+ return [3, 10];
91
+ case 6:
92
+ if (!hasTaxCompleted) return [3, 8];
79
93
  return [4, thunkApi.dispatch(retrieveEntityInfo(entity === null || entity === void 0 ? void 0 : entity.id))];
80
- case 4:
94
+ case 7:
81
95
  _b.sent();
82
96
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
83
- return [3, 8];
84
- case 5:
85
- if (!(data.step_name === INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO)) return [3, 8];
97
+ return [3, 10];
98
+ case 8:
99
+ if (!(data.step_name === INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO)) return [3, 10];
86
100
  return [4, thunkApi.dispatch(retrieveDataList(entity === null || entity === void 0 ? void 0 : entity.country))];
87
- case 6:
88
- _b.sent();
89
- return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: individual_id, countryCode: entity === null || entity === void 0 ? void 0 : entity.country }))];
90
- case 7:
101
+ case 9:
91
102
  _b.sent();
92
103
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
93
- _b.label = 8;
94
- case 8: return [2, { data: data, leadData: leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data, token: token }];
104
+ _b.label = 10;
105
+ case 10: return [2, {
106
+ data: data,
107
+ boardResponse: __assign(__assign(__assign({}, userData === null || userData === void 0 ? void 0 : userData.user), boardData === null || boardData === void 0 ? void 0 : boardData.business), { countries: countries, countryCode: countryCode, flows: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info }),
108
+ token: token
109
+ }];
95
110
  }
96
111
  });
97
112
  }); });
@@ -131,26 +146,6 @@ export var retrieveDataList = createAsyncThunk('individualRetrieveDataList', fun
131
146
  }
132
147
  });
133
148
  }); });
134
- export var retrieveIndividualInfo = createAsyncThunk('individualRetrieveIndividualInfo', function (_a, thunkApi) {
135
- var id = _a.id, countryCode = _a.countryCode;
136
- return __awaiter(void 0, void 0, void 0, function () {
137
- var data, settings, countries;
138
- return __generator(this, function (_b) {
139
- switch (_b.label) {
140
- case 0: return [4, API.individualService.retrieveIndividualInfo(id)];
141
- case 1:
142
- data = _b.sent();
143
- settings = thunkApi.getState().settings;
144
- countries = settings.data.countries;
145
- return [2, {
146
- data: data,
147
- countries: countries,
148
- countryCode: countryCode
149
- }];
150
- }
151
- });
152
- });
153
- });
154
149
  export var retrieveEntityInfo = createAsyncThunk('retrieveIndividualEntityInfo', function (entityID) { return __awaiter(void 0, void 0, void 0, function () {
155
150
  var data;
156
151
  return __generator(this, function (_a) {
@@ -163,7 +158,7 @@ export var retrieveEntityInfo = createAsyncThunk('retrieveIndividualEntityInfo',
163
158
  });
164
159
  }); });
165
160
  export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
166
- var _a, individual, settings, responseBody, payload, data, _b, steps, individual_id, entity, hasIndividualCompleted;
161
+ var _a, individual, settings, responseBody, payload, data, _b, steps, entity, hasIndividualCompleted;
167
162
  var _c, _d, _e, _f;
168
163
  return __generator(this, function (_g) {
169
164
  switch (_g.label) {
@@ -180,25 +175,22 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
180
175
  return [4, API.leadService.verifyLeadOTP(payload)];
181
176
  case 1:
182
177
  data = (_g.sent()).data;
183
- if (!!(data === null || data === void 0 ? void 0 : data.errors)) return [3, 6];
178
+ if (!!(data === null || data === void 0 ? void 0 : data.errors)) return [3, 5];
184
179
  (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
185
- _b = responseBody || {}, steps = _b.steps, individual_id = _b.individual_id, entity = _b.entity;
180
+ _b = responseBody || {}, steps = _b.steps, entity = _b.entity;
186
181
  hasIndividualCompleted = hasKey(steps, INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS);
187
182
  if (!hasIndividualCompleted) return [3, 3];
188
183
  return [4, thunkApi.dispatch(retrieveEntityInfo((_f = responseBody === null || responseBody === void 0 ? void 0 : responseBody.entity) === null || _f === void 0 ? void 0 : _f.id))];
189
184
  case 2:
190
185
  _g.sent();
191
186
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
192
- return [3, 6];
187
+ return [3, 5];
193
188
  case 3: return [4, thunkApi.dispatch(retrieveDataList(entity === null || entity === void 0 ? void 0 : entity.country))];
194
189
  case 4:
195
- _g.sent();
196
- return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: individual_id, countryCode: entity === null || entity === void 0 ? void 0 : entity.country }))];
197
- case 5:
198
190
  _g.sent();
199
191
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
200
- _g.label = 6;
201
- case 6: return [2, { data: data, formData: __assign({}, params) }];
192
+ _g.label = 5;
193
+ case 5: return [2, { data: data, formData: __assign({}, params) }];
202
194
  }
203
195
  });
204
196
  }); });
@@ -233,7 +225,7 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
233
225
  }
234
226
  });
235
227
  }); });
236
- export var updateLeadSuccess = createAsyncThunk('individualUpdateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
228
+ export var updateBoardSuccess = createAsyncThunk('individualUpdateBoardSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
237
229
  var _a, settings, individual, id, payload, data;
238
230
  var _b, _c, _d, _e, _f;
239
231
  return __generator(this, function (_g) {
@@ -246,21 +238,18 @@ export var updateLeadSuccess = createAsyncThunk('individualUpdateLeadSuccess', f
246
238
  payload = {
247
239
  lang: settings.data.language,
248
240
  step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS,
249
- id: id,
250
- encryption_contract: []
241
+ id: id
251
242
  };
252
- return [4, API.leadService.updateLead(payload)];
243
+ return [4, API.boardService.updateBoard(payload)];
253
244
  case 1:
254
- data = (_g.sent()).data;
255
- if (!!data.errors) return [3, 3];
245
+ data = _g.sent();
256
246
  return [4, thunkApi.dispatch(retrieveEntityInfo((_b = data.entity) === null || _b === void 0 ? void 0 : _b.id))];
257
247
  case 2:
258
248
  _g.sent();
259
249
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
260
250
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
261
251
  thunkApi.dispatch(handleNextScreenStep());
262
- _g.label = 3;
263
- case 3: return [2, { response: data, formData: params }];
252
+ return [2, { response: data, formData: params }];
264
253
  }
265
254
  });
266
255
  }); });
@@ -310,14 +299,32 @@ export var individualSlice = createSlice({
310
299
  var _a;
311
300
  state.error = null;
312
301
  state.customLoading = false;
313
- var _b = action.payload, data = _b.data, token = _b.token, leadData = _b.leadData;
302
+ var _b = action.payload, data = _b.data, token = _b.token, boardResponse = _b.boardResponse;
314
303
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
315
304
  if (description) {
316
305
  state.error = description;
317
306
  return;
318
307
  }
319
- state.data.verify.responseBody = __assign(__assign(__assign({}, data), leadData), state.data.verify.responseBody);
308
+ state.data.verify.responseBody = __assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody);
320
309
  state.data.verify.token = token;
310
+ var _c = boardResponse || {}, source_income = _c.source_income, actual_income = _c.actual_income, occupation = _c.occupation, is_relative_PEP = _c.is_relative_PEP, is_influencer = _c.is_influencer, countries = _c.countries, countryCode = _c.countryCode;
311
+ var _d = state.data.individualData.responseBody || {}, sourceIncomeList = _d.sourceIncomeList, monthlyIncomeList = _d.monthlyIncomeList, occupationList = _d.occupationList;
312
+ var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a, _b; return ((_a = source === null || source === void 0 ? void 0 : source.name_en) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === ((_b = source_income === null || source_income === void 0 ? void 0 : source_income[0]) === null || _b === void 0 ? void 0 : _b.toLocaleLowerCase()); })) || (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
313
+ if (!!selectedSourceIncome)
314
+ state.data.individualData.sourceIncome = selectedSourceIncome;
315
+ var selectedMonthlyIncome = (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) { var _a; return ((_a = income === null || income === void 0 ? void 0 : income.name_en) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === (actual_income === null || actual_income === void 0 ? void 0 : actual_income.toLocaleLowerCase()); })) || (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList[2]);
316
+ if (!!selectedMonthlyIncome)
317
+ state.data.individualData.monthlyIncome = selectedMonthlyIncome;
318
+ var code = (data === null || data === void 0 ? void 0 : data.employer_country) || countryCode;
319
+ if (!!code) {
320
+ var employerLocation = (countries || []).find(function (country) { return country.iso2 === code; });
321
+ state.data.individualData.employerLocation = employerLocation;
322
+ }
323
+ var selectedOccupation = (occupationList === null || occupationList === void 0 ? void 0 : occupationList.find(function (o) { var _a; return ((_a = o === null || o === void 0 ? void 0 : o.name_en) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === (occupation === null || occupation === void 0 ? void 0 : occupation.toLocaleLowerCase()); })) || (occupationList === null || occupationList === void 0 ? void 0 : occupationList[0]);
324
+ if (!!selectedOccupation)
325
+ state.data.individualData.occupation = selectedOccupation;
326
+ state.data.individualData.isPEP = is_relative_PEP;
327
+ state.data.individualData.isInfluencer = is_influencer;
321
328
  })
322
329
  .addCase(verifyLeadToken.rejected, function (state, action) {
323
330
  state.error = action.error.message;
@@ -375,37 +382,6 @@ export var individualSlice = createSlice({
375
382
  .addCase(retrieveDataList.rejected, function (state, action) {
376
383
  state.loading = false;
377
384
  state.error = action.error.message;
378
- })
379
- .addCase(retrieveIndividualInfo.pending, function (state) {
380
- state.loading = true;
381
- state.error = null;
382
- })
383
- .addCase(retrieveIndividualInfo.fulfilled, function (state, action) {
384
- state.loading = false;
385
- state.error = null;
386
- var _a = action.payload, data = _a.data, countries = _a.countries, countryCode = _a.countryCode;
387
- var info = (data || {}).info;
388
- var _b = state.data.individualData.responseBody || {}, sourceIncomeList = _b.sourceIncomeList, monthlyIncomeList = _b.monthlyIncomeList, occupationList = _b.occupationList;
389
- var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a, _b, _c; return ((_a = source === null || source === void 0 ? void 0 : source.name_en) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === ((_c = (_b = info === null || info === void 0 ? void 0 : info.source_income) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.toLocaleLowerCase()); })) || (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
390
- if (!!selectedSourceIncome)
391
- state.data.individualData.sourceIncome = selectedSourceIncome;
392
- var selectedMonthlyIncome = (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) { var _a, _b; return ((_a = income === null || income === void 0 ? void 0 : income.name_en) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === ((_b = info === null || info === void 0 ? void 0 : info.actual_income) === null || _b === void 0 ? void 0 : _b.toLocaleLowerCase()); })) || (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList[2]);
393
- if (!!selectedMonthlyIncome)
394
- state.data.individualData.monthlyIncome = selectedMonthlyIncome;
395
- var code = (info === null || info === void 0 ? void 0 : info.employer_country) || countryCode;
396
- if (!!code) {
397
- var employerLocation = countries.find(function (country) { return country.iso2 === code; });
398
- state.data.individualData.employerLocation = employerLocation;
399
- }
400
- var selectedOccupation = (occupationList === null || occupationList === void 0 ? void 0 : occupationList.find(function (occupation) { var _a, _b; return ((_a = occupation === null || occupation === void 0 ? void 0 : occupation.name_en) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === ((_b = info === null || info === void 0 ? void 0 : info.occupation) === null || _b === void 0 ? void 0 : _b.toLocaleLowerCase()); })) || (occupationList === null || occupationList === void 0 ? void 0 : occupationList[0]);
401
- if (!!selectedOccupation)
402
- state.data.individualData.occupation = selectedOccupation;
403
- state.data.individualData.isPEP = info === null || info === void 0 ? void 0 : info.is_relative_PEP;
404
- state.data.individualData.isInfluencer = info === null || info === void 0 ? void 0 : info.is_influencer;
405
- })
406
- .addCase(retrieveIndividualInfo.rejected, function (state, action) {
407
- state.loading = false;
408
- state.error = action.error.message;
409
385
  })
410
386
  .addCase(updateIndividualInfo.pending, function (state) {
411
387
  state.loading = true;
@@ -448,7 +424,7 @@ export var individualSlice = createSlice({
448
424
  state.error = action.error.message;
449
425
  state.loading = false;
450
426
  })
451
- .addCase(updateLeadSuccess.fulfilled, function (state, action) {
427
+ .addCase(updateBoardSuccess.fulfilled, function (state, action) {
452
428
  var _a;
453
429
  state.loading = false;
454
430
  state.error = null;
@@ -461,11 +437,11 @@ export var individualSlice = createSlice({
461
437
  var flows = response.flows, steps = response.steps, bank_account = response.bank_account;
462
438
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps, bank_account: bank_account });
463
439
  })
464
- .addCase(updateLeadSuccess.pending, function (state) {
440
+ .addCase(updateBoardSuccess.pending, function (state) {
465
441
  state.loading = true;
466
442
  state.error = null;
467
443
  })
468
- .addCase(updateLeadSuccess.rejected, function (state, action) {
444
+ .addCase(updateBoardSuccess.rejected, function (state, action) {
469
445
  state.loading = false;
470
446
  state.error = action.error.message;
471
447
  });
@@ -2,7 +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
- leadData: any;
5
+ boardResponse: any;
6
6
  token: string;
7
7
  }, string, {}>;
8
8
  export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
@@ -21,17 +21,18 @@ export declare const createPassword: import("@reduxjs/toolkit").AsyncThunk<{
21
21
  data: any;
22
22
  formData: PasswordCreateFormValues;
23
23
  }, PasswordCreateFormValues, {}>;
24
- export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
24
+ export declare const updateBoardSuccess: import("@reduxjs/toolkit").AsyncThunk<{
25
25
  response: any;
26
26
  formData: void;
27
27
  } | undefined, void, {}>;
28
28
  export declare const verifyOperationToken: import("@reduxjs/toolkit").AsyncThunk<{
29
29
  data: any;
30
30
  token: string;
31
- leadId: string;
31
+ boardId: string;
32
+ flows: any;
32
33
  }, {
33
34
  token: string;
34
- leadId: string;
35
+ boardId: string;
35
36
  }, {}>;
36
37
  export declare const resendOperationOTP: import("@reduxjs/toolkit").AsyncThunk<{
37
38
  data: any;
@@ -48,7 +49,7 @@ export declare const resetPassword: import("@reduxjs/toolkit").AsyncThunk<{
48
49
  };
49
50
  }, OTPFormValues, {}>;
50
51
  export declare const retrieveLeadPassword: import("@reduxjs/toolkit").AsyncThunk<{
51
- lead: any;
52
+ boardResponse: any;
52
53
  entity: any;
53
54
  }, void, {}>;
54
55
  declare type VerifyData = {
@@ -53,7 +53,8 @@ import { hasKey } from '../../../utils';
53
53
  import { handleCurrentActiveScreen, handleNextScreenStep } from '../../../app/settings';
54
54
  import { PASSWORD_OPERATION_TYPE, PASSWORD_STEP_NAMES } from '../../../constants';
55
55
  export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
56
- var payload, data, leadResponse, _a, steps, entity, hasCompleted;
56
+ var payload, data, boardData, boardInfoData, userData, board_id, board_info_id, steps, entity, business, hasCompleted;
57
+ var _a;
57
58
  return __generator(this, function (_b) {
58
59
  switch (_b.label) {
59
60
  case 0:
@@ -64,29 +65,40 @@ export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', functio
64
65
  return [4, API.leadService.verifyLeadToken(payload)];
65
66
  case 1:
66
67
  data = (_b.sent()).data;
67
- leadResponse = undefined;
68
- if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 6];
69
- return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
68
+ userData = undefined;
69
+ if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 9];
70
+ return [4, API.boardService.retrieveBoard(data === null || data === void 0 ? void 0 : data.id)];
70
71
  case 2:
71
- leadResponse = _b.sent();
72
- _a = leadResponse.data, steps = _a.steps, entity = _a.entity;
72
+ boardData = _b.sent();
73
+ board_id = data === null || data === void 0 ? void 0 : data.id;
74
+ board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
75
+ if (!(!!board_id && !!board_info_id)) return [3, 4];
76
+ return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
77
+ case 3:
78
+ boardInfoData = _b.sent();
79
+ _b.label = 4;
80
+ case 4:
81
+ steps = boardData.steps, entity = boardData.entity, business = boardData.business;
82
+ return [4, API.userService.retrieveUserInfo((_a = business === null || business === void 0 ? void 0 : business.user) === null || _a === void 0 ? void 0 : _a.id)];
83
+ case 5:
84
+ userData = _b.sent();
73
85
  hasCompleted = hasKey(steps, PASSWORD_STEP_NAMES.PASSWORD_SUCCESS);
74
- if (!(data.step_name === PASSWORD_STEP_NAMES.PHONE_AUTH)) return [3, 3];
86
+ if (!(data.step_name === PASSWORD_STEP_NAMES.PHONE_AUTH)) return [3, 6];
75
87
  thunkApi.dispatch(handleCurrentActiveScreen('PASSWORD_VERIFY_STEP'));
76
- return [3, 6];
77
- case 3:
78
- if (!hasCompleted) return [3, 5];
88
+ return [3, 9];
89
+ case 6:
90
+ if (!hasCompleted) return [3, 8];
79
91
  return [4, thunkApi.dispatch(retrieveEntityInfo(entity === null || entity === void 0 ? void 0 : entity.id))];
80
- case 4:
92
+ case 7:
81
93
  _b.sent();
82
94
  thunkApi.dispatch(handleNextScreenStep('PASSWORD_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
83
- return [3, 6];
84
- case 5:
95
+ return [3, 9];
96
+ case 8:
85
97
  if (data.step_name === PASSWORD_STEP_NAMES.PASSWORD_INFO) {
86
98
  thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
87
99
  }
88
- _b.label = 6;
89
- case 6: return [2, { data: data, leadData: leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data, token: token }];
100
+ _b.label = 9;
101
+ case 9: return [2, { data: data, boardResponse: __assign(__assign(__assign({}, userData === null || userData === void 0 ? void 0 : userData.user), boardData === null || boardData === void 0 ? void 0 : boardData.business), { flows: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info }), token: token }];
90
102
  }
91
103
  });
92
104
  }); });
@@ -177,7 +189,7 @@ export var createPassword = createAsyncThunk('createPassword', function (params,
177
189
  }
178
190
  });
179
191
  }); });
180
- export var updateLeadSuccess = createAsyncThunk('passwordUpdateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
192
+ export var updateBoardSuccess = createAsyncThunk('passwordUpdateBoardSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
181
193
  var _a, settings, password, id, payload, data;
182
194
  var _b, _c, _d, _e, _f;
183
195
  return __generator(this, function (_g) {
@@ -190,30 +202,28 @@ export var updateLeadSuccess = createAsyncThunk('passwordUpdateLeadSuccess', fun
190
202
  payload = {
191
203
  lang: settings.data.language,
192
204
  step_name: PASSWORD_STEP_NAMES.PASSWORD_SUCCESS,
193
- id: id,
194
- encryption_contract: []
205
+ id: id
195
206
  };
196
- return [4, API.leadService.updateLead(payload)];
207
+ return [4, API.boardService.updateBoard(payload)];
197
208
  case 1:
198
- data = (_g.sent()).data;
199
- if (!!data.errors) return [3, 3];
209
+ data = _g.sent();
200
210
  return [4, thunkApi.dispatch(retrieveEntityInfo((_b = data.entity) === null || _b === void 0 ? void 0 : _b.id))];
201
211
  case 2:
202
212
  _g.sent();
203
213
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
204
214
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
205
215
  thunkApi.dispatch(handleNextScreenStep());
206
- _g.label = 3;
207
- case 3: return [2, { response: data, formData: params }];
216
+ return [2, { response: data, formData: params }];
208
217
  }
209
218
  });
210
219
  }); });
211
220
  export var verifyOperationToken = createAsyncThunk('verifyOperationToken', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
212
- var token, leadId, payload, data;
221
+ var token, boardId, boardInfoData, payload, data, board_id, board_info_id;
213
222
  return __generator(this, function (_a) {
214
223
  switch (_a.label) {
215
224
  case 0:
216
- token = params.token, leadId = params.leadId;
225
+ token = params.token, boardId = params.boardId;
226
+ boardInfoData = undefined;
217
227
  payload = {
218
228
  auth_type: 7,
219
229
  auth_token: token
@@ -221,8 +231,16 @@ export var verifyOperationToken = createAsyncThunk('verifyOperationToken', funct
221
231
  return [4, API.authService.verifyAuth(payload)];
222
232
  case 1:
223
233
  data = (_a.sent()).data;
234
+ board_id = data === null || data === void 0 ? void 0 : data.id;
235
+ board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
236
+ if (!(!!board_id && !!board_info_id)) return [3, 3];
237
+ return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
238
+ case 2:
239
+ boardInfoData = _a.sent();
240
+ _a.label = 3;
241
+ case 3:
224
242
  thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
225
- return [2, { data: data, token: token, leadId: leadId }];
243
+ return [2, { data: data, token: token, boardId: boardId, flows: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info }];
226
244
  }
227
245
  });
228
246
  }); });
@@ -274,25 +292,29 @@ export var resetPassword = createAsyncThunk('resetPassword', function (params, t
274
292
  });
275
293
  }); });
276
294
  export var retrieveLeadPassword = createAsyncThunk('retrieveLeadPassword', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
277
- var _a, password, settings, id, data, entityData;
278
- var _b, _c, _d, _e, _f;
279
- return __generator(this, function (_g) {
280
- switch (_g.label) {
295
+ var _a, password, settings, id, boardData, business, data, entityData;
296
+ var _b, _c, _d, _e, _f, _g;
297
+ return __generator(this, function (_h) {
298
+ switch (_h.label) {
281
299
  case 0:
282
300
  _a = thunkApi.getState(), password = _a.password, settings = _a.settings;
283
301
  id = (password.data.verify.responseBody || { id: '' }).id;
284
- return [4, API.leadService.retrieveLead(id)];
302
+ return [4, API.boardService.retrieveBoard(id)];
285
303
  case 1:
286
- data = (_g.sent()).data;
287
- return [4, API.entityService.retrieveEntityInfo((_b = data === null || data === void 0 ? void 0 : data.entity) === null || _b === void 0 ? void 0 : _b.id)];
304
+ boardData = _h.sent();
305
+ business = boardData.business;
306
+ return [4, API.userService.retrieveUserInfo((_b = business === null || business === void 0 ? void 0 : business.user) === null || _b === void 0 ? void 0 : _b.id)];
288
307
  case 2:
289
- entityData = (_g.sent()).data;
308
+ data = _h.sent();
309
+ return [4, API.entityService.retrieveEntityInfo((_c = data === null || data === void 0 ? void 0 : data.entity) === null || _c === void 0 ? void 0 : _c.id)];
310
+ case 3:
311
+ entityData = (_h.sent()).data;
290
312
  if (!(data === null || data === void 0 ? void 0 : data.errors) || !(entityData === null || entityData === void 0 ? void 0 : entityData.errors)) {
291
313
  thunkApi.dispatch(handleNextScreenStep());
292
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { id: id });
293
- (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
314
+ (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { id: id });
315
+ (_g = (_f = settings.data.appConfig).onFlowCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, { data: data });
294
316
  }
295
- return [2, { lead: data, entity: entityData }];
317
+ return [2, { boardResponse: __assign(__assign({}, data), boardData), entity: entityData }];
296
318
  }
297
319
  });
298
320
  }); });
@@ -337,13 +359,13 @@ export var passwordSlice = createSlice({
337
359
  state.data.verify.operationType = PASSWORD_OPERATION_TYPE.SET_PASSWORD;
338
360
  state.error = null;
339
361
  state.customLoading = false;
340
- var _b = action.payload, data = _b.data, token = _b.token, leadData = _b.leadData;
362
+ var _b = action.payload, data = _b.data, token = _b.token, boardResponse = _b.boardResponse;
341
363
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
342
364
  if (description) {
343
365
  state.error = description;
344
366
  return;
345
367
  }
346
- state.data.verify.responseBody = __assign(__assign(__assign({}, data), leadData), state.data.verify.responseBody);
368
+ state.data.verify.responseBody = __assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody);
347
369
  state.data.verify.token = token;
348
370
  })
349
371
  .addCase(verifyLeadToken.pending, function (state) {
@@ -433,24 +455,18 @@ export var passwordSlice = createSlice({
433
455
  state.error = action.error.message;
434
456
  state.loading = false;
435
457
  })
436
- .addCase(updateLeadSuccess.fulfilled, function (state, action) {
437
- var _a;
458
+ .addCase(updateBoardSuccess.fulfilled, function (state, action) {
438
459
  state.loading = false;
439
460
  state.error = null;
440
461
  var response = (action.payload || {}).response;
441
- var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
442
- if (description) {
443
- state.error = description;
444
- return;
445
- }
446
462
  var flows = response.flows, steps = response.steps, bank_account = response.bank_account;
447
463
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps, bank_account: bank_account });
448
464
  })
449
- .addCase(updateLeadSuccess.pending, function (state) {
465
+ .addCase(updateBoardSuccess.pending, function (state) {
450
466
  state.loading = true;
451
467
  state.error = null;
452
468
  })
453
- .addCase(updateLeadSuccess.rejected, function (state, action) {
469
+ .addCase(updateBoardSuccess.rejected, function (state, action) {
454
470
  state.loading = false;
455
471
  state.error = action.error.message;
456
472
  })
@@ -459,13 +475,13 @@ export var passwordSlice = createSlice({
459
475
  state.data.verify.operationType = PASSWORD_OPERATION_TYPE.RESET_PASSWORD;
460
476
  state.error = null;
461
477
  state.customLoading = false;
462
- var _b = action.payload, data = _b.data, token = _b.token, leadId = _b.leadId;
478
+ var _b = action.payload, data = _b.data, token = _b.token, boardId = _b.boardId;
463
479
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
464
480
  if (description) {
465
481
  state.error = description;
466
482
  return;
467
483
  }
468
- state.data.verify.responseBody = __assign(__assign(__assign({}, data), state.data.verify.responseBody), { id: leadId });
484
+ state.data.verify.responseBody = __assign(__assign(__assign({}, data), state.data.verify.responseBody), { id: boardId });
469
485
  state.data.verify.token = token;
470
486
  })
471
487
  .addCase(verifyOperationToken.pending, function (state) {
@@ -516,16 +532,16 @@ export var passwordSlice = createSlice({
516
532
  state.loading = false;
517
533
  })
518
534
  .addCase(retrieveLeadPassword.fulfilled, function (state, action) {
519
- var _a, _b;
535
+ var _a;
520
536
  state.loading = false;
521
537
  state.error = null;
522
- var _c = action.payload, lead = _c.lead, entity = _c.entity;
523
- var description = (((_a = lead === null || lead === void 0 ? void 0 : lead.errors) === null || _a === void 0 ? void 0 : _a[0]) || ((_b = entity === null || entity === void 0 ? void 0 : entity.errors) === null || _b === void 0 ? void 0 : _b[0]) || {}).description;
538
+ var _b = action.payload, boardResponse = _b.boardResponse, entity = _b.entity;
539
+ var description = (((_a = entity === null || entity === void 0 ? void 0 : entity.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
524
540
  if (description) {
525
541
  state.error = description;
526
542
  return;
527
543
  }
528
- state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), lead), entity);
544
+ state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), boardResponse), entity);
529
545
  })
530
546
  .addCase(retrieveLeadPassword.pending, function (state) {
531
547
  state.loading = true;
@@ -2,7 +2,7 @@ import { RootState } from '../../../app/store';
2
2
  import { FlowsTypes, OTPFormValues, ResponseData, SharedState, TaxFormValues } from '../../../@types';
3
3
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
4
  data: any;
5
- leadData: any;
5
+ boardResponse: any;
6
6
  token: string;
7
7
  }, string, {}>;
8
8
  export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{