@tap-payments/auth-jsconnect 2.1.58-test → 2.1.60-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 (46) hide show
  1. package/build/constants/app.js +24 -0
  2. package/build/features/app/bank/bankStore.d.ts +5 -1
  3. package/build/features/app/bank/bankStore.js +62 -57
  4. package/build/features/app/brand/brandStore.js +2 -0
  5. package/build/features/app/entity/entityStore.d.ts +5 -1
  6. package/build/features/app/entity/entityStore.js +75 -70
  7. package/build/features/app/individual/individualStore.d.ts +5 -1
  8. package/build/features/app/individual/individualStore.js +88 -83
  9. package/build/features/app/tax/taxStore.d.ts +5 -1
  10. package/build/features/app/tax/taxStore.js +51 -46
  11. package/build/features/bank/Bank.js +31 -24
  12. package/build/features/bank/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  13. package/build/features/bank/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  14. package/build/features/bank/screens/PrepareDataLoading/index.d.ts +2 -0
  15. package/build/features/bank/screens/PrepareDataLoading/index.js +2 -0
  16. package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  17. package/build/features/brand/Brand.js +12 -21
  18. package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -98
  19. package/build/features/connectExpress/screens/Mobile/Mobile.js +1 -1
  20. package/build/features/connectExpress/screens/Mobile/MobileNumber.js +6 -9
  21. package/build/features/entity/Entity.js +31 -24
  22. package/build/features/entity/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  23. package/build/features/entity/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  24. package/build/features/entity/screens/PrepareDataLoading/index.d.ts +2 -0
  25. package/build/features/entity/screens/PrepareDataLoading/index.js +2 -0
  26. package/build/features/entity/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  27. package/build/features/featuresScreens.js +20 -0
  28. package/build/features/individual/Individual.js +31 -24
  29. package/build/features/individual/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  30. package/build/features/individual/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  31. package/build/features/individual/screens/PrepareDataLoading/index.d.ts +2 -0
  32. package/build/features/individual/screens/PrepareDataLoading/index.js +2 -0
  33. package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  34. package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  35. package/build/features/shared/Button/FlowsButtons.js +1 -1
  36. package/build/features/tax/Tax.js +31 -24
  37. package/build/features/tax/screens/PrepareDataLoading/PrepareDataLoading.d.ts +4 -0
  38. package/build/features/tax/screens/PrepareDataLoading/PrepareDataLoading.js +7 -0
  39. package/build/features/tax/screens/PrepareDataLoading/index.d.ts +2 -0
  40. package/build/features/tax/screens/PrepareDataLoading/index.js +2 -0
  41. package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +6 -99
  42. package/build/hooks/index.d.ts +1 -0
  43. package/build/hooks/index.js +1 -0
  44. package/build/hooks/useVerifyToken.d.ts +15 -0
  45. package/build/hooks/useVerifyToken.js +25 -0
  46. package/package.json +1 -1
@@ -245,6 +245,12 @@ export var INDIVIDUAL_SCREENS_NAVIGATION = [
245
245
  prev: '',
246
246
  order: 1
247
247
  },
248
+ {
249
+ name: 'INDIVIDUAL_LOADING_DATA_STEP',
250
+ next: ['INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP', 'INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'],
251
+ prev: '',
252
+ order: 1
253
+ },
248
254
  {
249
255
  name: 'INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP',
250
256
  next: 'INDIVIDUAL_SUCCESS_STEP',
@@ -315,6 +321,12 @@ export var BANK_SCREENS_NAVIGATION = [
315
321
  prev: '',
316
322
  order: 1
317
323
  },
324
+ {
325
+ name: 'BANK_LOADING_DATA_STEP',
326
+ next: ['BANK_BANK_DETAILS_STEP', 'BANK_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'],
327
+ prev: '',
328
+ order: 1
329
+ },
318
330
  {
319
331
  name: 'BANK_BANK_DETAILS_STEP',
320
332
  next: 'BANK_DETAILS_SUCCESS_STEP',
@@ -347,6 +359,12 @@ export var TAX_SCREENS_NAVIGATION = [
347
359
  prev: '',
348
360
  order: 1
349
361
  },
362
+ {
363
+ name: 'TAX_LOADING_DATA_STEP',
364
+ next: ['TAX_TAX_DETAILS_STEP', 'TAX_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'],
365
+ prev: '',
366
+ order: 1
367
+ },
350
368
  {
351
369
  name: 'TAX_TAX_DETAILS_STEP',
352
370
  next: 'TAX_DETAILS_SUCCESS_STEP',
@@ -405,6 +423,12 @@ export var ENTITY_SCREENS_NAVIGATION = [
405
423
  prev: '',
406
424
  order: 1
407
425
  },
426
+ {
427
+ name: 'ENTITY_LOADING_DATA_STEP',
428
+ next: ['ENTITY_NAME_STEP', 'ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'],
429
+ prev: '',
430
+ order: 1
431
+ },
408
432
  {
409
433
  name: 'ENTITY_NAME_STEP',
410
434
  next: 'ENTITY_CAPITAL_STEP',
@@ -1,6 +1,10 @@
1
1
  import { RootState } from '../../../app/store';
2
2
  import { BankFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
3
3
  import { CancelToken } from 'axios';
4
+ interface VerifyLeadTokenProps {
5
+ token: string;
6
+ isInternally?: boolean;
7
+ }
4
8
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
5
9
  data: any;
6
10
  boardResponse: {
@@ -15,7 +19,7 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
15
19
  flows: any;
16
20
  };
17
21
  token: string;
18
- }, string, {}>;
22
+ }, VerifyLeadTokenProps, {}>;
19
23
  export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
20
24
  data: any;
21
25
  }, void, {}>;
@@ -51,64 +51,69 @@ import API from '../../../api';
51
51
  import { FlowsTypes } from '../../../@types';
52
52
  import { handleCurrentActiveScreen, handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
53
53
  import { BANK_STEP_NAMES } from '../../../constants';
54
- export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
55
- var payload, data, boardInfoData, boardData, board_id, countryIso2, info, hasBankCompleted;
56
- var _a, _b, _c, _d;
57
- return __generator(this, function (_e) {
58
- switch (_e.label) {
59
- case 0:
60
- payload = {
61
- service_name: 'tap_email',
62
- verify_token: token
63
- };
64
- return [4, API.leadService.verifyLeadToken(payload)];
65
- case 1:
66
- data = (_e.sent()).data;
67
- boardData = undefined;
68
- if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 5];
69
- board_id = data === null || data === void 0 ? void 0 : data.id;
70
- if (!board_id) return [3, 4];
71
- return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
72
- case 2:
73
- boardInfoData = _e.sent();
74
- return [4, API.boardService.retrieveBoardDetails(board_id)];
75
- case 3:
76
- boardData = _e.sent();
77
- _e.label = 4;
78
- case 4:
79
- countryIso2 = (_a = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _a === void 0 ? void 0 : _a.country;
80
- if (countryIso2)
81
- thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
82
- info = (boardInfoData || {}).info;
83
- hasBankCompleted = ((_b = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'bank'; })) === null || _b === void 0 ? void 0 : _b.status) === 'completed';
84
- if (data.step_name === BANK_STEP_NAMES.PHONE_AUTH) {
85
- thunkApi.dispatch(handleCurrentActiveScreen('BANK_VERIFY_STEP'));
86
- }
87
- else if (hasBankCompleted) {
88
- thunkApi.dispatch(handleNextScreenStep('BANK_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
89
- }
90
- else if (data.step_name === BANK_STEP_NAMES.BANK_INFO) {
91
- thunkApi.dispatch(handleNextScreenStep('BANK_BANK_DETAILS_STEP'));
92
- }
93
- _e.label = 5;
94
- case 5: return [2, {
95
- data: data,
96
- boardResponse: {
97
- user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
98
- brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
99
- bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
100
- entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
101
- merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
102
- name: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.names,
103
- contact: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.contact,
104
- business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
105
- flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || []
106
- },
107
- token: token
108
- }];
109
- }
54
+ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_a, thunkApi) {
55
+ var token = _a.token, isInternally = _a.isInternally;
56
+ return __awaiter(void 0, void 0, void 0, function () {
57
+ var payload, data, boardInfoData, boardData, board_id, countryIso2, info, hasBankCompleted;
58
+ var _b, _c, _d, _e;
59
+ return __generator(this, function (_f) {
60
+ switch (_f.label) {
61
+ case 0:
62
+ payload = {
63
+ service_name: 'tap_email',
64
+ verify_token: token
65
+ };
66
+ return [4, API.leadService.verifyLeadToken(payload)];
67
+ case 1:
68
+ data = (_f.sent()).data;
69
+ boardData = undefined;
70
+ if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 5];
71
+ board_id = data === null || data === void 0 ? void 0 : data.id;
72
+ if (!board_id) return [3, 4];
73
+ return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
74
+ case 2:
75
+ boardInfoData = _f.sent();
76
+ return [4, API.boardService.retrieveBoardDetails(board_id)];
77
+ case 3:
78
+ boardData = _f.sent();
79
+ _f.label = 4;
80
+ case 4:
81
+ countryIso2 = (_b = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _b === void 0 ? void 0 : _b.country;
82
+ if (countryIso2)
83
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
84
+ info = (boardInfoData || {}).info;
85
+ if (isInternally)
86
+ data.step_name = BANK_STEP_NAMES.BANK_INFO;
87
+ hasBankCompleted = ((_c = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'bank'; })) === null || _c === void 0 ? void 0 : _c.status) === 'completed';
88
+ if (data.step_name === BANK_STEP_NAMES.PHONE_AUTH) {
89
+ thunkApi.dispatch(handleCurrentActiveScreen('BANK_VERIFY_STEP'));
90
+ }
91
+ else if (hasBankCompleted) {
92
+ thunkApi.dispatch(handleNextScreenStep('BANK_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
93
+ }
94
+ else if (data.step_name === BANK_STEP_NAMES.BANK_INFO) {
95
+ thunkApi.dispatch(handleNextScreenStep('BANK_BANK_DETAILS_STEP'));
96
+ }
97
+ _f.label = 5;
98
+ case 5: return [2, {
99
+ data: data,
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: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.names,
107
+ contact: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _e === void 0 ? void 0 : _e.contact,
108
+ business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
109
+ flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || []
110
+ },
111
+ token: token
112
+ }];
113
+ }
114
+ });
110
115
  });
111
- }); });
116
+ });
112
117
  export var resendOTP = createAsyncThunk('resendOTPBank', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
113
118
  var bank, payload, data;
114
119
  return __generator(this, function (_a) {
@@ -78,6 +78,8 @@ export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (
78
78
  throw new Error('Internal server error');
79
79
  }
80
80
  boardData = undefined;
81
+ if (isInternally)
82
+ data.step_name = BRAND_STEP_NAMES.BRAND_INFO;
81
83
  if (!(data.step_name !== BRAND_STEP_NAMES.PHONE_AUTH || isInternally)) return [3, 7];
82
84
  return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
83
85
  case 2:
@@ -1,5 +1,9 @@
1
1
  import { RootState } from '../../../app/store';
2
2
  import { EntityCapitalFormValues, EntityNameFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState } from '../../../@types';
3
+ interface VerifyLeadTokenProps {
4
+ token: string;
5
+ isInternally?: boolean;
6
+ }
3
7
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
8
  data: any;
5
9
  boardResponse: {
@@ -14,7 +18,7 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
14
18
  entityTypes: any;
15
19
  };
16
20
  token: string;
17
- }, string, {}>;
21
+ }, VerifyLeadTokenProps, {}>;
18
22
  export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
19
23
  data: any;
20
24
  }, void, {}>;
@@ -64,77 +64,82 @@ import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/setti
64
64
  import { ENTITY_STEP_NAMES } from '../../../constants';
65
65
  import moment from 'moment';
66
66
  import { convertNumbers2English } from '../../../utils';
67
- export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
68
- var payload, data, boardData, entityData, boardInfoData, entityTypes, countryIso2, board_id, entityId, info, hasEntityCompleted;
69
- var _a, _b, _c, _d;
70
- return __generator(this, function (_e) {
71
- switch (_e.label) {
72
- case 0:
73
- payload = {
74
- service_name: 'tap_email',
75
- verify_token: token
76
- };
77
- return [4, API.leadService.verifyLeadToken(payload)];
78
- case 1:
79
- data = (_e.sent()).data;
80
- countryIso2 = undefined;
81
- if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 9];
82
- if (data === null || data === void 0 ? void 0 : data.country_code) {
83
- countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
84
- if (countryIso2)
85
- thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
86
- }
87
- if (!(data.step_name !== ENTITY_STEP_NAMES.PHONE_AUTH)) return [3, 9];
88
- board_id = data === null || data === void 0 ? void 0 : data.id;
89
- if (!board_id) return [3, 4];
90
- return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
91
- case 2:
92
- boardInfoData = _e.sent();
93
- return [4, API.boardService.retrieveBoardDetails(board_id)];
94
- case 3:
95
- boardData = _e.sent();
96
- _e.label = 4;
97
- case 4:
98
- entityId = (_a = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _a === void 0 ? void 0 : _a.id;
99
- if (!entityId) return [3, 6];
100
- return [4, API.entityService.retrieveEntity(entityId)];
101
- case 5:
102
- entityData = _e.sent();
103
- _e.label = 6;
104
- case 6:
105
- if (!countryIso2) {
106
- countryIso2 = entityData.country;
107
- if (countryIso2)
108
- thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
109
- }
110
- info = (boardInfoData || {}).info;
111
- hasEntityCompleted = ((_b = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'entity'; })) === null || _b === void 0 ? void 0 : _b.status) === 'completed';
112
- if (!hasEntityCompleted) return [3, 7];
113
- thunkApi.dispatch(handleNextScreenStep('ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
114
- return [3, 9];
115
- case 7: return [4, API.entityService.retrieveEntityType()];
116
- case 8:
117
- entityTypes = _e.sent();
118
- thunkApi.dispatch(handleNextScreenStep('ENTITY_NAME_STEP'));
119
- _e.label = 9;
120
- case 9: return [2, {
121
- data: data,
122
- boardResponse: {
123
- user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
124
- brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
125
- bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
126
- entity: entityData === null || entityData === void 0 ? void 0 : entityData.entity,
127
- merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
128
- name: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.names,
129
- contact: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.contact,
130
- flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || [],
131
- entityTypes: entityTypes
132
- },
133
- token: token
134
- }];
135
- }
67
+ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function (_a, thunkApi) {
68
+ var token = _a.token, isInternally = _a.isInternally;
69
+ return __awaiter(void 0, void 0, void 0, function () {
70
+ var payload, data, boardData, entityData, boardInfoData, entityTypes, countryIso2, board_id, entityId, info, hasEntityCompleted;
71
+ var _b, _c, _d, _e;
72
+ return __generator(this, function (_f) {
73
+ switch (_f.label) {
74
+ case 0:
75
+ payload = {
76
+ service_name: 'tap_email',
77
+ verify_token: token
78
+ };
79
+ return [4, API.leadService.verifyLeadToken(payload)];
80
+ case 1:
81
+ data = (_f.sent()).data;
82
+ countryIso2 = undefined;
83
+ if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 9];
84
+ if (isInternally)
85
+ data.step_name = ENTITY_STEP_NAMES.ENTITY_INFO;
86
+ if (data === null || data === void 0 ? void 0 : data.country_code) {
87
+ countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
88
+ if (countryIso2)
89
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
90
+ }
91
+ if (!(data.step_name !== ENTITY_STEP_NAMES.PHONE_AUTH)) return [3, 9];
92
+ board_id = data === null || data === void 0 ? void 0 : data.id;
93
+ if (!board_id) return [3, 4];
94
+ return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
95
+ case 2:
96
+ boardInfoData = _f.sent();
97
+ return [4, API.boardService.retrieveBoardDetails(board_id)];
98
+ case 3:
99
+ boardData = _f.sent();
100
+ _f.label = 4;
101
+ case 4:
102
+ entityId = (_b = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _b === void 0 ? void 0 : _b.id;
103
+ if (!entityId) return [3, 6];
104
+ return [4, API.entityService.retrieveEntity(entityId)];
105
+ case 5:
106
+ entityData = _f.sent();
107
+ _f.label = 6;
108
+ case 6:
109
+ if (!countryIso2) {
110
+ countryIso2 = entityData.country;
111
+ if (countryIso2)
112
+ thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
113
+ }
114
+ info = (boardInfoData || {}).info;
115
+ hasEntityCompleted = ((_c = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'entity'; })) === null || _c === void 0 ? void 0 : _c.status) === 'completed';
116
+ if (!hasEntityCompleted) return [3, 7];
117
+ thunkApi.dispatch(handleNextScreenStep('ENTITY_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
118
+ return [3, 9];
119
+ case 7: return [4, API.entityService.retrieveEntityType()];
120
+ case 8:
121
+ entityTypes = _f.sent();
122
+ thunkApi.dispatch(handleNextScreenStep('ENTITY_NAME_STEP'));
123
+ _f.label = 9;
124
+ case 9: return [2, {
125
+ data: data,
126
+ boardResponse: {
127
+ user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
128
+ brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
129
+ bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
130
+ entity: entityData === null || entityData === void 0 ? void 0 : entityData.entity,
131
+ merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
132
+ name: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.names,
133
+ contact: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _e === void 0 ? void 0 : _e.contact,
134
+ flows: (boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || [],
135
+ entityTypes: entityTypes
136
+ },
137
+ token: token
138
+ }];
139
+ }
140
+ });
136
141
  });
137
- }); });
142
+ });
138
143
  export var resendOTP = createAsyncThunk('entityResendOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
139
144
  var entity, payload, data;
140
145
  return __generator(this, function (_a) {
@@ -1,5 +1,9 @@
1
1
  import { RootState } from '../../../app/store';
2
2
  import { CountryCode, FlowsTypes, IndividualExtraFormValues, OTPFormValues, ResponseData, SharedState, ActionState } from '../../../@types';
3
+ interface VerifyLeadTokenProps {
4
+ token: string;
5
+ isInternally?: boolean;
6
+ }
3
7
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
8
  data: any;
5
9
  boardResponse: {
@@ -17,7 +21,7 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
17
21
  flows: any;
18
22
  };
19
23
  token: string;
20
- }, string, {}>;
24
+ }, VerifyLeadTokenProps, {}>;
21
25
  export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
22
26
  data: any;
23
27
  }, void, {}>;
@@ -51,91 +51,96 @@ import API from '../../../api';
51
51
  import { FlowsTypes } from '../../../@types';
52
52
  import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
53
53
  import { INDIVIDUAl_STEP_NAMES } from '../../../constants';
54
- export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
55
- var payload, settings, data, boardData, individualData, countryCode, boardInfoData, boardInfoStatus, countries, board_id, board_info_id, notification, _a, id, type, info, hasIndividualCompleted;
56
- var _b, _c, _d, _e;
57
- return __generator(this, function (_f) {
58
- switch (_f.label) {
59
- case 0:
60
- payload = {
61
- service_name: 'tap_email',
62
- verify_token: token
63
- };
64
- settings = thunkApi.getState().settings;
65
- return [4, API.leadService.verifyLeadToken(payload)];
66
- case 1:
67
- data = (_f.sent()).data;
68
- boardInfoStatus = undefined;
69
- countries = settings.data.countries;
70
- if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 11];
71
- if (data === null || data === void 0 ? void 0 : data.country_code) {
72
- countryCode = data === null || data === void 0 ? void 0 : data.country_code;
73
- thunkApi.dispatch(handleSetCountryByIso2(countryCode));
74
- }
75
- if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 11];
76
- board_id = data === null || data === void 0 ? void 0 : data.id;
77
- board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
78
- if (!(board_id && board_info_id)) return [3, 4];
79
- return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
80
- case 2:
81
- boardInfoData = _f.sent();
82
- notification = (boardInfoData || {}).notification;
83
- _a = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _a.id, type = _a.type;
84
- if (!(id && type)) return [3, 4];
85
- return [4, API.individualService.retrieveIndividual(id, type)];
86
- case 3:
87
- individualData = _f.sent();
88
- _f.label = 4;
89
- case 4:
90
- if (!board_id) return [3, 7];
91
- return [4, API.boardService.retrieveBoardDetails(board_id)];
92
- case 5:
93
- boardData = _f.sent();
94
- return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
95
- case 6:
96
- boardInfoStatus = _f.sent();
97
- _f.label = 7;
98
- case 7:
99
- if (!countryCode) {
100
- countryCode = (_b = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _b === void 0 ? void 0 : _b.country;
101
- if (countryCode)
54
+ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', function (_a, thunkApi) {
55
+ var token = _a.token, isInternally = _a.isInternally;
56
+ return __awaiter(void 0, void 0, void 0, function () {
57
+ var payload, settings, data, boardData, individualData, countryCode, boardInfoData, boardInfoStatus, countries, board_id, board_info_id, notification, _b, id, type, info, hasIndividualCompleted;
58
+ var _c, _d, _e, _f;
59
+ return __generator(this, function (_g) {
60
+ switch (_g.label) {
61
+ case 0:
62
+ payload = {
63
+ service_name: 'tap_email',
64
+ verify_token: token
65
+ };
66
+ settings = thunkApi.getState().settings;
67
+ return [4, API.leadService.verifyLeadToken(payload)];
68
+ case 1:
69
+ data = (_g.sent()).data;
70
+ boardInfoStatus = undefined;
71
+ countries = settings.data.countries;
72
+ if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 11];
73
+ if (isInternally)
74
+ data.step_name = INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO;
75
+ if (data === null || data === void 0 ? void 0 : data.country_code) {
76
+ countryCode = data === null || data === void 0 ? void 0 : data.country_code;
102
77
  thunkApi.dispatch(handleSetCountryByIso2(countryCode));
103
- }
104
- info = (boardInfoStatus || {}).info;
105
- hasIndividualCompleted = ((_c = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _c === void 0 ? void 0 : _c.status) === 'completed';
106
- if (!hasIndividualCompleted) return [3, 8];
107
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
108
- return [3, 11];
109
- case 8:
110
- if (!countryCode) return [3, 10];
111
- return [4, thunkApi.dispatch(retrieveDataList(countryCode))];
112
- case 9:
113
- _f.sent();
114
- _f.label = 10;
115
- case 10:
116
- thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
117
- _f.label = 11;
118
- case 11: return [2, {
119
- data: data,
120
- boardResponse: {
121
- user: individualData === null || individualData === void 0 ? void 0 : individualData.user,
122
- brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
123
- bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
124
- entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
125
- merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
126
- merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
127
- name: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.names,
128
- contact: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _e === void 0 ? void 0 : _e.contact,
129
- countries: countries,
130
- countryCode: countryCode,
131
- notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
132
- flows: (boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || []
133
- },
134
- token: token
135
- }];
136
- }
78
+ }
79
+ if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 11];
80
+ board_id = data === null || data === void 0 ? void 0 : data.id;
81
+ board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
82
+ if (!(board_id && board_info_id)) return [3, 4];
83
+ return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
84
+ case 2:
85
+ boardInfoData = _g.sent();
86
+ notification = (boardInfoData || {}).notification;
87
+ _b = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _b.id, type = _b.type;
88
+ if (!(id && type)) return [3, 4];
89
+ return [4, API.individualService.retrieveIndividual(id, type)];
90
+ case 3:
91
+ individualData = _g.sent();
92
+ _g.label = 4;
93
+ case 4:
94
+ if (!board_id) return [3, 7];
95
+ return [4, API.boardService.retrieveBoardDetails(board_id)];
96
+ case 5:
97
+ boardData = _g.sent();
98
+ return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
99
+ case 6:
100
+ boardInfoStatus = _g.sent();
101
+ _g.label = 7;
102
+ case 7:
103
+ if (!countryCode) {
104
+ countryCode = (_c = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _c === void 0 ? void 0 : _c.country;
105
+ if (countryCode)
106
+ thunkApi.dispatch(handleSetCountryByIso2(countryCode));
107
+ }
108
+ info = (boardInfoStatus || {}).info;
109
+ hasIndividualCompleted = ((_d = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _d === void 0 ? void 0 : _d.status) === 'completed';
110
+ if (!hasIndividualCompleted) return [3, 8];
111
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
112
+ return [3, 11];
113
+ case 8:
114
+ if (!countryCode) return [3, 10];
115
+ return [4, thunkApi.dispatch(retrieveDataList(countryCode))];
116
+ case 9:
117
+ _g.sent();
118
+ _g.label = 10;
119
+ case 10:
120
+ thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
121
+ _g.label = 11;
122
+ case 11: return [2, {
123
+ data: data,
124
+ boardResponse: {
125
+ user: individualData === null || individualData === void 0 ? void 0 : individualData.user,
126
+ brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
127
+ bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
128
+ entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
129
+ merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
130
+ merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
131
+ name: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _e === void 0 ? void 0 : _e.names,
132
+ contact: (_f = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _f === void 0 ? void 0 : _f.contact,
133
+ countries: countries,
134
+ countryCode: countryCode,
135
+ notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
136
+ flows: (boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || []
137
+ },
138
+ token: token
139
+ }];
140
+ }
141
+ });
137
142
  });
138
- }); });
143
+ });
139
144
  export var resendOTP = createAsyncThunk('resendOTPIndividual', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
140
145
  var individual, payload, data;
141
146
  return __generator(this, function (_a) {
@@ -1,10 +1,14 @@
1
1
  import { RootState } from '../../../app/store';
2
2
  import { FlowsTypes, OTPFormValues, ResponseData, SharedState, TaxFormValues } from '../../../@types';
3
+ interface VerifyLeadTokenProps {
4
+ token: string;
5
+ isInternally?: boolean;
6
+ }
3
7
  export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
4
8
  data: any;
5
9
  boardResponse: any;
6
10
  token: string;
7
- }, string, {}>;
11
+ }, VerifyLeadTokenProps, {}>;
8
12
  export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
9
13
  data: any;
10
14
  }, void, {}>;