@cuemath/leap 3.5.64 → 3.5.66-link0

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 (176) hide show
  1. package/dist/features/cue-canvas/bottombar/homework-controls.js.map +1 -1
  2. package/dist/features/cue-canvas/sidebar/sidebar.js +4 -4
  3. package/dist/features/cue-canvas/sidebar/sidebar.js.map +1 -1
  4. package/dist/features/cue-canvas/toolbar/toolbar.js +21 -17
  5. package/dist/features/cue-canvas/toolbar/toolbar.js.map +1 -1
  6. package/dist/features/cue-canvas/toolbar/whiteboard-toolbar.js +23 -13
  7. package/dist/features/cue-canvas/toolbar/whiteboard-toolbar.js.map +1 -1
  8. package/dist/features/milestone/create/api/milestone-config.js.map +1 -1
  9. package/dist/features/parent-dashboard/modals/trial-report/trial-report.js +1 -1
  10. package/dist/features/parent-dashboard/modals/trial-report/trial-report.js.map +1 -1
  11. package/dist/features/sheets/constants/sheet.js +1 -0
  12. package/dist/features/sheets/constants/sheet.js.map +1 -1
  13. package/dist/features/timeline/daily-timeline/daily-timeline.js +40 -40
  14. package/dist/features/timeline/daily-timeline/daily-timeline.js.map +1 -1
  15. package/dist/features/timeline/monthly-timeline/monthly-report/monthly-report-types.js +1 -1
  16. package/dist/features/timeline/monthly-timeline/monthly-report/monthly-report-types.js.map +1 -1
  17. package/dist/features/timeline/monthly-timeline/monthly-timeline-styled.js +8 -5
  18. package/dist/features/timeline/monthly-timeline/monthly-timeline-styled.js.map +1 -1
  19. package/dist/features/timeline/monthly-timeline/monthly-timeline.js +35 -35
  20. package/dist/features/timeline/monthly-timeline/monthly-timeline.js.map +1 -1
  21. package/dist/features/trial-session/api/trial-home.js +10 -16
  22. package/dist/features/trial-session/api/trial-home.js.map +1 -1
  23. package/dist/features/trial-session/api/trial-session-report.js +16 -0
  24. package/dist/features/trial-session/api/trial-session-report.js.map +1 -0
  25. package/dist/features/trial-session/api/trial-topics.js +9 -0
  26. package/dist/features/trial-session/api/trial-topics.js.map +1 -0
  27. package/dist/features/trial-session/comps/background-grid/background-grid-utils.js +62 -50
  28. package/dist/features/trial-session/comps/background-grid/background-grid-utils.js.map +1 -1
  29. package/dist/features/trial-session/comps/class-preference/class-preference-styled.js +5 -14
  30. package/dist/features/trial-session/comps/class-preference/class-preference-styled.js.map +1 -1
  31. package/dist/features/trial-session/comps/class-preference/class-preference.js +55 -53
  32. package/dist/features/trial-session/comps/class-preference/class-preference.js.map +1 -1
  33. package/dist/features/trial-session/comps/communication-slide/communication-slide-constants.js +3 -2
  34. package/dist/features/trial-session/comps/communication-slide/communication-slide-constants.js.map +1 -1
  35. package/dist/features/trial-session/comps/confirmation-modal/hooks/use-confirmation-modal.js +27 -27
  36. package/dist/features/trial-session/comps/confirmation-modal/hooks/use-confirmation-modal.js.map +1 -1
  37. package/dist/features/trial-session/comps/learning-session/learning-session-styled.js +19 -18
  38. package/dist/features/trial-session/comps/learning-session/learning-session-styled.js.map +1 -1
  39. package/dist/features/trial-session/comps/learning-session/learning-session.js +34 -43
  40. package/dist/features/trial-session/comps/learning-session/learning-session.js.map +1 -1
  41. package/dist/features/trial-session/comps/navigation-bar/index.js +56 -58
  42. package/dist/features/trial-session/comps/navigation-bar/index.js.map +1 -1
  43. package/dist/features/trial-session/comps/offering-information/offering-information-constants.js +29 -6
  44. package/dist/features/trial-session/comps/offering-information/offering-information-constants.js.map +1 -1
  45. package/dist/features/trial-session/comps/offering-information/offering-information.js +74 -64
  46. package/dist/features/trial-session/comps/offering-information/offering-information.js.map +1 -1
  47. package/dist/features/trial-session/comps/school-goals/school-goals-styled.js +10 -9
  48. package/dist/features/trial-session/comps/school-goals/school-goals-styled.js.map +1 -1
  49. package/dist/features/trial-session/comps/school-goals/school-goals-view.js +40 -39
  50. package/dist/features/trial-session/comps/school-goals/school-goals-view.js.map +1 -1
  51. package/dist/features/trial-session/comps/school-goals/school-goals.js +39 -37
  52. package/dist/features/trial-session/comps/school-goals/school-goals.js.map +1 -1
  53. package/dist/features/trial-session/comps/session-insights/session-insights-styled.js +12 -20
  54. package/dist/features/trial-session/comps/session-insights/session-insights-styled.js.map +1 -1
  55. package/dist/features/trial-session/comps/session-insights/session-insights.js +64 -63
  56. package/dist/features/trial-session/comps/session-insights/session-insights.js.map +1 -1
  57. package/dist/features/trial-session/comps/session-overview/session-overview-styled.js +13 -13
  58. package/dist/features/trial-session/comps/session-overview/session-overview-styled.js.map +1 -1
  59. package/dist/features/trial-session/comps/session-overview/session-overview-utils.js +23 -4
  60. package/dist/features/trial-session/comps/session-overview/session-overview-utils.js.map +1 -1
  61. package/dist/features/trial-session/comps/session-overview/session-overview.js +20 -20
  62. package/dist/features/trial-session/comps/session-overview/session-overview.js.map +1 -1
  63. package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary-styled.js +61 -0
  64. package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary-styled.js.map +1 -0
  65. package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary-types.js +5 -0
  66. package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary-types.js.map +1 -0
  67. package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary-view.js +135 -0
  68. package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary-view.js.map +1 -0
  69. package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary.js +53 -0
  70. package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary.js.map +1 -0
  71. package/dist/features/trial-session/comps/session-report/report-404/report-404.js +15 -16
  72. package/dist/features/trial-session/comps/session-report/report-404/report-404.js.map +1 -1
  73. package/dist/features/trial-session/comps/session-report/session-report.js +35 -33
  74. package/dist/features/trial-session/comps/session-report/session-report.js.map +1 -1
  75. package/dist/features/trial-session/comps/student-enrichment/student-enrichment-styled.js +9 -16
  76. package/dist/features/trial-session/comps/student-enrichment/student-enrichment-styled.js.map +1 -1
  77. package/dist/features/trial-session/comps/student-enrichment/student-enrichment.js +39 -37
  78. package/dist/features/trial-session/comps/student-enrichment/student-enrichment.js.map +1 -1
  79. package/dist/features/trial-session/comps/student-feedback/student-feedback-styled.js +10 -9
  80. package/dist/features/trial-session/comps/student-feedback/student-feedback-styled.js.map +1 -1
  81. package/dist/features/trial-session/comps/student-info/student-info-constants.js +35 -0
  82. package/dist/features/trial-session/comps/student-info/student-info-constants.js.map +1 -0
  83. package/dist/features/trial-session/comps/student-info/student-info-helpers.js +12 -0
  84. package/dist/features/trial-session/comps/student-info/student-info-helpers.js.map +1 -0
  85. package/dist/features/trial-session/comps/student-info/student-info-styled.js +26 -11
  86. package/dist/features/trial-session/comps/student-info/student-info-styled.js.map +1 -1
  87. package/dist/features/trial-session/comps/student-info/student-info.js +113 -78
  88. package/dist/features/trial-session/comps/student-info/student-info.js.map +1 -1
  89. package/dist/features/trial-session/comps/student-personalization/student-personalization-styled.js +3 -12
  90. package/dist/features/trial-session/comps/student-personalization/student-personalization-styled.js.map +1 -1
  91. package/dist/features/trial-session/comps/student-personalization/student-personalization.js +34 -33
  92. package/dist/features/trial-session/comps/student-personalization/student-personalization.js.map +1 -1
  93. package/dist/features/trial-session/comps/student-profile/student-profile.js +45 -44
  94. package/dist/features/trial-session/comps/student-profile/student-profile.js.map +1 -1
  95. package/dist/features/trial-session/comps/teacher-intro/teacher-intro.js +9 -8
  96. package/dist/features/trial-session/comps/teacher-intro/teacher-intro.js.map +1 -1
  97. package/dist/features/trial-session/comps/test-prep/test-prep-styled.js +11 -19
  98. package/dist/features/trial-session/comps/test-prep/test-prep-styled.js.map +1 -1
  99. package/dist/features/trial-session/comps/test-prep/test-prep.js +31 -29
  100. package/dist/features/trial-session/comps/test-prep/test-prep.js.map +1 -1
  101. package/dist/features/trial-session/comps/topic-selection/topic-selection-styled.js +42 -0
  102. package/dist/features/trial-session/comps/topic-selection/topic-selection-styled.js.map +1 -0
  103. package/dist/features/trial-session/comps/topic-selection/topic-selection.js +84 -0
  104. package/dist/features/trial-session/comps/topic-selection/topic-selection.js.map +1 -0
  105. package/dist/features/trial-session/comps/whiteboard/whiteboard-styled.js +21 -0
  106. package/dist/features/trial-session/comps/whiteboard/whiteboard-styled.js.map +1 -0
  107. package/dist/features/trial-session/comps/whiteboard/whiteboard.js +99 -0
  108. package/dist/features/trial-session/comps/whiteboard/whiteboard.js.map +1 -0
  109. package/dist/features/trial-session/comps/worksheet/worksheet.js +35 -33
  110. package/dist/features/trial-session/comps/worksheet/worksheet.js.map +1 -1
  111. package/dist/features/trial-session/context/trial-session-context.js +2 -0
  112. package/dist/features/trial-session/context/trial-session-context.js.map +1 -1
  113. package/dist/features/trial-session/helper.js +70 -64
  114. package/dist/features/trial-session/helper.js.map +1 -1
  115. package/dist/features/trial-session/hooks/use-trial-session-navigation.js +190 -158
  116. package/dist/features/trial-session/hooks/use-trial-session-navigation.js.map +1 -1
  117. package/dist/features/trial-session/right-panel/right-panel-styled.js +8 -8
  118. package/dist/features/trial-session/right-panel/right-panel-styled.js.map +1 -1
  119. package/dist/features/trial-session/right-panel/slide-components-map.js +42 -36
  120. package/dist/features/trial-session/right-panel/slide-components-map.js.map +1 -1
  121. package/dist/features/trial-session/trial-session-constants.js +22 -18
  122. package/dist/features/trial-session/trial-session-constants.js.map +1 -1
  123. package/dist/features/trial-session/trial-session-types.js.map +1 -1
  124. package/dist/features/trial-session/trial-session-view.js +82 -77
  125. package/dist/features/trial-session/trial-session-view.js.map +1 -1
  126. package/dist/features/trial-session/trial-session.js +38 -38
  127. package/dist/features/trial-session/trial-session.js.map +1 -1
  128. package/dist/features/ui/inputs/checkbox-input/checkbox-input.js +21 -21
  129. package/dist/features/ui/inputs/checkbox-input/checkbox-input.js.map +1 -1
  130. package/dist/features/ui/inputs/checkbox-input-list/checkbox-input-list.js +12 -12
  131. package/dist/features/ui/inputs/checkbox-input-list/checkbox-input-list.js.map +1 -1
  132. package/dist/features/ui/theme/clrs.js +1 -0
  133. package/dist/features/ui/theme/clrs.js.map +1 -1
  134. package/dist/features/worksheet/worksheet/mocks/activity.js +6 -0
  135. package/dist/features/worksheet/worksheet/mocks/activity.js.map +1 -0
  136. package/dist/features/worksheet/worksheet/mocks/signed-requests.js +5 -0
  137. package/dist/features/worksheet/worksheet/mocks/signed-requests.js.map +1 -0
  138. package/dist/features/worksheet/worksheet/stories/use-canvas-sync-broker-story.js +57 -0
  139. package/dist/features/worksheet/worksheet/stories/use-canvas-sync-broker-story.js.map +1 -0
  140. package/dist/features/worksheet/worksheet/stories/worksheet-story-container.js +263 -0
  141. package/dist/features/worksheet/worksheet/stories/worksheet-story-container.js.map +1 -0
  142. package/dist/features/worksheet/worksheet/stories/worksheet-student.js +177 -0
  143. package/dist/features/worksheet/worksheet/stories/worksheet-student.js.map +1 -0
  144. package/dist/features/worksheet/worksheet/stories/worksheet-teacher.js +268 -0
  145. package/dist/features/worksheet/worksheet/stories/worksheet-teacher.js.map +1 -0
  146. package/dist/features/worksheet/worksheet/worksheet-behavior-helper.js +51 -32
  147. package/dist/features/worksheet/worksheet/worksheet-behavior-helper.js.map +1 -1
  148. package/dist/features/worksheet/worksheet/worksheet-helpers.js +38 -37
  149. package/dist/features/worksheet/worksheet/worksheet-helpers.js.map +1 -1
  150. package/dist/features/worksheet/worksheet/worksheet-store/helpers/get-computed-properties.js +36 -35
  151. package/dist/features/worksheet/worksheet/worksheet-store/helpers/get-computed-properties.js.map +1 -1
  152. package/dist/features/worksheet/worksheet/worksheet-store/helpers/get-questions-from-items.js +61 -58
  153. package/dist/features/worksheet/worksheet/worksheet-store/helpers/get-questions-from-items.js.map +1 -1
  154. package/dist/features/worksheet/worksheet/worksheet-types.js.map +1 -1
  155. package/dist/features/worksheet/worksheet-preview/hooks/use-worksheet-layout.js +32 -30
  156. package/dist/features/worksheet/worksheet-preview/hooks/use-worksheet-layout.js.map +1 -1
  157. package/dist/index.d.ts +12 -6
  158. package/dist/index.js +148 -150
  159. package/dist/index.js.map +1 -1
  160. package/dist/node_modules/uuid/dist/esm-browser/regex.js +5 -0
  161. package/dist/node_modules/uuid/dist/esm-browser/regex.js.map +1 -0
  162. package/dist/node_modules/uuid/dist/esm-browser/rng.js +2 -3
  163. package/dist/node_modules/uuid/dist/esm-browser/rng.js.map +1 -1
  164. package/dist/node_modules/uuid/dist/esm-browser/stringify.js +10 -6
  165. package/dist/node_modules/uuid/dist/esm-browser/stringify.js.map +1 -1
  166. package/dist/node_modules/uuid/dist/esm-browser/v4.js +9 -12
  167. package/dist/node_modules/uuid/dist/esm-browser/v4.js.map +1 -1
  168. package/dist/node_modules/uuid/dist/esm-browser/validate.js +8 -0
  169. package/dist/node_modules/uuid/dist/esm-browser/validate.js.map +1 -0
  170. package/dist/types/models/worksheet.js +1 -1
  171. package/dist/types/models/worksheet.js.map +1 -1
  172. package/package.json +1 -1
  173. package/dist/features/sheets/utils/is-v3-worksheet.js +0 -55
  174. package/dist/features/sheets/utils/is-v3-worksheet.js.map +0 -1
  175. package/dist/node_modules/uuid/dist/esm-browser/native.js +0 -7
  176. package/dist/node_modules/uuid/dist/esm-browser/native.js.map +0 -1
@@ -1,12 +1,12 @@
1
- import d from "../../../assets/line-icons/icons/bulb2.js";
1
+ import _ from "../../../assets/line-icons/icons/bulb2.js";
2
2
  import f from "../../../assets/line-icons/icons/edit-star.js";
3
3
  import E from "../../../assets/line-icons/icons/edit2.js";
4
4
  import h from "../../../assets/line-icons/icons/practice.js";
5
5
  import C from "../../../assets/line-icons/icons/question-letter.js";
6
6
  import w from "../../../assets/line-icons/icons/star2.js";
7
7
  import s from "../constants/events.js";
8
- import { ACTION_BAR_HEIGHT as I, QUESTION_WIDTH as _, SPLIT_QUESTION_WIDTH as v, CLOZE_FORMULA_RESPONSE_LIMIT as b } from "./constants.js";
9
- const x = ({
8
+ import { ACTION_BAR_HEIGHT as T, QUESTION_WIDTH as d, SPLIT_QUESTION_WIDTH as I, CLOZE_FORMULA_RESPONSE_LIMIT as S } from "./constants.js";
9
+ const k = ({
10
10
  questions: e,
11
11
  initialQuestion: t,
12
12
  initialResponseId: r,
@@ -31,7 +31,7 @@ const x = ({
31
31
  return e[0].response_id;
32
32
  throw new Error("Initial question not found");
33
33
  };
34
- function T(e, t) {
34
+ function A(e, t) {
35
35
  var n, o;
36
36
  const r = Array.isArray(e) ? e.find((i) => i.response_id === t) : e;
37
37
  if (!r)
@@ -41,7 +41,7 @@ function T(e, t) {
41
41
  itemReference: r.item_reference,
42
42
  itemPosition: r.item_number,
43
43
  questionPosition: r.question_number,
44
- isOkayTypeQuestion: L(r),
44
+ isOkayTypeQuestion: v(r),
45
45
  score: {
46
46
  max_score: ((o = (n = r == null ? void 0 : r.validation) == null ? void 0 : n.valid_response) == null ? void 0 : o.score) ?? 0 * r.metadata.valid_response_count
47
47
  },
@@ -51,31 +51,31 @@ function T(e, t) {
51
51
  }
52
52
  };
53
53
  }
54
- const Q = (e) => e.reduce(
54
+ const x = (e) => e.reduce(
55
55
  (t, r) => ({
56
56
  ...t,
57
- [r.response_id]: T(e, r.response_id)
57
+ [r.response_id]: A(e, r.response_id)
58
58
  }),
59
59
  {}
60
- ), W = (e, t) => {
60
+ ), Q = (e, t) => {
61
61
  const { actionBar: r } = t;
62
62
  return {
63
63
  questionsContainerWidth: !e.some(
64
64
  (i) => i.questions.some((a) => a.stimulus_review)
65
- ) ? _ : v,
66
- maxQuestionWidth: _,
67
- actionbarHeight: r === "bottom" ? I : 0
65
+ ) ? d : I,
66
+ maxQuestionWidth: d,
67
+ actionbarHeight: r === "bottom" ? T : 0
68
68
  };
69
- }, P = (e, { animation: t = !1, block: r = "start" } = {}) => {
69
+ }, W = (e, { animation: t = !1, block: r = "start" } = {}) => {
70
70
  const n = document.querySelectorAll(`.widget-${e}`)[0];
71
71
  n && n.scrollIntoView({
72
72
  block: r,
73
73
  behavior: t ? "smooth" : "instant"
74
74
  });
75
- }, L = (e) => {
75
+ }, v = (e) => {
76
76
  const { type: t, options: r, instructor_stimulus: n } = e;
77
77
  return ("item_type" in e ? e.item_type : void 0) === "overview" || n === "Intro" || n === "SystemIntro" || n === "Concept-Intro" ? !0 : t === "mcq" && (r == null ? void 0 : r.length) === 1;
78
- }, N = ({
78
+ }, P = ({
79
79
  attemptsAfterTeacherInterventionNeeded: e,
80
80
  attemptsHistory: t
81
81
  }) => {
@@ -166,7 +166,7 @@ const Q = (e) => e.reduce(
166
166
  default:
167
167
  return "GREY_3";
168
168
  }
169
- }, Y = (e) => {
169
+ }, H = (e) => {
170
170
  switch (e) {
171
171
  case "learning":
172
172
  return "BLUE_1";
@@ -181,7 +181,7 @@ const Q = (e) => e.reduce(
181
181
  default:
182
182
  return "YELLOW_1";
183
183
  }
184
- }, z = (e) => {
184
+ }, Y = (e) => {
185
185
  switch (e) {
186
186
  case "learning":
187
187
  return "Learning";
@@ -198,10 +198,10 @@ const Q = (e) => e.reduce(
198
198
  default:
199
199
  return "";
200
200
  }
201
- }, J = (e) => {
201
+ }, z = (e) => {
202
202
  switch (e) {
203
203
  case "learning":
204
- return d;
204
+ return _;
205
205
  case "practice":
206
206
  return h;
207
207
  case "practice-basic":
@@ -213,11 +213,11 @@ const Q = (e) => e.reduce(
213
213
  case "advanced":
214
214
  return w;
215
215
  default:
216
- return d;
216
+ return _;
217
217
  }
218
- }, H = (e) => Array.isArray(e.value) ? e.value.some(
219
- (r) => typeof r == "string" && r.length > b
220
- ) : !1, K = ({
218
+ }, J = (e) => e === "SAT_ENGLISH_ASSESSMENT" || e === "SAT_MATH_ASSESSMENT", K = (e) => Array.isArray(e.value) ? e.value.some(
219
+ (r) => typeof r == "string" && r.length > S
220
+ ) : !1, D = ({
221
221
  isPuzzleWorksheet: e,
222
222
  isTestWorksheet: t,
223
223
  imageHue: r = "BLUE"
@@ -233,30 +233,31 @@ const Q = (e) => e.reduce(
233
233
  bgColor: "BLACK",
234
234
  borderColor: "BLACK_4",
235
235
  textColor: "WHITE"
236
- }, D = (e) => e ? `${e}_1` : "BLUE_1", V = (e) => {
236
+ }, V = (e) => e ? `${e}_1` : "BLUE_1", X = (e) => {
237
237
  if (!e)
238
238
  return !1;
239
239
  const t = e.toLowerCase();
240
240
  return t === "intro" || t === "concept-intro";
241
241
  };
242
242
  export {
243
- H as checkIsClozeFormulaResponseInvalid,
244
- x as getInitialQuestionId,
245
- Q as getInitialResponses,
246
- Y as getNavigationSectionBackgroundColor,
247
- J as getNavigationSectionIcon,
248
- z as getNavigationSectionName,
243
+ K as checkIsClozeFormulaResponseInvalid,
244
+ k as getInitialQuestionId,
245
+ x as getInitialResponses,
246
+ H as getNavigationSectionBackgroundColor,
247
+ z as getNavigationSectionIcon,
248
+ Y as getNavigationSectionName,
249
249
  U as getPaperColorByQuestion,
250
- D as getPuzzleWorksheetBackgroundColor,
250
+ V as getPuzzleWorksheetBackgroundColor,
251
251
  F as getQuestionBackgroundImage,
252
252
  G as getQuestionBorderColor,
253
- T as getQuestionMetadata,
254
- W as getWorksheetDimensions,
255
- K as getWorksheetHeaderLayout,
256
- V as isConceptIntroWidget,
257
- L as isOkayTypeQuestion,
258
- N as isTeacherInterventionNeeded,
259
- P as scrollToQuestion,
253
+ A as getQuestionMetadata,
254
+ Q as getWorksheetDimensions,
255
+ D as getWorksheetHeaderLayout,
256
+ X as isConceptIntroWidget,
257
+ v as isOkayTypeQuestion,
258
+ J as isSATAssessmentNode,
259
+ P as isTeacherInterventionNeeded,
260
+ W as scrollToQuestion,
260
261
  $ as setMathJaxConfigInWindow
261
262
  };
262
263
  //# sourceMappingURL=worksheet-helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"worksheet-helpers.js","sources":["../../../../src/features/worksheet/worksheet/worksheet-helpers.ts"],"sourcesContent":["import Bulb2Icon from '../../../assets/line-icons/icons/bulb2';\nimport EditStarIcon from '../../../assets/line-icons/icons/edit-star';\nimport Edit2Icon from '../../../assets/line-icons/icons/edit2';\nimport PracticeIcon from '../../../assets/line-icons/icons/practice';\nimport QuestionLetterIcon from '../../../assets/line-icons/icons/question-letter';\nimport Star2Icon from '../../../assets/line-icons/icons/star2';\nimport { type NODE_TYPES } from '../../../types/models/worksheet';\nimport type { TColorNames, THueNames } from '../../ui/types';\nimport EVENTS from '../constants/events';\nimport {\n ACTION_BAR_HEIGHT,\n CLOZE_FORMULA_RESPONSE_LIMIT,\n QUESTION_WIDTH,\n SPLIT_QUESTION_WIDTH,\n} from './constants';\nimport type { TWorksheetQuestionPaperColor } from './worksheet-question/worksheet-question-types';\nimport {\n type ILearnosityItem,\n type ILearnosityQuestion,\n type ILearnosityQuestionResponse,\n type IWorksheetBehavior,\n type IWorksheetHeaderLayoutProps,\n type IWorksheetLayout,\n type IWorksheetQuestion,\n type IWorksheetResponse,\n type TInstructorStimulus,\n type TSectionName,\n} from './worksheet-types';\n\ninterface IGetInitialQuestionId {\n (params: {\n questions: IWorksheetQuestion[];\n initialQuestion: IWorksheetBehavior['initialQuestion'];\n lastUnlockedQuestionIndex: number;\n lastAttemptableQuestionIndex: number;\n initialResponseId?: string;\n initialItemIndex?: number;\n }): string;\n}\n\nconst getInitialQuestionId: IGetInitialQuestionId = ({\n questions,\n initialQuestion,\n initialResponseId,\n initialItemIndex,\n lastUnlockedQuestionIndex,\n lastAttemptableQuestionIndex,\n}) => {\n const unlockedQuestions = questions.slice(0, lastUnlockedQuestionIndex + 1);\n const lastUnlockedQuestion = questions[lastUnlockedQuestionIndex]!;\n const lastAttemptableQuestion = questions[lastAttemptableQuestionIndex]!;\n\n if (initialResponseId && unlockedQuestions.find(q => q.response_id === initialResponseId)) {\n return initialResponseId;\n }\n\n if (\n typeof initialItemIndex === 'number' &&\n initialItemIndex <= lastUnlockedQuestion.item_number\n ) {\n const question = questions.find(q => q.item_number === initialItemIndex);\n\n if (question?.response_id) {\n return question.response_id;\n }\n }\n\n if (initialQuestion === 'FIRST' && questions[0]?.response_id) {\n return questions[0].response_id;\n }\n\n if (initialQuestion === 'CURRENT') {\n return lastAttemptableQuestion.response_id;\n }\n\n if (questions[0]?.response_id) {\n return questions[0].response_id;\n }\n\n throw new Error('Initial question not found');\n};\n\ntype TQuestionMetadata = Pick<\n IWorksheetResponse,\n 'widgetReference' | 'itemReference' | 'itemPosition' | 'questionPosition' | 'isOkayTypeQuestion'\n>;\n\nfunction getQuestionMetadata(\n questions: IWorksheetQuestion[],\n questionId: string,\n): TQuestionMetadata;\nfunction getQuestionMetadata(question: IWorksheetQuestion): TQuestionMetadata;\nfunction getQuestionMetadata(\n questions: IWorksheetQuestion | IWorksheetQuestion[],\n questionId?: string,\n) {\n const question = Array.isArray(questions)\n ? questions.find(q => q.response_id === questionId)\n : questions;\n\n if (!question) {\n throw new Error(`Question with id ${questionId} not found`);\n }\n\n return {\n widgetReference: question.metadata.widget_reference,\n itemReference: question.item_reference,\n itemPosition: question.item_number,\n questionPosition: question.question_number,\n isOkayTypeQuestion: isOkayTypeQuestion(question),\n score: {\n max_score:\n question?.validation?.valid_response?.score ?? 0 * question.metadata.valid_response_count,\n },\n tags: {\n ...question.item_tags_map,\n instructor_stimulus: question.instructor_stimulus,\n },\n };\n}\n\ninterface IGetInitialResponses {\n (questions: IWorksheetQuestion[]): Record<string, IWorksheetResponse>;\n}\n\nconst getInitialResponses: IGetInitialResponses = questions => {\n return questions.reduce(\n (acc, question) => ({\n ...acc,\n [question.response_id]: getQuestionMetadata(questions, question.response_id),\n }),\n {},\n );\n};\n\ninterface IGetWorksheetDimensions {\n (\n items: ILearnosityItem[],\n layout: IWorksheetLayout,\n ): {\n questionsContainerWidth: number;\n maxQuestionWidth: number;\n actionbarHeight: number;\n };\n}\n\nconst getWorksheetDimensions: IGetWorksheetDimensions = (items, layout) => {\n const { actionBar } = layout;\n const isSingleColumn = !items.some(item =>\n item.questions.some(question => question.stimulus_review),\n );\n const actionbarHeight = actionBar === 'bottom' ? ACTION_BAR_HEIGHT : 0;\n\n return {\n questionsContainerWidth: isSingleColumn ? QUESTION_WIDTH : SPLIT_QUESTION_WIDTH,\n maxQuestionWidth: QUESTION_WIDTH,\n actionbarHeight,\n };\n};\n\ninterface IScrollToQuestion {\n (questionId: string, params?: { animation?: boolean; block?: 'start' | 'end' }): void;\n}\n\nconst scrollToQuestion: IScrollToQuestion = (\n questionId,\n { animation = false, block = 'start' } = {},\n) => {\n const $questionEl = document.querySelectorAll(`.widget-${questionId}`)[0];\n\n if ($questionEl) {\n $questionEl.scrollIntoView({\n block,\n behavior: animation ? 'smooth' : 'instant',\n });\n }\n};\n\ninterface IIsOkayTypeQuestion {\n (question: IWorksheetQuestion | ILearnosityQuestion): boolean;\n}\n\nconst isOkayTypeQuestion: IIsOkayTypeQuestion = question => {\n const { type, options, instructor_stimulus } = question;\n const itemType = 'item_type' in question ? question.item_type : undefined;\n\n if (\n itemType === 'overview' ||\n instructor_stimulus === 'Intro' ||\n instructor_stimulus === 'SystemIntro' ||\n instructor_stimulus === 'Concept-Intro'\n ) {\n return true;\n }\n\n return type === 'mcq' && options?.length === 1 ? true : false;\n};\n\ninterface IIsTeacherInterventionNeeded {\n (params: {\n attemptsAfterTeacherInterventionNeeded: number | undefined;\n attemptsHistory: IWorksheetResponse['attemptsHistory'];\n }): boolean;\n}\n\nconst isTeacherInterventionNeeded: IIsTeacherInterventionNeeded = ({\n attemptsAfterTeacherInterventionNeeded,\n attemptsHistory,\n}) => {\n if (\n attemptsAfterTeacherInterventionNeeded &&\n (attemptsHistory?.length ?? 0) >= attemptsAfterTeacherInterventionNeeded\n ) {\n const score = attemptsHistory?.slice(-1)[0]?.score;\n\n if (score && score.score === score.max_score) {\n return false;\n }\n\n return true;\n }\n\n return false;\n};\n\nconst setMathJaxConfigInWindow = (\n logger: (eventName: string, data?: Record<string, unknown>) => void,\n) => {\n window.MathJax = {\n options: {\n enableMenu: false,\n ignoreHtmlClass: 'lrn_noMath',\n compileError: function (doc, math, err) {\n logger(EVENTS.MATHJAX_COMPILE_ERROR);\n doc.compileError(math, err);\n },\n typesetError: function (doc, math, err) {\n logger(EVENTS.MATHJAX_TYPESET_ERROR);\n doc.typesetError(math, err);\n // throw new Error('typesetError');\n },\n },\n tex: {\n inlineMath: [\n ['\\\\(', '\\\\)'],\n ['$$', '$$'],\n ],\n displayMath: [['\\\\[', '\\\\]']],\n macros: {\n abs: ['{|#1|}', 1],\n degree: ['°'],\n longdiv: ['{\\\\enclose{longdiv}{#1}}', 1],\n atomic: ['{_{#1}^{#2}}', 2],\n polyatomic: ['{_{#2}{}^{#1}}', 2],\n circledot: ['{\\\\odot}'],\n parallelogram: ['\\\\unicode{x25B1}'],\n ngtr: ['\\\\unicode{x226F}'],\n nless: ['\\\\unicode{x226E}'],\n MathQuillVarField: ['#1', 1],\n overarc: ['{\\\\overparen{#1}}', 1],\n },\n formatError: (jax, err) => {\n logger(EVENTS.MATHJAX_FORMAT_ERROR, {\n id: err.id,\n message: err.message,\n });\n jax.formatError(err);\n },\n },\n chtml: {\n minScale: 1,\n matchFontHeight: false,\n },\n };\n};\n\ninterface IGetPaperColorByQuestion {\n (question: IWorksheetQuestion): TWorksheetQuestionPaperColor;\n}\n\nconst getPaperColorByQuestion: IGetPaperColorByQuestion = question => {\n const { item_type, instructor_stimulus } = question;\n const lowerCaseInstructorStimulus = instructor_stimulus?.toLowerCase();\n\n switch (item_type) {\n case 'overview':\n case 'learning':\n return 'blue';\n case 'learning-we-do':\n case 'learning-your-turn':\n case 'learning-explore':\n if (\n lowerCaseInstructorStimulus === 'instruction' ||\n lowerCaseInstructorStimulus === 'intro' ||\n lowerCaseInstructorStimulus === 'concept-intro'\n ) {\n return 'blue';\n }\n\n if (lowerCaseInstructorStimulus === 'task') {\n return 'green';\n }\n\n return 'yellow';\n case 'practice-basic':\n case 'practice-regular':\n return 'yellow';\n case 'exit-ticket':\n return 'purple';\n case 'advanced-practice':\n return 'orange';\n default:\n if (lowerCaseInstructorStimulus === 'learn') return 'blue';\n\n if (lowerCaseInstructorStimulus === 'try' || lowerCaseInstructorStimulus === 'apply')\n return 'green';\n\n return 'yellow';\n }\n};\n\nconst getQuestionBackgroundImage = (paperColor: TWorksheetQuestionPaperColor) => {\n return `https://cuemath-intel.s3.ap-southeast-1.amazonaws.com/media/math-canvas/paper-${paperColor}.png`;\n};\n\nconst getQuestionBorderColor = (\n paperColor: TWorksheetQuestionPaperColor,\n isActive?: boolean,\n): TColorNames => {\n if (!isActive) {\n return 'GREY_3';\n }\n\n switch (paperColor) {\n case 'orange':\n case 'white':\n return 'ORANGE_2';\n case 'blue':\n return 'BLUE_2';\n case 'green':\n return 'GREEN_2';\n case 'yellow':\n return 'YELLOW_2';\n case 'purple':\n return 'PURPLE_2';\n default:\n return 'GREY_3';\n }\n};\n\nconst getNavigationSectionBackgroundColor = (sectionName?: TSectionName): TColorNames => {\n switch (sectionName) {\n case 'learning':\n return 'BLUE_1';\n case 'practice':\n case 'practice-basic':\n case 'practice-regular':\n return 'YELLOW_1';\n case 'exit-ticket':\n return 'PURPLE_1';\n case 'advanced':\n return 'ORANGE_1';\n default:\n return 'YELLOW_1';\n }\n};\n\nconst getNavigationSectionName = (sectionName?: TSectionName): string => {\n switch (sectionName) {\n case 'learning':\n return 'Learning';\n case 'practice':\n return 'Practice';\n case 'practice-basic':\n return 'Basic practice';\n case 'practice-regular':\n return 'Regular practice';\n case 'exit-ticket':\n return 'Mini quiz';\n case 'advanced':\n return 'Advanced work';\n default:\n return '';\n }\n};\n\nconst getNavigationSectionIcon = (sectionName?: TSectionName) => {\n switch (sectionName) {\n case 'learning':\n return Bulb2Icon;\n case 'practice':\n return PracticeIcon;\n case 'practice-basic':\n return Edit2Icon;\n case 'practice-regular':\n return EditStarIcon;\n case 'exit-ticket':\n return QuestionLetterIcon;\n case 'advanced':\n return Star2Icon;\n default:\n return Bulb2Icon;\n }\n};\n\nconst isSATAssessmentNode = (nodeType: NODE_TYPES) =>\n nodeType === 'SAT_ENGLISH_ASSESSMENT' || nodeType === 'SAT_MATH_ASSESSMENT';\n\nconst checkIsClozeFormulaResponseInvalid = (response: ILearnosityQuestionResponse) => {\n if (Array.isArray(response.value)) {\n const isInvalid = response.value.some(\n item => typeof item === 'string' && item.length > CLOZE_FORMULA_RESPONSE_LIMIT,\n );\n\n return isInvalid;\n }\n\n return false;\n};\n\nconst getWorksheetHeaderLayout: IWorksheetHeaderLayoutProps = ({\n isPuzzleWorksheet,\n isTestWorksheet,\n imageHue = 'BLUE',\n}) => {\n if (isPuzzleWorksheet) {\n return {\n bgColor: `${imageHue}_3`,\n borderColor: `${imageHue}_4`,\n textColor: 'BLACK_T_87',\n };\n }\n\n if (isTestWorksheet) {\n return {\n bgColor: 'WHITE_3',\n borderColor: 'WHITE_4',\n textColor: 'BLACK_T_87',\n };\n }\n\n return {\n bgColor: 'BLACK',\n borderColor: 'BLACK_4',\n textColor: 'WHITE',\n };\n};\n\ninterface IGetPuzzleWorksheetBackgroundColor {\n (imageHue?: THueNames): TColorNames;\n}\n\nconst getPuzzleWorksheetBackgroundColor: IGetPuzzleWorksheetBackgroundColor = imageHue => {\n if (!imageHue) return 'BLUE_1';\n\n return `${imageHue}_1`;\n};\n\nconst isConceptIntroWidget = (instructorStimulus?: TInstructorStimulus) => {\n if (!instructorStimulus) {\n return false;\n }\n\n const lowerCaseInstructorStimulus = instructorStimulus.toLowerCase();\n\n return lowerCaseInstructorStimulus === 'intro' || lowerCaseInstructorStimulus === 'concept-intro';\n};\n\nexport {\n checkIsClozeFormulaResponseInvalid,\n getInitialQuestionId,\n getInitialResponses,\n getNavigationSectionBackgroundColor,\n getNavigationSectionIcon,\n getNavigationSectionName,\n getPaperColorByQuestion,\n getPuzzleWorksheetBackgroundColor,\n getQuestionBackgroundImage,\n getQuestionBorderColor,\n getQuestionMetadata,\n getWorksheetDimensions,\n getWorksheetHeaderLayout,\n isConceptIntroWidget,\n isOkayTypeQuestion,\n isSATAssessmentNode,\n isTeacherInterventionNeeded,\n scrollToQuestion,\n setMathJaxConfigInWindow,\n};\n"],"names":["getInitialQuestionId","questions","initialQuestion","initialResponseId","initialItemIndex","lastUnlockedQuestionIndex","lastAttemptableQuestionIndex","unlockedQuestions","lastUnlockedQuestion","lastAttemptableQuestion","q","question","_a","_b","getQuestionMetadata","questionId","isOkayTypeQuestion","getInitialResponses","acc","getWorksheetDimensions","items","layout","actionBar","item","QUESTION_WIDTH","SPLIT_QUESTION_WIDTH","ACTION_BAR_HEIGHT","scrollToQuestion","animation","block","$questionEl","type","options","instructor_stimulus","isTeacherInterventionNeeded","attemptsAfterTeacherInterventionNeeded","attemptsHistory","score","setMathJaxConfigInWindow","logger","doc","math","err","EVENTS","jax","getPaperColorByQuestion","item_type","lowerCaseInstructorStimulus","getQuestionBackgroundImage","paperColor","getQuestionBorderColor","isActive","getNavigationSectionBackgroundColor","sectionName","getNavigationSectionName","getNavigationSectionIcon","Bulb2Icon","PracticeIcon","Edit2Icon","EditStarIcon","QuestionLetterIcon","Star2Icon","checkIsClozeFormulaResponseInvalid","response","CLOZE_FORMULA_RESPONSE_LIMIT","getWorksheetHeaderLayout","isPuzzleWorksheet","isTestWorksheet","imageHue","getPuzzleWorksheetBackgroundColor","isConceptIntroWidget","instructorStimulus"],"mappings":";;;;;;;;AAwCA,MAAMA,IAA8C,CAAC;AAAA,EACnD,WAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,2BAAAC;AAAA,EACA,8BAAAC;AACF,MAAM;;AACJ,QAAMC,IAAoBN,EAAU,MAAM,GAAGI,IAA4B,CAAC,GACpEG,IAAuBP,EAAUI,CAAyB,GAC1DI,IAA0BR,EAAUK,CAA4B;AAEtE,MAAIH,KAAqBI,EAAkB,KAAK,OAAKG,EAAE,gBAAgBP,CAAiB;AAC/E,WAAAA;AAGT,MACE,OAAOC,KAAqB,YAC5BA,KAAoBI,EAAqB,aACzC;AACA,UAAMG,IAAWV,EAAU,KAAK,CAAKS,MAAAA,EAAE,gBAAgBN,CAAgB;AAEvE,QAAIO,KAAA,QAAAA,EAAU;AACZ,aAAOA,EAAS;AAAA,EAEpB;AAEA,MAAIT,MAAoB,aAAWU,IAAAX,EAAU,CAAC,MAAX,QAAAW,EAAc;AACxC,WAAAX,EAAU,CAAC,EAAE;AAGtB,MAAIC,MAAoB;AACtB,WAAOO,EAAwB;AAG7B,OAAAI,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;AAAA,IAM/C,IAGHC,IAAwD,CAAC;AAAA,EAC7D,mBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,UAAAC,IAAW;AACb,MACMF,IACK;AAAA,EACL,SAAS,GAAGE,CAAQ;AAAA,EACpB,aAAa,GAAGA,CAAQ;AAAA,EACxB,WAAW;AAAA,IAIXD,IACK;AAAA,EACL,SAAS;AAAA,EACT,aAAa;AAAA,EACb,WAAW;AAAA,IAIR;AAAA,EACL,SAAS;AAAA,EACT,aAAa;AAAA,EACb,WAAW;AAAA,GAQTE,IAAwE,CAAYD,MACnFA,IAEE,GAAGA,CAAQ,OAFI,UAKlBE,IAAuB,CAACC,MAA6C;AACzE,MAAI,CAACA;AACI,WAAA;AAGH,QAAAxB,IAA8BwB,EAAmB;AAEhD,SAAAxB,MAAgC,WAAWA,MAAgC;AACpF;"}
1
+ {"version":3,"file":"worksheet-helpers.js","sources":["../../../../src/features/worksheet/worksheet/worksheet-helpers.ts"],"sourcesContent":["import Bulb2Icon from '../../../assets/line-icons/icons/bulb2';\nimport EditStarIcon from '../../../assets/line-icons/icons/edit-star';\nimport Edit2Icon from '../../../assets/line-icons/icons/edit2';\nimport PracticeIcon from '../../../assets/line-icons/icons/practice';\nimport QuestionLetterIcon from '../../../assets/line-icons/icons/question-letter';\nimport Star2Icon from '../../../assets/line-icons/icons/star2';\nimport { type NODE_TYPES } from '../../../types/models/worksheet';\nimport type { TColorNames, THueNames } from '../../ui/types';\nimport EVENTS from '../constants/events';\nimport {\n ACTION_BAR_HEIGHT,\n CLOZE_FORMULA_RESPONSE_LIMIT,\n QUESTION_WIDTH,\n SPLIT_QUESTION_WIDTH,\n} from './constants';\nimport type { TWorksheetQuestionPaperColor } from './worksheet-question/worksheet-question-types';\nimport {\n type ILearnosityItem,\n type ILearnosityQuestion,\n type ILearnosityQuestionResponse,\n type IWorksheetBehavior,\n type IWorksheetHeaderLayoutProps,\n type IWorksheetLayout,\n type IWorksheetQuestion,\n type IWorksheetResponse,\n type TInstructorStimulus,\n type TSectionName,\n} from './worksheet-types';\n\ninterface IGetInitialQuestionId {\n (params: {\n questions: IWorksheetQuestion[];\n initialQuestion: IWorksheetBehavior['initialQuestion'];\n lastUnlockedQuestionIndex: number;\n lastAttemptableQuestionIndex: number;\n initialResponseId?: string;\n initialItemIndex?: number;\n }): string;\n}\n\nconst getInitialQuestionId: IGetInitialQuestionId = ({\n questions,\n initialQuestion,\n initialResponseId,\n initialItemIndex,\n lastUnlockedQuestionIndex,\n lastAttemptableQuestionIndex,\n}) => {\n const unlockedQuestions = questions.slice(0, lastUnlockedQuestionIndex + 1);\n const lastUnlockedQuestion = questions[lastUnlockedQuestionIndex]!;\n const lastAttemptableQuestion = questions[lastAttemptableQuestionIndex]!;\n\n if (initialResponseId && unlockedQuestions.find(q => q.response_id === initialResponseId)) {\n return initialResponseId;\n }\n\n if (\n typeof initialItemIndex === 'number' &&\n initialItemIndex <= lastUnlockedQuestion.item_number\n ) {\n const question = questions.find(q => q.item_number === initialItemIndex);\n\n if (question?.response_id) {\n return question.response_id;\n }\n }\n\n if (initialQuestion === 'FIRST' && questions[0]?.response_id) {\n return questions[0].response_id;\n }\n\n if (initialQuestion === 'CURRENT') {\n return lastAttemptableQuestion.response_id;\n }\n\n if (questions[0]?.response_id) {\n return questions[0].response_id;\n }\n\n throw new Error('Initial question not found');\n};\n\ntype TQuestionMetadata = Pick<\n IWorksheetResponse,\n 'widgetReference' | 'itemReference' | 'itemPosition' | 'questionPosition' | 'isOkayTypeQuestion'\n>;\n\nfunction getQuestionMetadata(\n questions: IWorksheetQuestion[],\n questionId: string,\n): TQuestionMetadata;\nfunction getQuestionMetadata(question: IWorksheetQuestion): TQuestionMetadata;\nfunction getQuestionMetadata(\n questions: IWorksheetQuestion | IWorksheetQuestion[],\n questionId?: string,\n) {\n const question = Array.isArray(questions)\n ? questions.find(q => q.response_id === questionId)\n : questions;\n\n if (!question) {\n throw new Error(`Question with id ${questionId} not found`);\n }\n\n return {\n widgetReference: question.metadata.widget_reference,\n itemReference: question.item_reference,\n itemPosition: question.item_number,\n questionPosition: question.question_number,\n isOkayTypeQuestion: isOkayTypeQuestion(question),\n score: {\n max_score:\n question?.validation?.valid_response?.score ?? 0 * question.metadata.valid_response_count,\n },\n tags: {\n ...question.item_tags_map,\n instructor_stimulus: question.instructor_stimulus,\n },\n };\n}\n\ninterface IGetInitialResponses {\n (questions: IWorksheetQuestion[]): Record<string, IWorksheetResponse>;\n}\n\nconst getInitialResponses: IGetInitialResponses = questions => {\n return questions.reduce(\n (acc, question) => ({\n ...acc,\n [question.response_id]: getQuestionMetadata(questions, question.response_id),\n }),\n {},\n );\n};\n\ninterface IGetWorksheetDimensions {\n (\n items: ILearnosityItem[],\n layout: IWorksheetLayout,\n ): {\n questionsContainerWidth: number;\n maxQuestionWidth: number;\n actionbarHeight: number;\n };\n}\n\nconst getWorksheetDimensions: IGetWorksheetDimensions = (items, layout) => {\n const { actionBar } = layout;\n const isSingleColumn = !items.some(item =>\n item.questions.some(question => question.stimulus_review),\n );\n const actionbarHeight = actionBar === 'bottom' ? ACTION_BAR_HEIGHT : 0;\n\n return {\n questionsContainerWidth: isSingleColumn ? QUESTION_WIDTH : SPLIT_QUESTION_WIDTH,\n maxQuestionWidth: QUESTION_WIDTH,\n actionbarHeight,\n };\n};\n\ninterface IScrollToQuestion {\n (questionId: string, params?: { animation?: boolean; block?: 'start' | 'end' }): void;\n}\n\nconst scrollToQuestion: IScrollToQuestion = (\n questionId,\n { animation = false, block = 'start' } = {},\n) => {\n const $questionEl = document.querySelectorAll(`.widget-${questionId}`)[0];\n\n if ($questionEl) {\n $questionEl.scrollIntoView({\n block,\n behavior: animation ? 'smooth' : 'instant',\n });\n }\n};\n\ninterface IIsOkayTypeQuestion {\n (question: IWorksheetQuestion | ILearnosityQuestion): boolean;\n}\n\nconst isOkayTypeQuestion: IIsOkayTypeQuestion = question => {\n const { type, options, instructor_stimulus } = question;\n const itemType = 'item_type' in question ? question.item_type : undefined;\n\n if (\n itemType === 'overview' ||\n instructor_stimulus === 'Intro' ||\n instructor_stimulus === 'SystemIntro' ||\n instructor_stimulus === 'Concept-Intro'\n ) {\n return true;\n }\n\n return type === 'mcq' && options?.length === 1 ? true : false;\n};\n\ninterface IIsTeacherInterventionNeeded {\n (params: {\n attemptsAfterTeacherInterventionNeeded: number | undefined;\n attemptsHistory: IWorksheetResponse['attemptsHistory'];\n }): boolean;\n}\n\nconst isTeacherInterventionNeeded: IIsTeacherInterventionNeeded = ({\n attemptsAfterTeacherInterventionNeeded,\n attemptsHistory,\n}) => {\n if (\n attemptsAfterTeacherInterventionNeeded &&\n (attemptsHistory?.length ?? 0) >= attemptsAfterTeacherInterventionNeeded\n ) {\n const score = attemptsHistory?.slice(-1)[0]?.score;\n\n if (score && score.score === score.max_score) {\n return false;\n }\n\n return true;\n }\n\n return false;\n};\n\nconst setMathJaxConfigInWindow = (\n logger: (eventName: string, data?: Record<string, unknown>) => void,\n) => {\n window.MathJax = {\n options: {\n enableMenu: false,\n ignoreHtmlClass: 'lrn_noMath',\n compileError: function (doc, math, err) {\n logger(EVENTS.MATHJAX_COMPILE_ERROR);\n doc.compileError(math, err);\n },\n typesetError: function (doc, math, err) {\n logger(EVENTS.MATHJAX_TYPESET_ERROR);\n doc.typesetError(math, err);\n // throw new Error('typesetError');\n },\n },\n tex: {\n inlineMath: [\n ['\\\\(', '\\\\)'],\n ['$$', '$$'],\n ],\n displayMath: [['\\\\[', '\\\\]']],\n macros: {\n abs: ['{|#1|}', 1],\n degree: ['°'],\n longdiv: ['{\\\\enclose{longdiv}{#1}}', 1],\n atomic: ['{_{#1}^{#2}}', 2],\n polyatomic: ['{_{#2}{}^{#1}}', 2],\n circledot: ['{\\\\odot}'],\n parallelogram: ['\\\\unicode{x25B1}'],\n ngtr: ['\\\\unicode{x226F}'],\n nless: ['\\\\unicode{x226E}'],\n MathQuillVarField: ['#1', 1],\n overarc: ['{\\\\overparen{#1}}', 1],\n },\n formatError: (jax, err) => {\n logger(EVENTS.MATHJAX_FORMAT_ERROR, {\n id: err.id,\n message: err.message,\n });\n jax.formatError(err);\n },\n },\n chtml: {\n minScale: 1,\n matchFontHeight: false,\n },\n };\n};\n\ninterface IGetPaperColorByQuestion {\n (question: IWorksheetQuestion): TWorksheetQuestionPaperColor;\n}\n\nconst getPaperColorByQuestion: IGetPaperColorByQuestion = question => {\n const { item_type, instructor_stimulus } = question;\n const lowerCaseInstructorStimulus = instructor_stimulus?.toLowerCase();\n\n switch (item_type) {\n case 'overview':\n case 'learning':\n return 'blue';\n case 'learning-we-do':\n case 'learning-your-turn':\n case 'learning-explore':\n if (\n lowerCaseInstructorStimulus === 'instruction' ||\n lowerCaseInstructorStimulus === 'intro' ||\n lowerCaseInstructorStimulus === 'concept-intro'\n ) {\n return 'blue';\n }\n\n if (lowerCaseInstructorStimulus === 'task') {\n return 'green';\n }\n\n return 'yellow';\n case 'practice-basic':\n case 'practice-regular':\n return 'yellow';\n case 'exit-ticket':\n return 'purple';\n case 'advanced-practice':\n return 'orange';\n default:\n if (lowerCaseInstructorStimulus === 'learn') return 'blue';\n\n if (lowerCaseInstructorStimulus === 'try' || lowerCaseInstructorStimulus === 'apply')\n return 'green';\n\n return 'yellow';\n }\n};\n\nconst getQuestionBackgroundImage = (paperColor: TWorksheetQuestionPaperColor) => {\n return `https://cuemath-intel.s3.ap-southeast-1.amazonaws.com/media/math-canvas/paper-${paperColor}.png`;\n};\n\nconst getQuestionBorderColor = (\n paperColor: TWorksheetQuestionPaperColor,\n isActive?: boolean,\n): TColorNames => {\n if (!isActive) {\n return 'GREY_3';\n }\n\n switch (paperColor) {\n case 'orange':\n case 'white':\n return 'ORANGE_2';\n case 'blue':\n return 'BLUE_2';\n case 'green':\n return 'GREEN_2';\n case 'yellow':\n return 'YELLOW_2';\n case 'purple':\n return 'PURPLE_2';\n default:\n return 'GREY_3';\n }\n};\n\nconst getNavigationSectionBackgroundColor = (sectionName?: TSectionName): TColorNames => {\n switch (sectionName) {\n case 'learning':\n return 'BLUE_1';\n case 'practice':\n case 'practice-basic':\n case 'practice-regular':\n return 'YELLOW_1';\n case 'exit-ticket':\n return 'PURPLE_1';\n case 'advanced':\n return 'ORANGE_1';\n default:\n return 'YELLOW_1';\n }\n};\n\nconst getNavigationSectionName = (sectionName?: TSectionName): string => {\n switch (sectionName) {\n case 'learning':\n return 'Learning';\n case 'practice':\n return 'Practice';\n case 'practice-basic':\n return 'Basic practice';\n case 'practice-regular':\n return 'Regular practice';\n case 'exit-ticket':\n return 'Mini quiz';\n case 'advanced':\n return 'Advanced work';\n default:\n return '';\n }\n};\n\nconst getNavigationSectionIcon = (sectionName?: TSectionName) => {\n switch (sectionName) {\n case 'learning':\n return Bulb2Icon;\n case 'practice':\n return PracticeIcon;\n case 'practice-basic':\n return Edit2Icon;\n case 'practice-regular':\n return EditStarIcon;\n case 'exit-ticket':\n return QuestionLetterIcon;\n case 'advanced':\n return Star2Icon;\n default:\n return Bulb2Icon;\n }\n};\n\nconst isSATAssessmentNode = (nodeType: NODE_TYPES) =>\n nodeType === 'SAT_ENGLISH_ASSESSMENT' || nodeType === 'SAT_MATH_ASSESSMENT';\n\nconst checkIsClozeFormulaResponseInvalid = (response: ILearnosityQuestionResponse) => {\n if (Array.isArray(response.value)) {\n const isInvalid = response.value.some(\n item => typeof item === 'string' && item.length > CLOZE_FORMULA_RESPONSE_LIMIT,\n );\n\n return isInvalid;\n }\n\n return false;\n};\n\nconst getWorksheetHeaderLayout: IWorksheetHeaderLayoutProps = ({\n isPuzzleWorksheet,\n isTestWorksheet,\n imageHue = 'BLUE',\n}) => {\n if (isPuzzleWorksheet) {\n return {\n bgColor: `${imageHue}_3`,\n borderColor: `${imageHue}_4`,\n textColor: 'BLACK_T_87',\n };\n }\n\n if (isTestWorksheet) {\n return {\n bgColor: 'WHITE_3',\n borderColor: 'WHITE_4',\n textColor: 'BLACK_T_87',\n };\n }\n\n return {\n bgColor: 'BLACK',\n borderColor: 'BLACK_4',\n textColor: 'WHITE',\n };\n};\n\ninterface IGetPuzzleWorksheetBackgroundColor {\n (imageHue?: THueNames): TColorNames;\n}\n\nconst getPuzzleWorksheetBackgroundColor: IGetPuzzleWorksheetBackgroundColor = imageHue => {\n if (!imageHue) return 'BLUE_1';\n\n return `${imageHue}_1`;\n};\n\nconst isConceptIntroWidget = (instructorStimulus?: TInstructorStimulus) => {\n if (!instructorStimulus) {\n return false;\n }\n\n const lowerCaseInstructorStimulus = instructorStimulus.toLowerCase();\n\n return lowerCaseInstructorStimulus === 'intro' || lowerCaseInstructorStimulus === 'concept-intro';\n};\n\nexport {\n checkIsClozeFormulaResponseInvalid,\n getInitialQuestionId,\n getInitialResponses,\n getNavigationSectionBackgroundColor,\n getNavigationSectionIcon,\n getNavigationSectionName,\n getPaperColorByQuestion,\n getPuzzleWorksheetBackgroundColor,\n getQuestionBackgroundImage,\n getQuestionBorderColor,\n getQuestionMetadata,\n getWorksheetDimensions,\n getWorksheetHeaderLayout,\n isConceptIntroWidget,\n isOkayTypeQuestion,\n isSATAssessmentNode,\n isTeacherInterventionNeeded,\n scrollToQuestion,\n setMathJaxConfigInWindow,\n};\n"],"names":["getInitialQuestionId","questions","initialQuestion","initialResponseId","initialItemIndex","lastUnlockedQuestionIndex","lastAttemptableQuestionIndex","unlockedQuestions","lastUnlockedQuestion","lastAttemptableQuestion","q","question","_a","_b","getQuestionMetadata","questionId","isOkayTypeQuestion","getInitialResponses","acc","getWorksheetDimensions","items","layout","actionBar","item","QUESTION_WIDTH","SPLIT_QUESTION_WIDTH","ACTION_BAR_HEIGHT","scrollToQuestion","animation","block","$questionEl","type","options","instructor_stimulus","isTeacherInterventionNeeded","attemptsAfterTeacherInterventionNeeded","attemptsHistory","score","setMathJaxConfigInWindow","logger","doc","math","err","EVENTS","jax","getPaperColorByQuestion","item_type","lowerCaseInstructorStimulus","getQuestionBackgroundImage","paperColor","getQuestionBorderColor","isActive","getNavigationSectionBackgroundColor","sectionName","getNavigationSectionName","getNavigationSectionIcon","Bulb2Icon","PracticeIcon","Edit2Icon","EditStarIcon","QuestionLetterIcon","Star2Icon","isSATAssessmentNode","nodeType","checkIsClozeFormulaResponseInvalid","response","CLOZE_FORMULA_RESPONSE_LIMIT","getWorksheetHeaderLayout","isPuzzleWorksheet","isTestWorksheet","imageHue","getPuzzleWorksheetBackgroundColor","isConceptIntroWidget","instructorStimulus"],"mappings":";;;;;;;;AAwCA,MAAMA,IAA8C,CAAC;AAAA,EACnD,WAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,2BAAAC;AAAA,EACA,8BAAAC;AACF,MAAM;;AACJ,QAAMC,IAAoBN,EAAU,MAAM,GAAGI,IAA4B,CAAC,GACpEG,IAAuBP,EAAUI,CAAyB,GAC1DI,IAA0BR,EAAUK,CAA4B;AAEtE,MAAIH,KAAqBI,EAAkB,KAAK,OAAKG,EAAE,gBAAgBP,CAAiB;AAC/E,WAAAA;AAGT,MACE,OAAOC,KAAqB,YAC5BA,KAAoBI,EAAqB,aACzC;AACA,UAAMG,IAAWV,EAAU,KAAK,CAAKS,MAAAA,EAAE,gBAAgBN,CAAgB;AAEvE,QAAIO,KAAA,QAAAA,EAAU;AACZ,aAAOA,EAAS;AAAA,EAEpB;AAEA,MAAIT,MAAoB,aAAWU,IAAAX,EAAU,CAAC,MAAX,QAAAW,EAAc;AACxC,WAAAX,EAAU,CAAC,EAAE;AAGtB,MAAIC,MAAoB;AACtB,WAAOO,EAAwB;AAG7B,OAAAI,IAAAZ,EAAU,CAAC,MAAX,QAAAY,EAAc;AACT,WAAAZ,EAAU,CAAC,EAAE;AAGhB,QAAA,IAAI,MAAM,4BAA4B;AAC9C;AAYA,SAASa,EACPb,GACAc,GACA;;AACM,QAAAJ,IAAW,MAAM,QAAQV,CAAS,IACpCA,EAAU,KAAK,CAAKS,MAAAA,EAAE,gBAAgBK,CAAU,IAChDd;AAEJ,MAAI,CAACU;AACH,UAAM,IAAI,MAAM,oBAAoBI,CAAU,YAA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AAA,EACb,WAAW;AAAA,IAIR;AAAA,EACL,SAAS;AAAA,EACT,aAAa;AAAA,EACb,WAAW;AAAA,GAQTE,IAAwE,CAAYD,MACnFA,IAEE,GAAGA,CAAQ,OAFI,UAKlBE,IAAuB,CAACC,MAA6C;AACzE,MAAI,CAACA;AACI,WAAA;AAGH,QAAA1B,IAA8B0B,EAAmB;AAEhD,SAAA1B,MAAgC,WAAWA,MAAgC;AACpF;"}
@@ -1,73 +1,74 @@
1
- import { getInitialResponses as y, getInitialQuestionId as v, getWorksheetDimensions as C } from "../../worksheet-helpers.js";
2
- import { getLastAttemptableQuestionIndex as h } from "./get-last-attemptable-question-index.js";
3
- import { getQuestionsFromItems as x } from "./get-questions-from-items.js";
4
- import { getLastUnlockedQuestionIndex as T } from "./get-last-unlocked-question-index.js";
1
+ import { getInitialResponses as y, getInitialQuestionId as v, getWorksheetDimensions as T } from "../../worksheet-helpers.js";
2
+ import { getLastAttemptableQuestionIndex as C } from "./get-last-attemptable-question-index.js";
3
+ import { getQuestionsFromItems as h } from "./get-questions-from-items.js";
4
+ import { getLastUnlockedQuestionIndex as x } from "./get-last-unlocked-question-index.js";
5
5
  import { getDerivedBlocker as E } from "./get-derived-blocker.js";
6
6
  import { getRenderableQuestions as R } from "./get-renderable-questions.js";
7
- const L = (n, i) => {
7
+ const L = (n, e) => {
8
8
  const {
9
9
  learnosityItems: d,
10
10
  learnosityResponses: m,
11
11
  updatedResponses: b,
12
12
  layout: I,
13
13
  behavior: s,
14
- userType: t,
14
+ userType: a,
15
15
  initialResponseId: Q,
16
16
  initialItemIndex: g
17
- } = n, { initialQuestion: p } = s, e = (i == null ? void 0 : i.questions) ?? x(d, {
17
+ } = n, { initialQuestion: p } = s, i = (e == null ? void 0 : e.questions) ?? h(d, {
18
18
  nodeType: n.nodeType,
19
- activityType: n.activityType
20
- }), a = b ?? (i == null ? void 0 : i.responses) ?? m ?? y(e), l = T({
21
- questions: e,
22
- responses: a,
19
+ activityType: n.activityType,
20
+ selectedTopics: n.selectedTopics
21
+ }), t = b ?? (e == null ? void 0 : e.responses) ?? m ?? y(i), l = x({
22
+ questions: i,
23
+ responses: t,
23
24
  behavior: s,
24
- userType: t,
25
+ userType: a,
25
26
  inClass: !!n.inClass
26
- }), c = (i == null ? void 0 : i.initialQuestionId) ?? v({
27
- questions: e,
27
+ }), o = (e == null ? void 0 : e.initialQuestionId) ?? v({
28
+ questions: i,
28
29
  initialQuestion: p,
29
30
  lastUnlockedQuestionIndex: l,
30
- lastAttemptableQuestionIndex: h({
31
- questions: e,
32
- responses: a,
31
+ lastAttemptableQuestionIndex: C({
32
+ questions: i,
33
+ responses: t,
33
34
  behavior: s,
34
- userType: t,
35
+ userType: a,
35
36
  inClass: !!n.inClass
36
37
  }),
37
38
  initialResponseId: Q,
38
39
  initialItemIndex: g
39
- }), u = (i == null ? void 0 : i.activeQuestionId) ?? c, o = e.findIndex(
40
+ }), u = (e == null ? void 0 : e.activeQuestionId) ?? o, c = i.findIndex(
40
41
  (f) => f.response_id === u
41
42
  );
42
43
  return setTimeout(() => {
43
- !i && e[o] && n.onActiveQuestionChange && n.onActiveQuestionChange(e[o]);
44
+ !e && i[c] && n.onActiveQuestionChange && n.onActiveQuestionChange(i[c]);
44
45
  }, 0), {
45
- questions: e,
46
+ questions: i,
46
47
  renderableQuestions: R({
47
- questions: e,
48
- userType: t,
48
+ questions: i,
49
+ userType: a,
49
50
  lastUnlockedQuestionIndex: l
50
51
  }),
51
- responses: a,
52
+ responses: t,
52
53
  lastUnlockedQuestionIndex: l,
53
- initialQuestionId: c,
54
+ initialQuestionId: o,
54
55
  activeQuestionId: u,
55
- activeQuestionIndex: o,
56
- summaryVisible: i ? i.summaryVisible : !1,
57
- calculatorVisible: i ? i.calculatorVisible : !1,
58
- scribblingEnabled: i ? i.scribblingEnabled : !1,
56
+ activeQuestionIndex: c,
57
+ summaryVisible: e ? e.summaryVisible : !1,
58
+ calculatorVisible: e ? e.calculatorVisible : !1,
59
+ scribblingEnabled: e ? e.scribblingEnabled : !1,
59
60
  blocker: E({
60
- questions: e,
61
- responses: a,
62
- prevResponses: (i == null ? void 0 : i.responses) ?? a,
61
+ questions: i,
62
+ responses: t,
63
+ prevResponses: (e == null ? void 0 : e.responses) ?? t,
63
64
  lastUnlockedQuestionIndex: l,
64
65
  teacherValidationEnabled: s.teacherValidationEnabled,
65
66
  teacherDiscussionEnabled: !!s.teacherDiscussionEnabled,
66
67
  inClass: !!n.inClass,
67
- userType: t
68
+ userType: a
68
69
  }),
69
- scrolledToInitialQuestion: (i == null ? void 0 : i.scrolledToInitialQuestion) ?? !1,
70
- ...C(d, I)
70
+ scrolledToInitialQuestion: (e == null ? void 0 : e.scrolledToInitialQuestion) ?? !1,
71
+ ...T(d, I)
71
72
  };
72
73
  };
73
74
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"get-computed-properties.js","sources":["../../../../../../src/features/worksheet/worksheet/worksheet-store/helpers/get-computed-properties.ts"],"sourcesContent":["import {\n getInitialQuestionId,\n getInitialResponses,\n getWorksheetDimensions,\n} from '../../worksheet-helpers';\nimport { getLastAttemptableQuestionIndex } from './get-last-attemptable-question-index';\nimport { getQuestionsFromItems } from './get-questions-from-items';\nimport { getLastUnlockedQuestionIndex } from './get-last-unlocked-question-index';\nimport type {\n IWorksheetStore,\n IWorksheetStoreState,\n TWorksheetStoreProps,\n} from '../../worksheet-types';\nimport { getDerivedBlocker } from './get-derived-blocker';\nimport { getRenderableQuestions } from './get-renderable-questions';\n\ninterface IGetComputedProperties {\n (props: TWorksheetStoreProps, store?: IWorksheetStore): IWorksheetStoreState;\n}\nexport const getComputedProperties: IGetComputedProperties = (props, store) => {\n const {\n learnosityItems,\n learnosityResponses,\n updatedResponses,\n layout,\n behavior,\n userType,\n initialResponseId,\n initialItemIndex,\n } = props;\n const { initialQuestion } = behavior;\n const questions =\n store?.questions ??\n getQuestionsFromItems(learnosityItems, {\n nodeType: props.nodeType,\n activityType: props.activityType,\n });\n const responses =\n updatedResponses ?? store?.responses ?? learnosityResponses ?? getInitialResponses(questions);\n const lastUnlockedQuestionIndex = getLastUnlockedQuestionIndex({\n questions,\n responses,\n behavior,\n userType,\n inClass: !!props.inClass,\n });\n const initialQuestionId =\n store?.initialQuestionId ??\n getInitialQuestionId({\n questions,\n initialQuestion,\n lastUnlockedQuestionIndex,\n lastAttemptableQuestionIndex: getLastAttemptableQuestionIndex({\n questions,\n responses,\n behavior,\n userType,\n inClass: !!props.inClass,\n }),\n initialResponseId,\n initialItemIndex,\n });\n\n const activeQuestionId = store?.activeQuestionId ?? initialQuestionId;\n const activeQuestionIndex = questions.findIndex(\n question => question.response_id === activeQuestionId,\n );\n\n setTimeout(() => {\n if (!store && questions[activeQuestionIndex] && props.onActiveQuestionChange) {\n props.onActiveQuestionChange(questions[activeQuestionIndex]);\n }\n }, 0);\n\n return {\n questions,\n renderableQuestions: getRenderableQuestions({\n questions,\n userType,\n lastUnlockedQuestionIndex,\n }),\n responses,\n lastUnlockedQuestionIndex,\n initialQuestionId,\n activeQuestionId,\n activeQuestionIndex,\n summaryVisible: store ? store.summaryVisible : false,\n calculatorVisible: store ? store.calculatorVisible : false,\n scribblingEnabled: store ? store.scribblingEnabled : false,\n blocker: getDerivedBlocker({\n questions,\n responses,\n prevResponses: store?.responses ?? responses,\n lastUnlockedQuestionIndex,\n teacherValidationEnabled: behavior.teacherValidationEnabled,\n teacherDiscussionEnabled: !!behavior.teacherDiscussionEnabled,\n inClass: !!props.inClass,\n userType,\n }),\n scrolledToInitialQuestion: store?.scrolledToInitialQuestion ?? false,\n ...getWorksheetDimensions(learnosityItems, layout),\n };\n};\n"],"names":["getComputedProperties","props","store","learnosityItems","learnosityResponses","updatedResponses","layout","behavior","userType","initialResponseId","initialItemIndex","initialQuestion","questions","getQuestionsFromItems","responses","getInitialResponses","lastUnlockedQuestionIndex","getLastUnlockedQuestionIndex","initialQuestionId","getInitialQuestionId","getLastAttemptableQuestionIndex","activeQuestionId","activeQuestionIndex","question","getRenderableQuestions","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AAAA,IACL,WAAAV;AAAA,IACA,qBAAqBY,EAAuB;AAAA,MAC1C,WAAAZ;AAAA,MACA,UAAAJ;AAAA,MACA,2BAAAQ;AAAA,IAAA,CACD;AAAA,IACD,WAAAF;AAAA,IACA,2BAAAE;AAAA,IACA,mBAAAE;AAAA,IACA,kBAAAG;AAAA,IACA,qBAAAC;AAAA,IACA,gBAAgBpB,IAAQA,EAAM,iBAAiB;AAAA,IAC/C,mBAAmBA,IAAQA,EAAM,oBAAoB;AAAA,IACrD,mBAAmBA,IAAQA,EAAM,oBAAoB;AAAA,IACrD,SAASuB,EAAkB;AAAA,MACzB,WAAAb;AAAA,MACA,WAAAE;AAAA,MACA,gBAAeZ,KAAA,gBAAAA,EAAO,cAAaY;AAAA,MACnC,2BAAAE;AAAA,MACA,0BAA0BT,EAAS;AAAA,MACnC,0BAA0B,CAAC,CAACA,EAAS;AAAA,MACrC,SAAS,CAAC,CAACN,EAAM;AAAA,MACjB,UAAAO;AAAA,IAAA,CACD;AAAA,IACD,4BAA2BN,KAAA,gBAAAA,EAAO,8BAA6B;AAAA,IAC/D,GAAGwB,EAAuBvB,GAAiBG,CAAM;AAAA,EAAA;AAErD;"}
1
+ {"version":3,"file":"get-computed-properties.js","sources":["../../../../../../src/features/worksheet/worksheet/worksheet-store/helpers/get-computed-properties.ts"],"sourcesContent":["import {\n getInitialQuestionId,\n getInitialResponses,\n getWorksheetDimensions,\n} from '../../worksheet-helpers';\nimport { getLastAttemptableQuestionIndex } from './get-last-attemptable-question-index';\nimport { getQuestionsFromItems } from './get-questions-from-items';\nimport { getLastUnlockedQuestionIndex } from './get-last-unlocked-question-index';\nimport type {\n IWorksheetStore,\n IWorksheetStoreState,\n TWorksheetStoreProps,\n} from '../../worksheet-types';\nimport { getDerivedBlocker } from './get-derived-blocker';\nimport { getRenderableQuestions } from './get-renderable-questions';\n\ninterface IGetComputedProperties {\n (props: TWorksheetStoreProps, store?: IWorksheetStore): IWorksheetStoreState;\n}\nexport const getComputedProperties: IGetComputedProperties = (props, store) => {\n const {\n learnosityItems,\n learnosityResponses,\n updatedResponses,\n layout,\n behavior,\n userType,\n initialResponseId,\n initialItemIndex,\n } = props;\n const { initialQuestion } = behavior;\n const questions =\n store?.questions ??\n getQuestionsFromItems(learnosityItems, {\n nodeType: props.nodeType,\n activityType: props.activityType,\n selectedTopics: props.selectedTopics,\n });\n const responses =\n updatedResponses ?? store?.responses ?? learnosityResponses ?? getInitialResponses(questions);\n const lastUnlockedQuestionIndex = getLastUnlockedQuestionIndex({\n questions,\n responses,\n behavior,\n userType,\n inClass: !!props.inClass,\n });\n const initialQuestionId =\n store?.initialQuestionId ??\n getInitialQuestionId({\n questions,\n initialQuestion,\n lastUnlockedQuestionIndex,\n lastAttemptableQuestionIndex: getLastAttemptableQuestionIndex({\n questions,\n responses,\n behavior,\n userType,\n inClass: !!props.inClass,\n }),\n initialResponseId,\n initialItemIndex,\n });\n\n const activeQuestionId = store?.activeQuestionId ?? initialQuestionId;\n const activeQuestionIndex = questions.findIndex(\n question => question.response_id === activeQuestionId,\n );\n\n setTimeout(() => {\n if (!store && questions[activeQuestionIndex] && props.onActiveQuestionChange) {\n props.onActiveQuestionChange(questions[activeQuestionIndex]);\n }\n }, 0);\n\n return {\n questions,\n renderableQuestions: getRenderableQuestions({\n questions,\n userType,\n lastUnlockedQuestionIndex,\n }),\n responses,\n lastUnlockedQuestionIndex,\n initialQuestionId,\n activeQuestionId,\n activeQuestionIndex,\n summaryVisible: store ? store.summaryVisible : false,\n calculatorVisible: store ? store.calculatorVisible : false,\n scribblingEnabled: store ? store.scribblingEnabled : false,\n blocker: getDerivedBlocker({\n questions,\n responses,\n prevResponses: store?.responses ?? responses,\n lastUnlockedQuestionIndex,\n teacherValidationEnabled: behavior.teacherValidationEnabled,\n teacherDiscussionEnabled: !!behavior.teacherDiscussionEnabled,\n inClass: !!props.inClass,\n userType,\n }),\n scrolledToInitialQuestion: store?.scrolledToInitialQuestion ?? false,\n ...getWorksheetDimensions(learnosityItems, layout),\n };\n};\n"],"names":["getComputedProperties","props","store","learnosityItems","learnosityResponses","updatedResponses","layout","behavior","userType","initialResponseId","initialItemIndex","initialQuestion","questions","getQuestionsFromItems","responses","getInitialResponses","lastUnlockedQuestionIndex","getLastUnlockedQuestionIndex","initialQuestionId","getInitialQuestionId","getLastAttemptableQuestionIndex","activeQuestionId","activeQuestionIndex","question","getRenderableQuestions","getDerivedBlocker","getWorksheetDimensions"],"mappings":";;;;;;AAmBa,MAAAA,IAAgD,CAACC,GAAOC,MAAU;AACvE,QAAA;AAAA,IACJ,iBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,kBAAAC;AAAA,EACE,IAAAT,GACE,EAAE,iBAAAU,EAAoB,IAAAJ,GACtBK,KACJV,KAAA,gBAAAA,EAAO,cACPW,EAAsBV,GAAiB;AAAA,IACrC,UAAUF,EAAM;AAAA,IAChB,cAAcA,EAAM;AAAA,IACpB,gBAAgBA,EAAM;AAAA,EAAA,CACvB,GACGa,IACJT,MAAoBH,KAAA,gBAAAA,EAAO,cAAaE,KAAuBW,EAAoBH,CAAS,GACxFI,IAA4BC,EAA6B;AAAA,IAC7D,WAAAL;AAAA,IACA,WAAAE;AAAA,IACA,UAAAP;AAAA,IACA,UAAAC;AAAA,IACA,SAAS,CAAC,CAACP,EAAM;AAAA,EAAA,CAClB,GACKiB,KACJhB,KAAA,gBAAAA,EAAO,sBACPiB,EAAqB;AAAA,IACnB,WAAAP;AAAA,IACA,iBAAAD;AAAA,IACA,2BAAAK;AAAA,IACA,8BAA8BI,EAAgC;AAAA,MAC5D,WAAAR;AAAA,MACA,WAAAE;AAAA,MACA,UAAAP;AAAA,MACA,UAAAC;AAAA,MACA,SAAS,CAAC,CAACP,EAAM;AAAA,IAAA,CAClB;AAAA,IACD,mBAAAQ;AAAA,IACA,kBAAAC;AAAA,EAAA,CACD,GAEGW,KAAmBnB,KAAA,gBAAAA,EAAO,qBAAoBgB,GAC9CI,IAAsBV,EAAU;AAAA,IACpC,CAAAW,MAAYA,EAAS,gBAAgBF;AAAA,EAAA;AAGvC,oBAAW,MAAM;AACf,IAAI,CAACnB,KAASU,EAAUU,CAAmB,KAAKrB,EAAM,0BAC9CA,EAAA,uBAAuBW,EAAUU,CAAmB,CAAC;AAAA,KAE5D,CAAC,GAEG;AAAA,IACL,WAAAV;AAAA,IACA,qBAAqBY,EAAuB;AAAA,MAC1C,WAAAZ;AAAA,MACA,UAAAJ;AAAA,MACA,2BAAAQ;AAAA,IAAA,CACD;AAAA,IACD,WAAAF;AAAA,IACA,2BAAAE;AAAA,IACA,mBAAAE;AAAA,IACA,kBAAAG;AAAA,IACA,qBAAAC;AAAA,IACA,gBAAgBpB,IAAQA,EAAM,iBAAiB;AAAA,IAC/C,mBAAmBA,IAAQA,EAAM,oBAAoB;AAAA,IACrD,mBAAmBA,IAAQA,EAAM,oBAAoB;AAAA,IACrD,SAASuB,EAAkB;AAAA,MACzB,WAAAb;AAAA,MACA,WAAAE;AAAA,MACA,gBAAeZ,KAAA,gBAAAA,EAAO,cAAaY;AAAA,MACnC,2BAAAE;AAAA,MACA,0BAA0BT,EAAS;AAAA,MACnC,0BAA0B,CAAC,CAACA,EAAS;AAAA,MACrC,SAAS,CAAC,CAACN,EAAM;AAAA,MACjB,UAAAO;AAAA,IAAA,CACD;AAAA,IACD,4BAA2BN,KAAA,gBAAAA,EAAO,8BAA6B;AAAA,IAC/D,GAAGwB,EAAuBvB,GAAiBG,CAAM;AAAA,EAAA;AAErD;"}
@@ -1,8 +1,8 @@
1
- import { EWorksheetActivity as b } from "../../../../../types/models/worksheet.js";
2
- import { OPTIONAL_ITEM_TYPES as T } from "../../constants.js";
3
- import { isConceptIntroWidget as I } from "../../worksheet-helpers.js";
1
+ import { EWorksheetActivity as S } from "../../../../../types/models/worksheet.js";
2
+ import { OPTIONAL_ITEM_TYPES as L } from "../../constants.js";
3
+ import { isConceptIntroWidget as C } from "../../worksheet-helpers.js";
4
4
  import { QUESTION_TAGS as f } from "../../worksheet-types.js";
5
- const w = (c) => {
5
+ const A = (c) => {
6
6
  switch (c) {
7
7
  case "overview":
8
8
  return "overview";
@@ -29,63 +29,66 @@ const w = (c) => {
29
29
  default:
30
30
  return;
31
31
  }
32
- }, L = (c) => c.reduce((h, m) => {
33
- const [p, g] = m.split(":"), s = p == null ? void 0 : p.trim(), t = g == null ? void 0 : g.trim();
34
- return !s || !t ? h : {
32
+ }, w = (c) => c.reduce((h, l) => {
33
+ const [m, g] = l.split(":"), b = m == null ? void 0 : m.trim(), v = g == null ? void 0 : g.trim();
34
+ return !b || !v ? h : {
35
35
  ...h,
36
- [s.toLowerCase()]: t
36
+ [b.toLowerCase()]: v
37
37
  };
38
- }, {}), V = (c, { nodeType: h, activityType: m }) => {
39
- const p = c.reduce(
40
- (s, t, o) => t.questions.reduce((r, e, i) => (r[e.response_id] = {
38
+ }, {}), y = (c, { nodeType: h, activityType: l, selectedTopics: m }) => {
39
+ const g = m && m.length > 0 ? c.filter((s) => {
40
+ const t = w(s.tags ?? []);
41
+ return m.includes(t["trial-topic"] ?? "");
42
+ }) : c, b = g.reduce(
43
+ (s, t, i) => t.questions.reduce((r, e, o) => (r[e.response_id] = {
41
44
  ...e,
42
45
  // Some questions are set to limited number of attempts which can show feedback which is causing the question to be stuck in the errored state
43
46
  feedback_attempts: void 0,
44
47
  item_reference: t.reference,
45
- item_number: o,
46
- item_display_number: o + 1,
48
+ item_number: i,
49
+ item_display_number: i + 1,
47
50
  item_tags: t.tags ?? [],
48
- item_tags_map: L(t.tags ?? []),
49
- question_number: i,
51
+ item_tags_map: w(t.tags ?? []),
52
+ question_number: o,
50
53
  total_questions: t.questions.length,
51
54
  can_scribble: !0
52
55
  }, r), s),
53
56
  {}
54
57
  );
55
- if (h === "LEARNING" && (m === b.LESSON_V3 || m == b.LESSON_V3_1))
56
- return c.reduce((s, t, o) => {
57
- var q;
58
+ if (h === "LEARNING" && (l === S.LESSON_V3 || l == S.LESSON_V3_1))
59
+ return c.reduce((s, t, i) => {
60
+ var T;
58
61
  let r = !1, e;
59
- const { content: i, itemType: n } = t, l = w(n), a = s[s.length - 1], v = l === (a == null ? void 0 : a.section_name) && (a != null && a.item_display_number) ? a.item_display_number + 1 : 1, S = i.match(/question-[^"]*/g), d = S == null ? void 0 : S.reduce(
60
- (_, u, E) => {
61
- const O = p[u.replace("question-", "")];
62
- if (!O)
62
+ const { content: o, itemType: n } = t, d = A(n), a = s[s.length - 1], O = d === (a == null ? void 0 : a.section_name) && (a != null && a.item_display_number) ? a.item_display_number + 1 : 1, E = o.match(/question-[^"]*/g), p = E == null ? void 0 : E.reduce(
63
+ (_, u, q) => {
64
+ const N = b[u.replace("question-", "")];
65
+ if (!N)
63
66
  throw new Error(`Question not found for the response id: ${u}`);
64
- const N = I(O.instructor_stimulus);
65
- return r = r || N, N && m === b.LESSON_V3_1 ? (e = O.stimulus, _) : (_.push({
66
- ...O,
67
+ const I = C(N.instructor_stimulus);
68
+ return r = r || I, I && l === S.LESSON_V3_1 ? (e = N.stimulus, _) : (_.push({
69
+ ...N,
67
70
  concept_intro_stimulus: e,
68
- is_non_question: m === b.LESSON_V3_1 && n === "overview",
69
- item_display_number: v,
70
- section_name: l,
71
+ is_non_question: l === S.LESSON_V3_1 && n === "overview",
72
+ item_display_number: O,
73
+ section_name: d,
71
74
  item_type: n,
72
- is_optional: n ? T.includes(n) : !1,
73
- question_number: E - (r ? 1 : 0),
74
- total_questions: S.length,
75
- can_scribble: !(n === "overview" || N)
75
+ is_optional: n ? L.includes(n) : !1,
76
+ question_number: q - (r ? 1 : 0),
77
+ total_questions: E.length,
78
+ can_scribble: !(n === "overview" || I)
76
79
  }), e && (e = void 0), _);
77
80
  },
78
81
  []
79
82
  );
80
- if (r = !1, d != null && d[0] && o > 0 && c.length > 0) {
81
- const _ = (q = c[o - 1]) == null ? void 0 : q.itemType, u = n != null && n.startsWith("advanced-") ? "advanced" : n, E = _ != null && _.startsWith("advanced-") ? "advanced" : _;
82
- if ((u === "practice" || u === "practice-basic" || u === "practice-regular" || u === "exit-ticket" || u === "advanced") && u !== E)
83
+ if (r = !1, p != null && p[0] && i > 0 && c.length > 0) {
84
+ const _ = (T = c[i - 1]) == null ? void 0 : T.itemType, u = n != null && n.startsWith("advanced-") ? "advanced" : n, q = _ != null && _.startsWith("advanced-") ? "advanced" : _;
85
+ if ((u === "practice" || u === "practice-basic" || u === "practice-regular" || u === "exit-ticket" || u === "advanced") && u !== q)
83
86
  return [
84
87
  ...s,
85
88
  {
86
- ...d[0],
89
+ ...p[0],
87
90
  metadata: {
88
- ...d[0].metadata,
91
+ ...p[0].metadata,
89
92
  teacher_tips: void 0,
90
93
  hints: void 0,
91
94
  solution: void 0
@@ -93,22 +96,22 @@ const w = (c) => {
93
96
  instructor_stimulus: "SystemIntro",
94
97
  response_id: `${n}-system-intro`,
95
98
  is_optional: n == null ? void 0 : n.startsWith("advanced-"),
96
- is_non_question: m === b.LESSON_V3_1,
99
+ is_non_question: l === S.LESSON_V3_1,
97
100
  can_scribble: !1
98
101
  },
99
- ...d ?? []
102
+ ...p ?? []
100
103
  ];
101
104
  }
102
- return [...s, ...d ?? []];
105
+ return [...s, ...p ?? []];
103
106
  }, []);
104
- const g = c.reduce((s, t) => {
105
- const { content: o } = t, r = o.match(/question-[^"]*/g), e = r == null ? void 0 : r.map(
106
- (i, n) => {
107
- const l = p[i.replace("question-", "")];
108
- if (!l)
109
- throw new Error(`Question not found for the response id: ${i}`);
107
+ const v = g.reduce((s, t) => {
108
+ const { content: i } = t, r = i.match(/question-[^"]*/g), e = r == null ? void 0 : r.map(
109
+ (o, n) => {
110
+ const d = b[o.replace("question-", "")];
111
+ if (!d)
112
+ throw new Error(`Question not found for the response id: ${o}`);
110
113
  return {
111
- ...l,
114
+ ...d,
112
115
  question_number: n,
113
116
  total_questions: r.length
114
117
  };
@@ -118,24 +121,24 @@ const w = (c) => {
118
121
  }, []);
119
122
  if (h === "TRIAL_DIAGNOSTIC") {
120
123
  const s = [], t = {};
121
- return g.sort((o, r) => {
122
- var a, v;
123
- const e = o.item_tags_map[f.TRIAL_TOPIC], i = r.item_tags_map[f.TRIAL_TOPIC];
124
- if (e && t[e] === void 0 && (t[e] = s.length, s.push(e)), i && t[i] === void 0 && (t[i] = s.length, s.push(i)), !e || !i)
124
+ return v.sort((i, r) => {
125
+ var a, O;
126
+ const e = i.item_tags_map[f.TRIAL_TOPIC], o = r.item_tags_map[f.TRIAL_TOPIC];
127
+ if (e && t[e] === void 0 && (t[e] = s.length, s.push(e)), o && t[o] === void 0 && (t[o] = s.length, s.push(o)), !e || !o)
125
128
  return 0;
126
- const n = `${t[e]}-${((a = o.item_tags_map[f.QUESTION_CODE]) == null ? void 0 : a.length) ?? 0}`, l = `${t[i]}-${((v = r.item_tags_map[f.QUESTION_CODE]) == null ? void 0 : v.length) ?? 0}`;
127
- return n > l ? 1 : -1;
128
- }).map((o) => {
129
- const r = t[o.item_tags_map[f.TRIAL_TOPIC] ?? ""] ?? 0, e = o.item_tags_map[f.QUESTION_CODE] ?? "";
129
+ const n = `${t[e]}-${((a = i.item_tags_map[f.QUESTION_CODE]) == null ? void 0 : a.length) ?? 0}`, d = `${t[o]}-${((O = r.item_tags_map[f.QUESTION_CODE]) == null ? void 0 : O.length) ?? 0}`;
130
+ return n > d ? 1 : -1;
131
+ }).map((i) => {
132
+ const r = t[i.item_tags_map[f.TRIAL_TOPIC] ?? ""] ?? 0, e = i.item_tags_map[f.QUESTION_CODE] ?? "";
130
133
  return {
131
- ...o,
134
+ ...i,
132
135
  item_display_number: r * 3 + e.length
133
136
  };
134
137
  });
135
138
  }
136
- return g;
139
+ return v;
137
140
  };
138
141
  export {
139
- V as getQuestionsFromItems
142
+ y as getQuestionsFromItems
140
143
  };
141
144
  //# sourceMappingURL=get-questions-from-items.js.map