@cuemath/leap 2.8.62-rj-4 → 2.8.62-rj-5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/features/circle-games/game-launcher/game-launcher.js +46 -38
- package/dist/features/circle-games/game-launcher/game-launcher.js.map +1 -1
- package/dist/features/circle-games/game-launcher/hooks/use-table-launcher-journey/use-table-launcher-journey.js +97 -87
- package/dist/features/circle-games/game-launcher/hooks/use-table-launcher-journey/use-table-launcher-journey.js.map +1 -1
- package/dist/features/journey/use-journey/journey-context-provider.js +38 -38
- package/dist/features/journey/use-journey/journey-context-provider.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
@@ -1,24 +1,32 @@
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
2
|
-
import { memo as
|
3
|
-
import { LOTTIE as
|
2
|
+
import { memo as g, useRef as x, useCallback as n, useMemo as h, useEffect as D } from "react";
|
3
|
+
import { LOTTIE as U } from "../../../assets/lottie/lottie.js";
|
4
4
|
import { JOURNEY_ID_STUDENT as z } from "../../journey/journey-id/journey-id-student.js";
|
5
|
-
import { useJourney as
|
6
|
-
import { CircularLoader as
|
7
|
-
import
|
8
|
-
import { useCircleSounds as
|
5
|
+
import { useJourney as Y } from "../../journey/use-journey/use-journey.js";
|
6
|
+
import { CircularLoader as B } from "../../ui/loader/circular-loader/circular-loader.js";
|
7
|
+
import K from "../../ui/lottie-animation/lottie-animation.js";
|
8
|
+
import { useCircleSounds as H } from "../hooks/use-circle-sounds/use-circle-sounds.js";
|
9
9
|
import { CircleSoundKey as u } from "../hooks/use-circle-sounds/use-circle-sounds-enums.js";
|
10
|
-
import { GAME_LAUNCHER_SIZE as
|
10
|
+
import { GAME_LAUNCHER_SIZE as Z } from "./comps/card-container/constants.js";
|
11
11
|
import { Carousel as G } from "./comps/carousel/carousel.js";
|
12
|
-
import { GAME_LAUNCHER_ASSET_PADDING as
|
13
|
-
import { SegmentedGameCard as
|
14
|
-
import { TablesCard as
|
12
|
+
import { GAME_LAUNCHER_ASSET_PADDING as w } 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 X } from "./comps/tables-card/tables-card.js";
|
15
15
|
import { GAME_LAUNCHER_ANALYTICS_EVENTS as V } from "./game-launcher-analytics-events.js";
|
16
|
-
import { useGameLauncherJourney as
|
17
|
-
import { useTableLauncherJourney as
|
16
|
+
import { useGameLauncherJourney as q } from "./hooks/use-game-launcher-journey/use-game-launcher-journey.js";
|
17
|
+
import { useTableLauncherJourney as F } from "./hooks/use-table-launcher-journey/use-table-launcher-journey.js";
|
18
18
|
import { ProjectType as f } from "../games/web-view/enums/project-type-enum.js";
|
19
|
-
const S =
|
20
|
-
({
|
21
|
-
|
19
|
+
const S = Z + w, ce = g(
|
20
|
+
({
|
21
|
+
onSegmentClick: r,
|
22
|
+
journeyId: m,
|
23
|
+
isError: J,
|
24
|
+
data: e,
|
25
|
+
isLoading: p,
|
26
|
+
isTutorialOnboardingDone: E,
|
27
|
+
defaultIndex: M = 0
|
28
|
+
}) => {
|
29
|
+
const t = x(null), { isJourneyActive: C } = Y(), { playSwipSound: L, play: o } = H(), c = n(
|
22
30
|
(l) => {
|
23
31
|
o(u.GAME_CARD_CLICK), r(l, f.TABLE);
|
24
32
|
},
|
@@ -43,18 +51,18 @@ const S = H + Z, pe = O(
|
|
43
51
|
lessonRefs: y,
|
44
52
|
puzzleRefs: R,
|
45
53
|
startJourney: I
|
46
|
-
} =
|
54
|
+
} = q({
|
47
55
|
carouselRefs: t,
|
48
56
|
onSegmentClick: r
|
49
|
-
}), { startJourney: P, tableRef: N } =
|
57
|
+
}), { startJourney: P, tableRef: N } = F({
|
50
58
|
carouselRefs: t,
|
51
59
|
onTableSegmentClick: c
|
52
|
-
}),
|
60
|
+
}), v = h(() => {
|
53
61
|
let l = [];
|
54
62
|
return e && (e.lessons && (l = [
|
55
63
|
...l,
|
56
64
|
/* @__PURE__ */ i(
|
57
|
-
|
65
|
+
a,
|
58
66
|
{
|
59
67
|
ref: y,
|
60
68
|
label: e.lessons.label,
|
@@ -72,7 +80,7 @@ const S = H + Z, pe = O(
|
|
72
80
|
]), l = [
|
73
81
|
...l,
|
74
82
|
/* @__PURE__ */ i(
|
75
|
-
|
83
|
+
a,
|
76
84
|
{
|
77
85
|
ref: T,
|
78
86
|
label: e.games.label,
|
@@ -88,7 +96,7 @@ const S = H + Z, pe = O(
|
|
88
96
|
}
|
89
97
|
),
|
90
98
|
/* @__PURE__ */ i(
|
91
|
-
|
99
|
+
a,
|
92
100
|
{
|
93
101
|
ref: R,
|
94
102
|
label: e.puzzles.label,
|
@@ -106,7 +114,7 @@ const S = H + Z, pe = O(
|
|
106
114
|
], e.tables && (l = [
|
107
115
|
...l,
|
108
116
|
/* @__PURE__ */ i(
|
109
|
-
|
117
|
+
X,
|
110
118
|
{
|
111
119
|
ref: N,
|
112
120
|
label: e.tables.label,
|
@@ -126,12 +134,12 @@ const S = H + Z, pe = O(
|
|
126
134
|
b,
|
127
135
|
N,
|
128
136
|
c
|
129
|
-
]),
|
137
|
+
]), O = h(
|
130
138
|
() => [
|
131
139
|
/* @__PURE__ */ i(
|
132
|
-
|
140
|
+
K,
|
133
141
|
{
|
134
|
-
src:
|
142
|
+
src: U.SLEEPY_BOI,
|
135
143
|
width: S,
|
136
144
|
height: S
|
137
145
|
}
|
@@ -139,35 +147,32 @@ const S = H + Z, pe = O(
|
|
139
147
|
],
|
140
148
|
[]
|
141
149
|
);
|
142
|
-
return
|
150
|
+
return D(() => {
|
143
151
|
if (!(p || !e || C)) {
|
144
152
|
if (e != null && e.puzzles && m === z.CIRCLE_ACTIVITIES_INTRO_JOURNEY) {
|
145
153
|
I(e == null ? void 0 : e.puzzles, !!(e != null && e.lessons), m);
|
146
154
|
return;
|
147
155
|
}
|
148
|
-
e != null && e.tables && m === z.CIRCLE_TABLES_INTRO_JOURNEY && P(e == null ? void 0 : e.tables,
|
156
|
+
e != null && e.tables && m === z.CIRCLE_TABLES_INTRO_JOURNEY && P(e == null ? void 0 : e.tables, E);
|
149
157
|
}
|
150
158
|
}, [
|
151
159
|
e,
|
152
160
|
C,
|
153
161
|
p,
|
154
|
-
|
162
|
+
E,
|
155
163
|
m,
|
156
164
|
I,
|
157
165
|
P
|
158
|
-
]), p ? /* @__PURE__ */ i(
|
166
|
+
]), p ? /* @__PURE__ */ i(B, {}) : J ? /* @__PURE__ */ i(
|
159
167
|
G,
|
160
168
|
{
|
161
169
|
ref: t,
|
162
|
-
items:
|
163
|
-
defaultIndex: J,
|
164
|
-
onNext: L,
|
165
|
-
onPrev: L,
|
170
|
+
items: O,
|
166
171
|
analyticsNext: {
|
167
|
-
analyticsLabel:
|
172
|
+
analyticsLabel: ""
|
168
173
|
},
|
169
174
|
analyticsPrev: {
|
170
|
-
analyticsLabel:
|
175
|
+
analyticsLabel: ""
|
171
176
|
}
|
172
177
|
}
|
173
178
|
) : /* @__PURE__ */ i(
|
@@ -175,17 +180,20 @@ const S = H + Z, pe = O(
|
|
175
180
|
{
|
176
181
|
ref: t,
|
177
182
|
items: v,
|
183
|
+
defaultIndex: M,
|
184
|
+
onNext: L,
|
185
|
+
onPrev: L,
|
178
186
|
analyticsNext: {
|
179
|
-
analyticsLabel:
|
187
|
+
analyticsLabel: V.NEXT_ACTIVITY
|
180
188
|
},
|
181
189
|
analyticsPrev: {
|
182
|
-
analyticsLabel:
|
190
|
+
analyticsLabel: V.PREV_ACTIVITY
|
183
191
|
}
|
184
192
|
}
|
185
193
|
);
|
186
194
|
}
|
187
195
|
);
|
188
196
|
export {
|
189
|
-
|
197
|
+
ce as GameLauncher
|
190
198
|
};
|
191
199
|
//# sourceMappingURL=game-launcher.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"game-launcher.js","sources":["../../../../src/features/circle-games/game-launcher/game-launcher.tsx"],"sourcesContent":["import type { ICarouselRefs } from './comps/carousel/carousel-types';\nimport type { ITableDetails } from './comps/tables-card/tables-card-types';\nimport type {\n Game,\n Lesson,\n Puzzle,\n} from './dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport type { IGameLauncherProps } from './game-launcher-types';\nimport type { FC, ReactNode } from 'react';\n\nimport { memo, useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport { LOTTIE } from '../../../assets/lottie/lottie';\nimport { JOURNEY_ID_STUDENT } from '../../journey/journey-id/journey-id-student';\nimport { 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 { useTableLauncherJourney } from './hooks/use-table-launcher-journey/use-table-launcher-journey';\n\nconst sleepyBoiDimension = GAME_LAUNCHER_SIZE + GAME_LAUNCHER_ASSET_PADDING;\n\nexport const GameLauncher: FC<IGameLauncherProps> = memo(\n ({ onSegmentClick, journeyId, data, isLoading, isTutorialOnboardingDone, defaultIndex = 0 }) => {\n const carouselRefs = useRef<ICarouselRefs>(null);\n\n const { isJourneyActive } = useJourney();\n\n const { playSwipSound, play } = useCircleSounds();\n\n const onTableSegmentClick = useCallback(\n (table: ITableDetails) => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(table, ProjectType.TABLE);\n },\n [onSegmentClick, play],\n );\n\n const handleLessonSegmentClick = useCallback(\n (lesson: Lesson) => {\n if (lesson.status !== 'completed') {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(lesson, ProjectType.LESSON);\n }\n },\n [onSegmentClick, play],\n );\n\n const handleGameSegmentClick = useCallback(\n (game: Game) => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(game, ProjectType.GAME);\n },\n [onSegmentClick, play],\n );\n\n const handlePuzzleSegmentClick = useCallback(\n (puzzle: Puzzle) => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(puzzle, ProjectType.PUZZLE);\n },\n [onSegmentClick, play],\n );\n\n const {\n gameRefs,\n lessonRefs,\n puzzleRefs,\n startJourney: startLessonPuzzleGamesJourney,\n } = useGameLauncherJourney({\n carouselRefs,\n onSegmentClick,\n });\n\n const { startJourney: startTablesJourney, tableRef } = useTableLauncherJourney({\n carouselRefs,\n onTableSegmentClick,\n });\n\n const items = useMemo(() => {\n let itemTypes: ReactNode[] = [];\n\n if (data) {\n if (data.lessons) {\n itemTypes = [\n ...itemTypes,\n <SegmentedGameCard\n ref={lessonRefs}\n label={data.lessons.label}\n value={data.lessons.data.filter(lesson => lesson.status === 'completed').length}\n maxValue={data.lessons.data.length}\n initialValue={data.lessons.initialProgressValue}\n data={data?.lessons.data.map(lesson => ({\n card: lesson.cardLottie,\n name: lesson.name,\n isCompleted: lesson.status === 'completed',\n onPress: () => handleLessonSegmentClick(lesson),\n }))}\n />,\n ];\n }\n\n itemTypes = [\n ...itemTypes,\n <SegmentedGameCard\n ref={gameRefs}\n label={data.games.label}\n value={data.games.data.filter(game => game.isPlayed).length}\n maxValue={data.games.data.length}\n initialValue={data.games.initialProgressValue}\n data={data.games.data.map(game => ({\n card: game.cardLottie,\n name: game.name,\n isCompleted: false,\n onPress: () => handleGameSegmentClick(game),\n }))}\n />,\n <SegmentedGameCard\n ref={puzzleRefs}\n label={data.puzzles.label}\n value={data.puzzles.data.filter(puzzle => puzzle.solved).length}\n maxValue={data.puzzles.data.length}\n initialValue={data.puzzles.initialProgressValue}\n data={data.puzzles.data.map(puzzle => ({\n card: puzzle.cardLottie,\n name: puzzle.name,\n isCompleted: puzzle.solved,\n onPress: () => handlePuzzleSegmentClick(puzzle),\n }))}\n />,\n ];\n\n if (data.tables) {\n itemTypes = [\n ...itemTypes,\n <TablesCard\n ref={tableRef}\n label={data.tables.label}\n data={data.tables.data}\n onPress={onTableSegmentClick}\n openModesOfTable={data.tables.openModesOfTable}\n />,\n ];\n }\n }\n\n return itemTypes;\n }, [\n data,\n gameRefs,\n puzzleRefs,\n lessonRefs,\n handleLessonSegmentClick,\n handleGameSegmentClick,\n handlePuzzleSegmentClick,\n tableRef,\n onTableSegmentClick,\n ]);\n\n const sleepyBoiItem = useMemo(\n () => [\n <LottieAnimation\n src={LOTTIE.SLEEPY_BOI}\n width={sleepyBoiDimension}\n height={sleepyBoiDimension}\n />,\n ],\n [],\n );\n\n // Start game launcher journey only when isLoading has become false and data is available\n useEffect(() => {\n if (isLoading || !data || isJourneyActive) {\n return;\n }\n\n if (data?.puzzles && journeyId === JOURNEY_ID_STUDENT.CIRCLE_ACTIVITIES_INTRO_JOURNEY) {\n startLessonPuzzleGamesJourney(data?.puzzles, !!data?.lessons, journeyId);\n\n return; // CIRCLE_ACTIVITIES_INTRO_JOURNEY has higher priority\n }\n\n if (data?.tables && journeyId === JOURNEY_ID_STUDENT.CIRCLE_TABLES_INTRO_JOURNEY) {\n startTablesJourney(data?.tables, isTutorialOnboardingDone);\n }\n }, [\n data,\n isJourneyActive,\n isLoading,\n isTutorialOnboardingDone,\n journeyId,\n startLessonPuzzleGamesJourney,\n startTablesJourney,\n ]);\n\n if (isLoading) {\n return <CircularLoader />;\n }\n\n if (!data) {\n return (\n <Carousel\n ref={carouselRefs}\n items={sleepyBoiItem}\n analyticsNext={{\n analyticsLabel: '',\n }}\n analyticsPrev={{\n analyticsLabel: '',\n }}\n />\n );\n }\n\n return (\n <Carousel\n ref={carouselRefs}\n items={items}\n defaultIndex={defaultIndex}\n onNext={playSwipSound}\n onPrev={playSwipSound}\n analyticsNext={{\n analyticsLabel: GAME_LAUNCHER_ANALYTICS_EVENTS.NEXT_ACTIVITY,\n }}\n analyticsPrev={{\n analyticsLabel: GAME_LAUNCHER_ANALYTICS_EVENTS.PREV_ACTIVITY,\n }}\n />\n );\n },\n);\n"],"names":["sleepyBoiDimension","GAME_LAUNCHER_SIZE","GAME_LAUNCHER_ASSET_PADDING","GameLauncher","memo","onSegmentClick","journeyId","data","isLoading","isTutorialOnboardingDone","defaultIndex","carouselRefs","useRef","isJourneyActive","useJourney","playSwipSound","play","useCircleSounds","onTableSegmentClick","useCallback","table","CircleSoundKey","ProjectType","handleLessonSegmentClick","lesson","handleGameSegmentClick","game","handlePuzzleSegmentClick","puzzle","gameRefs","lessonRefs","puzzleRefs","startLessonPuzzleGamesJourney","useGameLauncherJourney","startTablesJourney","tableRef","useTableLauncherJourney","items","useMemo","itemTypes","jsx","SegmentedGameCard","TablesCard","sleepyBoiItem","LottieAnimation","LOTTIE","useEffect","JOURNEY_ID_STUDENT","CircularLoader","Carousel","GAME_LAUNCHER_ANALYTICS_EVENTS"],"mappings":";;;;;;;;;;;;;;;;;;AA6BA,MAAMA,IAAqBC,IAAqBC,GAEnCC,KAAuCC;AAAA,EAClD,CAAC,EAAE,gBAAAC,GAAgB,WAAAC,GAAW,MAAAC,GAAM,WAAAC,GAAW,0BAAAC,GAA0B,cAAAC,IAAe,QAAQ;AACxF,UAAAC,IAAeC,EAAsB,IAAI,GAEzC,EAAE,iBAAAC,MAAoBC,KAEtB,EAAE,eAAAC,GAAe,MAAAC,EAAK,IAAIC,EAAgB,GAE1CC,IAAsBC;AAAA,MAC1B,CAACC,MAAyB;AACxB,QAAAJ,EAAKK,EAAe,eAAe,GACpBhB,EAAAe,GAAOE,EAAY,KAAK;AAAA,MACzC;AAAA,MACA,CAACjB,GAAgBW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EAA+B;AAAA,QACjD;AAAA,QACA,eAAe;AAAA,UACb,gBAAgBA,EAA+B;AAAA,QACjD;AAAA,MAAA;AAAA,IAAA,IAzBA,gBAAAV;AAAA,MAACS;AAAA,MAAA;AAAA,QACC,KAAKtC;AAAA,QACL,OAAOgC;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 { 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 { useTableLauncherJourney } from './hooks/use-table-launcher-journey/use-table-launcher-journey';\n\nconst sleepyBoiDimension = GAME_LAUNCHER_SIZE + GAME_LAUNCHER_ASSET_PADDING;\n\nexport const GameLauncher: FC<IGameLauncherProps> = memo(\n ({\n onSegmentClick,\n journeyId,\n isError,\n data,\n isLoading,\n isTutorialOnboardingDone,\n defaultIndex = 0,\n }) => {\n const carouselRefs = useRef<ICarouselRefs>(null);\n\n const { isJourneyActive } = useJourney();\n\n const { playSwipSound, play } = useCircleSounds();\n\n const onTableSegmentClick = useCallback(\n (table: ITableDetails) => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(table, ProjectType.TABLE);\n },\n [onSegmentClick, play],\n );\n\n const handleLessonSegmentClick = useCallback(\n (lesson: Lesson) => {\n if (lesson.status !== 'completed') {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(lesson, ProjectType.LESSON);\n }\n },\n [onSegmentClick, play],\n );\n\n const handleGameSegmentClick = useCallback(\n (game: Game) => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(game, ProjectType.GAME);\n },\n [onSegmentClick, play],\n );\n\n const handlePuzzleSegmentClick = useCallback(\n (puzzle: Puzzle) => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(puzzle, ProjectType.PUZZLE);\n },\n [onSegmentClick, play],\n );\n\n const {\n gameRefs,\n lessonRefs,\n puzzleRefs,\n startJourney: startLessonPuzzleGamesJourney,\n } = useGameLauncherJourney({\n carouselRefs,\n onSegmentClick,\n });\n\n const { startJourney: startTablesJourney, tableRef } = useTableLauncherJourney({\n carouselRefs,\n onTableSegmentClick,\n });\n\n const items = useMemo(() => {\n let itemTypes: ReactNode[] = [];\n\n if (data) {\n if (data.lessons) {\n itemTypes = [\n ...itemTypes,\n <SegmentedGameCard\n ref={lessonRefs}\n label={data.lessons.label}\n value={data.lessons.data.filter(lesson => lesson.status === 'completed').length}\n maxValue={data.lessons.data.length}\n initialValue={data.lessons.initialProgressValue}\n data={data?.lessons.data.map(lesson => ({\n card: lesson.cardLottie,\n name: lesson.name,\n isCompleted: lesson.status === 'completed',\n onPress: () => handleLessonSegmentClick(lesson),\n }))}\n />,\n ];\n }\n\n itemTypes = [\n ...itemTypes,\n <SegmentedGameCard\n ref={gameRefs}\n label={data.games.label}\n value={data.games.data.filter(game => game.isPlayed).length}\n maxValue={data.games.data.length}\n initialValue={data.games.initialProgressValue}\n data={data.games.data.map(game => ({\n card: game.cardLottie,\n name: game.name,\n isCompleted: false,\n onPress: () => handleGameSegmentClick(game),\n }))}\n />,\n <SegmentedGameCard\n ref={puzzleRefs}\n label={data.puzzles.label}\n value={data.puzzles.data.filter(puzzle => puzzle.solved).length}\n maxValue={data.puzzles.data.length}\n initialValue={data.puzzles.initialProgressValue}\n data={data.puzzles.data.map(puzzle => ({\n card: puzzle.cardLottie,\n name: puzzle.name,\n isCompleted: puzzle.solved,\n onPress: () => handlePuzzleSegmentClick(puzzle),\n }))}\n />,\n ];\n\n if (data.tables) {\n itemTypes = [\n ...itemTypes,\n <TablesCard\n ref={tableRef}\n label={data.tables.label}\n data={data.tables.data}\n onPress={onTableSegmentClick}\n openModesOfTable={data.tables.openModesOfTable}\n />,\n ];\n }\n }\n\n return itemTypes;\n }, [\n data,\n gameRefs,\n puzzleRefs,\n lessonRefs,\n handleLessonSegmentClick,\n handleGameSegmentClick,\n handlePuzzleSegmentClick,\n tableRef,\n onTableSegmentClick,\n ]);\n\n const sleepyBoiItem = useMemo(\n () => [\n <LottieAnimation\n src={LOTTIE.SLEEPY_BOI}\n width={sleepyBoiDimension}\n height={sleepyBoiDimension}\n />,\n ],\n [],\n );\n\n // Start game launcher journey only when isLoading has become false and data is available\n useEffect(() => {\n if (isLoading || !data || isJourneyActive) {\n return;\n }\n\n if (data?.puzzles && journeyId === JOURNEY_ID_STUDENT.CIRCLE_ACTIVITIES_INTRO_JOURNEY) {\n startLessonPuzzleGamesJourney(data?.puzzles, !!data?.lessons, journeyId);\n\n return; // CIRCLE_ACTIVITIES_INTRO_JOURNEY has higher priority\n }\n\n if (data?.tables && journeyId === JOURNEY_ID_STUDENT.CIRCLE_TABLES_INTRO_JOURNEY) {\n startTablesJourney(data?.tables, isTutorialOnboardingDone);\n }\n }, [\n data,\n isJourneyActive,\n isLoading,\n isTutorialOnboardingDone,\n journeyId,\n startLessonPuzzleGamesJourney,\n startTablesJourney,\n ]);\n\n if (isLoading) {\n return <CircularLoader />;\n }\n\n if (isError) {\n return (\n <Carousel\n ref={carouselRefs}\n items={sleepyBoiItem}\n analyticsNext={{\n analyticsLabel: '',\n }}\n analyticsPrev={{\n analyticsLabel: '',\n }}\n />\n );\n }\n\n return (\n <Carousel\n ref={carouselRefs}\n items={items}\n defaultIndex={defaultIndex}\n onNext={playSwipSound}\n onPrev={playSwipSound}\n analyticsNext={{\n analyticsLabel: GAME_LAUNCHER_ANALYTICS_EVENTS.NEXT_ACTIVITY,\n }}\n analyticsPrev={{\n analyticsLabel: GAME_LAUNCHER_ANALYTICS_EVENTS.PREV_ACTIVITY,\n }}\n />\n );\n },\n);\n"],"names":["sleepyBoiDimension","GAME_LAUNCHER_SIZE","GAME_LAUNCHER_ASSET_PADDING","GameLauncher","memo","onSegmentClick","journeyId","isError","data","isLoading","isTutorialOnboardingDone","defaultIndex","carouselRefs","useRef","isJourneyActive","useJourney","playSwipSound","play","useCircleSounds","onTableSegmentClick","useCallback","table","CircleSoundKey","ProjectType","handleLessonSegmentClick","lesson","handleGameSegmentClick","game","handlePuzzleSegmentClick","puzzle","gameRefs","lessonRefs","puzzleRefs","startLessonPuzzleGamesJourney","useGameLauncherJourney","startTablesJourney","tableRef","useTableLauncherJourney","items","useMemo","itemTypes","jsx","SegmentedGameCard","TablesCard","sleepyBoiItem","LottieAnimation","LOTTIE","useEffect","JOURNEY_ID_STUDENT","CircularLoader","Carousel","GAME_LAUNCHER_ANALYTICS_EVENTS"],"mappings":";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AACA,KAAA,QAAAA,EAAM,UAASF,CAAS;AAEvE;AAAA,QACF;AAEA,QAAIE,KAAA,QAAAA,EAAM,UAAUF,MAAc0C,EAAmB,+BAChCb,EAAA3B,KAAA,gBAAAA,EAAM,QAAQE,CAAwB;AAAA;AAAA,IAC3D,GACC;AAAA,MACDF;AAAA,MACAM;AAAA,MACAL;AAAA,MACAC;AAAA,MACAJ;AAAA,MACA2B;AAAA,MACAE;AAAA,IAAA,CACD,GAEG1B,sBACMwC,GAAe,CAAA,CAAA,IAGrB1C,IAEA,gBAAAkC;AAAA,MAACS;AAAA,MAAA;AAAA,QACC,KAAKtC;AAAA,QACL,OAAOgC;AAAA,QACP,eAAe;AAAA,UACb,gBAAgB;AAAA,QAClB;AAAA,QACA,eAAe;AAAA,UACb,gBAAgB;AAAA,QAClB;AAAA,MAAA;AAAA,IAAA,IAMJ,gBAAAH;AAAA,MAACS;AAAA,MAAA;AAAA,QACC,KAAKtC;AAAA,QACL,OAAA0B;AAAA,QACA,cAAA3B;AAAA,QACA,QAAQK;AAAA,QACR,QAAQA;AAAA,QACR,eAAe;AAAA,UACb,gBAAgBmC,EAA+B;AAAA,QACjD;AAAA,QACA,eAAe;AAAA,UACb,gBAAgBA,EAA+B;AAAA,QACjD;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;"}
|
@@ -1,46 +1,46 @@
|
|
1
|
-
import { jsx as r, Fragment as
|
2
|
-
import { useRef as
|
3
|
-
import
|
4
|
-
import { PLATFORM_EVENTS_STUDENT as
|
5
|
-
import { JOURNEY_ID_STUDENT as
|
1
|
+
import { jsx as r, Fragment as R } from "react/jsx-runtime";
|
2
|
+
import { useRef as b, useCallback as A, useEffect as Q } from "react";
|
3
|
+
import ee from "../../../../../assets/line-icons/icons/carat-right.js";
|
4
|
+
import { PLATFORM_EVENTS_STUDENT as J } from "../../../../analytics-events/platform-events-student.js";
|
5
|
+
import { JOURNEY_ID_STUDENT as te } from "../../../../journey/journey-id/journey-id-student.js";
|
6
6
|
import { IndicatorType as d } from "../../../../journey/use-journey/constants.js";
|
7
|
-
import { useJourney as
|
8
|
-
import
|
9
|
-
import { useUIContext as
|
10
|
-
import
|
11
|
-
import
|
12
|
-
import { CIRCLE_ONBOARDING_ANALYTICS_STEPS as
|
13
|
-
import { useCircleSounds as
|
14
|
-
import { TablesCard as
|
15
|
-
import { GAME_LAUNCHER_ANALYTICS_EVENTS as
|
16
|
-
import { SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS as
|
17
|
-
import { Indicator as
|
18
|
-
const
|
19
|
-
carouselRefs:
|
7
|
+
import { useJourney as re } from "../../../../journey/use-journey/use-journey.js";
|
8
|
+
import ne from "../../../../ui/buttons/icon-button/icon-button.js";
|
9
|
+
import { useUIContext as oe } from "../../../../ui/context/context.js";
|
10
|
+
import O from "../../../../ui/layout/flex-view.js";
|
11
|
+
import u from "../../../../ui/text/text.js";
|
12
|
+
import { CIRCLE_ONBOARDING_ANALYTICS_STEPS as V } from "../../../enum/circle-onboarding-steps.js";
|
13
|
+
import { useCircleSounds as ie } from "../../../hooks/use-circle-sounds/use-circle-sounds.js";
|
14
|
+
import { TablesCard as X } from "../../comps/tables-card/tables-card.js";
|
15
|
+
import { GAME_LAUNCHER_ANALYTICS_EVENTS as ae } from "../../game-launcher-analytics-events.js";
|
16
|
+
import { SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS as le, SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS as ce, START_ANIMATING_CLONED_ELEM as K, TABLE_CARD_INDEX as j, GO_TO_TABLE_LAUNCHER_DURATION_MS as de, SHOW_CLICK_TABLE_NUDGE_AFTER_MS as se, PUZZLE_CARD_INDEX as ue, SHOW_INITIAL_COACHMARK_AFTER_MS as Z, LESSON_CARD_INDEX as me, SHOW_INITIAL_TOOLTIP_AFTER_MS as ge } from "./constants.js";
|
17
|
+
import { Indicator as Te } from "./use-table-launcher-journey-styled.js";
|
18
|
+
const We = ({
|
19
|
+
carouselRefs: l,
|
20
20
|
onTableSegmentClick: N
|
21
21
|
}) => {
|
22
|
-
const t =
|
22
|
+
const t = te.CIRCLE_TABLES_INTRO_JOURNEY, e = b(null), f = b(null), m = b([]), { playButtonSound: S } = ie(), { nextCoachmark: a, setJourney: C, addCoachmark: s, endJourney: P } = re(), { onEvent: _ } = oe(), L = A(
|
23
23
|
(n) => {
|
24
24
|
var c, o;
|
25
|
-
n && N(n),
|
26
|
-
step:
|
25
|
+
n && N(n), _(J.ONBOARDING_STEP_COMPLETED, {
|
26
|
+
step: V.TABLES
|
27
27
|
}), (c = e == null ? void 0 : e.current) == null || c.setLabelVisiblity(!0), (o = e == null ? void 0 : e.current) == null || o.stopLabelAnimation(), P(t);
|
28
28
|
},
|
29
|
-
[P, t, N,
|
30
|
-
),
|
29
|
+
[P, t, N, _]
|
30
|
+
), y = A(
|
31
31
|
(n, c) => {
|
32
|
-
var
|
33
|
-
if (!((
|
32
|
+
var T, h, p;
|
33
|
+
if (!((T = e.current) != null && T.segmentedCardWrapperRef.current) || !((h = e.current) != null && h.labelRef.current))
|
34
34
|
return;
|
35
|
-
const o = e.current.labelRef.current.getBoundingClientRect(), i = (
|
36
|
-
|
35
|
+
const o = e.current.labelRef.current.getBoundingClientRect(), i = (p = e.current) == null ? void 0 : p.segmentedCardWrapperRef.current.getBoundingClientRect();
|
36
|
+
s(t, {
|
37
37
|
originalElementToHighlightRef: e.current.segmentedCardWrapperRef,
|
38
38
|
isActive: !1,
|
39
39
|
type: d.TOOLTIP,
|
40
40
|
elementToHighlight: /* @__PURE__ */ r(
|
41
|
-
|
41
|
+
X,
|
42
42
|
{
|
43
|
-
ref:
|
43
|
+
ref: f,
|
44
44
|
defaultTable: c,
|
45
45
|
label: n.label,
|
46
46
|
data: n.data,
|
@@ -52,69 +52,79 @@ const be = ({
|
|
52
52
|
position: "left",
|
53
53
|
backgroundColor: "YELLOW_4",
|
54
54
|
width: 236,
|
55
|
-
tooltipItem: /* @__PURE__ */ r(
|
55
|
+
tooltipItem: /* @__PURE__ */ r(O, { children: /* @__PURE__ */ r(u, { $renderAs: "ab2-bold", children: "Each table has 3 levels—clear them and earn 3 stars!" }) }),
|
56
56
|
tooltipXCoOrdinates: 0,
|
57
57
|
tooltipYCoOrdinates: o.height * 0.35
|
58
58
|
}
|
59
|
-
}),
|
59
|
+
}), s(t, {
|
60
60
|
originalElementToHighlightRef: e.current.segmentedCardWrapperRef,
|
61
61
|
isActive: !1,
|
62
62
|
type: d.NUDGE,
|
63
63
|
indicator: {
|
64
64
|
nudge: "click",
|
65
|
-
content: /* @__PURE__ */ r(
|
65
|
+
content: /* @__PURE__ */ r(u, { $renderAs: "ab1", $color: "WHITE", children: "Pick a level" }),
|
66
66
|
nudgePointerX: i.width / 2 + 50,
|
67
67
|
nudgePointerY: i.height * 0.4
|
68
68
|
},
|
69
|
-
elementToHighlight: /* @__PURE__ */ r(
|
70
|
-
}),
|
71
|
-
const
|
72
|
-
var
|
73
|
-
clearTimeout(
|
74
|
-
},
|
75
|
-
|
69
|
+
elementToHighlight: /* @__PURE__ */ r(R, {})
|
70
|
+
}), a(t, !1, le), a(t, !0, ce);
|
71
|
+
const g = setTimeout(() => {
|
72
|
+
var E;
|
73
|
+
clearTimeout(g), (E = f.current) == null || E.startLabelAnimation("YELLOW_4");
|
74
|
+
}, K);
|
75
|
+
m.current.push(g);
|
76
76
|
},
|
77
|
-
[
|
77
|
+
[s, L, t, a]
|
78
78
|
), I = A(() => {
|
79
79
|
var o;
|
80
|
-
S(), (o =
|
81
|
-
step:
|
80
|
+
S(), (o = l.current) == null || o.goToIndex(j), a(t, !1, de), _(J.ONBOARDING_STEP_VIEWED, {
|
81
|
+
step: V.TABLES
|
82
82
|
});
|
83
83
|
const n = setTimeout(() => {
|
84
84
|
var i;
|
85
|
-
clearTimeout(n), (i = e.current) == null || i.setLabelVisiblity(!1),
|
86
|
-
},
|
87
|
-
|
85
|
+
clearTimeout(n), (i = e.current) == null || i.setLabelVisiblity(!1), a(t, !0);
|
86
|
+
}, se);
|
87
|
+
m.current.push(n);
|
88
88
|
const c = setTimeout(() => {
|
89
89
|
var i;
|
90
|
-
clearTimeout(c), (i =
|
91
|
-
},
|
92
|
-
|
93
|
-
}, [
|
90
|
+
clearTimeout(c), (i = f.current) == null || i.startLabelAnimation("YELLOW_4");
|
91
|
+
}, K);
|
92
|
+
m.current.push(c);
|
93
|
+
}, [l, t, a, S, _]), q = A(
|
94
94
|
(n, c = !1) => {
|
95
|
-
var h, p,
|
96
|
-
const o = (h =
|
97
|
-
if (!((
|
95
|
+
var T, h, p, E, H, W, D, B, k, Y, U, G, v, x, w, M, $, F;
|
96
|
+
const o = (h = (T = l.current) == null ? void 0 : T.indicatorRefs) == null ? void 0 : h[j];
|
97
|
+
if (!((p = e.current) != null && p.segmentedCardWrapperRef) || !((E = e.current) != null && E.segmentedCardWrapperRef) || !((H = l.current) != null && H.nextBtnRef) || !((W = e.current) != null && W.segmentedCardWrapperRef.current) || !((D = e.current) != null && D.segmentedCardWrapperRef.current) || !((B = l.current) != null && B.nextBtnRef.current) || !o || !o.current) {
|
98
|
+
console.error(
|
99
|
+
"Table card ref or carousel ref is not defined. Please check the component tree and ensure that the refs are correctly passed down."
|
100
|
+
);
|
98
101
|
return;
|
99
|
-
|
102
|
+
}
|
103
|
+
const i = ((Y = (k = e.current) == null ? void 0 : k.labelRef.current) == null ? void 0 : Y.getBoundingClientRect()) || {
|
104
|
+
width: 0,
|
105
|
+
height: 0
|
106
|
+
}, g = ((v = (G = (U = e.current) == null ? void 0 : U.segmentedCardWrapperRef) == null ? void 0 : G.current) == null ? void 0 : v.getBoundingClientRect()) || {
|
107
|
+
width: 0,
|
108
|
+
height: 0
|
109
|
+
};
|
100
110
|
c ? (C(t, [
|
101
111
|
{
|
102
|
-
originalElementToHighlightRef:
|
112
|
+
originalElementToHighlightRef: o,
|
103
113
|
isActive: !1,
|
104
114
|
type: d.TOOLTIP,
|
105
|
-
elementToHighlight: /* @__PURE__ */ r(
|
115
|
+
elementToHighlight: /* @__PURE__ */ r(Te, { $isActive: !1 }),
|
106
116
|
indicator: {
|
107
117
|
position: "bottom",
|
108
118
|
backgroundColor: "YELLOW_4",
|
109
119
|
width: 52,
|
110
120
|
tooltipItem: /* @__PURE__ */ r(
|
111
|
-
|
121
|
+
O,
|
112
122
|
{
|
113
123
|
$position: "absolute",
|
114
124
|
$flexDirection: "row",
|
115
125
|
style: { top: 6, left: 8, cursor: "pointer" },
|
116
126
|
onClick: I,
|
117
|
-
children: /* @__PURE__ */ r(
|
127
|
+
children: /* @__PURE__ */ r(u, { $renderAs: "ab2-bold", children: "NEW" })
|
118
128
|
}
|
119
129
|
),
|
120
130
|
tooltipYCoOrdinates: 14
|
@@ -122,7 +132,7 @@ const be = ({
|
|
122
132
|
}
|
123
133
|
},
|
124
134
|
{
|
125
|
-
originalElementToHighlightRef:
|
135
|
+
originalElementToHighlightRef: o,
|
126
136
|
isActive: !1,
|
127
137
|
type: d.NUDGE,
|
128
138
|
indicator: {
|
@@ -130,83 +140,83 @@ const be = ({
|
|
130
140
|
content: "",
|
131
141
|
nudgePointerY: 20
|
132
142
|
},
|
133
|
-
elementToHighlight: /* @__PURE__ */ r(
|
143
|
+
elementToHighlight: /* @__PURE__ */ r(R, {})
|
134
144
|
}
|
135
|
-
]), (
|
145
|
+
]), (M = l.current) == null || M.goToIndex(me), a(t, !1, Z), a(t, !0, ge)) : (C(t, [
|
136
146
|
{
|
137
|
-
originalElementToHighlightRef: (
|
147
|
+
originalElementToHighlightRef: (x = l.current) == null ? void 0 : x.nextBtnRef,
|
138
148
|
isActive: !1,
|
139
149
|
type: d.NUDGE,
|
140
150
|
indicator: {
|
141
151
|
nudge: "click",
|
142
|
-
content: /* @__PURE__ */ r(
|
152
|
+
content: /* @__PURE__ */ r(u, { $renderAs: "ab1", $color: "WHITE", children: "Click to proceed" }),
|
143
153
|
nudgePointerX: 0,
|
144
154
|
nudgePointerY: 0
|
145
155
|
},
|
146
156
|
elementToHighlight: /* @__PURE__ */ r(
|
147
|
-
|
157
|
+
ne,
|
148
158
|
{
|
149
159
|
renderAs: "secondary",
|
150
|
-
Icon:
|
160
|
+
Icon: ee,
|
151
161
|
onClick: I,
|
152
|
-
analyticsLabel:
|
162
|
+
analyticsLabel: ae.JOURNEY_NEXT_ACTIVITY
|
153
163
|
}
|
154
164
|
)
|
155
165
|
}
|
156
|
-
]), (
|
157
|
-
originalElementToHighlightRef: e.current
|
166
|
+
]), (w = l.current) == null || w.goToIndex(ue), a(t, !1, Z)), s(t, {
|
167
|
+
originalElementToHighlightRef: ($ = e.current) == null ? void 0 : $.labelRef,
|
158
168
|
isActive: !1,
|
159
169
|
type: d.TOOLTIP,
|
160
|
-
elementToHighlight: /* @__PURE__ */ r(
|
170
|
+
elementToHighlight: /* @__PURE__ */ r(R, {}),
|
161
171
|
indicator: {
|
162
172
|
position: "right",
|
163
173
|
backgroundColor: "YELLOW_4",
|
164
174
|
width: 264,
|
165
|
-
tooltipItem: /* @__PURE__ */ r(
|
166
|
-
tooltipXCoOrdinates:
|
167
|
-
tooltipYCoOrdinates:
|
175
|
+
tooltipItem: /* @__PURE__ */ r(O, { children: /* @__PURE__ */ r(u, { $renderAs: "ab2-bold", children: "Get faster at multiplication! Practice everyday and become a Tables champ." }) }),
|
176
|
+
tooltipXCoOrdinates: i.width + 50,
|
177
|
+
tooltipYCoOrdinates: i.height / 2
|
168
178
|
}
|
169
|
-
}),
|
170
|
-
originalElementToHighlightRef: e.current.segmentedCardWrapperRef,
|
179
|
+
}), s(t, {
|
180
|
+
originalElementToHighlightRef: (F = e.current) == null ? void 0 : F.segmentedCardWrapperRef,
|
171
181
|
isActive: !1,
|
172
182
|
type: d.NUDGE,
|
173
183
|
indicator: {
|
174
184
|
nudge: "click",
|
175
|
-
content: /* @__PURE__ */ r(
|
176
|
-
nudgePointerX:
|
177
|
-
nudgePointerY:
|
185
|
+
content: /* @__PURE__ */ r(u, { $renderAs: "ab1", $color: "WHITE", children: "Pick a table to start" }),
|
186
|
+
nudgePointerX: g.width / 2 + 50,
|
187
|
+
nudgePointerY: g.height / 2
|
178
188
|
},
|
179
189
|
elementToHighlight: /* @__PURE__ */ r(
|
180
|
-
|
190
|
+
X,
|
181
191
|
{
|
182
|
-
ref:
|
192
|
+
ref: f,
|
183
193
|
label: n.label,
|
184
194
|
data: n.data,
|
185
195
|
onPress: () => {
|
186
196
|
},
|
187
|
-
onPressTableSegment: (
|
197
|
+
onPressTableSegment: (z) => y(n, z)
|
188
198
|
}
|
189
199
|
)
|
190
200
|
});
|
191
201
|
},
|
192
202
|
[
|
193
|
-
|
194
|
-
|
203
|
+
s,
|
204
|
+
l,
|
195
205
|
I,
|
196
|
-
|
206
|
+
y,
|
197
207
|
t,
|
198
|
-
|
208
|
+
a,
|
199
209
|
C
|
200
210
|
]
|
201
211
|
);
|
202
|
-
return
|
203
|
-
|
212
|
+
return Q(() => () => {
|
213
|
+
m.current.forEach((n) => clearTimeout(n)), m.current = [];
|
204
214
|
}, [t]), {
|
205
215
|
tableRef: e,
|
206
|
-
startJourney:
|
216
|
+
startJourney: q
|
207
217
|
};
|
208
218
|
};
|
209
219
|
export {
|
210
|
-
|
220
|
+
We as useTableLauncherJourney
|
211
221
|
};
|
212
222
|
//# 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 { 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}: IUseTableJourneyProps) => {\n const journeyId = JOURNEY_ID_STUDENT.CIRCLE_TABLES_INTRO_JOURNEY;\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 // 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 endJourney(journeyId);\n },\n [endJourney, journeyId, 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: 'left',\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: 0,\n tooltipYCoOrdinates: segmentedCardDims.height * 0.35,\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: (\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, 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: (\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: 'right',\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 + 50,\n tooltipYCoOrdinates: labelDims.height / 2,\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: (\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 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","journeyId","JOURNEY_ID_STUDENT","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":";;;;;;;;;;;;;;;;;AAyCO,MAAMA,KAA0B,CAAC;AAAA,EACtC,cAAAC;AAAA,EACA,qBAAAC;AACF,MAA6B;AAC3B,QAAMC,IAAYC,EAAmB,6BAC/BC,IAAmBC,EAAsB,IAAI,GAC7CC,IAAsBD,EAAsB,IAAI,GAEhDE,IAAYF,EAAwC,CAAA,CAAE,GAEtD,EAAE,iBAAAG,MAAoBC,KACtB,EAAE,eAAAC,GAAe,YAAAC,GAAY,cAAAC,GAAc,YAAAC,EAAA,IAAeC,KAC1D,EAAE,SAASC,EAAe,IAAIC,EAAa,GAE3CC,IAAmBC;AAAA,IACvB,CAACC,MAAiC;;AAEhC,MAAIA,KACFlB,EAAoBkB,CAAY,GAElCJ,EAAeK,EAAwB,2BAA2B;AAAA,QAChE,MAAMC,EAAO;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EAAiB,QAAQ;AAAA,QACxD,UAAU;AAAA,QACV,MAAM0B,EAAc;AAAA,QACpB,WAAW;AAAA,UACT,OAAO;AAAA,UACP,SACG,gBAAAC,EAAAG,GAAA,EAAK,WAAU,OAAM,QAAO,SAC1B,UACH,yBAAA;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,MACAZ;AAAA,MACAwC;AAAA,MACAhB;AAAA,MACAtB;AAAA,MACAQ;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,CAACL,CAAS,CAAC,GAEP;AAAA,IACL,UAAUE;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 no-console */\n/* 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 { 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}: IUseTableJourneyProps) => {\n const journeyId = JOURNEY_ID_STUDENT.CIRCLE_TABLES_INTRO_JOURNEY;\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 // 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 endJourney(journeyId);\n },\n [endJourney, journeyId, 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: 'left',\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: 0,\n tooltipYCoOrdinates: segmentedCardDims.height * 0.35,\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: (\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, 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 tablePaginationRef = carouselRefs.current?.indicatorRefs?.[TABLE_CARD_INDEX];\n\n if (\n !originalTableRef.current?.segmentedCardWrapperRef ||\n !originalTableRef.current?.segmentedCardWrapperRef ||\n !carouselRefs.current?.nextBtnRef ||\n !originalTableRef.current?.segmentedCardWrapperRef.current ||\n !originalTableRef.current?.segmentedCardWrapperRef.current ||\n !carouselRefs.current?.nextBtnRef.current ||\n !tablePaginationRef ||\n !tablePaginationRef.current\n ) {\n console.error(\n 'Table card ref or carousel ref is not defined. Please check the component tree and ensure that the refs are correctly passed down.',\n );\n\n return;\n }\n\n const labelDims = originalTableRef.current?.labelRef.current?.getBoundingClientRect() || {\n width: 0,\n height: 0,\n };\n const tableCardDims =\n originalTableRef.current?.segmentedCardWrapperRef?.current?.getBoundingClientRect() || {\n width: 0,\n height: 0,\n };\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: (\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: 'right',\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 + 50,\n tooltipYCoOrdinates: labelDims.height / 2,\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: (\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 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","journeyId","JOURNEY_ID_STUDENT","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","tablePaginationRef","_d","_e","_f","_g","_h","labelDims","_j","_i","_m","_l","_k","S.Indicator","_p","LESSON_CARD_INDEX","SHOW_INITIAL_COACHMARK_AFTER_MS","SHOW_INITIAL_TOOLTIP_AFTER_MS","_n","IconButton","CaratRightIcon","GAME_LAUNCHER_ANALYTICS_EVENTS","_o","PUZZLE_CARD_INDEX","_q","_r","tableInfo","useEffect","timer"],"mappings":";;;;;;;;;;;;;;;;;AA0CO,MAAMA,KAA0B,CAAC;AAAA,EACtC,cAAAC;AAAA,EACA,qBAAAC;AACF,MAA6B;AAC3B,QAAMC,IAAYC,GAAmB,6BAC/BC,IAAmBC,EAAsB,IAAI,GAC7CC,IAAsBD,EAAsB,IAAI,GAEhDE,IAAYF,EAAwC,CAAA,CAAE,GAEtD,EAAE,iBAAAG,MA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AwC;AAAA,MACAhB;AAAA,MACAtB;AAAA,MACAQ;AAAA,MACAC;AAAA,IACF;AAAA,EAAA;AAIF,SAAAgE,EAAU,MACD,MAAM;AACX,IAAApE,EAAU,QAAQ,QAAQ,CAASqE,MAAA,aAAaA,CAAK,CAAC,GACtDrE,EAAU,UAAU;EAAC,GAEtB,CAACL,CAAS,CAAC,GAEP;AAAA,IACL,UAAUE;AAAA,IACV,cAAA0C;AAAA,EAAA;AAEJ;"}
|
@@ -1,105 +1,105 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { createContext as
|
1
|
+
import { jsxs as b, jsx as j } from "react/jsx-runtime";
|
2
|
+
import { createContext as q, useState as C, useRef as g, useCallback as l, useMemo as L, useEffect as D } from "react";
|
3
3
|
import { Coachmark as N } from "../comps/coachmark/coachmark.js";
|
4
4
|
import { usePostUserJourney as M, useGetUserJourney as z } from "../user-journey-api/user-journey-api.js";
|
5
5
|
import { Overlay as G } from "./journey-styled.js";
|
6
|
-
const S =
|
7
|
-
const [k, v] =
|
6
|
+
const S = q(null), Q = ({ children: R, appId: u, userId: s }) => {
|
7
|
+
const [k, v] = C([]), [t, c] = C([]), [p, x] = C(!1), a = g(-1), r = g(), f = g([]), { post: $ } = M(), {
|
8
8
|
data: m = null,
|
9
9
|
get: _,
|
10
|
-
isProcessing:
|
11
|
-
} = z(),
|
12
|
-
(e,
|
13
|
-
if (
|
10
|
+
isProcessing: T
|
11
|
+
} = z(), O = (u === "" || m && !T) && t.length > 0, A = l(
|
12
|
+
(e, o) => {
|
13
|
+
if (t.length > 0) {
|
14
14
|
console.error(
|
15
15
|
`setJourney: Other Journey is already active, Current Journey: ${r.current}, New Journey Request: ${e}`
|
16
16
|
);
|
17
17
|
return;
|
18
18
|
}
|
19
|
-
|
19
|
+
console.log(`setJourney: Journey ID: ${e}`), x(!0), r.current = e, a.current = -1, c([...o]);
|
20
20
|
},
|
21
|
-
[
|
21
|
+
[t.length]
|
22
22
|
), y = l(() => {
|
23
23
|
f.current.forEach((e) => {
|
24
24
|
clearTimeout(e);
|
25
|
-
}), f.current = [], r.current = void 0, a.current = -1, c([]),
|
25
|
+
}), f.current = [], r.current = void 0, a.current = -1, c([]), x(!1);
|
26
26
|
}, []), P = l(
|
27
27
|
(e) => {
|
28
|
-
v((
|
28
|
+
v((o) => [...o, e]), $({
|
29
29
|
app_id: u,
|
30
30
|
user_id: s,
|
31
31
|
journey_id: e,
|
32
32
|
journey_status: "COMPLETED"
|
33
33
|
}), y();
|
34
34
|
},
|
35
|
-
[u, y,
|
36
|
-
),
|
35
|
+
[u, y, $, s]
|
36
|
+
), w = l((e, o) => {
|
37
37
|
if (!r.current || e !== r.current) {
|
38
38
|
console.error(
|
39
39
|
r.current ? `A Journey is already active, Current Journey: ${r.current}, New Journey Request: ${e}` : "addCoachmark was called before setJourney and Journey ID is undefined"
|
40
40
|
);
|
41
41
|
return;
|
42
42
|
}
|
43
|
-
c((J) => [...J,
|
44
|
-
}, []),
|
45
|
-
(e,
|
43
|
+
console.log(`addCoachmark: Journey ID: ${e}`), c((J) => [...J, o]);
|
44
|
+
}, []), d = l(
|
45
|
+
(e, o = !1, J = 0) => {
|
46
46
|
if (!r.current || e !== r.current) {
|
47
47
|
console.error(
|
48
48
|
r.current ? "nextCoachmark was called before setJourney" : `A Journey is already active, Current Journey: ${r.current}, New Journey Request: ${e}`
|
49
49
|
);
|
50
50
|
return;
|
51
51
|
}
|
52
|
-
J !== 0 && c((
|
52
|
+
console.log(d), J !== 0 && c((n) => n.map((i) => ({ ...i, isActive: !1 })));
|
53
53
|
const E = setTimeout(() => {
|
54
54
|
clearTimeout(E);
|
55
|
-
const
|
55
|
+
const n = a.current + 1;
|
56
56
|
c((i) => {
|
57
|
-
if (
|
57
|
+
if (n >= i.length || i.length === 0)
|
58
58
|
return r.current = void 0, a.current = -1, [];
|
59
|
-
a.current =
|
60
|
-
const
|
61
|
-
return
|
59
|
+
a.current = n;
|
60
|
+
const h = [...i];
|
61
|
+
return h[n].isActive = !0, n > 0 && (h[n - 1].isActive = o), h;
|
62
62
|
});
|
63
63
|
}, J);
|
64
64
|
f.current.push(E);
|
65
65
|
},
|
66
66
|
[]
|
67
|
-
),
|
67
|
+
), U = L(
|
68
68
|
() => ({
|
69
|
-
nextCoachmark:
|
69
|
+
nextCoachmark: d,
|
70
70
|
setJourney: A,
|
71
|
-
addCoachmark:
|
71
|
+
addCoachmark: w,
|
72
72
|
clearJourney: y,
|
73
73
|
endJourney: P,
|
74
|
-
coachmarks:
|
74
|
+
coachmarks: t,
|
75
75
|
userCompletedJourneyIds: k,
|
76
|
-
isJourneyActive:
|
76
|
+
isJourneyActive: p
|
77
77
|
}),
|
78
78
|
[
|
79
|
-
|
79
|
+
d,
|
80
80
|
A,
|
81
|
-
|
81
|
+
w,
|
82
82
|
y,
|
83
83
|
P,
|
84
|
-
|
84
|
+
t,
|
85
85
|
k,
|
86
|
-
|
86
|
+
p
|
87
87
|
]
|
88
88
|
);
|
89
|
-
return
|
89
|
+
return D(() => {
|
90
90
|
u && s && _(s, {
|
91
91
|
app_id: u,
|
92
92
|
user_id: s,
|
93
93
|
journey_status: "COMPLETED"
|
94
94
|
});
|
95
|
-
}, [u, _, s]),
|
95
|
+
}, [u, _, s]), D(() => {
|
96
96
|
if (m) {
|
97
|
-
const e = m.map((
|
97
|
+
const e = m.map((o) => o.journey_id);
|
98
98
|
v(e);
|
99
99
|
}
|
100
|
-
}, [m]), /* @__PURE__ */
|
101
|
-
|
102
|
-
|
100
|
+
}, [m]), /* @__PURE__ */ b(S.Provider, { value: U, children: [
|
101
|
+
O && /* @__PURE__ */ j(G, { children: t.map((e, o) => /* @__PURE__ */ j(N, { coachmark: e }, `coachmark-${o}`)) }),
|
102
|
+
R
|
103
103
|
] });
|
104
104
|
};
|
105
105
|
export {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"journey-context-provider.js","sources":["../../../../src/features/journey/use-journey/journey-context-provider.tsx"],"sourcesContent":["/* eslint-disable no-console */\nimport type { TJourneyId } from '../journey-id/journey-id-types';\nimport type {\n ICoachmarkProps,\n IJourneyContext,\n IJourneyProviderProps,\n} from './journey-context-types';\nimport type { FC } from 'react';\n\nimport { createContext, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { Coachmark } from '../comps/coachmark/coachmark';\nimport { useGetUserJourney, usePostUserJourney } from '../user-journey-api/user-journey-api';\nimport * as S from './journey-styled';\n\nexport const JourneyContext = createContext<IJourneyContext | null>(null);\n\nexport const JourneyProvider: FC<IJourneyProviderProps> = ({ children, appId, userId }) => {\n const [userCompletedJourneyIds, setUserCompletedJourneyIds] = useState<TJourneyId[]>([]);\n const [coachmarkList, setCoachmarkList] = useState<ICoachmarkProps[]>([]);\n const [isJourneyActive, setIsJourneyActive] = useState(false);\n const currentIndex = useRef(-1);\n const currentJourneyId = useRef<TJourneyId | undefined>();\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const { post: postJourneyCompletion } = usePostUserJourney();\n const {\n data: userCompletedJourneys = null,\n get: getJourneyProgress,\n isProcessing,\n } = useGetUserJourney();\n\n const showCoachmarks =\n appId === '' // Otherwise coachmark stories wont work\n ? coachmarkList.length > 0\n : userCompletedJourneys && !isProcessing && coachmarkList.length > 0;\n\n const setJourney = useCallback(\n (id: TJourneyId, coachmarks: ICoachmarkProps[]) => {\n if (coachmarkList.length > 0) {\n console.error(\n `setJourney: Other Journey is already active, Current Journey: ${currentJourneyId.current}, New Journey Request: ${id}`,\n );\n\n return;\n }\n setIsJourneyActive(true);\n currentJourneyId.current = id;\n currentIndex.current = -1;\n setCoachmarkList([...coachmarks]);\n },\n [coachmarkList.length],\n );\n\n const clearJourney = useCallback(() => {\n // Clear all timers\n timerRefs.current.forEach(timer => {\n clearTimeout(timer);\n });\n timerRefs.current = [];\n currentJourneyId.current = undefined;\n currentIndex.current = -1;\n setCoachmarkList([]);\n setIsJourneyActive(false);\n }, []);\n\n const endJourney = useCallback(\n (journeyId: TJourneyId) => {\n setUserCompletedJourneyIds(prev => [...prev, journeyId]);\n postJourneyCompletion({\n app_id: appId,\n user_id: userId,\n journey_id: journeyId,\n journey_status: 'COMPLETED',\n });\n clearJourney();\n },\n [appId, clearJourney, postJourneyCompletion, userId],\n );\n\n const addCoachmark = useCallback((id: TJourneyId, coachmark: ICoachmarkProps) => {\n if (!currentJourneyId.current || id !== currentJourneyId.current) {\n console.error(\n currentJourneyId.current\n ? `A Journey is already active, Current Journey: ${currentJourneyId.current}, New Journey Request: ${id}`\n : `addCoachmark was called before setJourney and Journey ID is undefined`,\n );\n\n return;\n }\n\n setCoachmarkList(prev => [...prev, coachmark]);\n }, []);\n\n const nextCoachmark = useCallback(\n (id: TJourneyId, keepPrevActive: boolean = false, delayInMs: number = 0) => {\n if (!currentJourneyId.current || id !== currentJourneyId.current) {\n console.error(\n currentJourneyId.current\n ? `nextCoachmark was called before setJourney`\n : `A Journey is already active, Current Journey: ${currentJourneyId.current}, New Journey Request: ${id}`,\n );\n\n return;\n }\n\n if (delayInMs !== 0) {\n // If delay is not 0, we will hide all them coachmarks and reveal only after the delay\n setCoachmarkList(prevList => {\n return prevList.map((item: ICoachmarkProps) => {\n return { ...item, isActive: false };\n });\n });\n }\n\n const timer = setTimeout(() => {\n clearTimeout(timer);\n const currIndex = currentIndex.current + 1;\n\n setCoachmarkList(prevList => {\n // Finish onboarding\n if (currIndex >= prevList.length || prevList.length === 0) {\n currentJourneyId.current = undefined;\n currentIndex.current = -1;\n\n return [];\n }\n\n currentIndex.current = currIndex;\n const updatedCoachmarkList = [...prevList];\n\n (updatedCoachmarkList[currIndex] as ICoachmarkProps).isActive = true;\n\n if (currIndex > 0) {\n (updatedCoachmarkList[currIndex - 1] as ICoachmarkProps).isActive = keepPrevActive;\n }\n\n return updatedCoachmarkList;\n });\n }, delayInMs);\n\n timerRefs.current.push(timer);\n },\n [],\n );\n\n const memoizedContextValue: IJourneyContext = useMemo(\n () => ({\n nextCoachmark,\n setJourney,\n addCoachmark,\n clearJourney,\n endJourney,\n coachmarks: coachmarkList,\n userCompletedJourneyIds,\n isJourneyActive,\n }),\n [\n nextCoachmark,\n setJourney,\n addCoachmark,\n clearJourney,\n endJourney,\n coachmarkList,\n userCompletedJourneyIds,\n isJourneyActive,\n ],\n );\n\n // Get the initial state of incompleteJourneys\n useEffect(() => {\n if (appId && userId) {\n getJourneyProgress(userId, {\n app_id: appId,\n user_id: userId,\n journey_status: 'COMPLETED',\n });\n }\n }, [appId, getJourneyProgress, userId]);\n\n // Set the data to context state initially\n useEffect(() => {\n if (userCompletedJourneys) {\n const completedUserJourneysIds = userCompletedJourneys.map(journey => journey.journey_id);\n\n setUserCompletedJourneyIds(completedUserJourneysIds);\n }\n }, [userCompletedJourneys]);\n\n return (\n <JourneyContext.Provider value={memoizedContextValue}>\n {showCoachmarks && (\n <S.Overlay>\n {coachmarkList.map((coachmark, index) => (\n <Coachmark key={`coachmark-${index}`} coachmark={coachmark} />\n ))}\n </S.Overlay>\n )}\n {children}\n </JourneyContext.Provider>\n );\n};\n"],"names":["JourneyContext","createContext","JourneyProvider","children","appId","userId","userCompletedJourneyIds","setUserCompletedJourneyIds","useState","coachmarkList","setCoachmarkList","isJourneyActive","setIsJourneyActive","currentIndex","useRef","currentJourneyId","timerRefs","postJourneyCompletion","usePostUserJourney","userCompletedJourneys","getJourneyProgress","isProcessing","useGetUserJourney","showCoachmarks","setJourney","useCallback","id","coachmarks","clearJourney","timer","endJourney","journeyId","prev","addCoachmark","coachmark","nextCoachmark","keepPrevActive","delayInMs","prevList","item","currIndex","updatedCoachmarkList","memoizedContextValue","useMemo","useEffect","completedUserJourneysIds","journey","jsxs","S.Overlay","index","jsx","Coachmark"],"mappings":";;;;;AAea,MAAAA,IAAiBC,EAAsC,IAAI,GAE3DC,IAA6C,CAAC,EAAE,UAAAC,GAAU,OAAAC,GAAO,QAAAC,QAAa;AACzF,QAAM,CAACC,GAAyBC,CAA0B,IAAIC,EAAuB,CAAE,CAAA,GACjF,CAACC,GAAeC,CAAg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AA,MACA,YAAAX;AAAA,MACA,cAAAS;AAAA,MACA,cAAAL;AAAA,MACA,YAAAE;AAAA,MACA,YAAYrB;AAAA,MACZ,yBAAAH;AAAA,MACA,iBAAAK;AAAA,IAAA;AAAA,IAEF;AAAA,MACEwB;AAAA,MACAX;AAAA,MACAS;AAAA,MACAL;AAAA,MACAE;AAAA,MACArB;AAAA,MACAH;AAAA,MACAK;AAAA,IACF;AAAA,EAAA;AAIF,SAAAiC,EAAU,MAAM;AACd,IAAIxC,KAASC,KACXe,EAAmBf,GAAQ;AAAA,MACzB,QAAQD;AAAA,MACR,SAASC;AAAA,MACT,gBAAgB;AAAA,IAAA,CACjB;AAAA,EAEF,GAAA,CAACD,GAAOgB,GAAoBf,CAAM,CAAC,GAGtCuC,EAAU,MAAM;AACd,QAAIzB,GAAuB;AACzB,YAAM0B,IAA2B1B,EAAsB,IAAI,CAAA2B,MAAWA,EAAQ,UAAU;AAExF,MAAAvC,EAA2BsC,CAAwB;AAAA,IACrD;AAAA,EAAA,GACC,CAAC1B,CAAqB,CAAC,GAGvB,gBAAA4B,EAAA/C,EAAe,UAAf,EAAwB,OAAO0C,GAC7B,UAAA;AAAA,IAAAnB,uBACEyB,GAAA,EACE,UAAAvC,EAAc,IAAI,CAACyB,GAAWe,MAC7B,gBAAAC,EAACC,KAAqC,WAAAjB,KAAtB,aAAae,CAAK,EAA0B,CAC7D,GACH;AAAA,IAED9C;AAAA,EACH,EAAA,CAAA;AAEJ;"}
|
1
|
+
{"version":3,"file":"journey-context-provider.js","sources":["../../../../src/features/journey/use-journey/journey-context-provider.tsx"],"sourcesContent":["/* eslint-disable no-console */\nimport type { TJourneyId } from '../journey-id/journey-id-types';\nimport type {\n ICoachmarkProps,\n IJourneyContext,\n IJourneyProviderProps,\n} from './journey-context-types';\nimport type { FC } from 'react';\n\nimport { createContext, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { Coachmark } from '../comps/coachmark/coachmark';\nimport { useGetUserJourney, usePostUserJourney } from '../user-journey-api/user-journey-api';\nimport * as S from './journey-styled';\n\nexport const JourneyContext = createContext<IJourneyContext | null>(null);\n\nexport const JourneyProvider: FC<IJourneyProviderProps> = ({ children, appId, userId }) => {\n const [userCompletedJourneyIds, setUserCompletedJourneyIds] = useState<TJourneyId[]>([]);\n const [coachmarkList, setCoachmarkList] = useState<ICoachmarkProps[]>([]);\n const [isJourneyActive, setIsJourneyActive] = useState(false);\n const currentIndex = useRef(-1);\n const currentJourneyId = useRef<TJourneyId | undefined>();\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const { post: postJourneyCompletion } = usePostUserJourney();\n const {\n data: userCompletedJourneys = null,\n get: getJourneyProgress,\n isProcessing,\n } = useGetUserJourney();\n\n const showCoachmarks =\n appId === '' // Otherwise coachmark stories wont work\n ? coachmarkList.length > 0\n : userCompletedJourneys && !isProcessing && coachmarkList.length > 0;\n\n const setJourney = useCallback(\n (id: TJourneyId, coachmarks: ICoachmarkProps[]) => {\n if (coachmarkList.length > 0) {\n console.error(\n `setJourney: Other Journey is already active, Current Journey: ${currentJourneyId.current}, New Journey Request: ${id}`,\n );\n\n return;\n }\n console.log(`setJourney: Journey ID: ${id}`);\n\n setIsJourneyActive(true);\n currentJourneyId.current = id;\n currentIndex.current = -1;\n setCoachmarkList([...coachmarks]);\n },\n [coachmarkList.length],\n );\n\n const clearJourney = useCallback(() => {\n // Clear all timers\n timerRefs.current.forEach(timer => {\n clearTimeout(timer);\n });\n timerRefs.current = [];\n currentJourneyId.current = undefined;\n currentIndex.current = -1;\n setCoachmarkList([]);\n setIsJourneyActive(false);\n }, []);\n\n const endJourney = useCallback(\n (journeyId: TJourneyId) => {\n setUserCompletedJourneyIds(prev => [...prev, journeyId]);\n postJourneyCompletion({\n app_id: appId,\n user_id: userId,\n journey_id: journeyId,\n journey_status: 'COMPLETED',\n });\n clearJourney();\n },\n [appId, clearJourney, postJourneyCompletion, userId],\n );\n\n const addCoachmark = useCallback((id: TJourneyId, coachmark: ICoachmarkProps) => {\n if (!currentJourneyId.current || id !== currentJourneyId.current) {\n console.error(\n currentJourneyId.current\n ? `A Journey is already active, Current Journey: ${currentJourneyId.current}, New Journey Request: ${id}`\n : `addCoachmark was called before setJourney and Journey ID is undefined`,\n );\n\n return;\n }\n console.log(`addCoachmark: Journey ID: ${id}`);\n\n setCoachmarkList(prev => [...prev, coachmark]);\n }, []);\n\n const nextCoachmark = useCallback(\n (id: TJourneyId, keepPrevActive: boolean = false, delayInMs: number = 0) => {\n if (!currentJourneyId.current || id !== currentJourneyId.current) {\n console.error(\n currentJourneyId.current\n ? `nextCoachmark was called before setJourney`\n : `A Journey is already active, Current Journey: ${currentJourneyId.current}, New Journey Request: ${id}`,\n );\n\n return;\n }\n console.log(nextCoachmark);\n\n if (delayInMs !== 0) {\n // If delay is not 0, we will hide all them coachmarks and reveal only after the delay\n setCoachmarkList(prevList => {\n return prevList.map((item: ICoachmarkProps) => {\n return { ...item, isActive: false };\n });\n });\n }\n\n const timer = setTimeout(() => {\n clearTimeout(timer);\n const currIndex = currentIndex.current + 1;\n\n setCoachmarkList(prevList => {\n // Finish onboarding\n if (currIndex >= prevList.length || prevList.length === 0) {\n currentJourneyId.current = undefined;\n currentIndex.current = -1;\n\n return [];\n }\n\n currentIndex.current = currIndex;\n const updatedCoachmarkList = [...prevList];\n\n (updatedCoachmarkList[currIndex] as ICoachmarkProps).isActive = true;\n\n if (currIndex > 0) {\n (updatedCoachmarkList[currIndex - 1] as ICoachmarkProps).isActive = keepPrevActive;\n }\n\n return updatedCoachmarkList;\n });\n }, delayInMs);\n\n timerRefs.current.push(timer);\n },\n [],\n );\n\n const memoizedContextValue: IJourneyContext = useMemo(\n () => ({\n nextCoachmark,\n setJourney,\n addCoachmark,\n clearJourney,\n endJourney,\n coachmarks: coachmarkList,\n userCompletedJourneyIds,\n isJourneyActive,\n }),\n [\n nextCoachmark,\n setJourney,\n addCoachmark,\n clearJourney,\n endJourney,\n coachmarkList,\n userCompletedJourneyIds,\n isJourneyActive,\n ],\n );\n\n // Get the initial state of incompleteJourneys\n useEffect(() => {\n if (appId && userId) {\n getJourneyProgress(userId, {\n app_id: appId,\n user_id: userId,\n journey_status: 'COMPLETED',\n });\n }\n }, [appId, getJourneyProgress, userId]);\n\n // Set the data to context state initially\n useEffect(() => {\n if (userCompletedJourneys) {\n const completedUserJourneysIds = userCompletedJourneys.map(journey => journey.journey_id);\n\n setUserCompletedJourneyIds(completedUserJourneysIds);\n }\n }, [userCompletedJourneys]);\n\n return (\n <JourneyContext.Provider value={memoizedContextValue}>\n {showCoachmarks && (\n <S.Overlay>\n {coachmarkList.map((coachmark, index) => (\n <Coachmark key={`coachmark-${index}`} coachmark={coachmark} />\n ))}\n </S.Overlay>\n )}\n {children}\n </JourneyContext.Provider>\n );\n};\n"],"names":["JourneyContext","createContext","JourneyProvider","children","appId","userId","userCompletedJourneyIds","setUserCompletedJourneyIds","useState","coachmarkList","setCoachmarkList","isJourneyActive","setIsJourneyActive","currentIndex","useRef","currentJourneyId","timerRefs","postJourneyCompletion","usePostUserJourney","userCompletedJourneys","getJourneyProgress","isProcessing","useGetUserJourney","showCoachmarks","setJourney","useCallback","id","coachmarks","clearJourney","timer","endJourney","journeyId","prev","addCoachmark","coachmark","nextCoachmark","keepPrevActive","delayInMs","prevList","item","currIndex","updatedCoachmarkList","memoizedContextValue","useMemo","useEffect","completedUserJourneysIds","journey","jsxs","S.Overlay","index","jsx","Coachmark"],"mappings":";;;;;AAea,MAAAA,IAAiBC,EAAsC,IAAI,GAE3DC,IAA6C,CAAC,EAAE,UAAAC,GAAU,OAAAC,GAAO,QAAAC,QAAa;AACzF,QAAM,CAACC,GAAyBC,CAA0B,IAAIC,EAAuB,CAAE,CAAA,GACjF,CAACC,GAAeC,CAAgB,IAAIF,EAA4B,CAAE,CAAA,GAClE,CAACG,GAAiBC,CAAkB,IAAIJ,EAAS,EAAK,GACtDK,IAAeC,EAAO,EAAE,GACxBC,IAAmBD,KACnBE,IAAYF,E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,cAAAL;AAAA,MACA,YAAAE;AAAA,MACA,YAAYrB;AAAA,MACZ,yBAAAH;AAAA,MACA,iBAAAK;AAAA,IAAA;AAAA,IAEF;AAAA,MACEwB;AAAA,MACAX;AAAA,MACAS;AAAA,MACAL;AAAA,MACAE;AAAA,MACArB;AAAA,MACAH;AAAA,MACAK;AAAA,IACF;AAAA,EAAA;AAIF,SAAAiC,EAAU,MAAM;AACd,IAAIxC,KAASC,KACXe,EAAmBf,GAAQ;AAAA,MACzB,QAAQD;AAAA,MACR,SAASC;AAAA,MACT,gBAAgB;AAAA,IAAA,CACjB;AAAA,EAEF,GAAA,CAACD,GAAOgB,GAAoBf,CAAM,CAAC,GAGtCuC,EAAU,MAAM;AACd,QAAIzB,GAAuB;AACzB,YAAM0B,IAA2B1B,EAAsB,IAAI,CAAA2B,MAAWA,EAAQ,UAAU;AAExF,MAAAvC,EAA2BsC,CAAwB;AAAA,IACrD;AAAA,EAAA,GACC,CAAC1B,CAAqB,CAAC,GAGvB,gBAAA4B,EAAA/C,EAAe,UAAf,EAAwB,OAAO0C,GAC7B,UAAA;AAAA,IAAAnB,uBACEyB,GAAA,EACE,UAAAvC,EAAc,IAAI,CAACyB,GAAWe,MAC7B,gBAAAC,EAACC,KAAqC,WAAAjB,KAAtB,aAAae,CAAK,EAA0B,CAC7D,GACH;AAAA,IAED9C;AAAA,EACH,EAAA,CAAA;AAEJ;"}
|
package/dist/index.d.ts
CHANGED
@@ -1107,6 +1107,7 @@ declare interface IGame extends IBaseProject {
|
|
1107
1107
|
declare interface IGameLauncherProps {
|
1108
1108
|
onSegmentClick: (projectDetail: Game | Puzzle | Lesson | ITableDetails, projectType: ProjectType) => void;
|
1109
1109
|
isLoading?: boolean;
|
1110
|
+
isError?: boolean;
|
1110
1111
|
data: IProjectData | null;
|
1111
1112
|
defaultIndex?: number;
|
1112
1113
|
journeyId?: TJourneyId;
|