@tap-payments/auth-jsconnect 2.9.38-sandbox → 2.9.40-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/@types/app.d.ts +5 -0
- package/build/@types/app.js +6 -0
- package/build/components/Tooltip/Tooltip.js +1 -1
- package/build/constants/app.d.ts +1 -1
- package/build/constants/app.js +25 -19
- package/build/features/app/connectExpress/connectExpressStore.d.ts +13 -3
- package/build/features/app/connectExpress/connectExpressStore.js +104 -12
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/OTPInput.d.ts +5 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/OTPInput.js +58 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/VerifyMobileAuthOTP.d.ts +5 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/VerifyMobileAuthOTP.js +88 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/index.d.ts +3 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/index.js +2 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/validation.d.ts +8 -0
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/validation.js +4 -0
- package/build/features/connectExpress/screens/VerifyNafath/VerifyNafath.js +9 -3
- package/build/features/featuresScreens.js +5 -5
- package/build/utils/common.js +3 -3
- package/package.json +2 -2
package/build/@types/app.d.ts
CHANGED
|
@@ -351,6 +351,11 @@ export declare enum AuthForType {
|
|
|
351
351
|
NATIONAL_ID = "national_id",
|
|
352
352
|
NATIONAL_ID_MISSED = "national_id_missed"
|
|
353
353
|
}
|
|
354
|
+
export declare enum AuthForScreen {
|
|
355
|
+
INDIVIDUAL = "individual",
|
|
356
|
+
DOB = "dob",
|
|
357
|
+
MOBILE_OWNERSHIP = "mobile_ownership"
|
|
358
|
+
}
|
|
354
359
|
export declare enum AuthTypeNumber {
|
|
355
360
|
EMAIL_OTP = 5,
|
|
356
361
|
MOBILE_OTP = 2,
|
package/build/@types/app.js
CHANGED
|
@@ -43,6 +43,12 @@ export var AuthForType;
|
|
|
43
43
|
AuthForType["NATIONAL_ID"] = "national_id";
|
|
44
44
|
AuthForType["NATIONAL_ID_MISSED"] = "national_id_missed";
|
|
45
45
|
})(AuthForType || (AuthForType = {}));
|
|
46
|
+
export var AuthForScreen;
|
|
47
|
+
(function (AuthForScreen) {
|
|
48
|
+
AuthForScreen["INDIVIDUAL"] = "individual";
|
|
49
|
+
AuthForScreen["DOB"] = "dob";
|
|
50
|
+
AuthForScreen["MOBILE_OWNERSHIP"] = "mobile_ownership";
|
|
51
|
+
})(AuthForScreen || (AuthForScreen = {}));
|
|
46
52
|
export var AuthTypeNumber;
|
|
47
53
|
(function (AuthTypeNumber) {
|
|
48
54
|
AuthTypeNumber[AuthTypeNumber["EMAIL_OTP"] = 5] = "EMAIL_OTP";
|
|
@@ -33,7 +33,7 @@ var StyledTooltip = styled(function (_a) {
|
|
|
33
33
|
var _b;
|
|
34
34
|
var theme = _a.theme;
|
|
35
35
|
return (_b = {},
|
|
36
|
-
_b["& .".concat(tooltipClasses.tooltip)] = __assign(__assign({ color: alpha(theme.palette.text.primary, 0.5), width: 'fit-content', maxHeight: 'fit-content' }, theme.typography.body2), { fontWeight: theme.typography.fontWeightLight, backgroundColor: theme.palette.secondary.light, border: "1px solid ".concat(alpha(theme.palette.divider, 0.8))
|
|
36
|
+
_b["& .".concat(tooltipClasses.tooltip)] = __assign(__assign({ color: alpha(theme.palette.text.primary, 0.5), width: 'fit-content', maxHeight: 'fit-content' }, theme.typography.body2), { fontWeight: theme.typography.fontWeightLight, backgroundColor: theme.palette.secondary.light, border: "1px solid ".concat(alpha(theme.palette.divider, 0.8)) }),
|
|
37
37
|
_b);
|
|
38
38
|
});
|
|
39
39
|
var TextStyled = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isAr'; } })(function (_a) {
|
package/build/constants/app.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ScreenStepNavigation, BusinessType } from '../@types';
|
|
2
2
|
export declare const CONNECT_DEV_URL = "https://connect.dev.tap.company";
|
|
3
|
-
export declare const CONNECT_SANDBOX_URL = "https://connect.sandbox.tap.company";
|
|
4
3
|
export declare const CONNECT_PROD_URL = "https://connect.tap.company";
|
|
5
4
|
export declare const CLIENT_ORIGIN: string;
|
|
6
5
|
export declare const TAP_WEBSITE = "https://www.tap.company/";
|
|
@@ -138,6 +137,7 @@ export declare const CONNECT_EXPRESS_STEP_NAMES: {
|
|
|
138
137
|
CONNECT_EXPRESS_SUCCESS: string;
|
|
139
138
|
COLLECT_MOBILE_OWNERSHIP: string;
|
|
140
139
|
COLLECT_MOBILE_OWNERSHIP_SKIPPED: string;
|
|
140
|
+
VERIFY_AUTH_MOBILE_OTP: string;
|
|
141
141
|
};
|
|
142
142
|
export declare const SignIn_STEP_NAMES: {
|
|
143
143
|
CREATE_AUTH_MOBILE: string;
|
package/build/constants/app.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BusinessType } from '../@types';
|
|
2
2
|
import { CONNECT_FLOWS } from './flows';
|
|
3
3
|
export var CONNECT_DEV_URL = 'https://connect.dev.tap.company';
|
|
4
|
-
export var CONNECT_SANDBOX_URL = 'https://connect.sandbox.tap.company';
|
|
5
4
|
export var CONNECT_PROD_URL = 'https://connect.tap.company';
|
|
6
5
|
export var CLIENT_ORIGIN = window.location.origin;
|
|
7
6
|
export var TAP_WEBSITE = 'https://www.tap.company/';
|
|
@@ -229,7 +228,11 @@ export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
|
|
|
229
228
|
},
|
|
230
229
|
{
|
|
231
230
|
name: 'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP',
|
|
232
|
-
next: [
|
|
231
|
+
next: [
|
|
232
|
+
'CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP',
|
|
233
|
+
'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP',
|
|
234
|
+
'CONNECT_EXPRESS_VERIFY_AUTH_OTP_STEP'
|
|
235
|
+
],
|
|
233
236
|
prev: ['CONNECT_EXPRESS_NID_STEP', 'CONNECT_EXPRESS_NID_MISSED_STEP'],
|
|
234
237
|
order: 5
|
|
235
238
|
},
|
|
@@ -242,7 +245,8 @@ export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
|
|
|
242
245
|
'CONNECT_EXPRESS_CIVIL_ID_STEP',
|
|
243
246
|
'CONNECT_EXPRESS_CIVIL_ID_MISSED_STEP',
|
|
244
247
|
'CONNECT_EXPRESS_NID_MISSED_STEP',
|
|
245
|
-
'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP'
|
|
248
|
+
'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP',
|
|
249
|
+
'CONNECT_EXPRESS_VERIFY_AUTH_OTP_STEP'
|
|
246
250
|
],
|
|
247
251
|
order: 5
|
|
248
252
|
},
|
|
@@ -252,7 +256,8 @@ export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
|
|
|
252
256
|
'CONNECT_EXPRESS_COLLECT_BUSINESS_INFO_STEP',
|
|
253
257
|
'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP',
|
|
254
258
|
'CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP',
|
|
255
|
-
'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP'
|
|
259
|
+
'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP',
|
|
260
|
+
'CONNECT_EXPRESS_VERIFY_AUTH_OTP_STEP'
|
|
256
261
|
],
|
|
257
262
|
prev: ['CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP', 'CONNECT_EXPRESS_NID_MISSED_STEP'],
|
|
258
263
|
order: 6
|
|
@@ -264,39 +269,39 @@ export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
|
|
|
264
269
|
order: 6
|
|
265
270
|
},
|
|
266
271
|
{
|
|
267
|
-
name: '
|
|
268
|
-
next: 'CONNECT_EXPRESS_PREPARING_DATA_STEP',
|
|
269
|
-
prev: '',
|
|
270
|
-
order: 7
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
name: 'CONNECT_EXPRESS_GENERIC_PREPARING_DATA_STEP',
|
|
272
|
+
name: 'CONNECT_EXPRESS_VERIFY_AUTH_OTP_STEP',
|
|
274
273
|
next: [
|
|
275
|
-
'CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP',
|
|
276
274
|
'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP',
|
|
277
|
-
'
|
|
278
|
-
'
|
|
275
|
+
'COLLECT_MOBILE_OWNERSHIP',
|
|
276
|
+
'CONNECT_EXPRESS_COLLECT_BUSINESS_INFO_STEP',
|
|
277
|
+
'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP'
|
|
279
278
|
],
|
|
279
|
+
prev: ['CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP', 'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP', 'COLLECT_MOBILE_OWNERSHIP'],
|
|
280
|
+
order: 7
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
name: 'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP',
|
|
284
|
+
next: 'CONNECT_EXPRESS_PREPARING_DATA_STEP',
|
|
280
285
|
prev: '',
|
|
281
|
-
order:
|
|
286
|
+
order: 8
|
|
282
287
|
},
|
|
283
288
|
{
|
|
284
289
|
name: 'CONNECT_EXPRESS_PREPARING_DATA_STEP',
|
|
285
290
|
next: 'CONNECT_EXPRESS_SUCCESS_WITH_FLOW_BUTTONS_STEP',
|
|
286
291
|
prev: '',
|
|
287
|
-
order:
|
|
292
|
+
order: 9
|
|
288
293
|
},
|
|
289
294
|
{
|
|
290
295
|
name: 'CONNECT_EXPRESS_ACCOUNT_ALREADY_CREATED_STEP',
|
|
291
296
|
next: '',
|
|
292
297
|
prev: '',
|
|
293
|
-
order:
|
|
298
|
+
order: 10
|
|
294
299
|
},
|
|
295
300
|
{
|
|
296
301
|
name: 'CONNECT_EXPRESS_SUCCESS_WITH_FLOW_BUTTONS_STEP',
|
|
297
302
|
next: '',
|
|
298
303
|
prev: '',
|
|
299
|
-
order:
|
|
304
|
+
order: 11
|
|
300
305
|
}
|
|
301
306
|
];
|
|
302
307
|
export var AUTH_SCREENS_NAVIGATION = [
|
|
@@ -1050,7 +1055,8 @@ export var CONNECT_EXPRESS_STEP_NAMES = {
|
|
|
1050
1055
|
VERIFY_AUTH_PASSWORD: 'connect_express_verify_auth_password',
|
|
1051
1056
|
CONNECT_EXPRESS_SUCCESS: 'connect_express_completed',
|
|
1052
1057
|
COLLECT_MOBILE_OWNERSHIP: 'collect_owner_phone',
|
|
1053
|
-
COLLECT_MOBILE_OWNERSHIP_SKIPPED: 'collect_owner_phone_skipped'
|
|
1058
|
+
COLLECT_MOBILE_OWNERSHIP_SKIPPED: 'collect_owner_phone_skipped',
|
|
1059
|
+
VERIFY_AUTH_MOBILE_OTP: 'connect_express_auth_mobile'
|
|
1054
1060
|
};
|
|
1055
1061
|
export var SignIn_STEP_NAMES = {
|
|
1056
1062
|
CREATE_AUTH_MOBILE: 'signIn_create_auth_mobile',
|
|
@@ -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 } from '../../../@types';
|
|
2
|
+
import { MobileFormValues, NIDFormValues, CivilFormValues, OTPFormValues, IndividualFormValues, SharedState, FlowsTypes, ActionState, CountryCode, AuthForType, BusinessDataFormValues, AsyncThunkParams, AuthenticationListFormValues, AuthMerchantFormValues, DOBFormValues, MobileOwnershipFormValues, AuthForScreen } 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<{
|
|
@@ -46,13 +46,16 @@ export declare const createNafathAuth: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
46
46
|
termAndConditionChecked?: boolean | undefined;
|
|
47
47
|
};
|
|
48
48
|
}, NIDFormValues, {}>;
|
|
49
|
+
declare type VerifyNafathAsyncParams = verifyPACIAsyncParams & {
|
|
50
|
+
showLoadingScreenAfterNafathSuccess: () => void;
|
|
51
|
+
};
|
|
49
52
|
export declare const verifyNafathAsync: import("@reduxjs/toolkit").AsyncThunk<{
|
|
50
53
|
data: any;
|
|
51
54
|
isNextScreenIsDob?: undefined;
|
|
52
55
|
} | {
|
|
53
56
|
data: any;
|
|
54
57
|
isNextScreenIsDob: boolean;
|
|
55
|
-
},
|
|
58
|
+
}, VerifyNafathAsyncParams, {}>;
|
|
56
59
|
export declare const createCivilIdAuthAsync: import("@reduxjs/toolkit").AsyncThunk<{
|
|
57
60
|
response: any;
|
|
58
61
|
formData: CivilFormValues;
|
|
@@ -133,6 +136,9 @@ export declare const updateLeadMobile: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
133
136
|
export declare const skipUpdateLeadMobile: import("@reduxjs/toolkit").AsyncThunk<{
|
|
134
137
|
leadResponse: any;
|
|
135
138
|
}, void, {}>;
|
|
139
|
+
export declare const verifyAuthMobileOtpAsync: import("@reduxjs/toolkit").AsyncThunk<{
|
|
140
|
+
data: any;
|
|
141
|
+
}, OTPFormValues, {}>;
|
|
136
142
|
export declare const confirmInfo: import("@reduxjs/toolkit").AsyncThunk<{
|
|
137
143
|
boardInfo: any;
|
|
138
144
|
boardData: any;
|
|
@@ -156,6 +162,9 @@ export interface ConnectExpressData {
|
|
|
156
162
|
individualData: IndividualFormValues & {
|
|
157
163
|
isPrevDob?: boolean;
|
|
158
164
|
};
|
|
165
|
+
verifyAuthOtpData: OTPFormValues & {
|
|
166
|
+
authFor: AuthForScreen;
|
|
167
|
+
};
|
|
159
168
|
businessData: BusinessDataFormValues;
|
|
160
169
|
authenticationData: AuthenticationListFormValues;
|
|
161
170
|
authMerchantData: AuthMerchantFormValues;
|
|
@@ -177,10 +186,11 @@ export declare const connectSlice: import("@reduxjs/toolkit").Slice<ConnectExpre
|
|
|
177
186
|
resetCivilScreen: (state: ConnectExpressState) => void;
|
|
178
187
|
resetAuthenticationScreen: (state: ConnectExpressState) => void;
|
|
179
188
|
resetOTPValue: (state: ConnectExpressState) => void;
|
|
189
|
+
resetVerifyAuthOTPValue: (state: ConnectExpressState) => void;
|
|
180
190
|
resetStore: (state: ConnectExpressState) => void;
|
|
181
191
|
resetIndividualScreen: (state: ConnectExpressState) => void;
|
|
182
192
|
}, "connectExpress/store">;
|
|
183
|
-
export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setIsLeadIdPassed: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>, resetMobileScreen: import("@reduxjs/toolkit").ActionCreatorWithPayload<CountryCode, string>, resetOTPValue: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetNIDScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetCivilScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetStore: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setError: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, setLeadId: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, resetIndividualScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setDefaultCountryCode: import("@reduxjs/toolkit").ActionCreatorWithPayload<CountryCode, string>, storeIsStartFromBusinessCountry: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>, resetAuthenticationScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
193
|
+
export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setIsLeadIdPassed: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>, resetMobileScreen: import("@reduxjs/toolkit").ActionCreatorWithPayload<CountryCode, string>, resetOTPValue: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetVerifyAuthOTPValue: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetNIDScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetCivilScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetStore: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setError: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, setLeadId: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, string>, resetIndividualScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, setDefaultCountryCode: import("@reduxjs/toolkit").ActionCreatorWithPayload<CountryCode, string>, storeIsStartFromBusinessCountry: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, string>, resetAuthenticationScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
184
194
|
declare const _default: import("redux").Reducer<ConnectExpressState, import("redux").AnyAction>;
|
|
185
195
|
export default _default;
|
|
186
196
|
export declare const connectExpressSelector: (state: RootState) => ConnectExpressState;
|
|
@@ -57,7 +57,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
57
57
|
var _a;
|
|
58
58
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
59
59
|
import { handleNextScreenStep, handleCurrentActiveScreen, handleOpen, handleSetCountryByIso2, onCloseComplete, storeAuthId } from '../../../app/settings';
|
|
60
|
-
import { FlowsTypes, AuthForType, BusinessType, LicenseType } from '../../../@types';
|
|
60
|
+
import { FlowsTypes, AuthForType, BusinessType, LicenseType, AuthForScreen } from '../../../@types';
|
|
61
61
|
import API from '../../../api';
|
|
62
62
|
import { ADD_NEW_ENTITY, COLLECT_DOB_INFO_NAFATH, CONNECT_EXPRESS_STEP_NAMES, IDENTIFICATION_TYPE, NAFATH_PACI_TIMEOUT_DURATION, NAFATH_VERIFICATION_FAILED, OTHER_CR_LICENSE, OTHER_FL_LICENSE, SCOPE_AUTH } from '../../../constants';
|
|
63
63
|
import { defaultCountry } from '../../../constants';
|
|
@@ -385,7 +385,6 @@ export var verifyNafathAsync = createAsyncThunk('connectExpress/verifyNafathAsyn
|
|
|
385
385
|
return [2, { data: data }];
|
|
386
386
|
}
|
|
387
387
|
if (!isSuccess) return [3, 9];
|
|
388
|
-
thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_GENERIC_PREPARING_DATA_STEP'));
|
|
389
388
|
authId = (_j = data.auth) === null || _j === void 0 ? void 0 : _j.id;
|
|
390
389
|
leadId = (_k = data.auth) === null || _k === void 0 ? void 0 : _k.lead_id;
|
|
391
390
|
thunkApi.dispatch(storeAuthId(authId));
|
|
@@ -401,6 +400,7 @@ export var verifyNafathAsync = createAsyncThunk('connectExpress/verifyNafathAsyn
|
|
|
401
400
|
return [2, { data: data }];
|
|
402
401
|
}
|
|
403
402
|
}
|
|
403
|
+
params.showLoadingScreenAfterNafathSuccess();
|
|
404
404
|
if (!(isScopeAuthentication && !data.new_user && authDataHasValue)) return [3, 7];
|
|
405
405
|
return [4, thunkApi.dispatch(retrieveAuthenticationListAsync({ individualId: data.individual_id })).unwrap()];
|
|
406
406
|
case 6:
|
|
@@ -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
|
}); });
|
|
@@ -1025,7 +1025,7 @@ export var createEntity = createAsyncThunk('connectExpress/createEntity', functi
|
|
|
1025
1025
|
});
|
|
1026
1026
|
}); });
|
|
1027
1027
|
export var updateLeadDOBAsync = createAsyncThunk('connectExpress/updateLeadDOBAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1028
|
-
var _a, settings, connectExpress, id, dob, payload, data, needToCollectMoreInfo, creatingAccount;
|
|
1028
|
+
var _a, settings, connectExpress, id, dob, payload, data, needToCollectMoreInfo, creatingAccount, verifyAuthMobile;
|
|
1029
1029
|
var _b, _c, _d;
|
|
1030
1030
|
return __generator(this, function (_e) {
|
|
1031
1031
|
switch (_e.label) {
|
|
@@ -1045,6 +1045,10 @@ export var updateLeadDOBAsync = createAsyncThunk('connectExpress/updateLeadDOBAs
|
|
|
1045
1045
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
|
|
1046
1046
|
needToCollectMoreInfo = data.step_name === 'collect_info';
|
|
1047
1047
|
creatingAccount = data.step_name === 'create_account';
|
|
1048
|
+
verifyAuthMobile = data.step_name === 'connect_express_auth_mobile';
|
|
1049
|
+
if (verifyAuthMobile) {
|
|
1050
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('CONNECT_EXPRESS_VERIFY_AUTH_OTP_STEP')); });
|
|
1051
|
+
}
|
|
1048
1052
|
if (creatingAccount) {
|
|
1049
1053
|
sleep(100).then(function () { return thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP')); });
|
|
1050
1054
|
}
|
|
@@ -1058,7 +1062,7 @@ export var updateLeadDOBAsync = createAsyncThunk('connectExpress/updateLeadDOBAs
|
|
|
1058
1062
|
export var updateLeadIndividualAsync = createAsyncThunk('connectExpress/updateLeadIndividualAsync', function (_a, thunkApi) {
|
|
1059
1063
|
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
1060
1064
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
1061
|
-
var _b, settings, connectExpress, id, countryCode, name, email, mobile, phoneCountry, isContactAvailable, payload, data, needToCollectMoreInfo, creatingAccount, collectPhoneOwnershipScreen, isSaudi;
|
|
1065
|
+
var _b, settings, connectExpress, id, countryCode, name, email, mobile, phoneCountry, isContactAvailable, payload, data, needToCollectMoreInfo, creatingAccount, collectPhoneOwnershipScreen, verifyAuthMobile, isSaudi;
|
|
1062
1066
|
var _c, _d, _e, _f, _g;
|
|
1063
1067
|
return __generator(this, function (_h) {
|
|
1064
1068
|
switch (_h.label) {
|
|
@@ -1078,6 +1082,10 @@ export var updateLeadIndividualAsync = createAsyncThunk('connectExpress/updateLe
|
|
|
1078
1082
|
needToCollectMoreInfo = data.step_name === 'collect_info';
|
|
1079
1083
|
creatingAccount = data.step_name === 'create_account';
|
|
1080
1084
|
collectPhoneOwnershipScreen = data.step_name === CONNECT_EXPRESS_STEP_NAMES.COLLECT_MOBILE_OWNERSHIP;
|
|
1085
|
+
verifyAuthMobile = data.step_name === CONNECT_EXPRESS_STEP_NAMES.VERIFY_AUTH_MOBILE_OTP;
|
|
1086
|
+
if (verifyAuthMobile) {
|
|
1087
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('CONNECT_EXPRESS_VERIFY_AUTH_OTP_STEP')); });
|
|
1088
|
+
}
|
|
1081
1089
|
if (collectPhoneOwnershipScreen) {
|
|
1082
1090
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('COLLECT_MOBILE_OWNERSHIP')); });
|
|
1083
1091
|
}
|
|
@@ -1141,7 +1149,7 @@ export var updateLeadBusinessDataAsync = createAsyncThunk('updateLeadBusinessDat
|
|
|
1141
1149
|
});
|
|
1142
1150
|
});
|
|
1143
1151
|
export var updateLeadMobile = createAsyncThunk('connectExpress/updateLeadMobile', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1144
|
-
var _a, settings, connectExpress, id, startWithNID, payload, leadResponse, needToCollectMoreInfo, creatingAccount, askDobInfo, collectPhoneOwnershipScreen;
|
|
1152
|
+
var _a, settings, connectExpress, id, startWithNID, payload, leadResponse, needToCollectMoreInfo, creatingAccount, askDobInfo, collectPhoneOwnershipScreen, verifyAuthMobile;
|
|
1145
1153
|
var _b, _c, _d;
|
|
1146
1154
|
return __generator(this, function (_e) {
|
|
1147
1155
|
switch (_e.label) {
|
|
@@ -1168,9 +1176,13 @@ export var updateLeadMobile = createAsyncThunk('connectExpress/updateLeadMobile'
|
|
|
1168
1176
|
creatingAccount = leadResponse.step_name === 'create_account';
|
|
1169
1177
|
askDobInfo = leadResponse.step_name === COLLECT_DOB_INFO_NAFATH;
|
|
1170
1178
|
collectPhoneOwnershipScreen = leadResponse.step_name === CONNECT_EXPRESS_STEP_NAMES.COLLECT_MOBILE_OWNERSHIP;
|
|
1179
|
+
verifyAuthMobile = leadResponse.step_name === CONNECT_EXPRESS_STEP_NAMES.VERIFY_AUTH_MOBILE_OTP;
|
|
1171
1180
|
if (collectPhoneOwnershipScreen) {
|
|
1172
1181
|
throw new Error("The new mobile number doesn't match the national ID, please update the mobile to the correct one");
|
|
1173
1182
|
}
|
|
1183
|
+
if (verifyAuthMobile) {
|
|
1184
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('CONNECT_EXPRESS_VERIFY_AUTH_OTP_STEP')); });
|
|
1185
|
+
}
|
|
1174
1186
|
if (askDobInfo) {
|
|
1175
1187
|
sleep(100).then(function () { return thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP')); });
|
|
1176
1188
|
}
|
|
@@ -1195,7 +1207,7 @@ export var updateLeadMobile = createAsyncThunk('connectExpress/updateLeadMobile'
|
|
|
1195
1207
|
});
|
|
1196
1208
|
}); });
|
|
1197
1209
|
export var skipUpdateLeadMobile = createAsyncThunk('connectExpress/skipUpdateLeadMobile', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1198
|
-
var _a, settings, connectExpress, id, startWithNID, payload, leadResponse, needToCollectMoreInfo, creatingAccount, askDobInfo;
|
|
1210
|
+
var _a, settings, connectExpress, id, startWithNID, payload, leadResponse, needToCollectMoreInfo, creatingAccount, askDobInfo, verifyAuthMobile;
|
|
1199
1211
|
var _b, _c, _d;
|
|
1200
1212
|
return __generator(this, function (_e) {
|
|
1201
1213
|
switch (_e.label) {
|
|
@@ -1215,6 +1227,10 @@ export var skipUpdateLeadMobile = createAsyncThunk('connectExpress/skipUpdateLea
|
|
|
1215
1227
|
needToCollectMoreInfo = leadResponse.step_name === 'collect_info';
|
|
1216
1228
|
creatingAccount = leadResponse.step_name === 'create_account';
|
|
1217
1229
|
askDobInfo = leadResponse.step_name === COLLECT_DOB_INFO_NAFATH;
|
|
1230
|
+
verifyAuthMobile = leadResponse.step_name === CONNECT_EXPRESS_STEP_NAMES.VERIFY_AUTH_MOBILE_OTP;
|
|
1231
|
+
if (verifyAuthMobile) {
|
|
1232
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('CONNECT_EXPRESS_VERIFY_AUTH_OTP_STEP')); });
|
|
1233
|
+
}
|
|
1218
1234
|
if (askDobInfo) {
|
|
1219
1235
|
sleep(100).then(function () { return thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP')); });
|
|
1220
1236
|
}
|
|
@@ -1238,6 +1254,57 @@ export var skipUpdateLeadMobile = createAsyncThunk('connectExpress/skipUpdateLea
|
|
|
1238
1254
|
}
|
|
1239
1255
|
});
|
|
1240
1256
|
}); });
|
|
1257
|
+
export var verifyAuthMobileOtpAsync = createAsyncThunk('connectExpress/verifyAuthMobileOtpAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1258
|
+
var _a, settings, connectExpress, responseData, _b, verify_token, verification_by, payload, data, needToCollectMoreInfo, creatingAccount, askDobInfo, collectPhoneOwnershipScreen, isSaudi;
|
|
1259
|
+
var _c, _d;
|
|
1260
|
+
return __generator(this, function (_e) {
|
|
1261
|
+
switch (_e.label) {
|
|
1262
|
+
case 0:
|
|
1263
|
+
_a = thunkApi.getState(), settings = _a.settings, connectExpress = _a.connectExpress;
|
|
1264
|
+
responseData = (connectExpress.data || {}).responseData;
|
|
1265
|
+
if (!(responseData === null || responseData === void 0 ? void 0 : responseData.verifyAuthMobile))
|
|
1266
|
+
throw new Error('Auth data is missing');
|
|
1267
|
+
_b = responseData.verifyAuthMobile, verify_token = _b.verify_token, verification_by = _b.verification_by;
|
|
1268
|
+
payload = {
|
|
1269
|
+
verify_token: verify_token,
|
|
1270
|
+
data: params.otp,
|
|
1271
|
+
auth_type: 2,
|
|
1272
|
+
service_name: verification_by === null || verification_by === void 0 ? void 0 : verification_by.service_name,
|
|
1273
|
+
sign_in: false,
|
|
1274
|
+
step_name: CONNECT_EXPRESS_STEP_NAMES.VERIFY_AUTH_MOBILE_OTP,
|
|
1275
|
+
encryption_contract: ['data']
|
|
1276
|
+
};
|
|
1277
|
+
return [4, API.authService.verifyExpressLeadIdentity(payload)];
|
|
1278
|
+
case 1:
|
|
1279
|
+
data = _e.sent();
|
|
1280
|
+
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
|
|
1281
|
+
needToCollectMoreInfo = data.step_name === 'collect_info';
|
|
1282
|
+
creatingAccount = data.step_name === 'create_account';
|
|
1283
|
+
askDobInfo = data.step_name === COLLECT_DOB_INFO_NAFATH;
|
|
1284
|
+
collectPhoneOwnershipScreen = data.step_name === CONNECT_EXPRESS_STEP_NAMES.COLLECT_MOBILE_OWNERSHIP;
|
|
1285
|
+
if (askDobInfo) {
|
|
1286
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP')); });
|
|
1287
|
+
}
|
|
1288
|
+
if (creatingAccount) {
|
|
1289
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP')); });
|
|
1290
|
+
}
|
|
1291
|
+
if (collectPhoneOwnershipScreen) {
|
|
1292
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('COLLECT_MOBILE_OWNERSHIP')); });
|
|
1293
|
+
}
|
|
1294
|
+
if (!needToCollectMoreInfo) return [3, 4];
|
|
1295
|
+
isSaudi = isSA(settings.data.businessCountry.iso2);
|
|
1296
|
+
if (!isSaudi) return [3, 3];
|
|
1297
|
+
return [4, thunkApi.dispatch(retrieveEntityListAsync(data.lead.id)).unwrap()];
|
|
1298
|
+
case 2:
|
|
1299
|
+
_e.sent();
|
|
1300
|
+
_e.label = 3;
|
|
1301
|
+
case 3:
|
|
1302
|
+
sleep(100).then(function () { return thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_COLLECT_BUSINESS_INFO_STEP')); });
|
|
1303
|
+
_e.label = 4;
|
|
1304
|
+
case 4: return [2, { data: data }];
|
|
1305
|
+
}
|
|
1306
|
+
});
|
|
1307
|
+
}); });
|
|
1241
1308
|
export var confirmInfo = createAsyncThunk('connectExpress/confirmInfo', function (_a, thunkApi) {
|
|
1242
1309
|
var brandInfo = _a.brandInfo, entityInfo = _a.entityInfo, merchantInfo = _a.merchantInfo;
|
|
1243
1310
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -1362,6 +1429,10 @@ var initialState = {
|
|
|
1362
1429
|
mobile: '',
|
|
1363
1430
|
countryCode: defaultCountry
|
|
1364
1431
|
},
|
|
1432
|
+
verifyAuthOtpData: {
|
|
1433
|
+
otp: '',
|
|
1434
|
+
authFor: AuthForScreen.INDIVIDUAL
|
|
1435
|
+
},
|
|
1365
1436
|
businessData: {
|
|
1366
1437
|
brandName: '',
|
|
1367
1438
|
licenseNumber: '',
|
|
@@ -1417,6 +1488,9 @@ export var connectSlice = createSlice({
|
|
|
1417
1488
|
resetOTPValue: function (state) {
|
|
1418
1489
|
state.data.otpData.otp = '';
|
|
1419
1490
|
},
|
|
1491
|
+
resetVerifyAuthOTPValue: function (state) {
|
|
1492
|
+
state.data.verifyAuthOtpData.otp = '';
|
|
1493
|
+
},
|
|
1420
1494
|
resetStore: function (state) {
|
|
1421
1495
|
var _a;
|
|
1422
1496
|
state.data = __assign(__assign({}, state.data), { responseData: { leadData: (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.leadData } });
|
|
@@ -1750,7 +1824,8 @@ export var connectSlice = createSlice({
|
|
|
1750
1824
|
state.loading = false;
|
|
1751
1825
|
state.error = null;
|
|
1752
1826
|
state.data.dobData = action.payload.formData;
|
|
1753
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { dobData: action.payload.response });
|
|
1827
|
+
state.data.responseData = __assign(__assign({}, state.data.responseData), { dobData: action.payload.response, verifyAuthMobile: action.payload.response });
|
|
1828
|
+
state.data.verifyAuthOtpData.authFor = AuthForScreen.DOB;
|
|
1754
1829
|
})
|
|
1755
1830
|
.addCase(updateLeadDOBAsync.pending, function (state) {
|
|
1756
1831
|
state.loading = true;
|
|
@@ -1766,7 +1841,8 @@ export var connectSlice = createSlice({
|
|
|
1766
1841
|
state.error = null;
|
|
1767
1842
|
var licenseList = [OTHER_CR_LICENSE, OTHER_FL_LICENSE];
|
|
1768
1843
|
state.data.individualData = action.payload.formData;
|
|
1769
|
-
state.data.responseData = __assign(__assign(__assign({}, state.data.responseData), { individualData: action.payload.response }), (!((_b = (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.licenseList) === null || _b === void 0 ? void 0 : _b.length) && { licenseList: licenseList }));
|
|
1844
|
+
state.data.responseData = __assign(__assign(__assign(__assign({}, state.data.responseData), { individualData: action.payload.response }), (!((_b = (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.licenseList) === null || _b === void 0 ? void 0 : _b.length) && { licenseList: licenseList })), { verifyAuthMobile: action.payload.response });
|
|
1845
|
+
state.data.verifyAuthOtpData.authFor = AuthForScreen.INDIVIDUAL;
|
|
1770
1846
|
})
|
|
1771
1847
|
.addCase(updateLeadIndividualAsync.pending, function (state) {
|
|
1772
1848
|
state.loading = true;
|
|
@@ -1794,7 +1870,8 @@ export var connectSlice = createSlice({
|
|
|
1794
1870
|
state.loading = false;
|
|
1795
1871
|
state.error = null;
|
|
1796
1872
|
state.data.individualData.mobile = action.payload.formData.mobile;
|
|
1797
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { individualData: action.payload.leadResponse });
|
|
1873
|
+
state.data.responseData = __assign(__assign({}, state.data.responseData), { individualData: action.payload.leadResponse, verifyAuthMobile: action.payload.leadResponse });
|
|
1874
|
+
state.data.verifyAuthOtpData.authFor = AuthForScreen.MOBILE_OWNERSHIP;
|
|
1798
1875
|
})
|
|
1799
1876
|
.addCase(updateLeadMobile.pending, function (state) {
|
|
1800
1877
|
state.loading = true;
|
|
@@ -1807,7 +1884,8 @@ export var connectSlice = createSlice({
|
|
|
1807
1884
|
.addCase(skipUpdateLeadMobile.fulfilled, function (state, action) {
|
|
1808
1885
|
state.loading = false;
|
|
1809
1886
|
state.error = null;
|
|
1810
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { individualData: action.payload.leadResponse });
|
|
1887
|
+
state.data.responseData = __assign(__assign({}, state.data.responseData), { individualData: action.payload.leadResponse, verifyAuthMobile: action.payload.leadResponse });
|
|
1888
|
+
state.data.verifyAuthOtpData.authFor = AuthForScreen.MOBILE_OWNERSHIP;
|
|
1811
1889
|
})
|
|
1812
1890
|
.addCase(skipUpdateLeadMobile.pending, function (state) {
|
|
1813
1891
|
state.loading = true;
|
|
@@ -1816,6 +1894,20 @@ export var connectSlice = createSlice({
|
|
|
1816
1894
|
.addCase(skipUpdateLeadMobile.rejected, function (state, action) {
|
|
1817
1895
|
state.loading = false;
|
|
1818
1896
|
state.error = action.error.message;
|
|
1897
|
+
})
|
|
1898
|
+
.addCase(verifyAuthMobileOtpAsync.fulfilled, function (state, action) {
|
|
1899
|
+
state.loading = false;
|
|
1900
|
+
state.error = null;
|
|
1901
|
+
state.data.responseData = __assign(__assign({}, state.data.responseData), { verifyAuthMobileOtp: action.payload.data });
|
|
1902
|
+
state.data.verifyAuthOtpData.authFor = AuthForScreen.MOBILE_OWNERSHIP;
|
|
1903
|
+
})
|
|
1904
|
+
.addCase(verifyAuthMobileOtpAsync.pending, function (state) {
|
|
1905
|
+
state.loading = true;
|
|
1906
|
+
state.error = null;
|
|
1907
|
+
})
|
|
1908
|
+
.addCase(verifyAuthMobileOtpAsync.rejected, function (state, action) {
|
|
1909
|
+
state.loading = false;
|
|
1910
|
+
state.error = action.error.message;
|
|
1819
1911
|
})
|
|
1820
1912
|
.addCase(createAccountAsync.pending, function (state) {
|
|
1821
1913
|
state.loading = true;
|
|
@@ -1924,6 +2016,6 @@ export var connectSlice = createSlice({
|
|
|
1924
2016
|
});
|
|
1925
2017
|
}
|
|
1926
2018
|
});
|
|
1927
|
-
export var clearError = (_a = connectSlice.actions, _a.clearError), stopLoader = _a.stopLoader, setIsLeadIdPassed = _a.setIsLeadIdPassed, resetMobileScreen = _a.resetMobileScreen, resetOTPValue = _a.resetOTPValue, resetNIDScreen = _a.resetNIDScreen, resetCivilScreen = _a.resetCivilScreen, resetStore = _a.resetStore, setError = _a.setError, setLeadId = _a.setLeadId, resetIndividualScreen = _a.resetIndividualScreen, setDefaultCountryCode = _a.setDefaultCountryCode, storeIsStartFromBusinessCountry = _a.storeIsStartFromBusinessCountry, resetAuthenticationScreen = _a.resetAuthenticationScreen;
|
|
2019
|
+
export var clearError = (_a = connectSlice.actions, _a.clearError), stopLoader = _a.stopLoader, setIsLeadIdPassed = _a.setIsLeadIdPassed, resetMobileScreen = _a.resetMobileScreen, resetOTPValue = _a.resetOTPValue, resetVerifyAuthOTPValue = _a.resetVerifyAuthOTPValue, resetNIDScreen = _a.resetNIDScreen, resetCivilScreen = _a.resetCivilScreen, resetStore = _a.resetStore, setError = _a.setError, setLeadId = _a.setLeadId, resetIndividualScreen = _a.resetIndividualScreen, setDefaultCountryCode = _a.setDefaultCountryCode, storeIsStartFromBusinessCountry = _a.storeIsStartFromBusinessCountry, resetAuthenticationScreen = _a.resetAuthenticationScreen;
|
|
1928
2020
|
export default connectSlice.reducer;
|
|
1929
2021
|
export var connectExpressSelector = function (state) { return state.connectExpress; };
|
|
@@ -0,0 +1,58 @@
|
|
|
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 { useController, useFormContext } from 'react-hook-form';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
16
|
+
import Box from '@mui/material/Box/Box';
|
|
17
|
+
import { styled } from '@mui/material/styles';
|
|
18
|
+
import OTPField from '../../../shared/OTP';
|
|
19
|
+
import { DEFAULT_TIMER_VALUE } from '../../../../constants';
|
|
20
|
+
import { connectExpressSelector, clearError, updateLeadIndividualAsync, updateLeadMobile, updateLeadDOBAsync } from '../../../app/connectExpress/connectExpressStore';
|
|
21
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
22
|
+
import { deepCopy } from '../../../../utils';
|
|
23
|
+
import { AuthForScreen } from '../../../../@types';
|
|
24
|
+
var BoxStyled = styled(Box)(function (_a) {
|
|
25
|
+
var theme = _a.theme;
|
|
26
|
+
return ({
|
|
27
|
+
display: 'flex',
|
|
28
|
+
flexDirection: 'column',
|
|
29
|
+
fontFamily: theme.typography.fontFamily
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
var OTPInput = function (_a) {
|
|
33
|
+
var _b = useFormContext(), control = _b.control, setValue = _b.setValue;
|
|
34
|
+
var t = useTranslation().t;
|
|
35
|
+
var dispatch = useAppDispatch();
|
|
36
|
+
var otpControl = useController({ name: 'otp', control: control });
|
|
37
|
+
var _c = useAppSelector(connectExpressSelector), data = _c.data, error = _c.error;
|
|
38
|
+
var verifyAuthOtpData = data.verifyAuthOtpData, individualData = data.individualData, dobData = data.dobData;
|
|
39
|
+
var authFor = verifyAuthOtpData.authFor;
|
|
40
|
+
var handleOnOTPChange = function (otp) {
|
|
41
|
+
if (error)
|
|
42
|
+
dispatch(clearError());
|
|
43
|
+
otpControl.field.onChange(otp);
|
|
44
|
+
};
|
|
45
|
+
var handleOnResendOTP = function () {
|
|
46
|
+
if (otpControl.field.value)
|
|
47
|
+
setValue('otp', '', { shouldValidate: true });
|
|
48
|
+
if (authFor === AuthForScreen.MOBILE_OWNERSHIP)
|
|
49
|
+
dispatch(updateLeadMobile(deepCopy(individualData)));
|
|
50
|
+
else if (authFor === AuthForScreen.DOB)
|
|
51
|
+
dispatch(updateLeadDOBAsync(deepCopy(dobData)));
|
|
52
|
+
else
|
|
53
|
+
dispatch(updateLeadIndividualAsync(deepCopy(individualData)));
|
|
54
|
+
};
|
|
55
|
+
var otpValue = otpControl.field.value;
|
|
56
|
+
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()); } }) })));
|
|
57
|
+
};
|
|
58
|
+
export default React.memo(OTPInput);
|
|
@@ -0,0 +1,88 @@
|
|
|
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 Box from '@mui/material/Box/Box';
|
|
14
|
+
import { styled } from '@mui/material/styles';
|
|
15
|
+
import * as React from 'react';
|
|
16
|
+
import { useTranslation } from 'react-i18next';
|
|
17
|
+
import Text from '../../../../components/Text';
|
|
18
|
+
import { clearError, connectExpressSelector, verifyAuthMobileOtpAsync, resetVerifyAuthOTPValue } from '../../../app/connectExpress/connectExpressStore';
|
|
19
|
+
import Button from '../../../shared/Button';
|
|
20
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
|
+
import { useAppDispatch, useAppSelector, useSanitizedTranslation } from '../../../../hooks';
|
|
22
|
+
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
23
|
+
import { useLanguage } from '../../../../hooks';
|
|
24
|
+
import { useForm, FormProvider } from 'react-hook-form';
|
|
25
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
26
|
+
import Form from '../../../../components/Form';
|
|
27
|
+
import { maskPhone, deepCopy } from '../../../../utils';
|
|
28
|
+
import { AuthForScreen } from '../../../../@types';
|
|
29
|
+
import { OTPValidation } from './validation';
|
|
30
|
+
import OTPInput from './OTPInput';
|
|
31
|
+
var OTPTitleContainerStyled = styled(Box)(function (_a) {
|
|
32
|
+
var theme = _a.theme;
|
|
33
|
+
return ({
|
|
34
|
+
background: theme.palette.common.white,
|
|
35
|
+
border: '1px solid',
|
|
36
|
+
borderColor: theme.palette.divider,
|
|
37
|
+
direction: theme.direction,
|
|
38
|
+
borderRadius: theme.spacing(0, 0, 1.25, 1.25),
|
|
39
|
+
marginBottom: theme.spacing(5.75)
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
var OTPTitleStyled = styled(Text)(function (_a) {
|
|
43
|
+
var theme = _a.theme;
|
|
44
|
+
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' }));
|
|
45
|
+
});
|
|
46
|
+
var FormStyled = styled(Form)(function () { return ({
|
|
47
|
+
display: 'flex',
|
|
48
|
+
flexDirection: 'column'
|
|
49
|
+
}); });
|
|
50
|
+
var VerifyMobileAuthOTP = function () {
|
|
51
|
+
var _a, _b, _c, _d, _e, _f;
|
|
52
|
+
var dispatch = useAppDispatch();
|
|
53
|
+
var _g = useAppSelector(connectExpressSelector), data = _g.data, loading = _g.loading, error = _g.error;
|
|
54
|
+
var t = useTranslation().t;
|
|
55
|
+
var st = useSanitizedTranslation();
|
|
56
|
+
var isAr = useLanguage().isAr;
|
|
57
|
+
var methods = useForm({
|
|
58
|
+
resolver: yupResolver(OTPValidation),
|
|
59
|
+
defaultValues: data.verifyAuthOtpData,
|
|
60
|
+
mode: 'onChange'
|
|
61
|
+
});
|
|
62
|
+
React.useEffect(function () {
|
|
63
|
+
if (error)
|
|
64
|
+
dispatch(clearError());
|
|
65
|
+
}, [methods.formState.isValid]);
|
|
66
|
+
React.useEffect(function () {
|
|
67
|
+
return function () {
|
|
68
|
+
dispatch(resetVerifyAuthOTPValue());
|
|
69
|
+
};
|
|
70
|
+
}, []);
|
|
71
|
+
var onSubmit = function (formData) {
|
|
72
|
+
dispatch(verifyAuthMobileOtpAsync(deepCopy(formData)));
|
|
73
|
+
};
|
|
74
|
+
var onBack = function () {
|
|
75
|
+
var authFor = data.verifyAuthOtpData.authFor;
|
|
76
|
+
var step_name = 'CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP';
|
|
77
|
+
if (authFor === AuthForScreen.DOB)
|
|
78
|
+
step_name = 'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP';
|
|
79
|
+
else if (authFor === AuthForScreen.MOBILE_OWNERSHIP)
|
|
80
|
+
step_name = 'COLLECT_MOBILE_OWNERSHIP';
|
|
81
|
+
dispatch(handlePrevScreenStep(step_name));
|
|
82
|
+
};
|
|
83
|
+
var disabled = !methods.formState.isValid;
|
|
84
|
+
var phone = ((_c = (_b = (_a = data.responseData) === null || _a === void 0 ? void 0 : _a.verifyAuthMobile) === null || _b === void 0 ? void 0 : _b.verification_by) === null || _c === void 0 ? void 0 : _c.sent_to) ? (_f = (_e = (_d = data.responseData) === null || _d === void 0 ? void 0 : _d.verifyAuthMobile) === null || _e === void 0 ? void 0 : _e.verification_by) === null || _f === void 0 ? void 0 : _f.sent_to : '';
|
|
85
|
+
var title = t('ide_opt_sent_title');
|
|
86
|
+
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: maskPhone(phone) }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: st(error || '') }, { children: t('next') }))] })) })) }));
|
|
87
|
+
};
|
|
88
|
+
export default React.memo(VerifyMobileAuthOTP);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as yup from 'yup';
|
|
2
|
+
export declare const OTPValidation: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
|
+
otp: 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
|
+
otp: 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
|
+
otp: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
8
|
+
}>>>;
|
|
@@ -4,14 +4,16 @@ import { connectExpressSelector, verifyNafathAsync } from '../../../app/connectE
|
|
|
4
4
|
import NafathVerification from '../../../shared/NafathVerification';
|
|
5
5
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
6
6
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
7
|
+
import GenericPrepareDataLoading from '../GenericPrepareDataLoading';
|
|
7
8
|
var VerifyNafath = function () {
|
|
8
9
|
var _a = React.useState(false), success = _a[0], setSuccess = _a[1];
|
|
9
10
|
var _b = React.useState(false), failed = _b[0], setFailed = _b[1];
|
|
10
11
|
var _c = React.useState(false), isReady = _c[0], setIsReady = _c[1];
|
|
12
|
+
var _d = React.useState(false), showLoadingScreen = _d[0], setShowLoadingScreen = _d[1];
|
|
11
13
|
var dispatch = useAppDispatch();
|
|
12
14
|
var data = useAppSelector(connectExpressSelector).data;
|
|
13
15
|
var authData = (data.responseData || {}).authData;
|
|
14
|
-
var
|
|
16
|
+
var _e = authData || {}, expiry = _e.expiry, app_url_android = _e.app_url_android, app_url_ios = _e.app_url_ios, random = _e.random;
|
|
15
17
|
React.useEffect(function () {
|
|
16
18
|
if (authData && !isReady) {
|
|
17
19
|
setIsReady(true);
|
|
@@ -20,7 +22,11 @@ var VerifyNafath = function () {
|
|
|
20
22
|
React.useEffect(function () {
|
|
21
23
|
if (!isReady)
|
|
22
24
|
return;
|
|
23
|
-
var promise = dispatch(verifyNafathAsync({
|
|
25
|
+
var promise = dispatch(verifyNafathAsync({
|
|
26
|
+
onSuccess: function () { return setSuccess(true); },
|
|
27
|
+
onFailure: function () { return setFailed(true); },
|
|
28
|
+
showLoadingScreenAfterNafathSuccess: function () { return setShowLoadingScreen(true); }
|
|
29
|
+
}));
|
|
24
30
|
return function () {
|
|
25
31
|
promise === null || promise === void 0 ? void 0 : promise.abort();
|
|
26
32
|
};
|
|
@@ -30,6 +36,6 @@ var VerifyNafath = function () {
|
|
|
30
36
|
}, []);
|
|
31
37
|
if (!isReady)
|
|
32
38
|
return null;
|
|
33
|
-
return (_jsx(NafathVerification, { randomNumber: random, expiryInSeconds: expiry, success: success, failed: failed, urls: { android: app_url_android, ios: app_url_ios }, onFinish: function () { return onBack(); } }));
|
|
39
|
+
return showLoadingScreen ? (_jsx(GenericPrepareDataLoading, {})) : (_jsx(NafathVerification, { randomNumber: random, expiryInSeconds: expiry, success: success, failed: failed, urls: { android: app_url_android, ios: app_url_ios }, onFinish: function () { return onBack(); } }));
|
|
34
40
|
};
|
|
35
41
|
export default React.memo(VerifyNafath);
|
|
@@ -27,9 +27,9 @@ import ConnectExpressIdentityVerifyNafathScreen from './connectExpress/screens/I
|
|
|
27
27
|
import ConnectExpressCollectIndividualScreen from './connectExpress/screens/CollectIndividualInfo';
|
|
28
28
|
import ConnectExpressCollectDobScreen from './connectExpress/screens/DOB';
|
|
29
29
|
import ConnectExpressCollectBusinessScreen from './connectExpress/screens/CollectBusinessInfo';
|
|
30
|
+
import ConnectExpressVerifyAuthMobileOtpScreen from './connectExpress/screens/VerifyMobileAuthOTP';
|
|
30
31
|
import ConnectExpressCreateAccountLoaderScreen from './connectExpress/screens/CreateAccountLoader';
|
|
31
32
|
import ConnectExpressPreparingDataLoaderScreen from './connectExpress/screens/PrepareDataLoading';
|
|
32
|
-
import ConnectExpressGenericPreparingDataLoaderScreen from './connectExpress/screens/GenericPrepareDataLoading';
|
|
33
33
|
import ConnectExpressSuccessFlowButtonsScreen from './connectExpress/screens/SuccessWithFlowButtons';
|
|
34
34
|
import ConnectExpressAccountAlreadyCreatedScreen from './connectExpress/screens/AccountAlreadyCreated';
|
|
35
35
|
import ConnectExpressAuthenticationListScreen from './connectExpress/screens/AuthenticationList';
|
|
@@ -263,6 +263,10 @@ export var connectExpressFeatureScreens = [
|
|
|
263
263
|
name: 'CONNECT_EXPRESS_COLLECT_BUSINESS_INFO_STEP',
|
|
264
264
|
element: ConnectExpressCollectBusinessScreen
|
|
265
265
|
},
|
|
266
|
+
{
|
|
267
|
+
name: 'CONNECT_EXPRESS_VERIFY_AUTH_OTP_STEP',
|
|
268
|
+
element: ConnectExpressVerifyAuthMobileOtpScreen
|
|
269
|
+
},
|
|
266
270
|
{
|
|
267
271
|
name: 'CONNECT_EXPRESS_ACCOUNT_ALREADY_CREATED_STEP',
|
|
268
272
|
element: ConnectExpressAccountAlreadyCreatedScreen
|
|
@@ -290,10 +294,6 @@ export var connectExpressFeatureScreens = [
|
|
|
290
294
|
{
|
|
291
295
|
name: 'COLLECT_MOBILE_OWNERSHIP',
|
|
292
296
|
element: ConnectExpressCollectMobileOwnership
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
name: 'CONNECT_EXPRESS_GENERIC_PREPARING_DATA_STEP',
|
|
296
|
-
element: ConnectExpressGenericPreparingDataLoaderScreen
|
|
297
297
|
}
|
|
298
298
|
];
|
|
299
299
|
export var authFeatureScreens = [
|
package/build/utils/common.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { axiosInstance } from '../api';
|
|
2
|
-
import { ENDPOINT_PATHS,
|
|
2
|
+
import { ENDPOINT_PATHS, CONNECT_DEV_URL, CONNECT_PROD_URL } from '../constants';
|
|
3
3
|
import { objectHasValues } from './object';
|
|
4
4
|
import { isSA } from './string';
|
|
5
5
|
export var sleep = function (milliseconds) {
|
|
@@ -19,7 +19,7 @@ export var setBaseUrl = function (publicKey, countryCode) {
|
|
|
19
19
|
axiosInstance.defaults.baseURL = isSA(countryCode) ? ENDPOINT_PATHS.PRODUCTION_BASE_URL_SA : ENDPOINT_PATHS.PRODUCTION_BASE_URL;
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
axiosInstance.defaults.baseURL = ENDPOINT_PATHS.
|
|
22
|
+
axiosInstance.defaults.baseURL = ENDPOINT_PATHS.DEV_BASE_URL;
|
|
23
23
|
};
|
|
24
24
|
export var updateLocationUrlWithCountry = function (countryIso2) {
|
|
25
25
|
var country = countryIso2.toLowerCase();
|
|
@@ -38,7 +38,7 @@ export var updateLocationUrlWithCountry = function (countryIso2) {
|
|
|
38
38
|
window.history.replaceState({}, '', newUrl);
|
|
39
39
|
};
|
|
40
40
|
export var openConnect = function (pk, countryCode) {
|
|
41
|
-
var newUrl = new URL(pk.includes('pk_live') ? CONNECT_PROD_URL :
|
|
41
|
+
var newUrl = new URL(pk.includes('pk_live') ? CONNECT_PROD_URL : CONNECT_DEV_URL);
|
|
42
42
|
if (countryCode) {
|
|
43
43
|
newUrl.pathname = "/".concat(countryCode.toLowerCase());
|
|
44
44
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tap-payments/auth-jsconnect",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.40-development",
|
|
4
4
|
"description": "connect library, auth",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "build/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"copy:files": "copyfiles -u 1 src/**/*.css build/",
|
|
22
22
|
"tsc:alias": "tsc-alias -p tsconfig.json",
|
|
23
23
|
"ts:build": "rm -rf build && tsc -p tsconfig.json && tsc-alias -p tsconfig.json && yarn copy:files",
|
|
24
|
-
"push": "npm publish --access public --tag
|
|
24
|
+
"push": "npm publish --access public --tag development"
|
|
25
25
|
},
|
|
26
26
|
"keywords": [],
|
|
27
27
|
"author": {
|