@hexar/biometric-identity-sdk-react-native 1.0.1 → 1.0.3
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.
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Main UI component for identity verification with backend AI support
|
|
4
4
|
*/
|
|
5
5
|
import React from 'react';
|
|
6
|
+
import { ViewStyle } from 'react-native';
|
|
6
7
|
import { ValidationResult, ThemeConfig, BiometricError, SupportedLanguage } from '@hexar/biometric-identity-sdk-core';
|
|
7
8
|
export interface BiometricIdentityFlowProps {
|
|
8
9
|
onValidationComplete: (result: ValidationResult) => void;
|
|
@@ -11,6 +12,10 @@ export interface BiometricIdentityFlowProps {
|
|
|
11
12
|
language?: SupportedLanguage;
|
|
12
13
|
customTranslations?: Record<string, string>;
|
|
13
14
|
smartLivenessMode?: boolean;
|
|
15
|
+
styles?: {
|
|
16
|
+
container?: ViewStyle;
|
|
17
|
+
content?: ViewStyle;
|
|
18
|
+
};
|
|
14
19
|
}
|
|
15
20
|
export declare const BiometricIdentityFlow: React.FC<BiometricIdentityFlowProps>;
|
|
16
21
|
export default BiometricIdentityFlow;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BiometricIdentityFlow.d.ts","sourceRoot":"","sources":["../../src/components/BiometricIdentityFlow.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAA2C,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"BiometricIdentityFlow.d.ts","sourceRoot":"","sources":["../../src/components/BiometricIdentityFlow.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAA2C,MAAM,OAAO,CAAC;AAChE,OAAO,EAOL,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,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;IAC5B,MAAM,CAAC,EAAE;QACP,SAAS,CAAC,EAAE,SAAS,CAAC;QACtB,OAAO,CAAC,EAAE,SAAS,CAAC;KACrB,CAAC;CACH;AAED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAsStE,CAAC;AAiOF,eAAe,qBAAqB,CAAC"}
|
|
@@ -48,15 +48,18 @@ const ValidationProgress_1 = require("./ValidationProgress");
|
|
|
48
48
|
const ResultScreen_1 = require("./ResultScreen");
|
|
49
49
|
const ErrorScreen_1 = require("./ErrorScreen");
|
|
50
50
|
const InstructionsScreen_1 = require("./InstructionsScreen");
|
|
51
|
-
const BiometricIdentityFlow = ({ onValidationComplete, onError, theme, language
|
|
51
|
+
const BiometricIdentityFlow = ({ onValidationComplete, onError, theme, language, customTranslations, smartLivenessMode = true, styles: customStyles, }) => {
|
|
52
52
|
const { sdk, state, isInitialized, isUsingBackend, challenges, uploadFrontID, uploadBackID, storeVideoRecording, fetchChallenges, validateIdentity, reset, } = (0, useBiometricSDK_1.useBiometricSDK)();
|
|
53
53
|
const [showCamera, setShowCamera] = (0, react_1.useState)(false);
|
|
54
54
|
const [cameraMode, setCameraMode] = (0, react_1.useState)('front');
|
|
55
55
|
const [showInstructions, setShowInstructions] = (0, react_1.useState)(true);
|
|
56
56
|
const [currentChallenges, setCurrentChallenges] = (0, react_1.useState)([]);
|
|
57
57
|
const [isLoadingChallenges, setIsLoadingChallenges] = (0, react_1.useState)(false);
|
|
58
|
+
// Override SDK language only if explicitly provided
|
|
58
59
|
(0, react_1.useEffect)(() => {
|
|
59
|
-
|
|
60
|
+
if (language) {
|
|
61
|
+
(0, biometric_identity_sdk_core_1.setLanguage)(language);
|
|
62
|
+
}
|
|
60
63
|
}, [language]);
|
|
61
64
|
const strings = (0, biometric_identity_sdk_core_1.getStrings)();
|
|
62
65
|
const styles = createStyles(theme);
|
|
@@ -142,7 +145,7 @@ const BiometricIdentityFlow = ({ onValidationComplete, onError, theme, language
|
|
|
142
145
|
}, [reset]);
|
|
143
146
|
// Show loading while initializing
|
|
144
147
|
if (!isInitialized) {
|
|
145
|
-
return (react_1.default.createElement(react_native_1.SafeAreaView, { style: styles.container },
|
|
148
|
+
return (react_1.default.createElement(react_native_1.SafeAreaView, { style: [styles.container, customStyles?.container] },
|
|
146
149
|
react_1.default.createElement(react_native_1.View, { style: styles.loadingFullScreen },
|
|
147
150
|
react_1.default.createElement(react_native_1.ActivityIndicator, { size: "large", color: theme?.primaryColor || '#6366F1' }),
|
|
148
151
|
react_1.default.createElement(react_native_1.Text, { style: styles.loadingText }, strings.initialization.initializing))));
|
|
@@ -173,8 +176,8 @@ const BiometricIdentityFlow = ({ onValidationComplete, onError, theme, language
|
|
|
173
176
|
if (state.currentStep === biometric_identity_sdk_core_1.SDKStep.ERROR && state.error) {
|
|
174
177
|
return (react_1.default.createElement(ErrorScreen_1.ErrorScreen, { error: state.error, theme: theme, language: language, onRetry: handleRetry, onClose: () => onError(state.error) }));
|
|
175
178
|
}
|
|
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 },
|
|
179
|
+
return (react_1.default.createElement(react_native_1.SafeAreaView, { style: [styles.container, customStyles?.container] },
|
|
180
|
+
react_1.default.createElement(react_native_1.View, { style: [styles.content, customStyles?.content] },
|
|
178
181
|
react_1.default.createElement(react_native_1.Text, { style: styles.title }, strings.instructions.title),
|
|
179
182
|
react_1.default.createElement(react_native_1.Text, { style: styles.subtitle }, strings.instructions.subtitle),
|
|
180
183
|
isUsingBackend && (react_1.default.createElement(react_native_1.View, { style: styles.backendBadge },
|
package/package.json
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
TouchableOpacity,
|
|
12
12
|
ActivityIndicator,
|
|
13
13
|
SafeAreaView,
|
|
14
|
+
ViewStyle,
|
|
14
15
|
} from 'react-native';
|
|
15
16
|
import {
|
|
16
17
|
ValidationResult,
|
|
@@ -37,15 +38,20 @@ export interface BiometricIdentityFlowProps {
|
|
|
37
38
|
language?: SupportedLanguage;
|
|
38
39
|
customTranslations?: Record<string, string>;
|
|
39
40
|
smartLivenessMode?: boolean;
|
|
41
|
+
styles?: {
|
|
42
|
+
container?: ViewStyle;
|
|
43
|
+
content?: ViewStyle;
|
|
44
|
+
};
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
export const BiometricIdentityFlow: React.FC<BiometricIdentityFlowProps> = ({
|
|
43
48
|
onValidationComplete,
|
|
44
49
|
onError,
|
|
45
50
|
theme,
|
|
46
|
-
language
|
|
51
|
+
language,
|
|
47
52
|
customTranslations,
|
|
48
53
|
smartLivenessMode = true,
|
|
54
|
+
styles: customStyles,
|
|
49
55
|
}) => {
|
|
50
56
|
const {
|
|
51
57
|
sdk,
|
|
@@ -67,8 +73,11 @@ export const BiometricIdentityFlow: React.FC<BiometricIdentityFlowProps> = ({
|
|
|
67
73
|
const [currentChallenges, setCurrentChallenges] = useState<ChallengeAction[]>([]);
|
|
68
74
|
const [isLoadingChallenges, setIsLoadingChallenges] = useState(false);
|
|
69
75
|
|
|
76
|
+
// Override SDK language only if explicitly provided
|
|
70
77
|
useEffect(() => {
|
|
71
|
-
|
|
78
|
+
if (language) {
|
|
79
|
+
setLanguage(language);
|
|
80
|
+
}
|
|
72
81
|
}, [language]);
|
|
73
82
|
|
|
74
83
|
const strings = getStrings();
|
|
@@ -162,7 +171,7 @@ export const BiometricIdentityFlow: React.FC<BiometricIdentityFlowProps> = ({
|
|
|
162
171
|
// Show loading while initializing
|
|
163
172
|
if (!isInitialized) {
|
|
164
173
|
return (
|
|
165
|
-
<SafeAreaView style={styles.container}>
|
|
174
|
+
<SafeAreaView style={[styles.container, customStyles?.container]}>
|
|
166
175
|
<View style={styles.loadingFullScreen}>
|
|
167
176
|
<ActivityIndicator size="large" color={theme?.primaryColor || '#6366F1'} />
|
|
168
177
|
<Text style={styles.loadingText}>{strings.initialization.initializing}</Text>
|
|
@@ -248,8 +257,8 @@ export const BiometricIdentityFlow: React.FC<BiometricIdentityFlowProps> = ({
|
|
|
248
257
|
}
|
|
249
258
|
|
|
250
259
|
return (
|
|
251
|
-
<SafeAreaView style={styles.container}>
|
|
252
|
-
<View style={styles.content}>
|
|
260
|
+
<SafeAreaView style={[styles.container, customStyles?.container]}>
|
|
261
|
+
<View style={[styles.content, customStyles?.content]}>
|
|
253
262
|
<Text style={styles.title}>{strings.instructions.title}</Text>
|
|
254
263
|
<Text style={styles.subtitle}>{strings.instructions.subtitle}</Text>
|
|
255
264
|
|