@magmamath/students-features 1.3.23-rc.2 → 1.3.23-rc.21
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 +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/useVoiceTranscriptionController.js +128 -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 +183 -0
- package/dist/commonjs/features/voice/playing/model/PlaybackController.js.map +1 -0
- package/dist/commonjs/features/voice/playing/model/Player.model.js +24 -1
- 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 +82 -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 +46 -172
- package/dist/commonjs/features/voice/playing/model/VoicePlayer.model.js.map +1 -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 +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/useVoiceTranscriptionController.js +123 -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 +178 -0
- package/dist/module/features/voice/playing/model/PlaybackController.js.map +1 -0
- package/dist/module/features/voice/playing/model/Player.model.js +24 -1
- 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 +77 -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 +48 -174
- package/dist/module/features/voice/playing/model/VoicePlayer.model.js.map +1 -1
- 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 +2 -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/{module/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts → commonjs/features/voice/playing/components/VoiceTranscription.d.ts} +3 -4
- 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/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/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 +3 -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 +18 -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 +5 -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 +2 -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/{commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts → module/features/voice/playing/components/VoiceTranscription.d.ts} +3 -4
- 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/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/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 +3 -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 +18 -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 +5 -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 +28 -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 +2 -1
- package/src/features/voice/playing/components/VoiceTranscriptContent.tsx +37 -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/useVoiceTranscriptionController.ts +171 -0
- package/src/features/voice/playing/model/{VoiceTranscriptionsDropdown.model.ts → Dropdown.model.ts} +2 -2
- package/src/features/voice/playing/model/PlaybackController.ts +213 -0
- package/src/features/voice/playing/model/Player.model.ts +26 -1
- 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 +57 -194
- package/src/features/voice/types.ts +10 -0
- package/src/index.ts +1 -0
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.js +0 -251
- 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/voice/playing/components/VoiceTranscriptionsDropdown.js +0 -244
- 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/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/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/voice/playing/components/VoiceTranscriptionsDropdown.tsx +0 -302
- 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,229 @@
|
|
|
1
|
+
const SUPPORTED_CODES = new Set<string>()
|
|
2
|
+
const NAME_TO_CODE: Record<string, string> = {}
|
|
3
|
+
|
|
4
|
+
const normalizeLanguageName = (language: string): string =>
|
|
5
|
+
language
|
|
6
|
+
.trim()
|
|
7
|
+
.toUpperCase()
|
|
8
|
+
.replace(/[\s()-]+/g, '_')
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Resolves an arbitrary language input (ISO code, locale, or English name) to the
|
|
12
|
+
* Google Translate ISO code. Returns null when the language is not supported.
|
|
13
|
+
*
|
|
14
|
+
* Examples:
|
|
15
|
+
* "en" → "en"
|
|
16
|
+
* "en-SE" → "en" (base fallback)
|
|
17
|
+
* "zh-CN" → "zh-CN" (exact match)
|
|
18
|
+
* "Spanish" → "es" (name lookup)
|
|
19
|
+
* "Chinese Simplified" → "zh-CN"
|
|
20
|
+
*/
|
|
21
|
+
export const resolveGoogleLanguageCode = (language?: string | null): string | null => {
|
|
22
|
+
if (!language) return null
|
|
23
|
+
if (SUPPORTED_CODES.has(language)) return language
|
|
24
|
+
const base = language.split('-')[0]
|
|
25
|
+
if (base !== language && SUPPORTED_CODES.has(base)) return base
|
|
26
|
+
return NAME_TO_CODE[normalizeLanguageName(language)] ?? null
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const GoogleTranslateLanguage = {
|
|
30
|
+
ABKHAZ: 'ab',
|
|
31
|
+
ACEHNESE: 'ace',
|
|
32
|
+
ACHOLI: 'ach',
|
|
33
|
+
AFRIKAANS: 'af',
|
|
34
|
+
ALBANIAN: 'sq',
|
|
35
|
+
ALUR: 'alz',
|
|
36
|
+
AMHARIC: 'am',
|
|
37
|
+
ARABIC: 'ar',
|
|
38
|
+
ARMENIAN: 'hy',
|
|
39
|
+
ASSAMESE: 'as',
|
|
40
|
+
AWADHI: 'awa',
|
|
41
|
+
AYMARA: 'ay',
|
|
42
|
+
AZERBAIJANI: 'az',
|
|
43
|
+
BALINESE: 'ban',
|
|
44
|
+
BAMBARA: 'bm',
|
|
45
|
+
BASHKIR: 'ba',
|
|
46
|
+
BASQUE: 'eu',
|
|
47
|
+
BATAK_KARO: 'btx',
|
|
48
|
+
BATAK_SIMALUNGUN: 'bts',
|
|
49
|
+
BATAK_TOBA: 'bbc',
|
|
50
|
+
BELARUSIAN: 'be',
|
|
51
|
+
BEMBA: 'bem',
|
|
52
|
+
BENGALI: 'bn',
|
|
53
|
+
BETAWI: 'bew',
|
|
54
|
+
BHOJPURI: 'bho',
|
|
55
|
+
BIKOL: 'bik',
|
|
56
|
+
BOSNIAN: 'bs',
|
|
57
|
+
BRETON: 'br',
|
|
58
|
+
BULGARIAN: 'bg',
|
|
59
|
+
BURMESE: 'my',
|
|
60
|
+
BURYAT: 'bua',
|
|
61
|
+
CANTONESE: 'yue',
|
|
62
|
+
CATALAN: 'ca',
|
|
63
|
+
CEBUANO: 'ceb',
|
|
64
|
+
CHICHEWA_NYANJA: 'ny',
|
|
65
|
+
CHINESE_SIMPLIFIED: 'zh-CN',
|
|
66
|
+
CHINESE_TRADITIONAL: 'zh-TW',
|
|
67
|
+
CHUVASH: 'cv',
|
|
68
|
+
CORSICAN: 'co',
|
|
69
|
+
CRIMEAN_TATAR: 'crh',
|
|
70
|
+
CROATIAN: 'hr',
|
|
71
|
+
CZECH: 'cs',
|
|
72
|
+
DANISH: 'da',
|
|
73
|
+
DINKA: 'din',
|
|
74
|
+
DIVEHI: 'dv',
|
|
75
|
+
DOGRI: 'doi',
|
|
76
|
+
DOMBE: 'dov',
|
|
77
|
+
DUTCH: 'nl',
|
|
78
|
+
DZONGKHA: 'dz',
|
|
79
|
+
ENGLISH: 'en',
|
|
80
|
+
ESPERANTO: 'eo',
|
|
81
|
+
ESTONIAN: 'et',
|
|
82
|
+
EWE: 'ee',
|
|
83
|
+
FIJIAN: 'fj',
|
|
84
|
+
FILIPINO_TAGALOG: 'fil',
|
|
85
|
+
FINNISH: 'fi',
|
|
86
|
+
FRENCH: 'fr',
|
|
87
|
+
FRENCH_CANADA: 'fr-CA',
|
|
88
|
+
FRENCH_FRANCE: 'fr-FR',
|
|
89
|
+
FRISIAN: 'fy',
|
|
90
|
+
FULFULDE: 'ff',
|
|
91
|
+
GA: 'gaa',
|
|
92
|
+
GALICIAN: 'gl',
|
|
93
|
+
GANDA_LUGANDA: 'lg',
|
|
94
|
+
GEORGIAN: 'ka',
|
|
95
|
+
GERMAN: 'de',
|
|
96
|
+
GREEK: 'el',
|
|
97
|
+
GUARANI: 'gn',
|
|
98
|
+
GUJARATI: 'gu',
|
|
99
|
+
HAITIAN_CREOLE: 'ht',
|
|
100
|
+
HAKHA_CHIN: 'cnh',
|
|
101
|
+
HAUSA: 'ha',
|
|
102
|
+
HAWAIIAN: 'haw',
|
|
103
|
+
HEBREW: 'he',
|
|
104
|
+
HILIGAYNON: 'hil',
|
|
105
|
+
HINDI: 'hi',
|
|
106
|
+
HMONG: 'hmn',
|
|
107
|
+
HUNGARIAN: 'hu',
|
|
108
|
+
HUNSRIK: 'hrx',
|
|
109
|
+
ICELANDIC: 'is',
|
|
110
|
+
IGBO: 'ig',
|
|
111
|
+
ILOKO: 'ilo',
|
|
112
|
+
INDONESIAN: 'id',
|
|
113
|
+
IRISH: 'ga',
|
|
114
|
+
ITALIAN: 'it',
|
|
115
|
+
JAPANESE: 'ja',
|
|
116
|
+
JAVANESE: 'jw',
|
|
117
|
+
KANNADA: 'kn',
|
|
118
|
+
KAPAMPANGAN: 'pam',
|
|
119
|
+
KAZAKH: 'kk',
|
|
120
|
+
KHMER: 'km',
|
|
121
|
+
KIGA: 'cgg',
|
|
122
|
+
KINYARWANDA: 'rw',
|
|
123
|
+
KITUBA: 'ktu',
|
|
124
|
+
KONKANI: 'gom',
|
|
125
|
+
KOREAN: 'ko',
|
|
126
|
+
KRIO: 'kri',
|
|
127
|
+
KURMANJI: 'ku',
|
|
128
|
+
KYRGYZ: 'ky',
|
|
129
|
+
LAO: 'lo',
|
|
130
|
+
LATGALIAN: 'ltg',
|
|
131
|
+
LATIN: 'la',
|
|
132
|
+
LATVIAN: 'lv',
|
|
133
|
+
LIGURIAN: 'lij',
|
|
134
|
+
LIMBURGAN: 'li',
|
|
135
|
+
LINGALA: 'ln',
|
|
136
|
+
LITHUANIAN: 'lt',
|
|
137
|
+
LOMBARD: 'lmo',
|
|
138
|
+
LUO: 'luo',
|
|
139
|
+
LUXEMBOURGISH: 'lb',
|
|
140
|
+
MACEDONIAN: 'mk',
|
|
141
|
+
MAITHILI: 'mai',
|
|
142
|
+
MAKASSAR: 'mak',
|
|
143
|
+
MALAGASY: 'mg',
|
|
144
|
+
MALAY: 'ms',
|
|
145
|
+
MALAYALAM: 'ml',
|
|
146
|
+
MALAY_JAWI: 'ms-Arab',
|
|
147
|
+
MALTESE: 'mt',
|
|
148
|
+
MAORI: 'mi',
|
|
149
|
+
MARATHI: 'mr',
|
|
150
|
+
MEADOW_MARI: 'chm',
|
|
151
|
+
MEITEILON_MANIPURI: 'mni-Mtei',
|
|
152
|
+
MINANG: 'min',
|
|
153
|
+
MIZO: 'lus',
|
|
154
|
+
MONGOLIAN: 'mn',
|
|
155
|
+
NDEBELE_SOUTH: 'nr',
|
|
156
|
+
NEPALBHASA_NEWARI: 'new',
|
|
157
|
+
NEPALI: 'ne',
|
|
158
|
+
NORTHERN_SOTHO: 'nso',
|
|
159
|
+
NORWEGIAN: 'no',
|
|
160
|
+
NUER: 'nus',
|
|
161
|
+
OCCITAN: 'oc',
|
|
162
|
+
ODIA: 'or',
|
|
163
|
+
OROMO: 'om',
|
|
164
|
+
PANGASINAN: 'pag',
|
|
165
|
+
PAPIAMENTO: 'pap',
|
|
166
|
+
PASHTO: 'ps',
|
|
167
|
+
PERSIAN: 'fa',
|
|
168
|
+
POLISH: 'pl',
|
|
169
|
+
PORTUGUESE: 'pt',
|
|
170
|
+
PORTUGUESE_BRAZIL: 'pt-BR',
|
|
171
|
+
PORTUGUESE_PORTUGAL: 'pt-PT',
|
|
172
|
+
PUNJABI: 'pa',
|
|
173
|
+
PUNJABI_SHAHMUKHI: 'pa-Arab',
|
|
174
|
+
QUECHUA: 'qu',
|
|
175
|
+
ROMANI: 'rom',
|
|
176
|
+
ROMANIAN: 'ro',
|
|
177
|
+
RUNDI: 'rn',
|
|
178
|
+
RUSSIAN: 'ru',
|
|
179
|
+
SAMOAN: 'sm',
|
|
180
|
+
SANGO: 'sg',
|
|
181
|
+
SANSKRIT: 'sa',
|
|
182
|
+
SCOTS_GAELIC: 'gd',
|
|
183
|
+
SERBIAN: 'sr',
|
|
184
|
+
SESOTHO: 'st',
|
|
185
|
+
SEYCHELLOIS_CREOLE: 'crs',
|
|
186
|
+
SHAN: 'shn',
|
|
187
|
+
SHONA: 'sn',
|
|
188
|
+
SICILIAN: 'scn',
|
|
189
|
+
SILESIAN: 'szl',
|
|
190
|
+
SINDHI: 'sd',
|
|
191
|
+
SINHALA: 'si',
|
|
192
|
+
SLOVAK: 'sk',
|
|
193
|
+
SLOVENIAN: 'sl',
|
|
194
|
+
SOMALI: 'so',
|
|
195
|
+
SORANI: 'ckb',
|
|
196
|
+
SPANISH: 'es',
|
|
197
|
+
SUNDANESE: 'su',
|
|
198
|
+
SWAHILI: 'sw',
|
|
199
|
+
SWATI: 'ss',
|
|
200
|
+
SWEDISH: 'sv',
|
|
201
|
+
TAJIK: 'tg',
|
|
202
|
+
TAMIL: 'ta',
|
|
203
|
+
TATAR: 'tt',
|
|
204
|
+
TELUGU: 'te',
|
|
205
|
+
TETUM: 'tet',
|
|
206
|
+
THAI: 'th',
|
|
207
|
+
TIGRINYA: 'ti',
|
|
208
|
+
TSONGA: 'ts',
|
|
209
|
+
TSWANA: 'tn',
|
|
210
|
+
TURKISH: 'tr',
|
|
211
|
+
TURKMEN: 'tk',
|
|
212
|
+
TWI_AKAN: 'ak',
|
|
213
|
+
UKRAINIAN: 'uk',
|
|
214
|
+
URDU: 'ur',
|
|
215
|
+
UYGHUR: 'ug',
|
|
216
|
+
UZBEK: 'uz',
|
|
217
|
+
VIETNAMESE: 'vi',
|
|
218
|
+
WELSH: 'cy',
|
|
219
|
+
XHOSA: 'xh',
|
|
220
|
+
YIDDISH: 'yi',
|
|
221
|
+
YORUBA: 'yo',
|
|
222
|
+
YUCATEC_MAYA: 'yua',
|
|
223
|
+
ZULU: 'zu',
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
Object.entries(GoogleTranslateLanguage).forEach(([name, code]) => {
|
|
227
|
+
SUPPORTED_CODES.add(code)
|
|
228
|
+
NAME_TO_CODE[name] = code
|
|
229
|
+
})
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type GoogleTranslateProps = {
|
|
2
|
+
text: string[]
|
|
3
|
+
targetLanguage: string
|
|
4
|
+
sourceLanguage?: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type GoogleTranslation = {
|
|
8
|
+
translatedText: string
|
|
9
|
+
detectedSourceLanguage: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type GoogleTranslateResponse = {
|
|
13
|
+
data: {
|
|
14
|
+
translations: GoogleTranslation[]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { replaceMappedTokens } from '../helpers'
|
|
2
|
+
|
|
3
|
+
export type LanguageGlossary = {
|
|
4
|
+
[languageCode: string]: Record<string, string>
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
type TranslationProviderProps = {
|
|
8
|
+
supportedLanguages: string[]
|
|
9
|
+
glossaries?: LanguageGlossary
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export abstract class TranslationProvider {
|
|
13
|
+
protected readonly supportedLanguages: ReadonlySet<string>
|
|
14
|
+
protected readonly glossaries: LanguageGlossary = {}
|
|
15
|
+
|
|
16
|
+
protected constructor({ supportedLanguages, glossaries = {} }: TranslationProviderProps) {
|
|
17
|
+
this.supportedLanguages = new Set(supportedLanguages)
|
|
18
|
+
this.glossaries = glossaries
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public abstract request(
|
|
22
|
+
text: string,
|
|
23
|
+
targetLanguage: string,
|
|
24
|
+
sourceLanguage?: string,
|
|
25
|
+
): Promise<string>
|
|
26
|
+
public abstract requestBatch(
|
|
27
|
+
text: string[],
|
|
28
|
+
targetLanguage: string,
|
|
29
|
+
sourceLanguage?: string,
|
|
30
|
+
): Promise<string[]>
|
|
31
|
+
|
|
32
|
+
public isTargetSupported(language: string) {
|
|
33
|
+
return this.resolveLanguage(language) !== null
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Returns the provider-supported variant of `language`, falling back to the base
|
|
38
|
+
* language part (e.g. "en-SE" → "en") when the exact locale is not listed.
|
|
39
|
+
* Subclasses may override to add their own resolution (e.g. language names).
|
|
40
|
+
* Returns null when the language cannot be resolved.
|
|
41
|
+
*/
|
|
42
|
+
public resolveLanguage(language: string): string | null {
|
|
43
|
+
if (!language) return null
|
|
44
|
+
if (this.supportedLanguages.has(language)) return language
|
|
45
|
+
const base = language.split('-')[0]
|
|
46
|
+
if (base !== language && this.supportedLanguages.has(base)) return base
|
|
47
|
+
return null
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public getSupportedLanguages() {
|
|
51
|
+
return this.supportedLanguages.values()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Replaces full standalone words in text using a custom glossary for the target language,
|
|
56
|
+
* matching words like "Hello", or "Hej" regardless of case, but not when they appear inside other words.
|
|
57
|
+
*/
|
|
58
|
+
public applyGlossary(text: string, targetLanguage: string): string {
|
|
59
|
+
const glossary = this.glossaries[targetLanguage]
|
|
60
|
+
if (!glossary) return text
|
|
61
|
+
return replaceMappedTokens(text, glossary)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type TranslatableProblem = {
|
|
2
|
+
description: string
|
|
3
|
+
richDescription?: string
|
|
4
|
+
answerVariants: string[]
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type TranslateAllFxParams<TProblem extends TranslatableProblem = TranslatableProblem> = {
|
|
8
|
+
problem: TProblem | null
|
|
9
|
+
translationLanguageCode?: string | null
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type TranslateFxParams = {
|
|
13
|
+
cacheKey: string
|
|
14
|
+
text: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type Replacement = {
|
|
18
|
+
placeholder: string
|
|
19
|
+
original: string
|
|
20
|
+
leftPad?: boolean
|
|
21
|
+
rightPad?: boolean
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type MaskSegmentParams = {
|
|
25
|
+
text: string
|
|
26
|
+
regex: RegExp
|
|
27
|
+
placeholder: string
|
|
28
|
+
replacements: Replacement[]
|
|
29
|
+
shouldSkip?: (match: string) => boolean
|
|
30
|
+
}
|
|
@@ -4,8 +4,9 @@ export * from './recording/modal/VoiceRecordDeleteModal'
|
|
|
4
4
|
export * from './recording/modal/VoiceRecordUndoModal'
|
|
5
5
|
|
|
6
6
|
export * from './playing/model/VoicePlayer.model'
|
|
7
|
-
export * from './playing/components/
|
|
7
|
+
export * from './playing/components/VoiceTranscription'
|
|
8
8
|
|
|
9
9
|
export * from './playing/components/VoiceIcon'
|
|
10
10
|
export * from './constants'
|
|
11
11
|
export * from './types'
|
|
12
|
+
export type { WithAbortSignal } from '../../types/common.types'
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { COLORS, Loader, LoaderColor, LoaderSize, Typography } from '@magmamath/react-native-ui'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { StyleSheet, View } from 'react-native'
|
|
4
|
+
|
|
5
|
+
type VoiceTranscriptContentProps = {
|
|
6
|
+
text: string
|
|
7
|
+
isLoading: boolean
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const VoiceTranscriptContent = ({ text, isLoading }: VoiceTranscriptContentProps) => {
|
|
11
|
+
if (isLoading) {
|
|
12
|
+
return (
|
|
13
|
+
<View style={styles.loaderContainer}>
|
|
14
|
+
<Loader size={LoaderSize.SMALL} color={LoaderColor.BLUE} />
|
|
15
|
+
</View>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Typography variant="h8" style={styles.text}>
|
|
21
|
+
{text}
|
|
22
|
+
</Typography>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const styles = StyleSheet.create({
|
|
27
|
+
text: {
|
|
28
|
+
color: COLORS.NEUTRAL_7,
|
|
29
|
+
paddingHorizontal: 8,
|
|
30
|
+
paddingVertical: 8,
|
|
31
|
+
},
|
|
32
|
+
loaderContainer: {
|
|
33
|
+
justifyContent: 'center',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
paddingVertical: 8,
|
|
36
|
+
},
|
|
37
|
+
})
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Typography, COLORS, SPACING } from '@magmamath/react-native-ui'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native'
|
|
4
|
+
import Animated from 'react-native-reanimated'
|
|
5
|
+
import { AnswerAudio, VoiceTranscriptionVariant } from '../../types'
|
|
6
|
+
import { useText } from '../../../../i18n/i18n'
|
|
7
|
+
import { useVoiceTranscriptionController } from '../hooks/useVoiceTranscriptionController'
|
|
8
|
+
import { VoicePlayerModel } from '../model'
|
|
9
|
+
import { VoiceTranscriptContent } from './VoiceTranscriptContent'
|
|
10
|
+
import { VoiceTranscriptionCollapsible } from './VoiceTranscriptionCollapsible'
|
|
11
|
+
import { VoiceTranscriptionHeaderActions } from './VoiceTranscriptionHeaderActions'
|
|
12
|
+
|
|
13
|
+
type VoiceTranscriptionProps = {
|
|
14
|
+
style?: StyleProp<ViewStyle>
|
|
15
|
+
model: VoicePlayerModel
|
|
16
|
+
answers: AnswerAudio[]
|
|
17
|
+
attemptOffset: number
|
|
18
|
+
attemptsCount: number
|
|
19
|
+
problemId: string
|
|
20
|
+
variant?: VoiceTranscriptionVariant
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const VoiceTranscription = ({
|
|
24
|
+
style,
|
|
25
|
+
model,
|
|
26
|
+
answers,
|
|
27
|
+
attemptOffset,
|
|
28
|
+
attemptsCount,
|
|
29
|
+
problemId,
|
|
30
|
+
variant = VoiceTranscriptionVariant.SMALL,
|
|
31
|
+
}: VoiceTranscriptionProps) => {
|
|
32
|
+
const t = useText()
|
|
33
|
+
const { display, flags, actions } = useVoiceTranscriptionController({
|
|
34
|
+
model,
|
|
35
|
+
answers,
|
|
36
|
+
attemptOffset,
|
|
37
|
+
attemptsCount,
|
|
38
|
+
problemId,
|
|
39
|
+
})
|
|
40
|
+
const isLargeVariant = variant === VoiceTranscriptionVariant.LARGE
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<Animated.View
|
|
44
|
+
style={[
|
|
45
|
+
styles.container,
|
|
46
|
+
isLargeVariant ? styles.largeContainer : styles.smallContainer,
|
|
47
|
+
style,
|
|
48
|
+
]}
|
|
49
|
+
>
|
|
50
|
+
<View style={styles.header}>
|
|
51
|
+
<Typography style={styles.title} variant="h7">
|
|
52
|
+
{t('voice.transcriptions')}
|
|
53
|
+
</Typography>
|
|
54
|
+
{flags.anyAttemptHasAudio && (
|
|
55
|
+
<VoiceTranscriptionHeaderActions
|
|
56
|
+
playerState={flags.playerState}
|
|
57
|
+
isTranslationActive={flags.isTranslationActive}
|
|
58
|
+
canTranslate={flags.canTranslate}
|
|
59
|
+
onPlayPress={actions.onPlayPress}
|
|
60
|
+
onTranslationPress={actions.onTranslationToggle}
|
|
61
|
+
/>
|
|
62
|
+
)}
|
|
63
|
+
</View>
|
|
64
|
+
|
|
65
|
+
{isLargeVariant ? (
|
|
66
|
+
<VoiceTranscriptContent text={display.text} isLoading={display.isLoading} />
|
|
67
|
+
) : (
|
|
68
|
+
<VoiceTranscriptionCollapsible
|
|
69
|
+
text={display.text}
|
|
70
|
+
isLoading={display.isLoading}
|
|
71
|
+
dropdown={model.dropdown}
|
|
72
|
+
/>
|
|
73
|
+
)}
|
|
74
|
+
</Animated.View>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const styles = StyleSheet.create({
|
|
79
|
+
container: {
|
|
80
|
+
padding: 4,
|
|
81
|
+
boxShadow: '0px 1px 3px 0px rgba(51, 51, 51, 0.25)',
|
|
82
|
+
borderRadius: 12,
|
|
83
|
+
backgroundColor: COLORS.NEUTRAL_1,
|
|
84
|
+
overflow: 'hidden',
|
|
85
|
+
},
|
|
86
|
+
// SMALL: floats over the drawing area; consumer-positioned siblings sit
|
|
87
|
+
// beneath it. Absolute positioning is intentional here.
|
|
88
|
+
smallContainer: {
|
|
89
|
+
position: 'absolute',
|
|
90
|
+
top: 56,
|
|
91
|
+
left: SPACING[200],
|
|
92
|
+
width: 222,
|
|
93
|
+
maxHeight: 405,
|
|
94
|
+
minHeight: 51,
|
|
95
|
+
},
|
|
96
|
+
// LARGE: rendered as a flex child of the SolutionCard's column flow,
|
|
97
|
+
// between the header and footer. Auto-sizes to whatever space the footer
|
|
98
|
+
// (with or without the playable timeline) leaves — no magic numbers.
|
|
99
|
+
largeContainer: {
|
|
100
|
+
flex: 1,
|
|
101
|
+
marginHorizontal: SPACING[200],
|
|
102
|
+
marginTop: SPACING[200],
|
|
103
|
+
marginBottom: SPACING[200],
|
|
104
|
+
},
|
|
105
|
+
header: {
|
|
106
|
+
flexDirection: 'row',
|
|
107
|
+
justifyContent: 'space-between',
|
|
108
|
+
alignItems: 'center',
|
|
109
|
+
padding: 4,
|
|
110
|
+
marginBottom: 4,
|
|
111
|
+
height: 32,
|
|
112
|
+
},
|
|
113
|
+
title: {
|
|
114
|
+
color: COLORS.NEUTRAL_9,
|
|
115
|
+
marginLeft: 4,
|
|
116
|
+
},
|
|
117
|
+
})
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { CaretDownIcon } from '@magmamath/react-native-ui'
|
|
2
|
+
import React, { useCallback } from 'react'
|
|
3
|
+
import { StyleSheet, TouchableOpacity, View } from 'react-native'
|
|
4
|
+
import Animated from 'react-native-reanimated'
|
|
5
|
+
import { useDropdownAnimation } from '../hooks/useDropdownAnimation'
|
|
6
|
+
import { DropdownModel } from '../model/Dropdown.model'
|
|
7
|
+
import { VoiceTranscriptContent } from './VoiceTranscriptContent'
|
|
8
|
+
|
|
9
|
+
const AnimatedTouchableOpacity = Animated.createAnimatedComponent(TouchableOpacity)
|
|
10
|
+
|
|
11
|
+
type VoiceTranscriptionCollapsibleProps = {
|
|
12
|
+
text: string
|
|
13
|
+
isLoading: boolean
|
|
14
|
+
dropdown: DropdownModel
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const VoiceTranscriptionCollapsible = ({
|
|
18
|
+
text,
|
|
19
|
+
isLoading,
|
|
20
|
+
dropdown,
|
|
21
|
+
}: VoiceTranscriptionCollapsibleProps) => {
|
|
22
|
+
const { listAnimatedStyle, iconAnimatedStyle, onListLayout } =
|
|
23
|
+
useDropdownAnimation(dropdown)
|
|
24
|
+
|
|
25
|
+
const handleToggle = useCallback(() => {
|
|
26
|
+
dropdown.toggleExpand()
|
|
27
|
+
}, [dropdown])
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<>
|
|
31
|
+
<Animated.View style={[listAnimatedStyle, styles.collapsibleContent]}>
|
|
32
|
+
<View onLayout={onListLayout} style={styles.transcriptContainer}>
|
|
33
|
+
<VoiceTranscriptContent text={text} isLoading={isLoading} />
|
|
34
|
+
</View>
|
|
35
|
+
</Animated.View>
|
|
36
|
+
<AnimatedTouchableOpacity
|
|
37
|
+
style={[styles.expandButton, iconAnimatedStyle]}
|
|
38
|
+
onPress={handleToggle}
|
|
39
|
+
>
|
|
40
|
+
<CaretDownIcon size={22} />
|
|
41
|
+
</AnimatedTouchableOpacity>
|
|
42
|
+
</>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const styles = StyleSheet.create({
|
|
47
|
+
collapsibleContent: {
|
|
48
|
+
overflow: 'hidden',
|
|
49
|
+
},
|
|
50
|
+
transcriptContainer: {
|
|
51
|
+
position: 'absolute',
|
|
52
|
+
width: '100%',
|
|
53
|
+
paddingHorizontal: 4,
|
|
54
|
+
},
|
|
55
|
+
expandButton: {
|
|
56
|
+
justifyContent: 'center',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
},
|
|
59
|
+
})
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Button, COLORS, GlobeIcon, SPACING } from '@magmamath/react-native-ui'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { StyleSheet, View } from 'react-native'
|
|
4
|
+
import { ColorScheme } from '../../../chatbot/types/style.types'
|
|
5
|
+
import { PlayButton } from '../../../../shared/components/PlayButton'
|
|
6
|
+
import { PlayerState } from '../model'
|
|
7
|
+
import { getAudioStatus } from '../../helpers'
|
|
8
|
+
|
|
9
|
+
type VoiceTranscriptionsHeaderActionsProps = {
|
|
10
|
+
playerState: PlayerState
|
|
11
|
+
isTranslationActive: boolean
|
|
12
|
+
canTranslate: boolean
|
|
13
|
+
onPlayPress: () => void
|
|
14
|
+
onTranslationPress: () => void
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const VoiceTranscriptionHeaderActions = ({
|
|
18
|
+
playerState,
|
|
19
|
+
isTranslationActive,
|
|
20
|
+
canTranslate,
|
|
21
|
+
onPlayPress,
|
|
22
|
+
onTranslationPress,
|
|
23
|
+
}: VoiceTranscriptionsHeaderActionsProps) => {
|
|
24
|
+
const playButtonState = {
|
|
25
|
+
isActive: playerState !== PlayerState.IDLE,
|
|
26
|
+
isLoading: playerState === PlayerState.LOADING,
|
|
27
|
+
status: getAudioStatus(playerState),
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<View style={styles.container}>
|
|
32
|
+
<PlayButton
|
|
33
|
+
state={playButtonState}
|
|
34
|
+
onPress={onPlayPress}
|
|
35
|
+
activityIndicatorColor={COLORS.NEUTRAL_1}
|
|
36
|
+
colorScheme={ColorScheme.Yellow}
|
|
37
|
+
/>
|
|
38
|
+
{canTranslate && (
|
|
39
|
+
<Button
|
|
40
|
+
variant="secondary"
|
|
41
|
+
size="small"
|
|
42
|
+
colorScheme={ColorScheme.Yellow}
|
|
43
|
+
isActive={isTranslationActive}
|
|
44
|
+
onPress={onTranslationPress}
|
|
45
|
+
icon={<GlobeIcon color={isTranslationActive ? COLORS.NEUTRAL_1 : COLORS.NEUTRAL_9} />}
|
|
46
|
+
/>
|
|
47
|
+
)}
|
|
48
|
+
</View>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const styles = StyleSheet.create({
|
|
53
|
+
container: {
|
|
54
|
+
flexDirection: 'row',
|
|
55
|
+
alignItems: 'center',
|
|
56
|
+
gap: SPACING[200],
|
|
57
|
+
},
|
|
58
|
+
hidden: {
|
|
59
|
+
opacity: 0,
|
|
60
|
+
},
|
|
61
|
+
})
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useEffect } from 'react'
|
|
2
2
|
import { useUnit } from 'effector-react'
|
|
3
3
|
import { useAnimatedStyle, useSharedValue, withTiming, interpolate } from 'react-native-reanimated'
|
|
4
|
-
import {
|
|
4
|
+
import { DropdownModel } from '../model/Dropdown.model'
|
|
5
5
|
import { DROPDOWN_MAX_CONTENT_HEIGHT } from '../../constants'
|
|
6
6
|
import { LayoutChangeEvent } from 'react-native'
|
|
7
7
|
|
|
8
|
-
export const
|
|
8
|
+
export const useDropdownAnimation = (model: DropdownModel) => {
|
|
9
9
|
const isExpanded = useUnit(model.$isExpanded)
|
|
10
10
|
|
|
11
11
|
const contentHeight = useSharedValue(0)
|
|
@@ -13,9 +13,9 @@ export const useVoiceTranscriptionsDropdown = (model: VoiceTranscriptionsDropdow
|
|
|
13
13
|
|
|
14
14
|
const onListLayout = (event: LayoutChangeEvent) => {
|
|
15
15
|
const measuredHeight = event.nativeEvent.layout.height
|
|
16
|
-
if (measuredHeight
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
if (measuredHeight <= 0) return
|
|
17
|
+
contentHeight.value =
|
|
18
|
+
contentHeight.value === 0 ? measuredHeight : withTiming(measuredHeight, { duration: 180 })
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
const listAnimatedStyle = useAnimatedStyle(() => {
|