@cuemath/leap 2.9.9-as2 → 2.9.9-as4

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,36 +1,36 @@
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";
1
+ import { jsx as e, jsxs as n } from "react/jsx-runtime";
2
+ import { useRef as s, useCallback as C, useMemo as P, useEffect as _ } from "react";
3
+ import X from "../../chapters-v2/chapter-details/block-sections/block-sections.js";
4
+ import x from "../../chapters-v2/chapter-details/chapter-banner/chapter-banner.js";
4
5
  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)
6
+ import a from "../../ui/buttons/button/button.js";
7
+ import l from "../../ui/layout/flex-view.js";
8
+ import c from "../../ui/text/text.js";
9
+ import { JOURNEY_ID_STUDENT as K } from "../journey-id/journey-id-student.js";
10
+ import { PROGRESS_STAT_MOCK as y, BLOCK_MOCKS as H } from "../mocks/chapter-page-journey-mock-data.js";
11
+ import { IndicatorType as d } from "../use-journey/constants.js";
12
+ import { useJourney as $ } from "../use-journey/use-journey.js";
13
+ const q = () => {
14
+ const o = K.CHAPTER_PAGE_JOURNEY, t = s(null), r = s(null), m = s(null), h = s([]), { nextCoachmark: g, setJourney: f, endJourney: A } = $(), i = C(() => {
15
+ g(o, !1, 0, !0);
16
+ }, [o, g]), w = C(() => {
17
+ A(o);
18
+ }, [A, o]), T = C(
19
+ ({ chapterDetails: p, userChapterId: B, studentId: L, userType: b }) => {
20
+ const { name: O, image_hue: u, image_url: R } = p;
21
+ if (!(t != null && t.current) || !(r != null && r.current) || !m.current)
22
22
  return;
23
- const k = t.current.getBoundingClientRect(), O = [
23
+ const S = t.current.getBoundingClientRect(), N = [
24
24
  {
25
25
  originalElementToHighlightRef: t,
26
26
  isActive: !1,
27
- type: p.TOOLTIP,
27
+ type: d.TOOLTIP,
28
28
  elementToHighlight: /* @__PURE__ */ e(
29
29
  I,
30
30
  {
31
- userChapterId: l.id,
32
- studentId: R,
33
- userType: E,
31
+ userChapterId: B,
32
+ studentId: L,
33
+ userType: b,
34
34
  onBlockSkipUnskip: () => null,
35
35
  onNodeAttempt: () => null,
36
36
  onNodeAttemptLocationChange: () => null,
@@ -43,22 +43,22 @@ const Y = () => {
43
43
  ),
44
44
  indicator: {
45
45
  position: "left",
46
- tooltipYCoOrdinates: -(k.height / 2) + 178,
46
+ tooltipYCoOrdinates: -(S.height / 2) + 178,
47
47
  backgroundColor: "BLUE_4",
48
48
  borderColor: "BLACK",
49
49
  arrowColor: "BLACK",
50
50
  arrowSize: 12,
51
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." }),
52
+ tooltipItem: /* @__PURE__ */ n(l, { $flexRowGapX: 0.75, children: [
53
+ /* @__PURE__ */ e(c, { $renderAs: "ab2-bold", children: "Welcome to the all new chapter experience." }),
54
54
  /* @__PURE__ */ e(
55
- c,
55
+ a,
56
56
  {
57
57
  label: "Next",
58
58
  size: "xsmall",
59
59
  widthX: 6,
60
60
  renderAs: "secondary",
61
- onClick: () => i(o, !1, 0, !0)
61
+ onClick: i
62
62
  }
63
63
  )
64
64
  ] })
@@ -67,15 +67,15 @@ const Y = () => {
67
67
  {
68
68
  originalElementToHighlightRef: r,
69
69
  elementToHighlight: /* @__PURE__ */ e(
70
- y,
70
+ x,
71
71
  {
72
- title: A,
73
- progressStats: f,
74
- imageUrl: w,
75
- imageHue: T
72
+ title: O,
73
+ progressStats: y,
74
+ imageUrl: R,
75
+ imageHue: u
76
76
  }
77
77
  ),
78
- type: p.TOOLTIP,
78
+ type: d.TOOLTIP,
79
79
  indicator: {
80
80
  position: "bottom",
81
81
  tooltipXCoOrdinates: -45,
@@ -85,16 +85,16 @@ const Y = () => {
85
85
  arrowColor: "BLACK",
86
86
  width: 264,
87
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." }),
88
+ tooltipItem: /* @__PURE__ */ n(l, { $flexRowGapX: 0.75, children: [
89
+ /* @__PURE__ */ e(c, { $renderAs: "ab2-bold", children: "A chapter is divided into *core sheets (compulsory), and supplementary sheets." }),
90
90
  /* @__PURE__ */ e(
91
- c,
91
+ a,
92
92
  {
93
93
  label: "Next",
94
94
  size: "xsmall",
95
95
  widthX: 6,
96
96
  renderAs: "secondary",
97
- onClick: () => i(o, !1, 0, !0)
97
+ onClick: i
98
98
  }
99
99
  )
100
100
  ] })
@@ -104,15 +104,15 @@ const Y = () => {
104
104
  {
105
105
  originalElementToHighlightRef: r,
106
106
  elementToHighlight: /* @__PURE__ */ e(
107
- y,
107
+ x,
108
108
  {
109
- title: A,
110
- progressStats: f,
111
- imageUrl: w,
112
- imageHue: T
109
+ title: O,
110
+ progressStats: y,
111
+ imageUrl: R,
112
+ imageHue: u
113
113
  }
114
114
  ),
115
- type: p.TOOLTIP,
115
+ type: d.TOOLTIP,
116
116
  indicator: {
117
117
  position: "bottom",
118
118
  tooltipXCoOrdinates: -275,
@@ -122,73 +122,73 @@ const Y = () => {
122
122
  arrowColor: "BLACK",
123
123
  arrowSize: 12,
124
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." }),
125
+ tooltipItem: /* @__PURE__ */ n(l, { $flexRowGapX: 0.75, children: [
126
+ /* @__PURE__ */ e(c, { $renderAs: "ab2-bold", children: "Easily track the progress of the core sheets." }),
127
127
  /* @__PURE__ */ e(
128
- c,
128
+ a,
129
+ {
130
+ label: "Next",
131
+ size: "xsmall",
132
+ widthX: 6,
133
+ renderAs: "secondary",
134
+ onClick: i
135
+ }
136
+ )
137
+ ] })
138
+ },
139
+ isActive: !1
140
+ },
141
+ {
142
+ originalElementToHighlightRef: m,
143
+ elementToHighlight: /* @__PURE__ */ e(l, { $widthX: 50, children: /* @__PURE__ */ e(X, { userType: b, blocks: H, imageHue: u }) }),
144
+ type: d.TOOLTIP,
145
+ indicator: {
146
+ position: "top",
147
+ tooltipXCoOrdinates: -150,
148
+ tooltipYCoOrdinates: -260,
149
+ backgroundColor: "PURPLE_4",
150
+ borderColor: "BLACK",
151
+ arrowColor: "BLACK",
152
+ arrowSize: 12,
153
+ width: 264,
154
+ tooltipItem: /* @__PURE__ */ n(l, { $flexRowGapX: 0.75, children: [
155
+ /* @__PURE__ */ e(c, { $renderAs: "ab2-bold", children: "Easily track the progress of the core sheets." }),
156
+ /* @__PURE__ */ e(
157
+ a,
129
158
  {
130
159
  label: "Got it",
131
160
  size: "xsmall",
132
161
  widthX: 6,
133
162
  renderAs: "secondary",
134
- onClick: () => g(o)
163
+ onClick: w
135
164
  }
136
165
  )
137
166
  ] })
138
167
  },
139
168
  isActive: !1
140
169
  }
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
170
  ];
171
- h(o, O);
172
- const b = setTimeout(() => {
173
- clearTimeout(b), i(o, !1, 0, !0);
174
- }, 200);
175
- s.current.push(b);
171
+ f(o, N);
172
+ const k = setTimeout(() => {
173
+ clearTimeout(k), i();
174
+ }, 500);
175
+ h.current.push(k);
176
176
  },
177
- [h, o, i, g]
178
- ), x = L(
177
+ [i, w, f, o]
178
+ ), E = P(
179
179
  () => ({
180
180
  chapterPageRef: t,
181
181
  bannerRef: r,
182
- coreBlocksRef: u,
183
- startJourney: C
182
+ coreBlocksRef: m,
183
+ startJourney: T
184
184
  }),
185
- [C]
185
+ [T]
186
186
  );
187
- return N(() => () => {
188
- s.current.forEach((l) => clearTimeout(l)), s.current = [];
189
- }, []), x;
187
+ return _(() => () => {
188
+ h.current.forEach((p) => clearTimeout(p)), h.current = [];
189
+ }, []), E;
190
190
  };
191
191
  export {
192
- Y as useChapterPageJourney
192
+ q as useChapterPageJourney
193
193
  };
194
194
  //# sourceMappingURL=use-chapter-journey.js.map
@@ -1 +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,YAAAC,GAAY,YAAAC,MAAeC,EAAW,GAEvDC,IAAeC;AAAA,IACnB,CAAC,EAAE,gBAAAC,GAAgB,WAAAC,GAAW,UAAAC,QAA0C;AAGhE,YAAA;AAAA,QACJ,eAAeC;AAAA,QACf,MAAAC;AAAA,QACA,WAAWC;AAAA,QACX,WAAWC;AAAA;AAAA,MAET,IAAAN;AAEA,UAAA,EAACX,KAAA,QAAAA,EAAgB,YAAW,EAACE,KAAA,QAAAA,EAAW,YAAW,CAACC,EAAc;AACpE;AAGI,YAAAe,IAAkBlB,EAAe,QAAQ,sBAAsB,GAE/DmB,IAAsC;AAAA,QAC1C;AAAA,UACE,+BAA+BnB;AAAA,UAC/B,UAAU;AAAA,UACV,MAAMoB,EAAc;AAAA,UACpB,oBACE,gBAAAC;AAAA,YAACC;AAAA,YAAA;AAAA,cACC,eAAeX,EAAe;AAAA,cAC9B,WAAAC;AAAA,cACA,UAAAC;AAAA,cACA,mBAAmB,MAAM;AAAA,cACzB,eAAe,MAAM;AAAA,cACrB,6BAA6B,MAAM;AAAA,cACnC,kBAAkB,MAAM;AAAA,cACxB,iBAAiB,MAAM;AAAA,cACvB,cAAc,MAAM;AAAA,cACpB,YAAY,MAAM;AAAA,cAClB,QAAQ,MAAM;AAAA,YAAA;AAAA,UAChB;AAAA,UAEF,WAAW;A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AA,EAAA,GAG7CsB,IAAOC;AAAA,IACX,OAAO;AAAA,MACL,gBAAA9B;AAAA,MACA,WAAAE;AAAA,MACA,eAAAC;AAAA,MACA,cAAAM;AAAA,IAAA;AAAA,IAEF,CAACA,CAAY;AAAA,EAAA;AAGf,SAAAsB,EAAU,MACD,MAAM;AACX,IAAA3B,EAAU,QAAQ,QAAQ,CAAS4B,MAAA,aAAaA,CAAK,CAAC,GACtD5B,EAAU,UAAU;EAAC,GAEtB,CAAE,CAAA,GAEEyB;AACT;"}
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 { TUserTypes } from '../../ui/types';\nimport type { ICoachmarkProps } from '../use-journey/journey-context-types';\n\nimport { useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport BlockSections from '../../chapters-v2/chapter-details/block-sections/block-sections';\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 { BLOCK_MOCKS, PROGRESS_STAT_MOCK } from '../mocks/chapter-page-journey-mock-data';\nimport { IndicatorType } from '../use-journey/constants';\nimport { useJourney } from '../use-journey/use-journey';\n\ninterface IChapterStartJourneyProps {\n chapterDetails: IUserChapterData;\n userChapterId: string;\n studentId: string;\n userType: TUserTypes;\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 handleNextCoachmark = useCallback(() => {\n nextCoachmark(journeyId, false, 0, true);\n }, [journeyId, nextCoachmark]);\n\n const handleEndJourney = useCallback(() => {\n endJourney(journeyId);\n }, [endJourney, journeyId]);\n\n const startJourney = useCallback(\n ({ chapterDetails, userChapterId, studentId, userType }: IChapterStartJourneyProps) => {\n const { name, image_hue: imageHue, image_url: imageUrl } = 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={userChapterId}\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={handleNextCoachmark}\n />\n </FlexView>\n ),\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: bannerRef,\n elementToHighlight: (\n <ChapterBanner\n title={name}\n progressStats={PROGRESS_STAT_MOCK}\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={handleNextCoachmark}\n />\n </FlexView>\n ),\n } as IArrowTooltipProps,\n isActive: false,\n },\n {\n originalElementToHighlightRef: bannerRef,\n elementToHighlight: (\n <ChapterBanner\n title={name}\n progressStats={PROGRESS_STAT_MOCK}\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=\"Next\"\n size=\"xsmall\"\n widthX={6}\n renderAs=\"secondary\"\n onClick={handleNextCoachmark}\n />\n </FlexView>\n ),\n } as IArrowTooltipProps,\n isActive: false,\n },\n {\n originalElementToHighlightRef: coreBlocksRef,\n elementToHighlight: (\n <FlexView $widthX={50}>\n <BlockSections userType={userType} blocks={BLOCK_MOCKS} imageHue={imageHue} />\n </FlexView>\n ),\n type: IndicatorType.TOOLTIP,\n indicator: {\n position: 'top',\n tooltipXCoOrdinates: -150,\n tooltipYCoOrdinates: -260,\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={handleEndJourney}\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 handleNextCoachmark();\n }, 500);\n\n timerRefs.current.push(delayBeforeStart);\n },\n [handleNextCoachmark, handleEndJourney, setJourney, journeyId],\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","handleNextCoachmark","useCallback","handleEndJourney","startJourney","chapterDetails","userChapterId","studentId","userType","name","imageHue","imageUrl","chapterPageRect","chapterPageSteps","IndicatorType","jsx","ChapterDetails","jsxs","FlexView","Text","Button","ChapterBanner","PROGRESS_STAT_MOCK","BlockSections","BLOCK_MOCKS","delayBeforeStart","data","useMemo","useEffect","timer"],"mappings":";;;;;;;;;;;;AAyBO,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,YAAAC,GAAY,YAAAC,MAAeC,EAAW,GAEvDC,IAAsBC,EAAY,MAAM;AAC9B,IAAAL,EAAAP,GAAW,IAAO,GAAG,EAAI;AAAA,EAAA,GACtC,CAACA,GAAWO,CAAa,CAAC,GAEvBM,IAAmBD,EAAY,MAAM;A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