@magmamath/students-features 0.7.1 → 0.8.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/features/chatbot/components/{ChatMessages/ChatbotMessages.js → Chat/Chat.js} +8 -15
- package/dist/commonjs/features/chatbot/components/Chat/Chat.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js +1 -1
- package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/ChatInput.js +74 -0
- package/dist/commonjs/features/chatbot/components/ChatInput/ChatInput.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/ChatInput/RequestHintButton.js +144 -0
- package/dist/commonjs/features/chatbot/components/ChatInput/RequestHintButton.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/ChatInput/freeText/ChatTextInput.js +138 -0
- package/dist/commonjs/features/chatbot/components/ChatInput/freeText/ChatTextInput.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.js +66 -0
- package/dist/commonjs/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/ChatInput/freeText/SendMessageButton.js +106 -0
- package/dist/commonjs/features/chatbot/components/ChatInput/freeText/SendMessageButton.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js +7 -4
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/Chatbot.js +2 -2
- package/dist/commonjs/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/commonjs/features/chatbot/constants.js +6 -1
- package/dist/commonjs/features/chatbot/constants.js.map +1 -1
- package/dist/commonjs/features/chatbot/helpers.js +75 -1
- package/dist/commonjs/features/chatbot/helpers.js.map +1 -1
- package/dist/commonjs/features/chatbot/index.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js +49 -11
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatBotTextInput.js +16 -0
- package/dist/commonjs/features/chatbot/model/ChatBotTextInput.js.map +1 -0
- package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js +11 -19
- package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/{translation.js → ChatbotTranslation.js} +29 -1
- package/dist/commonjs/features/chatbot/model/ChatbotTranslation.js.map +1 -0
- package/dist/commonjs/features/chatbot/types/model.types.js +6 -1
- package/dist/commonjs/features/chatbot/types/model.types.js.map +1 -1
- package/dist/commonjs/features/chatbot/types/units.types.js +10 -0
- package/dist/commonjs/features/chatbot/types/units.types.js.map +1 -1
- package/dist/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.js +8 -0
- package/dist/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.js.map +1 -1
- package/dist/commonjs/features/exampleSolution/components/LavaIcon.js +44 -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/shared/hooks/useKeyDownListener.js +3 -2
- package/dist/commonjs/shared/hooks/useKeyDownListener.js.map +1 -1
- package/dist/commonjs/shared/translation/localization/ca.json +3 -2
- package/dist/commonjs/shared/translation/localization/en.json +3 -2
- package/dist/commonjs/shared/translation/localization/gb.json +3 -2
- package/dist/commonjs/shared/translation/localization/sct.json +3 -2
- package/dist/commonjs/shared/translation/localization/sw.json +3 -2
- package/dist/module/features/chatbot/components/{ChatMessages/ChatbotMessages.js → Chat/Chat.js} +6 -13
- package/dist/module/features/chatbot/components/Chat/Chat.js.map +1 -0
- package/dist/module/features/chatbot/components/ChatControls/ChatControls.js +1 -1
- package/dist/module/features/chatbot/components/ChatControls/ChatControls.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatInput/ChatInput.js +67 -0
- package/dist/module/features/chatbot/components/ChatInput/ChatInput.js.map +1 -0
- package/dist/module/features/chatbot/components/ChatInput/RequestHintButton.js +138 -0
- package/dist/module/features/chatbot/components/ChatInput/RequestHintButton.js.map +1 -0
- package/dist/module/features/chatbot/components/ChatInput/freeText/ChatTextInput.js +131 -0
- package/dist/module/features/chatbot/components/ChatInput/freeText/ChatTextInput.js.map +1 -0
- package/dist/module/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.js +60 -0
- package/dist/module/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.js.map +1 -0
- package/dist/module/features/chatbot/components/ChatInput/freeText/SendMessageButton.js +98 -0
- package/dist/module/features/chatbot/components/ChatInput/freeText/SendMessageButton.js.map +1 -0
- package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js +7 -4
- package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -1
- package/dist/module/features/chatbot/components/Chatbot.js +2 -2
- package/dist/module/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/module/features/chatbot/constants.js +5 -0
- package/dist/module/features/chatbot/constants.js.map +1 -1
- package/dist/module/features/chatbot/helpers.js +71 -0
- package/dist/module/features/chatbot/helpers.js.map +1 -1
- package/dist/module/features/chatbot/index.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatBotModel.js +49 -11
- package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatBotTextInput.js +11 -0
- package/dist/module/features/chatbot/model/ChatBotTextInput.js.map +1 -0
- package/dist/module/features/chatbot/model/ChatBotThreadManager.js +11 -19
- package/dist/module/features/chatbot/model/ChatBotThreadManager.js.map +1 -1
- package/dist/module/features/chatbot/model/{translation.js → ChatbotTranslation.js} +29 -1
- package/dist/module/features/chatbot/model/ChatbotTranslation.js.map +1 -0
- package/dist/module/features/chatbot/types/model.types.js +5 -0
- package/dist/module/features/chatbot/types/model.types.js.map +1 -1
- package/dist/module/features/chatbot/types/units.types.js +6 -0
- package/dist/module/features/chatbot/types/units.types.js.map +1 -1
- package/dist/module/features/exampleSolution/components/ExampleSolutionModalContent.js +8 -0
- package/dist/module/features/exampleSolution/components/ExampleSolutionModalContent.js.map +1 -1
- package/dist/module/features/exampleSolution/components/LavaIcon.js +36 -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/shared/hooks/useKeyDownListener.js +3 -2
- package/dist/module/shared/hooks/useKeyDownListener.js.map +1 -1
- package/dist/module/shared/translation/localization/ca.json +3 -2
- package/dist/module/shared/translation/localization/en.json +3 -2
- package/dist/module/shared/translation/localization/gb.json +3 -2
- package/dist/module/shared/translation/localization/sct.json +3 -2
- package/dist/module/shared/translation/localization/sw.json +3 -2
- package/dist/typescript/{module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts → commonjs/features/chatbot/components/Chat/Chat.d.ts} +3 -3
- package/dist/typescript/commonjs/features/chatbot/components/Chat/Chat.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatControls/ChatControls.d.ts +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatControls/ChatControls.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/ChatInput.d.ts +9 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/ChatInput.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/RequestHintButton.d.ts +16 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/RequestHintButton.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/ChatTextInput.d.ts +16 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/ChatTextInput.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.d.ts +11 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/SendMessageButton.d.ts +10 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/SendMessageButton.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageLoader.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts +3 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/constants.d.ts +5 -0
- package/dist/typescript/commonjs/features/chatbot/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/helpers.d.ts +5 -0
- package/dist/typescript/commonjs/features/chatbot/helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts +5 -6
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotTextInput.d.ts +8 -0
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotTextInput.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts +3 -2
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -1
- package/dist/typescript/{module/features/chatbot/model/translation.d.ts → commonjs/features/chatbot/model/ChatbotTranslation.d.ts} +3 -2
- package/dist/typescript/commonjs/features/chatbot/model/ChatbotTranslation.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts +28 -6
- package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts +28 -3
- package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/translation.types.d.ts +5 -0
- package/dist/typescript/commonjs/features/chatbot/types/translation.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts +5 -0
- package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.d.ts.map +1 -1
- 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/shared/hooks/useKeyDownListener.d.ts +1 -1
- package/dist/typescript/commonjs/shared/hooks/useKeyDownListener.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/hooks/useKeyboard.d.ts +1 -1
- package/dist/typescript/commonjs/shared/hooks/useKeyboard.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/constants.d.ts +5 -0
- package/dist/typescript/commonjs/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/model.d.ts +2 -0
- package/dist/typescript/commonjs/shared/translation/model.d.ts.map +1 -1
- package/dist/typescript/{commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts → module/features/chatbot/components/Chat/Chat.d.ts} +3 -3
- package/dist/typescript/module/features/chatbot/components/Chat/Chat.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/ChatControls/ChatControls.d.ts +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatControls/ChatControls.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatInput/ChatInput.d.ts +9 -0
- package/dist/typescript/module/features/chatbot/components/ChatInput/ChatInput.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/ChatInput/RequestHintButton.d.ts +16 -0
- package/dist/typescript/module/features/chatbot/components/ChatInput/RequestHintButton.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/ChatTextInput.d.ts +16 -0
- package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/ChatTextInput.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.d.ts +11 -0
- package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/SendMessageButton.d.ts +10 -0
- package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/SendMessageButton.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageLoader.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts +3 -1
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/constants.d.ts +5 -0
- package/dist/typescript/module/features/chatbot/constants.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/helpers.d.ts +5 -0
- package/dist/typescript/module/features/chatbot/helpers.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts +5 -6
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotTextInput.d.ts +8 -0
- package/dist/typescript/module/features/chatbot/model/ChatBotTextInput.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts +3 -2
- package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -1
- package/dist/typescript/{commonjs/features/chatbot/model/translation.d.ts → module/features/chatbot/model/ChatbotTranslation.d.ts} +3 -2
- package/dist/typescript/module/features/chatbot/model/ChatbotTranslation.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/types/api.types.d.ts +28 -6
- package/dist/typescript/module/features/chatbot/types/api.types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/model.types.d.ts +28 -3
- package/dist/typescript/module/features/chatbot/types/model.types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/translation.types.d.ts +5 -0
- package/dist/typescript/module/features/chatbot/types/translation.types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/units.types.d.ts +5 -0
- package/dist/typescript/module/features/chatbot/types/units.types.d.ts.map +1 -1
- package/dist/typescript/module/features/exampleSolution/components/ExampleSolutionModalContent.d.ts.map +1 -1
- 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/shared/hooks/useKeyDownListener.d.ts +1 -1
- package/dist/typescript/module/shared/hooks/useKeyDownListener.d.ts.map +1 -1
- package/dist/typescript/module/shared/hooks/useKeyboard.d.ts +1 -1
- package/dist/typescript/module/shared/hooks/useKeyboard.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/constants.d.ts +5 -0
- package/dist/typescript/module/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/model.d.ts +2 -0
- package/dist/typescript/module/shared/translation/model.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/chatbot/components/{ChatMessages/ChatbotMessages.tsx → Chat/Chat.tsx} +13 -18
- package/src/features/chatbot/components/ChatControls/ChatControls.tsx +2 -2
- package/src/features/chatbot/components/ChatInput/ChatInput.tsx +88 -0
- package/src/features/chatbot/components/ChatInput/RequestHintButton.tsx +156 -0
- package/src/features/chatbot/components/ChatInput/freeText/ChatTextInput.tsx +156 -0
- package/src/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.tsx +71 -0
- package/src/features/chatbot/components/ChatInput/freeText/SendMessageButton.tsx +111 -0
- package/src/features/chatbot/components/ChatMessage/MessageLoader.tsx +6 -2
- package/src/features/chatbot/components/Chatbot.tsx +5 -3
- package/src/features/chatbot/constants.ts +7 -0
- package/src/features/chatbot/helpers.ts +70 -1
- package/src/features/chatbot/index.ts +1 -0
- package/src/features/chatbot/model/ChatBotModel.ts +82 -37
- package/src/features/chatbot/model/ChatBotTextInput.ts +10 -0
- package/src/features/chatbot/model/ChatBotThreadManager.ts +17 -19
- package/src/features/chatbot/model/{translation.ts → ChatbotTranslation.ts} +32 -2
- package/src/features/chatbot/types/api.types.ts +31 -6
- package/src/features/chatbot/types/model.types.ts +35 -2
- package/src/features/chatbot/types/translation.types.ts +6 -0
- package/src/features/chatbot/types/units.types.ts +6 -0
- package/src/features/exampleSolution/components/ExampleSolutionModalContent.tsx +4 -0
- package/src/features/exampleSolution/components/LavaIcon.tsx +35 -0
- package/src/features/exampleSolution/components/MessageBlock.tsx +67 -0
- package/src/shared/hooks/useKeyDownListener.ts +3 -1
- package/src/shared/translation/localization/ca.json +3 -2
- package/src/shared/translation/localization/en.json +3 -2
- package/src/shared/translation/localization/gb.json +3 -2
- package/src/shared/translation/localization/sct.json +3 -2
- package/src/shared/translation/localization/sw.json +3 -2
- package/dist/commonjs/features/chatbot/components/Alternatives/Alternatives.js +0 -59
- package/dist/commonjs/features/chatbot/components/Alternatives/Alternatives.js.map +0 -1
- package/dist/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.js +0 -99
- package/dist/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.js.map +0 -1
- package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +0 -1
- package/dist/commonjs/features/chatbot/model/translation.js.map +0 -1
- package/dist/module/features/chatbot/components/Alternatives/Alternatives.js +0 -53
- package/dist/module/features/chatbot/components/Alternatives/Alternatives.js.map +0 -1
- package/dist/module/features/chatbot/components/Alternatives/HelpRequestOption.js +0 -92
- package/dist/module/features/chatbot/components/Alternatives/HelpRequestOption.js.map +0 -1
- package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +0 -1
- package/dist/module/features/chatbot/model/translation.js.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/Alternatives/Alternatives.d.ts +0 -11
- package/dist/typescript/commonjs/features/chatbot/components/Alternatives/Alternatives.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.d.ts +0 -10
- package/dist/typescript/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/Alternatives/Alternatives.d.ts +0 -11
- package/dist/typescript/module/features/chatbot/components/Alternatives/Alternatives.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/Alternatives/HelpRequestOption.d.ts +0 -10
- package/dist/typescript/module/features/chatbot/components/Alternatives/HelpRequestOption.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/model/translation.d.ts.map +0 -1
- package/src/features/chatbot/components/Alternatives/Alternatives.tsx +0 -60
- package/src/features/chatbot/components/Alternatives/HelpRequestOption.tsx +0 -91
|
@@ -3,26 +3,47 @@ export type GetAlternativesPayload = {
|
|
|
3
3
|
municipalityId: string;
|
|
4
4
|
assignmentClassGrade: number;
|
|
5
5
|
} | null;
|
|
6
|
+
export type AlternativesOptions = {
|
|
7
|
+
default: ChatAnswer[];
|
|
8
|
+
hints: ChatAnswer[];
|
|
9
|
+
};
|
|
6
10
|
export type GetAlternativesResponse = {
|
|
7
11
|
chatAccess?: boolean;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
isOpenChatEnabled?: boolean;
|
|
13
|
+
version: string;
|
|
14
|
+
options: AlternativesOptions;
|
|
15
|
+
};
|
|
16
|
+
export type SendMessagePayload = {
|
|
17
|
+
problemDescription?: string;
|
|
18
|
+
correctAnswer?: string | string[];
|
|
19
|
+
answerOptions?: string[];
|
|
20
|
+
altText?: string;
|
|
21
|
+
language?: string;
|
|
22
|
+
message: string;
|
|
23
|
+
conversationId?: string;
|
|
24
|
+
};
|
|
25
|
+
export type SendMessageResponse = {
|
|
26
|
+
message: string;
|
|
27
|
+
conversationId?: string | null;
|
|
12
28
|
};
|
|
13
29
|
export type PostMessagePayload = {
|
|
14
30
|
language: string;
|
|
15
31
|
problemAnswer: string[];
|
|
32
|
+
problemDescription: string;
|
|
16
33
|
answer?: string | string[];
|
|
17
|
-
|
|
34
|
+
answerOptions?: string[];
|
|
18
35
|
imageAltText?: string;
|
|
19
36
|
imageCdnId?: string;
|
|
37
|
+
freeTextMessage?: string;
|
|
38
|
+
conversationId?: string | null;
|
|
20
39
|
};
|
|
21
40
|
export type PostMessageResponse = {
|
|
22
41
|
message: string;
|
|
23
42
|
options: ChatAnswer[];
|
|
24
|
-
endMessage?: boolean;
|
|
25
43
|
threadId: string;
|
|
44
|
+
endMessage?: boolean;
|
|
45
|
+
conversationId?: string | null;
|
|
46
|
+
errorStrokeIds?: string[];
|
|
26
47
|
};
|
|
27
48
|
export type GoogleTranslatePayload = {
|
|
28
49
|
text: string[];
|
|
@@ -66,6 +87,7 @@ export type ChatHintPayload = {
|
|
|
66
87
|
};
|
|
67
88
|
export type ChatHintResponse = {
|
|
68
89
|
message: string;
|
|
90
|
+
conversationId?: string | null;
|
|
69
91
|
errorStrokeIds?: string[];
|
|
70
92
|
};
|
|
71
93
|
export type ErrorSpottingPayload = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/api.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAElE,MAAM,MAAM,sBAAsB,GAAG;IACnC,cAAc,EAAE,MAAM,CAAA;IACtB,oBAAoB,EAAE,MAAM,CAAA;CAC7B,GAAG,IAAI,CAAA;AAER,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,OAAO,EAAE;
|
|
1
|
+
{"version":3,"file":"api.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/api.types.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Store } from 'effector';
|
|
2
|
-
import { ChatHintPayload, ChatHintResponse, ErrorSpottingPayload, ErrorSpottingResponse, GetAlternativesPayload, GetAlternativesResponse, GoogleText2SpeechPayload, GoogleText2SpeechResponse, GoogleTranslatePayload, GoogleTranslateResponse, PostMessagePayload, PostMessageResponse } from './api.types';
|
|
2
|
+
import { ChatHintPayload, ChatHintResponse, ErrorSpottingPayload, ErrorSpottingResponse, GetAlternativesPayload, GetAlternativesResponse, GoogleText2SpeechPayload, GoogleText2SpeechResponse, GoogleTranslatePayload, GoogleTranslateResponse, PostMessagePayload, PostMessageResponse, SendMessagePayload, SendMessageResponse } from './api.types';
|
|
3
3
|
import { ExtendWithOptional } from '../../../lib/helpers/types';
|
|
4
|
-
import { ChatAnswer, ConversationMessage, FullStrokeData } from './units.types';
|
|
4
|
+
import { ChatAnswer, ChatItem, ConversationMessage, FullStrokeData } from './units.types';
|
|
5
5
|
export type ChatbotMessages = {
|
|
6
6
|
error: ConversationMessage;
|
|
7
7
|
start: ConversationMessage;
|
|
@@ -10,6 +10,7 @@ export type ChatbotMessages = {
|
|
|
10
10
|
};
|
|
11
11
|
export type ChatbotApiRequests = {
|
|
12
12
|
getAlternatives: (props: GetAlternativesPayload) => Promise<GetAlternativesResponse>;
|
|
13
|
+
sendMessage: (props: SendMessagePayload) => Promise<SendMessageResponse>;
|
|
13
14
|
postMessage: (props: PostMessagePayload) => Promise<PostMessageResponse>;
|
|
14
15
|
postTranslateText: (props: GoogleTranslatePayload) => Promise<GoogleTranslateResponse>;
|
|
15
16
|
postTextToSpeech: (props: GoogleText2SpeechPayload) => Promise<GoogleText2SpeechResponse>;
|
|
@@ -32,10 +33,13 @@ export type ChatbotModelProps = {
|
|
|
32
33
|
export type SendHelpParams = {
|
|
33
34
|
message: string;
|
|
34
35
|
translatedMessage?: string;
|
|
36
|
+
isFreeText?: boolean;
|
|
35
37
|
};
|
|
36
38
|
export type SendHelpProps = SendHelpParams & {
|
|
37
39
|
key: string;
|
|
38
40
|
context: ChatbotContext | null;
|
|
41
|
+
cache: Record<string, ChatItem>;
|
|
42
|
+
isFreeText?: boolean;
|
|
39
43
|
};
|
|
40
44
|
export type SetHintMessageProps = {
|
|
41
45
|
key: string;
|
|
@@ -77,9 +81,30 @@ export type ChatbotContext = {
|
|
|
77
81
|
problem: string;
|
|
78
82
|
problemAnswer: string[];
|
|
79
83
|
answer?: string | string[];
|
|
84
|
+
answerOptions?: string[];
|
|
80
85
|
translationTargetLanguage: string;
|
|
81
86
|
imageDescription?: string;
|
|
82
|
-
|
|
87
|
+
imageCdnId?: string;
|
|
83
88
|
};
|
|
89
|
+
export type ReinitConversationProps = {
|
|
90
|
+
key: string;
|
|
91
|
+
};
|
|
92
|
+
export declare enum ChatRequestType {
|
|
93
|
+
Freetext = "sendMessage",
|
|
94
|
+
Hint = "getHint"
|
|
95
|
+
}
|
|
96
|
+
type FreeTextWithConversationId = {
|
|
97
|
+
type: ChatRequestType.Freetext;
|
|
98
|
+
data: Pick<SendMessagePayload, 'message' | 'conversationId'>;
|
|
99
|
+
};
|
|
100
|
+
type FreeTextNewConversation = {
|
|
101
|
+
type: ChatRequestType.Freetext;
|
|
102
|
+
data: SendMessagePayload;
|
|
103
|
+
};
|
|
104
|
+
export type HintRequest = {
|
|
105
|
+
type: ChatRequestType.Hint;
|
|
106
|
+
data: ChatHintPayload;
|
|
107
|
+
};
|
|
108
|
+
export type ChatRequestPayload = FreeTextWithConversationId | FreeTextNewConversation | HintRequest;
|
|
84
109
|
export {};
|
|
85
110
|
//# sourceMappingURL=model.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/model.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"model.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/model.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAEzF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,mBAAmB,CAAA;IAC1B,KAAK,EAAE,mBAAmB,CAAA;IAC1B,UAAU,EAAE,mBAAmB,CAAA;IAC/B,iBAAiB,EAAE,UAAU,CAAA;CAC9B,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,eAAe,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAA;IACpF,WAAW,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAA;IACxE,WAAW,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAA;IACxE,iBAAiB,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAA;IACtF,gBAAgB,EAAE,CAAC,KAAK,EAAE,wBAAwB,KAAK,OAAO,CAAC,yBAAyB,CAAC,CAAA;IACzF;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAA;CAC5E,CAAA;AAED,KAAK,eAAe,GAAG;IACrB,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACpB,GAAG,EAAE,IAAI,CAAC,kBAAkB,EAAE,aAAa,CAAC,GAAG;QAC7C,WAAW,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAA;KACnE,CAAA;IACD,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,EAAE,eAAe,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,MAAM,CAAA;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG;IAC3C,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,cAAc,GAAG,IAAI,CAAA;IAC9B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,GAAG,EAAE,MAAM,CAAA;CACZ,GAAG,mBAAmB,CAAA;AAEvB,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,eAAe,EAAE;QACf,GAAG,EAAE,MAAM,CAAA;QACX,QAAQ,EAAE,mBAAmB,EAAE,CAAA;KAChC,CAAA;IACD,YAAY,CAAC,EAAE,uBAAuB,GAAG,IAAI,CAAA;CAC9C,GAAG,sBAAsB,CAAA;AAE1B,oBAAY,cAAc;IACxB,IAAI,SAAS;IACb,QAAQ,aAAa;CACtB;AAED,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,CACpD,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,EACrC,mBAAmB,CACpB,CAAA;AAED,KAAK,yBAAyB,GAAG;IAC/B,OAAO,EAAE,cAAc,EAAE,CAAA;IACzB,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,KAAK,uBAAuB,GAAG;IAC7B,OAAO,CAAC,EAAE,cAAc,EAAE,CAAA;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,qBAAqB,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;IAC3C;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAAA;IACnE,UAAU,IAAI,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAAA;CACtD,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC1B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,yBAAyB,EAAE,MAAM,CAAA;IACjC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,oBAAY,eAAe;IACzB,QAAQ,gBAAgB;IACxB,IAAI,YAAY;CACjB;AAED,KAAK,0BAA0B,GAAG;IAChC,IAAI,EAAE,eAAe,CAAC,QAAQ,CAAA;IAC9B,IAAI,EAAE,IAAI,CAAC,kBAAkB,EAAE,SAAS,GAAG,gBAAgB,CAAC,CAAA;CAC7D,CAAA;AAED,KAAK,uBAAuB,GAAG;IAC7B,IAAI,EAAE,eAAe,CAAC,QAAQ,CAAA;IAC9B,IAAI,EAAE,kBAAkB,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,eAAe,CAAC,IAAI,CAAA;IAC1B,IAAI,EAAE,eAAe,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG,0BAA0B,GAAG,uBAAuB,GAAG,WAAW,CAAA"}
|
|
@@ -30,4 +30,9 @@ export type TranslateRequestProps<List extends Record<string, string[]>> = {
|
|
|
30
30
|
textList: List;
|
|
31
31
|
targetLanguage: string;
|
|
32
32
|
};
|
|
33
|
+
export type TranslateSingleMessageFxParams = {
|
|
34
|
+
message: string;
|
|
35
|
+
targetLanguage: string | null;
|
|
36
|
+
isTranslationActive: boolean;
|
|
37
|
+
};
|
|
33
38
|
//# sourceMappingURL=translation.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/translation.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAEnD,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,mBAAmB,EAAE,CAAA;IAC/B,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,uBAAuB,GAAG,IAAI,CAAA;CAC7C,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,mBAAmB,EAAE,CAAA;IAC/B,cAAc,EAAE,MAAM,CAAA;IACtB,mBAAmB,EAAE,OAAO,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,iCAAiC,GAAG;IAC9C,YAAY,EAAE,uBAAuB,CAAA;IACrC,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB,kBAAkB,EAAE,MAAM,EAAE,CAAA;CAC7B,CAAA;AACD,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,EAAE,uBAAuB,GAAG,IAAI,CAAA;IAC5C,WAAW,EAAE,mBAAmB,GAAG,SAAS,CAAA;CAC7C,CAAA;AACD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,WAAW,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAC5B,YAAY,EAAE;QACZ,KAAK,EAAE,MAAM,EAAE,CAAA;QACf,OAAO,EAAE,MAAM,EAAE,CAAA;KAClB,GAAG,IAAI,CAAA;CACT,CAAA;AAED,MAAM,MAAM,qBAAqB,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,IAAI;IACzE,QAAQ,EAAE,IAAI,CAAA;IACd,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA"}
|
|
1
|
+
{"version":3,"file":"translation.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/translation.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAEnD,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,mBAAmB,EAAE,CAAA;IAC/B,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,uBAAuB,GAAG,IAAI,CAAA;CAC7C,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,mBAAmB,EAAE,CAAA;IAC/B,cAAc,EAAE,MAAM,CAAA;IACtB,mBAAmB,EAAE,OAAO,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,iCAAiC,GAAG;IAC9C,YAAY,EAAE,uBAAuB,CAAA;IACrC,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB,kBAAkB,EAAE,MAAM,EAAE,CAAA;CAC7B,CAAA;AACD,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY,EAAE,uBAAuB,GAAG,IAAI,CAAA;IAC5C,WAAW,EAAE,mBAAmB,GAAG,SAAS,CAAA;CAC7C,CAAA;AACD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,WAAW,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAC5B,YAAY,EAAE;QACZ,KAAK,EAAE,MAAM,EAAE,CAAA;QACf,OAAO,EAAE,MAAM,EAAE,CAAA;KAClB,GAAG,IAAI,CAAA;CACT,CAAA;AAED,MAAM,MAAM,qBAAqB,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,IAAI;IACzE,QAAQ,EAAE,IAAI,CAAA;IACd,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,8BAA8B,GAAG;IAC3C,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,mBAAmB,EAAE,OAAO,CAAA;CAC7B,CAAA"}
|
|
@@ -31,5 +31,10 @@ export type ChatItem = {
|
|
|
31
31
|
messages: ConversationMessage[];
|
|
32
32
|
isAvailable: boolean;
|
|
33
33
|
currentThread: IThreadItem | null;
|
|
34
|
+
conversationId?: string | null;
|
|
34
35
|
};
|
|
36
|
+
export declare enum ChatInputMode {
|
|
37
|
+
FreeText = 1,
|
|
38
|
+
Option = 2
|
|
39
|
+
}
|
|
35
40
|
//# sourceMappingURL=units.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"units.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/units.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG;IACnB,CAAC,EAAE,MAAM,EAAE,CAAA;IACX,CAAC,EAAE,MAAM,EAAE,CAAA;CACZ,CAAA;AACD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG;IACpC,EAAE,EAAE,MAAM,CAAA;CACX,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,OAAO,EAAE,cAAc,EAAE,GAAG,IAAI,CAAA;IAChC,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,eAAe,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,YAAY,EAAE,OAAO,CAAA;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,EAAE,mBAAmB,EAAE,CAAA;IAC/B,WAAW,EAAE,OAAO,CAAA;IACpB,aAAa,EAAE,WAAW,GAAG,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"units.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/units.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG;IACnB,CAAC,EAAE,MAAM,EAAE,CAAA;IACX,CAAC,EAAE,MAAM,EAAE,CAAA;CACZ,CAAA;AACD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG;IACpC,EAAE,EAAE,MAAM,CAAA;CACX,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,OAAO,EAAE,cAAc,EAAE,GAAG,IAAI,CAAA;IAChC,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,eAAe,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,YAAY,EAAE,OAAO,CAAA;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,EAAE,mBAAmB,EAAE,CAAA;IAC/B,WAAW,EAAE,OAAO,CAAA;IACpB,aAAa,EAAE,WAAW,GAAG,IAAI,CAAA;IACjC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/B,CAAA;AAED,oBAAY,aAAa;IACvB,QAAQ,IAAI;IACZ,MAAM,IAAI;CACX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExampleSolutionModalContent.d.ts","sourceRoot":"","sources":["../../../../../../src/features/exampleSolution/components/ExampleSolutionModalContent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"ExampleSolutionModalContent.d.ts","sourceRoot":"","sources":["../../../../../../src/features/exampleSolution/components/ExampleSolutionModalContent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAA;AAKrD,KAAK,gCAAgC,GAAG;IACtC,MAAM,EAAE,0BAA0B,CAAA;CACnC,CAAA;AAID,eAAO,MAAM,2BAA2B,8CAErC,gCAAgC,sBA0BlC,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import { ExampleSolutionStatuses } from '../constants';
|
|
4
|
+
type LavaIconProps = {
|
|
5
|
+
status: ExampleSolutionStatuses;
|
|
6
|
+
style?: StyleProp<ViewStyle>;
|
|
7
|
+
};
|
|
8
|
+
export declare const LavaIcon: ({ status, style }: LavaIconProps) => React.JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=LavaIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LavaIcon.d.ts","sourceRoot":"","sources":["../../../../../../src/features/exampleSolution/components/LavaIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAItD,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,uBAAuB,CAAA;IAC/B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAC7B,CAAA;AAED,eAAO,MAAM,QAAQ,sBAAuB,aAAa,sBAoBxD,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ExampleSolutionStatuses } from '../constants';
|
|
4
|
+
type MessageBlockProps = {
|
|
5
|
+
status: ExampleSolutionStatuses;
|
|
6
|
+
style?: StyleProp<ViewStyle>;
|
|
7
|
+
};
|
|
8
|
+
export declare const MessageBlock: ({ status, style }: MessageBlockProps) => React.JSX.Element | null;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=MessageBlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageBlock.d.ts","sourceRoot":"","sources":["../../../../../../src/features/exampleSolution/components/MessageBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAc,SAAS,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,KAAK,MAAM,OAAO,CAAA;AAUzB,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAEtD,KAAK,iBAAiB,GAAG;IACvB,MAAM,EAAE,uBAAuB,CAAA;IAC/B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAC7B,CAAA;AAED,eAAO,MAAM,YAAY,sBAAuB,iBAAiB,6BA0BhE,CAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { KeyboardKeys } from '../../lib/constants';
|
|
2
|
-
export declare const useKeyDownListener: (callback: (event: KeyboardEvent) => void, overrideKeys?: KeyboardKeys[]) => void;
|
|
2
|
+
export declare const useKeyDownListener: (callback: (event: KeyboardEvent) => void, enabled?: boolean, overrideKeys?: KeyboardKeys[]) => void;
|
|
3
3
|
//# sourceMappingURL=useKeyDownListener.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useKeyDownListener.d.ts","sourceRoot":"","sources":["../../../../../src/shared/hooks/useKeyDownListener.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAElD,eAAO,MAAM,kBAAkB,aACnB,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,
|
|
1
|
+
{"version":3,"file":"useKeyDownListener.d.ts","sourceRoot":"","sources":["../../../../../src/shared/hooks/useKeyDownListener.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAElD,eAAO,MAAM,kBAAkB,aACnB,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,2DAuBzC,CAAA"}
|
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
* - On web (default), it returns the `useKeyDownListener` hook, which allows you
|
|
8
8
|
* to register a callback that is triggered on keydown events.
|
|
9
9
|
*/
|
|
10
|
-
export declare const useKeyBoard: (callback: (event: KeyboardEvent) => void, overrideKeys?: import("../../lib/constants").KeyboardKeys[]) => void;
|
|
10
|
+
export declare const useKeyBoard: (callback: (event: KeyboardEvent) => void, enabled?: boolean, overrideKeys?: import("../../lib/constants").KeyboardKeys[]) => void;
|
|
11
11
|
//# sourceMappingURL=useKeyboard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useKeyboard.d.ts","sourceRoot":"","sources":["../../../../../src/shared/hooks/useKeyboard.ts"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"useKeyboard.d.ts","sourceRoot":"","sources":["../../../../../src/shared/hooks/useKeyboard.ts"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,oIAGtB,CAAC"}
|
|
@@ -19,6 +19,7 @@ export declare const LOCALIZATION_CONFIGS: {
|
|
|
19
19
|
errorMessage: string;
|
|
20
20
|
howCanIHelp: string;
|
|
21
21
|
showError: string;
|
|
22
|
+
inputPlaceholder: string;
|
|
22
23
|
};
|
|
23
24
|
gifCelebrations: {
|
|
24
25
|
greatStart: string;
|
|
@@ -52,6 +53,7 @@ export declare const LOCALIZATION_CONFIGS: {
|
|
|
52
53
|
errorMessage: string;
|
|
53
54
|
howCanIHelp: string;
|
|
54
55
|
showError: string;
|
|
56
|
+
inputPlaceholder: string;
|
|
55
57
|
};
|
|
56
58
|
gifCelebrations: {
|
|
57
59
|
greatStart: string;
|
|
@@ -85,6 +87,7 @@ export declare const LOCALIZATION_CONFIGS: {
|
|
|
85
87
|
errorMessage: string;
|
|
86
88
|
howCanIHelp: string;
|
|
87
89
|
showError: string;
|
|
90
|
+
inputPlaceholder: string;
|
|
88
91
|
};
|
|
89
92
|
gifCelebrations: {
|
|
90
93
|
greatStart: string;
|
|
@@ -118,6 +121,7 @@ export declare const LOCALIZATION_CONFIGS: {
|
|
|
118
121
|
errorMessage: string;
|
|
119
122
|
howCanIHelp: string;
|
|
120
123
|
showError: string;
|
|
124
|
+
inputPlaceholder: string;
|
|
121
125
|
};
|
|
122
126
|
gifCelebrations: {
|
|
123
127
|
greatStart: string;
|
|
@@ -151,6 +155,7 @@ export declare const LOCALIZATION_CONFIGS: {
|
|
|
151
155
|
errorMessage: string;
|
|
152
156
|
howCanIHelp: string;
|
|
153
157
|
showError: string;
|
|
158
|
+
inputPlaceholder: string;
|
|
154
159
|
};
|
|
155
160
|
gifCelebrations: {
|
|
156
161
|
greatStart: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/shared/translation/constants.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/shared/translation/constants.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMhC,CAAA"}
|
|
@@ -20,6 +20,7 @@ export declare const setLocalization: import("effector").EventCallable<{
|
|
|
20
20
|
errorMessage: string;
|
|
21
21
|
howCanIHelp: string;
|
|
22
22
|
showError: string;
|
|
23
|
+
inputPlaceholder: string;
|
|
23
24
|
};
|
|
24
25
|
gifCelebrations: {
|
|
25
26
|
greatStart: string;
|
|
@@ -53,6 +54,7 @@ export declare const $localization: import("effector").StoreWritable<{
|
|
|
53
54
|
errorMessage: string;
|
|
54
55
|
howCanIHelp: string;
|
|
55
56
|
showError: string;
|
|
57
|
+
inputPlaceholder: string;
|
|
56
58
|
};
|
|
57
59
|
gifCelebrations: {
|
|
58
60
|
greatStart: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../../src/shared/translation/model.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,YAAY,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAElD,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../../src/shared/translation/model.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,YAAY,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAElD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cACD,OAAO,oBAAoB,KAAK,YAAY,EACpE,CAAA;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMzB,CAAA"}
|
package/package.json
CHANGED
|
@@ -5,29 +5,29 @@ import { useStoreMap, useUnit } from 'effector-react'
|
|
|
5
5
|
import { ChatbotModel } from '../../model/ChatBotModel'
|
|
6
6
|
import { ChatMessage } from '../ChatMessage/ChatMessage'
|
|
7
7
|
import { MessageLoader } from '../ChatMessage/MessageLoader'
|
|
8
|
-
import {
|
|
8
|
+
import { ChatInput } from '../ChatInput/ChatInput'
|
|
9
9
|
import { MessageVariant } from '../../types/model.types'
|
|
10
10
|
import { ColorScheme } from '../../types/style.types'
|
|
11
11
|
|
|
12
|
-
type ChatbotMessagesProps = {
|
|
13
|
-
model: ChatbotModel
|
|
14
|
-
isHintFeedback: boolean
|
|
15
|
-
isTextToSpeechEnabled: boolean
|
|
16
|
-
colorScheme?: ColorScheme
|
|
17
|
-
}
|
|
18
|
-
|
|
19
12
|
const TOOLBAR_HEIGHT = 140
|
|
20
13
|
const BOTTOM_OFFSET = Platform.select({
|
|
21
14
|
web: 265,
|
|
22
15
|
default: 294,
|
|
23
16
|
})
|
|
24
17
|
|
|
25
|
-
|
|
18
|
+
type ChatProps = {
|
|
19
|
+
model: ChatbotModel
|
|
20
|
+
isHintFeedback: boolean
|
|
21
|
+
isTextToSpeechEnabled: boolean
|
|
22
|
+
colorScheme?: ColorScheme
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const Chat = ({
|
|
26
26
|
model,
|
|
27
27
|
isHintFeedback,
|
|
28
28
|
isTextToSpeechEnabled,
|
|
29
29
|
colorScheme = ColorScheme.Blue,
|
|
30
|
-
}:
|
|
30
|
+
}: ChatProps) => {
|
|
31
31
|
const dimensions = useWindowDimensions()
|
|
32
32
|
const ref = useRef<ScrollView>(null)
|
|
33
33
|
const isOpen = useUnit(model.$isOpen)
|
|
@@ -45,10 +45,6 @@ export const ChatbotMessages = ({
|
|
|
45
45
|
|
|
46
46
|
const MAX_HEIGHT = dimensions.height - TOOLBAR_HEIGHT - BOTTOM_OFFSET
|
|
47
47
|
|
|
48
|
-
const askChatForHelp = (message: string, translatedMessage?: string) => {
|
|
49
|
-
void model.sendHelpRequestFx({ message, translatedMessage })
|
|
50
|
-
}
|
|
51
|
-
|
|
52
48
|
return (
|
|
53
49
|
<View style={[styles.container, { maxHeight: MAX_HEIGHT }]}>
|
|
54
50
|
<ScrollView
|
|
@@ -88,12 +84,11 @@ export const ChatbotMessages = ({
|
|
|
88
84
|
</View>
|
|
89
85
|
)}
|
|
90
86
|
|
|
91
|
-
{
|
|
92
|
-
<
|
|
93
|
-
onPressAlternative={askChatForHelp}
|
|
94
|
-
hasMessages={messages.length > 1}
|
|
87
|
+
{isOpen && (
|
|
88
|
+
<ChatInput
|
|
95
89
|
isHintFeedback={isHintFeedback}
|
|
96
90
|
colorScheme={colorScheme}
|
|
91
|
+
hasMessages={messages.length > 1}
|
|
97
92
|
/>
|
|
98
93
|
)}
|
|
99
94
|
</ScrollView>
|
|
@@ -18,7 +18,7 @@ type ChatControlsProps = {
|
|
|
18
18
|
model: ChatbotModel
|
|
19
19
|
onPressChatIcon: () => void
|
|
20
20
|
onPressClose: () => void
|
|
21
|
-
ButtonWrapper
|
|
21
|
+
ButtonWrapper?: ComponentType<PropsWithChildren>
|
|
22
22
|
iconSize?: { width: number; height: number }
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -26,7 +26,7 @@ export const ChatControls = ({
|
|
|
26
26
|
model,
|
|
27
27
|
onPressChatIcon,
|
|
28
28
|
onPressClose,
|
|
29
|
-
ButtonWrapper,
|
|
29
|
+
ButtonWrapper = React.Fragment,
|
|
30
30
|
iconSize = { width: 80, height: 100 },
|
|
31
31
|
}: ChatControlsProps) => {
|
|
32
32
|
const isOpen = useUnit(model.$isOpen)
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React, { useCallback, useMemo } from 'react'
|
|
2
|
+
import { IS_WEB } from '@magmamath/react-native-ui'
|
|
3
|
+
import { StyleSheet, View } from 'react-native'
|
|
4
|
+
import { useStoreMap, useUnit } from 'effector-react'
|
|
5
|
+
import { useChatModel } from '../../context/ChatBotModelContext'
|
|
6
|
+
import { ColorScheme } from '../../types/style.types'
|
|
7
|
+
import { HintButtonVariant, RequestHintButton } from './RequestHintButton'
|
|
8
|
+
import { FreeTextInputBlock } from './freeText/FreeTextInputBlock'
|
|
9
|
+
|
|
10
|
+
export type ChatInputProps = {
|
|
11
|
+
hasMessages: boolean
|
|
12
|
+
isHintFeedback: boolean
|
|
13
|
+
colorScheme?: ColorScheme
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const ChatInput = ({
|
|
17
|
+
isHintFeedback,
|
|
18
|
+
hasMessages,
|
|
19
|
+
colorScheme = ColorScheme.Blue,
|
|
20
|
+
}: ChatInputProps) => {
|
|
21
|
+
const model = useChatModel()
|
|
22
|
+
const alternatives = useUnit(model.$alternatives)
|
|
23
|
+
const isTranslated = useUnit(model.translation.$isTranslated)
|
|
24
|
+
const isTranslationPending = useUnit(model.translation.translateAllMessagesFx.pending)
|
|
25
|
+
const isHelpRequestPending = useUnit(model.sendHelpRequestFx.pending)
|
|
26
|
+
|
|
27
|
+
const lastMessageOptions = useStoreMap(model.$currentChatData, ({ messages }) => {
|
|
28
|
+
const lastMessage = messages.at(-1)
|
|
29
|
+
return lastMessage?.options ?? []
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
const option = useMemo(() => {
|
|
33
|
+
if (hasMessages && lastMessageOptions.length) return lastMessageOptions[0]
|
|
34
|
+
|
|
35
|
+
const shouldShowNextHintOption =
|
|
36
|
+
(isHintFeedback && !!alternatives?.options.hints) || hasMessages || isHelpRequestPending
|
|
37
|
+
|
|
38
|
+
return shouldShowNextHintOption
|
|
39
|
+
? alternatives?.options.hints[0]
|
|
40
|
+
: alternatives?.options.default[0]
|
|
41
|
+
}, [hasMessages, isHintFeedback, isHelpRequestPending, lastMessageOptions, alternatives?.options])
|
|
42
|
+
|
|
43
|
+
const optionLabel =
|
|
44
|
+
(isTranslated && !isTranslationPending ? option?.translatedText : option?.text) ?? ''
|
|
45
|
+
|
|
46
|
+
if (!option) return null
|
|
47
|
+
|
|
48
|
+
const sendMessage = useCallback(() => {
|
|
49
|
+
void model.sendHelpRequestFx({
|
|
50
|
+
message: option.text,
|
|
51
|
+
translatedMessage: option.translatedText,
|
|
52
|
+
})
|
|
53
|
+
}, [option.text, option.translatedText])
|
|
54
|
+
|
|
55
|
+
const shouldDisableInput =
|
|
56
|
+
isHelpRequestPending || (hasMessages && lastMessageOptions.length === 0)
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<View style={styles.container}>
|
|
60
|
+
{IS_WEB && alternatives?.isOpenChatEnabled ? (
|
|
61
|
+
<FreeTextInputBlock
|
|
62
|
+
optionLabel={optionLabel}
|
|
63
|
+
onOptionPress={sendMessage}
|
|
64
|
+
disabled={shouldDisableInput}
|
|
65
|
+
colorScheme={colorScheme}
|
|
66
|
+
/>
|
|
67
|
+
) : (
|
|
68
|
+
<RequestHintButton
|
|
69
|
+
onPress={sendMessage}
|
|
70
|
+
label={optionLabel}
|
|
71
|
+
disabled={shouldDisableInput}
|
|
72
|
+
colorScheme={colorScheme}
|
|
73
|
+
variant={HintButtonVariant.Default}
|
|
74
|
+
/>
|
|
75
|
+
)}
|
|
76
|
+
</View>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const styles = StyleSheet.create({
|
|
81
|
+
container: {
|
|
82
|
+
flex: 1,
|
|
83
|
+
width: 305,
|
|
84
|
+
alignItems: 'center',
|
|
85
|
+
justifyContent: 'center',
|
|
86
|
+
marginVertical: 8,
|
|
87
|
+
},
|
|
88
|
+
})
|