@sage-rsc/talking-head-react 1.0.28 → 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/{fbxAnimationLoader-xd44uqKF.js → fbxAnimationLoader-Bsel7DtJ.js} +1 -1
- package/dist/{fbxAnimationLoader-BAdAJQ7P.cjs → fbxAnimationLoader-C_QSrujX.cjs} +1 -1
- package/dist/{index-zMY6cyU2.js → index-BvDk1TRw.js} +206 -202
- package/dist/{index-Dx7mDKJm.cjs → index-C3A1_CcE.cjs} +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/CurriculumLearning.jsx +19 -12
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-C3A1_CcE.cjs");exports.CurriculumLearning=i.CurriculumLearning;exports.TalkingHeadAvatar=i.TalkingHeadAvatar;exports.TalkingHeadComponent=i.TalkingHeadComponent;exports.animations=i.animations;exports.getActiveTTSConfig=i.getActiveTTSConfig;exports.getAnimation=i.getAnimation;exports.getVoiceOptions=i.getVoiceOptions;exports.hasAnimation=i.hasAnimation;
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -199,6 +199,9 @@ const CurriculumLearning = forwardRef(({
|
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
}, [animations.lessonComplete, curriculum, completeCurriculum, defaultAvatarConfig]);
|
|
202
|
+
|
|
203
|
+
// Assign ref immediately after function is defined
|
|
204
|
+
completeLessonRef.current = completeLesson;
|
|
202
205
|
|
|
203
206
|
// Complete entire curriculum
|
|
204
207
|
const completeCurriculum = useCallback(() => {
|
|
@@ -323,9 +326,12 @@ const CurriculumLearning = forwardRef(({
|
|
|
323
326
|
}
|
|
324
327
|
}
|
|
325
328
|
} else {
|
|
326
|
-
|
|
329
|
+
// Use ref to avoid circular dependency
|
|
330
|
+
if (completeLessonRef.current) {
|
|
331
|
+
completeLessonRef.current();
|
|
332
|
+
}
|
|
327
333
|
}
|
|
328
|
-
}, [animations.nextQuestion, getCurrentLesson,
|
|
334
|
+
}, [animations.nextQuestion, getCurrentLesson, getCurrentQuestion, defaultAvatarConfig]);
|
|
329
335
|
|
|
330
336
|
// Move to next lesson
|
|
331
337
|
const nextLesson = useCallback(() => {
|
|
@@ -361,6 +367,9 @@ const CurriculumLearning = forwardRef(({
|
|
|
361
367
|
completeCurriculum();
|
|
362
368
|
}
|
|
363
369
|
}, [curriculum, completeCurriculum]);
|
|
370
|
+
|
|
371
|
+
// Assign ref immediately after function is defined
|
|
372
|
+
nextLessonRef.current = nextLesson;
|
|
364
373
|
|
|
365
374
|
// Start teaching the lesson
|
|
366
375
|
const startTeaching = useCallback(() => {
|
|
@@ -416,6 +425,9 @@ const CurriculumLearning = forwardRef(({
|
|
|
416
425
|
}, 8000);
|
|
417
426
|
}
|
|
418
427
|
}, [animations.teaching, getCurrentLesson, startQuestions, defaultAvatarConfig]);
|
|
428
|
+
|
|
429
|
+
// Assign ref immediately after function is defined
|
|
430
|
+
startTeachingRef.current = startTeaching;
|
|
419
431
|
|
|
420
432
|
// Handle answer selection
|
|
421
433
|
const handleAnswerSelect = useCallback((answer) => {
|
|
@@ -546,23 +558,18 @@ const CurriculumLearning = forwardRef(({
|
|
|
546
558
|
stateRef.current.totalQuestions = 0;
|
|
547
559
|
}, []);
|
|
548
560
|
|
|
549
|
-
// Handle avatar ready callback
|
|
561
|
+
// Handle avatar ready callback - use ref to avoid circular dependency
|
|
550
562
|
const handleAvatarReady = useCallback((talkingHead) => {
|
|
551
563
|
console.log('Avatar is ready!', talkingHead);
|
|
552
564
|
const currentLesson = getCurrentLesson();
|
|
553
565
|
if (autoStart && currentLesson?.avatar_script) {
|
|
554
566
|
setTimeout(() => {
|
|
555
|
-
|
|
567
|
+
if (startTeachingRef.current) {
|
|
568
|
+
startTeachingRef.current();
|
|
569
|
+
}
|
|
556
570
|
}, 1000);
|
|
557
571
|
}
|
|
558
|
-
}, [autoStart, getCurrentLesson
|
|
559
|
-
|
|
560
|
-
// Update refs after all functions are defined to avoid circular dependency issues
|
|
561
|
-
useEffect(() => {
|
|
562
|
-
startTeachingRef.current = startTeaching;
|
|
563
|
-
nextLessonRef.current = nextLesson;
|
|
564
|
-
completeLessonRef.current = completeLesson;
|
|
565
|
-
}, [startTeaching, nextLesson, completeLesson]);
|
|
572
|
+
}, [autoStart, getCurrentLesson]);
|
|
566
573
|
|
|
567
574
|
// Expose methods via ref (for external control)
|
|
568
575
|
useImperativeHandle(ref, () => ({
|