@tap-payments/auth-jsconnect 2.0.20-test → 2.0.22-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/build/@types/app.d.ts +5 -0
  2. package/build/api/board.d.ts +1 -0
  3. package/build/api/board.js +8 -1
  4. package/build/api/index.d.ts +1 -1
  5. package/build/api/lead.d.ts +0 -1
  6. package/build/api/lead.js +0 -5
  7. package/build/features/app/bank/bankStore.d.ts +4 -2
  8. package/build/features/app/bank/bankStore.js +55 -70
  9. package/build/features/app/business/businessStore.d.ts +2 -1
  10. package/build/features/app/business/businessStore.js +61 -63
  11. package/build/features/app/individual/individualStore.d.ts +14 -3
  12. package/build/features/app/individual/individualStore.js +81 -81
  13. package/build/features/app/password/passwordStore.d.ts +7 -5
  14. package/build/features/app/password/passwordStore.js +68 -96
  15. package/build/features/app/tax/taxStore.d.ts +0 -1
  16. package/build/features/app/tax/taxStore.js +38 -49
  17. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  18. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  19. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
  20. package/build/features/password/Password.js +2 -1
  21. package/build/features/password/screens/Success/Success.js +2 -2
  22. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +3 -2
  23. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +4 -4
  24. package/build/features/tax/screens/Verify/Verify.js +1 -1
  25. package/build/utils/string.d.ts +1 -1
  26. package/build/utils/string.js +2 -2
  27. package/package.json +1 -1
@@ -63,10 +63,10 @@ import { BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LI
63
63
  import { convertNumbers2English, getEighteenYearsAgo, hasKey } from '../../../utils';
64
64
  import { handleNextScreenStep } from '../../../app/settings';
65
65
  export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
66
- var payload, data, leadResponse, brandInfo, boardResponse, board_id, board_info_id, steps, entityID, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted;
67
- var _a, _b, _c, _d, _e, _f, _g;
68
- return __generator(this, function (_h) {
69
- switch (_h.label) {
66
+ var payload, data, leadResponse, brandInfo, boardResponse, board_id, board_info_id, steps, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted;
67
+ var _a, _b, _c, _d, _e, _f;
68
+ return __generator(this, function (_g) {
69
+ switch (_g.label) {
70
70
  case 0:
71
71
  payload = {
72
72
  service_name: 'tap_email',
@@ -74,37 +74,36 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
74
74
  };
75
75
  return [4, API.leadService.verifyLeadToken(payload)];
76
76
  case 1:
77
- data = (_h.sent()).data;
77
+ data = (_g.sent()).data;
78
78
  leadResponse = undefined;
79
79
  brandInfo = undefined;
80
80
  boardResponse = undefined;
81
81
  if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 17];
82
82
  return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
83
83
  case 2:
84
- leadResponse = _h.sent();
84
+ leadResponse = _g.sent();
85
85
  board_id = (_a = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _a === void 0 ? void 0 : _a.board_id;
86
86
  board_info_id = (_b = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _b === void 0 ? void 0 : _b.board_info_id;
87
87
  if (!(!!board_id && !!board_info_id)) return [3, 4];
88
88
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
89
89
  case 3:
90
- boardResponse = _h.sent();
91
- _h.label = 4;
90
+ boardResponse = _g.sent();
91
+ _g.label = 4;
92
92
  case 4:
93
93
  if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH) {
94
94
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
95
95
  }
96
96
  if (!(data.step_name === 'business_info')) return [3, 17];
97
97
  steps = (_c = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _c === void 0 ? void 0 : _c.steps;
98
- entityID = (_e = (_d = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _d === void 0 ? void 0 : _d.entity) === null || _e === void 0 ? void 0 : _e.id;
99
- brandID = (_g = (_f = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _f === void 0 ? void 0 : _f.brand) === null || _g === void 0 ? void 0 : _g.id;
98
+ brandID = (_e = (_d = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _d === void 0 ? void 0 : _d.brand) === null || _e === void 0 ? void 0 : _e.id;
100
99
  hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
101
100
  hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO);
102
101
  hasBusinessCRActivitiesCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES);
103
102
  hasBusinessCustomersCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS);
104
103
  if (!hasBusinessCompleted) return [3, 6];
105
- return [4, thunkApi.dispatch(retrieveEntityInfo(entityID))];
104
+ return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
106
105
  case 5:
107
- _h.sent();
106
+ _g.sent();
108
107
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
109
108
  return [3, 17];
110
109
  case 6:
@@ -119,31 +118,37 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
119
118
  if (!hasBusinessCRActivitiesCompleted) return [3, 12];
120
119
  return [4, thunkApi.dispatch(retrieveChannels())];
121
120
  case 9:
122
- _h.sent();
121
+ _g.sent();
123
122
  return [4, thunkApi.dispatch(retrieveDataList())];
124
123
  case 10:
125
- _h.sent();
124
+ _g.sent();
126
125
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
127
126
  return [4, API.brandService.retrieveBrand(brandID)];
128
127
  case 11:
129
- brandInfo = _h.sent();
128
+ brandInfo = _g.sent();
130
129
  return [3, 17];
131
130
  case 12:
132
131
  if (!hasBusinessCRInfoCompleted) return [3, 15];
133
132
  return [4, thunkApi.dispatch(retrieveChannels())];
134
133
  case 13:
135
- _h.sent();
134
+ _g.sent();
136
135
  return [4, API.brandService.retrieveBrand(brandID)];
137
136
  case 14:
138
- brandInfo = _h.sent();
137
+ brandInfo = _g.sent();
139
138
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
140
139
  return [3, 17];
141
140
  case 15: return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
142
141
  case 16:
143
- _h.sent();
142
+ _g.sent();
144
143
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
145
- _h.label = 17;
146
- case 17: return [2, { data: data, leadData: __assign(__assign({}, leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data), { flows: boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info }), token: token, brandInfo: brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.brand }];
144
+ _g.label = 17;
145
+ case 17: return [2, {
146
+ data: data,
147
+ leadData: __assign(__assign({}, leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data), { flows: boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info }),
148
+ token: token,
149
+ brandInfo: brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.brand,
150
+ boardId: (_f = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _f === void 0 ? void 0 : _f.board_id
151
+ }];
147
152
  }
148
153
  });
149
154
  }); });
@@ -166,9 +171,9 @@ export var resendOTP = createAsyncThunk('resendOTPBusiness', function (params, t
166
171
  }); });
167
172
  export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
168
173
  var _a, business, settings, isNID, responseBody, verifyResponse, stepName, brandID, payload, data, brandInfo, steps, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted;
169
- var _b, _c, _d, _e, _f, _g;
170
- return __generator(this, function (_h) {
171
- switch (_h.label) {
174
+ var _b, _c, _d, _e, _f, _g, _h, _j;
175
+ return __generator(this, function (_k) {
176
+ switch (_k.label) {
172
177
  case 0:
173
178
  _a = thunkApi.getState(), business = _a.business, settings = _a.settings;
174
179
  isNID = business.data.otpData.isNID;
@@ -178,21 +183,21 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
178
183
  brandID = (_c = (_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) === null || _c === void 0 ? void 0 : _c.id;
179
184
  payload = {
180
185
  data: params.otp,
181
- service_name: (_d = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _d === void 0 ? void 0 : _d.service_name,
182
- verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
186
+ service_name: ((_e = (_d = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_token) === null || _d === void 0 ? void 0 : _d.verification_by) === null || _e === void 0 ? void 0 : _e.service_name) || ((_f = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _f === void 0 ? void 0 : _f.service_name),
187
+ verify_token: ((_g = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_token) === null || _g === void 0 ? void 0 : _g.verify_token) || (responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token),
183
188
  step_name: stepName,
184
189
  encryption_contract: ['data']
185
190
  };
186
191
  return [4, API.leadService.verifyLeadOTP(payload)];
187
192
  case 1:
188
- data = (_h.sent()).data;
193
+ data = (_k.sent()).data;
189
194
  brandInfo = undefined;
190
195
  if (!!data.errors) return [3, 13];
191
196
  thunkApi.dispatch(updateStepName(stepName));
192
197
  return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
193
198
  case 2:
194
- _h.sent();
195
- (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
199
+ _k.sent();
200
+ (_j = (_h = settings.data.appConfig).onStepCompleted) === null || _j === void 0 ? void 0 : _j.call(_h, settings.data.activeScreen.name, { otp: params.otp });
196
201
  steps = responseBody === null || responseBody === void 0 ? void 0 : responseBody.steps;
197
202
  hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
198
203
  hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO);
@@ -203,9 +208,9 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
203
208
  return [3, 13];
204
209
  case 3:
205
210
  if (!hasBusinessCompleted) return [3, 5];
206
- return [4, thunkApi.dispatch(retrieveEntityInfo((_g = verifyResponse === null || verifyResponse === void 0 ? void 0 : verifyResponse.entity) === null || _g === void 0 ? void 0 : _g.id))];
211
+ return [4, thunkApi.dispatch(retrieveBoardDetails(verifyResponse === null || verifyResponse === void 0 ? void 0 : verifyResponse.board_id))];
207
212
  case 4:
208
- _h.sent();
213
+ _k.sent();
209
214
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
210
215
  return [3, 13];
211
216
  case 5:
@@ -223,21 +228,21 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
223
228
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
224
229
  return [4, API.brandService.retrieveBrand(brandID)];
225
230
  case 8:
226
- brandInfo = _h.sent();
231
+ brandInfo = _k.sent();
227
232
  return [3, 13];
228
233
  case 9:
229
234
  if (!hasBusinessCRInfoCompleted) return [3, 12];
230
235
  return [4, thunkApi.dispatch(retrieveChannels())];
231
236
  case 10:
232
- _h.sent();
237
+ _k.sent();
233
238
  return [4, API.brandService.retrieveBrand(brandID)];
234
239
  case 11:
235
- brandInfo = _h.sent();
240
+ brandInfo = _k.sent();
236
241
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
237
242
  return [3, 13];
238
243
  case 12:
239
244
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
240
- _h.label = 13;
245
+ _k.label = 13;
241
246
  case 13: return [2, { data: data, formData: __assign(__assign({}, params), { isNID: isNID }), brandInfo: brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.brand }];
242
247
  }
243
248
  });
@@ -260,14 +265,12 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
260
265
  step_name: stepName,
261
266
  encryption_contract: ['country_code', 'identification_id', 'identification_id_type', 'date_of_birth']
262
267
  };
263
- return [4, API.leadService.updateLeadIdentity(requestBody)];
268
+ return [4, API.leadService.updateLead(requestBody)];
264
269
  case 1:
265
- data = (_e.sent()).data;
266
- if (!data.errors) {
267
- thunkApi.dispatch(updateStepName(stepName));
268
- thunkApi.dispatch(handleNextScreenStep());
269
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody);
270
- }
270
+ data = _e.sent();
271
+ thunkApi.dispatch(updateStepName(stepName));
272
+ thunkApi.dispatch(handleNextScreenStep());
273
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody);
271
274
  return [2, { data: data, formData: __assign(__assign({}, params), { type: identification_id_type }) }];
272
275
  }
273
276
  });
@@ -290,12 +293,10 @@ export var resendOTPLeadIdentity = createAsyncThunk('resendOTPLeadIdentity', fun
290
293
  step_name: stepName,
291
294
  encryption_contract: ['country_code', 'identification_id', 'identification_id_type', 'date_of_birth']
292
295
  };
293
- return [4, API.leadService.updateLeadIdentity(requestBody)];
296
+ return [4, API.leadService.updateLead(requestBody)];
294
297
  case 1:
295
- data = (_d.sent()).data;
296
- if (!data.errors) {
297
- thunkApi.dispatch(updateStepName(stepName));
298
- }
298
+ data = _d.sent();
299
+ thunkApi.dispatch(updateStepName(stepName));
299
300
  return [2, data];
300
301
  }
301
302
  });
@@ -322,14 +323,17 @@ export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function
322
323
  }
323
324
  });
324
325
  }); });
325
- export var retrieveEntityInfo = createAsyncThunk('retrieveEntityInfo', function (entityID) { return __awaiter(void 0, void 0, void 0, function () {
326
+ export var retrieveBoardDetails = createAsyncThunk('retrieveBoardDetails', function (boardID) { return __awaiter(void 0, void 0, void 0, function () {
326
327
  var data;
327
- return __generator(this, function (_a) {
328
- switch (_a.label) {
329
- case 0: return [4, API.entityService.retrieveEntityInfo(entityID)];
328
+ var _a, _b;
329
+ return __generator(this, function (_c) {
330
+ switch (_c.label) {
331
+ case 0: return [4, API.boardService.retrieveBoardDetails(boardID)];
330
332
  case 1:
331
- data = (_a.sent()).data;
332
- return [2, { data: data }];
333
+ data = _c.sent();
334
+ return [2, {
335
+ data: __assign(__assign({}, data), { user: data === null || data === void 0 ? void 0 : data.user, brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.name, contact: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.contact })
336
+ }];
333
337
  }
334
338
  });
335
339
  }); });
@@ -596,13 +600,13 @@ export var businessSlice = createSlice({
596
600
  var _a, _b, _c, _d;
597
601
  state.error = null;
598
602
  state.customLoading = false;
599
- var _e = action.payload, data = _e.data, token = _e.token, leadData = _e.leadData, brandInfo = _e.brandInfo;
603
+ var _e = action.payload, data = _e.data, token = _e.token, leadData = _e.leadData, brandInfo = _e.brandInfo, boardId = _e.boardId;
600
604
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
601
605
  if (description) {
602
606
  state.error = description;
603
607
  return;
604
608
  }
605
- state.data.verify.responseBody = __assign(__assign(__assign({}, data), leadData), state.data.verify.responseBody);
609
+ state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), leadData), state.data.verify.responseBody), { board_id: boardId });
606
610
  state.data.verify.token = token;
607
611
  state.data.otpData.isNID = false;
608
612
  var _f = state.data.verify.responseBody || {}, entity = _f.entity, entity_activities = _f.entity_activities, business_type = _f.business_type;
@@ -787,23 +791,17 @@ export var businessSlice = createSlice({
787
791
  state.error = action.error.message;
788
792
  state.loading = false;
789
793
  })
790
- .addCase(retrieveEntityInfo.pending, function (state) {
794
+ .addCase(retrieveBoardDetails.pending, function (state) {
791
795
  state.error = null;
792
796
  state.loading = true;
793
797
  })
794
- .addCase(retrieveEntityInfo.fulfilled, function (state, action) {
795
- var _a;
798
+ .addCase(retrieveBoardDetails.fulfilled, function (state, action) {
796
799
  state.error = null;
797
800
  state.loading = false;
798
801
  var data = (action.payload || {}).data;
799
- var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
800
- if (description) {
801
- state.error = description;
802
- return;
803
- }
804
802
  state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
805
803
  })
806
- .addCase(retrieveEntityInfo.rejected, function (state, action) {
804
+ .addCase(retrieveBoardDetails.rejected, function (state, action) {
807
805
  state.error = action.error.message;
808
806
  state.loading = false;
809
807
  })
@@ -1,8 +1,19 @@
1
1
  import { RootState } from '../../../app/store';
2
- import { FlowsTypes, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
2
+ import { CountryCode, FlowsTypes, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState } from '../../../@types';
3
3
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
4
  data: any;
5
- boardResponse: any;
5
+ boardResponse: {
6
+ user: any;
7
+ brand: any;
8
+ bank_account: any;
9
+ entity: any;
10
+ merchant: any;
11
+ name: any;
12
+ contact: any;
13
+ countries: CountryCode[];
14
+ countryCode: any;
15
+ flows: any;
16
+ };
6
17
  token: string;
7
18
  }, string, {}>;
8
19
  export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
@@ -13,7 +24,7 @@ export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<{
13
24
  monthlyIncome: any;
14
25
  occupation: any;
15
26
  }, string, {}>;
16
- export declare const retrieveEntityInfo: import("@reduxjs/toolkit").AsyncThunk<{
27
+ export declare const retrieveBoardDetails: import("@reduxjs/toolkit").AsyncThunk<{
17
28
  data: any;
18
29
  }, string, {}>;
19
30
  export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
@@ -49,13 +49,13 @@ var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import API from '../../../api';
51
51
  import { FlowsTypes } from '../../../@types';
52
- import { hasKey } from '../../../utils';
53
52
  import { handleCurrentActiveScreen, handleNextScreenStep } from '../../../app/settings';
54
53
  import { INDIVIDUAl_STEP_NAMES } from '../../../constants';
55
54
  export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
56
- var payload, settings, data, boardData, userData, countryCode, boardInfoData, countries, board_id, board_info_id, _a, steps, entity, user, hasTaxCompleted;
57
- return __generator(this, function (_b) {
58
- switch (_b.label) {
55
+ var payload, settings, data, boardData, countryCode, boardInfoData, countries, board_id, board_info_id, entity, info, hasIndividualCompleted;
56
+ var _a, _b, _c;
57
+ return __generator(this, function (_d) {
58
+ switch (_d.label) {
59
59
  case 0:
60
60
  payload = {
61
61
  service_name: 'tap_email',
@@ -64,47 +64,51 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
64
64
  settings = thunkApi.getState().settings;
65
65
  return [4, API.leadService.verifyLeadToken(payload)];
66
66
  case 1:
67
- data = (_b.sent()).data;
67
+ data = (_d.sent()).data;
68
68
  boardInfoData = undefined;
69
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)];
72
- case 2:
73
- boardData = _b.sent();
70
+ if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 6];
74
71
  board_id = data === null || data === void 0 ? void 0 : data.id;
75
72
  board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
76
- if (!(!!board_id && !!board_info_id)) return [3, 4];
73
+ if (!(!!board_id && !!board_info_id)) return [3, 3];
77
74
  return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
78
- case 3:
79
- boardInfoData = _b.sent();
80
- _b.label = 4;
75
+ case 2:
76
+ boardInfoData = _d.sent();
77
+ _d.label = 3;
78
+ case 3: return [4, API.boardService.retrieveBoardDetails(board_id)];
81
79
  case 4:
82
- _a = (boardData === null || boardData === void 0 ? void 0 : boardData.business) || {}, steps = _a.steps, entity = _a.entity, user = _a.user;
80
+ boardData = _d.sent();
81
+ entity = ((boardData === null || boardData === void 0 ? void 0 : boardData.business) || {}).entity;
83
82
  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();
87
- hasTaxCompleted = hasKey(steps, INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS);
88
- if (!(data.step_name === INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 6];
89
- thunkApi.dispatch(handleCurrentActiveScreen('INDIVIDUAL_VERIFY_STEP'));
90
- return [3, 10];
91
- case 6:
92
- if (!hasTaxCompleted) return [3, 8];
93
- return [4, thunkApi.dispatch(retrieveEntityInfo(entity === null || entity === void 0 ? void 0 : entity.id))];
94
- case 7:
95
- _b.sent();
96
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
97
- return [3, 10];
98
- case 8:
99
- if (!(data.step_name === INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO)) return [3, 10];
83
+ info = boardInfoData.info;
84
+ hasIndividualCompleted = ((_a = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _a === void 0 ? void 0 : _a.status) === 'completed';
100
85
  return [4, thunkApi.dispatch(retrieveDataList(entity === null || entity === void 0 ? void 0 : entity.country))];
101
- case 9:
102
- _b.sent();
103
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
104
- _b.label = 10;
105
- case 10: return [2, {
86
+ case 5:
87
+ _d.sent();
88
+ if (data.step_name === INDIVIDUAl_STEP_NAMES.PHONE_AUTH) {
89
+ thunkApi.dispatch(handleCurrentActiveScreen('INDIVIDUAL_VERIFY_STEP'));
90
+ }
91
+ else if (hasIndividualCompleted) {
92
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
93
+ }
94
+ else if (data.step_name === INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO) {
95
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
96
+ }
97
+ _d.label = 6;
98
+ case 6: return [2, {
106
99
  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 }),
100
+ boardResponse: {
101
+ user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
102
+ brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
103
+ bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
104
+ entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
105
+ merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
106
+ name: (_b = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _b === void 0 ? void 0 : _b.name,
107
+ contact: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.contact,
108
+ countries: countries,
109
+ countryCode: countryCode,
110
+ flows: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info
111
+ },
108
112
  token: token
109
113
  }];
110
114
  }
@@ -146,51 +150,50 @@ export var retrieveDataList = createAsyncThunk('individualRetrieveDataList', fun
146
150
  }
147
151
  });
148
152
  }); });
149
- export var retrieveEntityInfo = createAsyncThunk('retrieveIndividualEntityInfo', function (entityID) { return __awaiter(void 0, void 0, void 0, function () {
153
+ export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetails', function (boardId) { return __awaiter(void 0, void 0, void 0, function () {
150
154
  var data;
151
- return __generator(this, function (_a) {
152
- switch (_a.label) {
153
- case 0: return [4, API.entityService.retrieveEntityInfo(entityID)];
155
+ var _a, _b;
156
+ return __generator(this, function (_c) {
157
+ switch (_c.label) {
158
+ case 0: return [4, API.boardService.retrieveBoardDetails(boardId)];
154
159
  case 1:
155
- data = (_a.sent()).data;
156
- return [2, { data: data }];
160
+ data = _c.sent();
161
+ return [2, {
162
+ data: __assign(__assign({}, data), { user: data === null || data === void 0 ? void 0 : data.user, brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.name, contact: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.contact })
163
+ }];
157
164
  }
158
165
  });
159
166
  }); });
160
167
  export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
161
- var _a, individual, settings, responseBody, payload, data, _b, steps, entity, hasIndividualCompleted;
162
- var _c, _d, _e, _f;
163
- return __generator(this, function (_g) {
164
- switch (_g.label) {
168
+ var _a, individual, settings, responseBody, payload, data, flows, hasIndividualCompleted;
169
+ var _b, _c, _d, _e;
170
+ return __generator(this, function (_f) {
171
+ switch (_f.label) {
165
172
  case 0:
166
173
  _a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
167
174
  responseBody = individual.data.verify.responseBody;
168
175
  payload = {
169
176
  data: params.otp,
170
- 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: (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _b === void 0 ? void 0 : _b.service_name,
171
178
  verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
172
179
  step_name: INDIVIDUAl_STEP_NAMES.PHONE_AUTH,
173
180
  encryption_contract: ['data']
174
181
  };
175
182
  return [4, API.leadService.verifyLeadOTP(payload)];
176
183
  case 1:
177
- data = (_g.sent()).data;
178
- if (!!(data === null || data === void 0 ? void 0 : data.errors)) return [3, 5];
179
- (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
180
- _b = responseBody || {}, steps = _b.steps, entity = _b.entity;
181
- hasIndividualCompleted = hasKey(steps, INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS);
182
- if (!hasIndividualCompleted) return [3, 3];
183
- return [4, thunkApi.dispatch(retrieveEntityInfo((_f = responseBody === null || responseBody === void 0 ? void 0 : responseBody.entity) === null || _f === void 0 ? void 0 : _f.id))];
184
- case 2:
185
- _g.sent();
186
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
187
- return [3, 5];
188
- case 3: return [4, thunkApi.dispatch(retrieveDataList(entity === null || entity === void 0 ? void 0 : entity.country))];
189
- case 4:
190
- _g.sent();
191
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
192
- _g.label = 5;
193
- case 5: return [2, { data: data, formData: __assign({}, params) }];
184
+ data = (_f.sent()).data;
185
+ if (!(data === null || data === void 0 ? void 0 : data.errors)) {
186
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
187
+ flows = (responseBody || {}).flows;
188
+ hasIndividualCompleted = ((_e = flows === null || flows === void 0 ? void 0 : flows.find(function (flow) { return flow.name === 'individual'; })) === null || _e === void 0 ? void 0 : _e.status) === 'completed';
189
+ if (hasIndividualCompleted) {
190
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
191
+ }
192
+ else {
193
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
194
+ }
195
+ }
196
+ return [2, { data: data, formData: __assign({}, params) }];
194
197
  }
195
198
  });
196
199
  }); });
@@ -226,13 +229,13 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
226
229
  });
227
230
  }); });
228
231
  export var updateBoardSuccess = createAsyncThunk('individualUpdateBoardSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
229
- var _a, settings, individual, _b, id, infoId, entity, payload, data;
232
+ var _a, settings, individual, _b, id, infoId, payload, data;
230
233
  var _c, _d, _e, _f;
231
234
  return __generator(this, function (_g) {
232
235
  switch (_g.label) {
233
236
  case 0:
234
237
  _a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
235
- _b = individual.data.verify.responseBody || {}, id = _b.board_id, infoId = _b.board_info_id, entity = _b.entity;
238
+ _b = individual.data.verify.responseBody || {}, id = _b.board_id, infoId = _b.board_info_id;
236
239
  if (!id)
237
240
  return [2];
238
241
  payload = {
@@ -243,7 +246,7 @@ export var updateBoardSuccess = createAsyncThunk('individualUpdateBoardSuccess',
243
246
  return [4, API.boardService.updateBoardInfo(__assign({ id: id, infoId: infoId }, payload))];
244
247
  case 1:
245
248
  data = _g.sent();
246
- return [4, thunkApi.dispatch(retrieveEntityInfo(entity === null || entity === void 0 ? void 0 : entity.id))];
249
+ return [4, thunkApi.dispatch(retrieveBoardDetails(id))];
247
250
  case 2:
248
251
  _g.sent();
249
252
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
@@ -307,8 +310,9 @@ export var individualSlice = createSlice({
307
310
  }
308
311
  state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), boardResponse), state.data.verify.responseBody), { board_id: data.id });
309
312
  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;
313
+ var _c = boardResponse || {}, countries = _c.countries, countryCode = _c.countryCode, brand = _c.brand;
314
+ var _d = brand || {}, source_income = _d.source_income, actual_income = _d.actual_income, occupation = _d.occupation, is_relative_PEP = _d.is_relative_PEP, is_influencer = _d.is_influencer;
315
+ var _e = state.data.individualData.responseBody || {}, sourceIncomeList = _e.sourceIncomeList, monthlyIncomeList = _e.monthlyIncomeList, occupationList = _e.occupationList;
312
316
  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
317
  if (!!selectedSourceIncome)
314
318
  state.data.individualData.sourceIncome = selectedSourceIncome;
@@ -363,6 +367,7 @@ export var individualSlice = createSlice({
363
367
  }
364
368
  state.data.otpData = formData;
365
369
  state.data.otpData.responseBody = data;
370
+ state.data.individualData = __assign({}, state.data.individualData);
366
371
  })
367
372
  .addCase(verifyLeadOTP.rejected, function (state, action) {
368
373
  state.loading = false;
@@ -404,23 +409,18 @@ export var individualSlice = createSlice({
404
409
  state.loading = false;
405
410
  state.error = action.error.message;
406
411
  })
407
- .addCase(retrieveEntityInfo.pending, function (state) {
412
+ .addCase(retrieveBoardDetails.pending, function (state) {
408
413
  state.error = null;
409
414
  state.loading = true;
410
415
  })
411
- .addCase(retrieveEntityInfo.fulfilled, function (state, action) {
412
- var _a;
416
+ .addCase(retrieveBoardDetails.fulfilled, function (state, action) {
413
417
  state.error = null;
414
418
  state.loading = false;
415
419
  var data = (action.payload || {}).data;
416
- var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
417
- if (description) {
418
- state.error = description;
419
- return;
420
- }
421
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
420
+ var _a = data || {}, entity = _a.entity, user = _a.user;
421
+ state.data.verify.responseBody = __assign(__assign(__assign({}, state.data.verify.responseBody), data), { entity: entity, name: user === null || user === void 0 ? void 0 : user.name });
422
422
  })
423
- .addCase(retrieveEntityInfo.rejected, function (state, action) {
423
+ .addCase(retrieveBoardDetails.rejected, function (state, action) {
424
424
  state.error = action.error.message;
425
425
  state.loading = false;
426
426
  })
@@ -434,8 +434,8 @@ export var individualSlice = createSlice({
434
434
  state.error = description;
435
435
  return;
436
436
  }
437
- var flows = response.flows, steps = response.steps, bank_account = response.bank_account;
438
- state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows, steps: steps, bank_account: bank_account });
437
+ var flows = response.flows;
438
+ state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows });
439
439
  })
440
440
  .addCase(updateBoardSuccess.pending, function (state) {
441
441
  state.loading = true;
@@ -2,13 +2,15 @@ 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
- boardResponse: any;
5
+ boardResponse: {
6
+ flows: any;
7
+ };
6
8
  token: string;
7
9
  }, string, {}>;
8
10
  export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
9
11
  data: any;
10
12
  }, void, {}>;
11
- export declare const retrieveEntityInfo: import("@reduxjs/toolkit").AsyncThunk<{
13
+ export declare const retrieveBoardDetails: import("@reduxjs/toolkit").AsyncThunk<{
12
14
  data: any;
13
15
  }, string, {}>;
14
16
  export declare const verifyPasswordLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
@@ -33,6 +35,7 @@ export declare const verifyOperationToken: import("@reduxjs/toolkit").AsyncThunk
33
35
  }, {
34
36
  token: string;
35
37
  boardId: string;
38
+ boardInfoId: string;
36
39
  }, {}>;
37
40
  export declare const resendOperationOTP: import("@reduxjs/toolkit").AsyncThunk<{
38
41
  data: any;
@@ -48,9 +51,8 @@ export declare const resetPassword: import("@reduxjs/toolkit").AsyncThunk<{
48
51
  otp: string;
49
52
  };
50
53
  }, OTPFormValues, {}>;
51
- export declare const retrieveLeadPassword: import("@reduxjs/toolkit").AsyncThunk<{
52
- boardResponse: any;
53
- entity: any;
54
+ export declare const retrieveBoardResetPasswordSuccess: import("@reduxjs/toolkit").AsyncThunk<{
55
+ id: any;
54
56
  }, void, {}>;
55
57
  declare type VerifyData = {
56
58
  token: string;