@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.
- package/dist/features/cue-canvas/bottombar/homework-controls.js.map +1 -1
- package/dist/features/cue-canvas/sidebar/sidebar.js +4 -4
- package/dist/features/cue-canvas/sidebar/sidebar.js.map +1 -1
- package/dist/features/cue-canvas/toolbar/toolbar.js +21 -17
- package/dist/features/cue-canvas/toolbar/toolbar.js.map +1 -1
- package/dist/features/cue-canvas/toolbar/whiteboard-toolbar.js +23 -13
- package/dist/features/cue-canvas/toolbar/whiteboard-toolbar.js.map +1 -1
- package/dist/features/milestone/create/api/milestone-config.js.map +1 -1
- package/dist/features/parent-dashboard/modals/trial-report/trial-report.js +1 -1
- package/dist/features/parent-dashboard/modals/trial-report/trial-report.js.map +1 -1
- package/dist/features/sheets/constants/sheet.js +1 -0
- package/dist/features/sheets/constants/sheet.js.map +1 -1
- package/dist/features/timeline/daily-timeline/daily-timeline.js +40 -40
- package/dist/features/timeline/daily-timeline/daily-timeline.js.map +1 -1
- package/dist/features/timeline/monthly-timeline/monthly-report/monthly-report-types.js +1 -1
- package/dist/features/timeline/monthly-timeline/monthly-report/monthly-report-types.js.map +1 -1
- package/dist/features/timeline/monthly-timeline/monthly-timeline-styled.js +8 -5
- package/dist/features/timeline/monthly-timeline/monthly-timeline-styled.js.map +1 -1
- package/dist/features/timeline/monthly-timeline/monthly-timeline.js +35 -35
- package/dist/features/timeline/monthly-timeline/monthly-timeline.js.map +1 -1
- package/dist/features/trial-session/api/trial-home.js +10 -16
- package/dist/features/trial-session/api/trial-home.js.map +1 -1
- package/dist/features/trial-session/api/trial-session-report.js +16 -0
- package/dist/features/trial-session/api/trial-session-report.js.map +1 -0
- package/dist/features/trial-session/api/trial-topics.js +9 -0
- package/dist/features/trial-session/api/trial-topics.js.map +1 -0
- package/dist/features/trial-session/comps/background-grid/background-grid-utils.js +62 -50
- package/dist/features/trial-session/comps/background-grid/background-grid-utils.js.map +1 -1
- package/dist/features/trial-session/comps/class-preference/class-preference-styled.js +5 -14
- package/dist/features/trial-session/comps/class-preference/class-preference-styled.js.map +1 -1
- package/dist/features/trial-session/comps/class-preference/class-preference.js +55 -53
- package/dist/features/trial-session/comps/class-preference/class-preference.js.map +1 -1
- package/dist/features/trial-session/comps/communication-slide/communication-slide-constants.js +3 -2
- package/dist/features/trial-session/comps/communication-slide/communication-slide-constants.js.map +1 -1
- package/dist/features/trial-session/comps/confirmation-modal/hooks/use-confirmation-modal.js +27 -27
- package/dist/features/trial-session/comps/confirmation-modal/hooks/use-confirmation-modal.js.map +1 -1
- package/dist/features/trial-session/comps/learning-session/learning-session-styled.js +19 -18
- package/dist/features/trial-session/comps/learning-session/learning-session-styled.js.map +1 -1
- package/dist/features/trial-session/comps/learning-session/learning-session.js +34 -43
- package/dist/features/trial-session/comps/learning-session/learning-session.js.map +1 -1
- package/dist/features/trial-session/comps/navigation-bar/index.js +56 -58
- package/dist/features/trial-session/comps/navigation-bar/index.js.map +1 -1
- package/dist/features/trial-session/comps/offering-information/offering-information-constants.js +29 -6
- package/dist/features/trial-session/comps/offering-information/offering-information-constants.js.map +1 -1
- package/dist/features/trial-session/comps/offering-information/offering-information.js +74 -64
- package/dist/features/trial-session/comps/offering-information/offering-information.js.map +1 -1
- package/dist/features/trial-session/comps/school-goals/school-goals-styled.js +10 -9
- package/dist/features/trial-session/comps/school-goals/school-goals-styled.js.map +1 -1
- package/dist/features/trial-session/comps/school-goals/school-goals-view.js +40 -39
- package/dist/features/trial-session/comps/school-goals/school-goals-view.js.map +1 -1
- package/dist/features/trial-session/comps/school-goals/school-goals.js +39 -37
- package/dist/features/trial-session/comps/school-goals/school-goals.js.map +1 -1
- package/dist/features/trial-session/comps/session-insights/session-insights-styled.js +12 -20
- package/dist/features/trial-session/comps/session-insights/session-insights-styled.js.map +1 -1
- package/dist/features/trial-session/comps/session-insights/session-insights.js +64 -63
- package/dist/features/trial-session/comps/session-insights/session-insights.js.map +1 -1
- package/dist/features/trial-session/comps/session-overview/session-overview-styled.js +13 -13
- package/dist/features/trial-session/comps/session-overview/session-overview-styled.js.map +1 -1
- package/dist/features/trial-session/comps/session-overview/session-overview-utils.js +23 -4
- package/dist/features/trial-session/comps/session-overview/session-overview-utils.js.map +1 -1
- package/dist/features/trial-session/comps/session-overview/session-overview.js +20 -20
- package/dist/features/trial-session/comps/session-overview/session-overview.js.map +1 -1
- package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary-styled.js +61 -0
- package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary-styled.js.map +1 -0
- package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary-types.js +5 -0
- package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary-types.js.map +1 -0
- package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary-view.js +135 -0
- package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary-view.js.map +1 -0
- package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary.js +53 -0
- package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary.js.map +1 -0
- package/dist/features/trial-session/comps/session-report/report-404/report-404.js +15 -16
- package/dist/features/trial-session/comps/session-report/report-404/report-404.js.map +1 -1
- package/dist/features/trial-session/comps/session-report/session-report.js +35 -33
- package/dist/features/trial-session/comps/session-report/session-report.js.map +1 -1
- package/dist/features/trial-session/comps/student-enrichment/student-enrichment-styled.js +9 -16
- package/dist/features/trial-session/comps/student-enrichment/student-enrichment-styled.js.map +1 -1
- package/dist/features/trial-session/comps/student-enrichment/student-enrichment.js +39 -37
- package/dist/features/trial-session/comps/student-enrichment/student-enrichment.js.map +1 -1
- package/dist/features/trial-session/comps/student-feedback/student-feedback-styled.js +10 -9
- package/dist/features/trial-session/comps/student-feedback/student-feedback-styled.js.map +1 -1
- package/dist/features/trial-session/comps/student-info/student-info-constants.js +35 -0
- package/dist/features/trial-session/comps/student-info/student-info-constants.js.map +1 -0
- package/dist/features/trial-session/comps/student-info/student-info-helpers.js +12 -0
- package/dist/features/trial-session/comps/student-info/student-info-helpers.js.map +1 -0
- package/dist/features/trial-session/comps/student-info/student-info-styled.js +26 -11
- package/dist/features/trial-session/comps/student-info/student-info-styled.js.map +1 -1
- package/dist/features/trial-session/comps/student-info/student-info.js +113 -78
- package/dist/features/trial-session/comps/student-info/student-info.js.map +1 -1
- package/dist/features/trial-session/comps/student-personalization/student-personalization-styled.js +3 -12
- package/dist/features/trial-session/comps/student-personalization/student-personalization-styled.js.map +1 -1
- package/dist/features/trial-session/comps/student-personalization/student-personalization.js +34 -33
- package/dist/features/trial-session/comps/student-personalization/student-personalization.js.map +1 -1
- package/dist/features/trial-session/comps/student-profile/student-profile.js +45 -44
- package/dist/features/trial-session/comps/student-profile/student-profile.js.map +1 -1
- package/dist/features/trial-session/comps/teacher-intro/teacher-intro.js +9 -8
- package/dist/features/trial-session/comps/teacher-intro/teacher-intro.js.map +1 -1
- package/dist/features/trial-session/comps/test-prep/test-prep-styled.js +11 -19
- package/dist/features/trial-session/comps/test-prep/test-prep-styled.js.map +1 -1
- package/dist/features/trial-session/comps/test-prep/test-prep.js +31 -29
- package/dist/features/trial-session/comps/test-prep/test-prep.js.map +1 -1
- package/dist/features/trial-session/comps/topic-selection/topic-selection-styled.js +42 -0
- package/dist/features/trial-session/comps/topic-selection/topic-selection-styled.js.map +1 -0
- package/dist/features/trial-session/comps/topic-selection/topic-selection.js +84 -0
- package/dist/features/trial-session/comps/topic-selection/topic-selection.js.map +1 -0
- package/dist/features/trial-session/comps/whiteboard/whiteboard-styled.js +21 -0
- package/dist/features/trial-session/comps/whiteboard/whiteboard-styled.js.map +1 -0
- package/dist/features/trial-session/comps/whiteboard/whiteboard.js +99 -0
- package/dist/features/trial-session/comps/whiteboard/whiteboard.js.map +1 -0
- package/dist/features/trial-session/comps/worksheet/worksheet.js +35 -33
- package/dist/features/trial-session/comps/worksheet/worksheet.js.map +1 -1
- package/dist/features/trial-session/context/trial-session-context.js +2 -0
- package/dist/features/trial-session/context/trial-session-context.js.map +1 -1
- package/dist/features/trial-session/helper.js +70 -64
- package/dist/features/trial-session/helper.js.map +1 -1
- package/dist/features/trial-session/hooks/use-trial-session-navigation.js +190 -158
- package/dist/features/trial-session/hooks/use-trial-session-navigation.js.map +1 -1
- package/dist/features/trial-session/right-panel/right-panel-styled.js +8 -8
- package/dist/features/trial-session/right-panel/right-panel-styled.js.map +1 -1
- package/dist/features/trial-session/right-panel/slide-components-map.js +42 -36
- package/dist/features/trial-session/right-panel/slide-components-map.js.map +1 -1
- package/dist/features/trial-session/trial-session-constants.js +22 -18
- package/dist/features/trial-session/trial-session-constants.js.map +1 -1
- package/dist/features/trial-session/trial-session-types.js.map +1 -1
- package/dist/features/trial-session/trial-session-view.js +82 -77
- package/dist/features/trial-session/trial-session-view.js.map +1 -1
- package/dist/features/trial-session/trial-session.js +38 -38
- package/dist/features/trial-session/trial-session.js.map +1 -1
- package/dist/features/ui/inputs/checkbox-input/checkbox-input.js +21 -21
- package/dist/features/ui/inputs/checkbox-input/checkbox-input.js.map +1 -1
- package/dist/features/ui/inputs/checkbox-input-list/checkbox-input-list.js +12 -12
- package/dist/features/ui/inputs/checkbox-input-list/checkbox-input-list.js.map +1 -1
- package/dist/features/ui/theme/clrs.js +1 -0
- package/dist/features/ui/theme/clrs.js.map +1 -1
- package/dist/features/worksheet/worksheet/mocks/activity.js +6 -0
- package/dist/features/worksheet/worksheet/mocks/activity.js.map +1 -0
- package/dist/features/worksheet/worksheet/mocks/signed-requests.js +5 -0
- package/dist/features/worksheet/worksheet/mocks/signed-requests.js.map +1 -0
- package/dist/features/worksheet/worksheet/stories/use-canvas-sync-broker-story.js +57 -0
- package/dist/features/worksheet/worksheet/stories/use-canvas-sync-broker-story.js.map +1 -0
- package/dist/features/worksheet/worksheet/stories/worksheet-story-container.js +263 -0
- package/dist/features/worksheet/worksheet/stories/worksheet-story-container.js.map +1 -0
- package/dist/features/worksheet/worksheet/stories/worksheet-student.js +177 -0
- package/dist/features/worksheet/worksheet/stories/worksheet-student.js.map +1 -0
- package/dist/features/worksheet/worksheet/stories/worksheet-teacher.js +268 -0
- package/dist/features/worksheet/worksheet/stories/worksheet-teacher.js.map +1 -0
- package/dist/features/worksheet/worksheet/worksheet-behavior-helper.js +51 -32
- package/dist/features/worksheet/worksheet/worksheet-behavior-helper.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-helpers.js +38 -37
- package/dist/features/worksheet/worksheet/worksheet-helpers.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-store/helpers/get-computed-properties.js +36 -35
- package/dist/features/worksheet/worksheet/worksheet-store/helpers/get-computed-properties.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-store/helpers/get-questions-from-items.js +61 -58
- package/dist/features/worksheet/worksheet/worksheet-store/helpers/get-questions-from-items.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-types.js.map +1 -1
- package/dist/features/worksheet/worksheet-preview/hooks/use-worksheet-layout.js +32 -30
- package/dist/features/worksheet/worksheet-preview/hooks/use-worksheet-layout.js.map +1 -1
- package/dist/index.d.ts +12 -6
- package/dist/index.js +148 -150
- package/dist/index.js.map +1 -1
- package/dist/node_modules/uuid/dist/esm-browser/regex.js +5 -0
- package/dist/node_modules/uuid/dist/esm-browser/regex.js.map +1 -0
- package/dist/node_modules/uuid/dist/esm-browser/rng.js +2 -3
- package/dist/node_modules/uuid/dist/esm-browser/rng.js.map +1 -1
- package/dist/node_modules/uuid/dist/esm-browser/stringify.js +10 -6
- package/dist/node_modules/uuid/dist/esm-browser/stringify.js.map +1 -1
- package/dist/node_modules/uuid/dist/esm-browser/v4.js +9 -12
- package/dist/node_modules/uuid/dist/esm-browser/v4.js.map +1 -1
- package/dist/node_modules/uuid/dist/esm-browser/validate.js +8 -0
- package/dist/node_modules/uuid/dist/esm-browser/validate.js.map +1 -0
- package/dist/types/models/worksheet.js +1 -1
- package/dist/types/models/worksheet.js.map +1 -1
- package/package.json +1 -1
- package/dist/features/sheets/utils/is-v3-worksheet.js +0 -55
- package/dist/features/sheets/utils/is-v3-worksheet.js.map +0 -1
- package/dist/node_modules/uuid/dist/esm-browser/native.js +0 -7
- package/dist/node_modules/uuid/dist/esm-browser/native.js.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
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
|
|
9
|
-
const
|
|
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
|
|
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:
|
|
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
|
|
54
|
+
const x = (e) => e.reduce(
|
|
55
55
|
(t, r) => ({
|
|
56
56
|
...t,
|
|
57
|
-
[r.response_id]:
|
|
57
|
+
[r.response_id]: A(e, r.response_id)
|
|
58
58
|
}),
|
|
59
59
|
{}
|
|
60
|
-
),
|
|
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
|
-
) ?
|
|
66
|
-
maxQuestionWidth:
|
|
67
|
-
actionbarHeight: r === "bottom" ?
|
|
65
|
+
) ? d : I,
|
|
66
|
+
maxQuestionWidth: d,
|
|
67
|
+
actionbarHeight: r === "bottom" ? T : 0
|
|
68
68
|
};
|
|
69
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
201
|
+
}, z = (e) => {
|
|
202
202
|
switch (e) {
|
|
203
203
|
case "learning":
|
|
204
|
-
return
|
|
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
|
|
216
|
+
return _;
|
|
217
217
|
}
|
|
218
|
-
},
|
|
219
|
-
(r) => typeof r == "string" && r.length >
|
|
220
|
-
) : !1,
|
|
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
|
-
},
|
|
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
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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
|
-
|
|
250
|
+
V as getPuzzleWorksheetBackgroundColor,
|
|
251
251
|
F as getQuestionBackgroundImage,
|
|
252
252
|
G as getQuestionBorderColor,
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
P as
|
|
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,IA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,IAAqC,CAACC,MACtC,MAAM,QAAQA,EAAS,KAAK,IACZA,EAAS,MAAM;AAAA,EAC/B,CAAQxC,MAAA,OAAOA,KAAS,YAAYA,EAAK,SAASyC;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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A,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,QAAA1B,IAA8B0B,EAAmB;AAEhD,SAAA1B,MAAgC,WAAWA,MAAgC;AACpF;"}
|
package/dist/features/worksheet/worksheet/worksheet-store/helpers/get-computed-properties.js
CHANGED
|
@@ -1,73 +1,74 @@
|
|
|
1
|
-
import { getInitialResponses as y, getInitialQuestionId as v, getWorksheetDimensions as
|
|
2
|
-
import { getLastAttemptableQuestionIndex as
|
|
3
|
-
import { getQuestionsFromItems as
|
|
4
|
-
import { getLastUnlockedQuestionIndex as
|
|
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,
|
|
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:
|
|
14
|
+
userType: a,
|
|
15
15
|
initialResponseId: Q,
|
|
16
16
|
initialItemIndex: g
|
|
17
|
-
} = n, { initialQuestion: p } = s,
|
|
17
|
+
} = n, { initialQuestion: p } = s, i = (e == null ? void 0 : e.questions) ?? h(d, {
|
|
18
18
|
nodeType: n.nodeType,
|
|
19
|
-
activityType: n.activityType
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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:
|
|
25
|
+
userType: a,
|
|
25
26
|
inClass: !!n.inClass
|
|
26
|
-
}),
|
|
27
|
-
questions:
|
|
27
|
+
}), o = (e == null ? void 0 : e.initialQuestionId) ?? v({
|
|
28
|
+
questions: i,
|
|
28
29
|
initialQuestion: p,
|
|
29
30
|
lastUnlockedQuestionIndex: l,
|
|
30
|
-
lastAttemptableQuestionIndex:
|
|
31
|
-
questions:
|
|
32
|
-
responses:
|
|
31
|
+
lastAttemptableQuestionIndex: C({
|
|
32
|
+
questions: i,
|
|
33
|
+
responses: t,
|
|
33
34
|
behavior: s,
|
|
34
|
-
userType:
|
|
35
|
+
userType: a,
|
|
35
36
|
inClass: !!n.inClass
|
|
36
37
|
}),
|
|
37
38
|
initialResponseId: Q,
|
|
38
39
|
initialItemIndex: g
|
|
39
|
-
}), u = (
|
|
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
|
-
!
|
|
44
|
+
!e && i[c] && n.onActiveQuestionChange && n.onActiveQuestionChange(i[c]);
|
|
44
45
|
}, 0), {
|
|
45
|
-
questions:
|
|
46
|
+
questions: i,
|
|
46
47
|
renderableQuestions: R({
|
|
47
|
-
questions:
|
|
48
|
-
userType:
|
|
48
|
+
questions: i,
|
|
49
|
+
userType: a,
|
|
49
50
|
lastUnlockedQuestionIndex: l
|
|
50
51
|
}),
|
|
51
|
-
responses:
|
|
52
|
+
responses: t,
|
|
52
53
|
lastUnlockedQuestionIndex: l,
|
|
53
|
-
initialQuestionId:
|
|
54
|
+
initialQuestionId: o,
|
|
54
55
|
activeQuestionId: u,
|
|
55
|
-
activeQuestionIndex:
|
|
56
|
-
summaryVisible:
|
|
57
|
-
calculatorVisible:
|
|
58
|
-
scribblingEnabled:
|
|
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:
|
|
61
|
-
responses:
|
|
62
|
-
prevResponses: (
|
|
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:
|
|
68
|
+
userType: a
|
|
68
69
|
}),
|
|
69
|
-
scrolledToInitialQuestion: (
|
|
70
|
-
...
|
|
70
|
+
scrolledToInitialQuestion: (e == null ? void 0 : e.scrolledToInitialQuestion) ?? !1,
|
|
71
|
+
...T(d, I)
|
|
71
72
|
};
|
|
72
73
|
};
|
|
73
74
|
export {
|
package/dist/features/worksheet/worksheet/worksheet-store/helpers/get-computed-properties.js.map
CHANGED
|
@@ -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","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,EAAA,
|
|
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;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AuBvB,GAAiBG,CAAM;AAAA,EAAA;AAErD;"}
|
package/dist/features/worksheet/worksheet/worksheet-store/helpers/get-questions-from-items.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { EWorksheetActivity as
|
|
2
|
-
import { OPTIONAL_ITEM_TYPES as
|
|
3
|
-
import { isConceptIntroWidget as
|
|
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
|
|
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
|
-
},
|
|
33
|
-
const [
|
|
34
|
-
return !
|
|
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
|
-
[
|
|
36
|
+
[b.toLowerCase()]: v
|
|
37
37
|
};
|
|
38
|
-
}, {}),
|
|
39
|
-
const
|
|
40
|
-
|
|
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:
|
|
46
|
-
item_display_number:
|
|
48
|
+
item_number: i,
|
|
49
|
+
item_display_number: i + 1,
|
|
47
50
|
item_tags: t.tags ?? [],
|
|
48
|
-
item_tags_map:
|
|
49
|
-
question_number:
|
|
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" && (
|
|
56
|
-
return c.reduce((s, t,
|
|
57
|
-
var
|
|
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:
|
|
60
|
-
(_, u,
|
|
61
|
-
const
|
|
62
|
-
if (!
|
|
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
|
|
65
|
-
return r = r ||
|
|
66
|
-
...
|
|
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:
|
|
69
|
-
item_display_number:
|
|
70
|
-
section_name:
|
|
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 ?
|
|
73
|
-
question_number:
|
|
74
|
-
total_questions:
|
|
75
|
-
can_scribble: !(n === "overview" ||
|
|
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,
|
|
81
|
-
const _ = (
|
|
82
|
-
if ((u === "practice" || u === "practice-basic" || u === "practice-regular" || u === "exit-ticket" || u === "advanced") && u !==
|
|
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
|
-
...
|
|
89
|
+
...p[0],
|
|
87
90
|
metadata: {
|
|
88
|
-
...
|
|
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:
|
|
99
|
+
is_non_question: l === S.LESSON_V3_1,
|
|
97
100
|
can_scribble: !1
|
|
98
101
|
},
|
|
99
|
-
...
|
|
102
|
+
...p ?? []
|
|
100
103
|
];
|
|
101
104
|
}
|
|
102
|
-
return [...s, ...
|
|
105
|
+
return [...s, ...p ?? []];
|
|
103
106
|
}, []);
|
|
104
|
-
const
|
|
105
|
-
const { content:
|
|
106
|
-
(
|
|
107
|
-
const
|
|
108
|
-
if (!
|
|
109
|
-
throw new Error(`Question not found for the response id: ${
|
|
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
|
-
...
|
|
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
|
|
122
|
-
var a,
|
|
123
|
-
const e =
|
|
124
|
-
if (e && t[e] === void 0 && (t[e] = s.length, s.push(e)),
|
|
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 =
|
|
127
|
-
return n >
|
|
128
|
-
}).map((
|
|
129
|
-
const r = t[
|
|
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
|
-
...
|
|
134
|
+
...i,
|
|
132
135
|
item_display_number: r * 3 + e.length
|
|
133
136
|
};
|
|
134
137
|
});
|
|
135
138
|
}
|
|
136
|
-
return
|
|
139
|
+
return v;
|
|
137
140
|
};
|
|
138
141
|
export {
|
|
139
|
-
|
|
142
|
+
y as getQuestionsFromItems
|
|
140
143
|
};
|
|
141
144
|
//# sourceMappingURL=get-questions-from-items.js.map
|