@cuemath/leap 2.8.43-rj-0 → 2.8.43-rj-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,17 +1,14 @@
1
- import { useState as E, useCallback as R, useEffect as d } from "react";
2
- import { useGetCircleHomeAPI as p } from "../../api/get-content-for-today/get-circle-home-api.js";
1
+ import { useState as R, useCallback as p, useEffect as d } from "react";
2
+ import { useGetCircleHomeAPI as C } from "../../api/get-content-for-today/get-circle-home-api.js";
3
3
  import { ProjectType as s } from "../../../games/web-view/enums/project-type-enum.js";
4
- const T = (r, o) => {
5
- const [n, _] = E(null), { data: a, get: c, isProcessed: i, ...m } = p(), l = R(
6
- (e) => {
7
- c("", {
8
- user_id: r,
9
- country_code: e,
10
- grade: o
11
- });
12
- },
13
- [c, r, o]
14
- );
4
+ const L = (r, o, c) => {
5
+ const [_, m] = R(null), { data: a, get: n, isProcessed: i, ...l } = C(), E = p(() => {
6
+ n("", {
7
+ user_id: r,
8
+ country_code: o,
9
+ grade: c
10
+ });
11
+ }, [n, r, o, c]);
15
12
  return d(() => {
16
13
  let e = null;
17
14
  i && a && (e = {
@@ -87,10 +84,10 @@ const T = (r, o) => {
87
84
  stars: t.stars
88
85
  }))
89
86
  }
90
- })), _(e);
91
- }, [a, i]), { data: n, isProcessed: i, getCircleHomeDetails: l, ...m };
87
+ })), m(e);
88
+ }, [a, i]), { data: _, isProcessed: i, getCircleHomeDetails: E, ...l };
92
89
  };
93
90
  export {
94
- T as useGetCircleHomeDetailsDal
91
+ L as useGetCircleHomeDetailsDal
95
92
  };
96
93
  //# sourceMappingURL=use-get-circle-home-details-dal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-get-circle-home-details-dal.js","sources":["../../../../../../src/features/circle-games/game-launcher/dal/use-get-circle-home-details-dal/use-get-circle-home-details-dal.ts"],"sourcesContent":["import type {\n ICircleHomeDetails,\n TStreakStatus,\n TTableMode,\n} from './use-get-circle-home-dal-types';\n\nimport { useCallback, useEffect, useState } from 'react';\n\nimport { ProjectType } from '../../../games/web-view/enums';\nimport { useGetCircleHomeAPI } from '../../api/get-content-for-today/get-circle-home-api';\n\nexport const useGetCircleHomeDetailsDal = (\n userId: string,\n grade: string,\n): Omit<ReturnType<typeof useGetCircleHomeAPI>, 'data' | 'get'> & {\n data: ICircleHomeDetails | null;\n getCircleHomeDetails: (countryCode: string) => void;\n} => {\n const [contentForToday, setContentForToday] = useState<ICircleHomeDetails | null>(null);\n const { data, get: getHomeDetails, isProcessed, ...rest } = useGetCircleHomeAPI();\n\n const getCircleHomeDetails = useCallback(\n (countryCode: string) => {\n getHomeDetails('', {\n user_id: userId,\n country_code: countryCode,\n grade: grade,\n });\n },\n [getHomeDetails, userId, grade],\n );\n\n useEffect(() => {\n let circleHomeDetails: ICircleHomeDetails | null = null;\n\n if (isProcessed && data) {\n circleHomeDetails = {\n points: data.points,\n streakDays: data.streak_days,\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 coachmarkProgress: {\n CIRCLE_ACTIVITIES_INTRO_JOURNEY:\n data.coachmark_completion.CIRCLE_ACTIVITIES_INTRO_JOURNEY,\n CIRCLE_LEADERBOARD_INTRO_JOURNEY:\n data.coachmark_completion.CIRCLE_LEADERBOARD_INTRO_JOURNEY,\n CIRCLE_POINTS_REWARD_JOURNEY: data.coachmark_completion.CIRCLE_POINTS_REWARD_JOURNEY,\n CIRCLE_STREAK_UPDATE_JOURNEY: data.coachmark_completion.CIRCLE_STREAK_UPDATE_JOURNEY,\n CIRCLE_TUTORIAL_JOURNEY: data.coachmark_completion.CIRCLE_TUTORIAL_JOURNEY,\n CIRCLE_TABLES_INTRO_JOURNEY: data.coachmark_completion.CIRCLE_TABLES_INTRO_JOURNEY,\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 setContentForToday(circleHomeDetails);\n }, [data, isProcessed]);\n\n return { data: contentForToday, isProcessed, getCircleHomeDetails, ...rest };\n};\n"],"names":["useGetCircleHomeDetailsDal","userId","grade","contentForToday","setContentForToday","useState","data","getHomeDetails","isProcessed","rest","useGetCircleHomeAPI","getCircleHomeDetails","useCallback","countryCode","useEffect","circleHomeDetails","ProjectType","game","puzzle","lesson","table"],"mappings":";;;AAWa,MAAAA,IAA6B,CACxCC,GACAC,MAIG;AACH,QAAM,CAACC,GAAiBC,CAAkB,IAAIC,EAAoC,IAAI,GAChF,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,GAAiB,aAAAK,GAAa,sBAAAG,GAAsB,GAAGF;AACxE;"}
1
+ {"version":3,"file":"use-get-circle-home-details-dal.js","sources":["../../../../../../src/features/circle-games/game-launcher/dal/use-get-circle-home-details-dal/use-get-circle-home-details-dal.ts"],"sourcesContent":["import type {\n ICircleHomeDetails,\n TStreakStatus,\n TTableMode,\n} from './use-get-circle-home-dal-types';\n\nimport { useCallback, useEffect, useState } from 'react';\n\nimport { ProjectType } from '../../../games/web-view/enums';\nimport { useGetCircleHomeAPI } from '../../api/get-content-for-today/get-circle-home-api';\n\nexport const useGetCircleHomeDetailsDal = (\n userId: string,\n countryCode: string,\n grade: string,\n): Omit<ReturnType<typeof useGetCircleHomeAPI>, 'data' | 'get'> & {\n data: ICircleHomeDetails | null;\n getCircleHomeDetails: () => void;\n} => {\n const [contentForToday, setContentForToday] = useState<ICircleHomeDetails | null>(null);\n const { data, get: getHomeDetails, isProcessed, ...rest } = useGetCircleHomeAPI();\n\n const getCircleHomeDetails = useCallback(() => {\n getHomeDetails('', {\n user_id: userId,\n country_code: countryCode,\n grade: grade,\n });\n }, [getHomeDetails, userId, countryCode, grade]);\n\n useEffect(() => {\n let circleHomeDetails: ICircleHomeDetails | null = null;\n\n if (isProcessed && data) {\n circleHomeDetails = {\n points: data.points,\n streakDays: data.streak_days,\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 coachmarkProgress: {\n CIRCLE_ACTIVITIES_INTRO_JOURNEY:\n data.coachmark_completion.CIRCLE_ACTIVITIES_INTRO_JOURNEY,\n CIRCLE_LEADERBOARD_INTRO_JOURNEY:\n data.coachmark_completion.CIRCLE_LEADERBOARD_INTRO_JOURNEY,\n CIRCLE_POINTS_REWARD_JOURNEY: data.coachmark_completion.CIRCLE_POINTS_REWARD_JOURNEY,\n CIRCLE_STREAK_UPDATE_JOURNEY: data.coachmark_completion.CIRCLE_STREAK_UPDATE_JOURNEY,\n CIRCLE_TUTORIAL_JOURNEY: data.coachmark_completion.CIRCLE_TUTORIAL_JOURNEY,\n CIRCLE_TABLES_INTRO_JOURNEY: data.coachmark_completion.CIRCLE_TABLES_INTRO_JOURNEY,\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 setContentForToday(circleHomeDetails);\n }, [data, isProcessed]);\n\n return { data: contentForToday, isProcessed, getCircleHomeDetails, ...rest };\n};\n"],"names":["useGetCircleHomeDetailsDal","userId","countryCode","grade","contentForToday","setContentForToday","useState","data","getHomeDetails","isProcessed","rest","useGetCircleHomeAPI","getCircleHomeDetails","useCallback","useEffect","circleHomeDetails","ProjectType","game","puzzle","lesson","table"],"mappings":";;;AAWO,MAAMA,IAA6B,CACxCC,GACAC,GACAC,MAIG;AACH,QAAM,CAACC,GAAiBC,CAAkB,IAAIC,EAAoC,IAAI,GAChF,EAAE,MAAAC,GAAM,KAAKC,GAAgB,aAAAC,GAAa,GAAGC,EAAA,IAASC,KAEtDC,IAAuBC,EAAY,MAAM;AAC7C,IAAAL,EAAe,IAAI;AAAA,MACjB,SAASP;AAAA,MACT,cAAcC;AAAA,MACd,OAAAC;AAAA,IAAA,CACD;AAAA,KACA,CAACK,GAAgBP,GAAQC,GAAaC,CAAK,CAAC;AAE/C,SAAAW,EAAU,MAAM;AACd,QAAIC,IAA+C;AAEnD,IAAIN,KAAeF,MACGQ,IAAA;AAAA,MAClB,QAAQR,EAAK;AAAA,MACb,YAAYA,EAAK;AAAA,MACjB,cAAcA,EAAK;AAAA,MACnB,gBAAgBA,EAAK;AAAA,MACrB,UAAU;AAAA,QACR,OAAO;AAAA,UACL,OAAOA,EAAK,SAAS,MAAM;AAAA,UAC3B,MAAMS,EAAY;AAAA,UAClB,sBAAsB;AAAA,UACtB,MAAMT,EAAK,SAAS,MAAM,KAAK,IAAI,CAASU,OAAA;AAAA,YAC1C,IAAIA,EAAK;AAAA,YACT,MAAMA,EAAK;AAAA,YACX,YAAYA,EAAK;AAAA,YACjB,UAAUA,EAAK;AAAA,YACf,SAASA,EAAK;AAAA,YACd,UAAUA,EAAK;AAAA,UAAA,EACf;AAAA,QACJ;AAAA,QACA,SAAS;AAAA,UACP,OAAOV,EAAK,SAAS,QAAQ;AAAA,UAC7B,MAAMS,EAAY;AAAA,UAClB,sBAAsB;AAAA,UACtB,MAAMT,EAAK,SAAS,QAAQ,KAAK,IAAI,CAAWW,OAAA;AAAA,YAC9C,IAAIA,EAAO;AAAA,YACX,MAAMA,EAAO;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S,OAAO,KAAK,mBAAmB,IAAI,CAAUa,OAAA;AAAA,UACpE,aAAaA,EAAM;AAAA,UACnB,OAAOA,EAAM;AAAA,QAAA,EACb;AAAA,MACJ;AAAA,IAAA,KAINf,EAAmBU,CAAiB;AAAA,EAAA,GACnC,CAACR,GAAME,CAAW,CAAC,GAEf,EAAE,MAAML,GAAiB,aAAAK,GAAa,sBAAAG,GAAsB,GAAGF;AACxE;"}
@@ -1,9 +1,8 @@
1
- const _ = 500, S = 1e3, E = 500, T = 1500, L = 3e3;
1
+ const _ = 500, S = 500, E = 1500, T = 3e3;
2
2
  export {
3
- E as GO_TO_NEXT_SLIDE_AFTER_MS,
4
- T as SHOW_LABEL_HIGHLIGHT_AFTER_MS,
5
- L as SHOW_NUDGE_AFTER_MS,
6
- _ as SLIDE_TO_LESSON_MS,
7
- S as START_JOURNEY_DELAY_MS
3
+ S as GO_TO_NEXT_SLIDE_AFTER_MS,
4
+ E as SHOW_LABEL_HIGHLIGHT_AFTER_MS,
5
+ T as SHOW_NUDGE_AFTER_MS,
6
+ _ as SLIDE_TO_LESSON_MS
8
7
  };
9
8
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../../../../../src/features/circle-games/game-launcher/hooks/use-game-launcher-journey/constants.ts"],"sourcesContent":["export const SLIDE_TO_LESSON_MS = 500;\nexport const START_JOURNEY_DELAY_MS = 1000;\n\nexport const GO_TO_NEXT_SLIDE_AFTER_MS = 500;\nexport const SHOW_LABEL_HIGHLIGHT_AFTER_MS = 1500;\nexport const SHOW_NUDGE_AFTER_MS = 3000;\nexport const FIRST_COACHMARK_AFTER_MS = 200;\n"],"names":["SLIDE_TO_LESSON_MS","START_JOURNEY_DELAY_MS","GO_TO_NEXT_SLIDE_AFTER_MS","SHOW_LABEL_HIGHLIGHT_AFTER_MS","SHOW_NUDGE_AFTER_MS"],"mappings":"AAAO,MAAMA,IAAqB,KACrBC,IAAyB,KAEzBC,IAA4B,KAC5BC,IAAgC,MAChCC,IAAsB;"}
1
+ {"version":3,"file":"constants.js","sources":["../../../../../../src/features/circle-games/game-launcher/hooks/use-game-launcher-journey/constants.ts"],"sourcesContent":["export const SLIDE_TO_LESSON_MS = 500;\n\nexport const GO_TO_NEXT_SLIDE_AFTER_MS = 500;\nexport const SHOW_LABEL_HIGHLIGHT_AFTER_MS = 1500;\nexport const SHOW_NUDGE_AFTER_MS = 3000;\nexport const FIRST_COACHMARK_AFTER_MS = 200;\n"],"names":["SLIDE_TO_LESSON_MS","GO_TO_NEXT_SLIDE_AFTER_MS","SHOW_LABEL_HIGHLIGHT_AFTER_MS","SHOW_NUDGE_AFTER_MS"],"mappings":"AAAO,MAAMA,IAAqB,KAErBC,IAA4B,KAC5BC,IAAgC,MAChCC,IAAsB;"}
@@ -1,125 +1,125 @@
1
1
  import { jsx as e, Fragment as I } from "react/jsx-runtime";
2
- import { useRef as C, useCallback as E, useMemo as ne } from "react";
3
- import q from "../../../../../assets/line-icons/icons/carat-right.js";
4
- import { PLATFORM_EVENTS_STUDENT as Q } from "../../../../analytics-events/platform-events-student.js";
5
- import { IndicatorType as s } from "../../../../journey/use-journey/constants.js";
6
- import { useJourney as ie } from "../../../../journey/use-journey/use-journey.js";
7
- import j from "../../../../ui/buttons/icon-button/icon-button.js";
8
- import { useUIContext as oe } from "../../../../ui/context/context.js";
2
+ import { useRef as f, useCallback as E, useMemo as ie } from "react";
3
+ import Q from "../../../../../assets/line-icons/icons/carat-right.js";
4
+ import { PLATFORM_EVENTS_STUDENT as j } from "../../../../analytics-events/platform-events-student.js";
5
+ import { IndicatorType as d } from "../../../../journey/use-journey/constants.js";
6
+ import { useJourney as oe } from "../../../../journey/use-journey/use-journey.js";
7
+ import z from "../../../../ui/buttons/icon-button/icon-button.js";
8
+ import { useUIContext as le } from "../../../../ui/context/context.js";
9
9
  import L from "../../../../ui/layout/flex-view.js";
10
- import g from "../../../../ui/text/text.js";
10
+ import s from "../../../../ui/text/text.js";
11
11
  import { CIRCLE_ONBOARDING_ANALYTICS_STEPS as p } from "../../../enum/circle-onboarding-steps.js";
12
- import { useCircleSounds as le } from "../../../hooks/use-circle-sounds/use-circle-sounds.js";
13
- import { SegmentedGameCard as ce } from "../../comps/segmented-game-card/segmented-game-card.js";
14
- import { GAME_LAUNCHER_ANALYTICS_EVENTS as z } from "../../game-launcher-analytics-events.js";
15
- import { GO_TO_NEXT_SLIDE_AFTER_MS as ae, SHOW_LABEL_HIGHLIGHT_AFTER_MS as de, SHOW_NUDGE_AFTER_MS as se, START_JOURNEY_DELAY_MS as ge, SLIDE_TO_LESSON_MS as he } from "./constants.js";
12
+ import { useCircleSounds as ce } from "../../../hooks/use-circle-sounds/use-circle-sounds.js";
13
+ import { SegmentedGameCard as ae } from "../../comps/segmented-game-card/segmented-game-card.js";
14
+ import { GAME_LAUNCHER_ANALYTICS_EVENTS as ee } from "../../game-launcher-analytics-events.js";
15
+ import { GO_TO_NEXT_SLIDE_AFTER_MS as de, SHOW_LABEL_HIGHLIGHT_AFTER_MS as se, SHOW_NUDGE_AFTER_MS as ge, SLIDE_TO_LESSON_MS as he } from "./constants.js";
16
16
  import { ProjectType as me } from "../../../games/web-view/enums/project-type-enum.js";
17
17
  const He = ({
18
18
  carouselRefs: n,
19
19
  onSegmentClick: O,
20
20
  onJourneyComplete: S
21
21
  }) => {
22
- const o = C(null), r = C(null), d = C(null), R = C(!1), { playButtonSound: b } = le(), { nextCoachmark: c, setJourney: N } = ie(), { onEvent: _ } = oe(), P = E(
22
+ const o = f(null), r = f(null), a = f(null), b = f(!1), { playButtonSound: R } = ce(), { nextCoachmark: l, setJourney: P } = oe(), { onEvent: _ } = le(), N = E(
23
23
  (t) => {
24
- _(Q.ONBOARDING_STEP_VIEWED, {
24
+ _(j.ONBOARDING_STEP_VIEWED, {
25
25
  step: t
26
26
  });
27
27
  },
28
28
  [_]
29
29
  ), y = E(
30
30
  (t) => {
31
- _(Q.ONBOARDING_STEP_COMPLETED, {
31
+ _(j.ONBOARDING_STEP_COMPLETED, {
32
32
  step: t
33
33
  });
34
34
  },
35
35
  [_]
36
- ), h = E(
37
- (t, a, i, m, A = !1) => {
38
- var T, u;
39
- A || (b(), (u = n.current) == null || u.goToIndex(((T = n.current) == null ? void 0 : T.currentIndex) + 1), c(m, !1, ae)), P(t);
40
- const f = setTimeout(() => {
41
- clearTimeout(f), a.startLabelAnimation(i);
42
- }, de);
43
- c(m, !0, se);
36
+ ), g = E(
37
+ (t, c, i, h, A = !1) => {
38
+ var m, T;
39
+ A || (R(), (T = n.current) == null || T.goToIndex(((m = n.current) == null ? void 0 : m.currentIndex) + 1), l(h, !1, de)), N(t);
40
+ const C = setTimeout(() => {
41
+ clearTimeout(C), c.startLabelAnimation(i);
42
+ }, se);
43
+ l(h, !0, ge);
44
44
  },
45
- [n, c, b, P]
45
+ [n, l, R, N]
46
46
  ), H = E(
47
- (t, a) => {
48
- O(t, me.PUZZLE), y(p.PUZZLE_ACTIVITY), c(a), S(a);
47
+ (t, c) => {
48
+ O(t, me.PUZZLE), y(p.PUZZLE_ACTIVITY), l(c), S(c);
49
49
  },
50
- [c, S, O, y]
50
+ [l, S, O, y]
51
51
  ), G = E(
52
- (t, a, i) => {
53
- var Y, k, w, U, v, B, V, x, D, M, W, X, $, J, F, Z, K;
54
- if (R.current || !((Y = n == null ? void 0 : n.current) != null && Y.nextBtnRef.current) || !((k = r == null ? void 0 : r.current) != null && k.segmentedCardWrapperRef.current) || !((w = o == null ? void 0 : o.current) != null && w.labelRef.current) || !((U = r == null ? void 0 : r.current) != null && U.labelRef.current) || !t)
52
+ (t, c, i) => {
53
+ var k, w, Y, v, B, U, V, x, D, M, W, X, $, J, F, Z, K, q;
54
+ if (b.current || !((k = n == null ? void 0 : n.current) != null && k.nextBtnRef.current) || !((w = r == null ? void 0 : r.current) != null && w.segmentedCardWrapperRef.current) || !((Y = o == null ? void 0 : o.current) != null && Y.labelRef.current) || !((v = r == null ? void 0 : r.current) != null && v.labelRef.current) || !t)
55
55
  return;
56
- R.current = !0;
57
- const m = ((V = (B = (v = d.current) == null ? void 0 : v.labelRef) == null ? void 0 : B.current) == null ? void 0 : V.getBoundingClientRect()) || {
56
+ b.current = !0;
57
+ const h = ((V = (U = (B = a.current) == null ? void 0 : B.labelRef) == null ? void 0 : U.current) == null ? void 0 : V.getBoundingClientRect()) || {
58
58
  height: 0,
59
59
  width: 0
60
60
  }, A = ((M = (D = (x = o.current) == null ? void 0 : x.labelRef) == null ? void 0 : D.current) == null ? void 0 : M.getBoundingClientRect()) || {
61
61
  height: 0,
62
62
  width: 0
63
- }, f = (($ = (X = (W = r.current) == null ? void 0 : W.labelRef) == null ? void 0 : X.current) == null ? void 0 : $.getBoundingClientRect()) || {
63
+ }, C = (($ = (X = (W = r.current) == null ? void 0 : W.labelRef) == null ? void 0 : X.current) == null ? void 0 : $.getBoundingClientRect()) || {
64
64
  height: 0,
65
65
  width: 0
66
- }, T = ((Z = (F = (J = r.current) == null ? void 0 : J.segmentedCardWrapperRef) == null ? void 0 : F.current) == null ? void 0 : Z.getBoundingClientRect()) || {
66
+ }, m = ((Z = (F = (J = r.current) == null ? void 0 : J.segmentedCardWrapperRef) == null ? void 0 : F.current) == null ? void 0 : Z.getBoundingClientRect()) || {
67
67
  height: 0,
68
68
  width: 0
69
69
  };
70
- let u = [];
71
- a && d.current && (u = [
70
+ let T = [];
71
+ c && a.current && (T = [
72
72
  {
73
- originalElementToHighlightRef: d.current.labelRef,
73
+ originalElementToHighlightRef: a.current.labelRef,
74
74
  isActive: !1,
75
- type: s.TOOLTIP,
75
+ type: d.TOOLTIP,
76
76
  elementToHighlight: /* @__PURE__ */ e(I, {}),
77
77
  indicator: {
78
78
  position: "right",
79
79
  backgroundColor: "BLUE_4",
80
80
  width: 264,
81
- tooltipItem: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(g, { $renderAs: "ab2-bold", children: "Get faster & stay ahead in school. Practice 3 new skills everyday." }) }),
82
- tooltipXCoOrdinates: m.width + 50,
83
- tooltipYCoOrdinates: m.height / 2
81
+ tooltipItem: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(s, { $renderAs: "ab2-bold", children: "Get faster & stay ahead in school. Practice 3 new skills everyday." }) }),
82
+ tooltipXCoOrdinates: h.width + 50,
83
+ tooltipYCoOrdinates: h.height / 2
84
84
  }
85
85
  },
86
86
  {
87
87
  originalElementToHighlightRef: (K = n.current) == null ? void 0 : K.nextBtnRef,
88
88
  isActive: !1,
89
- type: s.NUDGE,
89
+ type: d.NUDGE,
90
90
  elementToHighlight: /* @__PURE__ */ e(
91
- j,
91
+ z,
92
92
  {
93
93
  renderAs: "secondary",
94
- Icon: q,
95
- onClick: () => h(
94
+ Icon: Q,
95
+ onClick: () => g(
96
96
  p.GAMES_ACTIVITY,
97
97
  o.current,
98
98
  "ORANGE_4",
99
99
  i
100
100
  ),
101
- analyticsLabel: z.JOURNEY_NEXT_ACTIVITY
101
+ analyticsLabel: ee.JOURNEY_NEXT_ACTIVITY
102
102
  }
103
103
  ),
104
104
  indicator: {
105
105
  nudge: "click",
106
- content: /* @__PURE__ */ e(g, { $renderAs: "ab1", $color: "WHITE", children: "Click to proceed" }),
106
+ content: /* @__PURE__ */ e(s, { $renderAs: "ab1", $color: "WHITE", children: "Click to proceed" }),
107
107
  nudgePointerX: 0,
108
108
  nudgePointerY: 0
109
109
  }
110
110
  }
111
111
  ]);
112
- const ee = [
112
+ const te = [
113
113
  {
114
114
  originalElementToHighlightRef: o.current.labelRef,
115
115
  isActive: !1,
116
- type: s.TOOLTIP,
116
+ type: d.TOOLTIP,
117
117
  elementToHighlight: /* @__PURE__ */ e(I, {}),
118
118
  indicator: {
119
119
  position: "right",
120
120
  backgroundColor: "ORANGE_4",
121
121
  width: 264,
122
- tooltipItem: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(g, { $renderAs: "ab2-bold", children: "Train to think deeper & plan ahead. Play 3 new games everyday." }) }),
122
+ tooltipItem: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(s, { $renderAs: "ab2-bold", children: "Train to think deeper & plan ahead. Play 3 new games everyday." }) }),
123
123
  tooltipXCoOrdinates: A.width + 50,
124
124
  tooltipYCoOrdinates: A.height / 2
125
125
  }
@@ -127,85 +127,84 @@ const He = ({
127
127
  {
128
128
  originalElementToHighlightRef: n.current.nextBtnRef,
129
129
  isActive: !1,
130
- type: s.NUDGE,
130
+ type: d.NUDGE,
131
131
  elementToHighlight: /* @__PURE__ */ e(
132
- j,
132
+ z,
133
133
  {
134
134
  renderAs: "secondary",
135
- Icon: q,
136
- onClick: () => h(
135
+ Icon: Q,
136
+ onClick: () => g(
137
137
  p.PUZZLE_ACTIVITY,
138
138
  r.current,
139
139
  "PURPLE_4",
140
140
  i
141
141
  ),
142
- analyticsLabel: z.JOURNEY_NEXT_ACTIVITY
142
+ analyticsLabel: ee.JOURNEY_NEXT_ACTIVITY
143
143
  }
144
144
  ),
145
145
  indicator: {
146
146
  nudge: "click",
147
- content: /* @__PURE__ */ e(g, { $renderAs: "ab1", $color: "WHITE", children: "Click to proceed" }),
147
+ content: /* @__PURE__ */ e(s, { $renderAs: "ab1", $color: "WHITE", children: "Click to proceed" }),
148
148
  nudgePointerX: 0,
149
149
  nudgePointerY: 0
150
150
  }
151
151
  }
152
- ], te = [
152
+ ], re = [
153
153
  {
154
154
  originalElementToHighlightRef: r.current.labelRef,
155
155
  isActive: !1,
156
- type: s.TOOLTIP,
156
+ type: d.TOOLTIP,
157
157
  elementToHighlight: /* @__PURE__ */ e(I, {}),
158
158
  indicator: {
159
159
  position: "right",
160
160
  backgroundColor: "PURPLE_4",
161
161
  width: 264,
162
- tooltipItem: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(g, { $renderAs: "ab2-bold", children: "Think in new ways & stay sharp. Solve 3 new puzzles everyday." }) }),
163
- tooltipXCoOrdinates: f.width + 50,
164
- tooltipYCoOrdinates: f.height / 2
162
+ tooltipItem: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(s, { $renderAs: "ab2-bold", children: "Think in new ways & stay sharp. Solve 3 new puzzles everyday." }) }),
163
+ tooltipXCoOrdinates: C.width + 50,
164
+ tooltipYCoOrdinates: C.height / 2
165
165
  }
166
166
  },
167
167
  {
168
168
  originalElementToHighlightRef: r.current.segmentedCardWrapperRef,
169
169
  isActive: !1,
170
- type: s.NUDGE,
170
+ type: d.NUDGE,
171
171
  elementToHighlight: /* @__PURE__ */ e(
172
- ce,
172
+ ae,
173
173
  {
174
174
  label: "",
175
- value: t.data.filter((l) => l.solved).length,
175
+ value: t.data.filter((u) => u.solved).length,
176
176
  maxValue: t.data.length,
177
177
  initialValue: t.initialProgressValue,
178
- data: t.data.map((l) => ({
179
- card: l.cardLottie,
178
+ data: t.data.map((u) => ({
179
+ card: u.cardLottie,
180
180
  name: "",
181
181
  // We dont want to show the name of the puzzle in onboarding
182
- isCompleted: l.solved,
183
- onPress: () => H(l, i)
182
+ isCompleted: u.solved,
183
+ onPress: () => H(u, i)
184
184
  }))
185
185
  }
186
186
  ),
187
187
  indicator: {
188
188
  nudge: "click",
189
- content: /* @__PURE__ */ e(g, { $renderAs: "ab1", $color: "WHITE", children: "Click to solve a puzzle" }),
190
- nudgePointerX: T.width * 0.6,
191
- nudgePointerY: T.height * 0.4
189
+ content: /* @__PURE__ */ e(s, { $renderAs: "ab1", $color: "WHITE", children: "Click to solve a puzzle" }),
190
+ nudgePointerX: m.width * 0.6,
191
+ nudgePointerY: m.height * 0.4
192
192
  }
193
193
  }
194
194
  ];
195
- N(i, [...u, ...ee, ...te]);
196
- const re = setTimeout(() => {
197
- var l;
198
- clearTimeout(re), (l = n.current) == null || l.goToIndex(0), c(i, !1, ge);
195
+ P(i, [...T, ...te, ...re]), (q = n.current) == null || q.goToIndex(0);
196
+ const ne = setTimeout(() => {
197
+ clearTimeout(ne), l(i);
199
198
  }, he);
200
- a && d.current ? h(p.SKILL_ACTIVITY, d.current, "BLUE_4", i, !0) : h(p.GAMES_ACTIVITY, o.current, "ORANGE_4", i, !0);
199
+ c && a.current ? g(p.SKILL_ACTIVITY, a.current, "BLUE_4", i, !0) : g(p.GAMES_ACTIVITY, o.current, "ORANGE_4", i, !0);
201
200
  },
202
- [n, H, h, c, N]
201
+ [n, H, g, l, P]
203
202
  );
204
- return ne(
203
+ return ie(
205
204
  () => ({
206
205
  gameRefs: o,
207
206
  puzzleRefs: r,
208
- lessonRefs: d,
207
+ lessonRefs: a,
209
208
  startJourney: G
210
209
  }),
211
210
  [G]
@@ -1 +1 @@
1
- {"version":3,"file":"use-game-launcher-journey.js","sources":["../../../../../../src/features/circle-games/game-launcher/hooks/use-game-launcher-journey/use-game-launcher-journey.tsx"],"sourcesContent":["import type { TJourneyId } from '../../../../journey/journey-id/journey-id-types';\nimport type { ICoachmarkProps } from '../../../../journey/use-journey/journey-context-types';\nimport type { IArrowTooltipProps } from '../../../../ui/arrow-tooltip/arrow-tooltip-types';\nimport type { INudgeProps } from '../../../../ui/nudge/nudge-types';\nimport type { TColorNames } from '../../../../ui/types';\nimport type { ISegmentedGameCardRefs } from '../../comps/segmented-game-card/segmented-game-card-types';\nimport type {\n IProject,\n Puzzle,\n} from '../../dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport type { IUseGameLauncherJourneyProps } from './use-game-launcher-journey-types';\n\nimport { useCallback, useMemo, useRef } from 'react';\n\nimport CaratRightIcon from '../../../../../assets/line-icons/icons/carat-right';\nimport { PLATFORM_EVENTS_STUDENT as AnalyticsLabel } from '../../../../analytics-events/platform-events-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 ActionEvent } from '../../../enum/circle-onboarding-steps';\nimport { ProjectType } from '../../../games/web-view/enums';\nimport { useCircleSounds } from '../../../hooks/use-circle-sounds/use-circle-sounds';\nimport { SegmentedGameCard } from '../../comps/segmented-game-card/segmented-game-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from '../../game-launcher-analytics-events';\nimport {\n GO_TO_NEXT_SLIDE_AFTER_MS,\n SHOW_LABEL_HIGHLIGHT_AFTER_MS,\n SHOW_NUDGE_AFTER_MS,\n SLIDE_TO_LESSON_MS,\n START_JOURNEY_DELAY_MS,\n} from './constants';\n\nexport const useGameLauncherJourney = ({\n carouselRefs,\n onSegmentClick,\n onJourneyComplete,\n}: IUseGameLauncherJourneyProps) => {\n const gameRefs = useRef<ISegmentedGameCardRefs>(null);\n const puzzleRefs = useRef<ISegmentedGameCardRefs>(null);\n const lessonRefs = useRef<ISegmentedGameCardRefs>(null);\n\n const isJourneyInProgress = useRef(false);\n\n const { playButtonSound } = useCircleSounds();\n const { nextCoachmark, setJourney } = useJourney();\n const { onEvent: trackAnalytics } = useUIContext();\n\n const trackEventViewed = useCallback(\n (step: ActionEvent) => {\n trackAnalytics(AnalyticsLabel.ONBOARDING_STEP_VIEWED, {\n step,\n });\n },\n [trackAnalytics],\n );\n const trackEventCompleted = useCallback(\n (step: ActionEvent) => {\n trackAnalytics(AnalyticsLabel.ONBOARDING_STEP_COMPLETED, {\n step,\n });\n },\n [trackAnalytics],\n );\n\n const goToNextCard = useCallback(\n (\n analyticsLabelViewed: ActionEvent,\n refOfNextSlide: ISegmentedGameCardRefs,\n color: TColorNames,\n journeyId: TJourneyId,\n isFirstSlide: boolean = false,\n ) => {\n if (!isFirstSlide) {\n playButtonSound();\n carouselRefs.current?.goToIndex(carouselRefs.current?.currentIndex + 1);\n nextCoachmark(journeyId, false, GO_TO_NEXT_SLIDE_AFTER_MS);\n }\n\n trackEventViewed(analyticsLabelViewed);\n\n const animateLabelTimer = setTimeout(() => {\n clearTimeout(animateLabelTimer);\n refOfNextSlide.startLabelAnimation(color);\n }, SHOW_LABEL_HIGHLIGHT_AFTER_MS);\n\n nextCoachmark(journeyId, true, SHOW_NUDGE_AFTER_MS);\n },\n [carouselRefs, nextCoachmark, playButtonSound, trackEventViewed],\n );\n\n const endJourney = useCallback(\n (puzzlesData: Puzzle, journeyId: TJourneyId) => {\n onSegmentClick(puzzlesData, ProjectType.PUZZLE);\n trackEventCompleted(ActionEvent.PUZZLE_ACTIVITY);\n nextCoachmark(journeyId);\n onJourneyComplete(journeyId);\n },\n [nextCoachmark, onJourneyComplete, onSegmentClick, trackEventCompleted],\n );\n\n const startJourney = useCallback(\n (puzzlesData: IProject<Puzzle>, isLessonAvailable: boolean, journeyId: TJourneyId) => {\n if (isJourneyInProgress.current) {\n return;\n }\n\n // If element refs are not available return, this is just for type safety\n if (\n !carouselRefs?.current?.nextBtnRef.current ||\n !puzzleRefs?.current?.segmentedCardWrapperRef.current ||\n !gameRefs?.current?.labelRef.current ||\n !puzzleRefs?.current?.labelRef.current ||\n !puzzlesData\n ) {\n return;\n }\n\n isJourneyInProgress.current = true;\n const lessonLabelDims = lessonRefs.current?.labelRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n const gameLabelDims = gameRefs.current?.labelRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n const puzzleLabelDims = puzzleRefs.current?.labelRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n\n const launcherDims =\n puzzleRefs.current?.segmentedCardWrapperRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n\n let lessonSteps: ICoachmarkProps[] = [];\n\n if (isLessonAvailable && lessonRefs.current) {\n lessonSteps = [\n {\n originalElementToHighlightRef: lessonRefs.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'BLUE_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Get faster & stay ahead in school. Practice 3 new skills everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: lessonLabelDims.width + 50,\n tooltipYCoOrdinates: lessonLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: carouselRefs.current?.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={() =>\n goToNextCard(\n ActionEvent.GAMES_ACTIVITY,\n gameRefs.current as ISegmentedGameCardRefs,\n 'ORANGE_4',\n journeyId,\n )\n }\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\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 },\n ];\n }\n\n const gameSteps: ICoachmarkProps[] = [\n {\n originalElementToHighlightRef: gameRefs.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'ORANGE_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Train to think deeper & plan ahead. Play 3 new games everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: gameLabelDims.width + 50,\n tooltipYCoOrdinates: gameLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: carouselRefs.current.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={() =>\n goToNextCard(\n ActionEvent.PUZZLE_ACTIVITY,\n puzzleRefs.current as ISegmentedGameCardRefs,\n 'PURPLE_4',\n journeyId,\n )\n }\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\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 },\n ];\n\n const puzzleSteps: ICoachmarkProps[] = [\n {\n originalElementToHighlightRef: puzzleRefs.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'PURPLE_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Think in new ways & stay sharp. Solve 3 new puzzles everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: puzzleLabelDims.width + 50,\n tooltipYCoOrdinates: puzzleLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: puzzleRefs.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <SegmentedGameCard\n label={''} // This is intentionally left blank to avoid showing the label\n value={puzzlesData.data.filter(puzzle => puzzle.solved).length}\n maxValue={puzzlesData.data.length}\n initialValue={puzzlesData.initialProgressValue}\n data={puzzlesData.data.map(puzzle => ({\n card: puzzle.cardLottie,\n name: '', // We dont want to show the name of the puzzle in onboarding\n isCompleted: puzzle.solved,\n onPress: () => endJourney(puzzle, journeyId),\n }))}\n />\n ),\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to solve a puzzle\n </Text>\n ),\n nudgePointerX: launcherDims.width * 0.6,\n nudgePointerY: launcherDims.height * 0.4,\n } as INudgeProps,\n },\n ];\n\n setJourney(journeyId, [...lessonSteps, ...gameSteps, ...puzzleSteps]);\n\n const delayBeforeStart = setTimeout(() => {\n clearTimeout(delayBeforeStart);\n carouselRefs.current?.goToIndex(0); // Always start from 0th Index no matter what the current index is\n nextCoachmark(journeyId, false, START_JOURNEY_DELAY_MS);\n }, SLIDE_TO_LESSON_MS);\n\n if (isLessonAvailable && lessonRefs.current) {\n goToNextCard(ActionEvent.SKILL_ACTIVITY, lessonRefs.current, 'BLUE_4', journeyId, true);\n } else {\n goToNextCard(ActionEvent.GAMES_ACTIVITY, gameRefs.current, 'ORANGE_4', journeyId, true);\n }\n },\n [carouselRefs, endJourney, goToNextCard, nextCoachmark, setJourney],\n );\n\n const data = useMemo(\n () => ({\n gameRefs,\n puzzleRefs,\n lessonRefs,\n startJourney,\n }),\n [startJourney],\n );\n\n return data;\n};\n"],"names":["useGameLauncherJourney","carouselRefs","onSegmentClick","onJourneyComplete","gameRefs","useRef","puzzleRefs","lessonRefs","isJourneyInProgress","playButtonSound","useCircleSounds","nextCoachmark","setJourney","useJourney","trackAnalytics","useUIContext","trackEventViewed","useCallback","step","AnalyticsLabel","trackEventCompleted","goToNextCard","analyticsLabelViewed","refOfNextSlide","color","journeyId","isFirstSlide","_b","_a","GO_TO_NEXT_SLIDE_AFTER_MS","animateLabelTimer","SHOW_LABEL_HIGHLIGHT_AFTER_MS","SHOW_NUDGE_AFTER_MS","endJourney","puzzlesData","ProjectType","ActionEvent","startJourney","isLessonAvailable","_c","_d","lessonLabelDims","_g","_f","_e","gameLabelDims","_j","_i","_h","puzzleLabelDims","_m","_l","_k","launcherDims","_p","_o","_n","lessonSteps","IndicatorType","jsx","Fragment","FlexView","Text","_q","IconButton","CaratRightIcon","GAME_LAUNCHER_ANALYTICS_EVENTS","gameSteps","puzzleSteps","SegmentedGameCard","puzzle","delayBeforeStart","START_JOURNEY_DELAY_MS","SLIDE_TO_LESSON_MS","useMemo"],"mappings":";;;;;;;;;;;;;;;;AAmCO,MAAMA,KAAyB,CAAC;AAAA,EACrC,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,mBAAAC;AACF,MAAoC;AAC5B,QAAAC,IAAWC,EAA+B,IAAI,GAC9CC,IAAaD,EAA+B,IAAI,GAChDE,IAAaF,EAA+B,IAAI,GAEhDG,IAAsBH,EAAO,EAAK,GAElC,EAAE,iBAAAI,MAAoBC,M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AAA,gBACb,MAAM;AAAA;AAAA,gBACN,aAAaA,EAAO;AAAA,gBACpB,SAAS,MAAMrC,EAAWqC,GAAQ7C,CAAS;AAAA,cAAA,EAC3C;AAAA,YAAA;AAAA,UACJ;AAAA,UAEF,WAAW;AAAA,YACT,OAAO;AAAA,YACP,SACG,gBAAAkC,EAAAG,GAAA,EAAK,WAAU,OAAM,QAAO,SAAQ,UAErC,2BAAA;AAAA,YAEF,eAAeT,EAAa,QAAQ;AAAA,YACpC,eAAeA,EAAa,SAAS;AAAA,UACvC;AAAA,QACF;AAAA,MAAA;AAGS,MAAAzC,EAAAa,GAAW,CAAC,GAAGgC,GAAa,GAAGU,IAAW,GAAGC,EAAW,CAAC;AAE9D,YAAAG,KAAmB,WAAW,MAAM;;AACxC,qBAAaA,EAAgB,IAChB3C,IAAA3B,EAAA,YAAA,QAAA2B,EAAS,UAAU,IAClBjB,EAAAc,GAAW,IAAO+C,EAAsB;AAAA,SACrDC,EAAkB;AAEjB,MAAAnC,KAAqB/B,EAAW,UAClCc,EAAae,EAAY,gBAAgB7B,EAAW,SAAS,UAAUkB,GAAW,EAAI,IAEtFJ,EAAae,EAAY,gBAAgBhC,EAAS,SAAS,YAAYqB,GAAW,EAAI;AAAA,IAE1F;AAAA,IACA,CAACxB,GAAcgC,GAAYZ,GAAcV,GAAeC,CAAU;AAAA,EAAA;AAa7D,SAVM8D;AAAA,IACX,OAAO;AAAA,MACL,UAAAtE;AAAA,MACA,YAAAE;AAAA,MACA,YAAAC;AAAA,MACA,cAAA8B;AAAA,IAAA;AAAA,IAEF,CAACA,CAAY;AAAA,EAAA;AAIjB;"}
1
+ {"version":3,"file":"use-game-launcher-journey.js","sources":["../../../../../../src/features/circle-games/game-launcher/hooks/use-game-launcher-journey/use-game-launcher-journey.tsx"],"sourcesContent":["import type { TJourneyId } from '../../../../journey/journey-id/journey-id-types';\nimport type { ICoachmarkProps } from '../../../../journey/use-journey/journey-context-types';\nimport type { IArrowTooltipProps } from '../../../../ui/arrow-tooltip/arrow-tooltip-types';\nimport type { INudgeProps } from '../../../../ui/nudge/nudge-types';\nimport type { TColorNames } from '../../../../ui/types';\nimport type { ISegmentedGameCardRefs } from '../../comps/segmented-game-card/segmented-game-card-types';\nimport type {\n IProject,\n Puzzle,\n} from '../../dal/use-get-circle-home-details-dal/use-get-circle-home-dal-types';\nimport type { IUseGameLauncherJourneyProps } from './use-game-launcher-journey-types';\n\nimport { useCallback, useMemo, useRef } from 'react';\n\nimport CaratRightIcon from '../../../../../assets/line-icons/icons/carat-right';\nimport { PLATFORM_EVENTS_STUDENT as AnalyticsLabel } from '../../../../analytics-events/platform-events-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 ActionEvent } from '../../../enum/circle-onboarding-steps';\nimport { ProjectType } from '../../../games/web-view/enums';\nimport { useCircleSounds } from '../../../hooks/use-circle-sounds/use-circle-sounds';\nimport { SegmentedGameCard } from '../../comps/segmented-game-card/segmented-game-card';\nimport { GAME_LAUNCHER_ANALYTICS_EVENTS } from '../../game-launcher-analytics-events';\nimport {\n GO_TO_NEXT_SLIDE_AFTER_MS,\n SHOW_LABEL_HIGHLIGHT_AFTER_MS,\n SHOW_NUDGE_AFTER_MS,\n SLIDE_TO_LESSON_MS,\n} from './constants';\n\nexport const useGameLauncherJourney = ({\n carouselRefs,\n onSegmentClick,\n onJourneyComplete,\n}: IUseGameLauncherJourneyProps) => {\n const gameRefs = useRef<ISegmentedGameCardRefs>(null);\n const puzzleRefs = useRef<ISegmentedGameCardRefs>(null);\n const lessonRefs = useRef<ISegmentedGameCardRefs>(null);\n\n const isJourneyInProgress = useRef(false);\n\n const { playButtonSound } = useCircleSounds();\n const { nextCoachmark, setJourney } = useJourney();\n const { onEvent: trackAnalytics } = useUIContext();\n\n const trackEventViewed = useCallback(\n (step: ActionEvent) => {\n trackAnalytics(AnalyticsLabel.ONBOARDING_STEP_VIEWED, {\n step,\n });\n },\n [trackAnalytics],\n );\n const trackEventCompleted = useCallback(\n (step: ActionEvent) => {\n trackAnalytics(AnalyticsLabel.ONBOARDING_STEP_COMPLETED, {\n step,\n });\n },\n [trackAnalytics],\n );\n\n const goToNextCard = useCallback(\n (\n analyticsLabelViewed: ActionEvent,\n refOfNextSlide: ISegmentedGameCardRefs,\n color: TColorNames,\n journeyId: TJourneyId,\n isFirstSlide: boolean = false,\n ) => {\n if (!isFirstSlide) {\n playButtonSound();\n carouselRefs.current?.goToIndex(carouselRefs.current?.currentIndex + 1);\n nextCoachmark(journeyId, false, GO_TO_NEXT_SLIDE_AFTER_MS);\n }\n\n trackEventViewed(analyticsLabelViewed);\n\n const animateLabelTimer = setTimeout(() => {\n clearTimeout(animateLabelTimer);\n refOfNextSlide.startLabelAnimation(color);\n }, SHOW_LABEL_HIGHLIGHT_AFTER_MS);\n\n nextCoachmark(journeyId, true, SHOW_NUDGE_AFTER_MS);\n },\n [carouselRefs, nextCoachmark, playButtonSound, trackEventViewed],\n );\n\n const endJourney = useCallback(\n (puzzlesData: Puzzle, journeyId: TJourneyId) => {\n onSegmentClick(puzzlesData, ProjectType.PUZZLE);\n trackEventCompleted(ActionEvent.PUZZLE_ACTIVITY);\n nextCoachmark(journeyId);\n onJourneyComplete(journeyId);\n },\n [nextCoachmark, onJourneyComplete, onSegmentClick, trackEventCompleted],\n );\n\n const startJourney = useCallback(\n (puzzlesData: IProject<Puzzle>, isLessonAvailable: boolean, journeyId: TJourneyId) => {\n if (isJourneyInProgress.current) {\n return;\n }\n\n // If element refs are not available return, this is just for type safety\n if (\n !carouselRefs?.current?.nextBtnRef.current ||\n !puzzleRefs?.current?.segmentedCardWrapperRef.current ||\n !gameRefs?.current?.labelRef.current ||\n !puzzleRefs?.current?.labelRef.current ||\n !puzzlesData\n ) {\n return;\n }\n\n isJourneyInProgress.current = true;\n const lessonLabelDims = lessonRefs.current?.labelRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n const gameLabelDims = gameRefs.current?.labelRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n const puzzleLabelDims = puzzleRefs.current?.labelRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n\n const launcherDims =\n puzzleRefs.current?.segmentedCardWrapperRef?.current?.getBoundingClientRect() || {\n height: 0,\n width: 0,\n };\n\n let lessonSteps: ICoachmarkProps[] = [];\n\n if (isLessonAvailable && lessonRefs.current) {\n lessonSteps = [\n {\n originalElementToHighlightRef: lessonRefs.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'BLUE_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Get faster & stay ahead in school. Practice 3 new skills everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: lessonLabelDims.width + 50,\n tooltipYCoOrdinates: lessonLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: carouselRefs.current?.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={() =>\n goToNextCard(\n ActionEvent.GAMES_ACTIVITY,\n gameRefs.current as ISegmentedGameCardRefs,\n 'ORANGE_4',\n journeyId,\n )\n }\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\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 },\n ];\n }\n\n const gameSteps: ICoachmarkProps[] = [\n {\n originalElementToHighlightRef: gameRefs.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'ORANGE_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Train to think deeper & plan ahead. Play 3 new games everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: gameLabelDims.width + 50,\n tooltipYCoOrdinates: gameLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: carouselRefs.current.nextBtnRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <IconButton\n renderAs=\"secondary\"\n Icon={CaratRightIcon}\n onClick={() =>\n goToNextCard(\n ActionEvent.PUZZLE_ACTIVITY,\n puzzleRefs.current as ISegmentedGameCardRefs,\n 'PURPLE_4',\n journeyId,\n )\n }\n analyticsLabel={GAME_LAUNCHER_ANALYTICS_EVENTS.JOURNEY_NEXT_ACTIVITY}\n />\n ),\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 },\n ];\n\n const puzzleSteps: ICoachmarkProps[] = [\n {\n originalElementToHighlightRef: puzzleRefs.current.labelRef,\n isActive: false,\n type: IndicatorType.TOOLTIP,\n elementToHighlight: <></>,\n indicator: {\n position: 'right',\n backgroundColor: 'PURPLE_4',\n width: 264,\n tooltipItem: (\n <FlexView>\n <Text $renderAs=\"ab2-bold\">\n Think in new ways & stay sharp. Solve 3 new puzzles everyday.\n </Text>\n </FlexView>\n ),\n tooltipXCoOrdinates: puzzleLabelDims.width + 50,\n tooltipYCoOrdinates: puzzleLabelDims.height / 2,\n } as IArrowTooltipProps,\n },\n {\n originalElementToHighlightRef: puzzleRefs.current.segmentedCardWrapperRef,\n isActive: false,\n type: IndicatorType.NUDGE,\n elementToHighlight: (\n <SegmentedGameCard\n label={''} // This is intentionally left blank to avoid showing the label\n value={puzzlesData.data.filter(puzzle => puzzle.solved).length}\n maxValue={puzzlesData.data.length}\n initialValue={puzzlesData.initialProgressValue}\n data={puzzlesData.data.map(puzzle => ({\n card: puzzle.cardLottie,\n name: '', // We dont want to show the name of the puzzle in onboarding\n isCompleted: puzzle.solved,\n onPress: () => endJourney(puzzle, journeyId),\n }))}\n />\n ),\n indicator: {\n nudge: 'click',\n content: (\n <Text $renderAs=\"ab1\" $color=\"WHITE\">\n Click to solve a puzzle\n </Text>\n ),\n nudgePointerX: launcherDims.width * 0.6,\n nudgePointerY: launcherDims.height * 0.4,\n } as INudgeProps,\n },\n ];\n\n setJourney(journeyId, [...lessonSteps, ...gameSteps, ...puzzleSteps]);\n\n carouselRefs.current?.goToIndex(0); // Always start from 0th Index no matter what the current index is\n\n const delayBeforeStart = setTimeout(() => {\n clearTimeout(delayBeforeStart);\n nextCoachmark(journeyId);\n }, SLIDE_TO_LESSON_MS);\n\n if (isLessonAvailable && lessonRefs.current) {\n goToNextCard(ActionEvent.SKILL_ACTIVITY, lessonRefs.current, 'BLUE_4', journeyId, true);\n } else {\n goToNextCard(ActionEvent.GAMES_ACTIVITY, gameRefs.current, 'ORANGE_4', journeyId, true);\n }\n },\n [carouselRefs, endJourney, goToNextCard, nextCoachmark, setJourney],\n );\n\n const data = useMemo(\n () => ({\n gameRefs,\n puzzleRefs,\n lessonRefs,\n startJourney,\n }),\n [startJourney],\n );\n\n return data;\n};\n"],"names":["useGameLauncherJourney","carouselRefs","onSegmentClick","onJourneyComplete","gameRefs","useRef","puzzleRefs","lessonRefs","isJourneyInProgress","playButtonSound","useCircleSounds","nextCoachmark","setJourney","useJourney","trackAnalytics","useUIContext","trackEventViewed","useCallback","step","AnalyticsLabel","trackEventCompleted","goToNextCard","analyticsLabelViewed","refOfNextSlide","color","journeyId","isFirstSlide","_b","_a","GO_TO_NEXT_SLIDE_AFTER_MS","animateLabelTimer","SHOW_LABEL_HIGHLIGHT_AFTER_MS","SHOW_NUDGE_AFTER_MS","endJourney","puzzlesData","ProjectType","ActionEvent","startJourney","isLessonAvailable","_c","_d","lessonLabelDims","_g","_f","_e","gameLabelDims","_j","_i","_h","puzzleLabelDims","_m","_l","_k","launcherDims","_p","_o","_n","lessonSteps","IndicatorType","jsx","Fragment","FlexView","Text","_q","IconButton","CaratRightIcon","GAME_LAUNCHER_ANALYTICS_EVENTS","gameSteps","puzzleSteps","SegmentedGameCard","puzzle","_r","delayBeforeStart","SLIDE_TO_LESSON_MS","useMemo"],"mappings":";;;;;;;;;;;;;;;;AAkCO,MAAMA,KAAyB,CAAC;AAAA,EACrC,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,mBAAAC;AACF,MAAoC;AAC5B,QAAAC,IAAWC,EAA+B,IAAI,GAC9CC,IAAaD,EAA+B,IAAI,GAChDE,IAAaF,EAA+B,IAAI,GAEhDG,IAAsBH,EAAO,EAAK,GAElC,EAAE,iBAAAI,MAAoBC,MACtB,EAAE,eAAAC,GAAe,YAAAC,EAAW,IAAIC,GAAW,GAC3C,EAAE,SAASC,EAAe,IAAIC,GAAa,GAE3CC,IAAmBC;AAAA,IACvB,CAACC,MAAsB;AACrB,MAAAJ,EAAeK,EAAe,wBAAwB;AAAA,QACpD,MAAAD;AAAA,MAAA,CACD;AAAA,IACH;AAAA,IACA,CAACJ,CAAc;AAAA,EAAA,GAEXM,IAAsBH;AAAA,IAC1B,CAACC,MAAsB;AACrB,MAAAJ,EAAeK,EAAe,2BAA2B;AAAA,QACvD,MAAAD;AAAA,MAAA,CACD;AAAA,IACH;AAAA,IACA,CAACJ,CAAc;AAAA,EAAA,GAGXO,IAAeJ;AAAA,IACnB,CACEK,GACAC,GACAC,GACAC,GACAC,IAAwB,OACrB;;AACH,MAAKA,MACajB,MAChBkB,IAAA1B,EAAa,YAAb,QAAA0B,EAAsB,YAAUC,IAAA3B,EAAa,YAAb,gBAAA2B,EAAsB,gBAA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,MAAAnC,KAAqB/B,EAAW,UAClCc,EAAae,EAAY,gBAAgB7B,EAAW,SAAS,UAAUkB,GAAW,EAAI,IAEtFJ,EAAae,EAAY,gBAAgBhC,EAAS,SAAS,YAAYqB,GAAW,EAAI;AAAA,IAE1F;AAAA,IACA,CAACxB,GAAcgC,GAAYZ,GAAcV,GAAeC,CAAU;AAAA,EAAA;AAa7D,SAVM8D;AAAA,IACX,OAAO;AAAA,MACL,UAAAtE;AAAA,MACA,YAAAE;AAAA,MACA,YAAAC;AAAA,MACA,cAAA8B;AAAA,IAAA;AAAA,IAEF,CAACA,CAAY;AAAA,EAAA;AAIjB;"}
@@ -1,4 +1,4 @@
1
- const _ = 2, E = 3, A = 500, T = 1500, L = 1e3, I = 3e3, O = 3100, S = 2e3, C = 3e3;
1
+ const _ = 2, E = 3, A = 500, T = 1500, L = 1e3, I = 3e3, O = 3100, S = 100, C = 3e3;
2
2
  export {
3
3
  L as GO_TO_TABLE_LAUNCHER_DURATION_MS,
4
4
  _ as PUZZLE_CARD_INDEX,
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sources":["../../../../../../src/features/circle-games/game-launcher/hooks/use-table-launcher-journey/constants.ts"],"sourcesContent":["export const PUZZLE_CARD_INDEX = 2;\nexport const TABLE_CARD_INDEX = 3;\n\nexport const SHOW_INITIAL_COACHMARK_AFTER_MS = 500;\nexport const SHOW_INITIAL_TOOLTIP_AFTER_MS = 1500;\n\nexport const GO_TO_TABLE_LAUNCHER_DURATION_MS = 1000;\nexport const SHOW_CLICK_TABLE_NUDGE_AFTER_MS = 3000;\nexport const START_ANIMATING_CLONED_ELEM = SHOW_CLICK_TABLE_NUDGE_AFTER_MS + 100;\n\nexport const SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS = 2000;\nexport const SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS = 3000;\n"],"names":["PUZZLE_CARD_INDEX","TABLE_CARD_INDEX","SHOW_INITIAL_COACHMARK_AFTER_MS","SHOW_INITIAL_TOOLTIP_AFTER_MS","GO_TO_TABLE_LAUNCHER_DURATION_MS","SHOW_CLICK_TABLE_NUDGE_AFTER_MS","START_ANIMATING_CLONED_ELEM","SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS","SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS"],"mappings":"AAAO,MAAMA,IAAoB,GACpBC,IAAmB,GAEnBC,IAAkC,KAClCC,IAAgC,MAEhCC,IAAmC,KACnCC,IAAkC,KAClCC,IAA8B,MAE9BC,IAAqC,KACrCC,IAAmC;"}
1
+ {"version":3,"file":"constants.js","sources":["../../../../../../src/features/circle-games/game-launcher/hooks/use-table-launcher-journey/constants.ts"],"sourcesContent":["export const PUZZLE_CARD_INDEX = 2;\nexport const TABLE_CARD_INDEX = 3;\n\nexport const SHOW_INITIAL_COACHMARK_AFTER_MS = 500;\nexport const SHOW_INITIAL_TOOLTIP_AFTER_MS = 1500;\n\nexport const GO_TO_TABLE_LAUNCHER_DURATION_MS = 1000;\nexport const SHOW_CLICK_TABLE_NUDGE_AFTER_MS = 3000;\nexport const START_ANIMATING_CLONED_ELEM = SHOW_CLICK_TABLE_NUDGE_AFTER_MS + 100;\n\nexport const SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS = 100;\nexport const SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS = 3000;\n"],"names":["PUZZLE_CARD_INDEX","TABLE_CARD_INDEX","SHOW_INITIAL_COACHMARK_AFTER_MS","SHOW_INITIAL_TOOLTIP_AFTER_MS","GO_TO_TABLE_LAUNCHER_DURATION_MS","SHOW_CLICK_TABLE_NUDGE_AFTER_MS","START_ANIMATING_CLONED_ELEM","SHOW_PICK_A_LEVEL_TOOLTIP_AFTER_MS","SHOW_PICK_A_LEVEL_NUDGE_AFTER_MS"],"mappings":"AAAO,MAAMA,IAAoB,GACpBC,IAAmB,GAEnBC,IAAkC,KAClCC,IAAgC,MAEhCC,IAAmC,KACnCC,IAAkC,KAClCC,IAA8B,MAE9BC,IAAqC,KACrCC,IAAmC;"}
@@ -2,7 +2,7 @@ import { jsxs as v, jsx as J } from "react/jsx-runtime";
2
2
  import { createContext as x, useState as $, useRef as f, useCallback as i, useMemo as p } from "react";
3
3
  import { Coachmark as g } from "../comps/coachmark/coachmark.js";
4
4
  import { BlurOverlay as A } from "./journey-styled.js";
5
- const E = x(null), j = ({ children: C }) => {
5
+ const R = x(null), j = ({ children: C }) => {
6
6
  const [o, u] = $([]), c = f(-1), r = f(), l = i(
7
7
  (e, t) => {
8
8
  if (o.length > 0)
@@ -22,15 +22,13 @@ const E = x(null), j = ({ children: C }) => {
22
22
  u((s) => [...s, t]);
23
23
  }, []), d = i(
24
24
  (e, t = !1, s = 0) => {
25
- if (!r.current)
26
- throw new Error("nextCoachmark was called before setJourney");
27
- if (e !== r.current)
25
+ if (!r.current || e !== r.current)
28
26
  throw new Error(
29
- `A Journey is already active, Current Journey: ${r.current}, New Journey Request: ${e}`
27
+ r.current ? "nextCoachmark was called before setJourney" : `A Journey is already active, Current Journey: ${r.current}, New Journey Request: ${e}`
30
28
  );
31
29
  s !== 0 && u((n) => n.map((a) => ({ ...a, isActive: !1 })));
32
- const k = setTimeout(() => {
33
- clearTimeout(k);
30
+ const w = setTimeout(() => {
31
+ clearTimeout(w);
34
32
  const n = c.current + 1;
35
33
  u((a) => {
36
34
  if (n >= a.length || a.length === 0)
@@ -42,7 +40,7 @@ const E = x(null), j = ({ children: C }) => {
42
40
  }, s);
43
41
  },
44
42
  []
45
- ), w = p(
43
+ ), k = p(
46
44
  () => ({
47
45
  nextCoachmark: d,
48
46
  setJourney: l,
@@ -52,13 +50,13 @@ const E = x(null), j = ({ children: C }) => {
52
50
  }),
53
51
  [d, l, y, h, o]
54
52
  );
55
- return /* @__PURE__ */ v(E.Provider, { value: w, children: [
53
+ return /* @__PURE__ */ v(R.Provider, { value: k, children: [
56
54
  o.length > 0 && /* @__PURE__ */ J(A, { children: o.map((e, t) => /* @__PURE__ */ J(g, { coachmark: e }, `coachmark-${t}`)) }),
57
55
  C
58
56
  ] });
59
57
  };
60
58
  export {
61
- E as JourneyContext,
59
+ R as JourneyContext,
62
60
  j as JourneyProvider
63
61
  };
64
62
  //# sourceMappingURL=journey-context-provider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"journey-context-provider.js","sources":["../../../../src/features/journey/use-journey/journey-context-provider.tsx"],"sourcesContent":["import type { TJourneyId } from '../journey-id/journey-id-types';\nimport type { ICoachmarkProps, IJourneyContext } from './journey-context-types';\nimport type { FC, ReactNode } from 'react';\n\nimport { createContext, useCallback, useMemo, useRef, useState } from 'react';\n\nimport { Coachmark } from '../comps/coachmark/coachmark';\nimport * as S from './journey-styled';\n\nexport const JourneyContext = createContext<IJourneyContext | null>(null);\n\nexport const JourneyProvider: FC<{ children: ReactNode }> = ({ children }) => {\n const [coachmarkList, setCoachmarkList] = useState<ICoachmarkProps[]>([]);\n const currentIndex = useRef(-1);\n const currentJourneyIdStudent = useRef<TJourneyId | undefined>();\n\n const setJourney = useCallback(\n (id: TJourneyId, coachmarks: ICoachmarkProps[]) => {\n if (coachmarkList.length > 0) {\n throw new Error(\n `setJourney: Other Journey is already active, Current Journey: ${currentJourneyIdStudent.current}, New Journey Request: ${id}`,\n );\n }\n currentJourneyIdStudent.current = id;\n currentIndex.current = -1;\n setCoachmarkList([...coachmarks]);\n },\n [coachmarkList.length],\n );\n\n const clearJourney = useCallback(() => {\n currentJourneyIdStudent.current = undefined;\n currentIndex.current = -1;\n setCoachmarkList([]);\n }, []);\n\n const addCoachmark = useCallback((id: TJourneyId, coachmark: ICoachmarkProps) => {\n if (!currentJourneyIdStudent.current || id !== currentJourneyIdStudent.current) {\n throw new Error(\n currentJourneyIdStudent.current\n ? `addCoachmark was called before setJourney`\n : `A Journey is already active, Current Journey: ${currentJourneyIdStudent.current}, New Journey Request: ${id}`,\n );\n }\n\n setCoachmarkList(prev => [...prev, coachmark]);\n }, []);\n\n const nextCoachmark = useCallback(\n (id: TJourneyId, keepPrevActive: boolean = false, delayInMs: number = 0) => {\n if (!currentJourneyIdStudent.current) {\n throw new Error('nextCoachmark was called before setJourney');\n }\n\n if (id !== currentJourneyIdStudent.current) {\n throw new Error(\n `A Journey is already active, Current Journey: ${currentJourneyIdStudent.current}, New Journey Request: ${id}`,\n );\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 currentJourneyIdStudent.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 [],\n );\n\n const memoizedContextValue = useMemo(\n () => ({\n nextCoachmark,\n setJourney,\n addCoachmark,\n clearJourney,\n coachmarks: coachmarkList,\n }),\n [nextCoachmark, setJourney, addCoachmark, clearJourney, coachmarkList],\n );\n\n return (\n <JourneyContext.Provider value={memoizedContextValue}>\n {coachmarkList.length > 0 && (\n <S.BlurOverlay>\n {coachmarkList.map((coachmark, index) => (\n <Coachmark key={`coachmark-${index}`} coachmark={coachmark} />\n ))}\n </S.BlurOverlay>\n )}\n {children}\n </JourneyContext.Provider>\n );\n};\n"],"names":["JourneyContext","createContext","JourneyProvider","children","coachmarkList","setCoachmarkList","useState","currentIndex","useRef","currentJourneyIdStudent","setJourney","useCallback","id","coachmarks","clearJourney","addCoachmark","coachmark","prev","nextCoachmark","keepPrevActive","delayInMs","prevList","item","timer","currIndex","updatedCoachmarkList","memoizedCont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,EAAS,IAAI,CAACC,OACZ,EAAE,GAAGA,GAAM,UAAU,GAAM,EACnC,CACF;AAGG,YAAAC,IAAQ,WAAW,MAAM;AAC7B,qBAAaA,CAAK;AACZ,cAAAC,IAAYjB,EAAa,UAAU;AAEzC,QAAAF,EAAiB,CAAYgB,MAAA;AAE3B,cAAIG,KAAaH,EAAS,UAAUA,EAAS,WAAW;AACtD,mBAAAZ,EAAwB,UAAU,QAClCF,EAAa,UAAU,IAEhB;AAGT,UAAAA,EAAa,UAAUiB;AACjB,gBAAAC,IAAuB,CAAC,GAAGJ,CAAQ;AAExC,iBAAAI,EAAqBD,CAAS,EAAsB,WAAW,IAE5DA,IAAY,MACbC,EAAqBD,IAAY,CAAC,EAAsB,WAAWL,IAG/DM;AAAA,QAAA,CACR;AAAA,SACAL,CAAS;AAAA,IACd;AAAA,IACA,CAAC;AAAA,EAAA,GAGGM,IAAuBC;AAAA,IAC3B,OAAO;AAAA,MACL,eAAAT;AAAA,MACA,YAAAR;AAAA,MACA,cAAAK;AAAA,MACA,cAAAD;AAAA,MACA,YAAYV;AAAA,IAAA;AAAA,IAEd,CAACc,GAAeR,GAAYK,GAAcD,GAAcV,CAAa;AAAA,EAAA;AAGvE,SACG,gBAAAwB,EAAA5B,EAAe,UAAf,EAAwB,OAAO0B,GAC7B,UAAA;AAAA,IAAAtB,EAAc,SAAS,KACtB,gBAAAyB,EAACC,GAAA,EACE,YAAc,IAAI,CAACd,GAAWe,wBAC5BC,GAAqC,EAAA,WAAAhB,EAAA,GAAtB,aAAae,CAAK,EAA0B,CAC7D,GACH;AAAA,IAED5B;AAAA,EACH,EAAA,CAAA;AAEJ;"}
1
+ {"version":3,"file":"journey-context-provider.js","sources":["../../../../src/features/journey/use-journey/journey-context-provider.tsx"],"sourcesContent":["import type { TJourneyId } from '../journey-id/journey-id-types';\nimport type { ICoachmarkProps, IJourneyContext } from './journey-context-types';\nimport type { FC, ReactNode } from 'react';\n\nimport { createContext, useCallback, useMemo, useRef, useState } from 'react';\n\nimport { Coachmark } from '../comps/coachmark/coachmark';\nimport * as S from './journey-styled';\n\nexport const JourneyContext = createContext<IJourneyContext | null>(null);\n\nexport const JourneyProvider: FC<{ children: ReactNode }> = ({ children }) => {\n const [coachmarkList, setCoachmarkList] = useState<ICoachmarkProps[]>([]);\n const currentIndex = useRef(-1);\n const currentJourneyIdStudent = useRef<TJourneyId | undefined>();\n\n const setJourney = useCallback(\n (id: TJourneyId, coachmarks: ICoachmarkProps[]) => {\n if (coachmarkList.length > 0) {\n throw new Error(\n `setJourney: Other Journey is already active, Current Journey: ${currentJourneyIdStudent.current}, New Journey Request: ${id}`,\n );\n }\n currentJourneyIdStudent.current = id;\n currentIndex.current = -1;\n setCoachmarkList([...coachmarks]);\n },\n [coachmarkList.length],\n );\n\n const clearJourney = useCallback(() => {\n currentJourneyIdStudent.current = undefined;\n currentIndex.current = -1;\n setCoachmarkList([]);\n }, []);\n\n const addCoachmark = useCallback((id: TJourneyId, coachmark: ICoachmarkProps) => {\n if (!currentJourneyIdStudent.current || id !== currentJourneyIdStudent.current) {\n throw new Error(\n currentJourneyIdStudent.current\n ? `addCoachmark was called before setJourney`\n : `A Journey is already active, Current Journey: ${currentJourneyIdStudent.current}, New Journey Request: ${id}`,\n );\n }\n\n setCoachmarkList(prev => [...prev, coachmark]);\n }, []);\n\n const nextCoachmark = useCallback(\n (id: TJourneyId, keepPrevActive: boolean = false, delayInMs: number = 0) => {\n if (!currentJourneyIdStudent.current || id !== currentJourneyIdStudent.current) {\n throw new Error(\n currentJourneyIdStudent.current\n ? `nextCoachmark was called before setJourney`\n : `A Journey is already active, Current Journey: ${currentJourneyIdStudent.current}, New Journey Request: ${id}`,\n );\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 currentJourneyIdStudent.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 [],\n );\n\n const memoizedContextValue = useMemo(\n () => ({\n nextCoachmark,\n setJourney,\n addCoachmark,\n clearJourney,\n coachmarks: coachmarkList,\n }),\n [nextCoachmark, setJourney, addCoachmark, clearJourney, coachmarkList],\n );\n\n return (\n <JourneyContext.Provider value={memoizedContextValue}>\n {coachmarkList.length > 0 && (\n <S.BlurOverlay>\n {coachmarkList.map((coachmark, index) => (\n <Coachmark key={`coachmark-${index}`} coachmark={coachmark} />\n ))}\n </S.BlurOverlay>\n )}\n {children}\n </JourneyContext.Provider>\n );\n};\n"],"names":["JourneyContext","createContext","JourneyProvider","children","coachmarkList","setCoachmarkList","useState","currentIndex","useRef","currentJourneyIdStudent","setJourney","useCallback","id","coachmarks","clearJourney","addCoachmark","coachmark","prev","nextCoachmark","keepPrevActive","delayInMs","prevList","item","timer","currIndex","updatedCoachmarkList","memoizedContextValue","useMemo","jsxs","jsx","S.BlurOverlay","index","Coachmark"],"mappings":";;;;AASa,MAAAA,IAAiBC,EAAsC,IAAI,GAE3DC,IAA+C,CAAC,EAAE,UAAAC,QAAe;AAC5E,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAA4B,CAAE,CAAA,GAClEC,IAAeC,EAAO,EAAE,GACxBC,IAA0BD,KAE1BE,IAAaC;AAAA,IACjB,CAACC,GAAgBC,MAAkC;AAC7C,UAAAT,EAAc,SAAS;AACzB,cAAM,IAAI;AAAA,UACR,iEAAiEK,EAAwB,OAAO,0BAA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qBD,CAAS,EAAsB,WAAW,IAE5DA,IAAY,MACbC,EAAqBD,IAAY,CAAC,EAAsB,WAAWL,IAG/DM;AAAA,QAAA,CACR;AAAA,SACAL,CAAS;AAAA,IACd;AAAA,IACA,CAAC;AAAA,EAAA,GAGGM,IAAuBC;AAAA,IAC3B,OAAO;AAAA,MACL,eAAAT;AAAA,MACA,YAAAR;AAAA,MACA,cAAAK;AAAA,MACA,cAAAD;AAAA,MACA,YAAYV;AAAA,IAAA;AAAA,IAEd,CAACc,GAAeR,GAAYK,GAAcD,GAAcV,CAAa;AAAA,EAAA;AAGvE,SACG,gBAAAwB,EAAA5B,EAAe,UAAf,EAAwB,OAAO0B,GAC7B,UAAA;AAAA,IAAAtB,EAAc,SAAS,KACtB,gBAAAyB,EAACC,GAAA,EACE,YAAc,IAAI,CAACd,GAAWe,wBAC5BC,GAAqC,EAAA,WAAAhB,EAAA,GAAtB,aAAae,CAAK,EAA0B,CAC7D,GACH;AAAA,IAED5B;AAAA,EACH,EAAA,CAAA;AAEJ;"}
package/dist/index.d.ts CHANGED
@@ -4910,9 +4910,9 @@ declare const useGetCircleHomeAPI: (initialId?: string, initialQuery?: IGetCircl
4910
4910
  } & Record<string, unknown>) | undefined;
4911
4911
  };
4912
4912
 
4913
- export declare const useGetCircleHomeDetailsDal: (userId: string, grade: string) => Omit<ReturnType<typeof useGetCircleHomeAPI>, "data" | "get"> & {
4913
+ export declare const useGetCircleHomeDetailsDal: (userId: string, countryCode: string, grade: string) => Omit<ReturnType<typeof useGetCircleHomeAPI>, "data" | "get"> & {
4914
4914
  data: ICircleHomeDetails | null;
4915
- getCircleHomeDetails: (countryCode: string) => void;
4915
+ getCircleHomeDetails: () => void;
4916
4916
  };
4917
4917
 
4918
4918
  declare const useGetLeaderboard: (initialId?: string, initialQuery?: IGetLeaderboardPayloadModel | undefined) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuemath/leap",
3
- "version": "2.8.43-rj-0",
3
+ "version": "2.8.43-rj-2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"