@hexar/biometric-identity-sdk-react-native 1.0.0
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 +68 -0
- package/dist/components/BiometricIdentityFlow.d.ts +17 -0
- package/dist/components/BiometricIdentityFlow.d.ts.map +1 -0
- package/dist/components/BiometricIdentityFlow.js +366 -0
- package/dist/components/CameraCapture.d.ts +15 -0
- package/dist/components/CameraCapture.d.ts.map +1 -0
- package/dist/components/CameraCapture.js +238 -0
- package/dist/components/ErrorScreen.d.ts +15 -0
- package/dist/components/ErrorScreen.d.ts.map +1 -0
- package/dist/components/ErrorScreen.js +142 -0
- package/dist/components/InstructionsScreen.d.ts +14 -0
- package/dist/components/InstructionsScreen.d.ts.map +1 -0
- package/dist/components/InstructionsScreen.js +181 -0
- package/dist/components/ResultScreen.d.ts +15 -0
- package/dist/components/ResultScreen.d.ts.map +1 -0
- package/dist/components/ResultScreen.js +182 -0
- package/dist/components/ValidationProgress.d.ts +14 -0
- package/dist/components/ValidationProgress.d.ts.map +1 -0
- package/dist/components/ValidationProgress.js +143 -0
- package/dist/components/VideoRecorder.d.ts +43 -0
- package/dist/components/VideoRecorder.d.ts.map +1 -0
- package/dist/components/VideoRecorder.js +631 -0
- package/dist/hooks/useBiometricSDK.d.ts +25 -0
- package/dist/hooks/useBiometricSDK.d.ts.map +1 -0
- package/dist/hooks/useBiometricSDK.js +173 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +47 -0
- package/package.json +27 -0
- package/src/components/BiometricIdentityFlow.tsx +557 -0
- package/src/components/CameraCapture.tsx +262 -0
- package/src/components/ErrorScreen.tsx +201 -0
- package/src/components/InstructionsScreen.tsx +269 -0
- package/src/components/ResultScreen.tsx +301 -0
- package/src/components/ValidationProgress.tsx +223 -0
- package/src/components/VideoRecorder.tsx +794 -0
- package/src/hooks/useBiometricSDK.ts +230 -0
- package/src/index.ts +24 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation Progress Component
|
|
3
|
+
* Shows AI validation progress
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import {
|
|
8
|
+
View,
|
|
9
|
+
Text,
|
|
10
|
+
StyleSheet,
|
|
11
|
+
ActivityIndicator,
|
|
12
|
+
} from 'react-native';
|
|
13
|
+
import { ThemeConfig, SupportedLanguage } from '@hexar/biometric-identity-sdk-core';
|
|
14
|
+
|
|
15
|
+
export interface ValidationProgressProps {
|
|
16
|
+
progress: number;
|
|
17
|
+
theme?: ThemeConfig;
|
|
18
|
+
language?: SupportedLanguage;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const ValidationProgress: React.FC<ValidationProgressProps> = ({
|
|
22
|
+
progress,
|
|
23
|
+
theme,
|
|
24
|
+
language = 'en',
|
|
25
|
+
}) => {
|
|
26
|
+
const getStatusText = () => {
|
|
27
|
+
if (progress < 80) return language === 'es' ? 'Extrayendo datos del documento...' : 'Extracting document data...';
|
|
28
|
+
if (progress < 85) return language === 'es' ? 'Validando presencia vital...' : 'Validating liveness...';
|
|
29
|
+
if (progress < 90) return language === 'es' ? 'Detectando rostro en documento...' : 'Detecting face in document...';
|
|
30
|
+
if (progress < 95) return language === 'es' ? 'Comparando rostros...' : 'Comparing faces...';
|
|
31
|
+
return language === 'es' ? 'Validando autenticidad del documento...' : 'Validating document authenticity...';
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<View style={styles.container}>
|
|
36
|
+
<View style={styles.content}>
|
|
37
|
+
<ActivityIndicator
|
|
38
|
+
size="large"
|
|
39
|
+
color={theme?.primaryColor || '#6366F1'}
|
|
40
|
+
/>
|
|
41
|
+
|
|
42
|
+
<Text style={[styles.title, { color: theme?.textColor || '#000000' }]}>
|
|
43
|
+
{language === 'es' ? 'Validando Identidad' : 'Validating Identity'}
|
|
44
|
+
</Text>
|
|
45
|
+
|
|
46
|
+
<Text style={[styles.statusText, { color: theme?.secondaryTextColor || '#6B7280' }]}>
|
|
47
|
+
{getStatusText()}
|
|
48
|
+
</Text>
|
|
49
|
+
|
|
50
|
+
{/* Progress Bar */}
|
|
51
|
+
<View style={styles.progressBarContainer}>
|
|
52
|
+
<View style={styles.progressBar}>
|
|
53
|
+
<View
|
|
54
|
+
style={[
|
|
55
|
+
styles.progressFill,
|
|
56
|
+
{
|
|
57
|
+
width: `${progress}%`,
|
|
58
|
+
backgroundColor: theme?.primaryColor || '#6366F1',
|
|
59
|
+
},
|
|
60
|
+
]}
|
|
61
|
+
/>
|
|
62
|
+
</View>
|
|
63
|
+
<Text style={[styles.progressText, { color: theme?.textColor || '#000000' }]}>
|
|
64
|
+
{Math.round(progress)}%
|
|
65
|
+
</Text>
|
|
66
|
+
</View>
|
|
67
|
+
|
|
68
|
+
{/* Validation Steps */}
|
|
69
|
+
<View style={styles.stepsContainer}>
|
|
70
|
+
<ValidationStep
|
|
71
|
+
icon="✓"
|
|
72
|
+
text={language === 'es' ? 'Extracción OCR' : 'OCR Extraction'}
|
|
73
|
+
completed={progress >= 80}
|
|
74
|
+
theme={theme}
|
|
75
|
+
/>
|
|
76
|
+
<ValidationStep
|
|
77
|
+
icon="✓"
|
|
78
|
+
text={language === 'es' ? 'Detección de Presencia Vital' : 'Liveness Detection'}
|
|
79
|
+
completed={progress >= 85}
|
|
80
|
+
theme={theme}
|
|
81
|
+
/>
|
|
82
|
+
<ValidationStep
|
|
83
|
+
icon="✓"
|
|
84
|
+
text={language === 'es' ? 'Coincidencia Facial' : 'Face Matching'}
|
|
85
|
+
completed={progress >= 95}
|
|
86
|
+
theme={theme}
|
|
87
|
+
/>
|
|
88
|
+
<ValidationStep
|
|
89
|
+
icon="✓"
|
|
90
|
+
text={language === 'es' ? 'Validación de Documento' : 'Document Validation'}
|
|
91
|
+
completed={progress >= 100}
|
|
92
|
+
theme={theme}
|
|
93
|
+
/>
|
|
94
|
+
</View>
|
|
95
|
+
|
|
96
|
+
<Text style={styles.bottomText}>
|
|
97
|
+
{language === 'es'
|
|
98
|
+
? 'Esto puede tomar unos segundos...'
|
|
99
|
+
: 'This may take a few seconds...'}
|
|
100
|
+
</Text>
|
|
101
|
+
</View>
|
|
102
|
+
</View>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
interface ValidationStepProps {
|
|
107
|
+
icon: string;
|
|
108
|
+
text: string;
|
|
109
|
+
completed: boolean;
|
|
110
|
+
theme?: ThemeConfig;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const ValidationStep: React.FC<ValidationStepProps> = ({
|
|
114
|
+
icon,
|
|
115
|
+
text,
|
|
116
|
+
completed,
|
|
117
|
+
theme,
|
|
118
|
+
}) => (
|
|
119
|
+
<View style={stepStyles.container}>
|
|
120
|
+
<View
|
|
121
|
+
style={[
|
|
122
|
+
stepStyles.iconContainer,
|
|
123
|
+
completed && {
|
|
124
|
+
backgroundColor: theme?.successColor || '#10B981',
|
|
125
|
+
},
|
|
126
|
+
]}
|
|
127
|
+
>
|
|
128
|
+
{completed && <Text style={stepStyles.icon}>{icon}</Text>}
|
|
129
|
+
</View>
|
|
130
|
+
<Text style={[stepStyles.text, completed && stepStyles.textCompleted]}>
|
|
131
|
+
{text}
|
|
132
|
+
</Text>
|
|
133
|
+
</View>
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
const stepStyles = StyleSheet.create({
|
|
137
|
+
container: {
|
|
138
|
+
flexDirection: 'row',
|
|
139
|
+
alignItems: 'center',
|
|
140
|
+
marginVertical: 8,
|
|
141
|
+
},
|
|
142
|
+
iconContainer: {
|
|
143
|
+
width: 24,
|
|
144
|
+
height: 24,
|
|
145
|
+
borderRadius: 12,
|
|
146
|
+
backgroundColor: '#E5E7EB',
|
|
147
|
+
justifyContent: 'center',
|
|
148
|
+
alignItems: 'center',
|
|
149
|
+
marginRight: 12,
|
|
150
|
+
},
|
|
151
|
+
icon: {
|
|
152
|
+
color: '#FFFFFF',
|
|
153
|
+
fontSize: 14,
|
|
154
|
+
fontWeight: 'bold',
|
|
155
|
+
},
|
|
156
|
+
text: {
|
|
157
|
+
fontSize: 14,
|
|
158
|
+
color: '#9CA3AF',
|
|
159
|
+
},
|
|
160
|
+
textCompleted: {
|
|
161
|
+
color: '#111827',
|
|
162
|
+
fontWeight: '500',
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
const styles = StyleSheet.create({
|
|
167
|
+
container: {
|
|
168
|
+
flex: 1,
|
|
169
|
+
backgroundColor: '#FFFFFF',
|
|
170
|
+
justifyContent: 'center',
|
|
171
|
+
alignItems: 'center',
|
|
172
|
+
},
|
|
173
|
+
content: {
|
|
174
|
+
width: '85%',
|
|
175
|
+
alignItems: 'center',
|
|
176
|
+
},
|
|
177
|
+
title: {
|
|
178
|
+
fontSize: 24,
|
|
179
|
+
fontWeight: 'bold',
|
|
180
|
+
marginTop: 24,
|
|
181
|
+
marginBottom: 8,
|
|
182
|
+
},
|
|
183
|
+
statusText: {
|
|
184
|
+
fontSize: 16,
|
|
185
|
+
marginBottom: 32,
|
|
186
|
+
textAlign: 'center',
|
|
187
|
+
},
|
|
188
|
+
progressBarContainer: {
|
|
189
|
+
width: '100%',
|
|
190
|
+
marginBottom: 32,
|
|
191
|
+
},
|
|
192
|
+
progressBar: {
|
|
193
|
+
width: '100%',
|
|
194
|
+
height: 8,
|
|
195
|
+
backgroundColor: '#E5E7EB',
|
|
196
|
+
borderRadius: 4,
|
|
197
|
+
overflow: 'hidden',
|
|
198
|
+
marginBottom: 8,
|
|
199
|
+
},
|
|
200
|
+
progressFill: {
|
|
201
|
+
height: '100%',
|
|
202
|
+
borderRadius: 4,
|
|
203
|
+
},
|
|
204
|
+
progressText: {
|
|
205
|
+
fontSize: 14,
|
|
206
|
+
fontWeight: '600',
|
|
207
|
+
textAlign: 'center',
|
|
208
|
+
},
|
|
209
|
+
stepsContainer: {
|
|
210
|
+
width: '100%',
|
|
211
|
+
marginTop: 24,
|
|
212
|
+
marginBottom: 32,
|
|
213
|
+
},
|
|
214
|
+
bottomText: {
|
|
215
|
+
fontSize: 14,
|
|
216
|
+
color: '#9CA3AF',
|
|
217
|
+
textAlign: 'center',
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
export default ValidationProgress;
|
|
222
|
+
|
|
223
|
+
|