@tinyweb_dev/oe-exam-sdk 0.1.28 → 0.1.30

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 (796) hide show
  1. package/README.md +4 -4
  2. package/dist/api/contest-rooms.js +54 -1
  3. package/dist/api/contest-rooms.types.js +1 -1
  4. package/dist/api/exam-create.js +179 -1
  5. package/dist/api/exam-create.types.js +1 -1
  6. package/dist/api/exam-entry.js +68 -1
  7. package/dist/api/exam-entry.types.js +1 -1
  8. package/dist/api/exam-questions.js +149 -1
  9. package/dist/api/exam-questions.types.js +1 -1
  10. package/dist/api/exam-taking.js +84 -1
  11. package/dist/api/exam-taking.types.d.ts +7 -0
  12. package/dist/api/exam-taking.types.js +1 -1
  13. package/dist/api/index.js +8 -1
  14. package/dist/api/result-review.js +62 -1
  15. package/dist/api/result-review.types.js +16 -1
  16. package/dist/components/CueCardEditor.js +58 -1
  17. package/dist/components/common/ResolvedImage.js +15 -1
  18. package/dist/components/exams/CompletionDialog.js +8 -1
  19. package/dist/components/exams/CreateExamInfoForm.js +84 -1
  20. package/dist/components/exams/CreateExamPageContainer.js +110 -1
  21. package/dist/components/exams/ExamCreator.js +287 -1
  22. package/dist/components/exams/ExamPartTabs.js +138 -1
  23. package/dist/components/exams/ExamPreviewDialog.d.ts +6 -7
  24. package/dist/components/exams/ExamPreviewDialog.js +121 -1
  25. package/dist/components/exams/ExamPreviewPartContent.d.ts +18 -0
  26. package/dist/components/exams/ExamPreviewPartContent.js +27 -0
  27. package/dist/components/exams/ExamPreviewSidebar.d.ts +17 -0
  28. package/dist/components/exams/ExamPreviewSidebar.js +37 -0
  29. package/dist/components/exams/ExamQuestionGrid.js +37 -1
  30. package/dist/components/exams/ExamQuestionsPageContainer.js +112 -1
  31. package/dist/components/exams/ExamViewDialog.js +61 -1
  32. package/dist/components/exams/PartAudioUploader.js +9 -1
  33. package/dist/components/exams/TemplateSelector.js +76 -1
  34. package/dist/components/exams/UnsavedChangesDialog.js +7 -1
  35. package/dist/components/exams/api.js +3 -1
  36. package/dist/components/exams/create-exam.texts.js +1 -1
  37. package/dist/components/exams/create-exam.validation.js +18 -1
  38. package/dist/components/exams/entry/EntryRestartDialog.js +11 -1
  39. package/dist/components/exams/entry/StudentExamEntryPageContainer.js +358 -1
  40. package/dist/components/exams/entry/exam-entry.states.js +26 -1
  41. package/dist/components/exams/entry/exam-entry.utils.js +55 -1
  42. package/dist/components/exams/entry/fullscreen-loading.js +18 -1
  43. package/dist/components/exams/entry/index.js +4 -1
  44. package/dist/components/exams/exam-preview.types.d.ts +30 -0
  45. package/dist/components/exams/exam-preview.types.js +62 -0
  46. package/dist/components/exams/exam-question-status.js +45 -1
  47. package/dist/components/exams/exam-template.utils.js +18 -1
  48. package/dist/components/exams/index.d.ts +1 -0
  49. package/dist/components/exams/index.js +19 -1
  50. package/dist/components/exams/rooms/StudentContestRoomsPageContainer.js +183 -1
  51. package/dist/components/exams/rooms/contest-rooms.utils.js +93 -1
  52. package/dist/components/exams/rooms/index.js +2 -1
  53. package/dist/components/exams/take/ExamTakingApiContext.js +25 -1
  54. package/dist/components/exams/take/ExamTakingPageContainer.js +955 -1
  55. package/dist/components/exams/take/GenericQuestionRenderer.js +14 -1
  56. package/dist/components/exams/take/components/QuestionRenderer.js +207 -1
  57. package/dist/components/exams/take/components/index.js +11 -1
  58. package/dist/components/exams/take/components/question-renderers/ArticlesViewer.js +8 -1
  59. package/dist/components/exams/take/components/question-renderers/MoversAnswerTheQuestionRenderer.js +30 -1
  60. package/dist/components/exams/take/components/question-renderers/MoversChooseAdjectiveRenderer.js +63 -1
  61. package/dist/components/exams/take/components/question-renderers/MoversChooseBestAnswerRenderer.js +136 -1
  62. package/dist/components/exams/take/components/question-renderers/MoversColoringRenderer.js +379 -1
  63. package/dist/components/exams/take/components/question-renderers/MoversCrossOutWordGroupRenderer.d.ts +20 -0
  64. package/dist/components/exams/take/components/question-renderers/MoversCrossOutWordGroupRenderer.js +141 -0
  65. package/dist/components/exams/take/components/question-renderers/MoversFillWordHintRenderer.js +131 -1
  66. package/dist/components/exams/take/components/question-renderers/MoversGridFillRenderer.js +76 -1
  67. package/dist/components/exams/take/components/question-renderers/MoversLabelThePictureRenderer.js +68 -1
  68. package/dist/components/exams/take/components/question-renderers/MoversListenAndWriteRenderer.js +42 -1
  69. package/dist/components/exams/take/components/question-renderers/MoversMatchByWritingAnswerRenderer.js +131 -1
  70. package/dist/components/exams/take/components/question-renderers/MoversPictureChooseRenderer.js +76 -1
  71. package/dist/components/exams/take/components/question-renderers/MoversPictureFillBlankChooseRenderer.js +68 -1
  72. package/dist/components/exams/take/components/question-renderers/MoversReadingPassageRenderer.js +62 -1
  73. package/dist/components/exams/take/components/question-renderers/MoversTrueFalseRenderer.d.ts +1 -1
  74. package/dist/components/exams/take/components/question-renderers/MoversTrueFalseRenderer.js +51 -1
  75. package/dist/components/exams/take/components/question-renderers/MoversWordFillParagraphRenderer.js +171 -1
  76. package/dist/components/exams/take/components/question-renderers/MoversWordFillStructuredFormRenderer.js +198 -1
  77. package/dist/components/exams/take/components/question-renderers/MoversWordOrderAndMatchGroupRenderer.d.ts +15 -0
  78. package/dist/components/exams/take/components/question-renderers/MoversWordOrderAndMatchGroupRenderer.js +36 -0
  79. package/dist/components/exams/take/components/question-renderers/MoversWordOrderingRenderer.js +92 -1
  80. package/dist/components/exams/take/components/question-renderers/MoversWriteSentencesRenderer.js +11 -1
  81. package/dist/components/exams/take/components/question-renderers/MoversWritingRenderer.js +56 -1
  82. package/dist/components/exams/take/components/question-renderers/index.d.ts +2 -0
  83. package/dist/components/exams/take/components/question-renderers/index.js +25 -1
  84. package/dist/components/exams/take/components/speaking/SpeakingAudioPlayer.js +85 -1
  85. package/dist/components/exams/take/components/speaking/SpeakingContentFrame.js +10 -1
  86. package/dist/components/exams/take/components/speaking/SpeakingExamLayout.js +15 -1
  87. package/dist/components/exams/take/components/speaking/SpeakingHeader.js +6 -1
  88. package/dist/components/exams/take/components/speaking/SpeakingInstructionBar.js +8 -1
  89. package/dist/components/exams/take/components/speaking/SpeakingMicButton.js +59 -1
  90. package/dist/components/exams/take/components/speaking/SpeakingNavButton.js +7 -1
  91. package/dist/components/exams/take/components/speaking/SpeakingPartBadge.js +5 -1
  92. package/dist/components/exams/take/components/speaking/SpeakingReadDisplayedContent.module.css +120 -0
  93. package/dist/components/exams/take/components/speaking/SpeakingRecordingPreview.js +73 -1
  94. package/dist/components/exams/take/components/speaking/SpeakingReportErrorButton.js +8 -1
  95. package/dist/components/exams/take/components/speaking/SpeakingSpontaneousQA.module.css +344 -0
  96. package/dist/components/exams/take/components/speaking/SpeakingVideoIntro.js +32 -1
  97. package/dist/components/exams/take/components/speaking/index.js +1 -1
  98. package/dist/components/exams/take/components/speaking/renderers/SpeakingChooseAnswerGroupRenderer.js +63 -1
  99. package/dist/components/exams/take/components/speaking/renderers/SpeakingChooseObjectsRenderer.js +95 -1
  100. package/dist/components/exams/take/components/speaking/renderers/SpeakingCompareImagesRenderer.js +35 -1
  101. package/dist/components/exams/take/components/speaking/renderers/SpeakingConversationRenderer.js +147 -1
  102. package/dist/components/exams/take/components/speaking/renderers/SpeakingCueCardRenderer.js +232 -1
  103. package/dist/components/exams/take/components/speaking/renderers/SpeakingDescribeImageRenderer.js +193 -1
  104. package/dist/components/exams/take/components/speaking/renderers/SpeakingDragObjectsRenderer.js +155 -1
  105. package/dist/components/exams/take/components/speaking/renderers/SpeakingGNInterviewRenderer.js +212 -1
  106. package/dist/components/exams/take/components/speaking/renderers/SpeakingInfoExchangeRenderer.js +77 -1
  107. package/dist/components/exams/take/components/speaking/renderers/SpeakingListenAndSpeakAnswerRenderer.js +64 -1
  108. package/dist/components/exams/take/components/speaking/renderers/SpeakingOddOneOutRenderer.js +69 -1
  109. package/dist/components/exams/take/components/speaking/renderers/SpeakingQuestionListRenderer.js +64 -1
  110. package/dist/components/exams/take/components/speaking/renderers/SpeakingQuestionRenderer.js +92 -1
  111. package/dist/components/exams/take/components/speaking/renderers/SpeakingReadDisplayedContentRenderer.js +202 -1
  112. package/dist/components/exams/take/components/speaking/renderers/SpeakingSpontaneousQARenderer.js +339 -1
  113. package/dist/components/exams/take/components/speaking/renderers/SpeakingSpontaneousQaGroupRenderer.d.ts +19 -0
  114. package/dist/components/exams/take/components/speaking/renderers/SpeakingSpontaneousQaGroupRenderer.js +76 -0
  115. package/dist/components/exams/take/components/speaking/renderers/SpeakingStoryImagesRenderer.js +56 -1
  116. package/dist/components/exams/take/components/speaking/renderers/SpontaneousQACambridgeLayout.d.ts +24 -0
  117. package/dist/components/exams/take/components/speaking/renderers/SpontaneousQACambridgeLayout.js +120 -0
  118. package/dist/components/exams/take/components/speaking/renderers/SpontaneousQAInlineAudioPlayer.d.ts +8 -0
  119. package/dist/components/exams/take/components/speaking/renderers/SpontaneousQAInlineAudioPlayer.js +94 -0
  120. package/dist/components/exams/take/components/speaking/renderers/SpontaneousQASummerSkyAudioPlayer.d.ts +8 -0
  121. package/dist/components/exams/take/components/speaking/renderers/SpontaneousQASummerSkyAudioPlayer.js +101 -0
  122. package/dist/components/exams/take/components/speaking/renderers/index.d.ts +1 -0
  123. package/dist/components/exams/take/components/speaking/renderers/index.js +14 -1
  124. package/dist/components/exams/take/exam-taking.utils.d.ts +13 -0
  125. package/dist/components/exams/take/exam-taking.utils.js +203 -1
  126. package/dist/components/exams/take/hooks/index.js +2 -1
  127. package/dist/components/exams/take/hooks/useAnswerAutosave.js +71 -1
  128. package/dist/components/exams/take/hooks/useAttemptSubmit.js +38 -1
  129. package/dist/components/exams/take/hooks/useAutoSave.js +83 -1
  130. package/dist/components/exams/take/hooks/useExamCountdown.js +35 -1
  131. package/dist/components/exams/take/hooks/useExamTimer.js +97 -1
  132. package/dist/components/exams/take/hooks/useProctoringCamera.js +118 -1
  133. package/dist/components/exams/take/hooks/useProctoringSnapshot.js +76 -1
  134. package/dist/components/exams/take/hooks/useSpeakingConversationAudio.js +178 -1
  135. package/dist/components/exams/take/hooks/useSpeakingNavigation.js +51 -1
  136. package/dist/components/exams/take/hooks/useSpeakingRecorder.js +406 -1
  137. package/dist/components/exams/take/hooks/useSpeakingRendererSetup.js +136 -1
  138. package/dist/components/exams/take/hooks/useSpontaneousQaGroupRecorder.d.ts +11 -0
  139. package/dist/components/exams/take/hooks/useSpontaneousQaGroupRecorder.js +352 -0
  140. package/dist/components/exams/take/hooks/useSpontaneousQaGroupRendererSetup.d.ts +42 -0
  141. package/dist/components/exams/take/hooks/useSpontaneousQaGroupRendererSetup.js +166 -0
  142. package/dist/components/exams/take/hooks/useToeicAudio.js +35 -1
  143. package/dist/components/exams/take/index.js +6 -1
  144. package/dist/components/exams/take/types/speaking-cue-card.types.js +1 -1
  145. package/dist/components/exams/take/types/speaking.types.js +7 -1
  146. package/dist/components/exams/take/types.js +4 -1
  147. package/dist/components/exams/take/utils/answer-transformers.js +452 -1
  148. package/dist/components/exams/take/utils/cambridge-yle-inline-speaking.d.ts +21 -0
  149. package/dist/components/exams/take/utils/cambridge-yle-inline-speaking.js +44 -0
  150. package/dist/components/exams/take/utils/coloring-assignments.js +40 -1
  151. package/dist/components/exams/take/utils/cross-out-word-group.transformer.d.ts +21 -0
  152. package/dist/components/exams/take/utils/cross-out-word-group.transformer.js +83 -0
  153. package/dist/components/exams/take/utils/question-transformers.d.ts +43 -2
  154. package/dist/components/exams/take/utils/question-transformers.js +1137 -1
  155. package/dist/components/features/exam-entry/entry-state-cards.js +19 -1
  156. package/dist/components/features/exam-entry/index.js +2 -1
  157. package/dist/components/features/exam-entry/themed/CambridgeYleWaitingRoom.js +121 -1
  158. package/dist/components/features/exam-entry/themed/ThemedWaitingRoom.js +37 -1
  159. package/dist/components/features/exam-entry/themed/ToeicWaitingRoom.js +15 -1
  160. package/dist/components/features/exam-entry/themed/cambridge-yle-waiting-parts.js +80 -1
  161. package/dist/components/features/exam-entry/themed/components/CloseButton.js +6 -1
  162. package/dist/components/features/exam-entry/themed/components/ExamInfoPanel.js +17 -1
  163. package/dist/components/features/exam-entry/themed/components/ModeSelector.js +6 -1
  164. package/dist/components/features/exam-entry/themed/components/StartButton.js +12 -1
  165. package/dist/components/features/exam-entry/themed/components/index.js +4 -1
  166. package/dist/components/features/exam-entry/themed/index.js +3 -1
  167. package/dist/components/index.d.ts +1 -0
  168. package/dist/components/index.js +43 -1
  169. package/dist/components/questions/_shared/config/question-types.config.js +362 -1
  170. package/dist/components/questions/_shared/constants/color-palette.js +21 -1
  171. package/dist/components/questions/_shared/hooks/useAnswerGroupQuestionGroup.js +105 -1
  172. package/dist/components/questions/_shared/hooks/useBasicQuestionGroup.js +222 -1
  173. package/dist/components/questions/_shared/hooks/useCompareImagesGroup.js +140 -1
  174. package/dist/components/questions/_shared/hooks/useImageQuestionGroup.js +123 -1
  175. package/dist/components/questions/_shared/hooks/useInfoExchangeGroup.js +50 -1
  176. package/dist/components/questions/_shared/hooks/useQuestionFormState.js +54 -1
  177. package/dist/components/questions/_shared/hooks/useQuestionInitialization.js +123 -1
  178. package/dist/components/questions/_shared/hooks/useQuestionListGroup.js +121 -1
  179. package/dist/components/questions/_shared/hooks/useQuestionOnChange.js +70 -1
  180. package/dist/components/questions/_shared/hooks/useSceneQuestionGroup.js +194 -1
  181. package/dist/components/questions/_shared/index.js +7 -1
  182. package/dist/components/questions/_shared/types/answer-the-question.type.js +1 -1
  183. package/dist/components/questions/_shared/types/arrange-letters-into-words.type.js +1 -1
  184. package/dist/components/questions/_shared/types/choose-correct-adjective.type.js +3 -1
  185. package/dist/components/questions/_shared/types/choose-the-correct-answer-group.type.d.ts +1 -0
  186. package/dist/components/questions/_shared/types/choose-the-correct-answer-group.type.js +1 -1
  187. package/dist/components/questions/_shared/types/color-region.config.js +1 -1
  188. package/dist/components/questions/_shared/types/cross-out-word-group.type.d.ts +2 -0
  189. package/dist/components/questions/_shared/types/cross-out-word-group.type.js +1 -1
  190. package/dist/components/questions/_shared/types/fill-in-blank.type.js +1 -1
  191. package/dist/components/questions/_shared/types/fill-missing-words-in-grid.type.js +1 -1
  192. package/dist/components/questions/_shared/types/gn-speaking-interview.type.js +1 -1
  193. package/dist/components/questions/_shared/types/index.d.ts +1 -0
  194. package/dist/components/questions/_shared/types/index.js +14 -1
  195. package/dist/components/questions/_shared/types/label-the-picture.type.js +1 -1
  196. package/dist/components/questions/_shared/types/listen-and-choose-from-answer-group.type.js +1 -1
  197. package/dist/components/questions/_shared/types/listen-and-choose-objects-in-scene.type.js +1 -1
  198. package/dist/components/questions/_shared/types/listen-and-drag-objects-into-scene.type.js +1 -1
  199. package/dist/components/questions/_shared/types/listen-and-speak-answer.type.js +1 -1
  200. package/dist/components/questions/_shared/types/listen-and-speak-compare-images.type.js +1 -1
  201. package/dist/components/questions/_shared/types/listen-and-speak-image-group.type.js +1 -1
  202. package/dist/components/questions/_shared/types/listen-and-speak-info-exchange.type.js +1 -1
  203. package/dist/components/questions/_shared/types/listen-and-speak-odd-one-out.type.js +3 -1
  204. package/dist/components/questions/_shared/types/listen-and-speak-question-list.type.js +1 -1
  205. package/dist/components/questions/_shared/types/listen-and-speak-with-story-images.type.js +3 -1
  206. package/dist/components/questions/_shared/types/listen-and-tick-answer.type.js +1 -1
  207. package/dist/components/questions/_shared/types/listening-drawline.type.js +1 -1
  208. package/dist/components/questions/_shared/types/look-and-choose-answer.type.js +1 -1
  209. package/dist/components/questions/_shared/types/look-picture-fill-word-hint.type.js +1 -1
  210. package/dist/components/questions/_shared/types/match-by-writing-answer.type.js +1 -1
  211. package/dist/components/questions/_shared/types/multiple-choice.type.d.ts +5 -0
  212. package/dist/components/questions/_shared/types/multiple-choice.type.js +1 -1
  213. package/dist/components/questions/_shared/types/question-group.type.js +11 -1
  214. package/dist/components/questions/_shared/types/read-and-color-objects.type.js +1 -1
  215. package/dist/components/questions/_shared/types/read-displayed-content.type.js +1 -1
  216. package/dist/components/questions/_shared/types/read-passage-and-answer-questions.type.js +1 -1
  217. package/dist/components/questions/_shared/types/speaking-describe-image.type.js +1 -1
  218. package/dist/components/questions/_shared/types/spontaneous-qa-group.type.d.ts +37 -0
  219. package/dist/components/questions/_shared/types/spontaneous-qa-group.type.js +1 -0
  220. package/dist/components/questions/_shared/types/spontaneous-qa.type.js +1 -1
  221. package/dist/components/questions/_shared/types/true-false-group.type.js +1 -1
  222. package/dist/components/questions/_shared/types/word-fill-paragraph-with-options.type.js +1 -1
  223. package/dist/components/questions/_shared/types/word-fill-paragraph.type.js +1 -1
  224. package/dist/components/questions/_shared/types/word-fill-structured-form.type.d.ts +20 -11
  225. package/dist/components/questions/_shared/types/word-fill-structured-form.type.js +1 -1
  226. package/dist/components/questions/_shared/types/word-order-and-match-group.type.d.ts +38 -0
  227. package/dist/components/questions/_shared/types/word-order-and-match-group.type.js +1 -0
  228. package/dist/components/questions/_shared/types/word-ordering.type.js +1 -1
  229. package/dist/components/questions/_shared/types/write-a-short-letter.type.js +1 -1
  230. package/dist/components/questions/_shared/types/write-correct-verb-form.type.js +3 -1
  231. package/dist/components/questions/_shared/types/write-sentences.type.js +1 -1
  232. package/dist/components/questions/_shared/types/write-short-paragraph.type.js +1 -1
  233. package/dist/components/questions/_shared/utils/answer-builder.js +79 -1
  234. package/dist/components/questions/_shared/utils/createColorRegionRegistration.js +39 -1
  235. package/dist/components/questions/_shared/utils/id-generator.js +3 -1
  236. package/dist/components/questions/_shared/utils/parseFillBlankStem.d.ts +30 -0
  237. package/dist/components/questions/_shared/utils/parseFillBlankStem.js +69 -0
  238. package/dist/components/questions/_shared/utils/question-validation.js +21 -1
  239. package/dist/components/questions/components/ColorNode.js +85 -1
  240. package/dist/components/questions/components/ColorRegionClient.js +545 -1
  241. package/dist/components/questions/components/ColorRegionCreator.js +420 -1
  242. package/dist/components/questions/components/ColorRegionNode.js +59 -1
  243. package/dist/components/questions/components/CreatorGuide.js +103 -1
  244. package/dist/components/questions/components/NameNode.js +26 -1
  245. package/dist/components/questions/components/QuestionBankOption.js +46 -1
  246. package/dist/components/questions/components/QuestionBasicInfoForm.js +9 -1
  247. package/dist/components/questions/components/QuestionCommonFields.js +33 -1
  248. package/dist/components/questions/components/QuestionSearchDropdown.js +258 -1
  249. package/dist/components/questions/components/QuestionTypeSelector.js +32 -1
  250. package/dist/components/questions/components/QuestionTypeSpecificForms.js +6 -1
  251. package/dist/components/questions/components/RegionNode.js +94 -1
  252. package/dist/components/questions/components/index.js +14 -1
  253. package/dist/components/questions/creator/QuestionCreator.js +90 -1
  254. package/dist/components/questions/creator/QuestionGroupCreator.js +119 -1
  255. package/dist/components/questions/creator/dedicated-component-router.js +79 -1
  256. package/dist/components/questions/creator/index.js +3 -1
  257. package/dist/components/questions/creator/question-type-registry.js +90 -1
  258. package/dist/components/questions/groups/ArticlesGroupCard.js +121 -1
  259. package/dist/components/questions/groups/BasicQuestionGroupCard.js +50 -1
  260. package/dist/components/questions/groups/DocumentGroupCard.js +114 -1
  261. package/dist/components/questions/groups/MatchAnswerGroupCard.js +25 -1
  262. package/dist/components/questions/index.d.ts +1 -0
  263. package/dist/components/questions/index.js +11 -1
  264. package/dist/components/questions/question-bank/EditQuestionBankDialog.d.ts +2 -0
  265. package/dist/components/questions/question-bank/EditQuestionBankDialog.js +114 -0
  266. package/dist/components/questions/question-bank/QuestionEditorRenderer.d.ts +23 -0
  267. package/dist/components/questions/question-bank/QuestionEditorRenderer.js +75 -0
  268. package/dist/components/questions/question-bank/difficulty.d.ts +15 -0
  269. package/dist/components/questions/question-bank/difficulty.js +33 -0
  270. package/dist/components/questions/question-bank/editor-adapters/choice-adapters.d.ts +5 -0
  271. package/dist/components/questions/question-bank/editor-adapters/choice-adapters.js +101 -0
  272. package/dist/components/questions/question-bank/editor-adapters/index.d.ts +5 -0
  273. package/dist/components/questions/question-bank/editor-adapters/index.js +4 -0
  274. package/dist/components/questions/question-bank/editor-adapters/media-adapters.d.ts +6 -0
  275. package/dist/components/questions/question-bank/editor-adapters/media-adapters.js +140 -0
  276. package/dist/components/questions/question-bank/editor-adapters/types.d.ts +1 -0
  277. package/dist/components/questions/question-bank/editor-adapters/types.js +1 -0
  278. package/dist/components/questions/question-bank/editor-adapters/unsupported-fallback.d.ts +8 -0
  279. package/dist/components/questions/question-bank/editor-adapters/unsupported-fallback.js +6 -0
  280. package/dist/components/questions/question-bank/editor-adapters/writing-adapters.d.ts +5 -0
  281. package/dist/components/questions/question-bank/editor-adapters/writing-adapters.js +114 -0
  282. package/dist/components/questions/question-bank/index.d.ts +4 -0
  283. package/dist/components/questions/question-bank/index.js +3 -0
  284. package/dist/components/questions/question-bank/types.d.ts +59 -0
  285. package/dist/components/questions/question-bank/types.js +1 -0
  286. package/dist/components/questions/types/answer-the-question/AnswerTheQuestionClient.js +37 -1
  287. package/dist/components/questions/types/answer-the-question/AnswerTheQuestionCreator.js +351 -1
  288. package/dist/components/questions/types/answer-the-question/register.js +67 -1
  289. package/dist/components/questions/types/answer-the-question/transform.js +36 -1
  290. package/dist/components/questions/types/arrange-letters-into-words/ArrangeLettersIntoWordsClient.js +141 -1
  291. package/dist/components/questions/types/arrange-letters-into-words/ArrangeLettersIntoWordsCreator.js +118 -1
  292. package/dist/components/questions/types/arrange-letters-into-words/index.js +2 -1
  293. package/dist/components/questions/types/arrange-letters-into-words/register.js +4 -1
  294. package/dist/components/questions/types/arrange-letters-into-words/transform.js +24 -1
  295. package/dist/components/questions/types/choose-correct-adjective/ChooseCorrectAdjectiveClient.js +74 -1
  296. package/dist/components/questions/types/choose-correct-adjective/ChooseCorrectAdjectiveCreator.js +169 -1
  297. package/dist/components/questions/types/choose-correct-adjective/index.js +2 -1
  298. package/dist/components/questions/types/choose-correct-adjective/register.js +55 -1
  299. package/dist/components/questions/types/choose-correct-adjective/transform.js +16 -1
  300. package/dist/components/questions/types/choose-the-correct-answer/ChooseTheCorrectAnswerClient.js +149 -1
  301. package/dist/components/questions/types/choose-the-correct-answer/ChooseTheCorrectAnswerCreator.js +568 -1
  302. package/dist/components/questions/types/choose-the-correct-answer/index.js +3 -1
  303. package/dist/components/questions/types/choose-the-correct-answer/normalize.d.ts +9 -0
  304. package/dist/components/questions/types/choose-the-correct-answer/normalize.js +88 -1
  305. package/dist/components/questions/types/choose-the-correct-answer/register.js +99 -1
  306. package/dist/components/questions/types/choose-the-correct-answer/transform.js +70 -1
  307. package/dist/components/questions/types/choose-the-correct-answer-group/ChooseTheCorrectAnswerGroupClient.js +22 -1
  308. package/dist/components/questions/types/choose-the-correct-answer-group/ChooseTheCorrectAnswerGroupCreator.js +163 -1
  309. package/dist/components/questions/types/choose-the-correct-answer-group/index.js +3 -1
  310. package/dist/components/questions/types/choose-the-correct-answer-group/map-choose-the-correct-answer-group-data.js +94 -1
  311. package/dist/components/questions/types/choose-the-correct-answer-group/register.js +36 -1
  312. package/dist/components/questions/types/choose-the-correct-answer-group/transform.js +55 -1
  313. package/dist/components/questions/types/cross-out-word-group/CrossOutWordGroupClient.js +27 -1
  314. package/dist/components/questions/types/cross-out-word-group/CrossOutWordGroupCreator.js +231 -1
  315. package/dist/components/questions/types/cross-out-word-group/index.js +5 -1
  316. package/dist/components/questions/types/cross-out-word-group/map-cross-out-word-group-data.d.ts +1 -1
  317. package/dist/components/questions/types/cross-out-word-group/map-cross-out-word-group-data.js +110 -1
  318. package/dist/components/questions/types/cross-out-word-group/register.js +36 -1
  319. package/dist/components/questions/types/cross-out-word-group/transform.js +67 -1
  320. package/dist/components/questions/types/fill-in-blank/FillInBlankClient.js +275 -1
  321. package/dist/components/questions/types/fill-in-blank/FillInBlankCreator.js +464 -1
  322. package/dist/components/questions/types/fill-in-blank/index.js +2 -1
  323. package/dist/components/questions/types/fill-in-blank/register.js +148 -1
  324. package/dist/components/questions/types/fill-in-blank/transform.js +88 -1
  325. package/dist/components/questions/types/fill-missing-words-in-grid/FillMissingWordsInGridClient.js +117 -1
  326. package/dist/components/questions/types/fill-missing-words-in-grid/FillMissingWordsInGridCreator.js +671 -1
  327. package/dist/components/questions/types/fill-missing-words-in-grid/index.js +2 -1
  328. package/dist/components/questions/types/fill-missing-words-in-grid/register.js +37 -1
  329. package/dist/components/questions/types/fill-missing-words-in-grid/transform.js +15 -1
  330. package/dist/components/questions/types/gn-speaking-interview/GNSpeakingInterviewCreator.js +262 -1
  331. package/dist/components/questions/types/gn-speaking-interview/register.js +121 -1
  332. package/dist/components/questions/types/gn-speaking-interview/transform.js +48 -1
  333. package/dist/components/questions/types/image-object-matching/ImageObjectMatchingClient.js +16 -1
  334. package/dist/components/questions/types/image-object-matching/ImageObjectMatchingCreator.js +27 -1
  335. package/dist/components/questions/types/image-object-matching/index.js +2 -1
  336. package/dist/components/questions/types/image-object-matching/register.js +3 -1
  337. package/dist/components/questions/types/image-object-matching/transform.js +2 -1
  338. package/dist/components/questions/types/label-the-picture/LabelThePictureClient.js +102 -1
  339. package/dist/components/questions/types/label-the-picture/LabelThePictureCreator.js +344 -1
  340. package/dist/components/questions/types/label-the-picture/index.js +2 -1
  341. package/dist/components/questions/types/label-the-picture/register.js +54 -1
  342. package/dist/components/questions/types/label-the-picture/transform.js +28 -1
  343. package/dist/components/questions/types/listen-and-choose-from-answer-group/ListenAndChooseFromAnswerGroupClient.js +78 -1
  344. package/dist/components/questions/types/listen-and-choose-from-answer-group/ListenAndChooseFromAnswerGroupCreator.js +232 -1
  345. package/dist/components/questions/types/listen-and-choose-from-answer-group/index.js +2 -1
  346. package/dist/components/questions/types/listen-and-choose-from-answer-group/register.js +82 -1
  347. package/dist/components/questions/types/listen-and-choose-from-answer-group/transform.js +27 -1
  348. package/dist/components/questions/types/listen-and-choose-objects-in-scene/ListenAndChooseObjectsInSceneClient.js +70 -1
  349. package/dist/components/questions/types/listen-and-choose-objects-in-scene/ListenAndChooseObjectsInSceneCreator.js +386 -1
  350. package/dist/components/questions/types/listen-and-choose-objects-in-scene/index.js +2 -1
  351. package/dist/components/questions/types/listen-and-choose-objects-in-scene/register.js +100 -1
  352. package/dist/components/questions/types/listen-and-choose-objects-in-scene/transform.js +33 -1
  353. package/dist/components/questions/types/listen-and-drag-objects-into-scene/ListenAndDragObjectsIntoSceneClient.js +106 -1
  354. package/dist/components/questions/types/listen-and-drag-objects-into-scene/ListenAndDragObjectsIntoSceneCreator.js +457 -1
  355. package/dist/components/questions/types/listen-and-drag-objects-into-scene/index.js +2 -1
  356. package/dist/components/questions/types/listen-and-drag-objects-into-scene/register.js +110 -1
  357. package/dist/components/questions/types/listen-and-drag-objects-into-scene/transform.js +35 -1
  358. package/dist/components/questions/types/listen-and-speak-answer/ArrowIndicator.js +8 -1
  359. package/dist/components/questions/types/listen-and-speak-answer/ListenAndSpeakAnswerClient.js +22 -1
  360. package/dist/components/questions/types/listen-and-speak-answer/ListenAndSpeakAnswerCreator.js +291 -1
  361. package/dist/components/questions/types/listen-and-speak-answer/index.js +2 -1
  362. package/dist/components/questions/types/listen-and-speak-answer/register.js +84 -1
  363. package/dist/components/questions/types/listen-and-speak-answer/transform.js +27 -1
  364. package/dist/components/questions/types/listen-and-speak-compare-images/ListenAndSpeakCompareImagesClient.js +32 -1
  365. package/dist/components/questions/types/listen-and-speak-compare-images/ListenAndSpeakCompareImagesCreator.js +295 -1
  366. package/dist/components/questions/types/listen-and-speak-compare-images/register.js +79 -1
  367. package/dist/components/questions/types/listen-and-speak-compare-images/transform.js +27 -1
  368. package/dist/components/questions/types/listen-and-speak-image-group/ListenAndSpeakImageGroupClient.js +34 -1
  369. package/dist/components/questions/types/listen-and-speak-image-group/ListenAndSpeakImageGroupCreator.js +285 -1
  370. package/dist/components/questions/types/listen-and-speak-image-group/register.js +81 -1
  371. package/dist/components/questions/types/listen-and-speak-image-group/transform.js +26 -1
  372. package/dist/components/questions/types/listen-and-speak-info-exchange/ListenAndSpeakInfoExchangeClient.js +38 -1
  373. package/dist/components/questions/types/listen-and-speak-info-exchange/ListenAndSpeakInfoExchangeCreator.js +385 -1
  374. package/dist/components/questions/types/listen-and-speak-info-exchange/register.js +87 -1
  375. package/dist/components/questions/types/listen-and-speak-info-exchange/transform.js +32 -1
  376. package/dist/components/questions/types/listen-and-speak-odd-one-out/ListenAndSpeakOddOneOutClient.js +26 -1
  377. package/dist/components/questions/types/listen-and-speak-odd-one-out/ListenAndSpeakOddOneOutCreator.js +247 -1
  378. package/dist/components/questions/types/listen-and-speak-odd-one-out/register.js +59 -1
  379. package/dist/components/questions/types/listen-and-speak-odd-one-out/transform.js +18 -1
  380. package/dist/components/questions/types/listen-and-speak-question-list/ListenAndSpeakQuestionListClient.js +26 -1
  381. package/dist/components/questions/types/listen-and-speak-question-list/ListenAndSpeakQuestionListCreator.js +256 -1
  382. package/dist/components/questions/types/listen-and-speak-question-list/register.js +81 -1
  383. package/dist/components/questions/types/listen-and-speak-question-list/transform.js +26 -1
  384. package/dist/components/questions/types/listen-and-speak-with-story-images/ListenAndSpeakWithStoryImagesClient.js +26 -1
  385. package/dist/components/questions/types/listen-and-speak-with-story-images/ListenAndSpeakWithStoryImagesCreator.js +230 -1
  386. package/dist/components/questions/types/listen-and-speak-with-story-images/register.js +56 -1
  387. package/dist/components/questions/types/listen-and-speak-with-story-images/transform.js +16 -1
  388. package/dist/components/questions/types/look-picture-choose-correct-answer/LookPictureChooseCorrectAnswerClient.js +72 -1
  389. package/dist/components/questions/types/look-picture-choose-correct-answer/LookPictureChooseCorrectAnswerCreator.js +230 -1
  390. package/dist/components/questions/types/look-picture-choose-correct-answer/index.js +1 -1
  391. package/dist/components/questions/types/look-picture-choose-correct-answer/register.js +66 -1
  392. package/dist/components/questions/types/look-picture-choose-correct-answer/transform.js +42 -1
  393. package/dist/components/questions/types/look-picture-fill-blank-choose-answer/LookPictureFillBlankChooseAnswerClient.js +96 -1
  394. package/dist/components/questions/types/look-picture-fill-blank-choose-answer/LookPictureFillBlankChooseAnswerCreator.js +238 -1
  395. package/dist/components/questions/types/look-picture-fill-blank-choose-answer/index.js +2 -1
  396. package/dist/components/questions/types/look-picture-fill-blank-choose-answer/register.js +76 -1
  397. package/dist/components/questions/types/look-picture-fill-blank-choose-answer/transform.js +19 -1
  398. package/dist/components/questions/types/look-picture-fill-word-hint/LookPictureFillWordHintClient.js +134 -1
  399. package/dist/components/questions/types/look-picture-fill-word-hint/LookPictureFillWordHintCreator.js +617 -1
  400. package/dist/components/questions/types/look-picture-fill-word-hint/index.js +2 -1
  401. package/dist/components/questions/types/look-picture-fill-word-hint/register.js +82 -1
  402. package/dist/components/questions/types/look-picture-fill-word-hint/transform.js +29 -1
  403. package/dist/components/questions/types/match-by-writing-answer/MatchByWritingAnswerClient.js +38 -1
  404. package/dist/components/questions/types/match-by-writing-answer/MatchByWritingAnswerCreator.js +359 -1
  405. package/dist/components/questions/types/match-by-writing-answer/index.js +3 -1
  406. package/dist/components/questions/types/match-by-writing-answer/register.js +58 -1
  407. package/dist/components/questions/types/match-by-writing-answer/transform.js +61 -1
  408. package/dist/components/questions/types/read-and-color-objects/ReadAndColorObjectsClient.js +16 -1
  409. package/dist/components/questions/types/read-and-color-objects/ReadAndColorObjectsCreator.js +23 -1
  410. package/dist/components/questions/types/read-and-color-objects/index.js +2 -1
  411. package/dist/components/questions/types/read-and-color-objects/register.js +3 -1
  412. package/dist/components/questions/types/read-and-color-objects/transform.js +36 -1
  413. package/dist/components/questions/types/read-displayed-content/ReadDisplayedContentCreator.js +125 -1
  414. package/dist/components/questions/types/read-displayed-content/register.js +64 -1
  415. package/dist/components/questions/types/read-displayed-content/transform.js +12 -1
  416. package/dist/components/questions/types/read-passage-and-answer-questions/ReadPassageAndAnswerQuestionsClient.js +65 -1
  417. package/dist/components/questions/types/read-passage-and-answer-questions/ReadPassageAndAnswerQuestionsCreator.js +511 -1
  418. package/dist/components/questions/types/read-passage-and-answer-questions/index.js +2 -1
  419. package/dist/components/questions/types/read-passage-and-answer-questions/register.js +58 -1
  420. package/dist/components/questions/types/read-passage-and-answer-questions/transform.js +28 -1
  421. package/dist/components/questions/types/speaking-conversation/SpeakingConversationCreator.js +373 -1
  422. package/dist/components/questions/types/speaking-conversation/SpeakingConversationPreviewClient.js +41 -1
  423. package/dist/components/questions/types/speaking-conversation/register.js +110 -1
  424. package/dist/components/questions/types/speaking-conversation/transform.js +34 -1
  425. package/dist/components/questions/types/speaking-cue-card/SpeakingCueCardCreator.js +74 -1
  426. package/dist/components/questions/types/speaking-cue-card/register.js +52 -1
  427. package/dist/components/questions/types/speaking-cue-card/transform.js +12 -1
  428. package/dist/components/questions/types/speaking-describe-image/SpeakingDescribeImageClient.js +10 -1
  429. package/dist/components/questions/types/speaking-describe-image/SpeakingDescribeImageCreator.js +161 -1
  430. package/dist/components/questions/types/speaking-describe-image/index.js +2 -1
  431. package/dist/components/questions/types/speaking-describe-image/register.js +69 -1
  432. package/dist/components/questions/types/speaking-describe-image/transform.js +16 -1
  433. package/dist/components/questions/types/spontaneous-qa/SpontaneousQACreator.js +234 -1
  434. package/dist/components/questions/types/spontaneous-qa/register.js +93 -1
  435. package/dist/components/questions/types/spontaneous-qa/transform.js +34 -1
  436. package/dist/components/questions/types/spontaneous-qa-group/SpontaneousQaGroupClient.d.ts +2 -0
  437. package/dist/components/questions/types/spontaneous-qa-group/SpontaneousQaGroupClient.js +9 -0
  438. package/dist/components/questions/types/spontaneous-qa-group/SpontaneousQaGroupCreator.d.ts +2 -0
  439. package/dist/components/questions/types/spontaneous-qa-group/SpontaneousQaGroupCreator.js +179 -0
  440. package/dist/components/questions/types/spontaneous-qa-group/creator-helpers.d.ts +5 -0
  441. package/dist/components/questions/types/spontaneous-qa-group/creator-helpers.js +43 -0
  442. package/dist/components/questions/types/spontaneous-qa-group/flatten.d.ts +14 -0
  443. package/dist/components/questions/types/spontaneous-qa-group/flatten.js +69 -0
  444. package/dist/components/questions/types/spontaneous-qa-group/index.d.ts +2 -0
  445. package/dist/components/questions/types/spontaneous-qa-group/index.js +2 -0
  446. package/dist/components/questions/types/spontaneous-qa-group/register.d.ts +2 -0
  447. package/dist/components/questions/types/spontaneous-qa-group/register.js +139 -0
  448. package/dist/components/questions/types/spontaneous-qa-group/transform.d.ts +2 -0
  449. package/dist/components/questions/types/spontaneous-qa-group/transform.js +52 -0
  450. package/dist/components/questions/types/true-false/TrueFalseClient.js +75 -1
  451. package/dist/components/questions/types/true-false/TrueFalseCreator.js +244 -1
  452. package/dist/components/questions/types/true-false/index.js +2 -1
  453. package/dist/components/questions/types/true-false/register.js +77 -1
  454. package/dist/components/questions/types/true-false/transform.js +32 -1
  455. package/dist/components/questions/types/true-false-group/TrueFalseGroupClient.js +25 -1
  456. package/dist/components/questions/types/true-false-group/TrueFalseGroupCreator.js +129 -1
  457. package/dist/components/questions/types/true-false-group/index.js +5 -1
  458. package/dist/components/questions/types/true-false-group/map-true-false-group-data.js +69 -1
  459. package/dist/components/questions/types/true-false-group/register.js +36 -1
  460. package/dist/components/questions/types/true-false-group/transform.js +43 -1
  461. package/dist/components/questions/types/word-fill-paragraph/WordFillParagraphClient.js +233 -1
  462. package/dist/components/questions/types/word-fill-paragraph/WordFillParagraphCreator.js +631 -1
  463. package/dist/components/questions/types/word-fill-paragraph/WordFillParagraphWrapper.js +28 -1
  464. package/dist/components/questions/types/word-fill-paragraph/index.js +2 -1
  465. package/dist/components/questions/types/word-fill-paragraph/register.js +136 -1
  466. package/dist/components/questions/types/word-fill-paragraph/transform.js +56 -1
  467. package/dist/components/questions/types/word-fill-structured-form/WfsfWordBankEditor.js +86 -1
  468. package/dist/components/questions/types/word-fill-structured-form/WordFillStructuredFormClient.js +246 -1
  469. package/dist/components/questions/types/word-fill-structured-form/WordFillStructuredFormCreator.d.ts +2 -0
  470. package/dist/components/questions/types/word-fill-structured-form/WordFillStructuredFormCreator.js +484 -1
  471. package/dist/components/questions/types/word-fill-structured-form/index.js +3 -1
  472. package/dist/components/questions/types/word-fill-structured-form/map-wfsf-question-data.js +113 -1
  473. package/dist/components/questions/types/word-fill-structured-form/register.js +36 -1
  474. package/dist/components/questions/types/word-fill-structured-form/transform.js +77 -1
  475. package/dist/components/questions/types/word-fill-structured-form/wfsf-word-bank.utils.js +110 -1
  476. package/dist/components/questions/types/word-order-and-match-group/WordOrderAndMatchGroupClient.d.ts +3 -0
  477. package/dist/components/questions/types/word-order-and-match-group/WordOrderAndMatchGroupClient.js +190 -0
  478. package/dist/components/questions/types/word-order-and-match-group/WordOrderAndMatchGroupCreator.d.ts +3 -0
  479. package/dist/components/questions/types/word-order-and-match-group/WordOrderAndMatchGroupCreator.js +182 -0
  480. package/dist/components/questions/types/word-order-and-match-group/index.d.ts +4 -0
  481. package/dist/components/questions/types/word-order-and-match-group/index.js +4 -0
  482. package/dist/components/questions/types/word-order-and-match-group/register.d.ts +2 -0
  483. package/dist/components/questions/types/word-order-and-match-group/register.js +121 -0
  484. package/dist/components/questions/types/word-order-and-match-group/transform.d.ts +2 -0
  485. package/dist/components/questions/types/word-order-and-match-group/transform.js +70 -0
  486. package/dist/components/questions/types/word-ordering/WordOrderingClient.js +84 -1
  487. package/dist/components/questions/types/word-ordering/WordOrderingCreator.js +192 -1
  488. package/dist/components/questions/types/word-ordering/index.js +2 -1
  489. package/dist/components/questions/types/word-ordering/register.js +46 -1
  490. package/dist/components/questions/types/word-ordering/transform.js +24 -1
  491. package/dist/components/questions/types/write-a-short-letter/WriteAShortLetterClient.js +99 -1
  492. package/dist/components/questions/types/write-a-short-letter/WriteAShortLetterCreator.js +320 -1
  493. package/dist/components/questions/types/write-a-short-letter/index.js +2 -1
  494. package/dist/components/questions/types/write-a-short-letter/register.js +68 -1
  495. package/dist/components/questions/types/write-a-short-letter/transform.js +25 -1
  496. package/dist/components/questions/types/write-correct-verb-form/WriteCorrectVerbFormClient.js +61 -1
  497. package/dist/components/questions/types/write-correct-verb-form/WriteCorrectVerbFormCreator.js +196 -1
  498. package/dist/components/questions/types/write-correct-verb-form/index.js +2 -1
  499. package/dist/components/questions/types/write-correct-verb-form/register.js +62 -1
  500. package/dist/components/questions/types/write-correct-verb-form/transform.js +17 -1
  501. package/dist/components/questions/types/write-sentences/WriteSentencesClient.js +22 -1
  502. package/dist/components/questions/types/write-sentences/WriteSentencesCreator.js +174 -1
  503. package/dist/components/questions/types/write-sentences/index.js +2 -1
  504. package/dist/components/questions/types/write-sentences/register.js +58 -1
  505. package/dist/components/questions/types/write-sentences/transform.js +28 -1
  506. package/dist/components/questions/types/write-short-paragraph/WriteShortParagraphClient.js +96 -1
  507. package/dist/components/questions/types/write-short-paragraph/WriteShortParagraphCreator.js +161 -1
  508. package/dist/components/questions/types/write-short-paragraph/index.js +2 -1
  509. package/dist/components/questions/types/write-short-paragraph/register.js +4 -1
  510. package/dist/components/questions/types/write-short-paragraph/transform.js +21 -1
  511. package/dist/components/questions/viewer/ChooseTheCorrectAnswerGroupViewer.js +11 -1
  512. package/dist/components/questions/viewer/CrossOutWordGroupViewer.js +8 -1
  513. package/dist/components/questions/viewer/QuestionGroupViewer.js +36 -1
  514. package/dist/components/questions/viewer/QuestionViewer.js +692 -1
  515. package/dist/components/questions/viewer/SpontaneousQaGroupViewer.d.ts +2 -1
  516. package/dist/components/questions/viewer/SpontaneousQaGroupViewer.js +82 -1
  517. package/dist/components/questions/viewer/TrueFalseGroupViewer.js +11 -1
  518. package/dist/components/questions/viewer/WordFillStructuredFormViewer.js +14 -1
  519. package/dist/components/questions/viewer/WordOrderAndMatchGroupViewer.d.ts +3 -1
  520. package/dist/components/questions/viewer/WordOrderAndMatchGroupViewer.js +95 -1
  521. package/dist/components/questions/viewer/index.js +8 -1
  522. package/dist/components/results/ResultReviewPageContainer.js +220 -1
  523. package/dist/components/results/ReviewQuestionRenderer.js +55 -1
  524. package/dist/components/results/hooks/useResultReviewPolling.js +76 -1
  525. package/dist/components/results/index.js +22 -1
  526. package/dist/components/results/renderers/QuestionExplanations.js +19 -1
  527. package/dist/components/results/renderers/ReviewChooseAdjectiveRenderer.js +94 -1
  528. package/dist/components/results/renderers/ReviewChooseBestAnswerRenderer.js +75 -1
  529. package/dist/components/results/renderers/ReviewColoringRenderer.js +110 -1
  530. package/dist/components/results/renderers/ReviewListenAndWriteRenderer.js +48 -1
  531. package/dist/components/results/renderers/ReviewListenChooseAnswerGroupRenderer.js +87 -1
  532. package/dist/components/results/renderers/ReviewListenChooseObjectsRenderer.js +104 -1
  533. package/dist/components/results/renderers/ReviewListenDragObjectsRenderer.js +123 -1
  534. package/dist/components/results/renderers/ReviewListeningHeader.js +104 -1
  535. package/dist/components/results/renderers/ReviewSpeakingAIPanel.js +116 -1
  536. package/dist/components/results/renderers/ReviewSpeakingMedia.js +48 -1
  537. package/dist/components/results/renderers/ReviewSpeakingQuestionItem.js +42 -1
  538. package/dist/components/results/renderers/ReviewSpeakingRenderer.js +12 -1
  539. package/dist/components/results/renderers/ReviewSpeakingRenderer.types.js +85 -1
  540. package/dist/components/results/renderers/review-question-body-dedicated.js +104 -1
  541. package/dist/components/results/renderers/review-question-body-movers.js +148 -1
  542. package/dist/components/results/renderers/review-speaking-map.js +226 -1
  543. package/dist/components/results/renderers/review-spontaneous-qa-group.d.ts +4 -0
  544. package/dist/components/results/renderers/review-spontaneous-qa-group.js +74 -0
  545. package/dist/components/results/report/BadgeTitle.js +5 -1
  546. package/dist/components/results/report/ExamSkillRow.js +20 -1
  547. package/dist/components/results/report/OceanEduExamReport.js +58 -1
  548. package/dist/components/results/report/OceanEduSpeakingReport.js +62 -1
  549. package/dist/components/results/report/OverallAssessmentSection.js +17 -1
  550. package/dist/components/results/report/ResultErrorState.js +18 -1
  551. package/dist/components/results/report/ResultLoadingState.js +10 -1
  552. package/dist/components/results/report/ResultNotPublicState.js +27 -1
  553. package/dist/components/results/report/SpeakingReportParts.js +14 -1
  554. package/dist/components/results/report/SpeakingReportShared.js +86 -1
  555. package/dist/components/results/report/SpeakingRubricSection.js +171 -1
  556. package/dist/components/results/report/speaking-report.utils.js +198 -1
  557. package/dist/components/results/result-review.utils.js +6 -1
  558. package/dist/components/results/review-data.js +222 -1
  559. package/dist/components/results/review-renderer.utils.js +97 -1
  560. package/dist/components/results/review-status.utils.js +36 -1
  561. package/dist/components/results/review-types.js +1 -1
  562. package/dist/components/results/speaking/SpeakingResultAudioPlayer.js +77 -1
  563. package/dist/components/results/speaking/SpeakingReviewResult.js +48 -1
  564. package/dist/components/results/utils/review-score.utils.js +72 -1
  565. package/dist/components/results/utils/speaking-summary.js +224 -1
  566. package/dist/components/results/utils/transform-speaking-review.js +183 -1
  567. package/dist/components/shared/RichTextEditor.d.ts +9 -0
  568. package/dist/components/shared/RichTextEditor.js +47 -0
  569. package/dist/components/shared/audio/SpeakingAudioPlayer.js +100 -1
  570. package/dist/components/themes/cambridge-yle/CambridgeYleAudioPlayer.js +140 -1
  571. package/dist/components/themes/cambridge-yle/CambridgeYleBottomNav.js +10 -1
  572. package/dist/components/themes/cambridge-yle/CambridgeYleExamLayout.d.ts +1 -1
  573. package/dist/components/themes/cambridge-yle/CambridgeYleExamLayout.js +18 -1
  574. package/dist/components/themes/cambridge-yle/CambridgeYleExampleText.js +11 -1
  575. package/dist/components/themes/cambridge-yle/CambridgeYleHeader.js +11 -1
  576. package/dist/components/themes/cambridge-yle/CambridgeYleInstructionBanner.d.ts +2 -1
  577. package/dist/components/themes/cambridge-yle/CambridgeYleInstructionBanner.js +19 -1
  578. package/dist/components/themes/cambridge-yle/CambridgeYleNavButton.js +13 -1
  579. package/dist/components/themes/cambridge-yle/CambridgeYlePartBanner.d.ts +1 -1
  580. package/dist/components/themes/cambridge-yle/CambridgeYlePartBanner.js +3 -1
  581. package/dist/components/themes/cambridge-yle/CambridgeYleProgressBar.js +6 -1
  582. package/dist/components/themes/cambridge-yle/CambridgeYleQuestionCard.js +5 -1
  583. package/dist/components/themes/cambridge-yle/CambridgeYleQuestionCardFullWidth.js +9 -1
  584. package/dist/components/themes/cambridge-yle/CambridgeYleSidebar.d.ts +2 -1
  585. package/dist/components/themes/cambridge-yle/CambridgeYleSidebar.js +61 -1
  586. package/dist/components/themes/cambridge-yle/CambridgeYleTimer.d.ts +1 -1
  587. package/dist/components/themes/cambridge-yle/CambridgeYleTimer.js +25 -1
  588. package/dist/components/themes/cambridge-yle/index.js +13 -1
  589. package/dist/components/themes/english-certification/EcAnswerTheQuestion.js +25 -1
  590. package/dist/components/themes/english-certification/EcMatchByWritingAnswer.js +89 -1
  591. package/dist/components/themes/english-certification/EcWordFillParagraph.js +56 -1
  592. package/dist/components/themes/english-certification/EcWordFillStructuredForm.js +192 -1
  593. package/dist/components/themes/english-certification/EcWritingTask.js +60 -1
  594. package/dist/components/themes/english-certification/EnglishCertificationAudioPlayer.js +108 -1
  595. package/dist/components/themes/english-certification/EnglishCertificationBrand.js +11 -1
  596. package/dist/components/themes/english-certification/EnglishCertificationExamLayout.js +34 -1
  597. package/dist/components/themes/english-certification/EnglishCertificationFlagButton.js +15 -1
  598. package/dist/components/themes/english-certification/EnglishCertificationFooterBar.js +19 -1
  599. package/dist/components/themes/english-certification/EnglishCertificationGroupedQuestion.js +166 -1
  600. package/dist/components/themes/english-certification/EnglishCertificationHeader.js +31 -1
  601. package/dist/components/themes/english-certification/EnglishCertificationInstructionBanner.js +79 -1
  602. package/dist/components/themes/english-certification/EnglishCertificationNavigationPanel.js +71 -1
  603. package/dist/components/themes/english-certification/EnglishCertificationOptionSelector.js +79 -1
  604. package/dist/components/themes/english-certification/EnglishCertificationPartHeader.js +47 -1
  605. package/dist/components/themes/english-certification/EnglishCertificationPassagePanel.js +77 -1
  606. package/dist/components/themes/english-certification/EnglishCertificationQuestionCard.js +25 -1
  607. package/dist/components/themes/english-certification/EnglishCertificationQuestionItem.js +36 -1
  608. package/dist/components/themes/english-certification/EnglishCertificationQuestionRenderer.js +81 -1
  609. package/dist/components/themes/english-certification/EnglishCertificationReadingSection.js +95 -1
  610. package/dist/components/themes/english-certification/EnglishCertificationSingleQuestion.js +18 -1
  611. package/dist/components/themes/english-certification/EnglishCertificationSingleQuestionList.js +32 -1
  612. package/dist/components/themes/english-certification/english-cert-scroll.js +163 -1
  613. package/dist/components/themes/english-certification/english-certification-theme.js +58 -1
  614. package/dist/components/themes/english-certification/grouped-question-utils.js +243 -1
  615. package/dist/components/themes/english-certification/index.js +24 -1
  616. package/dist/components/themes/index.js +25 -1
  617. package/dist/components/themes/summer-sky/SummerSkyAudioPlayer.js +170 -1
  618. package/dist/components/themes/summer-sky/SummerSkyExitModal.js +21 -1
  619. package/dist/components/themes/summer-sky/SummerSkyLayout.js +221 -1
  620. package/dist/components/themes/summer-sky/SummerSkySubmitModal.js +18 -1
  621. package/dist/components/themes/summer-sky/SummerSkyWaitingRoom.js +193 -1
  622. package/dist/components/themes/types.js +1 -1
  623. package/dist/components/ui/alert-dialog.js +26 -1
  624. package/dist/components/ui/alert.js +22 -1
  625. package/dist/components/ui/avatar.js +12 -1
  626. package/dist/components/ui/badge.js +38 -1
  627. package/dist/components/ui/button.js +35 -1
  628. package/dist/components/ui/calendar.js +76 -1
  629. package/dist/components/ui/card.js +16 -1
  630. package/dist/components/ui/carousel.js +91 -1
  631. package/dist/components/ui/checkbox.js +9 -1
  632. package/dist/components/ui/collapsible.js +13 -1
  633. package/dist/components/ui/command.js +34 -1
  634. package/dist/components/ui/confirm-dialog.js +49 -1
  635. package/dist/components/ui/dialog.js +23 -1
  636. package/dist/components/ui/drawer.js +35 -1
  637. package/dist/components/ui/dropdown-menu.js +33 -1
  638. package/dist/components/ui/file-upload.js +155 -1
  639. package/dist/components/ui/form.js +62 -1
  640. package/dist/components/ui/hover-card.js +10 -1
  641. package/dist/components/ui/image-preview.js +29 -1
  642. package/dist/components/ui/input.js +8 -1
  643. package/dist/components/ui/label.js +9 -1
  644. package/dist/components/ui/language-switcher.js +15 -1
  645. package/dist/components/ui/multi-select.js +90 -1
  646. package/dist/components/ui/points-input.js +33 -1
  647. package/dist/components/ui/popover.js +26 -1
  648. package/dist/components/ui/progress.js +16 -1
  649. package/dist/components/ui/radio-group.js +12 -1
  650. package/dist/components/ui/scroll-area.js +11 -1
  651. package/dist/components/ui/select.js +38 -1
  652. package/dist/components/ui/separator.js +8 -1
  653. package/dist/components/ui/sheet.js +40 -1
  654. package/dist/components/ui/single-select.js +76 -1
  655. package/dist/components/ui/skeleton.js +6 -1
  656. package/dist/components/ui/switch.js +8 -1
  657. package/dist/components/ui/table.js +20 -1
  658. package/dist/components/ui/tabs.js +17 -1
  659. package/dist/components/ui/textarea.js +8 -1
  660. package/dist/components/ui/tooltip.js +11 -1
  661. package/dist/index.d.ts +3 -0
  662. package/dist/index.js +24 -1
  663. package/dist/shared/constants/ApiConstant.d.ts +1 -0
  664. package/dist/shared/constants/ApiConstant.js +278 -1
  665. package/dist/shared/constants/QueryKeyConstant.js +112 -1
  666. package/dist/shared/constants/exam-level.enum.js +41 -1
  667. package/dist/shared/constants/landings/placement-test.constants.js +431 -1
  668. package/dist/shared/constants/question-skills.js +277 -1
  669. package/dist/shared/constants/routes.js +81 -1
  670. package/dist/shared/index.js +10 -1
  671. package/dist/shared/lib/hooks/index.js +10 -1
  672. package/dist/shared/lib/hooks/useAlertDialog.js +57 -1
  673. package/dist/shared/lib/hooks/useAudioPlayCounter.js +30 -1
  674. package/dist/shared/lib/hooks/useAudioPreview.js +81 -1
  675. package/dist/shared/lib/hooks/useAudioUpload.js +24 -1
  676. package/dist/shared/lib/hooks/useConfirmDialog.js +89 -1
  677. package/dist/shared/lib/hooks/useDebouncedCallback.js +32 -1
  678. package/dist/shared/lib/hooks/useDelayedAutoPlay.js +12 -1
  679. package/dist/shared/lib/hooks/useFileUpload.js +24 -1
  680. package/dist/shared/lib/hooks/useImageUrl.js +5 -1
  681. package/dist/shared/lib/hooks/usePresignedFileUrl.js +108 -1
  682. package/dist/shared/lib/hooks/useReactHookForm.js +31 -1
  683. package/dist/shared/lib/hooks/useToast.js +62 -1
  684. package/dist/shared/lib/html-content.js +22 -1
  685. package/dist/shared/lib/i18n/index.js +54 -1
  686. package/dist/shared/lib/i18n/messages/en/admin.d.ts +11 -4
  687. package/dist/shared/lib/i18n/messages/en/admin.js +2111 -1
  688. package/dist/shared/lib/i18n/messages/en/auth.js +86 -1
  689. package/dist/shared/lib/i18n/messages/en/common.js +140 -1
  690. package/dist/shared/lib/i18n/messages/en/file-upload.js +18 -1
  691. package/dist/shared/lib/i18n/messages/en/student.js +133 -1
  692. package/dist/shared/lib/i18n/messages/en/terms.js +37 -1
  693. package/dist/shared/lib/i18n/messages/en.d.ts +11 -4
  694. package/dist/shared/lib/i18n/messages/en.js +15 -1
  695. package/dist/shared/lib/i18n/messages/vi/admin.d.ts +11 -4
  696. package/dist/shared/lib/i18n/messages/vi/admin.js +2111 -1
  697. package/dist/shared/lib/i18n/messages/vi/auth.js +86 -1
  698. package/dist/shared/lib/i18n/messages/vi/common.js +140 -1
  699. package/dist/shared/lib/i18n/messages/vi/file-upload.js +18 -1
  700. package/dist/shared/lib/i18n/messages/vi/student.js +133 -1
  701. package/dist/shared/lib/i18n/messages/vi/terms.js +37 -1
  702. package/dist/shared/lib/i18n/messages/vi.d.ts +11 -4
  703. package/dist/shared/lib/i18n/messages/vi.js +15 -1
  704. package/dist/shared/lib/i18n/types.js +1 -1
  705. package/dist/shared/lib/stores/examQuestionStore.js +212 -1
  706. package/dist/shared/lib/stores/examTakingStore.js +240 -1
  707. package/dist/shared/lib/stores/gradingTransientStore.js +39 -1
  708. package/dist/shared/lib/stores/localeStore.js +10 -1
  709. package/dist/shared/lib/themes/config/starters.config.js +71 -1
  710. package/dist/shared/lib/themes/index.js +49 -1
  711. package/dist/shared/lib/themes/types.js +2 -1
  712. package/dist/shared/lib/toast.js +43 -1
  713. package/dist/shared/lib/utils/public-page.js +44 -1
  714. package/dist/shared/lib/utils/question-reverse-transform.js +438 -1
  715. package/dist/shared/lib/utils/question-transform-types.js +1 -1
  716. package/dist/shared/lib/utils/question-transform-validation.js +194 -1
  717. package/dist/shared/lib/utils/question-transform.js +199 -1
  718. package/dist/shared/lib/utils.js +168 -1
  719. package/dist/shared/lib/validation/choose-correct-answer.validation.js +111 -1
  720. package/dist/shared/lib/validation/label-the-picture.validation.js +19 -1
  721. package/dist/shared/lib/validation/listen-and-choose-from-answer-group.validation.js +46 -1
  722. package/dist/shared/lib/validation/listen-and-choose-objects-in-scene.validation.js +21 -1
  723. package/dist/shared/lib/validation/listen-and-drag-objects-into-scene.validation.js +34 -1
  724. package/dist/shared/lib/validation/listen-and-speak-answer.validation.js +40 -1
  725. package/dist/shared/lib/validation/listen-and-speak-compare-images.validation.js +45 -1
  726. package/dist/shared/lib/validation/listen-and-speak-image-group.validation.js +19 -1
  727. package/dist/shared/lib/validation/listen-and-speak-info-exchange.validation.js +39 -1
  728. package/dist/shared/lib/validation/listen-and-speak-odd-one-out.validation.js +32 -1
  729. package/dist/shared/lib/validation/listen-and-speak-question-list.validation.js +19 -1
  730. package/dist/shared/lib/validation/listen-and-speak-with-story-images.validation.js +28 -1
  731. package/dist/shared/lib/validation/look-picture-choose-correct-answer.validation.js +12 -1
  732. package/dist/shared/lib/validation/look-picture-fill-blank-choose-answer.validation.js +47 -1
  733. package/dist/shared/lib/validation/read-and-color-objects.validation.js +29 -1
  734. package/dist/shared/lib/validation/read-displayed-content.validation.js +28 -1
  735. package/dist/shared/lib/validation/speaking-conversation.validation.js +75 -1
  736. package/dist/shared/lib/validation/speaking-describe-image.validation.js +31 -1
  737. package/dist/shared/lib/validation/spontaneous-qa.validation.js +48 -1
  738. package/dist/shared/lib/validation/word-fill-paragraph-default.validation.js +38 -1
  739. package/dist/shared/lib/validation/word-fill-paragraph-with-options.validation.js +39 -1
  740. package/dist/shared/lib/validation/word-fill-paragraph.validation.js +43 -1
  741. package/dist/shared/lib/validation/word-ordering.validation.js +33 -1
  742. package/dist/shared/types/branch.types.js +6 -1
  743. package/dist/shared/types/common.types.js +49 -1
  744. package/dist/shared/types/entities/exam-schedule.types.js +5 -1
  745. package/dist/shared/types/entities/exam.types.js +1 -1
  746. package/dist/shared/types/entities/question.types.js +4 -1
  747. package/dist/shared/types/entities/result.types.js +4 -1
  748. package/dist/shared/types/entities/user.types.js +4 -1
  749. package/dist/shared/types/exam-taking.types.js +2 -1
  750. package/dist/shared/types/history.types.js +34 -1
  751. package/dist/shared/types/index.js +1 -1
  752. package/dist/shared/types/questions/choose-correct-adjective.js +4 -1
  753. package/dist/shared/types/questions/choose-the-correct-answer-group.d.ts +1 -0
  754. package/dist/shared/types/questions/choose-the-correct-answer-group.js +1 -1
  755. package/dist/shared/types/questions/choose-the-correct-answer.js +9 -1
  756. package/dist/shared/types/questions/cross-out-word-group.d.ts +2 -0
  757. package/dist/shared/types/questions/cross-out-word-group.js +1 -1
  758. package/dist/shared/types/questions/fill-missing-words-in-grid.js +11 -1
  759. package/dist/shared/types/questions/index.d.ts +1 -0
  760. package/dist/shared/types/questions/index.js +46 -1
  761. package/dist/shared/types/questions/listen-and-speak-answer.js +1 -1
  762. package/dist/shared/types/questions/listen-and-speak-compare-images.js +1 -1
  763. package/dist/shared/types/questions/listen-and-speak-image-group.js +1 -1
  764. package/dist/shared/types/questions/listen-and-speak-info-exchange.js +3 -1
  765. package/dist/shared/types/questions/listen-and-speak-odd-one-out.js +3 -1
  766. package/dist/shared/types/questions/listen-and-speak-question-list.js +1 -1
  767. package/dist/shared/types/questions/listen-and-speak-with-story-images.js +3 -1
  768. package/dist/shared/types/questions/look-picture-choose-correct-answer.js +5 -1
  769. package/dist/shared/types/questions/look-picture-fill-blank-choose-answer.js +9 -1
  770. package/dist/shared/types/questions/look-picture-fill-word-hint.js +7 -1
  771. package/dist/shared/types/questions/read-displayed-content.js +1 -1
  772. package/dist/shared/types/questions/speaking-conversation.js +7 -1
  773. package/dist/shared/types/questions/speaking-describe-image.js +1 -1
  774. package/dist/shared/types/questions/spontaneous-qa.js +1 -1
  775. package/dist/shared/types/questions/word-order-and-match-group.d.ts +33 -0
  776. package/dist/shared/types/questions/word-order-and-match-group.js +1 -0
  777. package/dist/shared/types/questions/write-correct-verb-form.js +12 -1
  778. package/dist/shared/types/role.types.js +1 -1
  779. package/dist/shared/types/structure-management.js +28 -1
  780. package/dist/shared/types/student.types.js +57 -1
  781. package/dist/shared/types/teacher-dashboard-rooms.js +2 -1
  782. package/package.json +184 -166
  783. package/dist/mcp/config.d.ts +0 -12
  784. package/dist/mcp/config.js +0 -1
  785. package/dist/mcp/http-client.d.ts +0 -6
  786. package/dist/mcp/http-client.js +0 -1
  787. package/dist/mcp/index.d.ts +0 -6
  788. package/dist/mcp/index.js +0 -2
  789. package/dist/mcp/tools/_helpers.d.ts +0 -4
  790. package/dist/mcp/tools/_helpers.js +0 -1
  791. package/dist/mcp/tools/exams.d.ts +0 -2
  792. package/dist/mcp/tools/exams.js +0 -1
  793. package/dist/mcp/tools/index.d.ts +0 -2
  794. package/dist/mcp/tools/index.js +0 -1
  795. package/dist/mcp/tools/results.d.ts +0 -2
  796. package/dist/mcp/tools/results.js +0 -1
@@ -1,4 +1,5 @@
1
1
  import type { Question } from '../../../shared/types/entities/question.types';
2
- export declare function SpontaneousQaGroupViewer({ question }: {
2
+ export declare function SpontaneousQaGroupViewer({ question, isReviewMode, }: {
3
3
  question: Question;
4
+ isReviewMode?: boolean;
4
5
  }): import("react").JSX.Element;
@@ -1 +1,82 @@
1
- "use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";function r(e){return function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}(e)?e:{}}function n(e,t=""){return"string"==typeof e?e:t}function s(e,t){const s=r(e),i=r(s.content),o=r(s.correctAnswer),a=Array.isArray(o.expectedAnswers)?o.expectedAnswers.map(e=>String(e??"")):[];return{questionText:n(i.questionText)||n(i.question)||n(s.questionText),audioUrl:n(i.audioUrl)||void 0,expectedAnswers:a,isExample:!0===s.isExample,points:"number"==typeof s.points?s.points:1,questionNumber:"number"==typeof s.questionNumber?s.questionNumber:t+1}}export function SpontaneousQaGroupViewer({question:i}){const{instruction:o,items:a}=function(e){const t=r(e.content),i=r(e.spontaneousQAList??t.spontaneousQAList??t),o=Array.isArray(i.items)?i.items:Array.isArray(t.items)?t.items:[];return{instruction:n(r(i.meta).instruction)||n(r(t.meta).instruction)||n(e.explanation)||"Talk about the topic.",items:o.map(s)}}(i);return t("div",{className:"space-y-4",children:[o?e("div",{className:"rounded-xl border border-indigo-100 bg-indigo-50 px-4 py-3 text-sm font-medium text-indigo-800",children:o}):null,a.map((r,n)=>t("div",{className:"overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm",children:[t("div",{className:"flex items-center justify-between border-b border-gray-100 bg-gray-50 px-4 py-2.5",children:[t("span",{className:"text-sm font-medium text-gray-700",children:["Câu ",r.questionNumber||n+1]}),t("span",{className:"text-xs text-gray-500",children:[r.points||0," điểm"]})]}),t("div",{className:"space-y-2 p-4",children:[e("p",{className:"text-sm font-semibold text-gray-800",children:r.questionText||"Câu hỏi chưa được nhập"}),r.audioUrl?t("p",{className:"text-xs text-gray-500",children:["Audio: ",r.audioUrl]}):null,r.expectedAnswers.length>0?t("div",{className:"rounded-lg border border-emerald-100 bg-emerald-50 px-3 py-2 text-sm text-emerald-800",children:[e("p",{className:"mb-1 font-medium",children:"Gợi ý đáp án"}),e("ul",{className:"list-disc space-y-1 pl-4",children:r.expectedAnswers.map(t=>e("li",{children:t},t))})]}):null]})]},`${r.questionNumber}-${n}`))]})}
1
+ 'use client';
2
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
3
+ function isRecord(value) {
4
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
5
+ }
6
+ function asRecord(value) {
7
+ return isRecord(value) ? value : {};
8
+ }
9
+ function asString(value, fallback = '') {
10
+ return typeof value === 'string' ? value : fallback;
11
+ }
12
+ function mapItem(item, index) {
13
+ const record = asRecord(item);
14
+ const content = asRecord(record.content);
15
+ const correctAnswer = asRecord(record.correctAnswer);
16
+ const expected = Array.isArray(correctAnswer.expectedAnswers)
17
+ ? correctAnswer.expectedAnswers.map((value) => String(value ?? ''))
18
+ : [];
19
+ return {
20
+ questionText: asString(content.questionText) ||
21
+ asString(content.question) ||
22
+ asString(record.questionText),
23
+ audioUrl: asString(content.audioUrl) || undefined,
24
+ expectedAnswers: expected,
25
+ isExample: record.isExample === true,
26
+ points: typeof record.points === 'number' ? record.points : 1,
27
+ questionNumber: typeof record.questionNumber === 'number' ? record.questionNumber : index + 1,
28
+ };
29
+ }
30
+ function isNestedPart(item) {
31
+ const record = asRecord(item);
32
+ return Array.isArray(record.questions);
33
+ }
34
+ function resolveGroup(question) {
35
+ const content = asRecord(question.content);
36
+ const list = asRecord(question.spontaneousQAList ?? content.spontaneousQAList ?? content);
37
+ const itemsRaw = Array.isArray(list.items)
38
+ ? list.items
39
+ : Array.isArray(content.items)
40
+ ? content.items
41
+ : [];
42
+ const instruction = asString(asRecord(list.meta).instruction) ||
43
+ asString(asRecord(content.meta).instruction) ||
44
+ asString(question.explanation) ||
45
+ 'Talk about the topic.';
46
+ if (itemsRaw.some(isNestedPart)) {
47
+ return {
48
+ instruction,
49
+ parts: itemsRaw.map((item, index) => {
50
+ const record = asRecord(item);
51
+ const questions = Array.isArray(record.questions)
52
+ ? record.questions.map(mapItem)
53
+ : [];
54
+ return {
55
+ partNumber: typeof record.partNumber === 'number' ? record.partNumber : index + 1,
56
+ partTitle: asString(record.partTitle) || `PART ${index + 1}`,
57
+ topic: asString(record.topic),
58
+ questions,
59
+ };
60
+ }),
61
+ };
62
+ }
63
+ return {
64
+ instruction,
65
+ parts: [
66
+ {
67
+ partNumber: 1,
68
+ partTitle: '',
69
+ topic: '',
70
+ questions: itemsRaw.map(mapItem),
71
+ },
72
+ ],
73
+ };
74
+ }
75
+ function QaPromptCard({ item, index }) {
76
+ return (_jsxs("div", { className: "overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm", children: [_jsxs("div", { className: "flex items-center justify-between border-b border-gray-100 bg-gray-50 px-4 py-2.5", children: [_jsxs("span", { className: "text-sm font-medium text-gray-700", children: ["C\u00E2u ", item.questionNumber || index + 1] }), _jsxs("span", { className: "text-xs text-gray-500", children: [item.points || 0, " \u0111i\u1EC3m"] })] }), _jsxs("div", { className: "space-y-2 p-4", children: [_jsx("p", { className: "text-sm font-semibold text-gray-800", children: item.questionText || 'Câu hỏi chưa được nhập' }), item.audioUrl ? (_jsxs("p", { className: "text-xs text-gray-500", children: ["Audio: ", item.audioUrl] })) : null, item.expectedAnswers.length > 0 ? (_jsxs("div", { className: "rounded-lg border border-emerald-100 bg-emerald-50 px-3 py-2 text-sm text-emerald-800", children: [_jsx("p", { className: "mb-1 font-medium", children: "G\u1EE3i \u00FD \u0111\u00E1p \u00E1n" }), _jsx("ul", { className: "list-disc space-y-1 pl-4", children: item.expectedAnswers.map((answer) => (_jsx("li", { children: answer }, answer))) })] })) : null] })] }));
77
+ }
78
+ export function SpontaneousQaGroupViewer({ question, isReviewMode, }) {
79
+ const { instruction, parts } = resolveGroup(question);
80
+ const showPartChrome = parts.length > 1 || parts.some((part) => part.partTitle || part.topic);
81
+ return (_jsxs("div", { className: "space-y-5", children: [instruction ? (_jsx("div", { className: "rounded-xl border border-indigo-100 bg-indigo-50 px-4 py-3 text-sm font-medium text-indigo-800", children: instruction })) : null, parts.map((part) => (_jsxs("section", { className: "space-y-3", children: [showPartChrome ? (_jsxs("div", { children: [part.partTitle ? (_jsx("h3", { className: "text-base font-bold tracking-wide text-sky-600", children: part.partTitle })) : null, part.topic ? (_jsx("p", { className: "text-sm font-semibold text-slate-600", children: part.topic })) : null] })) : null, _jsx("div", { className: "space-y-3", children: part.questions.map((item, index) => (_jsx(QaPromptCard, { item: item, index: index }, `${part.partNumber}-${item.questionNumber}-${index}`))) })] }, `part-${part.partNumber}`)))] }));
82
+ }
@@ -1 +1,11 @@
1
- "use client";import{jsx as e}from"react/jsx-runtime";import{TrueFalseGroupClient as r}from"../types/true-false-group/TrueFalseGroupClient";import{mapQuestionToTrueFalseGroupData as s}from"../types/true-false-group/map-true-false-group-data";export function TrueFalseGroupViewer({question:t,isReviewMode:o=!1,userAnswer:u}){const i=s(t),a=o&&!u?i.items.map(e=>e.correctAnswer):u;return e(r,{questionData:i,isReviewMode:o,userAnswers:a})}
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { TrueFalseGroupClient } from '../types/true-false-group/TrueFalseGroupClient';
4
+ import { mapQuestionToTrueFalseGroupData } from '../types/true-false-group/map-true-false-group-data';
5
+ export function TrueFalseGroupViewer({ question, isReviewMode = false, userAnswer, }) {
6
+ const questionData = mapQuestionToTrueFalseGroupData(question);
7
+ const reviewAnswers = isReviewMode && !userAnswer
8
+ ? questionData.items.map((item) => item.correctAnswer)
9
+ : userAnswer;
10
+ return (_jsx(TrueFalseGroupClient, { questionData: questionData, isReviewMode: isReviewMode, userAnswers: reviewAnswers }));
11
+ }
@@ -1 +1,14 @@
1
- "use client";import{jsx as r}from"react/jsx-runtime";import{useState as e}from"react";import{WordFillStructuredFormClient as t}from"../types/word-fill-structured-form/WordFillStructuredFormClient";import{mapQuestionToWfsfData as o}from"../types/word-fill-structured-form/map-wfsf-question-data";export function WordFillStructuredFormViewer({question:i,isReviewMode:n=!1,userAnswer:s,onSubmitAnswer:u}){const m=o(i),[a,l]=e(()=>s??{});return r(t,{questionData:m,isReviewMode:n,userAnswer:s,autoFillCorrectAnswers:n&&!s,instruction:m.instruction,questionNumber:i.questionNumber,explanation:i.explanation,onAnswerChange:(r,e)=>{const t={...a,[r]:e};l(t),u?.(t)}})}
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useState } from 'react';
4
+ import { WordFillStructuredFormClient } from '../types/word-fill-structured-form/WordFillStructuredFormClient';
5
+ import { mapQuestionToWfsfData } from '../types/word-fill-structured-form/map-wfsf-question-data';
6
+ export function WordFillStructuredFormViewer({ question, isReviewMode = false, userAnswer, onSubmitAnswer, }) {
7
+ const questionData = mapQuestionToWfsfData(question);
8
+ const [draftAnswers, setDraftAnswers] = useState(() => userAnswer ?? {});
9
+ return (_jsx(WordFillStructuredFormClient, { questionData: questionData, isReviewMode: isReviewMode, userAnswer: userAnswer, autoFillCorrectAnswers: isReviewMode && !userAnswer, instruction: questionData.instruction, questionNumber: question.questionNumber, explanation: question.explanation, onAnswerChange: (key, value) => {
10
+ const next = { ...draftAnswers, [key]: value };
11
+ setDraftAnswers(next);
12
+ onSubmitAnswer?.(next);
13
+ } }));
14
+ }
@@ -1,4 +1,6 @@
1
1
  import type { Question } from '../../../shared/types/entities/question.types';
2
- export declare function WordOrderAndMatchGroupViewer({ question, }: {
2
+ export declare function WordOrderAndMatchGroupViewer({ question, isReviewMode, userAnswer, }: {
3
3
  question: Question;
4
+ isReviewMode?: boolean;
5
+ userAnswer?: any;
4
6
  }): import("react").JSX.Element;
@@ -1 +1,95 @@
1
- "use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";function t(e){return function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}(e)?e:{}}function s(e,r=""){return"string"==typeof e?e:r}function a(e,r){const a=t(e),n=t(a.content),i=t(a.correctAnswer);return{scrambledWords:Array.isArray(n.scrambledWords)?n.scrambledWords.map(e=>String(e??"")):[],orderedPhrase:s(i.orderedPhrase),matchLabel:s(i.matchLabel),isExample:!0===a.isExample,points:"number"==typeof a.points?a.points:1,questionNumber:"number"==typeof a.questionNumber?a.questionNumber:r+1}}export function WordOrderAndMatchGroupViewer({question:n}){const{instruction:i,matchOptions:d,items:o}=function(e){const r=t(e.content),n=t(e.wordOrderMatchList??r.wordOrderMatchList??r),i=t(n.meta??r.meta),d=Array.isArray(n.items)?n.items:Array.isArray(r.items)?r.items:[];return{instruction:s(i.instruction)||s(e.explanation)||"Put the phrases in order, then match the labels.",matchOptions:Array.isArray(i.matchOptions)?i.matchOptions.map(e=>String(e??"")):[],items:d.map(a)}}(n);return r("div",{className:"space-y-4",children:[i?e("div",{className:"rounded-xl border border-indigo-100 bg-indigo-50 px-4 py-3 text-sm font-medium text-indigo-800",children:i}):null,d.length>0?e("div",{className:"flex flex-wrap gap-2",children:d.map(r=>e("span",{className:"rounded-md border border-gray-200 bg-white px-2 py-1 text-xs font-semibold text-gray-700",children:r},r))}):null,o.map((t,s)=>r("div",{className:"overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm",children:[r("div",{className:"flex items-center justify-between border-b border-gray-100 bg-gray-50 px-4 py-2.5",children:[r("span",{className:"text-sm font-medium text-gray-700",children:["Câu ",t.questionNumber||s+1,t.isExample?" · Example":""]}),r("span",{className:"text-xs text-gray-500",children:[t.points||0," điểm"]})]}),r("div",{className:"space-y-2 p-4",children:[e("div",{className:"flex flex-wrap gap-1.5",children:t.scrambledWords.map((r,t)=>e("span",{className:"rounded-md border border-dashed border-teal-300 bg-teal-50 px-2 py-1 text-sm text-teal-800",children:r},`${r}-${t}`))}),r("p",{className:"text-sm text-gray-800",children:[e("span",{className:"font-medium text-gray-500",children:"Câu đúng: "}),t.orderedPhrase||"—"]}),r("p",{className:"text-sm text-gray-800",children:[e("span",{className:"font-medium text-gray-500",children:"Nhãn: "}),t.matchLabel||"—"]})]})]},`${t.questionNumber}-${s}`))]})}
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { WordOrderAndMatchGroupClient } from '../types/word-order-and-match-group/WordOrderAndMatchGroupClient';
4
+ function isRecord(value) {
5
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
6
+ }
7
+ function asRecord(value) {
8
+ return isRecord(value) ? value : {};
9
+ }
10
+ function asString(value, fallback = '') {
11
+ return typeof value === 'string' ? value : fallback;
12
+ }
13
+ function mapItem(item, index, fallbackAnswer) {
14
+ const record = asRecord(item);
15
+ const content = asRecord(record.content);
16
+ const fb = asRecord(fallbackAnswer);
17
+ const correctAnswer = asRecord(record.correctAnswer ??
18
+ record.correct_answer ??
19
+ record.answer ??
20
+ fb.correctAnswer ??
21
+ fb.correct_answer ??
22
+ fb.answer ??
23
+ fb);
24
+ const words = Array.isArray(content.scrambledWords)
25
+ ? content.scrambledWords.map((value) => String(value ?? ''))
26
+ : Array.isArray(record.scrambledWords)
27
+ ? record.scrambledWords.map((value) => String(value ?? ''))
28
+ : [];
29
+ return {
30
+ scrambledWords: words,
31
+ orderedPhrase: asString(correctAnswer.orderedPhrase) ||
32
+ asString(record.orderedPhrase) ||
33
+ asString(fb.orderedPhrase),
34
+ matchLabel: asString(correctAnswer.matchLabel) ||
35
+ asString(record.matchLabel) ||
36
+ asString(fb.matchLabel) ||
37
+ 'A',
38
+ isExample: record.isExample === true || record.is_example === true,
39
+ points: typeof record.points === 'number' ? record.points : 1,
40
+ questionNumber: typeof record.questionNumber === 'number' ? record.questionNumber : index + 1,
41
+ };
42
+ }
43
+ function resolveGroup(question) {
44
+ const content = asRecord(question.content);
45
+ const answer = asRecord(question.answer);
46
+ const correctAnswer = asRecord(question.correctAnswer ?? question.correct_answer);
47
+ const list = asRecord(question.wordOrderMatchList ??
48
+ content.wordOrderMatchList ??
49
+ answer.wordOrderMatchList ??
50
+ (content.items ? content : null) ??
51
+ (answer.items ? answer : null) ??
52
+ content);
53
+ const meta = asRecord(list.meta ?? content.meta ?? answer.meta);
54
+ const itemsRaw = Array.isArray(list.items)
55
+ ? list.items
56
+ : Array.isArray(content.items)
57
+ ? content.items
58
+ : Array.isArray(answer.items)
59
+ ? answer.items
60
+ : [];
61
+ const answersRaw = Array.isArray(correctAnswer.answer)
62
+ ? correctAnswer.answer
63
+ : Array.isArray(answer.answer)
64
+ ? answer.answer
65
+ : [];
66
+ return {
67
+ instruction: asString(meta.instruction) ||
68
+ asString(answer.instruction) ||
69
+ asString(question.explanation) ||
70
+ 'Put the phrases in order, then match the labels.',
71
+ matchOptions: Array.isArray(meta.matchOptions)
72
+ ? meta.matchOptions.map((value) => String(value ?? ''))
73
+ : Array.isArray(answer.matchOptions)
74
+ ? answer.matchOptions.map((value) => String(value ?? ''))
75
+ : ['A', 'B', 'C', 'D', 'E', 'F'],
76
+ items: itemsRaw.map((item, idx) => mapItem(item, idx, answersRaw[idx])),
77
+ };
78
+ }
79
+ export function WordOrderAndMatchGroupViewer({ question, isReviewMode = false, userAnswer, }) {
80
+ const { instruction, matchOptions, items } = resolveGroup(question);
81
+ const questionData = {
82
+ instruction,
83
+ matchOptions,
84
+ items,
85
+ };
86
+ const autoUserAnswers = isReviewMode
87
+ ? items.map((item) => ({
88
+ orderedPhrase: item.orderedPhrase,
89
+ matchLabel: item.matchLabel,
90
+ }))
91
+ : Array.isArray(userAnswer)
92
+ ? userAnswer
93
+ : undefined;
94
+ return (_jsx(WordOrderAndMatchGroupClient, { questionData: questionData, isReviewMode: isReviewMode, userAnswers: autoUserAnswers }));
95
+ }
@@ -1 +1,8 @@
1
- export{QuestionViewer}from"./QuestionViewer";export{QuestionGroupViewer}from"./QuestionGroupViewer";export{WordFillStructuredFormViewer}from"./WordFillStructuredFormViewer";export{ChooseTheCorrectAnswerGroupViewer}from"./ChooseTheCorrectAnswerGroupViewer";export{TrueFalseGroupViewer}from"./TrueFalseGroupViewer";export{CrossOutWordGroupViewer}from"./CrossOutWordGroupViewer";export{SpontaneousQaGroupViewer}from"./SpontaneousQaGroupViewer";export{WordOrderAndMatchGroupViewer}from"./WordOrderAndMatchGroupViewer";
1
+ export { QuestionViewer } from './QuestionViewer';
2
+ export { QuestionGroupViewer } from './QuestionGroupViewer';
3
+ export { WordFillStructuredFormViewer } from './WordFillStructuredFormViewer';
4
+ export { ChooseTheCorrectAnswerGroupViewer } from './ChooseTheCorrectAnswerGroupViewer';
5
+ export { TrueFalseGroupViewer } from './TrueFalseGroupViewer';
6
+ export { CrossOutWordGroupViewer } from './CrossOutWordGroupViewer';
7
+ export { SpontaneousQaGroupViewer } from './SpontaneousQaGroupViewer';
8
+ export { WordOrderAndMatchGroupViewer } from './WordOrderAndMatchGroupViewer';
@@ -1 +1,220 @@
1
- "use client";import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import{useCallback as n,useEffect as o,useMemo as i,useState as a}from"react";import{ChevronLeft as s,Download as l,Loader2 as c,Sparkles as d}from"lucide-react";import{ResultTemplateType as m}from"../../api/result-review";import{useToast as u}from"../../shared/lib/hooks/useToast";import{ReviewQuestionRenderer as p}from"./ReviewQuestionRenderer";import{useResultReviewPolling as f}from"./hooks/useResultReviewPolling";import{BadgeTitle as g}from"./report/BadgeTitle";import{OceanEduExamReport as x}from"./report/OceanEduExamReport";import{OverallAssessmentSection as h}from"./report/OverallAssessmentSection";import{ResultErrorState as w}from"./report/ResultErrorState";import{ResultLoadingState as b}from"./report/ResultLoadingState";import{ResultNotPublicState as S}from"./report/ResultNotPublicState";import{SpeakingRubricSection as v}from"./report/SpeakingRubricSection";import{SpeakingReviewResult as N}from"./speaking/SpeakingReviewResult";import{transformResultAnswersForReview as R}from"./review-data";import{isResultNotPublic as E,setPdfReady as P}from"./review-status.utils";import{unwrap as y}from"./result-review.utils";import{formatTotalScore as k}from"./utils/review-score.utils";import{transformSpeakingResultForReview as A}from"./utils/transform-speaking-review";const L="/student/contests/my-contests";export var PartRubricTemplateCode;!function(e){e.KINDY_VER3="PLACEMENT_TEST_KINDY_VER3",e.PRESCHOOL="PLACEMENT_TEST_PRESCHOOL"}(PartRubricTemplateCode||(PartRubricTemplateCode={}));const T=new Set(Object.values(PartRubricTemplateCode));export function ResultReviewPageContainer({attemptId:s,token:l,api:c,isPrintMode:d=!1,canExportPdf:p=!1,reviewUrl:g,assetBaseUrl:k,loginHref:U,onBack:F,onNavigate:O,topActionsSlot:_,beforeReportSlot:j,afterReportSlot:Q}){const{error:M,success:$}=u(),[H,I]=a(null),[G,K]=a(null),[V,q]=a(!0),[W,X]=a(null),[Y,z]=a(!1),J=n(async e=>{e&&q(!0);try{const[e,t]=await Promise.all([c.getDetailedResult(s,l),c.getAttempt?.(s,l)]);I(y(e)),K(t?y(t):null),X(null)}catch(e){X(e),E(e,Boolean(l))||M({message:"Không thể tải kết quả",description:e instanceof Error?e.message:void 0})}finally{e&&q(!1)}},[c,s,l,M]);o(()=>{J(!0)},[J]);const Z=n(()=>{J(!1)},[J]),{hasPendingQuestions:ee,hasPendingLlm:te,hasFailedLlm:re,retryLlm:ne}=f({detail:H,isPrintMode:d,isLoading:V,onRefetch:Z});o(()=>{if(!d||V)return;const e=requestAnimationFrame(()=>P(!0));return()=>{cancelAnimationFrame(e),P(!1)}},[d,V]);const oe=G?.exam?.template,ie=oe?.parts,ae=G?.studentName??"Học sinh",se=G?.studentUsername??null,le=G?.branchName??"Chưa tham gia chi nhánh",ce=function(e){const t=e?new Date(e):new Date;return Number.isNaN(t.getTime())?(new Date).toLocaleDateString("vi-VN"):t.toLocaleDateString("vi-VN")}(H?.submittedAt),de=i(()=>function(e,t){const r=e??("undefined"!=typeof window?window.location.href:void 0);if(!r||!t)return r;try{const e=new URL(r,"undefined"!=typeof window?window.location.origin:void 0);return e.searchParams.set("token",t),e.toString()}catch{return r}}(g,l??G?.verificationToken),[g,l,G?.verificationToken]),me=i(()=>R(H?.answers??[],ie),[H?.answers,ie]),ue=i(()=>H&&oe?.type===m.SPEAKING?A(H,ae,ie):null,[H,ae,oe?.type,ie]),pe=!!H?.templateCode&&T.has(H.templateCode),fe=i(()=>function(e){const t={};return e?.speakingRubric?.criteria?.forEach(e=>{const r=/^C(\d+)$/.exec(e.code);if(!r)return;const n=null!=e.weightedScore&&null!=e.maxScore;t[Number(r[1])]=n?{score:e.weightedScore,maxScore:e.maxScore,weighted:n}:{score:e.score,maxScore:5,weighted:n}}),t}(H),[H?.speakingRubric]);o(()=>{if("undefined"==typeof window)return;window.history.pushState(null,"",window.location.href);const e=()=>{F?F():O?O(L):window.location.replace(L)};return window.addEventListener("popstate",e),()=>{window.removeEventListener("popstate",e)}},[F,O]);const ge=n(()=>{if(F)return F();O?O(L):"undefined"!=typeof window&&(window.location.href=L)},[F,O]),xe=async()=>{if(H&&c.exportPdf){z(!0);try{const{blob:e,filename:t}=await c.exportPdf(s,oe?.type);!function(e,t){const r=URL.createObjectURL(e),n=document.createElement("a");n.href=r,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}(e,t),$({message:"Xuất PDF thành công"})}catch(e){M({message:"Không xuất được PDF",description:e instanceof Error?e.message:void 0})}finally{z(!1)}}};return V?e(b,{}):E(W,Boolean(l))?e(S,{loginHref:U,assetBaseUrl:k,onLogin:O}):H?ue?e(N,{reviewData:ue,studentName:ae,studentCode:se,branchName:le,examDateText:ce,examTitle:oe?.title,showDetailedResults:H.showDetailedResults,speakingRubric:H.speakingRubric,reviewUrl:de,assetBaseUrl:k,canExportPdf:p&&Boolean(c.exportPdf),isExporting:Y,hasPendingQuestions:ee,onBack:ge,onExportPdf:xe,topActionsSlot:_,beforeReportSlot:j,afterReportSlot:Q}):e("div",{className:"min-h-screen bg-[#e0e0e0] py-4 md:py-6",children:r("div",{className:"mx-auto flex w-full max-w-[1160px] flex-col gap-4 px-0 sm:px-4",children:[e(D,{onBack:ge,onExport:xe,canExport:p&&Boolean(c.exportPdf),isExporting:Y,topActionsSlot:_}),ee?e(C,{}):null,j,e(x,{studentName:ae,studentCode:se,branchName:le,examDateText:ce,totalScore:H.totalScore,maxScore:H.maxScore,isPendingGrading:Boolean(H.isPendingGrading||ee),examSubTitle:H.roomName,examTitle:oe?.title,reviewUrl:de,assetBaseUrl:k,readingScore:H.readingScore,maxReadingScore:H.maxReadingScore,listeningScore:H.listeningScore,maxListeningScore:H.maxListeningScore,writingScore:H.writingScore,maxWritingScore:H.maxWritingScore,speakingScore:H.speakingScore,maxSpeakingScore:H.maxSpeakingScore,overallAssessmentSlot:r(t,{children:[e(h,{isPending:te,isFailed:re,onRetry:ne,llmOverallAssessment:H.llmOverallAssessment,llmSkillAssessment:H.llmSkillAssessment,correctAnswers:H.correctAnswers,totalQuestions:H.totalQuestions}),H.speakingRubric?.criteria?.length?e(v,{rubric:H.speakingRubric}):null]}),children:!1!==H.showDetailedResults?e(B,{reviewData:me,hidePerQuestionGrading:pe,rubricScores:fe}):null}),Q]})}):e(w,{error:W,onBack:ge})}function D({onBack:t,onExport:n,canExport:o,isExporting:i,topActionsSlot:a}){return r("div",{className:"flex items-center justify-between gap-3 px-3 print:hidden sm:px-0",children:[r("button",{type:"button",onClick:t,className:"inline-flex items-center gap-2 rounded-xl border border-slate-200 bg-white px-4 py-2.5 text-sm font-semibold text-slate-700 shadow-sm transition hover:bg-slate-50",children:[e(s,{className:"h-4 w-4"}),"Quay lại"]}),r("div",{className:"flex items-center gap-3",children:[o?r("button",{type:"button",onClick:()=>{n()},disabled:i,className:"inline-flex items-center gap-2 rounded-xl bg-gradient-to-r from-[#00AEEF] to-[#0099D6] px-5 py-2.5 text-sm font-bold text-white shadow-lg disabled:opacity-50",children:[i?e(c,{className:"h-4 w-4 animate-spin"}):e(l,{className:"h-4 w-4"}),i?"Đang xuất...":"Xuất PDF"]}):null,a]})]})}function C(){return r("div",{className:"mx-3 flex items-center gap-3 rounded-2xl border border-[#b3dfff] bg-gradient-to-r from-[#e8f6ff] to-[#f0f8ff] px-5 py-4 shadow-sm sm:mx-0",children:[e("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-[#d0edff]",children:e(d,{className:"h-5 w-5 animate-pulse text-[#00AEEF]"})}),r("div",{children:[e("p",{className:"text-sm font-bold text-[#0054A6]",children:"AI đang chấm điểm..."}),e("p",{className:"text-xs text-[#0078c8]",children:"Trang sẽ tự động cập nhật cho đến khi hoàn tất."})]})]})}function B({reviewData:t,hidePerQuestionGrading:n,rubricScores:o}){return e("div",{className:"space-y-6",children:t.parts.map((i,a)=>{const s=n?o[i.partNo]:void 0,l=t.partScoresMap[a],c=s?`${s.weighted?Number(s.score.toFixed(1)):Math.round(s.score)} / ${Math.round(s.maxScore)}`:l?`${k(l.score)} / ${k(l.maxScore)}`:null;return r("section",{className:"relative rounded-[20px] border-2 border-[#00AEEF] bg-white px-5 pb-6 pt-11 md:px-8",children:[e(g,{number:String(i.partNo),title:i.name||`PHẦN ${i.partNo}`}),r("div",{className:"mb-6 flex flex-col gap-4",children:[c?e("div",{className:"flex justify-end",children:r("div",{className:"rounded-full bg-[#0054A6] px-4 py-2 text-sm font-bold text-white",children:["Điểm: ",c]})}):null,i.instructions?e(U,{value:i.instructions}):null]}),e(p,{part:i,reviewData:t,hidePerQuestionGrading:n})]},`${i.partId}-${a}`)})})}function U({value:t}){return/<[a-z][\s\S]*>/i.test(t)?e("div",{className:"text-[17px] font-bold leading-relaxed text-[#0054A6] [&_p]:mb-2 [&_p:last-child]:mb-0",dangerouslySetInnerHTML:{__html:t}}):e("h3",{className:"text-[17px] font-bold leading-relaxed text-[#0054A6]",children:t})}
1
+ 'use client';
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useCallback, useEffect, useMemo, useState } from 'react';
4
+ import { ChevronLeft, Download, Loader2, Sparkles } from 'lucide-react';
5
+ import { ResultTemplateType, } from '../../api/result-review';
6
+ import { useToast } from '../../shared/lib/hooks/useToast';
7
+ import { ReviewQuestionRenderer } from './ReviewQuestionRenderer';
8
+ import { useResultReviewPolling } from './hooks/useResultReviewPolling';
9
+ import { BadgeTitle } from './report/BadgeTitle';
10
+ import { OceanEduExamReport } from './report/OceanEduExamReport';
11
+ import { OverallAssessmentSection } from './report/OverallAssessmentSection';
12
+ import { ResultErrorState } from './report/ResultErrorState';
13
+ import { ResultLoadingState } from './report/ResultLoadingState';
14
+ import { ResultNotPublicState } from './report/ResultNotPublicState';
15
+ import { SpeakingRubricSection } from './report/SpeakingRubricSection';
16
+ import { SpeakingReviewResult } from './speaking/SpeakingReviewResult';
17
+ import { transformResultAnswersForReview } from './review-data';
18
+ import { isResultNotPublic, setPdfReady } from './review-status.utils';
19
+ import { unwrap } from './result-review.utils';
20
+ import { formatTotalScore } from './utils/review-score.utils';
21
+ import { transformSpeakingResultForReview } from './utils/transform-speaking-review';
22
+ const DEFAULT_RESULTS_PATH = '/student/contests/my-contests';
23
+ export var PartRubricTemplateCode;
24
+ (function (PartRubricTemplateCode) {
25
+ PartRubricTemplateCode["KINDY_VER3"] = "PLACEMENT_TEST_KINDY_VER3";
26
+ PartRubricTemplateCode["PRESCHOOL"] = "PLACEMENT_TEST_PRESCHOOL";
27
+ })(PartRubricTemplateCode || (PartRubricTemplateCode = {}));
28
+ const PART_RUBRIC_TEMPLATE_CODES = new Set(Object.values(PartRubricTemplateCode));
29
+ export function ResultReviewPageContainer({ attemptId, token, api, isPrintMode = false, canExportPdf = false, reviewUrl, assetBaseUrl, loginHref, onBack, onNavigate, topActionsSlot, beforeReportSlot, afterReportSlot, }) {
30
+ const { error: errorToast, success } = useToast();
31
+ const [detail, setDetail] = useState(null);
32
+ const [attempt, setAttempt] = useState(null);
33
+ const [isLoading, setIsLoading] = useState(true);
34
+ const [loadError, setLoadError] = useState(null);
35
+ const [isExporting, setIsExporting] = useState(false);
36
+ const loadResult = useCallback(async (showSpinner) => {
37
+ if (showSpinner)
38
+ setIsLoading(true);
39
+ try {
40
+ const [detailResult, attemptResult] = await Promise.all([
41
+ api.getDetailedResult(attemptId, token),
42
+ api.getAttempt?.(attemptId, token),
43
+ ]);
44
+ setDetail(unwrap(detailResult));
45
+ setAttempt(attemptResult ? unwrap(attemptResult) : null);
46
+ setLoadError(null);
47
+ }
48
+ catch (error) {
49
+ setLoadError(error);
50
+ if (!isResultNotPublic(error, Boolean(token))) {
51
+ errorToast({
52
+ message: 'Không thể tải kết quả',
53
+ description: error instanceof Error ? error.message : undefined,
54
+ });
55
+ }
56
+ }
57
+ finally {
58
+ if (showSpinner)
59
+ setIsLoading(false);
60
+ }
61
+ }, [api, attemptId, token, errorToast]);
62
+ useEffect(() => {
63
+ void loadResult(true);
64
+ }, [loadResult]);
65
+ const refetch = useCallback(() => void loadResult(false), [loadResult]);
66
+ const { hasPendingQuestions, hasPendingLlm, hasFailedLlm, retryLlm } = useResultReviewPolling({
67
+ detail,
68
+ isPrintMode,
69
+ isLoading,
70
+ onRefetch: refetch,
71
+ });
72
+ useEffect(() => {
73
+ if (!isPrintMode || isLoading)
74
+ return undefined;
75
+ const raf = requestAnimationFrame(() => setPdfReady(true));
76
+ return () => {
77
+ cancelAnimationFrame(raf);
78
+ setPdfReady(false);
79
+ };
80
+ }, [isPrintMode, isLoading]);
81
+ const template = attempt?.exam?.template;
82
+ const templateParts = template?.parts;
83
+ const studentName = attempt?.studentName ?? 'Học sinh';
84
+ const studentCode = attempt?.studentUsername ?? null;
85
+ const branchName = attempt?.branchName ?? 'Chưa tham gia chi nhánh';
86
+ const examDateText = formatExamDate(detail?.submittedAt);
87
+ const canonicalReviewUrl = useMemo(() => buildReviewUrl(reviewUrl, token ?? attempt?.verificationToken), [reviewUrl, token, attempt?.verificationToken]);
88
+ const reviewData = useMemo(() => transformResultAnswersForReview(detail?.answers ?? [], templateParts), [detail?.answers, templateParts]);
89
+ const speakingReviewData = useMemo(() => detail && template?.type === ResultTemplateType.SPEAKING
90
+ ? transformSpeakingResultForReview(detail, studentName, templateParts)
91
+ : null, [detail, studentName, template?.type, templateParts]);
92
+ const hidePerQuestionGrading = detail?.templateCode
93
+ ? PART_RUBRIC_TEMPLATE_CODES.has(detail.templateCode)
94
+ : false;
95
+ const rubricScores = useMemo(() => buildRubricPartScores(detail), [detail?.speakingRubric]);
96
+ // Intercept browser back button to navigate to My Contests tab
97
+ useEffect(() => {
98
+ if (typeof window === 'undefined')
99
+ return undefined;
100
+ window.history.pushState(null, '', window.location.href);
101
+ const handlePopState = () => {
102
+ if (onBack) {
103
+ onBack();
104
+ return;
105
+ }
106
+ if (onNavigate) {
107
+ onNavigate(DEFAULT_RESULTS_PATH);
108
+ }
109
+ else {
110
+ window.location.replace(DEFAULT_RESULTS_PATH);
111
+ }
112
+ };
113
+ window.addEventListener('popstate', handlePopState);
114
+ return () => {
115
+ window.removeEventListener('popstate', handlePopState);
116
+ };
117
+ }, [onBack, onNavigate]);
118
+ const handleBack = useCallback(() => {
119
+ if (onBack)
120
+ return onBack();
121
+ if (onNavigate) {
122
+ onNavigate(DEFAULT_RESULTS_PATH);
123
+ return;
124
+ }
125
+ if (typeof window !== 'undefined')
126
+ window.location.href = DEFAULT_RESULTS_PATH;
127
+ }, [onBack, onNavigate]);
128
+ const handleExport = async () => {
129
+ if (!detail || !api.exportPdf)
130
+ return;
131
+ setIsExporting(true);
132
+ try {
133
+ const { blob, filename } = await api.exportPdf(attemptId, template?.type);
134
+ downloadBlob(blob, filename);
135
+ success({ message: 'Xuất PDF thành công' });
136
+ }
137
+ catch (error) {
138
+ errorToast({
139
+ message: 'Không xuất được PDF',
140
+ description: error instanceof Error ? error.message : undefined,
141
+ });
142
+ }
143
+ finally {
144
+ setIsExporting(false);
145
+ }
146
+ };
147
+ if (isLoading)
148
+ return _jsx(ResultLoadingState, {});
149
+ if (isResultNotPublic(loadError, Boolean(token))) {
150
+ return _jsx(ResultNotPublicState, { loginHref: loginHref, assetBaseUrl: assetBaseUrl, onLogin: onNavigate });
151
+ }
152
+ if (!detail)
153
+ return _jsx(ResultErrorState, { error: loadError, onBack: handleBack });
154
+ if (speakingReviewData) {
155
+ return (_jsx(SpeakingReviewResult, { reviewData: speakingReviewData, studentName: studentName, studentCode: studentCode, branchName: branchName, examDateText: examDateText, examTitle: template?.title, showDetailedResults: detail.showDetailedResults, speakingRubric: detail.speakingRubric, reviewUrl: canonicalReviewUrl, assetBaseUrl: assetBaseUrl, canExportPdf: canExportPdf && Boolean(api.exportPdf), isExporting: isExporting, hasPendingQuestions: hasPendingQuestions, onBack: handleBack, onExportPdf: handleExport, topActionsSlot: topActionsSlot, beforeReportSlot: beforeReportSlot, afterReportSlot: afterReportSlot }));
156
+ }
157
+ return (_jsx("div", { className: "min-h-screen bg-[#e0e0e0] py-4 md:py-6", children: _jsxs("div", { className: "mx-auto flex w-full max-w-[1160px] flex-col gap-4 px-0 sm:px-4", children: [_jsx(ReviewToolbar, { onBack: handleBack, onExport: handleExport, canExport: canExportPdf && Boolean(api.exportPdf), isExporting: isExporting, topActionsSlot: topActionsSlot }), hasPendingQuestions ? _jsx(PendingGradingBanner, {}) : null, beforeReportSlot, _jsx(OceanEduExamReport, { studentName: studentName, studentCode: studentCode, branchName: branchName, examDateText: examDateText, totalScore: detail.totalScore, maxScore: detail.maxScore, isPendingGrading: Boolean(detail.isPendingGrading || hasPendingQuestions), examSubTitle: detail.roomName, examTitle: template?.title, reviewUrl: canonicalReviewUrl, assetBaseUrl: assetBaseUrl, readingScore: detail.readingScore, maxReadingScore: detail.maxReadingScore, listeningScore: detail.listeningScore, maxListeningScore: detail.maxListeningScore, writingScore: detail.writingScore, maxWritingScore: detail.maxWritingScore, speakingScore: detail.speakingScore, maxSpeakingScore: detail.maxSpeakingScore, overallAssessmentSlot: (_jsxs(_Fragment, { children: [_jsx(OverallAssessmentSection, { isPending: hasPendingLlm, isFailed: hasFailedLlm, onRetry: retryLlm, llmOverallAssessment: detail.llmOverallAssessment, llmSkillAssessment: detail.llmSkillAssessment, correctAnswers: detail.correctAnswers, totalQuestions: detail.totalQuestions }), detail.speakingRubric?.criteria?.length ? (_jsx(SpeakingRubricSection, { rubric: detail.speakingRubric })) : null] })), children: detail.showDetailedResults !== false ? (_jsx(AnswerSections, { reviewData: reviewData, hidePerQuestionGrading: hidePerQuestionGrading, rubricScores: rubricScores })) : null }), afterReportSlot] }) }));
158
+ }
159
+ function buildRubricPartScores(detail) {
160
+ const scores = {};
161
+ detail?.speakingRubric?.criteria?.forEach((criterion) => {
162
+ const match = /^C(\d+)$/.exec(criterion.code);
163
+ if (!match)
164
+ return;
165
+ const weighted = criterion.weightedScore != null && criterion.maxScore != null;
166
+ scores[Number(match[1])] = weighted
167
+ ? { score: criterion.weightedScore, maxScore: criterion.maxScore, weighted }
168
+ : { score: criterion.score, maxScore: 5, weighted };
169
+ });
170
+ return scores;
171
+ }
172
+ function ReviewToolbar({ onBack, onExport, canExport, isExporting, topActionsSlot }) {
173
+ return (_jsxs("div", { className: "flex items-center justify-between gap-3 px-3 print:hidden sm:px-0", children: [_jsxs("button", { type: "button", onClick: onBack, className: "inline-flex items-center gap-2 rounded-xl border border-slate-200 bg-white px-4 py-2.5 text-sm font-semibold text-slate-700 shadow-sm transition hover:bg-slate-50", children: [_jsx(ChevronLeft, { className: "h-4 w-4" }), "Quay l\u1EA1i"] }), _jsxs("div", { className: "flex items-center gap-3", children: [canExport ? (_jsxs("button", { type: "button", onClick: () => void onExport(), disabled: isExporting, className: "inline-flex items-center gap-2 rounded-xl bg-gradient-to-r from-[#00AEEF] to-[#0099D6] px-5 py-2.5 text-sm font-bold text-white shadow-lg disabled:opacity-50", children: [isExporting ? _jsx(Loader2, { className: "h-4 w-4 animate-spin" }) : _jsx(Download, { className: "h-4 w-4" }), isExporting ? 'Đang xuất...' : 'Xuất PDF'] })) : null, topActionsSlot] })] }));
174
+ }
175
+ function PendingGradingBanner() {
176
+ return (_jsxs("div", { className: "mx-3 flex items-center gap-3 rounded-2xl border border-[#b3dfff] bg-gradient-to-r from-[#e8f6ff] to-[#f0f8ff] px-5 py-4 shadow-sm sm:mx-0", children: [_jsx("div", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-[#d0edff]", children: _jsx(Sparkles, { className: "h-5 w-5 animate-pulse text-[#00AEEF]" }) }), _jsxs("div", { children: [_jsx("p", { className: "text-sm font-bold text-[#0054A6]", children: "AI \u0111ang ch\u1EA5m \u0111i\u1EC3m..." }), _jsx("p", { className: "text-xs text-[#0078c8]", children: "Trang s\u1EBD t\u1EF1 \u0111\u1ED9ng c\u1EADp nh\u1EADt cho \u0111\u1EBFn khi ho\u00E0n t\u1EA5t." })] })] }));
177
+ }
178
+ function AnswerSections({ reviewData, hidePerQuestionGrading, rubricScores }) {
179
+ return _jsx("div", { className: "space-y-6", children: reviewData.parts.map((part, index) => {
180
+ const rubricScore = hidePerQuestionGrading ? rubricScores[part.partNo] : undefined;
181
+ const score = reviewData.partScoresMap[index];
182
+ const scoreText = rubricScore
183
+ ? `${rubricScore.weighted ? Number(rubricScore.score.toFixed(1)) : Math.round(rubricScore.score)} / ${Math.round(rubricScore.maxScore)}`
184
+ : score ? `${formatTotalScore(score.score)} / ${formatTotalScore(score.maxScore)}` : null;
185
+ return (_jsxs("section", { className: "relative rounded-[20px] border-2 border-[#00AEEF] bg-white px-5 pb-6 pt-11 md:px-8", children: [_jsx(BadgeTitle, { number: String(part.partNo), title: part.name || `PHẦN ${part.partNo}` }), _jsxs("div", { className: "mb-6 flex flex-col gap-4", children: [scoreText ? _jsx("div", { className: "flex justify-end", children: _jsxs("div", { className: "rounded-full bg-[#0054A6] px-4 py-2 text-sm font-bold text-white", children: ["\u0110i\u1EC3m: ", scoreText] }) }) : null, part.instructions ? _jsx(PartInstructions, { value: part.instructions }) : null] }), _jsx(ReviewQuestionRenderer, { part: part, reviewData: reviewData, hidePerQuestionGrading: hidePerQuestionGrading })] }, `${part.partId}-${index}`));
186
+ }) });
187
+ }
188
+ function PartInstructions({ value }) {
189
+ if (/<[a-z][\s\S]*>/i.test(value)) {
190
+ return _jsx("div", { className: "text-[17px] font-bold leading-relaxed text-[#0054A6] [&_p]:mb-2 [&_p:last-child]:mb-0", dangerouslySetInnerHTML: { __html: value } });
191
+ }
192
+ return _jsx("h3", { className: "text-[17px] font-bold leading-relaxed text-[#0054A6]", children: value });
193
+ }
194
+ function buildReviewUrl(explicitUrl, reviewToken) {
195
+ const source = explicitUrl ?? (typeof window !== 'undefined' ? window.location.href : undefined);
196
+ if (!source || !reviewToken)
197
+ return source;
198
+ try {
199
+ const url = new URL(source, typeof window !== 'undefined' ? window.location.origin : undefined);
200
+ url.searchParams.set('token', reviewToken);
201
+ return url.toString();
202
+ }
203
+ catch {
204
+ return source;
205
+ }
206
+ }
207
+ function formatExamDate(value) {
208
+ const date = value ? new Date(value) : new Date();
209
+ return Number.isNaN(date.getTime()) ? new Date().toLocaleDateString('vi-VN') : date.toLocaleDateString('vi-VN');
210
+ }
211
+ function downloadBlob(blob, filename) {
212
+ const url = URL.createObjectURL(blob);
213
+ const link = document.createElement('a');
214
+ link.href = url;
215
+ link.download = filename;
216
+ document.body.appendChild(link);
217
+ link.click();
218
+ document.body.removeChild(link);
219
+ URL.revokeObjectURL(url);
220
+ }
@@ -1 +1,55 @@
1
- "use client";import{jsx as e,Fragment as r,jsxs as t}from"react/jsx-runtime";import{QuestionExplanations as s}from"./renderers/QuestionExplanations";import{renderDedicatedReviewBody as n}from"./renderers/review-question-body-dedicated";import{renderMoversReviewBody as a}from"./renderers/review-question-body-movers";const o=new Set(["READ_DISPLAYED_CONTENT","SPEAKING_DESCRIBE_IMAGE","SPEAKING_CUE_CARD","SPONTANEOUS_QA","LISTEN_AND_SPEAK_ANSWER","LISTEN_AND_SPEAK_IMAGE_GROUP","LISTEN_AND_SPEAK_QUESTION_LIST","LISTEN_AND_SPEAK_COMPARE_IMAGES","LISTEN_AND_SPEAK_WITH_STORY_IMAGES","LISTEN_AND_SPEAK_INFO_EXCHANGE","LISTEN_AND_SPEAK_ODD_ONE_OUT"]);export function ReviewQuestionRenderer(n){const{part:a}=n,c=a.questions.map(e=>({id:e.id,questionNumber:e.question_number,explanation:e.explanation??null}));return t(r,{children:[i(n),!o.has(a.questionType)&&e(s,{items:c})]})}function i({part:r,reviewData:s,hidePerQuestionGrading:o=!1}){const i=n({part:r,answers:s.studentAnswers,isCorrectMap:s.isCorrectMap,correctAnswerTextMap:s.correctAnswerTextMap,correctOptionIdMap:s.correctOptionIdMap,rawCorrectAnswerMap:s.rawCorrectAnswerMap,questionScoreMap:s.questionScoreMap,hidePerQuestionGrading:o});if(i)return i;const c=a({part:r,answers:s.studentAnswers,isCorrectMap:s.isCorrectMap,correctAnswerTextMap:s.correctAnswerTextMap,correctOptionIdMap:s.correctOptionIdMap,cellAnswersMap:s.cellAnswersMap,essayGradingMap:s.essayGradingMap,rawCorrectAnswerMap:s.rawCorrectAnswerMap});return c||e("div",{className:"flex h-full items-center justify-center",children:t("div",{className:"text-center",children:[e("p",{className:"text-lg font-semibold text-red-500",children:"Unsupported question type"}),e("p",{className:"mt-2 text-gray-500",children:r.questionType})]})})}
1
+ 'use client';
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { QuestionExplanations } from './renderers/QuestionExplanations';
4
+ import { renderDedicatedReviewBody } from './renderers/review-question-body-dedicated';
5
+ import { renderMoversReviewBody } from './renderers/review-question-body-movers';
6
+ const SPEAKING_QUESTION_TYPES = new Set([
7
+ 'READ_DISPLAYED_CONTENT',
8
+ 'SPEAKING_DESCRIBE_IMAGE',
9
+ 'SPEAKING_CUE_CARD',
10
+ 'SPONTANEOUS_QA',
11
+ 'SPONTANEOUS_QA_GROUP',
12
+ 'LISTEN_AND_SPEAK_ANSWER',
13
+ 'LISTEN_AND_SPEAK_IMAGE_GROUP',
14
+ 'LISTEN_AND_SPEAK_QUESTION_LIST',
15
+ 'LISTEN_AND_SPEAK_COMPARE_IMAGES',
16
+ 'LISTEN_AND_SPEAK_WITH_STORY_IMAGES',
17
+ 'LISTEN_AND_SPEAK_INFO_EXCHANGE',
18
+ 'LISTEN_AND_SPEAK_ODD_ONE_OUT',
19
+ ]);
20
+ export function ReviewQuestionRenderer(props) {
21
+ const { part } = props;
22
+ const explanationItems = part.questions.map((question) => ({
23
+ id: question.id,
24
+ questionNumber: question.question_number,
25
+ explanation: question.explanation ?? null,
26
+ }));
27
+ return (_jsxs(_Fragment, { children: [renderQuestionBody(props), !SPEAKING_QUESTION_TYPES.has(part.questionType) && (_jsx(QuestionExplanations, { items: explanationItems }))] }));
28
+ }
29
+ function renderQuestionBody({ part, reviewData, hidePerQuestionGrading = false, }) {
30
+ const dedicated = renderDedicatedReviewBody({
31
+ part,
32
+ answers: reviewData.studentAnswers,
33
+ isCorrectMap: reviewData.isCorrectMap,
34
+ correctAnswerTextMap: reviewData.correctAnswerTextMap,
35
+ correctOptionIdMap: reviewData.correctOptionIdMap,
36
+ rawCorrectAnswerMap: reviewData.rawCorrectAnswerMap,
37
+ questionScoreMap: reviewData.questionScoreMap,
38
+ hidePerQuestionGrading,
39
+ });
40
+ if (dedicated)
41
+ return dedicated;
42
+ const movers = renderMoversReviewBody({
43
+ part,
44
+ answers: reviewData.studentAnswers,
45
+ isCorrectMap: reviewData.isCorrectMap,
46
+ correctAnswerTextMap: reviewData.correctAnswerTextMap,
47
+ correctOptionIdMap: reviewData.correctOptionIdMap,
48
+ cellAnswersMap: reviewData.cellAnswersMap,
49
+ essayGradingMap: reviewData.essayGradingMap,
50
+ rawCorrectAnswerMap: reviewData.rawCorrectAnswerMap,
51
+ });
52
+ if (movers)
53
+ return movers;
54
+ return (_jsx("div", { className: "flex h-full items-center justify-center", children: _jsxs("div", { className: "text-center", children: [_jsx("p", { className: "text-lg font-semibold text-red-500", children: "Unsupported question type" }), _jsx("p", { className: "mt-2 text-gray-500", children: part.questionType })] }) }));
55
+ }
@@ -1 +1,76 @@
1
- "use client";import{useCallback as e,useEffect as n,useRef as t,useState as r}from"react";const s=new Set(["PENDING","QUEUED","PROCESSING"]);export function useResultReviewPolling({detail:l,isPrintMode:o,isLoading:i,intervalMs:a=5e3,llmTimeoutMs:u=12e4,onRefetch:c}){const m=(g=l?.answers,!!g&&g.some(e=>null!=e.gradingStatus&&s.has(e.gradingStatus)));var g;const d=Boolean(l)&&!function(e){if(!e)return!1;if(e.llmOverallAssessment)return!0;const n=e.llmSkillAssessment;return Boolean(n&&Object.values(n).some(e=>Boolean(e)))}(l),[f,v]=r(!1),[P,S]=r(0),h=t(c);h.current=c,n(()=>{if(v(!1),!d||o||i)return;const e=setTimeout(()=>v(!0),u);return()=>clearTimeout(e)},[d,o,i,u,P]);const E=d&&!f,I=d&&f,L=!o&&!i&&(m||E);n(()=>{if(!L)return;const e=setInterval(()=>h.current(),a);return()=>clearInterval(e)},[a,L]);const R=e(()=>{S(e=>e+1),h.current()},[]);return{hasPendingQuestions:m,hasPendingLlm:E,hasFailedLlm:I,isPolling:L,retryLlm:R}}
1
+ 'use client';
2
+ import { useCallback, useEffect, useRef, useState } from 'react';
3
+ /** Default poll cadence for pending grading (5 seconds). */
4
+ const DEFAULT_INTERVAL_MS = 5000;
5
+ /**
6
+ * How long the assessment may stay absent before we call it failed.
7
+ *
8
+ * The backend retries the LLM job 3x with exponential backoff (5s/10s/20s) on
9
+ * top of the model call itself, so this must comfortably exceed that total —
10
+ * otherwise a run that would have succeeded gets reported as failed.
11
+ */
12
+ const DEFAULT_LLM_TIMEOUT_MS = 120000;
13
+ /**
14
+ * Grading statuses that mean an answer is still being processed. `FAILED` is
15
+ * terminal and deliberately excluded — polling on it never converges.
16
+ */
17
+ const POLLABLE_STATUSES = new Set(['PENDING', 'QUEUED', 'PROCESSING']);
18
+ function hasPendingGrading(answers) {
19
+ if (!answers)
20
+ return false;
21
+ return answers.some((answer) => answer.gradingStatus != null && POLLABLE_STATUSES.has(answer.gradingStatus));
22
+ }
23
+ /**
24
+ * An empty `llmSkillAssessment` object is not an assessment: the generator can
25
+ * legitimately persist `{}` when no skill has a percentage, so treat it the same
26
+ * as absent rather than rendering an empty table.
27
+ */
28
+ function hasLlmAssessmentData(detail) {
29
+ if (!detail)
30
+ return false;
31
+ if (detail.llmOverallAssessment)
32
+ return true;
33
+ const skills = detail.llmSkillAssessment;
34
+ return Boolean(skills && Object.values(skills).some((skill) => Boolean(skill)));
35
+ }
36
+ /**
37
+ * Polls the result endpoint while any answer is still being graded or the LLM
38
+ * assessment hasn't been generated yet. Ports the host app's behaviour: polling
39
+ * is suppressed in print mode so the headless PDF renderer reaches an idle state.
40
+ *
41
+ * A missing assessment is indistinguishable from a failed one — the API exposes
42
+ * no status for it — so the wait is bounded by `llmTimeoutMs` and reported as
43
+ * `hasFailedLlm` once it elapses, instead of polling forever.
44
+ */
45
+ export function useResultReviewPolling({ detail, isPrintMode, isLoading, intervalMs = DEFAULT_INTERVAL_MS, llmTimeoutMs = DEFAULT_LLM_TIMEOUT_MS, onRefetch, }) {
46
+ const hasPendingQuestions = hasPendingGrading(detail?.answers);
47
+ const isAwaitingLlm = Boolean(detail) && !hasLlmAssessmentData(detail);
48
+ const [llmWaitExpired, setLlmWaitExpired] = useState(false);
49
+ const [retryNonce, setRetryNonce] = useState(0);
50
+ const onRefetchRef = useRef(onRefetch);
51
+ onRefetchRef.current = onRefetch;
52
+ // Bound the assessment wait. `isAwaitingLlm` is a boolean, so this timer keeps
53
+ // running across refetches and only resets when the assessment arrives (or the
54
+ // user retries) — it is a deadline on the wait, not on each poll.
55
+ useEffect(() => {
56
+ setLlmWaitExpired(false);
57
+ if (!isAwaitingLlm || isPrintMode || isLoading)
58
+ return undefined;
59
+ const timer = setTimeout(() => setLlmWaitExpired(true), llmTimeoutMs);
60
+ return () => clearTimeout(timer);
61
+ }, [isAwaitingLlm, isPrintMode, isLoading, llmTimeoutMs, retryNonce]);
62
+ const hasPendingLlm = isAwaitingLlm && !llmWaitExpired;
63
+ const hasFailedLlm = isAwaitingLlm && llmWaitExpired;
64
+ const isPolling = !isPrintMode && !isLoading && (hasPendingQuestions || hasPendingLlm);
65
+ useEffect(() => {
66
+ if (!isPolling)
67
+ return undefined;
68
+ const timer = setInterval(() => onRefetchRef.current(), intervalMs);
69
+ return () => clearInterval(timer);
70
+ }, [intervalMs, isPolling]);
71
+ const retryLlm = useCallback(() => {
72
+ setRetryNonce((nonce) => nonce + 1);
73
+ onRefetchRef.current();
74
+ }, []);
75
+ return { hasPendingQuestions, hasPendingLlm, hasFailedLlm, isPolling, retryLlm };
76
+ }