@magmamath/students-features 1.3.23-rc.21 → 1.3.23-rc.3

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 (282) hide show
  1. package/dist/commonjs/features/voice/playing/components/VoiceTranscription.js +48 -39
  2. package/dist/commonjs/features/voice/playing/components/VoiceTranscription.js.map +1 -1
  3. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.js +2 -2
  4. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.js.map +1 -1
  5. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.js +8 -7
  6. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.js.map +1 -1
  7. package/dist/commonjs/features/voice/playing/hooks/{useDropdownAnimation.js → useVoiceTranscription.js} +7 -8
  8. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscription.js.map +1 -0
  9. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionEffects.js +37 -0
  10. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionEffects.js.map +1 -0
  11. package/dist/commonjs/features/voice/playing/model/Player.model.js +1 -24
  12. package/dist/commonjs/features/voice/playing/model/Player.model.js.map +1 -1
  13. package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.js +66 -0
  14. package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.js.map +1 -0
  15. package/dist/commonjs/features/voice/playing/model/VoiceFileDownloader.model.js +2 -2
  16. package/dist/commonjs/features/voice/playing/model/VoiceFileDownloader.model.js.map +1 -1
  17. package/dist/commonjs/features/voice/playing/model/VoicePlayer.model.js +175 -46
  18. package/dist/commonjs/features/voice/playing/model/VoicePlayer.model.js.map +1 -1
  19. package/dist/commonjs/features/voice/playing/model/{Dropdown.model.js → VoiceTranscription.model.js} +4 -4
  20. package/dist/commonjs/features/voice/playing/model/VoiceTranscription.model.js.map +1 -0
  21. package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionTranslation.model.js +15 -0
  22. package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionTranslation.model.js.map +1 -0
  23. package/dist/commonjs/features/voice/playing/model/{TranscriptionsCollection.js → VoiceTranscriptionsCollection.js} +4 -4
  24. package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionsCollection.js.map +1 -0
  25. package/dist/commonjs/features/voice/types.js.map +1 -1
  26. package/dist/commonjs/index.js +0 -12
  27. package/dist/commonjs/index.js.map +1 -1
  28. package/dist/module/features/voice/playing/components/VoiceTranscription.js +47 -40
  29. package/dist/module/features/voice/playing/components/VoiceTranscription.js.map +1 -1
  30. package/dist/module/features/voice/playing/components/VoiceTranscriptionCollapsible.js +2 -2
  31. package/dist/module/features/voice/playing/components/VoiceTranscriptionCollapsible.js.map +1 -1
  32. package/dist/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.js +7 -8
  33. package/dist/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.js.map +1 -1
  34. package/dist/module/features/voice/playing/hooks/{useDropdownAnimation.js → useVoiceTranscription.js} +5 -6
  35. package/dist/module/features/voice/playing/hooks/useVoiceTranscription.js.map +1 -0
  36. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionEffects.js +32 -0
  37. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionEffects.js.map +1 -0
  38. package/dist/module/features/voice/playing/model/Player.model.js +1 -24
  39. package/dist/module/features/voice/playing/model/Player.model.js.map +1 -1
  40. package/dist/module/features/voice/playing/model/TranscriptionsDownloaderModel.js +61 -0
  41. package/dist/module/features/voice/playing/model/TranscriptionsDownloaderModel.js.map +1 -0
  42. package/dist/module/features/voice/playing/model/VoiceFileDownloader.model.js +2 -2
  43. package/dist/module/features/voice/playing/model/VoiceFileDownloader.model.js.map +1 -1
  44. package/dist/module/features/voice/playing/model/VoicePlayer.model.js +177 -48
  45. package/dist/module/features/voice/playing/model/VoicePlayer.model.js.map +1 -1
  46. package/dist/module/features/voice/playing/model/{Dropdown.model.js → VoiceTranscription.model.js} +2 -2
  47. package/dist/module/features/voice/playing/model/VoiceTranscription.model.js.map +1 -0
  48. package/dist/module/features/voice/playing/model/VoiceTranscriptionTranslation.model.js +10 -0
  49. package/dist/module/features/voice/playing/model/VoiceTranscriptionTranslation.model.js.map +1 -0
  50. package/dist/module/features/voice/playing/model/{TranscriptionsCollection.js → VoiceTranscriptionsCollection.js} +2 -2
  51. package/dist/module/features/voice/playing/model/VoiceTranscriptionsCollection.js.map +1 -0
  52. package/dist/module/features/voice/types.js.map +1 -1
  53. package/dist/module/index.js +0 -1
  54. package/dist/module/index.js.map +1 -1
  55. package/dist/typescript/commonjs/features/voice/index.d.ts +0 -1
  56. package/dist/typescript/commonjs/features/voice/index.d.ts.map +1 -1
  57. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscription.d.ts.map +1 -1
  58. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts +2 -2
  59. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts.map +1 -1
  60. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts.map +1 -1
  61. package/dist/typescript/commonjs/features/voice/playing/hooks/{useDropdownAnimation.d.ts → useVoiceTranscription.d.ts} +3 -3
  62. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscription.d.ts.map +1 -0
  63. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionEffects.d.ts +12 -0
  64. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionEffects.d.ts.map +1 -0
  65. package/dist/typescript/commonjs/features/voice/playing/model/Player.model.d.ts +0 -3
  66. package/dist/typescript/commonjs/features/voice/playing/model/Player.model.d.ts.map +1 -1
  67. package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts +15 -0
  68. package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts.map +1 -0
  69. package/dist/typescript/commonjs/features/voice/playing/model/VoiceFileDownloader.model.d.ts +2 -2
  70. package/dist/typescript/commonjs/features/voice/playing/model/VoiceFileDownloader.model.d.ts.map +1 -1
  71. package/dist/typescript/commonjs/features/voice/playing/model/VoicePlayer.model.d.ts +20 -18
  72. package/dist/typescript/commonjs/features/voice/playing/model/VoicePlayer.model.d.ts.map +1 -1
  73. package/dist/typescript/commonjs/features/voice/playing/model/{Dropdown.model.d.ts → VoiceTranscription.model.d.ts} +2 -2
  74. package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscription.model.d.ts.map +1 -0
  75. package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionTranslation.model.d.ts +7 -0
  76. package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionTranslation.model.d.ts.map +1 -0
  77. package/dist/typescript/{module/features/voice/playing/model/TranscriptionsCollection.d.ts → commonjs/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts} +2 -2
  78. package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts.map +1 -0
  79. package/dist/typescript/commonjs/features/voice/types.d.ts +1 -4
  80. package/dist/typescript/commonjs/features/voice/types.d.ts.map +1 -1
  81. package/dist/typescript/commonjs/index.d.ts +0 -1
  82. package/dist/typescript/commonjs/index.d.ts.map +1 -1
  83. package/dist/typescript/module/features/voice/index.d.ts +0 -1
  84. package/dist/typescript/module/features/voice/index.d.ts.map +1 -1
  85. package/dist/typescript/module/features/voice/playing/components/VoiceTranscription.d.ts.map +1 -1
  86. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts +2 -2
  87. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts.map +1 -1
  88. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts.map +1 -1
  89. package/dist/typescript/module/features/voice/playing/hooks/{useDropdownAnimation.d.ts → useVoiceTranscription.d.ts} +3 -3
  90. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscription.d.ts.map +1 -0
  91. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionEffects.d.ts +12 -0
  92. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionEffects.d.ts.map +1 -0
  93. package/dist/typescript/module/features/voice/playing/model/Player.model.d.ts +0 -3
  94. package/dist/typescript/module/features/voice/playing/model/Player.model.d.ts.map +1 -1
  95. package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts +15 -0
  96. package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts.map +1 -0
  97. package/dist/typescript/module/features/voice/playing/model/VoiceFileDownloader.model.d.ts +2 -2
  98. package/dist/typescript/module/features/voice/playing/model/VoiceFileDownloader.model.d.ts.map +1 -1
  99. package/dist/typescript/module/features/voice/playing/model/VoicePlayer.model.d.ts +20 -18
  100. package/dist/typescript/module/features/voice/playing/model/VoicePlayer.model.d.ts.map +1 -1
  101. package/dist/typescript/module/features/voice/playing/model/{Dropdown.model.d.ts → VoiceTranscription.model.d.ts} +2 -2
  102. package/dist/typescript/module/features/voice/playing/model/VoiceTranscription.model.d.ts.map +1 -0
  103. package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionTranslation.model.d.ts +7 -0
  104. package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionTranslation.model.d.ts.map +1 -0
  105. package/dist/typescript/{commonjs/features/voice/playing/model/TranscriptionsCollection.d.ts → module/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts} +2 -2
  106. package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts.map +1 -0
  107. package/dist/typescript/module/features/voice/types.d.ts +1 -4
  108. package/dist/typescript/module/features/voice/types.d.ts.map +1 -1
  109. package/dist/typescript/module/index.d.ts +0 -1
  110. package/dist/typescript/module/index.d.ts.map +1 -1
  111. package/package.json +1 -28
  112. package/src/features/voice/index.ts +0 -1
  113. package/src/features/voice/playing/components/VoiceTranscription.tsx +60 -43
  114. package/src/features/voice/playing/components/VoiceTranscriptionCollapsible.tsx +4 -4
  115. package/src/features/voice/playing/components/VoiceTranscriptionHeaderActions.tsx +9 -8
  116. package/src/features/voice/playing/hooks/{useDropdownAnimation.ts → useVoiceTranscription.ts} +5 -5
  117. package/src/features/voice/playing/hooks/useVoiceTranscriptionEffects.ts +44 -0
  118. package/src/features/voice/playing/model/Player.model.ts +1 -26
  119. package/src/features/voice/playing/model/TranscriptionsDownloaderModel.ts +80 -0
  120. package/src/features/voice/playing/model/VoiceFileDownloader.model.ts +2 -2
  121. package/src/features/voice/playing/model/VoicePlayer.model.ts +196 -56
  122. package/src/features/voice/playing/model/{Dropdown.model.ts → VoiceTranscription.model.ts} +1 -1
  123. package/src/features/voice/playing/model/VoiceTranscriptionTranslation.model.ts +11 -0
  124. package/src/features/voice/playing/model/{TranscriptionsCollection.ts → VoiceTranscriptionsCollection.ts} +1 -1
  125. package/src/features/voice/types.ts +0 -9
  126. package/src/index.ts +0 -1
  127. package/dist/commonjs/features/translation/constants.js +0 -11
  128. package/dist/commonjs/features/translation/constants.js.map +0 -1
  129. package/dist/commonjs/features/translation/helpers.js +0 -60
  130. package/dist/commonjs/features/translation/helpers.js.map +0 -1
  131. package/dist/commonjs/features/translation/index.js +0 -105
  132. package/dist/commonjs/features/translation/index.js.map +0 -1
  133. package/dist/commonjs/features/translation/model/TranslationModel.js +0 -122
  134. package/dist/commonjs/features/translation/model/TranslationModel.js.map +0 -1
  135. package/dist/commonjs/features/translation/model/TranslationPreprocessor.js +0 -142
  136. package/dist/commonjs/features/translation/model/TranslationPreprocessor.js.map +0 -1
  137. package/dist/commonjs/features/translation/model/TranslationService.js +0 -112
  138. package/dist/commonjs/features/translation/model/TranslationService.js.map +0 -1
  139. package/dist/commonjs/features/translation/preserve/wordsToPreserve.js +0 -314
  140. package/dist/commonjs/features/translation/preserve/wordsToPreserve.js.map +0 -1
  141. package/dist/commonjs/features/translation/providers/google/GoogleTranslationProvider.js +0 -50
  142. package/dist/commonjs/features/translation/providers/google/GoogleTranslationProvider.js.map +0 -1
  143. package/dist/commonjs/features/translation/providers/google/supportedLanguages.js +0 -230
  144. package/dist/commonjs/features/translation/providers/google/supportedLanguages.js.map +0 -1
  145. package/dist/commonjs/features/translation/providers/google.types.js +0 -2
  146. package/dist/commonjs/features/translation/providers/google.types.js.map +0 -1
  147. package/dist/commonjs/features/translation/providers/translation.interface.js +0 -49
  148. package/dist/commonjs/features/translation/providers/translation.interface.js.map +0 -1
  149. package/dist/commonjs/features/translation/types.js +0 -2
  150. package/dist/commonjs/features/translation/types.js.map +0 -1
  151. package/dist/commonjs/features/voice/playing/hooks/useDropdownAnimation.js.map +0 -1
  152. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionController.js +0 -128
  153. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionController.js.map +0 -1
  154. package/dist/commonjs/features/voice/playing/model/Dropdown.model.js.map +0 -1
  155. package/dist/commonjs/features/voice/playing/model/PlaybackController.js +0 -183
  156. package/dist/commonjs/features/voice/playing/model/PlaybackController.js.map +0 -1
  157. package/dist/commonjs/features/voice/playing/model/TranscriptionsCollection.js.map +0 -1
  158. package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloader.model.js +0 -82
  159. package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloader.model.js.map +0 -1
  160. package/dist/commonjs/features/voice/playing/model/Translation.model.js +0 -62
  161. package/dist/commonjs/features/voice/playing/model/Translation.model.js.map +0 -1
  162. package/dist/module/features/translation/constants.js +0 -7
  163. package/dist/module/features/translation/constants.js.map +0 -1
  164. package/dist/module/features/translation/helpers.js +0 -53
  165. package/dist/module/features/translation/helpers.js.map +0 -1
  166. package/dist/module/features/translation/index.js +0 -12
  167. package/dist/module/features/translation/index.js.map +0 -1
  168. package/dist/module/features/translation/model/TranslationModel.js +0 -117
  169. package/dist/module/features/translation/model/TranslationModel.js.map +0 -1
  170. package/dist/module/features/translation/model/TranslationPreprocessor.js +0 -137
  171. package/dist/module/features/translation/model/TranslationPreprocessor.js.map +0 -1
  172. package/dist/module/features/translation/model/TranslationService.js +0 -107
  173. package/dist/module/features/translation/model/TranslationService.js.map +0 -1
  174. package/dist/module/features/translation/preserve/wordsToPreserve.js +0 -310
  175. package/dist/module/features/translation/preserve/wordsToPreserve.js.map +0 -1
  176. package/dist/module/features/translation/providers/google/GoogleTranslationProvider.js +0 -45
  177. package/dist/module/features/translation/providers/google/GoogleTranslationProvider.js.map +0 -1
  178. package/dist/module/features/translation/providers/google/supportedLanguages.js +0 -225
  179. package/dist/module/features/translation/providers/google/supportedLanguages.js.map +0 -1
  180. package/dist/module/features/translation/providers/google.types.js +0 -2
  181. package/dist/module/features/translation/providers/google.types.js.map +0 -1
  182. package/dist/module/features/translation/providers/translation.interface.js +0 -44
  183. package/dist/module/features/translation/providers/translation.interface.js.map +0 -1
  184. package/dist/module/features/translation/types.js +0 -2
  185. package/dist/module/features/translation/types.js.map +0 -1
  186. package/dist/module/features/voice/playing/hooks/useDropdownAnimation.js.map +0 -1
  187. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionController.js +0 -123
  188. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionController.js.map +0 -1
  189. package/dist/module/features/voice/playing/model/Dropdown.model.js.map +0 -1
  190. package/dist/module/features/voice/playing/model/PlaybackController.js +0 -178
  191. package/dist/module/features/voice/playing/model/PlaybackController.js.map +0 -1
  192. package/dist/module/features/voice/playing/model/TranscriptionsCollection.js.map +0 -1
  193. package/dist/module/features/voice/playing/model/TranscriptionsDownloader.model.js +0 -77
  194. package/dist/module/features/voice/playing/model/TranscriptionsDownloader.model.js.map +0 -1
  195. package/dist/module/features/voice/playing/model/Translation.model.js +0 -57
  196. package/dist/module/features/voice/playing/model/Translation.model.js.map +0 -1
  197. package/dist/typescript/commonjs/features/translation/constants.d.ts +0 -5
  198. package/dist/typescript/commonjs/features/translation/constants.d.ts.map +0 -1
  199. package/dist/typescript/commonjs/features/translation/helpers.d.ts +0 -9
  200. package/dist/typescript/commonjs/features/translation/helpers.d.ts.map +0 -1
  201. package/dist/typescript/commonjs/features/translation/index.d.ts +0 -12
  202. package/dist/typescript/commonjs/features/translation/index.d.ts.map +0 -1
  203. package/dist/typescript/commonjs/features/translation/model/TranslationModel.d.ts +0 -33
  204. package/dist/typescript/commonjs/features/translation/model/TranslationModel.d.ts.map +0 -1
  205. package/dist/typescript/commonjs/features/translation/model/TranslationPreprocessor.d.ts +0 -34
  206. package/dist/typescript/commonjs/features/translation/model/TranslationPreprocessor.d.ts.map +0 -1
  207. package/dist/typescript/commonjs/features/translation/model/TranslationService.d.ts +0 -40
  208. package/dist/typescript/commonjs/features/translation/model/TranslationService.d.ts.map +0 -1
  209. package/dist/typescript/commonjs/features/translation/preserve/wordsToPreserve.d.ts +0 -3
  210. package/dist/typescript/commonjs/features/translation/preserve/wordsToPreserve.d.ts.map +0 -1
  211. package/dist/typescript/commonjs/features/translation/providers/google/GoogleTranslationProvider.d.ts +0 -17
  212. package/dist/typescript/commonjs/features/translation/providers/google/GoogleTranslationProvider.d.ts.map +0 -1
  213. package/dist/typescript/commonjs/features/translation/providers/google/supportedLanguages.d.ts +0 -209
  214. package/dist/typescript/commonjs/features/translation/providers/google/supportedLanguages.d.ts.map +0 -1
  215. package/dist/typescript/commonjs/features/translation/providers/google.types.d.ts +0 -15
  216. package/dist/typescript/commonjs/features/translation/providers/google.types.d.ts.map +0 -1
  217. package/dist/typescript/commonjs/features/translation/providers/translation.interface.d.ts +0 -30
  218. package/dist/typescript/commonjs/features/translation/providers/translation.interface.d.ts.map +0 -1
  219. package/dist/typescript/commonjs/features/translation/types.d.ts +0 -27
  220. package/dist/typescript/commonjs/features/translation/types.d.ts.map +0 -1
  221. package/dist/typescript/commonjs/features/voice/playing/hooks/useDropdownAnimation.d.ts.map +0 -1
  222. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionController.d.ts +0 -30
  223. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionController.d.ts.map +0 -1
  224. package/dist/typescript/commonjs/features/voice/playing/model/Dropdown.model.d.ts.map +0 -1
  225. package/dist/typescript/commonjs/features/voice/playing/model/PlaybackController.d.ts +0 -28
  226. package/dist/typescript/commonjs/features/voice/playing/model/PlaybackController.d.ts.map +0 -1
  227. package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsCollection.d.ts.map +0 -1
  228. package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloader.model.d.ts +0 -19
  229. package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloader.model.d.ts.map +0 -1
  230. package/dist/typescript/commonjs/features/voice/playing/model/Translation.model.d.ts +0 -25
  231. package/dist/typescript/commonjs/features/voice/playing/model/Translation.model.d.ts.map +0 -1
  232. package/dist/typescript/module/features/translation/constants.d.ts +0 -5
  233. package/dist/typescript/module/features/translation/constants.d.ts.map +0 -1
  234. package/dist/typescript/module/features/translation/helpers.d.ts +0 -9
  235. package/dist/typescript/module/features/translation/helpers.d.ts.map +0 -1
  236. package/dist/typescript/module/features/translation/index.d.ts +0 -12
  237. package/dist/typescript/module/features/translation/index.d.ts.map +0 -1
  238. package/dist/typescript/module/features/translation/model/TranslationModel.d.ts +0 -33
  239. package/dist/typescript/module/features/translation/model/TranslationModel.d.ts.map +0 -1
  240. package/dist/typescript/module/features/translation/model/TranslationPreprocessor.d.ts +0 -34
  241. package/dist/typescript/module/features/translation/model/TranslationPreprocessor.d.ts.map +0 -1
  242. package/dist/typescript/module/features/translation/model/TranslationService.d.ts +0 -40
  243. package/dist/typescript/module/features/translation/model/TranslationService.d.ts.map +0 -1
  244. package/dist/typescript/module/features/translation/preserve/wordsToPreserve.d.ts +0 -3
  245. package/dist/typescript/module/features/translation/preserve/wordsToPreserve.d.ts.map +0 -1
  246. package/dist/typescript/module/features/translation/providers/google/GoogleTranslationProvider.d.ts +0 -17
  247. package/dist/typescript/module/features/translation/providers/google/GoogleTranslationProvider.d.ts.map +0 -1
  248. package/dist/typescript/module/features/translation/providers/google/supportedLanguages.d.ts +0 -209
  249. package/dist/typescript/module/features/translation/providers/google/supportedLanguages.d.ts.map +0 -1
  250. package/dist/typescript/module/features/translation/providers/google.types.d.ts +0 -15
  251. package/dist/typescript/module/features/translation/providers/google.types.d.ts.map +0 -1
  252. package/dist/typescript/module/features/translation/providers/translation.interface.d.ts +0 -30
  253. package/dist/typescript/module/features/translation/providers/translation.interface.d.ts.map +0 -1
  254. package/dist/typescript/module/features/translation/types.d.ts +0 -27
  255. package/dist/typescript/module/features/translation/types.d.ts.map +0 -1
  256. package/dist/typescript/module/features/voice/playing/hooks/useDropdownAnimation.d.ts.map +0 -1
  257. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionController.d.ts +0 -30
  258. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionController.d.ts.map +0 -1
  259. package/dist/typescript/module/features/voice/playing/model/Dropdown.model.d.ts.map +0 -1
  260. package/dist/typescript/module/features/voice/playing/model/PlaybackController.d.ts +0 -28
  261. package/dist/typescript/module/features/voice/playing/model/PlaybackController.d.ts.map +0 -1
  262. package/dist/typescript/module/features/voice/playing/model/TranscriptionsCollection.d.ts.map +0 -1
  263. package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloader.model.d.ts +0 -19
  264. package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloader.model.d.ts.map +0 -1
  265. package/dist/typescript/module/features/voice/playing/model/Translation.model.d.ts +0 -25
  266. package/dist/typescript/module/features/voice/playing/model/Translation.model.d.ts.map +0 -1
  267. package/src/features/translation/constants.ts +0 -4
  268. package/src/features/translation/helpers.ts +0 -63
  269. package/src/features/translation/index.ts +0 -30
  270. package/src/features/translation/model/TranslationModel.ts +0 -174
  271. package/src/features/translation/model/TranslationPreprocessor.ts +0 -171
  272. package/src/features/translation/model/TranslationService.ts +0 -148
  273. package/src/features/translation/preserve/wordsToPreserve.ts +0 -87
  274. package/src/features/translation/providers/google/GoogleTranslationProvider.ts +0 -50
  275. package/src/features/translation/providers/google/supportedLanguages.ts +0 -229
  276. package/src/features/translation/providers/google.types.ts +0 -16
  277. package/src/features/translation/providers/translation.interface.ts +0 -63
  278. package/src/features/translation/types.ts +0 -30
  279. package/src/features/voice/playing/hooks/useVoiceTranscriptionController.ts +0 -171
  280. package/src/features/voice/playing/model/PlaybackController.ts +0 -213
  281. package/src/features/voice/playing/model/TranscriptionsDownloader.model.ts +0 -88
  282. package/src/features/voice/playing/model/Translation.model.ts +0 -75
@@ -1,213 +0,0 @@
1
- import { createEffect } from 'effector'
2
- import { PlayerModel, PlayerState } from './Player.model'
3
- import { TranscriptionsCollection } from './TranscriptionsCollection'
4
- import { VoiceFileDownloaderModel } from './VoiceFileDownloader.model'
5
-
6
- type PlaybackControllerDeps = {
7
- collection: TranscriptionsCollection
8
- player: PlayerModel
9
- downloader: VoiceFileDownloaderModel
10
- }
11
-
12
- export class PlaybackController {
13
- private readonly collection: TranscriptionsCollection
14
- private readonly player: PlayerModel
15
- private readonly downloader: VoiceFileDownloaderModel
16
- private currentPlayingAttempt: number | null = null
17
- private shouldPreventPlayback = false
18
-
19
- constructor(deps: PlaybackControllerDeps) {
20
- this.collection = deps.collection
21
- this.player = deps.player
22
- this.downloader = deps.downloader
23
- this.player.playbackFinished.watch(() => this.clearCurrentAttempt())
24
- }
25
-
26
- public readonly togglePlayPause = (attemptNumber: number) => {
27
- const playerState = this.player.$playerState.getState()
28
- if (this.currentPlayingAttempt === attemptNumber && playerState === PlayerState.PLAYING) {
29
- this.player.pause()
30
- } else {
31
- this.handlePlayAttempt(attemptNumber)
32
- }
33
- }
34
-
35
- public readonly preloadAudio = createEffect(async (attemptNumber: number) => {
36
- const item = this.collection.get(attemptNumber)
37
- if (!item) return
38
- if (this.collection.hasAudio(attemptNumber)) {
39
- this.primePlayerIfIdle(attemptNumber)
40
- return
41
- }
42
- if (item.audioDownloadPromise) {
43
- try {
44
- await item.audioDownloadPromise
45
- } catch {}
46
- this.primePlayerIfIdle(attemptNumber)
47
- return
48
- }
49
- try {
50
- await this.downloadAudio(attemptNumber)
51
- this.primePlayerIfIdle(attemptNumber)
52
- } catch (error) {
53
- if (error instanceof Error && error.name === 'AbortError') return
54
- console.error('Audio preload error:', error)
55
- }
56
- })
57
-
58
- private primePlayerIfIdle(attemptNumber: number) {
59
- if (this.player.$playerState.getState() !== PlayerState.IDLE) return
60
- if (this.currentPlayingAttempt !== null) return
61
- const audioUri = this.collection.get(attemptNumber)?.audioUri
62
- if (!audioUri) return
63
- this.player.prime(audioUri)
64
- }
65
-
66
- public halt() {
67
- this.shouldPreventPlayback = true
68
- this.abortAllDownloads()
69
- this.player.stop()
70
- this.clearCurrentAttempt()
71
- }
72
-
73
- public releaseResources() {
74
- this.collection.getAll().forEach((item) => {
75
- if (item.controller) {
76
- this.downloader.abortDownload(item.controller)
77
- }
78
- if (item.audioUri?.startsWith('blob:')) {
79
- try {
80
- URL.revokeObjectURL(item.audioUri)
81
- } catch (e) {}
82
- }
83
- })
84
- }
85
-
86
- private clearCurrentAttempt() {
87
- this.currentPlayingAttempt = null
88
- }
89
-
90
- private abortAllDownloads() {
91
- this.collection.getAll().forEach((item) => {
92
- if (item.controller && item.audioLoading) {
93
- this.downloader.abortDownload(item.controller)
94
- this.collection.update(item.attemptNumber, {
95
- audioLoading: false,
96
- controller: undefined,
97
- audioDownloadPromise: undefined,
98
- })
99
- }
100
- })
101
- }
102
-
103
- private async downloadAudio(attemptNumber: number): Promise<void> {
104
- const item = this.collection.get(attemptNumber)
105
- if (!item) return
106
-
107
- const { collectionItem, downloadPromise } = await this.downloader.download({
108
- audioFileId: item.audioFileId,
109
- attemptNumber,
110
- })
111
- this.collection.update(attemptNumber, collectionItem)
112
-
113
- try {
114
- const result = await downloadPromise
115
- this.collection.update(attemptNumber, {
116
- audioUri: result.uri,
117
- audioLoading: false,
118
- audioError: undefined,
119
- controller: undefined,
120
- audioDownloadPromise: undefined,
121
- })
122
- } catch (error) {
123
- const isAbort = error instanceof Error && error.name === 'AbortError'
124
- this.collection.update(attemptNumber, {
125
- audioLoading: false,
126
- audioError: isAbort
127
- ? undefined
128
- : error instanceof Error
129
- ? error.message
130
- : 'Failed to download audio',
131
- controller: undefined,
132
- audioDownloadPromise: undefined,
133
- })
134
- throw error
135
- }
136
- }
137
-
138
- private readonly handlePlayAttempt = createEffect(async (attemptNumber: number) => {
139
- this.shouldPreventPlayback = false
140
- const item = this.collection.get(attemptNumber)
141
- if (!item) return
142
-
143
- if (this.currentPlayingAttempt !== null && this.currentPlayingAttempt !== attemptNumber) {
144
- this.abortAllDownloads()
145
- }
146
-
147
- if (this.collection.hasAudio(attemptNumber)) {
148
- this.playAudioFx(attemptNumber)
149
- return
150
- }
151
-
152
- try {
153
- this.player.setPlayerState(PlayerState.LOADING)
154
-
155
- if (item.audioDownloadPromise) {
156
- await item.audioDownloadPromise
157
- } else {
158
- await this.downloadAudio(attemptNumber)
159
- }
160
-
161
- if (this.shouldPreventPlayback) {
162
- this.player.setPlayerState(PlayerState.IDLE)
163
- return
164
- }
165
-
166
- this.player.setPlayerState(PlayerState.IDLE)
167
- this.playAudioFx(attemptNumber)
168
- } catch (error) {
169
- if (error instanceof Error && error.name === 'AbortError') {
170
- this.player.setPlayerState(PlayerState.IDLE)
171
- return
172
- }
173
- console.error('Audio download error:', error)
174
- this.player.setPlayerState(PlayerState.IDLE)
175
- }
176
- })
177
-
178
- private readonly playAudioFx = createEffect(async (attemptNumber: number) => {
179
- if (this.shouldPreventPlayback) return
180
-
181
- const item = this.collection.get(attemptNumber)
182
- if (!item?.audioUri) {
183
- console.warn('No audio URI available for attempt:', attemptNumber)
184
- return
185
- }
186
-
187
- try {
188
- if (this.currentPlayingAttempt !== null && this.currentPlayingAttempt !== attemptNumber) {
189
- this.player.player?.remove()
190
- }
191
-
192
- if (this.currentPlayingAttempt === attemptNumber && this.player.player?.playing) {
193
- this.player.pause()
194
- return
195
- }
196
-
197
- if (this.currentPlayingAttempt === attemptNumber && !this.player.player?.playing) {
198
- this.player.resume()
199
- return
200
- }
201
-
202
- this.currentPlayingAttempt = attemptNumber
203
- await this.player.play(item.audioUri)
204
- } catch (error) {
205
- console.error('Error playing audio:', error)
206
- this.player.setPlayerState(PlayerState.IDLE)
207
-
208
- this.collection.update(attemptNumber, {
209
- audioError: error instanceof Error ? error.message : 'Failed to play audio',
210
- })
211
- }
212
- })
213
- }
@@ -1,88 +0,0 @@
1
- import { createEffect } from 'effector'
2
- import { TranscriptionsCollection } from './TranscriptionsCollection'
3
- import { VoicePlayerApi } from '../../types'
4
- import {
5
- NO_AUDIO_BE_MESSAGE,
6
- TRANSCRIPT_MAX_RETRIES,
7
- TRANSCRIPT_RETRY_INTERVAL_MS,
8
- } from '../../constants'
9
-
10
- type TranscriptResult = { text: string; language?: string }
11
-
12
- export class TranscriptionsDownloaderModel {
13
- private readonly collection: TranscriptionsCollection
14
- private readonly api: VoicePlayerApi
15
- private readonly inflightFetches = new Map<string, Promise<TranscriptResult>>()
16
- private readonly transcriptCache = new Map<string, TranscriptResult>()
17
-
18
- constructor(collection: TranscriptionsCollection, api: VoicePlayerApi) {
19
- this.collection = collection
20
- this.api = api
21
- }
22
-
23
- private fetchTranscriptWithRetry(audioFileId: string): Promise<TranscriptResult> {
24
- const cached = this.transcriptCache.get(audioFileId)
25
- if (cached) return Promise.resolve(cached)
26
-
27
- const existing = this.inflightFetches.get(audioFileId)
28
- if (existing) return existing
29
-
30
- const promise = this.runFetchWithRetry(audioFileId)
31
- .then((result) => {
32
- this.transcriptCache.set(audioFileId, result)
33
- return result
34
- })
35
- .finally(() => {
36
- this.inflightFetches.delete(audioFileId)
37
- })
38
- this.inflightFetches.set(audioFileId, promise)
39
- return promise
40
- }
41
-
42
- private async runFetchWithRetry(audioFileId: string): Promise<TranscriptResult> {
43
- for (let attempt = 0; attempt < TRANSCRIPT_MAX_RETRIES; attempt++) {
44
- const response = await this.api.getAudioFileTranscript(audioFileId)
45
-
46
- if (response.status === 'completed') {
47
- return { text: response.text, language: response.language }
48
- }
49
-
50
- if (response.status === 'failed') {
51
- return { text: NO_AUDIO_BE_MESSAGE }
52
- }
53
-
54
- if (attempt < TRANSCRIPT_MAX_RETRIES - 1) {
55
- await new Promise((resolve) => setTimeout(resolve, TRANSCRIPT_RETRY_INTERVAL_MS))
56
- }
57
- }
58
- return { text: NO_AUDIO_BE_MESSAGE }
59
- }
60
-
61
- public readonly loadTranscriptForAttempt = createEffect(async (attemptNumber: number) => {
62
- const item = this.collection.get(attemptNumber)
63
- if (!item?.audioFileId) return
64
- if (item.transcript || item.transcriptLoading) return
65
-
66
- this.collection.update(attemptNumber, { transcriptLoading: true })
67
-
68
- try {
69
- const { text, language } = await this.fetchTranscriptWithRetry(item.audioFileId)
70
-
71
- this.collection.update(attemptNumber, {
72
- transcript: text,
73
- transcriptLanguage: language,
74
- transcriptLoading: false,
75
- transcriptError: undefined,
76
- })
77
- } catch (error) {
78
- this.collection.update(attemptNumber, {
79
- transcriptLoading: false,
80
- transcriptError: error instanceof Error ? error.message : 'Failed to load transcript',
81
- })
82
- }
83
- })
84
-
85
- public getCachedTranscript(audioFileId: string): TranscriptResult | undefined {
86
- return this.transcriptCache.get(audioFileId)
87
- }
88
- }
@@ -1,75 +0,0 @@
1
- import { createEffect, createEvent, createStore, restore } from 'effector'
2
- import { TranscriptionsCollection } from './TranscriptionsCollection'
3
- import { VoicePlayerApi } from '../../types'
4
- import { TranslationService } from '../../../translation/model/TranslationService'
5
- import { GoogleTranslationProvider } from '../../../translation/providers/google/GoogleTranslationProvider'
6
- import {
7
- preservedWordsReplacers,
8
- wordsToPreserve,
9
- } from '../../../translation/preserve/wordsToPreserve'
10
-
11
- type TranslateParams = {
12
- attemptNumber: number
13
- targetLanguage: string
14
- }
15
-
16
- type TranslateResult = {
17
- attemptNumber: number
18
- text: string
19
- }
20
-
21
- export class TranslationModel {
22
- private readonly collection: TranscriptionsCollection
23
- private readonly service: TranslationService
24
-
25
- public readonly toggle = createEvent()
26
- public readonly setActive = createEvent<boolean>()
27
- public readonly clearCache = createEvent()
28
- public readonly reset = createEvent()
29
-
30
- public readonly $isActive = restore(this.setActive, false)
31
- .on(this.toggle, (state) => !state)
32
- .reset(this.reset)
33
-
34
- public readonly translate = createEffect<TranslateParams, TranslateResult | null>(
35
- async ({ attemptNumber, targetLanguage }) => {
36
- const item = this.collection.get(attemptNumber)
37
- if (!item?.transcript) return null
38
-
39
- const text = await this.service.translate(item.transcript, {
40
- targetLang: targetLanguage,
41
- sourceLang: item.transcriptLanguage,
42
- cacheKey: `voice::${attemptNumber}::${targetLanguage}`,
43
- })
44
-
45
- if (!text) return null
46
-
47
- return { attemptNumber, text }
48
- },
49
- )
50
-
51
- public readonly $translations = createStore<Record<number, string>>({})
52
- .on(this.translate.doneData, (state, result) => {
53
- if (!result) return state
54
- return { ...state, [result.attemptNumber]: result.text }
55
- })
56
- .reset(this.reset, this.clearCache)
57
-
58
- constructor(collection: TranscriptionsCollection, api: VoicePlayerApi) {
59
- this.collection = collection
60
- this.service = new TranslationService({
61
- preserve: {
62
- map: wordsToPreserve,
63
- replacers: preservedWordsReplacers,
64
- },
65
- providers: [new GoogleTranslationProvider({ api: { translateRequest: api.translateText } })],
66
- })
67
-
68
- this.clearCache.watch(() => this.service.reset())
69
- this.reset.watch(() => this.service.reset())
70
- }
71
-
72
- public getTranslation(attemptNumber: number): string | undefined {
73
- return this.$translations.getState()[attemptNumber]
74
- }
75
- }