@cuemath/leap 3.2.1-ppa-0.1 → 3.2.1

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,71 +1,68 @@
1
1
  import { ProjectType as i } from "../../../games/web-view/enums/project-type-enum.js";
2
- const a = (e) => {
2
+ const a = (t) => {
3
3
  let s = null;
4
- return e && (s = {
5
- points: e.points,
6
- streakDays: e.streak_days,
7
- streakReduction: e.streak_reduction,
8
- streakDaysBeforeReduction: e.streak_days_before_reduction,
9
- streakStatus: e.streak_status,
10
- tournamentRank: e.tournament_rank,
11
- projects: {
12
- games: {
13
- label: e.projects.games.label,
14
- type: i.GAME,
15
- initialProgressValue: 0,
16
- data: e.projects.games.data.map((t) => ({
17
- id: t.id,
18
- name: t.name,
19
- cardLottie: t.card,
20
- tutorial: t.tutorial,
21
- variant: t.variant,
22
- isPlayed: t.played
23
- }))
24
- },
25
- puzzles: {
26
- label: e.projects.puzzles.label,
27
- type: i.PUZZLE,
28
- initialProgressValue: 0,
29
- data: e.projects.puzzles.data.map((t) => ({
30
- id: t.id,
31
- name: t.name,
32
- cardLottie: t.card,
33
- tutorial: t.tutorial,
34
- variant: t.variant,
35
- question: t.question,
36
- isHintSeen: t.is_hint_seen,
37
- solved: t.solved
38
- }))
39
- }
40
- },
4
+ return t && (s = {
5
+ points: t.points,
6
+ streakDays: t.streak_days,
7
+ streakReduction: t.streak_reduction,
8
+ streakDaysBeforeReduction: t.streak_days_before_reduction,
9
+ streakStatus: t.streak_status,
10
+ tournamentRank: t.tournament_rank,
11
+ projects: {},
41
12
  timestamps: {
42
- startTimestamp: e.timestamps.start_timestamp,
43
- endTimestamp: e.timestamps.end_timestamp,
44
- current: e.timestamps.current
13
+ startTimestamp: t.timestamps.start_timestamp,
14
+ endTimestamp: t.timestamps.end_timestamp,
15
+ current: t.timestamps.current
45
16
  }
46
- }, e.projects.lessons && (s.projects.lessons = {
47
- label: e.projects.lessons.label,
17
+ }, t.projects.games && (s.projects.games = {
18
+ label: t.projects.games.label,
19
+ type: i.GAME,
20
+ initialProgressValue: 0,
21
+ data: t.projects.games.data.map((e) => ({
22
+ id: e.id,
23
+ name: e.name,
24
+ cardLottie: e.card,
25
+ tutorial: e.tutorial,
26
+ variant: e.variant,
27
+ isPlayed: e.played
28
+ }))
29
+ }), t.projects.puzzles && (s.projects.puzzles = {
30
+ label: t.projects.puzzles.label,
31
+ type: i.PUZZLE,
32
+ initialProgressValue: 0,
33
+ data: t.projects.puzzles.data.map((e) => ({
34
+ id: e.id,
35
+ name: e.name,
36
+ cardLottie: e.card,
37
+ tutorial: e.tutorial,
38
+ variant: e.variant,
39
+ question: e.question,
40
+ isHintSeen: e.is_hint_seen,
41
+ solved: e.solved
42
+ }))
43
+ }), t.projects.lessons && (s.projects.lessons = {
44
+ label: t.projects.lessons.label,
48
45
  type: i.LESSON,
49
46
  initialProgressValue: 0,
50
- data: e.projects.lessons.data.map((t) => ({
51
- id: t.id,
52
- name: t.name,
53
- cardLottie: t.card,
54
- tutorial: t.tutorial,
55
- variant: t.variant,
56
- sessionId: t.session_id,
57
- miniGameIdentifier: t.mini_game_identifier,
58
- targetQuestions: t.target_questions,
59
- status: t.status
47
+ data: t.projects.lessons.data.map((e) => ({
48
+ id: e.id,
49
+ name: e.name,
50
+ cardLottie: e.card,
51
+ tutorial: e.tutorial,
52
+ variant: e.variant,
53
+ sessionId: e.session_id,
54
+ miniGameIdentifier: e.mini_game_identifier,
55
+ targetQuestions: e.target_questions,
56
+ status: e.status
60
57
  }))
61
- }), e.projects.tables && (s.projects.tables = {
62
- label: e.projects.tables.label,
58
+ }), t.projects.tables && (s.projects.tables = {
59
+ label: t.projects.tables.label,
63
60
  type: i.TABLE,
64
61
  data: {
65
- infiniteModeHighScore: e.projects.tables.data.infinite_mode_high_score,
66
- tableList: e.projects.tables.data.table_wise_details.map((t) => ({
67
- tableNumber: t.table_number,
68
- stars: t.stars
62
+ infiniteModeHighScore: t.projects.tables.data.infinite_mode_high_score,
63
+ tableList: t.projects.tables.data.table_wise_details.map((e) => ({
64
+ tableNumber: e.table_number,
65
+ stars: e.stars
69
66
  }))
70
67
  }
71
68
  })), s;
@@ -1 +1 @@
1
- {"version":3,"file":"helper.js","sources":["../../../../../../src/features/circle-games/game-launcher/dal/use-get-circle-home-details-dal/helper.ts"],"sourcesContent":["import type { IGetCircleHomeResponseModel } from '../../api/get-content-for-today/get-circle-home-api-types';\nimport type {\n ICircleHomeDetails,\n TStreakStatus,\n TTableMode,\n} from './use-get-circle-home-dal-types';\n\nimport { ProjectType } from '../../../games/web-view/enums';\n\nexport const transformCircleHomeData = (data: IGetCircleHomeResponseModel | null) => {\n let circleHomeDetails: ICircleHomeDetails | null = null;\n\n if (data) {\n circleHomeDetails = {\n points: data.points,\n streakDays: data.streak_days,\n streakReduction: data.streak_reduction,\n streakDaysBeforeReduction: data.streak_days_before_reduction,\n streakStatus: data.streak_status as TStreakStatus,\n tournamentRank: data.tournament_rank,\n projects: {\n games: {\n label: data.projects.games.label,\n type: ProjectType.GAME,\n initialProgressValue: 0,\n data: data.projects.games.data.map(game => ({\n id: game.id,\n name: game.name,\n cardLottie: game.card,\n tutorial: game.tutorial,\n variant: game.variant,\n isPlayed: game.played,\n })),\n },\n puzzles: {\n label: data.projects.puzzles.label,\n type: ProjectType.PUZZLE,\n initialProgressValue: 0,\n data: data.projects.puzzles.data.map(puzzle => ({\n id: puzzle.id,\n name: puzzle.name,\n cardLottie: puzzle.card,\n tutorial: puzzle.tutorial,\n variant: puzzle.variant,\n question: puzzle.question,\n isHintSeen: puzzle.is_hint_seen,\n solved: puzzle.solved,\n })),\n },\n },\n timestamps: {\n startTimestamp: data.timestamps.start_timestamp,\n endTimestamp: data.timestamps.end_timestamp,\n current: data.timestamps.current,\n },\n };\n\n if (data.projects.lessons) {\n circleHomeDetails.projects.lessons = {\n label: data.projects.lessons.label,\n type: ProjectType.LESSON,\n initialProgressValue: 0,\n data: data.projects.lessons.data.map(lesson => ({\n id: lesson.id,\n name: lesson.name,\n cardLottie: lesson.card,\n tutorial: lesson.tutorial,\n variant: lesson.variant,\n sessionId: lesson.session_id,\n miniGameIdentifier: lesson.mini_game_identifier,\n targetQuestions: lesson.target_questions,\n status: lesson.status,\n })),\n };\n }\n\n if (data.projects.tables) {\n circleHomeDetails.projects.tables = {\n label: data.projects.tables.label,\n type: ProjectType.TABLE,\n data: {\n infiniteModeHighScore: data.projects.tables.data.infinite_mode_high_score,\n tableList: data.projects.tables.data.table_wise_details.map(table => ({\n tableNumber: table.table_number,\n stars: table.stars as TTableMode[],\n })),\n },\n };\n }\n }\n\n return circleHomeDetails;\n};\n"],"names":["transformCircleHomeData","data","circleHomeDetails","ProjectType","game","puzzle","lesson","table"],"mappings":";AASa,MAAAA,IAA0B,CAACC,MAA6C;AACnF,MAAIC,IAA+C;AAEnD,SAAID,MACkBC,IAAA;AAAA,IAClB,QAAQD,EAAK;AAAA,IACb,YAAYA,EAAK;AAAA,IACjB,iBAAiBA,EAAK;AAAA,IACtB,2BAA2BA,EAAK;AAAA,IAChC,cAAcA,EAAK;AAAA,IACnB,gBAAgBA,EAAK;AAAA,IACrB,UAAU;AAAA,MACR,OAAO;AAAA,QACL,OAAOA,EAAK,SAAS,MAAM;AAAA,QAC3B,MAAME,EAAY;AAAA,QAClB,sBAAsB;AAAA,QACtB,MAAMF,EAAK,SAAS,MAAM,KAAK,IAAI,CAASG,OAAA;AAAA,UAC1C,IAAIA,EAAK;AAAA,UACT,MAAMA,EAAK;AAAA,UACX,YAAYA,EAAK;AAAA,UACjB,UAAUA,EAAK;AAAA,UACf,SAASA,EAAK;AAAA,UACd,UAAUA,EAAK;AAAA,QAAA,EACf;AAAA,MACJ;AAAA,MACA,SAAS;AAAA,QACP,OAAOH,EAAK,SAAS,QAAQ;AAAA,QAC7B,MAAME,EAAY;AAAA,QAClB,sBAAsB;AAAA,QACtB,MAAMF,EAAK,SAAS,QAAQ,KAAK,IAAI,CAAWI,OAAA;AAAA,UAC9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circle-home-details-dal/helper.ts"],"sourcesContent":["import type { IGetCircleHomeResponseModel } from '../../api/get-content-for-today/get-circle-home-api-types';\nimport type {\n ICircleHomeDetails,\n TStreakStatus,\n TTableMode,\n} from './use-get-circle-home-dal-types';\n\nimport { ProjectType } from '../../../games/web-view/enums';\n\nexport const transformCircleHomeData = (data: IGetCircleHomeResponseModel | null) => {\n let circleHomeDetails: ICircleHomeDetails | null = null;\n\n if (data) {\n circleHomeDetails = {\n points: data.points,\n streakDays: data.streak_days,\n streakReduction: data.streak_reduction,\n streakDaysBeforeReduction: data.streak_days_before_reduction,\n streakStatus: data.streak_status as TStreakStatus,\n tournamentRank: data.tournament_rank,\n projects: {},\n timestamps: {\n startTimestamp: data.timestamps.start_timestamp,\n endTimestamp: data.timestamps.end_timestamp,\n current: data.timestamps.current,\n },\n };\n\n if (data.projects.games) {\n circleHomeDetails.projects.games = {\n label: data.projects.games.label,\n type: ProjectType.GAME,\n initialProgressValue: 0,\n data: data.projects.games.data.map(game => ({\n id: game.id,\n name: game.name,\n cardLottie: game.card,\n tutorial: game.tutorial,\n variant: game.variant,\n isPlayed: game.played,\n })),\n };\n }\n\n if (data.projects.puzzles) {\n circleHomeDetails.projects.puzzles = {\n label: data.projects.puzzles.label,\n type: ProjectType.PUZZLE,\n initialProgressValue: 0,\n data: data.projects.puzzles.data.map(puzzle => ({\n id: puzzle.id,\n name: puzzle.name,\n cardLottie: puzzle.card,\n tutorial: puzzle.tutorial,\n variant: puzzle.variant,\n question: puzzle.question,\n isHintSeen: puzzle.is_hint_seen,\n solved: puzzle.solved,\n })),\n };\n }\n\n if (data.projects.lessons) {\n circleHomeDetails.projects.lessons = {\n label: data.projects.lessons.label,\n type: ProjectType.LESSON,\n initialProgressValue: 0,\n data: data.projects.lessons.data.map(lesson => ({\n id: lesson.id,\n name: lesson.name,\n cardLottie: lesson.card,\n tutorial: lesson.tutorial,\n variant: lesson.variant,\n sessionId: lesson.session_id,\n miniGameIdentifier: lesson.mini_game_identifier,\n targetQuestions: lesson.target_questions,\n status: lesson.status,\n })),\n };\n }\n\n if (data.projects.tables) {\n circleHomeDetails.projects.tables = {\n label: data.projects.tables.label,\n type: ProjectType.TABLE,\n data: {\n infiniteModeHighScore: data.projects.tables.data.infinite_mode_high_score,\n tableList: data.projects.tables.data.table_wise_details.map(table => ({\n tableNumber: table.table_number,\n stars: table.stars as TTableMode[],\n })),\n },\n };\n }\n }\n\n return circleHomeDetails;\n};\n"],"names":["transformCircleHomeData","data","circleHomeDetails","ProjectType","game","puzzle","lesson","table"],"mappings":";AASa,MAAAA,IAA0B,CAACC,MAA6C;AACnF,MAAIC,IAA+C;AAEnD,SAAID,MACkBC,IAAA;AAAA,IAClB,QAAQD,EAAK;AAAA,IACb,YAAYA,EAAK;AAAA,IACjB,iBAAiBA,EAAK;AAAA,IACtB,2BAA2BA,EAAK;AAAA,IAChC,cAAcA,EAAK;AAAA,IACnB,gBAAgBA,EAAK;AAAA,IACrB,UAAU,CAAC;AAAA,IACX,YAAY;AAAA,MACV,gBAAgBA,EAAK,WAAW;AAAA,MAChC,cAAcA,EAAK,WAAW;AAAA,MAC9B,SAASA,EAAK,WAAW;AAAA,IAC3B;AAAA,EAAA,GAGEA,EAAK,SAAS,UAChBC,EAAkB,SAAS,QAAQ;AAAA,IACjC,OAAOD,EAAK,SAAS,MAAM;AAAA,IAC3B,MAAME,EAAY;AAAA,IAClB,sBAAsB;AAAA,IACtB,MAAMF,EAAK,SAAS,MAAM,KAAK,IAAI,CAASG,OAAA;AAAA,MAC1C,IAAIA,EAAK;AAAA,MACT,MAAMA,EAAK;AAAA,MACX,YAAYA,EAAK;AAAA,MACjB,UAAUA,EAAK;AAAA,MACf,SAASA,EAAK;AAAA,MACd,UAAUA,EAAK;AAAA,IAAA,EACf;AAAA,EAAA,IAIFH,EAAK,SAAS,YAChBC,EAAkB,SAAS,UAAU;AAAA,IACnC,OAAOD,EAAK,SAAS,QAAQ;AAAA,IAC7B,MAAME,EAAY;AAAA,IAClB,sBAAsB;AAAA,IACtB,MAAMF,EAAK,SAAS,QAAQ,KAAK,IAAI,CAAWI,OAAA;AAAA,MAC9C,IAAIA,EAAO;AAAA,MACX,MAAMA,EAAO;AAAA,MACb,YAAYA,EAAO;AAAA,MACnB,UAAUA,EAAO;AAAA,MACjB,SAASA,EAAO;AAAA,MAChB,UAAUA,EAAO;AAAA,MACjB,YAAYA,EAAO;AAAA,MACnB,QAAQA,EAAO;AAAA,IAAA,EACf;AAAA,EAAA,IAIFJ,EAAK,SAAS,YAChBC,EAAkB,SAAS,UAAU;AAAA,IACnC,OAAOD,EAAK,SAAS,QAAQ;AAAA,IAC7B,MAAME,EAAY;AAAA,IAClB,sBAAsB;AAAA,IACtB,MAAMF,EAAK,SAAS,QAAQ,KAAK,IAAI,CAAWK,OAAA;AAAA,MAC9C,IAAIA,EAAO;AAAA,MACX,MAAMA,EAAO;AAAA,MACb,YAAYA,EAAO;AAAA,MACnB,UAAUA,EAAO;AAAA,MACjB,SAASA,EAAO;AAAA,MAChB,WAAWA,EAAO;AAAA,MAClB,oBAAoBA,EAAO;AAAA,MAC3B,iBAAiBA,EAAO;AAAA,MACxB,QAAQA,EAAO;AAAA,IAAA,EACf;AAAA,EAAA,IAIFL,EAAK,SAAS,WAChBC,EAAkB,SAAS,SAAS;AAAA,IAClC,OAAOD,EAAK,SAAS,OAAO;AAAA,IAC5B,MAAME,EAAY;AAAA,IAClB,MAAM;AAAA,MACJ,uBAAuBF,EAAK,SAAS,OAAO,KAAK;AAAA,MACjD,WAAWA,EAAK,SAAS,OAAO,KAAK,mBAAmB,IAAI,CAAUM,OAAA;AAAA,QACpE,aAAaA,EAAM;AAAA,QACnB,OAAOA,EAAM;AAAA,MAAA,EACb;AAAA,IACJ;AAAA,EAAA,KAKCL;AACT;"}
@@ -1,80 +1,80 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
- import { memo as g, useRef as J, useCallback as n, useMemo as V, useEffect as Y } from "react";
2
+ import { memo as D, useRef as J, useCallback as m, useMemo as S, useEffect as Y } from "react";
3
3
  import { LOTTIE as B } from "../../../assets/lottie/lottie.js";
4
- import { JOURNEY_ID_STUDENT as _ } from "../../journey/journey-id/journey-id-student.js";
4
+ import { JOURNEY_ID_STUDENT as p } from "../../journey/journey-id/journey-id-student.js";
5
5
  import { useJourney as K } from "../../journey/use-journey/use-journey.js";
6
6
  import { CircularLoader as H } from "../../ui/loader/circular-loader/circular-loader.js";
7
7
  import Z from "../../ui/lottie-animation/lottie-animation.js";
8
8
  import { useCircleSounds as w } from "../hooks/use-circle-sounds/use-circle-sounds.js";
9
9
  import { CircleSoundKey as t } from "../hooks/use-circle-sounds/use-circle-sounds-enums.js";
10
10
  import { GAME_LAUNCHER_SIZE as F } from "./comps/card-container/constants.js";
11
- import { Carousel as M } from "./comps/carousel/carousel.js";
11
+ import { Carousel as V } from "./comps/carousel/carousel.js";
12
12
  import { GAME_LAUNCHER_ASSET_PADDING as X } from "./comps/segmented-game-card/constants.js";
13
- import { SegmentedGameCard as a } from "./comps/segmented-game-card/segmented-game-card.js";
13
+ import { SegmentedGameCard as C } from "./comps/segmented-game-card/segmented-game-card.js";
14
14
  import { TablesCard as q } from "./comps/tables-card/tables-card.js";
15
- import { GAME_LAUNCHER_ANALYTICS_EVENTS as S } from "./game-launcher-analytics-events.js";
15
+ import { GAME_LAUNCHER_ANALYTICS_EVENTS as M } from "./game-launcher-analytics-events.js";
16
16
  import { useGameLauncherJourney as Q } from "./hooks/use-game-launcher-journey/use-game-launcher-journey.js";
17
17
  import { useTableInfiniteLauncherJourney as W } from "./hooks/use-table-infinite-launcher-journey/use-table-infinite-launcher-journey.js";
18
18
  import { useTableLauncherJourney as $ } from "./hooks/use-table-launcher-journey/use-table-launcher-journey.js";
19
- import { ProjectType as m } from "../games/web-view/enums/project-type-enum.js";
20
- const O = F + X, _e = g(
19
+ import { ProjectType as f } from "../games/web-view/enums/project-type-enum.js";
20
+ const O = F + X, Te = D(
21
21
  ({
22
- onSegmentClick: l,
23
- journeyId: u,
22
+ onSegmentClick: r,
23
+ journeyId: n,
24
24
  data: e,
25
25
  isLoading: c,
26
26
  isTutorialOnboardingDone: b,
27
- defaultIndex: v = 0,
28
- onJourneyComplete: p
27
+ defaultIndex: U = 0,
28
+ onJourneyComplete: E
29
29
  }) => {
30
- const f = J(null), E = J(null), { isJourneyActive: C } = K(), { playSwipeSound: A, play: o } = w(), L = n(
31
- (r) => {
32
- o(t.GAME_CARD_CLICK), l(r, m.TABLE);
30
+ const u = J(null), _ = J(null), { isJourneyActive: A } = K(), { playSwipeSound: R, play: o } = w(), L = m(
31
+ (l) => {
32
+ o(t.GAME_CARD_CLICK), r(l, f.TABLE);
33
33
  },
34
- [l, o]
35
- ), x = n(() => {
36
- o(t.GAME_CARD_CLICK), l({ mode: "infinite" }, m.TABLE);
37
- }, [l, o]), I = n(
38
- (r) => {
39
- r.status !== "completed" && (o(t.GAME_CARD_CLICK), l(r, m.LESSON));
34
+ [r, o]
35
+ ), g = m(() => {
36
+ o(t.GAME_CARD_CLICK), r({ mode: "infinite" }, f.TABLE);
37
+ }, [r, o]), I = m(
38
+ (l) => {
39
+ l.status !== "completed" && (o(t.GAME_CARD_CLICK), r(l, f.LESSON));
40
40
  },
41
- [l, o]
42
- ), R = n(
43
- (r) => {
44
- o(t.GAME_CARD_CLICK), l(r, m.GAME);
41
+ [r, o]
42
+ ), N = m(
43
+ (l) => {
44
+ o(t.GAME_CARD_CLICK), r(l, f.GAME);
45
45
  },
46
- [l, o]
47
- ), y = n(
48
- (r) => {
49
- o(t.GAME_CARD_CLICK), l(r, m.PUZZLE);
46
+ [r, o]
47
+ ), y = m(
48
+ (l) => {
49
+ o(t.GAME_CARD_CLICK), r(l, f.PUZZLE);
50
50
  },
51
- [l, o]
51
+ [r, o]
52
52
  ), {
53
- gameRefs: N,
53
+ gameRefs: a,
54
54
  lessonRefs: P,
55
55
  puzzleRefs: h,
56
- startJourney: G
56
+ startJourney: z
57
57
  } = Q({
58
- carouselRefs: f,
59
- onSegmentClick: l,
60
- onJourneyComplete: p
58
+ carouselRefs: u,
59
+ onSegmentClick: r,
60
+ onJourneyComplete: E
61
61
  }), { startJourney: T } = W({
62
- carouselRefs: f,
63
- onTableInfiniteModeClick: x,
64
- onJourneyComplete: p,
65
- originalTableRef: E
66
- }), { startJourney: z } = $({
67
- carouselRefs: f,
68
- originalTableRef: E,
62
+ carouselRefs: u,
63
+ onTableInfiniteModeClick: g,
64
+ onJourneyComplete: E,
65
+ originalTableRef: _
66
+ }), { startJourney: G } = $({
67
+ carouselRefs: u,
68
+ originalTableRef: _,
69
69
  onTableSegmentClick: L,
70
- onJourneyComplete: p,
70
+ onJourneyComplete: E,
71
71
  onNextJourney: T
72
- }), D = V(() => {
73
- let r = [];
74
- return e && (e.lessons && (r = [
75
- ...r,
72
+ }), v = S(() => {
73
+ let l = [];
74
+ return e && (e.lessons && (l = [
75
+ ...l,
76
76
  /* @__PURE__ */ i(
77
- a,
77
+ C,
78
78
  {
79
79
  ref: P,
80
80
  label: e.lessons.label,
@@ -89,12 +89,12 @@ const O = F + X, _e = g(
89
89
  }))
90
90
  }
91
91
  )
92
- ]), r = [
93
- ...r,
92
+ ]), e.games && (l = [
93
+ ...l,
94
94
  /* @__PURE__ */ i(
95
- a,
95
+ C,
96
96
  {
97
- ref: N,
97
+ ref: a,
98
98
  label: e.games.label,
99
99
  value: e.games.data.filter((s) => s.isPlayed).length,
100
100
  maxValue: e.games.data.length,
@@ -103,12 +103,14 @@ const O = F + X, _e = g(
103
103
  card: s.cardLottie,
104
104
  name: s.name,
105
105
  isCompleted: !1,
106
- onPress: () => R(s)
106
+ onPress: () => N(s)
107
107
  }))
108
108
  }
109
- ),
109
+ )
110
+ ]), e.puzzles && (l = [
111
+ ...l,
110
112
  /* @__PURE__ */ i(
111
- a,
113
+ C,
112
114
  {
113
115
  ref: h,
114
116
  label: e.puzzles.label,
@@ -123,29 +125,29 @@ const O = F + X, _e = g(
123
125
  }))
124
126
  }
125
127
  )
126
- ], e.tables && (r = [
127
- ...r,
128
+ ]), e.tables && (l = [
129
+ ...l,
128
130
  /* @__PURE__ */ i(
129
131
  q,
130
132
  {
131
- ref: E,
133
+ ref: _,
132
134
  label: e.tables.label,
133
135
  data: e.tables.data,
134
136
  onPress: L,
135
137
  openModesOfTable: e.tables.openModesOfTable
136
138
  }
137
139
  )
138
- ])), r;
140
+ ])), l;
139
141
  }, [
140
142
  e,
141
- N,
143
+ a,
142
144
  h,
143
145
  P,
144
146
  I,
145
- R,
147
+ N,
146
148
  y,
147
149
  L
148
- ]), U = V(
150
+ ]), x = S(
149
151
  () => [
150
152
  /* @__PURE__ */ i(
151
153
  Z,
@@ -159,48 +161,48 @@ const O = F + X, _e = g(
159
161
  []
160
162
  );
161
163
  return Y(() => {
162
- if (!(c || !e || C)) {
163
- if (e != null && e.puzzles && u === _.CIRCLE_ACTIVITIES_INTRO_JOURNEY) {
164
- G(e == null ? void 0 : e.puzzles, !!(e != null && e.lessons));
164
+ if (!(c || !e || A)) {
165
+ if (e != null && e.puzzles && n === p.CIRCLE_ACTIVITIES_INTRO_JOURNEY || e != null && e.lessons && n === p.CIRCLE_LESSONS_K_1_INTRO_JOURNEY) {
166
+ z(n, e == null ? void 0 : e.puzzles, e == null ? void 0 : e.lessons);
165
167
  return;
166
168
  }
167
- if (e != null && e.tables && u === _.CIRCLE_TABLES_INTRO_JOURNEY) {
168
- z(e == null ? void 0 : e.tables, b);
169
+ if (e != null && e.tables && n === p.CIRCLE_TABLES_INTRO_JOURNEY) {
170
+ G(e == null ? void 0 : e.tables, b);
169
171
  return;
170
172
  }
171
- if (e != null && e.tables && u === _.CIRCLE_TABLES_INFINTE_JOURNEY) {
173
+ if (e != null && e.tables && n === p.CIRCLE_TABLES_INFINTE_JOURNEY) {
172
174
  T();
173
175
  return;
174
176
  }
175
177
  }
176
178
  }, [
177
179
  e,
178
- C,
180
+ A,
179
181
  c,
180
182
  b,
181
- u,
183
+ n,
182
184
  T,
183
- G,
184
- z
185
+ z,
186
+ G
185
187
  ]), c ? /* @__PURE__ */ i(H, {}) : e ? /* @__PURE__ */ i(
186
- M,
188
+ V,
187
189
  {
188
- ref: f,
189
- items: D,
190
- defaultIndex: v,
191
- onNext: A,
192
- onPrev: A,
190
+ ref: u,
191
+ items: v,
192
+ defaultIndex: U,
193
+ onNext: R,
194
+ onPrev: R,
193
195
  analyticsNext: {
194
- analyticsLabel: S.NEXT_ACTIVITY
196
+ analyticsLabel: M.NEXT_ACTIVITY
195
197
  },
196
198
  analyticsPrev: {
197
- analyticsLabel: S.PREV_ACTIVITY
199
+ analyticsLabel: M.PREV_ACTIVITY
198
200
  }
199
201
  }
200
202
  ) : /* @__PURE__ */ i(
201
- M,
203
+ V,
202
204
  {
203
- items: U,
205
+ items: x,
204
206
  analyticsNext: {
205
207
  analyticsLabel: ""
206
208
  },
@@ -212,6 +214,6 @@ const O = F + X, _e = g(
212
214
  }
213
215
  );
214
216
  export {
215
- _e as GameLauncher
217
+ Te as GameLauncher
216
218
  };
217
219
  //# 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 { ITableCardRef, 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 { useTableInfiniteLauncherJourney } from './hooks/use-table-infinite-launcher-journey/use-table-infinite-launcher-journey';\nimport { useTableLauncherJourney } from './hooks/use-table-launcher-journey/use-table-launcher-journey';\n\nconst sleepyBoiDimension = GAME_LAUNCHER_SIZE + GAME_LAUNCHER_ASSET_PADDING;\n\nexport const GameLauncher: FC<IGameLauncherProps> = memo(\n ({\n onSegmentClick,\n journeyId,\n data,\n isLoading,\n isTutorialOnboardingDone,\n defaultIndex = 0,\n onJourneyComplete,\n }) => {\n const carouselRefs = useRef<ICarouselRefs>(null) as React.RefObject<ICarouselRefs>;\n\n const tableRef = useRef<ITableCardRef>(null) as React.RefObject<ITableCardRef>;\n\n const { isJourneyActive } = useJourney();\n\n const { playSwipeSound, 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 onTableInfiniteModeClick = useCallback(() => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick({ mode: 'infinite' } as ITableDetails, ProjectType.TABLE);\n }, [onSegmentClick, play]);\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 onJourneyComplete,\n });\n\n const { startJourney: startInfiniteTablesJourney } = useTableInfiniteLauncherJourney({\n carouselRefs,\n onTableInfiniteModeClick,\n onJourneyComplete,\n originalTableRef: tableRef,\n });\n\n const { startJourney: startTablesJourney } = useTableLauncherJourney({\n carouselRefs,\n originalTableRef: tableRef,\n onTableSegmentClick,\n onJourneyComplete,\n onNextJourney: startInfiniteTablesJourney,\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 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);\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 return;\n }\n\n if (data?.tables && journeyId === JOURNEY_ID_STUDENT.CIRCLE_TABLES_INFINTE_JOURNEY) {\n startInfiniteTablesJourney();\n\n return;\n }\n }, [\n data,\n isJourneyActive,\n isLoading,\n isTutorialOnboardingDone,\n journeyId,\n startInfiniteTablesJourney,\n startLessonPuzzleGamesJourney,\n startTablesJourney,\n ]);\n\n if (isLoading) {\n return <CircularLoader />;\n }\n\n if (!data) {\n return (\n <Carousel\n items={sleepyBoiItem}\n analyticsNext={{\n analyticsLabel: '',\n }}\n analyticsPrev={{\n analyticsLabel: '',\n }}\n />\n );\n }\n\n return (\n <Carousel\n ref={carouselRefs}\n items={items}\n defaultIndex={defaultIndex}\n onNext={playSwipeSound}\n onPrev={playSwipeSound}\n analyticsNext={{\n analyticsLabel: GAME_LAUNCHER_ANALYTICS_EVENTS.NEXT_ACTIVITY,\n }}\n analyticsPrev={{\n analyticsLabel: GAME_LAUNCHER_ANALYTICS_EVENTS.PREV_ACTIVITY,\n }}\n />\n );\n },\n);\n"],"names":["sleepyBoiDimension","GAME_LAUNCHER_SIZE","GAME_LAUNCHER_ASSET_PADDING","GameLauncher","memo","onSegmentClick","journeyId","data","isLoading","isTutorialOnboardingDone","defaultIndex","onJourneyComplete","carouselRefs","useRef","tableRef","isJourneyActive","useJourney","playSwipeSound","play","useCircleSounds","onTableSegmentClick","useCallback","table","CircleSoundKey","ProjectType","onTableInfiniteModeClick","handleLessonSegmentClick","lesson","handleGameSegmentClick","game","handlePuzzleSegmentClick","puzzle","gameRefs","lessonRefs","puzzleRefs","startLessonPuzzleGamesJourney","useGameLauncherJourney","startInfiniteTablesJourney","useTableInfiniteLauncherJourney","startTablesJourney","useTableLauncherJourney","items","useMemo","itemTypes","jsx","SegmentedGameCard","TablesCard","sleepyBoiItem","LottieAnimation","LOTTIE","useEffect","JOURNEY_ID_STUDENT","CircularLoader","Carousel","GAME_LAUNCHER_ANALYTICS_EVENTS"],"mappings":";;;;;;;;;;;;;;;;;;;AA8BA,MAAMA,IAAqBC,IAAqBC,GAEnCC,KAAuCC;AAAA,EAClD,CAAC;AAAA,IACC,gBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,MAAAC;AAAA,IACA,WAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,cAAAC,IAAe;AAAA,IACf,mBAAAC;AAAA,EAAA,MACI;AACE,UAAAC,IAAeC,EAAsB,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A,YAAIR,KAAA,QAAAA,EAAM,WAAWD,MAAc6C,EAAmB,iCAAiC;AACrF,UAAAhB,EAA8B5B,KAAA,gBAAAA,EAAM,SAAS,CAAC,EAACA,KAAA,QAAAA,EAAM,QAAO;AAE5D;AAAA,QACF;AAEA,YAAIA,KAAA,QAAAA,EAAM,UAAUD,MAAc6C,EAAmB,6BAA6B;AAC7D,UAAAZ,EAAAhC,KAAA,gBAAAA,EAAM,QAAQE,CAAwB;AAEzD;AAAA,QACF;AAEA,YAAIF,KAAA,QAAAA,EAAM,UAAUD,MAAc6C,EAAmB,+BAA+B;AACvD,UAAAd;AAE3B;AAAA,QACF;AAAA;AAAA,IAAA,GACC;AAAA,MACD9B;AAAA,MACAQ;AAAA,MACAP;AAAA,MACAC;AAAA,MACAH;AAAA,MACA+B;AAAA,MACAF;AAAA,MACAI;AAAA,IAAA,CACD,GAEG/B,sBACM4C,GAAe,CAAA,CAAA,IAGpB7C,IAeH,gBAAAqC;AAAA,MAACS;AAAA,MAAA;AAAA,QACC,KAAKzC;AAAA,QACL,OAAA6B;AAAA,QACA,cAAA/B;AAAA,QACA,QAAQO;AAAA,QACR,QAAQA;AAAA,QACR,eAAe;AAAA,UACb,gBAAgBqC,EAA+B;AAAA,QACjD;AAAA,QACA,eAAe;AAAA,UACb,gBAAgBA,EAA+B;AAAA,QACjD;AAAA,MAAA;AAAA,IAAA,IAxBA,gBAAAV;AAAA,MAACS;AAAA,MAAA;AAAA,QACC,OAAON;AAAA,QACP,eAAe;AAAA,UACb,gBAAgB;AAAA,QAClB;AAAA,QACA,eAAe;AAAA,UACb,gBAAgB;AAAA,QAClB;AAAA,MAAA;AAAA,IAAA;AAAA,EAoBR;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 { ITableCardRef, 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 { useTableInfiniteLauncherJourney } from './hooks/use-table-infinite-launcher-journey/use-table-infinite-launcher-journey';\nimport { useTableLauncherJourney } from './hooks/use-table-launcher-journey/use-table-launcher-journey';\n\nconst sleepyBoiDimension = GAME_LAUNCHER_SIZE + GAME_LAUNCHER_ASSET_PADDING;\n\nexport const GameLauncher: FC<IGameLauncherProps> = memo(\n ({\n onSegmentClick,\n journeyId,\n data,\n isLoading,\n isTutorialOnboardingDone,\n defaultIndex = 0,\n onJourneyComplete,\n }) => {\n const carouselRefs = useRef<ICarouselRefs>(null) as React.RefObject<ICarouselRefs>;\n const tableRef = useRef<ITableCardRef>(null) as React.RefObject<ITableCardRef>;\n\n const { isJourneyActive } = useJourney();\n\n const { playSwipeSound, 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 onTableInfiniteModeClick = useCallback(() => {\n play(CircleSoundKey.GAME_CARD_CLICK);\n onSegmentClick({ mode: 'infinite' } as ITableDetails, ProjectType.TABLE);\n }, [onSegmentClick, play]);\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 onJourneyComplete,\n });\n\n const { startJourney: startInfiniteTablesJourney } = useTableInfiniteLauncherJourney({\n carouselRefs,\n onTableInfiniteModeClick,\n onJourneyComplete,\n originalTableRef: tableRef,\n });\n\n const { startJourney: startTablesJourney } = useTableLauncherJourney({\n carouselRefs,\n originalTableRef: tableRef,\n onTableSegmentClick,\n onJourneyComplete,\n onNextJourney: startInfiniteTablesJourney,\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 if (data.games) {\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 ];\n }\n\n if (data.puzzles) {\n itemTypes = [\n ...itemTypes,\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\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 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 (\n (data?.puzzles && journeyId === JOURNEY_ID_STUDENT.CIRCLE_ACTIVITIES_INTRO_JOURNEY) ||\n (data?.lessons && journeyId === JOURNEY_ID_STUDENT.CIRCLE_LESSONS_K_1_INTRO_JOURNEY)\n ) {\n startLessonPuzzleGamesJourney(journeyId, data?.puzzles, data?.lessons);\n\n return; // CIRCLE_ACTIVITIES_INTRO_JOURNEY / CIRCLE_LESSONS_K_1_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 return;\n }\n\n if (data?.tables && journeyId === JOURNEY_ID_STUDENT.CIRCLE_TABLES_INFINTE_JOURNEY) {\n startInfiniteTablesJourney();\n\n return;\n }\n }, [\n data,\n isJourneyActive,\n isLoading,\n isTutorialOnboardingDone,\n journeyId,\n startInfiniteTablesJourney,\n startLessonPuzzleGamesJourney,\n startTablesJourney,\n ]);\n\n if (isLoading) {\n return <CircularLoader />;\n }\n\n if (!data) {\n return (\n <Carousel\n items={sleepyBoiItem}\n analyticsNext={{\n analyticsLabel: '',\n }}\n analyticsPrev={{\n analyticsLabel: '',\n }}\n />\n );\n }\n\n return (\n <Carousel\n ref={carouselRefs}\n items={items}\n defaultIndex={defaultIndex}\n onNext={playSwipeSound}\n onPrev={playSwipeSound}\n analyticsNext={{\n analyticsLabel: GAME_LAUNCHER_ANALYTICS_EVENTS.NEXT_ACTIVITY,\n }}\n analyticsPrev={{\n analyticsLabel: GAME_LAUNCHER_ANALYTICS_EVENTS.PREV_ACTIVITY,\n }}\n />\n );\n },\n);\n"],"names":["sleepyBoiDimension","GAME_LAUNCHER_SIZE","GAME_LAUNCHER_ASSET_PADDING","GameLauncher","memo","onSegmentClick","journeyId","data","isLoading","isTutorialOnboardingDone","defaultIndex","onJourneyComplete","carouselRefs","useRef","tableRef","isJourneyActive","useJourney","playSwipeSound","play","useCircleSounds","onTableSegmentClick","useCallback","table","CircleSoundKey","ProjectType","onTableInfiniteModeClick","handleLessonSegmentClick","lesson","handleGameSegmentClick","game","handlePuzzleSegmentClick","puzzle","gameRefs","lessonRefs","puzzleRefs","startLessonPuzzleGamesJourney","useGameLauncherJourney","startInfiniteTablesJourney","useTableInfiniteLauncherJourney","startTablesJourney","useTableLauncherJourney","items","useMemo","itemTypes","jsx","SegmentedGameCard","TablesCard","sleepyBoiItem","LottieAnimation","LOTTIE","useEffect","JOURNEY_ID_STUDENT","CircularLoader","Carousel","GAME_LAUNCHER_ANALYTICS_EVENTS"],"mappings":";;;;;;;;;;;;;;;;;;;AA8BA,MAAMA,IAAqBC,IAAqBC,GAEnCC,KAAuCC;AAAA,EAClD,CAAC;AAAA,IACC,gBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,MAAAC;AAAA,IACA,WAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,cAAAC,IAAe;AAAA,IACf,mBAAAC;AAAA,EAAA,MACI;AACE,UAAAC,IAAeC,EAAsB,IAAI,GACzCC,IAAWD,EAAsB,IAAI,GAErC,EAAE,iBAAAE,MAAoBC,KAEtB,EAAE,gBAAAC,GAAgB,MAAAC,EAAK,IAAIC,EAAgB,GAE3CC,IAAsBC;AAAA,MAC1B,CAACC,MAAyB;AACxB,QAAAJ,EAAKK,EAAe,eAAe,GACpBlB,EAAAiB,GAAOE,EAAY,KAAK;AAAA,MACzC;AAAA,MACA,CAACnB,GAAgBa,CAAI;AAAA,IAAA,GAGjBO,IAA2BJ,EAAY,MAAM;AACjD,MAAAH,EAAKK,EAAe,eAAe,GACnClB,EAAe,EAAE,MAAM,WAAW,GAAoBmB,EAAY,KAAK;AAAA,IAAA,GACtE,CAACnB,GAAgBa,CAAI,CAAC,GAEnBQ,IAA2BL;AAAA,MAC/B,CAACM,MAAmB;AACd,QAAAA,EAAO,WAAW,gBACpBT,EAAKK,EAAe,eAAe,GACpBlB,EAAAsB,GAAQH,EAAY,MAAM;AAAA,MAE7C;AAAA,MACA,CAACnB,GAAgBa,CAAI;AAAA,IAAA,GAGjBU,IAAyBP;AAAA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