@cuemath/leap 2.9.7-rj-0 → 2.9.7-rj-1
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/hooks/use-game-launcher-journey/use-game-launcher-journey.js +119 -109
- 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 +107 -97
- package/dist/features/circle-games/game-launcher/hooks/use-table-launcher-journey/use-table-launcher-journey.js.map +1 -1
- package/dist/features/circle-games/games/tutorial/tutorial.js +25 -19
- package/dist/features/circle-games/games/tutorial/tutorial.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
@@ -1,217 +1,227 @@
|
|
1
|
-
import { jsx as t, Fragment as
|
2
|
-
import { useRef as
|
3
|
-
import
|
4
|
-
import { PLATFORM_EVENTS_STUDENT as
|
5
|
-
import { useBreakpoint as
|
6
|
-
import { JOURNEY_ID_STUDENT as
|
7
|
-
import { IndicatorType as
|
8
|
-
import { useJourney as
|
9
|
-
import
|
10
|
-
import { useUIContext as
|
11
|
-
import
|
12
|
-
import
|
13
|
-
import { CIRCLE_ONBOARDING_ANALYTICS_STEPS as
|
14
|
-
import { useCircleSounds as
|
15
|
-
import { SegmentedGameCard as
|
16
|
-
import { GAME_LAUNCHER_ANALYTICS_EVENTS as
|
17
|
-
import { GO_TO_NEXT_SLIDE_AFTER_MS as
|
18
|
-
import { ProjectType as
|
19
|
-
const
|
1
|
+
import { jsx as t, Fragment as y } from "react/jsx-runtime";
|
2
|
+
import { useRef as R, useCallback as E, useMemo as de, useEffect as se } from "react";
|
3
|
+
import re from "../../../../../assets/line-icons/icons/carat-right.js";
|
4
|
+
import { PLATFORM_EVENTS_STUDENT as ne } from "../../../../analytics-events/platform-events-student.js";
|
5
|
+
import { useBreakpoint as me } from "../../../../hooks/use-breakpoint/use-breakpoint.js";
|
6
|
+
import { JOURNEY_ID_STUDENT as he } from "../../../../journey/journey-id/journey-id-student.js";
|
7
|
+
import { IndicatorType as a } from "../../../../journey/use-journey/constants.js";
|
8
|
+
import { useJourney as ue } from "../../../../journey/use-journey/use-journey.js";
|
9
|
+
import oe from "../../../../ui/buttons/icon-button/icon-button.js";
|
10
|
+
import { useUIContext as Te } from "../../../../ui/context/context.js";
|
11
|
+
import S from "../../../../ui/layout/flex-view.js";
|
12
|
+
import d from "../../../../ui/text/text.js";
|
13
|
+
import { CIRCLE_ONBOARDING_ANALYTICS_STEPS as p } from "../../../enum/circle-onboarding-steps.js";
|
14
|
+
import { useCircleSounds as ge } from "../../../hooks/use-circle-sounds/use-circle-sounds.js";
|
15
|
+
import { SegmentedGameCard as Ee } from "../../comps/segmented-game-card/segmented-game-card.js";
|
16
|
+
import { GAME_LAUNCHER_ANALYTICS_EVENTS as ie } from "../../game-launcher-analytics-events.js";
|
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 fe } from "../../../games/web-view/enums/project-type-enum.js";
|
19
|
+
const xe = ({
|
20
20
|
carouselRefs: n,
|
21
|
-
onSegmentClick:
|
22
|
-
onJourneyComplete:
|
21
|
+
onSegmentClick: N,
|
22
|
+
onJourneyComplete: b
|
23
23
|
}) => {
|
24
|
-
const o =
|
24
|
+
const o = he.CIRCLE_ACTIVITIES_INTRO_JOURNEY, { isMobile: l } = me(), I = l ? 232 : 264, _ = l ? "ab3-bold" : "ab2-bold", i = R(null), r = R(null), c = R(null), C = R([]), { playButtonSound: P } = ge(), { nextCoachmark: s, setJourney: H, endJourney: k } = ue(), { onEvent: f } = Te(), G = E(
|
25
25
|
(e) => {
|
26
|
-
|
26
|
+
f(ne.ONBOARDING_STEP_VIEWED, {
|
27
27
|
step: e
|
28
28
|
});
|
29
29
|
},
|
30
|
-
[
|
31
|
-
),
|
30
|
+
[f]
|
31
|
+
), U = E(
|
32
32
|
(e) => {
|
33
|
-
|
33
|
+
f(ne.ONBOARDING_STEP_COMPLETED, {
|
34
34
|
step: e
|
35
35
|
});
|
36
36
|
},
|
37
|
-
[
|
38
|
-
),
|
39
|
-
(e,
|
40
|
-
var
|
41
|
-
|
42
|
-
const
|
43
|
-
clearTimeout(
|
44
|
-
},
|
45
|
-
|
37
|
+
[f]
|
38
|
+
), m = E(
|
39
|
+
(e, A, O, L = !1) => {
|
40
|
+
var u, T;
|
41
|
+
L || (P(), (T = n.current) == null || T.goToIndex(((u = n.current) == null ? void 0 : u.currentIndex) + 1), s(o, !1, pe)), G(e);
|
42
|
+
const h = setTimeout(() => {
|
43
|
+
clearTimeout(h), A.startLabelAnimation(O);
|
44
|
+
}, Ie);
|
45
|
+
C.current.push(h), s(o, !0, _e);
|
46
46
|
},
|
47
|
-
[n, o,
|
48
|
-
),
|
47
|
+
[n, o, s, P, G]
|
48
|
+
), Y = E(
|
49
49
|
(e) => {
|
50
|
-
|
50
|
+
N(e, fe.PUZZLE), U(p.PUZZLE_ACTIVITY), k(o), b(o);
|
51
51
|
},
|
52
|
-
[
|
53
|
-
),
|
54
|
-
(e,
|
55
|
-
var
|
56
|
-
if (!((
|
52
|
+
[k, o, b, N, U]
|
53
|
+
), w = E(
|
54
|
+
(e, A) => {
|
55
|
+
var v, V, x, D, M, W, J, X, $, F, Z, j, K, q, Q, z, ee, te;
|
56
|
+
if (!((v = n == null ? void 0 : n.current) != null && v.nextBtnRef.current) || !((V = r == null ? void 0 : r.current) != null && V.segmentedCardWrapperRef.current) || !((x = i == null ? void 0 : i.current) != null && x.labelRef.current) || !((D = r == null ? void 0 : r.current) != null && D.labelRef.current) || !e)
|
57
57
|
return;
|
58
|
-
const
|
58
|
+
const O = ((J = (W = (M = c.current) == null ? void 0 : M.labelRef) == null ? void 0 : W.current) == null ? void 0 : J.getBoundingClientRect()) || {
|
59
59
|
height: 0,
|
60
60
|
width: 0
|
61
|
-
},
|
61
|
+
}, L = ((F = ($ = (X = i.current) == null ? void 0 : X.labelRef) == null ? void 0 : $.current) == null ? void 0 : F.getBoundingClientRect()) || {
|
62
62
|
height: 0,
|
63
63
|
width: 0
|
64
|
-
},
|
64
|
+
}, h = ((K = (j = (Z = r.current) == null ? void 0 : Z.labelRef) == null ? void 0 : j.current) == null ? void 0 : K.getBoundingClientRect()) || {
|
65
65
|
height: 0,
|
66
66
|
width: 0
|
67
|
-
},
|
67
|
+
}, u = ((z = (Q = (q = r.current) == null ? void 0 : q.segmentedCardWrapperRef) == null ? void 0 : Q.current) == null ? void 0 : z.getBoundingClientRect()) || {
|
68
68
|
height: 0,
|
69
69
|
width: 0
|
70
70
|
};
|
71
|
-
let
|
72
|
-
|
71
|
+
let T = [];
|
72
|
+
A && c.current && (T = [
|
73
73
|
{
|
74
|
-
originalElementToHighlightRef:
|
74
|
+
originalElementToHighlightRef: c.current.labelRef,
|
75
75
|
isActive: !1,
|
76
|
-
type:
|
77
|
-
elementToHighlight: /* @__PURE__ */ t(
|
76
|
+
type: a.TOOLTIP,
|
77
|
+
elementToHighlight: /* @__PURE__ */ t(y, {}),
|
78
78
|
indicator: {
|
79
79
|
position: "top",
|
80
80
|
backgroundColor: "BLUE_4",
|
81
|
-
width:
|
82
|
-
tooltipItem: /* @__PURE__ */ t(
|
83
|
-
tooltipXCoOrdinates:
|
84
|
-
tooltipYCoOrdinates:
|
81
|
+
width: I,
|
82
|
+
tooltipItem: /* @__PURE__ */ t(S, { children: /* @__PURE__ */ t(d, { $renderAs: _, children: "Get faster & stay ahead in school. Practice 3 new skills everyday." }) }),
|
83
|
+
tooltipXCoOrdinates: O.width / 2,
|
84
|
+
tooltipYCoOrdinates: O.height + 10
|
85
85
|
}
|
86
86
|
},
|
87
87
|
{
|
88
|
-
originalElementToHighlightRef: (
|
88
|
+
originalElementToHighlightRef: (ee = n.current) == null ? void 0 : ee.nextBtnRef,
|
89
89
|
isActive: !1,
|
90
|
-
type:
|
90
|
+
type: a.NUDGE,
|
91
91
|
elementToHighlight: /* @__PURE__ */ t(
|
92
|
-
|
92
|
+
oe,
|
93
93
|
{
|
94
94
|
renderAs: "secondary",
|
95
|
-
Icon:
|
96
|
-
onClick: () =>
|
97
|
-
|
95
|
+
Icon: re,
|
96
|
+
onClick: () => m(
|
97
|
+
p.GAMES_ACTIVITY,
|
98
98
|
i.current,
|
99
99
|
"ORANGE_4"
|
100
100
|
),
|
101
|
-
analyticsLabel:
|
101
|
+
analyticsLabel: ie.JOURNEY_NEXT_ACTIVITY
|
102
102
|
}
|
103
103
|
),
|
104
104
|
indicator: {
|
105
105
|
nudge: "click",
|
106
|
-
content: !
|
106
|
+
content: !l && /* @__PURE__ */ t(d, { $renderAs: "ab1", $color: "WHITE", children: "Click to proceed" }),
|
107
107
|
nudgePointerX: 0,
|
108
108
|
nudgePointerY: 0
|
109
109
|
}
|
110
110
|
}
|
111
111
|
]);
|
112
|
-
const
|
112
|
+
const ce = [
|
113
113
|
{
|
114
114
|
originalElementToHighlightRef: i.current.labelRef,
|
115
115
|
isActive: !1,
|
116
|
-
type:
|
117
|
-
elementToHighlight: /* @__PURE__ */ t(
|
116
|
+
type: a.TOOLTIP,
|
117
|
+
elementToHighlight: /* @__PURE__ */ t(y, {}),
|
118
118
|
indicator: {
|
119
119
|
position: "top",
|
120
120
|
backgroundColor: "ORANGE_4",
|
121
|
-
width:
|
122
|
-
tooltipItem: /* @__PURE__ */ t(
|
123
|
-
tooltipXCoOrdinates:
|
124
|
-
tooltipYCoOrdinates:
|
121
|
+
width: I,
|
122
|
+
tooltipItem: /* @__PURE__ */ t(S, { children: /* @__PURE__ */ t(d, { $renderAs: _, children: "Train to think deeper & plan ahead. Play 3 new games everyday." }) }),
|
123
|
+
tooltipXCoOrdinates: L.width / 2,
|
124
|
+
tooltipYCoOrdinates: L.height + 10
|
125
125
|
}
|
126
126
|
},
|
127
127
|
{
|
128
128
|
originalElementToHighlightRef: n.current.nextBtnRef,
|
129
129
|
isActive: !1,
|
130
|
-
type:
|
130
|
+
type: a.NUDGE,
|
131
131
|
elementToHighlight: /* @__PURE__ */ t(
|
132
|
-
|
132
|
+
oe,
|
133
133
|
{
|
134
134
|
renderAs: "secondary",
|
135
|
-
Icon:
|
136
|
-
onClick: () =>
|
137
|
-
|
135
|
+
Icon: re,
|
136
|
+
onClick: () => m(
|
137
|
+
p.PUZZLE_ACTIVITY,
|
138
138
|
r.current,
|
139
139
|
"PURPLE_4"
|
140
140
|
),
|
141
|
-
analyticsLabel:
|
141
|
+
analyticsLabel: ie.JOURNEY_NEXT_ACTIVITY
|
142
142
|
}
|
143
143
|
),
|
144
144
|
indicator: {
|
145
145
|
nudge: "click",
|
146
|
-
content: !
|
146
|
+
content: !l && /* @__PURE__ */ t(d, { $renderAs: "ab1", $color: "WHITE", children: "Click to proceed" }),
|
147
147
|
nudgePointerX: 0,
|
148
148
|
nudgePointerY: 0
|
149
149
|
}
|
150
150
|
}
|
151
|
-
],
|
151
|
+
], ae = [
|
152
152
|
{
|
153
153
|
originalElementToHighlightRef: r.current.labelRef,
|
154
154
|
isActive: !1,
|
155
|
-
type:
|
156
|
-
elementToHighlight: /* @__PURE__ */ t(
|
155
|
+
type: a.TOOLTIP,
|
156
|
+
elementToHighlight: /* @__PURE__ */ t(y, {}),
|
157
157
|
indicator: {
|
158
158
|
position: "top",
|
159
159
|
backgroundColor: "PURPLE_4",
|
160
|
-
width:
|
161
|
-
tooltipItem: /* @__PURE__ */ t(
|
162
|
-
tooltipXCoOrdinates:
|
163
|
-
tooltipYCoOrdinates:
|
160
|
+
width: I,
|
161
|
+
tooltipItem: /* @__PURE__ */ t(S, { children: /* @__PURE__ */ t(d, { $renderAs: _, children: "Think in new ways & stay sharp. Solve 3 new puzzles everyday." }) }),
|
162
|
+
tooltipXCoOrdinates: h.width / 2,
|
163
|
+
tooltipYCoOrdinates: h.height + 10
|
164
164
|
}
|
165
165
|
},
|
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
|
+
Ee,
|
172
172
|
{
|
173
173
|
label: "",
|
174
|
-
value: e.data.filter((
|
174
|
+
value: e.data.filter((g) => g.solved).length,
|
175
175
|
maxValue: e.data.length,
|
176
176
|
initialValue: e.initialProgressValue,
|
177
|
-
data: e.data.map((
|
178
|
-
card:
|
177
|
+
data: e.data.map((g) => ({
|
178
|
+
card: g.cardLottie,
|
179
179
|
name: "",
|
180
180
|
// We dont want to show the name of the puzzle in onboarding
|
181
|
-
isCompleted:
|
182
|
-
onPress: () =>
|
181
|
+
isCompleted: g.solved,
|
182
|
+
onPress: () => Y(g)
|
183
183
|
}))
|
184
184
|
}
|
185
185
|
),
|
186
186
|
indicator: {
|
187
187
|
nudge: "click",
|
188
|
-
content: !
|
189
|
-
nudgePointerX:
|
190
|
-
nudgePointerY:
|
188
|
+
content: !l && /* @__PURE__ */ t(d, { $renderAs: "ab1", $color: "WHITE", children: "Click to solve a puzzle" }),
|
189
|
+
nudgePointerX: u.width * 0.6,
|
190
|
+
nudgePointerY: u.height * 0.4
|
191
191
|
}
|
192
192
|
}
|
193
193
|
];
|
194
|
-
|
195
|
-
const
|
196
|
-
clearTimeout(
|
197
|
-
},
|
198
|
-
|
194
|
+
H(o, [...T, ...ce, ...ae]), (te = n.current) == null || te.goToIndex(0);
|
195
|
+
const B = setTimeout(() => {
|
196
|
+
clearTimeout(B), s(o);
|
197
|
+
}, Ce);
|
198
|
+
C.current.push(B), A && c.current ? m(p.SKILL_ACTIVITY, c.current, "BLUE_4", !0) : m(p.GAMES_ACTIVITY, i.current, "ORANGE_4", !0);
|
199
199
|
},
|
200
|
-
[
|
201
|
-
|
200
|
+
[
|
201
|
+
n,
|
202
|
+
I,
|
203
|
+
_,
|
204
|
+
l,
|
205
|
+
H,
|
206
|
+
o,
|
207
|
+
m,
|
208
|
+
Y,
|
209
|
+
s
|
210
|
+
]
|
211
|
+
), le = de(
|
202
212
|
() => ({
|
203
213
|
gameRefs: i,
|
204
214
|
puzzleRefs: r,
|
205
|
-
lessonRefs:
|
206
|
-
startJourney:
|
215
|
+
lessonRefs: c,
|
216
|
+
startJourney: w
|
207
217
|
}),
|
208
|
-
[
|
218
|
+
[w]
|
209
219
|
);
|
210
|
-
return
|
211
|
-
|
212
|
-
}, [n]),
|
220
|
+
return se(() => () => {
|
221
|
+
C.current.forEach((e) => clearTimeout(e)), C.current = [];
|
222
|
+
}, [n]), le;
|
213
223
|
};
|
214
224
|
export {
|
215
|
-
|
225
|
+
xe as useGameLauncherJourney
|
216
226
|
};
|
217
227
|
//# sourceMappingURL=use-game-launcher-journey.js.map
|
@@ -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 { useBreakpoint } from '../../../../hooks/use-breakpoint/use-breakpoint';\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 { 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 { isMobile } = useBreakpoint();\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 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 / 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 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 / 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 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 / 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 [carouselRefs, isMobile, setJourney, journeyId, goToNextCard, handleEndJourney, nextCoachmark],\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","isMobile","useBreakpoint","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,UAAAC,MAAaC,MAEfC,IAAWC,EAA+B,IAAI,GAC9CC,IAAaD,EAA+B,IAAI,GAChDE,IAAaF,EAA+B,IAAI,GAChDG,IAAYH,EAAwC,CAAA,CAAE,GAEtD,EAAE,iBAAAI,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,IAAwB,OACrB;;AACH,MAAKA,MACajB,MAChBkB,IAAA9B,EAAa,YAAb,QAAA8B,EAAsB,YAAUC,IAAA/B,EAAa,YAAb,gBAAA+B,EAAsB,gBAAe,IACvDjB,EAAAX,GAAW,IAAO6B,EAAyB,IAG3DZ,EAAiBM,CAAoB;AAE/B,YAAAO,I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EAAW,SAAS,UAAU,EAAI,IAE3Ee,EAAac,EAAY,gBAAgBhC,EAAS,SAAS,YAAY,EAAI;AAAA,IAE/E;AAAA,IACA,CAACP,GAAcK,GAAUU,GAAYZ,GAAWsB,GAAcW,GAAkBtB,CAAa;AAAA,EAAA,GAGzF+D,KAAOC;AAAA,IACX,OAAO;AAAA,MACL,UAAAvE;AAAA,MACA,YAAAE;AAAA,MACA,YAAAC;AAAA,MACA,cAAA8B;AAAA,IAAA;AAAA,IAEF,CAACA,CAAY;AAAA,EAAA;AAIf,SAAAuC,GAAU,MACD,MAAM;AACX,IAAApE,EAAU,QAAQ,QAAQ,CAASqE,MAAA,aAAaA,CAAK,CAAC,GACtDrE,EAAU,UAAU;EAAC,GAEtB,CAACX,CAAY,CAAC,GAEV6E;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 { 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 { useBreakpoint } from '../../../../hooks/use-breakpoint/use-breakpoint';\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 { 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 { isMobile } = useBreakpoint();\n\n const tooltipWidth = isMobile ? 232 : 264;\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 width: tooltipWidth,\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 width: tooltipWidth,\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 width: tooltipWidth,\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 tooltipWidth,\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","isMobile","useBreakpoint","tooltipWidth","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,UAAAC,MAAaC,MAEfC,IAAeF,IAAW,MAAM,KAChCG,IAAsBH,IAAW,aAAa,YAE9CI,IAAWC,EAA+B,IAAI,GAC9CC,IAAaD,EAA+B,IAAI,GAChDE,IAAaF,EAA+B,IAAI,GAChDG,IAAYH,EAAwC,CAAA,CAAE,GAEtD,EAAE,iBAAAI,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,IAAwB,OACrB;;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A4E,GAAS,UAAU;AAE1B,YAAAC,IAAmB,WAAW,MAAM;AACxC,qBAAaA,CAAgB,GAC7B7D,EAAcb,CAAS;AAAA,SACtB2E,EAAkB;AAEX,MAAAjE,EAAA,QAAQ,KAAKgE,CAAgB,GAEnClC,KAAqB/B,EAAW,UAClCe,EAAac,EAAY,gBAAgB7B,EAAW,SAAS,UAAU,EAAI,IAE3Ee,EAAac,EAAY,gBAAgBhC,EAAS,SAAS,YAAY,EAAI;AAAA,IAE/E;AAAA,IACA;AAAA,MACET;AAAA,MACAO;AAAA,MACAC;AAAA,MACAH;AAAA,MACAY;AAAA,MACAd;AAAA,MACAwB;AAAA,MACAW;AAAA,MACAtB;AAAA,IACF;AAAA,EAAA,GAGI+D,KAAOC;AAAA,IACX,OAAO;AAAA,MACL,UAAAvE;AAAA,MACA,YAAAE;AAAA,MACA,YAAAC;AAAA,MACA,cAAA8B;AAAA,IAAA;AAAA,IAEF,CAACA,CAAY;AAAA,EAAA;AAIf,SAAAuC,GAAU,MACD,MAAM;AACX,IAAApE,EAAU,QAAQ,QAAQ,CAASqE,MAAA,aAAaA,CAAK,CAAC,GACtDrE,EAAU,UAAU;EAAC,GAEtB,CAACb,CAAY,CAAC,GAEV+E;AACT;"}
|
@@ -1,122 +1,130 @@
|
|
1
|
-
import { jsx as r, Fragment as
|
2
|
-
import { useRef as
|
3
|
-
import
|
4
|
-
import { PLATFORM_EVENTS_STUDENT as
|
5
|
-
import { useBreakpoint as
|
6
|
-
import { JOURNEY_ID_STUDENT as
|
7
|
-
import { IndicatorType as
|
8
|
-
import { useJourney as
|
9
|
-
import
|
10
|
-
import { useUIContext as
|
11
|
-
import
|
12
|
-
import
|
13
|
-
import { CIRCLE_ONBOARDING_ANALYTICS_STEPS as
|
14
|
-
import { useCircleSounds as
|
15
|
-
import { TablesCard as
|
16
|
-
import { GAME_LAUNCHER_ANALYTICS_EVENTS as
|
17
|
-
import { SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS as
|
18
|
-
import { Indicator as
|
19
|
-
const
|
1
|
+
import { jsx as r, Fragment as N } from "react/jsx-runtime";
|
2
|
+
import { useRef as S, useCallback as I, useEffect as j } from "react";
|
3
|
+
import Z from "../../../../../assets/line-icons/icons/carat-right.js";
|
4
|
+
import { PLATFORM_EVENTS_STUDENT as x } from "../../../../analytics-events/platform-events-student.js";
|
5
|
+
import { useBreakpoint as q } from "../../../../hooks/use-breakpoint/use-breakpoint.js";
|
6
|
+
import { JOURNEY_ID_STUDENT as z } from "../../../../journey/journey-id/journey-id-student.js";
|
7
|
+
import { IndicatorType as u } from "../../../../journey/use-journey/constants.js";
|
8
|
+
import { useJourney as Q } from "../../../../journey/use-journey/use-journey.js";
|
9
|
+
import ee from "../../../../ui/buttons/icon-button/icon-button.js";
|
10
|
+
import { useUIContext as te } from "../../../../ui/context/context.js";
|
11
|
+
import P from "../../../../ui/layout/flex-view.js";
|
12
|
+
import T from "../../../../ui/text/text.js";
|
13
|
+
import { CIRCLE_ONBOARDING_ANALYTICS_STEPS as $ } from "../../../enum/circle-onboarding-steps.js";
|
14
|
+
import { useCircleSounds as re } from "../../../hooks/use-circle-sounds/use-circle-sounds.js";
|
15
|
+
import { TablesCard as w } from "../../comps/tables-card/tables-card.js";
|
16
|
+
import { GAME_LAUNCHER_ANALYTICS_EVENTS as ne } from "../../game-launcher-analytics-events.js";
|
17
|
+
import { SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS as oe, SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS as ie, START_ANIMATING_CLONED_ELEM as F, TABLE_CARD_INDEX as V, GO_TO_TABLE_LAUNCHER_DURATION_MS as le, SHOW_CLICK_TABLE_NUDGE_AFTER_MS as ce, PUZZLE_CARD_INDEX as ae, SHOW_INITIAL_COACHMARK_AFTER_MS as X, LESSON_CARD_INDEX as se, SHOW_INITIAL_TOOLTIP_AFTER_MS as de } from "./constants.js";
|
18
|
+
import { Indicator as ue } from "./use-table-launcher-journey-styled.js";
|
19
|
+
const He = ({
|
20
20
|
carouselRefs: a,
|
21
|
-
onTableSegmentClick:
|
22
|
-
onJourneyComplete:
|
21
|
+
onTableSegmentClick: H,
|
22
|
+
onJourneyComplete: y
|
23
23
|
}) => {
|
24
|
-
const e =
|
24
|
+
const e = z.CIRCLE_TABLES_INTRO_JOURNEY, { isMobile: s } = q(), t = S(null), A = S(null), g = S([]), { playButtonSound: D } = re(), { nextCoachmark: l, setJourney: R, addCoachmark: m, endJourney: W } = Q(), { onEvent: C } = te(), L = s ? 232 : 264, E = s ? "ab3-bold" : "ab2-bold", O = I(
|
25
25
|
(n) => {
|
26
26
|
var c, o;
|
27
|
-
|
28
|
-
step:
|
29
|
-
}), (c = t == null ? void 0 : t.current) == null || c.setLabelVisiblity(!0), (o = t == null ? void 0 : t.current) == null || o.stopLabelAnimation(),
|
27
|
+
W(e), n && H(n), C(x.ONBOARDING_STEP_COMPLETED, {
|
28
|
+
step: $.TABLES
|
29
|
+
}), (c = t == null ? void 0 : t.current) == null || c.setLabelVisiblity(!0), (o = t == null ? void 0 : t.current) == null || o.stopLabelAnimation(), y(e);
|
30
30
|
},
|
31
|
-
[
|
32
|
-
),
|
31
|
+
[W, e, y, H, C]
|
32
|
+
), k = I(
|
33
33
|
(n, c) => {
|
34
|
-
var
|
35
|
-
if (!((
|
34
|
+
var h, p, _;
|
35
|
+
if (!((h = t.current) != null && h.segmentedCardWrapperRef.current) || !((p = t.current) != null && p.labelRef.current))
|
36
36
|
return;
|
37
|
-
const o = t.current.labelRef.current.getBoundingClientRect(), i = (
|
38
|
-
|
37
|
+
const o = t.current.labelRef.current.getBoundingClientRect(), i = (_ = t.current) == null ? void 0 : _.segmentedCardWrapperRef.current.getBoundingClientRect();
|
38
|
+
m(e, {
|
39
39
|
originalElementToHighlightRef: t.current.segmentedCardWrapperRef,
|
40
40
|
isActive: !1,
|
41
|
-
type:
|
41
|
+
type: u.TOOLTIP,
|
42
42
|
elementToHighlight: /* @__PURE__ */ r(
|
43
|
-
|
43
|
+
w,
|
44
44
|
{
|
45
|
-
ref:
|
45
|
+
ref: A,
|
46
46
|
defaultTable: c,
|
47
47
|
label: n.label,
|
48
48
|
data: n.data,
|
49
|
-
onPress:
|
50
|
-
onGoBackFromTableLevel:
|
49
|
+
onPress: O,
|
50
|
+
onGoBackFromTableLevel: O
|
51
51
|
}
|
52
52
|
),
|
53
53
|
indicator: {
|
54
54
|
position: "top",
|
55
55
|
backgroundColor: "YELLOW_4",
|
56
|
-
width:
|
57
|
-
tooltipItem: /* @__PURE__ */ r(
|
56
|
+
width: L,
|
57
|
+
tooltipItem: /* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(T, { $renderAs: E, children: "Each table has 3 levels—clear them and earn 3 stars!" }) }),
|
58
58
|
tooltipXCoOrdinates: o.width / 2,
|
59
59
|
tooltipYCoOrdinates: 45
|
60
60
|
}
|
61
|
-
}),
|
61
|
+
}), m(e, {
|
62
62
|
originalElementToHighlightRef: t.current.segmentedCardWrapperRef,
|
63
63
|
isActive: !1,
|
64
|
-
type:
|
64
|
+
type: u.NUDGE,
|
65
65
|
indicator: {
|
66
66
|
nudge: "click",
|
67
|
-
content: !
|
67
|
+
content: !s && /* @__PURE__ */ r(T, { $renderAs: "ab1", $color: "WHITE", children: "Pick a level" }),
|
68
68
|
nudgePointerX: i.width / 2 + 50,
|
69
69
|
nudgePointerY: i.height * 0.4
|
70
70
|
},
|
71
|
-
elementToHighlight: /* @__PURE__ */ r(
|
72
|
-
}), l(e, !1,
|
73
|
-
const
|
74
|
-
var
|
75
|
-
clearTimeout(
|
76
|
-
},
|
77
|
-
g.current.push(
|
71
|
+
elementToHighlight: /* @__PURE__ */ r(N, {})
|
72
|
+
}), l(e, !1, oe), l(e, !0, ie);
|
73
|
+
const d = setTimeout(() => {
|
74
|
+
var f;
|
75
|
+
clearTimeout(d), (f = A.current) == null || f.startLabelAnimation("YELLOW_4");
|
76
|
+
}, F);
|
77
|
+
g.current.push(d);
|
78
78
|
},
|
79
|
-
[
|
80
|
-
|
79
|
+
[
|
80
|
+
m,
|
81
|
+
O,
|
82
|
+
s,
|
83
|
+
e,
|
84
|
+
l,
|
85
|
+
E,
|
86
|
+
L
|
87
|
+
]
|
88
|
+
), b = I(() => {
|
81
89
|
var o;
|
82
|
-
|
83
|
-
step:
|
90
|
+
D(), (o = a.current) == null || o.goToIndex(V), l(e, !1, le), C(x.ONBOARDING_STEP_VIEWED, {
|
91
|
+
step: $.TABLES
|
84
92
|
});
|
85
93
|
const n = setTimeout(() => {
|
86
94
|
var i;
|
87
95
|
clearTimeout(n), (i = t.current) == null || i.setLabelVisiblity(!1), l(e, !0);
|
88
|
-
},
|
96
|
+
}, ce);
|
89
97
|
g.current.push(n);
|
90
98
|
const c = setTimeout(() => {
|
91
99
|
var i;
|
92
|
-
clearTimeout(c), (i =
|
93
|
-
},
|
100
|
+
clearTimeout(c), (i = A.current) == null || i.startLabelAnimation("YELLOW_4");
|
101
|
+
}, F);
|
94
102
|
g.current.push(c);
|
95
|
-
}, [a, e, l,
|
103
|
+
}, [a, e, l, D, C]), J = I(
|
96
104
|
(n, c = !1) => {
|
97
|
-
var
|
98
|
-
const o = (
|
99
|
-
if (!((
|
105
|
+
var _, f, B, Y, U, G, v, M;
|
106
|
+
const o = (_ = a.current) == null ? void 0 : _.indicatorRefs, i = (f = a.current) == null ? void 0 : f.nextBtnRef, d = o == null ? void 0 : o[V];
|
107
|
+
if (!((B = t.current) != null && B.segmentedCardWrapperRef.current) || !((Y = t.current) != null && Y.labelRef.current) || !o || !(i != null && i.current) || !d || !d.current)
|
100
108
|
return;
|
101
|
-
const
|
102
|
-
c ? (
|
109
|
+
const h = t.current.labelRef.current.getBoundingClientRect(), p = (U = t.current) == null ? void 0 : U.segmentedCardWrapperRef.current.getBoundingClientRect();
|
110
|
+
c ? (R(e, [
|
103
111
|
{
|
104
|
-
originalElementToHighlightRef:
|
112
|
+
originalElementToHighlightRef: d,
|
105
113
|
isActive: !1,
|
106
|
-
type:
|
107
|
-
elementToHighlight: /* @__PURE__ */ r(
|
114
|
+
type: u.TOOLTIP,
|
115
|
+
elementToHighlight: /* @__PURE__ */ r(ue, { $isActive: !1 }),
|
108
116
|
indicator: {
|
109
117
|
position: "bottom",
|
110
118
|
backgroundColor: "YELLOW_4",
|
111
119
|
width: 52,
|
112
120
|
tooltipItem: /* @__PURE__ */ r(
|
113
|
-
|
121
|
+
P,
|
114
122
|
{
|
115
123
|
$position: "absolute",
|
116
124
|
$flexDirection: "row",
|
117
125
|
style: { top: 6, left: 8, cursor: "pointer" },
|
118
126
|
onClick: b,
|
119
|
-
children: /* @__PURE__ */ r(
|
127
|
+
children: /* @__PURE__ */ r(T, { $renderAs: E, children: "NEW" })
|
120
128
|
}
|
121
129
|
),
|
122
130
|
tooltipYCoOrdinates: 14
|
@@ -124,92 +132,94 @@ const Se = ({
|
|
124
132
|
}
|
125
133
|
},
|
126
134
|
{
|
127
|
-
originalElementToHighlightRef:
|
135
|
+
originalElementToHighlightRef: d,
|
128
136
|
isActive: !1,
|
129
|
-
type:
|
137
|
+
type: u.NUDGE,
|
130
138
|
indicator: {
|
131
139
|
nudge: "click",
|
132
140
|
content: "",
|
133
141
|
nudgePointerY: 20
|
134
142
|
},
|
135
|
-
elementToHighlight: /* @__PURE__ */ r(
|
143
|
+
elementToHighlight: /* @__PURE__ */ r(N, {})
|
136
144
|
}
|
137
|
-
]), (
|
145
|
+
]), (M = a.current) == null || M.goToIndex(se), l(e, !1, X), l(e, !0, de)) : (R(e, [
|
138
146
|
{
|
139
|
-
originalElementToHighlightRef: (
|
147
|
+
originalElementToHighlightRef: (G = a.current) == null ? void 0 : G.nextBtnRef,
|
140
148
|
isActive: !1,
|
141
|
-
type:
|
149
|
+
type: u.NUDGE,
|
142
150
|
indicator: {
|
143
151
|
nudge: "click",
|
144
|
-
content: !
|
152
|
+
content: !s && /* @__PURE__ */ r(T, { $renderAs: "ab1", $color: "WHITE", children: "Click to proceed" }),
|
145
153
|
nudgePointerX: 0,
|
146
154
|
nudgePointerY: 0
|
147
155
|
},
|
148
156
|
elementToHighlight: /* @__PURE__ */ r(
|
149
|
-
|
157
|
+
ee,
|
150
158
|
{
|
151
159
|
renderAs: "secondary",
|
152
|
-
Icon:
|
160
|
+
Icon: Z,
|
153
161
|
onClick: b,
|
154
|
-
analyticsLabel:
|
162
|
+
analyticsLabel: ne.JOURNEY_NEXT_ACTIVITY
|
155
163
|
}
|
156
164
|
)
|
157
165
|
}
|
158
|
-
]), (
|
166
|
+
]), (v = a.current) == null || v.goToIndex(ae), l(e, !1, X)), m(e, {
|
159
167
|
originalElementToHighlightRef: t.current.labelRef,
|
160
168
|
isActive: !1,
|
161
|
-
type:
|
162
|
-
elementToHighlight: /* @__PURE__ */ r(
|
169
|
+
type: u.TOOLTIP,
|
170
|
+
elementToHighlight: /* @__PURE__ */ r(N, {}),
|
163
171
|
indicator: {
|
164
172
|
position: "top",
|
165
173
|
backgroundColor: "YELLOW_4",
|
166
|
-
width:
|
167
|
-
tooltipItem: /* @__PURE__ */ r(
|
168
|
-
tooltipXCoOrdinates:
|
169
|
-
tooltipYCoOrdinates:
|
174
|
+
width: L,
|
175
|
+
tooltipItem: /* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(T, { $renderAs: E, children: "Get faster at multiplication! Practice everyday and become a Tables champ." }) }),
|
176
|
+
tooltipXCoOrdinates: h.width / 2,
|
177
|
+
tooltipYCoOrdinates: h.height + 10
|
170
178
|
}
|
171
|
-
}),
|
179
|
+
}), m(e, {
|
172
180
|
originalElementToHighlightRef: t.current.segmentedCardWrapperRef,
|
173
181
|
isActive: !1,
|
174
|
-
type:
|
182
|
+
type: u.NUDGE,
|
175
183
|
indicator: {
|
176
184
|
nudge: "click",
|
177
|
-
content: !
|
178
|
-
nudgePointerX:
|
179
|
-
nudgePointerY:
|
185
|
+
content: !s && /* @__PURE__ */ r(T, { $renderAs: "ab1", $color: "WHITE", children: "Pick a table to start" }),
|
186
|
+
nudgePointerX: p.width / 2 + 50,
|
187
|
+
nudgePointerY: p.height / 2
|
180
188
|
},
|
181
189
|
elementToHighlight: /* @__PURE__ */ r(
|
182
|
-
|
190
|
+
w,
|
183
191
|
{
|
184
|
-
ref:
|
192
|
+
ref: A,
|
185
193
|
label: n.label,
|
186
194
|
data: n.data,
|
187
195
|
onPress: () => {
|
188
196
|
},
|
189
|
-
onPressTableSegment: (
|
197
|
+
onPressTableSegment: (K) => k(n, K)
|
190
198
|
}
|
191
199
|
)
|
192
200
|
});
|
193
201
|
},
|
194
202
|
[
|
195
|
-
|
203
|
+
m,
|
196
204
|
a,
|
197
205
|
b,
|
198
|
-
|
199
|
-
|
206
|
+
k,
|
207
|
+
s,
|
200
208
|
e,
|
201
209
|
l,
|
210
|
+
R,
|
211
|
+
E,
|
202
212
|
L
|
203
213
|
]
|
204
214
|
);
|
205
|
-
return
|
215
|
+
return j(() => () => {
|
206
216
|
g.current.forEach((n) => clearTimeout(n)), g.current = [];
|
207
217
|
}, [e]), {
|
208
218
|
tableRef: t,
|
209
|
-
startJourney:
|
219
|
+
startJourney: J
|
210
220
|
};
|
211
221
|
};
|
212
222
|
export {
|
213
|
-
|
223
|
+
He as useTableLauncherJourney
|
214
224
|
};
|
215
225
|
//# sourceMappingURL=use-table-launcher-journey.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-table-launcher-journey.js","sources":["../../../../../../src/features/circle-games/game-launcher/hooks/use-table-launcher-journey/use-table-launcher-journey.tsx"],"sourcesContent":["/* eslint-disable react-native/no-inline-styles */\nimport type { IArrowTooltipProps } from '../../../../ui/arrow-tooltip/arrow-tooltip-types';\nimport type { INudgeProps } from '../../../../ui/nudge/nudge-types';\nimport type { ITableCardRef, ITableDetails } from '../../comps/tables-card/tables-card-types';\nimport type {\n ITableInfo,\n ITables,\n} from '../../dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport type { IUseTableJourneyProps } from './use-table-launcher-journey-types';\n\nimport { useCallback, useEffect, useRef } from 'react';\n\nimport CaratRightIcon from '../../../../../assets/line-icons/icons/carat-right';\nimport { PLATFORM_EVENTS_STUDENT } from '../../../../analytics-events/platform-events-student';\nimport { useBreakpoint } from '../../../../hooks/use-breakpoint/use-breakpoint';\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 { CIRCLE_ONBOARDING_ANALYTICS_STEPS as Action } from '../../../enum/circle-onboarding-steps';\nimport { useCircleSounds } from '../../../hooks/use-circle-sounds/use-circle-sounds';\nimport { TablesCard } from '../../comps/tables-card/tables-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from '../../game-launcher-analytics-events';\nimport {\n LESSON_CARD_INDEX,\n PUZZLE_CARD_INDEX,\n SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS,\n SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS,\n TABLE_CARD_INDEX,\n} from './constants';\nimport {\n GO_TO_TABLE_LAUNCHER_DURATION_MS,\n SHOW_CLICK_TABLE_NUDGE_AFTER_MS,\n SHOW_INITIAL_COACHMARK_AFTER_MS,\n SHOW_INITIAL_TOOLTIP_AFTER_MS,\n START_ANIMATING_CLONED_ELEM,\n} from './constants';\nimport * as S from './use-table-launcher-journey-styled';\n\nexport const useTableLauncherJourney = ({\n carouselRefs,\n onTableSegmentClick,\n onJourneyComplete,\n}: IUseTableJourneyProps) => {\n const journeyId = JOURNEY_ID_STUDENT.CIRCLE_TABLES_INTRO_JOURNEY;\n const { isMobile } = useBreakpoint();\n\n const originalTableRef = useRef<ITableCardRef>(null);\n const highlightedTableRef = useRef<ITableCardRef>(null);\n\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const { playButtonSound } = useCircleSounds();\n const { nextCoachmark, setJourney, addCoachmark, endJourney } = useJourney();\n const { onEvent: trackAnalytics } = useUIContext();\n\n const handleEndJourney = useCallback(\n (tableDetails?: ITableDetails) => {\n endJourney(journeyId);\n // Only when User clicked on play\n if (tableDetails) {\n onTableSegmentClick(tableDetails);\n }\n trackAnalytics(PLATFORM_EVENTS_STUDENT.ONBOARDING_STEP_COMPLETED, {\n step: Action.TABLES,\n });\n\n // Reset original table card ref label\n originalTableRef?.current?.setLabelVisiblity(true);\n originalTableRef?.current?.stopLabelAnimation();\n onJourneyComplete(journeyId);\n },\n [endJourney, journeyId, onJourneyComplete, onTableSegmentClick, trackAnalytics],\n );\n\n const handleTableSegmentClick = useCallback(\n (launcherData: ITables, tableData: ITableInfo) => {\n if (\n !originalTableRef.current?.segmentedCardWrapperRef.current ||\n !originalTableRef.current?.labelRef.current\n ) {\n return;\n }\n\n const segmentedCardDims = originalTableRef.current.labelRef.current.getBoundingClientRect();\n const tableCardDims =\n originalTableRef.current?.segmentedCardWrapperRef.current.getBoundingClientRect();\n\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: (\n <TablesCard\n ref={highlightedTableRef}\n defaultTable={tableData}\n label={launcherData.label}\n data={launcherData.data}\n onPress={handleEndJourney}\n onGoBackFromTableLevel={handleEndJourney}\n />\n ),\n indicator: {\n position: 'top',\n backgroundColor: 'YELLOW_4',\n width: 236,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">Each table has 3 levels—clear them and earn 3 stars!</Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: segmentedCardDims.width / 2,\n tooltipYCoOrdinates: 45,\n } as IArrowTooltipProps,\n });\n\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: !isMobile && (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Pick a level\n </Text>\n ),\n nudgePointerX: tableCardDims.width / 2 + 50,\n nudgePointerY: tableCardDims.height * 0.4,\n } as INudgeProps,\n elementToHighlight: <></>,\n });\n\n nextCoachmark(journeyId, false, SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS); // Show coachmark => Each table has 3... and Hide the previous two\n nextCoachmark(journeyId, true, SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS); // Show nudge => Pick a level\n\n const startAnimationOnLabelAgain = setTimeout(() => {\n clearTimeout(startAnimationOnLabelAgain);\n highlightedTableRef.current?.startLabelAnimation('YELLOW_4');\n }, START_ANIMATING_CLONED_ELEM);\n\n timerRefs.current.push(startAnimationOnLabelAgain);\n },\n [addCoachmark, handleEndJourney, isMobile, journeyId, nextCoachmark],\n );\n\n const goToTableLauncher = useCallback(() => {\n playButtonSound();\n carouselRefs.current?.goToIndex(TABLE_CARD_INDEX);\n nextCoachmark(journeyId, false, GO_TO_TABLE_LAUNCHER_DURATION_MS);\n\n trackAnalytics(PLATFORM_EVENTS_STUDENT.ONBOARDING_STEP_VIEWED, {\n step: Action.TABLES,\n });\n\n const showNudge = setTimeout(() => {\n clearTimeout(showNudge);\n originalTableRef.current?.setLabelVisiblity(false);\n nextCoachmark(journeyId, true);\n }, SHOW_CLICK_TABLE_NUDGE_AFTER_MS);\n\n timerRefs.current.push(showNudge);\n\n const animateLabel = setTimeout(() => {\n clearTimeout(animateLabel);\n highlightedTableRef.current?.startLabelAnimation('YELLOW_4');\n }, START_ANIMATING_CLONED_ELEM);\n\n timerRefs.current.push(animateLabel);\n }, [carouselRefs, journeyId, nextCoachmark, playButtonSound, trackAnalytics]);\n\n const startJourney = useCallback(\n (tablesData: ITables, isTutorialOnboardingDone: boolean = false) => {\n const paginationList = carouselRefs.current?.indicatorRefs;\n const carouselNextBtnRef = carouselRefs.current?.nextBtnRef;\n const tablePaginationRef = paginationList?.[TABLE_CARD_INDEX];\n\n if (\n !originalTableRef.current?.segmentedCardWrapperRef.current ||\n !originalTableRef.current?.labelRef.current ||\n !paginationList ||\n !carouselNextBtnRef?.current ||\n !tablePaginationRef ||\n !tablePaginationRef.current\n ) {\n return;\n }\n\n const labelDims = originalTableRef.current.labelRef.current.getBoundingClientRect();\n const tableCardDims =\n originalTableRef.current?.segmentedCardWrapperRef.current.getBoundingClientRect();\n\n // TAKE THE USER TO THE TABLE CARD\n if (!isTutorialOnboardingDone) {\n setJourney(journeyId, [\n {\n originalElementToHighlightRef: carouselRefs.current?.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\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 elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={goToTableLauncher}\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\n },\n ]);\n carouselRefs.current?.goToIndex(PUZZLE_CARD_INDEX);\n nextCoachmark(journeyId, false, SHOW_INITIAL_COACHMARK_AFTER_MS); // Show nudge => Click to proceed\n } else {\n setJourney(journeyId, [\n {\n originalElementToHighlightRef: tablePaginationRef as React.RefObject<HTMLDivElement>,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <S.Indicator $isActive={false} />,\n indicator: {\n position: 'bottom',\n backgroundColor: 'YELLOW_4',\n width: 52,\n tooltipItem: (\n <FlexView\n $position=\"absolute\"\n $flexDirection=\"row\"\n style={{ top: 6, left: 8, cursor: 'pointer' }}\n onClick={goToTableLauncher}\n >\n <Text $renderAs=\"ab2-bold\">NEW</Text>\n </FlexView>\n ),\n tooltipYCoOrdinates: 14, // Need some offset in Y direction from top\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: tablePaginationRef as React.RefObject<HTMLDivElement>,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: '',\n nudgePointerY: 20,\n } as INudgeProps,\n elementToHighlight: <></>,\n },\n ]);\n carouselRefs.current?.goToIndex(LESSON_CARD_INDEX);\n nextCoachmark(journeyId, false, SHOW_INITIAL_COACHMARK_AFTER_MS); // Show Coachmark => NEW\n nextCoachmark(journeyId, true, SHOW_INITIAL_TOOLTIP_AFTER_MS); // Show Nudge over Coachmark\n }\n\n // SHOW THE USER SELECT A TABLE\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'top',\n backgroundColor: 'YELLOW_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Get faster at multiplication! Practice everyday and become a Tables champ.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: labelDims.width / 2,\n tooltipYCoOrdinates: labelDims.height + 10,\n } as IArrowTooltipProps,\n });\n\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: !isMobile && (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n {'Pick a table to start'}\n </Text>\n ),\n nudgePointerX: tableCardDims.width / 2 + 50,\n nudgePointerY: tableCardDims.height / 2,\n } as INudgeProps,\n elementToHighlight: (\n <TablesCard\n ref={highlightedTableRef}\n label={tablesData.label}\n data={tablesData.data}\n onPress={() => {}}\n onPressTableSegment={tableInfo => handleTableSegmentClick(tablesData, tableInfo)}\n />\n ),\n });\n },\n [\n addCoachmark,\n carouselRefs,\n goToTableLauncher,\n handleTableSegmentClick,\n isMobile,\n journeyId,\n nextCoachmark,\n setJourney,\n ],\n );\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n timerRefs.current.forEach(timer => clearTimeout(timer));\n timerRefs.current = [];\n };\n }, [journeyId]);\n\n return {\n tableRef: originalTableRef,\n startJourney,\n };\n};\n"],"names":["useTableLauncherJourney","carouselRefs","onTableSegmentClick","onJourneyComplete","journeyId","JOURNEY_ID_STUDENT","isMobile","useBreakpoint","originalTableRef","useRef","highlightedTableRef","timerRefs","playButtonSound","useCircleSounds","nextCoachmark","setJourney","addCoachmark","endJourney","useJourney","trackAnalytics","useUIContext","handleEndJourney","useCallback","tableDetails","PLATFORM_EVENTS_STUDENT","Action","_a","_b","handleTableSegmentClick","launcherData","tableData","segmentedCardDims","tableCardDims","_c","IndicatorType","jsx","TablesCard","FlexView","Text","Fragment","SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS","SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS","startAnimationOnLabelAgain","START_ANIMATING_CLONED_ELEM","goToTableLauncher","TABLE_CARD_INDEX","GO_TO_TABLE_LAUNCHER_DURATION_MS","showNudge","SHOW_CLICK_TABLE_NUDGE_AFTER_MS","animateLabel","startJourney","tablesData","isTutorialOnboardingDone","paginationList","carouselNextBtnRef","tablePaginationRef","_d","labelDims","_e","S.Indicator","_h","LESSON_CARD_INDEX","SHOW_INITIAL_COACHMARK_AFTER_MS","SHOW_INITIAL_TOOLTIP_AFTER_MS","_f","IconButton","CaratRightIcon","GAME_LAUNCHER_ANALYTICS_EVENTS","_g","PUZZLE_CARD_INDEX","tableInfo","useEffect","timer"],"mappings":";;;;;;;;;;;;;;;;;;AA0CO,MAAMA,KAA0B,CAAC;AAAA,EACtC,cAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,mBAAAC;AACF,MAA6B;AAC3B,QAAMC,IAAYC,EAAmB,6BAC/B,EAAE,UAAAC,MAAaC,KAEfC,IAAmBC,EAAsB,IAAI,GAC7CC,IAAsBD,EAAsB,IAAI,GAEhDE,IAAYF,EAAwC,CAAA,CAAE,GAEtD,EAAE,iBAAAG,MAAoBC,MACtB,EAAE,eAAAC,GAAe,YAAAC,GAAY,cA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,UACT,UAAU;AAAA,UACV,iBAAiB;AAAA,UACjB,OAAO;AAAA,UACP,+BACGF,GACC,EAAA,UAAA,gBAAAF,EAACG,KAAK,WAAU,YAAW,wFAE3B,EACF,CAAA;AAAA,UAEF,qBAAqBmB,EAAU,QAAQ;AAAA,UACvC,qBAAqBA,EAAU,SAAS;AAAA,QAC1C;AAAA,MAAA,CACD,GAEDzC,EAAaZ,GAAW;AAAA,QACtB,+BAA+BI,EAAiB,QAAQ;AAAA,QACxD,UAAU;AAAA,QACV,MAAM0B,EAAc;AAAA,QACpB,WAAW;AAAA,UACT,OAAO;AAAA,UACP,SAAS,CAAC5B,KACR,gBAAA6B,EAACG,KAAK,WAAU,OAAM,QAAO,SAC1B,UACH,wBAAA,CAAA;AAAA,UAEF,eAAeN,EAAc,QAAQ,IAAI;AAAA,UACzC,eAAeA,EAAc,SAAS;AAAA,QACxC;AAAA,QACA,oBACE,gBAAAG;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,KAAK1B;AAAA,YACL,OAAOyC,EAAW;AAAA,YAClB,MAAMA,EAAW;AAAA,YACjB,SAAS,MAAM;AAAA,YAAC;AAAA,YAChB,qBAAqB,CAAAmB,MAAa1C,EAAwBuB,GAAYmB,CAAS;AAAA,UAAA;AAAA,QACjF;AAAA,MAAA,CAEH;AAAA,IACH;AAAA,IACA;AAAA,MACEtD;AAAA,MACAf;AAAA,MACA2C;AAAA,MACAhB;AAAA,MACAtB;AAAA,MACAF;AAAA,MACAU;AAAA,MACAC;AAAA,IACF;AAAA,EAAA;AAIF,SAAAwD,EAAU,MACD,MAAM;AACX,IAAA5D,EAAU,QAAQ,QAAQ,CAAS6D,MAAA,aAAaA,CAAK,CAAC,GACtD7D,EAAU,UAAU;EAAC,GAEtB,CAACP,CAAS,CAAC,GAEP;AAAA,IACL,UAAUI;AAAA,IACV,cAAA0C;AAAA,EAAA;AAEJ;"}
|
1
|
+
{"version":3,"file":"use-table-launcher-journey.js","sources":["../../../../../../src/features/circle-games/game-launcher/hooks/use-table-launcher-journey/use-table-launcher-journey.tsx"],"sourcesContent":["/* eslint-disable react-native/no-inline-styles */\nimport type { IArrowTooltipProps } from '../../../../ui/arrow-tooltip/arrow-tooltip-types';\nimport type { INudgeProps } from '../../../../ui/nudge/nudge-types';\nimport type { ITableCardRef, ITableDetails } from '../../comps/tables-card/tables-card-types';\nimport type {\n ITableInfo,\n ITables,\n} from '../../dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport type { IUseTableJourneyProps } from './use-table-launcher-journey-types';\n\nimport { useCallback, useEffect, useRef } from 'react';\n\nimport CaratRightIcon from '../../../../../assets/line-icons/icons/carat-right';\nimport { PLATFORM_EVENTS_STUDENT } from '../../../../analytics-events/platform-events-student';\nimport { useBreakpoint } from '../../../../hooks/use-breakpoint/use-breakpoint';\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 { CIRCLE_ONBOARDING_ANALYTICS_STEPS as Action } from '../../../enum/circle-onboarding-steps';\nimport { useCircleSounds } from '../../../hooks/use-circle-sounds/use-circle-sounds';\nimport { TablesCard } from '../../comps/tables-card/tables-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from '../../game-launcher-analytics-events';\nimport {\n LESSON_CARD_INDEX,\n PUZZLE_CARD_INDEX,\n SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS,\n SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS,\n TABLE_CARD_INDEX,\n} from './constants';\nimport {\n GO_TO_TABLE_LAUNCHER_DURATION_MS,\n SHOW_CLICK_TABLE_NUDGE_AFTER_MS,\n SHOW_INITIAL_COACHMARK_AFTER_MS,\n SHOW_INITIAL_TOOLTIP_AFTER_MS,\n START_ANIMATING_CLONED_ELEM,\n} from './constants';\nimport * as S from './use-table-launcher-journey-styled';\n\nexport const useTableLauncherJourney = ({\n carouselRefs,\n onTableSegmentClick,\n onJourneyComplete,\n}: IUseTableJourneyProps) => {\n const journeyId = JOURNEY_ID_STUDENT.CIRCLE_TABLES_INTRO_JOURNEY;\n const { isMobile } = useBreakpoint();\n\n const originalTableRef = useRef<ITableCardRef>(null);\n const highlightedTableRef = useRef<ITableCardRef>(null);\n\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const { playButtonSound } = useCircleSounds();\n const { nextCoachmark, setJourney, addCoachmark, endJourney } = useJourney();\n const { onEvent: trackAnalytics } = useUIContext();\n\n const tooltipWidth = isMobile ? 232 : 264;\n const tooltipTextRenderAs = isMobile ? 'ab3-bold' : 'ab2-bold';\n\n const handleEndJourney = useCallback(\n (tableDetails?: ITableDetails) => {\n endJourney(journeyId);\n // Only when User clicked on play\n if (tableDetails) {\n onTableSegmentClick(tableDetails);\n }\n trackAnalytics(PLATFORM_EVENTS_STUDENT.ONBOARDING_STEP_COMPLETED, {\n step: Action.TABLES,\n });\n\n // Reset original table card ref label\n originalTableRef?.current?.setLabelVisiblity(true);\n originalTableRef?.current?.stopLabelAnimation();\n onJourneyComplete(journeyId);\n },\n [endJourney, journeyId, onJourneyComplete, onTableSegmentClick, trackAnalytics],\n );\n\n const handleTableSegmentClick = useCallback(\n (launcherData: ITables, tableData: ITableInfo) => {\n if (\n !originalTableRef.current?.segmentedCardWrapperRef.current ||\n !originalTableRef.current?.labelRef.current\n ) {\n return;\n }\n\n const segmentedCardDims = originalTableRef.current.labelRef.current.getBoundingClientRect();\n const tableCardDims =\n originalTableRef.current?.segmentedCardWrapperRef.current.getBoundingClientRect();\n\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: (\n <TablesCard\n ref={highlightedTableRef}\n defaultTable={tableData}\n label={launcherData.label}\n data={launcherData.data}\n onPress={handleEndJourney}\n onGoBackFromTableLevel={handleEndJourney}\n />\n ),\n indicator: {\n position: 'top',\n backgroundColor: 'YELLOW_4',\n width: tooltipWidth,\n tooltipItem: (\n <FlexView>\n <Text $renderAs={tooltipTextRenderAs}>\n Each table has 3 levels—clear them and earn 3 stars!\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: segmentedCardDims.width / 2,\n tooltipYCoOrdinates: 45,\n } as IArrowTooltipProps,\n });\n\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: !isMobile && (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Pick a level\n </Text>\n ),\n nudgePointerX: tableCardDims.width / 2 + 50,\n nudgePointerY: tableCardDims.height * 0.4,\n } as INudgeProps,\n elementToHighlight: <></>,\n });\n\n nextCoachmark(journeyId, false, SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS); // Show coachmark => Each table has 3... and Hide the previous two\n nextCoachmark(journeyId, true, SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS); // Show nudge => Pick a level\n\n const startAnimationOnLabelAgain = setTimeout(() => {\n clearTimeout(startAnimationOnLabelAgain);\n highlightedTableRef.current?.startLabelAnimation('YELLOW_4');\n }, START_ANIMATING_CLONED_ELEM);\n\n timerRefs.current.push(startAnimationOnLabelAgain);\n },\n [\n addCoachmark,\n handleEndJourney,\n isMobile,\n journeyId,\n nextCoachmark,\n tooltipTextRenderAs,\n tooltipWidth,\n ],\n );\n\n const goToTableLauncher = useCallback(() => {\n playButtonSound();\n carouselRefs.current?.goToIndex(TABLE_CARD_INDEX);\n nextCoachmark(journeyId, false, GO_TO_TABLE_LAUNCHER_DURATION_MS);\n\n trackAnalytics(PLATFORM_EVENTS_STUDENT.ONBOARDING_STEP_VIEWED, {\n step: Action.TABLES,\n });\n\n const showNudge = setTimeout(() => {\n clearTimeout(showNudge);\n originalTableRef.current?.setLabelVisiblity(false);\n nextCoachmark(journeyId, true);\n }, SHOW_CLICK_TABLE_NUDGE_AFTER_MS);\n\n timerRefs.current.push(showNudge);\n\n const animateLabel = setTimeout(() => {\n clearTimeout(animateLabel);\n highlightedTableRef.current?.startLabelAnimation('YELLOW_4');\n }, START_ANIMATING_CLONED_ELEM);\n\n timerRefs.current.push(animateLabel);\n }, [carouselRefs, journeyId, nextCoachmark, playButtonSound, trackAnalytics]);\n\n const startJourney = useCallback(\n (tablesData: ITables, isTutorialOnboardingDone: boolean = false) => {\n const paginationList = carouselRefs.current?.indicatorRefs;\n const carouselNextBtnRef = carouselRefs.current?.nextBtnRef;\n const tablePaginationRef = paginationList?.[TABLE_CARD_INDEX];\n\n if (\n !originalTableRef.current?.segmentedCardWrapperRef.current ||\n !originalTableRef.current?.labelRef.current ||\n !paginationList ||\n !carouselNextBtnRef?.current ||\n !tablePaginationRef ||\n !tablePaginationRef.current\n ) {\n return;\n }\n\n const labelDims = originalTableRef.current.labelRef.current.getBoundingClientRect();\n const tableCardDims =\n originalTableRef.current?.segmentedCardWrapperRef.current.getBoundingClientRect();\n\n // TAKE THE USER TO THE TABLE CARD\n if (!isTutorialOnboardingDone) {\n setJourney(journeyId, [\n {\n originalElementToHighlightRef: carouselRefs.current?.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\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 elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={goToTableLauncher}\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\n },\n ]);\n carouselRefs.current?.goToIndex(PUZZLE_CARD_INDEX);\n nextCoachmark(journeyId, false, SHOW_INITIAL_COACHMARK_AFTER_MS); // Show nudge => Click to proceed\n } else {\n setJourney(journeyId, [\n {\n originalElementToHighlightRef: tablePaginationRef as React.RefObject<HTMLDivElement>,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <S.Indicator $isActive={false} />,\n indicator: {\n position: 'bottom',\n backgroundColor: 'YELLOW_4',\n width: 52,\n tooltipItem: (\n <FlexView\n $position=\"absolute\"\n $flexDirection=\"row\"\n style={{ top: 6, left: 8, cursor: 'pointer' }}\n onClick={goToTableLauncher}\n >\n <Text $renderAs={tooltipTextRenderAs}>NEW</Text>\n </FlexView>\n ),\n tooltipYCoOrdinates: 14, // Need some offset in Y direction from top\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: tablePaginationRef as React.RefObject<HTMLDivElement>,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: '',\n nudgePointerY: 20,\n } as INudgeProps,\n elementToHighlight: <></>,\n },\n ]);\n carouselRefs.current?.goToIndex(LESSON_CARD_INDEX);\n nextCoachmark(journeyId, false, SHOW_INITIAL_COACHMARK_AFTER_MS); // Show Coachmark => NEW\n nextCoachmark(journeyId, true, SHOW_INITIAL_TOOLTIP_AFTER_MS); // Show Nudge over Coachmark\n }\n\n // SHOW THE USER SELECT A TABLE\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'top',\n backgroundColor: 'YELLOW_4',\n width: tooltipWidth,\n tooltipItem: (\n <FlexView>\n <Text $renderAs={tooltipTextRenderAs}>\n Get faster at multiplication! Practice everyday and become a Tables champ.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: labelDims.width / 2,\n tooltipYCoOrdinates: labelDims.height + 10,\n } as IArrowTooltipProps,\n });\n\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: !isMobile && (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n {'Pick a table to start'}\n </Text>\n ),\n nudgePointerX: tableCardDims.width / 2 + 50,\n nudgePointerY: tableCardDims.height / 2,\n } as INudgeProps,\n elementToHighlight: (\n <TablesCard\n ref={highlightedTableRef}\n label={tablesData.label}\n data={tablesData.data}\n onPress={() => {}}\n onPressTableSegment={tableInfo => handleTableSegmentClick(tablesData, tableInfo)}\n />\n ),\n });\n },\n [\n addCoachmark,\n carouselRefs,\n goToTableLauncher,\n handleTableSegmentClick,\n isMobile,\n journeyId,\n nextCoachmark,\n setJourney,\n tooltipTextRenderAs,\n tooltipWidth,\n ],\n );\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n timerRefs.current.forEach(timer => clearTimeout(timer));\n timerRefs.current = [];\n };\n }, [journeyId]);\n\n return {\n tableRef: originalTableRef,\n startJourney,\n };\n};\n"],"names":["useTableLauncherJourney","carouselRefs","onTableSegmentClick","onJourneyComplete","journeyId","JOURNEY_ID_STUDENT","isMobile","useBreakpoint","originalTableRef","useRef","highlightedTableRef","timerRefs","playButtonSound","useCircleSounds","nextCoachmark","setJourney","addCoachmark","endJourney","useJourney","trackAnalytics","useUIContext","tooltipWidth","tooltipTextRenderAs","handleEndJourney","useCallback","tableDetails","PLATFORM_EVENTS_STUDENT","Action","_a","_b","handleTableSegmentClick","launcherData","tableData","segmentedCardDims","tableCardDims","_c","IndicatorType","jsx","TablesCard","FlexView","Text","Fragment","SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS","SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS","startAnimationOnLabelAgain","START_ANIMATING_CLONED_ELEM","goToTableLauncher","TABLE_CARD_INDEX","GO_TO_TABLE_LAUNCHER_DURATION_MS","showNudge","SHOW_CLICK_TABLE_NUDGE_AFTER_MS","animateLabel","startJourney","tablesData","isTutorialOnboardingDone","paginationList","carouselNextBtnRef","tablePaginationRef","_d","labelDims","_e","S.Indicator","_h","LESSON_CARD_INDEX","SHOW_INITIAL_COACHMARK_AFTER_MS","SHOW_INITIAL_TOOLTIP_AFTER_MS","_f","IconButton","CaratRightIcon","GAME_LAUNCHER_ANALYTICS_EVENTS","_g","PUZZLE_CARD_INDEX","tableInfo","useEffect","timer"],"mappings":";;;;;;;;;;;;;;;;;;AA0CO,MAAMA,KAA0B,CAAC;AAAA,EACtC,cAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,mBAAAC;AACF,MAA6B;AAC3B,QAAMC,IAAYC,EAAmB,6BAC/B,EAAE,UAAAC,MAAaC,KAEfC,IAAmBC,EAAsB,IAAI,GAC7CC,IAAsBD,EAAsB,IAAI,GAEhDE,IAAYF,EAAwC,CAAA,CAAE,GAEtD,EAAE,iBAAAG,MAAoBC,MACtB,EAAE,eAAAC,GAAe,YAAAC,GAAY,cAAAC,GAAc,YAAAC,EAAA,IAAeC,KAC1D,EAAE,SAASC,EAAe,IAAIC,GAAa,GAE3CC,IAAef,IAAW,MAAM,KAChCgB,IAAsBhB,IAAW,aAAa,YAE9CiB,IAAmBC;AAAA,IACvB,CAACC,MAAiC;;AAChC,MAAAR,EAAWb,CAAS,GAEhBqB,KACFvB,EAAoBuB,CAAY,GAElCN,EAAeO,EAAwB,2BAA2B;AAAA,QAChE,MAAMC,EAAO;AAAA,MAAA,CACd,IAGiBC,IAAApB,KAAA,gBAAAA,EAAA,YAAA,QAAAoB,EAAS,kBAAkB,MAC7CC,IAAArB,KAAA,gBAAAA,EAAkB,YAAlB,QAAAqB,EAA2B,sBAC3B1B,EAAkBC,CAAS;AAAA,IAC7B;AAAA,IACA,CAACa,GAAYb,GAAWD,GAAmBD,GAAqBiB,CAAc;AAAA,EAAA,GAG1EW,IAA0BN;AAAA,IAC9B,CAACO,GAAuBC,MAA0B;;AAE9C,UAAA,GAACJ,IAAApB,EAAiB,YAAjB,QAAAoB,EAA0B,wBAAw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Ac,SAAS;AAAA,QACxC;AAAA,QACA,oBACE,gBAAAG;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,KAAK5B;AAAA,YACL,OAAO2C,EAAW;AAAA,YAClB,MAAMA,EAAW;AAAA,YACjB,SAAS,MAAM;AAAA,YAAC;AAAA,YAChB,qBAAqB,CAAAmB,MAAa1C,EAAwBuB,GAAYmB,CAAS;AAAA,UAAA;AAAA,QACjF;AAAA,MAAA,CAEH;AAAA,IACH;AAAA,IACA;AAAA,MACExD;AAAA,MACAf;AAAA,MACA6C;AAAA,MACAhB;AAAA,MACAxB;AAAA,MACAF;AAAA,MACAU;AAAA,MACAC;AAAA,MACAO;AAAA,MACAD;AAAA,IACF;AAAA,EAAA;AAIF,SAAAoD,EAAU,MACD,MAAM;AACX,IAAA9D,EAAU,QAAQ,QAAQ,CAAS+D,MAAA,aAAaA,CAAK,CAAC,GACtD/D,EAAU,UAAU;EAAC,GAEtB,CAACP,CAAS,CAAC,GAEP;AAAA,IACL,UAAUI;AAAA,IACV,cAAA4C;AAAA,EAAA;AAEJ;"}
|
@@ -1,26 +1,32 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { forwardRef as I, useState as
|
1
|
+
import { jsxs as c, jsx as r } from "react/jsx-runtime";
|
2
|
+
import { forwardRef as I, useState as C, useRef as u, useCallback as V, useImperativeHandle as v } from "react";
|
3
3
|
import x from "../../../../assets/line-icons/icons/cross.js";
|
4
|
-
import
|
5
|
-
import T from "
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
4
|
+
import H from "../../../ui/text/text.js";
|
5
|
+
import { GameTutorialWrapper as T, GameTutorialHeader as $, HeaderIconContainer as G, GameTutorialContainer as P, VideoContainer as R, VideoProgressWrapper as W, VideoProgressContainer as b, VideoProgress as j } from "./tutorial-styled.js";
|
6
|
+
const U = I(
|
7
|
+
({
|
8
|
+
src: m,
|
9
|
+
title: o,
|
10
|
+
onCross: t,
|
11
|
+
showProgress: p = !0,
|
12
|
+
onTutorialPlayedOnce: e,
|
13
|
+
isJourneyActive: f
|
14
|
+
}, l) => {
|
15
|
+
const [i, h] = C(0), n = u(!1), s = u(null), g = V(
|
16
|
+
(a) => {
|
17
|
+
const d = (a.target.currentTime || 0) / (a.target.duration || 1) * 100;
|
18
|
+
d >= 90 && !n.current && (n.current = !0, e == null || e()), h(d);
|
13
19
|
},
|
14
20
|
[e]
|
15
21
|
);
|
16
|
-
return
|
22
|
+
return v(l, () => ({
|
17
23
|
videoRef: s
|
18
|
-
})), /* @__PURE__ */
|
19
|
-
(o || t) && /* @__PURE__ */
|
20
|
-
o && /* @__PURE__ */ r(
|
21
|
-
t && /* @__PURE__ */ r(
|
24
|
+
})), /* @__PURE__ */ c(T, { children: [
|
25
|
+
(o || t) && /* @__PURE__ */ c($, { children: [
|
26
|
+
o && /* @__PURE__ */ r(H, { $renderAs: "ac3", $color: "WHITE", $align: "center", children: o }),
|
27
|
+
t && /* @__PURE__ */ r(G, { children: /* @__PURE__ */ r(x, { color: "#fff", onClick: t }) })
|
22
28
|
] }),
|
23
|
-
/* @__PURE__ */ r(
|
29
|
+
/* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(R, { isJourneyActive: f, children: /* @__PURE__ */ r(
|
24
30
|
"video",
|
25
31
|
{
|
26
32
|
ref: s,
|
@@ -34,11 +40,11 @@ const q = I(
|
|
34
40
|
playsInline: !0
|
35
41
|
}
|
36
42
|
) }) }),
|
37
|
-
p && /* @__PURE__ */ r(
|
43
|
+
p && /* @__PURE__ */ r(W, { children: /* @__PURE__ */ r(b, { children: i > 0 && /* @__PURE__ */ r(j, { $width: i }) }) })
|
38
44
|
] });
|
39
45
|
}
|
40
46
|
);
|
41
47
|
export {
|
42
|
-
|
48
|
+
U as Tutorial
|
43
49
|
};
|
44
50
|
//# sourceMappingURL=tutorial.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"tutorial.js","sources":["../../../../../src/features/circle-games/games/tutorial/tutorial.tsx"],"sourcesContent":["import type { ITutorialProps, ITutorialRef } from './tutorial-types';\nimport type { ChangeEvent } from 'react';\n\nimport { forwardRef, useCallback, useImperativeHandle, useRef, useState } from 'react';\n\nimport CrossIcon from '../../../../assets/line-icons/icons/cross';\nimport
|
1
|
+
{"version":3,"file":"tutorial.js","sources":["../../../../../src/features/circle-games/games/tutorial/tutorial.tsx"],"sourcesContent":["import type { ITutorialProps, ITutorialRef } from './tutorial-types';\nimport type { ChangeEvent } from 'react';\n\nimport { forwardRef, useCallback, useImperativeHandle, useRef, useState } from 'react';\n\nimport CrossIcon from '../../../../assets/line-icons/icons/cross';\nimport Text from '../../../ui/text/text';\nimport * as Styled from './tutorial-styled';\n\nexport const Tutorial = forwardRef<ITutorialRef, ITutorialProps>(\n (\n {\n src,\n title,\n onCross,\n showProgress = true,\n onTutorialPlayedOnce,\n isJourneyActive,\n }: ITutorialProps,\n ref,\n ) => {\n const [progress, setProgress] = useState(0);\n const hasVideoEnded = useRef(false);\n const videoRef = useRef<HTMLVideoElement>(null);\n\n const onProgress = useCallback(\n (e: ChangeEvent<HTMLVideoElement>) => {\n const p = ((e.target.currentTime || 0) / (e.target.duration || 1)) * 100;\n\n if (p >= 90 && !hasVideoEnded.current) {\n hasVideoEnded.current = true;\n onTutorialPlayedOnce?.();\n }\n\n setProgress(p);\n },\n [onTutorialPlayedOnce],\n );\n\n useImperativeHandle(ref, () => ({\n videoRef,\n }));\n\n return (\n <Styled.GameTutorialWrapper>\n {(title || onCross) && (\n <Styled.GameTutorialHeader>\n {title && (\n <Text $renderAs=\"ac3\" $color=\"WHITE\" $align=\"center\">\n {title}\n </Text>\n )}\n {onCross && (\n <Styled.HeaderIconContainer>\n <CrossIcon color=\"#fff\" onClick={onCross} />\n </Styled.HeaderIconContainer>\n )}\n </Styled.GameTutorialHeader>\n )}\n <Styled.GameTutorialContainer>\n <Styled.VideoContainer isJourneyActive={isJourneyActive}>\n <video\n ref={videoRef}\n loop={true}\n autoPlay={true}\n muted={true}\n src={src}\n onTimeUpdate={onProgress}\n disablePictureInPicture={true}\n itemType=\"video/mp4\"\n playsInline\n />\n </Styled.VideoContainer>\n </Styled.GameTutorialContainer>\n\n {showProgress && (\n <Styled.VideoProgressWrapper>\n <Styled.VideoProgressContainer>\n {progress > 0 && <Styled.VideoProgress $width={progress} />}\n </Styled.VideoProgressContainer>\n </Styled.VideoProgressWrapper>\n )}\n </Styled.GameTutorialWrapper>\n );\n },\n);\n"],"names":["Tutorial","forwardRef","src","title","onCross","showProgress","onTutorialPlayedOnce","isJourneyActive","ref","progress","setProgress","useState","hasVideoEnded","useRef","videoRef","onProgress","useCallback","e","p","useImperativeHandle","jsxs","Styled.GameTutorialWrapper","Styled.GameTutorialHeader","jsx","Text","Styled.HeaderIconContainer","CrossIcon","Styled.GameTutorialContainer","Styled.VideoContainer","Styled.VideoProgressWrapper","Styled.VideoProgressContainer","Styled.VideoProgress"],"mappings":";;;;;AASO,MAAMA,IAAWC;AAAA,EACtB,CACE;AAAA,IACE,KAAAC;AAAA,IACA,OAAAC;AAAA,IACA,SAAAC;AAAA,IACA,cAAAC,IAAe;AAAA,IACf,sBAAAC;AAAA,IACA,iBAAAC;AAAA,KAEFC,MACG;AACH,UAAM,CAACC,GAAUC,CAAW,IAAIC,EAAS,CAAC,GACpCC,IAAgBC,EAAO,EAAK,GAC5BC,IAAWD,EAAyB,IAAI,GAExCE,IAAaC;AAAA,MACjB,CAACC,MAAqC;AAC9B,cAAAC,KAAMD,EAAE,OAAO,eAAe,MAAMA,EAAE,OAAO,YAAY,KAAM;AAErE,QAAIC,KAAK,MAAM,CAACN,EAAc,YAC5BA,EAAc,UAAU,IACDN,KAAA,QAAAA,MAGzBI,EAAYQ,CAAC;AAAA,MACf;AAAA,MACA,CAACZ,CAAoB;AAAA,IAAA;AAGvB,WAAAa,EAAoBX,GAAK,OAAO;AAAA,MAC9B,UAAAM;AAAA,IACA,EAAA,GAGA,gBAAAM,EAACC,GAAA,EACG,UAA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