@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.
Files changed (242) 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 -13
  16. package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -1
  17. package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js +10 -32
  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 +11 -8
  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 +48 -28
  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/shared/translation/localization/ca.json +2 -2
  36. package/dist/commonjs/shared/translation/localization/en.json +2 -2
  37. package/dist/commonjs/shared/translation/localization/gb.json +2 -2
  38. package/dist/commonjs/shared/translation/localization/sct.json +2 -2
  39. package/dist/commonjs/shared/translation/localization/sw.json +3 -3
  40. package/dist/module/features/chatbot/components/Alternatives/Alternatives.js +53 -0
  41. package/dist/module/features/chatbot/components/Alternatives/Alternatives.js.map +1 -0
  42. package/dist/module/features/chatbot/components/Alternatives/HelpRequestOption.js +92 -0
  43. package/dist/module/features/chatbot/components/Alternatives/HelpRequestOption.js.map +1 -0
  44. package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js +4 -7
  45. package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -1
  46. package/dist/module/features/chatbot/components/{Chat/Chat.js → ChatMessages/ChatbotMessages.js} +7 -10
  47. package/dist/module/features/chatbot/components/ChatMessages/ChatbotMessages.js.map +1 -0
  48. package/dist/module/features/chatbot/components/Chatbot.js +3 -5
  49. package/dist/module/features/chatbot/components/Chatbot.js.map +1 -1
  50. package/dist/module/features/chatbot/constants.js +0 -5
  51. package/dist/module/features/chatbot/constants.js.map +1 -1
  52. package/dist/module/features/chatbot/index.js +0 -1
  53. package/dist/module/features/chatbot/index.js.map +1 -1
  54. package/dist/module/features/chatbot/model/ChatBotModel.js +3 -13
  55. package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
  56. package/dist/module/features/chatbot/model/ChatBotThreadManager.js +10 -32
  57. package/dist/module/features/chatbot/model/ChatBotThreadManager.js.map +1 -1
  58. package/dist/module/features/chatbot/model/ChatbotApi.js +0 -3
  59. package/dist/module/features/chatbot/model/ChatbotApi.js.map +1 -1
  60. package/dist/module/features/chatbot/types/model.types.js.map +1 -1
  61. package/dist/module/features/chatbot/types/units.types.js +0 -6
  62. package/dist/module/features/chatbot/types/units.types.js.map +1 -1
  63. package/dist/module/features/exampleSolution/ExampleSolutionModal.js +1 -3
  64. package/dist/module/features/exampleSolution/ExampleSolutionModal.js.map +1 -1
  65. package/dist/module/features/exampleSolution/assets/grid.webp +0 -0
  66. package/dist/module/features/exampleSolution/components/ExampleSolutionModalContent.js +11 -8
  67. package/dist/module/features/exampleSolution/components/ExampleSolutionModalContent.js.map +1 -1
  68. package/dist/module/features/exampleSolution/components/QuestionSection.js +9 -9
  69. package/dist/module/features/exampleSolution/components/QuestionSection.js.map +1 -1
  70. package/dist/module/features/exampleSolution/components/SolutionSection.js +50 -30
  71. package/dist/module/features/exampleSolution/components/SolutionSection.js.map +1 -1
  72. package/dist/module/features/exampleSolution/model/ExampleSolution.model.js +3 -1
  73. package/dist/module/features/exampleSolution/model/ExampleSolution.model.js.map +1 -1
  74. package/dist/module/shared/translation/localization/ca.json +2 -2
  75. package/dist/module/shared/translation/localization/en.json +2 -2
  76. package/dist/module/shared/translation/localization/gb.json +2 -2
  77. package/dist/module/shared/translation/localization/sct.json +2 -2
  78. package/dist/module/shared/translation/localization/sw.json +3 -3
  79. package/dist/typescript/commonjs/features/chatbot/components/Alternatives/Alternatives.d.ts +11 -0
  80. package/dist/typescript/commonjs/features/chatbot/components/Alternatives/Alternatives.d.ts.map +1 -0
  81. package/dist/typescript/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.d.ts +10 -0
  82. package/dist/typescript/commonjs/features/chatbot/components/Alternatives/HelpRequestOption.d.ts.map +1 -0
  83. package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageLoader.d.ts.map +1 -1
  84. package/dist/typescript/{module/features/chatbot/components/Chat/Chat.d.ts → commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts} +2 -4
  85. package/dist/typescript/commonjs/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -0
  86. package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts +0 -2
  87. package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts.map +1 -1
  88. package/dist/typescript/commonjs/features/chatbot/constants.d.ts +0 -5
  89. package/dist/typescript/commonjs/features/chatbot/constants.d.ts.map +1 -1
  90. package/dist/typescript/commonjs/features/chatbot/index.d.ts +0 -1
  91. package/dist/typescript/commonjs/features/chatbot/index.d.ts.map +1 -1
  92. package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts +0 -4
  93. package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
  94. package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts +2 -5
  95. package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -1
  96. package/dist/typescript/commonjs/features/chatbot/model/ChatbotApi.d.ts.map +1 -1
  97. package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts +4 -9
  98. package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts.map +1 -1
  99. package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts +0 -20
  100. package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts.map +1 -1
  101. package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts +0 -18
  102. package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts.map +1 -1
  103. package/dist/typescript/commonjs/features/exampleSolution/ExampleSolutionModal.d.ts.map +1 -1
  104. package/dist/typescript/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.d.ts +5 -1
  105. package/dist/typescript/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.d.ts.map +1 -1
  106. package/dist/typescript/commonjs/features/exampleSolution/components/QuestionSection.d.ts +2 -1
  107. package/dist/typescript/commonjs/features/exampleSolution/components/QuestionSection.d.ts.map +1 -1
  108. package/dist/typescript/commonjs/features/exampleSolution/components/SolutionSection.d.ts.map +1 -1
  109. package/dist/typescript/commonjs/features/exampleSolution/model/ExampleSolution.model.d.ts +3 -2
  110. package/dist/typescript/commonjs/features/exampleSolution/model/ExampleSolution.model.d.ts.map +1 -1
  111. package/dist/typescript/commonjs/features/exampleSolution/types.d.ts +2 -1
  112. package/dist/typescript/commonjs/features/exampleSolution/types.d.ts.map +1 -1
  113. package/dist/typescript/module/features/chatbot/components/Alternatives/Alternatives.d.ts +11 -0
  114. package/dist/typescript/module/features/chatbot/components/Alternatives/Alternatives.d.ts.map +1 -0
  115. package/dist/typescript/module/features/chatbot/components/Alternatives/HelpRequestOption.d.ts +10 -0
  116. package/dist/typescript/module/features/chatbot/components/Alternatives/HelpRequestOption.d.ts.map +1 -0
  117. package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageLoader.d.ts.map +1 -1
  118. package/dist/typescript/{commonjs/features/chatbot/components/Chat/Chat.d.ts → module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts} +2 -4
  119. package/dist/typescript/module/features/chatbot/components/ChatMessages/ChatbotMessages.d.ts.map +1 -0
  120. package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts +0 -2
  121. package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts.map +1 -1
  122. package/dist/typescript/module/features/chatbot/constants.d.ts +0 -5
  123. package/dist/typescript/module/features/chatbot/constants.d.ts.map +1 -1
  124. package/dist/typescript/module/features/chatbot/index.d.ts +0 -1
  125. package/dist/typescript/module/features/chatbot/index.d.ts.map +1 -1
  126. package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts +0 -4
  127. package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
  128. package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts +2 -5
  129. package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -1
  130. package/dist/typescript/module/features/chatbot/model/ChatbotApi.d.ts.map +1 -1
  131. package/dist/typescript/module/features/chatbot/types/api.types.d.ts +4 -9
  132. package/dist/typescript/module/features/chatbot/types/api.types.d.ts.map +1 -1
  133. package/dist/typescript/module/features/chatbot/types/model.types.d.ts +0 -20
  134. package/dist/typescript/module/features/chatbot/types/model.types.d.ts.map +1 -1
  135. package/dist/typescript/module/features/chatbot/types/units.types.d.ts +0 -18
  136. package/dist/typescript/module/features/chatbot/types/units.types.d.ts.map +1 -1
  137. package/dist/typescript/module/features/exampleSolution/ExampleSolutionModal.d.ts.map +1 -1
  138. package/dist/typescript/module/features/exampleSolution/components/ExampleSolutionModalContent.d.ts +5 -1
  139. package/dist/typescript/module/features/exampleSolution/components/ExampleSolutionModalContent.d.ts.map +1 -1
  140. package/dist/typescript/module/features/exampleSolution/components/QuestionSection.d.ts +2 -1
  141. package/dist/typescript/module/features/exampleSolution/components/QuestionSection.d.ts.map +1 -1
  142. package/dist/typescript/module/features/exampleSolution/components/SolutionSection.d.ts.map +1 -1
  143. package/dist/typescript/module/features/exampleSolution/model/ExampleSolution.model.d.ts +3 -2
  144. package/dist/typescript/module/features/exampleSolution/model/ExampleSolution.model.d.ts.map +1 -1
  145. package/dist/typescript/module/features/exampleSolution/types.d.ts +2 -1
  146. package/dist/typescript/module/features/exampleSolution/types.d.ts.map +1 -1
  147. package/package.json +1 -1
  148. package/src/features/chatbot/components/Alternatives/Alternatives.tsx +60 -0
  149. package/src/features/chatbot/components/Alternatives/HelpRequestOption.tsx +91 -0
  150. package/src/features/chatbot/components/ChatMessage/MessageLoader.tsx +2 -6
  151. package/src/features/chatbot/components/{Chat/Chat.tsx → ChatMessages/ChatbotMessages.tsx} +6 -10
  152. package/src/features/chatbot/components/Chatbot.tsx +2 -6
  153. package/src/features/chatbot/constants.ts +0 -7
  154. package/src/features/chatbot/index.ts +0 -2
  155. package/src/features/chatbot/model/ChatBotModel.ts +26 -44
  156. package/src/features/chatbot/model/ChatBotThreadManager.ts +9 -38
  157. package/src/features/chatbot/model/ChatbotApi.ts +0 -2
  158. package/src/features/chatbot/types/api.types.ts +4 -10
  159. package/src/features/chatbot/types/model.types.ts +0 -27
  160. package/src/features/chatbot/types/units.types.ts +0 -22
  161. package/src/features/exampleSolution/ExampleSolutionModal.tsx +1 -7
  162. package/src/features/exampleSolution/assets/grid.webp +0 -0
  163. package/src/features/exampleSolution/components/ExampleSolutionModalContent.tsx +15 -9
  164. package/src/features/exampleSolution/components/QuestionSection.tsx +11 -7
  165. package/src/features/exampleSolution/components/SolutionSection.tsx +61 -28
  166. package/src/features/exampleSolution/model/ExampleSolution.model.ts +5 -2
  167. package/src/features/exampleSolution/types.ts +2 -1
  168. package/src/shared/translation/localization/ca.json +2 -2
  169. package/src/shared/translation/localization/en.json +2 -2
  170. package/src/shared/translation/localization/gb.json +2 -2
  171. package/src/shared/translation/localization/sct.json +2 -2
  172. package/src/shared/translation/localization/sw.json +3 -3
  173. package/dist/commonjs/features/chatbot/components/Chat/Chat.js.map +0 -1
  174. package/dist/commonjs/features/chatbot/components/ChatInput/ChatInput.js +0 -53
  175. package/dist/commonjs/features/chatbot/components/ChatInput/ChatInput.js.map +0 -1
  176. package/dist/commonjs/features/chatbot/components/ChatInput/InputOption.js +0 -39
  177. package/dist/commonjs/features/chatbot/components/ChatInput/InputOption.js.map +0 -1
  178. package/dist/commonjs/features/chatbot/components/ChatInput/InputOptionWithTextArea.js +0 -38
  179. package/dist/commonjs/features/chatbot/components/ChatInput/InputOptionWithTextArea.js.map +0 -1
  180. package/dist/commonjs/features/chatbot/components/ChatInput/RequestHintButton.js +0 -140
  181. package/dist/commonjs/features/chatbot/components/ChatInput/RequestHintButton.js.map +0 -1
  182. package/dist/commonjs/features/chatbot/components/ChatInput/freeText/ChatTextInput.js +0 -142
  183. package/dist/commonjs/features/chatbot/components/ChatInput/freeText/ChatTextInput.js.map +0 -1
  184. package/dist/commonjs/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.js +0 -44
  185. package/dist/commonjs/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.js.map +0 -1
  186. package/dist/commonjs/features/chatbot/components/ChatInput/freeText/SendMessageButton.js +0 -105
  187. package/dist/commonjs/features/chatbot/components/ChatInput/freeText/SendMessageButton.js.map +0 -1
  188. package/dist/commonjs/features/exampleSolution/assets/grid.png +0 -0
  189. package/dist/module/features/chatbot/components/Chat/Chat.js.map +0 -1
  190. package/dist/module/features/chatbot/components/ChatInput/ChatInput.js +0 -47
  191. package/dist/module/features/chatbot/components/ChatInput/ChatInput.js.map +0 -1
  192. package/dist/module/features/chatbot/components/ChatInput/InputOption.js +0 -34
  193. package/dist/module/features/chatbot/components/ChatInput/InputOption.js.map +0 -1
  194. package/dist/module/features/chatbot/components/ChatInput/InputOptionWithTextArea.js +0 -32
  195. package/dist/module/features/chatbot/components/ChatInput/InputOptionWithTextArea.js.map +0 -1
  196. package/dist/module/features/chatbot/components/ChatInput/RequestHintButton.js +0 -132
  197. package/dist/module/features/chatbot/components/ChatInput/RequestHintButton.js.map +0 -1
  198. package/dist/module/features/chatbot/components/ChatInput/freeText/ChatTextInput.js +0 -134
  199. package/dist/module/features/chatbot/components/ChatInput/freeText/ChatTextInput.js.map +0 -1
  200. package/dist/module/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.js +0 -38
  201. package/dist/module/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.js.map +0 -1
  202. package/dist/module/features/chatbot/components/ChatInput/freeText/SendMessageButton.js +0 -97
  203. package/dist/module/features/chatbot/components/ChatInput/freeText/SendMessageButton.js.map +0 -1
  204. package/dist/module/features/exampleSolution/assets/grid.png +0 -0
  205. package/dist/typescript/commonjs/features/chatbot/components/Chat/Chat.d.ts.map +0 -1
  206. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/ChatInput.d.ts +0 -4
  207. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/ChatInput.d.ts.map +0 -1
  208. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/InputOption.d.ts +0 -4
  209. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/InputOption.d.ts.map +0 -1
  210. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/InputOptionWithTextArea.d.ts +0 -4
  211. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/InputOptionWithTextArea.d.ts.map +0 -1
  212. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/RequestHintButton.d.ts +0 -18
  213. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/RequestHintButton.d.ts.map +0 -1
  214. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/ChatTextInput.d.ts +0 -10
  215. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/ChatTextInput.d.ts.map +0 -1
  216. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.d.ts +0 -11
  217. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.d.ts.map +0 -1
  218. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/SendMessageButton.d.ts +0 -10
  219. package/dist/typescript/commonjs/features/chatbot/components/ChatInput/freeText/SendMessageButton.d.ts.map +0 -1
  220. package/dist/typescript/module/features/chatbot/components/Chat/Chat.d.ts.map +0 -1
  221. package/dist/typescript/module/features/chatbot/components/ChatInput/ChatInput.d.ts +0 -4
  222. package/dist/typescript/module/features/chatbot/components/ChatInput/ChatInput.d.ts.map +0 -1
  223. package/dist/typescript/module/features/chatbot/components/ChatInput/InputOption.d.ts +0 -4
  224. package/dist/typescript/module/features/chatbot/components/ChatInput/InputOption.d.ts.map +0 -1
  225. package/dist/typescript/module/features/chatbot/components/ChatInput/InputOptionWithTextArea.d.ts +0 -4
  226. package/dist/typescript/module/features/chatbot/components/ChatInput/InputOptionWithTextArea.d.ts.map +0 -1
  227. package/dist/typescript/module/features/chatbot/components/ChatInput/RequestHintButton.d.ts +0 -18
  228. package/dist/typescript/module/features/chatbot/components/ChatInput/RequestHintButton.d.ts.map +0 -1
  229. package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/ChatTextInput.d.ts +0 -10
  230. package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/ChatTextInput.d.ts.map +0 -1
  231. package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.d.ts +0 -11
  232. package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.d.ts.map +0 -1
  233. package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/SendMessageButton.d.ts +0 -10
  234. package/dist/typescript/module/features/chatbot/components/ChatInput/freeText/SendMessageButton.d.ts.map +0 -1
  235. package/src/features/chatbot/components/ChatInput/ChatInput.tsx +0 -56
  236. package/src/features/chatbot/components/ChatInput/InputOption.tsx +0 -29
  237. package/src/features/chatbot/components/ChatInput/InputOptionWithTextArea.tsx +0 -27
  238. package/src/features/chatbot/components/ChatInput/RequestHintButton.tsx +0 -160
  239. package/src/features/chatbot/components/ChatInput/freeText/ChatTextInput.tsx +0 -133
  240. package/src/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.tsx +0 -42
  241. package/src/features/chatbot/components/ChatInput/freeText/SendMessageButton.tsx +0 -110
  242. package/src/features/exampleSolution/assets/grid.png +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ExampleSolution.model.d.ts","sourceRoot":"","sources":["../../../../../../src/features/exampleSolution/model/ExampleSolution.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAA;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAE7D,qBAAa,oBAAoB;IAC/B,SAAgB,GAAG,sBAAA;IACnB,SAAgB,KAAK,uBAA6B;gBAEtC,EAAE,GAAG,EAAE,YAAY,EAAE,EAAE,yBAAyB;CAG7D"}
1
+ {"version":3,"file":"ExampleSolution.model.d.ts","sourceRoot":"","sources":["../../../../../../src/features/exampleSolution/model/ExampleSolution.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAA;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAE7D,qBAAa,oBAAoB;IAC/B,SAAgB,GAAG,sBAAA;IACnB,SAAgB,KAAK,uBAA6B;IAElD,SAAgB,oBAAoB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAA;gBAElE,EAAE,GAAG,EAAE,YAAY,EAAE,oBAAoB,EAAE,EAAE,yBAAyB;CAInF"}
@@ -14,9 +14,10 @@ export type ExampleSolutionApiRequests = {
14
14
  generateExampleSolution: (body: ExampleSolutionPayload) => Promise<ExampleSolutionResponse>;
15
15
  };
16
16
  export type ExampleSolutionErrorHandler = (errorMessage: string) => void;
17
- export type GifCelebrationsModelProps = {
17
+ export type ExampleSolutionModelProps = {
18
18
  api: ExampleSolutionApiRequests;
19
19
  errorHandler?: ExampleSolutionErrorHandler;
20
+ renderKatexComponent: (katexString: string) => React.ReactNode;
20
21
  };
21
22
  export type ExampleSolutionModalParams = {
22
23
  cacheKey: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/features/exampleSolution/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAA;AAEpE,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AACD,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AACD,MAAM,MAAM,0BAA0B,GAAG;IACvC,uBAAuB,EAAE,CAAC,IAAI,EAAE,sBAAsB,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAA;CAC5F,CAAA;AACD,MAAM,MAAM,2BAA2B,GAAG,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAA;AACxE,MAAM,MAAM,yBAAyB,GAAG;IACtC,GAAG,EAAE,0BAA0B,CAAA;IAC/B,YAAY,CAAC,EAAE,2BAA2B,CAAA;CAC3C,CAAA;AACD,MAAM,MAAM,0BAA0B,GAAG;IACvC,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,sBAAsB,CAAA;IAC/B,KAAK,EAAE,oBAAoB,CAAA;CAC5B,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/features/exampleSolution/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAA;AAEpE,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AACD,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AACD,MAAM,MAAM,0BAA0B,GAAG;IACvC,uBAAuB,EAAE,CAAC,IAAI,EAAE,sBAAsB,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAA;CAC5F,CAAA;AACD,MAAM,MAAM,2BAA2B,GAAG,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAA;AACxE,MAAM,MAAM,yBAAyB,GAAG;IACtC,GAAG,EAAE,0BAA0B,CAAA;IAC/B,YAAY,CAAC,EAAE,2BAA2B,CAAA;IAC1C,oBAAoB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAA;CAC/D,CAAA;AACD,MAAM,MAAM,0BAA0B,GAAG;IACvC,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,sBAAsB,CAAA;IAC/B,KAAK,EAAE,oBAAoB,CAAA;CAC5B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magmamath/students-features",
3
- "version": "0.6.14-rc.8",
3
+ "version": "0.6.14",
4
4
  "description": "Magmamath features library",
5
5
  "source": "src/index.ts",
6
6
  "main": "src/index.ts",
@@ -0,0 +1,60 @@
1
+ import React from 'react'
2
+ import { StyleSheet, View } from 'react-native'
3
+ import { useStoreMap, useUnit } from 'effector-react'
4
+
5
+ import { HelpRequestOption } from './HelpRequestOption'
6
+ import { useChatModel } from '../../context/ChatBotModelContext'
7
+ import { ColorScheme } from '../../types/style.types'
8
+ import { CONTROLS_COLORS_MAP } from '../../constants'
9
+
10
+ type AlternativesProps = {
11
+ onPressAlternative: (message: string, translatedMessage?: string) => void
12
+ hasMessages: boolean
13
+ isHintFeedback: boolean
14
+ colorScheme?: ColorScheme
15
+ }
16
+
17
+ export const Alternatives = ({
18
+ onPressAlternative,
19
+ hasMessages,
20
+ isHintFeedback,
21
+ colorScheme = ColorScheme.Blue,
22
+ }: AlternativesProps) => {
23
+ const model = useChatModel()
24
+ const isTranslated = useUnit(model.translation.$isTranslated)
25
+ const alternatives = useUnit(model.$alternatives)
26
+ const isTranslationPending = useUnit(model.translation.translateAllMessagesFx.pending)
27
+ const lastMessageOptions = useStoreMap(model.$currentChatData, ({ messages }) => {
28
+ const lastMessage = messages.at(-1)
29
+ return lastMessage?.options ?? []
30
+ })
31
+
32
+ const options = (() => {
33
+ if (hasMessages) return lastMessageOptions
34
+ if (isHintFeedback) return alternatives?.options.hints ?? []
35
+ return alternatives?.options.default ?? []
36
+ })()
37
+
38
+ return (
39
+ <View style={styles.container}>
40
+ {options.map(({ text, translatedText }, index) => (
41
+ <HelpRequestOption
42
+ key={index}
43
+ onPress={() => onPressAlternative(text, translatedText)}
44
+ message={isTranslated ? (translatedText as string) : text}
45
+ disabled={isTranslationPending}
46
+ hoverColor={CONTROLS_COLORS_MAP[colorScheme].hover}
47
+ />
48
+ ))}
49
+ </View>
50
+ )
51
+ }
52
+
53
+ const styles = StyleSheet.create({
54
+ container: {
55
+ flex: 1,
56
+ width: 305,
57
+ marginVertical: 8,
58
+ gap: 8,
59
+ },
60
+ })
@@ -0,0 +1,91 @@
1
+ import React, { useEffect, useRef, useState } from 'react'
2
+ import { Animated, Pressable, StyleSheet } from 'react-native'
3
+ import { COLORS, FONT_FAMILY, SPACING } from '@magmamath/react-native-ui'
4
+ import { ArrowRightIcon } from '../../../../shared/icons/ArrowRightIcon'
5
+
6
+ type HelpRequestOptionProps = {
7
+ onPress: () => void
8
+ message: string
9
+ disabled: boolean
10
+ hoverColor?: string
11
+ }
12
+
13
+ export const HelpRequestOption = ({
14
+ onPress,
15
+ message,
16
+ disabled = false,
17
+ hoverColor = COLORS.PRIMARY_BLUE,
18
+ }: HelpRequestOptionProps) => {
19
+ const [isHovered, setIsHovered] = useState(false)
20
+ const hoverAnim = useRef(new Animated.Value(0)).current
21
+
22
+ const backgroundColor = hoverAnim.interpolate({
23
+ inputRange: [0, 1],
24
+ outputRange: [COLORS.NEUTRAL_1, hoverColor],
25
+ })
26
+ const textColor = hoverAnim.interpolate({
27
+ inputRange: [0, 1],
28
+ outputRange: [COLORS.NEUTRAL_10, COLORS.NEUTRAL_1],
29
+ })
30
+
31
+ useEffect(() => {
32
+ Animated.timing(hoverAnim, {
33
+ toValue: isHovered ? 1 : 0,
34
+ duration: 200,
35
+ useNativeDriver: false,
36
+ }).start()
37
+ }, [isHovered, hoverAnim])
38
+
39
+ return (
40
+ <Pressable
41
+ onHoverIn={() => setIsHovered(true)}
42
+ onHoverOut={() => setIsHovered(false)}
43
+ onPress={onPress}
44
+ style={styles.button}
45
+ disabled={disabled}
46
+ accessibilityState={{ disabled }}
47
+ accessibilityRole="button"
48
+ >
49
+ <Animated.View
50
+ style={[styles.textWrapper, { backgroundColor, borderColor: backgroundColor }]}
51
+ >
52
+ <Animated.Text numberOfLines={1} style={[styles.text, { color: textColor }]}>
53
+ {message}
54
+ </Animated.Text>
55
+ <ArrowRightIcon color={isHovered ? COLORS.NEUTRAL_1 : COLORS.NEUTRAL_10} />
56
+ </Animated.View>
57
+ </Pressable>
58
+ )
59
+ }
60
+
61
+ const styles = StyleSheet.create({
62
+ button: {
63
+ flexDirection: 'row',
64
+ alignItems: 'center',
65
+ justifyContent: 'space-between',
66
+ width: '100%',
67
+ },
68
+ text: {
69
+ fontSize: 20,
70
+ fontWeight: 400,
71
+ fontFamily: FONT_FAMILY.buenosAires,
72
+ color: COLORS.NEUTRAL_10,
73
+ },
74
+ textWrapper: {
75
+ flex: 1,
76
+ flexDirection: 'row',
77
+ alignItems: 'center',
78
+ justifyContent: 'space-between',
79
+ maxWidth: 305,
80
+ paddingHorizontal: SPACING[400],
81
+ paddingVertical: SPACING[200],
82
+ borderWidth: 1,
83
+ borderRadius: 48,
84
+ elevation: 3,
85
+ shadowColor: '#333',
86
+ shadowOffset: { width: 0, height: 1 },
87
+ shadowOpacity: 0.25,
88
+ shadowRadius: 3,
89
+ backgroundColor: COLORS.NEUTRAL_1,
90
+ },
91
+ })
@@ -6,7 +6,6 @@ import { ChatbotIcon } from '../../../../shared/icons/ChatbotIcon'
6
6
  import { ThreeDotsLoader } from '../ThreeDotsLoader/ThreeDotsLoader'
7
7
  import { CONTROLS_COLORS_MAP } from '../../constants'
8
8
  import { ColorScheme } from '../../types/style.types'
9
- import { LavaIconInGlasses } from '@magmamath/students-features'
10
9
 
11
10
  type MessageLoaderProps = {
12
11
  colorScheme?: ColorScheme
@@ -15,7 +14,7 @@ type MessageLoaderProps = {
15
14
  export const MessageLoader = ({ colorScheme = ColorScheme.Blue }: MessageLoaderProps) => (
16
15
  <View style={styles.container}>
17
16
  <View style={styles.icon}>
18
- <LavaIconInGlasses width={60} height={80} />
17
+ <ChatbotIcon width={60} height={80} />
19
18
  </View>
20
19
  <View style={styles.loader}>
21
20
  <ThreeDotsLoader backgroundColor={CONTROLS_COLORS_MAP[colorScheme].background} />
@@ -28,13 +27,10 @@ const styles = StyleSheet.create({
28
27
  flexDirection: 'row',
29
28
  width: 327,
30
29
  alignItems: 'flex-end',
31
- paddingLeft:70
32
30
  },
33
31
  icon: {
34
- position: 'absolute',
35
- zIndex:1,
36
32
  alignSelf: 'flex-end',
37
- left: 0
33
+ marginRight: 8,
38
34
  },
39
35
  loader: {
40
36
  flex: 1,
@@ -5,16 +5,14 @@ import { useStoreMap, useUnit } from 'effector-react'
5
5
  import { ChatbotModel } from '../../model/ChatBotModel'
6
6
  import { ChatMessage } from '../ChatMessage/ChatMessage'
7
7
  import { MessageLoader } from '../ChatMessage/MessageLoader'
8
- import { ChatInput } from '../ChatInput/ChatInput'
8
+ import { Alternatives } from '../Alternatives/Alternatives'
9
9
  import { MessageVariant } from '../../types/model.types'
10
10
  import { ColorScheme } from '../../types/style.types'
11
- import { ChatInputMode } from '../../types/units.types'
12
11
 
13
12
  type ChatbotMessagesProps = {
14
13
  model: ChatbotModel
15
14
  isHintFeedback: boolean
16
15
  isTextToSpeechEnabled: boolean
17
- inputMode: ChatInputMode
18
16
  colorScheme?: ColorScheme
19
17
  }
20
18
 
@@ -24,11 +22,10 @@ const BOTTOM_OFFSET = Platform.select({
24
22
  default: 294,
25
23
  })
26
24
 
27
- export const Chat = ({
25
+ export const ChatbotMessages = ({
28
26
  model,
29
27
  isHintFeedback,
30
28
  isTextToSpeechEnabled,
31
- inputMode,
32
29
  colorScheme = ColorScheme.Blue,
33
30
  }: ChatbotMessagesProps) => {
34
31
  const dimensions = useWindowDimensions()
@@ -48,8 +45,8 @@ export const Chat = ({
48
45
 
49
46
  const MAX_HEIGHT = dimensions.height - TOOLBAR_HEIGHT - BOTTOM_OFFSET
50
47
 
51
- const askChatForHelp = (message: string, translatedMessage?: string, isFreeText?: boolean) => {
52
- void model.sendHelpRequestFx({ message, translatedMessage, isFreeText })
48
+ const askChatForHelp = (message: string, translatedMessage?: string) => {
49
+ void model.sendHelpRequestFx({ message, translatedMessage })
53
50
  }
54
51
 
55
52
  return (
@@ -91,13 +88,12 @@ export const Chat = ({
91
88
  </View>
92
89
  )}
93
90
 
94
- {isOpen && (
95
- <ChatInput
91
+ {!isHelpRequestPending && isOpen && (
92
+ <Alternatives
96
93
  onPressAlternative={askChatForHelp}
97
94
  hasMessages={messages.length > 1}
98
95
  isHintFeedback={isHintFeedback}
99
96
  colorScheme={colorScheme}
100
- inputMode={inputMode}
101
97
  />
102
98
  )}
103
99
  </ScrollView>
@@ -2,13 +2,11 @@ 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 { Chat } from './Chat/Chat'
5
+ import { ChatbotMessages } from './ChatMessages/ChatbotMessages'
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'
11
- import { IS_MOBILE } from '@magmamath/react-native-ui'
12
10
 
13
11
  type ChatbotProps = {
14
12
  model: ChatbotModel
@@ -18,7 +16,6 @@ type ChatbotProps = {
18
16
  voice: typeof DEFAULT_VOICE
19
17
  audioConfig: typeof AUDIO_CONFIG
20
18
  }
21
- inputMode?: ChatInputMode
22
19
  ButtonWrapper: ComponentType<PropsWithChildren>
23
20
  iconSize?: { width: number; height: number } // TODO: use number instead
24
21
  colorScheme?: ColorScheme
@@ -46,12 +43,11 @@ export const Chatbot = ({
46
43
 
47
44
  return (
48
45
  <ChatBotModelContext.Provider value={model}>
49
- <Chat
46
+ <ChatbotMessages
50
47
  model={model}
51
48
  colorScheme={colorScheme}
52
49
  isHintFeedback={isHintFeedback}
53
50
  isTextToSpeechEnabled={isTextToSpeechEnabled}
54
- inputMode={alternatives?.isOpenChatEnabled ? ChatInputMode.FreeText : ChatInputMode.Option}
55
51
  />
56
52
 
57
53
  <ChatControls
@@ -2,7 +2,6 @@ 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'
6
5
 
7
6
  export const AUDIO_CONFIG = {
8
7
  audioEncoding: 'LINEAR16',
@@ -45,24 +44,20 @@ export const MESSAGE_COLORS_MAP = {
45
44
  [ColorScheme.Blue]: {
46
45
  [MessageVariant.RECEIVED]: {
47
46
  background: COLORS.NEUTRAL_3,
48
- border: COLORS.NEUTRAL_3,
49
47
  icon: ButtonColor.BLUE,
50
48
  },
51
49
  [MessageVariant.SENT]: {
52
50
  background: COLORS.PRIMARY_BLUE,
53
- border: COLORS.PRIMARY_BLUE,
54
51
  icon: ButtonColor.BLUE,
55
52
  },
56
53
  },
57
54
  [ColorScheme.Yellow]: {
58
55
  [MessageVariant.RECEIVED]: {
59
56
  background: COLORS.NEUTRAL_3,
60
- border: COLORS.NEUTRAL_3,
61
57
  icon: ButtonColor.YELLOW,
62
58
  },
63
59
  [MessageVariant.SENT]: {
64
60
  background: COLORS.PRIMARY_YELLOW,
65
- border: COLORS.PRIMARY_YELLOW,
66
61
  icon: ButtonColor.YELLOW,
67
62
  },
68
63
  },
@@ -78,5 +73,3 @@ export const CONTROLS_COLORS_MAP = {
78
73
  background: COLORS.PRIMARY_YELLOW,
79
74
  },
80
75
  }
81
-
82
- export const HOVER_ANIMATION_DURATION = 200
@@ -9,7 +9,5 @@ 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
-
14
12
  export type { ConversationMessage } from './types/units.types'
15
13
  export { ColorScheme } from './types/style.types'
@@ -5,7 +5,6 @@ import {
5
5
  IChatDrawBoardAdapter,
6
6
  SendHelpParams,
7
7
  SendHelpProps,
8
- SendMessageProps,
9
8
  SetHintMessageProps,
10
9
  StartConversationFxData,
11
10
  StartConversationProps,
@@ -53,13 +52,6 @@ export class ChatbotModel {
53
52
  readonly toggleOpen = createEvent()
54
53
  readonly $isOpen = restore(this.setIsOpen, false).on(this.toggleOpen, (isOpen) => !isOpen)
55
54
 
56
- readonly setIsTextInputFocused = createEvent<boolean>()
57
- readonly $isTextInputFocused = restore(this.setIsTextInputFocused, false).reset(
58
- this.resetAlternatives,
59
- )
60
- readonly setTextInputValue = createEvent<string>()
61
- readonly $textInputValue = restore(this.setTextInputValue, '').reset(this.resetAlternatives)
62
-
63
55
  public readonly removeLastMessage = createEvent()
64
56
  private readonly setLastMessageKey = createEvent<string>()
65
57
  public readonly $lastMessageKey = restore(this.setLastMessageKey, null)
@@ -80,7 +72,7 @@ export class ChatbotModel {
80
72
  constructor({ api, $key, threadMessagesLimit, settings = {} }: ChatbotModelProps) {
81
73
  this.api = new ChatbotAPI({ ...api, postMessage: this.threadManager.postMessage })
82
74
 
83
- this.threadManager.setApi({ getHint: api.requestHint, sendMessage: api.sendMessage })
75
+ this.threadManager.setApi({ getHint: api.requestHint })
84
76
  if (threadMessagesLimit) {
85
77
  this.threadManager.setMessagesLimit(threadMessagesLimit)
86
78
  }
@@ -170,42 +162,34 @@ export class ChatbotModel {
170
162
  mapParams: (params: SendHelpParams, [key, context]) => ({
171
163
  message: params.message,
172
164
  translatedMessage: params.translatedMessage,
173
- isFreeText: params.isFreeText,
174
165
  context,
175
166
  key,
176
167
  }),
177
- effect: createEffect(
178
- async ({ message, translatedMessage, key, context, isFreeText }: SendHelpProps) => {
179
- if (!context) throw new Error('Trying to send message in chat without context')
180
- this.setLastMessageKey(key)
181
- this.cache.addMessages(key, {
182
- messages: [messagesHelper.createOwn({ message, translatedMessage })],
183
- })
184
-
185
- const response = await this.api.postMessageFx({
186
- problem: context.problem,
187
- language: context.language,
188
- problemAnswer: context.problemAnswer,
189
- answer: context.answer,
190
- imageAltText: context.imageDescription,
191
- message: isFreeText ? message : undefined,
192
- })
193
-
194
- const thread = this.threadManager.get(key)
195
- const messages = [
196
- messagesHelper.createAnswer(response, { isInitial: thread?.history.length === 1 }),
197
- ]
198
- if (response.endMessage) {
199
- messages.push(messagesHelper.createLast(this.defaultMessages.endMessage))
200
- }
201
- const translatedMessages = await this.translation.applyTranslationFx(messages)
202
-
203
- this.cache.addMessages(key, {
204
- messages: translatedMessages,
205
- thread,
206
- })
207
- },
208
- ),
168
+ effect: createEffect(async ({ message, translatedMessage, key, context }: SendHelpProps) => {
169
+ if (!context) throw new Error('Trying to send message in chat without context')
170
+ this.setLastMessageKey(key)
171
+ this.cache.addMessages(key, {
172
+ messages: [messagesHelper.createOwn({ message, translatedMessage })],
173
+ })
174
+
175
+ const response = await this.api.postMessageFx({
176
+ problem: context.problem,
177
+ language: context.language,
178
+ problemAnswer: context.problemAnswer,
179
+ answer: context.answer,
180
+ imageAltText: context.imageDescription,
181
+ })
182
+ const thread = this.threadManager.get(key)
183
+ const messages = [
184
+ messagesHelper.createAnswer(response, { isInitial: thread?.history.length === 1 }),
185
+ ]
186
+ if (response.endMessage) {
187
+ messages.push(messagesHelper.createLast(this.defaultMessages.endMessage))
188
+ }
189
+ const translatedMessages = await this.translation.applyTranslationFx(messages)
190
+
191
+ this.cache.addMessages(key, { messages: translatedMessages, thread })
192
+ }),
209
193
  })
210
194
 
211
195
  sample({
@@ -289,8 +273,6 @@ export class ChatbotModel {
289
273
  this.api.postMessageFx.controller.abort()
290
274
  this.removeLastMessage()
291
275
  }
292
- this.setIsTextInputFocused(false)
293
- this.setTextInputValue('')
294
276
  this.errorSpotting.abortPendingRequest()
295
277
 
296
278
  this.t2s.stop()
@@ -5,17 +5,11 @@ import {
5
5
  PostMessagePayload,
6
6
  PostMessageResponse,
7
7
  } from '../types/api.types'
8
- import {
9
- ChatbotMessages,
10
- IChatDrawBoardAdapter,
11
- SendMessagePayload,
12
- SendMessageResponse,
13
- } from '../types/model.types'
8
+ import { ChatbotMessages, IChatDrawBoardAdapter } from '../types/model.types'
14
9
  import { CHAT_BOT_MODEL_DEFAULTS } from './constants'
15
10
 
16
11
  type ThreadManagerApi = {
17
12
  getHint: (props: ChatHintPayload) => Promise<ChatHintResponse>
18
- sendMessage: (props: SendMessagePayload) => Promise<SendMessageResponse>
19
13
  }
20
14
 
21
15
  type ChatBotThreadManagerProps = {
@@ -32,7 +26,6 @@ export class ChatBotThreadManager {
32
26
 
33
27
  private messagesLimit
34
28
  private currentKey = ''
35
- private currentConversationId: null | string = null
36
29
 
37
30
  private readonly defaultMessages
38
31
 
@@ -76,7 +69,6 @@ export class ChatBotThreadManager {
76
69
  answer,
77
70
  language,
78
71
  imageAltText,
79
- message,
80
72
  }: PostMessagePayload): Promise<PostMessageResponse> => {
81
73
  if (!this.api) {
82
74
  throw new Error(
@@ -85,28 +77,14 @@ export class ChatBotThreadManager {
85
77
  }
86
78
  const threadItem = await this.getThreadItem()
87
79
 
88
- let result = {} as ChatHintResponse | SendMessageResponse
89
-
90
- if (message) {
91
- result = await this.api.sendMessage({
92
- problemDescription: problem,
93
- correctAnswer: problemAnswer[0] ?? '', // temporal fix
94
- language,
95
- message,
96
- conversationId: this.currentConversationId ?? '',
97
- })
98
- //@ts-ignore
99
- this.conversationId = result?.conversationId ?? null
100
- } else {
101
- result = await this.api.getHint({
102
- ...threadItem.getNextHintProps(),
103
- correctAnswer: problemAnswer,
104
- problemDescription: problem,
105
- userAnswer: answer,
106
- language,
107
- imageAltText,
108
- })
109
- }
80
+ const result = await this.api.getHint({
81
+ ...threadItem.getNextHintProps(),
82
+ correctAnswer: problemAnswer,
83
+ problemDescription: problem,
84
+ userAnswer: answer,
85
+ language,
86
+ imageAltText,
87
+ })
110
88
 
111
89
  threadItem.history.push(result.message)
112
90
  const nextOptions =
@@ -117,8 +95,6 @@ export class ChatBotThreadManager {
117
95
  options: nextOptions,
118
96
  endMessage: !nextOptions.length,
119
97
  threadId: threadItem.id,
120
- //@ts-ignore
121
- conversationId: result?.conversationId ?? null,
122
98
  }
123
99
  }
124
100
 
@@ -128,7 +104,6 @@ export class ChatBotThreadManager {
128
104
 
129
105
  public reset(key?: string) {
130
106
  if (typeof key === 'string') {
131
- this.currentConversationId = null
132
107
  this.threads.delete(key)
133
108
  return
134
109
  }
@@ -147,8 +122,4 @@ export class ChatBotThreadManager {
147
122
  public setCurrentKey(key: string) {
148
123
  this.currentKey = key
149
124
  }
150
-
151
- public setCurrentConversationId(id: string) {
152
- this.currentConversationId = id
153
- }
154
125
  }
@@ -9,12 +9,10 @@ export class ChatbotAPI {
9
9
  public readonly getAlternativesFx
10
10
  public readonly translateTextFx
11
11
  public readonly textToSpeechTextFx
12
- // public readonly sendMessageFx
13
12
 
14
13
  public readonly spotErrorFx
15
14
 
16
15
  constructor(api: ChatbotApiRequests) {
17
- // this.sendMessageFx = createControllerEffect(api.sendMessage)
18
16
  this.spotErrorFx = createControllerEffect(api.spotError)
19
17
  this.postMessageFx = createControllerEffect(api.postMessage)
20
18
  this.getAlternativesFx = createEffect(api.getAlternatives)
@@ -5,16 +5,12 @@ export type GetAlternativesPayload = {
5
5
  assignmentClassGrade: number
6
6
  } | null
7
7
 
8
- export type AlternativesOptions = {
9
- default: ChatAnswer[]
10
- hints: ChatAnswer[]
11
- }
12
-
13
8
  export type GetAlternativesResponse = {
14
9
  chatAccess?: boolean
15
- isOpenChatEnabled?: boolean
16
- version: string
17
- options: AlternativesOptions
10
+ options: {
11
+ default: ChatAnswer[]
12
+ hints: ChatAnswer[]
13
+ }
18
14
  }
19
15
 
20
16
  export type PostMessagePayload = {
@@ -23,8 +19,6 @@ export type PostMessagePayload = {
23
19
  answer?: string | string[]
24
20
  problem: string
25
21
  imageAltText?: string
26
- customText?: string
27
- message?: string
28
22
  }
29
23
 
30
24
  export type PostMessageResponse = {
@@ -25,7 +25,6 @@ export type ChatbotMessages = {
25
25
 
26
26
  export type ChatbotApiRequests = {
27
27
  getAlternatives: (props: GetAlternativesPayload) => Promise<GetAlternativesResponse>
28
- sendMessage: (props: SendMessagePayload) => Promise<SendMessageResponse>
29
28
  postMessage: (props: PostMessagePayload) => Promise<PostMessageResponse>
30
29
  postTranslateText: (props: GoogleTranslatePayload) => Promise<GoogleTranslateResponse>
31
30
  postTextToSpeech: (props: GoogleText2SpeechPayload) => Promise<GoogleText2SpeechResponse>
@@ -48,34 +47,11 @@ export type ChatbotModelProps = {
48
47
  export type SendHelpParams = {
49
48
  message: string
50
49
  translatedMessage?: string
51
- isFreeText?: boolean
52
50
  }
53
51
 
54
52
  export type SendHelpProps = SendHelpParams & {
55
53
  key: string
56
54
  context: ChatbotContext | null
57
- isFreeText?: boolean
58
- }
59
-
60
- export type SendMessageProps = SendHelpParams & {
61
- key: string
62
- context: ChatbotContext | null
63
- conversationId?: string
64
- message: string
65
- }
66
-
67
-
68
- export type SendMessagePayload = {
69
- problemDescription: string
70
- correctAnswer: string | string[]
71
- language: string
72
- message: string
73
- conversationId?: string
74
- }
75
-
76
- export type SendMessageResponse = {
77
- message: string
78
- conversationId: string
79
55
  }
80
56
 
81
57
  export type SetHintMessageProps = {
@@ -132,6 +108,3 @@ export type ChatbotContext = {
132
108
  translationTargetLanguage: string
133
109
  imageDescription?: string
134
110
  }
135
-
136
-
137
-