@tap-payments/auth-jsconnect 2.12.10-development → 2.12.11-development
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/constants/app.d.ts +2 -0
- package/build/constants/app.js +14 -6
- package/build/features/app/connectExpress/connectExpressStore.d.ts +11 -1
- package/build/features/app/connectExpress/connectExpressStore.js +196 -18
- package/build/features/connectExpress/ConnectExpress.js +6 -3
- package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.js +4 -1
- package/build/features/connectExpress/screens/BusinessCountry/BusinessCountry.js +5 -1
- package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +2 -1
- package/build/features/connectExpress/screens/Email/Email.d.ts +5 -0
- package/build/features/connectExpress/screens/Email/Email.js +57 -0
- package/build/features/connectExpress/screens/Email/EmailField.d.ts +8 -0
- package/build/features/connectExpress/screens/Email/EmailField.js +52 -0
- package/build/features/connectExpress/screens/Email/index.d.ts +3 -0
- package/build/features/connectExpress/screens/Email/index.js +2 -0
- package/build/features/connectExpress/screens/Email/validation.d.ts +8 -0
- package/build/features/connectExpress/screens/Email/validation.js +4 -0
- package/build/features/connectExpress/screens/NIDMissed/NID.js +4 -1
- package/build/features/connectExpress/screens/OTP/OTP.js +13 -7
- package/build/features/connectExpress/screens/OTP/OTPInput.js +10 -3
- package/build/features/featuresScreens.js +5 -0
- package/build/hooks/useCountry.d.ts +1 -0
- package/build/hooks/useCountry.js +3 -2
- package/build/utils/string.d.ts +1 -0
- package/build/utils/string.js +5 -0
- package/package.json +1 -1
package/build/constants/app.d.ts
CHANGED
|
@@ -130,6 +130,8 @@ export declare const AUTH_STEP_NAMES: {
|
|
|
130
130
|
export declare const CONNECT_EXPRESS_STEP_NAMES: {
|
|
131
131
|
CREATE_AUTH_MOBILE: string;
|
|
132
132
|
VERIFY_AUTH_MOBILE: string;
|
|
133
|
+
CREATE_AUTH_EMAIL: string;
|
|
134
|
+
VERIFY_AUTH_EMAIL: string;
|
|
133
135
|
CREATE_AUTH_CIVIL_ID: string;
|
|
134
136
|
VERIFY_AUTH_CIVIL_ID: string;
|
|
135
137
|
CREATE_AUTH_NID: string;
|
package/build/constants/app.js
CHANGED
|
@@ -151,9 +151,15 @@ export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
|
|
|
151
151
|
prev: ['CONNECT_EXPRESS_NID_STEP', 'CONNECT_EXPRESS_CIVIL_ID_STEP'],
|
|
152
152
|
order: 1
|
|
153
153
|
},
|
|
154
|
+
{
|
|
155
|
+
name: 'CONNECT_EXPRESS_EMAIL_STEP',
|
|
156
|
+
next: 'CONNECT_EXPRESS_OTP_STEP',
|
|
157
|
+
prev: 'CONNECT_EXPRESS_BUSINESS_COUNTRY_STEP',
|
|
158
|
+
order: 1
|
|
159
|
+
},
|
|
154
160
|
{
|
|
155
161
|
name: 'CONNECT_EXPRESS_BUSINESS_COUNTRY_STEP',
|
|
156
|
-
next: ['CONNECT_EXPRESS_NID_STEP', 'CONNECT_EXPRESS_MOBILE_STEP'],
|
|
162
|
+
next: ['CONNECT_EXPRESS_NID_STEP', 'CONNECT_EXPRESS_MOBILE_STEP', 'CONNECT_EXPRESS_EMAIL_STEP'],
|
|
157
163
|
prev: '',
|
|
158
164
|
order: 1
|
|
159
165
|
},
|
|
@@ -196,20 +202,19 @@ export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
|
|
|
196
202
|
'CONNECT_EXPRESS_AUTHENTICATION_LIST_STEP',
|
|
197
203
|
'CONNECT_EXPRESS_OTP_VERIFY_SECURITY_ERROR_STEP'
|
|
198
204
|
],
|
|
199
|
-
prev: 'CONNECT_EXPRESS_MOBILE_STEP',
|
|
200
|
-
order: 2
|
|
201
|
-
back: 'CONNECT_EXPRESS_MOBILE_STEP'
|
|
205
|
+
prev: ['CONNECT_EXPRESS_MOBILE_STEP', 'CONNECT_EXPRESS_EMAIL_STEP'],
|
|
206
|
+
order: 2
|
|
202
207
|
},
|
|
203
208
|
{
|
|
204
209
|
name: 'CONNECT_EXPRESS_AUTHENTICATION_LIST_STEP',
|
|
205
210
|
next: ['CONNECT_EXPRESS_AUTH_MERCHANT_LIST_STEP', 'CONNECT_EXPRESS_AUTH_ACCOUNT_CREATED_STEP'],
|
|
206
|
-
prev: ['CONNECT_EXPRESS_MOBILE_STEP', 'CONNECT_EXPRESS_NID_STEP', 'CONNECT_EXPRESS_CIVIL_ID_STEP'],
|
|
211
|
+
prev: ['CONNECT_EXPRESS_MOBILE_STEP', 'CONNECT_EXPRESS_EMAIL_STEP', 'CONNECT_EXPRESS_NID_STEP', 'CONNECT_EXPRESS_CIVIL_ID_STEP'],
|
|
207
212
|
order: 3
|
|
208
213
|
},
|
|
209
214
|
{
|
|
210
215
|
name: 'CONNECT_EXPRESS_NID_MISSED_STEP',
|
|
211
216
|
next: ['CONNECT_EXPRESS_IDENTITY_VERIFY_NAFATH_STEP', 'CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP'],
|
|
212
|
-
prev: 'CONNECT_EXPRESS_MOBILE_STEP',
|
|
217
|
+
prev: ['CONNECT_EXPRESS_MOBILE_STEP', 'CONNECT_EXPRESS_EMAIL_STEP'],
|
|
213
218
|
order: 3
|
|
214
219
|
},
|
|
215
220
|
{
|
|
@@ -270,6 +275,7 @@ export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
|
|
|
270
275
|
],
|
|
271
276
|
prev: [
|
|
272
277
|
'CONNECT_EXPRESS_MOBILE_STEP',
|
|
278
|
+
'CONNECT_EXPRESS_EMAIL_STEP',
|
|
273
279
|
'CONNECT_EXPRESS_NID_STEP',
|
|
274
280
|
'CONNECT_EXPRESS_CIVIL_ID_STEP',
|
|
275
281
|
'CONNECT_EXPRESS_CIVIL_ID_MISSED_STEP',
|
|
@@ -1314,6 +1320,8 @@ export var AUTH_STEP_NAMES = {
|
|
|
1314
1320
|
export var CONNECT_EXPRESS_STEP_NAMES = {
|
|
1315
1321
|
CREATE_AUTH_MOBILE: 'connect_express_create_auth_mobile',
|
|
1316
1322
|
VERIFY_AUTH_MOBILE: 'connect_express_verify_auth_mobile',
|
|
1323
|
+
CREATE_AUTH_EMAIL: 'connect_express_create_auth_email',
|
|
1324
|
+
VERIFY_AUTH_EMAIL: 'connect_express_verify_auth_email',
|
|
1317
1325
|
CREATE_AUTH_CIVIL_ID: 'connect_express_create_auth_civil_id',
|
|
1318
1326
|
VERIFY_AUTH_CIVIL_ID: 'connect_express_verify_auth_civil_id',
|
|
1319
1327
|
CREATE_AUTH_NID: 'connect_express_create_auth_nid',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RootState } from '../../../app/store';
|
|
2
|
-
import { MobileFormValues, NIDFormValues, CivilFormValues, OTPFormValues, IndividualFormValues, SharedState, FlowsTypes, ActionState, CountryCode, AuthForType, BusinessDataFormValues, AsyncThunkParams, AuthenticationListFormValues, AuthMerchantFormValues, DOBFormValues, MobileOwnershipFormValues, AuthForScreen } from '../../../@types';
|
|
2
|
+
import { MobileFormValues, NIDFormValues, CivilFormValues, OTPFormValues, IndividualFormValues, SharedState, FlowsTypes, ActionState, CountryCode, AuthForType, BusinessDataFormValues, AsyncThunkParams, AuthenticationListFormValues, AuthMerchantFormValues, DOBFormValues, MobileOwnershipFormValues, AuthForScreen, AuthEmailFormValues } from '../../../@types';
|
|
3
3
|
import { CancelToken } from 'axios';
|
|
4
4
|
export declare const updateBusinessCountryAsync: import("@reduxjs/toolkit").AsyncThunk<any, string, {}>;
|
|
5
5
|
export declare const retrieveLeadIdentityByIdAsync: import("@reduxjs/toolkit").AsyncThunk<{
|
|
@@ -37,6 +37,14 @@ export declare const resendMobileAuthOTP: import("@reduxjs/toolkit").AsyncThunk<
|
|
|
37
37
|
response: any;
|
|
38
38
|
formData: MobileFormValues;
|
|
39
39
|
}, MobileFormValues, {}>;
|
|
40
|
+
export declare const createEmailAuthAsync: import("@reduxjs/toolkit").AsyncThunk<{
|
|
41
|
+
response: any;
|
|
42
|
+
formData: AuthEmailFormValues;
|
|
43
|
+
}, AuthEmailFormValues, {}>;
|
|
44
|
+
export declare const resendEmailAuthOTP: import("@reduxjs/toolkit").AsyncThunk<{
|
|
45
|
+
response: any;
|
|
46
|
+
formData: AuthEmailFormValues;
|
|
47
|
+
}, AuthEmailFormValues, {}>;
|
|
40
48
|
export declare const createAuthSessionExpiredAsync: import("@reduxjs/toolkit").AsyncThunk<{
|
|
41
49
|
data: any;
|
|
42
50
|
}, boolean, {}>;
|
|
@@ -65,6 +73,7 @@ export declare const createCivilIdAuthAsync: import("@reduxjs/toolkit").AsyncThu
|
|
|
65
73
|
formData: CivilFormValues;
|
|
66
74
|
}, CivilFormValues, {}>;
|
|
67
75
|
export declare const verifyMobileOtpAsync: import("@reduxjs/toolkit").AsyncThunk<any, OTPFormValues, {}>;
|
|
76
|
+
export declare const verifyEmailOtpAsync: import("@reduxjs/toolkit").AsyncThunk<any, OTPFormValues, {}>;
|
|
68
77
|
export declare const verifyPACIAsync: import("@reduxjs/toolkit").AsyncThunk<any, verifyPACIAsyncParams, {}>;
|
|
69
78
|
export declare const createCivilIDAuthIdentityAsync: import("@reduxjs/toolkit").AsyncThunk<{
|
|
70
79
|
response: any;
|
|
@@ -157,6 +166,7 @@ interface ResponseData {
|
|
|
157
166
|
export interface ConnectExpressData {
|
|
158
167
|
isLeadIdPassed: boolean;
|
|
159
168
|
mobileData: MobileFormValues;
|
|
169
|
+
emailData: AuthEmailFormValues;
|
|
160
170
|
nidData: NIDFormValues;
|
|
161
171
|
civilIdData: CivilFormValues;
|
|
162
172
|
otpData: OTPFormValues & {
|
|
@@ -61,7 +61,7 @@ import { FlowsTypes, AuthForType, BusinessType, LicenseType, AuthForScreen } fro
|
|
|
61
61
|
import API, { setAuthSessionToGlobalHeaders } from '../../../api';
|
|
62
62
|
import { ADD_NEW_ENTITY, COLLECT_DOB_INFO_NAFATH, CONNECT_EXPRESS_STEP_NAMES, IDENTIFICATION_TYPE, NAFATH_PACI_TIMEOUT_DURATION, NAFATH_VERIFICATION_FAILED, OTHER_CR_LICENSE, OTHER_FL_LICENSE, SCOPE_AUTH, SCOPE_MERCHANT } from '../../../constants';
|
|
63
63
|
import { defaultCountry } from '../../../constants';
|
|
64
|
-
import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA, isKW, isOtherThanKWOrSA, sendCustomEventToGTM, sendCustomDimension, getMetaData, isNetworkError, isTimeoutError, isInternalServerError, isAuthenticationVerificationFailed } from '../../../utils';
|
|
64
|
+
import { getIndividualName, capitalizeTheFirstLetterOfEachWord, sleep, findCountryByIddPrefix, concatenateObjectValues, isSA, isKW, isQA, isOtherThanKWOrSA, sendCustomEventToGTM, sendCustomDimension, getMetaData, isNetworkError, isTimeoutError, isInternalServerError, isAuthenticationVerificationFailed } from '../../../utils';
|
|
65
65
|
export var updateBusinessCountryAsync = createAsyncThunk('connectExpress/updateBusinessCountryAsync', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
66
|
var connectExpress, payload, data;
|
|
67
67
|
return __generator(this, function (_a) {
|
|
@@ -81,17 +81,17 @@ export var updateBusinessCountryAsync = createAsyncThunk('connectExpress/updateB
|
|
|
81
81
|
});
|
|
82
82
|
}); });
|
|
83
83
|
export var retrieveLeadIdentityByIdAsync = createAsyncThunk('expressConnect/retrieveLeadIdentityByIdAsync', function (leadId, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
84
|
-
var settings, countryCode, showBoard, data, _a, country_code, contact, phone, status, board_id, board_info_id, isRegistered, screen_1, _b, boardInfo, boardData, error_1;
|
|
85
|
-
var _c, _d, _e, _f, _g;
|
|
86
|
-
return __generator(this, function (
|
|
87
|
-
switch (
|
|
84
|
+
var settings, countryCode, showBoard, data, _a, country_code, contact, phone, status, board_id, board_info_id, isRegistered, screen_1, screen_2, _b, boardInfo, boardData, error_1;
|
|
85
|
+
var _c, _d, _e, _f, _g, _h;
|
|
86
|
+
return __generator(this, function (_j) {
|
|
87
|
+
switch (_j.label) {
|
|
88
88
|
case 0:
|
|
89
89
|
settings = thunkApi.getState().settings;
|
|
90
90
|
countryCode = settings.data.businessCountry;
|
|
91
91
|
showBoard = settings.data.appConfig.showBoard;
|
|
92
92
|
return [4, API.leadService.retrieveLeadIdentity(leadId)];
|
|
93
93
|
case 1:
|
|
94
|
-
data =
|
|
94
|
+
data = _j.sent();
|
|
95
95
|
_a = data || {}, country_code = _a.country_code, contact = _a.contact;
|
|
96
96
|
if (country_code)
|
|
97
97
|
thunkApi.dispatch(handleSetCountryByIso2(country_code));
|
|
@@ -105,14 +105,19 @@ export var retrieveLeadIdentityByIdAsync = createAsyncThunk('expressConnect/retr
|
|
|
105
105
|
}
|
|
106
106
|
isRegistered = (status === null || status === void 0 ? void 0 : status.toLowerCase()) === 'registered';
|
|
107
107
|
if (!isRegistered && !(data === null || data === void 0 ? void 0 : data.identification) && phone) {
|
|
108
|
-
|
|
108
|
+
screen_1 = isQA(country_code || ((_d = settings.data.businessCountry) === null || _d === void 0 ? void 0 : _d.iso2)) ? 'CONNECT_EXPRESS_EMAIL_STEP' : 'CONNECT_EXPRESS_MOBILE_STEP';
|
|
109
|
+
thunkApi.dispatch(handleCurrentActiveScreen(screen_1));
|
|
109
110
|
return [2, { data: data, countryCode: countryCode }];
|
|
110
111
|
}
|
|
111
112
|
if (!isRegistered && country_code) {
|
|
112
|
-
|
|
113
|
+
screen_2 = 'CONNECT_EXPRESS_NID_STEP';
|
|
113
114
|
if (!isSA(data.country_code))
|
|
114
|
-
|
|
115
|
-
thunkApi.dispatch(handleCurrentActiveScreen(
|
|
115
|
+
screen_2 = isQA(data.country_code) ? 'CONNECT_EXPRESS_EMAIL_STEP' : 'CONNECT_EXPRESS_MOBILE_STEP';
|
|
116
|
+
thunkApi.dispatch(handleCurrentActiveScreen(screen_2));
|
|
117
|
+
return [2, { data: data, countryCode: countryCode }];
|
|
118
|
+
}
|
|
119
|
+
if (!isRegistered && isQA(settings.data.businessCountry.iso2)) {
|
|
120
|
+
thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_EMAIL_STEP'));
|
|
116
121
|
return [2, { data: data, countryCode: countryCode }];
|
|
117
122
|
}
|
|
118
123
|
if (!isRegistered && !isSA(settings.data.businessCountry.iso2)) {
|
|
@@ -123,11 +128,11 @@ export var retrieveLeadIdentityByIdAsync = createAsyncThunk('expressConnect/retr
|
|
|
123
128
|
thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_NID_STEP'));
|
|
124
129
|
return [2, { data: data, countryCode: countryCode }];
|
|
125
130
|
}
|
|
126
|
-
if ((
|
|
127
|
-
thunkApi.dispatch(storeAuthId((
|
|
131
|
+
if ((_e = data === null || data === void 0 ? void 0 : data.identification) === null || _e === void 0 ? void 0 : _e.authentication_id) {
|
|
132
|
+
thunkApi.dispatch(storeAuthId((_f = data === null || data === void 0 ? void 0 : data.identification) === null || _f === void 0 ? void 0 : _f.authentication_id));
|
|
128
133
|
}
|
|
129
134
|
if (isRegistered && !showBoard) {
|
|
130
|
-
(
|
|
135
|
+
(_h = (_g = settings.data.appConfig).onFlowCompleted) === null || _h === void 0 ? void 0 : _h.call(_g, data);
|
|
131
136
|
thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_ACCOUNT_ALREADY_CREATED_STEP'));
|
|
132
137
|
return [2, { data: data, countryCode: countryCode }];
|
|
133
138
|
}
|
|
@@ -136,19 +141,19 @@ export var retrieveLeadIdentityByIdAsync = createAsyncThunk('expressConnect/retr
|
|
|
136
141
|
return [2, { data: data, countryCode: countryCode }];
|
|
137
142
|
}
|
|
138
143
|
if (!(isRegistered && board_id && board_info_id)) return [3, 5];
|
|
139
|
-
|
|
144
|
+
_j.label = 2;
|
|
140
145
|
case 2:
|
|
141
|
-
|
|
146
|
+
_j.trys.push([2, 4, , 5]);
|
|
142
147
|
return [4, Promise.all([
|
|
143
148
|
API.boardService.retrieveBoardInfo({ id: board_id, infoId: board_info_id }),
|
|
144
149
|
API.boardService.retrieveBoardDetails(board_id)
|
|
145
150
|
])];
|
|
146
151
|
case 3:
|
|
147
|
-
_b =
|
|
152
|
+
_b = _j.sent(), boardInfo = _b[0], boardData = _b[1];
|
|
148
153
|
thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_SUCCESS_WITH_FLOW_BUTTONS_STEP'));
|
|
149
154
|
return [2, { data: data, countryCode: countryCode, boardInfo: boardInfo, boardData: boardData }];
|
|
150
155
|
case 4:
|
|
151
|
-
error_1 =
|
|
156
|
+
error_1 = _j.sent();
|
|
152
157
|
thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_ACCOUNT_ALREADY_CREATED_STEP'));
|
|
153
158
|
return [2, { data: data, countryCode: countryCode }];
|
|
154
159
|
case 5: return [2, { data: data, countryCode: countryCode }];
|
|
@@ -309,6 +314,61 @@ export var resendMobileAuthOTP = createAsyncThunk('connectExpress/resendMobileAu
|
|
|
309
314
|
}
|
|
310
315
|
});
|
|
311
316
|
}); });
|
|
317
|
+
export var createEmailAuthAsync = createAsyncThunk('connectExpress/createEmailAuthAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
318
|
+
var _a, settings, connectExpress, requestBody, data;
|
|
319
|
+
var _b, _c;
|
|
320
|
+
return __generator(this, function (_d) {
|
|
321
|
+
switch (_d.label) {
|
|
322
|
+
case 0:
|
|
323
|
+
_a = thunkApi.getState(), settings = _a.settings, connectExpress = _a.connectExpress;
|
|
324
|
+
requestBody = {
|
|
325
|
+
country: settings.data.businessCountry.iso2,
|
|
326
|
+
scope: settings.data.appConfig.scope,
|
|
327
|
+
lang: settings.data.language,
|
|
328
|
+
lead_id: connectExpress.data.leadId,
|
|
329
|
+
user_credentail: {
|
|
330
|
+
email: params.email || ''
|
|
331
|
+
},
|
|
332
|
+
sign_in: false,
|
|
333
|
+
is_lead: true,
|
|
334
|
+
step_name: CONNECT_EXPRESS_STEP_NAMES.CREATE_AUTH_EMAIL,
|
|
335
|
+
encryption_contract: ['user_credentail.email']
|
|
336
|
+
};
|
|
337
|
+
return [4, API.authService.createExpressAuth(requestBody)];
|
|
338
|
+
case 1:
|
|
339
|
+
data = _d.sent();
|
|
340
|
+
thunkApi.dispatch(handleNextScreenStep());
|
|
341
|
+
(_c = (_b = settings.data.appConfig).onStepCompleted) === null || _c === void 0 ? void 0 : _c.call(_b, settings.data.activeScreen.name, requestBody.user_credentail);
|
|
342
|
+
return [2, { response: data, formData: params }];
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
}); });
|
|
346
|
+
export var resendEmailAuthOTP = createAsyncThunk('connectExpress/resendEmailAuthOTPExpress', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
347
|
+
var _a, settings, connectExpress, requestBody, data;
|
|
348
|
+
return __generator(this, function (_b) {
|
|
349
|
+
switch (_b.label) {
|
|
350
|
+
case 0:
|
|
351
|
+
_a = thunkApi.getState(), settings = _a.settings, connectExpress = _a.connectExpress;
|
|
352
|
+
requestBody = {
|
|
353
|
+
country: settings.data.businessCountry.iso2,
|
|
354
|
+
scope: settings.data.appConfig.scope,
|
|
355
|
+
lang: settings.data.language,
|
|
356
|
+
lead_id: connectExpress.data.leadId,
|
|
357
|
+
user_credentail: {
|
|
358
|
+
email: params.email || ''
|
|
359
|
+
},
|
|
360
|
+
sign_in: false,
|
|
361
|
+
is_lead: true,
|
|
362
|
+
step_name: CONNECT_EXPRESS_STEP_NAMES.CREATE_AUTH_EMAIL,
|
|
363
|
+
encryption_contract: ['user_credentail.email']
|
|
364
|
+
};
|
|
365
|
+
return [4, API.authService.createExpressAuth(requestBody)];
|
|
366
|
+
case 1:
|
|
367
|
+
data = _b.sent();
|
|
368
|
+
return [2, { response: data, formData: params }];
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
}); });
|
|
312
372
|
export var createAuthSessionExpiredAsync = createAsyncThunk('connectExpress/createAuthSessionExpiredAsync', function (redirect, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
313
373
|
var settings, requestBody, data;
|
|
314
374
|
return __generator(this, function (_a) {
|
|
@@ -614,6 +674,78 @@ export var verifyMobileOtpAsync = createAsyncThunk('connectExpress/verifyMobileO
|
|
|
614
674
|
}
|
|
615
675
|
});
|
|
616
676
|
}); });
|
|
677
|
+
export var verifyEmailOtpAsync = createAsyncThunk('connectExpress/verifyEmailOtpAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
678
|
+
var _a, settings, connectExpress, _b, responseData, leadId, _c, auth_token, device_token, service_name, auth_type, _d, scope, redirectUrl, authData, isScopeAuthentication, bi, isDataHasIndividualOnly, authDataHasValue, payload, data, authId, urlQueryStart, _e, brandList, entityList;
|
|
679
|
+
var _f, _g;
|
|
680
|
+
return __generator(this, function (_h) {
|
|
681
|
+
switch (_h.label) {
|
|
682
|
+
case 0:
|
|
683
|
+
_a = thunkApi.getState(), settings = _a.settings, connectExpress = _a.connectExpress;
|
|
684
|
+
_b = connectExpress.data || {}, responseData = _b.responseData, leadId = _b.leadId;
|
|
685
|
+
if (!(responseData === null || responseData === void 0 ? void 0 : responseData.authData))
|
|
686
|
+
throw new Error('Auth data is missing');
|
|
687
|
+
_c = responseData.authData, auth_token = _c.auth_token, device_token = _c.device_token, service_name = _c.service_name, auth_type = _c.auth_type;
|
|
688
|
+
_d = settings.data.appConfig, scope = _d.scope, redirectUrl = _d.redirectUrl, authData = _d.data;
|
|
689
|
+
isScopeAuthentication = scope === SCOPE_AUTH;
|
|
690
|
+
bi = settings.data.deviceInfo.browser.browser_id;
|
|
691
|
+
isDataHasIndividualOnly = (authData === null || authData === void 0 ? void 0 : authData.length) === 1 && authData.includes('individual');
|
|
692
|
+
authDataHasValue = authData === null || authData === void 0 ? void 0 : authData.length;
|
|
693
|
+
payload = {
|
|
694
|
+
auth_token: auth_token,
|
|
695
|
+
lead_id: leadId,
|
|
696
|
+
data: params.otp,
|
|
697
|
+
auth_type: auth_type,
|
|
698
|
+
device_token: device_token,
|
|
699
|
+
service_name: service_name,
|
|
700
|
+
sign_in: false,
|
|
701
|
+
step_name: CONNECT_EXPRESS_STEP_NAMES.VERIFY_AUTH_EMAIL,
|
|
702
|
+
encryption_contract: ['data']
|
|
703
|
+
};
|
|
704
|
+
return [4, API.authService.verifyExpressAuth(payload).catch(function (err) {
|
|
705
|
+
if (isAuthenticationVerificationFailed(err === null || err === void 0 ? void 0 : err.message))
|
|
706
|
+
thunkApi.dispatch(handleNextScreenStep('CONNECT_EXPRESS_OTP_VERIFY_SECURITY_ERROR_STEP'));
|
|
707
|
+
throw new Error(err === null || err === void 0 ? void 0 : err.message);
|
|
708
|
+
})];
|
|
709
|
+
case 1:
|
|
710
|
+
data = _h.sent();
|
|
711
|
+
setAuthSessionToGlobalHeaders(data === null || data === void 0 ? void 0 : data.auth_session);
|
|
712
|
+
sendCustomEventToGTM({
|
|
713
|
+
event: 'Send Event',
|
|
714
|
+
event_category: 'User Registration Flow',
|
|
715
|
+
event_action: 'First OTP Success'
|
|
716
|
+
});
|
|
717
|
+
(_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, params);
|
|
718
|
+
authId = data.auth.id;
|
|
719
|
+
thunkApi.dispatch(storeAuthId(authId));
|
|
720
|
+
if (isScopeAuthentication && !data.new_user && isDataHasIndividualOnly && authId) {
|
|
721
|
+
if (settings.data.appConfig.mode === 'popup') {
|
|
722
|
+
settings.data.appConfig.onFlowCompleted({ auth_id: authId, bi: bi });
|
|
723
|
+
thunkApi.dispatch(handleOpen(false));
|
|
724
|
+
return [2, data];
|
|
725
|
+
}
|
|
726
|
+
if (redirectUrl) {
|
|
727
|
+
urlQueryStart = redirectUrl.includes('?') ? '&' : '?';
|
|
728
|
+
window.open("".concat(redirectUrl).concat(urlQueryStart, "authentication_id=").concat(authId, "&bi=").concat(bi), '_self');
|
|
729
|
+
return [2, data];
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
if (!(isScopeAuthentication && !data.new_user && authDataHasValue)) return [3, 3];
|
|
733
|
+
return [4, thunkApi.dispatch(retrieveAuthenticationListAsync({ individualId: data.individual_id })).unwrap()];
|
|
734
|
+
case 2:
|
|
735
|
+
_e = _h.sent(), brandList = _e.brandList, entityList = _e.entityList;
|
|
736
|
+
if (brandList.length && entityList.length) {
|
|
737
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('CONNECT_EXPRESS_AUTHENTICATION_LIST_STEP')); });
|
|
738
|
+
return [2, data];
|
|
739
|
+
}
|
|
740
|
+
_h.label = 3;
|
|
741
|
+
case 3: return [4, thunkApi.dispatch(getLeadByIdAsync(data.lead_id)).unwrap()];
|
|
742
|
+
case 4:
|
|
743
|
+
_h.sent();
|
|
744
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('CONNECT_EXPRESS_NID_MISSED_STEP')); });
|
|
745
|
+
return [2, data];
|
|
746
|
+
}
|
|
747
|
+
});
|
|
748
|
+
}); });
|
|
617
749
|
export var verifyPACIAsync = createAsyncThunk('connectExpress/verifyPACIAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
618
750
|
var _a, settings, connectExpress, authData, _b, scope, redirectUrl, authConfigData, isScopeAuthentication, bi, isDataHasIndividualOnly, authDataHasValue, expiry, interval, maxCalls, count, data, error_3, isSuccess, authId, urlQueryStart, _c, brandList, entityList, stepName, needToCollectMoreInfo, creatingAccount;
|
|
619
751
|
var _d, _e, _f;
|
|
@@ -1543,6 +1675,9 @@ var initialState = {
|
|
|
1543
1675
|
mobile: '',
|
|
1544
1676
|
termAndConditionChecked: false
|
|
1545
1677
|
},
|
|
1678
|
+
emailData: {
|
|
1679
|
+
email: ''
|
|
1680
|
+
},
|
|
1546
1681
|
nidData: {
|
|
1547
1682
|
nid: '',
|
|
1548
1683
|
termAndConditionChecked: false
|
|
@@ -1647,11 +1782,14 @@ export var connectSlice = createSlice({
|
|
|
1647
1782
|
var _b = data || {}, identification = _b.identification, contact = _b.contact, terms_conditions_accepted = _b.terms_conditions_accepted;
|
|
1648
1783
|
if (identification === null || identification === void 0 ? void 0 : identification.id)
|
|
1649
1784
|
state.data.nidData.nid = identification === null || identification === void 0 ? void 0 : identification.id;
|
|
1650
|
-
var
|
|
1785
|
+
var _c = contact || {}, phone = _c.phone, email = _c.email;
|
|
1651
1786
|
if (phone) {
|
|
1652
1787
|
state.data.mobileData.mobile = phone === null || phone === void 0 ? void 0 : phone.number;
|
|
1653
1788
|
state.data.mobileData.countryCode = countryCode;
|
|
1654
1789
|
}
|
|
1790
|
+
if (email) {
|
|
1791
|
+
state.data.emailData.email = email;
|
|
1792
|
+
}
|
|
1655
1793
|
if (terms_conditions_accepted !== undefined && state.data.isLeadIdPassed) {
|
|
1656
1794
|
state.data.mobileData.termAndConditionChecked = terms_conditions_accepted;
|
|
1657
1795
|
state.data.nidData.termAndConditionChecked = terms_conditions_accepted;
|
|
@@ -1718,6 +1856,31 @@ export var connectSlice = createSlice({
|
|
|
1718
1856
|
})
|
|
1719
1857
|
.addCase(resendMobileAuthOTP.rejected, function (state, action) {
|
|
1720
1858
|
state.error = action.error.message;
|
|
1859
|
+
})
|
|
1860
|
+
.addCase(createEmailAuthAsync.pending, function (state) {
|
|
1861
|
+
state.loading = true;
|
|
1862
|
+
state.error = null;
|
|
1863
|
+
})
|
|
1864
|
+
.addCase(createEmailAuthAsync.fulfilled, function (state, action) {
|
|
1865
|
+
state.loading = false;
|
|
1866
|
+
state.data.emailData = action.payload.formData;
|
|
1867
|
+
state.data.otpData.authFor = AuthForType.EMAIL;
|
|
1868
|
+
state.data.responseData = __assign(__assign({}, state.data.responseData), { authData: action.payload.response });
|
|
1869
|
+
})
|
|
1870
|
+
.addCase(createEmailAuthAsync.rejected, function (state, action) {
|
|
1871
|
+
state.loading = false;
|
|
1872
|
+
state.error = action.error.message;
|
|
1873
|
+
})
|
|
1874
|
+
.addCase(resendEmailAuthOTP.pending, function (state) {
|
|
1875
|
+
state.error = null;
|
|
1876
|
+
})
|
|
1877
|
+
.addCase(resendEmailAuthOTP.fulfilled, function (state, action) {
|
|
1878
|
+
state.data.emailData = action.payload.formData;
|
|
1879
|
+
state.data.otpData.authFor = AuthForType.EMAIL;
|
|
1880
|
+
state.data.responseData = __assign(__assign({}, state.data.responseData), { authData: action.payload.response });
|
|
1881
|
+
})
|
|
1882
|
+
.addCase(resendEmailAuthOTP.rejected, function (state, action) {
|
|
1883
|
+
state.error = action.error.message;
|
|
1721
1884
|
})
|
|
1722
1885
|
.addCase(createAuthSessionExpiredAsync.pending, function (state) {
|
|
1723
1886
|
state.loading = true;
|
|
@@ -1822,6 +1985,21 @@ export var connectSlice = createSlice({
|
|
|
1822
1985
|
state.loading = false;
|
|
1823
1986
|
if (!isAuthenticationVerificationFailed(message))
|
|
1824
1987
|
state.error = message;
|
|
1988
|
+
})
|
|
1989
|
+
.addCase(verifyEmailOtpAsync.pending, function (state) {
|
|
1990
|
+
state.loading = true;
|
|
1991
|
+
state.error = null;
|
|
1992
|
+
})
|
|
1993
|
+
.addCase(verifyEmailOtpAsync.fulfilled, function (state, action) {
|
|
1994
|
+
var _a;
|
|
1995
|
+
state.loading = false;
|
|
1996
|
+
state.data.responseData = __assign(__assign({}, state.data.responseData), { authData: __assign(__assign({}, (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.authData), action.payload) });
|
|
1997
|
+
})
|
|
1998
|
+
.addCase(verifyEmailOtpAsync.rejected, function (state, _a) {
|
|
1999
|
+
var message = _a.error.message;
|
|
2000
|
+
state.loading = false;
|
|
2001
|
+
if (!isAuthenticationVerificationFailed(message))
|
|
2002
|
+
state.error = message;
|
|
1825
2003
|
})
|
|
1826
2004
|
.addCase(verifyNafathAsync.pending, function (state) {
|
|
1827
2005
|
state.loading = true;
|
|
@@ -67,7 +67,7 @@ import { store } from '../../app/store';
|
|
|
67
67
|
import { connectExpressSelector, setIsLeadIdPassed, setLeadId, retrieveLeadIdentityByIdAsync, setDefaultCountryCode, clearError, createAuthSessionExpiredAsync } from '../app/connectExpress/connectExpressStore';
|
|
68
68
|
import { ReduxProvider, ThemeProvider } from '../../components/Providers';
|
|
69
69
|
import Collapse from '../../components/Collapse';
|
|
70
|
-
import { isKW, findOrCreateElementAndInject, sendPageView, isOtherThanKWOrSA, initializeGTM, sendCustomEventToGTM, sendCustomDimension } from '../../utils';
|
|
70
|
+
import { isKW, isQA, findOrCreateElementAndInject, sendPageView, isOtherThanKWOrSA, initializeGTM, sendCustomEventToGTM, sendCustomDimension } from '../../utils';
|
|
71
71
|
import { CONNECT_EXPRESS_SCREENS_NAVIGATION } from '../../constants';
|
|
72
72
|
import { connectExpressFeatureScreens } from '../featuresScreens';
|
|
73
73
|
import Background from '../shared/Background';
|
|
@@ -123,7 +123,7 @@ var ConnectExpress = memo(function (_a) {
|
|
|
123
123
|
}
|
|
124
124
|
}, [data.businessCountry]);
|
|
125
125
|
React.useEffect(function () {
|
|
126
|
-
var _a, _b;
|
|
126
|
+
var _a, _b, _c;
|
|
127
127
|
if (settingLoading || !props.open)
|
|
128
128
|
return;
|
|
129
129
|
if (!data.isValidOperator) {
|
|
@@ -146,7 +146,10 @@ var ConnectExpress = memo(function (_a) {
|
|
|
146
146
|
dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_BUSINESS_COUNTRY_STEP'));
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
149
|
-
if (((_b = data.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2) && (
|
|
149
|
+
if (((_b = data.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2) && isQA(data.businessCountry.iso2)) {
|
|
150
|
+
dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_EMAIL_STEP'));
|
|
151
|
+
}
|
|
152
|
+
else if (((_c = data.businessCountry) === null || _c === void 0 ? void 0 : _c.iso2) && (isKW(data.businessCountry.iso2) || isOtherThanKWOrSA(data.businessCountry.iso2))) {
|
|
150
153
|
dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_MOBILE_STEP'));
|
|
151
154
|
}
|
|
152
155
|
}, [data.isValidOperator, settingLoading]);
|
|
@@ -45,6 +45,7 @@ var AuthenticationList = function (_a) {
|
|
|
45
45
|
var _g = React.useState(false), isAddEntity = _g[0], setIsAddEntity = _g[1];
|
|
46
46
|
var otpData = data.otpData;
|
|
47
47
|
var startWithNID = otpData.authFor === AuthForType.NATIONAL_ID;
|
|
48
|
+
var startWithEmail = otpData.authFor === AuthForType.EMAIL;
|
|
48
49
|
React.useEffect(function () {
|
|
49
50
|
sendCustomEventToGTM({
|
|
50
51
|
event: 'Send Event',
|
|
@@ -83,7 +84,9 @@ var AuthenticationList = function (_a) {
|
|
|
83
84
|
methods.setValue('entityInfo', undefined, { shouldValidate: true });
|
|
84
85
|
return;
|
|
85
86
|
}
|
|
86
|
-
var screen =
|
|
87
|
+
var screen = startWithEmail ? 'CONNECT_EXPRESS_EMAIL_STEP' : 'CONNECT_EXPRESS_MOBILE_STEP';
|
|
88
|
+
if (startWithNID)
|
|
89
|
+
screen = isKW(code) ? 'CONNECT_EXPRESS_CIVIL_ID_STEP' : 'CONNECT_EXPRESS_NID_STEP';
|
|
87
90
|
dispatch(resetAuthenticationScreen());
|
|
88
91
|
dispatch(handlePrevScreenStep(screen));
|
|
89
92
|
};
|
|
@@ -53,7 +53,7 @@ import { ScreenContainer } from '../../../shared/Containers';
|
|
|
53
53
|
import BusinessCountry from '../../../shared/BusinessCountry';
|
|
54
54
|
import Button from '../../../shared/Button';
|
|
55
55
|
import Collapse from '../../../../components/Collapse';
|
|
56
|
-
import { findCountryByIso2, isKW, isOtherThanKWOrSA, sendCustomEventToGTM } from '../../../../utils';
|
|
56
|
+
import { findCountryByIso2, isKW, isQA, isOtherThanKWOrSA, sendCustomEventToGTM } from '../../../../utils';
|
|
57
57
|
import { handleNextScreenStep, handleSetCountryByIso2, settingsSelector } from '../../../../app/settings';
|
|
58
58
|
import { clearError, connectExpressSelector, setDefaultCountryCode, storeIsStartFromBusinessCountry, updateBusinessCountryAsync } from '../../../app/connectExpress/connectExpressStore';
|
|
59
59
|
var BusinessCountryScreen = function (_a) {
|
|
@@ -95,6 +95,10 @@ var BusinessCountryScreen = function (_a) {
|
|
|
95
95
|
case 2:
|
|
96
96
|
if (countryCode)
|
|
97
97
|
dispatch(setDefaultCountryCode(countryCode));
|
|
98
|
+
if (isQA(iso2)) {
|
|
99
|
+
dispatch(handleNextScreenStep('CONNECT_EXPRESS_EMAIL_STEP'));
|
|
100
|
+
return [2];
|
|
101
|
+
}
|
|
98
102
|
if (isOtherThanKWOrSA(iso2) || isKW(iso2)) {
|
|
99
103
|
dispatch(handleNextScreenStep('CONNECT_EXPRESS_MOBILE_STEP'));
|
|
100
104
|
return [2];
|
package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js
CHANGED
|
@@ -45,6 +45,7 @@ var CollectIndividualInfo = function (_a) {
|
|
|
45
45
|
var t = useTranslation().t;
|
|
46
46
|
var isAr = useLanguage().isAr;
|
|
47
47
|
var individualData = data.individualData, otpData = data.otpData, responseData = data.responseData;
|
|
48
|
+
var startWithEmail = otpData.authFor === AuthForType.EMAIL;
|
|
48
49
|
var startWithNID = otpData.authFor === AuthForType.NATIONAL_ID;
|
|
49
50
|
var startWithNIDMissed = otpData.authFor === AuthForType.NATIONAL_ID_MISSED;
|
|
50
51
|
var contact = ((responseData === null || responseData === void 0 ? void 0 : responseData.leadData) || {}).contact;
|
|
@@ -82,7 +83,7 @@ var CollectIndividualInfo = function (_a) {
|
|
|
82
83
|
dispatch(resetIndividualScreen());
|
|
83
84
|
}
|
|
84
85
|
var code = (_a = settingsData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2;
|
|
85
|
-
var screen = 'CONNECT_EXPRESS_MOBILE_STEP';
|
|
86
|
+
var screen = startWithEmail ? 'CONNECT_EXPRESS_EMAIL_STEP' : 'CONNECT_EXPRESS_MOBILE_STEP';
|
|
86
87
|
if (startWithNID) {
|
|
87
88
|
if (isKW(code))
|
|
88
89
|
screen = 'CONNECT_EXPRESS_CIVIL_ID_STEP';
|
|
@@ -0,0 +1,57 @@
|
|
|
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 { useTranslation } from 'react-i18next';
|
|
15
|
+
import { useForm, FormProvider } from 'react-hook-form';
|
|
16
|
+
import { styled } from '@mui/material/styles';
|
|
17
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
|
+
import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
|
|
19
|
+
import { handleCurrentActiveScreen } from '../../../../app/settings';
|
|
20
|
+
import { clearError, connectExpressSelector, createEmailAuthAsync, resetStore } from '../../../app/connectExpress/connectExpressStore';
|
|
21
|
+
import Form from '../../../../components/Form';
|
|
22
|
+
import Button from '../../../shared/Button';
|
|
23
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
24
|
+
import { deepCopy } from '../../../../utils';
|
|
25
|
+
import { EmailInfoValidation } from './validation';
|
|
26
|
+
import EmailField from './EmailField';
|
|
27
|
+
var FormStyled = styled(Form)(function () { return ({
|
|
28
|
+
display: 'flex',
|
|
29
|
+
flexDirection: 'column'
|
|
30
|
+
}); });
|
|
31
|
+
var Email = function (_a) {
|
|
32
|
+
var isAr = useLanguage().isAr;
|
|
33
|
+
var dispatch = useAppDispatch();
|
|
34
|
+
var t = useTranslation().t;
|
|
35
|
+
var _b = useAppSelector(connectExpressSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
36
|
+
var methods = useForm({
|
|
37
|
+
resolver: yupResolver(EmailInfoValidation),
|
|
38
|
+
defaultValues: data.emailData,
|
|
39
|
+
mode: 'onChange'
|
|
40
|
+
});
|
|
41
|
+
React.useEffect(function () {
|
|
42
|
+
if (error)
|
|
43
|
+
dispatch(clearError());
|
|
44
|
+
}, [methods.formState.isValid]);
|
|
45
|
+
React.useEffect(function () {
|
|
46
|
+
dispatch(resetStore());
|
|
47
|
+
}, []);
|
|
48
|
+
var onSubmit = function (formData) {
|
|
49
|
+
dispatch(createEmailAuthAsync(deepCopy(formData)));
|
|
50
|
+
};
|
|
51
|
+
var onBackToCountryList = function () {
|
|
52
|
+
dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_BUSINESS_COUNTRY_STEP'));
|
|
53
|
+
};
|
|
54
|
+
var disabled = !methods.formState.isValid;
|
|
55
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(EmailField, { sx: { mb: 5, transition: 'mb 0.3s' } }), _jsx(Button, __assign({ loading: loading, isAr: isAr, onBackClicked: onBackToCountryList, disableBack: !data.isStartFromBusinessCountry, disabled: disabled, error: t(error || '') }, { children: t('next') }))] })) })) }));
|
|
56
|
+
};
|
|
57
|
+
export default React.memo(Email);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
+
interface EmailFieldProps {
|
|
4
|
+
sx: SxProps<Theme> | undefined;
|
|
5
|
+
readOnly?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<EmailFieldProps & React.RefAttributes<unknown>>>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,52 @@
|
|
|
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 { useTranslation } from 'react-i18next';
|
|
15
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
16
|
+
import Box from '@mui/material/Box';
|
|
17
|
+
import { styled, alpha } from '@mui/material/styles';
|
|
18
|
+
import Text from '../../../../components/Text';
|
|
19
|
+
import { MAX_EMAIL_LENGTH } from '../../../../constants';
|
|
20
|
+
import Input from '../../../shared/Input';
|
|
21
|
+
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
22
|
+
import { EndAdornment } from '../../../shared/EndAdornment';
|
|
23
|
+
var LabelContainerStyled = styled(Box)(function (_a) {
|
|
24
|
+
var theme = _a.theme;
|
|
25
|
+
return ({
|
|
26
|
+
display: 'flex',
|
|
27
|
+
justifyContent: 'space-between',
|
|
28
|
+
padding: theme.spacing(0, 2.5, 1.25, 2.5)
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
var InputLabelStyled = styled(Text)(function (_a) {
|
|
32
|
+
var theme = _a.theme;
|
|
33
|
+
return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.6), fontWeight: theme.typography.fontWeightMedium }, theme.typography.caption), { lineHeight: theme.spacing(2.5) }));
|
|
34
|
+
});
|
|
35
|
+
var EmailField = React.forwardRef(function (_a, ref) {
|
|
36
|
+
var _b;
|
|
37
|
+
var sx = _a.sx, readOnly = _a.readOnly;
|
|
38
|
+
var t = useTranslation().t;
|
|
39
|
+
var control = useFormContext().control;
|
|
40
|
+
var emailControl = useController({ control: control, name: 'email' });
|
|
41
|
+
var handleEmailChange = function (_a) {
|
|
42
|
+
var target = _a.target;
|
|
43
|
+
emailControl.field.onChange(target.value);
|
|
44
|
+
};
|
|
45
|
+
var clearEmail = function () {
|
|
46
|
+
emailControl.field.onChange('');
|
|
47
|
+
};
|
|
48
|
+
var emailValue = emailControl.field.value;
|
|
49
|
+
var error = (_b = emailControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
50
|
+
return (_jsxs(ScreenContainer, __assign({ ref: ref, sx: sx }, { children: [_jsx(LabelContainerStyled, { children: _jsx(InputLabelStyled, { children: t('signup_email_lable') }) }), _jsx(Input, { type: 'email', readOnly: readOnly, inputProps: { maxLength: MAX_EMAIL_LENGTH }, onChange: handleEmailChange, value: emailValue, endAdornment: _jsx(EndAdornment, { value: emailValue, error: error, onClear: clearEmail }), placeholder: t('signup_email_placeholder'), warningType: 'alert', warningMessage: error && t(error), required: true })] })));
|
|
51
|
+
});
|
|
52
|
+
export default React.memo(EmailField);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export declare const EmailInfoValidation: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
email: 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
|
+
email: 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
|
+
email: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
8
|
+
}>>>;
|
|
@@ -22,6 +22,7 @@ import { clearError, connectExpressSelector, createNIDNafathAuthIdentityAsync }
|
|
|
22
22
|
import Form from '../../../../components/Form';
|
|
23
23
|
import Button from '../../../shared/Button';
|
|
24
24
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
25
|
+
import { AuthForType } from '../../../../@types';
|
|
25
26
|
import Collapse from '../../../../components/Collapse';
|
|
26
27
|
import IDNumber from './IDNumber';
|
|
27
28
|
import DOB from './DOB';
|
|
@@ -38,6 +39,7 @@ var NID = function (_a) {
|
|
|
38
39
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
39
40
|
var _c = useAppSelector(connectExpressSelector), data = _c.data, loading = _c.loading, error = _c.error;
|
|
40
41
|
var isOtherCountry = React.useMemo(function () { return isOtherThanKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
42
|
+
var startWithEmail = data.otpData.authFor === AuthForType.EMAIL;
|
|
41
43
|
var methods = useForm({
|
|
42
44
|
resolver: yupResolver(isOtherCountry ? NIDOtherCountryValidationSchema : NIDValidationSchema),
|
|
43
45
|
defaultValues: data.nidData,
|
|
@@ -54,7 +56,8 @@ var NID = function (_a) {
|
|
|
54
56
|
setCollapse(flag);
|
|
55
57
|
};
|
|
56
58
|
var onBack = function () {
|
|
57
|
-
|
|
59
|
+
var screen = startWithEmail ? 'CONNECT_EXPRESS_EMAIL_STEP' : 'CONNECT_EXPRESS_MOBILE_STEP';
|
|
60
|
+
dispatch(handlePrevScreenStep(screen));
|
|
58
61
|
};
|
|
59
62
|
var disabled = !methods.formState.isValid;
|
|
60
63
|
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(IDNumber, { show: !collapse }) })), _jsx(Collapse, __assign({ in: isOtherCountry }, { children: _jsx(DOB, { onDateClicked: handleCollapseOpenClose }) })), _jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(Button, __assign({ sx: !isOtherCountry ? { mt: 10 } : {}, loading: loading, isAr: isAr, onBackClicked: onBack, disabled: disabled, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
@@ -13,9 +13,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import Box from '@mui/material/Box/Box';
|
|
14
14
|
import { styled } from '@mui/material/styles';
|
|
15
15
|
import * as React from 'react';
|
|
16
|
-
import { useTranslation } from 'react-i18next';
|
|
17
16
|
import Text from '../../../../components/Text';
|
|
18
|
-
import { clearError, connectExpressSelector, verifyMobileOtpAsync, resetOTPValue } from '../../../app/connectExpress/connectExpressStore';
|
|
17
|
+
import { clearError, connectExpressSelector, verifyMobileOtpAsync, verifyEmailOtpAsync, resetOTPValue } from '../../../app/connectExpress/connectExpressStore';
|
|
19
18
|
import Button from '../../../shared/Button';
|
|
20
19
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
20
|
import { useAppDispatch, useAppSelector, useSanitizedTranslation } from '../../../../hooks';
|
|
@@ -24,7 +23,8 @@ import { useLanguage } from '../../../../hooks';
|
|
|
24
23
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
25
24
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
26
25
|
import Form from '../../../../components/Form';
|
|
27
|
-
import { maskPhone, deepCopy, sendCustomEventToGTM } from '../../../../utils';
|
|
26
|
+
import { maskPhone, deepCopy, sendCustomEventToGTM, maskEmail } from '../../../../utils';
|
|
27
|
+
import { AuthForType } from '../../../../@types';
|
|
28
28
|
import { OTPValidation } from './validation';
|
|
29
29
|
import OTPInput from './OTPInput';
|
|
30
30
|
var OTPTitleContainerStyled = styled(Box)(function (_a) {
|
|
@@ -50,7 +50,6 @@ var OTP = function () {
|
|
|
50
50
|
var _a;
|
|
51
51
|
var dispatch = useAppDispatch();
|
|
52
52
|
var _b = useAppSelector(connectExpressSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
53
|
-
var t = useTranslation().t;
|
|
54
53
|
var st = useSanitizedTranslation();
|
|
55
54
|
var isAr = useLanguage().isAr;
|
|
56
55
|
var methods = useForm({
|
|
@@ -73,14 +72,21 @@ var OTP = function () {
|
|
|
73
72
|
};
|
|
74
73
|
}, []);
|
|
75
74
|
var onSubmit = function (formData) {
|
|
76
|
-
|
|
75
|
+
if (data.otpData.authFor === AuthForType.EMAIL) {
|
|
76
|
+
dispatch(verifyEmailOtpAsync(deepCopy(formData)));
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
dispatch(verifyMobileOtpAsync(deepCopy(formData)));
|
|
80
|
+
}
|
|
77
81
|
};
|
|
78
82
|
var onBack = function () {
|
|
79
83
|
dispatch(handlePrevScreenStep());
|
|
80
84
|
};
|
|
81
85
|
var disabled = !methods.formState.isValid;
|
|
86
|
+
var isEmailFlow = data.otpData.authFor === AuthForType.EMAIL;
|
|
82
87
|
var phone = data.mobileData.mobile ? ((_a = data.mobileData.countryCode) === null || _a === void 0 ? void 0 : _a.idd_prefix) + data.mobileData.mobile : '';
|
|
83
|
-
var
|
|
84
|
-
|
|
88
|
+
var contactInfo = isEmailFlow ? maskEmail(data.emailData.email) : maskPhone(phone);
|
|
89
|
+
var title = isEmailFlow ? st('otp_email_sent_title') : st('ide_opt_sent_title');
|
|
90
|
+
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') : title, !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: contactInfo }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: st(error || '') }, { children: st('next') }))] })) })) }));
|
|
85
91
|
};
|
|
86
92
|
export default React.memo(OTP);
|
|
@@ -17,9 +17,10 @@ import Box from '@mui/material/Box/Box';
|
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
18
|
import OTPField from '../../../shared/OTP';
|
|
19
19
|
import { DEFAULT_TIMER_VALUE } from '../../../../constants';
|
|
20
|
-
import { resendMobileAuthOTP, connectExpressSelector, clearError } from '../../../app/connectExpress/connectExpressStore';
|
|
20
|
+
import { resendMobileAuthOTP, resendEmailAuthOTP, connectExpressSelector, clearError } from '../../../app/connectExpress/connectExpressStore';
|
|
21
21
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
22
22
|
import { sendCustomEventToGTM } from '../../../../utils';
|
|
23
|
+
import { AuthForType } from '../../../../@types';
|
|
23
24
|
var BoxStyled = styled(Box)(function (_a) {
|
|
24
25
|
var theme = _a.theme;
|
|
25
26
|
return ({
|
|
@@ -34,7 +35,8 @@ var OTPInput = function (_a) {
|
|
|
34
35
|
var dispatch = useAppDispatch();
|
|
35
36
|
var otpControl = useController({ name: 'otp', control: control });
|
|
36
37
|
var _c = useAppSelector(connectExpressSelector), data = _c.data, error = _c.error;
|
|
37
|
-
var mobileData = data.mobileData;
|
|
38
|
+
var mobileData = data.mobileData, emailData = data.emailData, otpData = data.otpData;
|
|
39
|
+
var isEmailFlow = otpData.authFor === AuthForType.EMAIL;
|
|
38
40
|
var sendEventAskAnotherOTP = function () {
|
|
39
41
|
sendCustomEventToGTM({
|
|
40
42
|
event: 'Send Event',
|
|
@@ -51,7 +53,12 @@ var OTPInput = function (_a) {
|
|
|
51
53
|
if (otpControl.field.value)
|
|
52
54
|
setValue('otp', '', { shouldValidate: true });
|
|
53
55
|
sendEventAskAnotherOTP();
|
|
54
|
-
|
|
56
|
+
if (isEmailFlow) {
|
|
57
|
+
dispatch(resendEmailAuthOTP(emailData));
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
dispatch(resendMobileAuthOTP(mobileData));
|
|
61
|
+
}
|
|
55
62
|
};
|
|
56
63
|
var otpValue = otpControl.field.value;
|
|
57
64
|
return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
|
|
@@ -17,6 +17,7 @@ import OTPVerifySecurityError from './shared/OTPVerifySecurityError';
|
|
|
17
17
|
import OTPSessionExpired from './connect/screens/OTPSessionExpired';
|
|
18
18
|
import ConnectExpressBusinessCountry from './connectExpress/screens/BusinessCountry/BusinessCountry';
|
|
19
19
|
import ConnectExpressMobileScreen from './connectExpress/screens/Mobile';
|
|
20
|
+
import ConnectExpressEmailScreen from './connectExpress/screens/Email';
|
|
20
21
|
import ConnectExpressNIDScreen from './connectExpress/screens/NID';
|
|
21
22
|
import ConnectExpressVerifyNafathScreen from './connectExpress/screens/VerifyNafath';
|
|
22
23
|
import ConnectExpressCivilIDScreen from './connectExpress/screens/CivilID';
|
|
@@ -261,6 +262,10 @@ export var connectExpressFeatureScreens = [
|
|
|
261
262
|
name: 'CONNECT_EXPRESS_MOBILE_STEP',
|
|
262
263
|
element: ConnectExpressMobileScreen
|
|
263
264
|
},
|
|
265
|
+
{
|
|
266
|
+
name: 'CONNECT_EXPRESS_EMAIL_STEP',
|
|
267
|
+
element: ConnectExpressEmailScreen
|
|
268
|
+
},
|
|
264
269
|
{
|
|
265
270
|
name: 'CONNECT_EXPRESS_OTP_STEP',
|
|
266
271
|
element: ConnectExpressOTPScreen
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { isKW, isSA } from '../utils';
|
|
1
|
+
import { isKW, isSA, isQA } from '../utils';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
export var useCountry = function (code) {
|
|
4
4
|
var isKuwait = useMemo(function () { return isKW(code); }, [code]);
|
|
5
5
|
var isSaudi = useMemo(function () { return isSA(code); }, [code]);
|
|
6
|
+
var isQatar = useMemo(function () { return isQA(code); }, [code]);
|
|
6
7
|
var isOther = useMemo(function () { return !isKW(code) && !isSA(code); }, [code]);
|
|
7
|
-
return { isKuwait: isKuwait, isSaudi: isSaudi, isOther: isOther };
|
|
8
|
+
return { isKuwait: isKuwait, isSaudi: isSaudi, isQatar: isQatar, isOther: isOther };
|
|
8
9
|
};
|
package/build/utils/string.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ export declare const getEighteenYearsAgo: () => string;
|
|
|
48
48
|
export declare const isKW: (flag: string) => boolean;
|
|
49
49
|
export declare const isSA: (flag: string | undefined) => boolean;
|
|
50
50
|
export declare const isOtherThanKWOrSA: (flag: string) => boolean;
|
|
51
|
+
export declare const isQA: (flag: string | undefined) => boolean;
|
|
51
52
|
export declare const isKWOrSA: (flag: string) => boolean;
|
|
52
53
|
export declare const isLinkedIn: (flag: string) => boolean;
|
|
53
54
|
export declare const isTwitter: (flag: string) => boolean;
|
package/build/utils/string.js
CHANGED
|
@@ -224,6 +224,11 @@ export var isSA = function (flag) {
|
|
|
224
224
|
export var isOtherThanKWOrSA = function (flag) {
|
|
225
225
|
return !isKW(flag) && !isSA(flag);
|
|
226
226
|
};
|
|
227
|
+
export var isQA = function (flag) {
|
|
228
|
+
if (!flag)
|
|
229
|
+
return false;
|
|
230
|
+
return ['qa', 'qat'].includes(flag.toLowerCase());
|
|
231
|
+
};
|
|
227
232
|
export var isKWOrSA = function (flag) {
|
|
228
233
|
return isKW(flag) || isSA(flag);
|
|
229
234
|
};
|