@cuemath/leap 3.0.12-ays7 → 3.0.12-ays8

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,24 +1,24 @@
1
- import { jsxs as u, jsx as t, Fragment as x } from "react/jsx-runtime";
2
- import { memo as L, useCallback as l, useEffect as X } from "react";
3
- import { IMAGES as D } from "../../../../assets/images/images.js";
4
- import j from "../../../ui/arrow-tooltip/arrow-tooltip.js";
1
+ import { jsxs as u, jsx as e, Fragment as X } from "react/jsx-runtime";
2
+ import { memo as D, useCallback as l, useEffect as j } from "react";
3
+ import { IMAGES as G } from "../../../../assets/images/images.js";
4
+ import R from "../../../ui/arrow-tooltip/arrow-tooltip.js";
5
5
  import S from "../../../ui/buttons/button/button.js";
6
6
  import T from "../../../ui/layout/flex-view.js";
7
- import G from "../../../ui/loader/app-loader/app-loader.js";
7
+ import W from "../../../ui/loader/app-loader/app-loader.js";
8
8
  import _ from "../../../ui/separator/separator.js";
9
9
  import N from "../../../ui/text/text.js";
10
10
  import { MILESTONE_WIDGET_MIN_HEIGHT as v } from "../../constants.js";
11
- import { useGetTestHelpData as R } from "../../milestone-list-container/api/get-tests-list.js";
12
- import { TESTS_CREATION_ANALYTICS_EVENTS as W } from "../tests-creation/tests-creation-analytics-events.js";
13
- import F from "./test-list-view.js";
14
- const oe = L((c) => {
11
+ import { useGetTestHelpData as F } from "../../milestone-list-container/api/get-tests-list.js";
12
+ import { TESTS_CREATION_ANALYTICS_EVENTS as U } from "../tests-creation/tests-creation-analytics-events.js";
13
+ import V from "./test-list-view.js";
14
+ const ne = D((c) => {
15
15
  const {
16
16
  isChaptersAvailable: g,
17
17
  isDraftMilestone: E,
18
18
  isMilestoneActive: d,
19
19
  userType: b,
20
20
  studentId: m,
21
- userMilestoneId: e,
21
+ userMilestoneId: t,
22
22
  canUpdatePlan: I
23
23
  } = c, {
24
24
  onCreateMilestoneTest: o,
@@ -33,47 +33,47 @@ const oe = L((c) => {
33
33
  isProcessed: f,
34
34
  isStale: w,
35
35
  isProcessing: C
36
- } = R(), y = !I || !g || !d || d && E, M = d && !g ? "Chapters need to be assigned" : E ? "Allowed after plan is published" : "Plan is completed", h = l(() => {
37
- A(e, void 0, {
36
+ } = F(), y = !I || !g || !d || d && E, M = d && !g ? "Chapters need to be assigned" : E ? "Allowed after plan is published" : "Plan is completed", h = l(() => {
37
+ A(t, void 0, {
38
38
  studentId: m
39
39
  });
40
- }, [A, m, e]);
41
- X(() => {
40
+ }, [A, m, t]);
41
+ j(() => {
42
42
  !C && (!f && !p || w) && h();
43
43
  }, [h, f, C, p, w]);
44
44
  const $ = l(() => {
45
45
  if (typeof o == "function") {
46
- o == null || o(e, ((r == null ? void 0 : r.length) || 0) + 1);
46
+ o == null || o(t, ((r == null ? void 0 : r.length) || 0) + 1);
47
47
  return;
48
48
  }
49
49
  throw new Error("No callback provided. If provided it must be a function");
50
- }, [o, e, r]), O = l(
50
+ }, [o, t, r]), O = l(
51
51
  (a) => {
52
52
  if (typeof i == "function") {
53
- i == null || i(a, e);
53
+ i == null || i(a, t);
54
54
  return;
55
55
  }
56
56
  throw new Error("No callback provided. If provided it must be a function");
57
57
  },
58
- [i, e]
58
+ [i, t]
59
59
  ), H = l(
60
- (a) => {
60
+ (a, x, L) => {
61
61
  if (typeof n == "function") {
62
- n == null || n(a, e);
62
+ n == null || n(a, x, L);
63
63
  return;
64
64
  }
65
65
  throw new Error("No callback provided. If provided it must be a function");
66
66
  },
67
- [n, e]
67
+ [n]
68
68
  ), P = l(
69
69
  (a) => {
70
70
  if (typeof s == "function") {
71
- s == null || s(a, e);
71
+ s == null || s(a, t);
72
72
  return;
73
73
  }
74
74
  throw new Error("No callback provided. If provided it must be a function");
75
75
  },
76
- [s, e]
76
+ [s, t]
77
77
  );
78
78
  return p ? /* @__PURE__ */ u(
79
79
  T,
@@ -84,8 +84,8 @@ const oe = L((c) => {
84
84
  $height: "100%",
85
85
  $background: "WHITE",
86
86
  children: [
87
- /* @__PURE__ */ t(N, { $renderAs: "h6", children: "Oops! Something went wrong. Please try again later." }),
88
- /* @__PURE__ */ t(
87
+ /* @__PURE__ */ e(N, { $renderAs: "h6", children: "Oops! Something went wrong. Please try again later." }),
88
+ /* @__PURE__ */ e(
89
89
  S,
90
90
  {
91
91
  widthX: 14,
@@ -98,15 +98,15 @@ const oe = L((c) => {
98
98
  )
99
99
  ]
100
100
  }
101
- ) : f ? r != null && r.length ? /* @__PURE__ */ t(
102
- F,
101
+ ) : f ? r != null && r.length ? /* @__PURE__ */ e(
102
+ V,
103
103
  {
104
104
  ...c,
105
105
  onNodeAttempt: H,
106
106
  onNodeView: O,
107
107
  onNodeReview: P,
108
108
  onNodeAssignAsHomework: k,
109
- milestoneId: e,
109
+ milestoneId: t,
110
110
  sheets: r,
111
111
  userType: b,
112
112
  studentId: m,
@@ -123,17 +123,17 @@ const oe = L((c) => {
123
123
  $background: "WHITE",
124
124
  $height: v,
125
125
  children: [
126
- /* @__PURE__ */ t("img", { src: D.EMPTY_MIX_TESTS, alt: "empty_mix_tests" }),
127
- /* @__PURE__ */ t(_, { heightX: 2 }),
128
- b === "TEACHER" ? /* @__PURE__ */ u(x, { children: [
129
- /* @__PURE__ */ t(
130
- j,
126
+ /* @__PURE__ */ e("img", { src: G.EMPTY_MIX_TESTS, alt: "empty_mix_tests" }),
127
+ /* @__PURE__ */ e(_, { heightX: 2 }),
128
+ b === "TEACHER" ? /* @__PURE__ */ u(X, { children: [
129
+ /* @__PURE__ */ e(
130
+ R,
131
131
  {
132
132
  renderAs: "primary",
133
133
  position: "bottom",
134
134
  hidden: !y,
135
135
  tooltipItem: M,
136
- children: /* @__PURE__ */ t(
136
+ children: /* @__PURE__ */ e(
137
137
  S,
138
138
  {
139
139
  widthX: 10,
@@ -143,30 +143,30 @@ const oe = L((c) => {
143
143
  label: "Create a Test",
144
144
  onClick: $,
145
145
  disabled: y,
146
- analyticsLabel: W.CUSTOM_TEST_CREATION_STARTED,
146
+ analyticsLabel: U.CUSTOM_TEST_CREATION_STARTED,
147
147
  analyticsProps: {
148
- milestone_id: e
148
+ milestone_id: t
149
149
  }
150
150
  }
151
151
  )
152
152
  }
153
153
  ),
154
- /* @__PURE__ */ t(_, { heightX: 2 })
155
- ] }) : /* @__PURE__ */ t(N, { $renderAs: "ab2-bold", $color: "BLACK_T_87", children: "Wait for the teacher to create a test" })
154
+ /* @__PURE__ */ e(_, { heightX: 2 })
155
+ ] }) : /* @__PURE__ */ e(N, { $renderAs: "ab2-bold", $color: "BLACK_T_87", children: "Wait for the teacher to create a test" })
156
156
  ]
157
157
  }
158
- ) : /* @__PURE__ */ t(
158
+ ) : /* @__PURE__ */ e(
159
159
  T,
160
160
  {
161
161
  $height: v,
162
162
  $alignItems: "center",
163
163
  $justifyContent: "center",
164
164
  $background: "WHITE",
165
- children: /* @__PURE__ */ t(G, { height: "100%" })
165
+ children: /* @__PURE__ */ e(W, { height: "100%" })
166
166
  }
167
167
  );
168
168
  });
169
169
  export {
170
- oe as default
170
+ ne as default
171
171
  };
172
172
  //# sourceMappingURL=test-list-container.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"test-list-container.js","sources":["../../../../../src/features/milestone/milestone-tests/test-list-v2/test-list-container.tsx"],"sourcesContent":["import type { INodeDataProps } from '../../../chapters-v2/comps/node-card/node-card-types';\nimport type { ITestsListProps } from './types';\n\nimport { memo, useCallback, useEffect, type FC } from 'react';\n\nimport { IMAGES } from '../../../../assets/images/images';\nimport ArrowTooltip from '../../../ui/arrow-tooltip/arrow-tooltip';\nimport Button from '../../../ui/buttons/button/button';\nimport FlexView from '../../../ui/layout/flex-view';\nimport AppLoader from '../../../ui/loader/app-loader/app-loader';\nimport Separator from '../../../ui/separator/separator';\nimport Text from '../../../ui/text/text';\nimport { MILESTONE_WIDGET_MIN_HEIGHT } from '../../constants';\nimport { useGetTestHelpData } from '../../milestone-list-container/api/get-tests-list';\nimport { TESTS_CREATION_ANALYTICS_EVENTS } from '../tests-creation/tests-creation-analytics-events';\nimport TestSheetsList from './test-list-view';\n\nconst MilestoneTestsList: FC<ITestsListProps> = memo(props => {\n const {\n isChaptersAvailable,\n isDraftMilestone,\n isMilestoneActive,\n userType,\n studentId,\n userMilestoneId,\n canUpdatePlan,\n } = props;\n const {\n onCreateMilestoneTest,\n onTestPreview,\n onTestStart,\n onTestReview,\n onNodeAssignAsHomework,\n } = props;\n\n const {\n get: getTestHelpData,\n data,\n isProcessingFailed,\n isProcessed,\n isStale,\n isProcessing,\n } = useGetTestHelpData();\n\n const isTestSheetCreationDisabled =\n !canUpdatePlan ||\n !isChaptersAvailable ||\n !isMilestoneActive ||\n (isMilestoneActive && isDraftMilestone);\n const testCreationCtaTooltipText =\n isMilestoneActive && !isChaptersAvailable\n ? 'Chapters need to be assigned'\n : isDraftMilestone\n ? 'Allowed after plan is published'\n : 'Plan is completed';\n\n const handleOnTryAgain = useCallback(() => {\n getTestHelpData(userMilestoneId, undefined, {\n studentId,\n });\n }, [getTestHelpData, studentId, userMilestoneId]);\n\n useEffect(() => {\n if (!isProcessing && ((!isProcessed && !isProcessingFailed) || isStale)) {\n handleOnTryAgain();\n }\n }, [handleOnTryAgain, isProcessed, isProcessing, isProcessingFailed, isStale]);\n\n const handleOnCreateMilestoneTest = useCallback(() => {\n if (typeof onCreateMilestoneTest === 'function') {\n onCreateMilestoneTest?.(userMilestoneId, (data?.length || 0) + 1);\n\n return;\n }\n\n throw new Error('No callback provided. If provided it must be a function');\n }, [onCreateMilestoneTest, userMilestoneId, data]);\n\n const handleOnTestPreview = useCallback(\n (sheetData: INodeDataProps) => {\n if (typeof onTestPreview === 'function') {\n onTestPreview?.(sheetData, userMilestoneId);\n\n return;\n }\n\n throw new Error('No callback provided. If provided it must be a function');\n },\n [onTestPreview, userMilestoneId],\n );\n\n const handleOnTestStart = useCallback(\n (sheetData: INodeDataProps) => {\n if (typeof onTestStart === 'function') {\n onTestStart?.(sheetData, userMilestoneId);\n\n return;\n }\n\n throw new Error('No callback provided. If provided it must be a function');\n },\n [onTestStart, userMilestoneId],\n );\n\n const handleOnTestReview = useCallback(\n (sheetData: INodeDataProps) => {\n if (typeof onTestReview === 'function') {\n onTestReview?.(sheetData, userMilestoneId);\n\n return;\n }\n\n throw new Error('No callback provided. If provided it must be a function');\n },\n [onTestReview, userMilestoneId],\n );\n\n if (isProcessingFailed) {\n return (\n <FlexView\n $flexGapX={1.5}\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $height=\"100%\"\n $background=\"WHITE\"\n >\n <Text $renderAs=\"h6\">Oops! Something went wrong. Please try again later.</Text>\n <Button\n widthX={14}\n size=\"small\"\n shape=\"square\"\n renderAs=\"primary\"\n label=\"Try again\"\n onClick={handleOnTryAgain}\n />\n </FlexView>\n );\n }\n\n if (isProcessed) {\n if (data?.length) {\n return (\n <TestSheetsList\n {...props}\n onNodeAttempt={handleOnTestStart}\n onNodeView={handleOnTestPreview}\n onNodeReview={handleOnTestReview}\n onNodeAssignAsHomework={onNodeAssignAsHomework}\n milestoneId={userMilestoneId}\n sheets={data}\n userType={userType}\n studentId={studentId}\n onCreateNewTest={handleOnCreateMilestoneTest}\n canUpdatedPlan={canUpdatePlan}\n isMilestoneActive={isMilestoneActive}\n />\n );\n }\n\n return (\n <FlexView\n $gapX={6.75}\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $background=\"WHITE\"\n $height={MILESTONE_WIDGET_MIN_HEIGHT}\n >\n <img src={IMAGES.EMPTY_MIX_TESTS} alt=\"empty_mix_tests\" />\n <Separator heightX={2} />\n {userType === 'TEACHER' ? (\n <>\n <ArrowTooltip\n renderAs=\"primary\"\n position=\"bottom\"\n hidden={!isTestSheetCreationDisabled}\n tooltipItem={testCreationCtaTooltipText}\n >\n <Button\n widthX={10}\n renderAs=\"primary\"\n shape=\"square\"\n size=\"small\"\n label=\"Create a Test\"\n onClick={handleOnCreateMilestoneTest}\n disabled={isTestSheetCreationDisabled}\n analyticsLabel={TESTS_CREATION_ANALYTICS_EVENTS.CUSTOM_TEST_CREATION_STARTED}\n analyticsProps={{\n milestone_id: userMilestoneId,\n }}\n />\n </ArrowTooltip>\n <Separator heightX={2} />\n </>\n ) : (\n <Text $renderAs=\"ab2-bold\" $color=\"BLACK_T_87\">\n Wait for the teacher to create a test\n </Text>\n )}\n </FlexView>\n );\n }\n\n return (\n <FlexView\n $height={MILESTONE_WIDGET_MIN_HEIGHT}\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $background=\"WHITE\"\n >\n <AppLoader height=\"100%\" />\n </FlexView>\n );\n});\n\nexport default MilestoneTestsList;\n"],"names":["MilestoneTestsList","memo","props","isChaptersAvailable","isDraftMilestone","isMilestoneActive","userType","studentId","userMilestoneId","canUpdatePlan","onCreateMilestoneTest","onTestPreview","onTestStart","onTestReview","onNodeAssignAsHomework","getTestHelpData","data","isProcessingFailed","isProcessed","isStale","isProcessing","useGetTestHelpData","isTestSheetCreationDisabled","testCreationCtaTooltipText","handleOnTryAgain","useCallback","useEffect","handleOnCreateMilestoneTest","handleOnTestPreview","sheetData","handleOnTestStart","handleOnTestReview","jsxs","FlexView","jsx","Text","Button","TestSheetsList","MILESTONE_WIDGET_MIN_HEIGHT","IMAGES","Separator","Fragment","ArrowTooltip","TESTS_CREATION_ANALYTICS_EVENTS","AppLoader"],"mappings":";;;;;;;;;;;;;AAiBM,MAAAA,KAA0CC,EAAK,CAASC,MAAA;AACtD,QAAA;AAAA,IACJ,qBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,eAAAC;AAAA,EACE,IAAAP,GACE;AAAA,IACJ,uBAAAQ;AAAA,IACA,eAAAC;AAAA,IACA,aAAAC;AAAA,IACA,cAAAC;AAAA,IACA,wBAAAC;AAAA,EACE,IAAAZ,GAEE;AAAA,IACJ,KAAKa;AAAA,IACL,MAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,SAAAC;AA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AS,GAAA,EAAA,UAAA;AAAA,UAAA,gBAAAP;AAAA,YAACQ;AAAA,YAAA;AAAA,cACC,UAAS;AAAA,cACT,UAAS;AAAA,cACT,QAAQ,CAACpB;AAAA,cACT,aAAaC;AAAA,cAEb,UAAA,gBAAAW;AAAA,gBAACE;AAAA,gBAAA;AAAA,kBACC,QAAQ;AAAA,kBACR,UAAS;AAAA,kBACT,OAAM;AAAA,kBACN,MAAK;AAAA,kBACL,OAAM;AAAA,kBACN,SAAST;AAAA,kBACT,UAAUL;AAAA,kBACV,gBAAgBqB,EAAgC;AAAA,kBAChD,gBAAgB;AAAA,oBACd,cAAcnC;AAAA,kBAChB;AAAA,gBAAA;AAAA,cACF;AAAA,YAAA;AAAA,UACF;AAAA,UACA,gBAAA0B,EAACM,GAAU,EAAA,SAAS,EAAG,CAAA;AAAA,QAAA,EAAA,CACzB,IAEC,gBAAAN,EAAAC,GAAA,EAAK,WAAU,YAAW,QAAO,cAAa,UAE/C,yCAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,IAON,gBAAAD;AAAA,IAACD;AAAA,IAAA;AAAA,MACC,SAASK;AAAA,MACT,aAAY;AAAA,MACZ,iBAAgB;AAAA,MAChB,aAAY;AAAA,MAEZ,UAAA,gBAAAJ,EAACU,GAAU,EAAA,QAAO,OAAO,CAAA;AAAA,IAAA;AAAA,EAAA;AAG/B,CAAC;"}
1
+ {"version":3,"file":"test-list-container.js","sources":["../../../../../src/features/milestone/milestone-tests/test-list-v2/test-list-container.tsx"],"sourcesContent":["import type { INodeDataProps } from '../../../chapters-v2/comps/node-card/node-card-types';\nimport type { ITestsListProps } from './types';\n\nimport { memo, useCallback, useEffect, type FC } from 'react';\n\nimport { IMAGES } from '../../../../assets/images/images';\nimport ArrowTooltip from '../../../ui/arrow-tooltip/arrow-tooltip';\nimport Button from '../../../ui/buttons/button/button';\nimport FlexView from '../../../ui/layout/flex-view';\nimport AppLoader from '../../../ui/loader/app-loader/app-loader';\nimport Separator from '../../../ui/separator/separator';\nimport Text from '../../../ui/text/text';\nimport { MILESTONE_WIDGET_MIN_HEIGHT } from '../../constants';\nimport { useGetTestHelpData } from '../../milestone-list-container/api/get-tests-list';\nimport { TESTS_CREATION_ANALYTICS_EVENTS } from '../tests-creation/tests-creation-analytics-events';\nimport TestSheetsList from './test-list-view';\n\nconst MilestoneTestsList: FC<ITestsListProps> = memo(props => {\n const {\n isChaptersAvailable,\n isDraftMilestone,\n isMilestoneActive,\n userType,\n studentId,\n userMilestoneId,\n canUpdatePlan,\n } = props;\n const {\n onCreateMilestoneTest,\n onTestPreview,\n onTestStart,\n onTestReview,\n onNodeAssignAsHomework,\n } = props;\n\n const {\n get: getTestHelpData,\n data,\n isProcessingFailed,\n isProcessed,\n isStale,\n isProcessing,\n } = useGetTestHelpData();\n\n const isTestSheetCreationDisabled =\n !canUpdatePlan ||\n !isChaptersAvailable ||\n !isMilestoneActive ||\n (isMilestoneActive && isDraftMilestone);\n const testCreationCtaTooltipText =\n isMilestoneActive && !isChaptersAvailable\n ? 'Chapters need to be assigned'\n : isDraftMilestone\n ? 'Allowed after plan is published'\n : 'Plan is completed';\n\n const handleOnTryAgain = useCallback(() => {\n getTestHelpData(userMilestoneId, undefined, {\n studentId,\n });\n }, [getTestHelpData, studentId, userMilestoneId]);\n\n useEffect(() => {\n if (!isProcessing && ((!isProcessed && !isProcessingFailed) || isStale)) {\n handleOnTryAgain();\n }\n }, [handleOnTryAgain, isProcessed, isProcessing, isProcessingFailed, isStale]);\n\n const handleOnCreateMilestoneTest = useCallback(() => {\n if (typeof onCreateMilestoneTest === 'function') {\n onCreateMilestoneTest?.(userMilestoneId, (data?.length || 0) + 1);\n\n return;\n }\n\n throw new Error('No callback provided. If provided it must be a function');\n }, [onCreateMilestoneTest, userMilestoneId, data]);\n\n const handleOnTestPreview = useCallback(\n (sheetData: INodeDataProps) => {\n if (typeof onTestPreview === 'function') {\n onTestPreview?.(sheetData, userMilestoneId);\n\n return;\n }\n\n throw new Error('No callback provided. If provided it must be a function');\n },\n [onTestPreview, userMilestoneId],\n );\n\n const handleOnTestStart = useCallback(\n (sheetData: INodeDataProps, milestoneId?: string, hwId?: string) => {\n if (typeof onTestStart === 'function') {\n onTestStart?.(sheetData, milestoneId, hwId);\n\n return;\n }\n\n throw new Error('No callback provided. If provided it must be a function');\n },\n [onTestStart],\n );\n\n const handleOnTestReview = useCallback(\n (sheetData: INodeDataProps) => {\n if (typeof onTestReview === 'function') {\n onTestReview?.(sheetData, userMilestoneId);\n\n return;\n }\n\n throw new Error('No callback provided. If provided it must be a function');\n },\n [onTestReview, userMilestoneId],\n );\n\n if (isProcessingFailed) {\n return (\n <FlexView\n $flexGapX={1.5}\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $height=\"100%\"\n $background=\"WHITE\"\n >\n <Text $renderAs=\"h6\">Oops! Something went wrong. Please try again later.</Text>\n <Button\n widthX={14}\n size=\"small\"\n shape=\"square\"\n renderAs=\"primary\"\n label=\"Try again\"\n onClick={handleOnTryAgain}\n />\n </FlexView>\n );\n }\n\n if (isProcessed) {\n if (data?.length) {\n return (\n <TestSheetsList\n {...props}\n onNodeAttempt={handleOnTestStart}\n onNodeView={handleOnTestPreview}\n onNodeReview={handleOnTestReview}\n onNodeAssignAsHomework={onNodeAssignAsHomework}\n milestoneId={userMilestoneId}\n sheets={data}\n userType={userType}\n studentId={studentId}\n onCreateNewTest={handleOnCreateMilestoneTest}\n canUpdatedPlan={canUpdatePlan}\n isMilestoneActive={isMilestoneActive}\n />\n );\n }\n\n return (\n <FlexView\n $gapX={6.75}\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $background=\"WHITE\"\n $height={MILESTONE_WIDGET_MIN_HEIGHT}\n >\n <img src={IMAGES.EMPTY_MIX_TESTS} alt=\"empty_mix_tests\" />\n <Separator heightX={2} />\n {userType === 'TEACHER' ? (\n <>\n <ArrowTooltip\n renderAs=\"primary\"\n position=\"bottom\"\n hidden={!isTestSheetCreationDisabled}\n tooltipItem={testCreationCtaTooltipText}\n >\n <Button\n widthX={10}\n renderAs=\"primary\"\n shape=\"square\"\n size=\"small\"\n label=\"Create a Test\"\n onClick={handleOnCreateMilestoneTest}\n disabled={isTestSheetCreationDisabled}\n analyticsLabel={TESTS_CREATION_ANALYTICS_EVENTS.CUSTOM_TEST_CREATION_STARTED}\n analyticsProps={{\n milestone_id: userMilestoneId,\n }}\n />\n </ArrowTooltip>\n <Separator heightX={2} />\n </>\n ) : (\n <Text $renderAs=\"ab2-bold\" $color=\"BLACK_T_87\">\n Wait for the teacher to create a test\n </Text>\n )}\n </FlexView>\n );\n }\n\n return (\n <FlexView\n $height={MILESTONE_WIDGET_MIN_HEIGHT}\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $background=\"WHITE\"\n >\n <AppLoader height=\"100%\" />\n </FlexView>\n );\n});\n\nexport default MilestoneTestsList;\n"],"names":["MilestoneTestsList","memo","props","isChaptersAvailable","isDraftMilestone","isMilestoneActive","userType","studentId","userMilestoneId","canUpdatePlan","onCreateMilestoneTest","onTestPreview","onTestStart","onTestReview","onNodeAssignAsHomework","getTestHelpData","data","isProcessingFailed","isProcessed","isStale","isProcessing","useGetTestHelpData","isTestSheetCreationDisabled","testCreationCtaTooltipText","handleOnTryAgain","useCallback","useEffect","handleOnCreateMilestoneTest","handleOnTestPreview","sheetData","handleOnTestStart","milestoneId","hwId","handleOnTestReview","jsxs","FlexView","jsx","Text","Button","TestSheetsList","MILESTONE_WIDGET_MIN_HEIGHT","IMAGES","Separator","Fragment","ArrowTooltip","TESTS_CREATION_ANALYTICS_EVENTS","AppLoader"],"mappings":";;;;;;;;;;;;;AAiBM,MAAAA,KAA0CC,EAAK,CAASC,MAAA;AACtD,QAAA;AAAA,IACJ,qBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,eAAAC;AAAA,EACE,IAAAP,GACE;AAAA,IACJ,uBAAA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,aAAY;AAAA,MACZ,SAASK;AAAA,MAET,UAAA;AAAA,QAAA,gBAAAJ,EAAC,OAAI,EAAA,KAAKK,EAAO,iBAAiB,KAAI,mBAAkB;AAAA,QACxD,gBAAAL,EAACM,GAAU,EAAA,SAAS,EAAG,CAAA;AAAA,QACtBpC,MAAa,YAEV,gBAAA4B,EAAAS,GAAA,EAAA,UAAA;AAAA,UAAA,gBAAAP;AAAA,YAACQ;AAAA,YAAA;AAAA,cACC,UAAS;AAAA,cACT,UAAS;AAAA,cACT,QAAQ,CAACtB;AAAA,cACT,aAAaC;AAAA,cAEb,UAAA,gBAAAa;AAAA,gBAACE;AAAA,gBAAA;AAAA,kBACC,QAAQ;AAAA,kBACR,UAAS;AAAA,kBACT,OAAM;AAAA,kBACN,MAAK;AAAA,kBACL,OAAM;AAAA,kBACN,SAASX;AAAA,kBACT,UAAUL;AAAA,kBACV,gBAAgBuB,EAAgC;AAAA,kBAChD,gBAAgB;AAAA,oBACd,cAAcrC;AAAA,kBAChB;AAAA,gBAAA;AAAA,cACF;AAAA,YAAA;AAAA,UACF;AAAA,UACA,gBAAA4B,EAACM,GAAU,EAAA,SAAS,EAAG,CAAA;AAAA,QAAA,EAAA,CACzB,IAEC,gBAAAN,EAAAC,GAAA,EAAK,WAAU,YAAW,QAAO,cAAa,UAE/C,yCAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,IAON,gBAAAD;AAAA,IAACD;AAAA,IAAA;AAAA,MACC,SAASK;AAAA,MACT,aAAY;AAAA,MACZ,iBAAgB;AAAA,MAChB,aAAY;AAAA,MAEZ,UAAA,gBAAAJ,EAACU,GAAU,EAAA,QAAO,OAAO,CAAA;AAAA,IAAA;AAAA,EAAA;AAG/B,CAAC;"}
package/dist/index.d.ts CHANGED
@@ -3058,7 +3058,7 @@ declare interface ITestsListProps {
3058
3058
  onNodeReattempt?: (sheetData: INodeDataProps, milestoneId?: string) => void;
3059
3059
  onNodeAssignAsHomework?: (sheetData: INodeDataProps, milestoneId?: string) => void;
3060
3060
  onTestPreview?: (sheetData: INodeDataProps, milestoneId: string) => void;
3061
- onTestStart?: (sheetData: INodeDataProps, milestoneId: string) => void;
3061
+ onTestStart?: (sheetData: INodeDataProps, milestoneId?: string, homeworkId?: string) => void;
3062
3062
  onTestReview?: (sheetData: INodeDataProps, milestoneId: string) => void;
3063
3063
  }
3064
3064
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuemath/leap",
3
- "version": "3.0.12-ays7",
3
+ "version": "3.0.12-ays8",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"