@magmamath/students-features 0.11.0-rc.9 → 1.0.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/Chat/Chat.js +59 -221
- package/dist/commonjs/features/chatbot/components/Chat/Chat.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js +58 -45
- package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/ChatInput.js +1 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/ChatInput.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/FreeText/ChatTextInput.js +2 -2
- package/dist/commonjs/features/chatbot/components/ChatInput/FreeText/ChatTextInput.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/FreeText/SendMessageButton.js +1 -1
- 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/MessageLoader.js +34 -14
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.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/components/ChatMessage/ReceivedMessage.js +13 -14
- package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/SentMessage.js +1 -1
- package/dist/commonjs/features/chatbot/components/Chatbot.js +12 -22
- package/dist/commonjs/features/chatbot/components/Chatbot.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/chatbot/helpers.js +1 -8
- package/dist/commonjs/features/chatbot/helpers.js.map +1 -1
- package/dist/commonjs/features/chatbot/index.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js +10 -46
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatBoxTextManager.js +1 -2
- package/dist/commonjs/features/chatbot/model/ChatBoxTextManager.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatbotApi.js +1 -1
- package/dist/commonjs/features/chatbot/model/ChatbotApi.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatbotTranslation.js +1 -1
- package/dist/commonjs/features/chatbot/model/ChatbotTranslation.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatsCacheModel.js +0 -9
- package/dist/commonjs/features/chatbot/model/ChatsCacheModel.js.map +1 -1
- package/dist/commonjs/features/chatbot/types/model.types.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 +23 -0
- package/dist/commonjs/features/voice/constants.js.map +1 -0
- package/dist/commonjs/features/voice/helpers.js +208 -0
- package/dist/commonjs/features/voice/helpers.js.map +1 -0
- package/dist/commonjs/features/voice/index.js +105 -0
- package/dist/commonjs/features/voice/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 +219 -0
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.js.map +1 -0
- package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js +109 -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 +98 -0
- package/dist/commonjs/features/voice/playing/model/Player.model.js.map +1 -0
- package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.js +66 -0
- package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.js.map +1 -0
- package/dist/commonjs/features/voice/playing/model/VoiceFileDownloader.model.js +39 -0
- package/dist/commonjs/features/voice/playing/model/VoiceFileDownloader.model.js.map +1 -0
- package/dist/commonjs/features/voice/playing/model/VoicePlayer.model.js +223 -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/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 +20 -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 +63 -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/VoiceRecordDivider.js +27 -0
- package/dist/commonjs/features/voice/recording/components/VoiceRecordDivider.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 +55 -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 +248 -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/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 +18 -2
- package/dist/commonjs/shared/translation/localization/de.json +18 -2
- package/dist/commonjs/shared/translation/localization/en.json +18 -2
- package/dist/commonjs/shared/translation/localization/gb.json +18 -2
- package/dist/commonjs/shared/translation/localization/sct.json +18 -2
- package/dist/commonjs/shared/translation/localization/sw.json +18 -2
- package/dist/module/features/chatbot/components/Chat/Chat.js +61 -223
- package/dist/module/features/chatbot/components/Chat/Chat.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatControls/ChatControls.js +59 -47
- package/dist/module/features/chatbot/components/ChatControls/ChatControls.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatInput/ChatInput.js +1 -1
- package/dist/module/features/chatbot/components/ChatInput/ChatInput.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatInput/FreeText/ChatTextInput.js +2 -2
- package/dist/module/features/chatbot/components/ChatInput/FreeText/ChatTextInput.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatInput/FreeText/SendMessageButton.js +1 -1
- 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/MessageLoader.js +36 -17
- package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.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/components/ChatMessage/ReceivedMessage.js +12 -13
- package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/SentMessage.js +1 -1
- package/dist/module/features/chatbot/components/Chatbot.js +11 -20
- package/dist/module/features/chatbot/components/Chatbot.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/chatbot/helpers.js +1 -8
- package/dist/module/features/chatbot/helpers.js.map +1 -1
- package/dist/module/features/chatbot/index.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatBotModel.js +10 -46
- package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatBoxTextManager.js +1 -2
- package/dist/module/features/chatbot/model/ChatBoxTextManager.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatbotApi.js +1 -1
- package/dist/module/features/chatbot/model/ChatbotApi.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatbotTranslation.js +1 -1
- package/dist/module/features/chatbot/model/ChatbotTranslation.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatsCacheModel.js +0 -9
- package/dist/module/features/chatbot/model/ChatsCacheModel.js.map +1 -1
- package/dist/module/features/chatbot/types/model.types.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 +19 -0
- package/dist/module/features/voice/constants.js.map +1 -0
- package/dist/module/features/voice/helpers.js +191 -0
- package/dist/module/features/voice/helpers.js.map +1 -0
- package/dist/module/features/voice/index.js +12 -0
- package/dist/module/features/voice/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 +212 -0
- package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdown.js.map +1 -0
- package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js +103 -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 +93 -0
- package/dist/module/features/voice/playing/model/Player.model.js.map +1 -0
- package/dist/module/features/voice/playing/model/TranscriptionsDownloaderModel.js +61 -0
- package/dist/module/features/voice/playing/model/TranscriptionsDownloaderModel.js.map +1 -0
- package/dist/module/features/voice/playing/model/VoiceFileDownloader.model.js +34 -0
- package/dist/module/features/voice/playing/model/VoiceFileDownloader.model.js.map +1 -0
- package/dist/module/features/voice/playing/model/VoicePlayer.model.js +218 -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/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 +5 -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 +57 -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/VoiceRecordDivider.js +21 -0
- package/dist/module/features/voice/recording/components/VoiceRecordDivider.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 +50 -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 +244 -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/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 +18 -2
- package/dist/module/shared/translation/localization/de.json +18 -2
- package/dist/module/shared/translation/localization/en.json +18 -2
- package/dist/module/shared/translation/localization/gb.json +18 -2
- package/dist/module/shared/translation/localization/sct.json +18 -2
- package/dist/module/shared/translation/localization/sw.json +18 -2
- package/dist/typescript/commonjs/features/chatbot/components/Chat/Chat.d.ts +1 -2
- package/dist/typescript/commonjs/features/chatbot/components/Chat/Chat.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatControls/ChatControls.d.ts +3 -3
- package/dist/typescript/commonjs/features/chatbot/components/ChatControls/ChatControls.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/ChatInput.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/RequestHintButton.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ChatMessage.d.ts +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ChatMessage.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/MessageLoader.d.ts +3 -2
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageLoader.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/components/ChatMessage/ReceivedMessage.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts +1 -2
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.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/chatbot/helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/index.d.ts +2 -2
- package/dist/typescript/commonjs/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts +1 -2
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBoxTextManager.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatsCacheModel.d.ts +0 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatsCacheModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts +17 -19
- package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts +13 -8
- package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts +0 -1
- package/dist/typescript/commonjs/features/chatbot/types/units.types.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 +16 -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 +10 -0
- package/dist/typescript/commonjs/features/voice/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 +16 -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 +23 -0
- package/dist/typescript/commonjs/features/voice/playing/model/Player.model.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts +15 -0
- package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/model/VoiceFileDownloader.model.d.ts +17 -0
- package/dist/typescript/commonjs/features/voice/playing/model/VoiceFileDownloader.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 +13 -0
- package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionsCollection.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 +3 -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/VoiceRecordDivider.d.ts +3 -0
- package/dist/typescript/commonjs/features/voice/recording/components/VoiceRecordDivider.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/types.d.ts +72 -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 -6
- package/dist/typescript/commonjs/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/model.d.ts +34 -2
- 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/Chat/Chat.d.ts +1 -2
- package/dist/typescript/module/features/chatbot/components/Chat/Chat.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatControls/ChatControls.d.ts +3 -3
- package/dist/typescript/module/features/chatbot/components/ChatControls/ChatControls.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatInput/ChatInput.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/ChatMessage.d.ts +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/ChatMessage.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/MessageLoader.d.ts +3 -2
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageLoader.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/components/ChatMessage/ReceivedMessage.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts +1 -2
- package/dist/typescript/module/features/chatbot/components/Chatbot.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/chatbot/helpers.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/index.d.ts +2 -2
- package/dist/typescript/module/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts +1 -2
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBoxTextManager.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatsCacheModel.d.ts +0 -1
- package/dist/typescript/module/features/chatbot/model/ChatsCacheModel.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/api.types.d.ts +17 -19
- package/dist/typescript/module/features/chatbot/types/api.types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/model.types.d.ts +13 -8
- package/dist/typescript/module/features/chatbot/types/model.types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/units.types.d.ts +0 -1
- package/dist/typescript/module/features/chatbot/types/units.types.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 +16 -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 +10 -0
- package/dist/typescript/module/features/voice/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 +16 -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 +23 -0
- package/dist/typescript/module/features/voice/playing/model/Player.model.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts +15 -0
- package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/model/VoiceFileDownloader.model.d.ts +17 -0
- package/dist/typescript/module/features/voice/playing/model/VoiceFileDownloader.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 +13 -0
- package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionsCollection.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 +3 -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/VoiceRecordDivider.d.ts +3 -0
- package/dist/typescript/module/features/voice/recording/components/VoiceRecordDivider.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/types.d.ts +72 -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 -6
- package/dist/typescript/module/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/model.d.ts +34 -2
- 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 -6
- package/src/features/chatbot/components/Chat/Chat.tsx +70 -288
- package/src/features/chatbot/components/ChatControls/ChatControls.tsx +66 -46
- package/src/features/chatbot/components/ChatInput/ChatInput.tsx +1 -2
- package/src/features/chatbot/components/ChatInput/FreeText/ChatTextInput.tsx +2 -2
- package/src/features/chatbot/components/ChatInput/FreeText/SendMessageButton.tsx +1 -1
- package/src/features/chatbot/components/ChatInput/RequestHintButton.tsx +0 -1
- package/src/features/chatbot/components/ChatMessage/ChatMessage.tsx +1 -1
- package/src/features/chatbot/components/ChatMessage/MessageButtonsBlock.tsx +1 -1
- package/src/features/chatbot/components/ChatMessage/MessageLoader.tsx +33 -17
- package/src/features/chatbot/components/ChatMessage/MessageTextToSpeech.tsx +9 -51
- package/src/features/chatbot/components/ChatMessage/ReceivedMessage.tsx +12 -13
- package/src/features/chatbot/components/ChatMessage/SentMessage.tsx +1 -1
- package/src/features/chatbot/components/Chatbot.tsx +11 -21
- package/src/features/chatbot/constants.ts +4 -4
- package/src/features/chatbot/helpers.ts +0 -3
- package/src/features/chatbot/index.ts +2 -16
- package/src/features/chatbot/model/ChatBotModel.ts +8 -51
- package/src/features/chatbot/model/ChatBoxTextManager.ts +0 -1
- package/src/features/chatbot/model/ChatbotApi.ts +1 -1
- package/src/features/chatbot/model/ChatbotTranslation.ts +1 -1
- package/src/features/chatbot/model/ChatsCacheModel.ts +0 -7
- package/src/features/chatbot/types/api.types.ts +17 -17
- package/src/features/chatbot/types/model.types.ts +15 -8
- package/src/features/chatbot/types/units.types.ts +0 -1
- package/src/features/gifCelebrations/helpers.ts +1 -0
- package/src/features/voice/constants.ts +15 -0
- package/src/features/voice/helpers.ts +251 -0
- package/src/features/voice/index.ts +11 -0
- package/src/features/voice/playing/components/VoiceIcon.tsx +38 -0
- package/src/features/voice/playing/components/VoiceTranscriptionsDropdown.tsx +256 -0
- package/src/features/voice/playing/components/VoiceTranscriptionsDropdownItem.tsx +128 -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 +104 -0
- package/src/features/voice/playing/model/TranscriptionsDownloaderModel.ts +80 -0
- package/src/features/voice/playing/model/VoiceFileDownloader.model.ts +42 -0
- package/src/features/voice/playing/model/VoicePlayer.model.ts +255 -0
- package/src/features/voice/playing/model/VoiceTranscriptionsCollection.ts +40 -0
- package/src/features/voice/playing/model/VoiceTranscriptionsDropdown.model.ts +11 -0
- package/src/features/voice/playing/model/index.ts +2 -0
- package/src/features/voice/recording/components/VoiceRecord.tsx +65 -0
- package/src/features/voice/recording/components/VoiceRecordButton.tsx +64 -0
- package/src/features/voice/recording/components/VoiceRecordDeleteButton.tsx +25 -0
- package/src/features/voice/recording/components/VoiceRecordDivider.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 +63 -0
- package/src/features/voice/recording/model/Uploader.model.ts +48 -0
- package/src/features/voice/recording/model/VoiceRecord.model.ts +302 -0
- package/src/features/voice/recording/model/VoiceRecordCollection.ts +26 -0
- package/src/features/voice/types.ts +84 -0
- package/src/index.ts +1 -0
- package/src/shared/components/PlayButton.tsx +84 -0
- package/src/shared/translation/localization/ca.json +18 -2
- package/src/shared/translation/localization/de.json +18 -2
- package/src/shared/translation/localization/en.json +18 -2
- package/src/shared/translation/localization/gb.json +18 -2
- package/src/shared/translation/localization/sct.json +18 -2
- package/src/shared/translation/localization/sw.json +18 -2
- package/src/types/common.types.ts +1 -0
- package/dist/commonjs/features/chatbot/TTS_HIGHLIGHTING.md +0 -120
- package/dist/commonjs/features/chatbot/components/Chat/CloseButton.js +0 -39
- package/dist/commonjs/features/chatbot/components/Chat/CloseButton.js.map +0 -1
- package/dist/commonjs/features/chatbot/components/Chat/GradientFade.js +0 -44
- package/dist/commonjs/features/chatbot/components/Chat/GradientFade.js.map +0 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/AnimatedMessage.js +0 -41
- package/dist/commonjs/features/chatbot/components/ChatMessage/AnimatedMessage.js.map +0 -1
- package/dist/module/features/chatbot/TTS_HIGHLIGHTING.md +0 -120
- package/dist/module/features/chatbot/components/Chat/CloseButton.js +0 -33
- package/dist/module/features/chatbot/components/Chat/CloseButton.js.map +0 -1
- package/dist/module/features/chatbot/components/Chat/GradientFade.js +0 -39
- package/dist/module/features/chatbot/components/Chat/GradientFade.js.map +0 -1
- package/dist/module/features/chatbot/components/ChatMessage/AnimatedMessage.js +0 -34
- package/dist/module/features/chatbot/components/ChatMessage/AnimatedMessage.js.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chat/CloseButton.d.ts +0 -7
- package/dist/typescript/commonjs/features/chatbot/components/Chat/CloseButton.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chat/GradientFade.d.ts +0 -10
- package/dist/typescript/commonjs/features/chatbot/components/Chat/GradientFade.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/AnimatedMessage.d.ts +0 -7
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/AnimatedMessage.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/Chat/CloseButton.d.ts +0 -7
- package/dist/typescript/module/features/chatbot/components/Chat/CloseButton.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/Chat/GradientFade.d.ts +0 -10
- package/dist/typescript/module/features/chatbot/components/Chat/GradientFade.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/AnimatedMessage.d.ts +0 -7
- package/dist/typescript/module/features/chatbot/components/ChatMessage/AnimatedMessage.d.ts.map +0 -1
- package/src/features/chatbot/TTS_HIGHLIGHTING.md +0 -120
- package/src/features/chatbot/components/Chat/CloseButton.tsx +0 -31
- package/src/features/chatbot/components/Chat/GradientFade.tsx +0 -43
- package/src/features/chatbot/components/ChatMessage/AnimatedMessage.tsx +0 -30
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { VoiceTranscriptionItem } from '../../types'
|
|
2
|
+
|
|
3
|
+
export class VoiceTranscriptionsCollection {
|
|
4
|
+
public readonly collection: Map<number, VoiceTranscriptionItem> = new Map()
|
|
5
|
+
|
|
6
|
+
public add(attemptNumber: number, item: VoiceTranscriptionItem) {
|
|
7
|
+
this.collection.set(attemptNumber, item)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
public update(attemptNumber: number, item: Partial<VoiceTranscriptionItem>) {
|
|
11
|
+
const existingItem = this.collection.get(attemptNumber) || ({} as VoiceTranscriptionItem)
|
|
12
|
+
this.collection.set(attemptNumber, { ...existingItem, ...item })
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public delete(attemptNumber: number) {
|
|
16
|
+
this.collection.delete(attemptNumber)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public get(attemptNumber: number) {
|
|
20
|
+
return this.collection.get(attemptNumber)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public getAll() {
|
|
24
|
+
return Array.from(this.collection.values())
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public clear() {
|
|
28
|
+
this.collection.clear()
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public hasTranscript(attemptNumber: number) {
|
|
32
|
+
const item = this.collection.get(attemptNumber)
|
|
33
|
+
return !!item?.transcript
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public hasAudio(attemptNumber: number) {
|
|
37
|
+
const item = this.collection.get(attemptNumber)
|
|
38
|
+
return !!item?.audioUri
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createEvent, createStore, restore } from 'effector'
|
|
2
|
+
|
|
3
|
+
export class VoiceTranscriptionsDropdownModel {
|
|
4
|
+
public readonly toggleExpand = createEvent()
|
|
5
|
+
public readonly setExpanded = createEvent<boolean>()
|
|
6
|
+
public readonly reset = createEvent()
|
|
7
|
+
|
|
8
|
+
public readonly $isExpanded = restore(this.setExpanded, false)
|
|
9
|
+
.on(this.toggleExpand, (state) => !state)
|
|
10
|
+
.reset(this.reset)
|
|
11
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle, StyleSheet } from 'react-native'
|
|
2
|
+
import { VoiceRecordButton } from './VoiceRecordButton'
|
|
3
|
+
import React, { useEffect } from 'react'
|
|
4
|
+
import { COLORS, SPACING } from '@magmamath/react-native-ui'
|
|
5
|
+
import { VoiceRecordDeleteButton } from './VoiceRecordDeleteButton'
|
|
6
|
+
import { VoiceRecordDivider } from './VoiceRecordDivider'
|
|
7
|
+
import { VoiceRecordTimer } from './VoiceRecordTimer'
|
|
8
|
+
import Animated, { FadeIn, FadeOut } from 'react-native-reanimated'
|
|
9
|
+
import { VoiceRecordModel } from '../model/VoiceRecord.model'
|
|
10
|
+
import { useVoiceRecorder } from '../hooks/useVoiceRecorder'
|
|
11
|
+
import { useVoiceRecorderAnimation } from '../hooks/useVoiceRecorderAnimation'
|
|
12
|
+
import { useUnit } from 'effector-react'
|
|
13
|
+
|
|
14
|
+
type VoiceRecordProps = {
|
|
15
|
+
style?: StyleProp<ViewStyle>
|
|
16
|
+
model: VoiceRecordModel
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const VoiceRecord = ({ style, model }: VoiceRecordProps) => {
|
|
20
|
+
const { recorderState } = useVoiceRecorder(model)
|
|
21
|
+
const [isExpanded, isDisabled] = useUnit([model.$isExpanded, model.$isButtonDisabled])
|
|
22
|
+
|
|
23
|
+
const { containerAnimatedStyle } = useVoiceRecorderAnimation(isExpanded)
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
return () => {
|
|
27
|
+
model.cleanup()
|
|
28
|
+
}
|
|
29
|
+
}, [model])
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Animated.View style={[styles.container, style, containerAnimatedStyle]}>
|
|
33
|
+
<VoiceRecordButton model={model} />
|
|
34
|
+
{isExpanded && (
|
|
35
|
+
<Animated.View entering={FadeIn} exiting={FadeOut} style={styles.expendedContainer}>
|
|
36
|
+
<VoiceRecordTimer
|
|
37
|
+
style={styles.timer}
|
|
38
|
+
model={model}
|
|
39
|
+
recordingFileDurationMs={recorderState.durationMillis}
|
|
40
|
+
/>
|
|
41
|
+
<VoiceRecordDivider />
|
|
42
|
+
<VoiceRecordDeleteButton isDisabled={isDisabled} onPress={model.events.deleteRecord} />
|
|
43
|
+
</Animated.View>
|
|
44
|
+
)}
|
|
45
|
+
</Animated.View>
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const styles = StyleSheet.create({
|
|
50
|
+
container: {
|
|
51
|
+
alignItems: 'center',
|
|
52
|
+
padding: 3,
|
|
53
|
+
paddingBottom: 6,
|
|
54
|
+
backgroundColor: COLORS.NEUTRAL_3,
|
|
55
|
+
borderRadius: 32,
|
|
56
|
+
boxShadow: '0 1px 3px 0 rgba(51, 51, 51, 0.10), 0 0 1px 0 rgba(51, 51, 51, 0.40)',
|
|
57
|
+
overflow: 'hidden',
|
|
58
|
+
},
|
|
59
|
+
timer: {
|
|
60
|
+
marginTop: SPACING[400],
|
|
61
|
+
},
|
|
62
|
+
expendedContainer: {
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
},
|
|
65
|
+
})
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React, { useMemo } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
Button,
|
|
4
|
+
ButtonColor,
|
|
5
|
+
ButtonSize,
|
|
6
|
+
ButtonStyle,
|
|
7
|
+
ButtonVariant,
|
|
8
|
+
IS_WEB,
|
|
9
|
+
} from '@magmamath/react-native-ui'
|
|
10
|
+
import { Pressable } from 'react-native'
|
|
11
|
+
import { MicrophoneIcon, CheckIcon } from '@magmamath/react-native-ui'
|
|
12
|
+
import { VoiceRecordModel } from '../model/VoiceRecord.model'
|
|
13
|
+
import { useUnit } from 'effector-react'
|
|
14
|
+
import { VoiceRecorderState } from '../../constants'
|
|
15
|
+
import { useText } from '../../../../shared/translation'
|
|
16
|
+
|
|
17
|
+
type VoiceRecordButtonProps = {
|
|
18
|
+
style?: ButtonStyle
|
|
19
|
+
model: VoiceRecordModel
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const VoiceRecordButton = ({ style, model }: VoiceRecordButtonProps) => {
|
|
23
|
+
const t = useText()
|
|
24
|
+
|
|
25
|
+
const availableInputs = useUnit(model.recorderModel.$availableInputs)
|
|
26
|
+
const voiceRecordState = useUnit(model.recorderModel.$voiceRecordState)
|
|
27
|
+
const isButtonDisabled = useUnit(model.$isButtonDisabled)
|
|
28
|
+
const isInitializing = useUnit(model.initializeRecording.pending)
|
|
29
|
+
|
|
30
|
+
const combinedStyles = useMemo((): ButtonStyle => {
|
|
31
|
+
return {
|
|
32
|
+
button: [{ width: 50, height: 50 }, style?.button],
|
|
33
|
+
container: [style?.container],
|
|
34
|
+
text: [style?.text],
|
|
35
|
+
}
|
|
36
|
+
}, [style])
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<Pressable
|
|
40
|
+
onPressIn={(e) => {
|
|
41
|
+
if (availableInputs.length) return
|
|
42
|
+
e.preventDefault()
|
|
43
|
+
model.notification.warning(t('voice.noMicrophoneFound'))
|
|
44
|
+
}}
|
|
45
|
+
pointerEvents={!availableInputs.length || isInitializing ? 'box-only' : 'auto'}
|
|
46
|
+
>
|
|
47
|
+
<Button
|
|
48
|
+
disabled={isButtonDisabled || !availableInputs.length}
|
|
49
|
+
onPressIn={() => model.recorderButtonHandler()}
|
|
50
|
+
style={combinedStyles}
|
|
51
|
+
size={ButtonSize.LARGE}
|
|
52
|
+
variant={ButtonVariant.SECONDARY}
|
|
53
|
+
colorScheme={ButtonColor.WHITE}
|
|
54
|
+
icon={
|
|
55
|
+
voiceRecordState === VoiceRecorderState.RECORDING ? (
|
|
56
|
+
<CheckIcon size={25} />
|
|
57
|
+
) : (
|
|
58
|
+
<MicrophoneIcon style={IS_WEB ? { width: 19 } : { minWidth: 23, minHeight: 23 }} />
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
/>
|
|
62
|
+
</Pressable>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { StyleSheet, TouchableOpacity } from 'react-native'
|
|
2
|
+
import { COLORS, TrashcanIcon } from '@magmamath/react-native-ui'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
|
|
5
|
+
type VoiceRecordDeleteProps = {
|
|
6
|
+
onPress?: () => void
|
|
7
|
+
isDisabled?: boolean
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const VoiceRecordDeleteButton = ({ onPress, isDisabled }: VoiceRecordDeleteProps) => {
|
|
11
|
+
return (
|
|
12
|
+
<TouchableOpacity style={styles.container} onPress={onPress} disabled={isDisabled}>
|
|
13
|
+
<TrashcanIcon size={20} color={isDisabled ? COLORS.NEUTRAL_5 : COLORS.NEUTRAL_9} />
|
|
14
|
+
</TouchableOpacity>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const styles = StyleSheet.create({
|
|
19
|
+
container: {
|
|
20
|
+
width: 36,
|
|
21
|
+
height: 36,
|
|
22
|
+
alignItems: 'center',
|
|
23
|
+
justifyContent: 'center',
|
|
24
|
+
},
|
|
25
|
+
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StyleSheet, View } from 'react-native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { COLORS } from '@magmamath/react-native-ui'
|
|
4
|
+
|
|
5
|
+
export const VoiceRecordDivider = () => {
|
|
6
|
+
return <View style={styles.container} />
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const styles = StyleSheet.create({
|
|
10
|
+
container: {
|
|
11
|
+
height: 1,
|
|
12
|
+
borderRadius: 1,
|
|
13
|
+
width: 28,
|
|
14
|
+
margin: 8,
|
|
15
|
+
backgroundColor: COLORS.NEUTRAL_6,
|
|
16
|
+
},
|
|
17
|
+
})
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native'
|
|
2
|
+
import { COLORS, Typography } from '@magmamath/react-native-ui'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
import { VoiceRecordModel } from '../model/VoiceRecord.model'
|
|
5
|
+
import { useUnit } from 'effector-react'
|
|
6
|
+
import { formatDuration } from '../../helpers'
|
|
7
|
+
|
|
8
|
+
type VoiceRecordTimerProps = {
|
|
9
|
+
style?: StyleProp<ViewStyle>
|
|
10
|
+
model: VoiceRecordModel
|
|
11
|
+
recordingFileDurationMs?: number
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const VoiceRecordTimer = ({
|
|
15
|
+
style,
|
|
16
|
+
model,
|
|
17
|
+
recordingFileDurationMs,
|
|
18
|
+
}: VoiceRecordTimerProps) => {
|
|
19
|
+
const savedAudioFileDurationMs = useUnit(model.$currentRecord)?.durationMs || 0
|
|
20
|
+
const displayDurationMs = recordingFileDurationMs || savedAudioFileDurationMs
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<View style={[styles.container, style]}>
|
|
24
|
+
<Typography variant="h9" style={styles.text}>
|
|
25
|
+
{displayDurationMs ? formatDuration(displayDurationMs) : '0:00'}
|
|
26
|
+
</Typography>
|
|
27
|
+
</View>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const styles = StyleSheet.create({
|
|
32
|
+
container: {
|
|
33
|
+
backgroundColor: COLORS.NEUTRAL_1,
|
|
34
|
+
paddingHorizontal: 8,
|
|
35
|
+
paddingVertical: 2,
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
borderWidth: 0.5,
|
|
38
|
+
borderColor: COLORS.NEUTRAL_4,
|
|
39
|
+
borderRadius: 18,
|
|
40
|
+
minWidth: 45,
|
|
41
|
+
},
|
|
42
|
+
text: {
|
|
43
|
+
color: COLORS.NEUTRAL_10,
|
|
44
|
+
fontSize: 13,
|
|
45
|
+
fontWeight: '600',
|
|
46
|
+
lineHeight: 18,
|
|
47
|
+
textTransform: 'uppercase',
|
|
48
|
+
},
|
|
49
|
+
})
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { RecordingPresets, useAudioRecorder, useAudioRecorderState } from 'expo-audio'
|
|
2
|
+
import { VoiceRecordModel } from '../model/VoiceRecord.model'
|
|
3
|
+
import { useEffect } from 'react'
|
|
4
|
+
import { IS_WEB } from '@magmamath/react-native-ui'
|
|
5
|
+
import { VOICE_RECORDER_MAX_DURATION_MS, VoiceRecorderState } from '../../constants'
|
|
6
|
+
import { addAudioInputsListenerWeb, getAvailableInputs } from '../../helpers'
|
|
7
|
+
|
|
8
|
+
export const useVoiceRecorder = (model: VoiceRecordModel) => {
|
|
9
|
+
const recorder = useAudioRecorder(RecordingPresets.LOW_QUALITY, model.recordingStatusUpdate)
|
|
10
|
+
const recorderState = useAudioRecorderState(recorder)
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (
|
|
14
|
+
recorderState.durationMillis >= VOICE_RECORDER_MAX_DURATION_MS &&
|
|
15
|
+
recorderState.isRecording
|
|
16
|
+
) {
|
|
17
|
+
model.recorderModel.stop()
|
|
18
|
+
}
|
|
19
|
+
// Track the last known duration while recording (for old browsers where getAudioDurationMs returns Infinity)
|
|
20
|
+
if (recorderState.isRecording && recorderState.durationMillis > 0) {
|
|
21
|
+
model.recorderModel.setLastKnownDurationMs(recorderState.durationMillis)
|
|
22
|
+
}
|
|
23
|
+
}, [recorderState.durationMillis])
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (!IS_WEB) {
|
|
27
|
+
//only once for iPad and listener for WEB
|
|
28
|
+
getAvailableInputs(recorder).then((inputs) => {
|
|
29
|
+
model.recorderModel.setAvailableInputs(inputs)
|
|
30
|
+
})
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const removeListener = addAudioInputsListenerWeb((devices) => {
|
|
35
|
+
model.recorderModel.setAvailableInputs(devices)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
return removeListener
|
|
39
|
+
}, [recorder, model.recorderModel])
|
|
40
|
+
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (recorderState.isRecording) {
|
|
43
|
+
model.recorderModel.setVoiceRecordState(VoiceRecorderState.RECORDING)
|
|
44
|
+
return
|
|
45
|
+
}
|
|
46
|
+
if (recorderState.durationMillis > 0) {
|
|
47
|
+
model.recorderModel.setVoiceRecordState(VoiceRecorderState.PAUSED)
|
|
48
|
+
return
|
|
49
|
+
}
|
|
50
|
+
model.recorderModel.setVoiceRecordState(VoiceRecorderState.IDLE)
|
|
51
|
+
|
|
52
|
+
return () => {
|
|
53
|
+
model.recorderModel.reset()
|
|
54
|
+
}
|
|
55
|
+
}, [recorderState, model.recorderModel])
|
|
56
|
+
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
model.recorderModel.recorder = recorder
|
|
59
|
+
}, [recorder])
|
|
60
|
+
|
|
61
|
+
return { recorderState }
|
|
62
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useAnimatedStyle, withTiming } from 'react-native-reanimated'
|
|
2
|
+
import { VOICE_RECORDER_CONTAINER_SIZES } from '../../constants'
|
|
3
|
+
|
|
4
|
+
export const useVoiceRecorderAnimation = (isExpanded: boolean) => {
|
|
5
|
+
const containerAnimatedStyle = useAnimatedStyle(() => {
|
|
6
|
+
return {
|
|
7
|
+
height: withTiming(
|
|
8
|
+
isExpanded
|
|
9
|
+
? VOICE_RECORDER_CONTAINER_SIZES.EXPANDED
|
|
10
|
+
: VOICE_RECORDER_CONTAINER_SIZES.COLLAPSED,
|
|
11
|
+
{
|
|
12
|
+
duration: 280,
|
|
13
|
+
},
|
|
14
|
+
),
|
|
15
|
+
}
|
|
16
|
+
}, [isExpanded])
|
|
17
|
+
|
|
18
|
+
return { containerAnimatedStyle }
|
|
19
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Button, ButtonColor, ButtonSize, ButtonVariant, SPACING } from '@magmamath/react-native-ui'
|
|
3
|
+
import { StyleSheet, View } from 'react-native'
|
|
4
|
+
import { useText } from '../../../../shared/translation'
|
|
5
|
+
import { TranslationKeys } from '../../../../shared/translation/types'
|
|
6
|
+
|
|
7
|
+
type ModalFooterButtonsProps = {
|
|
8
|
+
onCancel: () => void
|
|
9
|
+
onConfirm: () => void
|
|
10
|
+
confirmLabel: TranslationKeys
|
|
11
|
+
confirmColor?: ButtonColor
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const ModalFooterButtons = ({
|
|
15
|
+
onCancel,
|
|
16
|
+
onConfirm,
|
|
17
|
+
confirmLabel,
|
|
18
|
+
confirmColor = ButtonColor.BLUE,
|
|
19
|
+
}: ModalFooterButtonsProps) => {
|
|
20
|
+
const t = useText()
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<View style={styles.container}>
|
|
24
|
+
<Button
|
|
25
|
+
style={{ text: styles.buttonLabel }}
|
|
26
|
+
variant={ButtonVariant.TERTIARY}
|
|
27
|
+
size={ButtonSize.LARGE}
|
|
28
|
+
onPress={onCancel}
|
|
29
|
+
>
|
|
30
|
+
{t('voice.cancel')}
|
|
31
|
+
</Button>
|
|
32
|
+
<Button
|
|
33
|
+
colorScheme={confirmColor}
|
|
34
|
+
variant={ButtonVariant.PRIMARY}
|
|
35
|
+
size={ButtonSize.LARGE}
|
|
36
|
+
onPress={onConfirm}
|
|
37
|
+
style={{ text: styles.buttonLabel }}
|
|
38
|
+
>
|
|
39
|
+
{t(confirmLabel)}
|
|
40
|
+
</Button>
|
|
41
|
+
</View>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const styles = StyleSheet.create({
|
|
46
|
+
container: {
|
|
47
|
+
flexDirection: 'row',
|
|
48
|
+
alignItems: 'center',
|
|
49
|
+
gap: SPACING[200],
|
|
50
|
+
},
|
|
51
|
+
buttonLabel: {
|
|
52
|
+
textTransform: 'uppercase',
|
|
53
|
+
},
|
|
54
|
+
})
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
|
+
import { BaseModal, ButtonColor } from '@magmamath/react-native-ui'
|
|
3
|
+
import { StyleSheet } from 'react-native'
|
|
4
|
+
import { useUnit } from 'effector-react'
|
|
5
|
+
import { VoiceRecorderState } from '../../constants'
|
|
6
|
+
import { useText } from '../../../../shared/translation'
|
|
7
|
+
import { ModalFooterButtons } from './ModalFooterButtons'
|
|
8
|
+
import { VoiceRecordModalParams } from '../../types'
|
|
9
|
+
|
|
10
|
+
type VoiceRecordDeleteModalComponentProps = {
|
|
11
|
+
modal: {
|
|
12
|
+
closeModal: () => void
|
|
13
|
+
params: VoiceRecordModalParams
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const VoiceRecordDeleteModal = ({
|
|
18
|
+
modal: { closeModal, params },
|
|
19
|
+
}: VoiceRecordDeleteModalComponentProps) => {
|
|
20
|
+
const t = useText()
|
|
21
|
+
const { model } = params
|
|
22
|
+
|
|
23
|
+
const recorderState = useUnit(model.recorderModel.$voiceRecordState)
|
|
24
|
+
|
|
25
|
+
const handleDelete = () => {
|
|
26
|
+
if (recorderState === VoiceRecorderState.PAUSED) {
|
|
27
|
+
// if recording is paused, we need to start it again to ensure the recorder is in a consistent state before deletion
|
|
28
|
+
// without .record() browser still will use microphone
|
|
29
|
+
model.recorderModel.recorder.record()
|
|
30
|
+
setTimeout(() => {
|
|
31
|
+
model.stop()
|
|
32
|
+
model.deleteCurrentRecording()
|
|
33
|
+
}, 50)
|
|
34
|
+
closeModal()
|
|
35
|
+
return
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
model.deleteCurrentRecording()
|
|
39
|
+
closeModal()
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (recorderState === VoiceRecorderState.RECORDING) {
|
|
44
|
+
model.recorderModel.recorder.pause()
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return () => {
|
|
48
|
+
if (model.recorderModel.$voiceRecordState.getState() === VoiceRecorderState.PAUSED) {
|
|
49
|
+
try {
|
|
50
|
+
model.recorderModel.recorder.record()
|
|
51
|
+
} catch (error) {
|
|
52
|
+
console.error(`Failed to resume recording: ${error}`)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}, [])
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<BaseModal
|
|
60
|
+
style={{
|
|
61
|
+
container: styles.modalContainer,
|
|
62
|
+
}}
|
|
63
|
+
header={t('voice.deleteRecording')}
|
|
64
|
+
content={t('voice.youWontBeAbleToRecover')}
|
|
65
|
+
footer={
|
|
66
|
+
<ModalFooterButtons
|
|
67
|
+
onCancel={closeModal}
|
|
68
|
+
onConfirm={handleDelete}
|
|
69
|
+
confirmLabel="voice.delete"
|
|
70
|
+
confirmColor={ButtonColor.RED}
|
|
71
|
+
/>
|
|
72
|
+
}
|
|
73
|
+
/>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const styles = StyleSheet.create({
|
|
78
|
+
modalContainer: {
|
|
79
|
+
width: 600,
|
|
80
|
+
height: 268,
|
|
81
|
+
},
|
|
82
|
+
})
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { BaseModal } from '@magmamath/react-native-ui'
|
|
3
|
+
import { StyleSheet } from 'react-native'
|
|
4
|
+
import { useText } from '../../../../shared/translation'
|
|
5
|
+
import { ModalFooterButtons } from './ModalFooterButtons'
|
|
6
|
+
import { VoiceRecordModalParams } from '../../types'
|
|
7
|
+
|
|
8
|
+
type VoiceRecordUndoModalProps = {
|
|
9
|
+
modal: {
|
|
10
|
+
closeModal: () => void
|
|
11
|
+
params: VoiceRecordModalParams
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const VoiceRecordUndoModal = ({
|
|
16
|
+
modal: { closeModal, params },
|
|
17
|
+
}: VoiceRecordUndoModalProps) => {
|
|
18
|
+
const t = useText()
|
|
19
|
+
const { model } = params
|
|
20
|
+
|
|
21
|
+
const redoRecording = () => {
|
|
22
|
+
model.deleteCurrentRecording({ notification: false })
|
|
23
|
+
closeModal()
|
|
24
|
+
model.initializeRecording()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<BaseModal
|
|
29
|
+
style={{
|
|
30
|
+
container: styles.modalStyle,
|
|
31
|
+
}}
|
|
32
|
+
header={t('voice.redoRecording')}
|
|
33
|
+
content={t('voice.thisWillRemoveRecording')}
|
|
34
|
+
footer={
|
|
35
|
+
<ModalFooterButtons
|
|
36
|
+
onCancel={closeModal}
|
|
37
|
+
onConfirm={redoRecording}
|
|
38
|
+
confirmLabel="voice.redo"
|
|
39
|
+
/>
|
|
40
|
+
}
|
|
41
|
+
/>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const styles = StyleSheet.create({
|
|
46
|
+
modalStyle: {
|
|
47
|
+
width: 600,
|
|
48
|
+
height: 268,
|
|
49
|
+
},
|
|
50
|
+
})
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { createEffect, createEvent, restore } from 'effector'
|
|
2
|
+
import { AudioRecorder, setAudioModeAsync } from 'expo-audio'
|
|
3
|
+
import { VoiceRecorderState } from '../../constants'
|
|
4
|
+
import { AvailableAudioInputs } from '../../types'
|
|
5
|
+
|
|
6
|
+
const AUDIO_MODE_CONFIG = {
|
|
7
|
+
playsInSilentMode: true,
|
|
8
|
+
allowsRecording: true,
|
|
9
|
+
} as const
|
|
10
|
+
|
|
11
|
+
type StopResolver<T> = (result: T) => void
|
|
12
|
+
|
|
13
|
+
export class RecorderModel<T = unknown> {
|
|
14
|
+
public recorder!: AudioRecorder
|
|
15
|
+
private stopResolver: StopResolver<T> | null = null
|
|
16
|
+
|
|
17
|
+
public readonly reset = createEvent()
|
|
18
|
+
public readonly setVoiceRecordState = createEvent<VoiceRecorderState>()
|
|
19
|
+
public readonly setAvailableInputs = createEvent<AvailableAudioInputs>()
|
|
20
|
+
public readonly setLastKnownDurationMs = createEvent<number>()
|
|
21
|
+
|
|
22
|
+
public readonly $voiceRecordState = restore(
|
|
23
|
+
this.setVoiceRecordState,
|
|
24
|
+
VoiceRecorderState.IDLE,
|
|
25
|
+
).reset(this.reset)
|
|
26
|
+
public readonly $availableInputs = restore(this.setAvailableInputs, [])
|
|
27
|
+
public readonly $lastKnownDurationMs = restore(this.setLastKnownDurationMs, 0).reset(this.reset)
|
|
28
|
+
|
|
29
|
+
public readonly start = createEffect(async () => {
|
|
30
|
+
try {
|
|
31
|
+
await setAudioModeAsync(AUDIO_MODE_CONFIG)
|
|
32
|
+
await this.recorder.prepareToRecordAsync()
|
|
33
|
+
this.recorder.record()
|
|
34
|
+
this.setVoiceRecordState(VoiceRecorderState.RECORDING)
|
|
35
|
+
} catch (error) {
|
|
36
|
+
console.error('Error starting recording:', error)
|
|
37
|
+
throw error
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
public readonly stop = createEffect(() => {
|
|
42
|
+
if (!this.recorder.getStatus().isRecording) return
|
|
43
|
+
return this.recorder.stop()
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
public stopAndAwaitResult(): Promise<T> {
|
|
47
|
+
return new Promise((resolve) => {
|
|
48
|
+
this.stopResolver = resolve
|
|
49
|
+
this.recorder.getStatus().isRecording && this.recorder.stop()
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public resolveRecord(result: T): void {
|
|
54
|
+
if (this.stopResolver) {
|
|
55
|
+
this.stopResolver(result)
|
|
56
|
+
this.stopResolver = null
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public clearStopResolver(): void {
|
|
61
|
+
this.stopResolver = null
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createEffect } from 'effector'
|
|
2
|
+
import { VoiceRecordCollectionItem, VoiceRecorderApi } from '../../types'
|
|
3
|
+
import { generateAudioFormData, uploadAudioFileRequestGenerator } from '../../helpers'
|
|
4
|
+
|
|
5
|
+
type UploadParams = {
|
|
6
|
+
uri: string
|
|
7
|
+
fileName: string
|
|
8
|
+
durationMs: number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type UploadResult = {
|
|
12
|
+
collectionItem: VoiceRecordCollectionItem
|
|
13
|
+
uploadPromise: Promise<any>
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class UploaderModel {
|
|
17
|
+
private api!: VoiceRecorderApi
|
|
18
|
+
|
|
19
|
+
public readonly setApi = (api: VoiceRecorderApi) => {
|
|
20
|
+
this.api = api
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public readonly upload = createEffect(
|
|
24
|
+
async ({ uri, fileName, durationMs }: UploadParams): Promise<UploadResult> => {
|
|
25
|
+
const formData = await generateAudioFormData({
|
|
26
|
+
audioFileUri: uri,
|
|
27
|
+
durationMs,
|
|
28
|
+
fileName,
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const { uploadAudio, controller } = uploadAudioFileRequestGenerator(formData, this.api)
|
|
32
|
+
const uploadPromise = uploadAudio()
|
|
33
|
+
|
|
34
|
+
const collectionItem: VoiceRecordCollectionItem = {
|
|
35
|
+
durationMs,
|
|
36
|
+
audioUploadPromise: uploadPromise,
|
|
37
|
+
controller,
|
|
38
|
+
uri,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return { collectionItem, uploadPromise }
|
|
42
|
+
},
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
public readonly abortUpload = (controller?: AbortController) => {
|
|
46
|
+
controller?.abort()
|
|
47
|
+
}
|
|
48
|
+
}
|