@cuemath/leap 2.8.62-rj-7 → 2.8.62-rj-0.2

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,40 +1,45 @@
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);
1
+ import { jsxs as k, jsx as e } from "react/jsx-runtime";
2
+ import { memo as z, forwardRef as B, useMemo as p, useRef as C, useState as D, createRef as E, useEffect as d, useCallback as m, useImperativeHandle as F } from "react";
3
+ import R from "../../../../../assets/line-icons/icons/carat-left.js";
4
+ import S from "../../../../../assets/line-icons/icons/carat-right.js";
5
+ import w from "../../../../ui/buttons/icon-button/icon-button.js";
6
+ import A from "../../../../ui/separator/separator.js";
7
+ import { Carousel as H, CarouselWrapper as O, CarouselItemContainer as T, ExtendedFlexView as V, Indicator as W } from "./carousel-styled.js";
8
+ const _ = ({ items: a, defaultIndex: u = 0, onNext: l, onPrev: s, analyticsPrev: h, analyticsNext: y, onItemsRendered: i }, L) => {
9
+ const b = p(() => h, [h]), $ = p(() => y, [y]), I = C(null), f = C(!0), [n, o] = D(u), c = p(() => a.map(() => E()), [a]), g = C(!1);
10
+ d(() => {
11
+ if (g.current) return;
12
+ c.length > 0 && c.every((t) => t.current !== null) && (g.current = !0, i == null || i());
13
+ }, [c, i]);
14
+ const M = m(() => {
15
+ s == null || s(), o((r) => r - 1);
16
+ }, [s]), j = m(() => {
17
+ l == null || l(), o((r) => r + 1);
18
+ }, [l]), x = m((r) => {
19
+ o(r);
15
20
  }, []);
16
- return D(k, () => ({
17
- nextBtnRef: h,
18
- indicatorRefs: I,
19
- currentIndex: o,
21
+ return F(L, () => ({
22
+ nextBtnRef: I,
23
+ indicatorRefs: c,
24
+ currentIndex: n,
20
25
  goToIndex: (r) => {
21
- n(r);
26
+ o(r);
22
27
  }
23
- })), $(() => {
24
- i.current && (i.current = !1);
25
- }, []), $(() => {
26
- n(l);
27
- }, [l]), /* @__PURE__ */ y(M, { children: [
28
+ })), d(() => {
29
+ f.current && (f.current = !1);
30
+ }, []), d(() => {
31
+ o(u);
32
+ }, [u]), /* @__PURE__ */ k(H, { children: [
28
33
  /* @__PURE__ */ e(
29
- S,
34
+ O,
30
35
  {
31
- $translate: o * 100,
32
- $translateDuration: i.current ? 0 : 300,
33
- children: t.map((r, a) => /* @__PURE__ */ e(H, { children: r }, a))
36
+ $translate: n * 100,
37
+ $translateDuration: f.current ? 0 : 300,
38
+ children: a.map((r, t) => /* @__PURE__ */ e(T, { children: r }, t))
34
39
  }
35
40
  ),
36
- t.length > 1 && /* @__PURE__ */ y(
37
- T,
41
+ a.length > 1 && /* @__PURE__ */ k(
42
+ V,
38
43
  {
39
44
  $flexDirection: "row",
40
45
  $alignItems: "center",
@@ -42,44 +47,44 @@ const W = ({ items: t, defaultIndex: l = 0, onNext: s, onPrev: c, analyticsPrev:
42
47
  $position: "absolute",
43
48
  children: [
44
49
  /* @__PURE__ */ e(
45
- R,
50
+ w,
46
51
  {
47
52
  renderAs: "secondary",
48
- Icon: E,
49
- onClick: w,
50
- analyticsLabel: f.analyticsLabel,
51
- analyticsProps: f.analyticsProps,
52
- disabled: o === 0
53
+ Icon: R,
54
+ onClick: M,
55
+ analyticsLabel: b.analyticsLabel,
56
+ analyticsProps: b.analyticsProps,
57
+ disabled: n === 0
53
58
  }
54
59
  ),
55
- /* @__PURE__ */ e(g, { width: 48 }),
56
- t.map((r, a) => /* @__PURE__ */ e(
57
- V,
60
+ /* @__PURE__ */ e(A, { width: 48 }),
61
+ a.map((r, t) => /* @__PURE__ */ e(
62
+ W,
58
63
  {
59
- ref: I[a],
60
- $isActive: a === o,
61
- onClick: () => L(a)
64
+ ref: c[t],
65
+ $isActive: t === n,
66
+ onClick: () => x(t)
62
67
  },
63
- a
68
+ t
64
69
  )),
65
- /* @__PURE__ */ e(g, { width: 48 }),
66
- /* @__PURE__ */ e("div", { ref: h, children: /* @__PURE__ */ e(
67
- R,
70
+ /* @__PURE__ */ e(A, { width: 48 }),
71
+ /* @__PURE__ */ e("div", { ref: I, children: /* @__PURE__ */ e(
72
+ w,
68
73
  {
69
74
  renderAs: "secondary",
70
- Icon: F,
71
- onClick: A,
72
- analyticsLabel: C.analyticsLabel,
73
- analyticsProps: C.analyticsProps,
74
- disabled: o === t.length - 1
75
+ Icon: S,
76
+ onClick: j,
77
+ analyticsLabel: $.analyticsLabel,
78
+ analyticsProps: $.analyticsProps,
79
+ disabled: n === a.length - 1
75
80
  }
76
81
  ) })
77
82
  ]
78
83
  }
79
84
  )
80
85
  ] });
81
- }, Q = j(x(W));
86
+ }, U = z(B(_));
82
87
  export {
83
- Q as Carousel
88
+ U as Carousel
84
89
  };
85
90
  //# 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 {\n memo,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n forwardRef,\n useImperativeHandle,\n createRef,\n} from 'react';\n\nimport CaratLeftIcon from '../../../../../assets/line-icons/icons/carat-left';\nimport CaratRightIcon from '../../../../../assets/line-icons/icons/carat-right';\nimport IconButton from '../../../../ui/buttons/icon-button/icon-button';\nimport Separator from '../../../../ui/separator/separator';\nimport * as Styled from './carousel-styled';\n\nconst CarouselComponent: ForwardRefRenderFunction<ICarouselRefs, ICarouselProps> = (\n { items, defaultIndex = 0, onNext, onPrev, analyticsPrev, analyticsNext },\n ref,\n) => {\n const memoizedAnalyticsPrev = useMemo(() => analyticsPrev, [analyticsPrev]);\n const memoizedAnalyticsNext = useMemo(() => analyticsNext, [analyticsNext]);\n\n const nextBtnRef = useRef<HTMLDivElement>(null);\n const isFirstMount = useRef(true);\n const [currIndex, setCurrIndex] = useState(defaultIndex);\n\n // Create a stable array of refs for indicators\n const indicatorRefs = useMemo(() => items.map(() => createRef<HTMLDivElement>()), [items]);\n\n const handleCarouselPrev = useCallback(() => {\n onPrev?.();\n setCurrIndex(prev => prev - 1);\n }, [onPrev]);\n\n const handleCarouselNext = useCallback(() => {\n onNext?.();\n setCurrIndex(prev => prev + 1);\n }, [onNext]);\n\n const handleCarouselIndicatorClick = useCallback((index: number) => {\n setCurrIndex(index);\n }, []);\n\n useImperativeHandle(ref, () => ({\n nextBtnRef,\n indicatorRefs,\n currentIndex: currIndex,\n goToIndex: (index: number) => {\n setCurrIndex(index);\n },\n }));\n\n useEffect(() => {\n if (isFirstMount.current) {\n isFirstMount.current = false;\n }\n }, []);\n\n // Change index from parent\n useEffect(() => {\n setCurrIndex(defaultIndex);\n }, [defaultIndex]);\n\n return (\n <Styled.Carousel>\n <Styled.CarouselWrapper\n $translate={currIndex * 100}\n $translateDuration={isFirstMount.current ? 0 : 300}\n >\n {items.map((item, index) => (\n <Styled.CarouselItemContainer key={index}>{item}</Styled.CarouselItemContainer>\n ))}\n </Styled.CarouselWrapper>\n\n {items.length > 1 && (\n <Styled.ExtendedFlexView\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $position=\"absolute\"\n >\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratLeftIcon}\n onClick={handleCarouselPrev}\n analyticsLabel={memoizedAnalyticsPrev.analyticsLabel}\n analyticsProps={memoizedAnalyticsPrev.analyticsProps}\n disabled={currIndex === 0}\n />\n <Separator width={48} />\n {items.map((_, index) => (\n <Styled.Indicator\n ref={indicatorRefs[index]}\n $isActive={index === currIndex}\n key={index}\n onClick={() => handleCarouselIndicatorClick(index)}\n />\n ))}\n <Separator width={48} />\n <div ref={nextBtnRef}>\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={handleCarouselNext}\n analyticsLabel={memoizedAnalyticsNext.analyticsLabel}\n analyticsProps={memoizedAnalyticsNext.analyticsProps}\n disabled={currIndex === items.length - 1}\n />\n </div>\n </Styled.ExtendedFlexView>\n )}\n </Styled.Carousel>\n );\n};\n\nexport const Carousel = memo(forwardRef(CarouselComponent));\n"],"names":["CarouselComponent","items","defaultIndex","onNext","onPrev","analyticsPrev","analyticsNext","ref","memoizedAnalyticsPrev","useMemo","memoizedAnalyticsNext","nextBtnRef","useRef","isFirstMount","currIndex","setCurrIndex","useState","indicatorRefs","createRef","handleCarouselPrev","useCallback","prev","handleCarouselNext","handleCarouselIndicatorClick","index","useImperativeHandle","useEffect","jsxs","Styled.Carousel","jsx","Styled.CarouselWrapper","item","Styled.CarouselItemContainer","Styled.ExtendedFlexView","IconButton","CaratLeftIcon","Separator","_","Styled.Indicator","CaratRightIcon","Carousel","memo","forwardRef"],"mappings":";;;;;;;AAqBA,MAAMA,IAA6E,CACjF,EAAE,OAAAC,GAAO,cAAAC,IAAe,GAAG,QAAAC,GAAQ,QAAAC,GAAQ,eAAAC,GAAe,eAAAC,EAAc,GACxEC,MACG;AACH,QAAMC,IAAwBC,EAAQ,MAAMJ,GAAe,CAACA,CAAa,CAAC,GACpEK,IAAwBD,EAAQ,MAAM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BAAA0B;AAAA,MAACM;AAAAA,MAAA;AAAA,QACC,gBAAe;AAAA,QACf,aAAY;AAAA,QACZ,iBAAgB;AAAA,QAChB,WAAU;AAAA,QAEV,UAAA;AAAA,UAAA,gBAAAJ;AAAA,YAACK;AAAA,YAAA;AAAA,cACC,UAAS;AAAA,cACT,MAAMC;AAAA,cACN,SAAShB;AAAA,cACT,gBAAgBX,EAAsB;AAAA,cACtC,gBAAgBA,EAAsB;AAAA,cACtC,UAAUM,MAAc;AAAA,YAAA;AAAA,UAC1B;AAAA,UACA,gBAAAe,EAACO,GAAU,EAAA,OAAO,GAAI,CAAA;AAAA,UACrBnC,EAAM,IAAI,CAACoC,GAAGb,MACb,gBAAAK;AAAA,YAACS;AAAAA,YAAA;AAAA,cACC,KAAKrB,EAAcO,CAAK;AAAA,cACxB,WAAWA,MAAUV;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
+ {"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, onItemsRendered },\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 const indicatorRefs = useMemo(() => items.map(() => createRef<HTMLDivElement>()), [items]);\n\n // only fire once\n const hasRenderedOnce = useRef(false);\n\n useEffect(() => {\n if (hasRenderedOnce.current) return;\n\n // we have an array of refs, make sure every one is in the DOM\n const allMounted = indicatorRefs.length > 0 && indicatorRefs.every(r => r.current !== null);\n\n if (allMounted) {\n hasRenderedOnce.current = true;\n onItemsRendered?.();\n }\n }, [indicatorRefs, onItemsRendered]);\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","onItemsRendered","ref","memoizedAnalyticsPrev","useMemo","memoizedAnalyticsNext","nextBtnRef","useRef","isFirstMount","currIndex","setCurrIndex","useState","indicatorRefs","createRef","hasRenderedOnce","useEffect","r","handleCarouselPrev","useCallback","prev","handleCarouselNext","handleCarouselIndicatorClick","index","useImperativeHandle","jsxs","Styled.Carousel","jsx","Styled.CarouselWrapper","item","Styled.CarouselItemContainer","Styled.ExtendedFlexView","IconButton","CaratLeftIcon","Separator","_","Styled.Indicator","CaratRightIcon","Car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UAAA,gBAAAoB;AAAA,YAACK;AAAA,YAAA;AAAA,cACC,UAAS;AAAA,cACT,MAAMK;AAAA,cACN,SAAShB;AAAA,cACT,gBAAgBf,EAAsB;AAAA,cACtC,gBAAgBA,EAAsB;AAAA,cACtC,UAAUI,MAAcd,EAAM,SAAS;AAAA,YAAA;AAAA,UAAA,GAE3C;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ,EAAA,CAAA;AAEJ,GAEa0C,IAAWC,EAAKC,EAAW7C,CAAiB,CAAC;"}
@@ -1,70 +1,69 @@
1
- import { jsx as m, jsxs as O, Fragment as v } from "react/jsx-runtime";
2
- import { memo as x, useRef as D, useCallback as t, useMemo as N, useEffect as U } from "react";
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { memo as x, useRef as D, useCallback as m, useMemo as V } from "react";
3
3
  import { LOTTIE as Y } from "../../../assets/lottie/lottie.js";
4
- import { JOURNEY_ID_STUDENT as z } from "../../journey/journey-id/journey-id-student.js";
5
- import { useJourney as B } from "../../journey/use-journey/use-journey.js";
6
- import { CircularLoader as K } from "../../ui/loader/circular-loader/circular-loader.js";
7
- import H from "../../ui/lottie-animation/lottie-animation.js";
8
- import { useCircleSounds as Z } from "../hooks/use-circle-sounds/use-circle-sounds.js";
9
- import { CircleSoundKey as n } from "../hooks/use-circle-sounds/use-circle-sounds-enums.js";
10
- import { GAME_LAUNCHER_SIZE as w } from "./comps/card-container/constants.js";
11
- import { Carousel as F } from "./comps/carousel/carousel.js";
12
- import { GAME_LAUNCHER_ASSET_PADDING as X } 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 j } from "./comps/tables-card/tables-card.js";
4
+ import { JOURNEY_ID_STUDENT as E } from "../../journey/journey-id/journey-id-student.js";
5
+ import { useJourney as g } from "../../journey/use-journey/use-journey.js";
6
+ import { CircularLoader as B } from "../../ui/loader/circular-loader/circular-loader.js";
7
+ import K from "../../ui/lottie-animation/lottie-animation.js";
8
+ import { useCircleSounds as H } from "../hooks/use-circle-sounds/use-circle-sounds.js";
9
+ import { CircleSoundKey as u } from "../hooks/use-circle-sounds/use-circle-sounds-enums.js";
10
+ import { GAME_LAUNCHER_SIZE as Z } from "./comps/card-container/constants.js";
11
+ import { Carousel as z } from "./comps/carousel/carousel.js";
12
+ import { GAME_LAUNCHER_ASSET_PADDING as j } from "./comps/segmented-game-card/constants.js";
13
+ import { SegmentedGameCard as a } from "./comps/segmented-game-card/segmented-game-card.js";
14
+ import { TablesCard as w } from "./comps/tables-card/tables-card.js";
15
15
  import { GAME_LAUNCHER_ANALYTICS_EVENTS as G } from "./game-launcher-analytics-events.js";
16
- import { useGameLauncherJourney as q } 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";
18
- import { ProjectType as u } from "../games/web-view/enums/project-type-enum.js";
19
- const V = w + X, Ce = x(
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";
18
+ import { ProjectType as f } from "../games/web-view/enums/project-type-enum.js";
19
+ const S = Z + j, pe = x(
20
20
  ({
21
- onSegmentClick: r,
22
- journeyId: i,
23
- isError: S,
21
+ onSegmentClick: l,
24
22
  data: e,
25
- isLoading: f,
23
+ isLoading: c,
26
24
  isTutorialOnboardingDone: C,
27
- defaultIndex: J = 0
25
+ eligibleJourneyIds: i,
26
+ defaultIndex: M = 0
28
27
  }) => {
29
- const p = D(null), { isJourneyActive: _ } = B(), { playSwipSound: A, play: o } = Z(), c = t(
30
- (l) => {
31
- o(n.GAME_CARD_CLICK), r(l, u.TABLE);
28
+ const t = D(null), { isJourneyActive: _ } = g(), { playSwipSound: L, play: o } = H(), p = m(
29
+ (r) => {
30
+ o(u.GAME_CARD_CLICK), l(r, f.TABLE);
32
31
  },
33
- [r, o]
34
- ), L = t(
35
- (l) => {
36
- l.status !== "completed" && (o(n.GAME_CARD_CLICK), r(l, u.LESSON));
32
+ [l, o]
33
+ ), A = m(
34
+ (r) => {
35
+ r.status !== "completed" && (o(u.GAME_CARD_CLICK), l(r, f.LESSON));
37
36
  },
38
- [r, o]
39
- ), T = t(
40
- (l) => {
41
- o(n.GAME_CARD_CLICK), r(l, u.GAME);
37
+ [l, o]
38
+ ), T = m(
39
+ (r) => {
40
+ o(u.GAME_CARD_CLICK), l(r, f.GAME);
42
41
  },
43
- [r, o]
44
- ), a = t(
45
- (l) => {
46
- o(n.GAME_CARD_CLICK), r(l, u.PUZZLE);
42
+ [l, o]
43
+ ), R = m(
44
+ (r) => {
45
+ o(u.GAME_CARD_CLICK), l(r, f.PUZZLE);
47
46
  },
48
- [r, o]
47
+ [l, o]
49
48
  ), {
50
- gameRefs: b,
51
- lessonRefs: R,
52
- puzzleRefs: I,
53
- startJourney: y
54
- } = q({
55
- carouselRefs: p,
56
- onSegmentClick: r
57
- }), { startJourney: P, tableRef: h } = Q({
58
- carouselRefs: p,
59
- onTableSegmentClick: c
60
- }), M = N(() => {
61
- let l = [];
62
- return e && (e.lessons && (l = [
63
- ...l,
64
- /* @__PURE__ */ m(
65
- E,
49
+ gameRefs: I,
50
+ lessonRefs: y,
51
+ puzzleRefs: b,
52
+ startJourney: N
53
+ } = X({
54
+ carouselRefs: t,
55
+ onSegmentClick: l
56
+ }), { startJourney: P, tableRef: h } = q({
57
+ carouselRefs: t,
58
+ onTableSegmentClick: p
59
+ }), O = V(() => {
60
+ let r = [];
61
+ return e && (e.lessons && (r = [
62
+ ...r,
63
+ /* @__PURE__ */ n(
64
+ a,
66
65
  {
67
- ref: R,
66
+ ref: y,
68
67
  label: e.lessons.label,
69
68
  value: e.lessons.data.filter((s) => s.status === "completed").length,
70
69
  maxValue: e.lessons.data.length,
@@ -73,16 +72,16 @@ const V = w + X, Ce = x(
73
72
  card: s.cardLottie,
74
73
  name: s.name,
75
74
  isCompleted: s.status === "completed",
76
- onPress: () => L(s)
75
+ onPress: () => A(s)
77
76
  }))
78
77
  }
79
78
  )
80
- ]), l = [
81
- ...l,
82
- /* @__PURE__ */ m(
83
- E,
79
+ ]), r = [
80
+ ...r,
81
+ /* @__PURE__ */ n(
82
+ a,
84
83
  {
85
- ref: b,
84
+ ref: I,
86
85
  label: e.games.label,
87
86
  value: e.games.data.filter((s) => s.isPlayed).length,
88
87
  maxValue: e.games.data.length,
@@ -95,10 +94,10 @@ const V = w + X, Ce = x(
95
94
  }))
96
95
  }
97
96
  ),
98
- /* @__PURE__ */ m(
99
- E,
97
+ /* @__PURE__ */ n(
98
+ a,
100
99
  {
101
- ref: I,
100
+ ref: b,
102
101
  label: e.puzzles.label,
103
102
  value: e.puzzles.data.filter((s) => s.solved).length,
104
103
  maxValue: e.puzzles.data.length,
@@ -107,84 +106,102 @@ const V = w + X, Ce = x(
107
106
  card: s.cardLottie,
108
107
  name: s.name,
109
108
  isCompleted: s.solved,
110
- onPress: () => a(s)
109
+ onPress: () => R(s)
111
110
  }))
112
111
  }
113
112
  )
114
- ], e.tables && (l = [
115
- ...l,
116
- /* @__PURE__ */ m(
117
- j,
113
+ ], e.tables && (r = [
114
+ ...r,
115
+ /* @__PURE__ */ n(
116
+ w,
118
117
  {
119
118
  ref: h,
120
119
  label: e.tables.label,
121
120
  data: e.tables.data,
122
- onPress: c,
121
+ onPress: p,
123
122
  openModesOfTable: e.tables.openModesOfTable
124
123
  }
125
124
  )
126
- ])), l;
125
+ ])), r;
127
126
  }, [
128
127
  e,
129
- b,
130
128
  I,
131
- R,
132
- L,
129
+ b,
130
+ y,
131
+ A,
133
132
  T,
134
- a,
133
+ R,
135
134
  h,
136
- c
137
- ]), g = N(
135
+ p
136
+ ]), v = V(
138
137
  () => [
139
- /* @__PURE__ */ m(
140
- H,
138
+ /* @__PURE__ */ n(
139
+ K,
141
140
  {
142
141
  src: Y.SLEEPY_BOI,
143
- width: V,
144
- height: V
142
+ width: S,
143
+ height: S
145
144
  }
146
145
  )
147
146
  ],
148
147
  []
149
- );
150
- return U(() => {
151
- if (!(f || !e || _)) {
152
- if (e != null && e.puzzles && i === z.CIRCLE_ACTIVITIES_INTRO_JOURNEY) {
153
- y(e == null ? void 0 : e.puzzles, !!(e != null && e.lessons), i);
148
+ ), J = m(() => {
149
+ var s;
150
+ const r = (s = t.current) == null ? void 0 : s.indicatorRefs.every(
151
+ (U) => U.current !== null
152
+ );
153
+ if (!(c || !e || _ || !r || i.length === 0)) {
154
+ if (e != null && e.puzzles && i.includes(E.CIRCLE_ACTIVITIES_INTRO_JOURNEY)) {
155
+ N(
156
+ e == null ? void 0 : e.puzzles,
157
+ !!(e != null && e.lessons),
158
+ E.CIRCLE_ACTIVITIES_INTRO_JOURNEY
159
+ );
154
160
  return;
155
161
  }
156
- e != null && e.tables && i === z.CIRCLE_TABLES_INTRO_JOURNEY && P(e == null ? void 0 : e.tables, C);
162
+ e != null && e.tables && i.includes(E.CIRCLE_TABLES_INTRO_JOURNEY) && P(e == null ? void 0 : e.tables, C);
157
163
  }
158
164
  }, [
159
165
  e,
166
+ i,
160
167
  _,
161
- f,
168
+ c,
162
169
  C,
163
- i,
164
- y,
170
+ N,
165
171
  P
166
- ]), /* @__PURE__ */ O(v, { children: [
167
- /* @__PURE__ */ m(
168
- F,
169
- {
170
- ref: p,
171
- items: S ? g : M,
172
- defaultIndex: J,
173
- onNext: A,
174
- onPrev: A,
175
- analyticsNext: {
176
- analyticsLabel: G.NEXT_ACTIVITY
177
- },
178
- analyticsPrev: {
179
- analyticsLabel: G.PREV_ACTIVITY
180
- }
172
+ ]);
173
+ return c ? /* @__PURE__ */ n(B, {}) : e ? /* @__PURE__ */ n(
174
+ z,
175
+ {
176
+ ref: t,
177
+ items: O,
178
+ defaultIndex: M,
179
+ onNext: L,
180
+ onPrev: L,
181
+ onItemsRendered: J,
182
+ analyticsNext: {
183
+ analyticsLabel: G.NEXT_ACTIVITY
184
+ },
185
+ analyticsPrev: {
186
+ analyticsLabel: G.PREV_ACTIVITY
181
187
  }
182
- ),
183
- f && /* @__PURE__ */ m(K, {})
184
- ] });
188
+ }
189
+ ) : /* @__PURE__ */ n(
190
+ z,
191
+ {
192
+ ref: t,
193
+ items: v,
194
+ analyticsNext: {
195
+ analyticsLabel: ""
196
+ },
197
+ analyticsPrev: {
198
+ analyticsLabel: ""
199
+ }
200
+ }
201
+ );
185
202
  }
186
203
  );
187
204
  export {
188
- Ce as GameLauncher
205
+ pe as GameLauncher
189
206
  };
190
207
  //# sourceMappingURL=game-launcher.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"game-launcher.js","sources":["../../../../src/features/circle-games/game-launcher/game-launcher.tsx"],"sourcesContent":["import type { ICarouselRefs } from './comps/carousel/carousel-types';\nimport type { ITableDetails } from './comps/tables-card/tables-card-types';\nimport type {\n Game,\n Lesson,\n Puzzle,\n} from './dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport type { IGameLauncherProps } from './game-launcher-types';\nimport type { FC, ReactNode } from 'react';\n\nimport { memo, useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport { LOTTIE } from '../../../assets/lottie/lottie';\nimport { JOURNEY_ID_STUDENT } from '../../journey/journey-id/journey-id-student';\nimport { useJourney } from '../../journey/use-journey/use-journey';\nimport { CircularLoader } from '../../ui/loader/circular-loader/circular-loader';\nimport LottieAnimation from '../../ui/lottie-animation/lottie-animation';\nimport { ProjectType } from '../games/web-view/enums';\nimport { useCircleSounds } from '../hooks/use-circle-sounds/use-circle-sounds';\nimport { CircleSoundKey } from '../hooks/use-circle-sounds/use-circle-sounds-enums';\nimport { GAME_LAUNCHER_SIZE } from './comps/card-container/constants';\nimport { Carousel } from './comps/carousel/carousel';\nimport { GAME_LAUNCHER_ASSET_PADDING } from './comps/segmented-game-card/constants';\nimport { SegmentedGameCard } from './comps/segmented-game-card/segmented-game-card';\nimport { TablesCard } from './comps/tables-card/tables-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from './game-launcher-analytics-events';\nimport { useGameLauncherJourney } from './hooks/use-game-launcher-journey/use-game-launcher-journey';\nimport { useTableLauncherJourney } from './hooks/use-table-launcher-journey/use-table-launcher-journey';\n\nconst sleepyBoiDimension = GAME_LAUNCHER_SIZE + GAME_LAUNCHER_ASSET_PADDING;\n\nexport const GameLauncher: FC<IGameLauncherProps> = memo(\n ({\n onSegmentClick,\n journeyId,\n isError,\n data,\n isLoading,\n isTutorialOnboardingDone,\n defaultIndex = 0,\n }) => {\n const carouselRefs = useRef<ICarouselRefs>(null);\n\n const { isJourneyActive } = useJourney();\n\n const { playSwipSound, play } = useCircleSounds();\n\n const onTableSegmentClick = useCallback(\n (table: ITableDetails) => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(table, ProjectType.TABLE);\n },\n [onSegmentClick, play],\n );\n\n const handleLessonSegmentClick = useCallback(\n (lesson: Lesson) => {\n if (lesson.status !== 'completed') {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(lesson, ProjectType.LESSON);\n }\n },\n [onSegmentClick, play],\n );\n\n const handleGameSegmentClick = useCallback(\n (game: Game) => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(game, ProjectType.GAME);\n },\n [onSegmentClick, play],\n );\n\n const handlePuzzleSegmentClick = useCallback(\n (puzzle: Puzzle) => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(puzzle, ProjectType.PUZZLE);\n },\n [onSegmentClick, play],\n );\n\n const {\n gameRefs,\n lessonRefs,\n puzzleRefs,\n startJourney: startLessonPuzzleGamesJourney,\n } = useGameLauncherJourney({\n carouselRefs,\n onSegmentClick,\n });\n\n const { startJourney: startTablesJourney, tableRef } = useTableLauncherJourney({\n carouselRefs,\n onTableSegmentClick,\n });\n\n const items = useMemo(() => {\n let itemTypes: ReactNode[] = [];\n\n if (data) {\n if (data.lessons) {\n itemTypes = [\n ...itemTypes,\n <SegmentedGameCard\n ref={lessonRefs}\n label={data.lessons.label}\n value={data.lessons.data.filter(lesson => lesson.status === 'completed').length}\n maxValue={data.lessons.data.length}\n initialValue={data.lessons.initialProgressValue}\n data={data?.lessons.data.map(lesson => ({\n card: lesson.cardLottie,\n name: lesson.name,\n isCompleted: lesson.status === 'completed',\n onPress: () => handleLessonSegmentClick(lesson),\n }))}\n />,\n ];\n }\n\n itemTypes = [\n ...itemTypes,\n <SegmentedGameCard\n ref={gameRefs}\n label={data.games.label}\n value={data.games.data.filter(game => game.isPlayed).length}\n maxValue={data.games.data.length}\n initialValue={data.games.initialProgressValue}\n data={data.games.data.map(game => ({\n card: game.cardLottie,\n name: game.name,\n isCompleted: false,\n onPress: () => handleGameSegmentClick(game),\n }))}\n />,\n <SegmentedGameCard\n ref={puzzleRefs}\n label={data.puzzles.label}\n value={data.puzzles.data.filter(puzzle => puzzle.solved).length}\n maxValue={data.puzzles.data.length}\n initialValue={data.puzzles.initialProgressValue}\n data={data.puzzles.data.map(puzzle => ({\n card: puzzle.cardLottie,\n name: puzzle.name,\n isCompleted: puzzle.solved,\n onPress: () => handlePuzzleSegmentClick(puzzle),\n }))}\n />,\n ];\n\n if (data.tables) {\n itemTypes = [\n ...itemTypes,\n <TablesCard\n ref={tableRef}\n label={data.tables.label}\n data={data.tables.data}\n onPress={onTableSegmentClick}\n openModesOfTable={data.tables.openModesOfTable}\n />,\n ];\n }\n }\n\n return itemTypes;\n }, [\n data,\n gameRefs,\n puzzleRefs,\n lessonRefs,\n handleLessonSegmentClick,\n handleGameSegmentClick,\n handlePuzzleSegmentClick,\n tableRef,\n onTableSegmentClick,\n ]);\n\n const sleepyBoiItem = useMemo(\n () => [\n <LottieAnimation\n src={LOTTIE.SLEEPY_BOI}\n width={sleepyBoiDimension}\n height={sleepyBoiDimension}\n />,\n ],\n [],\n );\n\n // Start game launcher journey only when isLoading has become false and data is available\n useEffect(() => {\n if (isLoading || !data || isJourneyActive) {\n return;\n }\n\n if (data?.puzzles && journeyId === JOURNEY_ID_STUDENT.CIRCLE_ACTIVITIES_INTRO_JOURNEY) {\n startLessonPuzzleGamesJourney(data?.puzzles, !!data?.lessons, journeyId);\n\n return; // CIRCLE_ACTIVITIES_INTRO_JOURNEY has higher priority\n }\n\n if (data?.tables && journeyId === JOURNEY_ID_STUDENT.CIRCLE_TABLES_INTRO_JOURNEY) {\n startTablesJourney(data?.tables, isTutorialOnboardingDone);\n }\n }, [\n data,\n isJourneyActive,\n isLoading,\n isTutorialOnboardingDone,\n journeyId,\n startLessonPuzzleGamesJourney,\n startTablesJourney,\n ]);\n\n return (\n <>\n <Carousel\n ref={carouselRefs}\n items={isError ? sleepyBoiItem : 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 {isLoading && <CircularLoader />}\n </>\n );\n },\n);\n"],"names":["sleepyBoiDimension","GAME_LAUNCHER_SIZE","GAME_LAUNCHER_ASSET_PADDING","GameLauncher","memo","onSegmentClick","journeyId","isError","data","isLoading","isTutorialOnboardingDone","defaultIndex","carouselRefs","useRef","isJourneyActive","useJourney","playSwipSound","play","useCircleSounds","onTableSegmentClick","useCallback","table","CircleSoundKey","ProjectType","handleLessonSegmentClick","lesson","handleGameSegmentClick","game","handlePuzzleSegmentClick","puzzle","gameRefs","lessonRefs","puzzleRefs","startLessonPuzzleGamesJourney","useGameLauncherJourney","startTablesJourney","tableRef","useTableLauncherJourney","items","useMemo","itemTypes","jsx","SegmentedGameCard","TablesCard","sleepyBoiItem","LottieAnimation","LOTTIE","useEffect","JOURNEY_ID_STUDENT","jsxs","Fragment","Carousel","GAME_LAUNCHER_ANALYTICS_EVENTS","CircularLoader"],"mappings":";;;;;;;;;;;;;;;;;;AA6BA,MAAMA,IAA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E;AAAA,QACF;AAEA,QAAIE,KAAA,QAAAA,EAAM,UAAUF,MAAc0C,EAAmB,+BAChCb,EAAA3B,KAAA,gBAAAA,EAAM,QAAQE,CAAwB;AAAA;AAAA,IAC3D,GACC;AAAA,MACDF;AAAA,MACAM;AAAA,MACAL;AAAA,MACAC;AAAA,MACAJ;AAAA,MACA2B;AAAA,MACAE;AAAA,IAAA,CACD,GAIG,gBAAAc,EAAAC,GAAA,EAAA,UAAA;AAAA,MAAA,gBAAAT;AAAA,QAACU;AAAA,QAAA;AAAA,UACC,KAAKvC;AAAA,UACL,OAAOL,IAAUqC,IAAgBN;AAAA,UACjC,cAAA3B;AAAA,UACA,QAAQK;AAAA,UACR,QAAQA;AAAA,UACR,eAAe;AAAA,YACb,gBAAgBoC,EAA+B;AAAA,UACjD;AAAA,UACA,eAAe;AAAA,YACb,gBAAgBA,EAA+B;AAAA,UACjD;AAAA,QAAA;AAAA,MACF;AAAA,MACC3C,uBAAc4C,GAAe,EAAA;AAAA,IAChC,EAAA,CAAA;AAAA,EAEJ;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, useMemo, useRef } from 'react';\n\nimport { LOTTIE } from '../../../assets/lottie/lottie';\nimport { JOURNEY_ID_STUDENT } from '../../journey/journey-id/journey-id-student';\nimport { useJourney } from '../../journey/use-journey/use-journey';\nimport { CircularLoader } from '../../ui/loader/circular-loader/circular-loader';\nimport LottieAnimation from '../../ui/lottie-animation/lottie-animation';\nimport { ProjectType } from '../games/web-view/enums';\nimport { useCircleSounds } from '../hooks/use-circle-sounds/use-circle-sounds';\nimport { CircleSoundKey } from '../hooks/use-circle-sounds/use-circle-sounds-enums';\nimport { GAME_LAUNCHER_SIZE } from './comps/card-container/constants';\nimport { Carousel } from './comps/carousel/carousel';\nimport { GAME_LAUNCHER_ASSET_PADDING } from './comps/segmented-game-card/constants';\nimport { SegmentedGameCard } from './comps/segmented-game-card/segmented-game-card';\nimport { TablesCard } from './comps/tables-card/tables-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from './game-launcher-analytics-events';\nimport { useGameLauncherJourney } from './hooks/use-game-launcher-journey/use-game-launcher-journey';\nimport { useTableLauncherJourney } from './hooks/use-table-launcher-journey/use-table-launcher-journey';\n\nconst sleepyBoiDimension = GAME_LAUNCHER_SIZE + GAME_LAUNCHER_ASSET_PADDING;\n\nexport const GameLauncher: FC<IGameLauncherProps> = memo(\n ({\n onSegmentClick,\n data,\n isLoading,\n isTutorialOnboardingDone,\n eligibleJourneyIds,\n defaultIndex = 0,\n }) => {\n const carouselRefs = useRef<ICarouselRefs>(null);\n\n const { isJourneyActive } = useJourney();\n\n const { playSwipSound, play } = useCircleSounds();\n\n const onTableSegmentClick = useCallback(\n (table: ITableDetails) => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(table, ProjectType.TABLE);\n },\n [onSegmentClick, play],\n );\n\n const handleLessonSegmentClick = useCallback(\n (lesson: Lesson) => {\n if (lesson.status !== 'completed') {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(lesson, ProjectType.LESSON);\n }\n },\n [onSegmentClick, play],\n );\n\n const handleGameSegmentClick = useCallback(\n (game: Game) => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(game, ProjectType.GAME);\n },\n [onSegmentClick, play],\n );\n\n const handlePuzzleSegmentClick = useCallback(\n (puzzle: Puzzle) => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick(puzzle, ProjectType.PUZZLE);\n },\n [onSegmentClick, play],\n );\n\n const {\n gameRefs,\n lessonRefs,\n puzzleRefs,\n startJourney: startLessonPuzzleGamesJourney,\n } = useGameLauncherJourney({\n carouselRefs,\n onSegmentClick,\n });\n\n const { startJourney: startTablesJourney, tableRef } = useTableLauncherJourney({\n carouselRefs,\n onTableSegmentClick,\n });\n\n const items = useMemo(() => {\n let itemTypes: ReactNode[] = [];\n\n if (data) {\n if (data.lessons) {\n itemTypes = [\n ...itemTypes,\n <SegmentedGameCard\n ref={lessonRefs}\n label={data.lessons.label}\n value={data.lessons.data.filter(lesson => lesson.status === 'completed').length}\n maxValue={data.lessons.data.length}\n initialValue={data.lessons.initialProgressValue}\n data={data?.lessons.data.map(lesson => ({\n card: lesson.cardLottie,\n name: lesson.name,\n isCompleted: lesson.status === 'completed',\n onPress: () => handleLessonSegmentClick(lesson),\n }))}\n />,\n ];\n }\n\n itemTypes = [\n ...itemTypes,\n <SegmentedGameCard\n ref={gameRefs}\n label={data.games.label}\n value={data.games.data.filter(game => game.isPlayed).length}\n maxValue={data.games.data.length}\n initialValue={data.games.initialProgressValue}\n data={data.games.data.map(game => ({\n card: game.cardLottie,\n name: game.name,\n isCompleted: false,\n onPress: () => handleGameSegmentClick(game),\n }))}\n />,\n <SegmentedGameCard\n ref={puzzleRefs}\n label={data.puzzles.label}\n value={data.puzzles.data.filter(puzzle => puzzle.solved).length}\n maxValue={data.puzzles.data.length}\n initialValue={data.puzzles.initialProgressValue}\n data={data.puzzles.data.map(puzzle => ({\n card: puzzle.cardLottie,\n name: puzzle.name,\n isCompleted: puzzle.solved,\n onPress: () => handlePuzzleSegmentClick(puzzle),\n }))}\n />,\n ];\n\n if (data.tables) {\n itemTypes = [\n ...itemTypes,\n <TablesCard\n ref={tableRef}\n label={data.tables.label}\n data={data.tables.data}\n onPress={onTableSegmentClick}\n openModesOfTable={data.tables.openModesOfTable}\n />,\n ];\n }\n }\n\n return itemTypes;\n }, [\n data,\n gameRefs,\n puzzleRefs,\n lessonRefs,\n handleLessonSegmentClick,\n handleGameSegmentClick,\n handlePuzzleSegmentClick,\n tableRef,\n onTableSegmentClick,\n ]);\n\n const sleepyBoiItem = useMemo(\n () => [\n <LottieAnimation\n src={LOTTIE.SLEEPY_BOI}\n width={sleepyBoiDimension}\n height={sleepyBoiDimension}\n />,\n ],\n [],\n );\n\n // Start game launcher journey only when isLoading has become false and data is available\n const startJourneys = useCallback(() => {\n const areAllRefsMounted = carouselRefs.current?.indicatorRefs.every(\n ref => ref.current !== null,\n );\n\n if (\n isLoading ||\n !data ||\n isJourneyActive ||\n !areAllRefsMounted ||\n eligibleJourneyIds.length === 0\n ) {\n return;\n }\n\n if (\n data?.puzzles &&\n eligibleJourneyIds.includes(JOURNEY_ID_STUDENT.CIRCLE_ACTIVITIES_INTRO_JOURNEY)\n ) {\n startLessonPuzzleGamesJourney(\n data?.puzzles,\n !!data?.lessons,\n JOURNEY_ID_STUDENT.CIRCLE_ACTIVITIES_INTRO_JOURNEY,\n );\n\n return; // CIRCLE_ACTIVITIES_INTRO_JOURNEY has higher priority\n }\n\n if (\n data?.tables &&\n eligibleJourneyIds.includes(JOURNEY_ID_STUDENT.CIRCLE_TABLES_INTRO_JOURNEY)\n ) {\n startTablesJourney(data?.tables, isTutorialOnboardingDone);\n }\n }, [\n data,\n eligibleJourneyIds,\n isJourneyActive,\n isLoading,\n isTutorialOnboardingDone,\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 onItemsRendered={startJourneys}\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","data","isLoading","isTutorialOnboardingDone","eligibleJourneyIds","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","startJourneys","areAllRefsMounted","_a","ref","JOURNEY_ID_STUDENT","CircularLoader","Carousel","GAME_LAUNCHER_ANALYTICS_EVENTS"],"mappings":";;;;;;;;;;;;;;;;;;AA6BA,MAAMA,IAAqBC,IAAqBC,GAEnCC,KAAuCC;AAAA,EAClD,CAAC;AAAA,IACC,gBAAAC;AAAA,IACA,MAAAC;AAAA,IACA,WAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,cAAAC,IAAe;AAAA,EAAA,MACX;AACE,UAAAC,IAAeC,EAAsB,IAAI,GAEzC,EAAE,iBAAAC,MAAoBC,KAEtB,EAAE,eAAAC,GAAe,MAAAC,EAAK,IAAIC,EAAgB,GAE1CC,IAAsBC;AAAA,MAC1B,CAACC,MAAyB;AACxB,QAAAJ,EAAKK,EAAe,eAAe,GACpBhB,EAAAe,GAAOE,EAAY,KAAK;AAAA,MACzC;AAAA,MACA,CAACjB,GAAgBW,CAAI;AAAA,IAAA,GAGjBO,IAA2BJ;AAAA,MAC/B,CAACK,MAAmB;AACd,QAAAA,EAAO,WAAW,gBACpBR,EAAKK,EAAe,eAAe,GACpBhB,EAAAmB,GAAQF,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ACA,QAAQK;AAAA,QACR,QAAQA;AAAA,QACR,iBAAiB+B;AAAA,QACjB,eAAe;AAAA,UACb,gBAAgBO,EAA+B;AAAA,QACjD;AAAA,QACA,eAAe;AAAA,UACb,gBAAgBA,EAA+B;AAAA,QACjD;AAAA,MAAA;AAAA,IAAA,IA1BA,gBAAAb;AAAA,MAACY;AAAA,MAAA;AAAA,QACC,KAAKzC;AAAA,QACL,OAAOgC;AAAA,QACP,eAAe;AAAA,UACb,gBAAgB;AAAA,QAClB;AAAA,QACA,eAAe;AAAA,UACb,gBAAgB;AAAA,QAClB;AAAA,MAAA;AAAA,IAAA;AAAA,EAqBR;AACF;"}
@@ -1,46 +1,46 @@
1
- import { jsx as r, Fragment as R } from "react/jsx-runtime";
2
- import { useRef as b, useCallback as A, useEffect as Q } from "react";
3
- import ee from "../../../../../assets/line-icons/icons/carat-right.js";
4
- import { PLATFORM_EVENTS_STUDENT as J } from "../../../../analytics-events/platform-events-student.js";
5
- import { JOURNEY_ID_STUDENT as te } from "../../../../journey/journey-id/journey-id-student.js";
1
+ import { jsx as r, Fragment as b } from "react/jsx-runtime";
2
+ import { useRef as O, useCallback as A, useEffect as J } from "react";
3
+ import V from "../../../../../assets/line-icons/icons/carat-right.js";
4
+ import { PLATFORM_EVENTS_STUDENT as U } from "../../../../analytics-events/platform-events-student.js";
5
+ import { JOURNEY_ID_STUDENT as X } from "../../../../journey/journey-id/journey-id-student.js";
6
6
  import { IndicatorType as d } from "../../../../journey/use-journey/constants.js";
7
- import { useJourney as re } from "../../../../journey/use-journey/use-journey.js";
8
- import ne from "../../../../ui/buttons/icon-button/icon-button.js";
9
- import { useUIContext as oe } from "../../../../ui/context/context.js";
10
- import O from "../../../../ui/layout/flex-view.js";
11
- import u from "../../../../ui/text/text.js";
12
- import { CIRCLE_ONBOARDING_ANALYTICS_STEPS as V } from "../../../enum/circle-onboarding-steps.js";
13
- import { useCircleSounds as ie } from "../../../hooks/use-circle-sounds/use-circle-sounds.js";
14
- import { TablesCard as X } from "../../comps/tables-card/tables-card.js";
15
- import { GAME_LAUNCHER_ANALYTICS_EVENTS as ae } from "../../game-launcher-analytics-events.js";
16
- import { SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS as le, SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS as ce, START_ANIMATING_CLONED_ELEM as K, TABLE_CARD_INDEX as j, GO_TO_TABLE_LAUNCHER_DURATION_MS as de, SHOW_CLICK_TABLE_NUDGE_AFTER_MS as se, PUZZLE_CARD_INDEX as ue, SHOW_INITIAL_COACHMARK_AFTER_MS as Z, LESSON_CARD_INDEX as me, SHOW_INITIAL_TOOLTIP_AFTER_MS as ge } from "./constants.js";
17
- import { Indicator as Te } from "./use-table-launcher-journey-styled.js";
18
- const We = ({
19
- carouselRefs: l,
7
+ import { useJourney as K } from "../../../../journey/use-journey/use-journey.js";
8
+ import j from "../../../../ui/buttons/icon-button/icon-button.js";
9
+ import { useUIContext as Z } from "../../../../ui/context/context.js";
10
+ import R from "../../../../ui/layout/flex-view.js";
11
+ import m from "../../../../ui/text/text.js";
12
+ import { CIRCLE_ONBOARDING_ANALYTICS_STEPS as G } from "../../../enum/circle-onboarding-steps.js";
13
+ import { useCircleSounds as q } from "../../../hooks/use-circle-sounds/use-circle-sounds.js";
14
+ import { TablesCard as v } from "../../comps/tables-card/tables-card.js";
15
+ import { GAME_LAUNCHER_ANALYTICS_EVENTS as z } from "../../game-launcher-analytics-events.js";
16
+ import { SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS as Q, SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS as ee, START_ANIMATING_CLONED_ELEM as M, TABLE_CARD_INDEX as $, GO_TO_TABLE_LAUNCHER_DURATION_MS as te, SHOW_CLICK_TABLE_NUDGE_AFTER_MS as re, PUZZLE_CARD_INDEX as ne, SHOW_INITIAL_COACHMARK_AFTER_MS as x, LESSON_CARD_INDEX as oe, SHOW_INITIAL_TOOLTIP_AFTER_MS as ie } from "./constants.js";
17
+ import { Indicator as le } from "./use-table-launcher-journey-styled.js";
18
+ const be = ({
19
+ carouselRefs: a,
20
20
  onTableSegmentClick: N
21
21
  }) => {
22
- const t = te.CIRCLE_TABLES_INTRO_JOURNEY, e = b(null), f = b(null), m = b([]), { playButtonSound: S } = ie(), { nextCoachmark: a, setJourney: C, addCoachmark: s, endJourney: P } = re(), { onEvent: _ } = oe(), L = A(
22
+ const t = X.CIRCLE_TABLES_INTRO_JOURNEY, e = O(null), _ = O(null), T = O([]), { playButtonSound: S } = q(), { nextCoachmark: l, setJourney: C, addCoachmark: u, endJourney: P } = K(), { onEvent: f } = Z(), L = A(
23
23
  (n) => {
24
24
  var c, o;
25
- n && N(n), _(J.ONBOARDING_STEP_COMPLETED, {
26
- step: V.TABLES
25
+ n && N(n), f(U.ONBOARDING_STEP_COMPLETED, {
26
+ step: G.TABLES
27
27
  }), (c = e == null ? void 0 : e.current) == null || c.setLabelVisiblity(!0), (o = e == null ? void 0 : e.current) == null || o.stopLabelAnimation(), P(t);
28
28
  },
29
- [P, t, N, _]
30
- ), y = A(
29
+ [P, t, N, f]
30
+ ), H = A(
31
31
  (n, c) => {
32
- var T, h, p;
33
- if (!((T = e.current) != null && T.segmentedCardWrapperRef.current) || !((h = e.current) != null && h.labelRef.current))
32
+ var g, E, h;
33
+ if (!((g = e.current) != null && g.segmentedCardWrapperRef.current) || !((E = e.current) != null && E.labelRef.current))
34
34
  return;
35
- const o = e.current.labelRef.current.getBoundingClientRect(), i = (p = e.current) == null ? void 0 : p.segmentedCardWrapperRef.current.getBoundingClientRect();
36
- s(t, {
35
+ const o = e.current.labelRef.current.getBoundingClientRect(), i = (h = e.current) == null ? void 0 : h.segmentedCardWrapperRef.current.getBoundingClientRect();
36
+ u(t, {
37
37
  originalElementToHighlightRef: e.current.segmentedCardWrapperRef,
38
38
  isActive: !1,
39
39
  type: d.TOOLTIP,
40
40
  elementToHighlight: /* @__PURE__ */ r(
41
- X,
41
+ v,
42
42
  {
43
- ref: f,
43
+ ref: _,
44
44
  defaultTable: c,
45
45
  label: n.label,
46
46
  data: n.data,
@@ -52,79 +52,69 @@ const We = ({
52
52
  position: "left",
53
53
  backgroundColor: "YELLOW_4",
54
54
  width: 236,
55
- tooltipItem: /* @__PURE__ */ r(O, { children: /* @__PURE__ */ r(u, { $renderAs: "ab2-bold", children: "Each table has 3 levels—clear them and earn 3 stars!" }) }),
55
+ tooltipItem: /* @__PURE__ */ r(R, { children: /* @__PURE__ */ r(m, { $renderAs: "ab2-bold", children: "Each table has 3 levels—clear them and earn 3 stars!" }) }),
56
56
  tooltipXCoOrdinates: 0,
57
57
  tooltipYCoOrdinates: o.height * 0.35
58
58
  }
59
- }), s(t, {
59
+ }), u(t, {
60
60
  originalElementToHighlightRef: e.current.segmentedCardWrapperRef,
61
61
  isActive: !1,
62
62
  type: d.NUDGE,
63
63
  indicator: {
64
64
  nudge: "click",
65
- content: /* @__PURE__ */ r(u, { $renderAs: "ab1", $color: "WHITE", children: "Pick a level" }),
65
+ content: /* @__PURE__ */ r(m, { $renderAs: "ab1", $color: "WHITE", children: "Pick a level" }),
66
66
  nudgePointerX: i.width / 2 + 50,
67
67
  nudgePointerY: i.height * 0.4
68
68
  },
69
- elementToHighlight: /* @__PURE__ */ r(R, {})
70
- }), a(t, !1, le), a(t, !0, ce);
71
- const g = setTimeout(() => {
72
- var E;
73
- clearTimeout(g), (E = f.current) == null || E.startLabelAnimation("YELLOW_4");
74
- }, K);
75
- m.current.push(g);
69
+ elementToHighlight: /* @__PURE__ */ r(b, {})
70
+ }), l(t, !1, Q), l(t, !0, ee);
71
+ const s = setTimeout(() => {
72
+ var p;
73
+ clearTimeout(s), (p = _.current) == null || p.startLabelAnimation("YELLOW_4");
74
+ }, M);
75
+ T.current.push(s);
76
76
  },
77
- [s, L, t, a]
77
+ [u, L, t, l]
78
78
  ), I = A(() => {
79
79
  var o;
80
- S(), (o = l.current) == null || o.goToIndex(j), a(t, !1, de), _(J.ONBOARDING_STEP_VIEWED, {
81
- step: V.TABLES
80
+ S(), (o = a.current) == null || o.goToIndex($), l(t, !1, te), f(U.ONBOARDING_STEP_VIEWED, {
81
+ step: G.TABLES
82
82
  });
83
83
  const n = setTimeout(() => {
84
84
  var i;
85
- clearTimeout(n), (i = e.current) == null || i.setLabelVisiblity(!1), a(t, !0);
86
- }, se);
87
- m.current.push(n);
85
+ clearTimeout(n), (i = e.current) == null || i.setLabelVisiblity(!1), l(t, !0);
86
+ }, re);
87
+ T.current.push(n);
88
88
  const c = setTimeout(() => {
89
89
  var i;
90
- clearTimeout(c), (i = f.current) == null || i.startLabelAnimation("YELLOW_4");
91
- }, K);
92
- m.current.push(c);
93
- }, [l, t, a, S, _]), q = A(
90
+ clearTimeout(c), (i = _.current) == null || i.startLabelAnimation("YELLOW_4");
91
+ }, M);
92
+ T.current.push(c);
93
+ }, [a, t, l, S, f]), w = A(
94
94
  (n, c = !1) => {
95
- var T, h, p, E, H, W, D, B, k, Y, U, G, v, x, w, M, $, F;
96
- const o = (h = (T = l.current) == null ? void 0 : T.indicatorRefs) == null ? void 0 : h[j];
97
- if (!((p = e.current) != null && p.segmentedCardWrapperRef) || !((E = e.current) != null && E.segmentedCardWrapperRef) || !((H = l.current) != null && H.nextBtnRef) || !((W = e.current) != null && W.segmentedCardWrapperRef.current) || !((D = e.current) != null && D.segmentedCardWrapperRef.current) || !((B = l.current) != null && B.nextBtnRef.current) || !o || !o.current) {
98
- console.error(
99
- "Table card ref or carousel ref is not defined. Please check the component tree and ensure that the refs are correctly passed down."
100
- );
95
+ var h, p, y, D, W, Y, k, B;
96
+ const o = (h = a.current) == null ? void 0 : h.indicatorRefs, i = (p = a.current) == null ? void 0 : p.nextBtnRef, s = o == null ? void 0 : o[$];
97
+ if (!((y = e.current) != null && y.segmentedCardWrapperRef.current) || !((D = e.current) != null && D.labelRef.current) || !o || !(i != null && i.current) || !s || !s.current)
101
98
  return;
102
- }
103
- const i = ((Y = (k = e.current) == null ? void 0 : k.labelRef.current) == null ? void 0 : Y.getBoundingClientRect()) || {
104
- width: 0,
105
- height: 0
106
- }, g = ((v = (G = (U = e.current) == null ? void 0 : U.segmentedCardWrapperRef) == null ? void 0 : G.current) == null ? void 0 : v.getBoundingClientRect()) || {
107
- width: 0,
108
- height: 0
109
- };
99
+ const g = e.current.labelRef.current.getBoundingClientRect(), E = (W = e.current) == null ? void 0 : W.segmentedCardWrapperRef.current.getBoundingClientRect();
110
100
  c ? (C(t, [
111
101
  {
112
- originalElementToHighlightRef: o,
102
+ originalElementToHighlightRef: s,
113
103
  isActive: !1,
114
104
  type: d.TOOLTIP,
115
- elementToHighlight: /* @__PURE__ */ r(Te, { $isActive: !1 }),
105
+ elementToHighlight: /* @__PURE__ */ r(le, { $isActive: !1 }),
116
106
  indicator: {
117
107
  position: "bottom",
118
108
  backgroundColor: "YELLOW_4",
119
109
  width: 52,
120
110
  tooltipItem: /* @__PURE__ */ r(
121
- O,
111
+ R,
122
112
  {
123
113
  $position: "absolute",
124
114
  $flexDirection: "row",
125
115
  style: { top: 6, left: 8, cursor: "pointer" },
126
116
  onClick: I,
127
- children: /* @__PURE__ */ r(u, { $renderAs: "ab2-bold", children: "NEW" })
117
+ children: /* @__PURE__ */ r(m, { $renderAs: "ab2-bold", children: "NEW" })
128
118
  }
129
119
  ),
130
120
  tooltipYCoOrdinates: 14
@@ -132,7 +122,7 @@ const We = ({
132
122
  }
133
123
  },
134
124
  {
135
- originalElementToHighlightRef: o,
125
+ originalElementToHighlightRef: s,
136
126
  isActive: !1,
137
127
  type: d.NUDGE,
138
128
  indicator: {
@@ -140,83 +130,83 @@ const We = ({
140
130
  content: "",
141
131
  nudgePointerY: 20
142
132
  },
143
- elementToHighlight: /* @__PURE__ */ r(R, {})
133
+ elementToHighlight: /* @__PURE__ */ r(b, {})
144
134
  }
145
- ]), (M = l.current) == null || M.goToIndex(me), a(t, !1, Z), a(t, !0, ge)) : (C(t, [
135
+ ]), (B = a.current) == null || B.goToIndex(oe), l(t, !1, x), l(t, !0, ie)) : (C(t, [
146
136
  {
147
- originalElementToHighlightRef: (x = l.current) == null ? void 0 : x.nextBtnRef,
137
+ originalElementToHighlightRef: (Y = a.current) == null ? void 0 : Y.nextBtnRef,
148
138
  isActive: !1,
149
139
  type: d.NUDGE,
150
140
  indicator: {
151
141
  nudge: "click",
152
- content: /* @__PURE__ */ r(u, { $renderAs: "ab1", $color: "WHITE", children: "Click to proceed" }),
142
+ content: /* @__PURE__ */ r(m, { $renderAs: "ab1", $color: "WHITE", children: "Click to proceed" }),
153
143
  nudgePointerX: 0,
154
144
  nudgePointerY: 0
155
145
  },
156
146
  elementToHighlight: /* @__PURE__ */ r(
157
- ne,
147
+ j,
158
148
  {
159
149
  renderAs: "secondary",
160
- Icon: ee,
150
+ Icon: V,
161
151
  onClick: I,
162
- analyticsLabel: ae.JOURNEY_NEXT_ACTIVITY
152
+ analyticsLabel: z.JOURNEY_NEXT_ACTIVITY
163
153
  }
164
154
  )
165
155
  }
166
- ]), (w = l.current) == null || w.goToIndex(ue), a(t, !1, Z)), s(t, {
167
- originalElementToHighlightRef: ($ = e.current) == null ? void 0 : $.labelRef,
156
+ ]), (k = a.current) == null || k.goToIndex(ne), l(t, !1, x)), u(t, {
157
+ originalElementToHighlightRef: e.current.labelRef,
168
158
  isActive: !1,
169
159
  type: d.TOOLTIP,
170
- elementToHighlight: /* @__PURE__ */ r(R, {}),
160
+ elementToHighlight: /* @__PURE__ */ r(b, {}),
171
161
  indicator: {
172
162
  position: "right",
173
163
  backgroundColor: "YELLOW_4",
174
164
  width: 264,
175
- tooltipItem: /* @__PURE__ */ r(O, { children: /* @__PURE__ */ r(u, { $renderAs: "ab2-bold", children: "Get faster at multiplication! Practice everyday and become a Tables champ." }) }),
176
- tooltipXCoOrdinates: i.width + 50,
177
- tooltipYCoOrdinates: i.height / 2
165
+ tooltipItem: /* @__PURE__ */ r(R, { children: /* @__PURE__ */ r(m, { $renderAs: "ab2-bold", children: "Get faster at multiplication! Practice everyday and become a Tables champ." }) }),
166
+ tooltipXCoOrdinates: g.width + 50,
167
+ tooltipYCoOrdinates: g.height / 2
178
168
  }
179
- }), s(t, {
180
- originalElementToHighlightRef: (F = e.current) == null ? void 0 : F.segmentedCardWrapperRef,
169
+ }), u(t, {
170
+ originalElementToHighlightRef: e.current.segmentedCardWrapperRef,
181
171
  isActive: !1,
182
172
  type: d.NUDGE,
183
173
  indicator: {
184
174
  nudge: "click",
185
- content: /* @__PURE__ */ r(u, { $renderAs: "ab1", $color: "WHITE", children: "Pick a table to start" }),
186
- nudgePointerX: g.width / 2 + 50,
187
- nudgePointerY: g.height / 2
175
+ content: /* @__PURE__ */ r(m, { $renderAs: "ab1", $color: "WHITE", children: "Pick a table to start" }),
176
+ nudgePointerX: E.width / 2 + 50,
177
+ nudgePointerY: E.height / 2
188
178
  },
189
179
  elementToHighlight: /* @__PURE__ */ r(
190
- X,
180
+ v,
191
181
  {
192
- ref: f,
182
+ ref: _,
193
183
  label: n.label,
194
184
  data: n.data,
195
185
  onPress: () => {
196
186
  },
197
- onPressTableSegment: (z) => y(n, z)
187
+ onPressTableSegment: (F) => H(n, F)
198
188
  }
199
189
  )
200
190
  });
201
191
  },
202
192
  [
203
- s,
204
- l,
193
+ u,
194
+ a,
205
195
  I,
206
- y,
196
+ H,
207
197
  t,
208
- a,
198
+ l,
209
199
  C
210
200
  ]
211
201
  );
212
- return Q(() => () => {
213
- m.current.forEach((n) => clearTimeout(n)), m.current = [];
202
+ return J(() => () => {
203
+ T.current.forEach((n) => clearTimeout(n)), T.current = [];
214
204
  }, [t]), {
215
205
  tableRef: e,
216
- startJourney: q
206
+ startJourney: w
217
207
  };
218
208
  };
219
209
  export {
220
- We as useTableLauncherJourney
210
+ be as useTableLauncherJourney
221
211
  };
222
212
  //# 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 no-console */\n/* eslint-disable react-native/no-inline-styles */\nimport type { IArrowTooltipProps } from '../../../../ui/arrow-tooltip/arrow-tooltip-types';\nimport type { INudgeProps } from '../../../../ui/nudge/nudge-types';\nimport type { ITableCardRef, ITableDetails } from '../../comps/tables-card/tables-card-types';\nimport type {\n ITableInfo,\n ITables,\n} from '../../dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport type { IUseTableJourneyProps } from './use-table-launcher-journey-types';\n\nimport { useCallback, useEffect, useRef } from 'react';\n\nimport CaratRightIcon from '../../../../../assets/line-icons/icons/carat-right';\nimport { PLATFORM_EVENTS_STUDENT } from '../../../../analytics-events/platform-events-student';\nimport { JOURNEY_ID_STUDENT } from '../../../../journey/journey-id/journey-id-student';\nimport { IndicatorType } from '../../../../journey/use-journey/constants';\nimport { useJourney } from '../../../../journey/use-journey/use-journey';\nimport IconButton from '../../../../ui/buttons/icon-button/icon-button';\nimport { useUIContext } from '../../../../ui/context/context';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport { CIRCLE_ONBOARDING_ANALYTICS_STEPS as Action } from '../../../enum/circle-onboarding-steps';\nimport { useCircleSounds } from '../../../hooks/use-circle-sounds/use-circle-sounds';\nimport { TablesCard } from '../../comps/tables-card/tables-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from '../../game-launcher-analytics-events';\nimport {\n LESSON_CARD_INDEX,\n PUZZLE_CARD_INDEX,\n SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS,\n SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS,\n TABLE_CARD_INDEX,\n} from './constants';\nimport {\n GO_TO_TABLE_LAUNCHER_DURATION_MS,\n SHOW_CLICK_TABLE_NUDGE_AFTER_MS,\n SHOW_INITIAL_COACHMARK_AFTER_MS,\n SHOW_INITIAL_TOOLTIP_AFTER_MS,\n START_ANIMATING_CLONED_ELEM,\n} from './constants';\nimport * as S from './use-table-launcher-journey-styled';\n\nexport const useTableLauncherJourney = ({\n carouselRefs,\n onTableSegmentClick,\n}: IUseTableJourneyProps) => {\n const journeyId = JOURNEY_ID_STUDENT.CIRCLE_TABLES_INTRO_JOURNEY;\n const originalTableRef = useRef<ITableCardRef>(null);\n const highlightedTableRef = useRef<ITableCardRef>(null);\n\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const { playButtonSound } = useCircleSounds();\n const { nextCoachmark, setJourney, addCoachmark, endJourney } = useJourney();\n const { onEvent: trackAnalytics } = useUIContext();\n\n const handleEndJourney = useCallback(\n (tableDetails?: ITableDetails) => {\n // Only when User clicked on play\n if (tableDetails) {\n onTableSegmentClick(tableDetails);\n }\n trackAnalytics(PLATFORM_EVENTS_STUDENT.ONBOARDING_STEP_COMPLETED, {\n step: Action.TABLES,\n });\n\n // Reset original table card ref label\n originalTableRef?.current?.setLabelVisiblity(true);\n originalTableRef?.current?.stopLabelAnimation();\n endJourney(journeyId);\n },\n [endJourney, journeyId, onTableSegmentClick, trackAnalytics],\n );\n\n const handleTableSegmentClick = useCallback(\n (launcherData: ITables, tableData: ITableInfo) => {\n if (\n !originalTableRef.current?.segmentedCardWrapperRef.current ||\n !originalTableRef.current?.labelRef.current\n ) {\n return;\n }\n\n const segmentedCardDims = originalTableRef.current.labelRef.current.getBoundingClientRect();\n const tableCardDims =\n originalTableRef.current?.segmentedCardWrapperRef.current.getBoundingClientRect();\n\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: (\n <TablesCard\n ref={highlightedTableRef}\n defaultTable={tableData}\n label={launcherData.label}\n data={launcherData.data}\n onPress={handleEndJourney}\n onGoBackFromTableLevel={handleEndJourney}\n />\n ),\n indicator: {\n position: 'left',\n backgroundColor: 'YELLOW_4',\n width: 236,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">Each table has 3 levels—clear them and earn 3 stars!</Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: 0,\n tooltipYCoOrdinates: segmentedCardDims.height * 0.35,\n } as IArrowTooltipProps,\n });\n\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Pick a level\n </Text>\n ),\n nudgePointerX: tableCardDims.width / 2 + 50,\n nudgePointerY: tableCardDims.height * 0.4,\n } as INudgeProps,\n elementToHighlight: <></>,\n });\n\n nextCoachmark(journeyId, false, SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS); // Show coachmark => Each table has 3... and Hide the previous two\n nextCoachmark(journeyId, true, SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS); // Show nudge => Pick a level\n\n const startAnimationOnLabelAgain = setTimeout(() => {\n clearTimeout(startAnimationOnLabelAgain);\n highlightedTableRef.current?.startLabelAnimation('YELLOW_4');\n }, START_ANIMATING_CLONED_ELEM);\n\n timerRefs.current.push(startAnimationOnLabelAgain);\n },\n [addCoachmark, handleEndJourney, journeyId, nextCoachmark],\n );\n\n const goToTableLauncher = useCallback(() => {\n playButtonSound();\n carouselRefs.current?.goToIndex(TABLE_CARD_INDEX);\n nextCoachmark(journeyId, false, GO_TO_TABLE_LAUNCHER_DURATION_MS);\n\n trackAnalytics(PLATFORM_EVENTS_STUDENT.ONBOARDING_STEP_VIEWED, {\n step: Action.TABLES,\n });\n\n const showNudge = setTimeout(() => {\n clearTimeout(showNudge);\n originalTableRef.current?.setLabelVisiblity(false);\n nextCoachmark(journeyId, true);\n }, SHOW_CLICK_TABLE_NUDGE_AFTER_MS);\n\n timerRefs.current.push(showNudge);\n\n const animateLabel = setTimeout(() => {\n clearTimeout(animateLabel);\n highlightedTableRef.current?.startLabelAnimation('YELLOW_4');\n }, START_ANIMATING_CLONED_ELEM);\n\n timerRefs.current.push(animateLabel);\n }, [carouselRefs, journeyId, nextCoachmark, playButtonSound, trackAnalytics]);\n\n const startJourney = useCallback(\n (tablesData: ITables, isTutorialOnboardingDone: boolean = false) => {\n const tablePaginationRef = carouselRefs.current?.indicatorRefs?.[TABLE_CARD_INDEX];\n\n if (\n !originalTableRef.current?.segmentedCardWrapperRef ||\n !originalTableRef.current?.segmentedCardWrapperRef ||\n !carouselRefs.current?.nextBtnRef ||\n !originalTableRef.current?.segmentedCardWrapperRef.current ||\n !originalTableRef.current?.segmentedCardWrapperRef.current ||\n !carouselRefs.current?.nextBtnRef.current ||\n !tablePaginationRef ||\n !tablePaginationRef.current\n ) {\n console.error(\n 'Table card ref or carousel ref is not defined. Please check the component tree and ensure that the refs are correctly passed down.',\n );\n\n return;\n }\n\n const labelDims = originalTableRef.current?.labelRef.current?.getBoundingClientRect() || {\n width: 0,\n height: 0,\n };\n const tableCardDims =\n originalTableRef.current?.segmentedCardWrapperRef?.current?.getBoundingClientRect() || {\n width: 0,\n height: 0,\n };\n\n // TAKE THE USER TO THE TABLE CARD\n if (!isTutorialOnboardingDone) {\n setJourney(journeyId, [\n {\n originalElementToHighlightRef: carouselRefs.current?.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to proceed\n </Text>\n ),\n nudgePointerX: 0,\n nudgePointerY: 0,\n } as INudgeProps,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={goToTableLauncher}\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\n },\n ]);\n carouselRefs.current?.goToIndex(PUZZLE_CARD_INDEX);\n nextCoachmark(journeyId, false, SHOW_INITIAL_COACHMARK_AFTER_MS); // Show nudge => Click to proceed\n } else {\n setJourney(journeyId, [\n {\n originalElementToHighlightRef: tablePaginationRef as React.RefObject<HTMLDivElement>,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <S.Indicator $isActive={false} />,\n indicator: {\n position: 'bottom',\n backgroundColor: 'YELLOW_4',\n width: 52,\n tooltipItem: (\n <FlexView\n $position=\"absolute\"\n $flexDirection=\"row\"\n style={{ top: 6, left: 8, cursor: 'pointer' }}\n onClick={goToTableLauncher}\n >\n <Text $renderAs=\"ab2-bold\">NEW</Text>\n </FlexView>\n ),\n tooltipYCoOrdinates: 14, // Need some offset in Y direction from top\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: tablePaginationRef as React.RefObject<HTMLDivElement>,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: '',\n nudgePointerY: 20,\n } as INudgeProps,\n elementToHighlight: <></>,\n },\n ]);\n carouselRefs.current?.goToIndex(LESSON_CARD_INDEX);\n nextCoachmark(journeyId, false, SHOW_INITIAL_COACHMARK_AFTER_MS); // Show Coachmark => NEW\n nextCoachmark(journeyId, true, SHOW_INITIAL_TOOLTIP_AFTER_MS); // Show Nudge over Coachmark\n }\n\n // SHOW THE USER SELECT A TABLE\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current?.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'YELLOW_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Get faster at multiplication! Practice everyday and become a Tables champ.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: labelDims.width + 50,\n tooltipYCoOrdinates: labelDims.height / 2,\n } as IArrowTooltipProps,\n });\n\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current?.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n {'Pick a table to start'}\n </Text>\n ),\n nudgePointerX: tableCardDims.width / 2 + 50,\n nudgePointerY: tableCardDims.height / 2,\n } as INudgeProps,\n elementToHighlight: (\n <TablesCard\n ref={highlightedTableRef}\n label={tablesData.label}\n data={tablesData.data}\n onPress={() => {}}\n onPressTableSegment={tableInfo => handleTableSegmentClick(tablesData, tableInfo)}\n />\n ),\n });\n },\n [\n addCoachmark,\n carouselRefs,\n goToTableLauncher,\n handleTableSegmentClick,\n journeyId,\n nextCoachmark,\n setJourney,\n ],\n );\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n timerRefs.current.forEach(timer => clearTimeout(timer));\n timerRefs.current = [];\n };\n }, [journeyId]);\n\n return {\n tableRef: originalTableRef,\n startJourney,\n };\n};\n"],"names":["useTableLauncherJourney","carouselRefs","onTableSegmentClick","journeyId","JOURNEY_ID_STUDENT","originalTableRef","useRef","highlightedTableRef","timerRefs","playButtonSound","useCircleSounds","nextCoachmark","setJourney","addCoachmark","endJourney","useJourney","trackAnalytics","useUIContext","handleEndJourney","useCallback","tableDetails","PLATFORM_EVENTS_STUDENT","Action","_a","_b","handleTableSegmentClick","launcherData","tableData","segmentedCardDims","tableCardDims","_c","IndicatorType","jsx","TablesCard","FlexView","Text","Fragment","SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS","SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS","startAnimationOnLabelAgain","START_ANIMATING_CLONED_ELEM","goToTableLauncher","TABLE_CARD_INDEX","GO_TO_TABLE_LAUNCHER_DURATION_MS","showNudge","SHOW_CLICK_TABLE_NUDGE_AFTER_MS","animateLabel","startJourney","tablesData","isTutorialOnboardingDone","tablePaginationRef","_d","_e","_f","_g","_h","labelDims","_j","_i","_m","_l","_k","S.Indicator","_p","LESSON_CARD_INDEX","SHOW_INITIAL_COACHMARK_AFTER_MS","SHOW_INITIAL_TOOLTIP_AFTER_MS","_n","IconButton","CaratRightIcon","GAME_LAUNCHER_ANALYTICS_EVENTS","_o","PUZZLE_CARD_INDEX","_q","_r","tableInfo","useEffect","timer"],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KAAK1B;AAAA,YACL,OAAOyC,EAAW;AAAA,YAClB,MAAMA,EAAW;AAAA,YACjB,SAAS,MAAM;AAAA,YAAC;AAAA,YAChB,qBAAqB,CAAA2B,MAAalD,EAAwBuB,GAAY2B,CAAS;AAAA,UAAA;AAAA,QACjF;AAAA,MAAA,CAEH;AAAA,IACH;AAAA,IACA;AAAA,MACE9D;AAAA,MACAZ;AAAA,MACAwC;AAAA,MACAhB;AAAA,MACAtB;AAAA,MACAQ;AAAA,MACAC;AAAA,IACF;AAAA,EAAA;AAIF,SAAAgE,EAAU,MACD,MAAM;AACX,IAAApE,EAAU,QAAQ,QAAQ,CAASqE,MAAA,aAAaA,CAAK,CAAC,GACtDrE,EAAU,UAAU;EAAC,GAEtB,CAACL,CAAS,CAAC,GAEP;AAAA,IACL,UAAUE;AAAA,IACV,cAAA0C;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"use-table-launcher-journey.js","sources":["../../../../../../src/features/circle-games/game-launcher/hooks/use-table-launcher-journey/use-table-launcher-journey.tsx"],"sourcesContent":["/* eslint-disable react-native/no-inline-styles */\nimport type { IArrowTooltipProps } from '../../../../ui/arrow-tooltip/arrow-tooltip-types';\nimport type { INudgeProps } from '../../../../ui/nudge/nudge-types';\nimport type { ITableCardRef, ITableDetails } from '../../comps/tables-card/tables-card-types';\nimport type {\n ITableInfo,\n ITables,\n} from '../../dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport type { IUseTableJourneyProps } from './use-table-launcher-journey-types';\n\nimport { useCallback, useEffect, useRef } from 'react';\n\nimport CaratRightIcon from '../../../../../assets/line-icons/icons/carat-right';\nimport { PLATFORM_EVENTS_STUDENT } from '../../../../analytics-events/platform-events-student';\nimport { JOURNEY_ID_STUDENT } from '../../../../journey/journey-id/journey-id-student';\nimport { IndicatorType } from '../../../../journey/use-journey/constants';\nimport { useJourney } from '../../../../journey/use-journey/use-journey';\nimport IconButton from '../../../../ui/buttons/icon-button/icon-button';\nimport { useUIContext } from '../../../../ui/context/context';\nimport FlexView from '../../../../ui/layout/flex-view';\nimport Text from '../../../../ui/text/text';\nimport { CIRCLE_ONBOARDING_ANALYTICS_STEPS as Action } from '../../../enum/circle-onboarding-steps';\nimport { useCircleSounds } from '../../../hooks/use-circle-sounds/use-circle-sounds';\nimport { TablesCard } from '../../comps/tables-card/tables-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from '../../game-launcher-analytics-events';\nimport {\n LESSON_CARD_INDEX,\n PUZZLE_CARD_INDEX,\n SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS,\n SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS,\n TABLE_CARD_INDEX,\n} from './constants';\nimport {\n GO_TO_TABLE_LAUNCHER_DURATION_MS,\n SHOW_CLICK_TABLE_NUDGE_AFTER_MS,\n SHOW_INITIAL_COACHMARK_AFTER_MS,\n SHOW_INITIAL_TOOLTIP_AFTER_MS,\n START_ANIMATING_CLONED_ELEM,\n} from './constants';\nimport * as S from './use-table-launcher-journey-styled';\n\nexport const useTableLauncherJourney = ({\n carouselRefs,\n onTableSegmentClick,\n}: IUseTableJourneyProps) => {\n const journeyId = JOURNEY_ID_STUDENT.CIRCLE_TABLES_INTRO_JOURNEY;\n const originalTableRef = useRef<ITableCardRef>(null);\n const highlightedTableRef = useRef<ITableCardRef>(null);\n\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const { playButtonSound } = useCircleSounds();\n const { nextCoachmark, setJourney, addCoachmark, endJourney } = useJourney();\n const { onEvent: trackAnalytics } = useUIContext();\n\n const handleEndJourney = useCallback(\n (tableDetails?: ITableDetails) => {\n // Only when User clicked on play\n if (tableDetails) {\n onTableSegmentClick(tableDetails);\n }\n trackAnalytics(PLATFORM_EVENTS_STUDENT.ONBOARDING_STEP_COMPLETED, {\n step: Action.TABLES,\n });\n\n // Reset original table card ref label\n originalTableRef?.current?.setLabelVisiblity(true);\n originalTableRef?.current?.stopLabelAnimation();\n endJourney(journeyId);\n },\n [endJourney, journeyId, onTableSegmentClick, trackAnalytics],\n );\n\n const handleTableSegmentClick = useCallback(\n (launcherData: ITables, tableData: ITableInfo) => {\n if (\n !originalTableRef.current?.segmentedCardWrapperRef.current ||\n !originalTableRef.current?.labelRef.current\n ) {\n return;\n }\n\n const segmentedCardDims = originalTableRef.current.labelRef.current.getBoundingClientRect();\n const tableCardDims =\n originalTableRef.current?.segmentedCardWrapperRef.current.getBoundingClientRect();\n\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: (\n <TablesCard\n ref={highlightedTableRef}\n defaultTable={tableData}\n label={launcherData.label}\n data={launcherData.data}\n onPress={handleEndJourney}\n onGoBackFromTableLevel={handleEndJourney}\n />\n ),\n indicator: {\n position: 'left',\n backgroundColor: 'YELLOW_4',\n width: 236,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">Each table has 3 levels—clear them and earn 3 stars!</Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: 0,\n tooltipYCoOrdinates: segmentedCardDims.height * 0.35,\n } as IArrowTooltipProps,\n });\n\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Pick a level\n </Text>\n ),\n nudgePointerX: tableCardDims.width / 2 + 50,\n nudgePointerY: tableCardDims.height * 0.4,\n } as INudgeProps,\n elementToHighlight: <></>,\n });\n\n nextCoachmark(journeyId, false, SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS); // Show coachmark => Each table has 3... and Hide the previous two\n nextCoachmark(journeyId, true, SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS); // Show nudge => Pick a level\n\n const startAnimationOnLabelAgain = setTimeout(() => {\n clearTimeout(startAnimationOnLabelAgain);\n highlightedTableRef.current?.startLabelAnimation('YELLOW_4');\n }, START_ANIMATING_CLONED_ELEM);\n\n timerRefs.current.push(startAnimationOnLabelAgain);\n },\n [addCoachmark, handleEndJourney, journeyId, nextCoachmark],\n );\n\n const goToTableLauncher = useCallback(() => {\n playButtonSound();\n carouselRefs.current?.goToIndex(TABLE_CARD_INDEX);\n nextCoachmark(journeyId, false, GO_TO_TABLE_LAUNCHER_DURATION_MS);\n\n trackAnalytics(PLATFORM_EVENTS_STUDENT.ONBOARDING_STEP_VIEWED, {\n step: Action.TABLES,\n });\n\n const showNudge = setTimeout(() => {\n clearTimeout(showNudge);\n originalTableRef.current?.setLabelVisiblity(false);\n nextCoachmark(journeyId, true);\n }, SHOW_CLICK_TABLE_NUDGE_AFTER_MS);\n\n timerRefs.current.push(showNudge);\n\n const animateLabel = setTimeout(() => {\n clearTimeout(animateLabel);\n highlightedTableRef.current?.startLabelAnimation('YELLOW_4');\n }, START_ANIMATING_CLONED_ELEM);\n\n timerRefs.current.push(animateLabel);\n }, [carouselRefs, journeyId, nextCoachmark, playButtonSound, trackAnalytics]);\n\n const startJourney = useCallback(\n (tablesData: ITables, isTutorialOnboardingDone: boolean = false) => {\n const paginationList = carouselRefs.current?.indicatorRefs;\n const carouselNextBtnRef = carouselRefs.current?.nextBtnRef;\n const tablePaginationRef = paginationList?.[TABLE_CARD_INDEX];\n\n if (\n !originalTableRef.current?.segmentedCardWrapperRef.current ||\n !originalTableRef.current?.labelRef.current ||\n !paginationList ||\n !carouselNextBtnRef?.current ||\n !tablePaginationRef ||\n !tablePaginationRef.current\n ) {\n return;\n }\n\n const labelDims = originalTableRef.current.labelRef.current.getBoundingClientRect();\n const tableCardDims =\n originalTableRef.current?.segmentedCardWrapperRef.current.getBoundingClientRect();\n\n // TAKE THE USER TO THE TABLE CARD\n if (!isTutorialOnboardingDone) {\n setJourney(journeyId, [\n {\n originalElementToHighlightRef: carouselRefs.current?.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to proceed\n </Text>\n ),\n nudgePointerX: 0,\n nudgePointerY: 0,\n } as INudgeProps,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={goToTableLauncher}\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\n },\n ]);\n carouselRefs.current?.goToIndex(PUZZLE_CARD_INDEX);\n nextCoachmark(journeyId, false, SHOW_INITIAL_COACHMARK_AFTER_MS); // Show nudge => Click to proceed\n } else {\n setJourney(journeyId, [\n {\n originalElementToHighlightRef: tablePaginationRef as React.RefObject<HTMLDivElement>,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <S.Indicator $isActive={false} />,\n indicator: {\n position: 'bottom',\n backgroundColor: 'YELLOW_4',\n width: 52,\n tooltipItem: (\n <FlexView\n $position=\"absolute\"\n $flexDirection=\"row\"\n style={{ top: 6, left: 8, cursor: 'pointer' }}\n onClick={goToTableLauncher}\n >\n <Text $renderAs=\"ab2-bold\">NEW</Text>\n </FlexView>\n ),\n tooltipYCoOrdinates: 14, // Need some offset in Y direction from top\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: tablePaginationRef as React.RefObject<HTMLDivElement>,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: '',\n nudgePointerY: 20,\n } as INudgeProps,\n elementToHighlight: <></>,\n },\n ]);\n carouselRefs.current?.goToIndex(LESSON_CARD_INDEX);\n nextCoachmark(journeyId, false, SHOW_INITIAL_COACHMARK_AFTER_MS); // Show Coachmark => NEW\n nextCoachmark(journeyId, true, SHOW_INITIAL_TOOLTIP_AFTER_MS); // Show Nudge over Coachmark\n }\n\n // SHOW THE USER SELECT A TABLE\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'YELLOW_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Get faster at multiplication! Practice everyday and become a Tables champ.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: labelDims.width + 50,\n tooltipYCoOrdinates: labelDims.height / 2,\n } as IArrowTooltipProps,\n });\n\n addCoachmark(journeyId, {\n originalElementToHighlightRef: originalTableRef.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n {'Pick a table to start'}\n </Text>\n ),\n nudgePointerX: tableCardDims.width / 2 + 50,\n nudgePointerY: tableCardDims.height / 2,\n } as INudgeProps,\n elementToHighlight: (\n <TablesCard\n ref={highlightedTableRef}\n label={tablesData.label}\n data={tablesData.data}\n onPress={() => {}}\n onPressTableSegment={tableInfo => handleTableSegmentClick(tablesData, tableInfo)}\n />\n ),\n });\n },\n [\n addCoachmark,\n carouselRefs,\n goToTableLauncher,\n handleTableSegmentClick,\n journeyId,\n nextCoachmark,\n setJourney,\n ],\n );\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n timerRefs.current.forEach(timer => clearTimeout(timer));\n timerRefs.current = [];\n };\n }, [journeyId]);\n\n return {\n tableRef: originalTableRef,\n startJourney,\n };\n};\n"],"names":["useTableLauncherJourney","carouselRefs","onTableSegmentClick","journeyId","JOURNEY_ID_STUDENT","originalTableRef","useRef","highlightedTableRef","timerRefs","playButtonSound","useCircleSounds","nextCoachmark","setJourney","addCoachmark","endJourney","useJourney","trackAnalytics","useUIContext","handleEndJourney","useCallback","tableDetails","PLATFORM_EVENTS_STUDENT","Action","_a","_b","handleTableSegmentClick","launcherData","tableData","segmentedCardDims","tableCardDims","_c","IndicatorType","jsx","TablesCard","FlexView","Text","Fragment","SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS","SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS","startAnimationOnLabelAgain","START_ANIMATING_CLONED_ELEM","goToTableLauncher","TABLE_CARD_INDEX","GO_TO_TABLE_LAUNCHER_DURATION_MS","showNudge","SHOW_CLICK_TABLE_NUDGE_AFTER_MS","animateLabel","startJourney","tablesData","isTutorialOnboardingDone","paginationList","carouselNextBtnRef","tablePaginationRef","_d","labelDims","_e","S.Indicator","_h","LESSON_CARD_INDEX","SHOW_INITIAL_COACHMARK_AFTER_MS","SHOW_INITIAL_TOOLTIP_AFTER_MS","_f","IconButton","CaratRightIcon","GAME_LAUNCHER_ANALYTICS_EVENTS","_g","PUZZLE_CARD_INDEX","tableInfo","useEffect","timer"],"mappings":";;;;;;;;;;;;;;;;;AAyCO,MAAMA,KAA0B,CAAC;AAAA,EACtC,cAAAC;AAAA,EACA,qBAAAC;AACF,MAA6B;AAC3B,QAAMC,IAAYC,EAAmB,6BAC/BC,IAAmBC,EAAsB,IAAI,GAC7CC,IAAsBD,EAAsB,IAAI,GAEhDE,IAAYF,EAAwC,CAAA,CAAE,GAEtD,EAAE,iBAAAG,MAAoBC,KACtB,EAAE,eAAAC,GAAe,YAAAC,GAAY,cAAAC,GAAc,YAAAC,EAAA,IAAeC,KAC1D,EAAE,SAASC,EAAe,IAAIC,EAAa,GAE3CC,IAAmBC;AAAA,IACvB,CAACC,MAAiC;;AAEhC,MAAIA,KACFlB,EAAoBkB,CAAY,GAElCJ,EAAeK,EAAwB,2BAA2B;AAAA,QAChE,MAAMC,EAAO;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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oBACE,gBAAAG;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,KAAK1B;AAAA,YACL,OAAOyC,EAAW;AAAA,YAClB,MAAMA,EAAW;AAAA,YACjB,SAAS,MAAM;AAAA,YAAC;AAAA,YAChB,qBAAqB,CAAAmB,MAAa1C,EAAwBuB,GAAYmB,CAAS;AAAA,UAAA;AAAA,QACjF;AAAA,MAAA,CAEH;AAAA,IACH;AAAA,IACA;AAAA,MACEtD;AAAA,MACAZ;AAAA,MACAwC;AAAA,MACAhB;AAAA,MACAtB;AAAA,MACAQ;AAAA,MACAC;AAAA,IACF;AAAA,EAAA;AAIF,SAAAwD,EAAU,MACD,MAAM;AACX,IAAA5D,EAAU,QAAQ,QAAQ,CAAS6D,MAAA,aAAaA,CAAK,CAAC,GACtD7D,EAAU,UAAU;EAAC,GAEtB,CAACL,CAAS,CAAC,GAEP;AAAA,IACL,UAAUE;AAAA,IACV,cAAA0C;AAAA,EAAA;AAEJ;"}
@@ -1,14 +1,14 @@
1
- import { jsxs as U, jsx as w } from "react/jsx-runtime";
2
- import { createContext as b, useState as h, useRef as k, useCallback as l, useMemo as q, useEffect as R } from "react";
1
+ import { jsxs as b, jsx as w } from "react/jsx-runtime";
2
+ import { createContext as q, useState as h, useRef as p, useCallback as l, useMemo as D, useEffect as R } from "react";
3
3
  import { Coachmark as L } from "../comps/coachmark/coachmark.js";
4
4
  import { usePostUserJourney as N, useGetUserJourney as M } from "../user-journey-api/user-journey-api.js";
5
5
  import { Overlay as z } from "./journey-styled.js";
6
- const G = b(null), K = ({ children: T, appId: u, userId: n }) => {
7
- const [p, v] = h([]), [s, c] = h([]), [J, x] = h(!1), a = k(-1), r = k(), d = k([]), { post: g } = N(), {
6
+ const G = q(null), K = ({ children: T, appId: u, userId: o }) => {
7
+ const [v, k] = h([]), [s, c] = h([]), [J, x] = h(!1), a = p(-1), r = p(), d = p([]), { post: g } = N(), {
8
8
  data: f = null,
9
9
  get: _,
10
- isProcessing: D
11
- } = M(), $ = l(
10
+ isProcessing: O
11
+ } = M(), A = l(
12
12
  (e, t) => {
13
13
  if (s.length > 0) {
14
14
  console.error(
@@ -23,24 +23,24 @@ const G = b(null), K = ({ children: T, appId: u, userId: n }) => {
23
23
  d.current.forEach((e) => {
24
24
  clearTimeout(e);
25
25
  }), d.current = [], r.current = void 0, a.current = -1, c([]), x(!1);
26
- }, []), A = l(
26
+ }, []), P = l(
27
27
  (e) => {
28
- v((t) => [...t, e]), g({
28
+ k((t) => [...t, e]), g({
29
29
  app_id: u,
30
- user_id: n,
30
+ user_id: o,
31
31
  journey_id: e,
32
32
  journey_status: "COMPLETED"
33
33
  }), m();
34
34
  },
35
- [u, m, g, n]
36
- ), P = l((e, t) => {
35
+ [u, m, g, o]
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"
40
40
  );
41
41
  return;
42
42
  }
43
- console.log(`addCoachmark: Journey ID: ${e}`), c((y) => [...y, t]);
43
+ c((y) => [...y, t]);
44
44
  }, []), E = l(
45
45
  (e, t = !1, y = 0) => {
46
46
  if (!r.current || e !== r.current) {
@@ -49,56 +49,56 @@ const G = b(null), K = ({ children: T, appId: u, userId: n }) => {
49
49
  );
50
50
  return;
51
51
  }
52
- y !== 0 && c((o) => o.map((i) => ({ ...i, isActive: !1 })));
52
+ y !== 0 && c((n) => n.map((i) => ({ ...i, isActive: !1 })));
53
53
  const j = setTimeout(() => {
54
54
  clearTimeout(j);
55
- const o = a.current + 1;
55
+ const n = a.current + 1;
56
56
  c((i) => {
57
- if (o >= i.length || i.length === 0)
57
+ if (n >= i.length || i.length === 0)
58
58
  return r.current = void 0, a.current = -1, [];
59
- a.current = o;
59
+ a.current = n;
60
60
  const C = [...i];
61
- return C[o].isActive = !0, o > 0 && (C[o - 1].isActive = t), C;
61
+ return C[n].isActive = !0, n > 0 && (C[n - 1].isActive = t), C;
62
62
  });
63
63
  }, y);
64
64
  d.current.push(j);
65
65
  },
66
66
  []
67
- ), O = q(
67
+ ), U = D(
68
68
  () => ({
69
69
  nextCoachmark: E,
70
- setJourney: $,
71
- addCoachmark: P,
70
+ setJourney: A,
71
+ addCoachmark: $,
72
72
  clearJourney: m,
73
- endJourney: A,
73
+ endJourney: P,
74
74
  coachmarks: s,
75
- userCompletedJourneyIds: p,
75
+ userCompletedJourneyIds: v,
76
76
  isJourneyActive: J
77
77
  }),
78
78
  [
79
79
  E,
80
+ A,
80
81
  $,
81
- P,
82
82
  m,
83
- A,
83
+ P,
84
84
  s,
85
- p,
85
+ v,
86
86
  J
87
87
  ]
88
88
  );
89
89
  return R(() => {
90
- u && n && _(n, {
90
+ u && o && _(o, {
91
91
  app_id: u,
92
- user_id: n,
92
+ user_id: o,
93
93
  journey_status: "COMPLETED"
94
94
  });
95
- }, [u, _, n]), R(() => {
95
+ }, [u, _, o]), R(() => {
96
96
  if (f) {
97
97
  const e = f.map((t) => t.journey_id);
98
- v(e);
98
+ k(e);
99
99
  }
100
- }, [f]), /* @__PURE__ */ U(G.Provider, { value: O, children: [
101
- J && !D && /* @__PURE__ */ w(z, { children: s.map((e, t) => /* @__PURE__ */ w(L, { coachmark: e }, `coachmark-${t}`)) }),
100
+ }, [f]), /* @__PURE__ */ b(G.Provider, { value: U, children: [
101
+ J && !O && /* @__PURE__ */ w(z, { children: s.map((e, t) => /* @__PURE__ */ w(L, { 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 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 console.log(`addCoachmark: Journey ID: ${id}`);\n\n setCoachmarkList(prev => [...prev, coachmark]);\n }, []);\n\n const nextCoachmark = useCallback(\n (id: TJourneyId, keepPrevActive: boolean = false, delayInMs: number = 0) => {\n if (!currentJourneyId.current || id !== currentJourneyId.current) {\n console.error(\n currentJourneyId.current\n ? `nextCoachmark was called before setJourney`\n : `A Journey is already active, Current Journey: ${currentJourneyId.current}, New Journey Request: ${id}`,\n );\n\n return;\n }\n\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 {isJourneyActive && !isProcessing && (\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","setJourney","useCallback","id","coachmarks","clearJourney","timer","endJourney","journeyId","prev","addCoachmark","coachmark","nextCoachmark","keepPrevActive","delayInMs","prevList","item","currIndex","updatedCoachmarkList","memoizedContextValue","useMemo","useEffect","completedUserJourneysIds","journey","jsxs","jsx","S.Overlay","index","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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ACAK;AAAA,IACF;AAAA,EAAA;AAIF,SAAAgC,EAAU,MAAM;AACd,IAAIvC,KAASC,KACXe,EAAmBf,GAAQ;AAAA,MACzB,QAAQD;AAAA,MACR,SAASC;AAAA,MACT,gBAAgB;AAAA,IAAA,CACjB;AAAA,EAEF,GAAA,CAACD,GAAOgB,GAAoBf,CAAM,CAAC,GAGtCsC,EAAU,MAAM;AACd,QAAIxB,GAAuB;AACzB,YAAMyB,IAA2BzB,EAAsB,IAAI,CAAA0B,MAAWA,EAAQ,UAAU;AAExF,MAAAtC,EAA2BqC,CAAwB;AAAA,IACrD;AAAA,EAAA,GACC,CAACzB,CAAqB,CAAC,GAGvB,gBAAA2B,EAAA9C,EAAe,UAAf,EAAwB,OAAOyC,GAC7B,UAAA;AAAA,IAAA9B,KAAmB,CAACU,KACnB,gBAAA0B,EAACC,GAAA,EACE,YAAc,IAAI,CAACf,GAAWgB,wBAC5BC,GAAqC,EAAA,WAAAjB,EAAA,GAAtB,aAAagB,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 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 {isJourneyActive && !isProcessing && (\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","setJourney","useCallback","id","coachmarks","clearJourney","timer","endJourney","journeyId","prev","addCoachmark","coachmark","nextCoachmark","keepPrevActive","delayInMs","prevList","item","currIndex","updatedCoachmarkList","memoizedContextValue","useMemo","useEffect","completedUserJourneysIds","journey","jsxs","jsx","S.Overlay","index","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,IAAaC;AAAA,IACjB,CAACC,GAAgBC,MAAkC;AAC7C,UAAAjB,EAAc,SAAS,GAAG;AACpB,gBAAA;AAAA,UACN,iEAAiEM,EAAiB,OAAO,0BAA0BU,CAAE;AAAA,QAAA;AAGvH;AAAA,MACF;AACA,MAAAb,EAAmB,EAAI,GACvBG,EAAiB,UAAUU,GAC3BZ,EAAa,UAAU,IACNH,EAAA,CAAC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AA,IACrD;AAAA,EAAA,GACC,CAACzB,CAAqB,CAAC,GAGvB,gBAAA2B,EAAA9C,EAAe,UAAf,EAAwB,OAAOyC,GAC7B,UAAA;AAAA,IAAA9B,KAAmB,CAACU,KACnB,gBAAA0B,EAACC,GAAA,EACE,YAAc,IAAI,CAACf,GAAWgB,wBAC5BC,GAAqC,EAAA,WAAAjB,EAAA,GAAtB,aAAagB,CAAK,EAA0B,CAC7D,GACH;AAAA,IAED9C;AAAA,EACH,EAAA,CAAA;AAEJ;"}
@@ -1,8 +1,8 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
- import { LOTTIE as o } from "../../../../assets/lottie/lottie.js";
2
+ import { LOTTIE as r } from "../../../../assets/lottie/lottie.js";
3
3
  import i from "../../layout/flex-view.js";
4
- import r from "../../lottie-animation/lottie-animation.js";
5
- const s = () => /* @__PURE__ */ t(
4
+ import o from "../../lottie-animation/lottie-animation.js";
5
+ const h = () => /* @__PURE__ */ t(
6
6
  i,
7
7
  {
8
8
  $width: "100%",
@@ -10,11 +10,10 @@ const s = () => /* @__PURE__ */ t(
10
10
  $alignItems: "center",
11
11
  $justifyContent: "center",
12
12
  $background: "TRANSPARENT",
13
- style: { zIndex: 9999, position: "absolute", background: "#000000" },
14
- children: /* @__PURE__ */ t(r, { width: "50%", height: "50%", src: o.CIRCULAR_LOADER })
13
+ children: /* @__PURE__ */ t(o, { width: "50%", height: "50%", src: r.CIRCULAR_LOADER })
15
14
  }
16
15
  );
17
16
  export {
18
- s as CircularLoader
17
+ h as CircularLoader
19
18
  };
20
19
  //# sourceMappingURL=circular-loader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"circular-loader.js","sources":["../../../../../src/features/ui/loader/circular-loader/circular-loader.tsx"],"sourcesContent":["import { LOTTIE } from '../../../../assets/lottie/lottie';\nimport FlexView from '../../layout/flex-view';\nimport LottieAnimation from '../../lottie-animation/lottie-animation';\n\nexport const CircularLoader = () => (\n <FlexView\n $width=\"100%\"\n $height=\"100%\"\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $background=\"TRANSPARENT\"\n style={{ zIndex: 9999, position: 'absolute', background: '#000000' }}\n >\n <LottieAnimation width=\"50%\" height=\"50%\" src={LOTTIE.CIRCULAR_LOADER} />\n </FlexView>\n);\n"],"names":["CircularLoader","jsx","FlexView","LottieAnimation","LOTTIE"],"mappings":";;;;AAIO,MAAMA,IAAiB,MAC5B,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACC,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,aAAY;AAAA,IACZ,iBAAgB;AAAA,IAChB,aAAY;AAAA,IACZ,OAAO,EAAE,QAAQ,MAAM,UAAU,YAAY,YAAY,UAAU;AAAA,IAEnE,UAAA,gBAAAD,EAACE,KAAgB,OAAM,OAAM,QAAO,OAAM,KAAKC,EAAO,gBAAiB,CAAA;AAAA,EAAA;AACzE;"}
1
+ {"version":3,"file":"circular-loader.js","sources":["../../../../../src/features/ui/loader/circular-loader/circular-loader.tsx"],"sourcesContent":["import { LOTTIE } from '../../../../assets/lottie/lottie';\nimport FlexView from '../../layout/flex-view';\nimport LottieAnimation from '../../lottie-animation/lottie-animation';\n\nexport const CircularLoader = () => (\n <FlexView\n $width=\"100%\"\n $height=\"100%\"\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $background=\"TRANSPARENT\"\n >\n <LottieAnimation width=\"50%\" height=\"50%\" src={LOTTIE.CIRCULAR_LOADER} />\n </FlexView>\n);\n"],"names":["CircularLoader","jsx","FlexView","LottieAnimation","LOTTIE"],"mappings":";;;;AAIO,MAAMA,IAAiB,MAC5B,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACC,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,aAAY;AAAA,IACZ,iBAAgB;AAAA,IAChB,aAAY;AAAA,IAEZ,UAAA,gBAAAD,EAACE,KAAgB,OAAM,OAAM,QAAO,OAAM,KAAKC,EAAO,gBAAiB,CAAA;AAAA,EAAA;AACzE;"}
package/dist/index.d.ts CHANGED
@@ -1107,11 +1107,11 @@ 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;
1114
1113
  isTutorialOnboardingDone?: boolean;
1114
+ eligibleJourneyIds: TJourneyId[];
1115
1115
  }
1116
1116
 
1117
1117
  declare interface IGetArrowTooltipConfig {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuemath/leap",
3
- "version": "2.8.62-rj-7",
3
+ "version": "2.8.62-rj-0.2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"