@cuemath/leap 2.9.6-as4 → 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 +75 -81
  22. package/dist/features/milestone/milestone-list-container/milestone-list-container.js.map +1 -1
  23. package/dist/index.d.ts +29 -5
  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 re } 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: T,
23
- isClassOngoing: P,
24
- userType: _,
21
+ milestoneType: s,
22
+ isStudentPresent: N,
23
+ isClassOngoing: v,
24
+ userType: A,
25
25
  canCreatePlan: G,
26
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,
@@ -48,33 +48,33 @@ const ue = (A) => {
48
48
  onTestReview: Z,
49
49
  onTestStart: ee,
50
50
  onWidgetTabSelection: te
51
- } = v, n = 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,
59
+ data: o,
60
60
  getAll: m,
61
61
  isStale: D,
62
62
  isProcessing: S
63
- } = _e(n), [I, M] = O(), [L, C] = O(!1), oe = Te(
63
+ } = _e(n), [M, I] = R(), [L, C] = R(!1), oe = me(
64
64
  (c) => {
65
- const { searchText: i, selectedBoard: E, selectedGrade: r } = c || {};
66
- (i || E || r) && C(!0);
67
- const d = s == null ? void 0 : s.filter((t) => {
68
- const { milestone_name: ne, board: ie, grade: Ee } = t || {};
69
- return (i ? ne.toLowerCase().includes(i.toLowerCase()) : !0) && (E ? ie === E : !0) && (r ? Ee === r : !0);
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
+ const { milestone_name: ne, board: ie, grade: re } = t || {};
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: [
@@ -97,73 +97,67 @@ const ue = (A) => {
97
97
  [e.GOAL_DELETED],
98
98
  [e.GOAL_OUTCOME_ADDED],
99
99
  [e.PAST_MILESTONE_OUTCOME_ADDED],
100
- [e.MILESTONE_TEST_ASSIGNED],
101
- [e.SHEET_STARTED]
100
+ [e.MILESTONE_TEST_ASSIGNED]
102
101
  ],
103
102
  callback: (c) => {
104
- var r, d;
105
- const i = (r = c.find(
106
- (t) => t.eventName === e.MILESTONE_RESOURCE_ASSIGNED || t.eventName === e.MILESTONE_RESOURCE_UNASSIGNED || t.eventName === e.SHEET_STARTED
107
- )) == null ? void 0 : r.eventPayload, E = (d = c.find(
108
- (t) => t.eventName === e.MILESTONE_TEST_ASSIGNED || t.eventName === e.SHEET_STARTED
109
- )) == null ? void 0 : d.eventPayload;
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;
110
109
  if (i) {
111
110
  const { milestoneId: t } = i || {};
112
111
  f(l), Ae(t);
113
112
  }
114
- if (E) {
115
- const { milestoneId: t } = E;
113
+ if (r) {
114
+ const { milestoneId: t } = r;
116
115
  f(l), De(t);
117
116
  }
118
117
  ue(n);
119
118
  }
120
119
  },
121
- (o === "ACTIVE" || o === "INACTIVE") && T
122
- ), console.log(
123
- (o === "ACTIVE" || o === "INACTIVE") && T,
124
- o,
125
- T,
126
- "ayush"
120
+ (s === "ACTIVE" || s === "INACTIVE") && N
127
121
  ), p(() => {
128
122
  m(n);
129
123
  }, [m, n]), p(() => {
130
124
  !S && D && m(n);
131
- }, [m, n, D, S]), S && !s)
132
- return /* @__PURE__ */ a(Le, { numMilestones: 2 });
133
- const R = o === "ACTIVE" && s && s.length > 6;
125
+ }, [m, n, D, S]), S && !o)
126
+ return /* @__PURE__ */ E(Le, { numMilestones: 2 });
127
+ const O = s === "ACTIVE" && o && o.length > 6;
134
128
  return /* @__PURE__ */ u(Ce, { $disablePointerEvents: S, children: [
135
- S && /* @__PURE__ */ a(Re, { children: /* @__PURE__ */ a("img", { src: me.LOADER_1, alt: "loading" }) }),
136
- R && /* @__PURE__ */ u(re, { children: [
137
- /* @__PURE__ */ a(
138
- 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,
139
133
  {
140
- filteredMilestones: I,
141
- milestones: s,
134
+ filteredMilestones: M,
135
+ milestones: o,
142
136
  handleFilterMilestones: oe,
143
137
  handleClearFilter: se
144
138
  }
145
139
  ),
146
- /* @__PURE__ */ a(de, { heightX: 1.5 })
140
+ /* @__PURE__ */ E(de, { heightX: 1.5 })
147
141
  ] }),
148
- /* @__PURE__ */ a(
149
- Me,
142
+ /* @__PURE__ */ E(
143
+ Ie,
150
144
  {
151
- showFilters: !!R,
145
+ showFilters: !!O,
152
146
  canCreatePlan: G,
153
- isClassOngoing: P,
147
+ isClassOngoing: v,
154
148
  isFiltersAdded: L,
155
- isStudentPresent: T,
156
- milestoneType: o,
157
- milestones: L ? I : s,
149
+ isStudentPresent: N,
150
+ milestoneType: s,
151
+ milestones: L ? M : o,
158
152
  onAddChapter: K,
159
- onAddOutcome: H,
160
- onChapterClick: x,
153
+ onAddOutcome: x,
154
+ onChapterClick: b,
161
155
  onCreatePlan: W,
162
156
  onDelete: j,
163
157
  onDraftPublish: k,
164
158
  onEdit: y,
165
- onExpandPastMilestones: w,
166
- onCreateMilestoneTest: b,
159
+ onExpandPastMilestones: V,
160
+ onCreateMilestoneTest: H,
167
161
  onAssignResources: X,
168
162
  onTestPreview: Y,
169
163
  onTestReview: Z,
@@ -174,20 +168,20 @@ const ue = (A) => {
174
168
  onNodeReattempt: B,
175
169
  onNodeReset: J,
176
170
  onNodeUnassign: Q,
177
- activeMilestoneId: V,
178
- activeTabId: F,
171
+ activeMilestoneId: F,
172
+ activeTabId: w,
179
173
  onWidgetTabSelection: te,
180
174
  studentId: l,
181
- studentName: ae.titleCase(A),
175
+ studentName: Ee.titleCase(d),
182
176
  teacherName: U,
183
177
  parentName: g,
184
- userType: _,
185
- courseStream: N
178
+ userType: A,
179
+ courseStream: _
186
180
  }
187
181
  )
188
182
  ] });
189
183
  }
190
- ), je = Oe;
184
+ ), je = Re;
191
185
  export {
192
186
  je as default
193
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 [EVENTS.SHEET_STARTED],\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 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":";;;;;;;;;;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;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;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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AAA,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>;
@@ -4612,7 +4630,6 @@ export declare type TInclassMessage = {
4612
4630
  eventName: typeof EVENTS.SHEET_STARTED;
4613
4631
  eventPayload: {
4614
4632
  sheetIds: string[];
4615
- milestoneId?: string;
4616
4633
  };
4617
4634
  } | {
4618
4635
  eventName: typeof EVENTS.MILESTONE_NAME_UPDATED;
@@ -5266,6 +5283,13 @@ export declare const useCanvasSyncBroker: (channelId: string, logEvent: (type: s
5266
5283
  registerCallback: (qrId: string, cb: (data: IActionData) => void) => void;
5267
5284
  };
5268
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
+
5269
5293
  export declare const useCircleSounds: () => {
5270
5294
  playSwipSound: () => void;
5271
5295
  play: (key: CircleSoundKey, immediately?: boolean, loop?: boolean) => HTMLAudioElement | undefined;