@cuemath/leap 3.0.1-hg1 → 3.0.1

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,5 +1,5 @@
1
1
  import { State as e } from "./sign-up-types.js";
2
- const a = [e.ACTIVE, e.PAUSED, e.PAID], h = [e.TRIAL, e.DEMO], p = [
2
+ const h = [e.ACTIVE, e.PAUSED, e.PAID], i = [e.TRIAL, e.DEMO], p = [
3
3
  { label: "2", key: "2", sup: "nd" },
4
4
  { label: "3", key: "3", sup: "rd" },
5
5
  { label: "4", key: "4", sup: "th" },
@@ -11,14 +11,14 @@ const a = [e.ACTIVE, e.PAUSED, e.PAID], h = [e.TRIAL, e.DEMO], p = [
11
11
  { label: "10", key: "10", sup: "th" },
12
12
  { label: "11", key: "11", sup: "th" },
13
13
  { label: "12", key: "12", sup: "th" }
14
- ], t = 440, s = 640, l = window.innerWidth / t, i = window.innerHeight / s, n = window.innerWidth < window.innerHeight ? l : i, r = Math.min(s * n, s), u = Math.min(t * n, t);
14
+ ], t = 440, s = 640, n = window.innerWidth / t, a = window.innerHeight / s, l = Math.min(n, a), u = Math.min(s * l, s), b = Math.min(t * l, t);
15
15
  export {
16
16
  s as ACTUAL_HEIGHT,
17
17
  t as ACTUAL_WIDTH,
18
- r as CONTAINER_HEIGHT,
19
- u as CONTAINER_WIDTH,
18
+ u as CONTAINER_HEIGHT,
19
+ b as CONTAINER_WIDTH,
20
20
  p as GRADES,
21
- a as userIsEnrolledCases,
22
- h as userIsOnTrialCases
21
+ h as userIsEnrolledCases,
22
+ i as userIsOnTrialCases
23
23
  };
24
24
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../../../src/features/circle-games/sign-up/constants.ts"],"sourcesContent":["import type { Grade } from './comp/grade-input/grade-input-types';\n\nimport { State } from './sign-up-types';\n\nexport const userIsEnrolledCases = [State.ACTIVE, State.PAUSED, State.PAID];\nexport const userIsOnTrialCases = [State.TRIAL, State.DEMO];\n\nexport const GRADES: Grade[] = [\n { label: '2', key: '2', sup: 'nd' },\n { label: '3', key: '3', sup: 'rd' },\n { label: '4', key: '4', sup: 'th' },\n { label: '5', key: '5', sup: 'th' },\n { label: '6', key: '6', sup: 'th' },\n { label: '7', key: '7', sup: 'th' },\n { label: '8', key: '8', sup: 'th' },\n { label: '9', key: '9', sup: 'th' },\n { label: '10', key: '10', sup: 'th' },\n { label: '11', key: '11', sup: 'th' },\n { label: '12', key: '12', sup: 'th' },\n];\n\nexport const MIN_HEIGHT_TO_SUPPORT = 540;\nexport const ACTUAL_WIDTH = 440;\nexport const ACTUAL_HEIGHT = 640;\n\nconst widthRatio = window.innerWidth / ACTUAL_WIDTH;\nconst heightRatio = window.innerHeight / ACTUAL_HEIGHT;\nconst ratio = window.innerWidth < window.innerHeight ? widthRatio : heightRatio;\n\nexport const CONTAINER_HEIGHT = Math.min(ACTUAL_HEIGHT * ratio, ACTUAL_HEIGHT);\nexport const CONTAINER_WIDTH = Math.min(ACTUAL_WIDTH * ratio, ACTUAL_WIDTH);\n"],"names":["userIsEnrolledCases","State","userIsOnTrialCases","GRADES","ACTUAL_WIDTH","ACTUAL_HEIGHT","widthRatio","heightRatio","ratio","CONTAINER_HEIGHT","CONTAINER_WIDTH"],"mappings":";AAIO,MAAMA,IAAsB,CAACC,EAAM,QAAQA,EAAM,QAAQA,EAAM,IAAI,GAC7DC,IAAqB,CAACD,EAAM,OAAOA,EAAM,IAAI,GAE7CE,IAAkB;AAAA,EAC7B,EAAE,OAAO,KAAK,KAAK,KAAK,KAAK,KAAK;AAAA,EAClC,EAAE,OAAO,KAAK,KAAK,KAAK,KAAK,KAAK;AAAA,EAClC,EAAE,OAAO,KAAK,KAAK,KAAK,KAAK,KAAK;AAAA,EAClC,EAAE,OAAO,KAAK,KAAK,KAAK,KAAK,KAAK;AAAA,EAClC,EAAE,OAAO,KAAK,KAAK,KAAK,KAAK,KAAK;AAAA,EAClC,EAAE,OAAO,KAAK,KAAK,KAAK,KAAK,KAAK;AAAA,EAClC,EAAE,OAAO,KAAK,KAAK,KAAK,KAAK,KAAK;AAAA,EAClC,EAAE,OAAO,KAAK,KAAK,KAAK,KAAK,KAAK;AAAA,EAClC,EAAE,OAAO,MAAM,KAAK,MAAM,KAAK,KAAK;AAAA,EACpC,EAAE,OAAO,MAAM,KAAK,MAAM,KAAK,KAAK;AAAA,EACpC,EAAE,OAAO,MAAM,KAAK,MAAM,KAAK,KAAK;AACtC,GAGaC,IAAe,KACfC,IAAgB,KAEvBC,IAAa,OAAO,aAAaF,GACjCG,IAAc,OAAO,cAAcF,GACnCG,IAAQ,OAAO,aAAa,OAAO,cAAcF,IAAaC,GAEvDE,IAAmB,KAAK,IAAIJ,IAAgBG,GAAOH,CAAa,GAChEK,IAAkB,KAAK,IAAIN,IAAeI,GAAOJ,CAAY;"}
1
+ {"version":3,"file":"constants.js","sources":["../../../../src/features/circle-games/sign-up/constants.ts"],"sourcesContent":["import type { Grade } from './comp/grade-input/grade-input-types';\n\nimport { State } from './sign-up-types';\n\nexport const userIsEnrolledCases = [State.ACTIVE, State.PAUSED, State.PAID];\nexport const userIsOnTrialCases = [State.TRIAL, State.DEMO];\n\nexport const GRADES: Grade[] = [\n { label: '2', key: '2', sup: 'nd' },\n { label: '3', key: '3', sup: 'rd' },\n { label: '4', key: '4', sup: 'th' },\n { label: '5', key: '5', sup: 'th' },\n { label: '6', key: '6', sup: 'th' },\n { label: '7', key: '7', sup: 'th' },\n { label: '8', key: '8', sup: 'th' },\n { label: '9', key: '9', sup: 'th' },\n { label: '10', key: '10', sup: 'th' },\n { label: '11', key: '11', sup: 'th' },\n { label: '12', key: '12', sup: 'th' },\n];\n\nexport const MIN_HEIGHT_TO_SUPPORT = 540;\nexport const ACTUAL_WIDTH = 440;\nexport const ACTUAL_HEIGHT = 640;\n\nconst widthRatio = window.innerWidth / ACTUAL_WIDTH;\nconst heightRatio = window.innerHeight / ACTUAL_HEIGHT;\nconst ratio = Math.min(widthRatio, heightRatio);\n\nexport const CONTAINER_HEIGHT = Math.min(ACTUAL_HEIGHT * ratio, ACTUAL_HEIGHT);\nexport const CONTAINER_WIDTH = Math.min(ACTUAL_WIDTH * ratio, ACTUAL_WIDTH);\n"],"names":["userIsEnrolledCases","State","userIsOnTrialCases","GRADES","ACTUAL_WIDTH","ACTUAL_HEIGHT","widthRatio","heightRatio","ratio","CONTAINER_HEIGHT","CONTAINER_WIDTH"],"mappings":";AAIO,MAAMA,IAAsB,CAACC,EAAM,QAAQA,EAAM,QAAQA,EAAM,IAAI,GAC7DC,IAAqB,CAACD,EAAM,OAAOA,EAAM,IAAI,GAE7CE,IAAkB;AAAA,EAC7B,EAAE,OAAO,KAAK,KAAK,KAAK,KAAK,KAAK;AAAA,EAClC,EAAE,OAAO,KAAK,KAAK,KAAK,KAAK,KAAK;AAAA,EAClC,EAAE,OAAO,KAAK,KAAK,KAAK,KAAK,KAAK;AAAA,EAClC,EAAE,OAAO,KAAK,KAAK,KAAK,KAAK,KAAK;AAAA,EAClC,EAAE,OAAO,KAAK,KAAK,KAAK,KAAK,KAAK;AAAA,EAClC,EAAE,OAAO,KAAK,KAAK,KAAK,KAAK,KAAK;AAAA,EAClC,EAAE,OAAO,KAAK,KAAK,KAAK,KAAK,KAAK;AAAA,EAClC,EAAE,OAAO,KAAK,KAAK,KAAK,KAAK,KAAK;AAAA,EAClC,EAAE,OAAO,MAAM,KAAK,MAAM,KAAK,KAAK;AAAA,EACpC,EAAE,OAAO,MAAM,KAAK,MAAM,KAAK,KAAK;AAAA,EACpC,EAAE,OAAO,MAAM,KAAK,MAAM,KAAK,KAAK;AACtC,GAGaC,IAAe,KACfC,IAAgB,KAEvBC,IAAa,OAAO,aAAaF,GACjCG,IAAc,OAAO,cAAcF,GACnCG,IAAQ,KAAK,IAAIF,GAAYC,CAAW,GAEjCE,IAAmB,KAAK,IAAIJ,IAAgBG,GAAOH,CAAa,GAChEK,IAAkB,KAAK,IAAIN,IAAeI,GAAOJ,CAAY;"}
@@ -1,48 +1,52 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { useRef as n, useCallback as p, useMemo as S, useEffect as x } from "react";
3
- import N from "../../chapters-v2/chapter-details/block-sections/block-sections.js";
1
+ import { jsxs as x, jsx as o } from "react/jsx-runtime";
2
+ import { useRef as n, useCallback as p, useMemo as R, useEffect as N } from "react";
3
+ import _ from "../../chapters-v2/chapter-details/block-sections/block-sections.js";
4
4
  import L from "../../chapters-v2/chapter-details/chapter-banner/chapter-banner.js";
5
- import P from "../../chapters-v2/chapter-details/chapter-details.js";
6
- import _ from "../../ui/layout/flex-view.js";
7
- import { JOURNEY_ID_STUDENT as I } from "../journey-id/journey-id-student.js";
8
- import { PROGRESS_STAT_MOCK as k, BLOCK_MOCKS as K } from "../mocks/chapter-page-journey-mock-data.js";
5
+ import I from "../../chapters-v2/chapter-details/chapter-details.js";
6
+ import k from "../../ui/layout/flex-view.js";
7
+ import P from "../../ui/separator/separator.js";
8
+ import { JOURNEY_ID_STUDENT as K } from "../journey-id/journey-id-student.js";
9
+ import { PROGRESS_STAT_MOCK as y, BLOCK_MOCKS as H } from "../mocks/chapter-page-journey-mock-data.js";
9
10
  import { IndicatorType as l } from "../use-journey/constants.js";
10
- import { useJourney as H } from "../use-journey/use-journey.js";
11
+ import { useJourney as v } from "../use-journey/use-journey.js";
11
12
  import a from "./use-home-page-journey/tooltip-item.js";
12
- const F = () => {
13
- const t = I.CHAPTER_PAGE_JOURNEY, e = n(null), r = n(null), s = n(null), c = n([]), { nextCoachmark: d, setJourney: h, endJourney: C } = H(), i = p(() => {
13
+ const $ = () => {
14
+ const t = K.CHAPTER_PAGE_JOURNEY, r = n(null), e = n(null), s = n(null), c = n([]), { nextCoachmark: d, setJourney: h, endJourney: C } = v(), i = p(() => {
14
15
  d(t, !1, 0, !0);
15
16
  }, [t, d]), g = p(() => {
16
17
  document.body.style.overflow = "unset", C(t);
17
18
  }, [C, t]), f = p(
18
- ({ chapterDetails: u, userChapterId: A, studentId: B, userType: T }) => {
19
- const { name: O, image_hue: m, image_url: b } = u;
20
- if (!(e != null && e.current) || !(r != null && r.current) || !s.current)
19
+ ({ chapterDetails: m, userChapterId: B, studentId: E, userType: T }) => {
20
+ const { name: O, image_hue: u, image_url: b } = m;
21
+ if (!(r != null && r.current) || !(e != null && e.current) || !s.current)
21
22
  return;
22
- const E = e.current.getBoundingClientRect(), R = [
23
+ const S = [
23
24
  {
24
- originalElementToHighlightRef: e,
25
+ originalElementToHighlightRef: r,
25
26
  isActive: !1,
26
27
  type: l.TOOLTIP,
27
- elementToHighlight: /* @__PURE__ */ o(
28
- P,
29
- {
30
- userChapterId: A,
31
- studentId: B,
32
- userType: T,
33
- onBlockSkipUnskip: () => null,
34
- onNodeAttempt: () => null,
35
- onNodeAttemptLocationChange: () => null,
36
- onNodeMarkAsDone: () => null,
37
- onNodeReattempt: () => null,
38
- onNodeReview: () => null,
39
- onNodeView: () => null,
40
- onExit: () => null
41
- }
42
- ),
28
+ elementToHighlight: /* @__PURE__ */ x(k, { children: [
29
+ /* @__PURE__ */ o(P, { heightX: 10 }),
30
+ /* @__PURE__ */ o(
31
+ I,
32
+ {
33
+ userChapterId: B,
34
+ studentId: E,
35
+ userType: T,
36
+ onBlockSkipUnskip: () => null,
37
+ onNodeAttempt: () => null,
38
+ onNodeAttemptLocationChange: () => null,
39
+ onNodeMarkAsDone: () => null,
40
+ onNodeReattempt: () => null,
41
+ onNodeReview: () => null,
42
+ onNodeView: () => null,
43
+ onExit: () => null
44
+ }
45
+ )
46
+ ] }),
43
47
  indicator: {
44
- position: "left",
45
- tooltipYCoOrdinates: -(E.height / 2) + 178,
48
+ position: "top",
49
+ tooltipYCoOrdinates: -140,
46
50
  backgroundColor: "BLUE_4",
47
51
  borderColor: "BLACK",
48
52
  arrowColor: "BLACK",
@@ -59,14 +63,14 @@ const F = () => {
59
63
  }
60
64
  },
61
65
  {
62
- originalElementToHighlightRef: r,
66
+ originalElementToHighlightRef: e,
63
67
  elementToHighlight: /* @__PURE__ */ o(
64
68
  L,
65
69
  {
66
70
  title: O,
67
- progressStats: k,
71
+ progressStats: y,
68
72
  imageUrl: b,
69
- imageHue: m
73
+ imageHue: u
70
74
  }
71
75
  ),
72
76
  type: l.TOOLTIP,
@@ -91,14 +95,14 @@ const F = () => {
91
95
  isActive: !1
92
96
  },
93
97
  {
94
- originalElementToHighlightRef: r,
98
+ originalElementToHighlightRef: e,
95
99
  elementToHighlight: /* @__PURE__ */ o(
96
100
  L,
97
101
  {
98
102
  title: O,
99
- progressStats: k,
103
+ progressStats: y,
100
104
  imageUrl: b,
101
- imageHue: m
105
+ imageHue: u
102
106
  }
103
107
  ),
104
108
  type: l.TOOLTIP,
@@ -124,7 +128,7 @@ const F = () => {
124
128
  },
125
129
  {
126
130
  originalElementToHighlightRef: s,
127
- elementToHighlight: /* @__PURE__ */ o(_, { $widthX: 50, children: /* @__PURE__ */ o(N, { userType: T, blocks: K, imageHue: m }) }),
131
+ elementToHighlight: /* @__PURE__ */ o(k, { $widthX: 50, children: /* @__PURE__ */ o(_, { userType: T, blocks: H, imageHue: u }) }),
128
132
  type: l.TOOLTIP,
129
133
  indicator: {
130
134
  position: "top",
@@ -147,27 +151,27 @@ const F = () => {
147
151
  isActive: !1
148
152
  }
149
153
  ];
150
- h(t, R);
154
+ h(t, S);
151
155
  const w = setTimeout(() => {
152
156
  clearTimeout(w), window.scrollTo(0, 0), document.body.style.overflow = "hidden", i();
153
157
  }, 500);
154
158
  c.current.push(w);
155
159
  },
156
160
  [i, g, h, t]
157
- ), y = S(
161
+ ), A = R(
158
162
  () => ({
159
- chapterPageRef: e,
160
- bannerRef: r,
163
+ chapterPageRef: r,
164
+ bannerRef: e,
161
165
  coreBlocksRef: s,
162
166
  startJourney: f
163
167
  }),
164
168
  [f]
165
169
  );
166
- return x(() => () => {
167
- c.current.forEach((u) => clearTimeout(u)), c.current = [];
168
- }, []), y;
170
+ return N(() => () => {
171
+ c.current.forEach((m) => clearTimeout(m)), c.current = [];
172
+ }, []), A;
169
173
  };
170
174
  export {
171
- F as useChapterPageJourney
175
+ $ as useChapterPageJourney
172
176
  };
173
177
  //# 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 { 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 FlexView from '../../ui/layout/flex-view';\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';\nimport TooltipItem from './use-home-page-journey/tooltip-item';\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 document.body.style.overflow = 'unset';\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 <TooltipItem\n text=\"Welcome to the all new chapter experience.\"\n buttonLabel=\"Next\"\n onButtonClick={handleNextCoachmark}\n />\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 <TooltipItem\n text=\"A chapter is divided into *core sheets (compulsory), and supplementary sheets.\"\n buttonLabel=\"Next\"\n onButtonClick={handleNextCoachmark}\n />\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 <TooltipItem\n text=\"Easily track the progress of the core sheets.\"\n buttonLabel=\"Next\"\n onButtonClick={handleNextCoachmark}\n />\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 <TooltipItem\n text=\"Core sheets are marked to help you find them faster.\"\n buttonLabel=\"Got it\"\n onButtonClick={handleEndJourney}\n />\n ),\n } as IArrowTooltipProps,\n isActive: false,\n },\n ];\n\n setJourney(journeyId, chapterPageSteps);\n\n const delayBeforeStart = setTimeout(() => {\n clearTimeout(delayBeforeStart);\n window.scrollTo(0, 0);\n document.body.style.overflow = 'hidden';\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","TooltipItem","ChapterBanner","PROGRESS_STAT_MOCK","FlexView","BlockSections","BLOCK_MOCKS","delayBeforeStart","data","useMemo","useEffect","timer"],"mappings":";;;;;;;;;;;AAwBO,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;AAChC,aAAA,KAAK,MAAM,WAAW,SAC/BH,EAAWT,CAAS;AAAA,EAAA,GACnB,CAACS,GAAYT,CAAS,CAAC,GAEpBc,IAAeF;AAAA,IACnB,CAAC,EAAE,gBAAAG,GAAgB,eAAAC,GAAe,WAAAC,GAAW,UAAAC,QAA0C;AACrF,YAAM,EAAE,MAAAC,GAAM,WAAWC,GAAU,WAAWC,EAAa,IAAAN;AAEvD,UAAA,EAACb,KAAA,QAAAA,EAAgB,YAAW,EAACE,KAAA,QAAAA,EAAW,YAAW,CAACC,EAAc;AACpE;AAGI,YAAAiB,IAAkBpB,EAAe,QAAQ,sBAAsB,GAE/DqB,IAAsC;AAAA,QAC1C;AAAA,UACE,+BAA+BrB;AAAA,UAC/B,UAAU;AA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AW,UACXtB;SACnB,GAAG;AAEI,MAAAL,EAAA,QAAQ,KAAK2B,CAAgB;AAAA,IACzC;AAAA,IACA,CAACtB,GAAqBE,GAAkBL,GAAYR,CAAS;AAAA,EAAA,GAGzDkC,IAAOC;AAAA,IACX,OAAO;AAAA,MACL,gBAAAjC;AAAA,MACA,WAAAE;AAAA,MACA,eAAAC;AAAA,MACA,cAAAS;AAAA,IAAA;AAAA,IAEF,CAACA,CAAY;AAAA,EAAA;AAGf,SAAAsB,EAAU,MACD,MAAM;AACX,IAAA9B,EAAU,QAAQ,QAAQ,CAAS+B,MAAA,aAAaA,CAAK,CAAC,GACtD/B,EAAU,UAAU;EAAC,GAEtB,CAAE,CAAA,GAEE4B;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 FlexView from '../../ui/layout/flex-view';\nimport Separator from '../../ui/separator/separator';\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';\nimport TooltipItem from './use-home-page-journey/tooltip-item';\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 document.body.style.overflow = 'unset';\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 chapterPageSteps: ICoachmarkProps[] = [\n {\n originalElementToHighlightRef: chapterPageRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: (\n <FlexView>\n <Separator heightX={10} />\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 </FlexView>\n ),\n indicator: {\n position: 'top',\n tooltipYCoOrdinates: -140,\n backgroundColor: 'BLUE_4',\n borderColor: 'BLACK',\n arrowColor: 'BLACK',\n arrowSize: 12,\n width: 264,\n tooltipItem: (\n <TooltipItem\n text=\"Welcome to the all new chapter experience.\"\n buttonLabel=\"Next\"\n onButtonClick={handleNextCoachmark}\n />\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 <TooltipItem\n text=\"A chapter is divided into *core sheets (compulsory), and supplementary sheets.\"\n buttonLabel=\"Next\"\n onButtonClick={handleNextCoachmark}\n />\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 <TooltipItem\n text=\"Easily track the progress of the core sheets.\"\n buttonLabel=\"Next\"\n onButtonClick={handleNextCoachmark}\n />\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 <TooltipItem\n text=\"Core sheets are marked to help you find them faster.\"\n buttonLabel=\"Got it\"\n onButtonClick={handleEndJourney}\n />\n ),\n } as IArrowTooltipProps,\n isActive: false,\n },\n ];\n\n setJourney(journeyId, chapterPageSteps);\n\n const delayBeforeStart = setTimeout(() => {\n clearTimeout(delayBeforeStart);\n window.scrollTo(0, 0);\n document.body.style.overflow = 'hidden';\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","chapterPageSteps","IndicatorType","FlexView","jsx","Separator","ChapterDetails","TooltipItem","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;AAChC,aAAA,KAAK,MAAM,WAAW,SAC/BH,EAAWT,CAAS;AAAA,EAAA,GACnB,CAACS,GAAYT,CAAS,CAAC,GAEpBc,IAAeF;AAAA,IACnB,CAAC,EAAE,gBAAAG,GAAgB,eAAAC,GAAe,W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ACZ,WAAW;AAAA,YACX,OAAO;AAAA,YACP,aACE,gBAAAE;AAAA,cAACG;AAAA,cAAA;AAAA,gBACC,MAAK;AAAA,gBACL,aAAY;AAAA,gBACZ,eAAef;AAAA,cAAA;AAAA,YACjB;AAAA,UAEJ;AAAA,UACA,UAAU;AAAA,QACZ;AAAA,MAAA;AAGF,MAAAL,EAAWR,GAAWsB,CAAgB;AAEhC,YAAAW,IAAmB,WAAW,MAAM;AACxC,qBAAaA,CAAgB,GACtB,OAAA,SAAS,GAAG,CAAC,GACX,SAAA,KAAK,MAAM,WAAW,UACXtB;SACnB,GAAG;AAEI,MAAAL,EAAA,QAAQ,KAAK2B,CAAgB;AAAA,IACzC;AAAA,IACA,CAACtB,GAAqBE,GAAkBL,GAAYR,CAAS;AAAA,EAAA,GAGzDkC,IAAOC;AAAA,IACX,OAAO;AAAA,MACL,gBAAAjC;AAAA,MACA,WAAAE;AAAA,MACA,eAAAC;AAAA,MACA,cAAAS;AAAA,IAAA;AAAA,IAEF,CAACA,CAAY;AAAA,EAAA;AAGf,SAAAsB,EAAU,MACD,MAAM;AACX,IAAA9B,EAAU,QAAQ,QAAQ,CAAS+B,MAAA,aAAaA,CAAK,CAAC,GACtD/B,EAAU,UAAU;EAAC,GAEtB,CAAE,CAAA,GAEE4B;AACT;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuemath/leap",
3
- "version": "3.0.1-hg1",
3
+ "version": "3.0.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -93,5 +93,6 @@
93
93
  "vite-plugin-dts": "3.6.4",
94
94
  "vite-plugin-svgr": "3.2.0",
95
95
  "vite-tsconfig-paths": "^4.2.2"
96
- }
96
+ },
97
+ "packageManager": "yarn@4.4.1"
97
98
  }