@magmamath/students-features 0.6.0 → 0.6.1-2.rc-2
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/README.md +14 -5
- package/dist/commonjs/features/chatbot/components/Alternatives/Alternatives.js +6 -2
- package/dist/commonjs/features/chatbot/components/Alternatives/Alternatives.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.js +27 -24
- package/dist/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/ChatMessage.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageButtonsBlock.js +9 -4
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageButtonsBlock.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageContent.js +18 -5
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageContent.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js +10 -3
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.js +16 -12
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js +13 -4
- package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/SentMessage.js +14 -8
- package/dist/commonjs/features/chatbot/components/ChatMessage/SentMessage.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js +14 -4
- package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/Chatbot.js +5 -2
- package/dist/commonjs/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ThreeDotsLoader/ThreeDotsLoader.js +2 -1
- package/dist/commonjs/features/chatbot/components/ThreeDotsLoader/ThreeDotsLoader.js.map +1 -1
- package/dist/commonjs/features/chatbot/constants.js +36 -1
- package/dist/commonjs/features/chatbot/constants.js.map +1 -1
- package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.js +8 -0
- package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.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/ChatBotModel.js +67 -39
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js +3 -8
- package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatBoxTextManager.js +12 -1
- package/dist/commonjs/features/chatbot/model/ChatBoxTextManager.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/DefaultMessageCreator.js +4 -2
- package/dist/commonjs/features/chatbot/model/DefaultMessageCreator.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/constants.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/translation.js +9 -1
- package/dist/commonjs/features/chatbot/model/translation.js.map +1 -1
- package/dist/commonjs/features/chatbot/types/model.types.js.map +1 -1
- package/dist/commonjs/features/chatbot/types/style.types.js +12 -0
- package/dist/commonjs/features/chatbot/types/style.types.js.map +1 -0
- package/dist/commonjs/features/endOfAssignment/components/Modal/Modal.js +2 -0
- package/dist/commonjs/features/endOfAssignment/components/Modal/Modal.js.map +1 -1
- package/dist/commonjs/features/exampleSolution/ExampleSolutionModal.js +31 -0
- package/dist/commonjs/features/exampleSolution/ExampleSolutionModal.js.map +1 -0
- package/dist/commonjs/features/exampleSolution/assets/grid.png +0 -0
- package/dist/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.js +97 -0
- package/dist/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.js.map +1 -0
- package/dist/commonjs/features/exampleSolution/components/LavaIcon.js +43 -0
- package/dist/commonjs/features/exampleSolution/components/LavaIcon.js.map +1 -0
- package/dist/commonjs/features/exampleSolution/components/MessageBlock.js +61 -0
- package/dist/commonjs/features/exampleSolution/components/MessageBlock.js.map +1 -0
- package/dist/commonjs/features/exampleSolution/components/QuestionSection.js +68 -0
- package/dist/commonjs/features/exampleSolution/components/QuestionSection.js.map +1 -0
- package/dist/commonjs/features/exampleSolution/components/SolutionSection.js +75 -0
- package/dist/commonjs/features/exampleSolution/components/SolutionSection.js.map +1 -0
- package/dist/commonjs/features/exampleSolution/components/index.js +2 -0
- package/dist/commonjs/features/exampleSolution/components/index.js.map +1 -0
- package/dist/commonjs/features/exampleSolution/constants.js +13 -0
- package/dist/commonjs/features/exampleSolution/constants.js.map +1 -0
- package/dist/commonjs/features/exampleSolution/hooks/useExampleSolution.js +54 -0
- package/dist/commonjs/features/exampleSolution/hooks/useExampleSolution.js.map +1 -0
- package/dist/commonjs/features/exampleSolution/index.js +39 -0
- package/dist/commonjs/features/exampleSolution/index.js.map +1 -0
- package/dist/commonjs/features/exampleSolution/model/ExampleSolution.model.js +22 -0
- package/dist/commonjs/features/exampleSolution/model/ExampleSolution.model.js.map +1 -0
- package/dist/commonjs/features/exampleSolution/model/ExampleSolutionApi.js +24 -0
- package/dist/commonjs/features/exampleSolution/model/ExampleSolutionApi.js.map +1 -0
- package/dist/commonjs/features/exampleSolution/model/ExampleSolutionCache.js +19 -0
- package/dist/commonjs/features/exampleSolution/model/ExampleSolutionCache.js.map +1 -0
- package/dist/commonjs/features/exampleSolution/types.js +6 -0
- package/dist/commonjs/features/exampleSolution/types.js.map +1 -0
- package/dist/commonjs/features/feedback/model/comments.js +5 -3
- package/dist/commonjs/features/feedback/model/comments.js.map +1 -1
- package/dist/commonjs/features/feedback/model/model.js +7 -9
- package/dist/commonjs/features/feedback/model/model.js.map +1 -1
- package/dist/commonjs/features/gifCelebrations/GifCelebrations.js +62 -0
- package/dist/commonjs/features/gifCelebrations/GifCelebrations.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/assets/confetti.webp +0 -0
- package/dist/commonjs/features/gifCelebrations/assets/gifFallback.gif +0 -0
- package/dist/commonjs/features/gifCelebrations/components/Backdrop.js +44 -0
- package/dist/commonjs/features/gifCelebrations/components/Backdrop.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/components/ContentContainer.js +46 -0
- package/dist/commonjs/features/gifCelebrations/components/ContentContainer.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/components/Gif.js +90 -0
- package/dist/commonjs/features/gifCelebrations/components/Gif.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/components/Progress.js +96 -0
- package/dist/commonjs/features/gifCelebrations/components/Progress.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/constants.js +34 -0
- package/dist/commonjs/features/gifCelebrations/constants.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/helpers.js +114 -0
- package/dist/commonjs/features/gifCelebrations/helpers.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/index.js +20 -0
- package/dist/commonjs/features/gifCelebrations/index.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/model/GifCelebrations.model.js +136 -0
- package/dist/commonjs/features/gifCelebrations/model/GifCelebrations.model.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/model/GifCelebrationsApi.js +27 -0
- package/dist/commonjs/features/gifCelebrations/model/GifCelebrationsApi.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/model/GifCelebrationsCache.js +30 -0
- package/dist/commonjs/features/gifCelebrations/model/GifCelebrationsCache.js.map +1 -0
- package/dist/commonjs/features/gifCelebrations/types/model.types.js +6 -0
- package/dist/commonjs/features/gifCelebrations/types/model.types.js.map +1 -0
- package/dist/commonjs/features/problemSelector/components/ProblemSelectorButton.js +12 -9
- package/dist/commonjs/features/problemSelector/components/ProblemSelectorButton.js.map +1 -1
- package/dist/commonjs/features/problemSelector/constants.js +3 -6
- package/dist/commonjs/features/problemSelector/constants.js.map +1 -1
- package/dist/commonjs/index.js +36 -0
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/lib/effector/ControlledSample.js +40 -0
- package/dist/commonjs/lib/effector/ControlledSample.js.map +1 -0
- package/dist/commonjs/lib/effector/createControllerEffect.js.map +1 -1
- package/dist/commonjs/lib/helpers/helpers.js.map +1 -1
- package/dist/commonjs/react-app-env.d.js +2 -0
- package/dist/commonjs/react-app-env.d.js.map +1 -0
- package/dist/commonjs/shared/icons/ExcitedLavaIcon.js +681 -0
- package/dist/commonjs/shared/icons/ExcitedLavaIcon.js.map +1 -0
- package/dist/commonjs/shared/icons/LavaIconInGlasses.js +616 -0
- package/dist/commonjs/shared/icons/LavaIconInGlasses.js.map +1 -0
- package/dist/commonjs/shared/icons/index.js +204 -0
- package/dist/commonjs/shared/icons/index.js.map +1 -0
- package/dist/commonjs/shared/translation/constants.js +5 -1
- package/dist/commonjs/shared/translation/constants.js.map +1 -1
- package/dist/commonjs/shared/translation/localization/ca.json +33 -0
- package/dist/commonjs/shared/translation/localization/en.json +13 -1
- package/dist/commonjs/shared/translation/localization/gb.json +13 -1
- package/dist/commonjs/shared/translation/localization/sct.json +33 -0
- package/dist/commonjs/shared/translation/localization/sw.json +13 -1
- package/dist/commonjs/shared/translation/types.js +2 -0
- package/dist/commonjs/shared/translation/types.js.map +1 -1
- package/dist/commonjs/types/common.types.js +2 -0
- package/dist/commonjs/types/common.types.js.map +1 -0
- package/dist/module/features/chatbot/components/Alternatives/Alternatives.js +6 -2
- package/dist/module/features/chatbot/components/Alternatives/Alternatives.js.map +1 -1
- package/dist/module/features/chatbot/components/Alternatives/HelpRequestOption.js +29 -27
- package/dist/module/features/chatbot/components/Alternatives/HelpRequestOption.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/ChatMessage.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/MessageButtonsBlock.js +9 -4
- package/dist/module/features/chatbot/components/ChatMessage/MessageButtonsBlock.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/MessageContent.js +18 -5
- package/dist/module/features/chatbot/components/ChatMessage/MessageContent.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js +10 -3
- package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.js +16 -12
- package/dist/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js +13 -4
- package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/SentMessage.js +14 -8
- package/dist/module/features/chatbot/components/ChatMessage/SentMessage.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js +14 -4
- package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -1
- package/dist/module/features/chatbot/components/Chatbot.js +5 -2
- package/dist/module/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/module/features/chatbot/components/ThreeDotsLoader/ThreeDotsLoader.js +3 -3
- package/dist/module/features/chatbot/components/ThreeDotsLoader/ThreeDotsLoader.js.map +1 -1
- package/dist/module/features/chatbot/constants.js +35 -0
- package/dist/module/features/chatbot/constants.js.map +1 -1
- package/dist/module/features/chatbot/errorSpotting/ErrorSpottingModel.js +9 -1
- package/dist/module/features/chatbot/errorSpotting/ErrorSpottingModel.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/ChatBotModel.js +68 -40
- package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatBotThreadManager.js +3 -8
- package/dist/module/features/chatbot/model/ChatBotThreadManager.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatBoxTextManager.js +12 -1
- package/dist/module/features/chatbot/model/ChatBoxTextManager.js.map +1 -1
- package/dist/module/features/chatbot/model/DefaultMessageCreator.js +4 -2
- package/dist/module/features/chatbot/model/DefaultMessageCreator.js.map +1 -1
- package/dist/module/features/chatbot/model/constants.js.map +1 -1
- package/dist/module/features/chatbot/model/translation.js +9 -1
- package/dist/module/features/chatbot/model/translation.js.map +1 -1
- package/dist/module/features/chatbot/types/model.types.js.map +1 -1
- package/dist/module/features/chatbot/types/style.types.js +8 -0
- package/dist/module/features/chatbot/types/style.types.js.map +1 -0
- package/dist/module/features/endOfAssignment/components/Modal/Modal.js +3 -1
- package/dist/module/features/endOfAssignment/components/Modal/Modal.js.map +1 -1
- package/dist/module/features/exampleSolution/ExampleSolutionModal.js +25 -0
- package/dist/module/features/exampleSolution/ExampleSolutionModal.js.map +1 -0
- package/dist/module/features/exampleSolution/assets/grid.png +0 -0
- package/dist/module/features/exampleSolution/components/ExampleSolutionModalContent.js +91 -0
- package/dist/module/features/exampleSolution/components/ExampleSolutionModalContent.js.map +1 -0
- package/dist/module/features/exampleSolution/components/LavaIcon.js +35 -0
- package/dist/module/features/exampleSolution/components/LavaIcon.js.map +1 -0
- package/dist/module/features/exampleSolution/components/MessageBlock.js +53 -0
- package/dist/module/features/exampleSolution/components/MessageBlock.js.map +1 -0
- package/dist/module/features/exampleSolution/components/QuestionSection.js +60 -0
- package/dist/module/features/exampleSolution/components/QuestionSection.js.map +1 -0
- package/dist/module/features/exampleSolution/components/SolutionSection.js +67 -0
- package/dist/module/features/exampleSolution/components/SolutionSection.js.map +1 -0
- package/dist/module/features/exampleSolution/components/index.js +2 -0
- package/dist/module/features/exampleSolution/components/index.js.map +1 -0
- package/dist/module/features/exampleSolution/constants.js +9 -0
- package/dist/module/features/exampleSolution/constants.js.map +1 -0
- package/dist/module/features/exampleSolution/hooks/useExampleSolution.js +49 -0
- package/dist/module/features/exampleSolution/hooks/useExampleSolution.js.map +1 -0
- package/dist/module/features/exampleSolution/index.js +6 -0
- package/dist/module/features/exampleSolution/index.js.map +1 -0
- package/dist/module/features/exampleSolution/model/ExampleSolution.model.js +17 -0
- package/dist/module/features/exampleSolution/model/ExampleSolution.model.js.map +1 -0
- package/dist/module/features/exampleSolution/model/ExampleSolutionApi.js +19 -0
- package/dist/module/features/exampleSolution/model/ExampleSolutionApi.js.map +1 -0
- package/dist/module/features/exampleSolution/model/ExampleSolutionCache.js +14 -0
- package/dist/module/features/exampleSolution/model/ExampleSolutionCache.js.map +1 -0
- package/dist/module/features/exampleSolution/types.js +4 -0
- package/dist/module/features/exampleSolution/types.js.map +1 -0
- package/dist/module/features/feedback/model/comments.js +5 -3
- package/dist/module/features/feedback/model/comments.js.map +1 -1
- package/dist/module/features/feedback/model/model.js +7 -9
- package/dist/module/features/feedback/model/model.js.map +1 -1
- package/dist/module/features/gifCelebrations/GifCelebrations.js +55 -0
- package/dist/module/features/gifCelebrations/GifCelebrations.js.map +1 -0
- package/dist/module/features/gifCelebrations/assets/confetti.webp +0 -0
- package/dist/module/features/gifCelebrations/assets/gifFallback.gif +0 -0
- package/dist/module/features/gifCelebrations/components/Backdrop.js +36 -0
- package/dist/module/features/gifCelebrations/components/Backdrop.js.map +1 -0
- package/dist/module/features/gifCelebrations/components/ContentContainer.js +38 -0
- package/dist/module/features/gifCelebrations/components/ContentContainer.js.map +1 -0
- package/dist/module/features/gifCelebrations/components/Gif.js +82 -0
- package/dist/module/features/gifCelebrations/components/Gif.js.map +1 -0
- package/dist/module/features/gifCelebrations/components/Progress.js +88 -0
- package/dist/module/features/gifCelebrations/components/Progress.js.map +1 -0
- package/dist/module/features/gifCelebrations/constants.js +30 -0
- package/dist/module/features/gifCelebrations/constants.js.map +1 -0
- package/dist/module/features/gifCelebrations/helpers.js +103 -0
- package/dist/module/features/gifCelebrations/helpers.js.map +1 -0
- package/dist/module/features/gifCelebrations/index.js +5 -0
- package/dist/module/features/gifCelebrations/index.js.map +1 -0
- package/dist/module/features/gifCelebrations/model/GifCelebrations.model.js +131 -0
- package/dist/module/features/gifCelebrations/model/GifCelebrations.model.js.map +1 -0
- package/dist/module/features/gifCelebrations/model/GifCelebrationsApi.js +22 -0
- package/dist/module/features/gifCelebrations/model/GifCelebrationsApi.js.map +1 -0
- package/dist/module/features/gifCelebrations/model/GifCelebrationsCache.js +25 -0
- package/dist/module/features/gifCelebrations/model/GifCelebrationsCache.js.map +1 -0
- package/dist/module/features/gifCelebrations/types/model.types.js +4 -0
- package/dist/module/features/gifCelebrations/types/model.types.js.map +1 -0
- package/dist/module/features/problemSelector/components/ProblemSelectorButton.js +13 -10
- package/dist/module/features/problemSelector/components/ProblemSelectorButton.js.map +1 -1
- package/dist/module/features/problemSelector/constants.js +2 -5
- package/dist/module/features/problemSelector/constants.js.map +1 -1
- package/dist/module/index.js +3 -0
- package/dist/module/index.js.map +1 -1
- package/dist/module/lib/effector/ControlledSample.js +35 -0
- package/dist/module/lib/effector/ControlledSample.js.map +1 -0
- package/dist/module/lib/effector/createControllerEffect.js.map +1 -1
- package/dist/module/react-app-env.d.js +2 -0
- package/dist/module/react-app-env.d.js.map +1 -0
- package/dist/module/shared/icons/ExcitedLavaIcon.js +673 -0
- package/dist/module/shared/icons/ExcitedLavaIcon.js.map +1 -0
- package/dist/module/shared/icons/LavaIconInGlasses.js +608 -0
- package/dist/module/shared/icons/LavaIconInGlasses.js.map +1 -0
- package/dist/module/shared/icons/index.js +21 -0
- package/dist/module/shared/icons/index.js.map +1 -0
- package/dist/module/shared/translation/constants.js +5 -1
- package/dist/module/shared/translation/constants.js.map +1 -1
- package/dist/module/shared/translation/localization/ca.json +33 -0
- package/dist/module/shared/translation/localization/en.json +13 -1
- package/dist/module/shared/translation/localization/gb.json +13 -1
- package/dist/module/shared/translation/localization/sct.json +33 -0
- package/dist/module/shared/translation/localization/sw.json +13 -1
- package/dist/module/shared/translation/types.js +2 -0
- package/dist/module/shared/translation/types.js.map +1 -1
- package/dist/module/types/common.types.js +2 -0
- package/dist/module/types/common.types.js.map +1 -0
- 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/Alternatives/HelpRequestOption.d.ts +2 -1
- package/dist/typescript/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ChatMessage.d.ts +5 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ChatMessage.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageButtonsBlock.d.ts +6 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageButtonsBlock.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageContent.d.ts +7 -2
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageContent.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageLoader.d.ts +6 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageLoader.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.d.ts +5 -1
- 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 +3 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts +4 -3
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ThreeDotsLoader/ThreeDotsLoader.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/constants.d.ts +33 -0
- package/dist/typescript/commonjs/features/chatbot/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts +4 -0
- package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/index.d.ts +1 -0
- package/dist/typescript/commonjs/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts +7 -2
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts +1 -3
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBoxTextManager.d.ts +5 -0
- package/dist/typescript/commonjs/features/chatbot/model/ChatBoxTextManager.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/DefaultMessageCreator.d.ts +2 -1
- package/dist/typescript/commonjs/features/chatbot/model/DefaultMessageCreator.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts +5 -2
- package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/style.types.d.ts +5 -0
- package/dist/typescript/commonjs/features/chatbot/types/style.types.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/endOfAssignment/components/Modal/Modal.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/exampleSolution/ExampleSolutionModal.d.ts +11 -0
- package/dist/typescript/commonjs/features/exampleSolution/ExampleSolutionModal.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.d.ts +11 -0
- package/dist/typescript/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/exampleSolution/components/LavaIcon.d.ts +10 -0
- package/dist/typescript/commonjs/features/exampleSolution/components/LavaIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/exampleSolution/components/MessageBlock.d.ts +10 -0
- package/dist/typescript/commonjs/features/exampleSolution/components/MessageBlock.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/exampleSolution/components/QuestionSection.d.ts +9 -0
- package/dist/typescript/commonjs/features/exampleSolution/components/QuestionSection.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/exampleSolution/components/SolutionSection.d.ts +9 -0
- package/dist/typescript/commonjs/features/exampleSolution/components/SolutionSection.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/exampleSolution/components/index.d.ts +1 -0
- package/dist/typescript/commonjs/features/exampleSolution/components/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/exampleSolution/constants.d.ts +6 -0
- package/dist/typescript/commonjs/features/exampleSolution/constants.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/exampleSolution/hooks/useExampleSolution.d.ts +15 -0
- package/dist/typescript/commonjs/features/exampleSolution/hooks/useExampleSolution.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/exampleSolution/index.d.ts +4 -0
- package/dist/typescript/commonjs/features/exampleSolution/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/exampleSolution/model/ExampleSolution.model.d.ts +9 -0
- package/dist/typescript/commonjs/features/exampleSolution/model/ExampleSolution.model.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/exampleSolution/model/ExampleSolutionApi.d.ts +11 -0
- package/dist/typescript/commonjs/features/exampleSolution/model/ExampleSolutionApi.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/exampleSolution/model/ExampleSolutionCache.d.ts +12 -0
- package/dist/typescript/commonjs/features/exampleSolution/model/ExampleSolutionCache.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/exampleSolution/types.d.ts +25 -0
- package/dist/typescript/commonjs/features/exampleSolution/types.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/GifCelebrations.d.ts +10 -0
- package/dist/typescript/commonjs/features/gifCelebrations/GifCelebrations.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/components/Backdrop.d.ts +10 -0
- package/dist/typescript/commonjs/features/gifCelebrations/components/Backdrop.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/components/ContentContainer.d.ts +10 -0
- package/dist/typescript/commonjs/features/gifCelebrations/components/ContentContainer.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/components/Gif.d.ts +10 -0
- package/dist/typescript/commonjs/features/gifCelebrations/components/Gif.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/components/Progress.d.ts +10 -0
- package/dist/typescript/commonjs/features/gifCelebrations/components/Progress.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/constants.d.ts +26 -0
- package/dist/typescript/commonjs/features/gifCelebrations/constants.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/helpers.d.ts +29 -0
- package/dist/typescript/commonjs/features/gifCelebrations/helpers.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/index.d.ts +3 -0
- package/dist/typescript/commonjs/features/gifCelebrations/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrations.model.d.ts +25 -0
- package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrations.model.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrationsApi.d.ts +7 -0
- package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrationsApi.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrationsCache.d.ts +18 -0
- package/dist/typescript/commonjs/features/gifCelebrations/model/GifCelebrationsCache.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/gifCelebrations/types/model.types.d.ts +45 -0
- package/dist/typescript/commonjs/features/gifCelebrations/types/model.types.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/problemSelector/components/ProblemSelectorButton.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/problemSelector/constants.d.ts +2 -5
- package/dist/typescript/commonjs/features/problemSelector/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/index.d.ts +3 -0
- package/dist/typescript/commonjs/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/lib/effector/ControlledSample.d.ts +17 -0
- package/dist/typescript/commonjs/lib/effector/ControlledSample.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/effector/createControllerEffect.d.ts +1 -1
- package/dist/typescript/commonjs/lib/effector/createControllerEffect.d.ts.map +1 -1
- package/dist/typescript/commonjs/lib/helpers/helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/icons/ExcitedLavaIcon.d.ts +4 -0
- package/dist/typescript/commonjs/shared/icons/ExcitedLavaIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/LavaIconInGlasses.d.ts +4 -0
- package/dist/typescript/commonjs/shared/icons/LavaIconInGlasses.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/index.d.ts +19 -0
- package/dist/typescript/commonjs/shared/icons/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/translation/constants.d.ts +102 -0
- package/dist/typescript/commonjs/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/model.d.ts +24 -0
- package/dist/typescript/commonjs/shared/translation/model.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/types.d.ts +3 -1
- package/dist/typescript/commonjs/shared/translation/types.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/validation.types.d.ts +5 -1
- package/dist/typescript/commonjs/shared/translation/validation.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/types/common.types.d.ts +5 -0
- package/dist/typescript/commonjs/types/common.types.d.ts.map +1 -0
- 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/Alternatives/HelpRequestOption.d.ts +2 -1
- package/dist/typescript/module/features/chatbot/components/Alternatives/HelpRequestOption.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/ChatMessage.d.ts +5 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/ChatMessage.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageButtonsBlock.d.ts +6 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageButtonsBlock.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageContent.d.ts +7 -2
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageContent.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageLoader.d.ts +6 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageLoader.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.d.ts +5 -1
- 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 +3 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts +4 -3
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ThreeDotsLoader/ThreeDotsLoader.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/constants.d.ts +33 -0
- package/dist/typescript/module/features/chatbot/constants.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts +4 -0
- package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/index.d.ts +1 -0
- package/dist/typescript/module/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts +7 -2
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts +1 -3
- package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBoxTextManager.d.ts +5 -0
- package/dist/typescript/module/features/chatbot/model/ChatBoxTextManager.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/DefaultMessageCreator.d.ts +2 -1
- package/dist/typescript/module/features/chatbot/model/DefaultMessageCreator.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/constants.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/translation.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/model.types.d.ts +5 -2
- package/dist/typescript/module/features/chatbot/types/model.types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/style.types.d.ts +5 -0
- package/dist/typescript/module/features/chatbot/types/style.types.d.ts.map +1 -0
- package/dist/typescript/module/features/endOfAssignment/components/Modal/Modal.d.ts.map +1 -1
- package/dist/typescript/module/features/exampleSolution/ExampleSolutionModal.d.ts +11 -0
- package/dist/typescript/module/features/exampleSolution/ExampleSolutionModal.d.ts.map +1 -0
- package/dist/typescript/module/features/exampleSolution/components/ExampleSolutionModalContent.d.ts +11 -0
- package/dist/typescript/module/features/exampleSolution/components/ExampleSolutionModalContent.d.ts.map +1 -0
- package/dist/typescript/module/features/exampleSolution/components/LavaIcon.d.ts +10 -0
- package/dist/typescript/module/features/exampleSolution/components/LavaIcon.d.ts.map +1 -0
- package/dist/typescript/module/features/exampleSolution/components/MessageBlock.d.ts +10 -0
- package/dist/typescript/module/features/exampleSolution/components/MessageBlock.d.ts.map +1 -0
- package/dist/typescript/module/features/exampleSolution/components/QuestionSection.d.ts +9 -0
- package/dist/typescript/module/features/exampleSolution/components/QuestionSection.d.ts.map +1 -0
- package/dist/typescript/module/features/exampleSolution/components/SolutionSection.d.ts +9 -0
- package/dist/typescript/module/features/exampleSolution/components/SolutionSection.d.ts.map +1 -0
- package/dist/typescript/module/features/exampleSolution/components/index.d.ts +1 -0
- package/dist/typescript/module/features/exampleSolution/components/index.d.ts.map +1 -0
- package/dist/typescript/module/features/exampleSolution/constants.d.ts +6 -0
- package/dist/typescript/module/features/exampleSolution/constants.d.ts.map +1 -0
- package/dist/typescript/module/features/exampleSolution/hooks/useExampleSolution.d.ts +15 -0
- package/dist/typescript/module/features/exampleSolution/hooks/useExampleSolution.d.ts.map +1 -0
- package/dist/typescript/module/features/exampleSolution/index.d.ts +4 -0
- package/dist/typescript/module/features/exampleSolution/index.d.ts.map +1 -0
- package/dist/typescript/module/features/exampleSolution/model/ExampleSolution.model.d.ts +9 -0
- package/dist/typescript/module/features/exampleSolution/model/ExampleSolution.model.d.ts.map +1 -0
- package/dist/typescript/module/features/exampleSolution/model/ExampleSolutionApi.d.ts +11 -0
- package/dist/typescript/module/features/exampleSolution/model/ExampleSolutionApi.d.ts.map +1 -0
- package/dist/typescript/module/features/exampleSolution/model/ExampleSolutionCache.d.ts +12 -0
- package/dist/typescript/module/features/exampleSolution/model/ExampleSolutionCache.d.ts.map +1 -0
- package/dist/typescript/module/features/exampleSolution/types.d.ts +25 -0
- package/dist/typescript/module/features/exampleSolution/types.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/GifCelebrations.d.ts +10 -0
- package/dist/typescript/module/features/gifCelebrations/GifCelebrations.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/components/Backdrop.d.ts +10 -0
- package/dist/typescript/module/features/gifCelebrations/components/Backdrop.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/components/ContentContainer.d.ts +10 -0
- package/dist/typescript/module/features/gifCelebrations/components/ContentContainer.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/components/Gif.d.ts +10 -0
- package/dist/typescript/module/features/gifCelebrations/components/Gif.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/components/Progress.d.ts +10 -0
- package/dist/typescript/module/features/gifCelebrations/components/Progress.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/constants.d.ts +26 -0
- package/dist/typescript/module/features/gifCelebrations/constants.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/helpers.d.ts +29 -0
- package/dist/typescript/module/features/gifCelebrations/helpers.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/index.d.ts +3 -0
- package/dist/typescript/module/features/gifCelebrations/index.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/model/GifCelebrations.model.d.ts +25 -0
- package/dist/typescript/module/features/gifCelebrations/model/GifCelebrations.model.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/model/GifCelebrationsApi.d.ts +7 -0
- package/dist/typescript/module/features/gifCelebrations/model/GifCelebrationsApi.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/model/GifCelebrationsCache.d.ts +18 -0
- package/dist/typescript/module/features/gifCelebrations/model/GifCelebrationsCache.d.ts.map +1 -0
- package/dist/typescript/module/features/gifCelebrations/types/model.types.d.ts +45 -0
- package/dist/typescript/module/features/gifCelebrations/types/model.types.d.ts.map +1 -0
- package/dist/typescript/module/features/problemSelector/components/ProblemSelectorButton.d.ts.map +1 -1
- package/dist/typescript/module/features/problemSelector/constants.d.ts +2 -5
- package/dist/typescript/module/features/problemSelector/constants.d.ts.map +1 -1
- package/dist/typescript/module/index.d.ts +3 -0
- package/dist/typescript/module/index.d.ts.map +1 -1
- package/dist/typescript/module/lib/effector/ControlledSample.d.ts +17 -0
- package/dist/typescript/module/lib/effector/ControlledSample.d.ts.map +1 -0
- package/dist/typescript/module/lib/effector/createControllerEffect.d.ts +1 -1
- package/dist/typescript/module/lib/effector/createControllerEffect.d.ts.map +1 -1
- package/dist/typescript/module/lib/helpers/helpers.d.ts.map +1 -1
- package/dist/typescript/module/shared/icons/ExcitedLavaIcon.d.ts +4 -0
- package/dist/typescript/module/shared/icons/ExcitedLavaIcon.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/LavaIconInGlasses.d.ts +4 -0
- package/dist/typescript/module/shared/icons/LavaIconInGlasses.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/index.d.ts +19 -0
- package/dist/typescript/module/shared/icons/index.d.ts.map +1 -0
- package/dist/typescript/module/shared/translation/constants.d.ts +102 -0
- package/dist/typescript/module/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/model.d.ts +24 -0
- package/dist/typescript/module/shared/translation/model.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/types.d.ts +3 -1
- package/dist/typescript/module/shared/translation/types.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/validation.types.d.ts +5 -1
- package/dist/typescript/module/shared/translation/validation.types.d.ts.map +1 -1
- package/dist/typescript/module/types/common.types.d.ts +5 -0
- package/dist/typescript/module/types/common.types.d.ts.map +1 -0
- package/package.json +11 -7
- package/src/features/chatbot/components/Alternatives/Alternatives.tsx +6 -0
- package/src/features/chatbot/components/Alternatives/HelpRequestOption.tsx +28 -29
- package/src/features/chatbot/components/ChatMessage/ChatMessage.tsx +6 -1
- package/src/features/chatbot/components/ChatMessage/MessageButtonsBlock.tsx +24 -4
- package/src/features/chatbot/components/ChatMessage/MessageContent.tsx +39 -6
- package/src/features/chatbot/components/ChatMessage/MessageLoader.tsx +11 -3
- package/src/features/chatbot/components/ChatMessage/MessageTextToSpeech.tsx +28 -7
- package/src/features/chatbot/components/ChatMessage/ReceivedMessage.tsx +25 -5
- package/src/features/chatbot/components/ChatMessage/SentMessage.tsx +24 -13
- package/src/features/chatbot/components/ChatMessages/ChatbotMessages.tsx +13 -3
- package/src/features/chatbot/components/Chatbot.tsx +6 -2
- package/src/features/chatbot/components/ThreeDotsLoader/ThreeDotsLoader.tsx +7 -10
- package/src/features/chatbot/constants.ts +37 -0
- package/src/features/chatbot/errorSpotting/ErrorSpottingModel.ts +11 -1
- package/src/features/chatbot/index.ts +1 -0
- package/src/features/chatbot/model/ChatBotModel.ts +66 -42
- package/src/features/chatbot/model/ChatBotThreadManager.ts +4 -10
- package/src/features/chatbot/model/ChatBoxTextManager.ts +14 -1
- package/src/features/chatbot/model/DefaultMessageCreator.ts +4 -2
- package/src/features/chatbot/model/constants.ts +0 -2
- package/src/features/chatbot/model/translation.ts +11 -1
- package/src/features/chatbot/types/model.types.ts +5 -2
- package/src/features/chatbot/types/style.types.ts +4 -0
- package/src/features/endOfAssignment/components/Modal/Modal.tsx +3 -0
- package/src/features/exampleSolution/ExampleSolutionModal.tsx +29 -0
- package/src/features/exampleSolution/assets/grid.png +0 -0
- package/src/features/exampleSolution/components/ExampleSolutionModalContent.tsx +78 -0
- package/src/features/exampleSolution/components/LavaIcon.tsx +33 -0
- package/src/features/exampleSolution/components/MessageBlock.tsx +67 -0
- package/src/features/exampleSolution/components/QuestionSection.tsx +56 -0
- package/src/features/exampleSolution/components/SolutionSection.tsx +69 -0
- package/src/features/exampleSolution/components/index.ts +0 -0
- package/src/features/exampleSolution/constants.ts +5 -0
- package/src/features/exampleSolution/hooks/useExampleSolution.ts +64 -0
- package/src/features/exampleSolution/index.ts +3 -0
- package/src/features/exampleSolution/model/ExampleSolution.model.ts +12 -0
- package/src/features/exampleSolution/model/ExampleSolutionApi.ts +23 -0
- package/src/features/exampleSolution/model/ExampleSolutionCache.ts +20 -0
- package/src/features/exampleSolution/types.ts +25 -0
- package/src/features/feedback/model/comments.ts +7 -7
- package/src/features/feedback/model/model.ts +6 -6
- package/src/features/gifCelebrations/GifCelebrations.tsx +75 -0
- package/src/features/gifCelebrations/assets/confetti.webp +0 -0
- package/src/features/gifCelebrations/assets/gifFallback.gif +0 -0
- package/src/features/gifCelebrations/components/Backdrop.tsx +41 -0
- package/src/features/gifCelebrations/components/ContentContainer.tsx +44 -0
- package/src/features/gifCelebrations/components/Gif.tsx +88 -0
- package/src/features/gifCelebrations/components/Progress.tsx +106 -0
- package/src/features/gifCelebrations/constants.ts +32 -0
- package/src/features/gifCelebrations/helpers.ts +144 -0
- package/src/features/gifCelebrations/index.ts +2 -0
- package/src/features/gifCelebrations/model/GifCelebrations.model.ts +167 -0
- package/src/features/gifCelebrations/model/GifCelebrationsApi.ts +26 -0
- package/src/features/gifCelebrations/model/GifCelebrationsCache.ts +41 -0
- package/src/features/gifCelebrations/types/model.types.ts +53 -0
- package/src/features/problemSelector/components/ProblemSelectorButton.tsx +17 -10
- package/src/features/problemSelector/constants.ts +3 -2
- package/src/index.ts +3 -0
- package/src/lib/effector/ControlledSample.ts +40 -0
- package/src/lib/effector/createControllerEffect.ts +41 -41
- package/src/lib/helpers/helpers.ts +1 -1
- package/src/react-app-env.d.ts +6 -0
- package/src/shared/icons/ExcitedLavaIcon.tsx +541 -0
- package/src/shared/icons/LavaIconInGlasses.tsx +489 -0
- package/src/shared/icons/index.ts +18 -0
- package/src/shared/translation/constants.ts +4 -0
- package/src/shared/translation/localization/ca.json +33 -0
- package/src/shared/translation/localization/en.json +13 -1
- package/src/shared/translation/localization/gb.json +13 -1
- package/src/shared/translation/localization/sct.json +33 -0
- package/src/shared/translation/localization/sw.json +13 -1
- package/src/shared/translation/types.ts +6 -0
- package/src/shared/translation/validation.types.ts +9 -1
- package/src/types/common.types.ts +4 -0
- package/dist/commonjs/shared/icons/LockIcon.js +0 -31
- package/dist/commonjs/shared/icons/LockIcon.js.map +0 -1
- package/dist/module/shared/icons/LockIcon.js +0 -23
- package/dist/module/shared/icons/LockIcon.js.map +0 -1
- package/dist/typescript/commonjs/shared/icons/LockIcon.d.ts +0 -4
- package/dist/typescript/commonjs/shared/icons/LockIcon.d.ts.map +0 -1
- package/dist/typescript/module/shared/icons/LockIcon.d.ts +0 -4
- package/dist/typescript/module/shared/icons/LockIcon.d.ts.map +0 -1
- package/src/shared/icons/LockIcon.tsx +0 -16
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { StyleSheet, View, Image } from 'react-native'
|
|
2
|
+
import React, { useLayoutEffect, useState } from 'react'
|
|
3
|
+
import { BORDER_RADIUS, COLORS, IS_WEB, SPACING } from '@magmamath/react-native-ui'
|
|
4
|
+
import { CustomGetCachePathMethod, GifObject, TextComponentType } from '../types/model.types'
|
|
5
|
+
import { MAX_GIF_SIZE, MIN_GIF_SIZE } from '../constants'
|
|
6
|
+
import { useText } from '../../../shared/translation'
|
|
7
|
+
import { constrainDimension, getGifLabel, getImagePath } from '../helpers'
|
|
8
|
+
import gifFallback from '../assets/gifFallback.gif'
|
|
9
|
+
import { Size } from '../../../types/common.types'
|
|
10
|
+
|
|
11
|
+
type GifProps = {
|
|
12
|
+
gifObject: GifObject
|
|
13
|
+
getCachePathMethod?: CustomGetCachePathMethod
|
|
14
|
+
TextComponent: TextComponentType
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const Gif = ({ gifObject, getCachePathMethod, TextComponent }: GifProps) => {
|
|
18
|
+
const [size, setSize] = useState<Size | null>(null)
|
|
19
|
+
const [pathOrUri, setPathOrUri] = useState('')
|
|
20
|
+
|
|
21
|
+
const t = useText()
|
|
22
|
+
|
|
23
|
+
const gifGroupNumber = Number(gifObject.group.replace('group', ''))
|
|
24
|
+
const gifLabel = getGifLabel(gifGroupNumber)
|
|
25
|
+
|
|
26
|
+
useLayoutEffect(() => {
|
|
27
|
+
const loadImageSize = async () => {
|
|
28
|
+
let localPath
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
localPath = await getImagePath(gifObject.url, getCachePathMethod)
|
|
32
|
+
} catch (error) {
|
|
33
|
+
localPath = IS_WEB ? gifFallback : Image.resolveAssetSource(gifFallback).uri
|
|
34
|
+
console.error('Error fetching image from cache:', error)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
Image.getSize(localPath, (width, height) => {
|
|
38
|
+
setSize({
|
|
39
|
+
width: constrainDimension(width, MIN_GIF_SIZE, MAX_GIF_SIZE.WIDTH),
|
|
40
|
+
height: constrainDimension(height, MIN_GIF_SIZE, MAX_GIF_SIZE.HEIGHT),
|
|
41
|
+
})
|
|
42
|
+
setPathOrUri(localPath)
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
loadImageSize()
|
|
47
|
+
}, [gifObject.url])
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<View style={styles.backgroundContainer}>
|
|
51
|
+
<View style={styles.container}>
|
|
52
|
+
{size && pathOrUri && (
|
|
53
|
+
<Image
|
|
54
|
+
alt="Funny celebration animated image"
|
|
55
|
+
source={{
|
|
56
|
+
uri: pathOrUri,
|
|
57
|
+
}}
|
|
58
|
+
width={size.width}
|
|
59
|
+
height={size.height}
|
|
60
|
+
style={[styles.image, { width: size.width, height: size.height }]} //this sizes duplication is needed for compatibility with web and rn
|
|
61
|
+
/>
|
|
62
|
+
)}
|
|
63
|
+
<View style={styles.textContainer}>{TextComponent(t(gifLabel))}</View>
|
|
64
|
+
</View>
|
|
65
|
+
</View>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const styles = StyleSheet.create({
|
|
70
|
+
backgroundContainer: {
|
|
71
|
+
backgroundColor: 'rgba(255, 255, 255, 0.6)',
|
|
72
|
+
borderRadius: 23,
|
|
73
|
+
padding: SPACING[200],
|
|
74
|
+
},
|
|
75
|
+
container: {
|
|
76
|
+
padding: SPACING[1600],
|
|
77
|
+
borderRadius: BORDER_RADIUS[400],
|
|
78
|
+
backgroundColor: COLORS.NEUTRAL_1,
|
|
79
|
+
},
|
|
80
|
+
image: {
|
|
81
|
+
borderRadius: BORDER_RADIUS[100],
|
|
82
|
+
},
|
|
83
|
+
textContainer: {
|
|
84
|
+
position: 'absolute',
|
|
85
|
+
bottom: 74,
|
|
86
|
+
alignSelf: 'center',
|
|
87
|
+
},
|
|
88
|
+
})
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { StyleSheet, View, Image } from 'react-native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import {
|
|
4
|
+
BORDER_RADIUS,
|
|
5
|
+
COLORS,
|
|
6
|
+
HeadingVariants,
|
|
7
|
+
IS_WEB,
|
|
8
|
+
SPACING,
|
|
9
|
+
Typography,
|
|
10
|
+
} from '@magmamath/react-native-ui'
|
|
11
|
+
import Animated, { useAnimatedStyle, SharedValue, interpolate } from 'react-native-reanimated'
|
|
12
|
+
import confettiImage from '../assets/confetti.webp'
|
|
13
|
+
import { ProgressValue } from '../types/model.types'
|
|
14
|
+
import { getProgressLineWidth } from '../helpers'
|
|
15
|
+
|
|
16
|
+
type ProgressProps = {
|
|
17
|
+
progress: SharedValue<ProgressValue>
|
|
18
|
+
completedPercent: number
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const Progress = ({ progress, completedPercent }: ProgressProps) => {
|
|
22
|
+
const progressLineWidth = getProgressLineWidth(completedPercent)
|
|
23
|
+
|
|
24
|
+
const animatedStyles = useAnimatedStyle(
|
|
25
|
+
() => ({
|
|
26
|
+
width: `${interpolate(
|
|
27
|
+
progress.value,
|
|
28
|
+
[0, 1, 2],
|
|
29
|
+
[0, progressLineWidth, progressLineWidth],
|
|
30
|
+
)}%`,
|
|
31
|
+
}),
|
|
32
|
+
[progress, progressLineWidth],
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<View style={styles.backgroundContainer}>
|
|
37
|
+
<View style={styles.container}>
|
|
38
|
+
<View style={styles.progressContainer}>
|
|
39
|
+
<Animated.View style={[styles.progress, animatedStyles]}>
|
|
40
|
+
<Typography variant={HeadingVariants.H1} style={styles.percent}>
|
|
41
|
+
{`${completedPercent}%`}
|
|
42
|
+
</Typography>
|
|
43
|
+
</Animated.View>
|
|
44
|
+
</View>
|
|
45
|
+
<Image
|
|
46
|
+
source={
|
|
47
|
+
IS_WEB
|
|
48
|
+
? {
|
|
49
|
+
uri: confettiImage,
|
|
50
|
+
}
|
|
51
|
+
: require('../assets/confetti.webp')
|
|
52
|
+
}
|
|
53
|
+
style={styles.confetti}
|
|
54
|
+
/>
|
|
55
|
+
</View>
|
|
56
|
+
</View>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const styles = StyleSheet.create({
|
|
61
|
+
backgroundContainer: {
|
|
62
|
+
backgroundColor: 'rgba(255, 255, 255, 0.6)',
|
|
63
|
+
borderRadius: 23,
|
|
64
|
+
padding: SPACING[200],
|
|
65
|
+
width: '100%',
|
|
66
|
+
},
|
|
67
|
+
container: {
|
|
68
|
+
width: '100%',
|
|
69
|
+
height: 116,
|
|
70
|
+
flexDirection: 'row',
|
|
71
|
+
alignItems: 'center',
|
|
72
|
+
borderRadius: BORDER_RADIUS[400],
|
|
73
|
+
backgroundColor: COLORS.NEUTRAL_1,
|
|
74
|
+
paddingLeft: SPACING[400],
|
|
75
|
+
paddingRight: SPACING[200],
|
|
76
|
+
gap: SPACING[100],
|
|
77
|
+
},
|
|
78
|
+
progressContainer: {
|
|
79
|
+
height: 50,
|
|
80
|
+
flexGrow: 1,
|
|
81
|
+
backgroundColor: COLORS.NEUTRAL_5,
|
|
82
|
+
borderRadius: 90,
|
|
83
|
+
overflow: 'hidden',
|
|
84
|
+
},
|
|
85
|
+
progress: {
|
|
86
|
+
position: 'absolute',
|
|
87
|
+
height: '100%',
|
|
88
|
+
backgroundColor: COLORS.PRIMARY_BLUE,
|
|
89
|
+
borderRadius: BORDER_RADIUS[200],
|
|
90
|
+
justifyContent: 'center',
|
|
91
|
+
alignItems: 'flex-end',
|
|
92
|
+
paddingRight: 10.6,
|
|
93
|
+
overflow: 'hidden',
|
|
94
|
+
},
|
|
95
|
+
confetti: {
|
|
96
|
+
width: 75,
|
|
97
|
+
height: 70,
|
|
98
|
+
marginHorizontal: SPACING[200],
|
|
99
|
+
},
|
|
100
|
+
percent: {
|
|
101
|
+
position: 'absolute',
|
|
102
|
+
paddingRight: 10,
|
|
103
|
+
color: COLORS.NEUTRAL_1,
|
|
104
|
+
fontWeight: '700',
|
|
105
|
+
},
|
|
106
|
+
})
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export const BACKDROP_COLOR = {
|
|
2
|
+
INITIAL: 'rgba(51, 51, 51, 0)',
|
|
3
|
+
FINAL: 'rgba(51, 51, 51, 0.66)',
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export const CONTENT_CONTAINER = {
|
|
7
|
+
ANGLE: 5,
|
|
8
|
+
CONTAINER_WIDTH: 769,
|
|
9
|
+
ROTATION_PADDING: 44, // to be sure that the content is not cut off on the edges because of rotate transform
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const ANIMATION_DURATION = 1750
|
|
13
|
+
export const MIN_PROBLEMS_TO_SHOW_GIF = 7
|
|
14
|
+
|
|
15
|
+
export const MAX_GIF_SIZE = {
|
|
16
|
+
WIDTH: 480,
|
|
17
|
+
HEIGHT: 300,
|
|
18
|
+
}
|
|
19
|
+
export const MIN_GIF_SIZE = 300
|
|
20
|
+
|
|
21
|
+
export const GROUPS_PERCENTAGES = {
|
|
22
|
+
group1: [15, 20, 25, 30], // Early celebrations
|
|
23
|
+
group2: [33, 40, 45, 50], // Mid celebrations
|
|
24
|
+
group3: [60, 66, 75, 80], // Party
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const MIN_WIDTH_FOR_ONE_DIGIT = 12
|
|
28
|
+
export const MIN_WIDTH_FOR_TWO_DIGITS = 15
|
|
29
|
+
|
|
30
|
+
export const GET_GIFS_TIMEOUT = 5000
|
|
31
|
+
|
|
32
|
+
export const GIFS_FETCHED_KEY = 'gifsFetchedTimestamp'
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { TranslationKeys } from 'src/shared/translation/types'
|
|
2
|
+
import {
|
|
3
|
+
CustomGetCachePathMethod,
|
|
4
|
+
GifsGroups,
|
|
5
|
+
GifsStructure,
|
|
6
|
+
GroupNumber,
|
|
7
|
+
GroupNumberString,
|
|
8
|
+
ProblemsGifsTable,
|
|
9
|
+
} from './types/model.types'
|
|
10
|
+
import { MIN_WIDTH_FOR_ONE_DIGIT, MIN_WIDTH_FOR_TWO_DIGITS } from './constants'
|
|
11
|
+
import { Image } from 'react-native'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Number of problems When we show gif
|
|
15
|
+
* <6 Never
|
|
16
|
+
* 7-12 50% completion
|
|
17
|
+
* 13-18 33%, 66% completion
|
|
18
|
+
* 19-24 25%, 50%, 75 completion
|
|
19
|
+
* 25-30 20%, 40%, 60%, 80% completion
|
|
20
|
+
* .>30 15%, 30%, 45%, 60%, 75% completion
|
|
21
|
+
*
|
|
22
|
+
* We are also going to have different buckets with different gifs. The logic is as follows:
|
|
23
|
+
* Group 1: 15%, 20%, 25%, 30% - Early celebrations
|
|
24
|
+
* Group 2: 33%, 40%, 45%, 50% - Mid celebrations
|
|
25
|
+
* Group 3: 60%, 66%, 75%, 80% - Party
|
|
26
|
+
* or
|
|
27
|
+
* Group 1: <=30% - Early celebrations
|
|
28
|
+
* Group 2: >30% <60% - Mid celebrations
|
|
29
|
+
* Group 3: >=60% - Party
|
|
30
|
+
*/
|
|
31
|
+
export const generateProblemsGifsTable = (
|
|
32
|
+
problemsAmount: number,
|
|
33
|
+
resolvedProblems: number,
|
|
34
|
+
gifs: GifsStructure,
|
|
35
|
+
): ProblemsGifsTable => {
|
|
36
|
+
const percentageMilestones = getPercentageMilestones(problemsAmount)
|
|
37
|
+
|
|
38
|
+
const result: ProblemsGifsTable = {}
|
|
39
|
+
|
|
40
|
+
for (const percentage of percentageMilestones) {
|
|
41
|
+
const problemNumber = Math.ceil(problemsAmount * (percentage / 100))
|
|
42
|
+
|
|
43
|
+
if (problemNumber <= resolvedProblems) continue
|
|
44
|
+
|
|
45
|
+
const groupKey = findGroupForPercentage(percentage)
|
|
46
|
+
const gifsInGroup = gifs[groupKey]
|
|
47
|
+
|
|
48
|
+
if (!gifsInGroup || gifsInGroup.length === 0) continue
|
|
49
|
+
|
|
50
|
+
const unshownGif = gifsInGroup.find((gif) => !gif.isShown)
|
|
51
|
+
|
|
52
|
+
const selectedGif = unshownGif || gifsInGroup[0]
|
|
53
|
+
|
|
54
|
+
if (selectedGif) {
|
|
55
|
+
result[problemNumber] = {
|
|
56
|
+
url: selectedGif.url,
|
|
57
|
+
group: groupKey,
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return result
|
|
63
|
+
}
|
|
64
|
+
const getPercentageMilestones = (problemsAmount: number): number[] => {
|
|
65
|
+
if (problemsAmount <= 12) return [50]
|
|
66
|
+
|
|
67
|
+
if (problemsAmount <= 18) return [33, 66]
|
|
68
|
+
|
|
69
|
+
if (problemsAmount <= 24) return [25, 50, 75]
|
|
70
|
+
|
|
71
|
+
if (problemsAmount <= 30) return [20, 40, 60, 80]
|
|
72
|
+
|
|
73
|
+
return [15, 30, 45, 60, 75]
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const generateGifsStructure = (gifs: GifsGroups): GifsStructure =>
|
|
77
|
+
Object.fromEntries(
|
|
78
|
+
Object.entries(gifs).map(([key, value]) => [
|
|
79
|
+
key,
|
|
80
|
+
value.map((url) => ({
|
|
81
|
+
url,
|
|
82
|
+
isShown: false,
|
|
83
|
+
group: key as GroupNumberString,
|
|
84
|
+
})),
|
|
85
|
+
]),
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
export const getGifLabel = (relatedGroup: GroupNumber): TranslationKeys => {
|
|
89
|
+
if (relatedGroup === 2) {
|
|
90
|
+
return 'gifCelebrations.onTheWay'
|
|
91
|
+
}
|
|
92
|
+
if (relatedGroup === 3) {
|
|
93
|
+
return 'gifCelebrations.almostThere'
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return 'gifCelebrations.greatStart'
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export const getProgressLineWidth = (completedPercent: number) => {
|
|
100
|
+
if (completedPercent <= 9) {
|
|
101
|
+
return MIN_WIDTH_FOR_ONE_DIGIT
|
|
102
|
+
}
|
|
103
|
+
if (completedPercent <= 15) {
|
|
104
|
+
return MIN_WIDTH_FOR_TWO_DIGITS
|
|
105
|
+
}
|
|
106
|
+
return completedPercent
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export const findGroupForPercentage = (percentage: number) => {
|
|
110
|
+
if (percentage <= 30) {
|
|
111
|
+
return 'group1'
|
|
112
|
+
}
|
|
113
|
+
if (percentage < 60) {
|
|
114
|
+
return 'group2'
|
|
115
|
+
}
|
|
116
|
+
return 'group3'
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export const getImagePath = async (url: string, cacheMethod?: CustomGetCachePathMethod) => {
|
|
120
|
+
if (cacheMethod) {
|
|
121
|
+
const path = await cacheMethod(url)
|
|
122
|
+
if (path) return path
|
|
123
|
+
} else {
|
|
124
|
+
// @ts-ignore
|
|
125
|
+
const isImagesStored = await Image.queryCache([url]).then((images) => !!images[url])
|
|
126
|
+
if (isImagesStored) return url
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
throw new Error('Image not found in cache')
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export const constrainDimension = (value: number, min: number, max: number) =>
|
|
133
|
+
Math.max(min, Math.min(max, value))
|
|
134
|
+
|
|
135
|
+
export const shouldRefreshGifs = (timestamp: string | null | undefined): boolean => {
|
|
136
|
+
if (!timestamp) return true
|
|
137
|
+
|
|
138
|
+
const REFRESH_INTERVAL_HOURS = 24
|
|
139
|
+
const lastFetchedDate = new Date(timestamp)
|
|
140
|
+
const currentDate = new Date()
|
|
141
|
+
const diffInHours = (currentDate.getTime() - lastFetchedDate.getTime()) / (1000 * 60 * 60)
|
|
142
|
+
|
|
143
|
+
return diffInHours > REFRESH_INTERVAL_HOURS
|
|
144
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { createEffect, createEvent, createStore, sample, Store } from 'effector'
|
|
2
|
+
import { GifCelebrationsApi } from './GifCelebrationsApi'
|
|
3
|
+
import {
|
|
4
|
+
CustomLocalStorage,
|
|
5
|
+
GifCelebrationsModelProps,
|
|
6
|
+
GifObject,
|
|
7
|
+
GifsStructure,
|
|
8
|
+
ProblemsGifsTable,
|
|
9
|
+
} from '../types/model.types'
|
|
10
|
+
import { GifCelebrationsCache } from './GifCelebrationsCache'
|
|
11
|
+
import { generateProblemsGifsTable, shouldRefreshGifs } from '../helpers'
|
|
12
|
+
import { MIN_PROBLEMS_TO_SHOW_GIF, GIFS_FETCHED_KEY } from '../constants'
|
|
13
|
+
|
|
14
|
+
type HandleGifSelectionProps = {
|
|
15
|
+
gifsGroups: GifsStructure
|
|
16
|
+
resolvedProblemsAmount: number
|
|
17
|
+
problemsGifsTable: ProblemsGifsTable
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export class GifCelebrationsModel {
|
|
21
|
+
public readonly api: GifCelebrationsApi
|
|
22
|
+
public readonly cache: GifCelebrationsCache
|
|
23
|
+
|
|
24
|
+
public readonly $problemsAmount: Store<number>
|
|
25
|
+
public readonly $resolvedProblemsAmount: Store<number>
|
|
26
|
+
|
|
27
|
+
public readonly play = createEvent()
|
|
28
|
+
public readonly stop = createEvent()
|
|
29
|
+
|
|
30
|
+
public readonly resetGifTriggerable = createEvent()
|
|
31
|
+
public readonly setGifTriggerable = createEvent<boolean>()
|
|
32
|
+
public readonly $isGifTriggerable = createStore<boolean>(false)
|
|
33
|
+
.reset(this.resetGifTriggerable)
|
|
34
|
+
.reset(this.stop)
|
|
35
|
+
.on(
|
|
36
|
+
this.setGifTriggerable,
|
|
37
|
+
(_, isGifCelebrationMayBeTriggered) => isGifCelebrationMayBeTriggered,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
public readonly resetProblemsGifsTable = createEvent()
|
|
41
|
+
public readonly $problemsGifsTable = createStore<ProblemsGifsTable | null>(null).reset(
|
|
42
|
+
this.resetProblemsGifsTable,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
public readonly setActiveGif = createEvent<GifObject>()
|
|
46
|
+
public readonly $activeGif = createStore<GifObject | null>(null)
|
|
47
|
+
.reset(this.stop)
|
|
48
|
+
.reset(this.resetGifTriggerable)
|
|
49
|
+
.on(this.setActiveGif, (_, gif) => gif)
|
|
50
|
+
|
|
51
|
+
private readonly localStorage: typeof localStorage | CustomLocalStorage
|
|
52
|
+
|
|
53
|
+
public readonly initialize = createEvent()
|
|
54
|
+
|
|
55
|
+
constructor({
|
|
56
|
+
api,
|
|
57
|
+
problemsAmount,
|
|
58
|
+
resolvedProblemsAmount,
|
|
59
|
+
customLocalStorage,
|
|
60
|
+
customGetCachePathMethod,
|
|
61
|
+
customPrefetchMethod,
|
|
62
|
+
}: GifCelebrationsModelProps) {
|
|
63
|
+
this.api = new GifCelebrationsApi(api)
|
|
64
|
+
this.cache = new GifCelebrationsCache({ customGetCachePathMethod, customPrefetchMethod })
|
|
65
|
+
|
|
66
|
+
this.$problemsAmount = problemsAmount
|
|
67
|
+
this.$resolvedProblemsAmount = resolvedProblemsAmount
|
|
68
|
+
|
|
69
|
+
this.localStorage = customLocalStorage || localStorage
|
|
70
|
+
this.setupEventHandlers()
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
private setupEventHandlers() {
|
|
74
|
+
sample({
|
|
75
|
+
clock: this.initialize,
|
|
76
|
+
source: this.cache.$gifs,
|
|
77
|
+
filter: (gifs) => {
|
|
78
|
+
if (!gifs) return true
|
|
79
|
+
|
|
80
|
+
const gifsFetchedTimestamp = this.localStorage.getItem(GIFS_FETCHED_KEY)
|
|
81
|
+
return shouldRefreshGifs(gifsFetchedTimestamp)
|
|
82
|
+
},
|
|
83
|
+
target: this.api.getGifsFx,
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
sample({
|
|
87
|
+
source: this.api.getGifsFx.doneData,
|
|
88
|
+
filter: (response) => response.ok,
|
|
89
|
+
fn: (response) => response.data,
|
|
90
|
+
target: this.cache.initialSet,
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
sample({
|
|
94
|
+
source: this.api.getGifsFx.doneData,
|
|
95
|
+
filter: (response) => response.ok,
|
|
96
|
+
target: createEffect(() => {
|
|
97
|
+
this.localStorage.setItem(GIFS_FETCHED_KEY, new Date().toISOString())
|
|
98
|
+
}),
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
sample({
|
|
102
|
+
clock: [this.initialize, this.api.getGifsFx.doneData],
|
|
103
|
+
source: {
|
|
104
|
+
gifs: this.cache.$gifs,
|
|
105
|
+
problemsAmount: this.$problemsAmount,
|
|
106
|
+
resolvedProblemsAmount: this.$resolvedProblemsAmount,
|
|
107
|
+
},
|
|
108
|
+
filter: ({ gifs }) => !!gifs,
|
|
109
|
+
fn: ({ problemsAmount, resolvedProblemsAmount, gifs }) => {
|
|
110
|
+
if (!gifs || problemsAmount < MIN_PROBLEMS_TO_SHOW_GIF) return null
|
|
111
|
+
return generateProblemsGifsTable(problemsAmount, resolvedProblemsAmount, gifs)
|
|
112
|
+
},
|
|
113
|
+
target: this.$problemsGifsTable,
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
sample({
|
|
117
|
+
source: this.$problemsGifsTable,
|
|
118
|
+
filter: (problemsGifsTable) => !!problemsGifsTable,
|
|
119
|
+
fn: (problemsGifsTable) => {
|
|
120
|
+
if (!problemsGifsTable) return []
|
|
121
|
+
return Object.values(problemsGifsTable).map((gif) => gif.url)
|
|
122
|
+
},
|
|
123
|
+
target: this.cache.prefetchGifs,
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
sample({
|
|
127
|
+
clock: this.play,
|
|
128
|
+
source: {
|
|
129
|
+
isGifCelebrationMayBeTriggered: this.$isGifTriggerable,
|
|
130
|
+
gifsGroups: this.cache.$gifs,
|
|
131
|
+
resolvedProblemsAmount: this.$resolvedProblemsAmount,
|
|
132
|
+
problemsGifsTable: this.$problemsGifsTable,
|
|
133
|
+
},
|
|
134
|
+
filter: ({ isGifCelebrationMayBeTriggered, gifsGroups, problemsGifsTable }) =>
|
|
135
|
+
!!(isGifCelebrationMayBeTriggered && gifsGroups && problemsGifsTable),
|
|
136
|
+
fn: (sources) => sources as HandleGifSelectionProps,
|
|
137
|
+
target: this.updateGifShownStatus,
|
|
138
|
+
})
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
private readonly updateGifShownStatus = createEffect(
|
|
142
|
+
({ gifsGroups, resolvedProblemsAmount, problemsGifsTable }: HandleGifSelectionProps) => {
|
|
143
|
+
const gifToShow = problemsGifsTable[resolvedProblemsAmount]
|
|
144
|
+
const groupName = gifToShow.group
|
|
145
|
+
|
|
146
|
+
const gifsInGroup = gifsGroups[groupName]
|
|
147
|
+
const selectedGifIndex = gifsInGroup?.findIndex((gif) => gif.url === gifToShow.url)
|
|
148
|
+
|
|
149
|
+
if (!gifsInGroup || selectedGifIndex === -1) {
|
|
150
|
+
console.warn(`Gif with URL ${gifToShow.url} not found in group ${groupName}`)
|
|
151
|
+
return
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const updatedGifsInGroup = gifsInGroup.map((gif, index) => ({
|
|
155
|
+
...gif,
|
|
156
|
+
isShown: index === selectedGifIndex ? true : gif.isShown,
|
|
157
|
+
}))
|
|
158
|
+
|
|
159
|
+
this.cache.set({
|
|
160
|
+
...gifsGroups,
|
|
161
|
+
[groupName]: updatedGifsInGroup,
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
this.setActiveGif(gifToShow)
|
|
165
|
+
},
|
|
166
|
+
)
|
|
167
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createControllerEffect } from './../../../lib/effector/createControllerEffect'
|
|
2
|
+
import { GifCelebrationApiRequests } from '../types/model.types'
|
|
3
|
+
import { GET_GIFS_TIMEOUT } from '../constants'
|
|
4
|
+
|
|
5
|
+
export class GifCelebrationsApi {
|
|
6
|
+
public readonly getGifsFx
|
|
7
|
+
|
|
8
|
+
private failedGetGifxTimeout: NodeJS.Timeout | null = null
|
|
9
|
+
|
|
10
|
+
constructor(api: GifCelebrationApiRequests) {
|
|
11
|
+
this.getGifsFx = createControllerEffect(() => api.getGifs())
|
|
12
|
+
|
|
13
|
+
this.getGifsFx.fail.watch(() => {
|
|
14
|
+
this.failedGetGifxTimeout = setTimeout(() => {
|
|
15
|
+
this.getGifsFx()
|
|
16
|
+
}, GET_GIFS_TIMEOUT)
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
this.getGifsFx.done.watch(() => {
|
|
20
|
+
if (this.failedGetGifxTimeout) {
|
|
21
|
+
clearTimeout(this.failedGetGifxTimeout)
|
|
22
|
+
this.failedGetGifxTimeout = null
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createEffect, createEvent, createStore } from 'effector'
|
|
2
|
+
import {
|
|
3
|
+
GifsGroups,
|
|
4
|
+
GifsStructure,
|
|
5
|
+
CustomGetCachePathMethod,
|
|
6
|
+
CustomPrefetchMethod,
|
|
7
|
+
} from '../types/model.types'
|
|
8
|
+
import { generateGifsStructure } from '../helpers'
|
|
9
|
+
import { Image } from 'react-native'
|
|
10
|
+
|
|
11
|
+
type GifCelebrationsCacheProps = {
|
|
12
|
+
customPrefetchMethod?: CustomPrefetchMethod
|
|
13
|
+
customGetCachePathMethod?: CustomGetCachePathMethod
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class GifCelebrationsCache {
|
|
17
|
+
public readonly initialSet = createEvent<GifsGroups>()
|
|
18
|
+
public readonly set = createEvent<GifsStructure>()
|
|
19
|
+
public readonly reset = createEvent()
|
|
20
|
+
|
|
21
|
+
public readonly getCachePathMethod?: CustomGetCachePathMethod
|
|
22
|
+
public readonly prefetchMethod: CustomPrefetchMethod | typeof Image.prefetch
|
|
23
|
+
|
|
24
|
+
public readonly prefetchGifs = createEffect<string[], void>((gifs) => {
|
|
25
|
+
if (!gifs || gifs.length === 0) return
|
|
26
|
+
|
|
27
|
+
gifs.forEach((gifUrl) => {
|
|
28
|
+
this.prefetchMethod(gifUrl)
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
public readonly $gifs = createStore<GifsStructure | null>(null)
|
|
33
|
+
.reset(this.reset)
|
|
34
|
+
.on(this.initialSet, (_, gifs) => generateGifsStructure(gifs))
|
|
35
|
+
.on(this.set, (_, gifs) => gifs)
|
|
36
|
+
|
|
37
|
+
constructor({ customGetCachePathMethod, customPrefetchMethod }: GifCelebrationsCacheProps) {
|
|
38
|
+
this.prefetchMethod = customPrefetchMethod || Image.prefetch
|
|
39
|
+
this.getCachePathMethod = customGetCachePathMethod
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Store } from 'effector'
|
|
2
|
+
|
|
3
|
+
export type CustomGetCachePathMethod = (uri: string) => Promise<string | null>
|
|
4
|
+
export type CustomPrefetchMethod = (gifs: string[] | string) => Promise<unknown>
|
|
5
|
+
export type CustomLocalStorage = {
|
|
6
|
+
setItem: (key: string, value: string) => void
|
|
7
|
+
getItem: (key: string) => string | null | undefined
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type GroupNumber = number
|
|
11
|
+
|
|
12
|
+
export type GifCelebrationApiRequests = {
|
|
13
|
+
getGifs: () => Promise<GifResponse>
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type GifCelebrationsModelProps = {
|
|
17
|
+
api: GifCelebrationApiRequests
|
|
18
|
+
problemsAmount: Store<number>
|
|
19
|
+
resolvedProblemsAmount: Store<number>
|
|
20
|
+
customLocalStorage?: CustomLocalStorage
|
|
21
|
+
customPrefetchMethod?: CustomPrefetchMethod
|
|
22
|
+
customGetCachePathMethod?: CustomGetCachePathMethod
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type GifsGroup = string[]
|
|
26
|
+
export type GroupNumberString = `group${GroupNumber}`
|
|
27
|
+
export type GifsGroups = Record<GroupNumberString, GifsGroup>
|
|
28
|
+
|
|
29
|
+
export type GifObject = {
|
|
30
|
+
url: string
|
|
31
|
+
group: GroupNumberString
|
|
32
|
+
isShown?: boolean
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type GifsStructure = Record<GroupNumberString, GifObject[]>
|
|
36
|
+
/**
|
|
37
|
+
* Usually, the response contains 3 groups of gifs:
|
|
38
|
+
* - group1: early celebrations
|
|
39
|
+
* - group2: mid celebrations
|
|
40
|
+
* - group3: party
|
|
41
|
+
*/
|
|
42
|
+
export type GifResponse = {
|
|
43
|
+
data: GifsGroups
|
|
44
|
+
ok: boolean
|
|
45
|
+
}
|
|
46
|
+
export type GifsPayload = {
|
|
47
|
+
group: number
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type ProblemsGifsTable = Record<number, GifObject>
|
|
51
|
+
export type ProgressValue = 0 | 1 | 2
|
|
52
|
+
|
|
53
|
+
export type TextComponentType = (text: string) => React.ReactNode
|