@hexar/biometric-identity-sdk-react-native 1.0.27 → 1.0.29
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/dist/components/BiometricIdentityFlow.d.ts.map +1 -1
- package/dist/components/BiometricIdentityFlow.js +2 -0
- package/dist/components/ValidationProgress.d.ts.map +1 -1
- package/dist/components/ValidationProgress.js +51 -18
- package/dist/components/VideoRecorder.d.ts.map +1 -1
- package/dist/components/VideoRecorder.js +30 -12
- package/package.json +2 -2
- package/src/components/BiometricIdentityFlow.tsx +2 -0
- package/src/components/ValidationProgress.tsx +20 -15
- package/src/components/VideoRecorder.tsx +30 -12
|
@@ -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;AA8B5C,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,CAuatE,CAAC;AA8NF,eAAe,qBAAqB,CAAC"}
|
|
@@ -53,6 +53,8 @@ const getInstructionMap = (strings) => {
|
|
|
53
53
|
look_right: { text: strings.liveness.instructions.lookRight || 'Slowly turn your head RIGHT' },
|
|
54
54
|
look_up: { text: strings.liveness.instructions.lookUp || 'Look UP' },
|
|
55
55
|
look_down: { text: strings.liveness.instructions.lookDown || 'Look DOWN' },
|
|
56
|
+
turn_left: { text: strings.liveness.instructions.turnHeadLeft || strings.liveness.instructions.lookLeft || 'Turn your head LEFT' },
|
|
57
|
+
turn_right: { text: strings.liveness.instructions.turnHeadRight || strings.liveness.instructions.lookRight || 'Turn your head RIGHT' },
|
|
56
58
|
turn_head_left: { text: strings.liveness.instructions.turnHeadLeft || 'Turn your head LEFT' },
|
|
57
59
|
turn_head_right: { text: strings.liveness.instructions.turnHeadRight || 'Turn your head RIGHT' },
|
|
58
60
|
smile: { text: strings.liveness.instructions.smile || 'Smile' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidationProgress.d.ts","sourceRoot":"","sources":["../../src/components/ValidationProgress.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"ValidationProgress.d.ts","sourceRoot":"","sources":["../../src/components/ValidationProgress.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAoB,MAAM,OAAO,CAAC;AAOzC,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAA2B,MAAM,oCAAoC,CAAC;AAE7G,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CAC9B;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAwFhE,CAAC;AAqHF,eAAe,kBAAkB,CAAC"}
|
|
@@ -3,29 +3,64 @@
|
|
|
3
3
|
* Validation Progress Component
|
|
4
4
|
* Shows AI validation progress
|
|
5
5
|
*/
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
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
|
+
})();
|
|
9
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
40
|
exports.ValidationProgress = void 0;
|
|
11
|
-
const react_1 =
|
|
41
|
+
const react_1 = __importStar(require("react"));
|
|
12
42
|
const react_native_1 = require("react-native");
|
|
43
|
+
const biometric_identity_sdk_core_1 = require("@hexar/biometric-identity-sdk-core");
|
|
13
44
|
const ValidationProgress = ({ progress, theme, language = 'en', }) => {
|
|
45
|
+
(0, react_1.useEffect)(() => {
|
|
46
|
+
if (language) {
|
|
47
|
+
(0, biometric_identity_sdk_core_1.setLanguage)(language);
|
|
48
|
+
}
|
|
49
|
+
}, [language]);
|
|
50
|
+
const strings = (0, biometric_identity_sdk_core_1.getStrings)();
|
|
14
51
|
const getStatusText = () => {
|
|
15
52
|
if (progress < 80)
|
|
16
|
-
return
|
|
53
|
+
return strings.validation.checkingDocument || 'Extracting document data...';
|
|
17
54
|
if (progress < 85)
|
|
18
|
-
return
|
|
19
|
-
if (progress < 90)
|
|
20
|
-
return language === 'es' ? 'Detectando rostro en documento...' : 'Detecting face in document...';
|
|
55
|
+
return strings.validation.checkingLiveness || 'Validating liveness...';
|
|
21
56
|
if (progress < 95)
|
|
22
|
-
return
|
|
23
|
-
return
|
|
57
|
+
return strings.validation.matchingFaces || 'Comparing faces...';
|
|
58
|
+
return strings.validation.almostDone || 'Validating document authenticity...';
|
|
24
59
|
};
|
|
25
60
|
return (react_1.default.createElement(react_native_1.View, { style: styles.container },
|
|
26
61
|
react_1.default.createElement(react_native_1.View, { style: styles.content },
|
|
27
62
|
react_1.default.createElement(react_native_1.ActivityIndicator, { size: "large", color: theme?.primaryColor || '#6366F1' }),
|
|
28
|
-
react_1.default.createElement(react_native_1.Text, { style: [styles.title, { color: theme?.textColor || '#000000' }] },
|
|
63
|
+
react_1.default.createElement(react_native_1.Text, { style: [styles.title, { color: theme?.textColor || '#000000' }] }, strings.validation.title || 'Validating Identity'),
|
|
29
64
|
react_1.default.createElement(react_native_1.Text, { style: [styles.statusText, { color: theme?.secondaryTextColor || '#6B7280' }] }, getStatusText()),
|
|
30
65
|
react_1.default.createElement(react_native_1.View, { style: styles.progressBarContainer },
|
|
31
66
|
react_1.default.createElement(react_native_1.View, { style: styles.progressBar },
|
|
@@ -40,13 +75,11 @@ const ValidationProgress = ({ progress, theme, language = 'en', }) => {
|
|
|
40
75
|
Math.round(progress),
|
|
41
76
|
"%")),
|
|
42
77
|
react_1.default.createElement(react_native_1.View, { style: styles.stepsContainer },
|
|
43
|
-
react_1.default.createElement(ValidationStep, { icon: "\u2713", text:
|
|
44
|
-
react_1.default.createElement(ValidationStep, { icon: "\u2713", text:
|
|
45
|
-
react_1.default.createElement(ValidationStep, { icon: "\u2713", text:
|
|
46
|
-
react_1.default.createElement(ValidationStep, { icon: "\u2713", text:
|
|
47
|
-
react_1.default.createElement(react_native_1.Text, { style: styles.bottomText },
|
|
48
|
-
? 'Esto puede tomar unos segundos...'
|
|
49
|
-
: 'This may take a few seconds...'))));
|
|
78
|
+
react_1.default.createElement(ValidationStep, { icon: "\u2713", text: strings.validation.checkingDocument || 'OCR Extraction', completed: progress >= 80, theme: theme }),
|
|
79
|
+
react_1.default.createElement(ValidationStep, { icon: "\u2713", text: strings.validation.checkingLiveness || 'Liveness Detection', completed: progress >= 85, theme: theme }),
|
|
80
|
+
react_1.default.createElement(ValidationStep, { icon: "\u2713", text: strings.validation.matchingFaces || 'Face Matching', completed: progress >= 95, theme: theme }),
|
|
81
|
+
react_1.default.createElement(ValidationStep, { icon: "\u2713", text: strings.validation.checkingDocument || 'Document Validation', completed: progress >= 100, theme: theme })),
|
|
82
|
+
react_1.default.createElement(react_native_1.Text, { style: styles.bottomText }, strings.validation.almostDone || 'This may take a few seconds...'))));
|
|
50
83
|
};
|
|
51
84
|
exports.ValidationProgress = ValidationProgress;
|
|
52
85
|
const ValidationStep = ({ icon, text, completed, theme, }) => (react_1.default.createElement(react_native_1.View, { style: stepStyles.container },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoRecorder.d.ts","sourceRoot":"","sources":["../../src/components/VideoRecorder.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAmD,MAAM,OAAO,CAAC;AAaxE,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,iBAAiB,EAAmC,MAAM,oCAAoC,CAAC;AAE1I,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,YAAY,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACrC,0CAA0C;IAC1C,UAAU,CAAC,EAAE,eAAe,EAAE,CAAC;IAC/B,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,wCAAwC;IACxC,UAAU,EAAE,CAAC,SAAS,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACtD,iCAAiC;IACjC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,gDAAgD;IAChD,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;CACtD;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"VideoRecorder.d.ts","sourceRoot":"","sources":["../../src/components/VideoRecorder.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAmD,MAAM,OAAO,CAAC;AAaxE,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,iBAAiB,EAAmC,MAAM,oCAAoC,CAAC;AAE1I,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,YAAY,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACrC,0CAA0C;IAC1C,UAAU,CAAC,EAAE,eAAe,EAAE,CAAC;IAC/B,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,wCAAwC;IACxC,UAAU,EAAE,CAAC,SAAS,EAAE,oBAAoB,KAAK,IAAI,CAAC;IACtD,iCAAiC;IACjC,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,gDAAgD;IAChD,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;CACtD;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAiDD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAi2BtD,CAAC;AA4OF,eAAe,aAAa,CAAC"}
|
|
@@ -69,18 +69,25 @@ const getDefaultChallenges = (strings) => [
|
|
|
69
69
|
order: 4,
|
|
70
70
|
},
|
|
71
71
|
];
|
|
72
|
-
const getInstructionMap = (strings) =>
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
72
|
+
const getInstructionMap = (strings) => {
|
|
73
|
+
if (!strings || !strings.liveness || !strings.liveness.instructions) {
|
|
74
|
+
return {};
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
look_left: { text: strings.liveness.instructions.lookLeft || 'Slowly turn your head LEFT' },
|
|
78
|
+
look_right: { text: strings.liveness.instructions.lookRight || 'Slowly turn your head RIGHT' },
|
|
79
|
+
look_up: { text: strings.liveness.instructions.lookUp || 'Look UP' },
|
|
80
|
+
look_down: { text: strings.liveness.instructions.lookDown || 'Look DOWN' },
|
|
81
|
+
turn_left: { text: strings.liveness.instructions.turnHeadLeft || strings.liveness.instructions.lookLeft || 'Turn your head LEFT' },
|
|
82
|
+
turn_right: { text: strings.liveness.instructions.turnHeadRight || strings.liveness.instructions.lookRight || 'Turn your head RIGHT' },
|
|
83
|
+
turn_head_left: { text: strings.liveness.instructions.turnHeadLeft || 'Turn your head LEFT' },
|
|
84
|
+
turn_head_right: { text: strings.liveness.instructions.turnHeadRight || 'Turn your head RIGHT' },
|
|
85
|
+
smile: { text: strings.liveness.instructions.smile || 'Smile' },
|
|
86
|
+
blink: { text: strings.liveness.instructions.blink || 'Blink your eyes naturally' },
|
|
87
|
+
open_mouth: { text: strings.liveness.instructions.openMouth || 'Open your mouth slightly' },
|
|
88
|
+
stay_still: { text: strings.liveness.instructions.stayStill || 'Look at the camera and follow the instructions' },
|
|
89
|
+
};
|
|
90
|
+
};
|
|
84
91
|
const VideoRecorder = ({ theme, language, duration, instructions, challenges: propChallenges, sessionId, smartMode = true, onComplete, onCancel, onFetchChallenges, }) => {
|
|
85
92
|
(0, react_1.useEffect)(() => {
|
|
86
93
|
if (language) {
|
|
@@ -145,9 +152,20 @@ const VideoRecorder = ({ theme, language, duration, instructions, challenges: pr
|
|
|
145
152
|
(0, react_1.useEffect)(() => {
|
|
146
153
|
const initChallenges = async () => {
|
|
147
154
|
try {
|
|
155
|
+
if (language) {
|
|
156
|
+
(0, biometric_identity_sdk_core_1.setLanguage)(language);
|
|
157
|
+
}
|
|
148
158
|
let challengeList;
|
|
149
159
|
const currentStrings = (0, biometric_identity_sdk_core_1.getStrings)();
|
|
150
160
|
const instructionMap = getInstructionMap(currentStrings);
|
|
161
|
+
biometric_identity_sdk_core_1.logger.info('Initializing challenges', {
|
|
162
|
+
language,
|
|
163
|
+
hasStrings: !!currentStrings,
|
|
164
|
+
hasInstructions: !!currentStrings?.liveness?.instructions,
|
|
165
|
+
instructionMapKeys: Object.keys(instructionMap),
|
|
166
|
+
turnLeftTranslation: instructionMap['turn_left']?.text,
|
|
167
|
+
turnRightTranslation: instructionMap['turn_right']?.text
|
|
168
|
+
});
|
|
151
169
|
if (propChallenges && propChallenges.length > 0) {
|
|
152
170
|
challengeList = propChallenges.map(challenge => ({
|
|
153
171
|
...challenge,
|
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.29",
|
|
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.18",
|
|
15
15
|
"react": ">=18.0.0",
|
|
16
16
|
"react-native": ">=0.70.0",
|
|
17
17
|
"react-native-permissions": ">=4.0.0",
|
|
@@ -38,6 +38,8 @@ const getInstructionMap = (strings: any): Record<string, { text: string; icon?:
|
|
|
38
38
|
look_right: { text: strings.liveness.instructions.lookRight || 'Slowly turn your head RIGHT' },
|
|
39
39
|
look_up: { text: strings.liveness.instructions.lookUp || 'Look UP' },
|
|
40
40
|
look_down: { text: strings.liveness.instructions.lookDown || 'Look DOWN' },
|
|
41
|
+
turn_left: { text: strings.liveness.instructions.turnHeadLeft || strings.liveness.instructions.lookLeft || 'Turn your head LEFT' },
|
|
42
|
+
turn_right: { text: strings.liveness.instructions.turnHeadRight || strings.liveness.instructions.lookRight || 'Turn your head RIGHT' },
|
|
41
43
|
turn_head_left: { text: strings.liveness.instructions.turnHeadLeft || 'Turn your head LEFT' },
|
|
42
44
|
turn_head_right: { text: strings.liveness.instructions.turnHeadRight || 'Turn your head RIGHT' },
|
|
43
45
|
smile: { text: strings.liveness.instructions.smile || 'Smile' },
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
* Shows AI validation progress
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import React from 'react';
|
|
6
|
+
import React, { useEffect } from 'react';
|
|
7
7
|
import {
|
|
8
8
|
View,
|
|
9
9
|
Text,
|
|
10
10
|
StyleSheet,
|
|
11
11
|
ActivityIndicator,
|
|
12
12
|
} from 'react-native';
|
|
13
|
-
import { ThemeConfig, SupportedLanguage } from '@hexar/biometric-identity-sdk-core';
|
|
13
|
+
import { ThemeConfig, SupportedLanguage, getStrings, setLanguage } from '@hexar/biometric-identity-sdk-core';
|
|
14
14
|
|
|
15
15
|
export interface ValidationProgressProps {
|
|
16
16
|
progress: number;
|
|
@@ -23,12 +23,19 @@ export const ValidationProgress: React.FC<ValidationProgressProps> = ({
|
|
|
23
23
|
theme,
|
|
24
24
|
language = 'en',
|
|
25
25
|
}) => {
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (language) {
|
|
28
|
+
setLanguage(language);
|
|
29
|
+
}
|
|
30
|
+
}, [language]);
|
|
31
|
+
|
|
32
|
+
const strings = getStrings();
|
|
33
|
+
|
|
26
34
|
const getStatusText = () => {
|
|
27
|
-
if (progress < 80) return
|
|
28
|
-
if (progress < 85) return
|
|
29
|
-
if (progress <
|
|
30
|
-
|
|
31
|
-
return language === 'es' ? 'Validando autenticidad del documento...' : 'Validating document authenticity...';
|
|
35
|
+
if (progress < 80) return strings.validation.checkingDocument || 'Extracting document data...';
|
|
36
|
+
if (progress < 85) return strings.validation.checkingLiveness || 'Validating liveness...';
|
|
37
|
+
if (progress < 95) return strings.validation.matchingFaces || 'Comparing faces...';
|
|
38
|
+
return strings.validation.almostDone || 'Validating document authenticity...';
|
|
32
39
|
};
|
|
33
40
|
|
|
34
41
|
return (
|
|
@@ -40,7 +47,7 @@ export const ValidationProgress: React.FC<ValidationProgressProps> = ({
|
|
|
40
47
|
/>
|
|
41
48
|
|
|
42
49
|
<Text style={[styles.title, { color: theme?.textColor || '#000000' }]}>
|
|
43
|
-
{
|
|
50
|
+
{strings.validation.title || 'Validating Identity'}
|
|
44
51
|
</Text>
|
|
45
52
|
|
|
46
53
|
<Text style={[styles.statusText, { color: theme?.secondaryTextColor || '#6B7280' }]}>
|
|
@@ -69,34 +76,32 @@ export const ValidationProgress: React.FC<ValidationProgressProps> = ({
|
|
|
69
76
|
<View style={styles.stepsContainer}>
|
|
70
77
|
<ValidationStep
|
|
71
78
|
icon="✓"
|
|
72
|
-
text={
|
|
79
|
+
text={strings.validation.checkingDocument || 'OCR Extraction'}
|
|
73
80
|
completed={progress >= 80}
|
|
74
81
|
theme={theme}
|
|
75
82
|
/>
|
|
76
83
|
<ValidationStep
|
|
77
84
|
icon="✓"
|
|
78
|
-
text={
|
|
85
|
+
text={strings.validation.checkingLiveness || 'Liveness Detection'}
|
|
79
86
|
completed={progress >= 85}
|
|
80
87
|
theme={theme}
|
|
81
88
|
/>
|
|
82
89
|
<ValidationStep
|
|
83
90
|
icon="✓"
|
|
84
|
-
text={
|
|
91
|
+
text={strings.validation.matchingFaces || 'Face Matching'}
|
|
85
92
|
completed={progress >= 95}
|
|
86
93
|
theme={theme}
|
|
87
94
|
/>
|
|
88
95
|
<ValidationStep
|
|
89
96
|
icon="✓"
|
|
90
|
-
text={
|
|
97
|
+
text={strings.validation.checkingDocument || 'Document Validation'}
|
|
91
98
|
completed={progress >= 100}
|
|
92
99
|
theme={theme}
|
|
93
100
|
/>
|
|
94
101
|
</View>
|
|
95
102
|
|
|
96
103
|
<Text style={styles.bottomText}>
|
|
97
|
-
{
|
|
98
|
-
? 'Esto puede tomar unos segundos...'
|
|
99
|
-
: 'This may take a few seconds...'}
|
|
104
|
+
{strings.validation.almostDone || 'This may take a few seconds...'}
|
|
100
105
|
</Text>
|
|
101
106
|
</View>
|
|
102
107
|
</View>
|
|
@@ -83,18 +83,25 @@ const getDefaultChallenges = (strings: any): ChallengeAction[] => [
|
|
|
83
83
|
},
|
|
84
84
|
];
|
|
85
85
|
|
|
86
|
-
const getInstructionMap = (strings: any): Record<string, { text: string; icon?: string }> =>
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
86
|
+
const getInstructionMap = (strings: any): Record<string, { text: string; icon?: string }> => {
|
|
87
|
+
if (!strings || !strings.liveness || !strings.liveness.instructions) {
|
|
88
|
+
return {};
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
look_left: { text: strings.liveness.instructions.lookLeft || 'Slowly turn your head LEFT' },
|
|
92
|
+
look_right: { text: strings.liveness.instructions.lookRight || 'Slowly turn your head RIGHT' },
|
|
93
|
+
look_up: { text: strings.liveness.instructions.lookUp || 'Look UP' },
|
|
94
|
+
look_down: { text: strings.liveness.instructions.lookDown || 'Look DOWN' },
|
|
95
|
+
turn_left: { text: strings.liveness.instructions.turnHeadLeft || strings.liveness.instructions.lookLeft || 'Turn your head LEFT' },
|
|
96
|
+
turn_right: { text: strings.liveness.instructions.turnHeadRight || strings.liveness.instructions.lookRight || 'Turn your head RIGHT' },
|
|
97
|
+
turn_head_left: { text: strings.liveness.instructions.turnHeadLeft || 'Turn your head LEFT' },
|
|
98
|
+
turn_head_right: { text: strings.liveness.instructions.turnHeadRight || 'Turn your head RIGHT' },
|
|
99
|
+
smile: { text: strings.liveness.instructions.smile || 'Smile' },
|
|
100
|
+
blink: { text: strings.liveness.instructions.blink || 'Blink your eyes naturally' },
|
|
101
|
+
open_mouth: { text: strings.liveness.instructions.openMouth || 'Open your mouth slightly' },
|
|
102
|
+
stay_still: { text: strings.liveness.instructions.stayStill || 'Look at the camera and follow the instructions' },
|
|
103
|
+
};
|
|
104
|
+
};
|
|
98
105
|
|
|
99
106
|
export const VideoRecorder: React.FC<VideoRecorderProps> = ({
|
|
100
107
|
theme,
|
|
@@ -184,9 +191,20 @@ export const VideoRecorder: React.FC<VideoRecorderProps> = ({
|
|
|
184
191
|
useEffect(() => {
|
|
185
192
|
const initChallenges = async () => {
|
|
186
193
|
try {
|
|
194
|
+
if (language) {
|
|
195
|
+
setLanguage(language);
|
|
196
|
+
}
|
|
187
197
|
let challengeList: ChallengeAction[];
|
|
188
198
|
const currentStrings = getStrings();
|
|
189
199
|
const instructionMap = getInstructionMap(currentStrings);
|
|
200
|
+
logger.info('Initializing challenges', {
|
|
201
|
+
language,
|
|
202
|
+
hasStrings: !!currentStrings,
|
|
203
|
+
hasInstructions: !!currentStrings?.liveness?.instructions,
|
|
204
|
+
instructionMapKeys: Object.keys(instructionMap),
|
|
205
|
+
turnLeftTranslation: instructionMap['turn_left']?.text,
|
|
206
|
+
turnRightTranslation: instructionMap['turn_right']?.text
|
|
207
|
+
});
|
|
190
208
|
|
|
191
209
|
if (propChallenges && propChallenges.length > 0) {
|
|
192
210
|
challengeList = propChallenges.map(challenge => ({
|