@tap-payments/auth-jsconnect 2.10.14-beta → 2.11.0-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/@types/app.d.ts +2 -1
- package/build/@types/app.js +1 -0
- package/build/@types/form.d.ts +3 -0
- package/build/api/auth.d.ts +1 -0
- package/build/assets/locales/ar.json +5 -1
- package/build/assets/locales/en.json +31 -1
- package/build/constants/app.d.ts +1 -0
- package/build/constants/app.js +11 -4
- package/build/features/app/auth/authStore.d.ts +24 -5
- package/build/features/app/auth/authStore.js +136 -71
- package/build/features/app/connectExpress/connectExpressStore.js +1 -1
- 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/featuresScreens.js +5 -0
- package/build/features/shared/Button/Button.js +1 -2
- package/package.json +1 -1
package/build/@types/app.d.ts
CHANGED
package/build/@types/app.js
CHANGED
|
@@ -56,6 +56,7 @@ export var AuthTypeNumber;
|
|
|
56
56
|
AuthTypeNumber[AuthTypeNumber["PASSWORD"] = 1] = "PASSWORD";
|
|
57
57
|
AuthTypeNumber[AuthTypeNumber["MIGRATION"] = 10] = "MIGRATION";
|
|
58
58
|
AuthTypeNumber[AuthTypeNumber["RESET_PASSWORD"] = 7] = "RESET_PASSWORD";
|
|
59
|
+
AuthTypeNumber[AuthTypeNumber["PASSCODE"] = 11] = "PASSCODE";
|
|
59
60
|
})(AuthTypeNumber || (AuthTypeNumber = {}));
|
|
60
61
|
export var MigrationStatus;
|
|
61
62
|
(function (MigrationStatus) {
|
package/build/@types/form.d.ts
CHANGED
package/build/api/auth.d.ts
CHANGED
|
@@ -643,5 +643,9 @@
|
|
|
643
643
|
"current_mobile_number": "رقم الجوال الحالي",
|
|
644
644
|
"new_mobile_number": "رقم الجوال الجديد",
|
|
645
645
|
"update_mobile_number": "تحديث رقم الجوال",
|
|
646
|
-
"update_later": "سأقوم بالتحديث لاحقاً"
|
|
646
|
+
"update_later": "سأقوم بالتحديث لاحقاً",
|
|
647
|
+
"passcode_title": "الرجاء إدخال رمز المرور الخاص بك",
|
|
648
|
+
"sign_in_with_otp": "تسجيل الدخول باستخدام رمز التحقق (OTP)",
|
|
649
|
+
"passcode_required": "الرجاء إدخال رمز المرور المطلوب",
|
|
650
|
+
"login_with_passcode": "تسجيل الدخول باستخدام رمز المرور"
|
|
647
651
|
}
|
|
@@ -670,5 +670,35 @@
|
|
|
670
670
|
"current_mobile_number": "Current mobile number",
|
|
671
671
|
"new_mobile_number": "New mobile number",
|
|
672
672
|
"update_mobile_number": "Update mobile number",
|
|
673
|
-
"update_later": "I'll update later"
|
|
673
|
+
"update_later": "I'll update later",
|
|
674
|
+
"terminal_manage_terminals": "Manage Terminals",
|
|
675
|
+
"terminal_link_terminal": "Link Terminal",
|
|
676
|
+
"terminal_linked": "Linked",
|
|
677
|
+
"terminal_link": "Link",
|
|
678
|
+
"terminal_unlinked": "Unlinked",
|
|
679
|
+
"terminal_paired_with": "Paired with",
|
|
680
|
+
"terminal_device_id": "Device ID",
|
|
681
|
+
"terminal_serial_number": "Serial no",
|
|
682
|
+
"terminal_qr_code_description": "Open the Tap app on the terminal and select Linked Terminal from the More menu.",
|
|
683
|
+
"terminal_or_use_code": "or use code",
|
|
684
|
+
"terminal_unlink": "Unlink",
|
|
685
|
+
"terminal_linked_with": "Linked with",
|
|
686
|
+
"terminal_send_link_request": "Send linking request",
|
|
687
|
+
"terminal_request_will_send": "A request will be sent to Tap Terminal app to confirm linking.",
|
|
688
|
+
"terminal_new_request_will_send": "A new link request bas ben sent to Tap Terminal app to confirm linking.",
|
|
689
|
+
"terminal_resend_request": "Resend Request",
|
|
690
|
+
"terminal_with": "with",
|
|
691
|
+
"terminal_request_denied": "The Request to link Terminal {{device}} has been denied.",
|
|
692
|
+
"terminal_go_to_board": "Go to Board",
|
|
693
|
+
"terminal_linked_success": "Your terminal {{device}} is linked successfully",
|
|
694
|
+
"terminal_unlinked_success": "Your terminal {{device}} is unlinked successfully",
|
|
695
|
+
"terminal_no_terminal_linked": "No Terminal Linked",
|
|
696
|
+
"terminal_no_terminal_linked_description": "We will list the linked terminals here when available",
|
|
697
|
+
"terminal_push_notification_link_new_terminal_failed": "Something went wrong. Please try again later",
|
|
698
|
+
"terminal_id": "Terminal ID",
|
|
699
|
+
"terminal_devices": "{{name}} Devices",
|
|
700
|
+
"passcode_title": "Please enter your passcode",
|
|
701
|
+
"sign_in_with_otp": "Sign in with OTP",
|
|
702
|
+
"passcode_required": "Please enter the required Passcode",
|
|
703
|
+
"login_with_passcode": "Login with Passcode"
|
|
674
704
|
}
|
package/build/constants/app.d.ts
CHANGED
|
@@ -121,6 +121,7 @@ export declare const AUTH_STEP_NAMES: {
|
|
|
121
121
|
CREATE_AUTH_NID: string;
|
|
122
122
|
VERIFY_AUTH_NID: string;
|
|
123
123
|
UPDATE_DOB_INFO: string;
|
|
124
|
+
CREATE_AUTH_PASSCODE: string;
|
|
124
125
|
};
|
|
125
126
|
export declare const CONNECT_EXPRESS_STEP_NAMES: {
|
|
126
127
|
CREATE_AUTH_MOBILE: string;
|
package/build/constants/app.js
CHANGED
|
@@ -332,13 +332,13 @@ export var AUTH_SCREENS_NAVIGATION = [
|
|
|
332
332
|
},
|
|
333
333
|
{
|
|
334
334
|
name: 'AUTH_MOBILE_STEP',
|
|
335
|
-
next: 'AUTH_OTP_STEP',
|
|
335
|
+
next: ['AUTH_OTP_STEP', 'AUTH_PASSCODE_STEP'],
|
|
336
336
|
prev: 'AUTH_SWITCH_STEP',
|
|
337
337
|
order: 1
|
|
338
338
|
},
|
|
339
339
|
{
|
|
340
340
|
name: 'AUTH_EMAIL_STEP',
|
|
341
|
-
next: ['AUTH_PASSWORD_STEP', 'AUTH_RESET_PASSWORD_MESSAGE_STEP', 'AUTH_OTP_STEP'],
|
|
341
|
+
next: ['AUTH_PASSWORD_STEP', 'AUTH_RESET_PASSWORD_MESSAGE_STEP', 'AUTH_OTP_STEP', 'AUTH_PASSCODE_STEP'],
|
|
342
342
|
prev: 'AUTH_SWITCH_STEP',
|
|
343
343
|
order: 1
|
|
344
344
|
},
|
|
@@ -356,10 +356,16 @@ export var AUTH_SCREENS_NAVIGATION = [
|
|
|
356
356
|
},
|
|
357
357
|
{
|
|
358
358
|
name: 'AUTH_OTP_STEP',
|
|
359
|
-
next: ['AUTH_PREPARING_DATA_STEP', 'AUTH_EMAIL_SENT_STEP', 'AUTH_MIGRATING_DATA_STEP'],
|
|
359
|
+
next: ['AUTH_PREPARING_DATA_STEP', 'AUTH_EMAIL_SENT_STEP', 'AUTH_MIGRATING_DATA_STEP', 'AUTH_PASSCODE_STEP'],
|
|
360
360
|
prev: ['AUTH_MOBILE_STEP', 'AUTH_NID_STEP', 'AUTH_EMAIL_STEP', 'AUTH_PASSWORD_STEP'],
|
|
361
361
|
order: 2
|
|
362
362
|
},
|
|
363
|
+
{
|
|
364
|
+
name: 'AUTH_PASSCODE_STEP',
|
|
365
|
+
next: ['AUTH_OTP_STEP', 'AUTH_PREPARING_DATA_STEP', 'AUTH_MIGRATING_DATA_STEP'],
|
|
366
|
+
prev: ['AUTH_MOBILE_STEP', 'AUTH_EMAIL_STEP'],
|
|
367
|
+
order: 2
|
|
368
|
+
},
|
|
363
369
|
{
|
|
364
370
|
name: 'AUTH_NAFATH_VERIFY_STEP',
|
|
365
371
|
next: ['AUTH_PREPARING_DATA_STEP', 'AUTH_DOB_STEP'],
|
|
@@ -1043,7 +1049,8 @@ export var AUTH_STEP_NAMES = {
|
|
|
1043
1049
|
VERIFY_AUTH_EMAIL: 'auth_verify_auth_email',
|
|
1044
1050
|
CREATE_AUTH_NID: 'auth_create_auth_nid',
|
|
1045
1051
|
VERIFY_AUTH_NID: 'auth_verify_auth_nid',
|
|
1046
|
-
UPDATE_DOB_INFO: 'auth_update_dob_info'
|
|
1052
|
+
UPDATE_DOB_INFO: 'auth_update_dob_info',
|
|
1053
|
+
CREATE_AUTH_PASSCODE: 'auth_create_auth_passcode'
|
|
1047
1054
|
};
|
|
1048
1055
|
export var CONNECT_EXPRESS_STEP_NAMES = {
|
|
1049
1056
|
CREATE_AUTH_MOBILE: 'connect_express_create_auth_mobile',
|
|
@@ -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)) {
|
|
@@ -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();
|
|
@@ -861,6 +899,9 @@ var initialState = {
|
|
|
861
899
|
otp: '',
|
|
862
900
|
authFor: AuthForType.MOBILE
|
|
863
901
|
},
|
|
902
|
+
passcodeData: {
|
|
903
|
+
passcode: ''
|
|
904
|
+
},
|
|
864
905
|
passwordData: {
|
|
865
906
|
password: ''
|
|
866
907
|
},
|
|
@@ -955,6 +996,8 @@ export var authSlice = createSlice({
|
|
|
955
996
|
state.loading = false;
|
|
956
997
|
state.data.mobileData = action.payload.formData;
|
|
957
998
|
state.data.otpData.authFor = AuthForType.MOBILE;
|
|
999
|
+
state.data.passcodeData.skipPasscode = action.payload.skipPasscode;
|
|
1000
|
+
state.data.passcodeData.allowOTPToPasscodeRedirection = action.payload.skipPasscode;
|
|
958
1001
|
state.data.responseData = __assign(__assign({}, state.data.responseData), { authResponse: action.payload.response });
|
|
959
1002
|
})
|
|
960
1003
|
.addCase(createMobileAuth.rejected, function (state, action) {
|
|
@@ -981,10 +1024,28 @@ export var authSlice = createSlice({
|
|
|
981
1024
|
state.loading = false;
|
|
982
1025
|
var data = action.payload;
|
|
983
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;
|
|
984
1029
|
})
|
|
985
1030
|
.addCase(verifyMobileOtp.rejected, function (state, action) {
|
|
986
1031
|
state.loading = false;
|
|
987
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;
|
|
988
1049
|
})
|
|
989
1050
|
.addCase(createEmailAuth.pending, function (state) {
|
|
990
1051
|
state.loading = true;
|
|
@@ -994,6 +1055,8 @@ export var authSlice = createSlice({
|
|
|
994
1055
|
state.loading = false;
|
|
995
1056
|
state.data.emailData = action.payload.formData;
|
|
996
1057
|
state.data.otpData.authFor = AuthForType.EMAIL;
|
|
1058
|
+
state.data.passcodeData.skipPasscode = action.payload.skipPasscode;
|
|
1059
|
+
state.data.passcodeData.allowOTPToPasscodeRedirection = action.payload.skipPasscode;
|
|
997
1060
|
state.data.responseData = __assign(__assign({}, state.data.responseData), { authResponse: action.payload.response });
|
|
998
1061
|
})
|
|
999
1062
|
.addCase(createEmailAuth.rejected, function (state, action) {
|
|
@@ -1034,6 +1097,8 @@ export var authSlice = createSlice({
|
|
|
1034
1097
|
state.loading = false;
|
|
1035
1098
|
var data = action.payload;
|
|
1036
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;
|
|
1037
1102
|
})
|
|
1038
1103
|
.addCase(verifyEmailOtp.rejected, function (state, action) {
|
|
1039
1104
|
state.loading = false;
|
|
@@ -831,7 +831,7 @@ export var verifyPaciLeadIdentityAsync = createAsyncThunk('connectExpress/verify
|
|
|
831
831
|
case 9:
|
|
832
832
|
count++;
|
|
833
833
|
return [3, 1];
|
|
834
|
-
case 10: throw new Error('
|
|
834
|
+
case 10: throw new Error('paci_verification_failed');
|
|
835
835
|
}
|
|
836
836
|
});
|
|
837
837
|
}); });
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export
|
|
3
|
-
|
|
2
|
+
export declare const PasscodeLoginStyled: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material/styles").Theme> & {
|
|
3
|
+
align?: "left" | "right" | "inherit" | "center" | "justify" | undefined;
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
classes?: Partial<import("@mui/material").TypographyClasses> | undefined;
|
|
6
|
+
gutterBottom?: boolean | undefined;
|
|
7
|
+
noWrap?: boolean | undefined;
|
|
8
|
+
paragraph?: boolean | undefined;
|
|
9
|
+
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
10
|
+
variant?: "button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | undefined;
|
|
11
|
+
variantMapping?: Partial<Record<"button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline", string>> | undefined;
|
|
12
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof React.HTMLAttributes<HTMLSpanElement>> & {
|
|
13
|
+
ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
|
|
14
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | ("left" | "right" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "top" | "bottom" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform") | "children" | "sx" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
4
15
|
declare const _default: React.MemoExoticComponent<() => JSX.Element>;
|
|
5
16
|
export default _default;
|
|
@@ -14,9 +14,9 @@ import * as React from 'react';
|
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
16
16
|
import Box from '@mui/material/Box/Box';
|
|
17
|
-
import { styled } from '@mui/material/styles';
|
|
17
|
+
import { styled, useTheme } from '@mui/material/styles';
|
|
18
18
|
import Text from '../../../../components/Text';
|
|
19
|
-
import { clearError, authSelector, verifyMobileOtp, resetOTPValue, verifyEmailOtp } from '../../../app/auth/authStore';
|
|
19
|
+
import { clearError, authSelector, verifyMobileOtp, resetOTPValue, verifyEmailOtp, createEmailAuth, createMobileAuth } from '../../../app/auth/authStore';
|
|
20
20
|
import Button from '../../../shared/Button';
|
|
21
21
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
22
22
|
import { useAppDispatch, useAppSelector, useLanguage, useSanitizedTranslation } from '../../../../hooks';
|
|
@@ -46,8 +46,13 @@ var FormStyled = styled(Form)(function () { return ({
|
|
|
46
46
|
display: 'flex',
|
|
47
47
|
flexDirection: 'column'
|
|
48
48
|
}); });
|
|
49
|
+
export var PasscodeLoginStyled = styled(Text)(function (_a) {
|
|
50
|
+
var _b = _a.theme, spacing = _b.spacing, palette = _b.palette, typography = _b.typography;
|
|
51
|
+
return (__assign(__assign({}, typography.caption), { color: palette.primary.main, lineHeight: 1.75, textAlign: 'center', marginTop: spacing(5), cursor: 'pointer' }));
|
|
52
|
+
});
|
|
49
53
|
var OTP = function () {
|
|
50
54
|
var _a;
|
|
55
|
+
var spacing = useTheme().spacing;
|
|
51
56
|
var dispatch = useAppDispatch();
|
|
52
57
|
var _b = useAppSelector(authSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
53
58
|
var t = useTranslation().t;
|
|
@@ -112,7 +117,14 @@ var OTP = function () {
|
|
|
112
117
|
screen = 'AUTH_EMAIL_STEP';
|
|
113
118
|
dispatch(handlePrevScreenStep(screen));
|
|
114
119
|
};
|
|
120
|
+
var onOTPLoginClick = function () {
|
|
121
|
+
if (isEmailAuth)
|
|
122
|
+
dispatch(createEmailAuth({ email: data.emailData.email }));
|
|
123
|
+
else
|
|
124
|
+
dispatch(createMobileAuth({ mobile: data.mobileData.mobile, countryCode: data.mobileData.countryCode }));
|
|
125
|
+
};
|
|
115
126
|
var disabled = !methods.formState.isValid;
|
|
116
|
-
|
|
127
|
+
var showLoginWithPasscode = data.passcodeData.allowOTPToPasscodeRedirection;
|
|
128
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? st('ide_otp_waiting_title') : getTitle(), !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: getNumber() }))] }) }), _jsx(OTPInput, {}), showLoginWithPasscode && _jsx(PasscodeLoginStyled, __assign({ onClick: onOTPLoginClick }, { children: st('login_with_passcode') })), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: st(error || '') }, (showLoginWithPasscode && { sx: { marginTop: spacing(2.25) } }), { children: t('next') }))] })) })) }));
|
|
117
129
|
};
|
|
118
130
|
export default React.memo(OTP);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const OTPSignInStyled: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material/styles").Theme> & {
|
|
3
|
+
align?: "left" | "right" | "inherit" | "center" | "justify" | undefined;
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
classes?: Partial<import("@mui/material").TypographyClasses> | undefined;
|
|
6
|
+
gutterBottom?: boolean | undefined;
|
|
7
|
+
noWrap?: boolean | undefined;
|
|
8
|
+
paragraph?: boolean | undefined;
|
|
9
|
+
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
10
|
+
variant?: "button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | undefined;
|
|
11
|
+
variantMapping?: Partial<Record<"button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline", string>> | undefined;
|
|
12
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof React.HTMLAttributes<HTMLSpanElement>> & {
|
|
13
|
+
ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
|
|
14
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | ("left" | "right" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "top" | "bottom" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "p" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform") | "children" | "sx" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
15
|
+
declare const _default: React.MemoExoticComponent<() => JSX.Element>;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import Box from '@mui/material/Box/Box';
|
|
15
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
16
|
+
import { useForm, FormProvider } from 'react-hook-form';
|
|
17
|
+
import { styled, useTheme } from '@mui/material/styles';
|
|
18
|
+
import Form from '../../../../components/Form';
|
|
19
|
+
import Text from '../../../../components/Text';
|
|
20
|
+
import { deepCopy } from '../../../../utils';
|
|
21
|
+
import Button from '../../../shared/Button';
|
|
22
|
+
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
23
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
24
|
+
import { AuthForType } from '../../../../@types';
|
|
25
|
+
import { useAppDispatch, useAppSelector, useLanguage, useSanitizedTranslation } from '../../../../hooks';
|
|
26
|
+
import { clearError, authSelector, verifyPasscode, createEmailAuth, createMobileAuth } from '../../../app/auth/authStore';
|
|
27
|
+
import { validation } from './validation';
|
|
28
|
+
import PasscodeInput from './PasscodeInput';
|
|
29
|
+
var TitleContainerStyled = styled(Box)(function (_a) {
|
|
30
|
+
var theme = _a.theme;
|
|
31
|
+
return ({
|
|
32
|
+
background: theme.palette.common.white,
|
|
33
|
+
border: '1px solid',
|
|
34
|
+
borderColor: theme.palette.divider,
|
|
35
|
+
direction: theme.direction,
|
|
36
|
+
borderRadius: theme.spacing(0, 0, 1.25, 1.25),
|
|
37
|
+
marginBottom: theme.spacing(5.75)
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
var TitleStyled = styled(Text)(function (_a) {
|
|
41
|
+
var theme = _a.theme;
|
|
42
|
+
return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightLight, marginBlock: theme.spacing(1.75), marginInline: theme.spacing(2.5), lineHeight: 1.75, whiteSpace: 'pre-line' }));
|
|
43
|
+
});
|
|
44
|
+
var FormStyled = styled(Form)(function () { return ({
|
|
45
|
+
display: 'flex',
|
|
46
|
+
flexDirection: 'column'
|
|
47
|
+
}); });
|
|
48
|
+
export var OTPSignInStyled = styled(Text)(function (_a) {
|
|
49
|
+
var _b = _a.theme, spacing = _b.spacing, palette = _b.palette, typography = _b.typography;
|
|
50
|
+
return (__assign(__assign({}, typography.caption), { color: palette.primary.main, lineHeight: 1.75, textAlign: 'center', marginTop: spacing(11.625), cursor: 'pointer' }));
|
|
51
|
+
});
|
|
52
|
+
var Passcode = function () {
|
|
53
|
+
var spacing = useTheme().spacing;
|
|
54
|
+
var isAr = useLanguage().isAr;
|
|
55
|
+
var dispatch = useAppDispatch();
|
|
56
|
+
var st = useSanitizedTranslation();
|
|
57
|
+
var _a = useAppSelector(authSelector), _b = _a.data, passcodeData = _b.passcodeData, otpData = _b.otpData, emailData = _b.emailData, mobileData = _b.mobileData, loading = _a.loading, error = _a.error;
|
|
58
|
+
var methods = useForm({
|
|
59
|
+
resolver: yupResolver(validation),
|
|
60
|
+
defaultValues: passcodeData,
|
|
61
|
+
mode: 'onChange'
|
|
62
|
+
});
|
|
63
|
+
React.useEffect(function () {
|
|
64
|
+
if (error)
|
|
65
|
+
dispatch(clearError());
|
|
66
|
+
}, [methods.formState.isValid]);
|
|
67
|
+
var startWithEmail = otpData.authFor === AuthForType.EMAIL;
|
|
68
|
+
var onSubmit = function (formData) {
|
|
69
|
+
dispatch(verifyPasscode(deepCopy(formData)));
|
|
70
|
+
};
|
|
71
|
+
var onBack = function () {
|
|
72
|
+
dispatch(handlePrevScreenStep(startWithEmail ? 'AUTH_EMAIL_STEP' : 'AUTH_MOBILE_STEP'));
|
|
73
|
+
};
|
|
74
|
+
var onOTPLoginClick = function () {
|
|
75
|
+
if (startWithEmail)
|
|
76
|
+
dispatch(createEmailAuth({ email: emailData.email, skipPasscode: true }));
|
|
77
|
+
else
|
|
78
|
+
dispatch(createMobileAuth({ mobile: mobileData.mobile, countryCode: mobileData.countryCode, skipPasscode: true }));
|
|
79
|
+
};
|
|
80
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(TitleContainerStyled, { children: _jsx(TitleStyled, { children: loading ? st('ide_otp_waiting_title') : st('passcode_title') }) }), _jsx(PasscodeInput, { disableResend: true }), _jsx(OTPSignInStyled, __assign({ onClick: onOTPLoginClick }, { children: st('sign_in_with_otp') })), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: !methods.formState.isValid, isAr: isAr, loading: loading, error: st(error || ''), sx: { marginTop: spacing(2.5) } }, { children: st('next') }))] })) })) }));
|
|
81
|
+
};
|
|
82
|
+
export default React.memo(Passcode);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import Box from '@mui/material/Box/Box';
|
|
15
|
+
import { styled } from '@mui/material/styles';
|
|
16
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
17
|
+
import OTPField from '../../../shared/OTP';
|
|
18
|
+
import { DEFAULT_TIMER_VALUE } from '../../../../constants';
|
|
19
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
20
|
+
import { authSelector, clearError } from '../../../app/auth/authStore';
|
|
21
|
+
var BoxStyled = styled(Box)(function (_a) {
|
|
22
|
+
var theme = _a.theme;
|
|
23
|
+
return ({
|
|
24
|
+
display: 'flex',
|
|
25
|
+
flexDirection: 'column',
|
|
26
|
+
fontFamily: theme.typography.fontFamily
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
var PasscodeInput = function (_a) {
|
|
30
|
+
var disableResend = _a.disableResend;
|
|
31
|
+
var dispatch = useAppDispatch();
|
|
32
|
+
var control = useFormContext().control;
|
|
33
|
+
var error = useAppSelector(authSelector).error;
|
|
34
|
+
var _b = useController({ name: 'passcode', control: control }).field, value = _b.value, onChange = _b.onChange;
|
|
35
|
+
var handleOnPasscodeChange = function (passcode) {
|
|
36
|
+
if (error)
|
|
37
|
+
dispatch(clearError());
|
|
38
|
+
onChange(passcode);
|
|
39
|
+
};
|
|
40
|
+
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, __assign({}, (!disableResend && { timerInSeconds: DEFAULT_TIMER_VALUE }), { value: value, onChange: function (number) { return handleOnPasscodeChange(number.toString()); } })) })));
|
|
41
|
+
};
|
|
42
|
+
export default React.memo(PasscodeInput);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export declare const validation: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
passcode: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
4
|
+
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
5
|
+
passcode: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
6
|
+
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
7
|
+
passcode: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
8
|
+
}>>>;
|
|
@@ -57,6 +57,7 @@ import AuthAccountCreatedLoaderScreen from './auth/screens/AccountCreatedLoader'
|
|
|
57
57
|
import AuthEmailSentScreen from './auth/screens/EmailSent';
|
|
58
58
|
import AuthMigratingDataScreen from './auth/screens/MigratingData';
|
|
59
59
|
import AuthOperatorError from './auth/screens/OperatorError';
|
|
60
|
+
import AuthPasscodeScreen from './auth/screens/Passcode';
|
|
60
61
|
import CustomersPage from './business/screens/Customers';
|
|
61
62
|
import IDBODPage from './business/screens/IDBOD';
|
|
62
63
|
import BusinessVerifyPage from './business/screens/Verify';
|
|
@@ -325,6 +326,10 @@ export var authFeatureScreens = [
|
|
|
325
326
|
name: 'AUTH_OTP_STEP',
|
|
326
327
|
element: AuthOTPScreen
|
|
327
328
|
},
|
|
329
|
+
{
|
|
330
|
+
name: 'AUTH_PASSCODE_STEP',
|
|
331
|
+
element: AuthPasscodeScreen
|
|
332
|
+
},
|
|
328
333
|
{
|
|
329
334
|
name: 'AUTH_PASSWORD_STEP',
|
|
330
335
|
element: AuthPasswordScreen
|
|
@@ -53,8 +53,7 @@ var BackIconStyled = styled(Icon, { shouldForwardProp: function (prop) { return
|
|
|
53
53
|
var ButtonBoxStyled = styled(Box)(function (_a) {
|
|
54
54
|
var theme = _a.theme;
|
|
55
55
|
return ({
|
|
56
|
-
margin: theme.spacing(
|
|
57
|
-
marginBlockStart: theme.spacing(5),
|
|
56
|
+
margin: theme.spacing(5, 2.5, 2.5, 2.5),
|
|
58
57
|
maxHeight: theme.spacing(5.375),
|
|
59
58
|
display: 'flex',
|
|
60
59
|
alignItems: 'center',
|