@cuemath/leap 3.5.35-j1 → 3.5.35-link.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/features/milestone/constants.js +28 -15
- package/dist/features/milestone/constants.js.map +1 -1
- package/dist/features/milestone/create/milestone-create-helpers.js +43 -42
- package/dist/features/milestone/create/milestone-create-helpers.js.map +1 -1
- package/dist/features/timeline/daily-timeline/daily-timeline-types.js.map +1 -1
- package/dist/features/timeline/daily-timeline/daily-timeline.js +63 -74
- package/dist/features/timeline/daily-timeline/daily-timeline.js.map +1 -1
- package/dist/features/timeline/monthly-timeline/monthly-timeline-types.js.map +1 -1
- package/dist/features/timeline/monthly-timeline/monthly-timeline.js +52 -56
- package/dist/features/timeline/monthly-timeline/monthly-timeline.js.map +1 -1
- package/dist/features/trial-session/comps/school-goals/school-goals.js +85 -80
- package/dist/features/trial-session/comps/school-goals/school-goals.js.map +1 -1
- package/dist/features/trial-session/comps/worksheet/worksheet.js +42 -33
- package/dist/features/trial-session/comps/worksheet/worksheet.js.map +1 -1
- package/dist/features/trial-session/helper.js +69 -66
- package/dist/features/trial-session/helper.js.map +1 -1
- package/dist/features/trial-session/hooks/use-slide-config-update.js +53 -39
- package/dist/features/trial-session/hooks/use-slide-config-update.js.map +1 -1
- package/dist/features/trial-session/hooks/use-trial-session-navigation.js +141 -129
- package/dist/features/trial-session/hooks/use-trial-session-navigation.js.map +1 -1
- package/dist/features/trial-session/left-panel/index.js.map +1 -1
- package/dist/features/trial-session/trial-session-constants.js +16 -9
- package/dist/features/trial-session/trial-session-constants.js.map +1 -1
- package/dist/features/trial-session/trial-session-types.js.map +1 -1
- package/dist/features/trial-session/trial-session-view.js +17 -16
- package/dist/features/trial-session/trial-session-view.js.map +1 -1
- package/dist/features/trial-session/trial-session.js +68 -66
- package/dist/features/trial-session/trial-session.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/package.json +1 -1
|
@@ -1,110 +1,99 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
2
|
-
import { memo as
|
|
3
|
-
import { useDailyTimelineGet as
|
|
4
|
-
import { ScrollWrapper as
|
|
5
|
-
import { USER_TYPE as
|
|
6
|
-
import { INITIAL_PAGE as
|
|
7
|
-
import { getTimezone as
|
|
8
|
-
import { DAILY_TIMELINE_ANALYTICS_EVENTS as
|
|
9
|
-
import
|
|
10
|
-
import { useUIContext as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
const
|
|
17
|
-
({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
courseStreams: f,
|
|
21
|
-
onPuzzleClick: v,
|
|
22
|
-
onReviewClick: x,
|
|
23
|
-
scrollAreaHeight: y,
|
|
24
|
-
onAPIComplete: l
|
|
25
|
-
}) => {
|
|
26
|
-
const [c, _] = M([]), [p, S] = M(!1), { onEvent: t } = W(), {
|
|
27
|
-
get: d,
|
|
1
|
+
import { jsx as s, jsxs as P } from "react/jsx-runtime";
|
|
2
|
+
import { memo as $, useState as I, useCallback as _, useMemo as w, useEffect as f, Fragment as D } from "react";
|
|
3
|
+
import { useDailyTimelineGet as R } from "./api/use-daily-timeline-get.js";
|
|
4
|
+
import { ScrollWrapper as F, DailyTimelineContainer as V } from "./daily-timeline-styled.js";
|
|
5
|
+
import { USER_TYPE as Y, CARD_TYPE as y } from "./daily-timeline-types.js";
|
|
6
|
+
import { INITIAL_PAGE as j } from "./comps/constants.js";
|
|
7
|
+
import { getTimezone as k } from "../../../helpers/date-time.js";
|
|
8
|
+
import { DAILY_TIMELINE_ANALYTICS_EVENTS as h } from "./daily-timeline-events.js";
|
|
9
|
+
import G from "./daily-timeline-view.js";
|
|
10
|
+
import { useUIContext as O } from "../../ui/context/context.js";
|
|
11
|
+
import U from "../../hooks/use-previous.js";
|
|
12
|
+
import W from "../../ui/error/error.js";
|
|
13
|
+
import b from "../../ui/layout/flex-view.js";
|
|
14
|
+
import X from "../../ui/intersection-loader/intersection-loader.js";
|
|
15
|
+
import q from "../../ui/loader/app-loader/app-loader.js";
|
|
16
|
+
const S = $(
|
|
17
|
+
({ userType: c, studentId: i, courseStreams: m, onPuzzleClick: A, onReviewClick: M, scrollAreaHeight: T }) => {
|
|
18
|
+
const [l, p] = I([]), [E, u] = I(!1), { onEvent: t } = O(), {
|
|
19
|
+
get: L,
|
|
28
20
|
data: e,
|
|
29
|
-
isProcessingFailed:
|
|
30
|
-
isProcessing:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
o && S(!0), d(i, {
|
|
21
|
+
isProcessingFailed: d,
|
|
22
|
+
isProcessing: z
|
|
23
|
+
} = R(i), C = U(e == null ? void 0 : e.curr_page), n = _(
|
|
24
|
+
(r = j, o = !1) => {
|
|
25
|
+
o && u(!0), L(i, {
|
|
35
26
|
page: r,
|
|
36
|
-
timezone:
|
|
37
|
-
course_stream:
|
|
27
|
+
timezone: k(),
|
|
28
|
+
course_stream: c === Y.TEACHER ? m : []
|
|
38
29
|
});
|
|
39
30
|
},
|
|
40
|
-
[
|
|
41
|
-
),
|
|
31
|
+
[L, i, c, m]
|
|
32
|
+
), N = w(() => {
|
|
42
33
|
const r = /* @__PURE__ */ new Set();
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
34
|
+
l.forEach((a) => {
|
|
35
|
+
a.daily_logs && a.daily_logs.forEach((g) => {
|
|
36
|
+
g.course_stream && g.course_stream !== y.CIRCLE && r.add(g.course_stream);
|
|
46
37
|
});
|
|
47
38
|
});
|
|
48
39
|
const o = new Set(
|
|
49
|
-
(
|
|
40
|
+
(m || []).filter((a) => String(a) !== y.CIRCLE)
|
|
50
41
|
);
|
|
51
|
-
return o.size > 1 || r.size > 1 || o.size > 0 && r.size > 0 && (o.size !== r.size || !Array.from(o).every((
|
|
52
|
-
}, [
|
|
53
|
-
e != null && e.next_page && !
|
|
42
|
+
return o.size > 1 || r.size > 1 || o.size > 0 && r.size > 0 && (o.size !== r.size || !Array.from(o).every((a) => r.has(a)));
|
|
43
|
+
}, [l, m]), v = _(() => {
|
|
44
|
+
e != null && e.next_page && !E && (n(e.next_page, !0), t(h.TIMELINE_SCROLLED, {
|
|
54
45
|
student_id: i
|
|
55
46
|
}));
|
|
56
|
-
}, [e, i, t,
|
|
57
|
-
|
|
58
|
-
}, [
|
|
59
|
-
return
|
|
60
|
-
e && (e.curr_page === 1 ?
|
|
61
|
-
}, [e, C]),
|
|
62
|
-
t(
|
|
47
|
+
}, [e, i, t, E, n]), x = _(() => {
|
|
48
|
+
n(1, !1), p([]);
|
|
49
|
+
}, [n]);
|
|
50
|
+
return f(() => {
|
|
51
|
+
e && (e.curr_page === 1 ? p((e == null ? void 0 : e.user_logs) ?? []) : e.curr_page && C !== e.curr_page && (p((r) => [...r, ...e.user_logs ?? []]), u(!1)));
|
|
52
|
+
}, [e, C]), f(() => {
|
|
53
|
+
t(h.TIMELINE_VIEWED, {
|
|
63
54
|
student_id: i
|
|
64
55
|
});
|
|
65
|
-
}, [i, t]),
|
|
66
|
-
t(
|
|
56
|
+
}, [i, t]), f(() => () => {
|
|
57
|
+
t(h.TIMELINE_CLOSED, {
|
|
67
58
|
student_id: i
|
|
68
59
|
});
|
|
69
|
-
}, [i, t]),
|
|
70
|
-
|
|
71
|
-
}, [
|
|
72
|
-
|
|
73
|
-
}, [h, E, l]), E ? /* @__PURE__ */ s(X, { height: y ?? "100vh", onTryAgain: D }) : I && !c.length ? /* @__PURE__ */ s(
|
|
74
|
-
q,
|
|
60
|
+
}, [i, t]), f(() => {
|
|
61
|
+
n(1, !1);
|
|
62
|
+
}, [n]), d ? /* @__PURE__ */ s(W, { height: T ?? "100vh", onTryAgain: x }) : z && !l.length ? /* @__PURE__ */ s(
|
|
63
|
+
b,
|
|
75
64
|
{
|
|
76
65
|
$alignItems: "center",
|
|
77
66
|
$justifyContent: "center",
|
|
78
|
-
$height:
|
|
79
|
-
children: /* @__PURE__ */ s(
|
|
67
|
+
$height: T || "100vh",
|
|
68
|
+
children: /* @__PURE__ */ s(q, { width: "100%", height: "100%" })
|
|
80
69
|
}
|
|
81
|
-
) : /* @__PURE__ */ s(
|
|
82
|
-
|
|
83
|
-
|
|
70
|
+
) : /* @__PURE__ */ s(F, { $alignItems: "center", $gapX: 1, children: /* @__PURE__ */ P(V, { children: [
|
|
71
|
+
l.map((r, o) => /* @__PURE__ */ s(D, { children: /* @__PURE__ */ s(
|
|
72
|
+
G,
|
|
84
73
|
{
|
|
85
74
|
entry: r,
|
|
86
75
|
isFirstElement: o === 0,
|
|
87
|
-
shouldShowTag:
|
|
88
|
-
onPuzzleClick:
|
|
89
|
-
onReviewClick:
|
|
90
|
-
userType:
|
|
76
|
+
shouldShowTag: N,
|
|
77
|
+
onPuzzleClick: A,
|
|
78
|
+
onReviewClick: M,
|
|
79
|
+
userType: c,
|
|
91
80
|
studentId: i
|
|
92
81
|
}
|
|
93
82
|
) }, `timeline-entry-${o}`)),
|
|
94
83
|
/* @__PURE__ */ s(
|
|
95
|
-
|
|
84
|
+
X,
|
|
96
85
|
{
|
|
97
|
-
onLoadMore:
|
|
98
|
-
isLoading:
|
|
86
|
+
onLoadMore: v,
|
|
87
|
+
isLoading: E,
|
|
99
88
|
hasMore: !!(e != null && e.next_page)
|
|
100
89
|
}
|
|
101
90
|
)
|
|
102
91
|
] }) });
|
|
103
92
|
}
|
|
104
93
|
);
|
|
105
|
-
|
|
106
|
-
const
|
|
94
|
+
S.displayName = "DailyTimeline";
|
|
95
|
+
const le = S;
|
|
107
96
|
export {
|
|
108
|
-
|
|
97
|
+
le as default
|
|
109
98
|
};
|
|
110
99
|
//# sourceMappingURL=daily-timeline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daily-timeline.js","sources":["../../../../src/features/timeline/daily-timeline/daily-timeline.tsx"],"sourcesContent":["import { Fragment, memo, useCallback, useEffect, useMemo, useState, type FC } from 'react';\n\nimport { type ITimelineData, useDailyTimelineGet } from './api/use-daily-timeline-get';\nimport * as Styled from './daily-timeline-styled';\nimport { CARD_TYPE, USER_TYPE, type IDailyTimelineProps } from './daily-timeline-types';\nimport { INITIAL_PAGE } from './comps/constants';\nimport { getTimezone } from '../../../helpers/date-time';\nimport { DAILY_TIMELINE_ANALYTICS_EVENTS } from './daily-timeline-events';\nimport DailyTimelineView from './daily-timeline-view';\nimport { useUIContext } from '../../ui/context/context';\nimport usePrevious from '../../hooks/use-previous';\nimport Error from '../../ui/error/error';\nimport FlexView from '../../ui/layout/flex-view';\nimport IntersectionLoader from '../../ui/intersection-loader/intersection-loader';\nimport AppLoader from '../../ui/loader/app-loader/app-loader';\n\nconst DailyTimeline: FC<IDailyTimelineProps> = memo(\n ({\n userType,\n studentId,\n courseStreams,\n onPuzzleClick,\n onReviewClick,\n scrollAreaHeight,\n onAPIComplete,\n }) => {\n const [allTimelineData, setAllTimelineData] = useState<ITimelineData[]>([]);\n const [isLoadingMore, setIsLoadingMore] = useState(false);\n const { onEvent: trackEvent } = useUIContext();\n const {\n get: getTimeline,\n data: timelineData,\n isProcessingFailed,\n isProcessing,\n isProcessed,\n } = useDailyTimelineGet(studentId);\n\n const prevCurrentPage = usePrevious(timelineData?.curr_page);\n\n const fetchTimeline = useCallback(\n (page = INITIAL_PAGE, append = false) => {\n if (append) {\n setIsLoadingMore(true);\n }\n\n getTimeline(studentId, {\n page,\n timezone: getTimezone(),\n course_stream: userType === USER_TYPE.TEACHER ? courseStreams : [],\n });\n },\n [getTimeline, studentId, userType, courseStreams],\n );\n\n const shouldShowTag = useMemo(() => {\n const allCourseStreams = new Set<string>();\n\n allTimelineData.forEach(entry => {\n if (entry.daily_logs) {\n entry.daily_logs.forEach(log => {\n if (log.course_stream && log.course_stream !== CARD_TYPE.CIRCLE) {\n allCourseStreams.add(log.course_stream);\n }\n });\n }\n });\n\n const courseStreamsSet = new Set(\n (courseStreams || []).filter(stream => String(stream) !== CARD_TYPE.CIRCLE),\n );\n\n return (\n courseStreamsSet.size > 1 ||\n allCourseStreams.size > 1 ||\n (courseStreamsSet.size > 0 &&\n allCourseStreams.size > 0 &&\n (courseStreamsSet.size !== allCourseStreams.size ||\n !Array.from(courseStreamsSet).every(stream => allCourseStreams.has(stream))))\n );\n }, [allTimelineData, courseStreams]);\n\n const handleLoadMore = useCallback(() => {\n if (timelineData?.next_page && !isLoadingMore) {\n fetchTimeline(timelineData.next_page, true);\n trackEvent(DAILY_TIMELINE_ANALYTICS_EVENTS.TIMELINE_SCROLLED, {\n student_id: studentId,\n });\n }\n }, [timelineData, studentId, trackEvent, isLoadingMore, fetchTimeline]);\n\n const onTryAgain = useCallback(() => {\n fetchTimeline(1, false);\n setAllTimelineData([]);\n }, [fetchTimeline]);\n\n useEffect(() => {\n if (timelineData) {\n if (timelineData.curr_page === 1) {\n setAllTimelineData(timelineData?.user_logs ?? []);\n } else if (timelineData.curr_page && prevCurrentPage !== timelineData.curr_page) {\n setAllTimelineData(prev => [...prev, ...(timelineData.user_logs ?? [])]);\n setIsLoadingMore(false);\n }\n }\n }, [timelineData, prevCurrentPage]);\n\n useEffect(() => {\n trackEvent(DAILY_TIMELINE_ANALYTICS_EVENTS.TIMELINE_VIEWED, {\n student_id: studentId,\n });\n }, [studentId, trackEvent]);\n\n useEffect(() => {\n return () => {\n trackEvent(DAILY_TIMELINE_ANALYTICS_EVENTS.TIMELINE_CLOSED, {\n student_id: studentId,\n });\n };\n }, [studentId, trackEvent]);\n\n useEffect(() => {\n fetchTimeline(1, false);\n }, [fetchTimeline]);\n\n useEffect(() => {\n if (isProcessed || isProcessingFailed) {\n onAPIComplete?.(isProcessed && !isProcessingFailed ? true : false);\n }\n }, [isProcessed, isProcessingFailed, onAPIComplete]);\n\n if (isProcessingFailed) {\n return <Error height={scrollAreaHeight ?? '100vh'} onTryAgain={onTryAgain} />;\n }\n\n if (isProcessing && !allTimelineData.length) {\n return (\n <FlexView\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $height={scrollAreaHeight || '100vh'}\n >\n <AppLoader width=\"100%\" height=\"100%\" />\n </FlexView>\n );\n }\n\n return (\n <Styled.ScrollWrapper $alignItems=\"center\" $gapX={1}>\n <Styled.DailyTimelineContainer>\n {allTimelineData.map((entry, index) => (\n <Fragment key={`timeline-entry-${index}`}>\n <DailyTimelineView\n entry={entry}\n isFirstElement={index === 0}\n shouldShowTag={shouldShowTag}\n onPuzzleClick={onPuzzleClick}\n onReviewClick={onReviewClick}\n userType={userType}\n studentId={studentId}\n />\n </Fragment>\n ))}\n <IntersectionLoader\n onLoadMore={handleLoadMore}\n isLoading={isLoadingMore}\n hasMore={!!timelineData?.next_page}\n />\n </Styled.DailyTimelineContainer>\n </Styled.ScrollWrapper>\n );\n },\n);\n\nDailyTimeline.displayName = 'DailyTimeline';\n\nexport default DailyTimeline;\n"],"names":["DailyTimeline","memo","userType","studentId","courseStreams","onPuzzleClick","onReviewClick","scrollAreaHeight","onAPIComplete","allTimelineData","setAllTimelineData","useState","isLoadingMore","setIsLoadingMore","trackEvent","useUIContext","getTimeline","timelineData","isProcessingFailed","isProcessing","isProcessed","useDailyTimelineGet","prevCurrentPage","usePrevious","fetchTimeline","useCallback","page","INITIAL_PAGE","append","getTimezone","USER_TYPE","shouldShowTag","useMemo","allCourseStreams","entry","log","CARD_TYPE","courseStreamsSet","stream","handleLoadMore","DAILY_TIMELINE_ANALYTICS_EVENTS","onTryAgain","useEffect","prev","jsx","Error","FlexView","AppLoader","Styled.ScrollWrapper","jsxs","Styled.DailyTimelineContainer","index","Fragment","DailyTimelineView","IntersectionLoader","DailyTimeline$1"],"mappings":";;;;;;;;;;;;;;;AAgBA,MAAMA,IAAyCC;AAAA,EAC7C,CAAC;AAAA,IACC,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,eAAAC;AAAA,IACA,eAAAC;AAAA,IACA,eAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,eAAAC;AAAA,EAAA,MACI;AACJ,UAAM,CAACC,GAAiBC,CAAkB,IAAIC,EAA0B,CAA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wB,CAAA,IAGzEtB,KAAgB,CAACV,EAAgB,SAEjC,gBAAAmC;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,aAAY;AAAA,QACZ,iBAAgB;AAAA,QAChB,SAASvC,KAAoB;AAAA,QAE7B,UAAC,gBAAAqC,EAAAG,GAAA,EAAU,OAAM,QAAO,QAAO,QAAO;AAAA,MAAA;AAAA,IAAA,IAM1C,gBAAAH,EAACI,GAAA,EAAqB,aAAY,UAAS,OAAO,GAChD,UAAA,gBAAAC,EAACC,GAAA,EACE,UAAA;AAAA,MAAAzC,EAAgB,IAAI,CAACyB,GAAOiB,wBAC1BC,GACC,EAAA,UAAA,gBAAAR;AAAA,QAACS;AAAA,QAAA;AAAA,UACC,OAAAnB;AAAA,UACA,gBAAgBiB,MAAU;AAAA,UAC1B,eAAApB;AAAA,UACA,eAAA1B;AAAA,UACA,eAAAC;AAAA,UACA,UAAAJ;AAAA,UACA,WAAAC;AAAA,QAAA;AAAA,MARW,EAAA,GAAA,kBAAkBgD,CAAK,EAUtC,CACD;AAAA,MACD,gBAAAP;AAAA,QAACU;AAAA,QAAA;AAAA,UACC,YAAYf;AAAA,UACZ,WAAW3B;AAAA,UACX,SAAS,CAAC,EAACK,KAAA,QAAAA,EAAc;AAAA,QAAA;AAAA,MAC3B;AAAA,IAAA,EACF,CAAA,EACF,CAAA;AAAA,EAEJ;AACF;AAEAjB,EAAc,cAAc;AAE5B,MAAAuD,KAAevD;"}
|
|
1
|
+
{"version":3,"file":"daily-timeline.js","sources":["../../../../src/features/timeline/daily-timeline/daily-timeline.tsx"],"sourcesContent":["import { Fragment, memo, useCallback, useEffect, useMemo, useState, type FC } from 'react';\n\nimport { type ITimelineData, useDailyTimelineGet } from './api/use-daily-timeline-get';\nimport * as Styled from './daily-timeline-styled';\nimport { CARD_TYPE, USER_TYPE, type IDailyTimelineProps } from './daily-timeline-types';\nimport { INITIAL_PAGE } from './comps/constants';\nimport { getTimezone } from '../../../helpers/date-time';\nimport { DAILY_TIMELINE_ANALYTICS_EVENTS } from './daily-timeline-events';\nimport DailyTimelineView from './daily-timeline-view';\nimport { useUIContext } from '../../ui/context/context';\nimport usePrevious from '../../hooks/use-previous';\nimport Error from '../../ui/error/error';\nimport FlexView from '../../ui/layout/flex-view';\nimport IntersectionLoader from '../../ui/intersection-loader/intersection-loader';\nimport AppLoader from '../../ui/loader/app-loader/app-loader';\n\nconst DailyTimeline: FC<IDailyTimelineProps> = memo(\n ({ userType, studentId, courseStreams, onPuzzleClick, onReviewClick, scrollAreaHeight }) => {\n const [allTimelineData, setAllTimelineData] = useState<ITimelineData[]>([]);\n const [isLoadingMore, setIsLoadingMore] = useState(false);\n const { onEvent: trackEvent } = useUIContext();\n const {\n get: getTimeline,\n data: timelineData,\n isProcessingFailed,\n isProcessing,\n } = useDailyTimelineGet(studentId);\n\n const prevCurrentPage = usePrevious(timelineData?.curr_page);\n\n const fetchTimeline = useCallback(\n (page = INITIAL_PAGE, append = false) => {\n if (append) {\n setIsLoadingMore(true);\n }\n\n getTimeline(studentId, {\n page,\n timezone: getTimezone(),\n course_stream: userType === USER_TYPE.TEACHER ? courseStreams : [],\n });\n },\n [getTimeline, studentId, userType, courseStreams],\n );\n\n const shouldShowTag = useMemo(() => {\n const allCourseStreams = new Set<string>();\n\n allTimelineData.forEach(entry => {\n if (entry.daily_logs) {\n entry.daily_logs.forEach(log => {\n if (log.course_stream && log.course_stream !== CARD_TYPE.CIRCLE) {\n allCourseStreams.add(log.course_stream);\n }\n });\n }\n });\n\n const courseStreamsSet = new Set(\n (courseStreams || []).filter(stream => String(stream) !== CARD_TYPE.CIRCLE),\n );\n\n return (\n courseStreamsSet.size > 1 ||\n allCourseStreams.size > 1 ||\n (courseStreamsSet.size > 0 &&\n allCourseStreams.size > 0 &&\n (courseStreamsSet.size !== allCourseStreams.size ||\n !Array.from(courseStreamsSet).every(stream => allCourseStreams.has(stream))))\n );\n }, [allTimelineData, courseStreams]);\n\n const handleLoadMore = useCallback(() => {\n if (timelineData?.next_page && !isLoadingMore) {\n fetchTimeline(timelineData.next_page, true);\n trackEvent(DAILY_TIMELINE_ANALYTICS_EVENTS.TIMELINE_SCROLLED, {\n student_id: studentId,\n });\n }\n }, [timelineData, studentId, trackEvent, isLoadingMore, fetchTimeline]);\n\n const onTryAgain = useCallback(() => {\n fetchTimeline(1, false);\n setAllTimelineData([]);\n }, [fetchTimeline]);\n\n useEffect(() => {\n if (timelineData) {\n if (timelineData.curr_page === 1) {\n setAllTimelineData(timelineData?.user_logs ?? []);\n } else if (timelineData.curr_page && prevCurrentPage !== timelineData.curr_page) {\n setAllTimelineData(prev => [...prev, ...(timelineData.user_logs ?? [])]);\n setIsLoadingMore(false);\n }\n }\n }, [timelineData, prevCurrentPage]);\n\n useEffect(() => {\n trackEvent(DAILY_TIMELINE_ANALYTICS_EVENTS.TIMELINE_VIEWED, {\n student_id: studentId,\n });\n }, [studentId, trackEvent]);\n\n useEffect(() => {\n return () => {\n trackEvent(DAILY_TIMELINE_ANALYTICS_EVENTS.TIMELINE_CLOSED, {\n student_id: studentId,\n });\n };\n }, [studentId, trackEvent]);\n\n useEffect(() => {\n fetchTimeline(1, false);\n }, [fetchTimeline]);\n\n if (isProcessingFailed) {\n return <Error height={scrollAreaHeight ?? '100vh'} onTryAgain={onTryAgain} />;\n }\n\n if (isProcessing && !allTimelineData.length) {\n return (\n <FlexView\n $alignItems=\"center\"\n $justifyContent=\"center\"\n $height={scrollAreaHeight || '100vh'}\n >\n <AppLoader width=\"100%\" height=\"100%\" />\n </FlexView>\n );\n }\n\n return (\n <Styled.ScrollWrapper $alignItems=\"center\" $gapX={1}>\n <Styled.DailyTimelineContainer>\n {allTimelineData.map((entry, index) => (\n <Fragment key={`timeline-entry-${index}`}>\n <DailyTimelineView\n entry={entry}\n isFirstElement={index === 0}\n shouldShowTag={shouldShowTag}\n onPuzzleClick={onPuzzleClick}\n onReviewClick={onReviewClick}\n userType={userType}\n studentId={studentId}\n />\n </Fragment>\n ))}\n <IntersectionLoader\n onLoadMore={handleLoadMore}\n isLoading={isLoadingMore}\n hasMore={!!timelineData?.next_page}\n />\n </Styled.DailyTimelineContainer>\n </Styled.ScrollWrapper>\n );\n },\n);\n\nDailyTimeline.displayName = 'DailyTimeline';\n\nexport default DailyTimeline;\n"],"names":["DailyTimeline","memo","userType","studentId","courseStreams","onPuzzleClick","onReviewClick","scrollAreaHeight","allTimelineData","setAllTimelineData","useState","isLoadingMore","setIsLoadingMore","trackEvent","useUIContext","getTimeline","timelineData","isProcessingFailed","isProcessing","useDailyTimelineGet","prevCurrentPage","usePrevious","fetchTimeline","useCallback","page","INITIAL_PAGE","append","getTimezone","USER_TYPE","shouldShowTag","useMemo","allCourseStreams","entry","log","CARD_TYPE","courseStreamsSet","stream","handleLoadMore","DAILY_TIMELINE_ANALYTICS_EVENTS","onTryAgain","useEffect","prev","jsx","Error","FlexView","AppLoader","Styled.ScrollWrapper","jsxs","Styled.DailyTimelineContainer","index","Fragment","DailyTimelineView","IntersectionLoader","DailyTimeline$1"],"mappings":";;;;;;;;;;;;;;;AAgBA,MAAMA,IAAyCC;AAAA,EAC7C,CAAC,EAAE,UAAAC,GAAU,WAAAC,GAAW,eAAAC,GAAe,eAAAC,GAAe,eAAAC,GAAe,kBAAAC,QAAuB;AAC1F,UAAM,CAACC,GAAiBC,CAAkB,IAAIC,EAA0B,CAAE,CAAA,GACpE,CAACC,GAAeC,CAAgB,IAAIF,EAAS,EAAK,GAClD,EAAE,SAASG,EAAW,IAAIC,EAAa,GACvC;AAAA,MACJ,KAAKC;AAAA,MACL,MAAMC;AAAA,MACN,oBAAAC;AAAA,MACA,cAAAC;AAAA,IAAA,IACEC,EAAoBhB,CAAS,GAE3BiB,IAAkBC,EAAYL,KAAA,gBAAAA,EAAc,SAAS,GAErDM,IAAgBC;AAAA,MACpB,CAACC,IAAOC,GAAcC,IAAS,OAAU;AACvC,QAAIA,KACFd,EAAiB,EAAI,GAGvBG,EAAYZ,GAAW;AAAA,UACrB,MAAAqB;AA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UACA,UAAAJ;AAAA,UACA,WAAAC;AAAA,QAAA;AAAA,MARW,EAAA,GAAA,kBAAkB8C,CAAK,EAUtC,CACD;AAAA,MACD,gBAAAP;AAAA,QAACU;AAAA,QAAA;AAAA,UACC,YAAYf;AAAA,UACZ,WAAW1B;AAAA,UACX,SAAS,CAAC,EAACK,KAAA,QAAAA,EAAc;AAAA,QAAA;AAAA,MAC3B;AAAA,IAAA,EACF,CAAA,EACF,CAAA;AAAA,EAEJ;AACF;AAEAhB,EAAc,cAAc;AAE5B,MAAAqD,KAAerD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monthly-timeline-types.js","sources":["../../../../src/features/timeline/monthly-timeline/monthly-timeline-types.ts"],"sourcesContent":["import { type TCourseStream } from '../../milestone/create/milestone-create-types';\n\nexport enum REPORT_TYPE {\n MPR_V1 = 'MPR_V1',\n MPR_V2 = 'MPR_V2',\n PTM = 'PTM',\n}\n\nexport enum EGoalCategory {\n SCHOOL_SUCCESS = 'SCHOOL_SUCCESS',\n ENRICHMENT = 'ENRICHMENT',\n TEST_PREP = 'TEST_PREP',\n}\n\nexport interface IMonthlyTimeline {\n year: number;\n month: number;\n reports: IMonthlyTimelineReport[];\n}\n\nexport interface IMonthlyTimelineReport {\n report_data: TimelineReportData | null;\n course_stream: TCourseStream | null;\n report_type: REPORT_TYPE;\n}\n\nexport interface TimelineReportData {\n id: string | null;\n progress_data: ProgressData | null;\n}\n\nexport interface ProgressData {\n user_milestones: IUserMilestone[];\n}\n\nexport interface IUserMilestone {\n goal_category: EGoalCategory;\n goal_code: string;\n milestone_name: string;\n previous_progress_stat: ProgressStat | null;\n progress_stat: ProgressStat;\n user_chapters: IUserChapter[];\n user_milestone_id: string;\n}\n\nexport interface IUserChapter {\n chapter_code: string;\n chapter_name: string;\n image_url: string;\n previous_progress_stat: ProgressStat | null;\n progress_stat: ProgressStat;\n user_chapter_id: string;\n}\n\nexport interface ProgressStat {\n completed: number;\n total: number;\n}\n\nexport interface IMonthlyTimelineProps {\n userType: 'PARENT' | 'TEACHER' | 'STUDENT';\n studentId: string;\n courseStreams?: string[];\n onReportClick?: (reportId: string, reportType: REPORT_TYPE, year: number, month: string) => void;\n scrollAreaHeight?: string | number;\n
|
|
1
|
+
{"version":3,"file":"monthly-timeline-types.js","sources":["../../../../src/features/timeline/monthly-timeline/monthly-timeline-types.ts"],"sourcesContent":["import { type TCourseStream } from '../../milestone/create/milestone-create-types';\n\nexport enum REPORT_TYPE {\n MPR_V1 = 'MPR_V1',\n MPR_V2 = 'MPR_V2',\n PTM = 'PTM',\n}\n\nexport enum EGoalCategory {\n SCHOOL_SUCCESS = 'SCHOOL_SUCCESS',\n ENRICHMENT = 'ENRICHMENT',\n TEST_PREP = 'TEST_PREP',\n}\n\nexport interface IMonthlyTimeline {\n year: number;\n month: number;\n reports: IMonthlyTimelineReport[];\n}\n\nexport interface IMonthlyTimelineReport {\n report_data: TimelineReportData | null;\n course_stream: TCourseStream | null;\n report_type: REPORT_TYPE;\n}\n\nexport interface TimelineReportData {\n id: string | null;\n progress_data: ProgressData | null;\n}\n\nexport interface ProgressData {\n user_milestones: IUserMilestone[];\n}\n\nexport interface IUserMilestone {\n goal_category: EGoalCategory;\n goal_code: string;\n milestone_name: string;\n previous_progress_stat: ProgressStat | null;\n progress_stat: ProgressStat;\n user_chapters: IUserChapter[];\n user_milestone_id: string;\n}\n\nexport interface IUserChapter {\n chapter_code: string;\n chapter_name: string;\n image_url: string;\n previous_progress_stat: ProgressStat | null;\n progress_stat: ProgressStat;\n user_chapter_id: string;\n}\n\nexport interface ProgressStat {\n completed: number;\n total: number;\n}\n\nexport interface IMonthlyTimelineProps {\n userType: 'PARENT' | 'TEACHER' | 'STUDENT';\n studentId: string;\n courseStreams?: string[];\n onReportClick?: (reportId: string, reportType: REPORT_TYPE, year: number, month: string) => void;\n scrollAreaHeight?: string | number;\n}\n\nexport interface IMonthlyTimelineViewProps {\n reports: IMonthlyTimelineReport[];\n onReportClick?: IMonthlyTimelineProps['onReportClick'];\n year: number;\n month: number;\n}\n"],"names":["REPORT_TYPE","EGoalCategory"],"mappings":"AAEY,IAAAA,sBAAAA,OACVA,EAAA,SAAS,UACTA,EAAA,SAAS,UACTA,EAAA,MAAM,OAHIA,IAAAA,KAAA,CAAA,CAAA,GAMAC,sBAAAA,OACVA,EAAA,iBAAiB,kBACjBA,EAAA,aAAa,cACbA,EAAA,YAAY,aAHFA,IAAAA,KAAA,CAAA,CAAA;"}
|
|
@@ -1,69 +1,65 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { memo as
|
|
3
|
-
import { monthlyTimelineGet as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { jsx as e, Fragment as A, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import { memo as I, useMemo as C, useCallback as E, useEffect as _ } from "react";
|
|
3
|
+
import { monthlyTimelineGet as b } from "./api/use-monthly-timeline-get.js";
|
|
4
|
+
import w from "./monthly-timeline-view.js";
|
|
5
|
+
import L from "../../ui/loader/app-loader/app-loader.js";
|
|
6
6
|
import t from "../../ui/layout/flex-view.js";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { yearImages as
|
|
11
|
-
import
|
|
12
|
-
import { ImageContainer as
|
|
13
|
-
import { getTimezone as
|
|
14
|
-
import { ILLUSTRATIONS as
|
|
15
|
-
const
|
|
16
|
-
userType:
|
|
17
|
-
studentId:
|
|
18
|
-
courseStreams:
|
|
19
|
-
onReportClick:
|
|
20
|
-
onAPIComplete: o
|
|
7
|
+
import P from "../../ui/text/text.js";
|
|
8
|
+
import T from "../../ui/image/image.js";
|
|
9
|
+
import s from "../../ui/separator/separator.js";
|
|
10
|
+
import { yearImages as R, monthNames as X } from "./constants.js";
|
|
11
|
+
import j from "../../ui/error/error.js";
|
|
12
|
+
import { ImageContainer as F, DateText as M } from "./monthly-timeline-styled.js";
|
|
13
|
+
import { getTimezone as S } from "../../../helpers/date-time.js";
|
|
14
|
+
import { ILLUSTRATIONS as B } from "../../../assets/illustrations/illustrations.js";
|
|
15
|
+
const v = ({
|
|
16
|
+
userType: h,
|
|
17
|
+
studentId: n,
|
|
18
|
+
courseStreams: l,
|
|
19
|
+
onReportClick: $
|
|
21
20
|
}) => {
|
|
22
|
-
const
|
|
21
|
+
const i = C(
|
|
23
22
|
() => ({
|
|
24
|
-
course_streams:
|
|
25
|
-
timezone:
|
|
23
|
+
course_streams: h === "TEACHER" ? l : [],
|
|
24
|
+
timezone: S()
|
|
26
25
|
}),
|
|
27
|
-
[
|
|
26
|
+
[l, h]
|
|
28
27
|
), {
|
|
29
|
-
get:
|
|
30
|
-
data:
|
|
31
|
-
isProcessing:
|
|
32
|
-
isProcessingFailed:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
/* @__PURE__ */ r(l, { heightX: 1 }),
|
|
49
|
-
/* @__PURE__ */ r(
|
|
50
|
-
F,
|
|
28
|
+
get: c,
|
|
29
|
+
data: o = [],
|
|
30
|
+
isProcessing: y,
|
|
31
|
+
isProcessingFailed: d
|
|
32
|
+
} = b(n, i), m = E(() => {
|
|
33
|
+
c(n, i);
|
|
34
|
+
}, [c, i, n]);
|
|
35
|
+
return _(() => {
|
|
36
|
+
m();
|
|
37
|
+
}, [m]), y ? /* @__PURE__ */ e(L, { height: "100dvh" }) : d ? /* @__PURE__ */ e(t, { $flex: 1, $alignItems: "center", $justifyContent: "center", children: /* @__PURE__ */ e(j, { onTryAgain: m }) }) : /* @__PURE__ */ e(A, { children: (o == null ? void 0 : o.length) > 0 ? /* @__PURE__ */ e(t, { $gapX: 2, children: o.map((r, u) => {
|
|
38
|
+
const g = u === 0, x = r.month === 12, f = !g && x, p = R[r.year];
|
|
39
|
+
return /* @__PURE__ */ a(t, { $width: "100%", children: [
|
|
40
|
+
!g && !f && /* @__PURE__ */ e(s, { heightX: 2 }),
|
|
41
|
+
f && p && /* @__PURE__ */ e(F, { $marginBottom: -122, children: /* @__PURE__ */ e(T, { src: p, alt: r.year.toString() }) }),
|
|
42
|
+
/* @__PURE__ */ a(t, { $gutterX: 1, children: [
|
|
43
|
+
/* @__PURE__ */ e(M, { $renderAs: "ac4", $color: "BLACK_T_60", children: X[r.month - 1] }),
|
|
44
|
+
/* @__PURE__ */ e(s, { heightX: 1 }),
|
|
45
|
+
/* @__PURE__ */ e(
|
|
46
|
+
w,
|
|
51
47
|
{
|
|
52
|
-
reports:
|
|
53
|
-
month:
|
|
54
|
-
year:
|
|
55
|
-
onReportClick:
|
|
48
|
+
reports: r.reports,
|
|
49
|
+
month: r.month,
|
|
50
|
+
year: r.year,
|
|
51
|
+
onReportClick: $
|
|
56
52
|
}
|
|
57
53
|
)
|
|
58
54
|
] })
|
|
59
|
-
] }, `${
|
|
60
|
-
}) }) : /* @__PURE__ */
|
|
61
|
-
/* @__PURE__ */
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
/* @__PURE__ */
|
|
55
|
+
] }, `${r.month}-${r.year}`);
|
|
56
|
+
}) }) : /* @__PURE__ */ a(t, { $justifyContent: "center", $alignItems: "center", $height: "100%", children: [
|
|
57
|
+
/* @__PURE__ */ e(T, { src: B.EMPTY_REPORTS }),
|
|
58
|
+
/* @__PURE__ */ e(s, { heightX: 1.5 }),
|
|
59
|
+
/* @__PURE__ */ e(P, { $renderAs: "ab2", color: "BLACK_T_60", children: "Report will be available next month." })
|
|
64
60
|
] }) });
|
|
65
|
-
},
|
|
61
|
+
}, W = I(v);
|
|
66
62
|
export {
|
|
67
|
-
|
|
63
|
+
W as default
|
|
68
64
|
};
|
|
69
65
|
//# sourceMappingURL=monthly-timeline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monthly-timeline.js","sources":["../../../../src/features/timeline/monthly-timeline/monthly-timeline.tsx"],"sourcesContent":["import { type FC, memo, useCallback, useEffect, useMemo } from 'react';\n\nimport { type IMonthlyTimelineProps } from './monthly-timeline-types';\nimport { monthlyTimelineGet } from './api/use-monthly-timeline-get';\nimport MonthlyTimelineView from './monthly-timeline-view';\nimport AppLoader from '../../ui/loader/app-loader/app-loader';\nimport FlexView from '../../ui/layout/flex-view';\nimport Text from '../../ui/text/text';\nimport Image from '../../ui/image/image';\nimport Separator from '../../ui/separator/separator';\nimport { monthNames, yearImages } from './constants';\nimport Error from '../../ui/error/error';\nimport * as Styled from './monthly-timeline-styled';\nimport { getTimezone } from '../../../helpers/date-time';\nimport { ILLUSTRATIONS } from '../../../assets/illustrations/illustrations';\n\nconst MonthlyTimeline: FC<IMonthlyTimelineProps> = ({\n userType,\n studentId,\n courseStreams,\n onReportClick,\n
|
|
1
|
+
{"version":3,"file":"monthly-timeline.js","sources":["../../../../src/features/timeline/monthly-timeline/monthly-timeline.tsx"],"sourcesContent":["import { type FC, memo, useCallback, useEffect, useMemo } from 'react';\n\nimport { type IMonthlyTimelineProps } from './monthly-timeline-types';\nimport { monthlyTimelineGet } from './api/use-monthly-timeline-get';\nimport MonthlyTimelineView from './monthly-timeline-view';\nimport AppLoader from '../../ui/loader/app-loader/app-loader';\nimport FlexView from '../../ui/layout/flex-view';\nimport Text from '../../ui/text/text';\nimport Image from '../../ui/image/image';\nimport Separator from '../../ui/separator/separator';\nimport { monthNames, yearImages } from './constants';\nimport Error from '../../ui/error/error';\nimport * as Styled from './monthly-timeline-styled';\nimport { getTimezone } from '../../../helpers/date-time';\nimport { ILLUSTRATIONS } from '../../../assets/illustrations/illustrations';\n\nconst MonthlyTimeline: FC<IMonthlyTimelineProps> = ({\n userType,\n studentId,\n courseStreams,\n onReportClick,\n}) => {\n const initialQueryParams = useMemo(\n () => ({\n course_streams: userType === 'TEACHER' ? courseStreams : [],\n timezone: getTimezone(),\n }),\n [courseStreams, userType],\n );\n\n const {\n get: getTimeline,\n data: timelineData = [],\n isProcessing,\n isProcessingFailed,\n } = monthlyTimelineGet(studentId, initialQueryParams);\n\n const fetchData = useCallback(() => {\n getTimeline(studentId, initialQueryParams);\n }, [getTimeline, initialQueryParams, studentId]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n if (isProcessing) {\n return <AppLoader height=\"100dvh\" />;\n }\n\n if (isProcessingFailed) {\n return (\n <FlexView $flex={1} $alignItems=\"center\" $justifyContent=\"center\">\n <Error onTryAgain={fetchData} />\n </FlexView>\n );\n }\n\n return (\n <>\n {timelineData?.length > 0 ? (\n <FlexView $gapX={2}>\n {timelineData.map((item, index) => {\n const isFirstItem = index === 0;\n const isDecember = item.month === 12;\n const showYearImage = !isFirstItem && isDecember;\n const yearImage = yearImages[item.year];\n\n return (\n <FlexView key={`${item.month}-${item.year}`} $width=\"100%\">\n {!isFirstItem && !showYearImage && <Separator heightX={2} />}\n {showYearImage && yearImage && (\n <Styled.ImageContainer $marginBottom={-122}>\n <Image src={yearImage} alt={item.year.toString()} />\n </Styled.ImageContainer>\n )}\n <FlexView $gutterX={1}>\n <Styled.DateText $renderAs=\"ac4\" $color=\"BLACK_T_60\">\n {monthNames[item.month - 1]}\n </Styled.DateText>\n <Separator heightX={1} />\n <MonthlyTimelineView\n reports={item.reports}\n month={item.month}\n year={item.year}\n onReportClick={onReportClick}\n />\n </FlexView>\n </FlexView>\n );\n })}\n </FlexView>\n ) : (\n <FlexView $justifyContent=\"center\" $alignItems=\"center\" $height=\"100%\">\n <Image src={ILLUSTRATIONS.EMPTY_REPORTS} />\n <Separator heightX={1.5} />\n <Text $renderAs=\"ab2\" color=\"BLACK_T_60\">\n Report will be available next month.\n </Text>\n </FlexView>\n )}\n </>\n );\n};\n\nexport default memo(MonthlyTimeline);\n"],"names":["MonthlyTimeline","userType","studentId","courseStreams","onReportClick","initialQueryParams","useMemo","getTimezone","getTimeline","timelineData","isProcessing","isProcessingFailed","monthlyTimelineGet","fetchData","useCallback","useEffect","jsx","AppLoader","FlexView","Error","Fragment","item","index","isFirstItem","isDecember","showYearImage","yearImage","yearImages","jsxs","Separator","Styled.ImageContainer","Image","Styled.DateText","monthNames","MonthlyTimelineView","ILLUSTRATIONS","Text","monthlyTimeline","memo"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAMA,IAA6C,CAAC;AAAA,EAClD,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AACF,MAAM;AACJ,QAAMC,IAAqBC;AAAA,IACzB,OAAO;AAAA,MACL,gBAAgBL,MAAa,YAAYE,IAAgB,CAAC;AAAA,MAC1D,UAAUI,EAAY;AAAA,IAAA;AAAA,IAExB,CAACJ,GAAeF,CAAQ;AAAA,EAAA,GAGpB;AAAA,IACJ,KAAKO;AAAA,IACL,MAAMC,IAAe,CAAC;AAAA,IACtB,cAAAC;AAAA,IACA,oBAAAC;AAAA,EAAA,IACEC,EAAmBV,GAAWG,CAAkB,GAE9CQ,IAAYC,EAAY,MAAM;AAClC,IAAAN,EAAYN,GAAWG,CAAkB;AAAA,EACxC,GAAA,CAACG,GAAaH,GAAoBH,CAAS,CAAC;AAM/C,SAJAa,EAAU,MAAM;AACJ,IAAAF;EAAA,GACT,CAACA,CAAS,CAAC,GAEVH,IACK,gBAAAM,EAACC,GAAU,EAAA,QAAO,SAAS,CAAA,IAGhCN,IAEC,gBAAAK,EAAAE,GAAA,EAAS,OAAO,GAAG,aAAY,UAAS,iBAAgB,UACvD,UAAC,gBAAAF,EAAAG,GAAA,EAAM,YAAYN,EAAA,CAAW,EAChC,CAAA,IAMC,gBAAAG,EAAAI,GAAA,EAAA,WAAAX,KAAA,gBAAAA,EAAc,UAAS,IACrB,gBAAAO,EAAAE,GAAA,EAAS,OAAO,GACd,UAAaT,EAAA,IAAI,CAACY,GAAMC,MAAU;AACjC,UAAMC,IAAcD,MAAU,GACxBE,IAAaH,EAAK,UAAU,IAC5BI,IAAgB,CAACF,KAAeC,GAChCE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
|
-
import { GOAL_CATEGORY as
|
|
1
|
+
import { jsx as w } from "react/jsx-runtime";
|
|
2
|
+
import { memo as B, useMemo as h, useCallback as g, useEffect as G } from "react";
|
|
3
|
+
import { GOAL_CATEGORY as n, ENROLLMENT_TYPES as E } from "../../../milestone/constants.js";
|
|
4
4
|
import { getCategorizedCurriculumStandards as q } from "../../../milestone/create/comps/class-details-step/class-details-utils.js";
|
|
5
|
-
import { getGradesFromConfig as
|
|
5
|
+
import { getGradesFromConfig as z, getGoalsFromConfig as V } from "../../../milestone/create/milestone-create-helpers.js";
|
|
6
6
|
import { epochTimestampAfterOneYear as L } from "../../../utils/utils.js";
|
|
7
|
-
import { useTrialSessionContext as
|
|
8
|
-
import { isPLASource as
|
|
9
|
-
import
|
|
10
|
-
|
|
7
|
+
import { useTrialSessionContext as J } from "../../context/use-trial-session-context.js";
|
|
8
|
+
import { isPLASource as K, updateGoalInFormData as b } from "../../helper.js";
|
|
9
|
+
import Q from "./school-goals-view.js";
|
|
10
|
+
import { HIGH_ENROLLMENT_PROGRAMS_MAP as W } from "../../trial-session-constants.js";
|
|
11
|
+
const mo = B(function() {
|
|
11
12
|
const {
|
|
12
|
-
milestoneConfig:
|
|
13
|
+
milestoneConfig: a,
|
|
13
14
|
formData: U,
|
|
14
|
-
updateSlideConfig:
|
|
15
|
-
updateButtonState:
|
|
16
|
-
onRemoveOptionalSlides:
|
|
17
|
-
trialHomeData:
|
|
18
|
-
} =
|
|
19
|
-
() => q(
|
|
20
|
-
countryCode:
|
|
21
|
-
grade:
|
|
22
|
-
goalCategory:
|
|
23
|
-
courseStream:
|
|
24
|
-
enrollmentType:
|
|
15
|
+
updateSlideConfig: e,
|
|
16
|
+
updateButtonState: O,
|
|
17
|
+
onRemoveOptionalSlides: C,
|
|
18
|
+
trialHomeData: A
|
|
19
|
+
} = J(), { name: T, grade: r, goals: t, curriculum: l, numberInNameError: I } = U || {}, { demo_info: N, intel_student: p, student: P } = A, { enrollment_type: s } = P || {}, { stream: m, region_data: R } = N || {}, { opportunity_country: i = "US" } = R || {}, v = z(a), c = K(p == null ? void 0 : p.source), S = Object.keys(W), D = h(
|
|
20
|
+
() => q(a, {
|
|
21
|
+
countryCode: i,
|
|
22
|
+
grade: r ?? "",
|
|
23
|
+
goalCategory: n.SCHOOL_SUCCESS,
|
|
24
|
+
courseStream: m,
|
|
25
|
+
enrollmentType: s,
|
|
25
26
|
flow: "CREATE"
|
|
26
27
|
}),
|
|
27
|
-
[
|
|
28
|
-
),
|
|
29
|
-
() =>
|
|
30
|
-
countryCode:
|
|
31
|
-
grade:
|
|
32
|
-
goalCategory:
|
|
33
|
-
courseStream:
|
|
34
|
-
curriculumStandard:
|
|
35
|
-
enrollmentType:
|
|
28
|
+
[a, i, r, m, s]
|
|
29
|
+
), d = h(
|
|
30
|
+
() => V(a, {
|
|
31
|
+
countryCode: i,
|
|
32
|
+
grade: r ?? "",
|
|
33
|
+
goalCategory: n.SCHOOL_SUCCESS,
|
|
34
|
+
courseStream: m,
|
|
35
|
+
curriculumStandard: l,
|
|
36
|
+
enrollmentType: s
|
|
36
37
|
}),
|
|
37
|
-
[
|
|
38
|
-
), { goal_code:
|
|
39
|
-
() => (t == null ? void 0 : t.find((o) => o.goal_category ===
|
|
38
|
+
[a, i, r, m, l, s]
|
|
39
|
+
), { goal_code: u } = h(
|
|
40
|
+
() => (t == null ? void 0 : t.find((o) => o.goal_category === n.SCHOOL_SUCCESS)) ?? {},
|
|
40
41
|
[t]
|
|
41
|
-
),
|
|
42
|
-
(o, s) => {
|
|
43
|
-
a({
|
|
44
|
-
[o]: s,
|
|
45
|
-
...o === "grade" || o === "curriculum" ? { goals: [] } : {}
|
|
46
|
-
});
|
|
47
|
-
},
|
|
48
|
-
[a]
|
|
49
|
-
), N = l(
|
|
42
|
+
), y = !!(T && r && l && u), M = g(
|
|
50
43
|
(o) => {
|
|
51
|
-
|
|
44
|
+
e({
|
|
45
|
+
name: o.target.value,
|
|
46
|
+
numberInNameError: !1,
|
|
47
|
+
enrollmentType: E.HIGH
|
|
48
|
+
});
|
|
52
49
|
},
|
|
53
|
-
[
|
|
54
|
-
),
|
|
55
|
-
(o,
|
|
56
|
-
const { label:
|
|
50
|
+
[e]
|
|
51
|
+
), F = g(
|
|
52
|
+
(o, f) => {
|
|
53
|
+
const { label: _, programCode: H = "" } = f, j = b(t, n.SCHOOL_SUCCESS, {
|
|
57
54
|
goal_code: o,
|
|
58
|
-
milestone_name:
|
|
55
|
+
milestone_name: _,
|
|
59
56
|
milestone_date_ts: L(),
|
|
60
|
-
publish:
|
|
57
|
+
publish: c,
|
|
58
|
+
program_code: H
|
|
59
|
+
}), k = S.includes(H) ? E.HIGH : void 0;
|
|
60
|
+
e({
|
|
61
|
+
goals: j,
|
|
62
|
+
enrollmentType: k
|
|
61
63
|
});
|
|
62
|
-
a({ goals: R });
|
|
63
64
|
},
|
|
64
|
-
[t,
|
|
65
|
-
),
|
|
66
|
-
(o) =>
|
|
67
|
-
[
|
|
68
|
-
),
|
|
65
|
+
[t, c, e, S]
|
|
66
|
+
), x = g(
|
|
67
|
+
(o) => e({ curriculum: o, goals: [], enrollmentType: void 0 }),
|
|
68
|
+
[e]
|
|
69
|
+
), Y = g(
|
|
69
70
|
(o) => {
|
|
70
|
-
|
|
71
|
+
e({ grade: o, curriculum: "", goals: [], enrollmentType: void 0 });
|
|
71
72
|
},
|
|
72
|
-
[
|
|
73
|
+
[e]
|
|
73
74
|
);
|
|
74
|
-
return
|
|
75
|
-
|
|
76
|
-
}, [
|
|
77
|
-
|
|
78
|
-
}, [
|
|
79
|
-
const o =
|
|
75
|
+
return G(() => {
|
|
76
|
+
O("right", { isDisabled: !y, isLoading: !1 });
|
|
77
|
+
}, [y, O]), G(() => {
|
|
78
|
+
r && (C == null || C(r, u));
|
|
79
|
+
}, [r, u]), G(() => {
|
|
80
|
+
const o = d.length === 1 ? d[0] : void 0;
|
|
80
81
|
if (o) {
|
|
81
|
-
const
|
|
82
|
+
const f = b(t, n.SCHOOL_SUCCESS, {
|
|
82
83
|
goal_code: o.id ?? "",
|
|
83
84
|
milestone_name: o.label ?? "",
|
|
84
85
|
milestone_date_ts: L(),
|
|
85
|
-
publish:
|
|
86
|
+
publish: c,
|
|
87
|
+
program_code: o.programCode
|
|
88
|
+
}), _ = S.includes((o == null ? void 0 : o.programCode) ?? "") ? E.HIGH : void 0;
|
|
89
|
+
e({
|
|
90
|
+
goals: f,
|
|
91
|
+
enrollmentType: _
|
|
86
92
|
});
|
|
87
|
-
a({ goals: s });
|
|
88
93
|
}
|
|
89
|
-
}, [
|
|
90
|
-
|
|
94
|
+
}, [d, c]), /* @__PURE__ */ w(
|
|
95
|
+
Q,
|
|
91
96
|
{
|
|
92
|
-
name:
|
|
93
|
-
grade:
|
|
94
|
-
grades:
|
|
95
|
-
goalsList:
|
|
96
|
-
curriculum:
|
|
97
|
-
selectedGoal:
|
|
98
|
-
numberInNameError:
|
|
99
|
-
curriculumStandards:
|
|
100
|
-
onNameChange:
|
|
101
|
-
onGoalChange:
|
|
102
|
-
onGradeChange:
|
|
103
|
-
onCurriculumChange:
|
|
97
|
+
name: T,
|
|
98
|
+
grade: r,
|
|
99
|
+
grades: v,
|
|
100
|
+
goalsList: d,
|
|
101
|
+
curriculum: l,
|
|
102
|
+
selectedGoal: u,
|
|
103
|
+
numberInNameError: I,
|
|
104
|
+
curriculumStandards: D,
|
|
105
|
+
onNameChange: M,
|
|
106
|
+
onGoalChange: F,
|
|
107
|
+
onGradeChange: Y,
|
|
108
|
+
onCurriculumChange: x
|
|
104
109
|
}
|
|
105
110
|
);
|
|
106
111
|
});
|
|
107
112
|
export {
|
|
108
|
-
|
|
113
|
+
mo as default
|
|
109
114
|
};
|
|
110
115
|
//# sourceMappingURL=school-goals.js.map
|