@magmamath/students-features 0.6.14-rc.8 → 0.6.14
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/Alternatives/Alternatives.js +59 -0
- package/dist/commonjs/features/chatbot/components/Alternatives/Alternatives.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.js +99 -0
- package/dist/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js +4 -7
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/{Chat/Chat.js → ChatMessages/ChatbotMessages.js} +9 -12
- package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/Chatbot.js +3 -5
- package/dist/commonjs/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/commonjs/features/chatbot/constants.js +1 -6
- package/dist/commonjs/features/chatbot/constants.js.map +1 -1
- package/dist/commonjs/features/chatbot/index.js +0 -7
- package/dist/commonjs/features/chatbot/index.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js +3 -13
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js +10 -32
- package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatbotApi.js +0 -3
- package/dist/commonjs/features/chatbot/model/ChatbotApi.js.map +1 -1
- package/dist/commonjs/features/chatbot/types/model.types.js.map +1 -1
- package/dist/commonjs/features/chatbot/types/units.types.js +0 -10
- package/dist/commonjs/features/chatbot/types/units.types.js.map +1 -1
- package/dist/commonjs/features/exampleSolution/ExampleSolutionModal.js +1 -3
- package/dist/commonjs/features/exampleSolution/ExampleSolutionModal.js.map +1 -1
- package/dist/commonjs/features/exampleSolution/assets/grid.webp +0 -0
- package/dist/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.js +11 -8
- package/dist/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.js.map +1 -1
- package/dist/commonjs/features/exampleSolution/components/QuestionSection.js +7 -7
- package/dist/commonjs/features/exampleSolution/components/QuestionSection.js.map +1 -1
- package/dist/commonjs/features/exampleSolution/components/SolutionSection.js +48 -28
- package/dist/commonjs/features/exampleSolution/components/SolutionSection.js.map +1 -1
- package/dist/commonjs/features/exampleSolution/model/ExampleSolution.model.js +3 -1
- package/dist/commonjs/features/exampleSolution/model/ExampleSolution.model.js.map +1 -1
- package/dist/commonjs/shared/translation/localization/ca.json +2 -2
- package/dist/commonjs/shared/translation/localization/en.json +2 -2
- package/dist/commonjs/shared/translation/localization/gb.json +2 -2
- package/dist/commonjs/shared/translation/localization/sct.json +2 -2
- package/dist/commonjs/shared/translation/localization/sw.json +3 -3
- package/dist/module/features/chatbot/components/Alternatives/Alternatives.js +53 -0
- package/dist/module/features/chatbot/components/Alternatives/Alternatives.js.map +1 -0
- package/dist/module/features/chatbot/components/Alternatives/HelpRequestOption.js +92 -0
- package/dist/module/features/chatbot/components/Alternatives/HelpRequestOption.js.map +1 -0
- package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js +4 -7
- package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -1
- package/dist/module/features/chatbot/components/{Chat/Chat.js → ChatMessages/ChatbotMessages.js} +7 -10
- package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -0
- package/dist/module/features/chatbot/components/Chatbot.js +3 -5
- package/dist/module/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/module/features/chatbot/constants.js +0 -5
- package/dist/module/features/chatbot/constants.js.map +1 -1
- package/dist/module/features/chatbot/index.js +0 -1
- package/dist/module/features/chatbot/index.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatBotModel.js +3 -13
- package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatBotThreadManager.js +10 -32
- package/dist/module/features/chatbot/model/ChatBotThreadManager.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatbotApi.js +0 -3
- package/dist/module/features/chatbot/model/ChatbotApi.js.map +1 -1
- package/dist/module/features/chatbot/types/model.types.js.map +1 -1
- package/dist/module/features/chatbot/types/units.types.js +0 -6
- package/dist/module/features/chatbot/types/units.types.js.map +1 -1
- package/dist/module/features/exampleSolution/ExampleSolutionModal.js +1 -3
- package/dist/module/features/exampleSolution/ExampleSolutionModal.js.map +1 -1
- package/dist/module/features/exampleSolution/assets/grid.webp +0 -0
- package/dist/module/features/exampleSolution/components/ExampleSolutionModalContent.js +11 -8
- package/dist/module/features/exampleSolution/components/ExampleSolutionModalContent.js.map +1 -1
- package/dist/module/features/exampleSolution/components/QuestionSection.js +9 -9
- package/dist/module/features/exampleSolution/components/QuestionSection.js.map +1 -1
- package/dist/module/features/exampleSolution/components/SolutionSection.js +50 -30
- package/dist/module/features/exampleSolution/components/SolutionSection.js.map +1 -1
- package/dist/module/features/exampleSolution/model/ExampleSolution.model.js +3 -1
- package/dist/module/features/exampleSolution/model/ExampleSolution.model.js.map +1 -1
- package/dist/module/shared/translation/localization/ca.json +2 -2
- package/dist/module/shared/translation/localization/en.json +2 -2
- package/dist/module/shared/translation/localization/gb.json +2 -2
- package/dist/module/shared/translation/localization/sct.json +2 -2
- package/dist/module/shared/translation/localization/sw.json +3 -3
- 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 +10 -0
- package/dist/typescript/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageLoader.d.ts.map +1 -1
- package/dist/typescript/{module/features/chatbot/components/Chat/Chat.d.ts → commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts} +2 -4
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts +0 -2
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/constants.d.ts +0 -5
- package/dist/typescript/commonjs/features/chatbot/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/index.d.ts +0 -1
- package/dist/typescript/commonjs/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts +0 -4
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts +2 -5
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatbotApi.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts +4 -9
- 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 +0 -20
- package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts +0 -18
- package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/exampleSolution/ExampleSolutionModal.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.d.ts +5 -1
- package/dist/typescript/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/exampleSolution/components/QuestionSection.d.ts +2 -1
- package/dist/typescript/commonjs/features/exampleSolution/components/QuestionSection.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/exampleSolution/components/SolutionSection.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/exampleSolution/model/ExampleSolution.model.d.ts +3 -2
- package/dist/typescript/commonjs/features/exampleSolution/model/ExampleSolution.model.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/exampleSolution/types.d.ts +2 -1
- package/dist/typescript/commonjs/features/exampleSolution/types.d.ts.map +1 -1
- 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 +10 -0
- package/dist/typescript/module/features/chatbot/components/Alternatives/HelpRequestOption.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageLoader.d.ts.map +1 -1
- package/dist/typescript/{commonjs/features/chatbot/components/Chat/Chat.d.ts → module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts} +2 -4
- package/dist/typescript/module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts +0 -2
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/constants.d.ts +0 -5
- package/dist/typescript/module/features/chatbot/constants.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/index.d.ts +0 -1
- package/dist/typescript/module/features/chatbot/index.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts +0 -4
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts +2 -5
- package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatbotApi.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/api.types.d.ts +4 -9
- 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 +0 -20
- package/dist/typescript/module/features/chatbot/types/model.types.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/units.types.d.ts +0 -18
- package/dist/typescript/module/features/chatbot/types/units.types.d.ts.map +1 -1
- package/dist/typescript/module/features/exampleSolution/ExampleSolutionModal.d.ts.map +1 -1
- package/dist/typescript/module/features/exampleSolution/components/ExampleSolutionModalContent.d.ts +5 -1
- package/dist/typescript/module/features/exampleSolution/components/ExampleSolutionModalContent.d.ts.map +1 -1
- package/dist/typescript/module/features/exampleSolution/components/QuestionSection.d.ts +2 -1
- package/dist/typescript/module/features/exampleSolution/components/QuestionSection.d.ts.map +1 -1
- package/dist/typescript/module/features/exampleSolution/components/SolutionSection.d.ts.map +1 -1
- package/dist/typescript/module/features/exampleSolution/model/ExampleSolution.model.d.ts +3 -2
- package/dist/typescript/module/features/exampleSolution/model/ExampleSolution.model.d.ts.map +1 -1
- package/dist/typescript/module/features/exampleSolution/types.d.ts +2 -1
- package/dist/typescript/module/features/exampleSolution/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/chatbot/components/Alternatives/Alternatives.tsx +60 -0
- package/src/features/chatbot/components/Alternatives/HelpRequestOption.tsx +91 -0
- package/src/features/chatbot/components/ChatMessage/MessageLoader.tsx +2 -6
- package/src/features/chatbot/components/{Chat/Chat.tsx → ChatMessages/ChatbotMessages.tsx} +6 -10
- package/src/features/chatbot/components/Chatbot.tsx +2 -6
- package/src/features/chatbot/constants.ts +0 -7
- package/src/features/chatbot/index.ts +0 -2
- package/src/features/chatbot/model/ChatBotModel.ts +26 -44
- package/src/features/chatbot/model/ChatBotThreadManager.ts +9 -38
- package/src/features/chatbot/model/ChatbotApi.ts +0 -2
- package/src/features/chatbot/types/api.types.ts +4 -10
- package/src/features/chatbot/types/model.types.ts +0 -27
- package/src/features/chatbot/types/units.types.ts +0 -22
- package/src/features/exampleSolution/ExampleSolutionModal.tsx +1 -7
- package/src/features/exampleSolution/assets/grid.webp +0 -0
- package/src/features/exampleSolution/components/ExampleSolutionModalContent.tsx +15 -9
- package/src/features/exampleSolution/components/QuestionSection.tsx +11 -7
- package/src/features/exampleSolution/components/SolutionSection.tsx +61 -28
- package/src/features/exampleSolution/model/ExampleSolution.model.ts +5 -2
- package/src/features/exampleSolution/types.ts +2 -1
- package/src/shared/translation/localization/ca.json +2 -2
- package/src/shared/translation/localization/en.json +2 -2
- package/src/shared/translation/localization/gb.json +2 -2
- package/src/shared/translation/localization/sct.json +2 -2
- package/src/shared/translation/localization/sw.json +3 -3
- package/dist/commonjs/features/chatbot/components/Chat/Chat.js.map +0 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/ChatInput.js +0 -53
- package/dist/commonjs/features/chatbot/components/ChatInput/ChatInput.js.map +0 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/InputOption.js +0 -39
- package/dist/commonjs/features/chatbot/components/ChatInput/InputOption.js.map +0 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/InputOptionWithTextArea.js +0 -38
- package/dist/commonjs/features/chatbot/components/ChatInput/InputOptionWithTextArea.js.map +0 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/RequestHintButton.js +0 -140
- package/dist/commonjs/features/chatbot/components/ChatInput/RequestHintButton.js.map +0 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/freeText/ChatTextInput.js +0 -142
- package/dist/commonjs/features/chatbot/components/ChatInput/freeText/ChatTextInput.js.map +0 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.js +0 -44
- package/dist/commonjs/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.js.map +0 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/freeText/SendMessageButton.js +0 -105
- package/dist/commonjs/features/chatbot/components/ChatInput/freeText/SendMessageButton.js.map +0 -1
- package/dist/commonjs/features/exampleSolution/assets/grid.png +0 -0
- package/dist/module/features/chatbot/components/Chat/Chat.js.map +0 -1
- package/dist/module/features/chatbot/components/ChatInput/ChatInput.js +0 -47
- package/dist/module/features/chatbot/components/ChatInput/ChatInput.js.map +0 -1
- package/dist/module/features/chatbot/components/ChatInput/InputOption.js +0 -34
- package/dist/module/features/chatbot/components/ChatInput/InputOption.js.map +0 -1
- package/dist/module/features/chatbot/components/ChatInput/InputOptionWithTextArea.js +0 -32
- package/dist/module/features/chatbot/components/ChatInput/InputOptionWithTextArea.js.map +0 -1
- package/dist/module/features/chatbot/components/ChatInput/RequestHintButton.js +0 -132
- package/dist/module/features/chatbot/components/ChatInput/RequestHintButton.js.map +0 -1
- package/dist/module/features/chatbot/components/ChatInput/freeText/ChatTextInput.js +0 -134
- package/dist/module/features/chatbot/components/ChatInput/freeText/ChatTextInput.js.map +0 -1
- package/dist/module/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.js +0 -38
- package/dist/module/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.js.map +0 -1
- package/dist/module/features/chatbot/components/ChatInput/freeText/SendMessageButton.js +0 -97
- package/dist/module/features/chatbot/components/ChatInput/freeText/SendMessageButton.js.map +0 -1
- package/dist/module/features/exampleSolution/assets/grid.png +0 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chat/Chat.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/ChatInput.d.ts +0 -4
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/ChatInput.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/InputOption.d.ts +0 -4
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/InputOption.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/InputOptionWithTextArea.d.ts +0 -4
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/InputOptionWithTextArea.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/RequestHintButton.d.ts +0 -18
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/RequestHintButton.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/ChatTextInput.d.ts +0 -10
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/ChatTextInput.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.d.ts +0 -11
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.d.ts.map +0 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/SendMessageButton.d.ts +0 -10
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/SendMessageButton.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/Chat/Chat.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/ChatInput/ChatInput.d.ts +0 -4
- package/dist/typescript/module/features/chatbot/components/ChatInput/ChatInput.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/ChatInput/InputOption.d.ts +0 -4
- package/dist/typescript/module/features/chatbot/components/ChatInput/InputOption.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/ChatInput/InputOptionWithTextArea.d.ts +0 -4
- package/dist/typescript/module/features/chatbot/components/ChatInput/InputOptionWithTextArea.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/ChatInput/RequestHintButton.d.ts +0 -18
- package/dist/typescript/module/features/chatbot/components/ChatInput/RequestHintButton.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/ChatTextInput.d.ts +0 -10
- package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/ChatTextInput.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.d.ts +0 -11
- package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.d.ts.map +0 -1
- package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/SendMessageButton.d.ts +0 -10
- package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/SendMessageButton.d.ts.map +0 -1
- package/src/features/chatbot/components/ChatInput/ChatInput.tsx +0 -56
- package/src/features/chatbot/components/ChatInput/InputOption.tsx +0 -29
- package/src/features/chatbot/components/ChatInput/InputOptionWithTextArea.tsx +0 -27
- package/src/features/chatbot/components/ChatInput/RequestHintButton.tsx +0 -160
- package/src/features/chatbot/components/ChatInput/freeText/ChatTextInput.tsx +0 -133
- package/src/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.tsx +0 -42
- package/src/features/chatbot/components/ChatInput/freeText/SendMessageButton.tsx +0 -110
- package/src/features/exampleSolution/assets/grid.png +0 -0
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ColorScheme } from './style.types'
|
|
2
|
-
|
|
3
1
|
export type Stroke = {
|
|
4
2
|
x: number[]
|
|
5
3
|
y: number[]
|
|
@@ -37,23 +35,3 @@ export type ChatItem = {
|
|
|
37
35
|
isAvailable: boolean
|
|
38
36
|
currentThread: IThreadItem | null
|
|
39
37
|
}
|
|
40
|
-
|
|
41
|
-
export type ChatInputAreaProps = {
|
|
42
|
-
onPressAlternative: (message: string, translatedMessage?: string) => void
|
|
43
|
-
hasMessages: boolean
|
|
44
|
-
isHintFeedback: boolean
|
|
45
|
-
inputMode: ChatInputMode
|
|
46
|
-
colorScheme?: ColorScheme
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export enum ChatInputMode {
|
|
50
|
-
FreeText = 1,
|
|
51
|
-
Option = 2,
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export type ChatInputProps = {
|
|
55
|
-
message: string
|
|
56
|
-
disabled: boolean
|
|
57
|
-
onPress: () => void
|
|
58
|
-
colorScheme: ColorScheme
|
|
59
|
-
}
|
|
@@ -18,12 +18,6 @@ export const ExampleSolutionModal = ({
|
|
|
18
18
|
container: { paddingHorizontal: SPACING[800] },
|
|
19
19
|
}}
|
|
20
20
|
onClose={closeModal}
|
|
21
|
-
content={
|
|
22
|
-
<ExampleSolutionModalContent
|
|
23
|
-
model={params.model}
|
|
24
|
-
payload={params.payload}
|
|
25
|
-
cacheKey={params.cacheKey}
|
|
26
|
-
/>
|
|
27
|
-
}
|
|
21
|
+
content={<ExampleSolutionModalContent params={params} />}
|
|
28
22
|
/>
|
|
29
23
|
)
|
|
Binary file
|
|
@@ -10,11 +10,13 @@ import { QuestionSection } from './QuestionSection'
|
|
|
10
10
|
import { SolutionSection } from './SolutionSection'
|
|
11
11
|
import { useExampleSolution } from '../hooks/useExampleSolution'
|
|
12
12
|
|
|
13
|
+
type ExampleSolutionModalContentProps = {
|
|
14
|
+
params: ExampleSolutionModalParams
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
export const ExampleSolutionModalContent = ({
|
|
14
|
-
model,
|
|
15
|
-
|
|
16
|
-
cacheKey,
|
|
17
|
-
}: ExampleSolutionModalParams) => {
|
|
18
|
+
params: { model, payload, cacheKey },
|
|
19
|
+
}: ExampleSolutionModalContentProps) => {
|
|
18
20
|
const { result, status } = useExampleSolution({ model, payload, cacheKey })
|
|
19
21
|
const localization = useUnit($localization)
|
|
20
22
|
|
|
@@ -24,7 +26,11 @@ export const ExampleSolutionModalContent = ({
|
|
|
24
26
|
{localization.exampleSolution.exampleSolution}
|
|
25
27
|
</Typography>
|
|
26
28
|
<View style={styles.content}>
|
|
27
|
-
<QuestionSection
|
|
29
|
+
<QuestionSection
|
|
30
|
+
status={status}
|
|
31
|
+
question={result?.question}
|
|
32
|
+
renderKatexComponent={model.renderKatexComponent}
|
|
33
|
+
/>
|
|
28
34
|
<SolutionSection status={status} answer={result?.answer} />
|
|
29
35
|
</View>
|
|
30
36
|
<MessageBlock status={status} style={styles.messageBlock} />
|
|
@@ -53,8 +59,8 @@ const styles = StyleSheet.create({
|
|
|
53
59
|
},
|
|
54
60
|
lavaIconContainer: {
|
|
55
61
|
position: 'absolute',
|
|
56
|
-
bottom: -
|
|
57
|
-
right: -
|
|
62
|
+
bottom: -24,
|
|
63
|
+
right: -26,
|
|
58
64
|
},
|
|
59
65
|
loaderContainer: {
|
|
60
66
|
paddingTop: 34,
|
|
@@ -65,7 +71,7 @@ const styles = StyleSheet.create({
|
|
|
65
71
|
},
|
|
66
72
|
messageBlock: {
|
|
67
73
|
position: 'absolute',
|
|
68
|
-
right:
|
|
69
|
-
bottom: -
|
|
74
|
+
right: 58,
|
|
75
|
+
bottom: -12,
|
|
70
76
|
},
|
|
71
77
|
})
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import { StyleSheet, View
|
|
1
|
+
import { StyleSheet, View } from 'react-native'
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import { COLORS, Loader, LoaderColor, SPACING
|
|
3
|
+
import { COLORS, Loader, LoaderColor, SPACING } from '@magmamath/react-native-ui'
|
|
4
4
|
import Animated, { FadeOut } from 'react-native-reanimated'
|
|
5
5
|
import { ExampleSolutionStatuses } from '../constants'
|
|
6
6
|
|
|
7
7
|
type QuestionSectionProps = {
|
|
8
8
|
question?: string
|
|
9
9
|
status: ExampleSolutionStatuses
|
|
10
|
+
renderKatexComponent: (katexString: string) => React.ReactNode
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
export const QuestionSection = ({
|
|
13
|
+
export const QuestionSection = ({
|
|
14
|
+
question,
|
|
15
|
+
status,
|
|
16
|
+
renderKatexComponent,
|
|
17
|
+
}: QuestionSectionProps) => {
|
|
13
18
|
return (
|
|
14
19
|
<View style={styles.container}>
|
|
15
|
-
<
|
|
16
|
-
<Typography>{question}</Typography>
|
|
17
|
-
</ScrollView>
|
|
20
|
+
{question && <View style={styles.katexContainer}>{renderKatexComponent(question)}</View>}
|
|
18
21
|
{status === ExampleSolutionStatuses.LOADING && (
|
|
19
22
|
<Animated.View exiting={FadeOut} style={styles.loaderContainer}>
|
|
20
23
|
<Loader size="large" color={LoaderColor.BLUE} />
|
|
@@ -28,12 +31,13 @@ const styles = StyleSheet.create({
|
|
|
28
31
|
container: {
|
|
29
32
|
flex: 1,
|
|
30
33
|
},
|
|
31
|
-
|
|
34
|
+
katexContainer: {
|
|
32
35
|
flex: 1,
|
|
33
36
|
},
|
|
34
37
|
loaderContainer: {
|
|
35
38
|
paddingTop: 34,
|
|
36
39
|
position: 'absolute',
|
|
40
|
+
zIndex: 100,
|
|
37
41
|
width: '100%',
|
|
38
42
|
height: '100%',
|
|
39
43
|
backgroundColor: COLORS.NEUTRAL_1,
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
import { StyleSheet, View, Image,
|
|
1
|
+
import { StyleSheet, View, Image, ImageBackground, ScrollView } from 'react-native'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
import { COLORS, IS_WEB, SPACING } from '@magmamath/react-native-ui'
|
|
4
4
|
import Animated, { FadeIn } from 'react-native-reanimated'
|
|
5
5
|
import { ExampleSolutionStatuses } from '../constants'
|
|
6
|
-
import gridImage from '../assets/grid.
|
|
6
|
+
import gridImage from '../assets/grid.webp'
|
|
7
7
|
|
|
8
8
|
type SolutionSectionProps = {
|
|
9
9
|
answer?: string
|
|
10
10
|
status: ExampleSolutionStatuses
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
const CONTAINER_SIZES = {
|
|
14
|
+
width: 489,
|
|
15
|
+
height: 543,
|
|
16
|
+
}
|
|
17
|
+
const BORDER_WIDTH = 1
|
|
18
|
+
|
|
13
19
|
const gridImagePath = !IS_WEB ? Image.resolveAssetSource(gridImage).uri : gridImage
|
|
14
20
|
|
|
15
21
|
export const SolutionSection = ({ answer, status }: SolutionSectionProps) => {
|
|
@@ -19,51 +25,78 @@ export const SolutionSection = ({ answer, status }: SolutionSectionProps) => {
|
|
|
19
25
|
|
|
20
26
|
return (
|
|
21
27
|
<View style={styles.container}>
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
<ScrollView
|
|
29
|
+
style={styles.solutionScroll}
|
|
30
|
+
contentContainerStyle={styles.solutionScrollContent}
|
|
31
|
+
bounces
|
|
32
|
+
>
|
|
33
|
+
{IS_WEB ? (
|
|
34
|
+
<ImageBackground
|
|
35
|
+
resizeMode="repeat"
|
|
36
|
+
style={[styles.gridImageWeb]}
|
|
37
|
+
source={{ uri: gridImagePath }}
|
|
38
|
+
>
|
|
39
|
+
{shouldShowAnswer && (
|
|
40
|
+
<Animated.Text
|
|
41
|
+
entering={status === 'cache' ? undefined : FadeIn.delay(1000).duration(500)}
|
|
42
|
+
style={styles.solutionText}
|
|
43
|
+
>
|
|
44
|
+
{answer}
|
|
45
|
+
</Animated.Text>
|
|
46
|
+
)}
|
|
47
|
+
</ImageBackground>
|
|
48
|
+
) : (
|
|
49
|
+
<>
|
|
50
|
+
<ImageBackground
|
|
51
|
+
resizeMode="repeat"
|
|
52
|
+
style={styles.gridImageRn}
|
|
53
|
+
source={{ uri: gridImagePath }}
|
|
54
|
+
/>
|
|
55
|
+
{shouldShowAnswer && (
|
|
56
|
+
<Animated.Text
|
|
57
|
+
entering={status === 'cache' ? undefined : FadeIn.delay(1000).duration(500)}
|
|
58
|
+
style={styles.solutionText}
|
|
59
|
+
>
|
|
60
|
+
{answer}
|
|
61
|
+
</Animated.Text>
|
|
62
|
+
)}
|
|
63
|
+
</>
|
|
64
|
+
)}
|
|
65
|
+
</ScrollView>
|
|
35
66
|
</View>
|
|
36
67
|
)
|
|
37
68
|
}
|
|
38
69
|
|
|
39
70
|
const styles = StyleSheet.create({
|
|
40
71
|
container: {
|
|
41
|
-
width:
|
|
72
|
+
width: CONTAINER_SIZES.width,
|
|
73
|
+
height: CONTAINER_SIZES.height,
|
|
42
74
|
overflow: 'hidden',
|
|
43
75
|
borderRadius: 8,
|
|
44
|
-
borderWidth:
|
|
76
|
+
borderWidth: BORDER_WIDTH,
|
|
45
77
|
borderColor: COLORS.NEUTRAL_5,
|
|
46
78
|
},
|
|
47
|
-
|
|
79
|
+
gridImageRn: {
|
|
80
|
+
top: -327,
|
|
48
81
|
width: '100%',
|
|
49
|
-
height: '
|
|
50
|
-
|
|
51
|
-
aspectRatio: 28 / 8,
|
|
82
|
+
height: '150%',
|
|
83
|
+
position: 'absolute',
|
|
52
84
|
},
|
|
53
85
|
gridImageWeb: {
|
|
54
|
-
transform: [{ scale: 3.5 }],
|
|
55
|
-
},
|
|
56
|
-
solutionScroll: {
|
|
57
|
-
position: 'absolute',
|
|
58
86
|
width: '100%',
|
|
59
87
|
height: '100%',
|
|
60
88
|
},
|
|
89
|
+
solutionScroll: {
|
|
90
|
+
flex: 1,
|
|
91
|
+
},
|
|
61
92
|
solutionScrollContent: {
|
|
62
|
-
|
|
63
|
-
|
|
93
|
+
minHeight: CONTAINER_SIZES.height - BORDER_WIDTH * 2,
|
|
94
|
+
width: '100%',
|
|
64
95
|
},
|
|
65
96
|
solutionText: {
|
|
66
97
|
fontFamily: 'PlaypenSans-Light',
|
|
67
|
-
fontSize:
|
|
98
|
+
fontSize: 28,
|
|
99
|
+
marginHorizontal: SPACING[800],
|
|
100
|
+
marginVertical: SPACING[400],
|
|
68
101
|
},
|
|
69
102
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ExampleSolutionModelProps } from '../types'
|
|
2
2
|
import { ExampleSolutionsApi } from './ExampleSolutionApi'
|
|
3
3
|
import { ExampleSolutionCache } from './ExampleSolutionCache'
|
|
4
4
|
|
|
@@ -6,7 +6,10 @@ export class ExampleSolutionModel {
|
|
|
6
6
|
public readonly api
|
|
7
7
|
public readonly cache = new ExampleSolutionCache()
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
public readonly renderKatexComponent: (katexString: string) => React.ReactNode
|
|
10
|
+
|
|
11
|
+
constructor({ api, errorHandler, renderKatexComponent }: ExampleSolutionModelProps) {
|
|
10
12
|
this.api = new ExampleSolutionsApi({ api, errorHandler })
|
|
13
|
+
this.renderKatexComponent = renderKatexComponent
|
|
11
14
|
}
|
|
12
15
|
}
|
|
@@ -15,9 +15,10 @@ export type ExampleSolutionApiRequests = {
|
|
|
15
15
|
generateExampleSolution: (body: ExampleSolutionPayload) => Promise<ExampleSolutionResponse>
|
|
16
16
|
}
|
|
17
17
|
export type ExampleSolutionErrorHandler = (errorMessage: string) => void
|
|
18
|
-
export type
|
|
18
|
+
export type ExampleSolutionModelProps = {
|
|
19
19
|
api: ExampleSolutionApiRequests
|
|
20
20
|
errorHandler?: ExampleSolutionErrorHandler
|
|
21
|
+
renderKatexComponent: (katexString: string) => React.ReactNode
|
|
21
22
|
}
|
|
22
23
|
export type ExampleSolutionModalParams = {
|
|
23
24
|
cacheKey: string
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"time.yearAgo": "year ago",
|
|
13
13
|
"time.yearsAgo": "years ago",
|
|
14
14
|
"chat": {
|
|
15
|
-
"anotherHint": "
|
|
16
|
-
"giveHint": "
|
|
15
|
+
"anotherHint": "Give me another hint",
|
|
16
|
+
"giveHint": "Give me a hint",
|
|
17
17
|
"answerAgain": "Answer again to get another hint!",
|
|
18
18
|
"errorMessage": "Something went wrong! Try again",
|
|
19
19
|
"howCanIHelp": "Hi! Do you want help?",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"time.yearAgo": "year ago",
|
|
13
13
|
"time.yearsAgo": "years ago",
|
|
14
14
|
"chat": {
|
|
15
|
-
"anotherHint": "
|
|
16
|
-
"giveHint": "
|
|
15
|
+
"anotherHint": "Give me another hint",
|
|
16
|
+
"giveHint": "Give me a hint",
|
|
17
17
|
"answerAgain": "Answer again to get another hint!",
|
|
18
18
|
"errorMessage": "Something went wrong! Try again",
|
|
19
19
|
"howCanIHelp": "Hi! Do you want help?",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"time.yearAgo": "year ago",
|
|
13
13
|
"time.yearsAgo": "years ago",
|
|
14
14
|
"chat": {
|
|
15
|
-
"anotherHint": "
|
|
16
|
-
"giveHint": "
|
|
15
|
+
"anotherHint": "Give me another hint",
|
|
16
|
+
"giveHint": "Give me a hint",
|
|
17
17
|
"answerAgain": "Answer again to get another hint!",
|
|
18
18
|
"errorMessage": "Something went wrong! Try again",
|
|
19
19
|
"howCanIHelp": "Hi! Do you want help?",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"time.yearAgo": "year ago",
|
|
13
13
|
"time.yearsAgo": "years ago",
|
|
14
14
|
"chat": {
|
|
15
|
-
"anotherHint": "
|
|
16
|
-
"giveHint": "
|
|
15
|
+
"anotherHint": "Give me another hint",
|
|
16
|
+
"giveHint": "Give me a hint",
|
|
17
17
|
"answerAgain": "Answer again to get another hint!",
|
|
18
18
|
"errorMessage": "Something went wrong! Try again",
|
|
19
19
|
"howCanIHelp": "Hi! Do you want help?",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"time.yearAgo": "år sedan",
|
|
13
13
|
"time.yearsAgo": "år sedan",
|
|
14
14
|
"chat": {
|
|
15
|
-
"anotherHint": "Ge ledtråd",
|
|
16
|
-
"giveHint": "Ge ledtråd",
|
|
15
|
+
"anotherHint": "Ge mig en ledtråd",
|
|
16
|
+
"giveHint": "Ge mig en ledtråd",
|
|
17
17
|
"answerAgain": "Svara igen för att få en till ledtråd!",
|
|
18
18
|
"errorMessage": "Något gick snett! Försök igen",
|
|
19
19
|
"howCanIHelp": "Hej! Hur kan jag hjälpa dig?",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"almostThere": "Nästan där"
|
|
26
26
|
},
|
|
27
27
|
"exampleSolution": {
|
|
28
|
-
"exampleSolution": "
|
|
28
|
+
"exampleSolution": "Lösningsexempel",
|
|
29
29
|
"letMeThink": "Låt mig tänka...",
|
|
30
30
|
"aha": "Aha!",
|
|
31
31
|
"errorMessage": "Något gick snett med att generera en exempellösning"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_effectorReact","_ChatMessage","_MessageLoader","_ChatInput","_modelTypes","_styleTypes","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","TOOLBAR_HEIGHT","BOTTOM_OFFSET","Platform","select","web","Chat","model","isHintFeedback","isTextToSpeechEnabled","inputMode","colorScheme","ColorScheme","Blue","dimensions","useWindowDimensions","ref","useRef","isOpen","useUnit","$isOpen","isHelpRequestPending","sendHelpRequestFx","pending","isTextToSpeechPending","api","textToSpeechTextFx","currentPlayingId","t2s","$currentPlayingId","isTranslated","translation","$isTranslated","audioStatus","$status","errorSpottingEnabled","errorSpotting","$isEnabled","messages","useStoreMap","$currentChatData","lastMessageId","at","id","MAX_HEIGHT","height","askChatForHelp","message","translatedMessage","isFreeText","jsx","View","style","styles","container","maxHeight","children","jsxs","ScrollView","bounces","contentContainerStyle","list","onContentSizeChange","_","current","scrollToEnd","setScrollActive","gap","map","ChatMessage","withIcon","isOwnMessage","variant","MessageVariant","SENT","RECEIVED","withErrorSpotting","t2sState","isEnabled","isActive","isLoading","status","disabled","MessageLoader","ChatInput","onPressAlternative","hasMessages","length","exports","StyleSheet","create","flex","alignItems","width","paddingVertical","paddingRight"],"sourceRoot":"../../../../../../src","sources":["features/chatbot/components/Chat/Chat.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAGA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AAAqD,IAAAQ,WAAA,GAAAR,OAAA;AAAA,SAAAS,yBAAAC,CAAA,6BAAAC,OA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AACwB,YAAY;YACzDQ,QAAQ,EAAEhC,OAAO,CAACJ,EAAE,KAAKhB,gBAAgB;YACzCqD,SAAS,EAAExD,qBAAqB;YAChCyD,MAAM,EAAEhD,WAAW;YACnBiD,QAAQ,EAAE1D;UACZ;QAAE,GAbGuB,OAAO,CAACJ,EAcd,CACF,CAAC,EAEDtB,oBAAoB,iBAAI,IAAAzC,WAAA,CAAAsE,GAAA,EAAC1E,cAAA,CAAA2G,aAAa;UAACxE,WAAW,EAAEA;QAAY,CAAE,CAAC;MAAA,CAChE,CACP,EAEAO,MAAM,iBACL,IAAAtC,WAAA,CAAAsE,GAAA,EAACzE,UAAA,CAAA2G,SAAS;QACRC,kBAAkB,EAAEvC,cAAe;QACnCwC,WAAW,EAAEhD,QAAQ,CAACiD,MAAM,GAAG,CAAE;QACjC/E,cAAc,EAAEA,cAAe;QAC/BG,WAAW,EAAEA,WAAY;QACzBD,SAAS,EAAEA;MAAU,CACtB,CACF;IAAA,CACS;EAAC,CACT,CAAC;AAEX,CAAC;AAAA8E,OAAA,CAAAlF,IAAA,GAAAA,IAAA;AAED,MAAM+C,MAAM,GAAGoC,uBAAU,CAACC,MAAM,CAAC;EAC/BpC,SAAS,EAAE;IACTqC,IAAI,EAAE,CAAC;IACPC,UAAU,EAAE,UAAU;IACtBC,KAAK,EAAE,GAAG;IACVhD,MAAM,EAAE;EACV,CAAC;EACDgB,IAAI,EAAE;IACJ+B,UAAU,EAAE,UAAU;IACtBE,eAAe,EAAE,CAAC;IAClBC,YAAY,EAAE;EAChB,CAAC;EACD5B,GAAG,EAAE;IACHwB,IAAI,EAAE,CAAC;IACPxB,GAAG,EAAE;EACP;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ChatInput = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _effectorReact = require("effector-react");
|
|
9
|
-
var _ChatBotModelContext = require("../../context/ChatBotModelContext.js");
|
|
10
|
-
var _styleTypes = require("../../types/style.types.js");
|
|
11
|
-
var _unitsTypes = require("../../types/units.types.js");
|
|
12
|
-
var _InputOption = require("./InputOption.js");
|
|
13
|
-
var _InputOptionWithTextArea = require("./InputOptionWithTextArea.js");
|
|
14
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
-
const chatInputVariant = {
|
|
17
|
-
[_unitsTypes.ChatInputMode.Option]: _InputOption.InputOption,
|
|
18
|
-
[_unitsTypes.ChatInputMode.FreeText]: _InputOptionWithTextArea.InputOptionWithTextArea
|
|
19
|
-
};
|
|
20
|
-
const ChatInput = ({
|
|
21
|
-
onPressAlternative,
|
|
22
|
-
hasMessages,
|
|
23
|
-
isHintFeedback,
|
|
24
|
-
inputMode,
|
|
25
|
-
colorScheme = _styleTypes.ColorScheme.Blue
|
|
26
|
-
}) => {
|
|
27
|
-
const model = (0, _ChatBotModelContext.useChatModel)();
|
|
28
|
-
const isTranslated = (0, _effectorReact.useUnit)(model.translation.$isTranslated);
|
|
29
|
-
const alternatives = (0, _effectorReact.useUnit)(model.$alternatives);
|
|
30
|
-
const isTranslationPending = (0, _effectorReact.useUnit)(model.translation.translateAllMessagesFx.pending);
|
|
31
|
-
const isHelpRequestPending = (0, _effectorReact.useUnit)(model.sendHelpRequestFx.pending);
|
|
32
|
-
const lastMessageOptions = (0, _effectorReact.useStoreMap)(model.$currentChatData, ({
|
|
33
|
-
messages
|
|
34
|
-
}) => {
|
|
35
|
-
const lastMessage = messages.at(-1);
|
|
36
|
-
return lastMessage?.options ?? [];
|
|
37
|
-
});
|
|
38
|
-
const availableOption = (() => {
|
|
39
|
-
if (hasMessages && lastMessageOptions.length) return lastMessageOptions[0];
|
|
40
|
-
if (isHintFeedback && alternatives?.options.hints) return alternatives?.options.hints[0];
|
|
41
|
-
return alternatives?.options.default[0] ?? null;
|
|
42
|
-
})();
|
|
43
|
-
const buttonLabel = (isTranslated && !isTranslationPending ? availableOption?.translatedText : availableOption?.text) ?? '';
|
|
44
|
-
const Component = chatInputVariant[inputMode];
|
|
45
|
-
return availableOption?.text && /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
46
|
-
message: buttonLabel,
|
|
47
|
-
onPress: () => onPressAlternative(availableOption.text, availableOption.translatedText),
|
|
48
|
-
disabled: isHelpRequestPending || hasMessages && lastMessageOptions.length === 0,
|
|
49
|
-
colorScheme: colorScheme
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
exports.ChatInput = ChatInput;
|
|
53
|
-
//# sourceMappingURL=ChatInput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_effectorReact","_ChatBotModelContext","_styleTypes","_unitsTypes","_InputOption","_InputOptionWithTextArea","_jsxRuntime","e","__esModule","default","chatInputVariant","ChatInputMode","Option","InputOption","FreeText","InputOptionWithTextArea","ChatInput","onPressAlternative","hasMessages","isHintFeedback","inputMode","colorScheme","ColorScheme","Blue","model","useChatModel","isTranslated","useUnit","translation","$isTranslated","alternatives","$alternatives","isTranslationPending","translateAllMessagesFx","pending","isHelpRequestPending","sendHelpRequestFx","lastMessageOptions","useStoreMap","$currentChatData","messages","lastMessage","at","options","availableOption","length","hints","buttonLabel","translatedText","text","Component","jsx","message","onPress","disabled","exports"],"sourceRoot":"../../../../../../src","sources":["features/chatbot/components/ChatInput/ChatInput.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAEA,IAAAE,oBAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAC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a,OAAO,CAACG,KAAK,EAAE,OAAOhB,YAAY,EAAEa,OAAO,CAACG,KAAK,CAAC,CAAC,CAAC;IACxF,OAAOhB,YAAY,EAAEa,OAAO,CAAClC,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI;EACjD,CAAC,EAAE,CAAC;EAEJ,MAAMsC,WAAW,GACf,CAACrB,YAAY,IAAI,CAACM,oBAAoB,GAClCY,eAAe,EAAEI,cAAc,GAC/BJ,eAAe,EAAEK,IAAI,KAAK,EAAE;EAElC,MAAMC,SAAS,GAAGxC,gBAAgB,CAACU,SAAS,CAAC;EAE7C,OACEwB,eAAe,EAAEK,IAAI,iBACnB,IAAA3C,WAAA,CAAA6C,GAAA,EAACD,SAAS;IACRE,OAAO,EAAEL,WAAY;IACrBM,OAAO,EAAEA,CAAA,KAAMpC,kBAAkB,CAAC2B,eAAe,CAACK,IAAI,EAAEL,eAAe,CAACI,cAAc,CAAE;IACxFM,QAAQ,EAAEnB,oBAAoB,IAAKjB,WAAW,IAAImB,kBAAkB,CAACQ,MAAM,KAAK,CAAG;IACnFxB,WAAW,EAAEA;EAAY,CAC1B,CACF;AAEL,CAAC;AAAAkC,OAAA,CAAAvC,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.InputOption = void 0;
|
|
7
|
-
var _reactNative = require("react-native");
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _RequestHintButton = require("./RequestHintButton.js");
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
const InputOption = ({
|
|
13
|
-
message,
|
|
14
|
-
onPress,
|
|
15
|
-
colorScheme,
|
|
16
|
-
disabled
|
|
17
|
-
}) => {
|
|
18
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
19
|
-
style: styles.container,
|
|
20
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_RequestHintButton.RequestHintButton, {
|
|
21
|
-
onPress: onPress,
|
|
22
|
-
message: message,
|
|
23
|
-
disabled: disabled,
|
|
24
|
-
colorScheme: colorScheme,
|
|
25
|
-
variant: _RequestHintButton.OptionButtonVariant.Default
|
|
26
|
-
})
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
exports.InputOption = InputOption;
|
|
30
|
-
const styles = _reactNative.StyleSheet.create({
|
|
31
|
-
container: {
|
|
32
|
-
flex: 1,
|
|
33
|
-
width: 305,
|
|
34
|
-
alignItems: 'center',
|
|
35
|
-
justifyContent: 'center',
|
|
36
|
-
marginVertical: 8
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
//# sourceMappingURL=InputOption.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_react","_interopRequireDefault","_RequestHintButton","_jsxRuntime","e","__esModule","default","InputOption","message","onPress","colorScheme","disabled","jsx","View","style","styles","container","children","RequestHintButton","variant","OptionButtonVariant","Default","exports","StyleSheet","create","flex","width","alignItems","justifyContent","marginVertical"],"sourceRoot":"../../../../../../src","sources":["features/chatbot/components/ChatInput/InputOption.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,kBAAA,GAAAH,OAAA;AAAyD,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAE,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGlD,MAAMG,WAAW,GAAGA,CAAC;EAAEC,OAAO;EAAEC,OAAO;EAAEC,WAAW;EAAEC;AAAyB,CAAC,KAAK;EAC1F,oBACE,IAAAR,WAAA,CAAAS,GAAA,EAACd,YAAA,CAAAe,IAAI;IAACC,KAAK,EAAEC,MAAM,CAACC,SAAU;IAAAC,QAAA,eAC5B,IAAAd,WAAA,CAAAS,GAAA,EAACV,kBAAA,CAAAgB,iBAAiB;MAChBT,OAAO,EAAEA,OAAQ;MACjBD,OAAO,EAAEA,OAAQ;MACjBG,QAAQ,EAAEA,QAAS;MACnBD,WAAW,EAAEA,WAAY;MACzBS,OAAO,EAAEC,sCAAmB,CAACC;IAAQ,CACtC;EAAC,CACE,CAAC;AAEX,CAAC;AAAAC,OAAA,CAAAf,WAAA,GAAAA,WAAA;AAED,MAAMQ,MAAM,GAAGQ,uBAAU,CAACC,MAAM,CAAC;EAC/BR,SAAS,EAAE;IACTS,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,GAAG;IACVC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBC,cAAc,EAAE;EAClB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.InputOptionWithTextArea = void 0;
|
|
7
|
-
var _reactNative = require("react-native");
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _FreeTextInputBlock = require("./freeText/FreeTextInputBlock.js");
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
const InputOptionWithTextArea = ({
|
|
13
|
-
message,
|
|
14
|
-
disabled,
|
|
15
|
-
onPress,
|
|
16
|
-
colorScheme
|
|
17
|
-
}) => {
|
|
18
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
19
|
-
style: styles.container,
|
|
20
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_FreeTextInputBlock.FreeTextInputBlock, {
|
|
21
|
-
message: message,
|
|
22
|
-
onPress: onPress,
|
|
23
|
-
disabled: disabled,
|
|
24
|
-
colorScheme: colorScheme
|
|
25
|
-
})
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
exports.InputOptionWithTextArea = InputOptionWithTextArea;
|
|
29
|
-
const styles = _reactNative.StyleSheet.create({
|
|
30
|
-
container: {
|
|
31
|
-
flex: 1,
|
|
32
|
-
width: 305,
|
|
33
|
-
alignItems: 'center',
|
|
34
|
-
justifyContent: 'center',
|
|
35
|
-
marginVertical: 8
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
//# sourceMappingURL=InputOptionWithTextArea.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_react","_interopRequireDefault","_FreeTextInputBlock","_jsxRuntime","e","__esModule","default","InputOptionWithTextArea","message","disabled","onPress","colorScheme","jsx","View","style","styles","container","children","FreeTextInputBlock","exports","StyleSheet","create","flex","width","alignItems","justifyContent","marginVertical"],"sourceRoot":"../../../../../../src","sources":["features/chatbot/components/ChatInput/InputOptionWithTextArea.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,mBAAA,GAAAH,OAAA;AAAkE,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAE,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE3D,MAAMG,uBAAuB,GAAGA,CAAC;EAAEC,OAAO;EAAEC,QAAQ;EAAEC,OAAO;EAAEC;AAA4B,CAAC,KAAK;EACtG,oBACE,IAAAR,WAAA,CAAAS,GAAA,EAACd,YAAA,CAAAe,IAAI;IAACC,KAAK,EAAEC,MAAM,CAACC,SAAU;IAAAC,QAAA,eAC5B,IAAAd,WAAA,CAAAS,GAAA,EAACV,mBAAA,CAAAgB,kBAAkB;MACjBV,OAAO,EAAEA,OAAQ;MACjBE,OAAO,EAAEA,OAAQ;MACjBD,QAAQ,EAAEA,QAAS;MACnBE,WAAW,EAAEA;IAAY,CAC1B;EAAC,CACE,CAAC;AAEX,CAAC;AAAAQ,OAAA,CAAAZ,uBAAA,GAAAA,uBAAA;AAED,MAAMQ,MAAM,GAAGK,uBAAU,CAACC,MAAM,CAAC;EAC/BL,SAAS,EAAE;IACTM,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,GAAG;IACVC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBC,cAAc,EAAE;EAClB;AACF,CAAC,CAAC","ignoreList":[]}
|