@tap-payments/auth-jsconnect 2.4.97-test → 2.4.98-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.
- package/build/features/app/bank/bankStore.js +6 -3
- package/build/features/app/brand/brandStore.js +6 -3
- package/build/features/app/business/businessStore.js +22 -19
- package/build/features/app/entity/entityStore.js +22 -19
- package/build/features/app/individual/individualStore.js +27 -24
- package/build/features/app/password/passwordStore.js +6 -3
- package/build/features/app/tax/taxStore.js +17 -14
- package/package.json +1 -1
|
@@ -49,13 +49,13 @@ var _a;
|
|
|
49
49
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
50
50
|
import API from '../../../api';
|
|
51
51
|
import { DocumentPurpose, FlowsTypes } from '../../../@types';
|
|
52
|
-
import { handleCurrentActiveScreen, handleNextScreenStep, handlePrevScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
|
|
52
|
+
import { handleCurrentActiveScreen, handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
|
|
53
53
|
import { BANK_STEP_NAMES } from '../../../constants';
|
|
54
54
|
import { hasNoneEditableValue, isStringHasOneAsterisk, retrieveIndividualData, sleep } from '../../../utils';
|
|
55
55
|
export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_a, thunkApi) {
|
|
56
56
|
var token = _a.token, isInternally = _a.isInternally;
|
|
57
57
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
58
|
-
var payload, data, boardData, boardInfoData, individualData, _b, board_id, board_info_id, _c, id_1, type_1, serviceCallBack, _d, boardRes, individualRes, countryIso2;
|
|
58
|
+
var payload, data, boardData, boardInfoData, individualData, _b, board_id, board_info_id, config, publicKey, _c, id_1, type_1, serviceCallBack, _d, boardRes, individualRes, countryIso2;
|
|
59
59
|
var _e, _f, _g, _h, _j;
|
|
60
60
|
return __generator(this, function (_k) {
|
|
61
61
|
switch (_k.label) {
|
|
@@ -70,7 +70,10 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (_
|
|
|
70
70
|
individualData = undefined;
|
|
71
71
|
if ((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length)
|
|
72
72
|
throw new Error(data.errors[0].description);
|
|
73
|
-
_b = data || {}, board_id = _b.id, board_info_id = _b.board_info_id;
|
|
73
|
+
_b = data || {}, board_id = _b.id, board_info_id = _b.board_info_id, config = _b.config;
|
|
74
|
+
publicKey = config === null || config === void 0 ? void 0 : config.public_key;
|
|
75
|
+
if (publicKey)
|
|
76
|
+
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
74
77
|
if (!board_id) return [3, 6];
|
|
75
78
|
if (!board_info_id) return [3, 3];
|
|
76
79
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
@@ -60,13 +60,13 @@ var _a;
|
|
|
60
60
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
61
61
|
import API from '../../../api';
|
|
62
62
|
import { FlowsTypes } from '../../../@types';
|
|
63
|
-
import { handleNextScreenStep, handlePrevScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
|
|
63
|
+
import { handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
|
|
64
64
|
import { BRAND_STEP_NAMES } from '../../../constants';
|
|
65
65
|
import { hasNoneEditableValue, isKW, isTwitter, isWebsite, mapSalesChannel, retrieveIndividualData, sleep } from '../../../utils';
|
|
66
66
|
export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (_a, thunkApi) {
|
|
67
67
|
var token = _a.token, isInternally = _a.isInternally;
|
|
68
68
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
69
|
-
var payload, data, countryIso2, _b, board_id, board_info_id, salesChannels, boardData, boardInfoData, individualData, _c, id_1, type_1, serviceCallBack, _d, boardRes, individualRes;
|
|
69
|
+
var payload, data, countryIso2, _b, board_id, board_info_id, config, publicKey, salesChannels, boardData, boardInfoData, individualData, _c, id_1, type_1, serviceCallBack, _d, boardRes, individualRes;
|
|
70
70
|
var _e, _f, _g, _h;
|
|
71
71
|
return __generator(this, function (_j) {
|
|
72
72
|
switch (_j.label) {
|
|
@@ -84,7 +84,10 @@ export var verifyLeadToken = createAsyncThunk('brandVerifyLeadToken', function (
|
|
|
84
84
|
countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
|
|
85
85
|
if (countryIso2)
|
|
86
86
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
87
|
-
_b = data || {}, board_id = _b.id, board_info_id = _b.board_info_id;
|
|
87
|
+
_b = data || {}, board_id = _b.id, board_info_id = _b.board_info_id, config = _b.config;
|
|
88
|
+
publicKey = config === null || config === void 0 ? void 0 : config.public_key;
|
|
89
|
+
if (publicKey)
|
|
90
|
+
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
88
91
|
if (!board_id) {
|
|
89
92
|
throw new Error('Internal server error');
|
|
90
93
|
}
|
|
@@ -60,12 +60,12 @@ import API from '../../../api';
|
|
|
60
60
|
import { BusinessType, FlowsTypes, DocumentPurpose, LicenseType } from '../../../@types';
|
|
61
61
|
import { BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_ENTITY_LICENSE, OTHER_FL_LICENSE } from '../../../constants';
|
|
62
62
|
import { convertNumbers2English, hasKey, sleep, isKW, isSA, dateFormat, isOtherLicense } from '../../../utils';
|
|
63
|
-
import { handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
|
|
63
|
+
import { handleNextScreenStep, handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
|
|
64
64
|
export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
65
|
-
var payload, data, countryIso2, boardData, brandData, isicActivityList, leadData, _a, steps, brand, board_id, business_id, entity, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, list, list;
|
|
66
|
-
var _b;
|
|
67
|
-
return __generator(this, function (
|
|
68
|
-
switch (
|
|
65
|
+
var payload, data, publicKey, countryIso2, boardData, brandData, isicActivityList, leadData, _a, steps, brand, board_id, business_id, entity, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, list, list;
|
|
66
|
+
var _b, _c;
|
|
67
|
+
return __generator(this, function (_d) {
|
|
68
|
+
switch (_d.label) {
|
|
69
69
|
case 0:
|
|
70
70
|
payload = {
|
|
71
71
|
service_name: 'tap_email',
|
|
@@ -73,11 +73,14 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
|
|
|
73
73
|
};
|
|
74
74
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
75
75
|
case 1:
|
|
76
|
-
data = (
|
|
76
|
+
data = (_d.sent()).data;
|
|
77
77
|
if ((_b = data.errors) === null || _b === void 0 ? void 0 : _b.length)
|
|
78
78
|
throw new Error(data.errors[0].description);
|
|
79
79
|
if (data.mw_error)
|
|
80
80
|
throw new Error(data.mw_error);
|
|
81
|
+
publicKey = (_c = data === null || data === void 0 ? void 0 : data.config) === null || _c === void 0 ? void 0 : _c.public_key;
|
|
82
|
+
if (publicKey)
|
|
83
|
+
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
81
84
|
countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
|
|
82
85
|
if (countryIso2)
|
|
83
86
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
@@ -86,7 +89,7 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
|
|
|
86
89
|
brandData = void 0, isicActivityList = undefined;
|
|
87
90
|
return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
|
|
88
91
|
case 2:
|
|
89
|
-
leadData = (
|
|
92
|
+
leadData = (_d.sent()).data;
|
|
90
93
|
countryIso2 = leadData === null || leadData === void 0 ? void 0 : leadData.country_code;
|
|
91
94
|
if (!countryIso2)
|
|
92
95
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
@@ -107,11 +110,11 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
|
|
|
107
110
|
if (!board_id) return [3, 5];
|
|
108
111
|
return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
109
112
|
case 3:
|
|
110
|
-
boardData =
|
|
113
|
+
boardData = _d.sent();
|
|
111
114
|
return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
|
|
112
115
|
case 4:
|
|
113
|
-
|
|
114
|
-
|
|
116
|
+
_d.sent();
|
|
117
|
+
_d.label = 5;
|
|
115
118
|
case 5:
|
|
116
119
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
117
120
|
return [3, 19];
|
|
@@ -127,38 +130,38 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
|
|
|
127
130
|
if (!hasBusinessCRActivitiesCompleted) return [3, 12];
|
|
128
131
|
return [4, API.dataService.getActivitiesIsIc()];
|
|
129
132
|
case 9:
|
|
130
|
-
list = (
|
|
133
|
+
list = (_d.sent()).list;
|
|
131
134
|
isicActivityList = list || [];
|
|
132
135
|
return [4, thunkApi.dispatch(retrieveDataList())];
|
|
133
136
|
case 10:
|
|
134
|
-
|
|
137
|
+
_d.sent();
|
|
135
138
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
136
139
|
case 11:
|
|
137
|
-
brandData =
|
|
140
|
+
brandData = _d.sent();
|
|
138
141
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
|
|
139
142
|
return [3, 19];
|
|
140
143
|
case 12:
|
|
141
144
|
if (!hasBusinessCRInfoCompleted) return [3, 15];
|
|
142
145
|
return [4, API.dataService.getActivitiesIsIc()];
|
|
143
146
|
case 13:
|
|
144
|
-
list = (
|
|
147
|
+
list = (_d.sent()).list;
|
|
145
148
|
isicActivityList = list || [];
|
|
146
149
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
147
150
|
case 14:
|
|
148
|
-
brandData =
|
|
151
|
+
brandData = _d.sent();
|
|
149
152
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
|
|
150
153
|
return [3, 19];
|
|
151
154
|
case 15: return [4, thunkApi.dispatch(retrieveAllEntityList({ businessId: business_id, entityId: entity === null || entity === void 0 ? void 0 : entity.id }))];
|
|
152
155
|
case 16:
|
|
153
|
-
|
|
156
|
+
_d.sent();
|
|
154
157
|
if (!isSA(countryIso2)) return [3, 18];
|
|
155
158
|
return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
|
|
156
159
|
case 17:
|
|
157
|
-
|
|
158
|
-
|
|
160
|
+
_d.sent();
|
|
161
|
+
_d.label = 18;
|
|
159
162
|
case 18:
|
|
160
163
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
|
|
161
|
-
|
|
164
|
+
_d.label = 19;
|
|
162
165
|
case 19: return [2, {
|
|
163
166
|
data: data,
|
|
164
167
|
isicActivityList: isicActivityList,
|
|
@@ -60,17 +60,17 @@ var _a;
|
|
|
60
60
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
61
61
|
import API from '../../../api';
|
|
62
62
|
import { BusinessType, DocumentPurpose, FlowsTypes, LicenseType } from '../../../@types';
|
|
63
|
-
import { handleNextScreenStep, handlePrevScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
|
|
63
|
+
import { handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
|
|
64
64
|
import { ENTITY_STEP_NAMES } from '../../../constants';
|
|
65
65
|
import moment from 'moment';
|
|
66
66
|
import { convertNumbers2English, getRecentDocumentBasedOnPurpose, hasVerifiedValue, hasNoneEditableValue, sleep, formatNumberAsCurrency, removeAllCharsFromNumber, retrieveIndividualData } from '../../../utils';
|
|
67
67
|
export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function (_a, thunkApi) {
|
|
68
68
|
var token = _a.token, isInternally = _a.isInternally;
|
|
69
69
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
70
|
-
var payload, data, boardData, boardInfoData, entityData, entityTypes, individualData, countryIso2, _b, board_id, board_info_id, _c, id_1, type_1, serviceCallBack, _d, boardRes, individualRes, entityId;
|
|
71
|
-
var _e, _f, _g, _h;
|
|
72
|
-
return __generator(this, function (
|
|
73
|
-
switch (
|
|
70
|
+
var payload, data, boardData, boardInfoData, entityData, entityTypes, individualData, countryIso2, publicKey, _b, board_id, board_info_id, _c, id_1, type_1, serviceCallBack, _d, boardRes, individualRes, entityId;
|
|
71
|
+
var _e, _f, _g, _h, _j;
|
|
72
|
+
return __generator(this, function (_k) {
|
|
73
|
+
switch (_k.label) {
|
|
74
74
|
case 0:
|
|
75
75
|
payload = {
|
|
76
76
|
service_name: 'tap_email',
|
|
@@ -78,7 +78,7 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
|
|
|
78
78
|
};
|
|
79
79
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
80
80
|
case 1:
|
|
81
|
-
data = (
|
|
81
|
+
data = (_k.sent()).data;
|
|
82
82
|
countryIso2 = undefined;
|
|
83
83
|
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 10];
|
|
84
84
|
if (isInternally)
|
|
@@ -88,33 +88,36 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
|
|
|
88
88
|
if (countryIso2)
|
|
89
89
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
90
90
|
}
|
|
91
|
+
publicKey = (_e = data === null || data === void 0 ? void 0 : data.config) === null || _e === void 0 ? void 0 : _e.public_key;
|
|
92
|
+
if (publicKey)
|
|
93
|
+
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
91
94
|
if (!(data.step_name !== ENTITY_STEP_NAMES.PHONE_AUTH)) return [3, 10];
|
|
92
95
|
_b = data || {}, board_id = _b.id, board_info_id = _b.board_info_id;
|
|
93
96
|
if (!board_id) return [3, 6];
|
|
94
97
|
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
95
98
|
case 2:
|
|
96
|
-
boardData =
|
|
99
|
+
boardData = _k.sent();
|
|
97
100
|
if (!board_info_id) return [3, 4];
|
|
98
101
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
99
102
|
case 3:
|
|
100
|
-
boardInfoData =
|
|
101
|
-
|
|
103
|
+
boardInfoData = _k.sent();
|
|
104
|
+
_k.label = 4;
|
|
102
105
|
case 4:
|
|
103
|
-
_c = ((
|
|
106
|
+
_c = ((_f = boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification) === null || _f === void 0 ? void 0 : _f.recipient) || {}, id_1 = _c.id, type_1 = _c.type;
|
|
104
107
|
serviceCallBack = function () { return API.individualService.retrieveIndividual(id_1, type_1); };
|
|
105
108
|
return [4, retrieveIndividualData(type_1, boardData, serviceCallBack)];
|
|
106
109
|
case 5:
|
|
107
|
-
_d =
|
|
110
|
+
_d = _k.sent(), boardRes = _d.boardRes, individualRes = _d.individualRes;
|
|
108
111
|
boardData = boardRes;
|
|
109
112
|
individualData = individualRes;
|
|
110
|
-
|
|
113
|
+
_k.label = 6;
|
|
111
114
|
case 6:
|
|
112
|
-
entityId = (
|
|
115
|
+
entityId = (_g = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _g === void 0 ? void 0 : _g.id;
|
|
113
116
|
if (!entityId) return [3, 8];
|
|
114
117
|
return [4, API.entityService.retrieveEntity(entityId)];
|
|
115
118
|
case 7:
|
|
116
|
-
entityData =
|
|
117
|
-
|
|
119
|
+
entityData = _k.sent();
|
|
120
|
+
_k.label = 8;
|
|
118
121
|
case 8:
|
|
119
122
|
if (!countryIso2) {
|
|
120
123
|
countryIso2 = entityData.country;
|
|
@@ -123,9 +126,9 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
|
|
|
123
126
|
}
|
|
124
127
|
return [4, API.entityService.retrieveEntityType()];
|
|
125
128
|
case 9:
|
|
126
|
-
entityTypes =
|
|
129
|
+
entityTypes = _k.sent();
|
|
127
130
|
thunkApi.dispatch(handleNextScreenStep('ENTITY_NAME_STEP'));
|
|
128
|
-
|
|
131
|
+
_k.label = 10;
|
|
129
132
|
case 10: return [2, {
|
|
130
133
|
data: data,
|
|
131
134
|
individualData: individualData,
|
|
@@ -135,8 +138,8 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
|
|
|
135
138
|
bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
|
|
136
139
|
entity: entityData === null || entityData === void 0 ? void 0 : entityData.entity,
|
|
137
140
|
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
138
|
-
name: (
|
|
139
|
-
contact: (
|
|
141
|
+
name: (_h = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _h === void 0 ? void 0 : _h.names,
|
|
142
|
+
contact: (_j = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _j === void 0 ? void 0 : _j.contact,
|
|
140
143
|
individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals,
|
|
141
144
|
business: boardData === null || boardData === void 0 ? void 0 : boardData.business,
|
|
142
145
|
entityTypes: entityTypes,
|
|
@@ -69,16 +69,16 @@ var _a;
|
|
|
69
69
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
70
70
|
import API from '../../../api';
|
|
71
71
|
import { FlowsTypes, IndividualGender, DocumentPurpose } from '../../../@types';
|
|
72
|
-
import { handleNextScreenStep, handlePrevScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
|
|
72
|
+
import { handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
|
|
73
73
|
import { defaultCountry, IDENTIFICATION_TYPE, INDIVIDUAl_STEP_NAMES } from '../../../constants';
|
|
74
74
|
import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, hasNoneEditableValue, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose, formatNumberAsCurrency, removeAllCharsFromNumber, mapUserList, sortUserList, getIndividualType } from '../../../utils';
|
|
75
75
|
export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a, thunkApi) {
|
|
76
76
|
var token = _a.token, isInternally = _a.isInternally, isUpdatePhoneInfo = _a.isUpdatePhoneInfo;
|
|
77
77
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
78
|
-
var payload, settings, data, boardData, individualData, countryCode, boardInfoData, boardInfoStatus, countries, board_id, board_info_id, notification, _b, id, type, data_1, birthCountry, individuals, _c, is_authorized, data_state;
|
|
79
|
-
var _d, _e, _f, _g, _h, _j, _k;
|
|
80
|
-
return __generator(this, function (
|
|
81
|
-
switch (
|
|
78
|
+
var payload, settings, data, boardData, individualData, countryCode, boardInfoData, boardInfoStatus, countries, publicKey, board_id, board_info_id, notification, _b, id, type, data_1, birthCountry, individuals, _c, is_authorized, data_state;
|
|
79
|
+
var _d, _e, _f, _g, _h, _j, _k, _l;
|
|
80
|
+
return __generator(this, function (_m) {
|
|
81
|
+
switch (_m.label) {
|
|
82
82
|
case 0:
|
|
83
83
|
payload = {
|
|
84
84
|
service_name: 'tap_email',
|
|
@@ -87,7 +87,7 @@ export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a
|
|
|
87
87
|
settings = thunkApi.getState().settings;
|
|
88
88
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
89
89
|
case 1:
|
|
90
|
-
data = (
|
|
90
|
+
data = (_m.sent()).data;
|
|
91
91
|
boardInfoStatus = undefined;
|
|
92
92
|
countries = settings.data.countries;
|
|
93
93
|
if (((_d = data.errors) === null || _d === void 0 ? void 0 : _d.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
|
|
@@ -98,6 +98,9 @@ export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a
|
|
|
98
98
|
countryCode = data === null || data === void 0 ? void 0 : data.country_code;
|
|
99
99
|
thunkApi.dispatch(handleSetCountryByIso2(countryCode));
|
|
100
100
|
}
|
|
101
|
+
publicKey = (_e = data === null || data === void 0 ? void 0 : data.config) === null || _e === void 0 ? void 0 : _e.public_key;
|
|
102
|
+
if (publicKey)
|
|
103
|
+
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
101
104
|
if (!(data.step_name === INDIVIDUAl_STEP_NAMES.PHONE_INFO)) return [3, 2];
|
|
102
105
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PHONE_INFO_STEP'));
|
|
103
106
|
return [3, 16];
|
|
@@ -108,54 +111,54 @@ export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a
|
|
|
108
111
|
if (!(board_id && board_info_id)) return [3, 5];
|
|
109
112
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
110
113
|
case 3:
|
|
111
|
-
boardInfoData =
|
|
114
|
+
boardInfoData = _m.sent();
|
|
112
115
|
notification = (boardInfoData || {}).notification;
|
|
113
116
|
_b = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _b.id, type = _b.type;
|
|
114
117
|
if (!(id && type)) return [3, 5];
|
|
115
118
|
return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode })).unwrap()];
|
|
116
119
|
case 4:
|
|
117
|
-
data_1 = (
|
|
120
|
+
data_1 = (_m.sent()).data;
|
|
118
121
|
individualData = data_1 || {};
|
|
119
|
-
|
|
122
|
+
_m.label = 5;
|
|
120
123
|
case 5:
|
|
121
124
|
if (!board_id) return [3, 7];
|
|
122
125
|
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
123
126
|
case 6:
|
|
124
|
-
boardData =
|
|
125
|
-
|
|
127
|
+
boardData = _m.sent();
|
|
128
|
+
_m.label = 7;
|
|
126
129
|
case 7:
|
|
127
130
|
if (!countryCode) {
|
|
128
|
-
countryCode = (
|
|
131
|
+
countryCode = (_f = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _f === void 0 ? void 0 : _f.country;
|
|
129
132
|
if (countryCode)
|
|
130
133
|
thunkApi.dispatch(handleSetCountryByIso2(countryCode));
|
|
131
134
|
}
|
|
132
135
|
if (!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized)) return [3, 11];
|
|
133
|
-
if (!((
|
|
134
|
-
return [4, thunkApi.dispatch(getIndividualList((
|
|
136
|
+
if (!((_g = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _g === void 0 ? void 0 : _g.id)) return [3, 9];
|
|
137
|
+
return [4, thunkApi.dispatch(getIndividualList((_h = boardData === null || boardData === void 0 ? void 0 : boardData.business) === null || _h === void 0 ? void 0 : _h.id))];
|
|
135
138
|
case 8:
|
|
136
|
-
|
|
137
|
-
|
|
139
|
+
_m.sent();
|
|
140
|
+
_m.label = 9;
|
|
138
141
|
case 9: return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
139
142
|
case 10:
|
|
140
|
-
boardInfoStatus =
|
|
143
|
+
boardInfoStatus = _m.sent();
|
|
141
144
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
|
|
142
145
|
return [3, 14];
|
|
143
146
|
case 11:
|
|
144
|
-
birthCountry = ((
|
|
147
|
+
birthCountry = ((_j = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _j === void 0 ? void 0 : _j.country) || countryCode;
|
|
145
148
|
if (!birthCountry) return [3, 13];
|
|
146
149
|
return [4, thunkApi.dispatch(getCityList(birthCountry))];
|
|
147
150
|
case 12:
|
|
148
|
-
|
|
149
|
-
|
|
151
|
+
_m.sent();
|
|
152
|
+
_m.label = 13;
|
|
150
153
|
case 13:
|
|
151
154
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP'));
|
|
152
|
-
|
|
155
|
+
_m.label = 14;
|
|
153
156
|
case 14: return [3, 16];
|
|
154
157
|
case 15:
|
|
155
158
|
if (isUpdatePhoneInfo) {
|
|
156
159
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_VERIFY_STEP'));
|
|
157
160
|
}
|
|
158
|
-
|
|
161
|
+
_m.label = 16;
|
|
159
162
|
case 16:
|
|
160
163
|
individuals = (boardData || {}).individuals;
|
|
161
164
|
_c = individualData || {}, is_authorized = _c.is_authorized, data_state = _c.data_state;
|
|
@@ -167,8 +170,8 @@ export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a
|
|
|
167
170
|
entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
|
|
168
171
|
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
169
172
|
merchant_id: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.merchant_id,
|
|
170
|
-
name: (
|
|
171
|
-
contact: (
|
|
173
|
+
name: (_k = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _k === void 0 ? void 0 : _k.names,
|
|
174
|
+
contact: (_l = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _l === void 0 ? void 0 : _l.contact,
|
|
172
175
|
individuals: is_authorized ? individuals : __assign(__assign({}, individuals), (!!data_state && { data_state: data_state })),
|
|
173
176
|
countries: countries,
|
|
174
177
|
countryCode: countryCode,
|
|
@@ -49,11 +49,11 @@ var _a;
|
|
|
49
49
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
50
50
|
import API from '../../../api';
|
|
51
51
|
import { FlowsTypes } from '../../../@types';
|
|
52
|
-
import { handleCurrentActiveScreen, handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
|
|
52
|
+
import { handleCurrentActiveScreen, handleNextScreenStep, handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
|
|
53
53
|
import { PASSWORD_OPERATION_TYPE, PASSWORD_STEP_NAMES } from '../../../constants';
|
|
54
54
|
import { retrieveIndividualData } from '../../../utils';
|
|
55
55
|
export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
56
|
-
var payload, data, boardStatusData, boardInfoData, boardData, individualData, _a, board_id, board_info_id, _b, id_1, type_1, serviceCallBack, _c, boardRes, individualRes, countryIso2, info, hasPasswordCompleted;
|
|
56
|
+
var payload, data, boardStatusData, boardInfoData, boardData, individualData, _a, board_id, board_info_id, config, publicKey, _b, id_1, type_1, serviceCallBack, _c, boardRes, individualRes, countryIso2, info, hasPasswordCompleted;
|
|
57
57
|
var _d, _e, _f, _g, _h;
|
|
58
58
|
return __generator(this, function (_j) {
|
|
59
59
|
switch (_j.label) {
|
|
@@ -67,7 +67,10 @@ export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', functio
|
|
|
67
67
|
data = (_j.sent()).data;
|
|
68
68
|
individualData = undefined;
|
|
69
69
|
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 8];
|
|
70
|
-
_a = data || {}, board_id = _a.id, board_info_id = _a.board_info_id;
|
|
70
|
+
_a = data || {}, board_id = _a.id, board_info_id = _a.board_info_id, config = _a.config;
|
|
71
|
+
publicKey = config === null || config === void 0 ? void 0 : config.public_key;
|
|
72
|
+
if (publicKey)
|
|
73
|
+
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
71
74
|
if (!board_id) return [3, 7];
|
|
72
75
|
if (!board_info_id) return [3, 3];
|
|
73
76
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
@@ -49,16 +49,16 @@ var _a;
|
|
|
49
49
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
50
50
|
import API from '../../../api';
|
|
51
51
|
import { DocumentPurpose, FlowsTypes } from '../../../@types';
|
|
52
|
-
import { handleNextScreenStep, handleCurrentActiveScreen, handleSetCountryByIso2, handlePrevScreenStep } from '../../../app/settings';
|
|
52
|
+
import { handleNextScreenStep, handleCurrentActiveScreen, handleSetCountryByIso2, handlePrevScreenStep, handlePublicKey } from '../../../app/settings';
|
|
53
53
|
import { TAX_STEP_NAMES } from '../../../constants';
|
|
54
54
|
import { getRecentDocumentBasedOnPurpose, hasNoneEditableValue, retrieveIndividualData, sleep } from '../../../utils';
|
|
55
55
|
export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a, thunkApi) {
|
|
56
56
|
var token = _a.token, isInternally = _a.isInternally;
|
|
57
57
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
58
|
-
var payload, data, boardData, boardInfoData, individualData, _b, id_1, type_1, serviceCallBack, _c, boardRes, individualRes, countryIso2;
|
|
59
|
-
var _d, _e, _f, _g;
|
|
60
|
-
return __generator(this, function (
|
|
61
|
-
switch (
|
|
58
|
+
var payload, data, boardData, boardInfoData, individualData, publicKey, _b, id_1, type_1, serviceCallBack, _c, boardRes, individualRes, countryIso2;
|
|
59
|
+
var _d, _e, _f, _g, _h;
|
|
60
|
+
return __generator(this, function (_j) {
|
|
61
|
+
switch (_j.label) {
|
|
62
62
|
case 0:
|
|
63
63
|
payload = {
|
|
64
64
|
service_name: 'tap_email',
|
|
@@ -66,31 +66,34 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a
|
|
|
66
66
|
};
|
|
67
67
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
68
68
|
case 1:
|
|
69
|
-
data = (
|
|
69
|
+
data = (_j.sent()).data;
|
|
70
70
|
individualData = undefined;
|
|
71
71
|
if (((_d = data === null || data === void 0 ? void 0 : data.errors) === null || _d === void 0 ? void 0 : _d.length) || (data === null || data === void 0 ? void 0 : data.mw_error))
|
|
72
72
|
throw new Error(data.errors[0].description || (data === null || data === void 0 ? void 0 : data.mw_error));
|
|
73
73
|
if (isInternally)
|
|
74
74
|
data.step_name = TAX_STEP_NAMES.TAX_INFO;
|
|
75
|
+
publicKey = (_e = data === null || data === void 0 ? void 0 : data.config) === null || _e === void 0 ? void 0 : _e.public_key;
|
|
76
|
+
if (publicKey)
|
|
77
|
+
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
75
78
|
if (!(data === null || data === void 0 ? void 0 : data.id)) return [3, 6];
|
|
76
79
|
if (!data.board_info_id) return [3, 3];
|
|
77
80
|
return [4, API.boardService.retrieveBoardInfo({ id: data.id, infoId: data.board_info_id })];
|
|
78
81
|
case 2:
|
|
79
|
-
boardInfoData =
|
|
80
|
-
|
|
82
|
+
boardInfoData = _j.sent();
|
|
83
|
+
_j.label = 3;
|
|
81
84
|
case 3: return [4, API.boardService.retrieveBoardDetails(data.id)];
|
|
82
85
|
case 4:
|
|
83
|
-
boardData =
|
|
84
|
-
_b = ((
|
|
86
|
+
boardData = _j.sent();
|
|
87
|
+
_b = ((_f = boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification) === null || _f === void 0 ? void 0 : _f.recipient) || {}, id_1 = _b.id, type_1 = _b.type;
|
|
85
88
|
serviceCallBack = function () { return API.individualService.retrieveIndividual(id_1, type_1); };
|
|
86
89
|
return [4, retrieveIndividualData(type_1, boardData, serviceCallBack)];
|
|
87
90
|
case 5:
|
|
88
|
-
_c =
|
|
91
|
+
_c = _j.sent(), boardRes = _c.boardRes, individualRes = _c.individualRes;
|
|
89
92
|
boardData = boardRes;
|
|
90
93
|
individualData = individualRes;
|
|
91
|
-
|
|
94
|
+
_j.label = 6;
|
|
92
95
|
case 6:
|
|
93
|
-
countryIso2 = (
|
|
96
|
+
countryIso2 = (_g = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _g === void 0 ? void 0 : _g.country;
|
|
94
97
|
if (countryIso2)
|
|
95
98
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
96
99
|
if (data.step_name === TAX_STEP_NAMES.PHONE_AUTH) {
|
|
@@ -102,7 +105,7 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (_a
|
|
|
102
105
|
return [2, {
|
|
103
106
|
data: data,
|
|
104
107
|
individualData: individualData,
|
|
105
|
-
boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (
|
|
108
|
+
boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_h = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _h === void 0 ? void 0 : _h.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, individuals: boardData === null || boardData === void 0 ? void 0 : boardData.individuals, business: boardData === null || boardData === void 0 ? void 0 : boardData.business, notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification }),
|
|
106
109
|
token: token
|
|
107
110
|
}];
|
|
108
111
|
}
|