@cuemath/leap 3.1.52-beta-0.2 → 3.1.52-beta-0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,41 +1,50 @@
1
- import { jsxs as n, jsx as t } from "react/jsx-runtime";
2
- import { memo as h, useCallback as c } from "react";
3
- import { LOTTIE as p } from "../../../assets/lottie/lottie.js";
4
- import f from "../../ui/image/image.js";
5
- import $ from "../../ui/layout/flex-view.js";
6
- import g from "../../ui/lottie-animation/lottie-animation.js";
7
- import { PuzzleWrapper as u, Title as d, StickerWrapper as z } from "./puzzle-card-styled.js";
8
- const w = {
1
+ import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
+ import { memo as f, useCallback as $ } from "react";
3
+ import g from "../../ui/image/image.js";
4
+ import z from "../../ui/layout/flex-view.js";
5
+ import u from "../../ui/lottie-animation/lottie-animation.js";
6
+ import { getPuzzleStickerLottie as d } from "../utils/puzzle-feedback-celebration.js";
7
+ import { PuzzleWrapper as x, Title as L, StickerWrapper as S } from "./puzzle-card-styled.js";
8
+ const j = {
9
9
  autoplay: !1,
10
10
  loop: !1,
11
11
  renderer: "canvas"
12
- }, P = h(
13
- ({ imageHue: i, imageUrl: o, title: a, height: l = "100%", width: m = "100%", onCardClick: e, userNodeId: r }) => {
14
- const s = c(() => {
15
- r && (e == null || e(r));
16
- }, [e, r]);
17
- return /* @__PURE__ */ n(
18
- u,
12
+ }, W = f(
13
+ ({
14
+ imageHue: o,
15
+ imageUrl: m,
16
+ title: h,
17
+ height: s = "100%",
18
+ width: a = "100%",
19
+ onCardClick: t,
20
+ userNodeId: i,
21
+ rewards: r
22
+ }) => {
23
+ const { sticker: n } = (r == null ? void 0 : r[0]) || {}, l = n ? d(n) : void 0, p = $(() => {
24
+ i && (t == null || t(i));
25
+ }, [t, i]);
26
+ return /* @__PURE__ */ c(
27
+ x,
19
28
  {
20
- $width: m,
21
- $height: l,
29
+ $width: a,
30
+ $height: s,
22
31
  $justifyContent: "center",
23
32
  $alignItems: "center",
24
- $imageHue: i,
25
- $background: `${i}_2`,
26
- onClick: s,
33
+ $imageHue: o,
34
+ $background: `${o}_2`,
35
+ onClick: p,
27
36
  children: [
28
- /* @__PURE__ */ n($, { $justifyContent: "center", $alignItems: "center", $flexGap: 12, children: [
29
- /* @__PURE__ */ t(f, { src: o ?? "", width: 68, height: 68, withLoader: !1, alt: "Puzzle" }),
30
- /* @__PURE__ */ t(d, { $renderAs: "ab3", $align: "center", $width: "80%", children: a })
37
+ /* @__PURE__ */ c(z, { $justifyContent: "center", $alignItems: "center", $flexGap: 12, children: [
38
+ /* @__PURE__ */ e(g, { src: m ?? "", width: 68, height: 68, withLoader: !1, alt: "Puzzle" }),
39
+ /* @__PURE__ */ e(L, { $renderAs: "ab3", $align: "center", $width: "80%", children: h })
31
40
  ] }),
32
- /* @__PURE__ */ t(z, { $widthX: 2.5, $heightX: 2.5, children: /* @__PURE__ */ t(
33
- g,
41
+ l && /* @__PURE__ */ e(S, { $widthX: 2.5, $heightX: 2.5, children: /* @__PURE__ */ e(
42
+ u,
34
43
  {
35
44
  width: 40,
36
45
  height: 40,
37
- src: p.DIAMOND,
38
- settings: w
46
+ src: l,
47
+ settings: j
39
48
  }
40
49
  ) })
41
50
  ]
@@ -44,6 +53,6 @@ const w = {
44
53
  }
45
54
  );
46
55
  export {
47
- P as default
56
+ W as default
48
57
  };
49
58
  //# sourceMappingURL=puzzle-card.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"puzzle-card.js","sources":["../../../../src/features/puzzles/comps/puzzle-card.tsx"],"sourcesContent":["import type { IPuzzleCardProps } from './puzzle-card-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback } from 'react';\n\nimport { LOTTIE } from '../../../assets/lottie/lottie';\nimport Image from '../../ui/image/image';\nimport FlexView from '../../ui/layout/flex-view';\nimport LottieAnimation from '../../ui/lottie-animation/lottie-animation';\nimport * as Styled from './puzzle-card-styled';\n\nconst puzzleStickerLottieSettings = {\n autoplay: false,\n loop: false,\n renderer: 'canvas',\n};\n\nconst PuzzleCard: FC<IPuzzleCardProps> = memo(\n ({ imageHue, imageUrl, title, height = '100%', width = '100%', onCardClick, userNodeId }) => {\n const handleCardClick = useCallback(() => {\n if (userNodeId) {\n onCardClick?.(userNodeId);\n }\n }, [onCardClick, userNodeId]);\n\n return (\n <Styled.PuzzleWrapper\n $width={width}\n $height={height}\n $justifyContent=\"center\"\n $alignItems=\"center\"\n $imageHue={imageHue}\n $background={`${imageHue}_2`}\n onClick={handleCardClick}\n >\n <FlexView $justifyContent=\"center\" $alignItems=\"center\" $flexGap={12}>\n <Image src={imageUrl ?? ''} width={68} height={68} withLoader={false} alt=\"Puzzle\" />\n\n <Styled.Title $renderAs=\"ab3\" $align=\"center\" $width=\"80%\">\n {title}\n </Styled.Title>\n </FlexView>\n\n <Styled.StickerWrapper $widthX={2.5} $heightX={2.5}>\n <LottieAnimation\n width={40}\n height={40}\n src={LOTTIE.DIAMOND}\n settings={puzzleStickerLottieSettings}\n />\n </Styled.StickerWrapper>\n </Styled.PuzzleWrapper>\n );\n },\n);\n\nexport default PuzzleCard;\n"],"names":["puzzleStickerLottieSettings","PuzzleCard","memo","imageHue","imageUrl","title","height","width","onCardClick","userNodeId","handleCardClick","useCallback","jsxs","Styled.PuzzleWrapper","FlexView","jsx","Image","Styled.Title","Styled.StickerWrapper","LottieAnimation","LOTTIE"],"mappings":";;;;;;;AAWA,MAAMA,IAA8B;AAAA,EAClC,UAAU;AAAA,EACV,MAAM;AAAA,EACN,UAAU;AACZ,GAEMC,IAAmCC;AAAA,EACvC,CAAC,EAAE,UAAAC,GAAU,UAAAC,GAAU,OAAAC,GAAO,QAAAC,IAAS,QAAQ,OAAAC,IAAQ,QAAQ,aAAAC,GAAa,YAAAC,QAAiB;AACrF,UAAAC,IAAkBC,EAAY,MAAM;AACxC,MAAIF,MACFD,KAAA,QAAAA,EAAcC;AAAA,IAChB,GACC,CAACD,GAAaC,CAAU,CAAC;AAG1B,WAAA,gBAAAG;AAAA,MAACC;AAAAA,MAAA;AAAA,QACC,QAAQN;AAAA,QACR,SAASD;AAAA,QACT,iBAAgB;AAAA,QAChB,aAAY;AAAA,QACZ,WAAWH;AAAA,QACX,aAAa,GAAGA,CAAQ;AAAA,QACxB,SAASO;AAAA,QAET,UAAA;AAAA,UAAA,gBAAAE,EAACE,KAAS,iBAAgB,UAAS,aAAY,UAAS,UAAU,IAChE,UAAA;AAAA,YAAC,gBAAAC,EAAAC,GAAA,EAAM,KAAKZ,KAAY,IAAI,OAAO,IAAI,QAAQ,IAAI,YAAY,IAAO,KAAI,SAAS,CAAA;AAAA,YAEnF,gBAAAW,EAACE,GAAA,EAAa,WAAU,OAAM,QAAO,UAAS,QAAO,OAClD,UACHZ,EAAA,CAAA;AAAA,UAAA,GACF;AAAA,4BAECa,GAAA,EAAsB,SAAS,KAAK,UAAU,KAC7C,UAAA,gBAAAH;AAAA,YAACI;AAAA,YAAA;AAAA,cACC,OAAO;AAAA,cACP,QAAQ;AAAA,cACR,KAAKC,EAAO;AAAA,cACZ,UAAUpB;AAAA,YAAA;AAAA,UAAA,GAEd;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;"}
1
+ {"version":3,"file":"puzzle-card.js","sources":["../../../../src/features/puzzles/comps/puzzle-card.tsx"],"sourcesContent":["import type { IPuzzleCardProps } from './puzzle-card-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback } from 'react';\n\nimport Image from '../../ui/image/image';\nimport FlexView from '../../ui/layout/flex-view';\nimport LottieAnimation from '../../ui/lottie-animation/lottie-animation';\nimport { getPuzzleStickerLottie } from '../utils/puzzle-feedback-celebration';\nimport * as Styled from './puzzle-card-styled';\n\nconst puzzleStickerLottieSettings = {\n autoplay: false,\n loop: false,\n renderer: 'canvas',\n};\n\nconst PuzzleCard: FC<IPuzzleCardProps> = memo(\n ({\n imageHue,\n imageUrl,\n title,\n height = '100%',\n width = '100%',\n onCardClick,\n userNodeId,\n rewards,\n }) => {\n const { sticker } = rewards?.[0] || {};\n\n const puzzleStickerLottie = sticker ? getPuzzleStickerLottie(sticker) : undefined;\n\n const handleCardClick = useCallback(() => {\n if (userNodeId) {\n onCardClick?.(userNodeId);\n }\n }, [onCardClick, userNodeId]);\n\n return (\n <Styled.PuzzleWrapper\n $width={width}\n $height={height}\n $justifyContent=\"center\"\n $alignItems=\"center\"\n $imageHue={imageHue}\n $background={`${imageHue}_2`}\n onClick={handleCardClick}\n >\n <FlexView $justifyContent=\"center\" $alignItems=\"center\" $flexGap={12}>\n <Image src={imageUrl ?? ''} width={68} height={68} withLoader={false} alt=\"Puzzle\" />\n\n <Styled.Title $renderAs=\"ab3\" $align=\"center\" $width=\"80%\">\n {title}\n </Styled.Title>\n </FlexView>\n\n {puzzleStickerLottie && (\n <Styled.StickerWrapper $widthX={2.5} $heightX={2.5}>\n <LottieAnimation\n width={40}\n height={40}\n src={puzzleStickerLottie}\n settings={puzzleStickerLottieSettings}\n />\n </Styled.StickerWrapper>\n )}\n </Styled.PuzzleWrapper>\n );\n },\n);\n\nexport default PuzzleCard;\n"],"names":["puzzleStickerLottieSettings","PuzzleCard","memo","imageHue","imageUrl","title","height","width","onCardClick","userNodeId","rewards","sticker","puzzleStickerLottie","getPuzzleStickerLottie","handleCardClick","useCallback","jsxs","Styled.PuzzleWrapper","FlexView","jsx","Image","Styled.Title","Styled.StickerWrapper","LottieAnimation"],"mappings":";;;;;;;AAWA,MAAMA,IAA8B;AAAA,EAClC,UAAU;AAAA,EACV,MAAM;AAAA,EACN,UAAU;AACZ,GAEMC,IAAmCC;AAAA,EACvC,CAAC;AAAA,IACC,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC,IAAS;AAAA,IACT,OAAAC,IAAQ;AAAA,IACR,aAAAC;AAAA,IACA,YAAAC;AAAA,IACA,SAAAC;AAAA,EAAA,MACI;AACJ,UAAM,EAAE,SAAAC,EAAQ,KAAID,KAAA,gBAAAA,EAAU,OAAM,CAAA,GAE9BE,IAAsBD,IAAUE,EAAuBF,CAAO,IAAI,QAElEG,IAAkBC,EAAY,MAAM;AACxC,MAAIN,MACFD,KAAA,QAAAA,EAAcC;AAAA,IAChB,GACC,CAACD,GAAaC,CAAU,CAAC;AAG1B,WAAA,gBAAAO;AAAA,MAACC;AAAAA,MAAA;AAAA,QACC,QAAQV;AAAA,QACR,SAASD;AAAA,QACT,iBAAgB;AAAA,QAChB,aAAY;AAAA,QACZ,WAAWH;AAAA,QACX,aAAa,GAAGA,CAAQ;AAAA,QACxB,SAASW;AAAA,QAET,UAAA;AAAA,UAAA,gBAAAE,EAACE,KAAS,iBAAgB,UAAS,aAAY,UAAS,UAAU,IAChE,UAAA;AAAA,YAAC,gBAAAC,EAAAC,GAAA,EAAM,KAAKhB,KAAY,IAAI,OAAO,IAAI,QAAQ,IAAI,YAAY,IAAO,KAAI,SAAS,CAAA;AAAA,YAEnF,gBAAAe,EAACE,GAAA,EAAa,WAAU,OAAM,QAAO,UAAS,QAAO,OAClD,UACHhB,EAAA,CAAA;AAAA,UAAA,GACF;AAAA,UAECO,uBACEU,GAAA,EAAsB,SAAS,KAAK,UAAU,KAC7C,UAAA,gBAAAH;AAAA,YAACI;AAAA,YAAA;AAAA,cACC,OAAO;AAAA,cACP,QAAQ;AAAA,cACR,KAAKX;AAAA,cACL,UAAUZ;AAAA,YAAA;AAAA,UAAA,GAEd;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;"}
@@ -1,57 +1,58 @@
1
- import { jsx as n, jsxs as b } from "react/jsx-runtime";
2
- import { memo as x, useState as R, useRef as V, useEffect as N, useCallback as u, useMemo as T } from "react";
3
- import j from "../../ui/layout/flex-view.js";
4
- import k from "../../ui/lottie-animation/lottie-animation.js";
5
- import { usePostPuzzleToAssign as O } from "../api/puzzle-assign.js";
6
- import { PUZZLE_ASSIGN_ANIMATION as m } from "../constants/puzzle-container.js";
7
- import { getPuzzleCardLottie as v } from "../utils/puzzle-pattern.js";
8
- import { PuzzleContainer as C, PuzzleAssignedWrapper as G, PuzzleContentWrapper as M } from "./puzzle-container-styled.js";
9
- import L from "./puzzle-container-view.js";
10
- const U = {
1
+ import { jsx as r, jsxs as x } from "react/jsx-runtime";
2
+ import { memo as R, useState as V, useRef as N, useEffect as T, useCallback as u, useMemo as j } from "react";
3
+ import k from "../../ui/layout/flex-view.js";
4
+ import O from "../../ui/lottie-animation/lottie-animation.js";
5
+ import { usePostPuzzleToAssign as v } from "../api/puzzle-assign.js";
6
+ import { PUZZLE_ASSIGN_ANIMATION as c } from "../constants/puzzle-container.js";
7
+ import { getPuzzleCardLottie as G } from "../utils/puzzle-pattern.js";
8
+ import { PuzzleContainer as L, PuzzleAssignedWrapper as M, PuzzleContentWrapper as U } from "./puzzle-container-styled.js";
9
+ import S from "./puzzle-container-view.js";
10
+ const W = {
11
11
  loop: !1,
12
12
  renderer: "svg",
13
13
  autoPlay: !1
14
- }, W = x(
14
+ }, X = R(
15
15
  ({
16
16
  triggerReveal: a = !1,
17
17
  onFullyHidden: i,
18
- onPuzzleClick: c,
19
- puzzleData: S,
20
- courseStream: f,
21
- studentId: z
18
+ onPuzzleClick: f,
19
+ puzzleData: E,
20
+ courseStream: p,
21
+ studentId: z,
22
+ onPuzzleAssign: l
22
23
  }) => {
23
24
  const {
24
- image_hue: l,
25
- image_url: p,
26
- assigned: s,
27
- title: g,
25
+ image_hue: m,
26
+ image_url: g,
27
+ assigned: n,
28
+ title: h,
28
29
  id: P
29
- } = S, [E, o] = R(s), r = V(null), $ = v(l), { post: h, isProcessing: I } = O({
30
+ } = E, [$, o] = V(n), s = N(null), I = G(m), { post: d, isProcessing: _ } = v({
30
31
  onComplete: (e) => {
31
32
  var t;
32
- e ? o(!0) : ((t = r.current) == null || t.playSegments(m.REVEAL_ASSIGNED, !1), o(!1));
33
+ e ? o(!0) : ((t = s.current) == null || t.playSegments(c.REVEAL_ASSIGNED, !1), o(!1), l == null || l());
33
34
  }
34
35
  });
35
- N(() => {
36
+ T(() => {
36
37
  var e, t;
37
- s || (a ? (e = r.current) == null || e.playSegments(m.REVEAL, !0) : ((t = r.current) == null || t.stop(), o(!1)));
38
- }, [s, a]);
38
+ n || (a ? (e = s.current) == null || e.playSegments(c.REVEAL, !0) : ((t = s.current) == null || t.stop(), o(!1)));
39
+ }, [n, a]);
39
40
  const A = u(() => {
40
- s || h(
41
+ n || d(
41
42
  {
42
43
  puzzle_id: P
43
44
  },
44
45
  {
45
46
  studentId: z,
46
- courseStream: f
47
+ courseStream: p
47
48
  }
48
49
  );
49
- }, [f, s, h, P, z]), d = u(() => {
50
- c();
51
- }, [c]), _ = u(() => {
50
+ }, [p, n, d, P, z]), C = u(() => {
51
+ f();
52
+ }, [f]), w = u(() => {
52
53
  var e;
53
- (e = r.current) == null || e.playSegments(m.REVEAL, !0);
54
- }, []), w = T(
54
+ (e = s.current) == null || e.playSegments(c.REVEAL, !0);
55
+ }, []), b = j(
55
56
  () => ({
56
57
  name: "enterFrame",
57
58
  callback: (e) => {
@@ -61,49 +62,49 @@ const U = {
61
62
  }),
62
63
  [i]
63
64
  );
64
- return a ? s ? /* @__PURE__ */ n(C, { $justifyContent: "center", children: /* @__PURE__ */ n(
65
- G,
65
+ return a ? n ? /* @__PURE__ */ r(L, { $justifyContent: "center", children: /* @__PURE__ */ r(
66
+ M,
66
67
  {
67
- $imageHue: l,
68
- $background: `${l}_2`,
68
+ $imageHue: m,
69
+ $background: `${m}_2`,
69
70
  $widthX: 15.9375,
70
- children: /* @__PURE__ */ n(
71
- L,
71
+ children: /* @__PURE__ */ r(
72
+ S,
72
73
  {
73
- imageUrl: p,
74
- title: g,
75
- handleOnPuzzleClick: d,
74
+ imageUrl: g,
75
+ title: h,
76
+ handleOnPuzzleClick: C,
76
77
  handleAssign: A,
77
78
  assigned: !0
78
79
  }
79
80
  )
80
81
  }
81
- ) }) : /* @__PURE__ */ n(C, { children: /* @__PURE__ */ b(j, { $heightX: 26, children: [
82
- /* @__PURE__ */ n(
83
- k,
82
+ ) }) : /* @__PURE__ */ r(L, { children: /* @__PURE__ */ x(k, { $heightX: 26, children: [
83
+ /* @__PURE__ */ r(
84
+ O,
84
85
  {
85
- src: $,
86
- ref: r,
87
- settings: U,
88
- onRender: _,
89
- eventListener: w,
86
+ src: I,
87
+ ref: s,
88
+ settings: W,
89
+ onRender: w,
90
+ eventListener: b,
90
91
  animateOnIntersect: !0
91
92
  }
92
93
  ),
93
- /* @__PURE__ */ n(M, { $visible: E, $position: "absolute", children: /* @__PURE__ */ n(
94
- L,
94
+ /* @__PURE__ */ r(U, { $visible: $, $position: "absolute", children: /* @__PURE__ */ r(
95
+ S,
95
96
  {
96
- imageUrl: p,
97
- title: g,
98
- handleOnPuzzleClick: d,
97
+ imageUrl: g,
98
+ title: h,
99
+ handleOnPuzzleClick: C,
99
100
  handleAssign: A,
100
- assigning: I
101
+ assigning: _
101
102
  }
102
103
  ) })
103
104
  ] }) }) : null;
104
105
  }
105
- ), Y = W;
106
+ ), F = X;
106
107
  export {
107
- Y as default
108
+ F as default
108
109
  };
109
110
  //# sourceMappingURL=puzzle-container.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"puzzle-container.js","sources":["../../../../src/features/puzzles/puzzle-container/puzzle-container.tsx"],"sourcesContent":["import type { ILottieAnimationRef } from '../../ui/lottie-animation/types';\nimport type { IPuzzleCardContainerProps } from './puzzle-container-types';\nimport type { AnimationEventName, BMEnterFrameEvent } from 'lottie-web';\nimport type { FC } from 'react';\n\nimport { useState, useCallback, useEffect, useRef, memo, useMemo } from 'react';\n\nimport FlexView from '../../ui/layout/flex-view';\nimport LottieAnimation from '../../ui/lottie-animation/lottie-animation';\nimport { usePostPuzzleToAssign } from '../api/puzzle-assign';\nimport { PUZZLE_ASSIGN_ANIMATION } from '../constants/puzzle-container';\nimport { getPuzzleCardLottie } from '../utils/puzzle-pattern';\nimport * as Styled from './puzzle-container-styled';\nimport PuzzleAssigned from './puzzle-container-view';\n\nconst modeRevealAnimationSettings = {\n loop: false,\n renderer: 'svg',\n autoPlay: false,\n};\n\nconst PuzzleCardContainer: FC<IPuzzleCardContainerProps> = memo(\n ({\n triggerReveal = false,\n onFullyHidden,\n onPuzzleClick,\n puzzleData,\n courseStream,\n studentId,\n }) => {\n const {\n image_hue: imageHue,\n image_url: imageUrl,\n assigned: externalAssigned,\n title,\n id: puzzleId,\n } = puzzleData;\n\n const [showPuzzleInfo, setShowPuzzleInfo] = useState(externalAssigned);\n\n const assignLottieRef = useRef<ILottieAnimationRef | null>(null);\n const puzzleLottieSrc = getPuzzleCardLottie(imageHue);\n\n const { post: postPuzzleToAssign, isProcessing } = usePostPuzzleToAssign({\n onComplete: (error: string | null) => {\n if (error) {\n // Handle error (e.g., show a notification)\n setShowPuzzleInfo(true);\n } else {\n assignLottieRef.current?.playSegments(PUZZLE_ASSIGN_ANIMATION.REVEAL_ASSIGNED, false);\n\n setShowPuzzleInfo(false);\n }\n },\n });\n\n useEffect(() => {\n if (!externalAssigned) {\n if (triggerReveal) {\n assignLottieRef.current?.playSegments(PUZZLE_ASSIGN_ANIMATION.REVEAL, true);\n } else {\n assignLottieRef.current?.stop();\n setShowPuzzleInfo(false);\n }\n }\n }, [externalAssigned, triggerReveal]);\n\n const handleAssign = useCallback(() => {\n if (externalAssigned) return;\n\n postPuzzleToAssign(\n {\n puzzle_id: puzzleId,\n },\n {\n studentId,\n courseStream,\n },\n );\n }, [courseStream, externalAssigned, postPuzzleToAssign, puzzleId, studentId]);\n\n const handleOnPuzzleClick = useCallback(() => {\n onPuzzleClick();\n }, [onPuzzleClick]);\n\n const showPuzzleLottie = useCallback(() => {\n assignLottieRef.current?.playSegments(PUZZLE_ASSIGN_ANIMATION.REVEAL, true);\n }, []);\n\n const onAnimationFinish = useMemo(\n () => ({\n name: 'enterFrame' as AnimationEventName,\n callback: (event: BMEnterFrameEvent) => {\n const { currentTime } = event;\n\n if (currentTime === 49) {\n setShowPuzzleInfo(true);\n }\n\n if (currentTime === 101) {\n onFullyHidden?.();\n }\n },\n }),\n [onFullyHidden],\n );\n\n if (!triggerReveal) {\n return null;\n }\n\n if (externalAssigned) {\n return (\n <Styled.PuzzleContainer $justifyContent=\"center\">\n <Styled.PuzzleAssignedWrapper\n $imageHue={imageHue}\n $background={`${imageHue}_2`}\n $widthX={15.9375}\n >\n <PuzzleAssigned\n imageUrl={imageUrl}\n title={title}\n handleOnPuzzleClick={handleOnPuzzleClick}\n handleAssign={handleAssign}\n assigned\n />\n </Styled.PuzzleAssignedWrapper>\n </Styled.PuzzleContainer>\n );\n }\n\n return (\n <Styled.PuzzleContainer>\n <FlexView $heightX={26}>\n <LottieAnimation\n src={puzzleLottieSrc}\n ref={assignLottieRef}\n settings={modeRevealAnimationSettings}\n onRender={showPuzzleLottie}\n eventListener={onAnimationFinish}\n animateOnIntersect\n />\n\n <Styled.PuzzleContentWrapper $visible={showPuzzleInfo} $position=\"absolute\">\n <PuzzleAssigned\n imageUrl={imageUrl}\n title={title}\n handleOnPuzzleClick={handleOnPuzzleClick}\n handleAssign={handleAssign}\n assigning={isProcessing}\n />\n </Styled.PuzzleContentWrapper>\n </FlexView>\n </Styled.PuzzleContainer>\n );\n },\n);\n\nexport default PuzzleCardContainer;\n"],"names":["modeRevealAnimationSettings","PuzzleCardContainer","memo","triggerReveal","onFullyHidden","onPuzzleClick","puzzleData","courseStream","studentId","imageHue","imageUrl","externalAssigned","title","puzzleId","showPuzzleInfo","setShowPuzzleInfo","useState","assignLottieRef","useRef","puzzleLottieSrc","getPuzzleCardLottie","postPuzzleToAssign","isProcessing","usePostPuzzleToAssign","error","_a","PUZZLE_ASSIGN_ANIMATION","useEffect","_b","handleAssign","useCallback","handleOnPuzzleClick","showPuzzleLottie","onAnimationFinish","useMemo","event","currentTime","jsx","Styled.PuzzleContainer","Styled.PuzzleAssignedWrapper","PuzzleAssigned","jsxs","FlexView","LottieAnimation","Styled.PuzzleContentWrapper","PuzzleCardContainer$1"],"mappings":";;;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,UACA,WAAWP;AAAA,QAAA;AAAA,MAAA,GAEf;AAAA,IAAA,EACF,CAAA,EACF,CAAA,IA7CO;AAAA,EA+CX;AACF,GAEAuB,IAAe5C;"}
1
+ {"version":3,"file":"puzzle-container.js","sources":["../../../../src/features/puzzles/puzzle-container/puzzle-container.tsx"],"sourcesContent":["import type { ILottieAnimationRef } from '../../ui/lottie-animation/types';\nimport type { IPuzzleCardContainerProps } from './puzzle-container-types';\nimport type { AnimationEventName, BMEnterFrameEvent } from 'lottie-web';\nimport type { FC } from 'react';\n\nimport { useState, useCallback, useEffect, useRef, memo, useMemo } from 'react';\n\nimport FlexView from '../../ui/layout/flex-view';\nimport LottieAnimation from '../../ui/lottie-animation/lottie-animation';\nimport { usePostPuzzleToAssign } from '../api/puzzle-assign';\nimport { PUZZLE_ASSIGN_ANIMATION } from '../constants/puzzle-container';\nimport { getPuzzleCardLottie } from '../utils/puzzle-pattern';\nimport * as Styled from './puzzle-container-styled';\nimport PuzzleAssigned from './puzzle-container-view';\n\nconst modeRevealAnimationSettings = {\n loop: false,\n renderer: 'svg',\n autoPlay: false,\n};\n\nconst PuzzleCardContainer: FC<IPuzzleCardContainerProps> = memo(\n ({\n triggerReveal = false,\n onFullyHidden,\n onPuzzleClick,\n puzzleData,\n courseStream,\n studentId,\n onPuzzleAssign,\n }) => {\n const {\n image_hue: imageHue,\n image_url: imageUrl,\n assigned: externalAssigned,\n title,\n id: puzzleId,\n } = puzzleData;\n\n const [showPuzzleInfo, setShowPuzzleInfo] = useState(externalAssigned);\n\n const assignLottieRef = useRef<ILottieAnimationRef | null>(null);\n const puzzleLottieSrc = getPuzzleCardLottie(imageHue);\n\n const { post: postPuzzleToAssign, isProcessing } = usePostPuzzleToAssign({\n onComplete: (error: string | null) => {\n if (error) {\n // Handle error (e.g., show a notification)\n setShowPuzzleInfo(true);\n } else {\n assignLottieRef.current?.playSegments(PUZZLE_ASSIGN_ANIMATION.REVEAL_ASSIGNED, false);\n\n setShowPuzzleInfo(false);\n onPuzzleAssign?.();\n }\n },\n });\n\n useEffect(() => {\n if (!externalAssigned) {\n if (triggerReveal) {\n assignLottieRef.current?.playSegments(PUZZLE_ASSIGN_ANIMATION.REVEAL, true);\n } else {\n assignLottieRef.current?.stop();\n setShowPuzzleInfo(false);\n }\n }\n }, [externalAssigned, triggerReveal]);\n\n const handleAssign = useCallback(() => {\n if (externalAssigned) return;\n\n postPuzzleToAssign(\n {\n puzzle_id: puzzleId,\n },\n {\n studentId,\n courseStream,\n },\n );\n }, [courseStream, externalAssigned, postPuzzleToAssign, puzzleId, studentId]);\n\n const handleOnPuzzleClick = useCallback(() => {\n onPuzzleClick();\n }, [onPuzzleClick]);\n\n const showPuzzleLottie = useCallback(() => {\n assignLottieRef.current?.playSegments(PUZZLE_ASSIGN_ANIMATION.REVEAL, true);\n }, []);\n\n const onAnimationFinish = useMemo(\n () => ({\n name: 'enterFrame' as AnimationEventName,\n callback: (event: BMEnterFrameEvent) => {\n const { currentTime } = event;\n\n if (currentTime === 49) {\n setShowPuzzleInfo(true);\n }\n\n if (currentTime === 101) {\n onFullyHidden?.();\n }\n },\n }),\n [onFullyHidden],\n );\n\n if (!triggerReveal) {\n return null;\n }\n\n if (externalAssigned) {\n return (\n <Styled.PuzzleContainer $justifyContent=\"center\">\n <Styled.PuzzleAssignedWrapper\n $imageHue={imageHue}\n $background={`${imageHue}_2`}\n $widthX={15.9375}\n >\n <PuzzleAssigned\n imageUrl={imageUrl}\n title={title}\n handleOnPuzzleClick={handleOnPuzzleClick}\n handleAssign={handleAssign}\n assigned\n />\n </Styled.PuzzleAssignedWrapper>\n </Styled.PuzzleContainer>\n );\n }\n\n return (\n <Styled.PuzzleContainer>\n <FlexView $heightX={26}>\n <LottieAnimation\n src={puzzleLottieSrc}\n ref={assignLottieRef}\n settings={modeRevealAnimationSettings}\n onRender={showPuzzleLottie}\n eventListener={onAnimationFinish}\n animateOnIntersect\n />\n\n <Styled.PuzzleContentWrapper $visible={showPuzzleInfo} $position=\"absolute\">\n <PuzzleAssigned\n imageUrl={imageUrl}\n title={title}\n handleOnPuzzleClick={handleOnPuzzleClick}\n handleAssign={handleAssign}\n assigning={isProcessing}\n />\n </Styled.PuzzleContentWrapper>\n </FlexView>\n </Styled.PuzzleContainer>\n );\n },\n);\n\nexport default PuzzleCardContainer;\n"],"names":["modeRevealAnimationSettings","PuzzleCardContainer","memo","triggerReveal","onFullyHidden","onPuzzleClick","puzzleData","courseStream","studentId","onPuzzleAssign","imageHue","imageUrl","externalAssigned","title","puzzleId","showPuzzleInfo","setShowPuzzleInfo","useState","assignLottieRef","useRef","puzzleLottieSrc","getPuzzleCardLottie","postPuzzleToAssign","isProcessing","usePostPuzzleToAssign","error","_a","PUZZLE_ASSIGN_ANIMATION","useEffect","_b","handleAssign","useCallback","handleOnPuzzleClick","showPuzzleLottie","onAnimationFinish","useMemo","event","currentTime","jsx","Styled.PuzzleContainer","Styled.PuzzleAssignedWrapper","PuzzleAssigned","jsxs","FlexView","LottieAnimation","Styled.PuzzleContentWrapper","PuzzleCardContainer$1"],"mappings":";;;;;;;;;AAeA,MAAMA,IAA8B;AAAA,EAClC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,UAAU;AACZ,GAEMC,IAAqDC;AAAA,EACzD,CAAC;AAAA,IACC,eAAAC,IAAgB;AAAA,IAChB,eAAAC;AAAA,IACA,eAAAC;AAAA,IACA,YAAAC;AAAA,IACA,cAAAC;AAAA,IACA,WAAAC;AAAA,IACA,gBAAAC;AAAA,EAAA,MACI;AACE,UAAA;AAAA,MACJ,WAAWC;AAAA,MACX,WAAWC;AAAA,MACX,UAAUC;AAAA,MACV,OAAAC;AAAA,MACA,IAAIC;AAAA,IACF,IAAAR,GAEE,CAACS,GAAgBC,CAAiB,IAAIC,EAASL,CAAgB,GAE/DM,IAAkBC,EAAmC,IAAI,GACzDC,IAAkBC,EAAoBX,CAAQ,GAE9C,EAAE,MAAMY,GAAoB,cAAAC,EAAA,IAAiBC,EAAsB;AAAA,MACv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A,QACC,WAAW9B;AAAA,QACX,aAAa,GAAGA,CAAQ;AAAA,QACxB,SAAS;AAAA,QAET,UAAA,gBAAA4B;AAAA,UAACG;AAAAA,UAAA;AAAA,YACC,UAAA9B;AAAA,YACA,OAAAE;AAAA,YACA,qBAAAmB;AAAA,YACA,cAAAF;AAAA,YACA,UAAQ;AAAA,UAAA;AAAA,QACV;AAAA,MAAA;AAAA,IAEJ,EAAA,CAAA,sBAKDS,GAAA,EACC,UAAC,gBAAAG,EAAAC,GAAA,EAAS,UAAU,IAClB,UAAA;AAAA,MAAA,gBAAAL;AAAA,QAACM;AAAA,QAAA;AAAA,UACC,KAAKxB;AAAA,UACL,KAAKF;AAAA,UACL,UAAUlB;AAAA,UACV,UAAUiC;AAAA,UACV,eAAeC;AAAA,UACf,oBAAkB;AAAA,QAAA;AAAA,MACpB;AAAA,wBAECW,GAAA,EAA4B,UAAU9B,GAAgB,WAAU,YAC/D,UAAA,gBAAAuB;AAAA,QAACG;AAAAA,QAAA;AAAA,UACC,UAAA9B;AAAA,UACA,OAAAE;AAAA,UACA,qBAAAmB;AAAA,UACA,cAAAF;AAAA,UACA,WAAWP;AAAA,QAAA;AAAA,MAAA,GAEf;AAAA,IAAA,EACF,CAAA,EACF,CAAA,IA7CO;AAAA,EA+CX;AACF,GAEAuB,IAAe7C;"}
@@ -1,31 +1,31 @@
1
1
  import { jsx as e, jsxs as t } from "react/jsx-runtime";
2
- import { useCallback as $, useEffect as P } from "react";
3
- import C from "../../../assets/line-icons/icons/back2.js";
4
- import b from "../../ui/buttons/button/button.js";
5
- import x from "../../ui/buttons/icon-button/icon-button.js";
6
- import k from "../../ui/layout/flex-view.js";
7
- import I from "../../ui/loader/app-loader/app-loader.js";
8
- import a from "../../ui/text/text.js";
9
- import { useGetPuzzles as w } from "../api/puzzle-dashboard.js";
10
- import A from "../comps/puzzle-card.js";
11
- import { PuzzleDashboardWrapper as B, BannerWrapper as X, BackIconContainer as _, BackIconWrapper as j, ContentWrapper as v } from "./puzzle-dashboard-styled.js";
12
- const y = ({ studentId: i, onBackCLick: l, onCardClick: s }) => {
2
+ import { useCallback as P, useEffect as b } from "react";
3
+ import x from "../../../assets/line-icons/icons/back2.js";
4
+ import C from "../../ui/buttons/button/button.js";
5
+ import w from "../../ui/buttons/icon-button/icon-button.js";
6
+ import I from "../../ui/layout/flex-view.js";
7
+ import A from "../../ui/loader/app-loader/app-loader.js";
8
+ import l from "../../ui/text/text.js";
9
+ import { useGetPuzzles as k } from "../api/puzzle-dashboard.js";
10
+ import v from "../comps/puzzle-card.js";
11
+ import { PuzzleDashboardWrapper as B, BannerWrapper as X, BackIconContainer as _, BackIconWrapper as j, ContentWrapper as y } from "./puzzle-dashboard-styled.js";
12
+ const S = ({ studentId: i, onBackCLick: o, onCardClick: s }) => {
13
13
  const {
14
- get: o,
14
+ get: a,
15
15
  data: r,
16
16
  isProcessing: c,
17
17
  isProcessingFailed: m
18
- } = w(), h = (r == null ? void 0 : r.length) || 0, n = $(() => {
19
- o(i, void 0, {
18
+ } = k(), h = (r == null ? void 0 : r.length) || 0, n = P(() => {
19
+ a(i, void 0, {
20
20
  courseStream: "MATH"
21
21
  });
22
- }, [o, i]);
23
- return P(() => {
22
+ }, [a, i]);
23
+ return b(() => {
24
24
  n();
25
- }, [n]), c ? /* @__PURE__ */ e(I, { height: "100%" }) : m ? /* @__PURE__ */ t(k, { $flexGapX: 1.5, $height: "100vh", $justifyContent: "center", $alignItems: "center", children: [
26
- /* @__PURE__ */ e(a, { $renderAs: "h6", children: "Oops! Something went wrong. Please try again later." }),
25
+ }, [n]), c ? /* @__PURE__ */ e(A, { height: "100vh" }) : m ? /* @__PURE__ */ t(I, { $flexGapX: 1.5, $height: "100vh", $justifyContent: "center", $alignItems: "center", children: [
26
+ /* @__PURE__ */ e(l, { $renderAs: "h6", children: "Oops! Something went wrong. Please try again later." }),
27
27
  /* @__PURE__ */ e(
28
- b,
28
+ C,
29
29
  {
30
30
  widthX: 14,
31
31
  size: "small",
@@ -37,31 +37,32 @@ const y = ({ studentId: i, onBackCLick: l, onCardClick: s }) => {
37
37
  )
38
38
  ] }) : /* @__PURE__ */ t(B, { $alignItems: "center", $flexGapX: 2.5, $position: "relative", children: [
39
39
  /* @__PURE__ */ t(X, { $widthX: 50, $heightX: 10.5, $justifyContent: "center", children: [
40
- /* @__PURE__ */ t(a, { $renderAs: "ah3-bold", $alignSelf: "center", children: [
40
+ /* @__PURE__ */ t(l, { $renderAs: "ah3-bold", $alignSelf: "center", children: [
41
41
  h,
42
42
  " Puzzles Solved"
43
43
  ] }),
44
- /* @__PURE__ */ e(_, { $height: "100%", children: /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(
45
- x,
44
+ o && /* @__PURE__ */ e(_, { $height: "100%", children: /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(
45
+ w,
46
46
  {
47
- Icon: C,
47
+ Icon: x,
48
48
  size: "xsmall",
49
49
  renderAs: "secondary",
50
50
  analyticsLabel: "puzzle_back",
51
- onClick: l
51
+ onClick: o
52
52
  }
53
53
  ) }) })
54
54
  ] }),
55
- /* @__PURE__ */ e(v, { children: r == null ? void 0 : r.map((d) => {
55
+ /* @__PURE__ */ e(y, { children: r == null ? void 0 : r.map((d) => {
56
56
  const {
57
57
  id: p,
58
58
  image_hue: u,
59
59
  image_url: f,
60
60
  title: g,
61
- user_node_id: z
61
+ user_node_id: z,
62
+ rewards: $
62
63
  } = d;
63
64
  return /* @__PURE__ */ e(
64
- A,
65
+ v,
65
66
  {
66
67
  imageHue: u,
67
68
  imageUrl: f,
@@ -69,14 +70,15 @@ const y = ({ studentId: i, onBackCLick: l, onCardClick: s }) => {
69
70
  width: 126,
70
71
  height: 152,
71
72
  onCardClick: s,
72
- userNodeId: z
73
+ userNodeId: z,
74
+ rewards: $
73
75
  },
74
76
  p
75
77
  );
76
78
  }) })
77
79
  ] });
78
- }, U = y;
80
+ }, V = S;
79
81
  export {
80
- U as default
82
+ V as default
81
83
  };
82
84
  //# sourceMappingURL=puzzle-dashboard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"puzzle-dashboard.js","sources":["../../../../src/features/puzzles/puzzle-dashboard/puzzle-dashboard.tsx"],"sourcesContent":["import type { IPuzzleDashboardProps } from './puzzle-dashboard-types';\n\nimport { useCallback, useEffect, type FC } from 'react';\n\nimport Back2Icon from '../../../assets/line-icons/icons/back2';\nimport Button from '../../ui/buttons/button/button';\nimport IconButton from '../../ui/buttons/icon-button/icon-button';\nimport FlexView from '../../ui/layout/flex-view';\nimport AppLoader from '../../ui/loader/app-loader/app-loader';\nimport Text from '../../ui/text/text';\nimport { useGetPuzzles } from '../api/puzzle-dashboard';\nimport PuzzleCard from '../comps/puzzle-card';\nimport * as Styled from './puzzle-dashboard-styled';\n\nconst PuzzleDashboard: FC<IPuzzleDashboardProps> = ({ studentId, onBackCLick, onCardClick }) => {\n const {\n get: getPuzzles,\n data: puzzleHistoryData,\n isProcessing,\n isProcessingFailed,\n } = useGetPuzzles();\n\n const puzzleCount = puzzleHistoryData?.length || 0;\n\n const fetchPuzzles = useCallback(() => {\n getPuzzles(studentId, undefined, {\n courseStream: 'MATH',\n });\n }, [getPuzzles, studentId]);\n\n useEffect(() => {\n fetchPuzzles();\n }, [fetchPuzzles]);\n\n if (isProcessing) {\n return <AppLoader height=\"100%\" />;\n }\n\n if (isProcessingFailed) {\n return (\n <FlexView $flexGapX={1.5} $height=\"100vh\" $justifyContent=\"center\" $alignItems=\"center\">\n <Text $renderAs=\"h6\">Oops! Something went wrong. Please try again later.</Text>\n <Button\n widthX={14}\n size=\"small\"\n shape=\"square\"\n renderAs=\"primary\"\n label=\"Try again\"\n onClick={fetchPuzzles}\n />\n </FlexView>\n );\n }\n\n return (\n <Styled.PuzzleDashboardWrapper $alignItems=\"center\" $flexGapX={2.5} $position=\"relative\">\n <Styled.BannerWrapper $widthX={50} $heightX={10.5} $justifyContent=\"center\">\n <Text $renderAs=\"ah3-bold\" $alignSelf=\"center\">\n {puzzleCount} Puzzles Solved\n </Text>\n\n <Styled.BackIconContainer $height=\"100%\">\n <Styled.BackIconWrapper>\n <IconButton\n Icon={Back2Icon}\n size=\"xsmall\"\n renderAs=\"secondary\"\n analyticsLabel=\"puzzle_back\"\n onClick={onBackCLick}\n />\n </Styled.BackIconWrapper>\n </Styled.BackIconContainer>\n </Styled.BannerWrapper>\n\n <Styled.ContentWrapper>\n {puzzleHistoryData?.map(item => {\n const {\n id,\n image_hue: imageHue,\n image_url: imageUrl,\n title,\n user_node_id: userNodeId,\n } = item;\n\n return (\n <PuzzleCard\n key={id}\n imageHue={imageHue}\n imageUrl={imageUrl}\n title={title}\n width={126}\n height={152}\n onCardClick={onCardClick}\n userNodeId={userNodeId}\n />\n );\n })}\n </Styled.ContentWrapper>\n </Styled.PuzzleDashboardWrapper>\n );\n};\n\nexport default PuzzleDashboard;\n"],"names":["PuzzleDashboard","studentId","onBackCLick","onCardClick","getPuzzles","puzzleHistoryData","isProcessing","isProcessingFailed","useGetPuzzles","puzzleCount","fetchPuzzles","useCallback","useEffect","jsx","AppLoader","jsxs","FlexView","Text","Button","Styled.PuzzleDashboardWrapper","Styled.BannerWrapper","Styled.BackIconContainer","Styled.BackIconWrapper","IconButton","Back2Icon","Styled.ContentWrapper","item","id","imageHue","imageUrl","title","userNodeId","PuzzleCard","PuzzleDashboard$1"],"mappings":";;;;;;;;;;;AAcA,MAAMA,IAA6C,CAAC,EAAE,WAAAC,GAAW,aAAAC,GAAa,aAAAC,QAAkB;AACxF,QAAA;AAAA,IACJ,KAAKC;AAAA,IACL,MAAMC;AAAA,IACN,cAAAC;AAAA,IACA,oBAAAC;AAAA,MACEC,EAAc,GAEZC,KAAcJ,KAAA,gBAAAA,EAAmB,WAAU,GAE3CK,IAAeC,EAAY,MAAM;AACrC,IAAAP,EAAWH,GAAW,QAAW;AAAA,MAC/B,cAAc;AAAA,IAAA,CACf;AAAA,EAAA,GACA,CAACG,GAAYH,CAAS,CAAC;AAM1B,SAJAW,EAAU,MAAM;AACD,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AAAA,UAEC,UAAAJ;AAAA,UACA,UAAAC;AAAA,UACA,OAAAC;AAAA,UACA,OAAO;AAAA,UACP,QAAQ;AAAA,UACR,aAAA3B;AAAA,UACA,YAAA4B;AAAA,QAAA;AAAA,QAPKJ;AAAA,MAAA;AAAA,IAUV,IACH;AAAA,EACF,EAAA,CAAA;AAEJ,GAEAM,IAAejC;"}
1
+ {"version":3,"file":"puzzle-dashboard.js","sources":["../../../../src/features/puzzles/puzzle-dashboard/puzzle-dashboard.tsx"],"sourcesContent":["import type { IPuzzleDashboardProps } from './puzzle-dashboard-types';\n\nimport { useCallback, useEffect, type FC } from 'react';\n\nimport Back2Icon from '../../../assets/line-icons/icons/back2';\nimport Button from '../../ui/buttons/button/button';\nimport IconButton from '../../ui/buttons/icon-button/icon-button';\nimport FlexView from '../../ui/layout/flex-view';\nimport AppLoader from '../../ui/loader/app-loader/app-loader';\nimport Text from '../../ui/text/text';\nimport { useGetPuzzles } from '../api/puzzle-dashboard';\nimport PuzzleCard from '../comps/puzzle-card';\nimport * as Styled from './puzzle-dashboard-styled';\n\nconst PuzzleDashboard: FC<IPuzzleDashboardProps> = ({ studentId, onBackCLick, onCardClick }) => {\n const {\n get: getPuzzles,\n data: puzzleHistoryData,\n isProcessing,\n isProcessingFailed,\n } = useGetPuzzles();\n\n const puzzleCount = puzzleHistoryData?.length || 0;\n\n const fetchPuzzles = useCallback(() => {\n getPuzzles(studentId, undefined, {\n courseStream: 'MATH',\n });\n }, [getPuzzles, studentId]);\n\n useEffect(() => {\n fetchPuzzles();\n }, [fetchPuzzles]);\n\n if (isProcessing) {\n return <AppLoader height=\"100vh\" />;\n }\n\n if (isProcessingFailed) {\n return (\n <FlexView $flexGapX={1.5} $height=\"100vh\" $justifyContent=\"center\" $alignItems=\"center\">\n <Text $renderAs=\"h6\">Oops! Something went wrong. Please try again later.</Text>\n <Button\n widthX={14}\n size=\"small\"\n shape=\"square\"\n renderAs=\"primary\"\n label=\"Try again\"\n onClick={fetchPuzzles}\n />\n </FlexView>\n );\n }\n\n return (\n <Styled.PuzzleDashboardWrapper $alignItems=\"center\" $flexGapX={2.5} $position=\"relative\">\n <Styled.BannerWrapper $widthX={50} $heightX={10.5} $justifyContent=\"center\">\n <Text $renderAs=\"ah3-bold\" $alignSelf=\"center\">\n {puzzleCount} Puzzles Solved\n </Text>\n\n {onBackCLick && (\n <Styled.BackIconContainer $height=\"100%\">\n <Styled.BackIconWrapper>\n <IconButton\n Icon={Back2Icon}\n size=\"xsmall\"\n renderAs=\"secondary\"\n analyticsLabel=\"puzzle_back\"\n onClick={onBackCLick}\n />\n </Styled.BackIconWrapper>\n </Styled.BackIconContainer>\n )}\n </Styled.BannerWrapper>\n\n <Styled.ContentWrapper>\n {puzzleHistoryData?.map(item => {\n const {\n id,\n image_hue: imageHue,\n image_url: imageUrl,\n title,\n user_node_id: userNodeId,\n rewards,\n } = item;\n\n return (\n <PuzzleCard\n key={id}\n imageHue={imageHue}\n imageUrl={imageUrl}\n title={title}\n width={126}\n height={152}\n onCardClick={onCardClick}\n userNodeId={userNodeId}\n rewards={rewards}\n />\n );\n })}\n </Styled.ContentWrapper>\n </Styled.PuzzleDashboardWrapper>\n );\n};\n\nexport default PuzzleDashboard;\n"],"names":["PuzzleDashboard","studentId","onBackCLick","onCardClick","getPuzzles","puzzleHistoryData","isProcessing","isProcessingFailed","useGetPuzzles","puzzleCount","fetchPuzzles","useCallback","useEffect","jsx","AppLoader","jsxs","FlexView","Text","Button","Styled.PuzzleDashboardWrapper","Styled.BannerWrapper","Styled.BackIconContainer","Styled.BackIconWrapper","IconButton","Back2Icon","Styled.ContentWrapper","item","id","imageHue","imageUrl","title","userNodeId","rewards","PuzzleCard","PuzzleDashboard$1"],"mappings":";;;;;;;;;;;AAcA,MAAMA,IAA6C,CAAC,EAAE,WAAAC,GAAW,aAAAC,GAAa,aAAAC,QAAkB;AACxF,QAAA;AAAA,IACJ,KAAKC;AAAA,IACL,MAAMC;AAAA,IACN,cAAAC;AAAA,I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A,GAEJ;AAAA,sBAECuB,GAAA,EACE,UAAApB,KAAA,gBAAAA,EAAmB,IAAI,CAAQqB,MAAA;AACxB,YAAA;AAAA,QACJ,IAAAC;AAAA,QACA,WAAWC;AAAA,QACX,WAAWC;AAAA,QACX,OAAAC;AAAA,QACA,cAAcC;AAAA,QACd,SAAAC;AAAA,MACE,IAAAN;AAGF,aAAA,gBAAAb;AAAA,QAACoB;AAAA,QAAA;AAAA,UAEC,UAAAL;AAAA,UACA,UAAAC;AAAA,UACA,OAAAC;AAAA,UACA,OAAO;AAAA,UACP,QAAQ;AAAA,UACR,aAAA3B;AAAA,UACA,YAAA4B;AAAA,UACA,SAAAC;AAAA,QAAA;AAAA,QARKL;AAAA,MAAA;AAAA,IAWV,IACH;AAAA,EACF,EAAA,CAAA;AAEJ,GAEAO,IAAelC;"}
package/dist/index.d.ts CHANGED
@@ -2849,6 +2849,7 @@ export declare interface IPuzzleCardAssignData {
2849
2849
  node_type: TNodeTypes;
2850
2850
  node_id: string;
2851
2851
  user_node_id: string | null;
2852
+ rewards?: TPuzzleRewards[];
2852
2853
  }
2853
2854
 
2854
2855
  declare interface IPuzzleCardContainerProps {
@@ -2864,7 +2865,7 @@ declare interface IPuzzleCardContainerProps {
2864
2865
 
2865
2866
  declare interface IPuzzleDashboardProps {
2866
2867
  studentId: string;
2867
- onBackCLick: () => void;
2868
+ onBackCLick?: () => void;
2868
2869
  onCardClick: (userNodeId: string) => void;
2869
2870
  }
2870
2871
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuemath/leap",
3
- "version": "3.1.52-beta-0.2",
3
+ "version": "3.1.52-beta-0.4",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"