omnipay-reactnative-sdk 1.2.2-beta.4 → 1.2.2-beta.7
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/README.md +93 -43
- package/android/build.gradle +16 -15
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/omniretail/omnipay/OmnipayActivityPackage.java +2 -2
- package/android/src/main/java/com/omniretail/omnipay/OmnipayLivenessCameraView.java +153 -0
- package/android/src/main/java/com/omniretail/omnipay/OmnipayLivenessCameraViewManager.java +49 -0
- package/android/src/main/java/com/omniretail/omnipay/OmnipayLivenessModule.java +557 -0
- package/ios/OmnipayLivenessCameraView.h +15 -0
- package/ios/OmnipayLivenessCameraView.m +80 -0
- package/ios/OmnipayLivenessCameraViewManager.m +19 -0
- package/ios/OmnipayLivenessModule.h +38 -0
- package/ios/OmnipayLivenessModule.m +574 -0
- package/lib/commonjs/components/OmnipayProvider.js +2 -66
- package/lib/commonjs/components/OmnipayProvider.js.map +1 -1
- package/lib/commonjs/components/OmnipayView.js.map +1 -1
- package/lib/commonjs/components/biometrics/FaceVerification.js +252 -345
- package/lib/commonjs/components/biometrics/FaceVerification.js.map +1 -1
- package/lib/commonjs/components/biometrics/LivenessDetection.js +90 -198
- package/lib/commonjs/components/biometrics/LivenessDetection.js.map +1 -1
- package/lib/commonjs/components/biometrics/OmnipayLivenessCameraView.js +15 -0
- package/lib/commonjs/components/biometrics/OmnipayLivenessCameraView.js.map +1 -0
- package/lib/commonjs/components/biometrics/PermissionManager.js +279 -0
- package/lib/commonjs/components/biometrics/PermissionManager.js.map +1 -0
- package/lib/commonjs/components/biometrics/index.js +45 -0
- package/lib/commonjs/components/biometrics/index.js.map +1 -0
- package/lib/commonjs/components/biometrics/types.js +17 -0
- package/lib/commonjs/components/biometrics/types.js.map +1 -0
- package/lib/commonjs/components/views/BvnVerification.js.map +1 -1
- package/lib/commonjs/components/views/PaylaterAgreement.js.map +1 -1
- package/lib/commonjs/components/views/Registration.js.map +1 -1
- package/lib/commonjs/index.js +23 -18
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/components/OmnipayProvider.js +3 -67
- package/lib/module/components/OmnipayProvider.js.map +1 -1
- package/lib/module/components/OmnipayView.js.map +1 -1
- package/lib/module/components/biometrics/FaceVerification.js +254 -346
- package/lib/module/components/biometrics/FaceVerification.js.map +1 -1
- package/lib/module/components/biometrics/LivenessDetection.js +75 -197
- package/lib/module/components/biometrics/LivenessDetection.js.map +1 -1
- package/lib/module/components/biometrics/OmnipayLivenessCameraView.js +7 -0
- package/lib/module/components/biometrics/OmnipayLivenessCameraView.js.map +1 -0
- package/lib/module/components/biometrics/PermissionManager.js +272 -0
- package/lib/module/components/biometrics/PermissionManager.js.map +1 -0
- package/lib/module/components/biometrics/index.js +12 -0
- package/lib/module/components/biometrics/index.js.map +1 -0
- package/lib/module/components/biometrics/types.js +16 -0
- package/lib/module/components/biometrics/types.js.map +1 -0
- package/lib/module/components/views/BvnVerification.js.map +1 -1
- package/lib/module/components/views/PaylaterAgreement.js.map +1 -1
- package/lib/module/components/views/Registration.js.map +1 -1
- package/lib/module/index.js +5 -4
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/{src/components → components}/OmnipayProvider.d.ts +1 -1
- package/lib/typescript/components/OmnipayProvider.d.ts.map +1 -0
- package/lib/typescript/{src/components → components}/OmnipayView.d.ts +21 -20
- package/lib/typescript/components/OmnipayView.d.ts.map +1 -0
- package/lib/typescript/components/biometrics/FaceVerification.d.ts +11 -0
- package/lib/typescript/components/biometrics/FaceVerification.d.ts.map +1 -0
- package/lib/typescript/components/biometrics/LivenessDetection.d.ts +33 -0
- package/lib/typescript/components/biometrics/LivenessDetection.d.ts.map +1 -0
- package/lib/typescript/components/biometrics/OmnipayLivenessCameraView.d.ts +18 -0
- package/lib/typescript/components/biometrics/OmnipayLivenessCameraView.d.ts.map +1 -0
- package/lib/typescript/components/biometrics/PermissionManager.d.ts +58 -0
- package/lib/typescript/components/biometrics/PermissionManager.d.ts.map +1 -0
- package/lib/typescript/components/biometrics/index.d.ts +5 -0
- package/lib/typescript/components/biometrics/index.d.ts.map +1 -0
- package/lib/typescript/components/biometrics/types.d.ts +73 -0
- package/lib/typescript/components/biometrics/types.d.ts.map +1 -0
- package/lib/typescript/{src/components → components}/views/BvnVerification.d.ts +2 -1
- package/lib/typescript/components/views/BvnVerification.d.ts.map +1 -0
- package/lib/typescript/{src/components → components}/views/PaylaterAgreement.d.ts +2 -1
- package/lib/typescript/components/views/PaylaterAgreement.d.ts.map +1 -0
- package/lib/typescript/{src/components → components}/views/Registration.d.ts +2 -1
- package/lib/typescript/components/views/Registration.d.ts.map +1 -0
- package/lib/typescript/functions.d.ts.map +1 -0
- package/lib/typescript/hooks/useOmnipay.d.ts +28 -0
- package/lib/typescript/hooks/useOmnipay.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +7 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/lib/colors.d.ts.map +1 -0
- package/lib/typescript/lib/config.d.ts.map +1 -0
- package/omnipay-reactnative-sdk.podspec +32 -29
- package/package.json +15 -10
- package/src/components/OmnipayProvider.tsx +3 -106
- package/src/components/OmnipayView.tsx +1 -1
- package/src/components/biometrics/FaceVerification.tsx +291 -368
- package/src/components/biometrics/LivenessDetection.ts +113 -250
- package/src/components/biometrics/OmnipayLivenessCameraView.tsx +19 -0
- package/src/components/biometrics/PermissionManager.ts +317 -0
- package/src/components/biometrics/index.ts +11 -0
- package/src/components/biometrics/types.ts +86 -0
- package/src/components/views/BvnVerification.tsx +1 -1
- package/src/components/views/PaylaterAgreement.tsx +1 -1
- package/src/components/views/Registration.tsx +1 -1
- package/src/index.tsx +4 -15
- package/android/src/main/java/com/omniretail/omnipay/LivenessCameraViewManager.java +0 -116
- package/android/src/main/java/com/omniretail/omnipay/LivenessDetectionModule.java +0 -588
- package/ios/LivenessCameraView.h +0 -22
- package/ios/LivenessCameraView.m +0 -135
- package/ios/LivenessCameraViewManager.h +0 -12
- package/ios/LivenessCameraViewManager.m +0 -24
- package/ios/LivenessDetectionModule.h +0 -46
- package/ios/LivenessDetectionModule.m +0 -603
- package/lib/commonjs/components/biometrics/LivenessCameraView.js +0 -45
- package/lib/commonjs/components/biometrics/LivenessCameraView.js.map +0 -1
- package/lib/module/components/biometrics/LivenessCameraView.js +0 -39
- package/lib/module/components/biometrics/LivenessCameraView.js.map +0 -1
- package/lib/typescript/demo/src/App.d.ts +0 -3
- package/lib/typescript/demo/src/App.d.ts.map +0 -1
- package/lib/typescript/demo/src/Body.d.ts +0 -3
- package/lib/typescript/demo/src/Body.d.ts.map +0 -1
- package/lib/typescript/demo/src/NotificationsExample.d.ts +0 -4
- package/lib/typescript/demo/src/NotificationsExample.d.ts.map +0 -1
- package/lib/typescript/src/components/OmnipayProvider.d.ts.map +0 -1
- package/lib/typescript/src/components/OmnipayView.d.ts.map +0 -1
- package/lib/typescript/src/components/biometrics/FaceVerification.d.ts +0 -12
- package/lib/typescript/src/components/biometrics/FaceVerification.d.ts.map +0 -1
- package/lib/typescript/src/components/biometrics/LivenessCameraView.d.ts +0 -22
- package/lib/typescript/src/components/biometrics/LivenessCameraView.d.ts.map +0 -1
- package/lib/typescript/src/components/biometrics/LivenessDetection.d.ts +0 -73
- package/lib/typescript/src/components/biometrics/LivenessDetection.d.ts.map +0 -1
- package/lib/typescript/src/components/views/BvnVerification.d.ts.map +0 -1
- package/lib/typescript/src/components/views/PaylaterAgreement.d.ts.map +0 -1
- package/lib/typescript/src/components/views/Registration.d.ts.map +0 -1
- package/lib/typescript/src/functions.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useOmnipay.d.ts +0 -28
- package/lib/typescript/src/hooks/useOmnipay.d.ts.map +0 -1
- package/lib/typescript/src/index.d.ts +0 -8
- package/lib/typescript/src/index.d.ts.map +0 -1
- package/lib/typescript/src/lib/colors.d.ts.map +0 -1
- package/lib/typescript/src/lib/config.d.ts.map +0 -1
- package/src/components/biometrics/LivenessCameraView.tsx +0 -61
- /package/lib/typescript/{src/functions.d.ts → functions.d.ts} +0 -0
- /package/lib/typescript/{src/lib → lib}/colors.d.ts +0 -0
- /package/lib/typescript/{src/lib → lib}/config.d.ts +0 -0
|
@@ -7,429 +7,336 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _LivenessDetection = require("./LivenessDetection");
|
|
10
|
-
var
|
|
11
|
-
|
|
10
|
+
var _OmnipayLivenessCameraView = require("./OmnipayLivenessCameraView");
|
|
11
|
+
var _PermissionManager = require("./PermissionManager");
|
|
12
|
+
var _types = require("./types");
|
|
12
13
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
14
|
const FaceVerification = ({
|
|
14
15
|
onClose,
|
|
15
16
|
onSuccess,
|
|
16
17
|
primaryColor,
|
|
17
|
-
|
|
18
|
-
timeout = 300000 // 5 minutes default
|
|
18
|
+
config
|
|
19
19
|
}) => {
|
|
20
|
-
const [
|
|
21
|
-
const [
|
|
22
|
-
const [
|
|
23
|
-
const [
|
|
24
|
-
const [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
20
|
+
const [state, setState] = (0, _react.useState)('initializing');
|
|
21
|
+
const [error, setError] = (0, _react.useState)(null);
|
|
22
|
+
const [isSupported, setIsSupported] = (0, _react.useState)(false);
|
|
23
|
+
const [currentChallenge, setCurrentChallenge] = (0, _react.useState)(null);
|
|
24
|
+
const [challengeProgress, setChallengeProgress] = (0, _react.useState)('');
|
|
25
|
+
(0, _react.useEffect)(() => {
|
|
26
|
+
checkSupport();
|
|
27
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
28
|
+
}, []);
|
|
29
|
+
const checkSupport = async () => {
|
|
30
|
+
try {
|
|
31
|
+
const supported = await _LivenessDetection.LivenessDetection.isSupported();
|
|
32
|
+
setIsSupported(supported);
|
|
33
|
+
if (supported) {
|
|
34
|
+
await startDetection();
|
|
35
|
+
} else {
|
|
36
|
+
setState('failed');
|
|
37
|
+
setError('Liveness detection is not supported on this device');
|
|
38
|
+
}
|
|
39
|
+
} catch (err) {
|
|
40
|
+
setState('failed');
|
|
41
|
+
setError('Failed to initialize liveness detection');
|
|
39
42
|
}
|
|
40
43
|
};
|
|
41
|
-
const
|
|
44
|
+
const startDetection = async () => {
|
|
45
|
+
if (!isSupported) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
setState('starting');
|
|
49
|
+
setError(null);
|
|
42
50
|
try {
|
|
43
|
-
setDetectionState('starting');
|
|
44
|
-
setIsLoading(true);
|
|
45
|
-
setError('');
|
|
46
|
-
|
|
47
51
|
// Check and request camera permission first
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
52
|
+
const permissionResponse = await _PermissionManager.CameraPermissionManager.requestCameraPermission();
|
|
53
|
+
if (permissionResponse.result !== _PermissionManager.PermissionResult.GRANTED) {
|
|
54
|
+
setState('failed');
|
|
55
|
+
setError(permissionResponse.result === _PermissionManager.PermissionResult.BLOCKED ? 'Camera permission is blocked. Please enable it in device settings.' : 'Camera permission is required for face verification.');
|
|
56
|
+
return;
|
|
54
57
|
}
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
const livenessConfig = {
|
|
59
|
+
..._LivenessDetection.LivenessDetection.getDefaultConfig(),
|
|
60
|
+
...config
|
|
58
61
|
};
|
|
59
|
-
await _LivenessDetection.LivenessDetection.
|
|
62
|
+
const result = await _LivenessDetection.LivenessDetection.startDetection(livenessConfig, {
|
|
60
63
|
onChallengeStart: challenge => {
|
|
61
64
|
setCurrentChallenge(challenge);
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
setState('running');
|
|
66
|
+
setChallengeProgress(getChallengeInstruction(challenge));
|
|
64
67
|
},
|
|
65
|
-
onChallengeSuccess: challenge => {
|
|
66
|
-
|
|
68
|
+
onChallengeSuccess: (challenge, _challengeResult) => {
|
|
69
|
+
setChallengeProgress(`✓ ${getChallengeInstruction(challenge)} completed`);
|
|
67
70
|
},
|
|
68
71
|
onChallengeFailure: (challenge, reason) => {
|
|
69
|
-
|
|
70
|
-
// Continue with next challenge - the native module handles this
|
|
72
|
+
setError(`Failed: ${reason}, ${challenge}`);
|
|
71
73
|
},
|
|
72
|
-
onAllChallengesComplete:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
onAllChallengesComplete: () => {
|
|
75
|
+
setChallengeProgress('All challenges completed! Taking final photo...');
|
|
76
|
+
},
|
|
77
|
+
onScreenshotCaptured: _screenshot => {
|
|
78
|
+
// Screenshot captured, detection will complete soon
|
|
79
|
+
},
|
|
80
|
+
onDetectionFailed: reason => {
|
|
81
|
+
setError(reason);
|
|
82
|
+
setState('failed');
|
|
76
83
|
}
|
|
77
84
|
});
|
|
85
|
+
if (result.success) {
|
|
86
|
+
setState('completed');
|
|
87
|
+
setTimeout(() => {
|
|
88
|
+
onSuccess(result);
|
|
89
|
+
}, 1000); // Brief delay to show success state
|
|
90
|
+
} else {
|
|
91
|
+
setState('failed');
|
|
92
|
+
setError(result.failureReason || 'Face verification failed');
|
|
93
|
+
}
|
|
78
94
|
} catch (err) {
|
|
79
|
-
|
|
95
|
+
setState('failed');
|
|
80
96
|
setError(err instanceof Error ? err.message : 'Unknown error occurred');
|
|
81
|
-
setDetectionState('error');
|
|
82
|
-
setIsLoading(false);
|
|
83
|
-
}
|
|
84
|
-
}, [challenges, timeout, onSuccess]);
|
|
85
|
-
const handleClose = (0, _react.useCallback)(() => {
|
|
86
|
-
if (detectionState === 'active' || detectionState === 'starting') {
|
|
87
|
-
_LivenessDetection.LivenessDetection.stopDetection();
|
|
88
97
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const timer = setTimeout(() => {
|
|
103
|
-
startLivenessDetection();
|
|
104
|
-
}, 500);
|
|
105
|
-
return () => clearTimeout(timer);
|
|
98
|
+
};
|
|
99
|
+
const getChallengeInstruction = challenge => {
|
|
100
|
+
switch (challenge) {
|
|
101
|
+
case _types.LivenessChallenge.SMILE:
|
|
102
|
+
return 'Please smile';
|
|
103
|
+
case _types.LivenessChallenge.BLINK:
|
|
104
|
+
return 'Please blink';
|
|
105
|
+
case _types.LivenessChallenge.TURN_LEFT:
|
|
106
|
+
return 'Please turn your head left';
|
|
107
|
+
case _types.LivenessChallenge.TURN_RIGHT:
|
|
108
|
+
return 'Please turn your head right';
|
|
109
|
+
default:
|
|
110
|
+
return 'Follow the instruction';
|
|
106
111
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}, "Detection Failed"), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
123
|
-
style: styles.errorSubtitle
|
|
124
|
-
}, error), /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
125
|
-
style: [styles.button, {
|
|
126
|
-
backgroundColor: primaryColor
|
|
127
|
-
}],
|
|
128
|
-
onPress: handleRetry
|
|
129
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
130
|
-
style: styles.buttonText
|
|
131
|
-
}, "Try Again")));
|
|
112
|
+
};
|
|
113
|
+
const getStateMessage = () => {
|
|
114
|
+
switch (state) {
|
|
115
|
+
case 'initializing':
|
|
116
|
+
return 'Initializing camera...';
|
|
117
|
+
case 'starting':
|
|
118
|
+
return 'Starting face verification...';
|
|
119
|
+
case 'running':
|
|
120
|
+
return challengeProgress || 'Look at the camera';
|
|
121
|
+
case 'completed':
|
|
122
|
+
return 'Face verification completed!';
|
|
123
|
+
case 'failed':
|
|
124
|
+
return error || 'Face verification failed';
|
|
125
|
+
default:
|
|
126
|
+
return 'Please wait...';
|
|
132
127
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
128
|
+
};
|
|
129
|
+
const getStateColor = () => {
|
|
130
|
+
switch (state) {
|
|
131
|
+
case 'completed':
|
|
132
|
+
return '#4CAF50';
|
|
133
|
+
case 'failed':
|
|
134
|
+
return '#F44336';
|
|
135
|
+
case 'running':
|
|
136
|
+
return primaryColor;
|
|
137
|
+
default:
|
|
138
|
+
return '#666';
|
|
141
139
|
}
|
|
142
|
-
return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
143
|
-
style: styles.contentContainer
|
|
144
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
145
|
-
style: styles.cameraContainer
|
|
146
|
-
}, /*#__PURE__*/_react.default.createElement(_LivenessCameraView.default, {
|
|
147
|
-
style: styles.camera,
|
|
148
|
-
scaleType: "fillCenter",
|
|
149
|
-
onCameraReady: () => console.log('Camera ready'),
|
|
150
|
-
onCameraError: error => {
|
|
151
|
-
console.error('Camera error:', error);
|
|
152
|
-
setError('Camera initialization failed');
|
|
153
|
-
setDetectionState('error');
|
|
154
|
-
}
|
|
155
|
-
}), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
156
|
-
style: styles.overlay
|
|
157
|
-
}, isLoading ? /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
158
|
-
style: styles.loadingContainer
|
|
159
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.ActivityIndicator, {
|
|
160
|
-
size: "large",
|
|
161
|
-
color: primaryColor
|
|
162
|
-
}), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
163
|
-
style: styles.loadingText
|
|
164
|
-
}, "Initializing camera...")) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, currentChallenge && /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
165
|
-
style: styles.instructionContainer
|
|
166
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
167
|
-
style: styles.instructionText
|
|
168
|
-
}, getChallengeInstruction(currentChallenge))), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
169
|
-
style: styles.progressContainer
|
|
170
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
171
|
-
style: styles.progressText
|
|
172
|
-
}, completedChallenges.length, " / ", challenges.length, " completed"), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
173
|
-
style: styles.progressBar
|
|
174
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
175
|
-
style: [styles.progressFill, {
|
|
176
|
-
width: `${completedChallenges.length / challenges.length * 100}%`,
|
|
177
|
-
backgroundColor: primaryColor
|
|
178
|
-
}]
|
|
179
|
-
})))))));
|
|
180
140
|
};
|
|
141
|
+
const handleRetry = () => {
|
|
142
|
+
setState('initializing');
|
|
143
|
+
setError(null);
|
|
144
|
+
setCurrentChallenge(null);
|
|
145
|
+
setChallengeProgress('');
|
|
146
|
+
checkSupport();
|
|
147
|
+
};
|
|
148
|
+
const showRetryButton = state === 'failed' && error !== 'Camera permission is blocked. Please enable it in device settings.';
|
|
181
149
|
return /*#__PURE__*/_react.default.createElement(_reactNative.Modal, {
|
|
182
150
|
visible: true,
|
|
183
151
|
transparent: true,
|
|
184
|
-
onRequestClose:
|
|
185
|
-
style: styles.modal
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
152
|
+
onRequestClose: onClose,
|
|
153
|
+
style: styles.modal
|
|
154
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
155
|
+
style: styles.backdrop,
|
|
156
|
+
activeOpacity: 1,
|
|
157
|
+
onPress: () => {}
|
|
189
158
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
190
|
-
style: styles.container
|
|
191
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.
|
|
192
|
-
style: styles.
|
|
159
|
+
style: [styles.container]
|
|
160
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
161
|
+
style: styles.close,
|
|
162
|
+
onPress: onClose
|
|
163
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
|
|
164
|
+
source: require('../../assets/cancel.png'),
|
|
165
|
+
style: styles.closeIcon
|
|
166
|
+
})), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
167
|
+
style: styles.contentContainer
|
|
193
168
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
194
169
|
style: styles.title
|
|
195
|
-
}, "Face Verification"), /*#__PURE__*/_react.default.createElement(_reactNative.
|
|
196
|
-
|
|
197
|
-
|
|
170
|
+
}, "Face Verification"), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
171
|
+
style: styles.cameraContainer
|
|
172
|
+
}, state === 'running' && isSupported ? /*#__PURE__*/_react.default.createElement(_OmnipayLivenessCameraView.OmnipayLivenessCameraView, {
|
|
173
|
+
style: styles.camera
|
|
174
|
+
}) : /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
175
|
+
style: [styles.camera, styles.cameraPlaceholder]
|
|
176
|
+
}, state === 'initializing' || state === 'starting' ? /*#__PURE__*/_react.default.createElement(_reactNative.ActivityIndicator, {
|
|
177
|
+
size: "large",
|
|
178
|
+
color: primaryColor
|
|
179
|
+
}) : state === 'completed' ? /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
180
|
+
style: styles.successIcon
|
|
181
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
182
|
+
style: styles.successText
|
|
183
|
+
}, "\u2713")) : /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
184
|
+
style: styles.errorIcon
|
|
185
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
186
|
+
style: styles.errorText
|
|
187
|
+
}, "!"))), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
188
|
+
style: styles.overlay
|
|
189
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
190
|
+
style: [styles.instruction, {
|
|
191
|
+
color: getStateColor()
|
|
192
|
+
}]
|
|
193
|
+
}, getStateMessage()))), state === 'running' && currentChallenge && /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
194
|
+
style: styles.progressContainer
|
|
198
195
|
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
199
|
-
style: styles.
|
|
200
|
-
},
|
|
196
|
+
style: styles.challengeText
|
|
197
|
+
}, getChallengeInstruction(currentChallenge))), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
|
|
198
|
+
style: styles.buttonContainer
|
|
199
|
+
}, showRetryButton && /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
200
|
+
style: [styles.retryButton, {
|
|
201
|
+
backgroundColor: primaryColor
|
|
202
|
+
}],
|
|
203
|
+
onPress: handleRetry
|
|
204
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
205
|
+
style: styles.retryButtonText
|
|
206
|
+
}, "Try Again")))))));
|
|
201
207
|
};
|
|
202
|
-
|
|
208
|
+
const {
|
|
209
|
+
width: screenWidth,
|
|
210
|
+
height: screenHeight
|
|
211
|
+
} = _reactNative.Dimensions.get('window');
|
|
203
212
|
const styles = _reactNative.StyleSheet.create({
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
},
|
|
207
|
-
full: {
|
|
208
|
-
flex: 1,
|
|
209
|
-
width: '100%',
|
|
210
|
-
height: '100%'
|
|
211
|
-
},
|
|
212
|
-
webview: {
|
|
213
|
-
flex: 1,
|
|
214
|
-
width: '100%',
|
|
215
|
-
height: _reactNative.Dimensions.get('window').height - 40,
|
|
216
|
-
backgroundColor: 'white',
|
|
217
|
-
borderTopRightRadius: 20,
|
|
218
|
-
borderTopLeftRadius: 20,
|
|
219
|
-
paddingTop: 150
|
|
220
|
-
},
|
|
221
|
-
webviewLoader: {
|
|
222
|
-
zIndex: 3,
|
|
223
|
-
backgroundColor: 'white',
|
|
224
|
-
alignItems: 'center',
|
|
225
|
-
justifyContent: 'center',
|
|
226
|
-
flex: 1,
|
|
227
|
-
width: '100%',
|
|
228
|
-
height: '100%',
|
|
229
|
-
position: 'absolute',
|
|
230
|
-
top: 0,
|
|
231
|
-
left: 0,
|
|
232
|
-
borderTopRightRadius: 20,
|
|
233
|
-
borderTopLeftRadius: 20
|
|
213
|
+
modal: {
|
|
214
|
+
margin: 0
|
|
234
215
|
},
|
|
235
216
|
backdrop: {
|
|
236
|
-
backgroundColor: 'rgba(0,0,0,0.48)',
|
|
237
217
|
flex: 1,
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
218
|
+
backgroundColor: 'rgba(0, 0, 0, 0.8)',
|
|
219
|
+
justifyContent: 'center',
|
|
220
|
+
alignItems: 'center'
|
|
241
221
|
},
|
|
242
222
|
container: {
|
|
223
|
+
width: screenWidth * 0.9,
|
|
224
|
+
maxHeight: screenHeight * 0.8,
|
|
243
225
|
backgroundColor: 'white',
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
flex: 1,
|
|
248
|
-
position: 'relative',
|
|
249
|
-
...(_reactNative.Platform.OS === 'android' && {
|
|
250
|
-
overflow: 'hidden'
|
|
251
|
-
})
|
|
252
|
-
},
|
|
253
|
-
modal: {
|
|
254
|
-
flex: 1,
|
|
255
|
-
backgroundColor: 'rgba(0,0,0,0.48)',
|
|
256
|
-
height: '100%',
|
|
257
|
-
width: '100%'
|
|
226
|
+
borderRadius: 16,
|
|
227
|
+
padding: 20,
|
|
228
|
+
alignItems: 'center'
|
|
258
229
|
},
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
borderBottomColor: '#f0f0f0'
|
|
230
|
+
close: {
|
|
231
|
+
position: 'absolute',
|
|
232
|
+
top: 15,
|
|
233
|
+
right: 15,
|
|
234
|
+
zIndex: 10,
|
|
235
|
+
padding: 5
|
|
266
236
|
},
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
237
|
+
closeIcon: {
|
|
238
|
+
width: 20,
|
|
239
|
+
height: 20,
|
|
240
|
+
tintColor: '#666'
|
|
271
241
|
},
|
|
272
|
-
|
|
273
|
-
width:
|
|
274
|
-
height: 30,
|
|
275
|
-
borderRadius: 15,
|
|
276
|
-
backgroundColor: '#f0f0f0',
|
|
242
|
+
contentContainer: {
|
|
243
|
+
width: '100%',
|
|
277
244
|
alignItems: 'center',
|
|
278
|
-
|
|
245
|
+
paddingTop: 20
|
|
279
246
|
},
|
|
280
|
-
|
|
281
|
-
fontSize:
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
247
|
+
title: {
|
|
248
|
+
fontSize: 24,
|
|
249
|
+
fontWeight: 'bold',
|
|
250
|
+
color: '#333',
|
|
251
|
+
marginBottom: 20,
|
|
252
|
+
textAlign: 'center'
|
|
286
253
|
},
|
|
287
254
|
cameraContainer: {
|
|
288
|
-
|
|
289
|
-
|
|
255
|
+
width: screenWidth * 0.7,
|
|
256
|
+
height: screenWidth * 0.9,
|
|
257
|
+
borderRadius: 12,
|
|
258
|
+
overflow: 'hidden',
|
|
259
|
+
backgroundColor: '#f0f0f0',
|
|
260
|
+
position: 'relative',
|
|
261
|
+
marginBottom: 20
|
|
290
262
|
},
|
|
291
263
|
camera: {
|
|
292
264
|
flex: 1,
|
|
293
265
|
width: '100%',
|
|
294
266
|
height: '100%'
|
|
295
267
|
},
|
|
268
|
+
cameraPlaceholder: {
|
|
269
|
+
justifyContent: 'center',
|
|
270
|
+
alignItems: 'center',
|
|
271
|
+
backgroundColor: '#f5f5f5'
|
|
272
|
+
},
|
|
296
273
|
overlay: {
|
|
297
274
|
position: 'absolute',
|
|
298
|
-
|
|
275
|
+
bottom: 0,
|
|
299
276
|
left: 0,
|
|
300
277
|
right: 0,
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
alignItems: 'center',
|
|
304
|
-
paddingVertical: 40,
|
|
305
|
-
paddingHorizontal: 20
|
|
306
|
-
},
|
|
307
|
-
loadingContainer: {
|
|
308
|
-
flex: 1,
|
|
309
|
-
justifyContent: 'center',
|
|
278
|
+
backgroundColor: 'rgba(0, 0, 0, 0.7)',
|
|
279
|
+
padding: 15,
|
|
310
280
|
alignItems: 'center'
|
|
311
281
|
},
|
|
312
|
-
|
|
313
|
-
color: 'white',
|
|
314
|
-
fontSize: 16,
|
|
315
|
-
marginTop: 12,
|
|
316
|
-
textAlign: 'center'
|
|
317
|
-
},
|
|
318
|
-
instructionContainer: {
|
|
319
|
-
backgroundColor: 'rgba(0,0,0,0.7)',
|
|
320
|
-
paddingHorizontal: 20,
|
|
321
|
-
paddingVertical: 12,
|
|
322
|
-
borderRadius: 8,
|
|
323
|
-
marginTop: 20
|
|
324
|
-
},
|
|
325
|
-
instructionText: {
|
|
326
|
-
color: 'white',
|
|
282
|
+
instruction: {
|
|
327
283
|
fontSize: 16,
|
|
328
|
-
fontWeight: '500',
|
|
329
|
-
textAlign: 'center'
|
|
330
|
-
},
|
|
331
|
-
progressContainer: {
|
|
332
|
-
backgroundColor: 'rgba(0,0,0,0.7)',
|
|
333
|
-
paddingHorizontal: 20,
|
|
334
|
-
paddingVertical: 12,
|
|
335
|
-
borderRadius: 8,
|
|
336
|
-
minWidth: 200
|
|
337
|
-
},
|
|
338
|
-
progressText: {
|
|
339
|
-
color: 'white',
|
|
340
|
-
fontSize: 14,
|
|
341
|
-
textAlign: 'center',
|
|
342
|
-
marginBottom: 8
|
|
343
|
-
},
|
|
344
|
-
progressBar: {
|
|
345
|
-
height: 4,
|
|
346
|
-
backgroundColor: 'rgba(255,255,255,0.3)',
|
|
347
|
-
borderRadius: 2,
|
|
348
|
-
overflow: 'hidden'
|
|
349
|
-
},
|
|
350
|
-
progressFill: {
|
|
351
|
-
height: '100%',
|
|
352
|
-
borderRadius: 2
|
|
353
|
-
},
|
|
354
|
-
errorContainer: {
|
|
355
|
-
flex: 1,
|
|
356
|
-
justifyContent: 'center',
|
|
357
|
-
alignItems: 'center',
|
|
358
|
-
paddingHorizontal: 20
|
|
359
|
-
},
|
|
360
|
-
errorTitle: {
|
|
361
|
-
fontSize: 20,
|
|
362
284
|
fontWeight: '600',
|
|
363
|
-
color: '#d32f2f',
|
|
364
|
-
marginBottom: 8,
|
|
365
|
-
textAlign: 'center'
|
|
366
|
-
},
|
|
367
|
-
errorSubtitle: {
|
|
368
285
|
textAlign: 'center',
|
|
369
|
-
|
|
370
|
-
color: '#5e7079',
|
|
371
|
-
marginBottom: 20,
|
|
372
|
-
paddingHorizontal: 8
|
|
286
|
+
color: 'white'
|
|
373
287
|
},
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
alignItems: 'center',
|
|
378
|
-
paddingHorizontal: 20
|
|
288
|
+
progressContainer: {
|
|
289
|
+
marginBottom: 20,
|
|
290
|
+
alignItems: 'center'
|
|
379
291
|
},
|
|
380
|
-
|
|
381
|
-
fontSize:
|
|
292
|
+
challengeText: {
|
|
293
|
+
fontSize: 18,
|
|
382
294
|
fontWeight: '600',
|
|
383
|
-
color: '#
|
|
384
|
-
marginBottom: 8,
|
|
295
|
+
color: '#333',
|
|
385
296
|
textAlign: 'center'
|
|
386
297
|
},
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
fontSize: 14,
|
|
390
|
-
color: '#5e7079',
|
|
391
|
-
paddingHorizontal: 8
|
|
392
|
-
},
|
|
393
|
-
close: {
|
|
394
|
-
position: 'absolute',
|
|
395
|
-
top: 10,
|
|
396
|
-
right: 10,
|
|
397
|
-
backgroundColor: 'white',
|
|
398
|
-
height: 24,
|
|
399
|
-
width: 24,
|
|
400
|
-
borderRadius: 1000,
|
|
401
|
-
alignItems: 'center',
|
|
298
|
+
buttonContainer: {
|
|
299
|
+
flexDirection: 'row',
|
|
402
300
|
justifyContent: 'center',
|
|
403
|
-
|
|
301
|
+
gap: 15
|
|
404
302
|
},
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
303
|
+
retryButton: {
|
|
304
|
+
paddingHorizontal: 30,
|
|
305
|
+
paddingVertical: 12,
|
|
306
|
+
borderRadius: 8,
|
|
307
|
+
alignItems: 'center'
|
|
408
308
|
},
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
309
|
+
retryButtonText: {
|
|
310
|
+
color: 'white',
|
|
311
|
+
fontSize: 16,
|
|
312
|
+
fontWeight: '600'
|
|
412
313
|
},
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
314
|
+
successIcon: {
|
|
315
|
+
width: 60,
|
|
316
|
+
height: 60,
|
|
317
|
+
borderRadius: 30,
|
|
318
|
+
backgroundColor: '#4CAF50',
|
|
319
|
+
justifyContent: 'center',
|
|
320
|
+
alignItems: 'center'
|
|
416
321
|
},
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
322
|
+
successText: {
|
|
323
|
+
fontSize: 30,
|
|
324
|
+
color: 'white',
|
|
325
|
+
fontWeight: 'bold'
|
|
420
326
|
},
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
327
|
+
errorIcon: {
|
|
328
|
+
width: 60,
|
|
329
|
+
height: 60,
|
|
330
|
+
borderRadius: 30,
|
|
331
|
+
backgroundColor: '#F44336',
|
|
426
332
|
justifyContent: 'center',
|
|
427
|
-
|
|
333
|
+
alignItems: 'center'
|
|
428
334
|
},
|
|
429
|
-
|
|
335
|
+
errorText: {
|
|
336
|
+
fontSize: 30,
|
|
430
337
|
color: 'white',
|
|
431
|
-
|
|
432
|
-
fontWeight: '600'
|
|
338
|
+
fontWeight: 'bold'
|
|
433
339
|
}
|
|
434
340
|
});
|
|
341
|
+
var _default = exports.default = FaceVerification;
|
|
435
342
|
//# sourceMappingURL=FaceVerification.js.map
|