@cuemath/leap 4.1.2 → 4.1.3
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/fraud-detection/hooks/use-report-fraud.js +51 -67
- package/dist/features/fraud-detection/hooks/use-report-fraud.js.map +1 -1
- package/dist/features/math-fit/math-fit-report/comps/score-section/score-section.js +34 -35
- package/dist/features/math-fit/math-fit-report/comps/score-section/score-section.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-helpers.js +41 -32
- package/dist/features/worksheet/worksheet/worksheet-helpers.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-types.js.map +1 -1
- package/dist/features/worksheet/worksheet-preview/worksheet-preview-view.js +66 -71
- package/dist/features/worksheet/worksheet-preview/worksheet-preview-view.js.map +1 -1
- package/package.json +1 -1
- package/dist/features/fraud-detection/api/send-email.js +0 -9
- package/dist/features/fraud-detection/api/send-email.js.map +0 -1
- package/dist/features/fraud-detection/hooks/report-fraud-helper.js +0 -65
- package/dist/features/fraud-detection/hooks/report-fraud-helper.js.map +0 -1
|
@@ -1,99 +1,83 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { useLocalPeer as
|
|
3
|
-
import { useUIContext as
|
|
4
|
-
import { base64ToFile as
|
|
5
|
-
import { FRAUD_DETECTION_ANALYTICS_EVENTS as
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
import { generateEmailBody as v } from "./report-fraud-helper.js";
|
|
9
|
-
const w = { type: "class_fraud_login" }, x = ({
|
|
1
|
+
import { useState as S, useCallback as c, useEffect as T } from "react";
|
|
2
|
+
import { useLocalPeer as l, useRemotePeers as $, useCaptureMediaStreamImage as U } from "@cuemath/av";
|
|
3
|
+
import { useUIContext as N } from "../../ui/context/context.js";
|
|
4
|
+
import { base64ToFile as F } from "../fraud-alert-modal/fraud-alert-modal-helpers.js";
|
|
5
|
+
import { FRAUD_DETECTION_ANALYTICS_EVENTS as L } from "./report-fraud-analytics.js";
|
|
6
|
+
import k from "../../hooks/use-s3-helper/use-s3-helper.js";
|
|
7
|
+
const v = { type: "class_fraud_login" }, w = ({
|
|
10
8
|
teacherId: n,
|
|
11
|
-
studentId:
|
|
12
|
-
studentClassroomId:
|
|
13
|
-
teacherClassroomId:
|
|
14
|
-
classStartTs:
|
|
15
|
-
studentName:
|
|
9
|
+
studentId: t,
|
|
10
|
+
studentClassroomId: u,
|
|
11
|
+
teacherClassroomId: _,
|
|
12
|
+
classStartTs: o,
|
|
13
|
+
studentName: m
|
|
16
14
|
}) => {
|
|
17
|
-
const { onEvent:
|
|
18
|
-
studentId:
|
|
19
|
-
query:
|
|
20
|
-
}),
|
|
21
|
-
(
|
|
22
|
-
|
|
23
|
-
teacher_url:
|
|
24
|
-
student_url:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}), s({
|
|
32
|
-
recipient_emails: ["ayush.singhal@cuemath.com"],
|
|
33
|
-
subject: "Breach of Professional Standards: Fraud Login",
|
|
34
|
-
body: v({
|
|
35
|
-
teacherId: n,
|
|
36
|
-
studentName: f,
|
|
37
|
-
studentId: a,
|
|
38
|
-
classStartTs: u,
|
|
39
|
-
teacherClassroomId: t,
|
|
40
|
-
studentClassroomId: r,
|
|
41
|
-
teacherUrl: o[0] || "",
|
|
42
|
-
studentUrl: o[1] || ""
|
|
43
|
-
})
|
|
15
|
+
const { onEvent: r } = N(), [f, g] = S(!1), e = l(), a = $().find((i) => i.userId === n), s = U(), p = k({
|
|
16
|
+
studentId: t,
|
|
17
|
+
query: v
|
|
18
|
+
}), E = c(
|
|
19
|
+
(i) => {
|
|
20
|
+
r(L.FRAUD_LOGIN_TEACHER_ENTERED_CLASS_AS_STUDENT, {
|
|
21
|
+
teacher_url: i[0],
|
|
22
|
+
student_url: i[1],
|
|
23
|
+
class_start_ts: new Date(o * 1e3),
|
|
24
|
+
teacher_id: n,
|
|
25
|
+
student_id: t,
|
|
26
|
+
student_classroom_id: u,
|
|
27
|
+
student_name: m,
|
|
28
|
+
teacher_classroom_id: _
|
|
44
29
|
});
|
|
45
30
|
},
|
|
46
31
|
[
|
|
47
|
-
|
|
48
|
-
m,
|
|
49
|
-
s,
|
|
32
|
+
o,
|
|
50
33
|
r,
|
|
51
|
-
|
|
52
|
-
f,
|
|
34
|
+
u,
|
|
53
35
|
t,
|
|
36
|
+
m,
|
|
37
|
+
_,
|
|
54
38
|
n
|
|
55
39
|
]
|
|
56
|
-
), R =
|
|
57
|
-
|
|
58
|
-
}, [
|
|
40
|
+
), R = c(() => {
|
|
41
|
+
r("fraud_detection_images_failed", { classStartTs: o, teacherId: n, studentId: t });
|
|
42
|
+
}, [o, r, t, n]);
|
|
59
43
|
return T(() => {
|
|
60
|
-
if (!
|
|
44
|
+
if (!f || !(a != null && a.id) || !(e != null && e.id))
|
|
61
45
|
return;
|
|
62
|
-
const { image:
|
|
63
|
-
!
|
|
46
|
+
const { image: i } = s(a == null ? void 0 : a.id, "camera"), { image: D } = s(e == null ? void 0 : e.id, "camera"), d = F(i, `teacher-${Date.now()}.png`), A = F(D, `student-${Date.now()}.png`);
|
|
47
|
+
!d || !A || (p({
|
|
64
48
|
fileKey: "media/class_fraud_login/",
|
|
65
|
-
onSuccess:
|
|
49
|
+
onSuccess: E,
|
|
66
50
|
onError: R,
|
|
67
51
|
images: [
|
|
68
52
|
{
|
|
69
|
-
file:
|
|
70
|
-
name: `teacher_${
|
|
53
|
+
file: d,
|
|
54
|
+
name: `teacher_${_}_${n}`,
|
|
71
55
|
url: ""
|
|
72
56
|
},
|
|
73
57
|
{
|
|
74
|
-
file:
|
|
75
|
-
name: `student_${
|
|
58
|
+
file: A,
|
|
59
|
+
name: `student_${u}_${t}`,
|
|
76
60
|
url: ""
|
|
77
61
|
}
|
|
78
62
|
]
|
|
79
63
|
}), g(!1));
|
|
80
64
|
}, [
|
|
81
|
-
|
|
82
|
-
|
|
65
|
+
f,
|
|
66
|
+
s,
|
|
83
67
|
e == null ? void 0 : e.id,
|
|
84
68
|
R,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
a,
|
|
69
|
+
E,
|
|
70
|
+
a == null ? void 0 : a.id,
|
|
71
|
+
u,
|
|
89
72
|
t,
|
|
73
|
+
_,
|
|
90
74
|
n,
|
|
91
|
-
|
|
92
|
-
]),
|
|
75
|
+
p
|
|
76
|
+
]), c(() => {
|
|
93
77
|
g(!0);
|
|
94
78
|
}, []);
|
|
95
|
-
},
|
|
79
|
+
}, Y = w;
|
|
96
80
|
export {
|
|
97
|
-
|
|
81
|
+
Y as default
|
|
98
82
|
};
|
|
99
83
|
//# sourceMappingURL=use-report-fraud.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-report-fraud.js","sources":["../../../../src/features/fraud-detection/hooks/use-report-fraud.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react';\n\nimport { useCaptureMediaStreamImage, useLocalPeer, useRemotePeers } from '@cuemath/av';\n\nimport { useUIContext } from '../../ui/context/context';\nimport { base64ToFile } from '../fraud-alert-modal/fraud-alert-modal-helpers';\nimport { type IUseFraudAlertProps } from './report-fraud-types';\nimport { FRAUD_DETECTION_ANALYTICS_EVENTS } from './report-fraud-analytics';\nimport useS3ImageUploadHelper from '../../hooks/use-s3-helper/use-s3-helper';\
|
|
1
|
+
{"version":3,"file":"use-report-fraud.js","sources":["../../../../src/features/fraud-detection/hooks/use-report-fraud.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react';\n\nimport { useCaptureMediaStreamImage, useLocalPeer, useRemotePeers } from '@cuemath/av';\n\nimport { useUIContext } from '../../ui/context/context';\nimport { base64ToFile } from '../fraud-alert-modal/fraud-alert-modal-helpers';\nimport { type IUseFraudAlertProps } from './report-fraud-types';\nimport { FRAUD_DETECTION_ANALYTICS_EVENTS } from './report-fraud-analytics';\nimport useS3ImageUploadHelper from '../../hooks/use-s3-helper/use-s3-helper';\n\nconst QUERY = { type: 'class_fraud_login' };\n\nconst useReportFraud = ({\n teacherId,\n studentId,\n studentClassroomId,\n teacherClassroomId,\n classStartTs,\n studentName,\n}: IUseFraudAlertProps) => {\n const { onEvent } = useUIContext();\n\n const [canTrackEvent, setCanTrackEvent] = useState(false);\n const localpeer = useLocalPeer();\n const remotePeer = useRemotePeers().find(peer => peer.userId === teacherId);\n const captureMediaStreamImage = useCaptureMediaStreamImage();\n const uploadImages = useS3ImageUploadHelper({\n studentId,\n query: QUERY,\n });\n const onSuccess = useCallback(\n (urls: string[]) => {\n onEvent(FRAUD_DETECTION_ANALYTICS_EVENTS.FRAUD_LOGIN_TEACHER_ENTERED_CLASS_AS_STUDENT, {\n teacher_url: urls[0],\n student_url: urls[1],\n class_start_ts: new Date(classStartTs * 1000),\n teacher_id: teacherId,\n student_id: studentId,\n student_classroom_id: studentClassroomId,\n student_name: studentName,\n teacher_classroom_id: teacherClassroomId,\n });\n },\n [\n classStartTs,\n onEvent,\n studentClassroomId,\n studentId,\n studentName,\n teacherClassroomId,\n teacherId,\n ],\n );\n\n const onError = useCallback(() => {\n onEvent('fraud_detection_images_failed', { classStartTs, teacherId, studentId });\n }, [classStartTs, onEvent, studentId, teacherId]);\n\n useEffect(() => {\n if (!canTrackEvent || !remotePeer?.id || !localpeer?.id) {\n return;\n }\n\n const { image: teacherImage } = captureMediaStreamImage(remotePeer?.id, 'camera');\n const { image: studentImage } = captureMediaStreamImage(localpeer?.id, 'camera');\n const teacherFile = base64ToFile(teacherImage, `teacher-${Date.now()}.png`);\n const studentFile = base64ToFile(studentImage, `student-${Date.now()}.png`);\n\n if (!teacherFile || !studentFile) {\n return;\n }\n\n uploadImages({\n fileKey: `media/class_fraud_login/`,\n onSuccess,\n onError,\n images: [\n {\n file: teacherFile,\n name: `teacher_${teacherClassroomId}_${teacherId}`,\n url: '',\n },\n {\n file: studentFile,\n name: `student_${studentClassroomId}_${studentId}`,\n url: '',\n },\n ],\n });\n\n setCanTrackEvent(false);\n }, [\n canTrackEvent,\n captureMediaStreamImage,\n localpeer?.id,\n onError,\n onSuccess,\n remotePeer?.id,\n studentClassroomId,\n studentId,\n teacherClassroomId,\n teacherId,\n uploadImages,\n ]);\n\n const captureAndReportFraudImages = useCallback(() => {\n setCanTrackEvent(true);\n }, []);\n\n return captureAndReportFraudImages;\n};\n\nexport default useReportFraud;\n"],"names":["QUERY","useReportFraud","teacherId","studentId","studentClassroomId","teacherClassroomId","classStartTs","studentName","onEvent","useUIContext","canTrackEvent","setCanTrackEvent","useState","localpeer","useLocalPeer","remotePeer","useRemotePeers","peer","captureMediaStreamImage","useCaptureMediaStreamImage","uploadImages","useS3ImageUploadHelper","onSuccess","useCallback","urls","FRAUD_DETECTION_ANALYTICS_EVENTS","onError","useEffect","teacherImage","studentImage","teacherFile","base64ToFile","studentFile","useReportFraud$1"],"mappings":";;;;;;AAUA,MAAMA,IAAQ,EAAE,MAAM,uBAEhBC,IAAiB,CAAC;AAAA,EACtB,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AACF,MAA2B;AACnB,QAAA,EAAE,SAAAC,MAAYC,KAEd,CAACC,GAAeC,CAAgB,IAAIC,EAAS,EAAK,GAClDC,IAAYC,KACZC,IAAaC,EAAe,EAAE,KAAK,CAAQC,MAAAA,EAAK,WAAWf,CAAS,GACpEgB,IAA0BC,KAC1BC,IAAeC,EAAuB;AAAA,IAC1C,WAAAlB;AAAA,IACA,OAAOH;AAAA,EAAA,CACR,GACKsB,IAAYC;AAAA,IAChB,CAACC,MAAmB;AAClB,MAAAhB,EAAQiB,EAAiC,8CAA8C;AAAA,QACrF,aAAaD,EAAK,CAAC;AAAA,QACnB,aAAaA,EAAK,CAAC;AAAA,QACnB,gBAAgB,IAAI,KAAKlB,IAAe,GAAI;AAAA,QAC5C,YAAYJ;AAAA,QACZ,YAAYC;AAAA,QACZ,sBAAsBC;AAAA,QACtB,c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;AAAA,IACAD;AAAA,IACAE;AAAA,IACAH;AAAA,IACAkB;AAAA,EAAA,CACD,GAEmCG,EAAY,MAAM;AACpD,IAAAZ,EAAiB,EAAI;AAAA,EACvB,GAAG,CAAE,CAAA;AAGP,GAEAsB,IAAehC;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { memo as X, useCallback as _, Fragment as w } from "react";
|
|
3
|
-
import { useTheme as
|
|
4
|
-
import
|
|
3
|
+
import { useTheme as G } from "styled-components";
|
|
4
|
+
import L from "../../../../ui/buttons/button/button.js";
|
|
5
5
|
import o from "../../../../ui/layout/flex-view.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import a from "../../../../ui/text/text.js";
|
|
7
|
+
import y from "../score-badge/score-badge.js";
|
|
8
8
|
import { Divider as K } from "./score-section-styled.js";
|
|
9
9
|
import g from "../../../../ui/separator/separator.js";
|
|
10
10
|
import { getQuestionStatusBgColor as j } from "../../math-fit-report-helpers.js";
|
|
@@ -12,33 +12,33 @@ import { EQuestionState as u } from "../../../math-fit-overview/math-fit-overvie
|
|
|
12
12
|
import { EDeviceType as k } from "../../../../ui/theme/constants.js";
|
|
13
13
|
import M from "../../../../ui/tag/tag.js";
|
|
14
14
|
const V = X(function({
|
|
15
|
-
onReviewSection:
|
|
16
|
-
section:
|
|
17
|
-
sheet:
|
|
18
|
-
compactView:
|
|
15
|
+
onReviewSection: n,
|
|
16
|
+
section: l,
|
|
17
|
+
sheet: d,
|
|
18
|
+
compactView: m = !1,
|
|
19
19
|
showReviewButton: x = !0
|
|
20
20
|
}) {
|
|
21
21
|
const {
|
|
22
|
-
title:
|
|
23
|
-
score:
|
|
24
|
-
scoreChange:
|
|
25
|
-
sessionId:
|
|
26
|
-
isIncomplete:
|
|
27
|
-
sectionNumber:
|
|
22
|
+
title: C,
|
|
23
|
+
score: f,
|
|
24
|
+
scoreChange: T,
|
|
25
|
+
sessionId: p,
|
|
26
|
+
isIncomplete: $ = !1,
|
|
27
|
+
sectionNumber: b,
|
|
28
28
|
topics: I
|
|
29
|
-
} =
|
|
30
|
-
|
|
31
|
-
}, [
|
|
29
|
+
} = l, { device: A } = G(), s = A <= k.MOBILE, h = [...I ?? []].sort((t, c) => t.miniGoal.order - c.miniGoal.order), E = s || m ? "column" : "row", S = s || m ? "" : "center", B = s || m ? 0.5 : 0, D = _(() => {
|
|
30
|
+
l.sheet && n && n(d, p);
|
|
31
|
+
}, [n, l.sheet, d, p]);
|
|
32
32
|
return /* @__PURE__ */ r(o, { children: [
|
|
33
33
|
/* @__PURE__ */ r(o, { $flexDirection: "row", $alignItems: "center", children: [
|
|
34
|
-
/* @__PURE__ */ r(
|
|
35
|
-
|
|
34
|
+
/* @__PURE__ */ r(a, { $renderAs: "ab2-bold", $color: "BLACK_1", children: [
|
|
35
|
+
C,
|
|
36
36
|
":"
|
|
37
37
|
] }),
|
|
38
38
|
/* @__PURE__ */ e(g, { width: 4 }),
|
|
39
|
-
|
|
39
|
+
$ ? /* @__PURE__ */ e(M, { text: "INCOMPLETE", size: "8px" }) : f && /* @__PURE__ */ e(y, { score: f, maxScore: 10, scoreChange: T })
|
|
40
40
|
] }),
|
|
41
|
-
/* @__PURE__ */ e(o, { $flexRowGapX: 0.5, $gapX: 0.75, children: h.map((
|
|
41
|
+
/* @__PURE__ */ e(o, { $flexRowGapX: 0.5, $gapX: 0.75, children: h.map((t, c) => /* @__PURE__ */ r(w, { children: [
|
|
42
42
|
/* @__PURE__ */ r(
|
|
43
43
|
o,
|
|
44
44
|
{
|
|
@@ -47,8 +47,8 @@ const V = X(function({
|
|
|
47
47
|
$alignItems: S,
|
|
48
48
|
$flexRowGapX: B,
|
|
49
49
|
children: [
|
|
50
|
-
/* @__PURE__ */ e(
|
|
51
|
-
/* @__PURE__ */ e(o, { $flexGapX: 0.5, $flexDirection: "row", $flexWrap: !0, children:
|
|
50
|
+
/* @__PURE__ */ e(a, { $renderAs: "ub2", $color: $ ? "BLACK_T_38" : "BLACK_1", children: t.name }),
|
|
51
|
+
/* @__PURE__ */ e(o, { $flexGapX: 0.5, $flexDirection: "row", $flexWrap: !0, children: t.miniGoal.items.map((i) => /* @__PURE__ */ e(
|
|
52
52
|
o,
|
|
53
53
|
{
|
|
54
54
|
$heightX: 1.25,
|
|
@@ -56,36 +56,35 @@ const V = X(function({
|
|
|
56
56
|
$alignItems: "center",
|
|
57
57
|
$justifyContent: "center",
|
|
58
58
|
$borderRadiusX: 1,
|
|
59
|
-
$background: j(
|
|
59
|
+
$background: j(i.state),
|
|
60
60
|
children: /* @__PURE__ */ r(
|
|
61
|
-
|
|
61
|
+
a,
|
|
62
62
|
{
|
|
63
63
|
$renderAs: "ub4",
|
|
64
|
-
$color:
|
|
64
|
+
$color: i.state === u.SKIPPED || i.state === u.UNATTEMPTED ? "BLACK_T_38" : "WHITE",
|
|
65
65
|
children: [
|
|
66
66
|
"Q",
|
|
67
|
-
|
|
67
|
+
i.order
|
|
68
68
|
]
|
|
69
69
|
}
|
|
70
70
|
)
|
|
71
71
|
},
|
|
72
|
-
|
|
72
|
+
i.item_reference
|
|
73
73
|
)) })
|
|
74
74
|
]
|
|
75
75
|
}
|
|
76
76
|
),
|
|
77
|
-
|
|
78
|
-
] },
|
|
77
|
+
c !== h.length - 1 && /* @__PURE__ */ e(K, {})
|
|
78
|
+
] }, t.name)) }),
|
|
79
79
|
x && /* @__PURE__ */ r(o, { $alignItems: "center", children: [
|
|
80
80
|
/* @__PURE__ */ e(g, { heightX: 0.75 }),
|
|
81
81
|
/* @__PURE__ */ e(
|
|
82
|
-
|
|
82
|
+
L,
|
|
83
83
|
{
|
|
84
|
-
label: `Review Section ${
|
|
85
|
-
renderAs:
|
|
84
|
+
label: `Review Section ${b}`,
|
|
85
|
+
renderAs: "primary",
|
|
86
86
|
size: "small",
|
|
87
|
-
onClick: D
|
|
88
|
-
disabled: t
|
|
87
|
+
onClick: D
|
|
89
88
|
}
|
|
90
89
|
)
|
|
91
90
|
] })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"score-section.js","sources":["../../../../../../src/features/math-fit/math-fit-report/comps/score-section/score-section.tsx"],"sourcesContent":["import { Fragment, memo, useCallback, type FC } from 'react';\nimport { useTheme } from 'styled-components';\n\nimport Button from '../../../../ui/buttons/button/button';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport ScoreBadge from '../score-badge/score-badge';\nimport type { IScoreSectionProps } from './score-section-types';\nimport * as Styled from './score-section-styled';\nimport Separator from '../../../../ui/separator/separator';\nimport { getQuestionStatusBgColor } from '../../math-fit-report-helpers';\nimport { EQuestionState } from '../../../math-fit-overview/math-fit-overview-types';\nimport { EDeviceType } from '../../../../ui/theme/constants';\nimport Tag from '../../../../ui/tag/tag';\n\nconst ScoreSection: FC<IScoreSectionProps> = memo(function ScoreSection({\n onReviewSection,\n section,\n sheet,\n compactView = false,\n showReviewButton = true,\n}) {\n const {\n title,\n score,\n scoreChange,\n sessionId,\n isIncomplete = false,\n sectionNumber,\n topics,\n } = section;\n\n const { device } = useTheme();\n const isMobile = device <= EDeviceType.MOBILE;\n\n const sortedTopics = [...(topics ?? [])].sort((a, b) => a.miniGoal.order - b.miniGoal.order);\n const layoutDirection = isMobile || compactView ? 'column' : 'row';\n const alignment = isMobile || compactView ? '' : 'center';\n const gap = isMobile || compactView ? 0.5 : 0;\n\n const onClickReview = useCallback(() => {\n if (
|
|
1
|
+
{"version":3,"file":"score-section.js","sources":["../../../../../../src/features/math-fit/math-fit-report/comps/score-section/score-section.tsx"],"sourcesContent":["import { Fragment, memo, useCallback, type FC } from 'react';\nimport { useTheme } from 'styled-components';\n\nimport Button from '../../../../ui/buttons/button/button';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport ScoreBadge from '../score-badge/score-badge';\nimport type { IScoreSectionProps } from './score-section-types';\nimport * as Styled from './score-section-styled';\nimport Separator from '../../../../ui/separator/separator';\nimport { getQuestionStatusBgColor } from '../../math-fit-report-helpers';\nimport { EQuestionState } from '../../../math-fit-overview/math-fit-overview-types';\nimport { EDeviceType } from '../../../../ui/theme/constants';\nimport Tag from '../../../../ui/tag/tag';\n\nconst ScoreSection: FC<IScoreSectionProps> = memo(function ScoreSection({\n onReviewSection,\n section,\n sheet,\n compactView = false,\n showReviewButton = true,\n}) {\n const {\n title,\n score,\n scoreChange,\n sessionId,\n isIncomplete = false,\n sectionNumber,\n topics,\n } = section;\n\n const { device } = useTheme();\n const isMobile = device <= EDeviceType.MOBILE;\n\n const sortedTopics = [...(topics ?? [])].sort((a, b) => a.miniGoal.order - b.miniGoal.order);\n const layoutDirection = isMobile || compactView ? 'column' : 'row';\n const alignment = isMobile || compactView ? '' : 'center';\n const gap = isMobile || compactView ? 0.5 : 0;\n\n const onClickReview = useCallback(() => {\n if (section.sheet && onReviewSection) {\n onReviewSection(sheet, sessionId);\n }\n }, [onReviewSection, section.sheet, sheet, sessionId]);\n\n return (\n <FlexView>\n <FlexView $flexDirection=\"row\" $alignItems=\"center\">\n <Text $renderAs=\"ab2-bold\" $color=\"BLACK_1\">\n {title}:\n </Text>\n <Separator width={4} />\n {isIncomplete ? (\n <Tag text=\"INCOMPLETE\" size=\"8px\" />\n ) : (\n score && <ScoreBadge score={score} maxScore={10} scoreChange={scoreChange} />\n )}\n </FlexView>\n <FlexView $flexRowGapX={0.5} $gapX={0.75}>\n {sortedTopics.map((topic, index) => (\n <Fragment key={topic.name}>\n <FlexView\n $flexDirection={layoutDirection}\n $justifyContent=\"space-between\"\n $alignItems={alignment}\n $flexRowGapX={gap}\n >\n <Text $renderAs=\"ub2\" $color={isIncomplete ? 'BLACK_T_38' : 'BLACK_1'}>\n {topic.name}\n </Text>\n <FlexView $flexGapX={0.5} $flexDirection=\"row\" $flexWrap>\n {topic.miniGoal.items.map(question => (\n <FlexView\n key={question.item_reference}\n $heightX={1.25}\n $gutterX={0.5}\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $borderRadiusX={1}\n $background={getQuestionStatusBgColor(question.state)}\n >\n <Text\n $renderAs=\"ub4\"\n $color={\n question.state === EQuestionState.SKIPPED ||\n question.state === EQuestionState.UNATTEMPTED\n ? 'BLACK_T_38'\n : 'WHITE'\n }\n >\n Q{question.order}\n </Text>\n </FlexView>\n ))}\n </FlexView>\n </FlexView>\n {index !== sortedTopics.length - 1 && <Styled.Divider />}\n </Fragment>\n ))}\n </FlexView>\n {showReviewButton && (\n <FlexView $alignItems=\"center\">\n <Separator heightX={0.75} />\n <Button\n label={`Review Section ${sectionNumber}`}\n renderAs=\"primary\"\n size=\"small\"\n onClick={onClickReview}\n />\n </FlexView>\n )}\n </FlexView>\n );\n});\n\nexport default ScoreSection;\n"],"names":["ScoreSection","memo","onReviewSection","section","sheet","compactView","showReviewButton","title","score","scoreChange","sessionId","isIncomplete","sectionNumber","topics","device","useTheme","isMobile","EDeviceType","sortedTopics","a","b","layoutDirection","alignment","gap","onClickReview","useCallback","FlexView","jsxs","Text","jsx","Separator","Tag","ScoreBadge","topic","index","Fragment","question","getQuestionStatusBgColor","EQuestionState","Styled.Divider","Button"],"mappings":";;;;;;;;;;;;;AAeM,MAAAA,IAAuCC,EAAK,SAAsB;AAAA,EACtE,iBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,kBAAAC,IAAmB;AACrB,GAAG;AACK,QAAA;AAAA,IACJ,OAAAC;AAAA,IACA,OAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC,IAAe;AAAA,IACf,eAAAC;AAAA,IACA,QAAAC;AAAA,EACE,IAAAV,GAEE,EAAE,QAAAW,MAAWC,KACbC,IAAWF,KAAUG,EAAY,QAEjCC,IAAe,CAAC,GAAIL,KAAU,CAAA,CAAG,EAAE,KAAK,CAACM,GAAGC,MAAMD,EAAE,SAAS,QAAQC,EAAE,SAAS,KAAK,GACr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A,gBAEC,UAAU;AAAA,gBACV,UAAU;AAAA,gBACV,aAAY;AAAA,gBACZ,iBAAgB;AAAA,gBAChB,gBAAgB;AAAA,gBAChB,aAAaW,EAAyBD,EAAS,KAAK;AAAA,gBAEpD,UAAA,gBAAAT;AAAA,kBAACC;AAAA,kBAAA;AAAA,oBACC,WAAU;AAAA,oBACV,QACEQ,EAAS,UAAUE,EAAe,WAClCF,EAAS,UAAUE,EAAe,cAC9B,eACA;AAAA,oBAEP,UAAA;AAAA,sBAAA;AAAA,sBACGF,EAAS;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBACb;AAAA,cAAA;AAAA,cAlBKA,EAAS;AAAA,YAoBjB,CAAA,GACH;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,MACCF,MAAUhB,EAAa,SAAS,KAAM,gBAAAW,EAAAU,GAAA,EAAe;AAAA,IApCzC,EAAA,GAAAN,EAAM,IAqCrB,CACD,GACH;AAAA,IACC3B,KACC,gBAAAqB,EAACD,GAAS,EAAA,aAAY,UACpB,UAAA;AAAA,MAAC,gBAAAG,EAAAC,GAAA,EAAU,SAAS,KAAM,CAAA;AAAA,MAC1B,gBAAAD;AAAA,QAACW;AAAA,QAAA;AAAA,UACC,OAAO,kBAAkB5B,CAAa;AAAA,UACtC,UAAS;AAAA,UACT,MAAK;AAAA,UACL,SAASY;AAAA,QAAA;AAAA,MACX;AAAA,IAAA,GACF;AAAA,EAEJ,EAAA,CAAA;AAEJ,CAAC;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
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
|
-
import
|
|
4
|
+
import T from "../../../assets/line-icons/icons/practice.js";
|
|
5
5
|
import C from "../../../assets/line-icons/icons/question-letter.js";
|
|
6
|
-
import
|
|
6
|
+
import I 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 h, QUESTION_WIDTH as d, SPLIT_QUESTION_WIDTH as w, CLOZE_FORMULA_RESPONSE_LIMIT as S } from "./constants.js";
|
|
9
|
+
const O = ({
|
|
10
10
|
questions: e,
|
|
11
11
|
initialQuestion: t,
|
|
12
12
|
initialResponseId: r,
|
|
@@ -15,18 +15,18 @@ const k = ({
|
|
|
15
15
|
lastAttemptableQuestionIndex: c
|
|
16
16
|
}) => {
|
|
17
17
|
var u, l;
|
|
18
|
-
const i = e.slice(0, o + 1), m = e[o],
|
|
18
|
+
const i = e.slice(0, o + 1), m = e[o], g = e[c];
|
|
19
19
|
if (r && i.find((a) => a.response_id === r))
|
|
20
20
|
return r;
|
|
21
21
|
if (typeof n == "number" && n <= m.item_number) {
|
|
22
|
-
const a = e.find((
|
|
22
|
+
const a = e.find((p) => p.item_number === n);
|
|
23
23
|
if (a != null && a.response_id)
|
|
24
24
|
return a.response_id;
|
|
25
25
|
}
|
|
26
26
|
if (t === "FIRST" && ((u = e[0]) != null && u.response_id))
|
|
27
27
|
return e[0].response_id;
|
|
28
28
|
if (t === "CURRENT")
|
|
29
|
-
return
|
|
29
|
+
return g.response_id;
|
|
30
30
|
if ((l = e[0]) != null && l.response_id)
|
|
31
31
|
return e[0].response_id;
|
|
32
32
|
throw new Error("Initial question not found");
|
|
@@ -52,22 +52,22 @@ function v(e, t) {
|
|
|
52
52
|
distractor_rationale_response_level: r.metadata.distractor_rationale_response_level
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
const
|
|
55
|
+
const W = (e) => e.reduce(
|
|
56
56
|
(t, r) => ({
|
|
57
57
|
...t,
|
|
58
58
|
[r.response_id]: v(e, r.response_id)
|
|
59
59
|
}),
|
|
60
60
|
{}
|
|
61
|
-
),
|
|
61
|
+
), k = (e, t) => {
|
|
62
62
|
const { actionBar: r } = t;
|
|
63
63
|
return {
|
|
64
64
|
questionsContainerWidth: !e.some(
|
|
65
65
|
(c) => c.questions.some((i) => i.stimulus_review)
|
|
66
|
-
) ? d :
|
|
66
|
+
) ? d : w,
|
|
67
67
|
maxQuestionWidth: d,
|
|
68
|
-
actionbarHeight: r === "bottom" ?
|
|
68
|
+
actionbarHeight: r === "bottom" ? h : 0
|
|
69
69
|
};
|
|
70
|
-
},
|
|
70
|
+
}, Q = (e, { animation: t = !1, block: r = "start" } = {}) => {
|
|
71
71
|
const n = document.querySelectorAll(`.widget-${e}`)[0];
|
|
72
72
|
n && n.scrollIntoView({
|
|
73
73
|
block: r,
|
|
@@ -86,7 +86,7 @@ const x = (e) => e.reduce(
|
|
|
86
86
|
return !(n && n.score === n.max_score);
|
|
87
87
|
}
|
|
88
88
|
return !1;
|
|
89
|
-
},
|
|
89
|
+
}, U = (e) => {
|
|
90
90
|
window.MathJax = {
|
|
91
91
|
options: {
|
|
92
92
|
enableMenu: !1,
|
|
@@ -129,7 +129,7 @@ const x = (e) => e.reduce(
|
|
|
129
129
|
matchFontHeight: !1
|
|
130
130
|
}
|
|
131
131
|
};
|
|
132
|
-
},
|
|
132
|
+
}, $ = (e) => {
|
|
133
133
|
const { item_type: t, instructor_stimulus: r } = e, n = r == null ? void 0 : r.toLowerCase();
|
|
134
134
|
switch (t) {
|
|
135
135
|
case "overview":
|
|
@@ -149,7 +149,7 @@ const x = (e) => e.reduce(
|
|
|
149
149
|
default:
|
|
150
150
|
return n === "learn" ? "blue" : n === "try" || n === "apply" ? "green" : "yellow";
|
|
151
151
|
}
|
|
152
|
-
},
|
|
152
|
+
}, H = (e) => `https://cuemath-intel.s3.ap-southeast-1.amazonaws.com/media/math-canvas/paper-${e}.png`, F = (e, t) => {
|
|
153
153
|
if (!t)
|
|
154
154
|
return "GREY_3";
|
|
155
155
|
switch (e) {
|
|
@@ -167,7 +167,7 @@ const x = (e) => e.reduce(
|
|
|
167
167
|
default:
|
|
168
168
|
return "GREY_3";
|
|
169
169
|
}
|
|
170
|
-
},
|
|
170
|
+
}, G = (e) => {
|
|
171
171
|
switch (e) {
|
|
172
172
|
case "learning":
|
|
173
173
|
return "BLUE_1";
|
|
@@ -204,7 +204,7 @@ const x = (e) => e.reduce(
|
|
|
204
204
|
case "learning":
|
|
205
205
|
return _;
|
|
206
206
|
case "practice":
|
|
207
|
-
return
|
|
207
|
+
return T;
|
|
208
208
|
case "practice-basic":
|
|
209
209
|
return E;
|
|
210
210
|
case "practice-regular":
|
|
@@ -212,7 +212,7 @@ const x = (e) => e.reduce(
|
|
|
212
212
|
case "exit-ticket":
|
|
213
213
|
return C;
|
|
214
214
|
case "advanced":
|
|
215
|
-
return
|
|
215
|
+
return I;
|
|
216
216
|
default:
|
|
217
217
|
return _;
|
|
218
218
|
}
|
|
@@ -221,19 +221,28 @@ const x = (e) => e.reduce(
|
|
|
221
221
|
) : !1, D = ({
|
|
222
222
|
isPuzzleWorksheet: e,
|
|
223
223
|
isTestWorksheet: t,
|
|
224
|
-
imageHue: r = "BLUE"
|
|
224
|
+
imageHue: r = "BLUE",
|
|
225
|
+
userType: n
|
|
225
226
|
}) => e ? {
|
|
226
227
|
bgColor: `${r}_3`,
|
|
227
228
|
borderColor: `${r}_4`,
|
|
228
|
-
textColor: "BLACK_T_87"
|
|
229
|
-
|
|
229
|
+
textColor: "BLACK_T_87",
|
|
230
|
+
alignTextItem: "center"
|
|
231
|
+
} : t ? n === "STUDENT" ? {
|
|
232
|
+
bgColor: "BLACK",
|
|
233
|
+
borderColor: "WHITE_4",
|
|
234
|
+
textColor: "WHITE",
|
|
235
|
+
alignTextItem: "center"
|
|
236
|
+
} : {
|
|
230
237
|
bgColor: "WHITE_3",
|
|
231
238
|
borderColor: "WHITE_4",
|
|
232
|
-
textColor: "BLACK_T_87"
|
|
239
|
+
textColor: "BLACK_T_87",
|
|
240
|
+
alignTextItem: "flex-start"
|
|
233
241
|
} : {
|
|
234
242
|
bgColor: "BLACK",
|
|
235
243
|
borderColor: "BLACK_4",
|
|
236
|
-
textColor: "WHITE"
|
|
244
|
+
textColor: "WHITE",
|
|
245
|
+
alignTextItem: "center"
|
|
237
246
|
}, V = (e) => e ? `${e}_1` : "BLUE_1", X = (e) => {
|
|
238
247
|
if (!e)
|
|
239
248
|
return !1;
|
|
@@ -242,23 +251,23 @@ const x = (e) => e.reduce(
|
|
|
242
251
|
};
|
|
243
252
|
export {
|
|
244
253
|
K as checkIsClozeFormulaResponseInvalid,
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
254
|
+
O as getInitialQuestionId,
|
|
255
|
+
W as getInitialResponses,
|
|
256
|
+
G as getNavigationSectionBackgroundColor,
|
|
248
257
|
z as getNavigationSectionIcon,
|
|
249
258
|
Y as getNavigationSectionName,
|
|
250
|
-
|
|
259
|
+
$ as getPaperColorByQuestion,
|
|
251
260
|
V as getPuzzleWorksheetBackgroundColor,
|
|
252
|
-
|
|
253
|
-
|
|
261
|
+
H as getQuestionBackgroundImage,
|
|
262
|
+
F as getQuestionBorderColor,
|
|
254
263
|
v as getQuestionMetadata,
|
|
255
|
-
|
|
264
|
+
k as getWorksheetDimensions,
|
|
256
265
|
D as getWorksheetHeaderLayout,
|
|
257
266
|
X as isConceptIntroWidget,
|
|
258
267
|
A as isOkayTypeQuestion,
|
|
259
268
|
J as isSATAssessmentNode,
|
|
260
269
|
P as isTeacherInterventionNeeded,
|
|
261
|
-
|
|
262
|
-
|
|
270
|
+
Q as scrollToQuestion,
|
|
271
|
+
U as setMathJaxConfigInWindow
|
|
263
272
|
};
|
|
264
273
|
//# 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'\n | 'itemReference'\n | 'itemPosition'\n | 'questionPosition'\n | 'isOkayTypeQuestion'\n | 'score'\n | 'tags'\n> & {\n distractor_rationale_response_level?: IWorksheetResponse['distractor_rationale_response_level'];\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): TQuestionMetadata {\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 distractor_rationale_response_level: question.metadata.distractor_rationale_response_level,\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,M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2B,CAACF,MAA+B;AAC/D,UAAQA,GAAa;AAAA,IACnB,KAAK;AACI,aAAAG;AAAA,IACT,KAAK;AACI,aAAAC;AAAA,IACT,KAAK;AACI,aAAAC;AAAA,IACT,KAAK;AACI,aAAAC;AAAA,IACT,KAAK;AACI,aAAAC;AAAA,IACT,KAAK;AACI,aAAAC;AAAA,IACT;AACS,aAAAL;AAAA,EACX;AACF,GAEMM,IAAsB,CAACC,MAC3BA,MAAa,4BAA4BA,MAAa,uBAElDC,IAAqC,CAACC,MACtC,MAAM,QAAQA,EAAS,KAAK,IACZA,EAAS,MAAM;AAAA,EAC/B,CAAQ1C,MAAA,OAAOA,KAAS,YAAYA,EAAK,SAAS2C;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,QAAA1B,IAA8B0B,EAAmB;AAEhD,SAAA1B,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'\n | 'itemReference'\n | 'itemPosition'\n | 'questionPosition'\n | 'isOkayTypeQuestion'\n | 'score'\n | 'tags'\n> & {\n distractor_rationale_response_level?: IWorksheetResponse['distractor_rationale_response_level'];\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): TQuestionMetadata {\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 distractor_rationale_response_level: question.metadata.distractor_rationale_response_level,\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 userType,\n}) => {\n if (isPuzzleWorksheet) {\n return {\n bgColor: `${imageHue}_3`,\n borderColor: `${imageHue}_4`,\n textColor: 'BLACK_T_87',\n alignTextItem: 'center',\n };\n }\n\n if (isTestWorksheet) {\n if (userType === 'STUDENT') {\n return {\n bgColor: 'BLACK',\n borderColor: 'WHITE_4',\n textColor: 'WHITE',\n alignTextItem: 'center',\n };\n }\n\n return {\n bgColor: 'WHITE_3',\n borderColor: 'WHITE_4',\n textColor: 'BLACK_T_87',\n alignTextItem: 'flex-start',\n };\n }\n\n return {\n bgColor: 'BLACK',\n borderColor: 'BLACK_4',\n textColor: 'WHITE',\n alignTextItem: 'center',\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","userType","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,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 @@
|
|
|
1
|
-
{"version":3,"file":"worksheet-types.js","sources":["../../../../src/features/worksheet/worksheet/worksheet-types.ts"],"sourcesContent":["import type { MutableRefObject, ReactElement, ReactNode } from 'react';\n\nimport type { EWorksheetActivity, TNodeTypes } from '../../../types/models/worksheet';\nimport type { IActionData, TPublish, TSubscribe } from '../../cue-canvas/types/cue-canvas';\nimport type { TPublishMouseMove, TSubscribeMouseMove } from '../../pointer-sync/pointer-types';\nimport type { TColorNames, THueNames, TUserTypes } from '../../ui/types';\nimport { type IFile } from '../../hooks/use-s3-helper/use-s3-helper';\nimport type { TWorksheetBlocker } from './worksheet-blocker/worksheet-blocker-types';\n\nexport enum QUESTION_TAGS {\n TRIAL_TOPIC = 'trial-topic',\n QUESTION_CODE = 'question code',\n}\n\nexport enum QUESTIONS_RATING {\n E = 3,\n S = 2, // Just right\n H = 1,\n}\n\nexport interface ILearnosityError {\n code: number;\n consumerKey: string;\n detail: string;\n errorUI: string;\n msg: string;\n}\n\ninterface ILearnosityQuestionMetadata {\n widget_reference: string;\n sheet_reference: string;\n acknowledgements?: string;\n sample_answer?: string;\n hints?: string[];\n solution?: string[];\n teacher_tips?: string[];\n valid_response_count: number;\n distractor_rationale_response_level?: string[];\n source: {\n organisation_id: number;\n };\n}\n\nexport type TInstructorStimulus =\n | 'SystemIntro' // lesson v3\n | 'Intro' // lesson v3\n | 'Concept-Intro' // lesson v3\n | 'Instruction' // lesson v3\n | 'Task' // lesson v3\n | 'Try' // trial v3\n | 'Learn' // trial v3\n | 'Apply'; // trial v3\n\nexport type TItemType =\n | 'overview'\n | 'learning'\n | 'learning-we-do'\n | 'learning-your-turn'\n | 'learning-explore'\n | 'practice'\n | 'practice-basic'\n | 'practice-basic-optional'\n | 'practice-regular'\n | 'practice-regular-optional'\n | 'exit-ticket'\n | 'advanced-we-do'\n | 'advanced-your-turn'\n | 'advanced-explore'\n | 'advanced-practice';\n\nexport type TSectionName =\n | 'overview'\n | 'learning'\n | 'practice'\n | 'practice-basic'\n | 'practice-regular'\n | 'exit-ticket'\n | 'advanced';\n\ninterface IQuestionValidResponse {\n score: number;\n value: unknown[];\n}\n\nexport interface ISheetNudgeBannerInfo {\n bannerBackgroundColor: TColorNames;\n label: string;\n}\n\nexport interface ILearnosityQuestion {\n response_id: string;\n instructor_stimulus?: TInstructorStimulus;\n metadata: ILearnosityQuestionMetadata;\n instant_feedback?: boolean;\n math_renderer?: string;\n template?: string;\n tokenization?: string;\n numberPad?: string[];\n symbols?: unknown[];\n response_container?: Record<string, unknown>;\n ui_style?: Record<string, unknown>;\n shuffle_options?: boolean;\n // for custom type question validation is undefined.\n validation?: {\n scoring_type?: string;\n unscored?: boolean;\n valid_response?: IQuestionValidResponse;\n alt_responses?: IQuestionValidResponse[];\n penalty?: number;\n min_score_if_attempted?: number;\n };\n is_math?: boolean;\n labels?: Record<string, unknown>;\n line?: Record<string, unknown>;\n points?: string[];\n snap_to_ticks?: boolean;\n ticks?: Record<string, unknown>;\n max_length?: number;\n type:\n | 'hotspot'\n | 'tokenhighlight'\n | 'numberline'\n | 'clozeassociation'\n | 'clozetext'\n | 'association'\n | 'classification'\n | 'clozedropdown'\n | 'clozeformula'\n | 'mcq'\n | 'choicematrix'\n | 'plaintext'\n | 'drawing';\n case_sensitive?: boolean;\n show_copy?: boolean;\n show_cut?: boolean;\n show_paste?: boolean;\n spellcheck?: boolean;\n stimulus?: string;\n stimulus_review?: string;\n stimulus_list?: string[];\n image?: Record<string, unknown>;\n areas?: unknown[];\n area_attributes?: Record<string, unknown>;\n possible_responses?: string[][] | string[];\n duplicate_responses?: boolean;\n response_containers?: unknown[];\n options?: Record<string, unknown>[] | string[];\n feedback_attempts?: number;\n stems?: string[];\n multiple_responses?: boolean;\n}\n\nexport interface ILearnosityItem {\n reference: string;\n questions: ILearnosityQuestion[];\n source: Record<string, unknown>;\n content: string;\n metadata: Record<string, unknown> | unknown[];\n workflow: unknown[];\n response_ids: string[];\n feature_ids: unknown[];\n features: unknown[];\n itemType?: TItemType;\n tags?: string[];\n}\n\nexport interface IWorksheetQuestion extends ILearnosityQuestion {\n item_reference: string;\n item_type?: TItemType;\n section_name?: TSectionName;\n is_optional?: boolean;\n /**\n * If true, the question is not a question, but a content only item\n * e.g. Intro, Overview, Instruction etc.\n */\n is_non_question?: boolean;\n concept_intro_stimulus?: string; // Content for concept intro widget\n item_tags: string[];\n item_tags_map: Record<string, string>;\n item_number: number;\n item_display_number: number;\n question_number: number;\n total_questions: number;\n /**\n * if true, scribbler button will be shown on the question\n */\n can_scribble: boolean; // If true, the question can be scribbled on\n}\n\nexport interface ILearnosityQuestionScore {\n score?: number | null;\n max_score: number;\n unscored?: boolean;\n}\n\nexport interface ILearnosityQuestionResponse {\n value: unknown;\n responses?: unknown;\n type: unknown;\n updatedFormat?: boolean;\n wordCount?: number;\n apiVersion: string;\n revision: number;\n feedbackAttemptsCount?: number;\n}\n\ninterface IAttempt {\n response: ILearnosityQuestionResponse;\n score: ILearnosityQuestionScore;\n}\n\ninterface ITeacherReview {\n reviewComment?: string;\n images?: string[];\n}\nexport interface IWorksheetResponse {\n widgetReference: string;\n itemReference: string;\n itemPosition: number; // 0 based\n questionPosition: number; // 0 based\n isOkayTypeQuestion: boolean;\n response?: ILearnosityQuestionResponse;\n /**\n * For non question questions, when user click on start, responseGiven will be true\n */\n responseGiven?: boolean;\n retryEnabled?: boolean;\n simState?: Record<string, unknown>;\n score?: ILearnosityQuestionScore;\n responseEdited?: boolean;\n hintsUsed?: number;\n markedForReview?: boolean;\n attemptsHistory?: IAttempt[];\n validatedByTeacher?: boolean;\n submittedByStudent?: boolean;\n assignStatus?: 'assigned' | 'skipped';\n rating?: number;\n skipped?: boolean;\n doubtResolved?: boolean;\n teacherReview?: ITeacherReview;\n tags?: Record<string, string>;\n timeSpent?: number;\n discussionQuestionOffset?: number;\n distractor_rationale_response_level?: string[];\n}\n\ntype TMathRenderer = 'mathjax' | 'mathquill';\nexport interface ILearnosity {\n ready: () => void;\n questions: () => Record<string, unknown>;\n question: (responseId: string) =>\n | {\n enable: () => boolean;\n disable: () => boolean;\n getQuestion: () => ILearnosityQuestion;\n getMetadata: () => ILearnosityQuestionMetadata;\n getResponse: () => ILearnosityQuestionResponse;\n getScore: (\n callback?: (score: ILearnosityQuestionScore | null) => void,\n ) => ILearnosityQuestionScore;\n validate: (\n options?: { showCorrectAnswers?: boolean; feedbackAttempts?: boolean },\n callback?: () => void,\n ) => void;\n resetValidationUI: () => void;\n on: (eventName: 'changed', callback: () => void) => void;\n off: (eventName: 'changed', callback?: () => void) => void;\n }\n | undefined;\n append: (toAppend: {\n questions: ILearnosityQuestion[];\n responses?: Record<string, unknown>;\n }) => void;\n appendQuestion: (toAppend: {\n questions: ILearnosityQuestion[];\n responses?: Record<string, unknown>;\n }) => void;\n reset: () => void;\n renderMath: (renderer: TMathRenderer) => void;\n}\n\nexport interface IWorksheetBehavior {\n /**\n * If true, Opens the worksheet in resume mode.\n * - If false, Opens the worksheet in review mode.\n */\n canAttempt: boolean;\n /**\n * If true, the user can mark the question for review.\n */\n canMarkForReview: boolean;\n /**\n * The mode of navigation for the worksheet.\n * - `OPEN` mode allows the user to navigate to any question in the worksheet.\n * - `LINEAR` mode allows the user to navigate to the next question only.\n * - `ADAPTIVE` mode allows the user to navigate future questions based on the rating of the current question.\n * - `CURRENT` mode allows the user to navigate to the current question only. Back and forth not allowed.\n */\n navigationMode: 'OPEN' | 'LINEAR' | 'ADAPTIVE' | 'CURRENT';\n /**\n * The initial question to display when the worksheet is loaded.\n * - `FIRST` mode displays the first question in the worksheet.\n * - `CURRENT` mode displays the question that the user was last on.\n */\n initialQuestion: 'FIRST' | 'CURRENT';\n /**\n * If hints are available, on clicking the help button, first availble hint will be shown.\n * Clicking again will show the next hint.\n * If no more hints are available, onHelp will be called.\n */\n hints: boolean;\n /**\n * The time in seconds after which the hints button will be shown.\n */\n hintsTimer?: number; // in seconds\n /**\n * If true, the user can skip the question without attempting it.\n * Skip button will be shown only after the hints are exausted and skipTimer is reached.\n */\n skippable?: boolean;\n /**\n * The time in seconds after which the user can skip the question.\n */\n skippableTime?: number; // in seconds\n /**\n * If true, after the question is system validated, teacher discussion button will be shown when the question has discussion points.\n */\n teacherDiscussionEnabled?: boolean;\n /**\n * If true, teacher validation is needed for the question to proceed\n */\n teacherValidationEnabled: boolean;\n /**\n * If worksheet is attempting outside the class setting\n * This needs teacherValidationEnabled to be true\n * TODO: Consider changing to accept validation type: 'system' | 'teacher' | undefined instead of boolean\n */\n canTeacherValidate: boolean;\n /**\n * If true, questions will be validated and feedback will be shown.\n */\n validation: boolean;\n /**\n * If true, solution wont be shown to the user.\n */\n solutionHidden?: boolean;\n /**\n * If true, questions will be validated and feedback will be shown along with the correct answer.\n */\n review: boolean;\n /**\n * The maximum number of attempts allowed for each question.\n * 0 means unlimited attempts.\n * -1 means attempts will not be validated, hence not pushed to attempt history.\n * -2 means the sheet is a puzzle sheet\n * After reaching the maximum number of attempts, the user cannot attempt the question anymore.\n * If maxAtttmpts reached and canExceedAttempts is true, the user can still attempt the question\n * , also user will have the option to move to next question\n */\n maximumAttempts: number;\n /**\n * If true, the user can exceed the maximum number of attempts.\n */\n canExceedAttempts: boolean;\n\n /**\n * After attemptsAfterTeacherInterventionNeeded incorrect attempts, retry button will be disabled in class, move ahead button will show ouside class.\n */\n attemptsAfterTeacherInterventionNeeded?: number;\n /**\n * If the worksheet minimumAccuracy is not met, on clicking the final submit button, onMinimumAccuracyNotMet will be called.\n */\n minimumAccuracy: number;\n /**\n * Label for the check button\n * For example,\n * - \"Check\" for Checking the answer\n * - \"Submit\" for Submitting the answer when doing assessment\n */\n checkButtonLabel: string;\n /**\n * If attempt is incorrect, we show retry button, this is the label for the retry button\n * For example,\n * - 'Try Again' for retrying the question\n */\n retryButtonLabel: string;\n /**\n * If true show demos calculator https://www.desmos.com/calculator\n */\n canShowDesmosCalc: boolean;\n\n // If true, canvas is enabled and user can use canvas to scribble on the worksheet by toggling the scribble button\n canvasEnabled?: boolean;\n\n // If true, the user can scribble on workheet\n canScribble?: boolean;\n}\n\nexport type TWORKSHEET_QUESTION_MEDIA_TYPE = 'SIMULATION' | 'VIDEO' | 'AUDIO';\n\nexport interface IWorksheetCallbackProps {\n onResponseChange?: (options: {\n responseId: string;\n response: IWorksheetResponse;\n isNewAttempt: boolean;\n question: IWorksheetQuestion;\n }) => void;\n onBulkResponsesChange?: (responses: Record<string, IWorksheetResponse>) => void;\n onResponsesChange?: (responses: Record<string, IWorksheetResponse>) => void;\n onMediaStateChange?: (\n question: IWorksheetQuestion,\n mediaType: TWORKSHEET_QUESTION_MEDIA_TYPE,\n mediaState: Record<string, unknown>,\n ) => void;\n onTeacherValidation?: (questionId: string, rating?: keyof typeof QUESTIONS_RATING) => void;\n onAllowRetry?: (questionId: string) => void;\n onOptionalItemAssignment?: (itemType: TItemType) => void;\n onOptionalItemSkip?: (itemType: TItemType) => void;\n onHelp?: (options: { questionId: string; questionNumber: string }) => void;\n onMinimumAccuracyNotMet?: (accuracy: number) => void;\n onExitTicketStart?: () => void;\n onExitTicketSubmit?: () => void;\n onSubmit?: (\n responses: Record<string, IWorksheetResponse>,\n questions: IWorksheetQuestion[],\n ) => void;\n onActiveQuestionChange?: (question: IWorksheetQuestion) => void;\n onResolveDoubt?: (responseId: string) => void;\n onSkip?: (itemIndex: number, widgetIndex: number) => void;\n onLoaded: () => void;\n onErrored: (error: { code?: number; message: string }) => void;\n onResponsesLoaded?: (responses: Record<string, IWorksheetResponse>) => void;\n openQuestionFeedbackModal?: (itemRef: string) => void;\n}\n\ninterface ICueCanvasCallbackProps {\n onPublishStrokes?: TPublish;\n onReceiveStrokes?: TSubscribe;\n}\n\ninterface ICueCanvasProps {\n initialStrokesData?: Record<string, IActionData[]>;\n}\n\ninterface IPointerSyncCallbackProps {\n onPublishMouseMove?: TPublishMouseMove;\n onSubscribeMouseMove?: TSubscribeMouseMove;\n}\n\nexport interface IWorksheetLayout {\n containerStyle: 'none' | 'card';\n navigationBar: 'none' | 'top' | 'bottom';\n actionBar: 'none' | 'bottom';\n containerWidth: string;\n topOffset: number; // Offset from the top of the screen, for eg: height of the header\n questionsScrollable: boolean;\n minQuestionHeight: string | number;\n minSummaryHeight: string | number;\n showUserPointer?: boolean;\n renderQuestionHeader?: boolean;\n imageHue?: THueNames;\n background?: 'none' | 'paper';\n questionPadding: number;\n}\n\nexport interface ISubjectiveSheetProps {\n onAddReviewComment?: (\n responseId: string,\n commentData: {\n score: ILearnosityQuestionScore;\n teacherReview: ITeacherReview;\n },\n ) => void;\n openImagesReviewModal?: (props: IOpenImageReviewModalProps) => void;\n handleReviewSubmit?: () => void;\n isSubmittingReview?: boolean;\n isReviewPending?: boolean;\n}\n\ninterface IBaseWorksheetProps {\n userType: TUserTypes;\n userId: string;\n studentId: string;\n studentName?: string;\n worksheetName: string;\n initialResponseId?: string;\n initialItemIndex?: number;\n layout: IWorksheetLayout;\n updatedResponses?: Record<string, IWorksheetResponse>;\n worksheetCompleted: boolean;\n showNudgeBanner?: boolean;\n markedAsCompleted?: boolean;\n canResolveDoubt?: boolean;\n actionBarRightElement?: ReactElement; // Extra Elements to be rendered in the action bar\n attemptId?: string;\n itemsSignedRequest: string;\n questionsSignedRequest: string;\n summaryDescription?: ReactElement | null;\n canSubmitWorksheet?: boolean;\n selectedTopics?: string[];\n subjectiveProps?: ISubjectiveSheetProps;\n inClass?: boolean; // If true, the worksheet is rendered inside class\n activityType: EWorksheetActivity | null;\n isDesmosEnabled?: boolean; // If true, the worksheet can show desmos calculator\n nodeType: TNodeTypes; // NodeType of the worksheet\n mode: 'resume' | 'review' | 'preview'; // mode of the worksheet\n loggerRef: MutableRefObject<(eventName: string, data?: Record<string, unknown>) => void>;\n behaviorOverride?: Partial<IWorksheetBehavior>;\n}\n\ninterface IWorksheetPlugins {\n plugins?: {\n stickers?: ReactNode;\n };\n}\n\ninterface IUpdateImages {\n filteredImages: string[];\n newImages: IFile[];\n}\ninterface IOpenImageReviewModalProps {\n isReviewed?: boolean;\n disableScoreForm?: boolean;\n imageUrls?: string[];\n filteredImageUrls?: (props: IUpdateImages) => void;\n uploadedImages?: (IFile | string)[];\n image?: string;\n}\n\nexport interface IWorksheetProps\n extends IBaseWorksheetProps,\n IWorksheetCallbackProps,\n ICueCanvasProps,\n ICueCanvasCallbackProps,\n IPointerSyncCallbackProps,\n IWorksheetPlugins {}\n\nexport interface IWorksheetRef {\n validateQuestion: (\n responseId: string,\n rating?: keyof typeof QUESTIONS_RATING,\n skipRemainingQuestions?: boolean,\n ) => void;\n assignOptionalItems: (itemType: TItemType) => void;\n skipOptionalItems: (itemType: TItemType) => void;\n updateMediaState: (\n responseId: string,\n mediaType: TWORKSHEET_QUESTION_MEDIA_TYPE,\n mediaState: Record<string, unknown>,\n ) => void;\n allowRetry: (responseId: string) => void;\n}\n\ninterface IWorksheetHeaderLayoutArgs {\n isPuzzleWorksheet?: boolean;\n isTestWorksheet?: boolean;\n imageHue?: THueNames;\n}\n\nexport interface IWorksheetHeaderLayoutProps {\n (args: IWorksheetHeaderLayoutArgs): {\n bgColor: TColorNames;\n borderColor?: TColorNames;\n textColor?: TColorNames;\n };\n}\n\nexport type TWorksheetStoreProps = Omit<\n IBaseWorksheetProps,\n 'studentName' | 'itemsSignedRequest' | 'mode'\n> &\n Required<Pick<IBaseWorksheetProps, 'studentName'>> &\n Omit<IWorksheetCallbackProps, 'onLoaded' | 'onErrored'> &\n ICueCanvasProps &\n ICueCanvasCallbackProps &\n IPointerSyncCallbackProps &\n IWorksheetPlugins & {\n behavior: IWorksheetBehavior;\n learnosityItems: ILearnosityItem[];\n learnosityResponses?: Record<string, IWorksheetResponse>;\n learnosity: ILearnosity;\n appendedQuestionIds: string[];\n };\n\nexport enum EActiveQuestionTool {\n TEACHING_TOOLS = 'TEACHING_TOOLS',\n SOLUTION = 'SOLUTION',\n DISCUSSION = 'DISCUSSION',\n}\n\nexport interface IWorksheetStoreState {\n questions: IWorksheetQuestion[];\n renderableQuestions: IWorksheetQuestion[];\n responses: Record<string, IWorksheetResponse>;\n lastUnlockedQuestionIndex: number;\n initialQuestionId: string;\n activeQuestionId: string;\n activeQuestionIndex: number;\n questionsContainerWidth: number;\n maxQuestionWidth: number;\n actionbarHeight: number;\n summaryVisible: boolean;\n calculatorVisible: boolean;\n scribblingEnabled: boolean;\n activeQuestionTool?: EActiveQuestionTool;\n blocker?: TWorksheetBlocker;\n scrolledToInitialQuestion: boolean;\n}\n\n// Actions interface - contains all the methods\ninterface IWorksheetStoreActions {\n mergeWorksheetProps: (data: TWorksheetStoreProps) => void;\n setResponses: (\n responses:\n | IWorksheetStore['responses']\n | ((prevResponses: IWorksheetStore['responses']) => IWorksheetStore['responses']),\n ) => void;\n showSummary: () => void;\n hideSummary: () => void;\n toggleSummary: () => void;\n toggleCalculator: () => void;\n toggleScribble: () => void;\n setBlocker: (blocker?: TWorksheetBlocker) => void;\n /**\n *\n * @param scrollToLastUnlockedQuestion - If true, scrolls to the last unlocked question after removing the blocker. Default is true.\n * @returns\n */\n removeBlocker: (scrollToLastUnlockedQuestion?: boolean) => void;\n updateResponse: (options: {\n responseId: string;\n response: ILearnosityQuestionResponse;\n score: ILearnosityQuestionScore;\n timeSpent: number;\n answerChecked?: boolean;\n }) => void;\n updateMediaState: (\n responseId: string,\n mediaType: TWORKSHEET_QUESTION_MEDIA_TYPE,\n mediaState: Record<string, unknown>,\n ) => void;\n setDiscussionQuestionOffset: (responseId: string, offset: number) => void;\n markForReview: (responseId: string, markedForReview: boolean) => void;\n changeQuestion: (questionId: string, shouldScroll?: boolean, scrollDelay?: number) => void;\n setActiveQuestionTool: (tool: EActiveQuestionTool) => void;\n unsetActiveQuestionTool: () => void;\n destroy: () => void;\n}\n\n// Combined store interface\nexport interface IWorksheetStore\n extends IWorksheetStoreState,\n TWorksheetStoreProps,\n IWorksheetStoreActions {}\n"],"names":["QUESTION_TAGS","QUESTIONS_RATING","EActiveQuestionTool"],"mappings":"AASY,IAAAA,sBAAAA,OACVA,EAAA,cAAc,eACdA,EAAA,gBAAgB,iBAFNA,IAAAA,KAAA,CAAA,CAAA,GAKAC,sBAAAA,OACVA,EAAAA,EAAA,IAAI,CAAJ,IAAA,KACAA,EAAAA,EAAA,IAAI,CAAJ,IAAA,KACAA,EAAAA,EAAA,IAAI,CAAJ,IAAA,KAHUA,IAAAA,KAAA,CAAA,CAAA,GA0jBAC,sBAAAA,OACVA,EAAA,iBAAiB,kBACjBA,EAAA,WAAW,YACXA,EAAA,aAAa,cAHHA,IAAAA,KAAA,CAAA,CAAA;"}
|
|
1
|
+
{"version":3,"file":"worksheet-types.js","sources":["../../../../src/features/worksheet/worksheet/worksheet-types.ts"],"sourcesContent":["import type { MutableRefObject, ReactElement, ReactNode } from 'react';\n\nimport type { EWorksheetActivity, TNodeTypes } from '../../../types/models/worksheet';\nimport type { IActionData, TPublish, TSubscribe } from '../../cue-canvas/types/cue-canvas';\nimport type { TPublishMouseMove, TSubscribeMouseMove } from '../../pointer-sync/pointer-types';\nimport type { TColorNames, THueNames, TUserTypes } from '../../ui/types';\nimport { type IFile } from '../../hooks/use-s3-helper/use-s3-helper';\nimport type { TWorksheetBlocker } from './worksheet-blocker/worksheet-blocker-types';\nimport { type TStyleAttrubutes } from '../../ui/accordion-section/accordion-section-types';\n\nexport enum QUESTION_TAGS {\n TRIAL_TOPIC = 'trial-topic',\n QUESTION_CODE = 'question code',\n}\n\nexport enum QUESTIONS_RATING {\n E = 3,\n S = 2, // Just right\n H = 1,\n}\n\nexport interface ILearnosityError {\n code: number;\n consumerKey: string;\n detail: string;\n errorUI: string;\n msg: string;\n}\n\ninterface ILearnosityQuestionMetadata {\n widget_reference: string;\n sheet_reference: string;\n acknowledgements?: string;\n sample_answer?: string;\n hints?: string[];\n solution?: string[];\n teacher_tips?: string[];\n valid_response_count: number;\n distractor_rationale_response_level?: string[];\n source: {\n organisation_id: number;\n };\n}\n\nexport type TInstructorStimulus =\n | 'SystemIntro' // lesson v3\n | 'Intro' // lesson v3\n | 'Concept-Intro' // lesson v3\n | 'Instruction' // lesson v3\n | 'Task' // lesson v3\n | 'Try' // trial v3\n | 'Learn' // trial v3\n | 'Apply'; // trial v3\n\nexport type TItemType =\n | 'overview'\n | 'learning'\n | 'learning-we-do'\n | 'learning-your-turn'\n | 'learning-explore'\n | 'practice'\n | 'practice-basic'\n | 'practice-basic-optional'\n | 'practice-regular'\n | 'practice-regular-optional'\n | 'exit-ticket'\n | 'advanced-we-do'\n | 'advanced-your-turn'\n | 'advanced-explore'\n | 'advanced-practice';\n\nexport type TSectionName =\n | 'overview'\n | 'learning'\n | 'practice'\n | 'practice-basic'\n | 'practice-regular'\n | 'exit-ticket'\n | 'advanced';\n\ninterface IQuestionValidResponse {\n score: number;\n value: unknown[];\n}\n\nexport interface ISheetNudgeBannerInfo {\n bannerBackgroundColor: TColorNames;\n label: string;\n}\n\nexport interface ILearnosityQuestion {\n response_id: string;\n instructor_stimulus?: TInstructorStimulus;\n metadata: ILearnosityQuestionMetadata;\n instant_feedback?: boolean;\n math_renderer?: string;\n template?: string;\n tokenization?: string;\n numberPad?: string[];\n symbols?: unknown[];\n response_container?: Record<string, unknown>;\n ui_style?: Record<string, unknown>;\n shuffle_options?: boolean;\n // for custom type question validation is undefined.\n validation?: {\n scoring_type?: string;\n unscored?: boolean;\n valid_response?: IQuestionValidResponse;\n alt_responses?: IQuestionValidResponse[];\n penalty?: number;\n min_score_if_attempted?: number;\n };\n is_math?: boolean;\n labels?: Record<string, unknown>;\n line?: Record<string, unknown>;\n points?: string[];\n snap_to_ticks?: boolean;\n ticks?: Record<string, unknown>;\n max_length?: number;\n type:\n | 'hotspot'\n | 'tokenhighlight'\n | 'numberline'\n | 'clozeassociation'\n | 'clozetext'\n | 'association'\n | 'classification'\n | 'clozedropdown'\n | 'clozeformula'\n | 'mcq'\n | 'choicematrix'\n | 'plaintext'\n | 'drawing';\n case_sensitive?: boolean;\n show_copy?: boolean;\n show_cut?: boolean;\n show_paste?: boolean;\n spellcheck?: boolean;\n stimulus?: string;\n stimulus_review?: string;\n stimulus_list?: string[];\n image?: Record<string, unknown>;\n areas?: unknown[];\n area_attributes?: Record<string, unknown>;\n possible_responses?: string[][] | string[];\n duplicate_responses?: boolean;\n response_containers?: unknown[];\n options?: Record<string, unknown>[] | string[];\n feedback_attempts?: number;\n stems?: string[];\n multiple_responses?: boolean;\n}\n\nexport interface ILearnosityItem {\n reference: string;\n questions: ILearnosityQuestion[];\n source: Record<string, unknown>;\n content: string;\n metadata: Record<string, unknown> | unknown[];\n workflow: unknown[];\n response_ids: string[];\n feature_ids: unknown[];\n features: unknown[];\n itemType?: TItemType;\n tags?: string[];\n}\n\nexport interface IWorksheetQuestion extends ILearnosityQuestion {\n item_reference: string;\n item_type?: TItemType;\n section_name?: TSectionName;\n is_optional?: boolean;\n /**\n * If true, the question is not a question, but a content only item\n * e.g. Intro, Overview, Instruction etc.\n */\n is_non_question?: boolean;\n concept_intro_stimulus?: string; // Content for concept intro widget\n item_tags: string[];\n item_tags_map: Record<string, string>;\n item_number: number;\n item_display_number: number;\n question_number: number;\n total_questions: number;\n /**\n * if true, scribbler button will be shown on the question\n */\n can_scribble: boolean; // If true, the question can be scribbled on\n}\n\nexport interface ILearnosityQuestionScore {\n score?: number | null;\n max_score: number;\n unscored?: boolean;\n}\n\nexport interface ILearnosityQuestionResponse {\n value: unknown;\n responses?: unknown;\n type: unknown;\n updatedFormat?: boolean;\n wordCount?: number;\n apiVersion: string;\n revision: number;\n feedbackAttemptsCount?: number;\n}\n\ninterface IAttempt {\n response: ILearnosityQuestionResponse;\n score: ILearnosityQuestionScore;\n}\n\ninterface ITeacherReview {\n reviewComment?: string;\n images?: string[];\n}\nexport interface IWorksheetResponse {\n widgetReference: string;\n itemReference: string;\n itemPosition: number; // 0 based\n questionPosition: number; // 0 based\n isOkayTypeQuestion: boolean;\n response?: ILearnosityQuestionResponse;\n /**\n * For non question questions, when user click on start, responseGiven will be true\n */\n responseGiven?: boolean;\n retryEnabled?: boolean;\n simState?: Record<string, unknown>;\n score?: ILearnosityQuestionScore;\n responseEdited?: boolean;\n hintsUsed?: number;\n markedForReview?: boolean;\n attemptsHistory?: IAttempt[];\n validatedByTeacher?: boolean;\n submittedByStudent?: boolean;\n assignStatus?: 'assigned' | 'skipped';\n rating?: number;\n skipped?: boolean;\n doubtResolved?: boolean;\n teacherReview?: ITeacherReview;\n tags?: Record<string, string>;\n timeSpent?: number;\n discussionQuestionOffset?: number;\n distractor_rationale_response_level?: string[];\n}\n\ntype TMathRenderer = 'mathjax' | 'mathquill';\nexport interface ILearnosity {\n ready: () => void;\n questions: () => Record<string, unknown>;\n question: (responseId: string) =>\n | {\n enable: () => boolean;\n disable: () => boolean;\n getQuestion: () => ILearnosityQuestion;\n getMetadata: () => ILearnosityQuestionMetadata;\n getResponse: () => ILearnosityQuestionResponse;\n getScore: (\n callback?: (score: ILearnosityQuestionScore | null) => void,\n ) => ILearnosityQuestionScore;\n validate: (\n options?: { showCorrectAnswers?: boolean; feedbackAttempts?: boolean },\n callback?: () => void,\n ) => void;\n resetValidationUI: () => void;\n on: (eventName: 'changed', callback: () => void) => void;\n off: (eventName: 'changed', callback?: () => void) => void;\n }\n | undefined;\n append: (toAppend: {\n questions: ILearnosityQuestion[];\n responses?: Record<string, unknown>;\n }) => void;\n appendQuestion: (toAppend: {\n questions: ILearnosityQuestion[];\n responses?: Record<string, unknown>;\n }) => void;\n reset: () => void;\n renderMath: (renderer: TMathRenderer) => void;\n}\n\nexport interface IWorksheetBehavior {\n /**\n * If true, Opens the worksheet in resume mode.\n * - If false, Opens the worksheet in review mode.\n */\n canAttempt: boolean;\n /**\n * If true, the user can mark the question for review.\n */\n canMarkForReview: boolean;\n /**\n * The mode of navigation for the worksheet.\n * - `OPEN` mode allows the user to navigate to any question in the worksheet.\n * - `LINEAR` mode allows the user to navigate to the next question only.\n * - `ADAPTIVE` mode allows the user to navigate future questions based on the rating of the current question.\n * - `CURRENT` mode allows the user to navigate to the current question only. Back and forth not allowed.\n */\n navigationMode: 'OPEN' | 'LINEAR' | 'ADAPTIVE' | 'CURRENT';\n /**\n * The initial question to display when the worksheet is loaded.\n * - `FIRST` mode displays the first question in the worksheet.\n * - `CURRENT` mode displays the question that the user was last on.\n */\n initialQuestion: 'FIRST' | 'CURRENT';\n /**\n * If hints are available, on clicking the help button, first availble hint will be shown.\n * Clicking again will show the next hint.\n * If no more hints are available, onHelp will be called.\n */\n hints: boolean;\n /**\n * The time in seconds after which the hints button will be shown.\n */\n hintsTimer?: number; // in seconds\n /**\n * If true, the user can skip the question without attempting it.\n * Skip button will be shown only after the hints are exausted and skipTimer is reached.\n */\n skippable?: boolean;\n /**\n * The time in seconds after which the user can skip the question.\n */\n skippableTime?: number; // in seconds\n /**\n * If true, after the question is system validated, teacher discussion button will be shown when the question has discussion points.\n */\n teacherDiscussionEnabled?: boolean;\n /**\n * If true, teacher validation is needed for the question to proceed\n */\n teacherValidationEnabled: boolean;\n /**\n * If worksheet is attempting outside the class setting\n * This needs teacherValidationEnabled to be true\n * TODO: Consider changing to accept validation type: 'system' | 'teacher' | undefined instead of boolean\n */\n canTeacherValidate: boolean;\n /**\n * If true, questions will be validated and feedback will be shown.\n */\n validation: boolean;\n /**\n * If true, solution wont be shown to the user.\n */\n solutionHidden?: boolean;\n /**\n * If true, questions will be validated and feedback will be shown along with the correct answer.\n */\n review: boolean;\n /**\n * The maximum number of attempts allowed for each question.\n * 0 means unlimited attempts.\n * -1 means attempts will not be validated, hence not pushed to attempt history.\n * -2 means the sheet is a puzzle sheet\n * After reaching the maximum number of attempts, the user cannot attempt the question anymore.\n * If maxAtttmpts reached and canExceedAttempts is true, the user can still attempt the question\n * , also user will have the option to move to next question\n */\n maximumAttempts: number;\n /**\n * If true, the user can exceed the maximum number of attempts.\n */\n canExceedAttempts: boolean;\n\n /**\n * After attemptsAfterTeacherInterventionNeeded incorrect attempts, retry button will be disabled in class, move ahead button will show ouside class.\n */\n attemptsAfterTeacherInterventionNeeded?: number;\n /**\n * If the worksheet minimumAccuracy is not met, on clicking the final submit button, onMinimumAccuracyNotMet will be called.\n */\n minimumAccuracy: number;\n /**\n * Label for the check button\n * For example,\n * - \"Check\" for Checking the answer\n * - \"Submit\" for Submitting the answer when doing assessment\n */\n checkButtonLabel: string;\n /**\n * If attempt is incorrect, we show retry button, this is the label for the retry button\n * For example,\n * - 'Try Again' for retrying the question\n */\n retryButtonLabel: string;\n /**\n * If true show demos calculator https://www.desmos.com/calculator\n */\n canShowDesmosCalc: boolean;\n\n // If true, canvas is enabled and user can use canvas to scribble on the worksheet by toggling the scribble button\n canvasEnabled?: boolean;\n\n // If true, the user can scribble on workheet\n canScribble?: boolean;\n}\n\nexport type TWORKSHEET_QUESTION_MEDIA_TYPE = 'SIMULATION' | 'VIDEO' | 'AUDIO';\n\nexport interface IWorksheetCallbackProps {\n onResponseChange?: (options: {\n responseId: string;\n response: IWorksheetResponse;\n isNewAttempt: boolean;\n question: IWorksheetQuestion;\n }) => void;\n onBulkResponsesChange?: (responses: Record<string, IWorksheetResponse>) => void;\n onResponsesChange?: (responses: Record<string, IWorksheetResponse>) => void;\n onMediaStateChange?: (\n question: IWorksheetQuestion,\n mediaType: TWORKSHEET_QUESTION_MEDIA_TYPE,\n mediaState: Record<string, unknown>,\n ) => void;\n onTeacherValidation?: (questionId: string, rating?: keyof typeof QUESTIONS_RATING) => void;\n onAllowRetry?: (questionId: string) => void;\n onOptionalItemAssignment?: (itemType: TItemType) => void;\n onOptionalItemSkip?: (itemType: TItemType) => void;\n onHelp?: (options: { questionId: string; questionNumber: string }) => void;\n onMinimumAccuracyNotMet?: (accuracy: number) => void;\n onExitTicketStart?: () => void;\n onExitTicketSubmit?: () => void;\n onSubmit?: (\n responses: Record<string, IWorksheetResponse>,\n questions: IWorksheetQuestion[],\n ) => void;\n onActiveQuestionChange?: (question: IWorksheetQuestion) => void;\n onResolveDoubt?: (responseId: string) => void;\n onSkip?: (itemIndex: number, widgetIndex: number) => void;\n onLoaded: () => void;\n onErrored: (error: { code?: number; message: string }) => void;\n onResponsesLoaded?: (responses: Record<string, IWorksheetResponse>) => void;\n openQuestionFeedbackModal?: (itemRef: string) => void;\n}\n\ninterface ICueCanvasCallbackProps {\n onPublishStrokes?: TPublish;\n onReceiveStrokes?: TSubscribe;\n}\n\ninterface ICueCanvasProps {\n initialStrokesData?: Record<string, IActionData[]>;\n}\n\ninterface IPointerSyncCallbackProps {\n onPublishMouseMove?: TPublishMouseMove;\n onSubscribeMouseMove?: TSubscribeMouseMove;\n}\n\nexport interface IWorksheetLayout {\n containerStyle: 'none' | 'card';\n navigationBar: 'none' | 'top' | 'bottom';\n actionBar: 'none' | 'bottom';\n containerWidth: string;\n topOffset: number; // Offset from the top of the screen, for eg: height of the header\n questionsScrollable: boolean;\n minQuestionHeight: string | number;\n minSummaryHeight: string | number;\n showUserPointer?: boolean;\n renderQuestionHeader?: boolean;\n imageHue?: THueNames;\n background?: 'none' | 'paper';\n questionPadding: number;\n}\n\nexport interface ISubjectiveSheetProps {\n onAddReviewComment?: (\n responseId: string,\n commentData: {\n score: ILearnosityQuestionScore;\n teacherReview: ITeacherReview;\n },\n ) => void;\n openImagesReviewModal?: (props: IOpenImageReviewModalProps) => void;\n handleReviewSubmit?: () => void;\n isSubmittingReview?: boolean;\n isReviewPending?: boolean;\n}\n\ninterface IBaseWorksheetProps {\n userType: TUserTypes;\n userId: string;\n studentId: string;\n studentName?: string;\n worksheetName: string;\n initialResponseId?: string;\n initialItemIndex?: number;\n layout: IWorksheetLayout;\n updatedResponses?: Record<string, IWorksheetResponse>;\n worksheetCompleted: boolean;\n showNudgeBanner?: boolean;\n markedAsCompleted?: boolean;\n canResolveDoubt?: boolean;\n actionBarRightElement?: ReactElement; // Extra Elements to be rendered in the action bar\n attemptId?: string;\n itemsSignedRequest: string;\n questionsSignedRequest: string;\n summaryDescription?: ReactElement | null;\n canSubmitWorksheet?: boolean;\n selectedTopics?: string[];\n subjectiveProps?: ISubjectiveSheetProps;\n inClass?: boolean; // If true, the worksheet is rendered inside class\n activityType: EWorksheetActivity | null;\n isDesmosEnabled?: boolean; // If true, the worksheet can show desmos calculator\n nodeType: TNodeTypes; // NodeType of the worksheet\n mode: 'resume' | 'review' | 'preview'; // mode of the worksheet\n loggerRef: MutableRefObject<(eventName: string, data?: Record<string, unknown>) => void>;\n behaviorOverride?: Partial<IWorksheetBehavior>;\n}\n\ninterface IWorksheetPlugins {\n plugins?: {\n stickers?: ReactNode;\n };\n}\n\ninterface IUpdateImages {\n filteredImages: string[];\n newImages: IFile[];\n}\ninterface IOpenImageReviewModalProps {\n isReviewed?: boolean;\n disableScoreForm?: boolean;\n imageUrls?: string[];\n filteredImageUrls?: (props: IUpdateImages) => void;\n uploadedImages?: (IFile | string)[];\n image?: string;\n}\n\nexport interface IWorksheetProps\n extends IBaseWorksheetProps,\n IWorksheetCallbackProps,\n ICueCanvasProps,\n ICueCanvasCallbackProps,\n IPointerSyncCallbackProps,\n IWorksheetPlugins {}\n\nexport interface IWorksheetRef {\n validateQuestion: (\n responseId: string,\n rating?: keyof typeof QUESTIONS_RATING,\n skipRemainingQuestions?: boolean,\n ) => void;\n assignOptionalItems: (itemType: TItemType) => void;\n skipOptionalItems: (itemType: TItemType) => void;\n updateMediaState: (\n responseId: string,\n mediaType: TWORKSHEET_QUESTION_MEDIA_TYPE,\n mediaState: Record<string, unknown>,\n ) => void;\n allowRetry: (responseId: string) => void;\n}\n\ninterface IWorksheetHeaderLayoutArgs {\n isPuzzleWorksheet?: boolean;\n isTestWorksheet?: boolean;\n imageHue?: THueNames;\n userType?: TUserTypes;\n}\n\nexport interface IWorksheetHeaderLayoutProps {\n (args: IWorksheetHeaderLayoutArgs): {\n bgColor: TColorNames;\n borderColor?: TColorNames;\n textColor?: TColorNames;\n alignTextItem?: TStyleAttrubutes['alignItems'];\n };\n}\n\nexport type TWorksheetStoreProps = Omit<\n IBaseWorksheetProps,\n 'studentName' | 'itemsSignedRequest' | 'mode'\n> &\n Required<Pick<IBaseWorksheetProps, 'studentName'>> &\n Omit<IWorksheetCallbackProps, 'onLoaded' | 'onErrored'> &\n ICueCanvasProps &\n ICueCanvasCallbackProps &\n IPointerSyncCallbackProps &\n IWorksheetPlugins & {\n behavior: IWorksheetBehavior;\n learnosityItems: ILearnosityItem[];\n learnosityResponses?: Record<string, IWorksheetResponse>;\n learnosity: ILearnosity;\n appendedQuestionIds: string[];\n };\n\nexport enum EActiveQuestionTool {\n TEACHING_TOOLS = 'TEACHING_TOOLS',\n SOLUTION = 'SOLUTION',\n DISCUSSION = 'DISCUSSION',\n}\n\nexport interface IWorksheetStoreState {\n questions: IWorksheetQuestion[];\n renderableQuestions: IWorksheetQuestion[];\n responses: Record<string, IWorksheetResponse>;\n lastUnlockedQuestionIndex: number;\n initialQuestionId: string;\n activeQuestionId: string;\n activeQuestionIndex: number;\n questionsContainerWidth: number;\n maxQuestionWidth: number;\n actionbarHeight: number;\n summaryVisible: boolean;\n calculatorVisible: boolean;\n scribblingEnabled: boolean;\n activeQuestionTool?: EActiveQuestionTool;\n blocker?: TWorksheetBlocker;\n scrolledToInitialQuestion: boolean;\n}\n\n// Actions interface - contains all the methods\ninterface IWorksheetStoreActions {\n mergeWorksheetProps: (data: TWorksheetStoreProps) => void;\n setResponses: (\n responses:\n | IWorksheetStore['responses']\n | ((prevResponses: IWorksheetStore['responses']) => IWorksheetStore['responses']),\n ) => void;\n showSummary: () => void;\n hideSummary: () => void;\n toggleSummary: () => void;\n toggleCalculator: () => void;\n toggleScribble: () => void;\n setBlocker: (blocker?: TWorksheetBlocker) => void;\n /**\n *\n * @param scrollToLastUnlockedQuestion - If true, scrolls to the last unlocked question after removing the blocker. Default is true.\n * @returns\n */\n removeBlocker: (scrollToLastUnlockedQuestion?: boolean) => void;\n updateResponse: (options: {\n responseId: string;\n response: ILearnosityQuestionResponse;\n score: ILearnosityQuestionScore;\n timeSpent: number;\n answerChecked?: boolean;\n }) => void;\n updateMediaState: (\n responseId: string,\n mediaType: TWORKSHEET_QUESTION_MEDIA_TYPE,\n mediaState: Record<string, unknown>,\n ) => void;\n setDiscussionQuestionOffset: (responseId: string, offset: number) => void;\n markForReview: (responseId: string, markedForReview: boolean) => void;\n changeQuestion: (questionId: string, shouldScroll?: boolean, scrollDelay?: number) => void;\n setActiveQuestionTool: (tool: EActiveQuestionTool) => void;\n unsetActiveQuestionTool: () => void;\n destroy: () => void;\n}\n\n// Combined store interface\nexport interface IWorksheetStore\n extends IWorksheetStoreState,\n TWorksheetStoreProps,\n IWorksheetStoreActions {}\n"],"names":["QUESTION_TAGS","QUESTIONS_RATING","EActiveQuestionTool"],"mappings":"AAUY,IAAAA,sBAAAA,OACVA,EAAA,cAAc,eACdA,EAAA,gBAAgB,iBAFNA,IAAAA,KAAA,CAAA,CAAA,GAKAC,sBAAAA,OACVA,EAAAA,EAAA,IAAI,CAAJ,IAAA,KACAA,EAAAA,EAAA,IAAI,CAAJ,IAAA,KACAA,EAAAA,EAAA,IAAI,CAAJ,IAAA,KAHUA,IAAAA,KAAA,CAAA,CAAA,GA4jBAC,sBAAAA,OACVA,EAAA,iBAAiB,kBACjBA,EAAA,WAAW,YACXA,EAAA,aAAa,cAHHA,IAAAA,KAAA,CAAA,CAAA;"}
|
|
@@ -1,59 +1,60 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { memo as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { getWorksheetHeaderLayout as
|
|
7
|
-
import
|
|
8
|
-
import { WorksheetPageWrapper as
|
|
9
|
-
const
|
|
1
|
+
import { jsxs as h, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { memo as L, useMemo as i, useRef as P, useCallback as M } from "react";
|
|
3
|
+
import O from "../../ui/layout/flex-view.js";
|
|
4
|
+
import B from "../../ui/text/text.js";
|
|
5
|
+
import j from "../worksheet/worksheet.js";
|
|
6
|
+
import { getWorksheetHeaderLayout as D } from "../worksheet/worksheet-helpers.js";
|
|
7
|
+
import V from "./hooks/use-worksheet-layout.js";
|
|
8
|
+
import { WorksheetPageWrapper as z, HeaderWrapper as F, Header as G, StyledBackIcon as U, HeaderTitleWrapper as X } from "./worksheet-preview-styled.js";
|
|
9
|
+
const Z = [
|
|
10
10
|
"SAT_ENGLISH_ASSESSMENT",
|
|
11
11
|
"SAT_MATH_ASSESSMENT"
|
|
12
|
-
],
|
|
13
|
-
function(
|
|
12
|
+
], ne = L(
|
|
13
|
+
function(p) {
|
|
14
14
|
const {
|
|
15
15
|
studentId: d,
|
|
16
|
-
userType:
|
|
16
|
+
userType: s,
|
|
17
17
|
activityReference: t,
|
|
18
18
|
worksheet: k,
|
|
19
19
|
nodeType: e,
|
|
20
|
-
worksheetName:
|
|
21
|
-
showNudgeBanner:
|
|
22
|
-
markedAsCompleted:
|
|
23
|
-
imageHue:
|
|
24
|
-
onWorksheetLoaded:
|
|
25
|
-
onWorksheetErrored:
|
|
26
|
-
openQuestionFeedbackModal:
|
|
20
|
+
worksheetName: a,
|
|
21
|
+
showNudgeBanner: c,
|
|
22
|
+
markedAsCompleted: f,
|
|
23
|
+
imageHue: l,
|
|
24
|
+
onWorksheetLoaded: T,
|
|
25
|
+
onWorksheetErrored: g,
|
|
26
|
+
openQuestionFeedbackModal: S,
|
|
27
27
|
onBackIconClick: o,
|
|
28
|
-
activityType:
|
|
29
|
-
mode:
|
|
30
|
-
actionBarRightElement:
|
|
31
|
-
topOffset:
|
|
32
|
-
behaviorOverride:
|
|
33
|
-
layoutOverride:
|
|
34
|
-
worksheetBackIconRef:
|
|
35
|
-
} =
|
|
36
|
-
userType:
|
|
28
|
+
activityType: E,
|
|
29
|
+
mode: n,
|
|
30
|
+
actionBarRightElement: W,
|
|
31
|
+
topOffset: w = 56,
|
|
32
|
+
behaviorOverride: $,
|
|
33
|
+
layoutOverride: y,
|
|
34
|
+
worksheetBackIconRef: A
|
|
35
|
+
} = p, { signed_request: C, questions_signed_request: R } = k, x = i(() => e === "PUZZLE_CARD", [e]), m = i(() => t === "test", [t]), H = i(() => Z.includes(e), [e]), I = P(() => null), _ = V({
|
|
36
|
+
userType: s,
|
|
37
37
|
nodeType: e,
|
|
38
38
|
isSATAssessment: H,
|
|
39
|
-
showNudgeBanner:
|
|
40
|
-
topOffset:
|
|
41
|
-
imageHue:
|
|
42
|
-
layoutOverride:
|
|
43
|
-
}),
|
|
39
|
+
showNudgeBanner: c,
|
|
40
|
+
topOffset: w,
|
|
41
|
+
imageHue: l,
|
|
42
|
+
layoutOverride: y
|
|
43
|
+
}), v = M(() => {
|
|
44
44
|
o == null || o();
|
|
45
|
-
}, [o]), { bgColor: b, borderColor: q, textColor:
|
|
46
|
-
isPuzzleWorksheet:
|
|
47
|
-
isTestWorksheet:
|
|
48
|
-
imageHue:
|
|
45
|
+
}, [o]), { bgColor: b, borderColor: q, textColor: u, alignTextItem: N } = D({
|
|
46
|
+
isPuzzleWorksheet: x,
|
|
47
|
+
isTestWorksheet: m,
|
|
48
|
+
imageHue: l,
|
|
49
|
+
userType: s
|
|
49
50
|
});
|
|
50
|
-
return /* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */ r(
|
|
52
|
-
|
|
51
|
+
return /* @__PURE__ */ h(z, { children: [
|
|
52
|
+
/* @__PURE__ */ r(F, { children: /* @__PURE__ */ h(
|
|
53
|
+
G,
|
|
53
54
|
{
|
|
54
55
|
$flexDirection: "row",
|
|
55
56
|
$alignItems: "center",
|
|
56
|
-
$justifyContent:
|
|
57
|
+
$justifyContent: m ? "flex-start" : "center",
|
|
57
58
|
$background: b,
|
|
58
59
|
$height: 56,
|
|
59
60
|
$gutterX: 1,
|
|
@@ -61,51 +62,45 @@ const X = [
|
|
|
61
62
|
$borderColor: q,
|
|
62
63
|
children: [
|
|
63
64
|
o && /* @__PURE__ */ r(
|
|
64
|
-
G,
|
|
65
|
-
{
|
|
66
|
-
ref: C,
|
|
67
|
-
$color: h ?? "WHITE",
|
|
68
|
-
onClick: I
|
|
69
|
-
}
|
|
70
|
-
),
|
|
71
|
-
/* @__PURE__ */ r(
|
|
72
65
|
U,
|
|
73
66
|
{
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
ref: A,
|
|
68
|
+
$color: u ?? "WHITE",
|
|
69
|
+
onClick: v
|
|
76
70
|
}
|
|
77
|
-
)
|
|
71
|
+
),
|
|
72
|
+
/* @__PURE__ */ r(X, { $alignItems: N ?? "center", children: /* @__PURE__ */ r(B, { $renderAs: "ub2", $color: u, children: a || t }) })
|
|
78
73
|
]
|
|
79
74
|
}
|
|
80
75
|
) }),
|
|
81
|
-
/* @__PURE__ */ r(
|
|
82
|
-
|
|
76
|
+
/* @__PURE__ */ r(O, { $alignItems: "center", children: /* @__PURE__ */ r(
|
|
77
|
+
j,
|
|
83
78
|
{
|
|
84
|
-
userType:
|
|
85
|
-
worksheetCompleted:
|
|
86
|
-
worksheetName:
|
|
87
|
-
itemsSignedRequest:
|
|
88
|
-
questionsSignedRequest:
|
|
79
|
+
userType: s ?? (n === "review" ? "TEACHER" : "STUDENT"),
|
|
80
|
+
worksheetCompleted: n === "review",
|
|
81
|
+
worksheetName: a || t,
|
|
82
|
+
itemsSignedRequest: C,
|
|
83
|
+
questionsSignedRequest: R,
|
|
89
84
|
studentId: d,
|
|
90
|
-
layout:
|
|
91
|
-
loggerRef:
|
|
92
|
-
showNudgeBanner:
|
|
93
|
-
markedAsCompleted:
|
|
94
|
-
onLoaded:
|
|
95
|
-
onErrored:
|
|
85
|
+
layout: _,
|
|
86
|
+
loggerRef: I,
|
|
87
|
+
showNudgeBanner: c,
|
|
88
|
+
markedAsCompleted: f,
|
|
89
|
+
onLoaded: T,
|
|
90
|
+
onErrored: g,
|
|
96
91
|
userId: d,
|
|
97
|
-
openQuestionFeedbackModal:
|
|
92
|
+
openQuestionFeedbackModal: S,
|
|
98
93
|
nodeType: e,
|
|
99
|
-
mode:
|
|
100
|
-
activityType:
|
|
101
|
-
actionBarRightElement:
|
|
102
|
-
behaviorOverride:
|
|
94
|
+
mode: n,
|
|
95
|
+
activityType: E,
|
|
96
|
+
actionBarRightElement: W,
|
|
97
|
+
behaviorOverride: $
|
|
103
98
|
}
|
|
104
99
|
) })
|
|
105
100
|
] });
|
|
106
101
|
}
|
|
107
102
|
);
|
|
108
103
|
export {
|
|
109
|
-
|
|
104
|
+
ne as default
|
|
110
105
|
};
|
|
111
106
|
//# sourceMappingURL=worksheet-preview-view.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worksheet-preview-view.js","sources":["../../../../src/features/worksheet/worksheet-preview/worksheet-preview-view.tsx"],"sourcesContent":["import { memo, useCallback, useMemo, useRef, type FC } from 'react';\n\nimport type { IResumeWorksheetModel } from '../../../types/models/worksheet';\nimport FlexView from '../../ui/layout/flex-view';\nimport Text from '../../ui/text/text';\nimport Worksheet from '../worksheet/worksheet';\nimport { getWorksheetHeaderLayout } from '../worksheet/worksheet-helpers';\nimport useWorksheetLayout from './hooks/use-worksheet-layout';\nimport * as Styled from './worksheet-preview-styled';\nimport type { IPreviewWorksheetViewProps } from './worksheet-preview-types';\n\nconst SAT_WORKSHEET_TYPES: IResumeWorksheetModel['node_type'][] = [\n 'SAT_ENGLISH_ASSESSMENT',\n 'SAT_MATH_ASSESSMENT',\n];\n\nconst PreviewWorksheetView: FC<IPreviewWorksheetViewProps> = memo(\n function PreviewWorksheetView(props) {\n const {\n studentId,\n userType,\n activityReference,\n worksheet,\n nodeType,\n worksheetName,\n showNudgeBanner,\n markedAsCompleted,\n imageHue,\n onWorksheetLoaded,\n onWorksheetErrored,\n openQuestionFeedbackModal,\n onBackIconClick,\n activityType,\n mode,\n actionBarRightElement,\n topOffset = 56,\n behaviorOverride,\n layoutOverride,\n worksheetBackIconRef,\n } = props;\n const { signed_request: signedRequest, questions_signed_request: questionsSignedRequest } =\n worksheet;\n\n const isPuzzleWorksheet = useMemo(() => nodeType === 'PUZZLE_CARD', [nodeType]);\n const isTestWorksheet = useMemo(() => activityReference === 'test', [activityReference]);\n const isSATAssessment = useMemo(() => SAT_WORKSHEET_TYPES.includes(nodeType), [nodeType]);\n const loggerRef = useRef(() => null);\n\n const layout = useWorksheetLayout({\n userType,\n nodeType,\n isSATAssessment,\n showNudgeBanner,\n topOffset,\n imageHue,\n layoutOverride,\n });\n\n const handleOnBackIconClick = useCallback(() => {\n onBackIconClick?.();\n }, [onBackIconClick]);\n\n const { bgColor, borderColor, textColor } = getWorksheetHeaderLayout({\n isPuzzleWorksheet: isPuzzleWorksheet,\n isTestWorksheet,\n imageHue,\n });\n\n return (\n <Styled.WorksheetPageWrapper>\n <Styled.HeaderWrapper>\n <Styled.Header\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $justifyContent={isTestWorksheet ? 'flex-start' : 'center'}\n $background={bgColor}\n $height={56}\n $gutterX={1}\n $flexGapX={1}\n $borderColor={borderColor}\n >\n {onBackIconClick && (\n <Styled.StyledBackIcon\n ref={worksheetBackIconRef}\n $color={textColor ?? 'WHITE'}\n onClick={handleOnBackIconClick}\n />\n )}\n\n <Styled.HeaderTitleWrapper
|
|
1
|
+
{"version":3,"file":"worksheet-preview-view.js","sources":["../../../../src/features/worksheet/worksheet-preview/worksheet-preview-view.tsx"],"sourcesContent":["import { memo, useCallback, useMemo, useRef, type FC } from 'react';\n\nimport type { IResumeWorksheetModel } from '../../../types/models/worksheet';\nimport FlexView from '../../ui/layout/flex-view';\nimport Text from '../../ui/text/text';\nimport Worksheet from '../worksheet/worksheet';\nimport { getWorksheetHeaderLayout } from '../worksheet/worksheet-helpers';\nimport useWorksheetLayout from './hooks/use-worksheet-layout';\nimport * as Styled from './worksheet-preview-styled';\nimport type { IPreviewWorksheetViewProps } from './worksheet-preview-types';\n\nconst SAT_WORKSHEET_TYPES: IResumeWorksheetModel['node_type'][] = [\n 'SAT_ENGLISH_ASSESSMENT',\n 'SAT_MATH_ASSESSMENT',\n];\n\nconst PreviewWorksheetView: FC<IPreviewWorksheetViewProps> = memo(\n function PreviewWorksheetView(props) {\n const {\n studentId,\n userType,\n activityReference,\n worksheet,\n nodeType,\n worksheetName,\n showNudgeBanner,\n markedAsCompleted,\n imageHue,\n onWorksheetLoaded,\n onWorksheetErrored,\n openQuestionFeedbackModal,\n onBackIconClick,\n activityType,\n mode,\n actionBarRightElement,\n topOffset = 56,\n behaviorOverride,\n layoutOverride,\n worksheetBackIconRef,\n } = props;\n const { signed_request: signedRequest, questions_signed_request: questionsSignedRequest } =\n worksheet;\n\n const isPuzzleWorksheet = useMemo(() => nodeType === 'PUZZLE_CARD', [nodeType]);\n const isTestWorksheet = useMemo(() => activityReference === 'test', [activityReference]);\n const isSATAssessment = useMemo(() => SAT_WORKSHEET_TYPES.includes(nodeType), [nodeType]);\n const loggerRef = useRef(() => null);\n\n const layout = useWorksheetLayout({\n userType,\n nodeType,\n isSATAssessment,\n showNudgeBanner,\n topOffset,\n imageHue,\n layoutOverride,\n });\n\n const handleOnBackIconClick = useCallback(() => {\n onBackIconClick?.();\n }, [onBackIconClick]);\n\n const { bgColor, borderColor, textColor, alignTextItem } = getWorksheetHeaderLayout({\n isPuzzleWorksheet: isPuzzleWorksheet,\n isTestWorksheet,\n imageHue,\n userType,\n });\n\n return (\n <Styled.WorksheetPageWrapper>\n <Styled.HeaderWrapper>\n <Styled.Header\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $justifyContent={isTestWorksheet ? 'flex-start' : 'center'}\n $background={bgColor}\n $height={56}\n $gutterX={1}\n $flexGapX={1}\n $borderColor={borderColor}\n >\n {onBackIconClick && (\n <Styled.StyledBackIcon\n ref={worksheetBackIconRef}\n $color={textColor ?? 'WHITE'}\n onClick={handleOnBackIconClick}\n />\n )}\n\n <Styled.HeaderTitleWrapper $alignItems={alignTextItem ?? 'center'}>\n <Text $renderAs=\"ub2\" $color={textColor}>\n {worksheetName || activityReference}\n </Text>\n </Styled.HeaderTitleWrapper>\n </Styled.Header>\n </Styled.HeaderWrapper>\n\n <FlexView $alignItems=\"center\">\n <Worksheet\n userType={userType ?? (mode === 'review' ? 'TEACHER' : 'STUDENT')}\n worksheetCompleted={mode === 'review'}\n worksheetName={worksheetName || activityReference}\n itemsSignedRequest={signedRequest}\n questionsSignedRequest={questionsSignedRequest}\n studentId={studentId}\n layout={layout}\n loggerRef={loggerRef}\n showNudgeBanner={showNudgeBanner}\n markedAsCompleted={markedAsCompleted}\n onLoaded={onWorksheetLoaded}\n onErrored={onWorksheetErrored}\n userId={studentId}\n openQuestionFeedbackModal={openQuestionFeedbackModal}\n nodeType={nodeType}\n mode={mode}\n activityType={activityType}\n actionBarRightElement={actionBarRightElement}\n behaviorOverride={behaviorOverride}\n />\n </FlexView>\n </Styled.WorksheetPageWrapper>\n );\n },\n);\n\nexport default PreviewWorksheetView;\n"],"names":["SAT_WORKSHEET_TYPES","PreviewWorksheetView","memo","props","studentId","userType","activityReference","worksheet","nodeType","worksheetName","showNudgeBanner","markedAsCompleted","imageHue","onWorksheetLoaded","onWorksheetErrored","openQuestionFeedbackModal","onBackIconClick","activityType","mode","actionBarRightElement","topOffset","behaviorOverride","layoutOverride","worksheetBackIconRef","signedRequest","questionsSignedRequest","isPuzzleWorksheet","useMemo","isTestWorksheet","isSATAssessment","loggerRef","useRef","layout","useWorksheetLayout","handleOnBackIconClick","useCallback","bgColor","borderColor","textColor","alignTextItem","getWorksheetHeaderLayout","jsxs","Styled.WorksheetPageWrapper","jsx","Styled.HeaderWrapper","Styled.Header","Styled.StyledBackIcon","Styled.HeaderTitleWrapper","Text","FlexView","Worksheet"],"mappings":";;;;;;;;AAWA,MAAMA,IAA4D;AAAA,EAChE;AAAA,EACA;AACF,GAEMC,KAAuDC;AAAA,EAC3D,SAA8BC,GAAO;AAC7B,UAAA;AAAA,MACJ,WAAAC;AAAA,MACA,UAAAC;AAAA,MACA,mBAAAC;AAAA,MACA,WAAAC;AAAA,MACA,UAAAC;AAAA,MACA,eAAAC;AAAA,MACA,iBAAAC;AAAA,MACA,mBAAAC;AAAA,MACA,UAAAC;AAAA,MACA,mBAAAC;AAAA,MACA,oBAAAC;AAAA,MACA,2BAAAC;AAAA,MACA,iBAAAC;AAAA,MACA,cAAAC;AAAA,MACA,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;AAAA,gBACL,QAAQe,KAAa;AAAA,gBACrB,SAASJ;AAAA,cAAA;AAAA,YACX;AAAA,YAGD,gBAAAS,EAAAI,GAAA,EAA0B,aAAaR,KAAiB,UACvD,UAAC,gBAAAI,EAAAK,GAAA,EAAK,WAAU,OAAM,QAAQV,GAC3B,UAAA7B,KAAiBH,EACpB,CAAA,GACF;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA,GAEJ;AAAA,MAEA,gBAAAqC,EAACM,GAAS,EAAA,aAAY,UACpB,UAAA,gBAAAN;AAAA,QAACO;AAAA,QAAA;AAAA,UACC,UAAU7C,MAAaa,MAAS,WAAW,YAAY;AAAA,UACvD,oBAAoBA,MAAS;AAAA,UAC7B,eAAeT,KAAiBH;AAAA,UAChC,oBAAoBkB;AAAA,UACpB,wBAAAC;AAAA,UACA,WAAArB;AAAA,UACA,QAAA4B;AAAA,UACA,WAAAF;AAAA,UACA,iBAAApB;AAAA,UACA,mBAAAC;AAAA,UACA,UAAUE;AAAA,UACV,WAAWC;AAAA,UACX,QAAQV;AAAA,UACR,2BAAAW;AAAA,UACA,UAAAP;AAAA,UACA,MAAAU;AAAA,UACA,cAAAD;AAAA,UACA,uBAAAE;AAAA,UACA,kBAAAE;AAAA,QAAA;AAAA,MAAA,GAEJ;AAAA,IACF,EAAA,CAAA;AAAA,EAEJ;AACF;"}
|
package/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { createPostAPI as t } from "@cuemath/rest-api";
|
|
2
|
-
import { BASE_URL_V1 as e } from "../../../constants/api.js";
|
|
3
|
-
const { usePost: m } = t({
|
|
4
|
-
getURL: () => `${e}/utility/send-email`
|
|
5
|
-
});
|
|
6
|
-
export {
|
|
7
|
-
m as useSendEmail
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=send-email.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"send-email.js","sources":["../../../../src/features/fraud-detection/api/send-email.tsx"],"sourcesContent":["import { createPostAPI } from '@cuemath/rest-api';\n\nimport { BASE_URL_V1 } from '../../../constants/api';\nimport { type IFraudEmailPayload } from '../hooks/report-fraud-types';\n\nexport const { usePost: useSendEmail } = createPostAPI<null, IFraudEmailPayload>({\n getURL: () => `${BASE_URL_V1}/utility/send-email`,\n});\n"],"names":["useSendEmail","createPostAPI","BASE_URL_V1"],"mappings":";;AAKO,MAAM,EAAE,SAASA,EAAa,IAAIC,EAAwC;AAAA,EAC/E,QAAQ,MAAM,GAAGC,CAAW;AAC9B,CAAC;"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
const p = ({
|
|
2
|
-
teacherId: t,
|
|
3
|
-
studentName: e,
|
|
4
|
-
studentId: o,
|
|
5
|
-
classStartTs: d,
|
|
6
|
-
teacherClassroomId: r,
|
|
7
|
-
studentClassroomId: l,
|
|
8
|
-
teacherUrl: a,
|
|
9
|
-
studentUrl: n
|
|
10
|
-
}) => `
|
|
11
|
-
<div style="font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; max-width: 800px; margin: 0 auto; background-color: #ffffff; padding: 30px; border: 1px solid #e0e0e0; border-radius: 8px;">
|
|
12
|
-
<h2 style="margin: 0; font-weight: 500;">A teacher has been flagged for breach of professional standards due to fraud login during a regular class session.</h2>
|
|
13
|
-
<h3 style=" margin: 30px 0 15px 0; font-size: 18px; font-weight: 600; padding-bottom: 8px;">📋 Evidence Captured:</h3>
|
|
14
|
-
<table style="border-collapse: collapse; width: 80%; margin: 20px auto; box-shadow: 0 2px 4px rgba(0,0,0,0.08); border-radius: 8px; overflow: hidden;">
|
|
15
|
-
<tbody>
|
|
16
|
-
<tr style="background-color: #f8f9fa;">
|
|
17
|
-
<td style="padding: 14px 16px; border-bottom: 1px solid #e0e0e0; font-weight: 600; color: #424242; width: 40%;">Tutor ID</td>
|
|
18
|
-
<td style="padding: 14px 16px; border-bottom: 1px solid #e0e0e0; color: #212121;">${t}</td>
|
|
19
|
-
</tr>
|
|
20
|
-
<tr style="background-color: #ffffff;">
|
|
21
|
-
<td style="padding: 14px 16px; border-bottom: 1px solid #e0e0e0; font-weight: 600; color: #424242;">Student Name</td>
|
|
22
|
-
<td style="padding: 14px 16px; border-bottom: 1px solid #e0e0e0; color: #212121;">${e}</td>
|
|
23
|
-
</tr>
|
|
24
|
-
<tr style="background-color: #f8f9fa;">
|
|
25
|
-
<td style="padding: 14px 16px; border-bottom: 1px solid #e0e0e0; font-weight: 600; color: #424242;">Student ID</td>
|
|
26
|
-
<td style="padding: 14px 16px; border-bottom: 1px solid #e0e0e0; color: #212121;">${o}</td>
|
|
27
|
-
</tr>
|
|
28
|
-
<tr style="background-color: #ffffff;">
|
|
29
|
-
<td style="padding: 14px 16px; border-bottom: 1px solid #e0e0e0; font-weight: 600; color: #424242;">Class Date & Time</td>
|
|
30
|
-
<td style="padding: 14px 16px; border-bottom: 1px solid #e0e0e0; color: #212121;">${new Date(
|
|
31
|
-
d * 1e3
|
|
32
|
-
).toLocaleString()}</td>
|
|
33
|
-
</tr>
|
|
34
|
-
<tr style="background-color: #f8f9fa;">
|
|
35
|
-
<td style="padding: 14px 16px; border-bottom: 1px solid #e0e0e0; font-weight: 600; color: #424242;">Teacher Classroom ID</td>
|
|
36
|
-
<td style="padding: 14px 16px; border-bottom: 1px solid #e0e0e0; color: #212121; font-family: monospace; font-size: 13px;">${r}</td>
|
|
37
|
-
</tr>
|
|
38
|
-
<tr style="background-color: #ffffff;">
|
|
39
|
-
<td style="padding: 14px 16px; border-bottom: 1px solid #e0e0e0; font-weight: 600; color: #424242;">Student Classroom ID</td>
|
|
40
|
-
<td style="padding: 14px 16px; border-bottom: 1px solid #e0e0e0; color: #212121; font-family: monospace; font-size: 13px;">${l}</td>
|
|
41
|
-
</tr>
|
|
42
|
-
<tr style="background-color: #f8f9fa;">
|
|
43
|
-
<td style="padding: 14px 16px; border-bottom: 1px solid #e0e0e0; font-weight: 600; color: #424242;">Teacher Screenshot</td>
|
|
44
|
-
<td style="padding: 14px 16px; border-bottom: 1px solid #e0e0e0;">
|
|
45
|
-
<a href="${a}" style="color: #1976d2; text-decoration: none; font-weight: 500; display: inline-flex; align-items: center;">
|
|
46
|
-
<span style="margin-right: 6px;">🔗</span> View Screenshot
|
|
47
|
-
</a>
|
|
48
|
-
</td>
|
|
49
|
-
</tr>
|
|
50
|
-
<tr style="background-color: #ffffff;">
|
|
51
|
-
<td style="padding: 14px 16px; font-weight: 600; color: #424242;">Student Screenshot</td>
|
|
52
|
-
<td style="padding: 14px 16px;">
|
|
53
|
-
<a href="${n}" style="color: #1976d2; text-decoration: none; font-weight: 500; display: inline-flex; align-items: center;">
|
|
54
|
-
<span style="margin-right: 6px;">🔗</span> View Screenshot
|
|
55
|
-
</a>
|
|
56
|
-
</td>
|
|
57
|
-
</tr>
|
|
58
|
-
</tbody>
|
|
59
|
-
</table>
|
|
60
|
-
</div>
|
|
61
|
-
`;
|
|
62
|
-
export {
|
|
63
|
-
p as generateEmailBody
|
|
64
|
-
};
|
|
65
|
-
//# sourceMappingURL=report-fraud-helper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"report-fraud-helper.js","sources":["../../../../src/features/fraud-detection/hooks/report-fraud-helper.ts"],"sourcesContent":["export const generateEmailBody = ({\n teacherId,\n studentName,\n studentId,\n classStartTs,\n teacherClassroomId,\n studentClassroomId,\n teacherUrl,\n studentUrl,\n}: {\n teacherId: string;\n studentName: string;\n studentId: string;\n classStartTs: number;\n teacherClassroomId: string;\n studentClassroomId: string;\n teacherUrl: string;\n studentUrl: string;\n}) => `\n <div style=\"font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; max-width: 800px; margin: 0 auto; background-color: #ffffff; padding: 30px; border: 1px solid #e0e0e0; border-radius: 8px;\">\n <h2 style=\"margin: 0; font-weight: 500;\">A teacher has been flagged for breach of professional standards due to fraud login during a regular class session.</h2>\n <h3 style=\" margin: 30px 0 15px 0; font-size: 18px; font-weight: 600; padding-bottom: 8px;\">📋 Evidence Captured:</h3>\n <table style=\"border-collapse: collapse; width: 80%; margin: 20px auto; box-shadow: 0 2px 4px rgba(0,0,0,0.08); border-radius: 8px; overflow: hidden;\">\n <tbody>\n <tr style=\"background-color: #f8f9fa;\">\n <td style=\"padding: 14px 16px; border-bottom: 1px solid #e0e0e0; font-weight: 600; color: #424242; width: 40%;\">Tutor ID</td>\n <td style=\"padding: 14px 16px; border-bottom: 1px solid #e0e0e0; color: #212121;\">${teacherId}</td>\n </tr>\n <tr style=\"background-color: #ffffff;\">\n <td style=\"padding: 14px 16px; border-bottom: 1px solid #e0e0e0; font-weight: 600; color: #424242;\">Student Name</td>\n <td style=\"padding: 14px 16px; border-bottom: 1px solid #e0e0e0; color: #212121;\">${studentName}</td>\n </tr>\n <tr style=\"background-color: #f8f9fa;\">\n <td style=\"padding: 14px 16px; border-bottom: 1px solid #e0e0e0; font-weight: 600; color: #424242;\">Student ID</td>\n <td style=\"padding: 14px 16px; border-bottom: 1px solid #e0e0e0; color: #212121;\">${studentId}</td>\n </tr>\n <tr style=\"background-color: #ffffff;\">\n <td style=\"padding: 14px 16px; border-bottom: 1px solid #e0e0e0; font-weight: 600; color: #424242;\">Class Date & Time</td>\n <td style=\"padding: 14px 16px; border-bottom: 1px solid #e0e0e0; color: #212121;\">${new Date(\n classStartTs * 1000,\n ).toLocaleString()}</td>\n </tr>\n <tr style=\"background-color: #f8f9fa;\">\n <td style=\"padding: 14px 16px; border-bottom: 1px solid #e0e0e0; font-weight: 600; color: #424242;\">Teacher Classroom ID</td>\n <td style=\"padding: 14px 16px; border-bottom: 1px solid #e0e0e0; color: #212121; font-family: monospace; font-size: 13px;\">${teacherClassroomId}</td>\n </tr>\n <tr style=\"background-color: #ffffff;\">\n <td style=\"padding: 14px 16px; border-bottom: 1px solid #e0e0e0; font-weight: 600; color: #424242;\">Student Classroom ID</td>\n <td style=\"padding: 14px 16px; border-bottom: 1px solid #e0e0e0; color: #212121; font-family: monospace; font-size: 13px;\">${studentClassroomId}</td>\n </tr>\n <tr style=\"background-color: #f8f9fa;\">\n <td style=\"padding: 14px 16px; border-bottom: 1px solid #e0e0e0; font-weight: 600; color: #424242;\">Teacher Screenshot</td>\n <td style=\"padding: 14px 16px; border-bottom: 1px solid #e0e0e0;\">\n <a href=\"${teacherUrl}\" style=\"color: #1976d2; text-decoration: none; font-weight: 500; display: inline-flex; align-items: center;\">\n <span style=\"margin-right: 6px;\">🔗</span> View Screenshot\n </a>\n </td>\n </tr>\n <tr style=\"background-color: #ffffff;\">\n <td style=\"padding: 14px 16px; font-weight: 600; color: #424242;\">Student Screenshot</td>\n <td style=\"padding: 14px 16px;\">\n <a href=\"${studentUrl}\" style=\"color: #1976d2; text-decoration: none; font-weight: 500; display: inline-flex; align-items: center;\">\n <span style=\"margin-right: 6px;\">🔗</span> View Screenshot\n </a>\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n`;\n"],"names":["generateEmailBody","teacherId","studentName","studentId","classStartTs","teacherClassroomId","studentClassroomId","teacherUrl","studentUrl"],"mappings":"AAAO,MAAMA,IAAoB,CAAC;AAAA,EAChC,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AACF,MASM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,8FAQwFP,CAAS;AAAA;AAAA;AAAA;AAAA,8FAITC,CAAW;AAAA;AAAA;AAAA;AAAA,8FAIXC,CAAS;AAAA;AAAA;AAAA;AAAA,8FAIT,IAAI;AAAA,EACtFC,IAAe;AACjB,EAAE,gBAAgB;AAAA;AAAA;AAAA;AAAA,uIAI2GC,CAAkB;AAAA;AAAA;AAAA;AAAA,uIAIlBC,CAAkB;AAAA;AAAA;AAAA;AAAA;AAAA,uBAKlIC,CAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAQVC,CAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|