@hexar/biometric-identity-sdk-react-native 1.1.17 → 1.1.18
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":"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,C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,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,CAg5BtD,CAAC;AA4OF,eAAe,aAAa,CAAC"}
|
|
@@ -200,6 +200,13 @@ const VideoRecorder = ({ theme, language, duration, instructions, challenges: pr
|
|
|
200
200
|
},
|
|
201
201
|
];
|
|
202
202
|
}
|
|
203
|
+
biometric_identity_sdk_core_1.logger.info('VideoRecorder: Challenges initialized', {
|
|
204
|
+
challengeCount: challengeList.length,
|
|
205
|
+
challengeActions: challengeList.map(c => c.action),
|
|
206
|
+
source: propChallenges && propChallenges.length > 0 ? 'propChallenges' :
|
|
207
|
+
onFetchChallenges ? 'onFetchChallenges' :
|
|
208
|
+
instructions && instructions.length > 0 ? 'instructions' : 'default'
|
|
209
|
+
});
|
|
203
210
|
setChallenges(challengeList);
|
|
204
211
|
setPhase('countdown');
|
|
205
212
|
}
|
|
@@ -494,6 +501,12 @@ const VideoRecorder = ({ theme, language, duration, instructions, challenges: pr
|
|
|
494
501
|
}
|
|
495
502
|
}, [frames, completedChallenges, challenges, sessionId, onComplete, minDurationMs, resetAndRetry, strings]);
|
|
496
503
|
const runChallenge = (0, react_1.useCallback)((index) => {
|
|
504
|
+
biometric_identity_sdk_core_1.logger.info('VideoRecorder: runChallenge called', {
|
|
505
|
+
index,
|
|
506
|
+
challengesLength: challenges.length,
|
|
507
|
+
challengeActions: challenges.map(c => c.action),
|
|
508
|
+
completedChallengesCount: completedChallenges.length
|
|
509
|
+
});
|
|
497
510
|
if (index >= challenges.length) {
|
|
498
511
|
setOverallProgress(100);
|
|
499
512
|
if (recordingTimeoutRef.current) {
|
|
@@ -556,7 +569,16 @@ const VideoRecorder = ({ theme, language, duration, instructions, challenges: pr
|
|
|
556
569
|
}, 100);
|
|
557
570
|
setTimeout(() => {
|
|
558
571
|
clearInterval(progressInterval);
|
|
559
|
-
setCompletedChallenges(prev =>
|
|
572
|
+
setCompletedChallenges(prev => {
|
|
573
|
+
const updated = [...prev, challenge.action];
|
|
574
|
+
biometric_identity_sdk_core_1.logger.info('VideoRecorder: Challenge completed', {
|
|
575
|
+
action: challenge.action,
|
|
576
|
+
index,
|
|
577
|
+
completedCount: updated.length,
|
|
578
|
+
completedActions: updated
|
|
579
|
+
});
|
|
580
|
+
return updated;
|
|
581
|
+
});
|
|
560
582
|
react_native_1.Animated.timing(fadeAnim, {
|
|
561
583
|
toValue: 0,
|
|
562
584
|
duration: 200,
|
|
@@ -593,7 +615,32 @@ const VideoRecorder = ({ theme, language, duration, instructions, challenges: pr
|
|
|
593
615
|
else {
|
|
594
616
|
startFrameCapture();
|
|
595
617
|
}
|
|
596
|
-
|
|
618
|
+
/**
|
|
619
|
+
* If challenges are not available, set default challenges and run challenge
|
|
620
|
+
* This should not happen if ProfilePictureCapture properly waits for challenges
|
|
621
|
+
* But as a fallback, set defaults and retry after state update
|
|
622
|
+
* Schedule runChallenge to execute after state update completes
|
|
623
|
+
* This ensures the updated challenges are available when runChallenge executes
|
|
624
|
+
* Check again after state update - runChallenge callback should have latest challenges
|
|
625
|
+
*/
|
|
626
|
+
if (challenges.length === 0) {
|
|
627
|
+
biometric_identity_sdk_core_1.logger.warn('VideoRecorder: No challenges available when starting recording - challenges should have been loaded by initChallenges');
|
|
628
|
+
const defaultChallenges = smartMode ? getDefaultChallenges((0, biometric_identity_sdk_core_1.getStrings)()) : [
|
|
629
|
+
{
|
|
630
|
+
action: 'stay_still',
|
|
631
|
+
instruction: (0, biometric_identity_sdk_core_1.getStrings)().liveness.instructions.stayStill || 'Look at the camera and stay still',
|
|
632
|
+
duration_ms: duration || 5000,
|
|
633
|
+
order: 1,
|
|
634
|
+
},
|
|
635
|
+
];
|
|
636
|
+
setChallenges(defaultChallenges);
|
|
637
|
+
Promise.resolve().then(() => {
|
|
638
|
+
runChallenge(0);
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
else {
|
|
642
|
+
runChallenge(0);
|
|
643
|
+
}
|
|
597
644
|
const maxDuration = Math.max(totalDuration, minDurationMs + 2000);
|
|
598
645
|
recordingTimeoutRef.current = setTimeout(() => {
|
|
599
646
|
if (isRecordingRef.current) {
|
|
@@ -608,7 +655,7 @@ const VideoRecorder = ({ theme, language, duration, instructions, challenges: pr
|
|
|
608
655
|
recordingTimeoutRef.current = null;
|
|
609
656
|
}
|
|
610
657
|
};
|
|
611
|
-
}, [device, totalDuration, minDurationMs, handleVideoComplete, handleRecordingError, runChallenge, stopRecording, startFrameCapture]);
|
|
658
|
+
}, [device, totalDuration, minDurationMs, handleVideoComplete, handleRecordingError, runChallenge, stopRecording, startFrameCapture, challenges, smartMode, duration]);
|
|
612
659
|
const currentChallenge = challenges[currentChallengeIndex];
|
|
613
660
|
const getDirectionIndicator = () => {
|
|
614
661
|
if (!currentChallenge)
|
package/package.json
CHANGED
|
@@ -238,6 +238,13 @@ export const VideoRecorder: React.FC<VideoRecorderProps> = ({
|
|
|
238
238
|
];
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
+
logger.info('VideoRecorder: Challenges initialized', {
|
|
242
|
+
challengeCount: challengeList.length,
|
|
243
|
+
challengeActions: challengeList.map(c => c.action),
|
|
244
|
+
source: propChallenges && propChallenges.length > 0 ? 'propChallenges' :
|
|
245
|
+
onFetchChallenges ? 'onFetchChallenges' :
|
|
246
|
+
instructions && instructions.length > 0 ? 'instructions' : 'default'
|
|
247
|
+
});
|
|
241
248
|
setChallenges(challengeList);
|
|
242
249
|
setPhase('countdown');
|
|
243
250
|
} catch (error) {
|
|
@@ -574,6 +581,13 @@ export const VideoRecorder: React.FC<VideoRecorderProps> = ({
|
|
|
574
581
|
}, [frames, completedChallenges, challenges, sessionId, onComplete, minDurationMs, resetAndRetry, strings]);
|
|
575
582
|
|
|
576
583
|
const runChallenge = useCallback((index: number) => {
|
|
584
|
+
logger.info('VideoRecorder: runChallenge called', {
|
|
585
|
+
index,
|
|
586
|
+
challengesLength: challenges.length,
|
|
587
|
+
challengeActions: challenges.map(c => c.action),
|
|
588
|
+
completedChallengesCount: completedChallenges.length
|
|
589
|
+
});
|
|
590
|
+
|
|
577
591
|
if (index >= challenges.length) {
|
|
578
592
|
setOverallProgress(100);
|
|
579
593
|
|
|
@@ -647,7 +661,16 @@ export const VideoRecorder: React.FC<VideoRecorderProps> = ({
|
|
|
647
661
|
setTimeout(() => {
|
|
648
662
|
clearInterval(progressInterval);
|
|
649
663
|
|
|
650
|
-
setCompletedChallenges(prev =>
|
|
664
|
+
setCompletedChallenges(prev => {
|
|
665
|
+
const updated = [...prev, challenge.action];
|
|
666
|
+
logger.info('VideoRecorder: Challenge completed', {
|
|
667
|
+
action: challenge.action,
|
|
668
|
+
index,
|
|
669
|
+
completedCount: updated.length,
|
|
670
|
+
completedActions: updated
|
|
671
|
+
});
|
|
672
|
+
return updated;
|
|
673
|
+
});
|
|
651
674
|
|
|
652
675
|
Animated.timing(fadeAnim, {
|
|
653
676
|
toValue: 0,
|
|
@@ -687,7 +710,31 @@ export const VideoRecorder: React.FC<VideoRecorderProps> = ({
|
|
|
687
710
|
startFrameCapture();
|
|
688
711
|
}
|
|
689
712
|
|
|
690
|
-
|
|
713
|
+
/**
|
|
714
|
+
* If challenges are not available, set default challenges and run challenge
|
|
715
|
+
* This should not happen if ProfilePictureCapture properly waits for challenges
|
|
716
|
+
* But as a fallback, set defaults and retry after state update
|
|
717
|
+
* Schedule runChallenge to execute after state update completes
|
|
718
|
+
* This ensures the updated challenges are available when runChallenge executes
|
|
719
|
+
* Check again after state update - runChallenge callback should have latest challenges
|
|
720
|
+
*/
|
|
721
|
+
if (challenges.length === 0) {
|
|
722
|
+
logger.warn('VideoRecorder: No challenges available when starting recording - challenges should have been loaded by initChallenges');
|
|
723
|
+
const defaultChallenges = smartMode ? getDefaultChallenges(getStrings()) : [
|
|
724
|
+
{
|
|
725
|
+
action: 'stay_still',
|
|
726
|
+
instruction: getStrings().liveness.instructions.stayStill || 'Look at the camera and stay still',
|
|
727
|
+
duration_ms: duration || 5000,
|
|
728
|
+
order: 1,
|
|
729
|
+
},
|
|
730
|
+
];
|
|
731
|
+
setChallenges(defaultChallenges);
|
|
732
|
+
Promise.resolve().then(() => {
|
|
733
|
+
runChallenge(0);
|
|
734
|
+
});
|
|
735
|
+
} else {
|
|
736
|
+
runChallenge(0);
|
|
737
|
+
}
|
|
691
738
|
|
|
692
739
|
const maxDuration = Math.max(totalDuration, minDurationMs + 2000);
|
|
693
740
|
recordingTimeoutRef.current = setTimeout(() => {
|
|
@@ -704,7 +751,7 @@ export const VideoRecorder: React.FC<VideoRecorderProps> = ({
|
|
|
704
751
|
recordingTimeoutRef.current = null;
|
|
705
752
|
}
|
|
706
753
|
};
|
|
707
|
-
}, [device, totalDuration, minDurationMs, handleVideoComplete, handleRecordingError, runChallenge, stopRecording, startFrameCapture]);
|
|
754
|
+
}, [device, totalDuration, minDurationMs, handleVideoComplete, handleRecordingError, runChallenge, stopRecording, startFrameCapture, challenges, smartMode, duration]);
|
|
708
755
|
|
|
709
756
|
const currentChallenge = challenges[currentChallengeIndex];
|
|
710
757
|
|