@cuemath/leap 2.9.6-as3 → 2.9.6-as5

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.
Files changed (26) hide show
  1. package/dist/features/chapters-v2/chapter-details/block-sections/block-sections.js +44 -43
  2. package/dist/features/chapters-v2/chapter-details/block-sections/block-sections.js.map +1 -1
  3. package/dist/features/chapters-v2/chapter-details/chapter-banner/chapter-banner.js +31 -30
  4. package/dist/features/chapters-v2/chapter-details/chapter-banner/chapter-banner.js.map +1 -1
  5. package/dist/features/chapters-v2/chapter-details/chapter-details.js +82 -55
  6. package/dist/features/chapters-v2/chapter-details/chapter-details.js.map +1 -1
  7. package/dist/features/chapters-v2/comps/node-card/node-card-styled.js +6 -7
  8. package/dist/features/chapters-v2/comps/node-card/node-card-styled.js.map +1 -1
  9. package/dist/features/chapters-v2/comps/node-card/student-actions/student-actions.js +1 -1
  10. package/dist/features/chapters-v2/comps/node-card/student-actions/student-actions.js.map +1 -1
  11. package/dist/features/homework/hw-card-list/hw-card-list.js +23 -24
  12. package/dist/features/homework/hw-card-list/hw-card-list.js.map +1 -1
  13. package/dist/features/journey/hooks/use-chapter-journey.js +194 -0
  14. package/dist/features/journey/hooks/use-chapter-journey.js.map +1 -0
  15. package/dist/features/journey/journey-id/journey-id-student.js +2 -3
  16. package/dist/features/journey/journey-id/journey-id-student.js.map +1 -1
  17. package/dist/features/journey/journey-id/journey-id-teacher.js +5 -0
  18. package/dist/features/journey/journey-id/journey-id-teacher.js.map +1 -0
  19. package/dist/features/journey/use-journey/journey-context-provider.js +48 -48
  20. package/dist/features/journey/use-journey/journey-context-provider.js.map +1 -1
  21. package/dist/features/milestone/milestone-list-container/milestone-list-container.js +92 -97
  22. package/dist/features/milestone/milestone-list-container/milestone-list-container.js.map +1 -1
  23. package/dist/index.d.ts +29 -4
  24. package/dist/index.js +140 -137
  25. package/dist/index.js.map +1 -1
  26. package/package.json +1 -1
@@ -1,109 +1,109 @@
1
- import { jsxs as D, jsx as R } from "react/jsx-runtime";
2
- import { createContext as L, useState as J, useRef as k, useCallback as y, useMemo as N, useEffect as T } from "react";
1
+ import { jsxs as D, jsx as w } from "react/jsx-runtime";
2
+ import { createContext as L, useState as J, useRef as k, useCallback as l, useMemo as N, useEffect as R } from "react";
3
3
  import { Coachmark as B } from "../comps/coachmark/coachmark.js";
4
4
  import { usePostUserJourney as M, useGetUserJourney as z } from "../user-journey-api/user-journey-api.js";
5
5
  import { Overlay as G } from "./journey-styled.js";
6
- const S = L(null), W = ({ children: b, appId: c, userId: o }) => {
7
- const [O, x] = J(!1), [p, v] = J(null), [a, i] = J([]), [d, _] = J(!1), m = k(-1), t = k(), f = k([]), { post: g } = M(), { data: C = null, get: A } = z(), $ = y(
8
- (e, r, s) => {
9
- if (a.length > 0) {
6
+ const S = L(null), W = ({ children: T, appId: s, userId: o }) => {
7
+ const [b, O] = J(!1), [x, p] = J(null), [c, a] = J([]), [d, v] = J(!1), y = k(-1), t = k(), f = k([]), { post: _ } = M(), { data: C = null, get: g } = z(), A = l(
8
+ (e, r) => {
9
+ if (c.length > 0) {
10
10
  console.error(
11
11
  `setJourney: Other Journey is already active, Current Journey: ${t.current}, New Journey Request: ${e}`
12
12
  );
13
13
  return;
14
14
  }
15
- _(!0), t.current = e, m.current = -1, i([...r]), x(!!s);
15
+ v(!0), t.current = e, y.current = -1, a([...r]);
16
16
  },
17
- [a.length]
18
- ), u = y(() => {
17
+ [c.length]
18
+ ), u = l(() => {
19
19
  f.current.forEach((e) => {
20
20
  clearTimeout(e);
21
- }), f.current = [], t.current = void 0, m.current = -1, i([]), _(!1);
22
- }, []), E = y(
21
+ }), f.current = [], t.current = void 0, y.current = -1, a([]), v(!1);
22
+ }, []), $ = l(
23
23
  (e) => {
24
- u(), v((r) => r && !r.includes(e) ? [...r, e] : r), g({
25
- app_id: c,
24
+ u(), p((r) => r && !r.includes(e) ? [...r, e] : r), _({
25
+ app_id: s,
26
26
  user_id: o,
27
27
  journey_id: e,
28
28
  journey_status: "COMPLETED"
29
29
  });
30
30
  },
31
- [c, u, g, o]
32
- ), P = y((e, r) => {
31
+ [s, u, _, o]
32
+ ), E = l((e, r) => {
33
33
  if (!t.current || e !== t.current) {
34
34
  console.error(
35
35
  t.current ? `A Journey is already active, Current Journey: ${t.current}, New Journey Request: ${e}` : "addCoachmark was called before setJourney and Journey ID is undefined"
36
36
  );
37
37
  return;
38
38
  }
39
- i((s) => [...s, r]);
40
- }, []), j = y(
41
- (e, r = !1, s = 0, q = !1) => {
39
+ a((m) => [...m, r]);
40
+ }, []), P = l(
41
+ (e, r = !1, m = 0, q = !1) => {
42
42
  if (!t.current || e !== t.current) {
43
43
  console.error(
44
44
  t.current ? "nextCoachmark was called before setJourney" : `A Journey is already active, Current Journey: ${t.current}, New Journey Request: ${e}`
45
45
  );
46
46
  return;
47
47
  }
48
- x(q), s !== 0 && i((n) => n.map((l) => ({ ...l, isActive: !1 })));
49
- const w = setTimeout(() => {
50
- clearTimeout(w);
51
- const n = m.current + 1;
52
- i((l) => {
53
- if (n >= l.length || l.length === 0)
48
+ O(q), m !== 0 && a((n) => n.map((i) => ({ ...i, isActive: !1 })));
49
+ const j = setTimeout(() => {
50
+ clearTimeout(j);
51
+ const n = y.current + 1;
52
+ a((i) => {
53
+ if (n >= i.length || i.length === 0)
54
54
  return u(), [];
55
- m.current = n;
56
- const h = [...l];
55
+ y.current = n;
56
+ const h = [...i];
57
57
  return h[n].isActive = !0, n > 0 && (h[n - 1].isActive = r), h;
58
58
  });
59
- }, s);
60
- f.current.push(w);
59
+ }, m);
60
+ f.current.push(j);
61
61
  },
62
62
  [u]
63
63
  ), U = N(
64
64
  () => ({
65
- nextCoachmark: j,
66
- setJourney: $,
67
- addCoachmark: P,
65
+ nextCoachmark: P,
66
+ setJourney: A,
67
+ addCoachmark: E,
68
68
  clearJourney: u,
69
- endJourney: E,
70
- coachmarks: a,
71
- userCompletedJourneyIds: p,
69
+ endJourney: $,
70
+ coachmarks: c,
71
+ userCompletedJourneyIds: x,
72
72
  isJourneyActive: d
73
73
  }),
74
74
  [
75
- j,
76
- $,
77
75
  P,
78
- u,
76
+ A,
79
77
  E,
80
- a,
81
- p,
78
+ u,
79
+ $,
80
+ c,
81
+ x,
82
82
  d
83
83
  ]
84
84
  );
85
- return T(() => {
86
- c && o && A(o, {
87
- app_id: c,
85
+ return R(() => {
86
+ s && o && g(o, {
87
+ app_id: s,
88
88
  user_id: o,
89
89
  journey_status: "COMPLETED"
90
90
  });
91
- }, [c, A, o]), T(() => {
91
+ }, [s, g, o]), R(() => {
92
92
  if (C) {
93
93
  const e = C.map((r) => r.journey_id);
94
- v(e);
94
+ p(e);
95
95
  }
96
96
  }, [C]), /* @__PURE__ */ D(S.Provider, { value: U, children: [
97
- d && /* @__PURE__ */ R(
97
+ d && /* @__PURE__ */ w(
98
98
  G,
99
99
  {
100
100
  about: "journey-overlay",
101
- isJourneyBlurred: O,
101
+ isJourneyBlurred: b,
102
102
  "data-testid": t.current,
103
- children: a.map((e, r) => /* @__PURE__ */ R(B, { coachmark: e }, `coachmark-${r}`))
103
+ children: c.map((e, r) => /* @__PURE__ */ w(B, { coachmark: e }, `coachmark-${r}`))
104
104
  }
105
105
  ),
106
- b
106
+ T
107
107
  ] });
108
108
  };
109
109
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"journey-context-provider.js","sources":["../../../../src/features/journey/use-journey/journey-context-provider.tsx"],"sourcesContent":["/* eslint-disable no-console */\nimport type { TJourneyId } from '../journey-id/journey-id-types';\nimport type {\n ICoachmarkProps,\n IJourneyContext,\n IJourneyProviderProps,\n} from './journey-context-types';\nimport type { FC } from 'react';\n\nimport { createContext, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { Coachmark } from '../comps/coachmark/coachmark';\nimport { useGetUserJourney, usePostUserJourney } from '../user-journey-api/user-journey-api';\nimport * as S from './journey-styled';\n\nexport const JourneyContext = createContext<IJourneyContext | null>(null);\n\nexport const JourneyProvider: FC<IJourneyProviderProps> = ({ children, appId, userId }) => {\n const [isJourneyBlurred, setIsJourneyBlurred] = useState<boolean>(false);\n const [userCompletedJourneyIds, setUserCompletedJourneyIds] = useState<TJourneyId[] | null>(null);\n const [coachmarkList, setCoachmarkList] = useState<ICoachmarkProps[]>([]);\n const [isJourneyActive, setIsJourneyActive] = useState(false);\n const currentIndex = useRef(-1);\n const currentJourneyId = useRef<TJourneyId | undefined>();\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const { post: postJourneyCompletion } = usePostUserJourney();\n const { data: userCompletedJourneys = null, get: getJourneyProgress } = useGetUserJourney();\n\n const setJourney = useCallback(\n (id: TJourneyId, coachmarks: ICoachmarkProps[], shouldBlueInitialJourney?: boolean) => {\n if (coachmarkList.length > 0) {\n console.error(\n `setJourney: Other Journey is already active, Current Journey: ${currentJourneyId.current}, New Journey Request: ${id}`,\n );\n\n return;\n }\n setIsJourneyActive(true);\n currentJourneyId.current = id;\n currentIndex.current = -1;\n setCoachmarkList([...coachmarks]);\n setIsJourneyBlurred(!!shouldBlueInitialJourney);\n },\n [coachmarkList.length],\n );\n\n const clearJourney = useCallback(() => {\n // Clear all timers\n timerRefs.current.forEach(timer => {\n clearTimeout(timer);\n });\n timerRefs.current = [];\n currentJourneyId.current = undefined;\n currentIndex.current = -1;\n setCoachmarkList([]);\n setIsJourneyActive(false);\n }, []);\n\n const endJourney = useCallback(\n (journeyId: TJourneyId) => {\n clearJourney();\n setUserCompletedJourneyIds(prev => {\n if (prev && !prev.includes(journeyId)) {\n return [...prev, journeyId];\n }\n\n return prev;\n });\n // fire the API (doesn’t block the UI)\n postJourneyCompletion({\n app_id: appId,\n user_id: userId,\n journey_id: journeyId,\n journey_status: 'COMPLETED',\n });\n },\n [appId, clearJourney, postJourneyCompletion, userId],\n );\n\n const addCoachmark = useCallback((id: TJourneyId, coachmark: ICoachmarkProps) => {\n if (!currentJourneyId.current || id !== currentJourneyId.current) {\n console.error(\n currentJourneyId.current\n ? `A Journey is already active, Current Journey: ${currentJourneyId.current}, New Journey Request: ${id}`\n : `addCoachmark was called before setJourney and Journey ID is undefined`,\n );\n\n return;\n }\n\n setCoachmarkList(prev => [...prev, coachmark]);\n }, []);\n\n const nextCoachmark = useCallback(\n (\n id: TJourneyId,\n keepPrevActive: boolean = false,\n delayInMs: number = 0,\n shouldBlurNextJourney: boolean = false,\n ) => {\n if (!currentJourneyId.current || id !== currentJourneyId.current) {\n console.error(\n currentJourneyId.current\n ? `nextCoachmark was called before setJourney`\n : `A Journey is already active, Current Journey: ${currentJourneyId.current}, New Journey Request: ${id}`,\n );\n\n return;\n }\n\n setIsJourneyBlurred(shouldBlurNextJourney);\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 clearJourney();\n\n return [];\n }\n\n currentIndex.current = currIndex;\n const updatedCoachmarkList = [...prevList];\n\n (updatedCoachmarkList[currIndex] as ICoachmarkProps).isActive = true;\n\n if (currIndex > 0) {\n (updatedCoachmarkList[currIndex - 1] as ICoachmarkProps).isActive = keepPrevActive;\n }\n\n return updatedCoachmarkList;\n });\n }, delayInMs);\n\n timerRefs.current.push(timer);\n },\n [clearJourney],\n );\n\n const memoizedContextValue: IJourneyContext = useMemo(\n () => ({\n nextCoachmark,\n setJourney,\n addCoachmark,\n clearJourney,\n endJourney,\n coachmarks: coachmarkList,\n userCompletedJourneyIds,\n isJourneyActive,\n }),\n [\n nextCoachmark,\n setJourney,\n addCoachmark,\n clearJourney,\n endJourney,\n coachmarkList,\n userCompletedJourneyIds,\n isJourneyActive,\n ],\n );\n\n // Get the initial state of incompleteJourneys\n useEffect(() => {\n if (appId && userId) {\n getJourneyProgress(userId, {\n app_id: appId,\n user_id: userId,\n journey_status: 'COMPLETED',\n });\n }\n }, [appId, getJourneyProgress, userId]);\n\n // Set the data to context state initially\n useEffect(() => {\n if (userCompletedJourneys) {\n const completedUserJourneysIds = userCompletedJourneys.map(journey => journey.journey_id);\n\n setUserCompletedJourneyIds(completedUserJourneysIds);\n }\n }, [userCompletedJourneys]);\n\n return (\n <JourneyContext.Provider value={memoizedContextValue}>\n {isJourneyActive && (\n <S.Overlay\n about=\"journey-overlay\"\n isJourneyBlurred={isJourneyBlurred}\n data-testid={currentJourneyId.current}\n >\n {coachmarkList.map((coachmark, index) => (\n <Coachmark key={`coachmark-${index}`} coachmark={coachmark} />\n ))}\n </S.Overlay>\n )}\n {children}\n </JourneyContext.Provider>\n );\n};\n"],"names":["JourneyContext","createContext","JourneyProvider","children","appId","userId","isJourneyBlurred","setIsJourneyBlurred","useState","userCompletedJourneyIds","setUserCompletedJourneyIds","coachmarkList","setCoachmarkList","isJourneyActive","setIsJourneyActive","currentIndex","useRef","currentJourneyId","timerRefs","postJourneyCompletion","usePostUserJourney","userCompletedJourneys","getJourneyProgress","useGetUserJourney","setJourney","useCallback","id","coachmarks","shouldBlueInitialJourney","clearJourney","timer","endJourney","journeyId","prev","addCoachmark","coachmark","nextCoachmark","keepPrevActive","delayInMs","shouldBlurNextJourney","prevList","item","currIndex","updatedCoachmarkList","memoizedContextValue","useMemo","useEffect","completedUserJourneysIds","journey","jsxs","jsx","S.Overlay","index","Coachmark"],"mappings":";;;;;AAea,MAAAA,IAAiBC,EAAsC,IAAI,GAE3DC,IAA6C,CAAC,EAAE,UAAAC,GAAU,OAAAC,GAAO,QAAAC,QAAa;AACzF,QAAM,CAACC,GAAkBC,CAAmB,IAAIC,EAAkB,EAAK,GACjE,CAACC,GAAyBC,CAA0B,IAAIF,EAA8B,IAAI,GAC1F,CAACG,GAAeC,CAAgB,IAAIJ,EAA4B,CAAE,CAAA,GAClE,CAACK,GAAiBC,CAAkB,IAAIN,E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AAE;AAAA,MACA,YAAYpB;AAAA,MACZ,yBAAAF;AAAA,MACA,iBAAAI;AAAA,IAAA;AAAA,IAEF;AAAA,MACEuB;AAAA,MACAZ;AAAA,MACAU;AAAA,MACAL;AAAA,MACAE;AAAA,MACApB;AAAA,MACAF;AAAA,MACAI;AAAA,IACF;AAAA,EAAA;AAIF,SAAAiC,EAAU,MAAM;AACd,IAAI1C,KAASC,KACXiB,EAAmBjB,GAAQ;AAAA,MACzB,QAAQD;AAAA,MACR,SAASC;AAAA,MACT,gBAAgB;AAAA,IAAA,CACjB;AAAA,EAEF,GAAA,CAACD,GAAOkB,GAAoBjB,CAAM,CAAC,GAGtCyC,EAAU,MAAM;AACd,QAAIzB,GAAuB;AACzB,YAAM0B,IAA2B1B,EAAsB,IAAI,CAAA2B,MAAWA,EAAQ,UAAU;AAExF,MAAAtC,EAA2BqC,CAAwB;AAAA,IACrD;AAAA,EAAA,GACC,CAAC1B,CAAqB,CAAC,GAGvB,gBAAA4B,EAAAjD,EAAe,UAAf,EAAwB,OAAO4C,GAC7B,UAAA;AAAA,IACC/B,KAAA,gBAAAqC;AAAA,MAACC;AAAAA,MAAA;AAAA,QACC,OAAM;AAAA,QACN,kBAAA7C;AAAA,QACA,eAAaW,EAAiB;AAAA,QAE7B,UAAAN,EAAc,IAAI,CAACwB,GAAWiB,MAC5B,gBAAAF,EAAAG,GAAA,EAAqC,WAAAlB,EAAtB,GAAA,aAAaiB,CAAK,EAA0B,CAC7D;AAAA,MAAA;AAAA,IACH;AAAA,IAEDjD;AAAA,EACH,EAAA,CAAA;AAEJ;"}
1
+ {"version":3,"file":"journey-context-provider.js","sources":["../../../../src/features/journey/use-journey/journey-context-provider.tsx"],"sourcesContent":["/* eslint-disable no-console */\nimport type { TJourneyId } from '../journey-id/journey-id-types';\nimport type {\n ICoachmarkProps,\n IJourneyContext,\n IJourneyProviderProps,\n} from './journey-context-types';\nimport type { FC } from 'react';\n\nimport { createContext, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { Coachmark } from '../comps/coachmark/coachmark';\nimport { useGetUserJourney, usePostUserJourney } from '../user-journey-api/user-journey-api';\nimport * as S from './journey-styled';\n\nexport const JourneyContext = createContext<IJourneyContext | null>(null);\n\nexport const JourneyProvider: FC<IJourneyProviderProps> = ({ children, appId, userId }) => {\n const [isJourneyBlurred, setIsJourneyBlurred] = useState<boolean>(false);\n const [userCompletedJourneyIds, setUserCompletedJourneyIds] = useState<TJourneyId[] | null>(null);\n const [coachmarkList, setCoachmarkList] = useState<ICoachmarkProps[]>([]);\n const [isJourneyActive, setIsJourneyActive] = useState(false);\n const currentIndex = useRef(-1);\n const currentJourneyId = useRef<TJourneyId | undefined>();\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const { post: postJourneyCompletion } = usePostUserJourney();\n const { data: userCompletedJourneys = null, get: getJourneyProgress } = useGetUserJourney();\n\n const setJourney = useCallback(\n (id: TJourneyId, coachmarks: ICoachmarkProps[]) => {\n if (coachmarkList.length > 0) {\n console.error(\n `setJourney: Other Journey is already active, Current Journey: ${currentJourneyId.current}, New Journey Request: ${id}`,\n );\n\n return;\n }\n setIsJourneyActive(true);\n currentJourneyId.current = id;\n currentIndex.current = -1;\n setCoachmarkList([...coachmarks]);\n },\n [coachmarkList.length],\n );\n\n const clearJourney = useCallback(() => {\n // Clear all timers\n timerRefs.current.forEach(timer => {\n clearTimeout(timer);\n });\n timerRefs.current = [];\n currentJourneyId.current = undefined;\n currentIndex.current = -1;\n setCoachmarkList([]);\n setIsJourneyActive(false);\n }, []);\n\n const endJourney = useCallback(\n (journeyId: TJourneyId) => {\n clearJourney();\n setUserCompletedJourneyIds(prev => {\n if (prev && !prev.includes(journeyId)) {\n return [...prev, journeyId];\n }\n\n return prev;\n });\n // fire the API (doesn’t block the UI)\n postJourneyCompletion({\n app_id: appId,\n user_id: userId,\n journey_id: journeyId,\n journey_status: 'COMPLETED',\n });\n },\n [appId, clearJourney, postJourneyCompletion, userId],\n );\n\n const addCoachmark = useCallback((id: TJourneyId, coachmark: ICoachmarkProps) => {\n if (!currentJourneyId.current || id !== currentJourneyId.current) {\n console.error(\n currentJourneyId.current\n ? `A Journey is already active, Current Journey: ${currentJourneyId.current}, New Journey Request: ${id}`\n : `addCoachmark was called before setJourney and Journey ID is undefined`,\n );\n\n return;\n }\n\n setCoachmarkList(prev => [...prev, coachmark]);\n }, []);\n\n const nextCoachmark = useCallback(\n (\n id: TJourneyId,\n keepPrevActive: boolean = false,\n delayInMs: number = 0,\n shouldBlurNextJourney: boolean = false,\n ) => {\n if (!currentJourneyId.current || id !== currentJourneyId.current) {\n console.error(\n currentJourneyId.current\n ? `nextCoachmark was called before setJourney`\n : `A Journey is already active, Current Journey: ${currentJourneyId.current}, New Journey Request: ${id}`,\n );\n\n return;\n }\n\n setIsJourneyBlurred(shouldBlurNextJourney);\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 clearJourney();\n\n return [];\n }\n\n currentIndex.current = currIndex;\n const updatedCoachmarkList = [...prevList];\n\n (updatedCoachmarkList[currIndex] as ICoachmarkProps).isActive = true;\n\n if (currIndex > 0) {\n (updatedCoachmarkList[currIndex - 1] as ICoachmarkProps).isActive = keepPrevActive;\n }\n\n return updatedCoachmarkList;\n });\n }, delayInMs);\n\n timerRefs.current.push(timer);\n },\n [clearJourney],\n );\n\n const memoizedContextValue: IJourneyContext = useMemo(\n () => ({\n nextCoachmark,\n setJourney,\n addCoachmark,\n clearJourney,\n endJourney,\n coachmarks: coachmarkList,\n userCompletedJourneyIds,\n isJourneyActive,\n }),\n [\n nextCoachmark,\n setJourney,\n addCoachmark,\n clearJourney,\n endJourney,\n coachmarkList,\n userCompletedJourneyIds,\n isJourneyActive,\n ],\n );\n\n // Get the initial state of incompleteJourneys\n useEffect(() => {\n if (appId && userId) {\n getJourneyProgress(userId, {\n app_id: appId,\n user_id: userId,\n journey_status: 'COMPLETED',\n });\n }\n }, [appId, getJourneyProgress, userId]);\n\n // Set the data to context state initially\n useEffect(() => {\n if (userCompletedJourneys) {\n const completedUserJourneysIds = userCompletedJourneys.map(journey => journey.journey_id);\n\n setUserCompletedJourneyIds(completedUserJourneysIds);\n }\n }, [userCompletedJourneys]);\n\n return (\n <JourneyContext.Provider value={memoizedContextValue}>\n {isJourneyActive && (\n <S.Overlay\n about=\"journey-overlay\"\n isJourneyBlurred={isJourneyBlurred}\n data-testid={currentJourneyId.current}\n >\n {coachmarkList.map((coachmark, index) => (\n <Coachmark key={`coachmark-${index}`} coachmark={coachmark} />\n ))}\n </S.Overlay>\n )}\n {children}\n </JourneyContext.Provider>\n );\n};\n"],"names":["JourneyContext","createContext","JourneyProvider","children","appId","userId","isJourneyBlurred","setIsJourneyBlurred","useState","userCompletedJourneyIds","setUserCompletedJourneyIds","coachmarkList","setCoachmarkList","isJourneyActive","setIsJourneyActive","currentIndex","useRef","currentJourneyId","timerRefs","postJourneyCompletion","usePostUserJourney","userCompletedJourneys","getJourneyProgress","useGetUserJourney","setJourney","useCallback","id","coachmarks","clearJourney","timer","endJourney","journeyId","prev","addCoachmark","coachmark","nextCoachmark","keepPrevActive","delayInMs","shouldBlurNextJourney","prevList","item","currIndex","updatedCoachmarkList","memoizedContextValue","useMemo","useEffect","completedUserJourneysIds","journey","jsxs","jsx","S.Overlay","index","Coachmark"],"mappings":";;;;;AAea,MAAAA,IAAiBC,EAAsC,IAAI,GAE3DC,IAA6C,CAAC,EAAE,UAAAC,GAAU,OAAAC,GAAO,QAAAC,QAAa;AACzF,QAAM,CAACC,GAAkBC,CAAmB,IAAIC,EAAkB,EAAK,GACjE,CAACC,GAAyBC,CAA0B,IAAIF,EAA8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YAAAX;AAAA,MACA,cAAAS;AAAA,MACA,cAAAL;AAAA,MACA,YAAAE;AAAA,MACA,YAAYnB;AAAA,MACZ,yBAAAF;AAAA,MACA,iBAAAI;AAAA,IAAA;AAAA,IAEF;AAAA,MACEsB;AAAA,MACAX;AAAA,MACAS;AAAA,MACAL;AAAA,MACAE;AAAA,MACAnB;AAAA,MACAF;AAAA,MACAI;AAAA,IACF;AAAA,EAAA;AAIF,SAAAgC,EAAU,MAAM;AACd,IAAIzC,KAASC,KACXiB,EAAmBjB,GAAQ;AAAA,MACzB,QAAQD;AAAA,MACR,SAASC;AAAA,MACT,gBAAgB;AAAA,IAAA,CACjB;AAAA,EAEF,GAAA,CAACD,GAAOkB,GAAoBjB,CAAM,CAAC,GAGtCwC,EAAU,MAAM;AACd,QAAIxB,GAAuB;AACzB,YAAMyB,IAA2BzB,EAAsB,IAAI,CAAA0B,MAAWA,EAAQ,UAAU;AAExF,MAAArC,EAA2BoC,CAAwB;AAAA,IACrD;AAAA,EAAA,GACC,CAACzB,CAAqB,CAAC,GAGvB,gBAAA2B,EAAAhD,EAAe,UAAf,EAAwB,OAAO2C,GAC7B,UAAA;AAAA,IACC9B,KAAA,gBAAAoC;AAAA,MAACC;AAAAA,MAAA;AAAA,QACC,OAAM;AAAA,QACN,kBAAA5C;AAAA,QACA,eAAaW,EAAiB;AAAA,QAE7B,UAAAN,EAAc,IAAI,CAACuB,GAAWiB,MAC5B,gBAAAF,EAAAG,GAAA,EAAqC,WAAAlB,EAAtB,GAAA,aAAaiB,CAAK,EAA0B,CAC7D;AAAA,MAAA;AAAA,IACH;AAAA,IAEDhD;AAAA,EACH,EAAA,CAAA;AAEJ;"}
@@ -1,38 +1,38 @@
1
- import { jsx as a, jsxs as u, Fragment as Ee } from "react/jsx-runtime";
2
- import { h as ae } from "../../../node_modules/humanize-plus/dist/humanize.js";
3
- import { memo as le, useMemo as Se, useState as O, useCallback as Te, useEffect as p } from "react";
4
- import { ILLUSTRATIONS as me } from "../../../assets/illustrations/illustrations.js";
1
+ import { jsx as E, jsxs as u, Fragment as ae } from "react/jsx-runtime";
2
+ import { h as Ee } from "../../../node_modules/humanize-plus/dist/humanize.js";
3
+ import { memo as le, useMemo as Se, useState as R, useCallback as me, useEffect as p } from "react";
4
+ import { ILLUSTRATIONS as ce } from "../../../assets/illustrations/illustrations.js";
5
5
  import { EVENTS as e } from "../../communication/pub-sub/constants.js";
6
- import { useInClassActionListener as ce } from "../../communication/pub-sub/hooks.js";
6
+ import { useInClassActionListener as Te } from "../../communication/pub-sub/hooks.js";
7
7
  import { invalidateHomeworks as f } from "../../homework/hw-card-list/api/get-homeworks.js";
8
8
  import de from "../../ui/separator/separator.js";
9
9
  import { invalidateMilestoneResources as Ae } from "./api/get-milestone-resources.js";
10
10
  import { useGetAllMilestonesdata as _e, invalidateMilestonesData as Ne } from "./api/get-milestones.js";
11
11
  import { invalidateTestHelpData as De } from "./api/get-tests-list.js";
12
- import Ie from "./filter-milestones.js";
13
- import Me from "./milestone-list/milestone-list.js";
12
+ import Me from "./filter-milestones.js";
13
+ import Ie from "./milestone-list/milestone-list.js";
14
14
  import Le from "./milestone-list/milestone-loader/milestone-loader.js";
15
- import { ContentWrapper as Ce, LoaderWrapper as Re } from "./styled.js";
16
- const ue = (A) => {
17
- Ne(A);
18
- }, Oe = le(
19
- ({ studentName: A, studentId: l, studentClassroomId: h, ...v }) => {
15
+ import { ContentWrapper as Ce, LoaderWrapper as Oe } from "./styled.js";
16
+ const ue = (d) => {
17
+ Ne(d);
18
+ }, Re = le(
19
+ ({ studentName: d, studentId: l, studentClassroomId: h, ...P }) => {
20
20
  const {
21
- milestoneType: o,
22
- isStudentPresent: m,
23
- isClassOngoing: P,
24
- userType: _,
25
- canCreatePlan: U,
26
- teacherName: G,
21
+ milestoneType: s,
22
+ isStudentPresent: N,
23
+ isClassOngoing: v,
24
+ userType: A,
25
+ canCreatePlan: G,
26
+ teacherName: U,
27
27
  parentName: g,
28
- courseStream: N,
29
- activeMilestoneId: V,
30
- activeTabId: F,
31
- onExpandPastMilestones: w,
32
- onAddOutcome: H,
33
- onChapterClick: x,
28
+ courseStream: _,
29
+ activeMilestoneId: F,
30
+ activeTabId: w,
31
+ onExpandPastMilestones: V,
32
+ onAddOutcome: x,
33
+ onChapterClick: b,
34
34
  onEdit: y,
35
- onCreateMilestoneTest: b,
35
+ onCreateMilestoneTest: H,
36
36
  onDraftPublish: k,
37
37
  onAddChapter: K,
38
38
  onCreatePlan: W,
@@ -42,39 +42,39 @@ const ue = (A) => {
42
42
  onNodeView: q,
43
43
  onNodeReview: z,
44
44
  onNodeReattempt: B,
45
- onNodeReset: Y,
46
- onNodeUnassign: J,
47
- onTestPreview: Q,
45
+ onNodeReset: J,
46
+ onNodeUnassign: Q,
47
+ onTestPreview: Y,
48
48
  onTestReview: Z,
49
49
  onTestStart: ee,
50
50
  onWidgetTabSelection: te
51
- } = v, r = Se(
51
+ } = P, n = Se(
52
52
  () => ({
53
- milestone_state_group: o === "ACTIVE" ? _ === "TEACHER" ? "LIVE" : "STUDENT_LIVE" : o,
54
- course_stream: N,
53
+ milestone_state_group: s === "ACTIVE" ? A === "TEACHER" ? "LIVE" : "STUDENT_LIVE" : s,
54
+ course_stream: _,
55
55
  student_id: l
56
56
  }),
57
- [o, N, l, _]
57
+ [s, _, l, A]
58
58
  ), {
59
- data: s,
60
- getAll: c,
59
+ data: o,
60
+ getAll: m,
61
61
  isStale: D,
62
62
  isProcessing: S
63
- } = _e(r), [I, M] = O(), [L, C] = O(!1), oe = Te(
64
- (T) => {
65
- const { searchText: n, selectedBoard: i, selectedGrade: E } = T || {};
66
- (n || i || E) && C(!0);
67
- const d = s == null ? void 0 : s.filter((t) => {
63
+ } = _e(n), [M, I] = R(), [L, C] = R(!1), oe = me(
64
+ (c) => {
65
+ const { searchText: i, selectedBoard: r, selectedGrade: a } = c || {};
66
+ (i || r || a) && C(!0);
67
+ const T = o == null ? void 0 : o.filter((t) => {
68
68
  const { milestone_name: ne, board: ie, grade: re } = t || {};
69
- return (n ? ne.toLowerCase().includes(n.toLowerCase()) : !0) && (i ? ie === i : !0) && (E ? re === E : !0);
69
+ return (i ? ne.toLowerCase().includes(i.toLowerCase()) : !0) && (r ? ie === r : !0) && (a ? re === a : !0);
70
70
  });
71
- M(d);
71
+ I(T);
72
72
  },
73
- [s]
73
+ [o]
74
74
  ), se = () => {
75
- C(!1), M(void 0);
75
+ C(!1), I(void 0);
76
76
  };
77
- if (ce(
77
+ if (Te(
78
78
  {
79
79
  studentClassroomId: h,
80
80
  actions: [
@@ -99,94 +99,89 @@ const ue = (A) => {
99
99
  [e.PAST_MILESTONE_OUTCOME_ADDED],
100
100
  [e.MILESTONE_TEST_ASSIGNED]
101
101
  ],
102
- callback: (T) => {
103
- var E, d;
104
- const n = (E = T.find(
105
- (t) => t.eventName === e.MILESTONE_RESOURCE_ASSIGNED || t.eventName === e.MILESTONE_RESOURCE_UNASSIGNED || t.eventName === e.SHEET_STARTED
106
- )) == null ? void 0 : E.eventPayload, i = (d = T.find(
107
- (t) => t.eventName === e.MILESTONE_TEST_ASSIGNED || t.eventName === e.SHEET_STARTED
108
- )) == null ? void 0 : d.eventPayload;
109
- if (console.log(i, n, T, "aYUSH"), n) {
110
- const { milestoneId: t } = n || {};
102
+ callback: (c) => {
103
+ var a, T;
104
+ const i = (a = c.find(
105
+ (t) => t.eventName === e.MILESTONE_RESOURCE_ASSIGNED || t.eventName === e.MILESTONE_RESOURCE_UNASSIGNED
106
+ )) == null ? void 0 : a.eventPayload, r = (T = c.find(
107
+ (t) => t.eventName === e.MILESTONE_TEST_ASSIGNED
108
+ )) == null ? void 0 : T.eventPayload;
109
+ if (i) {
110
+ const { milestoneId: t } = i || {};
111
111
  f(l), Ae(t);
112
112
  }
113
- if (i) {
114
- const { milestoneId: t } = i;
113
+ if (r) {
114
+ const { milestoneId: t } = r;
115
115
  f(l), De(t);
116
116
  }
117
- ue(r);
117
+ ue(n);
118
118
  }
119
119
  },
120
- (o === "ACTIVE" || o === "INACTIVE") && m
121
- ), console.log(
122
- (o === "ACTIVE" || o === "INACTIVE") && m,
123
- o,
124
- m,
125
- "ayush"
120
+ (s === "ACTIVE" || s === "INACTIVE") && N
126
121
  ), p(() => {
127
- c(r);
128
- }, [c, r]), p(() => {
129
- !S && D && c(r);
130
- }, [c, r, D, S]), S && !s)
131
- return /* @__PURE__ */ a(Le, { numMilestones: 2 });
132
- const R = o === "ACTIVE" && s && s.length > 6;
122
+ m(n);
123
+ }, [m, n]), p(() => {
124
+ !S && D && m(n);
125
+ }, [m, n, D, S]), S && !o)
126
+ return /* @__PURE__ */ E(Le, { numMilestones: 2 });
127
+ const O = s === "ACTIVE" && o && o.length > 6;
133
128
  return /* @__PURE__ */ u(Ce, { $disablePointerEvents: S, children: [
134
- S && /* @__PURE__ */ a(Re, { children: /* @__PURE__ */ a("img", { src: me.LOADER_1, alt: "loading" }) }),
135
- R && /* @__PURE__ */ u(Ee, { children: [
136
- /* @__PURE__ */ a(
137
- Ie,
129
+ S && /* @__PURE__ */ E(Oe, { children: /* @__PURE__ */ E("img", { src: ce.LOADER_1, alt: "loading" }) }),
130
+ O && /* @__PURE__ */ u(ae, { children: [
131
+ /* @__PURE__ */ E(
132
+ Me,
138
133
  {
139
- filteredMilestones: I,
140
- milestones: s,
134
+ filteredMilestones: M,
135
+ milestones: o,
141
136
  handleFilterMilestones: oe,
142
137
  handleClearFilter: se
143
138
  }
144
139
  ),
145
- /* @__PURE__ */ a(de, { heightX: 1.5 })
140
+ /* @__PURE__ */ E(de, { heightX: 1.5 })
146
141
  ] }),
147
- /* @__PURE__ */ a(
148
- Me,
142
+ /* @__PURE__ */ E(
143
+ Ie,
149
144
  {
150
- showFilters: !!R,
151
- canCreatePlan: U,
152
- isClassOngoing: P,
145
+ showFilters: !!O,
146
+ canCreatePlan: G,
147
+ isClassOngoing: v,
153
148
  isFiltersAdded: L,
154
- isStudentPresent: m,
155
- milestoneType: o,
156
- milestones: L ? I : s,
149
+ isStudentPresent: N,
150
+ milestoneType: s,
151
+ milestones: L ? M : o,
157
152
  onAddChapter: K,
158
- onAddOutcome: H,
159
- onChapterClick: x,
153
+ onAddOutcome: x,
154
+ onChapterClick: b,
160
155
  onCreatePlan: W,
161
156
  onDelete: j,
162
157
  onDraftPublish: k,
163
158
  onEdit: y,
164
- onExpandPastMilestones: w,
165
- onCreateMilestoneTest: b,
159
+ onExpandPastMilestones: V,
160
+ onCreateMilestoneTest: H,
166
161
  onAssignResources: X,
167
- onTestPreview: Q,
162
+ onTestPreview: Y,
168
163
  onTestReview: Z,
169
164
  onTestStart: ee,
170
165
  onNodeAttempt: $,
171
166
  onNodeView: q,
172
167
  onNodeReview: z,
173
168
  onNodeReattempt: B,
174
- onNodeReset: Y,
175
- onNodeUnassign: J,
176
- activeMilestoneId: V,
177
- activeTabId: F,
169
+ onNodeReset: J,
170
+ onNodeUnassign: Q,
171
+ activeMilestoneId: F,
172
+ activeTabId: w,
178
173
  onWidgetTabSelection: te,
179
174
  studentId: l,
180
- studentName: ae.titleCase(A),
181
- teacherName: G,
175
+ studentName: Ee.titleCase(d),
176
+ teacherName: U,
182
177
  parentName: g,
183
- userType: _,
184
- courseStream: N
178
+ userType: A,
179
+ courseStream: _
185
180
  }
186
181
  )
187
182
  ] });
188
183
  }
189
- ), je = Oe;
184
+ ), je = Re;
190
185
  export {
191
186
  je as default
192
187
  };
@@ -1 +1 @@
1
- {"version":3,"file":"milestone-list-container.js","sources":["../../../../src/features/milestone/milestone-list-container/milestone-list-container.tsx"],"sourcesContent":["import type {\n IMilestoneContainerProps,\n IMilestoneListQueryParams,\n} from './milestone-list-container-types';\nimport type { IMilestoneData } from './milestone-list/milestone-list-types';\n\nimport { titleCase } from 'humanize-plus';\nimport React, { memo, useCallback, useEffect, useMemo, useState } from 'react';\n\nimport { ILLUSTRATIONS } from '../../../assets/illustrations/illustrations';\nimport { EVENTS } from '../../communication/pub-sub/constants';\nimport { useInClassActionListener } from '../../communication/pub-sub/hooks';\nimport { invalidateHomeworks } from '../../homework/hw-card-list/api/get-homeworks';\nimport Separator from '../../ui/separator/separator';\nimport { invalidateMilestoneResources } from './api/get-milestone-resources';\nimport { useGetAllMilestonesdata, invalidateMilestonesData } from './api/get-milestones';\nimport { invalidateTestHelpData } from './api/get-tests-list';\nimport FilterMilestones from './filter-milestones';\nimport MilestoneList from './milestone-list/milestone-list';\nimport MilestoneLoader from './milestone-list/milestone-loader/milestone-loader';\nimport * as Styled from './styled';\n\nconst invalidateAllMilestones = (queryParams: IMilestoneListQueryParams) => {\n invalidateMilestonesData(queryParams);\n};\n\nconst MilestoneListContainer: React.FC<IMilestoneContainerProps> = memo(\n ({ studentName, studentId, studentClassroomId, ...restMilestoneListContainerProps }) => {\n const {\n milestoneType,\n isStudentPresent,\n isClassOngoing,\n userType,\n canCreatePlan,\n teacherName,\n parentName,\n courseStream,\n activeMilestoneId,\n activeTabId,\n onExpandPastMilestones,\n onAddOutcome,\n onChapterClick,\n onEdit,\n onCreateMilestoneTest,\n onDraftPublish,\n onAddChapter,\n onCreatePlan,\n onDelete,\n onAssignResources,\n onNodeAttempt,\n onNodeView,\n onNodeReview,\n onNodeReattempt,\n onNodeReset,\n onNodeUnassign,\n onTestPreview,\n onTestReview,\n onTestStart,\n onWidgetTabSelection,\n } = restMilestoneListContainerProps;\n\n const queryParams: IMilestoneListQueryParams = useMemo(\n () =>\n ({\n milestone_state_group:\n milestoneType === 'ACTIVE'\n ? userType === 'TEACHER'\n ? 'LIVE'\n : 'STUDENT_LIVE'\n : milestoneType,\n course_stream: courseStream,\n student_id: studentId,\n }) as const,\n [milestoneType, courseStream, studentId, userType],\n );\n\n const {\n data: milestoneData,\n getAll: getMilestoneData,\n isStale: isMilestoneDataStale,\n isProcessing: isMilestoneProcessing,\n } = useGetAllMilestonesdata(queryParams);\n\n const [filteredMilestones, setFilteredMilestones] = useState<IMilestoneData[] | undefined>();\n const [isFiltersAdded, setIsFiltersAdded] = useState<boolean>(false);\n\n const handleFilterMilestones = useCallback(\n (data: { searchText?: string; selectedBoard?: string; selectedGrade?: string }) => {\n const { searchText, selectedBoard, selectedGrade } = data || {};\n\n if (searchText || selectedBoard || selectedGrade) {\n setIsFiltersAdded(true);\n }\n\n const filteredData = milestoneData?.filter(item => {\n const { milestone_name: milestoneName, board, grade } = item || {};\n const matchesSearchText = searchText\n ? milestoneName.toLowerCase().includes(searchText.toLowerCase())\n : true;\n const matchesCurriculum = selectedBoard ? board === selectedBoard : true;\n const matchesGrade = selectedGrade ? grade === selectedGrade : true;\n\n return matchesSearchText && matchesCurriculum && matchesGrade;\n });\n\n setFilteredMilestones(filteredData);\n },\n [milestoneData],\n );\n\n const handleClearFilter = () => {\n setIsFiltersAdded(false);\n setFilteredMilestones(undefined);\n };\n\n useInClassActionListener(\n {\n studentClassroomId,\n actions: [\n [EVENTS.CHAPTER_UPDATED],\n [EVENTS.LESSONS_MARKED_AS_FAMILIAR],\n [EVENTS.LESSONS_MARKED_AS_IRRELEVANT],\n [EVENTS.LESSONS_PROGRESS_RESET],\n [EVENTS.UNLOCK_SHEETS],\n [EVENTS.EXTRA_PRACTICE_ASSIGNED],\n [EVENTS.MILESTONE_DATE_UPDATED],\n [EVENTS.MILESTONE_DELETED],\n [EVENTS.MILESTONE_NAME_UPDATED],\n [EVENTS.MILESTONE_EDITED],\n [EVENTS.MILESTONE_RESOURCE_ASSIGNED],\n [EVENTS.MILESTONE_RESOURCE_UNASSIGNED],\n [EVENTS.MILESTONE_RESOURCE_RESET],\n [EVENTS.SHEET_UNASSIGNED],\n [EVENTS.GOAL_CREATED],\n [EVENTS.GOAL_EDITED],\n [EVENTS.GOAL_DELETED],\n [EVENTS.GOAL_OUTCOME_ADDED],\n [EVENTS.PAST_MILESTONE_OUTCOME_ADDED],\n [EVENTS.MILESTONE_TEST_ASSIGNED],\n ],\n callback: messages => {\n const milestoneResourceEventPayload = messages.find(\n message =>\n message.eventName === EVENTS.MILESTONE_RESOURCE_ASSIGNED ||\n message.eventName === EVENTS.MILESTONE_RESOURCE_UNASSIGNED ||\n message.eventName === EVENTS.SHEET_STARTED,\n )?.eventPayload;\n const milestoneTestEventPayload = messages.find(\n message =>\n message.eventName === EVENTS.MILESTONE_TEST_ASSIGNED ||\n message.eventName === EVENTS.SHEET_STARTED,\n )?.eventPayload;\n\n console.log(milestoneTestEventPayload, milestoneResourceEventPayload, messages, 'aYUSH');\n\n if (milestoneResourceEventPayload) {\n const { milestoneId: resourceMilestoneId } =\n (milestoneResourceEventPayload as { milestoneId: string }) || {};\n\n invalidateHomeworks(studentId);\n invalidateMilestoneResources(resourceMilestoneId);\n }\n\n if (milestoneTestEventPayload) {\n const { milestoneId } = milestoneTestEventPayload as { milestoneId: string };\n\n invalidateHomeworks(studentId);\n invalidateTestHelpData(milestoneId);\n }\n\n invalidateAllMilestones(queryParams);\n },\n },\n (milestoneType === 'ACTIVE' || milestoneType === 'INACTIVE') && isStudentPresent,\n );\n console.log(\n (milestoneType === 'ACTIVE' || milestoneType === 'INACTIVE') && isStudentPresent,\n milestoneType,\n isStudentPresent,\n 'ayush',\n );\n useEffect(() => {\n getMilestoneData(queryParams);\n }, [getMilestoneData, queryParams]);\n\n useEffect(() => {\n if (!isMilestoneProcessing && isMilestoneDataStale) {\n getMilestoneData(queryParams);\n }\n }, [getMilestoneData, queryParams, isMilestoneDataStale, isMilestoneProcessing]);\n\n if (isMilestoneProcessing && !milestoneData) {\n return <MilestoneLoader numMilestones={2} />;\n }\n\n const showFilters = milestoneType === 'ACTIVE' && milestoneData && milestoneData.length > 6;\n\n return (\n <Styled.ContentWrapper $disablePointerEvents={isMilestoneProcessing}>\n {isMilestoneProcessing && (\n <Styled.LoaderWrapper>\n <img src={ILLUSTRATIONS.LOADER_1} alt=\"loading\" />\n </Styled.LoaderWrapper>\n )}\n {showFilters && (\n <>\n <FilterMilestones\n filteredMilestones={filteredMilestones}\n milestones={milestoneData}\n handleFilterMilestones={handleFilterMilestones}\n handleClearFilter={handleClearFilter}\n />\n <Separator heightX={1.5} />\n </>\n )}\n\n <MilestoneList\n showFilters={!!showFilters}\n canCreatePlan={canCreatePlan}\n isClassOngoing={isClassOngoing}\n isFiltersAdded={isFiltersAdded}\n isStudentPresent={isStudentPresent}\n milestoneType={milestoneType}\n milestones={isFiltersAdded ? filteredMilestones : milestoneData}\n onAddChapter={onAddChapter}\n onAddOutcome={onAddOutcome}\n onChapterClick={onChapterClick}\n onCreatePlan={onCreatePlan}\n onDelete={onDelete}\n onDraftPublish={onDraftPublish}\n onEdit={onEdit}\n onExpandPastMilestones={onExpandPastMilestones}\n onCreateMilestoneTest={onCreateMilestoneTest}\n onAssignResources={onAssignResources}\n onTestPreview={onTestPreview}\n onTestReview={onTestReview}\n onTestStart={onTestStart}\n onNodeAttempt={onNodeAttempt}\n onNodeView={onNodeView}\n onNodeReview={onNodeReview}\n onNodeReattempt={onNodeReattempt}\n onNodeReset={onNodeReset}\n onNodeUnassign={onNodeUnassign}\n activeMilestoneId={activeMilestoneId}\n activeTabId={activeTabId}\n onWidgetTabSelection={onWidgetTabSelection}\n studentId={studentId}\n studentName={titleCase(studentName)}\n teacherName={teacherName}\n parentName={parentName}\n userType={userType}\n courseStream={courseStream}\n />\n </Styled.ContentWrapper>\n );\n },\n);\n\nexport default MilestoneListContainer;\n"],"names":["invalidateAllMilestones","queryParams","invalidateMilestonesData","MilestoneListContainer","memo","studentName","studentId","studentClassroomId","restMilestoneListContainerProps","milestoneType","isStudentPresent","isClassOngoing","userType","canCreatePlan","teacherName","parentName","courseStream","activeMilestoneId","activeTabId","onExpandPastMilestones","onAddOutcome","onChapterClick","onEdit","onCreateMilestoneTest","onDraftPublish","onAddChapter","onCreatePlan","onDelete","onAssignResources","onNodeAttempt","onNodeView","onNodeReview","onNodeReattempt","onNodeReset","onNodeUnassign","onTestPreview","onTestReview","onTestStart","onWidgetTabSelection","useMemo","milestoneData","getMilestoneData","isMilestoneDataStale","isMilestoneProcessing","useGetAllMilestonesdata","filteredMilestones","setFilteredMilestones","useState","isFiltersAdded","setIsFiltersAdded","handleFilterMilestones","useCallback","data","searchText","selectedBoard","selectedGrade","filteredData","item","milestoneName","board","grade","handleClearFilter","useInClassActionListener","EVENTS","messages","milestoneResourceEventPayload","_a","message","milestoneTestEventPayload","_b","resourceMilestoneId","invalidateHomeworks","invalidateMilestoneResources","milestoneId","invalidateTestHelpData","useEffect","jsx","MilestoneLoader","showFilters","jsxs","Styled.ContentWrapper","Styled.LoaderWrapper","ILLUSTRATIONS","Fragment","FilterMilestones","Separator","MilestoneList","titleCase"],"mappings":";;;;;;;;;;;;;;;AAsBA,MAAMA,KAA0B,CAACC,MAA2C;AAC1E,EAAAC,GAAyBD,CAAW;AACtC,GAEME,KAA6DC;AAAA,EACjE,CAAC,EAAE,aAAAC,GAAa,WAAAC,GAAW,oBAAAC,GAAoB,GAAGC,QAAsC;AAChF,UAAA;AAAA,MACJ,eAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,UAAAC;AAAA,MACA,eAAAC;AAAA,MACA,aAAAC;AAAA,MACA,YAAAC;AAAA,MACA,cAAAC;AAAA,MACA,mBAAAC;AAAA,MACA,aAAAC;AAAA,MACA,wBAAAC;AAAA,MACA,cAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,QAAAC;AAAA,MACA,uBAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,cAAAC;AAAA,MACA,cAAAC;AAAA,MACA,UAAAC;AAAA,MACA,mBAAAC;AAAA,MACA,eAAAC;AAAA,MACA,YAAAC;AAAA,MACA,cAAAC;AAAA,MACA,iBAAAC;AAAA,MACA,aAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,eAAAC;AAAA,MACA,cAAAC;AAAA,MACA,aAAAC;AAAA,MACA,sBAAAC;AAAA,IACE,IAAA9B,GAEEP,IAAyCsC;AAAA,MAC7C,OACG;AAAA,QACC,uBACE9B,MAAkB,WACdG,MAAa,YACX,SACA,iBACFH;AAAA,QACN,eAAeO;AAAA,QACf,YAAYV;AAAA,MAAA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AAK;AAAA,UACA,eAAAO;AAAA,UACA,cAAAC;AAAA,UACA,aAAAC;AAAA,UACA,eAAAR;AAAA,UACA,YAAAC;AAAA,UACA,cAAAC;AAAA,UACA,iBAAAC;AAAA,UACA,aAAAC;AAAA,UACA,gBAAAC;AAAA,UACA,mBAAAjB;AAAA,UACA,aAAAC;AAAA,UACA,sBAAAoB;AAAA,UACA,WAAAhC;AAAA,UACA,aAAaiF,aAAUlF,CAAW;AAAA,UAClC,aAAAS;AAAA,UACA,YAAAC;AAAA,UACA,UAAAH;AAAA,UACA,cAAAI;AAAA,QAAA;AAAA,MACF;AAAA,IACF,EAAA,CAAA;AAAA,EAEJ;AACF,GAEAsE,KAAenF;"}
1
+ {"version":3,"file":"milestone-list-container.js","sources":["../../../../src/features/milestone/milestone-list-container/milestone-list-container.tsx"],"sourcesContent":["import type {\n IMilestoneContainerProps,\n IMilestoneListQueryParams,\n} from './milestone-list-container-types';\nimport type { IMilestoneData } from './milestone-list/milestone-list-types';\n\nimport { titleCase } from 'humanize-plus';\nimport React, { memo, useCallback, useEffect, useMemo, useState } from 'react';\n\nimport { ILLUSTRATIONS } from '../../../assets/illustrations/illustrations';\nimport { EVENTS } from '../../communication/pub-sub/constants';\nimport { useInClassActionListener } from '../../communication/pub-sub/hooks';\nimport { invalidateHomeworks } from '../../homework/hw-card-list/api/get-homeworks';\nimport Separator from '../../ui/separator/separator';\nimport { invalidateMilestoneResources } from './api/get-milestone-resources';\nimport { useGetAllMilestonesdata, invalidateMilestonesData } from './api/get-milestones';\nimport { invalidateTestHelpData } from './api/get-tests-list';\nimport FilterMilestones from './filter-milestones';\nimport MilestoneList from './milestone-list/milestone-list';\nimport MilestoneLoader from './milestone-list/milestone-loader/milestone-loader';\nimport * as Styled from './styled';\n\nconst invalidateAllMilestones = (queryParams: IMilestoneListQueryParams) => {\n invalidateMilestonesData(queryParams);\n};\n\nconst MilestoneListContainer: React.FC<IMilestoneContainerProps> = memo(\n ({ studentName, studentId, studentClassroomId, ...restMilestoneListContainerProps }) => {\n const {\n milestoneType,\n isStudentPresent,\n isClassOngoing,\n userType,\n canCreatePlan,\n teacherName,\n parentName,\n courseStream,\n activeMilestoneId,\n activeTabId,\n onExpandPastMilestones,\n onAddOutcome,\n onChapterClick,\n onEdit,\n onCreateMilestoneTest,\n onDraftPublish,\n onAddChapter,\n onCreatePlan,\n onDelete,\n onAssignResources,\n onNodeAttempt,\n onNodeView,\n onNodeReview,\n onNodeReattempt,\n onNodeReset,\n onNodeUnassign,\n onTestPreview,\n onTestReview,\n onTestStart,\n onWidgetTabSelection,\n } = restMilestoneListContainerProps;\n\n const queryParams: IMilestoneListQueryParams = useMemo(\n () =>\n ({\n milestone_state_group:\n milestoneType === 'ACTIVE'\n ? userType === 'TEACHER'\n ? 'LIVE'\n : 'STUDENT_LIVE'\n : milestoneType,\n course_stream: courseStream,\n student_id: studentId,\n }) as const,\n [milestoneType, courseStream, studentId, userType],\n );\n\n const {\n data: milestoneData,\n getAll: getMilestoneData,\n isStale: isMilestoneDataStale,\n isProcessing: isMilestoneProcessing,\n } = useGetAllMilestonesdata(queryParams);\n\n const [filteredMilestones, setFilteredMilestones] = useState<IMilestoneData[] | undefined>();\n const [isFiltersAdded, setIsFiltersAdded] = useState<boolean>(false);\n\n const handleFilterMilestones = useCallback(\n (data: { searchText?: string; selectedBoard?: string; selectedGrade?: string }) => {\n const { searchText, selectedBoard, selectedGrade } = data || {};\n\n if (searchText || selectedBoard || selectedGrade) {\n setIsFiltersAdded(true);\n }\n\n const filteredData = milestoneData?.filter(item => {\n const { milestone_name: milestoneName, board, grade } = item || {};\n const matchesSearchText = searchText\n ? milestoneName.toLowerCase().includes(searchText.toLowerCase())\n : true;\n const matchesCurriculum = selectedBoard ? board === selectedBoard : true;\n const matchesGrade = selectedGrade ? grade === selectedGrade : true;\n\n return matchesSearchText && matchesCurriculum && matchesGrade;\n });\n\n setFilteredMilestones(filteredData);\n },\n [milestoneData],\n );\n\n const handleClearFilter = () => {\n setIsFiltersAdded(false);\n setFilteredMilestones(undefined);\n };\n\n useInClassActionListener(\n {\n studentClassroomId,\n actions: [\n [EVENTS.CHAPTER_UPDATED],\n [EVENTS.LESSONS_MARKED_AS_FAMILIAR],\n [EVENTS.LESSONS_MARKED_AS_IRRELEVANT],\n [EVENTS.LESSONS_PROGRESS_RESET],\n [EVENTS.UNLOCK_SHEETS],\n [EVENTS.EXTRA_PRACTICE_ASSIGNED],\n [EVENTS.MILESTONE_DATE_UPDATED],\n [EVENTS.MILESTONE_DELETED],\n [EVENTS.MILESTONE_NAME_UPDATED],\n [EVENTS.MILESTONE_EDITED],\n [EVENTS.MILESTONE_RESOURCE_ASSIGNED],\n [EVENTS.MILESTONE_RESOURCE_UNASSIGNED],\n [EVENTS.MILESTONE_RESOURCE_RESET],\n [EVENTS.SHEET_UNASSIGNED],\n [EVENTS.GOAL_CREATED],\n [EVENTS.GOAL_EDITED],\n [EVENTS.GOAL_DELETED],\n [EVENTS.GOAL_OUTCOME_ADDED],\n [EVENTS.PAST_MILESTONE_OUTCOME_ADDED],\n [EVENTS.MILESTONE_TEST_ASSIGNED],\n ],\n callback: messages => {\n const milestoneResourceEventPayload = messages.find(\n message =>\n message.eventName === EVENTS.MILESTONE_RESOURCE_ASSIGNED ||\n message.eventName === EVENTS.MILESTONE_RESOURCE_UNASSIGNED,\n )?.eventPayload;\n const milestoneTestEventPayload = messages.find(\n message => message.eventName === EVENTS.MILESTONE_TEST_ASSIGNED,\n )?.eventPayload;\n\n if (milestoneResourceEventPayload) {\n const { milestoneId: resourceMilestoneId } =\n (milestoneResourceEventPayload as { milestoneId: string }) || {};\n\n invalidateHomeworks(studentId);\n invalidateMilestoneResources(resourceMilestoneId);\n }\n\n if (milestoneTestEventPayload) {\n const { milestoneId } = milestoneTestEventPayload as { milestoneId: string };\n\n invalidateHomeworks(studentId);\n invalidateTestHelpData(milestoneId);\n }\n\n invalidateAllMilestones(queryParams);\n },\n },\n (milestoneType === 'ACTIVE' || milestoneType === 'INACTIVE') && isStudentPresent,\n );\n\n useEffect(() => {\n getMilestoneData(queryParams);\n }, [getMilestoneData, queryParams]);\n\n useEffect(() => {\n if (!isMilestoneProcessing && isMilestoneDataStale) {\n getMilestoneData(queryParams);\n }\n }, [getMilestoneData, queryParams, isMilestoneDataStale, isMilestoneProcessing]);\n\n if (isMilestoneProcessing && !milestoneData) {\n return <MilestoneLoader numMilestones={2} />;\n }\n\n const showFilters = milestoneType === 'ACTIVE' && milestoneData && milestoneData.length > 6;\n\n return (\n <Styled.ContentWrapper $disablePointerEvents={isMilestoneProcessing}>\n {isMilestoneProcessing && (\n <Styled.LoaderWrapper>\n <img src={ILLUSTRATIONS.LOADER_1} alt=\"loading\" />\n </Styled.LoaderWrapper>\n )}\n {showFilters && (\n <>\n <FilterMilestones\n filteredMilestones={filteredMilestones}\n milestones={milestoneData}\n handleFilterMilestones={handleFilterMilestones}\n handleClearFilter={handleClearFilter}\n />\n <Separator heightX={1.5} />\n </>\n )}\n\n <MilestoneList\n showFilters={!!showFilters}\n canCreatePlan={canCreatePlan}\n isClassOngoing={isClassOngoing}\n isFiltersAdded={isFiltersAdded}\n isStudentPresent={isStudentPresent}\n milestoneType={milestoneType}\n milestones={isFiltersAdded ? filteredMilestones : milestoneData}\n onAddChapter={onAddChapter}\n onAddOutcome={onAddOutcome}\n onChapterClick={onChapterClick}\n onCreatePlan={onCreatePlan}\n onDelete={onDelete}\n onDraftPublish={onDraftPublish}\n onEdit={onEdit}\n onExpandPastMilestones={onExpandPastMilestones}\n onCreateMilestoneTest={onCreateMilestoneTest}\n onAssignResources={onAssignResources}\n onTestPreview={onTestPreview}\n onTestReview={onTestReview}\n onTestStart={onTestStart}\n onNodeAttempt={onNodeAttempt}\n onNodeView={onNodeView}\n onNodeReview={onNodeReview}\n onNodeReattempt={onNodeReattempt}\n onNodeReset={onNodeReset}\n onNodeUnassign={onNodeUnassign}\n activeMilestoneId={activeMilestoneId}\n activeTabId={activeTabId}\n onWidgetTabSelection={onWidgetTabSelection}\n studentId={studentId}\n studentName={titleCase(studentName)}\n teacherName={teacherName}\n parentName={parentName}\n userType={userType}\n courseStream={courseStream}\n />\n </Styled.ContentWrapper>\n );\n },\n);\n\nexport default MilestoneListContainer;\n"],"names":["invalidateAllMilestones","queryParams","invalidateMilestonesData","MilestoneListContainer","memo","studentName","studentId","studentClassroomId","restMilestoneListContainerProps","milestoneType","isStudentPresent","isClassOngoing","userType","canCreatePlan","teacherName","parentName","courseStream","activeMilestoneId","activeTabId","onExpandPastMilestones","onAddOutcome","onChapterClick","onEdit","onCreateMilestoneTest","onDraftPublish","onAddChapter","onCreatePlan","onDelete","onAssignResources","onNodeAttempt","onNodeView","onNodeReview","onNodeReattempt","onNodeReset","onNodeUnassign","onTestPreview","onTestReview","onTestStart","onWidgetTabSelection","useMemo","milestoneData","getMilestoneData","isMilestoneDataStale","isMilestoneProcessing","useGetAllMilestonesdata","filteredMilestones","setFilteredMilestones","useState","isFiltersAdded","setIsFiltersAdded","handleFilterMilestones","useCallback","data","searchText","selectedBoard","selectedGrade","filteredData","item","milestoneName","board","grade","handleClearFilter","useInClassActionListener","EVENTS","messages","milestoneResourceEventPayload","_a","message","milestoneTestEventPayload","_b","resourceMilestoneId","invalidateHomeworks","invalidateMilestoneResources","milestoneId","invalidateTestHelpData","useEffect","jsx","MilestoneLoader","showFilters","jsxs","Styled.ContentWrapper","Styled.LoaderWrapper","ILLUSTRATIONS","Fragment","FilterMilestones","Separator","MilestoneList","titleCase"],"mappings":";;;;;;;;;;;;;;;AAsBA,MAAMA,KAA0B,CAACC,MAA2C;AAC1E,EAAAC,GAAyBD,CAAW;AACtC,GAEME,KAA6DC;AAAA,EACjE,CAAC,EAAE,aAAAC,GAAa,WAAAC,GAAW,oBAAAC,GAAoB,GAAGC,QAAsC;AAChF,UAAA;AAAA,MACJ,eAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,UAAAC;AAAA,MACA,eAAAC;AAAA,MACA,aAAAC;AA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,MAGF,gBAAAT;AAAA,QAACU;AAAAA,QAAA;AAAA,UACC,aAAa,CAAC,CAACR;AAAA,UACf,eAAAjE;AAAA,UACA,gBAAAF;AAAA,UACA,gBAAAqC;AAAA,UACA,kBAAAtC;AAAA,UACA,eAAAD;AAAA,UACA,YAAYuC,IAAiBH,IAAqBL;AAAA,UAClD,cAAAf;AAAA,UACA,cAAAL;AAAA,UACA,gBAAAC;AAAA,UACA,cAAAK;AAAA,UACA,UAAAC;AAAA,UACA,gBAAAH;AAAA,UACA,QAAAF;AAAA,UACA,wBAAAH;AAAA,UACA,uBAAAI;AAAA,UACA,mBAAAK;AAAA,UACA,eAAAO;AAAA,UACA,cAAAC;AAAA,UACA,aAAAC;AAAA,UACA,eAAAR;AAAA,UACA,YAAAC;AAAA,UACA,cAAAC;AAAA,UACA,iBAAAC;AAAA,UACA,aAAAC;AAAA,UACA,gBAAAC;AAAA,UACA,mBAAAjB;AAAA,UACA,aAAAC;AAAA,UACA,sBAAAoB;AAAA,UACA,WAAAhC;AAAA,UACA,aAAaiF,aAAUlF,CAAW;AAAA,UAClC,aAAAS;AAAA,UACA,YAAAC;AAAA,UACA,UAAAH;AAAA,UACA,cAAAI;AAAA,QAAA;AAAA,MACF;AAAA,IACF,EAAA,CAAA;AAAA,EAEJ;AACF,GAEAsE,KAAenF;"}
package/dist/index.d.ts CHANGED
@@ -813,6 +813,11 @@ declare interface IChapterDetails extends IBlockSectionsCallbacks {
813
813
  userChapterId: string;
814
814
  studentId: string;
815
815
  onExit?: () => void;
816
+ startChapterPageJourney?: ({ chapterDetails, studentId, userType, }: IHomepageStartJourneyProps_2) => void;
817
+ chapterPageRef?: React.RefObject<HTMLDivElement>;
818
+ bannerRef?: React.RefObject<HTMLDivElement>;
819
+ coreBlocksRef?: React.RefObject<HTMLDivElement>;
820
+ canStartJourney?: boolean;
816
821
  }
817
822
 
818
823
  declare interface IChapterModel {
@@ -876,6 +881,12 @@ declare interface IChaptersListProps {
876
881
  isGoalCreation: boolean;
877
882
  }
878
883
 
884
+ declare interface IChapterStartJourneyProps {
885
+ chapterDetails: IUserChapterData;
886
+ studentId: string;
887
+ userType: 'STUDENT' | 'TEACHER';
888
+ }
889
+
879
890
  declare interface IChapterState {
880
891
  added?: boolean;
881
892
  expanded?: boolean;
@@ -1323,6 +1334,12 @@ export declare interface IHomepageStartJourneyProps {
1323
1334
  userType: TUserTypes;
1324
1335
  }
1325
1336
 
1337
+ declare interface IHomepageStartJourneyProps_2 {
1338
+ chapterDetails: IUserChapterData;
1339
+ studentId: string;
1340
+ userType: TUserTypes;
1341
+ }
1342
+
1326
1343
  export declare interface IHomeworkData extends INodeDataProps {
1327
1344
  homework_id: string;
1328
1345
  chapter_name: string;
@@ -1397,9 +1414,8 @@ export declare interface IJourneyContext {
1397
1414
  * Sets a journey with a list of coachmarks.
1398
1415
  * @param id - The journey identifier.
1399
1416
  * @param coachmark - The array of coachmarks to be used in this journey.
1400
- * @param shouldBlueInitialJourney - If `true`, It will blur the 1st step overlay.
1401
1417
  */
1402
- setJourney: (id: TJourneyId, coachmark: ICoachmarkProps[], shouldBlueInitialJourney?: boolean) => void;
1418
+ setJourney: (id: TJourneyId, coachmark: ICoachmarkProps[]) => void;
1403
1419
  /**
1404
1420
  * Clears the current journey, removing all coachmarks.
1405
1421
  * Should be called inside useEffect to ensure cleanup.
@@ -3628,11 +3644,13 @@ export declare enum JOURNEY_ID_STUDENT {
3628
3644
  CIRCLE_TUTORIAL_JOURNEY = "CIRCLE_TUTORIAL_JOURNEY",
3629
3645
  CIRCLE_TABLES_INTRO_JOURNEY = "CIRCLE_TABLES_INTRO_JOURNEY",
3630
3646
  CIRCLE_STREAK_REDUCTION_JOURNEY = "CIRCLE_STREAK_REDUCTION_JOURNEY",
3631
- HOMEPAGE_JOURNEY = "HOMEPAGE_JOURNEY"
3647
+ HOMEPAGE_JOURNEY = "HOMEPAGE_JOURNEY",
3648
+ CHAPTER_PAGE_JOURNEY = "CHAPTER_PAGE_JOURNEY"
3632
3649
  }
3633
3650
 
3634
3651
  export declare enum JOURNEY_ID_TEACHER {
3635
- HOMEPAGE_JOURNEY = "HOMEPAGE_JOURNEY"
3652
+ HOMEPAGE_JOURNEY = "HOMEPAGE_JOURNEY",
3653
+ CHAPTER_PAGE_JOURNEY = "CHAPTER_PAGE_JOURNEY"
3636
3654
  }
3637
3655
 
3638
3656
  export declare const JourneyProvider: FC<IJourneyProviderProps>;
@@ -5265,6 +5283,13 @@ export declare const useCanvasSyncBroker: (channelId: string, logEvent: (type: s
5265
5283
  registerCallback: (qrId: string, cb: (data: IActionData) => void) => void;
5266
5284
  };
5267
5285
 
5286
+ export declare const useChapterPageJourney: () => {
5287
+ chapterPageRef: RefObject<HTMLDivElement>;
5288
+ bannerRef: RefObject<HTMLDivElement>;
5289
+ coreBlocksRef: RefObject<HTMLDivElement>;
5290
+ startJourney: ({ chapterDetails, studentId, userType }: IChapterStartJourneyProps) => void;
5291
+ };
5292
+
5268
5293
  export declare const useCircleSounds: () => {
5269
5294
  playSwipSound: () => void;
5270
5295
  play: (key: CircleSoundKey, immediately?: boolean, loop?: boolean) => HTMLAudioElement | undefined;