@tap-payments/auth-jsconnect 2.0.7 → 2.0.9

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 (84) hide show
  1. package/build/@types/form.d.ts +4 -0
  2. package/build/@types/redux.d.ts +0 -1
  3. package/build/api/entity.d.ts +4 -3
  4. package/build/api/entity.js +8 -1
  5. package/build/api/index.d.ts +2 -0
  6. package/build/api/individual.d.ts +1 -0
  7. package/build/api/individual.js +9 -2
  8. package/build/app/rootReducer.d.ts +1 -0
  9. package/build/app/rootReducer.js +3 -1
  10. package/build/app/store.d.ts +2 -0
  11. package/build/assets/locales/ar.json +2 -1
  12. package/build/assets/locales/en.json +2 -1
  13. package/build/components/FileInput/DragAndDrop.js +1 -2
  14. package/build/constants/app.d.ts +9 -0
  15. package/build/constants/app.js +36 -0
  16. package/build/constants/validation.d.ts +2 -0
  17. package/build/constants/validation.js +2 -0
  18. package/build/features/app/bank/bankStore.d.ts +1 -1
  19. package/build/features/app/bank/bankStore.js +23 -42
  20. package/build/features/app/business/businessStore.d.ts +5 -3
  21. package/build/features/app/business/businessStore.js +55 -31
  22. package/build/features/app/connect/connectStore.d.ts +2 -1
  23. package/build/features/app/connect/connectStore.js +78 -47
  24. package/build/features/app/individual/individualStore.d.ts +9 -2
  25. package/build/features/app/individual/individualStore.js +80 -41
  26. package/build/features/app/password/passwordStore.d.ts +1 -0
  27. package/build/features/app/password/passwordStore.js +3 -7
  28. package/build/features/app/signIn/signInStore.d.ts +33 -0
  29. package/build/features/app/signIn/signInStore.js +389 -0
  30. package/build/features/app/tax/taxStore.d.ts +1 -0
  31. package/build/features/bank/screens/BankDetails/BankStatement.js +6 -17
  32. package/build/features/bank/screens/BankDetails/validation.d.ts +3 -0
  33. package/build/features/bank/screens/BankDetails/validation.js +11 -1
  34. package/build/features/business/screens/Activities/ActivitiesList.d.ts +1 -1
  35. package/build/features/business/screens/Customers/CustomerLocations.d.ts +2 -2
  36. package/build/features/connect/screens/Merchant/Merchant.js +3 -2
  37. package/build/features/connect/screens/Merchant/validation.js +1 -1
  38. package/build/features/featuresScreens.d.ts +1 -0
  39. package/build/features/featuresScreens.js +22 -0
  40. package/build/features/individual/screens/AdditionalIndividualInfo/AdditionalIndividualInfo.js +19 -5
  41. package/build/features/shared/UploadFile/UploadFile.d.ts +2 -2
  42. package/build/features/shared/UploadFile/UploadFile.js +13 -13
  43. package/build/features/signIn/SignIn.d.ts +7 -0
  44. package/build/features/signIn/SignIn.js +49 -0
  45. package/build/features/signIn/index.d.ts +1 -0
  46. package/build/features/signIn/index.js +1 -0
  47. package/build/features/signIn/screens/Email/Email.d.ts +5 -0
  48. package/build/features/signIn/screens/Email/Email.js +95 -0
  49. package/build/features/signIn/screens/Email/EmailField.d.ts +5 -0
  50. package/build/features/signIn/screens/Email/EmailField.js +55 -0
  51. package/build/features/signIn/screens/Email/index.d.ts +3 -0
  52. package/build/features/signIn/screens/Email/index.js +2 -0
  53. package/build/features/signIn/screens/Email/validation.d.ts +8 -0
  54. package/build/features/signIn/screens/Email/validation.js +5 -0
  55. package/build/features/signIn/screens/Mobile/Mobile.d.ts +5 -0
  56. package/build/features/signIn/screens/Mobile/Mobile.js +106 -0
  57. package/build/features/signIn/screens/Mobile/MobileNumber.d.ts +11 -0
  58. package/build/features/signIn/screens/Mobile/MobileNumber.js +151 -0
  59. package/build/features/signIn/screens/Mobile/index.d.ts +3 -0
  60. package/build/features/signIn/screens/Mobile/index.js +2 -0
  61. package/build/features/signIn/screens/Mobile/validation.d.ts +8 -0
  62. package/build/features/signIn/screens/Mobile/validation.js +28 -0
  63. package/build/features/signIn/screens/OTP/OTP.d.ts +5 -0
  64. package/build/features/signIn/screens/OTP/OTP.js +80 -0
  65. package/build/features/signIn/screens/OTP/OTPInput.d.ts +5 -0
  66. package/build/features/signIn/screens/OTP/OTPInput.js +53 -0
  67. package/build/features/signIn/screens/OTP/index.d.ts +3 -0
  68. package/build/features/signIn/screens/OTP/index.js +2 -0
  69. package/build/features/signIn/screens/OTP/validation.d.ts +8 -0
  70. package/build/features/signIn/screens/OTP/validation.js +4 -0
  71. package/build/features/signIn/screens/Password/Password.d.ts +5 -0
  72. package/build/features/signIn/screens/Password/Password.js +54 -0
  73. package/build/features/signIn/screens/Password/PasswordInput.d.ts +5 -0
  74. package/build/features/signIn/screens/Password/PasswordInput.js +28 -0
  75. package/build/features/signIn/screens/Password/index.d.ts +3 -0
  76. package/build/features/signIn/screens/Password/index.js +2 -0
  77. package/build/features/signIn/screens/Password/validation.d.ts +8 -0
  78. package/build/features/signIn/screens/Password/validation.js +4 -0
  79. package/build/hooks/useAppDispatch.d.ts +1 -0
  80. package/build/index.d.ts +3 -2
  81. package/build/index.js +5 -2
  82. package/build/utils/string.d.ts +1 -0
  83. package/build/utils/string.js +4 -0
  84. package/package.json +1 -1
@@ -207,24 +207,30 @@ export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkAp
207
207
  return [4, API.authService.verifyAuth(payload)];
208
208
  case 1:
209
209
  data = (_e.sent()).data;
210
- if (!data.errors) {
211
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
212
- if (responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) {
213
- params_1 = {
214
- leadId: data === null || data === void 0 ? void 0 : data.lead_id,
215
- stepName: 'CONNECT_INDIVIDUAL_STEP'
216
- };
217
- thunkApi.dispatch(retrieveLead(params_1));
218
- }
219
- else {
220
- params_2 = {
221
- individualId: data === null || data === void 0 ? void 0 : data.individual_id,
222
- stepName: 'CONNECT_MERCHANT_INFO_STEP'
223
- };
224
- thunkApi.dispatch(createLead(params_2));
225
- }
210
+ if (!!data.errors) return [3, 4];
211
+ (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
212
+ if (!(responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user)) return [3, 2];
213
+ params_1 = {
214
+ leadId: data === null || data === void 0 ? void 0 : data.lead_id,
215
+ stepName: 'CONNECT_INDIVIDUAL_STEP'
216
+ };
217
+ thunkApi.dispatch(retrieveLead(params_1));
218
+ return [3, 4];
219
+ case 2: return [4, thunkApi.dispatch(retrieveBrandList(data === null || data === void 0 ? void 0 : data.individual_id))];
220
+ case 3:
221
+ _e.sent();
222
+ if (!(data === null || data === void 0 ? void 0 : data.lead_id)) {
223
+ params_2 = {
224
+ individualId: data === null || data === void 0 ? void 0 : data.individual_id,
225
+ stepName: 'CONNECT_MERCHANT_INFO_STEP'
226
+ };
227
+ thunkApi.dispatch(createLead(params_2));
226
228
  }
227
- return [2, { response: data, formData: params }];
229
+ else {
230
+ thunkApi.dispatch(handleNextScreenStep('CONNECT_MERCHANT_INFO_STEP'));
231
+ }
232
+ _e.label = 4;
233
+ case 4: return [2, { response: data, formData: params }];
228
234
  }
229
235
  });
230
236
  }); });
@@ -241,9 +247,9 @@ export var retrieveLead = createAsyncThunk('retrieveLead', function (params, thu
241
247
  });
242
248
  }); });
243
249
  export var createLead = createAsyncThunk('createLead', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
244
- var settings, businessCountry, payload, brandPayload, _a, brandResponse, data;
245
- return __generator(this, function (_b) {
246
- switch (_b.label) {
250
+ var settings, businessCountry, payload, data;
251
+ return __generator(this, function (_a) {
252
+ switch (_a.label) {
247
253
  case 0:
248
254
  settings = thunkApi.getState().settings;
249
255
  businessCountry = settings.data.businessCountry;
@@ -251,19 +257,28 @@ export var createLead = createAsyncThunk('createLead', function (params, thunkAp
251
257
  individual_id: params.individualId,
252
258
  country_code: businessCountry.iso2
253
259
  };
254
- brandPayload = {
255
- individual_id: params.individualId
256
- };
257
- return [4, Promise.all([
258
- API.individualService.getBrandList(brandPayload),
259
- API.leadService.createLead(payload)
260
- ])];
260
+ return [4, API.leadService.createLead(payload)];
261
261
  case 1:
262
- _a = _b.sent(), brandResponse = _a[0].data, data = _a[1].data;
262
+ data = (_a.sent()).data;
263
263
  if (!data.errors) {
264
264
  thunkApi.dispatch(handleNextScreenStep(params.stepName));
265
265
  }
266
- return [2, { response: data, brandResponse: brandResponse, formData: params }];
266
+ return [2, { response: data, formData: params }];
267
+ }
268
+ });
269
+ }); });
270
+ export var retrieveBrandList = createAsyncThunk('retrieveBrandList', function (individualId) { return __awaiter(void 0, void 0, void 0, function () {
271
+ var brandPayload, data;
272
+ return __generator(this, function (_a) {
273
+ switch (_a.label) {
274
+ case 0:
275
+ brandPayload = {
276
+ individual_id: individualId
277
+ };
278
+ return [4, API.individualService.getBrandList(brandPayload)];
279
+ case 1:
280
+ data = (_a.sent()).data;
281
+ return [2, data];
267
282
  }
268
283
  });
269
284
  }); });
@@ -310,9 +325,9 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
310
325
  }); });
311
326
  export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
312
327
  var _a, settings, connect, instagram, twitter, _b, mobileData, nidData, otpData, brandData, isAbsher, responseBody, isExistingUser, isOther, brand, payload, data;
313
- var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
314
- return __generator(this, function (_p) {
315
- switch (_p.label) {
328
+ var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
329
+ return __generator(this, function (_q) {
330
+ switch (_q.label) {
316
331
  case 0:
317
332
  _a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
318
333
  instagram = !!((_c = params.links) === null || _c === void 0 ? void 0 : _c.instagram) ? "".concat(INSTAGRAM_URL, "/").concat((_d = params.links) === null || _d === void 0 ? void 0 : _d.instagram) : '';
@@ -321,20 +336,20 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
321
336
  isAbsher = otpData.isAbsher;
322
337
  responseBody = (isAbsher ? nidData : mobileData).responseBody;
323
338
  isExistingUser = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) === false;
324
- isOther = ((_g = params.selectedBrandItem) === null || _g === void 0 ? void 0 : _g.id) === 'other';
339
+ isOther = !!((_g = params.selectedBrandItem) === null || _g === void 0 ? void 0 : _g.id) ? ((_h = params.selectedBrandItem) === null || _h === void 0 ? void 0 : _h.id) === 'other' : true;
325
340
  brand = __assign({ name: {
326
341
  en: params.brandName,
327
342
  ar: params.brandName,
328
343
  zh: params.brandName
329
- }, website: (_h = params.links) === null || _h === void 0 ? void 0 : _h.website, social: [twitter, instagram] }, (isExistingUser &&
344
+ }, website: (_j = params.links) === null || _j === void 0 ? void 0 : _j.website, social: [twitter, instagram] }, (isExistingUser &&
330
345
  !isOther && {
331
- id: (_j = params.selectedBrandItem) === null || _j === void 0 ? void 0 : _j.id,
346
+ id: (_k = params.selectedBrandItem) === null || _k === void 0 ? void 0 : _k.id,
332
347
  name: undefined
333
348
  }));
334
349
  payload = {
335
350
  brand: brand,
336
- id: (isExistingUser ? (_k = brandData.responseBody) === null || _k === void 0 ? void 0 : _k.lead_id : (_l = otpData.responseBody) === null || _l === void 0 ? void 0 : _l.lead_id) || '',
337
- terms_conditions_accepted: params.termAndConditionChecked,
351
+ id: (isExistingUser ? (_l = brandData.responseBody) === null || _l === void 0 ? void 0 : _l.lead_id : (_m = otpData.responseBody) === null || _m === void 0 ? void 0 : _m.lead_id) || '',
352
+ terms_conditions_accepted: isExistingUser && !isOther ? undefined : params.termAndConditionChecked,
338
353
  step_name: CONNECT_STEP_NAMES.UPDATE_LEAD_MERCHANT,
339
354
  encryption_contract: [
340
355
  'brand.name.en',
@@ -347,10 +362,10 @@ export var updateLeadBrand = createAsyncThunk('updateLeadBrand', function (param
347
362
  };
348
363
  return [4, API.leadService.updateLead(payload)];
349
364
  case 1:
350
- data = (_p.sent()).data;
365
+ data = (_q.sent()).data;
351
366
  if (!data.errors) {
352
367
  thunkApi.dispatch(handleNextScreenStep());
353
- (_o = (_m = settings.data.appConfig).onStepCompleted) === null || _o === void 0 ? void 0 : _o.call(_m, settings.data.activeScreen.name, params);
368
+ (_p = (_o = settings.data.appConfig).onStepCompleted) === null || _p === void 0 ? void 0 : _p.call(_o, settings.data.activeScreen.name, params);
354
369
  }
355
370
  return [2, { response: data, formData: params }];
356
371
  }
@@ -590,6 +605,7 @@ export var connectSlice = createSlice({
590
605
  }
591
606
  state.data.otpData.responseBody = response;
592
607
  state.data.otpData.otp = formData.otp;
608
+ state.data.brandData.responseBody = __assign(__assign({}, state.data.brandData.responseBody), response);
593
609
  })
594
610
  .addCase(verifyAuth.pending, function (state) {
595
611
  state.loading = true;
@@ -629,30 +645,45 @@ export var connectSlice = createSlice({
629
645
  state.error = action.error.message;
630
646
  })
631
647
  .addCase(createLead.fulfilled, function (state, action) {
632
- var _a, _b;
648
+ var _a;
633
649
  state.loading = false;
634
650
  state.error = null;
635
- var _c = action.payload, response = _c.response, brandResponse = _c.brandResponse;
651
+ var response = action.payload.response;
636
652
  var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
637
- var brandError = (((_b = brandResponse === null || brandResponse === void 0 ? void 0 : brandResponse.errors) === null || _b === void 0 ? void 0 : _b[0]) || {}).description;
638
653
  if (description) {
639
654
  state.error = description;
640
655
  return;
641
656
  }
657
+ state.data.brandData.responseBody = __assign(__assign({}, state.data.brandData.responseBody), response);
658
+ })
659
+ .addCase(createLead.pending, function (state) {
660
+ state.loading = true;
661
+ state.error = null;
662
+ })
663
+ .addCase(createLead.rejected, function (state, action) {
664
+ state.loading = false;
665
+ state.error = action.error.message;
666
+ })
667
+ .addCase(retrieveBrandList.fulfilled, function (state, action) {
668
+ var _a;
669
+ state.loading = false;
670
+ state.error = null;
671
+ var response = action.payload;
672
+ var description = (((_a = response === null || response === void 0 ? void 0 : response.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
642
673
  var brandList = undefined;
643
- if (!brandError) {
644
- brandList = Array.isArray(brandResponse === null || brandResponse === void 0 ? void 0 : brandResponse.brands) ? __spreadArray(__spreadArray([], brandResponse === null || brandResponse === void 0 ? void 0 : brandResponse.brands, true), [OTHER_BRAND], false) : [];
674
+ if (!description) {
675
+ brandList = Array.isArray(response === null || response === void 0 ? void 0 : response.brands) ? __spreadArray(__spreadArray([], response === null || response === void 0 ? void 0 : response.brands, true), [OTHER_BRAND], false) : [];
645
676
  var brand = brandList === null || brandList === void 0 ? void 0 : brandList[0];
646
677
  if (!!brand)
647
678
  state.data.brandData.selectedBrandItem = brand;
648
679
  }
649
- state.data.brandData.responseBody = __assign({ brands: brandList || [] }, response);
680
+ state.data.brandData.responseBody = __assign(__assign({}, state.data.brandData.responseBody), { brands: brandList || [] });
650
681
  })
651
- .addCase(createLead.pending, function (state) {
682
+ .addCase(retrieveBrandList.pending, function (state) {
652
683
  state.loading = true;
653
684
  state.error = null;
654
685
  })
655
- .addCase(createLead.rejected, function (state, action) {
686
+ .addCase(retrieveBrandList.rejected, function (state, action) {
656
687
  state.loading = false;
657
688
  state.error = action.error.message;
658
689
  })
@@ -11,10 +11,16 @@ export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
11
11
  export declare const retrieveDataList: import("@reduxjs/toolkit").AsyncThunk<{
12
12
  sourceIncome: any;
13
13
  monthlyIncome: any;
14
- countryCode: string;
15
14
  occupation: any;
16
- countries: import("../../../@types").CountryCode[];
17
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
+ }, {}>;
18
24
  export declare const retrieveEntityInfo: import("@reduxjs/toolkit").AsyncThunk<{
19
25
  data: any;
20
26
  }, string, {}>;
@@ -42,6 +48,7 @@ export interface IndividualData {
42
48
  flowName: FlowsTypes;
43
49
  }
44
50
  export interface IndividualState extends SharedState<IndividualData> {
51
+ customLoading?: boolean;
45
52
  }
46
53
  export declare const individualSlice: import("@reduxjs/toolkit").Slice<IndividualState, {
47
54
  clearError: (state: IndividualState) => void;
@@ -53,10 +53,9 @@ 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, hasTaxCompleted;
57
- var _b, _c;
58
- return __generator(this, function (_d) {
59
- switch (_d.label) {
56
+ var payload, data, leadResponse, _a, steps, entity, individual_id, hasTaxCompleted;
57
+ return __generator(this, function (_b) {
58
+ switch (_b.label) {
60
59
  case 0:
61
60
  payload = {
62
61
  service_name: 'tap_email',
@@ -64,32 +63,35 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
64
63
  };
65
64
  return [4, API.leadService.verifyLeadToken(payload)];
66
65
  case 1:
67
- data = (_d.sent()).data;
66
+ data = (_b.sent()).data;
68
67
  leadResponse = undefined;
69
- if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 7];
68
+ if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 8];
70
69
  return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
71
70
  case 2:
72
- leadResponse = _d.sent();
73
- _a = leadResponse.data, steps = _a.steps, entity = _a.entity;
71
+ leadResponse = _b.sent();
72
+ _a = leadResponse.data, steps = _a.steps, entity = _a.entity, individual_id = _a.individual_id;
74
73
  hasTaxCompleted = hasKey(steps, INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS);
75
74
  if (!(data.step_name === INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 3];
76
75
  thunkApi.dispatch(handleCurrentActiveScreen('INDIVIDUAL_VERIFY_STEP'));
77
- return [3, 7];
76
+ return [3, 8];
78
77
  case 3:
79
78
  if (!hasTaxCompleted) return [3, 5];
80
79
  return [4, thunkApi.dispatch(retrieveEntityInfo(entity === null || entity === void 0 ? void 0 : entity.id))];
81
80
  case 4:
82
- _d.sent();
81
+ _b.sent();
83
82
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
84
- return [3, 7];
83
+ return [3, 8];
85
84
  case 5:
86
- if (!(data.step_name === INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO)) return [3, 7];
87
- return [4, thunkApi.dispatch(retrieveDataList((_c = (_b = leadResponse.data) === null || _b === void 0 ? void 0 : _b.entity) === null || _c === void 0 ? void 0 : _c.country))];
85
+ if (!(data.step_name === INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO)) return [3, 8];
86
+ return [4, thunkApi.dispatch(retrieveDataList(entity === null || entity === void 0 ? void 0 : entity.country))];
88
87
  case 6:
89
- _d.sent();
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:
91
+ _b.sent();
90
92
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
91
- _d.label = 7;
92
- case 7: return [2, { data: data, leadData: leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data, token: token }];
93
+ _b.label = 8;
94
+ case 8: return [2, { data: data, leadData: leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data, token: token }];
93
95
  }
94
96
  });
95
97
  }); });
@@ -110,8 +112,8 @@ export var resendOTP = createAsyncThunk('resendOTPIndividual', function (params,
110
112
  }
111
113
  });
112
114
  }); });
113
- export var retrieveDataList = createAsyncThunk('individualRetrieveDataList', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
114
- var _a, sourceIncome, monthlyIncome, occupation, settings, countries;
115
+ export var retrieveDataList = createAsyncThunk('individualRetrieveDataList', function (countryCode) { return __awaiter(void 0, void 0, void 0, function () {
116
+ var _a, sourceIncome, monthlyIncome, occupation;
115
117
  return __generator(this, function (_b) {
116
118
  switch (_b.label) {
117
119
  case 0: return [4, Promise.all([
@@ -121,18 +123,34 @@ export var retrieveDataList = createAsyncThunk('individualRetrieveDataList', fun
121
123
  ])];
122
124
  case 1:
123
125
  _a = _b.sent(), sourceIncome = _a[0].data, monthlyIncome = _a[1].data, occupation = _a[2];
124
- settings = thunkApi.getState().settings;
125
- countries = settings.data.countries;
126
126
  return [2, {
127
127
  sourceIncome: sourceIncome,
128
128
  monthlyIncome: monthlyIncome,
129
- countryCode: countryCode,
130
- occupation: occupation,
131
- countries: countries
129
+ occupation: occupation
132
130
  }];
133
131
  }
134
132
  });
135
133
  }); });
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
+ });
136
154
  export var retrieveEntityInfo = createAsyncThunk('retrieveIndividualEntityInfo', function (entityID) { return __awaiter(void 0, void 0, void 0, function () {
137
155
  var data;
138
156
  return __generator(this, function (_a) {
@@ -145,8 +163,8 @@ export var retrieveEntityInfo = createAsyncThunk('retrieveIndividualEntityInfo',
145
163
  });
146
164
  }); });
147
165
  export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
148
- var _a, individual, settings, responseBody, payload, data, steps, hasIndividualCompleted;
149
- var _b, _c, _d, _e, _f;
166
+ var _a, individual, settings, responseBody, payload, data, _b, steps, individual_id, entity, hasIndividualCompleted;
167
+ var _c, _d, _e, _f;
150
168
  return __generator(this, function (_g) {
151
169
  switch (_g.label) {
152
170
  case 0:
@@ -154,7 +172,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
154
172
  responseBody = individual.data.verify.responseBody;
155
173
  payload = {
156
174
  data: params.otp,
157
- service_name: (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _b === void 0 ? void 0 : _b.service_name,
175
+ service_name: (_c = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _c === void 0 ? void 0 : _c.service_name,
158
176
  verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
159
177
  step_name: INDIVIDUAl_STEP_NAMES.PHONE_AUTH,
160
178
  encryption_contract: ['data']
@@ -162,22 +180,25 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
162
180
  return [4, API.leadService.verifyLeadOTP(payload)];
163
181
  case 1:
164
182
  data = (_g.sent()).data;
165
- if (!!(data === null || data === void 0 ? void 0 : data.errors)) return [3, 5];
166
- (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
167
- steps = responseBody === null || responseBody === void 0 ? void 0 : responseBody.steps;
183
+ if (!!(data === null || data === void 0 ? void 0 : data.errors)) return [3, 6];
184
+ (_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;
168
186
  hasIndividualCompleted = hasKey(steps, INDIVIDUAl_STEP_NAMES.INDIVIDUAl_SUCCESS);
169
187
  if (!hasIndividualCompleted) return [3, 3];
170
- return [4, thunkApi.dispatch(retrieveEntityInfo((_e = responseBody === null || responseBody === void 0 ? void 0 : responseBody.entity) === null || _e === void 0 ? void 0 : _e.id))];
188
+ return [4, thunkApi.dispatch(retrieveEntityInfo((_f = responseBody === null || responseBody === void 0 ? void 0 : responseBody.entity) === null || _f === void 0 ? void 0 : _f.id))];
171
189
  case 2:
172
190
  _g.sent();
173
191
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
174
- return [3, 5];
175
- case 3: return [4, thunkApi.dispatch(retrieveDataList((_f = responseBody === null || responseBody === void 0 ? void 0 : responseBody.entity) === null || _f === void 0 ? void 0 : _f.country))];
192
+ return [3, 6];
193
+ case 3: return [4, thunkApi.dispatch(retrieveDataList(entity === null || entity === void 0 ? void 0 : entity.country))];
176
194
  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:
177
198
  _g.sent();
178
199
  thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
179
- _g.label = 5;
180
- case 5: return [2, { data: data, formData: __assign({}, params) }];
200
+ _g.label = 6;
201
+ case 6: return [2, { data: data, formData: __assign({}, params) }];
181
202
  }
182
203
  });
183
204
  }); });
@@ -347,24 +368,42 @@ export var individualSlice = createSlice({
347
368
  .addCase(retrieveDataList.fulfilled, function (state, action) {
348
369
  state.loading = false;
349
370
  state.error = null;
350
- var _a = action.payload, sourceIncome = _a.sourceIncome, monthlyIncome = _a.monthlyIncome, countryCode = _a.countryCode, countries = _a.countries, occupation = _a.occupation;
371
+ var _a = action.payload, sourceIncome = _a.sourceIncome, monthlyIncome = _a.monthlyIncome, occupation = _a.occupation;
351
372
  var data = state.data.individualData.responseBody;
352
373
  state.data.individualData.responseBody = __assign(__assign({}, data), { sourceIncomeList: sourceIncome || [], monthlyIncomeList: monthlyIncome || [], occupationList: occupation || [] });
353
- var selectedSourceIncome = sourceIncome === null || sourceIncome === void 0 ? void 0 : sourceIncome[0];
374
+ })
375
+ .addCase(retrieveDataList.rejected, function (state, action) {
376
+ state.loading = false;
377
+ 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]);
354
390
  if (!!selectedSourceIncome)
355
391
  state.data.individualData.sourceIncome = selectedSourceIncome;
356
- var selectedMonthlyIncome = monthlyIncome === null || monthlyIncome === void 0 ? void 0 : monthlyIncome[2];
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]);
357
393
  if (!!selectedMonthlyIncome)
358
394
  state.data.individualData.monthlyIncome = selectedMonthlyIncome;
359
- if (!!countryCode) {
360
- var employerLocation = countries.find(function (country) { return country.iso2 === countryCode; });
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; });
361
398
  state.data.individualData.employerLocation = employerLocation;
362
399
  }
363
- var selectedOccupation = occupation === null || occupation === void 0 ? void 0 : occupation[0];
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]);
364
401
  if (!!selectedOccupation)
365
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;
366
405
  })
367
- .addCase(retrieveDataList.rejected, function (state, action) {
406
+ .addCase(retrieveIndividualInfo.rejected, function (state, action) {
368
407
  state.loading = false;
369
408
  state.error = action.error.message;
370
409
  })
@@ -62,6 +62,7 @@ export interface PasswordData {
62
62
  flowName: FlowsTypes;
63
63
  }
64
64
  export interface PasswordState extends SharedState<PasswordData> {
65
+ customLoading?: boolean;
65
66
  }
66
67
  export declare const passwordSlice: import("@reduxjs/toolkit").Slice<PasswordState, {
67
68
  clearError: (state: PasswordState) => void;
@@ -210,9 +210,8 @@ export var updateLeadSuccess = createAsyncThunk('passwordUpdateLeadSuccess', fun
210
210
  }); });
211
211
  export var verifyOperationToken = createAsyncThunk('verifyOperationToken', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
212
212
  var token, leadId, payload, data;
213
- var _a, _b;
214
- return __generator(this, function (_c) {
215
- switch (_c.label) {
213
+ return __generator(this, function (_a) {
214
+ switch (_a.label) {
216
215
  case 0:
217
216
  token = params.token, leadId = params.leadId;
218
217
  payload = {
@@ -221,11 +220,8 @@ export var verifyOperationToken = createAsyncThunk('verifyOperationToken', funct
221
220
  };
222
221
  return [4, API.authService.verifyAuth(payload)];
223
222
  case 1:
224
- data = (_c.sent()).data;
223
+ data = (_a.sent()).data;
225
224
  thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
226
- if ((data === null || data === void 0 ? void 0 : data.errors) || (data === null || data === void 0 ? void 0 : data.mw_error)) {
227
- alert((_b = (_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.description);
228
- }
229
225
  return [2, { data: data, token: token, leadId: leadId }];
230
226
  }
231
227
  });
@@ -0,0 +1,33 @@
1
+ import { RootState } from '../../../app/store';
2
+ import { MobileFormValues, SharedState, EmailFormValues, ResponseData, OTPFormValues, PasswordFormValues } from '../../../@types';
3
+ export declare const createMobileAuth: import("@reduxjs/toolkit").AsyncThunk<{
4
+ data: any;
5
+ formData: MobileFormValues;
6
+ }, MobileFormValues, {}>;
7
+ export declare const resendOTPMobile: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
8
+ export declare const createEmailAuth: import("@reduxjs/toolkit").AsyncThunk<{
9
+ data: any;
10
+ formData: EmailFormValues;
11
+ }, EmailFormValues, {}>;
12
+ export declare const resendOTPEmail: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
13
+ export declare const verifyAuthOTP: import("@reduxjs/toolkit").AsyncThunk<{
14
+ data: any;
15
+ formData: OTPFormValues;
16
+ }, OTPFormValues, {}>;
17
+ export declare const verifyAuthPassword: import("@reduxjs/toolkit").AsyncThunk<any, PasswordFormValues, {}>;
18
+ export interface SignInData {
19
+ auth: Partial<MobileFormValues & EmailFormValues> & ResponseData;
20
+ otpData: OTPFormValues & ResponseData;
21
+ passwordData: PasswordFormValues & ResponseData;
22
+ }
23
+ export interface SignInState extends SharedState<SignInData> {
24
+ }
25
+ export declare const signInSlice: import("@reduxjs/toolkit").Slice<SignInState, {
26
+ clearError: (state: SignInState) => void;
27
+ stopLoader: (state: SignInState) => void;
28
+ resetOTPScreen: (state: SignInState) => void;
29
+ }, "signIsn/store">;
30
+ export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
31
+ declare const _default: import("redux").Reducer<SignInState, import("redux").AnyAction>;
32
+ export default _default;
33
+ export declare const signInSelector: (state: RootState) => SignInState;