@magmamath/students-features 0.6.17 → 0.7.0-rc.1

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 (71) hide show
  1. package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.js +18 -54
  2. package/dist/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.js.map +1 -1
  3. package/dist/commonjs/features/chatbot/model/ChatBotModel.js +1 -3
  4. package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -1
  5. package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js +3 -0
  6. package/dist/commonjs/features/chatbot/model/ChatBotThreadManager.js.map +1 -1
  7. package/dist/commonjs/features/chatbot/model/ChatbotApi.js +1 -0
  8. package/dist/commonjs/features/chatbot/model/ChatbotApi.js.map +1 -1
  9. package/dist/commonjs/features/chatbot/model/ThreadItem.js +6 -7
  10. package/dist/commonjs/features/chatbot/model/ThreadItem.js.map +1 -1
  11. package/dist/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.js +3 -7
  12. package/dist/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.js.map +1 -1
  13. package/dist/commonjs/features/exampleSolution/components/SolutionSection.js +1 -7
  14. package/dist/commonjs/features/exampleSolution/components/SolutionSection.js.map +1 -1
  15. package/dist/commonjs/features/formulaSheet/components/FormulaSheet.js +5 -9
  16. package/dist/commonjs/features/formulaSheet/components/FormulaSheet.js.map +1 -1
  17. package/dist/module/features/chatbot/errorSpotting/ErrorSpottingModel.js +19 -55
  18. package/dist/module/features/chatbot/errorSpotting/ErrorSpottingModel.js.map +1 -1
  19. package/dist/module/features/chatbot/model/ChatBotModel.js +1 -3
  20. package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
  21. package/dist/module/features/chatbot/model/ChatBotThreadManager.js +3 -0
  22. package/dist/module/features/chatbot/model/ChatBotThreadManager.js.map +1 -1
  23. package/dist/module/features/chatbot/model/ChatbotApi.js +1 -0
  24. package/dist/module/features/chatbot/model/ChatbotApi.js.map +1 -1
  25. package/dist/module/features/chatbot/model/ThreadItem.js +6 -7
  26. package/dist/module/features/chatbot/model/ThreadItem.js.map +1 -1
  27. package/dist/module/features/exampleSolution/components/ExampleSolutionModalContent.js +4 -8
  28. package/dist/module/features/exampleSolution/components/ExampleSolutionModalContent.js.map +1 -1
  29. package/dist/module/features/exampleSolution/components/SolutionSection.js +2 -8
  30. package/dist/module/features/exampleSolution/components/SolutionSection.js.map +1 -1
  31. package/dist/module/features/formulaSheet/components/FormulaSheet.js +5 -9
  32. package/dist/module/features/formulaSheet/components/FormulaSheet.js.map +1 -1
  33. package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts +1 -4
  34. package/dist/typescript/commonjs/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts.map +1 -1
  35. package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
  36. package/dist/typescript/commonjs/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -1
  37. package/dist/typescript/commonjs/features/chatbot/model/ChatbotApi.d.ts.map +1 -1
  38. package/dist/typescript/commonjs/features/chatbot/model/ThreadItem.d.ts +3 -4
  39. package/dist/typescript/commonjs/features/chatbot/model/ThreadItem.d.ts.map +1 -1
  40. package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts +1 -0
  41. package/dist/typescript/commonjs/features/chatbot/types/api.types.d.ts.map +1 -1
  42. package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts +1 -0
  43. package/dist/typescript/commonjs/features/chatbot/types/units.types.d.ts.map +1 -1
  44. package/dist/typescript/commonjs/features/exampleSolution/components/ExampleSolutionModalContent.d.ts.map +1 -1
  45. package/dist/typescript/commonjs/features/exampleSolution/components/SolutionSection.d.ts.map +1 -1
  46. package/dist/typescript/commonjs/features/formulaSheet/components/FormulaSheet.d.ts.map +1 -1
  47. package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts +1 -4
  48. package/dist/typescript/module/features/chatbot/errorSpotting/ErrorSpottingModel.d.ts.map +1 -1
  49. package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
  50. package/dist/typescript/module/features/chatbot/model/ChatBotThreadManager.d.ts.map +1 -1
  51. package/dist/typescript/module/features/chatbot/model/ChatbotApi.d.ts.map +1 -1
  52. package/dist/typescript/module/features/chatbot/model/ThreadItem.d.ts +3 -4
  53. package/dist/typescript/module/features/chatbot/model/ThreadItem.d.ts.map +1 -1
  54. package/dist/typescript/module/features/chatbot/types/api.types.d.ts +1 -0
  55. package/dist/typescript/module/features/chatbot/types/api.types.d.ts.map +1 -1
  56. package/dist/typescript/module/features/chatbot/types/units.types.d.ts +1 -0
  57. package/dist/typescript/module/features/chatbot/types/units.types.d.ts.map +1 -1
  58. package/dist/typescript/module/features/exampleSolution/components/ExampleSolutionModalContent.d.ts.map +1 -1
  59. package/dist/typescript/module/features/exampleSolution/components/SolutionSection.d.ts.map +1 -1
  60. package/dist/typescript/module/features/formulaSheet/components/FormulaSheet.d.ts.map +1 -1
  61. package/package.json +8 -8
  62. package/src/features/chatbot/errorSpotting/ErrorSpottingModel.ts +16 -57
  63. package/src/features/chatbot/model/ChatBotModel.ts +0 -2
  64. package/src/features/chatbot/model/ChatBotThreadManager.ts +3 -0
  65. package/src/features/chatbot/model/ChatbotApi.ts +1 -0
  66. package/src/features/chatbot/model/ThreadItem.ts +7 -1
  67. package/src/features/chatbot/types/api.types.ts +1 -0
  68. package/src/features/chatbot/types/units.types.ts +1 -0
  69. package/src/features/exampleSolution/components/ExampleSolutionModalContent.tsx +3 -9
  70. package/src/features/exampleSolution/components/SolutionSection.tsx +2 -12
  71. package/src/features/formulaSheet/components/FormulaSheet.tsx +4 -8
@@ -1 +1 @@
1
- {"version":3,"file":"ChatbotApi.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/ChatbotApi.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAGpF,qBAAa,UAAU;IACrB,SAAgB,aAAa,6KAAA;IAC7B,SAAgB,iBAAiB,8IAAA;IACjC,SAAgB,eAAe,oFAAA;IAC/B,SAAgB,kBAAkB,kJAAA;IAElC,SAAgB,WAAW,iLAAA;gBAEf,GAAG,EAAE,kBAAkB;CAyBpC"}
1
+ {"version":3,"file":"ChatbotApi.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/ChatbotApi.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAGpF,qBAAa,UAAU;IACrB,SAAgB,aAAa,6KAAA;IAC7B,SAAgB,iBAAiB,8IAAA;IACjC,SAAgB,eAAe,oFAAA;IAC/B,SAAgB,kBAAkB,kJAAA;IAElC,SAAgB,WAAW,iLAAA;gBAEf,GAAG,EAAE,kBAAkB;CA0BpC"}
@@ -10,10 +10,12 @@ export declare class ThreadItem implements IThreadItem {
10
10
  strokesValidationKey: string | null;
11
11
  strokes: FullStrokeData[] | null;
12
12
  text: string | null;
13
+ errorStrokesIds: string[] | null;
13
14
  constructor(props?: ThreadItemProps | null);
14
15
  setStrokes(strokes: FullStrokeData[]): this;
15
16
  setText(text: string): this;
16
17
  setValidationKey(key: string): this;
18
+ setErrorStrokesIds(ids: string[] | null): this;
17
19
  getNextHintProps(): {
18
20
  previousHint: string;
19
21
  drawBoardText?: undefined;
@@ -23,10 +25,7 @@ export declare class ThreadItem implements IThreadItem {
23
25
  previousHint?: undefined;
24
26
  stroke?: undefined;
25
27
  } | {
26
- stroke: {
27
- x: number[];
28
- y: number[];
29
- }[];
28
+ stroke: FullStrokeData[];
30
29
  previousHint?: undefined;
31
30
  drawBoardText?: undefined;
32
31
  } | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"ThreadItem.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/ThreadItem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAGlE,KAAK,eAAe,GAAG;IACrB,OAAO,CAAC,EAAE,cAAc,EAAE,CAAA;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,qBAAa,UAAW,YAAW,WAAW;IAC5C,SAAgB,EAAE,SAAqB;IACvC,SAAgB,OAAO,EAAE,MAAM,EAAE,CAAK;IAC/B,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAO;IAC1C,OAAO,EAAE,cAAc,EAAE,GAAG,IAAI,CAAA;IAChC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAO;gBAEd,KAAK,CAAC,EAAE,eAAe,GAAG,IAAI;IAM1C,UAAU,CAAC,OAAO,EAAE,cAAc,EAAE;IAKpC,OAAO,CAAC,IAAI,EAAE,MAAM;IAKpB,gBAAgB,CAAC,GAAG,EAAE,MAAM;IAK5B,gBAAgB;;;;;;;;;;;;;;;;CAexB"}
1
+ {"version":3,"file":"ThreadItem.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/model/ThreadItem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAGlE,KAAK,eAAe,GAAG;IACrB,OAAO,CAAC,EAAE,cAAc,EAAE,CAAA;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,qBAAa,UAAW,YAAW,WAAW;IAC5C,SAAgB,EAAE,SAAqB;IACvC,SAAgB,OAAO,EAAE,MAAM,EAAE,CAAK;IAC/B,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAO;IAC1C,OAAO,EAAE,cAAc,EAAE,GAAG,IAAI,CAAA;IAChC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAO;IAC1B,eAAe,EAAE,MAAM,EAAE,GAAG,IAAI,CAAO;gBAE3B,KAAK,CAAC,EAAE,eAAe,GAAG,IAAI;IAM1C,UAAU,CAAC,OAAO,EAAE,cAAc,EAAE;IAKpC,OAAO,CAAC,IAAI,EAAE,MAAM;IAKpB,gBAAgB,CAAC,GAAG,EAAE,MAAM;IAK5B,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI;IAKvC,gBAAgB;;;;;;;;;;;;;CAexB"}
@@ -64,6 +64,7 @@ export type ChatHintPayload = {
64
64
  };
65
65
  export type ChatHintResponse = {
66
66
  message: string;
67
+ errorStrokeIds?: string[];
67
68
  };
68
69
  export type ErrorSpottingPayload = {
69
70
  strokes: FullStrokeData[];
@@ -1 +1 @@
1
- {"version":3,"file":"api.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/api.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAElE,MAAM,MAAM,sBAAsB,GAAG;IACnC,cAAc,EAAE,MAAM,CAAA;IACtB,oBAAoB,EAAE,MAAM,CAAA;CAC7B,GAAG,IAAI,CAAA;AAER,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,OAAO,EAAE;QACP,OAAO,EAAE,UAAU,EAAE,CAAA;QACrB,KAAK,EAAE,UAAU,EAAE,CAAA;KACpB,CAAA;CACF,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;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AAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AACD,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,cAAc,EAAE,CAAA;IACzB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC7B,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AACD,MAAM,MAAM,qBAAqB,GAAG;IAClC,oBAAoB,EAAE,MAAM,EAAE,CAAA;CAC/B,CAAA"}
1
+ {"version":3,"file":"api.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/api.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAElE,MAAM,MAAM,sBAAsB,GAAG;IACnC,cAAc,EAAE,MAAM,CAAA;IACtB,oBAAoB,EAAE,MAAM,CAAA;CAC7B,GAAG,IAAI,CAAA;AAER,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,OAAO,EAAE;QACP,OAAO,EAAE,UAAU,EAAE,CAAA;QACrB,KAAK,EAAE,UAAU,EAAE,CAAA;KACpB,CAAA;CACF,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,QAAQ,EAAE,MAAM,CA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CAAA;IACzB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,aAAa,EAAE,MAAM,EAAE,CAAA;IACvB,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC7B,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AACD,MAAM,MAAM,qBAAqB,GAAG;IAClC,oBAAoB,EAAE,MAAM,EAAE,CAAA;CAC/B,CAAA"}
@@ -10,6 +10,7 @@ export type IThreadItem = {
10
10
  strokesValidationKey: string | null;
11
11
  strokes: FullStrokeData[] | null;
12
12
  history: string[];
13
+ errorStrokesIds: string[] | null;
13
14
  };
14
15
  export type ChatAnswer = {
15
16
  text: string;
@@ -1 +1 @@
1
- {"version":3,"file":"units.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/units.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG;IACnB,CAAC,EAAE,MAAM,EAAE,CAAA;IACX,CAAC,EAAE,MAAM,EAAE,CAAA;CACZ,CAAA;AACD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG;IACpC,EAAE,EAAE,MAAM,CAAA;CACX,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,OAAO,EAAE,cAAc,EAAE,GAAG,IAAI,CAAA;IAChC,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,YAAY,EAAE,OAAO,CAAA;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,EAAE,mBAAmB,EAAE,CAAA;IAC/B,WAAW,EAAE,OAAO,CAAA;IACpB,aAAa,EAAE,WAAW,GAAG,IAAI,CAAA;CAClC,CAAA"}
1
+ {"version":3,"file":"units.types.d.ts","sourceRoot":"","sources":["../../../../../../src/features/chatbot/types/units.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG;IACnB,CAAC,EAAE,MAAM,EAAE,CAAA;IACX,CAAC,EAAE,MAAM,EAAE,CAAA;CACZ,CAAA;AACD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG;IACpC,EAAE,EAAE,MAAM,CAAA;CACX,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,OAAO,EAAE,cAAc,EAAE,GAAG,IAAI,CAAA;IAChC,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,eAAe,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,UAAU,EAAE,CAAA;IACrB,YAAY,EAAE,OAAO,CAAA;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,EAAE,mBAAmB,EAAE,CAAA;IAC/B,WAAW,EAAE,OAAO,CAAA;IACpB,aAAa,EAAE,WAAW,GAAG,IAAI,CAAA;CAClC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ExampleSolutionModalContent.d.ts","sourceRoot":"","sources":["../../../../../../src/features/exampleSolution/components/ExampleSolutionModalContent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAA;AAKrD,KAAK,gCAAgC,GAAG;IACtC,MAAM,EAAE,0BAA0B,CAAA;CACnC,CAAA;AAID,eAAO,MAAM,2BAA2B,8CAErC,gCAAgC,sBA0BlC,CAAA"}
1
+ {"version":3,"file":"ExampleSolutionModalContent.d.ts","sourceRoot":"","sources":["../../../../../../src/features/exampleSolution/components/ExampleSolutionModalContent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAA;AAKrD,KAAK,gCAAgC,GAAG;IACtC,MAAM,EAAE,0BAA0B,CAAA;CACnC,CAAA;AAED,eAAO,MAAM,2BAA2B,8CAErC,gCAAgC,sBAqBlC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"SolutionSection.d.ts","sourceRoot":"","sources":["../../../../../../src/features/exampleSolution/components/SolutionSection.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAGtD,KAAK,oBAAoB,GAAG;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,uBAAuB,CAAA;CAChC,CAAA;AAWD,eAAO,MAAM,eAAe,uBAAwB,oBAAoB,sBAiDvE,CAAA"}
1
+ {"version":3,"file":"SolutionSection.d.ts","sourceRoot":"","sources":["../../../../../../src/features/exampleSolution/components/SolutionSection.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAGtD,KAAK,oBAAoB,GAAG;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,uBAAuB,CAAA;CAChC,CAAA;AAUD,eAAO,MAAM,eAAe,uBAAwB,oBAAoB,sBA+CvE,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"FormulaSheet.d.ts","sourceRoot":"","sources":["../../../../../../src/features/formulaSheet/components/FormulaSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAc,SAAS,EAAa,MAAM,OAAO,CAAA;AAE/D,OAAO,EAEL,WAAW,EACX,UAAU,EAIV,SAAS,EACT,WAAW,EACX,WAAW,EACZ,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAGlD,KAAK,iBAAiB,GAAG;IACvB,KAAK,EAAE,iBAAiB,CAAA;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,SAAS,CAAA;IACzC,UAAU,EAAE,UAAU,CAAA;IACtB,WAAW,EAAE,WAAW,CAAA;IACxB,WAAW,EAAE,WAAW,CAAA;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,KAAK,CAAC,EAAE,WAAW,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,YAAY,4FAsDxB,CAAA"}
1
+ {"version":3,"file":"FormulaSheet.d.ts","sourceRoot":"","sources":["../../../../../../src/features/formulaSheet/components/FormulaSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAc,SAAS,EAAa,MAAM,OAAO,CAAA;AAE/D,OAAO,EAEL,WAAW,EACX,UAAU,EAIV,SAAS,EACT,WAAW,EACX,WAAW,EACZ,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAGlD,KAAK,iBAAiB,GAAG;IACvB,KAAK,EAAE,iBAAiB,CAAA;IACxB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,SAAS,CAAA;IACzC,UAAU,EAAE,UAAU,CAAA;IACtB,WAAW,EAAE,WAAW,CAAA;IACxB,WAAW,EAAE,WAAW,CAAA;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,KAAK,CAAC,EAAE,WAAW,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,YAAY,4FAkDxB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magmamath/students-features",
3
- "version": "0.6.17",
3
+ "version": "0.7.0-rc.1",
4
4
  "description": "Magmamath features library",
5
5
  "source": "src/index.ts",
6
6
  "main": "src/index.ts",
@@ -23,20 +23,20 @@
23
23
  "effector-react": "^23.2.1",
24
24
  "react": "*",
25
25
  "react-native": "*",
26
- "react-native-reanimated": ">=0.3.16",
27
- "react-native-svg": "^15.10.0",
28
26
  "react-native-gesture-handler": "*",
29
- "react-native-modalfy": "*"
27
+ "react-native-modalfy": "*",
28
+ "react-native-reanimated": ">=0.3.16",
29
+ "react-native-svg": "^15.10.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@magmamath/react-native-ui": "0.4.37",
33
- "effector": "^23.2.3",
34
- "effector-react": "^23.2.1",
35
33
  "@react-native/eslint-config": "^0.73.1",
36
34
  "@release-it/conventional-changelog": "^9.0.2",
37
35
  "@types/jest": "^29.5.5",
38
36
  "@types/react": "^18.2.44",
39
37
  "del-cli": "^5.1.0",
38
+ "effector": "^23.2.3",
39
+ "effector-react": "^23.2.1",
40
40
  "eslint": "^8.51.0",
41
41
  "eslint-config-prettier": "^9.0.0",
42
42
  "eslint-plugin-prettier": "^5.0.1",
@@ -45,10 +45,10 @@
45
45
  "react": "18.3.1",
46
46
  "react-native": "0.76.3",
47
47
  "react-native-builder-bob": "^0.33.3",
48
- "react-native-reanimated": "^3.17.2",
49
- "react-native-svg": "^15.10.0",
50
48
  "react-native-gesture-handler": "^2.28.0",
51
49
  "react-native-modalfy": "^3.7.0",
50
+ "react-native-reanimated": "^3.17.2",
51
+ "react-native-svg": "^15.10.0",
52
52
  "release-it": "^17.10.0",
53
53
  "typescript": "^5.2.2"
54
54
  },
@@ -1,12 +1,10 @@
1
1
  import { ChatbotAPI } from '../model/ChatbotApi'
2
- import { createEvent, createStore, sample, createEffect, Store, restore } from 'effector'
2
+ import { createEvent, createStore, sample, Store, restore } from 'effector'
3
3
  import { ChatItem, ConversationMessage } from '../types/units.types'
4
- import { ChatbotContext } from '../types/model.types'
5
4
 
6
5
  type ErrorSpottingProps = {
7
6
  api: ChatbotAPI
8
7
  $currentChatData: Store<ChatItem>
9
- $currentChatContext: Store<ChatbotContext | null>
10
8
  }
11
9
 
12
10
  type ActiveErrorSpottingData = {
@@ -16,13 +14,6 @@ type ActiveErrorSpottingData = {
16
14
  validationKey: null | string
17
15
  }
18
16
 
19
- type ErrorSpottingReducerProps = {
20
- chatData: ChatItem
21
- activeSpotting: ActiveErrorSpottingData | null
22
- message: ConversationMessage
23
- context: ChatbotContext | null
24
- }
25
-
26
17
  const AUTO_CLOSE_TIMEOUT = 5000
27
18
 
28
19
  type ErrorSpottingPressedProps = {
@@ -48,37 +39,34 @@ export class ErrorSpottingModel {
48
39
  .on(this.$validationKey, (state, payload) => {
49
40
  if (!state || payload === null) return state
50
41
  const isDisabled = payload !== state.validationKey
51
- return { ...state, isDisabled, isActive: isDisabled ? false : state.isActive }
42
+ return { ...state, isDisabled, isActive: !isDisabled && state.isActive }
52
43
  })
53
44
 
54
45
  public readonly $isLoading
55
46
 
56
47
  private closeTimeout: NodeJS.Timeout | null = null
57
48
 
58
- public constructor({ api, $currentChatData, $currentChatContext }: ErrorSpottingProps) {
49
+ public constructor({ api, $currentChatData }: ErrorSpottingProps) {
59
50
  this.api = api
60
-
61
51
  this.$isLoading = api.spotErrorFx.pending
62
52
 
63
- this.$activeData.on($currentChatData, (state, payload) => {
64
- if (!state || state.validationKey !== payload.currentThread?.strokesValidationKey) return null
65
- })
66
-
67
53
  sample({
68
- clock: api.spotErrorFx.doneData,
54
+ clock: $currentChatData,
69
55
  source: {
70
- chatData: $currentChatData,
71
56
  activeSpotting: this.$activeData,
72
57
  validationKey: this.$validationKey,
73
58
  },
74
- fn: (source, result) => {
75
- const key = source.chatData.currentThread?.strokesValidationKey || null
59
+ fn: (source, chatData) => {
60
+ if (!chatData.currentThread?.errorStrokesIds?.length) return null
61
+ const key = chatData.currentThread?.strokesValidationKey || null
76
62
  const currentKey = source.validationKey
77
- const isDisabled = !!currentKey && currentKey !== key
63
+ if (!key) return null
64
+ const isDisabled = key !== currentKey
65
+ const isKeyChanged = key !== source.activeSpotting?.validationKey
78
66
  return {
79
67
  validationKey: key,
80
- strokesIds: result.highlightedStrokeIds,
81
- isActive: !isDisabled,
68
+ strokesIds: chatData.currentThread.errorStrokesIds,
69
+ isActive: !isDisabled && isKeyChanged,
82
70
  isDisabled,
83
71
  }
84
72
  },
@@ -87,36 +75,13 @@ export class ErrorSpottingModel {
87
75
 
88
76
  sample({
89
77
  clock: this.errorSpottingPressed,
90
- source: {
91
- context: $currentChatContext,
92
- chatData: $currentChatData,
93
- activeSpotting: this.$activeData,
94
- },
95
- fn: (source, { message }) => ({ ...source, message }),
96
- target: createEffect(
97
- ({ chatData, activeSpotting, message, context }: ErrorSpottingReducerProps) => {
98
- if (!context) throw new Error('Trying to use error spotting in chat without context')
99
- if (!chatData.currentThread?.strokes) return
100
- if (!activeSpotting) {
101
- return this.api
102
- .spotErrorFx({
103
- strokes: chatData.currentThread.strokes,
104
- problemDescription: context.problem,
105
- correctAnswer: context.problemAnswer,
106
- userAnswer: context.answer ?? '',
107
- hint: message.message,
108
- })
109
- .then(() => {
110
- this.scheduleClose()
111
- })
112
- }
113
- this.activeDataChanged({ ...activeSpotting, isActive: !activeSpotting.isActive })
114
- this.scheduleClose()
115
- },
116
- ),
78
+ source: this.$activeData,
79
+ fn: (state) => (state ? { ...state, isActive: !state.isActive } : null),
80
+ target: this.activeDataChanged,
117
81
  })
118
82
 
119
83
  this.activeDataChanged.watch((spotting) => {
84
+ if (spotting?.isActive) return this.scheduleClose()
120
85
  if ((!spotting || !spotting.isActive) && this.closeTimeout) {
121
86
  clearTimeout(this.closeTimeout)
122
87
  this.closeTimeout = null
@@ -140,14 +105,8 @@ export class ErrorSpottingModel {
140
105
  return this
141
106
  }
142
107
 
143
- public abortPendingRequest() {
144
- const isPending = this.api.spotErrorFx.pending.getState()
145
- if (isPending) this.api.spotErrorFx.controller.abort()
146
- }
147
-
148
108
  public reset() {
149
109
  this.activeDataChanged(null)
150
- this.abortPendingRequest()
151
110
  }
152
111
 
153
112
  public enable() {
@@ -97,7 +97,6 @@ export class ChatbotModel {
97
97
  this.errorSpotting = new ErrorSpottingModel({
98
98
  api: this.api,
99
99
  $currentChatData: this.$currentChatData,
100
- $currentChatContext: this.$context,
101
100
  })
102
101
 
103
102
  if ($key) this.bindKey($key)
@@ -273,7 +272,6 @@ export class ChatbotModel {
273
272
  this.api.postMessageFx.controller.abort()
274
273
  this.removeLastMessage()
275
274
  }
276
- this.errorSpotting.abortPendingRequest()
277
275
 
278
276
  this.t2s.stop()
279
277
  void this.t2s.reset()
@@ -87,6 +87,9 @@ export class ChatBotThreadManager {
87
87
  })
88
88
 
89
89
  threadItem.history.push(result.message)
90
+ if (result.errorStrokeIds) {
91
+ threadItem.setErrorStrokesIds(result.errorStrokeIds)
92
+ }
90
93
  const nextOptions =
91
94
  threadItem.history.length < this.messagesLimit ? [this.defaultMessages.anotherHintOption] : []
92
95
 
@@ -13,6 +13,7 @@ export class ChatbotAPI {
13
13
  public readonly spotErrorFx
14
14
 
15
15
  constructor(api: ChatbotApiRequests) {
16
+ //TODO: remove, likely not needed anymore
16
17
  this.spotErrorFx = createControllerEffect(api.spotError)
17
18
  this.postMessageFx = createControllerEffect(api.postMessage)
18
19
  this.getAlternativesFx = createEffect(api.getAlternatives)
@@ -13,6 +13,7 @@ export class ThreadItem implements IThreadItem {
13
13
  public strokesValidationKey: string | null = null
14
14
  public strokes: FullStrokeData[] | null
15
15
  public text: string | null = null
16
+ public errorStrokesIds: string[] | null = null
16
17
 
17
18
  public constructor(props?: ThreadItemProps | null) {
18
19
  this.strokes = props?.strokes ?? null
@@ -35,6 +36,11 @@ export class ThreadItem implements IThreadItem {
35
36
  return this
36
37
  }
37
38
 
39
+ public setErrorStrokesIds(ids: string[] | null) {
40
+ this.errorStrokesIds = ids
41
+ return this
42
+ }
43
+
38
44
  public getNextHintProps() {
39
45
  if (this.history.length) {
40
46
  return {
@@ -47,7 +53,7 @@ export class ThreadItem implements IThreadItem {
47
53
  }
48
54
 
49
55
  if (this.strokes && this.strokes.length > 0) {
50
- return { stroke: this.strokes.map(({ x, y }) => ({ x, y })) }
56
+ return { stroke: this.strokes }
51
57
  }
52
58
  }
53
59
  }
@@ -69,6 +69,7 @@ export type ChatHintPayload = {
69
69
 
70
70
  export type ChatHintResponse = {
71
71
  message: string
72
+ errorStrokeIds?: string[]
72
73
  }
73
74
  export type ErrorSpottingPayload = {
74
75
  strokes: FullStrokeData[]
@@ -11,6 +11,7 @@ export type IThreadItem = {
11
11
  strokesValidationKey: string | null
12
12
  strokes: FullStrokeData[] | null
13
13
  history: string[]
14
+ errorStrokesIds: string[] | null
14
15
  }
15
16
 
16
17
  export type ChatAnswer = {
@@ -1,6 +1,6 @@
1
1
  import { StyleSheet, View } from 'react-native'
2
2
  import React from 'react'
3
- import { COLORS, HeadingVariants, IS_WEB, SPACING, Typography } from '@magmamath/react-native-ui'
3
+ import { COLORS, HeadingVariants, SPACING, Typography } from '@magmamath/react-native-ui'
4
4
  import { useUnit } from 'effector-react'
5
5
  import { $localization } from '../../../shared/translation'
6
6
  import { MessageBlock } from './MessageBlock'
@@ -14,8 +14,6 @@ type ExampleSolutionModalContentProps = {
14
14
  params: ExampleSolutionModalParams
15
15
  }
16
16
 
17
- const CONTAINER_HEIGHT = 593
18
-
19
17
  export const ExampleSolutionModalContent = ({
20
18
  params: { model, payload, cacheKey },
21
19
  }: ExampleSolutionModalContentProps) => {
@@ -23,12 +21,7 @@ export const ExampleSolutionModalContent = ({
23
21
  const localization = useUnit($localization)
24
22
 
25
23
  return (
26
- <View
27
- style={[
28
- styles.container,
29
- IS_WEB ? { maxHeight: CONTAINER_HEIGHT } : { height: CONTAINER_HEIGHT },
30
- ]}
31
- >
24
+ <View style={styles.container}>
32
25
  <Typography align="center" variant={HeadingVariants.H2} style={{ color: COLORS.NEUTRAL_9 }}>
33
26
  {localization.exampleSolution.exampleSolution}
34
27
  </Typography>
@@ -49,6 +42,7 @@ export const ExampleSolutionModalContent = ({
49
42
  const styles = StyleSheet.create({
50
43
  container: {
51
44
  width: 880,
45
+ height: 593,
52
46
  },
53
47
  content: {
54
48
  flex: 1,
@@ -1,11 +1,4 @@
1
- import {
2
- StyleSheet,
3
- View,
4
- Image,
5
- ImageBackground,
6
- ScrollView,
7
- useWindowDimensions,
8
- } from 'react-native'
1
+ import { StyleSheet, View, Image, ImageBackground, ScrollView } from 'react-native'
9
2
  import React from 'react'
10
3
  import { COLORS, IS_WEB, SPACING } from '@magmamath/react-native-ui'
11
4
  import Animated, { FadeIn } from 'react-native-reanimated'
@@ -22,19 +15,16 @@ const CONTAINER_SIZES = {
22
15
  height: 543,
23
16
  }
24
17
  const BORDER_WIDTH = 1
25
- const CONTAINER_HEIGHT_OFFSET = 160
26
18
 
27
19
  const gridImagePath = !IS_WEB ? Image.resolveAssetSource(gridImage).uri : gridImage
28
20
 
29
21
  export const SolutionSection = ({ answer, status }: SolutionSectionProps) => {
30
- const { height } = useWindowDimensions()
31
-
32
22
  const shouldShowAnswer =
33
23
  answer &&
34
24
  (status === ExampleSolutionStatuses.DONE_DATA || status === ExampleSolutionStatuses.CACHE)
35
25
 
36
26
  return (
37
- <View style={[styles.container, IS_WEB && { maxHeight: height - CONTAINER_HEIGHT_OFFSET }]}>
27
+ <View style={styles.container}>
38
28
  <ScrollView
39
29
  style={styles.solutionScroll}
40
30
  contentContainerStyle={styles.solutionScrollContent}
@@ -43,11 +43,6 @@ export const FormulaSheet = forwardRef<ButtonRef | null, FormulaSheetProps>(
43
43
  const sheetFileBlob = useUnit(model.file.$blob)
44
44
  const isRequestPending = useUnit(model.api.getPDFFileBlobFx.pending)
45
45
 
46
- const onPressHandler = () => {
47
- model.modal.toggle()
48
- onPress?.()
49
- }
50
-
51
46
  useEffect(() => {
52
47
  model.file.setId(fileId ?? null)
53
48
  }, [fileId])
@@ -60,9 +55,10 @@ export const FormulaSheet = forwardRef<ButtonRef | null, FormulaSheetProps>(
60
55
  variant={ButtonVariant.SECONDARY}
61
56
  colorScheme={buttonColor}
62
57
  isActive={isOpen}
63
- //@ts-ignore
64
- delayPressIn={0}
65
- onPressIn={() => onPressHandler()}
58
+ onPress={() => {
59
+ model.modal.toggle()
60
+ onPress?.()
61
+ }}
66
62
  icon={<TheoryIcon color={isOpen ? COLORS.NEUTRAL_1 : undefined} size={20} />}
67
63
  style={style}
68
64
  />