@cuemath/leap 2.8.61-hg1 → 2.8.61-rj-0
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-get-circle-home-details-dal/use-get-circle-home-details-dal.js +77 -85
- package/dist/features/circle-games/game-launcher/dal/use-get-circle-home-details-dal/use-get-circle-home-details-dal.js.map +1 -1
- package/dist/features/circle-games/game-launcher/game-launcher.js +66 -76
- 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 +37 -38
- 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 +49 -50
- package/dist/features/circle-games/game-launcher/hooks/use-table-launcher-journey/use-table-launcher-journey.js.map +1 -1
- package/dist/features/circle-games/games/web-view/web-view-types.js.map +1 -1
- package/dist/features/circle-games/games/web-view/web-view.js +53 -47
- package/dist/features/circle-games/games/web-view/web-view.js.map +1 -1
- package/dist/features/journey/hooks/use-get-eligible-journeys-via-route.js +13 -0
- package/dist/features/journey/hooks/use-get-eligible-journeys-via-route.js.map +1 -0
- package/dist/features/journey/use-journey/journey-context-provider.js +74 -40
- package/dist/features/journey/use-journey/journey-context-provider.js.map +1 -1
- package/dist/features/journey/use-journey/journey-styled.js +1 -1
- package/dist/features/journey/use-journey/journey-styled.js.map +1 -1
- package/dist/features/journey/user-journey-api/user-journey-api.js +12 -0
- package/dist/features/journey/user-journey-api/user-journey-api.js.map +1 -0
- package/dist/index.d.ts +27 -33
- package/dist/index.js +78 -78
- package/package.json +1 -1
- package/dist/features/circle-games/game-launcher/api/update-circle-onboarding/constants.js +0 -5
- package/dist/features/circle-games/game-launcher/api/update-circle-onboarding/constants.js.map +0 -1
- package/dist/features/circle-games/game-launcher/api/update-circle-onboarding/post-circle-coachmark-api.js +0 -9
- package/dist/features/circle-games/game-launcher/api/update-circle-onboarding/post-circle-coachmark-api.js.map +0 -1
- package/dist/features/circle-games/game-launcher/dal/use-post-update-circle-journey-dal/use-post-update-circle-journey-dal.js +0 -23
- package/dist/features/circle-games/game-launcher/dal/use-post-update-circle-journey-dal/use-post-update-circle-journey-dal.js.map +0 -1
@@ -1,111 +1,103 @@
|
|
1
|
-
import { useMemo as
|
2
|
-
import { useGetCircleHomeAPI as
|
3
|
-
import { ProjectType as
|
4
|
-
const
|
5
|
-
const
|
1
|
+
import { useMemo as j, useState as f, useCallback as m, useEffect as y } from "react";
|
2
|
+
import { useGetCircleHomeAPI as k, invalidateCircleHomeAPI as v } from "../../api/get-content-for-today/get-circle-home-api.js";
|
3
|
+
import { ProjectType as r } from "../../../games/web-view/enums/project-type-enum.js";
|
4
|
+
const D = (a, n, l) => {
|
5
|
+
const s = j(
|
6
6
|
() => ({
|
7
7
|
user_id: a,
|
8
8
|
grade: n,
|
9
|
-
country_code:
|
9
|
+
country_code: l
|
10
10
|
}),
|
11
|
-
[a, n,
|
12
|
-
), [
|
13
|
-
data:
|
14
|
-
get:
|
15
|
-
isProcessed:
|
16
|
-
...
|
17
|
-
} =
|
18
|
-
|
19
|
-
}, [
|
20
|
-
|
21
|
-
}, [
|
22
|
-
return
|
23
|
-
let
|
24
|
-
|
25
|
-
points:
|
26
|
-
streakDays:
|
27
|
-
streakReduction:
|
28
|
-
streakDaysBeforeReduction:
|
29
|
-
streakStatus:
|
30
|
-
tournamentRank:
|
11
|
+
[a, n, l]
|
12
|
+
), [d, p] = f(null), {
|
13
|
+
data: e,
|
14
|
+
get: c,
|
15
|
+
isProcessed: o,
|
16
|
+
...u
|
17
|
+
} = k(a, s), _ = m(() => {
|
18
|
+
c(a, s);
|
19
|
+
}, [c, s, a]), b = m(() => {
|
20
|
+
v(a, s);
|
21
|
+
}, [s, a]);
|
22
|
+
return y(() => {
|
23
|
+
let i = null;
|
24
|
+
o && e && (i = {
|
25
|
+
points: e.points,
|
26
|
+
streakDays: e.streak_days,
|
27
|
+
streakReduction: e.streak_reduction,
|
28
|
+
streakDaysBeforeReduction: e.streak_days_before_reduction,
|
29
|
+
streakStatus: e.streak_status,
|
30
|
+
tournamentRank: e.tournament_rank,
|
31
31
|
projects: {
|
32
32
|
games: {
|
33
|
-
label:
|
34
|
-
type:
|
33
|
+
label: e.projects.games.label,
|
34
|
+
type: r.GAME,
|
35
35
|
initialProgressValue: 0,
|
36
|
-
data:
|
37
|
-
id:
|
38
|
-
name:
|
39
|
-
cardLottie:
|
40
|
-
tutorial:
|
41
|
-
variant:
|
42
|
-
isPlayed:
|
36
|
+
data: e.projects.games.data.map((t) => ({
|
37
|
+
id: t.id,
|
38
|
+
name: t.name,
|
39
|
+
cardLottie: t.card,
|
40
|
+
tutorial: t.tutorial,
|
41
|
+
variant: t.variant,
|
42
|
+
isPlayed: t.played
|
43
43
|
}))
|
44
44
|
},
|
45
45
|
puzzles: {
|
46
|
-
label:
|
47
|
-
type:
|
46
|
+
label: e.projects.puzzles.label,
|
47
|
+
type: r.PUZZLE,
|
48
48
|
initialProgressValue: 0,
|
49
|
-
data:
|
50
|
-
id:
|
51
|
-
name:
|
52
|
-
cardLottie:
|
53
|
-
tutorial:
|
54
|
-
variant:
|
55
|
-
question:
|
56
|
-
isHintSeen:
|
57
|
-
solved:
|
49
|
+
data: e.projects.puzzles.data.map((t) => ({
|
50
|
+
id: t.id,
|
51
|
+
name: t.name,
|
52
|
+
cardLottie: t.card,
|
53
|
+
tutorial: t.tutorial,
|
54
|
+
variant: t.variant,
|
55
|
+
question: t.question,
|
56
|
+
isHintSeen: t.is_hint_seen,
|
57
|
+
solved: t.solved
|
58
58
|
}))
|
59
59
|
}
|
60
60
|
},
|
61
61
|
timestamps: {
|
62
|
-
startTimestamp:
|
63
|
-
endTimestamp:
|
64
|
-
current:
|
65
|
-
},
|
66
|
-
coachmarkProgress: {
|
67
|
-
CIRCLE_ACTIVITIES_INTRO_JOURNEY: t.coachmark_completion.CIRCLE_ACTIVITIES_INTRO_JOURNEY,
|
68
|
-
CIRCLE_LEADERBOARD_INTRO_JOURNEY: t.coachmark_completion.CIRCLE_LEADERBOARD_INTRO_JOURNEY,
|
69
|
-
CIRCLE_POINTS_REWARD_JOURNEY: t.coachmark_completion.CIRCLE_POINTS_REWARD_JOURNEY,
|
70
|
-
CIRCLE_STREAK_UPDATE_JOURNEY: t.coachmark_completion.CIRCLE_STREAK_UPDATE_JOURNEY,
|
71
|
-
CIRCLE_TUTORIAL_JOURNEY: t.coachmark_completion.CIRCLE_TUTORIAL_JOURNEY,
|
72
|
-
CIRCLE_TABLES_INTRO_JOURNEY: t.coachmark_completion.CIRCLE_TABLES_INTRO_JOURNEY
|
62
|
+
startTimestamp: e.timestamps.start_timestamp,
|
63
|
+
endTimestamp: e.timestamps.end_timestamp,
|
64
|
+
current: e.timestamps.current
|
73
65
|
}
|
74
|
-
},
|
75
|
-
label:
|
76
|
-
type:
|
66
|
+
}, e.projects.lessons && (i.projects.lessons = {
|
67
|
+
label: e.projects.lessons.label,
|
68
|
+
type: r.LESSON,
|
77
69
|
initialProgressValue: 0,
|
78
|
-
data:
|
79
|
-
id:
|
80
|
-
name:
|
81
|
-
cardLottie:
|
82
|
-
tutorial:
|
83
|
-
variant:
|
84
|
-
sessionId:
|
85
|
-
miniGameIdentifier:
|
86
|
-
targetQuestions:
|
87
|
-
status:
|
70
|
+
data: e.projects.lessons.data.map((t) => ({
|
71
|
+
id: t.id,
|
72
|
+
name: t.name,
|
73
|
+
cardLottie: t.card,
|
74
|
+
tutorial: t.tutorial,
|
75
|
+
variant: t.variant,
|
76
|
+
sessionId: t.session_id,
|
77
|
+
miniGameIdentifier: t.mini_game_identifier,
|
78
|
+
targetQuestions: t.target_questions,
|
79
|
+
status: t.status
|
88
80
|
}))
|
89
|
-
}),
|
90
|
-
label:
|
91
|
-
type:
|
81
|
+
}), e.projects.tables && (i.projects.tables = {
|
82
|
+
label: e.projects.tables.label,
|
83
|
+
type: r.TABLE,
|
92
84
|
data: {
|
93
|
-
infiniteModeHighScore:
|
94
|
-
tableList:
|
95
|
-
tableNumber:
|
96
|
-
stars:
|
85
|
+
infiniteModeHighScore: e.projects.tables.data.infinite_mode_high_score,
|
86
|
+
tableList: e.projects.tables.data.table_wise_details.map((t) => ({
|
87
|
+
tableNumber: t.table_number,
|
88
|
+
stars: t.stars
|
97
89
|
}))
|
98
90
|
}
|
99
|
-
})),
|
100
|
-
}, [
|
101
|
-
data:
|
102
|
-
isProcessed:
|
103
|
-
getCircleHomeDetails:
|
104
|
-
invalidateCircleHomeDetails:
|
105
|
-
...
|
91
|
+
})), p(i);
|
92
|
+
}, [e, o]), {
|
93
|
+
data: d,
|
94
|
+
isProcessed: o,
|
95
|
+
getCircleHomeDetails: _,
|
96
|
+
invalidateCircleHomeDetails: b,
|
97
|
+
...u
|
106
98
|
};
|
107
99
|
};
|
108
100
|
export {
|
109
|
-
|
101
|
+
D as useGetCircleHomeDetailsDal
|
110
102
|
};
|
111
103
|
//# sourceMappingURL=use-get-circle-home-details-dal.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-get-circle-home-details-dal.js","sources":["../../../../../../src/features/circle-games/game-launcher/dal/use-get-circle-home-details-dal/use-get-circle-home-details-dal.ts"],"sourcesContent":["import type {\n ICircleHomeDetails,\n TStreakStatus,\n TTableMode,\n} from './use-get-circle-home-dal-types';\n\nimport { useCallback, useEffect, useMemo, useState } from 'react';\n\nimport { ProjectType } from '../../../games/web-view/enums';\nimport {\n invalidateCircleHomeAPI,\n useGetCircleHomeAPI,\n} from '../../api/get-content-for-today/get-circle-home-api';\n\nexport const useGetCircleHomeDetailsDal = (\n userId: string,\n grade: string,\n countryCode: string,\n): Omit<ReturnType<typeof useGetCircleHomeAPI>, 'data' | 'get'> & {\n data: ICircleHomeDetails | null;\n getCircleHomeDetails: () => void;\n invalidateCircleHomeDetails: () => void;\n} => {\n const initialQuery = useMemo(\n () => ({\n user_id: userId,\n grade,\n country_code: countryCode,\n }),\n [userId, grade, countryCode],\n );\n\n const [contentForToday, setContentForToday] = useState<ICircleHomeDetails | null>(null);\n\n const {\n data,\n get: getHomeDetails,\n isProcessed,\n ...rest\n } = useGetCircleHomeAPI(userId, initialQuery);\n\n const getCircleHomeDetails = useCallback(() => {\n getHomeDetails(userId, initialQuery);\n }, [getHomeDetails, initialQuery, userId]);\n\n const invalidateCircleHomeDetails = useCallback(() => {\n invalidateCircleHomeAPI(userId, initialQuery);\n }, [initialQuery, userId]);\n\n useEffect(() => {\n let circleHomeDetails: ICircleHomeDetails | null = null;\n\n if (isProcessed && data) {\n circleHomeDetails = {\n points: data.points,\n streakDays: data.streak_days,\n streakReduction: data.streak_reduction,\n streakDaysBeforeReduction: data.streak_days_before_reduction,\n streakStatus: data.streak_status as TStreakStatus,\n tournamentRank: data.tournament_rank,\n projects: {\n games: {\n label: data.projects.games.label,\n type: ProjectType.GAME,\n initialProgressValue: 0,\n data: data.projects.games.data.map(game => ({\n id: game.id,\n name: game.name,\n cardLottie: game.card,\n tutorial: game.tutorial,\n variant: game.variant,\n isPlayed: game.played,\n })),\n },\n puzzles: {\n label: data.projects.puzzles.label,\n type: ProjectType.PUZZLE,\n initialProgressValue: 0,\n data: data.projects.puzzles.data.map(puzzle => ({\n id: puzzle.id,\n name: puzzle.name,\n cardLottie: puzzle.card,\n tutorial: puzzle.tutorial,\n variant: puzzle.variant,\n question: puzzle.question,\n isHintSeen: puzzle.is_hint_seen,\n solved: puzzle.solved,\n })),\n },\n },\n timestamps: {\n startTimestamp: data.timestamps.start_timestamp,\n endTimestamp: data.timestamps.end_timestamp,\n current: data.timestamps.current,\n },\n
|
1
|
+
{"version":3,"file":"use-get-circle-home-details-dal.js","sources":["../../../../../../src/features/circle-games/game-launcher/dal/use-get-circle-home-details-dal/use-get-circle-home-details-dal.ts"],"sourcesContent":["import type {\n ICircleHomeDetails,\n TStreakStatus,\n TTableMode,\n} from './use-get-circle-home-dal-types';\n\nimport { useCallback, useEffect, useMemo, useState } from 'react';\n\nimport { ProjectType } from '../../../games/web-view/enums';\nimport {\n invalidateCircleHomeAPI,\n useGetCircleHomeAPI,\n} from '../../api/get-content-for-today/get-circle-home-api';\n\nexport const useGetCircleHomeDetailsDal = (\n userId: string,\n grade: string,\n countryCode: string,\n): Omit<ReturnType<typeof useGetCircleHomeAPI>, 'data' | 'get'> & {\n data: ICircleHomeDetails | null;\n getCircleHomeDetails: () => void;\n invalidateCircleHomeDetails: () => void;\n} => {\n const initialQuery = useMemo(\n () => ({\n user_id: userId,\n grade,\n country_code: countryCode,\n }),\n [userId, grade, countryCode],\n );\n\n const [contentForToday, setContentForToday] = useState<ICircleHomeDetails | null>(null);\n\n const {\n data,\n get: getHomeDetails,\n isProcessed,\n ...rest\n } = useGetCircleHomeAPI(userId, initialQuery);\n\n const getCircleHomeDetails = useCallback(() => {\n getHomeDetails(userId, initialQuery);\n }, [getHomeDetails, initialQuery, userId]);\n\n const invalidateCircleHomeDetails = useCallback(() => {\n invalidateCircleHomeAPI(userId, initialQuery);\n }, [initialQuery, userId]);\n\n useEffect(() => {\n let circleHomeDetails: ICircleHomeDetails | null = null;\n\n if (isProcessed && data) {\n circleHomeDetails = {\n points: data.points,\n streakDays: data.streak_days,\n streakReduction: data.streak_reduction,\n streakDaysBeforeReduction: data.streak_days_before_reduction,\n streakStatus: data.streak_status as TStreakStatus,\n tournamentRank: data.tournament_rank,\n projects: {\n games: {\n label: data.projects.games.label,\n type: ProjectType.GAME,\n initialProgressValue: 0,\n data: data.projects.games.data.map(game => ({\n id: game.id,\n name: game.name,\n cardLottie: game.card,\n tutorial: game.tutorial,\n variant: game.variant,\n isPlayed: game.played,\n })),\n },\n puzzles: {\n label: data.projects.puzzles.label,\n type: ProjectType.PUZZLE,\n initialProgressValue: 0,\n data: data.projects.puzzles.data.map(puzzle => ({\n id: puzzle.id,\n name: puzzle.name,\n cardLottie: puzzle.card,\n tutorial: puzzle.tutorial,\n variant: puzzle.variant,\n question: puzzle.question,\n isHintSeen: puzzle.is_hint_seen,\n solved: puzzle.solved,\n })),\n },\n },\n timestamps: {\n startTimestamp: data.timestamps.start_timestamp,\n endTimestamp: data.timestamps.end_timestamp,\n current: data.timestamps.current,\n },\n };\n\n if (data.projects.lessons) {\n circleHomeDetails.projects.lessons = {\n label: data.projects.lessons.label,\n type: ProjectType.LESSON,\n initialProgressValue: 0,\n data: data.projects.lessons.data.map(lesson => ({\n id: lesson.id,\n name: lesson.name,\n cardLottie: lesson.card,\n tutorial: lesson.tutorial,\n variant: lesson.variant,\n sessionId: lesson.session_id,\n miniGameIdentifier: lesson.mini_game_identifier,\n targetQuestions: lesson.target_questions,\n status: lesson.status,\n })),\n };\n }\n\n if (data.projects.tables) {\n circleHomeDetails.projects.tables = {\n label: data.projects.tables.label,\n type: ProjectType.TABLE,\n data: {\n infiniteModeHighScore: data.projects.tables.data.infinite_mode_high_score,\n tableList: data.projects.tables.data.table_wise_details.map(table => ({\n tableNumber: table.table_number,\n stars: table.stars as TTableMode[],\n })),\n },\n };\n }\n }\n\n setContentForToday(circleHomeDetails);\n }, [data, isProcessed]);\n\n return {\n data: contentForToday,\n isProcessed,\n getCircleHomeDetails,\n invalidateCircleHomeDetails,\n ...rest,\n };\n};\n"],"names":["useGetCircleHomeDetailsDal","userId","grade","countryCode","initialQuery","useMemo","contentForToday","setContentForToday","useState","data","getHomeDetails","isProcessed","rest","useGetCircleHomeAPI","getCircleHomeDetails","useCallback","invalidateCircleHomeDetails","invalidateCircleHomeAPI","useEffect","circleHomeDetails","ProjectType","game","puzzle","lesson","table"],"mappings":";;;AAcO,MAAMA,IAA6B,CACxCC,GACAC,GACAC,MAKG;AACH,QAAMC,IAAeC;AAAA,IACnB,OAAO;AAAA,MACL,SAASJ;AAAA,MACT,OAAAC;AAAA,MACA,cAAcC;AAAA,IAAA;AAAA,IAEhB,CAACF,GAAQC,GAAOC,CAAW;AAAA,EAAA,GAGvB,CAACG,GAAiBC,CAAkB,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EAAA;AAEP;"}
|
@@ -1,71 +1,61 @@
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
2
|
-
import { memo as
|
3
|
-
import { LOTTIE as
|
4
|
-
import { JOURNEY_ID_STUDENT as
|
5
|
-
import { CircularLoader as
|
6
|
-
import
|
7
|
-
import { useCircleSounds as
|
8
|
-
import { CircleSoundKey as
|
9
|
-
import { GAME_LAUNCHER_SIZE as
|
10
|
-
import { Carousel as
|
11
|
-
import { GAME_LAUNCHER_ASSET_PADDING as
|
2
|
+
import { memo as O, useRef as g, useCallback as n, useMemo as N, useEffect as v } from "react";
|
3
|
+
import { LOTTIE as x } from "../../../assets/lottie/lottie.js";
|
4
|
+
import { JOURNEY_ID_STUDENT as h } from "../../journey/journey-id/journey-id-student.js";
|
5
|
+
import { CircularLoader as D } from "../../ui/loader/circular-loader/circular-loader.js";
|
6
|
+
import U from "../../ui/lottie-animation/lottie-animation.js";
|
7
|
+
import { useCircleSounds as Y } from "../hooks/use-circle-sounds/use-circle-sounds.js";
|
8
|
+
import { CircleSoundKey as u } from "../hooks/use-circle-sounds/use-circle-sounds-enums.js";
|
9
|
+
import { GAME_LAUNCHER_SIZE as B } from "./comps/card-container/constants.js";
|
10
|
+
import { Carousel as z } from "./comps/carousel/carousel.js";
|
11
|
+
import { GAME_LAUNCHER_ASSET_PADDING as K } from "./comps/segmented-game-card/constants.js";
|
12
12
|
import { SegmentedGameCard as E } from "./comps/segmented-game-card/segmented-game-card.js";
|
13
|
-
import { TablesCard as
|
14
|
-
import { GAME_LAUNCHER_ANALYTICS_EVENTS as
|
15
|
-
import { useGameLauncherJourney as
|
16
|
-
import { useTableLauncherJourney as
|
17
|
-
import { ProjectType as
|
18
|
-
const
|
19
|
-
({
|
20
|
-
|
21
|
-
onJourneyComplete: a,
|
22
|
-
journeyId: m,
|
23
|
-
data: e,
|
24
|
-
isLoading: p,
|
25
|
-
isTutorialOnboardingDone: C,
|
26
|
-
defaultIndex: M = 0
|
27
|
-
}) => {
|
28
|
-
const t = x(null), { playSwipSound: L, play: o } = B(), c = n(
|
13
|
+
import { TablesCard as H } from "./comps/tables-card/tables-card.js";
|
14
|
+
import { GAME_LAUNCHER_ANALYTICS_EVENTS as G } from "./game-launcher-analytics-events.js";
|
15
|
+
import { useGameLauncherJourney as Z } from "./hooks/use-game-launcher-journey/use-game-launcher-journey.js";
|
16
|
+
import { useTableLauncherJourney as w } from "./hooks/use-table-launcher-journey/use-table-launcher-journey.js";
|
17
|
+
import { ProjectType as f } from "../games/web-view/enums/project-type-enum.js";
|
18
|
+
const V = B + K, ne = O(
|
19
|
+
({ onSegmentClick: r, journeyId: m, data: e, isLoading: p, isTutorialOnboardingDone: a, defaultIndex: S = 0 }) => {
|
20
|
+
const t = g(null), { playSwipSound: C, play: o } = Y(), c = n(
|
29
21
|
(l) => {
|
30
|
-
o(
|
22
|
+
o(u.GAME_CARD_CLICK), r(l, f.TABLE);
|
31
23
|
},
|
32
24
|
[r, o]
|
33
|
-
),
|
25
|
+
), L = n(
|
34
26
|
(l) => {
|
35
|
-
l.status !== "completed" && (o(
|
27
|
+
l.status !== "completed" && (o(u.GAME_CARD_CLICK), r(l, f.LESSON));
|
36
28
|
},
|
37
29
|
[r, o]
|
38
|
-
),
|
30
|
+
), _ = n(
|
39
31
|
(l) => {
|
40
|
-
o(
|
32
|
+
o(u.GAME_CARD_CLICK), r(l, f.GAME);
|
41
33
|
},
|
42
34
|
[r, o]
|
43
|
-
),
|
35
|
+
), b = n(
|
44
36
|
(l) => {
|
45
|
-
o(
|
37
|
+
o(u.GAME_CARD_CLICK), r(l, f.PUZZLE);
|
46
38
|
},
|
47
39
|
[r, o]
|
48
40
|
), {
|
49
|
-
gameRefs:
|
50
|
-
lessonRefs:
|
51
|
-
puzzleRefs:
|
41
|
+
gameRefs: A,
|
42
|
+
lessonRefs: T,
|
43
|
+
puzzleRefs: R,
|
52
44
|
startJourney: y
|
53
|
-
} =
|
45
|
+
} = Z({
|
54
46
|
carouselRefs: t,
|
55
|
-
onSegmentClick: r
|
56
|
-
|
57
|
-
}), { startJourney: P, tableRef: N } = X({
|
47
|
+
onSegmentClick: r
|
48
|
+
}), { startJourney: I, tableRef: P } = w({
|
58
49
|
carouselRefs: t,
|
59
|
-
onTableSegmentClick: c
|
60
|
-
|
61
|
-
}), O = h(() => {
|
50
|
+
onTableSegmentClick: c
|
51
|
+
}), M = N(() => {
|
62
52
|
let l = [];
|
63
53
|
return e && (e.lessons && (l = [
|
64
54
|
...l,
|
65
55
|
/* @__PURE__ */ i(
|
66
56
|
E,
|
67
57
|
{
|
68
|
-
ref:
|
58
|
+
ref: T,
|
69
59
|
label: e.lessons.label,
|
70
60
|
value: e.lessons.data.filter((s) => s.status === "completed").length,
|
71
61
|
maxValue: e.lessons.data.length,
|
@@ -74,7 +64,7 @@ const S = K + H, fe = v(
|
|
74
64
|
card: s.cardLottie,
|
75
65
|
name: s.name,
|
76
66
|
isCompleted: s.status === "completed",
|
77
|
-
onPress: () =>
|
67
|
+
onPress: () => L(s)
|
78
68
|
}))
|
79
69
|
}
|
80
70
|
)
|
@@ -83,7 +73,7 @@ const S = K + H, fe = v(
|
|
83
73
|
/* @__PURE__ */ i(
|
84
74
|
E,
|
85
75
|
{
|
86
|
-
ref:
|
76
|
+
ref: A,
|
87
77
|
label: e.games.label,
|
88
78
|
value: e.games.data.filter((s) => s.isPlayed).length,
|
89
79
|
maxValue: e.games.data.length,
|
@@ -92,14 +82,14 @@ const S = K + H, fe = v(
|
|
92
82
|
card: s.cardLottie,
|
93
83
|
name: s.name,
|
94
84
|
isCompleted: !1,
|
95
|
-
onPress: () =>
|
85
|
+
onPress: () => _(s)
|
96
86
|
}))
|
97
87
|
}
|
98
88
|
),
|
99
89
|
/* @__PURE__ */ i(
|
100
90
|
E,
|
101
91
|
{
|
102
|
-
ref:
|
92
|
+
ref: R,
|
103
93
|
label: e.puzzles.label,
|
104
94
|
value: e.puzzles.data.filter((s) => s.solved).length,
|
105
95
|
maxValue: e.puzzles.data.length,
|
@@ -108,16 +98,16 @@ const S = K + H, fe = v(
|
|
108
98
|
card: s.cardLottie,
|
109
99
|
name: s.name,
|
110
100
|
isCompleted: s.solved,
|
111
|
-
onPress: () =>
|
101
|
+
onPress: () => b(s)
|
112
102
|
}))
|
113
103
|
}
|
114
104
|
)
|
115
105
|
], e.tables && (l = [
|
116
106
|
...l,
|
117
107
|
/* @__PURE__ */ i(
|
118
|
-
|
108
|
+
H,
|
119
109
|
{
|
120
|
-
ref:
|
110
|
+
ref: P,
|
121
111
|
label: e.tables.label,
|
122
112
|
data: e.tables.data,
|
123
113
|
onPress: c,
|
@@ -127,62 +117,62 @@ const S = K + H, fe = v(
|
|
127
117
|
])), l;
|
128
118
|
}, [
|
129
119
|
e,
|
130
|
-
|
131
|
-
I,
|
120
|
+
A,
|
132
121
|
R,
|
122
|
+
T,
|
123
|
+
L,
|
133
124
|
_,
|
134
125
|
b,
|
135
|
-
|
136
|
-
N,
|
126
|
+
P,
|
137
127
|
c
|
138
|
-
]),
|
128
|
+
]), J = N(
|
139
129
|
() => [
|
140
130
|
/* @__PURE__ */ i(
|
141
|
-
|
131
|
+
U,
|
142
132
|
{
|
143
|
-
src:
|
144
|
-
width:
|
145
|
-
height:
|
133
|
+
src: x.SLEEPY_BOI,
|
134
|
+
width: V,
|
135
|
+
height: V
|
146
136
|
}
|
147
137
|
)
|
148
138
|
],
|
149
139
|
[]
|
150
140
|
);
|
151
|
-
return
|
141
|
+
return v(() => {
|
152
142
|
if (!(p || !e)) {
|
153
|
-
if (e != null && e.puzzles && m ===
|
143
|
+
if (e != null && e.puzzles && m === h.CIRCLE_ACTIVITIES_INTRO_JOURNEY) {
|
154
144
|
y(e == null ? void 0 : e.puzzles, !!(e != null && e.lessons), m);
|
155
145
|
return;
|
156
146
|
}
|
157
|
-
e != null && e.tables && m ===
|
147
|
+
e != null && e.tables && m === h.CIRCLE_TABLES_INTRO_JOURNEY && I(e == null ? void 0 : e.tables, a);
|
158
148
|
}
|
159
149
|
}, [
|
160
150
|
e,
|
161
151
|
p,
|
162
|
-
|
152
|
+
a,
|
163
153
|
m,
|
164
154
|
y,
|
165
|
-
|
166
|
-
]), p ? /* @__PURE__ */ i(
|
167
|
-
|
155
|
+
I
|
156
|
+
]), p ? /* @__PURE__ */ i(D, {}) : e ? /* @__PURE__ */ i(
|
157
|
+
z,
|
168
158
|
{
|
169
159
|
ref: t,
|
170
|
-
items:
|
171
|
-
defaultIndex:
|
172
|
-
onNext:
|
173
|
-
onPrev:
|
160
|
+
items: M,
|
161
|
+
defaultIndex: S,
|
162
|
+
onNext: C,
|
163
|
+
onPrev: C,
|
174
164
|
analyticsNext: {
|
175
|
-
analyticsLabel:
|
165
|
+
analyticsLabel: G.NEXT_ACTIVITY
|
176
166
|
},
|
177
167
|
analyticsPrev: {
|
178
|
-
analyticsLabel:
|
168
|
+
analyticsLabel: G.PREV_ACTIVITY
|
179
169
|
}
|
180
170
|
}
|
181
171
|
) : /* @__PURE__ */ i(
|
182
|
-
|
172
|
+
z,
|
183
173
|
{
|
184
174
|
ref: t,
|
185
|
-
items:
|
175
|
+
items: J,
|
186
176
|
analyticsNext: {
|
187
177
|
analyticsLabel: ""
|
188
178
|
},
|
@@ -194,6 +184,6 @@ const S = K + H, fe = v(
|
|
194
184
|
}
|
195
185
|
);
|
196
186
|
export {
|
197
|
-
|
187
|
+
ne as GameLauncher
|
198
188
|
};
|
199
189
|
//# 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 { 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 onJourneyComplete,\n journeyId,\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 onJourneyComplete,\n });\n\n const { startJourney: startTablesJourney, tableRef } = useTableLauncherJourney({\n carouselRefs,\n onTableSegmentClick,\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: () => 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) {\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 (!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","onJourneyComplete","journeyId","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,mBAAAC;AAAA,IACA,WAAAC;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,IAAA,GAGjBO,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,IAAA,GAGjBS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,gBAAgB;AAAA,QAClB;AAAA,QACA,eAAe;AAAA,UACb,gBAAgB;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 { 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 { 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) {\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 (!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","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,EAAE,gBAAAC,GAAgB,WAAAC,GAAW,MAAAC,GAAM,WAAAC,GAAW,0BAAAC,GAA0B,cAAAC,IAAe,QAAQ;AACxF,UAAAC,IAAeC,EAAsB,IAAI,GAEzC,EAAE,eAAAC,GAAe,MAAAC,EAAK,IAAIC,EAAgB,GAE1CC,IAAsBC;AAAA,MAC1B,CAACC,MAAyB;AACxB,QAA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