@tap-payments/auth-jsconnect 2.1.10-test → 2.1.11-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/board.d.ts +1 -0
- package/build/api/board.js +8 -1
- package/build/api/index.d.ts +1 -0
- package/build/constants/validation.d.ts +1 -0
- package/build/constants/validation.js +1 -0
- package/build/features/app/bank/bankStore.js +13 -10
- package/build/features/app/business/businessStore.js +49 -51
- package/build/features/app/entity/entityStore.js +37 -42
- package/build/features/app/individual/individualStore.js +47 -38
- package/build/features/app/password/passwordStore.js +19 -20
- package/build/features/app/tax/taxStore.js +13 -10
- package/build/features/bank/screens/BankDetails/BankDetails.js +13 -6
- package/build/features/bank/screens/BankDetails/validation.d.ts +22 -0
- package/build/features/bank/screens/BankDetails/validation.js +29 -2
- package/package.json +1 -1
package/build/api/board.d.ts
CHANGED
|
@@ -22,5 +22,6 @@ declare const boardService: {
|
|
|
22
22
|
retrieveBoardInfo: ({ id, infoId }: RetrieveBoardInfoBody) => Promise<any>;
|
|
23
23
|
updateBoardInfo: ({ id, infoId, ...data }: UpdateBoardInfoBody) => Promise<any>;
|
|
24
24
|
retrieveBoardDetails: (id: string) => Promise<any>;
|
|
25
|
+
retrieveBoardInfoStatus: (id: string) => Promise<any>;
|
|
25
26
|
};
|
|
26
27
|
export { boardService };
|
package/build/api/board.js
CHANGED
|
@@ -18,6 +18,12 @@ var retrieveBoardInfo = function (_a) {
|
|
|
18
18
|
url: "".concat(ENDPOINT_PATHS.BOARD, "/").concat(id, "/info/collect/").concat(infoId)
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
|
+
var retrieveBoardInfoStatus = function (id) {
|
|
22
|
+
return httpClient({
|
|
23
|
+
method: 'get',
|
|
24
|
+
url: "".concat(ENDPOINT_PATHS.BOARD, "/").concat(id, "/info/status")
|
|
25
|
+
});
|
|
26
|
+
};
|
|
21
27
|
var retrieveBoard = function (id) {
|
|
22
28
|
return httpClient({
|
|
23
29
|
method: 'get',
|
|
@@ -51,6 +57,7 @@ var boardService = {
|
|
|
51
57
|
updateBoard: updateBoard,
|
|
52
58
|
retrieveBoardInfo: retrieveBoardInfo,
|
|
53
59
|
updateBoardInfo: updateBoardInfo,
|
|
54
|
-
retrieveBoardDetails: retrieveBoardDetails
|
|
60
|
+
retrieveBoardDetails: retrieveBoardDetails,
|
|
61
|
+
retrieveBoardInfoStatus: retrieveBoardInfoStatus
|
|
55
62
|
};
|
|
56
63
|
export { boardService };
|
package/build/api/index.d.ts
CHANGED
|
@@ -97,6 +97,7 @@ declare const API: {
|
|
|
97
97
|
retrieveBoardInfo: ({ id, infoId }: import("./board").RetrieveBoardInfoBody) => Promise<any>;
|
|
98
98
|
updateBoardInfo: ({ id, infoId, ...data }: import("./board").UpdateBoardInfoBody) => Promise<any>;
|
|
99
99
|
retrieveBoardDetails: (id: string) => Promise<any>;
|
|
100
|
+
retrieveBoardInfoStatus: (id: string) => Promise<any>;
|
|
100
101
|
};
|
|
101
102
|
userService: {
|
|
102
103
|
retrieveUserInfo: (userId: string) => Promise<any>;
|
|
@@ -52,7 +52,7 @@ import { FlowsTypes } from '../../../@types';
|
|
|
52
52
|
import { handleCurrentActiveScreen, handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
|
|
53
53
|
import { BANK_STEP_NAMES, BUSINESS_FLOW_SUCCESS } from '../../../constants';
|
|
54
54
|
export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
|
-
var payload, data, boardInfoData, boardData, board_id,
|
|
55
|
+
var payload, data, boardInfoData, boardData, board_id, countryIso2, info, hasBankCompleted;
|
|
56
56
|
var _a, _b, _c, _d;
|
|
57
57
|
return __generator(this, function (_e) {
|
|
58
58
|
switch (_e.label) {
|
|
@@ -67,15 +67,15 @@ export var verifyLeadToken = createAsyncThunk('bankVerifyLeadToken', function (t
|
|
|
67
67
|
boardData = undefined;
|
|
68
68
|
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 5];
|
|
69
69
|
board_id = data === null || data === void 0 ? void 0 : data.id;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
70
|
+
if (!board_id) return [3, 4];
|
|
71
|
+
return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
73
72
|
case 2:
|
|
74
73
|
boardInfoData = _e.sent();
|
|
75
|
-
|
|
76
|
-
case 3:
|
|
77
|
-
case 4:
|
|
74
|
+
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
75
|
+
case 3:
|
|
78
76
|
boardData = _e.sent();
|
|
77
|
+
_e.label = 4;
|
|
78
|
+
case 4:
|
|
79
79
|
countryIso2 = (_a = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _a === void 0 ? void 0 : _a.country;
|
|
80
80
|
if (countryIso2)
|
|
81
81
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
@@ -252,7 +252,7 @@ export var uploadBankStatement = createAsyncThunk('uploadBankStatement', functio
|
|
|
252
252
|
});
|
|
253
253
|
});
|
|
254
254
|
export var updateBoardSuccess = createAsyncThunk('updateBoardBankSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
255
|
-
var _a, settings, bank, _b, id, infoId, payload, data;
|
|
255
|
+
var _a, settings, bank, _b, id, infoId, payload, data, boardInfoData;
|
|
256
256
|
var _c, _d, _e, _f;
|
|
257
257
|
return __generator(this, function (_g) {
|
|
258
258
|
switch (_g.label) {
|
|
@@ -269,13 +269,16 @@ export var updateBoardSuccess = createAsyncThunk('updateBoardBankSuccess', funct
|
|
|
269
269
|
return [4, API.boardService.updateBoardInfo(__assign({ id: id, infoId: infoId }, payload))];
|
|
270
270
|
case 1:
|
|
271
271
|
data = _g.sent();
|
|
272
|
-
return [4,
|
|
272
|
+
return [4, API.boardService.retrieveBoardInfoStatus(id)];
|
|
273
273
|
case 2:
|
|
274
|
+
boardInfoData = _g.sent();
|
|
275
|
+
return [4, thunkApi.dispatch(retrieveBoardDetails(id))];
|
|
276
|
+
case 3:
|
|
274
277
|
_g.sent();
|
|
275
278
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
|
|
276
279
|
(_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
|
|
277
280
|
thunkApi.dispatch(handleNextScreenStep());
|
|
278
|
-
return [2, { response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat((
|
|
281
|
+
return [2, { response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat((boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || []) }), formData: params }];
|
|
279
282
|
}
|
|
280
283
|
});
|
|
281
284
|
}); });
|
|
@@ -63,7 +63,7 @@ import { BUSINESS_FLOW_SUCCESS, BUSINESS_STEP_NAMES, IDENTIFICATION_TYPE, OTHER_
|
|
|
63
63
|
import { convertNumbers2English, getEighteenYearsAgo, hasKey, sleep, isKW, isSA, dateFormat } from '../../../utils';
|
|
64
64
|
import { handleNextScreenStep, handleSetCountryByIso2 } 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, countryIso2, boardData, brandData, leadData, entity_activities, steps, brand, board_id,
|
|
66
|
+
var payload, data, countryIso2, boardData, brandData, leadData, entity_activities, steps, brand, board_id, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, activityList;
|
|
67
67
|
var _a;
|
|
68
68
|
return __generator(this, function (_b) {
|
|
69
69
|
switch (_b.label) {
|
|
@@ -82,7 +82,7 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
|
|
|
82
82
|
countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
|
|
83
83
|
if (countryIso2)
|
|
84
84
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
85
|
-
if (!(data.step_name !== BUSINESS_STEP_NAMES.PHONE_AUTH)) return [3,
|
|
85
|
+
if (!(data.step_name !== BUSINESS_STEP_NAMES.PHONE_AUTH)) return [3, 19];
|
|
86
86
|
boardData = undefined;
|
|
87
87
|
brandData = undefined;
|
|
88
88
|
return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
|
|
@@ -97,8 +97,8 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
|
|
|
97
97
|
if (data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH && !isKW(countryIso2)) {
|
|
98
98
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
|
|
99
99
|
}
|
|
100
|
-
if (!(data.step_name === BUSINESS_STEP_NAMES.BUSINESS_INFO)) return [3,
|
|
101
|
-
entity_activities = leadData.entity_activities, steps = leadData.steps, brand = leadData.brand, board_id = leadData.board_id
|
|
100
|
+
if (!(data.step_name === BUSINESS_STEP_NAMES.BUSINESS_INFO)) return [3, 18];
|
|
101
|
+
entity_activities = leadData.entity_activities, steps = leadData.steps, brand = leadData.brand, board_id = leadData.board_id;
|
|
102
102
|
brandID = brand === null || brand === void 0 ? void 0 : brand.id;
|
|
103
103
|
hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
|
|
104
104
|
hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO) && hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM);
|
|
@@ -111,63 +111,60 @@ export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', functio
|
|
|
111
111
|
leadData = __assign(__assign({}, leadData), { entity_activities: activityList });
|
|
112
112
|
_b.label = 4;
|
|
113
113
|
case 4:
|
|
114
|
-
if (!hasBusinessCompleted) return [3,
|
|
115
|
-
if (!
|
|
116
|
-
return [4, API.boardService.
|
|
114
|
+
if (!hasBusinessCompleted) return [3, 8];
|
|
115
|
+
if (!board_id) return [3, 7];
|
|
116
|
+
return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
117
117
|
case 5:
|
|
118
118
|
boardData = _b.sent();
|
|
119
|
-
_b.label = 6;
|
|
120
|
-
case 6:
|
|
121
|
-
if (!board_id) return [3, 8];
|
|
122
119
|
return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
|
|
123
|
-
case
|
|
120
|
+
case 6:
|
|
124
121
|
_b.sent();
|
|
125
|
-
_b.label =
|
|
126
|
-
case
|
|
122
|
+
_b.label = 7;
|
|
123
|
+
case 7:
|
|
127
124
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
128
|
-
return [3,
|
|
129
|
-
case
|
|
130
|
-
if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3,
|
|
125
|
+
return [3, 18];
|
|
126
|
+
case 8:
|
|
127
|
+
if (!(data.step_name === BUSINESS_STEP_NAMES.IDENTITY_AUTH)) return [3, 9];
|
|
131
128
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_IDBOD_STEP'));
|
|
132
|
-
return [3,
|
|
133
|
-
case
|
|
134
|
-
if (!hasBusinessCustomersCompleted) return [3,
|
|
129
|
+
return [3, 18];
|
|
130
|
+
case 9:
|
|
131
|
+
if (!hasBusinessCustomersCompleted) return [3, 10];
|
|
135
132
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_STEP'));
|
|
136
|
-
return [3,
|
|
137
|
-
case
|
|
138
|
-
if (!hasBusinessCRActivitiesCompleted) return [3,
|
|
133
|
+
return [3, 18];
|
|
134
|
+
case 10:
|
|
135
|
+
if (!hasBusinessCRActivitiesCompleted) return [3, 13];
|
|
139
136
|
return [4, thunkApi.dispatch(retrieveDataList())];
|
|
140
|
-
case
|
|
137
|
+
case 11:
|
|
141
138
|
_b.sent();
|
|
142
139
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP'));
|
|
143
140
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
144
|
-
case
|
|
141
|
+
case 12:
|
|
145
142
|
brandData = _b.sent();
|
|
146
|
-
return [3,
|
|
147
|
-
case
|
|
148
|
-
if (!hasBusinessCRInfoCompleted) return [3,
|
|
143
|
+
return [3, 18];
|
|
144
|
+
case 13:
|
|
145
|
+
if (!hasBusinessCRInfoCompleted) return [3, 15];
|
|
149
146
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
150
|
-
case
|
|
147
|
+
case 14:
|
|
151
148
|
brandData = _b.sent();
|
|
152
149
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP'));
|
|
153
|
-
return [3,
|
|
154
|
-
case
|
|
155
|
-
if (!isSA(countryIso2)) return [3,
|
|
150
|
+
return [3, 18];
|
|
151
|
+
case 15:
|
|
152
|
+
if (!isSA(countryIso2)) return [3, 17];
|
|
156
153
|
return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
|
|
157
|
-
case
|
|
154
|
+
case 16:
|
|
158
155
|
_b.sent();
|
|
159
|
-
_b.label =
|
|
160
|
-
case
|
|
156
|
+
_b.label = 17;
|
|
157
|
+
case 17:
|
|
161
158
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP'));
|
|
162
|
-
_b.label =
|
|
163
|
-
case
|
|
159
|
+
_b.label = 18;
|
|
160
|
+
case 18: return [2, {
|
|
164
161
|
data: data,
|
|
165
162
|
leadData: __assign(__assign({}, leadData), { flows: BUSINESS_FLOW_SUCCESS.concat((boardData === null || boardData === void 0 ? void 0 : boardData.info) || []) }),
|
|
166
163
|
token: token,
|
|
167
164
|
brandData: brandData,
|
|
168
165
|
boardId: leadData === null || leadData === void 0 ? void 0 : leadData.board_id
|
|
169
166
|
}];
|
|
170
|
-
case
|
|
167
|
+
case 19: return [2, { data: data, isRequireOTP: true }];
|
|
171
168
|
}
|
|
172
169
|
});
|
|
173
170
|
}); });
|
|
@@ -189,7 +186,7 @@ export var resendOTP = createAsyncThunk('resendOTPBusiness', function (params, t
|
|
|
189
186
|
});
|
|
190
187
|
}); });
|
|
191
188
|
export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
192
|
-
var _a, business, settings, isNID, responseBody, stepName, payload, data, brandData, leadData, brand, country_code, steps, board_id,
|
|
189
|
+
var _a, business, settings, isNID, responseBody, stepName, payload, data, brandData, leadData, brand, country_code, steps, board_id, brandID, countryIso2, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, isIdentityAuthStep, entity_activities, activityList, boardResponse;
|
|
193
190
|
var _b, _c, _d, _e, _f, _g, _h;
|
|
194
191
|
return __generator(this, function (_j) {
|
|
195
192
|
switch (_j.label) {
|
|
@@ -215,7 +212,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
215
212
|
case 2:
|
|
216
213
|
leadData = (_j.sent()).data;
|
|
217
214
|
thunkApi.dispatch(updateStepName(stepName));
|
|
218
|
-
brand = leadData.brand, country_code = leadData.country_code, steps = leadData.steps, board_id = leadData.board_id
|
|
215
|
+
brand = leadData.brand, country_code = leadData.country_code, steps = leadData.steps, board_id = leadData.board_id;
|
|
219
216
|
brandID = brand === null || brand === void 0 ? void 0 : brand.id;
|
|
220
217
|
countryIso2 = country_code;
|
|
221
218
|
if (countryIso2)
|
|
@@ -249,15 +246,16 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
249
246
|
return [3, 20];
|
|
250
247
|
case 8:
|
|
251
248
|
if (!hasBusinessCompleted) return [3, 12];
|
|
252
|
-
if (!
|
|
253
|
-
return [4, API.boardService.
|
|
249
|
+
if (!board_id) return [3, 11];
|
|
250
|
+
return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
254
251
|
case 9:
|
|
255
252
|
boardResponse = _j.sent();
|
|
256
253
|
leadData = __assign(__assign({}, leadData), { flows: BUSINESS_FLOW_SUCCESS.concat((boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info) || []) });
|
|
257
|
-
|
|
258
|
-
case 10:
|
|
259
|
-
case 11:
|
|
254
|
+
return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
|
|
255
|
+
case 10:
|
|
260
256
|
_j.sent();
|
|
257
|
+
_j.label = 11;
|
|
258
|
+
case 11:
|
|
261
259
|
thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
262
260
|
return [3, 20];
|
|
263
261
|
case 12:
|
|
@@ -680,7 +678,7 @@ export var updateCustomersInfo = createAsyncThunk('updateCustomersInfo', functio
|
|
|
680
678
|
});
|
|
681
679
|
}); });
|
|
682
680
|
export var updateLeadSuccess = createAsyncThunk('businessUpdateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
683
|
-
var _a, settings, business, _b, steps, lead_id, flowCompleted, boardResponse, payload, data, board_id
|
|
681
|
+
var _a, settings, business, _b, steps, lead_id, flowCompleted, boardResponse, payload, data, board_id;
|
|
684
682
|
var _c, _d, _e, _f;
|
|
685
683
|
return __generator(this, function (_g) {
|
|
686
684
|
switch (_g.label) {
|
|
@@ -701,15 +699,15 @@ export var updateLeadSuccess = createAsyncThunk('businessUpdateLeadSuccess', fun
|
|
|
701
699
|
case 1:
|
|
702
700
|
data = _g.sent();
|
|
703
701
|
board_id = data === null || data === void 0 ? void 0 : data.board_id;
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
702
|
+
if (!board_id) return [3, 4];
|
|
703
|
+
return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
707
704
|
case 2:
|
|
708
705
|
boardResponse = _g.sent();
|
|
709
|
-
|
|
710
|
-
case 3:
|
|
711
|
-
case 4:
|
|
706
|
+
return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
|
|
707
|
+
case 3:
|
|
712
708
|
_g.sent();
|
|
709
|
+
_g.label = 4;
|
|
710
|
+
case 4:
|
|
713
711
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
|
|
714
712
|
(_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
|
|
715
713
|
thunkApi.dispatch(handleNextScreenStep());
|
|
@@ -54,7 +54,7 @@ import { ENTITY_STEP_NAMES } from '../../../constants';
|
|
|
54
54
|
import moment from 'moment';
|
|
55
55
|
import { convertNumbers2English } from '../../../utils';
|
|
56
56
|
export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
57
|
-
var payload, data, boardData, entityData, boardInfoData, countryIso2, board_id,
|
|
57
|
+
var payload, data, boardData, entityData, boardInfoData, countryIso2, board_id, entityId, activities, data_1, info, hasEntityCompleted;
|
|
58
58
|
var _a, _b, _c, _d;
|
|
59
59
|
return __generator(this, function (_e) {
|
|
60
60
|
switch (_e.label) {
|
|
@@ -67,40 +67,36 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
|
|
|
67
67
|
case 1:
|
|
68
68
|
data = (_e.sent()).data;
|
|
69
69
|
countryIso2 = undefined;
|
|
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, 8];
|
|
71
71
|
if (data === null || data === void 0 ? void 0 : data.country_code) {
|
|
72
72
|
countryIso2 = data === null || data === void 0 ? void 0 : data.country_code;
|
|
73
73
|
if (countryIso2)
|
|
74
74
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
75
75
|
}
|
|
76
|
-
if (!(data.step_name !== ENTITY_STEP_NAMES.PHONE_AUTH)) return [3,
|
|
76
|
+
if (!(data.step_name !== ENTITY_STEP_NAMES.PHONE_AUTH)) return [3, 8];
|
|
77
77
|
board_id = data === null || data === void 0 ? void 0 : data.id;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
78
|
+
if (!board_id) return [3, 4];
|
|
79
|
+
return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
81
80
|
case 2:
|
|
82
81
|
boardInfoData = _e.sent();
|
|
83
|
-
_e.label = 3;
|
|
84
|
-
case 3:
|
|
85
|
-
if (!board_id) return [3, 5];
|
|
86
82
|
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
87
|
-
case
|
|
83
|
+
case 3:
|
|
88
84
|
boardData = _e.sent();
|
|
89
|
-
_e.label =
|
|
90
|
-
case
|
|
85
|
+
_e.label = 4;
|
|
86
|
+
case 4:
|
|
91
87
|
entityId = (_a = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _a === void 0 ? void 0 : _a.id;
|
|
92
|
-
if (!entityId) return [3,
|
|
88
|
+
if (!entityId) return [3, 7];
|
|
93
89
|
return [4, API.entityService.retrieveEntity(entityId)];
|
|
94
|
-
case
|
|
90
|
+
case 5:
|
|
95
91
|
entityData = _e.sent();
|
|
96
92
|
activities = (entityData || {}).activities;
|
|
97
|
-
if (!!activities) return [3,
|
|
93
|
+
if (!!activities) return [3, 7];
|
|
98
94
|
return [4, API.dataService.getActivities()];
|
|
99
|
-
case
|
|
95
|
+
case 6:
|
|
100
96
|
data_1 = _e.sent();
|
|
101
97
|
entityData = __assign(__assign({}, entityData), { entity_activities: data_1.list });
|
|
102
|
-
_e.label =
|
|
103
|
-
case
|
|
98
|
+
_e.label = 7;
|
|
99
|
+
case 7:
|
|
104
100
|
if (!countryIso2) {
|
|
105
101
|
countryIso2 = entityData.country;
|
|
106
102
|
if (countryIso2)
|
|
@@ -114,8 +110,8 @@ export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function
|
|
|
114
110
|
else {
|
|
115
111
|
thunkApi.dispatch(handleNextScreenStep('ENTITY_INFO_STEP'));
|
|
116
112
|
}
|
|
117
|
-
_e.label =
|
|
118
|
-
case
|
|
113
|
+
_e.label = 8;
|
|
114
|
+
case 8: return [2, {
|
|
119
115
|
data: data,
|
|
120
116
|
boardResponse: {
|
|
121
117
|
user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
|
|
@@ -151,7 +147,7 @@ export var resendOTP = createAsyncThunk('entityResendOTP', function (params, thu
|
|
|
151
147
|
});
|
|
152
148
|
}); });
|
|
153
149
|
export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
154
|
-
var _a, entity, settings, responseBody, payload, data, boardData, entityData, boardInfoData, board_id,
|
|
150
|
+
var _a, entity, settings, responseBody, payload, data, boardData, entityData, boardInfoData, board_id, entityId, activities, data_2, info, hasEntityCompleted;
|
|
155
151
|
var _b, _c, _d, _e, _f, _g, _h;
|
|
156
152
|
return __generator(this, function (_j) {
|
|
157
153
|
switch (_j.label) {
|
|
@@ -169,34 +165,30 @@ export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', functio
|
|
|
169
165
|
case 1:
|
|
170
166
|
data = (_j.sent()).data;
|
|
171
167
|
boardInfoData = undefined;
|
|
172
|
-
if (!!data.errors) return [3,
|
|
168
|
+
if (!!data.errors) return [3, 8];
|
|
173
169
|
board_id = responseBody === null || responseBody === void 0 ? void 0 : responseBody.id;
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
170
|
+
if (!board_id) return [3, 4];
|
|
171
|
+
return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
177
172
|
case 2:
|
|
178
173
|
boardInfoData = _j.sent();
|
|
179
|
-
_j.label = 3;
|
|
180
|
-
case 3:
|
|
181
|
-
if (!board_id) return [3, 5];
|
|
182
174
|
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
183
|
-
case
|
|
175
|
+
case 3:
|
|
184
176
|
boardData = _j.sent();
|
|
185
|
-
_j.label =
|
|
186
|
-
case
|
|
177
|
+
_j.label = 4;
|
|
178
|
+
case 4:
|
|
187
179
|
entityId = (_c = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _c === void 0 ? void 0 : _c.id;
|
|
188
|
-
if (!entityId) return [3,
|
|
180
|
+
if (!entityId) return [3, 7];
|
|
189
181
|
return [4, API.entityService.retrieveEntity(entityId)];
|
|
190
|
-
case
|
|
182
|
+
case 5:
|
|
191
183
|
entityData = _j.sent();
|
|
192
184
|
activities = (entityData || {}).activities;
|
|
193
|
-
if (!!activities) return [3,
|
|
185
|
+
if (!!activities) return [3, 7];
|
|
194
186
|
return [4, API.dataService.getActivities()];
|
|
195
|
-
case
|
|
187
|
+
case 6:
|
|
196
188
|
data_2 = _j.sent();
|
|
197
189
|
entityData = __assign(__assign({}, entityData), { entity_activities: data_2.list });
|
|
198
|
-
_j.label =
|
|
199
|
-
case
|
|
190
|
+
_j.label = 7;
|
|
191
|
+
case 7:
|
|
200
192
|
(_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
|
|
201
193
|
info = (boardInfoData || {}).info;
|
|
202
194
|
hasEntityCompleted = ((_f = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'entity'; })) === null || _f === void 0 ? void 0 : _f.status) === 'completed';
|
|
@@ -206,8 +198,8 @@ export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', functio
|
|
|
206
198
|
else {
|
|
207
199
|
thunkApi.dispatch(handleNextScreenStep('ENTITY_INFO_STEP'));
|
|
208
200
|
}
|
|
209
|
-
_j.label =
|
|
210
|
-
case
|
|
201
|
+
_j.label = 8;
|
|
202
|
+
case 8: return [2, {
|
|
211
203
|
data: data,
|
|
212
204
|
boardResponse: {
|
|
213
205
|
user: boardData === null || boardData === void 0 ? void 0 : boardData.user,
|
|
@@ -376,7 +368,7 @@ export var retrieveDataList = createAsyncThunk('entityRetrieveDataList', functio
|
|
|
376
368
|
});
|
|
377
369
|
}); });
|
|
378
370
|
export var updateBoardSuccess = createAsyncThunk('updateBoardEntitySuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
379
|
-
var _a, settings, entity, _b, id, infoId, payload, data;
|
|
371
|
+
var _a, settings, entity, _b, id, infoId, payload, data, boardInfoData;
|
|
380
372
|
var _c, _d, _e, _f;
|
|
381
373
|
return __generator(this, function (_g) {
|
|
382
374
|
switch (_g.label) {
|
|
@@ -393,13 +385,16 @@ export var updateBoardSuccess = createAsyncThunk('updateBoardEntitySuccess', fun
|
|
|
393
385
|
return [4, API.boardService.updateBoardInfo(__assign({ id: id, infoId: infoId }, payload))];
|
|
394
386
|
case 1:
|
|
395
387
|
data = _g.sent();
|
|
396
|
-
return [4,
|
|
388
|
+
return [4, API.boardService.retrieveBoardInfoStatus(id)];
|
|
397
389
|
case 2:
|
|
390
|
+
boardInfoData = _g.sent();
|
|
391
|
+
return [4, thunkApi.dispatch(retrieveBoardDetails(id))];
|
|
392
|
+
case 3:
|
|
398
393
|
_g.sent();
|
|
399
394
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
|
|
400
395
|
(_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
|
|
401
396
|
thunkApi.dispatch(handleNextScreenStep());
|
|
402
|
-
return [2, { response: __assign(__assign({}, data), { flows:
|
|
397
|
+
return [2, { response: __assign(__assign({}, data), { flows: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info }), formData: params }];
|
|
403
398
|
}
|
|
404
399
|
});
|
|
405
400
|
}); });
|
|
@@ -52,7 +52,7 @@ import { FlowsTypes } from '../../../@types';
|
|
|
52
52
|
import { handleNextScreenStep, handleSetCountryByIso2 } 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, individualData, countryCode, boardInfoData, countries, board_id, board_info_id, notification, _a, id, type, info, hasIndividualCompleted;
|
|
55
|
+
var payload, settings, data, boardData, individualData, countryCode, boardInfoData, boardInfoStatus, countries, board_id, board_info_id, notification, _a, id, type, info, hasIndividualCompleted;
|
|
56
56
|
var _b, _c, _d, _e;
|
|
57
57
|
return __generator(this, function (_f) {
|
|
58
58
|
switch (_f.label) {
|
|
@@ -65,14 +65,14 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
|
|
|
65
65
|
return [4, API.leadService.verifyLeadToken(payload)];
|
|
66
66
|
case 1:
|
|
67
67
|
data = (_f.sent()).data;
|
|
68
|
-
|
|
68
|
+
boardInfoStatus = 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, 11];
|
|
71
71
|
if (data === null || data === void 0 ? void 0 : data.country_code) {
|
|
72
72
|
countryCode = data === null || data === void 0 ? void 0 : data.country_code;
|
|
73
73
|
thunkApi.dispatch(handleSetCountryByIso2(countryCode));
|
|
74
74
|
}
|
|
75
|
-
if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3,
|
|
75
|
+
if (!(data.step_name !== INDIVIDUAl_STEP_NAMES.PHONE_AUTH)) return [3, 11];
|
|
76
76
|
board_id = data === null || data === void 0 ? void 0 : data.id;
|
|
77
77
|
board_info_id = data === null || data === void 0 ? void 0 : data.board_info_id;
|
|
78
78
|
if (!(board_id && board_info_id)) return [3, 4];
|
|
@@ -87,32 +87,35 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
|
|
|
87
87
|
individualData = _f.sent();
|
|
88
88
|
_f.label = 4;
|
|
89
89
|
case 4:
|
|
90
|
-
if (!board_id) return [3,
|
|
90
|
+
if (!board_id) return [3, 7];
|
|
91
91
|
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
92
92
|
case 5:
|
|
93
93
|
boardData = _f.sent();
|
|
94
|
-
|
|
94
|
+
return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
95
95
|
case 6:
|
|
96
|
+
boardInfoStatus = _f.sent();
|
|
97
|
+
_f.label = 7;
|
|
98
|
+
case 7:
|
|
96
99
|
if (!countryCode) {
|
|
97
100
|
countryCode = (_b = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _b === void 0 ? void 0 : _b.country;
|
|
98
101
|
if (countryCode)
|
|
99
102
|
thunkApi.dispatch(handleSetCountryByIso2(countryCode));
|
|
100
103
|
}
|
|
101
|
-
info = (
|
|
104
|
+
info = (boardInfoStatus || {}).info;
|
|
102
105
|
hasIndividualCompleted = ((_c = info === null || info === void 0 ? void 0 : info.find(function (flow) { return flow.name === 'individual'; })) === null || _c === void 0 ? void 0 : _c.status) === 'completed';
|
|
103
|
-
if (!hasIndividualCompleted) return [3,
|
|
106
|
+
if (!hasIndividualCompleted) return [3, 8];
|
|
104
107
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
105
|
-
return [3,
|
|
106
|
-
case 7:
|
|
107
|
-
if (!countryCode) return [3, 9];
|
|
108
|
-
return [4, thunkApi.dispatch(retrieveDataList(countryCode))];
|
|
108
|
+
return [3, 11];
|
|
109
109
|
case 8:
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
if (!countryCode) return [3, 10];
|
|
111
|
+
return [4, thunkApi.dispatch(retrieveDataList(countryCode))];
|
|
112
112
|
case 9:
|
|
113
|
-
|
|
113
|
+
_f.sent();
|
|
114
114
|
_f.label = 10;
|
|
115
|
-
case 10:
|
|
115
|
+
case 10:
|
|
116
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
|
|
117
|
+
_f.label = 11;
|
|
118
|
+
case 11: return [2, {
|
|
116
119
|
data: data,
|
|
117
120
|
boardResponse: {
|
|
118
121
|
user: individualData === null || individualData === void 0 ? void 0 : individualData.user,
|
|
@@ -125,7 +128,7 @@ export var verifyLeadToken = createAsyncThunk('individualVerifyLeadToken', funct
|
|
|
125
128
|
countries: countries,
|
|
126
129
|
countryCode: countryCode,
|
|
127
130
|
notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
|
|
128
|
-
flows: BUSINESS_FLOW_SUCCESS.concat((
|
|
131
|
+
flows: BUSINESS_FLOW_SUCCESS.concat((boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || [])
|
|
129
132
|
},
|
|
130
133
|
token: token
|
|
131
134
|
}];
|
|
@@ -191,7 +194,7 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetai
|
|
|
191
194
|
});
|
|
192
195
|
}); });
|
|
193
196
|
export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
194
|
-
var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData, individualData, boardData, countryCode, notification, _c, id, type, info, hasIndividualCompleted;
|
|
197
|
+
var _a, individual, settings, responseBody, _b, board_id, board_info_id, countries, payload, data, boardInfoData, individualData, boardData, countryCode, boardInfoStatus, notification, _c, id, type, info, hasIndividualCompleted;
|
|
195
198
|
var _d, _e, _f, _g, _h, _j, _k;
|
|
196
199
|
return __generator(this, function (_l) {
|
|
197
200
|
switch (_l.label) {
|
|
@@ -210,8 +213,8 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
|
|
|
210
213
|
return [4, API.leadService.verifyLeadOTP(payload)];
|
|
211
214
|
case 1:
|
|
212
215
|
data = (_l.sent()).data;
|
|
213
|
-
|
|
214
|
-
if (!!(data === null || data === void 0 ? void 0 : data.errors)) return [3,
|
|
216
|
+
boardInfoStatus = undefined;
|
|
217
|
+
if (!!(data === null || data === void 0 ? void 0 : data.errors)) return [3, 11];
|
|
215
218
|
if (!(board_id && board_info_id)) return [3, 4];
|
|
216
219
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
217
220
|
case 2:
|
|
@@ -224,29 +227,32 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
|
|
|
224
227
|
individualData = _l.sent();
|
|
225
228
|
_l.label = 4;
|
|
226
229
|
case 4:
|
|
227
|
-
if (!board_id) return [3,
|
|
228
|
-
return [4, API.boardService.
|
|
230
|
+
if (!board_id) return [3, 7];
|
|
231
|
+
return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
229
232
|
case 5:
|
|
230
|
-
|
|
231
|
-
|
|
233
|
+
boardInfoStatus = _l.sent();
|
|
234
|
+
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
232
235
|
case 6:
|
|
236
|
+
boardData = _l.sent();
|
|
237
|
+
_l.label = 7;
|
|
238
|
+
case 7:
|
|
233
239
|
countryCode = (_e = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _e === void 0 ? void 0 : _e.country;
|
|
234
|
-
info = (
|
|
240
|
+
info = (boardInfoStatus || {}).info;
|
|
235
241
|
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';
|
|
236
242
|
(_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
|
|
237
|
-
if (!hasIndividualCompleted) return [3,
|
|
243
|
+
if (!hasIndividualCompleted) return [3, 8];
|
|
238
244
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_SUCCESS_FOUR_FLOWS_BUTTONS_STEP'));
|
|
239
|
-
return [3,
|
|
240
|
-
case 7:
|
|
241
|
-
if (!countryCode) return [3, 9];
|
|
242
|
-
return [4, thunkApi.dispatch(retrieveDataList(countryCode))];
|
|
245
|
+
return [3, 11];
|
|
243
246
|
case 8:
|
|
244
|
-
|
|
245
|
-
|
|
247
|
+
if (!countryCode) return [3, 10];
|
|
248
|
+
return [4, thunkApi.dispatch(retrieveDataList(countryCode))];
|
|
246
249
|
case 9:
|
|
247
|
-
|
|
250
|
+
_l.sent();
|
|
248
251
|
_l.label = 10;
|
|
249
|
-
case 10:
|
|
252
|
+
case 10:
|
|
253
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_ADDITIONAL_INDIVIDUAL_INFO_STEP'));
|
|
254
|
+
_l.label = 11;
|
|
255
|
+
case 11: return [2, {
|
|
250
256
|
data: data,
|
|
251
257
|
boardResponse: {
|
|
252
258
|
user: individualData === null || individualData === void 0 ? void 0 : individualData.user,
|
|
@@ -259,7 +265,7 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
|
|
|
259
265
|
countries: countries,
|
|
260
266
|
countryCode: countryCode,
|
|
261
267
|
notification: boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.notification,
|
|
262
|
-
flows: BUSINESS_FLOW_SUCCESS.concat((
|
|
268
|
+
flows: BUSINESS_FLOW_SUCCESS.concat((boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || [])
|
|
263
269
|
},
|
|
264
270
|
formData: __assign({}, params)
|
|
265
271
|
}];
|
|
@@ -299,7 +305,7 @@ export var updateIndividualInfo = createAsyncThunk('updateIndividualInfo', funct
|
|
|
299
305
|
});
|
|
300
306
|
}); });
|
|
301
307
|
export var updateBoardSuccess = createAsyncThunk('individualUpdateBoardSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
302
|
-
var _a, settings, individual, _b, id, infoId, payload, data;
|
|
308
|
+
var _a, settings, individual, _b, id, infoId, payload, data, boardInfoStatus;
|
|
303
309
|
var _c, _d, _e, _f;
|
|
304
310
|
return __generator(this, function (_g) {
|
|
305
311
|
switch (_g.label) {
|
|
@@ -316,13 +322,16 @@ export var updateBoardSuccess = createAsyncThunk('individualUpdateBoardSuccess',
|
|
|
316
322
|
return [4, API.boardService.updateBoardInfo(__assign({ id: id, infoId: infoId }, payload))];
|
|
317
323
|
case 1:
|
|
318
324
|
data = _g.sent();
|
|
319
|
-
return [4,
|
|
325
|
+
return [4, API.boardService.retrieveBoardInfoStatus(id)];
|
|
320
326
|
case 2:
|
|
327
|
+
boardInfoStatus = _g.sent();
|
|
328
|
+
return [4, thunkApi.dispatch(retrieveBoardDetails(id))];
|
|
329
|
+
case 3:
|
|
321
330
|
_g.sent();
|
|
322
331
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
|
|
323
332
|
(_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
|
|
324
333
|
thunkApi.dispatch(handleNextScreenStep());
|
|
325
|
-
return [2, { response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat((
|
|
334
|
+
return [2, { response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat((boardInfoStatus === null || boardInfoStatus === void 0 ? void 0 : boardInfoStatus.info) || []) }), formData: params }];
|
|
326
335
|
}
|
|
327
336
|
});
|
|
328
337
|
}); });
|
|
@@ -52,7 +52,7 @@ import { FlowsTypes } from '../../../@types';
|
|
|
52
52
|
import { handleCurrentActiveScreen, handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
|
|
53
53
|
import { BUSINESS_FLOW_SUCCESS, PASSWORD_OPERATION_TYPE, PASSWORD_STEP_NAMES } from '../../../constants';
|
|
54
54
|
export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
|
-
var payload, data, boardInfoData, boardData, board_id,
|
|
55
|
+
var payload, data, boardInfoData, boardData, board_id, countryIso2, info, hasPasswordCompleted;
|
|
56
56
|
var _a, _b, _c, _d;
|
|
57
57
|
return __generator(this, function (_e) {
|
|
58
58
|
switch (_e.label) {
|
|
@@ -65,21 +65,17 @@ export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', functio
|
|
|
65
65
|
case 1:
|
|
66
66
|
data = (_e.sent()).data;
|
|
67
67
|
boardData = undefined;
|
|
68
|
-
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3,
|
|
68
|
+
if (!(!(data === null || data === void 0 ? void 0 : data.errors) && !(data === null || data === void 0 ? void 0 : data.mw_error))) return [3, 5];
|
|
69
69
|
board_id = data === null || data === void 0 ? void 0 : data.id;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
70
|
+
if (!board_id) return [3, 4];
|
|
71
|
+
return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
73
72
|
case 2:
|
|
74
73
|
boardInfoData = _e.sent();
|
|
75
|
-
_e.label = 3;
|
|
76
|
-
case 3:
|
|
77
|
-
if (!board_id) return [3, 5];
|
|
78
74
|
return [4, API.boardService.retrieveBoardDetails(board_id)];
|
|
79
|
-
case
|
|
75
|
+
case 3:
|
|
80
76
|
boardData = _e.sent();
|
|
81
|
-
_e.label =
|
|
82
|
-
case
|
|
77
|
+
_e.label = 4;
|
|
78
|
+
case 4:
|
|
83
79
|
countryIso2 = (_a = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _a === void 0 ? void 0 : _a.country;
|
|
84
80
|
if (countryIso2)
|
|
85
81
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
@@ -94,8 +90,8 @@ export var verifyLeadToken = createAsyncThunk('passwordVerifyLeadToken', functio
|
|
|
94
90
|
else if (data.step_name === PASSWORD_STEP_NAMES.PASSWORD_INFO) {
|
|
95
91
|
thunkApi.dispatch(handleNextScreenStep('PASSWORD_CREATE_PASSWORD_STEP'));
|
|
96
92
|
}
|
|
97
|
-
_e.label =
|
|
98
|
-
case
|
|
93
|
+
_e.label = 5;
|
|
94
|
+
case 5: return [2, {
|
|
99
95
|
data: data,
|
|
100
96
|
boardResponse: __assign(__assign({}, boardData === null || boardData === void 0 ? void 0 : boardData.business), { flows: BUSINESS_FLOW_SUCCESS.concat((boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || []), user: boardData === null || boardData === void 0 ? void 0 : boardData.user, brand: boardData === null || boardData === void 0 ? void 0 : boardData.brand, bank_account: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, entity: boardData === null || boardData === void 0 ? void 0 : boardData.entity, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant, name: (_c = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _c === void 0 ? void 0 : _c.names, contact: (_d = boardData === null || boardData === void 0 ? void 0 : boardData.user) === null || _d === void 0 ? void 0 : _d.contact }),
|
|
101
97
|
token: token
|
|
@@ -190,7 +186,7 @@ export var createPassword = createAsyncThunk('createPassword', function (params,
|
|
|
190
186
|
});
|
|
191
187
|
}); });
|
|
192
188
|
export var updateBoardSuccess = createAsyncThunk('passwordUpdateBoardSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
193
|
-
var _a, settings, password, _b, id, infoId, payload, data;
|
|
189
|
+
var _a, settings, password, _b, id, infoId, payload, data, boardInfoData;
|
|
194
190
|
var _c, _d, _e, _f;
|
|
195
191
|
return __generator(this, function (_g) {
|
|
196
192
|
switch (_g.label) {
|
|
@@ -207,22 +203,25 @@ export var updateBoardSuccess = createAsyncThunk('passwordUpdateBoardSuccess', f
|
|
|
207
203
|
return [4, API.boardService.updateBoardInfo(__assign({ id: id, infoId: infoId }, payload))];
|
|
208
204
|
case 1:
|
|
209
205
|
data = _g.sent();
|
|
210
|
-
return [4,
|
|
206
|
+
return [4, API.boardService.retrieveBoardInfoStatus(id)];
|
|
211
207
|
case 2:
|
|
208
|
+
boardInfoData = _g.sent();
|
|
209
|
+
return [4, thunkApi.dispatch(retrieveBoardDetails(id))];
|
|
210
|
+
case 3:
|
|
212
211
|
_g.sent();
|
|
213
212
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
|
|
214
213
|
(_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
|
|
215
214
|
thunkApi.dispatch(handleNextScreenStep());
|
|
216
|
-
return [2, { response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat((
|
|
215
|
+
return [2, { response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat((boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || []) }), formData: params }];
|
|
217
216
|
}
|
|
218
217
|
});
|
|
219
218
|
}); });
|
|
220
219
|
export var verifyOperationToken = createAsyncThunk('verifyOperationToken', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
221
|
-
var token, boardId,
|
|
220
|
+
var token, boardId, boardInfoData, payload, data;
|
|
222
221
|
return __generator(this, function (_a) {
|
|
223
222
|
switch (_a.label) {
|
|
224
223
|
case 0:
|
|
225
|
-
token = params.token, boardId = params.boardId
|
|
224
|
+
token = params.token, boardId = params.boardId;
|
|
226
225
|
boardInfoData = undefined;
|
|
227
226
|
payload = {
|
|
228
227
|
auth_type: 7,
|
|
@@ -231,8 +230,8 @@ export var verifyOperationToken = createAsyncThunk('verifyOperationToken', funct
|
|
|
231
230
|
return [4, API.authService.verifyAuth(payload)];
|
|
232
231
|
case 1:
|
|
233
232
|
data = (_a.sent()).data;
|
|
234
|
-
if (!
|
|
235
|
-
return [4, API.boardService.
|
|
233
|
+
if (!boardId) return [3, 3];
|
|
234
|
+
return [4, API.boardService.retrieveBoardInfoStatus(boardId)];
|
|
236
235
|
case 2:
|
|
237
236
|
boardInfoData = _a.sent();
|
|
238
237
|
_a.label = 3;
|
|
@@ -67,16 +67,16 @@ export var verifyLeadToken = createAsyncThunk('taxVerifyLeadToken', function (to
|
|
|
67
67
|
data = (_d.sent()).data;
|
|
68
68
|
boardInfoData = 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, 5];
|
|
70
|
-
if (!
|
|
71
|
-
return [4, API.boardService.
|
|
70
|
+
if (!data.id) return [3, 4];
|
|
71
|
+
return [4, API.boardService.retrieveBoardInfoStatus(data.id)];
|
|
72
72
|
case 2:
|
|
73
73
|
boardInfoData = _d.sent();
|
|
74
|
-
_d.label = 3;
|
|
75
|
-
case 3:
|
|
76
|
-
info = (boardInfoData || {}).info;
|
|
77
74
|
return [4, API.boardService.retrieveBoardDetails(data === null || data === void 0 ? void 0 : data.id)];
|
|
78
|
-
case
|
|
75
|
+
case 3:
|
|
79
76
|
boardData = _d.sent();
|
|
77
|
+
_d.label = 4;
|
|
78
|
+
case 4:
|
|
79
|
+
info = (boardInfoData || {}).info;
|
|
80
80
|
countryIso2 = (_a = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _a === void 0 ? void 0 : _a.country;
|
|
81
81
|
if (countryIso2)
|
|
82
82
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
@@ -187,13 +187,13 @@ export var updateTaxInfo = createAsyncThunk('updateTaxInfo', function (params, t
|
|
|
187
187
|
});
|
|
188
188
|
}); });
|
|
189
189
|
export var updateLeadSuccess = createAsyncThunk('taxUpdateLeadSuccess', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
190
|
-
var _a, settings, tax, _b, id, infoId,
|
|
190
|
+
var _a, settings, tax, _b, id, infoId, payload, data, boardInfoData, boardData;
|
|
191
191
|
var _c, _d, _e, _f, _g;
|
|
192
192
|
return __generator(this, function (_h) {
|
|
193
193
|
switch (_h.label) {
|
|
194
194
|
case 0:
|
|
195
195
|
_a = thunkApi.getState(), settings = _a.settings, tax = _a.tax;
|
|
196
|
-
_b = tax.data.verify.responseBody || {}, id = _b.board_id, infoId = _b.board_info_id
|
|
196
|
+
_b = tax.data.verify.responseBody || {}, id = _b.board_id, infoId = _b.board_info_id;
|
|
197
197
|
if (!id)
|
|
198
198
|
return [2];
|
|
199
199
|
payload = {
|
|
@@ -203,14 +203,17 @@ export var updateLeadSuccess = createAsyncThunk('taxUpdateLeadSuccess', function
|
|
|
203
203
|
return [4, API.boardService.updateBoardInfo(__assign({ id: id, infoId: infoId }, payload))];
|
|
204
204
|
case 1:
|
|
205
205
|
data = _h.sent();
|
|
206
|
-
return [4, API.boardService.
|
|
206
|
+
return [4, API.boardService.retrieveBoardInfoStatus(id)];
|
|
207
207
|
case 2:
|
|
208
|
+
boardInfoData = _h.sent();
|
|
209
|
+
return [4, API.boardService.retrieveBoardDetails(id)];
|
|
210
|
+
case 3:
|
|
208
211
|
boardData = _h.sent();
|
|
209
212
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
|
|
210
213
|
(_f = (_e = settings.data.appConfig).onFlowCompleted) === null || _f === void 0 ? void 0 : _f.call(_e, { data: data });
|
|
211
214
|
thunkApi.dispatch(handleNextScreenStep());
|
|
212
215
|
return [2, {
|
|
213
|
-
response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat((
|
|
216
|
+
response: __assign(__assign({}, data), { flows: BUSINESS_FLOW_SUCCESS.concat((boardInfoData === null || boardInfoData === void 0 ? void 0 : boardInfoData.info) || []), user: boardData === null || boardData === void 0 ? void 0 : boardData.user, bank: boardData === null || boardData === void 0 ? void 0 : boardData.bank_account, vatID: (_g = boardData === null || boardData === void 0 ? void 0 : boardData.entity) === null || _g === void 0 ? void 0 : _g.vat_id, merchant: boardData === null || boardData === void 0 ? void 0 : boardData.merchant }),
|
|
214
217
|
formData: params
|
|
215
218
|
}];
|
|
216
219
|
}
|
|
@@ -28,17 +28,19 @@ import IBAN from './IBAN';
|
|
|
28
28
|
import BankName from './BankName';
|
|
29
29
|
import Button from '../../../shared/Button';
|
|
30
30
|
import { useAppDispatch, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
|
|
31
|
-
import { BankValidation } from './validation';
|
|
31
|
+
import { BankKWFLValidation, BankValidation } from './validation';
|
|
32
32
|
import { useTranslation } from 'react-i18next';
|
|
33
33
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
34
34
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
35
35
|
import { useLanguage } from '../../../../hooks';
|
|
36
36
|
import { styled } from '@mui/material/styles';
|
|
37
|
+
import { BusinessType } from '../../../../@types';
|
|
37
38
|
import { bankSelector, clearError, createBankAccount } from '../../../app/bank/bankStore';
|
|
38
39
|
import Form from '../../../../components/Form';
|
|
39
|
-
import { handleCurrentActiveScreen } from '../../../../app/settings';
|
|
40
|
+
import { handleCurrentActiveScreen, settingsSelector } from '../../../../app/settings';
|
|
40
41
|
import ConfirmPolicy from './ConfirmPolicy';
|
|
41
42
|
import BankStatement from './BankStatement';
|
|
43
|
+
import { isKW } from '../../../../utils';
|
|
42
44
|
var FormStyled = styled(Form)(function () { return ({
|
|
43
45
|
display: 'flex',
|
|
44
46
|
flexDirection: 'column',
|
|
@@ -51,12 +53,17 @@ var ButtonStyled = styled(Button)(function (_a) {
|
|
|
51
53
|
});
|
|
52
54
|
});
|
|
53
55
|
var BankDetails = function () {
|
|
54
|
-
var _a
|
|
56
|
+
var _a, _b, _c;
|
|
57
|
+
var _d = React.useState(false), ibanChecking = _d[0], setIbanChecking = _d[1];
|
|
55
58
|
var dispatch = useAppDispatch();
|
|
56
|
-
var
|
|
57
|
-
var
|
|
59
|
+
var _e = useAppSelector(bankSelector), data = _e.data, loading = _e.loading, error = _e.error, uploading = _e.uploading;
|
|
60
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
61
|
+
var _f = data.bankData, responseBody = _f.responseBody, defaultValues = __rest(_f, ["responseBody"]);
|
|
62
|
+
var verify = data.verify;
|
|
63
|
+
var isKWCountry = React.useMemo(function () { return isKW(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
64
|
+
var isFL = ((_c = (_b = (_a = verify.responseBody) === null || _a === void 0 ? void 0 : _a.entity) === null || _b === void 0 ? void 0 : _b.type) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === BusinessType.FL ? true : false;
|
|
58
65
|
var methods = useForm({
|
|
59
|
-
resolver: yupResolver(BankValidation),
|
|
66
|
+
resolver: yupResolver(isKWCountry && isFL ? BankKWFLValidation : BankValidation),
|
|
60
67
|
defaultValues: defaultValues,
|
|
61
68
|
mode: 'onChange'
|
|
62
69
|
});
|
|
@@ -21,3 +21,25 @@ export declare const BankValidation: yup.ObjectSchema<import("yup/lib/object").A
|
|
|
21
21
|
bankStatementFile: any;
|
|
22
22
|
confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
23
23
|
}>>>;
|
|
24
|
+
export declare const BankKWFLValidation: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
25
|
+
iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
26
|
+
bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
27
|
+
beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
28
|
+
bankStatementId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
29
|
+
bankStatementFile: import("yup/lib/mixed").MixedSchema<any, import("yup/lib/types").AnyObject, any>;
|
|
30
|
+
confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
31
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
32
|
+
iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
33
|
+
bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
34
|
+
beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
35
|
+
bankStatementId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
36
|
+
bankStatementFile: import("yup/lib/mixed").MixedSchema<any, import("yup/lib/types").AnyObject, any>;
|
|
37
|
+
confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
38
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
39
|
+
iban: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
40
|
+
bankName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
41
|
+
beneficiaryName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
42
|
+
bankStatementId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
|
|
43
|
+
bankStatementFile: import("yup/lib/mixed").MixedSchema<any, import("yup/lib/types").AnyObject, any>;
|
|
44
|
+
confirmPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
|
|
45
|
+
}>>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { MAX_FILE_SIZE, VALID_FILE_FORMATS, REGEX_ALPHANUMERIC } from '../../../../constants';
|
|
1
|
+
import { MAX_FILE_SIZE, VALID_FILE_FORMATS, REGEX_ALPHANUMERIC, REGEX_IBAN } from '../../../../constants';
|
|
2
2
|
import * as yup from 'yup';
|
|
3
3
|
export var BankValidation = yup.object().shape({
|
|
4
4
|
iban: yup
|
|
5
5
|
.string()
|
|
6
|
-
.matches(
|
|
6
|
+
.matches(REGEX_IBAN, 'invalid_iban_format')
|
|
7
7
|
.min(15, 'invalid_iban_format')
|
|
8
8
|
.max(34, 'invalid_iban_format')
|
|
9
9
|
.required('alert_iban'),
|
|
@@ -27,3 +27,30 @@ export var BankValidation = yup.object().shape({
|
|
|
27
27
|
.optional(),
|
|
28
28
|
confirmPolicy: yup.boolean().required('alert_bank_confirm').isTrue('alert_bank_confirm')
|
|
29
29
|
});
|
|
30
|
+
export var BankKWFLValidation = yup.object().shape({
|
|
31
|
+
iban: yup
|
|
32
|
+
.string()
|
|
33
|
+
.matches(REGEX_IBAN, 'invalid_iban_format')
|
|
34
|
+
.min(15, 'invalid_iban_format')
|
|
35
|
+
.max(34, 'invalid_iban_format')
|
|
36
|
+
.required('alert_iban'),
|
|
37
|
+
bankName: yup.string().optional(),
|
|
38
|
+
beneficiaryName: yup
|
|
39
|
+
.string()
|
|
40
|
+
.matches(REGEX_ALPHANUMERIC, 'beneficiary_name_invalid')
|
|
41
|
+
.required('beneficiary_name_required'),
|
|
42
|
+
bankStatementId: yup.string().optional(),
|
|
43
|
+
bankStatementFile: yup
|
|
44
|
+
.mixed()
|
|
45
|
+
.test({
|
|
46
|
+
test: function (value) {
|
|
47
|
+
if (!!value)
|
|
48
|
+
return VALID_FILE_FORMATS.includes(value === null || value === void 0 ? void 0 : value.type) && (value === null || value === void 0 ? void 0 : value.size) < MAX_FILE_SIZE
|
|
49
|
+
? true
|
|
50
|
+
: this.createError({ message: 'alert_file_upload' });
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
.required(),
|
|
55
|
+
confirmPolicy: yup.boolean().required('alert_bank_confirm').isTrue('alert_bank_confirm')
|
|
56
|
+
});
|