@olenbetong/synergi-course 2.1.0 → 2.2.0

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.
Files changed (47) hide show
  1. package/es/document/cues.d.ts +1 -1
  2. package/es/document/cues.js +3 -1
  3. package/es/document/effects.d.ts +3 -3
  4. package/es/document/effects.js +3 -1
  5. package/es/document/schema.d.ts +1778 -190
  6. package/es/document/schema.js +35 -2
  7. package/es/document/validate.js +14 -18
  8. package/es/index.d.ts +3 -2
  9. package/es/index.js +1 -1
  10. package/es/player/CoursePlayer.css +18 -0
  11. package/es/player/CoursePlayer.js +3 -2
  12. package/es/player/PlayerBars.d.ts +32 -0
  13. package/es/player/PlayerBars.js +14 -0
  14. package/es/steps/Blocks.d.ts +24 -3
  15. package/es/steps/Blocks.js +14 -7
  16. package/es/steps/Markdown.js +1 -1
  17. package/es/steps/QuizStepView.d.ts +2 -1
  18. package/es/steps/QuizStepView.js +20 -10
  19. package/es/steps/SlideStepView.d.ts +1 -1
  20. package/es/steps/SlideStepView.js +14 -4
  21. package/es/steps/StepBodyProps.d.ts +9 -0
  22. package/es/steps/StepView.css +65 -7
  23. package/es/steps/StepView.d.ts +29 -3
  24. package/es/steps/StepView.js +21 -5
  25. package/es/types.d.ts +13 -2
  26. package/package.json +1 -1
  27. package/src/document/box.test.ts +234 -0
  28. package/src/document/cues.ts +2 -1
  29. package/src/document/effects.ts +4 -3
  30. package/src/document/schema.ts +44 -2
  31. package/src/document/validate.ts +15 -19
  32. package/src/index.ts +11 -1
  33. package/src/player/CoursePlayer.css +18 -0
  34. package/src/player/CoursePlayer.tsx +38 -58
  35. package/src/player/PlayerBars.tsx +106 -0
  36. package/src/steps/Blocks.tsx +55 -8
  37. package/src/steps/Box.test.tsx +95 -0
  38. package/src/steps/Markdown.test.tsx +3 -0
  39. package/src/steps/Markdown.tsx +1 -1
  40. package/src/steps/QuizStepView.test.tsx +79 -0
  41. package/src/steps/QuizStepView.tsx +34 -12
  42. package/src/steps/SlideStepView.tsx +15 -3
  43. package/src/steps/StepBodyProps.ts +9 -0
  44. package/src/steps/StepView.css +65 -7
  45. package/src/steps/StepView.test.tsx +116 -0
  46. package/src/steps/StepView.tsx +100 -19
  47. package/src/types.ts +13 -2
package/src/types.ts CHANGED
@@ -70,7 +70,10 @@ export interface QuizQuestion {
70
70
  text: string;
71
71
  /** Several options may be right: shown as checkboxes instead of radio buttons. */
72
72
  multiple: boolean;
73
- /** Already answered in this attempt. Set when an open attempt is resumed; the quiz continues at the first question without it. */
73
+ /**
74
+ * Already answered in this attempt. Set when an open attempt is resumed; the quiz continues at the first question
75
+ * without it. With `retryUntilCorrect`, only a correct answer counts, so a question last answered wrong is asked again.
76
+ */
74
77
  answered?: boolean;
75
78
  options: QuizOption[];
76
79
  }
@@ -79,6 +82,11 @@ export interface QuizAttempt {
79
82
  attemptId: string;
80
83
  /** Percent of correct answers needed to pass. `null` means every answer must be correct. */
81
84
  passPercent: number | null;
85
+ /**
86
+ * Each question must be answered correctly before the next one: a wrong answer only says so, and the learner
87
+ * answers the same question again. The attempt passes once every question is right; `passPercent` is not used.
88
+ */
89
+ retryUntilCorrect?: boolean;
82
90
  questions: QuizQuestion[];
83
91
  /** The learner has passed this quiz before; the player shows it as passed without asking again. */
84
92
  alreadyPassed?: boolean;
@@ -86,7 +94,8 @@ export interface QuizAttempt {
86
94
 
87
95
  export interface QuizAnswerResult {
88
96
  correct: boolean;
89
- explanation?: string;
97
+ /** Left out after a wrong answer when the quiz has `retryUntilCorrect`; the player then never shows one. */
98
+ explanation?: string | null;
90
99
  }
91
100
 
92
101
  export interface QuizResult {
@@ -95,6 +104,8 @@ export interface QuizResult {
95
104
  correctCount: number;
96
105
  questionCount: number;
97
106
  passPercent: number | null;
107
+ /** The quiz had to be answered correctly question by question, so a passed attempt is every question right. */
108
+ retryUntilCorrect?: boolean;
98
109
  /** The ids of the must-be-correct questions that were answered wrong. */
99
110
  missedRequired: string[];
100
111
  }