@magmamath/students-features 1.4.6 → 1.5.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.js +1 -6
- package/dist/commonjs/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.js.map +1 -1
- package/dist/commonjs/features/fluency/components/Fluency.js +6 -12
- package/dist/commonjs/features/fluency/components/Fluency.js.map +1 -1
- package/dist/commonjs/features/fluency/components/select-math-operator/SelectMathOperator.js +5 -13
- package/dist/commonjs/features/fluency/components/select-math-operator/SelectMathOperator.js.map +1 -1
- package/dist/commonjs/features/fluency/model/FluencyModel.js +0 -21
- package/dist/commonjs/features/fluency/model/FluencyModel.js.map +1 -1
- package/dist/commonjs/features/fluency/shared/fluency.constants.js +1 -6
- package/dist/commonjs/features/fluency/shared/fluency.constants.js.map +1 -1
- package/dist/commonjs/features/fluency/shared/fluency.helpers.js +1 -3
- package/dist/commonjs/features/fluency/shared/fluency.helpers.js.map +1 -1
- package/dist/commonjs/features/pmProgress/model/PmProgressModel.js +1 -7
- package/dist/commonjs/features/pmProgress/model/PmProgressModel.js.map +1 -1
- package/dist/commonjs/features/pmProgress/model/PmRecommendationsModel.js +4 -20
- package/dist/commonjs/features/pmProgress/model/PmRecommendationsModel.js.map +1 -1
- package/dist/commonjs/features/pmProgress/shared/pmProgress.helpers.js +1 -22
- package/dist/commonjs/features/pmProgress/shared/pmProgress.helpers.js.map +1 -1
- package/dist/commonjs/features/translation/constants.js +11 -0
- package/dist/commonjs/features/translation/constants.js.map +1 -0
- package/dist/commonjs/features/translation/helpers.js +60 -0
- package/dist/commonjs/features/translation/helpers.js.map +1 -0
- package/dist/commonjs/features/translation/index.js +105 -0
- package/dist/commonjs/features/translation/index.js.map +1 -0
- package/dist/commonjs/features/translation/model/TranslationModel.js +122 -0
- package/dist/commonjs/features/translation/model/TranslationModel.js.map +1 -0
- package/dist/commonjs/features/translation/model/TranslationPreprocessor.js +142 -0
- package/dist/commonjs/features/translation/model/TranslationPreprocessor.js.map +1 -0
- package/dist/commonjs/features/translation/model/TranslationService.js +112 -0
- package/dist/commonjs/features/translation/model/TranslationService.js.map +1 -0
- package/dist/commonjs/features/translation/preserve/wordsToPreserve.js +314 -0
- package/dist/commonjs/features/translation/preserve/wordsToPreserve.js.map +1 -0
- package/dist/commonjs/features/translation/providers/google/GoogleTranslationProvider.js +50 -0
- package/dist/commonjs/features/translation/providers/google/GoogleTranslationProvider.js.map +1 -0
- package/dist/commonjs/features/translation/providers/google/supportedLanguages.js +230 -0
- package/dist/commonjs/features/translation/providers/google/supportedLanguages.js.map +1 -0
- package/dist/commonjs/features/translation/providers/google.types.js +2 -0
- package/dist/commonjs/features/translation/providers/google.types.js.map +1 -0
- package/dist/commonjs/features/translation/providers/translation.interface.js +49 -0
- package/dist/commonjs/features/translation/providers/translation.interface.js.map +1 -0
- package/dist/commonjs/features/translation/types.js +2 -0
- package/dist/commonjs/features/translation/types.js.map +1 -0
- package/dist/commonjs/features/voice/index.js +15 -4
- package/dist/commonjs/features/voice/index.js.map +1 -1
- package/dist/commonjs/features/voice/playing/components/VoiceIcon.js +1 -1
- package/dist/commonjs/features/voice/playing/components/VoiceIcon.js.map +1 -1
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptContent.js +44 -0
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptContent.js.map +1 -0
- package/dist/commonjs/features/voice/playing/components/VoiceTranscription.js +107 -0
- package/dist/commonjs/features/voice/playing/components/VoiceTranscription.js.map +1 -0
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.js +66 -0
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.js.map +1 -0
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.js +58 -0
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.js.map +1 -0
- package/dist/commonjs/features/voice/playing/hooks/{useVoiceTranscriptionsDropdown.js → useDropdownAnimation.js} +8 -7
- package/dist/commonjs/features/voice/playing/hooks/useDropdownAnimation.js.map +1 -0
- package/dist/commonjs/features/voice/playing/hooks/useVoicePlayerLifecycle.js +53 -0
- package/dist/commonjs/features/voice/playing/hooks/useVoicePlayerLifecycle.js.map +1 -0
- package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionController.js +111 -0
- package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionController.js.map +1 -0
- package/dist/commonjs/features/voice/playing/model/{VoiceTranscriptionsDropdown.model.js → Dropdown.model.js} +4 -4
- package/dist/commonjs/features/voice/playing/model/Dropdown.model.js.map +1 -0
- package/dist/commonjs/features/voice/playing/model/PlaybackController.js +192 -0
- package/dist/commonjs/features/voice/playing/model/PlaybackController.js.map +1 -0
- package/dist/commonjs/features/voice/playing/model/Player.model.js +50 -5
- package/dist/commonjs/features/voice/playing/model/Player.model.js.map +1 -1
- package/dist/commonjs/features/voice/playing/model/{VoiceTranscriptionsCollection.js → TranscriptionsCollection.js} +4 -4
- package/dist/commonjs/features/voice/playing/model/TranscriptionsCollection.js.map +1 -0
- package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloader.model.js +83 -0
- package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloader.model.js.map +1 -0
- package/dist/commonjs/features/voice/playing/model/Translation.model.js +62 -0
- package/dist/commonjs/features/voice/playing/model/Translation.model.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 +58 -172
- package/dist/commonjs/features/voice/playing/model/VoicePlayer.model.js.map +1 -1
- package/dist/commonjs/features/voice/recording/components/VoiceRecordDivider.js +1 -1
- package/dist/commonjs/features/voice/recording/components/VoiceRecordDivider.js.map +1 -1
- package/dist/commonjs/features/voice/types.js +12 -1
- package/dist/commonjs/features/voice/types.js.map +1 -1
- package/dist/commonjs/index.js +12 -0
- package/dist/commonjs/index.js.map +1 -1
- package/dist/module/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.js +2 -7
- package/dist/module/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.js.map +1 -1
- package/dist/module/features/fluency/components/Fluency.js +8 -14
- package/dist/module/features/fluency/components/Fluency.js.map +1 -1
- package/dist/module/features/fluency/components/select-math-operator/SelectMathOperator.js +5 -13
- package/dist/module/features/fluency/components/select-math-operator/SelectMathOperator.js.map +1 -1
- package/dist/module/features/fluency/model/FluencyModel.js +1 -22
- package/dist/module/features/fluency/model/FluencyModel.js.map +1 -1
- package/dist/module/features/fluency/shared/fluency.constants.js +0 -5
- package/dist/module/features/fluency/shared/fluency.constants.js.map +1 -1
- package/dist/module/features/fluency/shared/fluency.helpers.js +0 -1
- package/dist/module/features/fluency/shared/fluency.helpers.js.map +1 -1
- package/dist/module/features/pmProgress/model/PmProgressModel.js +1 -7
- package/dist/module/features/pmProgress/model/PmProgressModel.js.map +1 -1
- package/dist/module/features/pmProgress/model/PmRecommendationsModel.js +4 -20
- package/dist/module/features/pmProgress/model/PmRecommendationsModel.js.map +1 -1
- package/dist/module/features/pmProgress/shared/pmProgress.helpers.js +0 -20
- package/dist/module/features/pmProgress/shared/pmProgress.helpers.js.map +1 -1
- package/dist/module/features/translation/constants.js +7 -0
- package/dist/module/features/translation/constants.js.map +1 -0
- package/dist/module/features/translation/helpers.js +53 -0
- package/dist/module/features/translation/helpers.js.map +1 -0
- package/dist/module/features/translation/index.js +12 -0
- package/dist/module/features/translation/index.js.map +1 -0
- package/dist/module/features/translation/model/TranslationModel.js +117 -0
- package/dist/module/features/translation/model/TranslationModel.js.map +1 -0
- package/dist/module/features/translation/model/TranslationPreprocessor.js +137 -0
- package/dist/module/features/translation/model/TranslationPreprocessor.js.map +1 -0
- package/dist/module/features/translation/model/TranslationService.js +107 -0
- package/dist/module/features/translation/model/TranslationService.js.map +1 -0
- package/dist/module/features/translation/preserve/wordsToPreserve.js +310 -0
- package/dist/module/features/translation/preserve/wordsToPreserve.js.map +1 -0
- package/dist/module/features/translation/providers/google/GoogleTranslationProvider.js +45 -0
- package/dist/module/features/translation/providers/google/GoogleTranslationProvider.js.map +1 -0
- package/dist/module/features/translation/providers/google/supportedLanguages.js +225 -0
- package/dist/module/features/translation/providers/google/supportedLanguages.js.map +1 -0
- package/dist/module/features/translation/providers/google.types.js +2 -0
- package/dist/module/features/translation/providers/google.types.js.map +1 -0
- package/dist/module/features/translation/providers/translation.interface.js +44 -0
- package/dist/module/features/translation/providers/translation.interface.js.map +1 -0
- package/dist/module/features/translation/types.js +2 -0
- package/dist/module/features/translation/types.js.map +1 -0
- package/dist/module/features/voice/index.js +2 -1
- package/dist/module/features/voice/index.js.map +1 -1
- package/dist/module/features/voice/playing/components/VoiceIcon.js +2 -2
- package/dist/module/features/voice/playing/components/VoiceIcon.js.map +1 -1
- package/dist/module/features/voice/playing/components/VoiceTranscriptContent.js +38 -0
- package/dist/module/features/voice/playing/components/VoiceTranscriptContent.js.map +1 -0
- package/dist/module/features/voice/playing/components/VoiceTranscription.js +101 -0
- package/dist/module/features/voice/playing/components/VoiceTranscription.js.map +1 -0
- package/dist/module/features/voice/playing/components/VoiceTranscriptionCollapsible.js +58 -0
- package/dist/module/features/voice/playing/components/VoiceTranscriptionCollapsible.js.map +1 -0
- package/dist/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.js +52 -0
- package/dist/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.js.map +1 -0
- package/dist/module/features/voice/playing/hooks/{useVoiceTranscriptionsDropdown.js → useDropdownAnimation.js} +6 -5
- package/dist/module/features/voice/playing/hooks/useDropdownAnimation.js.map +1 -0
- package/dist/module/features/voice/playing/hooks/useVoicePlayerLifecycle.js +48 -0
- package/dist/module/features/voice/playing/hooks/useVoicePlayerLifecycle.js.map +1 -0
- package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionController.js +106 -0
- package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionController.js.map +1 -0
- package/dist/module/features/voice/playing/model/{VoiceTranscriptionsDropdown.model.js → Dropdown.model.js} +2 -2
- package/dist/module/features/voice/playing/model/Dropdown.model.js.map +1 -0
- package/dist/module/features/voice/playing/model/PlaybackController.js +187 -0
- package/dist/module/features/voice/playing/model/PlaybackController.js.map +1 -0
- package/dist/module/features/voice/playing/model/Player.model.js +51 -4
- package/dist/module/features/voice/playing/model/Player.model.js.map +1 -1
- package/dist/module/features/voice/playing/model/{VoiceTranscriptionsCollection.js → TranscriptionsCollection.js} +2 -2
- package/dist/module/features/voice/playing/model/TranscriptionsCollection.js.map +1 -0
- package/dist/module/features/voice/playing/model/TranscriptionsDownloader.model.js +78 -0
- package/dist/module/features/voice/playing/model/TranscriptionsDownloader.model.js.map +1 -0
- package/dist/module/features/voice/playing/model/Translation.model.js +57 -0
- package/dist/module/features/voice/playing/model/Translation.model.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 +60 -174
- package/dist/module/features/voice/playing/model/VoicePlayer.model.js.map +1 -1
- package/dist/module/features/voice/recording/components/VoiceRecordDivider.js +2 -2
- package/dist/module/features/voice/recording/components/VoiceRecordDivider.js.map +1 -1
- package/dist/module/features/voice/types.js +11 -0
- package/dist/module/features/voice/types.js.map +1 -1
- package/dist/module/index.js +1 -0
- package/dist/module/index.js.map +1 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/fluency/components/Fluency.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/fluency/components/select-math-operator/SelectMathOperator.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/fluency/model/FluencyModel.d.ts +0 -3
- package/dist/typescript/commonjs/features/fluency/model/FluencyModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/fluency/shared/fluency.constants.d.ts +0 -4
- package/dist/typescript/commonjs/features/fluency/shared/fluency.constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/fluency/shared/fluency.helpers.d.ts +0 -1
- package/dist/typescript/commonjs/features/fluency/shared/fluency.helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/pmProgress/model/PmProgressModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/pmProgress/model/PmRecommendationsModel.d.ts +38 -9
- package/dist/typescript/commonjs/features/pmProgress/model/PmRecommendationsModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/pmProgress/shared/pmProgress.helpers.d.ts +0 -1
- package/dist/typescript/commonjs/features/pmProgress/shared/pmProgress.helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/translation/constants.d.ts +5 -0
- package/dist/typescript/commonjs/features/translation/constants.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/translation/helpers.d.ts +9 -0
- package/dist/typescript/commonjs/features/translation/helpers.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/translation/index.d.ts +12 -0
- package/dist/typescript/commonjs/features/translation/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/translation/model/TranslationModel.d.ts +33 -0
- package/dist/typescript/commonjs/features/translation/model/TranslationModel.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/translation/model/TranslationPreprocessor.d.ts +34 -0
- package/dist/typescript/commonjs/features/translation/model/TranslationPreprocessor.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/translation/model/TranslationService.d.ts +40 -0
- package/dist/typescript/commonjs/features/translation/model/TranslationService.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/translation/preserve/wordsToPreserve.d.ts +3 -0
- package/dist/typescript/commonjs/features/translation/preserve/wordsToPreserve.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/translation/providers/google/GoogleTranslationProvider.d.ts +17 -0
- package/dist/typescript/commonjs/features/translation/providers/google/GoogleTranslationProvider.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/translation/providers/google/supportedLanguages.d.ts +209 -0
- package/dist/typescript/commonjs/features/translation/providers/google/supportedLanguages.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/translation/providers/google.types.d.ts +15 -0
- package/dist/typescript/commonjs/features/translation/providers/google.types.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/translation/providers/translation.interface.d.ts +30 -0
- package/dist/typescript/commonjs/features/translation/providers/translation.interface.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/translation/types.d.ts +27 -0
- package/dist/typescript/commonjs/features/translation/types.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/index.d.ts +3 -1
- package/dist/typescript/commonjs/features/voice/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptContent.d.ts +8 -0
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptContent.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscription.d.ts +16 -0
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscription.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts +10 -0
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts +12 -0
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/hooks/{useVoiceTranscriptionsDropdown.d.ts → useDropdownAnimation.d.ts} +3 -3
- package/dist/typescript/commonjs/features/voice/playing/hooks/useDropdownAnimation.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/hooks/useVoicePlayerLifecycle.d.ts +15 -0
- package/dist/typescript/commonjs/features/voice/playing/hooks/useVoicePlayerLifecycle.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionController.d.ts +30 -0
- package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionController.d.ts.map +1 -0
- package/dist/typescript/{module/features/voice/playing/model/VoiceTranscriptionsDropdown.model.d.ts → commonjs/features/voice/playing/model/Dropdown.model.d.ts} +2 -2
- package/dist/typescript/commonjs/features/voice/playing/model/Dropdown.model.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/model/PlaybackController.d.ts +28 -0
- package/dist/typescript/commonjs/features/voice/playing/model/PlaybackController.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/model/Player.model.d.ts +4 -0
- package/dist/typescript/commonjs/features/voice/playing/model/Player.model.d.ts.map +1 -1
- package/dist/typescript/{module/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts → commonjs/features/voice/playing/model/TranscriptionsCollection.d.ts} +2 -2
- package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsCollection.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloader.model.d.ts +19 -0
- package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloader.model.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/model/Translation.model.d.ts +25 -0
- package/dist/typescript/commonjs/features/voice/playing/model/Translation.model.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 +19 -18
- package/dist/typescript/commonjs/features/voice/playing/model/VoicePlayer.model.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voice/types.d.ts +14 -2
- package/dist/typescript/commonjs/features/voice/types.d.ts.map +1 -1
- package/dist/typescript/commonjs/index.d.ts +1 -0
- package/dist/typescript/commonjs/index.d.ts.map +1 -1
- package/dist/typescript/module/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.d.ts.map +1 -1
- package/dist/typescript/module/features/fluency/components/Fluency.d.ts.map +1 -1
- package/dist/typescript/module/features/fluency/components/select-math-operator/SelectMathOperator.d.ts.map +1 -1
- package/dist/typescript/module/features/fluency/model/FluencyModel.d.ts +0 -3
- package/dist/typescript/module/features/fluency/model/FluencyModel.d.ts.map +1 -1
- package/dist/typescript/module/features/fluency/shared/fluency.constants.d.ts +0 -4
- package/dist/typescript/module/features/fluency/shared/fluency.constants.d.ts.map +1 -1
- package/dist/typescript/module/features/fluency/shared/fluency.helpers.d.ts +0 -1
- package/dist/typescript/module/features/fluency/shared/fluency.helpers.d.ts.map +1 -1
- package/dist/typescript/module/features/pmProgress/model/PmProgressModel.d.ts.map +1 -1
- package/dist/typescript/module/features/pmProgress/model/PmRecommendationsModel.d.ts +38 -9
- package/dist/typescript/module/features/pmProgress/model/PmRecommendationsModel.d.ts.map +1 -1
- package/dist/typescript/module/features/pmProgress/shared/pmProgress.helpers.d.ts +0 -1
- package/dist/typescript/module/features/pmProgress/shared/pmProgress.helpers.d.ts.map +1 -1
- package/dist/typescript/module/features/translation/constants.d.ts +5 -0
- package/dist/typescript/module/features/translation/constants.d.ts.map +1 -0
- package/dist/typescript/module/features/translation/helpers.d.ts +9 -0
- package/dist/typescript/module/features/translation/helpers.d.ts.map +1 -0
- package/dist/typescript/module/features/translation/index.d.ts +12 -0
- package/dist/typescript/module/features/translation/index.d.ts.map +1 -0
- package/dist/typescript/module/features/translation/model/TranslationModel.d.ts +33 -0
- package/dist/typescript/module/features/translation/model/TranslationModel.d.ts.map +1 -0
- package/dist/typescript/module/features/translation/model/TranslationPreprocessor.d.ts +34 -0
- package/dist/typescript/module/features/translation/model/TranslationPreprocessor.d.ts.map +1 -0
- package/dist/typescript/module/features/translation/model/TranslationService.d.ts +40 -0
- package/dist/typescript/module/features/translation/model/TranslationService.d.ts.map +1 -0
- package/dist/typescript/module/features/translation/preserve/wordsToPreserve.d.ts +3 -0
- package/dist/typescript/module/features/translation/preserve/wordsToPreserve.d.ts.map +1 -0
- package/dist/typescript/module/features/translation/providers/google/GoogleTranslationProvider.d.ts +17 -0
- package/dist/typescript/module/features/translation/providers/google/GoogleTranslationProvider.d.ts.map +1 -0
- package/dist/typescript/module/features/translation/providers/google/supportedLanguages.d.ts +209 -0
- package/dist/typescript/module/features/translation/providers/google/supportedLanguages.d.ts.map +1 -0
- package/dist/typescript/module/features/translation/providers/google.types.d.ts +15 -0
- package/dist/typescript/module/features/translation/providers/google.types.d.ts.map +1 -0
- package/dist/typescript/module/features/translation/providers/translation.interface.d.ts +30 -0
- package/dist/typescript/module/features/translation/providers/translation.interface.d.ts.map +1 -0
- package/dist/typescript/module/features/translation/types.d.ts +27 -0
- package/dist/typescript/module/features/translation/types.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/index.d.ts +3 -1
- package/dist/typescript/module/features/voice/index.d.ts.map +1 -1
- package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptContent.d.ts +8 -0
- package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptContent.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/components/VoiceTranscription.d.ts +16 -0
- package/dist/typescript/module/features/voice/playing/components/VoiceTranscription.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts +10 -0
- package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts +12 -0
- package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/hooks/{useVoiceTranscriptionsDropdown.d.ts → useDropdownAnimation.d.ts} +3 -3
- package/dist/typescript/module/features/voice/playing/hooks/useDropdownAnimation.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/hooks/useVoicePlayerLifecycle.d.ts +15 -0
- package/dist/typescript/module/features/voice/playing/hooks/useVoicePlayerLifecycle.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionController.d.ts +30 -0
- package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionController.d.ts.map +1 -0
- package/dist/typescript/{commonjs/features/voice/playing/model/VoiceTranscriptionsDropdown.model.d.ts → module/features/voice/playing/model/Dropdown.model.d.ts} +2 -2
- package/dist/typescript/module/features/voice/playing/model/Dropdown.model.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/model/PlaybackController.d.ts +28 -0
- package/dist/typescript/module/features/voice/playing/model/PlaybackController.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/model/Player.model.d.ts +4 -0
- package/dist/typescript/module/features/voice/playing/model/Player.model.d.ts.map +1 -1
- package/dist/typescript/{commonjs/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts → module/features/voice/playing/model/TranscriptionsCollection.d.ts} +2 -2
- package/dist/typescript/module/features/voice/playing/model/TranscriptionsCollection.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloader.model.d.ts +19 -0
- package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloader.model.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/model/Translation.model.d.ts +25 -0
- package/dist/typescript/module/features/voice/playing/model/Translation.model.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 +19 -18
- package/dist/typescript/module/features/voice/playing/model/VoicePlayer.model.d.ts.map +1 -1
- package/dist/typescript/module/features/voice/types.d.ts +14 -2
- package/dist/typescript/module/features/voice/types.d.ts.map +1 -1
- package/dist/typescript/module/index.d.ts +1 -0
- package/dist/typescript/module/index.d.ts.map +1 -1
- package/package.json +37 -10
- package/src/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.tsx +2 -9
- package/src/features/fluency/components/Fluency.tsx +9 -17
- package/src/features/fluency/components/select-math-operator/SelectMathOperator.tsx +5 -13
- package/src/features/fluency/model/FluencyModel.ts +1 -25
- package/src/features/fluency/shared/fluency.constants.ts +0 -5
- package/src/features/fluency/shared/fluency.helpers.ts +0 -3
- package/src/features/pmProgress/model/PmProgressModel.ts +1 -4
- package/src/features/pmProgress/model/PmRecommendationsModel.ts +6 -22
- package/src/features/pmProgress/shared/pmProgress.helpers.ts +0 -33
- package/src/features/translation/constants.ts +4 -0
- package/src/features/translation/helpers.ts +63 -0
- package/src/features/translation/index.ts +30 -0
- package/src/features/translation/model/TranslationModel.ts +174 -0
- package/src/features/translation/model/TranslationPreprocessor.ts +171 -0
- package/src/features/translation/model/TranslationService.ts +148 -0
- package/src/features/translation/preserve/wordsToPreserve.ts +87 -0
- package/src/features/translation/providers/google/GoogleTranslationProvider.ts +50 -0
- package/src/features/translation/providers/google/supportedLanguages.ts +229 -0
- package/src/features/translation/providers/google.types.ts +16 -0
- package/src/features/translation/providers/translation.interface.ts +63 -0
- package/src/features/translation/types.ts +30 -0
- package/src/features/voice/index.ts +3 -1
- package/src/features/voice/playing/components/VoiceIcon.tsx +2 -2
- package/src/features/voice/playing/components/VoiceTranscriptContent.tsx +44 -0
- package/src/features/voice/playing/components/VoiceTranscription.tsx +117 -0
- package/src/features/voice/playing/components/VoiceTranscriptionCollapsible.tsx +59 -0
- package/src/features/voice/playing/components/VoiceTranscriptionHeaderActions.tsx +61 -0
- package/src/features/voice/playing/hooks/{useVoiceTranscriptionsDropdown.ts → useDropdownAnimation.ts} +5 -5
- package/src/features/voice/playing/hooks/useVoicePlayerLifecycle.ts +64 -0
- package/src/features/voice/playing/hooks/useVoiceTranscriptionController.ts +148 -0
- package/src/features/voice/playing/model/{VoiceTranscriptionsDropdown.model.ts → Dropdown.model.ts} +2 -2
- package/src/features/voice/playing/model/PlaybackController.ts +221 -0
- package/src/features/voice/playing/model/Player.model.ts +52 -4
- package/src/features/voice/playing/model/{VoiceTranscriptionsCollection.ts → TranscriptionsCollection.ts} +1 -1
- package/src/features/voice/playing/model/TranscriptionsDownloader.model.ts +88 -0
- package/src/features/voice/playing/model/Translation.model.ts +75 -0
- package/src/features/voice/playing/model/VoiceFileDownloader.model.ts +2 -2
- package/src/features/voice/playing/model/VoicePlayer.model.ts +68 -192
- package/src/features/voice/recording/components/VoiceRecordDivider.tsx +2 -2
- package/src/features/voice/types.ts +21 -1
- package/src/i18n/.generated/schema.json +3 -7
- package/src/index.ts +1 -0
- package/dist/commonjs/features/fluency/components/FluencyStatusOverlay.js +0 -101
- package/dist/commonjs/features/fluency/components/FluencyStatusOverlay.js.map +0 -1
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.js +0 -245
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.js.map +0 -1
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js +0 -109
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js.map +0 -1
- package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.js.map +0 -1
- package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.js +0 -34
- package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.js.map +0 -1
- package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.js +0 -66
- package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.js.map +0 -1
- package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionsCollection.js.map +0 -1
- package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionsDropdown.model.js.map +0 -1
- package/dist/module/features/fluency/components/FluencyStatusOverlay.js +0 -95
- package/dist/module/features/fluency/components/FluencyStatusOverlay.js.map +0 -1
- package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdown.js +0 -238
- package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdown.js.map +0 -1
- package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js +0 -103
- package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js.map +0 -1
- package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.js.map +0 -1
- package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.js +0 -29
- package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.js.map +0 -1
- package/dist/module/features/voice/playing/model/TranscriptionsDownloaderModel.js +0 -61
- package/dist/module/features/voice/playing/model/TranscriptionsDownloaderModel.js.map +0 -1
- package/dist/module/features/voice/playing/model/VoiceTranscriptionsCollection.js.map +0 -1
- package/dist/module/features/voice/playing/model/VoiceTranscriptionsDropdown.model.js.map +0 -1
- package/dist/typescript/commonjs/features/fluency/components/FluencyStatusOverlay.d.ts +0 -8
- package/dist/typescript/commonjs/features/fluency/components/FluencyStatusOverlay.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts +0 -16
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdownItem.d.ts +0 -12
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdownItem.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.d.ts +0 -11
- package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts +0 -15
- package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionsDropdown.model.d.ts.map +0 -1
- package/dist/typescript/module/features/fluency/components/FluencyStatusOverlay.d.ts +0 -8
- package/dist/typescript/module/features/fluency/components/FluencyStatusOverlay.d.ts.map +0 -1
- package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts +0 -16
- package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts.map +0 -1
- package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionsDropdownItem.d.ts +0 -12
- package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionsDropdownItem.d.ts.map +0 -1
- package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.d.ts.map +0 -1
- package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.d.ts +0 -11
- package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.d.ts.map +0 -1
- package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts +0 -15
- package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts.map +0 -1
- package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts.map +0 -1
- package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionsDropdown.model.d.ts.map +0 -1
- package/src/features/fluency/components/FluencyStatusOverlay.tsx +0 -101
- package/src/features/voice/playing/components/VoiceTranscriptionsDropdown.tsx +0 -296
- package/src/features/voice/playing/components/VoiceTranscriptionsDropdownItem.tsx +0 -128
- package/src/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.ts +0 -40
- package/src/features/voice/playing/model/TranscriptionsDownloaderModel.ts +0 -80
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_effectorReact","require","_react","_reactI18next","_constants","_helpers","_supportedLanguages","_i18n","useVoiceTranscriptionController","model","answers","attemptOffset","attemptsCount","problemId","t","useText","i18n","useTranslation","playerState","isLoadingTranscripts","isTranslationActive","translations","isTranslating","useUnit","$playerState","loader","loadTranscriptForAttempt","pending","translation","$isActive","$translations","translate","autoActivatedAttempts","useRef","Set","activeAttempt","getActiveAttempt","activeAudioFileId","audioFileId","undefined","hasActiveAudio","anyAttemptHasAudio","useMemo","some","a","cachedEntry","getCachedTranscript","activeTranscript","text","hasTranscriptText","NO_AUDIO_BE_MESSAGE","isActiveTranscriptLoading","isSourceSameAsTarget","language","resolveGoogleLanguageCode","canTranslate","cachedTranslation","showTranslation","isTranslationLoading","displayText","useEffect","dropdown","setExpanded","current","clear","has","add","setActive","attemptNumber","targetLanguage","doneData","watch","result","onPlayPress","useCallback","togglePlayPause","onTranslationToggle","toggle","display","isLoading","flags","actions","exports"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/hooks/useVoiceTranscriptionController.ts"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAEA,IAAAK,mBAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAcO,MAAMO,+BAA+B,GAAGA,CAAC;EAC9CC,KAAK;EACLC,OAAO;EACPC,aAAa;EACbC,aAAa;EACbC;AACM,CAAC,KAAK;EACZ,MAAMC,CAAC,GAAG,IAAAC,aAAO,EAAC,CAAC;EACnB,MAAM;IAAEC;EAAK,CAAC,GAAG,IAAAC,4BAAc,EAAC,CAAC;EAEjC,MAAM,CAACC,WAAW,EAAEC,oBAAoB,EAAEC,mBAAmB,EAAEC,YAAY,EAAEC,aAAa,CAAC,GACzF,IAAAC,sBAAO,EAAC,CACNd,KAAK,CAACe,YAA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ACdC,kBAAkB;MAClBc,YAAY;MACZnC;IACF,CAAC;IACD6D,OAAO,EAAE;MACPR,WAAW;MACXG;IACF;EACF,CAAC;AACH,CAAC;AAAAM,OAAA,CAAA1E,+BAAA,GAAAA,+BAAA","ignoreList":[]}
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.DropdownModel = void 0;
|
|
7
7
|
var _effector = require("effector");
|
|
8
|
-
class
|
|
8
|
+
class DropdownModel {
|
|
9
9
|
toggleExpand = (0, _effector.createEvent)();
|
|
10
10
|
setExpanded = (0, _effector.createEvent)();
|
|
11
11
|
reset = (0, _effector.createEvent)();
|
|
12
12
|
$isExpanded = (0, _effector.restore)(this.setExpanded, false).on(this.toggleExpand, state => !state).reset(this.reset);
|
|
13
13
|
}
|
|
14
|
-
exports.
|
|
15
|
-
//# sourceMappingURL=
|
|
14
|
+
exports.DropdownModel = DropdownModel;
|
|
15
|
+
//# sourceMappingURL=Dropdown.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_effector","require","DropdownModel","toggleExpand","createEvent","setExpanded","reset","$isExpanded","restore","on","state","exports"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/Dropdown.model.ts"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAEO,MAAMC,aAAa,CAAC;EACTC,YAAY,GAAG,IAAAC,qBAAW,EAAC,CAAC;EAC5BC,WAAW,GAAG,IAAAD,qBAAW,EAAU,CAAC;EACpCE,KAAK,GAAG,IAAAF,qBAAW,EAAC,CAAC;EAErBG,WAAW,GAAG,IAAAC,iBAAO,EAAC,IAAI,CAACH,WAAW,EAAE,KAAK,CAAC,CAC3DI,EAAE,CAAC,IAAI,CAACN,YAAY,EAAGO,KAAK,IAAK,CAACA,KAAK,CAAC,CACxCJ,KAAK,CAAC,IAAI,CAACA,KAAK,CAAC;AACtB;AAACK,OAAA,CAAAT,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PlaybackController = void 0;
|
|
7
|
+
var _effector = require("effector");
|
|
8
|
+
var _PlayerModel = require("./Player.model.js");
|
|
9
|
+
class PlaybackController {
|
|
10
|
+
currentPlayingAttempt = null;
|
|
11
|
+
shouldPreventPlayback = false;
|
|
12
|
+
constructor(deps) {
|
|
13
|
+
this.collection = deps.collection;
|
|
14
|
+
this.player = deps.player;
|
|
15
|
+
this.downloader = deps.downloader;
|
|
16
|
+
this.player.playbackFinished.watch(() => this.clearCurrentAttempt());
|
|
17
|
+
}
|
|
18
|
+
togglePlayPause = attemptNumber => {
|
|
19
|
+
const playerState = this.player.$playerState.getState();
|
|
20
|
+
if (this.currentPlayingAttempt === attemptNumber && playerState === _PlayerModel.PlayerState.PLAYING) {
|
|
21
|
+
this.player.pause();
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
this.handlePlayAttempt(attemptNumber);
|
|
25
|
+
};
|
|
26
|
+
preloadAudio = (0, _effector.createEffect)(async attemptNumber => {
|
|
27
|
+
const item = this.collection.get(attemptNumber);
|
|
28
|
+
if (!item) return;
|
|
29
|
+
if (this.collection.hasAudio(attemptNumber)) {
|
|
30
|
+
this.primePlayerIfIdle(attemptNumber);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (item.audioDownloadPromise) {
|
|
34
|
+
try {
|
|
35
|
+
await item.audioDownloadPromise;
|
|
36
|
+
} catch {}
|
|
37
|
+
this.primePlayerIfIdle(attemptNumber);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
await this.downloadAudio(attemptNumber);
|
|
42
|
+
this.primePlayerIfIdle(attemptNumber);
|
|
43
|
+
} catch (error) {
|
|
44
|
+
if (error instanceof Error && error.name === 'AbortError') return;
|
|
45
|
+
console.error('Audio preload error:', error);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
primePlayerIfIdle(attemptNumber) {
|
|
49
|
+
if (this.player.$playerState.getState() !== _PlayerModel.PlayerState.IDLE) return;
|
|
50
|
+
if (this.currentPlayingAttempt !== null) return;
|
|
51
|
+
const audioUri = this.collection.get(attemptNumber)?.audioUri;
|
|
52
|
+
if (!audioUri) return;
|
|
53
|
+
this.player.prime(audioUri);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Non-destructive halt: pause + IDLE, keep audio loaded so a subsequent
|
|
57
|
+
// play() can resume the same uri without re-fetch. Previously this called
|
|
58
|
+
// player.stop() which did replace('') and set stopped=true — that corrupted
|
|
59
|
+
// the AudioPlayer (isLoaded stuck false) and aborted any in-flight play()'s
|
|
60
|
+
// waitForLoad, when the lifecycle hook re-fired stopAudio mid-play.
|
|
61
|
+
halt() {
|
|
62
|
+
this.shouldPreventPlayback = true;
|
|
63
|
+
this.abortAllDownloads();
|
|
64
|
+
if (this.player.player && this.player.$playerState.getState() !== _PlayerModel.PlayerState.IDLE) {
|
|
65
|
+
this.player.player.pause();
|
|
66
|
+
this.player.setPlayerState(_PlayerModel.PlayerState.IDLE);
|
|
67
|
+
}
|
|
68
|
+
this.clearCurrentAttempt();
|
|
69
|
+
}
|
|
70
|
+
releaseResources() {
|
|
71
|
+
this.collection.getAll().forEach(item => {
|
|
72
|
+
if (item.controller) {
|
|
73
|
+
this.downloader.abortDownload(item.controller);
|
|
74
|
+
}
|
|
75
|
+
if (item.audioUri?.startsWith('blob:')) {
|
|
76
|
+
try {
|
|
77
|
+
URL.revokeObjectURL(item.audioUri);
|
|
78
|
+
} catch (e) {}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
clearCurrentAttempt() {
|
|
83
|
+
this.currentPlayingAttempt = null;
|
|
84
|
+
}
|
|
85
|
+
abortAllDownloads() {
|
|
86
|
+
this.collection.getAll().forEach(item => {
|
|
87
|
+
if (item.controller && item.audioLoading) {
|
|
88
|
+
this.downloader.abortDownload(item.controller);
|
|
89
|
+
this.collection.update(item.attemptNumber, {
|
|
90
|
+
audioLoading: false,
|
|
91
|
+
controller: undefined,
|
|
92
|
+
audioDownloadPromise: undefined
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
async downloadAudio(attemptNumber) {
|
|
98
|
+
const item = this.collection.get(attemptNumber);
|
|
99
|
+
if (!item) return;
|
|
100
|
+
const {
|
|
101
|
+
collectionItem,
|
|
102
|
+
downloadPromise
|
|
103
|
+
} = await this.downloader.download({
|
|
104
|
+
audioFileId: item.audioFileId,
|
|
105
|
+
attemptNumber
|
|
106
|
+
});
|
|
107
|
+
this.collection.update(attemptNumber, collectionItem);
|
|
108
|
+
try {
|
|
109
|
+
const result = await downloadPromise;
|
|
110
|
+
this.collection.update(attemptNumber, {
|
|
111
|
+
audioUri: result.uri,
|
|
112
|
+
audioLoading: false,
|
|
113
|
+
audioError: undefined,
|
|
114
|
+
controller: undefined,
|
|
115
|
+
audioDownloadPromise: undefined
|
|
116
|
+
});
|
|
117
|
+
} catch (error) {
|
|
118
|
+
const isAbort = error instanceof Error && error.name === 'AbortError';
|
|
119
|
+
this.collection.update(attemptNumber, {
|
|
120
|
+
audioLoading: false,
|
|
121
|
+
audioError: isAbort ? undefined : error instanceof Error ? error.message : 'Failed to download audio',
|
|
122
|
+
controller: undefined,
|
|
123
|
+
audioDownloadPromise: undefined
|
|
124
|
+
});
|
|
125
|
+
throw error;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
handlePlayAttempt = (0, _effector.createEffect)(async attemptNumber => {
|
|
129
|
+
this.shouldPreventPlayback = false;
|
|
130
|
+
const item = this.collection.get(attemptNumber);
|
|
131
|
+
if (!item) return;
|
|
132
|
+
if (this.currentPlayingAttempt !== null && this.currentPlayingAttempt !== attemptNumber) {
|
|
133
|
+
this.abortAllDownloads();
|
|
134
|
+
}
|
|
135
|
+
if (this.collection.hasAudio(attemptNumber)) {
|
|
136
|
+
this.playAudioFx(attemptNumber);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
try {
|
|
140
|
+
this.player.setPlayerState(_PlayerModel.PlayerState.LOADING);
|
|
141
|
+
if (item.audioDownloadPromise) {
|
|
142
|
+
await item.audioDownloadPromise;
|
|
143
|
+
} else {
|
|
144
|
+
await this.downloadAudio(attemptNumber);
|
|
145
|
+
}
|
|
146
|
+
if (this.shouldPreventPlayback) {
|
|
147
|
+
this.player.setPlayerState(_PlayerModel.PlayerState.IDLE);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
this.player.setPlayerState(_PlayerModel.PlayerState.IDLE);
|
|
151
|
+
this.playAudioFx(attemptNumber);
|
|
152
|
+
} catch (error) {
|
|
153
|
+
if (error instanceof Error && error.name === 'AbortError') {
|
|
154
|
+
this.player.setPlayerState(_PlayerModel.PlayerState.IDLE);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
console.error('Audio download error:', error);
|
|
158
|
+
this.player.setPlayerState(_PlayerModel.PlayerState.IDLE);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
playAudioFx = (0, _effector.createEffect)(async attemptNumber => {
|
|
162
|
+
if (this.shouldPreventPlayback) return;
|
|
163
|
+
const item = this.collection.get(attemptNumber);
|
|
164
|
+
if (!item?.audioUri) {
|
|
165
|
+
console.warn('No audio URI available for attempt:', attemptNumber);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
try {
|
|
169
|
+
if (this.currentPlayingAttempt !== null && this.currentPlayingAttempt !== attemptNumber) {
|
|
170
|
+
this.player.player?.remove();
|
|
171
|
+
}
|
|
172
|
+
if (this.currentPlayingAttempt === attemptNumber && this.player.player?.playing) {
|
|
173
|
+
this.player.pause();
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
if (this.currentPlayingAttempt === attemptNumber && !this.player.player?.playing) {
|
|
177
|
+
this.player.resume();
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
this.currentPlayingAttempt = attemptNumber;
|
|
181
|
+
await this.player.play(item.audioUri);
|
|
182
|
+
} catch (error) {
|
|
183
|
+
console.error('Error playing audio:', error);
|
|
184
|
+
this.player.setPlayerState(_PlayerModel.PlayerState.IDLE);
|
|
185
|
+
this.collection.update(attemptNumber, {
|
|
186
|
+
audioError: error instanceof Error ? error.message : 'Failed to play audio'
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
exports.PlaybackController = PlaybackController;
|
|
192
|
+
//# sourceMappingURL=PlaybackController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_effector","require","_PlayerModel","PlaybackController","currentPlayingAttempt","shouldPreventPlayback","constructor","deps","collection","player","downloader","playbackFinished","watch","clearCurrentAttempt","togglePlayPause","attemptNumber","playerState","$playerState","getState","PlayerState","PLAYING","pause","handlePlayAttempt","preloadAudio","createEffect","item","get","hasAudio","primePlayerIfIdle","audioDownloadPromise","downloadAudio","error","Error","name","console","IDLE","audioUri","prime","halt","abortAllDownloads","setPlayerState","releaseResources","getAll","forEach","controller","abortDownload","startsWith","URL","revokeObjectURL","e","audioLoading","update","undefined","collectionItem","downloadPromise","download","audioFileId","result","uri","audioError","isAbort","message","playAudioFx","LOADING","warn","remove","playing","resume","play","exports"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/PlaybackController.ts"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAUO,MAAME,kBAAkB,CAAC;EAItBC,qBAAqB,GAAkB,IAAI;EAC3CC,qBAAqB,GAAG,KAAK;EAErCC,WAAWA,CAACC,IAA4B,EAAE;IACxC,IAAI,CAACC,UAAU,GAAG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I,IAAI,CAACjB,qBAAqB,KAAKW,aAAa,IAAI,CAAC,IAAI,CAACN,MAAM,CAACA,MAAM,EAAEyD,OAAO,EAAE;QAChF,IAAI,CAACzD,MAAM,CAAC0D,MAAM,CAAC,CAAC;QACpB;MACF;MAEA,IAAI,CAAC/D,qBAAqB,GAAGW,aAAa;MAC1C,MAAM,IAAI,CAACN,MAAM,CAAC2D,IAAI,CAAC3C,IAAI,CAACW,QAAQ,CAAC;IACvC,CAAC,CAAC,OAAOL,KAAK,EAAE;MACdG,OAAO,CAACH,KAAK,CAAC,sBAAsB,EAAEA,KAAK,CAAC;MAC5C,IAAI,CAACtB,MAAM,CAAC+B,cAAc,CAACrB,wBAAW,CAACgB,IAAI,CAAC;MAE5C,IAAI,CAAC3B,UAAU,CAAC2C,MAAM,CAACpC,aAAa,EAAE;QACpC4C,UAAU,EAAE5B,KAAK,YAAYC,KAAK,GAAGD,KAAK,CAAC8B,OAAO,GAAG;MACvD,CAAC,CAAC;IACJ;EACF,CAAC,CAAC;AACJ;AAACQ,OAAA,CAAAlE,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -12,10 +12,23 @@ let PlayerState = exports.PlayerState = /*#__PURE__*/function (PlayerState) {
|
|
|
12
12
|
PlayerState["LOADING"] = "loading";
|
|
13
13
|
PlayerState["IDLE"] = "idle";
|
|
14
14
|
return PlayerState;
|
|
15
|
-
}({});
|
|
15
|
+
}({}); // audio.play() returns a promise that rejects with AbortError when a subsequent
|
|
16
|
+
// pause() interrupts it. That's expected during pause/resume cycles; suppress noise.
|
|
17
|
+
const safePlay = audio => {
|
|
18
|
+
const result = audio.play();
|
|
19
|
+
if (result && typeof result.catch === 'function') {
|
|
20
|
+
;
|
|
21
|
+
result.catch(err => {
|
|
22
|
+
if (err?.name === 'AbortError') return;
|
|
23
|
+
throw err;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
};
|
|
16
27
|
class PlayerModel {
|
|
17
28
|
player = (0, _expoAudio.createAudioPlayer)();
|
|
18
29
|
stopped = false;
|
|
30
|
+
primedUri = null;
|
|
31
|
+
pendingSeek = null;
|
|
19
32
|
reset = (0, _effector.createEvent)();
|
|
20
33
|
setPlayerState = (0, _effector.createEvent)();
|
|
21
34
|
playbackFinished = (0, _effector.createEvent)();
|
|
@@ -39,14 +52,33 @@ class PlayerModel {
|
|
|
39
52
|
this.stopped = true;
|
|
40
53
|
if (this.player) {
|
|
41
54
|
this.player.replace('');
|
|
55
|
+
this.primedUri = null;
|
|
56
|
+
this.pendingSeek = null;
|
|
42
57
|
this.setPlayerState(PlayerState.IDLE);
|
|
43
58
|
} else {
|
|
44
59
|
console.warn('Cannot stop: audio player not initialized');
|
|
45
60
|
}
|
|
46
61
|
});
|
|
62
|
+
prime = (0, _effector.createEffect)(uri => {
|
|
63
|
+
if (!this.player) return;
|
|
64
|
+
if (this.primedUri === uri) return;
|
|
65
|
+
this.primedUri = uri;
|
|
66
|
+
this.player.replace(uri);
|
|
67
|
+
});
|
|
68
|
+
seek = (0, _effector.createEffect)(async seconds => {
|
|
69
|
+
// When not loaded, defer the seek so play()'s waitForLoad can apply it
|
|
70
|
+
// before starting playback — otherwise the requested offset is lost and
|
|
71
|
+
// audio starts from 0 after a scrub-across-attempt that halted the player.
|
|
72
|
+
if (!this.player?.isLoaded) {
|
|
73
|
+
this.pendingSeek = seconds;
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
this.pendingSeek = null;
|
|
77
|
+
await this.player.seekTo(seconds);
|
|
78
|
+
});
|
|
47
79
|
resume = (0, _effector.createEffect)(() => {
|
|
48
80
|
if (this.player) {
|
|
49
|
-
this.player
|
|
81
|
+
safePlay(this.player);
|
|
50
82
|
this.setPlayerState(PlayerState.PLAYING);
|
|
51
83
|
} else {
|
|
52
84
|
console.warn('Cannot resume: audio player not initialized');
|
|
@@ -58,10 +90,21 @@ class PlayerModel {
|
|
|
58
90
|
return;
|
|
59
91
|
}
|
|
60
92
|
this.stopped = false;
|
|
61
|
-
this.player.
|
|
62
|
-
|
|
93
|
+
if (this.primedUri !== uri || !this.player.isLoaded) {
|
|
94
|
+
this.player.replace(uri);
|
|
95
|
+
this.primedUri = uri;
|
|
96
|
+
}
|
|
97
|
+
const waitForLoad = async () => {
|
|
63
98
|
if (this.stopped) return;
|
|
64
99
|
if (this.player && this.player.isLoaded) {
|
|
100
|
+
if (this.pendingSeek !== null) {
|
|
101
|
+
const target = this.pendingSeek;
|
|
102
|
+
this.pendingSeek = null;
|
|
103
|
+
try {
|
|
104
|
+
await this.player.seekTo(target);
|
|
105
|
+
} catch {}
|
|
106
|
+
if (this.stopped) return;
|
|
107
|
+
}
|
|
65
108
|
const unsubscribe = this.player.addListener('playbackStatusUpdate', status => {
|
|
66
109
|
if (status.didJustFinish) {
|
|
67
110
|
this.playbackFinished();
|
|
@@ -69,7 +112,7 @@ class PlayerModel {
|
|
|
69
112
|
this.setPlayerState(PlayerState.IDLE);
|
|
70
113
|
}
|
|
71
114
|
});
|
|
72
|
-
this.player
|
|
115
|
+
safePlay(this.player);
|
|
73
116
|
this.setPlayerState(PlayerState.PLAYING);
|
|
74
117
|
} else {
|
|
75
118
|
setTimeout(waitForLoad, 10);
|
|
@@ -91,6 +134,8 @@ class PlayerModel {
|
|
|
91
134
|
this.player.release();
|
|
92
135
|
this.player = null;
|
|
93
136
|
}
|
|
137
|
+
this.primedUri = null;
|
|
138
|
+
this.pendingSeek = null;
|
|
94
139
|
this.reset();
|
|
95
140
|
}
|
|
96
141
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_effector","require","_expoAudio","PlayerState","exports","PlayerModel","player","createAudioPlayer","stopped","reset","createEvent","setPlayerState","playbackFinished","$playerState","restore","IDLE","setupAudioMode","createEffect","setAudioModeAsync","playsInSilentMode","shouldPlayInBackground","interruptionMode","pause","PAUSED","console","warn","stop","replace","
|
|
1
|
+
{"version":3,"names":["_effector","require","_expoAudio","PlayerState","exports","safePlay","audio","result","play","catch","err","name","PlayerModel","player","createAudioPlayer","stopped","primedUri","pendingSeek","reset","createEvent","setPlayerState","playbackFinished","$playerState","restore","IDLE","setupAudioMode","createEffect","setAudioModeAsync","playsInSilentMode","shouldPlayInBackground","interruptionMode","pause","PAUSED","console","warn","stop","replace","prime","uri","seek","seconds","isLoaded","seekTo","resume","PLAYING","waitForLoad","target","unsubscribe","addListener","status","didJustFinish","remove","setTimeout","reinitialize","release","error"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/Player.model.ts"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAA8E,IAE5DE,WAAW,GAAAC,OAAA,CAAAD,WAAA,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA,OAO7B;AACA;AACA,MAAME,QAAQ,GAAIC,KAAkB,IAAK;EACvC,MAAMC,MAAM,GAAGD,KAAK,CAACE,IAAI,CAAC,CAAY;EACtC,IAAID,MAAM,IAAI,OAAQA,MAAM,CAAsBE,KAAK,KAAK,UAAU,EAAE;IACtE;IAAEF,MAAM,CAAsBE,KAAK,CAAEC,GAAY,IAAK;MACpD,IAAKA,GAAG,EAAwBC,IAAI,KAAK,YAAY,EAAE;MACvD,MAAMD,GAAG;IACX,CAAC,CAAC;EACJ;AACF,CAAC;AAEM,MAAME,WAAW,CAAC;EAChBC,MAAM,GAAuB,IAAAC,4BAAiB,EAAC,CAAC;EAC/CC,OAAO,GAAG,KAAK;EACfC,SAAS,GAAkB,IAAI;EAC/BC,WAAW,GAAkB,IAAI;EAEzBC,KAAK,GAAG,IAAAC,qBAAW,EAAC,CAAC;EACrBC,cAAc,GAAG,IAAAD,qBAAW,EAAc,CAAC;EAC3CE,gBAAgB,GAAG,IAAAF,qBAAW,EAAC,CAAC;EAEhCG,YAAY,GAAG,IAAAC,iBAAO,EAAC,IAAI,CAACH,cAAc,EAAEjB,WAAW,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Q,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
class
|
|
6
|
+
exports.TranscriptionsCollection = void 0;
|
|
7
|
+
class TranscriptionsCollection {
|
|
8
8
|
collection = new Map();
|
|
9
9
|
add(attemptNumber, item) {
|
|
10
10
|
this.collection.set(attemptNumber, item);
|
|
@@ -37,5 +37,5 @@ class VoiceTranscriptionsCollection {
|
|
|
37
37
|
return !!item?.audioUri;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
exports.
|
|
41
|
-
//# sourceMappingURL=
|
|
40
|
+
exports.TranscriptionsCollection = TranscriptionsCollection;
|
|
41
|
+
//# sourceMappingURL=TranscriptionsCollection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TranscriptionsCollection","collection","Map","add","attemptNumber","item","set","update","existingItem","get","delete","getAll","Array","from","values","clear","hasTranscript","transcript","hasAudio","audioUri","exports"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/TranscriptionsCollection.ts"],"mappings":";;;;;;AAEO,MAAMA,wBAAwB,CAAC;EACpBC,UAAU,GAAwC,IAAIC,GAAG,CAAC,CAAC;EAEpEC,GAAGA,CAACC,aAAqB,EAAEC,IAA4B,EAAE;IAC9D,IAAI,CAACJ,UAAU,CAACK,GAAG,CAACF,aAAa,EAAEC,IAAI,CAAC;EAC1C;EAEOE,MAAMA,CAACH,aAAqB,EAAEC,IAAqC,EAAE;IAC1E,MAAMG,YAAY,GAAG,IAAI,CAACP,UAAU,CAACQ,GAAG,CAACL,aAAa,CAAC,IAAK,CAAC,CAA4B;IACzF,IAAI,CAACH,UAAU,CAACK,GAAG,CAACF,aAAa,EAAE;MAAE,GAAGI,YAAY;MAAE,GAAGH;IAAK,CAAC,CAAC;EAClE;EAEOK,MAAMA,CAACN,aAAqB,EAAE;IACnC,IAAI,CAACH,UAAU,CAACS,MAAM,CAACN,aAAa,CAAC;EACvC;EAEOK,GAAGA,CAACL,aAAqB,EAAE;IAChC,OAAO,IAAI,CAACH,UAAU,CAACQ,GAAG,CAACL,aAAa,CAAC;EAC3C;EAEOO,MAAMA,CAAA,EAAG;IACd,OAAOC,KAAK,CAACC,IAAI,CAAC,IAAI,CAACZ,UAAU,CAACa,MAAM,CAAC,CAAC,CAAC;EAC7C;EAEOC,KAAKA,CAAA,EAAG;IACb,IAAI,CAACd,UAAU,CAACc,KAAK,CAAC,CAAC;EACzB;EAEOC,aAAaA,CAACZ,aAAqB,EAAE;IAC1C,MAAMC,IAAI,GAAG,IAAI,CAACJ,UAAU,CAACQ,GAAG,CAACL,aAAa,CAAC;IAC/C,OAAO,CAAC,CAACC,IAAI,EAAEY,UAAU;EAC3B;EAEOC,QAAQA,CAACd,aAAqB,EAAE;IACrC,MAAMC,IAAI,GAAG,IAAI,CAACJ,UAAU,CAACQ,GAAG,CAACL,aAAa,CAAC;IAC/C,OAAO,CAAC,CAACC,IAAI,EAAEc,QAAQ;EACzB;AACF;AAACC,OAAA,CAAApB,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TranscriptionsDownloaderModel = void 0;
|
|
7
|
+
var _effector = require("effector");
|
|
8
|
+
var _types = require("../../types.js");
|
|
9
|
+
var _constants = require("../../constants.js");
|
|
10
|
+
class TranscriptionsDownloaderModel {
|
|
11
|
+
inflightFetches = new Map();
|
|
12
|
+
transcriptCache = new Map();
|
|
13
|
+
constructor(collection, api) {
|
|
14
|
+
this.collection = collection;
|
|
15
|
+
this.api = api;
|
|
16
|
+
}
|
|
17
|
+
async fetchTranscriptWithRetry(audioFileId) {
|
|
18
|
+
const cached = this.transcriptCache.get(audioFileId);
|
|
19
|
+
if (cached) return cached;
|
|
20
|
+
const existing = this.inflightFetches.get(audioFileId);
|
|
21
|
+
if (existing) return existing;
|
|
22
|
+
const promise = this.runFetchWithRetry(audioFileId).then(result => {
|
|
23
|
+
this.transcriptCache.set(audioFileId, result);
|
|
24
|
+
return result;
|
|
25
|
+
}).finally(() => {
|
|
26
|
+
this.inflightFetches.delete(audioFileId);
|
|
27
|
+
});
|
|
28
|
+
this.inflightFetches.set(audioFileId, promise);
|
|
29
|
+
return promise;
|
|
30
|
+
}
|
|
31
|
+
async runFetchWithRetry(audioFileId) {
|
|
32
|
+
for (let attempt = 0; attempt < _constants.TRANSCRIPT_MAX_RETRIES; attempt++) {
|
|
33
|
+
const response = await this.api.getAudioFileTranscript(audioFileId);
|
|
34
|
+
if (response.status === _types.TranscriptionStatus.COMPLETED) {
|
|
35
|
+
return {
|
|
36
|
+
text: response.text,
|
|
37
|
+
language: response.language
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
if (response.status === _types.TranscriptionStatus.FAILED) {
|
|
41
|
+
return {
|
|
42
|
+
text: _constants.NO_AUDIO_BE_MESSAGE
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
if (attempt < _constants.TRANSCRIPT_MAX_RETRIES - 1) {
|
|
46
|
+
await new Promise(resolve => setTimeout(resolve, _constants.TRANSCRIPT_RETRY_INTERVAL_MS));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
text: _constants.NO_AUDIO_BE_MESSAGE
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
loadTranscriptForAttempt = (0, _effector.createEffect)(async attemptNumber => {
|
|
54
|
+
const item = this.collection.get(attemptNumber);
|
|
55
|
+
if (!item?.audioFileId) return;
|
|
56
|
+
if (item.transcript || item.transcriptLoading) return;
|
|
57
|
+
this.collection.update(attemptNumber, {
|
|
58
|
+
transcriptLoading: true
|
|
59
|
+
});
|
|
60
|
+
try {
|
|
61
|
+
const {
|
|
62
|
+
text,
|
|
63
|
+
language
|
|
64
|
+
} = await this.fetchTranscriptWithRetry(item.audioFileId);
|
|
65
|
+
this.collection.update(attemptNumber, {
|
|
66
|
+
transcript: text,
|
|
67
|
+
transcriptLanguage: language,
|
|
68
|
+
transcriptLoading: false,
|
|
69
|
+
transcriptError: undefined
|
|
70
|
+
});
|
|
71
|
+
} catch (error) {
|
|
72
|
+
this.collection.update(attemptNumber, {
|
|
73
|
+
transcriptLoading: false,
|
|
74
|
+
transcriptError: error instanceof Error ? error.message : 'Failed to load transcript'
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
getCachedTranscript(audioFileId) {
|
|
79
|
+
return this.transcriptCache.get(audioFileId);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.TranscriptionsDownloaderModel = TranscriptionsDownloaderModel;
|
|
83
|
+
//# sourceMappingURL=TranscriptionsDownloader.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_effector","require","_types","_constants","TranscriptionsDownloaderModel","inflightFetches","Map","transcriptCache","constructor","collection","api","fetchTranscriptWithRetry","audioFileId","cached","get","existing","promise","runFetchWithRetry","then","result","set","finally","delete","attempt","TRANSCRIPT_MAX_RETRIES","response","getAudioFileTranscript","status","TranscriptionStatus","COMPLETED","text","language","FAILED","NO_AUDIO_BE_MESSAGE","Promise","resolve","setTimeout","TRANSCRIPT_RETRY_INTERVAL_MS","loadTranscriptForAttempt","createEffect","attemptNumber","item","transcript","transcriptLoading","update","transcriptLanguage","transcriptError","undefined","error","Error","message","getCachedTranscript","exports"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/TranscriptionsDownloader.model.ts"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAQO,MAAMG,6BAA6B,CAAC;EAGxBC,eAAe,GAA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F,CAAC,CAAC;EAEKC,mBAAmBA,CAACvC,WAAmB,EAAgC;IAC5E,OAAO,IAAI,CAACL,eAAe,CAACO,GAAG,CAACF,WAAW,CAAC;EAC9C;AACF;AAACwC,OAAA,CAAAhD,6BAAA,GAAAA,6BAAA","ignoreList":[]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TranslationModel = void 0;
|
|
7
|
+
var _effector = require("effector");
|
|
8
|
+
var _TranslationService = require("../../../translation/model/TranslationService.js");
|
|
9
|
+
var _GoogleTranslationProvider = require("../../../translation/providers/google/GoogleTranslationProvider.js");
|
|
10
|
+
var _wordsToPreserve = require("../../../translation/preserve/wordsToPreserve.js");
|
|
11
|
+
class TranslationModel {
|
|
12
|
+
toggle = (0, _effector.createEvent)();
|
|
13
|
+
setActive = (0, _effector.createEvent)();
|
|
14
|
+
clearCache = (0, _effector.createEvent)();
|
|
15
|
+
reset = (0, _effector.createEvent)();
|
|
16
|
+
$isActive = (0, _effector.restore)(this.setActive, false).on(this.toggle, state => !state).reset(this.reset);
|
|
17
|
+
translate = (0, _effector.createEffect)(async ({
|
|
18
|
+
attemptNumber,
|
|
19
|
+
targetLanguage
|
|
20
|
+
}) => {
|
|
21
|
+
const item = this.collection.get(attemptNumber);
|
|
22
|
+
if (!item?.transcript) return null;
|
|
23
|
+
const text = await this.service.translate(item.transcript, {
|
|
24
|
+
targetLang: targetLanguage,
|
|
25
|
+
sourceLang: item.transcriptLanguage,
|
|
26
|
+
cacheKey: `voice::${attemptNumber}::${targetLanguage}`
|
|
27
|
+
});
|
|
28
|
+
if (!text) return null;
|
|
29
|
+
return {
|
|
30
|
+
attemptNumber,
|
|
31
|
+
text
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
$translations = (0, _effector.createStore)({}).on(this.translate.doneData, (state, result) => {
|
|
35
|
+
if (!result) return state;
|
|
36
|
+
return {
|
|
37
|
+
...state,
|
|
38
|
+
[result.attemptNumber]: result.text
|
|
39
|
+
};
|
|
40
|
+
}).reset(this.reset, this.clearCache);
|
|
41
|
+
constructor(collection, api) {
|
|
42
|
+
this.collection = collection;
|
|
43
|
+
this.service = new _TranslationService.TranslationService({
|
|
44
|
+
preserve: {
|
|
45
|
+
map: _wordsToPreserve.wordsToPreserve,
|
|
46
|
+
replacers: _wordsToPreserve.preservedWordsReplacers
|
|
47
|
+
},
|
|
48
|
+
providers: [new _GoogleTranslationProvider.GoogleTranslationProvider({
|
|
49
|
+
api: {
|
|
50
|
+
translateRequest: api.translateText
|
|
51
|
+
}
|
|
52
|
+
})]
|
|
53
|
+
});
|
|
54
|
+
this.clearCache.watch(() => this.service.reset());
|
|
55
|
+
this.reset.watch(() => this.service.reset());
|
|
56
|
+
}
|
|
57
|
+
getTranslation(attemptNumber) {
|
|
58
|
+
return this.$translations.getState()[attemptNumber];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.TranslationModel = TranslationModel;
|
|
62
|
+
//# sourceMappingURL=Translation.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_effector","require","_TranslationService","_GoogleTranslationProvider","_wordsToPreserve","TranslationModel","toggle","createEvent","setActive","clearCache","reset","$isActive","restore","on","state","translate","createEffect","attemptNumber","targetLanguage","item","collection","get","transcript","text","service","targetLang","sourceLang","transcriptLanguage","cacheKey","$translations","createStore","doneData","result","constructor","api","TranslationService","preserve","map","wordsToPreserve","replacers","preservedWordsReplacers","providers","GoogleTranslationProvider","translateRequest","translateText","watch","getTranslation","getState","exports"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/Translation.model.ts"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAGA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,0BAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OA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M,CAACT;IAAK,CAAC;EAC1D,CAAC,CAAC,CACDb,KAAK,CAAC,IAAI,CAACA,KAAK,EAAE,IAAI,CAACD,UAAU,CAAC;EAErCwB,WAAWA,CAACb,UAAoC,EAAEc,GAAmB,EAAE;IACrE,IAAI,CAACd,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACI,OAAO,GAAG,IAAIW,sCAAkB,CAAC;MACpCC,QAAQ,EAAE;QACRC,GAAG,EAAEC,gCAAe;QACpBC,SAAS,EAAEC;MACb,CAAC;MACDC,SAAS,EAAE,CAAC,IAAIC,oDAAyB,CAAC;QAAER,GAAG,EAAE;UAAES,gBAAgB,EAAET,GAAG,CAACU;QAAc;MAAE,CAAC,CAAC;IAC7F,CAAC,CAAC;IAEF,IAAI,CAACnC,UAAU,CAACoC,KAAK,CAAC,MAAM,IAAI,CAACrB,OAAO,CAACd,KAAK,CAAC,CAAC,CAAC;IACjD,IAAI,CAACA,KAAK,CAACmC,KAAK,CAAC,MAAM,IAAI,CAACrB,OAAO,CAACd,KAAK,CAAC,CAAC,CAAC;EAC9C;EAEOoC,cAAcA,CAAC7B,aAAqB,EAAsB;IAC/D,OAAO,IAAI,CAACY,aAAa,CAACkB,QAAQ,CAAC,CAAC,CAAC9B,aAAa,CAAC;EACrD;AACF;AAAC+B,OAAA,CAAA3C,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -7,9 +7,9 @@ exports.VoiceFileDownloaderModel = void 0;
|
|
|
7
7
|
var _effector = require("effector");
|
|
8
8
|
var _helpers = require("../../helpers.js");
|
|
9
9
|
class VoiceFileDownloaderModel {
|
|
10
|
-
|
|
10
|
+
constructor(api) {
|
|
11
11
|
this.api = api;
|
|
12
|
-
}
|
|
12
|
+
}
|
|
13
13
|
download = (0, _effector.createEffect)(async ({
|
|
14
14
|
audioFileId,
|
|
15
15
|
attemptNumber
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_effector","require","_helpers","VoiceFileDownloaderModel","
|
|
1
|
+
{"version":3,"names":["_effector","require","_helpers","VoiceFileDownloaderModel","constructor","api","download","createEffect","audioFileId","attemptNumber","downloadAudio","controller","downloadAudioFileRequestGenerator","downloadPromise","collectionItem","audioLoading","audioDownloadPromise","abortDownload","abort","exports"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/VoiceFileDownloader.model.ts"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAYO,MAAME,wBAAwB,CAAC;EAGpCC,WAAWA,CAACC,GAAmB,EAAE;IAC/B,IAAI,CAACA,GAAG,GAAGA,GAAG;EAChB;EAEgBC,QAAQ,GAAG,IAAAC,sBAAY,EACrC,OAAO;IAAEC,WAAW;IAAEC;EAA8B,CAAC,KAA8B;IACjF,MAAM;MAAEC,aAAa;MAAEC;IAAW,CAAC,GAAG,IAAAC,0CAAiC,EAACJ,WAAW,EAAE,IAAI,CAACH,GAAG,CAAC;IAC9F,MAAMQ,eAAe,GAAGH,aAAa,CAAC,CAAC;IAEvC,MAAMI,cAA+C,GAAG;MACtDL,aAAa;MACbD,WAAW;MACXO,YAAY,EAAE,IAAI;MAClBC,oBAAoB,EAAEH,eAAe;MACrCF;IACF,CAAC;IAED,OAAO;MAAEG,cAAc;MAAED;IAAgB,CAAC;EAC5C,CACF,CAAC;EAEeI,aAAa,GAAIN,UAA4B,IAAK;IAChEA,UAAU,EAAEO,KAAK,CAAC,CAAC;EACrB,CAAC;AACH;AAACC,OAAA,CAAAhB,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|