@cuemath/leap 3.4.0 → 3.4.1-as1

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,51 +1,51 @@
1
- import { jsx as e, jsxs as m, Fragment as G } from "react/jsx-runtime";
2
- import { memo as z, useRef as F, useCallback as l } from "react";
3
- import P from "../../../../../assets/line-icons/icons/eye2.js";
4
- import U from "../../../../../assets/line-icons/icons/redo.js";
5
- import Y from "../../../../ui/arrow-tooltip/arrow-tooltip.js";
6
- import Z from "../../../../ui/context-menu/context-menu.js";
7
- import q from "../../../../ui/lottie-animation/lottie-animation.js";
8
- import J from "../../../../ui/text/text.js";
9
- import { BLOCK_TYPE as Q } from "../../../constants/block-constants.js";
10
- import { NODE_CARD_STATES as V } from "../../../constants/node-constants.js";
11
- import { getNodeTypeBasedBgImage as ee } from "../../../utils/index.js";
12
- import { getNodeCardBasedIcon as te } from "../../../utils/node-card-utils.js";
13
- import { NodeCardContainer as ne, NodeCardInfoWrapper as re, IconWrapper as oe, StyledImportantIcon as ae, NodeCardContentWrapper as ie, NodeCardTitle as ce } from "../node-card-styled.js";
14
- import se from "../node-card-tags.js";
15
- import de from "../node-menu-options/node-menu-options.js";
16
- const me = { renderer: "canvas", autoplay: !1 }, ye = z((b) => {
1
+ import { jsx as e, jsxs as m, Fragment as F } from "react/jsx-runtime";
2
+ import { memo as P, useRef as U, useCallback as l } from "react";
3
+ import Y from "../../../../../assets/line-icons/icons/eye2.js";
4
+ import Z from "../../../../../assets/line-icons/icons/redo.js";
5
+ import q from "../../../../ui/arrow-tooltip/arrow-tooltip.js";
6
+ import J from "../../../../ui/context-menu/context-menu.js";
7
+ import Q from "../../../../ui/lottie-animation/lottie-animation.js";
8
+ import V from "../../../../ui/text/text.js";
9
+ import { BLOCK_TYPE as T } from "../../../constants/block-constants.js";
10
+ import { NODE_CARD_STATES as ee } from "../../../constants/node-constants.js";
11
+ import { getNodeTypeBasedBgImage as te } from "../../../utils/index.js";
12
+ import { getNodeCardBasedIcon as ne } from "../../../utils/node-card-utils.js";
13
+ import { NodeCardContainer as re, NodeCardInfoWrapper as oe, IconWrapper as ae, StyledImportantIcon as ie, NodeCardContentWrapper as ce, NodeCardTitle as se } from "../node-card-styled.js";
14
+ import de from "../node-card-tags.js";
15
+ import me from "../node-menu-options/node-menu-options.js";
16
+ const le = { renderer: "canvas", autoplay: !1 }, Ee = P((b) => {
17
17
  const {
18
18
  nodeData: t,
19
- imageHue: O,
20
- blockType: A,
19
+ imageHue: A,
20
+ blockType: C,
21
21
  onNodeAttempt: a,
22
22
  onNodeReattempt: i,
23
23
  onNodeReview: c,
24
24
  onNodeView: n,
25
- isStudent: S
25
+ isStudent: E
26
26
  } = b, {
27
27
  accuracy: y,
28
- attempt_location: E,
28
+ attempt_location: L,
29
29
  node_type: s,
30
- card_header: L,
31
- title: T,
32
- state: C,
33
- is_optional: B,
30
+ card_header: B,
31
+ title: v,
32
+ state: _,
33
+ is_optional: M,
34
34
  sheet_statement: $,
35
35
  permissions: x,
36
36
  marked_as_completed: g,
37
- user_attempt_id: _
37
+ user_attempt_id: k
38
38
  } = t, {
39
39
  can_review: d,
40
40
  can_start: p,
41
41
  can_resume: u,
42
42
  can_reset: I,
43
- can_un_skip: v
44
- } = x, w = A === Q.GOAL, o = C === V.LOCKED, M = E === "INCLASS", R = p || u, W = s === "HIDDEN_BASIC", f = !R && (I || d), h = F(null), D = ee(s), { lottie: N } = te(s), k = l(
43
+ can_un_skip: w
44
+ } = x, R = C === T.GOAL, o = _ === ee.LOCKED, W = L === "INCLASS", D = p || u, N = s === "HIDDEN_BASIC", S = C === T.SAT_MOCK_TEST, f = !D && (I || d), h = U(null), H = te(s), { lottie: K } = ne(s), O = l(
45
45
  (r) => {
46
46
  switch (r) {
47
47
  case "node-card-review":
48
- d && _ ? c == null || c(t) : n == null || n(t);
48
+ d && k ? c == null || c(t, void 0, void 0, S) : n == null || n(t);
49
49
  return;
50
50
  case "node-card-reattempt":
51
51
  i == null || i(t);
@@ -54,8 +54,16 @@ const me = { renderer: "canvas", autoplay: !1 }, ye = z((b) => {
54
54
  throw new Error(`No callback function for ${r}`);
55
55
  }
56
56
  },
57
- [d, t, i, c, n, _]
58
- ), H = l(() => {
57
+ [
58
+ d,
59
+ S,
60
+ t,
61
+ i,
62
+ c,
63
+ n,
64
+ k
65
+ ]
66
+ ), X = l(() => {
59
67
  f || o || (p || u ? a == null || a(t) : g && (n == null || n(t)));
60
68
  }, [
61
69
  u,
@@ -66,39 +74,39 @@ const me = { renderer: "canvas", autoplay: !1 }, ye = z((b) => {
66
74
  f,
67
75
  o,
68
76
  g
69
- ]), K = l(() => {
77
+ ]), j = l(() => {
70
78
  var r;
71
79
  o || (r = h.current) == null || r.play();
72
- }, [o]), X = l(() => {
80
+ }, [o]), G = l(() => {
73
81
  var r;
74
82
  (r = h.current) == null || r.stop();
75
- }, []), j = [
83
+ }, []), z = [
76
84
  {
77
85
  id: "node-card-review",
78
86
  label: "Review",
79
- icon: P,
87
+ icon: Y,
80
88
  disabled: !d,
81
- onClick: k
89
+ onClick: O
82
90
  },
83
91
  {
84
92
  id: "node-card-reattempt",
85
93
  label: "Reattempt",
86
- icon: U,
94
+ icon: Z,
87
95
  disabled: !I,
88
- onClick: k
96
+ onClick: O
89
97
  }
90
98
  ];
91
- return v || W ? null : /* @__PURE__ */ e(
92
- Z,
99
+ return w || N ? null : /* @__PURE__ */ e(
100
+ J,
93
101
  {
94
102
  targetElement: /* @__PURE__ */ e(
95
- ne,
103
+ re,
96
104
  {
97
- $background: `${O}_2`,
105
+ $background: `${A}_2`,
98
106
  $disabled: o,
99
- onClick: H,
107
+ onClick: X,
100
108
  children: /* @__PURE__ */ m(
101
- Y,
109
+ q,
102
110
  {
103
111
  renderAs: "primary",
104
112
  tooltipItem: $,
@@ -109,20 +117,20 @@ const me = { renderer: "canvas", autoplay: !1 }, ye = z((b) => {
109
117
  widthX: 11.25,
110
118
  children: [
111
119
  /* @__PURE__ */ m(
112
- re,
120
+ oe,
113
121
  {
114
122
  $flexDirection: "row",
115
123
  $alignItems: "center",
116
124
  $heightX: 3.5,
117
- $bgImage: D,
125
+ $bgImage: H,
118
126
  $gutterX: 0.78125,
119
127
  $flexGap: 8.5,
120
128
  $opacity: o ? 0.5 : 1,
121
- onMouseEnter: K,
122
- onMouseLeave: X,
129
+ onMouseEnter: j,
130
+ onMouseLeave: G,
123
131
  children: [
124
132
  /* @__PURE__ */ m(
125
- oe,
133
+ ae,
126
134
  {
127
135
  $width: 31,
128
136
  $height: 31,
@@ -132,41 +140,41 @@ const me = { renderer: "canvas", autoplay: !1 }, ye = z((b) => {
132
140
  $justifyContent: "center",
133
141
  children: [
134
142
  /* @__PURE__ */ e(
135
- q,
143
+ Q,
136
144
  {
137
- src: N,
145
+ src: K,
138
146
  ref: h,
139
- settings: me
147
+ settings: le
140
148
  }
141
149
  ),
142
- !B && /* @__PURE__ */ e(ae, {})
150
+ !M && /* @__PURE__ */ e(ie, {})
143
151
  ]
144
152
  }
145
153
  ),
146
- /* @__PURE__ */ m(J, { $renderAs: "ac4-black", $color: "BLACK", children: [
147
- L,
154
+ /* @__PURE__ */ m(V, { $renderAs: "ac4-black", $color: "BLACK", children: [
155
+ B,
148
156
  " ",
149
- M && "• CW"
157
+ W && "• CW"
150
158
  ] })
151
159
  ]
152
160
  }
153
161
  ),
154
162
  /* @__PURE__ */ e(
155
- se,
163
+ de,
156
164
  {
157
165
  nodeType: s,
158
- state: C,
166
+ state: _,
159
167
  accuracy: y,
160
- isStudent: S
168
+ isStudent: E
161
169
  }
162
170
  ),
163
- !w && /* @__PURE__ */ e(ie, { $background: "WHITE_1", $heightX: 4, children: /* @__PURE__ */ e(
164
- ce,
171
+ !R && /* @__PURE__ */ e(ce, { $background: "WHITE_1", $heightX: 4, children: /* @__PURE__ */ e(
172
+ se,
165
173
  {
166
174
  $renderAs: "ab3",
167
175
  $color: "BLACK_1",
168
176
  $opacity: o ? 0.5 : 1,
169
- children: T
177
+ children: v
170
178
  }
171
179
  ) })
172
180
  ]
@@ -178,11 +186,11 @@ const me = { renderer: "canvas", autoplay: !1 }, ye = z((b) => {
178
186
  menuWidth: "100%",
179
187
  menuZIndex: 6,
180
188
  menuOffset: 2,
181
- menuElement: f ? /* @__PURE__ */ e(de, { options: j }) : /* @__PURE__ */ e(G, {})
189
+ menuElement: f ? /* @__PURE__ */ e(me, { options: z }) : /* @__PURE__ */ e(F, {})
182
190
  }
183
191
  );
184
192
  });
185
193
  export {
186
- ye as default
194
+ Ee as default
187
195
  };
188
196
  //# sourceMappingURL=student-actions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"student-actions.js","sources":["../../../../../../src/features/chapters-v2/comps/node-card/student-actions/student-actions.tsx"],"sourcesContent":["import { memo, useCallback, useRef, type FC } from 'react';\n\nimport Eye2Icon from '../../../../../assets/line-icons/icons/eye2';\nimport RedoIcon from '../../../../../assets/line-icons/icons/redo';\nimport ArrowTooltip from '../../../../ui/arrow-tooltip/arrow-tooltip';\nimport ContextMenu from '../../../../ui/context-menu/context-menu';\nimport LottieAnimation from '../../../../ui/lottie-animation/lottie-animation';\nimport type { ILottieAnimationRef } from '../../../../ui/lottie-animation/types';\nimport Text from '../../../../ui/text/text';\nimport { BLOCK_TYPE } from '../../../constants/block-constants';\nimport { NODE_CARD_STATES } from '../../../constants/node-constants';\nimport { getNodeTypeBasedBgImage } from '../../../utils';\nimport { getNodeCardBasedIcon } from '../../../utils/node-card-utils';\nimport * as Styled from '../node-card-styled';\nimport NodeCardTags from '../node-card-tags';\nimport type { INodeCardProps } from '../node-card-types';\nimport NodeMenuOptions from '../node-menu-options/node-menu-options';\nimport type { INodeMenuOption } from '../node-menu-options/node-menu-options-types';\n\nconst renderSettings = { renderer: 'canvas', autoplay: false };\n\nconst StudentActions: FC<Omit<INodeCardProps, 'userType'>> = memo(props => {\n const {\n nodeData,\n imageHue,\n blockType,\n onNodeAttempt,\n onNodeReattempt,\n onNodeReview,\n onNodeView,\n isStudent,\n } = props;\n const {\n accuracy,\n attempt_location: attemptLocation,\n node_type: nodeType,\n card_header: cardHeader,\n title,\n state,\n is_optional: isOptional,\n sheet_statement: sheetStatement,\n permissions,\n marked_as_completed: teacherMarkedAsCompleted,\n user_attempt_id: userAttemptId,\n } = nodeData;\n const {\n can_review: canReview,\n can_start: canStart,\n can_resume: canResume,\n can_reset: canReset,\n can_un_skip: canUnSkip,\n } = permissions;\n\n const isGoalBlock = blockType === BLOCK_TYPE.GOAL;\n const sheetLocked = state === NODE_CARD_STATES.LOCKED;\n const inClassSheet = attemptLocation === 'INCLASS';\n const canStartOrResume = canStart || canResume;\n const isHiddenBasic = nodeType === 'HIDDEN_BASIC';\n\n const renderOptions = !canStartOrResume && (canReset || canReview);\n const animationRef = useRef<ILottieAnimationRef | null>(null);\n const nodeBgImage = getNodeTypeBasedBgImage(nodeType);\n const { lottie: nodeCardLottie } = getNodeCardBasedIcon(nodeType);\n\n const handleOnMenuOptionClick = useCallback(\n (optionId: string) => {\n switch (optionId) {\n case 'node-card-review':\n if (canReview && userAttemptId) {\n onNodeReview?.(nodeData);\n } else {\n onNodeView?.(nodeData);\n }\n\n return;\n\n case 'node-card-reattempt':\n onNodeReattempt?.(nodeData);\n\n return;\n\n default:\n throw new Error(`No callback function for ${optionId}`);\n }\n },\n [canReview, nodeData, onNodeReattempt, onNodeReview, onNodeView, userAttemptId],\n );\n\n const handleOnNodeCardClick = useCallback(() => {\n if (renderOptions || sheetLocked) return;\n\n if (canStart || canResume) {\n onNodeAttempt?.(nodeData);\n } else if (teacherMarkedAsCompleted) {\n onNodeView?.(nodeData);\n }\n }, [\n canResume,\n canStart,\n nodeData,\n onNodeAttempt,\n onNodeView,\n renderOptions,\n sheetLocked,\n teacherMarkedAsCompleted,\n ]);\n\n const handleOnMouseEnter = useCallback(() => {\n if (sheetLocked) return;\n animationRef.current?.play();\n }, [sheetLocked]);\n\n const handleOnMouseLeave = useCallback(() => {\n animationRef.current?.stop();\n }, []);\n\n const menuOptions: INodeMenuOption[] = [\n {\n id: 'node-card-review',\n label: 'Review',\n icon: Eye2Icon,\n disabled: !canReview,\n onClick: handleOnMenuOptionClick,\n },\n {\n id: 'node-card-reattempt',\n label: 'Reattempt',\n icon: RedoIcon,\n disabled: !canReset,\n onClick: handleOnMenuOptionClick,\n },\n ];\n\n //* Scenario when student cannot see the node. But teacher can still see that node.\n //* If a node is skipped or if it's node type is HIDDEN_BASIC.\n if (canUnSkip || isHiddenBasic) return null;\n\n return (\n <ContextMenu\n targetElement={\n <Styled.NodeCardContainer\n $background={`${imageHue}_2`}\n $disabled={sheetLocked}\n onClick={handleOnNodeCardClick}\n >\n <ArrowTooltip\n renderAs=\"primary\"\n tooltipItem={sheetStatement}\n position=\"bottom\"\n zIndex={5}\n hidden={!sheetStatement}\n parentWidth=\"100%\"\n widthX={11.25}\n >\n <Styled.NodeCardInfoWrapper\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $heightX={3.5}\n $bgImage={nodeBgImage}\n $gutterX={0.78125}\n $flexGap={8.5}\n $opacity={sheetLocked ? 0.5 : 1}\n onMouseEnter={handleOnMouseEnter}\n onMouseLeave={handleOnMouseLeave}\n >\n <Styled.IconWrapper\n $width={31}\n $height={31}\n $background=\"WHITE_1\"\n $position=\"relative\"\n $alignItems=\"center\"\n $justifyContent=\"center\"\n >\n <LottieAnimation\n src={nodeCardLottie}\n ref={animationRef}\n settings={renderSettings}\n />\n {!isOptional && <Styled.StyledImportantIcon />}\n </Styled.IconWrapper>\n\n <Text $renderAs=\"ac4-black\" $color=\"BLACK\">\n {cardHeader} {inClassSheet && `• CW`}\n </Text>\n </Styled.NodeCardInfoWrapper>\n\n <NodeCardTags\n nodeType={nodeType}\n state={state}\n accuracy={accuracy}\n isStudent={isStudent}\n />\n\n {!isGoalBlock && (\n <Styled.NodeCardContentWrapper $background=\"WHITE_1\" $heightX={4}>\n <Styled.NodeCardTitle\n $renderAs=\"ab3\"\n $color=\"BLACK_1\"\n $opacity={sheetLocked ? 0.5 : 1}\n >\n {title}\n </Styled.NodeCardTitle>\n </Styled.NodeCardContentWrapper>\n )}\n </ArrowTooltip>\n </Styled.NodeCardContainer>\n }\n startLeft\n menuWidth=\"100%\"\n menuZIndex={6}\n menuOffset={2}\n menuElement={renderOptions ? <NodeMenuOptions options={menuOptions} /> : <></>}\n />\n );\n});\n\nexport default StudentActions;\n"],"names":["renderSettings","StudentActions","memo","props","nodeData","imageHue","blockType","onNodeAttempt","onNodeReattempt","onNodeReview","onNodeView","isStudent","accuracy","attemptLocation","nodeType","cardHeader","title","state","isOptional","sheetStatement","permissions","teacherMarkedAsCompleted","userAttemptId","canReview","canStart","canResume","canReset","canUnSkip","isGoalBlock","BLOCK_TYPE","sheetLocked","NODE_CARD_STATES","inClassSheet","canStartOrResume","isHiddenBasic","renderOptions","animationRef","useRef","nodeBgImage","getNodeTypeBasedBgImage","nodeCardLottie","getNodeCardBasedIcon","handleOnMenuOptionClick","useCallback","optionId","handleOnNodeCardClick","handleOnMouseEnter","_a","handleOnMouseLeave","menuOptions","Eye2Icon","RedoIcon","jsx","ContextMenu","Styled.NodeCardContainer","jsxs","ArrowTooltip","Styled.NodeCardInfoWrapper","Styled.IconWrapper","LottieAnimation","Styled.StyledImportantIcon","Text","NodeCardTags","Styled.NodeCardContentWrapper","Styled.NodeCardTitle","NodeMenuOptions","Fragment"],"mappings":";;;;;;;;;;;;;;;AAmBA,MAAMA,KAAiB,EAAE,UAAU,UAAU,UAAU,GAAM,GAEvDC,KAAuDC,EAAK,CAASC,MAAA;AACnE,QAAA;AAAA,IACJ,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,eAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,YAAAC;AAAA,IACA,WAAAC;AAAA,EACE,IAAAR,GACE;AAAA,IACJ,UAAAS;AAAA,IACA,kBAAkBC;AAAA,IAClB,WAAWC;AAAA,IACX,aAAaC;AAAA,IACb,OAAAC;AAAA,IAC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;AAAA,0BAEhB,UAAA;AAAA,4BAAA,gBAAAN;AAAA,8BAACO;AAAA,8BAAA;AAAA,gCACC,KAAKnB;AAAA,gCACL,KAAKJ;AAAA,gCACL,UAAUpC;AAAA,8BAAA;AAAA,4BACZ;AAAA,4BACC,CAACkB,KAAe,gBAAAkC,EAAAQ,IAAA,EAA2B;AAAA,0BAAA;AAAA,wBAAA;AAAA,sBAC9C;AAAA,sBAEC,gBAAAL,EAAAM,GAAA,EAAK,WAAU,aAAY,QAAO,SAChC,UAAA;AAAA,wBAAA9C;AAAA,wBAAW;AAAA,wBAAEiB,KAAgB;AAAA,sBAAA,GAChC;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBACF;AAAA,gBAEA,gBAAAoB;AAAA,kBAACU;AAAA,kBAAA;AAAA,oBACC,UAAAhD;AAAA,oBACA,OAAAG;AAAA,oBACA,UAAAL;AAAA,oBACA,WAAAD;AAAA,kBAAA;AAAA,gBACF;AAAA,gBAEC,CAACiB,KACC,gBAAAwB,EAAAW,IAAA,EAA8B,aAAY,WAAU,UAAU,GAC7D,UAAA,gBAAAX;AAAA,kBAACY;AAAAA,kBAAA;AAAA,oBACC,WAAU;AAAA,oBACV,QAAO;AAAA,oBACP,UAAUlC,IAAc,MAAM;AAAA,oBAE7B,UAAAd;AAAA,kBAAA;AAAA,gBAAA,GAEL;AAAA,cAAA;AAAA,YAAA;AAAA,UAEJ;AAAA,QAAA;AAAA,MACF;AAAA,MAEF,WAAS;AAAA,MACT,WAAU;AAAA,MACV,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,aAAamB,IAAgB,gBAAAiB,EAACa,MAAgB,SAAShB,EAAA,CAAa,IAAO,gBAAAG,EAAAc,GAAA,EAAA;AAAA,IAAA;AAAA,EAAA;AAGjF,CAAC;"}
1
+ {"version":3,"file":"student-actions.js","sources":["../../../../../../src/features/chapters-v2/comps/node-card/student-actions/student-actions.tsx"],"sourcesContent":["import { memo, useCallback, useRef, type FC } from 'react';\n\nimport Eye2Icon from '../../../../../assets/line-icons/icons/eye2';\nimport RedoIcon from '../../../../../assets/line-icons/icons/redo';\nimport ArrowTooltip from '../../../../ui/arrow-tooltip/arrow-tooltip';\nimport ContextMenu from '../../../../ui/context-menu/context-menu';\nimport LottieAnimation from '../../../../ui/lottie-animation/lottie-animation';\nimport type { ILottieAnimationRef } from '../../../../ui/lottie-animation/types';\nimport Text from '../../../../ui/text/text';\nimport { BLOCK_TYPE } from '../../../constants/block-constants';\nimport { NODE_CARD_STATES } from '../../../constants/node-constants';\nimport { getNodeTypeBasedBgImage } from '../../../utils';\nimport { getNodeCardBasedIcon } from '../../../utils/node-card-utils';\nimport * as Styled from '../node-card-styled';\nimport NodeCardTags from '../node-card-tags';\nimport type { INodeCardProps } from '../node-card-types';\nimport NodeMenuOptions from '../node-menu-options/node-menu-options';\nimport type { INodeMenuOption } from '../node-menu-options/node-menu-options-types';\n\nconst renderSettings = { renderer: 'canvas', autoplay: false };\n\nconst StudentActions: FC<Omit<INodeCardProps, 'userType'>> = memo(props => {\n const {\n nodeData,\n imageHue,\n blockType,\n onNodeAttempt,\n onNodeReattempt,\n onNodeReview,\n onNodeView,\n isStudent,\n } = props;\n const {\n accuracy,\n attempt_location: attemptLocation,\n node_type: nodeType,\n card_header: cardHeader,\n title,\n state,\n is_optional: isOptional,\n sheet_statement: sheetStatement,\n permissions,\n marked_as_completed: teacherMarkedAsCompleted,\n user_attempt_id: userAttemptId,\n } = nodeData;\n const {\n can_review: canReview,\n can_start: canStart,\n can_resume: canResume,\n can_reset: canReset,\n can_un_skip: canUnSkip,\n } = permissions;\n\n const isGoalBlock = blockType === BLOCK_TYPE.GOAL;\n const sheetLocked = state === NODE_CARD_STATES.LOCKED;\n const inClassSheet = attemptLocation === 'INCLASS';\n const canStartOrResume = canStart || canResume;\n const isHiddenBasic = nodeType === 'HIDDEN_BASIC';\n const isSatMockTestBlock = blockType === BLOCK_TYPE.SAT_MOCK_TEST;\n const renderOptions = !canStartOrResume && (canReset || canReview);\n const animationRef = useRef<ILottieAnimationRef | null>(null);\n const nodeBgImage = getNodeTypeBasedBgImage(nodeType);\n const { lottie: nodeCardLottie } = getNodeCardBasedIcon(nodeType);\n\n const handleOnMenuOptionClick = useCallback(\n (optionId: string) => {\n switch (optionId) {\n case 'node-card-review':\n if (canReview && userAttemptId) {\n onNodeReview?.(nodeData, undefined, undefined, isSatMockTestBlock);\n } else {\n onNodeView?.(nodeData);\n }\n\n return;\n\n case 'node-card-reattempt':\n onNodeReattempt?.(nodeData);\n\n return;\n\n default:\n throw new Error(`No callback function for ${optionId}`);\n }\n },\n [\n canReview,\n isSatMockTestBlock,\n nodeData,\n onNodeReattempt,\n onNodeReview,\n onNodeView,\n userAttemptId,\n ],\n );\n\n const handleOnNodeCardClick = useCallback(() => {\n if (renderOptions || sheetLocked) return;\n\n if (canStart || canResume) {\n onNodeAttempt?.(nodeData);\n } else if (teacherMarkedAsCompleted) {\n onNodeView?.(nodeData);\n }\n }, [\n canResume,\n canStart,\n nodeData,\n onNodeAttempt,\n onNodeView,\n renderOptions,\n sheetLocked,\n teacherMarkedAsCompleted,\n ]);\n\n const handleOnMouseEnter = useCallback(() => {\n if (sheetLocked) return;\n animationRef.current?.play();\n }, [sheetLocked]);\n\n const handleOnMouseLeave = useCallback(() => {\n animationRef.current?.stop();\n }, []);\n\n const menuOptions: INodeMenuOption[] = [\n {\n id: 'node-card-review',\n label: 'Review',\n icon: Eye2Icon,\n disabled: !canReview,\n onClick: handleOnMenuOptionClick,\n },\n {\n id: 'node-card-reattempt',\n label: 'Reattempt',\n icon: RedoIcon,\n disabled: !canReset,\n onClick: handleOnMenuOptionClick,\n },\n ];\n\n //* Scenario when student cannot see the node. But teacher can still see that node.\n //* If a node is skipped or if it's node type is HIDDEN_BASIC.\n if (canUnSkip || isHiddenBasic) return null;\n\n return (\n <ContextMenu\n targetElement={\n <Styled.NodeCardContainer\n $background={`${imageHue}_2`}\n $disabled={sheetLocked}\n onClick={handleOnNodeCardClick}\n >\n <ArrowTooltip\n renderAs=\"primary\"\n tooltipItem={sheetStatement}\n position=\"bottom\"\n zIndex={5}\n hidden={!sheetStatement}\n parentWidth=\"100%\"\n widthX={11.25}\n >\n <Styled.NodeCardInfoWrapper\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $heightX={3.5}\n $bgImage={nodeBgImage}\n $gutterX={0.78125}\n $flexGap={8.5}\n $opacity={sheetLocked ? 0.5 : 1}\n onMouseEnter={handleOnMouseEnter}\n onMouseLeave={handleOnMouseLeave}\n >\n <Styled.IconWrapper\n $width={31}\n $height={31}\n $background=\"WHITE_1\"\n $position=\"relative\"\n $alignItems=\"center\"\n $justifyContent=\"center\"\n >\n <LottieAnimation\n src={nodeCardLottie}\n ref={animationRef}\n settings={renderSettings}\n />\n {!isOptional && <Styled.StyledImportantIcon />}\n </Styled.IconWrapper>\n\n <Text $renderAs=\"ac4-black\" $color=\"BLACK\">\n {cardHeader} {inClassSheet && `• CW`}\n </Text>\n </Styled.NodeCardInfoWrapper>\n\n <NodeCardTags\n nodeType={nodeType}\n state={state}\n accuracy={accuracy}\n isStudent={isStudent}\n />\n\n {!isGoalBlock && (\n <Styled.NodeCardContentWrapper $background=\"WHITE_1\" $heightX={4}>\n <Styled.NodeCardTitle\n $renderAs=\"ab3\"\n $color=\"BLACK_1\"\n $opacity={sheetLocked ? 0.5 : 1}\n >\n {title}\n </Styled.NodeCardTitle>\n </Styled.NodeCardContentWrapper>\n )}\n </ArrowTooltip>\n </Styled.NodeCardContainer>\n }\n startLeft\n menuWidth=\"100%\"\n menuZIndex={6}\n menuOffset={2}\n menuElement={renderOptions ? <NodeMenuOptions options={menuOptions} /> : <></>}\n />\n );\n});\n\nexport default StudentActions;\n"],"names":["renderSettings","StudentActions","memo","props","nodeData","imageHue","blockType","onNodeAttempt","onNodeReattempt","onNodeReview","onNodeView","isStudent","accuracy","attemptLocation","nodeType","cardHeader","title","state","isOptional","sheetStatement","permissions","teacherMarkedAsCompleted","userAttemptId","canReview","canStart","canResume","canReset","canUnSkip","isGoalBlock","BLOCK_TYPE","sheetLocked","NODE_CARD_STATES","inClassSheet","canStartOrResume","isHiddenBasic","isSatMockTestBlock","renderOptions","animationRef","useRef","nodeBgImage","getNodeTypeBasedBgImage","nodeCardLottie","getNodeCardBasedIcon","handleOnMenuOptionClick","useCallback","optionId","handleOnNodeCardClick","handleOnMouseEnter","_a","handleOnMouseLeave","menuOptions","Eye2Icon","RedoIcon","jsx","ContextMenu","Styled.NodeCardContainer","jsxs","ArrowTooltip","Styled.NodeCardInfoWrapper","Styled.IconWrapper","LottieAnimation","Styled.StyledImportantIcon","Text","NodeCardTags","Styled.NodeCardContentWrapper","Styled.NodeCardTitle","NodeMenuOptions","Fragment"],"mappings":";;;;;;;;;;;;;;;AAmBA,MAAMA,KAAiB,EAAE,UAAU,UAAU,UAAU,GAAM,GAEvDC,KAAuDC,EAAK,CAASC,MAAA;AACnE,QAAA;AAAA,IACJ,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,eAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,YAAAC;AAAA,IACA,WAAAC;AAAA,EACE,IAAAR,GACE;AAAA,IACJ,UAAAS;AAAA,IACA,kBAAkBC;AAAA,IAClB,WAAWC;AAAA,IACX,aAAaC;AAAA,IACb,OAAAC;AAAA,IACA,OAAAC;AAAA,IACA,aAAaC;AAAA,IACb,iBAAiBC;AAAA,IACjB,aAAAC;AAAA,IACA,qBAAqBC;AAAA,IACrB,iBAAiBC;AAAA,EACf,IAAAlB,GACE;AAAA,IACJ,YAAYmB;AAAA,IACZ,WAAWC;AAAA,IACX,YAAYC;AAAA,IACZ,WAAWC;AAAA,IACX,aAAaC;AAAA,EACX,IAAAP,GAEEQ,IAActB,MAAcuB,EAAW,MACvCC,IAAcb,MAAUc,GAAiB,QACzCC,IAAenB,MAAoB,WACnCoB,IAAmBT,KAAYC,GAC/BS,IAAgBpB,MAAa,gBAC7BqB,IA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A,EAAK,WAAU,aAAY,QAAO,SAChC,UAAA;AAAA,wBAAA/C;AAAA,wBAAW;AAAA,wBAAEiB,KAAgB;AAAA,sBAAA,GAChC;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBACF;AAAA,gBAEA,gBAAAqB;AAAA,kBAACU;AAAA,kBAAA;AAAA,oBACC,UAAAjD;AAAA,oBACA,OAAAG;AAAA,oBACA,UAAAL;AAAA,oBACA,WAAAD;AAAA,kBAAA;AAAA,gBACF;AAAA,gBAEC,CAACiB,KACC,gBAAAyB,EAAAW,IAAA,EAA8B,aAAY,WAAU,UAAU,GAC7D,UAAA,gBAAAX;AAAA,kBAACY;AAAAA,kBAAA;AAAA,oBACC,WAAU;AAAA,oBACV,QAAO;AAAA,oBACP,UAAUnC,IAAc,MAAM;AAAA,oBAE7B,UAAAd;AAAA,kBAAA;AAAA,gBAAA,GAEL;AAAA,cAAA;AAAA,YAAA;AAAA,UAEJ;AAAA,QAAA;AAAA,MACF;AAAA,MAEF,WAAS;AAAA,MACT,WAAU;AAAA,MACV,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,aAAaoB,IAAgB,gBAAAiB,EAACa,MAAgB,SAAShB,EAAA,CAAa,IAAO,gBAAAG,EAAAc,GAAA,EAAA;AAAA,IAAA;AAAA,EAAA;AAGjF,CAAC;"}
package/dist/index.d.ts CHANGED
@@ -2876,7 +2876,7 @@ export declare const InfoIcon: FC<SVGProps<SVGSVGElement>>;
2876
2876
  declare interface INodeCardCallbacks {
2877
2877
  onNodeAttempt?: (nodeData: INodeDataProps, milestoneId?: string, homeworkId?: string) => void;
2878
2878
  onNodeView?: (nodeData: INodeDataProps, milestoneId?: string) => void;
2879
- onNodeReview?: (nodeData: INodeDataProps, milestoneId?: string, homeworkId?: string) => void;
2879
+ onNodeReview?: (nodeData: INodeDataProps, milestoneId?: string, homeworkId?: string, isSatMockTestBlock?: boolean) => void;
2880
2880
  onNodeReattempt?: (nodeData: INodeDataProps, milestoneId?: string) => void;
2881
2881
  onNodeAssignAsHomework?: (nodeData: INodeDataProps, milestoneId?: string) => void;
2882
2882
  onNodeMarkAsDone?: (nodeData: INodeDataProps) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuemath/leap",
3
- "version": "3.4.0",
3
+ "version": "3.4.1-as1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"