@tap-payments/auth-jsconnect 2.0.15 → 2.0.21-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/@types/app.d.ts +5 -0
- package/build/api/board.d.ts +1 -0
- package/build/api/board.js +8 -1
- package/build/api/index.d.ts +1 -1
- package/build/api/lead.d.ts +0 -1
- package/build/api/lead.js +0 -5
- package/build/features/app/bank/bankStore.d.ts +4 -2
- package/build/features/app/bank/bankStore.js +47 -62
- package/build/features/app/business/businessStore.d.ts +2 -1
- package/build/features/app/business/businessStore.js +61 -63
- package/build/features/app/individual/individualStore.d.ts +14 -3
- package/build/features/app/individual/individualStore.js +81 -81
- package/build/features/app/password/passwordStore.d.ts +7 -5
- package/build/features/app/password/passwordStore.js +68 -96
- package/build/features/app/signIn/signInStore.js +2 -2
- package/build/features/app/tax/taxStore.d.ts +0 -1
- package/build/features/app/tax/taxStore.js +38 -49
- package/build/features/bank/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/business/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/individual/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +2 -2
- package/build/features/password/Password.js +2 -1
- package/build/features/password/screens/Success/Success.js +2 -2
- package/build/features/password/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +3 -2
- package/build/features/tax/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +4 -4
- package/build/features/tax/screens/Verify/Verify.js +1 -1
- package/build/utils/string.d.ts +1 -1
- package/build/utils/string.js +2 -2
- package/package.json +1 -1
package/build/@types/app.d.ts
CHANGED
package/build/api/board.d.ts
CHANGED
|
@@ -21,5 +21,6 @@ declare const boardService: {
|
|
|
21
21
|
updateBoard: ({ id, ...data }: UpdateBoardBody) => Promise<any>;
|
|
22
22
|
retrieveBoardInfo: ({ id, infoId }: RetrieveBoardInfoBody) => Promise<any>;
|
|
23
23
|
updateBoardInfo: ({ id, infoId, ...data }: UpdateBoardInfoBody) => Promise<any>;
|
|
24
|
+
retrieveBoardDetails: (id: string) => Promise<any>;
|
|
24
25
|
};
|
|
25
26
|
export { boardService };
|
package/build/api/board.js
CHANGED
|
@@ -24,6 +24,12 @@ var retrieveBoard = function (id) {
|
|
|
24
24
|
url: "".concat(ENDPOINT_PATHS.BOARD, "/").concat(id)
|
|
25
25
|
});
|
|
26
26
|
};
|
|
27
|
+
var retrieveBoardDetails = function (id) {
|
|
28
|
+
return httpClient({
|
|
29
|
+
method: 'get',
|
|
30
|
+
url: "".concat(ENDPOINT_PATHS.BOARD, "/").concat(id, "/details")
|
|
31
|
+
});
|
|
32
|
+
};
|
|
27
33
|
var updateBoard = function (_a) {
|
|
28
34
|
var id = _a.id, data = __rest(_a, ["id"]);
|
|
29
35
|
return httpClient({
|
|
@@ -44,6 +50,7 @@ var boardService = {
|
|
|
44
50
|
retrieveBoard: retrieveBoard,
|
|
45
51
|
updateBoard: updateBoard,
|
|
46
52
|
retrieveBoardInfo: retrieveBoardInfo,
|
|
47
|
-
updateBoardInfo: updateBoardInfo
|
|
53
|
+
updateBoardInfo: updateBoardInfo,
|
|
54
|
+
retrieveBoardDetails: retrieveBoardDetails
|
|
48
55
|
};
|
|
49
56
|
export { boardService };
|
package/build/api/index.d.ts
CHANGED
|
@@ -28,7 +28,6 @@ declare const API: {
|
|
|
28
28
|
retrieveLead: (leadId: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
29
29
|
verifyLeadToken: (data: LeadVerifyBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
30
30
|
verifyLeadOTP: (data: LeadOTPVerifyBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
31
|
-
updateLeadIdentity: ({ id, ...data }: LeadIdentityUpdateBody, config?: import("axios").AxiosRequestConfig<any> | undefined) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
32
31
|
retrieveEntityList: (leadId: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
33
32
|
};
|
|
34
33
|
entityService: {
|
|
@@ -68,6 +67,7 @@ declare const API: {
|
|
|
68
67
|
updateBoard: ({ id, ...data }: UpdateBoardBody) => Promise<any>;
|
|
69
68
|
retrieveBoardInfo: ({ id, infoId }: import("./board").RetrieveBoardInfoBody) => Promise<any>;
|
|
70
69
|
updateBoardInfo: ({ id, infoId, ...data }: import("./board").UpdateBoardInfoBody) => Promise<any>;
|
|
70
|
+
retrieveBoardDetails: (id: string) => Promise<any>;
|
|
71
71
|
};
|
|
72
72
|
userService: {
|
|
73
73
|
retrieveUserInfo: (userId: string) => Promise<any>;
|
package/build/api/lead.d.ts
CHANGED
|
@@ -88,7 +88,6 @@ declare const leadService: {
|
|
|
88
88
|
retrieveLead: (leadId: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
89
89
|
verifyLeadToken: (data: LeadVerifyBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
90
90
|
verifyLeadOTP: (data: LeadOTPVerifyBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
91
|
-
updateLeadIdentity: ({ id, ...data }: LeadIdentityUpdateBody, config?: AxiosRequestConfig) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
92
91
|
retrieveEntityList: (leadId: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
93
92
|
};
|
|
94
93
|
export { leadService };
|
package/build/api/lead.js
CHANGED
|
@@ -31,10 +31,6 @@ var verifyLeadToken = function (data, config) {
|
|
|
31
31
|
var verifyLeadOTP = function (data, config) {
|
|
32
32
|
return instance.put("".concat(ENDPOINT_PATHS.TOKEN_VERIFY), data, config);
|
|
33
33
|
};
|
|
34
|
-
var updateLeadIdentity = function (_a, config) {
|
|
35
|
-
var id = _a.id, data = __rest(_a, ["id"]);
|
|
36
|
-
return instance.put("".concat(ENDPOINT_PATHS.LEAD, "/").concat(id, "/identity"), data, config);
|
|
37
|
-
};
|
|
38
34
|
var retrieveEntityList = function (leadId) {
|
|
39
35
|
return instance.get("".concat(ENDPOINT_PATHS.RETRIEVE_ENTITY_LIST, "/").concat(leadId));
|
|
40
36
|
};
|
|
@@ -44,7 +40,6 @@ var leadService = {
|
|
|
44
40
|
retrieveLead: retrieveLead,
|
|
45
41
|
verifyLeadToken: verifyLeadToken,
|
|
46
42
|
verifyLeadOTP: verifyLeadOTP,
|
|
47
|
-
updateLeadIdentity: updateLeadIdentity,
|
|
48
43
|
retrieveEntityList: retrieveEntityList
|
|
49
44
|
};
|
|
50
45
|
export { leadService };
|
|
@@ -3,7 +3,9 @@ import { BankFormValues, FlowsTypes, OTPFormValues, ResponseData, SharedState }
|
|
|
3
3
|
import { CancelToken } from 'axios';
|
|
4
4
|
export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
5
5
|
data: any;
|
|
6
|
-
boardResponse:
|
|
6
|
+
boardResponse: {
|
|
7
|
+
flows: any;
|
|
8
|
+
};
|
|
7
9
|
token: string;
|
|
8
10
|
}, string, {}>;
|
|
9
11
|
export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
@@ -13,7 +15,7 @@ export declare const verifyBankLeadOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
13
15
|
data: any;
|
|
14
16
|
formData: OTPFormValues;
|
|
15
17
|
}, OTPFormValues, {}>;
|
|
16
|
-
export declare const
|
|
18
|
+
export declare const retrieveBoardDetails: import("@reduxjs/toolkit").AsyncThunk<{
|
|
17
19
|
data: any;
|
|
18
20
|
}, string, {}>;
|
|
19
21
|
export declare const createBankAccount: import("@reduxjs/toolkit").AsyncThunk<{
|
|
@@ -49,11 +49,10 @@ var _a;
|
|
|
49
49
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
50
50
|
import API from '../../../api';
|
|
51
51
|
import { FlowsTypes } from '../../../@types';
|
|
52
|
-
import { hasKey } from '../../../utils';
|
|
53
52
|
import { handleCurrentActiveScreen, handleNextScreenStep } from '../../../app/settings';
|
|
54
53
|
import { BANK_STEP_NAMES } from '../../../constants';
|
|
55
54
|
export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
56
|
-
var payload, data,
|
|
55
|
+
var payload, data, boardInfoData, board_id, board_info_id, info, hasBankCompleted;
|
|
57
56
|
var _a;
|
|
58
57
|
return __generator(this, function (_b) {
|
|
59
58
|
switch (_b.label) {
|
|
@@ -66,39 +65,30 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (t
|
|
|
66
65
|
case 1:
|
|
67
66
|
data = (_b.sent()).data;
|
|
68
67
|
boardInfoData = undefined;
|
|
69
|
-
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3,
|
|
70
|
-
return [4, API.boardService.retrieveBoard(data === null || data === void 0 ? void 0 : data.id)];
|
|
71
|
-
case 2:
|
|
72
|
-
boardData = _b.sent();
|
|
68
|
+
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 5];
|
|
73
69
|
board_id = data === null || data === void 0 ? void 0 : data.id;
|
|
74
70
|
board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
|
|
75
|
-
if (!(!!board_id && !!board_info_id)) return [3,
|
|
71
|
+
if (!(!!board_id && !!board_info_id)) return [3, 3];
|
|
76
72
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
77
|
-
case
|
|
73
|
+
case 2:
|
|
78
74
|
boardInfoData = _b.sent();
|
|
79
|
-
_b.label =
|
|
75
|
+
_b.label = 3;
|
|
76
|
+
case 3: return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
|
|
80
77
|
case 4:
|
|
81
|
-
steps = boardData.steps, entity = boardData.entity, business = boardData.business;
|
|
82
|
-
return [4, API.userService.retrieveUserInfo((_a = business === null || business === void 0 ? void 0 : business.user) === null || _a === void 0 ? void 0 : _a.id)];
|
|
83
|
-
case 5:
|
|
84
|
-
userData = _b.sent();
|
|
85
|
-
hasCompleted = hasKey(steps, BANK_STEP_NAMES.BANK_SUCCESS);
|
|
86
|
-
if (!(data.step_name === BANK_STEP_NAMES.PHONE_AUTH)) return [3, 6];
|
|
87
|
-
thunkApi.dispatch(handleCurrentActiveScreen('BANK_VERIFY_STEP'));
|
|
88
|
-
return [3, 9];
|
|
89
|
-
case 6:
|
|
90
|
-
if (!hasCompleted) return [3, 8];
|
|
91
|
-
return [4, thunkApi.dispatch(retrieveEntityInfo(entity === null || entity === void 0 ? void 0 : entity.id))];
|
|
92
|
-
case 7:
|
|
93
78
|
_b.sent();
|
|
94
|
-
|
|
95
|
-
return
|
|
96
|
-
|
|
97
|
-
|
|
79
|
+
info = boardInfoData.info;
|
|
80
|
+
hasBankCompleted = ((_a = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'bank'; })) === null || _a === void 0 ? void 0 : _a.status) === 'completed';
|
|
81
|
+
if (data.step_name === BANK_STEP_NAMES.PHONE_AUTH) {
|
|
82
|
+
thunkApi.dispatch(handleCurrentActiveScreen('BANK_VERIFY_STEP'));
|
|
83
|
+
}
|
|
84
|
+
else if (hasBankCompleted) {
|
|
85
|
+
thunkApi.dispatch(handleNextScreenStep('BANK_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
86
|
+
}
|
|
87
|
+
else if (data.step_name === BANK_STEP_NAMES.BANK_INFO) {
|
|
98
88
|
thunkApi.dispatch(handleNextScreenStep('BANK_BANK_DETAILS_STEP'));
|
|
99
89
|
}
|
|
100
|
-
_b.label =
|
|
101
|
-
case
|
|
90
|
+
_b.label = 5;
|
|
91
|
+
case 5: return [2, { data: data, boardResponse: { flows: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info }, token: token }];
|
|
102
92
|
}
|
|
103
93
|
});
|
|
104
94
|
}); });
|
|
@@ -120,13 +110,14 @@ export var resendOTP = createAsyncThunk('resendOTPBank', function (params, thunk
|
|
|
120
110
|
});
|
|
121
111
|
}); });
|
|
122
112
|
export var verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
123
|
-
var _a, bank, settings, responseBody, payload, data,
|
|
113
|
+
var _a, bank, settings, responseBody, flows, payload, data, hasBankCompleted;
|
|
124
114
|
var _b, _c, _d, _e;
|
|
125
115
|
return __generator(this, function (_f) {
|
|
126
116
|
switch (_f.label) {
|
|
127
117
|
case 0:
|
|
128
118
|
_a = thunkApi.getState(), bank = _a.bank, settings = _a.settings;
|
|
129
119
|
responseBody = bank.data.verify.responseBody;
|
|
120
|
+
flows = (responseBody || {}).flows;
|
|
130
121
|
payload = {
|
|
131
122
|
data: params.otp,
|
|
132
123
|
service_name: (_b = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_by) === null || _b === void 0 ? void 0 : _b.service_name,
|
|
@@ -137,31 +128,31 @@ export var verifyBankLeadOTP = createAsyncThunk('verifyBankLeadOTP', function (p
|
|
|
137
128
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
138
129
|
case 1:
|
|
139
130
|
data = (_f.sent()).data;
|
|
140
|
-
if (
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
thunkApi.dispatch(handleNextScreenStep('BANK_BANK_DETAILS_STEP'));
|
|
152
|
-
_f.label = 4;
|
|
153
|
-
case 4: return [2, { data: data, formData: params }];
|
|
131
|
+
if (!data.errors) {
|
|
132
|
+
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
|
|
133
|
+
hasBankCompleted = ((_e = flows === null || flows === void 0 ? void 0 : flows.find(function (flow) { return flow.name === 'bank'; })) === null || _e === void 0 ? void 0 : _e.status) === 'completed';
|
|
134
|
+
if (hasBankCompleted) {
|
|
135
|
+
thunkApi.dispatch(handleNextScreenStep('BANK_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
thunkApi.dispatch(handleNextScreenStep('BANK_BANK_DETAILS_STEP'));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return [2, { data: data, formData: params }];
|
|
154
142
|
}
|
|
155
143
|
});
|
|
156
144
|
}); });
|
|
157
|
-
export var
|
|
145
|
+
export var retrieveBoardDetails = createAsyncThunk('retrieveBankEntityInfo', function (boardId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
158
146
|
var data;
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
147
|
+
var _a, _b;
|
|
148
|
+
return __generator(this, function (_c) {
|
|
149
|
+
switch (_c.label) {
|
|
150
|
+
case 0: return [4, API.boardService.retrieveBoardDetails(boardId)];
|
|
162
151
|
case 1:
|
|
163
|
-
data =
|
|
164
|
-
return [2, {
|
|
152
|
+
data = _c.sent();
|
|
153
|
+
return [2, {
|
|
154
|
+
data: __assign(__assign({}, data), { user: data === null || data === void 0 ? void 0 : data.user, brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.name, contact: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.contact })
|
|
155
|
+
}];
|
|
165
156
|
}
|
|
166
157
|
});
|
|
167
158
|
}); });
|
|
@@ -232,13 +223,13 @@ export var checkIbanBank = createAsyncThunk('checkIbanBank', function (_a) {
|
|
|
232
223
|
});
|
|
233
224
|
});
|
|
234
225
|
export var updateBoardSuccess = createAsyncThunk('updateBoardBankSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
235
|
-
var _a, settings, bank, _b, id, infoId,
|
|
226
|
+
var _a, settings, bank, _b, id, infoId, payload, data;
|
|
236
227
|
var _c, _d, _e, _f;
|
|
237
228
|
return __generator(this, function (_g) {
|
|
238
229
|
switch (_g.label) {
|
|
239
230
|
case 0:
|
|
240
231
|
_a = thunkApi.getState(), settings = _a.settings, bank = _a.bank;
|
|
241
|
-
_b = bank.data.verify.responseBody || {}, id = _b.board_id, infoId = _b.board_info_id
|
|
232
|
+
_b = bank.data.verify.responseBody || {}, id = _b.board_id, infoId = _b.board_info_id;
|
|
242
233
|
if (!id)
|
|
243
234
|
return [2];
|
|
244
235
|
payload = {
|
|
@@ -249,7 +240,7 @@ export var updateBoardSuccess = createAsyncThunk('updateBoardBankSuccess', funct
|
|
|
249
240
|
return [4, API.boardService.updateBoardInfo(__assign({ id: id, infoId: infoId }, payload))];
|
|
250
241
|
case 1:
|
|
251
242
|
data = _g.sent();
|
|
252
|
-
return [4, thunkApi.dispatch(
|
|
243
|
+
return [4, thunkApi.dispatch(retrieveBoardDetails(id))];
|
|
253
244
|
case 2:
|
|
254
245
|
_g.sent();
|
|
255
246
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
|
|
@@ -355,23 +346,17 @@ export var bankSlice = createSlice({
|
|
|
355
346
|
state.loading = false;
|
|
356
347
|
state.error = action.error.message;
|
|
357
348
|
})
|
|
358
|
-
.addCase(
|
|
349
|
+
.addCase(retrieveBoardDetails.pending, function (state) {
|
|
359
350
|
state.error = null;
|
|
360
351
|
state.loading = true;
|
|
361
352
|
})
|
|
362
|
-
.addCase(
|
|
363
|
-
var _a;
|
|
353
|
+
.addCase(retrieveBoardDetails.fulfilled, function (state, action) {
|
|
364
354
|
state.error = null;
|
|
365
355
|
state.loading = false;
|
|
366
356
|
var data = (action.payload || {}).data;
|
|
367
|
-
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
368
|
-
if (description) {
|
|
369
|
-
state.error = description;
|
|
370
|
-
return;
|
|
371
|
-
}
|
|
372
357
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
|
|
373
358
|
})
|
|
374
|
-
.addCase(
|
|
359
|
+
.addCase(retrieveBoardDetails.rejected, function (state, action) {
|
|
375
360
|
state.error = action.error.message;
|
|
376
361
|
state.loading = false;
|
|
377
362
|
})
|
|
@@ -385,8 +370,8 @@ export var bankSlice = createSlice({
|
|
|
385
370
|
state.error = description;
|
|
386
371
|
return;
|
|
387
372
|
}
|
|
388
|
-
var flows = response.flows
|
|
389
|
-
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows
|
|
373
|
+
var flows = response.flows;
|
|
374
|
+
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), { flows: flows });
|
|
390
375
|
})
|
|
391
376
|
.addCase(updateBoardSuccess.pending, function (state) {
|
|
392
377
|
state.loading = true;
|
|
@@ -5,6 +5,7 @@ export declare const verifyLeadToken: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
5
5
|
leadData: any;
|
|
6
6
|
token: string;
|
|
7
7
|
brandInfo: any;
|
|
8
|
+
boardId: any;
|
|
8
9
|
}, string, {}>;
|
|
9
10
|
export declare const resendOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
10
11
|
data: any;
|
|
@@ -30,7 +31,7 @@ export declare const retrieveChannels: import("@reduxjs/toolkit").AsyncThunk<any
|
|
|
30
31
|
export declare const retrieveEntityList: import("@reduxjs/toolkit").AsyncThunk<any, {
|
|
31
32
|
leadId: string;
|
|
32
33
|
}, {}>;
|
|
33
|
-
export declare const
|
|
34
|
+
export declare const retrieveBoardDetails: import("@reduxjs/toolkit").AsyncThunk<{
|
|
34
35
|
data: any;
|
|
35
36
|
}, string, {}>;
|
|
36
37
|
export declare const updateLeadBusinessType: import("@reduxjs/toolkit").AsyncThunk<{
|
|
@@ -63,10 +63,10 @@ import { BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_CR_LICENSE, OTHER_FL_LI
|
|
|
63
63
|
import { convertNumbers2English, getEighteenYearsAgo, hasKey } from '../../../utils';
|
|
64
64
|
import { handleNextScreenStep } from '../../../app/settings';
|
|
65
65
|
export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
|
-
var payload, data, leadResponse, brandInfo, boardResponse, board_id, board_info_id, steps,
|
|
67
|
-
var _a, _b, _c, _d, _e, _f
|
|
68
|
-
return __generator(this, function (
|
|
69
|
-
switch (
|
|
66
|
+
var payload, data, leadResponse, brandInfo, boardResponse, board_id, board_info_id, steps, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted;
|
|
67
|
+
var _a, _b, _c, _d, _e, _f;
|
|
68
|
+
return __generator(this, function (_g) {
|
|
69
|
+
switch (_g.label) {
|
|
70
70
|
case 0:
|
|
71
71
|
payload = {
|
|
72
72
|
service_name: 'tap_email',
|
|
@@ -74,37 +74,36 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
|
|
|
74
74
|
};
|
|
75
75
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
76
76
|
case 1:
|
|
77
|
-
data = (
|
|
77
|
+
data = (_g.sent()).data;
|
|
78
78
|
leadResponse = undefined;
|
|
79
79
|
brandInfo = undefined;
|
|
80
80
|
boardResponse = undefined;
|
|
81
81
|
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 17];
|
|
82
82
|
return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
|
|
83
83
|
case 2:
|
|
84
|
-
leadResponse =
|
|
84
|
+
leadResponse = _g.sent();
|
|
85
85
|
board_id = (_a = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _a === void 0 ? void 0 : _a.board_id;
|
|
86
86
|
board_info_id = (_b = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _b === void 0 ? void 0 : _b.board_info_id;
|
|
87
87
|
if (!(!!board_id && !!board_info_id)) return [3, 4];
|
|
88
88
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
89
89
|
case 3:
|
|
90
|
-
boardResponse =
|
|
91
|
-
|
|
90
|
+
boardResponse = _g.sent();
|
|
91
|
+
_g.label = 4;
|
|
92
92
|
case 4:
|
|
93
93
|
if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH) {
|
|
94
94
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
|
|
95
95
|
}
|
|
96
96
|
if (!(data.step_name === 'business_info')) return [3, 17];
|
|
97
97
|
steps = (_c = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _c === void 0 ? void 0 : _c.steps;
|
|
98
|
-
|
|
99
|
-
brandID = (_g = (_f = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _f === void 0 ? void 0 : _f.brand) === null || _g === void 0 ? void 0 : _g.id;
|
|
98
|
+
brandID = (_e = (_d = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _d === void 0 ? void 0 : _d.brand) === null || _e === void 0 ? void 0 : _e.id;
|
|
100
99
|
hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
|
|
101
100
|
hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO);
|
|
102
101
|
hasBusinessCRActivitiesCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES);
|
|
103
102
|
hasBusinessCustomersCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CUSTOMERS);
|
|
104
103
|
if (!hasBusinessCompleted) return [3, 6];
|
|
105
|
-
return [4, thunkApi.dispatch(
|
|
104
|
+
return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
|
|
106
105
|
case 5:
|
|
107
|
-
|
|
106
|
+
_g.sent();
|
|
108
107
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
109
108
|
return [3, 17];
|
|
110
109
|
case 6:
|
|
@@ -119,31 +118,37 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
|
|
|
119
118
|
if (!hasBusinessCRActivitiesCompleted) return [3, 12];
|
|
120
119
|
return [4, thunkApi.dispatch(retrieveChannels())];
|
|
121
120
|
case 9:
|
|
122
|
-
|
|
121
|
+
_g.sent();
|
|
123
122
|
return [4, thunkApi.dispatch(retrieveDataList())];
|
|
124
123
|
case 10:
|
|
125
|
-
|
|
124
|
+
_g.sent();
|
|
126
125
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
|
|
127
126
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
128
127
|
case 11:
|
|
129
|
-
brandInfo =
|
|
128
|
+
brandInfo = _g.sent();
|
|
130
129
|
return [3, 17];
|
|
131
130
|
case 12:
|
|
132
131
|
if (!hasBusinessCRInfoCompleted) return [3, 15];
|
|
133
132
|
return [4, thunkApi.dispatch(retrieveChannels())];
|
|
134
133
|
case 13:
|
|
135
|
-
|
|
134
|
+
_g.sent();
|
|
136
135
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
137
136
|
case 14:
|
|
138
|
-
brandInfo =
|
|
137
|
+
brandInfo = _g.sent();
|
|
139
138
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
|
|
140
139
|
return [3, 17];
|
|
141
140
|
case 15: return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
|
|
142
141
|
case 16:
|
|
143
|
-
|
|
142
|
+
_g.sent();
|
|
144
143
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
|
|
145
|
-
|
|
146
|
-
case 17: return [2, {
|
|
144
|
+
_g.label = 17;
|
|
145
|
+
case 17: return [2, {
|
|
146
|
+
data: data,
|
|
147
|
+
leadData: __assign(__assign({}, leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data), { flows: boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info }),
|
|
148
|
+
token: token,
|
|
149
|
+
brandInfo: brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.brand,
|
|
150
|
+
boardId: (_f = leadResponse === null || leadResponse === void 0 ? void 0 : leadResponse.data) === null || _f === void 0 ? void 0 : _f.board_id
|
|
151
|
+
}];
|
|
147
152
|
}
|
|
148
153
|
});
|
|
149
154
|
}); });
|
|
@@ -166,9 +171,9 @@ export var resendOTP = createAsyncThunk('resendOTPBusiness', function (params, t
|
|
|
166
171
|
}); });
|
|
167
172
|
export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
168
173
|
var _a, business, settings, isNID, responseBody, verifyResponse, stepName, brandID, payload, data, brandInfo, steps, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted;
|
|
169
|
-
var _b, _c, _d, _e, _f, _g;
|
|
170
|
-
return __generator(this, function (
|
|
171
|
-
switch (
|
|
174
|
+
var _b, _c, _d, _e, _f, _g, _h;
|
|
175
|
+
return __generator(this, function (_j) {
|
|
176
|
+
switch (_j.label) {
|
|
172
177
|
case 0:
|
|
173
178
|
_a = thunkApi.getState(), business = _a.business, settings = _a.settings;
|
|
174
179
|
isNID = business.data.otpData.isNID;
|
|
@@ -178,21 +183,21 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
178
183
|
brandID = (_c = (_b = business.data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.brand) === null || _c === void 0 ? void 0 : _c.id;
|
|
179
184
|
payload = {
|
|
180
185
|
data: params.otp,
|
|
181
|
-
service_name: (_d = responseBody === null || responseBody === void 0 ? void 0 : responseBody.
|
|
182
|
-
verify_token: responseBody === null || responseBody === void 0 ? void 0 : responseBody.verify_token,
|
|
186
|
+
service_name: (_e = (_d = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_token) === null || _d === void 0 ? void 0 : _d.verification_by) === null || _e === void 0 ? void 0 : _e.service_name,
|
|
187
|
+
verify_token: (_f = responseBody === null || responseBody === void 0 ? void 0 : responseBody.verification_token) === null || _f === void 0 ? void 0 : _f.verify_token,
|
|
183
188
|
step_name: stepName,
|
|
184
189
|
encryption_contract: ['data']
|
|
185
190
|
};
|
|
186
191
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
187
192
|
case 1:
|
|
188
|
-
data = (
|
|
193
|
+
data = (_j.sent()).data;
|
|
189
194
|
brandInfo = undefined;
|
|
190
195
|
if (!!data.errors) return [3, 13];
|
|
191
196
|
thunkApi.dispatch(updateStepName(stepName));
|
|
192
197
|
return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
|
|
193
198
|
case 2:
|
|
194
|
-
|
|
195
|
-
(
|
|
199
|
+
_j.sent();
|
|
200
|
+
(_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
|
|
196
201
|
steps = responseBody === null || responseBody === void 0 ? void 0 : responseBody.steps;
|
|
197
202
|
hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
|
|
198
203
|
hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO);
|
|
@@ -203,9 +208,9 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
203
208
|
return [3, 13];
|
|
204
209
|
case 3:
|
|
205
210
|
if (!hasBusinessCompleted) return [3, 5];
|
|
206
|
-
return [4, thunkApi.dispatch(
|
|
211
|
+
return [4, thunkApi.dispatch(retrieveBoardDetails(verifyResponse === null || verifyResponse === void 0 ? void 0 : verifyResponse.board_id))];
|
|
207
212
|
case 4:
|
|
208
|
-
|
|
213
|
+
_j.sent();
|
|
209
214
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
210
215
|
return [3, 13];
|
|
211
216
|
case 5:
|
|
@@ -223,21 +228,21 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
223
228
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
|
|
224
229
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
225
230
|
case 8:
|
|
226
|
-
brandInfo =
|
|
231
|
+
brandInfo = _j.sent();
|
|
227
232
|
return [3, 13];
|
|
228
233
|
case 9:
|
|
229
234
|
if (!hasBusinessCRInfoCompleted) return [3, 12];
|
|
230
235
|
return [4, thunkApi.dispatch(retrieveChannels())];
|
|
231
236
|
case 10:
|
|
232
|
-
|
|
237
|
+
_j.sent();
|
|
233
238
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
234
239
|
case 11:
|
|
235
|
-
brandInfo =
|
|
240
|
+
brandInfo = _j.sent();
|
|
236
241
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
|
|
237
242
|
return [3, 13];
|
|
238
243
|
case 12:
|
|
239
244
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
|
|
240
|
-
|
|
245
|
+
_j.label = 13;
|
|
241
246
|
case 13: return [2, { data: data, formData: __assign(__assign({}, params), { isNID: isNID }), brandInfo: brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.brand }];
|
|
242
247
|
}
|
|
243
248
|
});
|
|
@@ -260,14 +265,12 @@ export var updateLeadIdentity = createAsyncThunk('updateLeadIdentity', function
|
|
|
260
265
|
step_name: stepName,
|
|
261
266
|
encryption_contract: ['country_code', 'identification_id', 'identification_id_type', 'date_of_birth']
|
|
262
267
|
};
|
|
263
|
-
return [4, API.leadService.
|
|
268
|
+
return [4, API.leadService.updateLead(requestBody)];
|
|
264
269
|
case 1:
|
|
265
|
-
data =
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody);
|
|
270
|
-
}
|
|
270
|
+
data = _e.sent();
|
|
271
|
+
thunkApi.dispatch(updateStepName(stepName));
|
|
272
|
+
thunkApi.dispatch(handleNextScreenStep());
|
|
273
|
+
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody);
|
|
271
274
|
return [2, { data: data, formData: __assign(__assign({}, params), { type: identification_id_type }) }];
|
|
272
275
|
}
|
|
273
276
|
});
|
|
@@ -290,12 +293,10 @@ export var resendOTPLeadIdentity = createAsyncThunk('resendOTPLeadIdentity', fun
|
|
|
290
293
|
step_name: stepName,
|
|
291
294
|
encryption_contract: ['country_code', 'identification_id', 'identification_id_type', 'date_of_birth']
|
|
292
295
|
};
|
|
293
|
-
return [4, API.leadService.
|
|
296
|
+
return [4, API.leadService.updateLead(requestBody)];
|
|
294
297
|
case 1:
|
|
295
|
-
data =
|
|
296
|
-
|
|
297
|
-
thunkApi.dispatch(updateStepName(stepName));
|
|
298
|
-
}
|
|
298
|
+
data = _d.sent();
|
|
299
|
+
thunkApi.dispatch(updateStepName(stepName));
|
|
299
300
|
return [2, data];
|
|
300
301
|
}
|
|
301
302
|
});
|
|
@@ -322,14 +323,17 @@ export var retrieveEntityList = createAsyncThunk('retrieveEntityList', function
|
|
|
322
323
|
}
|
|
323
324
|
});
|
|
324
325
|
}); });
|
|
325
|
-
export var
|
|
326
|
+
export var retrieveBoardDetails = createAsyncThunk('retrieveBoardDetails', function (boardID) { return __awaiter(void 0, void 0, void 0, function () {
|
|
326
327
|
var data;
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
328
|
+
var _a, _b;
|
|
329
|
+
return __generator(this, function (_c) {
|
|
330
|
+
switch (_c.label) {
|
|
331
|
+
case 0: return [4, API.boardService.retrieveBoardDetails(boardID)];
|
|
330
332
|
case 1:
|
|
331
|
-
data =
|
|
332
|
-
return [2, {
|
|
333
|
+
data = _c.sent();
|
|
334
|
+
return [2, {
|
|
335
|
+
data: __assign(__assign({}, data), { user: data === null || data === void 0 ? void 0 : data.user, brand: data === null || data === void 0 ? void 0 : data.brand, bank_account: data === null || data === void 0 ? void 0 : data.bank_account, entity: data === null || data === void 0 ? void 0 : data.entity, merchant: data === null || data === void 0 ? void 0 : data.merchant, name: (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.name, contact: (_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.contact })
|
|
336
|
+
}];
|
|
333
337
|
}
|
|
334
338
|
});
|
|
335
339
|
}); });
|
|
@@ -596,13 +600,13 @@ export var businessSlice = createSlice({
|
|
|
596
600
|
var _a, _b, _c, _d;
|
|
597
601
|
state.error = null;
|
|
598
602
|
state.customLoading = false;
|
|
599
|
-
var _e = action.payload, data = _e.data, token = _e.token, leadData = _e.leadData, brandInfo = _e.brandInfo;
|
|
603
|
+
var _e = action.payload, data = _e.data, token = _e.token, leadData = _e.leadData, brandInfo = _e.brandInfo, boardId = _e.boardId;
|
|
600
604
|
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
601
605
|
if (description) {
|
|
602
606
|
state.error = description;
|
|
603
607
|
return;
|
|
604
608
|
}
|
|
605
|
-
state.data.verify.responseBody = __assign(__assign(__assign({}, data), leadData), state.data.verify.responseBody);
|
|
609
|
+
state.data.verify.responseBody = __assign(__assign(__assign(__assign({}, data), leadData), state.data.verify.responseBody), { board_id: boardId });
|
|
606
610
|
state.data.verify.token = token;
|
|
607
611
|
state.data.otpData.isNID = false;
|
|
608
612
|
var _f = state.data.verify.responseBody || {}, entity = _f.entity, entity_activities = _f.entity_activities, business_type = _f.business_type;
|
|
@@ -787,23 +791,17 @@ export var businessSlice = createSlice({
|
|
|
787
791
|
state.error = action.error.message;
|
|
788
792
|
state.loading = false;
|
|
789
793
|
})
|
|
790
|
-
.addCase(
|
|
794
|
+
.addCase(retrieveBoardDetails.pending, function (state) {
|
|
791
795
|
state.error = null;
|
|
792
796
|
state.loading = true;
|
|
793
797
|
})
|
|
794
|
-
.addCase(
|
|
795
|
-
var _a;
|
|
798
|
+
.addCase(retrieveBoardDetails.fulfilled, function (state, action) {
|
|
796
799
|
state.error = null;
|
|
797
800
|
state.loading = false;
|
|
798
801
|
var data = (action.payload || {}).data;
|
|
799
|
-
var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
|
|
800
|
-
if (description) {
|
|
801
|
-
state.error = description;
|
|
802
|
-
return;
|
|
803
|
-
}
|
|
804
802
|
state.data.verify.responseBody = __assign(__assign({}, state.data.verify.responseBody), data);
|
|
805
803
|
})
|
|
806
|
-
.addCase(
|
|
804
|
+
.addCase(retrieveBoardDetails.rejected, function (state, action) {
|
|
807
805
|
state.error = action.error.message;
|
|
808
806
|
state.loading = false;
|
|
809
807
|
})
|