@magmamath/students-features 1.3.22 → 1.3.23-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +4 -4
- package/dist/commonjs/features/voice/index.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 +142 -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 +59 -0
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.js.map +1 -0
- package/dist/commonjs/features/voice/playing/hooks/{useVoiceTranscriptionsDropdown.js → useVoiceTranscription.js} +4 -4
- package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscription.js.map +1 -0
- package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionAutoTranslate.js +26 -0
- package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionAutoTranslate.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/TranscriptionsDownloaderModel.js +18 -4
- package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.js.map +1 -1
- package/dist/commonjs/features/voice/playing/model/VoicePlayer.model.js +6 -2
- package/dist/commonjs/features/voice/playing/model/VoicePlayer.model.js.map +1 -1
- package/dist/commonjs/features/voice/playing/model/{VoiceTranscriptionsDropdown.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 +62 -0
- package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionTranslation.model.js.map +1 -0
- package/dist/commonjs/features/voice/types.js +6 -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/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 +1 -1
- package/dist/module/features/voice/index.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 +134 -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 +51 -0
- package/dist/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.js.map +1 -0
- package/dist/module/features/voice/playing/hooks/{useVoiceTranscriptionsDropdown.js → useVoiceTranscription.js} +2 -2
- package/dist/module/features/voice/playing/hooks/useVoiceTranscription.js.map +1 -0
- package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionAutoTranslate.js +21 -0
- package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionAutoTranslate.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/TranscriptionsDownloaderModel.js +18 -4
- package/dist/module/features/voice/playing/model/TranscriptionsDownloaderModel.js.map +1 -1
- package/dist/module/features/voice/playing/model/VoicePlayer.model.js +6 -2
- package/dist/module/features/voice/playing/model/VoicePlayer.model.js.map +1 -1
- package/dist/module/features/voice/playing/model/{VoiceTranscriptionsDropdown.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 +57 -0
- package/dist/module/features/voice/playing/model/VoiceTranscriptionTranslation.model.js.map +1 -0
- package/dist/module/features/voice/types.js +5 -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/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 +1 -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/{module/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.d.ts → commonjs/features/voice/playing/hooks/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/useVoiceTranscriptionAutoTranslate.d.ts +10 -0
- package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionAutoTranslate.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/TranscriptionsDownloaderModel.d.ts +1 -0
- package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voice/playing/model/VoicePlayer.model.d.ts +4 -2
- package/dist/typescript/commonjs/features/voice/playing/model/VoicePlayer.model.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voice/playing/model/{VoiceTranscriptionsDropdown.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 +25 -0
- package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionTranslation.model.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/types.d.ts +9 -1
- 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/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 +1 -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/{commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.d.ts → module/features/voice/playing/hooks/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/useVoiceTranscriptionAutoTranslate.d.ts +10 -0
- package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionAutoTranslate.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/TranscriptionsDownloaderModel.d.ts +1 -0
- package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts.map +1 -1
- package/dist/typescript/module/features/voice/playing/model/VoicePlayer.model.d.ts +4 -2
- package/dist/typescript/module/features/voice/playing/model/VoicePlayer.model.d.ts.map +1 -1
- package/dist/typescript/module/features/voice/playing/model/{VoiceTranscriptionsDropdown.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 +25 -0
- package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionTranslation.model.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/types.d.ts +9 -1
- 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 +1 -1
- 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 +1 -1
- package/src/features/voice/playing/components/VoiceTranscriptContent.tsx +37 -0
- package/src/features/voice/playing/components/VoiceTranscription.tsx +175 -0
- package/src/features/voice/playing/components/VoiceTranscriptionCollapsible.tsx +59 -0
- package/src/features/voice/playing/components/VoiceTranscriptionHeaderActions.tsx +62 -0
- package/src/features/voice/playing/hooks/{useVoiceTranscriptionsDropdown.ts → useVoiceTranscription.ts} +2 -2
- package/src/features/voice/playing/hooks/useVoiceTranscriptionAutoTranslate.ts +32 -0
- package/src/features/voice/playing/hooks/useVoiceTranscriptionEffects.ts +44 -0
- package/src/features/voice/playing/model/TranscriptionsDownloaderModel.ts +12 -5
- package/src/features/voice/playing/model/VoicePlayer.model.ts +7 -2
- package/src/features/voice/playing/model/{VoiceTranscriptionsDropdown.model.ts → VoiceTranscription.model.ts} +2 -2
- package/src/features/voice/playing/model/VoiceTranscriptionTranslation.model.ts +75 -0
- package/src/features/voice/types.ts +15 -0
- package/src/index.ts +1 -0
- 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/VoiceTranscriptionsDropdown.model.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/VoiceTranscriptionsDropdown.model.js.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/VoiceTranscriptionsDropdown.model.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/VoiceTranscriptionsDropdown.model.d.ts.map +0 -1
- 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
|
@@ -4,7 +4,7 @@ import { useEffect } from 'react';
|
|
|
4
4
|
import { useUnit } from 'effector-react';
|
|
5
5
|
import { useAnimatedStyle, useSharedValue, withTiming, interpolate } from 'react-native-reanimated';
|
|
6
6
|
import { DROPDOWN_MAX_CONTENT_HEIGHT } from "../../constants.js";
|
|
7
|
-
export const
|
|
7
|
+
export const useVoiceTranscriptionDropdown = model => {
|
|
8
8
|
const isExpanded = useUnit(model.$isExpanded);
|
|
9
9
|
const contentHeight = useSharedValue(0);
|
|
10
10
|
const animationProgress = useSharedValue(isExpanded ? 1 : 0);
|
|
@@ -42,4 +42,4 @@ export const useVoiceTranscriptionsDropdown = model => {
|
|
|
42
42
|
onListLayout
|
|
43
43
|
};
|
|
44
44
|
};
|
|
45
|
-
//# sourceMappingURL=
|
|
45
|
+
//# sourceMappingURL=useVoiceTranscription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useUnit","useAnimatedStyle","useSharedValue","withTiming","interpolate","DROPDOWN_MAX_CONTENT_HEIGHT","useVoiceTranscriptionDropdown","model","isExpanded","$isExpanded","contentHeight","animationProgress","onListLayout","event","measuredHeight","nativeEvent","layout","height","value","listAnimatedStyle","opacity","iconAnimatedStyle","rotation","transform","rotate","duration"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/hooks/useVoiceTranscription.ts"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,OAAO,QAAQ,gBAAgB;AACxC,SAASC,gBAAgB,EAAEC,cAAc,EAAEC,UAAU,EAAEC,WAAW,QAAQ,yBAAyB;AAEnG,SAASC,2BAA2B,QAAQ,oBAAiB;AAG7D,OAAO,MAAMC,6BAA6B,GAAIC,KAA8B,IAAK;EAC/E,MAAMC,UAAU,GAAGR,OAAO,CAACO,KAAK,CAACE,WAAW,CAAC;EAE7C,MAAMC,aAAa,GAAGR,cAAc,CAAC,CAAC,CAAC;EACvC,MAAMS,iBAAiB,GAAGT,cAAc,CAACM,UAAU,GAAG,CAAC,GAAG,CAAC,CAAC;EAE5D,MAAMI,YAAY,GAAIC,KAAwB,IAAK;IACjD,MAAMC,cAAc,GAAGD,KAAK,CAACE,WAAW,CAACC,MAAM,CAACC,MAAM;IACtD,IAAIH,cAAc,GAAG,CAAC,EAAE;MACtBJ,aAAa,CAACQ,KAAK,GAAGJ,cAAc;IACtC;EACF,CAAC;EAED,MAAMK,iBAAiB,GAAGlB,gBAAgB,CAAC,MAAM;IAC/C,MAAMgB,MAAM,GAAGb,WAAW,CACxBO,iBAAiB,CAACO,KAAK,EACvB,CAAC,CAAC,EAAE,CAAC,CAAC,EACN,CAAC,CAAC,EAAER,aAAa,CAACQ,KAAK,IAAIb,2BAA2B,CACxD,CAAC;IAED,MAAMe,OAAO,GAAGhB,WAAW,CAACO,iBAAiB,CAACO,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAE5E,OAAO;MACLD,MAAM;MACNG;IACF,CAAC;EACH,CAAC,EAAE,CAACT,iBAAiB,EAAED,aAAa,CAAC,CAAC;EAEtC,MAAMW,iBAAiB,GAAGpB,gBAAgB,CAAC,MAAM;IAC/C,MAAMqB,QAAQ,GAAGlB,WAAW,CAACO,iBAAiB,CAACO,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAEvE,OAAO;MACLK,SAAS,EAAE,CAAC;QAAEC,MAAM,EAAE,GAAGF,QAAQ;MAAM,CAAC;IAC1C,CAAC;EACH,CAAC,EAAE,CAACX,iBAAiB,CAAC,CAAC;EAEvBZ,SAAS,CAAC,MAAM;IACdY,iBAAiB,CAACO,KAAK,GAAGf,UAAU,CAACK,UAAU,GAAG,CAAC,GAAG,CAAC,EAAE;MAAEiB,QAAQ,EAAE;IAAI,CAAC,CAAC;EAC7E,CAAC,EAAE,CAACjB,UAAU,EAAEG,iBAAiB,CAAC,CAAC;EAEnC,OAAO;IACLH,UAAU;IACVW,iBAAiB;IACjBE,iBAAiB;IACjBT;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef } from 'react';
|
|
4
|
+
export const useVoiceTranscriptionAutoTranslate = ({
|
|
5
|
+
translationModel,
|
|
6
|
+
canTranslate,
|
|
7
|
+
activeAttempt,
|
|
8
|
+
problemId
|
|
9
|
+
}) => {
|
|
10
|
+
const autoActivatedAttempts = useRef(new Set());
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
autoActivatedAttempts.current.clear();
|
|
13
|
+
}, [problemId]);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (canTranslate && activeAttempt !== null && !autoActivatedAttempts.current.has(activeAttempt)) {
|
|
16
|
+
autoActivatedAttempts.current.add(activeAttempt);
|
|
17
|
+
translationModel.setActive(true);
|
|
18
|
+
}
|
|
19
|
+
}, [canTranslate, activeAttempt, translationModel]);
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=useVoiceTranscriptionAutoTranslate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","useVoiceTranscriptionAutoTranslate","translationModel","canTranslate","activeAttempt","problemId","autoActivatedAttempts","Set","current","clear","has","add","setActive"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/hooks/useVoiceTranscriptionAutoTranslate.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AASzC,OAAO,MAAMC,kCAAkC,GAAGA,CAAC;EACjDC,gBAAgB;EAChBC,YAAY;EACZC,aAAa;EACbC;AACM,CAAC,KAAK;EACZ,MAAMC,qBAAqB,GAAGN,MAAM,CAAC,IAAIO,GAAG,CAAS,CAAC,CAAC;EAEvDR,SAAS,CAAC,MAAM;IACdO,qBAAqB,CAACE,OAAO,CAACC,KAAK,CAAC,CAAC;EACvC,CAAC,EAAE,CAACJ,SAAS,CAAC,CAAC;EAEfN,SAAS,CAAC,MAAM;IACd,IACEI,YAAY,IACZC,aAAa,KAAK,IAAI,IACtB,CAACE,qBAAqB,CAACE,OAAO,CAACE,GAAG,CAACN,aAAa,CAAC,EACjD;MACAE,qBAAqB,CAACE,OAAO,CAACG,GAAG,CAACP,aAAa,CAAC;MAChDF,gBAAgB,CAACU,SAAS,CAAC,IAAI,CAAC;IAClC;EACF,CAAC,EAAE,CAACT,YAAY,EAAEC,aAAa,EAAEF,gBAAgB,CAAC,CAAC;AACrD,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useEffect, useRef } from 'react';
|
|
4
|
+
export const useVoiceTranscriptionEffects = ({
|
|
5
|
+
model,
|
|
6
|
+
answers,
|
|
7
|
+
answersKey,
|
|
8
|
+
problemId,
|
|
9
|
+
activeAttempt
|
|
10
|
+
}) => {
|
|
11
|
+
const answersRef = useRef(answers);
|
|
12
|
+
answersRef.current = answers;
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
model.reinitializePlayer();
|
|
15
|
+
return () => model.cleanup();
|
|
16
|
+
}, [model]);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
const lastAnswerHasNoDrawing = !answers[answers.length - 1]?.drawing;
|
|
19
|
+
model.dropdown.setExpanded(answers.length > 0 && lastAnswerHasNoDrawing);
|
|
20
|
+
model.resetPlayer();
|
|
21
|
+
}, [problemId]);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (answersRef.current.some(answer => answer.audioFileId)) {
|
|
24
|
+
model.initializeWithAudios(answersRef.current);
|
|
25
|
+
model.loader.loadAllTranscripts();
|
|
26
|
+
}
|
|
27
|
+
}, [model, answersKey]);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
model.stopAudio();
|
|
30
|
+
}, [activeAttempt]);
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=useVoiceTranscriptionEffects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","useVoiceTranscriptionEffects","model","answers","answersKey","problemId","activeAttempt","answersRef","current","reinitializePlayer","cleanup","lastAnswerHasNoDrawing","length","drawing","dropdown","setExpanded","resetPlayer","some","answer","audioFileId","initializeWithAudios","loader","loadAllTranscripts","stopAudio"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/hooks/useVoiceTranscriptionEffects.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAYzC,OAAO,MAAMC,4BAA4B,GAAGA,CAAC;EAC3CC,KAAK;EACLC,OAAO;EACPC,UAAU;EACVC,SAAS;EACTC;AACM,CAAC,KAAK;EACZ,MAAMC,UAAU,GAAGP,MAAM,CAACG,OAAO,CAAC;EAClCI,UAAU,CAACC,OAAO,GAAGL,OAAO;EAE5BJ,SAAS,CAAC,MAAM;IACdG,KAAK,CAACO,kBAAkB,CAAC,CAAC;IAC1B,OAAO,MAAMP,KAAK,CAACQ,OAAO,CAAC,CAAC;EAC9B,CAAC,EAAE,CAACR,KAAK,CAAC,CAAC;EAEXH,SAAS,CAAC,MAAM;IACd,MAAMY,sBAAsB,GAAG,CAACR,OAAO,CAACA,OAAO,CAACS,MAAM,GAAG,CAAC,CAAC,EAAEC,OAAO;IACpEX,KAAK,CAACY,QAAQ,CAACC,WAAW,CAACZ,OAAO,CAACS,MAAM,GAAG,CAAC,IAAID,sBAAsB,CAAC;IACxET,KAAK,CAACc,WAAW,CAAC,CAAC;EACrB,CAAC,EAAE,CAACX,SAAS,CAAC,CAAC;EAEfN,SAAS,CAAC,MAAM;IACd,IAAIQ,UAAU,CAACC,OAAO,CAACS,IAAI,CAAEC,MAAM,IAAKA,MAAM,CAACC,WAAW,CAAC,EAAE;MAC3DjB,KAAK,CAACkB,oBAAoB,CAACb,UAAU,CAACC,OAAO,CAAC;MAC9CN,KAAK,CAACmB,MAAM,CAACC,kBAAkB,CAAC,CAAC;IACnC;EACF,CAAC,EAAE,CAACpB,KAAK,EAAEE,UAAU,CAAC,CAAC;EAEvBL,SAAS,CAAC,MAAM;IACdG,KAAK,CAACqB,SAAS,CAAC,CAAC;EACnB,CAAC,EAAE,CAACjB,aAAa,CAAC,CAAC;AACrB,CAAC","ignoreList":[]}
|
|
@@ -14,16 +14,23 @@ export class TranscriptionsDownloaderModel {
|
|
|
14
14
|
for (let attempt = 0; attempt < TRANSCRIPT_MAX_RETRIES; attempt++) {
|
|
15
15
|
const response = await this.api.getAudioFileTranscript(audioFileId);
|
|
16
16
|
if (response.status === 'completed') {
|
|
17
|
-
return
|
|
17
|
+
return {
|
|
18
|
+
text: response.text,
|
|
19
|
+
language: response.language
|
|
20
|
+
};
|
|
18
21
|
}
|
|
19
22
|
if (response.status === 'failed') {
|
|
20
|
-
return
|
|
23
|
+
return {
|
|
24
|
+
text: NO_AUDIO_BE_MESSAGE
|
|
25
|
+
};
|
|
21
26
|
}
|
|
22
27
|
if (attempt < TRANSCRIPT_MAX_RETRIES - 1) {
|
|
23
28
|
await new Promise(resolve => setTimeout(resolve, TRANSCRIPT_RETRY_INTERVAL_MS));
|
|
24
29
|
}
|
|
25
30
|
}
|
|
26
|
-
return
|
|
31
|
+
return {
|
|
32
|
+
text: NO_AUDIO_BE_MESSAGE
|
|
33
|
+
};
|
|
27
34
|
}
|
|
28
35
|
loadAllTranscripts = createEffect(async () => {
|
|
29
36
|
const attempts = this.collection.getAll();
|
|
@@ -35,9 +42,13 @@ export class TranscriptionsDownloaderModel {
|
|
|
35
42
|
transcriptLoading: true
|
|
36
43
|
});
|
|
37
44
|
try {
|
|
38
|
-
const
|
|
45
|
+
const {
|
|
46
|
+
text,
|
|
47
|
+
language
|
|
48
|
+
} = await this.fetchTranscriptWithRetry(item.audioFileId);
|
|
39
49
|
this.collection.update(item.attemptNumber, {
|
|
40
50
|
transcript: text,
|
|
51
|
+
transcriptLanguage: language,
|
|
41
52
|
transcriptLoading: false,
|
|
42
53
|
transcriptError: undefined
|
|
43
54
|
});
|
|
@@ -54,6 +65,9 @@ export class TranscriptionsDownloaderModel {
|
|
|
54
65
|
getTranscript(attemptNumber) {
|
|
55
66
|
return this.collection.get(attemptNumber)?.transcript;
|
|
56
67
|
}
|
|
68
|
+
getTranscriptLanguage(attemptNumber) {
|
|
69
|
+
return this.collection.get(attemptNumber)?.transcriptLanguage;
|
|
70
|
+
}
|
|
57
71
|
isTranscriptLoading(attemptNumber) {
|
|
58
72
|
return this.collection.get(attemptNumber)?.transcriptLoading || false;
|
|
59
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createEffect","createEvent","restore","NO_AUDIO_BE_MESSAGE","TRANSCRIPT_MAX_RETRIES","TRANSCRIPT_RETRY_INTERVAL_MS","TranscriptionsDownloaderModel","setTranscriptsLoaded","reset","$transcriptsLoaded","constructor","collection","api","fetchTranscriptWithRetry","audioFileId","attempt","response","getAudioFileTranscript","status","text","Promise","resolve","setTimeout","loadAllTranscripts","attempts","getAll","transcriptPromises","map","item","hasTranscript","attemptNumber","update","transcriptLoading","transcript","transcriptError","undefined","error","Error","message","all","getTranscript","get","isTranscriptLoading"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/TranscriptionsDownloaderModel.ts"],"mappings":";;AAAA,SAASA,YAAY,EAAEC,WAAW,EAAEC,OAAO,QAAQ,UAAU;AAG7D,SACEC,mBAAmB,EACnBC,sBAAsB,EACtBC,4BAA4B,QACvB,oBAAiB;AAExB,OAAO,MAAMC,6BAA6B,CAAC;EAIzBC,oBAAoB,GAAGN,WAAW,CAAU,CAAC;EAC7CO,KAAK,GAAGP,WAAW,CAAC,CAAC;EAErBQ,kBAAkB,GAAGP,OAAO,CAAC,IAAI,CAACK,oBAAoB,EAAE,KAAK,CAAC,CAACC,KAAK,CAAC,IAAI,CAACA,KAAK,CAAC;EAEhGE,WAAWA,CAACC,UAAyC,EAAEC,GAAmB,EAAE;IAC1E,IAAI,CAACD,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACC,GAAG,GAAGA,GAAG;EAChB;EAEA,MAAcC,wBAAwBA,
|
|
1
|
+
{"version":3,"names":["createEffect","createEvent","restore","NO_AUDIO_BE_MESSAGE","TRANSCRIPT_MAX_RETRIES","TRANSCRIPT_RETRY_INTERVAL_MS","TranscriptionsDownloaderModel","setTranscriptsLoaded","reset","$transcriptsLoaded","constructor","collection","api","fetchTranscriptWithRetry","audioFileId","attempt","response","getAudioFileTranscript","status","text","language","Promise","resolve","setTimeout","loadAllTranscripts","attempts","getAll","transcriptPromises","map","item","hasTranscript","attemptNumber","update","transcriptLoading","transcript","transcriptLanguage","transcriptError","undefined","error","Error","message","all","getTranscript","get","getTranscriptLanguage","isTranscriptLoading"],"sourceRoot":"../../../../../../src","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E,OAAO,IAAI,CAACpB,UAAU,CAACgC,GAAG,CAACZ,aAAa,CAAC,EAAEI,kBAAkB;EAC/D;EAEOU,mBAAmBA,CAACd,aAAqB,EAAW;IACzD,OAAO,IAAI,CAACpB,UAAU,CAACgC,GAAG,CAACZ,aAAa,CAAC,EAAEE,iBAAiB,IAAI,KAAK;EACvE;AACF","ignoreList":[]}
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
import { attach, createEffect, createEvent, restore } from 'effector';
|
|
4
4
|
import { VoiceTranscriptionsCollection } from "./VoiceTranscriptionsCollection.js";
|
|
5
5
|
import { VoiceFileDownloaderModel } from "./VoiceFileDownloader.model.js";
|
|
6
|
-
import {
|
|
6
|
+
import { VoiceTranscriptionModel } from "./VoiceTranscription.model.js";
|
|
7
|
+
import { VoiceTranscriptionTranslationModel } from "./VoiceTranscriptionTranslation.model.js";
|
|
7
8
|
import { PlayerModel, PlayerState } from "./Player.model.js";
|
|
8
9
|
import { TranscriptionsDownloaderModel } from "./TranscriptionsDownloaderModel.js";
|
|
9
10
|
export class VoicePlayerModel {
|
|
10
11
|
collection = new VoiceTranscriptionsCollection();
|
|
11
12
|
downloader = new VoiceFileDownloaderModel();
|
|
12
|
-
dropdown = new
|
|
13
|
+
dropdown = new VoiceTranscriptionModel();
|
|
13
14
|
playerModel = new PlayerModel();
|
|
14
15
|
currentPlayingAttempt = null;
|
|
15
16
|
shouldPreventPlayback = false;
|
|
@@ -32,10 +33,12 @@ export class VoicePlayerModel {
|
|
|
32
33
|
this.currentPlayingAttempt = null;
|
|
33
34
|
this.setCurrentAttempt(null);
|
|
34
35
|
this.collection.clear();
|
|
36
|
+
this.translation.clearCache();
|
|
35
37
|
};
|
|
36
38
|
constructor(params) {
|
|
37
39
|
this.api = params.api;
|
|
38
40
|
this.loader = new TranscriptionsDownloaderModel(this.collection, params.api);
|
|
41
|
+
this.translation = new VoiceTranscriptionTranslationModel(this.collection, params.api);
|
|
39
42
|
this.downloader.setApi(params.api);
|
|
40
43
|
this.playerModel.playbackFinished.watch(() => {
|
|
41
44
|
this.currentPlayingAttempt = null;
|
|
@@ -195,6 +198,7 @@ export class VoicePlayerModel {
|
|
|
195
198
|
this.reset();
|
|
196
199
|
this.loader.reset();
|
|
197
200
|
this.dropdown.reset();
|
|
201
|
+
this.translation.reset();
|
|
198
202
|
this.playerModel.release();
|
|
199
203
|
}
|
|
200
204
|
togglePlayPause = attach({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["attach","createEffect","createEvent","restore","VoiceTranscriptionsCollection","VoiceFileDownloaderModel","
|
|
1
|
+
{"version":3,"names":["attach","createEffect","createEvent","restore","VoiceTranscriptionsCollection","VoiceFileDownloaderModel","VoiceTranscriptionModel","VoiceTranscriptionTranslationModel","PlayerModel","PlayerState","TranscriptionsDownloaderModel","VoicePlayerModel","collection","downloader","dropdown","playerModel","currentPlayingAttempt","shouldPreventPlayback","setCurrentAttempt","reset","$currentAttempt","$playerState","pauseAudio","pause","stopAudio","abortAllDownloads","stop","resetPlayer","releaseCollectionResources","clear","translation","clearCache","constructor","params","api","loader","setApi","playbackFinished","watch","audios","initializeCollectionFromAudios","setupAudioMode","initializeWithAudios","answerAudio","setTranscriptsLoaded","console","warn","forEach","audio","index","attemptNumber","audioFileId","add","_id","hasDrawing","drawing","getAll","item","controller","abortDownload","audioUri","startsWith","URL","revokeObjectURL","e","audioLoading","update","undefined","audioDownloadPromise","handlePlayAttempt","get","hasAudio","playAudioFx","setPlayerState","LOADING","collectionItem","downloadPromise","download","abort","result","uri","audioError","IDLE","error","Error","name","message","player","remove","playing","resume","play","isAudioLoading","getAllAttempts","reinitializePlayer","reinitialize","cleanup","release","togglePlayPause","source","mapParams","playerState","effect","PLAYING"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/VoicePlayer.model.ts"],"mappings":";;AAAA,SAASA,MAAM,EAAEC,YAAY,EAAEC,WAAW,EAAEC,OAAO,QAAQ,UAAU;AACrE,SAASC,6BAA6B,QA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CAAC;IACjC,IAAI,CAAChB,UAAU,CAACiB,KAAK,CAAC,CAAC;IACvB,IAAI,CAACb,qBAAqB,GAAG,IAAI;IACjC,IAAI,CAACG,KAAK,CAAC,CAAC;IACZ,IAAI,CAACgB,MAAM,CAAChB,KAAK,CAAC,CAAC;IACnB,IAAI,CAACL,QAAQ,CAACK,KAAK,CAAC,CAAC;IACrB,IAAI,CAACW,WAAW,CAACX,KAAK,CAAC,CAAC;IACxB,IAAI,CAACJ,WAAW,CAACkF,OAAO,CAAC,CAAC;EAC5B;EAEOC,eAAe,GAAGlG,MAAM,CAAC;IAC9BmG,MAAM,EAAE,IAAI,CAACpF,WAAW,CAACM,YAAY;IACrC+E,SAAS,EAAEA,CAAClD,aAAqB,EAAEmD,WAAW,MAAM;MAAEnD,aAAa;MAAEmD;IAAY,CAAC,CAAC;IACnFC,MAAM,EAAErG,YAAY,CAAC,CAAC;MAAEiD,aAAa;MAAEmD;IAAmC,CAAC,KAAK;MAC9E,IAAI,IAAI,CAACrF,qBAAqB,KAAKkC,aAAa,IAAImD,WAAW,KAAK5F,WAAW,CAAC8F,OAAO,EAAE;QACvF,IAAI,CAACjF,UAAU,CAAC,CAAC;MACnB,CAAC,MAAM;QACL,IAAI,CAAC+C,iBAAiB,CAACnB,aAAa,CAAC;MACvC;IACF,CAAC;EACH,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { createEvent, restore } from 'effector';
|
|
4
|
-
export class
|
|
4
|
+
export class VoiceTranscriptionModel {
|
|
5
5
|
toggleExpand = createEvent();
|
|
6
6
|
setExpanded = createEvent();
|
|
7
7
|
reset = createEvent();
|
|
8
8
|
$isExpanded = restore(this.setExpanded, false).on(this.toggleExpand, state => !state).reset(this.reset);
|
|
9
9
|
}
|
|
10
|
-
//# sourceMappingURL=
|
|
10
|
+
//# sourceMappingURL=VoiceTranscription.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createEvent","restore","VoiceTranscriptionModel","toggleExpand","setExpanded","reset","$isExpanded","on","state"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/VoiceTranscription.model.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,OAAO,QAAQ,UAAU;AAE/C,OAAO,MAAMC,uBAAuB,CAAC;EACnBC,YAAY,GAAGH,WAAW,CAAC,CAAC;EAC5BI,WAAW,GAAGJ,WAAW,CAAU,CAAC;EACpCK,KAAK,GAAGL,WAAW,CAAC,CAAC;EAErBM,WAAW,GAAGL,OAAO,CAAC,IAAI,CAACG,WAAW,EAAE,KAAK,CAAC,CAC3DG,EAAE,CAAC,IAAI,CAACJ,YAAY,EAAGK,KAAK,IAAK,CAACA,KAAK,CAAC,CACxCH,KAAK,CAAC,IAAI,CAACA,KAAK,CAAC;AACtB","ignoreList":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createEffect, createEvent, createStore, restore } from 'effector';
|
|
4
|
+
import { TranslationService } from "../../../translation/model/TranslationService.js";
|
|
5
|
+
import { GoogleTranslationProvider } from "../../../translation/providers/google/GoogleTranslationProvider.js";
|
|
6
|
+
import { preservedWordsReplacers, wordsToPreserve } from "../../../translation/preserve/wordsToPreserve.js";
|
|
7
|
+
export class VoiceTranscriptionTranslationModel {
|
|
8
|
+
toggle = createEvent();
|
|
9
|
+
setActive = createEvent();
|
|
10
|
+
clearCache = createEvent();
|
|
11
|
+
reset = createEvent();
|
|
12
|
+
$isActive = restore(this.setActive, false).on(this.toggle, state => !state).reset(this.reset);
|
|
13
|
+
translate = createEffect(async ({
|
|
14
|
+
attemptNumber,
|
|
15
|
+
targetLanguage
|
|
16
|
+
}) => {
|
|
17
|
+
const item = this.collection.get(attemptNumber);
|
|
18
|
+
if (!item?.transcript) return null;
|
|
19
|
+
const text = await this.service.translate(item.transcript, {
|
|
20
|
+
targetLang: targetLanguage,
|
|
21
|
+
sourceLang: item.transcriptLanguage,
|
|
22
|
+
cacheKey: `voice::${attemptNumber}::${targetLanguage}`
|
|
23
|
+
});
|
|
24
|
+
if (!text) return null;
|
|
25
|
+
return {
|
|
26
|
+
attemptNumber,
|
|
27
|
+
text
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
$translations = createStore({}).on(this.translate.doneData, (state, result) => {
|
|
31
|
+
if (!result) return state;
|
|
32
|
+
return {
|
|
33
|
+
...state,
|
|
34
|
+
[result.attemptNumber]: result.text
|
|
35
|
+
};
|
|
36
|
+
}).reset(this.reset, this.clearCache);
|
|
37
|
+
constructor(collection, api) {
|
|
38
|
+
this.collection = collection;
|
|
39
|
+
this.service = new TranslationService({
|
|
40
|
+
preserve: {
|
|
41
|
+
map: wordsToPreserve,
|
|
42
|
+
replacers: preservedWordsReplacers
|
|
43
|
+
},
|
|
44
|
+
providers: [new GoogleTranslationProvider({
|
|
45
|
+
api: {
|
|
46
|
+
translateRequest: api.translateText
|
|
47
|
+
}
|
|
48
|
+
})]
|
|
49
|
+
});
|
|
50
|
+
this.clearCache.watch(() => this.service.reset());
|
|
51
|
+
this.reset.watch(() => this.service.reset());
|
|
52
|
+
}
|
|
53
|
+
getTranslation(attemptNumber) {
|
|
54
|
+
return this.$translations.getState()[attemptNumber];
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=VoiceTranscriptionTranslation.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createEffect","createEvent","createStore","restore","TranslationService","GoogleTranslationProvider","preservedWordsReplacers","wordsToPreserve","VoiceTranscriptionTranslationModel","toggle","setActive","clearCache","reset","$isActive","on","state","translate","attemptNumber","targetLanguage","item","collection","get","transcript","text","service","targetLang","sourceLang","transcriptLanguage","cacheKey","$translations","doneData","result","constructor","api","preserve","map","replacers","providers","translateRequest","translateText","watch","getTranslation","getState"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/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E,SAAS,CAACc,QAAQ,EAAE,CAACf,KAAK,EAAEgB,MAAM,KAAK;IAC9C,IAAI,CAACA,MAAM,EAAE,OAAOhB,KAAK;IACzB,OAAO;MAAE,GAAGA,KAAK;MAAE,CAACgB,MAAM,CAACd,aAAa,GAAGc,MAAM,CAACR;IAAK,CAAC;EAC1D,CAAC,CAAC,CACDX,KAAK,CAAC,IAAI,CAACA,KAAK,EAAE,IAAI,CAACD,UAAU,CAAC;EAErCqB,WAAWA,CAACZ,UAAyC,EAAEa,GAAmB,EAAE;IAC1E,IAAI,CAACb,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACI,OAAO,GAAG,IAAIpB,kBAAkB,CAAC;MACpC8B,QAAQ,EAAE;QACRC,GAAG,EAAE5B,eAAe;QACpB6B,SAAS,EAAE9B;MACb,CAAC;MACD+B,SAAS,EAAE,CAAC,IAAIhC,yBAAyB,CAAC;QAAE4B,GAAG,EAAE;UAAEK,gBAAgB,EAAEL,GAAG,CAACM;QAAc;MAAE,CAAC,CAAC;IAC7F,CAAC,CAAC;IAEF,IAAI,CAAC5B,UAAU,CAAC6B,KAAK,CAAC,MAAM,IAAI,CAAChB,OAAO,CAACZ,KAAK,CAAC,CAAC,CAAC;IACjD,IAAI,CAACA,KAAK,CAAC4B,KAAK,CAAC,MAAM,IAAI,CAAChB,OAAO,CAACZ,KAAK,CAAC,CAAC,CAAC;EAC9C;EAEO6B,cAAcA,CAACxB,aAAqB,EAAsB;IAC/D,OAAO,IAAI,CAACY,aAAa,CAACa,QAAQ,CAAC,CAAC,CAACzB,aAAa,CAAC;EACrD;AACF","ignoreList":[]}
|
|
@@ -5,4 +5,9 @@ export let RecordButtonVariant = /*#__PURE__*/function (RecordButtonVariant) {
|
|
|
5
5
|
RecordButtonVariant["ADVANCED"] = "advanced";
|
|
6
6
|
return RecordButtonVariant;
|
|
7
7
|
}({});
|
|
8
|
+
export let VoiceTranscriptionVariant = /*#__PURE__*/function (VoiceTranscriptionVariant) {
|
|
9
|
+
VoiceTranscriptionVariant["SMALL"] = "small";
|
|
10
|
+
VoiceTranscriptionVariant["LARGE"] = "large";
|
|
11
|
+
return VoiceTranscriptionVariant;
|
|
12
|
+
}({});
|
|
8
13
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RecordButtonVariant"],"sourceRoot":"../../../../src","sources":["features/voice/types.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"names":["RecordButtonVariant","VoiceTranscriptionVariant"],"sourceRoot":"../../../../src","sources":["features/voice/types.ts"],"mappings":";;AA8FA,WAAYA,mBAAmB,0BAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAA,OAAnBA,mBAAmB;AAAA;AAK/B,WAAYC,yBAAyB,0BAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAA,OAAzBA,yBAAyB;AAAA","ignoreList":[]}
|
package/dist/module/index.js
CHANGED
|
@@ -16,4 +16,5 @@ export * from "./shared/icons/index.js";
|
|
|
16
16
|
export * from "./features/voice/index.js";
|
|
17
17
|
export * from "./features/featureUsage/index.js";
|
|
18
18
|
export * from "./features/uiMode/index.js";
|
|
19
|
+
export * from "./features/translation/index.js";
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
package/dist/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["generateRandomId"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,0BAAuB;AACxD,cAAc,6BAAoB;AAClC,cAAc,8BAAqB;AACnC,cAAc,kCAAyB;AACvC,cAAc,qCAA4B;AAC1C,cAAc,kCAAyB;AACvC,cAAc,qCAA4B;AAC1C,cAAc,qCAA4B;AAC1C,cAAc,qCAA4B;AAC1C,cAAc,8BAAqB;AACnC,cAAc,gCAAuB;AACrC,cAAc,+BAAsB;AACpC,cAAc,yBAAgB;AAC9B,cAAc,2BAAkB;AAChC,cAAc,kCAAyB;AACvC,cAAc,4BAAmB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["generateRandomId"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,0BAAuB;AACxD,cAAc,6BAAoB;AAClC,cAAc,8BAAqB;AACnC,cAAc,kCAAyB;AACvC,cAAc,qCAA4B;AAC1C,cAAc,kCAAyB;AACvC,cAAc,qCAA4B;AAC1C,cAAc,qCAA4B;AAC1C,cAAc,qCAA4B;AAC1C,cAAc,8BAAqB;AACnC,cAAc,gCAAuB;AACrC,cAAc,+BAAsB;AACpC,cAAc,yBAAgB;AAC9B,cAAc,2BAAkB;AAChC,cAAc,kCAAyB;AACvC,cAAc,4BAAmB;AACjC,cAAc,iCAAwB","ignoreList":[]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const GBD_TEXT_CACHE_SUFFIX = "::gbd";
|
|
2
|
+
export declare const DESCRIPTION_CACHE_KEY_SUFFIX = "::description";
|
|
3
|
+
export declare const CHOICES_CACHE_KEY_SUFFIX = "::choices";
|
|
4
|
+
export declare const PRACTICE_THEORY_CACHE_KEY_SUFFIX = "::practice-theory";
|
|
5
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/features/translation/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,UAAU,CAAA;AAC5C,eAAO,MAAM,4BAA4B,kBAAkB,CAAA;AAC3D,eAAO,MAAM,wBAAwB,cAAc,CAAA;AACnD,eAAO,MAAM,gCAAgC,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MaskSegmentParams } from './types';
|
|
2
|
+
export declare function replaceMappedTokens(input: string, map: Record<string, string>): string;
|
|
3
|
+
/**
|
|
4
|
+
* Masks text segments matched by `regex` with a placeholder,
|
|
5
|
+
* while preserving spaces around the original match.
|
|
6
|
+
*/
|
|
7
|
+
export declare const maskSegment: ({ text, regex, placeholder, replacements, shouldSkip, }: MaskSegmentParams) => string;
|
|
8
|
+
export declare const decodeHtmlEntities: (text: string) => string;
|
|
9
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/features/translation/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE3C,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAWtF;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,4DAMrB,iBAAiB,KAAG,MAkBtB,CAAA;AAWD,eAAO,MAAM,kBAAkB,SAAU,MAAM,KAAG,MAQjD,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { TranslationModel } from './model/TranslationModel';
|
|
2
|
+
export { TranslationService, type TranslateConfigProps } from './model/TranslationService';
|
|
3
|
+
export { TranslationKatexPreprocessor } from './model/TranslationPreprocessor';
|
|
4
|
+
export { TranslationProvider, type LanguageGlossary } from './providers/translation.interface';
|
|
5
|
+
export { GoogleTranslationProvider } from './providers/google/GoogleTranslationProvider';
|
|
6
|
+
export { GoogleTranslateLanguage } from './providers/google/supportedLanguages';
|
|
7
|
+
export type { GoogleTranslateProps, GoogleTranslateResponse, GoogleTranslation, } from './providers/google.types';
|
|
8
|
+
export { wordsToPreserve, preservedWordsReplacers } from './preserve/wordsToPreserve';
|
|
9
|
+
export { GBD_TEXT_CACHE_SUFFIX, DESCRIPTION_CACHE_KEY_SUFFIX, CHOICES_CACHE_KEY_SUFFIX, PRACTICE_THEORY_CACHE_KEY_SUFFIX, } from './constants';
|
|
10
|
+
export { replaceMappedTokens, maskSegment, decodeHtmlEntities, } from './helpers';
|
|
11
|
+
export type { TranslatableProblem, TranslateAllFxParams, TranslateFxParams, Replacement, MaskSegmentParams, } from './types';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/translation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,kBAAkB,EAAE,KAAK,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAC1F,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAA;AAC9E,OAAO,EAAE,mBAAmB,EAAE,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AAC9F,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAA;AACxF,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAA;AAC/E,YAAY,EACV,oBAAoB,EACpB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AACrF,OAAO,EACL,qBAAqB,EACrB,4BAA4B,EAC5B,wBAAwB,EACxB,gCAAgC,GACjC,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,kBAAkB,GACnB,MAAM,WAAW,CAAA;AAClB,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,GAClB,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Store, Unit } from 'effector';
|
|
2
|
+
import { GoogleTranslateProps, GoogleTranslateResponse } from '../providers/google.types';
|
|
3
|
+
import { TranslatableProblem, TranslateFxParams } from '../types';
|
|
4
|
+
type TranslationModelProps<TProblem extends TranslatableProblem> = {
|
|
5
|
+
$problem: Store<TProblem | null>;
|
|
6
|
+
$problemId: Store<string>;
|
|
7
|
+
$assignmentId: Store<string>;
|
|
8
|
+
$currentProblemIndex: Store<number>;
|
|
9
|
+
$translationLanguageCode: Store<string>;
|
|
10
|
+
$contentLanguageCode?: Store<string>;
|
|
11
|
+
$isTranslationLocked: Store<boolean>;
|
|
12
|
+
languageChanged: Unit<unknown>;
|
|
13
|
+
api: {
|
|
14
|
+
translateRequest: (payload: GoogleTranslateProps) => Promise<GoogleTranslateResponse>;
|
|
15
|
+
};
|
|
16
|
+
getGreatWorkFeedbackText?: () => string;
|
|
17
|
+
};
|
|
18
|
+
export declare class TranslationModel<TProblem extends TranslatableProblem = TranslatableProblem> {
|
|
19
|
+
private readonly service;
|
|
20
|
+
readonly toggle: import("effector").EventCallable<void>;
|
|
21
|
+
readonly setTranslated: import("effector").EventCallable<boolean>;
|
|
22
|
+
readonly reset: import("effector").EventCallable<void>;
|
|
23
|
+
readonly $isTranslationActive: import("effector").StoreWritable<boolean>;
|
|
24
|
+
readonly $isTranslated: import("effector").StoreWritable<boolean>;
|
|
25
|
+
readonly $isTranslationPending: Store<boolean>;
|
|
26
|
+
readonly translateFx: import("effector").Effect<TranslateFxParams, string, Error>;
|
|
27
|
+
readonly translateAllFx: import("effector").Effect<void, unknown[] | undefined, Error>;
|
|
28
|
+
constructor({ $problem, $problemId, $assignmentId, $currentProblemIndex, $translationLanguageCode, $contentLanguageCode, $isTranslationLocked, languageChanged, api, getGreatWorkFeedbackText, }: TranslationModelProps<TProblem>);
|
|
29
|
+
getTranslated<T extends string | string[]>(key: string): T | undefined;
|
|
30
|
+
clearCache(): void;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=TranslationModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TranslationModel.d.ts","sourceRoot":"","sources":["../../../../../../src/features/translation/model/TranslationModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,EACL,IAAI,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pB,eAAe,EACf,GAAG,EACH,wBAAwB,GACzB,EAAE,qBAAqB,CAAC,QAAQ,CAAC;IA8F3B,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAItE,UAAU;CAGlB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { LanguageGlossary } from '../providers/translation.interface';
|
|
2
|
+
import { Replacement } from '../types';
|
|
3
|
+
type SetupPreservableProps = {
|
|
4
|
+
glossaryToPreserve: LanguageGlossary;
|
|
5
|
+
preserveWordsReplacers: [RegExp, string][];
|
|
6
|
+
};
|
|
7
|
+
export declare class TranslationKatexPreprocessor {
|
|
8
|
+
private static plaintextConverter;
|
|
9
|
+
static setPlaintextConverter(converter: (text: string) => string): void;
|
|
10
|
+
static shouldSkipTranslation(text?: string | string[]): boolean;
|
|
11
|
+
static isMathExpressionOnly(text: string): boolean;
|
|
12
|
+
static isSingleLetter(text: string): boolean;
|
|
13
|
+
static isMathSymbolsOnly(text: string): boolean;
|
|
14
|
+
private globalTargetLanguage;
|
|
15
|
+
private preserveWordsMap;
|
|
16
|
+
private preserveWordsReplacers;
|
|
17
|
+
private normalizePlaceholderSpacing;
|
|
18
|
+
sanitize(text: string): {
|
|
19
|
+
sanitized: string;
|
|
20
|
+
replacements: Replacement[];
|
|
21
|
+
};
|
|
22
|
+
restore(text: string, replacements: Replacement[]): string;
|
|
23
|
+
sanitizeBatch(texts: string[]): {
|
|
24
|
+
sanitized: string[];
|
|
25
|
+
replacements: Replacement[][];
|
|
26
|
+
};
|
|
27
|
+
restoreBatch(texts: string[], replacementsArray: Replacement[][]): string[];
|
|
28
|
+
setupPreservable({ glossaryToPreserve, preserveWordsReplacers }: SetupPreservableProps): void;
|
|
29
|
+
setupTarget(language: string): void;
|
|
30
|
+
private skipCustomReplacerSanitizeWithoutGlossary;
|
|
31
|
+
private applyPreserved;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=TranslationPreprocessor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TranslationPreprocessor.d.ts","sourceRoot":"","sources":["../../../../../../src/features/translation/model/TranslationPreprocessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AAErE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AA2BtC,KAAK,qBAAqB,GAAG;IAC3B,kBAAkB,EAAE,gBAAgB,CAAA;IACpC,sBAAsB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAA;CAC3C,CAAA;AAED,qBAAa,4BAA4B;IACvC,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAA2C;WAE9D,qBAAqB,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM;WAIzD,qBAAqB,CAAC,IAAI,GAAE,MAAM,GAAG,MAAM,EAAO;WAYlD,oBAAoB,CAAC,IAAI,EAAE,MAAM;WAIjC,cAAc,CAAC,IAAI,EAAE,MAAM;WAI3B,iBAAiB,CAAC,IAAI,EAAE,MAAM;IAO5C,OAAO,CAAC,oBAAoB,CAAsB;IAClD,OAAO,CAAC,gBAAgB,CAAuB;IAC/C,OAAO,CAAC,sBAAsB,CAAyB;IAEvD,OAAO,CAAC,2BAA2B;IAM5B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,WAAW,EAAE,CAAA;KAAE;IA8B1E,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE;IAUjD,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG;QAAE,SAAS,EAAE,MAAM,EAAE,CAAC;QAAC,YAAY,EAAE,WAAW,EAAE,EAAE,CAAA;KAAE;IAatF,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,iBAAiB,EAAE,WAAW,EAAE,EAAE;IAYhE,gBAAgB,CAAC,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,EAAE,qBAAqB;IAKtF,WAAW,CAAC,QAAQ,EAAE,MAAM;IAInC,OAAO,CAAC,yCAAyC;IAYjD,OAAO,CAAC,cAAc;CAMvB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Store } from 'effector';
|
|
2
|
+
import { LanguageGlossary, TranslationProvider } from '../providers/translation.interface';
|
|
3
|
+
type TranslationServiceProps = {
|
|
4
|
+
providers: TranslationProvider[];
|
|
5
|
+
preserve?: {
|
|
6
|
+
map: LanguageGlossary;
|
|
7
|
+
replacers: [RegExp, string][];
|
|
8
|
+
};
|
|
9
|
+
onError?: () => void;
|
|
10
|
+
};
|
|
11
|
+
export type TranslateConfigProps = {
|
|
12
|
+
targetLang?: string;
|
|
13
|
+
sourceLang?: string;
|
|
14
|
+
cacheKeySuffix?: string;
|
|
15
|
+
cacheKey?: string;
|
|
16
|
+
};
|
|
17
|
+
export declare class TranslationService {
|
|
18
|
+
private readonly preprocessor;
|
|
19
|
+
private readonly cache;
|
|
20
|
+
private readonly providers;
|
|
21
|
+
private readonly onError;
|
|
22
|
+
private globalTargetLanguage;
|
|
23
|
+
private sourceLanguage;
|
|
24
|
+
private customCacheKeyFn;
|
|
25
|
+
constructor({ providers, preserve, onError }: TranslationServiceProps);
|
|
26
|
+
private getTargetLanguage;
|
|
27
|
+
private getProvider;
|
|
28
|
+
private createCacheKey;
|
|
29
|
+
translate: <T extends string | string[]>(text?: T, config?: TranslateConfigProps) => Promise<T>;
|
|
30
|
+
bindTargetLanguage<T extends string>(store: Store<T>, callback?: (value: T) => string): this;
|
|
31
|
+
bindSourceLanguage<T extends string>(store: Store<T>): this;
|
|
32
|
+
bindCustomCacheKey<T extends string>(store: Store<T>, callback: (value: T, input: {
|
|
33
|
+
text: string | string[];
|
|
34
|
+
target: string;
|
|
35
|
+
}) => string): this;
|
|
36
|
+
getCached<T extends string | string[]>(key: string): T | undefined;
|
|
37
|
+
reset(): void;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=TranslationService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TranslationService.d.ts","sourceRoot":"","sources":["../../../../../../src/features/translation/model/TranslationService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAEhC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAA;AAE1F,KAAK,uBAAuB,GAAG;IAC7B,SAAS,EAAE,mBAAmB,EAAE,CAAA;IAChC,QAAQ,CAAC,EAAE;QACT,GAAG,EAAE,gBAAgB,CAAA;QACrB,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAA;KAC9B,CAAA;IACD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAqC;IAClE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAuC;IAC7D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA4B;IACtD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAA;IAExB,OAAO,CAAC,oBAAoB,CAAsB;IAClD,OAAO,CAAC,cAAc,CAAsB;IAC5C,OAAO,CAAC,gBAAgB,CAAqE;gBAEjF,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,uBAAuB;IAYrE,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,cAAc;IAYf,SAAS,GAAU,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,SAC7C,CAAC,WACE,oBAAoB,KAC5B,OAAO,CAAC,CAAC,CAAC,CAgCZ;IAEM,kBAAkB,CAAC,CAAC,SAAS,MAAM,EACxC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,GAC9B,IAAI;IAUA,kBAAkB,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI;IAQ3D,kBAAkB,CAAC,CAAC,SAAS,MAAM,EACxC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EACf,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,GACjF,IAAI;IASA,SAAS,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAIlE,KAAK;CAGb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wordsToPreserve.d.ts","sourceRoot":"","sources":["../../../../../../src/features/translation/preserve/wordsToPreserve.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA4ElE,CAAA;AAOD,eAAO,MAAM,uBAAuB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAGrD,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LanguageGlossary, TranslationProvider } from '../translation.interface';
|
|
2
|
+
import { GoogleTranslateProps, GoogleTranslateResponse } from '../google.types';
|
|
3
|
+
type GoogleTranslationProviderProps = {
|
|
4
|
+
api: {
|
|
5
|
+
translateRequest: (payload: GoogleTranslateProps) => Promise<GoogleTranslateResponse>;
|
|
6
|
+
};
|
|
7
|
+
glossaries?: LanguageGlossary;
|
|
8
|
+
};
|
|
9
|
+
export declare class GoogleTranslationProvider extends TranslationProvider {
|
|
10
|
+
private readonly getTranslationFx;
|
|
11
|
+
constructor({ api, glossaries }: GoogleTranslationProviderProps);
|
|
12
|
+
resolveLanguage(language: string): string | null;
|
|
13
|
+
request(text: string, targetLanguage: string, sourceLanguage?: string): Promise<string>;
|
|
14
|
+
requestBatch(text: string[], targetLanguage: string, sourceLanguage?: string): Promise<string[]>;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=GoogleTranslationProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GoogleTranslationProvider.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/translation/providers/google/GoogleTranslationProvider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAEhF,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAG/E,KAAK,8BAA8B,GAAG;IACpC,GAAG,EAAE;QACH,gBAAgB,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAA;KACtF,CAAA;IACD,UAAU,CAAC,EAAE,gBAAgB,CAAA;CAC9B,CAAA;AAED,qBAAa,yBAA0B,SAAQ,mBAAmB;IAChE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAuD;gBAE5E,EAAE,GAAG,EAAE,UAAU,EAAE,EAAE,8BAA8B;IAKxD,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAI1C,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM;IAYrE,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM;CAY1F"}
|