@tap-payments/auth-jsconnect 2.11.17-development → 2.11.19-development
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/account.d.ts +2 -2
- package/build/api/account.js +7 -4
- package/build/api/auth.d.ts +1 -1
- package/build/api/auth.js +7 -3
- package/build/api/headers.d.ts +5 -0
- package/build/api/headers.js +3 -0
- package/build/api/index.d.ts +4 -4
- package/build/api/operator.d.ts +1 -1
- package/build/api/operator.js +5 -2
- package/build/assets/locales/ar.json +1 -0
- package/build/assets/locales/en.json +3 -2
- package/build/constants/app.js +101 -15
- package/build/constants/flows.d.ts +1 -0
- package/build/constants/flows.js +2 -1
- package/build/features/app/auth/authStore.js +64 -54
- package/build/features/app/bank/bankStore.js +24 -20
- package/build/features/app/board/boardStore.js +11 -7
- package/build/features/app/brand/brandStore.js +22 -18
- package/build/features/app/business/businessStore.js +30 -26
- package/build/features/app/connect/connectStore.js +26 -22
- package/build/features/app/connectExpress/connectExpressStore.js +19 -7
- package/build/features/app/entity/entityStore.js +21 -17
- package/build/features/app/individual/individualStore.js +29 -25
- package/build/features/app/password/passwordStore.js +44 -46
- package/build/features/app/signIn/signInStore.js +12 -16
- package/build/features/app/tax/taxStore.js +20 -16
- package/build/features/app/terminal/terminalStore.js +5 -3
- package/build/features/featuresScreens.js +60 -0
- package/build/features/shared/OTPVerifySecurityError/OTPVerifySecurityError.d.ts +3 -0
- package/build/features/shared/OTPVerifySecurityError/OTPVerifySecurityError.js +9 -0
- package/build/features/shared/OTPVerifySecurityError/index.d.ts +2 -0
- package/build/features/shared/OTPVerifySecurityError/index.js +2 -0
- package/build/features/terminal/screens/Verify/Verify.js +6 -2
- package/build/utils/error.d.ts +1 -0
- package/build/utils/error.js +3 -0
- package/package.json +1 -1
|
@@ -59,7 +59,7 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
|
59
59
|
import API from '../../../api';
|
|
60
60
|
import { BusinessType, FlowsTypes, DocumentPurpose, LicenseType } from '../../../@types';
|
|
61
61
|
import { BUSINESS_STEP_NAMES, COLLECT_DOB_INFO_NAFATH, EXPECTED_SALES_LIST, IDENTIFICATION_TYPE, NAFATH_PACI_TIMEOUT_DURATION, NAFATH_VERIFICATION_FAILED, OTHER_CR_LICENSE, OTHER_ENTITY_LICENSE, OTHER_FL_LICENSE, defaultCountry } from '../../../constants';
|
|
62
|
-
import { convertNumbers2English, hasKey, sleep, isKW, isSA, dateFormat, isOtherLicense, isOtherThanKWOrSA, hasNoneEditableValue, sendCustomEventToGTM, findCountryByIddPrefix, isNetworkError, isTimeoutError } from '../../../utils';
|
|
62
|
+
import { convertNumbers2English, hasKey, sleep, isKW, isSA, dateFormat, isOtherLicense, isOtherThanKWOrSA, hasNoneEditableValue, sendCustomEventToGTM, findCountryByIddPrefix, isNetworkError, isTimeoutError, isAuthenticationVerificationFailed } from '../../../utils';
|
|
63
63
|
import { handleNextScreenStep, handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
|
|
64
64
|
export var verifyLeadToken = createAsyncThunk('businessVerifyLeadToken', function (token, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
65
65
|
var payload, data, publicKey, countryIso2, boardData, brandData, isicActivityList, leadData, _a, steps, brand, board_id, business_id, entity, brandID, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, list, list;
|
|
@@ -198,9 +198,9 @@ export var resendOTP = createAsyncThunk('resendOTPBusiness', function (params, t
|
|
|
198
198
|
}); });
|
|
199
199
|
export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
200
200
|
var _a, business, settings, isNID, responseBody, stepName, payload, data, publicKey, brandData, isicActivityList, leadData, brand, country_code, steps, board_id, business_id, entity, brandID, countryIso2, hasBusinessCompleted, hasBusinessCRInfoCompleted, hasBusinessCRActivitiesCompleted, hasBusinessCustomersCompleted, isIdentityAuthStep, boardResponse, list, list;
|
|
201
|
-
var _b, _c, _d, _e, _f, _g, _h
|
|
202
|
-
return __generator(this, function (
|
|
203
|
-
switch (
|
|
201
|
+
var _b, _c, _d, _e, _f, _g, _h;
|
|
202
|
+
return __generator(this, function (_j) {
|
|
203
|
+
switch (_j.label) {
|
|
204
204
|
case 0:
|
|
205
205
|
_a = thunkApi.getState(), business = _a.business, settings = _a.settings;
|
|
206
206
|
isNID = business.data.otpData.isNID;
|
|
@@ -213,26 +213,28 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
213
213
|
step_name: stepName,
|
|
214
214
|
encryption_contract: ['data']
|
|
215
215
|
};
|
|
216
|
-
return [4, API.leadService.
|
|
216
|
+
return [4, API.leadService.verifyTokenOTP(payload).catch(function (err) {
|
|
217
|
+
if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
|
|
218
|
+
thunkApi.dispatch(handleNextScreenStep('BUSINESS_OTP_VERIFY_SECURITY_ERROR_STEP'));
|
|
219
|
+
throw new Error(err === null || err === void 0 ? void 0 : err.message);
|
|
220
|
+
})];
|
|
217
221
|
case 1:
|
|
218
|
-
data =
|
|
219
|
-
|
|
220
|
-
throw new Error(data.errors[0].description);
|
|
221
|
-
publicKey = (_g = data === null || data === void 0 ? void 0 : data.config) === null || _g === void 0 ? void 0 : _g.public_key;
|
|
222
|
+
data = _j.sent();
|
|
223
|
+
publicKey = (_f = data === null || data === void 0 ? void 0 : data.config) === null || _f === void 0 ? void 0 : _f.public_key;
|
|
222
224
|
if (publicKey) {
|
|
223
225
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
224
226
|
}
|
|
225
227
|
isicActivityList = undefined;
|
|
226
228
|
return [4, API.leadService.retrieveLead(data === null || data === void 0 ? void 0 : data.id)];
|
|
227
229
|
case 2:
|
|
228
|
-
leadData = (
|
|
230
|
+
leadData = (_j.sent()).data;
|
|
229
231
|
thunkApi.dispatch(updateStepName(stepName));
|
|
230
232
|
brand = leadData.brand, country_code = leadData.country_code, steps = leadData.steps, board_id = leadData.board_id, business_id = leadData.business_id, entity = leadData.entity;
|
|
231
233
|
brandID = brand === null || brand === void 0 ? void 0 : brand.id;
|
|
232
234
|
countryIso2 = country_code;
|
|
233
235
|
if (countryIso2)
|
|
234
236
|
thunkApi.dispatch(handleSetCountryByIso2(countryIso2));
|
|
235
|
-
(
|
|
237
|
+
(_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
|
|
236
238
|
hasBusinessCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_SUCCESS);
|
|
237
239
|
hasBusinessCRInfoCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_INFO) && hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_INFO_CONFIRM);
|
|
238
240
|
hasBusinessCRActivitiesCompleted = hasKey(steps, BUSINESS_STEP_NAMES.BUSINESS_CR_ACTIVITIES);
|
|
@@ -241,14 +243,14 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
241
243
|
if (!(!isIdentityAuthStep && !hasBusinessCRInfoCompleted)) return [3, 4];
|
|
242
244
|
return [4, thunkApi.dispatch(retrieveAllEntityList({ businessId: business_id, entityId: entity === null || entity === void 0 ? void 0 : entity.id }))];
|
|
243
245
|
case 3:
|
|
244
|
-
|
|
245
|
-
|
|
246
|
+
_j.sent();
|
|
247
|
+
_j.label = 4;
|
|
246
248
|
case 4:
|
|
247
249
|
if (!(isSA(countryIso2) && !isIdentityAuthStep && !hasBusinessCRInfoCompleted)) return [3, 6];
|
|
248
250
|
return [4, thunkApi.dispatch(retrieveEntityList({ leadId: data === null || data === void 0 ? void 0 : data.id }))];
|
|
249
251
|
case 5:
|
|
250
|
-
|
|
251
|
-
|
|
252
|
+
_j.sent();
|
|
253
|
+
_j.label = 6;
|
|
252
254
|
case 6:
|
|
253
255
|
if (!isNID) return [3, 7];
|
|
254
256
|
thunkApi.dispatch(handleNextScreenStep());
|
|
@@ -262,12 +264,12 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
262
264
|
if (!board_id) return [3, 11];
|
|
263
265
|
return [4, API.boardService.retrieveBoardInfoStatus(board_id)];
|
|
264
266
|
case 9:
|
|
265
|
-
boardResponse =
|
|
267
|
+
boardResponse = _j.sent();
|
|
266
268
|
leadData = __assign(__assign({}, leadData), { flows: (boardResponse === null || boardResponse === void 0 ? void 0 : boardResponse.info) || [] });
|
|
267
269
|
return [4, thunkApi.dispatch(retrieveBoardDetails(board_id))];
|
|
268
270
|
case 10:
|
|
269
|
-
|
|
270
|
-
|
|
271
|
+
_j.sent();
|
|
272
|
+
_j.label = 11;
|
|
271
273
|
case 11:
|
|
272
274
|
sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('BUSINESS_SUCCESS_FOUR_FLOWS_BUTTONS_STEP')); });
|
|
273
275
|
return [3, 23];
|
|
@@ -287,30 +289,30 @@ export var verifyLeadOTP = createAsyncThunk('verifyLeadOTP', function (params, t
|
|
|
287
289
|
if (!hasBusinessCRActivitiesCompleted) return [3, 19];
|
|
288
290
|
return [4, API.dataService.getActivitiesIsIc()];
|
|
289
291
|
case 16:
|
|
290
|
-
list = (
|
|
292
|
+
list = (_j.sent()).list;
|
|
291
293
|
isicActivityList = list || [];
|
|
292
294
|
return [4, thunkApi.dispatch(retrieveDataList())];
|
|
293
295
|
case 17:
|
|
294
|
-
|
|
296
|
+
_j.sent();
|
|
295
297
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
296
298
|
case 18:
|
|
297
|
-
brandData =
|
|
299
|
+
brandData = _j.sent();
|
|
298
300
|
sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('BUSINESS_CUSTOMERS_STEP')); });
|
|
299
301
|
return [3, 23];
|
|
300
302
|
case 19:
|
|
301
303
|
if (!hasBusinessCRInfoCompleted) return [3, 22];
|
|
302
304
|
return [4, API.dataService.getActivitiesIsIc()];
|
|
303
305
|
case 20:
|
|
304
|
-
list = (
|
|
306
|
+
list = (_j.sent()).list;
|
|
305
307
|
isicActivityList = list || [];
|
|
306
308
|
return [4, API.brandService.retrieveBrand(brandID)];
|
|
307
309
|
case 21:
|
|
308
|
-
brandData =
|
|
310
|
+
brandData = _j.sent();
|
|
309
311
|
sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('BUSINESS_ACTIVITIES_STEP')); });
|
|
310
312
|
return [3, 23];
|
|
311
313
|
case 22:
|
|
312
314
|
sleep(50).then(function () { return thunkApi.dispatch(handleNextScreenStep('BUSINESS_BUSINESS_TYPE_STEP')); });
|
|
313
|
-
|
|
315
|
+
_j.label = 23;
|
|
314
316
|
case 23: return [2, { data: data, verifyNextStepName: data.step_name, isicActivityList: isicActivityList, formData: __assign(__assign({}, params), { isNID: isNID }), brand: brandData === null || brandData === void 0 ? void 0 : brandData.brand, leadData: leadData }];
|
|
315
317
|
}
|
|
316
318
|
});
|
|
@@ -1135,9 +1137,11 @@ export var businessSlice = createSlice({
|
|
|
1135
1137
|
var licenseList = [OTHER_CR_LICENSE, OTHER_FL_LICENSE];
|
|
1136
1138
|
state.data.businessTypeData.responseBody = __assign(__assign(__assign({}, state.data.businessTypeData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id, activityList: isicActivityList }), (!((_e = (_d = (_c = state.data.businessTypeData) === null || _c === void 0 ? void 0 : _c.responseBody) === null || _d === void 0 ? void 0 : _d.licenseList) === null || _e === void 0 ? void 0 : _e.length) && { licenseList: licenseList }));
|
|
1137
1139
|
})
|
|
1138
|
-
.addCase(verifyLeadOTP.rejected, function (state,
|
|
1140
|
+
.addCase(verifyLeadOTP.rejected, function (state, _a) {
|
|
1141
|
+
var message = _a.error.message;
|
|
1139
1142
|
state.loading = false;
|
|
1140
|
-
|
|
1143
|
+
if (!isAuthenticationVerificationFailed(message))
|
|
1144
|
+
state.error = message;
|
|
1141
1145
|
})
|
|
1142
1146
|
.addCase(createCivilIdAuth.pending, function (state) {
|
|
1143
1147
|
state.loading = true;
|
|
@@ -71,7 +71,7 @@ import { handleCurrentActiveScreen, handleNextScreenStep, handleSetCountryByIso2
|
|
|
71
71
|
import { COLLECT_DOB_INFO_NAFATH, CONNECT_STEP_NAMES, defaultCountry, IDENTIFICATION_TYPE, NAFATH_PACI_TIMEOUT_DURATION, NAFATH_VERIFICATION_FAILED, OTHER_BRAND } from '../../../constants';
|
|
72
72
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
73
73
|
import { AuthForType, FlowsTypes } from '../../../@types';
|
|
74
|
-
import { capitalizeTheFirstLetterOfEachWord, concatenateObjectValues, findCountryByIddPrefix, fixBrandList, isTwitter, getIndividualName, isWebsite, sleep, sendCustomEventToGTM, isOtherThanKWOrSA, isKW, findCountryByIso2, getMetaData, isNetworkError, isTimeoutError, isInternalServerError } from '../../../utils';
|
|
74
|
+
import { capitalizeTheFirstLetterOfEachWord, concatenateObjectValues, findCountryByIddPrefix, fixBrandList, isTwitter, getIndividualName, isWebsite, sleep, sendCustomEventToGTM, isOtherThanKWOrSA, isKW, findCountryByIso2, getMetaData, isNetworkError, isTimeoutError, isInternalServerError, isAuthenticationVerificationFailed } from '../../../utils';
|
|
75
75
|
export var updateBusinessCountry = createAsyncThunk('connect/updateBusinessCountry', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
76
76
|
var connect, payload, data;
|
|
77
77
|
return __generator(this, function (_a) {
|
|
@@ -209,9 +209,9 @@ export var createNafathAuth = createAsyncThunk('connect/createNafathAuth', funct
|
|
|
209
209
|
}); });
|
|
210
210
|
export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
211
211
|
var _a, connect, settings, startWithNID, _b, mobileData, nidData, responseBody, stepName, payload, data, lead_id, leadResponse, channels, brand, err_1, brands, err_2, countryCode, phone;
|
|
212
|
-
var _c, _d, _e
|
|
213
|
-
return __generator(this, function (
|
|
214
|
-
switch (
|
|
212
|
+
var _c, _d, _e;
|
|
213
|
+
return __generator(this, function (_f) {
|
|
214
|
+
switch (_f.label) {
|
|
215
215
|
case 0:
|
|
216
216
|
_a = thunkApi.getState(), connect = _a.connect, settings = _a.settings;
|
|
217
217
|
startWithNID = connect.data.otpData.authFor === AuthForType.NATIONAL_ID;
|
|
@@ -229,11 +229,13 @@ export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params,
|
|
|
229
229
|
step_name: stepName,
|
|
230
230
|
encryption_contract: ['data']
|
|
231
231
|
};
|
|
232
|
-
return [4, API.authService.verifyAuth(payload)
|
|
232
|
+
return [4, API.authService.verifyAuth(payload).catch(function (err) {
|
|
233
|
+
if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
|
|
234
|
+
thunkApi.dispatch(handleNextScreenStep('CONNECT_OTP_VERIFY_SECURITY_ERROR_STEP'));
|
|
235
|
+
throw new Error(err === null || err === void 0 ? void 0 : err.message);
|
|
236
|
+
})];
|
|
233
237
|
case 1:
|
|
234
|
-
data =
|
|
235
|
-
if ((_c = data.errors) === null || _c === void 0 ? void 0 : _c.length)
|
|
236
|
-
throw new Error(data.errors[0].description);
|
|
238
|
+
data = _f.sent();
|
|
237
239
|
sendCustomEventToGTM({
|
|
238
240
|
event: 'Send Event',
|
|
239
241
|
event_category: 'User Registration Flow',
|
|
@@ -244,41 +246,41 @@ export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params,
|
|
|
244
246
|
throw new Error('Lead id is missing');
|
|
245
247
|
return [4, API.leadService.retrieveLead(lead_id)];
|
|
246
248
|
case 2:
|
|
247
|
-
leadResponse = (
|
|
248
|
-
if ((
|
|
249
|
+
leadResponse = (_f.sent()).data;
|
|
250
|
+
if ((_c = leadResponse.errors) === null || _c === void 0 ? void 0 : _c.length)
|
|
249
251
|
throw new Error(leadResponse.errors[0].description);
|
|
250
252
|
return [4, API.dataService.getChannelsOfServices({ page: 0 })];
|
|
251
253
|
case 3:
|
|
252
|
-
channels = (
|
|
254
|
+
channels = (_f.sent()).list;
|
|
253
255
|
leadResponse.channel_list = channels;
|
|
254
|
-
|
|
256
|
+
_f.label = 4;
|
|
255
257
|
case 4:
|
|
256
|
-
|
|
258
|
+
_f.trys.push([4, 6, , 7]);
|
|
257
259
|
return [4, API.brandService.retrieveBrand(leadResponse.brand.id)];
|
|
258
260
|
case 5:
|
|
259
|
-
brand = (
|
|
261
|
+
brand = (_f.sent()).brand;
|
|
260
262
|
leadResponse.brand = __assign(__assign({}, leadResponse.brand), brand);
|
|
261
263
|
return [3, 7];
|
|
262
264
|
case 6:
|
|
263
|
-
err_1 =
|
|
265
|
+
err_1 = _f.sent();
|
|
264
266
|
return [3, 7];
|
|
265
267
|
case 7:
|
|
266
|
-
|
|
268
|
+
_f.trys.push([7, 9, , 10]);
|
|
267
269
|
return [4, API.brandService.getBrandList({ individual_id: leadResponse.individual_id })];
|
|
268
270
|
case 8:
|
|
269
|
-
brands = (
|
|
271
|
+
brands = (_f.sent()).brands;
|
|
270
272
|
leadResponse.brand_list = fixBrandList(brands, channels);
|
|
271
273
|
return [3, 10];
|
|
272
274
|
case 9:
|
|
273
|
-
err_2 =
|
|
275
|
+
err_2 = _f.sent();
|
|
274
276
|
return [3, 10];
|
|
275
277
|
case 10:
|
|
276
278
|
countryCode = settings.data.businessCountry;
|
|
277
279
|
phone = (leadResponse.contact || {}).phone;
|
|
278
280
|
if (phone === null || phone === void 0 ? void 0 : phone.country_code)
|
|
279
281
|
countryCode = findCountryByIddPrefix(settings.data.countries, phone.country_code);
|
|
280
|
-
(
|
|
281
|
-
thunkApi.dispatch(handleNextScreenStep());
|
|
282
|
+
(_e = (_d = settings.data.appConfig).onStepCompleted) === null || _e === void 0 ? void 0 : _e.call(_d, settings.data.activeScreen.name, { otp: params.otp });
|
|
283
|
+
thunkApi.dispatch(handleNextScreenStep('CONNECT_INDIVIDUAL_STEP'));
|
|
282
284
|
return [2, { authResponse: data, leadResponse: leadResponse, countryCode: countryCode }];
|
|
283
285
|
}
|
|
284
286
|
});
|
|
@@ -1135,9 +1137,11 @@ export var connectSlice = createSlice({
|
|
|
1135
1137
|
state.loading = true;
|
|
1136
1138
|
state.error = null;
|
|
1137
1139
|
})
|
|
1138
|
-
.addCase(verifyAuth.rejected, function (state,
|
|
1140
|
+
.addCase(verifyAuth.rejected, function (state, _a) {
|
|
1141
|
+
var message = _a.error.message;
|
|
1139
1142
|
state.loading = false;
|
|
1140
|
-
|
|
1143
|
+
if (!isAuthenticationVerificationFailed(message))
|
|
1144
|
+
state.error = message;
|
|
1141
1145
|
})
|
|
1142
1146
|
.addCase(updateLeadDOB.fulfilled, function (state, action) {
|
|
1143
1147
|
state.loading = false;
|
|
@@ -61,7 +61,7 @@ import { FlowsTypes, AuthForType, BusinessType, LicenseType, AuthForScreen } fro
|
|
|
61
61
|
import API from '../../../api';
|
|
62
62
|
import { ADD_NEW_ENTITY, COLLECT_DOB_INFO_NAFATH, CONNECT_EXPRESS_STEP_NAMES, IDENTIFICATION_TYPE, NAFATH_PACI_TIMEOUT_DURATION, NAFATH_VERIFICATION_FAILED, OTHER_CR_LICENSE, OTHER_FL_LICENSE, SCOPE_AUTH, SCOPE_MERCHANT } from '../../../constants';
|
|
63
63
|
import { defaultCountry } from '../../../constants';
|
|
64
|
-
import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA, isKW, isOtherThanKWOrSA, sendCustomEventToGTM, sendCustomDimension, getMetaData, isNetworkError, isTimeoutError, isInternalServerError } from '../../../utils';
|
|
64
|
+
import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA, isKW, isOtherThanKWOrSA, sendCustomEventToGTM, sendCustomDimension, getMetaData, isNetworkError, isTimeoutError, isInternalServerError, isAuthenticationVerificationFailed } from '../../../utils';
|
|
65
65
|
export var updateBusinessCountryAsync = createAsyncThunk('connectExpress/updateBusinessCountryAsync', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
66
|
var connectExpress, payload, data;
|
|
67
67
|
return __generator(this, function (_a) {
|
|
@@ -499,7 +499,11 @@ export var verifyMobileOtpAsync = createAsyncThunk('connectExpress/verifyMobileO
|
|
|
499
499
|
step_name: CONNECT_EXPRESS_STEP_NAMES.VERIFY_AUTH_MOBILE,
|
|
500
500
|
encryption_contract: ['data']
|
|
501
501
|
};
|
|
502
|
-
return [4, API.authService.verifyExpressAuth(payload)
|
|
502
|
+
return [4, API.authService.verifyExpressAuth(payload).catch(function (err) {
|
|
503
|
+
if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
|
|
504
|
+
thunkApi.dispatch(handleNextScreenStep('CONNECT_EXPRESS_OTP_VERIFY_SECURITY_ERROR_STEP'));
|
|
505
|
+
throw new Error(err === null || err === void 0 ? void 0 : err.message);
|
|
506
|
+
})];
|
|
503
507
|
case 1:
|
|
504
508
|
data = _h.sent();
|
|
505
509
|
sendCustomEventToGTM({
|
|
@@ -1307,7 +1311,11 @@ export var verifyAuthMobileOtpAsync = createAsyncThunk('connectExpress/verifyAut
|
|
|
1307
1311
|
step_name: CONNECT_EXPRESS_STEP_NAMES.VERIFY_AUTH_MOBILE_OTP,
|
|
1308
1312
|
encryption_contract: ['data']
|
|
1309
1313
|
};
|
|
1310
|
-
return [4, API.authService.verifyExpressLeadIdentity(payload)
|
|
1314
|
+
return [4, API.authService.verifyExpressLeadIdentity(payload).catch(function (err) {
|
|
1315
|
+
if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
|
|
1316
|
+
thunkApi.dispatch(handleNextScreenStep('CONNECT_EXPRESS_OTP_VERIFY_SECURITY_ERROR_STEP'));
|
|
1317
|
+
throw new Error(err === null || err === void 0 ? void 0 : err.message);
|
|
1318
|
+
})];
|
|
1311
1319
|
case 1:
|
|
1312
1320
|
data = _e.sent();
|
|
1313
1321
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
|
|
@@ -1712,9 +1720,11 @@ export var connectSlice = createSlice({
|
|
|
1712
1720
|
state.loading = false;
|
|
1713
1721
|
state.data.responseData = __assign(__assign({}, state.data.responseData), { authData: __assign(__assign({}, (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.authData), action.payload) });
|
|
1714
1722
|
})
|
|
1715
|
-
.addCase(verifyMobileOtpAsync.rejected, function (state,
|
|
1723
|
+
.addCase(verifyMobileOtpAsync.rejected, function (state, _a) {
|
|
1724
|
+
var message = _a.error.message;
|
|
1716
1725
|
state.loading = false;
|
|
1717
|
-
|
|
1726
|
+
if (!isAuthenticationVerificationFailed(message))
|
|
1727
|
+
state.error = message;
|
|
1718
1728
|
})
|
|
1719
1729
|
.addCase(verifyNafathAsync.pending, function (state) {
|
|
1720
1730
|
state.loading = true;
|
|
@@ -1978,9 +1988,11 @@ export var connectSlice = createSlice({
|
|
|
1978
1988
|
state.loading = true;
|
|
1979
1989
|
state.error = null;
|
|
1980
1990
|
})
|
|
1981
|
-
.addCase(verifyAuthMobileOtpAsync.rejected, function (state,
|
|
1991
|
+
.addCase(verifyAuthMobileOtpAsync.rejected, function (state, _a) {
|
|
1992
|
+
var message = _a.error.message;
|
|
1982
1993
|
state.loading = false;
|
|
1983
|
-
|
|
1994
|
+
if (!isAuthenticationVerificationFailed(message))
|
|
1995
|
+
state.error = message;
|
|
1984
1996
|
})
|
|
1985
1997
|
.addCase(resendLeadMobileAuthOTP.pending, function (state) {
|
|
1986
1998
|
state.loading = true;
|
|
@@ -63,7 +63,7 @@ import { BusinessType, DocumentPurpose, FlowsTypes, LicenseType } from '../../..
|
|
|
63
63
|
import { handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../../app/settings';
|
|
64
64
|
import { ENTITY_STEP_NAMES } from '../../../constants';
|
|
65
65
|
import moment from 'moment';
|
|
66
|
-
import { convertNumbers2English, getRecentDocumentBasedOnPurpose, hasVerifiedValue, hasNoneEditableValue, sleep, formatNumberAsCurrency, removeAllCharsFromNumber, retrieveIndividualData, sendCustomEventToGTM } from '../../../utils';
|
|
66
|
+
import { convertNumbers2English, getRecentDocumentBasedOnPurpose, hasVerifiedValue, hasNoneEditableValue, sleep, formatNumberAsCurrency, removeAllCharsFromNumber, retrieveIndividualData, sendCustomEventToGTM, isAuthenticationVerificationFailed } from '../../../utils';
|
|
67
67
|
export var verifyLeadToken = createAsyncThunk('entityVerifyLeadToken', function (_a, thunkApi) {
|
|
68
68
|
var token = _a.token, isInternally = _a.isInternally;
|
|
69
69
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -145,9 +145,9 @@ export var resendOTP = createAsyncThunk('entityResendOTP', function (params, thu
|
|
|
145
145
|
}); });
|
|
146
146
|
export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
147
147
|
var _a, entity, settings, responseBody, payload, data, _b, entity_id, config, boardId, country_code, entityData, publicKey, countryIso2, data_2, entityTypes;
|
|
148
|
-
var _c, _d, _e, _f, _g
|
|
149
|
-
return __generator(this, function (
|
|
150
|
-
switch (
|
|
148
|
+
var _c, _d, _e, _f, _g;
|
|
149
|
+
return __generator(this, function (_h) {
|
|
150
|
+
switch (_h.label) {
|
|
151
151
|
case 0:
|
|
152
152
|
_a = thunkApi.getState(), entity = _a.entity, settings = _a.settings;
|
|
153
153
|
responseBody = entity.data.verify.responseBody;
|
|
@@ -158,11 +158,13 @@ export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', functio
|
|
|
158
158
|
step_name: ENTITY_STEP_NAMES.PHONE_AUTH,
|
|
159
159
|
encryption_contract: ['data']
|
|
160
160
|
};
|
|
161
|
-
return [4, API.leadService.
|
|
161
|
+
return [4, API.leadService.verifyTokenOTP(payload).catch(function (err) {
|
|
162
|
+
if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
|
|
163
|
+
thunkApi.dispatch(handleNextScreenStep('ENTITY_OTP_VERIFY_SECURITY_ERROR_STEP'));
|
|
164
|
+
throw new Error(err === null || err === void 0 ? void 0 : err.message);
|
|
165
|
+
})];
|
|
162
166
|
case 1:
|
|
163
|
-
data =
|
|
164
|
-
if ((_d = data === null || data === void 0 ? void 0 : data.errors) === null || _d === void 0 ? void 0 : _d.length)
|
|
165
|
-
throw new Error(data.errors[0].description);
|
|
167
|
+
data = _h.sent();
|
|
166
168
|
_b = data || {}, entity_id = _b.entity_id, config = _b.config, boardId = _b.id, country_code = _b.country_code;
|
|
167
169
|
entityData = undefined;
|
|
168
170
|
publicKey = config === null || config === void 0 ? void 0 : config.public_key;
|
|
@@ -174,22 +176,22 @@ export var verifyEntityLeadOTP = createAsyncThunk('verifyEntityLeadOTP', functio
|
|
|
174
176
|
if (!!entity_id) return [3, 3];
|
|
175
177
|
return [4, API.boardService.retrieveBoardDetails(boardId)];
|
|
176
178
|
case 2:
|
|
177
|
-
data_2 =
|
|
178
|
-
if (!((
|
|
179
|
+
data_2 = _h.sent();
|
|
180
|
+
if (!((_d = data_2 === null || data_2 === void 0 ? void 0 : data_2.entity) === null || _d === void 0 ? void 0 : _d.id))
|
|
179
181
|
throw new Error('entity_id_missing');
|
|
180
182
|
entityData = data_2;
|
|
181
183
|
return [3, 5];
|
|
182
184
|
case 3: return [4, API.entityService.retrieveEntity(entity_id)];
|
|
183
185
|
case 4:
|
|
184
|
-
entityData =
|
|
185
|
-
|
|
186
|
+
entityData = _h.sent();
|
|
187
|
+
_h.label = 5;
|
|
186
188
|
case 5:
|
|
187
|
-
if (!countryIso2 && ((
|
|
189
|
+
if (!countryIso2 && ((_e = entityData === null || entityData === void 0 ? void 0 : entityData.entity) === null || _e === void 0 ? void 0 : _e.country))
|
|
188
190
|
thunkApi.dispatch(handleSetCountryByIso2(entityData.entity.country));
|
|
189
|
-
(
|
|
191
|
+
(_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, { otp: params.otp });
|
|
190
192
|
return [4, API.entityService.retrieveEntityType()];
|
|
191
193
|
case 6:
|
|
192
|
-
entityTypes =
|
|
194
|
+
entityTypes = _h.sent();
|
|
193
195
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('ENTITY_NAME_STEP')); });
|
|
194
196
|
return [2, {
|
|
195
197
|
data: data,
|
|
@@ -649,9 +651,11 @@ export var entitySlice = createSlice({
|
|
|
649
651
|
state.data.entityCapitalData.capitalShareValue = formatNumberAsCurrency(shares === null || shares === void 0 ? void 0 : shares.value);
|
|
650
652
|
state.data.entityNameData = __assign(__assign({}, state.data.entityNameData), { responseBody: __assign(__assign({}, state.data.entityNameData.responseBody), { entity_id: entity === null || entity === void 0 ? void 0 : entity.id }) });
|
|
651
653
|
})
|
|
652
|
-
.addCase(verifyEntityLeadOTP.rejected, function (state,
|
|
654
|
+
.addCase(verifyEntityLeadOTP.rejected, function (state, _a) {
|
|
655
|
+
var message = _a.error.message;
|
|
653
656
|
state.loading = false;
|
|
654
|
-
|
|
657
|
+
if (!isAuthenticationVerificationFailed(message))
|
|
658
|
+
state.error = message;
|
|
655
659
|
})
|
|
656
660
|
.addCase(updateEntityName.pending, function (state) {
|
|
657
661
|
state.loading = true;
|
|
@@ -71,7 +71,7 @@ import API from '../../../api';
|
|
|
71
71
|
import { FlowsTypes, IndividualGender, DocumentPurpose } from '../../../@types';
|
|
72
72
|
import { handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../../app/settings';
|
|
73
73
|
import { defaultCountry, IDENTIFICATION_TYPE, INDIVIDUAl_STEP_NAMES, MONTHLY_INCOME_LIST } from '../../../constants';
|
|
74
|
-
import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, hasNoneEditableValue, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose, formatNumberAsCurrency, removeAllCharsFromNumber, mapUserList, sortUserList, getIndividualType, isOtherThanKWOrSA, isKWOrSA, sendCustomEventToGTM } from '../../../utils';
|
|
74
|
+
import { convertNumbers2English, dateFormat, findCountryByIddPrefix, findCountryByIso2, hasNoneEditableValue, getUserNameObject, getUserName, sleep, isValidEmail, getRecentDocumentBasedOnPurpose, formatNumberAsCurrency, removeAllCharsFromNumber, mapUserList, sortUserList, getIndividualType, isOtherThanKWOrSA, isKWOrSA, sendCustomEventToGTM, isAuthenticationVerificationFailed } from '../../../utils';
|
|
75
75
|
export var verifyToken = createAsyncThunk('individual/verifyToken', function (_a, thunkApi) {
|
|
76
76
|
var token = _a.token, isInternally = _a.isInternally, isUpdatePhoneInfo = _a.isUpdatePhoneInfo;
|
|
77
77
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -445,9 +445,9 @@ export var retrieveBoardDetails = createAsyncThunk('retrieveIndividualBoardDetai
|
|
|
445
445
|
});
|
|
446
446
|
export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
447
447
|
var _a, individual, settings, responseBody, countries, payload, data, userList, recipientData, publicKey, countryCode, _b, business_id, recipient, board_id, board_info_id, notification, _c, id, type, individualData, birthCountry;
|
|
448
|
-
var _d, _e, _f, _g, _h, _j, _k
|
|
449
|
-
return __generator(this, function (
|
|
450
|
-
switch (
|
|
448
|
+
var _d, _e, _f, _g, _h, _j, _k;
|
|
449
|
+
return __generator(this, function (_l) {
|
|
450
|
+
switch (_l.label) {
|
|
451
451
|
case 0:
|
|
452
452
|
_a = thunkApi.getState(), individual = _a.individual, settings = _a.settings;
|
|
453
453
|
responseBody = individual.data.verify.responseBody;
|
|
@@ -459,40 +459,42 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
|
|
|
459
459
|
step_name: INDIVIDUAl_STEP_NAMES.PHONE_AUTH,
|
|
460
460
|
encryption_contract: ['data']
|
|
461
461
|
};
|
|
462
|
-
return [4, API.leadService.
|
|
462
|
+
return [4, API.leadService.verifyTokenOTP(payload).catch(function (err) {
|
|
463
|
+
if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
|
|
464
|
+
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_OTP_VERIFY_SECURITY_ERROR_STEP'));
|
|
465
|
+
throw new Error(err === null || err === void 0 ? void 0 : err.message);
|
|
466
|
+
})];
|
|
463
467
|
case 1:
|
|
464
|
-
data =
|
|
468
|
+
data = _l.sent();
|
|
465
469
|
recipientData = undefined;
|
|
466
|
-
|
|
467
|
-
throw new Error(data.errors[0].description);
|
|
468
|
-
publicKey = (_f = data === null || data === void 0 ? void 0 : data.config) === null || _f === void 0 ? void 0 : _f.public_key;
|
|
470
|
+
publicKey = (_e = data === null || data === void 0 ? void 0 : data.config) === null || _e === void 0 ? void 0 : _e.public_key;
|
|
469
471
|
countryCode = data === null || data === void 0 ? void 0 : data.country_code;
|
|
470
472
|
if (publicKey)
|
|
471
473
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
472
|
-
if (!((
|
|
474
|
+
if (!((_f = settings.data.businessCountry) === null || _f === void 0 ? void 0 : _f.iso2) && countryCode)
|
|
473
475
|
thunkApi.dispatch(handleSetCountryByIso2(countryCode));
|
|
474
476
|
_b = data || {}, business_id = _b.business_id, recipient = _b.recipient, board_id = _b.id, board_info_id = _b.board_info_id;
|
|
475
477
|
recipientData = recipient;
|
|
476
|
-
if (!!((
|
|
478
|
+
if (!!((_g = data === null || data === void 0 ? void 0 : data.recipient) === null || _g === void 0 ? void 0 : _g.id)) return [3, 3];
|
|
477
479
|
if (!(board_id && board_info_id)) return [3, 3];
|
|
478
480
|
return [4, API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id })];
|
|
479
481
|
case 2:
|
|
480
|
-
notification = (
|
|
482
|
+
notification = (_l.sent()).notification;
|
|
481
483
|
recipientData = notification === null || notification === void 0 ? void 0 : notification.recipient;
|
|
482
484
|
if (!(recipientData === null || recipientData === void 0 ? void 0 : recipientData.id))
|
|
483
485
|
throw new Error('individual_id_missing');
|
|
484
|
-
|
|
486
|
+
_l.label = 3;
|
|
485
487
|
case 3:
|
|
486
488
|
_c = recipientData || {}, id = _c.id, type = _c.type;
|
|
487
489
|
return [4, thunkApi.dispatch(retrieveIndividualInfo({ id: id, type: type, countryCode: countryCode })).unwrap()];
|
|
488
490
|
case 4:
|
|
489
|
-
individualData = (
|
|
491
|
+
individualData = (_l.sent()).data;
|
|
490
492
|
if (!(!(individualData === null || individualData === void 0 ? void 0 : individualData.is_authorized) && !isKWOrSA(countryCode))) return [3, 7];
|
|
491
493
|
if (!business_id) return [3, 6];
|
|
492
494
|
return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
|
|
493
495
|
case 5:
|
|
494
|
-
userList =
|
|
495
|
-
|
|
496
|
+
userList = _l.sent();
|
|
497
|
+
_l.label = 6;
|
|
496
498
|
case 6:
|
|
497
499
|
userList = userList === null || userList === void 0 ? void 0 : userList.filter(function (user) { return user.id === id; });
|
|
498
500
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
|
|
@@ -502,23 +504,23 @@ export var verifyLeadOTP = createAsyncThunk('verifyIndividualLeadOTP', function
|
|
|
502
504
|
if (!business_id) return [3, 9];
|
|
503
505
|
return [4, thunkApi.dispatch(getIndividualList(business_id)).unwrap()];
|
|
504
506
|
case 8:
|
|
505
|
-
userList =
|
|
506
|
-
|
|
507
|
+
userList = _l.sent();
|
|
508
|
+
_l.label = 9;
|
|
507
509
|
case 9:
|
|
508
510
|
thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_LIST_STEP'));
|
|
509
511
|
return [3, 13];
|
|
510
512
|
case 10:
|
|
511
|
-
birthCountry = ((
|
|
513
|
+
birthCountry = ((_h = individualData === null || individualData === void 0 ? void 0 : individualData.birth) === null || _h === void 0 ? void 0 : _h.country) || countryCode;
|
|
512
514
|
if (!birthCountry) return [3, 12];
|
|
513
515
|
return [4, thunkApi.dispatch(getCityList(birthCountry))];
|
|
514
516
|
case 11:
|
|
515
|
-
|
|
516
|
-
|
|
517
|
+
_l.sent();
|
|
518
|
+
_l.label = 12;
|
|
517
519
|
case 12:
|
|
518
520
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('INDIVIDUAL_PERSONAL_INDIVIDUAL_INFO_STEP')); });
|
|
519
|
-
|
|
521
|
+
_l.label = 13;
|
|
520
522
|
case 13:
|
|
521
|
-
(
|
|
523
|
+
(_k = (_j = settings.data.appConfig).onStepCompleted) === null || _k === void 0 ? void 0 : _k.call(_j, settings.data.activeScreen.name, { otp: params.otp });
|
|
522
524
|
return [2, {
|
|
523
525
|
data: data,
|
|
524
526
|
countries: countries,
|
|
@@ -1010,9 +1012,11 @@ export var individualSlice = createSlice({
|
|
|
1010
1012
|
state.data.otpData.responseBody = data;
|
|
1011
1013
|
state.data.verify.responseBody = __assign(__assign(__assign({}, data), state.data.verify.responseBody), { countries: countries, countryCode: countryCode, userList: userList });
|
|
1012
1014
|
})
|
|
1013
|
-
.addCase(verifyLeadOTP.rejected, function (state,
|
|
1015
|
+
.addCase(verifyLeadOTP.rejected, function (state, _a) {
|
|
1016
|
+
var message = _a.error.message;
|
|
1014
1017
|
state.loading = false;
|
|
1015
|
-
|
|
1018
|
+
if (!isAuthenticationVerificationFailed(message))
|
|
1019
|
+
state.error = message;
|
|
1016
1020
|
})
|
|
1017
1021
|
.addCase(addDetailsAsync.pending, function (state) {
|
|
1018
1022
|
state.addOrRequestDetailLoading = true;
|