@tap-payments/auth-jsconnect 2.11.22-development → 2.11.24-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.
|
@@ -69,7 +69,7 @@ var _a;
|
|
|
69
69
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
70
70
|
import { AuthForType, AuthTypeNumber, FlowsTypes, MigrationStatus } from '../../../@types';
|
|
71
71
|
import { ADD_NEW_ENTITY, AUTH_STEP_NAMES, COLLECT_DOB_INFO_NAFATH, IDENTIFICATION_TYPE, NAFATH_PACI_TIMEOUT_DURATION, NAFATH_VERIFICATION_FAILED, SCOPE_AUTH, defaultCountry } from '../../../constants';
|
|
72
|
-
import API from '../../../api';
|
|
72
|
+
import API, { setAxiosGlobalHeaders, getAxiosHeaders } from '../../../api';
|
|
73
73
|
import { handleCurrentActiveScreen, handleNextScreenStep, handleOpen, handlePrevScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
|
|
74
74
|
import { findCountryByIddPrefix, isAuthenticationVerificationFailed, isNetworkError, isTimeoutError, openConnect, sendCustomEventToGTM, sleep } from '../../../utils';
|
|
75
75
|
export var updateBusinessCountry = createAsyncThunk('auth/updateBusinessCountry', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -206,6 +206,7 @@ export var verifyMobileOtp = createAsyncThunk('auth/verifyMobileOtp', function (
|
|
|
206
206
|
})];
|
|
207
207
|
case 1:
|
|
208
208
|
data = _g.sent();
|
|
209
|
+
setAxiosGlobalHeaders(__assign(__assign({}, getAxiosHeaders()), ((data === null || data === void 0 ? void 0 : data.auth_session) && { st: data.auth_session })));
|
|
209
210
|
sendCustomEventToGTM({
|
|
210
211
|
event: 'Send Event',
|
|
211
212
|
event_category: 'User Registration Flow',
|
|
@@ -251,6 +252,7 @@ export var verifyPasscode = createAsyncThunk('auth/verifyPasscode', function (pa
|
|
|
251
252
|
})];
|
|
252
253
|
case 1:
|
|
253
254
|
data = _j.sent();
|
|
255
|
+
setAxiosGlobalHeaders(__assign(__assign({}, getAxiosHeaders()), ((data === null || data === void 0 ? void 0 : data.auth_session) && { st: data.auth_session })));
|
|
254
256
|
if (((_e = data === null || data === void 0 ? void 0 : data.status) === null || _e === void 0 ? void 0 : _e.toLowerCase()) === 'success' && (data === null || data === void 0 ? void 0 : data.auth_session)) {
|
|
255
257
|
if (scope === 'merchant') {
|
|
256
258
|
openConnect(settings.data.appConfig.publicKey, settings.data.businessCountry.iso2);
|
|
@@ -326,6 +328,7 @@ export var verifyEmailPassword = createAsyncThunk('auth/verifyEmailPassword', fu
|
|
|
326
328
|
return [4, API.authService.verifyAuth(payload)];
|
|
327
329
|
case 1:
|
|
328
330
|
data = _g.sent();
|
|
331
|
+
setAxiosGlobalHeaders(__assign(__assign({}, getAxiosHeaders()), ((data === null || data === void 0 ? void 0 : data.auth_session) && { st: data.auth_session })));
|
|
329
332
|
if ((data === null || data === void 0 ? void 0 : data.auth_type) === AuthTypeNumber.MOBILE_OTP) {
|
|
330
333
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('AUTH_OTP_STEP')); });
|
|
331
334
|
return [2, data];
|
|
@@ -394,6 +397,7 @@ export var verifyEmailOtp = createAsyncThunk('auth/verifyEmailOtp', function (pa
|
|
|
394
397
|
})];
|
|
395
398
|
case 1:
|
|
396
399
|
data = _g.sent();
|
|
400
|
+
setAxiosGlobalHeaders(__assign(__assign({}, getAxiosHeaders()), ((data === null || data === void 0 ? void 0 : data.auth_session) && { st: data.auth_session })));
|
|
397
401
|
sendCustomEventToGTM({
|
|
398
402
|
event: 'Send Event',
|
|
399
403
|
event_category: 'User Registration Flow',
|
|
@@ -485,6 +489,7 @@ export var verifyNafath = createAsyncThunk('auth/verifyNafath', function (params
|
|
|
485
489
|
return [2, { value: data }];
|
|
486
490
|
}
|
|
487
491
|
if (isSuccess) {
|
|
492
|
+
setAxiosGlobalHeaders(__assign(__assign({}, getAxiosHeaders()), ((data === null || data === void 0 ? void 0 : data.auth_session) && { st: data.auth_session })));
|
|
488
493
|
if (scope === 'merchant') {
|
|
489
494
|
openConnect(settings.data.appConfig.publicKey, settings.data.businessCountry.iso2);
|
|
490
495
|
return [2, { value: data }];
|
|
@@ -610,6 +615,7 @@ export var verifyPACI = createAsyncThunk('auth/verifyPACI', function (params, th
|
|
|
610
615
|
case 5:
|
|
611
616
|
isSuccess = ((_b = data === null || data === void 0 ? void 0 : data.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'success';
|
|
612
617
|
if (isSuccess) {
|
|
618
|
+
setAxiosGlobalHeaders(__assign(__assign({}, getAxiosHeaders()), ((data === null || data === void 0 ? void 0 : data.auth_session) && { st: data.auth_session })));
|
|
613
619
|
if (scope === 'merchant') {
|
|
614
620
|
openConnect(settings.data.appConfig.publicKey, settings.data.businessCountry.iso2);
|
|
615
621
|
return [2, data];
|
|
@@ -66,7 +66,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
66
66
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
67
67
|
};
|
|
68
68
|
var _a;
|
|
69
|
-
import API from '../../../api';
|
|
69
|
+
import API, { getAxiosHeaders, setAxiosGlobalHeaders } from '../../../api';
|
|
70
70
|
import { handleCurrentActiveScreen, handleNextScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
|
|
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';
|
|
@@ -236,6 +236,7 @@ export var verifyAuth = createAsyncThunk('connect/verifyAuth', function (params,
|
|
|
236
236
|
})];
|
|
237
237
|
case 1:
|
|
238
238
|
data = _f.sent();
|
|
239
|
+
setAxiosGlobalHeaders(__assign(__assign({}, getAxiosHeaders()), ((data === null || data === void 0 ? void 0 : data.auth_session) && { st: data.auth_session })));
|
|
239
240
|
sendCustomEventToGTM({
|
|
240
241
|
event: 'Send Event',
|
|
241
242
|
event_category: 'User Registration Flow',
|
|
@@ -320,6 +321,7 @@ export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params,
|
|
|
320
321
|
case 5:
|
|
321
322
|
isSuccess = ((_b = authResponse === null || authResponse === void 0 ? void 0 : authResponse.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'success';
|
|
322
323
|
if (!isSuccess) return [3, 16];
|
|
324
|
+
setAxiosGlobalHeaders(__assign(__assign({}, getAxiosHeaders()), ((authResponse === null || authResponse === void 0 ? void 0 : authResponse.auth_session) && { st: authResponse.auth_session })));
|
|
323
325
|
lead_id = authResponse.lead_id;
|
|
324
326
|
if (!lead_id)
|
|
325
327
|
throw new Error('Lead id is missing');
|
|
@@ -417,6 +419,7 @@ export var verifyNafath = createAsyncThunk('connect/verifyNafath', function (par
|
|
|
417
419
|
return [2, { authResponse: authResponse, countryCode: countryCode }];
|
|
418
420
|
}
|
|
419
421
|
if (!isSuccess) return [3, 16];
|
|
422
|
+
setAxiosGlobalHeaders(__assign(__assign({}, getAxiosHeaders()), ((authResponse === null || authResponse === void 0 ? void 0 : authResponse.auth_session) && { st: authResponse.auth_session })));
|
|
420
423
|
lead_id = authResponse.lead_id;
|
|
421
424
|
if (!lead_id)
|
|
422
425
|
throw new Error('Lead id is missing');
|
|
@@ -58,7 +58,7 @@ var _a;
|
|
|
58
58
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
59
59
|
import { handleNextScreenStep, handleCurrentActiveScreen, handleOpen, handleSetCountryByIso2, onCloseComplete, storeAuthId } from '../../../app/settings';
|
|
60
60
|
import { FlowsTypes, AuthForType, BusinessType, LicenseType, AuthForScreen } from '../../../@types';
|
|
61
|
-
import API from '../../../api';
|
|
61
|
+
import API, { getAxiosHeaders, setAxiosGlobalHeaders } 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
64
|
import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA, isKW, isOtherThanKWOrSA, sendCustomEventToGTM, sendCustomDimension, getMetaData, isNetworkError, isTimeoutError, isInternalServerError, isAuthenticationVerificationFailed } from '../../../utils';
|
|
@@ -385,6 +385,7 @@ export var verifyNafathAsync = createAsyncThunk('connectExpress/verifyNafathAsyn
|
|
|
385
385
|
return [2, { data: data }];
|
|
386
386
|
}
|
|
387
387
|
if (!isSuccess) return [3, 9];
|
|
388
|
+
setAxiosGlobalHeaders(__assign(__assign({}, getAxiosHeaders()), ((data === null || data === void 0 ? void 0 : data.auth_session) && { st: data.auth_session })));
|
|
388
389
|
authId = (_j = data.auth) === null || _j === void 0 ? void 0 : _j.id;
|
|
389
390
|
leadId = (_k = data.auth) === null || _k === void 0 ? void 0 : _k.lead_id;
|
|
390
391
|
thunkApi.dispatch(storeAuthId(authId));
|
|
@@ -506,6 +507,7 @@ export var verifyMobileOtpAsync = createAsyncThunk('connectExpress/verifyMobileO
|
|
|
506
507
|
})];
|
|
507
508
|
case 1:
|
|
508
509
|
data = _h.sent();
|
|
510
|
+
setAxiosGlobalHeaders(__assign(__assign({}, getAxiosHeaders()), ((data === null || data === void 0 ? void 0 : data.auth_session) && { st: data.auth_session })));
|
|
509
511
|
sendCustomEventToGTM({
|
|
510
512
|
event: 'Send Event',
|
|
511
513
|
event_category: 'User Registration Flow',
|
|
@@ -587,6 +589,7 @@ export var verifyPACIAsync = createAsyncThunk('connectExpress/verifyPACIAsync',
|
|
|
587
589
|
case 5:
|
|
588
590
|
isSuccess = ((_e = (_d = data === null || data === void 0 ? void 0 : data.auth) === null || _d === void 0 ? void 0 : _d.status) === null || _e === void 0 ? void 0 : _e.toLowerCase()) === 'success';
|
|
589
591
|
if (!isSuccess) return [3, 9];
|
|
592
|
+
setAxiosGlobalHeaders(__assign(__assign({}, getAxiosHeaders()), ((data === null || data === void 0 ? void 0 : data.auth_session) && { st: data.auth_session })));
|
|
590
593
|
authId = data.auth.id;
|
|
591
594
|
thunkApi.dispatch(storeAuthId(authId));
|
|
592
595
|
if (isScopeAuthentication && !data.new_user && isDataHasIndividualOnly && authId) {
|
|
@@ -69,16 +69,16 @@ var OrBoxStyled = styled(Box)(function (_a) {
|
|
|
69
69
|
});
|
|
70
70
|
});
|
|
71
71
|
var Mobile = function (_a) {
|
|
72
|
-
var _b, _c;
|
|
72
|
+
var _b, _c, _d;
|
|
73
73
|
var settingData = useAppSelector(settingsSelector).data;
|
|
74
|
-
var
|
|
75
|
-
var
|
|
74
|
+
var _e = useAppSelector(connectExpressSelector), data = _e.data, loading = _e.loading, error = _e.error;
|
|
75
|
+
var _f = React.useState(false), anchor = _f[0], setAnchor = _f[1];
|
|
76
76
|
var t = useTranslation().t;
|
|
77
77
|
var isAr = useLanguage().isAr;
|
|
78
78
|
var dispatch = useAppDispatch();
|
|
79
|
-
var
|
|
79
|
+
var _g = useCountry((_b = settingData.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2), isKuwait = _g.isKuwait, isOther = _g.isOther;
|
|
80
80
|
var responseData = data.responseData, isLeadIdPassed = data.isLeadIdPassed;
|
|
81
|
-
var isLeadIdentityIdAvailable = (
|
|
81
|
+
var isLeadIdentityIdAvailable = (_d = (_c = responseData === null || responseData === void 0 ? void 0 : responseData.leadData) === null || _c === void 0 ? void 0 : _c.identification) === null || _d === void 0 ? void 0 : _d.id;
|
|
82
82
|
var methods = useForm({
|
|
83
83
|
resolver: yupResolver(PhoneValidationSchema(isLeadIdPassed)),
|
|
84
84
|
defaultValues: data.mobileData,
|
|
@@ -95,13 +95,14 @@ var Mobile = function (_a) {
|
|
|
95
95
|
dispatch(createMobileAuthAsync(deepCopy(formData)));
|
|
96
96
|
};
|
|
97
97
|
var onBack = function () {
|
|
98
|
+
var _a;
|
|
98
99
|
var screen = isKuwait ? 'CONNECT_EXPRESS_CIVIL_ID_STEP' : 'CONNECT_EXPRESS_NID_STEP';
|
|
99
100
|
var eventAction = isKuwait ? 'PACI Click' : 'Abser Click';
|
|
100
101
|
sendCustomEventToGTM({
|
|
101
102
|
event: 'Send Event',
|
|
102
103
|
event_category: 'User Registration Flow',
|
|
103
104
|
event_action: eventAction,
|
|
104
|
-
event_label: settingData.businessCountry.iso2
|
|
105
|
+
event_label: (_a = settingData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2
|
|
105
106
|
});
|
|
106
107
|
dispatch(handlePrevScreenStep(screen));
|
|
107
108
|
};
|