@magmamath/students-features 0.6.14-rc.9 → 0.6.15

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.
Files changed (249) hide show
  1. package/dist/commonjs/features/chatbot/components/Alternatives/Alternatives.js +59 -0
  2. package/dist/commonjs/features/chatbot/components/Alternatives/Alternatives.js.map +1 -0
  3. package/dist/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.js +99 -0
  4. package/dist/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.js.map +1 -0
  5. package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js +4 -7
  6. package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -1
  7. package/dist/commonjs/features/chatbot/components/{Chat/Chat.js → ChatMessages/ChatbotMessages.js} +9 -12
  8. package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -0
  9. package/dist/commonjs/features/chatbot/components/Chatbot.js +3 -5
  10. package/dist/commonjs/features/chatbot/components/Chatbot.js.map +1 -1
  11. package/dist/commonjs/features/chatbot/constants.js +1 -6
  12. package/dist/commonjs/features/chatbot/constants.js.map +1 -1
  13. package/dist/commonjs/features/chatbot/index.js +0 -7
  14. package/dist/commonjs/features/chatbot/index.js.map +1 -1
  15. package/dist/commonjs/features/chatbot/model/ChatBotModel.js +3 -37
  16. package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -1
  17. package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js +10 -31
  18. package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js.map +1 -1
  19. package/dist/commonjs/features/chatbot/model/ChatbotApi.js +0 -3
  20. package/dist/commonjs/features/chatbot/model/ChatbotApi.js.map +1 -1
  21. package/dist/commonjs/features/chatbot/types/model.types.js.map +1 -1
  22. package/dist/commonjs/features/chatbot/types/units.types.js +0 -10
  23. package/dist/commonjs/features/chatbot/types/units.types.js.map +1 -1
  24. package/dist/commonjs/features/exampleSolution/ExampleSolutionModal.js +1 -3
  25. package/dist/commonjs/features/exampleSolution/ExampleSolutionModal.js.map +1 -1
  26. package/dist/commonjs/features/exampleSolution/assets/grid.webp +0 -0
  27. package/dist/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.js +12 -9
  28. package/dist/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.js.map +1 -1
  29. package/dist/commonjs/features/exampleSolution/components/QuestionSection.js +7 -7
  30. package/dist/commonjs/features/exampleSolution/components/QuestionSection.js.map +1 -1
  31. package/dist/commonjs/features/exampleSolution/components/SolutionSection.js +55 -29
  32. package/dist/commonjs/features/exampleSolution/components/SolutionSection.js.map +1 -1
  33. package/dist/commonjs/features/exampleSolution/model/ExampleSolution.model.js +3 -1
  34. package/dist/commonjs/features/exampleSolution/model/ExampleSolution.model.js.map +1 -1
  35. package/dist/commonjs/features/formulaSheet/components/FormulaSheet.js +6 -4
  36. package/dist/commonjs/features/formulaSheet/components/FormulaSheet.js.map +1 -1
  37. package/dist/commonjs/shared/translation/localization/ca.json +1 -1
  38. package/dist/commonjs/shared/translation/localization/en.json +1 -1
  39. package/dist/commonjs/shared/translation/localization/gb.json +1 -1
  40. package/dist/commonjs/shared/translation/localization/sct.json +2 -2
  41. package/dist/commonjs/shared/translation/localization/sw.json +3 -3
  42. package/dist/module/features/chatbot/components/Alternatives/Alternatives.js +53 -0
  43. package/dist/module/features/chatbot/components/Alternatives/Alternatives.js.map +1 -0
  44. package/dist/module/features/chatbot/components/Alternatives/HelpRequestOption.js +92 -0
  45. package/dist/module/features/chatbot/components/Alternatives/HelpRequestOption.js.map +1 -0
  46. package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js +4 -7
  47. package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -1
  48. package/dist/module/features/chatbot/components/{Chat/Chat.js → ChatMessages/ChatbotMessages.js} +7 -10
  49. package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -0
  50. package/dist/module/features/chatbot/components/Chatbot.js +3 -5
  51. package/dist/module/features/chatbot/components/Chatbot.js.map +1 -1
  52. package/dist/module/features/chatbot/constants.js +0 -5
  53. package/dist/module/features/chatbot/constants.js.map +1 -1
  54. package/dist/module/features/chatbot/index.js +0 -1
  55. package/dist/module/features/chatbot/index.js.map +1 -1
  56. package/dist/module/features/chatbot/model/ChatBotModel.js +3 -37
  57. package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
  58. package/dist/module/features/chatbot/model/ChatBotThreadManager.js +10 -31
  59. package/dist/module/features/chatbot/model/ChatBotThreadManager.js.map +1 -1
  60. package/dist/module/features/chatbot/model/ChatbotApi.js +0 -3
  61. package/dist/module/features/chatbot/model/ChatbotApi.js.map +1 -1
  62. package/dist/module/features/chatbot/types/model.types.js.map +1 -1
  63. package/dist/module/features/chatbot/types/units.types.js +0 -6
  64. package/dist/module/features/chatbot/types/units.types.js.map +1 -1
  65. package/dist/module/features/exampleSolution/ExampleSolutionModal.js +1 -3
  66. package/dist/module/features/exampleSolution/ExampleSolutionModal.js.map +1 -1
  67. package/dist/module/features/exampleSolution/assets/grid.webp +0 -0
  68. package/dist/module/features/exampleSolution/components/ExampleSolutionModalContent.js +12 -9
  69. package/dist/module/features/exampleSolution/components/ExampleSolutionModalContent.js.map +1 -1
  70. package/dist/module/features/exampleSolution/components/QuestionSection.js +9 -9
  71. package/dist/module/features/exampleSolution/components/QuestionSection.js.map +1 -1
  72. package/dist/module/features/exampleSolution/components/SolutionSection.js +57 -31
  73. package/dist/module/features/exampleSolution/components/SolutionSection.js.map +1 -1
  74. package/dist/module/features/exampleSolution/model/ExampleSolution.model.js +3 -1
  75. package/dist/module/features/exampleSolution/model/ExampleSolution.model.js.map +1 -1
  76. package/dist/module/features/formulaSheet/components/FormulaSheet.js +6 -4
  77. package/dist/module/features/formulaSheet/components/FormulaSheet.js.map +1 -1
  78. package/dist/module/shared/translation/localization/ca.json +1 -1
  79. package/dist/module/shared/translation/localization/en.json +1 -1
  80. package/dist/module/shared/translation/localization/gb.json +1 -1
  81. package/dist/module/shared/translation/localization/sct.json +2 -2
  82. package/dist/module/shared/translation/localization/sw.json +3 -3
  83. package/dist/typescript/commonjs/features/chatbot/components/Alternatives/Alternatives.d.ts +11 -0
  84. package/dist/typescript/commonjs/features/chatbot/components/Alternatives/Alternatives.d.ts.map +1 -0
  85. package/dist/typescript/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.d.ts +10 -0
  86. package/dist/typescript/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.d.ts.map +1 -0
  87. package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageLoader.d.ts.map +1 -1
  88. package/dist/typescript/{module/features/chatbot/components/Chat/Chat.d.ts → commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts} +2 -4
  89. package/dist/typescript/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -0
  90. package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts +0 -2
  91. package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts.map +1 -1
  92. package/dist/typescript/commonjs/features/chatbot/constants.d.ts +0 -5
  93. package/dist/typescript/commonjs/features/chatbot/constants.d.ts.map +1 -1
  94. package/dist/typescript/commonjs/features/chatbot/index.d.ts +0 -1
  95. package/dist/typescript/commonjs/features/chatbot/index.d.ts.map +1 -1
  96. package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts +1 -5
  97. package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
  98. package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts +2 -5
  99. package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -1
  100. package/dist/typescript/commonjs/features/chatbot/model/ChatbotApi.d.ts.map +1 -1
  101. package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts +4 -21
  102. package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts.map +1 -1
  103. package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts +1 -10
  104. package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts.map +1 -1
  105. package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts +0 -18
  106. package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts.map +1 -1
  107. package/dist/typescript/commonjs/features/exampleSolution/ExampleSolutionModal.d.ts.map +1 -1
  108. package/dist/typescript/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.d.ts +5 -1
  109. package/dist/typescript/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.d.ts.map +1 -1
  110. package/dist/typescript/commonjs/features/exampleSolution/components/QuestionSection.d.ts +2 -1
  111. package/dist/typescript/commonjs/features/exampleSolution/components/QuestionSection.d.ts.map +1 -1
  112. package/dist/typescript/commonjs/features/exampleSolution/components/SolutionSection.d.ts.map +1 -1
  113. package/dist/typescript/commonjs/features/exampleSolution/model/ExampleSolution.model.d.ts +3 -2
  114. package/dist/typescript/commonjs/features/exampleSolution/model/ExampleSolution.model.d.ts.map +1 -1
  115. package/dist/typescript/commonjs/features/exampleSolution/types.d.ts +2 -1
  116. package/dist/typescript/commonjs/features/exampleSolution/types.d.ts.map +1 -1
  117. package/dist/typescript/commonjs/features/formulaSheet/components/FormulaSheet.d.ts.map +1 -1
  118. package/dist/typescript/module/features/chatbot/components/Alternatives/Alternatives.d.ts +11 -0
  119. package/dist/typescript/module/features/chatbot/components/Alternatives/Alternatives.d.ts.map +1 -0
  120. package/dist/typescript/module/features/chatbot/components/Alternatives/HelpRequestOption.d.ts +10 -0
  121. package/dist/typescript/module/features/chatbot/components/Alternatives/HelpRequestOption.d.ts.map +1 -0
  122. package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageLoader.d.ts.map +1 -1
  123. package/dist/typescript/{commonjs/features/chatbot/components/Chat/Chat.d.ts → module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts} +2 -4
  124. package/dist/typescript/module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -0
  125. package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts +0 -2
  126. package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts.map +1 -1
  127. package/dist/typescript/module/features/chatbot/constants.d.ts +0 -5
  128. package/dist/typescript/module/features/chatbot/constants.d.ts.map +1 -1
  129. package/dist/typescript/module/features/chatbot/index.d.ts +0 -1
  130. package/dist/typescript/module/features/chatbot/index.d.ts.map +1 -1
  131. package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts +1 -5
  132. package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
  133. package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts +2 -5
  134. package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -1
  135. package/dist/typescript/module/features/chatbot/model/ChatbotApi.d.ts.map +1 -1
  136. package/dist/typescript/module/features/chatbot/types/api.types.d.ts +4 -21
  137. package/dist/typescript/module/features/chatbot/types/api.types.d.ts.map +1 -1
  138. package/dist/typescript/module/features/chatbot/types/model.types.d.ts +1 -10
  139. package/dist/typescript/module/features/chatbot/types/model.types.d.ts.map +1 -1
  140. package/dist/typescript/module/features/chatbot/types/units.types.d.ts +0 -18
  141. package/dist/typescript/module/features/chatbot/types/units.types.d.ts.map +1 -1
  142. package/dist/typescript/module/features/exampleSolution/ExampleSolutionModal.d.ts.map +1 -1
  143. package/dist/typescript/module/features/exampleSolution/components/ExampleSolutionModalContent.d.ts +5 -1
  144. package/dist/typescript/module/features/exampleSolution/components/ExampleSolutionModalContent.d.ts.map +1 -1
  145. package/dist/typescript/module/features/exampleSolution/components/QuestionSection.d.ts +2 -1
  146. package/dist/typescript/module/features/exampleSolution/components/QuestionSection.d.ts.map +1 -1
  147. package/dist/typescript/module/features/exampleSolution/components/SolutionSection.d.ts.map +1 -1
  148. package/dist/typescript/module/features/exampleSolution/model/ExampleSolution.model.d.ts +3 -2
  149. package/dist/typescript/module/features/exampleSolution/model/ExampleSolution.model.d.ts.map +1 -1
  150. package/dist/typescript/module/features/exampleSolution/types.d.ts +2 -1
  151. package/dist/typescript/module/features/exampleSolution/types.d.ts.map +1 -1
  152. package/dist/typescript/module/features/formulaSheet/components/FormulaSheet.d.ts.map +1 -1
  153. package/package.json +1 -1
  154. package/src/features/chatbot/components/Alternatives/Alternatives.tsx +60 -0
  155. package/src/features/chatbot/components/Alternatives/HelpRequestOption.tsx +91 -0
  156. package/src/features/chatbot/components/ChatMessage/MessageLoader.tsx +2 -6
  157. package/src/features/chatbot/components/{Chat/Chat.tsx → ChatMessages/ChatbotMessages.tsx} +6 -10
  158. package/src/features/chatbot/components/Chatbot.tsx +2 -6
  159. package/src/features/chatbot/constants.ts +0 -7
  160. package/src/features/chatbot/index.ts +0 -2
  161. package/src/features/chatbot/model/ChatBotModel.ts +27 -71
  162. package/src/features/chatbot/model/ChatBotThreadManager.ts +9 -38
  163. package/src/features/chatbot/model/ChatbotApi.ts +0 -2
  164. package/src/features/chatbot/types/api.types.ts +4 -24
  165. package/src/features/chatbot/types/model.types.ts +0 -15
  166. package/src/features/chatbot/types/units.types.ts +0 -22
  167. package/src/features/exampleSolution/ExampleSolutionModal.tsx +1 -7
  168. package/src/features/exampleSolution/assets/grid.webp +0 -0
  169. package/src/features/exampleSolution/components/ExampleSolutionModalContent.tsx +16 -10
  170. package/src/features/exampleSolution/components/QuestionSection.tsx +11 -7
  171. package/src/features/exampleSolution/components/SolutionSection.tsx +72 -29
  172. package/src/features/exampleSolution/model/ExampleSolution.model.ts +5 -2
  173. package/src/features/exampleSolution/types.ts +2 -1
  174. package/src/features/formulaSheet/components/FormulaSheet.tsx +7 -4
  175. package/src/shared/translation/localization/ca.json +1 -1
  176. package/src/shared/translation/localization/en.json +1 -1
  177. package/src/shared/translation/localization/gb.json +1 -1
  178. package/src/shared/translation/localization/sct.json +2 -2
  179. package/src/shared/translation/localization/sw.json +3 -3
  180. package/dist/commonjs/features/chatbot/components/Chat/Chat.js.map +0 -1
  181. package/dist/commonjs/features/chatbot/components/ChatInput/ChatInput.js +0 -53
  182. package/dist/commonjs/features/chatbot/components/ChatInput/ChatInput.js.map +0 -1
  183. package/dist/commonjs/features/chatbot/components/ChatInput/InputOption.js +0 -39
  184. package/dist/commonjs/features/chatbot/components/ChatInput/InputOption.js.map +0 -1
  185. package/dist/commonjs/features/chatbot/components/ChatInput/InputOptionWithTextArea.js +0 -38
  186. package/dist/commonjs/features/chatbot/components/ChatInput/InputOptionWithTextArea.js.map +0 -1
  187. package/dist/commonjs/features/chatbot/components/ChatInput/RequestHintButton.js +0 -140
  188. package/dist/commonjs/features/chatbot/components/ChatInput/RequestHintButton.js.map +0 -1
  189. package/dist/commonjs/features/chatbot/components/ChatInput/freeText/ChatTextInput.js +0 -142
  190. package/dist/commonjs/features/chatbot/components/ChatInput/freeText/ChatTextInput.js.map +0 -1
  191. package/dist/commonjs/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.js +0 -44
  192. package/dist/commonjs/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.js.map +0 -1
  193. package/dist/commonjs/features/chatbot/components/ChatInput/freeText/SendMessageButton.js +0 -105
  194. package/dist/commonjs/features/chatbot/components/ChatInput/freeText/SendMessageButton.js.map +0 -1
  195. package/dist/commonjs/features/exampleSolution/assets/grid.png +0 -0
  196. package/dist/module/features/chatbot/components/Chat/Chat.js.map +0 -1
  197. package/dist/module/features/chatbot/components/ChatInput/ChatInput.js +0 -47
  198. package/dist/module/features/chatbot/components/ChatInput/ChatInput.js.map +0 -1
  199. package/dist/module/features/chatbot/components/ChatInput/InputOption.js +0 -34
  200. package/dist/module/features/chatbot/components/ChatInput/InputOption.js.map +0 -1
  201. package/dist/module/features/chatbot/components/ChatInput/InputOptionWithTextArea.js +0 -32
  202. package/dist/module/features/chatbot/components/ChatInput/InputOptionWithTextArea.js.map +0 -1
  203. package/dist/module/features/chatbot/components/ChatInput/RequestHintButton.js +0 -132
  204. package/dist/module/features/chatbot/components/ChatInput/RequestHintButton.js.map +0 -1
  205. package/dist/module/features/chatbot/components/ChatInput/freeText/ChatTextInput.js +0 -134
  206. package/dist/module/features/chatbot/components/ChatInput/freeText/ChatTextInput.js.map +0 -1
  207. package/dist/module/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.js +0 -38
  208. package/dist/module/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.js.map +0 -1
  209. package/dist/module/features/chatbot/components/ChatInput/freeText/SendMessageButton.js +0 -97
  210. package/dist/module/features/chatbot/components/ChatInput/freeText/SendMessageButton.js.map +0 -1
  211. package/dist/module/features/exampleSolution/assets/grid.png +0 -0
  212. package/dist/typescript/commonjs/features/chatbot/components/Chat/Chat.d.ts.map +0 -1
  213. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/ChatInput.d.ts +0 -4
  214. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/ChatInput.d.ts.map +0 -1
  215. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/InputOption.d.ts +0 -4
  216. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/InputOption.d.ts.map +0 -1
  217. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/InputOptionWithTextArea.d.ts +0 -4
  218. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/InputOptionWithTextArea.d.ts.map +0 -1
  219. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/RequestHintButton.d.ts +0 -18
  220. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/RequestHintButton.d.ts.map +0 -1
  221. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/ChatTextInput.d.ts +0 -10
  222. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/ChatTextInput.d.ts.map +0 -1
  223. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.d.ts +0 -11
  224. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.d.ts.map +0 -1
  225. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/SendMessageButton.d.ts +0 -10
  226. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/SendMessageButton.d.ts.map +0 -1
  227. package/dist/typescript/module/features/chatbot/components/Chat/Chat.d.ts.map +0 -1
  228. package/dist/typescript/module/features/chatbot/components/ChatInput/ChatInput.d.ts +0 -4
  229. package/dist/typescript/module/features/chatbot/components/ChatInput/ChatInput.d.ts.map +0 -1
  230. package/dist/typescript/module/features/chatbot/components/ChatInput/InputOption.d.ts +0 -4
  231. package/dist/typescript/module/features/chatbot/components/ChatInput/InputOption.d.ts.map +0 -1
  232. package/dist/typescript/module/features/chatbot/components/ChatInput/InputOptionWithTextArea.d.ts +0 -4
  233. package/dist/typescript/module/features/chatbot/components/ChatInput/InputOptionWithTextArea.d.ts.map +0 -1
  234. package/dist/typescript/module/features/chatbot/components/ChatInput/RequestHintButton.d.ts +0 -18
  235. package/dist/typescript/module/features/chatbot/components/ChatInput/RequestHintButton.d.ts.map +0 -1
  236. package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/ChatTextInput.d.ts +0 -10
  237. package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/ChatTextInput.d.ts.map +0 -1
  238. package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.d.ts +0 -11
  239. package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.d.ts.map +0 -1
  240. package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/SendMessageButton.d.ts +0 -10
  241. package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/SendMessageButton.d.ts.map +0 -1
  242. package/src/features/chatbot/components/ChatInput/ChatInput.tsx +0 -56
  243. package/src/features/chatbot/components/ChatInput/InputOption.tsx +0 -29
  244. package/src/features/chatbot/components/ChatInput/InputOptionWithTextArea.tsx +0 -27
  245. package/src/features/chatbot/components/ChatInput/RequestHintButton.tsx +0 -160
  246. package/src/features/chatbot/components/ChatInput/freeText/ChatTextInput.tsx +0 -133
  247. package/src/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.tsx +0 -42
  248. package/src/features/chatbot/components/ChatInput/freeText/SendMessageButton.tsx +0 -110
  249. package/src/features/exampleSolution/assets/grid.png +0 -0
@@ -1,133 +0,0 @@
1
- import React from 'react'
2
- import { useUnit } from 'effector-react'
3
- import Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated'
4
- import { Platform, StyleSheet, TextInput } from 'react-native'
5
- import { COLORS, FONT_FAMILY, SPACING } from '@magmamath/react-native-ui'
6
-
7
- import { SendMessageButton } from './SendMessageButton'
8
- import { ColorScheme } from '@magmamath/students-features'
9
- import { useChatModel } from '../../../context/ChatBotModelContext'
10
- import { useKeyBoard } from '../../../../../shared/hooks/useKeyboard'
11
- import { KeyboardKeys } from '../../../../../lib/constants'
12
-
13
- const COMPACT_WIDTH = 134
14
- const FULL_WIDTH = 305
15
-
16
- const ANIMATION_DURATION = 200
17
-
18
- type ChatTextInputProps = {
19
- onPress: () => void
20
- disabled: boolean
21
- colorScheme?: ColorScheme
22
- }
23
-
24
- export const ChatTextInput = ({ disabled, colorScheme }: ChatTextInputProps) => {
25
- const model = useChatModel()
26
- const inputValue = useUnit(model.$textInputValue)
27
- const { language } = useUnit(model.$context) ?? {}
28
-
29
- const widthSv = useSharedValue(COMPACT_WIDTH)
30
- const arrowOpacitySv = useSharedValue(1)
31
- const hintVisibleSv = useSharedValue(1)
32
-
33
- const animatedInputStyle = useAnimatedStyle(
34
- () => ({
35
- width: widthSv.value,
36
- }),
37
- [widthSv],
38
- )
39
-
40
- const handleChangeText = (text: string) => {
41
- if (text.trim().length > 500) return
42
-
43
- model.setTextInputValue(text)
44
- const hasText = text.trim().length > 0
45
- const isExpanded = widthSv.value > COMPACT_WIDTH
46
-
47
- if (hasText && !isExpanded) {
48
- widthSv.value = withTiming(FULL_WIDTH, { duration: ANIMATION_DURATION })
49
- arrowOpacitySv.value = withTiming(0, { duration: ANIMATION_DURATION })
50
- hintVisibleSv.value = withTiming(0, { duration: ANIMATION_DURATION })
51
- } else if (!hasText && isExpanded) {
52
- widthSv.value = withTiming(COMPACT_WIDTH, { duration: ANIMATION_DURATION })
53
- arrowOpacitySv.value = withTiming(1, { duration: ANIMATION_DURATION })
54
- hintVisibleSv.value = withTiming(1, { duration: ANIMATION_DURATION })
55
- }
56
- }
57
-
58
- const handleOnPress = () => {
59
- if (disabled || inputValue.trim().length < 1 || inputValue.length > 500) return
60
- handleChangeText('')
61
- void model.sendHelpRequestFx({
62
- message: inputValue,
63
- translatedMessage: inputValue,
64
- isFreeText: true,
65
- })
66
- }
67
-
68
- useKeyBoard((event) => {
69
- if (event.key === KeyboardKeys.ENTER) {
70
- handleOnPress()
71
- }
72
- })
73
-
74
- return (
75
- <Animated.View style={[styles.inputWrapper, animatedInputStyle]}>
76
- <TextInput
77
- style={styles.input}
78
- placeholder={language === 'Swedish' ? 'Skriv...' : 'Type...'}
79
- placeholderTextColor={COLORS.NEUTRAL_6}
80
- value={inputValue}
81
- onChangeText={handleChangeText}
82
- onBlur={() => model.setIsTextInputFocused(false)}
83
- onFocus={() => model.setIsTextInputFocused(true)}
84
- />
85
- <SendMessageButton
86
- onPress={handleOnPress}
87
- disabled={inputValue.trim().length < 1 || disabled}
88
- colorScheme={colorScheme}
89
- />
90
- </Animated.View>
91
- )
92
- }
93
-
94
- const styles = StyleSheet.create({
95
- container: {
96
- position: 'relative',
97
- width: '100%',
98
- alignItems: 'flex-end',
99
- height: 52,
100
- justifyContent: 'center',
101
- },
102
- inputWrapper: {
103
- position: 'absolute',
104
- zIndex: 1,
105
- left: 0,
106
- flexDirection: 'row',
107
- borderWidth: 1,
108
- borderColor: COLORS.NEUTRAL_5,
109
- borderRadius: 200,
110
- backgroundColor: COLORS.NEUTRAL_1,
111
- paddingHorizontal: SPACING[100],
112
- paddingVertical: SPACING[100],
113
- elevation: 3,
114
- shadowColor: '#333',
115
- shadowOffset: { width: 0, height: 1 },
116
- shadowOpacity: 0.25,
117
- shadowRadius: 3,
118
- },
119
- input: {
120
- flex: 1,
121
- fontSize: 16,
122
- minWidth: 60,
123
- minHeight: 22,
124
- fontWeight: '400',
125
- fontFamily: FONT_FAMILY.buenosAires,
126
- paddingHorizontal: SPACING[200],
127
- paddingVertical: SPACING[200],
128
- ...(Platform.OS === 'web' && { outlineStyle: 'none' }),
129
- },
130
- arrowWrapper: {
131
- marginLeft: SPACING[200],
132
- },
133
- })
@@ -1,42 +0,0 @@
1
- import React from 'react'
2
- import { StyleSheet, View } from 'react-native'
3
- import { ColorScheme } from '../../../types/style.types'
4
- import { ChatTextInput } from './ChatTextInput'
5
- import { OptionButtonVariant, RequestHintButton } from '../RequestHintButton'
6
-
7
- type FreeTextInputAreaProps = {
8
- onPress: () => void
9
- message: string
10
- disabled: boolean
11
- colorScheme?: ColorScheme
12
- }
13
-
14
- export const FreeTextInputBlock = ({
15
- onPress,
16
- message,
17
- disabled,
18
- colorScheme,
19
- }: FreeTextInputAreaProps) => {
20
- return (
21
- <View style={styles.container}>
22
- <ChatTextInput onPress={onPress} disabled={disabled} colorScheme={colorScheme} />
23
- <RequestHintButton
24
- onPress={onPress}
25
- message={message}
26
- disabled={disabled}
27
- colorScheme={colorScheme}
28
- variant={OptionButtonVariant.Short}
29
- />
30
- </View>
31
- )
32
- }
33
-
34
- const styles = StyleSheet.create({
35
- container: {
36
- position: 'relative',
37
- width: '100%',
38
- alignItems: 'flex-end',
39
- height: 52,
40
- justifyContent: 'center',
41
- },
42
- })
@@ -1,110 +0,0 @@
1
- import React from 'react'
2
- import { Pressable, StyleSheet } from 'react-native'
3
- import Animated, {
4
- useSharedValue,
5
- withTiming,
6
- useAnimatedStyle,
7
- interpolateColor,
8
- } from 'react-native-reanimated'
9
- import { ArrowUpIcon, COLORS, IS_MOBILE } from '@magmamath/react-native-ui'
10
- import { ColorScheme } from '@magmamath/students-features'
11
- import { MESSAGE_COLORS_MAP } from '../../../constants'
12
-
13
- type HelpRequestOptionProps = {
14
- onPress: () => void
15
- disabled: boolean
16
- colorScheme?: ColorScheme
17
- }
18
-
19
- export const SendMessageButton = ({
20
- onPress,
21
- disabled = false,
22
- colorScheme = ColorScheme.Blue,
23
- }: HelpRequestOptionProps) => {
24
- const hoverSv = useSharedValue(0)
25
-
26
- const onHoverIn = () => {
27
- if (!disabled) hoverSv.value = withTiming(1, { duration: 200 })
28
- }
29
- const onHoverOut = () => {
30
- if (!disabled) hoverSv.value = withTiming(0, { duration: 200 })
31
- }
32
-
33
- const animatedIconStyle = useAnimatedStyle(() => {
34
- const backgroundColor = interpolateColor(
35
- hoverSv.value,
36
- [0, 1],
37
- [COLORS.NEUTRAL_1, MESSAGE_COLORS_MAP[colorScheme].sent.border],
38
- )
39
- const color = interpolateColor(hoverSv.value, [0, 1], [COLORS.NEUTRAL_10, COLORS.NEUTRAL_1])
40
-
41
- return {
42
- backgroundColor: disabled ? COLORS.NEUTRAL_2 : backgroundColor,
43
- borderColor: disabled ? COLORS.NEUTRAL_5 : MESSAGE_COLORS_MAP[colorScheme].sent.border,
44
- color: disabled ? COLORS.NEUTRAL_5 : color,
45
- }
46
- }, [hoverSv, disabled])
47
-
48
- return (
49
- <Pressable
50
- onHoverIn={onHoverIn}
51
- onHoverOut={onHoverOut}
52
- onPress={onPress}
53
- style={[styles.button, disabled && { cursor: 'auto' }]}
54
- disabled={disabled}
55
- accessibilityState={{ disabled }}
56
- accessibilityRole="button"
57
- >
58
- {IS_MOBILE ? (
59
- <Animated.View
60
- style={[
61
- styles.iconContainer,
62
- animatedIconStyle,
63
- {
64
- borderColor: disabled
65
- ? COLORS.NEUTRAL_5
66
- : MESSAGE_COLORS_MAP[colorScheme].sent.border,
67
- },
68
- ]}
69
- >
70
- <ArrowUpIcon color={'currentColor'} size={16} />
71
- </Animated.View>
72
- ) : (
73
- <Animated.Text style={[styles.webIconContainer, animatedIconStyle]}>
74
- <ArrowUpIcon color={'currentColor'} size={16} />
75
- </Animated.Text>
76
- )}
77
- </Pressable>
78
- )
79
- }
80
-
81
- const styles = StyleSheet.create({
82
- button: {
83
- flexDirection: 'row',
84
- justifyContent: 'flex-end',
85
- },
86
- iconContainer: {
87
- justifyContent: 'center',
88
- alignItems: 'center',
89
- padding: 12,
90
- borderRadius: 21,
91
- borderWidth: 1,
92
- },
93
- webIconContainer: {
94
- flex: 1,
95
- flexDirection: 'row',
96
- alignItems: 'center',
97
- justifyContent: 'space-between',
98
- paddingHorizontal: 13,
99
- paddingVertical: 12,
100
- borderWidth: 1,
101
- borderRadius: 48,
102
- elevation: 3,
103
- shadowColor: '#333',
104
- shadowOffset: { width: 0, height: 1 },
105
- shadowOpacity: 0.25,
106
- shadowRadius: 3,
107
- backgroundColor: COLORS.NEUTRAL_1,
108
- borderColor: COLORS.PRIMARY_BLUE,
109
- },
110
- })