@cuemath/leap 3.3.11-link.2 → 3.3.11-link.3
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/trial-session/comps/session-report/session-report.js +15 -15
- package/dist/features/trial-session/comps/session-report/session-report.js.map +1 -1
- package/dist/features/trial-session/comps/student-profile/student-profile.js +1 -1
- package/dist/features/trial-session/comps/student-profile/student-profile.js.map +1 -1
- package/dist/features/trial-session/hooks/use-trial-session-navigation.js +73 -70
- package/dist/features/trial-session/hooks/use-trial-session-navigation.js.map +1 -1
- package/dist/features/trial-session/trial-session-view.js +16 -16
- package/dist/features/trial-session/trial-session-view.js.map +1 -1
- package/package.json +1 -1
|
@@ -13,35 +13,35 @@ import { studentLevels as M } from "../student-feedback/student-feedback-constan
|
|
|
13
13
|
import N from "./report-information/report-information.js";
|
|
14
14
|
import { Container as j, ContentWrapper as w } from "./session-report-styled.js";
|
|
15
15
|
const D = E(() => {
|
|
16
|
-
const { formData:
|
|
16
|
+
const { formData: u, milestoneConfig: o } = v(), { name: s = "", grade: f, attemptId: n = "shg", personalizedLevel: e = [] } = u || {}, {
|
|
17
17
|
data: p,
|
|
18
18
|
get: d,
|
|
19
|
-
isProcessing:
|
|
20
|
-
isProcessingFailed:
|
|
21
|
-
} = b(),
|
|
19
|
+
isProcessing: g,
|
|
20
|
+
isProcessingFailed: l
|
|
21
|
+
} = b(), i = R(() => {
|
|
22
22
|
var r, c;
|
|
23
|
-
const
|
|
23
|
+
const a = ((c = (r = A(o, {
|
|
24
24
|
grade: f ?? "",
|
|
25
25
|
courseStream: T.MATH,
|
|
26
26
|
preferenceCategory: x.LEVEL
|
|
27
27
|
})) == null ? void 0 : r.find((h) => h.id === (e == null ? void 0 : e[0]))) == null ? void 0 : c.label) ?? "";
|
|
28
|
-
return M[
|
|
29
|
-
}, [f, o, e]),
|
|
28
|
+
return M[a.toLowerCase()];
|
|
29
|
+
}, [f, o, e]), m = S(() => {
|
|
30
30
|
var r;
|
|
31
|
-
const
|
|
31
|
+
const a = y(
|
|
32
32
|
o,
|
|
33
33
|
e
|
|
34
34
|
);
|
|
35
|
-
|
|
36
|
-
student_level: ((r =
|
|
37
|
-
student_name: s
|
|
35
|
+
n && d(n, {
|
|
36
|
+
student_level: ((r = a[0]) == null ? void 0 : r.preference_name) ?? "",
|
|
37
|
+
student_name: s ?? ""
|
|
38
38
|
});
|
|
39
|
-
}, [
|
|
39
|
+
}, [n, d, o, s, e]);
|
|
40
40
|
return P(() => {
|
|
41
|
-
|
|
42
|
-
}, [
|
|
41
|
+
m();
|
|
42
|
+
}, [m]), l ? /* @__PURE__ */ t(L, { height: "70vh", onTryAgain: m }) : g || !p ? /* @__PURE__ */ t(_, { height: "100vh" }) : /* @__PURE__ */ C(j, { children: [
|
|
43
43
|
/* @__PURE__ */ t(F, { height: 60 }),
|
|
44
|
-
/* @__PURE__ */ t(I, { textToInsert: (
|
|
44
|
+
/* @__PURE__ */ t(I, { textToInsert: (i == null ? void 0 : i.title) ?? "" }),
|
|
45
45
|
/* @__PURE__ */ t(w, { $width: 750, children: /* @__PURE__ */ t(N, { sessionReports: p, studentName: s }) })
|
|
46
46
|
] });
|
|
47
47
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-report.js","sources":["../../../../../src/features/trial-session/comps/session-report/session-report.tsx"],"sourcesContent":["import { memo, useCallback, useEffect, useMemo } from 'react';\n\nimport { COURSE_STREAMS, PREFERENCE_CATEGORY } from '../../../milestone/constants';\nimport { getPreferencesFromConfig } from '../../../milestone/create/milestone-create-helpers';\nimport Error from '../../../ui/error/error';\nimport AppLoader from '../../../ui/loader/app-loader/app-loader';\nimport Separator from '../../../ui/separator/separator';\nimport { useGetSessionReports } from '../../api/trial-home';\nimport { useTrialSessionContext } from '../../context/use-trial-session-context';\nimport { getFormattedStudentPersonalizedPreference } from '../../helper';\nimport SlideHeader from '../slide-header';\nimport { studentLevels } from '../student-feedback/student-feedback-constants';\nimport ReportInformation from './report-information/report-information';\nimport * as Styled from './session-report-styled';\n\nconst SessionReport = memo(() => {\n const { formData, milestoneConfig } = useTrialSessionContext();\n const { name = '', grade, attemptId = 'shg', personalizedLevel = [] } = formData || {};\n\n const {\n data: sessionReports,\n get: getSessionReports,\n isProcessing,\n isProcessingFailed,\n } = useGetSessionReports();\n\n const selectedSessionLevel = useMemo(() => {\n const selectedLabel =\n getPreferencesFromConfig(milestoneConfig, {\n grade: grade ?? '',\n courseStream: COURSE_STREAMS.MATH,\n preferenceCategory: PREFERENCE_CATEGORY.LEVEL,\n })?.find(sessionLevel => sessionLevel.id === personalizedLevel?.[0])?.label ?? '';\n\n return studentLevels[selectedLabel.toLowerCase()];\n }, [grade, milestoneConfig, personalizedLevel]);\n\n const fetchData = useCallback(() => {\n const studentLevel = getFormattedStudentPersonalizedPreference(\n milestoneConfig,\n personalizedLevel,\n );\n\n if (attemptId
|
|
1
|
+
{"version":3,"file":"session-report.js","sources":["../../../../../src/features/trial-session/comps/session-report/session-report.tsx"],"sourcesContent":["import { memo, useCallback, useEffect, useMemo } from 'react';\n\nimport { COURSE_STREAMS, PREFERENCE_CATEGORY } from '../../../milestone/constants';\nimport { getPreferencesFromConfig } from '../../../milestone/create/milestone-create-helpers';\nimport Error from '../../../ui/error/error';\nimport AppLoader from '../../../ui/loader/app-loader/app-loader';\nimport Separator from '../../../ui/separator/separator';\nimport { useGetSessionReports } from '../../api/trial-home';\nimport { useTrialSessionContext } from '../../context/use-trial-session-context';\nimport { getFormattedStudentPersonalizedPreference } from '../../helper';\nimport SlideHeader from '../slide-header';\nimport { studentLevels } from '../student-feedback/student-feedback-constants';\nimport ReportInformation from './report-information/report-information';\nimport * as Styled from './session-report-styled';\n\nconst SessionReport = memo(() => {\n const { formData, milestoneConfig } = useTrialSessionContext();\n const { name = '', grade, attemptId = 'shg', personalizedLevel = [] } = formData || {};\n\n const {\n data: sessionReports,\n get: getSessionReports,\n isProcessing,\n isProcessingFailed,\n } = useGetSessionReports();\n\n const selectedSessionLevel = useMemo(() => {\n const selectedLabel =\n getPreferencesFromConfig(milestoneConfig, {\n grade: grade ?? '',\n courseStream: COURSE_STREAMS.MATH,\n preferenceCategory: PREFERENCE_CATEGORY.LEVEL,\n })?.find(sessionLevel => sessionLevel.id === personalizedLevel?.[0])?.label ?? '';\n\n return studentLevels[selectedLabel.toLowerCase()];\n }, [grade, milestoneConfig, personalizedLevel]);\n\n const fetchData = useCallback(() => {\n const studentLevel = getFormattedStudentPersonalizedPreference(\n milestoneConfig,\n personalizedLevel,\n );\n\n if (attemptId) {\n getSessionReports(attemptId, {\n student_level: studentLevel[0]?.preference_name ?? '',\n student_name: name ?? '',\n });\n }\n }, [attemptId, getSessionReports, milestoneConfig, name, personalizedLevel]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n if (isProcessingFailed) {\n return <Error height=\"70vh\" onTryAgain={fetchData} />;\n }\n\n if (isProcessing || !sessionReports) {\n return <AppLoader height=\"100vh\" />;\n }\n\n return (\n <Styled.Container>\n <Separator height={60} />\n <SlideHeader textToInsert={selectedSessionLevel?.title ?? ''} />\n <Styled.ContentWrapper $width={750}>\n <ReportInformation sessionReports={sessionReports} studentName={name} />\n </Styled.ContentWrapper>\n </Styled.Container>\n );\n});\n\nSessionReport.displayName = 'SessionReport';\n\nexport default SessionReport;\n"],"names":["SessionReport","memo","formData","milestoneConfig","useTrialSessionContext","name","grade","attemptId","personalizedLevel","sessionReports","getSessionReports","isProcessing","isProcessingFailed","useGetSessionReports","selectedSessionLevel","useMemo","selectedLabel","_b","_a","getPreferencesFromConfig","COURSE_STREAMS","PREFERENCE_CATEGORY","sessionLevel","studentLevels","fetchData","useCallback","studentLevel","getFormattedStudentPersonalizedPreference","useEffect","jsx","Error","AppLoader","jsxs","Styled.Container","Separator","SlideHeader","Styled.ContentWrapper","ReportInformation"],"mappings":";;;;;;;;;;;;;;AAeM,MAAAA,IAAgBC,EAAK,MAAM;AAC/B,QAAM,EAAE,UAA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,GAAI,CAAA;AAAA,IACtB,gBAAAL,EAAAM,GAAA,EAAY,eAAcrB,KAAA,gBAAAA,EAAsB,UAAS,IAAI;AAAA,IAC9D,gBAAAe,EAACO,GAAA,EAAsB,QAAQ,KAC7B,UAAA,gBAAAP,EAACQ,GAAkB,EAAA,gBAAA5B,GAAgC,aAAaJ,EAAA,CAAM,EACxE,CAAA;AAAA,EACF,EAAA,CAAA;AAEJ,CAAC;AAEDL,EAAc,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"student-profile.js","sources":["../../../../../src/features/trial-session/comps/student-profile/student-profile.tsx"],"sourcesContent":["import type { TGoalCategory } from '../../../milestone/create/milestone-create-types';\nimport type { TColorNames } from '../../../ui/types';\nimport type { IGetStudentProfileSummaryQuery } from '../../api/student-profile-summary';\n\nimport { memo, useCallback, useEffect, useMemo } from 'react';\n\nimport { ILLUSTRATIONS } from '../../../../assets/illustrations/illustrations';\nimport { GOAL_CATEGORY } from '../../../milestone/constants';\nimport Error from '../../../ui/error/error';\nimport Image from '../../../ui/image/image';\nimport FlexView from '../../../ui/layout/flex-view';\nimport AppLoader from '../../../ui/loader/app-loader/app-loader';\nimport Separator from '../../../ui/separator/separator';\nimport Text from '../../../ui/text/text';\nimport { useGetStudentProfileSummary } from '../../api/student-profile-summary';\nimport { useTrialSessionContext } from '../../context/use-trial-session-context';\nimport { getFormattedStudentPersonalizedPreference } from '../../helper';\nimport SlideHeader from '../slide-header';\nimport { GOAL_MAPPING } from './constant';\nimport StudentProfileHighlights from './student-profile-highlights/student-profile-highlights';\nimport * as Styled from './student-profile-styled';\nimport { getDummyProfileImage, getMilestoneGoalName } from './student-profile-utils';\n\ntype TProfileHighlight = {\n illustration: string;\n background: TColorNames;\n title: string;\n description: string | string[];\n};\n\nconst StudentProfile = memo(() => {\n const {\n isTeacher,\n studentId,\n formData,\n slideConfig,\n milestoneConfig,\n updateSlideConfig,\n updateButtonState,\n } = useTrialSessionContext();\n const { showProfileHighlights } = slideConfig;\n\n const {\n name,\n goals = [],\n studentProfile,\n personalizedObjectives = [],\n personalizedPosition = [],\n } = formData || {};\n const { dummyProfileImageIndex, profileSummary } = studentProfile || {};\n const dummyProfileImage = getDummyProfileImage(dummyProfileImageIndex);\n\n const payload = useMemo<IGetStudentProfileSummaryQuery | null>(() => {\n if (goals && goals.length > 0) {\n return {\n school_success_goal: getMilestoneGoalName(goals, GOAL_CATEGORY.SCHOOL_SUCCESS),\n test_prep_goal: getMilestoneGoalName(goals, GOAL_CATEGORY.TEST_PREP),\n };\n }\n\n return null;\n }, [goals]);\n\n const {\n get: getStudentProfileSummary,\n data,\n isProcessing,\n isProcessed,\n isProcessingFailed,\n } = useGetStudentProfileSummary();\n const { profile_summary: studentProfileSummary } = data || {};\n\n const fetchData = useCallback(() => {\n if (payload) {\n getStudentProfileSummary(studentId, payload);\n }\n }, [getStudentProfileSummary, payload, studentId]);\n\n useEffect(() => {\n updateButtonState('right', { isDisabled: isProcessing, isLoading: false });\n }, [isProcessing, updateButtonState]);\n\n useEffect(() => {\n if (isTeacher && !studentProfile && !showProfileHighlights) {\n fetchData();\n }\n }, [fetchData, isTeacher, studentProfile, showProfileHighlights]);\n\n useEffect(() => {\n if (isTeacher && isProcessed && !showProfileHighlights) {\n updateSlideConfig({\n studentProfile: {\n profileSummary: studentProfileSummary || '',\n dummyProfileImageIndex: Math.floor(Math.random() * 6),\n },\n });\n }\n }, [isProcessed, isTeacher, showProfileHighlights, studentProfileSummary, updateSlideConfig]);\n\n const profileHighlights: TProfileHighlight[] = useMemo(\n () => [\n {\n title: 'Studnet Level',\n description: `Catching up: ${getFormattedStudentPersonalizedPreference(\n milestoneConfig,\n personalizedPosition,\n ).map(objectives => objectives.preference_description)}`,\n illustration: ILLUSTRATIONS.KNOWLEDGE_BLUE,\n background: 'BLUE_1',\n },\n {\n illustration: ILLUSTRATIONS.ARROW_BOARD_GREEN,\n background: 'GREEN_1',\n title: 'Goals',\n description: getFormattedStudentPersonalizedPreference(\n milestoneConfig,\n personalizedObjectives,\n ).map(objectives => objectives.preference_name),\n },\n {\n illustration: ILLUSTRATIONS.BOOK_CHECKED_PURPLE,\n background: 'PURPLE_1',\n title: 'Learning Plan',\n description: goals.map(\n goal => `${GOAL_MAPPING[goal.goal_category as TGoalCategory]}: ${goal.milestone_name}`,\n ),\n },\n ],\n [goals, milestoneConfig, personalizedObjectives, personalizedPosition],\n );\n\n if (isProcessingFailed) {\n return <Error height=\"70vh\" onTryAgain={fetchData} />;\n }\n\n if (isProcessing || (!studentProfile && !showProfileHighlights)) {\n return <AppLoader height=\"100vh\" />;\n }\n\n return (\n <Styled.Container>\n <Separator height={60} />\n <SlideHeader marginBottom={showProfileHighlights ? 50 : 100} />\n {showProfileHighlights ? (\n <Styled.ContentWrapper $width={650}>\n <StudentProfileHighlights profileHighlights={profileHighlights} />\n <Separator height={16} />\n <Text $renderAs=\"ub3\" $color=\"BLACK_T_60\" $align=\"center\">\n We can always revisit this later\n </Text>\n </Styled.ContentWrapper>\n ) : (\n <Styled.ContentWrapper $widthX={46.875}>\n <Styled.AbsoluteImage />\n <FlexView\n $width=\"100%\"\n $heightX={21.875}\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $flexGapX={1.5}\n $gutterX={1.5}\n $background=\"WHITE_2\"\n $borderColor=\"BLACK_T_87\"\n $borderRadiusX={0.5}\n >\n <Styled.ImageWrapper>\n <Image withLoader height={200} width={200} src={dummyProfileImage} />\n </Styled.ImageWrapper>\n <FlexView $flexGap={16}>\n <Text $renderAs=\"ac2-black\">{name}</Text>\n <Text $renderAs=\"ab1\">{profileSummary || ''}</Text>\n </FlexView>\n </FlexView>\n </Styled.ContentWrapper>\n )}\n </Styled.Container>\n );\n});\n\nexport default StudentProfile;\n"],"names":["StudentProfile","memo","isTeacher","studentId","formData","slideConfig","milestoneConfig","updateSlideConfig","updateButtonState","useTrialSessionContext","showProfileHighlights","name","goals","studentProfile","personalizedObjectives","personalizedPosition","dummyProfileImageIndex","profileSummary","dummyProfileImage","getDummyProfileImage","payload","useMemo","getMilestoneGoalName","GOAL_CATEGORY","getStudentProfileSummary","data","isProcessing","isProcessed","isProcessingFailed","useGetStudentProfileSummary","studentProfileSummary","fetchData","useCallback","useEffect","profileHighlights","getFormattedStudentPersonalizedPreference","objectives","ILLUSTRATIONS","goal","GOAL_MAPPING","jsx","Error","AppLoader","jsxs","Styled.Container","Separator","SlideHeader","Styled.ContentWrapper","StudentProfileHighlights","Text","Styled.AbsoluteImage","FlexView","Styled.ImageWrapper","Image"],"mappings":";;;;;;;;;;;;;;;;;;AA8BM,MAAAA,KAAiBC,EAAK,MAAM;AAC1B,QAAA;AAAA,IACJ,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,aAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,mBAAAC;AAAA,MACEC,EAAuB,GACrB,EAAE,uBAAAC,EAA0B,IAAAL,GAE5B;AAAA,IACJ,MAAAM;AAAA,IACA,OAAAC,IAAQ,CAAC;AAAA,IACT,gBAAAC;AAAA,IACA,wBAAAC,IAAyB,CAAC;AAAA,IAC1B,sBAAAC,IAAuB,CAAC;AAAA,EAAA,IACtBX,KAAY,CAAA,GACV,EAAE,wBAAAY,GAAwB,gBAAAC,MAAmBJ,KAAkB,CAAA,GAC/DK,IAAoBC,EAAqBH,CAAsB,GAE/DI,IAAUC,EAA+C,MACzDT,KAASA,EAAM,SAAS,IACnB;AAAA,IACL,qBAAqBU,EAAqBV,GAAOW,EAAc,cAAc;AAAA,IAC7E,gBAAgBD,EAAqBV,GAAOW,EAAc,SAAS;AAAA,EAAA,IAIhE,MACN,CAACX,CAAK,CAAC,GAEJ;AAAA,IACJ,KAAKY;AAAA,IACL,MAAAC;AAAA,IACA,cAAAC;AAAA,IACA,aAAAC;AAAA,IACA,oBAAAC;AAAA,MACEC,EAA4B,GAC1B,EAAE,iBAAiBC,MAA0BL,KAAQ,CAAA,GAErDM,IAAYC,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cAAC,gBAAAX,EAAAS,GAAA,EAAK,WAAU,aAAa,UAAKtC,GAAA;AAAA,cACjC,gBAAA6B,EAAAS,GAAA,EAAK,WAAU,OAAO,eAAkB,IAAG;AAAA,YAAA,GAC9C;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA,GACF;AAAA,EAEJ,EAAA,CAAA;AAEJ,CAAC;"}
|
|
1
|
+
{"version":3,"file":"student-profile.js","sources":["../../../../../src/features/trial-session/comps/student-profile/student-profile.tsx"],"sourcesContent":["import type { TGoalCategory } from '../../../milestone/create/milestone-create-types';\nimport type { TColorNames } from '../../../ui/types';\nimport type { IGetStudentProfileSummaryQuery } from '../../api/student-profile-summary';\n\nimport { memo, useCallback, useEffect, useMemo } from 'react';\n\nimport { ILLUSTRATIONS } from '../../../../assets/illustrations/illustrations';\nimport { GOAL_CATEGORY } from '../../../milestone/constants';\nimport Error from '../../../ui/error/error';\nimport Image from '../../../ui/image/image';\nimport FlexView from '../../../ui/layout/flex-view';\nimport AppLoader from '../../../ui/loader/app-loader/app-loader';\nimport Separator from '../../../ui/separator/separator';\nimport Text from '../../../ui/text/text';\nimport { useGetStudentProfileSummary } from '../../api/student-profile-summary';\nimport { useTrialSessionContext } from '../../context/use-trial-session-context';\nimport { getFormattedStudentPersonalizedPreference } from '../../helper';\nimport SlideHeader from '../slide-header';\nimport { GOAL_MAPPING } from './constant';\nimport StudentProfileHighlights from './student-profile-highlights/student-profile-highlights';\nimport * as Styled from './student-profile-styled';\nimport { getDummyProfileImage, getMilestoneGoalName } from './student-profile-utils';\n\ntype TProfileHighlight = {\n illustration: string;\n background: TColorNames;\n title: string;\n description: string | string[];\n};\n\nconst StudentProfile = memo(() => {\n const {\n isTeacher,\n studentId,\n formData,\n slideConfig,\n milestoneConfig,\n updateSlideConfig,\n updateButtonState,\n } = useTrialSessionContext();\n const { showProfileHighlights } = slideConfig;\n\n const {\n name,\n goals = [],\n studentProfile,\n personalizedObjectives = [],\n personalizedPosition = [],\n } = formData || {};\n const { dummyProfileImageIndex, profileSummary } = studentProfile || {};\n const dummyProfileImage = getDummyProfileImage(dummyProfileImageIndex);\n\n const payload = useMemo<IGetStudentProfileSummaryQuery | null>(() => {\n if (goals && goals.length > 0) {\n return {\n school_success_goal: getMilestoneGoalName(goals, GOAL_CATEGORY.SCHOOL_SUCCESS),\n test_prep_goal: getMilestoneGoalName(goals, GOAL_CATEGORY.TEST_PREP),\n };\n }\n\n return null;\n }, [goals]);\n\n const {\n get: getStudentProfileSummary,\n data,\n isProcessing,\n isProcessed,\n isProcessingFailed,\n } = useGetStudentProfileSummary();\n const { profile_summary: studentProfileSummary } = data || {};\n\n const fetchData = useCallback(() => {\n if (payload) {\n getStudentProfileSummary(studentId, payload);\n }\n }, [getStudentProfileSummary, payload, studentId]);\n\n useEffect(() => {\n updateButtonState('right', { isDisabled: isProcessing, isLoading: false });\n }, [isProcessing, updateButtonState]);\n\n useEffect(() => {\n if (isTeacher && !studentProfile && !showProfileHighlights) {\n fetchData();\n }\n }, [fetchData, isTeacher, studentProfile, showProfileHighlights]);\n\n useEffect(() => {\n if (isTeacher && isProcessed && !showProfileHighlights) {\n updateSlideConfig({\n studentProfile: {\n profileSummary: studentProfileSummary || '',\n dummyProfileImageIndex: Math.floor(Math.random() * 6),\n },\n });\n }\n }, [isProcessed, isTeacher, showProfileHighlights, studentProfileSummary, updateSlideConfig]);\n\n const profileHighlights: TProfileHighlight[] = useMemo(\n () => [\n {\n title: 'Student Level',\n description: `Catching up: ${getFormattedStudentPersonalizedPreference(\n milestoneConfig,\n personalizedPosition,\n ).map(objectives => objectives.preference_description)}`,\n illustration: ILLUSTRATIONS.KNOWLEDGE_BLUE,\n background: 'BLUE_1',\n },\n {\n illustration: ILLUSTRATIONS.ARROW_BOARD_GREEN,\n background: 'GREEN_1',\n title: 'Goals',\n description: getFormattedStudentPersonalizedPreference(\n milestoneConfig,\n personalizedObjectives,\n ).map(objectives => objectives.preference_name),\n },\n {\n illustration: ILLUSTRATIONS.BOOK_CHECKED_PURPLE,\n background: 'PURPLE_1',\n title: 'Learning Plan',\n description: goals.map(\n goal => `${GOAL_MAPPING[goal.goal_category as TGoalCategory]}: ${goal.milestone_name}`,\n ),\n },\n ],\n [goals, milestoneConfig, personalizedObjectives, personalizedPosition],\n );\n\n if (isProcessingFailed) {\n return <Error height=\"70vh\" onTryAgain={fetchData} />;\n }\n\n if (isProcessing || (!studentProfile && !showProfileHighlights)) {\n return <AppLoader height=\"100vh\" />;\n }\n\n return (\n <Styled.Container>\n <Separator height={60} />\n <SlideHeader marginBottom={showProfileHighlights ? 50 : 100} />\n {showProfileHighlights ? (\n <Styled.ContentWrapper $width={650}>\n <StudentProfileHighlights profileHighlights={profileHighlights} />\n <Separator height={16} />\n <Text $renderAs=\"ub3\" $color=\"BLACK_T_60\" $align=\"center\">\n We can always revisit this later\n </Text>\n </Styled.ContentWrapper>\n ) : (\n <Styled.ContentWrapper $widthX={46.875}>\n <Styled.AbsoluteImage />\n <FlexView\n $width=\"100%\"\n $heightX={21.875}\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $flexGapX={1.5}\n $gutterX={1.5}\n $background=\"WHITE_2\"\n $borderColor=\"BLACK_T_87\"\n $borderRadiusX={0.5}\n >\n <Styled.ImageWrapper>\n <Image withLoader height={200} width={200} src={dummyProfileImage} />\n </Styled.ImageWrapper>\n <FlexView $flexGap={16}>\n <Text $renderAs=\"ac2-black\">{name}</Text>\n <Text $renderAs=\"ab1\">{profileSummary || ''}</Text>\n </FlexView>\n </FlexView>\n </Styled.ContentWrapper>\n )}\n </Styled.Container>\n );\n});\n\nexport default StudentProfile;\n"],"names":["StudentProfile","memo","isTeacher","studentId","formData","slideConfig","milestoneConfig","updateSlideConfig","updateButtonState","useTrialSessionContext","showProfileHighlights","name","goals","studentProfile","personalizedObjectives","personalizedPosition","dummyProfileImageIndex","profileSummary","dummyProfileImage","getDummyProfileImage","payload","useMemo","getMilestoneGoalName","GOAL_CATEGORY","getStudentProfileSummary","data","isProcessing","isProcessed","isProcessingFailed","useGetStudentProfileSummary","studentProfileSummary","fetchData","useCallback","useEffect","profileHighlights","getFormattedStudentPersonalizedPreference","objectives","ILLUSTRATIONS","goal","GOAL_MAPPING","jsx","Error","AppLoader","jsxs","Styled.Container","Separator","SlideHeader","Styled.ContentWrapper","StudentProfileHighlights","Text","Styled.AbsoluteImage","FlexView","Styled.ImageWrapper","Image"],"mappings":";;;;;;;;;;;;;;;;;;AA8BM,MAAAA,KAAiBC,EAAK,MAAM;AAC1B,QAAA;AAAA,IACJ,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,aAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,mBAAAC;AAAA,MACEC,EAAuB,GACrB,EAAE,uBAAAC,EAA0B,IAAAL,GAE5B;AAAA,IACJ,MAAAM;AAAA,IACA,OAAAC,IAAQ,CAAC;AAAA,IACT,gBAAAC;AAAA,IACA,wBAAAC,IAAyB,CAAC;AAAA,IAC1B,sBAAAC,IAAuB,CAAC;AAAA,EAAA,IACtBX,KAAY,CAAA,GACV,EAAE,wBAAAY,GAAwB,gBAAAC,MAAmBJ,KAAkB,CAAA,GAC/DK,IAAoBC,EAAqBH,CAAsB,GAE/DI,IAAUC,EAA+C,MACzDT,KAASA,EAAM,SAAS,IACnB;AAAA,IACL,qBAAqBU,EAAqBV,GAAOW,EAAc,cAAc;AAAA,IAC7E,gBAAgBD,EAAqBV,GAAOW,EAAc,SAAS;AAAA,EAAA,IAIhE,MACN,CAACX,CAAK,CAAC,GAEJ;AAAA,IACJ,KAAKY;AAAA,IACL,MAAAC;AAAA,IACA,cAAAC;AAAA,IACA,aAAAC;AAAA,IACA,oBAAAC;AAAA,MACEC,EAA4B,GAC1B,EAAE,iBAAiBC,MAA0BL,KAAQ,CAAA,GAErDM,IAAYC,EAAY,MAAM;AAClC,IAAIZ,KACFI,EAAyBrB,GAAWiB,CAAO;AAAA,EAE5C,GAAA,CA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6B,EAAAS,GAAA,EAAK,WAAU,OAAO,eAAkB,IAAG;AAAA,YAAA,GAC9C;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA,GACF;AAAA,EAEJ,EAAA,CAAA;AAEJ,CAAC;"}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { useCallback as u, useEffect as
|
|
2
|
-
import { COURSE_STREAMS as
|
|
3
|
-
import { useMilestoneBulkPost as
|
|
4
|
-
import { usePostStudentPreferences as
|
|
5
|
-
import { usePatchStudentInformation as
|
|
6
|
-
import { usePostTeacherAvailability as
|
|
7
|
-
import { usePatchTrialHome as
|
|
8
|
-
import { useTrialSessionContext as
|
|
9
|
-
import { getFormattedPreferences as
|
|
10
|
-
import { DEFAULT_BUTTON_STATE as
|
|
11
|
-
import
|
|
12
|
-
const
|
|
1
|
+
import { useCallback as u, useEffect as ee } from "react";
|
|
2
|
+
import { COURSE_STREAMS as te } from "../../milestone/constants.js";
|
|
3
|
+
import { useMilestoneBulkPost as oe } from "../../milestone/create/api/milestone-bulk.js";
|
|
4
|
+
import { usePostStudentPreferences as se } from "../api/course-stream.js";
|
|
5
|
+
import { usePatchStudentInformation as ae } from "../api/student-information.js";
|
|
6
|
+
import { usePostTeacherAvailability as ne } from "../api/teacher-availability.js";
|
|
7
|
+
import { usePatchTrialHome as re } from "../api/trial-home.js";
|
|
8
|
+
import { useTrialSessionContext as ie } from "../context/use-trial-session-context.js";
|
|
9
|
+
import { getFormattedPreferences as w, getWeekdayAndStartTimeFromPreference as ce, getFormattedStudentPersonalizedPreference as le } from "../helper.js";
|
|
10
|
+
import { DEFAULT_BUTTON_STATE as p, TrialPageId as t } from "../trial-session-constants.js";
|
|
11
|
+
import K from "../../../node_modules/uuid/dist/esm-browser/v4.js";
|
|
12
|
+
const ge = () => {
|
|
13
13
|
const {
|
|
14
14
|
updateSlideConfig: s,
|
|
15
|
-
slideConfig:
|
|
16
|
-
formData:
|
|
15
|
+
slideConfig: V,
|
|
16
|
+
formData: W,
|
|
17
17
|
updateButtonState: a,
|
|
18
18
|
teacherId: l,
|
|
19
19
|
studentId: d,
|
|
20
20
|
milestoneConfig: b,
|
|
21
|
-
handleInfoMessage:
|
|
22
|
-
onTrialInformationUpdate:
|
|
23
|
-
trialHomeData:
|
|
21
|
+
handleInfoMessage: P,
|
|
22
|
+
onTrialInformationUpdate: S,
|
|
23
|
+
trialHomeData: Z,
|
|
24
24
|
worksheetNavigationPanel: g
|
|
25
|
-
} =
|
|
26
|
-
name:
|
|
25
|
+
} = ie(), { nextPage: j, id: m } = V || {}, { demo_info: q } = Z, { stream: A, region_data: J } = q, { opportunity_country: T = "US" } = J || {}, { pageId: i } = j || {}, {
|
|
26
|
+
name: f,
|
|
27
27
|
grade: _,
|
|
28
28
|
goals: R,
|
|
29
29
|
curriculum: E,
|
|
@@ -32,8 +32,9 @@ const Pe = () => {
|
|
|
32
32
|
personalizedLevel: v = [],
|
|
33
33
|
personalizedFocus: k = [],
|
|
34
34
|
personalizedBehaviors: y = [],
|
|
35
|
-
personalizedObjectives: D = []
|
|
36
|
-
|
|
35
|
+
personalizedObjectives: D = [],
|
|
36
|
+
personalizedPosition: O = []
|
|
37
|
+
} = W || {}, c = u(() => {
|
|
37
38
|
a("both", {
|
|
38
39
|
left: { isDisabled: !0, isLoading: !1 },
|
|
39
40
|
right: { isDisabled: !0, isLoading: !0 }
|
|
@@ -41,25 +42,25 @@ const Pe = () => {
|
|
|
41
42
|
}, [a]), L = (o) => {
|
|
42
43
|
if (!o) {
|
|
43
44
|
const e = {};
|
|
44
|
-
(i === t.CIRCLE_GAME || i === t.CIRCLE_PUZZLE || i === t.CIRCLE_SKILL) && (e.matchmakingId =
|
|
45
|
+
(i === t.CIRCLE_GAME || i === t.CIRCLE_PUZZLE || i === t.CIRCLE_SKILL) && (e.matchmakingId = K(), e.showCircleGameScreen = !0), s({ id: i, ...e });
|
|
45
46
|
}
|
|
46
|
-
a("both",
|
|
47
|
-
}, { patch:
|
|
47
|
+
a("both", p), m === t.LEARNING_LEVEL && (S == null || S());
|
|
48
|
+
}, { patch: Q } = re({ onComplete: L }), { patch: G } = ae({
|
|
48
49
|
onComplete: L
|
|
49
|
-
}), { post:
|
|
50
|
+
}), { post: z } = oe({
|
|
50
51
|
onComplete: L
|
|
51
|
-
}), { post: x } =
|
|
52
|
+
}), { post: x } = se({
|
|
52
53
|
onComplete: L
|
|
53
|
-
}),
|
|
54
|
+
}), X = (o, e) => {
|
|
54
55
|
const n = (e == null ? void 0 : e.filter((r) => !r.is_available)) ?? [];
|
|
55
56
|
if (n.length > 0) {
|
|
56
|
-
const r = n.map((
|
|
57
|
+
const r = n.map(($) => $.reason).join(`
|
|
57
58
|
`);
|
|
58
|
-
|
|
59
|
+
P == null || P({ message: r, position: "bottom" }), a("both", p);
|
|
59
60
|
return;
|
|
60
61
|
}
|
|
61
|
-
const h =
|
|
62
|
-
h.length > 0 ?
|
|
62
|
+
const h = w(N, I);
|
|
63
|
+
h.length > 0 ? Q("trial-v3-patch", {
|
|
63
64
|
action: "UPDATE_DEMO",
|
|
64
65
|
action_data: {
|
|
65
66
|
trial_details: {
|
|
@@ -68,11 +69,11 @@ const Pe = () => {
|
|
|
68
69
|
},
|
|
69
70
|
teacher_id: l,
|
|
70
71
|
student_id: d
|
|
71
|
-
}) : a("both",
|
|
72
|
-
}, { post:
|
|
73
|
-
onComplete:
|
|
74
|
-
}),
|
|
75
|
-
const [o, e] = (
|
|
72
|
+
}) : a("both", p);
|
|
73
|
+
}, { post: F } = ne({
|
|
74
|
+
onComplete: X
|
|
75
|
+
}), M = u(() => {
|
|
76
|
+
const [o, e] = (f == null ? void 0 : f.split(" ")) || [], n = {
|
|
76
77
|
first_name: o,
|
|
77
78
|
last_name: e,
|
|
78
79
|
grade: _,
|
|
@@ -81,37 +82,37 @@ const Pe = () => {
|
|
|
81
82
|
teacher_id: l,
|
|
82
83
|
country_alpha_2: T
|
|
83
84
|
};
|
|
84
|
-
/\d/.test(
|
|
85
|
+
/\d/.test(f || "") ? s({ numberInNameError: !0 }) : (c(), G(d, n));
|
|
85
86
|
}, [
|
|
86
|
-
|
|
87
|
+
f,
|
|
87
88
|
_,
|
|
88
89
|
E,
|
|
89
90
|
l,
|
|
90
91
|
T,
|
|
91
92
|
c,
|
|
92
93
|
s,
|
|
93
|
-
|
|
94
|
+
G,
|
|
94
95
|
d
|
|
95
|
-
]),
|
|
96
|
-
const o =
|
|
96
|
+
]), U = u(() => {
|
|
97
|
+
const o = w(N, I), e = ce(o);
|
|
97
98
|
if (o.length > 0) {
|
|
98
99
|
const n = {
|
|
99
100
|
teacher_id: l,
|
|
100
101
|
session_list: e
|
|
101
102
|
};
|
|
102
|
-
c(),
|
|
103
|
+
c(), F(n);
|
|
103
104
|
} else
|
|
104
|
-
s({ id: i }), a("both",
|
|
105
|
+
s({ id: i }), a("both", p);
|
|
105
106
|
}, [
|
|
106
107
|
N,
|
|
107
108
|
I,
|
|
108
109
|
l,
|
|
109
|
-
|
|
110
|
+
F,
|
|
110
111
|
c,
|
|
111
112
|
s,
|
|
112
113
|
i,
|
|
113
114
|
a
|
|
114
|
-
]),
|
|
115
|
+
]), B = u(() => {
|
|
115
116
|
const o = {
|
|
116
117
|
course_stream: A,
|
|
117
118
|
grade: _,
|
|
@@ -119,7 +120,7 @@ const Pe = () => {
|
|
|
119
120
|
board: E,
|
|
120
121
|
goals: R
|
|
121
122
|
};
|
|
122
|
-
c(),
|
|
123
|
+
c(), z(o, {
|
|
123
124
|
studentId: d
|
|
124
125
|
});
|
|
125
126
|
}, [
|
|
@@ -127,77 +128,79 @@ const Pe = () => {
|
|
|
127
128
|
c,
|
|
128
129
|
R,
|
|
129
130
|
_,
|
|
130
|
-
|
|
131
|
+
z,
|
|
131
132
|
A,
|
|
132
133
|
d,
|
|
133
134
|
l
|
|
134
|
-
]),
|
|
135
|
-
const e = { preferences:
|
|
135
|
+
]), H = u(() => {
|
|
136
|
+
const e = { preferences: le(b, [
|
|
136
137
|
...v,
|
|
137
138
|
...k,
|
|
138
139
|
...y,
|
|
139
|
-
...D
|
|
140
|
-
|
|
140
|
+
...D,
|
|
141
|
+
...O
|
|
142
|
+
]) }, n = { stream: te.MATH, studentId: d };
|
|
141
143
|
c(), x(e, n);
|
|
142
144
|
}, [
|
|
143
|
-
c,
|
|
144
145
|
b,
|
|
145
|
-
y,
|
|
146
|
-
k,
|
|
147
146
|
v,
|
|
148
|
-
|
|
147
|
+
k,
|
|
148
|
+
y,
|
|
149
149
|
D,
|
|
150
|
-
|
|
150
|
+
O,
|
|
151
|
+
d,
|
|
152
|
+
c,
|
|
153
|
+
x
|
|
151
154
|
]), C = u(
|
|
152
155
|
(o, e) => {
|
|
153
156
|
if (!s) return;
|
|
154
157
|
const n = m === t.STUDENT_PROFILE, h = m === t.LEARNING_PLAN, r = {};
|
|
155
|
-
if ((e === t.CIRCLE_GAME || e === t.CIRCLE_PUZZLE || e === t.CIRCLE_SKILL) && (r.matchmakingId =
|
|
158
|
+
if ((e === t.CIRCLE_GAME || e === t.CIRCLE_PUZZLE || e === t.CIRCLE_SKILL) && (r.matchmakingId = K(), r.showCircleGameScreen = !0), o === "prev" && (s({
|
|
156
159
|
id: e,
|
|
157
160
|
...n && { studentProfile: void 0 },
|
|
158
161
|
...h && {
|
|
159
162
|
chapterId: void 0
|
|
160
163
|
},
|
|
161
164
|
...r
|
|
162
|
-
}), a("both",
|
|
165
|
+
}), a("both", p)), o === "next")
|
|
163
166
|
switch (m) {
|
|
164
167
|
case t.STUDENT_INFORMATION:
|
|
165
168
|
case t.SCHOOL_GOALS:
|
|
166
|
-
|
|
169
|
+
M();
|
|
167
170
|
break;
|
|
168
171
|
case t.LEARNING_WORKSHEET:
|
|
169
|
-
|
|
172
|
+
B();
|
|
170
173
|
break;
|
|
171
174
|
case t.CLASS_PREFERENCE:
|
|
172
|
-
|
|
175
|
+
U();
|
|
173
176
|
break;
|
|
174
177
|
case t.LEARNING_LEVEL:
|
|
175
|
-
|
|
178
|
+
H();
|
|
176
179
|
break;
|
|
177
180
|
case t.LEARNING_PLAN:
|
|
178
181
|
s({ id: e, chapterId: void 0, ...r });
|
|
179
182
|
break;
|
|
180
183
|
default:
|
|
181
|
-
s({ id: e, ...r }), a("both",
|
|
184
|
+
s({ id: e, ...r }), a("both", p);
|
|
182
185
|
}
|
|
183
186
|
},
|
|
184
187
|
[
|
|
185
188
|
s,
|
|
186
189
|
m,
|
|
187
190
|
a,
|
|
188
|
-
F,
|
|
189
|
-
U,
|
|
190
191
|
M,
|
|
191
|
-
B
|
|
192
|
+
B,
|
|
193
|
+
U,
|
|
194
|
+
H
|
|
192
195
|
]
|
|
193
|
-
),
|
|
196
|
+
), Y = u(() => {
|
|
194
197
|
!g && m === t.LEARNING_WORKSHEET && C("next", i);
|
|
195
198
|
}, [m, C, i, g]);
|
|
196
|
-
return
|
|
197
|
-
|
|
199
|
+
return ee(() => {
|
|
200
|
+
Y();
|
|
198
201
|
}, [g]), { handleNavigation: C };
|
|
199
202
|
};
|
|
200
203
|
export {
|
|
201
|
-
|
|
204
|
+
ge as useTrialSessionNavigation
|
|
202
205
|
};
|
|
203
206
|
//# sourceMappingURL=use-trial-session-navigation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-trial-session-navigation.js","sources":["../../../../src/features/trial-session/hooks/use-trial-session-navigation.ts"],"sourcesContent":["import type { TTeacherAvailabilityResponse } from '../api/teacher-availability';\nimport type { ITrialSessionFormFields } from '../trial-session-types';\n\nimport { useCallback, useEffect } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport { COURSE_STREAMS } from '../../milestone/constants';\nimport { useMilestoneBulkPost } from '../../milestone/create/api/milestone-bulk';\nimport { usePostStudentPreferences } from '../api/course-stream';\nimport { usePatchStudentInformation } from '../api/student-information';\nimport { usePostTeacherAvailability } from '../api/teacher-availability';\nimport { usePatchTrialHome } from '../api/trial-home';\nimport { useTrialSessionContext } from '../context/use-trial-session-context';\nimport {\n getFormattedPreferences,\n getFormattedStudentPersonalizedPreference,\n getWeekdayAndStartTimeFromPreference,\n} from '../helper';\nimport { DEFAULT_BUTTON_STATE, TrialPageId } from '../trial-session-constants';\n\nconst useTrialSessionNavigation = () => {\n const {\n updateSlideConfig,\n slideConfig,\n formData,\n updateButtonState,\n teacherId,\n studentId,\n milestoneConfig,\n handleInfoMessage,\n onTrialInformationUpdate,\n trialHomeData,\n worksheetNavigationPanel,\n } = useTrialSessionContext();\n const { nextPage, id: currentPageId } = slideConfig || {};\n const { demo_info: demoInfo } = trialHomeData;\n const { stream, region_data: regionData } = demoInfo;\n const { opportunity_country: countryCode = 'US' } = regionData || {};\n const { pageId: nextPageId } = nextPage || {};\n const {\n name,\n grade,\n goals,\n curriculum,\n studentTimezone = 'Asia/Calcutta',\n preferences = [],\n personalizedLevel = [],\n personalizedFocus = [],\n personalizedBehaviors = [],\n personalizedObjectives = [],\n } = formData || {};\n\n const disableNavButtons = useCallback(() => {\n updateButtonState('both', {\n left: { isDisabled: true, isLoading: false },\n right: { isDisabled: true, isLoading: true },\n });\n }, [updateButtonState]);\n\n const onAcknowledge = (errorMessage: string | null) => {\n if (!errorMessage) {\n const overrides: Partial<ITrialSessionFormFields> = {};\n\n if (\n nextPageId === TrialPageId.CIRCLE_GAME ||\n nextPageId === TrialPageId.CIRCLE_PUZZLE ||\n nextPageId === TrialPageId.CIRCLE_SKILL\n ) {\n overrides.matchmakingId = uuidv4();\n overrides.showCircleGameScreen = true;\n }\n\n updateSlideConfig({ id: nextPageId, ...overrides });\n }\n updateButtonState('both', DEFAULT_BUTTON_STATE);\n\n if (currentPageId === TrialPageId.LEARNING_LEVEL) {\n onTrialInformationUpdate?.();\n }\n };\n\n // API specifications\n const { patch: patchTrialSession } = usePatchTrialHome({ onComplete: onAcknowledge });\n const { patch: patchStudentInformation } = usePatchStudentInformation({\n onComplete: onAcknowledge,\n });\n const { post: postMilestoneBulk } = useMilestoneBulkPost({\n onComplete: onAcknowledge,\n });\n const { post: postStudentPreferences } = usePostStudentPreferences({\n onComplete: onAcknowledge,\n });\n\n const onTeacherAvailabilityValidate = (_: string | null, data?: TTeacherAvailabilityResponse) => {\n const notAvailable = data?.filter(item => !item.is_available) ?? [];\n\n if (notAvailable.length > 0) {\n const reason = notAvailable.map(item => item.reason).join('\\n');\n\n handleInfoMessage?.({ message: reason, position: 'bottom' });\n updateButtonState('both', DEFAULT_BUTTON_STATE);\n\n return;\n }\n\n const selectedRegularSlots = getFormattedPreferences(preferences, studentTimezone);\n\n if (selectedRegularSlots.length > 0) {\n const actionData = {\n trial_details: {\n selected_regular_slots: selectedRegularSlots,\n },\n };\n\n patchTrialSession('trial-v3-patch', {\n action: 'UPDATE_DEMO',\n action_data: actionData,\n teacher_id: teacherId,\n student_id: studentId,\n });\n } else updateButtonState('both', DEFAULT_BUTTON_STATE);\n };\n\n const { post: postTeacherAvailability } = usePostTeacherAvailability({\n onComplete: onTeacherAvailabilityValidate,\n });\n\n // Function to call API and updates states\n const handleStudentInformation = useCallback(() => {\n const [firstName, lastName] = name?.split(' ') || [];\n const payload = {\n first_name: firstName,\n last_name: lastName,\n grade,\n board: curriculum,\n demo_type: 'TRIAL_V3',\n teacher_id: teacherId,\n country_alpha_2: countryCode,\n };\n const isNumberExistsInName = /\\d/.test(name || '');\n\n if (isNumberExistsInName) {\n updateSlideConfig({ numberInNameError: true });\n } else {\n disableNavButtons();\n patchStudentInformation(studentId, payload);\n }\n }, [\n name,\n grade,\n curriculum,\n teacherId,\n countryCode,\n disableNavButtons,\n updateSlideConfig,\n patchStudentInformation,\n studentId,\n ]);\n\n const handleClassPreferences = useCallback(() => {\n const selectedRegularSlots = getFormattedPreferences(preferences, studentTimezone);\n const sessionList = getWeekdayAndStartTimeFromPreference(selectedRegularSlots);\n\n if (selectedRegularSlots.length > 0) {\n const availabilityPayload = {\n teacher_id: teacherId,\n session_list: sessionList,\n };\n\n disableNavButtons();\n postTeacherAvailability(availabilityPayload);\n } else {\n updateSlideConfig({ id: nextPageId });\n updateButtonState('both', DEFAULT_BUTTON_STATE);\n }\n }, [\n preferences,\n studentTimezone,\n teacherId,\n postTeacherAvailability,\n disableNavButtons,\n updateSlideConfig,\n nextPageId,\n updateButtonState,\n ]);\n\n const handleMileStoneBulkPost = useCallback(() => {\n const payload = {\n course_stream: stream,\n grade,\n teacher_id: teacherId,\n board: curriculum,\n goals,\n };\n\n disableNavButtons();\n postMilestoneBulk(payload, {\n studentId,\n });\n }, [\n curriculum,\n disableNavButtons,\n goals,\n grade,\n postMilestoneBulk,\n stream,\n studentId,\n teacherId,\n ]);\n\n const handleStudentPreferencesPatch = useCallback(() => {\n const personalizedPreferences = getFormattedStudentPersonalizedPreference(milestoneConfig, [\n ...personalizedLevel,\n ...personalizedFocus,\n ...personalizedBehaviors,\n ...personalizedObjectives,\n ]);\n\n const payload = { preferences: personalizedPreferences };\n const meta = { stream: COURSE_STREAMS.MATH, studentId };\n\n disableNavButtons();\n postStudentPreferences(payload, meta);\n }, [\n disableNavButtons,\n milestoneConfig,\n personalizedBehaviors,\n personalizedFocus,\n personalizedLevel,\n postStudentPreferences,\n personalizedObjectives,\n studentId,\n ]);\n\n // Navigation logic\n const handleNavigation = useCallback(\n (dir: string, id?: string) => {\n if (!updateSlideConfig) return;\n\n const isStudentProfilePage = currentPageId === TrialPageId.STUDENT_PROFILE;\n const isLearningPlanSlide = currentPageId === TrialPageId.LEARNING_PLAN;\n const overrides: Partial<ITrialSessionFormFields> = {};\n\n if (\n id === TrialPageId.CIRCLE_GAME ||\n id === TrialPageId.CIRCLE_PUZZLE ||\n id === TrialPageId.CIRCLE_SKILL\n ) {\n overrides.matchmakingId = uuidv4();\n overrides.showCircleGameScreen = true;\n }\n\n if (dir === 'prev') {\n updateSlideConfig({\n id,\n ...(isStudentProfilePage && { studentProfile: undefined }),\n ...(isLearningPlanSlide && {\n chapterId: undefined,\n }),\n ...overrides,\n });\n updateButtonState('both', DEFAULT_BUTTON_STATE);\n }\n\n if (dir === 'next') {\n switch (currentPageId) {\n //TODO: remove STUDENT_INFORMATION\n case TrialPageId.STUDENT_INFORMATION:\n case TrialPageId.SCHOOL_GOALS:\n handleStudentInformation();\n break;\n case TrialPageId.LEARNING_WORKSHEET:\n handleMileStoneBulkPost();\n break;\n case TrialPageId.CLASS_PREFERENCE:\n handleClassPreferences();\n break;\n case TrialPageId.LEARNING_LEVEL:\n handleStudentPreferencesPatch();\n break;\n case TrialPageId.LEARNING_PLAN:\n updateSlideConfig({ id, chapterId: undefined, ...overrides });\n break;\n default: {\n updateSlideConfig({ id, ...overrides });\n updateButtonState('both', DEFAULT_BUTTON_STATE);\n }\n }\n }\n },\n [\n updateSlideConfig,\n currentPageId,\n updateButtonState,\n handleStudentInformation,\n handleMileStoneBulkPost,\n handleClassPreferences,\n handleStudentPreferencesPatch,\n ],\n );\n\n const sessionWorksheetNavigation = useCallback(() => {\n if (!worksheetNavigationPanel && currentPageId === TrialPageId.LEARNING_WORKSHEET) {\n handleNavigation('next', nextPageId);\n }\n }, [currentPageId, handleNavigation, nextPageId, worksheetNavigationPanel]);\n\n useEffect(() => {\n sessionWorksheetNavigation();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [worksheetNavigationPanel]);\n\n return { handleNavigation };\n};\n\nexport { useTrialSessionNavigation };\n"],"names":["useTrialSessionNavigation","updateSlideConfig","slideConfig","formData","updateButtonState","teacherId","studentId","milestoneConfig","handleInfoMessage","onTrialInformationUpdate","trialHomeData","worksheetNavigationPanel","useTrialSessionContext","nextPage","currentPageId","demoInfo","stream","regionData","countryCode","nextPageId","name","grade","goals","curriculum","studentTimezone","preferences","personalizedLevel","personalizedFocus","personalizedBehaviors","personalizedObjectives","disableNavButtons","useCallback","onAcknowledge","errorMessage","overrides","TrialPageId","uuidv4","DEFAULT_BUTTON_STATE","patchTrialSession","usePatchTrialHome","patchStudentInformation","usePatchStudentInformation","postMilestoneBulk","useMilestoneBulkPost","postStudentPreferences","usePostStudentPreferences","onTeacherAvailabilityValidate","_","data","notAvailable","item","reason","selectedRegularSlots","getFormattedPreferences","postTeacherAvailability","usePostTeacherAvailability","handleStudentInformation","firstName","lastName","payload","handleClassPreferences","sessionList","getWeekdayAndStartTimeFromPreference","availabilityPayload","handleMileStoneBulkPost","handleStudentPreferencesPatch","getFormattedStudentPersonalizedPreference","meta","COURSE_STREAMS","handleNavigation","dir","id","isStudentProfilePage","isLearningPlanSlide","sessionWorksheetNavigation","useEffect"],"mappings":";;;;;;;;;;;AAoBA,MAAMA,KAA4B,MAAM;AAChC,QAAA;AAAA,IACJ,mBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,UAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,eAAAC;AAAA,IACA,0BAAAC;AAAA,MACEC,GAAuB,GACrB,EAAE,UAAAC,GAAU,IAAIC,EAAc,IAAIZ,KAAe,CAAA,GACjD,EAAE,WAAWa,EAAa,IAAAL,GAC1B,EAAE,QAAAM,GAAQ,aAAaC,EAAA,IAAeF,GACtC,EAAE,qBAAqBG,IAAc,KAAK,IAAID,KAAc,CAAA,GAC5D,EAAE,QAAQE,MAAeN,KAAY,CAAA,GACrC;AAAA,IACJ,MAAAO;AAAA,IACA,OAAAC;AAAA,IACA,OAAAC;AAAA,IACA,YAAAC;AAAA,IACA,iBAAAC,IAAkB;AAAA,IAClB,aAAAC,IAAc,CAAC;AAAA,IACf,mBAAAC,IAAoB,CAAC;AAAA,IACrB,mBAAAC,IAAoB,CAAC;AAAA,IACrB,uBAAAC,IAAwB,CAAC;AAAA,IACzB,wBAAAC,IAAyB,CAAC;AAAA,EAAA,IACxB1B,KAAY,CAAA,GAEV2B,IAAoBC,EAAY,MAAM;AAC1C,IAAA3B,EAAkB,QAAQ;AAAA,MACxB,MAAM,EAAE,YAAY,IAAM,WAAW,GAAM;AAAA,MAC3C,OAAO,EAAE,YAAY,IAAM,WAAW,GAAK;AAA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AAGvC;AAAA,MAAA,CACJ,GACD9B,EAAkB,QAAQiC,CAAoB,IAG5CiC,MAAQ;AACV,gBAAQxD,GAAe;AAAA,UAErB,KAAKqB,EAAY;AAAA,UACjB,KAAKA,EAAY;AACU,YAAAqB;AACzB;AAAA,UACF,KAAKrB,EAAY;AACS,YAAA6B;AACxB;AAAA,UACF,KAAK7B,EAAY;AACQ,YAAAyB;AACvB;AAAA,UACF,KAAKzB,EAAY;AACe,YAAA8B;AAC9B;AAAA,UACF,KAAK9B,EAAY;AACf,YAAAlC,EAAkB,EAAE,IAAAsE,GAAI,WAAW,QAAW,GAAGrC,GAAW;AAC5D;AAAA,UACF;AACE,YAAAjC,EAAkB,EAAE,IAAAsE,GAAI,GAAGrC,EAAW,CAAA,GACtC9B,EAAkB,QAAQiC,CAAoB;AAAA,QAElD;AAAA,IAEJ;AAAA,IACA;AAAA,MACEpC;AAAA,MACAa;AAAA,MACAV;AAAA,MACAoD;AAAA,MACAQ;AAAA,MACAJ;AAAA,MACAK;AAAA,IACF;AAAA,EAAA,GAGIS,IAA6B3C,EAAY,MAAM;AACnD,IAAI,CAACpB,KAA4BG,MAAkBqB,EAAY,sBAC7DkC,EAAiB,QAAQlD,CAAU;AAAA,KAEpC,CAACL,GAAeuD,GAAkBlD,GAAYR,CAAwB,CAAC;AAE1E,SAAAgE,EAAU,MAAM;AACa,IAAAD;EAAA,GAE1B,CAAC/D,CAAwB,CAAC,GAEtB,EAAE,kBAAA0D,EAAiB;AAC5B;"}
|
|
1
|
+
{"version":3,"file":"use-trial-session-navigation.js","sources":["../../../../src/features/trial-session/hooks/use-trial-session-navigation.ts"],"sourcesContent":["import type { TTeacherAvailabilityResponse } from '../api/teacher-availability';\nimport type { ITrialSessionFormFields } from '../trial-session-types';\n\nimport { useCallback, useEffect } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport { COURSE_STREAMS } from '../../milestone/constants';\nimport { useMilestoneBulkPost } from '../../milestone/create/api/milestone-bulk';\nimport { usePostStudentPreferences } from '../api/course-stream';\nimport { usePatchStudentInformation } from '../api/student-information';\nimport { usePostTeacherAvailability } from '../api/teacher-availability';\nimport { usePatchTrialHome } from '../api/trial-home';\nimport { useTrialSessionContext } from '../context/use-trial-session-context';\nimport {\n getFormattedPreferences,\n getFormattedStudentPersonalizedPreference,\n getWeekdayAndStartTimeFromPreference,\n} from '../helper';\nimport { DEFAULT_BUTTON_STATE, TrialPageId } from '../trial-session-constants';\n\nconst useTrialSessionNavigation = () => {\n const {\n updateSlideConfig,\n slideConfig,\n formData,\n updateButtonState,\n teacherId,\n studentId,\n milestoneConfig,\n handleInfoMessage,\n onTrialInformationUpdate,\n trialHomeData,\n worksheetNavigationPanel,\n } = useTrialSessionContext();\n const { nextPage, id: currentPageId } = slideConfig || {};\n const { demo_info: demoInfo } = trialHomeData;\n const { stream, region_data: regionData } = demoInfo;\n const { opportunity_country: countryCode = 'US' } = regionData || {};\n const { pageId: nextPageId } = nextPage || {};\n const {\n name,\n grade,\n goals,\n curriculum,\n studentTimezone = 'Asia/Calcutta',\n preferences = [],\n personalizedLevel = [],\n personalizedFocus = [],\n personalizedBehaviors = [],\n personalizedObjectives = [],\n personalizedPosition = [],\n } = formData || {};\n\n const disableNavButtons = useCallback(() => {\n updateButtonState('both', {\n left: { isDisabled: true, isLoading: false },\n right: { isDisabled: true, isLoading: true },\n });\n }, [updateButtonState]);\n\n const onAcknowledge = (errorMessage: string | null) => {\n if (!errorMessage) {\n const overrides: Partial<ITrialSessionFormFields> = {};\n\n if (\n nextPageId === TrialPageId.CIRCLE_GAME ||\n nextPageId === TrialPageId.CIRCLE_PUZZLE ||\n nextPageId === TrialPageId.CIRCLE_SKILL\n ) {\n overrides.matchmakingId = uuidv4();\n overrides.showCircleGameScreen = true;\n }\n\n updateSlideConfig({ id: nextPageId, ...overrides });\n }\n updateButtonState('both', DEFAULT_BUTTON_STATE);\n\n if (currentPageId === TrialPageId.LEARNING_LEVEL) {\n onTrialInformationUpdate?.();\n }\n };\n\n // API specifications\n const { patch: patchTrialSession } = usePatchTrialHome({ onComplete: onAcknowledge });\n const { patch: patchStudentInformation } = usePatchStudentInformation({\n onComplete: onAcknowledge,\n });\n const { post: postMilestoneBulk } = useMilestoneBulkPost({\n onComplete: onAcknowledge,\n });\n const { post: postStudentPreferences } = usePostStudentPreferences({\n onComplete: onAcknowledge,\n });\n\n const onTeacherAvailabilityValidate = (_: string | null, data?: TTeacherAvailabilityResponse) => {\n const notAvailable = data?.filter(item => !item.is_available) ?? [];\n\n if (notAvailable.length > 0) {\n const reason = notAvailable.map(item => item.reason).join('\\n');\n\n handleInfoMessage?.({ message: reason, position: 'bottom' });\n updateButtonState('both', DEFAULT_BUTTON_STATE);\n\n return;\n }\n\n const selectedRegularSlots = getFormattedPreferences(preferences, studentTimezone);\n\n if (selectedRegularSlots.length > 0) {\n const actionData = {\n trial_details: {\n selected_regular_slots: selectedRegularSlots,\n },\n };\n\n patchTrialSession('trial-v3-patch', {\n action: 'UPDATE_DEMO',\n action_data: actionData,\n teacher_id: teacherId,\n student_id: studentId,\n });\n } else updateButtonState('both', DEFAULT_BUTTON_STATE);\n };\n\n const { post: postTeacherAvailability } = usePostTeacherAvailability({\n onComplete: onTeacherAvailabilityValidate,\n });\n\n // Function to call API and updates states\n const handleStudentInformation = useCallback(() => {\n const [firstName, lastName] = name?.split(' ') || [];\n const payload = {\n first_name: firstName,\n last_name: lastName,\n grade,\n board: curriculum,\n demo_type: 'TRIAL_V3',\n teacher_id: teacherId,\n country_alpha_2: countryCode,\n };\n const isNumberExistsInName = /\\d/.test(name || '');\n\n if (isNumberExistsInName) {\n updateSlideConfig({ numberInNameError: true });\n } else {\n disableNavButtons();\n patchStudentInformation(studentId, payload);\n }\n }, [\n name,\n grade,\n curriculum,\n teacherId,\n countryCode,\n disableNavButtons,\n updateSlideConfig,\n patchStudentInformation,\n studentId,\n ]);\n\n const handleClassPreferences = useCallback(() => {\n const selectedRegularSlots = getFormattedPreferences(preferences, studentTimezone);\n const sessionList = getWeekdayAndStartTimeFromPreference(selectedRegularSlots);\n\n if (selectedRegularSlots.length > 0) {\n const availabilityPayload = {\n teacher_id: teacherId,\n session_list: sessionList,\n };\n\n disableNavButtons();\n postTeacherAvailability(availabilityPayload);\n } else {\n updateSlideConfig({ id: nextPageId });\n updateButtonState('both', DEFAULT_BUTTON_STATE);\n }\n }, [\n preferences,\n studentTimezone,\n teacherId,\n postTeacherAvailability,\n disableNavButtons,\n updateSlideConfig,\n nextPageId,\n updateButtonState,\n ]);\n\n const handleMileStoneBulkPost = useCallback(() => {\n const payload = {\n course_stream: stream,\n grade,\n teacher_id: teacherId,\n board: curriculum,\n goals,\n };\n\n disableNavButtons();\n postMilestoneBulk(payload, {\n studentId,\n });\n }, [\n curriculum,\n disableNavButtons,\n goals,\n grade,\n postMilestoneBulk,\n stream,\n studentId,\n teacherId,\n ]);\n\n const handleStudentPreferencesPatch = useCallback(() => {\n const personalizedPreferences = getFormattedStudentPersonalizedPreference(milestoneConfig, [\n ...personalizedLevel,\n ...personalizedFocus,\n ...personalizedBehaviors,\n ...personalizedObjectives,\n ...personalizedPosition,\n ]);\n\n const payload = { preferences: personalizedPreferences };\n const meta = { stream: COURSE_STREAMS.MATH, studentId };\n\n disableNavButtons();\n postStudentPreferences(payload, meta);\n }, [\n milestoneConfig,\n personalizedLevel,\n personalizedFocus,\n personalizedBehaviors,\n personalizedObjectives,\n personalizedPosition,\n studentId,\n disableNavButtons,\n postStudentPreferences,\n ]);\n\n // Navigation logic\n const handleNavigation = useCallback(\n (dir: string, id?: string) => {\n if (!updateSlideConfig) return;\n\n const isStudentProfilePage = currentPageId === TrialPageId.STUDENT_PROFILE;\n const isLearningPlanSlide = currentPageId === TrialPageId.LEARNING_PLAN;\n const overrides: Partial<ITrialSessionFormFields> = {};\n\n if (\n id === TrialPageId.CIRCLE_GAME ||\n id === TrialPageId.CIRCLE_PUZZLE ||\n id === TrialPageId.CIRCLE_SKILL\n ) {\n overrides.matchmakingId = uuidv4();\n overrides.showCircleGameScreen = true;\n }\n\n if (dir === 'prev') {\n updateSlideConfig({\n id,\n ...(isStudentProfilePage && { studentProfile: undefined }),\n ...(isLearningPlanSlide && {\n chapterId: undefined,\n }),\n ...overrides,\n });\n updateButtonState('both', DEFAULT_BUTTON_STATE);\n }\n\n if (dir === 'next') {\n switch (currentPageId) {\n //TODO: remove STUDENT_INFORMATION\n case TrialPageId.STUDENT_INFORMATION:\n case TrialPageId.SCHOOL_GOALS:\n handleStudentInformation();\n break;\n case TrialPageId.LEARNING_WORKSHEET:\n handleMileStoneBulkPost();\n break;\n case TrialPageId.CLASS_PREFERENCE:\n handleClassPreferences();\n break;\n case TrialPageId.LEARNING_LEVEL:\n handleStudentPreferencesPatch();\n break;\n case TrialPageId.LEARNING_PLAN:\n updateSlideConfig({ id, chapterId: undefined, ...overrides });\n break;\n default: {\n updateSlideConfig({ id, ...overrides });\n updateButtonState('both', DEFAULT_BUTTON_STATE);\n }\n }\n }\n },\n [\n updateSlideConfig,\n currentPageId,\n updateButtonState,\n handleStudentInformation,\n handleMileStoneBulkPost,\n handleClassPreferences,\n handleStudentPreferencesPatch,\n ],\n );\n\n const sessionWorksheetNavigation = useCallback(() => {\n if (!worksheetNavigationPanel && currentPageId === TrialPageId.LEARNING_WORKSHEET) {\n handleNavigation('next', nextPageId);\n }\n }, [currentPageId, handleNavigation, nextPageId, worksheetNavigationPanel]);\n\n useEffect(() => {\n sessionWorksheetNavigation();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [worksheetNavigationPanel]);\n\n return { handleNavigation };\n};\n\nexport { useTrialSessionNavigation };\n"],"names":["useTrialSessionNavigation","updateSlideConfig","slideConfig","formData","updateButtonState","teacherId","studentId","milestoneConfig","handleInfoMessage","onTrialInformationUpdate","trialHomeData","worksheetNavigationPanel","useTrialSessionContext","nextPage","currentPageId","demoInfo","stream","regionData","countryCode","nextPageId","name","grade","goals","curriculum","studentTimezone","preferences","personalizedLevel","personalizedFocus","personalizedBehaviors","personalizedObjectives","personalizedPosition","disableNavButtons","useCallback","onAcknowledge","errorMessage","overrides","TrialPageId","uuidv4","DEFAULT_BUTTON_STATE","patchTrialSession","usePatchTrialHome","patchStudentInformation","usePatchStudentInformation","postMilestoneBulk","useMilestoneBulkPost","postStudentPreferences","usePostStudentPreferences","onTeacherAvailabilityValidate","_","data","notAvailable","item","reason","selectedRegularSlots","getFormattedPreferences","postTeacherAvailability","usePostTeacherAvailability","handleStudentInformation","firstName","lastName","payload","handleClassPreferences","sessionList","getWeekdayAndStartTimeFromPreference","availabilityPayload","handleMileStoneBulkPost","handleStudentPreferencesPatch","getFormattedStudentPersonalizedPreference","meta","COURSE_STREAMS","handleNavigation","dir","id","isStudentProfilePage","isLearningPlanSlide","sessionWorksheetNavigation","useEffect"],"mappings":";;;;;;;;;;;AAoBA,MAAMA,KAA4B,MAAM;AAChC,QAAA;AAAA,IACJ,mBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,UAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,eAAAC;AAAA,IACA,0BAAAC;AAAA,MACEC,GAAuB,GACrB,EAAE,UAAAC,GAAU,IAAIC,EAAc,IAAIZ,KAAe,CAAA,GACjD,EAAE,WAAWa,EAAa,IAAAL,GAC1B,EAAE,QAAAM,GAAQ,aAAaC,EAAA,IAAeF,GACtC,EAAE,qBAAqBG,IAAc,KAAK,IAAID,KAAc,CAAA,GAC5D,EAAE,QAAQE,MAAeN,KAAY,CAAA,GACrC;AAAA,IACJ,MAAAO;AAAA,IACA,OAAAC;AAAA,IACA,OAAAC;AAAA,IACA,YAAAC;AAAA,IACA,iBAAAC,IAAkB;AAAA,IAClB,aAAAC,IAAc,CAAC;AAAA,IACf,mBAAAC,IAAoB,CAAC;AAAA,IACrB,mBAAAC,IAAoB,CAAC;AAAA,IACrB,uBAAAC,IAAwB,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@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as E, jsxs as ne } from "react/jsx-runtime";
|
|
2
2
|
import { memo as re, useState as oe, useMemo as P, useCallback as L, useEffect as S } from "react";
|
|
3
3
|
import { PREFERENCE_CATEGORY as H } from "../milestone/constants.js";
|
|
4
4
|
import { getGradesFromConfig as se } from "../milestone/create/milestone-create-helpers.js";
|
|
@@ -20,7 +20,7 @@ const Te = re((q) => {
|
|
|
20
20
|
height: J = "100vh",
|
|
21
21
|
trialHomeData: e,
|
|
22
22
|
milestoneConfig: a,
|
|
23
|
-
onFormDataChange:
|
|
23
|
+
onFormDataChange: u,
|
|
24
24
|
worksheet: R,
|
|
25
25
|
studentId: i,
|
|
26
26
|
teacherId: l,
|
|
@@ -30,15 +30,15 @@ const Te = re((q) => {
|
|
|
30
30
|
studentAbsentInClass: O,
|
|
31
31
|
openEndClassModal: F,
|
|
32
32
|
onTrialInformationUpdate: G,
|
|
33
|
-
onStudentTimezoneUpdate:
|
|
33
|
+
onStudentTimezoneUpdate: p,
|
|
34
34
|
handleInfoMessage: N,
|
|
35
35
|
onRemoveOptionalSlides: b,
|
|
36
36
|
classDuration: j,
|
|
37
37
|
studentTimezone: c,
|
|
38
38
|
classTimeAlertConfig: w
|
|
39
|
-
} = q, t = o === "TEACHER", { pages:
|
|
40
|
-
() =>
|
|
41
|
-
[
|
|
39
|
+
} = q, t = o === "TEACHER", { pages: g = [] } = e, [r, Y] = oe(s), C = t ? r : s, h = C == null ? void 0 : C.id, A = P(
|
|
40
|
+
() => g.find((n) => n.id === h) ?? g[0],
|
|
41
|
+
[h, g]
|
|
42
42
|
), M = P(() => {
|
|
43
43
|
const n = {
|
|
44
44
|
circleConfig: e.circle_trial_game_config,
|
|
@@ -111,15 +111,15 @@ const Te = re((q) => {
|
|
|
111
111
|
]
|
|
112
112
|
);
|
|
113
113
|
S(() => {
|
|
114
|
-
r &&
|
|
115
|
-
}, [
|
|
116
|
-
c ||
|
|
117
|
-
}, [
|
|
114
|
+
r && u && u(r);
|
|
115
|
+
}, [u, r]), S(() => {
|
|
116
|
+
c || p == null || p();
|
|
117
|
+
}, [h]);
|
|
118
118
|
const $ = L(
|
|
119
119
|
(n) => {
|
|
120
120
|
const { student: m, intel_student: Q } = n, { student_preference: W } = Q || {}, { preferences: k = [] } = W || {}, { name: X, grade: z } = m || {}, Z = !!se(a).find(
|
|
121
121
|
(te) => te.id === z
|
|
122
|
-
), ee = U(k, H.OBJECTIVES),
|
|
122
|
+
), ee = U(k, H.OBJECTIVES), f = U(
|
|
123
123
|
k,
|
|
124
124
|
H.POSITION,
|
|
125
125
|
!0
|
|
@@ -129,17 +129,17 @@ const Te = re((q) => {
|
|
|
129
129
|
name: X,
|
|
130
130
|
grade: Z ? z : "",
|
|
131
131
|
personalizedObjectives: ee,
|
|
132
|
-
personalizedPosition:
|
|
133
|
-
personalizedLevel:
|
|
132
|
+
personalizedPosition: f,
|
|
133
|
+
personalizedLevel: f.length > 0 && f[0] ? [ie[f[0]]] : []
|
|
134
134
|
});
|
|
135
135
|
},
|
|
136
136
|
[a, c, d]
|
|
137
137
|
);
|
|
138
138
|
return S(() => {
|
|
139
139
|
t && e && $(e);
|
|
140
|
-
}, [c, $, e, t]), /* @__PURE__ */
|
|
141
|
-
/* @__PURE__ */
|
|
142
|
-
/* @__PURE__ */
|
|
140
|
+
}, [c, $, e, t]), /* @__PURE__ */ E(le.Provider, { value: K, children: /* @__PURE__ */ ne(ae, { $height: J, $flexDirection: "row", $justifyContent: "center", $alignItems: "center", children: [
|
|
141
|
+
/* @__PURE__ */ E(de, {}),
|
|
142
|
+
/* @__PURE__ */ E(me, {})
|
|
143
143
|
] }) });
|
|
144
144
|
});
|
|
145
145
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trial-session-view.js","sources":["../../../src/features/trial-session/trial-session-view.tsx"],"sourcesContent":["import type { ITrialCircleGameParams } from './comps/trial-circle-game/trial-circle-game-types';\nimport type {\n ITrialSessionContext,\n ITrialSessionViewProps,\n ITrialSessionFormFields,\n ITrialHomeData,\n} from './trial-session-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback, useEffect, useMemo, useState } from 'react';\n\nimport { PREFERENCE_CATEGORY } from '../milestone/constants';\nimport { getGradesFromConfig } from '../milestone/create/milestone-create-helpers';\nimport FlexView from '../ui/layout/flex-view';\nimport { PREFERENCE_CODE_MAP } from './comps/student-feedback/student-feedback-constants';\nimport TrialSessionContext from './context/trial-session-context';\nimport { getPreferenceCodesByCategory } from './helper';\nimport { useButtonStateForLeftPanel } from './hooks/use-left-panel-button-state';\nimport LeftPanel from './left-panel';\nimport RightPanel from './right-panel';\n\nconst TrialSessionView: FC<ITrialSessionViewProps> = memo(props => {\n const {\n countryCode,\n userType,\n teacherPanel,\n studentPanel,\n trialGameUrl,\n formData: formDataProps,\n height = '100vh',\n trialHomeData,\n milestoneConfig,\n onFormDataChange,\n worksheet,\n studentId,\n teacherId,\n classStartedOn,\n worksheetNavigationPanel,\n questionsRatingPanel,\n studentAbsentInClass,\n openEndClassModal,\n onTrialInformationUpdate,\n onStudentTimezoneUpdate,\n handleInfoMessage,\n onRemoveOptionalSlides,\n classDuration,\n studentTimezone,\n classTimeAlertConfig,\n } = props;\n const isTeacher = userType === 'TEACHER';\n const { pages: slides = [] } = trialHomeData;\n\n const [formData, setFormData] = useState<ITrialSessionFormFields | undefined>(formDataProps);\n const formDataToUse = isTeacher ? formData : formDataProps;\n const currentSlideId = formDataToUse?.id;\n\n const currentSlideConfig = useMemo(\n () => slides.find(config => config.id === currentSlideId) ?? slides[0]!,\n [currentSlideId, slides],\n );\n\n const circleGames = useMemo(() => {\n const data = {\n circleConfig: trialHomeData.circle_trial_game_config,\n playerDetails: {\n userId: isTeacher ? teacherId : studentId,\n circle_username: trialHomeData[isTeacher ? 'teacher' : 'student'].circle_username,\n user_avatar: trialHomeData[isTeacher ? 'teacher' : 'student'].user_avatar,\n playerType: userType,\n countryCode: countryCode,\n },\n } as ITrialCircleGameParams;\n\n if (userType === 'STUDENT') {\n data.playerDetails.grade = trialHomeData.student.grade;\n }\n\n return data;\n }, [countryCode, isTeacher, studentId, teacherId, trialHomeData, userType]);\n\n const updateSlideConfig = useCallback((config: Partial<ITrialSessionFormFields>) => {\n setFormData(previousProps => {\n if (!previousProps) return config as ITrialSessionFormFields;\n\n return { ...previousProps, ...config };\n });\n }, []);\n const { buttonState, updateButtonState } = useButtonStateForLeftPanel();\n\n const contextValue = useMemo<ITrialSessionContext>(\n () => ({\n teacherPanel,\n studentPanel,\n isTeacher,\n slideConfig: currentSlideConfig,\n milestoneConfig,\n formData: isTeacher ? formData : formDataProps,\n updateSlideConfig,\n worksheet,\n buttonState,\n updateButtonState,\n studentId,\n teacherId,\n classStartedOn,\n trialHomeData,\n worksheetNavigationPanel,\n questionsRatingPanel,\n onTrialInformationUpdate,\n openEndClassModal,\n studentAbsentInClass,\n circleGames,\n trialGameUrl,\n handleInfoMessage,\n onRemoveOptionalSlides,\n classDuration,\n classTimeAlertConfig,\n }),\n [\n teacherPanel,\n studentPanel,\n isTeacher,\n currentSlideConfig,\n milestoneConfig,\n formData,\n formDataProps,\n updateSlideConfig,\n worksheet,\n buttonState,\n updateButtonState,\n studentId,\n teacherId,\n classStartedOn,\n trialHomeData,\n worksheetNavigationPanel,\n questionsRatingPanel,\n onTrialInformationUpdate,\n openEndClassModal,\n studentAbsentInClass,\n circleGames,\n trialGameUrl,\n handleInfoMessage,\n onRemoveOptionalSlides,\n classDuration,\n classTimeAlertConfig,\n ],\n );\n\n useEffect(() => {\n if (formData && onFormDataChange) {\n onFormDataChange(formData);\n }\n }, [onFormDataChange, formData]);\n\n useEffect(() => {\n if (!studentTimezone) onStudentTimezoneUpdate?.();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [currentSlideId]);\n\n const onRenderUpdateSlideConfig = useCallback(\n (homeData: ITrialHomeData) => {\n const { student, intel_student: intelStudent } = homeData;\n const { student_preference: studentPreference } = intelStudent || {};\n const { preferences = [] } = studentPreference || {};\n const { name: studentName, grade: studentGrade } = student || {};\n\n const IsGradeExistInMilestoneConfig = !!getGradesFromConfig(milestoneConfig).find(\n element => element.id === studentGrade,\n );\n\n const objectives = getPreferenceCodesByCategory(preferences, PREFERENCE_CATEGORY.OBJECTIVES);\n const position = getPreferenceCodesByCategory(\n preferences,\n PREFERENCE_CATEGORY.POSITION,\n true,\n );\n\n updateSlideConfig({\n studentTimezone,\n name: studentName,\n grade: IsGradeExistInMilestoneConfig ? studentGrade : '',\n personalizedObjectives: objectives,\n personalizedPosition: position,\n personalizedLevel: position[0]\n ? [PREFERENCE_CODE_MAP[position[0] as keyof typeof PREFERENCE_CODE_MAP]]\n : [],\n });\n },\n [milestoneConfig, studentTimezone, updateSlideConfig],\n );\n\n useEffect(() => {\n if (isTeacher && trialHomeData) {\n onRenderUpdateSlideConfig(trialHomeData);\n }\n }, [studentTimezone, onRenderUpdateSlideConfig, trialHomeData, isTeacher]);\n\n return (\n <TrialSessionContext.Provider value={contextValue}>\n <FlexView $height={height} $flexDirection=\"row\" $justifyContent=\"center\" $alignItems=\"center\">\n <LeftPanel />\n <RightPanel />\n </FlexView>\n </TrialSessionContext.Provider>\n );\n});\n\nexport default TrialSessionView;\n"],"names":["TrialSessionView","memo","props","countryCode","userType","teacherPanel","studentPanel","trialGameUrl","formDataProps","height","trialHomeData","milestoneConfig","onFormDataChange","worksheet","studentId","teacherId","classStartedOn","worksheetNavigationPanel","questionsRatingPanel","studentAbsentInClass","openEndClassModal","onTrialInformationUpdate","onStudentTimezoneUpdate","handleInfoMessage","onRemoveOptionalSlides","classDuration","studentTimezone","classTimeAlertConfig","isTeacher","slides","formData","setFormData","useState","formDataToUse","currentSlideId","currentSlideConfig","useMemo","config","circleGames","data","updateSlideConfig","useCallback","previousProps","buttonState","updateButtonState","useButtonStateForLeftPanel","contextValue","useEffect","onRenderUpdateSlideConfig","homeData","student","intelStudent","studentPreference","preferences","studentName","studentGrade","IsGradeExistInMilestoneConfig","getGradesFromConfig","element","objectives","getPreferenceCodesByCategory","PREFERENCE_CATEGORY","position","PREFERENCE_CODE_MAP","jsx","TrialSessionContext","jsxs","FlexView","LeftPanel","RightPanel"],"mappings":";;;;;;;;;;;AAqBM,MAAAA,KAA+CC,GAAK,CAASC,MAAA;AAC3D,QAAA;AAAA,IACJ,aAAAC;AAAA,IACA,UAAAC;AAAA,IACA,cAAAC;AAAA,IACA,cAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAUC;AAAA,IACV,QAAAC,IAAS;AAAA,IACT,eAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,yBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,wBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,sBAAAC;AAAA,EACE,IAAAzB,GACE0B,IAAYxB,MAAa,WACzB,EAAE,OAAOyB,IAAS,OAAOnB,GAEzB,CAACoB,GAAUC,CAAW,IAAIC,GAA8CxB,CAAa,GACrFyB,IAAgBL,IAAYE,IAAWtB,GACvC0B,IAAiBD,KAAA,gBAAAA,EAAe,IAEhCE,IAAqBC;AAAA,IACzB,MAAMP,EAAO,KAAK,CAAAQ,MAAUA,EAAO,OAAOH,CAAc,KAAKL,EAAO,CAAC;AAAA,IACrE,CAACK,GAAgBL,CAAM;AAAA,EAAA,GAGnBS,IAAcF,EAAQ,MAAM;AAChC,UAAMG,IAAO;AAAA,MACX,cAAc7B,EAAc;AAAA,MAC5B,eAAe;AAAA,QACb,QAAQkB,IAAYb,IAAYD;AAAA,QAChC,iBAAiBJ,EAAckB,IAAY,YAAY,SAAS,EAAE;AAAA,QAClE,aAAalB,E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C,GAGtE,gBAAAoC,EAAAC,GAAoB,UAApB,EAA6B,OAAOnB,GACnC,UAAA,gBAAAoB,GAACC,IAAS,EAAA,SAAS1D,GAAQ,gBAAe,OAAM,iBAAgB,UAAS,aAAY,UACnF,UAAA;AAAA,IAAA,gBAAAuD,EAACI,IAAU,EAAA;AAAA,sBACVC,IAAW,EAAA;AAAA,EAAA,EACd,CAAA,EACF,CAAA;AAEJ,CAAC;"}
|
|
1
|
+
{"version":3,"file":"trial-session-view.js","sources":["../../../src/features/trial-session/trial-session-view.tsx"],"sourcesContent":["import type { ITrialCircleGameParams } from './comps/trial-circle-game/trial-circle-game-types';\nimport type {\n ITrialSessionContext,\n ITrialSessionViewProps,\n ITrialSessionFormFields,\n ITrialHomeData,\n} from './trial-session-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback, useEffect, useMemo, useState } from 'react';\n\nimport { PREFERENCE_CATEGORY } from '../milestone/constants';\nimport { getGradesFromConfig } from '../milestone/create/milestone-create-helpers';\nimport FlexView from '../ui/layout/flex-view';\nimport { PREFERENCE_CODE_MAP } from './comps/student-feedback/student-feedback-constants';\nimport TrialSessionContext from './context/trial-session-context';\nimport { getPreferenceCodesByCategory } from './helper';\nimport { useButtonStateForLeftPanel } from './hooks/use-left-panel-button-state';\nimport LeftPanel from './left-panel';\nimport RightPanel from './right-panel';\n\nconst TrialSessionView: FC<ITrialSessionViewProps> = memo(props => {\n const {\n countryCode,\n userType,\n teacherPanel,\n studentPanel,\n trialGameUrl,\n formData: formDataProps,\n height = '100vh',\n trialHomeData,\n milestoneConfig,\n onFormDataChange,\n worksheet,\n studentId,\n teacherId,\n classStartedOn,\n worksheetNavigationPanel,\n questionsRatingPanel,\n studentAbsentInClass,\n openEndClassModal,\n onTrialInformationUpdate,\n onStudentTimezoneUpdate,\n handleInfoMessage,\n onRemoveOptionalSlides,\n classDuration,\n studentTimezone,\n classTimeAlertConfig,\n } = props;\n const isTeacher = userType === 'TEACHER';\n const { pages: slides = [] } = trialHomeData;\n\n const [formData, setFormData] = useState<ITrialSessionFormFields | undefined>(formDataProps);\n const formDataToUse = isTeacher ? formData : formDataProps;\n const currentSlideId = formDataToUse?.id;\n\n const currentSlideConfig = useMemo(\n () => slides.find(config => config.id === currentSlideId) ?? slides[0]!,\n [currentSlideId, slides],\n );\n\n const circleGames = useMemo(() => {\n const data = {\n circleConfig: trialHomeData.circle_trial_game_config,\n playerDetails: {\n userId: isTeacher ? teacherId : studentId,\n circle_username: trialHomeData[isTeacher ? 'teacher' : 'student'].circle_username,\n user_avatar: trialHomeData[isTeacher ? 'teacher' : 'student'].user_avatar,\n playerType: userType,\n countryCode: countryCode,\n },\n } as ITrialCircleGameParams;\n\n if (userType === 'STUDENT') {\n data.playerDetails.grade = trialHomeData.student.grade;\n }\n\n return data;\n }, [countryCode, isTeacher, studentId, teacherId, trialHomeData, userType]);\n\n const updateSlideConfig = useCallback((config: Partial<ITrialSessionFormFields>) => {\n setFormData(previousProps => {\n if (!previousProps) return config as ITrialSessionFormFields;\n\n return { ...previousProps, ...config };\n });\n }, []);\n const { buttonState, updateButtonState } = useButtonStateForLeftPanel();\n\n const contextValue = useMemo<ITrialSessionContext>(\n () => ({\n teacherPanel,\n studentPanel,\n isTeacher,\n slideConfig: currentSlideConfig,\n milestoneConfig,\n formData: isTeacher ? formData : formDataProps,\n updateSlideConfig,\n worksheet,\n buttonState,\n updateButtonState,\n studentId,\n teacherId,\n classStartedOn,\n trialHomeData,\n worksheetNavigationPanel,\n questionsRatingPanel,\n onTrialInformationUpdate,\n openEndClassModal,\n studentAbsentInClass,\n circleGames,\n trialGameUrl,\n handleInfoMessage,\n onRemoveOptionalSlides,\n classDuration,\n classTimeAlertConfig,\n }),\n [\n teacherPanel,\n studentPanel,\n isTeacher,\n currentSlideConfig,\n milestoneConfig,\n formData,\n formDataProps,\n updateSlideConfig,\n worksheet,\n buttonState,\n updateButtonState,\n studentId,\n teacherId,\n classStartedOn,\n trialHomeData,\n worksheetNavigationPanel,\n questionsRatingPanel,\n onTrialInformationUpdate,\n openEndClassModal,\n studentAbsentInClass,\n circleGames,\n trialGameUrl,\n handleInfoMessage,\n onRemoveOptionalSlides,\n classDuration,\n classTimeAlertConfig,\n ],\n );\n\n useEffect(() => {\n if (formData && onFormDataChange) {\n onFormDataChange(formData);\n }\n }, [onFormDataChange, formData]);\n\n useEffect(() => {\n if (!studentTimezone) onStudentTimezoneUpdate?.();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [currentSlideId]);\n\n const onRenderUpdateSlideConfig = useCallback(\n (homeData: ITrialHomeData) => {\n const { student, intel_student: intelStudent } = homeData;\n const { student_preference: studentPreference } = intelStudent || {};\n const { preferences = [] } = studentPreference || {};\n const { name: studentName, grade: studentGrade } = student || {};\n\n const IsGradeExistInMilestoneConfig = !!getGradesFromConfig(milestoneConfig).find(\n element => element.id === studentGrade,\n );\n\n const objectives = getPreferenceCodesByCategory(preferences, PREFERENCE_CATEGORY.OBJECTIVES);\n const position = getPreferenceCodesByCategory(\n preferences,\n PREFERENCE_CATEGORY.POSITION,\n true,\n );\n\n updateSlideConfig({\n studentTimezone,\n name: studentName,\n grade: IsGradeExistInMilestoneConfig ? studentGrade : '',\n personalizedObjectives: objectives,\n personalizedPosition: position,\n personalizedLevel:\n position.length > 0 && position[0]\n ? [PREFERENCE_CODE_MAP[position[0] as keyof typeof PREFERENCE_CODE_MAP]]\n : [],\n });\n },\n [milestoneConfig, studentTimezone, updateSlideConfig],\n );\n\n useEffect(() => {\n if (isTeacher && trialHomeData) {\n onRenderUpdateSlideConfig(trialHomeData);\n }\n }, [studentTimezone, onRenderUpdateSlideConfig, trialHomeData, isTeacher]);\n\n return (\n <TrialSessionContext.Provider value={contextValue}>\n <FlexView $height={height} $flexDirection=\"row\" $justifyContent=\"center\" $alignItems=\"center\">\n <LeftPanel />\n <RightPanel />\n </FlexView>\n </TrialSessionContext.Provider>\n );\n});\n\nexport default TrialSessionView;\n"],"names":["TrialSessionView","memo","props","countryCode","userType","teacherPanel","studentPanel","trialGameUrl","formDataProps","height","trialHomeData","milestoneConfig","onFormDataChange","worksheet","studentId","teacherId","classStartedOn","worksheetNavigationPanel","questionsRatingPanel","studentAbsentInClass","openEndClassModal","onTrialInformationUpdate","onStudentTimezoneUpdate","handleInfoMessage","onRemoveOptionalSlides","classDuration","studentTimezone","classTimeAlertConfig","isTeacher","slides","formData","setFormData","useState","formDataToUse","currentSlideId","currentSlideConfig","useMemo","config","circleGames","data","updateSlideConfig","useCallback","previousProps","buttonState","updateButtonState","useButtonStateForLeftPanel","contextValue","useEffect","onRenderUpdateSlideConfig","homeData","student","intelStudent","studentPreference","preferences","studentName","studentGrade","IsGradeExistInMilestoneConfig","getGradesFromConfig","element","objectives","getPreferenceCodesByCategory","PREFERENCE_CATEGORY","position","PREFERENCE_CODE_MAP","jsx","TrialSessionContext","jsxs","FlexView","LeftPanel","RightPanel"],"mappings":";;;;;;;;;;;AAqBM,MAAAA,KAA+CC,GAAK,CAASC,MAAA;AAC3D,QAAA;AAAA,IACJ,aAAAC;AAAA,IACA,UAAAC;AAAA,IACA,cAAAC;AAAA,IACA,cAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAUC;AAAA,IACV,QAAAC,IAAS;AAAA,IACT,eAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,yBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,wBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,sBAAAC;AAAA,EACE,IAAAzB,GACE0B,IAAYxB,MAAa,WACzB,EAAE,OAAOyB,IAAS,OAAOnB,GAEzB,CAACoB,GAAUC,CAAW,IAAIC,GAA8CxB,CAAa,GACrFyB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