@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
package/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Biometric Identity SDK - React Native
|
|
2
|
+
|
|
3
|
+
React Native wrapper for the Biometric Identity SDK.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @hexar/biometric-identity-sdk-react-native
|
|
9
|
+
# or
|
|
10
|
+
yarn add @hexar/biometric-identity-sdk-react-native
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Peer Dependencies
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install react-native-vision-camera react-native-permissions
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### iOS Setup
|
|
20
|
+
|
|
21
|
+
Add to your `Info.plist`:
|
|
22
|
+
|
|
23
|
+
```xml
|
|
24
|
+
<key>NSCameraUsageDescription</key>
|
|
25
|
+
<string>We need camera access to capture your ID and verify your identity</string>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Android Setup
|
|
29
|
+
|
|
30
|
+
Add to your `AndroidManifest.xml`:
|
|
31
|
+
|
|
32
|
+
```xml
|
|
33
|
+
<uses-permission android:name="android.permission.CAMERA" />
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import { BiometricIdentityFlow } from '@hexar/biometric-identity-sdk-react-native';
|
|
40
|
+
|
|
41
|
+
function App() {
|
|
42
|
+
return (
|
|
43
|
+
<BiometricIdentityFlow
|
|
44
|
+
onValidationComplete={(result) => {
|
|
45
|
+
console.log('Validation complete:', result);
|
|
46
|
+
}}
|
|
47
|
+
onError={(error) => {
|
|
48
|
+
console.error('Validation error:', error);
|
|
49
|
+
}}
|
|
50
|
+
theme={{
|
|
51
|
+
primaryColor: '#6366F1',
|
|
52
|
+
backgroundColor: '#FFFFFF',
|
|
53
|
+
}}
|
|
54
|
+
language="en"
|
|
55
|
+
/>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Props
|
|
61
|
+
|
|
62
|
+
See main SDK documentation for detailed API reference.
|
|
63
|
+
|
|
64
|
+
## License
|
|
65
|
+
|
|
66
|
+
MIT
|
|
67
|
+
|
|
68
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Native Biometric Identity Flow Component
|
|
3
|
+
* Main UI component for identity verification with backend AI support
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { ValidationResult, ThemeConfig, BiometricError, SupportedLanguage } from '@hexar/biometric-identity-sdk-core';
|
|
7
|
+
export interface BiometricIdentityFlowProps {
|
|
8
|
+
onValidationComplete: (result: ValidationResult) => void;
|
|
9
|
+
onError: (error: BiometricError) => void;
|
|
10
|
+
theme?: ThemeConfig;
|
|
11
|
+
language?: SupportedLanguage;
|
|
12
|
+
customTranslations?: Record<string, string>;
|
|
13
|
+
smartLivenessMode?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const BiometricIdentityFlow: React.FC<BiometricIdentityFlowProps>;
|
|
16
|
+
export default BiometricIdentityFlow;
|
|
17
|
+
//# sourceMappingURL=BiometricIdentityFlow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BiometricIdentityFlow.d.ts","sourceRoot":"","sources":["../../src/components/BiometricIdentityFlow.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAA2C,MAAM,OAAO,CAAC;AAShE,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,cAAc,EAId,iBAAiB,EAClB,MAAM,oCAAoC,CAAC;AAU5C,MAAM,WAAW,0BAA0B;IACzC,oBAAoB,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACzD,OAAO,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IACzC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAkStE,CAAC;AAiOF,eAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* React Native Biometric Identity Flow Component
|
|
4
|
+
* Main UI component for identity verification with backend AI support
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.BiometricIdentityFlow = void 0;
|
|
41
|
+
const react_1 = __importStar(require("react"));
|
|
42
|
+
const react_native_1 = require("react-native");
|
|
43
|
+
const biometric_identity_sdk_core_1 = require("@hexar/biometric-identity-sdk-core");
|
|
44
|
+
const useBiometricSDK_1 = require("../hooks/useBiometricSDK");
|
|
45
|
+
const CameraCapture_1 = require("./CameraCapture");
|
|
46
|
+
const VideoRecorder_1 = require("./VideoRecorder");
|
|
47
|
+
const ValidationProgress_1 = require("./ValidationProgress");
|
|
48
|
+
const ResultScreen_1 = require("./ResultScreen");
|
|
49
|
+
const ErrorScreen_1 = require("./ErrorScreen");
|
|
50
|
+
const InstructionsScreen_1 = require("./InstructionsScreen");
|
|
51
|
+
const BiometricIdentityFlow = ({ onValidationComplete, onError, theme, language = 'en', customTranslations, smartLivenessMode = true, }) => {
|
|
52
|
+
const { sdk, state, isInitialized, isUsingBackend, challenges, uploadFrontID, uploadBackID, storeVideoRecording, fetchChallenges, validateIdentity, reset, } = (0, useBiometricSDK_1.useBiometricSDK)();
|
|
53
|
+
const [showCamera, setShowCamera] = (0, react_1.useState)(false);
|
|
54
|
+
const [cameraMode, setCameraMode] = (0, react_1.useState)('front');
|
|
55
|
+
const [showInstructions, setShowInstructions] = (0, react_1.useState)(true);
|
|
56
|
+
const [currentChallenges, setCurrentChallenges] = (0, react_1.useState)([]);
|
|
57
|
+
const [isLoadingChallenges, setIsLoadingChallenges] = (0, react_1.useState)(false);
|
|
58
|
+
(0, react_1.useEffect)(() => {
|
|
59
|
+
(0, biometric_identity_sdk_core_1.setLanguage)(language);
|
|
60
|
+
}, [language]);
|
|
61
|
+
const strings = (0, biometric_identity_sdk_core_1.getStrings)();
|
|
62
|
+
const styles = createStyles(theme);
|
|
63
|
+
// Handle validation result
|
|
64
|
+
(0, react_1.useEffect)(() => {
|
|
65
|
+
if (state.validationResult) {
|
|
66
|
+
onValidationComplete(state.validationResult);
|
|
67
|
+
}
|
|
68
|
+
}, [state.validationResult, onValidationComplete]);
|
|
69
|
+
// Handle error
|
|
70
|
+
(0, react_1.useEffect)(() => {
|
|
71
|
+
if (state.error) {
|
|
72
|
+
onError(state.error);
|
|
73
|
+
}
|
|
74
|
+
}, [state.error, onError]);
|
|
75
|
+
/**
|
|
76
|
+
* Start capture process
|
|
77
|
+
*/
|
|
78
|
+
const handleCaptureStart = (0, react_1.useCallback)(async (mode) => {
|
|
79
|
+
setCameraMode(mode);
|
|
80
|
+
// If video mode, fetch challenges first
|
|
81
|
+
if (mode === 'video' && smartLivenessMode && isUsingBackend) {
|
|
82
|
+
setIsLoadingChallenges(true);
|
|
83
|
+
try {
|
|
84
|
+
const challenges = await fetchChallenges('active');
|
|
85
|
+
setCurrentChallenges(challenges);
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
console.warn('Failed to fetch challenges, using defaults');
|
|
89
|
+
setCurrentChallenges(sdk.getDefaultChallenges());
|
|
90
|
+
}
|
|
91
|
+
setIsLoadingChallenges(false);
|
|
92
|
+
}
|
|
93
|
+
else if (mode === 'video' && smartLivenessMode) {
|
|
94
|
+
// Use default challenges for offline mode
|
|
95
|
+
setCurrentChallenges(sdk.getDefaultChallenges());
|
|
96
|
+
}
|
|
97
|
+
setShowCamera(true);
|
|
98
|
+
}, [smartLivenessMode, isUsingBackend, fetchChallenges, sdk]);
|
|
99
|
+
/**
|
|
100
|
+
* Handle capture completion
|
|
101
|
+
*/
|
|
102
|
+
const handleCaptureComplete = (0, react_1.useCallback)(async (data) => {
|
|
103
|
+
setShowCamera(false);
|
|
104
|
+
try {
|
|
105
|
+
if (cameraMode === 'front') {
|
|
106
|
+
await uploadFrontID(data);
|
|
107
|
+
}
|
|
108
|
+
else if (cameraMode === 'back') {
|
|
109
|
+
await uploadBackID(data);
|
|
110
|
+
}
|
|
111
|
+
else if (cameraMode === 'video') {
|
|
112
|
+
// Handle video recording result
|
|
113
|
+
const videoResult = data;
|
|
114
|
+
await storeVideoRecording({
|
|
115
|
+
frames: videoResult.frames,
|
|
116
|
+
duration: videoResult.duration,
|
|
117
|
+
instructionsFollowed: videoResult.instructionsFollowed,
|
|
118
|
+
qualityScore: videoResult.qualityScore,
|
|
119
|
+
challengesCompleted: videoResult.challengesCompleted,
|
|
120
|
+
sessionId: videoResult.sessionId,
|
|
121
|
+
});
|
|
122
|
+
// Automatically start validation after video
|
|
123
|
+
await validateIdentity();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
console.error('Capture error:', error);
|
|
128
|
+
onError({
|
|
129
|
+
name: 'BiometricError',
|
|
130
|
+
message: error instanceof Error ? error.message : 'Unknown error during capture',
|
|
131
|
+
code: 'LIVENESS_CHECK_FAILED',
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}, [cameraMode, uploadFrontID, uploadBackID, storeVideoRecording, validateIdentity, onError]);
|
|
135
|
+
/**
|
|
136
|
+
* Handle retry
|
|
137
|
+
*/
|
|
138
|
+
const handleRetry = (0, react_1.useCallback)(() => {
|
|
139
|
+
reset();
|
|
140
|
+
setCurrentChallenges([]);
|
|
141
|
+
setShowInstructions(true);
|
|
142
|
+
}, [reset]);
|
|
143
|
+
// Show loading while initializing
|
|
144
|
+
if (!isInitialized) {
|
|
145
|
+
return (react_1.default.createElement(react_native_1.SafeAreaView, { style: styles.container },
|
|
146
|
+
react_1.default.createElement(react_native_1.View, { style: styles.loadingFullScreen },
|
|
147
|
+
react_1.default.createElement(react_native_1.ActivityIndicator, { size: "large", color: theme?.primaryColor || '#6366F1' }),
|
|
148
|
+
react_1.default.createElement(react_native_1.Text, { style: styles.loadingText }, strings.initialization.initializing))));
|
|
149
|
+
}
|
|
150
|
+
// Show instructions on first load
|
|
151
|
+
if (showInstructions) {
|
|
152
|
+
return (react_1.default.createElement(InstructionsScreen_1.InstructionsScreen, { theme: theme, language: language, onStart: () => setShowInstructions(false) }));
|
|
153
|
+
}
|
|
154
|
+
// Show camera/video recorder
|
|
155
|
+
if (showCamera) {
|
|
156
|
+
if (cameraMode === 'video') {
|
|
157
|
+
return (react_1.default.createElement(VideoRecorder_1.VideoRecorder, { theme: theme, challenges: currentChallenges, smartMode: smartLivenessMode, sessionId: sdk.getSessionId() || undefined, onComplete: handleCaptureComplete, onCancel: () => setShowCamera(false), onFetchChallenges: async () => {
|
|
158
|
+
const challenges = await fetchChallenges('active');
|
|
159
|
+
return challenges;
|
|
160
|
+
} }));
|
|
161
|
+
}
|
|
162
|
+
return (react_1.default.createElement(CameraCapture_1.CameraCapture, { mode: cameraMode, theme: theme, onCapture: handleCaptureComplete, onCancel: () => setShowCamera(false) }));
|
|
163
|
+
}
|
|
164
|
+
// Show validation progress
|
|
165
|
+
if (state.currentStep === biometric_identity_sdk_core_1.SDKStep.VALIDATING) {
|
|
166
|
+
return (react_1.default.createElement(ValidationProgress_1.ValidationProgress, { progress: state.progress, theme: theme, language: language }));
|
|
167
|
+
}
|
|
168
|
+
// Show result
|
|
169
|
+
if (state.currentStep === biometric_identity_sdk_core_1.SDKStep.RESULT && state.validationResult) {
|
|
170
|
+
return (react_1.default.createElement(ResultScreen_1.ResultScreen, { result: state.validationResult, theme: theme, language: language, onClose: () => onValidationComplete(state.validationResult) }));
|
|
171
|
+
}
|
|
172
|
+
// Show error
|
|
173
|
+
if (state.currentStep === biometric_identity_sdk_core_1.SDKStep.ERROR && state.error) {
|
|
174
|
+
return (react_1.default.createElement(ErrorScreen_1.ErrorScreen, { error: state.error, theme: theme, language: language, onRetry: handleRetry, onClose: () => onError(state.error) }));
|
|
175
|
+
}
|
|
176
|
+
return (react_1.default.createElement(react_native_1.SafeAreaView, { style: styles.container },
|
|
177
|
+
react_1.default.createElement(react_native_1.View, { style: styles.content },
|
|
178
|
+
react_1.default.createElement(react_native_1.Text, { style: styles.title }, strings.instructions.title),
|
|
179
|
+
react_1.default.createElement(react_native_1.Text, { style: styles.subtitle }, strings.instructions.subtitle),
|
|
180
|
+
isUsingBackend && (react_1.default.createElement(react_native_1.View, { style: styles.backendBadge },
|
|
181
|
+
react_1.default.createElement(react_native_1.View, { style: styles.backendDot }),
|
|
182
|
+
react_1.default.createElement(react_native_1.Text, { style: styles.backendText }, strings.badges.secureVerification))),
|
|
183
|
+
react_1.default.createElement(react_native_1.View, { style: styles.progressContainer },
|
|
184
|
+
react_1.default.createElement(StepIndicator, { step: 1, active: state.currentStep === biometric_identity_sdk_core_1.SDKStep.CAPTURE_FRONT_ID, completed: !!state.frontID, label: strings.steps.frontId, theme: theme }),
|
|
185
|
+
react_1.default.createElement(react_native_1.View, { style: styles.stepConnector }),
|
|
186
|
+
react_1.default.createElement(StepIndicator, { step: 2, active: state.currentStep === biometric_identity_sdk_core_1.SDKStep.CAPTURE_BACK_ID, completed: !!state.backID, label: strings.steps.backId, theme: theme }),
|
|
187
|
+
react_1.default.createElement(react_native_1.View, { style: styles.stepConnector }),
|
|
188
|
+
react_1.default.createElement(StepIndicator, { step: 3, active: state.currentStep === biometric_identity_sdk_core_1.SDKStep.RECORD_LIVENESS, completed: !!state.videoData, label: strings.steps.faceVideo, theme: theme })),
|
|
189
|
+
react_1.default.createElement(react_native_1.View, { style: styles.actionsContainer },
|
|
190
|
+
!state.frontID && (react_1.default.createElement(ActionButton, { title: strings.capture.frontId.button, subtitle: strings.capture.frontId.instruction, onPress: () => handleCaptureStart('front'), theme: theme, disabled: state.isLoading })),
|
|
191
|
+
state.frontID && !state.backID && (react_1.default.createElement(ActionButton, { title: strings.capture.backId.button, subtitle: strings.capture.backId.instruction, onPress: () => handleCaptureStart('back'), theme: theme, disabled: state.isLoading })),
|
|
192
|
+
state.frontID && state.backID && !state.videoData && (react_1.default.createElement(ActionButton, { title: strings.liveness.title, subtitle: strings.liveness.instructions.stayStill, onPress: () => handleCaptureStart('video'), theme: theme, disabled: state.isLoading || isLoadingChallenges }))),
|
|
193
|
+
(state.isLoading || isLoadingChallenges) && (react_1.default.createElement(react_native_1.View, { style: styles.loadingContainer },
|
|
194
|
+
react_1.default.createElement(react_native_1.ActivityIndicator, { size: "large", color: theme?.primaryColor || '#6366F1' }),
|
|
195
|
+
react_1.default.createElement(react_native_1.Text, { style: styles.loadingText }, isLoadingChallenges ? strings.liveness.preparing : strings.common.loading))))));
|
|
196
|
+
};
|
|
197
|
+
exports.BiometricIdentityFlow = BiometricIdentityFlow;
|
|
198
|
+
const StepIndicator = ({ step, active, completed, label, theme, }) => {
|
|
199
|
+
const primaryColor = theme?.primaryColor || '#6366F1';
|
|
200
|
+
const successColor = theme?.successColor || '#10B981';
|
|
201
|
+
return (react_1.default.createElement(react_native_1.View, { style: stepStyles.container },
|
|
202
|
+
react_1.default.createElement(react_native_1.View, { style: [
|
|
203
|
+
stepStyles.circle,
|
|
204
|
+
active && { backgroundColor: primaryColor, borderColor: primaryColor },
|
|
205
|
+
completed && { backgroundColor: successColor, borderColor: successColor },
|
|
206
|
+
] },
|
|
207
|
+
react_1.default.createElement(react_native_1.Text, { style: [stepStyles.stepNumber, (active || completed) && stepStyles.stepNumberActive] }, completed ? '✓' : step)),
|
|
208
|
+
react_1.default.createElement(react_native_1.Text, { style: [stepStyles.label, active && { color: primaryColor }] }, label)));
|
|
209
|
+
};
|
|
210
|
+
const stepStyles = react_native_1.StyleSheet.create({
|
|
211
|
+
container: {
|
|
212
|
+
alignItems: 'center',
|
|
213
|
+
flex: 1,
|
|
214
|
+
},
|
|
215
|
+
circle: {
|
|
216
|
+
width: 44,
|
|
217
|
+
height: 44,
|
|
218
|
+
borderRadius: 22,
|
|
219
|
+
backgroundColor: '#F3F4F6',
|
|
220
|
+
borderWidth: 2,
|
|
221
|
+
borderColor: '#E5E7EB',
|
|
222
|
+
justifyContent: 'center',
|
|
223
|
+
alignItems: 'center',
|
|
224
|
+
},
|
|
225
|
+
stepNumber: {
|
|
226
|
+
fontSize: 16,
|
|
227
|
+
fontWeight: '600',
|
|
228
|
+
color: '#6B7280',
|
|
229
|
+
},
|
|
230
|
+
stepNumberActive: {
|
|
231
|
+
color: '#FFFFFF',
|
|
232
|
+
},
|
|
233
|
+
label: {
|
|
234
|
+
marginTop: 8,
|
|
235
|
+
fontSize: 12,
|
|
236
|
+
color: '#6B7280',
|
|
237
|
+
textAlign: 'center',
|
|
238
|
+
},
|
|
239
|
+
});
|
|
240
|
+
const ActionButton = ({ title, subtitle, onPress, theme, disabled, }) => {
|
|
241
|
+
const primaryColor = theme?.primaryColor || '#6366F1';
|
|
242
|
+
return (react_1.default.createElement(react_native_1.TouchableOpacity, { style: [
|
|
243
|
+
buttonStyles.button,
|
|
244
|
+
{ backgroundColor: primaryColor },
|
|
245
|
+
disabled && buttonStyles.buttonDisabled,
|
|
246
|
+
], onPress: onPress, disabled: disabled },
|
|
247
|
+
react_1.default.createElement(react_native_1.Text, { style: buttonStyles.buttonText }, title),
|
|
248
|
+
subtitle && (react_1.default.createElement(react_native_1.Text, { style: buttonStyles.buttonSubtext }, subtitle))));
|
|
249
|
+
};
|
|
250
|
+
const buttonStyles = react_native_1.StyleSheet.create({
|
|
251
|
+
button: {
|
|
252
|
+
paddingVertical: 16,
|
|
253
|
+
paddingHorizontal: 32,
|
|
254
|
+
borderRadius: 12,
|
|
255
|
+
alignItems: 'center',
|
|
256
|
+
marginVertical: 8,
|
|
257
|
+
shadowColor: '#000',
|
|
258
|
+
shadowOffset: { width: 0, height: 2 },
|
|
259
|
+
shadowOpacity: 0.1,
|
|
260
|
+
shadowRadius: 4,
|
|
261
|
+
elevation: 3,
|
|
262
|
+
},
|
|
263
|
+
buttonDisabled: {
|
|
264
|
+
opacity: 0.5,
|
|
265
|
+
},
|
|
266
|
+
buttonText: {
|
|
267
|
+
color: '#FFFFFF',
|
|
268
|
+
fontSize: 18,
|
|
269
|
+
fontWeight: '700',
|
|
270
|
+
},
|
|
271
|
+
buttonSubtext: {
|
|
272
|
+
color: 'rgba(255, 255, 255, 0.8)',
|
|
273
|
+
fontSize: 13,
|
|
274
|
+
marginTop: 4,
|
|
275
|
+
},
|
|
276
|
+
});
|
|
277
|
+
// Create styles based on theme
|
|
278
|
+
const createStyles = (theme) => {
|
|
279
|
+
const backgroundColor = theme?.backgroundColor || '#FFFFFF';
|
|
280
|
+
const textColor = theme?.textColor || '#000000';
|
|
281
|
+
const secondaryTextColor = theme?.secondaryTextColor || '#6B7280';
|
|
282
|
+
const primaryColor = theme?.primaryColor || '#6366F1';
|
|
283
|
+
return react_native_1.StyleSheet.create({
|
|
284
|
+
container: {
|
|
285
|
+
flex: 1,
|
|
286
|
+
backgroundColor,
|
|
287
|
+
},
|
|
288
|
+
content: {
|
|
289
|
+
flex: 1,
|
|
290
|
+
padding: 24,
|
|
291
|
+
},
|
|
292
|
+
title: {
|
|
293
|
+
fontSize: 28,
|
|
294
|
+
fontWeight: 'bold',
|
|
295
|
+
color: textColor,
|
|
296
|
+
marginBottom: 8,
|
|
297
|
+
textAlign: 'center',
|
|
298
|
+
},
|
|
299
|
+
subtitle: {
|
|
300
|
+
fontSize: 16,
|
|
301
|
+
color: secondaryTextColor,
|
|
302
|
+
marginBottom: 24,
|
|
303
|
+
textAlign: 'center',
|
|
304
|
+
},
|
|
305
|
+
backendBadge: {
|
|
306
|
+
flexDirection: 'row',
|
|
307
|
+
alignItems: 'center',
|
|
308
|
+
justifyContent: 'center',
|
|
309
|
+
backgroundColor: 'rgba(16, 185, 129, 0.1)',
|
|
310
|
+
paddingHorizontal: 12,
|
|
311
|
+
paddingVertical: 6,
|
|
312
|
+
borderRadius: 16,
|
|
313
|
+
alignSelf: 'center',
|
|
314
|
+
marginBottom: 24,
|
|
315
|
+
},
|
|
316
|
+
backendDot: {
|
|
317
|
+
width: 8,
|
|
318
|
+
height: 8,
|
|
319
|
+
borderRadius: 4,
|
|
320
|
+
backgroundColor: '#10B981',
|
|
321
|
+
marginRight: 8,
|
|
322
|
+
},
|
|
323
|
+
backendText: {
|
|
324
|
+
color: '#10B981',
|
|
325
|
+
fontSize: 12,
|
|
326
|
+
fontWeight: '600',
|
|
327
|
+
},
|
|
328
|
+
progressContainer: {
|
|
329
|
+
flexDirection: 'row',
|
|
330
|
+
justifyContent: 'space-around',
|
|
331
|
+
alignItems: 'center',
|
|
332
|
+
marginBottom: 48,
|
|
333
|
+
paddingHorizontal: 16,
|
|
334
|
+
},
|
|
335
|
+
stepConnector: {
|
|
336
|
+
flex: 0.5,
|
|
337
|
+
height: 2,
|
|
338
|
+
backgroundColor: '#E5E7EB',
|
|
339
|
+
marginHorizontal: -10,
|
|
340
|
+
},
|
|
341
|
+
actionsContainer: {
|
|
342
|
+
marginTop: 24,
|
|
343
|
+
},
|
|
344
|
+
loadingContainer: {
|
|
345
|
+
marginTop: 32,
|
|
346
|
+
alignItems: 'center',
|
|
347
|
+
},
|
|
348
|
+
loadingFullScreen: {
|
|
349
|
+
flex: 1,
|
|
350
|
+
justifyContent: 'center',
|
|
351
|
+
alignItems: 'center',
|
|
352
|
+
},
|
|
353
|
+
loadingText: {
|
|
354
|
+
marginTop: 12,
|
|
355
|
+
fontSize: 14,
|
|
356
|
+
color: secondaryTextColor,
|
|
357
|
+
},
|
|
358
|
+
loadingSubtext: {
|
|
359
|
+
marginTop: 4,
|
|
360
|
+
fontSize: 12,
|
|
361
|
+
color: secondaryTextColor,
|
|
362
|
+
opacity: 0.7,
|
|
363
|
+
},
|
|
364
|
+
});
|
|
365
|
+
};
|
|
366
|
+
exports.default = exports.BiometricIdentityFlow;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Camera Capture Component for React Native
|
|
3
|
+
* Handles ID document photo capture
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { ThemeConfig } from '@hexar/biometric-identity-sdk-core';
|
|
7
|
+
export interface CameraCaptureProps {
|
|
8
|
+
mode: 'front' | 'back';
|
|
9
|
+
theme?: ThemeConfig;
|
|
10
|
+
onCapture: (imageData: string) => void;
|
|
11
|
+
onCancel: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const CameraCapture: React.FC<CameraCaptureProps>;
|
|
14
|
+
export default CameraCapture;
|
|
15
|
+
//# sourceMappingURL=CameraCapture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CameraCapture.d.ts","sourceRoot":"","sources":["../../src/components/CameraCapture.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAA2B,MAAM,OAAO,CAAC;AAShD,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAIjE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA6FtD,CAAC;AA6IF,eAAe,aAAa,CAAC"}
|