@tap-payments/auth-jsconnect 2.13.8-beta → 2.13.9-beta
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/auth.d.ts +1 -1
- package/build/api/auth.js +7 -3
- package/build/api/index.d.ts +1 -1
- package/build/assets/locales/ar.json +1 -0
- package/build/assets/locales/en.json +3 -2
- package/build/constants/app.js +94 -14
- package/build/features/app/auth/authStore.js +50 -40
- 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/featuresScreens.js +55 -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/utils/error.d.ts +1 -0
- package/build/utils/error.js +3 -0
- package/package.json +1 -1
|
@@ -51,7 +51,7 @@ import API from '../../../api';
|
|
|
51
51
|
import { FlowsTypes } from '../../../@types';
|
|
52
52
|
import { handleCurrentActiveScreen, handleNextScreenStep, handlePublicKey, handleSetCountryByIso2 } from '../../../app/settings';
|
|
53
53
|
import { BOARD_STEP_STEPS } from '../../../constants';
|
|
54
|
-
import { retrieveIndividualData, sleep } from '../../../utils';
|
|
54
|
+
import { isAuthenticationVerificationFailed, retrieveIndividualData, sleep } from '../../../utils';
|
|
55
55
|
export var createVerifyTokenBy = createAsyncThunk('board/createVerifyTokenByBoardId', function (_a, thunkApi) {
|
|
56
56
|
var boardId = _a.boardId, isInternally = _a.isInternally;
|
|
57
57
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -129,17 +129,19 @@ export var verifyBoardLeadOTP = createAsyncThunk('board/verifyBoardLeadOTP', fun
|
|
|
129
129
|
step_name: BOARD_STEP_STEPS.PHONE_AUTH,
|
|
130
130
|
encryption_contract: ['data']
|
|
131
131
|
};
|
|
132
|
-
return [4, API.leadService.
|
|
132
|
+
return [4, API.leadService.verifyTokenOTP(payload).catch(function (err) {
|
|
133
|
+
if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
|
|
134
|
+
thunkApi.dispatch(handleNextScreenStep('BOARD_OTP_VERIFY_SECURITY_ERROR_STEP'));
|
|
135
|
+
throw new Error(err === null || err === void 0 ? void 0 : err.message);
|
|
136
|
+
})];
|
|
133
137
|
case 1:
|
|
134
|
-
data =
|
|
138
|
+
data = _j.sent();
|
|
135
139
|
_b = data || {}, country_code = _b.country_code, config = _b.config;
|
|
136
140
|
publicKey = config === null || config === void 0 ? void 0 : config.public_key;
|
|
137
141
|
if (country_code)
|
|
138
142
|
thunkApi.dispatch(handleSetCountryByIso2(country_code));
|
|
139
143
|
if (publicKey)
|
|
140
144
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
141
|
-
if (data.errors)
|
|
142
|
-
throw new Error(data.errors[0].description);
|
|
143
145
|
return [4, thunkApi.dispatch(retrieveBoardDetails({ boardId: data.id, boardInfoId: data.board_info_id })).unwrap()];
|
|
144
146
|
case 2:
|
|
145
147
|
boardData = (_j.sent()).data;
|
|
@@ -249,9 +251,11 @@ export var boardSlice = createSlice({
|
|
|
249
251
|
state.data.otpData = formData;
|
|
250
252
|
state.data.otpData.responseBody = data;
|
|
251
253
|
})
|
|
252
|
-
.addCase(verifyBoardLeadOTP.rejected, function (state,
|
|
254
|
+
.addCase(verifyBoardLeadOTP.rejected, function (state, _a) {
|
|
255
|
+
var message = _a.error.message;
|
|
253
256
|
state.loading = false;
|
|
254
|
-
|
|
257
|
+
if (!isAuthenticationVerificationFailed(message))
|
|
258
|
+
state.error = message;
|
|
255
259
|
})
|
|
256
260
|
.addCase(retrieveBoardDetails.pending, function (state) {
|
|
257
261
|
state.error = null;
|
|
@@ -62,7 +62,7 @@ import API from '../../../api';
|
|
|
62
62
|
import { FlowsTypes } from '../../../@types';
|
|
63
63
|
import { handleNextScreenStep, handlePrevScreenStep, handlePublicKey, handleSetCountryByIso2, onCloseComplete } from '../../../app/settings';
|
|
64
64
|
import { BRAND_STEP_NAMES, EXPECTED_SALES_LIST } from '../../../constants';
|
|
65
|
-
import { hasNoneEditableValue, isKW, isTwitter, isWebsite, mapSalesChannel, retrieveIndividualData, sendCustomEventToGTM, sleep } from '../../../utils';
|
|
65
|
+
import { hasNoneEditableValue, isAuthenticationVerificationFailed, isKW, isTwitter, isWebsite, mapSalesChannel, retrieveIndividualData, sendCustomEventToGTM, sleep } from '../../../utils';
|
|
66
66
|
export var verifyLeadToken = createAsyncThunk('brand/verifyLeadToken', function (_a, thunkApi) {
|
|
67
67
|
var token = _a.token, isInternally = _a.isInternally;
|
|
68
68
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -143,9 +143,9 @@ export var resendOTP = createAsyncThunk('brandResendOTP', function (params, thun
|
|
|
143
143
|
}); });
|
|
144
144
|
export var verifyBrandLeadOTP = createAsyncThunk('brand/verifyLeadOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
145
145
|
var _a, brand, settings, responseBody, payload, data, publicKey, countryIso2, _b, brand_id, entity_id, boardId, brandData, data_2, salesChannels;
|
|
146
|
-
var _c, _d, _e, _f, _g, _h
|
|
147
|
-
return __generator(this, function (
|
|
148
|
-
switch (
|
|
146
|
+
var _c, _d, _e, _f, _g, _h;
|
|
147
|
+
return __generator(this, function (_j) {
|
|
148
|
+
switch (_j.label) {
|
|
149
149
|
case 0:
|
|
150
150
|
_a = thunkApi.getState(), brand = _a.brand, settings = _a.settings;
|
|
151
151
|
responseBody = brand.data.verify.responseBody;
|
|
@@ -156,12 +156,14 @@ export var verifyBrandLeadOTP = createAsyncThunk('brand/verifyLeadOTP', function
|
|
|
156
156
|
step_name: BRAND_STEP_NAMES.PHONE_AUTH,
|
|
157
157
|
encryption_contract: ['data']
|
|
158
158
|
};
|
|
159
|
-
return [4, API.leadService.
|
|
159
|
+
return [4, API.leadService.verifyTokenOTP(payload).catch(function (err) {
|
|
160
|
+
if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
|
|
161
|
+
thunkApi.dispatch(handleNextScreenStep('BRAND_OTP_VERIFY_SECURITY_ERROR_STEP'));
|
|
162
|
+
throw new Error(err === null || err === void 0 ? void 0 : err.message);
|
|
163
|
+
})];
|
|
160
164
|
case 1:
|
|
161
|
-
data =
|
|
162
|
-
|
|
163
|
-
throw new Error(data.errors[0].description);
|
|
164
|
-
publicKey = (_e = data === null || data === void 0 ? void 0 : data.config) === null || _e === void 0 ? void 0 : _e.public_key;
|
|
165
|
+
data = _j.sent();
|
|
166
|
+
publicKey = (_d = data === null || data === void 0 ? void 0 : data.config) === null || _d === void 0 ? void 0 : _d.public_key;
|
|
165
167
|
countryIso2 = (data === null || data === void 0 ? void 0 : data.country_code) || (responseBody === null || responseBody === void 0 ? void 0 : responseBody.country_code);
|
|
166
168
|
if (publicKey)
|
|
167
169
|
thunkApi.dispatch(handlePublicKey(publicKey));
|
|
@@ -172,21 +174,21 @@ export var verifyBrandLeadOTP = createAsyncThunk('brand/verifyLeadOTP', function
|
|
|
172
174
|
if (!(!brand_id || !countryIso2)) return [3, 3];
|
|
173
175
|
return [4, API.boardService.retrieveBoardDetails(boardId)];
|
|
174
176
|
case 2:
|
|
175
|
-
data_2 =
|
|
176
|
-
if (!countryIso2 && ((
|
|
177
|
+
data_2 = _j.sent();
|
|
178
|
+
if (!countryIso2 && ((_e = data_2 === null || data_2 === void 0 ? void 0 : data_2.entity) === null || _e === void 0 ? void 0 : _e.country))
|
|
177
179
|
thunkApi.dispatch(handleSetCountryByIso2(data_2.entity.country));
|
|
178
|
-
if (!((
|
|
180
|
+
if (!((_f = data_2 === null || data_2 === void 0 ? void 0 : data_2.brand) === null || _f === void 0 ? void 0 : _f.id))
|
|
179
181
|
throw new Error('brand_id_missing');
|
|
180
182
|
brandData = data_2;
|
|
181
183
|
return [3, 5];
|
|
182
184
|
case 3: return [4, API.brandService.retrieveBrand(brand_id)];
|
|
183
185
|
case 4:
|
|
184
|
-
brandData =
|
|
185
|
-
|
|
186
|
+
brandData = _j.sent();
|
|
187
|
+
_j.label = 5;
|
|
186
188
|
case 5: return [4, API.dataService.getChannelsOfServices({ page: 0 })];
|
|
187
189
|
case 6:
|
|
188
|
-
salesChannels =
|
|
189
|
-
(
|
|
190
|
+
salesChannels = _j.sent();
|
|
191
|
+
(_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, { otp: params.otp });
|
|
190
192
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('BRAND_INFO_STEP')); });
|
|
191
193
|
return [2, {
|
|
192
194
|
data: data,
|
|
@@ -682,9 +684,11 @@ export var brandSlice = createSlice({
|
|
|
682
684
|
state.data.brandActivities.refundPolicy = termFlag;
|
|
683
685
|
state.data.verify.responseBody = __assign(__assign(__assign({}, data), state.data.verify.responseBody), { brand: brand, board_id: data.id, channel_list: (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.list) || [], salesChannels: mappedSalesChannels, entityInfoId: entityInfoId });
|
|
684
686
|
})
|
|
685
|
-
.addCase(verifyBrandLeadOTP.rejected, function (state,
|
|
687
|
+
.addCase(verifyBrandLeadOTP.rejected, function (state, _a) {
|
|
688
|
+
var message = _a.error.message;
|
|
686
689
|
state.loading = false;
|
|
687
|
-
|
|
690
|
+
if (!isAuthenticationVerificationFailed(message))
|
|
691
|
+
state.error = message;
|
|
688
692
|
})
|
|
689
693
|
.addCase(checkBrandNameAvailability.fulfilled, function (state, action) {
|
|
690
694
|
var _a;
|
|
@@ -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;
|