@magmamath/students-features 0.6.14-rc.9 → 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 -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 +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 +1 -1
  36. package/dist/commonjs/shared/translation/localization/en.json +1 -1
  37. package/dist/commonjs/shared/translation/localization/gb.json +1 -1
  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 -37
  55. package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
  56. package/dist/module/features/chatbot/model/ChatBotThreadManager.js +10 -31
  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 +1 -1
  75. package/dist/module/shared/translation/localization/en.json +1 -1
  76. package/dist/module/shared/translation/localization/gb.json +1 -1
  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 +1 -5
  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 -21
  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 +1 -10
  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 +1 -5
  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 -21
  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 +1 -10
  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 +27 -71
  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 -24
  159. package/src/features/chatbot/types/model.types.ts +0 -15
  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 +1 -1
  169. package/src/shared/translation/localization/en.json +1 -1
  170. package/src/shared/translation/localization/gb.json +1 -1
  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,11 +0,0 @@
1
- import React from 'react';
2
- import { ColorScheme } from '../../../types/style.types';
3
- type FreeTextInputAreaProps = {
4
- onPress: () => void;
5
- message: string;
6
- disabled: boolean;
7
- colorScheme?: ColorScheme;
8
- };
9
- export declare const FreeTextInputBlock: ({ onPress, message, disabled, colorScheme, }: FreeTextInputAreaProps) => React.JSX.Element;
10
- export {};
11
- //# sourceMappingURL=FreeTextInputBlock.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FreeTextInputBlock.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/chatbot/components/ChatInput/freeText/FreeTextInputBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAIxD,KAAK,sBAAsB,GAAG;IAC5B,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,kBAAkB,iDAK5B,sBAAsB,sBAaxB,CAAA"}
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import { ColorScheme } from '@magmamath/students-features';
3
- type HelpRequestOptionProps = {
4
- onPress: () => void;
5
- disabled: boolean;
6
- colorScheme?: ColorScheme;
7
- };
8
- export declare const SendMessageButton: ({ onPress, disabled, colorScheme, }: HelpRequestOptionProps) => React.JSX.Element;
9
- export {};
10
- //# sourceMappingURL=SendMessageButton.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SendMessageButton.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/chatbot/components/ChatInput/freeText/SendMessageButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AASzB,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAG1D,KAAK,sBAAsB,GAAG;IAC5B,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,iBAAiB,wCAI3B,sBAAsB,sBAwDxB,CAAA"}
@@ -1,56 +0,0 @@
1
- import React, { ComponentType } from 'react'
2
- import { useStoreMap, useUnit } from 'effector-react'
3
-
4
- import { useChatModel } from '../../context/ChatBotModelContext'
5
- import { ColorScheme } from '../../types/style.types'
6
- import { ChatInputAreaProps, ChatInputMode, ChatInputProps } from '../../types/units.types'
7
- import { InputOption } from './InputOption'
8
- import { InputOptionWithTextArea } from './InputOptionWithTextArea'
9
-
10
- const chatInputVariant: Record<ChatInputMode, ComponentType<ChatInputProps>> = {
11
- [ChatInputMode.Option]: InputOption,
12
- [ChatInputMode.FreeText]: InputOptionWithTextArea,
13
- }
14
-
15
- export const ChatInput = ({
16
- onPressAlternative,
17
- hasMessages,
18
- isHintFeedback,
19
- inputMode,
20
- colorScheme = ColorScheme.Blue,
21
- }: ChatInputAreaProps) => {
22
- const model = useChatModel()
23
- const isTranslated = useUnit(model.translation.$isTranslated)
24
- const alternatives = useUnit(model.$alternatives)
25
- const isTranslationPending = useUnit(model.translation.translateAllMessagesFx.pending)
26
- const isHelpRequestPending = useUnit(model.sendHelpRequestFx.pending)
27
-
28
- const lastMessageOptions = useStoreMap(model.$currentChatData, ({ messages }) => {
29
- const lastMessage = messages.at(-1)
30
- return lastMessage?.options ?? []
31
- })
32
-
33
- const availableOption = (() => {
34
- if (hasMessages && lastMessageOptions.length) return lastMessageOptions[0]
35
- if (isHintFeedback && alternatives?.options.hints) return alternatives?.options.hints[0]
36
- return alternatives?.options.default[0] ?? null
37
- })()
38
-
39
- const buttonLabel =
40
- (isTranslated && !isTranslationPending
41
- ? availableOption?.translatedText
42
- : availableOption?.text) ?? ''
43
-
44
- const Component = chatInputVariant[inputMode]
45
-
46
- return (
47
- availableOption?.text && (
48
- <Component
49
- message={buttonLabel}
50
- onPress={() => onPressAlternative(availableOption.text, availableOption.translatedText)}
51
- disabled={isHelpRequestPending || (hasMessages && lastMessageOptions.length === 0)}
52
- colorScheme={colorScheme}
53
- />
54
- )
55
- )
56
- }
@@ -1,29 +0,0 @@
1
- import { StyleSheet, View } from 'react-native'
2
- import React from 'react'
3
- import { ChatInputProps } from '../../types/units.types'
4
- import { OptionButtonVariant } from './RequestHintButton'
5
- import { RequestHintButton } from './RequestHintButton'
6
-
7
- export const InputOption = ({ message, onPress, colorScheme, disabled }: ChatInputProps) => {
8
- return (
9
- <View style={styles.container}>
10
- <RequestHintButton
11
- onPress={onPress}
12
- message={message}
13
- disabled={disabled}
14
- colorScheme={colorScheme}
15
- variant={OptionButtonVariant.Default}
16
- />
17
- </View>
18
- )
19
- }
20
-
21
- const styles = StyleSheet.create({
22
- container: {
23
- flex: 1,
24
- width: 305,
25
- alignItems: 'center',
26
- justifyContent: 'center',
27
- marginVertical: 8,
28
- },
29
- })
@@ -1,27 +0,0 @@
1
- import { StyleSheet, View } from 'react-native'
2
- import React from 'react'
3
- import { ChatInputProps } from '../../types/units.types'
4
- import { FreeTextInputBlock } from './freeText/FreeTextInputBlock'
5
-
6
- export const InputOptionWithTextArea = ({ message, disabled, onPress, colorScheme }: ChatInputProps) => {
7
- return (
8
- <View style={styles.container}>
9
- <FreeTextInputBlock
10
- message={message}
11
- onPress={onPress}
12
- disabled={disabled}
13
- colorScheme={colorScheme}
14
- />
15
- </View>
16
- )
17
- }
18
-
19
- const styles = StyleSheet.create({
20
- container: {
21
- flex: 1,
22
- width: 305,
23
- alignItems: 'center',
24
- justifyContent: 'center',
25
- marginVertical: 8,
26
- },
27
- })
@@ -1,160 +0,0 @@
1
- import { Pressable, StyleSheet } from 'react-native'
2
- import React from 'react'
3
- import Animated, {
4
- useSharedValue,
5
- withTiming,
6
- useAnimatedStyle,
7
- interpolateColor,
8
- SharedValue,
9
- } from 'react-native-reanimated'
10
- import {
11
- ArrowRightIcon,
12
- ArrowUpIcon,
13
- COLORS,
14
- FONT_FAMILY,
15
- IS_MOBILE,
16
- SPACING,
17
- } from '@magmamath/react-native-ui'
18
- import { ColorScheme } from '@magmamath/students-features'
19
- import { MESSAGE_COLORS_MAP } from '../../constants'
20
-
21
-
22
- type HelpRequestOptionProps = {
23
- onPress: () => void
24
- message: string
25
- disabled: boolean
26
- variant: OptionButtonVariant
27
- colorScheme?: ColorScheme
28
- visibleSv?: SharedValue<number>
29
- }
30
-
31
- export enum OptionButtonVariant {
32
- Default = 'default',
33
- Short = 'short',
34
- }
35
-
36
- const REQUEST_HINT_BUTTON = {
37
- [OptionButtonVariant.Default]: {
38
- WIDTH: 305,
39
- FONT_SIZE: 20,
40
- },
41
- [OptionButtonVariant.Short]: { WIDTH: 163, FONT_SIZE: 18 },
42
- }
43
-
44
- export const RequestHintButton = ({
45
- onPress,
46
- message,
47
- disabled = false,
48
- colorScheme = ColorScheme.Blue,
49
- variant = OptionButtonVariant.Default,
50
- }: HelpRequestOptionProps) => {
51
- const hoverSv = useSharedValue(0)
52
-
53
- const onHoverIn = () => {
54
- if (!disabled) hoverSv.value = withTiming(1, { duration: 200 })
55
- }
56
- const onHoverOut = () => {
57
- if (!disabled) hoverSv.value = withTiming(0, { duration: 200 })
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 === OptionButtonVariant.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 { color: interpolateColor(hoverSv.value, [0, 1], [COLORS.NEUTRAL_10, COLORS.NEUTRAL_1]) }
91
- }, [hoverSv, disabled])
92
-
93
- return (
94
- <Pressable
95
- onHoverIn={onHoverIn}
96
- onHoverOut={onHoverOut}
97
- onPress={onPress}
98
- style={[
99
- styles.button,
100
- { cursor: disabled ? 'auto' : 'pointer', width: REQUEST_HINT_BUTTON[variant].WIDTH },
101
- ]}
102
- disabled={disabled}
103
- accessibilityState={{ disabled }}
104
- accessibilityRole="button"
105
- >
106
- <Animated.View style={[styles.content, animatedTextContainerStyle]}>
107
- <Animated.Text
108
- numberOfLines={1}
109
- style={[
110
- styles.text,
111
- animatedTextStyle,
112
- { fontSize: REQUEST_HINT_BUTTON[variant].FONT_SIZE },
113
- ]}
114
- >
115
- {message}
116
- </Animated.Text>
117
-
118
- <Animated.Text style={[styles.icon, animatedTextStyle]}>
119
- {variant === OptionButtonVariant.Default ? (
120
- <ArrowRightIcon color={disabled ? COLORS.NEUTRAL_5 : 'currentColor'} size={16} />
121
- ) : (
122
- <ArrowUpIcon color={disabled ? COLORS.NEUTRAL_5 : 'currentColor'} size={16} />
123
- )}
124
- </Animated.Text>
125
- </Animated.View>
126
- </Pressable>
127
- )
128
- }
129
-
130
- const styles = StyleSheet.create({
131
- button: {
132
- flexDirection: 'row',
133
- justifyContent: 'flex-end',
134
- },
135
- text: {
136
- fontWeight: '400',
137
- fontFamily: FONT_FAMILY.buenosAires,
138
- color: COLORS.NEUTRAL_10,
139
- },
140
- content: {
141
- flex: 1,
142
- flexDirection: 'row',
143
- alignItems: 'center',
144
- justifyContent: 'space-between',
145
- paddingHorizontal: SPACING[400],
146
- paddingVertical: SPACING[200],
147
- borderWidth: 1,
148
- borderRadius: 48,
149
- elevation: 3,
150
- shadowColor: '#333',
151
- shadowOffset: { width: 0, height: 1 },
152
- shadowOpacity: 0.25,
153
- shadowRadius: 3,
154
- backgroundColor: COLORS.PRIMARY_BLUE,
155
- borderColor: COLORS.PRIMARY_BLUE,
156
- },
157
- icon: {
158
- top: IS_MOBILE ? 3 : 0,
159
- },
160
- })
@@ -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
- })