@magmamath/students-features 0.5.0 → 0.5.1-rc-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/features/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/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/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/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/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/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,35 +0,0 @@
|
|
|
1
|
-
import { ChatbotAPI } from '../model/ChatbotApi';
|
|
2
|
-
import { Store } from 'effector';
|
|
3
|
-
import { ChatItem, ConversationMessage } from '../types/units.types';
|
|
4
|
-
import { ChatbotContext } from '../types/model.types';
|
|
5
|
-
type ErrorSpottingProps = {
|
|
6
|
-
api: ChatbotAPI;
|
|
7
|
-
$currentChatData: Store<ChatItem>;
|
|
8
|
-
$currentChatContext: Store<ChatbotContext | null>;
|
|
9
|
-
};
|
|
10
|
-
type ActiveErrorSpottingData = {
|
|
11
|
-
isActive: boolean;
|
|
12
|
-
isDisabled: boolean;
|
|
13
|
-
strokesIds: string[];
|
|
14
|
-
validationKey: null | string;
|
|
15
|
-
};
|
|
16
|
-
type ErrorSpottingPressedProps = {
|
|
17
|
-
message: ConversationMessage;
|
|
18
|
-
};
|
|
19
|
-
export declare class ErrorSpottingModel {
|
|
20
|
-
private readonly api;
|
|
21
|
-
readonly errorSpottingPressed: import("effector").EventCallable<ErrorSpottingPressedProps>;
|
|
22
|
-
private readonly activeDataChanged;
|
|
23
|
-
readonly spottingHidden: import("effector").EventCallable<void>;
|
|
24
|
-
readonly $validationKey: import("effector").StoreWritable<string | null>;
|
|
25
|
-
readonly $activeData: import("effector").StoreWritable<ActiveErrorSpottingData | null>;
|
|
26
|
-
readonly $isLoading: Store<boolean>;
|
|
27
|
-
private closeTimeout;
|
|
28
|
-
constructor({ api, $currentChatData, $currentChatContext }: ErrorSpottingProps);
|
|
29
|
-
private scheduleClose;
|
|
30
|
-
bindStrokesValidation($store: Store<string | null>): this;
|
|
31
|
-
abortPendingRequest(): void;
|
|
32
|
-
reset(): void;
|
|
33
|
-
}
|
|
34
|
-
export {};
|
|
35
|
-
//# sourceMappingURL=ErrorSpottingModel.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorSpottingModel.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/errorSpotting/ErrorSpottingModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAkD,KAAK,EAAE,MAAM,UAAU,CAAA;AAChF,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD,KAAK,kBAAkB,GAAG;IACxB,GAAG,EAAE,UAAU,CAAA;IACf,gBAAgB,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;IACjC,mBAAmB,EAAE,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;CAClD,CAAA;AAED,KAAK,uBAAuB,GAAG;IAC7B,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;IACnB,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,aAAa,EAAE,IAAI,GAAG,MAAM,CAAA;CAC7B,CAAA;AAWD,KAAK,yBAAyB,GAAG;IAC/B,OAAO,EAAE,mBAAmB,CAAA;CAC7B,CAAA;AAED,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAY;IAEhC,SAAgB,oBAAoB,8DAA2C;IAC/E,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAgD;IAClF,SAAgB,cAAc,yCAAgB;IAE9C,SAAgB,cAAc,kDAAmC;IACjE,SAAgB,WAAW,mEAUvB;IAEJ,SAAgB,UAAU,iBAAA;IAE1B,OAAO,CAAC,YAAY,CAA8B;gBAE/B,EAAE,GAAG,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,EAAE,kBAAkB;IAqErF,OAAO,CAAC,aAAa;IAQd,qBAAqB,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;IAQlD,mBAAmB;IAKnB,KAAK;CAIb"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ThreadItem } from './ThreadItem';
|
|
2
|
-
import { Store } from 'effector';
|
|
3
|
-
import { ChatHintPayload, ChatHintResponse, PostMessagePayload, PostMessageResponse } from '../types/api.types';
|
|
4
|
-
import { ChatbotMessages, IChatDrawBoardAdapter } from '../types/model.types';
|
|
5
|
-
type ThreadManagerApi = {
|
|
6
|
-
getHint: (props: ChatHintPayload) => Promise<ChatHintResponse>;
|
|
7
|
-
};
|
|
8
|
-
type ChatBotThreadManagerProps = {
|
|
9
|
-
messagesLimit?: number;
|
|
10
|
-
drawBoardAdapter?: IChatDrawBoardAdapter;
|
|
11
|
-
messages: ChatbotMessages;
|
|
12
|
-
api?: ThreadManagerApi;
|
|
13
|
-
};
|
|
14
|
-
export declare class ChatBotThreadManager {
|
|
15
|
-
private api;
|
|
16
|
-
private drawBoardAdapter;
|
|
17
|
-
private readonly threads;
|
|
18
|
-
private messagesLimit;
|
|
19
|
-
private currentKey;
|
|
20
|
-
private currentBinding;
|
|
21
|
-
private readonly defaultMessages;
|
|
22
|
-
constructor({ drawBoardAdapter, api, messagesLimit, messages, }: ChatBotThreadManagerProps);
|
|
23
|
-
bindKeyStore($store: Store<string>): this;
|
|
24
|
-
private getThreadItem;
|
|
25
|
-
setDrawBoardAdapter(adapter: IChatDrawBoardAdapter): void;
|
|
26
|
-
readonly postMessage: ({ problemAnswer, problem, answer, language, imageAltText, }: PostMessagePayload) => Promise<PostMessageResponse>;
|
|
27
|
-
get(key: string): ThreadItem | undefined;
|
|
28
|
-
reset(key?: string): void;
|
|
29
|
-
setMessagesLimit(limit: number): void;
|
|
30
|
-
setApi(api: ThreadManagerApi): this;
|
|
31
|
-
}
|
|
32
|
-
export {};
|
|
33
|
-
//# sourceMappingURL=ChatBotThreadManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChatBotThreadManager.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/ChatBotThreadManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAG7E,KAAK,gBAAgB,GAAG;IACtB,OAAO,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAA;CAC/D,CAAA;AAED,KAAK,yBAAyB,GAAG;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,gBAAgB,CAAC,EAAE,qBAAqB,CAAA;IACxC,QAAQ,EAAE,eAAe,CAAA;IACzB,GAAG,CAAC,EAAE,gBAAgB,CAAA;CACvB,CAAA;AAED,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,GAAG,CAAgC;IAC3C,OAAO,CAAC,gBAAgB,CAAqC;IAC7D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgC;IAExD,OAAO,CAAC,aAAa,CAAA;IACrB,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,cAAc,CAA4B;IAElD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAA;gBAEb,EACjB,gBAAgB,EAChB,GAAG,EACH,aAA6D,EAC7D,QAAQ,GACT,EAAE,yBAAyB;IAOrB,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;YAQ3B,aAAa;IAqBpB,mBAAmB,CAAC,OAAO,EAAE,qBAAqB;IAIzD,SAAgB,WAAW,gEAMxB,kBAAkB,KAAG,OAAO,CAAC,mBAAmB,CAAC,CA2BnD;IAEM,GAAG,CAAC,GAAG,EAAE,MAAM;IAIf,KAAK,CAAC,GAAG,CAAC,EAAE,MAAM;IAQlB,gBAAgB,CAAC,KAAK,EAAE,MAAM;IAI9B,MAAM,CAAC,GAAG,EAAE,gBAAgB;CAIpC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChatBoxTextManager.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/ChatBoxTextManager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAGtD,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAEe;IAE/C,SAAgB,QAAQ,EAAE,eAAe,CAKxC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChatbotApi.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/ChatbotApi.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAGpF,qBAAa,UAAU;IACrB,SAAgB,aAAa,6KAAA;IAC7B,SAAgB,iBAAiB,8IAAA;IACjC,SAAgB,eAAe,oFAAA;IAC/B,SAAgB,kBAAkB,kJAAA;IAElC,SAAgB,WAAW,iLAAA;gBAEf,GAAG,EAAE,kBAAkB;CAyBpC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ChatAnswer, ChatItem, ConversationMessage } from '../types/units.types';
|
|
2
|
-
import { ThreadItem } from './ThreadItem';
|
|
3
|
-
type ReinitChatThreadSettings = {
|
|
4
|
-
initialOption: ChatAnswer;
|
|
5
|
-
};
|
|
6
|
-
type UpdateProps = {
|
|
7
|
-
key: string;
|
|
8
|
-
data: Partial<ChatItem>;
|
|
9
|
-
};
|
|
10
|
-
type AddMessagesProps = {
|
|
11
|
-
messages: ConversationMessage[];
|
|
12
|
-
thread?: ThreadItem | null;
|
|
13
|
-
};
|
|
14
|
-
export declare function defaultChatData(props?: Partial<ChatItem>): ChatItem;
|
|
15
|
-
export declare class ChatsCacheModel {
|
|
16
|
-
readonly update: import("effector").EventCallable<UpdateProps>;
|
|
17
|
-
private readonly cache;
|
|
18
|
-
readonly $data: import("effector").StoreWritable<Record<string, ChatItem>>;
|
|
19
|
-
readonly reset: import("effector").EventCallable<void>;
|
|
20
|
-
disableChat(key: string): void;
|
|
21
|
-
reinitChatThread(key: string, { initialOption }: ReinitChatThreadSettings): void;
|
|
22
|
-
setSingleMessage(key: string, message: ConversationMessage): void;
|
|
23
|
-
addMessages(key: string, { messages, thread }: AddMessagesProps): void;
|
|
24
|
-
add(key: string, data: ChatItem): void;
|
|
25
|
-
}
|
|
26
|
-
export {};
|
|
27
|
-
//# sourceMappingURL=ChatsCacheModel.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChatsCacheModel.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/ChatsCacheModel.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,KAAK,wBAAwB,GAAG;IAC9B,aAAa,EAAE,UAAU,CAAA;CAC1B,CAAA;AAED,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAA;CACxB,CAAA;AAED,KAAK,gBAAgB,GAAG;IACtB,QAAQ,EAAE,mBAAmB,EAAE,CAAA;IAC/B,MAAM,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;CAC3B,CAAA;AAED,wBAAgB,eAAe,CAAC,KAAK,GAAE,OAAO,CAAC,QAAQ,CAAM,GAAG,QAAQ,CAOvE;AAED,qBAAa,eAAe;IAC1B,SAAgB,MAAM,gDAA6B;IACnD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAMrB;IAED,SAAgB,KAAK,6DAAoB;IACzC,SAAgB,KAAK,yCAAmB;IAEjC,WAAW,CAAC,GAAG,EAAE,MAAM;IAQvB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,aAAa,EAAE,EAAE,wBAAwB;IAoBzE,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB;IAU1D,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAa,EAAE,EAAE,gBAAgB;IAYtE,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ;CAGvC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export type Stroke = {
|
|
2
|
-
x: number[];
|
|
3
|
-
y: number[];
|
|
4
|
-
};
|
|
5
|
-
export type FullStrokeData = Stroke & {
|
|
6
|
-
id: string;
|
|
7
|
-
};
|
|
8
|
-
export type IThreadItem = {
|
|
9
|
-
id: string;
|
|
10
|
-
strokesValidationKey: string | null;
|
|
11
|
-
strokes: FullStrokeData[] | null;
|
|
12
|
-
history: string[];
|
|
13
|
-
};
|
|
14
|
-
export type ChatAnswer = {
|
|
15
|
-
text: string;
|
|
16
|
-
promptKey: string;
|
|
17
|
-
translatedText?: string;
|
|
18
|
-
};
|
|
19
|
-
export type ConversationMessage = {
|
|
20
|
-
id: string;
|
|
21
|
-
message: string;
|
|
22
|
-
options: ChatAnswer[];
|
|
23
|
-
isOwnMessage: boolean;
|
|
24
|
-
translatedMessage?: string;
|
|
25
|
-
endMessage?: boolean;
|
|
26
|
-
isInitial?: boolean;
|
|
27
|
-
threadId?: string;
|
|
28
|
-
};
|
|
29
|
-
export type ChatItem = {
|
|
30
|
-
messages: ConversationMessage[];
|
|
31
|
-
isAvailable: boolean;
|
|
32
|
-
currentThread: IThreadItem | null;
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=units.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"units.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/units.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG;IACnB,CAAC,EAAE,MAAM,EAAE,CAAA;IACX,CAAC,EAAE,MAAM,EAAE,CAAA;CACZ,CAAA;AACD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG;IACpC,EAAE,EAAE,MAAM,CAAA;CACX,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,OAAO,EAAE,cAAc,EAAE,GAAG,IAAI,CAAA;IAChC,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,YAAY,EAAE,OAAO,CAAA;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,EAAE,mBAAmB,EAAE,CAAA;IAC/B,WAAW,EAAE,OAAO,CAAA;IACpB,aAAa,EAAE,WAAW,GAAG,IAAI,CAAA;CAClC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withEvent.d.ts","sourceRoot":"","sources":["../../../../../src/lib/effector/withEvent.ts"],"names":[],"mappings":"AAEA,wBAAgB,SAAS,CAAC,CAAC,GAAG,IAAI,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,uCAIzD"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
type JoinKeys<K extends string, P extends string> = `${K}.${P}`;
|
|
2
|
-
type NestedKeys<T, Prefix extends string = ''> = T extends object ? T extends Array<any> ? never : {
|
|
3
|
-
[K in keyof T & string]: T[K] extends object ? JoinKeys<Prefix extends '' ? K : `${Prefix}.${K}`, NestedKeys<T[K], ''>> | (Prefix extends '' ? K : `${Prefix}.${K}`) : Prefix extends '' ? K : `${Prefix}.${K}`;
|
|
4
|
-
}[keyof T & string] : never;
|
|
5
|
-
type FlattenKeys<T> = T extends string ? T : never;
|
|
6
|
-
export type RetrieveKeys<T> = FlattenKeys<NestedKeys<T>>;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=keys.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../../../../src/lib/types/keys.ts"],"names":[],"mappings":"AAAA,KAAK,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,EAAE,CAAA;AAE/D,KAAK,UAAU,CAAC,CAAC,EAAE,MAAM,SAAS,MAAM,GAAG,EAAE,IAAI,CAAC,SAAS,MAAM,GAC7D,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,GAClB,KAAK,GACL;KACG,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAEpC,QAAQ,CAAC,MAAM,SAAS,EAAE,GAAG,CAAC,GAAG,GAAG,MAAM,IAAI,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GACxE,CAAC,MAAM,SAAS,EAAE,GAAG,CAAC,GAAG,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,GAC9C,MAAM,SAAS,EAAE,GACf,CAAC,GACD,GAAG,MAAM,IAAI,CAAC,EAAE;CACvB,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,GACrB,KAAK,CAAA;AAET,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,KAAK,CAAA;AAClD,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HighlighterIcon.d.ts","sourceRoot":"","sources":["../../../../../src/shared/icons/HighlighterIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAGxC,wBAAgB,eAAe,CAAC,EAAE,IAAS,EAAE,KAAwB,EAAE,KAAK,EAAE,EAAE,SAAS,qBAexF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StopIcon.d.ts","sourceRoot":"","sources":["../../../../../src/shared/icons/StopIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAGxC,wBAAgB,QAAQ,CAAC,EAAE,IAAS,EAAE,KAAwB,EAAE,KAAK,EAAE,EAAE,SAAS,qBAWjF"}
|
|
@@ -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
|
-
}
|