@magmamath/students-features 1.3.23-rc.9 → 1.3.23

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 (332) hide show
  1. package/dist/commonjs/features/pmProgress/components/chart/chart.helpers.js +1 -0
  2. package/dist/commonjs/features/pmProgress/components/chart/chart.helpers.js.map +1 -1
  3. package/dist/commonjs/features/pmProgress/components/header/StartButton.js +10 -1
  4. package/dist/commonjs/features/pmProgress/components/header/StartButton.js.map +1 -1
  5. package/dist/commonjs/features/pmProgress/components/list/{ListCard.js → DomainCard.js} +10 -22
  6. package/dist/commonjs/features/pmProgress/components/list/DomainCard.js.map +1 -0
  7. package/dist/commonjs/features/pmProgress/components/list/Fluency.js +3 -3
  8. package/dist/commonjs/features/pmProgress/components/list/Fluency.js.map +1 -1
  9. package/dist/commonjs/features/pmProgress/components/list/PmDomainList.js +3 -3
  10. package/dist/commonjs/features/pmProgress/components/list/PmDomainList.js.map +1 -1
  11. package/dist/commonjs/features/pmProgress/components/list/{ListItem.js → StandardItem.js} +5 -5
  12. package/dist/commonjs/features/pmProgress/components/list/StandardItem.js.map +1 -0
  13. package/dist/commonjs/features/pmProgress/components/recs/PmTeacherRecs.js +7 -4
  14. package/dist/commonjs/features/pmProgress/components/recs/PmTeacherRecs.js.map +1 -1
  15. package/dist/commonjs/features/pmProgress/components/standard/StandardTag.js +1 -8
  16. package/dist/commonjs/features/pmProgress/components/standard/StandardTag.js.map +1 -1
  17. package/dist/commonjs/features/pmProgress/shared/pmProgress.helpers.js +1 -1
  18. package/dist/commonjs/features/pmProgress/shared/pmProgress.helpers.js.map +1 -1
  19. package/dist/commonjs/features/voice/index.js +4 -4
  20. package/dist/commonjs/features/voice/index.js.map +1 -1
  21. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.js +245 -0
  22. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.js.map +1 -0
  23. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js +109 -0
  24. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js.map +1 -0
  25. package/dist/commonjs/features/voice/playing/hooks/{useVoiceTranscription.js → useVoiceTranscriptionsDropdown.js} +4 -4
  26. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.js.map +1 -0
  27. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.js +34 -0
  28. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.js.map +1 -0
  29. package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.js +4 -18
  30. package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.js.map +1 -1
  31. package/dist/commonjs/features/voice/playing/model/VoicePlayer.model.js +2 -6
  32. package/dist/commonjs/features/voice/playing/model/VoicePlayer.model.js.map +1 -1
  33. package/dist/commonjs/features/voice/playing/model/{VoiceTranscription.model.js → VoiceTranscriptionsDropdown.model.js} +4 -4
  34. package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionsDropdown.model.js.map +1 -0
  35. package/dist/commonjs/features/voice/types.js +1 -6
  36. package/dist/commonjs/features/voice/types.js.map +1 -1
  37. package/dist/commonjs/index.js +0 -12
  38. package/dist/commonjs/index.js.map +1 -1
  39. package/dist/module/features/pmProgress/components/chart/chart.helpers.js +1 -0
  40. package/dist/module/features/pmProgress/components/chart/chart.helpers.js.map +1 -1
  41. package/dist/module/features/pmProgress/components/header/StartButton.js +10 -1
  42. package/dist/module/features/pmProgress/components/header/StartButton.js.map +1 -1
  43. package/dist/module/features/pmProgress/components/list/{ListCard.js → DomainCard.js} +8 -20
  44. package/dist/module/features/pmProgress/components/list/DomainCard.js.map +1 -0
  45. package/dist/module/features/pmProgress/components/list/Fluency.js +3 -3
  46. package/dist/module/features/pmProgress/components/list/Fluency.js.map +1 -1
  47. package/dist/module/features/pmProgress/components/list/PmDomainList.js +3 -3
  48. package/dist/module/features/pmProgress/components/list/PmDomainList.js.map +1 -1
  49. package/dist/module/features/pmProgress/components/list/{ListItem.js → StandardItem.js} +3 -3
  50. package/dist/module/features/pmProgress/components/list/StandardItem.js.map +1 -0
  51. package/dist/module/features/pmProgress/components/recs/PmTeacherRecs.js +7 -4
  52. package/dist/module/features/pmProgress/components/recs/PmTeacherRecs.js.map +1 -1
  53. package/dist/module/features/pmProgress/components/standard/StandardTag.js +2 -9
  54. package/dist/module/features/pmProgress/components/standard/StandardTag.js.map +1 -1
  55. package/dist/module/features/pmProgress/shared/pmProgress.helpers.js +1 -1
  56. package/dist/module/features/pmProgress/shared/pmProgress.helpers.js.map +1 -1
  57. package/dist/module/features/voice/index.js +1 -1
  58. package/dist/module/features/voice/index.js.map +1 -1
  59. package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdown.js +238 -0
  60. package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdown.js.map +1 -0
  61. package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js +103 -0
  62. package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js.map +1 -0
  63. package/dist/module/features/voice/playing/hooks/{useVoiceTranscription.js → useVoiceTranscriptionsDropdown.js} +2 -2
  64. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.js.map +1 -0
  65. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.js +29 -0
  66. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.js.map +1 -0
  67. package/dist/module/features/voice/playing/model/TranscriptionsDownloaderModel.js +4 -18
  68. package/dist/module/features/voice/playing/model/TranscriptionsDownloaderModel.js.map +1 -1
  69. package/dist/module/features/voice/playing/model/VoicePlayer.model.js +2 -6
  70. package/dist/module/features/voice/playing/model/VoicePlayer.model.js.map +1 -1
  71. package/dist/module/features/voice/playing/model/{VoiceTranscription.model.js → VoiceTranscriptionsDropdown.model.js} +2 -2
  72. package/dist/module/features/voice/playing/model/VoiceTranscriptionsDropdown.model.js.map +1 -0
  73. package/dist/module/features/voice/types.js +0 -5
  74. package/dist/module/features/voice/types.js.map +1 -1
  75. package/dist/module/index.js +0 -1
  76. package/dist/module/index.js.map +1 -1
  77. package/dist/typescript/commonjs/features/pmProgress/components/chart/chart.helpers.d.ts.map +1 -1
  78. package/dist/typescript/commonjs/features/pmProgress/components/header/StartButton.d.ts.map +1 -1
  79. package/dist/typescript/commonjs/features/pmProgress/components/list/{ListCard.d.ts → DomainCard.d.ts} +6 -6
  80. package/dist/typescript/commonjs/features/pmProgress/components/list/DomainCard.d.ts.map +1 -0
  81. package/dist/typescript/commonjs/features/pmProgress/components/list/StandardItem.d.ts +13 -0
  82. package/dist/typescript/commonjs/features/pmProgress/components/list/StandardItem.d.ts.map +1 -0
  83. package/dist/typescript/commonjs/features/pmProgress/components/recs/PmTeacherRecs.d.ts.map +1 -1
  84. package/dist/typescript/commonjs/features/pmProgress/shared/pmProgress.helpers.d.ts.map +1 -1
  85. package/dist/typescript/commonjs/features/voice/index.d.ts +1 -1
  86. package/dist/typescript/commonjs/features/voice/index.d.ts.map +1 -1
  87. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts +16 -0
  88. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts.map +1 -0
  89. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdownItem.d.ts +12 -0
  90. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdownItem.d.ts.map +1 -0
  91. package/dist/typescript/commonjs/features/voice/playing/hooks/{useVoiceTranscription.d.ts → useVoiceTranscriptionsDropdown.d.ts} +3 -3
  92. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.d.ts.map +1 -0
  93. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.d.ts +11 -0
  94. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.d.ts.map +1 -0
  95. package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts +0 -1
  96. package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts.map +1 -1
  97. package/dist/typescript/commonjs/features/voice/playing/model/VoicePlayer.model.d.ts +2 -4
  98. package/dist/typescript/commonjs/features/voice/playing/model/VoicePlayer.model.d.ts.map +1 -1
  99. package/dist/typescript/commonjs/features/voice/playing/model/{VoiceTranscription.model.d.ts → VoiceTranscriptionsDropdown.model.d.ts} +2 -2
  100. package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionsDropdown.model.d.ts.map +1 -0
  101. package/dist/typescript/commonjs/features/voice/types.d.ts +1 -9
  102. package/dist/typescript/commonjs/features/voice/types.d.ts.map +1 -1
  103. package/dist/typescript/commonjs/index.d.ts +0 -1
  104. package/dist/typescript/commonjs/index.d.ts.map +1 -1
  105. package/dist/typescript/module/features/pmProgress/components/chart/chart.helpers.d.ts.map +1 -1
  106. package/dist/typescript/module/features/pmProgress/components/header/StartButton.d.ts.map +1 -1
  107. package/dist/typescript/module/features/pmProgress/components/list/{ListCard.d.ts → DomainCard.d.ts} +6 -6
  108. package/dist/typescript/module/features/pmProgress/components/list/DomainCard.d.ts.map +1 -0
  109. package/dist/typescript/module/features/pmProgress/components/list/StandardItem.d.ts +13 -0
  110. package/dist/typescript/module/features/pmProgress/components/list/StandardItem.d.ts.map +1 -0
  111. package/dist/typescript/module/features/pmProgress/components/recs/PmTeacherRecs.d.ts.map +1 -1
  112. package/dist/typescript/module/features/pmProgress/shared/pmProgress.helpers.d.ts.map +1 -1
  113. package/dist/typescript/module/features/voice/index.d.ts +1 -1
  114. package/dist/typescript/module/features/voice/index.d.ts.map +1 -1
  115. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts +16 -0
  116. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts.map +1 -0
  117. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionsDropdownItem.d.ts +12 -0
  118. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionsDropdownItem.d.ts.map +1 -0
  119. package/dist/typescript/module/features/voice/playing/hooks/{useVoiceTranscription.d.ts → useVoiceTranscriptionsDropdown.d.ts} +3 -3
  120. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.d.ts.map +1 -0
  121. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.d.ts +11 -0
  122. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.d.ts.map +1 -0
  123. package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts +0 -1
  124. package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts.map +1 -1
  125. package/dist/typescript/module/features/voice/playing/model/VoicePlayer.model.d.ts +2 -4
  126. package/dist/typescript/module/features/voice/playing/model/VoicePlayer.model.d.ts.map +1 -1
  127. package/dist/typescript/module/features/voice/playing/model/{VoiceTranscription.model.d.ts → VoiceTranscriptionsDropdown.model.d.ts} +2 -2
  128. package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionsDropdown.model.d.ts.map +1 -0
  129. package/dist/typescript/module/features/voice/types.d.ts +1 -9
  130. package/dist/typescript/module/features/voice/types.d.ts.map +1 -1
  131. package/dist/typescript/module/index.d.ts +0 -1
  132. package/dist/typescript/module/index.d.ts.map +1 -1
  133. package/package.json +1 -1
  134. package/src/features/pmProgress/components/chart/chart.helpers.ts +1 -0
  135. package/src/features/pmProgress/components/header/StartButton.tsx +11 -1
  136. package/src/features/pmProgress/components/list/{ListCard.tsx → DomainCard.tsx} +12 -19
  137. package/src/features/pmProgress/components/list/Fluency.tsx +3 -3
  138. package/src/features/pmProgress/components/list/PmDomainList.tsx +3 -3
  139. package/src/features/pmProgress/components/list/{ListItem.tsx → StandardItem.tsx} +4 -4
  140. package/src/features/pmProgress/components/recs/PmTeacherRecs.tsx +8 -4
  141. package/src/features/pmProgress/components/standard/StandardTag.tsx +2 -6
  142. package/src/features/pmProgress/shared/pmProgress.helpers.ts +1 -2
  143. package/src/features/voice/index.ts +1 -1
  144. package/src/features/voice/playing/components/VoiceTranscriptionsDropdown.tsx +296 -0
  145. package/src/features/voice/playing/components/VoiceTranscriptionsDropdownItem.tsx +128 -0
  146. package/src/features/voice/playing/hooks/{useVoiceTranscription.ts → useVoiceTranscriptionsDropdown.ts} +2 -2
  147. package/src/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.ts +40 -0
  148. package/src/features/voice/playing/model/TranscriptionsDownloaderModel.ts +5 -12
  149. package/src/features/voice/playing/model/VoicePlayer.model.ts +2 -7
  150. package/src/features/voice/playing/model/{VoiceTranscription.model.ts → VoiceTranscriptionsDropdown.model.ts} +2 -2
  151. package/src/features/voice/types.ts +0 -15
  152. package/src/index.ts +0 -1
  153. package/dist/commonjs/features/pmProgress/components/list/ListCard.js.map +0 -1
  154. package/dist/commonjs/features/pmProgress/components/list/ListItem.js.map +0 -1
  155. package/dist/commonjs/features/translation/constants.js +0 -11
  156. package/dist/commonjs/features/translation/constants.js.map +0 -1
  157. package/dist/commonjs/features/translation/helpers.js +0 -60
  158. package/dist/commonjs/features/translation/helpers.js.map +0 -1
  159. package/dist/commonjs/features/translation/index.js +0 -105
  160. package/dist/commonjs/features/translation/index.js.map +0 -1
  161. package/dist/commonjs/features/translation/model/TranslationModel.js +0 -122
  162. package/dist/commonjs/features/translation/model/TranslationModel.js.map +0 -1
  163. package/dist/commonjs/features/translation/model/TranslationPreprocessor.js +0 -142
  164. package/dist/commonjs/features/translation/model/TranslationPreprocessor.js.map +0 -1
  165. package/dist/commonjs/features/translation/model/TranslationService.js +0 -112
  166. package/dist/commonjs/features/translation/model/TranslationService.js.map +0 -1
  167. package/dist/commonjs/features/translation/preserve/wordsToPreserve.js +0 -314
  168. package/dist/commonjs/features/translation/preserve/wordsToPreserve.js.map +0 -1
  169. package/dist/commonjs/features/translation/providers/google/GoogleTranslationProvider.js +0 -50
  170. package/dist/commonjs/features/translation/providers/google/GoogleTranslationProvider.js.map +0 -1
  171. package/dist/commonjs/features/translation/providers/google/supportedLanguages.js +0 -230
  172. package/dist/commonjs/features/translation/providers/google/supportedLanguages.js.map +0 -1
  173. package/dist/commonjs/features/translation/providers/google.types.js +0 -2
  174. package/dist/commonjs/features/translation/providers/google.types.js.map +0 -1
  175. package/dist/commonjs/features/translation/providers/translation.interface.js +0 -49
  176. package/dist/commonjs/features/translation/providers/translation.interface.js.map +0 -1
  177. package/dist/commonjs/features/translation/types.js +0 -2
  178. package/dist/commonjs/features/translation/types.js.map +0 -1
  179. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptContent.js +0 -44
  180. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptContent.js.map +0 -1
  181. package/dist/commonjs/features/voice/playing/components/VoiceTranscription.js +0 -135
  182. package/dist/commonjs/features/voice/playing/components/VoiceTranscription.js.map +0 -1
  183. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.js +0 -66
  184. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.js.map +0 -1
  185. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.js +0 -59
  186. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.js.map +0 -1
  187. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscription.js.map +0 -1
  188. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionEffects.js +0 -37
  189. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionEffects.js.map +0 -1
  190. package/dist/commonjs/features/voice/playing/model/VoiceTranscription.model.js.map +0 -1
  191. package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionTranslation.model.js +0 -62
  192. package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionTranslation.model.js.map +0 -1
  193. package/dist/module/features/pmProgress/components/list/ListCard.js.map +0 -1
  194. package/dist/module/features/pmProgress/components/list/ListItem.js.map +0 -1
  195. package/dist/module/features/translation/constants.js +0 -7
  196. package/dist/module/features/translation/constants.js.map +0 -1
  197. package/dist/module/features/translation/helpers.js +0 -53
  198. package/dist/module/features/translation/helpers.js.map +0 -1
  199. package/dist/module/features/translation/index.js +0 -12
  200. package/dist/module/features/translation/index.js.map +0 -1
  201. package/dist/module/features/translation/model/TranslationModel.js +0 -117
  202. package/dist/module/features/translation/model/TranslationModel.js.map +0 -1
  203. package/dist/module/features/translation/model/TranslationPreprocessor.js +0 -137
  204. package/dist/module/features/translation/model/TranslationPreprocessor.js.map +0 -1
  205. package/dist/module/features/translation/model/TranslationService.js +0 -107
  206. package/dist/module/features/translation/model/TranslationService.js.map +0 -1
  207. package/dist/module/features/translation/preserve/wordsToPreserve.js +0 -310
  208. package/dist/module/features/translation/preserve/wordsToPreserve.js.map +0 -1
  209. package/dist/module/features/translation/providers/google/GoogleTranslationProvider.js +0 -45
  210. package/dist/module/features/translation/providers/google/GoogleTranslationProvider.js.map +0 -1
  211. package/dist/module/features/translation/providers/google/supportedLanguages.js +0 -225
  212. package/dist/module/features/translation/providers/google/supportedLanguages.js.map +0 -1
  213. package/dist/module/features/translation/providers/google.types.js +0 -2
  214. package/dist/module/features/translation/providers/google.types.js.map +0 -1
  215. package/dist/module/features/translation/providers/translation.interface.js +0 -44
  216. package/dist/module/features/translation/providers/translation.interface.js.map +0 -1
  217. package/dist/module/features/translation/types.js +0 -2
  218. package/dist/module/features/translation/types.js.map +0 -1
  219. package/dist/module/features/voice/playing/components/VoiceTranscriptContent.js +0 -38
  220. package/dist/module/features/voice/playing/components/VoiceTranscriptContent.js.map +0 -1
  221. package/dist/module/features/voice/playing/components/VoiceTranscription.js +0 -127
  222. package/dist/module/features/voice/playing/components/VoiceTranscription.js.map +0 -1
  223. package/dist/module/features/voice/playing/components/VoiceTranscriptionCollapsible.js +0 -58
  224. package/dist/module/features/voice/playing/components/VoiceTranscriptionCollapsible.js.map +0 -1
  225. package/dist/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.js +0 -51
  226. package/dist/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.js.map +0 -1
  227. package/dist/module/features/voice/playing/hooks/useVoiceTranscription.js.map +0 -1
  228. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionEffects.js +0 -32
  229. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionEffects.js.map +0 -1
  230. package/dist/module/features/voice/playing/model/VoiceTranscription.model.js.map +0 -1
  231. package/dist/module/features/voice/playing/model/VoiceTranscriptionTranslation.model.js +0 -57
  232. package/dist/module/features/voice/playing/model/VoiceTranscriptionTranslation.model.js.map +0 -1
  233. package/dist/typescript/commonjs/features/pmProgress/components/list/ListCard.d.ts.map +0 -1
  234. package/dist/typescript/commonjs/features/pmProgress/components/list/ListItem.d.ts +0 -13
  235. package/dist/typescript/commonjs/features/pmProgress/components/list/ListItem.d.ts.map +0 -1
  236. package/dist/typescript/commonjs/features/translation/constants.d.ts +0 -5
  237. package/dist/typescript/commonjs/features/translation/constants.d.ts.map +0 -1
  238. package/dist/typescript/commonjs/features/translation/helpers.d.ts +0 -9
  239. package/dist/typescript/commonjs/features/translation/helpers.d.ts.map +0 -1
  240. package/dist/typescript/commonjs/features/translation/index.d.ts +0 -12
  241. package/dist/typescript/commonjs/features/translation/index.d.ts.map +0 -1
  242. package/dist/typescript/commonjs/features/translation/model/TranslationModel.d.ts +0 -33
  243. package/dist/typescript/commonjs/features/translation/model/TranslationModel.d.ts.map +0 -1
  244. package/dist/typescript/commonjs/features/translation/model/TranslationPreprocessor.d.ts +0 -34
  245. package/dist/typescript/commonjs/features/translation/model/TranslationPreprocessor.d.ts.map +0 -1
  246. package/dist/typescript/commonjs/features/translation/model/TranslationService.d.ts +0 -40
  247. package/dist/typescript/commonjs/features/translation/model/TranslationService.d.ts.map +0 -1
  248. package/dist/typescript/commonjs/features/translation/preserve/wordsToPreserve.d.ts +0 -3
  249. package/dist/typescript/commonjs/features/translation/preserve/wordsToPreserve.d.ts.map +0 -1
  250. package/dist/typescript/commonjs/features/translation/providers/google/GoogleTranslationProvider.d.ts +0 -17
  251. package/dist/typescript/commonjs/features/translation/providers/google/GoogleTranslationProvider.d.ts.map +0 -1
  252. package/dist/typescript/commonjs/features/translation/providers/google/supportedLanguages.d.ts +0 -209
  253. package/dist/typescript/commonjs/features/translation/providers/google/supportedLanguages.d.ts.map +0 -1
  254. package/dist/typescript/commonjs/features/translation/providers/google.types.d.ts +0 -15
  255. package/dist/typescript/commonjs/features/translation/providers/google.types.d.ts.map +0 -1
  256. package/dist/typescript/commonjs/features/translation/providers/translation.interface.d.ts +0 -30
  257. package/dist/typescript/commonjs/features/translation/providers/translation.interface.d.ts.map +0 -1
  258. package/dist/typescript/commonjs/features/translation/types.d.ts +0 -27
  259. package/dist/typescript/commonjs/features/translation/types.d.ts.map +0 -1
  260. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptContent.d.ts +0 -8
  261. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptContent.d.ts.map +0 -1
  262. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscription.d.ts +0 -16
  263. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscription.d.ts.map +0 -1
  264. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts +0 -10
  265. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts.map +0 -1
  266. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts +0 -12
  267. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts.map +0 -1
  268. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscription.d.ts.map +0 -1
  269. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionEffects.d.ts +0 -12
  270. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionEffects.d.ts.map +0 -1
  271. package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscription.model.d.ts.map +0 -1
  272. package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionTranslation.model.d.ts +0 -25
  273. package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionTranslation.model.d.ts.map +0 -1
  274. package/dist/typescript/module/features/pmProgress/components/list/ListCard.d.ts.map +0 -1
  275. package/dist/typescript/module/features/pmProgress/components/list/ListItem.d.ts +0 -13
  276. package/dist/typescript/module/features/pmProgress/components/list/ListItem.d.ts.map +0 -1
  277. package/dist/typescript/module/features/translation/constants.d.ts +0 -5
  278. package/dist/typescript/module/features/translation/constants.d.ts.map +0 -1
  279. package/dist/typescript/module/features/translation/helpers.d.ts +0 -9
  280. package/dist/typescript/module/features/translation/helpers.d.ts.map +0 -1
  281. package/dist/typescript/module/features/translation/index.d.ts +0 -12
  282. package/dist/typescript/module/features/translation/index.d.ts.map +0 -1
  283. package/dist/typescript/module/features/translation/model/TranslationModel.d.ts +0 -33
  284. package/dist/typescript/module/features/translation/model/TranslationModel.d.ts.map +0 -1
  285. package/dist/typescript/module/features/translation/model/TranslationPreprocessor.d.ts +0 -34
  286. package/dist/typescript/module/features/translation/model/TranslationPreprocessor.d.ts.map +0 -1
  287. package/dist/typescript/module/features/translation/model/TranslationService.d.ts +0 -40
  288. package/dist/typescript/module/features/translation/model/TranslationService.d.ts.map +0 -1
  289. package/dist/typescript/module/features/translation/preserve/wordsToPreserve.d.ts +0 -3
  290. package/dist/typescript/module/features/translation/preserve/wordsToPreserve.d.ts.map +0 -1
  291. package/dist/typescript/module/features/translation/providers/google/GoogleTranslationProvider.d.ts +0 -17
  292. package/dist/typescript/module/features/translation/providers/google/GoogleTranslationProvider.d.ts.map +0 -1
  293. package/dist/typescript/module/features/translation/providers/google/supportedLanguages.d.ts +0 -209
  294. package/dist/typescript/module/features/translation/providers/google/supportedLanguages.d.ts.map +0 -1
  295. package/dist/typescript/module/features/translation/providers/google.types.d.ts +0 -15
  296. package/dist/typescript/module/features/translation/providers/google.types.d.ts.map +0 -1
  297. package/dist/typescript/module/features/translation/providers/translation.interface.d.ts +0 -30
  298. package/dist/typescript/module/features/translation/providers/translation.interface.d.ts.map +0 -1
  299. package/dist/typescript/module/features/translation/types.d.ts +0 -27
  300. package/dist/typescript/module/features/translation/types.d.ts.map +0 -1
  301. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptContent.d.ts +0 -8
  302. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptContent.d.ts.map +0 -1
  303. package/dist/typescript/module/features/voice/playing/components/VoiceTranscription.d.ts +0 -16
  304. package/dist/typescript/module/features/voice/playing/components/VoiceTranscription.d.ts.map +0 -1
  305. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts +0 -10
  306. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts.map +0 -1
  307. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts +0 -12
  308. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts.map +0 -1
  309. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscription.d.ts.map +0 -1
  310. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionEffects.d.ts +0 -12
  311. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionEffects.d.ts.map +0 -1
  312. package/dist/typescript/module/features/voice/playing/model/VoiceTranscription.model.d.ts.map +0 -1
  313. package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionTranslation.model.d.ts +0 -25
  314. package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionTranslation.model.d.ts.map +0 -1
  315. package/src/features/translation/constants.ts +0 -4
  316. package/src/features/translation/helpers.ts +0 -63
  317. package/src/features/translation/index.ts +0 -30
  318. package/src/features/translation/model/TranslationModel.ts +0 -174
  319. package/src/features/translation/model/TranslationPreprocessor.ts +0 -171
  320. package/src/features/translation/model/TranslationService.ts +0 -148
  321. package/src/features/translation/preserve/wordsToPreserve.ts +0 -87
  322. package/src/features/translation/providers/google/GoogleTranslationProvider.ts +0 -50
  323. package/src/features/translation/providers/google/supportedLanguages.ts +0 -229
  324. package/src/features/translation/providers/google.types.ts +0 -16
  325. package/src/features/translation/providers/translation.interface.ts +0 -63
  326. package/src/features/translation/types.ts +0 -30
  327. package/src/features/voice/playing/components/VoiceTranscriptContent.tsx +0 -37
  328. package/src/features/voice/playing/components/VoiceTranscription.tsx +0 -172
  329. package/src/features/voice/playing/components/VoiceTranscriptionCollapsible.tsx +0 -59
  330. package/src/features/voice/playing/components/VoiceTranscriptionHeaderActions.tsx +0 -62
  331. package/src/features/voice/playing/hooks/useVoiceTranscriptionEffects.ts +0 -44
  332. package/src/features/voice/playing/model/VoiceTranscriptionTranslation.model.ts +0 -75
@@ -1,229 +0,0 @@
1
- const SUPPORTED_CODES = new Set<string>()
2
- const NAME_TO_CODE: Record<string, string> = {}
3
-
4
- const normalizeLanguageName = (language: string): string =>
5
- language
6
- .trim()
7
- .toUpperCase()
8
- .replace(/[\s()-]+/g, '_')
9
-
10
- /**
11
- * Resolves an arbitrary language input (ISO code, locale, or English name) to the
12
- * Google Translate ISO code. Returns null when the language is not supported.
13
- *
14
- * Examples:
15
- * "en" → "en"
16
- * "en-SE" → "en" (base fallback)
17
- * "zh-CN" → "zh-CN" (exact match)
18
- * "Spanish" → "es" (name lookup)
19
- * "Chinese Simplified" → "zh-CN"
20
- */
21
- export const resolveGoogleLanguageCode = (language?: string | null): string | null => {
22
- if (!language) return null
23
- if (SUPPORTED_CODES.has(language)) return language
24
- const base = language.split('-')[0]
25
- if (base !== language && SUPPORTED_CODES.has(base)) return base
26
- return NAME_TO_CODE[normalizeLanguageName(language)] ?? null
27
- }
28
-
29
- export const GoogleTranslateLanguage = {
30
- ABKHAZ: 'ab',
31
- ACEHNESE: 'ace',
32
- ACHOLI: 'ach',
33
- AFRIKAANS: 'af',
34
- ALBANIAN: 'sq',
35
- ALUR: 'alz',
36
- AMHARIC: 'am',
37
- ARABIC: 'ar',
38
- ARMENIAN: 'hy',
39
- ASSAMESE: 'as',
40
- AWADHI: 'awa',
41
- AYMARA: 'ay',
42
- AZERBAIJANI: 'az',
43
- BALINESE: 'ban',
44
- BAMBARA: 'bm',
45
- BASHKIR: 'ba',
46
- BASQUE: 'eu',
47
- BATAK_KARO: 'btx',
48
- BATAK_SIMALUNGUN: 'bts',
49
- BATAK_TOBA: 'bbc',
50
- BELARUSIAN: 'be',
51
- BEMBA: 'bem',
52
- BENGALI: 'bn',
53
- BETAWI: 'bew',
54
- BHOJPURI: 'bho',
55
- BIKOL: 'bik',
56
- BOSNIAN: 'bs',
57
- BRETON: 'br',
58
- BULGARIAN: 'bg',
59
- BURMESE: 'my',
60
- BURYAT: 'bua',
61
- CANTONESE: 'yue',
62
- CATALAN: 'ca',
63
- CEBUANO: 'ceb',
64
- CHICHEWA_NYANJA: 'ny',
65
- CHINESE_SIMPLIFIED: 'zh-CN',
66
- CHINESE_TRADITIONAL: 'zh-TW',
67
- CHUVASH: 'cv',
68
- CORSICAN: 'co',
69
- CRIMEAN_TATAR: 'crh',
70
- CROATIAN: 'hr',
71
- CZECH: 'cs',
72
- DANISH: 'da',
73
- DINKA: 'din',
74
- DIVEHI: 'dv',
75
- DOGRI: 'doi',
76
- DOMBE: 'dov',
77
- DUTCH: 'nl',
78
- DZONGKHA: 'dz',
79
- ENGLISH: 'en',
80
- ESPERANTO: 'eo',
81
- ESTONIAN: 'et',
82
- EWE: 'ee',
83
- FIJIAN: 'fj',
84
- FILIPINO_TAGALOG: 'fil',
85
- FINNISH: 'fi',
86
- FRENCH: 'fr',
87
- FRENCH_CANADA: 'fr-CA',
88
- FRENCH_FRANCE: 'fr-FR',
89
- FRISIAN: 'fy',
90
- FULFULDE: 'ff',
91
- GA: 'gaa',
92
- GALICIAN: 'gl',
93
- GANDA_LUGANDA: 'lg',
94
- GEORGIAN: 'ka',
95
- GERMAN: 'de',
96
- GREEK: 'el',
97
- GUARANI: 'gn',
98
- GUJARATI: 'gu',
99
- HAITIAN_CREOLE: 'ht',
100
- HAKHA_CHIN: 'cnh',
101
- HAUSA: 'ha',
102
- HAWAIIAN: 'haw',
103
- HEBREW: 'he',
104
- HILIGAYNON: 'hil',
105
- HINDI: 'hi',
106
- HMONG: 'hmn',
107
- HUNGARIAN: 'hu',
108
- HUNSRIK: 'hrx',
109
- ICELANDIC: 'is',
110
- IGBO: 'ig',
111
- ILOKO: 'ilo',
112
- INDONESIAN: 'id',
113
- IRISH: 'ga',
114
- ITALIAN: 'it',
115
- JAPANESE: 'ja',
116
- JAVANESE: 'jw',
117
- KANNADA: 'kn',
118
- KAPAMPANGAN: 'pam',
119
- KAZAKH: 'kk',
120
- KHMER: 'km',
121
- KIGA: 'cgg',
122
- KINYARWANDA: 'rw',
123
- KITUBA: 'ktu',
124
- KONKANI: 'gom',
125
- KOREAN: 'ko',
126
- KRIO: 'kri',
127
- KURMANJI: 'ku',
128
- KYRGYZ: 'ky',
129
- LAO: 'lo',
130
- LATGALIAN: 'ltg',
131
- LATIN: 'la',
132
- LATVIAN: 'lv',
133
- LIGURIAN: 'lij',
134
- LIMBURGAN: 'li',
135
- LINGALA: 'ln',
136
- LITHUANIAN: 'lt',
137
- LOMBARD: 'lmo',
138
- LUO: 'luo',
139
- LUXEMBOURGISH: 'lb',
140
- MACEDONIAN: 'mk',
141
- MAITHILI: 'mai',
142
- MAKASSAR: 'mak',
143
- MALAGASY: 'mg',
144
- MALAY: 'ms',
145
- MALAYALAM: 'ml',
146
- MALAY_JAWI: 'ms-Arab',
147
- MALTESE: 'mt',
148
- MAORI: 'mi',
149
- MARATHI: 'mr',
150
- MEADOW_MARI: 'chm',
151
- MEITEILON_MANIPURI: 'mni-Mtei',
152
- MINANG: 'min',
153
- MIZO: 'lus',
154
- MONGOLIAN: 'mn',
155
- NDEBELE_SOUTH: 'nr',
156
- NEPALBHASA_NEWARI: 'new',
157
- NEPALI: 'ne',
158
- NORTHERN_SOTHO: 'nso',
159
- NORWEGIAN: 'no',
160
- NUER: 'nus',
161
- OCCITAN: 'oc',
162
- ODIA: 'or',
163
- OROMO: 'om',
164
- PANGASINAN: 'pag',
165
- PAPIAMENTO: 'pap',
166
- PASHTO: 'ps',
167
- PERSIAN: 'fa',
168
- POLISH: 'pl',
169
- PORTUGUESE: 'pt',
170
- PORTUGUESE_BRAZIL: 'pt-BR',
171
- PORTUGUESE_PORTUGAL: 'pt-PT',
172
- PUNJABI: 'pa',
173
- PUNJABI_SHAHMUKHI: 'pa-Arab',
174
- QUECHUA: 'qu',
175
- ROMANI: 'rom',
176
- ROMANIAN: 'ro',
177
- RUNDI: 'rn',
178
- RUSSIAN: 'ru',
179
- SAMOAN: 'sm',
180
- SANGO: 'sg',
181
- SANSKRIT: 'sa',
182
- SCOTS_GAELIC: 'gd',
183
- SERBIAN: 'sr',
184
- SESOTHO: 'st',
185
- SEYCHELLOIS_CREOLE: 'crs',
186
- SHAN: 'shn',
187
- SHONA: 'sn',
188
- SICILIAN: 'scn',
189
- SILESIAN: 'szl',
190
- SINDHI: 'sd',
191
- SINHALA: 'si',
192
- SLOVAK: 'sk',
193
- SLOVENIAN: 'sl',
194
- SOMALI: 'so',
195
- SORANI: 'ckb',
196
- SPANISH: 'es',
197
- SUNDANESE: 'su',
198
- SWAHILI: 'sw',
199
- SWATI: 'ss',
200
- SWEDISH: 'sv',
201
- TAJIK: 'tg',
202
- TAMIL: 'ta',
203
- TATAR: 'tt',
204
- TELUGU: 'te',
205
- TETUM: 'tet',
206
- THAI: 'th',
207
- TIGRINYA: 'ti',
208
- TSONGA: 'ts',
209
- TSWANA: 'tn',
210
- TURKISH: 'tr',
211
- TURKMEN: 'tk',
212
- TWI_AKAN: 'ak',
213
- UKRAINIAN: 'uk',
214
- URDU: 'ur',
215
- UYGHUR: 'ug',
216
- UZBEK: 'uz',
217
- VIETNAMESE: 'vi',
218
- WELSH: 'cy',
219
- XHOSA: 'xh',
220
- YIDDISH: 'yi',
221
- YORUBA: 'yo',
222
- YUCATEC_MAYA: 'yua',
223
- ZULU: 'zu',
224
- }
225
-
226
- Object.entries(GoogleTranslateLanguage).forEach(([name, code]) => {
227
- SUPPORTED_CODES.add(code)
228
- NAME_TO_CODE[name] = code
229
- })
@@ -1,16 +0,0 @@
1
- export type GoogleTranslateProps = {
2
- text: string[]
3
- targetLanguage: string
4
- sourceLanguage?: string
5
- }
6
-
7
- export type GoogleTranslation = {
8
- translatedText: string
9
- detectedSourceLanguage: string
10
- }
11
-
12
- export type GoogleTranslateResponse = {
13
- data: {
14
- translations: GoogleTranslation[]
15
- }
16
- }
@@ -1,63 +0,0 @@
1
- import { replaceMappedTokens } from '../helpers'
2
-
3
- export type LanguageGlossary = {
4
- [languageCode: string]: Record<string, string>
5
- }
6
-
7
- type TranslationProviderProps = {
8
- supportedLanguages: string[]
9
- glossaries?: LanguageGlossary
10
- }
11
-
12
- export abstract class TranslationProvider {
13
- protected readonly supportedLanguages: ReadonlySet<string>
14
- protected readonly glossaries: LanguageGlossary = {}
15
-
16
- protected constructor({ supportedLanguages, glossaries = {} }: TranslationProviderProps) {
17
- this.supportedLanguages = new Set(supportedLanguages)
18
- this.glossaries = glossaries
19
- }
20
-
21
- public abstract request(
22
- text: string,
23
- targetLanguage: string,
24
- sourceLanguage?: string,
25
- ): Promise<string>
26
- public abstract requestBatch(
27
- text: string[],
28
- targetLanguage: string,
29
- sourceLanguage?: string,
30
- ): Promise<string[]>
31
-
32
- public isTargetSupported(language: string) {
33
- return this.resolveLanguage(language) !== null
34
- }
35
-
36
- /**
37
- * Returns the provider-supported variant of `language`, falling back to the base
38
- * language part (e.g. "en-SE" → "en") when the exact locale is not listed.
39
- * Subclasses may override to add their own resolution (e.g. language names).
40
- * Returns null when the language cannot be resolved.
41
- */
42
- public resolveLanguage(language: string): string | null {
43
- if (!language) return null
44
- if (this.supportedLanguages.has(language)) return language
45
- const base = language.split('-')[0]
46
- if (base !== language && this.supportedLanguages.has(base)) return base
47
- return null
48
- }
49
-
50
- public getSupportedLanguages() {
51
- return this.supportedLanguages.values()
52
- }
53
-
54
- /**
55
- * Replaces full standalone words in text using a custom glossary for the target language,
56
- * matching words like "Hello", or "Hej" regardless of case, but not when they appear inside other words.
57
- */
58
- public applyGlossary(text: string, targetLanguage: string): string {
59
- const glossary = this.glossaries[targetLanguage]
60
- if (!glossary) return text
61
- return replaceMappedTokens(text, glossary)
62
- }
63
- }
@@ -1,30 +0,0 @@
1
- export type TranslatableProblem = {
2
- description: string
3
- richDescription?: string
4
- answerVariants: string[]
5
- }
6
-
7
- export type TranslateAllFxParams<TProblem extends TranslatableProblem = TranslatableProblem> = {
8
- problem: TProblem | null
9
- translationLanguageCode?: string | null
10
- }
11
-
12
- export type TranslateFxParams = {
13
- cacheKey: string
14
- text: string
15
- }
16
-
17
- export type Replacement = {
18
- placeholder: string
19
- original: string
20
- leftPad?: boolean
21
- rightPad?: boolean
22
- }
23
-
24
- export type MaskSegmentParams = {
25
- text: string
26
- regex: RegExp
27
- placeholder: string
28
- replacements: Replacement[]
29
- shouldSkip?: (match: string) => boolean
30
- }
@@ -1,37 +0,0 @@
1
- import { COLORS, Loader, LoaderColor, LoaderSize, Typography } from '@magmamath/react-native-ui'
2
- import React from 'react'
3
- import { StyleSheet, View } from 'react-native'
4
-
5
- type VoiceTranscriptContentProps = {
6
- text: string
7
- isLoading: boolean
8
- }
9
-
10
- export const VoiceTranscriptContent = ({ text, isLoading }: VoiceTranscriptContentProps) => {
11
- if (isLoading) {
12
- return (
13
- <View style={styles.loaderContainer}>
14
- <Loader size={LoaderSize.SMALL} color={LoaderColor.BLUE} />
15
- </View>
16
- )
17
- }
18
-
19
- return (
20
- <Typography variant="h8" style={styles.text}>
21
- {text}
22
- </Typography>
23
- )
24
- }
25
-
26
- const styles = StyleSheet.create({
27
- text: {
28
- color: COLORS.NEUTRAL_7,
29
- paddingHorizontal: 8,
30
- paddingVertical: 8,
31
- },
32
- loaderContainer: {
33
- justifyContent: 'center',
34
- alignItems: 'center',
35
- paddingVertical: 8,
36
- },
37
- })
@@ -1,172 +0,0 @@
1
- import { Typography, COLORS } from '@magmamath/react-native-ui'
2
- import { useUnit } from 'effector-react'
3
- import React, { useCallback, useEffect, useMemo } from 'react'
4
- import { useTranslation } from 'react-i18next'
5
- import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native'
6
- import Animated from 'react-native-reanimated'
7
- import { NO_AUDIO_BE_MESSAGE } from '../../constants'
8
- import { getActiveAttempt } from '../../helpers'
9
- import { AnswerAudio, VoiceTranscriptionVariant } from '../../types'
10
- import { resolveGoogleLanguageCode } from '../../../translation/providers/google/supportedLanguages'
11
- import { useText } from '../../../../i18n/i18n'
12
- import { useVoiceTranscriptionEffects } from '../hooks/useVoiceTranscriptionEffects'
13
- import { VoicePlayerModel } from '../model'
14
- import { VoiceTranscriptContent } from './VoiceTranscriptContent'
15
- import { VoiceTranscriptionCollapsible } from './VoiceTranscriptionCollapsible'
16
- import { VoiceTranscriptionHeaderActions } from './VoiceTranscriptionHeaderActions'
17
-
18
- type VoiceTranscriptionProps = {
19
- style?: StyleProp<ViewStyle>
20
- model: VoicePlayerModel
21
- answers: AnswerAudio[]
22
- attemptOffset: number
23
- attemptsCount: number
24
- problemId: string
25
- variant?: VoiceTranscriptionVariant
26
- }
27
-
28
- export const VoiceTranscription = ({
29
- style,
30
- model,
31
- answers,
32
- attemptOffset,
33
- attemptsCount,
34
- problemId,
35
- variant = VoiceTranscriptionVariant.SMALL,
36
- }: VoiceTranscriptionProps) => {
37
- const t = useText()
38
- const { i18n } = useTranslation()
39
-
40
- const [
41
- playerState,
42
- isLoadingTranscripts,
43
- isTranslationActive,
44
- translations,
45
- isTranslating,
46
- ] = useUnit([
47
- model.$playerState,
48
- model.loader.loadAllTranscripts.pending,
49
- model.translation.$isActive,
50
- model.translation.$translations,
51
- model.translation.translate.pending,
52
- ])
53
-
54
- const activeAttempt = getActiveAttempt(attemptOffset, attemptsCount)
55
- const isLargeVariant = variant === VoiceTranscriptionVariant.LARGE
56
-
57
- const answersKey = useMemo(
58
- () => answers.map((a) => `${a._id}:${a.audioFileId ?? ''}`).join(','),
59
- [answers],
60
- )
61
-
62
- useVoiceTranscriptionEffects({ model, answers, answersKey, problemId, activeAttempt })
63
-
64
- const hasActiveAudio =
65
- activeAttempt !== null && answers?.[activeAttempt - 1]?.audioFileId !== undefined
66
-
67
- const activeTranscript = activeAttempt !== null ? model.loader.getTranscript(activeAttempt) : null
68
- const hasTranscriptText = !!activeTranscript && activeTranscript !== NO_AUDIO_BE_MESSAGE
69
- const isActiveTranscriptLoading = isLoadingTranscripts && hasActiveAudio && !activeTranscript
70
-
71
- const transcriptLanguage =
72
- activeAttempt !== null ? model.loader.getTranscriptLanguage(activeAttempt) : undefined
73
- const isSourceSameAsTarget =
74
- !!transcriptLanguage &&
75
- resolveGoogleLanguageCode(transcriptLanguage) === resolveGoogleLanguageCode(i18n.language)
76
-
77
- const canTranslate = hasTranscriptText && !isSourceSameAsTarget
78
-
79
- const cachedTranslation = activeAttempt !== null ? translations[activeAttempt] : undefined
80
- const showTranslation = isTranslationActive && canTranslate
81
- const isTranslationLoading = showTranslation && !cachedTranslation && isTranslating
82
-
83
- const displayText = showTranslation
84
- ? cachedTranslation ?? activeTranscript!
85
- : hasTranscriptText
86
- ? activeTranscript!
87
- : t('voice.transcriptNotAvailable')
88
-
89
- useEffect(() => {
90
- if (showTranslation && activeAttempt !== null && !cachedTranslation && !isTranslating) {
91
- model.translation.translate({
92
- attemptNumber: activeAttempt,
93
- targetLanguage: i18n.language,
94
- })
95
- }
96
- }, [showTranslation, activeAttempt, cachedTranslation, isTranslating, i18n.language, model])
97
-
98
- const handlePlayPress = useCallback(() => {
99
- if (activeAttempt) {
100
- model.translation.setActive(false)
101
- model.togglePlayPause(activeAttempt)
102
- }
103
- }, [model, activeAttempt])
104
-
105
- const handleTranslationToggle = useCallback(() => {
106
- model.translation.toggle()
107
- }, [model])
108
-
109
- return (
110
- <Animated.View style={[styles.container, isLargeVariant && styles.largeContainer, style]}>
111
- <View style={styles.header}>
112
- <Typography style={styles.title} variant="h7">
113
- {t('voice.transcriptions')}
114
- </Typography>
115
- {hasActiveAudio && (
116
- <VoiceTranscriptionHeaderActions
117
- playerState={playerState}
118
- isTranslationActive={isTranslationActive}
119
- canTranslate={canTranslate}
120
- onPlayPress={handlePlayPress}
121
- onTranslationPress={handleTranslationToggle}
122
- />
123
- )}
124
- </View>
125
-
126
- {isLargeVariant ? (
127
- <VoiceTranscriptContent
128
- text={displayText}
129
- isLoading={isActiveTranscriptLoading || isTranslationLoading}
130
- />
131
- ) : (
132
- <VoiceTranscriptionCollapsible
133
- text={displayText}
134
- isLoading={isActiveTranscriptLoading || isTranslationLoading}
135
- dropdown={model.dropdown}
136
- />
137
- )}
138
- </Animated.View>
139
- )
140
- }
141
-
142
- const styles = StyleSheet.create({
143
- container: {
144
- position: 'absolute',
145
- top: 56,
146
- left: 8,
147
- width: 222,
148
- maxHeight: 405,
149
- minHeight: 51,
150
- padding: 4,
151
- boxShadow: '0px 1px 3px 0px rgba(51, 51, 51, 0.25)',
152
- borderRadius: 12,
153
- backgroundColor: COLORS.NEUTRAL_1,
154
- overflow: 'hidden',
155
- },
156
- largeContainer: {
157
- width: '98%',
158
- height: '100%',
159
- },
160
- header: {
161
- flexDirection: 'row',
162
- justifyContent: 'space-between',
163
- alignItems: 'center',
164
- padding: 4,
165
- marginBottom: 4,
166
- height: 32,
167
- },
168
- title: {
169
- color: COLORS.NEUTRAL_9,
170
- marginLeft: 4,
171
- },
172
- })
@@ -1,59 +0,0 @@
1
- import { CaretDownIcon } from '@magmamath/react-native-ui'
2
- import React, { useCallback } from 'react'
3
- import { StyleSheet, TouchableOpacity, View } from 'react-native'
4
- import Animated from 'react-native-reanimated'
5
- import { useVoiceTranscriptionDropdown } from '../hooks/useVoiceTranscription'
6
- import { VoiceTranscriptionModel } from '../model/VoiceTranscription.model'
7
- import { VoiceTranscriptContent } from './VoiceTranscriptContent'
8
-
9
- const AnimatedTouchableOpacity = Animated.createAnimatedComponent(TouchableOpacity)
10
-
11
- type VoiceTranscriptionCollapsibleProps = {
12
- text: string
13
- isLoading: boolean
14
- dropdown: VoiceTranscriptionModel
15
- }
16
-
17
- export const VoiceTranscriptionCollapsible = ({
18
- text,
19
- isLoading,
20
- dropdown,
21
- }: VoiceTranscriptionCollapsibleProps) => {
22
- const { listAnimatedStyle, iconAnimatedStyle, onListLayout } =
23
- useVoiceTranscriptionDropdown(dropdown)
24
-
25
- const handleToggle = useCallback(() => {
26
- dropdown.toggleExpand()
27
- }, [dropdown])
28
-
29
- return (
30
- <>
31
- <Animated.View style={[listAnimatedStyle, styles.collapsibleContent]}>
32
- <View onLayout={onListLayout} style={styles.transcriptContainer}>
33
- <VoiceTranscriptContent text={text} isLoading={isLoading} />
34
- </View>
35
- </Animated.View>
36
- <AnimatedTouchableOpacity
37
- style={[styles.expandButton, iconAnimatedStyle]}
38
- onPress={handleToggle}
39
- >
40
- <CaretDownIcon size={22} />
41
- </AnimatedTouchableOpacity>
42
- </>
43
- )
44
- }
45
-
46
- const styles = StyleSheet.create({
47
- collapsibleContent: {
48
- overflow: 'hidden',
49
- },
50
- transcriptContainer: {
51
- position: 'absolute',
52
- width: '100%',
53
- paddingHorizontal: 4,
54
- },
55
- expandButton: {
56
- justifyContent: 'center',
57
- alignItems: 'center',
58
- },
59
- })
@@ -1,62 +0,0 @@
1
- import { Button, COLORS, GlobeIcon, SPACING } from '@magmamath/react-native-ui'
2
- import React from 'react'
3
- import { StyleSheet } from 'react-native'
4
- import Animated, { FadeIn, FadeOut } from 'react-native-reanimated'
5
- import { ColorScheme } from '../../../chatbot/types/style.types'
6
- import { PlayButton } from '../../../../shared/components/PlayButton'
7
- import { PlayerState } from '../model'
8
- import { getAudioStatus } from '../../helpers'
9
-
10
- type VoiceTranscriptionsHeaderActionsProps = {
11
- playerState: PlayerState
12
- isTranslationActive: boolean
13
- canTranslate: boolean
14
- onPlayPress: () => void
15
- onTranslationPress: () => void
16
- }
17
-
18
- export const VoiceTranscriptionHeaderActions = ({
19
- playerState,
20
- isTranslationActive,
21
- canTranslate,
22
- onPlayPress,
23
- onTranslationPress,
24
- }: VoiceTranscriptionsHeaderActionsProps) => {
25
- const playButtonState = {
26
- isActive: playerState !== PlayerState.IDLE,
27
- isLoading: playerState === PlayerState.LOADING,
28
- status: getAudioStatus(playerState),
29
- }
30
-
31
- return (
32
- <Animated.View
33
- entering={FadeIn.duration(120)}
34
- exiting={FadeOut.duration(120)}
35
- style={styles.container}
36
- >
37
- <PlayButton
38
- state={playButtonState}
39
- onPress={onPlayPress}
40
- activityIndicatorColor={COLORS.NEUTRAL_1}
41
- />
42
- {canTranslate && (
43
- <Button
44
- variant="secondary"
45
- size="small"
46
- colorScheme={ColorScheme.Blue}
47
- isActive={isTranslationActive}
48
- onPress={onTranslationPress}
49
- icon={<GlobeIcon color={isTranslationActive ? COLORS.NEUTRAL_1 : COLORS.NEUTRAL_9} />}
50
- />
51
- )}
52
- </Animated.View>
53
- )
54
- }
55
-
56
- const styles = StyleSheet.create({
57
- container: {
58
- flexDirection: 'row',
59
- alignItems: 'center',
60
- gap: SPACING[200],
61
- },
62
- })