@tap-payments/auth-jsconnect 2.0.57-test → 2.0.59-test
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/features/app/business/businessStore.d.ts +1 -0
- package/build/features/app/business/businessStore.js +3 -0
- package/build/features/app/connect/connectStore.d.ts +2 -1
- package/build/features/app/connect/connectStore.js +15 -11
- package/build/features/business/screens/CivilID/validation.js +1 -1
- package/build/features/business/screens/VerifyPACI/VerifyPACI.js +15 -19
- package/build/features/connect/screens/CivilID/CivilID.js +2 -1
- package/build/features/connect/screens/CivilID/validation.js +1 -1
- package/build/features/connect/screens/Individual/Individual.js +3 -2
- package/build/features/connect/screens/Mobile/Mobile.js +3 -1
- package/build/features/connect/screens/NID/NID.js +2 -1
- package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +11 -17
- package/package.json +129 -129
|
@@ -84,6 +84,7 @@ export interface BusinessData {
|
|
|
84
84
|
nidData: NIDFormValues & ResponseData & {
|
|
85
85
|
type: string;
|
|
86
86
|
};
|
|
87
|
+
civilIdData: CivilFormValues & ResponseData;
|
|
87
88
|
businessTypeData: BusinessTypeFormValues & ResponseData;
|
|
88
89
|
activitiesData: ActivitiesFormValues & ResponseData;
|
|
89
90
|
customersData: CustomersFormValues & ResponseData;
|
|
@@ -102,11 +102,12 @@ export declare const connectSlice: import("@reduxjs/toolkit").Slice<ConnectState
|
|
|
102
102
|
stopLoader: (state: ConnectState) => void;
|
|
103
103
|
resetMobileScreen: (state: ConnectState) => void;
|
|
104
104
|
resetNIDScreen: (state: ConnectState) => void;
|
|
105
|
+
resetCivilScreen: (state: ConnectState) => void;
|
|
105
106
|
resetOTPScreen: (state: ConnectState) => void;
|
|
106
107
|
resetIndividualScreen: (state: ConnectState) => void;
|
|
107
108
|
resetMerchantScreen: (state: ConnectState) => void;
|
|
108
109
|
}, "connect/store">;
|
|
109
|
-
export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetMobileScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetIndividualScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetMerchantScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetNIDScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
110
|
+
export declare const clearError: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, stopLoader: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetMobileScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetOTPScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetIndividualScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetMerchantScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetNIDScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetCivilScreen: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
|
|
110
111
|
declare const _default: import("redux").Reducer<ConnectState, import("redux").AnyAction>;
|
|
111
112
|
export default _default;
|
|
112
113
|
export declare const connectSelector: (state: RootState) => ConnectState;
|
|
@@ -274,21 +274,21 @@ export var verifyPACI = createAsyncThunk('verifyPACI', function (params, thunkAp
|
|
|
274
274
|
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
275
275
|
responseBody = connect.data.civilIdData.responseBody;
|
|
276
276
|
expiry = (responseBody === null || responseBody === void 0 ? void 0 : responseBody.expiry) || 120;
|
|
277
|
-
interval =
|
|
277
|
+
interval = 3;
|
|
278
278
|
maxCalls = Math.floor(expiry / interval);
|
|
279
279
|
response = null;
|
|
280
|
-
if (thunkApi.signal.aborted) {
|
|
281
|
-
return [2, { response: null }];
|
|
282
|
-
}
|
|
283
280
|
count = 1;
|
|
284
281
|
_f.label = 1;
|
|
285
282
|
case 1:
|
|
286
283
|
if (!(count <= maxCalls)) return [3, 7];
|
|
284
|
+
if (thunkApi.signal.aborted) {
|
|
285
|
+
return [3, 7];
|
|
286
|
+
}
|
|
287
287
|
return [4, API.authService.getVerifyAuth(responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_token)];
|
|
288
288
|
case 2:
|
|
289
289
|
data = _f.sent();
|
|
290
290
|
response = data;
|
|
291
|
-
if (count === 1) {
|
|
291
|
+
if (count === 1 && (responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) === false) {
|
|
292
292
|
thunkApi.dispatch(retrieveBrandList(data === null || data === void 0 ? void 0 : data.individual_id));
|
|
293
293
|
thunkApi.dispatch(retrieveChannels());
|
|
294
294
|
}
|
|
@@ -297,14 +297,14 @@ export var verifyPACI = createAsyncThunk('verifyPACI', function (params, thunkAp
|
|
|
297
297
|
return [4, ((_c = params === null || params === void 0 ? void 0 : params.onSuccess) === null || _c === void 0 ? void 0 : _c.call(params))];
|
|
298
298
|
case 3:
|
|
299
299
|
_f.sent();
|
|
300
|
-
if (responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) {
|
|
300
|
+
if ((responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user) && (data === null || data === void 0 ? void 0 : data.lead_id)) {
|
|
301
301
|
leadBody = {
|
|
302
302
|
leadId: data === null || data === void 0 ? void 0 : data.lead_id,
|
|
303
303
|
stepName: 'CONNECT_INDIVIDUAL_STEP'
|
|
304
304
|
};
|
|
305
305
|
thunkApi.dispatch(retrieveLead(leadBody));
|
|
306
306
|
}
|
|
307
|
-
else if (!(data === null || data === void 0 ? void 0 : data.lead_id)) {
|
|
307
|
+
else if (!(data === null || data === void 0 ? void 0 : data.lead_id) && (data === null || data === void 0 ? void 0 : data.individual_id)) {
|
|
308
308
|
leadBody = {
|
|
309
309
|
individualId: data === null || data === void 0 ? void 0 : data.individual_id,
|
|
310
310
|
stepName: 'CONNECT_MERCHANT_INFO_STEP'
|
|
@@ -390,20 +390,19 @@ export var retrieveChannels = createAsyncThunk('retrieveChannels', function () {
|
|
|
390
390
|
});
|
|
391
391
|
}); });
|
|
392
392
|
export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
393
|
-
var _a, settings, connect,
|
|
393
|
+
var _a, settings, connect, payload, data;
|
|
394
394
|
var _b, _c, _d, _e, _f, _g;
|
|
395
395
|
return __generator(this, function (_h) {
|
|
396
396
|
switch (_h.label) {
|
|
397
397
|
case 0:
|
|
398
398
|
_a = thunkApi.getState(), settings = _a.settings, connect = _a.connect;
|
|
399
|
-
isAbsher = connect.data.otpData.isAbsher;
|
|
400
399
|
payload = {
|
|
401
400
|
name: getIndividualName(params.name),
|
|
402
401
|
id: ((_b = connect.data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.lead_id) || '',
|
|
403
402
|
country_code: (_c = settings.data.businessCountry) === null || _c === void 0 ? void 0 : _c.iso2,
|
|
404
403
|
contact: {
|
|
405
404
|
email: params.email,
|
|
406
|
-
phone:
|
|
405
|
+
phone: !!params.mobile
|
|
407
406
|
? {
|
|
408
407
|
country_code: (_e = (_d = params.countryCode) === null || _d === void 0 ? void 0 : _d.idd_prefix) === null || _e === void 0 ? void 0 : _e.toString(),
|
|
409
408
|
number: params.mobile || ''
|
|
@@ -608,8 +607,13 @@ export var connectSlice = createSlice({
|
|
|
608
607
|
state.loading = false;
|
|
609
608
|
},
|
|
610
609
|
resetMobileScreen: function (state) {
|
|
610
|
+
state.data.mobileData = __assign(__assign({}, state.data.mobileData), initialState.data.mobileData);
|
|
611
611
|
},
|
|
612
612
|
resetNIDScreen: function (state) {
|
|
613
|
+
state.data.nidData = __assign(__assign({}, state.data.nidData), initialState.data.nidData);
|
|
614
|
+
},
|
|
615
|
+
resetCivilScreen: function (state) {
|
|
616
|
+
state.data.civilIdData = __assign(__assign({}, state.data.civilIdData), initialState.data.civilIdData);
|
|
613
617
|
},
|
|
614
618
|
resetOTPScreen: function (state) {
|
|
615
619
|
state.data.otpData.otp = '';
|
|
@@ -951,6 +955,6 @@ export var connectSlice = createSlice({
|
|
|
951
955
|
});
|
|
952
956
|
}
|
|
953
957
|
});
|
|
954
|
-
export var clearError = (_a = connectSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetMobileScreen = _a.resetMobileScreen, resetOTPScreen = _a.resetOTPScreen, resetIndividualScreen = _a.resetIndividualScreen, resetMerchantScreen = _a.resetMerchantScreen, resetNIDScreen = _a.resetNIDScreen;
|
|
958
|
+
export var clearError = (_a = connectSlice.actions, _a.clearError), stopLoader = _a.stopLoader, resetMobileScreen = _a.resetMobileScreen, resetOTPScreen = _a.resetOTPScreen, resetIndividualScreen = _a.resetIndividualScreen, resetMerchantScreen = _a.resetMerchantScreen, resetNIDScreen = _a.resetNIDScreen, resetCivilScreen = _a.resetCivilScreen;
|
|
955
959
|
export default connectSlice.reducer;
|
|
956
960
|
export var connectSelector = function (state) { return state.connect; };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
export var civilIDValidationSchema = yup.object().shape({
|
|
3
|
-
civilId: yup.string().min(12, 'invalid_civil_id').required('invalid_civil_id')
|
|
3
|
+
civilId: yup.string().matches(/^\d+$/, 'invalid_civil_id').min(12, 'invalid_civil_id').required('invalid_civil_id')
|
|
4
4
|
});
|
|
@@ -46,17 +46,16 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
49
|
+
import * as React from 'react';
|
|
49
50
|
import Box from '@mui/material/Box/Box';
|
|
50
51
|
import { styled } from '@mui/material/styles';
|
|
51
|
-
import * as React from 'react';
|
|
52
52
|
import { useTranslation } from 'react-i18next';
|
|
53
53
|
import Text from '../../../../components/Text';
|
|
54
|
-
import {
|
|
54
|
+
import { businessSelector, verifyPACI as verifyPACIFun } from '../../../app/business/businessStore';
|
|
55
55
|
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
56
56
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
57
57
|
import { MobileButton } from '../../../shared/Button';
|
|
58
58
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
59
|
-
import Icon from '../../../../components/Icon';
|
|
60
59
|
import { mobileOS, sleep } from '../../../../utils';
|
|
61
60
|
import VerifyPACILoading from './VerifyPACILoading';
|
|
62
61
|
import VerifyPACISuccess from './VerifyPACISuccess';
|
|
@@ -89,17 +88,6 @@ var Container = styled(Box)(function (_a) {
|
|
|
89
88
|
maxHeight: '300px'
|
|
90
89
|
});
|
|
91
90
|
});
|
|
92
|
-
var IconStyled = styled(Icon)(function (_a) {
|
|
93
|
-
var theme = _a.theme;
|
|
94
|
-
return ({
|
|
95
|
-
position: 'absolute',
|
|
96
|
-
top: '50%',
|
|
97
|
-
left: '50%',
|
|
98
|
-
transform: 'translate(-50%, -50%)',
|
|
99
|
-
width: 64,
|
|
100
|
-
height: 64
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
91
|
var BackButton = styled('button')(function (_a) {
|
|
104
92
|
var theme = _a.theme;
|
|
105
93
|
return ({
|
|
@@ -119,8 +107,9 @@ var BackButton = styled('button')(function (_a) {
|
|
|
119
107
|
});
|
|
120
108
|
var VerifyPACI = function () {
|
|
121
109
|
var _a = React.useState(false), success = _a[0], setSuccess = _a[1];
|
|
110
|
+
var _b = React.useState(false), isReady = _b[0], setIsReady = _b[1];
|
|
122
111
|
var dispatch = useAppDispatch();
|
|
123
|
-
var data = useAppSelector(
|
|
112
|
+
var data = useAppSelector(businessSelector).data;
|
|
124
113
|
var responseBody = data.civilIdData.responseBody;
|
|
125
114
|
var t = useTranslation().t;
|
|
126
115
|
var onSuccess = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -136,13 +125,20 @@ var VerifyPACI = function () {
|
|
|
136
125
|
});
|
|
137
126
|
}); };
|
|
138
127
|
React.useEffect(function () {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
128
|
+
if (responseBody) {
|
|
129
|
+
setIsReady(true);
|
|
130
|
+
}
|
|
131
|
+
}, [responseBody]);
|
|
132
|
+
React.useEffect(function () {
|
|
133
|
+
if (!isReady)
|
|
134
|
+
return;
|
|
135
|
+
var promise = dispatch(verifyPACIFun({ onSuccess: onSuccess }));
|
|
136
|
+
alert('promise');
|
|
142
137
|
return function () {
|
|
143
138
|
promise === null || promise === void 0 ? void 0 : promise.abort();
|
|
139
|
+
alert('abort');
|
|
144
140
|
};
|
|
145
|
-
}, [
|
|
141
|
+
}, [isReady]);
|
|
146
142
|
var onRedirect = React.useCallback(function () {
|
|
147
143
|
if (os === 'Android') {
|
|
148
144
|
window.open(responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_android, '_blank');
|
|
@@ -18,7 +18,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
|
|
|
18
18
|
import { civilIDValidationSchema } from './validation';
|
|
19
19
|
import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
|
|
20
20
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
21
|
-
import { clearError, connectSelector, createCivilIdAuth } from '../../../app/connect/connectStore';
|
|
21
|
+
import { clearError, connectSelector, createCivilIdAuth, resetMobileScreen } from '../../../app/connect/connectStore';
|
|
22
22
|
import Form from '../../../../components/Form';
|
|
23
23
|
import Button, { MobileButton } from '../../../shared/Button';
|
|
24
24
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
@@ -71,6 +71,7 @@ var CivilID = function (_a) {
|
|
|
71
71
|
}, [methods.formState.isValid]);
|
|
72
72
|
var onSubmit = function (data) {
|
|
73
73
|
dispatch(createCivilIdAuth(data));
|
|
74
|
+
dispatch(resetMobileScreen());
|
|
74
75
|
};
|
|
75
76
|
var handleClearError = function () {
|
|
76
77
|
if (error)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
export var civilIDValidationSchema = yup.object().shape({
|
|
3
|
-
civilId: yup.string().min(12, 'invalid_civil_id').required('invalid_civil_id')
|
|
3
|
+
civilId: yup.string().matches(/^\d+$/, 'invalid_civil_id').min(12, 'invalid_civil_id').required('invalid_civil_id')
|
|
4
4
|
});
|
|
@@ -43,9 +43,10 @@ var Individual = function (_a) {
|
|
|
43
43
|
var t = useTranslation().t;
|
|
44
44
|
var isAr = useLanguage().isAr;
|
|
45
45
|
var isAbsher = (_b = data.otpData) === null || _b === void 0 ? void 0 : _b.isAbsher;
|
|
46
|
+
var isMobile = data.mobileData.mobile;
|
|
46
47
|
var individualData = data.individualData;
|
|
47
48
|
var methods = useForm({
|
|
48
|
-
resolver: yupResolver(
|
|
49
|
+
resolver: yupResolver(!isMobile ? IndividualMobileValidation : IndividualValidation),
|
|
49
50
|
defaultValues: data.individualData,
|
|
50
51
|
mode: 'onChange'
|
|
51
52
|
});
|
|
@@ -83,6 +84,6 @@ var Individual = function (_a) {
|
|
|
83
84
|
}, [(_c = data.individualData) === null || _c === void 0 ? void 0 : _c.responseBody]);
|
|
84
85
|
var emailErrChecks = !methods.formState.isValid || !!methods.formState.errors.email || !!error;
|
|
85
86
|
var disabled = emailErrChecks || emailChecking || !((_d = data.individualData.responseBody) === null || _d === void 0 ? void 0 : _d.is_available);
|
|
86
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Name, { show: !listActive }), _jsx(MobileNumber, { show:
|
|
87
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Name, { show: !listActive }), _jsx(MobileNumber, { show: !isMobile, onListOpen: function () { return handleMenuListClick(); }, onListClose: function () { return handleMenuListClick(); }, countries: countriesCode }), _jsx(Email, { show: !listActive, fetchingEmail: function (v) { return setEmailChecking(v); }, emailChecking: emailChecking }), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
|
|
87
88
|
};
|
|
88
89
|
export default React.memo(Individual);
|
|
@@ -22,7 +22,7 @@ import Button, { AbsherButton } from '../../../shared/Button';
|
|
|
22
22
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
23
23
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
24
24
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
25
|
-
import { clearError, connectSelector, createMobileAuth } from '../../../app/connect/connectStore';
|
|
25
|
+
import { clearError, connectSelector, createMobileAuth, resetNIDScreen, resetCivilScreen } from '../../../app/connect/connectStore';
|
|
26
26
|
import { useLanguage } from '../../../../hooks';
|
|
27
27
|
import Divider from '@mui/material/Divider';
|
|
28
28
|
import { isKW } from '../../../../utils';
|
|
@@ -99,6 +99,8 @@ var Mobile = function (_a) {
|
|
|
99
99
|
}, [methods.formState.isValid]);
|
|
100
100
|
var onSubmit = function (formData) {
|
|
101
101
|
dispatch(createMobileAuth(formData));
|
|
102
|
+
dispatch(resetNIDScreen());
|
|
103
|
+
dispatch(resetCivilScreen());
|
|
102
104
|
};
|
|
103
105
|
var isKWCountry = React.useMemo(function () { var _a; return isKW((_a = settingsStore.data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2); }, [(_b = settingsStore.data.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2]);
|
|
104
106
|
var onBack = function () {
|
|
@@ -18,7 +18,7 @@ import { yupResolver } from '@hookform/resolvers/yup';
|
|
|
18
18
|
import { NIDValidationSchema } from './validation';
|
|
19
19
|
import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
|
|
20
20
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
21
|
-
import { clearError, connectSelector, createNIDAuth } from '../../../app/connect/connectStore';
|
|
21
|
+
import { clearError, connectSelector, createNIDAuth, resetMobileScreen } from '../../../app/connect/connectStore';
|
|
22
22
|
import Form from '../../../../components/Form';
|
|
23
23
|
import Button, { MobileButton } from '../../../shared/Button';
|
|
24
24
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
@@ -73,6 +73,7 @@ var NID = function (_a) {
|
|
|
73
73
|
}, [methods.formState.isValid]);
|
|
74
74
|
var onSubmit = function (data) {
|
|
75
75
|
dispatch(createNIDAuth(data));
|
|
76
|
+
dispatch(resetMobileScreen());
|
|
76
77
|
};
|
|
77
78
|
var handleCollapseOpenClose = function (flag) {
|
|
78
79
|
setCollapse(flag);
|
|
@@ -46,9 +46,9 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
49
|
+
import * as React from 'react';
|
|
49
50
|
import Box from '@mui/material/Box/Box';
|
|
50
51
|
import { styled } from '@mui/material/styles';
|
|
51
|
-
import * as React from 'react';
|
|
52
52
|
import { useTranslation } from 'react-i18next';
|
|
53
53
|
import Text from '../../../../components/Text';
|
|
54
54
|
import { connectSelector, verifyPACI as verifyPACIFun } from '../../../app/connect/connectStore';
|
|
@@ -56,7 +56,6 @@ import { handlePrevScreenStep } from '../../../../app/settings';
|
|
|
56
56
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
57
57
|
import { MobileButton } from '../../../shared/Button';
|
|
58
58
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
59
|
-
import Icon from '../../../../components/Icon';
|
|
60
59
|
import { mobileOS, sleep } from '../../../../utils';
|
|
61
60
|
import VerifyPACILoading from './VerifyPACILoading';
|
|
62
61
|
import VerifyPACISuccess from './VerifyPACISuccess';
|
|
@@ -89,17 +88,6 @@ var Container = styled(Box)(function (_a) {
|
|
|
89
88
|
maxHeight: '300px'
|
|
90
89
|
});
|
|
91
90
|
});
|
|
92
|
-
var IconStyled = styled(Icon)(function (_a) {
|
|
93
|
-
var theme = _a.theme;
|
|
94
|
-
return ({
|
|
95
|
-
position: 'absolute',
|
|
96
|
-
top: '50%',
|
|
97
|
-
left: '50%',
|
|
98
|
-
transform: 'translate(-50%, -50%)',
|
|
99
|
-
width: 64,
|
|
100
|
-
height: 64
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
91
|
var BackButton = styled('button')(function (_a) {
|
|
104
92
|
var theme = _a.theme;
|
|
105
93
|
return ({
|
|
@@ -119,6 +107,7 @@ var BackButton = styled('button')(function (_a) {
|
|
|
119
107
|
});
|
|
120
108
|
var VerifyPACI = function () {
|
|
121
109
|
var _a = React.useState(false), success = _a[0], setSuccess = _a[1];
|
|
110
|
+
var _b = React.useState(false), isReady = _b[0], setIsReady = _b[1];
|
|
122
111
|
var dispatch = useAppDispatch();
|
|
123
112
|
var data = useAppSelector(connectSelector).data;
|
|
124
113
|
var responseBody = data.civilIdData.responseBody;
|
|
@@ -136,13 +125,18 @@ var VerifyPACI = function () {
|
|
|
136
125
|
});
|
|
137
126
|
}); };
|
|
138
127
|
React.useEffect(function () {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
128
|
+
if (responseBody) {
|
|
129
|
+
setIsReady(true);
|
|
130
|
+
}
|
|
131
|
+
}, [responseBody]);
|
|
132
|
+
React.useEffect(function () {
|
|
133
|
+
if (!isReady)
|
|
134
|
+
return;
|
|
135
|
+
var promise = dispatch(verifyPACIFun({ onSuccess: onSuccess }));
|
|
142
136
|
return function () {
|
|
143
137
|
promise === null || promise === void 0 ? void 0 : promise.abort();
|
|
144
138
|
};
|
|
145
|
-
}, [
|
|
139
|
+
}, [isReady]);
|
|
146
140
|
var onRedirect = React.useCallback(function () {
|
|
147
141
|
if (os === 'Android') {
|
|
148
142
|
window.open(responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_android, '_blank');
|
package/package.json
CHANGED
|
@@ -1,129 +1,129 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@tap-payments/auth-jsconnect",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "connect library, auth",
|
|
5
|
-
"private": false,
|
|
6
|
-
"main": "build/index.js",
|
|
7
|
-
"module": "build/index.js",
|
|
8
|
-
"types": "build/index.d.ts",
|
|
9
|
-
"files": [
|
|
10
|
-
"build",
|
|
11
|
-
"README.md"
|
|
12
|
-
],
|
|
13
|
-
"scripts": {
|
|
14
|
-
"husky:setup": "npx husky install",
|
|
15
|
-
"prettier": "prettier --list-different \"src/**/*.{md,mdx,ts,js,tsx,jsx,json}\" *.json *.js",
|
|
16
|
-
"prettier:fix": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md,css,json}\" *.json *.js",
|
|
17
|
-
"lint": "eslint src --color --ext .js,.jsx,.ts,.tsx,.json",
|
|
18
|
-
"lint:fix": "eslint src --ext .js,.jsx,.ts,.tsx --fix",
|
|
19
|
-
"start": "cross-env NODE_ENV=development webpack serve",
|
|
20
|
-
"build": "rm -rf build && cross-env NODE_ENV=production webpack",
|
|
21
|
-
"copy:files": "copyfiles -u 1 src/**/*.css build/",
|
|
22
|
-
"tsc:alias": "tsc-alias -p tsconfig.json",
|
|
23
|
-
"ts:build": "rm -rf build && tsc -p tsconfig.json && tsc-alias -p tsconfig.json && yarn copy:files",
|
|
24
|
-
"push": "npm publish --access public"
|
|
25
|
-
},
|
|
26
|
-
"keywords": [],
|
|
27
|
-
"author": {
|
|
28
|
-
"name": "Ahmed Elsharkawy",
|
|
29
|
-
"email": "a.elsharkawy@tap.company"
|
|
30
|
-
},
|
|
31
|
-
"license": "ISC",
|
|
32
|
-
"devDependencies": {
|
|
33
|
-
"@babel/core": "^7.18.6",
|
|
34
|
-
"@babel/preset-env": "^7.18.6",
|
|
35
|
-
"@babel/preset-react": "^7.18.6",
|
|
36
|
-
"@babel/preset-typescript": "^7.18.6",
|
|
37
|
-
"@types/lodash-es": "^4.17.6",
|
|
38
|
-
"@types/moment-hijri": "^2.1.0",
|
|
39
|
-
"@types/react": "^18.0.15",
|
|
40
|
-
"@types/react-calendar": "~3.5.1",
|
|
41
|
-
"@types/react-dom": "^18.0.6",
|
|
42
|
-
"@typescript-eslint/eslint-plugin": "^5.30.5",
|
|
43
|
-
"@typescript-eslint/parser": "^5.30.5",
|
|
44
|
-
"babel-loader": "^8.2.5",
|
|
45
|
-
"copyfiles": "^2.4.1",
|
|
46
|
-
"cross-env": "^7.0.3",
|
|
47
|
-
"css-loader": "^6.7.1",
|
|
48
|
-
"css-minimizer-webpack-plugin": "^4.0.0",
|
|
49
|
-
"eslint": "^8.19.0",
|
|
50
|
-
"eslint-config-airbnb": "^19.0.4",
|
|
51
|
-
"eslint-config-prettier": "^8.5.0",
|
|
52
|
-
"eslint-plugin-import": "^2.26.0",
|
|
53
|
-
"eslint-plugin-jsx-a11y": "^6.6.0",
|
|
54
|
-
"eslint-plugin-node": "^11.1.0",
|
|
55
|
-
"eslint-plugin-prettier": "^4.2.1",
|
|
56
|
-
"eslint-plugin-react": "^7.30.1",
|
|
57
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
58
|
-
"file-loader": "^6.2.0",
|
|
59
|
-
"fork-ts-checker-webpack-plugin": "^7.2.12",
|
|
60
|
-
"html-loader": "^3.1.2",
|
|
61
|
-
"html-webpack-plugin": "^5.5.0",
|
|
62
|
-
"husky": "^8.0.1",
|
|
63
|
-
"lint-staged": "^13.0.3",
|
|
64
|
-
"mini-css-extract-plugin": "^2.6.1",
|
|
65
|
-
"prettier": "^2.7.1",
|
|
66
|
-
"sass": "^1.53.0",
|
|
67
|
-
"sass-loader": "^13.0.2",
|
|
68
|
-
"style-loader": "^3.3.1",
|
|
69
|
-
"terser-webpack-plugin": "^5.3.3",
|
|
70
|
-
"tsc-alias": "^1.6.11",
|
|
71
|
-
"typescript": "^4.7.4",
|
|
72
|
-
"webpack": "^5.73.0",
|
|
73
|
-
"webpack-cli": "^4.10.0",
|
|
74
|
-
"webpack-dev-server": "^4.9.3",
|
|
75
|
-
"webpack-merge": "^5.8.0"
|
|
76
|
-
},
|
|
77
|
-
"dependencies": {
|
|
78
|
-
"@emotion/react": "^11.9.3",
|
|
79
|
-
"@emotion/styled": "^11.9.3",
|
|
80
|
-
"@fingerprintjs/fingerprintjs": "~3.3.4",
|
|
81
|
-
"@hookform/resolvers": "^2.9.6",
|
|
82
|
-
"@mui/icons-material": "^5.8.4",
|
|
83
|
-
"@mui/material": "^5.8.7",
|
|
84
|
-
"@reduxjs/toolkit": "^1.8.3",
|
|
85
|
-
"axios": "^0.27.2",
|
|
86
|
-
"device-detector-js": "^3.0.3",
|
|
87
|
-
"i18next": "^21.8.14",
|
|
88
|
-
"i18next-browser-languagedetector": "^6.1.4",
|
|
89
|
-
"i18next-http-backend": "^1.4.1",
|
|
90
|
-
"jsencrypt": "^2.3.1",
|
|
91
|
-
"lodash-es": "^4.17.21",
|
|
92
|
-
"lottie-web": "^5.9.6",
|
|
93
|
-
"moment-hijri": "~2.1.2",
|
|
94
|
-
"react": "^18.2.0",
|
|
95
|
-
"react-calendar": "~3.7.0",
|
|
96
|
-
"react-device-detect": "^2.2.2",
|
|
97
|
-
"react-dom": "^18.2.0",
|
|
98
|
-
"react-dropzone": "^14.2.2",
|
|
99
|
-
"react-hook-form": "^7.33.1",
|
|
100
|
-
"react-i18next": "^11.18.1",
|
|
101
|
-
"react-otp-input": "^2.4.0",
|
|
102
|
-
"react-redux": "^8.0.2",
|
|
103
|
-
"react-spring-bottom-sheet": "^3.4.1",
|
|
104
|
-
"yup": "^0.32.11"
|
|
105
|
-
},
|
|
106
|
-
"peerDependencies": {
|
|
107
|
-
"react": "^18.2.0",
|
|
108
|
-
"react-dom": "^18.2.0"
|
|
109
|
-
},
|
|
110
|
-
"lint-staged": {
|
|
111
|
-
"src/**/*.{ts,tsx,json,js,jsx}": [
|
|
112
|
-
"yarn run prettier:fix",
|
|
113
|
-
"yarn run lint",
|
|
114
|
-
"git add ."
|
|
115
|
-
]
|
|
116
|
-
},
|
|
117
|
-
"browserslist": {
|
|
118
|
-
"production": [
|
|
119
|
-
">0.2%",
|
|
120
|
-
"not dead",
|
|
121
|
-
"not op_mini all"
|
|
122
|
-
],
|
|
123
|
-
"development": [
|
|
124
|
-
"last 1 chrome version",
|
|
125
|
-
"last 1 firefox version",
|
|
126
|
-
"last 1 safari version"
|
|
127
|
-
]
|
|
128
|
-
}
|
|
129
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@tap-payments/auth-jsconnect",
|
|
3
|
+
"version": "2.0.59-test",
|
|
4
|
+
"description": "connect library, auth",
|
|
5
|
+
"private": false,
|
|
6
|
+
"main": "build/index.js",
|
|
7
|
+
"module": "build/index.js",
|
|
8
|
+
"types": "build/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"build",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"husky:setup": "npx husky install",
|
|
15
|
+
"prettier": "prettier --list-different \"src/**/*.{md,mdx,ts,js,tsx,jsx,json}\" *.json *.js",
|
|
16
|
+
"prettier:fix": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json,md,css,json}\" *.json *.js",
|
|
17
|
+
"lint": "eslint src --color --ext .js,.jsx,.ts,.tsx,.json",
|
|
18
|
+
"lint:fix": "eslint src --ext .js,.jsx,.ts,.tsx --fix",
|
|
19
|
+
"start": "cross-env NODE_ENV=development webpack serve",
|
|
20
|
+
"build": "rm -rf build && cross-env NODE_ENV=production webpack",
|
|
21
|
+
"copy:files": "copyfiles -u 1 src/**/*.css build/",
|
|
22
|
+
"tsc:alias": "tsc-alias -p tsconfig.json",
|
|
23
|
+
"ts:build": "rm -rf build && tsc -p tsconfig.json && tsc-alias -p tsconfig.json && yarn copy:files",
|
|
24
|
+
"push": "npm publish --access public"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [],
|
|
27
|
+
"author": {
|
|
28
|
+
"name": "Ahmed Elsharkawy",
|
|
29
|
+
"email": "a.elsharkawy@tap.company"
|
|
30
|
+
},
|
|
31
|
+
"license": "ISC",
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@babel/core": "^7.18.6",
|
|
34
|
+
"@babel/preset-env": "^7.18.6",
|
|
35
|
+
"@babel/preset-react": "^7.18.6",
|
|
36
|
+
"@babel/preset-typescript": "^7.18.6",
|
|
37
|
+
"@types/lodash-es": "^4.17.6",
|
|
38
|
+
"@types/moment-hijri": "^2.1.0",
|
|
39
|
+
"@types/react": "^18.0.15",
|
|
40
|
+
"@types/react-calendar": "~3.5.1",
|
|
41
|
+
"@types/react-dom": "^18.0.6",
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "^5.30.5",
|
|
43
|
+
"@typescript-eslint/parser": "^5.30.5",
|
|
44
|
+
"babel-loader": "^8.2.5",
|
|
45
|
+
"copyfiles": "^2.4.1",
|
|
46
|
+
"cross-env": "^7.0.3",
|
|
47
|
+
"css-loader": "^6.7.1",
|
|
48
|
+
"css-minimizer-webpack-plugin": "^4.0.0",
|
|
49
|
+
"eslint": "^8.19.0",
|
|
50
|
+
"eslint-config-airbnb": "^19.0.4",
|
|
51
|
+
"eslint-config-prettier": "^8.5.0",
|
|
52
|
+
"eslint-plugin-import": "^2.26.0",
|
|
53
|
+
"eslint-plugin-jsx-a11y": "^6.6.0",
|
|
54
|
+
"eslint-plugin-node": "^11.1.0",
|
|
55
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
56
|
+
"eslint-plugin-react": "^7.30.1",
|
|
57
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
58
|
+
"file-loader": "^6.2.0",
|
|
59
|
+
"fork-ts-checker-webpack-plugin": "^7.2.12",
|
|
60
|
+
"html-loader": "^3.1.2",
|
|
61
|
+
"html-webpack-plugin": "^5.5.0",
|
|
62
|
+
"husky": "^8.0.1",
|
|
63
|
+
"lint-staged": "^13.0.3",
|
|
64
|
+
"mini-css-extract-plugin": "^2.6.1",
|
|
65
|
+
"prettier": "^2.7.1",
|
|
66
|
+
"sass": "^1.53.0",
|
|
67
|
+
"sass-loader": "^13.0.2",
|
|
68
|
+
"style-loader": "^3.3.1",
|
|
69
|
+
"terser-webpack-plugin": "^5.3.3",
|
|
70
|
+
"tsc-alias": "^1.6.11",
|
|
71
|
+
"typescript": "^4.7.4",
|
|
72
|
+
"webpack": "^5.73.0",
|
|
73
|
+
"webpack-cli": "^4.10.0",
|
|
74
|
+
"webpack-dev-server": "^4.9.3",
|
|
75
|
+
"webpack-merge": "^5.8.0"
|
|
76
|
+
},
|
|
77
|
+
"dependencies": {
|
|
78
|
+
"@emotion/react": "^11.9.3",
|
|
79
|
+
"@emotion/styled": "^11.9.3",
|
|
80
|
+
"@fingerprintjs/fingerprintjs": "~3.3.4",
|
|
81
|
+
"@hookform/resolvers": "^2.9.6",
|
|
82
|
+
"@mui/icons-material": "^5.8.4",
|
|
83
|
+
"@mui/material": "^5.8.7",
|
|
84
|
+
"@reduxjs/toolkit": "^1.8.3",
|
|
85
|
+
"axios": "^0.27.2",
|
|
86
|
+
"device-detector-js": "^3.0.3",
|
|
87
|
+
"i18next": "^21.8.14",
|
|
88
|
+
"i18next-browser-languagedetector": "^6.1.4",
|
|
89
|
+
"i18next-http-backend": "^1.4.1",
|
|
90
|
+
"jsencrypt": "^2.3.1",
|
|
91
|
+
"lodash-es": "^4.17.21",
|
|
92
|
+
"lottie-web": "^5.9.6",
|
|
93
|
+
"moment-hijri": "~2.1.2",
|
|
94
|
+
"react": "^18.2.0",
|
|
95
|
+
"react-calendar": "~3.7.0",
|
|
96
|
+
"react-device-detect": "^2.2.2",
|
|
97
|
+
"react-dom": "^18.2.0",
|
|
98
|
+
"react-dropzone": "^14.2.2",
|
|
99
|
+
"react-hook-form": "^7.33.1",
|
|
100
|
+
"react-i18next": "^11.18.1",
|
|
101
|
+
"react-otp-input": "^2.4.0",
|
|
102
|
+
"react-redux": "^8.0.2",
|
|
103
|
+
"react-spring-bottom-sheet": "^3.4.1",
|
|
104
|
+
"yup": "^0.32.11"
|
|
105
|
+
},
|
|
106
|
+
"peerDependencies": {
|
|
107
|
+
"react": "^18.2.0",
|
|
108
|
+
"react-dom": "^18.2.0"
|
|
109
|
+
},
|
|
110
|
+
"lint-staged": {
|
|
111
|
+
"src/**/*.{ts,tsx,json,js,jsx}": [
|
|
112
|
+
"yarn run prettier:fix",
|
|
113
|
+
"yarn run lint",
|
|
114
|
+
"git add ."
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
"browserslist": {
|
|
118
|
+
"production": [
|
|
119
|
+
">0.2%",
|
|
120
|
+
"not dead",
|
|
121
|
+
"not op_mini all"
|
|
122
|
+
],
|
|
123
|
+
"development": [
|
|
124
|
+
"last 1 chrome version",
|
|
125
|
+
"last 1 firefox version",
|
|
126
|
+
"last 1 safari version"
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
}
|