@magmamath/students-features 0.1.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/README.md +33 -0
- package/dist/commonjs/features/chatbot/components/Alternatives/Alternatives.js +60 -0
- package/dist/commonjs/features/chatbot/components/Alternatives/Alternatives.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.js +96 -0
- package/dist/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js +97 -0
- package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/ChatMessage/ChatMessage.js +27 -0
- package/dist/commonjs/features/chatbot/components/ChatMessage/ChatMessage.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js +56 -0
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.js +88 -0
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js +87 -0
- package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/ChatMessage/SentMessage.js +43 -0
- package/dist/commonjs/features/chatbot/components/ChatMessage/SentMessage.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js +130 -0
- package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/Chatbot.js +69 -0
- package/dist/commonjs/features/chatbot/components/Chatbot.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/ThreeDotsLoader/ThreeDotsLoader.js +65 -0
- package/dist/commonjs/features/chatbot/components/ThreeDotsLoader/ThreeDotsLoader.js.map +1 -0
- package/dist/commonjs/features/chatbot/constants.js +31 -0
- package/dist/commonjs/features/chatbot/constants.js.map +1 -0
- package/dist/commonjs/features/chatbot/helpers.js +12 -0
- package/dist/commonjs/features/chatbot/helpers.js.map +1 -0
- package/dist/commonjs/features/chatbot/index.js +34 -0
- package/dist/commonjs/features/chatbot/index.js.map +1 -0
- package/dist/commonjs/features/chatbot/model/api.js +18 -0
- package/dist/commonjs/features/chatbot/model/api.js.map +1 -0
- package/dist/commonjs/features/chatbot/model/model.js +244 -0
- package/dist/commonjs/features/chatbot/model/model.js.map +1 -0
- package/dist/commonjs/features/chatbot/model/t2s.js +104 -0
- package/dist/commonjs/features/chatbot/model/t2s.js.map +1 -0
- package/dist/commonjs/features/chatbot/model/translation.js +203 -0
- package/dist/commonjs/features/chatbot/model/translation.js.map +1 -0
- package/dist/commonjs/features/chatbot/types/api.types.js +2 -0
- package/dist/commonjs/features/chatbot/types/api.types.js.map +1 -0
- package/dist/commonjs/features/chatbot/types/model.types.js +12 -0
- package/dist/commonjs/features/chatbot/types/model.types.js.map +1 -0
- package/dist/commonjs/features/chatbot/types/t2s.types.js +13 -0
- package/dist/commonjs/features/chatbot/types/t2s.types.js.map +1 -0
- package/dist/commonjs/features/chatbot/types/translation.types.js +6 -0
- package/dist/commonjs/features/chatbot/types/translation.types.js.map +1 -0
- package/dist/commonjs/index.js +42 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/lib/createFeature/createFeature.js +28 -0
- package/dist/commonjs/lib/createFeature/createFeature.js.map +1 -0
- package/dist/commonjs/lib/effector/createControllerEffect.js +51 -0
- package/dist/commonjs/lib/effector/createControllerEffect.js.map +1 -0
- package/dist/commonjs/lib/effector/createEntityFieldStore.js +42 -0
- package/dist/commonjs/lib/effector/createEntityFieldStore.js.map +1 -0
- package/dist/commonjs/lib/effector/index.js +20 -0
- package/dist/commonjs/lib/effector/index.js.map +1 -0
- package/dist/commonjs/lib/helpers/helpers.js +9 -0
- package/dist/commonjs/lib/helpers/helpers.js.map +1 -0
- package/dist/commonjs/lib/localization/en.json +2 -0
- package/dist/commonjs/lib/localization/gb.json +2 -0
- package/dist/commonjs/lib/localization/sw.json +2 -0
- package/dist/commonjs/shared/hooks/useDebounce.js +21 -0
- package/dist/commonjs/shared/hooks/useDebounce.js.map +1 -0
- package/dist/commonjs/shared/icons/ArrowRightIcon.js +30 -0
- package/dist/commonjs/shared/icons/ArrowRightIcon.js.map +1 -0
- package/dist/commonjs/shared/icons/ChatbotIcon.js +148 -0
- package/dist/commonjs/shared/icons/ChatbotIcon.js.map +1 -0
- package/dist/commonjs/shared/icons/CloseIcon.js +28 -0
- package/dist/commonjs/shared/icons/CloseIcon.js.map +1 -0
- package/dist/commonjs/shared/icons/GlobeIcon.js +30 -0
- package/dist/commonjs/shared/icons/GlobeIcon.js.map +1 -0
- package/dist/commonjs/shared/icons/PauseIcon.js +32 -0
- package/dist/commonjs/shared/icons/PauseIcon.js.map +1 -0
- package/dist/commonjs/shared/icons/PlayIcon.js +32 -0
- package/dist/commonjs/shared/icons/PlayIcon.js.map +1 -0
- package/dist/commonjs/shared/icons/SpeakerIcon.js +37 -0
- package/dist/commonjs/shared/icons/SpeakerIcon.js.map +1 -0
- package/dist/commonjs/shared/icons/icon.types.js +2 -0
- package/dist/commonjs/shared/icons/icon.types.js.map +1 -0
- package/dist/commonjs/shared/translation/constants.js +17 -0
- package/dist/commonjs/shared/translation/constants.js.map +1 -0
- package/dist/commonjs/shared/translation/helpers.js +31 -0
- package/dist/commonjs/shared/translation/helpers.js.map +1 -0
- package/dist/commonjs/shared/translation/hooks.js +28 -0
- package/dist/commonjs/shared/translation/hooks.js.map +1 -0
- package/dist/commonjs/shared/translation/index.js +52 -0
- package/dist/commonjs/shared/translation/index.js.map +1 -0
- package/dist/commonjs/shared/translation/model.js +15 -0
- package/dist/commonjs/shared/translation/model.js.map +1 -0
- package/dist/commonjs/shared/translation/types.js +13 -0
- package/dist/commonjs/shared/translation/types.js.map +1 -0
- package/dist/commonjs/types/types.d.js +2 -0
- package/dist/commonjs/types/types.d.js.map +1 -0
- package/dist/module/features/chatbot/components/Alternatives/Alternatives.js +54 -0
- package/dist/module/features/chatbot/components/Alternatives/Alternatives.js.map +1 -0
- package/dist/module/features/chatbot/components/Alternatives/HelpRequestOption.js +90 -0
- package/dist/module/features/chatbot/components/Alternatives/HelpRequestOption.js.map +1 -0
- package/dist/module/features/chatbot/components/ChatControls/ChatControls.js +91 -0
- package/dist/module/features/chatbot/components/ChatControls/ChatControls.js.map +1 -0
- package/dist/module/features/chatbot/components/ChatMessage/ChatMessage.js +21 -0
- package/dist/module/features/chatbot/components/ChatMessage/ChatMessage.js.map +1 -0
- package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js +50 -0
- package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -0
- package/dist/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.js +82 -0
- package/dist/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.js.map +1 -0
- package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js +81 -0
- package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -0
- package/dist/module/features/chatbot/components/ChatMessage/SentMessage.js +37 -0
- package/dist/module/features/chatbot/components/ChatMessage/SentMessage.js.map +1 -0
- package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js +123 -0
- package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -0
- package/dist/module/features/chatbot/components/Chatbot.js +63 -0
- package/dist/module/features/chatbot/components/Chatbot.js.map +1 -0
- package/dist/module/features/chatbot/components/ThreeDotsLoader/ThreeDotsLoader.js +59 -0
- package/dist/module/features/chatbot/components/ThreeDotsLoader/ThreeDotsLoader.js.map +1 -0
- package/dist/module/features/chatbot/constants.js +27 -0
- package/dist/module/features/chatbot/constants.js.map +1 -0
- package/dist/module/features/chatbot/helpers.js +7 -0
- package/dist/module/features/chatbot/helpers.js.map +1 -0
- package/dist/module/features/chatbot/index.js +7 -0
- package/dist/module/features/chatbot/index.js.map +1 -0
- package/dist/module/features/chatbot/model/api.js +13 -0
- package/dist/module/features/chatbot/model/api.js.map +1 -0
- package/dist/module/features/chatbot/model/model.js +239 -0
- package/dist/module/features/chatbot/model/model.js.map +1 -0
- package/dist/module/features/chatbot/model/t2s.js +99 -0
- package/dist/module/features/chatbot/model/t2s.js.map +1 -0
- package/dist/module/features/chatbot/model/translation.js +198 -0
- package/dist/module/features/chatbot/model/translation.js.map +1 -0
- package/dist/module/features/chatbot/types/api.types.js +2 -0
- package/dist/module/features/chatbot/types/api.types.js.map +1 -0
- package/dist/module/features/chatbot/types/model.types.js +8 -0
- package/dist/module/features/chatbot/types/model.types.js.map +1 -0
- package/dist/module/features/chatbot/types/t2s.types.js +9 -0
- package/dist/module/features/chatbot/types/t2s.types.js.map +1 -0
- package/dist/module/features/chatbot/types/translation.types.js +4 -0
- package/dist/module/features/chatbot/types/translation.types.js.map +1 -0
- package/dist/module/index.js +5 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/lib/createFeature/createFeature.js +22 -0
- package/dist/module/lib/createFeature/createFeature.js.map +1 -0
- package/dist/module/lib/effector/createControllerEffect.js +45 -0
- package/dist/module/lib/effector/createControllerEffect.js.map +1 -0
- package/dist/module/lib/effector/createEntityFieldStore.js +38 -0
- package/dist/module/lib/effector/createEntityFieldStore.js.map +1 -0
- package/dist/module/lib/effector/index.js +5 -0
- package/dist/module/lib/effector/index.js.map +1 -0
- package/dist/module/lib/helpers/helpers.js +4 -0
- package/dist/module/lib/helpers/helpers.js.map +1 -0
- package/dist/module/lib/localization/en.json +2 -0
- package/dist/module/lib/localization/gb.json +2 -0
- package/dist/module/lib/localization/sw.json +2 -0
- package/dist/module/shared/hooks/useDebounce.js +16 -0
- package/dist/module/shared/hooks/useDebounce.js.map +1 -0
- package/dist/module/shared/icons/ArrowRightIcon.js +22 -0
- package/dist/module/shared/icons/ArrowRightIcon.js.map +1 -0
- package/dist/module/shared/icons/ChatbotIcon.js +140 -0
- package/dist/module/shared/icons/ChatbotIcon.js.map +1 -0
- package/dist/module/shared/icons/CloseIcon.js +20 -0
- package/dist/module/shared/icons/CloseIcon.js.map +1 -0
- package/dist/module/shared/icons/GlobeIcon.js +22 -0
- package/dist/module/shared/icons/GlobeIcon.js.map +1 -0
- package/dist/module/shared/icons/PauseIcon.js +24 -0
- package/dist/module/shared/icons/PauseIcon.js.map +1 -0
- package/dist/module/shared/icons/PlayIcon.js +24 -0
- package/dist/module/shared/icons/PlayIcon.js.map +1 -0
- package/dist/module/shared/icons/SpeakerIcon.js +29 -0
- package/dist/module/shared/icons/SpeakerIcon.js.map +1 -0
- package/dist/module/shared/icons/icon.types.js +2 -0
- package/dist/module/shared/icons/icon.types.js.map +1 -0
- package/dist/module/shared/translation/constants.js +12 -0
- package/dist/module/shared/translation/constants.js.map +1 -0
- package/dist/module/shared/translation/helpers.js +24 -0
- package/dist/module/shared/translation/helpers.js.map +1 -0
- package/dist/module/shared/translation/hooks.js +22 -0
- package/dist/module/shared/translation/hooks.js.map +1 -0
- package/dist/module/shared/translation/index.js +7 -0
- package/dist/module/shared/translation/index.js.map +1 -0
- package/dist/module/shared/translation/model.js +11 -0
- package/dist/module/shared/translation/model.js.map +1 -0
- package/dist/module/shared/translation/types.js +9 -0
- package/dist/module/shared/translation/types.js.map +1 -0
- package/dist/module/types/types.d.js +2 -0
- package/dist/module/types/types.d.js.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/Alternatives/Alternatives.d.ts +11 -0
- package/dist/typescript/commonjs/features/chatbot/components/Alternatives/Alternatives.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.d.ts +9 -0
- package/dist/typescript/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatControls/ChatControls.d.ts +14 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatControls/ChatControls.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ChatMessage.d.ts +17 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ChatMessage.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageLoader.d.ts +3 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageLoader.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.d.ts +12 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageTextToSpeech.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts +4 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/SentMessage.d.ts +4 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/SentMessage.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts +21 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts +25 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/ThreeDotsLoader/ThreeDotsLoader.d.ts +9 -0
- package/dist/typescript/commonjs/features/chatbot/components/ThreeDotsLoader/ThreeDotsLoader.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/constants.d.ts +21 -0
- package/dist/typescript/commonjs/features/chatbot/constants.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/helpers.d.ts +2 -0
- package/dist/typescript/commonjs/features/chatbot/helpers.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/index.d.ts +5 -0
- package/dist/typescript/commonjs/features/chatbot/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/model/api.d.ts +12 -0
- package/dist/typescript/commonjs/features/chatbot/model/api.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/model/model.d.ts +73 -0
- package/dist/typescript/commonjs/features/chatbot/model/model.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/model/t2s.d.ts +18 -0
- package/dist/typescript/commonjs/features/chatbot/model/t2s.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts +22 -0
- package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts +60 -0
- package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts +64 -0
- package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/types/t2s.types.d.ts +22 -0
- package/dist/typescript/commonjs/features/chatbot/types/t2s.types.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/types/translation.types.d.ts +23 -0
- package/dist/typescript/commonjs/features/chatbot/types/translation.types.d.ts.map +1 -0
- package/dist/typescript/commonjs/index.d.ts +4 -0
- package/dist/typescript/commonjs/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/createFeature/createFeature.d.ts +7 -0
- package/dist/typescript/commonjs/lib/createFeature/createFeature.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/effector/createControllerEffect.d.ts +16 -0
- package/dist/typescript/commonjs/lib/effector/createControllerEffect.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/effector/createEntityFieldStore.d.ts +16 -0
- package/dist/typescript/commonjs/lib/effector/createEntityFieldStore.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/effector/index.d.ts +3 -0
- package/dist/typescript/commonjs/lib/effector/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/lib/helpers/helpers.d.ts +2 -0
- package/dist/typescript/commonjs/lib/helpers/helpers.d.ts.map +1 -0
- package/dist/typescript/commonjs/package.json +1 -0
- package/dist/typescript/commonjs/shared/hooks/useDebounce.d.ts +2 -0
- package/dist/typescript/commonjs/shared/hooks/useDebounce.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/ArrowRightIcon.d.ts +4 -0
- package/dist/typescript/commonjs/shared/icons/ArrowRightIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/ChatbotIcon.d.ts +4 -0
- package/dist/typescript/commonjs/shared/icons/ChatbotIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/CloseIcon.d.ts +4 -0
- package/dist/typescript/commonjs/shared/icons/CloseIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/GlobeIcon.d.ts +4 -0
- package/dist/typescript/commonjs/shared/icons/GlobeIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/PauseIcon.d.ts +4 -0
- package/dist/typescript/commonjs/shared/icons/PauseIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/PlayIcon.d.ts +4 -0
- package/dist/typescript/commonjs/shared/icons/PlayIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/SpeakerIcon.d.ts +4 -0
- package/dist/typescript/commonjs/shared/icons/SpeakerIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/icons/icon.types.d.ts +9 -0
- package/dist/typescript/commonjs/shared/icons/icon.types.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/translation/constants.d.ts +6 -0
- package/dist/typescript/commonjs/shared/translation/constants.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/translation/helpers.d.ts +6 -0
- package/dist/typescript/commonjs/shared/translation/helpers.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/translation/hooks.d.ts +5 -0
- package/dist/typescript/commonjs/shared/translation/hooks.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/translation/index.d.ts +6 -0
- package/dist/typescript/commonjs/shared/translation/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/translation/model.d.ts +5 -0
- package/dist/typescript/commonjs/shared/translation/model.d.ts.map +1 -0
- package/dist/typescript/commonjs/shared/translation/types.d.ts +8 -0
- package/dist/typescript/commonjs/shared/translation/types.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/Alternatives/Alternatives.d.ts +11 -0
- package/dist/typescript/module/features/chatbot/components/Alternatives/Alternatives.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/Alternatives/HelpRequestOption.d.ts +9 -0
- package/dist/typescript/module/features/chatbot/components/Alternatives/HelpRequestOption.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/ChatControls/ChatControls.d.ts +14 -0
- package/dist/typescript/module/features/chatbot/components/ChatControls/ChatControls.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/ChatMessage/ChatMessage.d.ts +17 -0
- package/dist/typescript/module/features/chatbot/components/ChatMessage/ChatMessage.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageLoader.d.ts +3 -0
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageLoader.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.d.ts +12 -0
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageTextToSpeech.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts +4 -0
- package/dist/typescript/module/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/ChatMessage/SentMessage.d.ts +4 -0
- package/dist/typescript/module/features/chatbot/components/ChatMessage/SentMessage.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts +21 -0
- package/dist/typescript/module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts +25 -0
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/ThreeDotsLoader/ThreeDotsLoader.d.ts +9 -0
- package/dist/typescript/module/features/chatbot/components/ThreeDotsLoader/ThreeDotsLoader.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/constants.d.ts +21 -0
- package/dist/typescript/module/features/chatbot/constants.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/helpers.d.ts +2 -0
- package/dist/typescript/module/features/chatbot/helpers.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/index.d.ts +5 -0
- package/dist/typescript/module/features/chatbot/index.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/model/api.d.ts +12 -0
- package/dist/typescript/module/features/chatbot/model/api.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/model/model.d.ts +73 -0
- package/dist/typescript/module/features/chatbot/model/model.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/model/t2s.d.ts +18 -0
- package/dist/typescript/module/features/chatbot/model/t2s.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/model/translation.d.ts +22 -0
- package/dist/typescript/module/features/chatbot/model/translation.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/types/api.types.d.ts +60 -0
- package/dist/typescript/module/features/chatbot/types/api.types.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/types/model.types.d.ts +64 -0
- package/dist/typescript/module/features/chatbot/types/model.types.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/types/t2s.types.d.ts +22 -0
- package/dist/typescript/module/features/chatbot/types/t2s.types.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/types/translation.types.d.ts +23 -0
- package/dist/typescript/module/features/chatbot/types/translation.types.d.ts.map +1 -0
- package/dist/typescript/module/index.d.ts +4 -0
- package/dist/typescript/module/index.d.ts.map +1 -0
- package/dist/typescript/module/lib/createFeature/createFeature.d.ts +7 -0
- package/dist/typescript/module/lib/createFeature/createFeature.d.ts.map +1 -0
- package/dist/typescript/module/lib/effector/createControllerEffect.d.ts +16 -0
- package/dist/typescript/module/lib/effector/createControllerEffect.d.ts.map +1 -0
- package/dist/typescript/module/lib/effector/createEntityFieldStore.d.ts +16 -0
- package/dist/typescript/module/lib/effector/createEntityFieldStore.d.ts.map +1 -0
- package/dist/typescript/module/lib/effector/index.d.ts +3 -0
- package/dist/typescript/module/lib/effector/index.d.ts.map +1 -0
- package/dist/typescript/module/lib/helpers/helpers.d.ts +2 -0
- package/dist/typescript/module/lib/helpers/helpers.d.ts.map +1 -0
- package/dist/typescript/module/package.json +1 -0
- package/dist/typescript/module/shared/hooks/useDebounce.d.ts +2 -0
- package/dist/typescript/module/shared/hooks/useDebounce.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/ArrowRightIcon.d.ts +4 -0
- package/dist/typescript/module/shared/icons/ArrowRightIcon.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/ChatbotIcon.d.ts +4 -0
- package/dist/typescript/module/shared/icons/ChatbotIcon.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/CloseIcon.d.ts +4 -0
- package/dist/typescript/module/shared/icons/CloseIcon.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/GlobeIcon.d.ts +4 -0
- package/dist/typescript/module/shared/icons/GlobeIcon.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/PauseIcon.d.ts +4 -0
- package/dist/typescript/module/shared/icons/PauseIcon.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/PlayIcon.d.ts +4 -0
- package/dist/typescript/module/shared/icons/PlayIcon.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/SpeakerIcon.d.ts +4 -0
- package/dist/typescript/module/shared/icons/SpeakerIcon.d.ts.map +1 -0
- package/dist/typescript/module/shared/icons/icon.types.d.ts +9 -0
- package/dist/typescript/module/shared/icons/icon.types.d.ts.map +1 -0
- package/dist/typescript/module/shared/translation/constants.d.ts +6 -0
- package/dist/typescript/module/shared/translation/constants.d.ts.map +1 -0
- package/dist/typescript/module/shared/translation/helpers.d.ts +6 -0
- package/dist/typescript/module/shared/translation/helpers.d.ts.map +1 -0
- package/dist/typescript/module/shared/translation/hooks.d.ts +5 -0
- package/dist/typescript/module/shared/translation/hooks.d.ts.map +1 -0
- package/dist/typescript/module/shared/translation/index.d.ts +6 -0
- package/dist/typescript/module/shared/translation/index.d.ts.map +1 -0
- package/dist/typescript/module/shared/translation/model.d.ts +5 -0
- package/dist/typescript/module/shared/translation/model.d.ts.map +1 -0
- package/dist/typescript/module/shared/translation/types.d.ts +8 -0
- package/dist/typescript/module/shared/translation/types.d.ts.map +1 -0
- package/package.json +73 -0
- package/src/features/chatbot/components/Alternatives/Alternatives.tsx +64 -0
- package/src/features/chatbot/components/Alternatives/HelpRequestOption.tsx +92 -0
- package/src/features/chatbot/components/ChatControls/ChatControls.tsx +103 -0
- package/src/features/chatbot/components/ChatMessage/ChatMessage.tsx +28 -0
- package/src/features/chatbot/components/ChatMessage/MessageLoader.tsx +42 -0
- package/src/features/chatbot/components/ChatMessage/MessageTextToSpeech.tsx +78 -0
- package/src/features/chatbot/components/ChatMessage/ReceivedMessage.tsx +73 -0
- package/src/features/chatbot/components/ChatMessage/SentMessage.tsx +31 -0
- package/src/features/chatbot/components/ChatMessages/ChatbotMessages.tsx +148 -0
- package/src/features/chatbot/components/Chatbot.tsx +92 -0
- package/src/features/chatbot/components/ThreeDotsLoader/ThreeDotsLoader.tsx +77 -0
- package/src/features/chatbot/constants.ts +30 -0
- package/src/features/chatbot/helpers.ts +4 -0
- package/src/features/chatbot/index.ts +4 -0
- package/src/features/chatbot/model/api.ts +28 -0
- package/src/features/chatbot/model/model.ts +277 -0
- package/src/features/chatbot/model/t2s.ts +107 -0
- package/src/features/chatbot/model/translation.ts +231 -0
- package/src/features/chatbot/types/api.types.ts +59 -0
- package/src/features/chatbot/types/model.types.ts +73 -0
- package/src/features/chatbot/types/t2s.types.ts +24 -0
- package/src/features/chatbot/types/translation.types.ts +23 -0
- package/src/index.ts +3 -0
- package/src/lib/createFeature/createFeature.tsx +21 -0
- package/src/lib/effector/createControllerEffect.ts +66 -0
- package/src/lib/effector/createEntityFieldStore.ts +43 -0
- package/src/lib/effector/index.ts +2 -0
- package/src/lib/helpers/helpers.ts +2 -0
- package/src/lib/localization/en.json +2 -0
- package/src/lib/localization/gb.json +2 -0
- package/src/lib/localization/sw.json +2 -0
- package/src/shared/hooks/useDebounce.ts +17 -0
- package/src/shared/icons/ArrowRightIcon.tsx +14 -0
- package/src/shared/icons/ChatbotIcon.tsx +109 -0
- package/src/shared/icons/CloseIcon.tsx +12 -0
- package/src/shared/icons/GlobeIcon.tsx +14 -0
- package/src/shared/icons/PauseIcon.tsx +16 -0
- package/src/shared/icons/PlayIcon.tsx +16 -0
- package/src/shared/icons/SpeakerIcon.tsx +22 -0
- package/src/shared/icons/icon.types.ts +8 -0
- package/src/shared/translation/constants.ts +10 -0
- package/src/shared/translation/helpers.ts +34 -0
- package/src/shared/translation/hooks.ts +28 -0
- package/src/shared/translation/index.ts +5 -0
- package/src/shared/translation/model.ts +15 -0
- package/src/shared/translation/types.ts +9 -0
- package/src/types/types.d.ts +4 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Svg, { Path, Defs, LinearGradient, Stop, Mask, G, Rect } from 'react-native-svg'
|
|
3
|
+
import { IconProps } from './icon.types'
|
|
4
|
+
|
|
5
|
+
export const ChatbotIcon = ({ width = 60, height = 60 }: IconProps) => (
|
|
6
|
+
<Svg width={width} height={height} viewBox="0 0 60 60" fill="none">
|
|
7
|
+
<Mask id="a" maskUnits="userSpaceOnUse" x={0} y={0} width={60} height={60}>
|
|
8
|
+
<Rect x="0" y="0" width="60" height="60" fill="white" />
|
|
9
|
+
<Rect x="10" y="10" width="40" height="40" fill="black" />
|
|
10
|
+
<Path d="M60 0H0v60h60V0z" fill="#ffffff" />
|
|
11
|
+
</Mask>
|
|
12
|
+
<G mask="url(#a)">
|
|
13
|
+
<Path
|
|
14
|
+
d="M53.869 8.767v14.384M6.448 8.767v14.384"
|
|
15
|
+
stroke="#A83900"
|
|
16
|
+
strokeWidth={1.0538}
|
|
17
|
+
strokeLinecap="round"
|
|
18
|
+
/>
|
|
19
|
+
<Path
|
|
20
|
+
d="M1.705 25.206c1.897-3.92 6.06-3.53 7.904-2.845L5.025 33.426c-1.897-1.107-5.216-4.3-3.32-8.22z"
|
|
21
|
+
fill="#FF7819"
|
|
22
|
+
/>
|
|
23
|
+
<Path
|
|
24
|
+
d="M58.295 25.206c-1.897-3.92-6.06-3.53-7.904-2.845l4.584 11.065c1.897-1.107 5.216-4.3 3.32-8.22z"
|
|
25
|
+
fill="#FF275E"
|
|
26
|
+
/>
|
|
27
|
+
<Path
|
|
28
|
+
d="M5.025 44.594v-9.168c.474-6.112 3.952-18.673 25.133-18.81 21.182-.138 25.186 12.593 25.291 18.81v9.168c0 6.111-4.954 11.065-11.064 11.065H16.09c-6.111 0-11.065-4.954-11.065-11.065z"
|
|
29
|
+
fill="#A83900"
|
|
30
|
+
/>
|
|
31
|
+
<Path
|
|
32
|
+
d="M5.025 42.594v-9.168c.474-6.112 3.952-18.673 25.133-18.81 21.182-.138 25.186 12.593 25.291 18.81v9.168c0 6.111-4.954 11.065-11.064 11.065H16.09c-6.111 0-11.065-4.954-11.065-11.065z"
|
|
33
|
+
fill="url(#paint0_linear_722_2)"
|
|
34
|
+
/>
|
|
35
|
+
<Mask id="b" maskUnits="userSpaceOnUse" x="10" y="22" width="40" height="26">
|
|
36
|
+
<Path
|
|
37
|
+
d="M42.356 47.81H18.118c-4.001 0-7.244-3.244-7.244-7.244v-7.298c0-6.639 5.674-11.223 11.855-11.223 2.96 0 5.071 1.202 6.287 2.092.703.515 1.597.53 2.302.02 1.86-1.348 3.617-2.112 6.902-2.112 6.006 0 11.38 5.532 11.38 11.223v7.298c0 4-3.243 7.244-7.244 7.244z"
|
|
38
|
+
fill="white"
|
|
39
|
+
/>
|
|
40
|
+
</Mask>
|
|
41
|
+
<Rect x="0" y="0" width="60" height="60" fill="#ffffff" mask="url(#b)" />
|
|
42
|
+
|
|
43
|
+
<G mask="url(#b)">
|
|
44
|
+
<Path
|
|
45
|
+
d="M52.566 52.989L15.97 16.393c-.597-.598-.174-1.62.67-1.62h36.596c.524 0 .949.425.949.95v36.595c0 .845-1.022 1.268-1.62.67z"
|
|
46
|
+
fill="#ffffff"
|
|
47
|
+
fillOpacity={0.1}
|
|
48
|
+
/>
|
|
49
|
+
<G filter="url(#filter0_d_722_2)">
|
|
50
|
+
<Path
|
|
51
|
+
d="M42.356 47.81H18.118c-4.001 0-7.244-3.244-7.244-7.244v-7.298c0-6.639 5.674-11.223 11.855-11.223 2.96 0 5.071 1.202 6.287 2.092.703.515 1.597.53 2.302.02 1.86-1.348 3.617-2.112 6.902-2.112 6.006 0 11.38 5.532 11.38 11.223v7.298c0 4-3.243 7.244-7.244 7.244z"
|
|
52
|
+
fill="#F2F2F4"
|
|
53
|
+
/>
|
|
54
|
+
</G>
|
|
55
|
+
<Path
|
|
56
|
+
d="M42.357 47.544h-24.24a6.978 6.978 0 01-6.977-6.978v-7.298c0-6.466 5.528-10.956 11.589-10.956 2.883 0 4.94 1.17 6.13 2.04.793.581 1.813.602 2.615.021.917-.664 1.797-1.176 2.845-1.524 1.049-.349 2.28-.537 3.9-.537 2.922 0 5.702 1.346 7.755 3.399 2.054 2.054 3.36 4.795 3.36 7.557v7.298a6.978 6.978 0 01-6.977 6.978z"
|
|
57
|
+
stroke="#811200"
|
|
58
|
+
strokeWidth={0.355555}
|
|
59
|
+
/>
|
|
60
|
+
<Path
|
|
61
|
+
opacity={0.33}
|
|
62
|
+
d="M16.248 34.66c-.294-2.838-1.239-5.452-2.775-7.616-.445.65-1.4 2.215-1.667 3.282a12.456 12.456 0 00-.333 2.666v7.334c0 .666-.1 2.542 1.333 4.333 1.333 1.667 3 2.333 3.442 2.333V34.66zM25.972 34.982v12.344h9.56V34.91c-.133-3.61-1.922-7.251-4.726-9.893 0 0-.37.309-.667.309-.333 0-.666-.334-1.333-.667-2.333-1.666-4-2-6.333-2-1.067 0-2.607.295-3.243.443 3.132 2.174 5.912 6.727 6.742 11.88zM44.94 34.965c0 1.312.15 5.606.153 11.727.682-.344 2.18-1.3 2.713-2.366.666-1.334 1-2.334 1-3.334v-8.666c-.111-1.334-.933-4.534-3.334-6.667-3-2.667-5.333-3.136-8-3.068 3.49 1.794 6.829 6.264 7.469 12.373z"
|
|
63
|
+
fill="#ffffff"
|
|
64
|
+
/>
|
|
65
|
+
</G>
|
|
66
|
+
<Path d="M6.448 9.4a2.53 2.53 0 100-5.059 2.53 2.53 0 000 5.059z" fill="#FD7E14" />
|
|
67
|
+
<Path d="M53.868 9.4a2.53 2.53 0 100-5.059 2.53 2.53 0 000 5.059z" fill="#FF275E" />
|
|
68
|
+
<Path
|
|
69
|
+
d="M26.364 40.065c.747 1.71 2.087 2.621 3.952 2.687 1.969.07 3.48-.882 4.268-2.687"
|
|
70
|
+
stroke="#FD7E14"
|
|
71
|
+
strokeWidth={1.68609}
|
|
72
|
+
strokeLinecap="round"
|
|
73
|
+
/>
|
|
74
|
+
<Path
|
|
75
|
+
d="M20.832 37.694a2.53 2.53 0 100-5.058 2.53 2.53 0 000 5.058z"
|
|
76
|
+
fill="#FD7E14"
|
|
77
|
+
stroke="#FD7E14"
|
|
78
|
+
strokeWidth={0.210761}
|
|
79
|
+
/>
|
|
80
|
+
<Path
|
|
81
|
+
d="M19.4 33.494l-.505.55a.729.729 0 101.081.977l.497-.559a.723.723 0 00-1.073-.968z"
|
|
82
|
+
fill="#ffffff"
|
|
83
|
+
/>
|
|
84
|
+
<Path
|
|
85
|
+
d="M40.117 37.694a2.53 2.53 0 100-5.059 2.53 2.53 0 000 5.059z"
|
|
86
|
+
fill="#FD7E14"
|
|
87
|
+
stroke="#FD7E14"
|
|
88
|
+
strokeWidth={0.210761}
|
|
89
|
+
/>
|
|
90
|
+
<Path
|
|
91
|
+
d="M38.842 33.494l-.505.55a.728.728 0 101.082.977l.496-.559a.723.723 0 00-1.073-.968z"
|
|
92
|
+
fill="#ffffff"
|
|
93
|
+
/>
|
|
94
|
+
</G>
|
|
95
|
+
<Defs>
|
|
96
|
+
<LinearGradient
|
|
97
|
+
id="paint0_linear_722_2"
|
|
98
|
+
x1={5.0249}
|
|
99
|
+
y1={36.0572}
|
|
100
|
+
x2={55.4494}
|
|
101
|
+
y2={36.0572}
|
|
102
|
+
gradientUnits="userSpaceOnUse"
|
|
103
|
+
>
|
|
104
|
+
<Stop stopColor="#FF245F" />
|
|
105
|
+
<Stop offset={1} stopColor="#FF7917" />
|
|
106
|
+
</LinearGradient>
|
|
107
|
+
</Defs>
|
|
108
|
+
</Svg>
|
|
109
|
+
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Svg, { Path } from 'react-native-svg'
|
|
3
|
+
import { IconProps } from './icon.types'
|
|
4
|
+
|
|
5
|
+
export const CloseIcon = ({ width = 22, height = 22, color = '#4D4D63' }: IconProps) => (
|
|
6
|
+
<Svg width={width} height={height} viewBox="0 0 22 23" fill="none">
|
|
7
|
+
<Path
|
|
8
|
+
d="M2.384 1.116A1.25 1.25 0 10.616 2.884L9.232 11.5.616 20.116a1.25 1.25 0 001.768 1.768L11 13.268l8.616 8.616a1.25 1.25 0 001.768-1.768L12.768 11.5l8.616-8.616a1.25 1.25 0 00-1.768-1.768L11 9.732 2.384 1.116z"
|
|
9
|
+
fill={color}
|
|
10
|
+
/>
|
|
11
|
+
</Svg>
|
|
12
|
+
)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Svg, { Path } from 'react-native-svg'
|
|
3
|
+
import { IconProps } from './icon.types'
|
|
4
|
+
|
|
5
|
+
export const GlobeIcon = ({ width = 20, height = 20, color = '#4D4D63' }: IconProps) => (
|
|
6
|
+
<Svg width={width} height={height} viewBox="0 0 20 21" fill="none">
|
|
7
|
+
<Path
|
|
8
|
+
fillRule="evenodd"
|
|
9
|
+
clipRule="evenodd"
|
|
10
|
+
d="M4.397 4.365a8.312 8.312 0 003.4 14.148l-.405-2.503-2.298-1.213a1.26 1.26 0 01-.672-1.114v-2.949c0-.442.231-.851.61-1.08l2.23-1.344a1.26 1.26 0 01.651-.181h2.653V6.006H9.348l-.352.557a1.26 1.26 0 01-1.065.587H5.677a1.26 1.26 0 01-1.26-1.244l-.02-1.54zM7.903.72C3.387 1.684 0 5.696 0 10.5c0 5.523 4.477 10 10 10s10-4.477 10-10c0-.997-.146-1.959-.417-2.867a1.333 1.333 0 00-.03-.126c-.184-.654-.528-1.444-1.04-2.255a10.052 10.052 0 00-1.985-2.327 9.681 9.681 0 00-5.808-2.4A10.145 10.145 0 009.966.5C9.2.5 8.512.585 7.903.72zm8.895 5.002c.358.509.66 1.06.899 1.644h-3.34a1.26 1.26 0 00-1.26 1.26v4.465l-.306 1.61-3.27 3.884-.494-3.057a1.26 1.26 0 00-.656-.914l-2.258-1.191v-2.445l1.92-1.158h2.965a1.26 1.26 0 001.26-1.26V5.575a1.26 1.26 0 00-1.26-1.26H9.11a1.26 1.26 0 00-1.066.586l-.352.558h-1.59l-.028-2.135c.38-.282 1.105-.707 2.176-.948a8.34 8.34 0 012.531-.148 8.272 8.272 0 014.565 1.912 8.832 8.832 0 011.451 1.582zm-5.109 12.915a8.311 8.311 0 006.495-9.58h-3.396v4.074c0 .079-.007.157-.022.235l-.334 1.762a1.26 1.26 0 01-.274.577l-2.469 2.932z"
|
|
11
|
+
fill={color}
|
|
12
|
+
/>
|
|
13
|
+
</Svg>
|
|
14
|
+
)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Svg, { Path } from 'react-native-svg'
|
|
3
|
+
import { IconProps } from './icon.types'
|
|
4
|
+
|
|
5
|
+
export const PauseIcon = ({ color = '#4D4D63', height = 16, width = 16 }: IconProps) => {
|
|
6
|
+
return (
|
|
7
|
+
<Svg width={width} height={height} viewBox="0 0 16 16" fill="none">
|
|
8
|
+
<Path
|
|
9
|
+
fillRule="evenodd"
|
|
10
|
+
clipRule="evenodd"
|
|
11
|
+
d="M1 2.476C1 1.661 1.66 1 2.476 1h2.762c.815 0 1.476.66 1.476 1.476v11.048c0 .815-.66 1.476-1.476 1.476H2.476C1.661 15 1 14.34 1 13.524V2.476zM9.286 2.476c0-.815.66-1.476 1.476-1.476h2.762C14.339 1 15 1.66 15 2.476v11.048c0 .815-.66 1.476-1.476 1.476h-2.762c-.815 0-1.476-.66-1.476-1.476V2.476z"
|
|
12
|
+
fill={color}
|
|
13
|
+
/>
|
|
14
|
+
</Svg>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Svg, { Path } from 'react-native-svg'
|
|
3
|
+
import { IconProps } from './icon.types'
|
|
4
|
+
|
|
5
|
+
export const PlayIcon = ({ color = '#4D4D63', height = 16, width = 16 }: IconProps) => {
|
|
6
|
+
return (
|
|
7
|
+
<Svg width={width} height={height} viewBox="0 0 16 16" fill="none">
|
|
8
|
+
<Path
|
|
9
|
+
fillRule="evenodd"
|
|
10
|
+
clipRule="evenodd"
|
|
11
|
+
d="M1.5 2.806C1.5 1.438 2.945.568 4.131 1.22l9.439 5.195c1.24.682 1.24 2.486 0 3.168L4.13 14.78c-1.186.653-2.631-.217-2.631-1.585V2.806z"
|
|
12
|
+
fill={color}
|
|
13
|
+
/>
|
|
14
|
+
</Svg>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Svg, { Path } from 'react-native-svg'
|
|
3
|
+
import { IconProps } from './icon.types'
|
|
4
|
+
|
|
5
|
+
export const SpeakerIcon = ({ width = 17, height = 17, color = '#4D4D63' }: IconProps) => {
|
|
6
|
+
return (
|
|
7
|
+
<Svg width={width} height={height} viewBox="0 0 17 17" fill="none">
|
|
8
|
+
<Path
|
|
9
|
+
fillRule="evenodd"
|
|
10
|
+
clipRule="evenodd"
|
|
11
|
+
d="M6.743 3.016c1.09-.94 2.735-.128 2.735 1.349v8.27c0 1.478-1.644 2.289-2.735 1.35L3.92 11.556H2.172C1.25 11.556.5 10.774.5 9.808V7.192c0-.966.749-1.748 1.672-1.748h1.75l2.82-2.428zM8.01 4.365c0-.182-.202-.281-.336-.166L4.824 6.653c-.243.21-.549.324-.864.324H2.172a.21.21 0 00-.205.215v2.616a.21.21 0 00.205.215H3.96c.315 0 .62.115.864.324l2.851 2.454c.134.115.336.016.336-.165V4.364zM11.18 4.36c.286-.3.75-.3 1.037 0 1.041 1.089 1.78 2.582 1.78 4.14 0 1.558-.739 3.051-1.78 4.14-.287.3-.751.3-1.038 0a.791.791 0 010-1.084c.836-.874 1.35-1.997 1.35-3.056s-.514-2.182-1.35-3.056a.791.791 0 010-1.084z"
|
|
12
|
+
fill={color}
|
|
13
|
+
/>
|
|
14
|
+
<Path
|
|
15
|
+
fillRule="evenodd"
|
|
16
|
+
clipRule="evenodd"
|
|
17
|
+
d="M13.057 2.725c.287-.3.75-.3 1.037 0C15.788 4.495 16.5 6.32 16.5 8.5c0 2.18-.713 4.006-2.406 5.775-.286.3-.75.3-1.037 0a.791.791 0 010-1.084c1.437-1.501 1.976-2.945 1.976-4.691s-.54-3.19-1.976-4.691a.791.791 0 010-1.084z"
|
|
18
|
+
fill={color}
|
|
19
|
+
/>
|
|
20
|
+
</Svg>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Locale } from './types'
|
|
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
|
+
|
|
6
|
+
export const LOCALIZATION_CONFIGS = {
|
|
7
|
+
[Locale.EN]: EN,
|
|
8
|
+
[Locale.GB]: GB,
|
|
9
|
+
[Locale.SW]: SW,
|
|
10
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { LOCALIZATION_CONFIGS } from './constants'
|
|
2
|
+
import { $localization, setLocalization } from './model'
|
|
3
|
+
import { GetText, LocalizationConfig } from './types'
|
|
4
|
+
|
|
5
|
+
export const getSubstitutedString = (str: string, substitutions: Record<string, string> = {}) => {
|
|
6
|
+
const substitutionsArray = Object.entries(substitutions)
|
|
7
|
+
let result = str
|
|
8
|
+
|
|
9
|
+
if (!substitutionsArray.length) return result
|
|
10
|
+
|
|
11
|
+
substitutionsArray.forEach(([key, value]) => {
|
|
12
|
+
result = result.replace(`{{${key}}}`, value)
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
return result
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const getText: GetText = (key, args = null) => {
|
|
19
|
+
const config = $localization.getState()
|
|
20
|
+
|
|
21
|
+
const translation = config?.[key]
|
|
22
|
+
|
|
23
|
+
if (translation && args) {
|
|
24
|
+
return getSubstitutedString(translation, args)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return translation ?? key
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const setFeaturesLocalization = (
|
|
31
|
+
generator: ((config: typeof LOCALIZATION_CONFIGS) => LocalizationConfig) | LocalizationConfig,
|
|
32
|
+
) => {
|
|
33
|
+
setLocalization(generator)
|
|
34
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useUnit } from 'effector-react'
|
|
2
|
+
import { $localization, setLocalization } from './model'
|
|
3
|
+
import { GetText, LocalizationConfig } from './types'
|
|
4
|
+
import { useEffect } from 'react'
|
|
5
|
+
import { LOCALIZATION_CONFIGS } from './constants'
|
|
6
|
+
import { getSubstitutedString } from './helpers'
|
|
7
|
+
|
|
8
|
+
export const useText = (): GetText => {
|
|
9
|
+
const config = useUnit($localization) as LocalizationConfig
|
|
10
|
+
|
|
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
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const useFeaturesLocalization = (
|
|
23
|
+
generator: ((config: typeof LOCALIZATION_CONFIGS) => LocalizationConfig) | LocalizationConfig,
|
|
24
|
+
) => {
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
setLocalization(generator)
|
|
27
|
+
}, [generator])
|
|
28
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { useFeaturesLocalization, useText } from './hooks'
|
|
2
|
+
export { setFeaturesLocalization, getText as t } from './helpers'
|
|
3
|
+
export { $localization, setLocalization } from './model'
|
|
4
|
+
export { Locale } from './types'
|
|
5
|
+
export type { LocalizationConfig } from './types'
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createEvent, createStore } from 'effector'
|
|
2
|
+
import { Locale, LocalizationConfig } from './types'
|
|
3
|
+
import { LOCALIZATION_CONFIGS } from './constants'
|
|
4
|
+
|
|
5
|
+
export const setLocalization = createEvent<
|
|
6
|
+
LocalizationConfig | ((config: typeof LOCALIZATION_CONFIGS) => LocalizationConfig)
|
|
7
|
+
>()
|
|
8
|
+
|
|
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
|
+
)
|