@magmamath/students-features 0.5.0 → 0.5.1-rc-0
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/config.js +4 -4
- package/dist/commonjs/features/celebrations/config.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/Alternatives/Alternatives.js +1 -2
- package/dist/commonjs/features/chatbot/components/Alternatives/Alternatives.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/ChatMessage.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.js +47 -30
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js +42 -22
- package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/SentMessage.js +14 -11
- package/dist/commonjs/features/chatbot/components/ChatMessage/SentMessage.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js +32 -17
- package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/Chatbot.js +7 -5
- package/dist/commonjs/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/commonjs/features/chatbot/index.js +7 -0
- package/dist/commonjs/features/chatbot/index.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/{ChatBotThreadManager.js → ChatBotMessageHandler.js} +22 -44
- package/dist/commonjs/features/chatbot/model/ChatBotMessageHandler.js.map +1 -0
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js +125 -146
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/DefaultMessageCreator.js +12 -12
- package/dist/commonjs/features/chatbot/model/DefaultMessageCreator.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ThreadItem.js +8 -16
- package/dist/commonjs/features/chatbot/model/ThreadItem.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/{ChatbotApi.js → api.js} +1 -2
- package/dist/commonjs/features/chatbot/model/api.js.map +1 -0
- package/dist/commonjs/features/chatbot/model/constants.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/messagesHelper.js +7 -7
- package/dist/commonjs/features/chatbot/model/messagesHelper.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/t2s.js +13 -18
- package/dist/commonjs/features/chatbot/model/t2s.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/translation.helpers.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/translation.js +19 -28
- package/dist/commonjs/features/chatbot/model/translation.js.map +1 -1
- package/dist/commonjs/features/chatbot/types/api.types.js +0 -4
- package/dist/commonjs/features/chatbot/types/model.types.js.map +1 -1
- package/dist/commonjs/features/endOfAssignment/components/CorrectAnswer/AnimatedCard.js +2 -4
- package/dist/commonjs/features/endOfAssignment/components/CorrectAnswer/AnimatedCard.js.map +1 -1
- package/dist/commonjs/features/endOfAssignment/ui/PracticeButtonGroup.js.map +1 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/lib/effector/createEntityFieldStore.js +0 -4
- package/dist/commonjs/lib/effector/createEntityFieldStore.js.map +1 -1
- package/{src/shared/translation → dist/commonjs/lib}/localization/en.json +1 -8
- package/dist/{module/shared/translation → commonjs/lib}/localization/gb.json +1 -8
- package/dist/commonjs/{shared/translation → lib}/localization/sw.json +1 -8
- package/dist/commonjs/shared/icons/icon.types.js +0 -4
- package/dist/commonjs/shared/translation/constants.js +3 -3
- package/dist/commonjs/shared/translation/constants.js.map +1 -1
- package/dist/commonjs/shared/translation/helpers.js +6 -22
- package/dist/commonjs/shared/translation/helpers.js.map +1 -1
- package/dist/commonjs/shared/translation/hooks.js +5 -3
- package/dist/commonjs/shared/translation/hooks.js.map +1 -1
- package/dist/commonjs/shared/translation/model.js +1 -1
- package/dist/commonjs/shared/translation/model.js.map +1 -1
- package/dist/commonjs/shared/translation/types.js +1 -1
- package/dist/commonjs/shared/translation/types.js.map +1 -1
- package/dist/module/features/celebrations/config.js +4 -4
- package/dist/module/features/celebrations/config.js.map +1 -1
- package/dist/module/features/chatbot/components/Alternatives/Alternatives.js +1 -2
- package/dist/module/features/chatbot/components/Alternatives/Alternatives.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/ChatMessage.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.js +48 -31
- package/dist/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js +43 -23
- package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/SentMessage.js +13 -11
- package/dist/module/features/chatbot/components/ChatMessage/SentMessage.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js +32 -17
- package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
- package/dist/module/features/chatbot/components/Chatbot.js +8 -6
- package/dist/module/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/module/features/chatbot/index.js +1 -0
- package/dist/module/features/chatbot/index.js.map +1 -1
- package/dist/module/features/chatbot/model/{ChatBotThreadManager.js → ChatBotMessageHandler.js} +20 -42
- package/dist/module/features/chatbot/model/ChatBotMessageHandler.js.map +1 -0
- package/dist/module/features/chatbot/model/ChatBotModel.js +126 -147
- package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/module/features/chatbot/model/DefaultMessageCreator.js +12 -12
- package/dist/module/features/chatbot/model/DefaultMessageCreator.js.map +1 -1
- package/dist/module/features/chatbot/model/ThreadItem.js +8 -16
- package/dist/module/features/chatbot/model/ThreadItem.js.map +1 -1
- package/dist/module/features/chatbot/model/{ChatbotApi.js → api.js} +1 -2
- package/dist/module/features/chatbot/model/api.js.map +1 -0
- package/dist/module/features/chatbot/model/constants.js.map +1 -1
- package/dist/module/features/chatbot/model/messagesHelper.js +7 -7
- package/dist/module/features/chatbot/model/messagesHelper.js.map +1 -1
- package/dist/module/features/chatbot/model/t2s.js +14 -19
- package/dist/module/features/chatbot/model/t2s.js.map +1 -1
- package/dist/module/features/chatbot/model/translation.helpers.js.map +1 -1
- package/dist/module/features/chatbot/model/translation.js +19 -28
- package/dist/module/features/chatbot/model/translation.js.map +1 -1
- package/dist/module/features/chatbot/types/api.types.js +0 -2
- package/dist/module/features/chatbot/types/model.types.js.map +1 -1
- package/dist/module/features/endOfAssignment/components/CorrectAnswer/AnimatedCard.js +2 -4
- package/dist/module/features/endOfAssignment/components/CorrectAnswer/AnimatedCard.js.map +1 -1
- package/dist/module/features/endOfAssignment/ui/PracticeButtonGroup.js.map +1 -1
- package/dist/module/index.js.map +1 -1
- package/dist/module/lib/effector/createEntityFieldStore.js +0 -4
- package/dist/module/lib/effector/createEntityFieldStore.js.map +1 -1
- package/dist/module/{shared/translation → lib}/localization/en.json +1 -8
- package/dist/{commonjs/shared/translation → module/lib}/localization/gb.json +1 -8
- package/dist/module/{shared/translation → lib}/localization/sw.json +1 -8
- package/dist/module/shared/icons/icon.types.js +0 -2
- package/dist/module/shared/translation/constants.js +3 -3
- package/dist/module/shared/translation/constants.js.map +1 -1
- package/dist/module/shared/translation/helpers.js +5 -19
- package/dist/module/shared/translation/helpers.js.map +1 -1
- package/dist/module/shared/translation/hooks.js +6 -4
- package/dist/module/shared/translation/hooks.js.map +1 -1
- package/dist/module/shared/translation/model.js +1 -1
- package/dist/module/shared/translation/model.js.map +1 -1
- package/dist/module/shared/translation/types.js +0 -2
- package/dist/module/shared/translation/types.js.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/Alternatives/Alternatives.d.ts +3 -1
- package/dist/typescript/commonjs/features/chatbot/components/Alternatives/Alternatives.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ChatMessage.d.ts +10 -7
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ChatMessage.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.d.ts +7 -5
- 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 +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/SentMessage.d.ts +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/SentMessage.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts +10 -2
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts +5 -2
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/index.d.ts +3 -4
- package/dist/typescript/commonjs/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotMessageHandler.d.ts +31 -0
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotMessageHandler.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts +18 -24
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/DefaultMessageCreator.d.ts +3 -5
- package/dist/typescript/commonjs/features/chatbot/model/DefaultMessageCreator.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ThreadItem.d.ts +7 -13
- package/dist/typescript/commonjs/features/chatbot/model/ThreadItem.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/{ChatbotApi.d.ts → api.d.ts} +3 -4
- package/dist/typescript/commonjs/features/chatbot/model/api.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/model/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/messagesHelper.d.ts +5 -7
- package/dist/typescript/commonjs/features/chatbot/model/messagesHelper.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/t2s.d.ts +6 -16
- package/dist/typescript/commonjs/features/chatbot/model/t2s.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts +9 -8
- package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/translation.helpers.d.ts +1 -2
- package/dist/typescript/commonjs/features/chatbot/model/translation.helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts +11 -12
- 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 +24 -19
- 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 +7 -9
- package/dist/typescript/commonjs/features/chatbot/types/t2s.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/translation.types.d.ts +2 -3
- package/dist/typescript/commonjs/features/chatbot/types/translation.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/CorrectAnswer/AnimatedCard.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/endOfAssignment/ui/PracticeButtonGroup.d.ts.map +1 -1
- package/dist/typescript/commonjs/index.d.ts +1 -0
- package/dist/typescript/commonjs/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/lib/effector/createEntityFieldStore.d.ts +0 -2
- package/dist/typescript/commonjs/lib/effector/createEntityFieldStore.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/icons/icon.types.d.ts +0 -2
- package/dist/typescript/commonjs/shared/icons/icon.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/constants.d.ts +0 -21
- package/dist/typescript/commonjs/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/helpers.d.ts +2 -3
- package/dist/typescript/commonjs/shared/translation/helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/hooks.d.ts +2 -2
- package/dist/typescript/commonjs/shared/translation/hooks.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/index.d.ts +1 -0
- package/dist/typescript/commonjs/shared/translation/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/model.d.ts +3 -43
- package/dist/typescript/commonjs/shared/translation/model.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/types.d.ts +4 -4
- package/dist/typescript/commonjs/shared/translation/types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/Alternatives/Alternatives.d.ts +3 -1
- package/dist/typescript/module/features/chatbot/components/Alternatives/Alternatives.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/ChatMessage.d.ts +10 -7
- package/dist/typescript/module/features/chatbot/components/ChatMessage/ChatMessage.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.d.ts +7 -5
- 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 +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/SentMessage.d.ts +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/SentMessage.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts +10 -2
- package/dist/typescript/module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts +5 -2
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/index.d.ts +3 -4
- package/dist/typescript/module/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotMessageHandler.d.ts +31 -0
- package/dist/typescript/module/features/chatbot/model/ChatBotMessageHandler.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts +18 -24
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/DefaultMessageCreator.d.ts +3 -5
- package/dist/typescript/module/features/chatbot/model/DefaultMessageCreator.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ThreadItem.d.ts +7 -13
- package/dist/typescript/module/features/chatbot/model/ThreadItem.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/{ChatbotApi.d.ts → api.d.ts} +3 -4
- package/dist/typescript/module/features/chatbot/model/api.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/model/constants.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/messagesHelper.d.ts +5 -7
- package/dist/typescript/module/features/chatbot/model/messagesHelper.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/t2s.d.ts +6 -16
- package/dist/typescript/module/features/chatbot/model/t2s.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/translation.d.ts +9 -8
- package/dist/typescript/module/features/chatbot/model/translation.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/translation.helpers.d.ts +1 -2
- package/dist/typescript/module/features/chatbot/model/translation.helpers.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/api.types.d.ts +11 -12
- 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 +24 -19
- 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 +7 -9
- package/dist/typescript/module/features/chatbot/types/t2s.types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/translation.types.d.ts +2 -3
- package/dist/typescript/module/features/chatbot/types/translation.types.d.ts.map +1 -1
- package/dist/typescript/module/features/endOfAssignment/components/CorrectAnswer/AnimatedCard.d.ts.map +1 -1
- package/dist/typescript/module/features/endOfAssignment/ui/PracticeButtonGroup.d.ts.map +1 -1
- package/dist/typescript/module/index.d.ts +1 -0
- package/dist/typescript/module/index.d.ts.map +1 -1
- package/dist/typescript/module/lib/effector/createEntityFieldStore.d.ts +0 -2
- package/dist/typescript/module/lib/effector/createEntityFieldStore.d.ts.map +1 -1
- package/dist/typescript/module/shared/icons/icon.types.d.ts +0 -2
- package/dist/typescript/module/shared/icons/icon.types.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/constants.d.ts +0 -21
- package/dist/typescript/module/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/helpers.d.ts +2 -3
- package/dist/typescript/module/shared/translation/helpers.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/hooks.d.ts +2 -2
- package/dist/typescript/module/shared/translation/hooks.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/index.d.ts +1 -0
- package/dist/typescript/module/shared/translation/index.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/model.d.ts +3 -43
- package/dist/typescript/module/shared/translation/model.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/types.d.ts +4 -4
- package/dist/typescript/module/shared/translation/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/features/celebrations/config.ts +4 -4
- package/src/features/chatbot/components/Alternatives/Alternatives.tsx +4 -2
- package/src/features/chatbot/components/ChatMessage/ChatMessage.tsx +10 -7
- package/src/features/chatbot/components/ChatMessage/MessageTextToSpeech.tsx +51 -34
- package/src/features/chatbot/components/ChatMessage/ReceivedMessage.tsx +40 -15
- package/src/features/chatbot/components/ChatMessage/SentMessage.tsx +10 -9
- package/src/features/chatbot/components/ChatMessages/ChatbotMessages.tsx +34 -17
- package/src/features/chatbot/components/Chatbot.tsx +11 -5
- package/src/features/chatbot/index.ts +4 -3
- package/src/features/chatbot/model/{ChatBotThreadManager.ts → ChatBotMessageHandler.ts} +27 -53
- package/src/features/chatbot/model/ChatBotModel.ts +149 -151
- package/src/features/chatbot/model/DefaultMessageCreator.ts +16 -17
- package/src/features/chatbot/model/ThreadItem.ts +10 -15
- package/src/features/chatbot/model/{ChatbotApi.ts → api.ts} +2 -5
- package/src/features/chatbot/model/constants.ts +0 -2
- package/src/features/chatbot/model/messagesHelper.ts +7 -12
- package/src/features/chatbot/model/t2s.ts +13 -28
- package/src/features/chatbot/model/translation.helpers.ts +1 -2
- package/src/features/chatbot/model/translation.ts +24 -34
- package/src/features/chatbot/types/api.types.ts +12 -12
- package/src/features/chatbot/types/model.types.ts +32 -31
- package/src/features/chatbot/types/t2s.types.ts +15 -18
- package/src/features/chatbot/types/translation.types.ts +2 -3
- package/src/features/endOfAssignment/components/CorrectAnswer/AnimatedCard.tsx +2 -3
- package/src/features/endOfAssignment/ui/PracticeButtonGroup.tsx +1 -0
- package/src/index.ts +1 -0
- package/src/lib/effector/createEntityFieldStore.ts +1 -9
- package/{dist/commonjs/shared/translation → src/lib}/localization/en.json +1 -8
- package/src/{shared/translation → lib}/localization/gb.json +1 -8
- package/src/{shared/translation → lib}/localization/sw.json +1 -8
- package/src/shared/icons/icon.types.ts +6 -9
- package/src/shared/translation/constants.ts +3 -3
- package/src/shared/translation/helpers.ts +9 -22
- package/src/shared/translation/hooks.ts +16 -12
- package/src/shared/translation/index.ts +1 -0
- package/src/shared/translation/model.ts +8 -8
- package/src/shared/translation/types.ts +8 -11
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageButtonsBlock.js +0 -44
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageButtonsBlock.js.map +0 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageContent.js +0 -62
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageContent.js.map +0 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/helpers.js +0 -13
- package/dist/commonjs/features/chatbot/components/ChatMessage/helpers.js.map +0 -1
- package/dist/commonjs/features/chatbot/context/ChatBotModelContext.js +0 -17
- package/dist/commonjs/features/chatbot/context/ChatBotModelContext.js.map +0 -1
- package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingButton.js +0 -57
- package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingButton.js.map +0 -1
- package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.js +0 -130
- package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.js.map +0 -1
- package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js.map +0 -1
- package/dist/commonjs/features/chatbot/model/ChatBoxTextManager.js +0 -22
- package/dist/commonjs/features/chatbot/model/ChatBoxTextManager.js.map +0 -1
- package/dist/commonjs/features/chatbot/model/ChatbotApi.js.map +0 -1
- package/dist/commonjs/features/chatbot/model/ChatsCacheModel.js +0 -110
- package/dist/commonjs/features/chatbot/model/ChatsCacheModel.js.map +0 -1
- package/dist/commonjs/features/chatbot/types/units.types.js +0 -2
- package/dist/commonjs/features/chatbot/types/units.types.js.map +0 -1
- package/dist/commonjs/lib/effector/withEvent.js +0 -13
- package/dist/commonjs/lib/effector/withEvent.js.map +0 -1
- package/dist/commonjs/lib/types/keys.js +0 -2
- package/dist/commonjs/lib/types/keys.js.map +0 -1
- package/dist/commonjs/shared/icons/HighlighterIcon.js +0 -36
- package/dist/commonjs/shared/icons/HighlighterIcon.js.map +0 -1
- package/dist/commonjs/shared/icons/StopIcon.js +0 -33
- package/dist/commonjs/shared/icons/StopIcon.js.map +0 -1
- package/dist/commonjs/shared/translation/validation.types.js +0 -6
- package/dist/commonjs/shared/translation/validation.types.js.map +0 -1
- package/dist/module/features/chatbot/components/ChatMessage/MessageButtonsBlock.js +0 -38
- package/dist/module/features/chatbot/components/ChatMessage/MessageButtonsBlock.js.map +0 -1
- package/dist/module/features/chatbot/components/ChatMessage/MessageContent.js +0 -57
- package/dist/module/features/chatbot/components/ChatMessage/MessageContent.js.map +0 -1
- package/dist/module/features/chatbot/components/ChatMessage/helpers.js +0 -9
- package/dist/module/features/chatbot/components/ChatMessage/helpers.js.map +0 -1
- package/dist/module/features/chatbot/context/ChatBotModelContext.js +0 -12
- package/dist/module/features/chatbot/context/ChatBotModelContext.js.map +0 -1
- package/dist/module/features/chatbot/errorSpotting/ErrorSpottingButton.js +0 -51
- package/dist/module/features/chatbot/errorSpotting/ErrorSpottingButton.js.map +0 -1
- package/dist/module/features/chatbot/errorSpotting/ErrorSpottingModel.js +0 -125
- package/dist/module/features/chatbot/errorSpotting/ErrorSpottingModel.js.map +0 -1
- package/dist/module/features/chatbot/model/ChatBotThreadManager.js.map +0 -1
- package/dist/module/features/chatbot/model/ChatBoxTextManager.js +0 -17
- package/dist/module/features/chatbot/model/ChatBoxTextManager.js.map +0 -1
- package/dist/module/features/chatbot/model/ChatbotApi.js.map +0 -1
- package/dist/module/features/chatbot/model/ChatsCacheModel.js +0 -104
- package/dist/module/features/chatbot/model/ChatsCacheModel.js.map +0 -1
- package/dist/module/features/chatbot/types/units.types.js +0 -2
- package/dist/module/features/chatbot/types/units.types.js.map +0 -1
- package/dist/module/lib/effector/withEvent.js +0 -9
- package/dist/module/lib/effector/withEvent.js.map +0 -1
- package/dist/module/lib/types/keys.js +0 -2
- package/dist/module/lib/types/keys.js.map +0 -1
- package/dist/module/shared/icons/HighlighterIcon.js +0 -29
- package/dist/module/shared/icons/HighlighterIcon.js.map +0 -1
- package/dist/module/shared/icons/StopIcon.js +0 -26
- package/dist/module/shared/icons/StopIcon.js.map +0 -1
- package/dist/module/shared/translation/validation.types.js +0 -4
- package/dist/module/shared/translation/validation.types.js.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageButtonsBlock.d.ts +0 -10
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageButtonsBlock.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageContent.d.ts +0 -11
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageContent.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/helpers.d.ts +0 -4
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/helpers.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/context/ChatBotModelContext.d.ts +0 -4
- package/dist/typescript/commonjs/features/chatbot/context/ChatBotModelContext.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingButton.d.ts +0 -8
- package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingButton.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts +0 -35
- package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts +0 -33
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBoxTextManager.d.ts +0 -6
- package/dist/typescript/commonjs/features/chatbot/model/ChatBoxTextManager.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatbotApi.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatsCacheModel.d.ts +0 -27
- package/dist/typescript/commonjs/features/chatbot/model/ChatsCacheModel.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts +0 -34
- package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts.map +0 -1
- package/dist/typescript/commonjs/lib/effector/withEvent.d.ts +0 -2
- package/dist/typescript/commonjs/lib/effector/withEvent.d.ts.map +0 -1
- package/dist/typescript/commonjs/lib/types/keys.d.ts +0 -8
- package/dist/typescript/commonjs/lib/types/keys.d.ts.map +0 -1
- package/dist/typescript/commonjs/shared/icons/HighlighterIcon.d.ts +0 -4
- package/dist/typescript/commonjs/shared/icons/HighlighterIcon.d.ts.map +0 -1
- package/dist/typescript/commonjs/shared/icons/StopIcon.d.ts +0 -4
- package/dist/typescript/commonjs/shared/icons/StopIcon.d.ts.map +0 -1
- package/dist/typescript/commonjs/shared/translation/validation.types.d.ts +0 -17
- package/dist/typescript/commonjs/shared/translation/validation.types.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageButtonsBlock.d.ts +0 -10
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageButtonsBlock.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageContent.d.ts +0 -11
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageContent.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/helpers.d.ts +0 -4
- package/dist/typescript/module/features/chatbot/components/ChatMessage/helpers.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/context/ChatBotModelContext.d.ts +0 -4
- package/dist/typescript/module/features/chatbot/context/ChatBotModelContext.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingButton.d.ts +0 -8
- package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingButton.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts +0 -35
- package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts +0 -33
- package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/model/ChatBoxTextManager.d.ts +0 -6
- package/dist/typescript/module/features/chatbot/model/ChatBoxTextManager.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/model/ChatbotApi.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/model/ChatsCacheModel.d.ts +0 -27
- package/dist/typescript/module/features/chatbot/model/ChatsCacheModel.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/types/units.types.d.ts +0 -34
- package/dist/typescript/module/features/chatbot/types/units.types.d.ts.map +0 -1
- package/dist/typescript/module/lib/effector/withEvent.d.ts +0 -2
- package/dist/typescript/module/lib/effector/withEvent.d.ts.map +0 -1
- package/dist/typescript/module/lib/types/keys.d.ts +0 -8
- package/dist/typescript/module/lib/types/keys.d.ts.map +0 -1
- package/dist/typescript/module/shared/icons/HighlighterIcon.d.ts +0 -4
- package/dist/typescript/module/shared/icons/HighlighterIcon.d.ts.map +0 -1
- package/dist/typescript/module/shared/icons/StopIcon.d.ts +0 -4
- package/dist/typescript/module/shared/icons/StopIcon.d.ts.map +0 -1
- package/dist/typescript/module/shared/translation/validation.types.d.ts +0 -17
- package/dist/typescript/module/shared/translation/validation.types.d.ts.map +0 -1
- package/src/features/chatbot/components/ChatMessage/MessageButtonsBlock.tsx +0 -38
- package/src/features/chatbot/components/ChatMessage/MessageContent.tsx +0 -52
- package/src/features/chatbot/components/ChatMessage/helpers.ts +0 -9
- package/src/features/chatbot/context/ChatBotModelContext.ts +0 -14
- package/src/features/chatbot/errorSpotting/ErrorSpottingButton.tsx +0 -53
- package/src/features/chatbot/errorSpotting/ErrorSpottingModel.ts +0 -150
- package/src/features/chatbot/model/ChatBoxTextManager.ts +0 -18
- package/src/features/chatbot/model/ChatsCacheModel.ts +0 -95
- package/src/features/chatbot/types/units.types.ts +0 -37
- package/src/lib/effector/withEvent.ts +0 -7
- package/src/lib/types/keys.ts +0 -18
- package/src/shared/icons/HighlighterIcon.tsx +0 -21
- package/src/shared/icons/StopIcon.tsx +0 -17
- package/src/shared/translation/validation.types.ts +0 -26
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import enTranslations from './localization/en.json';
|
|
2
|
-
import swTranslations from './localization/sw.json';
|
|
3
|
-
import gbTranslations from './localization/gb.json';
|
|
4
|
-
type Extends<T, U> = T extends U ? true : false;
|
|
5
|
-
type ExtendsAll<Candidate, Types extends unknown[]> = Types extends [infer Head, ...infer Tail] ? Extends<Candidate, Head> extends true ? ExtendsAll<Candidate, Tail> : false : true;
|
|
6
|
-
type FindDominantType<Types extends unknown[]> = Types extends [
|
|
7
|
-
infer First,
|
|
8
|
-
...infer Rest extends unknown[]
|
|
9
|
-
] ? ExtendsAll<First, Rest> extends true ? First : FindDominantType<Rest> : never;
|
|
10
|
-
type DominantTranslation = FindDominantType<[
|
|
11
|
-
typeof enTranslations,
|
|
12
|
-
typeof swTranslations,
|
|
13
|
-
typeof gbTranslations
|
|
14
|
-
]>;
|
|
15
|
-
export type ISValidTranslation<T extends DominantTranslation> = T;
|
|
16
|
-
export {};
|
|
17
|
-
//# sourceMappingURL=validation.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validation.types.d.ts","sourceRoot":"","sources":["../../../../../src/shared/translation/validation.types.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,wBAAwB,CAAA;AACnD,OAAO,cAAc,MAAM,wBAAwB,CAAA;AACnD,OAAO,cAAc,MAAM,wBAAwB,CAAA;AAEnD,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,GAAG,KAAK,CAAA;AAE/C,KAAK,UAAU,CAAC,SAAS,EAAE,KAAK,SAAS,OAAO,EAAE,IAAI,KAAK,SAAS,CAAC,MAAM,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,GAC3F,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,IAAI,GACnC,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,GAC3B,KAAK,GACP,IAAI,CAAA;AAER,KAAK,gBAAgB,CAAC,KAAK,SAAS,OAAO,EAAE,IAAI,KAAK,SAAS;IAC7D,MAAM,KAAK;IACX,GAAG,MAAM,IAAI,SAAS,OAAO,EAAE;CAChC,GACG,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,IAAI,GAClC,KAAK,GACL,gBAAgB,CAAC,IAAI,CAAC,GACxB,KAAK,CAAA;AAET,KAAK,mBAAmB,GAAG,gBAAgB,CACzC;IAAC,OAAO,cAAc;IAAE,OAAO,cAAc;IAAE,OAAO,cAAc;CAAC,CACtE,CAAA;AAED,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,mBAAmB,IAAI,CAAC,CAAA"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { StyleSheet, View } from 'react-native'
|
|
3
|
-
import { ErrorSpottingButton } from '../../errorSpotting/ErrorSpottingButton'
|
|
4
|
-
import { MessageTextToSpeech } from './MessageTextToSpeech'
|
|
5
|
-
import { ConversationMessage } from '../../types/units.types'
|
|
6
|
-
import { IS_WEB } from '@magmamath/react-native-ui'
|
|
7
|
-
import { T2SState } from '../../types/t2s.types'
|
|
8
|
-
|
|
9
|
-
type MessageButtonsBlockProps = {
|
|
10
|
-
t2sState: T2SState
|
|
11
|
-
message: ConversationMessage
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const MessageButtonsBlock = ({ t2sState, message }: MessageButtonsBlockProps) => {
|
|
15
|
-
if (!t2sState.isEnabled && !message.isInitial) return null
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<View style={styles.container}>
|
|
19
|
-
{!!message.isInitial && <ErrorSpottingButton contextMessage={message} />}
|
|
20
|
-
{t2sState.isEnabled && <MessageTextToSpeech state={t2sState} message={message} />}
|
|
21
|
-
</View>
|
|
22
|
-
)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const styles = StyleSheet.create({
|
|
26
|
-
container: {
|
|
27
|
-
flexDirection: 'row',
|
|
28
|
-
gap: 8,
|
|
29
|
-
marginLeft: 'auto',
|
|
30
|
-
...(IS_WEB
|
|
31
|
-
? { float: 'right' }
|
|
32
|
-
: {
|
|
33
|
-
position: 'absolute',
|
|
34
|
-
bottom: 8,
|
|
35
|
-
right: 8,
|
|
36
|
-
}),
|
|
37
|
-
},
|
|
38
|
-
})
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { ConversationMessage } from '../../types/units.types'
|
|
2
|
-
import { T2SState } from '../../types/t2s.types'
|
|
3
|
-
import { Platform, StyleSheet, Text, View } from 'react-native'
|
|
4
|
-
import { MessageButtonsBlock } from './MessageButtonsBlock'
|
|
5
|
-
import { getSpacerSize } from './helpers'
|
|
6
|
-
import React from 'react'
|
|
7
|
-
|
|
8
|
-
type MessageContentProps = {
|
|
9
|
-
text: string
|
|
10
|
-
message: ConversationMessage
|
|
11
|
-
t2sState: T2SState
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const MessageContentWeb = ({ message, text, t2sState }: MessageContentProps) => {
|
|
15
|
-
return (
|
|
16
|
-
<Text style={styles.messageText}>
|
|
17
|
-
{text}
|
|
18
|
-
<MessageButtonsBlock message={message} t2sState={t2sState} />
|
|
19
|
-
</Text>
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const MessageContentMobile = ({ message, text, t2sState }: MessageContentProps) => {
|
|
24
|
-
return (
|
|
25
|
-
<>
|
|
26
|
-
<Text style={[styles.messageText, styles.mobileMessageText]}>
|
|
27
|
-
{text}
|
|
28
|
-
<View style={{ width: getSpacerSize(message, t2sState) }} />
|
|
29
|
-
</Text>
|
|
30
|
-
<MessageButtonsBlock message={message} t2sState={t2sState} />
|
|
31
|
-
</>
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export const MessageContent = Platform.select({
|
|
36
|
-
web: MessageContentWeb,
|
|
37
|
-
default: MessageContentMobile,
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
const styles = StyleSheet.create({
|
|
41
|
-
messageText: {
|
|
42
|
-
flex: 1,
|
|
43
|
-
fontSize: 20,
|
|
44
|
-
fontWeight: 400,
|
|
45
|
-
fontFamily: 'Buenos Aires',
|
|
46
|
-
color: '#33334D',
|
|
47
|
-
width: '100%',
|
|
48
|
-
},
|
|
49
|
-
mobileMessageText: {
|
|
50
|
-
lineHeight: 27,
|
|
51
|
-
},
|
|
52
|
-
})
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ConversationMessage } from '../../types/units.types'
|
|
2
|
-
import { T2SState } from '../../types/t2s.types'
|
|
3
|
-
|
|
4
|
-
export function getSpacerSize(message: ConversationMessage, t2sState: T2SState) {
|
|
5
|
-
if (!t2sState.isEnabled && !message.isInitial) return 0
|
|
6
|
-
if (t2sState.isEnabled && message.isInitial) return 164
|
|
7
|
-
if (t2sState.isEnabled) return 34
|
|
8
|
-
return 133
|
|
9
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from 'react'
|
|
2
|
-
import { ChatbotModel } from '../model/ChatBotModel'
|
|
3
|
-
|
|
4
|
-
export const ChatBotModelContext = createContext<ChatbotModel | null>(null)
|
|
5
|
-
|
|
6
|
-
export function useChatModel() {
|
|
7
|
-
const model = useContext(ChatBotModelContext)
|
|
8
|
-
if (!model) {
|
|
9
|
-
throw new Error(
|
|
10
|
-
'Something went wrong, you are probably trying to use component that is supposed to be inside ChatBotContext.Provider',
|
|
11
|
-
)
|
|
12
|
-
}
|
|
13
|
-
return model
|
|
14
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { Button, COLORS, StopIcon } from '@magmamath/react-native-ui'
|
|
3
|
-
import { useChatModel } from '../context/ChatBotModelContext'
|
|
4
|
-
import { useStoreMap, useUnit } from 'effector-react'
|
|
5
|
-
import { StyleSheet } from 'react-native'
|
|
6
|
-
import { HighlighterIcon } from '../../../shared/icons/HighlighterIcon'
|
|
7
|
-
import { ConversationMessage } from '../types/units.types'
|
|
8
|
-
import { useText } from '../../../shared/translation'
|
|
9
|
-
|
|
10
|
-
type ErrorSpottingButtonProps = {
|
|
11
|
-
contextMessage: ConversationMessage
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const ErrorSpottingButton = ({ contextMessage }: ErrorSpottingButtonProps) => {
|
|
15
|
-
const t = useText()
|
|
16
|
-
const model = useChatModel()
|
|
17
|
-
const activeErrorSpotting = useUnit(model.errorSpotting.$activeData)
|
|
18
|
-
const validationKey = useUnit(model.errorSpotting.$validationKey)
|
|
19
|
-
const isLoading = useUnit(model.errorSpotting.$isLoading)
|
|
20
|
-
const currentThread = useStoreMap(model.$currentChatData, (chatData) => chatData.currentThread)
|
|
21
|
-
|
|
22
|
-
const threadId = contextMessage.threadId
|
|
23
|
-
if (!currentThread?.strokes || (threadId && currentThread.id !== threadId)) {
|
|
24
|
-
return null
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const isActive = !!activeErrorSpotting?.isActive
|
|
28
|
-
return (
|
|
29
|
-
<Button
|
|
30
|
-
style={buttonStyles}
|
|
31
|
-
disabled={validationKey !== currentThread.strokesValidationKey}
|
|
32
|
-
isActive={isActive}
|
|
33
|
-
isLoading={isLoading}
|
|
34
|
-
variant={'secondary'}
|
|
35
|
-
colorScheme={'blue'}
|
|
36
|
-
size={'small'}
|
|
37
|
-
onPress={() => {
|
|
38
|
-
if (isLoading) return
|
|
39
|
-
model.errorSpotting.errorSpottingPressed({ message: contextMessage })
|
|
40
|
-
}}
|
|
41
|
-
icon={isActive ? <StopIcon color={COLORS.NEUTRAL_1} /> : <HighlighterIcon />}
|
|
42
|
-
>
|
|
43
|
-
{t('chat.showError')}
|
|
44
|
-
</Button>
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const buttonStyles = StyleSheet.create({
|
|
49
|
-
text: {
|
|
50
|
-
textTransform: 'uppercase',
|
|
51
|
-
paddingTop: 0.5,
|
|
52
|
-
},
|
|
53
|
-
})
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { ChatbotAPI } from '../model/ChatbotApi'
|
|
2
|
-
import { createEvent, createStore, sample, createEffect, Store } from 'effector'
|
|
3
|
-
import { ChatItem, ConversationMessage } from '../types/units.types'
|
|
4
|
-
import { ChatbotContext } from '../types/model.types'
|
|
5
|
-
|
|
6
|
-
type ErrorSpottingProps = {
|
|
7
|
-
api: ChatbotAPI
|
|
8
|
-
$currentChatData: Store<ChatItem>
|
|
9
|
-
$currentChatContext: Store<ChatbotContext | null>
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
type ActiveErrorSpottingData = {
|
|
13
|
-
isActive: boolean
|
|
14
|
-
isDisabled: boolean
|
|
15
|
-
strokesIds: string[]
|
|
16
|
-
validationKey: null | string
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
type ErrorSpottingReducerProps = {
|
|
20
|
-
chatData: ChatItem
|
|
21
|
-
activeSpotting: ActiveErrorSpottingData | null
|
|
22
|
-
message: ConversationMessage
|
|
23
|
-
context: ChatbotContext | null
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const AUTO_CLOSE_TIMEOUT = 5000
|
|
27
|
-
|
|
28
|
-
type ErrorSpottingPressedProps = {
|
|
29
|
-
message: ConversationMessage
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export class ErrorSpottingModel {
|
|
33
|
-
private readonly api: ChatbotAPI
|
|
34
|
-
|
|
35
|
-
public readonly errorSpottingPressed = createEvent<ErrorSpottingPressedProps>()
|
|
36
|
-
private readonly activeDataChanged = createEvent<ActiveErrorSpottingData | null>()
|
|
37
|
-
public readonly spottingHidden = createEvent()
|
|
38
|
-
|
|
39
|
-
public readonly $validationKey = createStore<string | null>(null)
|
|
40
|
-
public readonly $activeData = createStore<ActiveErrorSpottingData | null>(null)
|
|
41
|
-
.on(this.activeDataChanged, (_, payload) => payload)
|
|
42
|
-
.on(this.spottingHidden, (state) => {
|
|
43
|
-
if (state) return { ...state, isActive: false }
|
|
44
|
-
return null
|
|
45
|
-
})
|
|
46
|
-
.on(this.$validationKey, (state, payload) => {
|
|
47
|
-
if (!state || payload === null) return state
|
|
48
|
-
const isDisabled = payload !== state.validationKey
|
|
49
|
-
return { ...state, isDisabled, isActive: isDisabled ? false : state.isActive }
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
public readonly $isLoading
|
|
53
|
-
|
|
54
|
-
private closeTimeout: NodeJS.Timeout | null = null
|
|
55
|
-
|
|
56
|
-
public constructor({ api, $currentChatData, $currentChatContext }: ErrorSpottingProps) {
|
|
57
|
-
this.api = api
|
|
58
|
-
|
|
59
|
-
this.$isLoading = api.spotErrorFx.pending
|
|
60
|
-
|
|
61
|
-
this.$activeData.on($currentChatData, (state, payload) => {
|
|
62
|
-
if (!state || state.validationKey !== payload.currentThread?.strokesValidationKey) return null
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
sample({
|
|
66
|
-
clock: api.spotErrorFx.doneData,
|
|
67
|
-
source: {
|
|
68
|
-
chatData: $currentChatData,
|
|
69
|
-
activeSpotting: this.$activeData,
|
|
70
|
-
validationKey: this.$validationKey,
|
|
71
|
-
},
|
|
72
|
-
fn: (source, result) => {
|
|
73
|
-
const key = source.chatData.currentThread?.strokesValidationKey || null
|
|
74
|
-
const currentKey = source.validationKey
|
|
75
|
-
const isDisabled = !!currentKey && currentKey !== key
|
|
76
|
-
return {
|
|
77
|
-
validationKey: key,
|
|
78
|
-
strokesIds: result.highlightedStrokeIds,
|
|
79
|
-
isActive: !isDisabled,
|
|
80
|
-
isDisabled,
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
target: this.$activeData,
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
sample({
|
|
87
|
-
clock: this.errorSpottingPressed,
|
|
88
|
-
source: {
|
|
89
|
-
context: $currentChatContext,
|
|
90
|
-
chatData: $currentChatData,
|
|
91
|
-
activeSpotting: this.$activeData,
|
|
92
|
-
},
|
|
93
|
-
fn: (source, { message }) => ({ ...source, message }),
|
|
94
|
-
target: createEffect(
|
|
95
|
-
({ chatData, activeSpotting, message, context }: ErrorSpottingReducerProps) => {
|
|
96
|
-
if (!context) throw new Error('Trying to use error spotting in chat without context')
|
|
97
|
-
if (!chatData.currentThread?.strokes) return
|
|
98
|
-
if (!activeSpotting) {
|
|
99
|
-
return this.api
|
|
100
|
-
.spotErrorFx({
|
|
101
|
-
strokes: chatData.currentThread.strokes,
|
|
102
|
-
problemDescription: context.problem,
|
|
103
|
-
correctAnswer: context.problemAnswer,
|
|
104
|
-
userAnswer: context.answer ?? '',
|
|
105
|
-
hint: message.message,
|
|
106
|
-
})
|
|
107
|
-
.then(() => {
|
|
108
|
-
this.scheduleClose()
|
|
109
|
-
})
|
|
110
|
-
}
|
|
111
|
-
this.activeDataChanged({ ...activeSpotting, isActive: !activeSpotting.isActive })
|
|
112
|
-
this.scheduleClose()
|
|
113
|
-
},
|
|
114
|
-
),
|
|
115
|
-
})
|
|
116
|
-
|
|
117
|
-
this.activeDataChanged.watch((spotting) => {
|
|
118
|
-
if ((!spotting || !spotting.isActive) && this.closeTimeout) {
|
|
119
|
-
clearTimeout(this.closeTimeout)
|
|
120
|
-
this.closeTimeout = null
|
|
121
|
-
}
|
|
122
|
-
})
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
private scheduleClose() {
|
|
126
|
-
if (this.closeTimeout) clearTimeout(this.closeTimeout)
|
|
127
|
-
this.closeTimeout = setTimeout(() => {
|
|
128
|
-
this.spottingHidden()
|
|
129
|
-
this.closeTimeout = null
|
|
130
|
-
}, AUTO_CLOSE_TIMEOUT)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
public bindStrokesValidation($store: Store<string | null>) {
|
|
134
|
-
sample({
|
|
135
|
-
source: $store,
|
|
136
|
-
target: this.$validationKey,
|
|
137
|
-
})
|
|
138
|
-
return this
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
public abortPendingRequest() {
|
|
142
|
-
const isPending = this.api.spotErrorFx.pending.getState()
|
|
143
|
-
if (isPending) this.api.spotErrorFx.controller.abort()
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
public reset() {
|
|
147
|
-
this.activeDataChanged(null)
|
|
148
|
-
this.abortPendingRequest()
|
|
149
|
-
}
|
|
150
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { DefaultMessagesCreator } from './DefaultMessageCreator'
|
|
2
|
-
import { TranslationKeys } from '../../../shared/translation/types'
|
|
3
|
-
import { getText } from '../../../shared/translation/helpers'
|
|
4
|
-
import { ChatbotMessages } from '../types/model.types'
|
|
5
|
-
import { $localization } from '../../../shared/translation'
|
|
6
|
-
|
|
7
|
-
export class ChatBotTextManager {
|
|
8
|
-
private readonly messagesCreator = new DefaultMessagesCreator<TranslationKeys>({
|
|
9
|
-
textGetter: getText,
|
|
10
|
-
}).bindToLanguageChanged($localization.updates)
|
|
11
|
-
|
|
12
|
-
public readonly messages: ChatbotMessages = {
|
|
13
|
-
error: this.messagesCreator.createMessage('chat.errorMessage'),
|
|
14
|
-
start: this.messagesCreator.createMessage('chat.howCanIHelp'),
|
|
15
|
-
endMessage: this.messagesCreator.createMessage('chat.answerAgain'),
|
|
16
|
-
anotherHintOption: this.messagesCreator.createOption('chat.anotherHint'),
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { createEvent } from 'effector'
|
|
2
|
-
import { createEntityFieldStore } from '../../../lib/effector'
|
|
3
|
-
import { ChatAnswer, ChatItem, ConversationMessage } from '../types/units.types'
|
|
4
|
-
import { ThreadItem } from './ThreadItem'
|
|
5
|
-
|
|
6
|
-
type ReinitChatThreadSettings = {
|
|
7
|
-
initialOption: ChatAnswer
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
type UpdateProps = {
|
|
11
|
-
key: string
|
|
12
|
-
data: Partial<ChatItem>
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
type AddMessagesProps = {
|
|
16
|
-
messages: ConversationMessage[]
|
|
17
|
-
thread?: ThreadItem | null
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function defaultChatData(props: Partial<ChatItem> = {}): ChatItem {
|
|
21
|
-
return {
|
|
22
|
-
messages: [],
|
|
23
|
-
isAvailable: false,
|
|
24
|
-
currentThread: null,
|
|
25
|
-
...props,
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export class ChatsCacheModel {
|
|
30
|
-
public readonly update = createEvent<UpdateProps>()
|
|
31
|
-
private readonly cache = createEntityFieldStore<ChatItem>().on(
|
|
32
|
-
this.update,
|
|
33
|
-
(state, { key, data }) => {
|
|
34
|
-
const currentData = state[key] ?? defaultChatData()
|
|
35
|
-
return { ...state, [key]: { ...currentData, ...data } }
|
|
36
|
-
},
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
public readonly $data = this.cache.$state
|
|
40
|
-
public readonly reset = this.cache.reset
|
|
41
|
-
|
|
42
|
-
public disableChat(key: string) {
|
|
43
|
-
this.cache.setField({
|
|
44
|
-
key,
|
|
45
|
-
fn: (current) =>
|
|
46
|
-
current ? { ...current, isAvailable: false } : defaultChatData({ isAvailable: false }),
|
|
47
|
-
})
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
public reinitChatThread(key: string, { initialOption }: ReinitChatThreadSettings) {
|
|
51
|
-
this.cache.setField({
|
|
52
|
-
key,
|
|
53
|
-
fn: (current) => {
|
|
54
|
-
if (!current || current.messages.length <= 1) return
|
|
55
|
-
const copy = [...current.messages]
|
|
56
|
-
while (copy.at(-1)?.endMessage) {
|
|
57
|
-
copy.pop()
|
|
58
|
-
}
|
|
59
|
-
const lastMessage = copy.at(-1)
|
|
60
|
-
if (!lastMessage) return
|
|
61
|
-
copy.splice(copy.length - 1, 1, {
|
|
62
|
-
...lastMessage,
|
|
63
|
-
options: [initialOption],
|
|
64
|
-
})
|
|
65
|
-
return { ...current, messages: copy }
|
|
66
|
-
},
|
|
67
|
-
})
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
public setSingleMessage(key: string, message: ConversationMessage) {
|
|
71
|
-
this.cache.setField({
|
|
72
|
-
key,
|
|
73
|
-
fn: (current) => {
|
|
74
|
-
if (!current || current.messages.length > 1) return
|
|
75
|
-
return { ...current, messages: [message] }
|
|
76
|
-
},
|
|
77
|
-
})
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
public addMessages(key: string, { messages, thread = null }: AddMessagesProps) {
|
|
81
|
-
this.cache.setField({
|
|
82
|
-
key,
|
|
83
|
-
fn: (current) => {
|
|
84
|
-
if (!current) return defaultChatData({ messages, currentThread: thread })
|
|
85
|
-
const result = { ...current, messages: [...current.messages, ...messages] }
|
|
86
|
-
if (thread) result.currentThread = thread
|
|
87
|
-
return result
|
|
88
|
-
},
|
|
89
|
-
})
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
public add(key: string, data: ChatItem) {
|
|
93
|
-
this.cache.setField({ key, data })
|
|
94
|
-
}
|
|
95
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export type Stroke = {
|
|
2
|
-
x: number[]
|
|
3
|
-
y: number[]
|
|
4
|
-
}
|
|
5
|
-
export type FullStrokeData = Stroke & {
|
|
6
|
-
id: string
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export type IThreadItem = {
|
|
10
|
-
id: string
|
|
11
|
-
strokesValidationKey: string | null
|
|
12
|
-
strokes: FullStrokeData[] | null
|
|
13
|
-
history: string[]
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export type ChatAnswer = {
|
|
17
|
-
text: string
|
|
18
|
-
promptKey: string
|
|
19
|
-
translatedText?: string
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export type ConversationMessage = {
|
|
23
|
-
id: string
|
|
24
|
-
message: string
|
|
25
|
-
options: ChatAnswer[]
|
|
26
|
-
isOwnMessage: boolean
|
|
27
|
-
translatedMessage?: string
|
|
28
|
-
endMessage?: boolean
|
|
29
|
-
isInitial?: boolean
|
|
30
|
-
threadId?: string
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export type ChatItem = {
|
|
34
|
-
messages: ConversationMessage[]
|
|
35
|
-
isAvailable: boolean
|
|
36
|
-
currentThread: IThreadItem | null
|
|
37
|
-
}
|
package/src/lib/types/keys.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
type JoinKeys<K extends string, P extends string> = `${K}.${P}`
|
|
2
|
-
|
|
3
|
-
type NestedKeys<T, Prefix extends string = ''> = T extends object
|
|
4
|
-
? T extends Array<any>
|
|
5
|
-
? never
|
|
6
|
-
: {
|
|
7
|
-
[K in keyof T & string]: T[K] extends object
|
|
8
|
-
?
|
|
9
|
-
| JoinKeys<Prefix extends '' ? K : `${Prefix}.${K}`, NestedKeys<T[K], ''>>
|
|
10
|
-
| (Prefix extends '' ? K : `${Prefix}.${K}`)
|
|
11
|
-
: Prefix extends ''
|
|
12
|
-
? K
|
|
13
|
-
: `${Prefix}.${K}`
|
|
14
|
-
}[keyof T & string]
|
|
15
|
-
: never
|
|
16
|
-
|
|
17
|
-
type FlattenKeys<T> = T extends string ? T : never
|
|
18
|
-
export type RetrieveKeys<T> = FlattenKeys<NestedKeys<T>>
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import Svg, { Path } from 'react-native-svg'
|
|
3
|
-
import { IconProps } from './icon.types'
|
|
4
|
-
import { COLORS } from '@magmamath/react-native-ui'
|
|
5
|
-
|
|
6
|
-
export function HighlighterIcon({ size = 17, color = COLORS.NEUTRAL_9, style }: IconProps) {
|
|
7
|
-
return (
|
|
8
|
-
<Svg style={style} width={size} height={size} viewBox="0 0 17 17" fill="none">
|
|
9
|
-
<Path
|
|
10
|
-
d="M6.02 1.557a.596.596 0 011.108 0l.42 1.067c.06.153.182.275.336.335l1.066.42a.596.596 0 010 1.109l-1.066.42a.596.596 0 00-.336.336l-.42 1.066a.596.596 0 01-1.109 0L5.6 5.244a.596.596 0 00-.336-.336l-1.066-.42a.596.596 0 010-1.108l1.066-.42a.596.596 0 00.336-.336l.42-1.067z"
|
|
11
|
-
fill={color}
|
|
12
|
-
/>
|
|
13
|
-
<Path
|
|
14
|
-
fillRule="evenodd"
|
|
15
|
-
clipRule="evenodd"
|
|
16
|
-
d="M8.843 3.338l-.974.73-2.11 1.583.26.66a.596.596 0 001.109 0l.42-1.067a.596.596 0 01.336-.336l1.066-.42a.596.596 0 000-1.108l-.107-.042zm.67-.502c.497.346.665.964.506 1.495l.476-.357 2.868 2.868-3.636 4.849-4.08-4.08.38-.286a1.316 1.316 0 01-.705-.74l-.185-.468-.898.674a.95.95 0 00-.33 1.065 1.75 1.75 0 00-.2.53l-.602 3.016-1.752 1.752a.95.95 0 00.297 1.545l1.83.784a1.35 1.35 0 001.487-.286l.966-.966 3.016-.604c.187-.037.366-.105.53-.199a.95.95 0 001.065-.33l5.445-7.26a2.25 2.25 0 00-.209-2.94L14.44 1.554a2.25 2.25 0 00-2.941-.209l-1.986 1.49zm3.866-.22a.75.75 0 00-.98-.07l-.692.519 2.565 2.565.52-.692a.75.75 0 00-.07-.98l-1.343-1.342zM3.797 12.832l-.807.808.99.425.525-.525-.708-.707zm2.015-.107l2.357-.47-3.086-3.087-.471 2.357 1.2 1.2z"
|
|
17
|
-
fill={color}
|
|
18
|
-
/>
|
|
19
|
-
</Svg>
|
|
20
|
-
)
|
|
21
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import Svg, { Path } from 'react-native-svg'
|
|
3
|
-
import { IconProps } from './icon.types'
|
|
4
|
-
import { COLORS } from '@magmamath/react-native-ui'
|
|
5
|
-
|
|
6
|
-
export function StopIcon({ size = 17, color = COLORS.NEUTRAL_9, style }: IconProps) {
|
|
7
|
-
return (
|
|
8
|
-
<Svg width={size} height={size} viewBox="0 0 17 17" fill="none" style={style}>
|
|
9
|
-
<Path
|
|
10
|
-
fillRule="evenodd"
|
|
11
|
-
clipRule="evenodd"
|
|
12
|
-
d="M1.759 2.996c0-.967.784-1.752 1.752-1.752h10.496c.967 0 1.752.785 1.752 1.752v10.496c0 .968-.785 1.752-1.752 1.752H3.51a1.752 1.752 0 01-1.752-1.752V2.996z"
|
|
13
|
-
fill={color}
|
|
14
|
-
/>
|
|
15
|
-
</Svg>
|
|
16
|
-
)
|
|
17
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import enTranslations from './localization/en.json'
|
|
2
|
-
import swTranslations from './localization/sw.json'
|
|
3
|
-
import gbTranslations from './localization/gb.json'
|
|
4
|
-
|
|
5
|
-
type Extends<T, U> = T extends U ? true : false
|
|
6
|
-
|
|
7
|
-
type ExtendsAll<Candidate, Types extends unknown[]> = Types extends [infer Head, ...infer Tail]
|
|
8
|
-
? Extends<Candidate, Head> extends true
|
|
9
|
-
? ExtendsAll<Candidate, Tail>
|
|
10
|
-
: false
|
|
11
|
-
: true
|
|
12
|
-
|
|
13
|
-
type FindDominantType<Types extends unknown[]> = Types extends [
|
|
14
|
-
infer First,
|
|
15
|
-
...infer Rest extends unknown[],
|
|
16
|
-
]
|
|
17
|
-
? ExtendsAll<First, Rest> extends true
|
|
18
|
-
? First
|
|
19
|
-
: FindDominantType<Rest>
|
|
20
|
-
: never
|
|
21
|
-
|
|
22
|
-
type DominantTranslation = FindDominantType<
|
|
23
|
-
[typeof enTranslations, typeof swTranslations, typeof gbTranslations]
|
|
24
|
-
>
|
|
25
|
-
|
|
26
|
-
export type ISValidTranslation<T extends DominantTranslation> = T
|