@tap-payments/auth-jsconnect 2.0.100-test → 2.0.101-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/api/index.d.ts +4 -2
- package/build/api/individual.d.ts +21 -0
- package/build/api/individual.js +28 -1
- package/build/features/app/individual/individualStore.d.ts +17 -0
- package/build/features/app/individual/individualStore.js +141 -66
- package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/individual/screens/Verify/Verify.js +4 -4
- package/package.json +1 -1
package/build/api/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { CheckEmailBody, CheckBrandBody } from './availabilityServices';
|
|
|
6
6
|
import { EntityInfoBody, EntityBankUpdateBody, UploadFileBody, DocumentUpdateBody, DocumentInfo } from './entity';
|
|
7
7
|
import { CreateAccountBody } from './account';
|
|
8
8
|
import { DataElementBody } from './data';
|
|
9
|
-
import { BrandListBody, UpdateBrandBody } from './individual';
|
|
9
|
+
import { BrandListBody, UpdateBrandBody, UpdateIndividualBody } from './individual';
|
|
10
10
|
import { UpdateBoardBody } from './board';
|
|
11
11
|
declare const API: {
|
|
12
12
|
ipService: {
|
|
@@ -85,6 +85,8 @@ declare const API: {
|
|
|
85
85
|
};
|
|
86
86
|
individualService: {
|
|
87
87
|
retrieveIndividualInfo: (id: string) => Promise<any>;
|
|
88
|
+
retrieveIndividual: (id: string, type: string) => Promise<any>;
|
|
89
|
+
updateIndividual: ({ id, type, ...data }: UpdateIndividualBody) => Promise<any>;
|
|
88
90
|
};
|
|
89
91
|
boardService: {
|
|
90
92
|
retrieveBoard: (id: string) => Promise<any>;
|
|
@@ -103,6 +105,6 @@ declare const API: {
|
|
|
103
105
|
updateBrandSales: ({ id, ...data }: import("./individual").UpdateSalesChannels) => void;
|
|
104
106
|
};
|
|
105
107
|
};
|
|
106
|
-
export type { ValidateOperatorBody, CreateAuthBody, VerifyAuthBody, CreateLeadBody, UpdateLeadBody, LeadVerifyBody, LeadOTPVerifyBody, CheckEmailBody, CheckBrandBody, LeadIdentityUpdateBody, EntityInfoBody, CreateAccountBody, EntityBankUpdateBody, CreatePasswordBody, BrandListBody, VerifyOperationAuthBody, ResetPasswordVerifyAuthBody, UpdateBoardBody, UpdateBrandBody, DataElementBody, UploadFileBody, DocumentUpdateBody, DocumentInfo, VerifyAuthKitOTPBody };
|
|
108
|
+
export type { ValidateOperatorBody, CreateAuthBody, VerifyAuthBody, CreateLeadBody, UpdateLeadBody, LeadVerifyBody, LeadOTPVerifyBody, CheckEmailBody, CheckBrandBody, LeadIdentityUpdateBody, EntityInfoBody, CreateAccountBody, EntityBankUpdateBody, CreatePasswordBody, BrandListBody, VerifyOperationAuthBody, ResetPasswordVerifyAuthBody, UpdateBoardBody, UpdateBrandBody, DataElementBody, UploadFileBody, DocumentUpdateBody, DocumentInfo, VerifyAuthKitOTPBody, UpdateIndividualBody };
|
|
107
109
|
export { setAxiosGlobalHeaders, removeAxiosGlobalHeaders, axiosInstance, getAxiosHeaders };
|
|
108
110
|
export default API;
|
|
@@ -62,7 +62,28 @@ export declare type UpdateSalesChannels = {
|
|
|
62
62
|
address: string;
|
|
63
63
|
}>;
|
|
64
64
|
};
|
|
65
|
+
export declare type UpdateIndividualBody = {
|
|
66
|
+
id: string;
|
|
67
|
+
type: string;
|
|
68
|
+
employer_name?: string;
|
|
69
|
+
employer_country?: string | null;
|
|
70
|
+
source_income?: Array<{
|
|
71
|
+
id?: string;
|
|
72
|
+
}>;
|
|
73
|
+
monthly_income?: {
|
|
74
|
+
id?: string;
|
|
75
|
+
};
|
|
76
|
+
is_relative_PEP?: boolean | null;
|
|
77
|
+
is_influencer?: boolean | null;
|
|
78
|
+
occupation?: {
|
|
79
|
+
id?: string;
|
|
80
|
+
};
|
|
81
|
+
step_name: string;
|
|
82
|
+
encryption_contract?: Array<string>;
|
|
83
|
+
};
|
|
65
84
|
declare const individualService: {
|
|
66
85
|
retrieveIndividualInfo: (id: string) => Promise<any>;
|
|
86
|
+
retrieveIndividual: (id: string, type: string) => Promise<any>;
|
|
87
|
+
updateIndividual: ({ id, type, ...data }: UpdateIndividualBody) => Promise<any>;
|
|
67
88
|
};
|
|
68
89
|
export { individualService };
|
package/build/api/individual.js
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import { ENDPOINT_PATHS } from '../constants';
|
|
2
13
|
import { httpClient } from './axios';
|
|
3
14
|
var retrieveIndividualInfo = function (id) {
|
|
@@ -6,7 +17,23 @@ var retrieveIndividualInfo = function (id) {
|
|
|
6
17
|
url: "".concat(ENDPOINT_PATHS.USER, "/").concat(id, "/info")
|
|
7
18
|
});
|
|
8
19
|
};
|
|
20
|
+
var retrieveIndividual = function (id, type) {
|
|
21
|
+
return httpClient({
|
|
22
|
+
method: 'get',
|
|
23
|
+
url: "".concat(ENDPOINT_PATHS.INDIVIDUAL, "/").concat(type, "/").concat(id)
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var updateIndividual = function (_a) {
|
|
27
|
+
var id = _a.id, type = _a.type, data = __rest(_a, ["id", "type"]);
|
|
28
|
+
return httpClient({
|
|
29
|
+
method: 'put',
|
|
30
|
+
url: "".concat(ENDPOINT_PATHS.INDIVIDUAL, "/").concat(type, "/").concat(id),
|
|
31
|
+
data: data
|
|
32
|
+
});
|
|
33
|
+
};
|
|
9
34
|
var individualService = {
|
|
10
|
-
retrieveIndividualInfo: retrieveIndividualInfo
|
|
35
|
+
retrieveIndividualInfo: retrieveIndividualInfo,
|
|
36
|
+
retrieveIndividual: retrieveIndividual,
|
|
37
|
+
updateIndividual: updateIndividual
|
|
11
38
|
};
|
|
12
39
|
export { individualService };
|
|
@@ -12,6 +12,7 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
12
12
|
contact: any;
|
|
13
13
|
countries: CountryCode[];
|
|
14
14
|
countryCode: any;
|
|
15
|
+
notification: any;
|
|
15
16
|
flows: {
|
|
16
17
|
name: string;
|
|
17
18
|
status: string;
|
|
@@ -33,6 +34,22 @@ export declare const retrieveBoardDetails: import("@reduxjs/toolkit").AsyncThunk
|
|
|
33
34
|
}, string, {}>;
|
|
34
35
|
export declare const verifyLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
35
36
|
data: any;
|
|
37
|
+
boardResponse: {
|
|
38
|
+
user: any;
|
|
39
|
+
brand: any;
|
|
40
|
+
bank_account: any;
|
|
41
|
+
entity: any;
|
|
42
|
+
merchant: any;
|
|
43
|
+
name: any;
|
|
44
|
+
contact: any;
|
|
45
|
+
countries: CountryCode[];
|
|
46
|
+
notification: any;
|
|
47
|
+
flows: {
|
|
48
|
+
name: string;
|
|
49
|
+
status: string;
|
|
50
|
+
url: string;
|
|
51
|
+
}[];
|
|
52
|
+
};
|
|
36
53
|
formData: {
|
|
37
54
|
otp: string;
|
|
38
55
|
};
|
|
@@ -49,13 +49,13 @@ var _a;
|
|
|
49
49
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
50
50
|
import API from '../../../api';
|
|
51
51
|
import { FlowsTypes } from '../../../@types';
|
|
52
|
-
import {
|
|
52
|
+
import { handleNextScreenStep } from '../../../app/settings';
|
|
53
53
|
import { BUSINESS_FLOW_SUCCESS, INDIVIDUAl_STEP_NAMES } from '../../../constants';
|
|
54
54
|
export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
|
-
var payload, settings, data, boardData, countryCode, boardInfoData, countries, board_id, board_info_id,
|
|
56
|
-
var
|
|
57
|
-
return __generator(this, function (
|
|
58
|
-
switch (
|
|
55
|
+
var payload, settings, data, boardData, individualData, countryCode, boardInfoData, 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
59
|
case 0:
|
|
60
60
|
payload = {
|
|
61
61
|
service_name: 'tap_email',
|
|
@@ -64,49 +64,59 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
|
|
|
64
64
|
settings = thunkApi.getState().settings;
|
|
65
65
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
66
66
|
case 1:
|
|
67
|
-
data = (
|
|
67
|
+
data = (_f.sent()).data;
|
|
68
68
|
boardInfoData = undefined;
|
|
69
69
|
countries = settings.data.countries;
|
|
70
|
-
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3,
|
|
70
|
+
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 10];
|
|
71
|
+
if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 10];
|
|
71
72
|
board_id = data === null || data === void 0 ? void 0 : data.id;
|
|
72
73
|
board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
|
|
73
|
-
if (!(
|
|
74
|
+
if (!(board_id && board_info_id)) return [3, 4];
|
|
74
75
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
75
76
|
case 2:
|
|
76
|
-
boardInfoData =
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
boardInfoData = _f.sent();
|
|
78
|
+
notification = (boardInfoData || {}).notification;
|
|
79
|
+
_a = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _a.id, type = _a.type;
|
|
80
|
+
if (!(id && type)) return [3, 4];
|
|
81
|
+
return [4, API.individualService.retrieveIndividual(id, type)];
|
|
82
|
+
case 3:
|
|
83
|
+
individualData = _f.sent();
|
|
84
|
+
_f.label = 4;
|
|
79
85
|
case 4:
|
|
80
|
-
|
|
81
|
-
entity = ((boardData === null || boardData === void 0 ? void 0 : boardData.business) || {}).entity;
|
|
82
|
-
countryCode = entity === null || entity === void 0 ? void 0 : entity.country;
|
|
86
|
+
countryCode = (_b = individualData === null || individualData === void 0 ? void 0 : individualData.user) === null || _b === void 0 ? void 0 : _b.nationality;
|
|
83
87
|
info = boardInfoData.info;
|
|
84
|
-
hasIndividualCompleted = ((
|
|
85
|
-
return [
|
|
88
|
+
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';
|
|
89
|
+
if (!hasIndividualCompleted) return [3, 7];
|
|
90
|
+
if (!board_id) return [3, 6];
|
|
91
|
+
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
86
92
|
case 5:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
case
|
|
93
|
+
boardData = _f.sent();
|
|
94
|
+
_f.label = 6;
|
|
95
|
+
case 6:
|
|
96
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
97
|
+
return [3, 10];
|
|
98
|
+
case 7:
|
|
99
|
+
if (!countryCode) return [3, 9];
|
|
100
|
+
return [4, thunkApi.dispatch(retrieveDataList(countryCode))];
|
|
101
|
+
case 8:
|
|
102
|
+
_f.sent();
|
|
103
|
+
_f.label = 9;
|
|
104
|
+
case 9:
|
|
105
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
|
|
106
|
+
_f.label = 10;
|
|
107
|
+
case 10: return [2, {
|
|
99
108
|
data: data,
|
|
100
109
|
boardResponse: {
|
|
101
|
-
user:
|
|
110
|
+
user: individualData === null || individualData === void 0 ? void 0 : individualData.user,
|
|
102
111
|
brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
|
|
103
112
|
bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
|
|
104
113
|
entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
|
|
105
114
|
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
106
|
-
name: (
|
|
107
|
-
contact: (
|
|
115
|
+
name: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.name,
|
|
116
|
+
contact: (_e = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _e === void 0 ? void 0 : _e.contact,
|
|
108
117
|
countries: countries,
|
|
109
118
|
countryCode: countryCode,
|
|
119
|
+
notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
|
|
110
120
|
flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info)
|
|
111
121
|
},
|
|
112
122
|
token: token
|
|
@@ -173,63 +183,107 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetai
|
|
|
173
183
|
});
|
|
174
184
|
}); });
|
|
175
185
|
export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
176
|
-
var _a, individual, settings, responseBody, payload, data,
|
|
177
|
-
var
|
|
178
|
-
return __generator(this, function (
|
|
179
|
-
switch (
|
|
186
|
+
var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData, individualData, boardData, countryCode, notification, _c, id, type, info, hasIndividualCompleted;
|
|
187
|
+
var _d, _e, _f, _g, _h, _j, _k;
|
|
188
|
+
return __generator(this, function (_l) {
|
|
189
|
+
switch (_l.label) {
|
|
180
190
|
case 0:
|
|
181
191
|
_a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
|
|
182
192
|
responseBody = individual.data.verify.responseBody;
|
|
193
|
+
_b = responseBody || {}, board_id = _b.board_id, board_info_id = _b.board_info_id;
|
|
194
|
+
countries = settings.data.countries;
|
|
183
195
|
payload = {
|
|
184
196
|
data: params.otp,
|
|
185
|
-
service_name: (
|
|
197
|
+
service_name: (_d = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _d === void 0 ? void 0 : _d.service_name,
|
|
186
198
|
verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
|
|
187
199
|
step_name: INDIVIDUAl_STEP_NAMES.PHONE_AUTH,
|
|
188
200
|
encryption_contract: ['data']
|
|
189
201
|
};
|
|
190
202
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
191
203
|
case 1:
|
|
192
|
-
data = (
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
204
|
+
data = (_l.sent()).data;
|
|
205
|
+
countryCode = undefined;
|
|
206
|
+
if (!!(data === null || data === void 0 ? void 0 : data.errors)) return [3, 10];
|
|
207
|
+
if (!(board_id && board_info_id)) return [3, 4];
|
|
208
|
+
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
209
|
+
case 2:
|
|
210
|
+
boardInfoData = _l.sent();
|
|
211
|
+
notification = (boardInfoData || {}).notification;
|
|
212
|
+
_c = (notification === null || notification === void 0 ? void 0 : notification.recipient) || {}, id = _c.id, type = _c.type;
|
|
213
|
+
if (!(id && type)) return [3, 4];
|
|
214
|
+
return [4, API.individualService.retrieveIndividual(id, type)];
|
|
215
|
+
case 3:
|
|
216
|
+
individualData = _l.sent();
|
|
217
|
+
_l.label = 4;
|
|
218
|
+
case 4:
|
|
219
|
+
countryCode = (_e = individualData === null || individualData === void 0 ? void 0 : individualData.user) === null || _e === void 0 ? void 0 : _e.nationality;
|
|
220
|
+
info = boardInfoData.info;
|
|
221
|
+
hasIndividualCompleted = ((_f = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _f === void 0 ? void 0 : _f.status) === 'completed';
|
|
222
|
+
(_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
|
|
223
|
+
if (!hasIndividualCompleted) return [3, 7];
|
|
224
|
+
if (!board_id) return [3, 6];
|
|
225
|
+
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
226
|
+
case 5:
|
|
227
|
+
boardData = _l.sent();
|
|
228
|
+
_l.label = 6;
|
|
229
|
+
case 6:
|
|
230
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
231
|
+
return [3, 10];
|
|
232
|
+
case 7:
|
|
233
|
+
if (!countryCode) return [3, 9];
|
|
234
|
+
return [4, thunkApi.dispatch(retrieveDataList(countryCode))];
|
|
235
|
+
case 8:
|
|
236
|
+
_l.sent();
|
|
237
|
+
_l.label = 9;
|
|
238
|
+
case 9:
|
|
239
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
|
|
240
|
+
_l.label = 10;
|
|
241
|
+
case 10: return [2, {
|
|
242
|
+
data: data,
|
|
243
|
+
boardResponse: {
|
|
244
|
+
user: individualData === null || individualData === void 0 ? void 0 : individualData.user,
|
|
245
|
+
brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand,
|
|
246
|
+
bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account,
|
|
247
|
+
entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity,
|
|
248
|
+
merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant,
|
|
249
|
+
name: (_j = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _j === void 0 ? void 0 : _j.name,
|
|
250
|
+
contact: (_k = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _k === void 0 ? void 0 : _k.contact,
|
|
251
|
+
countries: countries,
|
|
252
|
+
notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
|
|
253
|
+
flows: BUSINESS_FLOW_SUCCESS.concat(boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info)
|
|
254
|
+
},
|
|
255
|
+
formData: __assign({}, params)
|
|
256
|
+
}];
|
|
205
257
|
}
|
|
206
258
|
});
|
|
207
259
|
}); });
|
|
208
260
|
export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
209
|
-
var _a, settings, individual, requestBody, data;
|
|
210
|
-
var
|
|
211
|
-
return __generator(this, function (
|
|
212
|
-
switch (
|
|
261
|
+
var _a, settings, individual, _b, id, type, requestBody, data;
|
|
262
|
+
var _c, _d, _e, _f, _g, _h, _j, _k;
|
|
263
|
+
return __generator(this, function (_l) {
|
|
264
|
+
switch (_l.label) {
|
|
213
265
|
case 0:
|
|
214
266
|
_a = thunkApi.getState(), settings = _a.settings, individual = _a.individual;
|
|
267
|
+
_b = ((_d = (_c = individual.data.verify.responseBody) === null || _c === void 0 ? void 0 : _c.notification) === null || _d === void 0 ? void 0 : _d.recipient) || {}, id = _b.id, type = _b.type;
|
|
215
268
|
requestBody = {
|
|
216
|
-
id:
|
|
217
|
-
|
|
269
|
+
id: id,
|
|
270
|
+
type: type,
|
|
271
|
+
occupation: { id: (_e = params.occupation) === null || _e === void 0 ? void 0 : _e.id },
|
|
218
272
|
employer_name: params.employerName,
|
|
219
|
-
employer_country: (
|
|
220
|
-
source_income: [{ id: (
|
|
221
|
-
monthly_income: { id: (
|
|
273
|
+
employer_country: (_f = params.employerLocation) === null || _f === void 0 ? void 0 : _f.iso2,
|
|
274
|
+
source_income: [{ id: (_g = params.sourceIncome) === null || _g === void 0 ? void 0 : _g.id }],
|
|
275
|
+
monthly_income: { id: (_h = params.monthlyIncome) === null || _h === void 0 ? void 0 : _h.id },
|
|
222
276
|
is_relative_PEP: params.isPEP,
|
|
223
277
|
is_influencer: params.isInfluencer,
|
|
224
278
|
encryption_contract: ['employer_name', 'employer_country'],
|
|
225
279
|
step_name: INDIVIDUAl_STEP_NAMES.INDIVIDUAl_INFO
|
|
226
280
|
};
|
|
227
|
-
return [4, API.
|
|
281
|
+
return [4, API.individualService.updateIndividual(requestBody)];
|
|
228
282
|
case 1:
|
|
229
|
-
data = (
|
|
283
|
+
data = (_l.sent()).data;
|
|
230
284
|
if (!(data === null || data === void 0 ? void 0 : data.errors)) {
|
|
231
285
|
thunkApi.dispatch(handleNextScreenStep());
|
|
232
|
-
(
|
|
286
|
+
(_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, requestBody);
|
|
233
287
|
}
|
|
234
288
|
return [2, { data: data, formData: params }];
|
|
235
289
|
}
|
|
@@ -315,9 +369,9 @@ export var individualSlice = createSlice({
|
|
|
315
369
|
state.error = description;
|
|
316
370
|
return;
|
|
317
371
|
}
|
|
318
|
-
state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data),
|
|
372
|
+
state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), state.data.verify.responseBody), boardResponse), { board_id: data.id });
|
|
319
373
|
state.data.verify.token = token;
|
|
320
|
-
var _c = boardResponse || {}, countries = _c.countries,
|
|
374
|
+
var _c = boardResponse || {}, countries = _c.countries, user = _c.user;
|
|
321
375
|
var _d = user || {}, source_income = _d.source_income, monthly_income = _d.monthly_income, occupation = _d.occupation, is_relative_PEP = _d.is_relative_PEP, is_influencer = _d.is_influencer;
|
|
322
376
|
var _e = state.data.individualData.responseBody || {}, sourceIncomeList = _e.sourceIncomeList, monthlyIncomeList = _e.monthlyIncomeList, occupationList = _e.occupationList;
|
|
323
377
|
var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a; return (source === null || source === void 0 ? void 0 : source.id) === ((_a = source_income === null || source_income === void 0 ? void 0 : source_income[0]) === null || _a === void 0 ? void 0 : _a.id); })) ||
|
|
@@ -328,7 +382,7 @@ export var individualSlice = createSlice({
|
|
|
328
382
|
(monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList[2]);
|
|
329
383
|
if (!!selectedMonthlyIncome)
|
|
330
384
|
state.data.individualData.monthlyIncome = selectedMonthlyIncome;
|
|
331
|
-
var code =
|
|
385
|
+
var code = user === null || user === void 0 ? void 0 : user.employer_country;
|
|
332
386
|
if (!!code) {
|
|
333
387
|
var employerLocation = (countries || []).find(function (country) { return country.iso2 === code; });
|
|
334
388
|
state.data.individualData.employerLocation = employerLocation;
|
|
@@ -368,7 +422,7 @@ export var individualSlice = createSlice({
|
|
|
368
422
|
var _a;
|
|
369
423
|
state.loading = false;
|
|
370
424
|
state.error = null;
|
|
371
|
-
var _b = action.payload, data = _b.data, formData = _b.formData;
|
|
425
|
+
var _b = action.payload, data = _b.data, formData = _b.formData, boardResponse = _b.boardResponse;
|
|
372
426
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
373
427
|
if (description) {
|
|
374
428
|
state.error = description;
|
|
@@ -376,7 +430,28 @@ export var individualSlice = createSlice({
|
|
|
376
430
|
}
|
|
377
431
|
state.data.otpData = formData;
|
|
378
432
|
state.data.otpData.responseBody = data;
|
|
379
|
-
state.data.
|
|
433
|
+
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), boardResponse);
|
|
434
|
+
var _c = boardResponse || {}, countries = _c.countries, user = _c.user;
|
|
435
|
+
var _d = user || {}, source_income = _d.source_income, monthly_income = _d.monthly_income, occupation = _d.occupation, is_relative_PEP = _d.is_relative_PEP, is_influencer = _d.is_influencer;
|
|
436
|
+
var _e = state.data.individualData.responseBody || {}, sourceIncomeList = _e.sourceIncomeList, monthlyIncomeList = _e.monthlyIncomeList, occupationList = _e.occupationList;
|
|
437
|
+
var selectedSourceIncome = (sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList.find(function (source) { var _a; return (source === null || source === void 0 ? void 0 : source.id) === ((_a = source_income === null || source_income === void 0 ? void 0 : source_income[0]) === null || _a === void 0 ? void 0 : _a.id); })) ||
|
|
438
|
+
(sourceIncomeList === null || sourceIncomeList === void 0 ? void 0 : sourceIncomeList[0]);
|
|
439
|
+
if (!!selectedSourceIncome)
|
|
440
|
+
state.data.individualData.sourceIncome = selectedSourceIncome;
|
|
441
|
+
var selectedMonthlyIncome = (monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList.find(function (income) { return (income === null || income === void 0 ? void 0 : income.id) === (monthly_income === null || monthly_income === void 0 ? void 0 : monthly_income.id); })) ||
|
|
442
|
+
(monthlyIncomeList === null || monthlyIncomeList === void 0 ? void 0 : monthlyIncomeList[2]);
|
|
443
|
+
if (!!selectedMonthlyIncome)
|
|
444
|
+
state.data.individualData.monthlyIncome = selectedMonthlyIncome;
|
|
445
|
+
var code = user === null || user === void 0 ? void 0 : user.employer_country;
|
|
446
|
+
if (!!code) {
|
|
447
|
+
var employerLocation = (countries || []).find(function (country) { return country.iso2 === code; });
|
|
448
|
+
state.data.individualData.employerLocation = employerLocation;
|
|
449
|
+
}
|
|
450
|
+
var selectedOccupation = (occupationList === null || occupationList === void 0 ? void 0 : occupationList.find(function (o) { return (o === null || o === void 0 ? void 0 : o.id) === (occupation === null || occupation === void 0 ? void 0 : occupation.id); })) || (occupationList === null || occupationList === void 0 ? void 0 : occupationList[0]);
|
|
451
|
+
if (!!selectedOccupation)
|
|
452
|
+
state.data.individualData.occupation = selectedOccupation;
|
|
453
|
+
state.data.individualData.isPEP = is_relative_PEP;
|
|
454
|
+
state.data.individualData.isInfluencer = is_influencer;
|
|
380
455
|
})
|
|
381
456
|
.addCase(verifyLeadOTP.rejected, function (state, action) {
|
|
382
457
|
state.loading = false;
|
|
@@ -48,7 +48,7 @@ var SuccessWithFlowButtons = function () {
|
|
|
48
48
|
var t = useTranslation().t;
|
|
49
49
|
var isAr = useLanguage().isAr;
|
|
50
50
|
var data = useAppSelector(individualSelector).data;
|
|
51
|
-
var _e = data.verify.responseBody || {}, flows = _e.flows, nameObj = _e.name, entity = _e.entity, brand = _e.brand, bank = _e.bank_account, merchant = _e.merchant,
|
|
51
|
+
var _e = data.verify.responseBody || {}, flows = _e.flows, nameObj = _e.name, entity = _e.entity, brand = _e.brand, bank = _e.bank_account, merchant = _e.merchant, user = _e.user;
|
|
52
52
|
var _f = useState([]), buttons = _f[0], setButtons = _f[1];
|
|
53
53
|
var username = ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.first) || '') + ' ' + ((nameObj === null || nameObj === void 0 ? void 0 : nameObj.last) || '');
|
|
54
54
|
var licenseNumber = ((_a = entity === null || entity === void 0 ? void 0 : entity.license) === null || _a === void 0 ? void 0 : _a.number) || '';
|
|
@@ -58,7 +58,7 @@ var SuccessWithFlowButtons = function () {
|
|
|
58
58
|
var brandName = (isAr ? (_b = brand === null || brand === void 0 ? void 0 : brand.name) === null || _b === void 0 ? void 0 : _b.ar : (_c = brand === null || brand === void 0 ? void 0 : brand.name) === null || _c === void 0 ? void 0 : _c.en) || '';
|
|
59
59
|
var isAcceptance = merchant === null || merchant === void 0 ? void 0 : merchant.is_acceptance_allowed;
|
|
60
60
|
var isPayout = merchant === null || merchant === void 0 ? void 0 : merchant.is_payout_allowed;
|
|
61
|
-
var identification = user.identification;
|
|
61
|
+
var identification = (user || {}).identification;
|
|
62
62
|
var maskedId = !!(identification === null || identification === void 0 ? void 0 : identification.id) ? " ".concat(t('masking_symbols')).concat((_d = identification === null || identification === void 0 ? void 0 : identification.id) === null || _d === void 0 ? void 0 : _d.slice(-2)) : '';
|
|
63
63
|
var settings = useAppSelector(settingsSelector);
|
|
64
64
|
var _g = data.verify.responseBody || { contact: {}, board_id: '' }, contact = _g.contact, board_id = _g.board_id, board_info_id = _g.board_info_id;
|
|
@@ -47,9 +47,9 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
47
47
|
flexDirection: 'column'
|
|
48
48
|
}); });
|
|
49
49
|
var VerifyNumber = function (_a) {
|
|
50
|
-
var _b, _c
|
|
50
|
+
var _b, _c;
|
|
51
51
|
var dispatch = useAppDispatch();
|
|
52
|
-
var
|
|
52
|
+
var _d = useAppSelector(individualSelector), data = _d.data, loading = _d.loading, error = _d.error;
|
|
53
53
|
var methods = useForm({
|
|
54
54
|
resolver: yupResolver(OTPValidation),
|
|
55
55
|
defaultValues: data.otpData,
|
|
@@ -57,8 +57,8 @@ var VerifyNumber = function (_a) {
|
|
|
57
57
|
});
|
|
58
58
|
var t = useTranslation().t;
|
|
59
59
|
var isAr = useLanguage().isAr;
|
|
60
|
-
var
|
|
61
|
-
var phone = (
|
|
60
|
+
var _e = React.useState(false), resendLoading = _e[0], setResendLoading = _e[1];
|
|
61
|
+
var phone = (_c = (_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.verification_by) === null || _c === void 0 ? void 0 : _c.sent_to;
|
|
62
62
|
React.useEffect(function () {
|
|
63
63
|
if (error && methods.formState.isValid && phone)
|
|
64
64
|
dispatch(clearError());
|