@cuemath/leap 3.4.9-m → 3.4.11-m

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.
@@ -1,41 +1,41 @@
1
1
  import { jsx as e, jsxs as o } from "react/jsx-runtime";
2
2
  import { memo as z, useState as $, useRef as C, useCallback as s, useMemo as m, useEffect as D } from "react";
3
3
  import { useGetEligibleJourneysViaRoute as F } from "../../../journey/hooks/use-get-eligible-journeys-via-route.js";
4
- import { JOURNEY_ID_TEACHER as Y } from "../../../journey/journey-id/journey-id-teacher.js";
4
+ import { JOURNEY_ID_TEACHER as G } from "../../../journey/journey-id/journey-id-teacher.js";
5
5
  import { useJourney as Q } from "../../../journey/use-journey/use-journey.js";
6
6
  import { useStickersJourney as Z } from "../../../stickers/sticker-selector/hooks/use-stickers-journey/use-stickers-journey.js";
7
7
  import ee from "../../../stickers/sticker-selector/sticker-selector.js";
8
8
  import f from "../../../ui/buttons/clickable/clickable.js";
9
9
  import i from "../../../ui/layout/flex-view.js";
10
- import v from "../../../ui/separator/separator.js";
10
+ import Y from "../../../ui/separator/separator.js";
11
11
  import d from "../../../ui/text/text.js";
12
- import J from "../../constants/events.js";
12
+ import v from "../../constants/events.js";
13
13
  import { StickersIcon as te, GuideContainer as oe, HintIcon as ie, SolIcon as ne, Pointer as re, SectionContainer as ce, Section as le, CloseIcon as se, Guide as de } from "./worksheet-sidebar-styled.js";
14
14
  const be = z(
15
15
  ({
16
16
  questionWidth: E,
17
- questions: L,
18
- activeQuestionIndex: X,
17
+ questions: J,
18
+ activeQuestionIndex: L,
19
19
  learnosity: I,
20
20
  actionbarHeight: T,
21
21
  loggerRef: a,
22
- studentClassroomId: b,
22
+ studentClassroomId: X,
23
23
  enableStickers: K
24
24
  }) => {
25
- var G;
25
+ var A;
26
26
  const [t, h] = $(), [B, V] = $({
27
27
  top: 0,
28
28
  left: 0
29
- }), [u, j] = $(!0), k = C(null), { top: R, left: O } = B, x = s(() => {
30
- h("HINT"), a.current(J.WORKSHEET_V3_HINT_SEEN);
29
+ }), [u, j] = $(!1), b = C(null), { top: k, left: R } = B, x = s(() => {
30
+ h("HINT"), a.current(v.WORKSHEET_V3_HINT_SEEN);
31
31
  }, [a]), P = s(() => {
32
- h("SOL"), a.current(J.WORKSHEET_V3_SOLUTION_SEEN);
32
+ h("SOL"), a.current(v.WORKSHEET_V3_SOLUTION_SEEN);
33
33
  }, [a]), U = s(() => {
34
34
  h(() => {
35
35
  });
36
36
  }, []), p = s(() => {
37
37
  j((c) => !c);
38
- }, []), { hints: n, solution: g } = ((G = L[X]) == null ? void 0 : G.metadata) || {}, r = m(() => t === void 0 ? void 0 : t === "HINT" ? n : g, [t, n, g]), _ = C(null), N = C(null), S = s((c) => {
38
+ }, []), { hints: n, solution: g } = ((A = J[L]) == null ? void 0 : A.metadata) || {}, r = m(() => t === void 0 ? void 0 : t === "HINT" ? n : g, [t, n, g]), O = C(null), _ = C(null), S = s((c) => {
39
39
  if (c.current) {
40
40
  const l = c.current.getBoundingClientRect();
41
41
  V({
@@ -44,11 +44,11 @@ const be = z(
44
44
  // 52px (sidebar width) + 16px (gutter) + 10px
45
45
  });
46
46
  }
47
- }, []), H = m(
48
- () => /* @__PURE__ */ e("div", { ref: k, children: /* @__PURE__ */ e(f, { label: "teacher-badges", onClick: p, children: /* @__PURE__ */ o(i, { $alignItems: "center", $justifyContent: "center", children: [
47
+ }, []), N = m(
48
+ () => /* @__PURE__ */ e("div", { ref: b, children: /* @__PURE__ */ e(f, { label: "teacher-badges", onClick: p, children: /* @__PURE__ */ o(i, { $alignItems: "center", $justifyContent: "center", children: [
49
49
  /* @__PURE__ */ e(te, { width: 32, height: 32, $disabled: !u }),
50
50
  /* @__PURE__ */ e(d, { $renderAs: "eyebrow2", $color: u ? "BLACK" : "GREY_4", children: "STICKERS" }),
51
- /* @__PURE__ */ e(i, { $gap: 8, $alignItems: "center", children: /* @__PURE__ */ e(v, { width: 24, height: 1, background: "GREY_2" }) })
51
+ /* @__PURE__ */ e(i, { $gap: 8, $alignItems: "center", children: /* @__PURE__ */ e(Y, { width: 24, height: 1, background: "GREY_2" }) })
52
52
  ] }) }) }),
53
53
  [u, p]
54
54
  ), W = m(
@@ -71,44 +71,44 @@ const be = z(
71
71
  position: "left",
72
72
  tooltipXCoOrdinates: 20,
73
73
  tooltipYCoOrdinates: -20
74
- }, w = F([
75
- Y.STICKERS_INTRO_JOURNEY
76
- ]), { isJourneyActive: y } = Q(), { startTeacherStickersJourney: A } = Z({
77
- triggerRef: k,
78
- triggerElement: H,
74
+ }, H = F([
75
+ G.STICKERS_INTRO_JOURNEY
76
+ ]), { isJourneyActive: w } = Q(), { startTeacherStickersJourney: y } = Z({
77
+ triggerRef: b,
78
+ triggerElement: N,
79
79
  tooltipConfig: q
80
80
  });
81
81
  return t && r && I && I.renderMath("mathjax"), D(() => {
82
- t === "HINT" ? S(N) : t === "SOL" ? S(_) : r || h(void 0), w.includes(Y.STICKERS_INTRO_JOURNEY) && !y && A();
82
+ t === "HINT" ? S(_) : t === "SOL" ? S(O) : r || h(void 0), H.includes(G.STICKERS_INTRO_JOURNEY) && !w && y();
83
83
  }, [
84
84
  t,
85
85
  S,
86
86
  r,
87
+ H,
87
88
  w,
88
- y,
89
- A
89
+ y
90
90
  ]), /* @__PURE__ */ o(oe, { $background: "WHITE", children: [
91
- K && b && /* @__PURE__ */ e(
91
+ K && /* @__PURE__ */ e(
92
92
  ee,
93
93
  {
94
- triggerNode: H,
95
- studentClassroomId: b,
94
+ triggerNode: N,
95
+ studentClassroomId: X,
96
96
  gridConfig: W,
97
97
  tooltipConfig: M,
98
98
  visible: u,
99
99
  onToggle: p
100
100
  }
101
101
  ),
102
- /* @__PURE__ */ e(f, { label: "hints", onClick: x, disabled: !n, children: /* @__PURE__ */ o(i, { $alignItems: "center", $justifyContent: "center", ref: N, children: [
102
+ /* @__PURE__ */ e(f, { label: "hints", onClick: x, disabled: !n, children: /* @__PURE__ */ o(i, { $alignItems: "center", $justifyContent: "center", ref: _, children: [
103
103
  /* @__PURE__ */ e(ie, { width: 32, height: 32, $disabled: !n }),
104
104
  /* @__PURE__ */ e(d, { $renderAs: "eyebrow2", $color: n ? "BLACK" : "GREY_4", children: "HINT" }),
105
- /* @__PURE__ */ e(i, { $gap: 8, $alignItems: "center", children: /* @__PURE__ */ e(v, { width: 24, height: 1, background: "GREY_2" }) })
105
+ /* @__PURE__ */ e(i, { $gap: 8, $alignItems: "center", children: /* @__PURE__ */ e(Y, { width: 24, height: 1, background: "GREY_2" }) })
106
106
  ] }) }),
107
- /* @__PURE__ */ e(f, { label: "solution", onClick: P, disabled: !g, children: /* @__PURE__ */ o(i, { $alignItems: "center", $justifyContent: "center", ref: _, children: [
107
+ /* @__PURE__ */ e(f, { label: "solution", onClick: P, disabled: !g, children: /* @__PURE__ */ o(i, { $alignItems: "center", $justifyContent: "center", ref: O, children: [
108
108
  /* @__PURE__ */ e(ne, { width: 32, height: 32, $disabled: !g }),
109
109
  /* @__PURE__ */ e(d, { $renderAs: "eyebrow2", $color: n ? "BLACK" : "GREY_4", children: "SOL" })
110
110
  ] }) }),
111
- t && R && O && /* @__PURE__ */ e(re, { topValue: R, leftValue: O }),
111
+ t && k && R && /* @__PURE__ */ e(re, { topValue: k, leftValue: R }),
112
112
  t && /* @__PURE__ */ e(
113
113
  ce,
114
114
  {
@@ -1 +1 @@
1
- {"version":3,"file":"question-guide.js","sources":["../../../../../src/features/worksheet/worksheet/worksheet-sidebar/question-guide.tsx"],"sourcesContent":["import React, {\n memo,\n useCallback,\n useEffect,\n useMemo,\n useState,\n useRef,\n type ReactElement,\n type RefObject,\n} from 'react';\n\nimport { useGetEligibleJourneysViaRoute } from '../../../journey/hooks/use-get-eligible-journeys-via-route';\nimport { JOURNEY_ID_TEACHER } from '../../../journey/journey-id/journey-id-teacher';\nimport { useJourney } from '../../../journey/use-journey/use-journey';\nimport { useStickersJourney } from '../../../stickers/sticker-selector/hooks/use-stickers-journey/use-stickers-journey';\nimport StickerSelector from '../../../stickers/sticker-selector/sticker-selector';\nimport {\n type IArrowTooltipProps,\n type TPositionProps,\n} from '../../../ui/arrow-tooltip/arrow-tooltip-types';\nimport Clickable from '../../../ui/buttons/clickable/clickable';\nimport FlexView from '../../../ui/layout/flex-view';\nimport Separator from '../../../ui/separator/separator';\nimport Text from '../../../ui/text/text';\nimport EVENTS from '../../constants/events';\nimport type { ILearnosity, IWorksheetProps, IWorksheetQuestion } from '../worksheet-types';\nimport {\n Section,\n GuideContainer,\n CloseIcon,\n SolIcon,\n HintIcon,\n StickersIcon,\n SectionContainer,\n Guide,\n Pointer,\n} from './worksheet-sidebar-styled';\n\ntype TSections = 'HINT' | 'SOL';\n\ninterface IQuestionGuideProps extends Pick<IWorksheetProps, 'loggerRef'> {\n questionWidth: number;\n questions: IWorksheetQuestion[];\n activeQuestionIndex: number;\n learnosity: ILearnosity;\n actionbarHeight: number;\n studentClassroomId?: string;\n enableStickers?: boolean;\n}\n\nconst QuestionGuide: React.FC<IQuestionGuideProps> = memo(\n ({\n questionWidth,\n questions,\n activeQuestionIndex,\n learnosity,\n actionbarHeight,\n loggerRef,\n studentClassroomId,\n enableStickers,\n }) => {\n const [activeSection, setActiveSection] = useState<TSections | undefined>();\n const [pointerPosition, setPointerPosition] = useState({\n top: 0,\n left: 0,\n });\n const [showStickers, setShowStickers] = useState(true);\n const triggerRef = useRef<HTMLDivElement | null>(null);\n const { top, left } = pointerPosition;\n\n const handleHintClick = useCallback(() => {\n setActiveSection('HINT');\n loggerRef.current(EVENTS.WORKSHEET_V3_HINT_SEEN);\n }, [loggerRef]);\n const handleSolClick = useCallback(() => {\n setActiveSection('SOL');\n loggerRef.current(EVENTS.WORKSHEET_V3_SOLUTION_SEEN);\n }, [loggerRef]);\n const handleClose = useCallback(() => {\n setActiveSection(() => undefined);\n }, []);\n const handleBadgeToggle = useCallback(() => {\n setShowStickers(prev => !prev);\n }, []);\n\n const { hints, solution } = questions[activeQuestionIndex]?.metadata || {};\n\n const activeSectionData = useMemo(() => {\n return activeSection === undefined ? undefined : activeSection === 'HINT' ? hints : solution;\n }, [activeSection, hints, solution]);\n\n const sqlRef = useRef<HTMLDivElement>(null) as React.RefObject<HTMLDivElement>;\n const hintRef = useRef<HTMLDivElement>(null) as React.RefObject<HTMLDivElement>;\n\n const updatePointerPosition = useCallback((ref: React.RefObject<HTMLDivElement>) => {\n if (ref.current) {\n const rect = ref.current.getBoundingClientRect();\n\n setPointerPosition({\n top: rect.top + rect.height / 2 - 8,\n left: rect.right - 78, // 52px (sidebar width) + 16px (gutter) + 10px\n });\n }\n }, []);\n\n const stickerTrigger = useMemo(\n () => (\n <div ref={triggerRef}>\n <Clickable label=\"teacher-badges\" onClick={handleBadgeToggle}>\n <FlexView $alignItems=\"center\" $justifyContent=\"center\">\n <StickersIcon width={32} height={32} $disabled={!showStickers} />\n <Text $renderAs=\"eyebrow2\" $color={!showStickers ? 'GREY_4' : 'BLACK'}>\n STICKERS\n </Text>\n <FlexView $gap={8} $alignItems=\"center\">\n <Separator width={24} height={1} background=\"GREY_2\" />\n </FlexView>\n </FlexView>\n </Clickable>\n </div>\n ),\n [showStickers, handleBadgeToggle],\n );\n\n const stickerGridConfig = useMemo(\n () => ({\n stickerSize: 48,\n columns: 4,\n gap: 8,\n }),\n [],\n );\n\n const stickerTooltipConfig = useMemo(\n () => ({\n position: 'left' as TPositionProps,\n zIndex: 1000,\n arrowYCoOrdinates: -175,\n tooltipXCoOrdinates: '7.5%',\n tooltipYCoOrdinates: '40%',\n }),\n [],\n );\n\n const coachmarkConfig = {\n position: 'left',\n tooltipXCoOrdinates: 20,\n tooltipYCoOrdinates: -20,\n };\n\n const eligibleJourneyIds = useGetEligibleJourneysViaRoute([\n JOURNEY_ID_TEACHER.STICKERS_INTRO_JOURNEY,\n ]);\n\n const { isJourneyActive } = useJourney();\n\n const { startTeacherStickersJourney } = useStickersJourney({\n triggerRef: triggerRef as RefObject<HTMLDivElement>,\n triggerElement: stickerTrigger as ReactElement,\n tooltipConfig: coachmarkConfig as IArrowTooltipProps,\n });\n\n if (activeSection && activeSectionData && learnosity) {\n learnosity.renderMath('mathjax');\n }\n\n useEffect(() => {\n if (activeSection === 'HINT') {\n updatePointerPosition(hintRef);\n } else if (activeSection === 'SOL') {\n updatePointerPosition(sqlRef);\n } else if (!activeSectionData) {\n setActiveSection(undefined);\n }\n\n if (\n eligibleJourneyIds.includes(JOURNEY_ID_TEACHER.STICKERS_INTRO_JOURNEY) &&\n !isJourneyActive\n ) {\n startTeacherStickersJourney();\n }\n }, [\n activeSection,\n updatePointerPosition,\n activeSectionData,\n eligibleJourneyIds,\n isJourneyActive,\n startTeacherStickersJourney,\n ]);\n\n return (\n <GuideContainer $background=\"WHITE\">\n {enableStickers && studentClassroomId && (\n <StickerSelector\n triggerNode={stickerTrigger}\n studentClassroomId={studentClassroomId}\n gridConfig={stickerGridConfig}\n tooltipConfig={stickerTooltipConfig}\n visible={showStickers}\n onToggle={handleBadgeToggle}\n />\n )}\n <Clickable label=\"hints\" onClick={handleHintClick} disabled={!hints}>\n <FlexView $alignItems=\"center\" $justifyContent=\"center\" ref={hintRef}>\n <HintIcon width={32} height={32} $disabled={!hints} />\n <Text $renderAs=\"eyebrow2\" $color={!hints ? 'GREY_4' : 'BLACK'}>\n HINT\n </Text>\n <FlexView $gap={8} $alignItems=\"center\">\n <Separator width={24} height={1} background=\"GREY_2\" />\n </FlexView>\n </FlexView>\n </Clickable>\n <Clickable label=\"solution\" onClick={handleSolClick} disabled={!solution}>\n <FlexView $alignItems=\"center\" $justifyContent=\"center\" ref={sqlRef}>\n <SolIcon width={32} height={32} $disabled={!solution} />\n <Text $renderAs=\"eyebrow2\" $color={!hints ? 'GREY_4' : 'BLACK'}>\n SOL\n </Text>\n </FlexView>\n </Clickable>\n {activeSection && top && left && <Pointer topValue={top} leftValue={left} />}\n {activeSection && (\n <SectionContainer\n $background=\"WHITE\"\n $questionWidth={questionWidth}\n $actionbarHeight={actionbarHeight}\n $borderRadius={10}\n >\n <Section\n $gutterX={1}\n $gapX={1}\n $questionWidth={questionWidth}\n $actionbarHeight={actionbarHeight}\n >\n <Clickable label=\"close\" onClick={handleClose}>\n <CloseIcon />\n </Clickable>\n <FlexView $gutterX={0.5}>\n <Text $renderAs=\"eyebrow2\" $color=\"ORANGE_5\" $marginBottomX={0.25}>\n {activeSection === 'HINT' ? 'HINTS:' : 'SOLUTION:'}\n </Text>\n </FlexView>\n {activeSectionData &&\n activeSectionData.map((item, index) => (\n <FlexView $gutterX={0.5} $gapX={0.5} key={index.toString()}>\n {activeSectionData.length > 1 && (\n <Text $renderAs=\"eyebrow2\" $color=\"ORANGE_5\" $marginBottomX={0.25}>\n {activeSection} {index + 1}:\n </Text>\n )}\n <Guide\n dangerouslySetInnerHTML={{\n __html: item,\n }}\n />\n </FlexView>\n ))}\n </Section>\n </SectionContainer>\n )}\n </GuideContainer>\n );\n },\n);\n\nexport default QuestionGuide;\n"],"names":["QuestionGuide","memo","questionWidth","questions","activeQuestionIndex","learnosity","actionbarHeight","loggerRef","studentClassroomId","enableStickers","activeSection","setActiveSection","useState","pointerPosition","setPointerPosition","showStickers","setShowStickers","triggerRef","useRef","top","left","handleHintClick","useCallback","EVENTS","handleSolClick","handleClose","handleBadgeToggle","prev","hints","solution","_a","activeSectionData","useMemo","sqlRef","hintRef","updatePointerPosition","ref","rect","stickerTrigger","jsx","Clickable","jsxs","FlexView","StickersIcon","Text","Separator","stickerGridConfig","stickerTooltipConfig","coachmarkConfig","eligibleJourneyIds","useGetEligibleJourneysViaRoute","JOURNEY_ID_TEACHER","isJourneyActive","useJourney","startTeacherStickersJourney","useStickersJourney","useEffect","GuideContainer","StickerSelector","HintIcon","SolIcon","Pointer","SectionContainer","Section","CloseIcon","item","index","Guide"],"mappings":";;;;;;;;;;;;;AAkDA,MAAMA,KAA+CC;AAAA,EACnD,CAAC;AAAA,IACC,eAAAC;AAAA,IACA,WAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,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BAAA3B;AAAA,oBAAC4B;AAAA,oBAAA;AAAA,sBACC,yBAAyB;AAAA,wBACvB,QAAQF;AAAA,sBACV;AAAA,oBAAA;AAAA,kBACF;AAAA,gBAAA,KAVwCC,EAAM,SAAS,CAWzD,CACD;AAAA,cAAA;AAAA,YAAA;AAAA,UACL;AAAA,QAAA;AAAA,MACF;AAAA,IAEJ,EAAA,CAAA;AAAA,EAEJ;AACF;"}
1
+ {"version":3,"file":"question-guide.js","sources":["../../../../../src/features/worksheet/worksheet/worksheet-sidebar/question-guide.tsx"],"sourcesContent":["import React, {\n memo,\n useCallback,\n useEffect,\n useMemo,\n useState,\n useRef,\n type ReactElement,\n type RefObject,\n} from 'react';\n\nimport { useGetEligibleJourneysViaRoute } from '../../../journey/hooks/use-get-eligible-journeys-via-route';\nimport { JOURNEY_ID_TEACHER } from '../../../journey/journey-id/journey-id-teacher';\nimport { useJourney } from '../../../journey/use-journey/use-journey';\nimport { useStickersJourney } from '../../../stickers/sticker-selector/hooks/use-stickers-journey/use-stickers-journey';\nimport StickerSelector from '../../../stickers/sticker-selector/sticker-selector';\nimport {\n type IArrowTooltipProps,\n type TPositionProps,\n} from '../../../ui/arrow-tooltip/arrow-tooltip-types';\nimport Clickable from '../../../ui/buttons/clickable/clickable';\nimport FlexView from '../../../ui/layout/flex-view';\nimport Separator from '../../../ui/separator/separator';\nimport Text from '../../../ui/text/text';\nimport EVENTS from '../../constants/events';\nimport type { ILearnosity, IWorksheetProps, IWorksheetQuestion } from '../worksheet-types';\nimport {\n Section,\n GuideContainer,\n CloseIcon,\n SolIcon,\n HintIcon,\n StickersIcon,\n SectionContainer,\n Guide,\n Pointer,\n} from './worksheet-sidebar-styled';\n\ntype TSections = 'HINT' | 'SOL';\n\ninterface IQuestionGuideProps extends Pick<IWorksheetProps, 'loggerRef'> {\n questionWidth: number;\n questions: IWorksheetQuestion[];\n activeQuestionIndex: number;\n learnosity: ILearnosity;\n actionbarHeight: number;\n studentClassroomId?: string;\n enableStickers?: boolean;\n}\n\nconst QuestionGuide: React.FC<IQuestionGuideProps> = memo(\n ({\n questionWidth,\n questions,\n activeQuestionIndex,\n learnosity,\n actionbarHeight,\n loggerRef,\n studentClassroomId,\n enableStickers,\n }) => {\n const [activeSection, setActiveSection] = useState<TSections | undefined>();\n const [pointerPosition, setPointerPosition] = useState({\n top: 0,\n left: 0,\n });\n const [showStickers, setShowStickers] = useState(false);\n const triggerRef = useRef<HTMLDivElement | null>(null);\n const { top, left } = pointerPosition;\n\n const handleHintClick = useCallback(() => {\n setActiveSection('HINT');\n loggerRef.current(EVENTS.WORKSHEET_V3_HINT_SEEN);\n }, [loggerRef]);\n const handleSolClick = useCallback(() => {\n setActiveSection('SOL');\n loggerRef.current(EVENTS.WORKSHEET_V3_SOLUTION_SEEN);\n }, [loggerRef]);\n const handleClose = useCallback(() => {\n setActiveSection(() => undefined);\n }, []);\n const handleBadgeToggle = useCallback(() => {\n setShowStickers(prev => !prev);\n }, []);\n\n const { hints, solution } = questions[activeQuestionIndex]?.metadata || {};\n\n const activeSectionData = useMemo(() => {\n return activeSection === undefined ? undefined : activeSection === 'HINT' ? hints : solution;\n }, [activeSection, hints, solution]);\n\n const sqlRef = useRef<HTMLDivElement>(null) as React.RefObject<HTMLDivElement>;\n const hintRef = useRef<HTMLDivElement>(null) as React.RefObject<HTMLDivElement>;\n\n const updatePointerPosition = useCallback((ref: React.RefObject<HTMLDivElement>) => {\n if (ref.current) {\n const rect = ref.current.getBoundingClientRect();\n\n setPointerPosition({\n top: rect.top + rect.height / 2 - 8,\n left: rect.right - 78, // 52px (sidebar width) + 16px (gutter) + 10px\n });\n }\n }, []);\n\n const stickerTrigger = useMemo(\n () => (\n <div ref={triggerRef}>\n <Clickable label=\"teacher-badges\" onClick={handleBadgeToggle}>\n <FlexView $alignItems=\"center\" $justifyContent=\"center\">\n <StickersIcon width={32} height={32} $disabled={!showStickers} />\n <Text $renderAs=\"eyebrow2\" $color={!showStickers ? 'GREY_4' : 'BLACK'}>\n STICKERS\n </Text>\n <FlexView $gap={8} $alignItems=\"center\">\n <Separator width={24} height={1} background=\"GREY_2\" />\n </FlexView>\n </FlexView>\n </Clickable>\n </div>\n ),\n [showStickers, handleBadgeToggle],\n );\n\n const stickerGridConfig = useMemo(\n () => ({\n stickerSize: 48,\n columns: 4,\n gap: 8,\n }),\n [],\n );\n\n const stickerTooltipConfig = useMemo(\n () => ({\n position: 'left' as TPositionProps,\n zIndex: 1000,\n arrowYCoOrdinates: -175,\n tooltipXCoOrdinates: '7.5%',\n tooltipYCoOrdinates: '40%',\n }),\n [],\n );\n\n const coachmarkConfig = {\n position: 'left',\n tooltipXCoOrdinates: 20,\n tooltipYCoOrdinates: -20,\n };\n\n const eligibleJourneyIds = useGetEligibleJourneysViaRoute([\n JOURNEY_ID_TEACHER.STICKERS_INTRO_JOURNEY,\n ]);\n\n const { isJourneyActive } = useJourney();\n\n const { startTeacherStickersJourney } = useStickersJourney({\n triggerRef: triggerRef as RefObject<HTMLDivElement>,\n triggerElement: stickerTrigger as ReactElement,\n tooltipConfig: coachmarkConfig as IArrowTooltipProps,\n });\n\n if (activeSection && activeSectionData && learnosity) {\n learnosity.renderMath('mathjax');\n }\n\n useEffect(() => {\n if (activeSection === 'HINT') {\n updatePointerPosition(hintRef);\n } else if (activeSection === 'SOL') {\n updatePointerPosition(sqlRef);\n } else if (!activeSectionData) {\n setActiveSection(undefined);\n }\n\n if (\n eligibleJourneyIds.includes(JOURNEY_ID_TEACHER.STICKERS_INTRO_JOURNEY) &&\n !isJourneyActive\n ) {\n startTeacherStickersJourney();\n }\n }, [\n activeSection,\n updatePointerPosition,\n activeSectionData,\n eligibleJourneyIds,\n isJourneyActive,\n startTeacherStickersJourney,\n ]);\n\n return (\n <GuideContainer $background=\"WHITE\">\n {enableStickers && (\n <StickerSelector\n triggerNode={stickerTrigger}\n studentClassroomId={studentClassroomId}\n gridConfig={stickerGridConfig}\n tooltipConfig={stickerTooltipConfig}\n visible={showStickers}\n onToggle={handleBadgeToggle}\n />\n )}\n <Clickable label=\"hints\" onClick={handleHintClick} disabled={!hints}>\n <FlexView $alignItems=\"center\" $justifyContent=\"center\" ref={hintRef}>\n <HintIcon width={32} height={32} $disabled={!hints} />\n <Text $renderAs=\"eyebrow2\" $color={!hints ? 'GREY_4' : 'BLACK'}>\n HINT\n </Text>\n <FlexView $gap={8} $alignItems=\"center\">\n <Separator width={24} height={1} background=\"GREY_2\" />\n </FlexView>\n </FlexView>\n </Clickable>\n <Clickable label=\"solution\" onClick={handleSolClick} disabled={!solution}>\n <FlexView $alignItems=\"center\" $justifyContent=\"center\" ref={sqlRef}>\n <SolIcon width={32} height={32} $disabled={!solution} />\n <Text $renderAs=\"eyebrow2\" $color={!hints ? 'GREY_4' : 'BLACK'}>\n SOL\n </Text>\n </FlexView>\n </Clickable>\n {activeSection && top && left && <Pointer topValue={top} leftValue={left} />}\n {activeSection && (\n <SectionContainer\n $background=\"WHITE\"\n $questionWidth={questionWidth}\n $actionbarHeight={actionbarHeight}\n $borderRadius={10}\n >\n <Section\n $gutterX={1}\n $gapX={1}\n $questionWidth={questionWidth}\n $actionbarHeight={actionbarHeight}\n >\n <Clickable label=\"close\" onClick={handleClose}>\n <CloseIcon />\n </Clickable>\n <FlexView $gutterX={0.5}>\n <Text $renderAs=\"eyebrow2\" $color=\"ORANGE_5\" $marginBottomX={0.25}>\n {activeSection === 'HINT' ? 'HINTS:' : 'SOLUTION:'}\n </Text>\n </FlexView>\n {activeSectionData &&\n activeSectionData.map((item, index) => (\n <FlexView $gutterX={0.5} $gapX={0.5} key={index.toString()}>\n {activeSectionData.length > 1 && (\n <Text $renderAs=\"eyebrow2\" $color=\"ORANGE_5\" $marginBottomX={0.25}>\n {activeSection} {index + 1}:\n </Text>\n )}\n <Guide\n dangerouslySetInnerHTML={{\n __html: item,\n }}\n />\n </FlexView>\n ))}\n </Section>\n </SectionContainer>\n )}\n </GuideContainer>\n );\n },\n);\n\nexport default QuestionGuide;\n"],"names":["QuestionGuide","memo","questionWidth","questions","activeQuestionIndex","learnosity","actionbarHeight","loggerRef","studentClassroomId","enableStickers","activeSection","setActiveSection","useState","pointerPosition","setPointerPosition","showStickers","setShowStickers","triggerRef","useRef","top","left","handleHintClick","useCallback","EVENTS","handleSolClick","handleClose","handleBadgeToggle","prev","hints","solution","_a","activeSectionData","useMemo","sqlRef","hintRef","updatePointerPosition","ref","rect","stickerTrigger","jsx","Clickable","jsxs","FlexView","StickersIcon","Text","Separator","stickerGridConfig","stickerTooltipConfig","coachmarkConfig","eligibleJourneyIds","useGetEligibleJourneysViaRoute","JOURNEY_ID_TEACHER","isJourneyActive","useJourney","startTeacherStickersJourney","useStickersJourney","useEffect","GuideContainer","StickerSelector","HintIcon","SolIcon","Pointer","SectionContainer","Section","CloseIcon","item","index","Guide"],"mappings":";;;;;;;;;;;;;AAkDA,MAAMA,KAA+CC;AAAA,EACnD,CAAC;AAAA,IACC,eAAAC;AAAA,IACA,WAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,gBAAAC;AAAA,EAAA,MACI;;AACJ,UAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAgC,GACpE,CAACC,GAAiBC,CAAkB,IAAIF,EAAS;AAAA,MACrD,KAAK;AAAA,MACL,MAAM;AAAA,IAAA,CACP,GACK,CAACG,GAAcC,CAAe,IAAIJ,EAAS,EAAK,GAChDK,IAAaC,EAA8B,IAAI,GAC/C,EAAE,KAAAC,GAAK,MAAAC,EAAS,IAAAP,GAEhBQ,IAAkBC,EAAY,MAAM;AACxC,MAAAX,EAAiB,MAAM,GACbJ,EAAA,QAAQgB,EAAO,sBAAsB;AAAA,IAAA,GAC9C,CAAChB,CAAS,CAAC,GACRiB,IAAiBF,EAAY,MAAM;AACvC,MAAAX,EAAiB,KAAK,GACZJ,EAAA,QAAQgB,EAAO,0BAA0B;AAAA,IAAA,GAClD,CAAChB,CAA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AA,cACP,gBAAgB7D;AAAA,cAChB,kBAAkBI;AAAA,cAElB,UAAA;AAAA,gBAAA,gBAAAiC,EAACC,KAAU,OAAM,SAAQ,SAASf,GAChC,UAAA,gBAAAc,EAACyB,MAAU,EACb,CAAA;AAAA,kCACCtB,GAAS,EAAA,UAAU,KAClB,UAAA,gBAAAH,EAACK,KAAK,WAAU,YAAW,QAAO,YAAW,gBAAgB,MAC1D,UAAAlC,MAAkB,SAAS,WAAW,YACzC,CAAA,GACF;AAAA,gBACCqB,KACCA,EAAkB,IAAI,CAACkC,GAAMC,MAC3B,gBAAAzB,EAACC,GAAS,EAAA,UAAU,KAAK,OAAO,KAC7B,UAAA;AAAA,kBAAkBX,EAAA,SAAS,KACzB,gBAAAU,EAAAG,GAAA,EAAK,WAAU,YAAW,QAAO,YAAW,gBAAgB,MAC1D,UAAA;AAAA,oBAAAlC;AAAA,oBAAc;AAAA,oBAAEwD,IAAQ;AAAA,oBAAE;AAAA,kBAAA,GAC7B;AAAA,kBAEF,gBAAA3B;AAAA,oBAAC4B;AAAA,oBAAA;AAAA,sBACC,yBAAyB;AAAA,wBACvB,QAAQF;AAAA,sBACV;AAAA,oBAAA;AAAA,kBACF;AAAA,gBAAA,KAVwCC,EAAM,SAAS,CAWzD,CACD;AAAA,cAAA;AAAA,YAAA;AAAA,UACL;AAAA,QAAA;AAAA,MACF;AAAA,IAEJ,EAAA,CAAA;AAAA,EAEJ;AACF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"worksheet-types.js","sources":["../../../../src/features/worksheet/worksheet/worksheet-types.ts"],"sourcesContent":["import type { MutableRefObject, ReactElement } from 'react';\n\nimport type { 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 './worksheet-question/subjective-review';\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 hints?: string[];\n solution?: string[];\n teacher_tips?: string[];\n valid_response_count: number;\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\nexport type TItemType =\n | 'overview'\n | 'learning-we-do'\n | 'learning-your-turn'\n | 'learning-explore'\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-basic'\n | 'practice-regular'\n | 'exit-ticket'\n | 'advanced';\n\nexport interface 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 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\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\nexport interface 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 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}\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, 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-ANTIL: Accept only validation which can be 'system' or 'teacher' or undefined\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 * 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 TWORKSHHET_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: TWORKSHHET_QUESTION_MEDIA_TYPE,\n mediaState: Record<string, unknown>,\n ) => void;\n onTeacherValidation?: (questionId: string, rating?: keyof typeof QUESTIONS_RATING) => 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?: (responses: Record<string, IWorksheetResponse>) => void;\n loggerRef: MutableRefObject<(eventName: string, data?: Record<string, unknown>) => void>;\n}\n\nexport interface ICueCanvasCallbackProps {\n onPublishStrokes?: TPublish;\n onReceiveStrokes?: TSubscribe;\n}\n\nexport interface ICueCanvasProps {\n initialStrokesData?: Record<string, IActionData[]>;\n}\n\nexport interface 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 renderSideBar: boolean;\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 layout: IWorksheetLayout;\n behavior: IWorksheetBehavior;\n initialResponseId?: string;\n initialItemIndex?: number;\n updatedResponses?: Record<string, IWorksheetResponse>;\n worksheetCompleted: boolean;\n showNudgeBanner?: boolean;\n markedAsCompleted?: boolean;\n onResolveDoubt?: (responseId: string) => void;\n onActiveQuestionChange?: (question: IWorksheetQuestion) => void;\n canResolveDoubt?: boolean;\n onSkip?: (itemIndex: number, widgetIndex: number) => void;\n canShowActionBar?: boolean;\n actionBarRightElement?: ReactElement; // Extra Elements to be rendered in the action bar\n}\ninterface StickerFeatureConfig {\n studentClassroomId: string;\n enableStickers: boolean;\n}\n\ninterface FeatureConfigs {\n stickers?: StickerFeatureConfig;\n}\n\nexport interface IWorksheetProps<\n TExtraFeatures extends Record<string, unknown> = Record<string, never>,\n> extends IBaseWorksheetProps,\n IWorksheetCallbackProps,\n ICueCanvasProps,\n ICueCanvasCallbackProps,\n IPointerSyncCallbackProps {\n learnosityActivityRef?: string;\n learnosityItems: ILearnosityItem[];\n learnosityResponses?: Record<string, IWorksheetResponse>;\n learnosity: ILearnosity;\n appendedQuestionIds: string[];\n questionsSignedRequest: string;\n openQuestionFeedbackModal?: (itemRef: string) => void;\n summaryDescription?: ReactElement | null;\n canSubmitWorksheet?: boolean;\n studentId: string;\n attemptId?: string;\n subjectiveProps?: ISubjectiveSheetProps;\n featuresConfig?: FeatureConfigs & TExtraFeatures;\n}\n\nexport interface IUpdateImages {\n filteredImages: string[];\n newImages: IFile[];\n}\nexport interface 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 IWorksheetContainerProps<\n TExtraFeatures extends Record<string, unknown> = Record<string, never>,\n> extends Omit<IBaseWorksheetProps, 'behavior'>,\n IWorksheetCallbackProps,\n ICueCanvasProps,\n ICueCanvasCallbackProps,\n IPointerSyncCallbackProps {\n studentId: string;\n attemptId?: string;\n itemsSignedRequest: string;\n questionsSignedRequest: string;\n onLoaded: () => void;\n onErrored: (error: { code?: number; message: string }) => void;\n onResponsesLoaded?: (responses: Record<string, IWorksheetResponse>) => void;\n openQuestionFeedbackModal?: (itemRef: string) => void;\n summaryDescription?: ReactElement | null;\n canSubmitWorksheet?: boolean;\n subjectiveProps?: ISubjectiveSheetProps;\n inClass?: boolean; // If true, the worksheet is rendered inside class\n isLessonV3Enabled?: boolean; // If true, the worksheet is rendered in lesson v3 mode\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 featuresConfig?: FeatureConfigs & TExtraFeatures;\n}\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: TWORKSHHET_QUESTION_MEDIA_TYPE,\n mediaState: Record<string, unknown>,\n ) => 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"],"names":["QUESTION_TAGS","QUESTIONS_RATING"],"mappings":"AAQY,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;"}
1
+ {"version":3,"file":"worksheet-types.js","sources":["../../../../src/features/worksheet/worksheet/worksheet-types.ts"],"sourcesContent":["import type { MutableRefObject, ReactElement } from 'react';\n\nimport type { 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 './worksheet-question/subjective-review';\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 hints?: string[];\n solution?: string[];\n teacher_tips?: string[];\n valid_response_count: number;\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\nexport type TItemType =\n | 'overview'\n | 'learning-we-do'\n | 'learning-your-turn'\n | 'learning-explore'\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-basic'\n | 'practice-regular'\n | 'exit-ticket'\n | 'advanced';\n\nexport interface 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 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\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\nexport interface 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 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}\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, 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-ANTIL: Accept only validation which can be 'system' or 'teacher' or undefined\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 * 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 TWORKSHHET_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: TWORKSHHET_QUESTION_MEDIA_TYPE,\n mediaState: Record<string, unknown>,\n ) => void;\n onTeacherValidation?: (questionId: string, rating?: keyof typeof QUESTIONS_RATING) => 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?: (responses: Record<string, IWorksheetResponse>) => void;\n loggerRef: MutableRefObject<(eventName: string, data?: Record<string, unknown>) => void>;\n}\n\nexport interface ICueCanvasCallbackProps {\n onPublishStrokes?: TPublish;\n onReceiveStrokes?: TSubscribe;\n}\n\nexport interface ICueCanvasProps {\n initialStrokesData?: Record<string, IActionData[]>;\n}\n\nexport interface 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 renderSideBar: boolean;\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 layout: IWorksheetLayout;\n behavior: IWorksheetBehavior;\n initialResponseId?: string;\n initialItemIndex?: number;\n updatedResponses?: Record<string, IWorksheetResponse>;\n worksheetCompleted: boolean;\n showNudgeBanner?: boolean;\n markedAsCompleted?: boolean;\n onResolveDoubt?: (responseId: string) => void;\n onActiveQuestionChange?: (question: IWorksheetQuestion) => void;\n canResolveDoubt?: boolean;\n onSkip?: (itemIndex: number, widgetIndex: number) => void;\n canShowActionBar?: boolean;\n actionBarRightElement?: ReactElement; // Extra Elements to be rendered in the action bar\n}\ninterface StickerFeatureConfig {\n studentClassroomId: string;\n enableStickers: boolean;\n}\n\ninterface FeatureConfigs {\n stickers?: StickerFeatureConfig;\n}\n\nexport interface IWorksheetProps<\n TExtraFeatures extends Record<string, unknown> = Record<string, never>,\n> extends IBaseWorksheetProps,\n IWorksheetCallbackProps,\n ICueCanvasProps,\n ICueCanvasCallbackProps,\n IPointerSyncCallbackProps {\n learnosityActivityRef?: string;\n learnosityItems: ILearnosityItem[];\n learnosityResponses?: Record<string, IWorksheetResponse>;\n learnosity: ILearnosity;\n appendedQuestionIds: string[];\n questionsSignedRequest: string;\n openQuestionFeedbackModal?: (itemRef: string) => void;\n summaryDescription?: ReactElement | null;\n canSubmitWorksheet?: boolean;\n studentId: string;\n attemptId?: string;\n subjectiveProps?: ISubjectiveSheetProps;\n featuresConfig?: FeatureConfigs & TExtraFeatures;\n}\n\nexport interface IUpdateImages {\n filteredImages: string[];\n newImages: IFile[];\n}\nexport interface 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 IWorksheetContainerProps<\n TExtraFeatures extends Record<string, unknown> = Record<string, unknown>,\n> extends Omit<IBaseWorksheetProps, 'behavior'>,\n IWorksheetCallbackProps,\n ICueCanvasProps,\n ICueCanvasCallbackProps,\n IPointerSyncCallbackProps {\n studentId: string;\n attemptId?: string;\n itemsSignedRequest: string;\n questionsSignedRequest: string;\n onLoaded: () => void;\n onErrored: (error: { code?: number; message: string }) => void;\n onResponsesLoaded?: (responses: Record<string, IWorksheetResponse>) => void;\n openQuestionFeedbackModal?: (itemRef: string) => void;\n summaryDescription?: ReactElement | null;\n canSubmitWorksheet?: boolean;\n subjectiveProps?: ISubjectiveSheetProps;\n inClass?: boolean; // If true, the worksheet is rendered inside class\n isLessonV3Enabled?: boolean; // If true, the worksheet is rendered in lesson v3 mode\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 featuresConfig?: FeatureConfigs & TExtraFeatures;\n}\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: TWORKSHHET_QUESTION_MEDIA_TYPE,\n mediaState: Record<string, unknown>,\n ) => 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"],"names":["QUESTION_TAGS","QUESTIONS_RATING"],"mappings":"AAQY,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;"}
package/dist/index.d.ts CHANGED
@@ -4665,7 +4665,7 @@ declare interface IWorksheetCallbackProps {
4665
4665
  loggerRef: MutableRefObject<(eventName: string, data?: Record<string, unknown>) => void>;
4666
4666
  }
4667
4667
 
4668
- declare interface IWorksheetContainerProps<TExtraFeatures extends Record<string, unknown> = Record<string, never>> extends Omit<IBaseWorksheetProps, 'behavior'>, IWorksheetCallbackProps, ICueCanvasProps, ICueCanvasCallbackProps, IPointerSyncCallbackProps {
4668
+ declare interface IWorksheetContainerProps<TExtraFeatures extends Record<string, unknown> = Record<string, unknown>> extends Omit<IBaseWorksheetProps, 'behavior'>, IWorksheetCallbackProps, ICueCanvasProps, ICueCanvasCallbackProps, IPointerSyncCallbackProps {
4669
4669
  studentId: string;
4670
4670
  attemptId?: string;
4671
4671
  itemsSignedRequest: string;
@@ -7303,7 +7303,7 @@ declare type WithSrc = {
7303
7303
  src: string;
7304
7304
  };
7305
7305
 
7306
- export declare const Worksheet: NamedExoticComponent<IWorksheetContainerProps<Record<string, never>> & RefAttributes<IWorksheetRef>>;
7306
+ export declare const Worksheet: NamedExoticComponent<IWorksheetContainerProps<Record<string, unknown>> & RefAttributes<IWorksheetRef>>;
7307
7307
 
7308
7308
  export declare const WORKSHEET_ACTION_BAR_HEIGHT = 56;
7309
7309
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuemath/leap",
3
- "version": "3.4.9-m",
3
+ "version": "3.4.11-m",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"