@cuemath/leap 2.8.62-rj-1 → 2.8.62-rj-4
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/comps/carousel/carousel.js +49 -51
- package/dist/features/circle-games/game-launcher/comps/carousel/carousel.js.map +1 -1
- package/dist/features/circle-games/game-launcher/game-launcher.js +67 -73
- package/dist/features/circle-games/game-launcher/game-launcher.js.map +1 -1
- package/dist/features/circle-games/game-launcher/hooks/use-game-launcher-journey/use-game-launcher-journey.js +78 -79
- 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 +108 -110
- 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 +46 -46
- package/dist/features/journey/use-journey/journey-context-provider.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/package.json +1 -1
@@ -1,103 +1,102 @@
|
|
1
|
-
import { jsx as t, Fragment as
|
2
|
-
import { useRef as
|
3
|
-
import
|
4
|
-
import { PLATFORM_EVENTS_STUDENT as
|
1
|
+
import { jsx as t, Fragment as L } from "react/jsx-runtime";
|
2
|
+
import { useRef as I, useCallback as p, useMemo as oe, useEffect as le } from "react";
|
3
|
+
import j from "../../../../../assets/line-icons/icons/carat-right.js";
|
4
|
+
import { PLATFORM_EVENTS_STUDENT as z } from "../../../../analytics-events/platform-events-student.js";
|
5
5
|
import { IndicatorType as a } from "../../../../journey/use-journey/constants.js";
|
6
|
-
import { useJourney as
|
7
|
-
import
|
8
|
-
import { useUIContext as
|
9
|
-
import
|
6
|
+
import { useJourney as ce } from "../../../../journey/use-journey/use-journey.js";
|
7
|
+
import ee from "../../../../ui/buttons/icon-button/icon-button.js";
|
8
|
+
import { useUIContext as ae } from "../../../../ui/context/context.js";
|
9
|
+
import O from "../../../../ui/layout/flex-view.js";
|
10
10
|
import d from "../../../../ui/text/text.js";
|
11
11
|
import { CIRCLE_ONBOARDING_ANALYTICS_STEPS as _ } from "../../../enum/circle-onboarding-steps.js";
|
12
|
-
import { useCircleSounds as
|
12
|
+
import { useCircleSounds as de } from "../../../hooks/use-circle-sounds/use-circle-sounds.js";
|
13
13
|
import { SegmentedGameCard as he } from "../../comps/segmented-game-card/segmented-game-card.js";
|
14
|
-
import { GAME_LAUNCHER_ANALYTICS_EVENTS as
|
15
|
-
import { GO_TO_NEXT_SLIDE_AFTER_MS as
|
16
|
-
import { ProjectType as
|
17
|
-
const
|
14
|
+
import { GAME_LAUNCHER_ANALYTICS_EVENTS as te } from "../../game-launcher-analytics-events.js";
|
15
|
+
import { GO_TO_NEXT_SLIDE_AFTER_MS as se, SHOW_LABEL_HIGHLIGHT_AFTER_MS as me, SHOW_NUDGE_AFTER_MS as ge, SLIDE_TO_LESSON_MS as Te } from "./constants.js";
|
16
|
+
import { ProjectType as ue } from "../../../games/web-view/enums/project-type-enum.js";
|
17
|
+
const Ge = ({
|
18
18
|
carouselRefs: n,
|
19
|
-
onSegmentClick:
|
19
|
+
onSegmentClick: S
|
20
20
|
}) => {
|
21
|
-
const o =
|
21
|
+
const o = I(null), r = I(null), l = I(null), C = I([]), { playButtonSound: b } = de(), { nextCoachmark: h, setJourney: R, endJourney: N } = ce(), { onEvent: f } = ae(), P = p(
|
22
22
|
(e) => {
|
23
|
-
|
23
|
+
f(z.ONBOARDING_STEP_VIEWED, {
|
24
24
|
step: e
|
25
25
|
});
|
26
26
|
},
|
27
|
-
[
|
28
|
-
),
|
27
|
+
[f]
|
28
|
+
), y = p(
|
29
29
|
(e) => {
|
30
|
-
|
30
|
+
f(z.ONBOARDING_STEP_COMPLETED, {
|
31
31
|
step: e
|
32
32
|
});
|
33
33
|
},
|
34
|
-
[
|
35
|
-
),
|
36
|
-
(e, c, i,
|
37
|
-
var
|
38
|
-
|
39
|
-
const
|
40
|
-
clearTimeout(
|
34
|
+
[f]
|
35
|
+
), s = p(
|
36
|
+
(e, c, i, m, A = !1) => {
|
37
|
+
var T, u;
|
38
|
+
A || (b(), (u = n.current) == null || u.goToIndex(((T = n.current) == null ? void 0 : T.currentIndex) + 1), h(m, !1, se)), P(e);
|
39
|
+
const g = setTimeout(() => {
|
40
|
+
clearTimeout(g), c.startLabelAnimation(i);
|
41
41
|
}, me);
|
42
|
-
C.current.push(
|
42
|
+
C.current.push(g), h(m, !0, ge);
|
43
43
|
},
|
44
|
-
[n,
|
45
|
-
),
|
44
|
+
[n, h, b, P]
|
45
|
+
), H = p(
|
46
46
|
(e, c) => {
|
47
|
-
|
47
|
+
S(e, ue.PUZZLE), y(_.PUZZLE_ACTIVITY), N(c);
|
48
48
|
},
|
49
|
-
[N,
|
50
|
-
),
|
49
|
+
[N, S, y]
|
50
|
+
), G = p(
|
51
51
|
(e, c, i) => {
|
52
|
-
var Y, v, B, U, V, x, D, M,
|
53
|
-
if (
|
52
|
+
var w, Y, v, B, U, V, x, D, M, W, X, $, J, F, Z, K, q, Q;
|
53
|
+
if (!((w = n == null ? void 0 : n.current) != null && w.nextBtnRef.current) || !((Y = r == null ? void 0 : r.current) != null && Y.segmentedCardWrapperRef.current) || !((v = o == null ? void 0 : o.current) != null && v.labelRef.current) || !((B = r == null ? void 0 : r.current) != null && B.labelRef.current) || !e)
|
54
54
|
return;
|
55
|
-
|
56
|
-
const g = ((D = (x = (V = l.current) == null ? void 0 : V.labelRef) == null ? void 0 : x.current) == null ? void 0 : D.getBoundingClientRect()) || {
|
55
|
+
const m = ((x = (V = (U = l.current) == null ? void 0 : U.labelRef) == null ? void 0 : V.current) == null ? void 0 : x.getBoundingClientRect()) || {
|
57
56
|
height: 0,
|
58
57
|
width: 0
|
59
|
-
},
|
58
|
+
}, A = ((W = (M = (D = o.current) == null ? void 0 : D.labelRef) == null ? void 0 : M.current) == null ? void 0 : W.getBoundingClientRect()) || {
|
60
59
|
height: 0,
|
61
60
|
width: 0
|
62
|
-
},
|
61
|
+
}, g = ((J = ($ = (X = r.current) == null ? void 0 : X.labelRef) == null ? void 0 : $.current) == null ? void 0 : J.getBoundingClientRect()) || {
|
63
62
|
height: 0,
|
64
63
|
width: 0
|
65
|
-
},
|
64
|
+
}, T = ((K = (Z = (F = r.current) == null ? void 0 : F.segmentedCardWrapperRef) == null ? void 0 : Z.current) == null ? void 0 : K.getBoundingClientRect()) || {
|
66
65
|
height: 0,
|
67
66
|
width: 0
|
68
67
|
};
|
69
|
-
let
|
70
|
-
c && l.current && (
|
68
|
+
let u = [];
|
69
|
+
c && l.current && (u = [
|
71
70
|
{
|
72
71
|
originalElementToHighlightRef: l.current.labelRef,
|
73
72
|
isActive: !1,
|
74
73
|
type: a.TOOLTIP,
|
75
|
-
elementToHighlight: /* @__PURE__ */ t(
|
74
|
+
elementToHighlight: /* @__PURE__ */ t(L, {}),
|
76
75
|
indicator: {
|
77
76
|
position: "right",
|
78
77
|
backgroundColor: "BLUE_4",
|
79
78
|
width: 264,
|
80
|
-
tooltipItem: /* @__PURE__ */ t(
|
81
|
-
tooltipXCoOrdinates:
|
82
|
-
tooltipYCoOrdinates:
|
79
|
+
tooltipItem: /* @__PURE__ */ t(O, { children: /* @__PURE__ */ t(d, { $renderAs: "ab2-bold", children: "Get faster & stay ahead in school. Practice 3 new skills everyday." }) }),
|
80
|
+
tooltipXCoOrdinates: m.width + 50,
|
81
|
+
tooltipYCoOrdinates: m.height / 2
|
83
82
|
}
|
84
83
|
},
|
85
84
|
{
|
86
|
-
originalElementToHighlightRef: (
|
85
|
+
originalElementToHighlightRef: (q = n.current) == null ? void 0 : q.nextBtnRef,
|
87
86
|
isActive: !1,
|
88
87
|
type: a.NUDGE,
|
89
88
|
elementToHighlight: /* @__PURE__ */ t(
|
90
|
-
|
89
|
+
ee,
|
91
90
|
{
|
92
91
|
renderAs: "secondary",
|
93
|
-
Icon:
|
94
|
-
onClick: () =>
|
92
|
+
Icon: j,
|
93
|
+
onClick: () => s(
|
95
94
|
_.GAMES_ACTIVITY,
|
96
95
|
o.current,
|
97
96
|
"ORANGE_4",
|
98
97
|
i
|
99
98
|
),
|
100
|
-
analyticsLabel:
|
99
|
+
analyticsLabel: te.JOURNEY_NEXT_ACTIVITY
|
101
100
|
}
|
102
101
|
),
|
103
102
|
indicator: {
|
@@ -108,19 +107,19 @@ const ke = ({
|
|
108
107
|
}
|
109
108
|
}
|
110
109
|
]);
|
111
|
-
const
|
110
|
+
const ne = [
|
112
111
|
{
|
113
112
|
originalElementToHighlightRef: o.current.labelRef,
|
114
113
|
isActive: !1,
|
115
114
|
type: a.TOOLTIP,
|
116
|
-
elementToHighlight: /* @__PURE__ */ t(
|
115
|
+
elementToHighlight: /* @__PURE__ */ t(L, {}),
|
117
116
|
indicator: {
|
118
117
|
position: "right",
|
119
118
|
backgroundColor: "ORANGE_4",
|
120
119
|
width: 264,
|
121
|
-
tooltipItem: /* @__PURE__ */ t(
|
122
|
-
tooltipXCoOrdinates:
|
123
|
-
tooltipYCoOrdinates:
|
120
|
+
tooltipItem: /* @__PURE__ */ t(O, { children: /* @__PURE__ */ t(d, { $renderAs: "ab2-bold", children: "Train to think deeper & plan ahead. Play 3 new games everyday." }) }),
|
121
|
+
tooltipXCoOrdinates: A.width + 50,
|
122
|
+
tooltipYCoOrdinates: A.height / 2
|
124
123
|
}
|
125
124
|
},
|
126
125
|
{
|
@@ -128,17 +127,17 @@ const ke = ({
|
|
128
127
|
isActive: !1,
|
129
128
|
type: a.NUDGE,
|
130
129
|
elementToHighlight: /* @__PURE__ */ t(
|
131
|
-
|
130
|
+
ee,
|
132
131
|
{
|
133
132
|
renderAs: "secondary",
|
134
|
-
Icon:
|
135
|
-
onClick: () =>
|
133
|
+
Icon: j,
|
134
|
+
onClick: () => s(
|
136
135
|
_.PUZZLE_ACTIVITY,
|
137
136
|
r.current,
|
138
137
|
"PURPLE_4",
|
139
138
|
i
|
140
139
|
),
|
141
|
-
analyticsLabel:
|
140
|
+
analyticsLabel: te.JOURNEY_NEXT_ACTIVITY
|
142
141
|
}
|
143
142
|
),
|
144
143
|
indicator: {
|
@@ -148,19 +147,19 @@ const ke = ({
|
|
148
147
|
nudgePointerY: 0
|
149
148
|
}
|
150
149
|
}
|
151
|
-
],
|
150
|
+
], ie = [
|
152
151
|
{
|
153
152
|
originalElementToHighlightRef: r.current.labelRef,
|
154
153
|
isActive: !1,
|
155
154
|
type: a.TOOLTIP,
|
156
|
-
elementToHighlight: /* @__PURE__ */ t(
|
155
|
+
elementToHighlight: /* @__PURE__ */ t(L, {}),
|
157
156
|
indicator: {
|
158
157
|
position: "right",
|
159
158
|
backgroundColor: "PURPLE_4",
|
160
159
|
width: 264,
|
161
|
-
tooltipItem: /* @__PURE__ */ t(
|
162
|
-
tooltipXCoOrdinates:
|
163
|
-
tooltipYCoOrdinates:
|
160
|
+
tooltipItem: /* @__PURE__ */ t(O, { children: /* @__PURE__ */ t(d, { $renderAs: "ab2-bold", children: "Think in new ways & stay sharp. Solve 3 new puzzles everyday." }) }),
|
161
|
+
tooltipXCoOrdinates: g.width + 50,
|
162
|
+
tooltipYCoOrdinates: g.height / 2
|
164
163
|
}
|
165
164
|
},
|
166
165
|
{
|
@@ -179,39 +178,39 @@ const ke = ({
|
|
179
178
|
name: "",
|
180
179
|
// We dont want to show the name of the puzzle in onboarding
|
181
180
|
isCompleted: E.solved,
|
182
|
-
onPress: () =>
|
181
|
+
onPress: () => H(E, i)
|
183
182
|
}))
|
184
183
|
}
|
185
184
|
),
|
186
185
|
indicator: {
|
187
186
|
nudge: "click",
|
188
187
|
content: /* @__PURE__ */ t(d, { $renderAs: "ab1", $color: "WHITE", children: "Click to solve a puzzle" }),
|
189
|
-
nudgePointerX:
|
190
|
-
nudgePointerY:
|
188
|
+
nudgePointerX: T.width * 0.6,
|
189
|
+
nudgePointerY: T.height * 0.4
|
191
190
|
}
|
192
191
|
}
|
193
192
|
];
|
194
|
-
|
195
|
-
const
|
196
|
-
clearTimeout(
|
193
|
+
R(i, [...u, ...ne, ...ie]), (Q = n.current) == null || Q.goToIndex(0);
|
194
|
+
const k = setTimeout(() => {
|
195
|
+
clearTimeout(k), h(i);
|
197
196
|
}, Te);
|
198
|
-
C.current.push(
|
197
|
+
C.current.push(k), c && l.current ? s(_.SKILL_ACTIVITY, l.current, "BLUE_4", i, !0) : s(_.GAMES_ACTIVITY, o.current, "ORANGE_4", i, !0);
|
199
198
|
},
|
200
|
-
[n,
|
201
|
-
),
|
199
|
+
[n, H, s, h, R]
|
200
|
+
), re = oe(
|
202
201
|
() => ({
|
203
202
|
gameRefs: o,
|
204
203
|
puzzleRefs: r,
|
205
204
|
lessonRefs: l,
|
206
|
-
startJourney:
|
205
|
+
startJourney: G
|
207
206
|
}),
|
208
|
-
[
|
207
|
+
[G]
|
209
208
|
);
|
210
|
-
return
|
211
|
-
C.current.forEach((e) => clearTimeout(e)), C.current = []
|
212
|
-
}, [n]),
|
209
|
+
return le(() => () => {
|
210
|
+
C.current.forEach((e) => clearTimeout(e)), C.current = [];
|
211
|
+
}, [n]), re;
|
213
212
|
};
|
214
213
|
export {
|
215
|
-
|
214
|
+
Ge as useGameLauncherJourney
|
216
215
|
};
|
217
216
|
//# 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 { TJourneyId } from '../../../../journey/journey-id/journey-id-types';\nimport type { ICoachmarkProps } from '../../../../journey/use-journey/journey-context-types';\nimport type { IArrowTooltipProps } from '../../../../ui/arrow-tooltip/arrow-tooltip-types';\nimport type { INudgeProps } from '../../../../ui/nudge/nudge-types';\nimport type { TColorNames } from '../../../../ui/types';\nimport type { ISegmentedGameCardRefs } from '../../comps/segmented-game-card/segmented-game-card-types';\nimport type {\n IProject,\n Puzzle,\n} from '../../dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport type { IUseGameLauncherJourneyProps } from './use-game-launcher-journey-types';\n\nimport { useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport CaratRightIcon from '../../../../../assets/line-icons/icons/carat-right';\nimport { PLATFORM_EVENTS_STUDENT as AnalyticsLabel } from '../../../../analytics-events/platform-events-student';\nimport { IndicatorType } from '../../../../journey/use-journey/constants';\nimport { useJourney } from '../../../../journey/use-journey/use-journey';\nimport IconButton from '../../../../ui/buttons/icon-button/icon-button';\nimport { useUIContext } from '../../../../ui/context/context';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport { CIRCLE_ONBOARDING_ANALYTICS_STEPS as ActionEvent } from '../../../enum/circle-onboarding-steps';\nimport { ProjectType } from '../../../games/web-view/enums';\nimport { useCircleSounds } from '../../../hooks/use-circle-sounds/use-circle-sounds';\nimport { SegmentedGameCard } from '../../comps/segmented-game-card/segmented-game-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from '../../game-launcher-analytics-events';\nimport {\n GO_TO_NEXT_SLIDE_AFTER_MS,\n SHOW_LABEL_HIGHLIGHT_AFTER_MS,\n SHOW_NUDGE_AFTER_MS,\n SLIDE_TO_LESSON_MS,\n} from './constants';\n\nexport const useGameLauncherJourney = ({\n carouselRefs,\n onSegmentClick,\n}: IUseGameLauncherJourneyProps) => {\n const gameRefs = useRef<ISegmentedGameCardRefs>(null);\n const puzzleRefs = useRef<ISegmentedGameCardRefs>(null);\n const lessonRefs = useRef<ISegmentedGameCardRefs>(null);\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const isJourneyInProgress = useRef(false);\n\n const { playButtonSound } = useCircleSounds();\n const { nextCoachmark, setJourney, endJourney } = useJourney();\n const { onEvent: trackAnalytics } = useUIContext();\n\n const trackEventViewed = useCallback(\n (step: ActionEvent) => {\n trackAnalytics(AnalyticsLabel.ONBOARDING_STEP_VIEWED, {\n step,\n });\n },\n [trackAnalytics],\n );\n const trackEventCompleted = useCallback(\n (step: ActionEvent) => {\n trackAnalytics(AnalyticsLabel.ONBOARDING_STEP_COMPLETED, {\n step,\n });\n },\n [trackAnalytics],\n );\n\n const goToNextCard = useCallback(\n (\n analyticsLabelViewed: ActionEvent,\n refOfNextSlide: ISegmentedGameCardRefs,\n color: TColorNames,\n journeyId: TJourneyId,\n isFirstSlide: boolean = false,\n ) => {\n if (!isFirstSlide) {\n playButtonSound();\n carouselRefs.current?.goToIndex(carouselRefs.current?.currentIndex + 1);\n nextCoachmark(journeyId, false, GO_TO_NEXT_SLIDE_AFTER_MS);\n }\n\n trackEventViewed(analyticsLabelViewed);\n\n const animateLabelTimer = setTimeout(() => {\n clearTimeout(animateLabelTimer);\n refOfNextSlide.startLabelAnimation(color);\n }, SHOW_LABEL_HIGHLIGHT_AFTER_MS);\n\n timerRefs.current.push(animateLabelTimer); // Store to cleanup later\n\n nextCoachmark(journeyId, true, SHOW_NUDGE_AFTER_MS);\n },\n [carouselRefs, nextCoachmark, playButtonSound, trackEventViewed],\n );\n\n const handleEndJourney = useCallback(\n (puzzlesData: Puzzle, journeyId: TJourneyId) => {\n onSegmentClick(puzzlesData, ProjectType.PUZZLE);\n trackEventCompleted(ActionEvent.PUZZLE_ACTIVITY);\n endJourney(journeyId);\n },\n [endJourney, onSegmentClick, trackEventCompleted],\n );\n\n const startJourney = useCallback(\n (puzzlesData: IProject<Puzzle>, isLessonAvailable: boolean, journeyId: TJourneyId) => {\n if (isJourneyInProgress.current) {\n return;\n }\n\n // If element refs are not available return, this is just for type safety\n if (\n !carouselRefs?.current?.nextBtnRef.current ||\n !puzzleRefs?.current?.segmentedCardWrapperRef.current ||\n !gameRefs?.current?.labelRef.current ||\n !puzzleRefs?.current?.labelRef.current ||\n !puzzlesData\n ) {\n return;\n }\n\n isJourneyInProgress.current = true;\n const lessonLabelDims = lessonRefs.current?.labelRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n const gameLabelDims = gameRefs.current?.labelRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n const puzzleLabelDims = puzzleRefs.current?.labelRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n\n const launcherDims =\n puzzleRefs.current?.segmentedCardWrapperRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n\n let lessonSteps: ICoachmarkProps[] = [];\n\n if (isLessonAvailable && lessonRefs.current) {\n lessonSteps = [\n {\n originalElementToHighlightRef: lessonRefs.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'BLUE_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Get faster & stay ahead in school. Practice 3 new skills everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: lessonLabelDims.width + 50,\n tooltipYCoOrdinates: lessonLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: carouselRefs.current?.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={() =>\n goToNextCard(\n ActionEvent.GAMES_ACTIVITY,\n gameRefs.current as ISegmentedGameCardRefs,\n 'ORANGE_4',\n journeyId,\n )\n }\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to proceed\n </Text>\n ),\n nudgePointerX: 0,\n nudgePointerY: 0,\n } as INudgeProps,\n },\n ];\n }\n\n const gameSteps: ICoachmarkProps[] = [\n {\n originalElementToHighlightRef: gameRefs.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'ORANGE_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Train to think deeper & plan ahead. Play 3 new games everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: gameLabelDims.width + 50,\n tooltipYCoOrdinates: gameLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: carouselRefs.current.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={() =>\n goToNextCard(\n ActionEvent.PUZZLE_ACTIVITY,\n puzzleRefs.current as ISegmentedGameCardRefs,\n 'PURPLE_4',\n journeyId,\n )\n }\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to proceed\n </Text>\n ),\n nudgePointerX: 0,\n nudgePointerY: 0,\n } as INudgeProps,\n },\n ];\n\n const puzzleSteps: ICoachmarkProps[] = [\n {\n originalElementToHighlightRef: puzzleRefs.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'PURPLE_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Think in new ways & stay sharp. Solve 3 new puzzles everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: puzzleLabelDims.width + 50,\n tooltipYCoOrdinates: puzzleLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: puzzleRefs.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <SegmentedGameCard\n label={''} // This is intentionally left blank to avoid showing the label\n value={puzzlesData.data.filter(puzzle => puzzle.solved).length}\n maxValue={puzzlesData.data.length}\n initialValue={puzzlesData.initialProgressValue}\n data={puzzlesData.data.map(puzzle => ({\n card: puzzle.cardLottie,\n name: '', // We dont want to show the name of the puzzle in onboarding\n isCompleted: puzzle.solved,\n onPress: () => handleEndJourney(puzzle, journeyId),\n }))}\n />\n ),\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to solve a puzzle\n </Text>\n ),\n nudgePointerX: launcherDims.width * 0.6,\n nudgePointerY: launcherDims.height * 0.4,\n } as INudgeProps,\n },\n ];\n\n setJourney(journeyId, [...lessonSteps, ...gameSteps, ...puzzleSteps]);\n\n carouselRefs.current?.goToIndex(0); // Always start from 0th Index no matter what the current index is\n\n const delayBeforeStart = setTimeout(() => {\n clearTimeout(delayBeforeStart);\n nextCoachmark(journeyId);\n }, SLIDE_TO_LESSON_MS);\n\n timerRefs.current.push(delayBeforeStart); // Store to cleanup later\n\n if (isLessonAvailable && lessonRefs.current) {\n goToNextCard(ActionEvent.SKILL_ACTIVITY, lessonRefs.current, 'BLUE_4', journeyId, true);\n } else {\n goToNextCard(ActionEvent.GAMES_ACTIVITY, gameRefs.current, 'ORANGE_4', journeyId, true);\n }\n },\n [carouselRefs, handleEndJourney, goToNextCard, nextCoachmark, setJourney],\n );\n\n const data = useMemo(\n () => ({\n gameRefs,\n puzzleRefs,\n lessonRefs,\n startJourney,\n }),\n [startJourney],\n );\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n timerRefs.current.forEach(timer => clearTimeout(timer));\n timerRefs.current = [];\n isJourneyInProgress.current = false;\n };\n }, [carouselRefs]);\n\n return data;\n};\n"],"names":["useGameLauncherJourney","carouselRefs","onSegmentClick","gameRefs","useRef","puzzleRefs","lessonRefs","timerRefs","isJourneyInProgress","playButtonSound","useCircleSounds","nextCoachmark","setJourney","endJourney","useJourney","trackAnalytics","useUIContext","trackEventViewed","useCallback","step","AnalyticsLabel","trackEventCompleted","goToNextCard","analyticsLabelViewed","refOfNextSlide","color","journeyId","isFirstSlide","_b","_a","GO_TO_NEXT_SLIDE_AFTER_MS","animateLabelTimer","SHOW_LABEL_HIGHLIGHT_AFTER_MS","SHOW_NUDGE_AFTER_MS","handleEndJourney","puzzlesData","ProjectType","ActionEvent","startJourney","isLessonAvailable","_c","_d","lessonLabelDims","_g","_f","_e","gameLabelDims","_j","_i","_h","puzzleLabelDims","_m","_l","_k","launcherDims","_p","_o","_n","lessonSteps","IndicatorType","jsx","Fragment","FlexView","Text","_q","IconButton","CaratRightIcon","GAME_LAUNCHER_ANALYTICS_EVENTS","gameSteps","puzzleSteps","SegmentedGameCard","puzzle","_r","delayBeforeStart","SLIDE_TO_LESSON_MS","data","useMemo","useEffect","timer"],"mappings":";;;;;;;;;;;;;;;;AAkCO,MAAMA,KAAyB,CAAC;AAAA,EACrC,cAAAC;AAAA,EACA,gBAAAC;AACF,MAAoC;AAC5B,QAAAC,IAAWC,EAA+B,IAAI,GAC9CC,IAAaD,EAA+B,IAAI,GAChDE,IAAaF,EAA+B,IAAI,GAChDG,IAAYH,EAAwC,CAAA,CAAE,GAEtDI,IAAsBJ,EAAO,EAAK,GAElC,EAAE,iBAAAK,MAAoBC,MACtB,EAAE,eAAAC,GAAe,YAAAC,GAAY,YAAAC,MAAeC,GAAW,GACvD,EAAE,SAASC,EAAe,IAAIC,GAAa,GAE3CC,IAAmBC;AAAA,IACvB,CAACC,MAAsB;AACrB,MAAAJ,EAAeK,GAAe,wBAAwB;AAAA,QACpD,MAAAD;AAAA,MAAA,CACD;AAAA,IACH;AAAA,IACA,CAACJ,CAAc;AAAA,EAAA,GAEXM,IAAsBH;AAAA,IAC1B,CAACC,MAAsB;AACrB,MAAAJ,EAAeK,GAAe,2BAA2B;AAAA,QACvD,MAAAD;AAAA,MAAA,CACD;AAAA,IACH;AAAA,IACA,CAACJ,CAAc;AAAA,EAAA,GAGXO,IAAeJ;AAAA,IACnB,CACEK,GACAC,GACAC,GACAC,GACAC,IAAwB,OACrB;;AACH,MAAKA,MACalB,MAChBmB,IAAA3B,EAAa,YAAb,QAAA2B,EAAsB,YAAUC,IAA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9D,EAAce,CAAS;AAAA,SACtBgD,EAAkB;AAEX,MAAAnE,EAAA,QAAQ,KAAKkE,CAAgB,GAEnClC,KAAqBjC,EAAW,UAClCgB,EAAae,EAAY,gBAAgB/B,EAAW,SAAS,UAAUoB,GAAW,EAAI,IAEtFJ,EAAae,EAAY,gBAAgBlC,EAAS,SAAS,YAAYuB,GAAW,EAAI;AAAA,IAE1F;AAAA,IACA,CAACzB,GAAciC,GAAkBZ,GAAcX,GAAeC,CAAU;AAAA,EAAA,GAGpE+D,KAAOC;AAAA,IACX,OAAO;AAAA,MACL,UAAAzE;AAAA,MACA,YAAAE;AAAA,MACA,YAAAC;AAAA,MACA,cAAAgC;AAAA,IAAA;AAAA,IAEF,CAACA,CAAY;AAAA,EAAA;AAIf,SAAAuC,GAAU,MACD,MAAM;AACX,IAAAtE,EAAU,QAAQ,QAAQ,CAASuE,MAAA,aAAaA,CAAK,CAAC,GACtDvE,EAAU,UAAU,IACpBC,EAAoB,UAAU;AAAA,EAAA,GAE/B,CAACP,CAAY,CAAC,GAEV0E;AACT;"}
|
1
|
+
{"version":3,"file":"use-game-launcher-journey.js","sources":["../../../../../../src/features/circle-games/game-launcher/hooks/use-game-launcher-journey/use-game-launcher-journey.tsx"],"sourcesContent":["import type { TJourneyId } from '../../../../journey/journey-id/journey-id-types';\nimport type { ICoachmarkProps } from '../../../../journey/use-journey/journey-context-types';\nimport type { IArrowTooltipProps } from '../../../../ui/arrow-tooltip/arrow-tooltip-types';\nimport type { INudgeProps } from '../../../../ui/nudge/nudge-types';\nimport type { TColorNames } from '../../../../ui/types';\nimport type { ISegmentedGameCardRefs } from '../../comps/segmented-game-card/segmented-game-card-types';\nimport type {\n IProject,\n Puzzle,\n} from '../../dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport type { IUseGameLauncherJourneyProps } from './use-game-launcher-journey-types';\n\nimport { useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport CaratRightIcon from '../../../../../assets/line-icons/icons/carat-right';\nimport { PLATFORM_EVENTS_STUDENT as AnalyticsLabel } from '../../../../analytics-events/platform-events-student';\nimport { IndicatorType } from '../../../../journey/use-journey/constants';\nimport { useJourney } from '../../../../journey/use-journey/use-journey';\nimport IconButton from '../../../../ui/buttons/icon-button/icon-button';\nimport { useUIContext } from '../../../../ui/context/context';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport { CIRCLE_ONBOARDING_ANALYTICS_STEPS as ActionEvent } from '../../../enum/circle-onboarding-steps';\nimport { ProjectType } from '../../../games/web-view/enums';\nimport { useCircleSounds } from '../../../hooks/use-circle-sounds/use-circle-sounds';\nimport { SegmentedGameCard } from '../../comps/segmented-game-card/segmented-game-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from '../../game-launcher-analytics-events';\nimport {\n GO_TO_NEXT_SLIDE_AFTER_MS,\n SHOW_LABEL_HIGHLIGHT_AFTER_MS,\n SHOW_NUDGE_AFTER_MS,\n SLIDE_TO_LESSON_MS,\n} from './constants';\n\nexport const useGameLauncherJourney = ({\n carouselRefs,\n onSegmentClick,\n}: IUseGameLauncherJourneyProps) => {\n const gameRefs = useRef<ISegmentedGameCardRefs>(null);\n const puzzleRefs = useRef<ISegmentedGameCardRefs>(null);\n const lessonRefs = useRef<ISegmentedGameCardRefs>(null);\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const { playButtonSound } = useCircleSounds();\n const { nextCoachmark, setJourney, endJourney } = useJourney();\n const { onEvent: trackAnalytics } = useUIContext();\n\n const trackEventViewed = useCallback(\n (step: ActionEvent) => {\n trackAnalytics(AnalyticsLabel.ONBOARDING_STEP_VIEWED, {\n step,\n });\n },\n [trackAnalytics],\n );\n const trackEventCompleted = useCallback(\n (step: ActionEvent) => {\n trackAnalytics(AnalyticsLabel.ONBOARDING_STEP_COMPLETED, {\n step,\n });\n },\n [trackAnalytics],\n );\n\n const goToNextCard = useCallback(\n (\n analyticsLabelViewed: ActionEvent,\n refOfNextSlide: ISegmentedGameCardRefs,\n color: TColorNames,\n journeyId: TJourneyId,\n isFirstSlide: boolean = false,\n ) => {\n if (!isFirstSlide) {\n playButtonSound();\n carouselRefs.current?.goToIndex(carouselRefs.current?.currentIndex + 1);\n nextCoachmark(journeyId, false, GO_TO_NEXT_SLIDE_AFTER_MS);\n }\n\n trackEventViewed(analyticsLabelViewed);\n\n const animateLabelTimer = setTimeout(() => {\n clearTimeout(animateLabelTimer);\n refOfNextSlide.startLabelAnimation(color);\n }, SHOW_LABEL_HIGHLIGHT_AFTER_MS);\n\n timerRefs.current.push(animateLabelTimer); // Store to cleanup later\n\n nextCoachmark(journeyId, true, SHOW_NUDGE_AFTER_MS);\n },\n [carouselRefs, nextCoachmark, playButtonSound, trackEventViewed],\n );\n\n const handleEndJourney = useCallback(\n (puzzlesData: Puzzle, journeyId: TJourneyId) => {\n onSegmentClick(puzzlesData, ProjectType.PUZZLE);\n trackEventCompleted(ActionEvent.PUZZLE_ACTIVITY);\n endJourney(journeyId);\n },\n [endJourney, onSegmentClick, trackEventCompleted],\n );\n\n const startJourney = useCallback(\n (puzzlesData: IProject<Puzzle>, isLessonAvailable: boolean, journeyId: TJourneyId) => {\n // If 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: 'right',\n backgroundColor: 'BLUE_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Get faster & stay ahead in school. Practice 3 new skills everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: lessonLabelDims.width + 50,\n tooltipYCoOrdinates: lessonLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: carouselRefs.current?.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={() =>\n goToNextCard(\n ActionEvent.GAMES_ACTIVITY,\n gameRefs.current as ISegmentedGameCardRefs,\n 'ORANGE_4',\n journeyId,\n )\n }\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to proceed\n </Text>\n ),\n nudgePointerX: 0,\n nudgePointerY: 0,\n } as INudgeProps,\n },\n ];\n }\n\n const gameSteps: ICoachmarkProps[] = [\n {\n originalElementToHighlightRef: gameRefs.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'ORANGE_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Train to think deeper & plan ahead. Play 3 new games everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: gameLabelDims.width + 50,\n tooltipYCoOrdinates: gameLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: carouselRefs.current.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={() =>\n goToNextCard(\n ActionEvent.PUZZLE_ACTIVITY,\n puzzleRefs.current as ISegmentedGameCardRefs,\n 'PURPLE_4',\n journeyId,\n )\n }\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to proceed\n </Text>\n ),\n nudgePointerX: 0,\n nudgePointerY: 0,\n } as INudgeProps,\n },\n ];\n\n const puzzleSteps: ICoachmarkProps[] = [\n {\n originalElementToHighlightRef: puzzleRefs.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'PURPLE_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Think in new ways & stay sharp. Solve 3 new puzzles everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: puzzleLabelDims.width + 50,\n tooltipYCoOrdinates: puzzleLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: puzzleRefs.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <SegmentedGameCard\n label={''} // This is intentionally left blank to avoid showing the label\n value={puzzlesData.data.filter(puzzle => puzzle.solved).length}\n maxValue={puzzlesData.data.length}\n initialValue={puzzlesData.initialProgressValue}\n data={puzzlesData.data.map(puzzle => ({\n card: puzzle.cardLottie,\n name: '', // We dont want to show the name of the puzzle in onboarding\n isCompleted: puzzle.solved,\n onPress: () => handleEndJourney(puzzle, journeyId),\n }))}\n />\n ),\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to solve a puzzle\n </Text>\n ),\n nudgePointerX: launcherDims.width * 0.6,\n nudgePointerY: launcherDims.height * 0.4,\n } as INudgeProps,\n },\n ];\n\n setJourney(journeyId, [...lessonSteps, ...gameSteps, ...puzzleSteps]);\n\n carouselRefs.current?.goToIndex(0); // Always start from 0th Index no matter what the current index is\n\n const delayBeforeStart = setTimeout(() => {\n clearTimeout(delayBeforeStart);\n nextCoachmark(journeyId);\n }, SLIDE_TO_LESSON_MS);\n\n timerRefs.current.push(delayBeforeStart); // Store to cleanup later\n\n if (isLessonAvailable && lessonRefs.current) {\n goToNextCard(ActionEvent.SKILL_ACTIVITY, lessonRefs.current, 'BLUE_4', journeyId, true);\n } else {\n goToNextCard(ActionEvent.GAMES_ACTIVITY, gameRefs.current, 'ORANGE_4', journeyId, true);\n }\n },\n [carouselRefs, handleEndJourney, goToNextCard, nextCoachmark, setJourney],\n );\n\n const data = useMemo(\n () => ({\n gameRefs,\n puzzleRefs,\n lessonRefs,\n startJourney,\n }),\n [startJourney],\n );\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n timerRefs.current.forEach(timer => clearTimeout(timer));\n timerRefs.current = [];\n };\n }, [carouselRefs]);\n\n return data;\n};\n"],"names":["useGameLauncherJourney","carouselRefs","onSegmentClick","gameRefs","useRef","puzzleRefs","lessonRefs","timerRefs","playButtonSound","useCircleSounds","nextCoachmark","setJourney","endJourney","useJourney","trackAnalytics","useUIContext","trackEventViewed","useCallback","step","AnalyticsLabel","trackEventCompleted","goToNextCard","analyticsLabelViewed","refOfNextSlide","color","journeyId","isFirstSlide","_b","_a","GO_TO_NEXT_SLIDE_AFTER_MS","animateLabelTimer","SHOW_LABEL_HIGHLIGHT_AFTER_MS","SHOW_NUDGE_AFTER_MS","handleEndJourney","puzzlesData","ProjectType","ActionEvent","startJourney","isLessonAvailable","_c","_d","lessonLabelDims","_g","_f","_e","gameLabelDims","_j","_i","_h","puzzleLabelDims","_m","_l","_k","launcherDims","_p","_o","_n","lessonSteps","IndicatorType","jsx","Fragment","FlexView","Text","_q","IconButton","CaratRightIcon","GAME_LAUNCHER_ANALYTICS_EVENTS","gameSteps","puzzleSteps","SegmentedGameCard","puzzle","_r","delayBeforeStart","SLIDE_TO_LESSON_MS","data","useMemo","useEffect","timer"],"mappings":";;;;;;;;;;;;;;;;AAkCO,MAAMA,KAAyB,CAAC;AAAA,EACrC,cAAAC;AAAA,EACA,gBAAAC;AACF,MAAoC;AAC5B,QAAAC,IAAWC,EAA+B,IAAI,GAC9CC,IAAaD,EAA+B,IAAI,GAChDE,IAAaF,EAA+B,IAAI,GAChDG,IAAYH,EAAwC,CAAA,CAAE,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,EAAe,wBAAwB;AAAA,QACpD,MAAAD;AAAA,MAAA,CACD;AAAA,IACH;AAAA,IACA,CAACJ,CAAc;AAAA,EAAA,GAEXM,IAAsBH;AAAA,IAC1B,CAACC,MAAsB;AACrB,MAAAJ,EAAeK,EAAe,2BAA2B;AAAA,QACvD,MAAAD;AAAA,MAAA,CACD;AAAA,IACH;AAAA,IACA,CAACJ,CAAc;AAAA,EAAA,GAGXO,IAAeJ;AAAA,IACnB,CACEK,GACAC,GACAC,GACAC,GACAC,IAAwB,OACrB;;AACH,MAAKA,MACalB,MAChBmB,IAAA1B,EAAa,YAAb,QAAA0B,EAAsB,YAAUC,IAAA3B,EAAa,YAAb,gBAAA2B,EAAsB,gBAAe,IACvDlB,EAAAe,GAAW,IAAOI,EAAyB,IAG3Db,EAAiBM,CAAoB;AAE/B,YAAAQ,IAAoB,WAAW,MAAM;AACzC,qBAAaA,CAAiB,GAC9BP,EAAe,oBAAoBC,CAAK;AAAA,SACvCO,EAA6B;AAEtB,MAAAxB,EAAA,QAAQ,KAAKuB,CAAiB,GAE1BpB,EA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