@hexar/biometric-identity-sdk-react-native 1.1.18 → 1.1.19
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,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,
|
|
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,CAw6BtD,CAAC;AA4OF,eAAe,aAAa,CAAC"}
|
|
@@ -102,6 +102,7 @@ const VideoRecorder = ({ theme, language, duration, instructions, challenges: pr
|
|
|
102
102
|
const [challengeProgress, setChallengeProgress] = (0, react_1.useState)(0);
|
|
103
103
|
const [overallProgress, setOverallProgress] = (0, react_1.useState)(0);
|
|
104
104
|
const [completedChallenges, setCompletedChallenges] = (0, react_1.useState)([]);
|
|
105
|
+
const completedChallengesRef = (0, react_1.useRef)([]);
|
|
105
106
|
const [frames, setFrames] = (0, react_1.useState)([]);
|
|
106
107
|
const framesRef = (0, react_1.useRef)([]);
|
|
107
108
|
const [hasPermission, setHasPermission] = (0, react_1.useState)(false);
|
|
@@ -280,6 +281,7 @@ const VideoRecorder = ({ theme, language, duration, instructions, challenges: pr
|
|
|
280
281
|
setFrames([]);
|
|
281
282
|
framesRef.current = [];
|
|
282
283
|
setCompletedChallenges([]);
|
|
284
|
+
completedChallengesRef.current = [];
|
|
283
285
|
setCurrentChallengeIndex(0);
|
|
284
286
|
setChallengeProgress(0);
|
|
285
287
|
setOverallProgress(0);
|
|
@@ -327,15 +329,22 @@ const VideoRecorder = ({ theme, language, duration, instructions, challenges: pr
|
|
|
327
329
|
return;
|
|
328
330
|
}
|
|
329
331
|
biometric_identity_sdk_core_1.logger.info('Using frames for completion:', finalFrames.length, 'frames');
|
|
332
|
+
const currentCompletedChallenges = completedChallengesRef.current.length > 0 ? completedChallengesRef.current : completedChallenges;
|
|
333
|
+
biometric_identity_sdk_core_1.logger.info('VideoRecorder: handleVideoComplete - completed challenges', {
|
|
334
|
+
refCount: completedChallengesRef.current.length,
|
|
335
|
+
stateCount: completedChallenges.length,
|
|
336
|
+
usingRef: completedChallengesRef.current.length > 0,
|
|
337
|
+
challengesCompleted: currentCompletedChallenges
|
|
338
|
+
});
|
|
330
339
|
const result = {
|
|
331
340
|
frames: finalFrames,
|
|
332
341
|
duration: actualDuration,
|
|
333
|
-
instructionsFollowed:
|
|
342
|
+
instructionsFollowed: currentCompletedChallenges.length === challenges.length,
|
|
334
343
|
qualityScore: finalFrames.length > 0 ? Math.min(100, (finalFrames.length / 30) * 100) : 85,
|
|
335
|
-
challengesCompleted:
|
|
344
|
+
challengesCompleted: currentCompletedChallenges,
|
|
336
345
|
sessionId,
|
|
337
346
|
};
|
|
338
|
-
biometric_identity_sdk_core_1.logger.info('Video recording completed:', result.frames.length, 'frames,', (actualDuration / 1000).toFixed(1) + 's');
|
|
347
|
+
biometric_identity_sdk_core_1.logger.info('Video recording completed:', result.frames.length, 'frames,', (actualDuration / 1000).toFixed(1) + 's', 'challenges:', currentCompletedChallenges.length);
|
|
339
348
|
isRecordingRef.current = false;
|
|
340
349
|
onComplete(result);
|
|
341
350
|
}
|
|
@@ -449,14 +458,15 @@ const VideoRecorder = ({ theme, language, duration, instructions, challenges: pr
|
|
|
449
458
|
biometric_identity_sdk_core_1.logger.error('Error stopping video recording:', error);
|
|
450
459
|
const actualDuration = Date.now() - recordingStartTime.current;
|
|
451
460
|
const currentFrames = framesRef.current.length > 0 ? framesRef.current : frames;
|
|
461
|
+
const currentCompletedChallenges = completedChallengesRef.current.length > 0 ? completedChallengesRef.current : completedChallenges;
|
|
452
462
|
if (actualDuration >= minDurationMs && currentFrames.length > 0) {
|
|
453
463
|
biometric_identity_sdk_core_1.logger.info('Stopping recording with frames:', currentFrames.length);
|
|
454
464
|
const result = {
|
|
455
465
|
frames: currentFrames,
|
|
456
466
|
duration: actualDuration,
|
|
457
|
-
instructionsFollowed:
|
|
467
|
+
instructionsFollowed: currentCompletedChallenges.length === challenges.length,
|
|
458
468
|
qualityScore: Math.min(100, (currentFrames.length / 30) * 100),
|
|
459
|
-
challengesCompleted:
|
|
469
|
+
challengesCompleted: currentCompletedChallenges,
|
|
460
470
|
sessionId,
|
|
461
471
|
};
|
|
462
472
|
onComplete(result);
|
|
@@ -466,9 +476,9 @@ const VideoRecorder = ({ theme, language, duration, instructions, challenges: pr
|
|
|
466
476
|
const result = {
|
|
467
477
|
frames: currentFrames.length > 0 ? currentFrames : [],
|
|
468
478
|
duration: actualDuration,
|
|
469
|
-
instructionsFollowed:
|
|
479
|
+
instructionsFollowed: currentCompletedChallenges.length === challenges.length,
|
|
470
480
|
qualityScore: currentFrames.length > 0 ? Math.min(100, (currentFrames.length / 30) * 100) : 0,
|
|
471
|
-
challengesCompleted:
|
|
481
|
+
challengesCompleted: currentCompletedChallenges,
|
|
472
482
|
sessionId,
|
|
473
483
|
};
|
|
474
484
|
onComplete(result);
|
|
@@ -486,13 +496,20 @@ const VideoRecorder = ({ theme, language, duration, instructions, challenges: pr
|
|
|
486
496
|
}
|
|
487
497
|
setPhase('processing');
|
|
488
498
|
setOverallProgress(100);
|
|
499
|
+
const currentCompletedChallenges = completedChallengesRef.current.length > 0 ? completedChallengesRef.current : completedChallenges;
|
|
500
|
+
biometric_identity_sdk_core_1.logger.info('VideoRecorder: stopRecording - completed challenges', {
|
|
501
|
+
refCount: completedChallengesRef.current.length,
|
|
502
|
+
stateCount: completedChallenges.length,
|
|
503
|
+
usingRef: completedChallengesRef.current.length > 0,
|
|
504
|
+
challengesCompleted: currentCompletedChallenges
|
|
505
|
+
});
|
|
489
506
|
biometric_identity_sdk_core_1.logger.info('Completing recording with frames:', currentFrames.length);
|
|
490
507
|
const result = {
|
|
491
508
|
frames: currentFrames.length > 0 ? currentFrames : [],
|
|
492
509
|
duration: actualDuration,
|
|
493
|
-
instructionsFollowed:
|
|
510
|
+
instructionsFollowed: currentCompletedChallenges.length === challenges.length,
|
|
494
511
|
qualityScore: currentFrames.length > 0 ? Math.min(100, (currentFrames.length / 30) * 100) : 0,
|
|
495
|
-
challengesCompleted:
|
|
512
|
+
challengesCompleted: currentCompletedChallenges,
|
|
496
513
|
sessionId,
|
|
497
514
|
};
|
|
498
515
|
setTimeout(() => {
|
|
@@ -501,11 +518,12 @@ const VideoRecorder = ({ theme, language, duration, instructions, challenges: pr
|
|
|
501
518
|
}
|
|
502
519
|
}, [frames, completedChallenges, challenges, sessionId, onComplete, minDurationMs, resetAndRetry, strings]);
|
|
503
520
|
const runChallenge = (0, react_1.useCallback)((index) => {
|
|
521
|
+
const currentCompletedChallenges = completedChallengesRef.current.length > 0 ? completedChallengesRef.current : completedChallenges;
|
|
504
522
|
biometric_identity_sdk_core_1.logger.info('VideoRecorder: runChallenge called', {
|
|
505
523
|
index,
|
|
506
524
|
challengesLength: challenges.length,
|
|
507
525
|
challengeActions: challenges.map(c => c.action),
|
|
508
|
-
completedChallengesCount:
|
|
526
|
+
completedChallengesCount: currentCompletedChallenges.length
|
|
509
527
|
});
|
|
510
528
|
if (index >= challenges.length) {
|
|
511
529
|
setOverallProgress(100);
|
|
@@ -528,13 +546,14 @@ const VideoRecorder = ({ theme, language, duration, instructions, challenges: pr
|
|
|
528
546
|
}
|
|
529
547
|
else {
|
|
530
548
|
const actualDuration = Date.now() - recordingStartTime.current;
|
|
549
|
+
const currentCompletedChallenges = completedChallengesRef.current.length > 0 ? completedChallengesRef.current : completedChallenges;
|
|
531
550
|
if (actualDuration >= minDurationMs && frames.length > 0) {
|
|
532
551
|
const result = {
|
|
533
552
|
frames,
|
|
534
553
|
duration: actualDuration,
|
|
535
|
-
instructionsFollowed:
|
|
554
|
+
instructionsFollowed: currentCompletedChallenges.length === challenges.length,
|
|
536
555
|
qualityScore: Math.min(100, (frames.length / 30) * 100),
|
|
537
|
-
challengesCompleted:
|
|
556
|
+
challengesCompleted: currentCompletedChallenges,
|
|
538
557
|
sessionId,
|
|
539
558
|
};
|
|
540
559
|
onComplete(result);
|
|
@@ -571,6 +590,7 @@ const VideoRecorder = ({ theme, language, duration, instructions, challenges: pr
|
|
|
571
590
|
clearInterval(progressInterval);
|
|
572
591
|
setCompletedChallenges(prev => {
|
|
573
592
|
const updated = [...prev, challenge.action];
|
|
593
|
+
completedChallengesRef.current = updated; // Keep ref in sync
|
|
574
594
|
biometric_identity_sdk_core_1.logger.info('VideoRecorder: Challenge completed', {
|
|
575
595
|
action: challenge.action,
|
|
576
596
|
index,
|
|
@@ -593,6 +613,9 @@ const VideoRecorder = ({ theme, language, duration, instructions, challenges: pr
|
|
|
593
613
|
setPhase('recording');
|
|
594
614
|
recordingStartTime.current = Date.now();
|
|
595
615
|
isRecordingRef.current = true;
|
|
616
|
+
// Reset completed challenges ref when starting new recording
|
|
617
|
+
completedChallengesRef.current = [];
|
|
618
|
+
setCompletedChallenges([]);
|
|
596
619
|
if (cameraRef.current && device) {
|
|
597
620
|
try {
|
|
598
621
|
videoRecordingRef.current = await cameraRef.current.startRecording({
|
package/package.json
CHANGED
|
@@ -129,6 +129,7 @@ export const VideoRecorder: React.FC<VideoRecorderProps> = ({
|
|
|
129
129
|
const [challengeProgress, setChallengeProgress] = useState(0);
|
|
130
130
|
const [overallProgress, setOverallProgress] = useState(0);
|
|
131
131
|
const [completedChallenges, setCompletedChallenges] = useState<string[]>([]);
|
|
132
|
+
const completedChallengesRef = useRef<string[]>([]);
|
|
132
133
|
const [frames, setFrames] = useState<string[]>([]);
|
|
133
134
|
const framesRef = useRef<string[]>([]);
|
|
134
135
|
const [hasPermission, setHasPermission] = useState(false);
|
|
@@ -327,6 +328,7 @@ export const VideoRecorder: React.FC<VideoRecorderProps> = ({
|
|
|
327
328
|
setFrames([]);
|
|
328
329
|
framesRef.current = [];
|
|
329
330
|
setCompletedChallenges([]);
|
|
331
|
+
completedChallengesRef.current = [];
|
|
330
332
|
setCurrentChallengeIndex(0);
|
|
331
333
|
setChallengeProgress(0);
|
|
332
334
|
setOverallProgress(0);
|
|
@@ -392,16 +394,24 @@ export const VideoRecorder: React.FC<VideoRecorderProps> = ({
|
|
|
392
394
|
|
|
393
395
|
logger.info('Using frames for completion:', finalFrames.length, 'frames');
|
|
394
396
|
|
|
397
|
+
const currentCompletedChallenges = completedChallengesRef.current.length > 0 ? completedChallengesRef.current : completedChallenges;
|
|
398
|
+
logger.info('VideoRecorder: handleVideoComplete - completed challenges', {
|
|
399
|
+
refCount: completedChallengesRef.current.length,
|
|
400
|
+
stateCount: completedChallenges.length,
|
|
401
|
+
usingRef: completedChallengesRef.current.length > 0,
|
|
402
|
+
challengesCompleted: currentCompletedChallenges
|
|
403
|
+
});
|
|
404
|
+
|
|
395
405
|
const result: VideoRecordingResult = {
|
|
396
406
|
frames: finalFrames,
|
|
397
407
|
duration: actualDuration,
|
|
398
|
-
instructionsFollowed:
|
|
408
|
+
instructionsFollowed: currentCompletedChallenges.length === challenges.length,
|
|
399
409
|
qualityScore: finalFrames.length > 0 ? Math.min(100, (finalFrames.length / 30) * 100) : 85,
|
|
400
|
-
challengesCompleted:
|
|
410
|
+
challengesCompleted: currentCompletedChallenges,
|
|
401
411
|
sessionId,
|
|
402
412
|
};
|
|
403
413
|
|
|
404
|
-
logger.info('Video recording completed:', result.frames.length, 'frames,', (actualDuration / 1000).toFixed(1) + 's');
|
|
414
|
+
logger.info('Video recording completed:', result.frames.length, 'frames,', (actualDuration / 1000).toFixed(1) + 's', 'challenges:', currentCompletedChallenges.length);
|
|
405
415
|
|
|
406
416
|
isRecordingRef.current = false;
|
|
407
417
|
onComplete(result);
|
|
@@ -522,14 +532,15 @@ export const VideoRecorder: React.FC<VideoRecorderProps> = ({
|
|
|
522
532
|
const actualDuration = Date.now() - recordingStartTime.current;
|
|
523
533
|
const currentFrames = framesRef.current.length > 0 ? framesRef.current : frames;
|
|
524
534
|
|
|
535
|
+
const currentCompletedChallenges = completedChallengesRef.current.length > 0 ? completedChallengesRef.current : completedChallenges;
|
|
525
536
|
if (actualDuration >= minDurationMs && currentFrames.length > 0) {
|
|
526
537
|
logger.info('Stopping recording with frames:', currentFrames.length);
|
|
527
538
|
const result: VideoRecordingResult = {
|
|
528
539
|
frames: currentFrames,
|
|
529
540
|
duration: actualDuration,
|
|
530
|
-
instructionsFollowed:
|
|
541
|
+
instructionsFollowed: currentCompletedChallenges.length === challenges.length,
|
|
531
542
|
qualityScore: Math.min(100, (currentFrames.length / 30) * 100),
|
|
532
|
-
challengesCompleted:
|
|
543
|
+
challengesCompleted: currentCompletedChallenges,
|
|
533
544
|
sessionId,
|
|
534
545
|
};
|
|
535
546
|
onComplete(result);
|
|
@@ -538,9 +549,9 @@ export const VideoRecorder: React.FC<VideoRecorderProps> = ({
|
|
|
538
549
|
const result: VideoRecordingResult = {
|
|
539
550
|
frames: currentFrames.length > 0 ? currentFrames : [],
|
|
540
551
|
duration: actualDuration,
|
|
541
|
-
instructionsFollowed:
|
|
552
|
+
instructionsFollowed: currentCompletedChallenges.length === challenges.length,
|
|
542
553
|
qualityScore: currentFrames.length > 0 ? Math.min(100, (currentFrames.length / 30) * 100) : 0,
|
|
543
|
-
challengesCompleted:
|
|
554
|
+
challengesCompleted: currentCompletedChallenges,
|
|
544
555
|
sessionId,
|
|
545
556
|
};
|
|
546
557
|
onComplete(result);
|
|
@@ -564,13 +575,20 @@ export const VideoRecorder: React.FC<VideoRecorderProps> = ({
|
|
|
564
575
|
setPhase('processing');
|
|
565
576
|
setOverallProgress(100);
|
|
566
577
|
|
|
578
|
+
const currentCompletedChallenges = completedChallengesRef.current.length > 0 ? completedChallengesRef.current : completedChallenges;
|
|
579
|
+
logger.info('VideoRecorder: stopRecording - completed challenges', {
|
|
580
|
+
refCount: completedChallengesRef.current.length,
|
|
581
|
+
stateCount: completedChallenges.length,
|
|
582
|
+
usingRef: completedChallengesRef.current.length > 0,
|
|
583
|
+
challengesCompleted: currentCompletedChallenges
|
|
584
|
+
});
|
|
567
585
|
logger.info('Completing recording with frames:', currentFrames.length);
|
|
568
586
|
const result: VideoRecordingResult = {
|
|
569
587
|
frames: currentFrames.length > 0 ? currentFrames : [],
|
|
570
588
|
duration: actualDuration,
|
|
571
|
-
instructionsFollowed:
|
|
589
|
+
instructionsFollowed: currentCompletedChallenges.length === challenges.length,
|
|
572
590
|
qualityScore: currentFrames.length > 0 ? Math.min(100, (currentFrames.length / 30) * 100) : 0,
|
|
573
|
-
challengesCompleted:
|
|
591
|
+
challengesCompleted: currentCompletedChallenges,
|
|
574
592
|
sessionId,
|
|
575
593
|
};
|
|
576
594
|
|
|
@@ -581,11 +599,12 @@ export const VideoRecorder: React.FC<VideoRecorderProps> = ({
|
|
|
581
599
|
}, [frames, completedChallenges, challenges, sessionId, onComplete, minDurationMs, resetAndRetry, strings]);
|
|
582
600
|
|
|
583
601
|
const runChallenge = useCallback((index: number) => {
|
|
602
|
+
const currentCompletedChallenges = completedChallengesRef.current.length > 0 ? completedChallengesRef.current : completedChallenges;
|
|
584
603
|
logger.info('VideoRecorder: runChallenge called', {
|
|
585
604
|
index,
|
|
586
605
|
challengesLength: challenges.length,
|
|
587
606
|
challengeActions: challenges.map(c => c.action),
|
|
588
|
-
completedChallengesCount:
|
|
607
|
+
completedChallengesCount: currentCompletedChallenges.length
|
|
589
608
|
});
|
|
590
609
|
|
|
591
610
|
if (index >= challenges.length) {
|
|
@@ -612,13 +631,14 @@ export const VideoRecorder: React.FC<VideoRecorderProps> = ({
|
|
|
612
631
|
stopRecording();
|
|
613
632
|
} else {
|
|
614
633
|
const actualDuration = Date.now() - recordingStartTime.current;
|
|
634
|
+
const currentCompletedChallenges = completedChallengesRef.current.length > 0 ? completedChallengesRef.current : completedChallenges;
|
|
615
635
|
if (actualDuration >= minDurationMs && frames.length > 0) {
|
|
616
636
|
const result: VideoRecordingResult = {
|
|
617
637
|
frames,
|
|
618
638
|
duration: actualDuration,
|
|
619
|
-
instructionsFollowed:
|
|
639
|
+
instructionsFollowed: currentCompletedChallenges.length === challenges.length,
|
|
620
640
|
qualityScore: Math.min(100, (frames.length / 30) * 100),
|
|
621
|
-
challengesCompleted:
|
|
641
|
+
challengesCompleted: currentCompletedChallenges,
|
|
622
642
|
sessionId,
|
|
623
643
|
};
|
|
624
644
|
onComplete(result);
|
|
@@ -663,6 +683,7 @@ export const VideoRecorder: React.FC<VideoRecorderProps> = ({
|
|
|
663
683
|
|
|
664
684
|
setCompletedChallenges(prev => {
|
|
665
685
|
const updated = [...prev, challenge.action];
|
|
686
|
+
completedChallengesRef.current = updated; // Keep ref in sync
|
|
666
687
|
logger.info('VideoRecorder: Challenge completed', {
|
|
667
688
|
action: challenge.action,
|
|
668
689
|
index,
|
|
@@ -687,6 +708,9 @@ export const VideoRecorder: React.FC<VideoRecorderProps> = ({
|
|
|
687
708
|
setPhase('recording');
|
|
688
709
|
recordingStartTime.current = Date.now();
|
|
689
710
|
isRecordingRef.current = true;
|
|
711
|
+
// Reset completed challenges ref when starting new recording
|
|
712
|
+
completedChallengesRef.current = [];
|
|
713
|
+
setCompletedChallenges([]);
|
|
690
714
|
|
|
691
715
|
if (cameraRef.current && device) {
|
|
692
716
|
try {
|