@sage-rsc/talking-head-react 1.0.67 → 1.0.68

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sage-rsc/talking-head-react",
3
- "version": "1.0.67",
3
+ "version": "1.0.68",
4
4
  "description": "A reusable React component for 3D talking avatars with lip-sync and text-to-speech",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -23,6 +23,12 @@ import TalkingHeadAvatar from './TalkingHeadAvatar';
23
23
  * @param {Function} props.onCurriculumComplete - Callback when curriculum completes
24
24
  * @param {Function} props.onCustomAction - Callback for custom actions (receives action type and data)
25
25
  * - 'teachingComplete': Fired when teaching finishes. Check data.hasQuestions to know if questions are available.
26
+ * - 'codeExampleReady': Fired after teaching if lesson has a code_example. Contains codeExample object with:
27
+ * - code: The code string to type/run in IDE
28
+ * - language: Programming language (default: 'javascript')
29
+ * - description: Optional description of what the code does
30
+ * - autoRun: Whether to auto-run after typing (default: false)
31
+ * - typingSpeed: Typing speed in ms per character (default: 50)
26
32
  * - 'answerFeedbackComplete': Fired when answer feedback finishes. Check data.hasNextQuestion to know if more questions exist.
27
33
  * - 'lessonCompleteFeedbackDone': Fired when lesson completion feedback finishes. Check data.hasNextLesson to know if more lessons exist.
28
34
  * - 'allQuestionsComplete': Fired when all questions in a lesson are done. Parent should call completeLesson() when ready.
@@ -632,6 +638,18 @@ const CurriculumLearning = forwardRef(({
632
638
  lesson: currentLesson,
633
639
  hasQuestions: currentLesson.questions && currentLesson.questions.length > 0
634
640
  });
641
+
642
+ // Check if there's a code example to demonstrate
643
+ if (currentLesson?.code_example) {
644
+ // Trigger code example event - parent can handle IDE typing/running
645
+ callbacksRef.current.onCustomAction({
646
+ type: 'codeExampleReady',
647
+ moduleIndex: stateRef.current.currentModuleIndex,
648
+ lessonIndex: stateRef.current.currentLessonIndex,
649
+ lesson: currentLesson,
650
+ codeExample: currentLesson.code_example
651
+ });
652
+ }
635
653
  }
636
654
  });
637
655
  }