-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathApp.tsx
More file actions
146 lines (139 loc) · 3.12 KB
/
Copy pathApp.tsx
File metadata and controls
146 lines (139 loc) · 3.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
import React from 'react';
import { ComplyCube } from '@complycube/react-native';
import type { StartOptions } from '@complycube/react-native';
import { useCallback } from 'react';
import {
SafeAreaView,
StatusBar,
View,
Text,
StyleSheet,
TouchableOpacity,
} from 'react-native';
const id = 'CLIENT_ID';
const token = 'SDK_TOKEN';
const sdkSettings: Record<string, unknown> = {
stages: [
{
name: 'intro',
title: 'Welcome',
message: 'We will verify your identity.',
},
{
name: 'consent',
},
{
name: 'documentCapture',
nfcEnabled: true,
captureDocumentId: false,
showGuidance: true,
useLiveCaptureOnly: false,
useMLAssistance: true,
retryLimit: 3,
documentTypes: {
passport: true,
driving_license: ['GB', 'FR'],
national_identity_card: ['GB', 'FR'],
residence_permit: ['GB', 'FR'],
},
},
{
name: 'faceCapture',
mode: 'photo',
showGuidance: true,
useLiveCaptureOnly: false,
useMLAssistance: true,
retryLimit: 1,
},
// {
// name: 'faceCapture',
// mode: 'video',
// showGuidance: true,
// useLiveCaptureOnly: false,
// useMLAssistance: true,
// retryLimit: 1,
// },
{
name: 'poaCapture',
showGuidance: true,
useLiveCaptureOnly: false,
useMLAssistance: true,
retryLimit: 3,
isAddressCaptureEnabled: true,
documentTypes: {
bank_statement: true,
utility_bill: ['GB', 'FR'],
},
},
{
name: 'addressCapture',
allowedCountries: ['GB', 'FR'],
useAutoComplete: true,
},
{
name: 'complete',
title: 'Complete',
message: 'Verification finished.',
},
],
};
function App() {
const startVerification = useCallback(async () => {
const out = await ComplyCube.startSafe(
{
stages: [],
...sdkSettings,
clientID: id,
clientToken: token,
} as StartOptions,
);
if (__DEV__) {
// Keeps the example behavior visible while testing.
console.log('ComplyCube outcome:', out);
}
}, []);
return (
<SafeAreaView style={styles.safeArea}>
<StatusBar />
<View style={styles.container}>
<Text style={styles.header}>Identity Verification</Text>
<TouchableOpacity style={styles.button} onPress={startVerification}>
<Text style={styles.buttonText}>Start Verification</Text>
</TouchableOpacity>
</View>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
safeArea: {
flex: 1,
backgroundColor: '#fff',
},
container: {
flex: 1,
padding: 20,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#fff',
},
header: {
fontSize: 24,
fontWeight: 'bold',
textAlign: 'center',
marginBottom: 30,
color: '#333',
},
button: {
backgroundColor: '#007AFF',
padding: 15,
borderRadius: 8,
alignItems: 'center',
marginHorizontal: 20,
},
buttonText: {
color: 'white',
fontSize: 16,
fontWeight: '500',
},
});
export default App;