@cuemath/leap 3.5.30-link.0 → 3.5.30-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.
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { memo as
|
|
3
|
-
import { getTimezone as
|
|
4
|
-
import
|
|
5
|
-
import { useGetMileStoneConfig as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { useGetTrialHome as
|
|
9
|
-
import { filterAndUpdateSlideNavigation as
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { memo as L, useState as I, useCallback as n, useEffect as N } from "react";
|
|
3
|
+
import { getTimezone as z } from "../../helpers/date-time.js";
|
|
4
|
+
import F from "../communication/hooks/use-trial-session-message-broker/use-trial-session-message-broker.js";
|
|
5
|
+
import { useGetMileStoneConfig as y } from "../milestone/create/api/milestone-config.js";
|
|
6
|
+
import w from "../ui/error/error.js";
|
|
7
|
+
import k from "../ui/loader/app-loader/app-loader.js";
|
|
8
|
+
import { useGetTrialHome as x } from "./api/trial-home.js";
|
|
9
|
+
import { filterAndUpdateSlideNavigation as G } from "./helper.js";
|
|
10
|
+
import V from "./trial-session-view.js";
|
|
11
|
+
import { USER_TYPE as s } from "../timeline/daily-timeline-types.js";
|
|
12
|
+
const Z = L(function(d) {
|
|
13
|
+
const { userType: e, teacherId: E, studentId: g, teacherClassroomId: A, height: S = "100vh" } = d, [l, _] = I(null), [D, R] = I(), {
|
|
14
|
+
data: m,
|
|
14
15
|
get: u,
|
|
15
16
|
isProcessing: H,
|
|
16
17
|
isProcessingFailed: P
|
|
17
|
-
} =
|
|
18
|
-
get:
|
|
19
|
-
data:
|
|
20
|
-
isProcessing:
|
|
18
|
+
} = x(), {
|
|
19
|
+
get: p,
|
|
20
|
+
data: r,
|
|
21
|
+
isProcessing: v,
|
|
21
22
|
isProcessingFailed: C
|
|
22
|
-
} =
|
|
23
|
+
} = y(), t = n(() => {
|
|
23
24
|
u("trial-v3", {
|
|
24
|
-
student_id:
|
|
25
|
-
teacher_id:
|
|
25
|
+
student_id: g,
|
|
26
|
+
teacher_id: E,
|
|
26
27
|
viewer: e.toLocaleLowerCase()
|
|
27
28
|
});
|
|
28
|
-
}, [u,
|
|
29
|
-
t(),
|
|
29
|
+
}, [u, g, E, e]), f = n(() => {
|
|
30
|
+
t(), p("", {
|
|
30
31
|
demo_type: "TRIAL_V3"
|
|
31
32
|
});
|
|
32
|
-
}, [t,
|
|
33
|
-
(
|
|
34
|
-
e ===
|
|
33
|
+
}, [t, p]), U = n(
|
|
34
|
+
(T) => {
|
|
35
|
+
e === s.STUDENT && T.forEach((i) => {
|
|
35
36
|
i.eventName === "TRIAL_INFORMATION_UPDATED" && t();
|
|
36
|
-
}), e ===
|
|
37
|
+
}), e === s.TEACHER && T.forEach((i) => {
|
|
37
38
|
if (i.eventName === "TRIAL_SESSION_STUDENT_TIMEZONE") {
|
|
38
39
|
const {
|
|
39
|
-
eventPayload: { timezone:
|
|
40
|
+
eventPayload: { timezone: h }
|
|
40
41
|
} = i;
|
|
41
|
-
|
|
42
|
+
R(h);
|
|
42
43
|
}
|
|
43
44
|
});
|
|
44
45
|
},
|
|
45
46
|
[t, e]
|
|
46
|
-
), { publish: o } =
|
|
47
|
+
), { publish: o } = F({
|
|
47
48
|
teacherClassroomId: A,
|
|
48
|
-
onMessageReceive:
|
|
49
|
-
}),
|
|
50
|
-
t(), e ===
|
|
49
|
+
onMessageReceive: U
|
|
50
|
+
}), M = n(() => {
|
|
51
|
+
t(), e === s.TEACHER && (o == null || o({
|
|
51
52
|
eventName: "TRIAL_INFORMATION_UPDATED"
|
|
52
53
|
}));
|
|
53
54
|
}, [t, o, e]), O = n(() => {
|
|
54
|
-
e ===
|
|
55
|
+
e === s.STUDENT && (o == null || o({
|
|
55
56
|
eventName: "TRIAL_SESSION_STUDENT_TIMEZONE",
|
|
56
|
-
eventPayload: { timezone:
|
|
57
|
+
eventPayload: { timezone: z() }
|
|
57
58
|
}));
|
|
58
59
|
}, [o, e]);
|
|
59
60
|
N(() => {
|
|
60
|
-
|
|
61
|
-
}, [
|
|
62
|
-
const
|
|
63
|
-
(
|
|
64
|
-
if (
|
|
65
|
-
const
|
|
66
|
-
milestoneConfigData:
|
|
67
|
-
trialHomeData:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
D(c);
|
|
61
|
+
f();
|
|
62
|
+
}, [f]);
|
|
63
|
+
const a = n(
|
|
64
|
+
(T) => {
|
|
65
|
+
if (m && r) {
|
|
66
|
+
const i = e === s.TEACHER ? G({
|
|
67
|
+
milestoneConfigData: r,
|
|
68
|
+
trialHomeData: m,
|
|
69
|
+
grade: T
|
|
70
|
+
}) : m;
|
|
71
|
+
_(i);
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
|
-
[
|
|
74
|
+
[r, m, e]
|
|
75
75
|
);
|
|
76
76
|
return N(() => {
|
|
77
|
-
|
|
78
|
-
}, [
|
|
79
|
-
|
|
77
|
+
a == null || a();
|
|
78
|
+
}, [a]), H && !l || v ? /* @__PURE__ */ c(k, { height: S }) : P || C ? /* @__PURE__ */ c(w, { height: S, onTryAgain: f }) : l && r ? /* @__PURE__ */ c(
|
|
79
|
+
V,
|
|
80
80
|
{
|
|
81
81
|
...d,
|
|
82
|
-
onTrialInformationUpdate:
|
|
82
|
+
onTrialInformationUpdate: M,
|
|
83
83
|
onStudentTimezoneUpdate: O,
|
|
84
|
-
trialHomeData:
|
|
85
|
-
milestoneConfig:
|
|
86
|
-
onRemoveOptionalSlides:
|
|
87
|
-
studentTimezone:
|
|
84
|
+
trialHomeData: l,
|
|
85
|
+
milestoneConfig: r,
|
|
86
|
+
onRemoveOptionalSlides: a,
|
|
87
|
+
studentTimezone: D
|
|
88
88
|
}
|
|
89
89
|
) : null;
|
|
90
|
-
}),
|
|
90
|
+
}), oe = Z;
|
|
91
91
|
export {
|
|
92
|
-
|
|
92
|
+
oe as default
|
|
93
93
|
};
|
|
94
94
|
//# sourceMappingURL=trial-session.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trial-session.js","sources":["../../../src/features/trial-session/trial-session.tsx"],"sourcesContent":["import { memo, useCallback, useEffect, useState, type FC } from 'react';\n\nimport { getTimezone } from '../../helpers/date-time';\nimport useTrialSessionMessageBroker from '../communication/hooks/use-trial-session-message-broker/use-trial-session-message-broker';\nimport type { TTrialSessionMessage } from '../communication/hooks/use-trial-session-message-broker/use-trial-session-message-broker-types';\nimport { useGetMileStoneConfig } from '../milestone/create/api/milestone-config';\nimport Error from '../ui/error/error';\nimport AppLoader from '../ui/loader/app-loader/app-loader';\nimport { useGetTrialHome } from './api/trial-home';\nimport { filterAndUpdateSlideNavigation } from './helper';\nimport type { ITrialHomeData, ITrialSessionProps } from './trial-session-types';\nimport TrialSessionView from './trial-session-view';\n\nconst TrialSession: FC<ITrialSessionProps> = memo(function TrialSession(props) {\n const { userType, teacherId, studentId, teacherClassroomId, height = '100vh' } = props;\n const [trialHomeData, setTrialHomeData] = useState<ITrialHomeData | null>(null);\n const [studentTimezone, setStudentTimezone] = useState<string>();\n\n const {\n data: trialHomeResponse,\n get: getTrialHome,\n isProcessing: isProcessingTrialHome,\n isProcessingFailed: isProcessingFailedTrialHome,\n } = useGetTrialHome();\n const {\n get: getMilestoneConfig,\n data: milestoneConfigData,\n isProcessing: isProcessingMilestoneConfig,\n isProcessingFailed: isProcessingFailedMilestoneConfig,\n } = useGetMileStoneConfig();\n\n const fetchTrialHome = useCallback(() => {\n getTrialHome('trial-v3', {\n student_id: studentId,\n teacher_id: teacherId,\n viewer: userType.toLocaleLowerCase(),\n });\n }, [getTrialHome, studentId, teacherId, userType]);\n\n const fetchData = useCallback(() => {\n fetchTrialHome();\n getMilestoneConfig('', {\n demo_type: 'TRIAL_V3',\n });\n }, [fetchTrialHome, getMilestoneConfig]);\n\n const handleMessageReceive = useCallback(\n (messages: TTrialSessionMessage[]) => {\n if (userType ===
|
|
1
|
+
{"version":3,"file":"trial-session.js","sources":["../../../src/features/trial-session/trial-session.tsx"],"sourcesContent":["import { memo, useCallback, useEffect, useState, type FC } from 'react';\n\nimport { getTimezone } from '../../helpers/date-time';\nimport useTrialSessionMessageBroker from '../communication/hooks/use-trial-session-message-broker/use-trial-session-message-broker';\nimport type { TTrialSessionMessage } from '../communication/hooks/use-trial-session-message-broker/use-trial-session-message-broker-types';\nimport { useGetMileStoneConfig } from '../milestone/create/api/milestone-config';\nimport Error from '../ui/error/error';\nimport AppLoader from '../ui/loader/app-loader/app-loader';\nimport { useGetTrialHome } from './api/trial-home';\nimport { filterAndUpdateSlideNavigation } from './helper';\nimport type { ITrialHomeData, ITrialSessionProps } from './trial-session-types';\nimport TrialSessionView from './trial-session-view';\nimport { USER_TYPE } from '../timeline/daily-timeline-types';\n\nconst TrialSession: FC<ITrialSessionProps> = memo(function TrialSession(props) {\n const { userType, teacherId, studentId, teacherClassroomId, height = '100vh' } = props;\n const [trialHomeData, setTrialHomeData] = useState<ITrialHomeData | null>(null);\n const [studentTimezone, setStudentTimezone] = useState<string>();\n\n const {\n data: trialHomeResponse,\n get: getTrialHome,\n isProcessing: isProcessingTrialHome,\n isProcessingFailed: isProcessingFailedTrialHome,\n } = useGetTrialHome();\n const {\n get: getMilestoneConfig,\n data: milestoneConfigData,\n isProcessing: isProcessingMilestoneConfig,\n isProcessingFailed: isProcessingFailedMilestoneConfig,\n } = useGetMileStoneConfig();\n\n const fetchTrialHome = useCallback(() => {\n getTrialHome('trial-v3', {\n student_id: studentId,\n teacher_id: teacherId,\n viewer: userType.toLocaleLowerCase(),\n });\n }, [getTrialHome, studentId, teacherId, userType]);\n\n const fetchData = useCallback(() => {\n fetchTrialHome();\n getMilestoneConfig('', {\n demo_type: 'TRIAL_V3',\n });\n }, [fetchTrialHome, getMilestoneConfig]);\n\n const handleMessageReceive = useCallback(\n (messages: TTrialSessionMessage[]) => {\n if (userType === USER_TYPE.STUDENT) {\n messages.forEach(message => {\n if (message.eventName === 'TRIAL_INFORMATION_UPDATED') {\n fetchTrialHome();\n }\n });\n }\n\n if (userType === USER_TYPE.TEACHER) {\n messages.forEach(message => {\n if (message.eventName === 'TRIAL_SESSION_STUDENT_TIMEZONE') {\n const {\n eventPayload: { timezone },\n } = message;\n\n setStudentTimezone(timezone);\n }\n });\n }\n },\n [fetchTrialHome, userType],\n );\n\n const { publish } = useTrialSessionMessageBroker({\n teacherClassroomId,\n onMessageReceive: handleMessageReceive,\n });\n\n const handleOnTrialInformationUpdate = useCallback(() => {\n fetchTrialHome();\n\n if (userType === USER_TYPE.TEACHER) {\n publish?.({\n eventName: 'TRIAL_INFORMATION_UPDATED',\n });\n }\n }, [fetchTrialHome, publish, userType]);\n\n const handleOnTrialStudentTimezoneUpdate = useCallback(() => {\n if (userType === USER_TYPE.STUDENT) {\n publish?.({\n eventName: 'TRIAL_SESSION_STUDENT_TIMEZONE',\n eventPayload: { timezone: getTimezone() },\n });\n }\n }, [publish, userType]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n const handleRemoveOptionalSlides = useCallback(\n (grade?: string) => {\n if (trialHomeResponse && milestoneConfigData) {\n const updatedTrialHomeData =\n userType === USER_TYPE.TEACHER\n ? filterAndUpdateSlideNavigation({\n milestoneConfigData,\n trialHomeData: trialHomeResponse,\n grade,\n })\n : trialHomeResponse;\n\n setTrialHomeData(updatedTrialHomeData);\n }\n },\n [milestoneConfigData, trialHomeResponse, userType],\n );\n\n useEffect(() => {\n handleRemoveOptionalSlides?.();\n }, [handleRemoveOptionalSlides]);\n\n if ((isProcessingTrialHome && !trialHomeData) || isProcessingMilestoneConfig) {\n return <AppLoader height={height} />;\n }\n\n if (isProcessingFailedTrialHome || isProcessingFailedMilestoneConfig) {\n return <Error height={height} onTryAgain={fetchData} />;\n }\n\n if (trialHomeData && milestoneConfigData) {\n return (\n <TrialSessionView\n {...props}\n onTrialInformationUpdate={handleOnTrialInformationUpdate}\n onStudentTimezoneUpdate={handleOnTrialStudentTimezoneUpdate}\n trialHomeData={trialHomeData}\n milestoneConfig={milestoneConfigData}\n onRemoveOptionalSlides={handleRemoveOptionalSlides}\n studentTimezone={studentTimezone}\n />\n );\n }\n\n return null;\n});\n\nexport default TrialSession;\n"],"names":["TrialSession","memo","props","userType","teacherId","studentId","teacherClassroomId","height","trialHomeData","setTrialHomeData","useState","studentTimezone","setStudentTimezone","trialHomeResponse","getTrialHome","isProcessingTrialHome","isProcessingFailedTrialHome","useGetTrialHome","getMilestoneConfig","milestoneConfigData","isProcessingMilestoneConfig","isProcessingFailedMilestoneConfig","useGetMileStoneConfig","fetchTrialHome","useCallback","fetchData","handleMessageReceive","messages","USER_TYPE","message","timezone","publish","useTrialSessionMessageBroker","handleOnTrialInformationUpdate","handleOnTrialStudentTimezoneUpdate","getTimezone","useEffect","handleRemoveOptionalSlides","grade","updatedTrialHomeData","filterAndUpdateSlideNavigation","jsx","AppLoader","Error","TrialSessionView","TrialSession$1"],"mappings":";;;;;;;;;;;AAcA,MAAMA,IAAuCC,EAAK,SAAsBC,GAAO;AAC7E,QAAM,EAAE,UAAAC,GAAU,WAAAC,GAAW,WAAAC,GAAW,oBAAAC,GAAoB,QAAAC,IAAS,QAAY,IAAAL,GAC3E,CAACM,GAAeC,CAAgB,IAAIC,EAAgC,IAAI,GACxE,CAACC,GAAiBC,CAAkB,IAAIF,EAAiB,GAEzD;AAAA,IACJ,MAAMG;AAAA,IACN,KAAKC;AAAA,IACL,cAAcC;AAAA,IACd,oBAAoBC;AAAA,MAClBC,EAAgB,GACd;AAAA,IACJ,KAAKC;AAAA,IACL,MAAMC;AAAA,IACN,cAAcC;AAAA,IACd,oBAAoBC;AAAA,MAClBC,EAAsB,GAEpBC,IAAiBC,EAAY,MAAM;AACvC,IAAAV,EAAa,YAAY;AAAA,MACvB,YAAYT;AAAA,MACZ,YAAYD;AAAA,MACZ,QAAQD,EAA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