@magmamath/students-features 0.9.113 → 0.9.114-rc.1
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/chatbot/components/ChatInput/RequestHintButton.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageButtonsBlock.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.js +8 -48
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.js.map +1 -1
- package/dist/commonjs/features/chatbot/constants.js +4 -4
- package/dist/commonjs/features/chatbot/constants.js.map +1 -1
- package/dist/commonjs/features/gifCelebrations/helpers.js +1 -0
- package/dist/commonjs/features/gifCelebrations/helpers.js.map +1 -1
- package/dist/commonjs/features/voice/constants.js +22 -0
- package/dist/commonjs/features/voice/constants.js.map +1 -0
- package/dist/commonjs/features/voice/helpers.js +211 -0
- package/dist/commonjs/features/voice/helpers.js.map +1 -0
- package/dist/commonjs/features/voice/index.js +138 -0
- package/dist/commonjs/features/voice/index.js.map +1 -0
- package/dist/commonjs/features/voice/model/index.js +68 -0
- package/dist/commonjs/features/voice/model/index.js.map +1 -0
- package/dist/commonjs/features/voice/playing/components/VoiceIcon.js +49 -0
- package/dist/commonjs/features/voice/playing/components/VoiceIcon.js.map +1 -0
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.js +208 -0
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.js.map +1 -0
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js +108 -0
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js.map +1 -0
- package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.js +50 -0
- package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.js.map +1 -0
- package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.js +34 -0
- package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.js.map +1 -0
- package/dist/commonjs/features/voice/playing/model/Player.model.js +87 -0
- package/dist/commonjs/features/voice/playing/model/Player.model.js.map +1 -0
- package/dist/commonjs/features/voice/playing/model/VoicePlayer.model.js +244 -0
- package/dist/commonjs/features/voice/playing/model/VoicePlayer.model.js.map +1 -0
- package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionsCollection.js +41 -0
- package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionsCollection.js.map +1 -0
- package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionsDownloader.model.js +39 -0
- package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionsDownloader.model.js.map +1 -0
- package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionsDropdown.model.js +15 -0
- package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionsDropdown.model.js.map +1 -0
- package/dist/commonjs/features/voice/playing/model/index.js +47 -0
- package/dist/commonjs/features/voice/playing/model/index.js.map +1 -0
- package/dist/commonjs/features/voice/recording/components/VoiceRecord.js +74 -0
- package/dist/commonjs/features/voice/recording/components/VoiceRecord.js.map +1 -0
- package/dist/commonjs/features/voice/recording/components/VoiceRecordButton.js +61 -0
- package/dist/commonjs/features/voice/recording/components/VoiceRecordButton.js.map +1 -0
- package/dist/commonjs/features/voice/recording/components/VoiceRecordDeleteButton.js +35 -0
- package/dist/commonjs/features/voice/recording/components/VoiceRecordDeleteButton.js.map +1 -0
- package/dist/commonjs/features/voice/recording/components/VoiceRecordDevider.js +27 -0
- package/dist/commonjs/features/voice/recording/components/VoiceRecordDevider.js.map +1 -0
- package/dist/commonjs/features/voice/recording/components/VoiceRecordTimer.js +50 -0
- package/dist/commonjs/features/voice/recording/components/VoiceRecordTimer.js.map +1 -0
- package/dist/commonjs/features/voice/recording/hooks/useVoiceRecorder.js +59 -0
- package/dist/commonjs/features/voice/recording/hooks/useVoiceRecorder.js.map +1 -0
- package/dist/commonjs/features/voice/recording/hooks/useVoiceRecorderAnimation.js +22 -0
- package/dist/commonjs/features/voice/recording/hooks/useVoiceRecorderAnimation.js.map +1 -0
- package/dist/commonjs/features/voice/recording/modal/ModalFooterButtons.js +53 -0
- package/dist/commonjs/features/voice/recording/modal/ModalFooterButtons.js.map +1 -0
- package/dist/commonjs/features/voice/recording/modal/VoiceRecordDeleteModal.js +78 -0
- package/dist/commonjs/features/voice/recording/modal/VoiceRecordDeleteModal.js.map +1 -0
- package/dist/commonjs/features/voice/recording/modal/VoiceRecordUndoModal.js +51 -0
- package/dist/commonjs/features/voice/recording/modal/VoiceRecordUndoModal.js.map +1 -0
- package/dist/commonjs/features/voice/recording/model/Recorder.model.js +54 -0
- package/dist/commonjs/features/voice/recording/model/Recorder.model.js.map +1 -0
- package/dist/commonjs/features/voice/recording/model/Uploader.model.js +44 -0
- package/dist/commonjs/features/voice/recording/model/Uploader.model.js.map +1 -0
- package/dist/commonjs/features/voice/recording/model/VoiceRecord.model.js +239 -0
- package/dist/commonjs/features/voice/recording/model/VoiceRecord.model.js.map +1 -0
- package/dist/commonjs/features/voice/recording/model/VoiceRecordCollection.js +30 -0
- package/dist/commonjs/features/voice/recording/model/VoiceRecordCollection.js.map +1 -0
- package/dist/commonjs/features/voice/recording/model/index.js +34 -0
- package/dist/commonjs/features/voice/recording/model/index.js.map +1 -0
- package/dist/commonjs/features/voice/types.js +6 -0
- package/dist/commonjs/features/voice/types.js.map +1 -0
- package/dist/commonjs/index.js +12 -0
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/shared/components/PlayButton.js +70 -0
- package/dist/commonjs/shared/components/PlayButton.js.map +1 -0
- package/dist/commonjs/shared/translation/localization/ca.json +17 -0
- package/dist/commonjs/shared/translation/localization/de.json +17 -0
- package/dist/commonjs/shared/translation/localization/en.json +17 -0
- package/dist/commonjs/shared/translation/localization/gb.json +17 -0
- package/dist/commonjs/shared/translation/localization/sct.json +17 -0
- package/dist/commonjs/shared/translation/localization/sw.json +17 -0
- package/dist/module/features/chatbot/components/ChatInput/RequestHintButton.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/MessageButtonsBlock.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.js +9 -49
- package/dist/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.js.map +1 -1
- package/dist/module/features/chatbot/constants.js +5 -5
- package/dist/module/features/chatbot/constants.js.map +1 -1
- package/dist/module/features/gifCelebrations/helpers.js +1 -0
- package/dist/module/features/gifCelebrations/helpers.js.map +1 -1
- package/dist/module/features/voice/constants.js +18 -0
- package/dist/module/features/voice/constants.js.map +1 -0
- package/dist/module/features/voice/helpers.js +194 -0
- package/dist/module/features/voice/helpers.js.map +1 -0
- package/dist/module/features/voice/index.js +20 -0
- package/dist/module/features/voice/index.js.map +1 -0
- package/dist/module/features/voice/model/index.js +15 -0
- package/dist/module/features/voice/model/index.js.map +1 -0
- package/dist/module/features/voice/playing/components/VoiceIcon.js +41 -0
- package/dist/module/features/voice/playing/components/VoiceIcon.js.map +1 -0
- package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdown.js +201 -0
- package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdown.js.map +1 -0
- package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js +102 -0
- package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js.map +1 -0
- package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.js +45 -0
- package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.js.map +1 -0
- package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.js +29 -0
- package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.js.map +1 -0
- package/dist/module/features/voice/playing/model/Player.model.js +82 -0
- package/dist/module/features/voice/playing/model/Player.model.js.map +1 -0
- package/dist/module/features/voice/playing/model/VoicePlayer.model.js +234 -0
- package/dist/module/features/voice/playing/model/VoicePlayer.model.js.map +1 -0
- package/dist/module/features/voice/playing/model/VoiceTranscriptionsCollection.js +36 -0
- package/dist/module/features/voice/playing/model/VoiceTranscriptionsCollection.js.map +1 -0
- package/dist/module/features/voice/playing/model/VoiceTranscriptionsDownloader.model.js +34 -0
- package/dist/module/features/voice/playing/model/VoiceTranscriptionsDownloader.model.js.map +1 -0
- package/dist/module/features/voice/playing/model/VoiceTranscriptionsDropdown.model.js +10 -0
- package/dist/module/features/voice/playing/model/VoiceTranscriptionsDropdown.model.js.map +1 -0
- package/dist/module/features/voice/playing/model/index.js +8 -0
- package/dist/module/features/voice/playing/model/index.js.map +1 -0
- package/dist/module/features/voice/recording/components/VoiceRecord.js +67 -0
- package/dist/module/features/voice/recording/components/VoiceRecord.js.map +1 -0
- package/dist/module/features/voice/recording/components/VoiceRecordButton.js +55 -0
- package/dist/module/features/voice/recording/components/VoiceRecordButton.js.map +1 -0
- package/dist/module/features/voice/recording/components/VoiceRecordDeleteButton.js +29 -0
- package/dist/module/features/voice/recording/components/VoiceRecordDeleteButton.js.map +1 -0
- package/dist/module/features/voice/recording/components/VoiceRecordDevider.js +21 -0
- package/dist/module/features/voice/recording/components/VoiceRecordDevider.js.map +1 -0
- package/dist/module/features/voice/recording/components/VoiceRecordTimer.js +44 -0
- package/dist/module/features/voice/recording/components/VoiceRecordTimer.js.map +1 -0
- package/dist/module/features/voice/recording/hooks/useVoiceRecorder.js +54 -0
- package/dist/module/features/voice/recording/hooks/useVoiceRecorder.js.map +1 -0
- package/dist/module/features/voice/recording/hooks/useVoiceRecorderAnimation.js +17 -0
- package/dist/module/features/voice/recording/hooks/useVoiceRecorderAnimation.js.map +1 -0
- package/dist/module/features/voice/recording/modal/ModalFooterButtons.js +47 -0
- package/dist/module/features/voice/recording/modal/ModalFooterButtons.js.map +1 -0
- package/dist/module/features/voice/recording/modal/VoiceRecordDeleteModal.js +71 -0
- package/dist/module/features/voice/recording/modal/VoiceRecordDeleteModal.js.map +1 -0
- package/dist/module/features/voice/recording/modal/VoiceRecordUndoModal.js +45 -0
- package/dist/module/features/voice/recording/modal/VoiceRecordUndoModal.js.map +1 -0
- package/dist/module/features/voice/recording/model/Recorder.model.js +49 -0
- package/dist/module/features/voice/recording/model/Recorder.model.js.map +1 -0
- package/dist/module/features/voice/recording/model/Uploader.model.js +39 -0
- package/dist/module/features/voice/recording/model/Uploader.model.js.map +1 -0
- package/dist/module/features/voice/recording/model/VoiceRecord.model.js +234 -0
- package/dist/module/features/voice/recording/model/VoiceRecord.model.js.map +1 -0
- package/dist/module/features/voice/recording/model/VoiceRecordCollection.js +25 -0
- package/dist/module/features/voice/recording/model/VoiceRecordCollection.js.map +1 -0
- package/dist/module/features/voice/recording/model/index.js +7 -0
- package/dist/module/features/voice/recording/model/index.js.map +1 -0
- package/dist/module/features/voice/types.js +4 -0
- package/dist/module/features/voice/types.js.map +1 -0
- package/dist/module/index.js +1 -0
- package/dist/module/index.js.map +1 -1
- package/dist/module/shared/components/PlayButton.js +64 -0
- package/dist/module/shared/components/PlayButton.js.map +1 -0
- package/dist/module/shared/translation/localization/ca.json +17 -0
- package/dist/module/shared/translation/localization/de.json +17 -0
- package/dist/module/shared/translation/localization/en.json +17 -0
- package/dist/module/shared/translation/localization/gb.json +17 -0
- package/dist/module/shared/translation/localization/sct.json +17 -0
- package/dist/module/shared/translation/localization/sw.json +17 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/RequestHintButton.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageButtonsBlock.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.d.ts +2 -2
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/constants.d.ts +5 -5
- package/dist/typescript/commonjs/features/chatbot/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/gifCelebrations/helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/voice/constants.d.ts +15 -0
- package/dist/typescript/commonjs/features/voice/constants.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/helpers.d.ts +46 -0
- package/dist/typescript/commonjs/features/voice/helpers.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/index.d.ts +13 -0
- package/dist/typescript/commonjs/features/voice/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/model/index.d.ts +11 -0
- package/dist/typescript/commonjs/features/voice/model/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceIcon.d.ts +8 -0
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts +15 -0
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdownItem.d.ts +12 -0
- package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdownItem.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.d.ts +16 -0
- package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.d.ts +11 -0
- package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/model/Player.model.d.ts +21 -0
- package/dist/typescript/commonjs/features/voice/playing/model/Player.model.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/model/VoicePlayer.model.d.ts +41 -0
- package/dist/typescript/commonjs/features/voice/playing/model/VoicePlayer.model.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts +26 -0
- package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionsDownloader.model.d.ts +18 -0
- package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionsDownloader.model.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionsDropdown.model.d.ts +7 -0
- package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionsDropdown.model.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/model/index.d.ts +7 -0
- package/dist/typescript/commonjs/features/voice/playing/model/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/recording/components/VoiceRecord.d.ts +10 -0
- package/dist/typescript/commonjs/features/voice/recording/components/VoiceRecord.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/recording/components/VoiceRecordButton.d.ts +10 -0
- package/dist/typescript/commonjs/features/voice/recording/components/VoiceRecordButton.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/recording/components/VoiceRecordDeleteButton.d.ts +8 -0
- package/dist/typescript/commonjs/features/voice/recording/components/VoiceRecordDeleteButton.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/recording/components/VoiceRecordDevider.d.ts +3 -0
- package/dist/typescript/commonjs/features/voice/recording/components/VoiceRecordDevider.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/recording/components/VoiceRecordTimer.d.ts +11 -0
- package/dist/typescript/commonjs/features/voice/recording/components/VoiceRecordTimer.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/recording/hooks/useVoiceRecorder.d.ts +5 -0
- package/dist/typescript/commonjs/features/voice/recording/hooks/useVoiceRecorder.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/recording/hooks/useVoiceRecorderAnimation.d.ts +6 -0
- package/dist/typescript/commonjs/features/voice/recording/hooks/useVoiceRecorderAnimation.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/recording/modal/ModalFooterButtons.d.ts +12 -0
- package/dist/typescript/commonjs/features/voice/recording/modal/ModalFooterButtons.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/recording/modal/VoiceRecordDeleteModal.d.ts +11 -0
- package/dist/typescript/commonjs/features/voice/recording/modal/VoiceRecordDeleteModal.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/recording/modal/VoiceRecordUndoModal.d.ts +11 -0
- package/dist/typescript/commonjs/features/voice/recording/modal/VoiceRecordUndoModal.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/recording/model/Recorder.model.d.ts +19 -0
- package/dist/typescript/commonjs/features/voice/recording/model/Recorder.model.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/recording/model/Uploader.model.d.ts +18 -0
- package/dist/typescript/commonjs/features/voice/recording/model/Uploader.model.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/recording/model/VoiceRecord.model.d.ts +50 -0
- package/dist/typescript/commonjs/features/voice/recording/model/VoiceRecord.model.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/recording/model/VoiceRecordCollection.d.ts +10 -0
- package/dist/typescript/commonjs/features/voice/recording/model/VoiceRecordCollection.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/recording/model/index.d.ts +5 -0
- package/dist/typescript/commonjs/features/voice/recording/model/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/types.d.ts +58 -0
- package/dist/typescript/commonjs/features/voice/types.d.ts.map +1 -0
- package/dist/typescript/commonjs/index.d.ts +1 -0
- package/dist/typescript/commonjs/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/components/PlayButton.d.ts +18 -0
- package/dist/typescript/commonjs/shared/components/PlayButton.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/translation/constants.d.ts +102 -0
- package/dist/typescript/commonjs/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/model.d.ts +34 -0
- package/dist/typescript/commonjs/shared/translation/model.d.ts.map +1 -1
- package/dist/typescript/commonjs/types/common.types.d.ts +3 -0
- package/dist/typescript/commonjs/types/common.types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatInput/RequestHintButton.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageButtonsBlock.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.d.ts +2 -2
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/constants.d.ts +5 -5
- package/dist/typescript/module/features/chatbot/constants.d.ts.map +1 -1
- package/dist/typescript/module/features/gifCelebrations/helpers.d.ts.map +1 -1
- package/dist/typescript/module/features/voice/constants.d.ts +15 -0
- package/dist/typescript/module/features/voice/constants.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/helpers.d.ts +46 -0
- package/dist/typescript/module/features/voice/helpers.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/index.d.ts +13 -0
- package/dist/typescript/module/features/voice/index.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/model/index.d.ts +11 -0
- package/dist/typescript/module/features/voice/model/index.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/components/VoiceIcon.d.ts +8 -0
- package/dist/typescript/module/features/voice/playing/components/VoiceIcon.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts +15 -0
- package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionsDropdownItem.d.ts +12 -0
- package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionsDropdownItem.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.d.ts +16 -0
- package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.d.ts +11 -0
- package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/model/Player.model.d.ts +21 -0
- package/dist/typescript/module/features/voice/playing/model/Player.model.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/model/VoicePlayer.model.d.ts +41 -0
- package/dist/typescript/module/features/voice/playing/model/VoicePlayer.model.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts +26 -0
- package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionsDownloader.model.d.ts +18 -0
- package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionsDownloader.model.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionsDropdown.model.d.ts +7 -0
- package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionsDropdown.model.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/model/index.d.ts +7 -0
- package/dist/typescript/module/features/voice/playing/model/index.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/recording/components/VoiceRecord.d.ts +10 -0
- package/dist/typescript/module/features/voice/recording/components/VoiceRecord.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/recording/components/VoiceRecordButton.d.ts +10 -0
- package/dist/typescript/module/features/voice/recording/components/VoiceRecordButton.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/recording/components/VoiceRecordDeleteButton.d.ts +8 -0
- package/dist/typescript/module/features/voice/recording/components/VoiceRecordDeleteButton.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/recording/components/VoiceRecordDevider.d.ts +3 -0
- package/dist/typescript/module/features/voice/recording/components/VoiceRecordDevider.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/recording/components/VoiceRecordTimer.d.ts +11 -0
- package/dist/typescript/module/features/voice/recording/components/VoiceRecordTimer.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/recording/hooks/useVoiceRecorder.d.ts +5 -0
- package/dist/typescript/module/features/voice/recording/hooks/useVoiceRecorder.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/recording/hooks/useVoiceRecorderAnimation.d.ts +6 -0
- package/dist/typescript/module/features/voice/recording/hooks/useVoiceRecorderAnimation.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/recording/modal/ModalFooterButtons.d.ts +12 -0
- package/dist/typescript/module/features/voice/recording/modal/ModalFooterButtons.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/recording/modal/VoiceRecordDeleteModal.d.ts +11 -0
- package/dist/typescript/module/features/voice/recording/modal/VoiceRecordDeleteModal.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/recording/modal/VoiceRecordUndoModal.d.ts +11 -0
- package/dist/typescript/module/features/voice/recording/modal/VoiceRecordUndoModal.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/recording/model/Recorder.model.d.ts +19 -0
- package/dist/typescript/module/features/voice/recording/model/Recorder.model.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/recording/model/Uploader.model.d.ts +18 -0
- package/dist/typescript/module/features/voice/recording/model/Uploader.model.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/recording/model/VoiceRecord.model.d.ts +50 -0
- package/dist/typescript/module/features/voice/recording/model/VoiceRecord.model.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/recording/model/VoiceRecordCollection.d.ts +10 -0
- package/dist/typescript/module/features/voice/recording/model/VoiceRecordCollection.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/recording/model/index.d.ts +5 -0
- package/dist/typescript/module/features/voice/recording/model/index.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/types.d.ts +58 -0
- package/dist/typescript/module/features/voice/types.d.ts.map +1 -0
- package/dist/typescript/module/index.d.ts +1 -0
- package/dist/typescript/module/index.d.ts.map +1 -1
- package/dist/typescript/module/shared/components/PlayButton.d.ts +18 -0
- package/dist/typescript/module/shared/components/PlayButton.d.ts.map +1 -0
- package/dist/typescript/module/shared/translation/constants.d.ts +102 -0
- package/dist/typescript/module/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/model.d.ts +34 -0
- package/dist/typescript/module/shared/translation/model.d.ts.map +1 -1
- package/dist/typescript/module/types/common.types.d.ts +3 -0
- package/dist/typescript/module/types/common.types.d.ts.map +1 -1
- package/package.json +11 -4
- package/src/features/chatbot/components/ChatInput/RequestHintButton.tsx +0 -1
- package/src/features/chatbot/components/ChatMessage/MessageButtonsBlock.tsx +1 -1
- package/src/features/chatbot/components/ChatMessage/MessageTextToSpeech.tsx +9 -51
- package/src/features/chatbot/constants.ts +4 -4
- package/src/features/gifCelebrations/helpers.ts +1 -0
- package/src/features/voice/constants.ts +14 -0
- package/src/features/voice/helpers.ts +254 -0
- package/src/features/voice/index.ts +17 -0
- package/src/features/voice/model/index.ts +13 -0
- package/src/features/voice/playing/components/VoiceIcon.tsx +38 -0
- package/src/features/voice/playing/components/VoiceTranscriptionsDropdown.tsx +239 -0
- package/src/features/voice/playing/components/VoiceTranscriptionsDropdownItem.tsx +127 -0
- package/src/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.ts +54 -0
- package/src/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.ts +40 -0
- package/src/features/voice/playing/model/Player.model.ts +92 -0
- package/src/features/voice/playing/model/VoicePlayer.model.ts +282 -0
- package/src/features/voice/playing/model/VoiceTranscriptionsCollection.ts +53 -0
- package/src/features/voice/playing/model/VoiceTranscriptionsDownloader.model.ts +43 -0
- package/src/features/voice/playing/model/VoiceTranscriptionsDropdown.model.ts +12 -0
- package/src/features/voice/playing/model/index.ts +6 -0
- package/src/features/voice/recording/components/VoiceRecord.tsx +65 -0
- package/src/features/voice/recording/components/VoiceRecordButton.tsx +63 -0
- package/src/features/voice/recording/components/VoiceRecordDeleteButton.tsx +25 -0
- package/src/features/voice/recording/components/VoiceRecordDevider.tsx +17 -0
- package/src/features/voice/recording/components/VoiceRecordTimer.tsx +49 -0
- package/src/features/voice/recording/hooks/useVoiceRecorder.ts +62 -0
- package/src/features/voice/recording/hooks/useVoiceRecorderAnimation.ts +19 -0
- package/src/features/voice/recording/modal/ModalFooterButtons.tsx +54 -0
- package/src/features/voice/recording/modal/VoiceRecordDeleteModal.tsx +82 -0
- package/src/features/voice/recording/modal/VoiceRecordUndoModal.tsx +50 -0
- package/src/features/voice/recording/model/Recorder.model.ts +62 -0
- package/src/features/voice/recording/model/Uploader.model.ts +48 -0
- package/src/features/voice/recording/model/VoiceRecord.model.ts +278 -0
- package/src/features/voice/recording/model/VoiceRecordCollection.ts +26 -0
- package/src/features/voice/recording/model/index.ts +4 -0
- package/src/features/voice/types.ts +69 -0
- package/src/index.ts +1 -0
- package/src/shared/components/PlayButton.tsx +84 -0
- package/src/shared/translation/localization/ca.json +17 -0
- package/src/shared/translation/localization/de.json +17 -0
- package/src/shared/translation/localization/en.json +17 -0
- package/src/shared/translation/localization/gb.json +17 -0
- package/src/shared/translation/localization/sct.json +17 -0
- package/src/shared/translation/localization/sw.json +17 -0
- package/src/types/common.types.ts +1 -0
- package/dist/commonjs/features/chatbot/TTS_HIGHLIGHTING.md +0 -120
- package/dist/module/features/chatbot/TTS_HIGHLIGHTING.md +0 -120
- package/src/features/chatbot/TTS_HIGHLIGHTING.md +0 -120
|
@@ -1,42 +1,11 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { ActivityIndicator } from 'react-native'
|
|
3
|
-
import { Button, COLORS } from '@magmamath/react-native-ui'
|
|
4
|
-
|
|
5
|
-
import { SpeakerIcon } from '../../../../shared/icons/SpeakerIcon'
|
|
6
|
-
import { PlayIcon } from '../../../../shared/icons/PlayIcon'
|
|
7
|
-
import { PauseIcon } from '../../../../shared/icons/PauseIcon'
|
|
8
|
-
import { AudioStatus, T2SState } from '../../types/t2s.types'
|
|
9
2
|
import { useChatModel } from '../../context/ChatBotModelContext'
|
|
3
|
+
import { PlayButton } from '../../../../shared/components/PlayButton'
|
|
4
|
+
import { T2SState } from '../../types/t2s.types'
|
|
10
5
|
import { ConversationMessage } from '../../types/units.types'
|
|
11
|
-
import { ColorScheme } from '../../types/style.types'
|
|
12
6
|
import { MessageVariant } from '../../types/model.types'
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
type TextToSpeechIconProps = {
|
|
16
|
-
status: AudioStatus
|
|
17
|
-
isLoading: boolean
|
|
18
|
-
isActive: boolean
|
|
19
|
-
colorScheme?: ColorScheme
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const TextToSpeechIcon = ({
|
|
23
|
-
status,
|
|
24
|
-
isActive,
|
|
25
|
-
isLoading,
|
|
26
|
-
colorScheme = ColorScheme.Blue,
|
|
27
|
-
}: TextToSpeechIconProps) => {
|
|
28
|
-
if (isLoading && isActive) {
|
|
29
|
-
return <ActivityIndicator color={CONTROLS_COLORS_MAP[colorScheme].background} />
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (!isActive) {
|
|
33
|
-
return <SpeakerIcon />
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (status === 'playing') return <PauseIcon color={COLORS.NEUTRAL_1} />
|
|
37
|
-
if (status === 'paused') return <PlayIcon color={COLORS.NEUTRAL_1} />
|
|
38
|
-
return <SpeakerIcon />
|
|
39
|
-
}
|
|
7
|
+
import { ColorScheme } from '../../types/style.types'
|
|
8
|
+
import { MESSAGE_COLORS_MAP } from '../../constants'
|
|
40
9
|
|
|
41
10
|
type MessageTextToSpeechProps = {
|
|
42
11
|
state: T2SState
|
|
@@ -46,14 +15,14 @@ type MessageTextToSpeechProps = {
|
|
|
46
15
|
}
|
|
47
16
|
|
|
48
17
|
export const MessageTextToSpeech = ({
|
|
49
|
-
state
|
|
50
|
-
message,
|
|
18
|
+
state,
|
|
51
19
|
variant,
|
|
20
|
+
message,
|
|
52
21
|
colorScheme = ColorScheme.Blue,
|
|
53
22
|
}: MessageTextToSpeechProps) => {
|
|
54
23
|
const model = useChatModel()
|
|
55
24
|
|
|
56
|
-
|
|
25
|
+
const play = () => {
|
|
57
26
|
void model.t2s.play({
|
|
58
27
|
isTranslated: model.translation.$isTranslated.getState(),
|
|
59
28
|
message,
|
|
@@ -61,21 +30,10 @@ export const MessageTextToSpeech = ({
|
|
|
61
30
|
}
|
|
62
31
|
|
|
63
32
|
return (
|
|
64
|
-
<
|
|
65
|
-
disabled={disabled}
|
|
66
|
-
isActive={isActive}
|
|
67
|
-
variant={'secondary'}
|
|
33
|
+
<PlayButton
|
|
68
34
|
colorScheme={MESSAGE_COLORS_MAP[colorScheme][variant].icon}
|
|
69
|
-
|
|
35
|
+
state={state}
|
|
70
36
|
onPress={play}
|
|
71
|
-
icon={
|
|
72
|
-
<TextToSpeechIcon
|
|
73
|
-
isActive={isActive}
|
|
74
|
-
isLoading={isLoading}
|
|
75
|
-
status={status}
|
|
76
|
-
colorScheme={colorScheme}
|
|
77
|
-
/>
|
|
78
|
-
}
|
|
79
37
|
/>
|
|
80
38
|
)
|
|
81
39
|
}
|
|
@@ -46,24 +46,24 @@ export const MESSAGE_COLORS_MAP = {
|
|
|
46
46
|
[MessageVariant.RECEIVED]: {
|
|
47
47
|
background: COLORS.NEUTRAL_3,
|
|
48
48
|
border: COLORS.NEUTRAL_3,
|
|
49
|
-
icon:
|
|
49
|
+
icon: ColorScheme.Blue,
|
|
50
50
|
},
|
|
51
51
|
[MessageVariant.SENT]: {
|
|
52
52
|
background: COLORS.PRIMARY_BLUE,
|
|
53
53
|
border: COLORS.PRIMARY_BLUE,
|
|
54
|
-
icon:
|
|
54
|
+
icon: ColorScheme.Blue,
|
|
55
55
|
},
|
|
56
56
|
},
|
|
57
57
|
[ColorScheme.Yellow]: {
|
|
58
58
|
[MessageVariant.RECEIVED]: {
|
|
59
59
|
background: COLORS.NEUTRAL_3,
|
|
60
60
|
border: COLORS.NEUTRAL_3,
|
|
61
|
-
icon:
|
|
61
|
+
icon: ColorScheme.Yellow,
|
|
62
62
|
},
|
|
63
63
|
[MessageVariant.SENT]: {
|
|
64
64
|
background: COLORS.PRIMARY_YELLOW,
|
|
65
65
|
border: COLORS.PRIMARY_YELLOW,
|
|
66
|
-
icon:
|
|
66
|
+
icon: ColorScheme.Yellow,
|
|
67
67
|
},
|
|
68
68
|
},
|
|
69
69
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const VOICE_RECORDER_CONTAINER_SIZES = {
|
|
2
|
+
COLLAPSED: 61,
|
|
3
|
+
EXPANDED: 152,
|
|
4
|
+
}
|
|
5
|
+
export const VOICE_RECORDER_MAX_DURATION_MS = 60000 // 1 minute
|
|
6
|
+
export enum VoiceRecorderState {
|
|
7
|
+
IDLE,
|
|
8
|
+
RECORDING,
|
|
9
|
+
PAUSED,
|
|
10
|
+
}
|
|
11
|
+
export const DROPDOWN_MAX_CONTENT_HEIGHT = 330
|
|
12
|
+
export const TRANSCRIPT_RETRY_INTERVAL_MS = 4000
|
|
13
|
+
export const TRANSCRIPT_MAX_RETRIES = 15
|
|
14
|
+
export const NO_AUDIO_BE_MESSAGE = 'No audio'
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { IS_MOBILE, IS_WEB } from '@magmamath/react-native-ui'
|
|
2
|
+
import {
|
|
3
|
+
AudioPlayer,
|
|
4
|
+
AudioRecorder,
|
|
5
|
+
createAudioPlayer,
|
|
6
|
+
getRecordingPermissionsAsync,
|
|
7
|
+
requestRecordingPermissionsAsync,
|
|
8
|
+
} from 'expo-audio'
|
|
9
|
+
import * as FileSystem from 'expo-file-system'
|
|
10
|
+
import { VoicePlayerApi, VoiceRecorderApi } from './types'
|
|
11
|
+
import { VOICE_RECORDER_MAX_DURATION_MS } from './constants'
|
|
12
|
+
import { PlayerState } from './playing/model'
|
|
13
|
+
import { AudioStatus } from '../chatbot'
|
|
14
|
+
import { AxiosResponse } from 'axios'
|
|
15
|
+
|
|
16
|
+
export const formatDuration = (ms: number): string => {
|
|
17
|
+
const totalSeconds = Math.floor(ms / 1000)
|
|
18
|
+
const minutes = Math.floor(totalSeconds / 60)
|
|
19
|
+
const seconds = totalSeconds % 60
|
|
20
|
+
return `${minutes}:${seconds.toString().padStart(2, '0')}`
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const ensureRecordingPermissions = async () => {
|
|
24
|
+
const { status } = await getRecordingPermissionsAsync()
|
|
25
|
+
console.log('permission status: ', status)
|
|
26
|
+
|
|
27
|
+
if (status !== 'granted') {
|
|
28
|
+
const { granted } = await requestRecordingPermissionsAsync()
|
|
29
|
+
return granted
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return true
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const getAvailableInputsWeb = async () => {
|
|
36
|
+
if (!navigator.mediaDevices?.enumerateDevices) return []
|
|
37
|
+
|
|
38
|
+
const devices = await navigator.mediaDevices.enumerateDevices()
|
|
39
|
+
return devices.filter((d) => d.kind === 'audioinput')
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const getAvailableInputs = async (recorder: AudioRecorder) => {
|
|
43
|
+
if (IS_WEB) {
|
|
44
|
+
return await getAvailableInputsWeb()
|
|
45
|
+
}
|
|
46
|
+
if (IS_MOBILE) {
|
|
47
|
+
return await recorder.getAvailableInputs()
|
|
48
|
+
}
|
|
49
|
+
return []
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const addAudioInputsListenerWeb = (callback: (devices: MediaDeviceInfo[]) => void) => {
|
|
53
|
+
if (!IS_WEB || !navigator.mediaDevices?.addEventListener) {
|
|
54
|
+
return () => {}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const handleDeviceChange = async () => {
|
|
58
|
+
const devices = await getAvailableInputsWeb()
|
|
59
|
+
callback(devices)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
handleDeviceChange()
|
|
63
|
+
|
|
64
|
+
navigator.mediaDevices.addEventListener('devicechange', handleDeviceChange)
|
|
65
|
+
|
|
66
|
+
return () => {
|
|
67
|
+
navigator.mediaDevices.removeEventListener('devicechange', handleDeviceChange)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
*
|
|
72
|
+
* @param fileUri
|
|
73
|
+
* @param externalPlayer - is optional expo-audio player, but should be provided
|
|
74
|
+
* because creating player is resource consuming operation
|
|
75
|
+
*/
|
|
76
|
+
export const getAudioDurationMs = (
|
|
77
|
+
fileUri: string,
|
|
78
|
+
externalPlayer?: AudioPlayer,
|
|
79
|
+
): Promise<number | undefined> => {
|
|
80
|
+
if (!fileUri) return Promise.resolve(undefined)
|
|
81
|
+
|
|
82
|
+
const player = externalPlayer ?? createAudioPlayer()
|
|
83
|
+
const isInternalPlayer = !externalPlayer
|
|
84
|
+
|
|
85
|
+
player.replace(fileUri)
|
|
86
|
+
|
|
87
|
+
return new Promise((resolve, reject) => {
|
|
88
|
+
const subscription = player.addListener('playbackStatusUpdate', () => {
|
|
89
|
+
if (player.duration !== undefined && player.duration > 0) {
|
|
90
|
+
subscription.remove()
|
|
91
|
+
|
|
92
|
+
// player.duration is in seconds (e.g., 1.234567)
|
|
93
|
+
const durationMs = Math.round(player.duration * 1000) // convert to milliseconds
|
|
94
|
+
|
|
95
|
+
if (isInternalPlayer) {
|
|
96
|
+
player.remove()
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
resolve(durationMs)
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
setTimeout(() => {
|
|
104
|
+
subscription.remove()
|
|
105
|
+
|
|
106
|
+
if (isInternalPlayer) {
|
|
107
|
+
player.remove()
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
reject(new Error('Timeout loading audio metadata'))
|
|
111
|
+
}, 3000)
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
type GenerateAudioFormDataParams = {
|
|
116
|
+
audioFileUri: string
|
|
117
|
+
durationMs?: number
|
|
118
|
+
fileName?: string
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const generateAudioFormData = async ({
|
|
122
|
+
audioFileUri,
|
|
123
|
+
durationMs,
|
|
124
|
+
fileName,
|
|
125
|
+
}: GenerateAudioFormDataParams): Promise<FormData> => {
|
|
126
|
+
//todo: add web or ios prefix to filename
|
|
127
|
+
|
|
128
|
+
const formData = new FormData()
|
|
129
|
+
const duration = Math.min(durationMs || 100, VOICE_RECORDER_MAX_DURATION_MS).toString()
|
|
130
|
+
|
|
131
|
+
if (IS_WEB) {
|
|
132
|
+
const response = await fetch(audioFileUri)
|
|
133
|
+
const blob = await response.blob()
|
|
134
|
+
const filename = fileName + blob.type.replace('audio/', '.')
|
|
135
|
+
|
|
136
|
+
formData.append('file', blob, filename)
|
|
137
|
+
formData.append('filename', filename)
|
|
138
|
+
formData.append('duration', duration)
|
|
139
|
+
|
|
140
|
+
return formData
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const filename = fileName + '.m4a'
|
|
144
|
+
const file = {
|
|
145
|
+
uri: audioFileUri,
|
|
146
|
+
type: 'audio/m4a',
|
|
147
|
+
name: filename,
|
|
148
|
+
} as any
|
|
149
|
+
|
|
150
|
+
formData.append('file', file, filename)
|
|
151
|
+
formData.append('filename', filename)
|
|
152
|
+
formData.append('duration', duration)
|
|
153
|
+
|
|
154
|
+
return formData
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export const uploadAudioFileRequestGenerator = (
|
|
158
|
+
audioFileFormData: FormData,
|
|
159
|
+
api: VoiceRecorderApi,
|
|
160
|
+
) => {
|
|
161
|
+
const controller = new AbortController()
|
|
162
|
+
|
|
163
|
+
return {
|
|
164
|
+
uploadAudio: () =>
|
|
165
|
+
api.uploadAudioFile(
|
|
166
|
+
{
|
|
167
|
+
audioFileFormData,
|
|
168
|
+
},
|
|
169
|
+
//@ts-ignore
|
|
170
|
+
{
|
|
171
|
+
signal: controller.signal,
|
|
172
|
+
},
|
|
173
|
+
),
|
|
174
|
+
controller,
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const downloadAudioMobile = async (response: any, audioFileId: string) => {
|
|
179
|
+
const { config } = response
|
|
180
|
+
const url = config.url.startsWith('http')
|
|
181
|
+
? config.url
|
|
182
|
+
: `${config.baseURL?.replace(/\/$/, '')}/${config.url.replace(/^\//, '')}`
|
|
183
|
+
|
|
184
|
+
const fileName = `audio-${audioFileId}.mp4`
|
|
185
|
+
const fileUri = `${FileSystem.cacheDirectory}${fileName}`
|
|
186
|
+
const authHeader = config.headers?.Authorization || config.headers?.authorization
|
|
187
|
+
|
|
188
|
+
const downloadResult = await FileSystem.downloadAsync(
|
|
189
|
+
url,
|
|
190
|
+
fileUri,
|
|
191
|
+
authHeader ? { headers: { Authorization: authHeader } } : undefined,
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
if (downloadResult.status !== 200) {
|
|
195
|
+
throw new Error(`Failed to download audio file. Status: ${downloadResult.status}`)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return {
|
|
199
|
+
uri: downloadResult.uri,
|
|
200
|
+
fileName,
|
|
201
|
+
fileType: 'audio/mp4',
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const downloadAudioWeb = (response: AxiosResponse<Blob>, audioFileId: string) => {
|
|
206
|
+
const blob: Blob = response.data
|
|
207
|
+
|
|
208
|
+
if (!(blob instanceof Blob)) {
|
|
209
|
+
throw new Error('Unable to extract audio blob from response')
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return {
|
|
213
|
+
uri: URL.createObjectURL(blob),
|
|
214
|
+
fileName: `audio-${audioFileId}.mp4`,
|
|
215
|
+
fileType: blob.type || 'audio/mp4',
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export const downloadAudioFileRequestGenerator = (audioFileId: string, api: VoicePlayerApi) => {
|
|
220
|
+
const controller = new AbortController()
|
|
221
|
+
|
|
222
|
+
return {
|
|
223
|
+
downloadAudio: async () => {
|
|
224
|
+
const response = await api.downloadAudioFile(audioFileId, {
|
|
225
|
+
//@ts-ignore
|
|
226
|
+
signal: controller.signal,
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
return IS_WEB
|
|
230
|
+
? downloadAudioWeb(response, audioFileId)
|
|
231
|
+
: downloadAudioMobile(response, audioFileId)
|
|
232
|
+
},
|
|
233
|
+
controller,
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export const getActiveAttempt = (attemptOffset?: number, attemptsCount?: number): number | null => {
|
|
238
|
+
if (attemptOffset === undefined || attemptsCount === undefined) return null
|
|
239
|
+
return attemptsCount - attemptOffset
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export const getAudioStatus = (state: PlayerState): AudioStatus | undefined => {
|
|
243
|
+
if (state === PlayerState.PLAYING) return AudioStatus.PLAYING
|
|
244
|
+
if (state === PlayerState.PAUSED) return AudioStatus.PAUSED
|
|
245
|
+
return undefined
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export const is400Error = (error: unknown): boolean => {
|
|
249
|
+
if (error instanceof Error) {
|
|
250
|
+
const httpError = error as any
|
|
251
|
+
return httpError.status === 400 || httpError.response?.status === 400
|
|
252
|
+
}
|
|
253
|
+
return false
|
|
254
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Recording exports
|
|
2
|
+
export * from './recording/components/VoiceRecord'
|
|
3
|
+
export * from './recording/model/VoiceRecord.model'
|
|
4
|
+
export * from './recording/modal/VoiceRecordDeleteModal'
|
|
5
|
+
export * from './recording/modal/VoiceRecordUndoModal'
|
|
6
|
+
|
|
7
|
+
// Playing exports
|
|
8
|
+
export * from './playing/model/VoicePlayer.model'
|
|
9
|
+
export * from './playing/model/VoiceTranscriptionsCollection'
|
|
10
|
+
export * from './playing/model/VoiceTranscriptionsDownloader.model'
|
|
11
|
+
export * from './playing/model/VoiceTranscriptionsDropdown.model'
|
|
12
|
+
export * from './playing/components/VoiceTranscriptionsDropdown'
|
|
13
|
+
|
|
14
|
+
// Shared exports
|
|
15
|
+
export * from './playing/components/VoiceIcon'
|
|
16
|
+
export * from './constants'
|
|
17
|
+
export * from './types'
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Re-export recording models
|
|
2
|
+
export { VoiceRecordModel } from '../recording/model/VoiceRecord.model'
|
|
3
|
+
export { VoiceRecordsCollection } from '../recording/model/VoiceRecordCollection'
|
|
4
|
+
export { RecorderModel } from '../recording/model/Recorder.model'
|
|
5
|
+
export { UploaderModel } from '../recording/model/Uploader.model'
|
|
6
|
+
|
|
7
|
+
// Re-export playing models
|
|
8
|
+
export { VoicePlayerModel } from '../playing/model/VoicePlayer.model'
|
|
9
|
+
export { VoiceTranscriptionsCollection } from '../playing/model/VoiceTranscriptionsCollection'
|
|
10
|
+
export type { VoiceTranscriptionItem } from '../playing/model/VoiceTranscriptionsCollection'
|
|
11
|
+
export { VoiceTranscriptionsDownloaderModel } from '../playing/model/VoiceTranscriptionsDownloader.model'
|
|
12
|
+
export { VoicePlayerModel as VoiceTranscriptionsPlayerModel } from '../playing/model/VoicePlayer.model'
|
|
13
|
+
export { VoiceTranscriptionsDropdownModel } from '../playing/model/VoiceTranscriptionsDropdown.model'
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { COLORS, MicrophoneIcon } from '@magmamath/react-native-ui'
|
|
4
|
+
import Animated, { FadeIn } from 'react-native-reanimated'
|
|
5
|
+
|
|
6
|
+
type VoiceIconProps = {
|
|
7
|
+
style?: StyleProp<ViewStyle>
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const VoiceIcon = ({ style }: VoiceIconProps) => {
|
|
11
|
+
return (
|
|
12
|
+
<Animated.View entering={FadeIn.duration(250)} style={[styles.container, style]}>
|
|
13
|
+
<View style={styles.iconContainer}>
|
|
14
|
+
<MicrophoneIcon color={COLORS.NEUTRAL_5} />
|
|
15
|
+
</View>
|
|
16
|
+
</Animated.View>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const styles = StyleSheet.create({
|
|
21
|
+
container: {
|
|
22
|
+
flex: 1,
|
|
23
|
+
justifyContent: 'center',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
},
|
|
26
|
+
iconContainer: {
|
|
27
|
+
maxHeight: 124,
|
|
28
|
+
height: '80%',
|
|
29
|
+
aspectRatio: 1,
|
|
30
|
+
alignSelf: 'center',
|
|
31
|
+
padding: 24,
|
|
32
|
+
borderWidth: 4,
|
|
33
|
+
borderColor: COLORS.NEUTRAL_5,
|
|
34
|
+
borderRadius: 400,
|
|
35
|
+
justifyContent: 'center',
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
},
|
|
38
|
+
})
|