@cuemath/leap 3.1.53-akm-1 → 3.1.53
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/game-launcher.js +96 -108
- 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 +70 -71
- package/dist/features/circle-games/game-launcher/hooks/use-game-launcher-journey/use-game-launcher-journey.js.map +1 -1
- package/dist/features/journey/journey-id/journey-id-student.js +1 -1
- package/dist/features/journey/journey-id/journey-id-student.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/package.json +1 -1
- package/dist/features/circle-games/game-launcher/hooks/use-game-launcher-lessons-journey/constants.js +0 -6
- package/dist/features/circle-games/game-launcher/hooks/use-game-launcher-lessons-journey/constants.js.map +0 -1
- package/dist/features/circle-games/game-launcher/hooks/use-game-launcher-lessons-journey/use-game-launcher-lessons-journey.js +0 -124
- package/dist/features/circle-games/game-launcher/hooks/use-game-launcher-lessons-journey/use-game-launcher-lessons-journey.js.map +0 -1
|
@@ -1,87 +1,82 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { memo as g, useRef as
|
|
3
|
-
import { LOTTIE as
|
|
4
|
-
import { JOURNEY_ID_STUDENT as
|
|
5
|
-
import { useJourney as
|
|
6
|
-
import { CircularLoader as
|
|
7
|
-
import
|
|
8
|
-
import { useCircleSounds as
|
|
2
|
+
import { memo as g, useRef as J, useCallback as n, useMemo as V, useEffect as Y } from "react";
|
|
3
|
+
import { LOTTIE as B } from "../../../assets/lottie/lottie.js";
|
|
4
|
+
import { JOURNEY_ID_STUDENT as _ } from "../../journey/journey-id/journey-id-student.js";
|
|
5
|
+
import { useJourney as K } from "../../journey/use-journey/use-journey.js";
|
|
6
|
+
import { CircularLoader as H } from "../../ui/loader/circular-loader/circular-loader.js";
|
|
7
|
+
import Z from "../../ui/lottie-animation/lottie-animation.js";
|
|
8
|
+
import { useCircleSounds as w } from "../hooks/use-circle-sounds/use-circle-sounds.js";
|
|
9
9
|
import { CircleSoundKey as t } from "../hooks/use-circle-sounds/use-circle-sounds-enums.js";
|
|
10
|
-
import { GAME_LAUNCHER_SIZE as
|
|
11
|
-
import { Carousel as
|
|
12
|
-
import { GAME_LAUNCHER_ASSET_PADDING as
|
|
13
|
-
import { SegmentedGameCard as
|
|
14
|
-
import { TablesCard as
|
|
15
|
-
import { GAME_LAUNCHER_ANALYTICS_EVENTS as
|
|
16
|
-
import { useGameLauncherJourney as
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
const U = X + q, Ae = g(
|
|
10
|
+
import { GAME_LAUNCHER_SIZE as F } from "./comps/card-container/constants.js";
|
|
11
|
+
import { Carousel as M } from "./comps/carousel/carousel.js";
|
|
12
|
+
import { GAME_LAUNCHER_ASSET_PADDING as X } from "./comps/segmented-game-card/constants.js";
|
|
13
|
+
import { SegmentedGameCard as a } from "./comps/segmented-game-card/segmented-game-card.js";
|
|
14
|
+
import { TablesCard as q } from "./comps/tables-card/tables-card.js";
|
|
15
|
+
import { GAME_LAUNCHER_ANALYTICS_EVENTS as S } from "./game-launcher-analytics-events.js";
|
|
16
|
+
import { useGameLauncherJourney as Q } from "./hooks/use-game-launcher-journey/use-game-launcher-journey.js";
|
|
17
|
+
import { useTableInfiniteLauncherJourney as W } from "./hooks/use-table-infinite-launcher-journey/use-table-infinite-launcher-journey.js";
|
|
18
|
+
import { useTableLauncherJourney as $ } from "./hooks/use-table-launcher-journey/use-table-launcher-journey.js";
|
|
19
|
+
import { ProjectType as m } from "../games/web-view/enums/project-type-enum.js";
|
|
20
|
+
const O = F + X, _e = g(
|
|
22
21
|
({
|
|
23
22
|
onSegmentClick: l,
|
|
24
|
-
journeyId:
|
|
23
|
+
journeyId: u,
|
|
25
24
|
data: e,
|
|
26
|
-
isLoading:
|
|
27
|
-
isTutorialOnboardingDone:
|
|
25
|
+
isLoading: c,
|
|
26
|
+
isTutorialOnboardingDone: b,
|
|
28
27
|
defaultIndex: v = 0,
|
|
29
|
-
onJourneyComplete:
|
|
28
|
+
onJourneyComplete: p
|
|
30
29
|
}) => {
|
|
31
|
-
const
|
|
30
|
+
const f = J(null), E = J(null), { isJourneyActive: C } = K(), { playSwipeSound: A, play: o } = w(), L = n(
|
|
32
31
|
(r) => {
|
|
33
|
-
o(t.GAME_CARD_CLICK), l(r,
|
|
32
|
+
o(t.GAME_CARD_CLICK), l(r, m.TABLE);
|
|
34
33
|
},
|
|
35
34
|
[l, o]
|
|
36
|
-
), x =
|
|
37
|
-
o(t.GAME_CARD_CLICK), l({ mode: "infinite" },
|
|
38
|
-
}, [l, o]),
|
|
35
|
+
), x = n(() => {
|
|
36
|
+
o(t.GAME_CARD_CLICK), l({ mode: "infinite" }, m.TABLE);
|
|
37
|
+
}, [l, o]), I = n(
|
|
39
38
|
(r) => {
|
|
40
|
-
r.status !== "completed" && (o(t.GAME_CARD_CLICK), l(r,
|
|
39
|
+
r.status !== "completed" && (o(t.GAME_CARD_CLICK), l(r, m.LESSON));
|
|
41
40
|
},
|
|
42
41
|
[l, o]
|
|
43
|
-
),
|
|
42
|
+
), R = n(
|
|
44
43
|
(r) => {
|
|
45
|
-
o(t.GAME_CARD_CLICK), l(r,
|
|
44
|
+
o(t.GAME_CARD_CLICK), l(r, m.GAME);
|
|
46
45
|
},
|
|
47
46
|
[l, o]
|
|
48
|
-
),
|
|
47
|
+
), y = n(
|
|
49
48
|
(r) => {
|
|
50
|
-
o(t.GAME_CARD_CLICK), l(r,
|
|
49
|
+
o(t.GAME_CARD_CLICK), l(r, m.PUZZLE);
|
|
51
50
|
},
|
|
52
51
|
[l, o]
|
|
53
52
|
), {
|
|
54
|
-
gameRefs:
|
|
55
|
-
|
|
53
|
+
gameRefs: N,
|
|
54
|
+
lessonRefs: P,
|
|
55
|
+
puzzleRefs: h,
|
|
56
56
|
startJourney: G
|
|
57
|
-
} =
|
|
58
|
-
carouselRefs:
|
|
57
|
+
} = Q({
|
|
58
|
+
carouselRefs: f,
|
|
59
59
|
onSegmentClick: l,
|
|
60
|
-
onJourneyComplete:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
onSegmentClick: l,
|
|
64
|
-
onJourneyComplete: f,
|
|
65
|
-
lessonRefs: p
|
|
66
|
-
}), { startJourney: b } = j({
|
|
67
|
-
carouselRefs: c,
|
|
60
|
+
onJourneyComplete: p
|
|
61
|
+
}), { startJourney: T } = W({
|
|
62
|
+
carouselRefs: f,
|
|
68
63
|
onTableInfiniteModeClick: x,
|
|
69
|
-
onJourneyComplete:
|
|
70
|
-
originalTableRef:
|
|
71
|
-
}), { startJourney:
|
|
72
|
-
carouselRefs:
|
|
73
|
-
originalTableRef:
|
|
74
|
-
onTableSegmentClick:
|
|
75
|
-
onJourneyComplete:
|
|
76
|
-
onNextJourney:
|
|
77
|
-
}), D =
|
|
64
|
+
onJourneyComplete: p,
|
|
65
|
+
originalTableRef: E
|
|
66
|
+
}), { startJourney: z } = $({
|
|
67
|
+
carouselRefs: f,
|
|
68
|
+
originalTableRef: E,
|
|
69
|
+
onTableSegmentClick: L,
|
|
70
|
+
onJourneyComplete: p,
|
|
71
|
+
onNextJourney: T
|
|
72
|
+
}), D = V(() => {
|
|
78
73
|
let r = [];
|
|
79
74
|
return e && (e.lessons && (r = [
|
|
80
75
|
...r,
|
|
81
76
|
/* @__PURE__ */ i(
|
|
82
|
-
|
|
77
|
+
a,
|
|
83
78
|
{
|
|
84
|
-
ref:
|
|
79
|
+
ref: P,
|
|
85
80
|
label: e.lessons.label,
|
|
86
81
|
value: e.lessons.data.filter((s) => s.status === "completed").length,
|
|
87
82
|
maxValue: e.lessons.data.length,
|
|
@@ -90,16 +85,16 @@ const U = X + q, Ae = g(
|
|
|
90
85
|
card: s.cardLottie,
|
|
91
86
|
name: s.name,
|
|
92
87
|
isCompleted: s.status === "completed",
|
|
93
|
-
onPress: () =>
|
|
88
|
+
onPress: () => I(s)
|
|
94
89
|
}))
|
|
95
90
|
}
|
|
96
91
|
)
|
|
97
|
-
]),
|
|
92
|
+
]), r = [
|
|
98
93
|
...r,
|
|
99
94
|
/* @__PURE__ */ i(
|
|
100
|
-
|
|
95
|
+
a,
|
|
101
96
|
{
|
|
102
|
-
ref:
|
|
97
|
+
ref: N,
|
|
103
98
|
label: e.games.label,
|
|
104
99
|
value: e.games.data.filter((s) => s.isPlayed).length,
|
|
105
100
|
maxValue: e.games.data.length,
|
|
@@ -108,16 +103,14 @@ const U = X + q, Ae = g(
|
|
|
108
103
|
card: s.cardLottie,
|
|
109
104
|
name: s.name,
|
|
110
105
|
isCompleted: !1,
|
|
111
|
-
onPress: () =>
|
|
106
|
+
onPress: () => R(s)
|
|
112
107
|
}))
|
|
113
108
|
}
|
|
114
|
-
)
|
|
115
|
-
]), e.puzzles && (r = [
|
|
116
|
-
...r,
|
|
109
|
+
),
|
|
117
110
|
/* @__PURE__ */ i(
|
|
118
|
-
|
|
111
|
+
a,
|
|
119
112
|
{
|
|
120
|
-
ref:
|
|
113
|
+
ref: h,
|
|
121
114
|
label: e.puzzles.label,
|
|
122
115
|
value: e.puzzles.data.filter((s) => s.solved).length,
|
|
123
116
|
maxValue: e.puzzles.data.length,
|
|
@@ -126,93 +119,88 @@ const U = X + q, Ae = g(
|
|
|
126
119
|
card: s.cardLottie,
|
|
127
120
|
name: s.name,
|
|
128
121
|
isCompleted: s.solved,
|
|
129
|
-
onPress: () =>
|
|
122
|
+
onPress: () => y(s)
|
|
130
123
|
}))
|
|
131
124
|
}
|
|
132
125
|
)
|
|
133
|
-
]
|
|
126
|
+
], e.tables && (r = [
|
|
134
127
|
...r,
|
|
135
128
|
/* @__PURE__ */ i(
|
|
136
|
-
|
|
129
|
+
q,
|
|
137
130
|
{
|
|
138
|
-
ref:
|
|
131
|
+
ref: E,
|
|
139
132
|
label: e.tables.label,
|
|
140
133
|
data: e.tables.data,
|
|
141
|
-
onPress:
|
|
134
|
+
onPress: L,
|
|
142
135
|
openModesOfTable: e.tables.openModesOfTable
|
|
143
136
|
}
|
|
144
137
|
)
|
|
145
138
|
])), r;
|
|
146
139
|
}, [
|
|
147
140
|
e,
|
|
148
|
-
J,
|
|
149
|
-
z,
|
|
150
|
-
p,
|
|
151
141
|
N,
|
|
152
|
-
P,
|
|
153
142
|
h,
|
|
154
|
-
|
|
155
|
-
|
|
143
|
+
P,
|
|
144
|
+
I,
|
|
145
|
+
R,
|
|
146
|
+
y,
|
|
147
|
+
L
|
|
148
|
+
]), U = V(
|
|
156
149
|
() => [
|
|
157
150
|
/* @__PURE__ */ i(
|
|
158
|
-
|
|
151
|
+
Z,
|
|
159
152
|
{
|
|
160
|
-
src:
|
|
161
|
-
width:
|
|
162
|
-
height:
|
|
153
|
+
src: B.SLEEPY_BOI,
|
|
154
|
+
width: O,
|
|
155
|
+
height: O
|
|
163
156
|
}
|
|
164
157
|
)
|
|
165
158
|
],
|
|
166
159
|
[]
|
|
167
160
|
);
|
|
168
|
-
return
|
|
169
|
-
if (!(
|
|
170
|
-
if (e != null && e.puzzles &&
|
|
161
|
+
return Y(() => {
|
|
162
|
+
if (!(c || !e || C)) {
|
|
163
|
+
if (e != null && e.puzzles && u === _.CIRCLE_ACTIVITIES_INTRO_JOURNEY) {
|
|
171
164
|
G(e == null ? void 0 : e.puzzles, !!(e != null && e.lessons));
|
|
172
165
|
return;
|
|
173
166
|
}
|
|
174
|
-
if (e != null && e.tables &&
|
|
175
|
-
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
178
|
-
if (e != null && e.tables && n === E.CIRCLE_TABLES_INFINTE_JOURNEY) {
|
|
179
|
-
b();
|
|
167
|
+
if (e != null && e.tables && u === _.CIRCLE_TABLES_INTRO_JOURNEY) {
|
|
168
|
+
z(e == null ? void 0 : e.tables, b);
|
|
180
169
|
return;
|
|
181
170
|
}
|
|
182
|
-
if (e != null && e.
|
|
183
|
-
|
|
171
|
+
if (e != null && e.tables && u === _.CIRCLE_TABLES_INFINTE_JOURNEY) {
|
|
172
|
+
T();
|
|
184
173
|
return;
|
|
185
174
|
}
|
|
186
175
|
}
|
|
187
176
|
}, [
|
|
188
177
|
e,
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
R,
|
|
192
|
-
n,
|
|
178
|
+
C,
|
|
179
|
+
c,
|
|
193
180
|
b,
|
|
194
|
-
|
|
181
|
+
u,
|
|
182
|
+
T,
|
|
195
183
|
G,
|
|
196
|
-
|
|
197
|
-
]),
|
|
198
|
-
|
|
184
|
+
z
|
|
185
|
+
]), c ? /* @__PURE__ */ i(H, {}) : e ? /* @__PURE__ */ i(
|
|
186
|
+
M,
|
|
199
187
|
{
|
|
200
|
-
ref:
|
|
188
|
+
ref: f,
|
|
201
189
|
items: D,
|
|
202
190
|
defaultIndex: v,
|
|
203
|
-
onNext:
|
|
204
|
-
onPrev:
|
|
191
|
+
onNext: A,
|
|
192
|
+
onPrev: A,
|
|
205
193
|
analyticsNext: {
|
|
206
|
-
analyticsLabel:
|
|
194
|
+
analyticsLabel: S.NEXT_ACTIVITY
|
|
207
195
|
},
|
|
208
196
|
analyticsPrev: {
|
|
209
|
-
analyticsLabel:
|
|
197
|
+
analyticsLabel: S.PREV_ACTIVITY
|
|
210
198
|
}
|
|
211
199
|
}
|
|
212
200
|
) : /* @__PURE__ */ i(
|
|
213
|
-
|
|
201
|
+
M,
|
|
214
202
|
{
|
|
215
|
-
items:
|
|
203
|
+
items: U,
|
|
216
204
|
analyticsNext: {
|
|
217
205
|
analyticsLabel: ""
|
|
218
206
|
},
|
|
@@ -224,6 +212,6 @@ const U = X + q, Ae = g(
|
|
|
224
212
|
}
|
|
225
213
|
);
|
|
226
214
|
export {
|
|
227
|
-
|
|
215
|
+
_e as GameLauncher
|
|
228
216
|
};
|
|
229
217
|
//# 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 { ISegmentedGameCardRefs } from './comps/segmented-game-card/segmented-game-card-types';\nimport type { ITableCardRef, ITableDetails } from './comps/tables-card/tables-card-types';\nimport type {\n Game,\n Lesson,\n Puzzle,\n} from './dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport type { IGameLauncherProps } from './game-launcher-types';\nimport type { FC, ReactNode } from 'react';\n\nimport { memo, useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport { LOTTIE } from '../../../assets/lottie/lottie';\nimport { JOURNEY_ID_STUDENT } from '../../journey/journey-id/journey-id-student';\nimport { useJourney } from '../../journey/use-journey/use-journey';\nimport { CircularLoader } from '../../ui/loader/circular-loader/circular-loader';\nimport LottieAnimation from '../../ui/lottie-animation/lottie-animation';\nimport { ProjectType } from '../games/web-view/enums';\nimport { useCircleSounds } from '../hooks/use-circle-sounds/use-circle-sounds';\nimport { CircleSoundKey } from '../hooks/use-circle-sounds/use-circle-sounds-enums';\nimport { GAME_LAUNCHER_SIZE } from './comps/card-container/constants';\nimport { Carousel } from './comps/carousel/carousel';\nimport { GAME_LAUNCHER_ASSET_PADDING } from './comps/segmented-game-card/constants';\nimport { SegmentedGameCard } from './comps/segmented-game-card/segmented-game-card';\nimport { TablesCard } from './comps/tables-card/tables-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from './game-launcher-analytics-events';\nimport { useGameLauncherJourney } from './hooks/use-game-launcher-journey/use-game-launcher-journey';\nimport { useGameLauncherLessonsJourney } from './hooks/use-game-launcher-lessons-journey/use-game-launcher-lessons-journey';\nimport { useTableInfiniteLauncherJourney } from './hooks/use-table-infinite-launcher-journey/use-table-infinite-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 data,\n isLoading,\n isTutorialOnboardingDone,\n defaultIndex = 0,\n onJourneyComplete,\n }) => {\n const carouselRefs = useRef<ICarouselRefs>(null) as React.RefObject<ICarouselRefs>;\n const lessonRefs = useRef<ISegmentedGameCardRefs>(null);\n const tableRef = useRef<ITableCardRef>(null) as React.RefObject<ITableCardRef>;\n\n const { isJourneyActive } = useJourney();\n\n const { playSwipeSound, 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 onTableInfiniteModeClick = useCallback(() => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick({ mode: 'infinite' } as ITableDetails, ProjectType.TABLE);\n }, [onSegmentClick, play]);\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 puzzleRefs,\n startJourney: startLessonPuzzleGamesJourney,\n } = useGameLauncherJourney({\n carouselRefs,\n onSegmentClick,\n onJourneyComplete,\n lessonRefs,\n });\n\n const { startJourney: startLessonJourney } = useGameLauncherLessonsJourney({\n onSegmentClick,\n onJourneyComplete,\n lessonRefs,\n });\n\n const { startJourney: startInfiniteTablesJourney } = useTableInfiniteLauncherJourney({\n carouselRefs,\n onTableInfiniteModeClick,\n onJourneyComplete,\n originalTableRef: tableRef,\n });\n\n const { startJourney: startTablesJourney } = useTableLauncherJourney({\n carouselRefs,\n originalTableRef: tableRef,\n onTableSegmentClick,\n onJourneyComplete,\n onNextJourney: startInfiniteTablesJourney,\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 if (data.games) {\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 ];\n }\n\n if (data.puzzles) {\n itemTypes = [\n ...itemTypes,\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\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 onTableSegmentClick,\n ]);\n\n const sleepyBoiItem = useMemo(\n () => [\n <LottieAnimation\n src={LOTTIE.SLEEPY_BOI}\n width={sleepyBoiDimension}\n height={sleepyBoiDimension}\n />,\n ],\n [],\n );\n\n // Start game launcher journey only when isLoading has become false and data is available\n useEffect(() => {\n if (isLoading || !data || isJourneyActive) {\n return;\n }\n\n if (data?.puzzles && journeyId === JOURNEY_ID_STUDENT.CIRCLE_ACTIVITIES_INTRO_JOURNEY) {\n startLessonPuzzleGamesJourney(data?.puzzles, !!data?.lessons);\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 return;\n }\n\n if (data?.tables && journeyId === JOURNEY_ID_STUDENT.CIRCLE_TABLES_INFINTE_JOURNEY) {\n startInfiniteTablesJourney();\n\n return;\n }\n\n if (data?.lessons && journeyId === JOURNEY_ID_STUDENT.CIRCLE_LESSONS_INTRO_JOURNEY) {\n startLessonJourney(data?.lessons);\n\n return;\n }\n }, [\n data,\n isJourneyActive,\n isLoading,\n isTutorialOnboardingDone,\n journeyId,\n startInfiniteTablesJourney,\n startLessonJourney,\n startLessonPuzzleGamesJourney,\n startTablesJourney,\n ]);\n\n if (isLoading) {\n return <CircularLoader />;\n }\n\n if (!data) {\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={playSwipeSound}\n onPrev={playSwipeSound}\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","onJourneyComplete","carouselRefs","useRef","lessonRefs","tableRef","isJourneyActive","useJourney","playSwipeSound","play","useCircleSounds","onTableSegmentClick","useCallback","table","CircleSoundKey","ProjectType","onTableInfiniteModeClick","handleLessonSegmentClick","lesson","handleGameSegmentClick","game","handlePuzzleSegmentClick","puzzle","gameRefs","puzzleRefs","startLessonPuzzleGamesJourney","useGameLauncherJourney","startLessonJourney","useGameLauncherLessonsJourney","startInfiniteTablesJourney","useTableInfiniteLauncherJourney","startTablesJourney","useTableLauncherJourney","items","useMemo","itemTypes","jsx","SegmentedGameCard","TablesCard","sleepyBoiItem","LottieAnimation","LOTTIE","useEffect","JOURNEY_ID_STUDENT","CircularLoader","Carousel","GAME_LAUNCHER_ANALYTICS_EVENTS"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgCA,MAAMA,IAAqBC,IAAqBC,GAEnCC,KAAuCC;AAAA,EAClD,CAAC;AAAA,IACC,gBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,MAAAC;AAAA,IACA,WAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,cAAAC,IAAe;AAAA,IACf,mBAAAC;AAAA,EAAA,MACI;AACE,UAAAC,IAAeC,EAAsB,IAAI,GACzCC,IAAaD,EAA+B,IAAI,GAChDE,IAAWF,EAAsB,IAAI,GAErC,EAAE,iBAAAG,MAAoBC,KAEtB,EAAE,gBAAAC,GAAgB,MAAAC,EAAK,IAAIC,EAAgB,GAE3CC,IAAsBC;AAAA,MAC1B,CAACC,MAAyB;AACxB,QAAAJ,EAAKK,EAAe,eAAe,GACpBnB,EAAAkB,GAAOE,EAAY,KAAK;AAAA,MACz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iC;AACrF,UAAAlB,EAA8B5B,KAAA,gBAAAA,EAAM,SAAS,CAAC,EAACA,KAAA,QAAAA,EAAM,QAAO;AAE5D;AAAA,QACF;AAEA,YAAIA,KAAA,QAAAA,EAAM,UAAUD,MAAc+C,EAAmB,6BAA6B;AAC7D,UAAAZ,EAAAlC,KAAA,gBAAAA,EAAM,QAAQE,CAAwB;AAEzD;AAAA,QACF;AAEA,YAAIF,KAAA,QAAAA,EAAM,UAAUD,MAAc+C,EAAmB,+BAA+B;AACvD,UAAAd;AAE3B;AAAA,QACF;AAEA,YAAIhC,KAAA,QAAAA,EAAM,WAAWD,MAAc+C,EAAmB,8BAA8B;AAClF,UAAAhB,EAAmB9B,KAAA,gBAAAA,EAAM,OAAO;AAEhC;AAAA,QACF;AAAA;AAAA,IAAA,GACC;AAAA,MACDA;AAAA,MACAS;AAAA,MACAR;AAAA,MACAC;AAAA,MACAH;AAAA,MACAiC;AAAA,MACAF;AAAA,MACAF;AAAA,MACAM;AAAA,IAAA,CACD,GAEGjC,sBACM8C,GAAe,CAAA,CAAA,IAGpB/C,IAeH,gBAAAuC;AAAA,MAACS;AAAA,MAAA;AAAA,QACC,KAAK3C;AAAA,QACL,OAAA+B;AAAA,QACA,cAAAjC;AAAA,QACA,QAAQQ;AAAA,QACR,QAAQA;AAAA,QACR,eAAe;AAAA,UACb,gBAAgBsC,EAA+B;AAAA,QACjD;AAAA,QACA,eAAe;AAAA,UACb,gBAAgBA,EAA+B;AAAA,QACjD;AAAA,MAAA;AAAA,IAAA,IAxBA,gBAAAV;AAAA,MAACS;AAAA,MAAA;AAAA,QACC,OAAON;AAAA,QACP,eAAe;AAAA,UACb,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 { ITableCardRef, ITableDetails } from './comps/tables-card/tables-card-types';\nimport type {\n Game,\n Lesson,\n Puzzle,\n} from './dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport type { IGameLauncherProps } from './game-launcher-types';\nimport type { FC, ReactNode } from 'react';\n\nimport { memo, useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport { LOTTIE } from '../../../assets/lottie/lottie';\nimport { JOURNEY_ID_STUDENT } from '../../journey/journey-id/journey-id-student';\nimport { useJourney } from '../../journey/use-journey/use-journey';\nimport { CircularLoader } from '../../ui/loader/circular-loader/circular-loader';\nimport LottieAnimation from '../../ui/lottie-animation/lottie-animation';\nimport { ProjectType } from '../games/web-view/enums';\nimport { useCircleSounds } from '../hooks/use-circle-sounds/use-circle-sounds';\nimport { CircleSoundKey } from '../hooks/use-circle-sounds/use-circle-sounds-enums';\nimport { GAME_LAUNCHER_SIZE } from './comps/card-container/constants';\nimport { Carousel } from './comps/carousel/carousel';\nimport { GAME_LAUNCHER_ASSET_PADDING } from './comps/segmented-game-card/constants';\nimport { SegmentedGameCard } from './comps/segmented-game-card/segmented-game-card';\nimport { TablesCard } from './comps/tables-card/tables-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from './game-launcher-analytics-events';\nimport { useGameLauncherJourney } from './hooks/use-game-launcher-journey/use-game-launcher-journey';\nimport { useTableInfiniteLauncherJourney } from './hooks/use-table-infinite-launcher-journey/use-table-infinite-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 data,\n isLoading,\n isTutorialOnboardingDone,\n defaultIndex = 0,\n onJourneyComplete,\n }) => {\n const carouselRefs = useRef<ICarouselRefs>(null) as React.RefObject<ICarouselRefs>;\n\n const tableRef = useRef<ITableCardRef>(null) as React.RefObject<ITableCardRef>;\n\n const { isJourneyActive } = useJourney();\n\n const { playSwipeSound, 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 onTableInfiniteModeClick = useCallback(() => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick({ mode: 'infinite' } as ITableDetails, ProjectType.TABLE);\n }, [onSegmentClick, play]);\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: startInfiniteTablesJourney } = useTableInfiniteLauncherJourney({\n carouselRefs,\n onTableInfiniteModeClick,\n onJourneyComplete,\n originalTableRef: tableRef,\n });\n\n const { startJourney: startTablesJourney } = useTableLauncherJourney({\n carouselRefs,\n originalTableRef: tableRef,\n onTableSegmentClick,\n onJourneyComplete,\n onNextJourney: startInfiniteTablesJourney,\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 onTableSegmentClick,\n ]);\n\n const sleepyBoiItem = useMemo(\n () => [\n <LottieAnimation\n src={LOTTIE.SLEEPY_BOI}\n width={sleepyBoiDimension}\n height={sleepyBoiDimension}\n />,\n ],\n [],\n );\n\n // Start game launcher journey only when isLoading has become false and data is available\n useEffect(() => {\n if (isLoading || !data || isJourneyActive) {\n return;\n }\n\n if (data?.puzzles && journeyId === JOURNEY_ID_STUDENT.CIRCLE_ACTIVITIES_INTRO_JOURNEY) {\n startLessonPuzzleGamesJourney(data?.puzzles, !!data?.lessons);\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 return;\n }\n\n if (data?.tables && journeyId === JOURNEY_ID_STUDENT.CIRCLE_TABLES_INFINTE_JOURNEY) {\n startInfiniteTablesJourney();\n\n return;\n }\n }, [\n data,\n isJourneyActive,\n isLoading,\n isTutorialOnboardingDone,\n journeyId,\n startInfiniteTablesJourney,\n startLessonPuzzleGamesJourney,\n startTablesJourney,\n ]);\n\n if (isLoading) {\n return <CircularLoader />;\n }\n\n if (!data) {\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={playSwipeSound}\n onPrev={playSwipeSound}\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","onJourneyComplete","carouselRefs","useRef","tableRef","isJourneyActive","useJourney","playSwipeSound","play","useCircleSounds","onTableSegmentClick","useCallback","table","CircleSoundKey","ProjectType","onTableInfiniteModeClick","handleLessonSegmentClick","lesson","handleGameSegmentClick","game","handlePuzzleSegmentClick","puzzle","gameRefs","lessonRefs","puzzleRefs","startLessonPuzzleGamesJourney","useGameLauncherJourney","startInfiniteTablesJourney","useTableInfiniteLauncherJourney","startTablesJourney","useTableLauncherJourney","items","useMemo","itemTypes","jsx","SegmentedGameCard","TablesCard","sleepyBoiItem","LottieAnimation","LOTTIE","useEffect","JOURNEY_ID_STUDENT","CircularLoader","Carousel","GAME_LAUNCHER_ANALYTICS_EVENTS"],"mappings":";;;;;;;;;;;;;;;;;;;AA8BA,MAAMA,IAAqBC,IAAqBC,GAEnCC,KAAuCC;AAAA,EAClD,CAAC;AAAA,IACC,gBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,MAAAC;AAAA,IACA,WAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,cAAAC,IAAe;AAAA,IACf,mBAAAC;AAAA,EAAA,MACI;AACE,UAAAC,IAAeC,EAAsB,IAAI,GAEzCC,IAAWD,EAAsB,IAAI,GAErC,EAAE,iBAAAE,MAAoBC,KAEtB,EAAE,gBAAAC,GAAgB,MAAAC,EAAK,IAAIC,EAAgB,GAE3CC,IAAsBC;AAAA,MAC1B,CAACC,MAAyB;AACxB,QAAAJ,EAAKK,EAAe,eAAe,GACpBlB,EAAAiB,GAAOE,EAAY,KAAK;AAAA,MACzC;AAAA,MACA,CAACnB,GAAgBa,CAAI;AAAA,IAAA,GAGjBO,IAA2BJ,EAAY,MAAM;AACjD,MAAAH,EAAKK,EAAe,eAAe,GACnClB,EAAe,EAAE,MAAM,WAAW,GAAoBmB,EAAY,KAAK;AAAA,IAAA,GACtE,CAACnB,GAAgBa,CAAI,CAAC,GAEnBQ,IAA2BL;AAAA,MAC/B,CAACM,MAAmB;AACd,QAAAA,EAAO,WAAW,gBACpBT,EAAKK,EAAe,eAAe,GACpBlB,EAAAsB,GAAQH,EAAY,MAAM;AAAA,MAE7C;AAAA,MACA,CAACnB,GAAgBa,CAAI;AAAA,IAAA,GAGjBU,IAAyBP;AAAA,MAC7B,CAACQ,MAAe;AACd,QAAAX,EAAKK,EAAe,eAAe,GACpBlB,EAAAwB,GAAML,EAAY,IAA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BAAgBqC,EAA+B;AAAA,QACjD;AAAA,QACA,eAAe;AAAA,UACb,gBAAgBA,EAA+B;AAAA,QACjD;AAAA,MAAA;AAAA,IAAA,IAxBA,gBAAAV;AAAA,MAACS;AAAA,MAAA;AAAA,QACC,OAAON;AAAA,QACP,eAAe;AAAA,UACb,gBAAgB;AAAA,QAClB;AAAA,QACA,eAAe;AAAA,UACb,gBAAgB;AAAA,QAClB;AAAA,MAAA;AAAA,IAAA;AAAA,EAoBR;AACF;"}
|
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
import { jsx as t, Fragment as
|
|
2
|
-
import { useRef as
|
|
1
|
+
import { jsx as t, Fragment as R } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as L, useCallback as E, useMemo as de, useEffect as se } from "react";
|
|
3
3
|
import te from "../../../../../assets/line-icons/icons/carat-right.js";
|
|
4
4
|
import { PLATFORM_EVENTS_STUDENT as re } from "../../../../analytics-events/platform-events-student.js";
|
|
5
|
-
import { JOURNEY_ID_STUDENT as
|
|
6
|
-
import { IndicatorType as
|
|
7
|
-
import { useJourney as
|
|
5
|
+
import { JOURNEY_ID_STUDENT as me } from "../../../../journey/journey-id/journey-id-student.js";
|
|
6
|
+
import { IndicatorType as c } from "../../../../journey/use-journey/constants.js";
|
|
7
|
+
import { useJourney as Te } from "../../../../journey/use-journey/use-journey.js";
|
|
8
8
|
import ne from "../../../../ui/buttons/icon-button/icon-button.js";
|
|
9
9
|
import { useUIContext as ue } from "../../../../ui/context/context.js";
|
|
10
|
-
import
|
|
10
|
+
import y from "../../../../ui/layout/flex-view.js";
|
|
11
11
|
import a from "../../../../ui/text/text.js";
|
|
12
|
-
import { getTheme as
|
|
12
|
+
import { getTheme as he } from "../../../../ui/theme/get-theme.js";
|
|
13
13
|
import { CIRCLE_ONBOARDING_ANALYTICS_STEPS as p } from "../../../enum/circle-onboarding-steps.js";
|
|
14
|
-
import { useCircleSounds as
|
|
14
|
+
import { useCircleSounds as ge } from "../../../hooks/use-circle-sounds/use-circle-sounds.js";
|
|
15
15
|
import { SegmentedGameCard as Ee } from "../../comps/segmented-game-card/segmented-game-card.js";
|
|
16
|
-
import { GAME_LAUNCHER_ANALYTICS_EVENTS as
|
|
16
|
+
import { GAME_LAUNCHER_ANALYTICS_EVENTS as oe } from "../../game-launcher-analytics-events.js";
|
|
17
17
|
import { GO_TO_NEXT_SLIDE_AFTER_MS as pe, SHOW_LABEL_HIGHLIGHT_AFTER_MS as Ie, SHOW_NUDGE_AFTER_MS as _e, SLIDE_TO_LESSON_MS as Ce } from "./constants.js";
|
|
18
|
-
import { ProjectType as
|
|
18
|
+
import { ProjectType as fe } from "../../../games/web-view/enums/project-type-enum.js";
|
|
19
19
|
const xe = ({
|
|
20
20
|
carouselRefs: n,
|
|
21
|
-
onSegmentClick:
|
|
22
|
-
onJourneyComplete:
|
|
23
|
-
lessonRefs: c
|
|
21
|
+
onSegmentClick: S,
|
|
22
|
+
onJourneyComplete: N
|
|
24
23
|
}) => {
|
|
25
|
-
const
|
|
24
|
+
const o = me.CIRCLE_ACTIVITIES_INTRO_JOURNEY, { device: ie } = he(), d = ie === "mobile", I = d ? "ab3-bold" : "ab2-bold", i = L(null), r = L(null), l = L(null), _ = L([]), { playButtonSound: b } = ge(), { nextCoachmark: s, setJourney: P, endJourney: H } = Te(), { onEvent: C } = ue(), G = E(
|
|
26
25
|
(e) => {
|
|
27
26
|
C(re.ONBOARDING_STEP_VIEWED, {
|
|
28
27
|
step: e
|
|
@@ -36,69 +35,69 @@ const xe = ({
|
|
|
36
35
|
});
|
|
37
36
|
},
|
|
38
37
|
[C]
|
|
39
|
-
),
|
|
40
|
-
(e,
|
|
41
|
-
var u,
|
|
42
|
-
O || (
|
|
43
|
-
const
|
|
44
|
-
clearTimeout(
|
|
38
|
+
), m = E(
|
|
39
|
+
(e, f, A, O = !1) => {
|
|
40
|
+
var u, h;
|
|
41
|
+
O || (b(), (h = n.current) == null || h.goToIndex(((u = n.current) == null ? void 0 : u.currentIndex) + 1), s(o, !1, pe)), G(e);
|
|
42
|
+
const T = setTimeout(() => {
|
|
43
|
+
clearTimeout(T), f.startLabelAnimation(A);
|
|
45
44
|
}, Ie);
|
|
46
|
-
_.current.push(
|
|
45
|
+
_.current.push(T), s(o, !0, _e);
|
|
47
46
|
},
|
|
48
|
-
[n,
|
|
47
|
+
[n, o, s, b, G]
|
|
49
48
|
), Y = E(
|
|
50
49
|
(e) => {
|
|
51
|
-
|
|
50
|
+
S(e, fe.PUZZLE), U(p.PUZZLE_ACTIVITY), H(o), N(o);
|
|
52
51
|
},
|
|
53
|
-
[H,
|
|
52
|
+
[H, o, N, S, U]
|
|
54
53
|
), k = E(
|
|
55
|
-
(e,
|
|
54
|
+
(e, f) => {
|
|
56
55
|
var B, V, w, x, D, M, J, W, X, $, F, Z, j, K, q, Q, z, ee;
|
|
57
|
-
if (!((B = n == null ? void 0 : n.current) != null && B.nextBtnRef.current) || !((V = r == null ? void 0 : r.current) != null && V.segmentedCardWrapperRef.current) || !((w =
|
|
56
|
+
if (!((B = n == null ? void 0 : n.current) != null && B.nextBtnRef.current) || !((V = r == null ? void 0 : r.current) != null && V.segmentedCardWrapperRef.current) || !((w = i == null ? void 0 : i.current) != null && w.labelRef.current) || !((x = r == null ? void 0 : r.current) != null && x.labelRef.current) || !e)
|
|
58
57
|
return;
|
|
59
|
-
const
|
|
58
|
+
const A = ((J = (M = (D = l.current) == null ? void 0 : D.labelRef) == null ? void 0 : M.current) == null ? void 0 : J.getBoundingClientRect()) || {
|
|
60
59
|
height: 0,
|
|
61
60
|
width: 0
|
|
62
|
-
}, O = (($ = (X = (W =
|
|
61
|
+
}, O = (($ = (X = (W = i.current) == null ? void 0 : W.labelRef) == null ? void 0 : X.current) == null ? void 0 : $.getBoundingClientRect()) || {
|
|
63
62
|
height: 0,
|
|
64
63
|
width: 0
|
|
65
|
-
},
|
|
64
|
+
}, T = ((j = (Z = (F = r.current) == null ? void 0 : F.labelRef) == null ? void 0 : Z.current) == null ? void 0 : j.getBoundingClientRect()) || {
|
|
66
65
|
height: 0,
|
|
67
66
|
width: 0
|
|
68
67
|
}, u = ((Q = (q = (K = r.current) == null ? void 0 : K.segmentedCardWrapperRef) == null ? void 0 : q.current) == null ? void 0 : Q.getBoundingClientRect()) || {
|
|
69
68
|
height: 0,
|
|
70
69
|
width: 0
|
|
71
70
|
};
|
|
72
|
-
let
|
|
73
|
-
|
|
71
|
+
let h = [];
|
|
72
|
+
f && l.current && (h = [
|
|
74
73
|
{
|
|
75
|
-
originalElementToHighlightRef:
|
|
74
|
+
originalElementToHighlightRef: l.current.labelRef,
|
|
76
75
|
isActive: !1,
|
|
77
|
-
type:
|
|
78
|
-
elementToHighlight: /* @__PURE__ */ t(
|
|
76
|
+
type: c.TOOLTIP,
|
|
77
|
+
elementToHighlight: /* @__PURE__ */ t(R, {}),
|
|
79
78
|
indicator: {
|
|
80
79
|
position: "top",
|
|
81
80
|
backgroundColor: "BLUE_4",
|
|
82
|
-
tooltipItem: /* @__PURE__ */ t(
|
|
83
|
-
tooltipXCoOrdinates:
|
|
84
|
-
tooltipYCoOrdinates:
|
|
81
|
+
tooltipItem: /* @__PURE__ */ t(y, { children: /* @__PURE__ */ t(a, { $renderAs: I, children: "Get faster & stay ahead in school. Practice 3 new skills everyday." }) }),
|
|
82
|
+
tooltipXCoOrdinates: A.width / 2,
|
|
83
|
+
tooltipYCoOrdinates: A.height + 10
|
|
85
84
|
}
|
|
86
85
|
},
|
|
87
86
|
{
|
|
88
87
|
originalElementToHighlightRef: (z = n.current) == null ? void 0 : z.nextBtnRef,
|
|
89
88
|
isActive: !1,
|
|
90
|
-
type:
|
|
89
|
+
type: c.NUDGE,
|
|
91
90
|
elementToHighlight: /* @__PURE__ */ t(
|
|
92
91
|
ne,
|
|
93
92
|
{
|
|
94
93
|
renderAs: "secondary",
|
|
95
94
|
Icon: te,
|
|
96
|
-
onClick: () =>
|
|
95
|
+
onClick: () => m(
|
|
97
96
|
p.GAMES_ACTIVITY,
|
|
98
|
-
|
|
97
|
+
i.current,
|
|
99
98
|
"ORANGE_4"
|
|
100
99
|
),
|
|
101
|
-
analyticsLabel:
|
|
100
|
+
analyticsLabel: oe.JOURNEY_NEXT_ACTIVITY
|
|
102
101
|
}
|
|
103
102
|
),
|
|
104
103
|
indicator: {
|
|
@@ -109,16 +108,16 @@ const xe = ({
|
|
|
109
108
|
}
|
|
110
109
|
}
|
|
111
110
|
]);
|
|
112
|
-
const
|
|
111
|
+
const ce = [
|
|
113
112
|
{
|
|
114
|
-
originalElementToHighlightRef:
|
|
113
|
+
originalElementToHighlightRef: i.current.labelRef,
|
|
115
114
|
isActive: !1,
|
|
116
|
-
type:
|
|
117
|
-
elementToHighlight: /* @__PURE__ */ t(
|
|
115
|
+
type: c.TOOLTIP,
|
|
116
|
+
elementToHighlight: /* @__PURE__ */ t(R, {}),
|
|
118
117
|
indicator: {
|
|
119
118
|
position: "top",
|
|
120
119
|
backgroundColor: "ORANGE_4",
|
|
121
|
-
tooltipItem: /* @__PURE__ */ t(
|
|
120
|
+
tooltipItem: /* @__PURE__ */ t(y, { children: /* @__PURE__ */ t(a, { $renderAs: I, children: "Train to think deeper & plan ahead. Play 3 new games everyday." }) }),
|
|
122
121
|
tooltipXCoOrdinates: O.width / 2,
|
|
123
122
|
tooltipYCoOrdinates: O.height + 10
|
|
124
123
|
}
|
|
@@ -126,18 +125,18 @@ const xe = ({
|
|
|
126
125
|
{
|
|
127
126
|
originalElementToHighlightRef: n.current.nextBtnRef,
|
|
128
127
|
isActive: !1,
|
|
129
|
-
type:
|
|
128
|
+
type: c.NUDGE,
|
|
130
129
|
elementToHighlight: /* @__PURE__ */ t(
|
|
131
130
|
ne,
|
|
132
131
|
{
|
|
133
132
|
renderAs: "secondary",
|
|
134
133
|
Icon: te,
|
|
135
|
-
onClick: () =>
|
|
134
|
+
onClick: () => m(
|
|
136
135
|
p.PUZZLE_ACTIVITY,
|
|
137
136
|
r.current,
|
|
138
137
|
"PURPLE_4"
|
|
139
138
|
),
|
|
140
|
-
analyticsLabel:
|
|
139
|
+
analyticsLabel: oe.JOURNEY_NEXT_ACTIVITY
|
|
141
140
|
}
|
|
142
141
|
),
|
|
143
142
|
indicator: {
|
|
@@ -151,33 +150,33 @@ const xe = ({
|
|
|
151
150
|
{
|
|
152
151
|
originalElementToHighlightRef: r.current.labelRef,
|
|
153
152
|
isActive: !1,
|
|
154
|
-
type:
|
|
155
|
-
elementToHighlight: /* @__PURE__ */ t(
|
|
153
|
+
type: c.TOOLTIP,
|
|
154
|
+
elementToHighlight: /* @__PURE__ */ t(R, {}),
|
|
156
155
|
indicator: {
|
|
157
156
|
position: "top",
|
|
158
157
|
backgroundColor: "PURPLE_4",
|
|
159
|
-
tooltipItem: /* @__PURE__ */ t(
|
|
160
|
-
tooltipXCoOrdinates:
|
|
161
|
-
tooltipYCoOrdinates:
|
|
158
|
+
tooltipItem: /* @__PURE__ */ t(y, { children: /* @__PURE__ */ t(a, { $renderAs: I, children: "Think in new ways & stay sharp. Solve 3 new puzzles everyday." }) }),
|
|
159
|
+
tooltipXCoOrdinates: T.width / 2,
|
|
160
|
+
tooltipYCoOrdinates: T.height + 10
|
|
162
161
|
}
|
|
163
162
|
},
|
|
164
163
|
{
|
|
165
164
|
originalElementToHighlightRef: r.current.segmentedCardWrapperRef,
|
|
166
165
|
isActive: !1,
|
|
167
|
-
type:
|
|
166
|
+
type: c.NUDGE,
|
|
168
167
|
elementToHighlight: /* @__PURE__ */ t(
|
|
169
168
|
Ee,
|
|
170
169
|
{
|
|
171
170
|
label: "",
|
|
172
|
-
value: e.data.filter((
|
|
171
|
+
value: e.data.filter((g) => g.solved).length,
|
|
173
172
|
maxValue: e.data.length,
|
|
174
173
|
initialValue: e.initialProgressValue,
|
|
175
|
-
data: e.data.map((
|
|
176
|
-
card:
|
|
174
|
+
data: e.data.map((g) => ({
|
|
175
|
+
card: g.cardLottie,
|
|
177
176
|
name: "",
|
|
178
177
|
// We dont want to show the name of the puzzle in onboarding
|
|
179
|
-
isCompleted:
|
|
180
|
-
onPress: () => Y(
|
|
178
|
+
isCompleted: g.solved,
|
|
179
|
+
onPress: () => Y(g)
|
|
181
180
|
}))
|
|
182
181
|
}
|
|
183
182
|
),
|
|
@@ -189,34 +188,34 @@ const xe = ({
|
|
|
189
188
|
}
|
|
190
189
|
}
|
|
191
190
|
];
|
|
192
|
-
P(
|
|
191
|
+
P(o, [...h, ...ce, ...ae]), (ee = n.current) == null || ee.goToIndex(0);
|
|
193
192
|
const v = setTimeout(() => {
|
|
194
|
-
clearTimeout(v),
|
|
193
|
+
clearTimeout(v), s(o);
|
|
195
194
|
}, Ce);
|
|
196
|
-
_.current.push(v),
|
|
195
|
+
_.current.push(v), f && l.current ? m(p.SKILL_ACTIVITY, l.current, "BLUE_4", !0) : m(p.GAMES_ACTIVITY, i.current, "ORANGE_4", !0);
|
|
197
196
|
},
|
|
198
197
|
[
|
|
199
198
|
n,
|
|
200
|
-
c,
|
|
201
199
|
I,
|
|
202
200
|
d,
|
|
203
201
|
P,
|
|
204
|
-
|
|
205
|
-
|
|
202
|
+
o,
|
|
203
|
+
m,
|
|
206
204
|
Y,
|
|
207
|
-
|
|
205
|
+
s
|
|
208
206
|
]
|
|
209
|
-
),
|
|
207
|
+
), le = de(
|
|
210
208
|
() => ({
|
|
211
|
-
gameRefs:
|
|
209
|
+
gameRefs: i,
|
|
212
210
|
puzzleRefs: r,
|
|
211
|
+
lessonRefs: l,
|
|
213
212
|
startJourney: k
|
|
214
213
|
}),
|
|
215
214
|
[k]
|
|
216
215
|
);
|
|
217
|
-
return
|
|
216
|
+
return se(() => () => {
|
|
218
217
|
_.current.forEach((e) => clearTimeout(e)), _.current = [];
|
|
219
|
-
}, [n]),
|
|
218
|
+
}, [n]), le;
|
|
220
219
|
};
|
|
221
220
|
export {
|
|
222
221
|
xe as useGameLauncherJourney
|
|
@@ -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 { 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 { JOURNEY_ID_STUDENT } from '../../../../journey/journey-id/journey-id-student';\nimport { IndicatorType } from '../../../../journey/use-journey/constants';\nimport { useJourney } from '../../../../journey/use-journey/use-journey';\nimport IconButton from '../../../../ui/buttons/icon-button/icon-button';\nimport { useUIContext } from '../../../../ui/context/context';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport { getTheme } from '../../../../ui/theme/get-theme';\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 onJourneyComplete,\n lessonRefs,\n}: IUseGameLauncherJourneyProps) => {\n const journeyId = JOURNEY_ID_STUDENT.CIRCLE_ACTIVITIES_INTRO_JOURNEY;\n\n const { device } = getTheme();\n const isMobile = device === 'mobile';\n const tooltipTextRenderAs = isMobile ? 'ab3-bold' : 'ab2-bold';\n\n const gameRefs = useRef<ISegmentedGameCardRefs>(null);\n const puzzleRefs = useRef<ISegmentedGameCardRefs>(null);\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\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 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, journeyId, nextCoachmark, playButtonSound, trackEventViewed],\n );\n\n const handleEndJourney = useCallback(\n (puzzlesData: Puzzle) => {\n onSegmentClick(puzzlesData, ProjectType.PUZZLE);\n trackEventCompleted(ActionEvent.PUZZLE_ACTIVITY);\n endJourney(journeyId);\n onJourneyComplete(journeyId);\n },\n [endJourney, journeyId, onJourneyComplete, onSegmentClick, trackEventCompleted],\n );\n\n const startJourney = useCallback(\n (puzzlesData: IProject<Puzzle>, isLessonAvailable: boolean) => {\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 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: 'top',\n backgroundColor: 'BLUE_4',\n tooltipItem: (\n <FlexView>\n <Text $renderAs={tooltipTextRenderAs}>\n Get faster & stay ahead in school. Practice 3 new skills everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: lessonLabelDims.width / 2,\n tooltipYCoOrdinates: lessonLabelDims.height + 10,\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 )\n }\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\n indicator: {\n nudge: 'click',\n content: !isMobile && (\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: 'top',\n backgroundColor: 'ORANGE_4',\n tooltipItem: (\n <FlexView>\n <Text $renderAs={tooltipTextRenderAs}>\n Train to think deeper & plan ahead. Play 3 new games everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: gameLabelDims.width / 2,\n tooltipYCoOrdinates: gameLabelDims.height + 10,\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 )\n }\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\n indicator: {\n nudge: 'click',\n content: !isMobile && (\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: 'top',\n backgroundColor: 'PURPLE_4',\n tooltipItem: (\n <FlexView>\n <Text $renderAs={tooltipTextRenderAs}>\n Think in new ways & stay sharp. Solve 3 new puzzles everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: puzzleLabelDims.width / 2,\n tooltipYCoOrdinates: puzzleLabelDims.height + 10,\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),\n }))}\n />\n ),\n indicator: {\n nudge: 'click',\n content: !isMobile && (\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', true);\n } else {\n goToNextCard(ActionEvent.GAMES_ACTIVITY, gameRefs.current, 'ORANGE_4', true);\n }\n },\n [\n carouselRefs,\n lessonRefs,\n tooltipTextRenderAs,\n isMobile,\n setJourney,\n journeyId,\n goToNextCard,\n handleEndJourney,\n nextCoachmark,\n ],\n );\n\n const data = useMemo(\n () => ({\n gameRefs,\n puzzleRefs,\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 };\n }, [carouselRefs]);\n\n return data;\n};\n"],"names":["useGameLauncherJourney","carouselRefs","onSegmentClick","onJourneyComplete","lessonRefs","journeyId","JOURNEY_ID_STUDENT","device","getTheme","isMobile","tooltipTextRenderAs","gameRefs","useRef","puzzleRefs","timerRefs","playButtonSound","useCircleSounds","nextCoachmark","setJourney","endJourney","useJourney","trackAnalytics","useUIContext","trackEventViewed","useCallback","step","AnalyticsLabel","trackEventCompleted","goToNextCard","analyticsLabelViewed","refOfNextSlide","color","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":";;;;;;;;;;;;;;;;;;AAmCO,MAAMA,KAAyB,CAAC;AAAA,EACrC,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,YAAAC;AACF,MAAoC;AAClC,QAAMC,IAAYC,GAAmB,iCAE/B,EAAE,QAAAC,OAAWC,MACbC,IAAWF,OAAW,UACtBG,IAAsBD,IAAW,aAAa,YAE9CE,IAAWC,EAA+B,IAAI,GAC9CC,IAAaD,EAA+B,IAAI,GAChDE,IAAYF,EAAwC,CAAA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
+
{"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 { 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 { JOURNEY_ID_STUDENT } from '../../../../journey/journey-id/journey-id-student';\nimport { IndicatorType } from '../../../../journey/use-journey/constants';\nimport { useJourney } from '../../../../journey/use-journey/use-journey';\nimport IconButton from '../../../../ui/buttons/icon-button/icon-button';\nimport { useUIContext } from '../../../../ui/context/context';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport { getTheme } from '../../../../ui/theme/get-theme';\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 onJourneyComplete,\n}: IUseGameLauncherJourneyProps) => {\n const journeyId = JOURNEY_ID_STUDENT.CIRCLE_ACTIVITIES_INTRO_JOURNEY;\n\n const { device } = getTheme();\n const isMobile = device === 'mobile';\n const tooltipTextRenderAs = isMobile ? 'ab3-bold' : 'ab2-bold';\n\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 { 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 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, journeyId, nextCoachmark, playButtonSound, trackEventViewed],\n );\n\n const handleEndJourney = useCallback(\n (puzzlesData: Puzzle) => {\n onSegmentClick(puzzlesData, ProjectType.PUZZLE);\n trackEventCompleted(ActionEvent.PUZZLE_ACTIVITY);\n endJourney(journeyId);\n onJourneyComplete(journeyId);\n },\n [endJourney, journeyId, onJourneyComplete, onSegmentClick, trackEventCompleted],\n );\n\n const startJourney = useCallback(\n (puzzlesData: IProject<Puzzle>, isLessonAvailable: boolean) => {\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 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: 'top',\n backgroundColor: 'BLUE_4',\n tooltipItem: (\n <FlexView>\n <Text $renderAs={tooltipTextRenderAs}>\n Get faster & stay ahead in school. Practice 3 new skills everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: lessonLabelDims.width / 2,\n tooltipYCoOrdinates: lessonLabelDims.height + 10,\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 )\n }\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\n indicator: {\n nudge: 'click',\n content: !isMobile && (\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: 'top',\n backgroundColor: 'ORANGE_4',\n tooltipItem: (\n <FlexView>\n <Text $renderAs={tooltipTextRenderAs}>\n Train to think deeper & plan ahead. Play 3 new games everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: gameLabelDims.width / 2,\n tooltipYCoOrdinates: gameLabelDims.height + 10,\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 )\n }\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\n indicator: {\n nudge: 'click',\n content: !isMobile && (\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: 'top',\n backgroundColor: 'PURPLE_4',\n tooltipItem: (\n <FlexView>\n <Text $renderAs={tooltipTextRenderAs}>\n Think in new ways & stay sharp. Solve 3 new puzzles everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: puzzleLabelDims.width / 2,\n tooltipYCoOrdinates: puzzleLabelDims.height + 10,\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),\n }))}\n />\n ),\n indicator: {\n nudge: 'click',\n content: !isMobile && (\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', true);\n } else {\n goToNextCard(ActionEvent.GAMES_ACTIVITY, gameRefs.current, 'ORANGE_4', true);\n }\n },\n [\n carouselRefs,\n tooltipTextRenderAs,\n isMobile,\n setJourney,\n journeyId,\n goToNextCard,\n handleEndJourney,\n nextCoachmark,\n ],\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 };\n }, [carouselRefs]);\n\n return data;\n};\n"],"names":["useGameLauncherJourney","carouselRefs","onSegmentClick","onJourneyComplete","journeyId","JOURNEY_ID_STUDENT","device","getTheme","isMobile","tooltipTextRenderAs","gameRefs","useRef","puzzleRefs","lessonRefs","timerRefs","playButtonSound","useCircleSounds","nextCoachmark","setJourney","endJourney","useJourney","trackAnalytics","useUIContext","trackEventViewed","useCallback","step","AnalyticsLabel","trackEventCompleted","goToNextCard","analyticsLabelViewed","refOfNextSlide","color","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":";;;;;;;;;;;;;;;;;;AAmCO,MAAMA,KAAyB,CAAC;AAAA,EACrC,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,mBAAAC;AACF,MAAoC;AAClC,QAAMC,IAAYC,GAAmB,iCAE/B,EAAE,QAAAC,OAAWC,MACbC,IAAWF,OAAW,UACtBG,IAAsBD,IAAW,aAAa,YAE9CE,IAAW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aAAaA,CAAK,CAAC,GACtDrE,EAAU,UAAU;EAAC,GAEtB,CAACb,CAAY,CAAC,GAEV+E;AACT;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var E = /* @__PURE__ */ ((R) => (R.CIRCLE_ACTIVITIES_INTRO_JOURNEY = "CIRCLE_ACTIVITIES_INTRO_JOURNEY", R.CIRCLE_LEADERBOARD_INTRO_JOURNEY = "CIRCLE_LEADERBOARD_INTRO_JOURNEY", R.CIRCLE_POINTS_REWARD_JOURNEY = "CIRCLE_POINTS_REWARD_JOURNEY", R.CIRCLE_STREAK_UPDATE_JOURNEY = "CIRCLE_STREAK_UPDATE_JOURNEY", R.CIRCLE_TUTORIAL_JOURNEY = "CIRCLE_TUTORIAL_JOURNEY", R.CIRCLE_TABLES_INTRO_JOURNEY = "CIRCLE_TABLES_INTRO_JOURNEY", R.CIRCLE_TABLES_INFINTE_JOURNEY = "CIRCLE_TABLES_INFINITE_JOURNEY", R.
|
|
1
|
+
var E = /* @__PURE__ */ ((R) => (R.CIRCLE_ACTIVITIES_INTRO_JOURNEY = "CIRCLE_ACTIVITIES_INTRO_JOURNEY", R.CIRCLE_LEADERBOARD_INTRO_JOURNEY = "CIRCLE_LEADERBOARD_INTRO_JOURNEY", R.CIRCLE_POINTS_REWARD_JOURNEY = "CIRCLE_POINTS_REWARD_JOURNEY", R.CIRCLE_STREAK_UPDATE_JOURNEY = "CIRCLE_STREAK_UPDATE_JOURNEY", R.CIRCLE_TUTORIAL_JOURNEY = "CIRCLE_TUTORIAL_JOURNEY", R.CIRCLE_TABLES_INTRO_JOURNEY = "CIRCLE_TABLES_INTRO_JOURNEY", R.CIRCLE_TABLES_INFINTE_JOURNEY = "CIRCLE_TABLES_INFINITE_JOURNEY", R.CIRCLE_STREAK_REDUCTION_JOURNEY = "CIRCLE_STREAK_REDUCTION_JOURNEY", R.HOMEPAGE_JOURNEY = "HOMEPAGE_JOURNEY", R.CHAPTER_PAGE_JOURNEY = "CHAPTER_PAGE_JOURNEY", R))(E || {});
|
|
2
2
|
export {
|
|
3
3
|
E as JOURNEY_ID_STUDENT
|
|
4
4
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"journey-id-student.js","sources":["../../../../src/features/journey/journey-id/journey-id-student.ts"],"sourcesContent":["export enum JOURNEY_ID_STUDENT {\n CIRCLE_ACTIVITIES_INTRO_JOURNEY = 'CIRCLE_ACTIVITIES_INTRO_JOURNEY',\n CIRCLE_LEADERBOARD_INTRO_JOURNEY = 'CIRCLE_LEADERBOARD_INTRO_JOURNEY',\n CIRCLE_POINTS_REWARD_JOURNEY = 'CIRCLE_POINTS_REWARD_JOURNEY',\n CIRCLE_STREAK_UPDATE_JOURNEY = 'CIRCLE_STREAK_UPDATE_JOURNEY',\n CIRCLE_TUTORIAL_JOURNEY = 'CIRCLE_TUTORIAL_JOURNEY',\n CIRCLE_TABLES_INTRO_JOURNEY = 'CIRCLE_TABLES_INTRO_JOURNEY',\n CIRCLE_TABLES_INFINTE_JOURNEY = 'CIRCLE_TABLES_INFINITE_JOURNEY',\n
|
|
1
|
+
{"version":3,"file":"journey-id-student.js","sources":["../../../../src/features/journey/journey-id/journey-id-student.ts"],"sourcesContent":["export enum JOURNEY_ID_STUDENT {\n CIRCLE_ACTIVITIES_INTRO_JOURNEY = 'CIRCLE_ACTIVITIES_INTRO_JOURNEY',\n CIRCLE_LEADERBOARD_INTRO_JOURNEY = 'CIRCLE_LEADERBOARD_INTRO_JOURNEY',\n CIRCLE_POINTS_REWARD_JOURNEY = 'CIRCLE_POINTS_REWARD_JOURNEY',\n CIRCLE_STREAK_UPDATE_JOURNEY = 'CIRCLE_STREAK_UPDATE_JOURNEY',\n CIRCLE_TUTORIAL_JOURNEY = 'CIRCLE_TUTORIAL_JOURNEY',\n CIRCLE_TABLES_INTRO_JOURNEY = 'CIRCLE_TABLES_INTRO_JOURNEY',\n CIRCLE_TABLES_INFINTE_JOURNEY = 'CIRCLE_TABLES_INFINITE_JOURNEY',\n\n // TODO: Deprecate bottom journeys, they are not actually journeys\n CIRCLE_STREAK_REDUCTION_JOURNEY = 'CIRCLE_STREAK_REDUCTION_JOURNEY',\n HOMEPAGE_JOURNEY = 'HOMEPAGE_JOURNEY',\n CHAPTER_PAGE_JOURNEY = 'CHAPTER_PAGE_JOURNEY',\n}\n"],"names":["JOURNEY_ID_STUDENT"],"mappings":"AAAY,IAAAA,sBAAAA,OACVA,EAAA,kCAAkC,mCAClCA,EAAA,mCAAmC,oCACnCA,EAAA,+BAA+B,gCAC/BA,EAAA,+BAA+B,gCAC/BA,EAAA,0BAA0B,2BAC1BA,EAAA,8BAA8B,+BAC9BA,EAAA,gCAAgC,kCAGhCA,EAAA,kCAAkC,mCAClCA,EAAA,mBAAmB,oBACnBA,EAAA,uBAAuB,wBAZbA,IAAAA,KAAA,CAAA,CAAA;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2772,8 +2772,8 @@ export declare interface IProjectData extends IProjects {
|
|
|
2772
2772
|
}
|
|
2773
2773
|
|
|
2774
2774
|
export declare interface IProjects {
|
|
2775
|
-
games
|
|
2776
|
-
puzzles
|
|
2775
|
+
games: IProject<Game>;
|
|
2776
|
+
puzzles: IProject<Puzzle>;
|
|
2777
2777
|
lessons?: IProject<Lesson>;
|
|
2778
2778
|
tables?: ITables;
|
|
2779
2779
|
}
|
|
@@ -4133,7 +4133,6 @@ export declare enum JOURNEY_ID_STUDENT {
|
|
|
4133
4133
|
CIRCLE_TUTORIAL_JOURNEY = "CIRCLE_TUTORIAL_JOURNEY",
|
|
4134
4134
|
CIRCLE_TABLES_INTRO_JOURNEY = "CIRCLE_TABLES_INTRO_JOURNEY",
|
|
4135
4135
|
CIRCLE_TABLES_INFINTE_JOURNEY = "CIRCLE_TABLES_INFINITE_JOURNEY",
|
|
4136
|
-
CIRCLE_LESSONS_INTRO_JOURNEY = "CIRCLE_LESSONS_INTRO_JOURNEY",
|
|
4137
4136
|
CIRCLE_STREAK_REDUCTION_JOURNEY = "CIRCLE_STREAK_REDUCTION_JOURNEY",
|
|
4138
4137
|
HOMEPAGE_JOURNEY = "HOMEPAGE_JOURNEY",
|
|
4139
4138
|
CHAPTER_PAGE_JOURNEY = "CHAPTER_PAGE_JOURNEY"
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../../../../../src/features/circle-games/game-launcher/hooks/use-game-launcher-lessons-journey/constants.ts"],"sourcesContent":["export const DELAY_FOR_LESSON_TOOLTIP = 500;\n\nexport const DELAY_FOR_LESSON_NUDGE = 2000;\n"],"names":["DELAY_FOR_LESSON_TOOLTIP","DELAY_FOR_LESSON_NUDGE"],"mappings":"AAAO,MAAMA,IAA2B,KAE3BC,IAAyB;"}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { jsx as i, Fragment as G } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as U, useCallback as a, useMemo as k, useEffect as w } from "react";
|
|
3
|
-
import { PLATFORM_EVENTS_STUDENT as b } from "../../../../analytics-events/platform-events-student.js";
|
|
4
|
-
import { JOURNEY_ID_STUDENT as B } from "../../../../journey/journey-id/journey-id-student.js";
|
|
5
|
-
import { IndicatorType as P } from "../../../../journey/use-journey/constants.js";
|
|
6
|
-
import { useJourney as J } from "../../../../journey/use-journey/use-journey.js";
|
|
7
|
-
import { useUIContext as F } from "../../../../ui/context/context.js";
|
|
8
|
-
import H from "../../../../ui/layout/flex-view.js";
|
|
9
|
-
import D from "../../../../ui/text/text.js";
|
|
10
|
-
import { getTheme as M } from "../../../../ui/theme/get-theme.js";
|
|
11
|
-
import { CIRCLE_ONBOARDING_ANALYTICS_STEPS as V } from "../../../enum/circle-onboarding-steps.js";
|
|
12
|
-
import { SegmentedGameCard as W } from "../../comps/segmented-game-card/segmented-game-card.js";
|
|
13
|
-
import { DELAY_FOR_LESSON_TOOLTIP as j, DELAY_FOR_LESSON_NUDGE as $ } from "./constants.js";
|
|
14
|
-
import { ProjectType as K } from "../../../games/web-view/enums/project-type-enum.js";
|
|
15
|
-
const le = ({
|
|
16
|
-
onSegmentClick: u,
|
|
17
|
-
onJourneyComplete: s,
|
|
18
|
-
lessonRefs: r
|
|
19
|
-
}) => {
|
|
20
|
-
const t = B.CIRCLE_LESSONS_INTRO_JOURNEY, { device: Y } = M(), c = Y === "mobile", T = c ? "ab3-bold" : "ab2-bold", m = U([]), { nextCoachmark: l, setJourney: p, endJourney: h } = J(), { onEvent: n } = F(), E = a(
|
|
21
|
-
(e) => {
|
|
22
|
-
n(b.ONBOARDING_STEP_VIEWED, {
|
|
23
|
-
step: e
|
|
24
|
-
});
|
|
25
|
-
},
|
|
26
|
-
[n]
|
|
27
|
-
), g = a(
|
|
28
|
-
(e) => {
|
|
29
|
-
n(b.ONBOARDING_STEP_COMPLETED, {
|
|
30
|
-
step: e
|
|
31
|
-
});
|
|
32
|
-
},
|
|
33
|
-
[n]
|
|
34
|
-
), f = a(
|
|
35
|
-
(e) => {
|
|
36
|
-
u(e, K.LESSON), g(V.SKILL_ACTIVITY), h(t), s(t);
|
|
37
|
-
},
|
|
38
|
-
[h, t, s, u, g]
|
|
39
|
-
), O = a(
|
|
40
|
-
(e) => {
|
|
41
|
-
var S, C, N, R, y, A;
|
|
42
|
-
if (!e)
|
|
43
|
-
return;
|
|
44
|
-
const _ = ((N = (C = (S = r.current) == null ? void 0 : S.labelRef) == null ? void 0 : C.current) == null ? void 0 : N.getBoundingClientRect()) || {
|
|
45
|
-
height: 0,
|
|
46
|
-
width: 0
|
|
47
|
-
}, I = ((A = (y = (R = r.current) == null ? void 0 : R.segmentedCardWrapperRef) == null ? void 0 : y.current) == null ? void 0 : A.getBoundingClientRect()) || {
|
|
48
|
-
height: 0,
|
|
49
|
-
width: 0
|
|
50
|
-
};
|
|
51
|
-
let L = [];
|
|
52
|
-
r.current && (L = [
|
|
53
|
-
{
|
|
54
|
-
originalElementToHighlightRef: r.current.labelRef,
|
|
55
|
-
isActive: !1,
|
|
56
|
-
type: P.TOOLTIP,
|
|
57
|
-
elementToHighlight: /* @__PURE__ */ i(G, {}),
|
|
58
|
-
indicator: {
|
|
59
|
-
position: "top",
|
|
60
|
-
backgroundColor: "BLUE_4",
|
|
61
|
-
tooltipItem: /* @__PURE__ */ i(H, { children: /* @__PURE__ */ i(D, { $renderAs: T, children: "Get faster & stay ahead in school. Practice 3 new skills everyday." }) }),
|
|
62
|
-
tooltipXCoOrdinates: _.width / 2,
|
|
63
|
-
tooltipYCoOrdinates: _.height + 10
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
originalElementToHighlightRef: r.current.segmentedCardWrapperRef,
|
|
68
|
-
isActive: !1,
|
|
69
|
-
type: P.NUDGE,
|
|
70
|
-
elementToHighlight: /* @__PURE__ */ i(
|
|
71
|
-
W,
|
|
72
|
-
{
|
|
73
|
-
label: "",
|
|
74
|
-
value: e.data.filter((o) => o.status === "pending").length,
|
|
75
|
-
maxValue: e.data.length,
|
|
76
|
-
initialValue: e.initialProgressValue,
|
|
77
|
-
data: e.data.map((o) => ({
|
|
78
|
-
card: o.cardLottie,
|
|
79
|
-
name: "",
|
|
80
|
-
// We dont want to show the name of the puzzle in onboarding
|
|
81
|
-
isCompleted: o.status === "completed",
|
|
82
|
-
onPress: () => f(o)
|
|
83
|
-
}))
|
|
84
|
-
}
|
|
85
|
-
),
|
|
86
|
-
indicator: {
|
|
87
|
-
nudge: "click",
|
|
88
|
-
content: !c && /* @__PURE__ */ i(D, { $renderAs: "ab1", $color: "WHITE", children: "Tap here to get started" }),
|
|
89
|
-
nudgePointerX: I.width * 0.6,
|
|
90
|
-
nudgePointerY: I.height * 0.4
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
]), p(t, L);
|
|
94
|
-
const d = setTimeout(() => {
|
|
95
|
-
E(V.SKILL_ACTIVITY), clearTimeout(d), l(t);
|
|
96
|
-
}, j), x = setTimeout(() => {
|
|
97
|
-
clearTimeout(d), l(t, !0);
|
|
98
|
-
}, $);
|
|
99
|
-
m.current.push(d, x);
|
|
100
|
-
},
|
|
101
|
-
[
|
|
102
|
-
r,
|
|
103
|
-
p,
|
|
104
|
-
t,
|
|
105
|
-
T,
|
|
106
|
-
c,
|
|
107
|
-
f,
|
|
108
|
-
E,
|
|
109
|
-
l
|
|
110
|
-
]
|
|
111
|
-
), v = k(
|
|
112
|
-
() => ({
|
|
113
|
-
startJourney: O
|
|
114
|
-
}),
|
|
115
|
-
[O]
|
|
116
|
-
);
|
|
117
|
-
return w(() => () => {
|
|
118
|
-
m.current.forEach((e) => clearTimeout(e)), m.current = [];
|
|
119
|
-
}, []), v;
|
|
120
|
-
};
|
|
121
|
-
export {
|
|
122
|
-
le as useGameLauncherLessonsJourney
|
|
123
|
-
};
|
|
124
|
-
//# sourceMappingURL=use-game-launcher-lessons-journey.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-game-launcher-lessons-journey.js","sources":["../../../../../../src/features/circle-games/game-launcher/hooks/use-game-launcher-lessons-journey/use-game-launcher-lessons-journey.tsx"],"sourcesContent":["import type { ICoachmarkProps } from '../../../../journey/use-journey/journey-context-types';\nimport type { IArrowTooltipProps } from '../../../../ui/arrow-tooltip/arrow-tooltip-types';\nimport type { INudgeProps } from '../../../../ui/nudge/nudge-types';\nimport type {\n IProject,\n Lesson,\n} from '../../dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport type { IUseGameLauncherLessonsJourneyProps } from './use-game-launcher-lessons-journey-types';\n\nimport { useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport { PLATFORM_EVENTS_STUDENT as AnalyticsLabel } from '../../../../analytics-events/platform-events-student';\nimport { JOURNEY_ID_STUDENT } from '../../../../journey/journey-id/journey-id-student';\nimport { IndicatorType } from '../../../../journey/use-journey/constants';\nimport { useJourney } from '../../../../journey/use-journey/use-journey';\nimport { useUIContext } from '../../../../ui/context/context';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport { getTheme } from '../../../../ui/theme/get-theme';\nimport { CIRCLE_ONBOARDING_ANALYTICS_STEPS as ActionEvent } from '../../../enum/circle-onboarding-steps';\nimport { ProjectType } from '../../../games/web-view/enums';\nimport { SegmentedGameCard } from '../../comps/segmented-game-card/segmented-game-card';\nimport { DELAY_FOR_LESSON_NUDGE, DELAY_FOR_LESSON_TOOLTIP } from './constants';\n\nexport const useGameLauncherLessonsJourney = ({\n onSegmentClick,\n onJourneyComplete,\n lessonRefs,\n}: IUseGameLauncherLessonsJourneyProps) => {\n const journeyId = JOURNEY_ID_STUDENT.CIRCLE_LESSONS_INTRO_JOURNEY;\n\n const { device } = getTheme();\n const isMobile = device === 'mobile';\n const tooltipTextRenderAs = isMobile ? 'ab3-bold' : 'ab2-bold';\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\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 handleEndJourney = useCallback(\n (lessonsData: Lesson) => {\n onSegmentClick(lessonsData, ProjectType.LESSON);\n trackEventCompleted(ActionEvent.SKILL_ACTIVITY);\n endJourney(journeyId);\n onJourneyComplete(journeyId);\n },\n [endJourney, journeyId, onJourneyComplete, onSegmentClick, trackEventCompleted],\n );\n\n const startJourney = useCallback(\n (lessonsData: IProject<Lesson>) => {\n // If element refs are not available return, this is just for type safety\n if (!lessonsData) {\n return;\n }\n\n const lessonLabelDims = lessonRefs.current?.labelRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n\n const launcherDims =\n lessonRefs.current?.segmentedCardWrapperRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n\n let lessonSteps: ICoachmarkProps[] = [];\n\n if (lessonRefs.current) {\n lessonSteps = [\n {\n originalElementToHighlightRef: lessonRefs.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'top',\n backgroundColor: 'BLUE_4',\n tooltipItem: (\n <FlexView>\n <Text $renderAs={tooltipTextRenderAs}>\n Get faster & stay ahead in school. Practice 3 new skills everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: lessonLabelDims.width / 2,\n tooltipYCoOrdinates: lessonLabelDims.height + 10,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: lessonRefs.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={lessonsData.data.filter(lesson => lesson.status === 'pending').length}\n maxValue={lessonsData.data.length}\n initialValue={lessonsData.initialProgressValue}\n data={lessonsData.data.map(lesson => ({\n card: lesson.cardLottie,\n name: '', // We dont want to show the name of the puzzle in onboarding\n isCompleted: lesson.status === 'completed',\n onPress: () => handleEndJourney(lesson),\n }))}\n />\n ),\n indicator: {\n nudge: 'click',\n content: !isMobile && (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Tap here to get started\n </Text>\n ),\n nudgePointerX: launcherDims.width * 0.6,\n nudgePointerY: launcherDims.height * 0.4,\n } as INudgeProps,\n },\n ];\n }\n\n setJourney(journeyId, lessonSteps);\n\n const delayBeforeStart = setTimeout(() => {\n trackEventViewed(ActionEvent.SKILL_ACTIVITY);\n clearTimeout(delayBeforeStart);\n nextCoachmark(journeyId);\n }, DELAY_FOR_LESSON_TOOLTIP);\n\n const delayForToolTip = setTimeout(() => {\n clearTimeout(delayBeforeStart);\n nextCoachmark(journeyId, true);\n }, DELAY_FOR_LESSON_NUDGE);\n\n timerRefs.current.push(delayBeforeStart, delayForToolTip); // Store to cleanup later\n },\n [\n lessonRefs,\n setJourney,\n journeyId,\n tooltipTextRenderAs,\n isMobile,\n handleEndJourney,\n trackEventViewed,\n nextCoachmark,\n ],\n );\n\n const data = useMemo(\n () => ({\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 };\n }, []);\n\n return data;\n};\n"],"names":["useGameLauncherLessonsJourney","onSegmentClick","onJourneyComplete","lessonRefs","journeyId","JOURNEY_ID_STUDENT","device","getTheme","isMobile","tooltipTextRenderAs","timerRefs","useRef","nextCoachmark","setJourney","endJourney","useJourney","trackAnalytics","useUIContext","trackEventViewed","useCallback","step","AnalyticsLabel","trackEventCompleted","handleEndJourney","lessonsData","ProjectType","ActionEvent","startJourney","lessonLabelDims","_c","_b","_a","launcherDims","_f","_e","_d","lessonSteps","IndicatorType","jsx","Fragment","FlexView","Text","SegmentedGameCard","lesson","delayBeforeStart","DELAY_FOR_LESSON_TOOLTIP","delayForToolTip","DELAY_FOR_LESSON_NUDGE","data","useMemo","useEffect","timer"],"mappings":";;;;;;;;;;;;;;AAwBO,MAAMA,KAAgC,CAAC;AAAA,EAC5C,gBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,YAAAC;AACF,MAA2C;AACzC,QAAMC,IAAYC,EAAmB,8BAE/B,EAAE,QAAAC,MAAWC,KACbC,IAAWF,MAAW,UACtBG,IAAsBD,IAAW,aAAa,YAC9CE,IAAYC,EAAwC,CAAA,CAAE,GAEtD,EAAE,eAAAC,GAAe,YAAAC,GAAY,YAAAC,MAAeC,EAAW,GACvD,EAAE,SAASC,EAAe,IAAIC,EAAa,GAE3CC,IAAmBC;AAAA,IACvB,CAACC,MAAsB;AACrB,MAAAJ,EAAeK,EAAe,wBAAwB;AAAA,QACpD,MAAAD;AAAA,MAAA,CACD;AAAA,IACH;AAAA,IACA,CAACJ,CAAc;AAAA,EAAA,GA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