@tap-payments/auth-jsconnect 2.9.37-development → 2.9.37-sandbox
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/@types/app.d.ts +0 -5
- package/build/@types/app.js +0 -6
- package/build/components/Tooltip/Tooltip.js +1 -1
- package/build/constants/app.d.ts +1 -1
- package/build/constants/app.js +9 -26
- package/build/features/app/connectExpress/connectExpressStore.d.ts +2 -9
- package/build/features/app/connectExpress/connectExpressStore.js +11 -103
- package/build/features/featuresScreens.js +0 -5
- package/build/features/shared/Button/FlowsButtons.js +2 -1
- package/build/utils/common.js +3 -3
- package/package.json +2 -2
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/OTPInput.d.ts +0 -5
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/OTPInput.js +0 -58
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/VerifyMobileAuthOTP.d.ts +0 -5
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/VerifyMobileAuthOTP.js +0 -88
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/index.d.ts +0 -3
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/index.js +0 -2
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/validation.d.ts +0 -8
- package/build/features/connectExpress/screens/VerifyMobileAuthOTP/validation.js +0 -4
package/build/@types/app.d.ts
CHANGED
|
@@ -351,11 +351,6 @@ 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
|
-
}
|
|
359
354
|
export declare enum AuthTypeNumber {
|
|
360
355
|
EMAIL_OTP = 5,
|
|
361
356
|
MOBILE_OTP = 2,
|
package/build/@types/app.js
CHANGED
|
@@ -43,12 +43,6 @@ 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 = {}));
|
|
52
46
|
export var AuthTypeNumber;
|
|
53
47
|
(function (AuthTypeNumber) {
|
|
54
48
|
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)), zIndex: 2147483647 }),
|
|
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,5 +1,6 @@
|
|
|
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";
|
|
3
4
|
export declare const CONNECT_PROD_URL = "https://connect.tap.company";
|
|
4
5
|
export declare const CLIENT_ORIGIN: string;
|
|
5
6
|
export declare const TAP_WEBSITE = "https://www.tap.company/";
|
|
@@ -137,7 +138,6 @@ export declare const CONNECT_EXPRESS_STEP_NAMES: {
|
|
|
137
138
|
CONNECT_EXPRESS_SUCCESS: string;
|
|
138
139
|
COLLECT_MOBILE_OWNERSHIP: string;
|
|
139
140
|
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,6 +1,7 @@
|
|
|
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';
|
|
4
5
|
export var CONNECT_PROD_URL = 'https://connect.tap.company';
|
|
5
6
|
export var CLIENT_ORIGIN = window.location.origin;
|
|
6
7
|
export var TAP_WEBSITE = 'https://www.tap.company/';
|
|
@@ -228,11 +229,7 @@ export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
|
|
|
228
229
|
},
|
|
229
230
|
{
|
|
230
231
|
name: 'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP',
|
|
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
|
-
],
|
|
232
|
+
next: ['CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP', 'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP'],
|
|
236
233
|
prev: ['CONNECT_EXPRESS_NID_STEP', 'CONNECT_EXPRESS_NID_MISSED_STEP'],
|
|
237
234
|
order: 5
|
|
238
235
|
},
|
|
@@ -245,8 +242,7 @@ export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
|
|
|
245
242
|
'CONNECT_EXPRESS_CIVIL_ID_STEP',
|
|
246
243
|
'CONNECT_EXPRESS_CIVIL_ID_MISSED_STEP',
|
|
247
244
|
'CONNECT_EXPRESS_NID_MISSED_STEP',
|
|
248
|
-
'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP'
|
|
249
|
-
'CONNECT_EXPRESS_VERIFY_AUTH_OTP_STEP'
|
|
245
|
+
'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP'
|
|
250
246
|
],
|
|
251
247
|
order: 5
|
|
252
248
|
},
|
|
@@ -256,8 +252,7 @@ export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
|
|
|
256
252
|
'CONNECT_EXPRESS_COLLECT_BUSINESS_INFO_STEP',
|
|
257
253
|
'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP',
|
|
258
254
|
'CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP',
|
|
259
|
-
'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP'
|
|
260
|
-
'CONNECT_EXPRESS_VERIFY_AUTH_OTP_STEP'
|
|
255
|
+
'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP'
|
|
261
256
|
],
|
|
262
257
|
prev: ['CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP', 'CONNECT_EXPRESS_NID_MISSED_STEP'],
|
|
263
258
|
order: 6
|
|
@@ -268,40 +263,29 @@ export var CONNECT_EXPRESS_SCREENS_NAVIGATION = [
|
|
|
268
263
|
prev: 'CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP',
|
|
269
264
|
order: 6
|
|
270
265
|
},
|
|
271
|
-
{
|
|
272
|
-
name: 'CONNECT_EXPRESS_VERIFY_AUTH_OTP_STEP',
|
|
273
|
-
next: [
|
|
274
|
-
'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP',
|
|
275
|
-
'COLLECT_MOBILE_OWNERSHIP',
|
|
276
|
-
'CONNECT_EXPRESS_COLLECT_BUSINESS_INFO_STEP',
|
|
277
|
-
'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP'
|
|
278
|
-
],
|
|
279
|
-
prev: ['CONNECT_EXPRESS_COLLECT_INDIVIDUAL_INFO_STEP', 'CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP', 'COLLECT_MOBILE_OWNERSHIP'],
|
|
280
|
-
order: 7
|
|
281
|
-
},
|
|
282
266
|
{
|
|
283
267
|
name: 'CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP',
|
|
284
268
|
next: 'CONNECT_EXPRESS_PREPARING_DATA_STEP',
|
|
285
269
|
prev: '',
|
|
286
|
-
order:
|
|
270
|
+
order: 7
|
|
287
271
|
},
|
|
288
272
|
{
|
|
289
273
|
name: 'CONNECT_EXPRESS_PREPARING_DATA_STEP',
|
|
290
274
|
next: 'CONNECT_EXPRESS_SUCCESS_WITH_FLOW_BUTTONS_STEP',
|
|
291
275
|
prev: '',
|
|
292
|
-
order:
|
|
276
|
+
order: 8
|
|
293
277
|
},
|
|
294
278
|
{
|
|
295
279
|
name: 'CONNECT_EXPRESS_ACCOUNT_ALREADY_CREATED_STEP',
|
|
296
280
|
next: '',
|
|
297
281
|
prev: '',
|
|
298
|
-
order:
|
|
282
|
+
order: 9
|
|
299
283
|
},
|
|
300
284
|
{
|
|
301
285
|
name: 'CONNECT_EXPRESS_SUCCESS_WITH_FLOW_BUTTONS_STEP',
|
|
302
286
|
next: '',
|
|
303
287
|
prev: '',
|
|
304
|
-
order:
|
|
288
|
+
order: 9
|
|
305
289
|
}
|
|
306
290
|
];
|
|
307
291
|
export var AUTH_SCREENS_NAVIGATION = [
|
|
@@ -1055,8 +1039,7 @@ export var CONNECT_EXPRESS_STEP_NAMES = {
|
|
|
1055
1039
|
VERIFY_AUTH_PASSWORD: 'connect_express_verify_auth_password',
|
|
1056
1040
|
CONNECT_EXPRESS_SUCCESS: 'connect_express_completed',
|
|
1057
1041
|
COLLECT_MOBILE_OWNERSHIP: 'collect_owner_phone',
|
|
1058
|
-
COLLECT_MOBILE_OWNERSHIP_SKIPPED: 'collect_owner_phone_skipped'
|
|
1059
|
-
VERIFY_AUTH_MOBILE_OTP: 'connect_express_auth_mobile'
|
|
1042
|
+
COLLECT_MOBILE_OWNERSHIP_SKIPPED: 'collect_owner_phone_skipped'
|
|
1060
1043
|
};
|
|
1061
1044
|
export var SignIn_STEP_NAMES = {
|
|
1062
1045
|
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
|
|
2
|
+
import { MobileFormValues, NIDFormValues, CivilFormValues, OTPFormValues, IndividualFormValues, SharedState, FlowsTypes, ActionState, CountryCode, AuthForType, BusinessDataFormValues, AsyncThunkParams, AuthenticationListFormValues, AuthMerchantFormValues, DOBFormValues, MobileOwnershipFormValues } 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<{
|
|
@@ -133,9 +133,6 @@ export declare const updateLeadMobile: import("@reduxjs/toolkit").AsyncThunk<{
|
|
|
133
133
|
export declare const skipUpdateLeadMobile: import("@reduxjs/toolkit").AsyncThunk<{
|
|
134
134
|
leadResponse: any;
|
|
135
135
|
}, void, {}>;
|
|
136
|
-
export declare const verifyAuthMobileOtpAsync: import("@reduxjs/toolkit").AsyncThunk<{
|
|
137
|
-
data: any;
|
|
138
|
-
}, OTPFormValues, {}>;
|
|
139
136
|
export declare const confirmInfo: import("@reduxjs/toolkit").AsyncThunk<{
|
|
140
137
|
boardInfo: any;
|
|
141
138
|
boardData: any;
|
|
@@ -159,9 +156,6 @@ export interface ConnectExpressData {
|
|
|
159
156
|
individualData: IndividualFormValues & {
|
|
160
157
|
isPrevDob?: boolean;
|
|
161
158
|
};
|
|
162
|
-
verifyAuthOtpData: OTPFormValues & {
|
|
163
|
-
authFor: AuthForScreen;
|
|
164
|
-
};
|
|
165
159
|
businessData: BusinessDataFormValues;
|
|
166
160
|
authenticationData: AuthenticationListFormValues;
|
|
167
161
|
authMerchantData: AuthMerchantFormValues;
|
|
@@ -183,11 +177,10 @@ export declare const connectSlice: import("@reduxjs/toolkit").Slice<ConnectExpre
|
|
|
183
177
|
resetCivilScreen: (state: ConnectExpressState) => void;
|
|
184
178
|
resetAuthenticationScreen: (state: ConnectExpressState) => void;
|
|
185
179
|
resetOTPValue: (state: ConnectExpressState) => void;
|
|
186
|
-
resetVerifyAuthOTPValue: (state: ConnectExpressState) => void;
|
|
187
180
|
resetStore: (state: ConnectExpressState) => void;
|
|
188
181
|
resetIndividualScreen: (state: ConnectExpressState) => void;
|
|
189
182
|
}, "connectExpress/store">;
|
|
190
|
-
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>,
|
|
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>;
|
|
191
184
|
declare const _default: import("redux").Reducer<ConnectExpressState, import("redux").AnyAction>;
|
|
192
185
|
export default _default;
|
|
193
186
|
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
|
|
60
|
+
import { FlowsTypes, AuthForType, BusinessType, LicenseType } 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';
|
|
@@ -835,7 +835,7 @@ export var verifyPaciLeadIdentityAsync = createAsyncThunk('connectExpress/verify
|
|
|
835
835
|
case 9:
|
|
836
836
|
count++;
|
|
837
837
|
return [3, 1];
|
|
838
|
-
case 10: throw new Error('
|
|
838
|
+
case 10: throw new Error('nafath_verification_failed');
|
|
839
839
|
}
|
|
840
840
|
});
|
|
841
841
|
}); });
|
|
@@ -1029,7 +1029,7 @@ export var createEntity = createAsyncThunk('connectExpress/createEntity', functi
|
|
|
1029
1029
|
});
|
|
1030
1030
|
}); });
|
|
1031
1031
|
export var updateLeadDOBAsync = createAsyncThunk('connectExpress/updateLeadDOBAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1032
|
-
var _a, settings, connectExpress, id, dob, payload, data, needToCollectMoreInfo, creatingAccount
|
|
1032
|
+
var _a, settings, connectExpress, id, dob, payload, data, needToCollectMoreInfo, creatingAccount;
|
|
1033
1033
|
var _b, _c, _d;
|
|
1034
1034
|
return __generator(this, function (_e) {
|
|
1035
1035
|
switch (_e.label) {
|
|
@@ -1049,10 +1049,6 @@ export var updateLeadDOBAsync = createAsyncThunk('connectExpress/updateLeadDOBAs
|
|
|
1049
1049
|
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
|
|
1050
1050
|
needToCollectMoreInfo = data.step_name === 'collect_info';
|
|
1051
1051
|
creatingAccount = data.step_name === 'create_account';
|
|
1052
|
-
verifyAuthMobile = data.step_name === 'connect_express_auth_mobile';
|
|
1053
|
-
if (verifyAuthMobile) {
|
|
1054
|
-
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('CONNECT_EXPRESS_VERIFY_AUTH_OTP_STEP')); });
|
|
1055
|
-
}
|
|
1056
1052
|
if (creatingAccount) {
|
|
1057
1053
|
sleep(100).then(function () { return thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP')); });
|
|
1058
1054
|
}
|
|
@@ -1066,7 +1062,7 @@ export var updateLeadDOBAsync = createAsyncThunk('connectExpress/updateLeadDOBAs
|
|
|
1066
1062
|
export var updateLeadIndividualAsync = createAsyncThunk('connectExpress/updateLeadIndividualAsync', function (_a, thunkApi) {
|
|
1067
1063
|
var formData = _a.formData, originalFormData = _a.originalFormData;
|
|
1068
1064
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
1069
|
-
var _b, settings, connectExpress, id, countryCode, name, email, mobile, phoneCountry, isContactAvailable, payload, data, needToCollectMoreInfo, creatingAccount, collectPhoneOwnershipScreen,
|
|
1065
|
+
var _b, settings, connectExpress, id, countryCode, name, email, mobile, phoneCountry, isContactAvailable, payload, data, needToCollectMoreInfo, creatingAccount, collectPhoneOwnershipScreen, isSaudi;
|
|
1070
1066
|
var _c, _d, _e, _f, _g;
|
|
1071
1067
|
return __generator(this, function (_h) {
|
|
1072
1068
|
switch (_h.label) {
|
|
@@ -1086,10 +1082,6 @@ export var updateLeadIndividualAsync = createAsyncThunk('connectExpress/updateLe
|
|
|
1086
1082
|
needToCollectMoreInfo = data.step_name === 'collect_info';
|
|
1087
1083
|
creatingAccount = data.step_name === 'create_account';
|
|
1088
1084
|
collectPhoneOwnershipScreen = data.step_name === CONNECT_EXPRESS_STEP_NAMES.COLLECT_MOBILE_OWNERSHIP;
|
|
1089
|
-
verifyAuthMobile = data.step_name === CONNECT_EXPRESS_STEP_NAMES.VERIFY_AUTH_MOBILE_OTP;
|
|
1090
|
-
if (verifyAuthMobile) {
|
|
1091
|
-
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('CONNECT_EXPRESS_VERIFY_AUTH_OTP_STEP')); });
|
|
1092
|
-
}
|
|
1093
1085
|
if (collectPhoneOwnershipScreen) {
|
|
1094
1086
|
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('COLLECT_MOBILE_OWNERSHIP')); });
|
|
1095
1087
|
}
|
|
@@ -1153,7 +1145,7 @@ export var updateLeadBusinessDataAsync = createAsyncThunk('updateLeadBusinessDat
|
|
|
1153
1145
|
});
|
|
1154
1146
|
});
|
|
1155
1147
|
export var updateLeadMobile = createAsyncThunk('connectExpress/updateLeadMobile', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1156
|
-
var _a, settings, connectExpress, id, startWithNID, payload, leadResponse, needToCollectMoreInfo, creatingAccount, askDobInfo, collectPhoneOwnershipScreen
|
|
1148
|
+
var _a, settings, connectExpress, id, startWithNID, payload, leadResponse, needToCollectMoreInfo, creatingAccount, askDobInfo, collectPhoneOwnershipScreen;
|
|
1157
1149
|
var _b, _c, _d;
|
|
1158
1150
|
return __generator(this, function (_e) {
|
|
1159
1151
|
switch (_e.label) {
|
|
@@ -1180,13 +1172,9 @@ export var updateLeadMobile = createAsyncThunk('connectExpress/updateLeadMobile'
|
|
|
1180
1172
|
creatingAccount = leadResponse.step_name === 'create_account';
|
|
1181
1173
|
askDobInfo = leadResponse.step_name === COLLECT_DOB_INFO_NAFATH;
|
|
1182
1174
|
collectPhoneOwnershipScreen = leadResponse.step_name === CONNECT_EXPRESS_STEP_NAMES.COLLECT_MOBILE_OWNERSHIP;
|
|
1183
|
-
verifyAuthMobile = leadResponse.step_name === CONNECT_EXPRESS_STEP_NAMES.VERIFY_AUTH_MOBILE_OTP;
|
|
1184
1175
|
if (collectPhoneOwnershipScreen) {
|
|
1185
1176
|
throw new Error("The new mobile number doesn't match the national ID, please update the mobile to the correct one");
|
|
1186
1177
|
}
|
|
1187
|
-
if (verifyAuthMobile) {
|
|
1188
|
-
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('CONNECT_EXPRESS_VERIFY_AUTH_OTP_STEP')); });
|
|
1189
|
-
}
|
|
1190
1178
|
if (askDobInfo) {
|
|
1191
1179
|
sleep(100).then(function () { return thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP')); });
|
|
1192
1180
|
}
|
|
@@ -1211,7 +1199,7 @@ export var updateLeadMobile = createAsyncThunk('connectExpress/updateLeadMobile'
|
|
|
1211
1199
|
});
|
|
1212
1200
|
}); });
|
|
1213
1201
|
export var skipUpdateLeadMobile = createAsyncThunk('connectExpress/skipUpdateLeadMobile', function (_, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1214
|
-
var _a, settings, connectExpress, id, startWithNID, payload, leadResponse, needToCollectMoreInfo, creatingAccount, askDobInfo
|
|
1202
|
+
var _a, settings, connectExpress, id, startWithNID, payload, leadResponse, needToCollectMoreInfo, creatingAccount, askDobInfo;
|
|
1215
1203
|
var _b, _c, _d;
|
|
1216
1204
|
return __generator(this, function (_e) {
|
|
1217
1205
|
switch (_e.label) {
|
|
@@ -1231,10 +1219,6 @@ export var skipUpdateLeadMobile = createAsyncThunk('connectExpress/skipUpdateLea
|
|
|
1231
1219
|
needToCollectMoreInfo = leadResponse.step_name === 'collect_info';
|
|
1232
1220
|
creatingAccount = leadResponse.step_name === 'create_account';
|
|
1233
1221
|
askDobInfo = leadResponse.step_name === COLLECT_DOB_INFO_NAFATH;
|
|
1234
|
-
verifyAuthMobile = leadResponse.step_name === CONNECT_EXPRESS_STEP_NAMES.VERIFY_AUTH_MOBILE_OTP;
|
|
1235
|
-
if (verifyAuthMobile) {
|
|
1236
|
-
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('CONNECT_EXPRESS_VERIFY_AUTH_OTP_STEP')); });
|
|
1237
|
-
}
|
|
1238
1222
|
if (askDobInfo) {
|
|
1239
1223
|
sleep(100).then(function () { return thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP')); });
|
|
1240
1224
|
}
|
|
@@ -1258,57 +1242,6 @@ export var skipUpdateLeadMobile = createAsyncThunk('connectExpress/skipUpdateLea
|
|
|
1258
1242
|
}
|
|
1259
1243
|
});
|
|
1260
1244
|
}); });
|
|
1261
|
-
export var verifyAuthMobileOtpAsync = createAsyncThunk('connectExpress/verifyAuthMobileOtpAsync', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1262
|
-
var _a, settings, connectExpress, responseData, _b, verify_token, verification_by, payload, data, needToCollectMoreInfo, creatingAccount, askDobInfo, collectPhoneOwnershipScreen, isSaudi;
|
|
1263
|
-
var _c, _d;
|
|
1264
|
-
return __generator(this, function (_e) {
|
|
1265
|
-
switch (_e.label) {
|
|
1266
|
-
case 0:
|
|
1267
|
-
_a = thunkApi.getState(), settings = _a.settings, connectExpress = _a.connectExpress;
|
|
1268
|
-
responseData = (connectExpress.data || {}).responseData;
|
|
1269
|
-
if (!(responseData === null || responseData === void 0 ? void 0 : responseData.verifyAuthMobile))
|
|
1270
|
-
throw new Error('Auth data is missing');
|
|
1271
|
-
_b = responseData.verifyAuthMobile, verify_token = _b.verify_token, verification_by = _b.verification_by;
|
|
1272
|
-
payload = {
|
|
1273
|
-
verify_token: verify_token,
|
|
1274
|
-
data: params.otp,
|
|
1275
|
-
auth_type: 2,
|
|
1276
|
-
service_name: verification_by === null || verification_by === void 0 ? void 0 : verification_by.service_name,
|
|
1277
|
-
sign_in: false,
|
|
1278
|
-
step_name: CONNECT_EXPRESS_STEP_NAMES.VERIFY_AUTH_MOBILE_OTP,
|
|
1279
|
-
encryption_contract: ['data']
|
|
1280
|
-
};
|
|
1281
|
-
return [4, API.authService.verifyExpressLeadIdentity(payload)];
|
|
1282
|
-
case 1:
|
|
1283
|
-
data = _e.sent();
|
|
1284
|
-
(_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, params);
|
|
1285
|
-
needToCollectMoreInfo = data.step_name === 'collect_info';
|
|
1286
|
-
creatingAccount = data.step_name === 'create_account';
|
|
1287
|
-
askDobInfo = data.step_name === COLLECT_DOB_INFO_NAFATH;
|
|
1288
|
-
collectPhoneOwnershipScreen = data.step_name === CONNECT_EXPRESS_STEP_NAMES.COLLECT_MOBILE_OWNERSHIP;
|
|
1289
|
-
if (askDobInfo) {
|
|
1290
|
-
sleep(100).then(function () { return thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_COLLECT_DOB_INFO_STEP')); });
|
|
1291
|
-
}
|
|
1292
|
-
if (creatingAccount) {
|
|
1293
|
-
sleep(100).then(function () { return thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_WAITING_FOR_CREATING_ACCOUNT_STEP')); });
|
|
1294
|
-
}
|
|
1295
|
-
if (collectPhoneOwnershipScreen) {
|
|
1296
|
-
sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('COLLECT_MOBILE_OWNERSHIP')); });
|
|
1297
|
-
}
|
|
1298
|
-
if (!needToCollectMoreInfo) return [3, 4];
|
|
1299
|
-
isSaudi = isSA(settings.data.businessCountry.iso2);
|
|
1300
|
-
if (!isSaudi) return [3, 3];
|
|
1301
|
-
return [4, thunkApi.dispatch(retrieveEntityListAsync(data.lead.id)).unwrap()];
|
|
1302
|
-
case 2:
|
|
1303
|
-
_e.sent();
|
|
1304
|
-
_e.label = 3;
|
|
1305
|
-
case 3:
|
|
1306
|
-
sleep(100).then(function () { return thunkApi.dispatch(handleCurrentActiveScreen('CONNECT_EXPRESS_COLLECT_BUSINESS_INFO_STEP')); });
|
|
1307
|
-
_e.label = 4;
|
|
1308
|
-
case 4: return [2, { data: data }];
|
|
1309
|
-
}
|
|
1310
|
-
});
|
|
1311
|
-
}); });
|
|
1312
1245
|
export var confirmInfo = createAsyncThunk('connectExpress/confirmInfo', function (_a, thunkApi) {
|
|
1313
1246
|
var brandInfo = _a.brandInfo, entityInfo = _a.entityInfo, merchantInfo = _a.merchantInfo;
|
|
1314
1247
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -1433,10 +1366,6 @@ var initialState = {
|
|
|
1433
1366
|
mobile: '',
|
|
1434
1367
|
countryCode: defaultCountry
|
|
1435
1368
|
},
|
|
1436
|
-
verifyAuthOtpData: {
|
|
1437
|
-
otp: '',
|
|
1438
|
-
authFor: AuthForScreen.INDIVIDUAL
|
|
1439
|
-
},
|
|
1440
1369
|
businessData: {
|
|
1441
1370
|
brandName: '',
|
|
1442
1371
|
licenseNumber: '',
|
|
@@ -1492,9 +1421,6 @@ export var connectSlice = createSlice({
|
|
|
1492
1421
|
resetOTPValue: function (state) {
|
|
1493
1422
|
state.data.otpData.otp = '';
|
|
1494
1423
|
},
|
|
1495
|
-
resetVerifyAuthOTPValue: function (state) {
|
|
1496
|
-
state.data.verifyAuthOtpData.otp = '';
|
|
1497
|
-
},
|
|
1498
1424
|
resetStore: function (state) {
|
|
1499
1425
|
var _a;
|
|
1500
1426
|
state.data = __assign(__assign({}, state.data), { responseData: { leadData: (_a = state.data.responseData) === null || _a === void 0 ? void 0 : _a.leadData } });
|
|
@@ -1828,8 +1754,7 @@ export var connectSlice = createSlice({
|
|
|
1828
1754
|
state.loading = false;
|
|
1829
1755
|
state.error = null;
|
|
1830
1756
|
state.data.dobData = action.payload.formData;
|
|
1831
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { dobData: action.payload.response
|
|
1832
|
-
state.data.verifyAuthOtpData.authFor = AuthForScreen.DOB;
|
|
1757
|
+
state.data.responseData = __assign(__assign({}, state.data.responseData), { dobData: action.payload.response });
|
|
1833
1758
|
})
|
|
1834
1759
|
.addCase(updateLeadDOBAsync.pending, function (state) {
|
|
1835
1760
|
state.loading = true;
|
|
@@ -1845,8 +1770,7 @@ export var connectSlice = createSlice({
|
|
|
1845
1770
|
state.error = null;
|
|
1846
1771
|
var licenseList = [OTHER_CR_LICENSE, OTHER_FL_LICENSE];
|
|
1847
1772
|
state.data.individualData = action.payload.formData;
|
|
1848
|
-
state.data.responseData = __assign(__assign(__assign(
|
|
1849
|
-
state.data.verifyAuthOtpData.authFor = AuthForScreen.INDIVIDUAL;
|
|
1773
|
+
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 }));
|
|
1850
1774
|
})
|
|
1851
1775
|
.addCase(updateLeadIndividualAsync.pending, function (state) {
|
|
1852
1776
|
state.loading = true;
|
|
@@ -1874,8 +1798,7 @@ export var connectSlice = createSlice({
|
|
|
1874
1798
|
state.loading = false;
|
|
1875
1799
|
state.error = null;
|
|
1876
1800
|
state.data.individualData.mobile = action.payload.formData.mobile;
|
|
1877
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { individualData: action.payload.leadResponse
|
|
1878
|
-
state.data.verifyAuthOtpData.authFor = AuthForScreen.MOBILE_OWNERSHIP;
|
|
1801
|
+
state.data.responseData = __assign(__assign({}, state.data.responseData), { individualData: action.payload.leadResponse });
|
|
1879
1802
|
})
|
|
1880
1803
|
.addCase(updateLeadMobile.pending, function (state) {
|
|
1881
1804
|
state.loading = true;
|
|
@@ -1888,8 +1811,7 @@ export var connectSlice = createSlice({
|
|
|
1888
1811
|
.addCase(skipUpdateLeadMobile.fulfilled, function (state, action) {
|
|
1889
1812
|
state.loading = false;
|
|
1890
1813
|
state.error = null;
|
|
1891
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { individualData: action.payload.leadResponse
|
|
1892
|
-
state.data.verifyAuthOtpData.authFor = AuthForScreen.MOBILE_OWNERSHIP;
|
|
1814
|
+
state.data.responseData = __assign(__assign({}, state.data.responseData), { individualData: action.payload.leadResponse });
|
|
1893
1815
|
})
|
|
1894
1816
|
.addCase(skipUpdateLeadMobile.pending, function (state) {
|
|
1895
1817
|
state.loading = true;
|
|
@@ -1898,20 +1820,6 @@ export var connectSlice = createSlice({
|
|
|
1898
1820
|
.addCase(skipUpdateLeadMobile.rejected, function (state, action) {
|
|
1899
1821
|
state.loading = false;
|
|
1900
1822
|
state.error = action.error.message;
|
|
1901
|
-
})
|
|
1902
|
-
.addCase(verifyAuthMobileOtpAsync.fulfilled, function (state, action) {
|
|
1903
|
-
state.loading = false;
|
|
1904
|
-
state.error = null;
|
|
1905
|
-
state.data.responseData = __assign(__assign({}, state.data.responseData), { verifyAuthMobileOtp: action.payload.data });
|
|
1906
|
-
state.data.verifyAuthOtpData.authFor = AuthForScreen.MOBILE_OWNERSHIP;
|
|
1907
|
-
})
|
|
1908
|
-
.addCase(verifyAuthMobileOtpAsync.pending, function (state) {
|
|
1909
|
-
state.loading = true;
|
|
1910
|
-
state.error = null;
|
|
1911
|
-
})
|
|
1912
|
-
.addCase(verifyAuthMobileOtpAsync.rejected, function (state, action) {
|
|
1913
|
-
state.loading = false;
|
|
1914
|
-
state.error = action.error.message;
|
|
1915
1823
|
})
|
|
1916
1824
|
.addCase(createAccountAsync.pending, function (state) {
|
|
1917
1825
|
state.loading = true;
|
|
@@ -2020,6 +1928,6 @@ export var connectSlice = createSlice({
|
|
|
2020
1928
|
});
|
|
2021
1929
|
}
|
|
2022
1930
|
});
|
|
2023
|
-
export var clearError = (_a = connectSlice.actions, _a.clearError), stopLoader = _a.stopLoader, setIsLeadIdPassed = _a.setIsLeadIdPassed, resetMobileScreen = _a.resetMobileScreen, resetOTPValue = _a.resetOTPValue,
|
|
1931
|
+
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;
|
|
2024
1932
|
export default connectSlice.reducer;
|
|
2025
1933
|
export var connectExpressSelector = function (state) { return state.connectExpress; };
|
|
@@ -27,7 +27,6 @@ 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';
|
|
31
30
|
import ConnectExpressCreateAccountLoaderScreen from './connectExpress/screens/CreateAccountLoader';
|
|
32
31
|
import ConnectExpressPreparingDataLoaderScreen from './connectExpress/screens/PrepareDataLoading';
|
|
33
32
|
import ConnectExpressSuccessFlowButtonsScreen from './connectExpress/screens/SuccessWithFlowButtons';
|
|
@@ -263,10 +262,6 @@ export var connectExpressFeatureScreens = [
|
|
|
263
262
|
name: 'CONNECT_EXPRESS_COLLECT_BUSINESS_INFO_STEP',
|
|
264
263
|
element: ConnectExpressCollectBusinessScreen
|
|
265
264
|
},
|
|
266
|
-
{
|
|
267
|
-
name: 'CONNECT_EXPRESS_VERIFY_AUTH_OTP_STEP',
|
|
268
|
-
element: ConnectExpressVerifyAuthMobileOtpScreen
|
|
269
|
-
},
|
|
270
265
|
{
|
|
271
266
|
name: 'CONNECT_EXPRESS_ACCOUNT_ALREADY_CREATED_STEP',
|
|
272
267
|
element: ConnectExpressAccountAlreadyCreatedScreen
|
|
@@ -163,6 +163,7 @@ export default function FlowsButtons(_a) {
|
|
|
163
163
|
var isAr = useLanguage().isAr;
|
|
164
164
|
var t = useTranslation().t;
|
|
165
165
|
var onRedirect = function (item) {
|
|
166
|
+
var _a;
|
|
166
167
|
if (!item.href)
|
|
167
168
|
return;
|
|
168
169
|
var name = item.name === FlowsTypes.BANK ? 'Wallet' : capitalize(item.name);
|
|
@@ -180,7 +181,7 @@ export default function FlowsButtons(_a) {
|
|
|
180
181
|
return;
|
|
181
182
|
}
|
|
182
183
|
if (typeof settingsData.appConfig.onBoardButtonClick === 'function') {
|
|
183
|
-
settingsData.appConfig.onBoardButtonClick({ name: item.name, token: item.token });
|
|
184
|
+
settingsData.appConfig.onBoardButtonClick({ name: item.name, token: item.token, countryCode: (_a = settingsData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2 });
|
|
184
185
|
return;
|
|
185
186
|
}
|
|
186
187
|
dispatch(handleOpen(false));
|
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_SANDBOX_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.SANDBOX_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_SANDBOX_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.37-
|
|
3
|
+
"version": "2.9.37-sandbox",
|
|
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 sandbox"
|
|
25
25
|
},
|
|
26
26
|
"keywords": [],
|
|
27
27
|
"author": {
|
|
@@ -1,58 +0,0 @@
|
|
|
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);
|
|
@@ -1,88 +0,0 @@
|
|
|
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);
|
|
@@ -1,8 +0,0 @@
|
|
|
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
|
-
}>>>;
|