@cuemath/leap 2.8.57-rj-4 → 2.8.57

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,8 +1,9 @@
1
- const _ = "/api/v1", o = "/api/v2", p = "/api/v3", t = "/api/v3.1";
1
+ const _ = "/api", o = "/api/v1", p = "/api/v2", t = "/api/v3", a = "/api/v3.1";
2
2
  export {
3
- _ as BASE_URL_V1,
4
- o as BASE_URL_V2,
5
- p as BASE_URL_V3,
6
- t as BASE_URL_V3_1
3
+ _ as BASE_URL,
4
+ o as BASE_URL_V1,
5
+ p as BASE_URL_V2,
6
+ t as BASE_URL_V3,
7
+ a as BASE_URL_V3_1
7
8
  };
8
9
  //# sourceMappingURL=api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sources":["../../src/constants/api.ts"],"sourcesContent":["const BASE_URL_V1 = '/api/v1';\nconst BASE_URL_V2 = '/api/v2';\nconst BASE_URL_V3 = '/api/v3';\nconst BASE_URL_V3_1 = '/api/v3.1';\n\nexport { BASE_URL_V1, BASE_URL_V2, BASE_URL_V3, BASE_URL_V3_1 };\n"],"names":["BASE_URL_V1","BASE_URL_V2","BASE_URL_V3","BASE_URL_V3_1"],"mappings":"AAAA,MAAMA,IAAc,WACdC,IAAc,WACdC,IAAc,WACdC,IAAgB;"}
1
+ {"version":3,"file":"api.js","sources":["../../src/constants/api.ts"],"sourcesContent":["const BASE_URL = '/api';\nconst BASE_URL_V1 = '/api/v1';\nconst BASE_URL_V2 = '/api/v2';\nconst BASE_URL_V3 = '/api/v3';\nconst BASE_URL_V3_1 = '/api/v3.1';\n\nexport { BASE_URL, BASE_URL_V1, BASE_URL_V2, BASE_URL_V3, BASE_URL_V3_1 };\n"],"names":["BASE_URL","BASE_URL_V1","BASE_URL_V2","BASE_URL_V3","BASE_URL_V3_1"],"mappings":"AAAA,MAAMA,IAAW,QACXC,IAAc,WACdC,IAAc,WACdC,IAAc,WACdC,IAAgB;"}
@@ -2,12 +2,12 @@ import { jsx as t, Fragment as O } from "react/jsx-runtime";
2
2
  import { useRef as p, useCallback as f, useMemo as le, useEffect as ce } from "react";
3
3
  import z from "../../../../../assets/line-icons/icons/carat-right.js";
4
4
  import { PLATFORM_EVENTS_STUDENT as ee } from "../../../../analytics-events/platform-events-student.js";
5
- import { IndicatorType as a } from "../../../../journey/use-journey/constants.js";
5
+ import { IndicatorType as d } from "../../../../journey/use-journey/constants.js";
6
6
  import { useJourney as ae } from "../../../../journey/use-journey/use-journey.js";
7
7
  import te from "../../../../ui/buttons/icon-button/icon-button.js";
8
8
  import { useUIContext as de } from "../../../../ui/context/context.js";
9
9
  import S from "../../../../ui/layout/flex-view.js";
10
- import d from "../../../../ui/text/text.js";
10
+ import s from "../../../../ui/text/text.js";
11
11
  import { CIRCLE_ONBOARDING_ANALYTICS_STEPS as _ } from "../../../enum/circle-onboarding-steps.js";
12
12
  import { useCircleSounds as se } from "../../../hooks/use-circle-sounds/use-circle-sounds.js";
13
13
  import { SegmentedGameCard as he } from "../../comps/segmented-game-card/segmented-game-card.js";
@@ -18,7 +18,7 @@ const ke = ({
18
18
  carouselRefs: n,
19
19
  onSegmentClick: b
20
20
  }) => {
21
- const o = p(null), r = p(null), l = p(null), C = p([]), L = p(!1), { playButtonSound: R } = se(), { nextCoachmark: s, setJourney: P, endJourney: N } = ae(), { onEvent: A } = de(), y = f(
21
+ const o = p(null), r = p(null), a = p(null), C = p([]), L = p(!1), { playButtonSound: R } = se(), { nextCoachmark: l, setJourney: P, endJourney: N } = ae(), { onEvent: A } = de(), y = f(
22
22
  (e) => {
23
23
  A(ee.ONBOARDING_STEP_VIEWED, {
24
24
  step: e
@@ -35,25 +35,25 @@ const ke = ({
35
35
  ), h = f(
36
36
  (e, c, i, g, I = !1) => {
37
37
  var u, T;
38
- I || (R(), (T = n.current) == null || T.goToIndex(((u = n.current) == null ? void 0 : u.currentIndex) + 1), s(g, !1, ge)), y(e);
38
+ I || (R(), (T = n.current) == null || T.goToIndex(((u = n.current) == null ? void 0 : u.currentIndex) + 1), l(g, !1, ge)), y(e);
39
39
  const m = setTimeout(() => {
40
40
  clearTimeout(m), c.startLabelAnimation(i);
41
41
  }, me);
42
- C.current.push(m), s(g, !0, ue);
42
+ C.current.push(m), l(g, !0, ue);
43
43
  },
44
- [n, s, R, y]
44
+ [n, l, R, y]
45
45
  ), G = f(
46
46
  (e, c) => {
47
- b(e, Ee.PUZZLE), H(_.PUZZLE_ACTIVITY), N(c);
47
+ b(e, Ee.PUZZLE), H(_.PUZZLE_ACTIVITY), l(c), N(c);
48
48
  },
49
- [N, b, H]
49
+ [N, l, b, H]
50
50
  ), k = f(
51
51
  (e, c, i) => {
52
52
  var Y, v, B, U, V, x, D, M, J, W, X, $, F, Z, K, q, Q, j;
53
53
  if (L.current || !((Y = n == null ? void 0 : n.current) != null && Y.nextBtnRef.current) || !((v = r == null ? void 0 : r.current) != null && v.segmentedCardWrapperRef.current) || !((B = o == null ? void 0 : o.current) != null && B.labelRef.current) || !((U = r == null ? void 0 : r.current) != null && U.labelRef.current) || !e)
54
54
  return;
55
55
  L.current = !0;
56
- const g = ((D = (x = (V = l.current) == null ? void 0 : V.labelRef) == null ? void 0 : x.current) == null ? void 0 : D.getBoundingClientRect()) || {
56
+ const g = ((D = (x = (V = a.current) == null ? void 0 : V.labelRef) == null ? void 0 : x.current) == null ? void 0 : D.getBoundingClientRect()) || {
57
57
  height: 0,
58
58
  width: 0
59
59
  }, I = ((W = (J = (M = o.current) == null ? void 0 : M.labelRef) == null ? void 0 : J.current) == null ? void 0 : W.getBoundingClientRect()) || {
@@ -67,17 +67,17 @@ const ke = ({
67
67
  width: 0
68
68
  };
69
69
  let T = [];
70
- c && l.current && (T = [
70
+ c && a.current && (T = [
71
71
  {
72
- originalElementToHighlightRef: l.current.labelRef,
72
+ originalElementToHighlightRef: a.current.labelRef,
73
73
  isActive: !1,
74
- type: a.TOOLTIP,
74
+ type: d.TOOLTIP,
75
75
  elementToHighlight: /* @__PURE__ */ t(O, {}),
76
76
  indicator: {
77
77
  position: "right",
78
78
  backgroundColor: "BLUE_4",
79
79
  width: 264,
80
- tooltipItem: /* @__PURE__ */ t(S, { children: /* @__PURE__ */ t(d, { $renderAs: "ab2-bold", children: "Get faster & stay ahead in school. Practice 3 new skills everyday." }) }),
80
+ tooltipItem: /* @__PURE__ */ t(S, { children: /* @__PURE__ */ t(s, { $renderAs: "ab2-bold", children: "Get faster & stay ahead in school. Practice 3 new skills everyday." }) }),
81
81
  tooltipXCoOrdinates: g.width + 50,
82
82
  tooltipYCoOrdinates: g.height / 2
83
83
  }
@@ -85,7 +85,7 @@ const ke = ({
85
85
  {
86
86
  originalElementToHighlightRef: (Q = n.current) == null ? void 0 : Q.nextBtnRef,
87
87
  isActive: !1,
88
- type: a.NUDGE,
88
+ type: d.NUDGE,
89
89
  elementToHighlight: /* @__PURE__ */ t(
90
90
  te,
91
91
  {
@@ -102,7 +102,7 @@ const ke = ({
102
102
  ),
103
103
  indicator: {
104
104
  nudge: "click",
105
- content: /* @__PURE__ */ t(d, { $renderAs: "ab1", $color: "WHITE", children: "Click to proceed" }),
105
+ content: /* @__PURE__ */ t(s, { $renderAs: "ab1", $color: "WHITE", children: "Click to proceed" }),
106
106
  nudgePointerX: 0,
107
107
  nudgePointerY: 0
108
108
  }
@@ -112,13 +112,13 @@ const ke = ({
112
112
  {
113
113
  originalElementToHighlightRef: o.current.labelRef,
114
114
  isActive: !1,
115
- type: a.TOOLTIP,
115
+ type: d.TOOLTIP,
116
116
  elementToHighlight: /* @__PURE__ */ t(O, {}),
117
117
  indicator: {
118
118
  position: "right",
119
119
  backgroundColor: "ORANGE_4",
120
120
  width: 264,
121
- tooltipItem: /* @__PURE__ */ t(S, { children: /* @__PURE__ */ t(d, { $renderAs: "ab2-bold", children: "Train to think deeper & plan ahead. Play 3 new games everyday." }) }),
121
+ tooltipItem: /* @__PURE__ */ t(S, { children: /* @__PURE__ */ t(s, { $renderAs: "ab2-bold", children: "Train to think deeper & plan ahead. Play 3 new games everyday." }) }),
122
122
  tooltipXCoOrdinates: I.width + 50,
123
123
  tooltipYCoOrdinates: I.height / 2
124
124
  }
@@ -126,7 +126,7 @@ const ke = ({
126
126
  {
127
127
  originalElementToHighlightRef: n.current.nextBtnRef,
128
128
  isActive: !1,
129
- type: a.NUDGE,
129
+ type: d.NUDGE,
130
130
  elementToHighlight: /* @__PURE__ */ t(
131
131
  te,
132
132
  {
@@ -143,7 +143,7 @@ const ke = ({
143
143
  ),
144
144
  indicator: {
145
145
  nudge: "click",
146
- content: /* @__PURE__ */ t(d, { $renderAs: "ab1", $color: "WHITE", children: "Click to proceed" }),
146
+ content: /* @__PURE__ */ t(s, { $renderAs: "ab1", $color: "WHITE", children: "Click to proceed" }),
147
147
  nudgePointerX: 0,
148
148
  nudgePointerY: 0
149
149
  }
@@ -152,13 +152,13 @@ const ke = ({
152
152
  {
153
153
  originalElementToHighlightRef: r.current.labelRef,
154
154
  isActive: !1,
155
- type: a.TOOLTIP,
155
+ type: d.TOOLTIP,
156
156
  elementToHighlight: /* @__PURE__ */ t(O, {}),
157
157
  indicator: {
158
158
  position: "right",
159
159
  backgroundColor: "PURPLE_4",
160
160
  width: 264,
161
- tooltipItem: /* @__PURE__ */ t(S, { children: /* @__PURE__ */ t(d, { $renderAs: "ab2-bold", children: "Think in new ways & stay sharp. Solve 3 new puzzles everyday." }) }),
161
+ tooltipItem: /* @__PURE__ */ t(S, { children: /* @__PURE__ */ t(s, { $renderAs: "ab2-bold", children: "Think in new ways & stay sharp. Solve 3 new puzzles everyday." }) }),
162
162
  tooltipXCoOrdinates: m.width + 50,
163
163
  tooltipYCoOrdinates: m.height / 2
164
164
  }
@@ -166,7 +166,7 @@ const ke = ({
166
166
  {
167
167
  originalElementToHighlightRef: r.current.segmentedCardWrapperRef,
168
168
  isActive: !1,
169
- type: a.NUDGE,
169
+ type: d.NUDGE,
170
170
  elementToHighlight: /* @__PURE__ */ t(
171
171
  he,
172
172
  {
@@ -185,7 +185,7 @@ const ke = ({
185
185
  ),
186
186
  indicator: {
187
187
  nudge: "click",
188
- content: /* @__PURE__ */ t(d, { $renderAs: "ab1", $color: "WHITE", children: "Click to solve a puzzle" }),
188
+ content: /* @__PURE__ */ t(s, { $renderAs: "ab1", $color: "WHITE", children: "Click to solve a puzzle" }),
189
189
  nudgePointerX: u.width * 0.6,
190
190
  nudgePointerY: u.height * 0.4
191
191
  }
@@ -193,16 +193,16 @@ const ke = ({
193
193
  ];
194
194
  P(i, [...T, ...ie, ...oe]), (j = n.current) == null || j.goToIndex(0);
195
195
  const w = setTimeout(() => {
196
- clearTimeout(w), s(i);
196
+ clearTimeout(w), l(i);
197
197
  }, Te);
198
- C.current.push(w), c && l.current ? h(_.SKILL_ACTIVITY, l.current, "BLUE_4", i, !0) : h(_.GAMES_ACTIVITY, o.current, "ORANGE_4", i, !0);
198
+ C.current.push(w), c && a.current ? h(_.SKILL_ACTIVITY, a.current, "BLUE_4", i, !0) : h(_.GAMES_ACTIVITY, o.current, "ORANGE_4", i, !0);
199
199
  },
200
- [n, G, h, s, P]
200
+ [n, G, h, l, P]
201
201
  ), ne = le(
202
202
  () => ({
203
203
  gameRefs: o,
204
204
  puzzleRefs: r,
205
- lessonRefs: l,
205
+ lessonRefs: a,
206
206
  startJourney: k
207
207
  }),
208
208
  [k]
@@ -1 +1 @@
1
- {"version":3,"file":"use-game-launcher-journey.js","sources":["../../../../../../src/features/circle-games/game-launcher/hooks/use-game-launcher-journey/use-game-launcher-journey.tsx"],"sourcesContent":["import type { TJourneyId } from '../../../../journey/journey-id/journey-id-types';\nimport type { ICoachmarkProps } from '../../../../journey/use-journey/journey-context-types';\nimport type { IArrowTooltipProps } from '../../../../ui/arrow-tooltip/arrow-tooltip-types';\nimport type { INudgeProps } from '../../../../ui/nudge/nudge-types';\nimport type { TColorNames } from '../../../../ui/types';\nimport type { ISegmentedGameCardRefs } from '../../comps/segmented-game-card/segmented-game-card-types';\nimport type {\n IProject,\n Puzzle,\n} from '../../dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport type { IUseGameLauncherJourneyProps } from './use-game-launcher-journey-types';\n\nimport { useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport CaratRightIcon from '../../../../../assets/line-icons/icons/carat-right';\nimport { PLATFORM_EVENTS_STUDENT as AnalyticsLabel } from '../../../../analytics-events/platform-events-student';\nimport { IndicatorType } from '../../../../journey/use-journey/constants';\nimport { useJourney } from '../../../../journey/use-journey/use-journey';\nimport IconButton from '../../../../ui/buttons/icon-button/icon-button';\nimport { useUIContext } from '../../../../ui/context/context';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport { CIRCLE_ONBOARDING_ANALYTICS_STEPS as ActionEvent } from '../../../enum/circle-onboarding-steps';\nimport { ProjectType } from '../../../games/web-view/enums';\nimport { useCircleSounds } from '../../../hooks/use-circle-sounds/use-circle-sounds';\nimport { SegmentedGameCard } from '../../comps/segmented-game-card/segmented-game-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from '../../game-launcher-analytics-events';\nimport {\n GO_TO_NEXT_SLIDE_AFTER_MS,\n SHOW_LABEL_HIGHLIGHT_AFTER_MS,\n SHOW_NUDGE_AFTER_MS,\n SLIDE_TO_LESSON_MS,\n} from './constants';\n\nexport const useGameLauncherJourney = ({\n carouselRefs,\n onSegmentClick,\n}: IUseGameLauncherJourneyProps) => {\n const gameRefs = useRef<ISegmentedGameCardRefs>(null);\n const puzzleRefs = useRef<ISegmentedGameCardRefs>(null);\n const lessonRefs = useRef<ISegmentedGameCardRefs>(null);\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const isJourneyInProgress = useRef(false);\n\n const { playButtonSound } = useCircleSounds();\n const { nextCoachmark, setJourney, endJourney } = useJourney();\n const { onEvent: trackAnalytics } = useUIContext();\n\n const trackEventViewed = useCallback(\n (step: ActionEvent) => {\n trackAnalytics(AnalyticsLabel.ONBOARDING_STEP_VIEWED, {\n step,\n });\n },\n [trackAnalytics],\n );\n const trackEventCompleted = useCallback(\n (step: ActionEvent) => {\n trackAnalytics(AnalyticsLabel.ONBOARDING_STEP_COMPLETED, {\n step,\n });\n },\n [trackAnalytics],\n );\n\n const goToNextCard = useCallback(\n (\n analyticsLabelViewed: ActionEvent,\n refOfNextSlide: ISegmentedGameCardRefs,\n color: TColorNames,\n journeyId: TJourneyId,\n isFirstSlide: boolean = false,\n ) => {\n if (!isFirstSlide) {\n playButtonSound();\n carouselRefs.current?.goToIndex(carouselRefs.current?.currentIndex + 1);\n nextCoachmark(journeyId, false, GO_TO_NEXT_SLIDE_AFTER_MS);\n }\n\n trackEventViewed(analyticsLabelViewed);\n\n const animateLabelTimer = setTimeout(() => {\n clearTimeout(animateLabelTimer);\n refOfNextSlide.startLabelAnimation(color);\n }, SHOW_LABEL_HIGHLIGHT_AFTER_MS);\n\n timerRefs.current.push(animateLabelTimer); // Store to cleanup later\n\n nextCoachmark(journeyId, true, SHOW_NUDGE_AFTER_MS);\n },\n [carouselRefs, nextCoachmark, playButtonSound, trackEventViewed],\n );\n\n const handleEndJourney = useCallback(\n (puzzlesData: Puzzle, journeyId: TJourneyId) => {\n onSegmentClick(puzzlesData, ProjectType.PUZZLE);\n trackEventCompleted(ActionEvent.PUZZLE_ACTIVITY);\n endJourney(journeyId);\n },\n [endJourney, onSegmentClick, trackEventCompleted],\n );\n\n const startJourney = useCallback(\n (puzzlesData: IProject<Puzzle>, isLessonAvailable: boolean, journeyId: TJourneyId) => {\n if (isJourneyInProgress.current) {\n return;\n }\n\n // If element refs are not available return, this is just for type safety\n if (\n !carouselRefs?.current?.nextBtnRef.current ||\n !puzzleRefs?.current?.segmentedCardWrapperRef.current ||\n !gameRefs?.current?.labelRef.current ||\n !puzzleRefs?.current?.labelRef.current ||\n !puzzlesData\n ) {\n return;\n }\n\n isJourneyInProgress.current = true;\n const lessonLabelDims = lessonRefs.current?.labelRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n const gameLabelDims = gameRefs.current?.labelRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n const puzzleLabelDims = puzzleRefs.current?.labelRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n\n const launcherDims =\n puzzleRefs.current?.segmentedCardWrapperRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n\n let lessonSteps: ICoachmarkProps[] = [];\n\n if (isLessonAvailable && lessonRefs.current) {\n lessonSteps = [\n {\n originalElementToHighlightRef: lessonRefs.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'BLUE_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Get faster & stay ahead in school. Practice 3 new skills everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: lessonLabelDims.width + 50,\n tooltipYCoOrdinates: lessonLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: carouselRefs.current?.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={() =>\n goToNextCard(\n ActionEvent.GAMES_ACTIVITY,\n gameRefs.current as ISegmentedGameCardRefs,\n 'ORANGE_4',\n journeyId,\n )\n }\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to proceed\n </Text>\n ),\n nudgePointerX: 0,\n nudgePointerY: 0,\n } as INudgeProps,\n },\n ];\n }\n\n const gameSteps: ICoachmarkProps[] = [\n {\n originalElementToHighlightRef: gameRefs.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'ORANGE_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Train to think deeper & plan ahead. Play 3 new games everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: gameLabelDims.width + 50,\n tooltipYCoOrdinates: gameLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: carouselRefs.current.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={() =>\n goToNextCard(\n ActionEvent.PUZZLE_ACTIVITY,\n puzzleRefs.current as ISegmentedGameCardRefs,\n 'PURPLE_4',\n journeyId,\n )\n }\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to proceed\n </Text>\n ),\n nudgePointerX: 0,\n nudgePointerY: 0,\n } as INudgeProps,\n },\n ];\n\n const puzzleSteps: ICoachmarkProps[] = [\n {\n originalElementToHighlightRef: puzzleRefs.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'PURPLE_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Think in new ways & stay sharp. Solve 3 new puzzles everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: puzzleLabelDims.width + 50,\n tooltipYCoOrdinates: puzzleLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: puzzleRefs.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <SegmentedGameCard\n label={''} // This is intentionally left blank to avoid showing the label\n value={puzzlesData.data.filter(puzzle => puzzle.solved).length}\n maxValue={puzzlesData.data.length}\n initialValue={puzzlesData.initialProgressValue}\n data={puzzlesData.data.map(puzzle => ({\n card: puzzle.cardLottie,\n name: '', // We dont want to show the name of the puzzle in onboarding\n isCompleted: puzzle.solved,\n onPress: () => handleEndJourney(puzzle, journeyId),\n }))}\n />\n ),\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to solve a puzzle\n </Text>\n ),\n nudgePointerX: launcherDims.width * 0.6,\n nudgePointerY: launcherDims.height * 0.4,\n } as INudgeProps,\n },\n ];\n\n setJourney(journeyId, [...lessonSteps, ...gameSteps, ...puzzleSteps]);\n\n carouselRefs.current?.goToIndex(0); // Always start from 0th Index no matter what the current index is\n\n const delayBeforeStart = setTimeout(() => {\n clearTimeout(delayBeforeStart);\n nextCoachmark(journeyId);\n }, SLIDE_TO_LESSON_MS);\n\n timerRefs.current.push(delayBeforeStart); // Store to cleanup later\n\n if (isLessonAvailable && lessonRefs.current) {\n goToNextCard(ActionEvent.SKILL_ACTIVITY, lessonRefs.current, 'BLUE_4', journeyId, true);\n } else {\n goToNextCard(ActionEvent.GAMES_ACTIVITY, gameRefs.current, 'ORANGE_4', journeyId, true);\n }\n },\n [carouselRefs, handleEndJourney, goToNextCard, nextCoachmark, setJourney],\n );\n\n const data = useMemo(\n () => ({\n gameRefs,\n puzzleRefs,\n lessonRefs,\n startJourney,\n }),\n [startJourney],\n );\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n timerRefs.current.forEach(timer => clearTimeout(timer));\n timerRefs.current = [];\n isJourneyInProgress.current = false;\n };\n }, [carouselRefs]);\n\n return data;\n};\n"],"names":["useGameLauncherJourney","carouselRefs","onSegmentClick","gameRefs","useRef","puzzleRefs","lessonRefs","timerRefs","isJourneyInProgress","playButtonSound","useCircleSounds","nextCoachmark","setJourney","endJourney","useJourney","trackAnalytics","useUIContext","trackEventViewed","useCallback","step","AnalyticsLabel","trackEventCompleted","goToNextCard","analyticsLabelViewed","refOfNextSlide","color","journeyId","isFirstSlide","_b","_a","GO_TO_NEXT_SLIDE_AFTER_MS","animateLabelTimer","SHOW_LABEL_HIGHLIGHT_AFTER_MS","SHOW_NUDGE_AFTER_MS","handleEndJourney","puzzlesData","ProjectType","ActionEvent","startJourney","isLessonAvailable","_c","_d","lessonLabelDims","_g","_f","_e","gameLabelDims","_j","_i","_h","puzzleLabelDims","_m","_l","_k","launcherDims","_p","_o","_n","lessonSteps","IndicatorType","jsx","Fragment","FlexView","Text","_q","IconButton","CaratRightIcon","GAME_LAUNCHER_ANALYTICS_EVENTS","gameSteps","puzzleSteps","SegmentedGameCard","puzzle","_r","delayBeforeStart","SLIDE_TO_LESSON_MS","data","useMemo","useEffect","timer"],"mappings":";;;;;;;;;;;;;;;;AAkCO,MAAMA,KAAyB,CAAC;AAAA,EACrC,cAAAC;AAAA,EACA,gBAAAC;AACF,MAAoC;AAC5B,QAAAC,IAAWC,EAA+B,IAAI,GAC9CC,IAAaD,EAA+B,IAAI,GAChDE,IAAaF,EAA+B,IAAI,GAChDG,IAAYH,EAAwC,CAAA,CAAE,GAEtDI,IAAsBJ,EAAO,EAAK,GAElC,EAAE,iBAAAK,MAAoBC,MACtB,EAAE,eAAAC,GAAe,YAAAC,GAAY,YAAAC,MAAeC,GAAW,GACvD,EAAE,SAASC,EAAe,IAAIC,GAAa,GAE3CC,IAAmBC;AAAA,IACvB,CAACC,MAAsB;AACrB,MAAAJ,EAAeK,GAAe,wBAAwB;AAAA,QACpD,MAAAD;AAAA,MAAA,CACD;AAAA,IACH;AAAA,IACA,CAACJ,CAAc;AAAA,EAAA,GAEXM,IAAsBH;AAAA,IAC1B,CAACC,MAAsB;AACrB,MAAAJ,EAAeK,GAAe,2BAA2B;AAAA,QACvD,MAAAD;AAAA,MAAA,CACD;AAAA,IACH;AAAA,IACA,CAACJ,CAAc;AAAA,EAAA,GAGXO,IAAeJ;AAAA,IACnB,CACEK,GACAC,GACAC,GACAC,GACAC,IAAwB,OACrB;;AACH,MAAKA,MACalB,MAChBmB,IA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AmB,WAAW,MAAM;AACxC,qBAAaA,CAAgB,GAC7B9D,EAAce,CAAS;AAAA,SACtBgD,EAAkB;AAEX,MAAAnE,EAAA,QAAQ,KAAKkE,CAAgB,GAEnClC,KAAqBjC,EAAW,UAClCgB,EAAae,EAAY,gBAAgB/B,EAAW,SAAS,UAAUoB,GAAW,EAAI,IAEtFJ,EAAae,EAAY,gBAAgBlC,EAAS,SAAS,YAAYuB,GAAW,EAAI;AAAA,IAE1F;AAAA,IACA,CAACzB,GAAciC,GAAkBZ,GAAcX,GAAeC,CAAU;AAAA,EAAA,GAGpE+D,KAAOC;AAAA,IACX,OAAO;AAAA,MACL,UAAAzE;AAAA,MACA,YAAAE;AAAA,MACA,YAAAC;AAAA,MACA,cAAAgC;AAAA,IAAA;AAAA,IAEF,CAACA,CAAY;AAAA,EAAA;AAIf,SAAAuC,GAAU,MACD,MAAM;AACX,IAAAtE,EAAU,QAAQ,QAAQ,CAASuE,MAAA,aAAaA,CAAK,CAAC,GACtDvE,EAAU,UAAU,IACpBC,EAAoB,UAAU;AAAA,EAAA,GAE/B,CAACP,CAAY,CAAC,GAEV0E;AACT;"}
1
+ {"version":3,"file":"use-game-launcher-journey.js","sources":["../../../../../../src/features/circle-games/game-launcher/hooks/use-game-launcher-journey/use-game-launcher-journey.tsx"],"sourcesContent":["import type { TJourneyId } from '../../../../journey/journey-id/journey-id-types';\nimport type { ICoachmarkProps } from '../../../../journey/use-journey/journey-context-types';\nimport type { IArrowTooltipProps } from '../../../../ui/arrow-tooltip/arrow-tooltip-types';\nimport type { INudgeProps } from '../../../../ui/nudge/nudge-types';\nimport type { TColorNames } from '../../../../ui/types';\nimport type { ISegmentedGameCardRefs } from '../../comps/segmented-game-card/segmented-game-card-types';\nimport type {\n IProject,\n Puzzle,\n} from '../../dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport type { IUseGameLauncherJourneyProps } from './use-game-launcher-journey-types';\n\nimport { useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport CaratRightIcon from '../../../../../assets/line-icons/icons/carat-right';\nimport { PLATFORM_EVENTS_STUDENT as AnalyticsLabel } from '../../../../analytics-events/platform-events-student';\nimport { IndicatorType } from '../../../../journey/use-journey/constants';\nimport { useJourney } from '../../../../journey/use-journey/use-journey';\nimport IconButton from '../../../../ui/buttons/icon-button/icon-button';\nimport { useUIContext } from '../../../../ui/context/context';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport { CIRCLE_ONBOARDING_ANALYTICS_STEPS as ActionEvent } from '../../../enum/circle-onboarding-steps';\nimport { ProjectType } from '../../../games/web-view/enums';\nimport { useCircleSounds } from '../../../hooks/use-circle-sounds/use-circle-sounds';\nimport { SegmentedGameCard } from '../../comps/segmented-game-card/segmented-game-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from '../../game-launcher-analytics-events';\nimport {\n GO_TO_NEXT_SLIDE_AFTER_MS,\n SHOW_LABEL_HIGHLIGHT_AFTER_MS,\n SHOW_NUDGE_AFTER_MS,\n SLIDE_TO_LESSON_MS,\n} from './constants';\n\nexport const useGameLauncherJourney = ({\n carouselRefs,\n onSegmentClick,\n}: IUseGameLauncherJourneyProps) => {\n const gameRefs = useRef<ISegmentedGameCardRefs>(null);\n const puzzleRefs = useRef<ISegmentedGameCardRefs>(null);\n const lessonRefs = useRef<ISegmentedGameCardRefs>(null);\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const isJourneyInProgress = useRef(false);\n\n const { playButtonSound } = useCircleSounds();\n const { nextCoachmark, setJourney, endJourney } = useJourney();\n const { onEvent: trackAnalytics } = useUIContext();\n\n const trackEventViewed = useCallback(\n (step: ActionEvent) => {\n trackAnalytics(AnalyticsLabel.ONBOARDING_STEP_VIEWED, {\n step,\n });\n },\n [trackAnalytics],\n );\n const trackEventCompleted = useCallback(\n (step: ActionEvent) => {\n trackAnalytics(AnalyticsLabel.ONBOARDING_STEP_COMPLETED, {\n step,\n });\n },\n [trackAnalytics],\n );\n\n const goToNextCard = useCallback(\n (\n analyticsLabelViewed: ActionEvent,\n refOfNextSlide: ISegmentedGameCardRefs,\n color: TColorNames,\n journeyId: TJourneyId,\n isFirstSlide: boolean = false,\n ) => {\n if (!isFirstSlide) {\n playButtonSound();\n carouselRefs.current?.goToIndex(carouselRefs.current?.currentIndex + 1);\n nextCoachmark(journeyId, false, GO_TO_NEXT_SLIDE_AFTER_MS);\n }\n\n trackEventViewed(analyticsLabelViewed);\n\n const animateLabelTimer = setTimeout(() => {\n clearTimeout(animateLabelTimer);\n refOfNextSlide.startLabelAnimation(color);\n }, SHOW_LABEL_HIGHLIGHT_AFTER_MS);\n\n timerRefs.current.push(animateLabelTimer); // Store to cleanup later\n\n nextCoachmark(journeyId, true, SHOW_NUDGE_AFTER_MS);\n },\n [carouselRefs, nextCoachmark, playButtonSound, trackEventViewed],\n );\n\n const handleEndJourney = useCallback(\n (puzzlesData: Puzzle, journeyId: TJourneyId) => {\n onSegmentClick(puzzlesData, ProjectType.PUZZLE);\n trackEventCompleted(ActionEvent.PUZZLE_ACTIVITY);\n nextCoachmark(journeyId);\n endJourney(journeyId);\n },\n [endJourney, nextCoachmark, onSegmentClick, trackEventCompleted],\n );\n\n const startJourney = useCallback(\n (puzzlesData: IProject<Puzzle>, isLessonAvailable: boolean, journeyId: TJourneyId) => {\n if (isJourneyInProgress.current) {\n return;\n }\n\n // If element refs are not available return, this is just for type safety\n if (\n !carouselRefs?.current?.nextBtnRef.current ||\n !puzzleRefs?.current?.segmentedCardWrapperRef.current ||\n !gameRefs?.current?.labelRef.current ||\n !puzzleRefs?.current?.labelRef.current ||\n !puzzlesData\n ) {\n return;\n }\n\n isJourneyInProgress.current = true;\n const lessonLabelDims = lessonRefs.current?.labelRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n const gameLabelDims = gameRefs.current?.labelRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n const puzzleLabelDims = puzzleRefs.current?.labelRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n\n const launcherDims =\n puzzleRefs.current?.segmentedCardWrapperRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n\n let lessonSteps: ICoachmarkProps[] = [];\n\n if (isLessonAvailable && lessonRefs.current) {\n lessonSteps = [\n {\n originalElementToHighlightRef: lessonRefs.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'BLUE_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Get faster & stay ahead in school. Practice 3 new skills everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: lessonLabelDims.width + 50,\n tooltipYCoOrdinates: lessonLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: carouselRefs.current?.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={() =>\n goToNextCard(\n ActionEvent.GAMES_ACTIVITY,\n gameRefs.current as ISegmentedGameCardRefs,\n 'ORANGE_4',\n journeyId,\n )\n }\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to proceed\n </Text>\n ),\n nudgePointerX: 0,\n nudgePointerY: 0,\n } as INudgeProps,\n },\n ];\n }\n\n const gameSteps: ICoachmarkProps[] = [\n {\n originalElementToHighlightRef: gameRefs.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'ORANGE_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Train to think deeper & plan ahead. Play 3 new games everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: gameLabelDims.width + 50,\n tooltipYCoOrdinates: gameLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: carouselRefs.current.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={() =>\n goToNextCard(\n ActionEvent.PUZZLE_ACTIVITY,\n puzzleRefs.current as ISegmentedGameCardRefs,\n 'PURPLE_4',\n journeyId,\n )\n }\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to proceed\n </Text>\n ),\n nudgePointerX: 0,\n nudgePointerY: 0,\n } as INudgeProps,\n },\n ];\n\n const puzzleSteps: ICoachmarkProps[] = [\n {\n originalElementToHighlightRef: puzzleRefs.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'PURPLE_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Think in new ways & stay sharp. Solve 3 new puzzles everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: puzzleLabelDims.width + 50,\n tooltipYCoOrdinates: puzzleLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: puzzleRefs.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <SegmentedGameCard\n label={''} // This is intentionally left blank to avoid showing the label\n value={puzzlesData.data.filter(puzzle => puzzle.solved).length}\n maxValue={puzzlesData.data.length}\n initialValue={puzzlesData.initialProgressValue}\n data={puzzlesData.data.map(puzzle => ({\n card: puzzle.cardLottie,\n name: '', // We dont want to show the name of the puzzle in onboarding\n isCompleted: puzzle.solved,\n onPress: () => handleEndJourney(puzzle, journeyId),\n }))}\n />\n ),\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to solve a puzzle\n </Text>\n ),\n nudgePointerX: launcherDims.width * 0.6,\n nudgePointerY: launcherDims.height * 0.4,\n } as INudgeProps,\n },\n ];\n\n setJourney(journeyId, [...lessonSteps, ...gameSteps, ...puzzleSteps]);\n\n carouselRefs.current?.goToIndex(0); // Always start from 0th Index no matter what the current index is\n\n const delayBeforeStart = setTimeout(() => {\n clearTimeout(delayBeforeStart);\n nextCoachmark(journeyId);\n }, SLIDE_TO_LESSON_MS);\n\n timerRefs.current.push(delayBeforeStart); // Store to cleanup later\n\n if (isLessonAvailable && lessonRefs.current) {\n goToNextCard(ActionEvent.SKILL_ACTIVITY, lessonRefs.current, 'BLUE_4', journeyId, true);\n } else {\n goToNextCard(ActionEvent.GAMES_ACTIVITY, gameRefs.current, 'ORANGE_4', journeyId, true);\n }\n },\n [carouselRefs, handleEndJourney, goToNextCard, nextCoachmark, setJourney],\n );\n\n const data = useMemo(\n () => ({\n gameRefs,\n puzzleRefs,\n lessonRefs,\n startJourney,\n }),\n [startJourney],\n );\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n timerRefs.current.forEach(timer => clearTimeout(timer));\n timerRefs.current = [];\n isJourneyInProgress.current = false;\n };\n }, [carouselRefs]);\n\n return data;\n};\n"],"names":["useGameLauncherJourney","carouselRefs","onSegmentClick","gameRefs","useRef","puzzleRefs","lessonRefs","timerRefs","isJourneyInProgress","playButtonSound","useCircleSounds","nextCoachmark","setJourney","endJourney","useJourney","trackAnalytics","useUIContext","trackEventViewed","useCallback","step","AnalyticsLabel","trackEventCompleted","goToNextCard","analyticsLabelViewed","refOfNextSlide","color","journeyId","isFirstSlide","_b","_a","GO_TO_NEXT_SLIDE_AFTER_MS","animateLabelTimer","SHOW_LABEL_HIGHLIGHT_AFTER_MS","SHOW_NUDGE_AFTER_MS","handleEndJourney","puzzlesData","ProjectType","ActionEvent","startJourney","isLessonAvailable","_c","_d","lessonLabelDims","_g","_f","_e","gameLabelDims","_j","_i","_h","puzzleLabelDims","_m","_l","_k","launcherDims","_p","_o","_n","lessonSteps","IndicatorType","jsx","Fragment","FlexView","Text","_q","IconButton","CaratRightIcon","GAME_LAUNCHER_ANALYTICS_EVENTS","gameSteps","puzzleSteps","SegmentedGameCard","puzzle","_r","delayBeforeStart","SLIDE_TO_LESSON_MS","data","useMemo","useEffect","timer"],"mappings":";;;;;;;;;;;;;;;;AAkCO,MAAMA,KAAyB,CAAC;AAAA,EACrC,cAAAC;AAAA,EACA,gBAAAC;AACF,MAAoC;AAC5B,QAAAC,IAAWC,EAA+B,IAAI,GAC9CC,IAAaD,EAA+B,IAAI,GAChDE,IAAaF,EAA+B,IAAI,GAChDG,IAAYH,EAAwC,CAAA,CAAE,GAEtDI,IAAsBJ,EAAO,EAAK,GAElC,EAAE,iBAAAK,MAAoBC,MACtB,EAAE,eAAAC,GAAe,YAAAC,GAAY,YAAAC,MAAeC,GAAW,GACvD,EAAE,SAASC,EAAe,IAAIC,GAAa,GAE3CC,IAAmBC;AAAA,IACvB,CAACC,MAAsB;AACrB,MAAAJ,EAAeK,GAAe,wBAAwB;AAAA,QACpD,MAAAD;AAAA,MAAA,CACD;AAAA,IACH;AAAA,IACA,CAACJ,CAAc;AAAA,EAAA,GAEXM,IAAsBH;AAAA,IAC1B,CAACC,MAAsB;AACrB,MAAAJ,EAAeK,GAAe,2BAA2B;AAAA,QACvD,MAAAD;AAAA,MAAA,CACD;AAAA,IACH;AAAA,IACA,CAACJ,CAAc;AAAA,EAAA,GAGXO,IAAeJ;AAAA,IACnB,CACEK,GACAC,GACAC,GACAC,GACAC,IAAwB,OACrB;;AACH,MAAKA,MACalB,MAChBmB,IAAA3B,EAAa,YAAb,QAAA2B,EAAsB,YAAUC,IAAA5B,EAAa,YAAb,gBAAA4B,EAAsB,gBAAe,IACvDlB,EAAAe,GAAW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B;AAEX,MAAAnE,EAAA,QAAQ,KAAKkE,CAAgB,GAEnClC,KAAqBjC,EAAW,UAClCgB,EAAae,EAAY,gBAAgB/B,EAAW,SAAS,UAAUoB,GAAW,EAAI,IAEtFJ,EAAae,EAAY,gBAAgBlC,EAAS,SAAS,YAAYuB,GAAW,EAAI;AAAA,IAE1F;AAAA,IACA,CAACzB,GAAciC,GAAkBZ,GAAcX,GAAeC,CAAU;AAAA,EAAA,GAGpE+D,KAAOC;AAAA,IACX,OAAO;AAAA,MACL,UAAAzE;AAAA,MACA,YAAAE;AAAA,MACA,YAAAC;AAAA,MACA,cAAAgC;AAAA,IAAA;AAAA,IAEF,CAACA,CAAY;AAAA,EAAA;AAIf,SAAAuC,GAAU,MACD,MAAM;AACX,IAAAtE,EAAU,QAAQ,QAAQ,CAASuE,MAAA,aAAaA,CAAK,CAAC,GACtDvE,EAAU,UAAU,IACpBC,EAAoB,UAAU;AAAA,EAAA,GAE/B,CAACP,CAAY,CAAC,GAEV0E;AACT;"}
@@ -19,22 +19,22 @@ const Oe = ({
19
19
  carouselRefs: a,
20
20
  onTableSegmentClick: S
21
21
  }) => {
22
- const t = K.CIRCLE_TABLES_INTRO_JOURNEY, e = A(null), p = A(null), L = A(!1), T = A([]), { playButtonSound: P } = z(), { nextCoachmark: l, setJourney: I, addCoachmark: u, endJourney: y } = j(), { onEvent: _ } = q(), b = C(
22
+ const e = K.CIRCLE_TABLES_INTRO_JOURNEY, t = A(null), p = A(null), L = A(!1), T = A([]), { playButtonSound: P } = z(), { nextCoachmark: o, setJourney: I, addCoachmark: u, endJourney: y } = j(), { onEvent: _ } = q(), b = C(
23
23
  (n) => {
24
- var c, o;
24
+ var c, i;
25
25
  n && S(n), _(G.ONBOARDING_STEP_COMPLETED, {
26
26
  step: v.TABLES
27
- }), (c = e == null ? void 0 : e.current) == null || c.setLabelVisiblity(!0), (o = e == null ? void 0 : e.current) == null || o.stopLabelAnimation(), y(t);
27
+ }), (c = t == null ? void 0 : t.current) == null || c.setLabelVisiblity(!0), (i = t == null ? void 0 : t.current) == null || i.stopLabelAnimation(), o(e, !1), y(e);
28
28
  },
29
- [y, t, S, _]
29
+ [y, e, o, S, _]
30
30
  ), H = C(
31
31
  (n, c) => {
32
32
  var g, E, h;
33
- if (!((g = e.current) != null && g.segmentedCardWrapperRef.current) || !((E = e.current) != null && E.labelRef.current))
33
+ if (!((g = t.current) != null && g.segmentedCardWrapperRef.current) || !((E = t.current) != null && E.labelRef.current))
34
34
  return;
35
- const o = e.current.labelRef.current.getBoundingClientRect(), i = (h = e.current) == null ? void 0 : h.segmentedCardWrapperRef.current.getBoundingClientRect();
36
- u(t, {
37
- originalElementToHighlightRef: e.current.segmentedCardWrapperRef,
35
+ const i = t.current.labelRef.current.getBoundingClientRect(), l = (h = t.current) == null ? void 0 : h.segmentedCardWrapperRef.current.getBoundingClientRect();
36
+ u(e, {
37
+ originalElementToHighlightRef: t.current.segmentedCardWrapperRef,
38
38
  isActive: !1,
39
39
  type: d.TOOLTIP,
40
40
  elementToHighlight: /* @__PURE__ */ r(
@@ -54,53 +54,53 @@ const Oe = ({
54
54
  width: 236,
55
55
  tooltipItem: /* @__PURE__ */ r(N, { children: /* @__PURE__ */ r(m, { $renderAs: "ab2-bold", children: "Each table has 3 levels—clear them and earn 3 stars!" }) }),
56
56
  tooltipXCoOrdinates: 0,
57
- tooltipYCoOrdinates: o.height * 0.35
57
+ tooltipYCoOrdinates: i.height * 0.35
58
58
  }
59
- }), u(t, {
60
- originalElementToHighlightRef: e.current.segmentedCardWrapperRef,
59
+ }), u(e, {
60
+ originalElementToHighlightRef: t.current.segmentedCardWrapperRef,
61
61
  isActive: !1,
62
62
  type: d.NUDGE,
63
63
  indicator: {
64
64
  nudge: "click",
65
65
  content: /* @__PURE__ */ r(m, { $renderAs: "ab1", $color: "WHITE", children: "Pick a level" }),
66
- nudgePointerX: i.width / 2 + 50,
67
- nudgePointerY: i.height * 0.4
66
+ nudgePointerX: l.width / 2 + 50,
67
+ nudgePointerY: l.height * 0.4
68
68
  },
69
69
  elementToHighlight: /* @__PURE__ */ r(R, {})
70
- }), l(t, !1, ee), l(t, !0, te);
70
+ }), o(e, !1, ee), o(e, !0, te);
71
71
  const s = setTimeout(() => {
72
72
  var f;
73
73
  clearTimeout(s), (f = p.current) == null || f.startLabelAnimation("YELLOW_4");
74
74
  }, $);
75
75
  T.current.push(s);
76
76
  },
77
- [u, b, t, l]
77
+ [u, b, e, o]
78
78
  ), O = C(() => {
79
- var o;
80
- P(), (o = a.current) == null || o.goToIndex(x), l(t, !1, re), _(G.ONBOARDING_STEP_VIEWED, {
79
+ var i;
80
+ P(), (i = a.current) == null || i.goToIndex(x), o(e, !1, re), _(G.ONBOARDING_STEP_VIEWED, {
81
81
  step: v.TABLES
82
82
  });
83
83
  const n = setTimeout(() => {
84
- var i;
85
- clearTimeout(n), (i = e.current) == null || i.setLabelVisiblity(!1), l(t, !0);
84
+ var l;
85
+ clearTimeout(n), (l = t.current) == null || l.setLabelVisiblity(!1), o(e, !0);
86
86
  }, ne);
87
87
  T.current.push(n);
88
88
  const c = setTimeout(() => {
89
- var i;
90
- clearTimeout(c), (i = p.current) == null || i.startLabelAnimation("YELLOW_4");
89
+ var l;
90
+ clearTimeout(c), (l = p.current) == null || l.startLabelAnimation("YELLOW_4");
91
91
  }, $);
92
92
  T.current.push(c);
93
- }, [a, t, l, P, _]), w = C(
93
+ }, [a, e, o, P, _]), w = C(
94
94
  (n, c = !1) => {
95
95
  var h, f, D, W, Y, k, B, U;
96
96
  if (L.current)
97
97
  return;
98
- const o = (h = a.current) == null ? void 0 : h.indicatorRefs, i = (f = a.current) == null ? void 0 : f.nextBtnRef, s = o == null ? void 0 : o[x];
99
- if (!((D = e.current) != null && D.segmentedCardWrapperRef.current) || !((W = e.current) != null && W.labelRef.current) || !o || !(i != null && i.current) || !s || !s.current)
98
+ const i = (h = a.current) == null ? void 0 : h.indicatorRefs, l = (f = a.current) == null ? void 0 : f.nextBtnRef, s = i == null ? void 0 : i[x];
99
+ if (!((D = t.current) != null && D.segmentedCardWrapperRef.current) || !((W = t.current) != null && W.labelRef.current) || !i || !(l != null && l.current) || !s || !s.current)
100
100
  return;
101
101
  L.current = !0;
102
- const g = e.current.labelRef.current.getBoundingClientRect(), E = (Y = e.current) == null ? void 0 : Y.segmentedCardWrapperRef.current.getBoundingClientRect();
103
- c ? (I(t, [
102
+ const g = t.current.labelRef.current.getBoundingClientRect(), E = (Y = t.current) == null ? void 0 : Y.segmentedCardWrapperRef.current.getBoundingClientRect();
103
+ c ? (I(e, [
104
104
  {
105
105
  originalElementToHighlightRef: s,
106
106
  isActive: !1,
@@ -135,7 +135,7 @@ const Oe = ({
135
135
  },
136
136
  elementToHighlight: /* @__PURE__ */ r(R, {})
137
137
  }
138
- ]), (U = a.current) == null || U.goToIndex(ie), l(t, !1, J), l(t, !0, le)) : (I(t, [
138
+ ]), (U = a.current) == null || U.goToIndex(ie), o(e, !1, J), o(e, !0, le)) : (I(e, [
139
139
  {
140
140
  originalElementToHighlightRef: (k = a.current) == null ? void 0 : k.nextBtnRef,
141
141
  isActive: !1,
@@ -156,8 +156,8 @@ const Oe = ({
156
156
  }
157
157
  )
158
158
  }
159
- ]), (B = a.current) == null || B.goToIndex(oe), l(t, !1, J)), u(t, {
160
- originalElementToHighlightRef: e.current.labelRef,
159
+ ]), (B = a.current) == null || B.goToIndex(oe), o(e, !1, J)), u(e, {
160
+ originalElementToHighlightRef: t.current.labelRef,
161
161
  isActive: !1,
162
162
  type: d.TOOLTIP,
163
163
  elementToHighlight: /* @__PURE__ */ r(R, {}),
@@ -169,8 +169,8 @@ const Oe = ({
169
169
  tooltipXCoOrdinates: g.width + 50,
170
170
  tooltipYCoOrdinates: g.height / 2
171
171
  }
172
- }), u(t, {
173
- originalElementToHighlightRef: e.current.segmentedCardWrapperRef,
172
+ }), u(e, {
173
+ originalElementToHighlightRef: t.current.segmentedCardWrapperRef,
174
174
  isActive: !1,
175
175
  type: d.NUDGE,
176
176
  indicator: {
@@ -197,15 +197,15 @@ const Oe = ({
197
197
  a,
198
198
  O,
199
199
  H,
200
- t,
201
- l,
200
+ e,
201
+ o,
202
202
  I
203
203
  ]
204
204
  );
205
205
  return V(() => () => {
206
206
  T.current.forEach((n) => clearTimeout(n)), T.current = [], L.current = !1;
207
- }, [t]), {
208
- tableRef: e,
207
+ }, [e]), {
208
+ tableRef: t,
209
209
  startJourney: w
210
210
  };
211
211
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use-table-launcher-journey.js","sources":["../../../../../../src/features/circle-games/game-launcher/hooks/use-table-launcher-journey/use-table-launcher-journey.tsx"],"sourcesContent":["/* eslint-disable react-native/no-inline-styles */\nimport type { IArrowTooltipProps } from '../../../../ui/arrow-tooltip/arrow-tooltip-types';\nimport type { INudgeProps } from '../../../../ui/nudge/nudge-types';\nimport type { ITableCardRef, ITableDetails } from '../../comps/tables-card/tables-card-types';\nimport type {\n ITableInfo,\n ITables,\n} from '../../dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport type { IUseTableJourneyProps } from './use-table-launcher-journey-types';\n\nimport { useCallback, useEffect, useRef } from 'react';\n\nimport CaratRightIcon from '../../../../../assets/line-icons/icons/carat-right';\nimport { PLATFORM_EVENTS_STUDENT } from '../../../../analytics-events/platform-events-student';\nimport { JOURNEY_ID_STUDENT } from '../../../../journey/journey-id/journey-id-student';\nimport { IndicatorType } from '../../../../journey/use-journey/constants';\nimport { useJourney } from '../../../../journey/use-journey/use-journey';\nimport IconButton from '../../../../ui/buttons/icon-button/icon-button';\nimport { useUIContext } from '../../../../ui/context/context';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport { CIRCLE_ONBOARDING_ANALYTICS_STEPS as Action } from '../../../enum/circle-onboarding-steps';\nimport { useCircleSounds } from '../../../hooks/use-circle-sounds/use-circle-sounds';\nimport { TablesCard } from '../../comps/tables-card/tables-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from '../../game-launcher-analytics-events';\nimport {\n LESSON_CARD_INDEX,\n PUZZLE_CARD_INDEX,\n SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS,\n SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS,\n TABLE_CARD_INDEX,\n} from './constants';\nimport {\n GO_TO_TABLE_LAUNCHER_DURATION_MS,\n SHOW_CLICK_TABLE_NUDGE_AFTER_MS,\n SHOW_INITIAL_COACHMARK_AFTER_MS,\n SHOW_INITIAL_TOOLTIP_AFTER_MS,\n START_ANIMATING_CLONED_ELEM,\n} from './constants';\nimport * as S from './use-table-launcher-journey-styled';\n\nexport const useTableLauncherJourney = ({\n carouselRefs,\n onTableSegmentClick,\n}: IUseTableJourneyProps) => {\n const journeyId = JOURNEY_ID_STUDENT.CIRCLE_TABLES_INTRO_JOURNEY;\n const originalTableRef = useRef<ITableCardRef>(null);\n const highlightedTableRef = useRef<ITableCardRef>(null);\n const isJourneyInProgress = useRef(false);\n\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const { playButtonSound } = useCircleSounds();\n const { nextCoachmark, setJourney, addCoachmark, endJourney } = useJourney();\n const { onEvent: trackAnalytics } = useUIContext();\n\n const handleEndJourney = useCallback(\n (tableDetails?: ITableDetails) => {\n // Only when User clicked on play\n if (tableDetails) {\n onTableSegmentClick(tableDetails);\n }\n trackAnalytics(PLATFORM_EVENTS_STUDENT.ONBOARDING_STEP_COMPLETED, {\n step: Action.TABLES,\n });\n\n // Reset original table card ref label\n originalTableRef?.current?.setLabelVisiblity(true);\n originalTableRef?.current?.stopLabelAnimation();\n endJourney(journeyId);\n },\n [endJourney, journeyId, onTableSegmentClick, trackAnalytics],\n );\n\n const handleTableSegmentClick = useCallback(\n (launcherData: ITables, tableData: ITableInfo) => {\n if (\n !originalTableRef.current?.segmentedCardWrapperRef.current ||\n !originalTableRef.current?.labelRef.current\n ) {\n return;\n }\n\n const segmentedCardDims = originalTableRef.current.labelRef.current.getBoundingClientRect();\n const tableCardDims =\n originalTableRef.current?.segmentedCardWrapperRef.current.getBoundingClientRect();\n\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: (\n <TablesCard\n ref={highlightedTableRef}\n defaultTable={tableData}\n label={launcherData.label}\n data={launcherData.data}\n onPress={handleEndJourney}\n onGoBackFromTableLevel={handleEndJourney}\n />\n ),\n indicator: {\n position: 'left',\n backgroundColor: 'YELLOW_4',\n width: 236,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">Each table has 3 levels—clear them and earn 3 stars!</Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: 0,\n tooltipYCoOrdinates: segmentedCardDims.height * 0.35,\n } as IArrowTooltipProps,\n });\n\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Pick a level\n </Text>\n ),\n nudgePointerX: tableCardDims.width / 2 + 50,\n nudgePointerY: tableCardDims.height * 0.4,\n } as INudgeProps,\n elementToHighlight: <></>,\n });\n\n nextCoachmark(journeyId, false, SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS); // Show coachmark => Each table has 3... and Hide the previous two\n nextCoachmark(journeyId, true, SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS); // Show nudge => Pick a level\n\n const startAnimationOnLabelAgain = setTimeout(() => {\n clearTimeout(startAnimationOnLabelAgain);\n highlightedTableRef.current?.startLabelAnimation('YELLOW_4');\n }, START_ANIMATING_CLONED_ELEM);\n\n timerRefs.current.push(startAnimationOnLabelAgain);\n },\n [addCoachmark, handleEndJourney, journeyId, nextCoachmark],\n );\n\n const goToTableLauncher = useCallback(() => {\n playButtonSound();\n carouselRefs.current?.goToIndex(TABLE_CARD_INDEX);\n nextCoachmark(journeyId, false, GO_TO_TABLE_LAUNCHER_DURATION_MS);\n\n trackAnalytics(PLATFORM_EVENTS_STUDENT.ONBOARDING_STEP_VIEWED, {\n step: Action.TABLES,\n });\n\n const showNudge = setTimeout(() => {\n clearTimeout(showNudge);\n originalTableRef.current?.setLabelVisiblity(false);\n nextCoachmark(journeyId, true);\n }, SHOW_CLICK_TABLE_NUDGE_AFTER_MS);\n\n timerRefs.current.push(showNudge);\n\n const animateLabel = setTimeout(() => {\n clearTimeout(animateLabel);\n highlightedTableRef.current?.startLabelAnimation('YELLOW_4');\n }, START_ANIMATING_CLONED_ELEM);\n\n timerRefs.current.push(animateLabel);\n }, [carouselRefs, journeyId, nextCoachmark, playButtonSound, trackAnalytics]);\n\n const startJourney = useCallback(\n (tablesData: ITables, isTutorialOnboardingDone: boolean = false) => {\n if (isJourneyInProgress.current) {\n return;\n }\n\n const paginationList = carouselRefs.current?.indicatorRefs;\n const carouselNextBtnRef = carouselRefs.current?.nextBtnRef;\n const tablePaginationRef = paginationList?.[TABLE_CARD_INDEX];\n\n if (\n !originalTableRef.current?.segmentedCardWrapperRef.current ||\n !originalTableRef.current?.labelRef.current ||\n !paginationList ||\n !carouselNextBtnRef?.current ||\n !tablePaginationRef ||\n !tablePaginationRef.current\n ) {\n return;\n }\n\n isJourneyInProgress.current = true;\n\n const labelDims = originalTableRef.current.labelRef.current.getBoundingClientRect();\n const tableCardDims =\n originalTableRef.current?.segmentedCardWrapperRef.current.getBoundingClientRect();\n\n // TAKE THE USER TO THE TABLE CARD\n if (!isTutorialOnboardingDone) {\n setJourney(journeyId, [\n {\n originalElementToHighlightRef: carouselRefs.current?.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to proceed\n </Text>\n ),\n nudgePointerX: 0,\n nudgePointerY: 0,\n } as INudgeProps,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={goToTableLauncher}\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\n },\n ]);\n carouselRefs.current?.goToIndex(PUZZLE_CARD_INDEX);\n nextCoachmark(journeyId, false, SHOW_INITIAL_COACHMARK_AFTER_MS); // Show nudge => Click to proceed\n } else {\n setJourney(journeyId, [\n {\n originalElementToHighlightRef: tablePaginationRef as React.RefObject<HTMLDivElement>,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <S.Indicator $isActive={false} />,\n indicator: {\n position: 'bottom',\n backgroundColor: 'YELLOW_4',\n width: 52,\n tooltipItem: (\n <FlexView\n $position=\"absolute\"\n $flexDirection=\"row\"\n style={{ top: 6, left: 8, cursor: 'pointer' }}\n onClick={goToTableLauncher}\n >\n <Text $renderAs=\"ab2-bold\">NEW</Text>\n </FlexView>\n ),\n tooltipYCoOrdinates: 14, // Need some offset in Y direction from top\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: tablePaginationRef as React.RefObject<HTMLDivElement>,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: '',\n nudgePointerY: 20,\n } as INudgeProps,\n elementToHighlight: <></>,\n },\n ]);\n carouselRefs.current?.goToIndex(LESSON_CARD_INDEX);\n nextCoachmark(journeyId, false, SHOW_INITIAL_COACHMARK_AFTER_MS); // Show Coachmark => NEW\n nextCoachmark(journeyId, true, SHOW_INITIAL_TOOLTIP_AFTER_MS); // Show Nudge over Coachmark\n }\n\n // SHOW THE USER SELECT A TABLE\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'YELLOW_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Get faster at multiplication! Practice everyday and become a Tables champ.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: labelDims.width + 50,\n tooltipYCoOrdinates: labelDims.height / 2,\n } as IArrowTooltipProps,\n });\n\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n {'Pick a table to start'}\n </Text>\n ),\n nudgePointerX: tableCardDims.width / 2 + 50,\n nudgePointerY: tableCardDims.height / 2,\n } as INudgeProps,\n elementToHighlight: (\n <TablesCard\n ref={highlightedTableRef}\n label={tablesData.label}\n data={tablesData.data}\n onPress={() => {}}\n onPressTableSegment={tableInfo => handleTableSegmentClick(tablesData, tableInfo)}\n />\n ),\n });\n },\n [\n addCoachmark,\n carouselRefs,\n goToTableLauncher,\n handleTableSegmentClick,\n journeyId,\n nextCoachmark,\n setJourney,\n ],\n );\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n timerRefs.current.forEach(timer => clearTimeout(timer));\n timerRefs.current = [];\n isJourneyInProgress.current = false;\n };\n }, [journeyId]);\n\n return {\n tableRef: originalTableRef,\n startJourney,\n };\n};\n"],"names":["useTableLauncherJourney","carouselRefs","onTableSegmentClick","journeyId","JOURNEY_ID_STUDENT","originalTableRef","useRef","highlightedTableRef","isJourneyInProgress","timerRefs","playButtonSound","useCircleSounds","nextCoachmark","setJourney","addCoachmark","endJourney","useJourney","trackAnalytics","useUIContext","handleEndJourney","useCallback","tableDetails","PLATFORM_EVENTS_STUDENT","Action","_a","_b","handleTableSegmentClick","launcherData","tableData","segmentedCardDims","tableCardDims","_c","IndicatorType","jsx","TablesCard","FlexView","Text","Fragment","SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS","SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS","startAnimationOnLabelAgain","START_ANIMATING_CLONED_ELEM","goToTableLauncher","TABLE_CARD_INDEX","GO_TO_TABLE_LAUNCHER_DURATION_MS","showNudge","SHOW_CLICK_TABLE_NUDGE_AFTER_MS","animateLabel","startJourney","tablesData","isTutorialOnboardingDone","paginationList","carouselNextBtnRef","tablePaginationRef","_d","labelDims","_e","S.Indicator","_h","LESSON_CARD_INDEX","SHOW_INITIAL_COACHMARK_AFTER_MS","SHOW_INITIAL_TOOLTIP_AFTER_MS","_f","IconButton","CaratRightIcon","GAME_LAUNCHER_ANALYTICS_EVENTS","_g","PUZZLE_CARD_INDEX","tableInfo","useEffect","timer"],"mappings":";;;;;;;;;;;;;;;;;AAyCO,MAAMA,KAA0B,CAAC;AAAA,EACtC,cAAAC;AAAA,EACA,qBAAAC;AACF,MAA6B;AAC3B,QAAMC,IAAYC,EAAmB,6BAC/BC,IAAmBC,EAAsB,IAAI,GAC7CC,IAAsBD,EAAsB,IAAI,GAChDE,IAAsBF,EAAO,EAAK,GAElCG,IAAYH,EAAwC,CAAA,CAAE,GAEtD,EAAE,iBAAAI,MAAoBC,KACtB,EAAE,eAAAC,GAAe,YAAAC,GAAY,cAAAC,GAAc,YAAAC,EAAA,IAAeC,KAC1D,EAAE,SAASC,EAAe,IAAIC,EAAa,GAE3CC,IAAmBC;AAAA,IACvB,CAACC,MAAiC;;AAEhC,MAAIA,KACFnB,EAAoBmB,CAAY,GAElCJ,EAAeK,EAAwB,2BAA2B;AAAA,QAChE,MAAMC,EAAO;AAAA,MAAA,CACd,IAGiBC,IAAAnB,KAAA,gBAAAA,EAAA,YAAA,QAAAmB,EAAS,kBAAkB,MAC7CC,IAAApB,KAAA,gBAAAA,EAAkB,YAAlB,QAAAoB,EAA2B,sBAC3BV,EAAWZ,CAAS;AAAA,IACtB;AAAA,IACA,CAACY,GAAYZ,GAAWD,GAAqBe,CAAc;AAAA,EAAA,GAGvDS,IAA0BN;AAAA,IAC9B,CAACO,GAAuBC,MAA0B;;AAE9C,UAAA,GAACJ,IAAAnB,EAAiB,YAAjB,QAAAmB,EAA0B,wBAAwB,YACnD,GAACC,IAAApB,EAAiB,YAAjB,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OAAO0C,EAAW;AAAA,YAClB,MAAMA,EAAW;AAAA,YACjB,SAAS,MAAM;AAAA,YAAC;AAAA,YAChB,qBAAqB,CAAAmB,MAAa1C,EAAwBuB,GAAYmB,CAAS;AAAA,UAAA;AAAA,QACjF;AAAA,MAAA,CAEH;AAAA,IACH;AAAA,IACA;AAAA,MACEtD;AAAA,MACAb;AAAA,MACAyC;AAAA,MACAhB;AAAA,MACAvB;AAAA,MACAS;AAAA,MACAC;AAAA,IACF;AAAA,EAAA;AAIF,SAAAwD,EAAU,MACD,MAAM;AACX,IAAA5D,EAAU,QAAQ,QAAQ,CAAS6D,MAAA,aAAaA,CAAK,CAAC,GACtD7D,EAAU,UAAU,IACpBD,EAAoB,UAAU;AAAA,EAAA,GAE/B,CAACL,CAAS,CAAC,GAEP;AAAA,IACL,UAAUE;AAAA,IACV,cAAA2C;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"use-table-launcher-journey.js","sources":["../../../../../../src/features/circle-games/game-launcher/hooks/use-table-launcher-journey/use-table-launcher-journey.tsx"],"sourcesContent":["/* eslint-disable react-native/no-inline-styles */\nimport type { IArrowTooltipProps } from '../../../../ui/arrow-tooltip/arrow-tooltip-types';\nimport type { INudgeProps } from '../../../../ui/nudge/nudge-types';\nimport type { ITableCardRef, ITableDetails } from '../../comps/tables-card/tables-card-types';\nimport type {\n ITableInfo,\n ITables,\n} from '../../dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport type { IUseTableJourneyProps } from './use-table-launcher-journey-types';\n\nimport { useCallback, useEffect, useRef } from 'react';\n\nimport CaratRightIcon from '../../../../../assets/line-icons/icons/carat-right';\nimport { PLATFORM_EVENTS_STUDENT } from '../../../../analytics-events/platform-events-student';\nimport { JOURNEY_ID_STUDENT } from '../../../../journey/journey-id/journey-id-student';\nimport { IndicatorType } from '../../../../journey/use-journey/constants';\nimport { useJourney } from '../../../../journey/use-journey/use-journey';\nimport IconButton from '../../../../ui/buttons/icon-button/icon-button';\nimport { useUIContext } from '../../../../ui/context/context';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport { CIRCLE_ONBOARDING_ANALYTICS_STEPS as Action } from '../../../enum/circle-onboarding-steps';\nimport { useCircleSounds } from '../../../hooks/use-circle-sounds/use-circle-sounds';\nimport { TablesCard } from '../../comps/tables-card/tables-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from '../../game-launcher-analytics-events';\nimport {\n LESSON_CARD_INDEX,\n PUZZLE_CARD_INDEX,\n SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS,\n SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS,\n TABLE_CARD_INDEX,\n} from './constants';\nimport {\n GO_TO_TABLE_LAUNCHER_DURATION_MS,\n SHOW_CLICK_TABLE_NUDGE_AFTER_MS,\n SHOW_INITIAL_COACHMARK_AFTER_MS,\n SHOW_INITIAL_TOOLTIP_AFTER_MS,\n START_ANIMATING_CLONED_ELEM,\n} from './constants';\nimport * as S from './use-table-launcher-journey-styled';\n\nexport const useTableLauncherJourney = ({\n carouselRefs,\n onTableSegmentClick,\n}: IUseTableJourneyProps) => {\n const journeyId = JOURNEY_ID_STUDENT.CIRCLE_TABLES_INTRO_JOURNEY;\n const originalTableRef = useRef<ITableCardRef>(null);\n const highlightedTableRef = useRef<ITableCardRef>(null);\n const isJourneyInProgress = useRef(false);\n\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const { playButtonSound } = useCircleSounds();\n const { nextCoachmark, setJourney, addCoachmark, endJourney } = useJourney();\n const { onEvent: trackAnalytics } = useUIContext();\n\n const handleEndJourney = useCallback(\n (tableDetails?: ITableDetails) => {\n // Only when User clicked on play\n if (tableDetails) {\n onTableSegmentClick(tableDetails);\n }\n trackAnalytics(PLATFORM_EVENTS_STUDENT.ONBOARDING_STEP_COMPLETED, {\n step: Action.TABLES,\n });\n\n // Reset original table card ref label\n originalTableRef?.current?.setLabelVisiblity(true);\n originalTableRef?.current?.stopLabelAnimation();\n nextCoachmark(journeyId, false);\n endJourney(journeyId);\n },\n [endJourney, journeyId, nextCoachmark, onTableSegmentClick, trackAnalytics],\n );\n\n const handleTableSegmentClick = useCallback(\n (launcherData: ITables, tableData: ITableInfo) => {\n if (\n !originalTableRef.current?.segmentedCardWrapperRef.current ||\n !originalTableRef.current?.labelRef.current\n ) {\n return;\n }\n\n const segmentedCardDims = originalTableRef.current.labelRef.current.getBoundingClientRect();\n const tableCardDims =\n originalTableRef.current?.segmentedCardWrapperRef.current.getBoundingClientRect();\n\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: (\n <TablesCard\n ref={highlightedTableRef}\n defaultTable={tableData}\n label={launcherData.label}\n data={launcherData.data}\n onPress={handleEndJourney}\n onGoBackFromTableLevel={handleEndJourney}\n />\n ),\n indicator: {\n position: 'left',\n backgroundColor: 'YELLOW_4',\n width: 236,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">Each table has 3 levels—clear them and earn 3 stars!</Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: 0,\n tooltipYCoOrdinates: segmentedCardDims.height * 0.35,\n } as IArrowTooltipProps,\n });\n\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Pick a level\n </Text>\n ),\n nudgePointerX: tableCardDims.width / 2 + 50,\n nudgePointerY: tableCardDims.height * 0.4,\n } as INudgeProps,\n elementToHighlight: <></>,\n });\n\n nextCoachmark(journeyId, false, SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS); // Show coachmark => Each table has 3... and Hide the previous two\n nextCoachmark(journeyId, true, SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS); // Show nudge => Pick a level\n\n const startAnimationOnLabelAgain = setTimeout(() => {\n clearTimeout(startAnimationOnLabelAgain);\n highlightedTableRef.current?.startLabelAnimation('YELLOW_4');\n }, START_ANIMATING_CLONED_ELEM);\n\n timerRefs.current.push(startAnimationOnLabelAgain);\n },\n [addCoachmark, handleEndJourney, journeyId, nextCoachmark],\n );\n\n const goToTableLauncher = useCallback(() => {\n playButtonSound();\n carouselRefs.current?.goToIndex(TABLE_CARD_INDEX);\n nextCoachmark(journeyId, false, GO_TO_TABLE_LAUNCHER_DURATION_MS);\n\n trackAnalytics(PLATFORM_EVENTS_STUDENT.ONBOARDING_STEP_VIEWED, {\n step: Action.TABLES,\n });\n\n const showNudge = setTimeout(() => {\n clearTimeout(showNudge);\n originalTableRef.current?.setLabelVisiblity(false);\n nextCoachmark(journeyId, true);\n }, SHOW_CLICK_TABLE_NUDGE_AFTER_MS);\n\n timerRefs.current.push(showNudge);\n\n const animateLabel = setTimeout(() => {\n clearTimeout(animateLabel);\n highlightedTableRef.current?.startLabelAnimation('YELLOW_4');\n }, START_ANIMATING_CLONED_ELEM);\n\n timerRefs.current.push(animateLabel);\n }, [carouselRefs, journeyId, nextCoachmark, playButtonSound, trackAnalytics]);\n\n const startJourney = useCallback(\n (tablesData: ITables, isTutorialOnboardingDone: boolean = false) => {\n if (isJourneyInProgress.current) {\n return;\n }\n\n const paginationList = carouselRefs.current?.indicatorRefs;\n const carouselNextBtnRef = carouselRefs.current?.nextBtnRef;\n const tablePaginationRef = paginationList?.[TABLE_CARD_INDEX];\n\n if (\n !originalTableRef.current?.segmentedCardWrapperRef.current ||\n !originalTableRef.current?.labelRef.current ||\n !paginationList ||\n !carouselNextBtnRef?.current ||\n !tablePaginationRef ||\n !tablePaginationRef.current\n ) {\n return;\n }\n\n isJourneyInProgress.current = true;\n\n const labelDims = originalTableRef.current.labelRef.current.getBoundingClientRect();\n const tableCardDims =\n originalTableRef.current?.segmentedCardWrapperRef.current.getBoundingClientRect();\n\n // TAKE THE USER TO THE TABLE CARD\n if (!isTutorialOnboardingDone) {\n setJourney(journeyId, [\n {\n originalElementToHighlightRef: carouselRefs.current?.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to proceed\n </Text>\n ),\n nudgePointerX: 0,\n nudgePointerY: 0,\n } as INudgeProps,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={goToTableLauncher}\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\n },\n ]);\n carouselRefs.current?.goToIndex(PUZZLE_CARD_INDEX);\n nextCoachmark(journeyId, false, SHOW_INITIAL_COACHMARK_AFTER_MS); // Show nudge => Click to proceed\n } else {\n setJourney(journeyId, [\n {\n originalElementToHighlightRef: tablePaginationRef as React.RefObject<HTMLDivElement>,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <S.Indicator $isActive={false} />,\n indicator: {\n position: 'bottom',\n backgroundColor: 'YELLOW_4',\n width: 52,\n tooltipItem: (\n <FlexView\n $position=\"absolute\"\n $flexDirection=\"row\"\n style={{ top: 6, left: 8, cursor: 'pointer' }}\n onClick={goToTableLauncher}\n >\n <Text $renderAs=\"ab2-bold\">NEW</Text>\n </FlexView>\n ),\n tooltipYCoOrdinates: 14, // Need some offset in Y direction from top\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: tablePaginationRef as React.RefObject<HTMLDivElement>,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: '',\n nudgePointerY: 20,\n } as INudgeProps,\n elementToHighlight: <></>,\n },\n ]);\n carouselRefs.current?.goToIndex(LESSON_CARD_INDEX);\n nextCoachmark(journeyId, false, SHOW_INITIAL_COACHMARK_AFTER_MS); // Show Coachmark => NEW\n nextCoachmark(journeyId, true, SHOW_INITIAL_TOOLTIP_AFTER_MS); // Show Nudge over Coachmark\n }\n\n // SHOW THE USER SELECT A TABLE\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'YELLOW_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Get faster at multiplication! Practice everyday and become a Tables champ.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: labelDims.width + 50,\n tooltipYCoOrdinates: labelDims.height / 2,\n } as IArrowTooltipProps,\n });\n\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n {'Pick a table to start'}\n </Text>\n ),\n nudgePointerX: tableCardDims.width / 2 + 50,\n nudgePointerY: tableCardDims.height / 2,\n } as INudgeProps,\n elementToHighlight: (\n <TablesCard\n ref={highlightedTableRef}\n label={tablesData.label}\n data={tablesData.data}\n onPress={() => {}}\n onPressTableSegment={tableInfo => handleTableSegmentClick(tablesData, tableInfo)}\n />\n ),\n });\n },\n [\n addCoachmark,\n carouselRefs,\n goToTableLauncher,\n handleTableSegmentClick,\n journeyId,\n nextCoachmark,\n setJourney,\n ],\n );\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n timerRefs.current.forEach(timer => clearTimeout(timer));\n timerRefs.current = [];\n isJourneyInProgress.current = false;\n };\n }, [journeyId]);\n\n return {\n tableRef: originalTableRef,\n startJourney,\n };\n};\n"],"names":["useTableLauncherJourney","carouselRefs","onTableSegmentClick","journeyId","JOURNEY_ID_STUDENT","originalTableRef","useRef","highlightedTableRef","isJourneyInProgress","timerRefs","playButtonSound","useCircleSounds","nextCoachmark","setJourney","addCoachmark","endJourney","useJourney","trackAnalytics","useUIContext","handleEndJourney","useCallback","tableDetails","PLATFORM_EVENTS_STUDENT","Action","_a","_b","handleTableSegmentClick","launcherData","tableData","segmentedCardDims","tableCardDims","_c","IndicatorType","jsx","TablesCard","FlexView","Text","Fragment","SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS","SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS","startAnimationOnLabelAgain","START_ANIMATING_CLONED_ELEM","goToTableLauncher","TABLE_CARD_INDEX","GO_TO_TABLE_LAUNCHER_DURATION_MS","showNudge","SHOW_CLICK_TABLE_NUDGE_AFTER_MS","animateLabel","startJourney","tablesData","isTutorialOnboardingDone","paginationList","carouselNextBtnRef","tablePaginationRef","_d","labelDims","_e","S.Indicator","_h","LESSON_CARD_INDEX","SHOW_INITIAL_COACHMARK_AFTER_MS","SHOW_INITIAL_TOOLTIP_AFTER_MS","_f","IconButton","CaratRightIcon","GAME_LAUNCHER_ANALYTICS_EVENTS","_g","PUZZLE_CARD_INDEX","tableInfo","useEffect","timer"],"mappings":";;;;;;;;;;;;;;;;;AAyCO,MAAMA,KAA0B,CAAC;AAAA,EACtC,cAAAC;AAAA,EACA,qBAAAC;AACF,MAA6B;AAC3B,QAAMC,IAAYC,EAAmB,6BAC/BC,IAAmBC,EAAsB,IAAI,GAC7CC,IAAsBD,EAAsB,IAAI,GAChDE,IAAsBF,EAAO,EAAK,GAElCG,IAAYH,EAAwC,CAAA,CAAE,GAEtD,EAAE,iBAAAI,MAAoBC,KACtB,EAAE,eAAAC,GAAe,YAAAC,GAAY,cAAAC,GAAc,YAAAC,EAAA,IAAeC,KAC1D,EAAE,SAASC,EAAe,IAAIC,EAAa,GAE3CC,IAAmBC;AAAA,IACvB,CAACC,MAAiC;;AAEhC,MAAIA,KACFnB,EAAoBmB,CAAY,GAElCJ,EAAeK,EAAwB,2BAA2B;AAAA,QAChE,MAAMC,EAAO;AAAA,MAAA,CACd,IAGiBC,IAAAnB,KAAA,gBAAAA,EAAA,YAAA,QAAAmB,EAAS,kBAAkB,MAC7CC,IA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AAiB,QAAQ;AAAA,QACxD,UAAU;AAAA,QACV,MAAM2B,EAAc;AAAA,QACpB,WAAW;AAAA,UACT,OAAO;AAAA,UACP,SACG,gBAAAC,EAAAG,GAAA,EAAK,WAAU,OAAM,QAAO,SAC1B,UACH,yBAAA;AAAA,UAEF,eAAeN,EAAc,QAAQ,IAAI;AAAA,UACzC,eAAeA,EAAc,SAAS;AAAA,QACxC;AAAA,QACA,oBACE,gBAAAG;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,KAAK3B;AAAA,YACL,OAAO0C,EAAW;AAAA,YAClB,MAAMA,EAAW;AAAA,YACjB,SAAS,MAAM;AAAA,YAAC;AAAA,YAChB,qBAAqB,CAAAmB,MAAa1C,EAAwBuB,GAAYmB,CAAS;AAAA,UAAA;AAAA,QACjF;AAAA,MAAA,CAEH;AAAA,IACH;AAAA,IACA;AAAA,MACEtD;AAAA,MACAb;AAAA,MACAyC;AAAA,MACAhB;AAAA,MACAvB;AAAA,MACAS;AAAA,MACAC;AAAA,IACF;AAAA,EAAA;AAIF,SAAAwD,EAAU,MACD,MAAM;AACX,IAAA5D,EAAU,QAAQ,QAAQ,CAAS6D,MAAA,aAAaA,CAAK,CAAC,GACtD7D,EAAU,UAAU,IACpBD,EAAoB,UAAU;AAAA,EAAA,GAE/B,CAACL,CAAS,CAAC,GAEP;AAAA,IACL,UAAUE;AAAA,IACV,cAAA2C;AAAA,EAAA;AAEJ;"}
@@ -0,0 +1,12 @@
1
+ import { createGetAPI as o, createPostAPI as u } from "@cuemath/rest-api";
2
+ import { BASE_URL as e } from "../../../constants/api.js";
3
+ const { useGet: p } = o({
4
+ getURL: (n, { app_id: s, journey_status: r, user_id: t }) => `${e}/task/user-journey/?app_id=${s}&journey_status=${r}&user_id=${t}`
5
+ }), { usePost: y } = u({
6
+ getURL: () => `${e}/task/user-journey/`
7
+ });
8
+ export {
9
+ p as useGetJourneyProgress,
10
+ y as usePostJourneyProgress
11
+ };
12
+ //# sourceMappingURL=journey-progress-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"journey-progress-api.js","sources":["../../../../src/features/journey/journey-progress-api/journey-progress-api.ts"],"sourcesContent":["import type {\n TGetJourneyProgressPayloadModel,\n TGetJourneyProgressResponseModel,\n TPostJourneyProgressPayloadModel,\n TPostJourneyProgressResponseModel,\n} from './journey-progress-api-types';\n\nimport { createGetAPI, createPostAPI } from '@cuemath/rest-api';\n\nimport { BASE_URL } from '../../../constants/api';\n\nconst { useGet: useGetJourneyProgress } = createGetAPI<\n TGetJourneyProgressResponseModel,\n TGetJourneyProgressPayloadModel\n>({\n getURL: (_, { app_id, journey_status, user_id }) =>\n `${BASE_URL}/task/user-journey/?app_id=${app_id}&journey_status=${journey_status}&user_id=${user_id}`,\n});\n\nconst { usePost: usePostJourneyProgress } = createPostAPI<\n TPostJourneyProgressResponseModel,\n TPostJourneyProgressPayloadModel\n>({\n getURL: () => `${BASE_URL}/task/user-journey/`,\n});\n\nexport { useGetJourneyProgress, usePostJourneyProgress };\n"],"names":["useGetJourneyProgress","createGetAPI","_","app_id","journey_status","user_id","BASE_URL","usePostJourneyProgress","createPostAPI"],"mappings":";;AAWA,MAAM,EAAE,QAAQA,EAAsB,IAAIC,EAGxC;AAAA,EACA,QAAQ,CAACC,GAAG,EAAE,QAAAC,GAAQ,gBAAAC,GAAgB,SAAAC,EAAA,MACpC,GAAGC,CAAQ,8BAA8BH,CAAM,mBAAmBC,CAAc,YAAYC,CAAO;AACvG,CAAC,GAEK,EAAE,SAASE,EAAuB,IAAIC,EAG1C;AAAA,EACA,QAAQ,MAAM,GAAGF,CAAQ;AAC3B,CAAC;"}
@@ -0,0 +1,11 @@
1
+ import { useJourney as t } from "./use-journey/use-journey.js";
2
+ const u = (n) => {
3
+ const { completedJourneys: r } = t(), e = n.filter(
4
+ (o) => !r.includes(o)
5
+ );
6
+ return e.length > 0 ? e[0] : null;
7
+ };
8
+ export {
9
+ u as useGetEligibleJourneys
10
+ };
11
+ //# sourceMappingURL=use-get-eligible-journeys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-get-eligible-journeys.js","sources":["../../../src/features/journey/use-get-eligible-journeys.tsx"],"sourcesContent":["import type { TJourneyId } from './journey-id/journey-id-types';\n\nimport { useJourney } from './use-journey/use-journey';\n\nexport const useGetEligibleJourneys = (allJourneyIds: TJourneyId[]) => {\n const { completedJourneys } = useJourney();\n const eligibleJourneys = allJourneyIds.filter(\n journeyId => !completedJourneys.includes(journeyId),\n );\n\n if (eligibleJourneys.length > 0) {\n return eligibleJourneys[0];\n }\n\n return null;\n};\n"],"names":["useGetEligibleJourneys","allJourneyIds","completedJourneys","useJourney","eligibleJourneys","journeyId"],"mappings":";AAIa,MAAAA,IAAyB,CAACC,MAAgC;AAC/D,QAAA,EAAE,mBAAAC,MAAsBC,KACxBC,IAAmBH,EAAc;AAAA,IACrC,CAAaI,MAAA,CAACH,EAAkB,SAASG,CAAS;AAAA,EAAA;AAGhD,SAAAD,EAAiB,SAAS,IACrBA,EAAiB,CAAC,IAGpB;AACT;"}
@@ -1,108 +1,107 @@
1
- import { jsxs as D, jsx as R } from "react/jsx-runtime";
2
- import { createContext as N, useState as h, useRef as C, useCallback as l, useMemo as O, useEffect as T } from "react";
3
- import { Coachmark as U } from "../comps/coachmark/coachmark.js";
4
- import { usePostUserJourney as j, useGetUserJourney as L } from "../user-journey-api/user-journey-api.js";
5
- import { BlurOverlay as M } from "./journey-styled.js";
6
- const z = N(null), H = ({ children: b, appId: c, userId: o }) => {
7
- const [p, v] = h([]), [u, s] = h([]), [k, x] = h(!1), a = C(-1), r = C(), J = C([]), { post: $ } = j(), { data: f = null, get: g } = L(), _ = l(
1
+ import { jsxs as O, jsx as $ } from "react/jsx-runtime";
2
+ import { createContext as R, useState as L, useRef as C, useCallback as y, useMemo as D, useEffect as T } from "react";
3
+ import { Coachmark as b } from "../comps/coachmark/coachmark.js";
4
+ import { usePostJourneyProgress as q, useGetJourneyProgress as M } from "../journey-progress-api/journey-progress-api.js";
5
+ import { BlurOverlay as N } from "./journey-styled.js";
6
+ const j = R(null), F = ({ children: w, appId: J, userId: u }) => {
7
+ const [c, p] = L([]), [s, a] = L([]), i = C(-1), r = C(), f = C([]), { post: g } = q(), { data: l = null, get: k } = M(), v = y(
8
8
  (e, t) => {
9
- if (u.length > 0) {
9
+ if (s.length > 0) {
10
10
  console.error(
11
11
  `setJourney: Other Journey is already active, Current Journey: ${r.current}, New Journey Request: ${e}`
12
12
  );
13
13
  return;
14
14
  }
15
- x(!0), r.current = e, a.current = -1, s([...t]);
15
+ r.current = e, i.current = -1, a([...t]);
16
16
  },
17
- [u.length]
18
- ), y = l(() => {
19
- J.current.forEach((e) => {
17
+ [s.length]
18
+ ), d = y(() => {
19
+ f.current.forEach((e) => {
20
20
  clearTimeout(e);
21
- }), J.current = [], r.current = void 0, a.current = -1, s([]), x(!1);
22
- }, []), w = l(
21
+ }), f.current = [], r.current = void 0, i.current = -1, a([]);
22
+ }, []), x = y(
23
23
  (e) => {
24
- (!r.current || e !== r.current) && console.error(
25
- `setJourney was not called before endJourney or Journey ID is different from currentJourney,
26
- currentJourneyId: ${r.current}, New Journey Request: ${e}`
27
- ), v((t) => [...t, e]), $({
28
- app_id: c,
29
- user_id: o,
24
+ if (c.includes(e)) {
25
+ console.error(`endJourney: Journey ID ${e} is already completed.`);
26
+ return;
27
+ }
28
+ p((t) => [...t, e]), g({
29
+ app_id: J,
30
+ user_id: u,
30
31
  journey_id: e,
31
32
  journey_status: "COMPLETED"
32
- }), y();
33
+ }), d();
33
34
  },
34
- [c, y, $, o]
35
- ), A = l((e, t) => {
35
+ [J, d, c, g, u]
36
+ ), E = y((e, t) => {
36
37
  if (!r.current || e !== r.current) {
37
38
  console.error(
38
39
  r.current ? `A Journey is already active, Current Journey: ${r.current}, New Journey Request: ${e}` : "addCoachmark was called before setJourney and Journey ID is undefined"
39
40
  );
40
41
  return;
41
42
  }
42
- s((m) => [...m, t]);
43
- }, []), E = l(
44
- (e, t = !1, m = 0) => {
43
+ a((n) => [...n, t]);
44
+ }, []), P = y(
45
+ (e, t = !1, n = 0) => {
45
46
  if (!r.current || e !== r.current) {
46
47
  console.error(
47
48
  r.current ? "nextCoachmark was called before setJourney" : `A Journey is already active, Current Journey: ${r.current}, New Journey Request: ${e}`
48
49
  );
49
50
  return;
50
51
  }
51
- m !== 0 && s((n) => n.map((i) => ({ ...i, isActive: !1 })));
52
- const P = setTimeout(() => {
53
- clearTimeout(P);
54
- const n = a.current + 1;
55
- s((i) => {
56
- if (n >= i.length || i.length === 0)
57
- return r.current = void 0, a.current = -1, [];
58
- a.current = n;
59
- const d = [...i];
60
- return d[n].isActive = !0, n > 0 && (d[n - 1].isActive = t), d;
52
+ n !== 0 && a((o) => o.map((m) => ({ ...m, isActive: !1 })));
53
+ const _ = setTimeout(() => {
54
+ clearTimeout(_);
55
+ const o = i.current + 1;
56
+ a((m) => {
57
+ if (o >= m.length || m.length === 0)
58
+ return r.current = void 0, i.current = -1, [];
59
+ i.current = o;
60
+ const h = [...m];
61
+ return h[o].isActive = !0, o > 0 && (h[o - 1].isActive = t), h;
61
62
  });
62
- }, m);
63
- J.current.push(P);
63
+ }, n);
64
+ f.current.push(_);
64
65
  },
65
66
  []
66
- ), q = O(
67
+ ), A = D(
67
68
  () => ({
68
- nextCoachmark: E,
69
- setJourney: _,
70
- addCoachmark: A,
71
- clearJourney: y,
72
- endJourney: w,
73
- coachmarks: u,
74
- userCompletedJourneyIds: p,
75
- isJourneyActive: k
69
+ nextCoachmark: P,
70
+ setJourney: v,
71
+ addCoachmark: E,
72
+ clearJourney: d,
73
+ endJourney: x,
74
+ coachmarks: s,
75
+ completedJourneys: c
76
76
  }),
77
77
  [
78
+ P,
79
+ v,
78
80
  E,
79
- _,
80
- A,
81
- y,
82
- w,
83
- u,
84
- p,
85
- k
81
+ d,
82
+ x,
83
+ s,
84
+ c
86
85
  ]
87
86
  );
88
87
  return T(() => {
89
- c && o && g(o, {
90
- app_id: c,
91
- user_id: o,
88
+ u && k(u, {
89
+ app_id: J,
90
+ user_id: u,
92
91
  journey_status: "COMPLETED"
93
92
  });
94
- }, [c, g, o]), T(() => {
95
- if (f) {
96
- const e = f.map((t) => t.journey_id);
97
- v(e);
93
+ }, [J, k, u]), T(() => {
94
+ if (l && c.length === 0) {
95
+ const t = (l == null ? void 0 : l.filter((n) => n.status === "COMPLETED")).map((n) => n.journey_id);
96
+ p(t);
98
97
  }
99
- }, [f]), /* @__PURE__ */ D(z.Provider, { value: q, children: [
100
- u.length > 0 && /* @__PURE__ */ R(M, { children: u.map((e, t) => /* @__PURE__ */ R(U, { coachmark: e }, `coachmark-${t}`)) }),
101
- b
98
+ }, [c.length, l]), /* @__PURE__ */ O(j.Provider, { value: A, children: [
99
+ s.length > 0 && /* @__PURE__ */ $(N, { children: s.map((e, t) => /* @__PURE__ */ $(b, { coachmark: e }, `coachmark-${t}`)) }),
100
+ w
102
101
  ] });
103
102
  };
104
103
  export {
105
- z as JourneyContext,
106
- H as JourneyProvider
104
+ j as JourneyContext,
105
+ F as JourneyProvider
107
106
  };
108
107
  //# sourceMappingURL=journey-context-provider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"journey-context-provider.js","sources":["../../../../src/features/journey/use-journey/journey-context-provider.tsx"],"sourcesContent":["/* eslint-disable no-console */\nimport type { TJourneyId } from '../journey-id/journey-id-types';\nimport type {\n ICoachmarkProps,\n IJourneyContext,\n IJourneyProviderProps,\n} from './journey-context-types';\nimport type { FC } from 'react';\n\nimport { createContext, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { Coachmark } from '../comps/coachmark/coachmark';\nimport { useGetUserJourney, usePostUserJourney } from '../user-journey-api/user-journey-api';\nimport * as S from './journey-styled';\n\nexport const JourneyContext = createContext<IJourneyContext | null>(null);\n\nexport const JourneyProvider: FC<IJourneyProviderProps> = ({ children, appId, userId }) => {\n const [userCompletedJourneyIds, setUserCompletedJourneyIds] = useState<TJourneyId[]>([]);\n const [coachmarkList, setCoachmarkList] = useState<ICoachmarkProps[]>([]);\n const [isJourneyActive, setIsJourneyActive] = useState(false);\n const currentIndex = useRef(-1);\n const currentJourneyId = useRef<TJourneyId | undefined>();\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const { post: postJourneyCompletion } = usePostUserJourney();\n const { data: userCompletedJourneys = null, get: getJourneyProgress } = useGetUserJourney();\n\n const setJourney = useCallback(\n (id: TJourneyId, coachmarks: ICoachmarkProps[]) => {\n if (coachmarkList.length > 0) {\n console.error(\n `setJourney: Other Journey is already active, Current Journey: ${currentJourneyId.current}, New Journey Request: ${id}`,\n );\n\n return;\n }\n setIsJourneyActive(true);\n currentJourneyId.current = id;\n currentIndex.current = -1;\n setCoachmarkList([...coachmarks]);\n },\n [coachmarkList.length],\n );\n\n const clearJourney = useCallback(() => {\n // Clear all timers\n timerRefs.current.forEach(timer => {\n clearTimeout(timer);\n });\n timerRefs.current = [];\n currentJourneyId.current = undefined;\n currentIndex.current = -1;\n setCoachmarkList([]);\n setIsJourneyActive(false);\n }, []);\n\n const endJourney = useCallback(\n (journeyId: TJourneyId) => {\n if (!currentJourneyId.current || journeyId !== currentJourneyId.current) {\n console.error(\n `setJourney was not called before endJourney or Journey ID is different from currentJourney,\n currentJourneyId: ${currentJourneyId.current}, New Journey Request: ${journeyId}`,\n );\n }\n setUserCompletedJourneyIds(prev => [...prev, journeyId]);\n postJourneyCompletion({\n app_id: appId,\n user_id: userId,\n journey_id: journeyId,\n journey_status: 'COMPLETED',\n });\n clearJourney();\n },\n [appId, clearJourney, postJourneyCompletion, userId],\n );\n\n const addCoachmark = useCallback((id: TJourneyId, coachmark: ICoachmarkProps) => {\n if (!currentJourneyId.current || id !== currentJourneyId.current) {\n console.error(\n currentJourneyId.current\n ? `A Journey is already active, Current Journey: ${currentJourneyId.current}, New Journey Request: ${id}`\n : `addCoachmark was called before setJourney and Journey ID is undefined`,\n );\n\n return;\n }\n\n setCoachmarkList(prev => [...prev, coachmark]);\n }, []);\n\n const nextCoachmark = useCallback(\n (id: TJourneyId, keepPrevActive: boolean = false, delayInMs: number = 0) => {\n if (!currentJourneyId.current || id !== currentJourneyId.current) {\n console.error(\n currentJourneyId.current\n ? `nextCoachmark was called before setJourney`\n : `A Journey is already active, Current Journey: ${currentJourneyId.current}, New Journey Request: ${id}`,\n );\n\n return;\n }\n\n if (delayInMs !== 0) {\n // If delay is not 0, we will hide all them coachmarks and reveal only after the delay\n setCoachmarkList(prevList => {\n return prevList.map((item: ICoachmarkProps) => {\n return { ...item, isActive: false };\n });\n });\n }\n\n const timer = setTimeout(() => {\n clearTimeout(timer);\n const currIndex = currentIndex.current + 1;\n\n setCoachmarkList(prevList => {\n // Finish onboarding\n if (currIndex >= prevList.length || prevList.length === 0) {\n currentJourneyId.current = undefined;\n currentIndex.current = -1;\n\n return [];\n }\n\n currentIndex.current = currIndex;\n const updatedCoachmarkList = [...prevList];\n\n (updatedCoachmarkList[currIndex] as ICoachmarkProps).isActive = true;\n\n if (currIndex > 0) {\n (updatedCoachmarkList[currIndex - 1] as ICoachmarkProps).isActive = keepPrevActive;\n }\n\n return updatedCoachmarkList;\n });\n }, delayInMs);\n\n timerRefs.current.push(timer);\n },\n [],\n );\n\n const memoizedContextValue: IJourneyContext = useMemo(\n () => ({\n nextCoachmark,\n setJourney,\n addCoachmark,\n clearJourney,\n endJourney,\n coachmarks: coachmarkList,\n userCompletedJourneyIds,\n isJourneyActive,\n }),\n [\n nextCoachmark,\n setJourney,\n addCoachmark,\n clearJourney,\n endJourney,\n coachmarkList,\n userCompletedJourneyIds,\n isJourneyActive,\n ],\n );\n\n // Get the initial state of incompleteJourneys\n useEffect(() => {\n if (appId && userId) {\n getJourneyProgress(userId, {\n app_id: appId,\n user_id: userId,\n journey_status: 'COMPLETED',\n });\n }\n }, [appId, getJourneyProgress, userId]);\n\n // Set the data to context state initially\n useEffect(() => {\n if (userCompletedJourneys) {\n const completedUserJourneysIds = userCompletedJourneys.map(journey => journey.journey_id);\n\n setUserCompletedJourneyIds(completedUserJourneysIds);\n }\n }, [userCompletedJourneys]);\n\n return (\n <JourneyContext.Provider value={memoizedContextValue}>\n {coachmarkList.length > 0 && (\n <S.BlurOverlay>\n {coachmarkList.map((coachmark, index) => (\n <Coachmark key={`coachmark-${index}`} coachmark={coachmark} />\n ))}\n </S.BlurOverlay>\n )}\n {children}\n </JourneyContext.Provider>\n );\n};\n"],"names":["JourneyContext","createContext","JourneyProvider","children","appId","userId","userCompletedJourneyIds","setUserCompletedJourneyIds","useState","coachmarkList","setCoachmarkList","isJourneyActive","setIsJourneyActive","currentIndex","useRef","currentJourneyId","timerRefs","postJourneyCompletion","usePostUserJourney","userCompletedJourneys","getJourneyProgress","useGetUserJourney","setJourney","useCallback","id","coachmarks","clearJourney","timer","endJourney","journeyId","prev","addCoachmark","coachmark","nextCoachmark","keepPrevActive","delayInMs","prevList","item","currIndex","updatedCoachmarkList","memoizedContextValue","useMemo","useEffect","completedUserJourneysIds","journey","jsxs","jsx","S.BlurOverlay","index","Coachmark"],"mappings":";;;;;AAea,MAAAA,IAAiBC,EAAsC,IAAI,GAE3DC,IAA6C,CAAC,EAAE,UAAAC,GAAU,OAAAC,GAAO,QAAAC,QAAa;AACzF,QAAM,CAACC,GAAyBC,CAA0B,IAAIC,EAAuB,CAAE,CAAA,GACjF,CAACC,GAAeC,CAAgB,IAAIF,EAA4B,CAAE,CAAA,GAClE,CAACG,GAAiBC,CAAkB,IAAIJ,EAAS,EAAK,GACtDK,IAAeC,EAAO,EAAE,GACxBC,IAAmBD,KACnBE,IAAYF,EAAwC,CAAA,CAAE,GAEtD,EAAE,MAAMG,EAAsB,IAAIC,EAAmB,GACrD,EAAE,MAAMC,IAAwB,MAAM,KAAKC,EAAA,IAAuBC,KAElEC,IAAaC;AAAA,IACjB,CAACC,GAAgBC,MAAkC;AAC7C,UAAAhB,EAAc,SAAS,GAAG;AACpB,gBAAA;AAAA,UACN,iEAAiEM,EAAiB,OAAO,0BAA0BS,CAAE;AAAA,QAAA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ACT,gBAAgB;AAAA,IAAA,CACjB;AAAA,EAEF,GAAA,CAACD,GAAOgB,GAAoBf,CAAM,CAAC,GAGtCqC,EAAU,MAAM;AACd,QAAIvB,GAAuB;AACzB,YAAMwB,IAA2BxB,EAAsB,IAAI,CAAAyB,MAAWA,EAAQ,UAAU;AAExF,MAAArC,EAA2BoC,CAAwB;AAAA,IACrD;AAAA,EAAA,GACC,CAACxB,CAAqB,CAAC,GAGvB,gBAAA0B,EAAA7C,EAAe,UAAf,EAAwB,OAAOwC,GAC7B,UAAA;AAAA,IAAA/B,EAAc,SAAS,KACtB,gBAAAqC,EAACC,GAAA,EACE,YAAc,IAAI,CAACf,GAAWgB,wBAC5BC,GAAqC,EAAA,WAAAjB,EAAA,GAAtB,aAAagB,CAAK,EAA0B,CAC7D,GACH;AAAA,IAED7C;AAAA,EACH,EAAA,CAAA;AAEJ;"}
1
+ {"version":3,"file":"journey-context-provider.js","sources":["../../../../src/features/journey/use-journey/journey-context-provider.tsx"],"sourcesContent":["/* eslint-disable no-console */\nimport type { TJourneyId } from '../journey-id/journey-id-types';\nimport type {\n ICoachmarkProps,\n IJourneyContext,\n IJourneyProviderProps,\n} from './journey-context-types';\nimport type { FC } from 'react';\n\nimport { createContext, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { Coachmark } from '../comps/coachmark/coachmark';\nimport {\n useGetJourneyProgress,\n usePostJourneyProgress,\n} from '../journey-progress-api/journey-progress-api';\nimport * as S from './journey-styled';\n\nexport const JourneyContext = createContext<IJourneyContext | null>(null);\n\nexport const JourneyProvider: FC<IJourneyProviderProps> = ({ children, appId, userId }) => {\n const [completedJourneys, setCompletedJourneys] = useState<TJourneyId[]>([]);\n const [coachmarkList, setCoachmarkList] = useState<ICoachmarkProps[]>([]);\n const currentIndex = useRef(-1);\n const currentJourneyIdStudent = useRef<TJourneyId | undefined>();\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const { post: postJourneyCompletion } = usePostJourneyProgress();\n const { data: journeyProgressData = null, get: getJourneyProgress } = useGetJourneyProgress();\n\n const setJourney = useCallback(\n (id: TJourneyId, coachmarks: ICoachmarkProps[]) => {\n if (coachmarkList.length > 0) {\n console.error(\n `setJourney: Other Journey is already active, Current Journey: ${currentJourneyIdStudent.current}, New Journey Request: ${id}`,\n );\n\n return;\n }\n currentJourneyIdStudent.current = id;\n currentIndex.current = -1;\n setCoachmarkList([...coachmarks]);\n },\n [coachmarkList.length],\n );\n\n const clearJourney = useCallback(() => {\n // Clear all timers\n timerRefs.current.forEach(timer => {\n clearTimeout(timer);\n });\n timerRefs.current = [];\n currentJourneyIdStudent.current = undefined;\n currentIndex.current = -1;\n setCoachmarkList([]);\n }, []);\n\n const endJourney = useCallback(\n (journeyId: TJourneyId) => {\n if (completedJourneys.includes(journeyId)) {\n console.error(`endJourney: Journey ID ${journeyId} is already completed.`);\n\n return;\n }\n setCompletedJourneys(prev => [...prev, journeyId]);\n postJourneyCompletion({\n app_id: appId,\n user_id: userId,\n journey_id: journeyId,\n journey_status: 'COMPLETED',\n });\n clearJourney();\n },\n [appId, clearJourney, completedJourneys, postJourneyCompletion, userId],\n );\n\n const addCoachmark = useCallback((id: TJourneyId, coachmark: ICoachmarkProps) => {\n if (!currentJourneyIdStudent.current || id !== currentJourneyIdStudent.current) {\n console.error(\n currentJourneyIdStudent.current\n ? `A Journey is already active, Current Journey: ${currentJourneyIdStudent.current}, New Journey Request: ${id}`\n : `addCoachmark was called before setJourney and Journey ID is undefined`,\n );\n\n return;\n }\n\n setCoachmarkList(prev => [...prev, coachmark]);\n }, []);\n\n const nextCoachmark = useCallback(\n (id: TJourneyId, keepPrevActive: boolean = false, delayInMs: number = 0) => {\n if (!currentJourneyIdStudent.current || id !== currentJourneyIdStudent.current) {\n console.error(\n currentJourneyIdStudent.current\n ? `nextCoachmark was called before setJourney`\n : `A Journey is already active, Current Journey: ${currentJourneyIdStudent.current}, New Journey Request: ${id}`,\n );\n\n return;\n }\n\n if (delayInMs !== 0) {\n // If delay is not 0, we will hide all them coachmarks and reveal only after the delay\n setCoachmarkList(prevList => {\n return prevList.map((item: ICoachmarkProps) => {\n return { ...item, isActive: false };\n });\n });\n }\n\n const timer = setTimeout(() => {\n clearTimeout(timer);\n const currIndex = currentIndex.current + 1;\n\n setCoachmarkList(prevList => {\n // Finish onboarding\n if (currIndex >= prevList.length || prevList.length === 0) {\n currentJourneyIdStudent.current = undefined;\n currentIndex.current = -1;\n\n return [];\n }\n\n currentIndex.current = currIndex;\n const updatedCoachmarkList = [...prevList];\n\n (updatedCoachmarkList[currIndex] as ICoachmarkProps).isActive = true;\n\n if (currIndex > 0) {\n (updatedCoachmarkList[currIndex - 1] as ICoachmarkProps).isActive = keepPrevActive;\n }\n\n return updatedCoachmarkList;\n });\n }, delayInMs);\n\n timerRefs.current.push(timer);\n },\n [],\n );\n\n const memoizedContextValue = useMemo(\n () => ({\n nextCoachmark,\n setJourney,\n addCoachmark,\n clearJourney,\n endJourney,\n coachmarks: coachmarkList,\n completedJourneys,\n }),\n [\n nextCoachmark,\n setJourney,\n addCoachmark,\n clearJourney,\n endJourney,\n coachmarkList,\n completedJourneys,\n ],\n );\n\n // Get the initial state of incompleteJourneys\n useEffect(() => {\n if (userId) {\n getJourneyProgress(userId, {\n app_id: appId,\n user_id: userId,\n journey_status: 'COMPLETED',\n });\n }\n }, [appId, getJourneyProgress, userId]);\n\n // Set the data to context state initially\n useEffect(() => {\n if (journeyProgressData && completedJourneys.length === 0) {\n const completedJourneysList = journeyProgressData?.filter(journey => {\n return journey.status === 'COMPLETED';\n });\n const completedJourneysIds = completedJourneysList.map(journey => journey.journey_id);\n\n setCompletedJourneys(completedJourneysIds);\n }\n }, [completedJourneys.length, journeyProgressData]);\n\n return (\n <JourneyContext.Provider value={memoizedContextValue}>\n {coachmarkList.length > 0 && (\n <S.BlurOverlay>\n {coachmarkList.map((coachmark, index) => (\n <Coachmark key={`coachmark-${index}`} coachmark={coachmark} />\n ))}\n </S.BlurOverlay>\n )}\n {children}\n </JourneyContext.Provider>\n );\n};\n"],"names":["JourneyContext","createContext","JourneyProvider","children","appId","userId","completedJourneys","setCompletedJourneys","useState","coachmarkList","setCoachmarkList","currentIndex","useRef","currentJourneyIdStudent","timerRefs","postJourneyCompletion","usePostJourneyProgress","journeyProgressData","getJourneyProgress","useGetJourneyProgress","setJourney","useCallback","id","coachmarks","clearJourney","timer","endJourney","journeyId","prev","addCoachmark","coachmark","nextCoachmark","keepPrevActive","delayInMs","prevList","item","currIndex","updatedCoachmarkList","memoizedContextValue","useMemo","useEffect","completedJourneysIds","journey","jsxs","jsx","S.BlurOverlay","index","Coachmark"],"mappings":";;;;;AAkBa,MAAAA,IAAiBC,EAAsC,IAAI,GAE3DC,IAA6C,CAAC,EAAE,UAAAC,GAAU,OAAAC,GAAO,QAAAC,QAAa;AACzF,QAAM,CAACC,GAAmBC,CAAoB,IAAIC,EAAuB,CAAE,CAAA,GACrE,CAACC,GAAeC,CAAgB,IAAIF,EAA4B,CAAE,CAAA,GAClEG,IAAeC,EAAO,EAAE,GACxBC,IAA0BD,KAC1BE,IAAYF,EAAwC,CAAA,CAAE,GAEtD,EAAE,MAAMG,EAAsB,IAAIC,EAAuB,GACzD,EAAE,MAAMC,IAAsB,MAAM,KAAKC,EAAA,IAAuBC,KAEhEC,IAAaC;AAAA,IACjB,CAACC,GAAgBC,MAAkC;AAC7C,UAAAd,EAAc,SAAS,GAAG;AACpB,gBAAA;AAAA,UACN,iEAAiEI,EAAwB,OAAO,0BAA0BS,CAAE;AAAA,QAAA;AAG9H;AAAA,MACF;AACA,MAAAT,EAAwB,UAAUS,GAClCX,EAAa,UAAU,IACND,EAAA,CAAC,GAAGa,CAAU,CAAC;AAAA,IAClC;AAAA,IACA,CAACd,EAAc,MAAM;AAAA,EAAA,GAGjBe,IAAeH,EAAY,MAAM;AAE3B,IAAAP,EAAA,QAAQ,QAAQ,CAASW,MAAA;AACjC,mBAAaA,CAAK;AAAA,IAAA,CACnB,GACDX,EAA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BAAA0B,EAAA3C,EAAe,UAAf,EAAwB,OAAOsC,GAC7B,UAAA;AAAA,IAAA7B,EAAc,SAAS,KACtB,gBAAAmC,EAACC,GAAA,EACE,YAAc,IAAI,CAACf,GAAWgB,wBAC5BC,GAAqC,EAAA,WAAAjB,EAAA,GAAtB,aAAagB,CAAK,EAA0B,CAC7D,GACH;AAAA,IAED3C;AAAA,EACH,EAAA,CAAA;AAEJ;"}
package/dist/index.d.ts CHANGED
@@ -1294,7 +1294,6 @@ declare interface IIsOkayTypeQuestion {
1294
1294
  * Context interface for managing onboarding journeys using coachmarks.
1295
1295
  */
1296
1296
  export declare interface IJourneyContext {
1297
- isJourneyActive: boolean;
1298
1297
  /** List of all active coachmarks within the journey. */
1299
1298
  coachmarks: ICoachmarkProps[];
1300
1299
  /**
@@ -1327,17 +1326,8 @@ export declare interface IJourneyContext {
1327
1326
  * @param delayInMs - Optional delay (in milliseconds) before rendering the current coachmark.
1328
1327
  */
1329
1328
  nextCoachmark: (id: TJourneyId, keepPrevActive?: boolean, delayInMs?: number) => void;
1330
- /**
1331
- * Must be called to end journey and update the journey status on server.
1332
- * @param id - The journey id.
1333
- */
1334
1329
  endJourney: (id: TJourneyId) => void;
1335
- /**
1336
- * Array of IDs representing the journeys that the user has completed.
1337
- * This data is set only the component is mounted.
1338
- * And thereafter it is updated when the user completes a journey, through the `endJourney` method.
1339
- */
1340
- userCompletedJourneyIds: TJourneyId[];
1330
+ completedJourneys: TJourneyId[];
1341
1331
  }
1342
1332
 
1343
1333
  declare interface IJourneyProviderProps {
@@ -5027,7 +5017,7 @@ export declare const useGetCircleHomeDetailsDal: (userId: string, grade: string,
5027
5017
  invalidateCircleHomeDetails: () => void;
5028
5018
  };
5029
5019
 
5030
- export declare const useGetEligibleJourneysViaRoute: (routeJourneyIds: TJourneyId[]) => JOURNEY_ID_STUDENT[];
5020
+ export declare const useGetEligibleJourneys: (allJourneyIds: TJourneyId[]) => JOURNEY_ID_STUDENT | null | undefined;
5031
5021
 
5032
5022
  declare const useGetLeaderboard: (initialId?: string, initialQuery?: IGetLeaderboardPayloadModel | undefined) => {
5033
5023
  get: (id: string, query: IGetLeaderboardPayloadModel, meta: void) => Promise<void>;
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import { default as _ } from "./assets/line-icons/icons/book.js";
12
12
  import { default as h } from "./assets/line-icons/icons/book2.js";
13
13
  import { default as k } from "./assets/line-icons/icons/bookmark.js";
14
14
  import { default as N } from "./assets/line-icons/icons/bulb.js";
15
- import { default as R } from "./assets/line-icons/icons/bulb2.js";
15
+ import { default as H } from "./assets/line-icons/icons/bulb2.js";
16
16
  import { default as D } from "./assets/line-icons/icons/calendar.js";
17
17
  import { default as y } from "./assets/line-icons/icons/check.js";
18
18
  import { default as B } from "./assets/line-icons/icons/check2.js";
@@ -39,7 +39,7 @@ import { default as _e } from "./assets/line-icons/icons/highlighter.js";
39
39
  import { default as he } from "./assets/line-icons/icons/home.js";
40
40
  import { default as ke } from "./assets/line-icons/icons/image.js";
41
41
  import { default as Ne } from "./assets/line-icons/icons/info.js";
42
- import { default as Re } from "./assets/line-icons/icons/info2.js";
42
+ import { default as He } from "./assets/line-icons/icons/info2.js";
43
43
  import { default as De } from "./assets/line-icons/icons/left.js";
44
44
  import { default as ye } from "./assets/line-icons/icons/lock.js";
45
45
  import { default as Be } from "./assets/line-icons/icons/lock2.js";
@@ -66,7 +66,7 @@ import { default as Po } from "./assets/line-icons/icons/search.js";
66
66
  import { default as Lo } from "./assets/line-icons/icons/sheet.js";
67
67
  import { default as Mo } from "./assets/line-icons/icons/star.js";
68
68
  import { default as Oo } from "./assets/line-icons/icons/skip.js";
69
- import { default as Ho } from "./assets/line-icons/icons/skip2.js";
69
+ import { default as Ro } from "./assets/line-icons/icons/skip2.js";
70
70
  import { default as Go } from "./assets/line-icons/icons/star2.js";
71
71
  import { default as go } from "./assets/line-icons/icons/striked-eye.js";
72
72
  import { default as bo } from "./assets/line-icons/icons/switch-icon.js";
@@ -92,7 +92,7 @@ import { default as _r } from "./features/hooks/use-zoom-disable.js";
92
92
  import { default as hr } from "./features/hooks/use-force-reload.js";
93
93
  import { default as kr } from "./features/ui/accordion-section/accordion-section.js";
94
94
  import { default as Nr } from "./features/ui/arrow-tooltip/arrow-tooltip.js";
95
- import { default as Rr } from "./features/ui/context-menu/context-menu.js";
95
+ import { default as Hr } from "./features/ui/context-menu/context-menu.js";
96
96
  import { default as Dr } from "./features/ui/timers/countdown-timer/countdown-timer.js";
97
97
  import { default as yr } from "./features/ui/nudge/nudge.js";
98
98
  import { default as Br } from "./features/ui/buttons/button/button.js";
@@ -119,7 +119,7 @@ import { default as _t } from "./features/ui/radio-cards/radio-cards.js";
119
119
  import { default as ht } from "./features/ui/section-list/section-list.js";
120
120
  import { default as kt } from "./features/ui/text/text.js";
121
121
  import { default as Nt } from "./features/ui/tag/tag.js";
122
- import { default as Rt } from "./features/ui/callout/callout.js";
122
+ import { default as Ht } from "./features/ui/callout/callout.js";
123
123
  import { default as Dt, useUIContext as Gt } from "./features/ui/context/context.js";
124
124
  import { default as gt } from "./features/ui/context/use-tracking-context.js";
125
125
  import { default as bt } from "./features/ui/hooks/use-context-menu-click-handler.js";
@@ -146,7 +146,7 @@ import { GAME_LAUNCHER_ASSET_PADDING as Pa } from "./features/circle-games/game-
146
146
  import { GAME_LAUNCHER_SIZE as La } from "./features/circle-games/game-launcher/comps/card-container/constants.js";
147
147
  import { useCircleSounds as Ma } from "./features/circle-games/hooks/use-circle-sounds/use-circle-sounds.js";
148
148
  import { CircleSoundKey as Oa } from "./features/circle-games/hooks/use-circle-sounds/use-circle-sounds-enums.js";
149
- import { useGetLeaderboardDal as Ha } from "./features/circle-games/leaderboard/dal/use-get-leaderboard-dal/use-get-leaderboard-dal.js";
149
+ import { useGetLeaderboardDal as Ra } from "./features/circle-games/leaderboard/dal/use-get-leaderboard-dal/use-get-leaderboard-dal.js";
150
150
  import { ELeaderboardType as Ga } from "./features/circle-games/leaderboard/enums/leaderboard-type-enum.js";
151
151
  import { StreakReductionLocalStorageUtil as ga } from "./features/circle-games/utils/streak-reduction-localstorage-util.js";
152
152
  import { Tutorial as ba } from "./features/circle-games/games/tutorial/tutorial.js";
@@ -172,7 +172,7 @@ import { default as Pf } from "./features/cue-canvas/hooks/use-canvas-sync-broke
172
172
  import { default as Lf } from "./features/communication/hooks/use-inclass-message-broker/use-inclass-message-broker.js";
173
173
  import { default as Mf } from "./features/communication/hooks/use-trial-session-message-broker/use-trial-session-message-broker.js";
174
174
  import { EVENTS as Of } from "./features/communication/pub-sub/constants.js";
175
- import { useInClassActionDispatcher as Hf, useInClassActionListener as Df } from "./features/communication/pub-sub/hooks.js";
175
+ import { useInClassActionDispatcher as Rf, useInClassActionListener as Df } from "./features/communication/pub-sub/hooks.js";
176
176
  import { default as yf } from "./features/trial-session/trial-session.js";
177
177
  import { EClassTimeAlertLevel as Bf } from "./features/trial-session/trial-session-types.js";
178
178
  import { useClassTimeAlerts as Uf } from "./features/trial-session/hooks/use-class-time-alerts.js";
@@ -181,7 +181,7 @@ import { default as wf } from "./features/extra-practice/extra-practice.js";
181
181
  import { useAutoPlayPermission as Yf } from "./features/hooks/use-auto-play-permission/use-auto-play-permission.js";
182
182
  import { JOURNEY_ID_STUDENT as Kf } from "./features/journey/journey-id/journey-id-student.js";
183
183
  import { useJourney as jf } from "./features/journey/use-journey/use-journey.js";
184
- import { useGetEligibleJourneysViaRoute as qf } from "./features/journey/hooks/use-get-eligible-journeys-via-route.js";
184
+ import { useGetEligibleJourneys as qf } from "./features/journey/use-get-eligible-journeys.js";
185
185
  import { JourneyProvider as Xf } from "./features/journey/use-journey/journey-context-provider.js";
186
186
  import { IndicatorType as es } from "./features/journey/use-journey/constants.js";
187
187
  import { Coachmark as rs } from "./features/journey/comps/coachmark/coachmark.js";
@@ -198,7 +198,7 @@ import { default as _s } from "./features/milestone/edit/goal-edit-container.js"
198
198
  import { default as hs } from "./features/milestone/edit/milestone-edit-container.js";
199
199
  import { default as ks } from "./features/milestone/milestone-list-container/milestone-list-container.js";
200
200
  import { default as Ns } from "./features/milestone/milestone-action-widget/milestone-action-widget.js";
201
- import { default as Rs } from "./features/milestone/start/milestone-start.js";
201
+ import { default as Hs } from "./features/milestone/start/milestone-start.js";
202
202
  import { default as Ds } from "./features/milestone/milestone-tests/tests-creation/tests-creation.js";
203
203
  import { default as ys } from "./features/milestone/milestone-resources/resources-assign/resources-assign.js";
204
204
  import { ACHIEVEMENT_ACTIONS as Bs, STAGES as bs } from "./features/milestone/outcome/milestone-outcome-constants.js";
@@ -217,7 +217,7 @@ import { default as ul } from "./features/sheets/reference-sheet/reference-sheet
217
217
  import { isV3Worksheet as dl, isV3WorksheetAttempt as nl } from "./features/sheets/utils/is-v3-worksheet.js";
218
218
  import { COMPLETED_SHEET_STATE as Il, NODE_LABELS as il, NODE_SUB_GROUP as Tl, NODE_TYPE as El, PYTHON_NODE_TYPES as Sl, REWARDS_LIST as Cl, SHEET_ACTIONS as Al, SHEET_ATTEMPT_LOCATION as _l, SHEET_ATTEMPT_LOCATION_MAP as Pl, SHEET_ATTEMPT_STATE as hl, SHEET_DATA_TYPE as Ll, SHEET_STATE as kl } from "./features/sheets/constants/sheet.js";
219
219
  import { default as Nl } from "./features/student-details/student-details.js";
220
- import { default as Rl } from "./features/utils/load-script.js";
220
+ import { default as Hl } from "./features/utils/load-script.js";
221
221
  import { ACTION_BAR_HEIGHT as Dl, QUESTIONS_GAP as Gl, QUESTION_WIDTH as yl, TOP_NAVIGATION_HEIGHT as gl } from "./features/worksheet/worksheet/constants.js";
222
222
  import { isOkayTypeQuestion as bl } from "./features/worksheet/worksheet/worksheet-helpers.js";
223
223
  import { default as vl } from "./features/worksheet/worksheet/worksheet-container.js";
@@ -248,14 +248,14 @@ export {
248
248
  C as BookClosedIcon,
249
249
  _ as BookIcon,
250
250
  k as BookmarkIcon,
251
- R as Bulb2Icon,
251
+ H as Bulb2Icon,
252
252
  N as BulbIcon,
253
253
  Br as Button,
254
254
  $a as CIRCLE_ACTION_IDS,
255
255
  za as CIRCLE_ONBOARDING_ANALYTICS_STEPS,
256
256
  Il as COMPLETED_SHEET_STATE,
257
257
  D as CalendarIcon,
258
- Rt as Callout,
258
+ Ht as Callout,
259
259
  pt as CascadingSelectInput,
260
260
  xa as Chapter,
261
261
  ps as ChapterClearanceConfirmationModal,
@@ -277,7 +277,7 @@ export {
277
277
  W as ClockIcon,
278
278
  rs as Coachmark,
279
279
  Y as CodeIcon,
280
- Rr as ContextMenu,
280
+ Hr as ContextMenu,
281
281
  K as CopyIcon,
282
282
  Dr as CountdownTimer,
283
283
  j as CrossIcon,
@@ -327,7 +327,7 @@ export {
327
327
  Wr as IconButton,
328
328
  ke as ImageIcon,
329
329
  es as IndicatorType,
330
- Re as Info2Icon,
330
+ He as Info2Icon,
331
331
  Ne as InfoIcon,
332
332
  Kf as JOURNEY_ID_STUDENT,
333
333
  Xf as JourneyProvider,
@@ -345,7 +345,7 @@ export {
345
345
  hs as MilestoneEdit,
346
346
  ks as MilestoneList,
347
347
  cs as MilestoneOutcome,
348
- Rs as MilestoneStart,
348
+ Hs as MilestoneStart,
349
349
  We as Minus2Icon,
350
350
  Ue as MinusIcon,
351
351
  we as MistakeIcon,
@@ -408,7 +408,7 @@ export {
408
408
  Ql as SheetLocked,
409
409
  cf as SignUp,
410
410
  er as SketchIcon,
411
- Ho as Skip2Icon,
411
+ Ro as Skip2Icon,
412
412
  Oo as SkipIcon,
413
413
  df as SplashScreen,
414
414
  Go as Star2Icon,
@@ -456,7 +456,7 @@ export {
456
456
  bl as isOkayTypeQuestion,
457
457
  dl as isV3Worksheet,
458
458
  nl as isV3WorksheetAttempt,
459
- Rl as loadScript,
459
+ Hl as loadScript,
460
460
  Yf as useAutoPlayPermission,
461
461
  Pf as useCanvasSyncBroker,
462
462
  Ma as useCircleSounds,
@@ -465,11 +465,11 @@ export {
465
465
  hr as useForceReload,
466
466
  Ws as useGetAllMilestonesdata,
467
467
  tf as useGetCircleHomeDetailsDal,
468
- qf as useGetEligibleJourneysViaRoute,
469
- Ha as useGetLeaderboardDal,
468
+ qf as useGetEligibleJourneys,
469
+ Ra as useGetLeaderboardDal,
470
470
  Ks as useGetMilestoneResources,
471
471
  Qs as useGetTestHelpData,
472
- Hf as useInClassActionDispatcher,
472
+ Rf as useInClassActionDispatcher,
473
473
  Df as useInClassActionListener,
474
474
  Lf as useInClassMessageBroker,
475
475
  Zl as useIsLearnosityLoaded,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuemath/leap",
3
- "version": "2.8.57-rj-4",
3
+ "version": "2.8.57",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -1,13 +0,0 @@
1
- import { useMemo as i } from "react";
2
- import { useJourney as s } from "../use-journey/use-journey.js";
3
- const n = (e) => {
4
- const { userCompletedJourneyIds: o } = s();
5
- return i(
6
- () => e.filter((r) => !o.includes(r)),
7
- [e, o]
8
- );
9
- };
10
- export {
11
- n as useGetEligibleJourneysViaRoute
12
- };
13
- //# sourceMappingURL=use-get-eligible-journeys-via-route.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-get-eligible-journeys-via-route.js","sources":["../../../../src/features/journey/hooks/use-get-eligible-journeys-via-route.tsx"],"sourcesContent":["import type { TJourneyId } from '../journey-id/journey-id-types';\n\nimport { useMemo } from 'react';\n\nimport { useJourney } from '../use-journey/use-journey';\n\nexport const useGetEligibleJourneysViaRoute = (routeJourneyIds: TJourneyId[]) => {\n const { userCompletedJourneyIds } = useJourney();\n\n const eligibleJourneys = useMemo(\n () => routeJourneyIds.filter(journeyId => !userCompletedJourneyIds.includes(journeyId)),\n [routeJourneyIds, userCompletedJourneyIds],\n );\n\n return eligibleJourneys;\n};\n"],"names":["useGetEligibleJourneysViaRoute","routeJourneyIds","userCompletedJourneyIds","useJourney","useMemo","journeyId"],"mappings":";;AAMa,MAAAA,IAAiC,CAACC,MAAkC;AACzE,QAAA,EAAE,yBAAAC,MAA4BC;AAO7B,SALkBC;AAAA,IACvB,MAAMH,EAAgB,OAAO,CAAAI,MAAa,CAACH,EAAwB,SAASG,CAAS,CAAC;AAAA,IACtF,CAACJ,GAAiBC,CAAuB;AAAA,EAAA;AAI7C;"}
@@ -1,12 +0,0 @@
1
- import { createGetAPI as o, createPostAPI as u } from "@cuemath/rest-api";
2
- import { BASE_URL_V1 as e } from "../../../constants/api.js";
3
- const { useGet: p } = o({
4
- getURL: (n, { app_id: t, journey_status: s, user_id: r }) => `${e}/task/user-journey/?app_id=${t}&journey_status=${s}&user_id=${r}`
5
- }), { usePost: y } = u({
6
- getURL: () => `${e}/task/user-journey/`
7
- });
8
- export {
9
- p as useGetUserJourney,
10
- y as usePostUserJourney
11
- };
12
- //# sourceMappingURL=user-journey-api.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"user-journey-api.js","sources":["../../../../src/features/journey/user-journey-api/user-journey-api.ts"],"sourcesContent":["import type {\n TGetJourneyProgressPayloadModel,\n TGetJourneyProgressResponseModel,\n TPostJourneyProgressPayloadModel,\n TPostJourneyProgressResponseModel,\n} from './user-journey-api-types';\n\nimport { createGetAPI, createPostAPI } from '@cuemath/rest-api';\n\nimport { BASE_URL_V1 } from '../../../constants/api';\n\nconst { useGet: useGetUserJourney } = createGetAPI<\n TGetJourneyProgressResponseModel,\n TGetJourneyProgressPayloadModel\n>({\n getURL: (_, { app_id, journey_status, user_id }) =>\n `${BASE_URL_V1}/task/user-journey/?app_id=${app_id}&journey_status=${journey_status}&user_id=${user_id}`,\n});\n\nconst { usePost: usePostUserJourney } = createPostAPI<\n TPostJourneyProgressResponseModel,\n TPostJourneyProgressPayloadModel\n>({\n getURL: () => `${BASE_URL_V1}/task/user-journey/`,\n});\n\nexport { useGetUserJourney, usePostUserJourney };\n"],"names":["useGetUserJourney","createGetAPI","_","app_id","journey_status","user_id","BASE_URL_V1","usePostUserJourney","createPostAPI"],"mappings":";;AAWA,MAAM,EAAE,QAAQA,EAAkB,IAAIC,EAGpC;AAAA,EACA,QAAQ,CAACC,GAAG,EAAE,QAAAC,GAAQ,gBAAAC,GAAgB,SAAAC,EAAA,MACpC,GAAGC,CAAW,8BAA8BH,CAAM,mBAAmBC,CAAc,YAAYC,CAAO;AAC1G,CAAC,GAEK,EAAE,SAASE,EAAmB,IAAIC,EAGtC;AAAA,EACA,QAAQ,MAAM,GAAGF,CAAW;AAC9B,CAAC;"}