@magmamath/students-features 0.6.14-rc.2 → 0.6.14-rc.21

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 (274) hide show
  1. package/dist/commonjs/features/chatbot/components/{ChatMessages/ChatbotMessages.js → Chat/Chat.js} +8 -15
  2. package/dist/commonjs/features/chatbot/components/Chat/Chat.js.map +1 -0
  3. package/dist/commonjs/features/chatbot/components/ChatInput/ChatInput.js +74 -0
  4. package/dist/commonjs/features/chatbot/components/ChatInput/ChatInput.js.map +1 -0
  5. package/dist/commonjs/features/chatbot/components/ChatInput/RequestHintButton.js +144 -0
  6. package/dist/commonjs/features/chatbot/components/ChatInput/RequestHintButton.js.map +1 -0
  7. package/dist/commonjs/features/chatbot/components/ChatInput/freeText/ChatTextInput.js +135 -0
  8. package/dist/commonjs/features/chatbot/components/ChatInput/freeText/ChatTextInput.js.map +1 -0
  9. package/dist/commonjs/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.js +77 -0
  10. package/dist/commonjs/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.js.map +1 -0
  11. package/dist/commonjs/features/chatbot/components/{Alternatives/InputButton.js → ChatInput/freeText/SendMessageButton.js} +26 -17
  12. package/dist/commonjs/features/chatbot/components/ChatInput/freeText/SendMessageButton.js.map +1 -0
  13. package/dist/commonjs/features/chatbot/components/Chatbot.js +2 -2
  14. package/dist/commonjs/features/chatbot/components/Chatbot.js.map +1 -1
  15. package/dist/commonjs/features/chatbot/constants.js +2 -1
  16. package/dist/commonjs/features/chatbot/constants.js.map +1 -1
  17. package/dist/commonjs/features/chatbot/index.js +7 -0
  18. package/dist/commonjs/features/chatbot/index.js.map +1 -1
  19. package/dist/commonjs/features/chatbot/model/ChatBotModel.js +44 -8
  20. package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -1
  21. package/dist/commonjs/features/chatbot/model/ChatBotTextInput.js +16 -0
  22. package/dist/commonjs/features/chatbot/model/ChatBotTextInput.js.map +1 -0
  23. package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js +44 -11
  24. package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js.map +1 -1
  25. package/dist/commonjs/features/chatbot/types/model.types.js.map +1 -1
  26. package/dist/commonjs/features/chatbot/types/types.js +2 -0
  27. package/dist/commonjs/features/chatbot/types/types.js.map +1 -0
  28. package/dist/commonjs/features/chatbot/types/units.types.js +10 -0
  29. package/dist/commonjs/features/chatbot/types/units.types.js.map +1 -1
  30. package/dist/commonjs/features/exampleSolution/ExampleSolutionModal.js +1 -3
  31. package/dist/commonjs/features/exampleSolution/ExampleSolutionModal.js.map +1 -1
  32. package/dist/commonjs/features/exampleSolution/assets/grid.webp +0 -0
  33. package/dist/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.js +18 -11
  34. package/dist/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.js.map +1 -1
  35. package/dist/commonjs/features/exampleSolution/components/QuestionSection.js +7 -7
  36. package/dist/commonjs/features/exampleSolution/components/QuestionSection.js.map +1 -1
  37. package/dist/commonjs/features/exampleSolution/components/SolutionSection.js +55 -29
  38. package/dist/commonjs/features/exampleSolution/components/SolutionSection.js.map +1 -1
  39. package/dist/commonjs/features/exampleSolution/model/ExampleSolution.model.js +3 -1
  40. package/dist/commonjs/features/exampleSolution/model/ExampleSolution.model.js.map +1 -1
  41. package/dist/commonjs/features/formulaSheet/components/FormulaSheet.js +5 -4
  42. package/dist/commonjs/features/formulaSheet/components/FormulaSheet.js.map +1 -1
  43. package/dist/commonjs/shared/hooks/useKeyDownListener.js +3 -2
  44. package/dist/commonjs/shared/hooks/useKeyDownListener.js.map +1 -1
  45. package/dist/commonjs/shared/translation/localization/ca.json +2 -1
  46. package/dist/commonjs/shared/translation/localization/en.json +3 -2
  47. package/dist/commonjs/shared/translation/localization/gb.json +2 -1
  48. package/dist/commonjs/shared/translation/localization/sct.json +2 -1
  49. package/dist/commonjs/shared/translation/localization/sw.json +3 -2
  50. package/dist/module/features/chatbot/components/{ChatMessages/ChatbotMessages.js → Chat/Chat.js} +6 -13
  51. package/dist/module/features/chatbot/components/Chat/Chat.js.map +1 -0
  52. package/dist/module/features/chatbot/components/ChatInput/ChatInput.js +67 -0
  53. package/dist/module/features/chatbot/components/ChatInput/ChatInput.js.map +1 -0
  54. package/dist/module/features/chatbot/components/ChatInput/RequestHintButton.js +138 -0
  55. package/dist/module/features/chatbot/components/ChatInput/RequestHintButton.js.map +1 -0
  56. package/dist/module/features/chatbot/components/ChatInput/freeText/ChatTextInput.js +128 -0
  57. package/dist/module/features/chatbot/components/ChatInput/freeText/ChatTextInput.js.map +1 -0
  58. package/dist/module/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.js +71 -0
  59. package/dist/module/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.js.map +1 -0
  60. package/dist/module/features/chatbot/components/{Alternatives/InputButton.js → ChatInput/freeText/SendMessageButton.js} +25 -16
  61. package/dist/module/features/chatbot/components/ChatInput/freeText/SendMessageButton.js.map +1 -0
  62. package/dist/module/features/chatbot/components/Chatbot.js +2 -2
  63. package/dist/module/features/chatbot/components/Chatbot.js.map +1 -1
  64. package/dist/module/features/chatbot/constants.js +1 -0
  65. package/dist/module/features/chatbot/constants.js.map +1 -1
  66. package/dist/module/features/chatbot/index.js +1 -0
  67. package/dist/module/features/chatbot/index.js.map +1 -1
  68. package/dist/module/features/chatbot/model/ChatBotModel.js +44 -8
  69. package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
  70. package/dist/module/features/chatbot/model/ChatBotTextInput.js +11 -0
  71. package/dist/module/features/chatbot/model/ChatBotTextInput.js.map +1 -0
  72. package/dist/module/features/chatbot/model/ChatBotThreadManager.js +44 -11
  73. package/dist/module/features/chatbot/model/ChatBotThreadManager.js.map +1 -1
  74. package/dist/module/features/chatbot/types/model.types.js.map +1 -1
  75. package/dist/module/features/chatbot/types/types.js +2 -0
  76. package/dist/module/features/chatbot/types/types.js.map +1 -0
  77. package/dist/module/features/chatbot/types/units.types.js +6 -0
  78. package/dist/module/features/chatbot/types/units.types.js.map +1 -1
  79. package/dist/module/features/exampleSolution/ExampleSolutionModal.js +1 -3
  80. package/dist/module/features/exampleSolution/ExampleSolutionModal.js.map +1 -1
  81. package/dist/module/features/exampleSolution/assets/grid.webp +0 -0
  82. package/dist/module/features/exampleSolution/components/ExampleSolutionModalContent.js +19 -12
  83. package/dist/module/features/exampleSolution/components/ExampleSolutionModalContent.js.map +1 -1
  84. package/dist/module/features/exampleSolution/components/QuestionSection.js +9 -9
  85. package/dist/module/features/exampleSolution/components/QuestionSection.js.map +1 -1
  86. package/dist/module/features/exampleSolution/components/SolutionSection.js +57 -31
  87. package/dist/module/features/exampleSolution/components/SolutionSection.js.map +1 -1
  88. package/dist/module/features/exampleSolution/model/ExampleSolution.model.js +3 -1
  89. package/dist/module/features/exampleSolution/model/ExampleSolution.model.js.map +1 -1
  90. package/dist/module/features/formulaSheet/components/FormulaSheet.js +5 -4
  91. package/dist/module/features/formulaSheet/components/FormulaSheet.js.map +1 -1
  92. package/dist/module/shared/hooks/useKeyDownListener.js +3 -2
  93. package/dist/module/shared/hooks/useKeyDownListener.js.map +1 -1
  94. package/dist/module/shared/translation/localization/ca.json +2 -1
  95. package/dist/module/shared/translation/localization/en.json +3 -2
  96. package/dist/module/shared/translation/localization/gb.json +2 -1
  97. package/dist/module/shared/translation/localization/sct.json +2 -1
  98. package/dist/module/shared/translation/localization/sw.json +3 -2
  99. package/dist/typescript/commonjs/features/chatbot/components/{ChatMessages/ChatbotMessages.d.ts → Chat/Chat.d.ts} +3 -3
  100. package/dist/typescript/commonjs/features/chatbot/components/Chat/Chat.d.ts.map +1 -0
  101. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/ChatInput.d.ts +9 -0
  102. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/ChatInput.d.ts.map +1 -0
  103. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/RequestHintButton.d.ts +16 -0
  104. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/RequestHintButton.d.ts.map +1 -0
  105. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/ChatTextInput.d.ts +16 -0
  106. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/ChatTextInput.d.ts.map +1 -0
  107. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.d.ts +11 -0
  108. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.d.ts.map +1 -0
  109. package/dist/typescript/{module/features/chatbot/components/Alternatives/InputButton.d.ts → commonjs/features/chatbot/components/ChatInput/freeText/SendMessageButton.d.ts} +2 -2
  110. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/SendMessageButton.d.ts.map +1 -0
  111. package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts +2 -0
  112. package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts.map +1 -1
  113. package/dist/typescript/commonjs/features/chatbot/constants.d.ts +1 -0
  114. package/dist/typescript/commonjs/features/chatbot/constants.d.ts.map +1 -1
  115. package/dist/typescript/commonjs/features/chatbot/index.d.ts +1 -0
  116. package/dist/typescript/commonjs/features/chatbot/index.d.ts.map +1 -1
  117. package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts +5 -6
  118. package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
  119. package/dist/typescript/commonjs/features/chatbot/model/ChatBotTextInput.d.ts +8 -0
  120. package/dist/typescript/commonjs/features/chatbot/model/ChatBotTextInput.d.ts.map +1 -0
  121. package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts +3 -2
  122. package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -1
  123. package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts +1 -1
  124. package/dist/typescript/commonjs/features/chatbot/model/translation.d.ts.map +1 -1
  125. package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts +23 -1
  126. package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts.map +1 -1
  127. package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts +11 -2
  128. package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts.map +1 -1
  129. package/dist/typescript/commonjs/features/chatbot/types/types.d.ts +1 -0
  130. package/dist/typescript/commonjs/features/chatbot/types/types.d.ts.map +1 -0
  131. package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts +5 -0
  132. package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts.map +1 -1
  133. package/dist/typescript/commonjs/features/exampleSolution/ExampleSolutionModal.d.ts.map +1 -1
  134. package/dist/typescript/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.d.ts +5 -1
  135. package/dist/typescript/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.d.ts.map +1 -1
  136. package/dist/typescript/commonjs/features/exampleSolution/components/QuestionSection.d.ts +2 -1
  137. package/dist/typescript/commonjs/features/exampleSolution/components/QuestionSection.d.ts.map +1 -1
  138. package/dist/typescript/commonjs/features/exampleSolution/components/SolutionSection.d.ts.map +1 -1
  139. package/dist/typescript/commonjs/features/exampleSolution/model/ExampleSolution.model.d.ts +3 -2
  140. package/dist/typescript/commonjs/features/exampleSolution/model/ExampleSolution.model.d.ts.map +1 -1
  141. package/dist/typescript/commonjs/features/exampleSolution/types.d.ts +2 -1
  142. package/dist/typescript/commonjs/features/exampleSolution/types.d.ts.map +1 -1
  143. package/dist/typescript/commonjs/features/formulaSheet/components/FormulaSheet.d.ts.map +1 -1
  144. package/dist/typescript/commonjs/shared/hooks/useKeyDownListener.d.ts +1 -1
  145. package/dist/typescript/commonjs/shared/hooks/useKeyDownListener.d.ts.map +1 -1
  146. package/dist/typescript/commonjs/shared/hooks/useKeyboard.d.ts +1 -1
  147. package/dist/typescript/commonjs/shared/hooks/useKeyboard.d.ts.map +1 -1
  148. package/dist/typescript/commonjs/shared/translation/constants.d.ts +5 -0
  149. package/dist/typescript/commonjs/shared/translation/constants.d.ts.map +1 -1
  150. package/dist/typescript/commonjs/shared/translation/model.d.ts +2 -0
  151. package/dist/typescript/commonjs/shared/translation/model.d.ts.map +1 -1
  152. package/dist/typescript/module/features/chatbot/components/{ChatMessages/ChatbotMessages.d.ts → Chat/Chat.d.ts} +3 -3
  153. package/dist/typescript/module/features/chatbot/components/Chat/Chat.d.ts.map +1 -0
  154. package/dist/typescript/module/features/chatbot/components/ChatInput/ChatInput.d.ts +9 -0
  155. package/dist/typescript/module/features/chatbot/components/ChatInput/ChatInput.d.ts.map +1 -0
  156. package/dist/typescript/module/features/chatbot/components/ChatInput/RequestHintButton.d.ts +16 -0
  157. package/dist/typescript/module/features/chatbot/components/ChatInput/RequestHintButton.d.ts.map +1 -0
  158. package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/ChatTextInput.d.ts +16 -0
  159. package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/ChatTextInput.d.ts.map +1 -0
  160. package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.d.ts +11 -0
  161. package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.d.ts.map +1 -0
  162. package/dist/typescript/{commonjs/features/chatbot/components/Alternatives/InputButton.d.ts → module/features/chatbot/components/ChatInput/freeText/SendMessageButton.d.ts} +2 -2
  163. package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/SendMessageButton.d.ts.map +1 -0
  164. package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts +2 -0
  165. package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts.map +1 -1
  166. package/dist/typescript/module/features/chatbot/constants.d.ts +1 -0
  167. package/dist/typescript/module/features/chatbot/constants.d.ts.map +1 -1
  168. package/dist/typescript/module/features/chatbot/index.d.ts +1 -0
  169. package/dist/typescript/module/features/chatbot/index.d.ts.map +1 -1
  170. package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts +5 -6
  171. package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
  172. package/dist/typescript/module/features/chatbot/model/ChatBotTextInput.d.ts +8 -0
  173. package/dist/typescript/module/features/chatbot/model/ChatBotTextInput.d.ts.map +1 -0
  174. package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts +3 -2
  175. package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -1
  176. package/dist/typescript/module/features/chatbot/model/translation.d.ts +1 -1
  177. package/dist/typescript/module/features/chatbot/model/translation.d.ts.map +1 -1
  178. package/dist/typescript/module/features/chatbot/types/api.types.d.ts +23 -1
  179. package/dist/typescript/module/features/chatbot/types/api.types.d.ts.map +1 -1
  180. package/dist/typescript/module/features/chatbot/types/model.types.d.ts +11 -2
  181. package/dist/typescript/module/features/chatbot/types/model.types.d.ts.map +1 -1
  182. package/dist/typescript/module/features/chatbot/types/types.d.ts +1 -0
  183. package/dist/typescript/module/features/chatbot/types/types.d.ts.map +1 -0
  184. package/dist/typescript/module/features/chatbot/types/units.types.d.ts +5 -0
  185. package/dist/typescript/module/features/chatbot/types/units.types.d.ts.map +1 -1
  186. package/dist/typescript/module/features/exampleSolution/ExampleSolutionModal.d.ts.map +1 -1
  187. package/dist/typescript/module/features/exampleSolution/components/ExampleSolutionModalContent.d.ts +5 -1
  188. package/dist/typescript/module/features/exampleSolution/components/ExampleSolutionModalContent.d.ts.map +1 -1
  189. package/dist/typescript/module/features/exampleSolution/components/QuestionSection.d.ts +2 -1
  190. package/dist/typescript/module/features/exampleSolution/components/QuestionSection.d.ts.map +1 -1
  191. package/dist/typescript/module/features/exampleSolution/components/SolutionSection.d.ts.map +1 -1
  192. package/dist/typescript/module/features/exampleSolution/model/ExampleSolution.model.d.ts +3 -2
  193. package/dist/typescript/module/features/exampleSolution/model/ExampleSolution.model.d.ts.map +1 -1
  194. package/dist/typescript/module/features/exampleSolution/types.d.ts +2 -1
  195. package/dist/typescript/module/features/exampleSolution/types.d.ts.map +1 -1
  196. package/dist/typescript/module/features/formulaSheet/components/FormulaSheet.d.ts.map +1 -1
  197. package/dist/typescript/module/shared/hooks/useKeyDownListener.d.ts +1 -1
  198. package/dist/typescript/module/shared/hooks/useKeyDownListener.d.ts.map +1 -1
  199. package/dist/typescript/module/shared/hooks/useKeyboard.d.ts +1 -1
  200. package/dist/typescript/module/shared/hooks/useKeyboard.d.ts.map +1 -1
  201. package/dist/typescript/module/shared/translation/constants.d.ts +5 -0
  202. package/dist/typescript/module/shared/translation/constants.d.ts.map +1 -1
  203. package/dist/typescript/module/shared/translation/model.d.ts +2 -0
  204. package/dist/typescript/module/shared/translation/model.d.ts.map +1 -1
  205. package/package.json +2 -2
  206. package/src/features/chatbot/components/{ChatMessages/ChatbotMessages.tsx → Chat/Chat.tsx} +12 -17
  207. package/src/features/chatbot/components/ChatInput/ChatInput.tsx +83 -0
  208. package/src/features/chatbot/components/ChatInput/RequestHintButton.tsx +156 -0
  209. package/src/features/chatbot/components/ChatInput/freeText/ChatTextInput.tsx +153 -0
  210. package/src/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.tsx +83 -0
  211. package/src/features/chatbot/components/{Alternatives/InputButton.tsx → ChatInput/freeText/SendMessageButton.tsx} +37 -16
  212. package/src/features/chatbot/components/Chatbot.tsx +4 -2
  213. package/src/features/chatbot/constants.ts +3 -0
  214. package/src/features/chatbot/index.ts +2 -0
  215. package/src/features/chatbot/model/ChatBotModel.ts +67 -33
  216. package/src/features/chatbot/model/ChatBotTextInput.ts +10 -0
  217. package/src/features/chatbot/model/ChatBotThreadManager.ts +35 -9
  218. package/src/features/chatbot/model/translation.ts +1 -1
  219. package/src/features/chatbot/types/api.types.ts +25 -1
  220. package/src/features/chatbot/types/model.types.ts +16 -1
  221. package/src/features/chatbot/types/types.ts +0 -0
  222. package/src/features/chatbot/types/units.types.ts +6 -0
  223. package/src/features/exampleSolution/ExampleSolutionModal.tsx +1 -7
  224. package/src/features/exampleSolution/assets/grid.webp +0 -0
  225. package/src/features/exampleSolution/components/ExampleSolutionModalContent.tsx +24 -12
  226. package/src/features/exampleSolution/components/QuestionSection.tsx +11 -7
  227. package/src/features/exampleSolution/components/SolutionSection.tsx +72 -29
  228. package/src/features/exampleSolution/model/ExampleSolution.model.ts +5 -2
  229. package/src/features/exampleSolution/types.ts +2 -1
  230. package/src/features/formulaSheet/components/FormulaSheet.tsx +6 -4
  231. package/src/shared/hooks/useKeyDownListener.ts +3 -1
  232. package/src/shared/translation/localization/ca.json +2 -1
  233. package/src/shared/translation/localization/en.json +3 -2
  234. package/src/shared/translation/localization/gb.json +2 -1
  235. package/src/shared/translation/localization/sct.json +2 -1
  236. package/src/shared/translation/localization/sw.json +3 -2
  237. package/dist/commonjs/features/chatbot/components/Alternatives/Alternatives.js +0 -111
  238. package/dist/commonjs/features/chatbot/components/Alternatives/Alternatives.js.map +0 -1
  239. package/dist/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.js +0 -208
  240. package/dist/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.js.map +0 -1
  241. package/dist/commonjs/features/chatbot/components/Alternatives/InputButton.js.map +0 -1
  242. package/dist/commonjs/features/chatbot/components/Alternatives/InputWithHintRow.js +0 -157
  243. package/dist/commonjs/features/chatbot/components/Alternatives/InputWithHintRow.js.map +0 -1
  244. package/dist/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +0 -1
  245. package/dist/commonjs/features/exampleSolution/assets/grid.png +0 -0
  246. package/dist/module/features/chatbot/components/Alternatives/Alternatives.js +0 -105
  247. package/dist/module/features/chatbot/components/Alternatives/Alternatives.js.map +0 -1
  248. package/dist/module/features/chatbot/components/Alternatives/HelpRequestOption.js +0 -200
  249. package/dist/module/features/chatbot/components/Alternatives/HelpRequestOption.js.map +0 -1
  250. package/dist/module/features/chatbot/components/Alternatives/InputButton.js.map +0 -1
  251. package/dist/module/features/chatbot/components/Alternatives/InputWithHintRow.js +0 -150
  252. package/dist/module/features/chatbot/components/Alternatives/InputWithHintRow.js.map +0 -1
  253. package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +0 -1
  254. package/dist/module/features/exampleSolution/assets/grid.png +0 -0
  255. package/dist/typescript/commonjs/features/chatbot/components/Alternatives/Alternatives.d.ts +0 -11
  256. package/dist/typescript/commonjs/features/chatbot/components/Alternatives/Alternatives.d.ts.map +0 -1
  257. package/dist/typescript/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.d.ts +0 -13
  258. package/dist/typescript/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.d.ts.map +0 -1
  259. package/dist/typescript/commonjs/features/chatbot/components/Alternatives/InputButton.d.ts.map +0 -1
  260. package/dist/typescript/commonjs/features/chatbot/components/Alternatives/InputWithHintRow.d.ts +0 -11
  261. package/dist/typescript/commonjs/features/chatbot/components/Alternatives/InputWithHintRow.d.ts.map +0 -1
  262. package/dist/typescript/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +0 -1
  263. package/dist/typescript/module/features/chatbot/components/Alternatives/Alternatives.d.ts +0 -11
  264. package/dist/typescript/module/features/chatbot/components/Alternatives/Alternatives.d.ts.map +0 -1
  265. package/dist/typescript/module/features/chatbot/components/Alternatives/HelpRequestOption.d.ts +0 -13
  266. package/dist/typescript/module/features/chatbot/components/Alternatives/HelpRequestOption.d.ts.map +0 -1
  267. package/dist/typescript/module/features/chatbot/components/Alternatives/InputButton.d.ts.map +0 -1
  268. package/dist/typescript/module/features/chatbot/components/Alternatives/InputWithHintRow.d.ts +0 -11
  269. package/dist/typescript/module/features/chatbot/components/Alternatives/InputWithHintRow.d.ts.map +0 -1
  270. package/dist/typescript/module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +0 -1
  271. package/src/features/chatbot/components/Alternatives/Alternatives.tsx +0 -135
  272. package/src/features/chatbot/components/Alternatives/HelpRequestOption.tsx +0 -214
  273. package/src/features/chatbot/components/Alternatives/InputWithHintRow.tsx +0 -160
  274. package/src/features/exampleSolution/assets/grid.png +0 -0
@@ -0,0 +1,156 @@
1
+ import { Pressable, StyleSheet } from 'react-native'
2
+ import React, { memo } from 'react'
3
+ import Animated, {
4
+ useSharedValue,
5
+ withTiming,
6
+ useAnimatedStyle,
7
+ interpolateColor,
8
+ } from 'react-native-reanimated'
9
+ import {
10
+ ArrowRightIcon,
11
+ ArrowUpIcon,
12
+ COLORS,
13
+ FONT_FAMILY,
14
+ IS_MOBILE,
15
+ SPACING,
16
+ } from '@magmamath/react-native-ui'
17
+ import { ColorScheme } from '@magmamath/students-features'
18
+ import { MESSAGE_COLORS_MAP } from '../../constants'
19
+
20
+ export enum HintButtonVariant {
21
+ Default = 'default',
22
+ Short = 'short',
23
+ }
24
+
25
+ const HOVER_ANIMATION_DURATION = 200
26
+
27
+ const REQUEST_HINT_BUTTON = {
28
+ [HintButtonVariant.Default]: {
29
+ width: 305,
30
+ fontSize: 20,
31
+ },
32
+ [HintButtonVariant.Short]: { width: 163, fontSize: 18 },
33
+ }
34
+
35
+ type RequestHintButtonProps = {
36
+ onPress: () => void
37
+ label: string
38
+ disabled: boolean
39
+ colorScheme?: ColorScheme
40
+ variant: HintButtonVariant
41
+ }
42
+
43
+ export const RequestHintButton = memo(
44
+ ({
45
+ onPress,
46
+ label,
47
+ disabled = false,
48
+ colorScheme = ColorScheme.Blue,
49
+ variant = HintButtonVariant.Default,
50
+ }: RequestHintButtonProps) => {
51
+ const hoverSv = useSharedValue(0)
52
+
53
+ const onHoverIn = () => {
54
+ if (!disabled) hoverSv.value = withTiming(1, { duration: HOVER_ANIMATION_DURATION })
55
+ }
56
+ const onHoverOut = () => {
57
+ if (!disabled) hoverSv.value = withTiming(0, { duration: HOVER_ANIMATION_DURATION })
58
+ }
59
+
60
+ const animatedTextContainerStyle = useAnimatedStyle(() => {
61
+ if (disabled) {
62
+ return {
63
+ backgroundColor: COLORS.NEUTRAL_2,
64
+ borderColor: COLORS.NEUTRAL_5,
65
+ }
66
+ }
67
+
68
+ const defaultBorderColor =
69
+ variant === HintButtonVariant.Default
70
+ ? COLORS.NEUTRAL_1
71
+ : MESSAGE_COLORS_MAP[colorScheme].sent.border
72
+
73
+ return {
74
+ backgroundColor: interpolateColor(
75
+ hoverSv.value,
76
+ [0, 1],
77
+ [COLORS.NEUTRAL_1, MESSAGE_COLORS_MAP[colorScheme].sent.background],
78
+ ),
79
+ borderColor: interpolateColor(
80
+ hoverSv.value,
81
+ [0, 1],
82
+ [defaultBorderColor, MESSAGE_COLORS_MAP[colorScheme].sent.border],
83
+ ),
84
+ }
85
+ }, [hoverSv, disabled, colorScheme])
86
+
87
+ const animatedTextStyle = useAnimatedStyle(() => {
88
+ if (disabled) return { color: COLORS.NEUTRAL_5 }
89
+
90
+ return {
91
+ color: interpolateColor(hoverSv.value, [0, 1], [COLORS.NEUTRAL_10, COLORS.NEUTRAL_1]),
92
+ }
93
+ }, [hoverSv, disabled])
94
+
95
+ const iconColor = disabled ? COLORS.NEUTRAL_5 : 'currentColor'
96
+ const { width, fontSize } = REQUEST_HINT_BUTTON[variant]
97
+
98
+ return (
99
+ <Pressable
100
+ onHoverIn={onHoverIn}
101
+ onHoverOut={onHoverOut}
102
+ onPress={onPress}
103
+ style={[styles.button, { cursor: disabled ? 'auto' : 'pointer', width }]}
104
+ disabled={disabled}
105
+ accessibilityState={{ disabled }}
106
+ accessibilityRole="button"
107
+ >
108
+ <Animated.View style={[styles.content, animatedTextContainerStyle]}>
109
+ <Animated.Text numberOfLines={1} style={[styles.text, animatedTextStyle, { fontSize }]}>
110
+ {label}
111
+ </Animated.Text>
112
+
113
+ <Animated.Text style={[styles.iconWrapper, animatedTextStyle]}>
114
+ {variant === HintButtonVariant.Default ? (
115
+ <ArrowRightIcon color={iconColor} size={16} />
116
+ ) : (
117
+ <ArrowUpIcon color={iconColor} size={16} />
118
+ )}
119
+ </Animated.Text>
120
+ </Animated.View>
121
+ </Pressable>
122
+ )
123
+ },
124
+ )
125
+
126
+ const styles = StyleSheet.create({
127
+ button: {
128
+ flexDirection: 'row',
129
+ justifyContent: 'flex-end',
130
+ },
131
+ text: {
132
+ fontWeight: '400',
133
+ fontFamily: FONT_FAMILY.buenosAires,
134
+ color: COLORS.NEUTRAL_10,
135
+ },
136
+ content: {
137
+ height: 44,
138
+ flex: 1,
139
+ flexDirection: 'row',
140
+ alignItems: 'center',
141
+ justifyContent: 'space-between',
142
+ paddingHorizontal: SPACING[400],
143
+ borderWidth: 1,
144
+ borderRadius: 48,
145
+ elevation: 3,
146
+ shadowColor: '#333',
147
+ shadowOffset: { width: 0, height: 1 },
148
+ shadowOpacity: 0.25,
149
+ shadowRadius: 3,
150
+ backgroundColor: COLORS.PRIMARY_BLUE,
151
+ borderColor: COLORS.PRIMARY_BLUE,
152
+ },
153
+ iconWrapper: {
154
+ top: IS_MOBILE ? 3 : 0,
155
+ },
156
+ })
@@ -0,0 +1,153 @@
1
+ import React, { useState } from 'react'
2
+ import Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated'
3
+ import {
4
+ NativeSyntheticEvent,
5
+ Platform,
6
+ StyleSheet,
7
+ TextInput,
8
+ TextInputFocusEventData,
9
+ } from 'react-native'
10
+ import { COLORS, FONT_FAMILY, SPACING } from '@magmamath/react-native-ui'
11
+ import { ColorScheme } from '@magmamath/students-features'
12
+ import { useKeyBoard } from '../../../../../shared/hooks/useKeyboard'
13
+ import { KeyboardKeys } from '../../../../../lib/constants'
14
+
15
+ import { SendMessageButton } from './SendMessageButton'
16
+
17
+ const MAX_AVAILABLE_MESSAGE_LENGTH = 500
18
+ const COMPACT_WIDTH = 134
19
+ const FULL_WIDTH = 305
20
+ const ANIMATION_DURATION = 200
21
+
22
+ type ChatTextInputProps = {
23
+ value: string
24
+ onSubmit: () => void
25
+ submitDisabled?: boolean
26
+ onChangeText?: (text: string) => void
27
+ onBlur?: (e: NativeSyntheticEvent<TextInputFocusEventData>) => void
28
+ onFocus?: (e: NativeSyntheticEvent<TextInputFocusEventData>) => void
29
+ placeholder?: string
30
+ colorScheme?: ColorScheme
31
+ }
32
+
33
+ export const ChatTextInput = ({
34
+ value,
35
+ submitDisabled,
36
+ onSubmit,
37
+ onChangeText,
38
+ onBlur,
39
+ onFocus,
40
+ colorScheme = ColorScheme.Blue,
41
+ placeholder,
42
+ }: ChatTextInputProps) => {
43
+ const [isFocused, setIsFocused] = useState(false)
44
+ const widthSv = useSharedValue(value ? FULL_WIDTH : COMPACT_WIDTH )
45
+
46
+ const animatedStyle = useAnimatedStyle(
47
+ () => ({
48
+ width: widthSv.value,
49
+ }),
50
+ [widthSv],
51
+ )
52
+
53
+ const handleInputChange = (text: string) => {
54
+ if (text.length > MAX_AVAILABLE_MESSAGE_LENGTH) return
55
+
56
+ onChangeText?.(text)
57
+
58
+ const hasText = text.trim().length > 0
59
+ const isExpanded = widthSv.value > COMPACT_WIDTH
60
+ const shouldCollapseInput = !hasText && isExpanded
61
+ const shouldExpandInput = hasText && !isExpanded
62
+
63
+ if (shouldExpandInput) {
64
+ widthSv.value = withTiming(FULL_WIDTH, { duration: ANIMATION_DURATION })
65
+ } else if (shouldCollapseInput) {
66
+ widthSv.value = withTiming(COMPACT_WIDTH, { duration: ANIMATION_DURATION })
67
+ }
68
+ }
69
+
70
+ const handleSendMessage = () => {
71
+ if (submitDisabled || value.trim().length < 1 || value.length > MAX_AVAILABLE_MESSAGE_LENGTH)
72
+ return
73
+
74
+ onSubmit?.()
75
+ handleInputChange('')
76
+ }
77
+
78
+ const handleOnFocus = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
79
+ setIsFocused(true)
80
+ onFocus?.(e)
81
+ }
82
+
83
+ const handleOnBlur = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
84
+ setIsFocused(false)
85
+ onBlur?.(e)
86
+ }
87
+
88
+ useKeyBoard((event) => {
89
+ if (event.key === KeyboardKeys.ENTER) {
90
+ void handleSendMessage()
91
+ }
92
+ }, isFocused)
93
+
94
+ return (
95
+ <Animated.View style={[styles.inputWrapper, animatedStyle]}>
96
+ <TextInput
97
+ value={value}
98
+ onChangeText={handleInputChange}
99
+ onBlur={handleOnBlur}
100
+ onFocus={handleOnFocus}
101
+ placeholder={placeholder}
102
+ placeholderTextColor={COLORS.NEUTRAL_6}
103
+ style={styles.input}
104
+ />
105
+ <SendMessageButton
106
+ onPress={handleSendMessage}
107
+ disabled={!!submitDisabled}
108
+ colorScheme={colorScheme}
109
+ />
110
+ </Animated.View>
111
+ )
112
+ }
113
+
114
+ const styles = StyleSheet.create({
115
+ container: {
116
+ position: 'relative',
117
+ width: '100%',
118
+ alignItems: 'flex-end',
119
+ height: 52,
120
+ justifyContent: 'center',
121
+ },
122
+ inputWrapper: {
123
+ position: 'absolute',
124
+ zIndex: 1,
125
+ left: 0,
126
+ flexDirection: 'row',
127
+ borderWidth: 1,
128
+ borderColor: COLORS.NEUTRAL_5,
129
+ borderRadius: 200,
130
+ backgroundColor: COLORS.NEUTRAL_1,
131
+ paddingHorizontal: SPACING[100],
132
+ paddingVertical: SPACING[100],
133
+ elevation: 3,
134
+ shadowColor: '#333',
135
+ shadowOffset: { width: 0, height: 1 },
136
+ shadowOpacity: 0.25,
137
+ shadowRadius: 3,
138
+ },
139
+ input: {
140
+ flex: 1,
141
+ fontSize: 16,
142
+ minWidth: 60,
143
+ minHeight: 22,
144
+ fontWeight: '400',
145
+ fontFamily: FONT_FAMILY.buenosAires,
146
+ paddingHorizontal: SPACING[200],
147
+ paddingVertical: SPACING[200],
148
+ ...(Platform.OS === 'web' && { outlineStyle: 'none' }),
149
+ },
150
+ arrowWrapper: {
151
+ marginLeft: SPACING[200],
152
+ },
153
+ })
@@ -0,0 +1,83 @@
1
+ import React from 'react'
2
+ import { useUnit } from 'effector-react'
3
+ import { StyleSheet, View } from 'react-native'
4
+ import { ColorScheme } from '../../../types/style.types'
5
+ import { HintButtonVariant, RequestHintButton } from '../RequestHintButton'
6
+ import { useChatModel } from '../../../context/ChatBotModelContext'
7
+ import { t } from '../../../../../shared/translation'
8
+ import { ChatTextInput } from './ChatTextInput'
9
+ import { decodeHTMLEntities } from '../../../helpers'
10
+
11
+ type FreeTextInputBlockProps = {
12
+ optionLabel: string
13
+ disabled: boolean
14
+ onOptionPress: () => void
15
+ colorScheme?: ColorScheme
16
+ }
17
+
18
+ export const FreeTextInputBlock = ({
19
+ optionLabel,
20
+ onOptionPress,
21
+ disabled,
22
+ colorScheme,
23
+ }: FreeTextInputBlockProps) => {
24
+ const model = useChatModel()
25
+ const inputValue = useUnit(model.textInput.$value)
26
+ const context = useUnit(model.$context)
27
+
28
+ const handleOnSubmit = async () => {
29
+ let translatedMessage = ''
30
+ if (context?.translationTargetLanguage) {
31
+ const response = await model.translation.api.translateTextFx({
32
+ text: [inputValue],
33
+ targetLanguage: context?.translationTargetLanguage,
34
+ })
35
+ translatedMessage =
36
+ response.data.translations.map(({ translatedText }) =>
37
+ decodeHTMLEntities(translatedText),
38
+ )?.[0] ?? ''
39
+ }
40
+
41
+ void model.textInput.setValue('')
42
+ void model.sendHelpRequestFx({
43
+ message: inputValue,
44
+ translatedMessage,
45
+ isFreeText: true,
46
+ })
47
+ }
48
+ const handleOnBlur = () => model.textInput.setIsFocused(false)
49
+ const handleOnFocus = () => model.textInput.setIsFocused(true)
50
+ const handleOnChangeText = (text: string) => model.textInput.setValue(text)
51
+
52
+ return (
53
+ <View style={styles.container}>
54
+ <ChatTextInput
55
+ value={inputValue}
56
+ onSubmit={handleOnSubmit}
57
+ onChangeText={handleOnChangeText}
58
+ onBlur={handleOnBlur}
59
+ onFocus={handleOnFocus}
60
+ submitDisabled={disabled || inputValue.trim().length < 1}
61
+ colorScheme={colorScheme}
62
+ placeholder={t('chat.inputPlaceholder')}
63
+ />
64
+ <RequestHintButton
65
+ onPress={onOptionPress}
66
+ label={optionLabel}
67
+ disabled={disabled}
68
+ colorScheme={colorScheme}
69
+ variant={HintButtonVariant.Short}
70
+ />
71
+ </View>
72
+ )
73
+ }
74
+
75
+ const styles = StyleSheet.create({
76
+ container: {
77
+ position: 'relative',
78
+ width: '100%',
79
+ alignItems: 'flex-end',
80
+ height: 52,
81
+ justifyContent: 'center',
82
+ },
83
+ })
@@ -6,9 +6,9 @@ import Animated, {
6
6
  useAnimatedStyle,
7
7
  interpolateColor,
8
8
  } from 'react-native-reanimated'
9
- import { ArrowUpIcon, COLORS, FONT_FAMILY } from '@magmamath/react-native-ui'
9
+ import { ArrowUpIcon, COLORS, IS_MOBILE } from '@magmamath/react-native-ui'
10
10
  import { ColorScheme } from '@magmamath/students-features'
11
- import { MESSAGE_COLORS_MAP } from '../../constants'
11
+ import { MESSAGE_COLORS_MAP } from '../../../constants'
12
12
 
13
13
  type HelpRequestOptionProps = {
14
14
  onPress: () => void
@@ -16,7 +16,7 @@ type HelpRequestOptionProps = {
16
16
  colorScheme?: ColorScheme
17
17
  }
18
18
 
19
- export const InputButton = ({
19
+ export const SendMessageButton = ({
20
20
  onPress,
21
21
  disabled = false,
22
22
  colorScheme = ColorScheme.Blue,
@@ -30,8 +30,12 @@ export const InputButton = ({
30
30
  if (!disabled) hoverSv.value = withTiming(0, { duration: 200 })
31
31
  }
32
32
 
33
- const animatedWrapperStyle = useAnimatedStyle(() => {
34
- const backgroundColor = interpolateColor(hoverSv.value, [0, 1], [COLORS.NEUTRAL_1, MESSAGE_COLORS_MAP[colorScheme].sent.border])
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
+ )
35
39
  const color = interpolateColor(hoverSv.value, [0, 1], [COLORS.NEUTRAL_10, COLORS.NEUTRAL_1])
36
40
 
37
41
  return {
@@ -51,9 +55,25 @@ export const InputButton = ({
51
55
  accessibilityState={{ disabled }}
52
56
  accessibilityRole="button"
53
57
  >
54
- <Animated.Text style={[styles.textWrapper, animatedWrapperStyle]}>
55
- <ArrowUpIcon color={'currentColor'} size={16} />
56
- </Animated.Text>
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
+ )}
57
77
  </Pressable>
58
78
  )
59
79
  }
@@ -62,19 +82,20 @@ const styles = StyleSheet.create({
62
82
  button: {
63
83
  flexDirection: 'row',
64
84
  justifyContent: 'flex-end',
85
+ height: 44,
86
+ width: 44,
65
87
  },
66
- text: {
67
- fontSize: 18,
68
- fontWeight: '400',
69
- fontFamily: FONT_FAMILY.buenosAires,
70
- color: COLORS.NEUTRAL_10,
71
- backgroundColor: 'purple',
88
+ iconContainer: {
89
+ justifyContent: 'center',
90
+ alignItems: 'center',
91
+ padding: 12,
92
+ borderRadius: 21,
93
+ borderWidth: 1,
72
94
  },
73
- textWrapper: {
95
+ webIconContainer: {
74
96
  flex: 1,
75
97
  flexDirection: 'row',
76
98
  alignItems: 'center',
77
- justifyContent: 'space-between',
78
99
  paddingHorizontal: 13,
79
100
  paddingVertical: 12,
80
101
  borderWidth: 1,
@@ -2,11 +2,12 @@ import React, { ComponentType, PropsWithChildren } from 'react'
2
2
  import { useStoreMap, useUnit } from 'effector-react'
3
3
 
4
4
  import { ChatbotModel } from '../model/ChatBotModel'
5
- import { ChatbotMessages } from './ChatMessages/ChatbotMessages'
5
+ import { Chat } from './Chat/Chat'
6
6
  import { ChatControls } from './ChatControls/ChatControls'
7
7
  import { AUDIO_CONFIG, DEFAULT_VOICE } from '../constants'
8
8
  import { ChatBotModelContext } from '../context/ChatBotModelContext'
9
9
  import { ColorScheme } from '../types/style.types'
10
+ import { ChatInputMode } from '../types/units.types'
10
11
 
11
12
  type ChatbotProps = {
12
13
  model: ChatbotModel
@@ -16,6 +17,7 @@ type ChatbotProps = {
16
17
  voice: typeof DEFAULT_VOICE
17
18
  audioConfig: typeof AUDIO_CONFIG
18
19
  }
20
+ inputMode?: ChatInputMode
19
21
  ButtonWrapper: ComponentType<PropsWithChildren>
20
22
  iconSize?: { width: number; height: number } // TODO: use number instead
21
23
  colorScheme?: ColorScheme
@@ -43,7 +45,7 @@ export const Chatbot = ({
43
45
 
44
46
  return (
45
47
  <ChatBotModelContext.Provider value={model}>
46
- <ChatbotMessages
48
+ <Chat
47
49
  model={model}
48
50
  colorScheme={colorScheme}
49
51
  isHintFeedback={isHintFeedback}
@@ -2,6 +2,7 @@ import { ButtonColor, COLORS } from '@magmamath/react-native-ui'
2
2
  import { Platform } from 'react-native'
3
3
  import { MessageVariant } from './types/model.types'
4
4
  import { ColorScheme } from './types/style.types'
5
+ import { ANIMATION_DURATION } from '../gifCelebrations/constants'
5
6
 
6
7
  export const AUDIO_CONFIG = {
7
8
  audioEncoding: 'LINEAR16',
@@ -77,3 +78,5 @@ export const CONTROLS_COLORS_MAP = {
77
78
  background: COLORS.PRIMARY_YELLOW,
78
79
  },
79
80
  }
81
+
82
+ export const HOVER_ANIMATION_DURATION = 200
@@ -9,5 +9,7 @@ export {
9
9
  export type { PostMessageResponse } from './types/api.types'
10
10
  export { DefaultMessagesCreator } from './model/DefaultMessageCreator'
11
11
  export type { ChatAnswer } from './types/units.types'
12
+ export { ChatInputMode } from './types/units.types'
13
+
12
14
  export type { ConversationMessage } from './types/units.types'
13
15
  export { ColorScheme } from './types/style.types'