@cuemath/leap 2.8.62-rj-0 → 2.8.62-rj-3

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(() => {\n return items.map(() => createRef<HTMLDivElement>());\n }, [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,MACrBR,EAAM,IAAI,MAAMiB,EAA2B,CAAA,GACjD,CAACjB,CAAK,CAAC,GAEJkB,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,IAAA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AAAA,cAErB,SAAS,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,G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C,OAAOR;AAAA,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","J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AAM,SAAS,CAAC,EAACA,KAAA,QAAAA,EAAM,UAASD,CAAS;AAEvE;AAAA,QACF;AAEA,QAAIC,KAAA,QAAAA,EAAM,UAAUD,MAAcyC,EAAmB,+BAChCb,EAAA3B,KAAA,gBAAAA,EAAM,QAAQE,CAAwB;AAAA;AAAA,IAC3D,GACC;AAAA,MACDF;AAAA,MACAM;AAAA,MACAL;AAAA,MACAC;AAAA,MACAH;AAAA,MACA0B;AAAA,MACAE;AAAA,IAAA,CACD,GAEG1B,sBACMwC,GAAe,CAAA,CAAA,IAGpBzC,IAgBH,gBAAAiC;AAAA,MAACS;AAAA,MAAA;AAAA,QACC,KAAKtC;AAAA,QACL,OAAA0B;AAAA,QACA,cAAA3B;AAAA,QACA,QAAQK;AAAA,QACR,QAAQA;AAAA,QACR,eAAe;AAAA,UACb,gBAAgBmC,EAA+B;AAAA,QACjD;AAAA,QACA,eAAe;AAAA,UACb,gBAAgBA,EAA+B;AAAA,QACjD;AAAA,MAAA;AAAA,IAAA,IAzBA,gBAAAV;AAAA,MAACS;AAAA,MAAA;AAAA,QACC,KAAKtC;AAAA,QACL,OAAOgC;AAAA,QACP,eAAe;AAAA,UACb,gBAAgB;AAAA,QAClB;AAAA,QACA,eAAe;AAAA,UACb,gBAAgB;AAAA,QAClB;AAAA,MAAA;AAAA,IAAA;AAAA,EAoBR;AACF;"}
@@ -1,122 +1,116 @@
1
- import { jsx as r, Fragment as R } from "react/jsx-runtime";
2
- import { useRef as A, useCallback as C, useEffect as V } from "react";
3
- import X from "../../../../../assets/line-icons/icons/carat-right.js";
4
- import { PLATFORM_EVENTS_STUDENT as G } from "../../../../analytics-events/platform-events-student.js";
5
- import { JOURNEY_ID_STUDENT as K } from "../../../../journey/journey-id/journey-id-student.js";
6
- import { IndicatorType as d } from "../../../../journey/use-journey/constants.js";
7
- import { useJourney as j } from "../../../../journey/use-journey/use-journey.js";
8
- import Z from "../../../../ui/buttons/icon-button/icon-button.js";
9
- import { useUIContext as q } from "../../../../ui/context/context.js";
10
- import N from "../../../../ui/layout/flex-view.js";
1
+ import { jsx as r, Fragment as L } from "react/jsx-runtime";
2
+ import { useRef as I, useCallback as p, useEffect as M } from "react";
3
+ import $ from "../../../../../assets/line-icons/icons/carat-right.js";
4
+ import { PLATFORM_EVENTS_STUDENT as D } from "../../../../analytics-events/platform-events-student.js";
5
+ import { JOURNEY_ID_STUDENT as x } from "../../../../journey/journey-id/journey-id-student.js";
6
+ import { IndicatorType as s } from "../../../../journey/use-journey/constants.js";
7
+ import { useJourney as w } from "../../../../journey/use-journey/use-journey.js";
8
+ import F from "../../../../ui/buttons/icon-button/icon-button.js";
9
+ import { useUIContext as J } from "../../../../ui/context/context.js";
10
+ import O from "../../../../ui/layout/flex-view.js";
11
11
  import m from "../../../../ui/text/text.js";
12
- import { CIRCLE_ONBOARDING_ANALYTICS_STEPS as v } from "../../../enum/circle-onboarding-steps.js";
13
- import { useCircleSounds as z } from "../../../hooks/use-circle-sounds/use-circle-sounds.js";
14
- import { TablesCard as M } from "../../comps/tables-card/tables-card.js";
15
- import { GAME_LAUNCHER_ANALYTICS_EVENTS as Q } from "../../game-launcher-analytics-events.js";
16
- import { SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS as ee, SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS as te, START_ANIMATING_CLONED_ELEM as $, TABLE_CARD_INDEX as x, GO_TO_TABLE_LAUNCHER_DURATION_MS as re, SHOW_CLICK_TABLE_NUDGE_AFTER_MS as ne, PUZZLE_CARD_INDEX as oe, SHOW_INITIAL_COACHMARK_AFTER_MS as J, LESSON_CARD_INDEX as ie, SHOW_INITIAL_TOOLTIP_AFTER_MS as le } from "./constants.js";
17
- import { Indicator as ce } from "./use-table-launcher-journey-styled.js";
18
- const Oe = ({
12
+ import { CIRCLE_ONBOARDING_ANALYTICS_STEPS as W } from "../../../enum/circle-onboarding-steps.js";
13
+ import { useCircleSounds as V } from "../../../hooks/use-circle-sounds/use-circle-sounds.js";
14
+ import { TablesCard as Y } from "../../comps/tables-card/tables-card.js";
15
+ import { GAME_LAUNCHER_ANALYTICS_EVENTS as X } from "../../game-launcher-analytics-events.js";
16
+ import { SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS as K, SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS as j, START_ANIMATING_CLONED_ELEM as k, TABLE_CARD_INDEX as B, GO_TO_TABLE_LAUNCHER_DURATION_MS as Z, SHOW_CLICK_TABLE_NUDGE_AFTER_MS as q, PUZZLE_CARD_INDEX as z, SHOW_INITIAL_COACHMARK_AFTER_MS as U, LESSON_CARD_INDEX as Q, SHOW_INITIAL_TOOLTIP_AFTER_MS as ee } from "./constants.js";
17
+ import { Indicator as te } from "./use-table-launcher-journey-styled.js";
18
+ const fe = ({
19
19
  carouselRefs: a,
20
- onTableSegmentClick: S
20
+ onTableSegmentClick: b
21
21
  }) => {
22
- const t = K.CIRCLE_TABLES_INTRO_JOURNEY, e = A(null), p = A(null), L = A(!1), T = A([]), { playButtonSound: P } = z(), { nextCoachmark: l, setJourney: I, addCoachmark: u, endJourney: y } = j(), { onEvent: _ } = q(), b = C(
23
- (n) => {
24
- var c, o;
25
- n && S(n), _(G.ONBOARDING_STEP_COMPLETED, {
26
- step: v.TABLES
27
- }), (c = e == null ? void 0 : e.current) == null || c.setLabelVisiblity(!0), (o = e == null ? void 0 : e.current) == null || o.stopLabelAnimation(), y(t);
22
+ const e = x.CIRCLE_TABLES_INTRO_JOURNEY, t = I(null), h = I(null), T = I([]), { playButtonSound: R } = V(), { nextCoachmark: i, setJourney: f, addCoachmark: d, endJourney: N } = w(), { onEvent: _ } = J(), A = p(
23
+ (o) => {
24
+ var l, n;
25
+ o && b(o), _(D.ONBOARDING_STEP_COMPLETED, {
26
+ step: W.TABLES
27
+ }), (l = t == null ? void 0 : t.current) == null || l.setLabelVisiblity(!0), (n = t == null ? void 0 : t.current) == null || n.stopLabelAnimation(), N(e);
28
28
  },
29
- [y, t, S, _]
30
- ), H = C(
31
- (n, c) => {
32
- var g, E, h;
33
- if (!((g = e.current) != null && g.segmentedCardWrapperRef.current) || !((E = e.current) != null && E.labelRef.current))
34
- return;
35
- const o = e.current.labelRef.current.getBoundingClientRect(), i = (h = e.current) == null ? void 0 : h.segmentedCardWrapperRef.current.getBoundingClientRect();
36
- u(t, {
37
- originalElementToHighlightRef: e.current.segmentedCardWrapperRef,
29
+ [N, e, b, _]
30
+ ), S = p(
31
+ (o, l) => {
32
+ var g;
33
+ const n = t.current.labelRef.current.getBoundingClientRect(), u = (g = t.current) == null ? void 0 : g.segmentedCardWrapperRef.current.getBoundingClientRect();
34
+ d(e, {
35
+ originalElementToHighlightRef: t.current.segmentedCardWrapperRef,
38
36
  isActive: !1,
39
- type: d.TOOLTIP,
37
+ type: s.TOOLTIP,
40
38
  elementToHighlight: /* @__PURE__ */ r(
41
- M,
39
+ Y,
42
40
  {
43
- ref: p,
44
- defaultTable: c,
45
- label: n.label,
46
- data: n.data,
47
- onPress: b,
48
- onGoBackFromTableLevel: b
41
+ ref: h,
42
+ defaultTable: l,
43
+ label: o.label,
44
+ data: o.data,
45
+ onPress: A,
46
+ onGoBackFromTableLevel: A
49
47
  }
50
48
  ),
51
49
  indicator: {
52
50
  position: "left",
53
51
  backgroundColor: "YELLOW_4",
54
52
  width: 236,
55
- tooltipItem: /* @__PURE__ */ r(N, { children: /* @__PURE__ */ r(m, { $renderAs: "ab2-bold", children: "Each table has 3 levels—clear them and earn 3 stars!" }) }),
53
+ tooltipItem: /* @__PURE__ */ r(O, { children: /* @__PURE__ */ r(m, { $renderAs: "ab2-bold", children: "Each table has 3 levels—clear them and earn 3 stars!" }) }),
56
54
  tooltipXCoOrdinates: 0,
57
- tooltipYCoOrdinates: o.height * 0.35
55
+ tooltipYCoOrdinates: n.height * 0.35
58
56
  }
59
- }), u(t, {
60
- originalElementToHighlightRef: e.current.segmentedCardWrapperRef,
57
+ }), d(e, {
58
+ originalElementToHighlightRef: t.current.segmentedCardWrapperRef,
61
59
  isActive: !1,
62
- type: d.NUDGE,
60
+ type: s.NUDGE,
63
61
  indicator: {
64
62
  nudge: "click",
65
63
  content: /* @__PURE__ */ r(m, { $renderAs: "ab1", $color: "WHITE", children: "Pick a level" }),
66
- nudgePointerX: i.width / 2 + 50,
67
- nudgePointerY: i.height * 0.4
64
+ nudgePointerX: u.width / 2 + 50,
65
+ nudgePointerY: u.height * 0.4
68
66
  },
69
- elementToHighlight: /* @__PURE__ */ r(R, {})
70
- }), l(t, !1, ee), l(t, !0, te);
71
- const s = setTimeout(() => {
72
- var f;
73
- clearTimeout(s), (f = p.current) == null || f.startLabelAnimation("YELLOW_4");
74
- }, $);
75
- T.current.push(s);
67
+ elementToHighlight: /* @__PURE__ */ r(L, {})
68
+ }), i(e, !1, K), i(e, !0, j);
69
+ const c = setTimeout(() => {
70
+ var E;
71
+ clearTimeout(c), (E = h.current) == null || E.startLabelAnimation("YELLOW_4");
72
+ }, k);
73
+ T.current.push(c);
76
74
  },
77
- [u, b, t, l]
78
- ), O = C(() => {
79
- var o;
80
- P(), (o = a.current) == null || o.goToIndex(x), l(t, !1, re), _(G.ONBOARDING_STEP_VIEWED, {
81
- step: v.TABLES
75
+ [d, A, e, i]
76
+ ), C = p(() => {
77
+ R(), a.current.goToIndex(B), i(e, !1, Z), _(D.ONBOARDING_STEP_VIEWED, {
78
+ step: W.TABLES
82
79
  });
83
- const n = setTimeout(() => {
84
- var i;
85
- clearTimeout(n), (i = e.current) == null || i.setLabelVisiblity(!1), l(t, !0);
86
- }, ne);
87
- T.current.push(n);
88
- const c = setTimeout(() => {
89
- var i;
90
- clearTimeout(c), (i = p.current) == null || i.startLabelAnimation("YELLOW_4");
91
- }, $);
92
- T.current.push(c);
93
- }, [a, t, l, P, _]), w = C(
94
- (n, c = !1) => {
95
- var h, f, D, W, Y, k, B, U;
96
- if (L.current)
97
- return;
98
- const o = (h = a.current) == null ? void 0 : h.indicatorRefs, i = (f = a.current) == null ? void 0 : f.nextBtnRef, s = o == null ? void 0 : o[x];
99
- if (!((D = e.current) != null && D.segmentedCardWrapperRef.current) || !((W = e.current) != null && W.labelRef.current) || !o || !(i != null && i.current) || !s || !s.current)
80
+ const o = setTimeout(() => {
81
+ var n;
82
+ clearTimeout(o), (n = t.current) == null || n.setLabelVisiblity(!1), i(e, !0);
83
+ }, q);
84
+ T.current.push(o);
85
+ const l = setTimeout(() => {
86
+ var n;
87
+ clearTimeout(l), (n = h.current) == null || n.startLabelAnimation("YELLOW_4");
88
+ }, k);
89
+ T.current.push(l);
90
+ }, [a, e, i, R, _]), G = p(
91
+ (o, l = !1) => {
92
+ var P, H, y;
93
+ const n = a.current.indicatorRefs, u = a.current.nextBtnRef, c = n == null ? void 0 : n[B];
94
+ if (!((P = t.current) != null && P.segmentedCardWrapperRef.current) || !((H = t.current) != null && H.labelRef.current) || !n || !(u != null && u.current) || !c || !c.current)
100
95
  return;
101
- L.current = !0;
102
- const g = e.current.labelRef.current.getBoundingClientRect(), E = (Y = e.current) == null ? void 0 : Y.segmentedCardWrapperRef.current.getBoundingClientRect();
103
- c ? (I(t, [
96
+ const g = t.current.labelRef.current.getBoundingClientRect(), E = (y = t.current) == null ? void 0 : y.segmentedCardWrapperRef.current.getBoundingClientRect();
97
+ l ? (f(e, [
104
98
  {
105
- originalElementToHighlightRef: s,
99
+ originalElementToHighlightRef: c,
106
100
  isActive: !1,
107
- type: d.TOOLTIP,
108
- elementToHighlight: /* @__PURE__ */ r(ce, { $isActive: !1 }),
101
+ type: s.TOOLTIP,
102
+ elementToHighlight: /* @__PURE__ */ r(te, { $isActive: !1 }),
109
103
  indicator: {
110
104
  position: "bottom",
111
105
  backgroundColor: "YELLOW_4",
112
106
  width: 52,
113
107
  tooltipItem: /* @__PURE__ */ r(
114
- N,
108
+ O,
115
109
  {
116
110
  $position: "absolute",
117
111
  $flexDirection: "row",
118
112
  style: { top: 6, left: 8, cursor: "pointer" },
119
- onClick: O,
113
+ onClick: C,
120
114
  children: /* @__PURE__ */ r(m, { $renderAs: "ab2-bold", children: "NEW" })
121
115
  }
122
116
  ),
@@ -125,21 +119,21 @@ const Oe = ({
125
119
  }
126
120
  },
127
121
  {
128
- originalElementToHighlightRef: s,
122
+ originalElementToHighlightRef: c,
129
123
  isActive: !1,
130
- type: d.NUDGE,
124
+ type: s.NUDGE,
131
125
  indicator: {
132
126
  nudge: "click",
133
127
  content: "",
134
128
  nudgePointerY: 20
135
129
  },
136
- elementToHighlight: /* @__PURE__ */ r(R, {})
130
+ elementToHighlight: /* @__PURE__ */ r(L, {})
137
131
  }
138
- ]), (U = a.current) == null || U.goToIndex(ie), l(t, !1, J), l(t, !0, le)) : (I(t, [
132
+ ]), a.current.goToIndex(Q), i(e, !1, U), i(e, !0, ee)) : (f(e, [
139
133
  {
140
- originalElementToHighlightRef: (k = a.current) == null ? void 0 : k.nextBtnRef,
134
+ originalElementToHighlightRef: a.current.nextBtnRef,
141
135
  isActive: !1,
142
- type: d.NUDGE,
136
+ type: s.NUDGE,
143
137
  indicator: {
144
138
  nudge: "click",
145
139
  content: /* @__PURE__ */ r(m, { $renderAs: "ab1", $color: "WHITE", children: "Click to proceed" }),
@@ -147,32 +141,32 @@ const Oe = ({
147
141
  nudgePointerY: 0
148
142
  },
149
143
  elementToHighlight: /* @__PURE__ */ r(
150
- Z,
144
+ F,
151
145
  {
152
146
  renderAs: "secondary",
153
- Icon: X,
154
- onClick: O,
155
- analyticsLabel: Q.JOURNEY_NEXT_ACTIVITY
147
+ Icon: $,
148
+ onClick: C,
149
+ analyticsLabel: X.JOURNEY_NEXT_ACTIVITY
156
150
  }
157
151
  )
158
152
  }
159
- ]), (B = a.current) == null || B.goToIndex(oe), l(t, !1, J)), u(t, {
160
- originalElementToHighlightRef: e.current.labelRef,
153
+ ]), a.current.goToIndex(z), i(e, !1, U)), d(e, {
154
+ originalElementToHighlightRef: t.current.labelRef,
161
155
  isActive: !1,
162
- type: d.TOOLTIP,
163
- elementToHighlight: /* @__PURE__ */ r(R, {}),
156
+ type: s.TOOLTIP,
157
+ elementToHighlight: /* @__PURE__ */ r(L, {}),
164
158
  indicator: {
165
159
  position: "right",
166
160
  backgroundColor: "YELLOW_4",
167
161
  width: 264,
168
- tooltipItem: /* @__PURE__ */ r(N, { children: /* @__PURE__ */ r(m, { $renderAs: "ab2-bold", children: "Get faster at multiplication! Practice everyday and become a Tables champ." }) }),
162
+ tooltipItem: /* @__PURE__ */ r(O, { children: /* @__PURE__ */ r(m, { $renderAs: "ab2-bold", children: "Get faster at multiplication! Practice everyday and become a Tables champ." }) }),
169
163
  tooltipXCoOrdinates: g.width + 50,
170
164
  tooltipYCoOrdinates: g.height / 2
171
165
  }
172
- }), u(t, {
173
- originalElementToHighlightRef: e.current.segmentedCardWrapperRef,
166
+ }), d(e, {
167
+ originalElementToHighlightRef: t.current.segmentedCardWrapperRef,
174
168
  isActive: !1,
175
- type: d.NUDGE,
169
+ type: s.NUDGE,
176
170
  indicator: {
177
171
  nudge: "click",
178
172
  content: /* @__PURE__ */ r(m, { $renderAs: "ab1", $color: "WHITE", children: "Pick a table to start" }),
@@ -180,36 +174,36 @@ const Oe = ({
180
174
  nudgePointerY: E.height / 2
181
175
  },
182
176
  elementToHighlight: /* @__PURE__ */ r(
183
- M,
177
+ Y,
184
178
  {
185
- ref: p,
186
- label: n.label,
187
- data: n.data,
179
+ ref: h,
180
+ label: o.label,
181
+ data: o.data,
188
182
  onPress: () => {
189
183
  },
190
- onPressTableSegment: (F) => H(n, F)
184
+ onPressTableSegment: (v) => S(o, v)
191
185
  }
192
186
  )
193
187
  });
194
188
  },
195
189
  [
196
- u,
190
+ d,
197
191
  a,
198
- O,
199
- H,
200
- t,
201
- l,
202
- I
192
+ C,
193
+ S,
194
+ e,
195
+ i,
196
+ f
203
197
  ]
204
198
  );
205
- return V(() => () => {
206
- T.current.forEach((n) => clearTimeout(n)), T.current = [], L.current = !1;
207
- }, [t]), {
208
- tableRef: e,
209
- startJourney: w
199
+ return M(() => () => {
200
+ T.current.forEach((o) => clearTimeout(o)), T.current = [];
201
+ }, [e]), {
202
+ tableRef: t,
203
+ startJourney: G
210
204
  };
211
205
  };
212
206
  export {
213
- Oe as useTableLauncherJourney
207
+ fe as useTableLauncherJourney
214
208
  };
215
209
  //# sourceMappingURL=use-table-launcher-journey.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-table-launcher-journey.js","sources":["../../../../../../src/features/circle-games/game-launcher/hooks/use-table-launcher-journey/use-table-launcher-journey.tsx"],"sourcesContent":["/* eslint-disable react-native/no-inline-styles */\nimport type { IArrowTooltipProps } from '../../../../ui/arrow-tooltip/arrow-tooltip-types';\nimport type { INudgeProps } from '../../../../ui/nudge/nudge-types';\nimport type { ITableCardRef, ITableDetails } from '../../comps/tables-card/tables-card-types';\nimport type {\n ITableInfo,\n ITables,\n} from '../../dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport type { IUseTableJourneyProps } from './use-table-launcher-journey-types';\n\nimport { useCallback, useEffect, useRef } from 'react';\n\nimport CaratRightIcon from '../../../../../assets/line-icons/icons/carat-right';\nimport { PLATFORM_EVENTS_STUDENT } from '../../../../analytics-events/platform-events-student';\nimport { JOURNEY_ID_STUDENT } from '../../../../journey/journey-id/journey-id-student';\nimport { IndicatorType } from '../../../../journey/use-journey/constants';\nimport { useJourney } from '../../../../journey/use-journey/use-journey';\nimport IconButton from '../../../../ui/buttons/icon-button/icon-button';\nimport { useUIContext } from '../../../../ui/context/context';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport { CIRCLE_ONBOARDING_ANALYTICS_STEPS as Action } from '../../../enum/circle-onboarding-steps';\nimport { useCircleSounds } from '../../../hooks/use-circle-sounds/use-circle-sounds';\nimport { TablesCard } from '../../comps/tables-card/tables-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from '../../game-launcher-analytics-events';\nimport {\n LESSON_CARD_INDEX,\n PUZZLE_CARD_INDEX,\n SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS,\n SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS,\n TABLE_CARD_INDEX,\n} from './constants';\nimport {\n GO_TO_TABLE_LAUNCHER_DURATION_MS,\n SHOW_CLICK_TABLE_NUDGE_AFTER_MS,\n SHOW_INITIAL_COACHMARK_AFTER_MS,\n SHOW_INITIAL_TOOLTIP_AFTER_MS,\n START_ANIMATING_CLONED_ELEM,\n} from './constants';\nimport * as S from './use-table-launcher-journey-styled';\n\nexport const useTableLauncherJourney = ({\n carouselRefs,\n onTableSegmentClick,\n}: IUseTableJourneyProps) => {\n const journeyId = JOURNEY_ID_STUDENT.CIRCLE_TABLES_INTRO_JOURNEY;\n const originalTableRef = useRef<ITableCardRef>(null);\n const highlightedTableRef = useRef<ITableCardRef>(null);\n const isJourneyInProgress = useRef(false);\n\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const { playButtonSound } = useCircleSounds();\n const { nextCoachmark, setJourney, addCoachmark, endJourney } = useJourney();\n const { onEvent: trackAnalytics } = useUIContext();\n\n const handleEndJourney = useCallback(\n (tableDetails?: ITableDetails) => {\n // Only when User clicked on play\n if (tableDetails) {\n onTableSegmentClick(tableDetails);\n }\n trackAnalytics(PLATFORM_EVENTS_STUDENT.ONBOARDING_STEP_COMPLETED, {\n step: Action.TABLES,\n });\n\n // Reset original table card ref label\n originalTableRef?.current?.setLabelVisiblity(true);\n originalTableRef?.current?.stopLabelAnimation();\n endJourney(journeyId);\n },\n [endJourney, journeyId, onTableSegmentClick, trackAnalytics],\n );\n\n const handleTableSegmentClick = useCallback(\n (launcherData: ITables, tableData: ITableInfo) => {\n if (\n !originalTableRef.current?.segmentedCardWrapperRef.current ||\n !originalTableRef.current?.labelRef.current\n ) {\n return;\n }\n\n const segmentedCardDims = originalTableRef.current.labelRef.current.getBoundingClientRect();\n const tableCardDims =\n originalTableRef.current?.segmentedCardWrapperRef.current.getBoundingClientRect();\n\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: (\n <TablesCard\n ref={highlightedTableRef}\n defaultTable={tableData}\n label={launcherData.label}\n data={launcherData.data}\n onPress={handleEndJourney}\n onGoBackFromTableLevel={handleEndJourney}\n />\n ),\n indicator: {\n position: 'left',\n backgroundColor: 'YELLOW_4',\n width: 236,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">Each table has 3 levels—clear them and earn 3 stars!</Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: 0,\n tooltipYCoOrdinates: segmentedCardDims.height * 0.35,\n } as IArrowTooltipProps,\n });\n\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Pick a level\n </Text>\n ),\n nudgePointerX: tableCardDims.width / 2 + 50,\n nudgePointerY: tableCardDims.height * 0.4,\n } as INudgeProps,\n elementToHighlight: <></>,\n });\n\n nextCoachmark(journeyId, false, SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS); // Show coachmark => Each table has 3... and Hide the previous two\n nextCoachmark(journeyId, true, SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS); // Show nudge => Pick a level\n\n const startAnimationOnLabelAgain = setTimeout(() => {\n clearTimeout(startAnimationOnLabelAgain);\n highlightedTableRef.current?.startLabelAnimation('YELLOW_4');\n }, START_ANIMATING_CLONED_ELEM);\n\n timerRefs.current.push(startAnimationOnLabelAgain);\n },\n [addCoachmark, handleEndJourney, journeyId, nextCoachmark],\n );\n\n const goToTableLauncher = useCallback(() => {\n playButtonSound();\n carouselRefs.current?.goToIndex(TABLE_CARD_INDEX);\n nextCoachmark(journeyId, false, GO_TO_TABLE_LAUNCHER_DURATION_MS);\n\n trackAnalytics(PLATFORM_EVENTS_STUDENT.ONBOARDING_STEP_VIEWED, {\n step: Action.TABLES,\n });\n\n const showNudge = setTimeout(() => {\n clearTimeout(showNudge);\n originalTableRef.current?.setLabelVisiblity(false);\n nextCoachmark(journeyId, true);\n }, SHOW_CLICK_TABLE_NUDGE_AFTER_MS);\n\n timerRefs.current.push(showNudge);\n\n const animateLabel = setTimeout(() => {\n clearTimeout(animateLabel);\n highlightedTableRef.current?.startLabelAnimation('YELLOW_4');\n }, START_ANIMATING_CLONED_ELEM);\n\n timerRefs.current.push(animateLabel);\n }, [carouselRefs, journeyId, nextCoachmark, playButtonSound, trackAnalytics]);\n\n const startJourney = useCallback(\n (tablesData: ITables, isTutorialOnboardingDone: boolean = false) => {\n if (isJourneyInProgress.current) {\n return;\n }\n\n const paginationList = carouselRefs.current?.indicatorRefs;\n const carouselNextBtnRef = carouselRefs.current?.nextBtnRef;\n const tablePaginationRef = paginationList?.[TABLE_CARD_INDEX];\n\n if (\n !originalTableRef.current?.segmentedCardWrapperRef.current ||\n !originalTableRef.current?.labelRef.current ||\n !paginationList ||\n !carouselNextBtnRef?.current ||\n !tablePaginationRef ||\n !tablePaginationRef.current\n ) {\n return;\n }\n\n isJourneyInProgress.current = true;\n\n const labelDims = originalTableRef.current.labelRef.current.getBoundingClientRect();\n const tableCardDims =\n originalTableRef.current?.segmentedCardWrapperRef.current.getBoundingClientRect();\n\n // TAKE THE USER TO THE TABLE CARD\n if (!isTutorialOnboardingDone) {\n setJourney(journeyId, [\n {\n originalElementToHighlightRef: carouselRefs.current?.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to proceed\n </Text>\n ),\n nudgePointerX: 0,\n nudgePointerY: 0,\n } as INudgeProps,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={goToTableLauncher}\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\n },\n ]);\n carouselRefs.current?.goToIndex(PUZZLE_CARD_INDEX);\n nextCoachmark(journeyId, false, SHOW_INITIAL_COACHMARK_AFTER_MS); // Show nudge => Click to proceed\n } else {\n setJourney(journeyId, [\n {\n originalElementToHighlightRef: tablePaginationRef as React.RefObject<HTMLDivElement>,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <S.Indicator $isActive={false} />,\n indicator: {\n position: 'bottom',\n backgroundColor: 'YELLOW_4',\n width: 52,\n tooltipItem: (\n <FlexView\n $position=\"absolute\"\n $flexDirection=\"row\"\n style={{ top: 6, left: 8, cursor: 'pointer' }}\n onClick={goToTableLauncher}\n >\n <Text $renderAs=\"ab2-bold\">NEW</Text>\n </FlexView>\n ),\n tooltipYCoOrdinates: 14, // Need some offset in Y direction from top\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: tablePaginationRef as React.RefObject<HTMLDivElement>,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: '',\n nudgePointerY: 20,\n } as INudgeProps,\n elementToHighlight: <></>,\n },\n ]);\n carouselRefs.current?.goToIndex(LESSON_CARD_INDEX);\n nextCoachmark(journeyId, false, SHOW_INITIAL_COACHMARK_AFTER_MS); // Show Coachmark => NEW\n nextCoachmark(journeyId, true, SHOW_INITIAL_TOOLTIP_AFTER_MS); // Show Nudge over Coachmark\n }\n\n // SHOW THE USER SELECT A TABLE\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'YELLOW_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Get faster at multiplication! Practice everyday and become a Tables champ.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: labelDims.width + 50,\n tooltipYCoOrdinates: labelDims.height / 2,\n } as IArrowTooltipProps,\n });\n\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n {'Pick a table to start'}\n </Text>\n ),\n nudgePointerX: tableCardDims.width / 2 + 50,\n nudgePointerY: tableCardDims.height / 2,\n } as INudgeProps,\n elementToHighlight: (\n <TablesCard\n ref={highlightedTableRef}\n label={tablesData.label}\n data={tablesData.data}\n onPress={() => {}}\n onPressTableSegment={tableInfo => handleTableSegmentClick(tablesData, tableInfo)}\n />\n ),\n });\n },\n [\n addCoachmark,\n carouselRefs,\n goToTableLauncher,\n handleTableSegmentClick,\n journeyId,\n nextCoachmark,\n setJourney,\n ],\n );\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n timerRefs.current.forEach(timer => clearTimeout(timer));\n timerRefs.current = [];\n isJourneyInProgress.current = false;\n };\n }, [journeyId]);\n\n return {\n tableRef: originalTableRef,\n startJourney,\n };\n};\n"],"names":["useTableLauncherJourney","carouselRefs","onTableSegmentClick","journeyId","JOURNEY_ID_STUDENT","originalTableRef","useRef","highlightedTableRef","isJourneyInProgress","timerRefs","playButtonSound","useCircleSounds","nextCoachmark","setJourney","addCoachmark","endJourney","useJourney","trackAnalytics","useUIContext","handleEndJourney","useCallback","tableDetails","PLATFORM_EVENTS_STUDENT","Action","_a","_b","handleTableSegmentClick","launcherData","tableData","segmentedCardDims","tableCardDims","_c","IndicatorType","jsx","TablesCard","FlexView","Text","Fragment","SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS","SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS","startAnimationOnLabelAgain","START_ANIMATING_CLONED_ELEM","goToTableLauncher","TABLE_CARD_INDEX","GO_TO_TABLE_LAUNCHER_DURATION_MS","showNudge","SHOW_CLICK_TABLE_NUDGE_AFTER_MS","animateLabel","startJourney","tablesData","isTutorialOnboardingDone","paginationList","carouselNextBtnRef","tablePaginationRef","_d","labelDims","_e","S.Indicator","_h","LESSON_CARD_INDEX","SHOW_INITIAL_COACHMARK_AFTER_MS","SHOW_INITIAL_TOOLTIP_AFTER_MS","_f","IconButton","CaratRightIcon","GAME_LAUNCHER_ANALYTICS_EVENTS","_g","PUZZLE_CARD_INDEX","tableInfo","useEffect","timer"],"mappings":";;;;;;;;;;;;;;;;;AAyCO,MAAMA,KAA0B,CAAC;AAAA,EACtC,cAAAC;AAAA,EACA,qBAAAC;AACF,MAA6B;AAC3B,QAAMC,IAAYC,EAAmB,6BAC/BC,IAAmBC,EAAsB,IAAI,GAC7CC,IAAsBD,EAAsB,IAAI,GAChDE,IAAsBF,EAAO,EAAK,GAElCG,IAAYH,EAAwC,CAAA,CAAE,GAEtD,EAAE,iBAAAI,MAAoBC,KACtB,EAAE,eAAAC,GAAe,YAAAC,GAAY,cAAAC,GAAc,YAAAC,EAAA,IAAeC,KAC1D,EAAE,SAASC,EAAe,IAAIC,EAAa,GAE3CC,IAAmBC;AAAA,IACvB,CAACC,MAAiC;;AAEhC,MAAIA,KACFnB,EAAoBmB,CAAY,GAElCJ,EAAeK,EAAwB,2BAA2B;AAAA,QAChE,MAAMC,EAAO;AAAA,MAAA,CACd,IAGiBC,IAAAnB,KAAA,gBAAAA,EAAA,YAAA,QAAAmB,EAAS,kBAAkB,MAC7CC,IAAApB,KAAA,gBAAAA,EAAkB,YAAlB,QAAAoB,EAA2B,sBAC3BV,EAAWZ,CAAS;AAAA,IACtB;AAAA,IACA,CAACY,GAAYZ,GAAWD,GAAqBe,CAAc;AAAA,EAAA,GAGvDS,IAA0BN;AAAA,IAC9B,CAACO,GAAuBC,MAA0B;;AAE9C,UAAA,GAACJ,IAAAnB,EAAiB,YAAjB,QAAAmB,EAA0B,wBAAwB,YACnD,GAACC,IAAApB,EAAiB,YAAjB,QAAAoB,EAA0B,SAAS;AAEpC;AAGF,YAAMI,IAAoBxB,EAAiB,QAAQ,SAAS,QAAQ,yBAC9DyB,KACJC,IAAA1B,E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AAa1C,EAAwBuB,GAAYmB,CAAS;AAAA,UAAA;AAAA,QACjF;AAAA,MAAA,CAEH;AAAA,IACH;AAAA,IACA;AAAA,MACEtD;AAAA,MACAb;AAAA,MACAyC;AAAA,MACAhB;AAAA,MACAvB;AAAA,MACAS;AAAA,MACAC;AAAA,IACF;AAAA,EAAA;AAIF,SAAAwD,EAAU,MACD,MAAM;AACX,IAAA5D,EAAU,QAAQ,QAAQ,CAAS6D,MAAA,aAAaA,CAAK,CAAC,GACtD7D,EAAU,UAAU,IACpBD,EAAoB,UAAU;AAAA,EAAA,GAE/B,CAACL,CAAS,CAAC,GAEP;AAAA,IACL,UAAUE;AAAA,IACV,cAAA2C;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"use-table-launcher-journey.js","sources":["../../../../../../src/features/circle-games/game-launcher/hooks/use-table-launcher-journey/use-table-launcher-journey.tsx"],"sourcesContent":["/* eslint-disable react-native/no-inline-styles */\nimport type { IArrowTooltipProps } from '../../../../ui/arrow-tooltip/arrow-tooltip-types';\nimport type { INudgeProps } from '../../../../ui/nudge/nudge-types';\nimport type { ITableCardRef, ITableDetails } from '../../comps/tables-card/tables-card-types';\nimport type {\n ITableInfo,\n ITables,\n} from '../../dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport type { IUseTableJourneyProps } from './use-table-launcher-journey-types';\n\nimport { useCallback, useEffect, useRef } from 'react';\n\nimport CaratRightIcon from '../../../../../assets/line-icons/icons/carat-right';\nimport { PLATFORM_EVENTS_STUDENT } from '../../../../analytics-events/platform-events-student';\nimport { JOURNEY_ID_STUDENT } from '../../../../journey/journey-id/journey-id-student';\nimport { IndicatorType } from '../../../../journey/use-journey/constants';\nimport { useJourney } from '../../../../journey/use-journey/use-journey';\nimport IconButton from '../../../../ui/buttons/icon-button/icon-button';\nimport { useUIContext } from '../../../../ui/context/context';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport { CIRCLE_ONBOARDING_ANALYTICS_STEPS as Action } from '../../../enum/circle-onboarding-steps';\nimport { useCircleSounds } from '../../../hooks/use-circle-sounds/use-circle-sounds';\nimport { TablesCard } from '../../comps/tables-card/tables-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from '../../game-launcher-analytics-events';\nimport {\n LESSON_CARD_INDEX,\n PUZZLE_CARD_INDEX,\n SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS,\n SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS,\n TABLE_CARD_INDEX,\n} from './constants';\nimport {\n GO_TO_TABLE_LAUNCHER_DURATION_MS,\n SHOW_CLICK_TABLE_NUDGE_AFTER_MS,\n SHOW_INITIAL_COACHMARK_AFTER_MS,\n SHOW_INITIAL_TOOLTIP_AFTER_MS,\n START_ANIMATING_CLONED_ELEM,\n} from './constants';\nimport * as S from './use-table-launcher-journey-styled';\n\nexport const useTableLauncherJourney = ({\n carouselRefs,\n onTableSegmentClick,\n}: IUseTableJourneyProps) => {\n const journeyId = JOURNEY_ID_STUDENT.CIRCLE_TABLES_INTRO_JOURNEY;\n const originalTableRef = useRef<ITableCardRef>(null);\n const highlightedTableRef = useRef<ITableCardRef>(null);\n\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const { playButtonSound } = useCircleSounds();\n const { nextCoachmark, setJourney, addCoachmark, endJourney } = useJourney();\n const { onEvent: trackAnalytics } = useUIContext();\n\n const handleEndJourney = useCallback(\n (tableDetails?: ITableDetails) => {\n // Only when User clicked on play\n if (tableDetails) {\n onTableSegmentClick(tableDetails);\n }\n trackAnalytics(PLATFORM_EVENTS_STUDENT.ONBOARDING_STEP_COMPLETED, {\n step: Action.TABLES,\n });\n\n // Reset original table card ref label\n originalTableRef?.current?.setLabelVisiblity(true);\n originalTableRef?.current?.stopLabelAnimation();\n endJourney(journeyId);\n },\n [endJourney, journeyId, onTableSegmentClick, trackAnalytics],\n );\n\n const handleTableSegmentClick = useCallback(\n (launcherData: ITables, tableData: ITableInfo) => {\n const segmentedCardDims = originalTableRef.current.labelRef.current.getBoundingClientRect();\n const tableCardDims =\n originalTableRef.current?.segmentedCardWrapperRef.current.getBoundingClientRect();\n\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: (\n <TablesCard\n ref={highlightedTableRef}\n defaultTable={tableData}\n label={launcherData.label}\n data={launcherData.data}\n onPress={handleEndJourney}\n onGoBackFromTableLevel={handleEndJourney}\n />\n ),\n indicator: {\n position: 'left',\n backgroundColor: 'YELLOW_4',\n width: 236,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">Each table has 3 levels—clear them and earn 3 stars!</Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: 0,\n tooltipYCoOrdinates: segmentedCardDims.height * 0.35,\n } as IArrowTooltipProps,\n });\n\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Pick a level\n </Text>\n ),\n nudgePointerX: tableCardDims.width / 2 + 50,\n nudgePointerY: tableCardDims.height * 0.4,\n } as INudgeProps,\n elementToHighlight: <></>,\n });\n\n nextCoachmark(journeyId, false, SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS); // Show coachmark => Each table has 3... and Hide the previous two\n nextCoachmark(journeyId, true, SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS); // Show nudge => Pick a level\n\n const startAnimationOnLabelAgain = setTimeout(() => {\n clearTimeout(startAnimationOnLabelAgain);\n highlightedTableRef.current?.startLabelAnimation('YELLOW_4');\n }, START_ANIMATING_CLONED_ELEM);\n\n timerRefs.current.push(startAnimationOnLabelAgain);\n },\n [addCoachmark, handleEndJourney, journeyId, nextCoachmark],\n );\n\n const goToTableLauncher = useCallback(() => {\n playButtonSound();\n carouselRefs.current.goToIndex(TABLE_CARD_INDEX);\n nextCoachmark(journeyId, false, GO_TO_TABLE_LAUNCHER_DURATION_MS);\n\n trackAnalytics(PLATFORM_EVENTS_STUDENT.ONBOARDING_STEP_VIEWED, {\n step: Action.TABLES,\n });\n\n const showNudge = setTimeout(() => {\n clearTimeout(showNudge);\n originalTableRef.current?.setLabelVisiblity(false);\n nextCoachmark(journeyId, true);\n }, SHOW_CLICK_TABLE_NUDGE_AFTER_MS);\n\n timerRefs.current.push(showNudge);\n\n const animateLabel = setTimeout(() => {\n clearTimeout(animateLabel);\n highlightedTableRef.current?.startLabelAnimation('YELLOW_4');\n }, START_ANIMATING_CLONED_ELEM);\n\n timerRefs.current.push(animateLabel);\n }, [carouselRefs, journeyId, nextCoachmark, playButtonSound, trackAnalytics]);\n\n const startJourney = useCallback(\n (tablesData: ITables, isTutorialOnboardingDone: boolean = false) => {\n const paginationList = carouselRefs.current.indicatorRefs;\n const carouselNextBtnRef = carouselRefs.current.nextBtnRef;\n const tablePaginationRef = paginationList?.[TABLE_CARD_INDEX];\n\n if (\n !originalTableRef.current?.segmentedCardWrapperRef.current ||\n !originalTableRef.current?.labelRef.current ||\n !paginationList ||\n !carouselNextBtnRef?.current ||\n !tablePaginationRef ||\n !tablePaginationRef.current\n ) {\n return;\n }\n\n const labelDims = originalTableRef.current.labelRef.current.getBoundingClientRect();\n const tableCardDims =\n originalTableRef.current?.segmentedCardWrapperRef.current.getBoundingClientRect();\n\n // TAKE THE USER TO THE TABLE CARD\n if (!isTutorialOnboardingDone) {\n setJourney(journeyId, [\n {\n originalElementToHighlightRef: carouselRefs.current.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to proceed\n </Text>\n ),\n nudgePointerX: 0,\n nudgePointerY: 0,\n } as INudgeProps,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={goToTableLauncher}\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\n },\n ]);\n carouselRefs.current.goToIndex(PUZZLE_CARD_INDEX);\n nextCoachmark(journeyId, false, SHOW_INITIAL_COACHMARK_AFTER_MS); // Show nudge => Click to proceed\n } else {\n setJourney(journeyId, [\n {\n originalElementToHighlightRef: tablePaginationRef as React.RefObject<HTMLDivElement>,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <S.Indicator $isActive={false} />,\n indicator: {\n position: 'bottom',\n backgroundColor: 'YELLOW_4',\n width: 52,\n tooltipItem: (\n <FlexView\n $position=\"absolute\"\n $flexDirection=\"row\"\n style={{ top: 6, left: 8, cursor: 'pointer' }}\n onClick={goToTableLauncher}\n >\n <Text $renderAs=\"ab2-bold\">NEW</Text>\n </FlexView>\n ),\n tooltipYCoOrdinates: 14, // Need some offset in Y direction from top\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: tablePaginationRef as React.RefObject<HTMLDivElement>,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: '',\n nudgePointerY: 20,\n } as INudgeProps,\n elementToHighlight: <></>,\n },\n ]);\n carouselRefs.current.goToIndex(LESSON_CARD_INDEX);\n nextCoachmark(journeyId, false, SHOW_INITIAL_COACHMARK_AFTER_MS); // Show Coachmark => NEW\n nextCoachmark(journeyId, true, SHOW_INITIAL_TOOLTIP_AFTER_MS); // Show Nudge over Coachmark\n }\n\n // SHOW THE USER SELECT A TABLE\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'YELLOW_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Get faster at multiplication! Practice everyday and become a Tables champ.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: labelDims.width + 50,\n tooltipYCoOrdinates: labelDims.height / 2,\n } as IArrowTooltipProps,\n });\n\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n {'Pick a table to start'}\n </Text>\n ),\n nudgePointerX: tableCardDims.width / 2 + 50,\n nudgePointerY: tableCardDims.height / 2,\n } as INudgeProps,\n elementToHighlight: (\n <TablesCard\n ref={highlightedTableRef}\n label={tablesData.label}\n data={tablesData.data}\n onPress={() => {}}\n onPressTableSegment={tableInfo => handleTableSegmentClick(tablesData, tableInfo)}\n />\n ),\n });\n },\n [\n addCoachmark,\n carouselRefs,\n goToTableLauncher,\n handleTableSegmentClick,\n journeyId,\n nextCoachmark,\n setJourney,\n ],\n );\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n timerRefs.current.forEach(timer => clearTimeout(timer));\n timerRefs.current = [];\n };\n }, [journeyId]);\n\n return {\n tableRef: originalTableRef,\n startJourney,\n };\n};\n"],"names":["useTableLauncherJourney","carouselRefs","onTableSegmentClick","journeyId","JOURNEY_ID_STUDENT","originalTableRef","useRef","highlightedTableRef","timerRefs","playButtonSound","useCircleSounds","nextCoachmark","setJourney","addCoachmark","endJourney","useJourney","trackAnalytics","useUIContext","handleEndJourney","useCallback","tableDetails","PLATFORM_EVENTS_STUDENT","Action","_a","_b","handleTableSegmentClick","launcherData","tableData","segmentedCardDims","tableCardDims","IndicatorType","jsx","TablesCard","FlexView","Text","Fragment","SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS","SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS","startAnimationOnLabelAgain","START_ANIMATING_CLONED_ELEM","goToTableLauncher","TABLE_CARD_INDEX","GO_TO_TABLE_LAUNCHER_DURATION_MS","showNudge","SHOW_CLICK_TABLE_NUDGE_AFTER_MS","animateLabel","startJourney","tablesData","isTutorialOnboardingDone","paginationList","carouselNextBtnRef","tablePaginationRef","labelDims","_c","S.Indicator","LESSON_CARD_INDEX","SHOW_INITIAL_COACHMARK_AFTER_MS","SHOW_INITIAL_TOOLTIP_AFTER_MS","IconButton","CaratRightIcon","GAME_LAUNCHER_ANALYTICS_EVENTS","PUZZLE_CARD_INDEX","tableInfo","useEffect","timer"],"mappings":";;;;;;;;;;;;;;;;;AAyCO,MAAMA,KAA0B,CAAC;AAAA,EACtC,cAAAC;AAAA,EACA,qBAAAC;AACF,MAA6B;AAC3B,QAAMC,IAAYC,EAAmB,6BAC/BC,IAAmBC,EAAsB,IAAI,GAC7CC,IAAsBD,EAAsB,IAAI,GAEhDE,IAAYF,EAAwC,CAAA,CAAE,GAEtD,EAAE,iBAAAG,MAAoBC,KACtB,EAAE,eAAAC,GAAe,YAAAC,GAAY,cAAAC,GAAc,YAAAC,EAAA,IAAeC,KAC1D,EAAE,SAASC,EAAe,IAAIC,EAAa,GAE3CC,IAAmBC;AAAA,IACvB,CAACC,MAAiC;;AAEhC,MAAIA,KACFlB,EAAoBkB,CAAY,GAElCJ,EAAeK,EAAwB,2BAA2B;AAAA,QAChE,MAAMC,EAAO;AAAA,MAAA,CACd,IAGiBC,IAAAlB,KAAA,gBAAAA,EAAA,YAAA,QAAAkB,EAAS,kBAAkB,MAC7CC,IAAAnB,KAAA,gBAAAA,EAAkB,YAAlB,QAAAmB,EAA2B,sBAC3BV,EAAWX,CAAS;AAAA,IACtB;AAAA,IACA,CAACW,GAAYX,GAAWD,GAAqBc,CAAc;AAAA,EAAA,GAGvDS,IAA0BN;AAAA,IAC9B,CAACO,GAAuBC,MAA0B;;AAChD,YAAMC,IAAoBvB,EAAiB,QAAQ,SAAS,QAAQ,yBAC9DwB,KACJN,IAAAlB,EAAiB,YAAjB,gBAAAkB,EAA0B,wBAAwB,QAAQ;AAE5D,MAAAV,EAAaV,GAAW;AAAA,QACtB,+BAA+BE,EAAiB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AAA,aAAaA,CAAK,CAAC,GACtDxD,EAAU,UAAU;EAAC,GAEtB,CAACL,CAAS,CAAC,GAEP;AAAA,IACL,UAAUE;AAAA,IACV,cAAAyC;AAAA,EAAA;AAEJ;"}
@@ -1,29 +1,29 @@
1
- import { jsxs as b, jsx as j } from "react/jsx-runtime";
2
- import { createContext as q, useState as h, useRef as C, useCallback as l, useMemo as L, useEffect as R } from "react";
1
+ import { jsxs as q, jsx as j } from "react/jsx-runtime";
2
+ import { createContext as D, useState as h, useRef as C, useCallback as l, useMemo as L, useEffect as R } from "react";
3
3
  import { Coachmark as N } from "../comps/coachmark/coachmark.js";
4
4
  import { usePostUserJourney as M, useGetUserJourney as z } from "../user-journey-api/user-journey-api.js";
5
5
  import { Overlay as G } from "./journey-styled.js";
6
- const S = q(null), Q = ({ children: T, appId: u, userId: s }) => {
7
- const [k, v] = h([]), [o, c] = h([]), [g, p] = h(!1), a = C(-1), r = C(), f = C([]), { post: x } = M(), {
6
+ const S = D(null), Q = ({ children: T, appId: u, userId: s }) => {
7
+ const [k, v] = h([]), [n, c] = h([]), [g, p] = h(!1), a = C(-1), r = C(), f = C([]), { post: x } = M(), {
8
8
  data: m = null,
9
9
  get: _,
10
- isProcessing: D
11
- } = z(), O = (u === "" || m && !D) && o.length > 0, $ = l(
10
+ isProcessing: O
11
+ } = z(), U = (u === "" || m && !O) && n.length > 0, A = l(
12
12
  (e, t) => {
13
- if (o.length > 0) {
13
+ if (n.length > 0) {
14
14
  console.error(
15
15
  `setJourney: Other Journey is already active, Current Journey: ${r.current}, New Journey Request: ${e}`
16
16
  );
17
17
  return;
18
18
  }
19
- console.log(`setJourney: Journey ID: ${e}`), p(!0), r.current = e, a.current = -1, c([...t]);
19
+ p(!0), r.current = e, a.current = -1, c([...t]);
20
20
  },
21
- [o.length]
21
+ [n.length]
22
22
  ), y = l(() => {
23
23
  f.current.forEach((e) => {
24
24
  clearTimeout(e);
25
25
  }), f.current = [], r.current = void 0, a.current = -1, c([]), p(!1);
26
- }, []), A = l(
26
+ }, []), P = l(
27
27
  (e) => {
28
28
  v((t) => [...t, e]), x({
29
29
  app_id: u,
@@ -33,7 +33,7 @@ const S = q(null), Q = ({ children: T, appId: u, userId: s }) => {
33
33
  }), y();
34
34
  },
35
35
  [u, y, x, s]
36
- ), P = l((e, t) => {
36
+ ), $ = l((e, t) => {
37
37
  if (!r.current || e !== r.current) {
38
38
  console.error(
39
39
  r.current ? `A Journey is already active, Current Journey: ${r.current}, New Journey Request: ${e}` : "addCoachmark was called before setJourney and Journey ID is undefined"
@@ -49,39 +49,39 @@ const S = q(null), Q = ({ children: T, appId: u, userId: s }) => {
49
49
  );
50
50
  return;
51
51
  }
52
- J !== 0 && c((n) => n.map((i) => ({ ...i, isActive: !1 })));
52
+ J !== 0 && c((o) => o.map((i) => ({ ...i, isActive: !1 })));
53
53
  const E = setTimeout(() => {
54
54
  clearTimeout(E);
55
- const n = a.current + 1;
55
+ const o = a.current + 1;
56
56
  c((i) => {
57
- if (n >= i.length || i.length === 0)
57
+ if (o >= i.length || i.length === 0)
58
58
  return r.current = void 0, a.current = -1, [];
59
- a.current = n;
59
+ a.current = o;
60
60
  const d = [...i];
61
- return d[n].isActive = !0, n > 0 && (d[n - 1].isActive = t), d;
61
+ return d[o].isActive = !0, o > 0 && (d[o - 1].isActive = t), d;
62
62
  });
63
63
  }, J);
64
64
  f.current.push(E);
65
65
  },
66
66
  []
67
- ), U = L(
67
+ ), b = L(
68
68
  () => ({
69
69
  nextCoachmark: w,
70
- setJourney: $,
71
- addCoachmark: P,
70
+ setJourney: A,
71
+ addCoachmark: $,
72
72
  clearJourney: y,
73
- endJourney: A,
74
- coachmarks: o,
73
+ endJourney: P,
74
+ coachmarks: n,
75
75
  userCompletedJourneyIds: k,
76
76
  isJourneyActive: g
77
77
  }),
78
78
  [
79
79
  w,
80
+ A,
80
81
  $,
81
- P,
82
82
  y,
83
- A,
84
- o,
83
+ P,
84
+ n,
85
85
  k,
86
86
  g
87
87
  ]
@@ -97,8 +97,8 @@ const S = q(null), Q = ({ children: T, appId: u, userId: s }) => {
97
97
  const e = m.map((t) => t.journey_id);
98
98
  v(e);
99
99
  }
100
- }, [m]), /* @__PURE__ */ b(S.Provider, { value: U, children: [
101
- O && /* @__PURE__ */ j(G, { children: o.map((e, t) => /* @__PURE__ */ j(N, { coachmark: e }, `coachmark-${t}`)) }),
100
+ }, [m]), /* @__PURE__ */ q(S.Provider, { value: b, children: [
101
+ U && /* @__PURE__ */ j(G, { children: n.map((e, t) => /* @__PURE__ */ j(N, { coachmark: e }, `coachmark-${t}`)) }),
102
102
  T
103
103
  ] });
104
104
  };
@@ -1 +1 @@
1
- {"version":3,"file":"journey-context-provider.js","sources":["../../../../src/features/journey/use-journey/journey-context-provider.tsx"],"sourcesContent":["/* eslint-disable no-console */\nimport type { TJourneyId } from '../journey-id/journey-id-types';\nimport type {\n ICoachmarkProps,\n IJourneyContext,\n IJourneyProviderProps,\n} from './journey-context-types';\nimport type { FC } from 'react';\n\nimport { createContext, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { Coachmark } from '../comps/coachmark/coachmark';\nimport { useGetUserJourney, usePostUserJourney } from '../user-journey-api/user-journey-api';\nimport * as S from './journey-styled';\n\nexport const JourneyContext = createContext<IJourneyContext | null>(null);\n\nexport const JourneyProvider: FC<IJourneyProviderProps> = ({ children, appId, userId }) => {\n const [userCompletedJourneyIds, setUserCompletedJourneyIds] = useState<TJourneyId[]>([]);\n const [coachmarkList, setCoachmarkList] = useState<ICoachmarkProps[]>([]);\n const [isJourneyActive, setIsJourneyActive] = useState(false);\n const currentIndex = useRef(-1);\n const currentJourneyId = useRef<TJourneyId | undefined>();\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const { post: postJourneyCompletion } = usePostUserJourney();\n const {\n data: userCompletedJourneys = null,\n get: getJourneyProgress,\n isProcessing,\n } = useGetUserJourney();\n\n const showCoachmarks =\n appId === '' // Otherwise coachmark stories wont work\n ? coachmarkList.length > 0\n : userCompletedJourneys && !isProcessing && coachmarkList.length > 0;\n\n const setJourney = useCallback(\n (id: TJourneyId, coachmarks: ICoachmarkProps[]) => {\n if (coachmarkList.length > 0) {\n console.error(\n `setJourney: Other Journey is already active, Current Journey: ${currentJourneyId.current}, New Journey Request: ${id}`,\n );\n\n return;\n }\n console.log(`setJourney: Journey ID: ${id}`);\n\n setIsJourneyActive(true);\n currentJourneyId.current = id;\n currentIndex.current = -1;\n setCoachmarkList([...coachmarks]);\n },\n [coachmarkList.length],\n );\n\n const clearJourney = useCallback(() => {\n // Clear all timers\n timerRefs.current.forEach(timer => {\n clearTimeout(timer);\n });\n timerRefs.current = [];\n currentJourneyId.current = undefined;\n currentIndex.current = -1;\n setCoachmarkList([]);\n setIsJourneyActive(false);\n }, []);\n\n const endJourney = useCallback(\n (journeyId: TJourneyId) => {\n setUserCompletedJourneyIds(prev => [...prev, journeyId]);\n postJourneyCompletion({\n app_id: appId,\n user_id: userId,\n journey_id: journeyId,\n journey_status: 'COMPLETED',\n });\n clearJourney();\n },\n [appId, clearJourney, postJourneyCompletion, userId],\n );\n\n const addCoachmark = useCallback((id: TJourneyId, coachmark: ICoachmarkProps) => {\n if (!currentJourneyId.current || id !== currentJourneyId.current) {\n console.error(\n currentJourneyId.current\n ? `A Journey is already active, Current Journey: ${currentJourneyId.current}, New Journey Request: ${id}`\n : `addCoachmark was called before setJourney and Journey ID is undefined`,\n );\n\n return;\n }\n\n setCoachmarkList(prev => [...prev, coachmark]);\n }, []);\n\n const nextCoachmark = useCallback(\n (id: TJourneyId, keepPrevActive: boolean = false, delayInMs: number = 0) => {\n if (!currentJourneyId.current || id !== currentJourneyId.current) {\n console.error(\n currentJourneyId.current\n ? `nextCoachmark was called before setJourney`\n : `A Journey is already active, Current Journey: ${currentJourneyId.current}, New Journey Request: ${id}`,\n );\n\n return;\n }\n\n if (delayInMs !== 0) {\n // If delay is not 0, we will hide all them coachmarks and reveal only after the delay\n setCoachmarkList(prevList => {\n return prevList.map((item: ICoachmarkProps) => {\n return { ...item, isActive: false };\n });\n });\n }\n\n const timer = setTimeout(() => {\n clearTimeout(timer);\n const currIndex = currentIndex.current + 1;\n\n setCoachmarkList(prevList => {\n // Finish onboarding\n if (currIndex >= prevList.length || prevList.length === 0) {\n currentJourneyId.current = undefined;\n currentIndex.current = -1;\n\n return [];\n }\n\n currentIndex.current = currIndex;\n const updatedCoachmarkList = [...prevList];\n\n (updatedCoachmarkList[currIndex] as ICoachmarkProps).isActive = true;\n\n if (currIndex > 0) {\n (updatedCoachmarkList[currIndex - 1] as ICoachmarkProps).isActive = keepPrevActive;\n }\n\n return updatedCoachmarkList;\n });\n }, delayInMs);\n\n timerRefs.current.push(timer);\n },\n [],\n );\n\n const memoizedContextValue: IJourneyContext = useMemo(\n () => ({\n nextCoachmark,\n setJourney,\n addCoachmark,\n clearJourney,\n endJourney,\n coachmarks: coachmarkList,\n userCompletedJourneyIds,\n isJourneyActive,\n }),\n [\n nextCoachmark,\n setJourney,\n addCoachmark,\n clearJourney,\n endJourney,\n coachmarkList,\n userCompletedJourneyIds,\n isJourneyActive,\n ],\n );\n\n // Get the initial state of incompleteJourneys\n useEffect(() => {\n if (appId && userId) {\n getJourneyProgress(userId, {\n app_id: appId,\n user_id: userId,\n journey_status: 'COMPLETED',\n });\n }\n }, [appId, getJourneyProgress, userId]);\n\n // Set the data to context state initially\n useEffect(() => {\n if (userCompletedJourneys) {\n const completedUserJourneysIds = userCompletedJourneys.map(journey => journey.journey_id);\n\n setUserCompletedJourneyIds(completedUserJourneysIds);\n }\n }, [userCompletedJourneys]);\n\n return (\n <JourneyContext.Provider value={memoizedContextValue}>\n {showCoachmarks && (\n <S.Overlay>\n {coachmarkList.map((coachmark, index) => (\n <Coachmark key={`coachmark-${index}`} coachmark={coachmark} />\n ))}\n </S.Overlay>\n )}\n {children}\n </JourneyContext.Provider>\n );\n};\n"],"names":["JourneyContext","createContext","JourneyProvider","children","appId","userId","userCompletedJourneyIds","setUserCompletedJourneyIds","useState","coachmarkList","setCoachmarkList","isJourneyActive","setIsJourneyActive","currentIndex","useRef","currentJourneyId","timerRefs","postJourneyCompletion","usePostUserJourney","userCompletedJourneys","getJourneyProgress","isProcessing","useGetUserJourney","showCoachmarks","setJourney","useCallback","id","coachmarks","clearJourney","timer","endJourney","journeyId","prev","addCoachmark","coachmark","nextCoachmark","keepPrevActive","delayInMs","prevList","item","currIndex","updatedCoachmarkList","memoizedContextValue","useMemo","useEffect","completedUserJourneysIds","journey","jsxs","S.Overlay","index","jsx","Coachmark"],"mappings":";;;;;AAea,MAAAA,IAAiBC,EAAsC,IAAI,GAE3DC,IAA6C,CAAC,EAAE,UAAAC,GAAU,OAAAC,GAAO,QAAAC,QAAa;AACzF,QAAM,CAACC,GAAyBC,CAA0B,IAAIC,EAAuB,CAAE,CAAA,GACjF,CAACC,GAAeC,CAAgB,IAAIF,EAA4B,CAAE,CAAA,GAClE,CAACG,GAAiBC,CAAkB,IAAIJ,EAAS,EAAK,GACtDK,IAAeC,EAAO,EAAE,GACxBC,IAAmBD,KACnBE,IAAYF,EAAwC,CAAA,CAAE,GAEtD,EAAE,MAAMG,EAAsB,IAAIC,EAAmB,GACrD;AAAA,IACJ,MAAMC,IAAwB;AAAA,IAC9B,KAAKC;AAAA,IACL,cAAAC;AAAA,MACEC,EAAkB,GAEhBC,KACJnB,MAAU,MAENe,KAAyB,CAACE,MAAgBZ,EAAc,SAAS,GAEjEe,IAAaC;AAAA,IACjB,CAACC,GAAgBC,MAAkC;AAC7C,UAAAlB,EAAc,SAAS,GAAG;AACpB,gBAAA;AAAA,UACN,iEAAiEM,EAAiB,OAAO,0BAA0BW,CAAE;AAAA,QAAA;AAGvH;AAAA,MACF;AACQ,cAAA,IAAI,2BAA2BA,CAAE,EAAE,GAE3Cd,EAAmB,EAAI,GACvBG,EAAiB,UAAUW,GAC3Bb,EAAa,UAAU,IACNH,EAAA,CAAC,GAAGiB,CAAU,CAAC;AAAA,IAClC;AAAA,IACA,CAA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GAGvB,gBAAA4B,EAAA/C,EAAe,UAAf,EAAwB,OAAO0C,GAC7B,UAAA;AAAA,IAAAnB,uBACEyB,GAAA,EACE,UAAAvC,EAAc,IAAI,CAACyB,GAAWe,MAC7B,gBAAAC,EAACC,KAAqC,WAAAjB,KAAtB,aAAae,CAAK,EAA0B,CAC7D,GACH;AAAA,IAED9C;AAAA,EACH,EAAA,CAAA;AAEJ;"}
1
+ {"version":3,"file":"journey-context-provider.js","sources":["../../../../src/features/journey/use-journey/journey-context-provider.tsx"],"sourcesContent":["/* eslint-disable no-console */\nimport type { TJourneyId } from '../journey-id/journey-id-types';\nimport type {\n ICoachmarkProps,\n IJourneyContext,\n IJourneyProviderProps,\n} from './journey-context-types';\nimport type { FC } from 'react';\n\nimport { createContext, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { Coachmark } from '../comps/coachmark/coachmark';\nimport { useGetUserJourney, usePostUserJourney } from '../user-journey-api/user-journey-api';\nimport * as S from './journey-styled';\n\nexport const JourneyContext = createContext<IJourneyContext | null>(null);\n\nexport const JourneyProvider: FC<IJourneyProviderProps> = ({ children, appId, userId }) => {\n const [userCompletedJourneyIds, setUserCompletedJourneyIds] = useState<TJourneyId[]>([]);\n const [coachmarkList, setCoachmarkList] = useState<ICoachmarkProps[]>([]);\n const [isJourneyActive, setIsJourneyActive] = useState(false);\n const currentIndex = useRef(-1);\n const currentJourneyId = useRef<TJourneyId | undefined>();\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const { post: postJourneyCompletion } = usePostUserJourney();\n const {\n data: userCompletedJourneys = null,\n get: getJourneyProgress,\n isProcessing,\n } = useGetUserJourney();\n\n const showCoachmarks =\n appId === '' // Otherwise coachmark stories wont work\n ? coachmarkList.length > 0\n : userCompletedJourneys && !isProcessing && coachmarkList.length > 0;\n\n const setJourney = useCallback(\n (id: TJourneyId, coachmarks: ICoachmarkProps[]) => {\n if (coachmarkList.length > 0) {\n console.error(\n `setJourney: Other Journey is already active, Current Journey: ${currentJourneyId.current}, New Journey Request: ${id}`,\n );\n\n return;\n }\n setIsJourneyActive(true);\n currentJourneyId.current = id;\n currentIndex.current = -1;\n setCoachmarkList([...coachmarks]);\n },\n [coachmarkList.length],\n );\n\n const clearJourney = useCallback(() => {\n // Clear all timers\n timerRefs.current.forEach(timer => {\n clearTimeout(timer);\n });\n timerRefs.current = [];\n currentJourneyId.current = undefined;\n currentIndex.current = -1;\n setCoachmarkList([]);\n setIsJourneyActive(false);\n }, []);\n\n const endJourney = useCallback(\n (journeyId: TJourneyId) => {\n setUserCompletedJourneyIds(prev => [...prev, journeyId]);\n postJourneyCompletion({\n app_id: appId,\n user_id: userId,\n journey_id: journeyId,\n journey_status: 'COMPLETED',\n });\n clearJourney();\n },\n [appId, clearJourney, postJourneyCompletion, userId],\n );\n\n const addCoachmark = useCallback((id: TJourneyId, coachmark: ICoachmarkProps) => {\n if (!currentJourneyId.current || id !== currentJourneyId.current) {\n console.error(\n currentJourneyId.current\n ? `A Journey is already active, Current Journey: ${currentJourneyId.current}, New Journey Request: ${id}`\n : `addCoachmark was called before setJourney and Journey ID is undefined`,\n );\n\n return;\n }\n\n setCoachmarkList(prev => [...prev, coachmark]);\n }, []);\n\n const nextCoachmark = useCallback(\n (id: TJourneyId, keepPrevActive: boolean = false, delayInMs: number = 0) => {\n if (!currentJourneyId.current || id !== currentJourneyId.current) {\n console.error(\n currentJourneyId.current\n ? `nextCoachmark was called before setJourney`\n : `A Journey is already active, Current Journey: ${currentJourneyId.current}, New Journey Request: ${id}`,\n );\n\n return;\n }\n\n if (delayInMs !== 0) {\n // If delay is not 0, we will hide all them coachmarks and reveal only after the delay\n setCoachmarkList(prevList => {\n return prevList.map((item: ICoachmarkProps) => {\n return { ...item, isActive: false };\n });\n });\n }\n\n const timer = setTimeout(() => {\n clearTimeout(timer);\n const currIndex = currentIndex.current + 1;\n\n setCoachmarkList(prevList => {\n // Finish onboarding\n if (currIndex >= prevList.length || prevList.length === 0) {\n currentJourneyId.current = undefined;\n currentIndex.current = -1;\n\n return [];\n }\n\n currentIndex.current = currIndex;\n const updatedCoachmarkList = [...prevList];\n\n (updatedCoachmarkList[currIndex] as ICoachmarkProps).isActive = true;\n\n if (currIndex > 0) {\n (updatedCoachmarkList[currIndex - 1] as ICoachmarkProps).isActive = keepPrevActive;\n }\n\n return updatedCoachmarkList;\n });\n }, delayInMs);\n\n timerRefs.current.push(timer);\n },\n [],\n );\n\n const memoizedContextValue: IJourneyContext = useMemo(\n () => ({\n nextCoachmark,\n setJourney,\n addCoachmark,\n clearJourney,\n endJourney,\n coachmarks: coachmarkList,\n userCompletedJourneyIds,\n isJourneyActive,\n }),\n [\n nextCoachmark,\n setJourney,\n addCoachmark,\n clearJourney,\n endJourney,\n coachmarkList,\n userCompletedJourneyIds,\n isJourneyActive,\n ],\n );\n\n // Get the initial state of incompleteJourneys\n useEffect(() => {\n if (appId && userId) {\n getJourneyProgress(userId, {\n app_id: appId,\n user_id: userId,\n journey_status: 'COMPLETED',\n });\n }\n }, [appId, getJourneyProgress, userId]);\n\n // Set the data to context state initially\n useEffect(() => {\n if (userCompletedJourneys) {\n const completedUserJourneysIds = userCompletedJourneys.map(journey => journey.journey_id);\n\n setUserCompletedJourneyIds(completedUserJourneysIds);\n }\n }, [userCompletedJourneys]);\n\n return (\n <JourneyContext.Provider value={memoizedContextValue}>\n {showCoachmarks && (\n <S.Overlay>\n {coachmarkList.map((coachmark, index) => (\n <Coachmark key={`coachmark-${index}`} coachmark={coachmark} />\n ))}\n </S.Overlay>\n )}\n {children}\n </JourneyContext.Provider>\n );\n};\n"],"names":["JourneyContext","createContext","JourneyProvider","children","appId","userId","userCompletedJourneyIds","setUserCompletedJourneyIds","useState","coachmarkList","setCoachmarkList","isJourneyActive","setIsJourneyActive","currentIndex","useRef","currentJourneyId","timerRefs","postJourneyCompletion","usePostUserJourney","userCompletedJourneys","getJourneyProgress","isProcessing","useGetUserJourney","showCoachmarks","setJourney","useCallback","id","coachmarks","clearJourney","timer","endJourney","journeyId","prev","addCoachmark","coachmark","nextCoachmark","keepPrevActive","delayInMs","prevList","item","currIndex","updatedCoachmarkList","memoizedContextValue","useMemo","useEffect","completedUserJourneysIds","journey","jsxs","S.Overlay","index","jsx","Coachmark"],"mappings":";;;;;AAea,MAAAA,IAAiBC,EAAsC,IAAI,GAE3DC,IAA6C,CAAC,EAAE,UAAAC,GAAU,OAAAC,GAAO,QAAAC,QAAa;AACzF,QAAM,CAACC,GAAyBC,CAA0B,IAAIC,EAAuB,CAAE,CAAA,GACjF,CAACC,GAAeC,CAAgB,IAAIF,EAA4B,CAAE,CAAA,GAClE,CAACG,GAAiBC,CAAkB,IAAIJ,EAAS,EAAK,GACtDK,IAAeC,EAAO,EAAE,GACxBC,IAAmBD,KACnBE,IAAYF,EAAwC,CAAA,CAAE,GAEtD,EAAE,MAAMG,EAAsB,IAAIC,EAAmB,GACrD;AAAA,IACJ,MAAMC,IAAwB;AAAA,IAC9B,KAAKC;AAAA,IACL,cAAAC;AAAA,MACEC,EAAkB,GAEhBC,KACJnB,MAAU,MAENe,KAAyB,CAACE,MAAgBZ,EAAc,SAAS,GAEjEe,IAAaC;AAAA,IACjB,CAACC,GAAgBC,MAAkC;AAC7C,UAAAlB,EAAc,SAAS,GAAG;AACpB,gBAAA;AAAA,UACN,iEAAiEM,EAAiB,OAAO,0BAA0BW,CAAE;AAAA,QAAA;AAGvH;AAAA,MACF;AACA,MAAAd,EAAmB,EAAI,GACvBG,EAAiB,UAAUW,GAC3Bb,EAAa,UAAU,IACNH,EAAA,CAAC,GAAGiB,CAAU,CAAC;AAAA,IAClC;AAAA,IACA,CAAClB,EAAc,MAAM;AAAA,EAAA,GAGjBmB,IAAeH,EAAY,MAAM;AAE3B,IAAAT,EAAA,QAAQ,QAAQ,CAASa,MAAA;AACjC,mBAAaA,CAAK;AAAA,IAAA,CACnB,GACDb,EAAU,UAAU,IACpBD,EAAiB,UAAU,QAC3BF,EAAa,UAAU,IACvBH,EAAiB,CAA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ED9C;AAAA,EACH,EAAA,CAAA;AAEJ;"}
package/dist/index.d.ts CHANGED
@@ -1107,7 +1107,6 @@ declare interface IGame extends IBaseProject {
1107
1107
  declare interface IGameLauncherProps {
1108
1108
  onSegmentClick: (projectDetail: Game | Puzzle | Lesson | ITableDetails, projectType: ProjectType) => void;
1109
1109
  isLoading?: boolean;
1110
- isError?: boolean;
1111
1110
  data: IProjectData | null;
1112
1111
  defaultIndex?: number;
1113
1112
  journeyId?: TJourneyId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuemath/leap",
3
- "version": "2.8.62-rj-0",
3
+ "version": "2.8.62-rj-3",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"