@magmamath/students-features 0.8.0-rc.2 → 0.8.0-rc.3
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/ChatInput/ChatInput.js +1 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/ChatInput.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/FreeText/ChatTextInput.js +7 -4
- package/dist/commonjs/features/chatbot/components/ChatInput/FreeText/ChatTextInput.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/FreeText/FreeTextInputBlock.js +1 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/FreeText/FreeTextInputBlock.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/RequestHintButton.js +7 -7
- package/dist/commonjs/features/chatbot/components/ChatInput/RequestHintButton.js.map +1 -1
- package/dist/commonjs/features/chatbot/helpers.js +3 -3
- package/dist/commonjs/features/chatbot/helpers.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js +8 -8
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js +1 -1
- package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js.map +1 -1
- package/dist/commonjs/features/chatbot/types/model.types.js +2 -2
- package/dist/commonjs/features/endOfAssignment/components/CheatDetected/CheatDetected.js +5 -3
- package/dist/commonjs/features/endOfAssignment/components/CheatDetected/CheatDetected.js.map +1 -1
- package/dist/commonjs/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.js +5 -3
- package/dist/commonjs/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.js.map +1 -1
- package/dist/commonjs/features/endOfAssignment/components/ExamLeave/ExamLeave.js +5 -3
- package/dist/commonjs/features/endOfAssignment/components/ExamLeave/ExamLeave.js.map +1 -1
- package/dist/commonjs/features/endOfAssignment/components/ExamPaused/ExamPaused.js +5 -3
- package/dist/commonjs/features/endOfAssignment/components/ExamPaused/ExamPaused.js.map +1 -1
- package/dist/commonjs/features/endOfAssignment/components/ExamSubmit/ExamSubmit.js +5 -3
- package/dist/commonjs/features/endOfAssignment/components/ExamSubmit/ExamSubmit.js.map +1 -1
- package/dist/commonjs/features/endOfAssignment/components/NoAnswer/NoAnswer.js +6 -4
- package/dist/commonjs/features/endOfAssignment/components/NoAnswer/NoAnswer.js.map +1 -1
- package/dist/commonjs/shared/hooks/useKeyDownListener.js +5 -1
- package/dist/commonjs/shared/hooks/useKeyDownListener.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatInput/ChatInput.js +1 -1
- package/dist/module/features/chatbot/components/ChatInput/ChatInput.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatInput/FreeText/ChatTextInput.js +7 -4
- package/dist/module/features/chatbot/components/ChatInput/FreeText/ChatTextInput.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatInput/FreeText/FreeTextInputBlock.js +1 -1
- package/dist/module/features/chatbot/components/ChatInput/FreeText/FreeTextInputBlock.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatInput/RequestHintButton.js +7 -7
- package/dist/module/features/chatbot/components/ChatInput/RequestHintButton.js.map +1 -1
- package/dist/module/features/chatbot/helpers.js +3 -3
- package/dist/module/features/chatbot/helpers.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatBotModel.js +8 -8
- package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatBotThreadManager.js +1 -1
- package/dist/module/features/chatbot/model/ChatBotThreadManager.js.map +1 -1
- package/dist/module/features/chatbot/types/model.types.js +2 -2
- package/dist/module/features/endOfAssignment/components/CheatDetected/CheatDetected.js +5 -3
- package/dist/module/features/endOfAssignment/components/CheatDetected/CheatDetected.js.map +1 -1
- package/dist/module/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.js +5 -3
- package/dist/module/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.js.map +1 -1
- package/dist/module/features/endOfAssignment/components/ExamLeave/ExamLeave.js +5 -3
- package/dist/module/features/endOfAssignment/components/ExamLeave/ExamLeave.js.map +1 -1
- package/dist/module/features/endOfAssignment/components/ExamPaused/ExamPaused.js +5 -3
- package/dist/module/features/endOfAssignment/components/ExamPaused/ExamPaused.js.map +1 -1
- package/dist/module/features/endOfAssignment/components/ExamSubmit/ExamSubmit.js +5 -3
- package/dist/module/features/endOfAssignment/components/ExamSubmit/ExamSubmit.js.map +1 -1
- package/dist/module/features/endOfAssignment/components/NoAnswer/NoAnswer.js +6 -4
- package/dist/module/features/endOfAssignment/components/NoAnswer/NoAnswer.js.map +1 -1
- package/dist/module/shared/hooks/useKeyDownListener.js +5 -1
- package/dist/module/shared/hooks/useKeyDownListener.js.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/FreeText/ChatTextInput.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatInput/RequestHintButton.d.ts +2 -2
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts +5 -5
- package/dist/typescript/commonjs/features/endOfAssignment/components/CheatDetected/CheatDetected.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/ExamLeave/ExamLeave.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/ExamPaused/ExamPaused.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/ExamSubmit/ExamSubmit.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/endOfAssignment/components/NoAnswer/NoAnswer.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/hooks/useKeyDownListener.d.ts +7 -1
- package/dist/typescript/commonjs/shared/hooks/useKeyDownListener.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/hooks/useKeyboard.d.ts +5 -1
- package/dist/typescript/commonjs/shared/hooks/useKeyboard.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatInput/FreeText/ChatTextInput.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatInput/RequestHintButton.d.ts +2 -2
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/model.types.d.ts +5 -5
- package/dist/typescript/module/features/endOfAssignment/components/CheatDetected/CheatDetected.d.ts.map +1 -1
- package/dist/typescript/module/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.d.ts.map +1 -1
- package/dist/typescript/module/features/endOfAssignment/components/ExamLeave/ExamLeave.d.ts.map +1 -1
- package/dist/typescript/module/features/endOfAssignment/components/ExamPaused/ExamPaused.d.ts.map +1 -1
- package/dist/typescript/module/features/endOfAssignment/components/ExamSubmit/ExamSubmit.d.ts.map +1 -1
- package/dist/typescript/module/features/endOfAssignment/components/NoAnswer/NoAnswer.d.ts.map +1 -1
- package/dist/typescript/module/shared/hooks/useKeyDownListener.d.ts +7 -1
- package/dist/typescript/module/shared/hooks/useKeyDownListener.d.ts.map +1 -1
- package/dist/typescript/module/shared/hooks/useKeyboard.d.ts +5 -1
- package/dist/typescript/module/shared/hooks/useKeyboard.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/chatbot/components/ChatInput/ChatInput.tsx +1 -1
- package/src/features/chatbot/components/ChatInput/FreeText/ChatTextInput.tsx +10 -7
- package/src/features/chatbot/components/ChatInput/FreeText/FreeTextInputBlock.tsx +1 -1
- package/src/features/chatbot/components/ChatInput/RequestHintButton.tsx +7 -7
- package/src/features/chatbot/helpers.ts +3 -3
- package/src/features/chatbot/model/ChatBotModel.ts +4 -8
- package/src/features/chatbot/model/ChatBotThreadManager.ts +1 -1
- package/src/features/chatbot/types/model.types.ts +5 -5
- package/src/features/endOfAssignment/components/CheatDetected/CheatDetected.tsx +6 -4
- package/src/features/endOfAssignment/components/CorrectAnswer/CorrectAnswer.tsx +6 -4
- package/src/features/endOfAssignment/components/ExamLeave/ExamLeave.tsx +6 -4
- package/src/features/endOfAssignment/components/ExamPaused/ExamPaused.tsx +6 -4
- package/src/features/endOfAssignment/components/ExamSubmit/ExamSubmit.tsx +6 -4
- package/src/features/endOfAssignment/components/NoAnswer/NoAnswer.tsx +7 -5
- package/src/shared/hooks/useKeyDownListener.ts +9 -4
|
@@ -125,22 +125,22 @@ export type ReinitConversationProps = {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
export enum ChatRequestType {
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
FREETEXT = 'sendMessage',
|
|
129
|
+
HINT = 'getHint',
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
type FreeTextWithConversationId = {
|
|
133
|
-
type: ChatRequestType.
|
|
133
|
+
type: ChatRequestType.FREETEXT
|
|
134
134
|
data: Pick<SendMessagePayload, 'message' | 'conversationId'>
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
type FreeTextNewConversation = {
|
|
138
|
-
type: ChatRequestType.
|
|
138
|
+
type: ChatRequestType.FREETEXT
|
|
139
139
|
data: SendMessagePayload
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
export type HintRequest = {
|
|
143
|
-
type: ChatRequestType.
|
|
143
|
+
type: ChatRequestType.HINT
|
|
144
144
|
data: ChatHintPayload
|
|
145
145
|
}
|
|
146
146
|
|
|
@@ -15,10 +15,12 @@ import { useKeyBoard } from '../../../../shared/hooks/useKeyboard'
|
|
|
15
15
|
import { KeyboardKeys } from '../../../../lib/constants'
|
|
16
16
|
|
|
17
17
|
export const CheatDetected = ({ textContent, model }: EOAModalContentProps) => {
|
|
18
|
-
useKeyBoard(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
useKeyBoard({
|
|
19
|
+
callback: (event) => {
|
|
20
|
+
if (event.key === KeyboardKeys.ENTER) {
|
|
21
|
+
model.hidePopUpAndLeave()
|
|
22
|
+
}
|
|
23
|
+
},
|
|
22
24
|
})
|
|
23
25
|
|
|
24
26
|
return (
|
|
@@ -47,10 +47,12 @@ export const CorrectAnswer = ({ textContent, model, onPracticePress }: EOAModalC
|
|
|
47
47
|
setCardsAnimationCompleted(true)
|
|
48
48
|
}, [])
|
|
49
49
|
|
|
50
|
-
useKeyBoard(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
useKeyBoard({
|
|
51
|
+
callback: (event) => {
|
|
52
|
+
if (event.key === KeyboardKeys.ENTER) {
|
|
53
|
+
isPracticeButtonVisible ? handlePracticeButtonPress() : model.hidePopUpAndLeave()
|
|
54
|
+
}
|
|
55
|
+
},
|
|
54
56
|
})
|
|
55
57
|
|
|
56
58
|
return (
|
|
@@ -17,10 +17,12 @@ import { KeyboardKeys } from '../../../../lib/constants'
|
|
|
17
17
|
export const ExamLeave = ({ textContent, model }: EOAModalContentProps) => {
|
|
18
18
|
const handleDismiss = () => model.hidePopUp()
|
|
19
19
|
|
|
20
|
-
useKeyBoard(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
useKeyBoard({
|
|
21
|
+
callback: (event) => {
|
|
22
|
+
if (event.key === KeyboardKeys.ENTER) {
|
|
23
|
+
model.hidePopUpAndLeave()
|
|
24
|
+
}
|
|
25
|
+
},
|
|
24
26
|
})
|
|
25
27
|
|
|
26
28
|
return (
|
|
@@ -15,10 +15,12 @@ import { useKeyBoard } from '../../../../shared/hooks/useKeyboard'
|
|
|
15
15
|
import { KeyboardKeys } from '../../../../lib/constants'
|
|
16
16
|
|
|
17
17
|
export const ExamPaused = ({ textContent, model }: EOAModalContentProps) => {
|
|
18
|
-
useKeyBoard(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
useKeyBoard({
|
|
19
|
+
callback: (event) => {
|
|
20
|
+
if (event.key === KeyboardKeys.ENTER) {
|
|
21
|
+
model.hidePopUpAndLeave()
|
|
22
|
+
}
|
|
23
|
+
},
|
|
22
24
|
})
|
|
23
25
|
|
|
24
26
|
return (
|
|
@@ -32,10 +32,12 @@ export const ExamSubmit = ({ textContent, model, onPracticePress }: EOAModalCont
|
|
|
32
32
|
model.hidePopUp()
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
useKeyBoard(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
useKeyBoard({
|
|
36
|
+
callback: (event) => {
|
|
37
|
+
if (event.key === KeyboardKeys.ENTER) {
|
|
38
|
+
isPracticeButtonVisible ? handlePracticePress() : model.hidePopUpAndLeave()
|
|
39
|
+
}
|
|
40
|
+
},
|
|
39
41
|
})
|
|
40
42
|
|
|
41
43
|
return (
|
|
@@ -61,11 +61,13 @@ export const NoAnswer = ({ model, textContent, onPracticePress }: EOAModalConten
|
|
|
61
61
|
|
|
62
62
|
const buttons = getButtons()
|
|
63
63
|
|
|
64
|
-
useKeyBoard(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
useKeyBoard({
|
|
65
|
+
callback: (event) => {
|
|
66
|
+
if (event.key === KeyboardKeys.ENTER) {
|
|
67
|
+
const primaryButton = buttons.at(-1)
|
|
68
|
+
primaryButton?.onPress()
|
|
69
|
+
}
|
|
70
|
+
},
|
|
69
71
|
})
|
|
70
72
|
|
|
71
73
|
return (
|
|
@@ -2,11 +2,16 @@ import { useEffect, useRef } from 'react'
|
|
|
2
2
|
|
|
3
3
|
import { KeyboardKeys } from '../../lib/constants'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
callback: (event: KeyboardEvent) => void
|
|
7
|
-
enabled
|
|
5
|
+
type UseKeyDownListenerParams = {
|
|
6
|
+
callback: (event: KeyboardEvent) => void
|
|
7
|
+
enabled?: boolean
|
|
8
|
+
overrideKeys?: KeyboardKeys[]
|
|
9
|
+
}
|
|
10
|
+
export const useKeyDownListener = ({
|
|
11
|
+
callback,
|
|
8
12
|
overrideKeys = [KeyboardKeys.ENTER],
|
|
9
|
-
|
|
13
|
+
enabled,
|
|
14
|
+
}: UseKeyDownListenerParams) => {
|
|
10
15
|
const callbackRef = useRef(callback)
|
|
11
16
|
callbackRef.current = callback
|
|
12
17
|
|