@magmamath/students-features 0.10.0 → 0.11.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/features/celebrations/helpers.js +4 -1
- package/dist/commonjs/features/celebrations/helpers.js.map +1 -1
- package/dist/commonjs/features/chatbot/TTS_HIGHLIGHTING.md +120 -0
- package/dist/commonjs/features/chatbot/components/Chat/Chat.js +229 -45
- package/dist/commonjs/features/chatbot/components/Chat/Chat.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/Chat/CloseButton.js +39 -0
- package/dist/commonjs/features/chatbot/components/Chat/CloseButton.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/Chat/GradientFade.js +44 -0
- package/dist/commonjs/features/chatbot/components/Chat/GradientFade.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js +46 -54
- 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/ChatMessage/AnimatedMessage.js +41 -0
- package/dist/commonjs/features/chatbot/components/ChatMessage/AnimatedMessage.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/ChatMessage/ChatMessage.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageContent.js +16 -4
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageContent.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js +14 -34
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js +20 -15
- 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 +30 -7
- package/dist/commonjs/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/commonjs/features/chatbot/constants.js +2 -1
- package/dist/commonjs/features/chatbot/constants.js.map +1 -1
- package/dist/commonjs/features/chatbot/helpers/ttsHighlight.js +29 -0
- package/dist/commonjs/features/chatbot/helpers/ttsHighlight.js.map +1 -0
- package/dist/commonjs/features/chatbot/helpers.js +19 -2
- 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 +65 -17
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js +2 -2
- package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatBoxTextManager.js +2 -1
- package/dist/commonjs/features/chatbot/model/ChatBoxTextManager.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatTTSHighlightModel.js +56 -0
- package/dist/commonjs/features/chatbot/model/ChatTTSHighlightModel.js.map +1 -0
- package/dist/commonjs/features/chatbot/model/ChatTTSModel.js +154 -0
- package/dist/commonjs/features/chatbot/model/ChatTTSModel.js.map +1 -0
- 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 +9 -0
- 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/chatbot/types/t2s.types.js.map +1 -1
- package/dist/commonjs/features/feedback/model/model.js.map +1 -1
- package/dist/commonjs/features/feedback/model/sockets.js +8 -5
- package/dist/commonjs/features/feedback/model/sockets.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/AlgebraLayout/AlgebraLayout.js +2 -2
- package/dist/commonjs/features/keyboard/components/AlgebraLayout/AlgebraLayout.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/BasicLayout/BasicLayout.js +2 -2
- package/dist/commonjs/features/keyboard/components/BasicLayout/BasicLayout.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/BasicPlusLayout/keyboardGroups.js +4 -4
- package/dist/commonjs/features/keyboard/components/BasicPlusLayout/keyboardGroups.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/BasicPlusPlusLayout/BasicPlusPlusLayout.js +2 -2
- package/dist/commonjs/features/keyboard/components/BasicPlusPlusLayout/BasicPlusPlusLayout.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/BasicPlusPlusLayout/keyboardGroups.js +4 -4
- package/dist/commonjs/features/keyboard/components/BasicPlusPlusLayout/keyboardGroups.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/Keyboard.js +4 -2
- package/dist/commonjs/features/keyboard/components/Keyboard.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/MainLayout/MainLayout.js +1 -6
- package/dist/commonjs/features/keyboard/components/MainLayout/MainLayout.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/UnitsLayout/UnitTabs.js +1 -1
- package/dist/commonjs/features/keyboard/components/UnitsLayout/helpers.js +3 -1
- package/dist/commonjs/features/keyboard/components/UnitsLayout/helpers.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/UnitsLayout/hooks/useUnitTabs.js +27 -6
- package/dist/commonjs/features/keyboard/components/UnitsLayout/hooks/useUnitTabs.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/UnitsLayout/keyboardGroups.js +9 -1
- package/dist/commonjs/features/keyboard/components/UnitsLayout/keyboardGroups.js.map +1 -1
- package/dist/commonjs/features/keyboard/components/UnitsLayout/types.js +1 -0
- package/dist/commonjs/features/keyboard/components/UnitsLayout/types.js.map +1 -1
- package/dist/commonjs/features/keyboard/constants/constants.js +1 -1
- package/dist/commonjs/features/keyboard/constants/keyboardGroupsByLocale.js +2 -1
- package/dist/commonjs/features/keyboard/constants/keyboardGroupsByLocale.js.map +1 -1
- package/dist/commonjs/features/keyboard/constants/keyboardLayouts.js +20 -4
- package/dist/commonjs/features/keyboard/constants/keyboardLayouts.js.map +1 -1
- package/dist/commonjs/features/keyboard/helpers.js +7 -0
- package/dist/commonjs/features/keyboard/helpers.js.map +1 -1
- package/dist/commonjs/features/keyboard/types/MathKeysGroups/basicOperators.js +20 -3
- package/dist/commonjs/features/keyboard/types/MathKeysGroups/basicOperators.js.map +1 -1
- package/dist/commonjs/features/keyboard/types/MathKeysGroups/units.js +6 -3
- package/dist/commonjs/features/keyboard/types/MathKeysGroups/units.js.map +1 -1
- package/dist/commonjs/features/openEnded/components/OpenEndedAttemptsLimit.js +34 -0
- package/dist/commonjs/features/openEnded/components/OpenEndedAttemptsLimit.js.map +1 -0
- package/dist/commonjs/features/openEnded/components/OpenEndedScoreLabel.js +77 -0
- package/dist/commonjs/features/openEnded/components/OpenEndedScoreLabel.js.map +1 -0
- package/dist/commonjs/features/openEnded/index.js +48 -0
- package/dist/commonjs/features/openEnded/index.js.map +1 -0
- package/dist/commonjs/features/openEnded/oe.helpers.js +26 -0
- package/dist/commonjs/features/openEnded/oe.helpers.js.map +1 -0
- package/dist/commonjs/features/openEnded/oe.types.js +14 -0
- package/dist/commonjs/features/openEnded/oe.types.js.map +1 -0
- package/dist/commonjs/index.js +13 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/lib/components/ConditionalWrapper.js +23 -0
- package/dist/commonjs/lib/components/ConditionalWrapper.js.map +1 -0
- package/dist/commonjs/shared/common.constants.js +9 -0
- package/dist/commonjs/shared/common.constants.js.map +1 -0
- package/dist/commonjs/shared/icons/TimeIcon.js +37 -0
- package/dist/commonjs/shared/icons/TimeIcon.js.map +1 -0
- package/dist/commonjs/shared/icons/keyboard/CDotIcon/CDotIcon.js +4 -4
- package/dist/commonjs/shared/icons/keyboard/CDotIcon/CDotIcon.js.map +1 -1
- package/dist/commonjs/shared/icons/keyboard/RoundBracketLeftIcon/RoundBracketLeftIcon.js +32 -0
- package/dist/commonjs/shared/icons/keyboard/RoundBracketLeftIcon/RoundBracketLeftIcon.js.map +1 -0
- package/dist/commonjs/shared/icons/keyboard/RoundBracketRightIcon/RoundBracketRightIcon.js +32 -0
- package/dist/commonjs/shared/icons/keyboard/RoundBracketRightIcon/RoundBracketRightIcon.js.map +1 -0
- package/dist/commonjs/shared/translation/localization/ca.json +4 -2
- package/dist/commonjs/shared/translation/localization/de.json +4 -2
- package/dist/commonjs/shared/translation/localization/en.json +4 -2
- package/dist/commonjs/shared/translation/localization/gb.json +4 -2
- package/dist/commonjs/shared/translation/localization/sct.json +4 -2
- package/dist/commonjs/shared/translation/localization/sw.json +4 -2
- package/dist/commonjs/types/common.types.js +4 -0
- package/dist/module/features/celebrations/helpers.js +4 -1
- package/dist/module/features/celebrations/helpers.js.map +1 -1
- package/dist/module/features/chatbot/TTS_HIGHLIGHTING.md +120 -0
- package/dist/module/features/chatbot/components/Chat/Chat.js +231 -47
- package/dist/module/features/chatbot/components/Chat/Chat.js.map +1 -1
- package/dist/module/features/chatbot/components/Chat/CloseButton.js +33 -0
- package/dist/module/features/chatbot/components/Chat/CloseButton.js.map +1 -0
- package/dist/module/features/chatbot/components/Chat/GradientFade.js +39 -0
- package/dist/module/features/chatbot/components/Chat/GradientFade.js.map +1 -0
- package/dist/module/features/chatbot/components/ChatControls/ChatControls.js +46 -55
- 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/ChatMessage/AnimatedMessage.js +34 -0
- package/dist/module/features/chatbot/components/ChatMessage/AnimatedMessage.js.map +1 -0
- package/dist/module/features/chatbot/components/ChatMessage/ChatMessage.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/MessageContent.js +16 -4
- package/dist/module/features/chatbot/components/ChatMessage/MessageContent.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js +17 -36
- package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js +19 -14
- 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 +28 -6
- package/dist/module/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/module/features/chatbot/constants.js +1 -0
- package/dist/module/features/chatbot/constants.js.map +1 -1
- package/dist/module/features/chatbot/helpers/ttsHighlight.js +23 -0
- package/dist/module/features/chatbot/helpers/ttsHighlight.js.map +1 -0
- package/dist/module/features/chatbot/helpers.js +19 -2
- 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 +65 -17
- package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatBotThreadManager.js +2 -2
- package/dist/module/features/chatbot/model/ChatBotThreadManager.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatBoxTextManager.js +2 -1
- package/dist/module/features/chatbot/model/ChatBoxTextManager.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatTTSHighlightModel.js +52 -0
- package/dist/module/features/chatbot/model/ChatTTSHighlightModel.js.map +1 -0
- package/dist/module/features/chatbot/model/ChatTTSModel.js +149 -0
- package/dist/module/features/chatbot/model/ChatTTSModel.js.map +1 -0
- 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 +9 -0
- 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/chatbot/types/t2s.types.js.map +1 -1
- package/dist/module/features/feedback/model/model.js.map +1 -1
- package/dist/module/features/feedback/model/sockets.js +8 -5
- package/dist/module/features/feedback/model/sockets.js.map +1 -1
- package/dist/module/features/keyboard/components/AlgebraLayout/AlgebraLayout.js +3 -3
- package/dist/module/features/keyboard/components/AlgebraLayout/AlgebraLayout.js.map +1 -1
- package/dist/module/features/keyboard/components/BasicLayout/BasicLayout.js +2 -2
- package/dist/module/features/keyboard/components/BasicLayout/BasicLayout.js.map +1 -1
- package/dist/module/features/keyboard/components/BasicPlusLayout/keyboardGroups.js +4 -4
- package/dist/module/features/keyboard/components/BasicPlusLayout/keyboardGroups.js.map +1 -1
- package/dist/module/features/keyboard/components/BasicPlusPlusLayout/BasicPlusPlusLayout.js +2 -2
- package/dist/module/features/keyboard/components/BasicPlusPlusLayout/BasicPlusPlusLayout.js.map +1 -1
- package/dist/module/features/keyboard/components/BasicPlusPlusLayout/keyboardGroups.js +4 -4
- package/dist/module/features/keyboard/components/BasicPlusPlusLayout/keyboardGroups.js.map +1 -1
- package/dist/module/features/keyboard/components/Keyboard.js +4 -2
- package/dist/module/features/keyboard/components/Keyboard.js.map +1 -1
- package/dist/module/features/keyboard/components/KeysList/KeysList.js.map +1 -1
- package/dist/module/features/keyboard/components/MainLayout/MainLayout.js +2 -7
- package/dist/module/features/keyboard/components/MainLayout/MainLayout.js.map +1 -1
- package/dist/module/features/keyboard/components/UnitsLayout/UnitTabs.js +1 -1
- package/dist/module/features/keyboard/components/UnitsLayout/helpers.js +2 -1
- package/dist/module/features/keyboard/components/UnitsLayout/helpers.js.map +1 -1
- package/dist/module/features/keyboard/components/UnitsLayout/hooks/useUnitTabs.js +27 -6
- package/dist/module/features/keyboard/components/UnitsLayout/hooks/useUnitTabs.js.map +1 -1
- package/dist/module/features/keyboard/components/UnitsLayout/keyboardGroups.js +9 -1
- package/dist/module/features/keyboard/components/UnitsLayout/keyboardGroups.js.map +1 -1
- package/dist/module/features/keyboard/components/UnitsLayout/types.js +1 -0
- package/dist/module/features/keyboard/components/UnitsLayout/types.js.map +1 -1
- package/dist/module/features/keyboard/constants/constants.js +1 -1
- package/dist/module/features/keyboard/constants/keyboardGroupsByLocale.js +3 -2
- package/dist/module/features/keyboard/constants/keyboardGroupsByLocale.js.map +1 -1
- package/dist/module/features/keyboard/constants/keyboardLayouts.js +19 -4
- package/dist/module/features/keyboard/constants/keyboardLayouts.js.map +1 -1
- package/dist/module/features/keyboard/helpers.js +5 -0
- package/dist/module/features/keyboard/helpers.js.map +1 -1
- package/dist/module/features/keyboard/types/MathKeysGroups/basicOperators.js +20 -3
- package/dist/module/features/keyboard/types/MathKeysGroups/basicOperators.js.map +1 -1
- package/dist/module/features/keyboard/types/MathKeysGroups/units.js +6 -3
- package/dist/module/features/keyboard/types/MathKeysGroups/units.js.map +1 -1
- package/dist/module/features/openEnded/components/OpenEndedAttemptsLimit.js +28 -0
- package/dist/module/features/openEnded/components/OpenEndedAttemptsLimit.js.map +1 -0
- package/dist/module/features/openEnded/components/OpenEndedScoreLabel.js +71 -0
- package/dist/module/features/openEnded/components/OpenEndedScoreLabel.js.map +1 -0
- package/dist/module/features/openEnded/index.js +7 -0
- package/dist/module/features/openEnded/index.js.map +1 -0
- package/dist/module/features/openEnded/oe.helpers.js +21 -0
- package/dist/module/features/openEnded/oe.helpers.js.map +1 -0
- package/dist/module/features/openEnded/oe.types.js +10 -0
- package/dist/module/features/openEnded/oe.types.js.map +1 -0
- package/dist/module/index.js +1 -0
- package/dist/module/index.js.map +1 -1
- package/dist/module/lib/components/ConditionalWrapper.js +17 -0
- package/dist/module/lib/components/ConditionalWrapper.js.map +1 -0
- package/dist/module/shared/common.constants.js +5 -0
- package/dist/module/shared/common.constants.js.map +1 -0
- package/dist/module/shared/icons/TimeIcon.js +29 -0
- package/dist/module/shared/icons/TimeIcon.js.map +1 -0
- package/dist/module/shared/icons/keyboard/CDotIcon/CDotIcon.js +4 -4
- package/dist/module/shared/icons/keyboard/CDotIcon/CDotIcon.js.map +1 -1
- package/dist/module/shared/icons/keyboard/RoundBracketLeftIcon/RoundBracketLeftIcon.js +24 -0
- package/dist/module/shared/icons/keyboard/RoundBracketLeftIcon/RoundBracketLeftIcon.js.map +1 -0
- package/dist/module/shared/icons/keyboard/RoundBracketRightIcon/RoundBracketRightIcon.js +24 -0
- package/dist/module/shared/icons/keyboard/RoundBracketRightIcon/RoundBracketRightIcon.js.map +1 -0
- package/dist/module/shared/translation/localization/ca.json +4 -2
- package/dist/module/shared/translation/localization/de.json +4 -2
- package/dist/module/shared/translation/localization/en.json +4 -2
- package/dist/module/shared/translation/localization/gb.json +4 -2
- package/dist/module/shared/translation/localization/sct.json +4 -2
- package/dist/module/shared/translation/localization/sw.json +4 -2
- package/dist/module/types/common.types.js +2 -0
- package/dist/typescript/commonjs/features/celebrations/helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chat/Chat.d.ts +7 -2
- package/dist/typescript/commonjs/features/chatbot/components/Chat/Chat.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chat/CloseButton.d.ts +7 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chat/CloseButton.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chat/GradientFade.d.ts +10 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chat/GradientFade.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatControls/ChatControls.d.ts +3 -2
- 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/ChatMessage/AnimatedMessage.d.ts +7 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/AnimatedMessage.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ChatMessage.d.ts +4 -2
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ChatMessage.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageContent.d.ts +4 -2
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageContent.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageLoader.d.ts +2 -3
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageLoader.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts +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 +5 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/constants.d.ts +1 -0
- package/dist/typescript/commonjs/features/chatbot/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/helpers/ttsHighlight.d.ts +8 -0
- package/dist/typescript/commonjs/features/chatbot/helpers/ttsHighlight.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/index.d.ts +3 -2
- package/dist/typescript/commonjs/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts +6 -3
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts +4 -3
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.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/ChatTTSHighlightModel.d.ts +25 -0
- package/dist/typescript/commonjs/features/chatbot/model/ChatTTSHighlightModel.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/model/ChatTTSModel.d.ts +38 -0
- package/dist/typescript/commonjs/features/chatbot/model/ChatTTSModel.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/model/ChatsCacheModel.d.ts +1 -0
- package/dist/typescript/commonjs/features/chatbot/model/ChatsCacheModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts +28 -16
- 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 +15 -11
- package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/t2s.types.d.ts +25 -0
- package/dist/typescript/commonjs/features/chatbot/types/t2s.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts +1 -0
- package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/feedback/model/model.d.ts +4 -1
- package/dist/typescript/commonjs/features/feedback/model/model.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/feedback/model/sockets.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/AlgebraLayout/AlgebraLayout.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/BasicPlusLayout/keyboardGroups.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/BasicPlusPlusLayout/BasicPlusPlusLayout.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/BasicPlusPlusLayout/keyboardGroups.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/Keyboard.d.ts +2 -1
- package/dist/typescript/commonjs/features/keyboard/components/Keyboard.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/MainLayout/MainLayout.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/UnitsLayout/helpers.d.ts +1 -0
- package/dist/typescript/commonjs/features/keyboard/components/UnitsLayout/helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/UnitsLayout/hooks/useUnitTabs.d.ts +4 -7
- package/dist/typescript/commonjs/features/keyboard/components/UnitsLayout/hooks/useUnitTabs.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/UnitsLayout/keyboardGroups.d.ts +1 -0
- package/dist/typescript/commonjs/features/keyboard/components/UnitsLayout/keyboardGroups.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/components/UnitsLayout/types.d.ts +7 -1
- package/dist/typescript/commonjs/features/keyboard/components/UnitsLayout/types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/constants/constants.d.ts +1 -1
- package/dist/typescript/commonjs/features/keyboard/constants/keyboardGroupsByLocale.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/constants/keyboardLayouts.d.ts +4 -0
- package/dist/typescript/commonjs/features/keyboard/constants/keyboardLayouts.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/helpers.d.ts +1 -0
- package/dist/typescript/commonjs/features/keyboard/helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/types/MathKeysGroups/basicOperators.d.ts +10 -0
- package/dist/typescript/commonjs/features/keyboard/types/MathKeysGroups/basicOperators.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/keyboard/types/MathKeysGroups/units.d.ts +36 -0
- package/dist/typescript/commonjs/features/keyboard/types/MathKeysGroups/units.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/openEnded/components/OpenEndedAttemptsLimit.d.ts +7 -0
- package/dist/typescript/commonjs/features/openEnded/components/OpenEndedAttemptsLimit.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/openEnded/components/OpenEndedScoreLabel.d.ts +12 -0
- package/dist/typescript/commonjs/features/openEnded/components/OpenEndedScoreLabel.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/openEnded/index.d.ts +5 -0
- package/dist/typescript/commonjs/features/openEnded/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/openEnded/oe.helpers.d.ts +13 -0
- package/dist/typescript/commonjs/features/openEnded/oe.helpers.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/openEnded/oe.types.d.ts +7 -0
- package/dist/typescript/commonjs/features/openEnded/oe.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/lib/components/ConditionalWrapper.d.ts +9 -0
- package/dist/typescript/commonjs/lib/components/ConditionalWrapper.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/effector/createControllerEffect.d.ts +1 -1
- package/dist/typescript/commonjs/lib/effector/createControllerEffect.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/common.constants.d.ts +2 -0
- package/dist/typescript/commonjs/shared/common.constants.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/TimeIcon.d.ts +4 -0
- package/dist/typescript/commonjs/shared/icons/TimeIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/keyboard/RoundBracketLeftIcon/RoundBracketLeftIcon.d.ts +4 -0
- package/dist/typescript/commonjs/shared/icons/keyboard/RoundBracketLeftIcon/RoundBracketLeftIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/keyboard/RoundBracketRightIcon/RoundBracketRightIcon.d.ts +4 -0
- package/dist/typescript/commonjs/shared/icons/keyboard/RoundBracketRightIcon/RoundBracketRightIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/translation/constants.d.ts +12 -0
- package/dist/typescript/commonjs/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/model.d.ts +4 -0
- package/dist/typescript/commonjs/shared/translation/model.d.ts.map +1 -1
- package/dist/typescript/commonjs/types/common.types.d.ts +2 -0
- package/dist/typescript/commonjs/types/common.types.d.ts.map +1 -1
- package/dist/typescript/module/features/celebrations/helpers.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/Chat/Chat.d.ts +7 -2
- package/dist/typescript/module/features/chatbot/components/Chat/Chat.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/Chat/CloseButton.d.ts +7 -0
- package/dist/typescript/module/features/chatbot/components/Chat/CloseButton.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/Chat/GradientFade.d.ts +10 -0
- package/dist/typescript/module/features/chatbot/components/Chat/GradientFade.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/ChatControls/ChatControls.d.ts +3 -2
- 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/ChatMessage/AnimatedMessage.d.ts +7 -0
- package/dist/typescript/module/features/chatbot/components/ChatMessage/AnimatedMessage.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/ChatMessage/ChatMessage.d.ts +4 -2
- package/dist/typescript/module/features/chatbot/components/ChatMessage/ChatMessage.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageContent.d.ts +4 -2
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageContent.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageLoader.d.ts +2 -3
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageLoader.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts +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 +5 -1
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/constants.d.ts +1 -0
- package/dist/typescript/module/features/chatbot/constants.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/helpers/ttsHighlight.d.ts +8 -0
- package/dist/typescript/module/features/chatbot/helpers/ttsHighlight.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/helpers.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/index.d.ts +3 -2
- package/dist/typescript/module/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts +6 -3
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts +4 -3
- package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.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/ChatTTSHighlightModel.d.ts +25 -0
- package/dist/typescript/module/features/chatbot/model/ChatTTSHighlightModel.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/model/ChatTTSModel.d.ts +38 -0
- package/dist/typescript/module/features/chatbot/model/ChatTTSModel.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/model/ChatsCacheModel.d.ts +1 -0
- package/dist/typescript/module/features/chatbot/model/ChatsCacheModel.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/api.types.d.ts +28 -16
- 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 +15 -11
- package/dist/typescript/module/features/chatbot/types/model.types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/t2s.types.d.ts +25 -0
- package/dist/typescript/module/features/chatbot/types/t2s.types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/units.types.d.ts +1 -0
- package/dist/typescript/module/features/chatbot/types/units.types.d.ts.map +1 -1
- package/dist/typescript/module/features/feedback/model/model.d.ts +4 -1
- package/dist/typescript/module/features/feedback/model/model.d.ts.map +1 -1
- package/dist/typescript/module/features/feedback/model/sockets.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/AlgebraLayout/AlgebraLayout.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/BasicPlusLayout/keyboardGroups.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/BasicPlusPlusLayout/BasicPlusPlusLayout.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/BasicPlusPlusLayout/keyboardGroups.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/Keyboard.d.ts +2 -1
- package/dist/typescript/module/features/keyboard/components/Keyboard.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/MainLayout/MainLayout.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/UnitsLayout/helpers.d.ts +1 -0
- package/dist/typescript/module/features/keyboard/components/UnitsLayout/helpers.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/UnitsLayout/hooks/useUnitTabs.d.ts +4 -7
- package/dist/typescript/module/features/keyboard/components/UnitsLayout/hooks/useUnitTabs.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/UnitsLayout/keyboardGroups.d.ts +1 -0
- package/dist/typescript/module/features/keyboard/components/UnitsLayout/keyboardGroups.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/components/UnitsLayout/types.d.ts +7 -1
- package/dist/typescript/module/features/keyboard/components/UnitsLayout/types.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/constants/constants.d.ts +1 -1
- package/dist/typescript/module/features/keyboard/constants/keyboardGroupsByLocale.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/constants/keyboardLayouts.d.ts +4 -0
- package/dist/typescript/module/features/keyboard/constants/keyboardLayouts.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/helpers.d.ts +1 -0
- package/dist/typescript/module/features/keyboard/helpers.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/types/MathKeysGroups/basicOperators.d.ts +10 -0
- package/dist/typescript/module/features/keyboard/types/MathKeysGroups/basicOperators.d.ts.map +1 -1
- package/dist/typescript/module/features/keyboard/types/MathKeysGroups/units.d.ts +36 -0
- package/dist/typescript/module/features/keyboard/types/MathKeysGroups/units.d.ts.map +1 -1
- package/dist/typescript/module/features/openEnded/components/OpenEndedAttemptsLimit.d.ts +7 -0
- package/dist/typescript/module/features/openEnded/components/OpenEndedAttemptsLimit.d.ts.map +1 -0
- package/dist/typescript/module/features/openEnded/components/OpenEndedScoreLabel.d.ts +12 -0
- package/dist/typescript/module/features/openEnded/components/OpenEndedScoreLabel.d.ts.map +1 -0
- package/dist/typescript/module/features/openEnded/index.d.ts +5 -0
- package/dist/typescript/module/features/openEnded/index.d.ts.map +1 -0
- package/dist/typescript/module/features/openEnded/oe.helpers.d.ts +13 -0
- package/dist/typescript/module/features/openEnded/oe.helpers.d.ts.map +1 -0
- package/dist/typescript/module/features/openEnded/oe.types.d.ts +7 -0
- package/dist/typescript/module/features/openEnded/oe.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/lib/components/ConditionalWrapper.d.ts +9 -0
- package/dist/typescript/module/lib/components/ConditionalWrapper.d.ts.map +1 -0
- package/dist/typescript/module/lib/effector/createControllerEffect.d.ts +1 -1
- package/dist/typescript/module/lib/effector/createControllerEffect.d.ts.map +1 -1
- package/dist/typescript/module/shared/common.constants.d.ts +2 -0
- package/dist/typescript/module/shared/common.constants.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/TimeIcon.d.ts +4 -0
- package/dist/typescript/module/shared/icons/TimeIcon.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/keyboard/RoundBracketLeftIcon/RoundBracketLeftIcon.d.ts +4 -0
- package/dist/typescript/module/shared/icons/keyboard/RoundBracketLeftIcon/RoundBracketLeftIcon.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/keyboard/RoundBracketRightIcon/RoundBracketRightIcon.d.ts +4 -0
- package/dist/typescript/module/shared/icons/keyboard/RoundBracketRightIcon/RoundBracketRightIcon.d.ts.map +1 -0
- package/dist/typescript/module/shared/translation/constants.d.ts +12 -0
- package/dist/typescript/module/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/model.d.ts +4 -0
- package/dist/typescript/module/shared/translation/model.d.ts.map +1 -1
- package/dist/typescript/module/types/common.types.d.ts +2 -0
- package/dist/typescript/module/types/common.types.d.ts.map +1 -1
- package/package.json +3 -1
- package/src/features/celebrations/helpers.ts +35 -33
- package/src/features/chatbot/TTS_HIGHLIGHTING.md +120 -0
- package/src/features/chatbot/components/Chat/Chat.tsx +301 -57
- package/src/features/chatbot/components/Chat/CloseButton.tsx +31 -0
- package/src/features/chatbot/components/Chat/GradientFade.tsx +43 -0
- package/src/features/chatbot/components/ChatControls/ChatControls.tsx +47 -60
- package/src/features/chatbot/components/ChatInput/ChatInput.tsx +2 -1
- 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/ChatMessage/AnimatedMessage.tsx +30 -0
- package/src/features/chatbot/components/ChatMessage/ChatMessage.tsx +4 -2
- package/src/features/chatbot/components/ChatMessage/MessageContent.tsx +25 -3
- package/src/features/chatbot/components/ChatMessage/MessageLoader.tsx +17 -33
- package/src/features/chatbot/components/ChatMessage/ReceivedMessage.tsx +17 -12
- package/src/features/chatbot/components/ChatMessage/SentMessage.tsx +1 -1
- package/src/features/chatbot/components/Chatbot.tsx +30 -3
- package/src/features/chatbot/constants.ts +2 -0
- package/src/features/chatbot/helpers/ttsHighlight.ts +25 -0
- package/src/features/chatbot/helpers.ts +14 -1
- package/src/features/chatbot/index.ts +17 -2
- package/src/features/chatbot/model/ChatBotModel.ts +74 -16
- package/src/features/chatbot/model/ChatBotThreadManager.ts +12 -4
- package/src/features/chatbot/model/ChatBoxTextManager.ts +1 -0
- package/src/features/chatbot/model/ChatTTSHighlightModel.ts +64 -0
- package/src/features/chatbot/model/ChatTTSModel.ts +168 -0
- 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 +11 -0
- package/src/features/chatbot/types/api.types.ts +25 -19
- package/src/features/chatbot/types/model.types.ts +24 -12
- package/src/features/chatbot/types/t2s.types.ts +33 -0
- package/src/features/chatbot/types/units.types.ts +1 -0
- package/src/features/feedback/model/model.ts +4 -1
- package/src/features/feedback/model/sockets.ts +8 -6
- package/src/features/keyboard/components/AlgebraLayout/AlgebraLayout.tsx +4 -3
- package/src/features/keyboard/components/BasicLayout/BasicLayout.tsx +2 -2
- package/src/features/keyboard/components/BasicPlusLayout/keyboardGroups.ts +27 -17
- package/src/features/keyboard/components/BasicPlusPlusLayout/BasicPlusPlusLayout.tsx +3 -2
- package/src/features/keyboard/components/BasicPlusPlusLayout/keyboardGroups.ts +30 -24
- package/src/features/keyboard/components/Keyboard.tsx +14 -4
- package/src/features/keyboard/components/KeysList/KeysList.tsx +1 -1
- package/src/features/keyboard/components/MainLayout/MainLayout.tsx +2 -6
- package/src/features/keyboard/components/UnitsLayout/UnitTabs.tsx +1 -1
- package/src/features/keyboard/components/UnitsLayout/helpers.tsx +3 -0
- package/src/features/keyboard/components/UnitsLayout/hooks/useUnitTabs.ts +36 -22
- package/src/features/keyboard/components/UnitsLayout/keyboardGroups.ts +11 -0
- package/src/features/keyboard/components/UnitsLayout/types.ts +7 -0
- package/src/features/keyboard/constants/constants.ts +1 -1
- package/src/features/keyboard/constants/keyboardGroupsByLocale.ts +2 -0
- package/src/features/keyboard/constants/keyboardLayouts.ts +18 -1
- package/src/features/keyboard/helpers.ts +6 -0
- package/src/features/keyboard/types/MathKeysGroups/basicOperators.tsx +15 -3
- package/src/features/keyboard/types/MathKeysGroups/units.tsx +3 -0
- package/src/features/openEnded/components/OpenEndedAttemptsLimit.tsx +26 -0
- package/src/features/openEnded/components/OpenEndedScoreLabel.tsx +81 -0
- package/src/features/openEnded/index.ts +4 -0
- package/src/features/openEnded/oe.helpers.ts +31 -0
- package/src/features/openEnded/oe.types.ts +6 -0
- package/src/index.ts +1 -0
- package/src/lib/components/ConditionalWrapper.tsx +15 -0
- package/src/lib/effector/createControllerEffect.ts +1 -1
- package/src/shared/common.constants.ts +3 -0
- package/src/shared/icons/TimeIcon.tsx +23 -0
- package/src/shared/icons/keyboard/CDotIcon/CDotIcon.tsx +2 -2
- package/src/shared/icons/keyboard/RoundBracketLeftIcon/RoundBracketLeftIcon.tsx +18 -0
- package/src/shared/icons/keyboard/RoundBracketRightIcon/RoundBracketRightIcon.tsx +18 -0
- package/src/shared/translation/localization/ca.json +4 -2
- package/src/shared/translation/localization/de.json +4 -2
- package/src/shared/translation/localization/en.json +4 -2
- package/src/shared/translation/localization/gb.json +4 -2
- package/src/shared/translation/localization/sct.json +4 -2
- package/src/shared/translation/localization/sw.json +4 -2
- package/src/types/common.types.ts +4 -0
- package/dist/commonjs/features/chatbot/model/t2s.js +0 -107
- package/dist/commonjs/features/chatbot/model/t2s.js.map +0 -1
- package/dist/module/features/chatbot/model/t2s.js +0 -102
- package/dist/module/features/chatbot/model/t2s.js.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/model/t2s.d.ts +0 -34
- package/dist/typescript/commonjs/features/chatbot/model/t2s.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/model/t2s.d.ts +0 -34
- package/dist/typescript/module/features/chatbot/model/t2s.d.ts.map +0 -1
- package/src/features/chatbot/model/t2s.ts +0 -123
|
@@ -1,39 +1,41 @@
|
|
|
1
|
-
import { ParticlesBatch } from './components/ParticleBatch'
|
|
2
|
-
import { Spark } from './components/Spark'
|
|
3
|
-
import { CELEBRATION_ICON_CONFIG, CELEBRATION_VARIANTS } from './config'
|
|
4
|
-
import { CelebrationVariant } from './types'
|
|
1
|
+
import { ParticlesBatch } from './components/ParticleBatch'
|
|
2
|
+
import { Spark } from './components/Spark'
|
|
3
|
+
import { CELEBRATION_ICON_CONFIG, CELEBRATION_VARIANTS } from './config'
|
|
4
|
+
import { CelebrationVariant } from './types'
|
|
5
5
|
|
|
6
|
-
export const randomRange = (min: number, max: number) => Math.random() * (max - min) + min
|
|
6
|
+
export const randomRange = (min: number, max: number) => Math.random() * (max - min) + min
|
|
7
7
|
|
|
8
8
|
const isDateInRange = (currentDate: Date, startDateStr: string, endDateStr: string) => {
|
|
9
|
-
const [startDay, startMonth] = startDateStr.split('-').map(Number)
|
|
10
|
-
const [endDay, endMonth] = endDateStr.split('-').map(Number)
|
|
9
|
+
const [startDay, startMonth] = startDateStr.split('-').map(Number)
|
|
10
|
+
const [endDay, endMonth] = endDateStr.split('-').map(Number)
|
|
11
11
|
|
|
12
|
-
const currentYear = currentDate.getFullYear()
|
|
13
|
-
const startDate = new Date(currentYear, startMonth - 1, startDay)
|
|
14
|
-
const endDate = new Date(currentYear, endMonth - 1, endDay + 1);
|
|
12
|
+
const currentYear = currentDate.getFullYear()
|
|
13
|
+
const startDate = new Date(currentYear, startMonth - 1, startDay)
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
// If end month is earlier than start month, it spans to next year
|
|
16
|
+
const endYear = endMonth < startMonth ? currentYear + 1 : currentYear
|
|
17
|
+
const endDate = new Date(endYear, endMonth - 1, endDay + 1)
|
|
18
|
+
|
|
19
|
+
return currentDate >= startDate && currentDate <= endDate
|
|
20
|
+
}
|
|
18
21
|
|
|
19
22
|
export const getIconForCurrentDate = () => {
|
|
20
|
-
const currentDate = new Date()
|
|
23
|
+
const currentDate = new Date()
|
|
21
24
|
|
|
22
25
|
for (const celebration of CELEBRATION_ICON_CONFIG) {
|
|
23
26
|
if (celebration.activePeriod) {
|
|
24
|
-
const { start, end } = celebration.activePeriod
|
|
27
|
+
const { start, end } = celebration.activePeriod
|
|
25
28
|
if (isDateInRange(currentDate, start, end)) {
|
|
26
|
-
return celebration.Icon
|
|
29
|
+
return celebration.Icon
|
|
27
30
|
}
|
|
28
31
|
}
|
|
29
32
|
}
|
|
30
33
|
|
|
31
|
-
return CELEBRATION_ICON_CONFIG[0].Icon
|
|
32
|
-
}
|
|
34
|
+
return CELEBRATION_ICON_CONFIG[0].Icon
|
|
35
|
+
}
|
|
33
36
|
|
|
34
|
-
const MainIcon = getIconForCurrentDate()
|
|
35
|
-
export const generateParticle = (variant: CelebrationVariant
|
|
36
|
-
) => {
|
|
37
|
+
const MainIcon = getIconForCurrentDate()
|
|
38
|
+
export const generateParticle = (variant: CelebrationVariant) => {
|
|
37
39
|
const {
|
|
38
40
|
elementsCount,
|
|
39
41
|
angle,
|
|
@@ -44,20 +46,20 @@ export const generateParticle = (variant: CelebrationVariant
|
|
|
44
46
|
friction,
|
|
45
47
|
life,
|
|
46
48
|
angularAcceleration,
|
|
47
|
-
speedRange
|
|
48
|
-
} = CELEBRATION_VARIANTS[variant]
|
|
49
|
+
speedRange,
|
|
50
|
+
} = CELEBRATION_VARIANTS[variant]
|
|
49
51
|
|
|
50
52
|
const sparkSpeedMin = speedRange?.spark?.[0]
|
|
51
53
|
const sparkSpeedMax = speedRange?.spark?.[1]
|
|
52
54
|
const mainSpeedMin = speedRange?.main?.[0]
|
|
53
55
|
const mainSpeedMax = speedRange?.main?.[1]
|
|
54
56
|
|
|
55
|
-
const particles: ParticlesBatch[] = []
|
|
57
|
+
const particles: ParticlesBatch[] = []
|
|
56
58
|
|
|
57
59
|
for (let i = 0; i < elementsCount.spark; i++) {
|
|
58
|
-
const randomAngle = randomRange((angle.from * Math.PI) / 180, (angle.to * Math.PI) / 180)
|
|
59
|
-
const randomSpeed = randomRange(sparkSpeedMin, sparkSpeedMax)
|
|
60
|
-
const randomAngularAcceleration = randomRange(angularAcceleration.from, angularAcceleration.to)
|
|
60
|
+
const randomAngle = randomRange((angle.from * Math.PI) / 180, (angle.to * Math.PI) / 180)
|
|
61
|
+
const randomSpeed = randomRange(sparkSpeedMin, sparkSpeedMax)
|
|
62
|
+
const randomAngularAcceleration = randomRange(angularAcceleration.from, angularAcceleration.to)
|
|
61
63
|
|
|
62
64
|
particles.push({
|
|
63
65
|
id: Math.random(),
|
|
@@ -74,12 +76,12 @@ export const generateParticle = (variant: CelebrationVariant
|
|
|
74
76
|
friction,
|
|
75
77
|
Component: Spark,
|
|
76
78
|
life,
|
|
77
|
-
})
|
|
79
|
+
})
|
|
78
80
|
}
|
|
79
81
|
for (let i = 0; i < elementsCount.star; i++) {
|
|
80
|
-
const randomAngle = randomRange((angle.from * Math.PI) / 180, (angle.to * Math.PI) / 180)
|
|
81
|
-
const randomSpeed = randomRange(mainSpeedMin, mainSpeedMax)
|
|
82
|
-
const randomAngularAcceleration = randomRange(angularAcceleration.from, angularAcceleration.to)
|
|
82
|
+
const randomAngle = randomRange((angle.from * Math.PI) / 180, (angle.to * Math.PI) / 180)
|
|
83
|
+
const randomSpeed = randomRange(mainSpeedMin, mainSpeedMax)
|
|
84
|
+
const randomAngularAcceleration = randomRange(angularAcceleration.from, angularAcceleration.to)
|
|
83
85
|
|
|
84
86
|
particles.push({
|
|
85
87
|
id: Math.random(),
|
|
@@ -96,8 +98,8 @@ export const generateParticle = (variant: CelebrationVariant
|
|
|
96
98
|
friction,
|
|
97
99
|
Component: MainIcon,
|
|
98
100
|
life,
|
|
99
|
-
})
|
|
101
|
+
})
|
|
100
102
|
}
|
|
101
103
|
|
|
102
|
-
return particles
|
|
103
|
-
}
|
|
104
|
+
return particles
|
|
105
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# TTS Word-by-Word Highlighting
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Word-by-word text highlighting synchronized with text-to-speech playback in the chatbot. The feature is optional and enabled via `isWordHighlightEnabled` config flag.
|
|
6
|
+
|
|
7
|
+
## How It Works
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
11
|
+
│ 1. User clicks TTS button on a message │
|
|
12
|
+
│ ↓ │
|
|
13
|
+
│ 2. Text is converted to SSML with word marks │
|
|
14
|
+
│ "Hello world" → <speak><mark name="w_0"/>Hello │
|
|
15
|
+
│ <mark name="w_1"/>world</speak> │
|
|
16
|
+
│ ↓ │
|
|
17
|
+
│ 3. Google TTS API returns audio + timepoints │
|
|
18
|
+
│ [{ markName: "w_0", timeSeconds: 0.0 }, │
|
|
19
|
+
│ { markName: "w_1", timeSeconds: 0.5 }] │
|
|
20
|
+
│ ↓ │
|
|
21
|
+
│ 4. Audio plays, onTimeUpdate fires via RAF loop │
|
|
22
|
+
│ ↓ │
|
|
23
|
+
│ 5. Current time → find matching timepoint → word index │
|
|
24
|
+
│ ↓ │
|
|
25
|
+
│ 6. $highlightedWordIndex updates → UI re-renders highlighted │
|
|
26
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
// In students-web model setup
|
|
33
|
+
chatModel.bot.setUpT2S({
|
|
34
|
+
audioProvider: createT2SAudioProvider(),
|
|
35
|
+
textSanitizer: removeKatexPartFromTextToSpeech,
|
|
36
|
+
isWordHighlightEnabled: true,
|
|
37
|
+
})
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Architecture
|
|
41
|
+
|
|
42
|
+
### ChatTTSModel (ChatTTSModel.ts)
|
|
43
|
+
|
|
44
|
+
Handles TTS playback and word highlighting. Key design decisions:
|
|
45
|
+
|
|
46
|
+
- **Map-based cache** — `audioCache: Map<string, AudioCache>` stores both `audioPath` and `timepoints` per message. When highlighting is off, `timepoints` is `[]`. Cache lives for the model's lifetime (cleared when user leaves the problem).
|
|
47
|
+
- **`fetchAudio()` method** — encapsulates API call + audioContent decoding. Highlight vs non-highlight differences are ternaries (SSML vs plain text, `enableTimePointing`).
|
|
48
|
+
- **`play()` is linear** — cache lookup → fetch if miss → store → activate highlight if enabled → play audio. No branching between highlight/non-highlight paths.
|
|
49
|
+
- **Pause/resume guards** — `wordHighlightEnabled` check before toggling `setIsActive(false)`/`setIsActive(true)` on pause/resume.
|
|
50
|
+
- **`wordHighlightEnabled` (private)** — stored result of `!!isWordHighlightEnabled && !!audioProvider.onTimeUpdate`. Set once at `setConfig`.
|
|
51
|
+
- **`isWordHighlightEnabled` (public getter)** — read-only access for external consumers (e.g. `Chat.tsx`).
|
|
52
|
+
|
|
53
|
+
### AudioProvider type
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
type AudioProvider = {
|
|
57
|
+
play: (audioPath: string, onPlaybackComplete: () => void) => Promise<void>
|
|
58
|
+
pause: () => void
|
|
59
|
+
resume: () => void
|
|
60
|
+
stop: () => void
|
|
61
|
+
onTimeUpdate?: OnTimeUpdate // optional — presence enables highlight capability
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`onTimeUpdate` is optional. It's the mechanism that syncs audio playback time with word highlights via a RAF loop. If the provider doesn't have it, highlighting won't activate even if `isWordHighlightEnabled: true`.
|
|
66
|
+
|
|
67
|
+
### ChatTTSHighlightModel (ChatTTSHighlightModel.ts)
|
|
68
|
+
|
|
69
|
+
Manages highlight state using Effector stores with declarative reset. Receives `OnTimeUpdate` callback directly (not the whole `AudioProvider`).
|
|
70
|
+
|
|
71
|
+
- **`$isActive`** — gates `$highlightedWordIndex` computation. Toggled on pause/resume without resetting timepoints.
|
|
72
|
+
- **`$highlightedWordIndex`** — derived store, returns `-1` when inactive or no match. Parses mark name via `WORD_MARK_REGEX`.
|
|
73
|
+
- **`activate(timepoints, onTimeUpdate)`** — sets timepoints, enables highlighting, registers time update callback. Only triggers store updates when the highlighted word actually changes (`lastMark` comparison).
|
|
74
|
+
- **`deactivate(onTimeUpdate)`** — stops listening, resets all state via declarative `.reset()` chain.
|
|
75
|
+
- **All stores use `.reset(this.reset)`** — single `reset` event clears `$time`, `$timepoints`, and `$isActive`.
|
|
76
|
+
|
|
77
|
+
### Helpers (helpers/ttsHighlight.ts)
|
|
78
|
+
|
|
79
|
+
- **`textToSSML(text)`** — converts plain text to SSML with `<mark>` tags for word timing.
|
|
80
|
+
- **`findCurrentMark(timepoints, time)`** — iterates backwards through timepoints to find the current mark. Efficient for linear playback.
|
|
81
|
+
|
|
82
|
+
### Constants (constants.ts)
|
|
83
|
+
|
|
84
|
+
- **`WORD_MARK_REGEX`** — `/^w_(\d+)$/` — extracts word index from mark names like `w_0`, `w_1`.
|
|
85
|
+
|
|
86
|
+
### Naming conventions
|
|
87
|
+
|
|
88
|
+
| Name | Scope | Purpose |
|
|
89
|
+
|------|-------|---------|
|
|
90
|
+
| `wordHighlight` | public instance | `ChatTTSHighlightModel` instance on `ChatTTSModel` |
|
|
91
|
+
| `wordHighlightEnabled` | private field | Whether highlighting is active (set once at config) |
|
|
92
|
+
| `isWordHighlightEnabled` | public getter | Read-only access to `wordHighlightEnabled` for external consumers |
|
|
93
|
+
| `isWordHighlightEnabled` | T2SConfig field | Config flag passed to `setUpT2S()` |
|
|
94
|
+
|
|
95
|
+
## Data Flow
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
AudioProvider.onTimeUpdate(callback)
|
|
99
|
+
↓
|
|
100
|
+
ChatTTSHighlightModel.activate(timepoints, onTimeUpdate)
|
|
101
|
+
↓
|
|
102
|
+
RAF loop → audio.currentTime → findCurrentMark() → only updates when mark changes
|
|
103
|
+
↓
|
|
104
|
+
$highlightedWordIndex = parse mark name "w_N" → N (or -1 if inactive/no match)
|
|
105
|
+
↓
|
|
106
|
+
Chat.tsx: model.t2s.isWordHighlightEnabled && isPlayingMessage ? highlightedWordIndex : -1
|
|
107
|
+
↓
|
|
108
|
+
ChatMessage → MessageContent → TTSHighlightRenderer({ text, highlightedIndex })
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Key Files
|
|
112
|
+
|
|
113
|
+
| File | Purpose |
|
|
114
|
+
|------|---------|
|
|
115
|
+
| `model/ChatTTSModel.ts` | `ChatTTSModel` — TTS playback, caching, highlight orchestration |
|
|
116
|
+
| `model/ChatTTSHighlightModel.ts` | Highlight state — timepoints, current time, `$isActive`, derived word index |
|
|
117
|
+
| `helpers/ttsHighlight.ts` | `textToSSML` + `findCurrentMark` — SSML conversion and playback position lookup |
|
|
118
|
+
| `constants.ts` | `WORD_MARK_REGEX` and audio config defaults |
|
|
119
|
+
| `types/t2s.types.ts` | `AudioProvider`, `OnTimeUpdate`, `AudioStatus`, `AudioCache`, `TTSHighlightRendererProps` types |
|
|
120
|
+
| `components/Chat/Chat.tsx` | Reads `isWordHighlightEnabled` and `$highlightedWordIndex`, passes to messages |
|
|
@@ -1,115 +1,359 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
|
|
1
|
+
import React, {
|
|
2
|
+
ComponentType,
|
|
3
|
+
PropsWithChildren,
|
|
4
|
+
useCallback,
|
|
5
|
+
useEffect,
|
|
6
|
+
useMemo,
|
|
7
|
+
useRef,
|
|
8
|
+
useState,
|
|
9
|
+
} from 'react'
|
|
10
|
+
import {
|
|
11
|
+
FlatList,
|
|
12
|
+
ListRenderItemInfo,
|
|
13
|
+
NativeScrollEvent,
|
|
14
|
+
NativeSyntheticEvent,
|
|
15
|
+
Platform,
|
|
16
|
+
StyleSheet,
|
|
17
|
+
useWindowDimensions,
|
|
18
|
+
View,
|
|
19
|
+
} from 'react-native'
|
|
3
20
|
import { useStoreMap, useUnit } from 'effector-react'
|
|
21
|
+
import { SPACING } from '@magmamath/react-native-ui'
|
|
4
22
|
|
|
23
|
+
import { ConversationMessage } from '../../types/units.types'
|
|
5
24
|
import { ChatbotModel } from '../../model/ChatBotModel'
|
|
25
|
+
import { ChatbotIcon } from '../../../../shared/icons/ChatbotIcon'
|
|
26
|
+
import { LavaIconInGlasses } from '../../../../shared/icons/LavaIconInGlasses'
|
|
27
|
+
import { AnimatedMessage } from '../ChatMessage/AnimatedMessage'
|
|
6
28
|
import { ChatMessage } from '../ChatMessage/ChatMessage'
|
|
7
29
|
import { MessageLoader } from '../ChatMessage/MessageLoader'
|
|
8
30
|
import { ChatInput } from '../ChatInput/ChatInput'
|
|
31
|
+
import { CloseButton } from './CloseButton'
|
|
9
32
|
import { MessageVariant } from '../../types/model.types'
|
|
10
33
|
import { ColorScheme } from '../../types/style.types'
|
|
34
|
+
import { ConditionalWrapper } from '../../../../lib/components/ConditionalWrapper'
|
|
35
|
+
import { TTSHighlightRenderer } from '../../types/t2s.types'
|
|
11
36
|
|
|
37
|
+
const SCROLL_BOTTOM_THRESHOLD = 1
|
|
12
38
|
const TOOLBAR_HEIGHT = 140
|
|
13
|
-
const BOTTOM_OFFSET = Platform.select({
|
|
14
|
-
|
|
15
|
-
|
|
39
|
+
const BOTTOM_OFFSET = Platform.select({ web: 265, default: 294 })
|
|
40
|
+
|
|
41
|
+
const TOP_FADE_MASK = Platform.select({
|
|
42
|
+
web: { maskImage: 'linear-gradient(to top, transparent, black 10%, black)' } as any,
|
|
43
|
+
default: undefined,
|
|
16
44
|
})
|
|
17
45
|
|
|
46
|
+
const Separator = () => <View style={styles.separator} />
|
|
47
|
+
|
|
48
|
+
const BottomFade = ({ visible }: { visible: boolean }) => (
|
|
49
|
+
<View
|
|
50
|
+
style={[styles.bottomFade, { opacity: visible ? 1 : 0 }]}
|
|
51
|
+
pointerEvents="none"
|
|
52
|
+
/>
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
type ChatIconProps = {
|
|
56
|
+
isLoading: boolean
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const ChatIcon = ({ isLoading }: ChatIconProps) => (
|
|
60
|
+
<View style={styles.iconAbsolute}>
|
|
61
|
+
{isLoading ? (
|
|
62
|
+
<LavaIconInGlasses width={53} height={73} />
|
|
63
|
+
) : (
|
|
64
|
+
<ChatbotIcon width={53} height={73} color={'blue'} />
|
|
65
|
+
)}
|
|
66
|
+
</View>
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
type ChatFooterProps = {
|
|
70
|
+
isHintFeedback: boolean
|
|
71
|
+
isInputDisabled?: boolean
|
|
72
|
+
colorScheme: ColorScheme
|
|
73
|
+
hasMessages: boolean
|
|
74
|
+
onPressClose?: () => void
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const ChatFooter = ({
|
|
78
|
+
isHintFeedback,
|
|
79
|
+
isInputDisabled,
|
|
80
|
+
colorScheme,
|
|
81
|
+
hasMessages,
|
|
82
|
+
onPressClose,
|
|
83
|
+
}: ChatFooterProps) => (
|
|
84
|
+
<View style={styles.inputRow}>
|
|
85
|
+
<CloseButton onPress={onPressClose} />
|
|
86
|
+
{!isInputDisabled && (
|
|
87
|
+
<ChatInput
|
|
88
|
+
isHintFeedback={isHintFeedback}
|
|
89
|
+
colorScheme={colorScheme}
|
|
90
|
+
hasMessages={hasMessages}
|
|
91
|
+
/>
|
|
92
|
+
)}
|
|
93
|
+
</View>
|
|
94
|
+
)
|
|
95
|
+
|
|
18
96
|
type ChatProps = {
|
|
19
97
|
model: ChatbotModel
|
|
20
98
|
isHintFeedback: boolean
|
|
21
99
|
isTextToSpeechEnabled: boolean
|
|
100
|
+
isInputDisabled?: boolean
|
|
22
101
|
colorScheme?: ColorScheme
|
|
102
|
+
MessageWrapper?: ComponentType<PropsWithChildren>
|
|
103
|
+
TTSHighlightRenderer?: TTSHighlightRenderer
|
|
104
|
+
onPressClose?: () => void
|
|
23
105
|
}
|
|
24
106
|
|
|
25
107
|
export const Chat = ({
|
|
26
108
|
model,
|
|
27
109
|
isHintFeedback,
|
|
28
110
|
isTextToSpeechEnabled,
|
|
111
|
+
isInputDisabled,
|
|
29
112
|
colorScheme = ColorScheme.Blue,
|
|
113
|
+
MessageWrapper,
|
|
114
|
+
TTSHighlightRenderer,
|
|
115
|
+
onPressClose,
|
|
30
116
|
}: ChatProps) => {
|
|
117
|
+
const ref = useRef<FlatList>(null)
|
|
118
|
+
const maxHeightRef = useRef(0)
|
|
31
119
|
const dimensions = useWindowDimensions()
|
|
32
|
-
const ref = useRef<ScrollView>(null)
|
|
33
120
|
const isOpen = useUnit(model.$isOpen)
|
|
34
121
|
|
|
35
122
|
const isHelpRequestPending = useUnit(model.sendHelpRequestFx.pending)
|
|
36
123
|
const isTextToSpeechPending = useUnit(model.api.textToSpeechTextFx.pending)
|
|
37
124
|
|
|
125
|
+
const audioStatus = useUnit(model.t2s.$status)
|
|
38
126
|
const currentPlayingId = useUnit(model.t2s.$currentPlayingId)
|
|
127
|
+
const highlightedWordIndex = useUnit(model.t2s.wordHighlight.$highlightedWordIndex)
|
|
128
|
+
|
|
39
129
|
const isTranslated = useUnit(model.translation.$isTranslated)
|
|
40
|
-
const audioStatus = useUnit(model.t2s.$status)
|
|
41
130
|
const errorSpottingEnabled = useUnit(model.errorSpotting.$isEnabled)
|
|
42
131
|
|
|
43
132
|
const messages = useStoreMap(model.$currentChatData, ({ messages }) => messages)
|
|
44
|
-
const
|
|
45
|
-
|
|
133
|
+
const lastBotMessageId = messages.findLast((m) => !m.isOwnMessage)?.id
|
|
46
134
|
const MAX_HEIGHT = dimensions.height - TOOLBAR_HEIGHT - BOTTOM_OFFSET
|
|
135
|
+
maxHeightRef.current = MAX_HEIGHT
|
|
136
|
+
|
|
137
|
+
const [isScrollable, setIsScrollable] = useState(false)
|
|
138
|
+
const [showBottomFade, setShowBottomFade] = useState(false)
|
|
139
|
+
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
if (!isOpen) {
|
|
142
|
+
setIsScrollable(false)
|
|
143
|
+
setShowBottomFade(false)
|
|
144
|
+
}
|
|
145
|
+
}, [isOpen])
|
|
146
|
+
|
|
147
|
+
const handleScroll = useCallback((e: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
148
|
+
const { contentOffset } = e.nativeEvent
|
|
149
|
+
setShowBottomFade(contentOffset.y > SCROLL_BOTTOM_THRESHOLD)
|
|
150
|
+
}, [])
|
|
151
|
+
|
|
152
|
+
const handleContentSizeChange = useCallback((_: number, contentHeight: number) => {
|
|
153
|
+
setIsScrollable(contentHeight >= maxHeightRef.current)
|
|
154
|
+
}, [])
|
|
155
|
+
|
|
156
|
+
const shouldWrapMessage = MessageWrapper && isInputDisabled && messages.length === 1
|
|
157
|
+
const reversedMessages = useMemo(() => [...messages].reverse(), [messages])
|
|
158
|
+
const showAbsoluteIcon = !showBottomFade && !isInputDisabled
|
|
159
|
+
|
|
160
|
+
const renderMessage = useCallback(
|
|
161
|
+
({ item: message }: ListRenderItemInfo<ConversationMessage>) => {
|
|
162
|
+
const isPlayingMessage = message.id === currentPlayingId
|
|
163
|
+
const messageHighlightIndex =
|
|
164
|
+
model.t2s.isWordHighlightEnabled && isPlayingMessage ? highlightedWordIndex : -1
|
|
165
|
+
const showInlineIcon =
|
|
166
|
+
showBottomFade && !message.isOwnMessage && message.id === lastBotMessageId
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
<MessageItem
|
|
170
|
+
message={message}
|
|
171
|
+
showInlineIcon={showInlineIcon}
|
|
172
|
+
animate={!isInputDisabled}
|
|
173
|
+
shouldWrapMessage={!!shouldWrapMessage}
|
|
174
|
+
MessageWrapper={MessageWrapper}
|
|
175
|
+
isTranslated={isTranslated}
|
|
176
|
+
colorScheme={colorScheme}
|
|
177
|
+
withIcon={isInputDisabled}
|
|
178
|
+
withErrorSpotting={errorSpottingEnabled && !message.isOwnMessage}
|
|
179
|
+
highlightedWordIndex={messageHighlightIndex}
|
|
180
|
+
TTSHighlightRenderer={TTSHighlightRenderer}
|
|
181
|
+
isTextToSpeechEnabled={isTextToSpeechEnabled && !message.isOwnMessage}
|
|
182
|
+
isPlayingMessage={isPlayingMessage}
|
|
183
|
+
isTextToSpeechPending={isTextToSpeechPending}
|
|
184
|
+
audioStatus={audioStatus}
|
|
185
|
+
/>
|
|
186
|
+
)
|
|
187
|
+
},
|
|
188
|
+
[
|
|
189
|
+
currentPlayingId,
|
|
190
|
+
highlightedWordIndex,
|
|
191
|
+
showBottomFade,
|
|
192
|
+
lastBotMessageId,
|
|
193
|
+
shouldWrapMessage,
|
|
194
|
+
isTranslated,
|
|
195
|
+
colorScheme,
|
|
196
|
+
errorSpottingEnabled,
|
|
197
|
+
isTextToSpeechEnabled,
|
|
198
|
+
isTextToSpeechPending,
|
|
199
|
+
audioStatus,
|
|
200
|
+
],
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
if (!isOpen) return null
|
|
47
204
|
|
|
48
205
|
return (
|
|
49
206
|
<View style={[styles.container, { maxHeight: MAX_HEIGHT }]}>
|
|
50
|
-
<
|
|
207
|
+
<FlatList
|
|
51
208
|
ref={ref}
|
|
209
|
+
inverted
|
|
52
210
|
bounces={false}
|
|
211
|
+
style={[styles.flatList, isScrollable && TOP_FADE_MASK]}
|
|
212
|
+
data={reversedMessages}
|
|
213
|
+
keyExtractor={keyExtractor}
|
|
214
|
+
renderItem={renderMessage}
|
|
53
215
|
contentContainerStyle={styles.list}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
withErrorSpotting={errorSpottingEnabled && !message.isOwnMessage}
|
|
73
|
-
t2sState={{
|
|
74
|
-
isEnabled: isTextToSpeechEnabled && !message.isOwnMessage,
|
|
75
|
-
isActive: message.id === currentPlayingId,
|
|
76
|
-
isLoading: isTextToSpeechPending,
|
|
77
|
-
status: audioStatus,
|
|
78
|
-
disabled: isTextToSpeechPending,
|
|
79
|
-
}}
|
|
80
|
-
/>
|
|
81
|
-
))}
|
|
82
|
-
|
|
83
|
-
{isHelpRequestPending && <MessageLoader colorScheme={colorScheme} />}
|
|
84
|
-
</View>
|
|
85
|
-
)}
|
|
86
|
-
|
|
87
|
-
{isOpen && (
|
|
88
|
-
<ChatInput
|
|
89
|
-
isHintFeedback={isHintFeedback}
|
|
90
|
-
colorScheme={colorScheme}
|
|
91
|
-
hasMessages={messages.length > 1}
|
|
92
|
-
/>
|
|
93
|
-
)}
|
|
94
|
-
</ScrollView>
|
|
216
|
+
onScroll={handleScroll}
|
|
217
|
+
scrollEventThrottle={16}
|
|
218
|
+
onContentSizeChange={handleContentSizeChange}
|
|
219
|
+
ListHeaderComponent={<MessageLoader isLoading={isHelpRequestPending} />}
|
|
220
|
+
ItemSeparatorComponent={Separator}
|
|
221
|
+
/>
|
|
222
|
+
|
|
223
|
+
<BottomFade visible={showBottomFade} />
|
|
224
|
+
|
|
225
|
+
{showAbsoluteIcon && <ChatIcon isLoading={isHelpRequestPending} />}
|
|
226
|
+
|
|
227
|
+
<ChatFooter
|
|
228
|
+
isHintFeedback={isHintFeedback}
|
|
229
|
+
isInputDisabled={isInputDisabled}
|
|
230
|
+
colorScheme={colorScheme}
|
|
231
|
+
hasMessages={messages.length > 1}
|
|
232
|
+
onPressClose={onPressClose}
|
|
233
|
+
/>
|
|
95
234
|
</View>
|
|
96
235
|
)
|
|
97
236
|
}
|
|
98
237
|
|
|
238
|
+
const keyExtractor = (item: ConversationMessage, index: number) => `${item.id}-${index}`
|
|
239
|
+
|
|
240
|
+
type MessageItemProps = {
|
|
241
|
+
message: ConversationMessage
|
|
242
|
+
showInlineIcon: boolean
|
|
243
|
+
animate?: boolean
|
|
244
|
+
shouldWrapMessage?: boolean
|
|
245
|
+
MessageWrapper?: ComponentType<PropsWithChildren>
|
|
246
|
+
isTranslated?: boolean
|
|
247
|
+
colorScheme: ColorScheme
|
|
248
|
+
withIcon?: boolean
|
|
249
|
+
withErrorSpotting?: boolean
|
|
250
|
+
highlightedWordIndex: number
|
|
251
|
+
TTSHighlightRenderer?: TTSHighlightRenderer
|
|
252
|
+
isTextToSpeechEnabled: boolean
|
|
253
|
+
isPlayingMessage: boolean
|
|
254
|
+
isTextToSpeechPending: boolean
|
|
255
|
+
audioStatus: any
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const MessageItem = ({
|
|
259
|
+
message,
|
|
260
|
+
showInlineIcon,
|
|
261
|
+
animate,
|
|
262
|
+
shouldWrapMessage,
|
|
263
|
+
MessageWrapper,
|
|
264
|
+
isTranslated,
|
|
265
|
+
colorScheme,
|
|
266
|
+
withIcon,
|
|
267
|
+
withErrorSpotting,
|
|
268
|
+
highlightedWordIndex,
|
|
269
|
+
TTSHighlightRenderer,
|
|
270
|
+
isTextToSpeechEnabled,
|
|
271
|
+
isPlayingMessage,
|
|
272
|
+
isTextToSpeechPending,
|
|
273
|
+
audioStatus,
|
|
274
|
+
}: MessageItemProps) => (
|
|
275
|
+
<View style={[styles.messageItem, showInlineIcon && styles.messageWithIcon]}>
|
|
276
|
+
{showInlineIcon && (
|
|
277
|
+
<View style={styles.inlineIcon}>
|
|
278
|
+
<ChatbotIcon width={53} height={73} />
|
|
279
|
+
</View>
|
|
280
|
+
)}
|
|
281
|
+
<AnimatedMessage animate={animate}>
|
|
282
|
+
<ConditionalWrapper withWrapper={shouldWrapMessage} Wrapper={MessageWrapper}>
|
|
283
|
+
<ChatMessage
|
|
284
|
+
withIcon={withIcon}
|
|
285
|
+
isTranslated={isTranslated}
|
|
286
|
+
message={message}
|
|
287
|
+
variant={message.isOwnMessage ? MessageVariant.SENT : MessageVariant.RECEIVED}
|
|
288
|
+
colorScheme={colorScheme}
|
|
289
|
+
withErrorSpotting={withErrorSpotting}
|
|
290
|
+
highlightedWordIndex={highlightedWordIndex}
|
|
291
|
+
TTSHighlightRenderer={TTSHighlightRenderer}
|
|
292
|
+
t2sState={{
|
|
293
|
+
isEnabled: isTextToSpeechEnabled,
|
|
294
|
+
isActive: isPlayingMessage,
|
|
295
|
+
isLoading: isTextToSpeechPending,
|
|
296
|
+
status: audioStatus,
|
|
297
|
+
disabled: isTextToSpeechPending,
|
|
298
|
+
}}
|
|
299
|
+
/>
|
|
300
|
+
</ConditionalWrapper>
|
|
301
|
+
</AnimatedMessage>
|
|
302
|
+
</View>
|
|
303
|
+
)
|
|
304
|
+
|
|
99
305
|
const styles = StyleSheet.create({
|
|
100
306
|
container: {
|
|
101
307
|
flex: 1,
|
|
102
308
|
alignItems: 'flex-end',
|
|
103
|
-
width:
|
|
309
|
+
width: 374,
|
|
104
310
|
height: '100%',
|
|
311
|
+
paddingRight: SPACING['100'],
|
|
312
|
+
},
|
|
313
|
+
flatList: {
|
|
314
|
+
alignSelf: 'stretch',
|
|
315
|
+
paddingTop: SPACING['300'],
|
|
105
316
|
},
|
|
106
317
|
list: {
|
|
107
|
-
alignItems: 'flex-end',
|
|
108
318
|
paddingVertical: 2,
|
|
109
|
-
paddingRight: 6,
|
|
110
319
|
},
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
320
|
+
inputRow: {
|
|
321
|
+
flexDirection: 'row',
|
|
322
|
+
alignItems: 'center',
|
|
323
|
+
gap: SPACING['200'],
|
|
324
|
+
minHeight: 52,
|
|
325
|
+
},
|
|
326
|
+
bottomFade: {
|
|
327
|
+
position: 'absolute',
|
|
328
|
+
bottom: 52,
|
|
329
|
+
right: 0,
|
|
330
|
+
width: 370,
|
|
331
|
+
height: 40,
|
|
332
|
+
transition: 'opacity 0.2s ease-in-out',
|
|
333
|
+
...Platform.select({
|
|
334
|
+
web: {
|
|
335
|
+
backgroundImage:
|
|
336
|
+
'linear-gradient(to top, rgba(255,255,255,1) 10%, rgba(255,255,255,0.8) 40%, transparent 100%)',
|
|
337
|
+
},
|
|
338
|
+
default: {},
|
|
339
|
+
}),
|
|
340
|
+
} as any,
|
|
341
|
+
iconAbsolute: {
|
|
342
|
+
position: 'absolute',
|
|
343
|
+
bottom: 65,
|
|
344
|
+
left: 4,
|
|
345
|
+
},
|
|
346
|
+
messageItem: {
|
|
347
|
+
alignSelf: 'flex-end',
|
|
348
|
+
},
|
|
349
|
+
messageWithIcon: {
|
|
350
|
+
flexDirection: 'row',
|
|
351
|
+
alignItems: 'flex-end',
|
|
352
|
+
},
|
|
353
|
+
inlineIcon: {
|
|
354
|
+
marginRight: 8,
|
|
355
|
+
},
|
|
356
|
+
separator: {
|
|
357
|
+
height: SPACING['200'],
|
|
114
358
|
},
|
|
115
359
|
})
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { StyleSheet } from 'react-native'
|
|
3
|
+
import { Button, ButtonColor, ButtonSize, ButtonVariant, COLORS } from '@magmamath/react-native-ui'
|
|
4
|
+
import { CloseIcon } from '../../../../shared/icons/CloseIcon'
|
|
5
|
+
|
|
6
|
+
type CloseButtonProps = {
|
|
7
|
+
onPress?: () => void
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const CloseButton = ({ onPress }: CloseButtonProps) => (
|
|
11
|
+
<Button
|
|
12
|
+
onPress={onPress}
|
|
13
|
+
style={{ button: styles.button }}
|
|
14
|
+
variant={ButtonVariant.PRIMARY}
|
|
15
|
+
size={ButtonSize.MEDIUM}
|
|
16
|
+
colorScheme={ButtonColor.WHITE}
|
|
17
|
+
raiseLevel={5}
|
|
18
|
+
>
|
|
19
|
+
<CloseIcon width={18} height={18} />
|
|
20
|
+
</Button>
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
const styles = StyleSheet.create({
|
|
24
|
+
button: {
|
|
25
|
+
width: 38,
|
|
26
|
+
height: 38,
|
|
27
|
+
borderRadius: 36,
|
|
28
|
+
paddingHorizontal: 0,
|
|
29
|
+
borderColor: COLORS.NEUTRAL_5,
|
|
30
|
+
},
|
|
31
|
+
})
|