@cuemath/leap 4.1.1-beta.2 → 4.1.1-beta.4
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,29 +1,30 @@
|
|
|
1
1
|
import { jsx as e, jsxs as n, Fragment as S } from "react/jsx-runtime";
|
|
2
|
-
import { memo as ye, useState as
|
|
3
|
-
import { usePTMReportGet as
|
|
4
|
-
import { EPTMTypes as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { Container as
|
|
2
|
+
import { memo as ye, useState as Pe, useCallback as l, useEffect as _ } from "react";
|
|
3
|
+
import { usePTMReportGet as Me } from "./api/use-ptm-report-get.js";
|
|
4
|
+
import { EPTMTypes as Ne } from "./ptm-report-types.js";
|
|
5
|
+
import De from "../../../ui/loader/app-loader/app-loader.js";
|
|
6
|
+
import Oe from "./comps/student-info/student-info.js";
|
|
7
|
+
import { Container as ve } from "./ptm-report-styled.js";
|
|
8
8
|
import Ae from "./comps/key-need/key-need.js";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
9
|
+
import je from "../../../ui/layout/flex-view.js";
|
|
10
|
+
import Fe from "./comps/teacher-observations/teacher-observations.js";
|
|
11
11
|
import xe from "./comps/strategies/strategies.js";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
12
|
+
import Ge from "./comps/parent-support/parent-support.js";
|
|
13
|
+
import Ue from "./comps/upcoming-chapters/upcoming-chapters.js";
|
|
14
|
+
import Ee from "./comps/real-world-projects/real-world-projects.js";
|
|
15
|
+
import He from "./comps/school-support/school-support.js";
|
|
16
16
|
import We from "../../../ui/error/error.js";
|
|
17
17
|
import $e from "./comps/sticky-footer/sticky-footer.js";
|
|
18
18
|
import Xe from "../../../ui/separator/separator.js";
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
import { IS_APP_RUNNING_IN_RN as Ke } from "../../../../constants/app-config.js";
|
|
20
|
+
const Le = ({ ptmId: o, onAPIComplete: s, onFeedback: c }) => {
|
|
21
|
+
const [t, T] = Pe(null), {
|
|
21
22
|
get: u,
|
|
22
23
|
data: p,
|
|
23
24
|
isProcessing: b,
|
|
24
25
|
isProcessed: i,
|
|
25
26
|
isProcessingFailed: a
|
|
26
|
-
} =
|
|
27
|
+
} = Me(o), { report: w, meta: y } = p || {}, { parent_feedback_given: P } = y || {}, { teacher_data: M } = w || {}, { name: k, gender: N } = M || {}, R = N === "female" ? "Ma'am" : "Sir", D = l((r) => {
|
|
27
28
|
T(r);
|
|
28
29
|
}, []), C = l(() => {
|
|
29
30
|
if (c && t) {
|
|
@@ -40,26 +41,26 @@ const Ke = ({ ptmId: o, onAPIComplete: s, onFeedback: c }) => {
|
|
|
40
41
|
}, [i, a, s]), _(() => {
|
|
41
42
|
t && (console.log("submitting feedback:", t), C());
|
|
42
43
|
}, [t, C]), b || !p)
|
|
43
|
-
return /* @__PURE__ */ e(
|
|
44
|
+
return /* @__PURE__ */ e(De, { height: "100dvh" });
|
|
44
45
|
if (a)
|
|
45
46
|
return /* @__PURE__ */ e(We, { onTryAgain: m, height: "100dvh" });
|
|
46
|
-
const { ptm_config:
|
|
47
|
-
teacher_observation:
|
|
48
|
-
learning_strategy:
|
|
47
|
+
const { ptm_config: O, report: v } = p || {}, { ptm_type: h, config: A } = O || {}, { ptm_report_sections: j, late_if_minutes: F } = A || {}, {
|
|
48
|
+
teacher_observation: x,
|
|
49
|
+
learning_strategy: G,
|
|
49
50
|
parent_support: U,
|
|
50
|
-
school_support:
|
|
51
|
-
} =
|
|
52
|
-
focus_area:
|
|
53
|
-
strengths:
|
|
54
|
-
teacher_remarks:
|
|
55
|
-
} =
|
|
51
|
+
school_support: E
|
|
52
|
+
} = j || {}, { subsections: H } = E || {}, { homework_help: W, test_help: $ } = H || {}, { options: X } = U || {}, { strategies: K } = G || {}, { subsections: L } = x || {}, {
|
|
53
|
+
focus_area: V,
|
|
54
|
+
strengths: q,
|
|
55
|
+
teacher_remarks: z
|
|
56
|
+
} = L || {}, { areas: B = [], report_tag: J } = V || {}, { areas: Q = [] } = q || {}, { report_tag: Y } = z || {}, { report_sections: Z, student_data: I } = v, {
|
|
56
57
|
teacher_observation: ee,
|
|
57
58
|
parent_support: te,
|
|
58
59
|
strategies: oe,
|
|
59
60
|
real_world_project: re,
|
|
60
61
|
school_support: se,
|
|
61
62
|
upcoming_chapters: ae
|
|
62
|
-
} =
|
|
63
|
+
} = Z || {}, { homework_help: ne, test_help: ce } = se || {}, { upcoming_chapters: pe } = ae || {}, {
|
|
63
64
|
strengths: ie = {},
|
|
64
65
|
focus_area: me,
|
|
65
66
|
teacher_remarks: he
|
|
@@ -71,61 +72,61 @@ const Ke = ({ ptmId: o, onAPIComplete: s, onFeedback: c }) => {
|
|
|
71
72
|
homework_data: de,
|
|
72
73
|
late_class_data: le = [],
|
|
73
74
|
real_world_project: _e
|
|
74
|
-
} =
|
|
75
|
+
} = I || {}, { classes_completed: ue, weeks_completed: ke } = fe || {}, { sheets_assigned: Re, sheets_not_completed: Ce } = de || {}, Se = B.find(
|
|
75
76
|
({ area_key: r }) => r === me
|
|
76
|
-
), Te = (f == null ? void 0 : f.key_need) ?? "", d = h ===
|
|
77
|
-
return /* @__PURE__ */ n(
|
|
78
|
-
/* @__PURE__ */ e(
|
|
79
|
-
/* @__PURE__ */ n(
|
|
77
|
+
), Te = (f == null ? void 0 : f.key_need) ?? "", d = h === Ne.ON_DEMAND, be = le.length, we = h && h.split("_").includes("UPGRADE");
|
|
78
|
+
return /* @__PURE__ */ n(ve, { children: [
|
|
79
|
+
/* @__PURE__ */ e(Oe, { name: g, grade: ge }),
|
|
80
|
+
/* @__PURE__ */ n(je, { $gutterX: 1, $gapX: 1, children: [
|
|
80
81
|
/* @__PURE__ */ e(Ae, { text: Te }),
|
|
81
82
|
(d || we) && /* @__PURE__ */ n(S, { children: [
|
|
82
|
-
/* @__PURE__ */ e(
|
|
83
|
+
/* @__PURE__ */ e(Ee, { projectReport: re, projectInfo: _e }),
|
|
83
84
|
/* @__PURE__ */ e(
|
|
84
|
-
|
|
85
|
+
He,
|
|
85
86
|
{
|
|
86
87
|
homeworkHelpReport: ne,
|
|
87
|
-
homeworkHelpConfig:
|
|
88
|
+
homeworkHelpConfig: W,
|
|
88
89
|
testHelpReport: ce,
|
|
89
|
-
testHelpConfig:
|
|
90
|
+
testHelpConfig: $,
|
|
90
91
|
studentName: g,
|
|
91
92
|
isOnDemandPTM: d
|
|
92
93
|
}
|
|
93
94
|
)
|
|
94
95
|
] }),
|
|
95
96
|
/* @__PURE__ */ e(
|
|
96
|
-
|
|
97
|
+
Fe,
|
|
97
98
|
{
|
|
98
|
-
strengthAreas:
|
|
99
|
+
strengthAreas: Q,
|
|
99
100
|
strengthsReport: ie,
|
|
100
101
|
focusArea: Se,
|
|
101
|
-
focusAreaReportTag:
|
|
102
|
+
focusAreaReportTag: J,
|
|
102
103
|
teacherRemarks: he,
|
|
103
|
-
teacherRemarkTag:
|
|
104
|
+
teacherRemarkTag: Y
|
|
104
105
|
}
|
|
105
106
|
),
|
|
106
|
-
/* @__PURE__ */ e(xe, { report: oe, strategyConfig:
|
|
107
|
+
/* @__PURE__ */ e(xe, { report: oe, strategyConfig: K }),
|
|
107
108
|
/* @__PURE__ */ e(
|
|
108
|
-
|
|
109
|
+
Ge,
|
|
109
110
|
{
|
|
110
111
|
report: te,
|
|
111
|
-
options:
|
|
112
|
+
options: X,
|
|
112
113
|
classesCompleted: ue,
|
|
113
114
|
weeksCompleted: ke,
|
|
114
115
|
sheetsAssigned: Re,
|
|
115
116
|
sheetsNotCompleted: Ce,
|
|
116
117
|
lateClassesCount: be,
|
|
117
|
-
lateIfMinutes:
|
|
118
|
+
lateIfMinutes: F
|
|
118
119
|
}
|
|
119
120
|
),
|
|
120
|
-
d && /* @__PURE__ */ e(
|
|
121
|
+
d && /* @__PURE__ */ e(Ue, { chapters: pe })
|
|
121
122
|
] }),
|
|
122
|
-
!
|
|
123
|
+
!P && Ke && /* @__PURE__ */ n(S, { children: [
|
|
123
124
|
/* @__PURE__ */ e(Xe, { heightX: 11 }),
|
|
124
|
-
/* @__PURE__ */ e($e, { studentName: g, onFeedback:
|
|
125
|
+
/* @__PURE__ */ e($e, { studentName: g, onFeedback: D })
|
|
125
126
|
] })
|
|
126
127
|
] });
|
|
127
|
-
},
|
|
128
|
+
}, ht = ye(Le);
|
|
128
129
|
export {
|
|
129
|
-
|
|
130
|
+
ht as default
|
|
130
131
|
};
|
|
131
132
|
//# sourceMappingURL=ptm-report.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ptm-report.js","sources":["../../../../../src/features/timeline/monthly-timeline/ptm-report/ptm-report.tsx"],"sourcesContent":["import { memo, useCallback, useEffect, useState, type FC } from 'react';\n\nimport { usePTMReportGet } from './api/use-ptm-report-get';\nimport { EPTMTypes, type IPTMReportProps } from './ptm-report-types';\nimport AppLoader from '../../../ui/loader/app-loader/app-loader';\nimport StudentInfo from './comps/student-info/student-info';\nimport * as Styled from './ptm-report-styled';\nimport KeyNeed from './comps/key-need/key-need';\nimport FlexView from '../../../ui/layout/flex-view';\nimport TeacherObservations from './comps/teacher-observations/teacher-observations';\nimport Strategies from './comps/strategies/strategies';\nimport ParentSupport from './comps/parent-support/parent-support';\nimport UpcomingChapters from './comps/upcoming-chapters/upcoming-chapters';\nimport RealWorldProjects from './comps/real-world-projects/real-world-projects';\nimport SchoolSupport from './comps/school-support/school-support';\nimport Error from '../../../ui/error/error';\nimport StickyFooter from './comps/sticky-footer/sticky-footer';\nimport Separator from '../../../ui/separator/separator';\n\nconst PTMReport: FC<IPTMReportProps> = ({ ptmId, onAPIComplete, onFeedback }) => {\n const [feedback, setFeedback] = useState<'positive' | 'negative' | null>(null);\n const {\n get: getPTMReport,\n data: ptmReportData,\n isProcessing,\n isProcessed,\n isProcessingFailed,\n } = usePTMReportGet(ptmId);\n\n const { report: ptmReport, meta } = ptmReportData || {};\n\n const { parent_feedback_given: parentFeedbackGiven } = meta || {};\n const { teacher_data: teacherData } = ptmReport || {};\n const { name: teacherName, gender: teacherGender } = teacherData || {};\n\n const teacherHonorific = teacherGender === 'female' ? \"Ma'am\" : 'Sir';\n\n const handleFeedback = useCallback((type: 'positive' | 'negative') => {\n setFeedback(type);\n }, []);\n\n const handleSubmit = useCallback(() => {\n if (onFeedback && feedback) {\n const feedbackTeacherName = `${teacherName} ${teacherHonorific}`;\n\n onFeedback(feedback, ptmId, feedbackTeacherName);\n }\n }, [feedback, ptmId, onFeedback, teacherName, teacherHonorific]);\n\n const fetchPTMReport = useCallback(() => {\n getPTMReport(ptmId);\n }, [getPTMReport, ptmId]);\n\n useEffect(() => {\n fetchPTMReport();\n }, [fetchPTMReport]);\n\n useEffect(() => {\n if (isProcessed || isProcessingFailed) {\n onAPIComplete?.(isProcessed && !isProcessingFailed);\n }\n }, [isProcessed, isProcessingFailed, onAPIComplete]);\n\n useEffect(() => {\n if (feedback) {\n // eslint-disable-next-line no-console\n console.log('submitting feedback:', feedback);\n handleSubmit();\n }\n }, [feedback, handleSubmit]);\n\n if (isProcessing || !ptmReportData) {\n return <AppLoader height=\"100dvh\" />;\n }\n\n if (isProcessingFailed) {\n return <Error onTryAgain={fetchPTMReport} height=\"100dvh\" />;\n }\n\n const { ptm_config: ptmConfig, report } = ptmReportData || {};\n\n const { report_sections: reportSections, student_data: studentData } = report || {};\n\n const { ptm_type: ptmType, config } = ptmConfig || {};\n const { ptm_report_sections: sectionsConfig, late_if_minutes: lateIfMinutes } = config || {};\n\n const {\n teacher_observation: teacherObservationConfig,\n learning_strategy: strategyConfig,\n parent_support: parentSupportConfig,\n school_support: schoolSupportConfig,\n } = sectionsConfig || {};\n\n const { subsections: schoolSubsections } = schoolSupportConfig || {};\n const { homework_help: homeworkConfig, test_help: testConfig } = schoolSubsections || {};\n\n const { options: parentOptions } = parentSupportConfig || {};\n const { strategies: strategiesConfig } = strategyConfig || {};\n const { subsections: teacherSubsections } = teacherObservationConfig || {};\n\n const {\n focus_area: focusAreaConfig,\n strengths: strengthsConfig,\n teacher_remarks: remarksConfig,\n } = teacherSubsections || {};\n\n const { areas: focusAreas = [], report_tag: focusAreaTag } = focusAreaConfig || {};\n const { areas: strengthAreas = [] } = strengthsConfig || {};\n const { report_tag: remarksTag } = remarksConfig || {};\n\n const {\n teacher_observation: teacherObservationReport,\n parent_support: parentSupportReport,\n strategies: strategiesReport,\n real_world_project: realWorldReport,\n school_support: schoolSupportReport,\n upcoming_chapters: upcomingChaptersReport,\n } = reportSections || {};\n\n const { homework_help: homeworkReport, test_help: testReport } = schoolSupportReport || {};\n\n const { upcoming_chapters: upcomingChapters } = upcomingChaptersReport || {};\n\n const {\n strengths: strengthsReport = {},\n focus_area: selectedFocusAreaKey,\n teacher_remarks: teacherRemarks,\n } = teacherObservationReport || {};\n\n const {\n first_name: studentName,\n grade: studentGrade,\n key_need: keyNeedData,\n attendance_data: attendanceData,\n homework_data: homeworkData,\n late_class_data: lateClasses = [],\n real_world_project: realWorldProjectData,\n } = studentData || {};\n\n const { classes_completed: completedClasses, weeks_completed: completedWeeks } =\n attendanceData || {};\n\n const { sheets_assigned: assignedSheets, sheets_not_completed: incompleteSheets } =\n homeworkData || {};\n\n const selectedFocusArea = focusAreas.find(\n ({ area_key: areaKey }) => areaKey === selectedFocusAreaKey,\n );\n\n const keyNeedText = keyNeedData?.key_need ?? '';\n const isOnDemandPTM = ptmType === EPTMTypes.ON_DEMAND;\n const lateClassesCount = lateClasses.length;\n const isUpgradePTM = ptmType && ptmType.split('_').includes('UPGRADE');\n const isUpgradeOrOnDemandPTM = isOnDemandPTM || isUpgradePTM;\n\n return (\n <Styled.Container>\n <StudentInfo name={studentName} grade={studentGrade} />\n <FlexView $gutterX={1} $gapX={1}>\n <KeyNeed text={keyNeedText} />\n {isUpgradeOrOnDemandPTM && (\n <>\n <RealWorldProjects projectReport={realWorldReport} projectInfo={realWorldProjectData} />\n <SchoolSupport\n homeworkHelpReport={homeworkReport}\n homeworkHelpConfig={homeworkConfig}\n testHelpReport={testReport}\n testHelpConfig={testConfig}\n studentName={studentName}\n isOnDemandPTM={isOnDemandPTM}\n />\n </>\n )}\n <TeacherObservations\n strengthAreas={strengthAreas}\n strengthsReport={strengthsReport}\n focusArea={selectedFocusArea}\n focusAreaReportTag={focusAreaTag}\n teacherRemarks={teacherRemarks}\n teacherRemarkTag={remarksTag}\n />\n <Strategies report={strategiesReport} strategyConfig={strategiesConfig} />\n <ParentSupport\n report={parentSupportReport}\n options={parentOptions}\n classesCompleted={completedClasses}\n weeksCompleted={completedWeeks}\n sheetsAssigned={assignedSheets}\n sheetsNotCompleted={incompleteSheets}\n lateClassesCount={lateClassesCount}\n lateIfMinutes={lateIfMinutes}\n />\n {isOnDemandPTM && <UpcomingChapters chapters={upcomingChapters} />}\n </FlexView>\n {!parentFeedbackGiven && (\n <>\n <Separator heightX={11} />\n <StickyFooter studentName={studentName} onFeedback={handleFeedback} />\n </>\n )}\n </Styled.Container>\n );\n};\n\nexport default memo(PTMReport);\n"],"names":["PTMReport","ptmId","onAPIComplete","onFeedback","feedback","setFeedback","useState","getPTMReport","ptmReportData","isProcessing","isProcessed","isProcessingFailed","usePTMReportGet","ptmReport","meta","parentFeedbackGiven","teacherData","teacherName","teacherGender","teacherHonorific","handleFeedback","useCallback","type","handleSubmit","feedbackTeacherName","fetchPTMReport","useEffect","jsx","AppLoader","Error","ptmConfig","report","reportSections","studentData","ptmType","config","sectionsConfig","lateIfMinutes","teacherObservationConfig","strategyConfig","parentSupportConfig","schoolSupportConfig","schoolSubsections","homeworkConfig","testConfig","parentOptions","strategiesConfig","teacherSubsections","focusAreaConfig","strengthsConfig","remarksConfig","focusAreas","focusAreaTag","strengthAreas","remarksTag","teacherObservationReport","parentSupportReport","strategiesReport","realWorldReport","schoolSupportReport","upcomingChaptersReport","homeworkReport","testReport","upcomingChapters","strengthsReport","selectedFocusAreaKey","teacherRemarks","studentName","studentGrade","keyNeedData","attendanceData","homeworkData","lateClasses","realWorldProjectData","completedClasses","completedWeeks","assignedSheets","incompleteSheets","selectedFocusArea","areaKey","keyNeedText","isOnDemandPTM","EPTMTypes","lateClassesCount","isUpgradePTM","jsxs","Styled.Container","StudentInfo","FlexView","KeyNeed","Fragment","RealWorldProjects","SchoolSupport","TeacherObservations","Strategies","ParentSupport","UpcomingChapters","Separator","StickyFooter","memo"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,MAAMA,KAAiC,CAAC,EAAE,OAAAC,GAAO,eAAAC,GAAe,YAAAC,QAAiB;AAC/E,QAAM,CAACC,GAAUC,CAAW,IAAIC,GAAyC,IAAI,GACvE;AAAA,IACJ,KAAKC;AAAA,IACL,MAAMC;AAAA,IACN,cAAAC;AAAA,IACA,aAAAC;AAAA,IACA,oBAAAC;AAAA,EAAA,IACEC,GAAgBX,CAAK,GAEnB,EAAE,QAAQY,GAAW,MAAAC,EAAK,IAAIN,KAAiB,CAAA,GAE/C,EAAE,uBAAuBO,MAAwBD,KAAQ,CAAA,GACzD,EAAE,cAAcE,MAAgBH,KAAa,CAAA,GAC7C,EAAE,MAAMI,GAAa,QAAQC,EAAc,IAAIF,KAAe,IAE9DG,IAAmBD,MAAkB,WAAW,UAAU,OAE1DE,IAAiBC,EAAY,CAACC,MAAkC;AACpE,IAAAjB,EAAYiB,CAAI;AAAA,EAClB,GAAG,CAAE,CAAA,GAECC,IAAeF,EAAY,MAAM;AACrC,QAAIlB,KAAcC,GAAU;AAC1B,YAAMoB,IAAsB,GAAGP,CAAW,IAAIE,CAAgB;AAEnD,MAAAhB,EAAAC,GAAUH,GAAOuB,CAAmB;AAAA,IACjD;AAAA,EAAA,GACC,CAACpB,GAAUH,GAAOE,GAAYc,GAAaE,CAAgB,CAAC,GAEzDM,IAAiBJ,EAAY,MAAM;AACvC,IAAAd,EAAaN,CAAK;AAAA,EAAA,GACjB,CAACM,GAAcN,CAAK,CAAC;AAoBpB,MAlBJyB,EAAU,MAAM;AACC,IAAAD;EAAA,GACd,CAACA,CAAc,CAAC,GAEnBC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../../../src/features/timeline/monthly-timeline/ptm-report/ptm-report.tsx"],"sourcesContent":["import { memo, useCallback, useEffect, useState, type FC } from 'react';\n\nimport { usePTMReportGet } from './api/use-ptm-report-get';\nimport { EPTMTypes, type IPTMReportProps } from './ptm-report-types';\nimport AppLoader from '../../../ui/loader/app-loader/app-loader';\nimport StudentInfo from './comps/student-info/student-info';\nimport * as Styled from './ptm-report-styled';\nimport KeyNeed from './comps/key-need/key-need';\nimport FlexView from '../../../ui/layout/flex-view';\nimport TeacherObservations from './comps/teacher-observations/teacher-observations';\nimport Strategies from './comps/strategies/strategies';\nimport ParentSupport from './comps/parent-support/parent-support';\nimport UpcomingChapters from './comps/upcoming-chapters/upcoming-chapters';\nimport RealWorldProjects from './comps/real-world-projects/real-world-projects';\nimport SchoolSupport from './comps/school-support/school-support';\nimport Error from '../../../ui/error/error';\nimport StickyFooter from './comps/sticky-footer/sticky-footer';\nimport Separator from '../../../ui/separator/separator';\nimport { IS_APP_RUNNING_IN_RN } from '../../../../constants/app-config';\n\nconst PTMReport: FC<IPTMReportProps> = ({ ptmId, onAPIComplete, onFeedback }) => {\n const [feedback, setFeedback] = useState<'positive' | 'negative' | null>(null);\n const {\n get: getPTMReport,\n data: ptmReportData,\n isProcessing,\n isProcessed,\n isProcessingFailed,\n } = usePTMReportGet(ptmId);\n\n const { report: ptmReport, meta } = ptmReportData || {};\n\n const { parent_feedback_given: parentFeedbackGiven } = meta || {};\n const { teacher_data: teacherData } = ptmReport || {};\n const { name: teacherName, gender: teacherGender } = teacherData || {};\n\n const teacherHonorific = teacherGender === 'female' ? \"Ma'am\" : 'Sir';\n\n const handleFeedback = useCallback((type: 'positive' | 'negative') => {\n setFeedback(type);\n }, []);\n\n const handleSubmit = useCallback(() => {\n if (onFeedback && feedback) {\n const feedbackTeacherName = `${teacherName} ${teacherHonorific}`;\n\n onFeedback(feedback, ptmId, feedbackTeacherName);\n }\n }, [feedback, ptmId, onFeedback, teacherName, teacherHonorific]);\n\n const fetchPTMReport = useCallback(() => {\n getPTMReport(ptmId);\n }, [getPTMReport, ptmId]);\n\n useEffect(() => {\n fetchPTMReport();\n }, [fetchPTMReport]);\n\n useEffect(() => {\n if (isProcessed || isProcessingFailed) {\n onAPIComplete?.(isProcessed && !isProcessingFailed);\n }\n }, [isProcessed, isProcessingFailed, onAPIComplete]);\n\n useEffect(() => {\n if (feedback) {\n // eslint-disable-next-line no-console\n console.log('submitting feedback:', feedback);\n handleSubmit();\n }\n }, [feedback, handleSubmit]);\n\n if (isProcessing || !ptmReportData) {\n return <AppLoader height=\"100dvh\" />;\n }\n\n if (isProcessingFailed) {\n return <Error onTryAgain={fetchPTMReport} height=\"100dvh\" />;\n }\n\n const { ptm_config: ptmConfig, report } = ptmReportData || {};\n const { ptm_type: ptmType, config } = ptmConfig || {};\n const { ptm_report_sections: sectionsConfig, late_if_minutes: lateIfMinutes } = config || {};\n\n const {\n teacher_observation: teacherObservationConfig,\n learning_strategy: strategyConfig,\n parent_support: parentSupportConfig,\n school_support: schoolSupportConfig,\n } = sectionsConfig || {};\n\n const { subsections: schoolSubsections } = schoolSupportConfig || {};\n const { homework_help: homeworkConfig, test_help: testConfig } = schoolSubsections || {};\n\n const { options: parentOptions } = parentSupportConfig || {};\n const { strategies: strategiesConfig } = strategyConfig || {};\n const { subsections: teacherSubsections } = teacherObservationConfig || {};\n\n const {\n focus_area: focusAreaConfig,\n strengths: strengthsConfig,\n teacher_remarks: remarksConfig,\n } = teacherSubsections || {};\n\n const { areas: focusAreas = [], report_tag: focusAreaTag } = focusAreaConfig || {};\n const { areas: strengthAreas = [] } = strengthsConfig || {};\n const { report_tag: remarksTag } = remarksConfig || {};\n\n const { report_sections: reportSections, student_data: studentData } = report;\n\n const {\n teacher_observation: teacherObservationReport,\n parent_support: parentSupportReport,\n strategies: strategiesReport,\n real_world_project: realWorldReport,\n school_support: schoolSupportReport,\n upcoming_chapters: upcomingChaptersReport,\n } = reportSections || {};\n\n const { homework_help: homeworkReport, test_help: testReport } = schoolSupportReport || {};\n\n const { upcoming_chapters: upcomingChapters } = upcomingChaptersReport || {};\n\n const {\n strengths: strengthsReport = {},\n focus_area: selectedFocusAreaKey,\n teacher_remarks: teacherRemarks,\n } = teacherObservationReport || {};\n\n const {\n first_name: studentName,\n grade: studentGrade,\n key_need: keyNeedData,\n attendance_data: attendanceData,\n homework_data: homeworkData,\n late_class_data: lateClasses = [],\n real_world_project: realWorldProjectData,\n } = studentData || {};\n\n const { classes_completed: completedClasses, weeks_completed: completedWeeks } =\n attendanceData || {};\n\n const { sheets_assigned: assignedSheets, sheets_not_completed: incompleteSheets } =\n homeworkData || {};\n\n const selectedFocusArea = focusAreas.find(\n ({ area_key: areaKey }) => areaKey === selectedFocusAreaKey,\n );\n\n const keyNeedText = keyNeedData?.key_need ?? '';\n const isOnDemandPTM = ptmType === EPTMTypes.ON_DEMAND;\n const lateClassesCount = lateClasses.length;\n const isUpgradePTM = ptmType && ptmType.split('_').includes('UPGRADE');\n const isUpgradeOrOnDemandPTM = isOnDemandPTM || isUpgradePTM;\n\n return (\n <Styled.Container>\n <StudentInfo name={studentName} grade={studentGrade} />\n <FlexView $gutterX={1} $gapX={1}>\n <KeyNeed text={keyNeedText} />\n {isUpgradeOrOnDemandPTM && (\n <>\n <RealWorldProjects projectReport={realWorldReport} projectInfo={realWorldProjectData} />\n <SchoolSupport\n homeworkHelpReport={homeworkReport}\n homeworkHelpConfig={homeworkConfig}\n testHelpReport={testReport}\n testHelpConfig={testConfig}\n studentName={studentName}\n isOnDemandPTM={isOnDemandPTM}\n />\n </>\n )}\n <TeacherObservations\n strengthAreas={strengthAreas}\n strengthsReport={strengthsReport}\n focusArea={selectedFocusArea}\n focusAreaReportTag={focusAreaTag}\n teacherRemarks={teacherRemarks}\n teacherRemarkTag={remarksTag}\n />\n <Strategies report={strategiesReport} strategyConfig={strategiesConfig} />\n <ParentSupport\n report={parentSupportReport}\n options={parentOptions}\n classesCompleted={completedClasses}\n weeksCompleted={completedWeeks}\n sheetsAssigned={assignedSheets}\n sheetsNotCompleted={incompleteSheets}\n lateClassesCount={lateClassesCount}\n lateIfMinutes={lateIfMinutes}\n />\n {isOnDemandPTM && <UpcomingChapters chapters={upcomingChapters} />}\n </FlexView>\n {!parentFeedbackGiven && IS_APP_RUNNING_IN_RN && (\n <>\n <Separator heightX={11} />\n <StickyFooter studentName={studentName} onFeedback={handleFeedback} />\n </>\n )}\n </Styled.Container>\n );\n};\n\nexport default memo(PTMReport);\n"],"names":["PTMReport","ptmId","onAPIComplete","onFeedback","feedback","setFeedback","useState","getPTMReport","ptmReportData","isProcessing","isProcessed","isProcessingFailed","usePTMReportGet","ptmReport","meta","parentFeedbackGiven","teacherData","teacherName","teacherGender","teacherHonorific","handleFeedback","useCallback","type","handleSubmit","feedbackTeacherName","fetchPTMReport","useEffect","jsx","AppLoader","Error","ptmConfig","report","ptmType","config","sectionsConfig","lateIfMinutes","teacherObservationConfig","strategyConfig","parentSupportConfig","schoolSupportConfig","schoolSubsections","homeworkConfig","testConfig","parentOptions","strategiesConfig","teacherSubsections","focusAreaConfig","strengthsConfig","remarksConfig","focusAreas","focusAreaTag","strengthAreas","remarksTag","reportSections","studentData","teacherObservationReport","parentSupportReport","strategiesReport","realWorldReport","schoolSupportReport","upcomingChaptersReport","homeworkReport","testReport","upcomingChapters","strengthsReport","selectedFocusAreaKey","teacherRemarks","studentName","studentGrade","keyNeedData","attendanceData","homeworkData","lateClasses","realWorldProjectData","completedClasses","completedWeeks","assignedSheets","incompleteSheets","selectedFocusArea","areaKey","keyNeedText","isOnDemandPTM","EPTMTypes","lateClassesCount","isUpgradePTM","jsxs","Styled.Container","StudentInfo","FlexView","KeyNeed","Fragment","RealWorldProjects","SchoolSupport","TeacherObservations","Strategies","ParentSupport","UpcomingChapters","IS_APP_RUNNING_IN_RN","Separator","StickyFooter","memo"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,MAAMA,KAAiC,CAAC,EAAE,OAAAC,GAAO,eAAAC,GAAe,YAAAC,Q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