@cuemath/leap 2.8.21-rj-0 → 2.8.21-rj-2
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.
- package/dist/features/circle-games/game-launcher/dal/use-post-update-circle-journey-dal/use-post-update-circle-journey-dal.js +16 -13
- package/dist/features/circle-games/game-launcher/dal/use-post-update-circle-journey-dal/use-post-update-circle-journey-dal.js.map +1 -1
- package/dist/features/circle-games/game-launcher/game-launcher.js +24 -23
- package/dist/features/circle-games/game-launcher/game-launcher.js.map +1 -1
- package/dist/features/circle-games/game-launcher/use-game-launcher-journey/use-game-launcher-journey.js +80 -75
- package/dist/features/circle-games/game-launcher/use-game-launcher-journey/use-game-launcher-journey.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/package.json +1 -1
@@ -1,18 +1,21 @@
|
|
1
|
-
import { useCallback as
|
2
|
-
import { usePostUpdateCircleCoachmark as
|
3
|
-
const p = (o
|
1
|
+
import { useCallback as n } from "react";
|
2
|
+
import { usePostUpdateCircleCoachmark as a } from "../../api/update-circle-onboarding/post-circle-coachmark-api.js";
|
3
|
+
const p = (o) => {
|
4
4
|
const {
|
5
|
-
post:
|
6
|
-
isProcessing:
|
7
|
-
onComplete:
|
5
|
+
post: e,
|
6
|
+
isProcessing: t,
|
7
|
+
onComplete: r,
|
8
8
|
...s
|
9
|
-
} =
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
9
|
+
} = a(), c = n(
|
10
|
+
(l) => {
|
11
|
+
e({
|
12
|
+
intelenrollment_id: o,
|
13
|
+
completed_coachmarks: l
|
14
|
+
});
|
15
|
+
},
|
16
|
+
[e, o]
|
17
|
+
);
|
18
|
+
return { ...s, isProcessing: t, onComplete: r, postCircleJourneyCompletion: c };
|
16
19
|
};
|
17
20
|
export {
|
18
21
|
p as usePostUpdateCircleJourneyDal
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-post-update-circle-journey-dal.js","sources":["../../../../../../src/features/circle-games/game-launcher/dal/use-post-update-circle-journey-dal/use-post-update-circle-journey-dal.ts"],"sourcesContent":["import type { TJourneyId } from '../../../../journey/journey-id/journey-id-types';\n\nimport { useCallback } from 'react';\n\nimport { usePostUpdateCircleCoachmark } from '../../api/update-circle-onboarding/post-circle-coachmark-api';\n\nexport const usePostUpdateCircleJourneyDal = (\n userId: string,\n
|
1
|
+
{"version":3,"file":"use-post-update-circle-journey-dal.js","sources":["../../../../../../src/features/circle-games/game-launcher/dal/use-post-update-circle-journey-dal/use-post-update-circle-journey-dal.ts"],"sourcesContent":["import type { TJourneyId } from '../../../../journey/journey-id/journey-id-types';\n\nimport { useCallback } from 'react';\n\nimport { usePostUpdateCircleCoachmark } from '../../api/update-circle-onboarding/post-circle-coachmark-api';\n\nexport const usePostUpdateCircleJourneyDal = (\n userId: string,\n): Omit<ReturnType<typeof usePostUpdateCircleCoachmark>, 'data' | 'post'> & {\n postCircleJourneyCompletion: (journeyCompletionIds: TJourneyId[]) => void;\n} => {\n const {\n post: postCircleCoachmark,\n isProcessing,\n onComplete,\n ...rest\n } = usePostUpdateCircleCoachmark();\n\n const postCircleJourneyCompletion = useCallback(\n (journeyCompletionIds: TJourneyId[]) => {\n postCircleCoachmark({\n intelenrollment_id: userId,\n completed_coachmarks: journeyCompletionIds,\n });\n },\n [postCircleCoachmark, userId],\n );\n\n return { ...rest, isProcessing, onComplete, postCircleJourneyCompletion };\n};\n"],"names":["usePostUpdateCircleJourneyDal","userId","postCircleCoachmark","isProcessing","onComplete","rest","usePostUpdateCircleCoachmark","postCircleJourneyCompletion","useCallback","journeyCompletionIds"],"mappings":";;AAMa,MAAAA,IAAgC,CAC3CC,MAGG;AACG,QAAA;AAAA,IACJ,MAAMC;AAAA,IACN,cAAAC;AAAA,IACA,YAAAC;AAAA,IACA,GAAGC;AAAA,MACDC,EAA6B,GAE3BC,IAA8BC;AAAA,IAClC,CAACC,MAAuC;AAClB,MAAAP,EAAA;AAAA,QAClB,oBAAoBD;AAAA,QACpB,sBAAsBQ;AAAA,MAAA,CACvB;AAAA,IACH;AAAA,IACA,CAACP,GAAqBD,CAAM;AAAA,EAAA;AAG9B,SAAO,EAAE,GAAGI,GAAM,cAAAF,GAAc,YAAAC,GAAY,6BAAAG,EAA4B;AAC1E;"}
|
@@ -1,27 +1,28 @@
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
2
|
-
import
|
3
|
-
import { memo as
|
4
|
-
import { CircularLoader as
|
5
|
-
import { useCircleSounds as
|
2
|
+
import T from "lottie-web";
|
3
|
+
import { memo as h, useState as R, useRef as S, useMemo as P, useEffect as x } from "react";
|
4
|
+
import { CircularLoader as G } from "../../ui/loader/circular-loader/circular-loader.js";
|
5
|
+
import { useCircleSounds as M } from "../hooks/use-circle-sounds/use-circle-sounds.js";
|
6
6
|
import { Carousel as V } from "./comps/carousel/carousel.js";
|
7
7
|
import { SegmentedGameCard as n } from "./comps/segmented-game-card/segmented-game-card.js";
|
8
8
|
import { GAME_LAUNCHER_ANALYTICS_EVENTS as z } from "./game-launcher-analytics-events.js";
|
9
|
-
import { SleepyBoiLottyContainer as
|
10
|
-
import { useGameLauncherJourney as
|
9
|
+
import { SleepyBoiLottyContainer as _ } from "./game-launcher-styled.js";
|
10
|
+
import { useGameLauncherJourney as B } from "./use-game-launcher-journey/use-game-launcher-journey.js";
|
11
11
|
import { ProjectType as i } from "../games/web-view/enums/project-type-enum.js";
|
12
|
-
const
|
13
|
-
({ onSegmentClick: o, journeyId: t, data: e, isLoading:
|
14
|
-
const [
|
12
|
+
const J = () => import("../../../assets/lotties/circle/sleepy-boi-lottie.json.js"), Q = h(
|
13
|
+
({ onSegmentClick: o, onJourneyComplete: g, journeyId: t, data: e, isLoading: C, defaultIndex: b = 0 }) => {
|
14
|
+
const [v, A] = R(b), m = S(null), { playSwipSound: u } = M(), {
|
15
15
|
gameRefs: a,
|
16
16
|
lessonRefs: p,
|
17
17
|
puzzleRefs: c,
|
18
18
|
startJourney: f,
|
19
19
|
carouselNextBtnRef: y,
|
20
20
|
isJourneyInProgress: L
|
21
|
-
} =
|
22
|
-
setCarouselIndex:
|
23
|
-
onSegmentClick: o
|
24
|
-
|
21
|
+
} = B({
|
22
|
+
setCarouselIndex: A,
|
23
|
+
onSegmentClick: o,
|
24
|
+
onJourneyComplete: g
|
25
|
+
}), E = P(() => {
|
25
26
|
let l = [];
|
26
27
|
return e && (e.lessons && (l = [
|
27
28
|
...l,
|
@@ -76,17 +77,17 @@ const B = () => import("../../../assets/lotties/circle/sleepy-boi-lottie.json.js
|
|
76
77
|
}
|
77
78
|
)
|
78
79
|
]), l;
|
79
|
-
}, [e, a, p, o, c]),
|
80
|
-
() => [/* @__PURE__ */ r(
|
80
|
+
}, [e, a, p, o, c]), I = P(
|
81
|
+
() => [/* @__PURE__ */ r(_, { ref: m })],
|
81
82
|
[]
|
82
83
|
);
|
83
84
|
return x(() => {
|
84
85
|
let l = null;
|
85
86
|
return (async () => {
|
86
|
-
const
|
87
|
-
l =
|
87
|
+
const N = (await J()).default;
|
88
|
+
l = T.loadAnimation({
|
88
89
|
container: m.current,
|
89
|
-
animationData:
|
90
|
+
animationData: N,
|
90
91
|
autoplay: !0,
|
91
92
|
loop: !0,
|
92
93
|
renderer: "canvas"
|
@@ -96,12 +97,12 @@ const B = () => import("../../../assets/lotties/circle/sleepy-boi-lottie.json.js
|
|
96
97
|
};
|
97
98
|
}, []), x(() => {
|
98
99
|
e != null && e.puzzles && t && L && f(e == null ? void 0 : e.puzzles, !!(e != null && e.lessons));
|
99
|
-
}, [e == null ? void 0 : e.lessons, e == null ? void 0 : e.puzzles, L, t, f]),
|
100
|
+
}, [e == null ? void 0 : e.lessons, e == null ? void 0 : e.puzzles, L, t, f]), C ? /* @__PURE__ */ r(G, {}) : e ? /* @__PURE__ */ r(
|
100
101
|
V,
|
101
102
|
{
|
102
103
|
ref: y,
|
103
|
-
items:
|
104
|
-
defaultIndex:
|
104
|
+
items: E,
|
105
|
+
defaultIndex: v,
|
105
106
|
onNext: u,
|
106
107
|
onPrev: u,
|
107
108
|
analyticsNext: {
|
@@ -115,7 +116,7 @@ const B = () => import("../../../assets/lotties/circle/sleepy-boi-lottie.json.js
|
|
115
116
|
V,
|
116
117
|
{
|
117
118
|
ref: y,
|
118
|
-
items:
|
119
|
+
items: I,
|
119
120
|
analyticsNext: {
|
120
121
|
analyticsLabel: ""
|
121
122
|
},
|
@@ -127,6 +128,6 @@ const B = () => import("../../../assets/lotties/circle/sleepy-boi-lottie.json.js
|
|
127
128
|
}
|
128
129
|
);
|
129
130
|
export {
|
130
|
-
|
131
|
+
Q as GameLauncher
|
131
132
|
};
|
132
133
|
//# sourceMappingURL=game-launcher.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"game-launcher.js","sources":["../../../../src/features/circle-games/game-launcher/game-launcher.tsx"],"sourcesContent":["import type { IGameLauncherProps } from './game-launcher-types';\nimport type { AnimationItem } from 'lottie-web';\nimport type { FC, ReactNode } from 'react';\n\nimport Lottie from 'lottie-web';\nimport { memo, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { CircularLoader } from '../../ui/loader/circular-loader/circular-loader';\nimport { ProjectType } from '../games/web-view/enums';\nimport { useCircleSounds } from '../hooks/use-circle-sounds/use-circle-sounds';\nimport { Carousel } from './comps/carousel/carousel';\nimport { SegmentedGameCard } from './comps/segmented-game-card/segmented-game-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from './game-launcher-analytics-events';\nimport * as Styled from './game-launcher-styled';\nimport { useGameLauncherJourney } from './use-game-launcher-journey/use-game-launcher-journey';\n\nconst sleepyBoi = () => import('../../../assets/lotties/circle/sleepy-boi-lottie.json');\n\nexport const GameLauncher: FC<IGameLauncherProps> = memo(\n ({ onSegmentClick, journeyId, data, isLoading, defaultIndex = 0 }) => {\n const [currentIndex, setCurrentIndex] = useState(defaultIndex);\n\n const lottieContainerRef = useRef<HTMLDivElement>(null);\n const { playSwipSound } = useCircleSounds();\n\n const {\n gameRefs,\n lessonRefs,\n puzzleRefs,\n startJourney,\n carouselNextBtnRef,\n isJourneyInProgress,\n } = useGameLauncherJourney({\n setCarouselIndex: setCurrentIndex,\n onSegmentClick,\n });\n\n const items = useMemo(() => {\n let itemTypes: ReactNode[] = [];\n\n if (data) {\n if (data.lessons) {\n itemTypes = [\n ...itemTypes,\n <SegmentedGameCard\n ref={lessonRefs}\n label={data.lessons.label}\n value={data.lessons.data.filter(lesson => lesson.status === 'completed').length}\n maxValue={data.lessons.data.length}\n initialValue={data.lessons.initialProgressValue}\n data={data?.lessons.data.map(lesson => ({\n card: lesson.cardLottie,\n name: lesson.name,\n isCompleted: lesson.status === 'completed',\n onPress: () =>\n lesson.status === 'completed'\n ? undefined\n : onSegmentClick(lesson, ProjectType.LESSON),\n }))}\n />,\n ];\n }\n\n itemTypes = [\n ...itemTypes,\n <SegmentedGameCard\n ref={gameRefs}\n label={data.games.label}\n value={data.games.data.filter(game => game.isPlayed).length}\n maxValue={data.games.data.length}\n initialValue={data.games.initialProgressValue}\n data={data.games.data.map(game => ({\n card: game.cardLottie,\n name: game.name,\n isCompleted: false,\n onPress: () => onSegmentClick(game, ProjectType.GAME),\n }))}\n />,\n <SegmentedGameCard\n ref={puzzleRefs}\n label={data.puzzles.label}\n value={data.puzzles.data.filter(puzzle => puzzle.solved).length}\n maxValue={data.puzzles.data.length}\n initialValue={data.puzzles.initialProgressValue}\n data={data.puzzles.data.map(puzzle => ({\n card: puzzle.cardLottie,\n name: puzzle.name,\n isCompleted: puzzle.solved,\n onPress: () => onSegmentClick(puzzle, ProjectType.PUZZLE),\n }))}\n />,\n ];\n }\n\n return itemTypes;\n }, [data, gameRefs, lessonRefs, onSegmentClick, puzzleRefs]);\n\n const sleepyBoiItem = useMemo(\n () => [<Styled.SleepyBoiLottyContainer ref={lottieContainerRef} />],\n [],\n );\n\n useEffect(() => {\n let animation: AnimationItem | null = null;\n const loadAnimation = async () => {\n const animationModule = await sleepyBoi();\n\n const animationData = animationModule.default;\n\n animation = Lottie.loadAnimation({\n container: lottieContainerRef.current as Element,\n animationData: animationData,\n autoplay: true,\n loop: true,\n renderer: 'canvas',\n });\n };\n\n loadAnimation();\n\n return () => {\n animation?.destroy();\n };\n }, []);\n\n // Start game launcher journey when the data for puzzles is available\n useEffect(() => {\n if (data?.puzzles && journeyId && isJourneyInProgress) {\n startJourney(data?.puzzles, !!data?.lessons);\n }\n }, [data?.lessons, data?.puzzles, isJourneyInProgress, journeyId, startJourney]);\n\n if (isLoading) {\n return <CircularLoader />;\n }\n\n if (!data) {\n return (\n <Carousel\n ref={carouselNextBtnRef}\n items={sleepyBoiItem}\n analyticsNext={{\n analyticsLabel: '',\n }}\n analyticsPrev={{\n analyticsLabel: '',\n }}\n />\n );\n }\n\n return (\n <Carousel\n ref={carouselNextBtnRef}\n items={items}\n defaultIndex={currentIndex}\n onNext={playSwipSound}\n onPrev={playSwipSound}\n analyticsNext={{\n analyticsLabel: GAME_LAUNCHER_ANALYTICS_EVENTS.NEXT_ACTIVITY,\n }}\n analyticsPrev={{\n analyticsLabel: GAME_LAUNCHER_ANALYTICS_EVENTS.PREV_ACTIVITY,\n }}\n />\n );\n },\n);\n"],"names":["sleepyBoi","GameLauncher","memo","onSegmentClick","journeyId","data","isLoading","defaultIndex","currentIndex","setCurrentIndex","useState","lottieContainerRef","useRef","playSwipSound","useCircleSounds","gameRefs","lessonRefs","puzzleRefs","startJourney","carouselNextBtnRef","isJourneyInProgress","useGameLauncherJourney","items","useMemo","itemTypes","jsx","SegmentedGameCard","lesson","ProjectType","game","puzzle","sleepyBoiItem","Styled.SleepyBoiLottyContainer","useEffect","animation","animationData","Lottie","CircularLoader","Carousel","GAME_LAUNCHER_ANALYTICS_EVENTS"],"mappings":";;;;;;;;;;;AAgBA,MAAMA,IAAY,MAAM,OAAO,0DAAuD,GAEzEC,IAAuCC;AAAA,EAClD,CAAC,EAAE,gBAAAC,GAAgB,WAAAC,GAAW,MAAAC,GAAM,WAAAC,GAAW,cAAAC,IAAe,QAAQ;
|
1
|
+
{"version":3,"file":"game-launcher.js","sources":["../../../../src/features/circle-games/game-launcher/game-launcher.tsx"],"sourcesContent":["import type { IGameLauncherProps } from './game-launcher-types';\nimport type { AnimationItem } from 'lottie-web';\nimport type { FC, ReactNode } from 'react';\n\nimport Lottie from 'lottie-web';\nimport { memo, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { CircularLoader } from '../../ui/loader/circular-loader/circular-loader';\nimport { ProjectType } from '../games/web-view/enums';\nimport { useCircleSounds } from '../hooks/use-circle-sounds/use-circle-sounds';\nimport { Carousel } from './comps/carousel/carousel';\nimport { SegmentedGameCard } from './comps/segmented-game-card/segmented-game-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from './game-launcher-analytics-events';\nimport * as Styled from './game-launcher-styled';\nimport { useGameLauncherJourney } from './use-game-launcher-journey/use-game-launcher-journey';\n\nconst sleepyBoi = () => import('../../../assets/lotties/circle/sleepy-boi-lottie.json');\n\nexport const GameLauncher: FC<IGameLauncherProps> = memo(\n ({ onSegmentClick, onJourneyComplete, journeyId, data, isLoading, defaultIndex = 0 }) => {\n const [currentIndex, setCurrentIndex] = useState(defaultIndex);\n\n const lottieContainerRef = useRef<HTMLDivElement>(null);\n const { playSwipSound } = useCircleSounds();\n\n const {\n gameRefs,\n lessonRefs,\n puzzleRefs,\n startJourney,\n carouselNextBtnRef,\n isJourneyInProgress,\n } = useGameLauncherJourney({\n setCarouselIndex: setCurrentIndex,\n onSegmentClick,\n onJourneyComplete,\n });\n\n const items = useMemo(() => {\n let itemTypes: ReactNode[] = [];\n\n if (data) {\n if (data.lessons) {\n itemTypes = [\n ...itemTypes,\n <SegmentedGameCard\n ref={lessonRefs}\n label={data.lessons.label}\n value={data.lessons.data.filter(lesson => lesson.status === 'completed').length}\n maxValue={data.lessons.data.length}\n initialValue={data.lessons.initialProgressValue}\n data={data?.lessons.data.map(lesson => ({\n card: lesson.cardLottie,\n name: lesson.name,\n isCompleted: lesson.status === 'completed',\n onPress: () =>\n lesson.status === 'completed'\n ? undefined\n : onSegmentClick(lesson, ProjectType.LESSON),\n }))}\n />,\n ];\n }\n\n itemTypes = [\n ...itemTypes,\n <SegmentedGameCard\n ref={gameRefs}\n label={data.games.label}\n value={data.games.data.filter(game => game.isPlayed).length}\n maxValue={data.games.data.length}\n initialValue={data.games.initialProgressValue}\n data={data.games.data.map(game => ({\n card: game.cardLottie,\n name: game.name,\n isCompleted: false,\n onPress: () => onSegmentClick(game, ProjectType.GAME),\n }))}\n />,\n <SegmentedGameCard\n ref={puzzleRefs}\n label={data.puzzles.label}\n value={data.puzzles.data.filter(puzzle => puzzle.solved).length}\n maxValue={data.puzzles.data.length}\n initialValue={data.puzzles.initialProgressValue}\n data={data.puzzles.data.map(puzzle => ({\n card: puzzle.cardLottie,\n name: puzzle.name,\n isCompleted: puzzle.solved,\n onPress: () => onSegmentClick(puzzle, ProjectType.PUZZLE),\n }))}\n />,\n ];\n }\n\n return itemTypes;\n }, [data, gameRefs, lessonRefs, onSegmentClick, puzzleRefs]);\n\n const sleepyBoiItem = useMemo(\n () => [<Styled.SleepyBoiLottyContainer ref={lottieContainerRef} />],\n [],\n );\n\n useEffect(() => {\n let animation: AnimationItem | null = null;\n const loadAnimation = async () => {\n const animationModule = await sleepyBoi();\n\n const animationData = animationModule.default;\n\n animation = Lottie.loadAnimation({\n container: lottieContainerRef.current as Element,\n animationData: animationData,\n autoplay: true,\n loop: true,\n renderer: 'canvas',\n });\n };\n\n loadAnimation();\n\n return () => {\n animation?.destroy();\n };\n }, []);\n\n // Start game launcher journey when the data for puzzles is available\n useEffect(() => {\n if (data?.puzzles && journeyId && isJourneyInProgress) {\n startJourney(data?.puzzles, !!data?.lessons);\n }\n }, [data?.lessons, data?.puzzles, isJourneyInProgress, journeyId, startJourney]);\n\n if (isLoading) {\n return <CircularLoader />;\n }\n\n if (!data) {\n return (\n <Carousel\n ref={carouselNextBtnRef}\n items={sleepyBoiItem}\n analyticsNext={{\n analyticsLabel: '',\n }}\n analyticsPrev={{\n analyticsLabel: '',\n }}\n />\n );\n }\n\n return (\n <Carousel\n ref={carouselNextBtnRef}\n items={items}\n defaultIndex={currentIndex}\n onNext={playSwipSound}\n onPrev={playSwipSound}\n analyticsNext={{\n analyticsLabel: GAME_LAUNCHER_ANALYTICS_EVENTS.NEXT_ACTIVITY,\n }}\n analyticsPrev={{\n analyticsLabel: GAME_LAUNCHER_ANALYTICS_EVENTS.PREV_ACTIVITY,\n }}\n />\n );\n },\n);\n"],"names":["sleepyBoi","GameLauncher","memo","onSegmentClick","onJourneyComplete","journeyId","data","isLoading","defaultIndex","currentIndex","setCurrentIndex","useState","lottieContainerRef","useRef","playSwipSound","useCircleSounds","gameRefs","lessonRefs","puzzleRefs","startJourney","carouselNextBtnRef","isJourneyInProgress","useGameLauncherJourney","items","useMemo","itemTypes","jsx","SegmentedGameCard","lesson","ProjectType","game","puzzle","sleepyBoiItem","Styled.SleepyBoiLottyContainer","useEffect","animation","animationData","Lottie","CircularLoader","Carousel","GAME_LAUNCHER_ANALYTICS_EVENTS"],"mappings":";;;;;;;;;;;AAgBA,MAAMA,IAAY,MAAM,OAAO,0DAAuD,GAEzEC,IAAuCC;AAAA,EAClD,CAAC,EAAE,gBAAAC,GAAgB,mBAAAC,GAAmB,WAAAC,GAAW,MAAAC,GAAM,WAAAC,GAAW,cAAAC,IAAe,QAAQ;AACvF,UAAM,CAACC,GAAcC,CAAe,IAAIC,EAASH,CAAY,GAEvDI,IAAqBC,EAAuB,IAAI,GAChD,EAAE,eAAAC,MAAkBC,KAEpB;AAAA,MACJ,UAAAC;AAAA,MACA,YAAAC;AAAA,MACA,YAAAC;AAAA,MACA,cAAAC;AAAA,MACA,oBAAAC;AAAA,MACA,qBAAAC;AAAA,QACEC,EAAuB;AAAA,MACzB,kBAAkBZ;AAAA,MAClB,gBAAAP;AAAA,MACA,mBAAAC;AAAA,IAAA,CACD,GAEKmB,IAAQC,EAAQ,MAAM;AAC1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,MAACa;AAAA,MAAA;AAAA,QACC,KAAKnB;AAAA,QACL,OAAAG;AAAA,QACA,cAAcd;AAAA,QACd,QAAQK;AAAA,QACR,QAAQA;AAAA,QACR,eAAe;AAAA,UACb,gBAAgB0B,EAA+B;AAAA,QACjD;AAAA,QACA,eAAe;AAAA,UACb,gBAAgBA,EAA+B;AAAA,QACjD;AAAA,MAAA;AAAA,IAAA,IAzBA,gBAAAd;AAAA,MAACa;AAAA,MAAA;AAAA,QACC,KAAKnB;AAAA,QACL,OAAOY;AAAA,QACP,eAAe;AAAA,UACb,gBAAgB;AAAA,QAClB;AAAA,QACA,eAAe;AAAA,UACb,gBAAgB;AAAA,QAClB;AAAA,MAAA;AAAA,IAAA;AAAA,EAoBR;AACF;"}
|
@@ -1,83 +1,85 @@
|
|
1
|
-
import { jsx as e, Fragment as
|
2
|
-
import { useRef as
|
3
|
-
import
|
4
|
-
import { JOURNEY_ID_STUDENT as
|
1
|
+
import { jsx as e, Fragment as E, jsxs as R } from "react/jsx-runtime";
|
2
|
+
import { useRef as u, useCallback as C, useMemo as z } from "react";
|
3
|
+
import q from "../../../../assets/line-icons/icons/next.js";
|
4
|
+
import { JOURNEY_ID_STUDENT as g } from "../../../journey/journey-id/journey-id-student.js";
|
5
5
|
import { IndicatorType as a } from "../../../journey/use-journey/constants.js";
|
6
|
-
import { useJourney as
|
7
|
-
import
|
8
|
-
import
|
6
|
+
import { useJourney as ee } from "../../../journey/use-journey/use-journey.js";
|
7
|
+
import K from "../../../ui/buttons/icon-button/icon-button.js";
|
8
|
+
import y from "../../../ui/layout/flex-view.js";
|
9
9
|
import r from "../../../ui/text/text.js";
|
10
|
-
import { useCircleSounds as
|
11
|
-
import { SegmentedGameCard as
|
12
|
-
import { GO_TO_NEXT_SLIDE_AFTER_MS as
|
13
|
-
import { ProjectType as
|
14
|
-
const
|
15
|
-
|
16
|
-
|
10
|
+
import { useCircleSounds as te } from "../../hooks/use-circle-sounds/use-circle-sounds.js";
|
11
|
+
import { SegmentedGameCard as re } from "../comps/segmented-game-card/segmented-game-card.js";
|
12
|
+
import { GO_TO_NEXT_SLIDE_AFTER_MS as ne, SHOW_LABEL_HIGHLIGHT_AFTER_MS as ie, SHOW_NUDGE_AFTER_MS as oe } from "./constants.js";
|
13
|
+
import { ProjectType as le } from "../../games/web-view/enums/project-type-enum.js";
|
14
|
+
const Ee = ({
|
15
|
+
journeyId: s,
|
16
|
+
onSegmentClick: L,
|
17
|
+
setCarouselIndex: I,
|
18
|
+
onJourneyComplete: H
|
17
19
|
}) => {
|
18
|
-
const l =
|
19
|
-
(n,
|
20
|
-
|
21
|
-
const
|
22
|
-
clearTimeout(
|
23
|
-
},
|
24
|
-
clearTimeout(
|
25
|
-
},
|
20
|
+
const l = u(null), i = u(null), t = u(null), c = u(null), A = u(!1), { playButtonSound: O } = te(), { nextCoachmark: o, setJourney: w } = ee(), d = C(
|
21
|
+
(n, m, T = !1) => {
|
22
|
+
T || (O(), I((b) => b + 1), o(g.ACTIVITY, !1, ne));
|
23
|
+
const f = setTimeout(() => {
|
24
|
+
clearTimeout(f), n.startLabelAnimation(m);
|
25
|
+
}, ie), p = setTimeout(() => {
|
26
|
+
clearTimeout(p), o(g.ACTIVITY, !0);
|
27
|
+
}, oe);
|
26
28
|
},
|
27
|
-
[o,
|
28
|
-
),
|
29
|
+
[o, O, I]
|
30
|
+
), P = C(
|
29
31
|
(n) => {
|
30
|
-
|
32
|
+
L(n, le.PUZZLE), o(g.ACTIVITY), s && H(s);
|
31
33
|
},
|
32
|
-
[o,
|
33
|
-
),
|
34
|
-
(n,
|
35
|
-
var
|
36
|
-
if (
|
34
|
+
[s, o, H, L]
|
35
|
+
), _ = C(
|
36
|
+
(n, m) => {
|
37
|
+
var $, G, S, v, N, Y, B, U, x, V, W, D, X, J, M, F, Z;
|
38
|
+
if (A.current || !s || !(($ = l == null ? void 0 : l.current) != null && $.nextBtnRef.current) || !((G = t == null ? void 0 : t.current) != null && G.segmentedCardWrapperRef.current) || !((S = i == null ? void 0 : i.current) != null && S.labelRef.current) || !((v = t == null ? void 0 : t.current) != null && v.labelRef.current) || !n)
|
37
39
|
return;
|
38
|
-
|
39
|
-
const
|
40
|
+
A.current = !0;
|
41
|
+
const T = ((B = (Y = (N = c.current) == null ? void 0 : N.labelRef) == null ? void 0 : Y.current) == null ? void 0 : B.getBoundingClientRect()) || {
|
40
42
|
height: 0,
|
41
43
|
width: 0
|
42
|
-
},
|
44
|
+
}, f = ((V = (x = (U = i.current) == null ? void 0 : U.labelRef) == null ? void 0 : x.current) == null ? void 0 : V.getBoundingClientRect()) || {
|
43
45
|
height: 0,
|
44
46
|
width: 0
|
45
|
-
},
|
47
|
+
}, p = ((X = (D = (W = t.current) == null ? void 0 : W.labelRef) == null ? void 0 : D.current) == null ? void 0 : X.getBoundingClientRect()) || {
|
46
48
|
height: 0,
|
47
49
|
width: 0
|
48
|
-
},
|
50
|
+
}, b = ((F = (M = (J = t.current) == null ? void 0 : J.segmentedCardWrapperRef) == null ? void 0 : M.current) == null ? void 0 : F.getBoundingClientRect()) || {
|
49
51
|
height: 0,
|
50
52
|
width: 0
|
51
53
|
};
|
52
|
-
let
|
53
|
-
|
54
|
+
let k = [];
|
55
|
+
m && c.current && (k = [
|
54
56
|
{
|
55
57
|
originalElementToHighlightRef: c.current.labelRef,
|
56
58
|
isActive: !1,
|
57
59
|
type: a.TOOLTIP,
|
58
|
-
elementToHighlight: /* @__PURE__ */ e(
|
60
|
+
elementToHighlight: /* @__PURE__ */ e(E, {}),
|
59
61
|
indicator: {
|
60
62
|
position: "right",
|
61
63
|
backgroundColor: "BLUE_4",
|
62
64
|
width: 244,
|
63
|
-
tooltipItem: /* @__PURE__ */
|
65
|
+
tooltipItem: /* @__PURE__ */ R(y, { children: [
|
64
66
|
/* @__PURE__ */ e(r, { $renderAs: "ab2-bold", children: "Practice Mental Math" }),
|
65
67
|
/* @__PURE__ */ e(r, { $renderAs: "ub3", children: "Get faster & stay ahead in school," }),
|
66
68
|
/* @__PURE__ */ e(r, { $renderAs: "ub3", children: "with 3 new skills everyday." })
|
67
69
|
] }),
|
68
|
-
tooltipXCoOrdinates:
|
69
|
-
tooltipYCoOrdinates:
|
70
|
+
tooltipXCoOrdinates: T.width,
|
71
|
+
tooltipYCoOrdinates: T.height / 2
|
70
72
|
}
|
71
73
|
},
|
72
74
|
{
|
73
|
-
originalElementToHighlightRef: (
|
75
|
+
originalElementToHighlightRef: (Z = l.current) == null ? void 0 : Z.nextBtnRef,
|
74
76
|
isActive: !1,
|
75
77
|
type: a.NUDGE,
|
76
78
|
elementToHighlight: /* @__PURE__ */ e(
|
77
|
-
|
79
|
+
K,
|
78
80
|
{
|
79
81
|
renderAs: "secondary",
|
80
|
-
Icon:
|
82
|
+
Icon: q,
|
81
83
|
onClick: () => d(i.current, "ORANGE_4"),
|
82
84
|
analyticsLabel: "HELLO "
|
83
85
|
}
|
@@ -90,23 +92,23 @@ const pe = ({
|
|
90
92
|
}
|
91
93
|
}
|
92
94
|
]);
|
93
|
-
const
|
95
|
+
const Q = [
|
94
96
|
{
|
95
97
|
originalElementToHighlightRef: i.current.labelRef,
|
96
98
|
isActive: !1,
|
97
99
|
type: a.TOOLTIP,
|
98
|
-
elementToHighlight: /* @__PURE__ */ e(
|
100
|
+
elementToHighlight: /* @__PURE__ */ e(E, {}),
|
99
101
|
indicator: {
|
100
102
|
position: "right",
|
101
103
|
backgroundColor: "ORANGE_4",
|
102
104
|
width: 244,
|
103
|
-
tooltipItem: /* @__PURE__ */
|
105
|
+
tooltipItem: /* @__PURE__ */ R(y, { children: [
|
104
106
|
/* @__PURE__ */ e(r, { $renderAs: "ab2-bold", children: "Play Strategy Games" }),
|
105
107
|
/* @__PURE__ */ e(r, { $renderAs: "ub3", children: "Train to think deeper & plan ahead," }),
|
106
108
|
/* @__PURE__ */ e(r, { $renderAs: "ub3", children: "with 3 new games everyday." })
|
107
109
|
] }),
|
108
|
-
tooltipXCoOrdinates:
|
109
|
-
tooltipYCoOrdinates:
|
110
|
+
tooltipXCoOrdinates: f.width,
|
111
|
+
tooltipYCoOrdinates: f.height / 2
|
110
112
|
}
|
111
113
|
},
|
112
114
|
{
|
@@ -114,10 +116,10 @@ const pe = ({
|
|
114
116
|
isActive: !1,
|
115
117
|
type: a.NUDGE,
|
116
118
|
elementToHighlight: /* @__PURE__ */ e(
|
117
|
-
|
119
|
+
K,
|
118
120
|
{
|
119
121
|
renderAs: "secondary",
|
120
|
-
Icon:
|
122
|
+
Icon: q,
|
121
123
|
onClick: () => d(t.current, "PURPLE_4"),
|
122
124
|
analyticsLabel: "HELLO "
|
123
125
|
}
|
@@ -129,23 +131,23 @@ const pe = ({
|
|
129
131
|
nudgePointerY: 0
|
130
132
|
}
|
131
133
|
}
|
132
|
-
],
|
134
|
+
], j = [
|
133
135
|
{
|
134
136
|
originalElementToHighlightRef: t.current.labelRef,
|
135
137
|
isActive: !1,
|
136
138
|
type: a.TOOLTIP,
|
137
|
-
elementToHighlight: /* @__PURE__ */ e(
|
139
|
+
elementToHighlight: /* @__PURE__ */ e(E, {}),
|
138
140
|
indicator: {
|
139
141
|
position: "right",
|
140
142
|
backgroundColor: "PURPLE_4",
|
141
143
|
width: 244,
|
142
|
-
tooltipItem: /* @__PURE__ */
|
144
|
+
tooltipItem: /* @__PURE__ */ R(y, { children: [
|
143
145
|
/* @__PURE__ */ e(r, { $renderAs: "ab2-bold", children: "Solve Logic Puzzles" }),
|
144
146
|
/* @__PURE__ */ e(r, { $renderAs: "ub3", children: "Think in new ways & stay sharp," }),
|
145
147
|
/* @__PURE__ */ e(r, { $renderAs: "ub3", children: "with 3 new puzzles everyday." })
|
146
148
|
] }),
|
147
|
-
tooltipXCoOrdinates:
|
148
|
-
tooltipYCoOrdinates:
|
149
|
+
tooltipXCoOrdinates: p.width,
|
150
|
+
tooltipYCoOrdinates: p.height / 2
|
149
151
|
}
|
150
152
|
},
|
151
153
|
{
|
@@ -153,43 +155,46 @@ const pe = ({
|
|
153
155
|
isActive: !1,
|
154
156
|
type: a.NUDGE,
|
155
157
|
elementToHighlight: /* @__PURE__ */ e(
|
156
|
-
|
158
|
+
re,
|
157
159
|
{
|
158
160
|
label: "",
|
159
|
-
value: n.data.filter((
|
161
|
+
value: n.data.filter((h) => h.solved).length,
|
160
162
|
maxValue: n.data.length,
|
161
163
|
initialValue: n.initialProgressValue,
|
162
|
-
data: n.data.map((
|
163
|
-
card:
|
164
|
+
data: n.data.map((h) => ({
|
165
|
+
card: h.cardLottie,
|
164
166
|
name: "",
|
165
167
|
// We dont want to show the name of the puzzle in onboarding
|
166
|
-
isCompleted:
|
167
|
-
onPress: () =>
|
168
|
+
isCompleted: h.solved,
|
169
|
+
onPress: () => P(h)
|
168
170
|
}))
|
169
171
|
}
|
170
172
|
),
|
171
173
|
indicator: {
|
172
174
|
nudge: "click",
|
173
175
|
content: /* @__PURE__ */ e(r, { $renderAs: "ab1", $color: "WHITE", children: "Click to solve a puzzle" }),
|
174
|
-
nudgePointerX:
|
175
|
-
nudgePointerY:
|
176
|
+
nudgePointerX: b.width * 0.6,
|
177
|
+
nudgePointerY: b.height * 0.4
|
176
178
|
}
|
177
179
|
}
|
178
180
|
];
|
179
|
-
|
181
|
+
w(g.ACTIVITY, [...k, ...Q, ...j]), o(g.ACTIVITY, !0), m && c.current ? d(c.current, "BLUE_4", !0) : d(i.current, "ORANGE_4", !0);
|
180
182
|
},
|
181
|
-
[
|
183
|
+
[P, d, s, o, w]
|
184
|
+
);
|
185
|
+
return z(
|
186
|
+
() => ({
|
187
|
+
gameRefs: i,
|
188
|
+
puzzleRefs: t,
|
189
|
+
lessonRefs: c,
|
190
|
+
carouselNextBtnRef: l,
|
191
|
+
isJourneyInProgress: A,
|
192
|
+
startJourney: _
|
193
|
+
}),
|
194
|
+
[_]
|
182
195
|
);
|
183
|
-
return {
|
184
|
-
gameRefs: i,
|
185
|
-
puzzleRefs: t,
|
186
|
-
lessonRefs: c,
|
187
|
-
carouselNextBtnRef: l,
|
188
|
-
isJourneyInProgress: b,
|
189
|
-
startJourney: j
|
190
|
-
};
|
191
196
|
};
|
192
197
|
export {
|
193
|
-
|
198
|
+
Ee as useGameLauncherJourney
|
194
199
|
};
|
195
200
|
//# sourceMappingURL=use-game-launcher-journey.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-game-launcher-journey.js","sources":["../../../../../src/features/circle-games/game-launcher/use-game-launcher-journey/use-game-launcher-journey.tsx"],"sourcesContent":["import 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 { ICarouselRefs } from '../comps/carousel/carousel-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, useRef } from 'react';\n\nimport NextIcon from '../../../../assets/line-icons/icons/next';\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 FlexView from '../../../ui/layout/flex-view';\nimport Text from '../../../ui/text/text';\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 {\n GO_TO_NEXT_SLIDE_AFTER_MS,\n SHOW_LABEL_HIGHLIGHT_AFTER_MS,\n SHOW_NUDGE_AFTER_MS,\n} from './constants';\n\nexport const useGameLauncherJourney = ({\n onSegmentClick,\n setCarouselIndex,\n}: IUseGameLauncherJourneyProps) => {\n const carouselNextBtnRef = useRef<ICarouselRefs>(null);\n const gameRefs = useRef<ISegmentedGameCardRefs>(null);\n const puzzleRefs = useRef<ISegmentedGameCardRefs>(null);\n const lessonRefs = useRef<ISegmentedGameCardRefs>(null);\n\n const isJourneyInProgress = useRef(false);\n\n const { playButtonSound } = useCircleSounds();\n const { nextCoachmark, setJourney } = useJourney();\n\n const goToNextCard = useCallback(\n (refOfNextSlide: ISegmentedGameCardRefs, color: TColorNames, isFirstSlide: boolean = false) => {\n if (!isFirstSlide) {\n playButtonSound();\n setCarouselIndex((prev: number) => prev + 1);\n nextCoachmark(JOURNEY_ID_STUDENT.ACTIVITY, false, GO_TO_NEXT_SLIDE_AFTER_MS);\n }\n\n const animateLabelTimer = setTimeout(() => {\n clearTimeout(animateLabelTimer);\n refOfNextSlide.startLabelAnimation(color);\n }, SHOW_LABEL_HIGHLIGHT_AFTER_MS);\n\n const showNudgeTimer = setTimeout(() => {\n clearTimeout(showNudgeTimer);\n nextCoachmark(JOURNEY_ID_STUDENT.ACTIVITY, true);\n }, SHOW_NUDGE_AFTER_MS);\n },\n [nextCoachmark, playButtonSound, setCarouselIndex],\n );\n\n const endJourney = useCallback(\n (puzzlesData: Puzzle) => {\n onSegmentClick(puzzlesData, ProjectType.PUZZLE);\n nextCoachmark(JOURNEY_ID_STUDENT.ACTIVITY);\n },\n [nextCoachmark, onSegmentClick],\n );\n\n const startJourney = useCallback(\n (puzzlesData: IProject<Puzzle>, isLessonAvailable: boolean) => {\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 !carouselNextBtnRef?.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: 244,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">Practice Mental Math</Text>\n <Text $renderAs=\"ub3\">Get faster & stay ahead in school,</Text>\n <Text $renderAs=\"ub3\">with 3 new skills everyday.</Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: lessonLabelDims.width,\n tooltipYCoOrdinates: lessonLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: carouselNextBtnRef.current?.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={NextIcon}\n onClick={() => goToNextCard(gameRefs.current as ISegmentedGameCardRefs, 'ORANGE_4')}\n analyticsLabel=\"HELLO \"\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: 244,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">Play Strategy Games</Text>\n <Text $renderAs=\"ub3\">Train to think deeper & plan ahead,</Text>\n <Text $renderAs=\"ub3\">with 3 new games everyday.</Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: gameLabelDims.width,\n tooltipYCoOrdinates: gameLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: carouselNextBtnRef.current.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={NextIcon}\n onClick={() => goToNextCard(puzzleRefs.current as ISegmentedGameCardRefs, 'PURPLE_4')}\n analyticsLabel=\"HELLO \"\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: 244,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">Solve Logic Puzzles</Text>\n <Text $renderAs=\"ub3\">Think in new ways & stay sharp,</Text>\n <Text $renderAs=\"ub3\">with 3 new puzzles everyday.</Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: puzzleLabelDims.width,\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: () => endJourney(puzzle),\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(JOURNEY_ID_STUDENT.ACTIVITY, [...lessonSteps, ...gameSteps, ...puzzleSteps]);\n\n nextCoachmark(JOURNEY_ID_STUDENT.ACTIVITY, true);\n if (isLessonAvailable && lessonRefs.current) {\n goToNextCard(lessonRefs.current, 'BLUE_4', true);\n } else {\n goToNextCard(gameRefs.current, 'ORANGE_4', true);\n }\n },\n [endJourney, goToNextCard, nextCoachmark, setJourney],\n );\n\n return {\n gameRefs,\n puzzleRefs,\n lessonRefs,\n carouselNextBtnRef,\n isJourneyInProgress,\n startJourney,\n };\n};\n"],"names":["useGameLauncherJourney","onSegmentClick","setCarouselIndex","carouselNextBtnRef","useRef","gameRefs","puzzleRefs","lessonRefs","isJourneyInProgress","playButtonSound","useCircleSounds","nextCoachmark","setJourney","useJourney","goToNextCard","useCallback","refOfNextSlide","color","isFirstSlide","prev","JOURNEY_ID_STUDENT","GO_TO_NEXT_SLIDE_AFTER_MS","animateLabelTimer","SHOW_LABEL_HIGHLIGHT_AFTER_MS","showNudgeTimer","SHOW_NUDGE_AFTER_MS","endJourney","puzzlesData","ProjectType","startJourney","isLessonAvailable","_a","_b","_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","NextIcon","gameSteps","puzzleSteps","SegmentedGameCard","puzzle"],"mappings":";;;;;;;;;;;;;AA8BO,MAAMA,KAAyB,CAAC;AAAA,EACrC,gBAAAC;AAAA,EACA,kBAAAC;AACF,MAAoC;AAC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,EAAY,KAAK,IAAI,CAAWoC,OAAA;AAAA,gBACpC,MAAMA,EAAO;AAAA,gBACb,MAAM;AAAA;AAAA,gBACN,aAAaA,EAAO;AAAA,gBACpB,SAAS,MAAMrC,EAAWqC,CAAM;AAAA,cAAA,EAChC;AAAA,YAAA;AAAA,UACJ;AAAA,UAEF,WAAW;AAAA,YACT,OAAO;AAAA,YACP,SACG,gBAAAV,EAAAG,GAAA,EAAK,WAAU,OAAM,QAAO,SAAQ,UAErC,2BAAA;AAAA,YAEF,eAAeT,EAAa,QAAQ;AAAA,YACpC,eAAeA,EAAa,SAAS;AAAA,UACvC;AAAA,QACF;AAAA,MAAA;AAGS,MAAAnC,EAAAQ,EAAmB,UAAU,CAAC,GAAG+B,GAAa,GAAGS,GAAW,GAAGC,CAAW,CAAC,GAExElD,EAAAS,EAAmB,UAAU,EAAI,GAC3CU,KAAqBvB,EAAW,UACrBO,EAAAP,EAAW,SAAS,UAAU,EAAI,IAElCO,EAAAT,EAAS,SAAS,YAAY,EAAI;AAAA,IAEnD;AAAA,IACA,CAACqB,GAAYZ,GAAcH,GAAeC,CAAU;AAAA,EAAA;AAG/C,SAAA;AAAA,IACL,UAAAP;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,oBAAAJ;AAAA,IACA,qBAAAK;AAAA,IACA,cAAAqB;AAAA,EAAA;AAEJ;"}
|
1
|
+
{"version":3,"file":"use-game-launcher-journey.js","sources":["../../../../../src/features/circle-games/game-launcher/use-game-launcher-journey/use-game-launcher-journey.tsx"],"sourcesContent":["import 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 { ICarouselRefs } from '../comps/carousel/carousel-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, useMemo, useRef } from 'react';\n\nimport NextIcon from '../../../../assets/line-icons/icons/next';\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 FlexView from '../../../ui/layout/flex-view';\nimport Text from '../../../ui/text/text';\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 {\n GO_TO_NEXT_SLIDE_AFTER_MS,\n SHOW_LABEL_HIGHLIGHT_AFTER_MS,\n SHOW_NUDGE_AFTER_MS,\n} from './constants';\n\nexport const useGameLauncherJourney = ({\n journeyId,\n onSegmentClick,\n setCarouselIndex,\n onJourneyComplete,\n}: IUseGameLauncherJourneyProps) => {\n const carouselNextBtnRef = useRef<ICarouselRefs>(null);\n const gameRefs = useRef<ISegmentedGameCardRefs>(null);\n const puzzleRefs = useRef<ISegmentedGameCardRefs>(null);\n const lessonRefs = useRef<ISegmentedGameCardRefs>(null);\n\n const isJourneyInProgress = useRef(false);\n\n const { playButtonSound } = useCircleSounds();\n const { nextCoachmark, setJourney } = useJourney();\n\n const goToNextCard = useCallback(\n (refOfNextSlide: ISegmentedGameCardRefs, color: TColorNames, isFirstSlide: boolean = false) => {\n if (!isFirstSlide) {\n playButtonSound();\n setCarouselIndex((prev: number) => prev + 1);\n nextCoachmark(JOURNEY_ID_STUDENT.ACTIVITY, false, GO_TO_NEXT_SLIDE_AFTER_MS);\n }\n\n const animateLabelTimer = setTimeout(() => {\n clearTimeout(animateLabelTimer);\n refOfNextSlide.startLabelAnimation(color);\n }, SHOW_LABEL_HIGHLIGHT_AFTER_MS);\n\n const showNudgeTimer = setTimeout(() => {\n clearTimeout(showNudgeTimer);\n nextCoachmark(JOURNEY_ID_STUDENT.ACTIVITY, true);\n }, SHOW_NUDGE_AFTER_MS);\n },\n [nextCoachmark, playButtonSound, setCarouselIndex],\n );\n\n const endJourney = useCallback(\n (puzzlesData: Puzzle) => {\n onSegmentClick(puzzlesData, ProjectType.PUZZLE);\n nextCoachmark(JOURNEY_ID_STUDENT.ACTIVITY);\n if (journeyId) {\n onJourneyComplete(journeyId);\n }\n },\n [journeyId, nextCoachmark, onJourneyComplete, onSegmentClick],\n );\n\n const startJourney = useCallback(\n (puzzlesData: IProject<Puzzle>, isLessonAvailable: boolean) => {\n if (isJourneyInProgress.current || !journeyId) {\n return;\n }\n\n // If element refs are not available return, this is just for type safety\n if (\n !carouselNextBtnRef?.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: 244,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">Practice Mental Math</Text>\n <Text $renderAs=\"ub3\">Get faster & stay ahead in school,</Text>\n <Text $renderAs=\"ub3\">with 3 new skills everyday.</Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: lessonLabelDims.width,\n tooltipYCoOrdinates: lessonLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: carouselNextBtnRef.current?.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={NextIcon}\n onClick={() => goToNextCard(gameRefs.current as ISegmentedGameCardRefs, 'ORANGE_4')}\n analyticsLabel=\"HELLO \"\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: 244,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">Play Strategy Games</Text>\n <Text $renderAs=\"ub3\">Train to think deeper & plan ahead,</Text>\n <Text $renderAs=\"ub3\">with 3 new games everyday.</Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: gameLabelDims.width,\n tooltipYCoOrdinates: gameLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: carouselNextBtnRef.current.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={NextIcon}\n onClick={() => goToNextCard(puzzleRefs.current as ISegmentedGameCardRefs, 'PURPLE_4')}\n analyticsLabel=\"HELLO \"\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: 244,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">Solve Logic Puzzles</Text>\n <Text $renderAs=\"ub3\">Think in new ways & stay sharp,</Text>\n <Text $renderAs=\"ub3\">with 3 new puzzles everyday.</Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: puzzleLabelDims.width,\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: () => endJourney(puzzle),\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(JOURNEY_ID_STUDENT.ACTIVITY, [...lessonSteps, ...gameSteps, ...puzzleSteps]);\n\n nextCoachmark(JOURNEY_ID_STUDENT.ACTIVITY, true);\n if (isLessonAvailable && lessonRefs.current) {\n goToNextCard(lessonRefs.current, 'BLUE_4', true);\n } else {\n goToNextCard(gameRefs.current, 'ORANGE_4', true);\n }\n },\n [endJourney, goToNextCard, journeyId, nextCoachmark, setJourney],\n );\n\n return useMemo(\n () => ({\n gameRefs,\n puzzleRefs,\n lessonRefs,\n carouselNextBtnRef,\n isJourneyInProgress,\n startJourney,\n }),\n [startJourney],\n );\n};\n"],"names":["useGameLauncherJourney","journeyId","onSegmentClick","setCarouselIndex","onJourneyComplete","carouselNextBtnRef","useRef","gameRefs","puzzleRefs","lessonRefs","isJourneyInProgress","playButtonSound","useCircleSounds","nextCoachmark","setJourney","useJourney","goToNextCard","useCallback","refOfNextSlide","color","isFirstSlide","prev","JOURNEY_ID_STUDENT","GO_TO_NEXT_SLIDE_AFTER_MS","animateLabelTimer","SHOW_LABEL_HIGHLIGHT_AFTER_MS","showNudgeTimer","SHOW_NUDGE_AFTER_MS","endJourney","puzzlesData","ProjectType","startJourney","isLessonAvailable","_a","_b","_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","NextIcon","gameSteps","puzzleSteps","SegmentedGameCard","puzzle","useMemo"],"mappings":";;;;;;;;;;;;;AA8BO,MAAMA,KAAyB,CAAC;AAAA,EACrC,WAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,mBAAAC;AACF,MAAoC;AAC5B,QAAAC,IAAqBC,EAAsB,IAAI,GAC/CC,IAAWD,EAA+B,IAAI,GAC9CE,IAAaF,EAA+B,IAAI,GAChDG,IAAaH,EAA+B,IAAI,GAEhDI,IAAsBJ,EAAO,EAAK,GAElC,EAAE,iBAAAK,MAAoBC,MACtB,EAAE,eAAAC,GAAe,YAAAC,EAAW,IAAIC,GAAW,GAE3CC,IAAeC;AAAA,IACnB,CAACC,GAAwCC,GAAoBC,IAAwB,OAAU;AAC7F,MAAKA,MACaT,KACCR,EAAA,CAACkB,MAAiBA,IAAO,CAAC,GAC7BR,E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AAA;AAAA,YAEF,eAAeT,EAAa,QAAQ;AAAA,YACpC,eAAeA,EAAa,SAAS;AAAA,UACvC;AAAA,QACF;AAAA,MAAA;AAGS,MAAAnC,EAAAQ,EAAmB,UAAU,CAAC,GAAG+B,GAAa,GAAGS,GAAW,GAAGC,CAAW,CAAC,GAExElD,EAAAS,EAAmB,UAAU,EAAI,GAC3CU,KAAqBvB,EAAW,UACrBO,EAAAP,EAAW,SAAS,UAAU,EAAI,IAElCO,EAAAT,EAAS,SAAS,YAAY,EAAI;AAAA,IAEnD;AAAA,IACA,CAACqB,GAAYZ,GAAcf,GAAWY,GAAeC,CAAU;AAAA,EAAA;AAG1D,SAAAoD;AAAA,IACL,OAAO;AAAA,MACL,UAAA3D;AAAA,MACA,YAAAC;AAAA,MACA,YAAAC;AAAA,MACA,oBAAAJ;AAAA,MACA,qBAAAK;AAAA,MACA,cAAAqB;AAAA,IAAA;AAAA,IAEF,CAACA,CAAY;AAAA,EAAA;AAEjB;"}
|
package/dist/index.d.ts
CHANGED
@@ -1075,6 +1075,7 @@ declare interface IGameLauncherProps {
|
|
1075
1075
|
data: IProjects | null;
|
1076
1076
|
defaultIndex?: number;
|
1077
1077
|
journeyId?: TJourneyId;
|
1078
|
+
onJourneyComplete: (journeyId: TJourneyId) => void;
|
1078
1079
|
}
|
1079
1080
|
|
1080
1081
|
declare interface IGetArrowTooltipConfig {
|
@@ -4954,8 +4955,8 @@ declare const usePostUpdateCircleCoachmark: (opts?: {
|
|
4954
4955
|
onComplete: (() => void) | undefined;
|
4955
4956
|
};
|
4956
4957
|
|
4957
|
-
export declare const usePostUpdateCircleJourneyDal: (userId: string
|
4958
|
-
postCircleJourneyCompletion: () => void;
|
4958
|
+
export declare const usePostUpdateCircleJourneyDal: (userId: string) => Omit<ReturnType<typeof usePostUpdateCircleCoachmark>, "data" | "post"> & {
|
4959
|
+
postCircleJourneyCompletion: (journeyCompletionIds: TJourneyId[]) => void;
|
4959
4960
|
};
|
4960
4961
|
|
4961
4962
|
export declare const User2Icon: React.FC<React.SVGProps<SVGSVGElement>>;
|