@cuemath/leap 2.8.62-rj-3 → 2.8.62-rj-5
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/comps/carousel/carousel.js.map +1 -1
- package/dist/features/circle-games/game-launcher/game-launcher.js +46 -38
- package/dist/features/circle-games/game-launcher/game-launcher.js.map +1 -1
- package/dist/features/circle-games/game-launcher/hooks/use-game-launcher-journey/use-game-launcher-journey.js +78 -79
- package/dist/features/circle-games/game-launcher/hooks/use-game-launcher-journey/use-game-launcher-journey.js.map +1 -1
- package/dist/features/circle-games/game-launcher/hooks/use-table-launcher-journey/use-table-launcher-journey.js +134 -121
- package/dist/features/circle-games/game-launcher/hooks/use-table-launcher-journey/use-table-launcher-journey.js.map +1 -1
- package/dist/features/journey/use-journey/journey-context-provider.js +38 -38
- package/dist/features/journey/use-journey/journey-context-provider.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"carousel.js","sources":["../../../../../../src/features/circle-games/game-launcher/comps/carousel/carousel.tsx"],"sourcesContent":["import type { ICarouselProps, ICarouselRefs } from './carousel-types';\nimport type { ForwardRefRenderFunction } from 'react';\n\nimport {\n memo,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n forwardRef,\n useImperativeHandle,\n createRef,\n} from 'react';\n\nimport CaratLeftIcon from '../../../../../assets/line-icons/icons/carat-left';\nimport CaratRightIcon from '../../../../../assets/line-icons/icons/carat-right';\nimport IconButton from '../../../../ui/buttons/icon-button/icon-button';\nimport Separator from '../../../../ui/separator/separator';\nimport * as Styled from './carousel-styled';\n\nconst CarouselComponent: ForwardRefRenderFunction<ICarouselRefs, ICarouselProps> = (\n { items, defaultIndex = 0, onNext, onPrev, analyticsPrev, analyticsNext },\n ref,\n) => {\n const memoizedAnalyticsPrev = useMemo(() => analyticsPrev, [analyticsPrev]);\n const memoizedAnalyticsNext = useMemo(() => analyticsNext, [analyticsNext]);\n\n const nextBtnRef = useRef<HTMLDivElement>(null);\n const isFirstMount = useRef(true);\n const [currIndex, setCurrIndex] = useState(defaultIndex);\n\n // Create a stable array of refs for indicators\n const indicatorRefs = useMemo(() =>
|
1
|
+
{"version":3,"file":"carousel.js","sources":["../../../../../../src/features/circle-games/game-launcher/comps/carousel/carousel.tsx"],"sourcesContent":["import type { ICarouselProps, ICarouselRefs } from './carousel-types';\nimport type { ForwardRefRenderFunction } from 'react';\n\nimport {\n memo,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n forwardRef,\n useImperativeHandle,\n createRef,\n} from 'react';\n\nimport CaratLeftIcon from '../../../../../assets/line-icons/icons/carat-left';\nimport CaratRightIcon from '../../../../../assets/line-icons/icons/carat-right';\nimport IconButton from '../../../../ui/buttons/icon-button/icon-button';\nimport Separator from '../../../../ui/separator/separator';\nimport * as Styled from './carousel-styled';\n\nconst CarouselComponent: ForwardRefRenderFunction<ICarouselRefs, ICarouselProps> = (\n { items, defaultIndex = 0, onNext, onPrev, analyticsPrev, analyticsNext },\n ref,\n) => {\n const memoizedAnalyticsPrev = useMemo(() => analyticsPrev, [analyticsPrev]);\n const memoizedAnalyticsNext = useMemo(() => analyticsNext, [analyticsNext]);\n\n const nextBtnRef = useRef<HTMLDivElement>(null);\n const isFirstMount = useRef(true);\n const [currIndex, setCurrIndex] = useState(defaultIndex);\n\n // Create a stable array of refs for indicators\n const indicatorRefs = useMemo(() => items.map(() => createRef<HTMLDivElement>()), [items]);\n\n const handleCarouselPrev = useCallback(() => {\n onPrev?.();\n setCurrIndex(prev => prev - 1);\n }, [onPrev]);\n\n const handleCarouselNext = useCallback(() => {\n onNext?.();\n setCurrIndex(prev => prev + 1);\n }, [onNext]);\n\n const handleCarouselIndicatorClick = useCallback((index: number) => {\n setCurrIndex(index);\n }, []);\n\n useImperativeHandle(ref, () => ({\n nextBtnRef,\n indicatorRefs,\n currentIndex: currIndex,\n goToIndex: (index: number) => {\n setCurrIndex(index);\n },\n }));\n\n useEffect(() => {\n if (isFirstMount.current) {\n isFirstMount.current = false;\n }\n }, []);\n\n // Change index from parent\n useEffect(() => {\n setCurrIndex(defaultIndex);\n }, [defaultIndex]);\n\n return (\n <Styled.Carousel>\n <Styled.CarouselWrapper\n $translate={currIndex * 100}\n $translateDuration={isFirstMount.current ? 0 : 300}\n >\n {items.map((item, index) => (\n <Styled.CarouselItemContainer key={index}>{item}</Styled.CarouselItemContainer>\n ))}\n </Styled.CarouselWrapper>\n\n {items.length > 1 && (\n <Styled.ExtendedFlexView\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $position=\"absolute\"\n >\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratLeftIcon}\n onClick={handleCarouselPrev}\n analyticsLabel={memoizedAnalyticsPrev.analyticsLabel}\n analyticsProps={memoizedAnalyticsPrev.analyticsProps}\n disabled={currIndex === 0}\n />\n <Separator width={48} />\n {items.map((_, index) => (\n <Styled.Indicator\n ref={indicatorRefs[index]}\n $isActive={index === currIndex}\n key={index}\n onClick={() => handleCarouselIndicatorClick(index)}\n />\n ))}\n <Separator width={48} />\n <div ref={nextBtnRef}>\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={handleCarouselNext}\n analyticsLabel={memoizedAnalyticsNext.analyticsLabel}\n analyticsProps={memoizedAnalyticsNext.analyticsProps}\n disabled={currIndex === items.length - 1}\n />\n </div>\n </Styled.ExtendedFlexView>\n )}\n </Styled.Carousel>\n );\n};\n\nexport const Carousel = memo(forwardRef(CarouselComponent));\n"],"names":["CarouselComponent","items","defaultIndex","onNext","onPrev","analyticsPrev","analyticsNext","ref","memoizedAnalyticsPrev","useMemo","memoizedAnalyticsNext","nextBtnRef","useRef","isFirstMount","currIndex","setCurrIndex","useState","indicatorRefs","createRef","handleCarouselPrev","useCallback","prev","handleCarouselNext","handleCarouselIndicatorClick","index","useImperativeHandle","useEffect","jsxs","Styled.Carousel","jsx","Styled.CarouselWrapper","item","Styled.CarouselItemContainer","Styled.ExtendedFlexView","IconButton","CaratLeftIcon","Separator","_","Styled.Indicator","CaratRightIcon","Carousel","memo","forwardRef"],"mappings":";;;;;;;AAqBA,MAAMA,IAA6E,CACjF,EAAE,OAAAC,GAAO,cAAAC,IAAe,GAAG,QAAAC,GAAQ,QAAAC,GAAQ,eAAAC,GAAe,eAAAC,EAAc,GACxEC,MACG;AACH,QAAMC,IAAwBC,EAAQ,MAAMJ,GAAe,CAACA,CAAa,CAAC,GACpEK,IAAwBD,EAAQ,MAAMH,GAAe,CAACA,CAAa,CAAC,GAEpEK,IAAaC,EAAuB,IAAI,GACxCC,IAAeD,EAAO,EAAI,GAC1B,CAACE,GAAWC,CAAY,IAAIC,EAASd,CAAY,GAGjDe,IAAgBR,EAAQ,MAAMR,EAAM,IAAI,MAAMiB,GAA2B,GAAG,CAACjB,CAAK,CAAC,GAEnFkB,IAAqBC,EAAY,MAAM;AAClC,IAAAhB,KAAA,QAAAA,KACIW,EAAA,CAAAM,MAAQA,IAAO,CAAC;AAAA,EAAA,GAC5B,CAACjB,CAAM,CAAC,GAELkB,IAAqBF,EAAY,MAAM;AAClC,IAAAjB,KAAA,QAAAA,KACIY,EAAA,CAAAM,MAAQA,IAAO,CAAC;AAAA,EAAA,GAC5B,CAAClB,CAAM,CAAC,GAELoB,IAA+BH,EAAY,CAACI,MAAkB;AAClE,IAAAT,EAAaS,CAAK;AAAA,EACpB,GAAG,CAAE,CAAA;AAEL,SAAAC,EAAoBlB,GAAK,OAAO;AAAA,IAC9B,YAAAI;AAAA,IACA,eAAAM;AAAA,IACA,cAAcH;AAAA,IACd,WAAW,CAACU,MAAkB;AAC5B,MAAAT,EAAaS,CAAK;AAAA,IACpB;AAAA,EACA,EAAA,GAEFE,EAAU,MAAM;AACd,IAAIb,EAAa,YACfA,EAAa,UAAU;AAAA,EAE3B,GAAG,CAAE,CAAA,GAGLa,EAAU,MAAM;AACd,IAAAX,E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AAA,cACtC,UAAUI,MAAcb,EAAM,SAAS;AAAA,YAAA;AAAA,UAAA,GAE3C;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ,EAAA,CAAA;AAEJ,GAEauC,IAAWC,EAAKC,EAAW1C,CAAiB,CAAC;"}
|
@@ -1,24 +1,32 @@
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
2
|
-
import { memo as
|
3
|
-
import { LOTTIE as
|
2
|
+
import { memo as g, useRef as x, useCallback as n, useMemo as h, useEffect as D } from "react";
|
3
|
+
import { LOTTIE as U } from "../../../assets/lottie/lottie.js";
|
4
4
|
import { JOURNEY_ID_STUDENT as z } from "../../journey/journey-id/journey-id-student.js";
|
5
|
-
import { useJourney as
|
6
|
-
import { CircularLoader as
|
7
|
-
import
|
8
|
-
import { useCircleSounds as
|
5
|
+
import { useJourney as Y } from "../../journey/use-journey/use-journey.js";
|
6
|
+
import { CircularLoader as B } from "../../ui/loader/circular-loader/circular-loader.js";
|
7
|
+
import K from "../../ui/lottie-animation/lottie-animation.js";
|
8
|
+
import { useCircleSounds as H } from "../hooks/use-circle-sounds/use-circle-sounds.js";
|
9
9
|
import { CircleSoundKey as u } from "../hooks/use-circle-sounds/use-circle-sounds-enums.js";
|
10
|
-
import { GAME_LAUNCHER_SIZE as
|
10
|
+
import { GAME_LAUNCHER_SIZE as Z } from "./comps/card-container/constants.js";
|
11
11
|
import { Carousel as G } from "./comps/carousel/carousel.js";
|
12
|
-
import { GAME_LAUNCHER_ASSET_PADDING as
|
13
|
-
import { SegmentedGameCard as
|
14
|
-
import { TablesCard as
|
12
|
+
import { GAME_LAUNCHER_ASSET_PADDING as w } from "./comps/segmented-game-card/constants.js";
|
13
|
+
import { SegmentedGameCard as a } from "./comps/segmented-game-card/segmented-game-card.js";
|
14
|
+
import { TablesCard as X } from "./comps/tables-card/tables-card.js";
|
15
15
|
import { GAME_LAUNCHER_ANALYTICS_EVENTS as V } from "./game-launcher-analytics-events.js";
|
16
|
-
import { useGameLauncherJourney as
|
17
|
-
import { useTableLauncherJourney as
|
16
|
+
import { useGameLauncherJourney as q } from "./hooks/use-game-launcher-journey/use-game-launcher-journey.js";
|
17
|
+
import { useTableLauncherJourney as F } from "./hooks/use-table-launcher-journey/use-table-launcher-journey.js";
|
18
18
|
import { ProjectType as f } from "../games/web-view/enums/project-type-enum.js";
|
19
|
-
const S =
|
20
|
-
({
|
21
|
-
|
19
|
+
const S = Z + w, ce = g(
|
20
|
+
({
|
21
|
+
onSegmentClick: r,
|
22
|
+
journeyId: m,
|
23
|
+
isError: J,
|
24
|
+
data: e,
|
25
|
+
isLoading: p,
|
26
|
+
isTutorialOnboardingDone: E,
|
27
|
+
defaultIndex: M = 0
|
28
|
+
}) => {
|
29
|
+
const t = x(null), { isJourneyActive: C } = Y(), { playSwipSound: L, play: o } = H(), c = n(
|
22
30
|
(l) => {
|
23
31
|
o(u.GAME_CARD_CLICK), r(l, f.TABLE);
|
24
32
|
},
|
@@ -43,18 +51,18 @@ const S = H + Z, pe = O(
|
|
43
51
|
lessonRefs: y,
|
44
52
|
puzzleRefs: R,
|
45
53
|
startJourney: I
|
46
|
-
} =
|
54
|
+
} = q({
|
47
55
|
carouselRefs: t,
|
48
56
|
onSegmentClick: r
|
49
|
-
}), { startJourney: P, tableRef: N } =
|
57
|
+
}), { startJourney: P, tableRef: N } = F({
|
50
58
|
carouselRefs: t,
|
51
59
|
onTableSegmentClick: c
|
52
|
-
}),
|
60
|
+
}), v = h(() => {
|
53
61
|
let l = [];
|
54
62
|
return e && (e.lessons && (l = [
|
55
63
|
...l,
|
56
64
|
/* @__PURE__ */ i(
|
57
|
-
|
65
|
+
a,
|
58
66
|
{
|
59
67
|
ref: y,
|
60
68
|
label: e.lessons.label,
|
@@ -72,7 +80,7 @@ const S = H + Z, pe = O(
|
|
72
80
|
]), l = [
|
73
81
|
...l,
|
74
82
|
/* @__PURE__ */ i(
|
75
|
-
|
83
|
+
a,
|
76
84
|
{
|
77
85
|
ref: T,
|
78
86
|
label: e.games.label,
|
@@ -88,7 +96,7 @@ const S = H + Z, pe = O(
|
|
88
96
|
}
|
89
97
|
),
|
90
98
|
/* @__PURE__ */ i(
|
91
|
-
|
99
|
+
a,
|
92
100
|
{
|
93
101
|
ref: R,
|
94
102
|
label: e.puzzles.label,
|
@@ -106,7 +114,7 @@ const S = H + Z, pe = O(
|
|
106
114
|
], e.tables && (l = [
|
107
115
|
...l,
|
108
116
|
/* @__PURE__ */ i(
|
109
|
-
|
117
|
+
X,
|
110
118
|
{
|
111
119
|
ref: N,
|
112
120
|
label: e.tables.label,
|
@@ -126,12 +134,12 @@ const S = H + Z, pe = O(
|
|
126
134
|
b,
|
127
135
|
N,
|
128
136
|
c
|
129
|
-
]),
|
137
|
+
]), O = h(
|
130
138
|
() => [
|
131
139
|
/* @__PURE__ */ i(
|
132
|
-
|
140
|
+
K,
|
133
141
|
{
|
134
|
-
src:
|
142
|
+
src: U.SLEEPY_BOI,
|
135
143
|
width: S,
|
136
144
|
height: S
|
137
145
|
}
|
@@ -139,35 +147,32 @@ const S = H + Z, pe = O(
|
|
139
147
|
],
|
140
148
|
[]
|
141
149
|
);
|
142
|
-
return
|
150
|
+
return D(() => {
|
143
151
|
if (!(p || !e || C)) {
|
144
152
|
if (e != null && e.puzzles && m === z.CIRCLE_ACTIVITIES_INTRO_JOURNEY) {
|
145
153
|
I(e == null ? void 0 : e.puzzles, !!(e != null && e.lessons), m);
|
146
154
|
return;
|
147
155
|
}
|
148
|
-
e != null && e.tables && m === z.CIRCLE_TABLES_INTRO_JOURNEY && P(e == null ? void 0 : e.tables,
|
156
|
+
e != null && e.tables && m === z.CIRCLE_TABLES_INTRO_JOURNEY && P(e == null ? void 0 : e.tables, E);
|
149
157
|
}
|
150
158
|
}, [
|
151
159
|
e,
|
152
160
|
C,
|
153
161
|
p,
|
154
|
-
|
162
|
+
E,
|
155
163
|
m,
|
156
164
|
I,
|
157
165
|
P
|
158
|
-
]), p ? /* @__PURE__ */ i(
|
166
|
+
]), p ? /* @__PURE__ */ i(B, {}) : J ? /* @__PURE__ */ i(
|
159
167
|
G,
|
160
168
|
{
|
161
169
|
ref: t,
|
162
|
-
items:
|
163
|
-
defaultIndex: J,
|
164
|
-
onNext: L,
|
165
|
-
onPrev: L,
|
170
|
+
items: O,
|
166
171
|
analyticsNext: {
|
167
|
-
analyticsLabel:
|
172
|
+
analyticsLabel: ""
|
168
173
|
},
|
169
174
|
analyticsPrev: {
|
170
|
-
analyticsLabel:
|
175
|
+
analyticsLabel: ""
|
171
176
|
}
|
172
177
|
}
|
173
178
|
) : /* @__PURE__ */ i(
|
@@ -175,17 +180,20 @@ const S = H + Z, pe = O(
|
|
175
180
|
{
|
176
181
|
ref: t,
|
177
182
|
items: v,
|
183
|
+
defaultIndex: M,
|
184
|
+
onNext: L,
|
185
|
+
onPrev: L,
|
178
186
|
analyticsNext: {
|
179
|
-
analyticsLabel:
|
187
|
+
analyticsLabel: V.NEXT_ACTIVITY
|
180
188
|
},
|
181
189
|
analyticsPrev: {
|
182
|
-
analyticsLabel:
|
190
|
+
analyticsLabel: V.PREV_ACTIVITY
|
183
191
|
}
|
184
192
|
}
|
185
193
|
);
|
186
194
|
}
|
187
195
|
);
|
188
196
|
export {
|
189
|
-
|
197
|
+
ce as GameLauncher
|
190
198
|
};
|
191
199
|
//# 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 { ICarouselRefs } from './comps/carousel/carousel-types';\nimport type { ITableDetails } from './comps/tables-card/tables-card-types';\nimport type {\n Game,\n Lesson,\n Puzzle,\n} from './dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport type { IGameLauncherProps } from './game-launcher-types';\nimport type { FC, ReactNode } from 'react';\n\nimport { memo, useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport { LOTTIE } from '../../../assets/lottie/lottie';\nimport { JOURNEY_ID_STUDENT } from '../../journey/journey-id/journey-id-student';\nimport { useJourney } from '../../journey/use-journey/use-journey';\nimport { CircularLoader } from '../../ui/loader/circular-loader/circular-loader';\nimport LottieAnimation from '../../ui/lottie-animation/lottie-animation';\nimport { ProjectType } from '../games/web-view/enums';\nimport { useCircleSounds } from '../hooks/use-circle-sounds/use-circle-sounds';\nimport { CircleSoundKey } from '../hooks/use-circle-sounds/use-circle-sounds-enums';\nimport { GAME_LAUNCHER_SIZE } from './comps/card-container/constants';\nimport { Carousel } from './comps/carousel/carousel';\nimport { GAME_LAUNCHER_ASSET_PADDING } from './comps/segmented-game-card/constants';\nimport { SegmentedGameCard } from './comps/segmented-game-card/segmented-game-card';\nimport { TablesCard } from './comps/tables-card/tables-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from './game-launcher-analytics-events';\nimport { useGameLauncherJourney } from './hooks/use-game-launcher-journey/use-game-launcher-journey';\nimport { useTableLauncherJourney } from './hooks/use-table-launcher-journey/use-table-launcher-journey';\n\nconst sleepyBoiDimension = GAME_LAUNCHER_SIZE + GAME_LAUNCHER_ASSET_PADDING;\n\nexport const GameLauncher: FC<IGameLauncherProps> = memo(\n ({ onSegmentClick, journeyId, data, isLoading, isTutorialOnboardingDone, defaultIndex = 0 }) => {\n const carouselRefs = useRef<ICarouselRefs>(null);\n\n const { isJourneyActive } = useJourney();\n\n const { playSwipSound, play } = useCircleSounds();\n\n const onTableSegmentClick = useCallback(\n (table: ITableDetails) => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(table, ProjectType.TABLE);\n },\n [onSegmentClick, play],\n );\n\n const handleLessonSegmentClick = useCallback(\n (lesson: Lesson) => {\n if (lesson.status !== 'completed') {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(lesson, ProjectType.LESSON);\n }\n },\n [onSegmentClick, play],\n );\n\n const handleGameSegmentClick = useCallback(\n (game: Game) => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(game, ProjectType.GAME);\n },\n [onSegmentClick, play],\n );\n\n const handlePuzzleSegmentClick = useCallback(\n (puzzle: Puzzle) => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(puzzle, ProjectType.PUZZLE);\n },\n [onSegmentClick, play],\n );\n\n const {\n gameRefs,\n lessonRefs,\n puzzleRefs,\n startJourney: startLessonPuzzleGamesJourney,\n } = useGameLauncherJourney({\n carouselRefs,\n onSegmentClick,\n });\n\n const { startJourney: startTablesJourney, tableRef } = useTableLauncherJourney({\n carouselRefs,\n onTableSegmentClick,\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: () => handleLessonSegmentClick(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: () => handleGameSegmentClick(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: () => handlePuzzleSegmentClick(puzzle),\n }))}\n />,\n ];\n\n if (data.tables) {\n itemTypes = [\n ...itemTypes,\n <TablesCard\n ref={tableRef}\n label={data.tables.label}\n data={data.tables.data}\n onPress={onTableSegmentClick}\n openModesOfTable={data.tables.openModesOfTable}\n />,\n ];\n }\n }\n\n return itemTypes;\n }, [\n data,\n gameRefs,\n puzzleRefs,\n lessonRefs,\n handleLessonSegmentClick,\n handleGameSegmentClick,\n handlePuzzleSegmentClick,\n tableRef,\n onTableSegmentClick,\n ]);\n\n const sleepyBoiItem = useMemo(\n () => [\n <LottieAnimation\n src={LOTTIE.SLEEPY_BOI}\n width={sleepyBoiDimension}\n height={sleepyBoiDimension}\n />,\n ],\n [],\n );\n\n // Start game launcher journey only when isLoading has become false and data is available\n useEffect(() => {\n if (isLoading || !data || isJourneyActive) {\n return;\n }\n\n if (data?.puzzles && journeyId === JOURNEY_ID_STUDENT.CIRCLE_ACTIVITIES_INTRO_JOURNEY) {\n startLessonPuzzleGamesJourney(data?.puzzles, !!data?.lessons, journeyId);\n\n return; // CIRCLE_ACTIVITIES_INTRO_JOURNEY has higher priority\n }\n\n if (data?.tables && journeyId === JOURNEY_ID_STUDENT.CIRCLE_TABLES_INTRO_JOURNEY) {\n startTablesJourney(data?.tables, isTutorialOnboardingDone);\n }\n }, [\n data,\n isJourneyActive,\n isLoading,\n isTutorialOnboardingDone,\n journeyId,\n startLessonPuzzleGamesJourney,\n startTablesJourney,\n ]);\n\n if (isLoading) {\n return <CircularLoader />;\n }\n\n if (!data) {\n return (\n <Carousel\n ref={carouselRefs}\n items={sleepyBoiItem}\n analyticsNext={{\n analyticsLabel: '',\n }}\n analyticsPrev={{\n analyticsLabel: '',\n }}\n />\n );\n }\n\n return (\n <Carousel\n ref={carouselRefs}\n items={items}\n defaultIndex={defaultIndex}\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":["sleepyBoiDimension","GAME_LAUNCHER_SIZE","GAME_LAUNCHER_ASSET_PADDING","GameLauncher","memo","onSegmentClick","journeyId","data","isLoading","isTutorialOnboardingDone","defaultIndex","carouselRefs","useRef","isJourneyActive","useJourney","playSwipSound","play","useCircleSounds","onTableSegmentClick","useCallback","table","CircleSoundKey","ProjectType","handleLessonSegmentClick","lesson","handleGameSegmentClick","game","handlePuzzleSegmentClick","puzzle","gameRefs","lessonRefs","puzzleRefs","startLessonPuzzleGamesJourney","useGameLauncherJourney","startTablesJourney","tableRef","useTableLauncherJourney","items","useMemo","itemTypes","jsx","SegmentedGameCard","TablesCard","sleepyBoiItem","LottieAnimation","LOTTIE","useEffect","JOURNEY_ID_STUDENT","CircularLoader","Carousel","GAME_LAUNCHER_ANALYTICS_EVENTS"],"mappings":";;;;;;;;;;;;;;;;;;AA6BA,MAAMA,IAAqBC,IAAqBC,GAEnCC,KAAuCC;AAAA,EAClD,CAAC,EAAE,gBAAAC,GAAgB,WAAAC,GAAW,MAAAC,GAAM,WAAAC,GAAW,0BAAAC,GAA0B,cAAAC,IAAe,QAAQ;AACxF,UAAAC,IAAeC,EAAsB,IAAI,GAEzC,EAAE,iBAAAC,MAAoBC,KAEtB,EAAE,eAAAC,GAAe,MAAAC,EAAK,IAAIC,EAAgB,GAE1CC,IAAsBC;AAAA,MAC1B,CAACC,MAAyB;AACxB,QAAAJ,EAAKK,EAAe,eAAe,GACpBhB,EAAAe,GAAOE,EAAY,KAAK;AAAA,MACzC;AAAA,MACA,CAACjB,GAAgBW,CAAI;AAAA,IAAA,GAGjBO,IAA2BJ;AAAA,MAC/B,CAACK,MAAmB;AACd,QAAAA,EAAO,WAAW,gBACpBR,EAAKK,EAAe,eAAe,GACpBhB,EAAAmB,GAAQF,EAAY,MAAM;AAAA,MAE7C;AAAA,MACA,CAACjB,GAAgBW,CAAI;AAAA,IAAA,GAGjBS,IAAyBN;AAAA,MAC7B,CAACO,MAAe;AACd,Q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AgB;AAAA,QAClB;AAAA,MAAA;AAAA,IAAA;AAAA,EAoBR;AACF;"}
|
1
|
+
{"version":3,"file":"game-launcher.js","sources":["../../../../src/features/circle-games/game-launcher/game-launcher.tsx"],"sourcesContent":["import type { ICarouselRefs } from './comps/carousel/carousel-types';\nimport type { ITableDetails } from './comps/tables-card/tables-card-types';\nimport type {\n Game,\n Lesson,\n Puzzle,\n} from './dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport type { IGameLauncherProps } from './game-launcher-types';\nimport type { FC, ReactNode } from 'react';\n\nimport { memo, useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport { LOTTIE } from '../../../assets/lottie/lottie';\nimport { JOURNEY_ID_STUDENT } from '../../journey/journey-id/journey-id-student';\nimport { useJourney } from '../../journey/use-journey/use-journey';\nimport { CircularLoader } from '../../ui/loader/circular-loader/circular-loader';\nimport LottieAnimation from '../../ui/lottie-animation/lottie-animation';\nimport { ProjectType } from '../games/web-view/enums';\nimport { useCircleSounds } from '../hooks/use-circle-sounds/use-circle-sounds';\nimport { CircleSoundKey } from '../hooks/use-circle-sounds/use-circle-sounds-enums';\nimport { GAME_LAUNCHER_SIZE } from './comps/card-container/constants';\nimport { Carousel } from './comps/carousel/carousel';\nimport { GAME_LAUNCHER_ASSET_PADDING } from './comps/segmented-game-card/constants';\nimport { SegmentedGameCard } from './comps/segmented-game-card/segmented-game-card';\nimport { TablesCard } from './comps/tables-card/tables-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from './game-launcher-analytics-events';\nimport { useGameLauncherJourney } from './hooks/use-game-launcher-journey/use-game-launcher-journey';\nimport { useTableLauncherJourney } from './hooks/use-table-launcher-journey/use-table-launcher-journey';\n\nconst sleepyBoiDimension = GAME_LAUNCHER_SIZE + GAME_LAUNCHER_ASSET_PADDING;\n\nexport const GameLauncher: FC<IGameLauncherProps> = memo(\n ({\n onSegmentClick,\n journeyId,\n isError,\n data,\n isLoading,\n isTutorialOnboardingDone,\n defaultIndex = 0,\n }) => {\n const carouselRefs = useRef<ICarouselRefs>(null);\n\n const { isJourneyActive } = useJourney();\n\n const { playSwipSound, play } = useCircleSounds();\n\n const onTableSegmentClick = useCallback(\n (table: ITableDetails) => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(table, ProjectType.TABLE);\n },\n [onSegmentClick, play],\n );\n\n const handleLessonSegmentClick = useCallback(\n (lesson: Lesson) => {\n if (lesson.status !== 'completed') {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(lesson, ProjectType.LESSON);\n }\n },\n [onSegmentClick, play],\n );\n\n const handleGameSegmentClick = useCallback(\n (game: Game) => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(game, ProjectType.GAME);\n },\n [onSegmentClick, play],\n );\n\n const handlePuzzleSegmentClick = useCallback(\n (puzzle: Puzzle) => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(puzzle, ProjectType.PUZZLE);\n },\n [onSegmentClick, play],\n );\n\n const {\n gameRefs,\n lessonRefs,\n puzzleRefs,\n startJourney: startLessonPuzzleGamesJourney,\n } = useGameLauncherJourney({\n carouselRefs,\n onSegmentClick,\n });\n\n const { startJourney: startTablesJourney, tableRef } = useTableLauncherJourney({\n carouselRefs,\n onTableSegmentClick,\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: () => handleLessonSegmentClick(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: () => handleGameSegmentClick(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: () => handlePuzzleSegmentClick(puzzle),\n }))}\n />,\n ];\n\n if (data.tables) {\n itemTypes = [\n ...itemTypes,\n <TablesCard\n ref={tableRef}\n label={data.tables.label}\n data={data.tables.data}\n onPress={onTableSegmentClick}\n openModesOfTable={data.tables.openModesOfTable}\n />,\n ];\n }\n }\n\n return itemTypes;\n }, [\n data,\n gameRefs,\n puzzleRefs,\n lessonRefs,\n handleLessonSegmentClick,\n handleGameSegmentClick,\n handlePuzzleSegmentClick,\n tableRef,\n onTableSegmentClick,\n ]);\n\n const sleepyBoiItem = useMemo(\n () => [\n <LottieAnimation\n src={LOTTIE.SLEEPY_BOI}\n width={sleepyBoiDimension}\n height={sleepyBoiDimension}\n />,\n ],\n [],\n );\n\n // Start game launcher journey only when isLoading has become false and data is available\n useEffect(() => {\n if (isLoading || !data || isJourneyActive) {\n return;\n }\n\n if (data?.puzzles && journeyId === JOURNEY_ID_STUDENT.CIRCLE_ACTIVITIES_INTRO_JOURNEY) {\n startLessonPuzzleGamesJourney(data?.puzzles, !!data?.lessons, journeyId);\n\n return; // CIRCLE_ACTIVITIES_INTRO_JOURNEY has higher priority\n }\n\n if (data?.tables && journeyId === JOURNEY_ID_STUDENT.CIRCLE_TABLES_INTRO_JOURNEY) {\n startTablesJourney(data?.tables, isTutorialOnboardingDone);\n }\n }, [\n data,\n isJourneyActive,\n isLoading,\n isTutorialOnboardingDone,\n journeyId,\n startLessonPuzzleGamesJourney,\n startTablesJourney,\n ]);\n\n if (isLoading) {\n return <CircularLoader />;\n }\n\n if (isError) {\n return (\n <Carousel\n ref={carouselRefs}\n items={sleepyBoiItem}\n analyticsNext={{\n analyticsLabel: '',\n }}\n analyticsPrev={{\n analyticsLabel: '',\n }}\n />\n );\n }\n\n return (\n <Carousel\n ref={carouselRefs}\n items={items}\n defaultIndex={defaultIndex}\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":["sleepyBoiDimension","GAME_LAUNCHER_SIZE","GAME_LAUNCHER_ASSET_PADDING","GameLauncher","memo","onSegmentClick","journeyId","isError","data","isLoading","isTutorialOnboardingDone","defaultIndex","carouselRefs","useRef","isJourneyActive","useJourney","playSwipSound","play","useCircleSounds","onTableSegmentClick","useCallback","table","CircleSoundKey","ProjectType","handleLessonSegmentClick","lesson","handleGameSegmentClick","game","handlePuzzleSegmentClick","puzzle","gameRefs","lessonRefs","puzzleRefs","startLessonPuzzleGamesJourney","useGameLauncherJourney","startTablesJourney","tableRef","useTableLauncherJourney","items","useMemo","itemTypes","jsx","SegmentedGameCard","TablesCard","sleepyBoiItem","LottieAnimation","LOTTIE","useEffect","JOURNEY_ID_STUDENT","CircularLoader","Carousel","GAME_LAUNCHER_ANALYTICS_EVENTS"],"mappings":";;;;;;;;;;;;;;;;;;AA6BA,MAAMA,IAAqBC,IAAqBC,GAEnCC,KAAuCC;AAAA,EAClD,CAAC;AAAA,IACC,gBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,MAAAC;AAAA,IACA,WAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,cAAAC,IAAe;AAAA,EAAA,MACX;AACE,UAAAC,IAAeC,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B;AAAA,MACAE;AAAA,IAAA,CACD,GAEG1B,sBACMwC,GAAe,CAAA,CAAA,IAGrB1C,IAEA,gBAAAkC;AAAA,MAACS;AAAA,MAAA;AAAA,QACC,KAAKtC;AAAA,QACL,OAAOgC;AAAA,QACP,eAAe;AAAA,UACb,gBAAgB;AAAA,QAClB;AAAA,QACA,eAAe;AAAA,UACb,gBAAgB;AAAA,QAClB;AAAA,MAAA;AAAA,IAAA,IAMJ,gBAAAH;AAAA,MAACS;AAAA,MAAA;AAAA,QACC,KAAKtC;AAAA,QACL,OAAA0B;AAAA,QACA,cAAA3B;AAAA,QACA,QAAQK;AAAA,QACR,QAAQA;AAAA,QACR,eAAe;AAAA,UACb,gBAAgBmC,EAA+B;AAAA,QACjD;AAAA,QACA,eAAe;AAAA,UACb,gBAAgBA,EAA+B;AAAA,QACjD;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;"}
|
@@ -1,103 +1,102 @@
|
|
1
|
-
import { jsx as t, Fragment as
|
2
|
-
import { useRef as
|
3
|
-
import
|
4
|
-
import { PLATFORM_EVENTS_STUDENT as
|
1
|
+
import { jsx as t, Fragment as L } from "react/jsx-runtime";
|
2
|
+
import { useRef as I, useCallback as p, useMemo as oe, useEffect as le } from "react";
|
3
|
+
import j from "../../../../../assets/line-icons/icons/carat-right.js";
|
4
|
+
import { PLATFORM_EVENTS_STUDENT as z } from "../../../../analytics-events/platform-events-student.js";
|
5
5
|
import { IndicatorType as a } from "../../../../journey/use-journey/constants.js";
|
6
|
-
import { useJourney as
|
7
|
-
import
|
8
|
-
import { useUIContext as
|
9
|
-
import
|
6
|
+
import { useJourney as ce } from "../../../../journey/use-journey/use-journey.js";
|
7
|
+
import ee from "../../../../ui/buttons/icon-button/icon-button.js";
|
8
|
+
import { useUIContext as ae } from "../../../../ui/context/context.js";
|
9
|
+
import O from "../../../../ui/layout/flex-view.js";
|
10
10
|
import d from "../../../../ui/text/text.js";
|
11
11
|
import { CIRCLE_ONBOARDING_ANALYTICS_STEPS as _ } from "../../../enum/circle-onboarding-steps.js";
|
12
|
-
import { useCircleSounds as
|
12
|
+
import { useCircleSounds as de } from "../../../hooks/use-circle-sounds/use-circle-sounds.js";
|
13
13
|
import { SegmentedGameCard as he } from "../../comps/segmented-game-card/segmented-game-card.js";
|
14
|
-
import { GAME_LAUNCHER_ANALYTICS_EVENTS as
|
15
|
-
import { GO_TO_NEXT_SLIDE_AFTER_MS as
|
16
|
-
import { ProjectType as
|
17
|
-
const
|
14
|
+
import { GAME_LAUNCHER_ANALYTICS_EVENTS as te } from "../../game-launcher-analytics-events.js";
|
15
|
+
import { GO_TO_NEXT_SLIDE_AFTER_MS as se, SHOW_LABEL_HIGHLIGHT_AFTER_MS as me, SHOW_NUDGE_AFTER_MS as ge, SLIDE_TO_LESSON_MS as Te } from "./constants.js";
|
16
|
+
import { ProjectType as ue } from "../../../games/web-view/enums/project-type-enum.js";
|
17
|
+
const Ge = ({
|
18
18
|
carouselRefs: n,
|
19
|
-
onSegmentClick:
|
19
|
+
onSegmentClick: S
|
20
20
|
}) => {
|
21
|
-
const o =
|
21
|
+
const o = I(null), r = I(null), l = I(null), C = I([]), { playButtonSound: b } = de(), { nextCoachmark: h, setJourney: R, endJourney: N } = ce(), { onEvent: f } = ae(), P = p(
|
22
22
|
(e) => {
|
23
|
-
|
23
|
+
f(z.ONBOARDING_STEP_VIEWED, {
|
24
24
|
step: e
|
25
25
|
});
|
26
26
|
},
|
27
|
-
[
|
28
|
-
),
|
27
|
+
[f]
|
28
|
+
), y = p(
|
29
29
|
(e) => {
|
30
|
-
|
30
|
+
f(z.ONBOARDING_STEP_COMPLETED, {
|
31
31
|
step: e
|
32
32
|
});
|
33
33
|
},
|
34
|
-
[
|
35
|
-
),
|
36
|
-
(e, c, i,
|
37
|
-
var
|
38
|
-
|
39
|
-
const
|
40
|
-
clearTimeout(
|
34
|
+
[f]
|
35
|
+
), s = p(
|
36
|
+
(e, c, i, m, A = !1) => {
|
37
|
+
var T, u;
|
38
|
+
A || (b(), (u = n.current) == null || u.goToIndex(((T = n.current) == null ? void 0 : T.currentIndex) + 1), h(m, !1, se)), P(e);
|
39
|
+
const g = setTimeout(() => {
|
40
|
+
clearTimeout(g), c.startLabelAnimation(i);
|
41
41
|
}, me);
|
42
|
-
C.current.push(
|
42
|
+
C.current.push(g), h(m, !0, ge);
|
43
43
|
},
|
44
|
-
[n,
|
45
|
-
),
|
44
|
+
[n, h, b, P]
|
45
|
+
), H = p(
|
46
46
|
(e, c) => {
|
47
|
-
|
47
|
+
S(e, ue.PUZZLE), y(_.PUZZLE_ACTIVITY), N(c);
|
48
48
|
},
|
49
|
-
[N,
|
50
|
-
),
|
49
|
+
[N, S, y]
|
50
|
+
), G = p(
|
51
51
|
(e, c, i) => {
|
52
|
-
var Y, v, B, U, V, x, D, M,
|
53
|
-
if (
|
52
|
+
var w, Y, v, B, U, V, x, D, M, W, X, $, J, F, Z, K, q, Q;
|
53
|
+
if (!((w = n == null ? void 0 : n.current) != null && w.nextBtnRef.current) || !((Y = r == null ? void 0 : r.current) != null && Y.segmentedCardWrapperRef.current) || !((v = o == null ? void 0 : o.current) != null && v.labelRef.current) || !((B = r == null ? void 0 : r.current) != null && B.labelRef.current) || !e)
|
54
54
|
return;
|
55
|
-
|
56
|
-
const g = ((D = (x = (V = l.current) == null ? void 0 : V.labelRef) == null ? void 0 : x.current) == null ? void 0 : D.getBoundingClientRect()) || {
|
55
|
+
const m = ((x = (V = (U = l.current) == null ? void 0 : U.labelRef) == null ? void 0 : V.current) == null ? void 0 : x.getBoundingClientRect()) || {
|
57
56
|
height: 0,
|
58
57
|
width: 0
|
59
|
-
},
|
58
|
+
}, A = ((W = (M = (D = o.current) == null ? void 0 : D.labelRef) == null ? void 0 : M.current) == null ? void 0 : W.getBoundingClientRect()) || {
|
60
59
|
height: 0,
|
61
60
|
width: 0
|
62
|
-
},
|
61
|
+
}, g = ((J = ($ = (X = r.current) == null ? void 0 : X.labelRef) == null ? void 0 : $.current) == null ? void 0 : J.getBoundingClientRect()) || {
|
63
62
|
height: 0,
|
64
63
|
width: 0
|
65
|
-
},
|
64
|
+
}, T = ((K = (Z = (F = r.current) == null ? void 0 : F.segmentedCardWrapperRef) == null ? void 0 : Z.current) == null ? void 0 : K.getBoundingClientRect()) || {
|
66
65
|
height: 0,
|
67
66
|
width: 0
|
68
67
|
};
|
69
|
-
let
|
70
|
-
c && l.current && (
|
68
|
+
let u = [];
|
69
|
+
c && l.current && (u = [
|
71
70
|
{
|
72
71
|
originalElementToHighlightRef: l.current.labelRef,
|
73
72
|
isActive: !1,
|
74
73
|
type: a.TOOLTIP,
|
75
|
-
elementToHighlight: /* @__PURE__ */ t(
|
74
|
+
elementToHighlight: /* @__PURE__ */ t(L, {}),
|
76
75
|
indicator: {
|
77
76
|
position: "right",
|
78
77
|
backgroundColor: "BLUE_4",
|
79
78
|
width: 264,
|
80
|
-
tooltipItem: /* @__PURE__ */ t(
|
81
|
-
tooltipXCoOrdinates:
|
82
|
-
tooltipYCoOrdinates:
|
79
|
+
tooltipItem: /* @__PURE__ */ t(O, { children: /* @__PURE__ */ t(d, { $renderAs: "ab2-bold", children: "Get faster & stay ahead in school. Practice 3 new skills everyday." }) }),
|
80
|
+
tooltipXCoOrdinates: m.width + 50,
|
81
|
+
tooltipYCoOrdinates: m.height / 2
|
83
82
|
}
|
84
83
|
},
|
85
84
|
{
|
86
|
-
originalElementToHighlightRef: (
|
85
|
+
originalElementToHighlightRef: (q = n.current) == null ? void 0 : q.nextBtnRef,
|
87
86
|
isActive: !1,
|
88
87
|
type: a.NUDGE,
|
89
88
|
elementToHighlight: /* @__PURE__ */ t(
|
90
|
-
|
89
|
+
ee,
|
91
90
|
{
|
92
91
|
renderAs: "secondary",
|
93
|
-
Icon:
|
94
|
-
onClick: () =>
|
92
|
+
Icon: j,
|
93
|
+
onClick: () => s(
|
95
94
|
_.GAMES_ACTIVITY,
|
96
95
|
o.current,
|
97
96
|
"ORANGE_4",
|
98
97
|
i
|
99
98
|
),
|
100
|
-
analyticsLabel:
|
99
|
+
analyticsLabel: te.JOURNEY_NEXT_ACTIVITY
|
101
100
|
}
|
102
101
|
),
|
103
102
|
indicator: {
|
@@ -108,19 +107,19 @@ const ke = ({
|
|
108
107
|
}
|
109
108
|
}
|
110
109
|
]);
|
111
|
-
const
|
110
|
+
const ne = [
|
112
111
|
{
|
113
112
|
originalElementToHighlightRef: o.current.labelRef,
|
114
113
|
isActive: !1,
|
115
114
|
type: a.TOOLTIP,
|
116
|
-
elementToHighlight: /* @__PURE__ */ t(
|
115
|
+
elementToHighlight: /* @__PURE__ */ t(L, {}),
|
117
116
|
indicator: {
|
118
117
|
position: "right",
|
119
118
|
backgroundColor: "ORANGE_4",
|
120
119
|
width: 264,
|
121
|
-
tooltipItem: /* @__PURE__ */ t(
|
122
|
-
tooltipXCoOrdinates:
|
123
|
-
tooltipYCoOrdinates:
|
120
|
+
tooltipItem: /* @__PURE__ */ t(O, { children: /* @__PURE__ */ t(d, { $renderAs: "ab2-bold", children: "Train to think deeper & plan ahead. Play 3 new games everyday." }) }),
|
121
|
+
tooltipXCoOrdinates: A.width + 50,
|
122
|
+
tooltipYCoOrdinates: A.height / 2
|
124
123
|
}
|
125
124
|
},
|
126
125
|
{
|
@@ -128,17 +127,17 @@ const ke = ({
|
|
128
127
|
isActive: !1,
|
129
128
|
type: a.NUDGE,
|
130
129
|
elementToHighlight: /* @__PURE__ */ t(
|
131
|
-
|
130
|
+
ee,
|
132
131
|
{
|
133
132
|
renderAs: "secondary",
|
134
|
-
Icon:
|
135
|
-
onClick: () =>
|
133
|
+
Icon: j,
|
134
|
+
onClick: () => s(
|
136
135
|
_.PUZZLE_ACTIVITY,
|
137
136
|
r.current,
|
138
137
|
"PURPLE_4",
|
139
138
|
i
|
140
139
|
),
|
141
|
-
analyticsLabel:
|
140
|
+
analyticsLabel: te.JOURNEY_NEXT_ACTIVITY
|
142
141
|
}
|
143
142
|
),
|
144
143
|
indicator: {
|
@@ -148,19 +147,19 @@ const ke = ({
|
|
148
147
|
nudgePointerY: 0
|
149
148
|
}
|
150
149
|
}
|
151
|
-
],
|
150
|
+
], ie = [
|
152
151
|
{
|
153
152
|
originalElementToHighlightRef: r.current.labelRef,
|
154
153
|
isActive: !1,
|
155
154
|
type: a.TOOLTIP,
|
156
|
-
elementToHighlight: /* @__PURE__ */ t(
|
155
|
+
elementToHighlight: /* @__PURE__ */ t(L, {}),
|
157
156
|
indicator: {
|
158
157
|
position: "right",
|
159
158
|
backgroundColor: "PURPLE_4",
|
160
159
|
width: 264,
|
161
|
-
tooltipItem: /* @__PURE__ */ t(
|
162
|
-
tooltipXCoOrdinates:
|
163
|
-
tooltipYCoOrdinates:
|
160
|
+
tooltipItem: /* @__PURE__ */ t(O, { children: /* @__PURE__ */ t(d, { $renderAs: "ab2-bold", children: "Think in new ways & stay sharp. Solve 3 new puzzles everyday." }) }),
|
161
|
+
tooltipXCoOrdinates: g.width + 50,
|
162
|
+
tooltipYCoOrdinates: g.height / 2
|
164
163
|
}
|
165
164
|
},
|
166
165
|
{
|
@@ -179,39 +178,39 @@ const ke = ({
|
|
179
178
|
name: "",
|
180
179
|
// We dont want to show the name of the puzzle in onboarding
|
181
180
|
isCompleted: E.solved,
|
182
|
-
onPress: () =>
|
181
|
+
onPress: () => H(E, i)
|
183
182
|
}))
|
184
183
|
}
|
185
184
|
),
|
186
185
|
indicator: {
|
187
186
|
nudge: "click",
|
188
187
|
content: /* @__PURE__ */ t(d, { $renderAs: "ab1", $color: "WHITE", children: "Click to solve a puzzle" }),
|
189
|
-
nudgePointerX:
|
190
|
-
nudgePointerY:
|
188
|
+
nudgePointerX: T.width * 0.6,
|
189
|
+
nudgePointerY: T.height * 0.4
|
191
190
|
}
|
192
191
|
}
|
193
192
|
];
|
194
|
-
|
195
|
-
const
|
196
|
-
clearTimeout(
|
193
|
+
R(i, [...u, ...ne, ...ie]), (Q = n.current) == null || Q.goToIndex(0);
|
194
|
+
const k = setTimeout(() => {
|
195
|
+
clearTimeout(k), h(i);
|
197
196
|
}, Te);
|
198
|
-
C.current.push(
|
197
|
+
C.current.push(k), c && l.current ? s(_.SKILL_ACTIVITY, l.current, "BLUE_4", i, !0) : s(_.GAMES_ACTIVITY, o.current, "ORANGE_4", i, !0);
|
199
198
|
},
|
200
|
-
[n,
|
201
|
-
),
|
199
|
+
[n, H, s, h, R]
|
200
|
+
), re = oe(
|
202
201
|
() => ({
|
203
202
|
gameRefs: o,
|
204
203
|
puzzleRefs: r,
|
205
204
|
lessonRefs: l,
|
206
|
-
startJourney:
|
205
|
+
startJourney: G
|
207
206
|
}),
|
208
|
-
[
|
207
|
+
[G]
|
209
208
|
);
|
210
|
-
return
|
211
|
-
C.current.forEach((e) => clearTimeout(e)), C.current = []
|
212
|
-
}, [n]),
|
209
|
+
return le(() => () => {
|
210
|
+
C.current.forEach((e) => clearTimeout(e)), C.current = [];
|
211
|
+
}, [n]), re;
|
213
212
|
};
|
214
213
|
export {
|
215
|
-
|
214
|
+
Ge as useGameLauncherJourney
|
216
215
|
};
|
217
216
|
//# sourceMappingURL=use-game-launcher-journey.js.map
|