@tap-payments/auth-jsconnect 2.0.56-test → 2.0.58-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/api/data.d.ts +16 -16
- package/build/api/index.d.ts +22 -7
- package/build/constants/app.d.ts +1 -0
- package/build/constants/app.js +4 -3
- package/build/constants/validation.d.ts +1 -1
- package/build/constants/validation.js +1 -1
- package/build/features/app/business/businessStore.d.ts +12 -1
- package/build/features/app/business/businessStore.js +109 -1
- package/build/features/app/connect/connectStore.d.ts +2 -1
- package/build/features/app/connect/connectStore.js +53 -28
- package/build/features/business/screens/CivilID/CivilID.d.ts +5 -0
- package/build/features/business/screens/CivilID/CivilID.js +85 -0
- package/build/features/business/screens/CivilID/IDNumber.d.ts +7 -0
- package/build/features/business/screens/CivilID/IDNumber.js +59 -0
- package/build/features/business/screens/CivilID/index.d.ts +3 -0
- package/build/features/business/screens/CivilID/index.js +2 -0
- package/build/features/business/screens/CivilID/validation.d.ts +8 -0
- package/build/features/business/screens/CivilID/validation.js +4 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACI.d.ts +5 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACI.js +158 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACILoading.d.ts +5 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACILoading.js +22 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.d.ts +5 -0
- package/build/features/business/screens/VerifyPACI/VerifyPACISuccess.js +8 -0
- package/build/features/business/screens/VerifyPACI/index.d.ts +3 -0
- package/build/features/business/screens/VerifyPACI/index.js +2 -0
- 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 +17 -30
- package/build/utils/common.d.ts +1 -0
- package/build/utils/common.js +3 -0
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.js +1 -0
- package/package.json +129 -129
|
@@ -0,0 +1,158 @@
|
|
|
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
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (_) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
49
|
+
import * as React from 'react';
|
|
50
|
+
import Box from '@mui/material/Box/Box';
|
|
51
|
+
import { styled } from '@mui/material/styles';
|
|
52
|
+
import { useTranslation } from 'react-i18next';
|
|
53
|
+
import Text from '../../../../components/Text';
|
|
54
|
+
import { businessSelector, verifyPACI as verifyPACIFun } from '../../../app/business/businessStore';
|
|
55
|
+
import { handlePrevScreenStep } from '../../../../app/settings';
|
|
56
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
57
|
+
import { MobileButton } from '../../../shared/Button';
|
|
58
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
59
|
+
import { mobileOS, sleep } from '../../../../utils';
|
|
60
|
+
import VerifyPACILoading from './VerifyPACILoading';
|
|
61
|
+
import VerifyPACISuccess from './VerifyPACISuccess';
|
|
62
|
+
var VerifyPACITitleContainerStyled = styled(Box)(function (_a) {
|
|
63
|
+
var theme = _a.theme;
|
|
64
|
+
return ({
|
|
65
|
+
direction: theme.direction,
|
|
66
|
+
borderRadius: theme.spacing(0, 0, 1.25, 1.25),
|
|
67
|
+
display: 'flex',
|
|
68
|
+
flexDirection: 'column',
|
|
69
|
+
alignItems: 'center',
|
|
70
|
+
marginBottom: theme.spacing(2.5)
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
var VerifyPACITitleStyled = styled(Text)(function (_a) {
|
|
74
|
+
var theme = _a.theme;
|
|
75
|
+
return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightBold, marginBlock: theme.spacing(1.75), marginInline: theme.spacing(2.5), lineHeight: 1.75, whiteSpace: 'pre-line' }));
|
|
76
|
+
});
|
|
77
|
+
var VerifyPACISubTitleStyled = styled(Text)(function (_a) {
|
|
78
|
+
var theme = _a.theme;
|
|
79
|
+
return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightMedium, marginBlock: theme.spacing(1.75), marginInline: theme.spacing(2.5), lineHeight: 1.75, whiteSpace: 'pre-line', textAlign: 'center' }));
|
|
80
|
+
});
|
|
81
|
+
var Container = styled(Box)(function (_a) {
|
|
82
|
+
var theme = _a.theme;
|
|
83
|
+
return ({
|
|
84
|
+
position: 'relative',
|
|
85
|
+
display: 'flex',
|
|
86
|
+
justifyContent: 'center',
|
|
87
|
+
alignItems: 'center',
|
|
88
|
+
maxHeight: '300px'
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
var BackButton = styled('button')(function (_a) {
|
|
92
|
+
var theme = _a.theme;
|
|
93
|
+
return ({
|
|
94
|
+
cursor: 'pointer',
|
|
95
|
+
height: 44,
|
|
96
|
+
appearance: 'none',
|
|
97
|
+
background: 'none',
|
|
98
|
+
border: 'none',
|
|
99
|
+
color: theme.palette.primary.main,
|
|
100
|
+
fontSize: theme.typography.body1.fontSize,
|
|
101
|
+
fontWeight: theme.typography.fontWeightMedium,
|
|
102
|
+
textTransform: 'capitalize',
|
|
103
|
+
'&:hover': {
|
|
104
|
+
backgroundColor: 'transparent'
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
var VerifyPACI = function () {
|
|
109
|
+
var _a = React.useState(false), success = _a[0], setSuccess = _a[1];
|
|
110
|
+
var _b = React.useState(false), isReady = _b[0], setIsReady = _b[1];
|
|
111
|
+
var dispatch = useAppDispatch();
|
|
112
|
+
var data = useAppSelector(businessSelector).data;
|
|
113
|
+
var responseBody = data.civilIdData.responseBody;
|
|
114
|
+
var t = useTranslation().t;
|
|
115
|
+
var onSuccess = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
116
|
+
return __generator(this, function (_a) {
|
|
117
|
+
switch (_a.label) {
|
|
118
|
+
case 0:
|
|
119
|
+
setSuccess(true);
|
|
120
|
+
return [4, sleep(2000)];
|
|
121
|
+
case 1:
|
|
122
|
+
_a.sent();
|
|
123
|
+
return [2];
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}); };
|
|
127
|
+
React.useEffect(function () {
|
|
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');
|
|
137
|
+
return function () {
|
|
138
|
+
promise === null || promise === void 0 ? void 0 : promise.abort();
|
|
139
|
+
alert('abort');
|
|
140
|
+
};
|
|
141
|
+
}, [isReady]);
|
|
142
|
+
var onRedirect = React.useCallback(function () {
|
|
143
|
+
if (os === 'Android') {
|
|
144
|
+
window.open(responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_android, '_blank');
|
|
145
|
+
}
|
|
146
|
+
if (os === 'iOS') {
|
|
147
|
+
window.open(responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_ios, '_blank');
|
|
148
|
+
}
|
|
149
|
+
}, [responseBody]);
|
|
150
|
+
var onBack = React.useCallback(function () {
|
|
151
|
+
dispatch(handlePrevScreenStep());
|
|
152
|
+
}, []);
|
|
153
|
+
var os = React.useMemo(function () { return mobileOS(); }, []);
|
|
154
|
+
var isAndroid = React.useMemo(function () { return os === 'Android' && (responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_ios); }, [os, responseBody]);
|
|
155
|
+
var isIOS = React.useMemo(function () { return os === 'iOS' && (responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_ios); }, [os, responseBody]);
|
|
156
|
+
return (_jsxs(ScreenContainer, __assign({ sx: { mb: 2.5 } }, { children: [_jsxs(VerifyPACITitleContainerStyled, { children: [_jsx(Container, { children: success ? _jsx(VerifyPACISuccess, {}) : _jsx(VerifyPACILoading, {}) }), _jsx(VerifyPACITitleStyled, { children: t('authenticate_kuwait_mobile_title') }), _jsx(VerifyPACISubTitleStyled, { children: t('authenticate_kuwait_mobile_description') })] }), (isAndroid || isIOS) && (_jsx(MobileButton, __assign({ onClick: onRedirect, hideIcon: true }, { children: t('Open Kuwait Mobile ID') }))), _jsx(BackButton, __assign({ onClick: onBack }, { children: t('back') }))] })));
|
|
157
|
+
};
|
|
158
|
+
export default React.memo(VerifyPACI);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import LottieFile, { LottieAnimationFiles } from '../../../../components/Lottie';
|
|
5
|
+
import { ICONS_NAMES } from '../../../../constants';
|
|
6
|
+
import Icon from '../../../../components/Icon';
|
|
7
|
+
var IconStyled = styled(Icon)(function (_a) {
|
|
8
|
+
var theme = _a.theme;
|
|
9
|
+
return ({
|
|
10
|
+
position: 'absolute',
|
|
11
|
+
top: '50%',
|
|
12
|
+
left: '50%',
|
|
13
|
+
transform: 'translate(-50%, -50%)',
|
|
14
|
+
width: 64,
|
|
15
|
+
height: 64
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
var VerifyPACILoading = function () {
|
|
19
|
+
return (_jsxs(_Fragment, { children: [_jsx(LottieFile, { file: LottieAnimationFiles.pulsating_circle_waves, width: '90%' }), _jsx(IconStyled, { src: ICONS_NAMES.PACI_VERIFY_ICON })] }));
|
|
20
|
+
};
|
|
21
|
+
VerifyPACILoading.defaultProps = {};
|
|
22
|
+
export default memo(VerifyPACILoading);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import LottieFile, { LottieAnimationFiles } from '../../../../components/Lottie';
|
|
4
|
+
var VerifyPACISuccess = function () {
|
|
5
|
+
return (_jsx(_Fragment, { children: _jsx(LottieFile, { loop: false, file: LottieAnimationFiles.success, width: '90%' }) }));
|
|
6
|
+
};
|
|
7
|
+
VerifyPACISuccess.defaultProps = {};
|
|
8
|
+
export default memo(VerifyPACISuccess);
|
|
@@ -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().
|
|
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,8 +56,7 @@ 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
|
|
60
|
-
import { mobileOS } from '../../../../utils';
|
|
59
|
+
import { mobileOS, sleep } from '../../../../utils';
|
|
61
60
|
import VerifyPACILoading from './VerifyPACILoading';
|
|
62
61
|
import VerifyPACISuccess from './VerifyPACISuccess';
|
|
63
62
|
var VerifyPACITitleContainerStyled = styled(Box)(function (_a) {
|
|
@@ -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;
|
|
@@ -126,12 +115,9 @@ var VerifyPACI = function () {
|
|
|
126
115
|
var onSuccess = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
127
116
|
return __generator(this, function (_a) {
|
|
128
117
|
switch (_a.label) {
|
|
129
|
-
case 0:
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
resolve('success');
|
|
133
|
-
}, 1000);
|
|
134
|
-
})];
|
|
118
|
+
case 0:
|
|
119
|
+
setSuccess(true);
|
|
120
|
+
return [4, sleep(2000)];
|
|
135
121
|
case 1:
|
|
136
122
|
_a.sent();
|
|
137
123
|
return [2];
|
|
@@ -139,17 +125,18 @@ var VerifyPACI = function () {
|
|
|
139
125
|
});
|
|
140
126
|
}); };
|
|
141
127
|
React.useEffect(function () {
|
|
142
|
-
if (responseBody)
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
if (responseBody)
|
|
146
|
-
dispatch(verifyPACIFun({ onSuccess: onSuccess }));
|
|
147
|
-
}, 10000);
|
|
148
|
-
setTimeout(function () {
|
|
149
|
-
clearInterval(interval);
|
|
150
|
-
}, ((responseBody === null || responseBody === void 0 ? void 0 : responseBody.expiry) || 120) * 1000);
|
|
151
|
-
return function () { return clearInterval(interval); };
|
|
128
|
+
if (responseBody) {
|
|
129
|
+
setIsReady(true);
|
|
130
|
+
}
|
|
152
131
|
}, [responseBody]);
|
|
132
|
+
React.useEffect(function () {
|
|
133
|
+
if (!isReady)
|
|
134
|
+
return;
|
|
135
|
+
var promise = dispatch(verifyPACIFun({ onSuccess: onSuccess }));
|
|
136
|
+
return function () {
|
|
137
|
+
promise === null || promise === void 0 ? void 0 : promise.abort();
|
|
138
|
+
};
|
|
139
|
+
}, [isReady]);
|
|
153
140
|
var onRedirect = React.useCallback(function () {
|
|
154
141
|
if (os === 'Android') {
|
|
155
142
|
window.open(responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_android, '_blank');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sleep: (milliseconds: number) => Promise<unknown>;
|
package/build/utils/index.d.ts
CHANGED
package/build/utils/index.js
CHANGED