@hexar/biometric-identity-sdk-react-native 1.1.11 → 1.1.13
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.
|
@@ -44,12 +44,14 @@ const ProfilePictureCapture = ({ onComplete, onError, onCancel, theme, language,
|
|
|
44
44
|
const [isValidating, setIsValidating] = (0, react_1.useState)(false);
|
|
45
45
|
const [currentChallenges, setCurrentChallenges] = (0, react_1.useState)([]);
|
|
46
46
|
const [isLoadingChallenges, setIsLoadingChallenges] = (0, react_1.useState)(false);
|
|
47
|
+
const handleFetchChallenges = (0, react_1.useCallback)(async () => {
|
|
48
|
+
return await fetchChallenges('active');
|
|
49
|
+
}, [fetchChallenges]);
|
|
47
50
|
(0, react_1.useEffect)(() => {
|
|
48
51
|
if (language) {
|
|
49
52
|
(0, biometric_identity_sdk_core_1.setLanguage)(language);
|
|
50
53
|
}
|
|
51
54
|
}, [language]);
|
|
52
|
-
// Fetch challenges when component mounts and SDK is ready
|
|
53
55
|
(0, react_1.useEffect)(() => {
|
|
54
56
|
if (isInitialized && isUsingBackend) {
|
|
55
57
|
const loadChallenges = async () => {
|
|
@@ -196,10 +198,7 @@ const ProfilePictureCapture = ({ onComplete, onError, onCancel, theme, language,
|
|
|
196
198
|
react_1.default.createElement(react_native_1.Text, { style: [styles.loadingText, { color: theme?.textColor || '#1e1b4b' }] }, strings.liveness.processing || strings.validation.checkingLiveness || 'Processing...'),
|
|
197
199
|
react_1.default.createElement(react_native_1.Text, { style: [styles.loadingSubtext, { color: theme?.secondaryTextColor || '#64748b' }] }, strings.validation.almostDone || strings.common.loading || 'This may take a few seconds'))));
|
|
198
200
|
}
|
|
199
|
-
return (react_1.default.createElement(VideoRecorder_1.VideoRecorder, { theme: theme, language: language, smartMode: true, challenges: currentChallenges, sessionId: sdk.getSessionId() || undefined, onComplete: handleVideoComplete, onCancel: handleVideoCancel, onFetchChallenges:
|
|
200
|
-
const challenges = await fetchChallenges('active');
|
|
201
|
-
return challenges;
|
|
202
|
-
} }));
|
|
201
|
+
return (react_1.default.createElement(VideoRecorder_1.VideoRecorder, { theme: theme, language: language, smartMode: true, challenges: currentChallenges, sessionId: sdk.getSessionId() || undefined, onComplete: handleVideoComplete, onCancel: handleVideoCancel, onFetchChallenges: handleFetchChallenges }));
|
|
203
202
|
};
|
|
204
203
|
exports.ProfilePictureCapture = ProfilePictureCapture;
|
|
205
204
|
const styles = react_native_1.StyleSheet.create({
|
|
@@ -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,gDAAg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I,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,CAy2BtD,CAAC;AA4OF,eAAe,aAAa,CAAC"}
|
|
@@ -321,8 +321,11 @@ const VideoRecorder = ({ theme, language, duration, instructions, challenges: pr
|
|
|
321
321
|
}
|
|
322
322
|
biometric_identity_sdk_core_1.logger.info('Using frames for completion:', finalFrames.length, 'frames');
|
|
323
323
|
let finalCompletedChallenges = completedChallenges;
|
|
324
|
-
if (smartMode && finalCompletedChallenges.length === 0
|
|
325
|
-
|
|
324
|
+
if (smartMode && finalCompletedChallenges.length === 0) {
|
|
325
|
+
const challengesToUse = challenges.length > 0 ? challenges : propChallenges || [];
|
|
326
|
+
if (challengesToUse.length > 0) {
|
|
327
|
+
finalCompletedChallenges = challengesToUse.map(c => c.action);
|
|
328
|
+
}
|
|
326
329
|
}
|
|
327
330
|
const result = {
|
|
328
331
|
frames: finalFrames,
|
|
@@ -342,7 +345,7 @@ const VideoRecorder = ({ theme, language, duration, instructions, challenges: pr
|
|
|
342
345
|
setOverallProgress(0);
|
|
343
346
|
handleRecordingError(error);
|
|
344
347
|
}
|
|
345
|
-
}, [frames, completedChallenges, challenges, sessionId, onComplete, resetAndRetry, handleRecordingError, strings, minDurationMs, phase, smartMode]);
|
|
348
|
+
}, [frames, completedChallenges, challenges, propChallenges, sessionId, onComplete, resetAndRetry, handleRecordingError, strings, minDurationMs, phase, smartMode]);
|
|
346
349
|
const startFrameCapture = (0, react_1.useCallback)(() => {
|
|
347
350
|
if (cameraRef.current && device) {
|
|
348
351
|
biometric_identity_sdk_core_1.logger.info('Starting frame capture');
|
package/package.json
CHANGED
|
@@ -45,13 +45,16 @@ export const ProfilePictureCapture: React.FC<ProfilePictureCaptureProps> = ({
|
|
|
45
45
|
const [currentChallenges, setCurrentChallenges] = useState<any[]>([]);
|
|
46
46
|
const [isLoadingChallenges, setIsLoadingChallenges] = useState(false);
|
|
47
47
|
|
|
48
|
+
const handleFetchChallenges = useCallback(async () => {
|
|
49
|
+
return await fetchChallenges('active');
|
|
50
|
+
}, [fetchChallenges]);
|
|
51
|
+
|
|
48
52
|
useEffect(() => {
|
|
49
53
|
if (language) {
|
|
50
54
|
setLanguage(language);
|
|
51
55
|
}
|
|
52
56
|
}, [language]);
|
|
53
57
|
|
|
54
|
-
// Fetch challenges when component mounts and SDK is ready
|
|
55
58
|
useEffect(() => {
|
|
56
59
|
if (isInitialized && isUsingBackend) {
|
|
57
60
|
const loadChallenges = async () => {
|
|
@@ -231,10 +234,7 @@ export const ProfilePictureCapture: React.FC<ProfilePictureCaptureProps> = ({
|
|
|
231
234
|
sessionId={sdk.getSessionId() || undefined}
|
|
232
235
|
onComplete={handleVideoComplete}
|
|
233
236
|
onCancel={handleVideoCancel}
|
|
234
|
-
onFetchChallenges={
|
|
235
|
-
const challenges = await fetchChallenges('active');
|
|
236
|
-
return challenges;
|
|
237
|
-
}}
|
|
237
|
+
onFetchChallenges={handleFetchChallenges}
|
|
238
238
|
/>
|
|
239
239
|
);
|
|
240
240
|
};
|
|
@@ -386,8 +386,11 @@ export const VideoRecorder: React.FC<VideoRecorderProps> = ({
|
|
|
386
386
|
logger.info('Using frames for completion:', finalFrames.length, 'frames');
|
|
387
387
|
|
|
388
388
|
let finalCompletedChallenges = completedChallenges;
|
|
389
|
-
if (smartMode && finalCompletedChallenges.length === 0
|
|
390
|
-
|
|
389
|
+
if (smartMode && finalCompletedChallenges.length === 0) {
|
|
390
|
+
const challengesToUse = challenges.length > 0 ? challenges : propChallenges || [];
|
|
391
|
+
if (challengesToUse.length > 0) {
|
|
392
|
+
finalCompletedChallenges = challengesToUse.map(c => c.action);
|
|
393
|
+
}
|
|
391
394
|
}
|
|
392
395
|
|
|
393
396
|
const result: VideoRecordingResult = {
|
|
@@ -409,7 +412,7 @@ export const VideoRecorder: React.FC<VideoRecorderProps> = ({
|
|
|
409
412
|
setOverallProgress(0);
|
|
410
413
|
handleRecordingError(error);
|
|
411
414
|
}
|
|
412
|
-
}, [frames, completedChallenges, challenges, sessionId, onComplete, resetAndRetry, handleRecordingError, strings, minDurationMs, phase, smartMode]);
|
|
415
|
+
}, [frames, completedChallenges, challenges, propChallenges, sessionId, onComplete, resetAndRetry, handleRecordingError, strings, minDurationMs, phase, smartMode]);
|
|
413
416
|
|
|
414
417
|
const startFrameCapture = useCallback(() => {
|
|
415
418
|
if (cameraRef.current && device) {
|