@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.
@@ -1,42 +1,40 @@
1
- import { jsxs as h, jsx as e } from "react/jsx-runtime";
2
- import w, { forwardRef as L, useRef as u, useState as j, useCallback as d, useImperativeHandle as A, useEffect as I } from "react";
3
- import _ from "../../../../../assets/line-icons/icons/carat-left.js";
4
- import B from "../../../../../assets/line-icons/icons/carat-right.js";
5
- import y from "../../../../ui/buttons/icon-button/icon-button.js";
6
- import b from "../../../../ui/separator/separator.js";
7
- import { Carousel as D, CarouselWrapper as E, CarouselItemContainer as F, ExtendedFlexView as S, Indicator as x } from "./carousel-styled.js";
8
- const H = ({ items: a, defaultIndex: l = 0, onNext: s, onPrev: c, analyticsPrev: f, analyticsNext: p }, R) => {
9
- const C = u(null), i = u(!0), [n, o] = j(l), m = u(
10
- a.map(() => w.createRef())
11
- ), $ = d(() => {
12
- c == null || c(), o((r) => r - 1);
13
- }, [c]), g = d(() => {
14
- s == null || s(), o((r) => r + 1);
15
- }, [s]), k = d((r) => {
16
- o(r);
1
+ import { jsxs as y, jsx as e } from "react/jsx-runtime";
2
+ import { memo as j, forwardRef as x, useMemo as u, useRef as b, useState as z, createRef as B, useCallback as d, useImperativeHandle as D, useEffect as $ } from "react";
3
+ import E from "../../../../../assets/line-icons/icons/carat-left.js";
4
+ import F from "../../../../../assets/line-icons/icons/carat-right.js";
5
+ import R from "../../../../ui/buttons/icon-button/icon-button.js";
6
+ import g from "../../../../ui/separator/separator.js";
7
+ import { Carousel as M, CarouselWrapper as S, CarouselItemContainer as H, ExtendedFlexView as T, Indicator as V } from "./carousel-styled.js";
8
+ const W = ({ items: t, defaultIndex: l = 0, onNext: s, onPrev: c, analyticsPrev: m, analyticsNext: p }, k) => {
9
+ const f = u(() => m, [m]), C = u(() => p, [p]), h = b(null), i = b(!0), [o, n] = z(l), I = u(() => t.map(() => B()), [t]), w = d(() => {
10
+ c == null || c(), n((r) => r - 1);
11
+ }, [c]), A = d(() => {
12
+ s == null || s(), n((r) => r + 1);
13
+ }, [s]), L = d((r) => {
14
+ n(r);
17
15
  }, []);
18
- return A(R, () => ({
19
- nextBtnRef: C,
20
- indicatorRefs: m.current,
21
- currentIndex: n,
16
+ return D(k, () => ({
17
+ nextBtnRef: h,
18
+ indicatorRefs: I,
19
+ currentIndex: o,
22
20
  goToIndex: (r) => {
23
- o(r);
21
+ n(r);
24
22
  }
25
- })), I(() => {
23
+ })), $(() => {
26
24
  i.current && (i.current = !1);
27
- }, []), I(() => {
28
- o(l);
29
- }, [l]), /* @__PURE__ */ h(D, { children: [
25
+ }, []), $(() => {
26
+ n(l);
27
+ }, [l]), /* @__PURE__ */ y(M, { children: [
30
28
  /* @__PURE__ */ e(
31
- E,
29
+ S,
32
30
  {
33
- $translate: n * 100,
31
+ $translate: o * 100,
34
32
  $translateDuration: i.current ? 0 : 300,
35
- children: a.map((r, t) => /* @__PURE__ */ e(F, { children: r }, t))
33
+ children: t.map((r, a) => /* @__PURE__ */ e(H, { children: r }, a))
36
34
  }
37
35
  ),
38
- a.length > 1 && /* @__PURE__ */ h(
39
- S,
36
+ t.length > 1 && /* @__PURE__ */ y(
37
+ T,
40
38
  {
41
39
  $flexDirection: "row",
42
40
  $alignItems: "center",
@@ -44,44 +42,44 @@ const H = ({ items: a, defaultIndex: l = 0, onNext: s, onPrev: c, analyticsPrev:
44
42
  $position: "absolute",
45
43
  children: [
46
44
  /* @__PURE__ */ e(
47
- y,
45
+ R,
48
46
  {
49
47
  renderAs: "secondary",
50
- Icon: _,
51
- onClick: $,
48
+ Icon: E,
49
+ onClick: w,
52
50
  analyticsLabel: f.analyticsLabel,
53
51
  analyticsProps: f.analyticsProps,
54
- disabled: n === 0
52
+ disabled: o === 0
55
53
  }
56
54
  ),
57
- /* @__PURE__ */ e(b, { width: 48 }),
58
- a.map((r, t) => /* @__PURE__ */ e(
59
- x,
55
+ /* @__PURE__ */ e(g, { width: 48 }),
56
+ t.map((r, a) => /* @__PURE__ */ e(
57
+ V,
60
58
  {
61
- ref: m.current[t],
62
- $isActive: t === n,
63
- onClick: () => k(t)
59
+ ref: I[a],
60
+ $isActive: a === o,
61
+ onClick: () => L(a)
64
62
  },
65
- t
63
+ a
66
64
  )),
67
- /* @__PURE__ */ e(b, { width: 48 }),
68
- /* @__PURE__ */ e("div", { ref: C, children: /* @__PURE__ */ e(
69
- y,
65
+ /* @__PURE__ */ e(g, { width: 48 }),
66
+ /* @__PURE__ */ e("div", { ref: h, children: /* @__PURE__ */ e(
67
+ R,
70
68
  {
71
69
  renderAs: "secondary",
72
- Icon: B,
73
- onClick: g,
74
- analyticsLabel: p.analyticsLabel,
75
- analyticsProps: p.analyticsProps,
76
- disabled: n === a.length - 1
70
+ Icon: F,
71
+ onClick: A,
72
+ analyticsLabel: C.analyticsLabel,
73
+ analyticsProps: C.analyticsProps,
74
+ disabled: o === t.length - 1
77
75
  }
78
76
  ) })
79
77
  ]
80
78
  }
81
79
  )
82
80
  ] });
83
- }, J = L(H);
81
+ }, Q = j(x(W));
84
82
  export {
85
- J as Carousel
83
+ Q as Carousel
86
84
  };
87
85
  //# sourceMappingURL=carousel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"carousel.js","sources":["../../../../../../src/features/circle-games/game-launcher/comps/carousel/carousel.tsx"],"sourcesContent":["import type { ICarouselProps, ICarouselRefs } from './carousel-types';\nimport type { ForwardRefRenderFunction } from 'react';\n\nimport React, {\n useCallback,\n useEffect,\n useRef,\n useState,\n forwardRef,\n useImperativeHandle,\n} from 'react';\n\nimport CaratLeftIcon from '../../../../../assets/line-icons/icons/carat-left';\nimport CaratRightIcon from '../../../../../assets/line-icons/icons/carat-right';\nimport IconButton from '../../../../ui/buttons/icon-button/icon-button';\nimport Separator from '../../../../ui/separator/separator';\nimport * as Styled from './carousel-styled';\n\nconst CarouselComponent: ForwardRefRenderFunction<ICarouselRefs, ICarouselProps> = (\n { items, defaultIndex = 0, onNext, onPrev, analyticsPrev, analyticsNext },\n ref,\n) => {\n const nextBtnRef = useRef<HTMLDivElement>(null);\n const isFirstMount = useRef(true);\n const [currIndex, setCurrIndex] = useState(defaultIndex);\n\n // Persistent indicator refs\n const indicatorRefs = useRef<React.RefObject<HTMLDivElement>[]>(\n items.map(() => React.createRef()),\n );\n\n const handleCarouselPrev = useCallback(() => {\n onPrev?.();\n setCurrIndex(prev => prev - 1);\n }, [onPrev]);\n\n const handleCarouselNext = useCallback(() => {\n onNext?.();\n setCurrIndex(prev => prev + 1);\n }, [onNext]);\n\n const handleCarouselIndicatorClick = useCallback((index: number) => {\n setCurrIndex(index);\n }, []);\n\n useImperativeHandle(ref, () => ({\n nextBtnRef,\n indicatorRefs: indicatorRefs.current,\n currentIndex: currIndex,\n goToIndex: (index: number) => {\n setCurrIndex(index);\n },\n }));\n\n useEffect(() => {\n if (isFirstMount.current) {\n isFirstMount.current = false;\n }\n }, []);\n\n // Sync external defaultIndex\n useEffect(() => {\n setCurrIndex(defaultIndex);\n }, [defaultIndex]);\n\n return (\n <Styled.Carousel>\n <Styled.CarouselWrapper\n $translate={currIndex * 100}\n $translateDuration={isFirstMount.current ? 0 : 300}\n >\n {items.map((item, index) => (\n <Styled.CarouselItemContainer key={index}>{item}</Styled.CarouselItemContainer>\n ))}\n </Styled.CarouselWrapper>\n\n {items.length > 1 && (\n <Styled.ExtendedFlexView\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $position=\"absolute\"\n >\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratLeftIcon}\n onClick={handleCarouselPrev}\n analyticsLabel={analyticsPrev.analyticsLabel}\n analyticsProps={analyticsPrev.analyticsProps}\n disabled={currIndex === 0}\n />\n <Separator width={48} />\n {items.map((_, index) => (\n <Styled.Indicator\n ref={indicatorRefs.current[index]}\n $isActive={index === currIndex}\n key={index}\n onClick={() => handleCarouselIndicatorClick(index)}\n />\n ))}\n <Separator width={48} />\n <div ref={nextBtnRef}>\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={handleCarouselNext}\n analyticsLabel={analyticsNext.analyticsLabel}\n analyticsProps={analyticsNext.analyticsProps}\n disabled={currIndex === items.length - 1}\n />\n </div>\n </Styled.ExtendedFlexView>\n )}\n </Styled.Carousel>\n );\n};\n\nexport const Carousel = forwardRef(CarouselComponent);\n"],"names":["CarouselComponent","items","defaultIndex","onNext","onPrev","analyticsPrev","analyticsNext","ref","nextBtnRef","useRef","isFirstMount","currIndex","setCurrIndex","useState","indicatorRefs","React","handleCarouselPrev","useCallback","prev","handleCarouselNext","handleCarouselIndicatorClick","index","useImperativeHandle","useEffect","jsxs","Styled.Carousel","jsx","Styled.CarouselWrapper","item","Styled.CarouselItemContainer","Styled.ExtendedFlexView","IconButton","CaratLeftIcon","Separator","_","Styled.Indicator","CaratRightIcon","Carousel","forwardRef"],"mappings":";;;;;;;AAkBA,MAAMA,IAA6E,CACjF,EAAE,OAAAC,GAAO,cAAAC,IAAe,GAAG,QAAAC,GAAQ,QAAAC,GAAQ,eAAAC,GAAe,eAAAC,EAAc,GACxEC,MACG;AACG,QAAAC,IAAaC,EAAuB,IAAI,GACxCC,IAAeD,EAAO,EAAI,GAC1B,CAACE,GAAWC,CAAY,IAAIC,EAASX,CAAY,GAGjDY,IAAgBL;AAAA,IACpBR,EAAM,IAAI,MAAMc,EAAM,WAAW;AAAA,EAAA,GAG7BC,IAAqBC,EAAY,MAAM;AAClC,IAAAb,KAAA,QAAAA,KACIQ,EAAA,CAAAM,MAAQA,IAAO,CAAC;AAAA,EAAA,GAC5B,CAACd,CAAM,CAAC,GAELe,IAAqBF,EAAY,MAAM;AAClC,IAAAd,KAAA,QAAAA,KACIS,EAAA,CAAAM,MAAQA,IAAO,CAAC;AAAA,EAAA,GAC5B,CAACf,CAAM,CAAC,GAELiB,IAA+BH,EAAY,CAACI,MAAkB;AAClE,IAAAT,EAAaS,CAAK;AAAA,EACpB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AAS,MAAMS,EAA6BC,CAAK;AAAA,YAAA;AAAA,YAD5CA;AAAA,UAAA,CAGR;AAAA,UACD,gBAAAK,EAACO,GAAU,EAAA,OAAO,GAAI,CAAA;AAAA,UACtB,gBAAAP,EAAC,OAAI,EAAA,KAAKlB,GACR,UAAA,gBAAAkB;AAAA,YAACK;AAAA,YAAA;AAAA,cACC,UAAS;AAAA,cACT,MAAMK;AAAA,cACN,SAASjB;AAAA,cACT,gBAAgBb,EAAc;AAAA,cAC9B,gBAAgBA,EAAc;AAAA,cAC9B,UAAUK,MAAcV,EAAM,SAAS;AAAA,YAAA;AAAA,UAAA,GAE3C;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ,EAAA,CAAA;AAEJ,GAEaoC,IAAWC,EAAWtC,CAAiB;"}
1
+ {"version":3,"file":"carousel.js","sources":["../../../../../../src/features/circle-games/game-launcher/comps/carousel/carousel.tsx"],"sourcesContent":["import type { ICarouselProps, ICarouselRefs } from './carousel-types';\nimport type { ForwardRefRenderFunction } from 'react';\n\nimport {\n memo,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n forwardRef,\n useImperativeHandle,\n createRef,\n} from 'react';\n\nimport CaratLeftIcon from '../../../../../assets/line-icons/icons/carat-left';\nimport CaratRightIcon from '../../../../../assets/line-icons/icons/carat-right';\nimport IconButton from '../../../../ui/buttons/icon-button/icon-button';\nimport Separator from '../../../../ui/separator/separator';\nimport * as Styled from './carousel-styled';\n\nconst CarouselComponent: ForwardRefRenderFunction<ICarouselRefs, ICarouselProps> = (\n { items, defaultIndex = 0, onNext, onPrev, analyticsPrev, analyticsNext },\n ref,\n) => {\n const memoizedAnalyticsPrev = useMemo(() => analyticsPrev, [analyticsPrev]);\n const memoizedAnalyticsNext = useMemo(() => analyticsNext, [analyticsNext]);\n\n const nextBtnRef = useRef<HTMLDivElement>(null);\n const isFirstMount = useRef(true);\n const [currIndex, setCurrIndex] = useState(defaultIndex);\n\n // Create a stable array of refs for indicators\n const indicatorRefs = useMemo(() => items.map(() => createRef<HTMLDivElement>()), [items]);\n\n const handleCarouselPrev = useCallback(() => {\n onPrev?.();\n setCurrIndex(prev => prev - 1);\n }, [onPrev]);\n\n const handleCarouselNext = useCallback(() => {\n onNext?.();\n setCurrIndex(prev => prev + 1);\n }, [onNext]);\n\n const handleCarouselIndicatorClick = useCallback((index: number) => {\n setCurrIndex(index);\n }, []);\n\n useImperativeHandle(ref, () => ({\n nextBtnRef,\n indicatorRefs,\n currentIndex: currIndex,\n goToIndex: (index: number) => {\n setCurrIndex(index);\n },\n }));\n\n useEffect(() => {\n if (isFirstMount.current) {\n isFirstMount.current = false;\n }\n }, []);\n\n // Change index from parent\n useEffect(() => {\n setCurrIndex(defaultIndex);\n }, [defaultIndex]);\n\n return (\n <Styled.Carousel>\n <Styled.CarouselWrapper\n $translate={currIndex * 100}\n $translateDuration={isFirstMount.current ? 0 : 300}\n >\n {items.map((item, index) => (\n <Styled.CarouselItemContainer key={index}>{item}</Styled.CarouselItemContainer>\n ))}\n </Styled.CarouselWrapper>\n\n {items.length > 1 && (\n <Styled.ExtendedFlexView\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $position=\"absolute\"\n >\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratLeftIcon}\n onClick={handleCarouselPrev}\n analyticsLabel={memoizedAnalyticsPrev.analyticsLabel}\n analyticsProps={memoizedAnalyticsPrev.analyticsProps}\n disabled={currIndex === 0}\n />\n <Separator width={48} />\n {items.map((_, index) => (\n <Styled.Indicator\n ref={indicatorRefs[index]}\n $isActive={index === currIndex}\n key={index}\n onClick={() => handleCarouselIndicatorClick(index)}\n />\n ))}\n <Separator width={48} />\n <div ref={nextBtnRef}>\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={handleCarouselNext}\n analyticsLabel={memoizedAnalyticsNext.analyticsLabel}\n analyticsProps={memoizedAnalyticsNext.analyticsProps}\n disabled={currIndex === items.length - 1}\n />\n </div>\n </Styled.ExtendedFlexView>\n )}\n </Styled.Carousel>\n );\n};\n\nexport const Carousel = memo(forwardRef(CarouselComponent));\n"],"names":["CarouselComponent","items","defaultIndex","onNext","onPrev","analyticsPrev","analyticsNext","ref","memoizedAnalyticsPrev","useMemo","memoizedAnalyticsNext","nextBtnRef","useRef","isFirstMount","currIndex","setCurrIndex","useState","indicatorRefs","createRef","handleCarouselPrev","useCallback","prev","handleCarouselNext","handleCarouselIndicatorClick","index","useImperativeHandle","useEffect","jsxs","Styled.Carousel","jsx","Styled.CarouselWrapper","item","Styled.CarouselItemContainer","Styled.ExtendedFlexView","IconButton","CaratLeftIcon","Separator","_","Styled.Indicator","CaratRightIcon","Carousel","memo","forwardRef"],"mappings":";;;;;;;AAqBA,MAAMA,IAA6E,CACjF,EAAE,OAAAC,GAAO,cAAAC,IAAe,GAAG,QAAAC,GAAQ,QAAAC,GAAQ,eAAAC,GAAe,eAAAC,EAAc,GACxEC,MACG;AACH,QAAMC,IAAwBC,EAAQ,MAAMJ,GAAe,CAACA,CAAa,CAAC,GACpEK,IAAwBD,EAAQ,MAAMH,GAAe,CAACA,CAAa,CAAC,GAEpEK,IAAaC,EAAuB,IAAI,GACxCC,IAAeD,EAAO,EAAI,GAC1B,CAACE,GAAWC,CAAY,IAAIC,EAASd,CAAY,GAGjDe,IAAgBR,EAAQ,MAAMR,EAAM,IAAI,MAAMiB,GAA2B,GAAG,CAACjB,CAAK,CAAC,GAEnFkB,IAAqBC,EAAY,MAAM;AAClC,IAAAhB,KAAA,QAAAA,KACIW,EAAA,CAAAM,MAAQA,IAAO,CAAC;AAAA,EAAA,GAC5B,CAACjB,CAAM,CAAC,GAELkB,IAAqBF,EAAY,MAAM;AAClC,IAAAjB,KAAA,QAAAA,KACIY,EAAA,CAAAM,MAAQA,IAAO,CAAC;AAAA,EAAA,GAC5B,CAAClB,CAAM,CAAC,GAELoB,IAA+BH,EAAY,CAACI,MAAkB;AAClE,IAAAT,EAAaS,CAA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AAS,MAAMS,EAA6BC,CAAK;AAAA,YAAA;AAAA,YAD5CA;AAAA,UAAA,CAGR;AAAA,UACD,gBAAAK,EAACO,GAAU,EAAA,OAAO,GAAI,CAAA;AAAA,UACtB,gBAAAP,EAAC,OAAI,EAAA,KAAKlB,GACR,UAAA,gBAAAkB;AAAA,YAACK;AAAA,YAAA;AAAA,cACC,UAAS;AAAA,cACT,MAAMK;AAAA,cACN,SAASjB;AAAA,cACT,gBAAgBZ,EAAsB;AAAA,cACtC,gBAAgBA,EAAsB;AAAA,cACtC,UAAUI,MAAcb,EAAM,SAAS;AAAA,YAAA;AAAA,UAAA,GAE3C;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ,EAAA,CAAA;AAEJ,GAEauC,IAAWC,EAAKC,EAAW1C,CAAiB,CAAC;"}
@@ -1,69 +1,62 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
- import { memo as J, useRef as v, useCallback as n, useMemo as P, useEffect as x } from "react";
2
+ import { memo as O, useRef as g, useCallback as n, useMemo as h, useEffect as x } from "react";
3
3
  import { LOTTIE as D } from "../../../assets/lottie/lottie.js";
4
- import { JOURNEY_ID_STUDENT as h } from "../../journey/journey-id/journey-id-student.js";
5
- import { CircularLoader as U } from "../../ui/loader/circular-loader/circular-loader.js";
6
- import Y from "../../ui/lottie-animation/lottie-animation.js";
7
- import { useCircleSounds as B } from "../hooks/use-circle-sounds/use-circle-sounds.js";
4
+ import { JOURNEY_ID_STUDENT as z } from "../../journey/journey-id/journey-id-student.js";
5
+ import { useJourney as U } from "../../journey/use-journey/use-journey.js";
6
+ import { CircularLoader as Y } from "../../ui/loader/circular-loader/circular-loader.js";
7
+ import B from "../../ui/lottie-animation/lottie-animation.js";
8
+ import { useCircleSounds as K } from "../hooks/use-circle-sounds/use-circle-sounds.js";
8
9
  import { CircleSoundKey as u } from "../hooks/use-circle-sounds/use-circle-sounds-enums.js";
9
- import { GAME_LAUNCHER_SIZE as K } from "./comps/card-container/constants.js";
10
- import { Carousel as z } from "./comps/carousel/carousel.js";
11
- import { GAME_LAUNCHER_ASSET_PADDING as H } from "./comps/segmented-game-card/constants.js";
12
- import { SegmentedGameCard as a } from "./comps/segmented-game-card/segmented-game-card.js";
13
- import { TablesCard as Z } from "./comps/tables-card/tables-card.js";
14
- import { GAME_LAUNCHER_ANALYTICS_EVENTS as G } from "./game-launcher-analytics-events.js";
15
- import { useGameLauncherJourney as w } from "./hooks/use-game-launcher-journey/use-game-launcher-journey.js";
16
- import { useTableLauncherJourney as X } from "./hooks/use-table-launcher-journey/use-table-launcher-journey.js";
10
+ import { GAME_LAUNCHER_SIZE as H } from "./comps/card-container/constants.js";
11
+ import { Carousel as G } from "./comps/carousel/carousel.js";
12
+ import { GAME_LAUNCHER_ASSET_PADDING as Z } from "./comps/segmented-game-card/constants.js";
13
+ import { SegmentedGameCard as E } from "./comps/segmented-game-card/segmented-game-card.js";
14
+ import { TablesCard as w } from "./comps/tables-card/tables-card.js";
15
+ import { GAME_LAUNCHER_ANALYTICS_EVENTS as V } from "./game-launcher-analytics-events.js";
16
+ import { useGameLauncherJourney as X } from "./hooks/use-game-launcher-journey/use-game-launcher-journey.js";
17
+ import { useTableLauncherJourney as q } from "./hooks/use-table-launcher-journey/use-table-launcher-journey.js";
17
18
  import { ProjectType as f } from "../games/web-view/enums/project-type-enum.js";
18
- const S = K + H, ue = J(
19
- ({
20
- onSegmentClick: r,
21
- journeyId: m,
22
- data: e,
23
- isLoading: c,
24
- isError: V,
25
- isTutorialOnboardingDone: E,
26
- defaultIndex: M = 0
27
- }) => {
28
- const t = v(null), { playSwipSound: T, play: o } = B(), p = n(
19
+ const S = H + Z, pe = O(
20
+ ({ onSegmentClick: r, journeyId: m, data: e, isLoading: p, isTutorialOnboardingDone: a, defaultIndex: J = 0 }) => {
21
+ const t = g(null), { isJourneyActive: C } = U(), { playSwipSound: L, play: o } = K(), c = n(
29
22
  (l) => {
30
23
  o(u.GAME_CARD_CLICK), r(l, f.TABLE);
31
24
  },
32
25
  [r, o]
33
- ), C = n(
26
+ ), _ = n(
34
27
  (l) => {
35
28
  l.status !== "completed" && (o(u.GAME_CARD_CLICK), r(l, f.LESSON));
36
29
  },
37
30
  [r, o]
38
- ), L = n(
31
+ ), A = n(
39
32
  (l) => {
40
33
  o(u.GAME_CARD_CLICK), r(l, f.GAME);
41
34
  },
42
35
  [r, o]
43
- ), A = n(
36
+ ), b = n(
44
37
  (l) => {
45
38
  o(u.GAME_CARD_CLICK), r(l, f.PUZZLE);
46
39
  },
47
40
  [r, o]
48
41
  ), {
49
- gameRefs: _,
50
- lessonRefs: R,
51
- puzzleRefs: b,
42
+ gameRefs: T,
43
+ lessonRefs: y,
44
+ puzzleRefs: R,
52
45
  startJourney: I
53
- } = w({
46
+ } = X({
54
47
  carouselRefs: t,
55
48
  onSegmentClick: r
56
- }), { startJourney: y, tableRef: N } = X({
49
+ }), { startJourney: P, tableRef: N } = q({
57
50
  carouselRefs: t,
58
- onTableSegmentClick: p
59
- }), g = P(() => {
51
+ onTableSegmentClick: c
52
+ }), M = h(() => {
60
53
  let l = [];
61
54
  return e && (e.lessons && (l = [
62
55
  ...l,
63
56
  /* @__PURE__ */ i(
64
- a,
57
+ E,
65
58
  {
66
- ref: R,
59
+ ref: y,
67
60
  label: e.lessons.label,
68
61
  value: e.lessons.data.filter((s) => s.status === "completed").length,
69
62
  maxValue: e.lessons.data.length,
@@ -72,16 +65,16 @@ const S = K + H, ue = J(
72
65
  card: s.cardLottie,
73
66
  name: s.name,
74
67
  isCompleted: s.status === "completed",
75
- onPress: () => C(s)
68
+ onPress: () => _(s)
76
69
  }))
77
70
  }
78
71
  )
79
72
  ]), l = [
80
73
  ...l,
81
74
  /* @__PURE__ */ i(
82
- a,
75
+ E,
83
76
  {
84
- ref: _,
77
+ ref: T,
85
78
  label: e.games.label,
86
79
  value: e.games.data.filter((s) => s.isPlayed).length,
87
80
  maxValue: e.games.data.length,
@@ -90,14 +83,14 @@ const S = K + H, ue = J(
90
83
  card: s.cardLottie,
91
84
  name: s.name,
92
85
  isCompleted: !1,
93
- onPress: () => L(s)
86
+ onPress: () => A(s)
94
87
  }))
95
88
  }
96
89
  ),
97
90
  /* @__PURE__ */ i(
98
- a,
91
+ E,
99
92
  {
100
- ref: b,
93
+ ref: R,
101
94
  label: e.puzzles.label,
102
95
  value: e.puzzles.data.filter((s) => s.solved).length,
103
96
  maxValue: e.puzzles.data.length,
@@ -106,37 +99,37 @@ const S = K + H, ue = J(
106
99
  card: s.cardLottie,
107
100
  name: s.name,
108
101
  isCompleted: s.solved,
109
- onPress: () => A(s)
102
+ onPress: () => b(s)
110
103
  }))
111
104
  }
112
105
  )
113
106
  ], e.tables && (l = [
114
107
  ...l,
115
108
  /* @__PURE__ */ i(
116
- Z,
109
+ w,
117
110
  {
118
111
  ref: N,
119
112
  label: e.tables.label,
120
113
  data: e.tables.data,
121
- onPress: p,
114
+ onPress: c,
122
115
  openModesOfTable: e.tables.openModesOfTable
123
116
  }
124
117
  )
125
118
  ])), l;
126
119
  }, [
127
120
  e,
128
- _,
129
- b,
121
+ T,
130
122
  R,
131
- C,
132
- L,
123
+ y,
124
+ _,
133
125
  A,
126
+ b,
134
127
  N,
135
- p
136
- ]), O = P(
128
+ c
129
+ ]), v = h(
137
130
  () => [
138
131
  /* @__PURE__ */ i(
139
- Y,
132
+ B,
140
133
  {
141
134
  src: D.SLEEPY_BOI,
142
135
  width: S,
@@ -147,51 +140,52 @@ const S = K + H, ue = J(
147
140
  []
148
141
  );
149
142
  return x(() => {
150
- var l, s;
151
- if (!(c || !e)) {
152
- if (e != null && e.puzzles && m === h.CIRCLE_ACTIVITIES_INTRO_JOURNEY) {
153
- console.log("INTRO START", (l = t.current) == null ? void 0 : l.indicatorRefs), I(e == null ? void 0 : e.puzzles, !!(e != null && e.lessons), m);
143
+ if (!(p || !e || C)) {
144
+ if (e != null && e.puzzles && m === z.CIRCLE_ACTIVITIES_INTRO_JOURNEY) {
145
+ I(e == null ? void 0 : e.puzzles, !!(e != null && e.lessons), m);
154
146
  return;
155
147
  }
156
- e != null && e.tables && m === h.CIRCLE_TABLES_INTRO_JOURNEY && (console.log("TABLE START", (s = t.current) == null ? void 0 : s.indicatorRefs), y(e == null ? void 0 : e.tables, E));
148
+ e != null && e.tables && m === z.CIRCLE_TABLES_INTRO_JOURNEY && P(e == null ? void 0 : e.tables, a);
157
149
  }
158
150
  }, [
159
151
  e,
160
- c,
161
- E,
152
+ C,
153
+ p,
154
+ a,
162
155
  m,
163
156
  I,
164
- y
165
- ]), c ? /* @__PURE__ */ i(U, {}) : V ? /* @__PURE__ */ i(
166
- z,
157
+ P
158
+ ]), p ? /* @__PURE__ */ i(Y, {}) : e ? /* @__PURE__ */ i(
159
+ G,
167
160
  {
168
- items: O,
161
+ ref: t,
162
+ items: M,
163
+ defaultIndex: J,
164
+ onNext: L,
165
+ onPrev: L,
169
166
  analyticsNext: {
170
- analyticsLabel: ""
167
+ analyticsLabel: V.NEXT_ACTIVITY
171
168
  },
172
169
  analyticsPrev: {
173
- analyticsLabel: ""
170
+ analyticsLabel: V.PREV_ACTIVITY
174
171
  }
175
172
  }
176
173
  ) : /* @__PURE__ */ i(
177
- z,
174
+ G,
178
175
  {
179
176
  ref: t,
180
- items: g,
181
- defaultIndex: M,
182
- onNext: T,
183
- onPrev: T,
177
+ items: v,
184
178
  analyticsNext: {
185
- analyticsLabel: G.NEXT_ACTIVITY
179
+ analyticsLabel: ""
186
180
  },
187
181
  analyticsPrev: {
188
- analyticsLabel: G.PREV_ACTIVITY
182
+ analyticsLabel: ""
189
183
  }
190
184
  }
191
185
  );
192
186
  }
193
187
  );
194
188
  export {
195
- ue as GameLauncher
189
+ pe as GameLauncher
196
190
  };
197
191
  //# sourceMappingURL=game-launcher.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"game-launcher.js","sources":["../../../../src/features/circle-games/game-launcher/game-launcher.tsx"],"sourcesContent":["import type { ICarouselRefs } from './comps/carousel/carousel-types';\nimport type { ITableDetails } from './comps/tables-card/tables-card-types';\nimport type {\n Game,\n Lesson,\n Puzzle,\n} from './dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport type { IGameLauncherProps } from './game-launcher-types';\nimport type { FC, ReactNode } from 'react';\n\nimport { memo, useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport { LOTTIE } from '../../../assets/lottie/lottie';\nimport { JOURNEY_ID_STUDENT } from '../../journey/journey-id/journey-id-student';\nimport { CircularLoader } from '../../ui/loader/circular-loader/circular-loader';\nimport LottieAnimation from '../../ui/lottie-animation/lottie-animation';\nimport { ProjectType } from '../games/web-view/enums';\nimport { useCircleSounds } from '../hooks/use-circle-sounds/use-circle-sounds';\nimport { CircleSoundKey } from '../hooks/use-circle-sounds/use-circle-sounds-enums';\nimport { GAME_LAUNCHER_SIZE } from './comps/card-container/constants';\nimport { Carousel } from './comps/carousel/carousel';\nimport { GAME_LAUNCHER_ASSET_PADDING } from './comps/segmented-game-card/constants';\nimport { SegmentedGameCard } from './comps/segmented-game-card/segmented-game-card';\nimport { TablesCard } from './comps/tables-card/tables-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from './game-launcher-analytics-events';\nimport { useGameLauncherJourney } from './hooks/use-game-launcher-journey/use-game-launcher-journey';\nimport { useTableLauncherJourney } from './hooks/use-table-launcher-journey/use-table-launcher-journey';\n\nconst sleepyBoiDimension = GAME_LAUNCHER_SIZE + GAME_LAUNCHER_ASSET_PADDING;\n\nexport const GameLauncher: FC<IGameLauncherProps> = memo(\n ({\n onSegmentClick,\n journeyId,\n data,\n isLoading,\n isError,\n isTutorialOnboardingDone,\n defaultIndex = 0,\n }) => {\n const carouselRefs = useRef<ICarouselRefs>(null);\n\n const { playSwipSound, play } = useCircleSounds();\n\n const onTableSegmentClick = useCallback(\n (table: ITableDetails) => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(table, ProjectType.TABLE);\n },\n [onSegmentClick, play],\n );\n\n const handleLessonSegmentClick = useCallback(\n (lesson: Lesson) => {\n if (lesson.status !== 'completed') {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(lesson, ProjectType.LESSON);\n }\n },\n [onSegmentClick, play],\n );\n\n const handleGameSegmentClick = useCallback(\n (game: Game) => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(game, ProjectType.GAME);\n },\n [onSegmentClick, play],\n );\n\n const handlePuzzleSegmentClick = useCallback(\n (puzzle: Puzzle) => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(puzzle, ProjectType.PUZZLE);\n },\n [onSegmentClick, play],\n );\n\n const {\n gameRefs,\n lessonRefs,\n puzzleRefs,\n startJourney: startLessonPuzzleGamesJourney,\n } = useGameLauncherJourney({\n carouselRefs,\n onSegmentClick,\n });\n\n const { startJourney: startTablesJourney, tableRef } = useTableLauncherJourney({\n carouselRefs,\n onTableSegmentClick,\n });\n\n const items = useMemo(() => {\n let itemTypes: ReactNode[] = [];\n\n if (data) {\n if (data.lessons) {\n itemTypes = [\n ...itemTypes,\n <SegmentedGameCard\n ref={lessonRefs}\n label={data.lessons.label}\n value={data.lessons.data.filter(lesson => lesson.status === 'completed').length}\n maxValue={data.lessons.data.length}\n initialValue={data.lessons.initialProgressValue}\n data={data?.lessons.data.map(lesson => ({\n card: lesson.cardLottie,\n name: lesson.name,\n isCompleted: lesson.status === 'completed',\n onPress: () => handleLessonSegmentClick(lesson),\n }))}\n />,\n ];\n }\n\n itemTypes = [\n ...itemTypes,\n <SegmentedGameCard\n ref={gameRefs}\n label={data.games.label}\n value={data.games.data.filter(game => game.isPlayed).length}\n maxValue={data.games.data.length}\n initialValue={data.games.initialProgressValue}\n data={data.games.data.map(game => ({\n card: game.cardLottie,\n name: game.name,\n isCompleted: false,\n onPress: () => handleGameSegmentClick(game),\n }))}\n />,\n <SegmentedGameCard\n ref={puzzleRefs}\n label={data.puzzles.label}\n value={data.puzzles.data.filter(puzzle => puzzle.solved).length}\n maxValue={data.puzzles.data.length}\n initialValue={data.puzzles.initialProgressValue}\n data={data.puzzles.data.map(puzzle => ({\n card: puzzle.cardLottie,\n name: puzzle.name,\n isCompleted: puzzle.solved,\n onPress: () => handlePuzzleSegmentClick(puzzle),\n }))}\n />,\n ];\n\n if (data.tables) {\n itemTypes = [\n ...itemTypes,\n <TablesCard\n ref={tableRef}\n label={data.tables.label}\n data={data.tables.data}\n onPress={onTableSegmentClick}\n openModesOfTable={data.tables.openModesOfTable}\n />,\n ];\n }\n }\n\n return itemTypes;\n }, [\n data,\n gameRefs,\n puzzleRefs,\n lessonRefs,\n handleLessonSegmentClick,\n handleGameSegmentClick,\n handlePuzzleSegmentClick,\n tableRef,\n onTableSegmentClick,\n ]);\n\n const sleepyBoiItem = useMemo(\n () => [\n <LottieAnimation\n src={LOTTIE.SLEEPY_BOI}\n width={sleepyBoiDimension}\n height={sleepyBoiDimension}\n />,\n ],\n [],\n );\n\n // Start game launcher journey only when isLoading has become false and data is available\n useEffect(() => {\n if (isLoading || !data) {\n return;\n }\n\n if (data?.puzzles && journeyId === JOURNEY_ID_STUDENT.CIRCLE_ACTIVITIES_INTRO_JOURNEY) {\n console.log('INTRO START', carouselRefs.current?.indicatorRefs);\n startLessonPuzzleGamesJourney(data?.puzzles, !!data?.lessons, journeyId);\n\n return; // CIRCLE_ACTIVITIES_INTRO_JOURNEY has higher priority\n }\n\n if (data?.tables && journeyId === JOURNEY_ID_STUDENT.CIRCLE_TABLES_INTRO_JOURNEY) {\n console.log('TABLE START', carouselRefs.current?.indicatorRefs);\n startTablesJourney(data?.tables, isTutorialOnboardingDone);\n }\n }, [\n data,\n isLoading,\n isTutorialOnboardingDone,\n journeyId,\n startLessonPuzzleGamesJourney,\n startTablesJourney,\n ]);\n\n if (isLoading) {\n return <CircularLoader />;\n }\n\n if (isError) {\n return (\n <Carousel\n items={sleepyBoiItem}\n analyticsNext={{\n analyticsLabel: '',\n }}\n analyticsPrev={{\n analyticsLabel: '',\n }}\n />\n );\n }\n\n return (\n <Carousel\n ref={carouselRefs}\n items={items}\n defaultIndex={defaultIndex}\n onNext={playSwipSound}\n onPrev={playSwipSound}\n analyticsNext={{\n analyticsLabel: GAME_LAUNCHER_ANALYTICS_EVENTS.NEXT_ACTIVITY,\n }}\n analyticsPrev={{\n analyticsLabel: GAME_LAUNCHER_ANALYTICS_EVENTS.PREV_ACTIVITY,\n }}\n />\n );\n },\n);\n"],"names":["sleepyBoiDimension","GAME_LAUNCHER_SIZE","GAME_LAUNCHER_ASSET_PADDING","GameLauncher","memo","onSegmentClick","journeyId","data","isLoading","isError","isTutorialOnboardingDone","defaultIndex","carouselRefs","useRef","playSwipSound","play","useCircleSounds","onTableSegmentClick","useCallback","table","CircleSoundKey","ProjectType","handleLessonSegmentClick","lesson","handleGameSegmentClick","game","handlePuzzleSegmentClick","puzzle","gameRefs","lessonRefs","puzzleRefs","startLessonPuzzleGamesJourney","useGameLauncherJourney","startTablesJourney","tableRef","useTableLauncherJourney","items","useMemo","itemTypes","jsx","SegmentedGameCard","TablesCard","sleepyBoiItem","LottieAnimation","LOTTIE","useEffect","JOURNEY_ID_STUDENT","_a","_b","CircularLoader","Carousel","GAME_LAUNCHER_ANALYTICS_EVENTS"],"mappings":";;;;;;;;;;;;;;;;;AA4BA,MAAMA,IAAqBC,IAAqBC,GAEnCC,KAAuCC;AAAA,EAClD,CAAC;AAAA,IACC,gBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,MAAAC;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,cAAAC,IAAe;AAAA,EAAA,MACX;AACE,UAAAC,IAAeC,EAAsB,IAAI,GAEzC,EAAE,eAAAC,GAAe,MAAAC,EAAK,IAAIC,EAAgB,GAE1CC,IAAsBC;AAAA,MAC1B,CAACC,MAAyB;AACxB,QAAAJ,EAAKK,EAAe,eAAe,GACpBf,EAAAc,GAAOE,EAAY,KAAK;AAAA,MACzC;AAAA,MACA,CAAChB,GAAgBU,CAAI;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A,QACP,eAAe;AAAA,UACb,gBAAgB;AAAA,QAClB;AAAA,QACA,eAAe;AAAA,UACb,gBAAgB;AAAA,QAClB;AAAA,MAAA;AAAA,IAAA,IAMJ,gBAAAH;AAAA,MAACW;AAAA,MAAA;AAAA,QACC,KAAKtC;AAAA,QACL,OAAAwB;AAAA,QACA,cAAAzB;AAAA,QACA,QAAQG;AAAA,QACR,QAAQA;AAAA,QACR,eAAe;AAAA,UACb,gBAAgBqC,EAA+B;AAAA,QACjD;AAAA,QACA,eAAe;AAAA,UACb,gBAAgBA,EAA+B;AAAA,QACjD;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;"}
1
+ {"version":3,"file":"game-launcher.js","sources":["../../../../src/features/circle-games/game-launcher/game-launcher.tsx"],"sourcesContent":["import type { ICarouselRefs } from './comps/carousel/carousel-types';\nimport type { ITableDetails } from './comps/tables-card/tables-card-types';\nimport type {\n Game,\n Lesson,\n Puzzle,\n} from './dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport type { IGameLauncherProps } from './game-launcher-types';\nimport type { FC, ReactNode } from 'react';\n\nimport { memo, useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport { LOTTIE } from '../../../assets/lottie/lottie';\nimport { JOURNEY_ID_STUDENT } from '../../journey/journey-id/journey-id-student';\nimport { useJourney } from '../../journey/use-journey/use-journey';\nimport { CircularLoader } from '../../ui/loader/circular-loader/circular-loader';\nimport LottieAnimation from '../../ui/lottie-animation/lottie-animation';\nimport { ProjectType } from '../games/web-view/enums';\nimport { useCircleSounds } from '../hooks/use-circle-sounds/use-circle-sounds';\nimport { CircleSoundKey } from '../hooks/use-circle-sounds/use-circle-sounds-enums';\nimport { GAME_LAUNCHER_SIZE } from './comps/card-container/constants';\nimport { Carousel } from './comps/carousel/carousel';\nimport { GAME_LAUNCHER_ASSET_PADDING } from './comps/segmented-game-card/constants';\nimport { SegmentedGameCard } from './comps/segmented-game-card/segmented-game-card';\nimport { TablesCard } from './comps/tables-card/tables-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from './game-launcher-analytics-events';\nimport { useGameLauncherJourney } from './hooks/use-game-launcher-journey/use-game-launcher-journey';\nimport { useTableLauncherJourney } from './hooks/use-table-launcher-journey/use-table-launcher-journey';\n\nconst sleepyBoiDimension = GAME_LAUNCHER_SIZE + GAME_LAUNCHER_ASSET_PADDING;\n\nexport const GameLauncher: FC<IGameLauncherProps> = memo(\n ({ onSegmentClick, journeyId, data, isLoading, isTutorialOnboardingDone, defaultIndex = 0 }) => {\n const carouselRefs = useRef<ICarouselRefs>(null);\n\n const { isJourneyActive } = useJourney();\n\n const { playSwipSound, play } = useCircleSounds();\n\n const onTableSegmentClick = useCallback(\n (table: ITableDetails) => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(table, ProjectType.TABLE);\n },\n [onSegmentClick, play],\n );\n\n const handleLessonSegmentClick = useCallback(\n (lesson: Lesson) => {\n if (lesson.status !== 'completed') {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(lesson, ProjectType.LESSON);\n }\n },\n [onSegmentClick, play],\n );\n\n const handleGameSegmentClick = useCallback(\n (game: Game) => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(game, ProjectType.GAME);\n },\n [onSegmentClick, play],\n );\n\n const handlePuzzleSegmentClick = useCallback(\n (puzzle: Puzzle) => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(puzzle, ProjectType.PUZZLE);\n },\n [onSegmentClick, play],\n );\n\n const {\n gameRefs,\n lessonRefs,\n puzzleRefs,\n startJourney: startLessonPuzzleGamesJourney,\n } = useGameLauncherJourney({\n carouselRefs,\n onSegmentClick,\n });\n\n const { startJourney: startTablesJourney, tableRef } = useTableLauncherJourney({\n carouselRefs,\n onTableSegmentClick,\n });\n\n const items = useMemo(() => {\n let itemTypes: ReactNode[] = [];\n\n if (data) {\n if (data.lessons) {\n itemTypes = [\n ...itemTypes,\n <SegmentedGameCard\n ref={lessonRefs}\n label={data.lessons.label}\n value={data.lessons.data.filter(lesson => lesson.status === 'completed').length}\n maxValue={data.lessons.data.length}\n initialValue={data.lessons.initialProgressValue}\n data={data?.lessons.data.map(lesson => ({\n card: lesson.cardLottie,\n name: lesson.name,\n isCompleted: lesson.status === 'completed',\n onPress: () => handleLessonSegmentClick(lesson),\n }))}\n />,\n ];\n }\n\n itemTypes = [\n ...itemTypes,\n <SegmentedGameCard\n ref={gameRefs}\n label={data.games.label}\n value={data.games.data.filter(game => game.isPlayed).length}\n maxValue={data.games.data.length}\n initialValue={data.games.initialProgressValue}\n data={data.games.data.map(game => ({\n card: game.cardLottie,\n name: game.name,\n isCompleted: false,\n onPress: () => handleGameSegmentClick(game),\n }))}\n />,\n <SegmentedGameCard\n ref={puzzleRefs}\n label={data.puzzles.label}\n value={data.puzzles.data.filter(puzzle => puzzle.solved).length}\n maxValue={data.puzzles.data.length}\n initialValue={data.puzzles.initialProgressValue}\n data={data.puzzles.data.map(puzzle => ({\n card: puzzle.cardLottie,\n name: puzzle.name,\n isCompleted: puzzle.solved,\n onPress: () => handlePuzzleSegmentClick(puzzle),\n }))}\n />,\n ];\n\n if (data.tables) {\n itemTypes = [\n ...itemTypes,\n <TablesCard\n ref={tableRef}\n label={data.tables.label}\n data={data.tables.data}\n onPress={onTableSegmentClick}\n openModesOfTable={data.tables.openModesOfTable}\n />,\n ];\n }\n }\n\n return itemTypes;\n }, [\n data,\n gameRefs,\n puzzleRefs,\n lessonRefs,\n handleLessonSegmentClick,\n handleGameSegmentClick,\n handlePuzzleSegmentClick,\n tableRef,\n onTableSegmentClick,\n ]);\n\n const sleepyBoiItem = useMemo(\n () => [\n <LottieAnimation\n src={LOTTIE.SLEEPY_BOI}\n width={sleepyBoiDimension}\n height={sleepyBoiDimension}\n />,\n ],\n [],\n );\n\n // Start game launcher journey only when isLoading has become false and data is available\n useEffect(() => {\n if (isLoading || !data || isJourneyActive) {\n return;\n }\n\n if (data?.puzzles && journeyId === JOURNEY_ID_STUDENT.CIRCLE_ACTIVITIES_INTRO_JOURNEY) {\n startLessonPuzzleGamesJourney(data?.puzzles, !!data?.lessons, journeyId);\n\n return; // CIRCLE_ACTIVITIES_INTRO_JOURNEY has higher priority\n }\n\n if (data?.tables && journeyId === JOURNEY_ID_STUDENT.CIRCLE_TABLES_INTRO_JOURNEY) {\n startTablesJourney(data?.tables, isTutorialOnboardingDone);\n }\n }, [\n data,\n isJourneyActive,\n isLoading,\n isTutorialOnboardingDone,\n journeyId,\n startLessonPuzzleGamesJourney,\n startTablesJourney,\n ]);\n\n if (isLoading) {\n return <CircularLoader />;\n }\n\n if (!data) {\n return (\n <Carousel\n ref={carouselRefs}\n items={sleepyBoiItem}\n analyticsNext={{\n analyticsLabel: '',\n }}\n analyticsPrev={{\n analyticsLabel: '',\n }}\n />\n );\n }\n\n return (\n <Carousel\n ref={carouselRefs}\n items={items}\n defaultIndex={defaultIndex}\n onNext={playSwipSound}\n onPrev={playSwipSound}\n analyticsNext={{\n analyticsLabel: GAME_LAUNCHER_ANALYTICS_EVENTS.NEXT_ACTIVITY,\n }}\n analyticsPrev={{\n analyticsLabel: GAME_LAUNCHER_ANALYTICS_EVENTS.PREV_ACTIVITY,\n }}\n />\n );\n },\n);\n"],"names":["sleepyBoiDimension","GAME_LAUNCHER_SIZE","GAME_LAUNCHER_ASSET_PADDING","GameLauncher","memo","onSegmentClick","journeyId","data","isLoading","isTutorialOnboardingDone","defaultIndex","carouselRefs","useRef","isJourneyActive","useJourney","playSwipSound","play","useCircleSounds","onTableSegmentClick","useCallback","table","CircleSoundKey","ProjectType","handleLessonSegmentClick","lesson","handleGameSegmentClick","game","handlePuzzleSegmentClick","puzzle","gameRefs","lessonRefs","puzzleRefs","startLessonPuzzleGamesJourney","useGameLauncherJourney","startTablesJourney","tableRef","useTableLauncherJourney","items","useMemo","itemTypes","jsx","SegmentedGameCard","TablesCard","sleepyBoiItem","LottieAnimation","LOTTIE","useEffect","JOURNEY_ID_STU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