@magmamath/students-features 1.4.6 → 1.5.0-rc.10

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 (412) hide show
  1. package/dist/commonjs/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.js +1 -6
  2. package/dist/commonjs/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.js.map +1 -1
  3. package/dist/commonjs/features/fluency/components/Fluency.js +6 -12
  4. package/dist/commonjs/features/fluency/components/Fluency.js.map +1 -1
  5. package/dist/commonjs/features/fluency/components/select-math-operator/SelectMathOperator.js +5 -13
  6. package/dist/commonjs/features/fluency/components/select-math-operator/SelectMathOperator.js.map +1 -1
  7. package/dist/commonjs/features/fluency/model/FluencyModel.js +0 -21
  8. package/dist/commonjs/features/fluency/model/FluencyModel.js.map +1 -1
  9. package/dist/commonjs/features/fluency/shared/fluency.constants.js +1 -6
  10. package/dist/commonjs/features/fluency/shared/fluency.constants.js.map +1 -1
  11. package/dist/commonjs/features/fluency/shared/fluency.helpers.js +1 -3
  12. package/dist/commonjs/features/fluency/shared/fluency.helpers.js.map +1 -1
  13. package/dist/commonjs/features/pmProgress/model/PmProgressModel.js +1 -7
  14. package/dist/commonjs/features/pmProgress/model/PmProgressModel.js.map +1 -1
  15. package/dist/commonjs/features/pmProgress/model/PmRecommendationsModel.js +4 -20
  16. package/dist/commonjs/features/pmProgress/model/PmRecommendationsModel.js.map +1 -1
  17. package/dist/commonjs/features/pmProgress/shared/pmProgress.helpers.js +1 -22
  18. package/dist/commonjs/features/pmProgress/shared/pmProgress.helpers.js.map +1 -1
  19. package/dist/commonjs/features/translation/constants.js +11 -0
  20. package/dist/commonjs/features/translation/constants.js.map +1 -0
  21. package/dist/commonjs/features/translation/helpers.js +60 -0
  22. package/dist/commonjs/features/translation/helpers.js.map +1 -0
  23. package/dist/commonjs/features/translation/index.js +105 -0
  24. package/dist/commonjs/features/translation/index.js.map +1 -0
  25. package/dist/commonjs/features/translation/model/TranslationModel.js +122 -0
  26. package/dist/commonjs/features/translation/model/TranslationModel.js.map +1 -0
  27. package/dist/commonjs/features/translation/model/TranslationPreprocessor.js +142 -0
  28. package/dist/commonjs/features/translation/model/TranslationPreprocessor.js.map +1 -0
  29. package/dist/commonjs/features/translation/model/TranslationService.js +112 -0
  30. package/dist/commonjs/features/translation/model/TranslationService.js.map +1 -0
  31. package/dist/commonjs/features/translation/preserve/wordsToPreserve.js +314 -0
  32. package/dist/commonjs/features/translation/preserve/wordsToPreserve.js.map +1 -0
  33. package/dist/commonjs/features/translation/providers/google/GoogleTranslationProvider.js +50 -0
  34. package/dist/commonjs/features/translation/providers/google/GoogleTranslationProvider.js.map +1 -0
  35. package/dist/commonjs/features/translation/providers/google/supportedLanguages.js +230 -0
  36. package/dist/commonjs/features/translation/providers/google/supportedLanguages.js.map +1 -0
  37. package/dist/commonjs/features/translation/providers/google.types.js +2 -0
  38. package/dist/commonjs/features/translation/providers/google.types.js.map +1 -0
  39. package/dist/commonjs/features/translation/providers/translation.interface.js +49 -0
  40. package/dist/commonjs/features/translation/providers/translation.interface.js.map +1 -0
  41. package/dist/commonjs/features/translation/types.js +2 -0
  42. package/dist/commonjs/features/translation/types.js.map +1 -0
  43. package/dist/commonjs/features/voice/index.js +15 -4
  44. package/dist/commonjs/features/voice/index.js.map +1 -1
  45. package/dist/commonjs/features/voice/playing/components/VoiceIcon.js +1 -1
  46. package/dist/commonjs/features/voice/playing/components/VoiceIcon.js.map +1 -1
  47. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptContent.js +44 -0
  48. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptContent.js.map +1 -0
  49. package/dist/commonjs/features/voice/playing/components/VoiceTranscription.js +107 -0
  50. package/dist/commonjs/features/voice/playing/components/VoiceTranscription.js.map +1 -0
  51. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.js +66 -0
  52. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.js.map +1 -0
  53. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.js +58 -0
  54. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.js.map +1 -0
  55. package/dist/commonjs/features/voice/playing/hooks/{useVoiceTranscriptionsDropdown.js → useDropdownAnimation.js} +8 -7
  56. package/dist/commonjs/features/voice/playing/hooks/useDropdownAnimation.js.map +1 -0
  57. package/dist/commonjs/features/voice/playing/hooks/useVoicePlayerLifecycle.js +53 -0
  58. package/dist/commonjs/features/voice/playing/hooks/useVoicePlayerLifecycle.js.map +1 -0
  59. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionController.js +111 -0
  60. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionController.js.map +1 -0
  61. package/dist/commonjs/features/voice/playing/model/{VoiceTranscriptionsDropdown.model.js → Dropdown.model.js} +4 -4
  62. package/dist/commonjs/features/voice/playing/model/Dropdown.model.js.map +1 -0
  63. package/dist/commonjs/features/voice/playing/model/PlaybackController.js +192 -0
  64. package/dist/commonjs/features/voice/playing/model/PlaybackController.js.map +1 -0
  65. package/dist/commonjs/features/voice/playing/model/Player.model.js +50 -5
  66. package/dist/commonjs/features/voice/playing/model/Player.model.js.map +1 -1
  67. package/dist/commonjs/features/voice/playing/model/{VoiceTranscriptionsCollection.js → TranscriptionsCollection.js} +4 -4
  68. package/dist/commonjs/features/voice/playing/model/TranscriptionsCollection.js.map +1 -0
  69. package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloader.model.js +83 -0
  70. package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloader.model.js.map +1 -0
  71. package/dist/commonjs/features/voice/playing/model/Translation.model.js +62 -0
  72. package/dist/commonjs/features/voice/playing/model/Translation.model.js.map +1 -0
  73. package/dist/commonjs/features/voice/playing/model/VoiceFileDownloader.model.js +2 -2
  74. package/dist/commonjs/features/voice/playing/model/VoiceFileDownloader.model.js.map +1 -1
  75. package/dist/commonjs/features/voice/playing/model/VoicePlayer.model.js +58 -172
  76. package/dist/commonjs/features/voice/playing/model/VoicePlayer.model.js.map +1 -1
  77. package/dist/commonjs/features/voice/recording/components/VoiceRecordDivider.js +1 -1
  78. package/dist/commonjs/features/voice/recording/components/VoiceRecordDivider.js.map +1 -1
  79. package/dist/commonjs/features/voice/types.js +12 -1
  80. package/dist/commonjs/features/voice/types.js.map +1 -1
  81. package/dist/commonjs/index.js +12 -0
  82. package/dist/commonjs/index.js.map +1 -1
  83. package/dist/module/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.js +2 -7
  84. package/dist/module/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.js.map +1 -1
  85. package/dist/module/features/fluency/components/Fluency.js +8 -14
  86. package/dist/module/features/fluency/components/Fluency.js.map +1 -1
  87. package/dist/module/features/fluency/components/select-math-operator/SelectMathOperator.js +5 -13
  88. package/dist/module/features/fluency/components/select-math-operator/SelectMathOperator.js.map +1 -1
  89. package/dist/module/features/fluency/model/FluencyModel.js +1 -22
  90. package/dist/module/features/fluency/model/FluencyModel.js.map +1 -1
  91. package/dist/module/features/fluency/shared/fluency.constants.js +0 -5
  92. package/dist/module/features/fluency/shared/fluency.constants.js.map +1 -1
  93. package/dist/module/features/fluency/shared/fluency.helpers.js +0 -1
  94. package/dist/module/features/fluency/shared/fluency.helpers.js.map +1 -1
  95. package/dist/module/features/pmProgress/model/PmProgressModel.js +1 -7
  96. package/dist/module/features/pmProgress/model/PmProgressModel.js.map +1 -1
  97. package/dist/module/features/pmProgress/model/PmRecommendationsModel.js +4 -20
  98. package/dist/module/features/pmProgress/model/PmRecommendationsModel.js.map +1 -1
  99. package/dist/module/features/pmProgress/shared/pmProgress.helpers.js +0 -20
  100. package/dist/module/features/pmProgress/shared/pmProgress.helpers.js.map +1 -1
  101. package/dist/module/features/translation/constants.js +7 -0
  102. package/dist/module/features/translation/constants.js.map +1 -0
  103. package/dist/module/features/translation/helpers.js +53 -0
  104. package/dist/module/features/translation/helpers.js.map +1 -0
  105. package/dist/module/features/translation/index.js +12 -0
  106. package/dist/module/features/translation/index.js.map +1 -0
  107. package/dist/module/features/translation/model/TranslationModel.js +117 -0
  108. package/dist/module/features/translation/model/TranslationModel.js.map +1 -0
  109. package/dist/module/features/translation/model/TranslationPreprocessor.js +137 -0
  110. package/dist/module/features/translation/model/TranslationPreprocessor.js.map +1 -0
  111. package/dist/module/features/translation/model/TranslationService.js +107 -0
  112. package/dist/module/features/translation/model/TranslationService.js.map +1 -0
  113. package/dist/module/features/translation/preserve/wordsToPreserve.js +310 -0
  114. package/dist/module/features/translation/preserve/wordsToPreserve.js.map +1 -0
  115. package/dist/module/features/translation/providers/google/GoogleTranslationProvider.js +45 -0
  116. package/dist/module/features/translation/providers/google/GoogleTranslationProvider.js.map +1 -0
  117. package/dist/module/features/translation/providers/google/supportedLanguages.js +225 -0
  118. package/dist/module/features/translation/providers/google/supportedLanguages.js.map +1 -0
  119. package/dist/module/features/translation/providers/google.types.js +2 -0
  120. package/dist/module/features/translation/providers/google.types.js.map +1 -0
  121. package/dist/module/features/translation/providers/translation.interface.js +44 -0
  122. package/dist/module/features/translation/providers/translation.interface.js.map +1 -0
  123. package/dist/module/features/translation/types.js +2 -0
  124. package/dist/module/features/translation/types.js.map +1 -0
  125. package/dist/module/features/voice/index.js +2 -1
  126. package/dist/module/features/voice/index.js.map +1 -1
  127. package/dist/module/features/voice/playing/components/VoiceIcon.js +2 -2
  128. package/dist/module/features/voice/playing/components/VoiceIcon.js.map +1 -1
  129. package/dist/module/features/voice/playing/components/VoiceTranscriptContent.js +38 -0
  130. package/dist/module/features/voice/playing/components/VoiceTranscriptContent.js.map +1 -0
  131. package/dist/module/features/voice/playing/components/VoiceTranscription.js +101 -0
  132. package/dist/module/features/voice/playing/components/VoiceTranscription.js.map +1 -0
  133. package/dist/module/features/voice/playing/components/VoiceTranscriptionCollapsible.js +58 -0
  134. package/dist/module/features/voice/playing/components/VoiceTranscriptionCollapsible.js.map +1 -0
  135. package/dist/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.js +52 -0
  136. package/dist/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.js.map +1 -0
  137. package/dist/module/features/voice/playing/hooks/{useVoiceTranscriptionsDropdown.js → useDropdownAnimation.js} +6 -5
  138. package/dist/module/features/voice/playing/hooks/useDropdownAnimation.js.map +1 -0
  139. package/dist/module/features/voice/playing/hooks/useVoicePlayerLifecycle.js +48 -0
  140. package/dist/module/features/voice/playing/hooks/useVoicePlayerLifecycle.js.map +1 -0
  141. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionController.js +106 -0
  142. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionController.js.map +1 -0
  143. package/dist/module/features/voice/playing/model/{VoiceTranscriptionsDropdown.model.js → Dropdown.model.js} +2 -2
  144. package/dist/module/features/voice/playing/model/Dropdown.model.js.map +1 -0
  145. package/dist/module/features/voice/playing/model/PlaybackController.js +187 -0
  146. package/dist/module/features/voice/playing/model/PlaybackController.js.map +1 -0
  147. package/dist/module/features/voice/playing/model/Player.model.js +51 -4
  148. package/dist/module/features/voice/playing/model/Player.model.js.map +1 -1
  149. package/dist/module/features/voice/playing/model/{VoiceTranscriptionsCollection.js → TranscriptionsCollection.js} +2 -2
  150. package/dist/module/features/voice/playing/model/TranscriptionsCollection.js.map +1 -0
  151. package/dist/module/features/voice/playing/model/TranscriptionsDownloader.model.js +78 -0
  152. package/dist/module/features/voice/playing/model/TranscriptionsDownloader.model.js.map +1 -0
  153. package/dist/module/features/voice/playing/model/Translation.model.js +57 -0
  154. package/dist/module/features/voice/playing/model/Translation.model.js.map +1 -0
  155. package/dist/module/features/voice/playing/model/VoiceFileDownloader.model.js +2 -2
  156. package/dist/module/features/voice/playing/model/VoiceFileDownloader.model.js.map +1 -1
  157. package/dist/module/features/voice/playing/model/VoicePlayer.model.js +60 -174
  158. package/dist/module/features/voice/playing/model/VoicePlayer.model.js.map +1 -1
  159. package/dist/module/features/voice/recording/components/VoiceRecordDivider.js +2 -2
  160. package/dist/module/features/voice/recording/components/VoiceRecordDivider.js.map +1 -1
  161. package/dist/module/features/voice/types.js +11 -0
  162. package/dist/module/features/voice/types.js.map +1 -1
  163. package/dist/module/index.js +1 -0
  164. package/dist/module/index.js.map +1 -1
  165. package/dist/typescript/commonjs/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.d.ts.map +1 -1
  166. package/dist/typescript/commonjs/features/fluency/components/Fluency.d.ts.map +1 -1
  167. package/dist/typescript/commonjs/features/fluency/components/select-math-operator/SelectMathOperator.d.ts.map +1 -1
  168. package/dist/typescript/commonjs/features/fluency/model/FluencyModel.d.ts +0 -3
  169. package/dist/typescript/commonjs/features/fluency/model/FluencyModel.d.ts.map +1 -1
  170. package/dist/typescript/commonjs/features/fluency/shared/fluency.constants.d.ts +0 -4
  171. package/dist/typescript/commonjs/features/fluency/shared/fluency.constants.d.ts.map +1 -1
  172. package/dist/typescript/commonjs/features/fluency/shared/fluency.helpers.d.ts +0 -1
  173. package/dist/typescript/commonjs/features/fluency/shared/fluency.helpers.d.ts.map +1 -1
  174. package/dist/typescript/commonjs/features/pmProgress/model/PmProgressModel.d.ts.map +1 -1
  175. package/dist/typescript/commonjs/features/pmProgress/model/PmRecommendationsModel.d.ts +38 -9
  176. package/dist/typescript/commonjs/features/pmProgress/model/PmRecommendationsModel.d.ts.map +1 -1
  177. package/dist/typescript/commonjs/features/pmProgress/shared/pmProgress.helpers.d.ts +0 -1
  178. package/dist/typescript/commonjs/features/pmProgress/shared/pmProgress.helpers.d.ts.map +1 -1
  179. package/dist/typescript/commonjs/features/translation/constants.d.ts +5 -0
  180. package/dist/typescript/commonjs/features/translation/constants.d.ts.map +1 -0
  181. package/dist/typescript/commonjs/features/translation/helpers.d.ts +9 -0
  182. package/dist/typescript/commonjs/features/translation/helpers.d.ts.map +1 -0
  183. package/dist/typescript/commonjs/features/translation/index.d.ts +12 -0
  184. package/dist/typescript/commonjs/features/translation/index.d.ts.map +1 -0
  185. package/dist/typescript/commonjs/features/translation/model/TranslationModel.d.ts +33 -0
  186. package/dist/typescript/commonjs/features/translation/model/TranslationModel.d.ts.map +1 -0
  187. package/dist/typescript/commonjs/features/translation/model/TranslationPreprocessor.d.ts +34 -0
  188. package/dist/typescript/commonjs/features/translation/model/TranslationPreprocessor.d.ts.map +1 -0
  189. package/dist/typescript/commonjs/features/translation/model/TranslationService.d.ts +40 -0
  190. package/dist/typescript/commonjs/features/translation/model/TranslationService.d.ts.map +1 -0
  191. package/dist/typescript/commonjs/features/translation/preserve/wordsToPreserve.d.ts +3 -0
  192. package/dist/typescript/commonjs/features/translation/preserve/wordsToPreserve.d.ts.map +1 -0
  193. package/dist/typescript/commonjs/features/translation/providers/google/GoogleTranslationProvider.d.ts +17 -0
  194. package/dist/typescript/commonjs/features/translation/providers/google/GoogleTranslationProvider.d.ts.map +1 -0
  195. package/dist/typescript/commonjs/features/translation/providers/google/supportedLanguages.d.ts +209 -0
  196. package/dist/typescript/commonjs/features/translation/providers/google/supportedLanguages.d.ts.map +1 -0
  197. package/dist/typescript/commonjs/features/translation/providers/google.types.d.ts +15 -0
  198. package/dist/typescript/commonjs/features/translation/providers/google.types.d.ts.map +1 -0
  199. package/dist/typescript/commonjs/features/translation/providers/translation.interface.d.ts +30 -0
  200. package/dist/typescript/commonjs/features/translation/providers/translation.interface.d.ts.map +1 -0
  201. package/dist/typescript/commonjs/features/translation/types.d.ts +27 -0
  202. package/dist/typescript/commonjs/features/translation/types.d.ts.map +1 -0
  203. package/dist/typescript/commonjs/features/voice/index.d.ts +3 -1
  204. package/dist/typescript/commonjs/features/voice/index.d.ts.map +1 -1
  205. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptContent.d.ts +8 -0
  206. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptContent.d.ts.map +1 -0
  207. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscription.d.ts +16 -0
  208. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscription.d.ts.map +1 -0
  209. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts +10 -0
  210. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts.map +1 -0
  211. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts +12 -0
  212. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts.map +1 -0
  213. package/dist/typescript/commonjs/features/voice/playing/hooks/{useVoiceTranscriptionsDropdown.d.ts → useDropdownAnimation.d.ts} +3 -3
  214. package/dist/typescript/commonjs/features/voice/playing/hooks/useDropdownAnimation.d.ts.map +1 -0
  215. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoicePlayerLifecycle.d.ts +15 -0
  216. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoicePlayerLifecycle.d.ts.map +1 -0
  217. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionController.d.ts +30 -0
  218. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionController.d.ts.map +1 -0
  219. package/dist/typescript/{module/features/voice/playing/model/VoiceTranscriptionsDropdown.model.d.ts → commonjs/features/voice/playing/model/Dropdown.model.d.ts} +2 -2
  220. package/dist/typescript/commonjs/features/voice/playing/model/Dropdown.model.d.ts.map +1 -0
  221. package/dist/typescript/commonjs/features/voice/playing/model/PlaybackController.d.ts +28 -0
  222. package/dist/typescript/commonjs/features/voice/playing/model/PlaybackController.d.ts.map +1 -0
  223. package/dist/typescript/commonjs/features/voice/playing/model/Player.model.d.ts +4 -0
  224. package/dist/typescript/commonjs/features/voice/playing/model/Player.model.d.ts.map +1 -1
  225. package/dist/typescript/{module/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts → commonjs/features/voice/playing/model/TranscriptionsCollection.d.ts} +2 -2
  226. package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsCollection.d.ts.map +1 -0
  227. package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloader.model.d.ts +19 -0
  228. package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloader.model.d.ts.map +1 -0
  229. package/dist/typescript/commonjs/features/voice/playing/model/Translation.model.d.ts +25 -0
  230. package/dist/typescript/commonjs/features/voice/playing/model/Translation.model.d.ts.map +1 -0
  231. package/dist/typescript/commonjs/features/voice/playing/model/VoiceFileDownloader.model.d.ts +2 -2
  232. package/dist/typescript/commonjs/features/voice/playing/model/VoiceFileDownloader.model.d.ts.map +1 -1
  233. package/dist/typescript/commonjs/features/voice/playing/model/VoicePlayer.model.d.ts +19 -18
  234. package/dist/typescript/commonjs/features/voice/playing/model/VoicePlayer.model.d.ts.map +1 -1
  235. package/dist/typescript/commonjs/features/voice/types.d.ts +14 -2
  236. package/dist/typescript/commonjs/features/voice/types.d.ts.map +1 -1
  237. package/dist/typescript/commonjs/index.d.ts +1 -0
  238. package/dist/typescript/commonjs/index.d.ts.map +1 -1
  239. package/dist/typescript/module/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.d.ts.map +1 -1
  240. package/dist/typescript/module/features/fluency/components/Fluency.d.ts.map +1 -1
  241. package/dist/typescript/module/features/fluency/components/select-math-operator/SelectMathOperator.d.ts.map +1 -1
  242. package/dist/typescript/module/features/fluency/model/FluencyModel.d.ts +0 -3
  243. package/dist/typescript/module/features/fluency/model/FluencyModel.d.ts.map +1 -1
  244. package/dist/typescript/module/features/fluency/shared/fluency.constants.d.ts +0 -4
  245. package/dist/typescript/module/features/fluency/shared/fluency.constants.d.ts.map +1 -1
  246. package/dist/typescript/module/features/fluency/shared/fluency.helpers.d.ts +0 -1
  247. package/dist/typescript/module/features/fluency/shared/fluency.helpers.d.ts.map +1 -1
  248. package/dist/typescript/module/features/pmProgress/model/PmProgressModel.d.ts.map +1 -1
  249. package/dist/typescript/module/features/pmProgress/model/PmRecommendationsModel.d.ts +38 -9
  250. package/dist/typescript/module/features/pmProgress/model/PmRecommendationsModel.d.ts.map +1 -1
  251. package/dist/typescript/module/features/pmProgress/shared/pmProgress.helpers.d.ts +0 -1
  252. package/dist/typescript/module/features/pmProgress/shared/pmProgress.helpers.d.ts.map +1 -1
  253. package/dist/typescript/module/features/translation/constants.d.ts +5 -0
  254. package/dist/typescript/module/features/translation/constants.d.ts.map +1 -0
  255. package/dist/typescript/module/features/translation/helpers.d.ts +9 -0
  256. package/dist/typescript/module/features/translation/helpers.d.ts.map +1 -0
  257. package/dist/typescript/module/features/translation/index.d.ts +12 -0
  258. package/dist/typescript/module/features/translation/index.d.ts.map +1 -0
  259. package/dist/typescript/module/features/translation/model/TranslationModel.d.ts +33 -0
  260. package/dist/typescript/module/features/translation/model/TranslationModel.d.ts.map +1 -0
  261. package/dist/typescript/module/features/translation/model/TranslationPreprocessor.d.ts +34 -0
  262. package/dist/typescript/module/features/translation/model/TranslationPreprocessor.d.ts.map +1 -0
  263. package/dist/typescript/module/features/translation/model/TranslationService.d.ts +40 -0
  264. package/dist/typescript/module/features/translation/model/TranslationService.d.ts.map +1 -0
  265. package/dist/typescript/module/features/translation/preserve/wordsToPreserve.d.ts +3 -0
  266. package/dist/typescript/module/features/translation/preserve/wordsToPreserve.d.ts.map +1 -0
  267. package/dist/typescript/module/features/translation/providers/google/GoogleTranslationProvider.d.ts +17 -0
  268. package/dist/typescript/module/features/translation/providers/google/GoogleTranslationProvider.d.ts.map +1 -0
  269. package/dist/typescript/module/features/translation/providers/google/supportedLanguages.d.ts +209 -0
  270. package/dist/typescript/module/features/translation/providers/google/supportedLanguages.d.ts.map +1 -0
  271. package/dist/typescript/module/features/translation/providers/google.types.d.ts +15 -0
  272. package/dist/typescript/module/features/translation/providers/google.types.d.ts.map +1 -0
  273. package/dist/typescript/module/features/translation/providers/translation.interface.d.ts +30 -0
  274. package/dist/typescript/module/features/translation/providers/translation.interface.d.ts.map +1 -0
  275. package/dist/typescript/module/features/translation/types.d.ts +27 -0
  276. package/dist/typescript/module/features/translation/types.d.ts.map +1 -0
  277. package/dist/typescript/module/features/voice/index.d.ts +3 -1
  278. package/dist/typescript/module/features/voice/index.d.ts.map +1 -1
  279. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptContent.d.ts +8 -0
  280. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptContent.d.ts.map +1 -0
  281. package/dist/typescript/module/features/voice/playing/components/VoiceTranscription.d.ts +16 -0
  282. package/dist/typescript/module/features/voice/playing/components/VoiceTranscription.d.ts.map +1 -0
  283. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts +10 -0
  284. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts.map +1 -0
  285. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts +12 -0
  286. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts.map +1 -0
  287. package/dist/typescript/module/features/voice/playing/hooks/{useVoiceTranscriptionsDropdown.d.ts → useDropdownAnimation.d.ts} +3 -3
  288. package/dist/typescript/module/features/voice/playing/hooks/useDropdownAnimation.d.ts.map +1 -0
  289. package/dist/typescript/module/features/voice/playing/hooks/useVoicePlayerLifecycle.d.ts +15 -0
  290. package/dist/typescript/module/features/voice/playing/hooks/useVoicePlayerLifecycle.d.ts.map +1 -0
  291. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionController.d.ts +30 -0
  292. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionController.d.ts.map +1 -0
  293. package/dist/typescript/{commonjs/features/voice/playing/model/VoiceTranscriptionsDropdown.model.d.ts → module/features/voice/playing/model/Dropdown.model.d.ts} +2 -2
  294. package/dist/typescript/module/features/voice/playing/model/Dropdown.model.d.ts.map +1 -0
  295. package/dist/typescript/module/features/voice/playing/model/PlaybackController.d.ts +28 -0
  296. package/dist/typescript/module/features/voice/playing/model/PlaybackController.d.ts.map +1 -0
  297. package/dist/typescript/module/features/voice/playing/model/Player.model.d.ts +4 -0
  298. package/dist/typescript/module/features/voice/playing/model/Player.model.d.ts.map +1 -1
  299. package/dist/typescript/{commonjs/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts → module/features/voice/playing/model/TranscriptionsCollection.d.ts} +2 -2
  300. package/dist/typescript/module/features/voice/playing/model/TranscriptionsCollection.d.ts.map +1 -0
  301. package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloader.model.d.ts +19 -0
  302. package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloader.model.d.ts.map +1 -0
  303. package/dist/typescript/module/features/voice/playing/model/Translation.model.d.ts +25 -0
  304. package/dist/typescript/module/features/voice/playing/model/Translation.model.d.ts.map +1 -0
  305. package/dist/typescript/module/features/voice/playing/model/VoiceFileDownloader.model.d.ts +2 -2
  306. package/dist/typescript/module/features/voice/playing/model/VoiceFileDownloader.model.d.ts.map +1 -1
  307. package/dist/typescript/module/features/voice/playing/model/VoicePlayer.model.d.ts +19 -18
  308. package/dist/typescript/module/features/voice/playing/model/VoicePlayer.model.d.ts.map +1 -1
  309. package/dist/typescript/module/features/voice/types.d.ts +14 -2
  310. package/dist/typescript/module/features/voice/types.d.ts.map +1 -1
  311. package/dist/typescript/module/index.d.ts +1 -0
  312. package/dist/typescript/module/index.d.ts.map +1 -1
  313. package/package.json +37 -10
  314. package/src/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.tsx +2 -9
  315. package/src/features/fluency/components/Fluency.tsx +9 -17
  316. package/src/features/fluency/components/select-math-operator/SelectMathOperator.tsx +5 -13
  317. package/src/features/fluency/model/FluencyModel.ts +1 -25
  318. package/src/features/fluency/shared/fluency.constants.ts +0 -5
  319. package/src/features/fluency/shared/fluency.helpers.ts +0 -3
  320. package/src/features/pmProgress/model/PmProgressModel.ts +1 -4
  321. package/src/features/pmProgress/model/PmRecommendationsModel.ts +6 -22
  322. package/src/features/pmProgress/shared/pmProgress.helpers.ts +0 -33
  323. package/src/features/translation/constants.ts +4 -0
  324. package/src/features/translation/helpers.ts +63 -0
  325. package/src/features/translation/index.ts +30 -0
  326. package/src/features/translation/model/TranslationModel.ts +174 -0
  327. package/src/features/translation/model/TranslationPreprocessor.ts +171 -0
  328. package/src/features/translation/model/TranslationService.ts +148 -0
  329. package/src/features/translation/preserve/wordsToPreserve.ts +87 -0
  330. package/src/features/translation/providers/google/GoogleTranslationProvider.ts +50 -0
  331. package/src/features/translation/providers/google/supportedLanguages.ts +229 -0
  332. package/src/features/translation/providers/google.types.ts +16 -0
  333. package/src/features/translation/providers/translation.interface.ts +63 -0
  334. package/src/features/translation/types.ts +30 -0
  335. package/src/features/voice/index.ts +3 -1
  336. package/src/features/voice/playing/components/VoiceIcon.tsx +2 -2
  337. package/src/features/voice/playing/components/VoiceTranscriptContent.tsx +44 -0
  338. package/src/features/voice/playing/components/VoiceTranscription.tsx +117 -0
  339. package/src/features/voice/playing/components/VoiceTranscriptionCollapsible.tsx +59 -0
  340. package/src/features/voice/playing/components/VoiceTranscriptionHeaderActions.tsx +61 -0
  341. package/src/features/voice/playing/hooks/{useVoiceTranscriptionsDropdown.ts → useDropdownAnimation.ts} +5 -5
  342. package/src/features/voice/playing/hooks/useVoicePlayerLifecycle.ts +64 -0
  343. package/src/features/voice/playing/hooks/useVoiceTranscriptionController.ts +148 -0
  344. package/src/features/voice/playing/model/{VoiceTranscriptionsDropdown.model.ts → Dropdown.model.ts} +2 -2
  345. package/src/features/voice/playing/model/PlaybackController.ts +221 -0
  346. package/src/features/voice/playing/model/Player.model.ts +52 -4
  347. package/src/features/voice/playing/model/{VoiceTranscriptionsCollection.ts → TranscriptionsCollection.ts} +1 -1
  348. package/src/features/voice/playing/model/TranscriptionsDownloader.model.ts +88 -0
  349. package/src/features/voice/playing/model/Translation.model.ts +75 -0
  350. package/src/features/voice/playing/model/VoiceFileDownloader.model.ts +2 -2
  351. package/src/features/voice/playing/model/VoicePlayer.model.ts +68 -192
  352. package/src/features/voice/recording/components/VoiceRecordDivider.tsx +2 -2
  353. package/src/features/voice/types.ts +21 -1
  354. package/src/i18n/.generated/schema.json +3 -7
  355. package/src/index.ts +1 -0
  356. package/dist/commonjs/features/fluency/components/FluencyStatusOverlay.js +0 -101
  357. package/dist/commonjs/features/fluency/components/FluencyStatusOverlay.js.map +0 -1
  358. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.js +0 -245
  359. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.js.map +0 -1
  360. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js +0 -109
  361. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js.map +0 -1
  362. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.js.map +0 -1
  363. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.js +0 -34
  364. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.js.map +0 -1
  365. package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.js +0 -66
  366. package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.js.map +0 -1
  367. package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionsCollection.js.map +0 -1
  368. package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionsDropdown.model.js.map +0 -1
  369. package/dist/module/features/fluency/components/FluencyStatusOverlay.js +0 -95
  370. package/dist/module/features/fluency/components/FluencyStatusOverlay.js.map +0 -1
  371. package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdown.js +0 -238
  372. package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdown.js.map +0 -1
  373. package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js +0 -103
  374. package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js.map +0 -1
  375. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.js.map +0 -1
  376. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.js +0 -29
  377. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.js.map +0 -1
  378. package/dist/module/features/voice/playing/model/TranscriptionsDownloaderModel.js +0 -61
  379. package/dist/module/features/voice/playing/model/TranscriptionsDownloaderModel.js.map +0 -1
  380. package/dist/module/features/voice/playing/model/VoiceTranscriptionsCollection.js.map +0 -1
  381. package/dist/module/features/voice/playing/model/VoiceTranscriptionsDropdown.model.js.map +0 -1
  382. package/dist/typescript/commonjs/features/fluency/components/FluencyStatusOverlay.d.ts +0 -8
  383. package/dist/typescript/commonjs/features/fluency/components/FluencyStatusOverlay.d.ts.map +0 -1
  384. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts +0 -16
  385. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts.map +0 -1
  386. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdownItem.d.ts +0 -12
  387. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdownItem.d.ts.map +0 -1
  388. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.d.ts.map +0 -1
  389. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.d.ts +0 -11
  390. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.d.ts.map +0 -1
  391. package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts +0 -15
  392. package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts.map +0 -1
  393. package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts.map +0 -1
  394. package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionsDropdown.model.d.ts.map +0 -1
  395. package/dist/typescript/module/features/fluency/components/FluencyStatusOverlay.d.ts +0 -8
  396. package/dist/typescript/module/features/fluency/components/FluencyStatusOverlay.d.ts.map +0 -1
  397. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts +0 -16
  398. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts.map +0 -1
  399. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionsDropdownItem.d.ts +0 -12
  400. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionsDropdownItem.d.ts.map +0 -1
  401. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.d.ts.map +0 -1
  402. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.d.ts +0 -11
  403. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.d.ts.map +0 -1
  404. package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts +0 -15
  405. package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts.map +0 -1
  406. package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts.map +0 -1
  407. package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionsDropdown.model.d.ts.map +0 -1
  408. package/src/features/fluency/components/FluencyStatusOverlay.tsx +0 -101
  409. package/src/features/voice/playing/components/VoiceTranscriptionsDropdown.tsx +0 -296
  410. package/src/features/voice/playing/components/VoiceTranscriptionsDropdownItem.tsx +0 -128
  411. package/src/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.ts +0 -40
  412. package/src/features/voice/playing/model/TranscriptionsDownloaderModel.ts +0 -80
@@ -1,29 +1,27 @@
1
- import { attach, createEffect, createEvent, restore } from 'effector'
2
- import { VoiceTranscriptionsCollection } from './VoiceTranscriptionsCollection'
1
+ import { createEvent, restore } from 'effector'
2
+ import { TranscriptionsCollection } from './TranscriptionsCollection'
3
3
  import { VoiceFileDownloaderModel } from './VoiceFileDownloader.model'
4
- import { VoiceTranscriptionsDropdownModel } from './VoiceTranscriptionsDropdown.model'
4
+ import { DropdownModel } from './Dropdown.model'
5
+ import { TranslationModel } from './Translation.model'
5
6
  import { AnswerAudio, VoicePlayerApi, VoiceTranscriptionItem } from '../../types'
6
- import { PlayerModel, PlayerState } from './Player.model'
7
- import { TranscriptionsDownloaderModel } from './TranscriptionsDownloaderModel'
7
+ import { PlayerModel } from './Player.model'
8
+ import { TranscriptionsDownloaderModel } from './TranscriptionsDownloader.model'
9
+ import { PlaybackController } from './PlaybackController'
8
10
 
9
- type VoiceTranscriptionsPlayerModelParams = {
11
+ type VoicePlayerModelParams = {
10
12
  api: VoicePlayerApi
11
13
  audios?: AnswerAudio[]
12
14
  }
13
- type TogglePlayPauseParams = {
14
- attemptNumber: number
15
- playerState: PlayerState
16
- }
17
15
 
18
16
  export class VoicePlayerModel {
19
- public readonly collection = new VoiceTranscriptionsCollection()
20
- public readonly downloader = new VoiceFileDownloaderModel()
21
- public readonly dropdown = new VoiceTranscriptionsDropdownModel()
17
+ public readonly collection = new TranscriptionsCollection()
18
+ public readonly dropdown = new DropdownModel()
22
19
  public readonly playerModel = new PlayerModel()
20
+ public readonly downloader: VoiceFileDownloaderModel
21
+ public readonly translation: TranslationModel
23
22
  public readonly loader: TranscriptionsDownloaderModel
24
23
  public readonly api: VoicePlayerApi
25
- private currentPlayingAttempt: number | null = null
26
- private shouldPreventPlayback = false
24
+ private readonly playback: PlaybackController
27
25
 
28
26
  public readonly setCurrentAttempt = createEvent<number | null>()
29
27
  public readonly reset = createEvent()
@@ -32,33 +30,21 @@ export class VoicePlayerModel {
32
30
  public readonly $playerState = this.playerModel.$playerState
33
31
 
34
32
  public readonly pauseAudio = this.playerModel.pause
33
+ public readonly seekAudio = this.playerModel.seek
35
34
 
36
- public readonly stopAudio = () => {
37
- this.shouldPreventPlayback = true
38
- this.abortAllDownloads()
39
- this.playerModel.stop()
40
- this.currentPlayingAttempt = null
41
- this.setCurrentAttempt(null)
42
- }
43
-
44
- public readonly resetPlayer = () => {
45
- this.shouldPreventPlayback = true
46
- this.releaseCollectionResources()
47
- this.playerModel.stop()
48
- this.currentPlayingAttempt = null
49
- this.setCurrentAttempt(null)
50
- this.collection.clear()
51
- }
35
+ public readonly togglePlayPause: PlaybackController['togglePlayPause']
52
36
 
53
- constructor(params: VoiceTranscriptionsPlayerModelParams) {
37
+ constructor(params: VoicePlayerModelParams) {
54
38
  this.api = params.api
39
+ this.downloader = new VoiceFileDownloaderModel(params.api)
55
40
  this.loader = new TranscriptionsDownloaderModel(this.collection, params.api)
56
- this.downloader.setApi(params.api)
57
-
58
- this.playerModel.playbackFinished.watch(() => {
59
- this.currentPlayingAttempt = null
60
- this.setCurrentAttempt(null)
41
+ this.translation = new TranslationModel(this.collection, params.api)
42
+ this.playback = new PlaybackController({
43
+ collection: this.collection,
44
+ player: this.playerModel,
45
+ downloader: this.downloader,
61
46
  })
47
+ this.togglePlayPause = this.playback.togglePlayPause
62
48
 
63
49
  if (params.audios) {
64
50
  this.initializeCollectionFromAudios(params.audios)
@@ -67,157 +53,40 @@ export class VoicePlayerModel {
67
53
  this.playerModel.setupAudioMode()
68
54
  }
69
55
 
70
- public initializeWithAudios(answerAudio: AnswerAudio[]) {
71
- this.loader.setTranscriptsLoaded(false)
72
- this.collection.clear()
73
- this.initializeCollectionFromAudios(answerAudio)
56
+ public readonly stopAudio = () => {
57
+ this.playback.halt()
74
58
  }
75
59
 
76
- private initializeCollectionFromAudios(audios: AnswerAudio[]) {
77
- if (!audios) {
78
- console.warn('VoicePlayerModel: audios is not provided')
79
- return
80
- }
81
- audios.forEach((audio, index) => {
82
- const attemptNumber = index + 1
83
- if (!audio.audioFileId) {
84
- console.warn('VoicePlayerModel: audioFileId is missing for audio', audio)
85
- return
86
- }
87
- this.collection.add(attemptNumber, {
88
- attemptNumber,
89
- audioFileId: audio.audioFileId,
90
- _id: audio._id,
91
- hasDrawing: !!audio.drawing,
92
- })
93
- })
60
+ public readonly preloadAudio = (attemptNumber?: number) => {
61
+ const target = attemptNumber ?? this.$currentAttempt.getState()
62
+ if (target === null) return
63
+ return this.playback.preloadAudio(target)
94
64
  }
95
65
 
96
- private releaseCollectionResources() {
97
- this.collection.getAll().forEach((item) => {
98
- if (item.controller) {
99
- this.downloader.abortDownload(item.controller)
100
- }
101
- if (item.audioUri?.startsWith('blob:')) {
102
- try {
103
- URL.revokeObjectURL(item.audioUri)
104
- } catch (e) {}
105
- }
106
- })
66
+ public readonly resetPlayer = () => {
67
+ this.playback.releaseResources()
68
+ this.playback.halt()
69
+ this.collection.clear()
70
+ this.translation.clearCache()
107
71
  }
108
72
 
109
- private abortAllDownloads() {
110
- this.collection.getAll().forEach((item) => {
111
- if (item.controller && item.audioLoading) {
112
- this.downloader.abortDownload(item.controller)
113
- this.collection.update(item.attemptNumber, {
114
- audioLoading: false,
115
- controller: undefined,
116
- audioDownloadPromise: undefined,
117
- })
118
- }
119
- })
73
+ public initializeWithAudios(answerAudio: AnswerAudio[]) {
74
+ // Skip clear+rebuild when content matches — re-init mid-playback drops audioUri and races with in-flight togglePlayPause.
75
+ if (this.collectionMatchesAudios(answerAudio)) return
76
+ this.collection.clear()
77
+ this.initializeCollectionFromAudios(answerAudio)
120
78
  }
121
79
 
122
- private readonly handlePlayAttempt = createEffect(async (attemptNumber: number) => {
123
- this.shouldPreventPlayback = false
124
- const item = this.collection.get(attemptNumber)
125
- if (!item) return
126
-
127
- if (this.currentPlayingAttempt !== null && this.currentPlayingAttempt !== attemptNumber) {
128
- this.abortAllDownloads()
129
- }
130
-
131
- if (this.collection.hasAudio(attemptNumber)) {
132
- this.playAudioFx(attemptNumber)
133
- return
134
- }
135
-
136
- try {
137
- this.playerModel.setPlayerState(PlayerState.LOADING)
138
- const { collectionItem, downloadPromise } = await this.downloader.download({
139
- audioFileId: item.audioFileId,
140
- attemptNumber,
141
- })
142
-
143
- if (this.shouldPreventPlayback) {
144
- collectionItem.controller?.abort()
145
- return
146
- }
147
-
148
- this.collection.update(attemptNumber, collectionItem)
149
-
150
- const result = await downloadPromise
151
-
152
- if (this.shouldPreventPlayback) {
153
- if (result.uri?.startsWith('blob:')) {
154
- URL.revokeObjectURL(result.uri)
155
- }
156
- return
157
- }
158
-
159
- this.collection.update(attemptNumber, {
160
- audioUri: result.uri,
161
- audioLoading: false,
162
- audioError: undefined,
163
- controller: undefined,
164
- audioDownloadPromise: undefined,
165
- })
166
-
167
- this.playerModel.setPlayerState(PlayerState.IDLE)
168
- this.playAudioFx(attemptNumber)
169
- } catch (error) {
170
- console.error('Audio download error:', error)
171
- if (error instanceof Error && error.name === 'AbortError') {
172
- this.playerModel.setPlayerState(PlayerState.IDLE)
173
- return
174
- }
175
-
176
- this.collection.update(attemptNumber, {
177
- audioLoading: false,
178
- audioError: error instanceof Error ? error.message : 'Failed to download audio',
179
- controller: undefined,
180
- audioDownloadPromise: undefined,
181
- })
182
- }
183
- })
184
-
185
- private playAudioFx = createEffect(async (attemptNumber: number) => {
186
- if (this.shouldPreventPlayback) return
187
-
188
- const item = this.collection.get(attemptNumber)
189
- if (!item?.audioUri) {
190
- console.warn('No audio URI available for attempt:', attemptNumber)
191
- return
80
+ private collectionMatchesAudios(audios: AnswerAudio[]): boolean {
81
+ for (let i = 0; i < audios.length; i++) {
82
+ const audio = audios[i]
83
+ if (!audio.audioFileId) continue
84
+ const attemptNumber = i + 1
85
+ const existing = this.collection.get(attemptNumber)
86
+ if (!existing || existing.audioFileId !== audio.audioFileId) return false
192
87
  }
193
-
194
- try {
195
- if (this.currentPlayingAttempt !== null && this.currentPlayingAttempt !== attemptNumber) {
196
- this.playerModel.player?.remove()
197
- }
198
-
199
- if (this.currentPlayingAttempt === attemptNumber && this.playerModel.player?.playing) {
200
- this.playerModel.pause()
201
- return
202
- }
203
-
204
- if (this.currentPlayingAttempt === attemptNumber && !this.playerModel.player?.playing) {
205
- this.playerModel.resume()
206
- return
207
- }
208
-
209
- this.currentPlayingAttempt = attemptNumber
210
- this.setCurrentAttempt(attemptNumber)
211
- await this.playerModel.play(item.audioUri)
212
- } catch (error) {
213
- console.error('Error playing audio:', error)
214
- this.playerModel.setPlayerState(PlayerState.IDLE)
215
-
216
- this.collection.update(attemptNumber, {
217
- audioError: error instanceof Error ? error.message : 'Failed to play audio',
218
- })
219
- }
220
- })
88
+ return true
89
+ }
221
90
 
222
91
  public isAudioLoading(attemptNumber: number): boolean {
223
92
  return this.collection.get(attemptNumber)?.audioLoading || false
@@ -232,24 +101,31 @@ export class VoicePlayerModel {
232
101
  }
233
102
 
234
103
  public cleanup() {
235
- this.releaseCollectionResources()
104
+ this.playback.releaseResources()
236
105
  this.collection.clear()
237
- this.currentPlayingAttempt = null
238
106
  this.reset()
239
- this.loader.reset()
240
107
  this.dropdown.reset()
108
+ this.translation.reset()
241
109
  this.playerModel.release()
242
110
  }
243
111
 
244
- public togglePlayPause = attach({
245
- source: this.playerModel.$playerState,
246
- mapParams: (attemptNumber: number, playerState) => ({ attemptNumber, playerState }),
247
- effect: createEffect(({ attemptNumber, playerState }: TogglePlayPauseParams) => {
248
- if (this.currentPlayingAttempt === attemptNumber && playerState === PlayerState.PLAYING) {
249
- this.pauseAudio()
250
- } else {
251
- this.handlePlayAttempt(attemptNumber)
112
+ private initializeCollectionFromAudios(audios: AnswerAudio[]) {
113
+ if (!audios) {
114
+ console.warn('VoicePlayerModel: audios is not provided')
115
+ return
116
+ }
117
+ audios.forEach((audio, index) => {
118
+ const attemptNumber = index + 1
119
+ if (!audio.audioFileId) {
120
+ console.warn('VoicePlayerModel: audioFileId is missing for audio', audio)
121
+ return
252
122
  }
253
- }),
254
- })
123
+ this.collection.add(attemptNumber, {
124
+ attemptNumber,
125
+ audioFileId: audio.audioFileId,
126
+ _id: audio._id,
127
+ hasDrawing: !!audio.drawing,
128
+ })
129
+ })
130
+ }
255
131
  }
@@ -1,6 +1,6 @@
1
1
  import { StyleSheet, View } from 'react-native'
2
2
  import React from 'react'
3
- import { COLORS } from '@magmamath/react-native-ui'
3
+ import { COLORS, SPACING } from '@magmamath/react-native-ui'
4
4
 
5
5
  export const VoiceRecordDivider = () => {
6
6
  return <View style={styles.container} />
@@ -11,7 +11,7 @@ const styles = StyleSheet.create({
11
11
  height: 1,
12
12
  borderRadius: 1,
13
13
  width: 28,
14
- margin: 8,
14
+ margin: SPACING[200],
15
15
  backgroundColor: COLORS.NEUTRAL_6,
16
16
  },
17
17
  })
@@ -2,6 +2,12 @@ import { WithAbortSignal } from 'src/types/common.types'
2
2
  import { getAvailableInputs } from './helpers'
3
3
  import { VoiceRecordModel } from './recording/model/VoiceRecord.model'
4
4
  import { AxiosResponse } from 'axios'
5
+ import type {
6
+ GoogleTranslateProps as GoogleTranslatePayload,
7
+ GoogleTranslateResponse,
8
+ } from '../translation/providers/google.types'
9
+
10
+ export type { GoogleTranslatePayload, GoogleTranslateResponse }
5
11
 
6
12
  export type VoiceRecordNotificationTypes = {
7
13
  success: (message: string) => void
@@ -54,9 +60,15 @@ export type VoiceRecorderApi = {
54
60
  deleteAudioFile: (audioFileId: string) => Promise<void>
55
61
  }
56
62
 
57
- type TranscriptionStatus = 'pending' | 'completed' | 'failed'
63
+ export enum TranscriptionStatus {
64
+ PENDING = 'pending',
65
+ COMPLETED = 'completed',
66
+ FAILED = 'failed',
67
+ }
68
+
58
69
  export type AudioTranscriptResponse = {
59
70
  text: string
71
+ language: string
60
72
  status: TranscriptionStatus
61
73
  }
62
74
 
@@ -66,6 +78,7 @@ export type VoicePlayerApi = {
66
78
  audioFileId: string,
67
79
  options?: { signal?: AbortSignal },
68
80
  ) => Promise<AxiosResponse<Blob>>
81
+ translateText: (payload: GoogleTranslatePayload) => Promise<GoogleTranslateResponse>
69
82
  }
70
83
 
71
84
  export type VoiceTranscriptionItem = {
@@ -73,6 +86,7 @@ export type VoiceTranscriptionItem = {
73
86
  audioFileId: string
74
87
  _id: string
75
88
  transcript?: string
89
+ transcriptLanguage?: string
76
90
  transcriptLoading?: boolean
77
91
  transcriptError?: string
78
92
  audioUri?: string
@@ -87,3 +101,9 @@ export enum RecordButtonVariant {
87
101
  DEFAULT = 'default',
88
102
  ADVANCED = 'advanced',
89
103
  }
104
+
105
+ export enum VoiceTranscriptionVariant {
106
+ SMALL = 'small',
107
+ LARGE = 'large',
108
+ }
109
+
@@ -35,7 +35,7 @@
35
35
  "allLockedTitle": "All grades are locked",
36
36
  "allTime": "All time",
37
37
  "andMore": "and {{ count }} more...",
38
- "fluency": "Fluency",
38
+ "fluency": "Fact Fluency",
39
39
  "grade": "Grade",
40
40
  "gradeK": "K",
41
41
  "gradeOther": "Other",
@@ -59,18 +59,14 @@
59
59
  "addition": "Addition",
60
60
  "cardsReady": "individualized facts ready",
61
61
  "claimProgress": "Claim progress",
62
- "correct": "Correct!",
62
+ "correct": "Correct! ",
63
63
  "dayFriday": "F",
64
64
  "dayMonday": "M",
65
65
  "dayThursday": "T",
66
66
  "dayTuesday": "T",
67
67
  "dayWednesday": "W",
68
68
  "division": "Division",
69
- "emptySubtitle": "Ask your teacher to set up your fluency practice.",
70
- "emptyTitle": "No facts to practice yet",
71
69
  "enter": "Submit",
72
- "errorSubtitle": "We couldn't load your progress.\nPlease try again later.",
73
- "errorTitle": "Something went wrong",
74
70
  "fast": "Fast!",
75
71
  "incorrect": "INCORRECT — ANSWER: {{answer}}",
76
72
  "masteryGrowing": "Growing",
@@ -97,7 +93,7 @@
97
93
  },
98
94
  "teacher": {
99
95
  "fluency": {
100
- "allPupils": "All pupils",
96
+ "allPupils": "All students",
101
97
  "average": "Average",
102
98
  "avgTimeTitle": "Avg Time / Student",
103
99
  "factFluency": "Fact Fluency",
package/src/index.ts CHANGED
@@ -16,3 +16,4 @@ export * from './features/featureUsage'
16
16
  export * from './features/uiMode'
17
17
  export * from './features/fluency'
18
18
  export * from './features/fluency-teacher'
19
+ export * from './features/translation'
@@ -1,101 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.FluencyStatusOverlay = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _reactNative = require("react-native");
9
- var _reactNativeUi = require("@magmamath/react-native-ui");
10
- var _fluencyConstants = require("../shared/fluency.constants.js");
11
- var _i18n = require("../../../i18n/i18n.js");
12
- var _jsxRuntime = require("react/jsx-runtime");
13
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
- const FLUENCY_STATUS_VARIANTS = {
15
- [_fluencyConstants.FluencyStatus.ERROR]: {
16
- icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeUi.ErrorIcon, {
17
- color: _reactNativeUi.COLORS.PRIMARY_RED,
18
- size: 40
19
- }),
20
- circleColor: _reactNativeUi.COLORS.RED_1,
21
- titleKey: 'student.fluency.errorTitle',
22
- subtitleKey: 'student.fluency.errorSubtitle'
23
- },
24
- [_fluencyConstants.FluencyStatus.EMPTY]: {
25
- icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeUi.InfoIcon, {
26
- color: _reactNativeUi.COLORS.NEUTRAL_6,
27
- size: 40
28
- }),
29
- circleColor: _reactNativeUi.COLORS.NEUTRAL_2,
30
- titleKey: 'student.fluency.emptyTitle',
31
- subtitleKey: 'student.fluency.emptySubtitle'
32
- }
33
- };
34
- const FluencyStatusOverlay = ({
35
- status
36
- }) => {
37
- const t = (0, _i18n.useText)();
38
- const variant = FLUENCY_STATUS_VARIANTS[status];
39
- if (!variant) return null;
40
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
41
- style: styles.container,
42
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
43
- style: styles.content,
44
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
45
- style: [styles.iconCircle, {
46
- backgroundColor: variant.circleColor
47
- }],
48
- children: variant.icon
49
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
50
- style: styles.text,
51
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeUi.Typography, {
52
- variant: _reactNativeUi.HeadingVariants.H2,
53
- style: styles.title,
54
- children: t(variant.titleKey)
55
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeUi.Typography, {
56
- variant: _reactNativeUi.HeadingVariants.H7,
57
- style: styles.subtitle,
58
- children: t(variant.subtitleKey)
59
- })]
60
- })]
61
- })
62
- });
63
- };
64
- exports.FluencyStatusOverlay = FluencyStatusOverlay;
65
- const styles = _reactNative.StyleSheet.create({
66
- container: {
67
- flex: 1,
68
- alignItems: 'center',
69
- justifyContent: 'center'
70
- },
71
- content: {
72
- alignItems: 'center',
73
- gap: _reactNativeUi.SPACING[500],
74
- paddingBottom: _reactNativeUi.SPACING[800]
75
- },
76
- iconCircle: {
77
- width: 88,
78
- height: 88,
79
- borderRadius: 44,
80
- alignItems: 'center',
81
- justifyContent: 'center'
82
- },
83
- text: {
84
- alignItems: 'center',
85
- gap: _reactNativeUi.SPACING[200],
86
- maxWidth: 340
87
- },
88
- title: {
89
- color: _reactNativeUi.COLORS.NEUTRAL_9,
90
- textAlign: 'center',
91
- fontSize: 24,
92
- fontWeight: '500'
93
- },
94
- subtitle: {
95
- color: _reactNativeUi.COLORS.NEUTRAL_7,
96
- textAlign: 'center',
97
- fontSize: 16,
98
- fontWeight: '400'
99
- }
100
- });
101
- //# sourceMappingURL=FluencyStatusOverlay.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_reactNativeUi","_fluencyConstants","_i18n","_jsxRuntime","e","__esModule","default","FLUENCY_STATUS_VARIANTS","FluencyStatus","ERROR","icon","jsx","ErrorIcon","color","COLORS","PRIMARY_RED","size","circleColor","RED_1","titleKey","subtitleKey","EMPTY","InfoIcon","NEUTRAL_6","NEUTRAL_2","FluencyStatusOverlay","status","t","useText","variant","View","style","styles","container","children","jsxs","content","iconCircle","backgroundColor","text","Typography","HeadingVariants","H2","title","H7","subtitle","exports","StyleSheet","create","flex","alignItems","justifyContent","gap","SPACING","paddingBottom","width","height","borderRadius","maxWidth","NEUTRAL_9","textAlign","fontSize","fontWeight","NEUTRAL_7"],"sourceRoot":"../../../../../src","sources":["features/fluency/components/FluencyStatusOverlay.tsx"],"mappings":"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","ignoreList":[]}