@tap-payments/auth-jsconnect 2.10.0-beta → 2.10.0-sandbox
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/@types/app.d.ts +7 -1
- package/build/@types/app.js +7 -0
- package/build/@types/form.d.ts +3 -0
- package/build/api/account.d.ts +1 -0
- package/build/api/account.js +7 -0
- package/build/api/auth.d.ts +1 -0
- package/build/api/index.d.ts +1 -0
- package/build/app/settings.d.ts +1 -0
- package/build/app/settings.js +9 -4
- package/build/assets/currencies/SARSymbol.d.ts +7 -0
- package/build/assets/currencies/SARSymbol.js +28 -0
- package/build/assets/currencies/index.d.ts +2 -0
- package/build/assets/currencies/index.js +2 -0
- package/build/assets/currencies/utils.d.ts +4 -0
- package/build/assets/currencies/utils.js +4 -0
- package/build/assets/locales/ar.json +10 -1
- package/build/assets/locales/en.json +36 -1
- package/build/components/TextWithCurrency/TextWithCurrency.d.ts +7 -0
- package/build/components/TextWithCurrency/TextWithCurrency.js +14 -0
- package/build/components/TextWithCurrency/index.d.ts +2 -0
- package/build/components/TextWithCurrency/index.js +2 -0
- package/build/constants/api.d.ts +1 -1
- package/build/constants/api.js +2 -2
- package/build/constants/app.d.ts +3 -1
- package/build/constants/app.js +42 -13
- package/build/constants/assets.d.ts +4 -0
- package/build/constants/assets.js +9 -2
- package/build/constants/validation.d.ts +1 -0
- package/build/constants/validation.js +1 -0
- package/build/features/app/auth/authStore.d.ts +24 -5
- package/build/features/app/auth/authStore.js +186 -89
- package/build/features/app/business/businessStore.js +53 -29
- package/build/features/app/connect/connectStore.js +47 -35
- package/build/features/app/connectExpress/connectExpressStore.d.ts +14 -3
- package/build/features/app/connectExpress/connectExpressStore.js +301 -109
- package/build/features/app/individual/individualStore.js +0 -1
- package/build/features/app/kyc/kycStore.js +49 -25
- package/build/features/auth/screens/OTP/OTP.d.ts +13 -2
- package/build/features/auth/screens/OTP/OTP.js +15 -3
- package/build/features/auth/screens/OTP/index.d.ts +1 -2
- package/build/features/auth/screens/Passcode/Passcode.d.ts +16 -0
- package/build/features/auth/screens/Passcode/Passcode.js +82 -0
- package/build/features/auth/screens/Passcode/PasscodeInput.d.ts +6 -0
- package/build/features/auth/screens/Passcode/PasscodeInput.js +42 -0
- package/build/features/auth/screens/Passcode/index.d.ts +2 -0
- package/build/features/auth/screens/Passcode/index.js +2 -0
- package/build/features/auth/screens/Passcode/validation.d.ts +8 -0
- package/build/features/auth/screens/Passcode/validation.js +4 -0
- package/build/features/brand/screens/BrandActivities/ExpectedSalesRange.js +3 -8
- package/build/features/business/screens/Customers/ExpectedSalesRange.js +3 -8
- package/build/features/business/screens/MobileOwnership/CollectMobileOwnership.js +4 -6
- package/build/features/connect/screens/MobileOwnership/CollectMobileOwnership.js +4 -6
- package/build/features/connectExpress/screens/GenericPrepareDataLoading/GenericPrepareDataLoading.d.ts +3 -0
- package/build/features/connectExpress/screens/GenericPrepareDataLoading/GenericPrepareDataLoading.js +9 -0
- package/build/features/connectExpress/screens/GenericPrepareDataLoading/index.d.ts +2 -0
- package/build/features/connectExpress/screens/GenericPrepareDataLoading/index.js +2 -0
- package/build/features/connectExpress/screens/MobileOwnership/CollectMobileOwnership.js +4 -6
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/OTPInput.d.ts +5 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/OTPInput.js +49 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/VerifyMobileAuthOTP.d.ts +5 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/VerifyMobileAuthOTP.js +88 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/index.d.ts +3 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/index.js +2 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/validation.d.ts +8 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/validation.js +4 -0
- package/build/features/connectExpress/screens/VerifyNafath/VerifyNafath.js +9 -3
- package/build/features/entity/screens/EntityCapital/CapitalPaid.js +3 -7
- package/build/features/entity/screens/EntityCapital/CapitalShareValue.js +3 -7
- package/build/features/featuresScreens.js +10 -0
- package/build/features/individual/screens/AdditionalIndividualInfo/MonthlyIncome.js +3 -8
- package/build/features/individual/screens/AdditionalIndividualInfo/ShareValue.js +3 -8
- package/build/features/kyc/screens/Terms/Terms.js +8 -2
- package/build/features/kyc/screens/Users/Users.js +1 -1
- package/build/features/shared/Background/LogoBackground.js +5 -17
- package/build/features/shared/Button/Button.js +1 -2
- package/build/features/shared/Button/FlowsButtons.js +2 -1
- package/build/features/shared/Input/Input.d.ts +1 -1
- package/build/hooks/useAppConfig.js +1 -1
- package/build/utils/common.d.ts +1 -1
- package/build/utils/common.js +6 -4
- package/build/utils/error.d.ts +1 -0
- package/build/utils/error.js +3 -0
- package/build/utils/string.d.ts +1 -1
- package/package.json +3 -4
|
@@ -1,23 +1,38 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
|
-
import { ActionState, AuthEmailFormValues, AuthForType, AuthMerchantFormValues, AuthenticationListFormValues, CivilFormValues, CountryCode, DOBFormValues, FlowsTypes, MobileFormValues, NIDFormValues, OTPFormValues, PasswordFormValues, SharedState } from '../../../@types';
|
|
2
|
+
import { ActionState, AuthEmailFormValues, AuthForType, AuthMerchantFormValues, AuthenticationListFormValues, CivilFormValues, CountryCode, DOBFormValues, FlowsTypes, MobileFormValues, NIDFormValues, OTPFormValues, PasscodeFormValues, PasswordFormValues, SharedState } from '../../../@types';
|
|
3
3
|
export declare const updateBusinessCountry: import("@reduxjs/toolkit").AsyncThunk<any, string, {}>;
|
|
4
4
|
export declare const retrieveLeadIdentityByIdAsync: import("@reduxjs/toolkit").AsyncThunk<{
|
|
5
5
|
data: any;
|
|
6
6
|
countryCode: CountryCode;
|
|
7
7
|
}, string, {}>;
|
|
8
|
+
interface CreateMobileAuthParams extends MobileFormValues {
|
|
9
|
+
skipPasscode?: boolean;
|
|
10
|
+
}
|
|
8
11
|
export declare const createMobileAuth: import("@reduxjs/toolkit").AsyncThunk<{
|
|
9
12
|
response: any;
|
|
10
|
-
formData:
|
|
11
|
-
|
|
13
|
+
formData: {
|
|
14
|
+
mobile: string;
|
|
15
|
+
countryCode: CountryCode;
|
|
16
|
+
termAndConditionChecked?: boolean | undefined;
|
|
17
|
+
};
|
|
18
|
+
skipPasscode: boolean | undefined;
|
|
19
|
+
}, CreateMobileAuthParams, {}>;
|
|
12
20
|
export declare const resendMobileAuthOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
13
21
|
response: any;
|
|
14
22
|
formData: MobileFormValues;
|
|
15
23
|
}, MobileFormValues, {}>;
|
|
16
24
|
export declare const verifyMobileOtp: import("@reduxjs/toolkit").AsyncThunk<any, OTPFormValues, {}>;
|
|
25
|
+
export declare const verifyPasscode: import("@reduxjs/toolkit").AsyncThunk<any, PasscodeFormValues, {}>;
|
|
26
|
+
interface CreateEmailAuthParams extends AuthEmailFormValues {
|
|
27
|
+
skipPasscode?: boolean;
|
|
28
|
+
}
|
|
17
29
|
export declare const createEmailAuth: import("@reduxjs/toolkit").AsyncThunk<{
|
|
18
30
|
response: any;
|
|
19
|
-
formData:
|
|
20
|
-
|
|
31
|
+
formData: {
|
|
32
|
+
email: string;
|
|
33
|
+
};
|
|
34
|
+
skipPasscode: boolean | undefined;
|
|
35
|
+
}, CreateEmailAuthParams, {}>;
|
|
21
36
|
export declare const verifyEmailPassword: import("@reduxjs/toolkit").AsyncThunk<any, PasswordFormValues, {}>;
|
|
22
37
|
export declare const resendEmailAuthOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
23
38
|
response: any;
|
|
@@ -75,6 +90,10 @@ export interface authData {
|
|
|
75
90
|
otpData: OTPFormValues & {
|
|
76
91
|
authFor?: AuthForType;
|
|
77
92
|
};
|
|
93
|
+
passcodeData: PasscodeFormValues & {
|
|
94
|
+
skipPasscode?: boolean;
|
|
95
|
+
allowOTPToPasscodeRedirection?: boolean;
|
|
96
|
+
};
|
|
78
97
|
passwordData: PasswordFormValues;
|
|
79
98
|
leadId?: string;
|
|
80
99
|
isStartFromBusinessCountry?: boolean;
|
|
@@ -45,6 +45,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
45
45
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
49
|
+
var t = {};
|
|
50
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
51
|
+
t[p] = s[p];
|
|
52
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
53
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
54
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
55
|
+
t[p[i]] = s[p[i]];
|
|
56
|
+
}
|
|
57
|
+
return t;
|
|
58
|
+
};
|
|
48
59
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
49
60
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
50
61
|
if (ar || !(i in from)) {
|
|
@@ -57,10 +68,10 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
57
68
|
var _a;
|
|
58
69
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
59
70
|
import { AuthForType, AuthTypeNumber, FlowsTypes, MigrationStatus } from '../../../@types';
|
|
60
|
-
import { ADD_NEW_ENTITY, AUTH_STEP_NAMES, COLLECT_DOB_INFO_NAFATH, IDENTIFICATION_TYPE, NAFATH_VERIFICATION_FAILED, SCOPE_AUTH, defaultCountry } from '../../../constants';
|
|
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';
|
|
61
72
|
import API from '../../../api';
|
|
62
73
|
import { handleCurrentActiveScreen, handleNextScreenStep, handleOpen, handlePrevScreenStep, handleSetCountryByIso2 } from '../../../app/settings';
|
|
63
|
-
import { findCountryByIddPrefix, openConnect, sendCustomEventToGTM, sleep } from '../../../utils';
|
|
74
|
+
import { findCountryByIddPrefix, isNetworkError, isTimeoutError, openConnect, sendCustomEventToGTM, sleep } from '../../../utils';
|
|
64
75
|
export var updateBusinessCountry = createAsyncThunk('auth/updateBusinessCountry', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
65
76
|
var auth, payload, data;
|
|
66
77
|
return __generator(this, function (_a) {
|
|
@@ -113,40 +124,35 @@ export var retrieveLeadIdentityByIdAsync = createAsyncThunk('auth/retrieveLeadId
|
|
|
113
124
|
}
|
|
114
125
|
});
|
|
115
126
|
}); });
|
|
116
|
-
export var createMobileAuth = createAsyncThunk('auth/createMobileAuth', function (
|
|
117
|
-
var
|
|
118
|
-
var
|
|
119
|
-
return __generator(this, function (
|
|
120
|
-
switch (
|
|
127
|
+
export var createMobileAuth = createAsyncThunk('auth/createMobileAuth', function (_a, thunkApi) { var _b, _c, _d; return __awaiter(void 0, void 0, void 0, function () {
|
|
128
|
+
var _e, settings, auth, isStartWithZero, mobileNumber, requestBody, data, stepName;
|
|
129
|
+
var skipPasscode = _a.skipPasscode, params = __rest(_a, ["skipPasscode"]);
|
|
130
|
+
return __generator(this, function (_f) {
|
|
131
|
+
switch (_f.label) {
|
|
121
132
|
case 0:
|
|
122
|
-
|
|
133
|
+
_e = thunkApi.getState(), settings = _e.settings, auth = _e.auth;
|
|
123
134
|
isStartWithZero = (_b = params.mobile) === null || _b === void 0 ? void 0 : _b.startsWith('0');
|
|
124
135
|
mobileNumber = isStartWithZero ? params.mobile.slice(1) : params.mobile;
|
|
125
|
-
requestBody = {
|
|
126
|
-
country: settings.data.businessCountry.iso2,
|
|
127
|
-
scope: settings.data.appConfig.scope,
|
|
128
|
-
lang: settings.data.language,
|
|
129
|
-
lead_id: auth.data.leadId,
|
|
130
|
-
user_credentail: {
|
|
136
|
+
requestBody = __assign({ country: settings.data.businessCountry.iso2, scope: settings.data.appConfig.scope, lang: settings.data.language, lead_id: auth.data.leadId, user_credentail: {
|
|
131
137
|
phone: mobileNumber || '',
|
|
132
138
|
code: params.countryCode.idd_prefix.toString()
|
|
133
|
-
},
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
};
|
|
139
|
+
}, sign_in: false, login: true, is_lead: true, step_name: AUTH_STEP_NAMES.CREATE_AUTH_MOBILE, encryption_contract: ['user_credentail.phone', 'user_credentail.code'] }, (skipPasscode && {
|
|
140
|
+
auth_info: {
|
|
141
|
+
skip_auth_method: true
|
|
142
|
+
}
|
|
143
|
+
}));
|
|
139
144
|
return [4, API.authService.createAuth(requestBody)];
|
|
140
145
|
case 1:
|
|
141
|
-
data =
|
|
142
|
-
|
|
146
|
+
data = _f.sent();
|
|
147
|
+
stepName = (data === null || data === void 0 ? void 0 : data.auth_type) === AuthTypeNumber.PASSCODE ? 'AUTH_PASSCODE_STEP' : 'AUTH_OTP_STEP';
|
|
148
|
+
thunkApi.dispatch(handleNextScreenStep(stepName));
|
|
143
149
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, requestBody.user_credentail);
|
|
144
|
-
return [2, { response: data, formData: params }];
|
|
150
|
+
return [2, { response: data, formData: params, skipPasscode: skipPasscode }];
|
|
145
151
|
}
|
|
146
152
|
});
|
|
147
153
|
}); });
|
|
148
154
|
export var resendMobileAuthOTP = createAsyncThunk('auth/resendMobileAuthOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
149
|
-
var _a, settings, auth, isStartWithZero, mobileNumber, requestBody, data;
|
|
155
|
+
var _a, settings, auth, isStartWithZero, mobileNumber, skipPasscode, requestBody, data;
|
|
150
156
|
var _b;
|
|
151
157
|
return __generator(this, function (_c) {
|
|
152
158
|
switch (_c.label) {
|
|
@@ -154,20 +160,15 @@ export var resendMobileAuthOTP = createAsyncThunk('auth/resendMobileAuthOTP', fu
|
|
|
154
160
|
_a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
|
|
155
161
|
isStartWithZero = (_b = params.mobile) === null || _b === void 0 ? void 0 : _b.startsWith('0');
|
|
156
162
|
mobileNumber = isStartWithZero ? params.mobile.slice(1) : params.mobile;
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
scope: settings.data.appConfig.scope,
|
|
160
|
-
lang: settings.data.language,
|
|
161
|
-
lead_id: auth.data.leadId,
|
|
162
|
-
user_credentail: {
|
|
163
|
+
skipPasscode = auth.data.passcodeData.skipPasscode;
|
|
164
|
+
requestBody = __assign({ country: settings.data.businessCountry.iso2, scope: settings.data.appConfig.scope, lang: settings.data.language, lead_id: auth.data.leadId, user_credentail: {
|
|
163
165
|
phone: mobileNumber,
|
|
164
166
|
code: params.countryCode.idd_prefix.toString()
|
|
165
|
-
},
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
};
|
|
167
|
+
}, sign_in: false, login: true, is_lead: true, step_name: AUTH_STEP_NAMES.CREATE_AUTH_MOBILE, encryption_contract: ['user_credentail.phone', 'user_credentail.code'] }, (skipPasscode && {
|
|
168
|
+
auth_info: {
|
|
169
|
+
skip_auth_method: true
|
|
170
|
+
}
|
|
171
|
+
}));
|
|
171
172
|
return [4, API.authService.createAuth(requestBody)];
|
|
172
173
|
case 1:
|
|
173
174
|
data = _c.sent();
|
|
@@ -218,37 +219,79 @@ export var verifyMobileOtp = createAsyncThunk('auth/verifyMobileOtp', function (
|
|
|
218
219
|
}
|
|
219
220
|
});
|
|
220
221
|
}); });
|
|
221
|
-
export var
|
|
222
|
-
var _a, settings, auth,
|
|
223
|
-
var
|
|
224
|
-
return __generator(this, function (
|
|
225
|
-
switch (
|
|
222
|
+
export var verifyPasscode = createAsyncThunk('auth/verifyPasscode', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
223
|
+
var _a, settings, auth, _b, responseData, leadId, _c, auth_token, device_token, service_name, auth_type, sign_in, scope, payload, data, stepName_1;
|
|
224
|
+
var _d, _e, _f, _g, _h, _j;
|
|
225
|
+
return __generator(this, function (_k) {
|
|
226
|
+
switch (_k.label) {
|
|
226
227
|
case 0:
|
|
227
228
|
_a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
229
|
+
_b = auth.data || {}, responseData = _b.responseData, leadId = _b.leadId;
|
|
230
|
+
_c = (_d = responseData === null || responseData === void 0 ? void 0 : responseData.authResponse) !== null && _d !== void 0 ? _d : {}, auth_token = _c.auth_token, device_token = _c.device_token, service_name = _c.service_name, auth_type = _c.auth_type, sign_in = _c.sign_in;
|
|
231
|
+
if (!auth_token)
|
|
232
|
+
throw new Error('Auth token is missing');
|
|
233
|
+
scope = settings.data.appConfig.scope;
|
|
234
|
+
payload = {
|
|
235
|
+
auth_token: auth_token,
|
|
236
|
+
lead_id: leadId,
|
|
237
|
+
data: params.passcode,
|
|
238
|
+
auth_type: auth_type,
|
|
239
|
+
device_token: device_token,
|
|
240
|
+
service_name: service_name,
|
|
241
|
+
sign_in: sign_in,
|
|
242
|
+
step_name: AUTH_STEP_NAMES.CREATE_AUTH_PASSCODE,
|
|
243
|
+
encryption_contract: ['data']
|
|
240
244
|
};
|
|
245
|
+
return [4, API.authService.verifyAuth(payload)];
|
|
246
|
+
case 1:
|
|
247
|
+
data = (_k.sent()).data;
|
|
248
|
+
if ((_e = data.errors) === null || _e === void 0 ? void 0 : _e.length)
|
|
249
|
+
throw new Error(data.errors[0].description);
|
|
250
|
+
if (((_f = data === null || data === void 0 ? void 0 : data.status) === null || _f === void 0 ? void 0 : _f.toLowerCase()) === 'success' && (data === null || data === void 0 ? void 0 : data.auth_session)) {
|
|
251
|
+
if (scope === 'merchant') {
|
|
252
|
+
openConnect(settings.data.appConfig.publicKey, settings.data.businessCountry.iso2);
|
|
253
|
+
return [2, data];
|
|
254
|
+
}
|
|
255
|
+
stepName_1 = 'AUTH_PREPARING_DATA_STEP';
|
|
256
|
+
if ((data === null || data === void 0 ? void 0 : data.auth_type) === AuthTypeNumber.MIGRATION)
|
|
257
|
+
stepName_1 = 'AUTH_MIGRATING_DATA_STEP';
|
|
258
|
+
(_h = (_g = settings.data.appConfig).onStepCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, settings.data.activeScreen.name, params);
|
|
259
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep(stepName_1)); });
|
|
260
|
+
}
|
|
261
|
+
else if (((_j = data === null || data === void 0 ? void 0 : data.status) === null || _j === void 0 ? void 0 : _j.toLowerCase()) === 'pending') {
|
|
262
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('AUTH_OTP_STEP')); });
|
|
263
|
+
}
|
|
264
|
+
return [2, data];
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
}); });
|
|
268
|
+
export var createEmailAuth = createAsyncThunk('auth/createEmailAuth', function (_a, thunkApi) { var _b, _c; return __awaiter(void 0, void 0, void 0, function () {
|
|
269
|
+
var _d, settings, auth, requestBody, data, stepName;
|
|
270
|
+
var skipPasscode = _a.skipPasscode, params = __rest(_a, ["skipPasscode"]);
|
|
271
|
+
return __generator(this, function (_e) {
|
|
272
|
+
switch (_e.label) {
|
|
273
|
+
case 0:
|
|
274
|
+
_d = thunkApi.getState(), settings = _d.settings, auth = _d.auth;
|
|
275
|
+
requestBody = __assign({ country: settings.data.businessCountry.iso2, scope: settings.data.appConfig.scope, lang: settings.data.language, lead_id: auth.data.leadId, user_credentail: {
|
|
276
|
+
email: params.email || ''
|
|
277
|
+
}, sign_in: true, login: true, is_lead: false, step_name: AUTH_STEP_NAMES.CREATE_AUTH_EMAIL, encryption_contract: ['user_credentail.email'] }, (skipPasscode && {
|
|
278
|
+
auth_info: {
|
|
279
|
+
skip_auth_method: true
|
|
280
|
+
}
|
|
281
|
+
}));
|
|
241
282
|
return [4, API.authService.createAuth(requestBody)];
|
|
242
283
|
case 1:
|
|
243
|
-
data =
|
|
244
|
-
|
|
284
|
+
data = _e.sent();
|
|
285
|
+
stepName = 'AUTH_PASSWORD_STEP';
|
|
245
286
|
if ((data === null || data === void 0 ? void 0 : data.auth_type) === AuthTypeNumber.RESET_PASSWORD)
|
|
246
|
-
|
|
247
|
-
if ((data === null || data === void 0 ? void 0 : data.auth_type) === AuthTypeNumber.EMAIL_OTP)
|
|
248
|
-
|
|
249
|
-
|
|
287
|
+
stepName = 'AUTH_RESET_PASSWORD_MESSAGE_STEP';
|
|
288
|
+
else if ((data === null || data === void 0 ? void 0 : data.auth_type) === AuthTypeNumber.EMAIL_OTP)
|
|
289
|
+
stepName = 'AUTH_OTP_STEP';
|
|
290
|
+
else if ((data === null || data === void 0 ? void 0 : data.auth_type) === AuthTypeNumber.PASSCODE)
|
|
291
|
+
stepName = 'AUTH_PASSCODE_STEP';
|
|
292
|
+
thunkApi.dispatch(handleNextScreenStep(stepName));
|
|
250
293
|
(_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, requestBody.user_credentail);
|
|
251
|
-
return [2, { response: data, formData: params }];
|
|
294
|
+
return [2, { response: data, formData: params, skipPasscode: skipPasscode }];
|
|
252
295
|
}
|
|
253
296
|
});
|
|
254
297
|
}); });
|
|
@@ -296,24 +339,19 @@ export var verifyEmailPassword = createAsyncThunk('auth/verifyEmailPassword', fu
|
|
|
296
339
|
});
|
|
297
340
|
}); });
|
|
298
341
|
export var resendEmailAuthOTP = createAsyncThunk('auth/resendEmailAuthOTP', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
299
|
-
var _a, settings, auth, requestBody, data;
|
|
342
|
+
var _a, settings, auth, skipPasscode, requestBody, data;
|
|
300
343
|
return __generator(this, function (_b) {
|
|
301
344
|
switch (_b.label) {
|
|
302
345
|
case 0:
|
|
303
346
|
_a = thunkApi.getState(), settings = _a.settings, auth = _a.auth;
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
scope: settings.data.appConfig.scope,
|
|
307
|
-
lang: settings.data.language,
|
|
308
|
-
lead_id: auth.data.leadId,
|
|
309
|
-
user_credentail: {
|
|
347
|
+
skipPasscode = auth.data.passcodeData.skipPasscode;
|
|
348
|
+
requestBody = __assign({ country: settings.data.businessCountry.iso2, scope: settings.data.appConfig.scope, lang: settings.data.language, lead_id: auth.data.leadId, user_credentail: {
|
|
310
349
|
email: params.email || ''
|
|
311
|
-
},
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
};
|
|
350
|
+
}, sign_in: true, login: true, is_lead: false, step_name: AUTH_STEP_NAMES.CREATE_AUTH_EMAIL, encryption_contract: ['user_credentail.email'] }, (skipPasscode && {
|
|
351
|
+
auth_info: {
|
|
352
|
+
skip_auth_method: true
|
|
353
|
+
}
|
|
354
|
+
}));
|
|
317
355
|
return [4, API.authService.createAuth(requestBody)];
|
|
318
356
|
case 1:
|
|
319
357
|
data = _b.sent();
|
|
@@ -414,17 +452,29 @@ export var verifyNafath = createAsyncThunk('auth/verifyNafath', function (params
|
|
|
414
452
|
interval = 3;
|
|
415
453
|
maxCalls = Math.floor(expiry / interval);
|
|
416
454
|
_loop_1 = function (count) {
|
|
417
|
-
var data, isSuccess, isFailed, screen_1;
|
|
455
|
+
var data, error_1, isSuccess, isFailed, screen_1;
|
|
418
456
|
return __generator(this, function (_h) {
|
|
419
457
|
switch (_h.label) {
|
|
420
458
|
case 0:
|
|
421
459
|
if (thunkApi.signal.aborted) {
|
|
422
460
|
return [2, "break"];
|
|
423
461
|
}
|
|
424
|
-
|
|
462
|
+
data = void 0;
|
|
463
|
+
_h.label = 1;
|
|
425
464
|
case 1:
|
|
465
|
+
_h.trys.push([1, 3, , 4]);
|
|
466
|
+
return [4, API.authService.getVerifyAuth(authResponse === null || authResponse === void 0 ? void 0 : authResponse.auth_token, { timeout: NAFATH_PACI_TIMEOUT_DURATION })];
|
|
467
|
+
case 2:
|
|
426
468
|
data = _h.sent();
|
|
427
|
-
|
|
469
|
+
return [3, 4];
|
|
470
|
+
case 3:
|
|
471
|
+
error_1 = _h.sent();
|
|
472
|
+
if (!isNetworkError(error_1.message) && !isTimeoutError(error_1.message)) {
|
|
473
|
+
throw new Error(error_1);
|
|
474
|
+
}
|
|
475
|
+
return [3, 4];
|
|
476
|
+
case 4:
|
|
477
|
+
isSuccess = ((_b = data === null || data === void 0 ? void 0 : data.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'success';
|
|
428
478
|
isFailed = ((_c = data === null || data === void 0 ? void 0 : data.status) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'failed';
|
|
429
479
|
if (isFailed) {
|
|
430
480
|
(_d = params.onFailure) === null || _d === void 0 ? void 0 : _d.call(params);
|
|
@@ -441,7 +491,7 @@ export var verifyNafath = createAsyncThunk('auth/verifyNafath', function (params
|
|
|
441
491
|
return [2, { value: data }];
|
|
442
492
|
}
|
|
443
493
|
return [4, sleep(interval * 1000)];
|
|
444
|
-
case
|
|
494
|
+
case 5:
|
|
445
495
|
_h.sent();
|
|
446
496
|
return [2];
|
|
447
497
|
}
|
|
@@ -521,7 +571,7 @@ export var createCivilIdAuth = createAsyncThunk('auth/createCivilAuth', function
|
|
|
521
571
|
});
|
|
522
572
|
}); });
|
|
523
573
|
export var verifyPACI = createAsyncThunk('auth/verifyPACI', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
524
|
-
var _a, settings, auth, authResponse, scope, expiry, interval, maxCalls, count, data, isSuccess;
|
|
574
|
+
var _a, settings, auth, authResponse, scope, expiry, interval, maxCalls, count, data, error_2, isSuccess;
|
|
525
575
|
var _b, _c, _d;
|
|
526
576
|
return __generator(this, function (_e) {
|
|
527
577
|
switch (_e.label) {
|
|
@@ -535,13 +585,25 @@ export var verifyPACI = createAsyncThunk('auth/verifyPACI', function (params, th
|
|
|
535
585
|
count = 1;
|
|
536
586
|
_e.label = 1;
|
|
537
587
|
case 1:
|
|
538
|
-
if (!(count <= maxCalls)) return [3,
|
|
588
|
+
if (!(count <= maxCalls)) return [3, 8];
|
|
539
589
|
if (thunkApi.signal.aborted) {
|
|
540
|
-
return [3,
|
|
590
|
+
return [3, 8];
|
|
541
591
|
}
|
|
542
|
-
|
|
592
|
+
data = void 0;
|
|
593
|
+
_e.label = 2;
|
|
543
594
|
case 2:
|
|
595
|
+
_e.trys.push([2, 4, , 5]);
|
|
596
|
+
return [4, API.authService.getVerifyAuth(authResponse === null || authResponse === void 0 ? void 0 : authResponse.auth_token, { timeout: NAFATH_PACI_TIMEOUT_DURATION })];
|
|
597
|
+
case 3:
|
|
544
598
|
data = _e.sent();
|
|
599
|
+
return [3, 5];
|
|
600
|
+
case 4:
|
|
601
|
+
error_2 = _e.sent();
|
|
602
|
+
if (!isNetworkError(error_2.message) && !isTimeoutError(error_2.message)) {
|
|
603
|
+
throw new Error(error_2);
|
|
604
|
+
}
|
|
605
|
+
return [3, 5];
|
|
606
|
+
case 5:
|
|
545
607
|
isSuccess = ((_b = data === null || data === void 0 ? void 0 : data.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'success';
|
|
546
608
|
if (isSuccess) {
|
|
547
609
|
if (scope === 'merchant') {
|
|
@@ -553,13 +615,13 @@ export var verifyPACI = createAsyncThunk('auth/verifyPACI', function (params, th
|
|
|
553
615
|
return [2, data];
|
|
554
616
|
}
|
|
555
617
|
return [4, sleep(interval * 1000)];
|
|
556
|
-
case
|
|
618
|
+
case 6:
|
|
557
619
|
_e.sent();
|
|
558
|
-
_e.label =
|
|
559
|
-
case
|
|
620
|
+
_e.label = 7;
|
|
621
|
+
case 7:
|
|
560
622
|
count++;
|
|
561
623
|
return [3, 1];
|
|
562
|
-
case
|
|
624
|
+
case 8: throw new Error('paci_verification_failed');
|
|
563
625
|
}
|
|
564
626
|
});
|
|
565
627
|
}); });
|
|
@@ -626,19 +688,27 @@ export var checkAccountAvailability = createAsyncThunk('auth/checkAccountAvailab
|
|
|
626
688
|
isDataHasIndividualOnly = (authConfigData === null || authConfigData === void 0 ? void 0 : authConfigData.length) === 1 && authConfigData.includes('individual');
|
|
627
689
|
data = (_c = auth.data.responseData) === null || _c === void 0 ? void 0 : _c.authResponse;
|
|
628
690
|
authId = (data || {}).id;
|
|
629
|
-
|
|
691
|
+
accountData = undefined;
|
|
692
|
+
if (!isDataHasIndividualOnly) return [3, 2];
|
|
693
|
+
return [4, API.accountService.checkAccountAvailabilityStatus(data === null || data === void 0 ? void 0 : data.individual_id)];
|
|
630
694
|
case 1:
|
|
631
695
|
accountData = _d.sent();
|
|
696
|
+
return [3, 4];
|
|
697
|
+
case 2: return [4, API.accountService.checkAccountAvailability(data === null || data === void 0 ? void 0 : data.individual_id)];
|
|
698
|
+
case 3:
|
|
699
|
+
accountData = _d.sent();
|
|
700
|
+
_d.label = 4;
|
|
701
|
+
case 4:
|
|
632
702
|
_b = accountData || {}, step_name = _b.step_name, brands = _b.brands, entities = _b.entities;
|
|
633
703
|
brandList = brands || [];
|
|
634
704
|
entityList = entities || [];
|
|
635
705
|
isExistingUser = step_name === 'select_account';
|
|
636
|
-
if (!(isExistingUser && isDataHasIndividualOnly && authId)) return [3,
|
|
706
|
+
if (!(isExistingUser && isDataHasIndividualOnly && authId)) return [3, 6];
|
|
637
707
|
return [4, thunkApi.dispatch(confirmInfo({ authId: authId }))];
|
|
638
|
-
case
|
|
708
|
+
case 5:
|
|
639
709
|
_d.sent();
|
|
640
710
|
return [2, { brandList: brandList, entityList: entityList }];
|
|
641
|
-
case
|
|
711
|
+
case 6:
|
|
642
712
|
if (isExistingUser && authDataHasValue && brandList.length && entityList.length) {
|
|
643
713
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('AUTH_AUTHENTICATION_LIST_STEP')); });
|
|
644
714
|
return [2, { brandList: brandList, entityList: entityList }];
|
|
@@ -829,6 +899,9 @@ var initialState = {
|
|
|
829
899
|
otp: '',
|
|
830
900
|
authFor: AuthForType.MOBILE
|
|
831
901
|
},
|
|
902
|
+
passcodeData: {
|
|
903
|
+
passcode: ''
|
|
904
|
+
},
|
|
832
905
|
passwordData: {
|
|
833
906
|
password: ''
|
|
834
907
|
},
|
|
@@ -923,6 +996,8 @@ export var authSlice = createSlice({
|
|
|
923
996
|
state.loading = false;
|
|
924
997
|
state.data.mobileData = action.payload.formData;
|
|
925
998
|
state.data.otpData.authFor = AuthForType.MOBILE;
|
|
999
|
+
state.data.passcodeData.skipPasscode = action.payload.skipPasscode;
|
|
1000
|
+
state.data.passcodeData.allowOTPToPasscodeRedirection = action.payload.skipPasscode;
|
|
926
1001
|
state.data.responseData = __assign(__assign({}, state.data.responseData), { authResponse: action.payload.response });
|
|
927
1002
|
})
|
|
928
1003
|
.addCase(createMobileAuth.rejected, function (state, action) {
|
|
@@ -949,10 +1024,28 @@ export var authSlice = createSlice({
|
|
|
949
1024
|
state.loading = false;
|
|
950
1025
|
var data = action.payload;
|
|
951
1026
|
state.data.responseData = __assign(__assign({}, state.data.responseData), { authResponse: __assign(__assign({}, (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.authResponse), data) });
|
|
1027
|
+
state.data.passcodeData.skipPasscode = false;
|
|
1028
|
+
state.data.passcodeData.allowOTPToPasscodeRedirection = false;
|
|
952
1029
|
})
|
|
953
1030
|
.addCase(verifyMobileOtp.rejected, function (state, action) {
|
|
954
1031
|
state.loading = false;
|
|
955
1032
|
state.error = action.error.message;
|
|
1033
|
+
})
|
|
1034
|
+
.addCase(verifyPasscode.pending, function (state) {
|
|
1035
|
+
state.loading = true;
|
|
1036
|
+
state.error = null;
|
|
1037
|
+
})
|
|
1038
|
+
.addCase(verifyPasscode.fulfilled, function (state, action) {
|
|
1039
|
+
var _a, _b;
|
|
1040
|
+
state.loading = false;
|
|
1041
|
+
var data = action.payload;
|
|
1042
|
+
state.data.responseData = __assign(__assign({}, state.data.responseData), { authResponse: __assign(__assign({}, (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.authResponse), data) });
|
|
1043
|
+
state.data.passcodeData.skipPasscode = ((_b = data === null || data === void 0 ? void 0 : data.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'pending';
|
|
1044
|
+
state.data.passcodeData.allowOTPToPasscodeRedirection = false;
|
|
1045
|
+
})
|
|
1046
|
+
.addCase(verifyPasscode.rejected, function (state, action) {
|
|
1047
|
+
state.loading = false;
|
|
1048
|
+
state.error = action.error.message;
|
|
956
1049
|
})
|
|
957
1050
|
.addCase(createEmailAuth.pending, function (state) {
|
|
958
1051
|
state.loading = true;
|
|
@@ -962,6 +1055,8 @@ export var authSlice = createSlice({
|
|
|
962
1055
|
state.loading = false;
|
|
963
1056
|
state.data.emailData = action.payload.formData;
|
|
964
1057
|
state.data.otpData.authFor = AuthForType.EMAIL;
|
|
1058
|
+
state.data.passcodeData.skipPasscode = action.payload.skipPasscode;
|
|
1059
|
+
state.data.passcodeData.allowOTPToPasscodeRedirection = action.payload.skipPasscode;
|
|
965
1060
|
state.data.responseData = __assign(__assign({}, state.data.responseData), { authResponse: action.payload.response });
|
|
966
1061
|
})
|
|
967
1062
|
.addCase(createEmailAuth.rejected, function (state, action) {
|
|
@@ -1002,6 +1097,8 @@ export var authSlice = createSlice({
|
|
|
1002
1097
|
state.loading = false;
|
|
1003
1098
|
var data = action.payload;
|
|
1004
1099
|
state.data.responseData = __assign(__assign({}, state.data.responseData), { authResponse: __assign(__assign({}, (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.authResponse), data) });
|
|
1100
|
+
state.data.passcodeData.skipPasscode = false;
|
|
1101
|
+
state.data.passcodeData.allowOTPToPasscodeRedirection = false;
|
|
1005
1102
|
})
|
|
1006
1103
|
.addCase(verifyEmailOtp.rejected, function (state, action) {
|
|
1007
1104
|
state.loading = false;
|