@cuemath/leap 2.8.57-rj-3 → 2.8.57-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/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/hooks/use-game-launcher-journey/use-game-launcher-journey.js +27 -27
- 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 +35 -35
- 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-get-eligible-journeys-via-route.js → hooks/use-get-eligible-journeys-via-route.js} +1 -1
- 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 +59 -57
- 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/index.d.ts +10 -28
- package/dist/index.js +173 -175
- package/dist/index.js.map +1 -1
- 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
- package/dist/features/journey/use-get-eligible-journeys-via-route.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,IAAIC,EAAoC,IAAI,GAEhF;AAAA,IACJ,MAAAC;AAAA,IACA,KAAKC;AAAA,IACL,aAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDC,EAAoBZ,GAAQG,CAAY,GAEtCU,IAAuBC,EAAY,MAAM;AAC7C,IAAAL,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AA,QAChC,cAAcA,EAAK,WAAW;AAAA,QAC9B,SAASA,EAAK,WAAW;AAAA,MAC3B;AAAA,IAAA,GAGEA,EAAK,SAAS,YAChBU,EAAkB,SAAS,UAAU;AAAA,MACnC,OAAOV,EAAK,SAAS,QAAQ;AAAA,MAC7B,MAAMW,EAAY;AAAA,MAClB,sBAAsB;AAAA,MACtB,MAAMX,EAAK,SAAS,QAAQ,KAAK,IAAI,CAAWc,OAAA;AAAA,QAC9C,IAAIA,EAAO;AAAA,QACX,MAAMA,EAAO;AAAA,QACb,YAAYA,EAAO;AAAA,QACnB,UAAUA,EAAO;AAAA,QACjB,SAASA,EAAO;AAAA,QAChB,WAAWA,EAAO;AAAA,QAClB,oBAAoBA,EAAO;AAAA,QAC3B,iBAAiBA,EAAO;AAAA,QACxB,QAAQA,EAAO;AAAA,MAAA,EACf;AAAA,IAAA,IAIFd,EAAK,SAAS,WAChBU,EAAkB,SAAS,SAAS;AAAA,MAClC,OAAOV,EAAK,SAAS,OAAO;AAAA,MAC5B,MAAMW,EAAY;AAAA,MAClB,MAAM;AAAA,QACJ,uBAAuBX,EAAK,SAAS,OAAO,KAAK;AAAA,QACjD,WAAWA,EAAK,SAAS,OAAO,KAAK,mBAAmB,IAAI,CAAUe,OAAA;AAAA,UACpE,aAAaA,EAAM;AAAA,UACnB,OAAOA,EAAM;AAAA,QAAA,EACb;AAAA,MACJ;AAAA,IAAA,KAKNjB,EAAmBY,CAAiB;AAAA,EAAA,GACnC,CAACV,GAAME,CAAW,CAAC,GAEf;AAAA,IACL,MAAML;AAAA,IACN,aAAAK;AAAA,IACA,sBAAAG;AAAA,IACA,6BAAAE;AAAA,IACA,GAAGJ;AAAA,EAAA;AAEP;"}
|
@@ -2,12 +2,12 @@ import { jsx as t, Fragment as O } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as p, useCallback as f, useMemo as le, useEffect as ce } from "react";
|
3
3
|
import z from "../../../../../assets/line-icons/icons/carat-right.js";
|
4
4
|
import { PLATFORM_EVENTS_STUDENT as ee } from "../../../../analytics-events/platform-events-student.js";
|
5
|
-
import { IndicatorType as
|
5
|
+
import { IndicatorType as a } from "../../../../journey/use-journey/constants.js";
|
6
6
|
import { useJourney as ae } from "../../../../journey/use-journey/use-journey.js";
|
7
7
|
import te from "../../../../ui/buttons/icon-button/icon-button.js";
|
8
8
|
import { useUIContext as de } from "../../../../ui/context/context.js";
|
9
9
|
import S from "../../../../ui/layout/flex-view.js";
|
10
|
-
import
|
10
|
+
import d from "../../../../ui/text/text.js";
|
11
11
|
import { CIRCLE_ONBOARDING_ANALYTICS_STEPS as _ } from "../../../enum/circle-onboarding-steps.js";
|
12
12
|
import { useCircleSounds as se } from "../../../hooks/use-circle-sounds/use-circle-sounds.js";
|
13
13
|
import { SegmentedGameCard as he } from "../../comps/segmented-game-card/segmented-game-card.js";
|
@@ -18,7 +18,7 @@ const ke = ({
|
|
18
18
|
carouselRefs: n,
|
19
19
|
onSegmentClick: b
|
20
20
|
}) => {
|
21
|
-
const o = p(null), r = p(null),
|
21
|
+
const o = p(null), r = p(null), l = p(null), C = p([]), L = p(!1), { playButtonSound: R } = se(), { nextCoachmark: s, setJourney: P, endJourney: N } = ae(), { onEvent: A } = de(), y = f(
|
22
22
|
(e) => {
|
23
23
|
A(ee.ONBOARDING_STEP_VIEWED, {
|
24
24
|
step: e
|
@@ -35,25 +35,25 @@ const ke = ({
|
|
35
35
|
), h = f(
|
36
36
|
(e, c, i, g, I = !1) => {
|
37
37
|
var u, T;
|
38
|
-
I || (R(), (T = n.current) == null || T.goToIndex(((u = n.current) == null ? void 0 : u.currentIndex) + 1),
|
38
|
+
I || (R(), (T = n.current) == null || T.goToIndex(((u = n.current) == null ? void 0 : u.currentIndex) + 1), s(g, !1, ge)), y(e);
|
39
39
|
const m = setTimeout(() => {
|
40
40
|
clearTimeout(m), c.startLabelAnimation(i);
|
41
41
|
}, me);
|
42
|
-
C.current.push(m),
|
42
|
+
C.current.push(m), s(g, !0, ue);
|
43
43
|
},
|
44
|
-
[n,
|
44
|
+
[n, s, R, y]
|
45
45
|
), G = f(
|
46
46
|
(e, c) => {
|
47
|
-
b(e, Ee.PUZZLE), H(_.PUZZLE_ACTIVITY),
|
47
|
+
b(e, Ee.PUZZLE), H(_.PUZZLE_ACTIVITY), N(c);
|
48
48
|
},
|
49
|
-
[N,
|
49
|
+
[N, b, H]
|
50
50
|
), k = f(
|
51
51
|
(e, c, i) => {
|
52
52
|
var Y, v, B, U, V, x, D, M, J, W, X, $, F, Z, K, q, Q, j;
|
53
53
|
if (L.current || !((Y = n == null ? void 0 : n.current) != null && Y.nextBtnRef.current) || !((v = r == null ? void 0 : r.current) != null && v.segmentedCardWrapperRef.current) || !((B = o == null ? void 0 : o.current) != null && B.labelRef.current) || !((U = r == null ? void 0 : r.current) != null && U.labelRef.current) || !e)
|
54
54
|
return;
|
55
55
|
L.current = !0;
|
56
|
-
const g = ((D = (x = (V =
|
56
|
+
const g = ((D = (x = (V = l.current) == null ? void 0 : V.labelRef) == null ? void 0 : x.current) == null ? void 0 : D.getBoundingClientRect()) || {
|
57
57
|
height: 0,
|
58
58
|
width: 0
|
59
59
|
}, I = ((W = (J = (M = o.current) == null ? void 0 : M.labelRef) == null ? void 0 : J.current) == null ? void 0 : W.getBoundingClientRect()) || {
|
@@ -67,17 +67,17 @@ const ke = ({
|
|
67
67
|
width: 0
|
68
68
|
};
|
69
69
|
let T = [];
|
70
|
-
c &&
|
70
|
+
c && l.current && (T = [
|
71
71
|
{
|
72
|
-
originalElementToHighlightRef:
|
72
|
+
originalElementToHighlightRef: l.current.labelRef,
|
73
73
|
isActive: !1,
|
74
|
-
type:
|
74
|
+
type: a.TOOLTIP,
|
75
75
|
elementToHighlight: /* @__PURE__ */ t(O, {}),
|
76
76
|
indicator: {
|
77
77
|
position: "right",
|
78
78
|
backgroundColor: "BLUE_4",
|
79
79
|
width: 264,
|
80
|
-
tooltipItem: /* @__PURE__ */ t(S, { children: /* @__PURE__ */ t(
|
80
|
+
tooltipItem: /* @__PURE__ */ t(S, { children: /* @__PURE__ */ t(d, { $renderAs: "ab2-bold", children: "Get faster & stay ahead in school. Practice 3 new skills everyday." }) }),
|
81
81
|
tooltipXCoOrdinates: g.width + 50,
|
82
82
|
tooltipYCoOrdinates: g.height / 2
|
83
83
|
}
|
@@ -85,7 +85,7 @@ const ke = ({
|
|
85
85
|
{
|
86
86
|
originalElementToHighlightRef: (Q = n.current) == null ? void 0 : Q.nextBtnRef,
|
87
87
|
isActive: !1,
|
88
|
-
type:
|
88
|
+
type: a.NUDGE,
|
89
89
|
elementToHighlight: /* @__PURE__ */ t(
|
90
90
|
te,
|
91
91
|
{
|
@@ -102,7 +102,7 @@ const ke = ({
|
|
102
102
|
),
|
103
103
|
indicator: {
|
104
104
|
nudge: "click",
|
105
|
-
content: /* @__PURE__ */ t(
|
105
|
+
content: /* @__PURE__ */ t(d, { $renderAs: "ab1", $color: "WHITE", children: "Click to proceed" }),
|
106
106
|
nudgePointerX: 0,
|
107
107
|
nudgePointerY: 0
|
108
108
|
}
|
@@ -112,13 +112,13 @@ const ke = ({
|
|
112
112
|
{
|
113
113
|
originalElementToHighlightRef: o.current.labelRef,
|
114
114
|
isActive: !1,
|
115
|
-
type:
|
115
|
+
type: a.TOOLTIP,
|
116
116
|
elementToHighlight: /* @__PURE__ */ t(O, {}),
|
117
117
|
indicator: {
|
118
118
|
position: "right",
|
119
119
|
backgroundColor: "ORANGE_4",
|
120
120
|
width: 264,
|
121
|
-
tooltipItem: /* @__PURE__ */ t(S, { children: /* @__PURE__ */ t(
|
121
|
+
tooltipItem: /* @__PURE__ */ t(S, { children: /* @__PURE__ */ t(d, { $renderAs: "ab2-bold", children: "Train to think deeper & plan ahead. Play 3 new games everyday." }) }),
|
122
122
|
tooltipXCoOrdinates: I.width + 50,
|
123
123
|
tooltipYCoOrdinates: I.height / 2
|
124
124
|
}
|
@@ -126,7 +126,7 @@ const ke = ({
|
|
126
126
|
{
|
127
127
|
originalElementToHighlightRef: n.current.nextBtnRef,
|
128
128
|
isActive: !1,
|
129
|
-
type:
|
129
|
+
type: a.NUDGE,
|
130
130
|
elementToHighlight: /* @__PURE__ */ t(
|
131
131
|
te,
|
132
132
|
{
|
@@ -143,7 +143,7 @@ const ke = ({
|
|
143
143
|
),
|
144
144
|
indicator: {
|
145
145
|
nudge: "click",
|
146
|
-
content: /* @__PURE__ */ t(
|
146
|
+
content: /* @__PURE__ */ t(d, { $renderAs: "ab1", $color: "WHITE", children: "Click to proceed" }),
|
147
147
|
nudgePointerX: 0,
|
148
148
|
nudgePointerY: 0
|
149
149
|
}
|
@@ -152,13 +152,13 @@ const ke = ({
|
|
152
152
|
{
|
153
153
|
originalElementToHighlightRef: r.current.labelRef,
|
154
154
|
isActive: !1,
|
155
|
-
type:
|
155
|
+
type: a.TOOLTIP,
|
156
156
|
elementToHighlight: /* @__PURE__ */ t(O, {}),
|
157
157
|
indicator: {
|
158
158
|
position: "right",
|
159
159
|
backgroundColor: "PURPLE_4",
|
160
160
|
width: 264,
|
161
|
-
tooltipItem: /* @__PURE__ */ t(S, { children: /* @__PURE__ */ t(
|
161
|
+
tooltipItem: /* @__PURE__ */ t(S, { children: /* @__PURE__ */ t(d, { $renderAs: "ab2-bold", children: "Think in new ways & stay sharp. Solve 3 new puzzles everyday." }) }),
|
162
162
|
tooltipXCoOrdinates: m.width + 50,
|
163
163
|
tooltipYCoOrdinates: m.height / 2
|
164
164
|
}
|
@@ -166,7 +166,7 @@ const ke = ({
|
|
166
166
|
{
|
167
167
|
originalElementToHighlightRef: r.current.segmentedCardWrapperRef,
|
168
168
|
isActive: !1,
|
169
|
-
type:
|
169
|
+
type: a.NUDGE,
|
170
170
|
elementToHighlight: /* @__PURE__ */ t(
|
171
171
|
he,
|
172
172
|
{
|
@@ -185,7 +185,7 @@ const ke = ({
|
|
185
185
|
),
|
186
186
|
indicator: {
|
187
187
|
nudge: "click",
|
188
|
-
content: /* @__PURE__ */ t(
|
188
|
+
content: /* @__PURE__ */ t(d, { $renderAs: "ab1", $color: "WHITE", children: "Click to solve a puzzle" }),
|
189
189
|
nudgePointerX: u.width * 0.6,
|
190
190
|
nudgePointerY: u.height * 0.4
|
191
191
|
}
|
@@ -193,16 +193,16 @@ const ke = ({
|
|
193
193
|
];
|
194
194
|
P(i, [...T, ...ie, ...oe]), (j = n.current) == null || j.goToIndex(0);
|
195
195
|
const w = setTimeout(() => {
|
196
|
-
clearTimeout(w),
|
196
|
+
clearTimeout(w), s(i);
|
197
197
|
}, Te);
|
198
|
-
C.current.push(w), c &&
|
198
|
+
C.current.push(w), c && l.current ? h(_.SKILL_ACTIVITY, l.current, "BLUE_4", i, !0) : h(_.GAMES_ACTIVITY, o.current, "ORANGE_4", i, !0);
|
199
199
|
},
|
200
|
-
[n, G, h,
|
200
|
+
[n, G, h, s, P]
|
201
201
|
), ne = le(
|
202
202
|
() => ({
|
203
203
|
gameRefs: o,
|
204
204
|
puzzleRefs: r,
|
205
|
-
lessonRefs:
|
205
|
+
lessonRefs: l,
|
206
206
|
startJourney: k
|
207
207
|
}),
|
208
208
|
[k]
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-game-launcher-journey.js","sources":["../../../../../../src/features/circle-games/game-launcher/hooks/use-game-launcher-journey/use-game-launcher-journey.tsx"],"sourcesContent":["import type { TJourneyId } from '../../../../journey/journey-id/journey-id-types';\nimport type { ICoachmarkProps } from '../../../../journey/use-journey/journey-context-types';\nimport type { IArrowTooltipProps } from '../../../../ui/arrow-tooltip/arrow-tooltip-types';\nimport type { INudgeProps } from '../../../../ui/nudge/nudge-types';\nimport type { TColorNames } from '../../../../ui/types';\nimport type { ISegmentedGameCardRefs } from '../../comps/segmented-game-card/segmented-game-card-types';\nimport type {\n IProject,\n Puzzle,\n} from '../../dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport type { IUseGameLauncherJourneyProps } from './use-game-launcher-journey-types';\n\nimport { useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport CaratRightIcon from '../../../../../assets/line-icons/icons/carat-right';\nimport { PLATFORM_EVENTS_STUDENT as AnalyticsLabel } from '../../../../analytics-events/platform-events-student';\nimport { IndicatorType } from '../../../../journey/use-journey/constants';\nimport { useJourney } from '../../../../journey/use-journey/use-journey';\nimport IconButton from '../../../../ui/buttons/icon-button/icon-button';\nimport { useUIContext } from '../../../../ui/context/context';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport { CIRCLE_ONBOARDING_ANALYTICS_STEPS as ActionEvent } from '../../../enum/circle-onboarding-steps';\nimport { ProjectType } from '../../../games/web-view/enums';\nimport { useCircleSounds } from '../../../hooks/use-circle-sounds/use-circle-sounds';\nimport { SegmentedGameCard } from '../../comps/segmented-game-card/segmented-game-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from '../../game-launcher-analytics-events';\nimport {\n GO_TO_NEXT_SLIDE_AFTER_MS,\n SHOW_LABEL_HIGHLIGHT_AFTER_MS,\n SHOW_NUDGE_AFTER_MS,\n SLIDE_TO_LESSON_MS,\n} from './constants';\n\nexport const useGameLauncherJourney = ({\n carouselRefs,\n onSegmentClick,\n}: IUseGameLauncherJourneyProps) => {\n const gameRefs = useRef<ISegmentedGameCardRefs>(null);\n const puzzleRefs = useRef<ISegmentedGameCardRefs>(null);\n const lessonRefs = useRef<ISegmentedGameCardRefs>(null);\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const isJourneyInProgress = useRef(false);\n\n const { playButtonSound } = useCircleSounds();\n const { nextCoachmark, setJourney, endJourney } = useJourney();\n const { onEvent: trackAnalytics } = useUIContext();\n\n const trackEventViewed = useCallback(\n (step: ActionEvent) => {\n trackAnalytics(AnalyticsLabel.ONBOARDING_STEP_VIEWED, {\n step,\n });\n },\n [trackAnalytics],\n );\n const trackEventCompleted = useCallback(\n (step: ActionEvent) => {\n trackAnalytics(AnalyticsLabel.ONBOARDING_STEP_COMPLETED, {\n step,\n });\n },\n [trackAnalytics],\n );\n\n const goToNextCard = useCallback(\n (\n analyticsLabelViewed: ActionEvent,\n refOfNextSlide: ISegmentedGameCardRefs,\n color: TColorNames,\n journeyId: TJourneyId,\n isFirstSlide: boolean = false,\n ) => {\n if (!isFirstSlide) {\n playButtonSound();\n carouselRefs.current?.goToIndex(carouselRefs.current?.currentIndex + 1);\n nextCoachmark(journeyId, false, GO_TO_NEXT_SLIDE_AFTER_MS);\n }\n\n trackEventViewed(analyticsLabelViewed);\n\n const animateLabelTimer = setTimeout(() => {\n clearTimeout(animateLabelTimer);\n refOfNextSlide.startLabelAnimation(color);\n }, SHOW_LABEL_HIGHLIGHT_AFTER_MS);\n\n timerRefs.current.push(animateLabelTimer); // Store to cleanup later\n\n nextCoachmark(journeyId, true, SHOW_NUDGE_AFTER_MS);\n },\n [carouselRefs, nextCoachmark, playButtonSound, trackEventViewed],\n );\n\n const handleEndJourney = useCallback(\n (puzzlesData: Puzzle, journeyId: TJourneyId) => {\n onSegmentClick(puzzlesData, ProjectType.PUZZLE);\n trackEventCompleted(ActionEvent.PUZZLE_ACTIVITY);\n nextCoachmark(journeyId);\n endJourney(journeyId);\n },\n [endJourney, nextCoachmark, onSegmentClick, trackEventCompleted],\n );\n\n const startJourney = useCallback(\n (puzzlesData: IProject<Puzzle>, isLessonAvailable: boolean, journeyId: TJourneyId) => {\n if (isJourneyInProgress.current) {\n return;\n }\n\n // If element refs are not available return, this is just for type safety\n if (\n !carouselRefs?.current?.nextBtnRef.current ||\n !puzzleRefs?.current?.segmentedCardWrapperRef.current ||\n !gameRefs?.current?.labelRef.current ||\n !puzzleRefs?.current?.labelRef.current ||\n !puzzlesData\n ) {\n return;\n }\n\n isJourneyInProgress.current = true;\n const lessonLabelDims = lessonRefs.current?.labelRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n const gameLabelDims = gameRefs.current?.labelRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n const puzzleLabelDims = puzzleRefs.current?.labelRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n\n const launcherDims =\n puzzleRefs.current?.segmentedCardWrapperRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n\n let lessonSteps: ICoachmarkProps[] = [];\n\n if (isLessonAvailable && lessonRefs.current) {\n lessonSteps = [\n {\n originalElementToHighlightRef: lessonRefs.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'BLUE_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Get faster & stay ahead in school. Practice 3 new skills everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: lessonLabelDims.width + 50,\n tooltipYCoOrdinates: lessonLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: carouselRefs.current?.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={() =>\n goToNextCard(\n ActionEvent.GAMES_ACTIVITY,\n gameRefs.current as ISegmentedGameCardRefs,\n 'ORANGE_4',\n journeyId,\n )\n }\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to proceed\n </Text>\n ),\n nudgePointerX: 0,\n nudgePointerY: 0,\n } as INudgeProps,\n },\n ];\n }\n\n const gameSteps: ICoachmarkProps[] = [\n {\n originalElementToHighlightRef: gameRefs.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'ORANGE_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Train to think deeper & plan ahead. Play 3 new games everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: gameLabelDims.width + 50,\n tooltipYCoOrdinates: gameLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: carouselRefs.current.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={() =>\n goToNextCard(\n ActionEvent.PUZZLE_ACTIVITY,\n puzzleRefs.current as ISegmentedGameCardRefs,\n 'PURPLE_4',\n journeyId,\n )\n }\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to proceed\n </Text>\n ),\n nudgePointerX: 0,\n nudgePointerY: 0,\n } as INudgeProps,\n },\n ];\n\n const puzzleSteps: ICoachmarkProps[] = [\n {\n originalElementToHighlightRef: puzzleRefs.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'PURPLE_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Think in new ways & stay sharp. Solve 3 new puzzles everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: puzzleLabelDims.width + 50,\n tooltipYCoOrdinates: puzzleLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: puzzleRefs.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <SegmentedGameCard\n label={''} // This is intentionally left blank to avoid showing the label\n value={puzzlesData.data.filter(puzzle => puzzle.solved).length}\n maxValue={puzzlesData.data.length}\n initialValue={puzzlesData.initialProgressValue}\n data={puzzlesData.data.map(puzzle => ({\n card: puzzle.cardLottie,\n name: '', // We dont want to show the name of the puzzle in onboarding\n isCompleted: puzzle.solved,\n onPress: () => handleEndJourney(puzzle, journeyId),\n }))}\n />\n ),\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to solve a puzzle\n </Text>\n ),\n nudgePointerX: launcherDims.width * 0.6,\n nudgePointerY: launcherDims.height * 0.4,\n } as INudgeProps,\n },\n ];\n\n setJourney(journeyId, [...lessonSteps, ...gameSteps, ...puzzleSteps]);\n\n carouselRefs.current?.goToIndex(0); // Always start from 0th Index no matter what the current index is\n\n const delayBeforeStart = setTimeout(() => {\n clearTimeout(delayBeforeStart);\n nextCoachmark(journeyId);\n }, SLIDE_TO_LESSON_MS);\n\n timerRefs.current.push(delayBeforeStart); // Store to cleanup later\n\n if (isLessonAvailable && lessonRefs.current) {\n goToNextCard(ActionEvent.SKILL_ACTIVITY, lessonRefs.current, 'BLUE_4', journeyId, true);\n } else {\n goToNextCard(ActionEvent.GAMES_ACTIVITY, gameRefs.current, 'ORANGE_4', journeyId, true);\n }\n },\n [carouselRefs, handleEndJourney, goToNextCard, nextCoachmark, setJourney],\n );\n\n const data = useMemo(\n () => ({\n gameRefs,\n puzzleRefs,\n lessonRefs,\n startJourney,\n }),\n [startJourney],\n );\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n timerRefs.current.forEach(timer => clearTimeout(timer));\n timerRefs.current = [];\n isJourneyInProgress.current = false;\n };\n }, [carouselRefs]);\n\n return data;\n};\n"],"names":["useGameLauncherJourney","carouselRefs","onSegmentClick","gameRefs","useRef","puzzleRefs","lessonRefs","timerRefs","isJourneyInProgress","playButtonSound","useCircleSounds","nextCoachmark","setJourney","endJourney","useJourney","trackAnalytics","useUIContext","trackEventViewed","useCallback","step","AnalyticsLabel","trackEventCompleted","goToNextCard","analyticsLabelViewed","refOfNextSlide","color","journeyId","isFirstSlide","_b","_a","GO_TO_NEXT_SLIDE_AFTER_MS","animateLabelTimer","SHOW_LABEL_HIGHLIGHT_AFTER_MS","SHOW_NUDGE_AFTER_MS","handleEndJourney","puzzlesData","ProjectType","ActionEvent","startJourney","isLessonAvailable","_c","_d","lessonLabelDims","_g","_f","_e","gameLabelDims","_j","_i","_h","puzzleLabelDims","_m","_l","_k","launcherDims","_p","_o","_n","lessonSteps","IndicatorType","jsx","Fragment","FlexView","Text","_q","IconButton","CaratRightIcon","GAME_LAUNCHER_ANALYTICS_EVENTS","gameSteps","puzzleSteps","SegmentedGameCard","puzzle","_r","delayBeforeStart","SLIDE_TO_LESSON_MS","data","useMemo","useEffect","timer"],"mappings":";;;;;;;;;;;;;;;;AAkCO,MAAMA,KAAyB,CAAC;AAAA,EACrC,cAAAC;AAAA,EACA,gBAAAC;AACF,MAAoC;AAC5B,QAAAC,IAAWC,EAA+B,IAAI,GAC9CC,IAAaD,EAA+B,IAAI,GAChDE,IAAaF,EAA+B,IAAI,GAChDG,IAAYH,EAAwC,CAAA,CAAE,GAEtDI,IAAsBJ,EAAO,EAAK,GAElC,EAAE,iBAAAK,MAAoBC,MACtB,EAAE,eAAAC,GAAe,YAAAC,GAAY,YAAAC,MAAeC,GAAW,GACvD,EAAE,SAASC,EAAe,IAAIC,GAAa,GAE3CC,IAAmBC;AAAA,IACvB,CAACC,MAAsB;AACrB,MAAAJ,EAAeK,GAAe,wBAAwB;AAAA,QACpD,MAAAD;AAAA,MAAA,CACD;AAAA,IACH;AAAA,IACA,CAACJ,CAAc;AAAA,EAAA,GAEXM,IAAsBH;AAAA,IAC1B,CAACC,MAAsB;AACrB,MAAAJ,EAAeK,GAAe,2BAA2B;AAAA,QACvD,MAAAD;AAAA,MAAA,CACD;AAAA,IACH;AAAA,IACA,CAACJ,CAAc;AAAA,EAAA,GAGXO,IAAeJ;AAAA,IACnB,CACEK,GACAC,GACAC,GACAC,GACAC,IAAwB,OACrB;;AACH,MAAKA,MACalB,MAChBmB,IAAA3B,EAAa,YAAb,QAAA2B,EAAsB,YAAUC,IAAA5B,EAAa,YAAb,gBAAA4B,EAAsB,gBAAe,IACvDlB,EAAAe,GAAW,IAAOI,EAAyB,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,EAAA,QAAQ,KAAKkE,CAAgB,GAEnClC,KAAqBjC,EAAW,UAClCgB,EAAae,EAAY,gBAAgB/B,EAAW,SAAS,UAAUoB,GAAW,EAAI,IAEtFJ,EAAae,EAAY,gBAAgBlC,EAAS,SAAS,YAAYuB,GAAW,EAAI;AAAA,IAE1F;AAAA,IACA,CAACzB,GAAciC,GAAkBZ,GAAcX,GAAeC,CAAU;AAAA,EAAA,GAGpE+D,KAAOC;AAAA,IACX,OAAO;AAAA,MACL,UAAAzE;AAAA,MACA,YAAAE;AAAA,MACA,YAAAC;AAAA,MACA,cAAAgC;AAAA,IAAA;AAAA,IAEF,CAACA,CAAY;AAAA,EAAA;AAIf,SAAAuC,GAAU,MACD,MAAM;AACX,IAAAtE,EAAU,QAAQ,QAAQ,CAASuE,MAAA,aAAaA,CAAK,CAAC,GACtDvE,EAAU,UAAU,IACpBC,EAAoB,UAAU;AAAA,EAAA,GAE/B,CAACP,CAAY,CAAC,GAEV0E;AACT;"}
|
1
|
+
{"version":3,"file":"use-game-launcher-journey.js","sources":["../../../../../../src/features/circle-games/game-launcher/hooks/use-game-launcher-journey/use-game-launcher-journey.tsx"],"sourcesContent":["import type { TJourneyId } from '../../../../journey/journey-id/journey-id-types';\nimport type { ICoachmarkProps } from '../../../../journey/use-journey/journey-context-types';\nimport type { IArrowTooltipProps } from '../../../../ui/arrow-tooltip/arrow-tooltip-types';\nimport type { INudgeProps } from '../../../../ui/nudge/nudge-types';\nimport type { TColorNames } from '../../../../ui/types';\nimport type { ISegmentedGameCardRefs } from '../../comps/segmented-game-card/segmented-game-card-types';\nimport type {\n IProject,\n Puzzle,\n} from '../../dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport type { IUseGameLauncherJourneyProps } from './use-game-launcher-journey-types';\n\nimport { useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport CaratRightIcon from '../../../../../assets/line-icons/icons/carat-right';\nimport { PLATFORM_EVENTS_STUDENT as AnalyticsLabel } from '../../../../analytics-events/platform-events-student';\nimport { IndicatorType } from '../../../../journey/use-journey/constants';\nimport { useJourney } from '../../../../journey/use-journey/use-journey';\nimport IconButton from '../../../../ui/buttons/icon-button/icon-button';\nimport { useUIContext } from '../../../../ui/context/context';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport { CIRCLE_ONBOARDING_ANALYTICS_STEPS as ActionEvent } from '../../../enum/circle-onboarding-steps';\nimport { ProjectType } from '../../../games/web-view/enums';\nimport { useCircleSounds } from '../../../hooks/use-circle-sounds/use-circle-sounds';\nimport { SegmentedGameCard } from '../../comps/segmented-game-card/segmented-game-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from '../../game-launcher-analytics-events';\nimport {\n GO_TO_NEXT_SLIDE_AFTER_MS,\n SHOW_LABEL_HIGHLIGHT_AFTER_MS,\n SHOW_NUDGE_AFTER_MS,\n SLIDE_TO_LESSON_MS,\n} from './constants';\n\nexport const useGameLauncherJourney = ({\n carouselRefs,\n onSegmentClick,\n}: IUseGameLauncherJourneyProps) => {\n const gameRefs = useRef<ISegmentedGameCardRefs>(null);\n const puzzleRefs = useRef<ISegmentedGameCardRefs>(null);\n const lessonRefs = useRef<ISegmentedGameCardRefs>(null);\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const isJourneyInProgress = useRef(false);\n\n const { playButtonSound } = useCircleSounds();\n const { nextCoachmark, setJourney, endJourney } = useJourney();\n const { onEvent: trackAnalytics } = useUIContext();\n\n const trackEventViewed = useCallback(\n (step: ActionEvent) => {\n trackAnalytics(AnalyticsLabel.ONBOARDING_STEP_VIEWED, {\n step,\n });\n },\n [trackAnalytics],\n );\n const trackEventCompleted = useCallback(\n (step: ActionEvent) => {\n trackAnalytics(AnalyticsLabel.ONBOARDING_STEP_COMPLETED, {\n step,\n });\n },\n [trackAnalytics],\n );\n\n const goToNextCard = useCallback(\n (\n analyticsLabelViewed: ActionEvent,\n refOfNextSlide: ISegmentedGameCardRefs,\n color: TColorNames,\n journeyId: TJourneyId,\n isFirstSlide: boolean = false,\n ) => {\n if (!isFirstSlide) {\n playButtonSound();\n carouselRefs.current?.goToIndex(carouselRefs.current?.currentIndex + 1);\n nextCoachmark(journeyId, false, GO_TO_NEXT_SLIDE_AFTER_MS);\n }\n\n trackEventViewed(analyticsLabelViewed);\n\n const animateLabelTimer = setTimeout(() => {\n clearTimeout(animateLabelTimer);\n refOfNextSlide.startLabelAnimation(color);\n }, SHOW_LABEL_HIGHLIGHT_AFTER_MS);\n\n timerRefs.current.push(animateLabelTimer); // Store to cleanup later\n\n nextCoachmark(journeyId, true, SHOW_NUDGE_AFTER_MS);\n },\n [carouselRefs, nextCoachmark, playButtonSound, trackEventViewed],\n );\n\n const handleEndJourney = useCallback(\n (puzzlesData: Puzzle, journeyId: TJourneyId) => {\n onSegmentClick(puzzlesData, ProjectType.PUZZLE);\n trackEventCompleted(ActionEvent.PUZZLE_ACTIVITY);\n endJourney(journeyId);\n },\n [endJourney, onSegmentClick, trackEventCompleted],\n );\n\n const startJourney = useCallback(\n (puzzlesData: IProject<Puzzle>, isLessonAvailable: boolean, journeyId: TJourneyId) => {\n if (isJourneyInProgress.current) {\n return;\n }\n\n // If element refs are not available return, this is just for type safety\n if (\n !carouselRefs?.current?.nextBtnRef.current ||\n !puzzleRefs?.current?.segmentedCardWrapperRef.current ||\n !gameRefs?.current?.labelRef.current ||\n !puzzleRefs?.current?.labelRef.current ||\n !puzzlesData\n ) {\n return;\n }\n\n isJourneyInProgress.current = true;\n const lessonLabelDims = lessonRefs.current?.labelRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n const gameLabelDims = gameRefs.current?.labelRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n const puzzleLabelDims = puzzleRefs.current?.labelRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n\n const launcherDims =\n puzzleRefs.current?.segmentedCardWrapperRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n\n let lessonSteps: ICoachmarkProps[] = [];\n\n if (isLessonAvailable && lessonRefs.current) {\n lessonSteps = [\n {\n originalElementToHighlightRef: lessonRefs.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'BLUE_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Get faster & stay ahead in school. Practice 3 new skills everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: lessonLabelDims.width + 50,\n tooltipYCoOrdinates: lessonLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: carouselRefs.current?.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={() =>\n goToNextCard(\n ActionEvent.GAMES_ACTIVITY,\n gameRefs.current as ISegmentedGameCardRefs,\n 'ORANGE_4',\n journeyId,\n )\n }\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to proceed\n </Text>\n ),\n nudgePointerX: 0,\n nudgePointerY: 0,\n } as INudgeProps,\n },\n ];\n }\n\n const gameSteps: ICoachmarkProps[] = [\n {\n originalElementToHighlightRef: gameRefs.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'ORANGE_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Train to think deeper & plan ahead. Play 3 new games everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: gameLabelDims.width + 50,\n tooltipYCoOrdinates: gameLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: carouselRefs.current.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={() =>\n goToNextCard(\n ActionEvent.PUZZLE_ACTIVITY,\n puzzleRefs.current as ISegmentedGameCardRefs,\n 'PURPLE_4',\n journeyId,\n )\n }\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to proceed\n </Text>\n ),\n nudgePointerX: 0,\n nudgePointerY: 0,\n } as INudgeProps,\n },\n ];\n\n const puzzleSteps: ICoachmarkProps[] = [\n {\n originalElementToHighlightRef: puzzleRefs.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'PURPLE_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Think in new ways & stay sharp. Solve 3 new puzzles everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: puzzleLabelDims.width + 50,\n tooltipYCoOrdinates: puzzleLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: puzzleRefs.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <SegmentedGameCard\n label={''} // This is intentionally left blank to avoid showing the label\n value={puzzlesData.data.filter(puzzle => puzzle.solved).length}\n maxValue={puzzlesData.data.length}\n initialValue={puzzlesData.initialProgressValue}\n data={puzzlesData.data.map(puzzle => ({\n card: puzzle.cardLottie,\n name: '', // We dont want to show the name of the puzzle in onboarding\n isCompleted: puzzle.solved,\n onPress: () => handleEndJourney(puzzle, journeyId),\n }))}\n />\n ),\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to solve a puzzle\n </Text>\n ),\n nudgePointerX: launcherDims.width * 0.6,\n nudgePointerY: launcherDims.height * 0.4,\n } as INudgeProps,\n },\n ];\n\n setJourney(journeyId, [...lessonSteps, ...gameSteps, ...puzzleSteps]);\n\n carouselRefs.current?.goToIndex(0); // Always start from 0th Index no matter what the current index is\n\n const delayBeforeStart = setTimeout(() => {\n clearTimeout(delayBeforeStart);\n nextCoachmark(journeyId);\n }, SLIDE_TO_LESSON_MS);\n\n timerRefs.current.push(delayBeforeStart); // Store to cleanup later\n\n if (isLessonAvailable && lessonRefs.current) {\n goToNextCard(ActionEvent.SKILL_ACTIVITY, lessonRefs.current, 'BLUE_4', journeyId, true);\n } else {\n goToNextCard(ActionEvent.GAMES_ACTIVITY, gameRefs.current, 'ORANGE_4', journeyId, true);\n }\n },\n [carouselRefs, handleEndJourney, goToNextCard, nextCoachmark, setJourney],\n );\n\n const data = useMemo(\n () => ({\n gameRefs,\n puzzleRefs,\n lessonRefs,\n startJourney,\n }),\n [startJourney],\n );\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n timerRefs.current.forEach(timer => clearTimeout(timer));\n timerRefs.current = [];\n isJourneyInProgress.current = false;\n };\n }, [carouselRefs]);\n\n return data;\n};\n"],"names":["useGameLauncherJourney","carouselRefs","onSegmentClick","gameRefs","useRef","puzzleRefs","lessonRefs","timerRefs","isJourneyInProgress","playButtonSound","useCircleSounds","nextCoachmark","setJourney","endJourney","useJourney","trackAnalytics","useUIContext","trackEventViewed","useCallback","step","AnalyticsLabel","trackEventCompleted","goToNextCard","analyticsLabelViewed","refOfNextSlide","color","journeyId","isFirstSlide","_b","_a","GO_TO_NEXT_SLIDE_AFTER_MS","animateLabelTimer","SHOW_LABEL_HIGHLIGHT_AFTER_MS","SHOW_NUDGE_AFTER_MS","handleEndJourney","puzzlesData","ProjectType","ActionEvent","startJourney","isLessonAvailable","_c","_d","lessonLabelDims","_g","_f","_e","gameLabelDims","_j","_i","_h","puzzleLabelDims","_m","_l","_k","launcherDims","_p","_o","_n","lessonSteps","IndicatorType","jsx","Fragment","FlexView","Text","_q","IconButton","CaratRightIcon","GAME_LAUNCHER_ANALYTICS_EVENTS","gameSteps","puzzleSteps","SegmentedGameCard","puzzle","_r","delayBeforeStart","SLIDE_TO_LESSON_MS","data","useMemo","useEffect","timer"],"mappings":";;;;;;;;;;;;;;;;AAkCO,MAAMA,KAAyB,CAAC;AAAA,EACrC,cAAAC;AAAA,EACA,gBAAAC;AACF,MAAoC;AAC5B,QAAAC,IAAWC,EAA+B,IAAI,GAC9CC,IAAaD,EAA+B,IAAI,GAChDE,IAAaF,EAA+B,IAAI,GAChDG,IAAYH,EAAwC,CAAA,CAAE,GAEtDI,IAAsBJ,EAAO,EAAK,GAElC,EAAE,iBAAAK,MAAoBC,MACtB,EAAE,eAAAC,GAAe,YAAAC,GAAY,YAAAC,MAAeC,GAAW,GACvD,EAAE,SAASC,EAAe,IAAIC,GAAa,GAE3CC,IAAmBC;AAAA,IACvB,CAACC,MAAsB;AACrB,MAAAJ,EAAeK,GAAe,wBAAwB;AAAA,QACpD,MAAAD;AAAA,MAAA,CACD;AAAA,IACH;AAAA,IACA,CAACJ,CAAc;AAAA,EAAA,GAEXM,IAAsBH;AAAA,IAC1B,CAACC,MAAsB;AACrB,MAAAJ,EAAeK,GAAe,2BAA2B;AAAA,QACvD,MAAAD;AAAA,MAAA,CACD;AAAA,IACH;AAAA,IACA,CAACJ,CAAc;AAAA,EAAA,GAGXO,IAAeJ;AAAA,IACnB,CACEK,GACAC,GACAC,GACAC,GACAC,IAAwB,OACrB;;AACH,MAAKA,MACalB,MAChBmB,IAAA3B,EAAa,YAAb,QAAA2B,EAAsB,YAAUC,IAAA5B,EAAa,YAAb,gBAAA4B,EAAsB,gBAAe,IACvDlB,EAAAe,GAAW,IAAOI,EAAyB,IAG3Db,EAAiBM,CAAoB;AAE/B,YAAAQ,IAAoB,WAAW,MAAM;AACzC,qBAAaA,CAAiB,GAC9BP,EAAe,oBAAoB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