@tap-payments/auth-jsconnect 1.0.72 → 1.0.77

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 (70) hide show
  1. package/build/@types/app.d.ts +7 -6
  2. package/build/@types/form.d.ts +2 -2
  3. package/build/api/auth.d.ts +7 -0
  4. package/build/api/auth.js +5 -1
  5. package/build/api/data.d.ts +1 -0
  6. package/build/api/data.js +5 -1
  7. package/build/api/entity.d.ts +1 -0
  8. package/build/api/entity.js +5 -1
  9. package/build/api/index.d.ts +9 -2
  10. package/build/api/index.js +3 -1
  11. package/build/api/individual.d.ts +8 -0
  12. package/build/api/individual.js +9 -0
  13. package/build/components/SimpleList/SimpleList.js +2 -2
  14. package/build/constants/api.d.ts +3 -0
  15. package/build/constants/api.js +10 -4
  16. package/build/constants/app.js +18 -6
  17. package/build/constants/assets.js +1 -1
  18. package/build/features/app/bank/bankStore.d.ts +3 -0
  19. package/build/features/app/bank/bankStore.js +45 -9
  20. package/build/features/app/business/businessStore.d.ts +4 -5
  21. package/build/features/app/business/businessStore.js +90 -54
  22. package/build/features/app/connect/connectStore.d.ts +1 -0
  23. package/build/features/app/connect/connectStore.js +19 -10
  24. package/build/features/app/individual/individualStore.d.ts +7 -1
  25. package/build/features/app/individual/individualStore.js +79 -30
  26. package/build/features/app/password/passwordStore.d.ts +4 -0
  27. package/build/features/app/password/passwordStore.js +71 -15
  28. package/build/features/bank/screens/Success/Success.js +4 -1
  29. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +3 -0
  30. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +87 -0
  31. package/build/features/bank/screens/SuccessWithFlowButtons/index.d.ts +2 -0
  32. package/build/features/bank/screens/SuccessWithFlowButtons/index.js +2 -0
  33. package/build/features/business/screens/Activities/ActivitiesList.d.ts +1 -1
  34. package/build/features/business/screens/Activities/SalesChannels.js +1 -1
  35. package/build/features/business/screens/Activities/validation.d.ts +24 -24
  36. package/build/features/business/screens/Activities/validation.js +2 -2
  37. package/build/features/business/screens/Customers/CustomerLocations.d.ts +1 -1
  38. package/build/features/business/screens/Customers/CustomerLocations.js +2 -2
  39. package/build/features/business/screens/Customers/ExpectedCustomers.js +2 -2
  40. package/build/features/business/screens/Customers/ExpectedSalesRange.js +30 -12
  41. package/build/features/business/screens/Customers/validation.js +2 -2
  42. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +20 -12
  43. package/build/features/connect/screens/Individual/MobileNumber.js +11 -2
  44. package/build/features/connect/screens/Merchant/Merchant.js +9 -2
  45. package/build/features/connect/screens/Mobile/MobileNumber.js +11 -2
  46. package/build/features/featuresScreens.js +10 -0
  47. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +14 -2
  48. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.d.ts +5 -1
  49. package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +62 -9
  50. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.d.ts +3 -1
  51. package/build/features/individual/screens/AdditionalIndividualInfo/SourceOfIncome.js +5 -9
  52. package/build/features/individual/screens/AdditionalIndividualInfo/validation.d.ts +3 -6
  53. package/build/features/individual/screens/AdditionalIndividualInfo/validation.js +1 -11
  54. package/build/features/individual/screens/Success/Success.js +4 -1
  55. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +3 -0
  56. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +87 -0
  57. package/build/features/individual/screens/SuccessWithFlowButtons/index.d.ts +2 -0
  58. package/build/features/individual/screens/SuccessWithFlowButtons/index.js +2 -0
  59. package/build/features/password/screens/CreatePassword/CreatePassword.js +9 -10
  60. package/build/features/password/screens/Success/Success.js +6 -0
  61. package/build/features/shared/Button/FlowsButtons.d.ts +2 -0
  62. package/build/features/shared/Button/FlowsButtons.js +2 -2
  63. package/build/features/shared/Input/Input.d.ts +1 -1
  64. package/build/features/shared/Search/Search.d.ts +1 -1
  65. package/build/features/shared/Search/Search.js +2 -14
  66. package/build/utils/array.d.ts +1 -0
  67. package/build/utils/array.js +6 -0
  68. package/build/utils/string.d.ts +1 -0
  69. package/build/utils/string.js +7 -0
  70. package/package.json +1 -1
@@ -79,10 +79,9 @@ export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi
79
79
  });
80
80
  }); });
81
81
  export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
82
- var payload, data, leadResponse, number;
83
- var _a;
84
- return __generator(this, function (_b) {
85
- switch (_b.label) {
82
+ var payload, data, leadResponse;
83
+ return __generator(this, function (_a) {
84
+ switch (_a.label) {
86
85
  case 0:
87
86
  payload = {
88
87
  service_name: 'tap_email',
@@ -90,32 +89,28 @@ export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token
90
89
  };
91
90
  return [4, API.leadService.verifyLeadToken(payload)];
92
91
  case 1:
93
- data = (_b.sent()).data;
92
+ data = (_a.sent()).data;
94
93
  leadResponse = undefined;
95
- if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 4];
94
+ if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 3];
96
95
  return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
97
96
  case 2:
98
- leadResponse = _b.sent();
99
- number = (((_a = leadResponse.data.entity) === null || _a === void 0 ? void 0 : _a.license) || {}).number;
100
- return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id, licenseNumber: number }))];
101
- case 3:
102
- _b.sent();
97
+ leadResponse = _a.sent();
103
98
  if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH) {
104
99
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
105
100
  }
106
101
  if (data.step_name === 'business_info') {
107
102
  thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
108
103
  }
109
- _b.label = 4;
110
- case 4: return [2, { data: data, leadData: leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data, token: token }];
104
+ _a.label = 3;
105
+ case 3: return [2, { data: data, leadData: leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data, token: token }];
111
106
  }
112
107
  });
113
108
  }); });
114
109
  export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
115
110
  var _a, business, settings, isNID, responseBody, stepName, payload, data, steps, hasBusinessCompleted;
116
- var _b, _c, _d;
117
- return __generator(this, function (_e) {
118
- switch (_e.label) {
111
+ var _b, _c, _d, _e, _f;
112
+ return __generator(this, function (_g) {
113
+ switch (_g.label) {
119
114
  case 0:
120
115
  _a = thunkApi.getState(), business = _a.business, settings = _a.settings;
121
116
  isNID = business.data.otpData.isNID;
@@ -130,28 +125,34 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
130
125
  };
131
126
  return [4, API.leadService.verifyLeadOTP(payload)];
132
127
  case 1:
133
- data = (_e.sent()).data;
134
- if (!data.errors) {
135
- thunkApi.dispatch(updateStepName(stepName));
136
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
137
- steps = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.steps) || [];
138
- hasBusinessCompleted = Object.keys(steps).find(function (key) { return key === BUSINESS_STEP_NAMES.BUSINESS_SUCCESS; });
139
- if (isNID) {
140
- thunkApi.dispatch(handleNextScreenStep());
128
+ data = (_g.sent()).data;
129
+ if (!!data.errors) return [3, 4];
130
+ thunkApi.dispatch(updateStepName(stepName));
131
+ return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
132
+ case 2:
133
+ _g.sent();
134
+ return [4, thunkApi.dispatch(retrieveEntityInfo((_d = (_c = business.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.entity) === null || _d === void 0 ? void 0 : _d.id))];
135
+ case 3:
136
+ _g.sent();
137
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
138
+ steps = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.steps) || [];
139
+ hasBusinessCompleted = Object.keys(steps).find(function (key) { return key === BUSINESS_STEP_NAMES.BUSINESS_SUCCESS; });
140
+ if (isNID) {
141
+ thunkApi.dispatch(handleNextScreenStep());
142
+ }
143
+ else {
144
+ if (hasBusinessCompleted) {
145
+ thunkApi.dispatch(handleCurrentActiveScreen('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
146
+ }
147
+ else if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH) {
148
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
141
149
  }
142
150
  else {
143
- if (hasBusinessCompleted) {
144
- thunkApi.dispatch(handleCurrentActiveScreen('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
145
- }
146
- else if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH) {
147
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
148
- }
149
- else {
150
- thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
151
- }
151
+ thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
152
152
  }
153
153
  }
154
- return [2, { data: data, formData: __assign(__assign({}, params), { isNID: isNID }) }];
154
+ _g.label = 4;
155
+ case 4: return [2, { data: data, formData: __assign(__assign({}, params), { isNID: isNID }) }];
155
156
  }
156
157
  });
157
158
  }); });
@@ -188,14 +189,25 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
188
189
  }
189
190
  });
190
191
  }); });
191
- export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
192
+ export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function (params) { return __awaiter(void 0, void 0, void 0, function () {
192
193
  var data;
193
194
  return __generator(this, function (_a) {
194
195
  switch (_a.label) {
195
196
  case 0: return [4, API.leadService.retrieveEntityList(params.leadId)];
196
197
  case 1:
197
198
  data = (_a.sent()).data;
198
- return [2, { data: data, licenseNumber: params.licenseNumber }];
199
+ return [2, data];
200
+ }
201
+ });
202
+ }); });
203
+ export var retrieveEntityInfo = createAsyncThunk('retrieveEntityInfo', function (entityID) { return __awaiter(void 0, void 0, void 0, function () {
204
+ var data;
205
+ return __generator(this, function (_a) {
206
+ switch (_a.label) {
207
+ case 0: return [4, API.entityService.retrieveEntityInfo(entityID)];
208
+ case 1:
209
+ data = (_a.sent()).data;
210
+ return [2, { data: data }];
199
211
  }
200
212
  });
201
213
  }); });
@@ -267,8 +279,8 @@ export var updateActivitiesInfo = createAsyncThunk('updateActivitiesInfo', funct
267
279
  case 0:
268
280
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
269
281
  channel = params.salesChannels.map(function (_a) {
270
- var value = _a.value;
271
- return value;
282
+ var id = _a.id;
283
+ return id;
272
284
  });
273
285
  activities = (_b = (params.activities || [])) === null || _b === void 0 ? void 0 : _b.map(function (_a) {
274
286
  var en = _a.en;
@@ -326,8 +338,8 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
326
338
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
327
339
  id = (_b = business.data.businessTypeData.responseBody) === null || _b === void 0 ? void 0 : _b.entity_id;
328
340
  customerBase = params.customerLocations.map(function (_a) {
329
- var title = _a.title;
330
- return title;
341
+ var id = _a.id;
342
+ return id;
331
343
  });
332
344
  stepName = BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS;
333
345
  requestBody = {
@@ -353,9 +365,9 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
353
365
  }); });
354
366
  export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
355
367
  var _a, settings, business, _b, steps, id, flowCompleted, payload, data;
356
- var _c, _d, _e, _f;
357
- return __generator(this, function (_g) {
358
- switch (_g.label) {
368
+ var _c, _d, _e, _f, _g;
369
+ return __generator(this, function (_h) {
370
+ switch (_h.label) {
359
371
  case 0:
360
372
  _a = thunkApi.getState(), settings = _a.settings, business = _a.business;
361
373
  _b = business.data.verify.responseBody || {}, steps = _b.steps, id = _b.id;
@@ -387,9 +399,12 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
387
399
  };
388
400
  return [4, API.leadService.updateLead(payload)];
389
401
  case 1:
390
- data = (_g.sent()).data;
402
+ data = (_h.sent()).data;
391
403
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
392
404
  (_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
405
+ return [4, thunkApi.dispatch(retrieveEntityInfo((_g = data === null || data === void 0 ? void 0 : data.entity) === null || _g === void 0 ? void 0 : _g.id))];
406
+ case 2:
407
+ _h.sent();
393
408
  return [2, { response: data, formData: params }];
394
409
  }
395
410
  });
@@ -556,13 +571,13 @@ export var businessSlice = createSlice({
556
571
  })
557
572
  .addCase(retrieveEntityList.pending, function (state) {
558
573
  state.error = null;
559
- state.customLoading = true;
574
+ state.loading = true;
560
575
  })
561
576
  .addCase(retrieveEntityList.fulfilled, function (state, action) {
562
- var _a, _b, _c, _d, _e;
577
+ var _a, _b, _c, _d, _e, _f, _g;
563
578
  state.error = null;
564
- state.customLoading = false;
565
- var _f = action.payload, data = _f.data, licenseNumber = _f.licenseNumber;
579
+ state.loading = false;
580
+ var data = action.payload;
566
581
  var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
567
582
  var licenseList = [];
568
583
  if (!description) {
@@ -581,18 +596,39 @@ export var businessSlice = createSlice({
581
596
  }
582
597
  licenseList = __spreadArray(__spreadArray([], licenseList, true), [OTHER_CR_LICENSE, OTHER_FL_LICENSE], false);
583
598
  state.data.businessTypeData.responseBody = { licenseList: licenseList };
584
- var selectedLicense = (_b = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _b === void 0 ? void 0 : _b.call(licenseList, function (_a) {
599
+ var licenseNumber = (((_c = (_b = state.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.license) || {}).number;
600
+ var selectedLicense = ((_d = licenseList === null || licenseList === void 0 ? void 0 : licenseList.find) === null || _d === void 0 ? void 0 : _d.call(licenseList, function (_a) {
585
601
  var license = _a.license;
586
602
  return (license === null || license === void 0 ? void 0 : license.number) === licenseNumber;
587
- });
588
- state.data.businessTypeData.selectedLicense = selectedLicense || (licenseList === null || licenseList === void 0 ? void 0 : licenseList[0]);
589
- var isOtherLicense = ((_c = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _c === void 0 ? void 0 : _c.number) === 'other_fl' || ((_d = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _d === void 0 ? void 0 : _d.number) === 'other_cr';
603
+ })) || (licenseList === null || licenseList === void 0 ? void 0 : licenseList[0]);
604
+ state.data.businessTypeData.selectedLicense = selectedLicense;
605
+ var isOtherLicense = ((_e = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _e === void 0 ? void 0 : _e.number) === 'other_fl' || ((_f = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _f === void 0 ? void 0 : _f.number) === 'other_cr';
590
606
  if (!isOtherLicense)
591
- state.data.businessTypeData.licenseNumber = ((_e = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _e === void 0 ? void 0 : _e.number) || '';
607
+ state.data.businessTypeData.licenseNumber = ((_g = selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.license) === null || _g === void 0 ? void 0 : _g.number) || '';
592
608
  })
593
609
  .addCase(retrieveEntityList.rejected, function (state, action) {
594
610
  state.error = action.error.message;
595
- state.customLoading = false;
611
+ state.loading = false;
612
+ })
613
+ .addCase(retrieveEntityInfo.pending, function (state) {
614
+ state.error = null;
615
+ state.loading = true;
616
+ })
617
+ .addCase(retrieveEntityInfo.fulfilled, function (state, action) {
618
+ var _a;
619
+ state.error = null;
620
+ state.loading = false;
621
+ var data = (action.payload || {}).data;
622
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
623
+ if (description) {
624
+ state.error = description;
625
+ return;
626
+ }
627
+ state.data.verify.responseBody = __assign(__assign({}, data), state.data.verify.responseBody);
628
+ })
629
+ .addCase(retrieveEntityInfo.rejected, function (state, action) {
630
+ state.error = action.error.message;
631
+ state.loading = false;
596
632
  })
597
633
  .addCase(updateLeadBusinessType.pending, function (state) {
598
634
  state.loading = true;
@@ -40,6 +40,7 @@ export declare const retrieveLead: import("@reduxjs/toolkit").AsyncThunk<{
40
40
  }, {}>;
41
41
  export declare const createLead: import("@reduxjs/toolkit").AsyncThunk<{
42
42
  response: any;
43
+ brandResponse: any;
43
44
  formData: {
44
45
  individualId: string;
45
46
  stepName: string;
@@ -58,7 +58,7 @@ var _a;
58
58
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
59
59
  import { handleNextScreenStep } from '../../../app/settings';
60
60
  import API from '../../../api';
61
- import { BRAND_LIST, CONNECT_STEP_NAMES, IDENTIFICATION_TYPE, INSTAGRAM_URL, OTHER_BRAND, TWITTER_URL } from '../../../constants';
61
+ import { CONNECT_STEP_NAMES, IDENTIFICATION_TYPE, INSTAGRAM_URL, OTHER_BRAND, TWITTER_URL } from '../../../constants';
62
62
  import { defaultCountry } from '../../../constants';
63
63
  import { getIndividualName, getFlowUrl, capitalizeTheFirstLetterOfEachWord, removeRequestHeaders } from '../../../utils';
64
64
  export var getCountries = createAsyncThunk('getCountries', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
@@ -199,9 +199,9 @@ export var retrieveLead = createAsyncThunk('retrieveLead', function (params, thu
199
199
  });
200
200
  }); });
201
201
  export var createLead = createAsyncThunk('createLead', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
202
- var connect, businessCountry, payload, data;
203
- return __generator(this, function (_a) {
204
- switch (_a.label) {
202
+ var connect, businessCountry, payload, brandPayload, _a, brandResponse, data;
203
+ return __generator(this, function (_b) {
204
+ switch (_b.label) {
205
205
  case 0:
206
206
  connect = thunkApi.getState().connect;
207
207
  businessCountry = connect.data.businessCountry;
@@ -209,11 +209,17 @@ export var createLead = createAsyncThunk('createLead', function (params, thunkAp
209
209
  individual_id: params.individualId,
210
210
  country_code: businessCountry.iso2
211
211
  };
212
- return [4, API.leadService.createLead(payload)];
212
+ brandPayload = {
213
+ individual_id: params.individualId
214
+ };
215
+ return [4, Promise.all([
216
+ API.individualService.getBrandList(brandPayload),
217
+ API.leadService.createLead(payload)
218
+ ])];
213
219
  case 1:
214
- data = (_a.sent()).data;
220
+ _a = _b.sent(), brandResponse = _a[0].data, data = _a[1].data;
215
221
  thunkApi.dispatch(handleNextScreenStep(params.stepName));
216
- return [2, { response: data, formData: params }];
222
+ return [2, { response: data, brandResponse: brandResponse, formData: params }];
217
223
  }
218
224
  });
219
225
  }); });
@@ -558,11 +564,14 @@ export var connectSlice = createSlice({
558
564
  var _a;
559
565
  state.loading = false;
560
566
  state.error = null;
561
- var response = action.payload.response;
567
+ var _b = action.payload, response = _b.response, brandResponse = _b.brandResponse;
562
568
  var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
563
569
  if (!!response && !description) {
564
- state.data.brandData.selectedBrandItem = BRAND_LIST[0];
565
- state.data.brandData.responseBody = __assign({ brands: __spreadArray(__spreadArray([], BRAND_LIST, true), [OTHER_BRAND], false) }, response);
570
+ var brandList = Array.isArray(brandResponse === null || brandResponse === void 0 ? void 0 : brandResponse.brands) ? brandResponse === null || brandResponse === void 0 ? void 0 : brandResponse.brands : [];
571
+ state.data.brandData.responseBody = __assign({ brands: __spreadArray(__spreadArray([], brandList, true), [OTHER_BRAND], false) }, response);
572
+ var brand = brandList === null || brandList === void 0 ? void 0 : brandList[0];
573
+ if (!!brand)
574
+ state.data.brandData.selectedBrandItem = brand;
566
575
  }
567
576
  })
568
577
  .addCase(createLead.pending, function (state) {
@@ -9,7 +9,13 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
9
9
  leadData: any;
10
10
  token: string;
11
11
  }, string, {}>;
12
- export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
12
+ export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<{
13
+ sourceIncome: any;
14
+ monthlyIncome: any;
15
+ }, void, {}>;
16
+ export declare const retrieveEntityInfo: import("@reduxjs/toolkit").AsyncThunk<{
17
+ data: any;
18
+ }, string, {}>;
13
19
  export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
14
20
  data: any;
15
21
  formData: {
@@ -92,22 +92,43 @@ export var verifyLeadToken = createAsyncThunk('verifyLeadToken', function (token
92
92
  }
93
93
  });
94
94
  }); });
95
- export var retrieveDataList = createAsyncThunk('retrieveDataList', function () { return __awaiter(void 0, void 0, void 0, function () {
96
- var sourceIncome;
95
+ export var retrieveDataList = createAsyncThunk('retrieveDataList', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
96
+ var individual, code, _a, sourceIncome, monthlyIncome;
97
+ var _b, _c;
98
+ return __generator(this, function (_d) {
99
+ switch (_d.label) {
100
+ case 0:
101
+ individual = thunkApi.getState().individual;
102
+ code = (_c = (_b = individual.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.country;
103
+ return [4, Promise.all([
104
+ API.dataService.getSourceOfIncome(),
105
+ API.dataService.getMonthlyIncome(code)
106
+ ])];
107
+ case 1:
108
+ _a = _d.sent(), sourceIncome = _a[0].data, monthlyIncome = _a[1].data;
109
+ return [2, {
110
+ sourceIncome: sourceIncome,
111
+ monthlyIncome: monthlyIncome
112
+ }];
113
+ }
114
+ });
115
+ }); });
116
+ export var retrieveEntityInfo = createAsyncThunk('retrieveIndividualEntityInfo', function (entityID) { return __awaiter(void 0, void 0, void 0, function () {
117
+ var data;
97
118
  return __generator(this, function (_a) {
98
119
  switch (_a.label) {
99
- case 0: return [4, API.dataService.getSourceOfIncome()];
120
+ case 0: return [4, API.entityService.retrieveEntityInfo(entityID)];
100
121
  case 1:
101
- sourceIncome = (_a.sent()).data;
102
- return [2, sourceIncome];
122
+ data = (_a.sent()).data;
123
+ return [2, { data: data }];
103
124
  }
104
125
  });
105
126
  }); });
106
127
  export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
107
128
  var _a, individual, settings, responseBody, payload, data, steps, hasIndividualCompleted;
108
- var _b, _c, _d, _e;
109
- return __generator(this, function (_f) {
110
- switch (_f.label) {
129
+ var _b, _c, _d, _e, _f, _g;
130
+ return __generator(this, function (_h) {
131
+ switch (_h.label) {
111
132
  case 0:
112
133
  _a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
113
134
  responseBody = individual.data.verify.responseBody;
@@ -120,28 +141,31 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
120
141
  };
121
142
  return [4, API.leadService.verifyLeadOTP(payload)];
122
143
  case 1:
123
- data = (_f.sent()).data;
124
- if (!!data.errors) return [3, 4];
125
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
126
- steps = (_e = individual.data.verify.responseBody) === null || _e === void 0 ? void 0 : _e.steps;
144
+ data = (_h.sent()).data;
145
+ return [4, thunkApi.dispatch(retrieveEntityInfo((_d = (_c = individual.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.entity) === null || _d === void 0 ? void 0 : _d.id))];
146
+ case 2:
147
+ _h.sent();
148
+ if (!!data.errors) return [3, 5];
149
+ (_f = (_e = settings.data.appConfig).onStepCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, settings.data.activeScreen.name, { otp: params.otp });
150
+ steps = (_g = individual.data.verify.responseBody) === null || _g === void 0 ? void 0 : _g.steps;
127
151
  hasIndividualCompleted = Object.keys(steps).find(function (key) { return key === INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS; });
128
- if (!hasIndividualCompleted) return [3, 2];
129
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_STEP'));
130
- return [3, 4];
131
- case 2: return [4, thunkApi.dispatch(retrieveDataList())];
132
- case 3:
133
- _f.sent();
152
+ if (!hasIndividualCompleted) return [3, 3];
153
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
154
+ return [3, 5];
155
+ case 3: return [4, thunkApi.dispatch(retrieveDataList())];
156
+ case 4:
157
+ _h.sent();
134
158
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
135
- _f.label = 4;
136
- case 4: return [2, { data: data, formData: __assign({}, params) }];
159
+ _h.label = 5;
160
+ case 5: return [2, { data: data, formData: __assign({}, params) }];
137
161
  }
138
162
  });
139
163
  }); });
140
164
  export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
141
165
  var _a, settings, individual, requestBody, data;
142
- var _b, _c, _d, _e, _f, _g;
143
- return __generator(this, function (_h) {
144
- switch (_h.label) {
166
+ var _b, _c, _d, _e, _f, _g, _h;
167
+ return __generator(this, function (_j) {
168
+ switch (_j.label) {
145
169
  case 0:
146
170
  _a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
147
171
  requestBody = {
@@ -149,7 +173,7 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
149
173
  employer_name: params.employerName,
150
174
  employer_city: (_d = params.employerLocation) === null || _d === void 0 ? void 0 : _d.iso2,
151
175
  source_income: [(_e = params.sourceIncome) === null || _e === void 0 ? void 0 : _e.id],
152
- actual_income: params.monthlyIncome,
176
+ actual_income: (_f = params.monthlyIncome) === null || _f === void 0 ? void 0 : _f.id,
153
177
  is_relative_PEP: params.isPEP,
154
178
  is_influencer: params.isInfluencer,
155
179
  encryption_contract: ['employer_name', 'employer_city', 'actual_income', 'is_relative_PEP', 'is_influencer'],
@@ -157,10 +181,10 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
157
181
  };
158
182
  return [4, API.entityService.updateEntityInfo(requestBody)];
159
183
  case 1:
160
- data = (_h.sent()).data;
184
+ data = (_j.sent()).data;
161
185
  if (!data.errors) {
162
186
  thunkApi.dispatch(handleNextScreenStep());
163
- (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, requestBody);
187
+ (_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, requestBody);
164
188
  }
165
189
  return [2, { data: data, formData: params }];
166
190
  }
@@ -186,7 +210,9 @@ export var updateLeadSuccess = createAsyncThunk('updateLeadSuccess', function (p
186
210
  (_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, params);
187
211
  (_g = (_f = settings.data.appConfig).onFlowCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, { data: response === null || response === void 0 ? void 0 : response.data });
188
212
  _h.label = 2;
189
- case 2: return [2, { response: response === null || response === void 0 ? void 0 : response.data, formData: params }];
213
+ case 2:
214
+ thunkApi.dispatch(handleNextScreenStep());
215
+ return [2, { response: response === null || response === void 0 ? void 0 : response.data, formData: params }];
190
216
  }
191
217
  });
192
218
  }); });
@@ -204,7 +230,7 @@ var initialState = {
204
230
  },
205
231
  individualData: {
206
232
  sourceIncome: undefined,
207
- monthlyIncome: '',
233
+ monthlyIncome: undefined,
208
234
  employerName: '',
209
235
  employerLocation: undefined,
210
236
  isPEP: null,
@@ -295,12 +321,15 @@ export var individualSlice = createSlice({
295
321
  var _a, _b;
296
322
  state.loading = false;
297
323
  state.error = null;
298
- var sourceIncome = action.payload;
324
+ var _c = action.payload, sourceIncome = _c.sourceIncome, monthlyIncome = _c.monthlyIncome;
299
325
  var data = state.data.individualData.responseBody;
300
- state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: sourceIncome || [] });
326
+ state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: sourceIncome || [], monthlyIncomeList: monthlyIncome || [] });
301
327
  var selectedSourceIncome = sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome[0];
302
328
  if (!!selectedSourceIncome)
303
329
  state.data.individualData.sourceIncome = selectedSourceIncome;
330
+ var selectedMonthlyIncome = monthlyIncome === null || monthlyIncome === void 0 ? void 0 : monthlyIncome[0];
331
+ if (!!selectedMonthlyIncome)
332
+ state.data.individualData.monthlyIncome = selectedMonthlyIncome;
304
333
  var location = (_b = (_a = state.data.verify.responseBody) === null || _a === void 0 ? void 0 : _a.entity) === null || _b === void 0 ? void 0 : _b.country;
305
334
  if (!!location) {
306
335
  state.data.individualData.employerLocation = state.data.countries.find(function (country) { return country.iso2 === location; });
@@ -330,6 +359,26 @@ export var individualSlice = createSlice({
330
359
  .addCase(updateIndividualInfo.rejected, function (state, action) {
331
360
  state.loading = false;
332
361
  state.error = action.error.message;
362
+ })
363
+ .addCase(retrieveEntityInfo.pending, function (state) {
364
+ state.error = null;
365
+ state.loading = true;
366
+ })
367
+ .addCase(retrieveEntityInfo.fulfilled, function (state, action) {
368
+ var _a;
369
+ state.error = null;
370
+ state.loading = false;
371
+ var data = (action.payload || {}).data;
372
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
373
+ if (description) {
374
+ state.error = description;
375
+ return;
376
+ }
377
+ state.data.verify.responseBody = __assign(__assign({}, data), state.data.verify.responseBody);
378
+ })
379
+ .addCase(retrieveEntityInfo.rejected, function (state, action) {
380
+ state.error = action.error.message;
381
+ state.loading = false;
333
382
  })
334
383
  .addCase(updateLeadSuccess.fulfilled, function (state, action) {
335
384
  var _a;
@@ -11,6 +11,10 @@ export declare const verifyPasswordLeadOTP: import("@reduxjs/toolkit").AsyncThun
11
11
  otp: string;
12
12
  };
13
13
  }, OTPFormValues, {}>;
14
+ export declare const createPassword: import("@reduxjs/toolkit").AsyncThunk<{
15
+ data: any;
16
+ formData: PasswordCreateFormValues;
17
+ }, PasswordCreateFormValues, {}>;
14
18
  export declare const updateLeadSuccess: import("@reduxjs/toolkit").AsyncThunk<{
15
19
  response: any;
16
20
  formData: void;