@cuemath/leap 3.5.29-as6 → 3.5.29-mb
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/assets/illustrations/illustrations.js +0 -10
- package/dist/assets/illustrations/illustrations.js.map +1 -1
- package/dist/assets/images/images.js +0 -8
- package/dist/assets/images/images.js.map +1 -1
- package/dist/features/circle-games/game-launcher/comps/carousel/carousel-styled.js +32 -16
- package/dist/features/circle-games/game-launcher/comps/carousel/carousel-styled.js.map +1 -1
- package/dist/features/circle-games/game-launcher/comps/carousel/carousel.js +87 -88
- package/dist/features/circle-games/game-launcher/comps/carousel/carousel.js.map +1 -1
- package/dist/features/circle-games/game-launcher/comps/swipable-component/swipeable-component-styled.js.map +1 -0
- package/dist/features/circle-games/game-launcher/comps/swipable-component/swipeable-component.js +26 -0
- package/dist/features/circle-games/game-launcher/comps/swipable-component/swipeable-component.js.map +1 -0
- package/dist/features/circle-games/game-launcher/hooks/use-game-launcher-journey/use-game-launcher-journey.js +35 -35
- 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/hooks/use-circle-sounds/constants.js +5 -7
- package/dist/features/circle-games/hooks/use-circle-sounds/constants.js.map +1 -1
- package/dist/features/circle-games/hooks/use-circle-sounds/use-circle-sounds.js +124 -104
- package/dist/features/circle-games/hooks/use-circle-sounds/use-circle-sounds.js.map +1 -1
- package/dist/index.d.ts +3 -184
- package/dist/index.js +451 -465
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/assets/line-icons/icons/carat-right.js +0 -26
- package/dist/assets/line-icons/icons/carat-right.js.map +0 -1
- package/dist/features/circle-games/hooks/use-circle-sounds/helper.js +0 -19
- package/dist/features/circle-games/hooks/use-circle-sounds/helper.js.map +0 -1
- package/dist/features/timeline/monthly-report/api/use-monthly-report-get.js +0 -13
- package/dist/features/timeline/monthly-report/api/use-monthly-report-get.js.map +0 -1
- package/dist/features/timeline/monthly-report/comps/achievements/achievements.js +0 -60
- package/dist/features/timeline/monthly-report/comps/achievements/achievements.js.map +0 -1
- package/dist/features/timeline/monthly-report/comps/achievements/achievements.styled.js +0 -15
- package/dist/features/timeline/monthly-report/comps/achievements/achievements.styled.js.map +0 -1
- package/dist/features/timeline/monthly-report/comps/activities/activities-card/activities-card.js +0 -128
- package/dist/features/timeline/monthly-report/comps/activities/activities-card/activities-card.js.map +0 -1
- package/dist/features/timeline/monthly-report/comps/activities/activities-card/activities-card.styled.js +0 -53
- package/dist/features/timeline/monthly-report/comps/activities/activities-card/activities-card.styled.js.map +0 -1
- package/dist/features/timeline/monthly-report/comps/activities/activities-card-puzzles/activities-card-puzzles.js +0 -105
- package/dist/features/timeline/monthly-report/comps/activities/activities-card-puzzles/activities-card-puzzles.js.map +0 -1
- package/dist/features/timeline/monthly-report/comps/activities/activities-card-puzzles/activities-card-puzzles.styled.js +0 -40
- package/dist/features/timeline/monthly-report/comps/activities/activities-card-puzzles/activities-card-puzzles.styled.js.map +0 -1
- package/dist/features/timeline/monthly-report/comps/activities/activities.js +0 -27
- package/dist/features/timeline/monthly-report/comps/activities/activities.js.map +0 -1
- package/dist/features/timeline/monthly-report/comps/activities/constants.js +0 -94
- package/dist/features/timeline/monthly-report/comps/activities/constants.js.map +0 -1
- package/dist/features/timeline/monthly-report/comps/activities/utils.js +0 -15
- package/dist/features/timeline/monthly-report/comps/activities/utils.js.map +0 -1
- package/dist/features/timeline/monthly-report/comps/attendance/attendance-constants.js +0 -29
- package/dist/features/timeline/monthly-report/comps/attendance/attendance-constants.js.map +0 -1
- package/dist/features/timeline/monthly-report/comps/attendance/attendance-utils.js +0 -95
- package/dist/features/timeline/monthly-report/comps/attendance/attendance-utils.js.map +0 -1
- package/dist/features/timeline/monthly-report/comps/attendance/attendance.js +0 -77
- package/dist/features/timeline/monthly-report/comps/attendance/attendance.js.map +0 -1
- package/dist/features/timeline/monthly-report/comps/attendance/attendance.styled.js +0 -39
- package/dist/features/timeline/monthly-report/comps/attendance/attendance.styled.js.map +0 -1
- package/dist/features/timeline/monthly-report/comps/feedback/feedback-styled.js +0 -9
- package/dist/features/timeline/monthly-report/comps/feedback/feedback-styled.js.map +0 -1
- package/dist/features/timeline/monthly-report/comps/feedback/feedback.js +0 -94
- package/dist/features/timeline/monthly-report/comps/feedback/feedback.js.map +0 -1
- package/dist/features/timeline/monthly-report/comps/goals/goals-card/goal-chapter-card.js +0 -48
- package/dist/features/timeline/monthly-report/comps/goals/goals-card/goal-chapter-card.js.map +0 -1
- package/dist/features/timeline/monthly-report/comps/goals/goals-card/goals-card-styled.js +0 -28
- package/dist/features/timeline/monthly-report/comps/goals/goals-card/goals-card-styled.js.map +0 -1
- package/dist/features/timeline/monthly-report/comps/goals/goals-card/goals-card.js +0 -103
- package/dist/features/timeline/monthly-report/comps/goals/goals-card/goals-card.js.map +0 -1
- package/dist/features/timeline/monthly-report/comps/goals/goals-constants.js +0 -30
- package/dist/features/timeline/monthly-report/comps/goals/goals-constants.js.map +0 -1
- package/dist/features/timeline/monthly-report/comps/goals/goals.js +0 -22
- package/dist/features/timeline/monthly-report/comps/goals/goals.js.map +0 -1
- package/dist/features/timeline/monthly-report/monthly-report-styled.js +0 -14
- package/dist/features/timeline/monthly-report/monthly-report-styled.js.map +0 -1
- package/dist/features/timeline/monthly-report/monthly-report-types.js +0 -5
- package/dist/features/timeline/monthly-report/monthly-report-types.js.map +0 -1
- package/dist/features/timeline/monthly-report/monthly-report.js +0 -70
- package/dist/features/timeline/monthly-report/monthly-report.js.map +0 -1
- package/dist/features/timeline/monthly-timeline/api/use-monthly-timeline-get.js +0 -10
- package/dist/features/timeline/monthly-timeline/api/use-monthly-timeline-get.js.map +0 -1
- package/dist/features/timeline/monthly-timeline/comps/monthly-card/monthly-card.js +0 -74
- package/dist/features/timeline/monthly-timeline/comps/monthly-card/monthly-card.js.map +0 -1
- package/dist/features/timeline/monthly-timeline/comps/monthly-card/monthly-card.styled.js +0 -9
- package/dist/features/timeline/monthly-timeline/comps/monthly-card/monthly-card.styled.js.map +0 -1
- package/dist/features/timeline/monthly-timeline/constants.js +0 -41
- package/dist/features/timeline/monthly-timeline/constants.js.map +0 -1
- package/dist/features/timeline/monthly-timeline/monthly-timeline-styled.js +0 -9
- package/dist/features/timeline/monthly-timeline/monthly-timeline-styled.js.map +0 -1
- package/dist/features/timeline/monthly-timeline/monthly-timeline-types.js +0 -6
- package/dist/features/timeline/monthly-timeline/monthly-timeline-types.js.map +0 -1
- package/dist/features/timeline/monthly-timeline/monthly-timeline-view.js +0 -28
- package/dist/features/timeline/monthly-timeline/monthly-timeline-view.js.map +0 -1
- package/dist/features/timeline/monthly-timeline/monthly-timeline.js +0 -54
- package/dist/features/timeline/monthly-timeline/monthly-timeline.js.map +0 -1
- package/dist/features/timeline/ptm-report/api/use-ptm-report-get.js +0 -9
- package/dist/features/timeline/ptm-report/api/use-ptm-report-get.js.map +0 -1
- package/dist/features/timeline/ptm-report/comps/key-need/key-need-styled.js +0 -9
- package/dist/features/timeline/ptm-report/comps/key-need/key-need-styled.js.map +0 -1
- package/dist/features/timeline/ptm-report/comps/key-need/key-need.js +0 -35
- package/dist/features/timeline/ptm-report/comps/key-need/key-need.js.map +0 -1
- package/dist/features/timeline/ptm-report/comps/parent-support/parent-support.js +0 -53
- package/dist/features/timeline/ptm-report/comps/parent-support/parent-support.js.map +0 -1
- package/dist/features/timeline/ptm-report/comps/real-world-projects/real-world-projects-styled.js +0 -19
- package/dist/features/timeline/ptm-report/comps/real-world-projects/real-world-projects-styled.js.map +0 -1
- package/dist/features/timeline/ptm-report/comps/real-world-projects/real-world-projects.js +0 -50
- package/dist/features/timeline/ptm-report/comps/real-world-projects/real-world-projects.js.map +0 -1
- package/dist/features/timeline/ptm-report/comps/report-card/report-card-styled.js +0 -9
- package/dist/features/timeline/ptm-report/comps/report-card/report-card-styled.js.map +0 -1
- package/dist/features/timeline/ptm-report/comps/report-card/report-card.js +0 -22
- package/dist/features/timeline/ptm-report/comps/report-card/report-card.js.map +0 -1
- package/dist/features/timeline/ptm-report/comps/school-support/school-support-styled.js +0 -9
- package/dist/features/timeline/ptm-report/comps/school-support/school-support-styled.js.map +0 -1
- package/dist/features/timeline/ptm-report/comps/school-support/school-support.js +0 -84
- package/dist/features/timeline/ptm-report/comps/school-support/school-support.js.map +0 -1
- package/dist/features/timeline/ptm-report/comps/strategies/strategies-constant.js +0 -11
- package/dist/features/timeline/ptm-report/comps/strategies/strategies-constant.js.map +0 -1
- package/dist/features/timeline/ptm-report/comps/strategies/strategies.js +0 -36
- package/dist/features/timeline/ptm-report/comps/strategies/strategies.js.map +0 -1
- package/dist/features/timeline/ptm-report/comps/strategy-card/strategy-card-styled.js +0 -55
- package/dist/features/timeline/ptm-report/comps/strategy-card/strategy-card-styled.js.map +0 -1
- package/dist/features/timeline/ptm-report/comps/strategy-card/strategy-card.js +0 -35
- package/dist/features/timeline/ptm-report/comps/strategy-card/strategy-card.js.map +0 -1
- package/dist/features/timeline/ptm-report/comps/student-info/student-info-styled.js +0 -21
- package/dist/features/timeline/ptm-report/comps/student-info/student-info-styled.js.map +0 -1
- package/dist/features/timeline/ptm-report/comps/student-info/student-info.js +0 -21
- package/dist/features/timeline/ptm-report/comps/student-info/student-info.js.map +0 -1
- package/dist/features/timeline/ptm-report/comps/support-card/support-card-styled.js +0 -9
- package/dist/features/timeline/ptm-report/comps/support-card/support-card-styled.js.map +0 -1
- package/dist/features/timeline/ptm-report/comps/support-card/support-card.js +0 -30
- package/dist/features/timeline/ptm-report/comps/support-card/support-card.js.map +0 -1
- package/dist/features/timeline/ptm-report/comps/teacher-observations/teacher-observations-constant.js +0 -9
- package/dist/features/timeline/ptm-report/comps/teacher-observations/teacher-observations-constant.js.map +0 -1
- package/dist/features/timeline/ptm-report/comps/teacher-observations/teacher-observations.js +0 -56
- package/dist/features/timeline/ptm-report/comps/teacher-observations/teacher-observations.js.map +0 -1
- package/dist/features/timeline/ptm-report/comps/upcoming-chapters/upcoming-chapters.js +0 -15
- package/dist/features/timeline/ptm-report/comps/upcoming-chapters/upcoming-chapters.js.map +0 -1
- package/dist/features/timeline/ptm-report/ptm-report-constants.js +0 -16
- package/dist/features/timeline/ptm-report/ptm-report-constants.js.map +0 -1
- package/dist/features/timeline/ptm-report/ptm-report-helpers.js +0 -8
- package/dist/features/timeline/ptm-report/ptm-report-helpers.js.map +0 -1
- package/dist/features/timeline/ptm-report/ptm-report-styled.js +0 -11
- package/dist/features/timeline/ptm-report/ptm-report-styled.js.map +0 -1
- package/dist/features/timeline/ptm-report/ptm-report-types.js +0 -5
- package/dist/features/timeline/ptm-report/ptm-report-types.js.map +0 -1
- package/dist/features/timeline/ptm-report/ptm-report.js +0 -113
- package/dist/features/timeline/ptm-report/ptm-report.js.map +0 -1
- package/dist/features/timeline/timeline-tabs/timeline-tabs-types.js +0 -5
- package/dist/features/timeline/timeline-tabs/timeline-tabs-types.js.map +0 -1
- package/dist/features/timeline/timeline-tabs/timeline-tabs.js +0 -41
- package/dist/features/timeline/timeline-tabs/timeline-tabs.js.map +0 -1
- package/dist/features/timeline/timeline-tabs/timeline-tabs.styled.js +0 -37
- package/dist/features/timeline/timeline-tabs/timeline-tabs.styled.js.map +0 -1
- package/dist/features/ui/swipable-carousel/swipable-carousel-styled.js +0 -57
- package/dist/features/ui/swipable-carousel/swipable-carousel-styled.js.map +0 -1
- package/dist/features/ui/swipable-carousel/swipable-carousel.js +0 -132
- package/dist/features/ui/swipable-carousel/swipable-carousel.js.map +0 -1
- package/dist/features/ui/swipeable-component/swipeable-component-styled.js.map +0 -1
- package/dist/features/ui/swipeable-component/swipeable-component.js +0 -27
- package/dist/features/ui/swipeable-component/swipeable-component.js.map +0 -1
- package/dist/static/2021.0683b580.png +0 -0
- package/dist/static/2022.d34ad7a5.png +0 -0
- package/dist/static/2023.fce87149.png +0 -0
- package/dist/static/2024.a275ee85.png +0 -0
- package/dist/static/2025.677cc187.png +0 -0
- package/dist/static/2026.63763214.png +0 -0
- package/dist/static/2027.b82dc039.png +0 -0
- package/dist/static/2028.580b8cc0.png +0 -0
- package/dist/static/coding-report-icon.91a1e900.svg +0 -1
- package/dist/static/elp-icon.d45b457d.svg +0 -1
- package/dist/static/english-icon.50c2e005.svg +0 -1
- package/dist/static/full-report.00112c74.svg +0 -1
- package/dist/static/math-fit-grey.c32f37b3.svg +0 -1
- package/dist/static/ptm-report-icon.5089218f.svg +0 -1
- package/dist/static/sat-report-icon.4331be86.svg +0 -1
- package/dist/static/science-report-icon.a0014c40.svg +0 -1
- package/dist/static/thumps-down.a1192a62.svg +0 -1
- package/dist/static/thumps-up.caa35a98.svg +0 -1
- /package/dist/features/{ui/swipeable-component → circle-games/game-launcher/comps/swipable-component}/swipeable-component-styled.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as N, useCallback as f, useMemo as J, useEffect as X } from "react";
|
|
3
3
|
import { useTheme as $ } from "styled-components";
|
|
4
4
|
import { PLATFORM_EVENTS_STUDENT as B } from "../../../../analytics-events/platform-events-student.js";
|
|
@@ -9,35 +9,35 @@ import A from "../../../../ui/text/text.js";
|
|
|
9
9
|
import { EDeviceType as Q } from "../../../../ui/theme/constants.js";
|
|
10
10
|
import { CIRCLE_ONBOARDING_ANALYTICS_STEPS as S } from "../../../enum/circle-onboarding-steps.js";
|
|
11
11
|
import { CircularGameCard as D } from "../../comps/circular-game-card/circular-game-card.js";
|
|
12
|
-
import j from "
|
|
12
|
+
import j from "../../comps/swipable-component/swipeable-component.js";
|
|
13
13
|
import { SHOW_NUDGE_AFTER_MS as V, SLIDE_TO_LESSON_MS as ee } from "./constants.js";
|
|
14
|
-
import { SwipableArea as
|
|
15
|
-
import { CarouselIndicator as
|
|
16
|
-
import { ProjectType as
|
|
14
|
+
import { SwipableArea as te } from "./use-game-launcher-journey-style.js";
|
|
15
|
+
import { CarouselIndicator as re } from "../../comps/carousel/carousel-indicator/carousel-indicator.js";
|
|
16
|
+
import { ProjectType as n } from "../../../games/web-view/enums/project-type-enum.js";
|
|
17
17
|
const Se = ({
|
|
18
18
|
carouselRefs: o,
|
|
19
19
|
onSegmentClick: d,
|
|
20
20
|
onJourneyComplete: a
|
|
21
21
|
}) => {
|
|
22
22
|
const { device: W } = $(), l = W <= Q.TABLET, L = N([]), c = N(null), C = N(null), { nextCoachmark: u, setJourney: _, endJourney: h } = K(), { onEvent: p } = q(), E = f(
|
|
23
|
-
(
|
|
23
|
+
(r) => {
|
|
24
24
|
p(B.ONBOARDING_STEP_COMPLETED, {
|
|
25
|
-
step:
|
|
25
|
+
step: r
|
|
26
26
|
});
|
|
27
27
|
},
|
|
28
28
|
[p]
|
|
29
29
|
), O = f(
|
|
30
|
-
(
|
|
31
|
-
d(
|
|
30
|
+
(r, e) => {
|
|
31
|
+
d(r, n.PUZZLE), E(S.PUZZLE_ACTIVITY), h(e), a(e);
|
|
32
32
|
},
|
|
33
33
|
[h, a, d, E]
|
|
34
34
|
), y = f(
|
|
35
|
-
(
|
|
36
|
-
d(
|
|
35
|
+
(r, e) => {
|
|
36
|
+
d(r, n.LESSON), E(S.SKILL_ACTIVITY), h(e), a(e);
|
|
37
37
|
},
|
|
38
38
|
[h, a, d, E]
|
|
39
39
|
), R = f(
|
|
40
|
-
(
|
|
40
|
+
(r, e) => {
|
|
41
41
|
var G, w, x, P, U, Y, Z, k, H, M, z;
|
|
42
42
|
const T = (G = o.current) == null ? void 0 : G.indicatorRefs, s = ((x = (w = c.current) == null ? void 0 : w.circularCardWrapperRef.current) == null ? void 0 : x.getBoundingClientRect()) || {
|
|
43
43
|
height: 0,
|
|
@@ -49,56 +49,56 @@ const Se = ({
|
|
|
49
49
|
(P = e == null ? void 0 : e.games) != null && P.data.length && ((U = e == null ? void 0 : e.puzzles) != null && U.data.length) && g.push(
|
|
50
50
|
{
|
|
51
51
|
projectData: e.games.data[0],
|
|
52
|
-
type:
|
|
52
|
+
type: n.GAME
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
projectData: e.puzzles.data[0],
|
|
56
|
-
type:
|
|
56
|
+
type: n.PUZZLE
|
|
57
57
|
}
|
|
58
58
|
), (Y = e == null ? void 0 : e.lessons) != null && Y.data.length && g.push(
|
|
59
|
-
{ projectData: e.lessons.data[0], type:
|
|
60
|
-
{ projectData: e.lessons.data[1], type:
|
|
59
|
+
{ projectData: e.lessons.data[0], type: n.LESSON },
|
|
60
|
+
{ projectData: e.lessons.data[1], type: n.LESSON }
|
|
61
61
|
);
|
|
62
|
-
const
|
|
62
|
+
const t = g[1];
|
|
63
63
|
p(B.ONBOARDING_STEP_VIEWED, {
|
|
64
|
-
step: ((Z = g[0]) == null ? void 0 : Z.type) ===
|
|
64
|
+
step: ((Z = g[0]) == null ? void 0 : Z.type) === n.LESSON ? S.SKILL_ACTIVITY : S.GAMES_ACTIVITY
|
|
65
65
|
});
|
|
66
66
|
const F = [
|
|
67
67
|
l ? {
|
|
68
68
|
originalElementToHighlightRef: c.current.circularCardWrapperRef,
|
|
69
69
|
type: I.NUDGE,
|
|
70
|
-
elementToHighlight: /* @__PURE__ */
|
|
70
|
+
elementToHighlight: /* @__PURE__ */ i(
|
|
71
71
|
j,
|
|
72
72
|
{
|
|
73
73
|
onSwipeLeft: () => {
|
|
74
74
|
var m;
|
|
75
|
-
(m = o.current) == null || m.goToIndex(1), u(
|
|
75
|
+
(m = o.current) == null || m.goToIndex(1), u(r, !1, V);
|
|
76
76
|
},
|
|
77
|
-
children: /* @__PURE__ */
|
|
77
|
+
children: /* @__PURE__ */ i(te, {})
|
|
78
78
|
}
|
|
79
79
|
),
|
|
80
80
|
indicator: {
|
|
81
81
|
nudge: "swipe",
|
|
82
|
-
content: /* @__PURE__ */
|
|
82
|
+
content: /* @__PURE__ */ i(A, { $renderAs: "ab2-bold", children: "Swipe to explore" }),
|
|
83
83
|
nudgePointerX: s.width / 2 - 30,
|
|
84
84
|
nudgePointerY: s.height / 2
|
|
85
85
|
}
|
|
86
86
|
} : {
|
|
87
87
|
originalElementToHighlightRef: T[1],
|
|
88
88
|
type: I.NUDGE,
|
|
89
|
-
elementToHighlight: /* @__PURE__ */
|
|
90
|
-
|
|
89
|
+
elementToHighlight: /* @__PURE__ */ i(
|
|
90
|
+
re,
|
|
91
91
|
{
|
|
92
92
|
textToShowInsideIndicator: "2",
|
|
93
93
|
onClick: () => {
|
|
94
94
|
var m;
|
|
95
|
-
(m = o.current) == null || m.goToIndex(1), u(
|
|
95
|
+
(m = o.current) == null || m.goToIndex(1), u(r, !1, V);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
),
|
|
99
99
|
indicator: {
|
|
100
100
|
nudge: "click",
|
|
101
|
-
content: /* @__PURE__ */
|
|
101
|
+
content: /* @__PURE__ */ i(A, { $renderAs: "ab1-bold", children: "Click to proceed" }),
|
|
102
102
|
nudgePointerX: 0,
|
|
103
103
|
nudgePointerY: 0
|
|
104
104
|
}
|
|
@@ -106,32 +106,32 @@ const Se = ({
|
|
|
106
106
|
{
|
|
107
107
|
originalElementToHighlightRef: C.current.circularCardWrapperRef,
|
|
108
108
|
type: I.NUDGE,
|
|
109
|
-
elementToHighlight: /* @__PURE__ */
|
|
109
|
+
elementToHighlight: /* @__PURE__ */ i(
|
|
110
110
|
D,
|
|
111
111
|
{
|
|
112
112
|
label: "",
|
|
113
113
|
data: {
|
|
114
|
-
card: ((k =
|
|
115
|
-
name: ((H =
|
|
114
|
+
card: ((k = t == null ? void 0 : t.projectData) == null ? void 0 : k.cardLottie) ?? "",
|
|
115
|
+
name: ((H = t == null ? void 0 : t.projectData) == null ? void 0 : H.name) ?? "",
|
|
116
116
|
isCompleted: !1,
|
|
117
|
-
displayNameImage: (M =
|
|
117
|
+
displayNameImage: (M = t == null ? void 0 : t.projectData) == null ? void 0 : M.displayNameImage,
|
|
118
118
|
onPress: () => {
|
|
119
|
-
(
|
|
119
|
+
(t == null ? void 0 : t.type) === n.LESSON && y(t.projectData, r), (t == null ? void 0 : t.type) === n.PUZZLE && O(t.projectData, r);
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
),
|
|
124
124
|
indicator: {
|
|
125
125
|
nudge: "click",
|
|
126
|
-
content: /* @__PURE__ */
|
|
126
|
+
content: /* @__PURE__ */ i(A, { $renderAs: l ? "ab2-bold" : "ab1-bold", children: l ? "Tap to start" : " Click to start" }),
|
|
127
127
|
nudgePointerX: l ? s.width / 2 : s.width / 1.3,
|
|
128
128
|
nudgePointerY: l ? s.height / 2 : s.height / 1.3
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
];
|
|
132
|
-
_(
|
|
132
|
+
_(r, F), (z = o.current) == null || z.goToIndex(0);
|
|
133
133
|
const b = setTimeout(() => {
|
|
134
|
-
clearTimeout(b), u(
|
|
134
|
+
clearTimeout(b), u(r);
|
|
135
135
|
}, ee);
|
|
136
136
|
L.current.push(b);
|
|
137
137
|
},
|
|
@@ -153,7 +153,7 @@ const Se = ({
|
|
|
153
153
|
[R]
|
|
154
154
|
);
|
|
155
155
|
return X(() => () => {
|
|
156
|
-
L.current.forEach((
|
|
156
|
+
L.current.forEach((r) => clearTimeout(r)), L.current = [];
|
|
157
157
|
}, [o]), v;
|
|
158
158
|
};
|
|
159
159
|
export {
|
|
@@ -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 { useCallback, useEffect, useMemo, useRef } from 'react';\nimport { useTheme } from 'styled-components';\n\nimport {\n PLATFORM_EVENTS_STUDENT as AnalyticsLabel,\n PLATFORM_EVENTS_STUDENT,\n} from '../../../../analytics-events/platform-events-student';\nimport { type JOURNEY_ID_STUDENT } from '../../../../journey/journey-id/journey-id-student';\nimport { IndicatorType } from '../../../../journey/use-journey/constants';\nimport type { TCoachmarkJourneyProps } from '../../../../journey/use-journey/journey-context-types';\nimport { useJourney } from '../../../../journey/use-journey/use-journey';\nimport { useUIContext } from '../../../../ui/context/context';\nimport type { INudgeProps } from '../../../../ui/nudge/nudge-types';\nimport Text from '../../../../ui/text/text';\nimport { EDeviceType } from '../../../../ui/theme/constants';\nimport { CIRCLE_ONBOARDING_ANALYTICS_STEPS as ActionEvent } from '../../../enum/circle-onboarding-steps';\nimport { ProjectType } from '../../../games/web-view/enums';\nimport { CircularGameCard } from '../../comps/circular-game-card/circular-game-card';\nimport { type ICircularGameCardRefs } from '../../comps/circular-game-card/circular-game-card-types';\nimport SwipeableCard from '../../../../ui/swipeable-component/swipeable-component';\nimport type {\n Lesson,\n Puzzle,\n} from '../../dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport { type IProjectData } from '../../game-launcher-types';\nimport { SHOW_NUDGE_AFTER_MS, SLIDE_TO_LESSON_MS } from './constants';\nimport type { IUseGameLauncherJourneyProps } from './use-game-launcher-journey-types';\nimport { SwipableArea } from './use-game-launcher-journey-style';\nimport { CarouselIndicator } from '../../comps/carousel/carousel-indicator/carousel-indicator';\n\nexport const useGameLauncherJourney = ({\n carouselRefs,\n onSegmentClick,\n onJourneyComplete,\n}: IUseGameLauncherJourneyProps) => {\n const { device } = useTheme();\n const isCompact = device <= EDeviceType.TABLET;\n\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const firstCardRefs = useRef<ICircularGameCardRefs>(null);\n const secondCardRefs = useRef<ICircularGameCardRefs>(null);\n const { nextCoachmark, setJourney, endJourney } = useJourney();\n const { onEvent: trackAnalytics } = useUIContext();\n\n const trackEventCompleted = useCallback(\n (step: ActionEvent) => {\n trackAnalytics(AnalyticsLabel.ONBOARDING_STEP_COMPLETED, {\n step,\n });\n },\n [trackAnalytics],\n );\n\n const handleEndJourneyForPuzzle = useCallback(\n (puzzlesData: Puzzle, journeyId: JOURNEY_ID_STUDENT) => {\n onSegmentClick(puzzlesData, ProjectType.PUZZLE);\n trackEventCompleted(ActionEvent.PUZZLE_ACTIVITY);\n endJourney(journeyId);\n onJourneyComplete(journeyId);\n },\n [endJourney, onJourneyComplete, onSegmentClick, trackEventCompleted],\n );\n\n const handleEndJourneyForLesson = useCallback(\n (lessonsData: Lesson, journeyId: JOURNEY_ID_STUDENT) => {\n onSegmentClick(lessonsData, ProjectType.LESSON);\n trackEventCompleted(ActionEvent.SKILL_ACTIVITY);\n endJourney(journeyId);\n onJourneyComplete(journeyId);\n },\n [endJourney, onJourneyComplete, onSegmentClick, trackEventCompleted],\n );\n\n const startJourney = useCallback(\n (journeyId: JOURNEY_ID_STUDENT, projectData?: IProjectData) => {\n const paginationList = carouselRefs.current?.indicatorRefs;\n\n const launcherDims =\n firstCardRefs.current?.circularCardWrapperRef.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n\n // Exit early if required refs or data are missing\n if (paginationList?.length < 2 || !secondCardRefs.current || !firstCardRefs.current) {\n return;\n }\n\n // prepare journey projects based on the data available as\n // games and puzzles are not aviailbale for K-1\n const journeyProjectsData = [];\n\n if (projectData?.games?.data.length && projectData?.puzzles?.data.length) {\n journeyProjectsData.push(\n {\n projectData: projectData.games.data[0],\n type: ProjectType.GAME,\n },\n {\n projectData: projectData.puzzles.data[0],\n type: ProjectType.PUZZLE,\n },\n );\n }\n\n if (projectData?.lessons?.data.length) {\n journeyProjectsData.push(\n { projectData: projectData.lessons.data[0], type: ProjectType.LESSON },\n { projectData: projectData.lessons.data[1], type: ProjectType.LESSON },\n );\n }\n\n const secondProjectData = journeyProjectsData[1];\n\n trackAnalytics(PLATFORM_EVENTS_STUDENT.ONBOARDING_STEP_VIEWED, {\n step:\n journeyProjectsData[0]?.type === ProjectType.LESSON\n ? ActionEvent.SKILL_ACTIVITY\n : ActionEvent.GAMES_ACTIVITY,\n });\n\n const coachmarks: TCoachmarkJourneyProps[] = [\n isCompact\n ? {\n originalElementToHighlightRef: firstCardRefs.current.circularCardWrapperRef,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <SwipeableCard\n onSwipeLeft={() => {\n carouselRefs.current?.goToIndex(1);\n nextCoachmark(journeyId, false, SHOW_NUDGE_AFTER_MS);\n }}\n >\n <SwipableArea />\n </SwipeableCard>\n ),\n indicator: {\n nudge: 'swipe',\n content: <Text $renderAs=\"ab2-bold\">Swipe to explore</Text>,\n nudgePointerX: launcherDims.width / 2 - 30,\n nudgePointerY: launcherDims.height / 2,\n } as INudgeProps,\n }\n : {\n originalElementToHighlightRef: paginationList[1] as React.RefObject<HTMLDivElement>,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <CarouselIndicator\n textToShowInsideIndicator=\"2\"\n onClick={() => {\n carouselRefs.current?.goToIndex(1);\n nextCoachmark(journeyId, false, SHOW_NUDGE_AFTER_MS);\n }}\n />\n ),\n indicator: {\n nudge: 'click',\n content: <Text $renderAs=\"ab1-bold\">Click to proceed</Text>,\n nudgePointerX: 0,\n nudgePointerY: 0,\n } as INudgeProps,\n },\n {\n originalElementToHighlightRef: secondCardRefs.current.circularCardWrapperRef,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <CircularGameCard\n label=\"\"\n data={{\n card: secondProjectData?.projectData?.cardLottie ?? '',\n name: secondProjectData?.projectData?.name ?? '',\n isCompleted: false,\n displayNameImage: secondProjectData?.projectData?.displayNameImage,\n onPress: () => {\n if (secondProjectData?.type === ProjectType.LESSON) {\n handleEndJourneyForLesson(secondProjectData.projectData as Lesson, journeyId);\n }\n\n if (secondProjectData?.type === ProjectType.PUZZLE) {\n handleEndJourneyForPuzzle(secondProjectData.projectData as Puzzle, journeyId);\n }\n },\n }}\n />\n ),\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs={isCompact ? 'ab2-bold' : 'ab1-bold'}>\n {isCompact ? 'Tap to start' : ' Click to start'}\n </Text>\n ),\n nudgePointerX: isCompact ? launcherDims.width / 2 : launcherDims.width / 1.3,\n nudgePointerY: isCompact ? launcherDims.height / 2 : launcherDims.height / 1.3,\n } as INudgeProps,\n },\n ];\n\n setJourney(journeyId, coachmarks);\n carouselRefs.current?.goToIndex(0);\n const delayBeforeStart = setTimeout(() => {\n clearTimeout(delayBeforeStart);\n nextCoachmark(journeyId);\n }, SLIDE_TO_LESSON_MS);\n\n timerRefs.current.push(delayBeforeStart);\n },\n [\n carouselRefs,\n trackAnalytics,\n isCompact,\n setJourney,\n nextCoachmark,\n handleEndJourneyForLesson,\n handleEndJourneyForPuzzle,\n ],\n );\n\n const data = useMemo(\n () => ({\n firstCardRefs,\n secondCardRefs,\n startJourney,\n }),\n [startJourney],\n );\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n timerRefs.current.forEach(timer => clearTimeout(timer));\n timerRefs.current = [];\n };\n }, [carouselRefs]);\n\n return data;\n};\n"],"names":["useGameLauncherJourney","carouselRefs","onSegmentClick","onJourneyComplete","device","useTheme","isCompact","EDeviceType","timerRefs","useRef","firstCardRefs","secondCardRefs","nextCoachmark","setJourney","endJourney","useJourney","trackAnalytics","useUIContext","trackEventCompleted","useCallback","step","AnalyticsLabel","handleEndJourneyForPuzzle","puzzlesData","journeyId","ProjectType","ActionEvent","handleEndJourneyForLesson","lessonsData","startJourney","projectData","paginationList","_a","launcherDims","_c","_b","journeyProjectsData","_d","_e","_f","secondProjectData","PLATFORM_EVENTS_STUDENT","_g","coachmarks","IndicatorType","jsx","SwipeableCard","SHOW_NUDGE_AFTER_MS","SwipableArea","Text","CarouselIndicator","CircularGameCard","_h","_i","_j","_k","delayBeforeStart","SLIDE_TO_LESSON_MS","data","useMemo","useEffect","timer"],"mappings":";;;;;;;;;;;;;;;;AA8BO,MAAMA,KAAyB,CAAC;AAAA,EACrC,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,mBAAAC;AACF,MAAoC;AAC5B,QAAA,EAAE,QAAAC,MAAWC,KACbC,IAAYF,KAAUG,EAAY,QAElCC,IAAYC,EAAwC,CAAA,CAAE,GAEtDC,IAAgBD,EAA8B,IAAI,GAClDE,IAAiBF,EAA8B,IAAI,GACn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Aa,QAAQ;AAAA,YACzE,eAAe3B,IAAY2B,EAAa,SAAS,IAAIA,EAAa,SAAS;AAAA,UAC7E;AAAA,QACF;AAAA,MAAA;AAGF,MAAApB,EAAWW,GAAWmB,CAAU,IACnBY,IAAAtD,EAAA,YAAA,QAAAsD,EAAS,UAAU;AAC1B,YAAAC,IAAmB,WAAW,MAAM;AACxC,qBAAaA,CAAgB,GAC7B5C,EAAcY,CAAS;AAAA,SACtBiC,EAAkB;AAEX,MAAAjD,EAAA,QAAQ,KAAKgD,CAAgB;AAAA,IACzC;AAAA,IACA;AAAA,MACEvD;AAAA,MACAe;AAAA,MACAV;AAAA,MACAO;AAAA,MACAD;AAAA,MACAe;AAAA,MACAL;AAAA,IACF;AAAA,EAAA,GAGIoC,IAAOC;AAAA,IACX,OAAO;AAAA,MACL,eAAAjD;AAAA,MACA,gBAAAC;AAAA,MACA,cAAAkB;AAAA,IAAA;AAAA,IAEF,CAACA,CAAY;AAAA,EAAA;AAIf,SAAA+B,EAAU,MACD,MAAM;AACX,IAAApD,EAAU,QAAQ,QAAQ,CAASqD,MAAA,aAAaA,CAAK,CAAC,GACtDrD,EAAU,UAAU;EAAC,GAEtB,CAACP,CAAY,CAAC,GAEVyD;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 { useCallback, useEffect, useMemo, useRef } from 'react';\nimport { useTheme } from 'styled-components';\n\nimport {\n PLATFORM_EVENTS_STUDENT as AnalyticsLabel,\n PLATFORM_EVENTS_STUDENT,\n} from '../../../../analytics-events/platform-events-student';\nimport { type JOURNEY_ID_STUDENT } from '../../../../journey/journey-id/journey-id-student';\nimport { IndicatorType } from '../../../../journey/use-journey/constants';\nimport type { TCoachmarkJourneyProps } from '../../../../journey/use-journey/journey-context-types';\nimport { useJourney } from '../../../../journey/use-journey/use-journey';\nimport { useUIContext } from '../../../../ui/context/context';\nimport type { INudgeProps } from '../../../../ui/nudge/nudge-types';\nimport Text from '../../../../ui/text/text';\nimport { EDeviceType } from '../../../../ui/theme/constants';\nimport { CIRCLE_ONBOARDING_ANALYTICS_STEPS as ActionEvent } from '../../../enum/circle-onboarding-steps';\nimport { ProjectType } from '../../../games/web-view/enums';\nimport { CircularGameCard } from '../../comps/circular-game-card/circular-game-card';\nimport { type ICircularGameCardRefs } from '../../comps/circular-game-card/circular-game-card-types';\nimport SwipeableCard from '../../comps/swipable-component/swipeable-component';\nimport type {\n Lesson,\n Puzzle,\n} from '../../dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport { type IProjectData } from '../../game-launcher-types';\nimport { SHOW_NUDGE_AFTER_MS, SLIDE_TO_LESSON_MS } from './constants';\nimport type { IUseGameLauncherJourneyProps } from './use-game-launcher-journey-types';\nimport { SwipableArea } from './use-game-launcher-journey-style';\nimport { CarouselIndicator } from '../../comps/carousel/carousel-indicator/carousel-indicator';\n\nexport const useGameLauncherJourney = ({\n carouselRefs,\n onSegmentClick,\n onJourneyComplete,\n}: IUseGameLauncherJourneyProps) => {\n const { device } = useTheme();\n const isCompact = device <= EDeviceType.TABLET;\n\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const firstCardRefs = useRef<ICircularGameCardRefs>(null);\n const secondCardRefs = useRef<ICircularGameCardRefs>(null);\n const { nextCoachmark, setJourney, endJourney } = useJourney();\n const { onEvent: trackAnalytics } = useUIContext();\n\n const trackEventCompleted = useCallback(\n (step: ActionEvent) => {\n trackAnalytics(AnalyticsLabel.ONBOARDING_STEP_COMPLETED, {\n step,\n });\n },\n [trackAnalytics],\n );\n\n const handleEndJourneyForPuzzle = useCallback(\n (puzzlesData: Puzzle, journeyId: JOURNEY_ID_STUDENT) => {\n onSegmentClick(puzzlesData, ProjectType.PUZZLE);\n trackEventCompleted(ActionEvent.PUZZLE_ACTIVITY);\n endJourney(journeyId);\n onJourneyComplete(journeyId);\n },\n [endJourney, onJourneyComplete, onSegmentClick, trackEventCompleted],\n );\n\n const handleEndJourneyForLesson = useCallback(\n (lessonsData: Lesson, journeyId: JOURNEY_ID_STUDENT) => {\n onSegmentClick(lessonsData, ProjectType.LESSON);\n trackEventCompleted(ActionEvent.SKILL_ACTIVITY);\n endJourney(journeyId);\n onJourneyComplete(journeyId);\n },\n [endJourney, onJourneyComplete, onSegmentClick, trackEventCompleted],\n );\n\n const startJourney = useCallback(\n (journeyId: JOURNEY_ID_STUDENT, projectData?: IProjectData) => {\n const paginationList = carouselRefs.current?.indicatorRefs;\n\n const launcherDims =\n firstCardRefs.current?.circularCardWrapperRef.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n\n // Exit early if required refs or data are missing\n if (paginationList?.length < 2 || !secondCardRefs.current || !firstCardRefs.current) {\n return;\n }\n\n // prepare journey projects based on the data available as\n // games and puzzles are not aviailbale for K-1\n const journeyProjectsData = [];\n\n if (projectData?.games?.data.length && projectData?.puzzles?.data.length) {\n journeyProjectsData.push(\n {\n projectData: projectData.games.data[0],\n type: ProjectType.GAME,\n },\n {\n projectData: projectData.puzzles.data[0],\n type: ProjectType.PUZZLE,\n },\n );\n }\n\n if (projectData?.lessons?.data.length) {\n journeyProjectsData.push(\n { projectData: projectData.lessons.data[0], type: ProjectType.LESSON },\n { projectData: projectData.lessons.data[1], type: ProjectType.LESSON },\n );\n }\n\n const secondProjectData = journeyProjectsData[1];\n\n trackAnalytics(PLATFORM_EVENTS_STUDENT.ONBOARDING_STEP_VIEWED, {\n step:\n journeyProjectsData[0]?.type === ProjectType.LESSON\n ? ActionEvent.SKILL_ACTIVITY\n : ActionEvent.GAMES_ACTIVITY,\n });\n\n const coachmarks: TCoachmarkJourneyProps[] = [\n isCompact\n ? {\n originalElementToHighlightRef: firstCardRefs.current.circularCardWrapperRef,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <SwipeableCard\n onSwipeLeft={() => {\n carouselRefs.current?.goToIndex(1);\n nextCoachmark(journeyId, false, SHOW_NUDGE_AFTER_MS);\n }}\n >\n <SwipableArea />\n </SwipeableCard>\n ),\n indicator: {\n nudge: 'swipe',\n content: <Text $renderAs=\"ab2-bold\">Swipe to explore</Text>,\n nudgePointerX: launcherDims.width / 2 - 30,\n nudgePointerY: launcherDims.height / 2,\n } as INudgeProps,\n }\n : {\n originalElementToHighlightRef: paginationList[1] as React.RefObject<HTMLDivElement>,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <CarouselIndicator\n textToShowInsideIndicator=\"2\"\n onClick={() => {\n carouselRefs.current?.goToIndex(1);\n nextCoachmark(journeyId, false, SHOW_NUDGE_AFTER_MS);\n }}\n />\n ),\n indicator: {\n nudge: 'click',\n content: <Text $renderAs=\"ab1-bold\">Click to proceed</Text>,\n nudgePointerX: 0,\n nudgePointerY: 0,\n } as INudgeProps,\n },\n {\n originalElementToHighlightRef: secondCardRefs.current.circularCardWrapperRef,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <CircularGameCard\n label=\"\"\n data={{\n card: secondProjectData?.projectData?.cardLottie ?? '',\n name: secondProjectData?.projectData?.name ?? '',\n isCompleted: false,\n displayNameImage: secondProjectData?.projectData?.displayNameImage,\n onPress: () => {\n if (secondProjectData?.type === ProjectType.LESSON) {\n handleEndJourneyForLesson(secondProjectData.projectData as Lesson, journeyId);\n }\n\n if (secondProjectData?.type === ProjectType.PUZZLE) {\n handleEndJourneyForPuzzle(secondProjectData.projectData as Puzzle, journeyId);\n }\n },\n }}\n />\n ),\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs={isCompact ? 'ab2-bold' : 'ab1-bold'}>\n {isCompact ? 'Tap to start' : ' Click to start'}\n </Text>\n ),\n nudgePointerX: isCompact ? launcherDims.width / 2 : launcherDims.width / 1.3,\n nudgePointerY: isCompact ? launcherDims.height / 2 : launcherDims.height / 1.3,\n } as INudgeProps,\n },\n ];\n\n setJourney(journeyId, coachmarks);\n carouselRefs.current?.goToIndex(0);\n const delayBeforeStart = setTimeout(() => {\n clearTimeout(delayBeforeStart);\n nextCoachmark(journeyId);\n }, SLIDE_TO_LESSON_MS);\n\n timerRefs.current.push(delayBeforeStart);\n },\n [\n carouselRefs,\n trackAnalytics,\n isCompact,\n setJourney,\n nextCoachmark,\n handleEndJourneyForLesson,\n handleEndJourneyForPuzzle,\n ],\n );\n\n const data = useMemo(\n () => ({\n firstCardRefs,\n secondCardRefs,\n startJourney,\n }),\n [startJourney],\n );\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n timerRefs.current.forEach(timer => clearTimeout(timer));\n timerRefs.current = [];\n };\n }, [carouselRefs]);\n\n return data;\n};\n"],"names":["useGameLauncherJourney","carouselRefs","onSegmentClick","onJourneyComplete","device","useTheme","isCompact","EDeviceType","timerRefs","useRef","firstCardRefs","secondCardRefs","nextCoachmark","setJourney","endJourney","useJourney","trackAnalytics","useUIContext","trackEventCompleted","useCallback","step","AnalyticsLabel","handleEndJourneyForPuzzle","puzzlesData","journeyId","ProjectType","ActionEvent","handleEndJourneyForLesson","lessonsData","startJourney","projectData","paginationList","_a","launcherDims","_c","_b","journeyProjectsData","_d","_e","_f","secondProjectData","PLATFORM_EVENTS_STUDENT","_g","coachmarks","IndicatorType","jsx","SwipeableCard","SHOW_NUDGE_AFTER_MS","SwipableArea","Text","CarouselIndicator","CircularGameCard","_h","_i","_j","_k","delayBeforeStart","SLIDE_TO_LESSON_MS","data","useMemo","useEffect","timer"],"mappings":";;;;;;;;;;;;;;;;AA8BO,MAAMA,KAAyB,CAAC;AAAA,EACrC,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,mBAAAC;AACF,MAAoC;AAC5B,QAAA,EAAE,QAAAC,MAAWC,KACbC,IAAYF,KAAUG,EAAY,QAElCC,IAAYC,EAAwC,CAAA,CAAE,GAEtDC,IAAgBD,EAA8B,IAAI,GAClDE,IAAiBF,EAA8B,IAAI,GACnD,EAAE,eAAAG,GAAe,YAAAC,GAAY,YAAAC,MAAeC,EAAW,GACvD,EA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a,SAAS;AAAA,UAC7E;AAAA,QACF;AAAA,MAAA;AAGF,MAAApB,EAAWW,GAAWmB,CAAU,IACnBY,IAAAtD,EAAA,YAAA,QAAAsD,EAAS,UAAU;AAC1B,YAAAC,IAAmB,WAAW,MAAM;AACxC,qBAAaA,CAAgB,GAC7B5C,EAAcY,CAAS;AAAA,SACtBiC,EAAkB;AAEX,MAAAjD,EAAA,QAAQ,KAAKgD,CAAgB;AAAA,IACzC;AAAA,IACA;AAAA,MACEvD;AAAA,MACAe;AAAA,MACAV;AAAA,MACAO;AAAA,MACAD;AAAA,MACAe;AAAA,MACAL;AAAA,IACF;AAAA,EAAA,GAGIoC,IAAOC;AAAA,IACX,OAAO;AAAA,MACL,eAAAjD;AAAA,MACA,gBAAAC;AAAA,MACA,cAAAkB;AAAA,IAAA;AAAA,IAEF,CAACA,CAAY;AAAA,EAAA;AAIf,SAAA+B,EAAU,MACD,MAAM;AACX,IAAApD,EAAU,QAAQ,QAAQ,CAASqD,MAAA,aAAaA,CAAK,CAAC,GACtDrD,EAAU,UAAU;EAAC,GAEtB,CAACP,CAAY,CAAC,GAEVyD;AACT;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CircleSoundKey as c } from "./use-circle-sounds-enums.js";
|
|
2
|
-
const e = "https://cuemath-circle.s3.ap-southeast-1.amazonaws.com/assets/sounds/production", a = "https://static.cuemath.com/static/sounds",
|
|
2
|
+
const e = "https://cuemath-circle.s3.ap-southeast-1.amazonaws.com/assets/sounds/production", a = "https://static.cuemath.com/static/sounds", i = {
|
|
3
3
|
[c.BACKGROUND]: `${e}/bg-sound.mp3`,
|
|
4
4
|
[c.BACKGROUND_RUSHHOUR]: `${e}/circle-background-rushhour.mp3`,
|
|
5
5
|
[c.TUTORIAL]: `${e}/bg-sound-tutorials.mp3`,
|
|
@@ -30,16 +30,14 @@ const e = "https://cuemath-circle.s3.ap-southeast-1.amazonaws.com/assets/sounds/
|
|
|
30
30
|
[c.ALL_DONE]: `${e}/all-done.mp3`,
|
|
31
31
|
[c.DOING_GREAT]: `${e}/doing-great.mp3`,
|
|
32
32
|
[c.KEEP_IT_UP]: `${e}/keep-it-up.mp3`
|
|
33
|
-
},
|
|
33
|
+
}, t = [
|
|
34
34
|
c.SWIPE_04,
|
|
35
35
|
c.SWIPE_02,
|
|
36
36
|
c.SWIPE_03,
|
|
37
37
|
c.SWIPE_01
|
|
38
|
-
]
|
|
38
|
+
];
|
|
39
39
|
export {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
_ as VOLUME_FADE_DURATION,
|
|
43
|
-
E as VOLUME_TO_CHANGE
|
|
40
|
+
i as CircleSoundKeyMapper,
|
|
41
|
+
t as SWIPE_SOUND_ORDER
|
|
44
42
|
};
|
|
45
43
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../../../../src/features/circle-games/hooks/use-circle-sounds/constants.ts"],"sourcesContent":["import { CircleSoundKey } from './use-circle-sounds-enums';\n\nconst BASE_URL = 'https://cuemath-circle.s3.ap-southeast-1.amazonaws.com/assets/sounds/production';\n\nconst STATIC_BASE_URL = 'https://static.cuemath.com/static/sounds';\n\nexport const CircleSoundKeyMapper = {\n [CircleSoundKey.BACKGROUND]: `${BASE_URL}/bg-sound.mp3`,\n [CircleSoundKey.BACKGROUND_RUSHHOUR]: `${BASE_URL}/circle-background-rushhour.mp3`,\n [CircleSoundKey.TUTORIAL]: `${BASE_URL}/bg-sound-tutorials.mp3`,\n [CircleSoundKey.SWIPE_01]: `${BASE_URL}/circle-swipe-1.wav`,\n [CircleSoundKey.SWIPE_02]: `${BASE_URL}/circle-swipe-2.wav`,\n [CircleSoundKey.SWIPE_03]: `${BASE_URL}/circle-swipe-3.wav`,\n [CircleSoundKey.SWIPE_04]: `${BASE_URL}/circle-swipe-4.wav`,\n [CircleSoundKey.SWIPE_DOWN]: `${BASE_URL}/circle-swipe-down-1.wav`,\n [CircleSoundKey.TOGGLE]: `${BASE_URL}/circle-button-v3.wav`,\n [CircleSoundKey.POINTS_AWARDED]: `${BASE_URL}/circle-points-v2.wav`,\n [CircleSoundKey.ACTIVITY_COMPLETE]: `${BASE_URL}/circle-activity-complete.wav`,\n [CircleSoundKey.POINTS_ADDED]: `${BASE_URL}/circle-points-add-v1.wav`,\n [CircleSoundKey.GAME_CARD_CLICK]: `${BASE_URL}/circle-gamecard-button-v1.wav`,\n [CircleSoundKey.CLOCK_IN]: `${BASE_URL}/circle-meter-v1.wav`,\n [CircleSoundKey.CLOCK_OUT]: `${BASE_URL}/circle-disappear-v1.wav`,\n [CircleSoundKey.ACCURACY_IN]: `${BASE_URL}/circle-meter-v1.wav`,\n [CircleSoundKey.ACCURACY_OUT]: `${BASE_URL}/circle-disappear-v1.wav`,\n [CircleSoundKey.STREAK_IN]: `${BASE_URL}/circle-streak-v1.wav`,\n [CircleSoundKey.STREAK_OUT]: `${BASE_URL}/circle-disappear-v1.wav`,\n [CircleSoundKey.ACCURACY_INTRO]: `${STATIC_BASE_URL}/accuracy-intro.mp3`,\n [CircleSoundKey.ACCURACY_TARGET]: `${STATIC_BASE_URL}/accuracy-target.mp3`,\n [CircleSoundKey.TIME_INTRO]: `${STATIC_BASE_URL}/timer-intro.mp3`,\n [CircleSoundKey.TIME_TARGET]: `${STATIC_BASE_URL}/timer-target.mp3`,\n [CircleSoundKey.METER_FILL]: `${STATIC_BASE_URL}/meter-fill.mp3`,\n [CircleSoundKey.YOUR_SCORE]: `${BASE_URL}/your-score.mp3`,\n [CircleSoundKey.HIGH_SCORE]: `${BASE_URL}/high-score.mp3`,\n [CircleSoundKey.ALL_ACTIVITIES_COMPLETE]: `${BASE_URL}/circle-all-activities-complete.mp3`,\n [CircleSoundKey.ALL_DONE]: `${BASE_URL}/all-done.mp3`,\n [CircleSoundKey.DOING_GREAT]: `${BASE_URL}/doing-great.mp3`,\n [CircleSoundKey.KEEP_IT_UP]: `${BASE_URL}/keep-it-up.mp3`,\n};\n\nexport const SWIPE_SOUND_ORDER = [\n CircleSoundKey.SWIPE_04,\n CircleSoundKey.SWIPE_02,\n CircleSoundKey.SWIPE_03,\n CircleSoundKey.SWIPE_01,\n];\n\nexport const VOLUME_FADE_DURATION = 100; // in milliseconds\nexport const VOLUME_TO_CHANGE = 0.1; // volume change per fade step\n"],"names":["BASE_URL","STATIC_BASE_URL","CircleSoundKeyMapper","CircleSoundKey","SWIPE_SOUND_ORDER"
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../../src/features/circle-games/hooks/use-circle-sounds/constants.ts"],"sourcesContent":["import { CircleSoundKey } from './use-circle-sounds-enums';\n\nconst BASE_URL = 'https://cuemath-circle.s3.ap-southeast-1.amazonaws.com/assets/sounds/production';\n\nconst STATIC_BASE_URL = 'https://static.cuemath.com/static/sounds';\n\nexport const CircleSoundKeyMapper = {\n [CircleSoundKey.BACKGROUND]: `${BASE_URL}/bg-sound.mp3`,\n [CircleSoundKey.BACKGROUND_RUSHHOUR]: `${BASE_URL}/circle-background-rushhour.mp3`,\n [CircleSoundKey.TUTORIAL]: `${BASE_URL}/bg-sound-tutorials.mp3`,\n [CircleSoundKey.SWIPE_01]: `${BASE_URL}/circle-swipe-1.wav`,\n [CircleSoundKey.SWIPE_02]: `${BASE_URL}/circle-swipe-2.wav`,\n [CircleSoundKey.SWIPE_03]: `${BASE_URL}/circle-swipe-3.wav`,\n [CircleSoundKey.SWIPE_04]: `${BASE_URL}/circle-swipe-4.wav`,\n [CircleSoundKey.SWIPE_DOWN]: `${BASE_URL}/circle-swipe-down-1.wav`,\n [CircleSoundKey.TOGGLE]: `${BASE_URL}/circle-button-v3.wav`,\n [CircleSoundKey.POINTS_AWARDED]: `${BASE_URL}/circle-points-v2.wav`,\n [CircleSoundKey.ACTIVITY_COMPLETE]: `${BASE_URL}/circle-activity-complete.wav`,\n [CircleSoundKey.POINTS_ADDED]: `${BASE_URL}/circle-points-add-v1.wav`,\n [CircleSoundKey.GAME_CARD_CLICK]: `${BASE_URL}/circle-gamecard-button-v1.wav`,\n [CircleSoundKey.CLOCK_IN]: `${BASE_URL}/circle-meter-v1.wav`,\n [CircleSoundKey.CLOCK_OUT]: `${BASE_URL}/circle-disappear-v1.wav`,\n [CircleSoundKey.ACCURACY_IN]: `${BASE_URL}/circle-meter-v1.wav`,\n [CircleSoundKey.ACCURACY_OUT]: `${BASE_URL}/circle-disappear-v1.wav`,\n [CircleSoundKey.STREAK_IN]: `${BASE_URL}/circle-streak-v1.wav`,\n [CircleSoundKey.STREAK_OUT]: `${BASE_URL}/circle-disappear-v1.wav`,\n [CircleSoundKey.ACCURACY_INTRO]: `${STATIC_BASE_URL}/accuracy-intro.mp3`,\n [CircleSoundKey.ACCURACY_TARGET]: `${STATIC_BASE_URL}/accuracy-target.mp3`,\n [CircleSoundKey.TIME_INTRO]: `${STATIC_BASE_URL}/timer-intro.mp3`,\n [CircleSoundKey.TIME_TARGET]: `${STATIC_BASE_URL}/timer-target.mp3`,\n [CircleSoundKey.METER_FILL]: `${STATIC_BASE_URL}/meter-fill.mp3`,\n [CircleSoundKey.YOUR_SCORE]: `${BASE_URL}/your-score.mp3`,\n [CircleSoundKey.HIGH_SCORE]: `${BASE_URL}/high-score.mp3`,\n [CircleSoundKey.ALL_ACTIVITIES_COMPLETE]: `${BASE_URL}/circle-all-activities-complete.mp3`,\n [CircleSoundKey.ALL_DONE]: `${BASE_URL}/all-done.mp3`,\n [CircleSoundKey.DOING_GREAT]: `${BASE_URL}/doing-great.mp3`,\n [CircleSoundKey.KEEP_IT_UP]: `${BASE_URL}/keep-it-up.mp3`,\n};\n\nexport const SWIPE_SOUND_ORDER = [\n CircleSoundKey.SWIPE_04,\n CircleSoundKey.SWIPE_02,\n CircleSoundKey.SWIPE_03,\n CircleSoundKey.SWIPE_01,\n];\n\nexport const VOLUME_FADE_DURATION = 100; // in milliseconds\nexport const VOLUME_TO_CHANGE = 0.1; // volume change per fade step\n"],"names":["BASE_URL","STATIC_BASE_URL","CircleSoundKeyMapper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ACE,EAAe,WAAW,GAAG,GAAGF,CAAe;AAAA,EAChD,CAACE,EAAe,UAAU,GAAG,GAAGF,CAAe;AAAA,EAC/C,CAACE,EAAe,UAAU,GAAG,GAAGH,CAAQ;AAAA,EACxC,CAACG,EAAe,UAAU,GAAG,GAAGH,CAAQ;AAAA,EACxC,CAACG,EAAe,uBAAuB,GAAG,GAAGH,CAAQ;AAAA,EACrD,CAACG,EAAe,QAAQ,GAAG,GAAGH,CAAQ;AAAA,EACtC,CAACG,EAAe,WAAW,GAAG,GAAGH,CAAQ;AAAA,EACzC,CAACG,EAAe,UAAU,GAAG,GAAGH,CAAQ;AAC1C,GAEaI,IAAoB;AAAA,EAC/BD,EAAe;AAAA,EACfA,EAAe;AAAA,EACfA,EAAe;AAAA,EACfA,EAAe;AACjB;"}
|
|
@@ -1,115 +1,135 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useAutoPlayPermission as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
[
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
19
|
-
[
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
23
|
-
[
|
|
24
|
-
[
|
|
25
|
-
[
|
|
26
|
-
[
|
|
27
|
-
[
|
|
28
|
-
[
|
|
29
|
-
[
|
|
30
|
-
[
|
|
31
|
-
[
|
|
32
|
-
[
|
|
33
|
-
[
|
|
34
|
-
[
|
|
35
|
-
[
|
|
36
|
-
[
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
1
|
+
import { useRef as O, useCallback as d, useEffect as v } from "react";
|
|
2
|
+
import { useAutoPlayPermission as U } from "../../../hooks/use-auto-play-permission/use-auto-play-permission.js";
|
|
3
|
+
import { SWIPE_SOUND_ORDER as w, CircleSoundKeyMapper as y } from "./constants.js";
|
|
4
|
+
import { CircleSoundKey as e } from "./use-circle-sounds-enums.js";
|
|
5
|
+
let C = 0;
|
|
6
|
+
const u = new (window.AudioContext || window.webkitAudioContext)(), _ = {
|
|
7
|
+
[e.BACKGROUND]: null,
|
|
8
|
+
[e.BACKGROUND_RUSHHOUR]: null,
|
|
9
|
+
[e.TUTORIAL]: null,
|
|
10
|
+
[e.SWIPE_01]: null,
|
|
11
|
+
[e.SWIPE_02]: null,
|
|
12
|
+
[e.SWIPE_03]: null,
|
|
13
|
+
[e.SWIPE_04]: null,
|
|
14
|
+
[e.SWIPE_DOWN]: null,
|
|
15
|
+
[e.TOGGLE]: null,
|
|
16
|
+
[e.POINTS_AWARDED]: null,
|
|
17
|
+
[e.POINTS_ADDED]: null,
|
|
18
|
+
[e.GAME_CARD_CLICK]: null,
|
|
19
|
+
[e.CLOCK_IN]: null,
|
|
20
|
+
[e.CLOCK_OUT]: null,
|
|
21
|
+
[e.ACCURACY_IN]: null,
|
|
22
|
+
[e.ACCURACY_OUT]: null,
|
|
23
|
+
[e.STREAK_IN]: null,
|
|
24
|
+
[e.STREAK_OUT]: null,
|
|
25
|
+
[e.ACCURACY_INTRO]: null,
|
|
26
|
+
[e.ACCURACY_TARGET]: null,
|
|
27
|
+
[e.TIME_INTRO]: null,
|
|
28
|
+
[e.TIME_TARGET]: null,
|
|
29
|
+
[e.METER_FILL]: null,
|
|
30
|
+
[e.YOUR_SCORE]: null,
|
|
31
|
+
[e.HIGH_SCORE]: null,
|
|
32
|
+
[e.KEEP_IT_UP]: null,
|
|
33
|
+
[e.DOING_GREAT]: null,
|
|
34
|
+
[e.ALL_DONE]: null,
|
|
35
|
+
[e.ACTIVITY_COMPLETE]: null,
|
|
36
|
+
[e.ALL_ACTIVITIES_COMPLETE]: null
|
|
37
|
+
}, l = {};
|
|
38
|
+
let R = !1;
|
|
39
|
+
const S = async () => {
|
|
40
|
+
if (u.state === "suspended" && !R) {
|
|
41
|
+
R = !0;
|
|
42
|
+
try {
|
|
43
|
+
await u.resume();
|
|
44
|
+
} catch (a) {
|
|
45
|
+
console.warn("Failed to resume AudioContext:", a);
|
|
46
|
+
} finally {
|
|
47
|
+
R = !1;
|
|
43
48
|
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (t)
|
|
51
|
-
u.volume = 1;
|
|
52
|
-
else {
|
|
53
|
-
const I = R(u);
|
|
54
|
-
o.current[l] = I;
|
|
55
|
-
}
|
|
56
|
-
return u;
|
|
57
|
-
}
|
|
58
|
-
u.volume = t ? 1 : 0;
|
|
59
|
-
const A = u.play();
|
|
60
|
-
if (A && (_[l] = A), !t) {
|
|
61
|
-
const I = R(u);
|
|
62
|
-
o.current[l] = I;
|
|
63
|
-
}
|
|
64
|
-
return u;
|
|
65
|
-
},
|
|
66
|
-
[C, f]
|
|
67
|
-
), a = s((l, t) => {
|
|
68
|
-
const e = c[l];
|
|
69
|
-
if (!e) return;
|
|
70
|
-
if (o.current[l] && clearInterval(o.current[l]), t) {
|
|
71
|
-
e.pause();
|
|
72
|
-
return;
|
|
49
|
+
}
|
|
50
|
+
}, K = () => {
|
|
51
|
+
const { canAutoPlayAudio: a } = U(), s = O(/* @__PURE__ */ new Set()), f = O({}), T = d(async (n) => {
|
|
52
|
+
if (!_[n]) {
|
|
53
|
+
const t = await D(y[n]);
|
|
54
|
+
t && (_[n] = t);
|
|
73
55
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
},
|
|
77
|
-
(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
56
|
+
}, []), p = (n) => {
|
|
57
|
+
n.gain.setValueAtTime(0, u.currentTime), n.gain.linearRampToValueAtTime(1, u.currentTime + 0.5);
|
|
58
|
+
}, L = (n, t) => {
|
|
59
|
+
n.gain.setValueAtTime(n.gain.value, u.currentTime), n.gain.linearRampToValueAtTime(0, u.currentTime + 0.5);
|
|
60
|
+
const o = setTimeout(() => {
|
|
61
|
+
var r;
|
|
62
|
+
(r = l[t]) == null || r.source.stop(), delete l[t];
|
|
63
|
+
}, 500);
|
|
64
|
+
f.current[t] = o;
|
|
65
|
+
}, i = d(
|
|
66
|
+
async (n, t = !0, o = !1) => {
|
|
67
|
+
await S(), await T(n);
|
|
68
|
+
const r = _[n];
|
|
69
|
+
if (!r || !a) {
|
|
70
|
+
console.warn("Cannot play sound", n, { buffer: r, canPlayAudio: a });
|
|
85
71
|
return;
|
|
86
72
|
}
|
|
87
|
-
|
|
73
|
+
if (l[n] && o)
|
|
74
|
+
return;
|
|
75
|
+
const c = u.createBufferSource(), E = u.createGain();
|
|
76
|
+
c.buffer = r, c.loop = o, c.connect(E).connect(u.destination), t ? E.gain.setValueAtTime(1, u.currentTime) : p(E), c.start(), l[n] = { source: c, gainNode: E, loop: o }, o || (c.onended = () => {
|
|
77
|
+
var I;
|
|
78
|
+
((I = l[n]) == null ? void 0 : I.source) === c && delete l[n];
|
|
79
|
+
});
|
|
88
80
|
},
|
|
89
|
-
[a]
|
|
90
|
-
),
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
}, [
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
81
|
+
[a, T]
|
|
82
|
+
), A = d(async (n, t = !0) => {
|
|
83
|
+
const o = l[n];
|
|
84
|
+
o && (t ? (o.source.stop(), delete l[n]) : L(o.gainNode, n));
|
|
85
|
+
}, []), P = d(() => {
|
|
86
|
+
const n = w[C] || e.SWIPE_01;
|
|
87
|
+
C = (C + 1) % w.length, i(n);
|
|
88
|
+
}, [i]), h = d(() => {
|
|
89
|
+
i(e.TOGGLE);
|
|
90
|
+
}, [i]), m = d(async () => {
|
|
91
|
+
document.visibilityState === "visible" ? (await S(), Array.from(s.current).forEach((t) => {
|
|
92
|
+
var o;
|
|
93
|
+
i(t, !1, ((o = l[t]) == null ? void 0 : o.loop) ?? !1);
|
|
94
|
+
}), s.current.clear()) : Object.keys(l).forEach((n) => {
|
|
95
|
+
A(n, !0), s.current.add(n);
|
|
96
|
+
});
|
|
97
|
+
}, [i, A]);
|
|
98
|
+
return v(() => {
|
|
99
|
+
const n = ["pointerdown", "touchstart"], t = () => {
|
|
100
|
+
S();
|
|
101
|
+
};
|
|
102
|
+
document.addEventListener("visibilitychange", m), n.forEach((r) => {
|
|
103
|
+
window.addEventListener(r, t, { once: !0 });
|
|
104
|
+
});
|
|
105
|
+
const o = f.current;
|
|
104
106
|
return () => {
|
|
105
|
-
document.removeEventListener("visibilitychange",
|
|
106
|
-
|
|
107
|
-
});
|
|
107
|
+
document.removeEventListener("visibilitychange", m), n.forEach((r) => {
|
|
108
|
+
window.removeEventListener(r, t);
|
|
109
|
+
}), Object.values(o).forEach((r) => clearTimeout(r));
|
|
108
110
|
};
|
|
109
|
-
}, [
|
|
111
|
+
}, [m]), {
|
|
112
|
+
playSwipeSound: P,
|
|
113
|
+
play: i,
|
|
114
|
+
stop: A,
|
|
115
|
+
playButtonSound: h
|
|
116
|
+
};
|
|
117
|
+
}, D = async (a) => {
|
|
118
|
+
try {
|
|
119
|
+
const s = await fetch(a, {
|
|
120
|
+
mode: "cors",
|
|
121
|
+
credentials: "omit"
|
|
122
|
+
});
|
|
123
|
+
if (!s.ok)
|
|
124
|
+
throw new Error(`HTTP error! status: ${s.status}`);
|
|
125
|
+
const f = await s.arrayBuffer();
|
|
126
|
+
return await u.decodeAudioData(f);
|
|
127
|
+
} catch (s) {
|
|
128
|
+
console.error("CORS error loading audio:", s);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
110
131
|
};
|
|
111
132
|
export {
|
|
112
|
-
|
|
113
|
-
b as useCircleSounds
|
|
133
|
+
K as useCircleSounds
|
|
114
134
|
};
|
|
115
135
|
//# sourceMappingURL=use-circle-sounds.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-circle-sounds.js","sources":["../../../../../src/features/circle-games/hooks/use-circle-sounds/use-circle-sounds.ts"],"sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\n\nimport { useAutoPlayPermission } from '../../../hooks/use-auto-play-permission/use-auto-play-permission';\nimport { CircleSoundKeyMapper, SWIPE_SOUND_ORDER } from './constants';\nimport { fadeInSound, fadeOutSound } from './helper';\nimport type { TimeoutMap } from './use-circle-sound-types';\nimport { CircleSoundKey } from './use-circle-sounds-enums';\n\nlet swipeSoundIndex = 0;\n\nexport const soundMapper: Record<keyof typeof CircleSoundKeyMapper, null | HTMLAudioElement> = {\n [CircleSoundKey.BACKGROUND]: null,\n [CircleSoundKey.BACKGROUND_RUSHHOUR]: null,\n [CircleSoundKey.TUTORIAL]: null,\n [CircleSoundKey.SWIPE_01]: null,\n [CircleSoundKey.SWIPE_02]: null,\n [CircleSoundKey.SWIPE_03]: null,\n [CircleSoundKey.SWIPE_04]: null,\n [CircleSoundKey.SWIPE_DOWN]: null,\n [CircleSoundKey.TOGGLE]: null,\n [CircleSoundKey.POINTS_AWARDED]: null,\n [CircleSoundKey.POINTS_ADDED]: null,\n [CircleSoundKey.GAME_CARD_CLICK]: null,\n [CircleSoundKey.CLOCK_IN]: null,\n [CircleSoundKey.CLOCK_OUT]: null,\n [CircleSoundKey.ACCURACY_IN]: null,\n [CircleSoundKey.ACCURACY_OUT]: null,\n [CircleSoundKey.STREAK_IN]: null,\n [CircleSoundKey.STREAK_OUT]: null,\n [CircleSoundKey.ACCURACY_INTRO]: null,\n [CircleSoundKey.ACCURACY_TARGET]: null,\n [CircleSoundKey.TIME_INTRO]: null,\n [CircleSoundKey.TIME_TARGET]: null,\n [CircleSoundKey.METER_FILL]: null,\n [CircleSoundKey.YOUR_SCORE]: null,\n [CircleSoundKey.HIGH_SCORE]: null,\n [CircleSoundKey.KEEP_IT_UP]: null,\n [CircleSoundKey.DOING_GREAT]: null,\n [CircleSoundKey.ALL_DONE]: null,\n [CircleSoundKey.ACTIVITY_COMPLETE]: null,\n [CircleSoundKey.ALL_ACTIVITIES_COMPLETE]: null,\n};\n\nconst soundInstancePromise: Partial<Record<keyof typeof CircleSoundKeyMapper, Promise<void>>> = {};\n\nexport const useCircleSounds = () => {\n const { canAutoPlayAudio: canPlayAudio } = useAutoPlayPermission();\n\n const loadSound = useCallback((key: CircleSoundKey) => {\n if (!soundMapper[key]) {\n const loadedSound = new Audio(CircleSoundKeyMapper[key]);\n\n soundMapper[key] = loadedSound;\n }\n }, []);\n\n const pausedSoundsRef = useRef<Set<CircleSoundKey>>(new Set());\n const timeoutRefs = useRef<TimeoutMap>({});\n\n const play = useCallback(\n (key: CircleSoundKey, immediately: boolean = true, loop = false) => {\n loadSound(key);\n const soundInstance = soundMapper[key];\n\n if (!soundInstance || !canPlayAudio) return;\n\n // this makes sure that it keeps the default loop value at the time it was requested to be loaded\n // helps in visibility change where we only want to resume\n if (loop) {\n soundInstance.loop = loop;\n }\n\n if (timeoutRefs.current[key]) {\n clearInterval(timeoutRefs.current[key]);\n }\n\n // resume sound\n if (!soundInstance.paused && soundInstance.currentTime > 0 && !soundInstance.ended) {\n if (!immediately) {\n const intervalId = fadeInSound(soundInstance);\n\n timeoutRefs.current[key] = intervalId;\n } else {\n soundInstance.volume = 1;\n }\n\n return soundInstance;\n }\n\n // play sound\n soundInstance.volume = immediately ? 1 : 0;\n const promise = soundInstance.play();\n\n if (promise) {\n soundInstancePromise[key] = promise;\n }\n\n if (!immediately) {\n const intervalId = fadeInSound(soundInstance);\n\n timeoutRefs.current[key] = intervalId;\n }\n\n return soundInstance;\n },\n [loadSound, canPlayAudio],\n );\n\n const handleSoundStop = useCallback((key: CircleSoundKey, immediately: boolean) => {\n const soundInstance = soundMapper[key];\n\n if (!soundInstance) return;\n\n if (timeoutRefs.current[key]) {\n clearInterval(timeoutRefs.current[key]);\n }\n\n if (immediately) {\n soundInstance.pause();\n\n return;\n }\n\n const intervalId = fadeOutSound(soundInstance);\n\n timeoutRefs.current[key] = intervalId;\n }, []);\n\n const stop = useCallback(\n (key: CircleSoundKey, immediately: boolean = true) => {\n // if play returned a promise\n if (soundInstancePromise[key] !== undefined) {\n soundInstancePromise[key]\n ?.then(() => {\n handleSoundStop(key, immediately);\n })\n .catch(err => {\n // eslint-disable-next-line no-console\n console.log('sound not playing', err);\n });\n\n return;\n }\n\n handleSoundStop(key, immediately);\n },\n [handleSoundStop],\n );\n\n const playSwipeSound = useCallback(() => {\n const key = SWIPE_SOUND_ORDER[swipeSoundIndex] || CircleSoundKey.SWIPE_01;\n\n swipeSoundIndex = (swipeSoundIndex + 1) % SWIPE_SOUND_ORDER.length;\n\n play(key);\n }, [play]);\n\n const playButtonSound = useCallback(() => {\n const sound = play(CircleSoundKey.TOGGLE);\n\n return sound;\n }, [play]);\n\n const handleVisibilityChange = useCallback(() => {\n const visibilityState = document.visibilityState;\n\n if (visibilityState === 'hidden') {\n Object.entries(soundMapper).forEach(([key, sound]) => {\n if (sound && !sound.paused) {\n stop(key as CircleSoundKey, true);\n pausedSoundsRef.current.add(key as CircleSoundKey);\n }\n });\n }\n\n if (visibilityState === 'visible') {\n pausedSoundsRef.current.forEach(key => {\n play(key);\n });\n pausedSoundsRef.current.clear();\n }\n }, [play, stop]);\n\n useEffect(() => {\n document.addEventListener('visibilitychange', handleVisibilityChange);\n const timeouts = timeoutRefs.current;\n\n return () => {\n document.removeEventListener('visibilitychange', handleVisibilityChange);\n Object.values(timeouts).forEach(id => {\n if (id) {\n clearInterval(id);\n }\n });\n };\n }, [handleVisibilityChange]);\n\n return { playSwipeSound, play, stop, playButtonSound };\n};\n"],"names":["swipeSoundIndex","soundMapper","CircleSoundKey","soundInstancePromise","useCircleSounds","canPlayAudio","useAutoPlayPermission","loadSound","useCallback","key","loadedSound","CircleSoundKeyMapper","pausedSoundsRef","useRef","timeoutRefs","play","immediately","loop","soundInstance","intervalId","fadeInSound","promise","handleSoundStop","fadeOutSound","stop","_a","err","playSwipeSound","SWIPE_SOUND_ORDER","playButtonSound","handleVisibilityChange","visibilityState","sound","useEffect","timeouts","id"],"mappings":";;;;;AAQA,IAAIA,IAAkB;AAEf,MAAMC,IAAkF;AAAA,EAC7F,CAACC,EAAe,UAAU,GAAG;AAAA,EAC7B,CAACA,EAAe,mBAAmB,GAAG;AAAA,EACtC,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,UAAU,GAAG;AAAA,EAC7B,CAACA,EAAe,MAAM,GAAG;AAAA,EACzB,CAACA,EAAe,cAAc,GAAG;AAAA,EACjC,CAACA,EAAe,YAAY,GAAG;AAAA,EAC/B,CAACA,EAAe,eAAe,GAAG;AAAA,EAClC,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,SAAS,GAAG;AAAA,EAC5B,CAACA,EAAe,WAAW,GAAG;AAAA,EAC9B,CAACA,EAAe,YAAY,GAAG;AAAA,EAC/B,CAACA,EAAe,SAAS,GAAG;AAAA,EAC5B,CAACA,EAAe,UAAU,GAAG;AAAA,EAC7B,CAACA,EAAe,cAAc,GAAG;AAAA,EACjC,CAACA,EAAe,eAAe,GAAG;AAAA,EAClC,CAACA,EAAe,UAAU,GAAG;AAAA,EAC7B,CAACA,EAAe,WAAW,GAAG;AAAA,EAC9B,CAACA,EAAe,UAAU,GAAG;AAAA,EAC7B,CAACA,EAAe,UAAU,GAAG;AAAA,EAC7B,CAACA,EAAe,UAAU,GAAG;AAAA,EAC7B,CAACA,EAAe,UAAU,GAAG;AAAA,EAC7B,CAACA,EAAe,WAAW,GAAG;AAAA,EAC9B,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,IAAIH,CAAqB;AAAA,IACnD,CACD,GAGCsB,MAAoB,cACNnB,EAAA,QAAQ,QAAQ,CAAOH,MAAA;AACrC,MAAAM,EAAKN,CAAG;AAAA,IAAA,CACT,GACDG,EAAgB,QAAQ;EAC1B,GACC,CAACG,GAAMS,CAAI,CAAC;AAEf,SAAAS,EAAU,MAAM;AACL,aAAA,iBAAiB,oBAAoBH,CAAsB;AACpE,UAAMI,IAAWpB,EAAY;AAE7B,WAAO,MAAM;AACF,eAAA,oBAAoB,oBAAoBgB,CAAsB,GACvE,OAAO,OAAOI,CAAQ,EAAE,QAAQ,CAAMC,MAAA;AACpC,QAAIA,KACF,cAAcA,CAAE;AAAA,MAClB,CACD;AAAA,IAAA;AAAA,EACH,GACC,CAACL,CAAsB,CAAC,GAEpB,EAAE,gBAAAH,GAAgB,MAAAZ,GAAM,MAAAS,GAAM,iBAAAK,EAAgB;AACvD;"}
|
|
1
|
+
{"version":3,"file":"use-circle-sounds.js","sources":["../../../../../src/features/circle-games/hooks/use-circle-sounds/use-circle-sounds.ts"],"sourcesContent":["/* eslint-disable no-console */\nimport { useCallback, useEffect, useRef } from 'react';\n\nimport { useAutoPlayPermission } from '../../../hooks/use-auto-play-permission/use-auto-play-permission';\nimport { CircleSoundKeyMapper, SWIPE_SOUND_ORDER } from './constants';\nimport type { TimeoutMap } from './use-circle-sound-types';\nimport { CircleSoundKey } from './use-circle-sounds-enums';\n\nlet swipeSoundIndex = 0;\nconst audioContext = new (window.AudioContext || window.webkitAudioContext)();\n\nconst bufferMapper: Record<CircleSoundKey, AudioBuffer | null> = {\n [CircleSoundKey.BACKGROUND]: null,\n [CircleSoundKey.BACKGROUND_RUSHHOUR]: null,\n [CircleSoundKey.TUTORIAL]: null,\n [CircleSoundKey.SWIPE_01]: null,\n [CircleSoundKey.SWIPE_02]: null,\n [CircleSoundKey.SWIPE_03]: null,\n [CircleSoundKey.SWIPE_04]: null,\n [CircleSoundKey.SWIPE_DOWN]: null,\n [CircleSoundKey.TOGGLE]: null,\n [CircleSoundKey.POINTS_AWARDED]: null,\n [CircleSoundKey.POINTS_ADDED]: null,\n [CircleSoundKey.GAME_CARD_CLICK]: null,\n [CircleSoundKey.CLOCK_IN]: null,\n [CircleSoundKey.CLOCK_OUT]: null,\n [CircleSoundKey.ACCURACY_IN]: null,\n [CircleSoundKey.ACCURACY_OUT]: null,\n [CircleSoundKey.STREAK_IN]: null,\n [CircleSoundKey.STREAK_OUT]: null,\n [CircleSoundKey.ACCURACY_INTRO]: null,\n [CircleSoundKey.ACCURACY_TARGET]: null,\n [CircleSoundKey.TIME_INTRO]: null,\n [CircleSoundKey.TIME_TARGET]: null,\n [CircleSoundKey.METER_FILL]: null,\n [CircleSoundKey.YOUR_SCORE]: null,\n [CircleSoundKey.HIGH_SCORE]: null,\n [CircleSoundKey.KEEP_IT_UP]: null,\n [CircleSoundKey.DOING_GREAT]: null,\n [CircleSoundKey.ALL_DONE]: null,\n [CircleSoundKey.ACTIVITY_COMPLETE]: null,\n [CircleSoundKey.ALL_ACTIVITIES_COMPLETE]: null,\n};\n\ntype ActiveSound = {\n source: AudioBufferSourceNode;\n gainNode: GainNode;\n loop: boolean;\n};\n\nconst activeSounds: Partial<Record<CircleSoundKey, ActiveSound>> = {};\n\nlet resuming = false;\nconst resumeAudioContext = async () => {\n if (audioContext.state === 'suspended' && !resuming) {\n resuming = true;\n try {\n await audioContext.resume();\n } catch (err) {\n console.warn('Failed to resume AudioContext:', err);\n } finally {\n resuming = false;\n }\n }\n};\n\nexport const useCircleSounds = () => {\n const { canAutoPlayAudio: canPlayAudio } = useAutoPlayPermission();\n\n const pausedSoundsRef = useRef<Set<CircleSoundKey>>(new Set());\n const timeoutRefs = useRef<TimeoutMap>({});\n\n const loadSound = useCallback(async (key: CircleSoundKey) => {\n if (!bufferMapper[key]) {\n const audioBuffer = await fetchAudio(CircleSoundKeyMapper[key]);\n\n if (audioBuffer) {\n bufferMapper[key] = audioBuffer;\n }\n }\n }, []);\n\n const fadeIn = (gainNode: GainNode) => {\n gainNode.gain.setValueAtTime(0, audioContext.currentTime);\n gainNode.gain.linearRampToValueAtTime(1, audioContext.currentTime + 0.5);\n };\n\n const fadeOut = (gainNode: GainNode, key: CircleSoundKey) => {\n gainNode.gain.setValueAtTime(gainNode.gain.value, audioContext.currentTime);\n gainNode.gain.linearRampToValueAtTime(0, audioContext.currentTime + 0.5);\n const timeout = setTimeout(() => {\n activeSounds[key]?.source.stop();\n delete activeSounds[key];\n }, 500);\n\n timeoutRefs.current[key] = timeout as unknown as number;\n };\n\n const play = useCallback(\n async (key: CircleSoundKey, immediately = true, loop = false) => {\n await resumeAudioContext();\n await loadSound(key);\n const buffer = bufferMapper[key];\n\n if (!buffer || !canPlayAudio) {\n console.warn('Cannot play sound', key, { buffer, canPlayAudio });\n\n return;\n }\n\n // prevent duplicate loop sounds\n if (activeSounds[key] && loop) {\n return;\n }\n\n const source = audioContext.createBufferSource();\n const gainNode = audioContext.createGain();\n\n source.buffer = buffer;\n source.loop = loop;\n source.connect(gainNode).connect(audioContext.destination);\n\n if (immediately) {\n gainNode.gain.setValueAtTime(1, audioContext.currentTime);\n } else {\n fadeIn(gainNode);\n }\n\n source.start();\n activeSounds[key] = { source, gainNode, loop };\n\n if (!loop) {\n source.onended = () => {\n if (activeSounds[key]?.source === source) {\n delete activeSounds[key];\n }\n };\n }\n },\n [canPlayAudio, loadSound],\n );\n\n const stop = useCallback(async (key: CircleSoundKey, immediately = true) => {\n const sound = activeSounds[key];\n\n if (!sound) return;\n\n if (immediately) {\n sound.source.stop();\n delete activeSounds[key];\n } else {\n fadeOut(sound.gainNode, key);\n }\n }, []);\n\n const playSwipeSound = useCallback(() => {\n const key = SWIPE_SOUND_ORDER[swipeSoundIndex] || CircleSoundKey.SWIPE_01;\n\n swipeSoundIndex = (swipeSoundIndex + 1) % SWIPE_SOUND_ORDER.length;\n play(key);\n }, [play]);\n\n const playButtonSound = useCallback(() => {\n play(CircleSoundKey.TOGGLE);\n }, [play]);\n\n const handleVisibilityChange = useCallback(async () => {\n if (document.visibilityState === 'visible') {\n await resumeAudioContext();\n // replay paused sounds with fresh source nodes\n const paused = Array.from(pausedSoundsRef.current);\n\n paused.forEach(key => {\n play(key, false, activeSounds[key]?.loop ?? false);\n });\n pausedSoundsRef.current.clear();\n } else {\n Object.keys(activeSounds).forEach(key => {\n stop(key as CircleSoundKey, true);\n pausedSoundsRef.current.add(key as CircleSoundKey);\n });\n }\n }, [play, stop]);\n\n useEffect(() => {\n const interactionEvents = ['pointerdown', 'touchstart'];\n const tryResume = () => {\n resumeAudioContext();\n };\n\n document.addEventListener('visibilitychange', handleVisibilityChange);\n interactionEvents.forEach(event => {\n window.addEventListener(event, tryResume, { once: true });\n });\n\n const timeouts = timeoutRefs.current;\n\n return () => {\n document.removeEventListener('visibilitychange', handleVisibilityChange);\n interactionEvents.forEach(event => {\n window.removeEventListener(event, tryResume);\n });\n Object.values(timeouts).forEach(id => clearTimeout(id));\n };\n }, [handleVisibilityChange]);\n\n return {\n playSwipeSound,\n play,\n stop,\n playButtonSound,\n };\n};\n\nconst fetchAudio = async (url: string): Promise<AudioBuffer | undefined> => {\n try {\n const response: Response = await fetch(url, {\n mode: 'cors',\n credentials: 'omit',\n });\n\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`);\n }\n\n const arrayBuffer: ArrayBuffer = await response.arrayBuffer();\n const decoded: AudioBuffer = await audioContext.decodeAudioData(arrayBuffer);\n\n return decoded;\n } catch (error) {\n console.error('CORS error loading audio:', error);\n\n return undefined;\n }\n};\n"],"names":["swipeSoundIndex","audioContext","bufferMapper","CircleSoundKey","activeSounds","resuming","resumeAudioContext","err","useCircleSounds","canPlayAudio","useAutoPlayPermission","pausedSoundsRef","useRef","timeoutRefs","loadSound","useCallback","key","audioBuffer","fetchAudio","CircleSoundKeyMapper","fadeIn","gainNode","fadeOut","timeout","_a","play","immediately","loop","buffer","source","stop","sound","playSwipeSound","SWIPE_SOUND_ORDER","playButtonSound","handleVisibilityChange","useEffect","interactionEvents","tryResume","event","timeouts","id","url","response","arrayBuffer","error"],"mappings":";;;;AAQA,IAAIA,IAAkB;AACtB,MAAMC,IAAe,KAAK,OAAO,gBAAgB,OAAO,oBAAoB,GAEtEC,IAA2D;AAAA,EAC/D,CAACC,EAAe,UAAU,GAAG;AAAA,EAC7B,CAACA,EAAe,mBAAmB,GAAG;AAAA,EACtC,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,UAAU,GAAG;AAAA,EAC7B,CAACA,EAAe,MAAM,GAAG;AAAA,EACzB,CAACA,EAAe,cAAc,GAAG;AAAA,EACjC,CAACA,EAAe,YAAY,GAAG;AAAA,EAC/B,CAACA,EAAe,eAAe,GAAG;AAAA,EAClC,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,SAAS,GAAG;AAAA,EAC5B,CAACA,EAAe,WAAW,GAAG;AAAA,EAC9B,CAACA,EAAe,YAAY,GAAG;AAAA,EAC/B,CAACA,EAAe,SAAS,GAAG;AAAA,EAC5B,CAACA,EAAe,UAAU,GAAG;AAAA,EAC7B,CAACA,EAAe,cAAc,GAAG;AAAA,EACjC,CAACA,EAAe,eAAe,GAAG;AAAA,EAClC,CAACA,EAAe,UAAU,GAAG;AAAA,EAC7B,CAACA,EAAe,WAAW,GAAG;AAAA,EAC9B,CAACA,EAAe,UAAU,GAAG;AAAA,EAC7B,CAACA,EAAe,UAAU,GAAG;AAAA,EAC7B,CAACA,EAAe,UAAU,GAAG;AAAA,EAC7B,CAACA,EAAe,UAAU,GAAG;AAAA,EAC7B,CAACA,EAAe,WAAW,GAAG;AAAA,EAC9B,CAACA,EAAe,QAAQ,GAAG;AAAA,EAC3B,CAACA,EAAe,iB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