@magmamath/students-features 1.3.22 → 1.3.23-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 (270) hide show
  1. package/dist/commonjs/features/translation/constants.js +11 -0
  2. package/dist/commonjs/features/translation/constants.js.map +1 -0
  3. package/dist/commonjs/features/translation/helpers.js +60 -0
  4. package/dist/commonjs/features/translation/helpers.js.map +1 -0
  5. package/dist/commonjs/features/translation/index.js +105 -0
  6. package/dist/commonjs/features/translation/index.js.map +1 -0
  7. package/dist/commonjs/features/translation/model/TranslationModel.js +122 -0
  8. package/dist/commonjs/features/translation/model/TranslationModel.js.map +1 -0
  9. package/dist/commonjs/features/translation/model/TranslationPreprocessor.js +142 -0
  10. package/dist/commonjs/features/translation/model/TranslationPreprocessor.js.map +1 -0
  11. package/dist/commonjs/features/translation/model/TranslationService.js +112 -0
  12. package/dist/commonjs/features/translation/model/TranslationService.js.map +1 -0
  13. package/dist/commonjs/features/translation/preserve/wordsToPreserve.js +314 -0
  14. package/dist/commonjs/features/translation/preserve/wordsToPreserve.js.map +1 -0
  15. package/dist/commonjs/features/translation/providers/google/GoogleTranslationProvider.js +50 -0
  16. package/dist/commonjs/features/translation/providers/google/GoogleTranslationProvider.js.map +1 -0
  17. package/dist/commonjs/features/translation/providers/google/supportedLanguages.js +230 -0
  18. package/dist/commonjs/features/translation/providers/google/supportedLanguages.js.map +1 -0
  19. package/dist/commonjs/features/translation/providers/google.types.js +2 -0
  20. package/dist/commonjs/features/translation/providers/google.types.js.map +1 -0
  21. package/dist/commonjs/features/translation/providers/translation.interface.js +49 -0
  22. package/dist/commonjs/features/translation/providers/translation.interface.js.map +1 -0
  23. package/dist/commonjs/features/translation/types.js +2 -0
  24. package/dist/commonjs/features/translation/types.js.map +1 -0
  25. package/dist/commonjs/features/voice/index.js +4 -4
  26. package/dist/commonjs/features/voice/index.js.map +1 -1
  27. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptContent.js +44 -0
  28. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptContent.js.map +1 -0
  29. package/dist/commonjs/features/voice/playing/components/VoiceTranscription.js +142 -0
  30. package/dist/commonjs/features/voice/playing/components/VoiceTranscription.js.map +1 -0
  31. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.js +66 -0
  32. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.js.map +1 -0
  33. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.js +59 -0
  34. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.js.map +1 -0
  35. package/dist/commonjs/features/voice/playing/hooks/{useVoiceTranscriptionsDropdown.js → useVoiceTranscription.js} +4 -4
  36. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscription.js.map +1 -0
  37. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionAutoTranslate.js +26 -0
  38. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionAutoTranslate.js.map +1 -0
  39. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionEffects.js +37 -0
  40. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionEffects.js.map +1 -0
  41. package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.js +18 -4
  42. package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.js.map +1 -1
  43. package/dist/commonjs/features/voice/playing/model/VoicePlayer.model.js +6 -2
  44. package/dist/commonjs/features/voice/playing/model/VoicePlayer.model.js.map +1 -1
  45. package/dist/commonjs/features/voice/playing/model/{VoiceTranscriptionsDropdown.model.js → VoiceTranscription.model.js} +4 -4
  46. package/dist/commonjs/features/voice/playing/model/VoiceTranscription.model.js.map +1 -0
  47. package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionTranslation.model.js +62 -0
  48. package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionTranslation.model.js.map +1 -0
  49. package/dist/commonjs/features/voice/types.js +6 -1
  50. package/dist/commonjs/features/voice/types.js.map +1 -1
  51. package/dist/commonjs/index.js +12 -0
  52. package/dist/commonjs/index.js.map +1 -1
  53. package/dist/module/features/translation/constants.js +7 -0
  54. package/dist/module/features/translation/constants.js.map +1 -0
  55. package/dist/module/features/translation/helpers.js +53 -0
  56. package/dist/module/features/translation/helpers.js.map +1 -0
  57. package/dist/module/features/translation/index.js +12 -0
  58. package/dist/module/features/translation/index.js.map +1 -0
  59. package/dist/module/features/translation/model/TranslationModel.js +117 -0
  60. package/dist/module/features/translation/model/TranslationModel.js.map +1 -0
  61. package/dist/module/features/translation/model/TranslationPreprocessor.js +137 -0
  62. package/dist/module/features/translation/model/TranslationPreprocessor.js.map +1 -0
  63. package/dist/module/features/translation/model/TranslationService.js +107 -0
  64. package/dist/module/features/translation/model/TranslationService.js.map +1 -0
  65. package/dist/module/features/translation/preserve/wordsToPreserve.js +310 -0
  66. package/dist/module/features/translation/preserve/wordsToPreserve.js.map +1 -0
  67. package/dist/module/features/translation/providers/google/GoogleTranslationProvider.js +45 -0
  68. package/dist/module/features/translation/providers/google/GoogleTranslationProvider.js.map +1 -0
  69. package/dist/module/features/translation/providers/google/supportedLanguages.js +225 -0
  70. package/dist/module/features/translation/providers/google/supportedLanguages.js.map +1 -0
  71. package/dist/module/features/translation/providers/google.types.js +2 -0
  72. package/dist/module/features/translation/providers/google.types.js.map +1 -0
  73. package/dist/module/features/translation/providers/translation.interface.js +44 -0
  74. package/dist/module/features/translation/providers/translation.interface.js.map +1 -0
  75. package/dist/module/features/translation/types.js +2 -0
  76. package/dist/module/features/translation/types.js.map +1 -0
  77. package/dist/module/features/voice/index.js +1 -1
  78. package/dist/module/features/voice/index.js.map +1 -1
  79. package/dist/module/features/voice/playing/components/VoiceTranscriptContent.js +38 -0
  80. package/dist/module/features/voice/playing/components/VoiceTranscriptContent.js.map +1 -0
  81. package/dist/module/features/voice/playing/components/VoiceTranscription.js +134 -0
  82. package/dist/module/features/voice/playing/components/VoiceTranscription.js.map +1 -0
  83. package/dist/module/features/voice/playing/components/VoiceTranscriptionCollapsible.js +58 -0
  84. package/dist/module/features/voice/playing/components/VoiceTranscriptionCollapsible.js.map +1 -0
  85. package/dist/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.js +51 -0
  86. package/dist/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.js.map +1 -0
  87. package/dist/module/features/voice/playing/hooks/{useVoiceTranscriptionsDropdown.js → useVoiceTranscription.js} +2 -2
  88. package/dist/module/features/voice/playing/hooks/useVoiceTranscription.js.map +1 -0
  89. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionAutoTranslate.js +21 -0
  90. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionAutoTranslate.js.map +1 -0
  91. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionEffects.js +32 -0
  92. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionEffects.js.map +1 -0
  93. package/dist/module/features/voice/playing/model/TranscriptionsDownloaderModel.js +18 -4
  94. package/dist/module/features/voice/playing/model/TranscriptionsDownloaderModel.js.map +1 -1
  95. package/dist/module/features/voice/playing/model/VoicePlayer.model.js +6 -2
  96. package/dist/module/features/voice/playing/model/VoicePlayer.model.js.map +1 -1
  97. package/dist/module/features/voice/playing/model/{VoiceTranscriptionsDropdown.model.js → VoiceTranscription.model.js} +2 -2
  98. package/dist/module/features/voice/playing/model/VoiceTranscription.model.js.map +1 -0
  99. package/dist/module/features/voice/playing/model/VoiceTranscriptionTranslation.model.js +57 -0
  100. package/dist/module/features/voice/playing/model/VoiceTranscriptionTranslation.model.js.map +1 -0
  101. package/dist/module/features/voice/types.js +5 -0
  102. package/dist/module/features/voice/types.js.map +1 -1
  103. package/dist/module/index.js +1 -0
  104. package/dist/module/index.js.map +1 -1
  105. package/dist/typescript/commonjs/features/translation/constants.d.ts +5 -0
  106. package/dist/typescript/commonjs/features/translation/constants.d.ts.map +1 -0
  107. package/dist/typescript/commonjs/features/translation/helpers.d.ts +9 -0
  108. package/dist/typescript/commonjs/features/translation/helpers.d.ts.map +1 -0
  109. package/dist/typescript/commonjs/features/translation/index.d.ts +12 -0
  110. package/dist/typescript/commonjs/features/translation/index.d.ts.map +1 -0
  111. package/dist/typescript/commonjs/features/translation/model/TranslationModel.d.ts +33 -0
  112. package/dist/typescript/commonjs/features/translation/model/TranslationModel.d.ts.map +1 -0
  113. package/dist/typescript/commonjs/features/translation/model/TranslationPreprocessor.d.ts +34 -0
  114. package/dist/typescript/commonjs/features/translation/model/TranslationPreprocessor.d.ts.map +1 -0
  115. package/dist/typescript/commonjs/features/translation/model/TranslationService.d.ts +40 -0
  116. package/dist/typescript/commonjs/features/translation/model/TranslationService.d.ts.map +1 -0
  117. package/dist/typescript/commonjs/features/translation/preserve/wordsToPreserve.d.ts +3 -0
  118. package/dist/typescript/commonjs/features/translation/preserve/wordsToPreserve.d.ts.map +1 -0
  119. package/dist/typescript/commonjs/features/translation/providers/google/GoogleTranslationProvider.d.ts +17 -0
  120. package/dist/typescript/commonjs/features/translation/providers/google/GoogleTranslationProvider.d.ts.map +1 -0
  121. package/dist/typescript/commonjs/features/translation/providers/google/supportedLanguages.d.ts +209 -0
  122. package/dist/typescript/commonjs/features/translation/providers/google/supportedLanguages.d.ts.map +1 -0
  123. package/dist/typescript/commonjs/features/translation/providers/google.types.d.ts +15 -0
  124. package/dist/typescript/commonjs/features/translation/providers/google.types.d.ts.map +1 -0
  125. package/dist/typescript/commonjs/features/translation/providers/translation.interface.d.ts +30 -0
  126. package/dist/typescript/commonjs/features/translation/providers/translation.interface.d.ts.map +1 -0
  127. package/dist/typescript/commonjs/features/translation/types.d.ts +27 -0
  128. package/dist/typescript/commonjs/features/translation/types.d.ts.map +1 -0
  129. package/dist/typescript/commonjs/features/voice/index.d.ts +1 -1
  130. package/dist/typescript/commonjs/features/voice/index.d.ts.map +1 -1
  131. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptContent.d.ts +8 -0
  132. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptContent.d.ts.map +1 -0
  133. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscription.d.ts +16 -0
  134. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscription.d.ts.map +1 -0
  135. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts +10 -0
  136. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts.map +1 -0
  137. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts +12 -0
  138. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts.map +1 -0
  139. package/dist/typescript/{module/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.d.ts → commonjs/features/voice/playing/hooks/useVoiceTranscription.d.ts} +3 -3
  140. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscription.d.ts.map +1 -0
  141. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionAutoTranslate.d.ts +10 -0
  142. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionAutoTranslate.d.ts.map +1 -0
  143. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionEffects.d.ts +12 -0
  144. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionEffects.d.ts.map +1 -0
  145. package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts +1 -0
  146. package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts.map +1 -1
  147. package/dist/typescript/commonjs/features/voice/playing/model/VoicePlayer.model.d.ts +4 -2
  148. package/dist/typescript/commonjs/features/voice/playing/model/VoicePlayer.model.d.ts.map +1 -1
  149. package/dist/typescript/commonjs/features/voice/playing/model/{VoiceTranscriptionsDropdown.model.d.ts → VoiceTranscription.model.d.ts} +2 -2
  150. package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscription.model.d.ts.map +1 -0
  151. package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionTranslation.model.d.ts +25 -0
  152. package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionTranslation.model.d.ts.map +1 -0
  153. package/dist/typescript/commonjs/features/voice/types.d.ts +9 -1
  154. package/dist/typescript/commonjs/features/voice/types.d.ts.map +1 -1
  155. package/dist/typescript/commonjs/index.d.ts +1 -0
  156. package/dist/typescript/commonjs/index.d.ts.map +1 -1
  157. package/dist/typescript/module/features/translation/constants.d.ts +5 -0
  158. package/dist/typescript/module/features/translation/constants.d.ts.map +1 -0
  159. package/dist/typescript/module/features/translation/helpers.d.ts +9 -0
  160. package/dist/typescript/module/features/translation/helpers.d.ts.map +1 -0
  161. package/dist/typescript/module/features/translation/index.d.ts +12 -0
  162. package/dist/typescript/module/features/translation/index.d.ts.map +1 -0
  163. package/dist/typescript/module/features/translation/model/TranslationModel.d.ts +33 -0
  164. package/dist/typescript/module/features/translation/model/TranslationModel.d.ts.map +1 -0
  165. package/dist/typescript/module/features/translation/model/TranslationPreprocessor.d.ts +34 -0
  166. package/dist/typescript/module/features/translation/model/TranslationPreprocessor.d.ts.map +1 -0
  167. package/dist/typescript/module/features/translation/model/TranslationService.d.ts +40 -0
  168. package/dist/typescript/module/features/translation/model/TranslationService.d.ts.map +1 -0
  169. package/dist/typescript/module/features/translation/preserve/wordsToPreserve.d.ts +3 -0
  170. package/dist/typescript/module/features/translation/preserve/wordsToPreserve.d.ts.map +1 -0
  171. package/dist/typescript/module/features/translation/providers/google/GoogleTranslationProvider.d.ts +17 -0
  172. package/dist/typescript/module/features/translation/providers/google/GoogleTranslationProvider.d.ts.map +1 -0
  173. package/dist/typescript/module/features/translation/providers/google/supportedLanguages.d.ts +209 -0
  174. package/dist/typescript/module/features/translation/providers/google/supportedLanguages.d.ts.map +1 -0
  175. package/dist/typescript/module/features/translation/providers/google.types.d.ts +15 -0
  176. package/dist/typescript/module/features/translation/providers/google.types.d.ts.map +1 -0
  177. package/dist/typescript/module/features/translation/providers/translation.interface.d.ts +30 -0
  178. package/dist/typescript/module/features/translation/providers/translation.interface.d.ts.map +1 -0
  179. package/dist/typescript/module/features/translation/types.d.ts +27 -0
  180. package/dist/typescript/module/features/translation/types.d.ts.map +1 -0
  181. package/dist/typescript/module/features/voice/index.d.ts +1 -1
  182. package/dist/typescript/module/features/voice/index.d.ts.map +1 -1
  183. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptContent.d.ts +8 -0
  184. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptContent.d.ts.map +1 -0
  185. package/dist/typescript/module/features/voice/playing/components/VoiceTranscription.d.ts +16 -0
  186. package/dist/typescript/module/features/voice/playing/components/VoiceTranscription.d.ts.map +1 -0
  187. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts +10 -0
  188. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts.map +1 -0
  189. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts +12 -0
  190. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts.map +1 -0
  191. package/dist/typescript/{commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.d.ts → module/features/voice/playing/hooks/useVoiceTranscription.d.ts} +3 -3
  192. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscription.d.ts.map +1 -0
  193. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionAutoTranslate.d.ts +10 -0
  194. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionAutoTranslate.d.ts.map +1 -0
  195. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionEffects.d.ts +12 -0
  196. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionEffects.d.ts.map +1 -0
  197. package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts +1 -0
  198. package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts.map +1 -1
  199. package/dist/typescript/module/features/voice/playing/model/VoicePlayer.model.d.ts +4 -2
  200. package/dist/typescript/module/features/voice/playing/model/VoicePlayer.model.d.ts.map +1 -1
  201. package/dist/typescript/module/features/voice/playing/model/{VoiceTranscriptionsDropdown.model.d.ts → VoiceTranscription.model.d.ts} +2 -2
  202. package/dist/typescript/module/features/voice/playing/model/VoiceTranscription.model.d.ts.map +1 -0
  203. package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionTranslation.model.d.ts +25 -0
  204. package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionTranslation.model.d.ts.map +1 -0
  205. package/dist/typescript/module/features/voice/types.d.ts +9 -1
  206. package/dist/typescript/module/features/voice/types.d.ts.map +1 -1
  207. package/dist/typescript/module/index.d.ts +1 -0
  208. package/dist/typescript/module/index.d.ts.map +1 -1
  209. package/package.json +1 -1
  210. package/src/features/translation/constants.ts +4 -0
  211. package/src/features/translation/helpers.ts +63 -0
  212. package/src/features/translation/index.ts +30 -0
  213. package/src/features/translation/model/TranslationModel.ts +174 -0
  214. package/src/features/translation/model/TranslationPreprocessor.ts +171 -0
  215. package/src/features/translation/model/TranslationService.ts +148 -0
  216. package/src/features/translation/preserve/wordsToPreserve.ts +87 -0
  217. package/src/features/translation/providers/google/GoogleTranslationProvider.ts +50 -0
  218. package/src/features/translation/providers/google/supportedLanguages.ts +229 -0
  219. package/src/features/translation/providers/google.types.ts +16 -0
  220. package/src/features/translation/providers/translation.interface.ts +63 -0
  221. package/src/features/translation/types.ts +30 -0
  222. package/src/features/voice/index.ts +1 -1
  223. package/src/features/voice/playing/components/VoiceTranscriptContent.tsx +37 -0
  224. package/src/features/voice/playing/components/VoiceTranscription.tsx +175 -0
  225. package/src/features/voice/playing/components/VoiceTranscriptionCollapsible.tsx +59 -0
  226. package/src/features/voice/playing/components/VoiceTranscriptionHeaderActions.tsx +62 -0
  227. package/src/features/voice/playing/hooks/{useVoiceTranscriptionsDropdown.ts → useVoiceTranscription.ts} +2 -2
  228. package/src/features/voice/playing/hooks/useVoiceTranscriptionAutoTranslate.ts +32 -0
  229. package/src/features/voice/playing/hooks/useVoiceTranscriptionEffects.ts +44 -0
  230. package/src/features/voice/playing/model/TranscriptionsDownloaderModel.ts +12 -5
  231. package/src/features/voice/playing/model/VoicePlayer.model.ts +7 -2
  232. package/src/features/voice/playing/model/{VoiceTranscriptionsDropdown.model.ts → VoiceTranscription.model.ts} +2 -2
  233. package/src/features/voice/playing/model/VoiceTranscriptionTranslation.model.ts +75 -0
  234. package/src/features/voice/types.ts +15 -0
  235. package/src/index.ts +1 -0
  236. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.js +0 -245
  237. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.js.map +0 -1
  238. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js +0 -109
  239. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js.map +0 -1
  240. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.js.map +0 -1
  241. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.js +0 -34
  242. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.js.map +0 -1
  243. package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionsDropdown.model.js.map +0 -1
  244. package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdown.js +0 -238
  245. package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdown.js.map +0 -1
  246. package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js +0 -103
  247. package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js.map +0 -1
  248. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.js.map +0 -1
  249. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.js +0 -29
  250. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.js.map +0 -1
  251. package/dist/module/features/voice/playing/model/VoiceTranscriptionsDropdown.model.js.map +0 -1
  252. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts +0 -16
  253. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts.map +0 -1
  254. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdownItem.d.ts +0 -12
  255. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdownItem.d.ts.map +0 -1
  256. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.d.ts.map +0 -1
  257. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.d.ts +0 -11
  258. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.d.ts.map +0 -1
  259. package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionsDropdown.model.d.ts.map +0 -1
  260. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts +0 -16
  261. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts.map +0 -1
  262. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionsDropdownItem.d.ts +0 -12
  263. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionsDropdownItem.d.ts.map +0 -1
  264. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.d.ts.map +0 -1
  265. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.d.ts +0 -11
  266. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.d.ts.map +0 -1
  267. package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionsDropdown.model.d.ts.map +0 -1
  268. package/src/features/voice/playing/components/VoiceTranscriptionsDropdown.tsx +0 -296
  269. package/src/features/voice/playing/components/VoiceTranscriptionsDropdownItem.tsx +0 -128
  270. package/src/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.ts +0 -40
@@ -1,296 +0,0 @@
1
- import {
2
- Typography,
3
- ScrollableList,
4
- CaretDownIcon,
5
- COLORS,
6
- IS_WEB,
7
- ScrollableListScrollView,
8
- } from '@magmamath/react-native-ui'
9
- import { useUnit } from 'effector-react'
10
- import React, { useRef, useEffect, useState, useCallback, useMemo } from 'react'
11
- import {
12
- TouchableOpacity,
13
- StyleProp,
14
- ViewStyle,
15
- FlatList,
16
- LayoutChangeEvent,
17
- ScrollView,
18
- View,
19
- StyleSheet,
20
- } from 'react-native'
21
- import Animated, { FadeIn, FadeOut } from 'react-native-reanimated'
22
- import { AnswerAudio, VoiceTranscriptionItem } from '../../types'
23
- import { useVoiceTranscriptionsDropdown } from '../hooks/useVoiceTranscriptionsDropdown'
24
- import { VoicePlayerModel, PlayerState } from '../model'
25
- import { VoiceTranscriptionsDropdownItem } from './VoiceTranscriptionsDropdownItem'
26
- import { DROPDOWN_MAX_CONTENT_HEIGHT, NO_AUDIO_BE_MESSAGE } from '../../constants'
27
- import { useText } from '../../../../i18n/i18n'
28
- import { PlayButton } from '../../../../shared/components/PlayButton'
29
- import { getActiveAttempt, getAudioStatus } from '../../helpers'
30
-
31
- const AnimatedTouchableOpacity = Animated.createAnimatedComponent(TouchableOpacity)
32
-
33
- type VoiceTranscriptionsDropdownProps = {
34
- style?: StyleProp<ViewStyle>
35
- model: VoicePlayerModel
36
- answers: AnswerAudio[]
37
- attemptOffset: number
38
- onAttemptOffsetChange: (offset: number) => void
39
- attemptsCount: number
40
- problemId: string
41
- }
42
-
43
- export const VoiceTranscriptionsDropdown = ({
44
- style,
45
- model,
46
- answers,
47
- attemptOffset,
48
- onAttemptOffsetChange,
49
- attemptsCount,
50
- problemId,
51
- }: VoiceTranscriptionsDropdownProps) => {
52
- const [attempts, setAttempts] = useState<VoiceTranscriptionItem[]>([])
53
-
54
- const scrollRef = useRef<FlatList | null>(null)
55
- const scrollViewRef = useRef<ScrollView | null>(null)
56
- const itemLayoutsRef = useRef<Map<string, number>>(new Map())
57
- const answersRef = useRef(answers)
58
- answersRef.current = answers
59
-
60
- const t = useText()
61
-
62
- const [currentAttempt, transcriptsLoaded, playerState, isDropdownExpanded] = useUnit([
63
- model.$currentAttempt,
64
- model.loader.$transcriptsLoaded,
65
- model.$playerState,
66
- model.dropdown.$isExpanded,
67
- ])
68
-
69
- const activeAttempt = getActiveAttempt(attemptOffset, attemptsCount)
70
-
71
- const answersKey = useMemo(
72
- () => answers.map((a) => `${a._id}:${a.audioFileId ?? ''}`).join(','),
73
- [answers],
74
- )
75
-
76
- const hasActiveTranscript =
77
- activeAttempt !== null && answers?.[activeAttempt - 1]?.audioFileId !== undefined
78
-
79
- const playButtonState = {
80
- isActive: playerState !== PlayerState.IDLE,
81
- isLoading: playerState === PlayerState.LOADING,
82
- status: getAudioStatus(playerState),
83
- }
84
-
85
- const { listAnimatedStyle, iconAnimatedStyle, onListLayout } = useVoiceTranscriptionsDropdown(
86
- model.dropdown,
87
- )
88
-
89
- const handleItemLayout = useCallback((id: string, event: LayoutChangeEvent) => {
90
- itemLayoutsRef.current.set(id, event.nativeEvent.layout.y)
91
- }, [])
92
-
93
- const scrollToAttempt = useCallback(
94
- (attemptNumber: number) => {
95
- if (IS_WEB) {
96
- const item = attempts.find((item) => item.attemptNumber === attemptNumber)
97
- if (item) {
98
- const y = itemLayoutsRef.current.get(item._id)
99
- if (y !== undefined) {
100
- scrollViewRef.current?.scrollTo({ y, animated: true })
101
- }
102
- }
103
- return
104
- }
105
-
106
- const index = attempts.findIndex((item) => item.attemptNumber === attemptNumber)
107
- if (index !== -1) {
108
- scrollRef.current?.scrollToIndex({ index, animated: true, viewPosition: 0 })
109
- }
110
- },
111
- [attempts],
112
- )
113
-
114
- const handleItemToggle = useCallback(
115
- (attempt: number) => {
116
- if (onAttemptOffsetChange && attemptsCount !== undefined) {
117
- onAttemptOffsetChange(attemptsCount - attempt)
118
- }
119
- },
120
- [onAttemptOffsetChange, attemptsCount],
121
- )
122
-
123
- const handlePlayPress = useCallback(() => {
124
- if (activeAttempt) {
125
- model.togglePlayPause(activeAttempt)
126
- }
127
- }, [model, activeAttempt])
128
-
129
- const handleScrollToIndexFailed = useCallback((info: { index: number }) => {
130
- setTimeout(() => {
131
- scrollRef.current?.scrollToIndex({ index: info.index, animated: true, viewPosition: 0 })
132
- }, 100)
133
- }, [])
134
-
135
- useEffect(() => {
136
- model.reinitializePlayer()
137
- return () => model.cleanup()
138
- }, [model])
139
-
140
- useEffect(() => {
141
- const isLastAttemptsWithoutDrowing = !answers[answers.length - 1].drawing
142
- if (answers.length > 0 && isLastAttemptsWithoutDrowing) {
143
- model.dropdown.setExpanded(true)
144
- } else {
145
- model.dropdown.setExpanded(false)
146
- }
147
-
148
- model.resetPlayer()
149
- }, [problemId])
150
-
151
- useEffect(() => {
152
- if (answersRef.current.some((answer) => answer.audioFileId)) {
153
- model.initializeWithAudios(answersRef.current)
154
- model.loader.loadAllTranscripts()
155
- }
156
- }, [model, answersKey])
157
-
158
- useEffect(() => {
159
- model.stopAudio()
160
- }, [activeAttempt])
161
-
162
- useEffect(() => {
163
- const allAttempts = model.getAllAttempts()
164
- setAttempts(allAttempts)
165
- }, [answersKey, transcriptsLoaded, currentAttempt, model])
166
-
167
- useEffect(() => {
168
- if (isDropdownExpanded && activeAttempt !== null) {
169
- setTimeout(() => {
170
- scrollToAttempt(activeAttempt)
171
- }, 500)
172
- }
173
- }, [isDropdownExpanded, answersKey])
174
-
175
- const renderItem = useCallback(
176
- ({ item }: { item: VoiceTranscriptionItem }) => {
177
- const isLoading = model.loader.isTranscriptLoading(item.attemptNumber)
178
- const transcript = model.loader.getTranscript(item.attemptNumber)
179
- const isActive = activeAttempt === item.attemptNumber
180
-
181
- return (
182
- <VoiceTranscriptionsDropdownItem
183
- isLoading={isActive && isLoading}
184
- attempt={item.attemptNumber}
185
- content={
186
- transcript && transcript !== NO_AUDIO_BE_MESSAGE
187
- ? transcript
188
- : t('voice.transcriptNotAvailable')
189
- }
190
- isActive={isActive}
191
- onToggle={handleItemToggle}
192
- scrollToAttempt={scrollToAttempt}
193
- />
194
- )
195
- },
196
- [model, activeAttempt, t, handleItemToggle, scrollToAttempt],
197
- )
198
-
199
- return (
200
- <Animated.View style={[styles.container, style]}>
201
- <View style={styles.header}>
202
- <Typography style={styles.title} variant="h7">
203
- {t('voice.transcriptions')}
204
- </Typography>
205
- {hasActiveTranscript && (
206
- <Animated.View entering={FadeIn.duration(120)} exiting={FadeOut.duration(120)}>
207
- <PlayButton
208
- state={playButtonState}
209
- onPress={handlePlayPress}
210
- activityIndicatorColor={COLORS.NEUTRAL_1}
211
- />
212
- </Animated.View>
213
- )}
214
- </View>
215
-
216
- <Animated.View style={[listAnimatedStyle, { overflow: 'hidden' }]}>
217
- <View onLayout={onListLayout} style={styles.listContainer}>
218
- {IS_WEB ? (
219
- <ScrollableListScrollView
220
- bounces={false}
221
- ref={scrollViewRef}
222
- hideShadow
223
- style={styles.list}
224
- contentContainerStyle={styles.listContent}
225
- >
226
- {attempts.map((item) => (
227
- <View key={item._id} onLayout={(e) => handleItemLayout(item._id, e)}>
228
- {renderItem({ item })}
229
- </View>
230
- ))}
231
- </ScrollableListScrollView>
232
- ) : (
233
- <ScrollableList
234
- bounces={false}
235
- ref={scrollRef}
236
- hideShadow
237
- data={attempts}
238
- keyExtractor={(item) => item._id}
239
- onScrollToIndexFailed={handleScrollToIndexFailed}
240
- renderItem={renderItem}
241
- contentContainerStyle={styles.listContent}
242
- />
243
- )}
244
- </View>
245
- </Animated.View>
246
-
247
- <AnimatedTouchableOpacity
248
- style={[styles.expandButton, iconAnimatedStyle]}
249
- onPress={() => model.dropdown.toggleExpand()}
250
- >
251
- <CaretDownIcon size={22} />
252
- </AnimatedTouchableOpacity>
253
- </Animated.View>
254
- )
255
- }
256
-
257
- const styles = StyleSheet.create({
258
- container: {
259
- position: 'absolute',
260
- top: 56,
261
- left: 8,
262
- width: 222,
263
- maxHeight: 405,
264
- minHeight: 51,
265
- padding: 4,
266
- boxShadow: '0px 1px 3px 0px rgba(51, 51, 51, 0.25)',
267
- borderRadius: 12,
268
- backgroundColor: COLORS.NEUTRAL_1,
269
- overflow: 'hidden',
270
- },
271
- header: {
272
- flexDirection: 'row',
273
- justifyContent: 'space-between',
274
- alignItems: 'center',
275
- padding: 4,
276
- marginBottom: 4,
277
- height: 32,
278
- },
279
- title: {
280
- color: COLORS.NEUTRAL_9,
281
- marginLeft: 4,
282
- },
283
- list: { flex: 1 },
284
- expandButton: {
285
- justifyContent: 'center',
286
- alignItems: 'center',
287
- },
288
- listContainer: {
289
- position: 'absolute',
290
- maxHeight: DROPDOWN_MAX_CONTENT_HEIGHT,
291
- width: '100%',
292
- },
293
- listContent: {
294
- paddingHorizontal: 4,
295
- },
296
- })
@@ -1,128 +0,0 @@
1
- import { Pressable, StyleSheet, View } from 'react-native'
2
- import React, { memo, useCallback, useRef } from 'react'
3
- import {
4
- Button,
5
- ButtonSize,
6
- ButtonVariant,
7
- COLORS,
8
- Loader,
9
- LoaderColor,
10
- LoaderSize,
11
- Typography,
12
- } from '@magmamath/react-native-ui'
13
- import Animated, { runOnJS, useAnimatedReaction } from 'react-native-reanimated'
14
- import { useVoiceTranscriptionsDropdownItemAnimation } from '../hooks/useVoiceTranscriptionsDropdownItemAnimation'
15
- import { useText } from '../../../../i18n/i18n'
16
-
17
- type VoiceTranscriptionsDropdownItemProps = {
18
- attempt: number
19
- content: string
20
- isActive: boolean
21
- isLoading?: boolean
22
- onToggle: (attempt: number) => void
23
- scrollToAttempt: (attempt: number) => void
24
- }
25
-
26
- export const VoiceTranscriptionsDropdownItem = memo(
27
- ({
28
- attempt,
29
- content,
30
- isActive,
31
- isLoading,
32
- onToggle,
33
- scrollToAttempt,
34
- }: VoiceTranscriptionsDropdownItemProps) => {
35
- const t = useText()
36
- const isActiveRef = useRef(isActive)
37
- isActiveRef.current = isActive
38
-
39
- const { contentAnimatedStyle, onLayout, progress } =
40
- useVoiceTranscriptionsDropdownItemAnimation(isActive)
41
-
42
- const handleScrollToAttempt = useCallback(
43
- (attemptNumber: number) => {
44
- if (!isActiveRef.current) return
45
- scrollToAttempt(attemptNumber)
46
- },
47
- [scrollToAttempt],
48
- )
49
-
50
- useAnimatedReaction(
51
- () => progress.value,
52
- (progress) => {
53
- if (progress === 1 && isActive) {
54
- runOnJS(handleScrollToAttempt)(attempt)
55
- }
56
- },
57
- [progress, attempt, isActive],
58
- )
59
-
60
- return (
61
- <View style={styles.container}>
62
- <Pressable disabled={isActive} style={styles.itemHeader} onPress={() => onToggle(attempt)}>
63
- <Button
64
- onPress={() => !isActive && onToggle(attempt)}
65
- size={ButtonSize.SMALL}
66
- variant={ButtonVariant.TERTIARY}
67
- style={{
68
- text: {
69
- textTransform: 'uppercase',
70
- color: isActive ? COLORS.NEUTRAL_9 : COLORS.NEUTRAL_7,
71
- },
72
- }}
73
- >
74
- {t('voice.attempt', { number: String(attempt) })}
75
- </Button>
76
- </Pressable>
77
- {isLoading ? (
78
- <View style={styles.loaderContainer}>
79
- <Loader size={LoaderSize.SMALL} color={LoaderColor.BLUE} />
80
- </View>
81
- ) : (
82
- <Animated.View style={contentAnimatedStyle}>
83
- <View onLayout={onLayout} style={styles.contentWrapper}>
84
- <Typography
85
- variant="h8"
86
- style={[
87
- styles.itemContent,
88
- {
89
- color: isActive ? COLORS.NEUTRAL_9 : COLORS.NEUTRAL_7,
90
- },
91
- ]}
92
- >
93
- {content}
94
- </Typography>
95
- </View>
96
- </Animated.View>
97
- )}
98
- </View>
99
- )
100
- },
101
- )
102
-
103
- const styles = StyleSheet.create({
104
- container: {
105
- borderTopWidth: 1,
106
- borderColor: COLORS.NEUTRAL_3,
107
- },
108
- itemHeader: {
109
- flexDirection: 'row',
110
- justifyContent: 'space-between',
111
- alignItems: 'center',
112
- width: '100%',
113
- paddingVertical: 8,
114
- },
115
- itemContent: {
116
- paddingHorizontal: 8,
117
- },
118
- contentWrapper: {
119
- width: '100%',
120
- position: 'absolute',
121
- },
122
- loaderContainer: {
123
- justifyContent: 'center',
124
- alignItems: 'center',
125
- paddingTop: 4,
126
- paddingBottom: 8,
127
- },
128
- })
@@ -1,40 +0,0 @@
1
- import { useEffect } from 'react'
2
- import { LayoutChangeEvent } from 'react-native'
3
- import {
4
- useSharedValue,
5
- withTiming,
6
- useDerivedValue,
7
- useAnimatedStyle,
8
- interpolate,
9
- } from 'react-native-reanimated'
10
-
11
- export const useVoiceTranscriptionsDropdownItemAnimation = (isExpanded: boolean) => {
12
- const height = useSharedValue(0)
13
- const progress = useSharedValue(isExpanded ? 1 : 0)
14
-
15
- useEffect(() => {
16
- progress.value = withTiming(isExpanded ? 1 : 0)
17
- }, [isExpanded, progress])
18
-
19
- const derivedHeight = useDerivedValue(() => height.value * progress.value, [height, progress])
20
-
21
- const contentAnimatedStyle = useAnimatedStyle(() => {
22
- const opacity = interpolate(progress.value, [0, 0.3, 1], [0, 0, 1])
23
-
24
- return {
25
- height: derivedHeight.value,
26
- opacity,
27
- overflow: 'hidden',
28
- }
29
- }, [progress, derivedHeight])
30
-
31
- const onLayout = (event: LayoutChangeEvent) => {
32
- height.value = event.nativeEvent.layout.height
33
- }
34
-
35
- return {
36
- contentAnimatedStyle,
37
- onLayout,
38
- progress,
39
- }
40
- }