@cuemath/leap 2.9.6-as4 → 2.9.6-as6

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.
Files changed (40) hide show
  1. package/dist/features/chapters-v2/chapter-details/block-sections/block-section-view.js +1 -1
  2. package/dist/features/chapters-v2/chapter-details/block-sections/block-section-view.js.map +1 -1
  3. package/dist/features/chapters-v2/chapter-details/block-sections/block-sections.js +44 -43
  4. package/dist/features/chapters-v2/chapter-details/block-sections/block-sections.js.map +1 -1
  5. package/dist/features/chapters-v2/chapter-details/chapter-banner/chapter-banner.js +31 -30
  6. package/dist/features/chapters-v2/chapter-details/chapter-banner/chapter-banner.js.map +1 -1
  7. package/dist/features/chapters-v2/chapter-details/chapter-details.js +82 -55
  8. package/dist/features/chapters-v2/chapter-details/chapter-details.js.map +1 -1
  9. package/dist/features/chapters-v2/comps/node-card/node-card-styled.js +14 -13
  10. package/dist/features/chapters-v2/comps/node-card/node-card-styled.js.map +1 -1
  11. package/dist/features/chapters-v2/comps/node-card/student-actions/student-actions.js +2 -2
  12. package/dist/features/chapters-v2/comps/node-card/student-actions/student-actions.js.map +1 -1
  13. package/dist/features/chapters-v2/comps/node-card/teacher-actions/teacher-actions.js +24 -24
  14. package/dist/features/chapters-v2/comps/node-card/teacher-actions/teacher-actions.js.map +1 -1
  15. package/dist/features/chapters-v2/utils/index.js +9 -11
  16. package/dist/features/chapters-v2/utils/index.js.map +1 -1
  17. package/dist/features/chapters-v2/utils/node-card-utils.js +8 -9
  18. package/dist/features/chapters-v2/utils/node-card-utils.js.map +1 -1
  19. package/dist/features/homework/hw-card-list/hw-card-list.js +38 -39
  20. package/dist/features/homework/hw-card-list/hw-card-list.js.map +1 -1
  21. package/dist/features/journey/hooks/use-chapter-journey.js +194 -0
  22. package/dist/features/journey/hooks/use-chapter-journey.js.map +1 -0
  23. package/dist/features/journey/journey-id/journey-id-student.js +2 -3
  24. package/dist/features/journey/journey-id/journey-id-student.js.map +1 -1
  25. package/dist/features/journey/journey-id/journey-id-teacher.js +5 -0
  26. package/dist/features/journey/journey-id/journey-id-teacher.js.map +1 -0
  27. package/dist/features/journey/use-journey/journey-context-provider.js +48 -48
  28. package/dist/features/journey/use-journey/journey-context-provider.js.map +1 -1
  29. package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-info.js +12 -11
  30. package/dist/features/milestone/milestone-list-container/milestone-list/milestone-widget/milestone-info.js.map +1 -1
  31. package/dist/features/milestone/milestone-list-container/milestone-list-container.js +75 -81
  32. package/dist/features/milestone/milestone-list-container/milestone-list-container.js.map +1 -1
  33. package/dist/features/milestone/milestone-tests/test-list-v2/test-list-view.js +1 -1
  34. package/dist/features/milestone/milestone-tests/test-list-v2/test-list-view.js.map +1 -1
  35. package/dist/features/sheet-v2/resource-list/resource-list.js +1 -1
  36. package/dist/features/sheet-v2/resource-list/resource-list.js.map +1 -1
  37. package/dist/index.d.ts +29 -5
  38. package/dist/index.js +140 -137
  39. package/dist/index.js.map +1 -1
  40. package/package.json +1 -1
@@ -3,13 +3,13 @@ import { useRef as Y, useState as H, useEffect as f, useCallback as c } from "re
3
3
  import q from "../../../assets/line-icons/icons/chevron-left.js";
4
4
  import z from "../../../assets/line-icons/icons/chevron-right.js";
5
5
  import { useJourney as Z } from "../../journey/use-journey/use-journey.js";
6
- import a from "../../ui/layout/flex-view.js";
7
- import C from "../../ui/text/text.js";
6
+ import u from "../../ui/layout/flex-view.js";
7
+ import v from "../../ui/text/text.js";
8
8
  import J from "../homework-card.js";
9
9
  import { useGetHomeworks as D } from "./api/get-homeworks.js";
10
10
  import { ContentWrapper as ee, ScrollButton as w, ScrollContainer as re, QueueWrapper as oe, QueueText as te } from "./hw-card-list-styled.js";
11
11
  const ne = ({
12
- userType: $ = "STUDENT",
12
+ userType: a = "STUDENT",
13
13
  studentId: s,
14
14
  stream: d,
15
15
  onTestStart: x,
@@ -21,31 +21,31 @@ const ne = ({
21
21
  onNodeUnassign: S,
22
22
  homeworkRef: W,
23
23
  individualHomeworkRef: y,
24
- startHomePageJourney: m,
25
- canStartJourney: k
24
+ startHomePageJourney: $,
25
+ canStartJourney: C
26
26
  }) => {
27
- const n = Y(null), [K, _] = H(!1), [N, L] = H(!1), {
28
- get: b,
27
+ const n = Y(null), [K, k] = H(!1), [N, _] = H(!1), {
28
+ get: L,
29
29
  data: e,
30
30
  isProcessingFailed: j,
31
- isProcessing: p,
32
- isStale: A
33
- } = D(s), { isJourneyActive: g } = Z();
31
+ isProcessing: m,
32
+ isStale: b
33
+ } = D(s), { isJourneyActive: A } = Z();
34
34
  f(() => {
35
- e != null && e.length && m && !g && k && m({ hwDetails: e, studentId: s, stream: d, userType: $ });
35
+ e != null && e.length && $ && !A && C && $({ hwDetails: e, studentId: s, stream: d, userType: a });
36
36
  }, [
37
- k,
37
+ C,
38
38
  e,
39
- g,
40
- m,
39
+ A,
40
+ $,
41
41
  d,
42
42
  s,
43
- $
43
+ a
44
44
  ]);
45
45
  const r = c(() => {
46
46
  if (n.current) {
47
- const { scrollLeft: o, scrollWidth: i, clientWidth: u } = n.current;
48
- o > 1 && _(!0), o < i - u - 1 && L(!0);
47
+ const { scrollLeft: o, scrollWidth: i, clientWidth: p } = n.current;
48
+ o > 1 && k(!0), o < i - p - 1 && _(!0);
49
49
  }
50
50
  }, []), G = c(() => {
51
51
  n.current && (n.current.scrollBy({ left: -200, behavior: "smooth" }), r());
@@ -54,7 +54,7 @@ const ne = ({
54
54
  }, [r]), Q = c(() => {
55
55
  n.current && r();
56
56
  }, [r]), X = c(() => {
57
- _(!1), L(!1);
57
+ k(!1), _(!1);
58
58
  }, []);
59
59
  f(() => {
60
60
  const o = n.current;
@@ -66,23 +66,23 @@ const ne = ({
66
66
  r();
67
67
  }, [e, r]);
68
68
  const h = c(() => {
69
- b(s, void 0, { stream: d });
70
- }, [b, d, s]);
69
+ L(s, void 0, { stream: d });
70
+ }, [L, d, s]);
71
71
  f(() => {
72
- !p && A && h();
73
- }, [h, p, A]), f(() => {
72
+ !m && b && h();
73
+ }, [h, m, b]), f(() => {
74
74
  h();
75
75
  }, [h]);
76
76
  const M = ((e == null ? void 0 : e.filter((o) => o.state === "WAIT_FOR_REVIEW")) || []).length;
77
- return e && e.length === 0 ? /* @__PURE__ */ l(a, { $flexRowGapX: 1, children: [
78
- /* @__PURE__ */ l(C, { $renderAs: "ac4-black", $color: "BLACK_T_60", children: [
77
+ return e && e.length === 0 ? /* @__PURE__ */ l(u, { $flexRowGapX: 1, children: [
78
+ /* @__PURE__ */ l(v, { $renderAs: "ac4-black", $color: "BLACK_T_60", children: [
79
79
  "Homework (",
80
80
  e == null ? void 0 : e.length,
81
81
  ")"
82
82
  ] }),
83
- /* @__PURE__ */ t(C, { $renderAs: "ab2", $color: "BLACK_T_60", children: "No Homework assigned yet" })
84
- ] }) : j ? null : /* @__PURE__ */ l(ee, { ref: W, $flexRowGapX: 1, $disablePointerEvents: p, children: [
85
- !g && /* @__PURE__ */ l(C, { $renderAs: "ac4-black", $color: "BLACK_T_60", children: [
83
+ /* @__PURE__ */ t(v, { $renderAs: "ab2", $color: "BLACK_T_60", children: "No Homework assigned yet" })
84
+ ] }) : j ? null : /* @__PURE__ */ l(ee, { ref: W, $flexRowGapX: 1, $disablePointerEvents: m, children: [
85
+ /* @__PURE__ */ l(v, { $renderAs: "ac4-black", $color: "BLACK_T_60", children: [
86
86
  "Homework (",
87
87
  M,
88
88
  "/",
@@ -90,7 +90,7 @@ const ne = ({
90
90
  ")"
91
91
  ] }),
92
92
  /* @__PURE__ */ l(
93
- a,
93
+ u,
94
94
  {
95
95
  $position: "relative",
96
96
  onMouseEnter: Q,
@@ -111,16 +111,16 @@ const ne = ({
111
111
  children: /* @__PURE__ */ t(q, { width: 24, height: 24 })
112
112
  }
113
113
  ),
114
- /* @__PURE__ */ t(re, { ref: n, children: /* @__PURE__ */ t(a, { $flexDirection: "row", $flexGapX: 1, children: e == null ? void 0 : e.map((o, i) => {
114
+ /* @__PURE__ */ t(re, { ref: n, children: /* @__PURE__ */ t(u, { $flexDirection: "row", $flexGapX: 1, children: e == null ? void 0 : e.map((o, i) => {
115
115
  const {
116
- node_id: u,
116
+ node_id: p,
117
117
  worksheet_id: O,
118
118
  node_type: V,
119
119
  title: P,
120
120
  subtext: U
121
- } = o, v = V === "DYNAMIC";
121
+ } = o, g = V === "DYNAMIC";
122
122
  return /* @__PURE__ */ l(
123
- a,
123
+ u,
124
124
  {
125
125
  ref: i === 0 ? y : void 0,
126
126
  $flexDirection: "row",
@@ -140,22 +140,21 @@ const ne = ({
140
140
  J,
141
141
  {
142
142
  isInQueue: e.length > 10 && i > 9,
143
- userType: $,
143
+ userType: a,
144
144
  header: P,
145
145
  subHeader: U || "",
146
146
  nodeData: o,
147
147
  renderAs: "homework",
148
- onNodeAttempt: v ? x : R,
148
+ onNodeAttempt: g ? x : R,
149
149
  shouldOpenOnRight: !0,
150
- onNodeView: v ? E : T,
151
- onNodeReview: v ? B : I,
150
+ onNodeView: g ? E : T,
151
+ onNodeReview: g ? B : I,
152
152
  onNodeUnassign: S
153
- },
154
- `${O}_${u}_${i}`
153
+ }
155
154
  )
156
155
  ]
157
156
  },
158
- u
157
+ `${O}_${p}_${i}`
159
158
  );
160
159
  }) }) }),
161
160
  /* @__PURE__ */ t(
@@ -1 +1 @@
1
- {"version":3,"file":"hw-card-list.js","sources":["../../../../src/features/homework/hw-card-list/hw-card-list.tsx"],"sourcesContent":["import type {\n INodeCardCallbacks,\n INodeDataProps,\n} from '../../chapters-v2/comps/node-card/node-card-types';\nimport type { IHomepageStartJourneyProps } from '../../journey/types/homepage-journey-types';\nimport type { TUserTypes } from '../../ui/types';\n\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\n\nimport ChevronLeftIcon from '../../../assets/line-icons/icons/chevron-left';\nimport ChevronRightIcon from '../../../assets/line-icons/icons/chevron-right';\nimport { useJourney } from '../../journey/use-journey/use-journey';\nimport FlexView from '../../ui/layout/flex-view';\nimport Text from '../../ui/text/text';\nimport HomeworkCard from '../homework-card';\nimport { useGetHomeworks } from './api/get-homeworks';\nimport * as Styled from './hw-card-list-styled';\n\ninterface HWCardListProps extends INodeCardCallbacks {\n userType: TUserTypes;\n studentId: string;\n stream: string;\n onTestPreview?: (sheetData: INodeDataProps, milestoneId?: string) => void;\n onTestStart?: (sheetData: INodeDataProps) => void;\n onTestReview?: (sheetData: INodeDataProps, milestoneId?: string) => void;\n homeworkRef?: React.RefObject<HTMLDivElement>;\n individualHomeworkRef?: React.RefObject<HTMLDivElement>;\n startHomePageJourney?: ({\n hwDetails,\n studentId,\n stream,\n userType,\n }: IHomepageStartJourneyProps) => void;\n canStartJourney?: boolean;\n}\n\nconst HWCardList: React.FC<HWCardListProps> = ({\n userType = 'STUDENT',\n studentId,\n stream,\n onTestStart,\n onNodeAttempt,\n onTestPreview,\n onNodeView,\n onTestReview,\n onNodeReview,\n onNodeUnassign,\n homeworkRef,\n individualHomeworkRef,\n startHomePageJourney,\n canStartJourney,\n}) => {\n const scrollRef = useRef<HTMLDivElement>(null);\n const [isLeftHovered, setIsLeftHovered] = useState(false);\n const [isRightHovered, setIsRightHovered] = useState(false);\n const {\n get: getHomeworks,\n data: hwDetails,\n isProcessingFailed,\n isProcessing,\n isStale,\n } = useGetHomeworks(studentId);\n const { isJourneyActive } = useJourney();\n\n useEffect(() => {\n if (hwDetails?.length && startHomePageJourney && !isJourneyActive && canStartJourney) {\n startHomePageJourney({ hwDetails, studentId, stream, userType });\n }\n }, [\n canStartJourney,\n hwDetails,\n isJourneyActive,\n startHomePageJourney,\n stream,\n studentId,\n userType,\n ]);\n\n const updatedCanScroll = useCallback(() => {\n if (scrollRef.current) {\n const { scrollLeft, scrollWidth, clientWidth } = scrollRef.current;\n\n if (scrollLeft > 1) {\n setIsLeftHovered(true);\n }\n\n if (scrollLeft < scrollWidth - clientWidth - 1) {\n setIsRightHovered(true);\n }\n }\n }, []);\n\n const handleScrollLeft = useCallback(() => {\n if (scrollRef.current) {\n scrollRef.current.scrollBy({ left: -200, behavior: 'smooth' });\n updatedCanScroll();\n }\n }, [updatedCanScroll]);\n\n const handleScrollRight = useCallback(() => {\n if (scrollRef.current) {\n scrollRef.current.scrollBy({ left: 200, behavior: 'smooth' });\n updatedCanScroll();\n }\n }, [updatedCanScroll]);\n\n const handleHoverEnter = useCallback(() => {\n if (!scrollRef.current) return;\n\n updatedCanScroll();\n }, [updatedCanScroll]);\n\n const handleHoverLeave = useCallback(() => {\n setIsLeftHovered(false);\n setIsRightHovered(false);\n }, []);\n\n useEffect(() => {\n const scrollElement = scrollRef.current;\n\n if (scrollElement) {\n scrollElement.addEventListener('scroll', updatedCanScroll);\n updatedCanScroll();\n\n return () => {\n scrollElement.removeEventListener('scroll', updatedCanScroll);\n };\n }\n }, [updatedCanScroll]);\n\n useEffect(() => {\n updatedCanScroll();\n }, [hwDetails, updatedCanScroll]);\n\n const fetchHomeworks = useCallback(() => {\n getHomeworks(studentId, undefined, { stream });\n }, [getHomeworks, stream, studentId]);\n\n useEffect(() => {\n if (!isProcessing && isStale) {\n fetchHomeworks();\n }\n }, [fetchHomeworks, isProcessing, isStale]);\n\n useEffect(() => {\n fetchHomeworks();\n }, [fetchHomeworks]);\n\n const waitForReviewSheets = (hwDetails?.filter(sheet => sheet.state === 'WAIT_FOR_REVIEW') || [])\n .length;\n\n if (hwDetails && hwDetails.length === 0) {\n return (\n <FlexView $flexRowGapX={1}>\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n Homework ({hwDetails?.length})\n </Text>\n <Text $renderAs=\"ab2\" $color=\"BLACK_T_60\">\n No Homework assigned yet\n </Text>\n </FlexView>\n );\n }\n\n if (isProcessingFailed) {\n return null;\n }\n\n return (\n <Styled.ContentWrapper ref={homeworkRef} $flexRowGapX={1} $disablePointerEvents={isProcessing}>\n {!isJourneyActive && (\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n Homework ({waitForReviewSheets}/{hwDetails?.length})\n </Text>\n )}\n <FlexView\n $position=\"relative\"\n onMouseEnter={handleHoverEnter}\n onMouseLeave={handleHoverLeave}\n >\n <Styled.ScrollButton\n $position=\"absolute\"\n $background=\"BLACK_T_60\"\n $justifyContent=\"center\"\n $alignItems=\"center\"\n $height=\"100%\"\n onClick={handleScrollLeft}\n $visible={isLeftHovered}\n left=\"0px\"\n right=\"auto\"\n >\n <ChevronLeftIcon width={24} height={24} />\n </Styled.ScrollButton>\n\n <Styled.ScrollContainer ref={scrollRef}>\n <FlexView $flexDirection=\"row\" $flexGapX={1}>\n {hwDetails?.map((sheet, idx) => {\n const {\n node_id: nodeId,\n worksheet_id: worksheetId,\n node_type: nodeType,\n title,\n subtext,\n } = sheet;\n const isDynamicSheet = nodeType === 'DYNAMIC';\n\n return (\n <FlexView\n ref={idx === 0 ? individualHomeworkRef : undefined}\n key={nodeId}\n $flexDirection=\"row\"\n $flexGapX={1}\n >\n {hwDetails.length > 10 && idx === 10 && (\n <Styled.QueueWrapper\n $background=\"BLACK_4\"\n $justifyContent=\"center\"\n $gutter={4}\n $gap={8}\n >\n <Styled.QueueText $renderAs=\"ac3\" $color=\"WHITE\">\n In Queue\n </Styled.QueueText>\n </Styled.QueueWrapper>\n )}\n <HomeworkCard\n isInQueue={hwDetails.length > 10 && idx > 9}\n key={`${worksheetId}_${nodeId}_${idx}`}\n userType={userType}\n header={title}\n subHeader={subtext || ''}\n nodeData={sheet}\n renderAs=\"homework\"\n onNodeAttempt={isDynamicSheet ? onTestStart : onNodeAttempt}\n shouldOpenOnRight={true}\n onNodeView={isDynamicSheet ? onTestPreview : onNodeView}\n onNodeReview={isDynamicSheet ? onTestReview : onNodeReview}\n onNodeUnassign={onNodeUnassign}\n />\n </FlexView>\n );\n })}\n </FlexView>\n </Styled.ScrollContainer>\n <Styled.ScrollButton\n $position=\"absolute\"\n $width=\"60px\"\n $height=\"100%\"\n $background=\"BLACK_T_60\"\n $justifyContent=\"center\"\n $alignItems=\"center\"\n onClick={handleScrollRight}\n $visible={isRightHovered}\n left=\"auto\"\n right=\"0px\"\n >\n <ChevronRightIcon width={24} height={24} />\n </Styled.ScrollButton>\n </FlexView>\n </Styled.ContentWrapper>\n );\n};\n\nexport default HWCardList;\n"],"names":["HWCardList","userType","studentId","stream","onTestStart","onNodeAttempt","onTestPreview","onNodeView","onTestReview","onNodeReview","onNodeUnassign","homeworkRef","individualHomeworkRef","startHomePageJourney","canStartJourney","scrollRef","useRef","isLeftHovered","setIsLeftHovered","useState","isRightHovered","setIsRightHovered","getHomeworks","hwDetails","isProcessingFailed","isProcessing","isStale","useGetHomeworks","isJourneyActive","useJourney","useEffect","updatedCanScroll","useCallback","scrollLeft","scrollWidth","clientWidth","handleScrollLeft","handleScrollRight","handleHoverEnter","handleHoverLeave","scrollElement","fetchHomeworks","waitForReviewSheets","sheet","jsxs","FlexView","Text","Styled.ContentWrapper","jsx","Styled.ScrollButton","ChevronLeftIcon","Styled.ScrollContainer","idx","nodeId","worksheetId","nodeType","title","subtext","isDynamicSheet","Styled.QueueWrapper","Styled.QueueText","HomeworkCard","ChevronRightIcon","HWCardList$1"],"mappings":";;;;;;;;;;AAoCA,MAAMA,KAAwC,CAAC;AAAA,EAC7C,UAAAC,IAAW;AAAA,EACX,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,YAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,aAAAC;AAAA,EACA,uBAAAC;AAAA,EACA,sBAAAC;AAAA,EACA,iBAAAC;AACF,MAAM;AACE,QAAAC,IAAYC,EAAuB,IAAI,GACvC,CAACC,GAAeC,CAAgB,IAAIC,EAAS,EAAK,GAClD,CAACC,GAAgBC,CAAiB,IAAIF,EAAS,EAAK,GACpD;AAAA,IACJ,KAAKG;AAAA,IACL,MAAMC;AAAA,IACN,oBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,SAAAC;AAAA,EAAA,IACEC,EAAgBzB,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B,UAAUd;AAAA,sBACV,UAAS;AAAA,sBACT,eAAee,IAAiBtD,IAAcC;AAAA,sBAC9C,mBAAmB;AAAA,sBACnB,YAAYqD,IAAiBpD,IAAgBC;AAAA,sBAC7C,cAAcmD,IAAiBlD,IAAeC;AAAA,sBAC9C,gBAAAC;AAAA,oBAAA;AAAA,oBAVK,GAAG4C,CAAW,IAAID,CAAM,IAAID,CAAG;AAAA,kBAWtC;AAAA,gBAAA;AAAA,cAAA;AAAA,cA7BKC;AAAA,YAAA;AAAA,UA8BP,IAGN,EACF,CAAA;AAAA,UACA,gBAAAL;AAAA,YAACC;AAAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,QAAO;AAAA,cACP,SAAQ;AAAA,cACR,aAAY;AAAA,cACZ,iBAAgB;AAAA,cAChB,aAAY;AAAA,cACZ,SAASZ;AAAA,cACT,UAAUjB;AAAA,cACV,MAAK;AAAA,cACL,OAAM;AAAA,cAEN,UAAC,gBAAA4B,EAAAc,GAAA,EAAiB,OAAO,IAAI,QAAQ,IAAI;AAAA,YAAA;AAAA,UAC3C;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EACF,EAAA,CAAA;AAEJ,GAEAC,KAAe/D;"}
1
+ {"version":3,"file":"hw-card-list.js","sources":["../../../../src/features/homework/hw-card-list/hw-card-list.tsx"],"sourcesContent":["import type {\n INodeCardCallbacks,\n INodeDataProps,\n} from '../../chapters-v2/comps/node-card/node-card-types';\nimport type { IHomepageStartJourneyProps } from '../../journey/types/homepage-journey-types';\nimport type { TUserTypes } from '../../ui/types';\n\nimport React, { useCallback, useEffect, useRef, useState } from 'react';\n\nimport ChevronLeftIcon from '../../../assets/line-icons/icons/chevron-left';\nimport ChevronRightIcon from '../../../assets/line-icons/icons/chevron-right';\nimport { useJourney } from '../../journey/use-journey/use-journey';\nimport FlexView from '../../ui/layout/flex-view';\nimport Text from '../../ui/text/text';\nimport HomeworkCard from '../homework-card';\nimport { useGetHomeworks } from './api/get-homeworks';\nimport * as Styled from './hw-card-list-styled';\n\ninterface HWCardListProps extends INodeCardCallbacks {\n userType: TUserTypes;\n studentId: string;\n stream: string;\n onTestPreview?: (sheetData: INodeDataProps, milestoneId?: string) => void;\n onTestStart?: (sheetData: INodeDataProps) => void;\n onTestReview?: (sheetData: INodeDataProps, milestoneId?: string) => void;\n homeworkRef?: React.RefObject<HTMLDivElement>;\n individualHomeworkRef?: React.RefObject<HTMLDivElement>;\n startHomePageJourney?: ({\n hwDetails,\n studentId,\n stream,\n userType,\n }: IHomepageStartJourneyProps) => void;\n canStartJourney?: boolean;\n}\n\nconst HWCardList: React.FC<HWCardListProps> = ({\n userType = 'STUDENT',\n studentId,\n stream,\n onTestStart,\n onNodeAttempt,\n onTestPreview,\n onNodeView,\n onTestReview,\n onNodeReview,\n onNodeUnassign,\n homeworkRef,\n individualHomeworkRef,\n startHomePageJourney,\n canStartJourney,\n}) => {\n const scrollRef = useRef<HTMLDivElement>(null);\n const [isLeftHovered, setIsLeftHovered] = useState(false);\n const [isRightHovered, setIsRightHovered] = useState(false);\n const {\n get: getHomeworks,\n data: hwDetails,\n isProcessingFailed,\n isProcessing,\n isStale,\n } = useGetHomeworks(studentId);\n const { isJourneyActive } = useJourney();\n\n useEffect(() => {\n if (hwDetails?.length && startHomePageJourney && !isJourneyActive && canStartJourney) {\n startHomePageJourney({ hwDetails, studentId, stream, userType });\n }\n }, [\n canStartJourney,\n hwDetails,\n isJourneyActive,\n startHomePageJourney,\n stream,\n studentId,\n userType,\n ]);\n\n const updatedCanScroll = useCallback(() => {\n if (scrollRef.current) {\n const { scrollLeft, scrollWidth, clientWidth } = scrollRef.current;\n\n if (scrollLeft > 1) {\n setIsLeftHovered(true);\n }\n\n if (scrollLeft < scrollWidth - clientWidth - 1) {\n setIsRightHovered(true);\n }\n }\n }, []);\n\n const handleScrollLeft = useCallback(() => {\n if (scrollRef.current) {\n scrollRef.current.scrollBy({ left: -200, behavior: 'smooth' });\n updatedCanScroll();\n }\n }, [updatedCanScroll]);\n\n const handleScrollRight = useCallback(() => {\n if (scrollRef.current) {\n scrollRef.current.scrollBy({ left: 200, behavior: 'smooth' });\n updatedCanScroll();\n }\n }, [updatedCanScroll]);\n\n const handleHoverEnter = useCallback(() => {\n if (!scrollRef.current) return;\n\n updatedCanScroll();\n }, [updatedCanScroll]);\n\n const handleHoverLeave = useCallback(() => {\n setIsLeftHovered(false);\n setIsRightHovered(false);\n }, []);\n\n useEffect(() => {\n const scrollElement = scrollRef.current;\n\n if (scrollElement) {\n scrollElement.addEventListener('scroll', updatedCanScroll);\n updatedCanScroll();\n\n return () => {\n scrollElement.removeEventListener('scroll', updatedCanScroll);\n };\n }\n }, [updatedCanScroll]);\n\n useEffect(() => {\n updatedCanScroll();\n }, [hwDetails, updatedCanScroll]);\n\n const fetchHomeworks = useCallback(() => {\n getHomeworks(studentId, undefined, { stream });\n }, [getHomeworks, stream, studentId]);\n\n useEffect(() => {\n if (!isProcessing && isStale) {\n fetchHomeworks();\n }\n }, [fetchHomeworks, isProcessing, isStale]);\n\n useEffect(() => {\n fetchHomeworks();\n }, [fetchHomeworks]);\n\n const waitForReviewSheets = (hwDetails?.filter(sheet => sheet.state === 'WAIT_FOR_REVIEW') || [])\n .length;\n\n if (hwDetails && hwDetails.length === 0) {\n return (\n <FlexView $flexRowGapX={1}>\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n Homework ({hwDetails?.length})\n </Text>\n <Text $renderAs=\"ab2\" $color=\"BLACK_T_60\">\n No Homework assigned yet\n </Text>\n </FlexView>\n );\n }\n\n if (isProcessingFailed) {\n return null;\n }\n\n return (\n <Styled.ContentWrapper ref={homeworkRef} $flexRowGapX={1} $disablePointerEvents={isProcessing}>\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n Homework ({waitForReviewSheets}/{hwDetails?.length})\n </Text>\n <FlexView\n $position=\"relative\"\n onMouseEnter={handleHoverEnter}\n onMouseLeave={handleHoverLeave}\n >\n <Styled.ScrollButton\n $position=\"absolute\"\n $background=\"BLACK_T_60\"\n $justifyContent=\"center\"\n $alignItems=\"center\"\n $height=\"100%\"\n onClick={handleScrollLeft}\n $visible={isLeftHovered}\n left=\"0px\"\n right=\"auto\"\n >\n <ChevronLeftIcon width={24} height={24} />\n </Styled.ScrollButton>\n\n <Styled.ScrollContainer ref={scrollRef}>\n <FlexView $flexDirection=\"row\" $flexGapX={1}>\n {hwDetails?.map((sheet, idx) => {\n const {\n node_id: nodeId,\n worksheet_id: worksheetId,\n node_type: nodeType,\n title,\n subtext,\n } = sheet;\n const isDynamicSheet = nodeType === 'DYNAMIC';\n\n return (\n <FlexView\n ref={idx === 0 ? individualHomeworkRef : undefined}\n key={`${worksheetId}_${nodeId}_${idx}`}\n $flexDirection=\"row\"\n $flexGapX={1}\n >\n {hwDetails.length > 10 && idx === 10 && (\n <Styled.QueueWrapper\n $background=\"BLACK_4\"\n $justifyContent=\"center\"\n $gutter={4}\n $gap={8}\n >\n <Styled.QueueText $renderAs=\"ac3\" $color=\"WHITE\">\n In Queue\n </Styled.QueueText>\n </Styled.QueueWrapper>\n )}\n <HomeworkCard\n isInQueue={hwDetails.length > 10 && idx > 9}\n userType={userType}\n header={title}\n subHeader={subtext || ''}\n nodeData={sheet}\n renderAs=\"homework\"\n onNodeAttempt={isDynamicSheet ? onTestStart : onNodeAttempt}\n shouldOpenOnRight={true}\n onNodeView={isDynamicSheet ? onTestPreview : onNodeView}\n onNodeReview={isDynamicSheet ? onTestReview : onNodeReview}\n onNodeUnassign={onNodeUnassign}\n />\n </FlexView>\n );\n })}\n </FlexView>\n </Styled.ScrollContainer>\n <Styled.ScrollButton\n $position=\"absolute\"\n $width=\"60px\"\n $height=\"100%\"\n $background=\"BLACK_T_60\"\n $justifyContent=\"center\"\n $alignItems=\"center\"\n onClick={handleScrollRight}\n $visible={isRightHovered}\n left=\"auto\"\n right=\"0px\"\n >\n <ChevronRightIcon width={24} height={24} />\n </Styled.ScrollButton>\n </FlexView>\n </Styled.ContentWrapper>\n );\n};\n\nexport default HWCardList;\n"],"names":["HWCardList","userType","studentId","stream","onTestStart","onNodeAttempt","onTestPreview","onNodeView","onTestReview","onNodeReview","onNodeUnassign","homeworkRef","individualHomeworkRef","startHomePageJourney","canStartJourney","scrollRef","useRef","isLeftHovered","setIsLeftHovered","useState","isRightHovered","setIsRightHovered","getHomeworks","hwDetails","isProcessingFailed","isProcessing","isStale","useGetHomeworks","isJourneyActive","useJourney","useEffect","updatedCanScroll","useCallback","scrollLeft","scrollWidth","clientWidth","handleScrollLeft","handleScrollRight","handleHoverEnter","handleHoverLeave","scrollElement","fetchHomeworks","waitForReviewSheets","sheet","jsxs","FlexView","Text","Styled.ContentWrapper","jsx","Styled.ScrollButton","ChevronLeftIcon","Styled.ScrollContainer","idx","nodeId","worksheetId","nodeType","title","subtext","isDynamicSheet","Styled.QueueWrapper","Styled.QueueText","HomeworkCard","ChevronRightIcon","HWCardList$1"],"mappings":";;;;;;;;;;AAoCA,MAAMA,KAAwC,CAAC;AAAA,EAC7C,UAAAC,IAAW;AAAA,EACX,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,YAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,aAAAC;AAAA,EACA,uBAAAC;AAAA,EACA,sBAAAC;AAAA,EACA,iBAAAC;AACF,MAAM;AACE,QAAAC,IAAYC,EAAuB,IAAI,GACvC,CAACC,GAAeC,CAAgB,IAAIC,EAAS,EAAK,GAClD,CAACC,GAAgBC,CAAiB,IAAIF,EAAS,EAAK,GACpD;AAAA,IACJ,KAAKG;AAAA,IACL,MAAMC;AAAA,IACN,oBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,SAAAC;AAAA,EAAA,IACEC,EAAgBzB,CAAS,GACvB,EAAE,iBAAA0B,MAAoBC;AAE5B,EAAAC,EAAU,MAAM;AACd,IAAIP,KAAA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BACnB,YAAYqD,IAAiBpD,IAAgBC;AAAA,sBAC7C,cAAcmD,IAAiBlD,IAAeC;AAAA,sBAC9C,gBAAAC;AAAA,oBAAA;AAAA,kBACF;AAAA,gBAAA;AAAA,cAAA;AAAA,cA5BK,GAAG4C,CAAW,IAAID,CAAM,IAAID,CAAG;AAAA,YAAA;AAAA,UA6BtC,IAGN,EACF,CAAA;AAAA,UACA,gBAAAJ;AAAA,YAACC;AAAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,QAAO;AAAA,cACP,SAAQ;AAAA,cACR,aAAY;AAAA,cACZ,iBAAgB;AAAA,cAChB,aAAY;AAAA,cACZ,SAASZ;AAAA,cACT,UAAUjB;AAAA,cACV,MAAK;AAAA,cACL,OAAM;AAAA,cAEN,UAAC,gBAAA4B,EAAAc,GAAA,EAAiB,OAAO,IAAI,QAAQ,IAAI;AAAA,YAAA;AAAA,UAC3C;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EACF,EAAA,CAAA;AAEJ,GAEAC,KAAe/D;"}
@@ -0,0 +1,194 @@
1
+ import { jsx as e, jsxs as a } from "react/jsx-runtime";
2
+ import { useRef as n, useCallback as B, useMemo as L, useEffect as N } from "react";
3
+ import y from "../../chapters-v2/chapter-details/chapter-banner/chapter-banner.js";
4
+ import I from "../../chapters-v2/chapter-details/chapter-details.js";
5
+ import c from "../../ui/buttons/button/button.js";
6
+ import d from "../../ui/layout/flex-view.js";
7
+ import m from "../../ui/text/text.js";
8
+ import { JOURNEY_ID_STUDENT as S } from "../journey-id/journey-id-student.js";
9
+ import { IndicatorType as p } from "../use-journey/constants.js";
10
+ import { useJourney as _ } from "../use-journey/use-journey.js";
11
+ const Y = () => {
12
+ const o = S.CHAPTER_PAGE_JOURNEY, t = n(null), r = n(null), u = n(null), s = n([]), { nextCoachmark: i, setJourney: h, endJourney: g } = _(), C = B(
13
+ ({ chapterDetails: l, studentId: R, userType: E }) => {
14
+ const {
15
+ progress_stat: f,
16
+ name: A,
17
+ image_hue: T,
18
+ image_url: w
19
+ // blocks,
20
+ } = l;
21
+ if (!(t != null && t.current) || !(r != null && r.current) || !u.current)
22
+ return;
23
+ const k = t.current.getBoundingClientRect(), O = [
24
+ {
25
+ originalElementToHighlightRef: t,
26
+ isActive: !1,
27
+ type: p.TOOLTIP,
28
+ elementToHighlight: /* @__PURE__ */ e(
29
+ I,
30
+ {
31
+ userChapterId: l.id,
32
+ studentId: R,
33
+ userType: E,
34
+ onBlockSkipUnskip: () => null,
35
+ onNodeAttempt: () => null,
36
+ onNodeAttemptLocationChange: () => null,
37
+ onNodeMarkAsDone: () => null,
38
+ onNodeReattempt: () => null,
39
+ onNodeReview: () => null,
40
+ onNodeView: () => null,
41
+ onExit: () => null
42
+ }
43
+ ),
44
+ indicator: {
45
+ position: "left",
46
+ tooltipYCoOrdinates: -(k.height / 2) + 178,
47
+ backgroundColor: "BLUE_4",
48
+ borderColor: "BLACK",
49
+ arrowColor: "BLACK",
50
+ arrowSize: 12,
51
+ width: 264,
52
+ tooltipItem: /* @__PURE__ */ a(d, { $flexRowGapX: 0.75, children: [
53
+ /* @__PURE__ */ e(m, { $renderAs: "ab2-bold", children: "Welcome to the all new chapter experience." }),
54
+ /* @__PURE__ */ e(
55
+ c,
56
+ {
57
+ label: "Next",
58
+ size: "xsmall",
59
+ widthX: 6,
60
+ renderAs: "secondary",
61
+ onClick: () => i(o, !1, 0, !0)
62
+ }
63
+ )
64
+ ] })
65
+ }
66
+ },
67
+ {
68
+ originalElementToHighlightRef: r,
69
+ elementToHighlight: /* @__PURE__ */ e(
70
+ y,
71
+ {
72
+ title: A,
73
+ progressStats: f,
74
+ imageUrl: w,
75
+ imageHue: T
76
+ }
77
+ ),
78
+ type: p.TOOLTIP,
79
+ indicator: {
80
+ position: "bottom",
81
+ tooltipXCoOrdinates: -45,
82
+ tooltipYCoOrdinates: -40,
83
+ backgroundColor: "ORANGE_4",
84
+ borderColor: "BLACK",
85
+ arrowColor: "BLACK",
86
+ width: 264,
87
+ arrowSize: 12,
88
+ tooltipItem: /* @__PURE__ */ a(d, { $flexRowGapX: 0.75, children: [
89
+ /* @__PURE__ */ e(m, { $renderAs: "ab2-bold", children: "A chapter is divided into *core sheets (compulsory), and supplementary sheets." }),
90
+ /* @__PURE__ */ e(
91
+ c,
92
+ {
93
+ label: "Next",
94
+ size: "xsmall",
95
+ widthX: 6,
96
+ renderAs: "secondary",
97
+ onClick: () => i(o, !1, 0, !0)
98
+ }
99
+ )
100
+ ] })
101
+ },
102
+ isActive: !1
103
+ },
104
+ {
105
+ originalElementToHighlightRef: r,
106
+ elementToHighlight: /* @__PURE__ */ e(
107
+ y,
108
+ {
109
+ title: A,
110
+ progressStats: f,
111
+ imageUrl: w,
112
+ imageHue: T
113
+ }
114
+ ),
115
+ type: p.TOOLTIP,
116
+ indicator: {
117
+ position: "bottom",
118
+ tooltipXCoOrdinates: -275,
119
+ tooltipYCoOrdinates: -15,
120
+ backgroundColor: "PURPLE_4",
121
+ borderColor: "BLACK",
122
+ arrowColor: "BLACK",
123
+ arrowSize: 12,
124
+ width: 264,
125
+ tooltipItem: /* @__PURE__ */ a(d, { $flexRowGapX: 0.75, children: [
126
+ /* @__PURE__ */ e(m, { $renderAs: "ab2-bold", children: "Easily track the progress of the core sheets." }),
127
+ /* @__PURE__ */ e(
128
+ c,
129
+ {
130
+ label: "Got it",
131
+ size: "xsmall",
132
+ widthX: 6,
133
+ renderAs: "secondary",
134
+ onClick: () => g(o)
135
+ }
136
+ )
137
+ ] })
138
+ },
139
+ isActive: !1
140
+ }
141
+ // {
142
+ // originalElementToHighlightRef: coreBlocksRef,
143
+ // elementToHighlight: <BlockSections userType={userType} blocks={blocks} imageHue="BLUE" />,
144
+ // type: IndicatorType.TOOLTIP,
145
+ // indicator: {
146
+ // position: 'top',
147
+ // tooltipXCoOrdinates: -35,
148
+ // tooltipYCoOrdinates: -7,
149
+ // backgroundColor: 'PURPLE_4',
150
+ // borderColor: 'BLACK',
151
+ // arrowColor: 'BLACK',
152
+ // arrowXCoOrdinates: -97,
153
+ // arrowSize: 12,
154
+ // width: 264,
155
+ // tooltipItem: (
156
+ // <FlexView $flexRowGapX={0.75}>
157
+ // <Text $renderAs="ab2-bold">Easily track the progress of the core sheets.</Text>
158
+ // <Button
159
+ // label="Next"
160
+ // size="xsmall"
161
+ // widthX={6}
162
+ // renderAs="secondary"
163
+ // onClick={() => endJourney(journeyId)}
164
+ // />
165
+ // </FlexView>
166
+ // ),
167
+ // } as IArrowTooltipProps,
168
+ // isActive: false,
169
+ // },
170
+ ];
171
+ h(o, O);
172
+ const b = setTimeout(() => {
173
+ clearTimeout(b), i(o, !1, 0, !0);
174
+ }, 200);
175
+ s.current.push(b);
176
+ },
177
+ [h, o, i, g]
178
+ ), x = L(
179
+ () => ({
180
+ chapterPageRef: t,
181
+ bannerRef: r,
182
+ coreBlocksRef: u,
183
+ startJourney: C
184
+ }),
185
+ [C]
186
+ );
187
+ return N(() => () => {
188
+ s.current.forEach((l) => clearTimeout(l)), s.current = [];
189
+ }, []), x;
190
+ };
191
+ export {
192
+ Y as useChapterPageJourney
193
+ };
194
+ //# sourceMappingURL=use-chapter-journey.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-chapter-journey.js","sources":["../../../../src/features/journey/hooks/use-chapter-journey.tsx"],"sourcesContent":["import type { IUserChapterData } from '../../chapters-v2/chapter-details/chapter-details-types';\nimport type { IArrowTooltipProps } from '../../ui/arrow-tooltip/arrow-tooltip-types';\nimport type { ICoachmarkProps } from '../use-journey/journey-context-types';\n\nimport { useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport ChapterBanner from '../../chapters-v2/chapter-details/chapter-banner/chapter-banner';\nimport ChapterDetails from '../../chapters-v2/chapter-details/chapter-details';\nimport Button from '../../ui/buttons/button/button';\nimport FlexView from '../../ui/layout/flex-view';\nimport Text from '../../ui/text/text';\nimport { JOURNEY_ID_STUDENT } from '../journey-id/journey-id-student';\nimport { IndicatorType } from '../use-journey/constants';\nimport { useJourney } from '../use-journey/use-journey';\n\ninterface IChapterStartJourneyProps {\n chapterDetails: IUserChapterData;\n studentId: string;\n userType: 'STUDENT' | 'TEACHER';\n}\n\nexport const useChapterPageJourney = () => {\n const journeyId = JOURNEY_ID_STUDENT.CHAPTER_PAGE_JOURNEY;\n\n const chapterPageRef = useRef<HTMLDivElement>(null);\n const bannerRef = useRef<HTMLDivElement>(null);\n const coreBlocksRef = useRef<HTMLDivElement>(null);\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n const { nextCoachmark, setJourney, endJourney } = useJourney();\n\n const startJourney = useCallback(\n ({ chapterDetails, studentId, userType }: IChapterStartJourneyProps) => {\n // const isStudent = userType === 'STUDENT';\n\n const {\n progress_stat: progressStat,\n name,\n image_hue: imageHue,\n image_url: imageUrl,\n // blocks,\n } = chapterDetails;\n\n if (!chapterPageRef?.current || !bannerRef?.current || !coreBlocksRef.current) {\n return;\n }\n\n const chapterPageRect = chapterPageRef.current.getBoundingClientRect();\n\n const chapterPageSteps: ICoachmarkProps[] = [\n {\n originalElementToHighlightRef: chapterPageRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: (\n <ChapterDetails\n userChapterId={chapterDetails.id}\n studentId={studentId}\n userType={userType}\n onBlockSkipUnskip={() => null}\n onNodeAttempt={() => null}\n onNodeAttemptLocationChange={() => null}\n onNodeMarkAsDone={() => null}\n onNodeReattempt={() => null}\n onNodeReview={() => null}\n onNodeView={() => null}\n onExit={() => null}\n />\n ),\n indicator: {\n position: 'left',\n tooltipYCoOrdinates: -(chapterPageRect.height / 2) + 178,\n backgroundColor: 'BLUE_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n arrowSize: 12,\n width: 264,\n tooltipItem: (\n <FlexView $flexRowGapX={0.75}>\n <Text $renderAs=\"ab2-bold\">Welcome to the all new chapter experience.</Text>\n <Button\n label=\"Next\"\n size=\"xsmall\"\n widthX={6}\n renderAs=\"secondary\"\n onClick={() => nextCoachmark(journeyId, false, 0, true)}\n />\n </FlexView>\n ),\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: bannerRef,\n elementToHighlight: (\n <ChapterBanner\n title={name}\n progressStats={progressStat}\n imageUrl={imageUrl}\n imageHue={imageHue}\n />\n ),\n type: IndicatorType.TOOLTIP,\n indicator: {\n position: 'bottom',\n tooltipXCoOrdinates: -45,\n tooltipYCoOrdinates: -40,\n backgroundColor: 'ORANGE_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n width: 264,\n arrowSize: 12,\n tooltipItem: (\n <FlexView $flexRowGapX={0.75}>\n <Text $renderAs=\"ab2-bold\">\n A chapter is divided into *core sheets (compulsory), and supplementary sheets.\n </Text>\n <Button\n label=\"Next\"\n size=\"xsmall\"\n widthX={6}\n renderAs=\"secondary\"\n onClick={() => nextCoachmark(journeyId, false, 0, true)}\n />\n </FlexView>\n ),\n } as IArrowTooltipProps,\n isActive: false,\n },\n {\n originalElementToHighlightRef: bannerRef,\n elementToHighlight: (\n <ChapterBanner\n title={name}\n progressStats={progressStat}\n imageUrl={imageUrl}\n imageHue={imageHue}\n />\n ),\n type: IndicatorType.TOOLTIP,\n indicator: {\n position: 'bottom',\n tooltipXCoOrdinates: -275,\n tooltipYCoOrdinates: -15,\n backgroundColor: 'PURPLE_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n arrowSize: 12,\n width: 264,\n tooltipItem: (\n <FlexView $flexRowGapX={0.75}>\n <Text $renderAs=\"ab2-bold\">Easily track the progress of the core sheets.</Text>\n <Button\n label=\"Got it\"\n size=\"xsmall\"\n widthX={6}\n renderAs=\"secondary\"\n onClick={() => endJourney(journeyId)}\n />\n </FlexView>\n ),\n } as IArrowTooltipProps,\n isActive: false,\n },\n // {\n // originalElementToHighlightRef: coreBlocksRef,\n // elementToHighlight: <BlockSections userType={userType} blocks={blocks} imageHue=\"BLUE\" />,\n // type: IndicatorType.TOOLTIP,\n // indicator: {\n // position: 'top',\n // tooltipXCoOrdinates: -35,\n // tooltipYCoOrdinates: -7,\n // backgroundColor: 'PURPLE_4',\n // borderColor: 'BLACK',\n // arrowColor: 'BLACK',\n // arrowXCoOrdinates: -97,\n // arrowSize: 12,\n // width: 264,\n // tooltipItem: (\n // <FlexView $flexRowGapX={0.75}>\n // <Text $renderAs=\"ab2-bold\">Easily track the progress of the core sheets.</Text>\n // <Button\n // label=\"Next\"\n // size=\"xsmall\"\n // widthX={6}\n // renderAs=\"secondary\"\n // onClick={() => endJourney(journeyId)}\n // />\n // </FlexView>\n // ),\n // } as IArrowTooltipProps,\n // isActive: false,\n // },\n ];\n\n setJourney(journeyId, chapterPageSteps);\n\n const delayBeforeStart = setTimeout(() => {\n clearTimeout(delayBeforeStart);\n nextCoachmark(journeyId, false, 0, true);\n }, 200);\n\n timerRefs.current.push(delayBeforeStart); // Store to cleanup later\n },\n [setJourney, journeyId, nextCoachmark, endJourney],\n );\n\n const data = useMemo(\n () => ({\n chapterPageRef,\n bannerRef,\n coreBlocksRef,\n startJourney,\n }),\n [startJourney],\n );\n\n useEffect(() => {\n return () => {\n timerRefs.current.forEach(timer => clearTimeout(timer));\n timerRefs.current = [];\n };\n }, []);\n\n return data;\n};\n"],"names":["useChapterPageJourney","journeyId","JOURNEY_ID_STUDENT","chapterPageRef","useRef","bannerRef","coreBlocksRef","timerRefs","nextCoachmark","setJourney","endJourney","useJourney","startJourney","useCallback","chapterDetails","studentId","userType","progressStat","name","imageHue","imageUrl","chapterPageRect","chapterPageSteps","IndicatorType","jsx","ChapterDetails","jsxs","FlexView","Text","Button","ChapterBanner","delayBeforeStart","data","useMemo","useEffect","timer"],"mappings":";;;;;;;;;;AAqBO,MAAMA,IAAwB,MAAM;AACzC,QAAMC,IAAYC,EAAmB,sBAE/BC,IAAiBC,EAAuB,IAAI,GAC5CC,IAAYD,EAAuB,IAAI,GACvCE,IAAgBF,EAAuB,IAAI,GAC3CG,IAAYH,EAAwC,CAAA,CAAE,GACtD,EAAE,eAAAI,GAAe,YAA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CLE_ACTIVITIES_INTRO_JOURNEY", R.CIRCLE_LEADERBOARD_INTRO_JOURNEY = "CIRCLE_LEADERBOARD_INTRO_JOURNEY", R.CIRCLE_POINTS_REWARD_JOURNEY = "CIRCLE_POINTS_REWARD_JOURNEY", R.CIRCLE_STREAK_UPDATE_JOURNEY = "CIRCLE_STREAK_UPDATE_JOURNEY", R.CIRCLE_TUTORIAL_JOURNEY = "CIRCLE_TUTORIAL_JOURNEY", R.CIRCLE_TABLES_INTRO_JOURNEY = "CIRCLE_TABLES_INTRO_JOURNEY", R.CIRCLE_STREAK_REDUCTION_JOURNEY = "CIRCLE_STREAK_REDUCTION_JOURNEY", R.HOMEPAGE_JOURNEY = "HOMEPAGE_JOURNEY", R))(E || {}), C = /* @__PURE__ */ ((R) => (R.HOMEPAGE_JOURNEY = "HOMEPAGE_JOURNEY", R))(C || {});
1
+ var E = /* @__PURE__ */ ((R) => (R.CIRCLE_ACTIVITIES_INTRO_JOURNEY = "CIRCLE_ACTIVITIES_INTRO_JOURNEY", R.CIRCLE_LEADERBOARD_INTRO_JOURNEY = "CIRCLE_LEADERBOARD_INTRO_JOURNEY", R.CIRCLE_POINTS_REWARD_JOURNEY = "CIRCLE_POINTS_REWARD_JOURNEY", R.CIRCLE_STREAK_UPDATE_JOURNEY = "CIRCLE_STREAK_UPDATE_JOURNEY", R.CIRCLE_TUTORIAL_JOURNEY = "CIRCLE_TUTORIAL_JOURNEY", R.CIRCLE_TABLES_INTRO_JOURNEY = "CIRCLE_TABLES_INTRO_JOURNEY", R.CIRCLE_STREAK_REDUCTION_JOURNEY = "CIRCLE_STREAK_REDUCTION_JOURNEY", R.HOMEPAGE_JOURNEY = "HOMEPAGE_JOURNEY", R.CHAPTER_PAGE_JOURNEY = "CHAPTER_PAGE_JOURNEY", R))(E || {});
2
2
  export {
3
- E as JOURNEY_ID_STUDENT,
4
- C as JOURNEY_ID_TEACHER
3
+ E as JOURNEY_ID_STUDENT
5
4
  };
6
5
  //# sourceMappingURL=journey-id-student.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"journey-id-student.js","sources":["../../../../src/features/journey/journey-id/journey-id-student.ts"],"sourcesContent":["export enum JOURNEY_ID_STUDENT {\n CIRCLE_ACTIVITIES_INTRO_JOURNEY = 'CIRCLE_ACTIVITIES_INTRO_JOURNEY',\n CIRCLE_LEADERBOARD_INTRO_JOURNEY = 'CIRCLE_LEADERBOARD_INTRO_JOURNEY',\n CIRCLE_POINTS_REWARD_JOURNEY = 'CIRCLE_POINTS_REWARD_JOURNEY',\n CIRCLE_STREAK_UPDATE_JOURNEY = 'CIRCLE_STREAK_UPDATE_JOURNEY',\n CIRCLE_TUTORIAL_JOURNEY = 'CIRCLE_TUTORIAL_JOURNEY',\n CIRCLE_TABLES_INTRO_JOURNEY = 'CIRCLE_TABLES_INTRO_JOURNEY',\n\n // TODO: Deprecate bottom journeys, they are not actually journeys\n CIRCLE_STREAK_REDUCTION_JOURNEY = 'CIRCLE_STREAK_REDUCTION_JOURNEY',\n HOMEPAGE_JOURNEY = 'HOMEPAGE_JOURNEY',\n}\n\nexport enum JOURNEY_ID_TEACHER {\n HOMEPAGE_JOURNEY = 'HOMEPAGE_JOURNEY',\n}\n"],"names":["JOURNEY_ID_STUDENT","JOURNEY_ID_TEACHER"],"mappings":"AAAY,IAAAA,sBAAAA,OACVA,EAAA,kCAAkC,mCAClCA,EAAA,mCAAmC,oCACnCA,EAAA,+BAA+B,gCAC/BA,EAAA,+BAA+B,gCAC/BA,EAAA,0BAA0B,2BAC1BA,EAAA,8BAA8B,+BAG9BA,EAAA,kCAAkC,mCAClCA,EAAA,mBAAmB,oBAVTA,IAAAA,KAAA,CAAA,CAAA,GAaAC,sBAAAA,OACVA,EAAA,mBAAmB,oBADTA,IAAAA,KAAA,CAAA,CAAA;"}
1
+ {"version":3,"file":"journey-id-student.js","sources":["../../../../src/features/journey/journey-id/journey-id-student.ts"],"sourcesContent":["export enum JOURNEY_ID_STUDENT {\n CIRCLE_ACTIVITIES_INTRO_JOURNEY = 'CIRCLE_ACTIVITIES_INTRO_JOURNEY',\n CIRCLE_LEADERBOARD_INTRO_JOURNEY = 'CIRCLE_LEADERBOARD_INTRO_JOURNEY',\n CIRCLE_POINTS_REWARD_JOURNEY = 'CIRCLE_POINTS_REWARD_JOURNEY',\n CIRCLE_STREAK_UPDATE_JOURNEY = 'CIRCLE_STREAK_UPDATE_JOURNEY',\n CIRCLE_TUTORIAL_JOURNEY = 'CIRCLE_TUTORIAL_JOURNEY',\n CIRCLE_TABLES_INTRO_JOURNEY = 'CIRCLE_TABLES_INTRO_JOURNEY',\n\n // TODO: Deprecate bottom journeys, they are not actually journeys\n CIRCLE_STREAK_REDUCTION_JOURNEY = 'CIRCLE_STREAK_REDUCTION_JOURNEY',\n HOMEPAGE_JOURNEY = 'HOMEPAGE_JOURNEY',\n CHAPTER_PAGE_JOURNEY = 'CHAPTER_PAGE_JOURNEY',\n}\n"],"names":["JOURNEY_ID_STUDENT"],"mappings":"AAAY,IAAAA,sBAAAA,OACVA,EAAA,kCAAkC,mCAClCA,EAAA,mCAAmC,oCACnCA,EAAA,+BAA+B,gCAC/BA,EAAA,+BAA+B,gCAC/BA,EAAA,0BAA0B,2BAC1BA,EAAA,8BAA8B,+BAG9BA,EAAA,kCAAkC,mCAClCA,EAAA,mBAAmB,oBACnBA,EAAA,uBAAuB,wBAXbA,IAAAA,KAAA,CAAA,CAAA;"}
@@ -0,0 +1,5 @@
1
+ var P = /* @__PURE__ */ ((E) => (E.HOMEPAGE_JOURNEY = "HOMEPAGE_JOURNEY", E.CHAPTER_PAGE_JOURNEY = "CHAPTER_PAGE_JOURNEY", E))(P || {});
2
+ export {
3
+ P as JOURNEY_ID_TEACHER
4
+ };
5
+ //# sourceMappingURL=journey-id-teacher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"journey-id-teacher.js","sources":["../../../../src/features/journey/journey-id/journey-id-teacher.ts"],"sourcesContent":["export enum JOURNEY_ID_TEACHER {\n HOMEPAGE_JOURNEY = 'HOMEPAGE_JOURNEY',\n CHAPTER_PAGE_JOURNEY = 'CHAPTER_PAGE_JOURNEY',\n}\n"],"names":["JOURNEY_ID_TEACHER"],"mappings":"AAAY,IAAAA,sBAAAA,OACVA,EAAA,mBAAmB,oBACnBA,EAAA,uBAAuB,wBAFbA,IAAAA,KAAA,CAAA,CAAA;"}
@@ -1,109 +1,109 @@
1
- import { jsxs as D, jsx as R } from "react/jsx-runtime";
2
- import { createContext as L, useState as J, useRef as k, useCallback as y, useMemo as N, useEffect as T } from "react";
1
+ import { jsxs as D, jsx as w } from "react/jsx-runtime";
2
+ import { createContext as L, useState as J, useRef as k, useCallback as l, useMemo as N, useEffect as R } from "react";
3
3
  import { Coachmark as B } from "../comps/coachmark/coachmark.js";
4
4
  import { usePostUserJourney as M, useGetUserJourney as z } from "../user-journey-api/user-journey-api.js";
5
5
  import { Overlay as G } from "./journey-styled.js";
6
- const S = L(null), W = ({ children: b, appId: c, userId: o }) => {
7
- const [O, x] = J(!1), [p, v] = J(null), [a, i] = J([]), [d, _] = J(!1), m = k(-1), t = k(), f = k([]), { post: g } = M(), { data: C = null, get: A } = z(), $ = y(
8
- (e, r, s) => {
9
- if (a.length > 0) {
6
+ const S = L(null), W = ({ children: T, appId: s, userId: o }) => {
7
+ const [b, O] = J(!1), [x, p] = J(null), [c, a] = J([]), [d, v] = J(!1), y = k(-1), t = k(), f = k([]), { post: _ } = M(), { data: C = null, get: g } = z(), A = l(
8
+ (e, r) => {
9
+ if (c.length > 0) {
10
10
  console.error(
11
11
  `setJourney: Other Journey is already active, Current Journey: ${t.current}, New Journey Request: ${e}`
12
12
  );
13
13
  return;
14
14
  }
15
- _(!0), t.current = e, m.current = -1, i([...r]), x(!!s);
15
+ v(!0), t.current = e, y.current = -1, a([...r]);
16
16
  },
17
- [a.length]
18
- ), u = y(() => {
17
+ [c.length]
18
+ ), u = l(() => {
19
19
  f.current.forEach((e) => {
20
20
  clearTimeout(e);
21
- }), f.current = [], t.current = void 0, m.current = -1, i([]), _(!1);
22
- }, []), E = y(
21
+ }), f.current = [], t.current = void 0, y.current = -1, a([]), v(!1);
22
+ }, []), $ = l(
23
23
  (e) => {
24
- u(), v((r) => r && !r.includes(e) ? [...r, e] : r), g({
25
- app_id: c,
24
+ u(), p((r) => r && !r.includes(e) ? [...r, e] : r), _({
25
+ app_id: s,
26
26
  user_id: o,
27
27
  journey_id: e,
28
28
  journey_status: "COMPLETED"
29
29
  });
30
30
  },
31
- [c, u, g, o]
32
- ), P = y((e, r) => {
31
+ [s, u, _, o]
32
+ ), E = l((e, r) => {
33
33
  if (!t.current || e !== t.current) {
34
34
  console.error(
35
35
  t.current ? `A Journey is already active, Current Journey: ${t.current}, New Journey Request: ${e}` : "addCoachmark was called before setJourney and Journey ID is undefined"
36
36
  );
37
37
  return;
38
38
  }
39
- i((s) => [...s, r]);
40
- }, []), j = y(
41
- (e, r = !1, s = 0, q = !1) => {
39
+ a((m) => [...m, r]);
40
+ }, []), P = l(
41
+ (e, r = !1, m = 0, q = !1) => {
42
42
  if (!t.current || e !== t.current) {
43
43
  console.error(
44
44
  t.current ? "nextCoachmark was called before setJourney" : `A Journey is already active, Current Journey: ${t.current}, New Journey Request: ${e}`
45
45
  );
46
46
  return;
47
47
  }
48
- x(q), s !== 0 && i((n) => n.map((l) => ({ ...l, isActive: !1 })));
49
- const w = setTimeout(() => {
50
- clearTimeout(w);
51
- const n = m.current + 1;
52
- i((l) => {
53
- if (n >= l.length || l.length === 0)
48
+ O(q), m !== 0 && a((n) => n.map((i) => ({ ...i, isActive: !1 })));
49
+ const j = setTimeout(() => {
50
+ clearTimeout(j);
51
+ const n = y.current + 1;
52
+ a((i) => {
53
+ if (n >= i.length || i.length === 0)
54
54
  return u(), [];
55
- m.current = n;
56
- const h = [...l];
55
+ y.current = n;
56
+ const h = [...i];
57
57
  return h[n].isActive = !0, n > 0 && (h[n - 1].isActive = r), h;
58
58
  });
59
- }, s);
60
- f.current.push(w);
59
+ }, m);
60
+ f.current.push(j);
61
61
  },
62
62
  [u]
63
63
  ), U = N(
64
64
  () => ({
65
- nextCoachmark: j,
66
- setJourney: $,
67
- addCoachmark: P,
65
+ nextCoachmark: P,
66
+ setJourney: A,
67
+ addCoachmark: E,
68
68
  clearJourney: u,
69
- endJourney: E,
70
- coachmarks: a,
71
- userCompletedJourneyIds: p,
69
+ endJourney: $,
70
+ coachmarks: c,
71
+ userCompletedJourneyIds: x,
72
72
  isJourneyActive: d
73
73
  }),
74
74
  [
75
- j,
76
- $,
77
75
  P,
78
- u,
76
+ A,
79
77
  E,
80
- a,
81
- p,
78
+ u,
79
+ $,
80
+ c,
81
+ x,
82
82
  d
83
83
  ]
84
84
  );
85
- return T(() => {
86
- c && o && A(o, {
87
- app_id: c,
85
+ return R(() => {
86
+ s && o && g(o, {
87
+ app_id: s,
88
88
  user_id: o,
89
89
  journey_status: "COMPLETED"
90
90
  });
91
- }, [c, A, o]), T(() => {
91
+ }, [s, g, o]), R(() => {
92
92
  if (C) {
93
93
  const e = C.map((r) => r.journey_id);
94
- v(e);
94
+ p(e);
95
95
  }
96
96
  }, [C]), /* @__PURE__ */ D(S.Provider, { value: U, children: [
97
- d && /* @__PURE__ */ R(
97
+ d && /* @__PURE__ */ w(
98
98
  G,
99
99
  {
100
100
  about: "journey-overlay",
101
- isJourneyBlurred: O,
101
+ isJourneyBlurred: b,
102
102
  "data-testid": t.current,
103
- children: a.map((e, r) => /* @__PURE__ */ R(B, { coachmark: e }, `coachmark-${r}`))
103
+ children: c.map((e, r) => /* @__PURE__ */ w(B, { coachmark: e }, `coachmark-${r}`))
104
104
  }
105
105
  ),
106
- b
106
+ T
107
107
  ] });
108
108
  };
109
109
  export {