@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
|
@@ -2,32 +2,30 @@ import { attach, createEffect, createEvent, EventCallable, restore, sample, Stor
|
|
|
2
2
|
import {
|
|
3
3
|
AddTranslationToAlternativesProps,
|
|
4
4
|
TranslateBatchFxProps,
|
|
5
|
-
|
|
5
|
+
TranslateMessageFxProps,
|
|
6
6
|
TranslateRequestProps,
|
|
7
7
|
} from '../types/translation.types'
|
|
8
|
-
import { ChatbotContext, ChatbotMessages } from '../types/model.types'
|
|
8
|
+
import { ChatbotContext, ChatbotMessages, ConversationMessage } from '../types/model.types'
|
|
9
9
|
import { GetAlternativesResponse } from '../types/api.types'
|
|
10
10
|
import { decodeHTMLEntities } from '../helpers'
|
|
11
|
-
import { ChatbotAPI } from './
|
|
11
|
+
import { ChatbotAPI } from './api'
|
|
12
|
+
import { EntityFieldStore } from '../../../lib/effector/createEntityFieldStore'
|
|
12
13
|
import {
|
|
13
14
|
addTranslationsToAlternative,
|
|
14
15
|
addTranslationToOptions,
|
|
15
16
|
getOptionsForTranslation,
|
|
16
17
|
} from './translation.helpers'
|
|
17
18
|
|
|
18
|
-
import { ChatsCacheModel } from './ChatsCacheModel'
|
|
19
|
-
import { ConversationMessage } from '../types/units.types'
|
|
20
|
-
|
|
21
19
|
type ChatbotTranslationProps = {
|
|
22
20
|
api: ChatbotAPI
|
|
23
21
|
$key: Store<string>
|
|
24
22
|
defaultMessages: ChatbotMessages
|
|
23
|
+
messagesModel: EntityFieldStore<ConversationMessage[]>
|
|
25
24
|
$context: Store<ChatbotContext | null>
|
|
26
25
|
alternativesModel: {
|
|
27
26
|
set: EventCallable<GetAlternativesResponse | null>
|
|
28
27
|
$store: Store<GetAlternativesResponse | null>
|
|
29
28
|
}
|
|
30
|
-
chats: ChatsCacheModel
|
|
31
29
|
}
|
|
32
30
|
|
|
33
31
|
export class ChatbotTranslation {
|
|
@@ -35,54 +33,39 @@ export class ChatbotTranslation {
|
|
|
35
33
|
private readonly $key
|
|
36
34
|
private readonly $context
|
|
37
35
|
private readonly defaultMessages
|
|
36
|
+
private readonly messagesModel
|
|
38
37
|
private readonly alternativesModel
|
|
39
38
|
|
|
40
39
|
readonly setIsTranslated = createEvent<boolean>()
|
|
41
40
|
readonly $isTranslated = restore(this.setIsTranslated, false)
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
public readonly applyTranslationFx
|
|
42
|
+
readonly translateAllMessagesFx
|
|
45
43
|
|
|
46
44
|
constructor({
|
|
47
45
|
api,
|
|
48
46
|
$key,
|
|
49
47
|
defaultMessages,
|
|
48
|
+
messagesModel,
|
|
50
49
|
alternativesModel,
|
|
51
50
|
$context,
|
|
52
|
-
chats,
|
|
53
51
|
}: ChatbotTranslationProps) {
|
|
54
52
|
this.api = api
|
|
55
53
|
this.$key = $key
|
|
56
54
|
this.$context = $context
|
|
57
55
|
this.defaultMessages = defaultMessages
|
|
56
|
+
this.messagesModel = messagesModel
|
|
58
57
|
this.alternativesModel = alternativesModel
|
|
59
58
|
|
|
60
|
-
this.applyTranslationFx = attach({
|
|
61
|
-
source: [this.$isTranslated, this.$context],
|
|
62
|
-
mapParams: (messages: ConversationMessage[], [isTranslationActive, context]) => ({
|
|
63
|
-
messages,
|
|
64
|
-
targetLanguage: context?.translationTargetLanguage ?? '',
|
|
65
|
-
isTranslationActive,
|
|
66
|
-
}),
|
|
67
|
-
effect: this.translateMessagesFx,
|
|
68
|
-
})
|
|
69
|
-
|
|
70
59
|
this.translateAllMessagesFx = attach({
|
|
71
|
-
source: [this.$key,
|
|
72
|
-
mapParams: (_: void, [key,
|
|
60
|
+
source: [this.$key, this.messagesModel.$state, this.alternativesModel.$store, this.$context],
|
|
61
|
+
mapParams: (_: void, [key, messages, alternatives, context]) => ({
|
|
73
62
|
targetLanguage: context?.translationTargetLanguage ?? '',
|
|
74
|
-
messages:
|
|
63
|
+
messages: messages[key] ?? [],
|
|
75
64
|
alternatives,
|
|
76
65
|
}),
|
|
77
66
|
effect: this.translateBatchFx,
|
|
78
67
|
})
|
|
79
|
-
|
|
80
|
-
sample({
|
|
81
|
-
clock: this.translateAllMessagesFx.doneData,
|
|
82
|
-
source: [this.$key] as const,
|
|
83
|
-
fn: ([key], translatedMessages) => ({ key, data: { messages: translatedMessages } }),
|
|
84
|
-
target: chats.update,
|
|
85
|
-
})
|
|
68
|
+
this.initTranslationSamples()
|
|
86
69
|
}
|
|
87
70
|
|
|
88
71
|
private shouldSkipTranslation(messages: ConversationMessage[]) {
|
|
@@ -100,6 +83,15 @@ export class ChatbotTranslation {
|
|
|
100
83
|
return false
|
|
101
84
|
}
|
|
102
85
|
|
|
86
|
+
private initTranslationSamples() {
|
|
87
|
+
sample({
|
|
88
|
+
clock: this.translateAllMessagesFx.doneData,
|
|
89
|
+
source: [this.$key] as const,
|
|
90
|
+
fn: ([key], translatedMessages) => ({ key, data: translatedMessages }),
|
|
91
|
+
target: this.messagesModel.setField,
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
|
|
103
95
|
private async translateRequest<List extends Record<string, string[]>>({
|
|
104
96
|
textList,
|
|
105
97
|
targetLanguage,
|
|
@@ -175,13 +167,11 @@ export class ChatbotTranslation {
|
|
|
175
167
|
},
|
|
176
168
|
)
|
|
177
169
|
|
|
178
|
-
|
|
170
|
+
public readonly translateMessagesFx = createEffect(
|
|
179
171
|
async ({
|
|
180
172
|
messages,
|
|
181
173
|
targetLanguage,
|
|
182
|
-
|
|
183
|
-
}: ApplyTranslationProps): Promise<ConversationMessage[]> => {
|
|
184
|
-
if (!isTranslationActive || !targetLanguage) return messages
|
|
174
|
+
}: TranslateMessageFxProps): Promise<ConversationMessage[]> => {
|
|
185
175
|
const text = messages
|
|
186
176
|
.map(({ options, message }) => {
|
|
187
177
|
return [message, ...options.map(({ text }) => text)]
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
export type ChatAnswer = {
|
|
2
|
+
text: string
|
|
3
|
+
promptKey: string
|
|
4
|
+
translatedText?: string
|
|
5
|
+
}
|
|
2
6
|
|
|
3
7
|
export type GetAlternativesPayload = {
|
|
4
8
|
municipalityId: string
|
|
@@ -17,15 +21,16 @@ export type PostMessagePayload = {
|
|
|
17
21
|
language: string
|
|
18
22
|
problemAnswer: string[]
|
|
19
23
|
answer?: string | string[]
|
|
24
|
+
threadId?: string | null
|
|
20
25
|
problem: string
|
|
21
26
|
imageAltText?: string
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
export type PostMessageResponse = {
|
|
25
30
|
message: string
|
|
31
|
+
threadId: string
|
|
26
32
|
options: ChatAnswer[]
|
|
27
33
|
endMessage?: boolean
|
|
28
|
-
threadId: string
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
export type GoogleTranslatePayload = {
|
|
@@ -56,6 +61,11 @@ export type GoogleText2SpeechPayload = {
|
|
|
56
61
|
|
|
57
62
|
export type GoogleText2SpeechResponse = string | undefined | { audioContent?: string }
|
|
58
63
|
|
|
64
|
+
export type Stroke = {
|
|
65
|
+
x: number[]
|
|
66
|
+
y: number[]
|
|
67
|
+
}
|
|
68
|
+
|
|
59
69
|
export type ChatHintPayload = {
|
|
60
70
|
problemDescription: string
|
|
61
71
|
correctAnswer: string[]
|
|
@@ -69,13 +79,3 @@ export type ChatHintPayload = {
|
|
|
69
79
|
export type ChatHintResponse = {
|
|
70
80
|
message: string
|
|
71
81
|
}
|
|
72
|
-
export type ErrorSpottingPayload = {
|
|
73
|
-
strokes: FullStrokeData[]
|
|
74
|
-
problemDescription: string
|
|
75
|
-
correctAnswer: string[]
|
|
76
|
-
userAnswer: string | string[]
|
|
77
|
-
hint: string
|
|
78
|
-
}
|
|
79
|
-
export type ErrorSpottingResponse = {
|
|
80
|
-
highlightedStrokeIds: string[]
|
|
81
|
-
}
|
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import type { Store } from 'effector'
|
|
2
2
|
import {
|
|
3
|
-
ChatHintPayload,
|
|
4
|
-
ChatHintResponse,
|
|
5
|
-
ErrorSpottingPayload,
|
|
6
|
-
ErrorSpottingResponse,
|
|
7
|
-
GetAlternativesPayload,
|
|
8
3
|
GetAlternativesResponse,
|
|
9
|
-
GoogleText2SpeechPayload,
|
|
10
|
-
GoogleText2SpeechResponse,
|
|
11
|
-
GoogleTranslatePayload,
|
|
12
|
-
GoogleTranslateResponse,
|
|
13
4
|
PostMessagePayload,
|
|
14
5
|
PostMessageResponse,
|
|
6
|
+
GoogleTranslatePayload,
|
|
7
|
+
GoogleTranslateResponse,
|
|
8
|
+
GoogleText2SpeechPayload,
|
|
9
|
+
GoogleText2SpeechResponse,
|
|
10
|
+
ChatAnswer,
|
|
11
|
+
GetAlternativesPayload,
|
|
12
|
+
Stroke,
|
|
15
13
|
} from './api.types'
|
|
16
14
|
import { ExtendWithOptional } from '../../../lib/helpers/types'
|
|
17
|
-
|
|
15
|
+
|
|
16
|
+
export type ConversationMessage = {
|
|
17
|
+
id: string
|
|
18
|
+
message: string
|
|
19
|
+
threadId: string
|
|
20
|
+
options: ChatAnswer[]
|
|
21
|
+
isOwnMessage: boolean
|
|
22
|
+
translatedMessage?: string
|
|
23
|
+
endMessage?: boolean
|
|
24
|
+
}
|
|
18
25
|
|
|
19
26
|
export type ChatbotMessages = {
|
|
20
27
|
error: ConversationMessage
|
|
@@ -23,20 +30,15 @@ export type ChatbotMessages = {
|
|
|
23
30
|
anotherHintOption: ChatAnswer
|
|
24
31
|
}
|
|
25
32
|
|
|
26
|
-
export type ChatbotApiRequests = {
|
|
27
|
-
getAlternatives: (props: GetAlternativesPayload) => Promise<GetAlternativesResponse>
|
|
28
|
-
postMessage: (props: PostMessagePayload) => Promise<PostMessageResponse>
|
|
29
|
-
postTranslateText: (props: GoogleTranslatePayload) => Promise<GoogleTranslateResponse>
|
|
30
|
-
postTextToSpeech: (props: GoogleText2SpeechPayload) => Promise<GoogleText2SpeechResponse>
|
|
31
|
-
spotError: (props: ErrorSpottingPayload) => Promise<ErrorSpottingResponse>
|
|
32
|
-
}
|
|
33
|
-
|
|
34
33
|
export type ChatbotModelProps = {
|
|
35
34
|
$key?: Store<string>
|
|
36
|
-
api:
|
|
37
|
-
|
|
35
|
+
api: {
|
|
36
|
+
getAlternatives: (props: GetAlternativesPayload) => Promise<GetAlternativesResponse>
|
|
37
|
+
postMessage: (props: PostMessagePayload) => Promise<PostMessageResponse>
|
|
38
|
+
postTranslateText: (props: GoogleTranslatePayload) => Promise<GoogleTranslateResponse>
|
|
39
|
+
postTextToSpeech: (props: GoogleText2SpeechPayload) => Promise<GoogleText2SpeechResponse>
|
|
38
40
|
}
|
|
39
|
-
|
|
41
|
+
messages: ChatbotMessages
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
export type SendHelpParams = {
|
|
@@ -46,6 +48,8 @@ export type SendHelpParams = {
|
|
|
46
48
|
|
|
47
49
|
export type SendHelpProps = SendHelpParams & {
|
|
48
50
|
key: string
|
|
51
|
+
isTranslated: boolean
|
|
52
|
+
threadId: string
|
|
49
53
|
context: ChatbotContext | null
|
|
50
54
|
}
|
|
51
55
|
|
|
@@ -67,19 +71,16 @@ export enum MessageVariant {
|
|
|
67
71
|
RECEIVED = 'received',
|
|
68
72
|
}
|
|
69
73
|
|
|
70
|
-
export type
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
type GetVisibleStrokesResponse = {
|
|
76
|
-
strokes: FullStrokeData[]
|
|
77
|
-
validationKey: string
|
|
74
|
+
export type ChatbotRenderer = {
|
|
75
|
+
message: string
|
|
76
|
+
variant: MessageVariant
|
|
77
|
+
withTextToSpeech: boolean
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
+
export type CreateMessageResponse = ExtendWithOptional<PostMessageResponse, ConversationMessage>
|
|
81
|
+
|
|
80
82
|
export type IChatDrawBoardAdapter = {
|
|
81
|
-
|
|
82
|
-
getVisibleStrokes(): Promise<GetVisibleStrokesResponse | null>
|
|
83
|
+
getVisibleStrokes(): Promise<Stroke[] | null>
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
export type ChatbotContext = {
|
|
@@ -1,27 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AUDIO_CONFIG, DEFAULT_VOICE } from '../constants'
|
|
2
2
|
|
|
3
3
|
export enum AudioStatus {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
PLAYING = 'playing',
|
|
5
|
+
STOPPED = 'stopped',
|
|
6
|
+
PAUSED = 'paused',
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export type AudioProvider = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
play: (audioPath: string, onPlaybackComplete: () => void) => Promise<void>
|
|
11
|
+
pause: () => void
|
|
12
|
+
resume: () => void
|
|
13
|
+
stop: () => void
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export type PlayTextToSpeechProps = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
isActive: boolean
|
|
25
|
-
isLoading: boolean
|
|
26
|
-
isEnabled: boolean
|
|
17
|
+
text: string
|
|
18
|
+
messageId: string
|
|
19
|
+
isTranslated: boolean
|
|
20
|
+
config?: {
|
|
21
|
+
voice?: typeof DEFAULT_VOICE
|
|
22
|
+
audioConfig?: typeof AUDIO_CONFIG
|
|
23
|
+
}
|
|
27
24
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { ConversationMessage } from './model.types'
|
|
1
2
|
import { GetAlternativesResponse } from './api.types'
|
|
2
|
-
import { ConversationMessage } from './units.types'
|
|
3
3
|
|
|
4
4
|
export type TranslateBatchFxProps = {
|
|
5
5
|
messages: ConversationMessage[]
|
|
@@ -7,10 +7,9 @@ export type TranslateBatchFxProps = {
|
|
|
7
7
|
alternatives: GetAlternativesResponse | null
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export type
|
|
10
|
+
export type TranslateMessageFxProps = {
|
|
11
11
|
messages: ConversationMessage[]
|
|
12
12
|
targetLanguage: string
|
|
13
|
-
isTranslationActive: boolean
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
export type AddTranslationToAlternativesProps = {
|
|
@@ -64,8 +64,6 @@ export const AnimatedCard = memo(
|
|
|
64
64
|
const statsOpacity = useSharedValue(OPACITY.initial)
|
|
65
65
|
const delaySv = useSharedValue(0)
|
|
66
66
|
|
|
67
|
-
const starOffsetLeft = gbdAmount > 9 ? 70 : 55
|
|
68
|
-
|
|
69
67
|
const animatedCardStyle = useAnimatedStyle(() => {
|
|
70
68
|
const progress = interpolate(
|
|
71
69
|
statsOpacity.value,
|
|
@@ -194,7 +192,7 @@ export const AnimatedCard = memo(
|
|
|
194
192
|
|
|
195
193
|
<Animated.View style={[styles.statsWrapper, animatedStatsStyle]}>
|
|
196
194
|
{variant === AnimatedCardVariant.GOOD_DRAWING && (
|
|
197
|
-
<View style={
|
|
195
|
+
<View style={styles.starContainer}>
|
|
198
196
|
<SparkIcon size={20} color={VARIANT_COLORS[variant].initial} />
|
|
199
197
|
<View style={styles.starCircle} />
|
|
200
198
|
<SparkIcon size={12} color={VARIANT_COLORS[variant].initial} />
|
|
@@ -283,6 +281,7 @@ const styles = StyleSheet.create({
|
|
|
283
281
|
},
|
|
284
282
|
starContainer: {
|
|
285
283
|
position: 'absolute',
|
|
284
|
+
left: 70,
|
|
286
285
|
top: 10,
|
|
287
286
|
},
|
|
288
287
|
starCircle: {
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { useFeaturesLocalization, setFeaturesLocalization, Locale } from './shared/translation'
|
|
2
|
+
export type { LocalizationConfig } from './shared/translation'
|
|
2
3
|
export { generateRandomId } from './lib/helpers/helpers'
|
|
3
4
|
export * from './features/chatbot'
|
|
4
5
|
export * from './features/feedback'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createEvent, createStore
|
|
1
|
+
import { createEvent, createStore } from 'effector'
|
|
2
2
|
|
|
3
3
|
type UpdateField<T> = {
|
|
4
4
|
key: string
|
|
@@ -19,14 +19,6 @@ export class EntityFieldStore<T> {
|
|
|
19
19
|
return { ...state, [key]: data }
|
|
20
20
|
})
|
|
21
21
|
.reset(this.reset)
|
|
22
|
-
|
|
23
|
-
public on<EV>(
|
|
24
|
-
event: Event<EV>,
|
|
25
|
-
fn: (state: Record<string, T>, payload: EV) => Record<string, T> | void,
|
|
26
|
-
) {
|
|
27
|
-
this.$state.on(event, fn)
|
|
28
|
-
return this
|
|
29
|
-
}
|
|
30
22
|
}
|
|
31
23
|
|
|
32
24
|
export function createEntityFieldStore<T>() {
|
|
@@ -10,12 +10,5 @@
|
|
|
10
10
|
"time.monthAgo": "month ago",
|
|
11
11
|
"time.monthsAgo": "months ago",
|
|
12
12
|
"time.yearAgo": "year ago",
|
|
13
|
-
"time.yearsAgo": "years ago"
|
|
14
|
-
"chat": {
|
|
15
|
-
"anotherHint": "Give me another hint",
|
|
16
|
-
"answerAgain": "Answer again to get another hint!",
|
|
17
|
-
"errorMessage": "Sorry, I can't help with this issue at the moment 😔.",
|
|
18
|
-
"howCanIHelp": "Hi! Do you want help?",
|
|
19
|
-
"showError": "Show error"
|
|
20
|
-
}
|
|
13
|
+
"time.yearsAgo": "years ago"
|
|
21
14
|
}
|
|
@@ -10,12 +10,5 @@
|
|
|
10
10
|
"time.monthAgo": "month ago",
|
|
11
11
|
"time.monthsAgo": "months ago",
|
|
12
12
|
"time.yearAgo": "year ago",
|
|
13
|
-
"time.yearsAgo": "years ago"
|
|
14
|
-
"chat": {
|
|
15
|
-
"anotherHint": "Give me another hint",
|
|
16
|
-
"answerAgain": "Answer again to get another hint!",
|
|
17
|
-
"errorMessage": "Sorry, I can't help with this issue at the moment 😔.",
|
|
18
|
-
"howCanIHelp": "Hi! Do you want help?",
|
|
19
|
-
"showError": "Show error"
|
|
20
|
-
}
|
|
13
|
+
"time.yearsAgo": "years ago"
|
|
21
14
|
}
|
|
@@ -10,12 +10,5 @@
|
|
|
10
10
|
"time.monthAgo": "månad sedan",
|
|
11
11
|
"time.monthsAgo": "månader sedan",
|
|
12
12
|
"time.yearAgo": "år sedan",
|
|
13
|
-
"time.yearsAgo": "år sedan"
|
|
14
|
-
"chat": {
|
|
15
|
-
"anotherHint": "Ge mig en ledtråd",
|
|
16
|
-
"answerAgain": "Svara igen för att få en till ledtråd!",
|
|
17
|
-
"errorMessage": "Tyvärr kan jag inte hjälpa dig just nu 😔.",
|
|
18
|
-
"howCanIHelp": "Hej! Hur kan jag hjälpa dig?",
|
|
19
|
-
"showError": "Visa fel"
|
|
20
|
-
}
|
|
13
|
+
"time.yearsAgo": "år sedan"
|
|
21
14
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { StyleProp, ViewStyle } from 'react-native'
|
|
2
|
-
|
|
3
1
|
export type IconProps = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
style?: StyleProp<ViewStyle>
|
|
2
|
+
color?: string
|
|
3
|
+
className?: string
|
|
4
|
+
size?: number
|
|
5
|
+
strokeWidth?: string
|
|
6
|
+
width?: number
|
|
7
|
+
height?: number
|
|
11
8
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Locale } from './types'
|
|
2
|
-
import EN from '
|
|
3
|
-
import GB from '
|
|
4
|
-
import SW from '
|
|
2
|
+
import EN from '../../lib/localization/en.json'
|
|
3
|
+
import GB from '../../lib/localization/gb.json'
|
|
4
|
+
import SW from '../../lib/localization/sw.json'
|
|
5
5
|
|
|
6
6
|
export const LOCALIZATION_CONFIGS = {
|
|
7
7
|
[Locale.EN]: EN,
|
|
@@ -1,23 +1,6 @@
|
|
|
1
1
|
import { LOCALIZATION_CONFIGS } from './constants'
|
|
2
2
|
import { $localization, setLocalization } from './model'
|
|
3
|
-
import { GetText,
|
|
4
|
-
|
|
5
|
-
export function getTranslation(config: Translations, key: TranslationKeys) {
|
|
6
|
-
const rawTranslation = config?.[key as keyof Translations]
|
|
7
|
-
if (typeof rawTranslation === 'string' || !key.includes('.')) {
|
|
8
|
-
return rawTranslation as string
|
|
9
|
-
}
|
|
10
|
-
const keys = key.split('.')
|
|
11
|
-
let translation = config
|
|
12
|
-
for (const k of keys) {
|
|
13
|
-
if (translation[k as keyof Translations] === undefined) return key
|
|
14
|
-
translation = translation[k as keyof Translations] as any
|
|
15
|
-
}
|
|
16
|
-
if (typeof translation === 'string') {
|
|
17
|
-
return translation
|
|
18
|
-
}
|
|
19
|
-
return key
|
|
20
|
-
}
|
|
3
|
+
import { GetText, LocalizationConfig, TranslationKeys } from './types'
|
|
21
4
|
|
|
22
5
|
export const getSubstitutedString = (str: string, substitutions: Record<string, string> = {}) => {
|
|
23
6
|
const substitutionsArray = Object.entries(substitutions)
|
|
@@ -35,13 +18,17 @@ export const getSubstitutedString = (str: string, substitutions: Record<string,
|
|
|
35
18
|
export const getText: GetText = (key: TranslationKeys, args = null) => {
|
|
36
19
|
const config = $localization.getState()
|
|
37
20
|
|
|
38
|
-
const translation =
|
|
39
|
-
|
|
40
|
-
|
|
21
|
+
const translation = config?.[key]
|
|
22
|
+
|
|
23
|
+
if (translation && args) {
|
|
24
|
+
return getSubstitutedString(translation, args)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return translation ?? key
|
|
41
28
|
}
|
|
42
29
|
|
|
43
30
|
export const setFeaturesLocalization = (
|
|
44
|
-
generator: ((config: typeof LOCALIZATION_CONFIGS) =>
|
|
31
|
+
generator: ((config: typeof LOCALIZATION_CONFIGS) => LocalizationConfig) | LocalizationConfig,
|
|
45
32
|
) => {
|
|
46
33
|
setLocalization(generator)
|
|
47
34
|
}
|
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
import { useUnit } from 'effector-react'
|
|
2
2
|
import { $localization, setLocalization } from './model'
|
|
3
|
-
import { GetText,
|
|
3
|
+
import { GetText, LocalizationConfig } from './types'
|
|
4
4
|
import { useEffect } from 'react'
|
|
5
5
|
import { LOCALIZATION_CONFIGS } from './constants'
|
|
6
|
-
import { getSubstitutedString
|
|
6
|
+
import { getSubstitutedString } from './helpers'
|
|
7
7
|
|
|
8
8
|
export const useText = (): GetText => {
|
|
9
|
-
|
|
9
|
+
const config = useUnit($localization) as LocalizationConfig
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
return (key, args = null) => {
|
|
12
|
+
const translation = config?.[key]
|
|
13
|
+
|
|
14
|
+
if (translation && args) {
|
|
15
|
+
return getSubstitutedString(translation, args)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return translation ?? key
|
|
19
|
+
}
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
export const useFeaturesLocalization = (
|
|
19
|
-
|
|
23
|
+
generator: ((config: typeof LOCALIZATION_CONFIGS) => LocalizationConfig) | LocalizationConfig,
|
|
20
24
|
) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
setLocalization(generator)
|
|
27
|
+
}, [generator])
|
|
24
28
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { createEvent, createStore } from 'effector'
|
|
2
|
-
import { Locale,
|
|
2
|
+
import { Locale, LocalizationConfig } from './types'
|
|
3
3
|
import { LOCALIZATION_CONFIGS } from './constants'
|
|
4
4
|
|
|
5
5
|
export const setLocalization = createEvent<
|
|
6
|
-
|
|
6
|
+
LocalizationConfig | ((config: typeof LOCALIZATION_CONFIGS) => LocalizationConfig)
|
|
7
7
|
>()
|
|
8
8
|
|
|
9
|
-
export const $localization = createStore<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
export const $localization = createStore<LocalizationConfig>(LOCALIZATION_CONFIGS[Locale.EN]).on(
|
|
10
|
+
setLocalization,
|
|
11
|
+
(state, payload) => {
|
|
12
|
+
if (typeof payload === 'function') return payload(LOCALIZATION_CONFIGS)
|
|
13
|
+
if (state.locale !== payload.locale) return payload
|
|
14
|
+
},
|
|
15
15
|
)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import enTranslations from '
|
|
2
|
-
import swTranslations from './localization/sw.json'
|
|
3
|
-
import gbTranslations from './localization/gb.json'
|
|
4
|
-
import { RetrieveKeys } from '../../lib/types/keys'
|
|
5
|
-
import { ISValidTranslation } from './validation.types'
|
|
1
|
+
import enTranslations from '../../lib/localization/en.json'
|
|
6
2
|
|
|
7
3
|
export type Translations = typeof enTranslations
|
|
8
|
-
export type TranslationKeys =
|
|
9
|
-
|
|
4
|
+
export type TranslationKeys = keyof Translations
|
|
5
|
+
|
|
6
|
+
export type GetText = <T extends TranslationKeys>(
|
|
7
|
+
key: T,
|
|
8
|
+
args?: Record<string, string> | null,
|
|
9
|
+
) => Translations[T]
|
|
10
10
|
|
|
11
11
|
export enum Locale {
|
|
12
12
|
EN = 'en-SE',
|
|
@@ -14,7 +14,4 @@ export enum Locale {
|
|
|
14
14
|
GB = 'en-GB',
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
type ISValidEN = ISValidTranslation<Translations>
|
|
19
|
-
type ISValidSW = ISValidTranslation<typeof swTranslations>
|
|
20
|
-
type ISValidGB = ISValidTranslation<typeof gbTranslations>
|
|
17
|
+
export type LocalizationConfig = Record<string, string>
|