@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.
- package/dist/commonjs/features/voice/playing/components/VoiceTranscription.js +48 -39
- package/dist/commonjs/features/voice/playing/components/VoiceTranscription.js.map +1 -1
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.js +2 -2
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.js.map +1 -1
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.js +8 -7
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.js.map +1 -1
- package/dist/commonjs/features/voice/playing/hooks/{useDropdownAnimation.js → useVoiceTranscription.js} +7 -8
- package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscription.js.map +1 -0
- package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionEffects.js +37 -0
- package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionEffects.js.map +1 -0
- package/dist/commonjs/features/voice/playing/model/Player.model.js +1 -24
- package/dist/commonjs/features/voice/playing/model/Player.model.js.map +1 -1
- package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.js +66 -0
- package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.js.map +1 -0
- package/dist/commonjs/features/voice/playing/model/VoiceFileDownloader.model.js +2 -2
- package/dist/commonjs/features/voice/playing/model/VoiceFileDownloader.model.js.map +1 -1
- package/dist/commonjs/features/voice/playing/model/VoicePlayer.model.js +175 -46
- package/dist/commonjs/features/voice/playing/model/VoicePlayer.model.js.map +1 -1
- package/dist/commonjs/features/voice/playing/model/{Dropdown.model.js → VoiceTranscription.model.js} +4 -4
- package/dist/commonjs/features/voice/playing/model/VoiceTranscription.model.js.map +1 -0
- package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionTranslation.model.js +15 -0
- package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionTranslation.model.js.map +1 -0
- package/dist/commonjs/features/voice/playing/model/{TranscriptionsCollection.js → VoiceTranscriptionsCollection.js} +4 -4
- package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionsCollection.js.map +1 -0
- package/dist/commonjs/features/voice/types.js.map +1 -1
- package/dist/commonjs/index.js +0 -12
- package/dist/commonjs/index.js.map +1 -1
- package/dist/module/features/voice/playing/components/VoiceTranscription.js +47 -40
- package/dist/module/features/voice/playing/components/VoiceTranscription.js.map +1 -1
- package/dist/module/features/voice/playing/components/VoiceTranscriptionCollapsible.js +2 -2
- package/dist/module/features/voice/playing/components/VoiceTranscriptionCollapsible.js.map +1 -1
- package/dist/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.js +7 -8
- package/dist/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.js.map +1 -1
- package/dist/module/features/voice/playing/hooks/{useDropdownAnimation.js → useVoiceTranscription.js} +5 -6
- package/dist/module/features/voice/playing/hooks/useVoiceTranscription.js.map +1 -0
- package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionEffects.js +32 -0
- package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionEffects.js.map +1 -0
- package/dist/module/features/voice/playing/model/Player.model.js +1 -24
- package/dist/module/features/voice/playing/model/Player.model.js.map +1 -1
- package/dist/module/features/voice/playing/model/TranscriptionsDownloaderModel.js +61 -0
- package/dist/module/features/voice/playing/model/TranscriptionsDownloaderModel.js.map +1 -0
- package/dist/module/features/voice/playing/model/VoiceFileDownloader.model.js +2 -2
- package/dist/module/features/voice/playing/model/VoiceFileDownloader.model.js.map +1 -1
- package/dist/module/features/voice/playing/model/VoicePlayer.model.js +177 -48
- package/dist/module/features/voice/playing/model/VoicePlayer.model.js.map +1 -1
- package/dist/module/features/voice/playing/model/{Dropdown.model.js → VoiceTranscription.model.js} +2 -2
- package/dist/module/features/voice/playing/model/VoiceTranscription.model.js.map +1 -0
- package/dist/module/features/voice/playing/model/VoiceTranscriptionTranslation.model.js +10 -0
- package/dist/module/features/voice/playing/model/VoiceTranscriptionTranslation.model.js.map +1 -0
- package/dist/module/features/voice/playing/model/{TranscriptionsCollection.js → VoiceTranscriptionsCollection.js} +2 -2
- package/dist/module/features/voice/playing/model/VoiceTranscriptionsCollection.js.map +1 -0
- package/dist/module/features/voice/types.js.map +1 -1
- package/dist/module/index.js +0 -1
- package/dist/module/index.js.map +1 -1
- package/dist/typescript/commonjs/features/voice/index.d.ts +0 -1
- package/dist/typescript/commonjs/features/voice/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscription.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts +2 -2
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voice/playing/hooks/{useDropdownAnimation.d.ts → useVoiceTranscription.d.ts} +3 -3
- package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscription.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionEffects.d.ts +12 -0
- package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionEffects.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/model/Player.model.d.ts +0 -3
- package/dist/typescript/commonjs/features/voice/playing/model/Player.model.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts +15 -0
- package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/model/VoiceFileDownloader.model.d.ts +2 -2
- package/dist/typescript/commonjs/features/voice/playing/model/VoiceFileDownloader.model.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voice/playing/model/VoicePlayer.model.d.ts +20 -18
- package/dist/typescript/commonjs/features/voice/playing/model/VoicePlayer.model.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voice/playing/model/{Dropdown.model.d.ts → VoiceTranscription.model.d.ts} +2 -2
- package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscription.model.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionTranslation.model.d.ts +7 -0
- package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionTranslation.model.d.ts.map +1 -0
- package/dist/typescript/{module/features/voice/playing/model/TranscriptionsCollection.d.ts → commonjs/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts} +2 -2
- package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/types.d.ts +1 -4
- package/dist/typescript/commonjs/features/voice/types.d.ts.map +1 -1
- package/dist/typescript/commonjs/index.d.ts +0 -1
- package/dist/typescript/commonjs/index.d.ts.map +1 -1
- package/dist/typescript/module/features/voice/index.d.ts +0 -1
- package/dist/typescript/module/features/voice/index.d.ts.map +1 -1
- package/dist/typescript/module/features/voice/playing/components/VoiceTranscription.d.ts.map +1 -1
- package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts +2 -2
- package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts.map +1 -1
- package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts.map +1 -1
- package/dist/typescript/module/features/voice/playing/hooks/{useDropdownAnimation.d.ts → useVoiceTranscription.d.ts} +3 -3
- package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscription.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionEffects.d.ts +12 -0
- package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionEffects.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/model/Player.model.d.ts +0 -3
- package/dist/typescript/module/features/voice/playing/model/Player.model.d.ts.map +1 -1
- package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts +15 -0
- package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/model/VoiceFileDownloader.model.d.ts +2 -2
- package/dist/typescript/module/features/voice/playing/model/VoiceFileDownloader.model.d.ts.map +1 -1
- package/dist/typescript/module/features/voice/playing/model/VoicePlayer.model.d.ts +20 -18
- package/dist/typescript/module/features/voice/playing/model/VoicePlayer.model.d.ts.map +1 -1
- package/dist/typescript/module/features/voice/playing/model/{Dropdown.model.d.ts → VoiceTranscription.model.d.ts} +2 -2
- package/dist/typescript/module/features/voice/playing/model/VoiceTranscription.model.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionTranslation.model.d.ts +7 -0
- package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionTranslation.model.d.ts.map +1 -0
- package/dist/typescript/{commonjs/features/voice/playing/model/TranscriptionsCollection.d.ts → module/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts} +2 -2
- package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/types.d.ts +1 -4
- package/dist/typescript/module/features/voice/types.d.ts.map +1 -1
- package/dist/typescript/module/index.d.ts +0 -1
- package/dist/typescript/module/index.d.ts.map +1 -1
- package/package.json +1 -28
- package/src/features/voice/index.ts +0 -1
- package/src/features/voice/playing/components/VoiceTranscription.tsx +60 -43
- package/src/features/voice/playing/components/VoiceTranscriptionCollapsible.tsx +4 -4
- package/src/features/voice/playing/components/VoiceTranscriptionHeaderActions.tsx +9 -8
- package/src/features/voice/playing/hooks/{useDropdownAnimation.ts → useVoiceTranscription.ts} +5 -5
- package/src/features/voice/playing/hooks/useVoiceTranscriptionEffects.ts +44 -0
- package/src/features/voice/playing/model/Player.model.ts +1 -26
- package/src/features/voice/playing/model/TranscriptionsDownloaderModel.ts +80 -0
- package/src/features/voice/playing/model/VoiceFileDownloader.model.ts +2 -2
- package/src/features/voice/playing/model/VoicePlayer.model.ts +196 -56
- package/src/features/voice/playing/model/{Dropdown.model.ts → VoiceTranscription.model.ts} +1 -1
- package/src/features/voice/playing/model/VoiceTranscriptionTranslation.model.ts +11 -0
- package/src/features/voice/playing/model/{TranscriptionsCollection.ts → VoiceTranscriptionsCollection.ts} +1 -1
- package/src/features/voice/types.ts +0 -9
- package/src/index.ts +0 -1
- package/dist/commonjs/features/translation/constants.js +0 -11
- package/dist/commonjs/features/translation/constants.js.map +0 -1
- package/dist/commonjs/features/translation/helpers.js +0 -60
- package/dist/commonjs/features/translation/helpers.js.map +0 -1
- package/dist/commonjs/features/translation/index.js +0 -105
- package/dist/commonjs/features/translation/index.js.map +0 -1
- package/dist/commonjs/features/translation/model/TranslationModel.js +0 -122
- package/dist/commonjs/features/translation/model/TranslationModel.js.map +0 -1
- package/dist/commonjs/features/translation/model/TranslationPreprocessor.js +0 -142
- package/dist/commonjs/features/translation/model/TranslationPreprocessor.js.map +0 -1
- package/dist/commonjs/features/translation/model/TranslationService.js +0 -112
- package/dist/commonjs/features/translation/model/TranslationService.js.map +0 -1
- package/dist/commonjs/features/translation/preserve/wordsToPreserve.js +0 -314
- package/dist/commonjs/features/translation/preserve/wordsToPreserve.js.map +0 -1
- package/dist/commonjs/features/translation/providers/google/GoogleTranslationProvider.js +0 -50
- package/dist/commonjs/features/translation/providers/google/GoogleTranslationProvider.js.map +0 -1
- package/dist/commonjs/features/translation/providers/google/supportedLanguages.js +0 -230
- package/dist/commonjs/features/translation/providers/google/supportedLanguages.js.map +0 -1
- package/dist/commonjs/features/translation/providers/google.types.js +0 -2
- package/dist/commonjs/features/translation/providers/google.types.js.map +0 -1
- package/dist/commonjs/features/translation/providers/translation.interface.js +0 -49
- package/dist/commonjs/features/translation/providers/translation.interface.js.map +0 -1
- package/dist/commonjs/features/translation/types.js +0 -2
- package/dist/commonjs/features/translation/types.js.map +0 -1
- package/dist/commonjs/features/voice/playing/hooks/useDropdownAnimation.js.map +0 -1
- package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionController.js +0 -128
- package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionController.js.map +0 -1
- package/dist/commonjs/features/voice/playing/model/Dropdown.model.js.map +0 -1
- package/dist/commonjs/features/voice/playing/model/PlaybackController.js +0 -183
- package/dist/commonjs/features/voice/playing/model/PlaybackController.js.map +0 -1
- package/dist/commonjs/features/voice/playing/model/TranscriptionsCollection.js.map +0 -1
- package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloader.model.js +0 -82
- package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloader.model.js.map +0 -1
- package/dist/commonjs/features/voice/playing/model/Translation.model.js +0 -62
- package/dist/commonjs/features/voice/playing/model/Translation.model.js.map +0 -1
- package/dist/module/features/translation/constants.js +0 -7
- package/dist/module/features/translation/constants.js.map +0 -1
- package/dist/module/features/translation/helpers.js +0 -53
- package/dist/module/features/translation/helpers.js.map +0 -1
- package/dist/module/features/translation/index.js +0 -12
- package/dist/module/features/translation/index.js.map +0 -1
- package/dist/module/features/translation/model/TranslationModel.js +0 -117
- package/dist/module/features/translation/model/TranslationModel.js.map +0 -1
- package/dist/module/features/translation/model/TranslationPreprocessor.js +0 -137
- package/dist/module/features/translation/model/TranslationPreprocessor.js.map +0 -1
- package/dist/module/features/translation/model/TranslationService.js +0 -107
- package/dist/module/features/translation/model/TranslationService.js.map +0 -1
- package/dist/module/features/translation/preserve/wordsToPreserve.js +0 -310
- package/dist/module/features/translation/preserve/wordsToPreserve.js.map +0 -1
- package/dist/module/features/translation/providers/google/GoogleTranslationProvider.js +0 -45
- package/dist/module/features/translation/providers/google/GoogleTranslationProvider.js.map +0 -1
- package/dist/module/features/translation/providers/google/supportedLanguages.js +0 -225
- package/dist/module/features/translation/providers/google/supportedLanguages.js.map +0 -1
- package/dist/module/features/translation/providers/google.types.js +0 -2
- package/dist/module/features/translation/providers/google.types.js.map +0 -1
- package/dist/module/features/translation/providers/translation.interface.js +0 -44
- package/dist/module/features/translation/providers/translation.interface.js.map +0 -1
- package/dist/module/features/translation/types.js +0 -2
- package/dist/module/features/translation/types.js.map +0 -1
- package/dist/module/features/voice/playing/hooks/useDropdownAnimation.js.map +0 -1
- package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionController.js +0 -123
- package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionController.js.map +0 -1
- package/dist/module/features/voice/playing/model/Dropdown.model.js.map +0 -1
- package/dist/module/features/voice/playing/model/PlaybackController.js +0 -178
- package/dist/module/features/voice/playing/model/PlaybackController.js.map +0 -1
- package/dist/module/features/voice/playing/model/TranscriptionsCollection.js.map +0 -1
- package/dist/module/features/voice/playing/model/TranscriptionsDownloader.model.js +0 -77
- package/dist/module/features/voice/playing/model/TranscriptionsDownloader.model.js.map +0 -1
- package/dist/module/features/voice/playing/model/Translation.model.js +0 -57
- package/dist/module/features/voice/playing/model/Translation.model.js.map +0 -1
- package/dist/typescript/commonjs/features/translation/constants.d.ts +0 -5
- package/dist/typescript/commonjs/features/translation/constants.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/translation/helpers.d.ts +0 -9
- package/dist/typescript/commonjs/features/translation/helpers.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/translation/index.d.ts +0 -12
- package/dist/typescript/commonjs/features/translation/index.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/translation/model/TranslationModel.d.ts +0 -33
- package/dist/typescript/commonjs/features/translation/model/TranslationModel.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/translation/model/TranslationPreprocessor.d.ts +0 -34
- package/dist/typescript/commonjs/features/translation/model/TranslationPreprocessor.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/translation/model/TranslationService.d.ts +0 -40
- package/dist/typescript/commonjs/features/translation/model/TranslationService.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/translation/preserve/wordsToPreserve.d.ts +0 -3
- package/dist/typescript/commonjs/features/translation/preserve/wordsToPreserve.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/translation/providers/google/GoogleTranslationProvider.d.ts +0 -17
- package/dist/typescript/commonjs/features/translation/providers/google/GoogleTranslationProvider.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/translation/providers/google/supportedLanguages.d.ts +0 -209
- package/dist/typescript/commonjs/features/translation/providers/google/supportedLanguages.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/translation/providers/google.types.d.ts +0 -15
- package/dist/typescript/commonjs/features/translation/providers/google.types.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/translation/providers/translation.interface.d.ts +0 -30
- package/dist/typescript/commonjs/features/translation/providers/translation.interface.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/translation/types.d.ts +0 -27
- package/dist/typescript/commonjs/features/translation/types.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/voice/playing/hooks/useDropdownAnimation.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionController.d.ts +0 -30
- package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionController.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/voice/playing/model/Dropdown.model.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/voice/playing/model/PlaybackController.d.ts +0 -28
- package/dist/typescript/commonjs/features/voice/playing/model/PlaybackController.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsCollection.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloader.model.d.ts +0 -19
- package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloader.model.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/voice/playing/model/Translation.model.d.ts +0 -25
- package/dist/typescript/commonjs/features/voice/playing/model/Translation.model.d.ts.map +0 -1
- package/dist/typescript/module/features/translation/constants.d.ts +0 -5
- package/dist/typescript/module/features/translation/constants.d.ts.map +0 -1
- package/dist/typescript/module/features/translation/helpers.d.ts +0 -9
- package/dist/typescript/module/features/translation/helpers.d.ts.map +0 -1
- package/dist/typescript/module/features/translation/index.d.ts +0 -12
- package/dist/typescript/module/features/translation/index.d.ts.map +0 -1
- package/dist/typescript/module/features/translation/model/TranslationModel.d.ts +0 -33
- package/dist/typescript/module/features/translation/model/TranslationModel.d.ts.map +0 -1
- package/dist/typescript/module/features/translation/model/TranslationPreprocessor.d.ts +0 -34
- package/dist/typescript/module/features/translation/model/TranslationPreprocessor.d.ts.map +0 -1
- package/dist/typescript/module/features/translation/model/TranslationService.d.ts +0 -40
- package/dist/typescript/module/features/translation/model/TranslationService.d.ts.map +0 -1
- package/dist/typescript/module/features/translation/preserve/wordsToPreserve.d.ts +0 -3
- package/dist/typescript/module/features/translation/preserve/wordsToPreserve.d.ts.map +0 -1
- package/dist/typescript/module/features/translation/providers/google/GoogleTranslationProvider.d.ts +0 -17
- package/dist/typescript/module/features/translation/providers/google/GoogleTranslationProvider.d.ts.map +0 -1
- package/dist/typescript/module/features/translation/providers/google/supportedLanguages.d.ts +0 -209
- package/dist/typescript/module/features/translation/providers/google/supportedLanguages.d.ts.map +0 -1
- package/dist/typescript/module/features/translation/providers/google.types.d.ts +0 -15
- package/dist/typescript/module/features/translation/providers/google.types.d.ts.map +0 -1
- package/dist/typescript/module/features/translation/providers/translation.interface.d.ts +0 -30
- package/dist/typescript/module/features/translation/providers/translation.interface.d.ts.map +0 -1
- package/dist/typescript/module/features/translation/types.d.ts +0 -27
- package/dist/typescript/module/features/translation/types.d.ts.map +0 -1
- package/dist/typescript/module/features/voice/playing/hooks/useDropdownAnimation.d.ts.map +0 -1
- package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionController.d.ts +0 -30
- package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionController.d.ts.map +0 -1
- package/dist/typescript/module/features/voice/playing/model/Dropdown.model.d.ts.map +0 -1
- package/dist/typescript/module/features/voice/playing/model/PlaybackController.d.ts +0 -28
- package/dist/typescript/module/features/voice/playing/model/PlaybackController.d.ts.map +0 -1
- package/dist/typescript/module/features/voice/playing/model/TranscriptionsCollection.d.ts.map +0 -1
- package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloader.model.d.ts +0 -19
- package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloader.model.d.ts.map +0 -1
- package/dist/typescript/module/features/voice/playing/model/Translation.model.d.ts +0 -25
- package/dist/typescript/module/features/voice/playing/model/Translation.model.d.ts.map +0 -1
- package/src/features/translation/constants.ts +0 -4
- package/src/features/translation/helpers.ts +0 -63
- package/src/features/translation/index.ts +0 -30
- package/src/features/translation/model/TranslationModel.ts +0 -174
- package/src/features/translation/model/TranslationPreprocessor.ts +0 -171
- package/src/features/translation/model/TranslationService.ts +0 -148
- package/src/features/translation/preserve/wordsToPreserve.ts +0 -87
- package/src/features/translation/providers/google/GoogleTranslationProvider.ts +0 -50
- package/src/features/translation/providers/google/supportedLanguages.ts +0 -229
- package/src/features/translation/providers/google.types.ts +0 -16
- package/src/features/translation/providers/translation.interface.ts +0 -63
- package/src/features/translation/types.ts +0 -30
- package/src/features/voice/playing/hooks/useVoiceTranscriptionController.ts +0 -171
- package/src/features/voice/playing/model/PlaybackController.ts +0 -213
- package/src/features/voice/playing/model/TranscriptionsDownloader.model.ts +0 -88
- package/src/features/voice/playing/model/Translation.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,171 +0,0 @@
|
|
|
1
|
-
import { useUnit } from 'effector-react'
|
|
2
|
-
import { useCallback, useEffect, useMemo, useRef } from 'react'
|
|
3
|
-
import { useTranslation } from 'react-i18next'
|
|
4
|
-
import { NO_AUDIO_BE_MESSAGE } from '../../constants'
|
|
5
|
-
import { getActiveAttempt } from '../../helpers'
|
|
6
|
-
import { AnswerAudio } from '../../types'
|
|
7
|
-
import { resolveGoogleLanguageCode } from '../../../translation/providers/google/supportedLanguages'
|
|
8
|
-
import { useText } from '../../../../i18n/i18n'
|
|
9
|
-
import { VoicePlayerModel } from '../model'
|
|
10
|
-
import { PlayerState } from '../model/Player.model'
|
|
11
|
-
|
|
12
|
-
type Params = {
|
|
13
|
-
model: VoicePlayerModel
|
|
14
|
-
answers: AnswerAudio[]
|
|
15
|
-
attemptOffset: number
|
|
16
|
-
attemptsCount: number
|
|
17
|
-
problemId: string
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export type VoiceTranscriptionController = ReturnType<typeof useVoiceTranscriptionController>
|
|
21
|
-
|
|
22
|
-
export const useVoiceTranscriptionController = ({
|
|
23
|
-
model,
|
|
24
|
-
answers,
|
|
25
|
-
attemptOffset,
|
|
26
|
-
attemptsCount,
|
|
27
|
-
problemId,
|
|
28
|
-
}: Params) => {
|
|
29
|
-
const t = useText()
|
|
30
|
-
const { i18n } = useTranslation()
|
|
31
|
-
|
|
32
|
-
const [playerState, isLoadingTranscripts, isTranslationActive, translations, isTranslating] =
|
|
33
|
-
useUnit([
|
|
34
|
-
model.$playerState,
|
|
35
|
-
model.loader.loadTranscriptForAttempt.pending,
|
|
36
|
-
model.translation.$isActive,
|
|
37
|
-
model.translation.$translations,
|
|
38
|
-
model.translation.translate.pending,
|
|
39
|
-
])
|
|
40
|
-
|
|
41
|
-
const activeAttempt = getActiveAttempt(attemptOffset, attemptsCount)
|
|
42
|
-
|
|
43
|
-
const answersKey = useMemo(
|
|
44
|
-
() => answers.map((a) => `${a._id}:${a.audioFileId ?? ''}`).join(','),
|
|
45
|
-
[answers],
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
const activeAudioFileId =
|
|
49
|
-
activeAttempt !== null ? answers?.[activeAttempt - 1]?.audioFileId : undefined
|
|
50
|
-
const hasActiveAudio = activeAudioFileId !== undefined
|
|
51
|
-
const anyAttemptHasAudio = useMemo(() => answers.some((a) => !!a.audioFileId), [answers])
|
|
52
|
-
|
|
53
|
-
const cachedEntry = activeAudioFileId
|
|
54
|
-
? model.loader.getCachedTranscript(activeAudioFileId)
|
|
55
|
-
: undefined
|
|
56
|
-
const activeTranscript = cachedEntry?.text ?? null
|
|
57
|
-
const hasTranscriptText = !!activeTranscript && activeTranscript !== NO_AUDIO_BE_MESSAGE
|
|
58
|
-
const isActiveTranscriptLoading = isLoadingTranscripts && hasActiveAudio && !activeTranscript
|
|
59
|
-
|
|
60
|
-
const isSourceSameAsTarget =
|
|
61
|
-
!!cachedEntry?.language &&
|
|
62
|
-
resolveGoogleLanguageCode(cachedEntry.language) === resolveGoogleLanguageCode(i18n.language)
|
|
63
|
-
|
|
64
|
-
const canTranslate = hasTranscriptText && !isSourceSameAsTarget
|
|
65
|
-
|
|
66
|
-
const cachedTranslation = activeAttempt !== null ? translations[activeAttempt] : undefined
|
|
67
|
-
const showTranslation = isTranslationActive && canTranslate
|
|
68
|
-
const isTranslationLoading = showTranslation && !cachedTranslation && isTranslating
|
|
69
|
-
|
|
70
|
-
const displayText = showTranslation
|
|
71
|
-
? (cachedTranslation ?? activeTranscript!)
|
|
72
|
-
: hasTranscriptText
|
|
73
|
-
? activeTranscript!
|
|
74
|
-
: t('voice.transcriptNotAvailable')
|
|
75
|
-
|
|
76
|
-
// Lifecycle effects
|
|
77
|
-
const answersRef = useRef(answers)
|
|
78
|
-
answersRef.current = answers
|
|
79
|
-
|
|
80
|
-
useEffect(() => {
|
|
81
|
-
model.reinitializePlayer()
|
|
82
|
-
return () => {
|
|
83
|
-
model.stopAudio()
|
|
84
|
-
model.dropdown.setExpanded(false)
|
|
85
|
-
}
|
|
86
|
-
}, [model])
|
|
87
|
-
|
|
88
|
-
useEffect(() => {
|
|
89
|
-
model.dropdown.setExpanded(false)
|
|
90
|
-
model.resetPlayer()
|
|
91
|
-
}, [problemId])
|
|
92
|
-
|
|
93
|
-
useEffect(() => {
|
|
94
|
-
if (answersRef.current.some((a) => a.audioFileId)) {
|
|
95
|
-
model.initializeWithAudios(answersRef.current)
|
|
96
|
-
}
|
|
97
|
-
}, [model, answersKey])
|
|
98
|
-
|
|
99
|
-
useEffect(() => {
|
|
100
|
-
model.stopAudio()
|
|
101
|
-
model.setCurrentAttempt(activeAttempt)
|
|
102
|
-
if (activeAttempt !== null) {
|
|
103
|
-
model.loader.loadTranscriptForAttempt(activeAttempt)
|
|
104
|
-
}
|
|
105
|
-
}, [model, activeAttempt, answersKey])
|
|
106
|
-
|
|
107
|
-
// Auto-activate translation once per (problemId, activeAttempt) when translatable
|
|
108
|
-
const autoActivatedAttempts = useRef(new Set<number>())
|
|
109
|
-
useEffect(() => {
|
|
110
|
-
autoActivatedAttempts.current.clear()
|
|
111
|
-
}, [problemId])
|
|
112
|
-
useEffect(() => {
|
|
113
|
-
if (
|
|
114
|
-
canTranslate &&
|
|
115
|
-
activeAttempt !== null &&
|
|
116
|
-
!autoActivatedAttempts.current.has(activeAttempt)
|
|
117
|
-
) {
|
|
118
|
-
autoActivatedAttempts.current.add(activeAttempt)
|
|
119
|
-
model.translation.setActive(true)
|
|
120
|
-
}
|
|
121
|
-
}, [canTranslate, activeAttempt, model])
|
|
122
|
-
|
|
123
|
-
// Trigger translate when we should show translation but don't have it cached
|
|
124
|
-
useEffect(() => {
|
|
125
|
-
if (showTranslation && activeAttempt !== null && !cachedTranslation && !isTranslating) {
|
|
126
|
-
model.translation.translate({
|
|
127
|
-
attemptNumber: activeAttempt,
|
|
128
|
-
targetLanguage: i18n.language,
|
|
129
|
-
})
|
|
130
|
-
}
|
|
131
|
-
}, [showTranslation, activeAttempt, cachedTranslation, isTranslating, i18n.language, model])
|
|
132
|
-
|
|
133
|
-
// Auto-open dropdown when a translation successfully completes
|
|
134
|
-
useEffect(() => {
|
|
135
|
-
return model.translation.translate.doneData.watch((result) => {
|
|
136
|
-
if (result) {
|
|
137
|
-
model.dropdown.setExpanded(true)
|
|
138
|
-
}
|
|
139
|
-
})
|
|
140
|
-
}, [model])
|
|
141
|
-
|
|
142
|
-
const onPlayPress = useCallback(() => {
|
|
143
|
-
if (activeAttempt) {
|
|
144
|
-
model.translation.setActive(false)
|
|
145
|
-
model.togglePlayPause(activeAttempt)
|
|
146
|
-
}
|
|
147
|
-
}, [model, activeAttempt])
|
|
148
|
-
|
|
149
|
-
const onTranslationToggle = useCallback(() => {
|
|
150
|
-
model.translation.toggle()
|
|
151
|
-
model.dropdown.setExpanded(true)
|
|
152
|
-
}, [model])
|
|
153
|
-
|
|
154
|
-
return {
|
|
155
|
-
display: {
|
|
156
|
-
text: displayText,
|
|
157
|
-
isLoading: isActiveTranscriptLoading || isTranslationLoading,
|
|
158
|
-
},
|
|
159
|
-
flags: {
|
|
160
|
-
playerState: playerState as PlayerState,
|
|
161
|
-
hasActiveAudio,
|
|
162
|
-
anyAttemptHasAudio,
|
|
163
|
-
canTranslate,
|
|
164
|
-
isTranslationActive,
|
|
165
|
-
},
|
|
166
|
-
actions: {
|
|
167
|
-
onPlayPress,
|
|
168
|
-
onTranslationToggle,
|
|
169
|
-
},
|
|
170
|
-
}
|
|
171
|
-
}
|