@cuemath/leap 2.8.61-rj-16 → 2.8.61-rj-17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
2
|
-
import { memo as
|
2
|
+
import { memo as O, useRef as v, useCallback as n, useMemo as N, useEffect as x } from "react";
|
3
3
|
import { LOTTIE as D } from "../../../assets/lottie/lottie.js";
|
4
4
|
import { JOURNEY_ID_STUDENT as h } from "../../journey/journey-id/journey-id-student.js";
|
5
5
|
import { CircularLoader as U } from "../../ui/loader/circular-loader/circular-loader.js";
|
@@ -7,42 +7,42 @@ import Y from "../../ui/lottie-animation/lottie-animation.js";
|
|
7
7
|
import { useCircleSounds as B } from "../hooks/use-circle-sounds/use-circle-sounds.js";
|
8
8
|
import { CircleSoundKey as u } from "../hooks/use-circle-sounds/use-circle-sounds-enums.js";
|
9
9
|
import { GAME_LAUNCHER_SIZE as K } from "./comps/card-container/constants.js";
|
10
|
-
import { Carousel as
|
10
|
+
import { Carousel as G } from "./comps/carousel/carousel.js";
|
11
11
|
import { GAME_LAUNCHER_ASSET_PADDING as H } from "./comps/segmented-game-card/constants.js";
|
12
12
|
import { SegmentedGameCard as a } from "./comps/segmented-game-card/segmented-game-card.js";
|
13
13
|
import { TablesCard as Z } from "./comps/tables-card/tables-card.js";
|
14
|
-
import { GAME_LAUNCHER_ANALYTICS_EVENTS as
|
14
|
+
import { GAME_LAUNCHER_ANALYTICS_EVENTS as z } from "./game-launcher-analytics-events.js";
|
15
15
|
import { useGameLauncherJourney as w } from "./hooks/use-game-launcher-journey/use-game-launcher-journey.js";
|
16
16
|
import { useTableLauncherJourney as X } from "./hooks/use-table-launcher-journey/use-table-launcher-journey.js";
|
17
17
|
import { ProjectType as f } from "../games/web-view/enums/project-type-enum.js";
|
18
|
-
const V = K + H, ue =
|
18
|
+
const V = K + H, ue = O(
|
19
19
|
({
|
20
20
|
onSegmentClick: r,
|
21
|
-
journeyId:
|
21
|
+
journeyId: t,
|
22
22
|
isError: S,
|
23
23
|
data: e,
|
24
|
-
isLoading:
|
24
|
+
isLoading: c,
|
25
25
|
isTutorialOnboardingDone: E,
|
26
26
|
defaultIndex: M = 0
|
27
27
|
}) => {
|
28
|
-
const
|
29
|
-
(
|
30
|
-
o(u.GAME_CARD_CLICK), r(
|
28
|
+
const m = v(null), { playSwipSound: C, play: o } = B(), p = n(
|
29
|
+
(s) => {
|
30
|
+
o(u.GAME_CARD_CLICK), r(s, f.TABLE);
|
31
31
|
},
|
32
32
|
[r, o]
|
33
33
|
), L = n(
|
34
|
-
(
|
35
|
-
|
34
|
+
(s) => {
|
35
|
+
s.status !== "completed" && (o(u.GAME_CARD_CLICK), r(s, f.LESSON));
|
36
36
|
},
|
37
37
|
[r, o]
|
38
38
|
), _ = n(
|
39
|
-
(
|
40
|
-
o(u.GAME_CARD_CLICK), r(
|
39
|
+
(s) => {
|
40
|
+
o(u.GAME_CARD_CLICK), r(s, f.GAME);
|
41
41
|
},
|
42
42
|
[r, o]
|
43
43
|
), b = n(
|
44
|
-
(
|
45
|
-
o(u.GAME_CARD_CLICK), r(
|
44
|
+
(s) => {
|
45
|
+
o(u.GAME_CARD_CLICK), r(s, f.PUZZLE);
|
46
46
|
},
|
47
47
|
[r, o]
|
48
48
|
), {
|
@@ -51,46 +51,46 @@ const V = K + H, ue = g(
|
|
51
51
|
puzzleRefs: R,
|
52
52
|
startJourney: y
|
53
53
|
} = w({
|
54
|
-
carouselRefs:
|
54
|
+
carouselRefs: m,
|
55
55
|
onSegmentClick: r
|
56
56
|
}), { startJourney: I, tableRef: P } = X({
|
57
|
-
carouselRefs:
|
58
|
-
onTableSegmentClick:
|
59
|
-
}),
|
60
|
-
let
|
61
|
-
return e && (e.lessons && (
|
62
|
-
...
|
57
|
+
carouselRefs: m,
|
58
|
+
onTableSegmentClick: p
|
59
|
+
}), g = N(() => {
|
60
|
+
let s = [];
|
61
|
+
return e && (e.lessons && (s = [
|
62
|
+
...s,
|
63
63
|
/* @__PURE__ */ i(
|
64
64
|
a,
|
65
65
|
{
|
66
66
|
ref: T,
|
67
67
|
label: e.lessons.label,
|
68
|
-
value: e.lessons.data.filter((
|
68
|
+
value: e.lessons.data.filter((l) => l.status === "completed").length,
|
69
69
|
maxValue: e.lessons.data.length,
|
70
70
|
initialValue: e.lessons.initialProgressValue,
|
71
|
-
data: e == null ? void 0 : e.lessons.data.map((
|
72
|
-
card:
|
73
|
-
name:
|
74
|
-
isCompleted:
|
75
|
-
onPress: () => L(
|
71
|
+
data: e == null ? void 0 : e.lessons.data.map((l) => ({
|
72
|
+
card: l.cardLottie,
|
73
|
+
name: l.name,
|
74
|
+
isCompleted: l.status === "completed",
|
75
|
+
onPress: () => L(l)
|
76
76
|
}))
|
77
77
|
}
|
78
78
|
)
|
79
|
-
]),
|
80
|
-
...
|
79
|
+
]), s = [
|
80
|
+
...s,
|
81
81
|
/* @__PURE__ */ i(
|
82
82
|
a,
|
83
83
|
{
|
84
84
|
ref: A,
|
85
85
|
label: e.games.label,
|
86
|
-
value: e.games.data.filter((
|
86
|
+
value: e.games.data.filter((l) => l.isPlayed).length,
|
87
87
|
maxValue: e.games.data.length,
|
88
88
|
initialValue: e.games.initialProgressValue,
|
89
|
-
data: e.games.data.map((
|
90
|
-
card:
|
91
|
-
name:
|
89
|
+
data: e.games.data.map((l) => ({
|
90
|
+
card: l.cardLottie,
|
91
|
+
name: l.name,
|
92
92
|
isCompleted: !1,
|
93
|
-
onPress: () => _(
|
93
|
+
onPress: () => _(l)
|
94
94
|
}))
|
95
95
|
}
|
96
96
|
),
|
@@ -99,30 +99,30 @@ const V = K + H, ue = g(
|
|
99
99
|
{
|
100
100
|
ref: R,
|
101
101
|
label: e.puzzles.label,
|
102
|
-
value: e.puzzles.data.filter((
|
102
|
+
value: e.puzzles.data.filter((l) => l.solved).length,
|
103
103
|
maxValue: e.puzzles.data.length,
|
104
104
|
initialValue: e.puzzles.initialProgressValue,
|
105
|
-
data: e.puzzles.data.map((
|
106
|
-
card:
|
107
|
-
name:
|
108
|
-
isCompleted:
|
109
|
-
onPress: () => b(
|
105
|
+
data: e.puzzles.data.map((l) => ({
|
106
|
+
card: l.cardLottie,
|
107
|
+
name: l.name,
|
108
|
+
isCompleted: l.solved,
|
109
|
+
onPress: () => b(l)
|
110
110
|
}))
|
111
111
|
}
|
112
112
|
)
|
113
|
-
], e.tables && (
|
114
|
-
...
|
113
|
+
], e.tables && (s = [
|
114
|
+
...s,
|
115
115
|
/* @__PURE__ */ i(
|
116
116
|
Z,
|
117
117
|
{
|
118
118
|
ref: P,
|
119
119
|
label: e.tables.label,
|
120
120
|
data: e.tables.data,
|
121
|
-
onPress:
|
121
|
+
onPress: p,
|
122
122
|
openModesOfTable: e.tables.openModesOfTable
|
123
123
|
}
|
124
124
|
)
|
125
|
-
])),
|
125
|
+
])), s;
|
126
126
|
}, [
|
127
127
|
e,
|
128
128
|
A,
|
@@ -132,8 +132,8 @@ const V = K + H, ue = g(
|
|
132
132
|
_,
|
133
133
|
b,
|
134
134
|
P,
|
135
|
-
|
136
|
-
]),
|
135
|
+
p
|
136
|
+
]), J = N(
|
137
137
|
() => [
|
138
138
|
/* @__PURE__ */ i(
|
139
139
|
Y,
|
@@ -147,24 +147,27 @@ const V = K + H, ue = g(
|
|
147
147
|
[]
|
148
148
|
);
|
149
149
|
return x(() => {
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
150
|
+
var s;
|
151
|
+
if (c || !e || !((s = m.current) != null && s.indicatorRefs)) {
|
152
|
+
console.log("Game Launcher", m.current);
|
153
|
+
return;
|
154
|
+
}
|
155
|
+
if (e != null && e.puzzles && t === h.CIRCLE_ACTIVITIES_INTRO_JOURNEY) {
|
156
|
+
y(e == null ? void 0 : e.puzzles, !!(e != null && e.lessons), t);
|
157
|
+
return;
|
156
158
|
}
|
159
|
+
e != null && e.tables && t === h.CIRCLE_TABLES_INTRO_JOURNEY && I(e == null ? void 0 : e.tables, E);
|
157
160
|
}, [
|
158
161
|
e,
|
159
|
-
|
162
|
+
c,
|
160
163
|
E,
|
161
|
-
|
164
|
+
t,
|
162
165
|
y,
|
163
166
|
I
|
164
|
-
]),
|
165
|
-
|
167
|
+
]), c ? /* @__PURE__ */ i(U, {}) : S ? /* @__PURE__ */ i(
|
168
|
+
G,
|
166
169
|
{
|
167
|
-
items:
|
170
|
+
items: J,
|
168
171
|
analyticsNext: {
|
169
172
|
analyticsLabel: ""
|
170
173
|
},
|
@@ -173,18 +176,18 @@ const V = K + H, ue = g(
|
|
173
176
|
}
|
174
177
|
}
|
175
178
|
) : /* @__PURE__ */ i(
|
176
|
-
|
179
|
+
G,
|
177
180
|
{
|
178
|
-
ref:
|
179
|
-
items:
|
181
|
+
ref: m,
|
182
|
+
items: g,
|
180
183
|
defaultIndex: M,
|
181
184
|
onNext: C,
|
182
185
|
onPrev: C,
|
183
186
|
analyticsNext: {
|
184
|
-
analyticsLabel:
|
187
|
+
analyticsLabel: z.NEXT_ACTIVITY
|
185
188
|
},
|
186
189
|
analyticsPrev: {
|
187
|
-
analyticsLabel:
|
190
|
+
analyticsLabel: z.PREV_ACTIVITY
|
188
191
|
}
|
189
192
|
}
|
190
193
|
);
|
@@ -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 { 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 { 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 || !carouselRefs.current) {\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 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 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","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":";;;;;;;;;;;;;;;;;AA4BA,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,EAAsB,IAAI,GAEzC,EAAE,eAAAC,GAAe,MAAAC,EAAK,IAAIC,EAAgB,GAE1CC,IAAsBC;AAAA,MAC1B,CAACC,MAAyB;AACxB,QAAAJ,EAAKK,EAAe,eAAe,GACpBf,EAAAc,GAAOE,EAAY,KAAK;AAAA,MACzC;AAAA,MACA,CAAChB,GAAgBU,CAAI;AAAA,IACvB,GAEMO,IAA2BJ;AAAA,MAC/B,CAACK,MAAmB;AACd,QAAAA,EAAO,WAAW,gBACpBR,EAAKK,EAAe,eAAe,GACpBf,EAAAkB,GAAQF,EAAY,MAAM;AAAA,MAE7C;AAAA,MACA,CAAChB,GAAgBU,CAAI;AAAA,IACvB,GAEMS,IAAyBN;AAAA,MAC7B,CAACO,MAAe;AACd,QAAAV,EAAKK,EAAe,eAAe,GACpBf,EAAAoB,GAAMJ,EAAY,IAAI;AAAA,MACvC;AAAA,MACA,CAAChB,GAAgBU,CAAI;AAA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AAAE;AAAA,UAACI;AAAA,UAAA;AAAA,YACC,KAAKC,EAAO;AAAA,YACZ,OAAO5C;AAAA,YACP,QAAQA;AAAA,UAAA;AAAA,QAAA;AAAA,MAEZ;AAAA,MACA,CAAA;AAAA,IACF;AA0BA,WAvBA6C,EAAU,MAAM;AACd,UAAI,EAAApC,KAAa,CAACD,KAAQ,CAACI,EAAa,UAIxC;AAAA,YAAIJ,KAAA,QAAAA,EAAM,WAAWF,MAAcwC,EAAmB,iCAAiC;AACrF,UAAAf,EAA8BvB,KAAA,gBAAAA,EAAM,SAAS,CAAC,EAACA,KAAA,QAAAA,EAAM,UAASF,CAAS;AAEvE;AAAA,QAAA;AAGF,QAAIE,KAAA,QAAAA,EAAM,UAAUF,MAAcwC,EAAmB,+BAChCb,EAAAzB,KAAA,gBAAAA,EAAM,QAAQE,CAAwB;AAAA;AAAA,IAC3D,GACC;AAAA,MACDF;AAAA,MACAC;AAAA,MACAC;AAAA,MACAJ;AAAA,MACAyB;AAAA,MACAE;AAAA,IAAA,CACD,GAEGxB,sBACMsC,GAAe,EAAA,IAGrBxC,IAEA,gBAAAgC;AAAA,MAACS;AAAA,MAAA;AAAA,QACC,OAAON;AAAA,QACP,eAAe;AAAA,UACb,gBAAgB;AAAA,QAClB;AAAA,QACA,eAAe;AAAA,UACb,gBAAgB;AAAA,QAAA;AAAA,MAClB;AAAA,IACF,IAKF,gBAAAH;AAAA,MAACS;AAAA,MAAA;AAAA,QACC,KAAKpC;AAAA,QACL,OAAAwB;AAAA,QACA,cAAAzB;AAAA,QACA,QAAQG;AAAA,QACR,QAAQA;AAAA,QACR,eAAe;AAAA,UACb,gBAAgBmC,EAA+B;AAAA,QACjD;AAAA,QACA,eAAe;AAAA,UACb,gBAAgBA,EAA+B;AAAA,QAAA;AAAA,MACjD;AAAA,IACF;AAAA,EAAA;AAGN;"}
|
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 { 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 { 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 || !carouselRefs.current?.indicatorRefs) {\n console.log('Game Launcher', carouselRefs.current);\n\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 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 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","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","_a","JOURNEY_ID_STUDENT","CircularLoader","Carousel","GAME_LAUNCHER_ANALYTICS_EVENTS"],"mappings":";;;;;;;;;;;;;;;;;AA4BA,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,EAAsB,IAAI,GAEzC,EAAE,eAAAC,GAAe,MAAAC,EAAK,IAAIC,EAAgB,GAE1CC,IAAsBC;AAAA,MAC1B,CAACC,MAAyB;AACxB,QAAAJ,EAAKK,EAAe,eAAe,GACpBf,EAAAc,GAAOE,EAAY,KAAK;AAAA,MACzC;AAAA,MACA,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