@cuemath/leap 3.0.22-aa3 → 3.0.22-aa5
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/assets/line-icons/icons/check.js +3 -3
- package/dist/assets/line-icons/icons/check.js.map +1 -1
- package/dist/features/cue-canvas/cue-canvas-context.js +5 -8
- package/dist/features/cue-canvas/cue-canvas-context.js.map +1 -1
- package/dist/features/cue-canvas/cue-canvas-core.js +47 -51
- package/dist/features/cue-canvas/cue-canvas-core.js.map +1 -1
- package/dist/features/cue-canvas/cue-canvas-helpers.js +25 -31
- package/dist/features/cue-canvas/cue-canvas-helpers.js.map +1 -1
- package/dist/features/cue-canvas/cue-canvas-provider.js +12 -14
- package/dist/features/cue-canvas/cue-canvas-provider.js.map +1 -1
- package/dist/features/cue-canvas/cue-canvas.js +59 -61
- package/dist/features/cue-canvas/cue-canvas.js.map +1 -1
- package/dist/features/cue-canvas/cue-cavas-styled.js +42 -45
- package/dist/features/cue-canvas/cue-cavas-styled.js.map +1 -1
- package/dist/features/cue-canvas/hooks/use-canvas-sync-broker.js +46 -50
- package/dist/features/cue-canvas/hooks/use-canvas-sync-broker.js.map +1 -1
- package/dist/features/cue-canvas/hooks/use-cue-canvas-actions.js +14 -18
- package/dist/features/cue-canvas/hooks/use-cue-canvas-actions.js.map +1 -1
- package/dist/features/hooks/use-async-error.js +16 -0
- package/dist/features/hooks/use-async-error.js.map +1 -0
- package/dist/features/ui/stepper/stepper.js +7 -7
- package/dist/features/worksheet/worksheet/hooks/use-s3-helper.js +19 -22
- package/dist/features/worksheet/worksheet/hooks/use-s3-helper.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-helpers.js +81 -66
- package/dist/features/worksheet/worksheet/worksheet-helpers.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-questions-controller/use-handler-callbacks.js +107 -99
- package/dist/features/worksheet/worksheet/worksheet-questions-controller/use-handler-callbacks.js.map +1 -1
- package/dist/index.d.ts +1 -36
- package/dist/index.js +209 -213
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/assets/line-icons/icons/puzzle-icon.js +0 -51
- package/dist/assets/line-icons/icons/puzzle-icon.js.map +0 -1
- package/dist/assets/line-icons/icons/share.js +0 -48
- package/dist/assets/line-icons/icons/share.js.map +0 -1
- package/dist/assets/line-icons/icons/tile.js +0 -54
- package/dist/assets/line-icons/icons/tile.js.map +0 -1
- package/dist/features/cue-canvas/bottombar/homework-controls.js +0 -73
- package/dist/features/cue-canvas/bottombar/homework-controls.js.map +0 -1
- package/dist/features/cue-canvas/hooks/use-upload-helper.js +0 -23
- package/dist/features/cue-canvas/hooks/use-upload-helper.js.map +0 -1
- package/dist/features/cue-canvas/sidebar/homework/helper.js +0 -20
- package/dist/features/cue-canvas/sidebar/homework/helper.js.map +0 -1
- package/dist/features/cue-canvas/sidebar/homework/homework-menu.js +0 -33
- package/dist/features/cue-canvas/sidebar/homework/homework-menu.js.map +0 -1
- package/dist/features/cue-canvas/sidebar/homework/homework-request.js +0 -61
- package/dist/features/cue-canvas/sidebar/homework/homework-request.js.map +0 -1
- package/dist/features/cue-canvas/sidebar/homework/homework-styled.js +0 -25
- package/dist/features/cue-canvas/sidebar/homework/homework-styled.js.map +0 -1
- package/dist/features/cue-canvas/sidebar/homework/homework.js +0 -39
- package/dist/features/cue-canvas/sidebar/homework/homework.js.map +0 -1
- package/dist/features/cue-canvas/sidebar/puzzles/api/get-puzzles.js +0 -13
- package/dist/features/cue-canvas/sidebar/puzzles/api/get-puzzles.js.map +0 -1
- package/dist/features/cue-canvas/sidebar/puzzles/filter-selection-menu.js +0 -60
- package/dist/features/cue-canvas/sidebar/puzzles/filter-selection-menu.js.map +0 -1
- package/dist/features/cue-canvas/sidebar/puzzles/filters-section.js +0 -44
- package/dist/features/cue-canvas/sidebar/puzzles/filters-section.js.map +0 -1
- package/dist/features/cue-canvas/sidebar/puzzles/filters.js +0 -107
- package/dist/features/cue-canvas/sidebar/puzzles/filters.js.map +0 -1
- package/dist/features/cue-canvas/sidebar/puzzles/hooks/use-fetch-cue-canvas-activity.js +0 -42
- package/dist/features/cue-canvas/sidebar/puzzles/hooks/use-fetch-cue-canvas-activity.js.map +0 -1
- package/dist/features/cue-canvas/sidebar/puzzles/launch-puzzle.js +0 -84
- package/dist/features/cue-canvas/sidebar/puzzles/launch-puzzle.js.map +0 -1
- package/dist/features/cue-canvas/sidebar/puzzles/puzzle-menu-header.js +0 -36
- package/dist/features/cue-canvas/sidebar/puzzles/puzzle-menu-header.js.map +0 -1
- package/dist/features/cue-canvas/sidebar/puzzles/puzzle-menu.js +0 -133
- package/dist/features/cue-canvas/sidebar/puzzles/puzzle-menu.js.map +0 -1
- package/dist/features/cue-canvas/sidebar/puzzles/puzzles-styled.js +0 -96
- package/dist/features/cue-canvas/sidebar/puzzles/puzzles-styled.js.map +0 -1
- package/dist/features/cue-canvas/sidebar/puzzles/puzzles.js +0 -29
- package/dist/features/cue-canvas/sidebar/puzzles/puzzles.js.map +0 -1
- package/dist/features/cue-canvas/sidebar/puzzles/utils.js +0 -120
- package/dist/features/cue-canvas/sidebar/puzzles/utils.js.map +0 -1
- package/dist/features/cue-canvas/sidebar/sidebar-styled.js +0 -32
- package/dist/features/cue-canvas/sidebar/sidebar-styled.js.map +0 -1
- package/dist/features/cue-canvas/sidebar/sidebar.js +0 -29
- package/dist/features/cue-canvas/sidebar/sidebar.js.map +0 -1
- package/dist/features/cue-canvas/sidebar/tiles/tile.js +0 -16
- package/dist/features/cue-canvas/sidebar/tiles/tile.js.map +0 -1
- package/dist/features/hooks/use-debounce.js +0 -16
- package/dist/features/hooks/use-debounce.js.map +0 -1
@@ -1,32 +1,28 @@
|
|
1
|
-
import { useContext as
|
2
|
-
import
|
3
|
-
const
|
1
|
+
import { useContext as c, useMemo as l } from "react";
|
2
|
+
import a from "../cue-canvas-context.js";
|
3
|
+
const m = () => {
|
4
4
|
const {
|
5
|
-
activeInstance:
|
6
|
-
setActiveTool:
|
5
|
+
activeInstance: t,
|
6
|
+
setActiveTool: o,
|
7
7
|
activeTool: e,
|
8
|
-
setActiveInstance:
|
8
|
+
setActiveInstance: i,
|
9
9
|
activeColor: s,
|
10
|
-
setActiveColor:
|
11
|
-
|
12
|
-
setHomeworkId: c
|
13
|
-
} = a(v), l = m(
|
10
|
+
setActiveColor: n
|
11
|
+
} = c(a), r = l(
|
14
12
|
() => e ? ["pen", "ruler", "highlighter", "marker"].includes(e) : !1,
|
15
13
|
[e]
|
16
14
|
);
|
17
15
|
return {
|
18
|
-
activeInstance:
|
19
|
-
setActiveTool:
|
16
|
+
activeInstance: t,
|
17
|
+
setActiveTool: o,
|
20
18
|
activeTool: e,
|
21
|
-
setActiveInstance:
|
19
|
+
setActiveInstance: i,
|
22
20
|
activeColor: s,
|
23
|
-
setActiveColor:
|
24
|
-
isWritingToolActive:
|
25
|
-
homeworkId: n,
|
26
|
-
setHomeworkId: c
|
21
|
+
setActiveColor: n,
|
22
|
+
isWritingToolActive: r
|
27
23
|
};
|
28
24
|
};
|
29
25
|
export {
|
30
|
-
|
26
|
+
m as useCueCanvasActions
|
31
27
|
};
|
32
28
|
//# sourceMappingURL=use-cue-canvas-actions.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-cue-canvas-actions.js","sources":["../../../../src/features/cue-canvas/hooks/use-cue-canvas-actions.ts"],"sourcesContent":["import { useContext, useMemo } from 'react';\n\nimport PolyContext from '../cue-canvas-context';\n\nexport const useCueCanvasActions = () => {\n const {\n activeInstance,\n setActiveTool,\n activeTool,\n setActiveInstance,\n activeColor,\n setActiveColor,\n
|
1
|
+
{"version":3,"file":"use-cue-canvas-actions.js","sources":["../../../../src/features/cue-canvas/hooks/use-cue-canvas-actions.ts"],"sourcesContent":["import { useContext, useMemo } from 'react';\n\nimport PolyContext from '../cue-canvas-context';\n\nexport const useCueCanvasActions = () => {\n const {\n activeInstance,\n setActiveTool,\n activeTool,\n setActiveInstance,\n activeColor,\n setActiveColor,\n } = useContext(PolyContext);\n\n const isWritingToolActive = useMemo(\n () => (activeTool ? ['pen', 'ruler', 'highlighter', 'marker'].includes(activeTool) : false),\n [activeTool],\n );\n\n return {\n activeInstance,\n setActiveTool,\n activeTool,\n setActiveInstance,\n activeColor,\n setActiveColor,\n isWritingToolActive,\n };\n};\n"],"names":["useCueCanvasActions","activeInstance","setActiveTool","activeTool","setActiveInstance","activeColor","setActiveColor","useContext","PolyContext","isWritingToolActive","useMemo"],"mappings":";;AAIO,MAAMA,IAAsB,MAAM;AACjC,QAAA;AAAA,IACJ,gBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,YAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,gBAAAC;AAAA,EAAA,IACEC,EAAWC,CAAW,GAEpBC,IAAsBC;AAAA,IAC1B,MAAOP,IAAa,CAAC,OAAO,SAAS,eAAe,QAAQ,EAAE,SAASA,CAAU,IAAI;AAAA,IACrF,CAACA,CAAU;AAAA,EAAA;AAGN,SAAA;AAAA,IACL,gBAAAF;AAAA,IACA,eAAAC;AAAA,IACA,YAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,qBAAAG;AAAA,EAAA;AAEJ;"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { useState as o, useCallback as e } from "react";
|
2
|
+
const c = () => {
|
3
|
+
const [, r] = o();
|
4
|
+
return e(
|
5
|
+
(t) => {
|
6
|
+
r(() => {
|
7
|
+
throw t;
|
8
|
+
});
|
9
|
+
},
|
10
|
+
[r]
|
11
|
+
);
|
12
|
+
};
|
13
|
+
export {
|
14
|
+
c as useAsyncError
|
15
|
+
};
|
16
|
+
//# sourceMappingURL=use-async-error.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"use-async-error.js","sources":["../../../src/features/hooks/use-async-error.ts"],"sourcesContent":["import { useCallback, useState } from 'react';\n\nexport const useAsyncError = () => {\n const [, setError] = useState();\n\n return useCallback(\n (e: Error) => {\n setError(() => {\n throw e;\n });\n },\n [setError],\n );\n};\n"],"names":["useAsyncError","setError","useState","useCallback","e"],"mappings":";AAEO,MAAMA,IAAgB,MAAM;AACjC,QAAM,CAAG,EAAAC,CAAQ,IAAIC;AAEd,SAAAC;AAAA,IACL,CAACC,MAAa;AACZ,MAAAH,EAAS,MAAM;AACP,cAAAG;AAAA,MAAA,CACP;AAAA,IACH;AAAA,IACA,CAACH,CAAQ;AAAA,EAAA;AAEb;"}
|
@@ -1,14 +1,14 @@
|
|
1
1
|
import { jsxs as o, jsx as t } from "react/jsx-runtime";
|
2
|
-
import
|
3
|
-
import
|
2
|
+
import m from "../../../assets/line-icons/icons/check.js";
|
3
|
+
import h from "../text/text.js";
|
4
4
|
import { getTheme as p } from "../theme/get-theme.js";
|
5
5
|
import { MainWrapper as a, HorizontalLine as d, Wrapper as g, NumberWrapper as f, StyledText as s } from "./stepper-styled.js";
|
6
6
|
const { layout: u } = p(), { gutter: i } = u;
|
7
|
-
function
|
7
|
+
function j({ stepsInfo: n = [], currentStep: e = 2 }) {
|
8
8
|
const c = n.length && e >= 1 ? (e - 1) / n.length * 100 : 0;
|
9
9
|
return /* @__PURE__ */ o(a, { $flexDirection: "row", $width: "fit-content", $gutterX: 0.625, $gapX: 0.625, children: [
|
10
10
|
/* @__PURE__ */ t(d, { $percentageCompleted: c, $height: 1 }),
|
11
|
-
n.map(({ id: $, label:
|
11
|
+
n.map(({ id: $, label: l }, r) => /* @__PURE__ */ o(
|
12
12
|
g,
|
13
13
|
{
|
14
14
|
$flexDirection: "row",
|
@@ -25,10 +25,10 @@ function W({ stepsInfo: n = [], currentStep: e = 2 }) {
|
|
25
25
|
$justifyContent: "center",
|
26
26
|
$heightX: 1.25,
|
27
27
|
$widthX: 1.25,
|
28
|
-
children: r + 1 < e ? /* @__PURE__ */ t(
|
28
|
+
children: r + 1 < e ? /* @__PURE__ */ t(m, { height: i, width: i }) : /* @__PURE__ */ t(h, { $renderAs: "body3", $color: "WHITE", children: $ })
|
29
29
|
}
|
30
30
|
),
|
31
|
-
r + 1 === e && /* @__PURE__ */ t(s, { $renderAs: "body2", children:
|
31
|
+
r + 1 === e && /* @__PURE__ */ t(s, { $renderAs: "body2", children: l })
|
32
32
|
]
|
33
33
|
},
|
34
34
|
r
|
@@ -36,6 +36,6 @@ function W({ stepsInfo: n = [], currentStep: e = 2 }) {
|
|
36
36
|
] });
|
37
37
|
}
|
38
38
|
export {
|
39
|
-
|
39
|
+
j as default
|
40
40
|
};
|
41
41
|
//# sourceMappingURL=stepper.js.map
|
@@ -1,36 +1,33 @@
|
|
1
|
-
import {
|
2
|
-
import { useAwsSignedKey as
|
3
|
-
import
|
4
|
-
const
|
5
|
-
const { studentId: t, query: o
|
6
|
-
return
|
7
|
-
|
8
|
-
}, [s]),
|
9
|
-
|
10
|
-
}, [o, d, t, r]), k(
|
11
|
-
async ({ images: g, onSuccess: n, onError: p, fileKey: w, fileName: K }) => {
|
12
|
-
const a = c.current;
|
1
|
+
import { useEffect as g, useCallback as w } from "react";
|
2
|
+
import { useAwsSignedKey as S } from "../api/subjective-review.js";
|
3
|
+
import h from "../../../../node_modules/uuid/dist/esm-browser/v4.js";
|
4
|
+
const A = (c) => {
|
5
|
+
const { studentId: t, query: o } = c, { data: a, get: s } = S();
|
6
|
+
return g(() => {
|
7
|
+
s(t, o);
|
8
|
+
}, [o, s, t]), w(
|
9
|
+
async ({ images: d, onSuccess: i, onError: l, fileKey: u, fileName: m }) => {
|
13
10
|
if (!a) return;
|
14
|
-
const
|
11
|
+
const r = `https://${a.bucketName}.s3.amazonaws.com/`;
|
15
12
|
try {
|
16
|
-
const
|
17
|
-
const e = new FormData(),
|
18
|
-
if (e.append("key",
|
13
|
+
const n = d.map(async (f) => {
|
14
|
+
const e = new FormData(), p = `${u}${m ?? h()}`;
|
15
|
+
if (e.append("key", p), e.append("AWSAccessKeyId", a.awsKey), e.append("acl", "public-read"), e.append("success_action_redirect", ""), e.append("policy", a.policy), e.append("signature", a.signature), e.append("Content-Type", "image/jpeg"), e.append("file", f.file), !(await fetch(r, {
|
19
16
|
method: "POST",
|
20
17
|
body: e
|
21
18
|
})).ok)
|
22
19
|
throw new Error("Upload failed");
|
23
|
-
return `${
|
24
|
-
}),
|
25
|
-
|
20
|
+
return `${r}${p}`;
|
21
|
+
}), y = await Promise.all(n);
|
22
|
+
i(y);
|
26
23
|
} catch {
|
27
|
-
|
24
|
+
l();
|
28
25
|
}
|
29
26
|
},
|
30
|
-
[]
|
27
|
+
[a]
|
31
28
|
);
|
32
29
|
};
|
33
30
|
export {
|
34
|
-
|
31
|
+
A as default
|
35
32
|
};
|
36
33
|
//# sourceMappingURL=use-s3-helper.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-s3-helper.js","sources":["../../../../../src/features/worksheet/worksheet/hooks/use-s3-helper.ts"],"sourcesContent":["import type { IFile } from '../worksheet-question/subjective-review';\n\nimport { useCallback, useEffect
|
1
|
+
{"version":3,"file":"use-s3-helper.js","sources":["../../../../../src/features/worksheet/worksheet/hooks/use-s3-helper.ts"],"sourcesContent":["import type { IFile } from '../worksheet-question/subjective-review';\n\nimport { useCallback, useEffect } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport { useAwsSignedKey } from '../api/subjective-review';\n\ninterface IUseS3helper {\n (params: {\n studentId: string;\n query: {\n type: string;\n };\n }): (props: IUploadImageProps) => void;\n}\n\ninterface IUploadImageProps {\n images: IFile[];\n onSuccess: (urls: string[]) => void;\n onError: () => void;\n fileKey: string;\n fileName?: string;\n}\n\nconst useS3ImageUploadHelper: IUseS3helper = props => {\n const { studentId, query } = props;\n const { data: awsSignedKey, get: getAwsSignedKey } = useAwsSignedKey();\n\n useEffect(() => {\n getAwsSignedKey(studentId, query);\n }, [query, getAwsSignedKey, studentId]);\n\n const uploadImagesToS3 = useCallback(\n async ({ images, onSuccess, onError, fileKey, fileName }: IUploadImageProps) => {\n if (!awsSignedKey) return;\n\n const url = `https://${awsSignedKey.bucketName}.s3.amazonaws.com/`;\n\n try {\n const uploadPromises = images.map(async (item: { file: string | Blob }) => {\n const formData = new FormData();\n const key = `${fileKey}${fileName ?? uuidv4()}`;\n\n formData.append('key', key);\n formData.append('AWSAccessKeyId', awsSignedKey.awsKey);\n formData.append('acl', 'public-read');\n formData.append('success_action_redirect', '');\n formData.append('policy', awsSignedKey.policy);\n formData.append('signature', awsSignedKey.signature);\n formData.append('Content-Type', 'image/jpeg');\n formData.append('file', item.file);\n\n const res = await fetch(url, {\n method: 'POST',\n body: formData,\n });\n\n if (!res.ok) {\n throw new Error('Upload failed');\n }\n\n return `${url}${key}`;\n });\n\n const uploadedUrls = await Promise.all(uploadPromises);\n\n onSuccess(uploadedUrls);\n } catch (error) {\n onError();\n }\n },\n [awsSignedKey],\n );\n\n return uploadImagesToS3;\n};\n\nexport default useS3ImageUploadHelper;\n"],"names":["useS3ImageUploadHelper","props","studentId","query","awsSignedKey","getAwsSignedKey","useAwsSignedKey","useEffect","useCallback","images","onSuccess","onError","fileKey","fileName","url","uploadPromises","item","formData","key","uuidv4","uploadedUrls"],"mappings":";;;AAwBA,MAAMA,IAAuC,CAASC,MAAA;AAC9C,QAAA,EAAE,WAAAC,GAAW,OAAAC,EAAU,IAAAF,GACvB,EAAE,MAAMG,GAAc,KAAKC,EAAA,IAAoBC;AAErD,SAAAC,EAAU,MAAM;AACd,IAAAF,EAAgBH,GAAWC,CAAK;AAAA,EAC/B,GAAA,CAACA,GAAOE,GAAiBH,CAAS,CAAC,GAEbM;AAAA,IACvB,OAAO,EAAE,QAAAC,GAAQ,WAAAC,GAAW,SAAAC,GAAS,SAAAC,GAAS,UAAAC,QAAkC;AAC9E,UAAI,CAACT,EAAc;AAEb,YAAAU,IAAM,WAAWV,EAAa,UAAU;AAE1C,UAAA;AACF,cAAMW,IAAiBN,EAAO,IAAI,OAAOO,MAAkC;AACnE,gBAAAC,IAAW,IAAI,YACfC,IAAM,GAAGN,CAAO,GAAGC,KAAYM,EAAQ,CAAA;AAgBzC,cAdKF,EAAA,OAAO,OAAOC,CAAG,GACjBD,EAAA,OAAO,kBAAkBb,EAAa,MAAM,GAC5Ca,EAAA,OAAO,OAAO,aAAa,GAC3BA,EAAA,OAAO,2BAA2B,EAAE,GACpCA,EAAA,OAAO,UAAUb,EAAa,MAAM,GACpCa,EAAA,OAAO,aAAab,EAAa,SAAS,GAC1Ca,EAAA,OAAO,gBAAgB,YAAY,GACnCA,EAAA,OAAO,QAAQD,EAAK,IAAI,GAO7B,EALQ,MAAM,MAAMF,GAAK;AAAA,YAC3B,QAAQ;AAAA,YACR,MAAMG;AAAA,UAAA,CACP,GAEQ;AACD,kBAAA,IAAI,MAAM,eAAe;AAG1B,iBAAA,GAAGH,CAAG,GAAGI,CAAG;AAAA,QAAA,CACpB,GAEKE,IAAe,MAAM,QAAQ,IAAIL,CAAc;AAErD,QAAAL,EAAUU,CAAY;AAAA,cACR;AACN,QAAAT;MACV;AAAA,IACF;AAAA,IACA,CAACP,CAAY;AAAA,EAAA;AAIjB;"}
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import
|
5
|
-
import
|
1
|
+
import T from "../../../assets/line-icons/icons/bulb2.js";
|
2
|
+
import R from "../../../assets/line-icons/icons/edit-star.js";
|
3
|
+
import A from "../../../assets/line-icons/icons/edit2.js";
|
4
|
+
import C from "../../../assets/line-icons/icons/question-letter.js";
|
5
|
+
import O from "../../../assets/line-icons/icons/star2.js";
|
6
6
|
import w from "../constants/events.js";
|
7
|
-
import { OPTIONAL_ITEM_TYPES as
|
7
|
+
import { OPTIONAL_ITEM_TYPES as k, ACTION_BAR_HEIGHT as N, QUESTION_WIDTH as y, SPLIT_QUESTION_WIDTH as Q } from "./constants.js";
|
8
8
|
import { QUESTION_TAGS as E } from "./worksheet-types.js";
|
9
9
|
const x = (e) => {
|
10
10
|
switch (e) {
|
@@ -36,17 +36,17 @@ const x = (e) => {
|
|
36
36
|
const r = e.toLowerCase();
|
37
37
|
return r === "intro" || r === "concept-intro";
|
38
38
|
}, I = (e) => e.reduce((r, t) => {
|
39
|
-
const [n, s] = t.split(":"),
|
40
|
-
return !
|
39
|
+
const [n, s] = t.split(":"), o = n == null ? void 0 : n.trim(), c = s == null ? void 0 : s.trim();
|
40
|
+
return !o || !c ? r : {
|
41
41
|
...r,
|
42
|
-
[
|
42
|
+
[o.toLowerCase()]: c
|
43
43
|
};
|
44
44
|
}, {}), Y = (e, { sectioned: r = !1, adaptive: t = !1 }) => {
|
45
45
|
if (r)
|
46
|
-
return e.reduce((s,
|
47
|
-
var
|
46
|
+
return e.reduce((s, o, c) => {
|
47
|
+
var b;
|
48
48
|
let d = !1;
|
49
|
-
const { content: u, questions: i, itemType:
|
49
|
+
const { content: u, questions: i, itemType: a } = o, l = x(a), m = s[s.length - 1], g = l === (m == null ? void 0 : m.section_name) && (m != null && m.item_display_number) ? m.item_display_number + 1 : 1, p = u.match(/question-[^"]*/g), _ = p == null ? void 0 : p.map((f, h) => {
|
50
50
|
const v = i.find(
|
51
51
|
({ response_id: S }) => S === f.replace("question-", "")
|
52
52
|
);
|
@@ -56,20 +56,20 @@ const x = (e) => {
|
|
56
56
|
...v,
|
57
57
|
// Some questions are set to limited number of attempts which can show feedback which is causing the question to be stuck in the errored state
|
58
58
|
feedback_attempts: void 0,
|
59
|
-
item_reference:
|
59
|
+
item_reference: o.reference,
|
60
60
|
item_number: c,
|
61
61
|
item_display_number: g,
|
62
62
|
section_name: l,
|
63
|
-
item_type: r ?
|
64
|
-
is_optional:
|
65
|
-
item_tags:
|
66
|
-
item_tags_map: I(
|
63
|
+
item_type: r ? a : void 0,
|
64
|
+
is_optional: a ? k.includes(a) : !1,
|
65
|
+
item_tags: o.tags ?? [],
|
66
|
+
item_tags_map: I(o.tags ?? []),
|
67
67
|
question_number: h - (d ? 1 : 0),
|
68
68
|
total_questions: p.length
|
69
69
|
};
|
70
70
|
});
|
71
71
|
if (d = !1, _ != null && _[0] && c > 0 && e.length > 0) {
|
72
|
-
const f = (
|
72
|
+
const f = (b = e[c - 1]) == null ? void 0 : b.itemType, h = a != null && a.startsWith("advanced-") ? "advanced" : a, v = f != null && f.startsWith("advanced-") ? "advanced" : f;
|
73
73
|
if ((h === "practice-basic" || h === "practice-regular" || h === "exit-ticket" || h === "advanced") && h !== v)
|
74
74
|
return [
|
75
75
|
...s,
|
@@ -82,16 +82,16 @@ const x = (e) => {
|
|
82
82
|
solution: void 0
|
83
83
|
},
|
84
84
|
instructor_stimulus: "SystemIntro",
|
85
|
-
response_id: `${
|
86
|
-
is_optional:
|
85
|
+
response_id: `${a}-system-intro`,
|
86
|
+
is_optional: a == null ? void 0 : a.startsWith("advanced-")
|
87
87
|
},
|
88
88
|
..._ ?? []
|
89
89
|
];
|
90
90
|
}
|
91
91
|
return [...s, ..._ ?? []];
|
92
92
|
}, []);
|
93
|
-
const n = e.reduce((s,
|
94
|
-
const { content: d, questions: u } =
|
93
|
+
const n = e.reduce((s, o, c) => {
|
94
|
+
const { content: d, questions: u } = o, i = d.match(/question-[^"]*/g), a = i == null ? void 0 : i.map(
|
95
95
|
(l, m) => {
|
96
96
|
const g = u.find(
|
97
97
|
({ response_id: p }) => p === l.replace("question-", "")
|
@@ -101,29 +101,29 @@ const x = (e) => {
|
|
101
101
|
return {
|
102
102
|
...g,
|
103
103
|
feedback_attempts: void 0,
|
104
|
-
item_reference:
|
104
|
+
item_reference: o.reference,
|
105
105
|
item_number: c,
|
106
106
|
item_display_number: c + 1,
|
107
|
-
item_tags:
|
108
|
-
item_tags_map: I(
|
107
|
+
item_tags: o.tags ?? [],
|
108
|
+
item_tags_map: I(o.tags ?? []),
|
109
109
|
question_number: m,
|
110
110
|
total_questions: i.length
|
111
111
|
};
|
112
112
|
}
|
113
113
|
);
|
114
|
-
return [...s, ...
|
114
|
+
return [...s, ...a ?? []];
|
115
115
|
}, []);
|
116
116
|
if (t) {
|
117
|
-
const s = [],
|
117
|
+
const s = [], o = {};
|
118
118
|
return n.sort((c, d) => {
|
119
119
|
var m, g;
|
120
120
|
const u = c.item_tags_map[E.TRIAL_TOPIC], i = d.item_tags_map[E.TRIAL_TOPIC];
|
121
|
-
if (u &&
|
121
|
+
if (u && o[u] === void 0 && (o[u] = s.length, s.push(u)), i && o[i] === void 0 && (o[i] = s.length, s.push(i)), !u || !i)
|
122
122
|
return 0;
|
123
|
-
const
|
124
|
-
return
|
123
|
+
const a = `${o[u]}-${((m = c.item_tags_map[E.QUESTION_CODE]) == null ? void 0 : m.length) ?? 0}`, l = `${o[i]}-${((g = d.item_tags_map[E.QUESTION_CODE]) == null ? void 0 : g.length) ?? 0}`;
|
124
|
+
return a > l ? 1 : -1;
|
125
125
|
}).map((c) => {
|
126
|
-
const d =
|
126
|
+
const d = o[c.item_tags_map[E.TRIAL_TOPIC] ?? ""] ?? 0, u = c.item_tags_map[E.QUESTION_CODE] ?? "";
|
127
127
|
return {
|
128
128
|
...c,
|
129
129
|
item_display_number: d * 3 + u.length
|
@@ -131,7 +131,7 @@ const x = (e) => {
|
|
131
131
|
});
|
132
132
|
}
|
133
133
|
return n;
|
134
|
-
},
|
134
|
+
}, V = ({
|
135
135
|
questions: e,
|
136
136
|
initialQuestion: r,
|
137
137
|
initialResponseId: t,
|
@@ -139,11 +139,11 @@ const x = (e) => {
|
|
139
139
|
lastUnlockedQuestionIndex: s
|
140
140
|
}) => {
|
141
141
|
var d, u;
|
142
|
-
const
|
143
|
-
if (t &&
|
142
|
+
const o = e.slice(0, s + 1), c = e[s];
|
143
|
+
if (t && o.find((i) => i.response_id === t))
|
144
144
|
return t;
|
145
145
|
if (typeof n == "number" && n <= c.item_number) {
|
146
|
-
const i = e.find((
|
146
|
+
const i = e.find((a) => a.item_number === n);
|
147
147
|
if (i != null && i.response_id)
|
148
148
|
return i.response_id;
|
149
149
|
}
|
@@ -154,41 +154,41 @@ const x = (e) => {
|
|
154
154
|
if ((u = e[0]) != null && u.response_id)
|
155
155
|
return e[0].response_id;
|
156
156
|
throw new Error("Initial question not found");
|
157
|
-
},
|
157
|
+
}, J = ({
|
158
158
|
questions: e,
|
159
159
|
responses: r,
|
160
160
|
behavior: t,
|
161
161
|
userType: n
|
162
162
|
}) => {
|
163
|
-
const { maximumAttempts: s, teacherValidationEnabled:
|
163
|
+
const { maximumAttempts: s, teacherValidationEnabled: o, validation: c, navigationMode: d } = t, u = [...e].reverse().findIndex((i) => {
|
164
164
|
var _;
|
165
|
-
const
|
166
|
-
if (
|
165
|
+
const a = r[i.response_id], { attemptsHistory: l, validatedByTeacher: m, assignStatus: g } = a ?? {};
|
166
|
+
if (o)
|
167
167
|
return !!(m || g === "skipped");
|
168
168
|
const p = (_ = l == null ? void 0 : l.slice(-1)[0]) == null ? void 0 : _.score;
|
169
|
-
return p ? (p.score ?? 0) === p.max_score ? !0 : ((l == null ? void 0 : l.length) ?? 0) >= s : !!(!c && d === "LINEAR" && (
|
169
|
+
return p ? (p.score ?? 0) === p.max_score ? !0 : ((l == null ? void 0 : l.length) ?? 0) >= s : !!(!c && d === "LINEAR" && (a != null && a.response || a != null && a.skipped));
|
170
170
|
});
|
171
171
|
if (u === -1)
|
172
172
|
return 0;
|
173
173
|
if (u === 0) {
|
174
|
-
if (
|
175
|
-
const i = [...e].reverse().findIndex((
|
174
|
+
if (o) {
|
175
|
+
const i = [...e].reverse().findIndex((a) => {
|
176
176
|
var l;
|
177
|
-
return ((l = r[
|
177
|
+
return ((l = r[a.response_id]) == null ? void 0 : l.assignStatus) !== "skipped";
|
178
178
|
});
|
179
179
|
return e.length - i - 1;
|
180
180
|
}
|
181
181
|
return e.length - 1;
|
182
182
|
}
|
183
|
-
if (
|
184
|
-
const i = e.length - u,
|
185
|
-
return
|
183
|
+
if (o && n === "STUDENT") {
|
184
|
+
const i = e.length - u, a = e[i], { assignStatus: l } = r[a.response_id] ?? {};
|
185
|
+
return a.is_optional && !l ? i - 1 : i;
|
186
186
|
}
|
187
187
|
return e.length - u;
|
188
188
|
};
|
189
189
|
function M(e, r) {
|
190
190
|
var n, s;
|
191
|
-
const t = Array.isArray(e) ? e.find((
|
191
|
+
const t = Array.isArray(e) ? e.find((o) => o.response_id === r) : e;
|
192
192
|
if (!t)
|
193
193
|
throw new Error(`Question with id ${r} not found`);
|
194
194
|
return {
|
@@ -206,22 +206,22 @@ function M(e, r) {
|
|
206
206
|
}
|
207
207
|
};
|
208
208
|
}
|
209
|
-
const
|
209
|
+
const z = (e) => e.reduce(
|
210
210
|
(r, t) => ({
|
211
211
|
...r,
|
212
212
|
[t.response_id]: M(e, t.response_id)
|
213
213
|
}),
|
214
214
|
{}
|
215
|
-
),
|
215
|
+
), K = (e, r) => {
|
216
216
|
const { actionBar: t } = r;
|
217
217
|
return {
|
218
218
|
questionsContainerWidth: !e.some(
|
219
|
-
(
|
219
|
+
(o) => o.questions.some((c) => c.stimulus_review)
|
220
220
|
) ? y : Q,
|
221
221
|
maxQuestionWidth: y,
|
222
222
|
actionbarHeight: t === "bottom" ? N : 0
|
223
223
|
};
|
224
|
-
},
|
224
|
+
}, X = ({
|
225
225
|
questions: e,
|
226
226
|
lastUnlockedQuestionIndex: r,
|
227
227
|
userType: t
|
@@ -343,22 +343,36 @@ const K = (e) => e.reduce(
|
|
343
343
|
default:
|
344
344
|
return "";
|
345
345
|
}
|
346
|
-
},
|
346
|
+
}, ae = (e) => {
|
347
347
|
switch (e) {
|
348
348
|
case "learning":
|
349
|
-
return
|
349
|
+
return T;
|
350
350
|
case "practice-basic":
|
351
|
-
return
|
351
|
+
return A;
|
352
352
|
case "practice-regular":
|
353
|
-
return
|
353
|
+
return R;
|
354
354
|
case "exit-ticket":
|
355
|
-
return k;
|
356
|
-
case "advanced":
|
357
355
|
return C;
|
356
|
+
case "advanced":
|
357
|
+
return O;
|
358
358
|
default:
|
359
|
-
return
|
359
|
+
return T;
|
360
|
+
}
|
361
|
+
}, oe = (e) => {
|
362
|
+
if (Array.isArray(e.value)) {
|
363
|
+
const r = e.value.map(
|
364
|
+
(t) => typeof t == "string" && t.length > 100 ? "" : t
|
365
|
+
);
|
366
|
+
return {
|
367
|
+
response: {
|
368
|
+
...e,
|
369
|
+
value: r
|
370
|
+
},
|
371
|
+
reportAbuse: !0
|
372
|
+
};
|
360
373
|
}
|
361
|
-
|
374
|
+
return { response: e, reportAbuse: !1 };
|
375
|
+
}, ie = (e, r) => {
|
362
376
|
const t = e === "TEACHER";
|
363
377
|
return r ? {
|
364
378
|
bannerBackgroundColor: "GREEN_4",
|
@@ -369,20 +383,21 @@ const K = (e) => e.reduce(
|
|
369
383
|
};
|
370
384
|
};
|
371
385
|
export {
|
372
|
-
|
373
|
-
|
374
|
-
|
386
|
+
V as getInitialQuestionId,
|
387
|
+
z as getInitialResponses,
|
388
|
+
J as getLastUnlockedQuestionIndex,
|
375
389
|
re as getNavigationSectionBackgroundColor,
|
376
|
-
|
390
|
+
ae as getNavigationSectionIcon,
|
377
391
|
ne as getNavigationSectionName,
|
378
392
|
q as getPaperColorByQuestion,
|
379
393
|
ee as getQuestionBackgroundImage,
|
380
394
|
te as getQuestionBorderColor,
|
381
395
|
M as getQuestionMetadata,
|
382
396
|
Y as getQuestionsFromItems,
|
383
|
-
|
384
|
-
|
385
|
-
|
397
|
+
X as getRenderableQuestions,
|
398
|
+
oe as getResetedResponseForClozeFormula,
|
399
|
+
K as getWorksheetDimensions,
|
400
|
+
ie as getWorksheetNudgeBannerInfo,
|
386
401
|
L as isConceptIntroWidget,
|
387
402
|
U as isOkayTypeQuestion,
|
388
403
|
j as scrollToQuestion,
|