@hexar/biometric-identity-sdk-react-native 1.0.24 → 1.0.25
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BiometricIdentityFlow.d.ts","sourceRoot":"","sources":["../../src/components/BiometricIdentityFlow.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,EAOL,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,cAAc,EAKd,iBAAiB,EAElB,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"BiometricIdentityFlow.d.ts","sourceRoot":"","sources":["../../src/components/BiometricIdentityFlow.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,EAOL,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,cAAc,EAKd,iBAAiB,EAElB,MAAM,oCAAoC,CAAC;AAuB5C,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,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,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,CAyXtE,CAAC;AA8NF,eAAe,qBAAqB,CAAC"}
|
|
@@ -44,6 +44,18 @@ const biometric_identity_sdk_core_1 = require("@hexar/biometric-identity-sdk-cor
|
|
|
44
44
|
const useBiometricSDK_1 = require("../hooks/useBiometricSDK");
|
|
45
45
|
const CameraCapture_1 = require("./CameraCapture");
|
|
46
46
|
const VideoRecorder_1 = require("./VideoRecorder");
|
|
47
|
+
const getInstructionMap = (strings) => ({
|
|
48
|
+
look_left: { text: strings.liveness.instructions.lookLeft || 'Slowly turn your head LEFT', icon: '←' },
|
|
49
|
+
look_right: { text: strings.liveness.instructions.lookRight || 'Slowly turn your head RIGHT', icon: '→' },
|
|
50
|
+
look_up: { text: strings.liveness.instructions.lookUp || 'Look UP', icon: '↑' },
|
|
51
|
+
look_down: { text: strings.liveness.instructions.lookDown || 'Look DOWN', icon: '↓' },
|
|
52
|
+
turn_head_left: { text: strings.liveness.instructions.turnHeadLeft || 'Turn your head LEFT', icon: '←' },
|
|
53
|
+
turn_head_right: { text: strings.liveness.instructions.turnHeadRight || 'Turn your head RIGHT', icon: '→' },
|
|
54
|
+
smile: { text: strings.liveness.instructions.smile || 'Smile 😊', icon: '😊' },
|
|
55
|
+
blink: { text: strings.liveness.instructions.blink || 'Blink your eyes naturally', icon: '👁' },
|
|
56
|
+
open_mouth: { text: strings.liveness.instructions.openMouth || 'Open your mouth slightly', icon: '😮' },
|
|
57
|
+
stay_still: { text: strings.liveness.instructions.stayStill || 'Look at the camera and follow the instructions', icon: '📷' },
|
|
58
|
+
});
|
|
47
59
|
const ValidationProgress_1 = require("./ValidationProgress");
|
|
48
60
|
const ResultScreen_1 = require("./ResultScreen");
|
|
49
61
|
const ErrorScreen_1 = require("./ErrorScreen");
|
|
@@ -100,12 +112,26 @@ const BiometricIdentityFlow = ({ onValidationComplete, onError, theme, language,
|
|
|
100
112
|
}
|
|
101
113
|
catch (error) {
|
|
102
114
|
biometric_identity_sdk_core_1.logger.warn('Failed to fetch challenges, using defaults');
|
|
103
|
-
|
|
115
|
+
const defaultChallenges = sdk.getDefaultChallenges();
|
|
116
|
+
const instructionMap = getInstructionMap(strings);
|
|
117
|
+
const translatedChallenges = defaultChallenges.map(challenge => ({
|
|
118
|
+
...challenge,
|
|
119
|
+
instruction: instructionMap[challenge.action]?.text || challenge.instruction,
|
|
120
|
+
icon: instructionMap[challenge.action]?.icon
|
|
121
|
+
}));
|
|
122
|
+
setCurrentChallenges(translatedChallenges);
|
|
104
123
|
}
|
|
105
124
|
setIsLoadingChallenges(false);
|
|
106
125
|
}
|
|
107
126
|
else if (mode === 'video' && smartLivenessMode) {
|
|
108
|
-
|
|
127
|
+
const defaultChallenges = sdk.getDefaultChallenges();
|
|
128
|
+
const instructionMap = getInstructionMap(strings);
|
|
129
|
+
const translatedChallenges = defaultChallenges.map(challenge => ({
|
|
130
|
+
...challenge,
|
|
131
|
+
instruction: instructionMap[challenge.action]?.text || challenge.instruction,
|
|
132
|
+
icon: instructionMap[challenge.action]?.icon
|
|
133
|
+
}));
|
|
134
|
+
setCurrentChallenges(translatedChallenges);
|
|
109
135
|
}
|
|
110
136
|
setShowCamera(true);
|
|
111
137
|
}, [smartLivenessMode, isUsingBackend, fetchChallenges, sdk]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hexar/biometric-identity-sdk-react-native",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.25",
|
|
4
4
|
"description": "React Native wrapper for Biometric Identity SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"clean": "rm -rf dist"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@hexar/biometric-identity-sdk-core": ">=1.0.
|
|
14
|
+
"@hexar/biometric-identity-sdk-core": ">=1.0.15",
|
|
15
15
|
"react": ">=18.0.0",
|
|
16
16
|
"react-native": ">=0.70.0",
|
|
17
17
|
"react-native-permissions": ">=4.0.0",
|
|
@@ -28,6 +28,19 @@ import type { ChallengeAction } from './VideoRecorder';
|
|
|
28
28
|
import { useBiometricSDK } from '../hooks/useBiometricSDK';
|
|
29
29
|
import { CameraCapture } from './CameraCapture';
|
|
30
30
|
import { VideoRecorder, VideoRecordingResult } from './VideoRecorder';
|
|
31
|
+
|
|
32
|
+
const getInstructionMap = (strings: any): Record<string, { text: string; icon: string }> => ({
|
|
33
|
+
look_left: { text: strings.liveness.instructions.lookLeft || 'Slowly turn your head LEFT', icon: '←' },
|
|
34
|
+
look_right: { text: strings.liveness.instructions.lookRight || 'Slowly turn your head RIGHT', icon: '→' },
|
|
35
|
+
look_up: { text: strings.liveness.instructions.lookUp || 'Look UP', icon: '↑' },
|
|
36
|
+
look_down: { text: strings.liveness.instructions.lookDown || 'Look DOWN', icon: '↓' },
|
|
37
|
+
turn_head_left: { text: strings.liveness.instructions.turnHeadLeft || 'Turn your head LEFT', icon: '←' },
|
|
38
|
+
turn_head_right: { text: strings.liveness.instructions.turnHeadRight || 'Turn your head RIGHT', icon: '→' },
|
|
39
|
+
smile: { text: strings.liveness.instructions.smile || 'Smile 😊', icon: '😊' },
|
|
40
|
+
blink: { text: strings.liveness.instructions.blink || 'Blink your eyes naturally', icon: '👁' },
|
|
41
|
+
open_mouth: { text: strings.liveness.instructions.openMouth || 'Open your mouth slightly', icon: '😮' },
|
|
42
|
+
stay_still: { text: strings.liveness.instructions.stayStill || 'Look at the camera and follow the instructions', icon: '📷' },
|
|
43
|
+
});
|
|
31
44
|
import { ValidationProgress } from './ValidationProgress';
|
|
32
45
|
import { ResultScreen } from './ResultScreen';
|
|
33
46
|
import { ErrorScreen } from './ErrorScreen';
|
|
@@ -129,11 +142,25 @@ export const BiometricIdentityFlow: React.FC<BiometricIdentityFlowProps> = ({
|
|
|
129
142
|
setCurrentChallenges(challenges);
|
|
130
143
|
} catch (error) {
|
|
131
144
|
logger.warn('Failed to fetch challenges, using defaults');
|
|
132
|
-
|
|
145
|
+
const defaultChallenges = sdk.getDefaultChallenges();
|
|
146
|
+
const instructionMap = getInstructionMap(strings);
|
|
147
|
+
const translatedChallenges = defaultChallenges.map(challenge => ({
|
|
148
|
+
...challenge,
|
|
149
|
+
instruction: instructionMap[challenge.action]?.text || challenge.instruction,
|
|
150
|
+
icon: instructionMap[challenge.action]?.icon
|
|
151
|
+
}));
|
|
152
|
+
setCurrentChallenges(translatedChallenges);
|
|
133
153
|
}
|
|
134
154
|
setIsLoadingChallenges(false);
|
|
135
155
|
} else if (mode === 'video' && smartLivenessMode) {
|
|
136
|
-
|
|
156
|
+
const defaultChallenges = sdk.getDefaultChallenges();
|
|
157
|
+
const instructionMap = getInstructionMap(strings);
|
|
158
|
+
const translatedChallenges = defaultChallenges.map(challenge => ({
|
|
159
|
+
...challenge,
|
|
160
|
+
instruction: instructionMap[challenge.action]?.text || challenge.instruction,
|
|
161
|
+
icon: instructionMap[challenge.action]?.icon
|
|
162
|
+
}));
|
|
163
|
+
setCurrentChallenges(translatedChallenges);
|
|
137
164
|
}
|
|
138
165
|
|
|
139
166
|
setShowCamera(true);
|