@cuemath/leap 3.5.64 → 3.5.66-link0
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/cue-canvas/bottombar/homework-controls.js.map +1 -1
- package/dist/features/cue-canvas/sidebar/sidebar.js +4 -4
- package/dist/features/cue-canvas/sidebar/sidebar.js.map +1 -1
- package/dist/features/cue-canvas/toolbar/toolbar.js +21 -17
- package/dist/features/cue-canvas/toolbar/toolbar.js.map +1 -1
- package/dist/features/cue-canvas/toolbar/whiteboard-toolbar.js +23 -13
- package/dist/features/cue-canvas/toolbar/whiteboard-toolbar.js.map +1 -1
- package/dist/features/milestone/create/api/milestone-config.js.map +1 -1
- package/dist/features/parent-dashboard/modals/trial-report/trial-report.js +1 -1
- package/dist/features/parent-dashboard/modals/trial-report/trial-report.js.map +1 -1
- package/dist/features/sheets/constants/sheet.js +1 -0
- package/dist/features/sheets/constants/sheet.js.map +1 -1
- package/dist/features/timeline/daily-timeline/daily-timeline.js +40 -40
- package/dist/features/timeline/daily-timeline/daily-timeline.js.map +1 -1
- package/dist/features/timeline/monthly-timeline/monthly-report/monthly-report-types.js +1 -1
- package/dist/features/timeline/monthly-timeline/monthly-report/monthly-report-types.js.map +1 -1
- package/dist/features/timeline/monthly-timeline/monthly-timeline-styled.js +8 -5
- package/dist/features/timeline/monthly-timeline/monthly-timeline-styled.js.map +1 -1
- package/dist/features/timeline/monthly-timeline/monthly-timeline.js +35 -35
- package/dist/features/timeline/monthly-timeline/monthly-timeline.js.map +1 -1
- package/dist/features/trial-session/api/trial-home.js +10 -16
- package/dist/features/trial-session/api/trial-home.js.map +1 -1
- package/dist/features/trial-session/api/trial-session-report.js +16 -0
- package/dist/features/trial-session/api/trial-session-report.js.map +1 -0
- package/dist/features/trial-session/api/trial-topics.js +9 -0
- package/dist/features/trial-session/api/trial-topics.js.map +1 -0
- package/dist/features/trial-session/comps/background-grid/background-grid-utils.js +62 -50
- package/dist/features/trial-session/comps/background-grid/background-grid-utils.js.map +1 -1
- package/dist/features/trial-session/comps/class-preference/class-preference-styled.js +5 -14
- package/dist/features/trial-session/comps/class-preference/class-preference-styled.js.map +1 -1
- package/dist/features/trial-session/comps/class-preference/class-preference.js +55 -53
- package/dist/features/trial-session/comps/class-preference/class-preference.js.map +1 -1
- package/dist/features/trial-session/comps/communication-slide/communication-slide-constants.js +3 -2
- package/dist/features/trial-session/comps/communication-slide/communication-slide-constants.js.map +1 -1
- package/dist/features/trial-session/comps/confirmation-modal/hooks/use-confirmation-modal.js +27 -27
- package/dist/features/trial-session/comps/confirmation-modal/hooks/use-confirmation-modal.js.map +1 -1
- package/dist/features/trial-session/comps/learning-session/learning-session-styled.js +19 -18
- package/dist/features/trial-session/comps/learning-session/learning-session-styled.js.map +1 -1
- package/dist/features/trial-session/comps/learning-session/learning-session.js +34 -43
- package/dist/features/trial-session/comps/learning-session/learning-session.js.map +1 -1
- package/dist/features/trial-session/comps/navigation-bar/index.js +56 -58
- package/dist/features/trial-session/comps/navigation-bar/index.js.map +1 -1
- package/dist/features/trial-session/comps/offering-information/offering-information-constants.js +29 -6
- package/dist/features/trial-session/comps/offering-information/offering-information-constants.js.map +1 -1
- package/dist/features/trial-session/comps/offering-information/offering-information.js +74 -64
- package/dist/features/trial-session/comps/offering-information/offering-information.js.map +1 -1
- package/dist/features/trial-session/comps/school-goals/school-goals-styled.js +10 -9
- package/dist/features/trial-session/comps/school-goals/school-goals-styled.js.map +1 -1
- package/dist/features/trial-session/comps/school-goals/school-goals-view.js +40 -39
- package/dist/features/trial-session/comps/school-goals/school-goals-view.js.map +1 -1
- package/dist/features/trial-session/comps/school-goals/school-goals.js +39 -37
- package/dist/features/trial-session/comps/school-goals/school-goals.js.map +1 -1
- package/dist/features/trial-session/comps/session-insights/session-insights-styled.js +12 -20
- package/dist/features/trial-session/comps/session-insights/session-insights-styled.js.map +1 -1
- package/dist/features/trial-session/comps/session-insights/session-insights.js +64 -63
- package/dist/features/trial-session/comps/session-insights/session-insights.js.map +1 -1
- package/dist/features/trial-session/comps/session-overview/session-overview-styled.js +13 -13
- package/dist/features/trial-session/comps/session-overview/session-overview-styled.js.map +1 -1
- package/dist/features/trial-session/comps/session-overview/session-overview-utils.js +23 -4
- package/dist/features/trial-session/comps/session-overview/session-overview-utils.js.map +1 -1
- package/dist/features/trial-session/comps/session-overview/session-overview.js +20 -20
- package/dist/features/trial-session/comps/session-overview/session-overview.js.map +1 -1
- package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary-styled.js +61 -0
- package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary-styled.js.map +1 -0
- package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary-types.js +5 -0
- package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary-types.js.map +1 -0
- package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary-view.js +135 -0
- package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary-view.js.map +1 -0
- package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary.js +53 -0
- package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary.js.map +1 -0
- package/dist/features/trial-session/comps/session-report/report-404/report-404.js +15 -16
- package/dist/features/trial-session/comps/session-report/report-404/report-404.js.map +1 -1
- package/dist/features/trial-session/comps/session-report/session-report.js +35 -33
- package/dist/features/trial-session/comps/session-report/session-report.js.map +1 -1
- package/dist/features/trial-session/comps/student-enrichment/student-enrichment-styled.js +9 -16
- package/dist/features/trial-session/comps/student-enrichment/student-enrichment-styled.js.map +1 -1
- package/dist/features/trial-session/comps/student-enrichment/student-enrichment.js +39 -37
- package/dist/features/trial-session/comps/student-enrichment/student-enrichment.js.map +1 -1
- package/dist/features/trial-session/comps/student-feedback/student-feedback-styled.js +10 -9
- package/dist/features/trial-session/comps/student-feedback/student-feedback-styled.js.map +1 -1
- package/dist/features/trial-session/comps/student-info/student-info-constants.js +35 -0
- package/dist/features/trial-session/comps/student-info/student-info-constants.js.map +1 -0
- package/dist/features/trial-session/comps/student-info/student-info-helpers.js +12 -0
- package/dist/features/trial-session/comps/student-info/student-info-helpers.js.map +1 -0
- package/dist/features/trial-session/comps/student-info/student-info-styled.js +26 -11
- package/dist/features/trial-session/comps/student-info/student-info-styled.js.map +1 -1
- package/dist/features/trial-session/comps/student-info/student-info.js +113 -78
- package/dist/features/trial-session/comps/student-info/student-info.js.map +1 -1
- package/dist/features/trial-session/comps/student-personalization/student-personalization-styled.js +3 -12
- package/dist/features/trial-session/comps/student-personalization/student-personalization-styled.js.map +1 -1
- package/dist/features/trial-session/comps/student-personalization/student-personalization.js +34 -33
- package/dist/features/trial-session/comps/student-personalization/student-personalization.js.map +1 -1
- package/dist/features/trial-session/comps/student-profile/student-profile.js +45 -44
- package/dist/features/trial-session/comps/student-profile/student-profile.js.map +1 -1
- package/dist/features/trial-session/comps/teacher-intro/teacher-intro.js +9 -8
- package/dist/features/trial-session/comps/teacher-intro/teacher-intro.js.map +1 -1
- package/dist/features/trial-session/comps/test-prep/test-prep-styled.js +11 -19
- package/dist/features/trial-session/comps/test-prep/test-prep-styled.js.map +1 -1
- package/dist/features/trial-session/comps/test-prep/test-prep.js +31 -29
- package/dist/features/trial-session/comps/test-prep/test-prep.js.map +1 -1
- package/dist/features/trial-session/comps/topic-selection/topic-selection-styled.js +42 -0
- package/dist/features/trial-session/comps/topic-selection/topic-selection-styled.js.map +1 -0
- package/dist/features/trial-session/comps/topic-selection/topic-selection.js +84 -0
- package/dist/features/trial-session/comps/topic-selection/topic-selection.js.map +1 -0
- package/dist/features/trial-session/comps/whiteboard/whiteboard-styled.js +21 -0
- package/dist/features/trial-session/comps/whiteboard/whiteboard-styled.js.map +1 -0
- package/dist/features/trial-session/comps/whiteboard/whiteboard.js +99 -0
- package/dist/features/trial-session/comps/whiteboard/whiteboard.js.map +1 -0
- package/dist/features/trial-session/comps/worksheet/worksheet.js +35 -33
- package/dist/features/trial-session/comps/worksheet/worksheet.js.map +1 -1
- package/dist/features/trial-session/context/trial-session-context.js +2 -0
- package/dist/features/trial-session/context/trial-session-context.js.map +1 -1
- package/dist/features/trial-session/helper.js +70 -64
- package/dist/features/trial-session/helper.js.map +1 -1
- package/dist/features/trial-session/hooks/use-trial-session-navigation.js +190 -158
- package/dist/features/trial-session/hooks/use-trial-session-navigation.js.map +1 -1
- package/dist/features/trial-session/right-panel/right-panel-styled.js +8 -8
- package/dist/features/trial-session/right-panel/right-panel-styled.js.map +1 -1
- package/dist/features/trial-session/right-panel/slide-components-map.js +42 -36
- package/dist/features/trial-session/right-panel/slide-components-map.js.map +1 -1
- package/dist/features/trial-session/trial-session-constants.js +22 -18
- package/dist/features/trial-session/trial-session-constants.js.map +1 -1
- package/dist/features/trial-session/trial-session-types.js.map +1 -1
- package/dist/features/trial-session/trial-session-view.js +82 -77
- package/dist/features/trial-session/trial-session-view.js.map +1 -1
- package/dist/features/trial-session/trial-session.js +38 -38
- package/dist/features/trial-session/trial-session.js.map +1 -1
- package/dist/features/ui/inputs/checkbox-input/checkbox-input.js +21 -21
- package/dist/features/ui/inputs/checkbox-input/checkbox-input.js.map +1 -1
- package/dist/features/ui/inputs/checkbox-input-list/checkbox-input-list.js +12 -12
- package/dist/features/ui/inputs/checkbox-input-list/checkbox-input-list.js.map +1 -1
- package/dist/features/ui/theme/clrs.js +1 -0
- package/dist/features/ui/theme/clrs.js.map +1 -1
- package/dist/features/worksheet/worksheet/mocks/activity.js +6 -0
- package/dist/features/worksheet/worksheet/mocks/activity.js.map +1 -0
- package/dist/features/worksheet/worksheet/mocks/signed-requests.js +5 -0
- package/dist/features/worksheet/worksheet/mocks/signed-requests.js.map +1 -0
- package/dist/features/worksheet/worksheet/stories/use-canvas-sync-broker-story.js +57 -0
- package/dist/features/worksheet/worksheet/stories/use-canvas-sync-broker-story.js.map +1 -0
- package/dist/features/worksheet/worksheet/stories/worksheet-story-container.js +263 -0
- package/dist/features/worksheet/worksheet/stories/worksheet-story-container.js.map +1 -0
- package/dist/features/worksheet/worksheet/stories/worksheet-student.js +177 -0
- package/dist/features/worksheet/worksheet/stories/worksheet-student.js.map +1 -0
- package/dist/features/worksheet/worksheet/stories/worksheet-teacher.js +268 -0
- package/dist/features/worksheet/worksheet/stories/worksheet-teacher.js.map +1 -0
- package/dist/features/worksheet/worksheet/worksheet-behavior-helper.js +51 -32
- package/dist/features/worksheet/worksheet/worksheet-behavior-helper.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-helpers.js +38 -37
- package/dist/features/worksheet/worksheet/worksheet-helpers.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-store/helpers/get-computed-properties.js +36 -35
- package/dist/features/worksheet/worksheet/worksheet-store/helpers/get-computed-properties.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-store/helpers/get-questions-from-items.js +61 -58
- package/dist/features/worksheet/worksheet/worksheet-store/helpers/get-questions-from-items.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-types.js.map +1 -1
- package/dist/features/worksheet/worksheet-preview/hooks/use-worksheet-layout.js +32 -30
- package/dist/features/worksheet/worksheet-preview/hooks/use-worksheet-layout.js.map +1 -1
- package/dist/index.d.ts +12 -6
- package/dist/index.js +148 -150
- package/dist/index.js.map +1 -1
- package/dist/node_modules/uuid/dist/esm-browser/regex.js +5 -0
- package/dist/node_modules/uuid/dist/esm-browser/regex.js.map +1 -0
- package/dist/node_modules/uuid/dist/esm-browser/rng.js +2 -3
- package/dist/node_modules/uuid/dist/esm-browser/rng.js.map +1 -1
- package/dist/node_modules/uuid/dist/esm-browser/stringify.js +10 -6
- package/dist/node_modules/uuid/dist/esm-browser/stringify.js.map +1 -1
- package/dist/node_modules/uuid/dist/esm-browser/v4.js +9 -12
- package/dist/node_modules/uuid/dist/esm-browser/v4.js.map +1 -1
- package/dist/node_modules/uuid/dist/esm-browser/validate.js +8 -0
- package/dist/node_modules/uuid/dist/esm-browser/validate.js.map +1 -0
- package/dist/types/models/worksheet.js +1 -1
- package/dist/types/models/worksheet.js.map +1 -1
- package/package.json +1 -1
- package/dist/features/sheets/utils/is-v3-worksheet.js +0 -55
- package/dist/features/sheets/utils/is-v3-worksheet.js.map +0 -1
- package/dist/node_modules/uuid/dist/esm-browser/native.js +0 -7
- package/dist/node_modules/uuid/dist/esm-browser/native.js.map +0 -1
|
@@ -1,52 +1,54 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { useResumeTrialWorksheet as
|
|
6
|
-
import { useTrialSessionContext as
|
|
7
|
-
import { GOAL_CATEGORY as
|
|
8
|
-
import { HIGH_ENROLLMENT_PROGRAMS_MAP as
|
|
9
|
-
const
|
|
10
|
-
const { isTeacher: n, studentId: i, worksheet: a, formData:
|
|
11
|
-
() => (o == null ? void 0 : o.find((e) => e.goal_category ===
|
|
1
|
+
import { jsx as h } from "react/jsx-runtime";
|
|
2
|
+
import { useState as S, useMemo as G, useCallback as H, useEffect as M } from "react";
|
|
3
|
+
import N from "../../../ui/error/error.js";
|
|
4
|
+
import x from "../../../ui/loader/app-loader/app-loader.js";
|
|
5
|
+
import { useResumeTrialWorksheet as D } from "../../api/trial-nodes.js";
|
|
6
|
+
import { useTrialSessionContext as U } from "../../context/use-trial-session-context.js";
|
|
7
|
+
import { GOAL_CATEGORY as W } from "../../../milestone/constants.js";
|
|
8
|
+
import { HIGH_ENROLLMENT_PROGRAMS_MAP as b } from "../../trial-session-constants.js";
|
|
9
|
+
const J = () => {
|
|
10
|
+
const { isTeacher: n, studentId: i, worksheet: a, formData: g, demoType: c, updateSlideConfig: y, trialHomeData: C } = U(), [T, d] = S(!1), [m, A] = S(!1), { goals: o, resetAttempt: t } = g || {}, { demo_info: I } = C, { region_data: E, course: p } = I || {}, { opportunity_country: f = "US" } = E || {}, { program_code: u = "" } = G(
|
|
11
|
+
() => (o == null ? void 0 : o.find((e) => e.goal_category === W.SCHOOL_SUCCESS)) ?? {},
|
|
12
12
|
[o]
|
|
13
|
-
),
|
|
14
|
-
if (e &&
|
|
13
|
+
), P = (e, l) => {
|
|
14
|
+
if (e && d(!0), l) {
|
|
15
15
|
const {
|
|
16
|
-
user_node_id:
|
|
17
|
-
node_id:
|
|
18
|
-
user_attempt_id:
|
|
19
|
-
node_type:
|
|
20
|
-
} =
|
|
21
|
-
A(!0),
|
|
16
|
+
user_node_id: O,
|
|
17
|
+
node_id: L,
|
|
18
|
+
user_attempt_id: R,
|
|
19
|
+
node_type: k
|
|
20
|
+
} = l;
|
|
21
|
+
A(!0), y({ userNodeId: O, nodeId: L, attemptId: R, nodeType: k, resetAttempt: !1 });
|
|
22
22
|
}
|
|
23
|
-
}, { patch:
|
|
24
|
-
onComplete:
|
|
25
|
-
}), s =
|
|
26
|
-
if (n && !r && !
|
|
27
|
-
const e =
|
|
28
|
-
|
|
23
|
+
}, { patch: _, isProcessing: r } = D({
|
|
24
|
+
onComplete: P
|
|
25
|
+
}), s = H(() => {
|
|
26
|
+
if (n && !r && !m) {
|
|
27
|
+
const e = b[u] || p;
|
|
28
|
+
d(!1), _(i, {
|
|
29
29
|
course: e,
|
|
30
30
|
country_code: f,
|
|
31
|
+
demo_type: c,
|
|
31
32
|
reset_attempt: t === void 0 || t
|
|
32
33
|
});
|
|
33
34
|
}
|
|
34
35
|
}, [
|
|
35
|
-
|
|
36
|
+
n,
|
|
37
|
+
r,
|
|
36
38
|
m,
|
|
37
39
|
u,
|
|
38
|
-
n,
|
|
39
40
|
p,
|
|
41
|
+
_,
|
|
40
42
|
i,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
f,
|
|
44
|
+
c,
|
|
45
|
+
t
|
|
44
46
|
]);
|
|
45
|
-
return
|
|
47
|
+
return M(() => {
|
|
46
48
|
s();
|
|
47
|
-
}, [s]),
|
|
49
|
+
}, [s]), T ? /* @__PURE__ */ h(N, { height: "100%", onTryAgain: s }) : r || !a ? /* @__PURE__ */ h(x, { height: "100%" }) : a;
|
|
48
50
|
};
|
|
49
51
|
export {
|
|
50
|
-
|
|
52
|
+
J as default
|
|
51
53
|
};
|
|
52
54
|
//# sourceMappingURL=worksheet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worksheet.js","sources":["../../../../../src/features/trial-session/comps/worksheet/worksheet.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState, type FC } from 'react';\n\nimport type { IResumeWorksheetModel } from '../../../../types/models/worksheet';\nimport Error from '../../../ui/error/error';\nimport AppLoader from '../../../ui/loader/app-loader/app-loader';\nimport { useResumeTrialWorksheet } from '../../api/trial-nodes';\nimport { useTrialSessionContext } from '../../context/use-trial-session-context';\nimport { GOAL_CATEGORY } from '../../../milestone/constants';\nimport { HIGH_ENROLLMENT_PROGRAMS_MAP } from '../../trial-session-constants';\n\nconst SessionWorksheet: FC = () => {\n const { isTeacher, studentId, worksheet, formData, updateSlideConfig, trialHomeData } =\n useTrialSessionContext();\n const [isError, setIserror] = useState<boolean>(false);\n const [isPatchProcessed, setIsPatchProcessed] = useState(false);\n\n const { goals, resetAttempt } = formData || {};\n const { demo_info: demoInfo } = trialHomeData;\n const { region_data: regionData, course } = demoInfo || {};\n const { opportunity_country: countryCode = 'US' } = regionData || {};\n\n const { program_code: programCode = '' } = useMemo(\n () => goals?.find(goal => goal.goal_category === GOAL_CATEGORY.SCHOOL_SUCCESS) ?? {},\n [goals],\n );\n\n const onComplete = (error: string | null, sheetData?: IResumeWorksheetModel) => {\n if (error) {\n setIserror(true);\n }\n\n if (sheetData) {\n const {\n user_node_id: userNodeId,\n node_id: nodeId,\n user_attempt_id: attemptId,\n node_type: nodeType,\n } = sheetData;\n\n setIsPatchProcessed(true);\n updateSlideConfig({ userNodeId, nodeId, attemptId, nodeType, resetAttempt: false });\n }\n };\n\n const { patch: resumeNode, isProcessing } = useResumeTrialWorksheet({\n onComplete,\n });\n\n const fetchData = useCallback(() => {\n if (isTeacher && !isProcessing && !isPatchProcessed) {\n const courseToSend =\n HIGH_ENROLLMENT_PROGRAMS_MAP[programCode as keyof typeof HIGH_ENROLLMENT_PROGRAMS_MAP] ||\n course;\n\n setIserror(false);\n resumeNode(studentId, {\n course: courseToSend,\n country_code: countryCode,\n reset_attempt: resetAttempt === undefined || resetAttempt,\n });\n }\n }, [\n
|
|
1
|
+
{"version":3,"file":"worksheet.js","sources":["../../../../../src/features/trial-session/comps/worksheet/worksheet.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState, type FC } from 'react';\n\nimport type { IResumeWorksheetModel } from '../../../../types/models/worksheet';\nimport Error from '../../../ui/error/error';\nimport AppLoader from '../../../ui/loader/app-loader/app-loader';\nimport { useResumeTrialWorksheet } from '../../api/trial-nodes';\nimport { useTrialSessionContext } from '../../context/use-trial-session-context';\nimport { GOAL_CATEGORY } from '../../../milestone/constants';\nimport { HIGH_ENROLLMENT_PROGRAMS_MAP } from '../../trial-session-constants';\n\nconst SessionWorksheet: FC = () => {\n const { isTeacher, studentId, worksheet, formData, demoType, updateSlideConfig, trialHomeData } =\n useTrialSessionContext();\n const [isError, setIserror] = useState<boolean>(false);\n const [isPatchProcessed, setIsPatchProcessed] = useState(false);\n\n const { goals, resetAttempt } = formData || {};\n const { demo_info: demoInfo } = trialHomeData;\n const { region_data: regionData, course } = demoInfo || {};\n const { opportunity_country: countryCode = 'US' } = regionData || {};\n\n const { program_code: programCode = '' } = useMemo(\n () => goals?.find(goal => goal.goal_category === GOAL_CATEGORY.SCHOOL_SUCCESS) ?? {},\n [goals],\n );\n\n const onComplete = (error: string | null, sheetData?: IResumeWorksheetModel) => {\n if (error) {\n setIserror(true);\n }\n\n if (sheetData) {\n const {\n user_node_id: userNodeId,\n node_id: nodeId,\n user_attempt_id: attemptId,\n node_type: nodeType,\n } = sheetData;\n\n setIsPatchProcessed(true);\n updateSlideConfig({ userNodeId, nodeId, attemptId, nodeType, resetAttempt: false });\n }\n };\n\n const { patch: resumeNode, isProcessing } = useResumeTrialWorksheet({\n onComplete,\n });\n\n const fetchData = useCallback(() => {\n if (isTeacher && !isProcessing && !isPatchProcessed) {\n const courseToSend =\n HIGH_ENROLLMENT_PROGRAMS_MAP[programCode as keyof typeof HIGH_ENROLLMENT_PROGRAMS_MAP] ||\n course;\n\n setIserror(false);\n resumeNode(studentId, {\n course: courseToSend,\n country_code: countryCode,\n demo_type: demoType,\n reset_attempt: resetAttempt === undefined || resetAttempt,\n });\n }\n }, [\n isTeacher,\n isProcessing,\n isPatchProcessed,\n programCode,\n course,\n resumeNode,\n studentId,\n countryCode,\n demoType,\n resetAttempt,\n ]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n if (isError) {\n return <Error height=\"100%\" onTryAgain={fetchData} />;\n }\n\n if (isProcessing || !worksheet) {\n return <AppLoader height=\"100%\" />;\n }\n\n return worksheet;\n};\n\nexport default SessionWorksheet;\n"],"names":["SessionWorksheet","isTeacher","studentId","worksheet","formData","demoType","updateSlideConfig","trialHomeData","useTrialSessionContext","isError","setIserror","useState","isPatchProcessed","setIsPatchProcessed","goals","resetAttempt","demoInfo","regionData","course","countryCode","programCode","useMemo","goal","GOAL_CATEGORY","onComplete","error","sheetData","userNodeId","nodeId","attemptId","nodeType","resumeNode","isProcessing","useResumeTrialWorksheet","fetchData","useCallback","courseToSend","HIGH_ENROLLMENT_PROGRAMS_MAP","useEffect","jsx","Error","AppLoader"],"mappings":";;;;;;;;AAUA,MAAMA,IAAuB,MAAM;AAC3B,QAAA,EAAE,WAAAC,GAAW,WAAAC,GAAW,WAAAC,GAAW,UAAAC,GAAU,UAAAC,GAAU,mBAAAC,GAAmB,eAAAC,MAC9EC,KACI,CAACC,GAASC,CAAU,IAAIC,EAAkB,EAAK,GAC/C,CAACC,GAAkBC,CAAmB,IAAIF,EAAS,EAAK,GAExD,EAAE,OAAAG,GAAO,cAAAC,MAAiBX,KAAY,CAAA,GACtC,EAAE,WAAWY,EAAa,IAAAT,GAC1B,EAAE,aAAaU,GAAY,QAAAC,EAAO,IAAIF,KAAY,CAAA,GAClD,EAAE,qBAAqBG,IAAc,KAAK,I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BAAAoC,EAACE,GAAU,EAAA,QAAO,OAAO,CAAA,IAG3BtC;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trial-session-context.js","sources":["../../../../src/features/trial-session/context/trial-session-context.tsx"],"sourcesContent":["import { createContext } from 'react';\n\nimport type { IMilestoneConfig } from '../../milestone/create/milestone-create-types';\nimport type { ITrialCircleGameParams } from '../comps/trial-circle-game/trial-circle-game-types';\nimport { DEFAULT_BUTTON_STATE } from '../trial-session-constants';\nimport type {\n IClassTimeAlertConfig,\n ISlide,\n ITrialHomeData,\n ITrialSessionContext,\n} from '../trial-session-types';\n\nconst TrialSessionContext = createContext<ITrialSessionContext>({\n isTeacher: false,\n slideConfig: {} as ISlide,\n formData: undefined,\n milestoneConfig: {} as IMilestoneConfig,\n updateSlideConfig: () => undefined,\n buttonState: DEFAULT_BUTTON_STATE,\n updateButtonState: () => undefined,\n teacherId: '',\n studentId: '',\n trialHomeData: {} as ITrialHomeData,\n openEndClassModal: () => undefined,\n studentAbsentInClass: false,\n circleGames: {} as ITrialCircleGameParams,\n trialGameUrl: '',\n handleInfoMessage: () => undefined,\n classTimeAlertConfig: {} as IClassTimeAlertConfig,\n classDuration: 0,\n});\n\nexport default TrialSessionContext;\n"],"names":["TrialSessionContext","createContext","DEFAULT_BUTTON_STATE"],"mappings":";;AAYA,MAAMA,IAAsBC,EAAoC;AAAA,EAC9D,WAAW;AAAA,EACX,aAAa,CAAC;AAAA,EACd,UAAU;AAAA,EACV,iBAAiB,CAAC;AAAA,EAClB,mBAAmB,MAAM;AAAA;AAAA,EACzB,aAAaC;AAAA,EACb,mBAAmB,MAAM;AAAA;AAAA,EACzB,WAAW;AAAA,EACX,WAAW;AAAA,EACX,eAAe,CAAC;AAAA,EAChB,mBAAmB,MAAM;AAAA;AAAA,EACzB,sBAAsB;AAAA,EACtB,aAAa,CAAC;AAAA,EACd,cAAc;AAAA,EACd,mBAAmB,MAAM;AAAA;AAAA,EACzB,sBAAsB,CAAC;AAAA,EACvB,eAAe;AACjB,CAAC;"}
|
|
1
|
+
{"version":3,"file":"trial-session-context.js","sources":["../../../../src/features/trial-session/context/trial-session-context.tsx"],"sourcesContent":["import { createContext } from 'react';\n\nimport type { IMilestoneConfig } from '../../milestone/create/milestone-create-types';\nimport type { ITrialCircleGameParams } from '../comps/trial-circle-game/trial-circle-game-types';\nimport { DEFAULT_BUTTON_STATE } from '../trial-session-constants';\nimport type {\n IClassTimeAlertConfig,\n ISlide,\n ITrialHomeData,\n ITrialSessionContext,\n} from '../trial-session-types';\n\nconst TrialSessionContext = createContext<ITrialSessionContext>({\n isTeacher: false,\n slideConfig: {} as ISlide,\n formData: undefined,\n demoType: '',\n teacherClassroomId: '',\n milestoneConfig: {} as IMilestoneConfig,\n updateSlideConfig: () => undefined,\n buttonState: DEFAULT_BUTTON_STATE,\n updateButtonState: () => undefined,\n teacherId: '',\n studentId: '',\n trialHomeData: {} as ITrialHomeData,\n openEndClassModal: () => undefined,\n studentAbsentInClass: false,\n circleGames: {} as ITrialCircleGameParams,\n trialGameUrl: '',\n handleInfoMessage: () => undefined,\n classTimeAlertConfig: {} as IClassTimeAlertConfig,\n classDuration: 0,\n});\n\nexport default TrialSessionContext;\n"],"names":["TrialSessionContext","createContext","DEFAULT_BUTTON_STATE"],"mappings":";;AAYA,MAAMA,IAAsBC,EAAoC;AAAA,EAC9D,WAAW;AAAA,EACX,aAAa,CAAC;AAAA,EACd,UAAU;AAAA,EACV,UAAU;AAAA,EACV,oBAAoB;AAAA,EACpB,iBAAiB,CAAC;AAAA,EAClB,mBAAmB,MAAM;AAAA;AAAA,EACzB,aAAaC;AAAA,EACb,mBAAmB,MAAM;AAAA;AAAA,EACzB,WAAW;AAAA,EACX,WAAW;AAAA,EACX,eAAe,CAAC;AAAA,EAChB,mBAAmB,MAAM;AAAA;AAAA,EACzB,sBAAsB;AAAA,EACtB,aAAa,CAAC;AAAA,EACd,cAAc;AAAA,EACd,mBAAmB,MAAM;AAAA;AAAA,EACzB,sBAAsB,CAAC;AAAA,EACvB,eAAe;AACjB,CAAC;"}
|
|
@@ -1,93 +1,99 @@
|
|
|
1
|
-
import { DAYS as
|
|
2
|
-
import { getOffsetBetweenTimezone as D, convertEpochToDateTime as
|
|
3
|
-
import { GOAL_CATEGORY as
|
|
1
|
+
import { DAYS as C } from "../../constants/date-time.js";
|
|
2
|
+
import { getOffsetBetweenTimezone as D, convertEpochToDateTime as H, getTimeUnits as M, convertToMilliseconds as w } from "../../helpers/date-time.js";
|
|
3
|
+
import { GOAL_CATEGORY as O } from "../milestone/constants.js";
|
|
4
4
|
import { getGoalsFromConfig as G } from "../milestone/create/milestone-create-helpers.js";
|
|
5
|
-
import { HIGH_ENROLLMENT_PROGRAMS_MAP as v, TrialPageId as
|
|
6
|
-
const
|
|
7
|
-
const e = n ? [...n] : [],
|
|
8
|
-
...
|
|
5
|
+
import { HIGH_ENROLLMENT_PROGRAMS_MAP as v, TrialPageId as i, TEACHER_TIMEZONE as U } from "./trial-session-constants.js";
|
|
6
|
+
const j = (n) => n === "PLA", B = (n, t, a) => {
|
|
7
|
+
const e = n ? [...n] : [], r = e.findIndex((c) => c.goal_category === t), d = {
|
|
8
|
+
...a,
|
|
9
9
|
goal_category: t
|
|
10
10
|
};
|
|
11
|
-
return
|
|
12
|
-
...e[
|
|
13
|
-
...
|
|
14
|
-
}, e.filter((
|
|
15
|
-
},
|
|
11
|
+
return r === -1 ? e.push(d) : e[r] = {
|
|
12
|
+
...e[r],
|
|
13
|
+
...d
|
|
14
|
+
}, e.filter((c) => c.goal_code);
|
|
15
|
+
}, W = (n, t) => {
|
|
16
16
|
if (!t) return [];
|
|
17
|
-
const
|
|
18
|
-
return n.length > 0 ? n.filter((
|
|
19
|
-
const { selectedDay:
|
|
17
|
+
const a = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0), e = D(U, t), r = a + e, { day: d = "" } = H(r, t), c = C.indexOf(d);
|
|
18
|
+
return n.length > 0 ? n.filter((l) => l.selectedDay && l.selectedTime).map((l) => {
|
|
19
|
+
const { selectedDay: E, selectedTime: I } = l, { hours: N, minutes: _, period: f } = M(I), u = (C.indexOf(E) - c + 7) % 7;
|
|
20
20
|
return {
|
|
21
|
-
id:
|
|
22
|
-
value: `${
|
|
21
|
+
id: a + e + w({ days: u, hours: N, minutes: _ }),
|
|
22
|
+
value: `${E}, ${I} - ${N + 1}:${_ < 10 ? "0" : ""}${_} ${f}`
|
|
23
23
|
// Formatted the value string as required
|
|
24
24
|
};
|
|
25
25
|
}) : [];
|
|
26
|
-
},
|
|
27
|
-
const
|
|
28
|
-
return { weekday:
|
|
29
|
-
}),
|
|
26
|
+
}, Y = (n) => n.filter((t) => typeof t.id == "number" && !isNaN(t.id)).map((t) => {
|
|
27
|
+
const a = new Date(t.id), e = C[a.getDay()], r = e ? e.toLowerCase() : "unknown", d = a.getHours(), c = a.getMinutes(), l = `${d.toString().padStart(2, "0")}:${c.toString().padStart(2, "0")}:00`;
|
|
28
|
+
return { weekday: r, start_time: l };
|
|
29
|
+
}), Z = ({
|
|
30
30
|
milestoneConfigData: n,
|
|
31
31
|
trialHomeData: t,
|
|
32
|
-
grade:
|
|
32
|
+
grade: a,
|
|
33
33
|
goal: e
|
|
34
34
|
}) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
const { student: r, demo_info: d } = t, {
|
|
36
|
+
grade: c,
|
|
37
|
+
enrollment_type: l,
|
|
38
|
+
can_show_topic_selection: E = !0
|
|
39
|
+
} = r || {}, { stream: I, region_data: N } = d || {}, { opportunity_country: _ = "US" } = N || {}, f = (s) => G(n, {
|
|
40
|
+
countryCode: _,
|
|
41
|
+
grade: a || c || "",
|
|
42
|
+
goalCategory: s,
|
|
43
|
+
courseStream: I,
|
|
44
|
+
enrollmentType: l
|
|
45
|
+
}), m = f(O.TEST_PREP), u = f(O.ENRICHMENT), S = f(O.SCHOOL_SUCCESS).some(
|
|
46
|
+
(s) => s.id === e && Object.keys(v).includes(s.programCode ?? "")
|
|
44
47
|
);
|
|
45
|
-
if ((
|
|
48
|
+
if ((m == null ? void 0 : m.length) > 0 && (u == null ? void 0 : u.length) > 0 && !S && E)
|
|
46
49
|
return t;
|
|
47
|
-
const
|
|
48
|
-
var
|
|
49
|
-
return ((
|
|
50
|
-
})(),
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
const y = { ...t }, g = Object.fromEntries(y.pages.map((s) => [s.id, s])), P = (() => {
|
|
51
|
+
var s, T, o, p, h, R, x, A;
|
|
52
|
+
return ((T = (s = g[i.SCHOOL_GOALS]) == null ? void 0 : s.nextPage) == null ? void 0 : T.pageId) === i.TEST_PREP && m.length === 0 ? i.SCHOOL_GOALS : m.length > 0 && ((p = (o = g[i.TEST_PREP]) == null ? void 0 : o.nextPage) == null ? void 0 : p.pageId) === i.STUDENT_ENRICHMENT && u.length === 0 ? i.TEST_PREP : S ? ((R = (h = g[i.LEARNING_LEVEL]) == null ? void 0 : h.prevPage) == null ? void 0 : R.pageId) ?? null : E ? null : ((A = (x = g[i.TOPIC_SELECTION]) == null ? void 0 : x.prevPage) == null ? void 0 : A.pageId) ?? null;
|
|
53
|
+
})(), L = (() => {
|
|
54
|
+
var s, T, o;
|
|
55
|
+
return P ? S ? ((s = g[i.LEARNING_LEVEL]) == null ? void 0 : s.nextPage) ?? null : E ? (o = g[(u == null ? void 0 : u.length) === 0 ? i.STUDENT_ENRICHMENT : i.TEST_PREP]) == null ? void 0 : o.nextPage : ((T = g[i.TOPIC_SELECTION]) == null ? void 0 : T.nextPage) ?? null : null;
|
|
56
|
+
})();
|
|
57
|
+
if (L && P) {
|
|
58
|
+
const s = (o) => m.length === 0 && o === i.TEST_PREP || u.length === 0 && o === i.STUDENT_ENRICHMENT || S && o === i.LEARNING_LEVEL || !E && o === i.TOPIC_SELECTION, T = y.pages.filter((o) => !s(o.id));
|
|
59
|
+
y.pages = T.map((o) => {
|
|
60
|
+
var p;
|
|
61
|
+
return o.id === P ? { ...o, nextPage: L } : o.id === L.pageId ? {
|
|
62
|
+
...o,
|
|
57
63
|
prevPage: {
|
|
58
|
-
buttonLabel: ((
|
|
59
|
-
pageId:
|
|
64
|
+
buttonLabel: ((p = g[P]) == null ? void 0 : p.navigationLabel) ?? "",
|
|
65
|
+
pageId: P
|
|
60
66
|
}
|
|
61
|
-
} :
|
|
67
|
+
} : o;
|
|
62
68
|
});
|
|
63
69
|
}
|
|
64
|
-
return
|
|
65
|
-
},
|
|
70
|
+
return y;
|
|
71
|
+
}, q = (n, t) => {
|
|
66
72
|
var e;
|
|
67
|
-
const { preference_config:
|
|
68
|
-
return t.length > 0 ? ((e =
|
|
69
|
-
({ preference_code:
|
|
70
|
-
preference_code:
|
|
71
|
-
preference_name:
|
|
72
|
-
preference_category:
|
|
73
|
-
preference_description:
|
|
73
|
+
const { preference_config: a } = n;
|
|
74
|
+
return t.length > 0 ? ((e = a == null ? void 0 : a.filter((r) => t.includes(r.preference_code))) == null ? void 0 : e.map(
|
|
75
|
+
({ preference_code: r, preference_name: d, preference_category: c, preference_description: l }) => ({
|
|
76
|
+
preference_code: r,
|
|
77
|
+
preference_name: d,
|
|
78
|
+
preference_category: c,
|
|
79
|
+
preference_description: l
|
|
74
80
|
})
|
|
75
81
|
)) || [] : [];
|
|
76
|
-
},
|
|
82
|
+
}, z = (n, t, a = !1) => {
|
|
77
83
|
if (!(n != null && n.length)) return [];
|
|
78
|
-
if (
|
|
79
|
-
const e = n.find((
|
|
84
|
+
if (a) {
|
|
85
|
+
const e = n.find((r) => (r == null ? void 0 : r.preference_category) === t);
|
|
80
86
|
return e ? [e.preference_code] : [];
|
|
81
87
|
}
|
|
82
88
|
return n.filter((e) => (e == null ? void 0 : e.preference_category) === t).map((e) => e.preference_code);
|
|
83
89
|
};
|
|
84
90
|
export {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
Z as filterAndUpdateSlideNavigation,
|
|
92
|
+
W as getFormattedPreferences,
|
|
93
|
+
q as getFormattedStudentPersonalizedPreference,
|
|
94
|
+
z as getPreferenceCodesByCategory,
|
|
95
|
+
Y as getWeekdayAndStartTimeFromPreference,
|
|
96
|
+
j as isPLASource,
|
|
97
|
+
B as updateGoalInFormData
|
|
92
98
|
};
|
|
93
99
|
//# sourceMappingURL=helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","sources":["../../../src/features/trial-session/helper.ts"],"sourcesContent":["import { DAYS } from '../../constants/date-time';\nimport {\n convertEpochToDateTime,\n convertToMilliseconds,\n getOffsetBetweenTimezone,\n getTimeUnits,\n} from '../../helpers/date-time';\nimport { GOAL_CATEGORY } from '../milestone/constants';\nimport { getGoalsFromConfig } from '../milestone/create/milestone-create-helpers';\nimport type { IMilestoneConfig } from '../milestone/create/milestone-create-types';\nimport type { TPreference } from './comps/class-preference/class-preference-types';\nimport {\n TrialPageId,\n TEACHER_TIMEZONE,\n HIGH_ENROLLMENT_PROGRAMS_MAP,\n} from './trial-session-constants';\nimport type { ITrialHomeData, TGoals, TPreferenceSchema } from './trial-session-types';\n\nconst isPLASource = (source?: string): boolean => {\n return source === 'PLA';\n};\n\nconst updateGoalInFormData = (goals: TGoals[] | undefined, goalCategory: string, data: TGoals) => {\n const updatedGoals = goals ? [...goals] : [];\n const goalIndex = updatedGoals.findIndex(goal => goal.goal_category === goalCategory);\n\n const goalWithCategory = {\n ...data,\n goal_category: goalCategory,\n };\n\n if (goalIndex === -1) {\n // Add new goal if it doesn't exist\n updatedGoals.push(goalWithCategory);\n } else {\n // Update existing goal\n updatedGoals[goalIndex] = {\n ...updatedGoals[goalIndex],\n ...goalWithCategory,\n };\n }\n\n // Filter out any goals without goal_code (cleanup existing data)\n return updatedGoals.filter(goal => goal.goal_code);\n};\n\nconst getFormattedPreferences = (preferences: TPreference[], studentTimezone?: string) => {\n if (!studentTimezone) return [];\n\n const todayTimestamp = new Date().setHours(0, 0, 0, 0); // Set the current date to midnight.\n const timestampOffset = getOffsetBetweenTimezone(TEACHER_TIMEZONE, studentTimezone); // Offset between the teacher's and student's timezone.\n const studentTimestamp = todayTimestamp + timestampOffset; // Adjusting the current date to the student's timezone.\n const { day: today = '' } = convertEpochToDateTime(studentTimestamp, studentTimezone); // Current day at student's timezone.\n const currentDayIndex = DAYS.indexOf(today); // Current day index.\n\n return preferences.length > 0\n ? preferences\n .filter(preference => preference.selectedDay && preference.selectedTime)\n .map(preference => {\n const { selectedDay, selectedTime } = preference;\n // Extracting hours, minutes, and period from the selected time.\n const { hours, minutes, period } = getTimeUnits(selectedTime);\n\n // Calculating the index of the selected day in the DAYS array.\n const selectedDayIndex = DAYS.indexOf(selectedDay);\n const dayDifference = (selectedDayIndex - currentDayIndex + 7) % 7;\n\n // Calculate the epoch timestamp for the selected day and time in the student's timezone.\n const epochTimestamp =\n todayTimestamp +\n timestampOffset +\n convertToMilliseconds({ days: dayDifference, hours, minutes });\n\n return {\n id: epochTimestamp,\n value: `${selectedDay}, ${selectedTime} - ${hours + 1}:${\n minutes < 10 ? '0' : ''\n }${minutes} ${period}`, // Formatted the value string as required\n };\n })\n : [];\n};\n\n/**\n * Converts a list of epoch timestamps to normalized weekday and start_time.\n * @param epochs Array of epoch timestamps (number)\n * @returns Array of { weekday, start_time }\n */\nconst getWeekdayAndStartTimeFromPreference = (\n preference: Array<{ id: number; value: string }>,\n): Array<{ weekday: string; start_time: string }> => {\n return preference\n .filter(pref => typeof pref.id === 'number' && !isNaN(pref.id))\n .map(pref => {\n const date = new Date(pref.id);\n // Get weekday in lowercase\n const weekdayRaw = DAYS[date.getDay()];\n const weekday = weekdayRaw ? weekdayRaw.toLowerCase() : 'unknown';\n // Get time in HH:MM:SS format\n const hour = date.getHours();\n const minute = date.getMinutes();\n const start_time = `${hour.toString().padStart(2, '0')}:${minute\n .toString()\n .padStart(2, '0')}:00`;\n\n return { weekday, start_time };\n });\n};\n\nconst filterAndUpdateSlideNavigation = ({\n milestoneConfigData,\n trialHomeData,\n grade,\n goal,\n}: {\n milestoneConfigData: IMilestoneConfig;\n trialHomeData: ITrialHomeData;\n grade?: string;\n goal?: string;\n}) => {\n const { student, demo_info: demoInfo } = trialHomeData;\n const { grade: studentGrade, enrollment_type: enrollmentType } = student || {};\n const { stream, region_data: regionData } = demoInfo || {};\n const { opportunity_country: countryCode = 'US' } = regionData || {};\n\n const getGoals = (goalCategory: keyof typeof GOAL_CATEGORY) =>\n getGoalsFromConfig(milestoneConfigData, {\n countryCode,\n grade: grade || studentGrade || '',\n goalCategory,\n courseStream: stream,\n enrollmentType: enrollmentType,\n });\n\n const testPrepGoals = getGoals(GOAL_CATEGORY.TEST_PREP);\n const enrichmentGoals = getGoals(GOAL_CATEGORY.ENRICHMENT);\n const isHighEnrollmentProgramSelected = getGoals(GOAL_CATEGORY.SCHOOL_SUCCESS).some(\n g => g.id === goal && Object.keys(HIGH_ENROLLMENT_PROGRAMS_MAP).includes(g.programCode ?? ''),\n );\n\n if (\n testPrepGoals?.length > 0 &&\n enrichmentGoals?.length > 0 &&\n !isHighEnrollmentProgramSelected\n ) {\n return trialHomeData;\n }\n\n const updatedTrialHomeData = { ...trialHomeData };\n\n const pagesMap = Object.fromEntries(updatedTrialHomeData.pages.map(page => [page.id, page]));\n\n //slide whose nextPage reference needs to be updated\n const slideIdToUpdate = (() => {\n if (\n pagesMap[TrialPageId.SCHOOL_GOALS]?.nextPage?.pageId === TrialPageId.TEST_PREP &&\n testPrepGoals.length === 0\n ) {\n return TrialPageId.SCHOOL_GOALS;\n }\n\n if (\n testPrepGoals.length > 0 &&\n pagesMap[TrialPageId.TEST_PREP]?.nextPage?.pageId === TrialPageId.STUDENT_ENRICHMENT &&\n enrichmentGoals.length === 0\n ) {\n return TrialPageId.TEST_PREP;\n }\n\n if (isHighEnrollmentProgramSelected) {\n return pagesMap[TrialPageId.LEARNING_LEVEL]?.prevPage?.pageId ?? null;\n }\n\n return null;\n })();\n\n // the new next page reference for slideIdToUpdate\n const updatedNextPageInfo = slideIdToUpdate\n ? isHighEnrollmentProgramSelected\n ? pagesMap[TrialPageId.LEARNING_LEVEL]?.nextPage\n : pagesMap[\n enrichmentGoals?.length === 0 ? TrialPageId.STUDENT_ENRICHMENT : TrialPageId.TEST_PREP\n ]?.nextPage\n : null;\n\n // updating the nextPage and prevPage references\n if (updatedNextPageInfo && slideIdToUpdate) {\n const shouldRemoveSlide = (slideId: TrialPageId) =>\n (testPrepGoals.length === 0 && slideId === TrialPageId.TEST_PREP) ||\n (enrichmentGoals.length === 0 && slideId === TrialPageId.STUDENT_ENRICHMENT) ||\n (isHighEnrollmentProgramSelected && slideId === TrialPageId.LEARNING_LEVEL);\n\n const filteredSlides = updatedTrialHomeData.pages.filter(page => !shouldRemoveSlide(page.id));\n\n updatedTrialHomeData.pages = filteredSlides.map(page => {\n if (page.id === slideIdToUpdate) {\n return { ...page, nextPage: updatedNextPageInfo };\n }\n\n if (page.id === updatedNextPageInfo.pageId) {\n return {\n ...page,\n prevPage: {\n buttonLabel: pagesMap[slideIdToUpdate]?.navigationLabel ?? '',\n pageId: slideIdToUpdate,\n },\n };\n }\n\n return page;\n });\n }\n\n return updatedTrialHomeData;\n};\n\nconst getFormattedStudentPersonalizedPreference = (\n config: IMilestoneConfig,\n selectedCodes: string[],\n) => {\n const { preference_config: preferenceConfig } = config;\n\n if (selectedCodes.length > 0) {\n return (\n preferenceConfig\n ?.filter(pref => selectedCodes.includes(pref.preference_code))\n ?.map(\n ({ preference_code, preference_name, preference_category, preference_description }) => ({\n preference_code,\n preference_name,\n preference_category,\n preference_description,\n }),\n ) || []\n );\n }\n\n return [];\n};\n\nconst getPreferenceCodesByCategory = (\n preferences: TPreferenceSchema[],\n category: string,\n returnFirstOnly: boolean = false,\n): string[] => {\n if (!preferences?.length) return [];\n\n if (returnFirstOnly) {\n const firstMatch = preferences.find(pref => pref?.preference_category === category);\n\n return firstMatch ? [firstMatch.preference_code] : [];\n }\n\n return preferences\n .filter(pref => pref?.preference_category === category)\n .map(pref => pref.preference_code);\n};\n\nexport {\n isPLASource,\n filterAndUpdateSlideNavigation,\n updateGoalInFormData,\n getFormattedPreferences,\n getWeekdayAndStartTimeFromPreference,\n getFormattedStudentPersonalizedPreference,\n getPreferenceCodesByCategory,\n};\n"],"names":["isPLASource","source","updateGoalInFormData","goals","goalCategory","data","updatedGoals","goalIndex","goal","goalWithCategory","getFormattedPreferences","preferences","studentTimezone","todayTimestamp","timestampOffset","getOffsetBetweenTimezone","TEACHER_TIMEZONE","studentTimestamp","today","convertEpochToDateTime","currentDayIndex","DAYS","preference","selectedDay","selectedTime","hours","minutes","period","getTimeUnits","dayDifference","convertToMilliseconds","getWeekdayAndStartTimeFromPreference","pref","date","weekdayRaw","weekday","hour","minute","start_time","filterAndUpdateSlideNavigation","milestoneConfigData","trialHomeData","grade","student","demoInfo","studentGrade","enrollmentType","stream","regionData","countryCode","getGoals","getGoalsFromConfig","testPrepGoals","GOAL_CATEGORY","enrichmentGoals","isHighEnrollmentProgramSelected","g","HIGH_ENROLLMENT_PROGRAMS_MAP","updatedTrialHomeData","pagesMap","page","slideIdToUpdate","_b","_a","TrialPageId","_d","_c","_f","_e","updatedNextPageInfo","shouldRemoveSlide","slideId","filteredSlides","getFormattedStudentPersonalizedPreference","config","selectedCodes","preferenceConfig","preference_code","preference_name","preference_category","preference_description","getPreferenceCodesByCategory","category","returnFirstOnly","firstMatch"],"mappings":";;;;;AAkBM,MAAAA,IAAc,CAACC,MACZA,MAAW,OAGdC,IAAuB,CAACC,GAA6BC,GAAsBC,MAAiB;AAChG,QAAMC,IAAeH,IAAQ,CAAC,GAAGA,CAAK,IAAI,CAAA,GACpCI,IAAYD,EAAa,UAAU,CAAQE,MAAAA,EAAK,kBAAkBJ,CAAY,GAE9EK,IAAmB;AAAA,IACv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AIGD;AAAA,IAAA,CACR;AAAA,EACH;AAEO,SAAAF;AACT,GAEMe,IAA4C,CAChDC,GACAC,MACG;;AACG,QAAA,EAAE,mBAAmBC,EAAqB,IAAAF;AAE5C,SAAAC,EAAc,SAAS,MAEvBZ,IAAAa,KAAA,gBAAAA,EACI,OAAO,CAAQ5C,MAAA2C,EAAc,SAAS3C,EAAK,eAAe,OAD9D,gBAAA+B,EAEI;AAAA,IACA,CAAC,EAAE,iBAAAc,GAAiB,iBAAAC,GAAiB,qBAAAC,GAAqB,wBAAAC,SAA8B;AAAA,MACtF,iBAAAH;AAAA,MACA,iBAAAC;AAAA,MACA,qBAAAC;AAAA,MACA,wBAAAC;AAAA,IAAA;AAAA,QAEC,KAIJ;AACT,GAEMC,IAA+B,CACnCtE,GACAuE,GACAC,IAA2B,OACd;AACb,MAAI,EAACxE,KAAA,QAAAA,EAAa,QAAQ,QAAO;AAEjC,MAAIwE,GAAiB;AACnB,UAAMC,IAAazE,EAAY,KAAK,CAAQqB,OAAAA,KAAA,gBAAAA,EAAM,yBAAwBkD,CAAQ;AAElF,WAAOE,IAAa,CAACA,EAAW,eAAe,IAAI,CAAA;AAAA,EACrD;AAEO,SAAAzE,EACJ,OAAO,CAAAqB,OAAQA,KAAA,gBAAAA,EAAM,yBAAwBkD,CAAQ,EACrD,IAAI,CAAQlD,MAAAA,EAAK,eAAe;AACrC;"}
|
|
1
|
+
{"version":3,"file":"helper.js","sources":["../../../src/features/trial-session/helper.ts"],"sourcesContent":["import { DAYS } from '../../constants/date-time';\nimport {\n convertEpochToDateTime,\n convertToMilliseconds,\n getOffsetBetweenTimezone,\n getTimeUnits,\n} from '../../helpers/date-time';\nimport { GOAL_CATEGORY } from '../milestone/constants';\nimport { getGoalsFromConfig } from '../milestone/create/milestone-create-helpers';\nimport type { IMilestoneConfig } from '../milestone/create/milestone-create-types';\nimport type { TPreference } from './comps/class-preference/class-preference-types';\nimport {\n TrialPageId,\n TEACHER_TIMEZONE,\n HIGH_ENROLLMENT_PROGRAMS_MAP,\n} from './trial-session-constants';\nimport type { ITrialHomeData, TGoals, TPreferenceSchema } from './trial-session-types';\n\nconst isPLASource = (source?: string): boolean => {\n return source === 'PLA';\n};\n\nconst updateGoalInFormData = (goals: TGoals[] | undefined, goalCategory: string, data: TGoals) => {\n const updatedGoals = goals ? [...goals] : [];\n const goalIndex = updatedGoals.findIndex(goal => goal.goal_category === goalCategory);\n\n const goalWithCategory = {\n ...data,\n goal_category: goalCategory,\n };\n\n if (goalIndex === -1) {\n // Add new goal if it doesn't exist\n updatedGoals.push(goalWithCategory);\n } else {\n // Update existing goal\n updatedGoals[goalIndex] = {\n ...updatedGoals[goalIndex],\n ...goalWithCategory,\n };\n }\n\n // Filter out any goals without goal_code (cleanup existing data)\n return updatedGoals.filter(goal => goal.goal_code);\n};\n\nconst getFormattedPreferences = (preferences: TPreference[], studentTimezone?: string) => {\n if (!studentTimezone) return [];\n\n const todayTimestamp = new Date().setHours(0, 0, 0, 0); // Set the current date to midnight.\n const timestampOffset = getOffsetBetweenTimezone(TEACHER_TIMEZONE, studentTimezone); // Offset between the teacher's and student's timezone.\n const studentTimestamp = todayTimestamp + timestampOffset; // Adjusting the current date to the student's timezone.\n const { day: today = '' } = convertEpochToDateTime(studentTimestamp, studentTimezone); // Current day at student's timezone.\n const currentDayIndex = DAYS.indexOf(today); // Current day index.\n\n return preferences.length > 0\n ? preferences\n .filter(preference => preference.selectedDay && preference.selectedTime)\n .map(preference => {\n const { selectedDay, selectedTime } = preference;\n // Extracting hours, minutes, and period from the selected time.\n const { hours, minutes, period } = getTimeUnits(selectedTime);\n\n // Calculating the index of the selected day in the DAYS array.\n const selectedDayIndex = DAYS.indexOf(selectedDay);\n const dayDifference = (selectedDayIndex - currentDayIndex + 7) % 7;\n\n // Calculate the epoch timestamp for the selected day and time in the student's timezone.\n const epochTimestamp =\n todayTimestamp +\n timestampOffset +\n convertToMilliseconds({ days: dayDifference, hours, minutes });\n\n return {\n id: epochTimestamp,\n value: `${selectedDay}, ${selectedTime} - ${hours + 1}:${\n minutes < 10 ? '0' : ''\n }${minutes} ${period}`, // Formatted the value string as required\n };\n })\n : [];\n};\n\n/**\n * Converts a list of epoch timestamps to normalized weekday and start_time.\n * @param epochs Array of epoch timestamps (number)\n * @returns Array of { weekday, start_time }\n */\nconst getWeekdayAndStartTimeFromPreference = (\n preference: Array<{ id: number; value: string }>,\n): Array<{ weekday: string; start_time: string }> => {\n return preference\n .filter(pref => typeof pref.id === 'number' && !isNaN(pref.id))\n .map(pref => {\n const date = new Date(pref.id);\n // Get weekday in lowercase\n const weekdayRaw = DAYS[date.getDay()];\n const weekday = weekdayRaw ? weekdayRaw.toLowerCase() : 'unknown';\n // Get time in HH:MM:SS format\n const hour = date.getHours();\n const minute = date.getMinutes();\n const start_time = `${hour.toString().padStart(2, '0')}:${minute\n .toString()\n .padStart(2, '0')}:00`;\n\n return { weekday, start_time };\n });\n};\n\nconst filterAndUpdateSlideNavigation = ({\n milestoneConfigData,\n trialHomeData,\n grade,\n goal,\n}: {\n milestoneConfigData: IMilestoneConfig;\n trialHomeData: ITrialHomeData;\n grade?: string;\n goal?: string;\n}) => {\n const { student, demo_info: demoInfo } = trialHomeData;\n const {\n grade: studentGrade,\n enrollment_type: enrollmentType,\n can_show_topic_selection: canShowTopicSelection = true,\n } = student || {};\n const { stream, region_data: regionData } = demoInfo || {};\n const { opportunity_country: countryCode = 'US' } = regionData || {};\n\n const getGoals = (goalCategory: keyof typeof GOAL_CATEGORY) =>\n getGoalsFromConfig(milestoneConfigData, {\n countryCode,\n grade: grade || studentGrade || '',\n goalCategory,\n courseStream: stream,\n enrollmentType: enrollmentType,\n });\n\n const testPrepGoals = getGoals(GOAL_CATEGORY.TEST_PREP);\n const enrichmentGoals = getGoals(GOAL_CATEGORY.ENRICHMENT);\n const isHighEnrollmentProgramSelected = getGoals(GOAL_CATEGORY.SCHOOL_SUCCESS).some(\n g => g.id === goal && Object.keys(HIGH_ENROLLMENT_PROGRAMS_MAP).includes(g.programCode ?? ''),\n );\n\n if (\n testPrepGoals?.length > 0 &&\n enrichmentGoals?.length > 0 &&\n !isHighEnrollmentProgramSelected &&\n canShowTopicSelection\n ) {\n return trialHomeData;\n }\n\n const updatedTrialHomeData = { ...trialHomeData };\n\n const pagesMap = Object.fromEntries(updatedTrialHomeData.pages.map(page => [page.id, page]));\n\n //slide whose nextPage reference needs to be updated\n const slideIdToUpdate = (() => {\n if (\n pagesMap[TrialPageId.SCHOOL_GOALS]?.nextPage?.pageId === TrialPageId.TEST_PREP &&\n testPrepGoals.length === 0\n ) {\n return TrialPageId.SCHOOL_GOALS;\n }\n\n if (\n testPrepGoals.length > 0 &&\n pagesMap[TrialPageId.TEST_PREP]?.nextPage?.pageId === TrialPageId.STUDENT_ENRICHMENT &&\n enrichmentGoals.length === 0\n ) {\n return TrialPageId.TEST_PREP;\n }\n\n if (isHighEnrollmentProgramSelected) {\n return pagesMap[TrialPageId.LEARNING_LEVEL]?.prevPage?.pageId ?? null;\n }\n\n if (!canShowTopicSelection) {\n return pagesMap[TrialPageId.TOPIC_SELECTION]?.prevPage?.pageId ?? null;\n }\n\n return null;\n })();\n\n // the new next page reference for slideIdToUpdate\n const updatedNextPageInfo = (() => {\n if (!slideIdToUpdate) return null;\n\n if (isHighEnrollmentProgramSelected) {\n return pagesMap[TrialPageId.LEARNING_LEVEL]?.nextPage ?? null;\n }\n\n if (!canShowTopicSelection) {\n return pagesMap[TrialPageId.TOPIC_SELECTION]?.nextPage ?? null;\n }\n\n return pagesMap[\n enrichmentGoals?.length === 0 ? TrialPageId.STUDENT_ENRICHMENT : TrialPageId.TEST_PREP\n ]?.nextPage;\n })();\n\n // updating the nextPage and prevPage references\n if (updatedNextPageInfo && slideIdToUpdate) {\n const shouldRemoveSlide = (slideId: TrialPageId) =>\n (testPrepGoals.length === 0 && slideId === TrialPageId.TEST_PREP) ||\n (enrichmentGoals.length === 0 && slideId === TrialPageId.STUDENT_ENRICHMENT) ||\n (isHighEnrollmentProgramSelected && slideId === TrialPageId.LEARNING_LEVEL) ||\n (!canShowTopicSelection && slideId === TrialPageId.TOPIC_SELECTION);\n\n const filteredSlides = updatedTrialHomeData.pages.filter(page => !shouldRemoveSlide(page.id));\n\n updatedTrialHomeData.pages = filteredSlides.map(page => {\n if (page.id === slideIdToUpdate) {\n return { ...page, nextPage: updatedNextPageInfo };\n }\n\n if (page.id === updatedNextPageInfo.pageId) {\n return {\n ...page,\n prevPage: {\n buttonLabel: pagesMap[slideIdToUpdate]?.navigationLabel ?? '',\n pageId: slideIdToUpdate,\n },\n };\n }\n\n return page;\n });\n }\n\n return updatedTrialHomeData;\n};\n\nconst getFormattedStudentPersonalizedPreference = (\n config: IMilestoneConfig,\n selectedCodes: string[],\n) => {\n const { preference_config: preferenceConfig } = config;\n\n if (selectedCodes.length > 0) {\n return (\n preferenceConfig\n ?.filter(pref => selectedCodes.includes(pref.preference_code))\n ?.map(\n ({ preference_code, preference_name, preference_category, preference_description }) => ({\n preference_code,\n preference_name,\n preference_category,\n preference_description,\n }),\n ) || []\n );\n }\n\n return [];\n};\n\nconst getPreferenceCodesByCategory = (\n preferences: TPreferenceSchema[],\n category: string,\n returnFirstOnly: boolean = false,\n): string[] => {\n if (!preferences?.length) return [];\n\n if (returnFirstOnly) {\n const firstMatch = preferences.find(pref => pref?.preference_category === category);\n\n return firstMatch ? [firstMatch.preference_code] : [];\n }\n\n return preferences\n .filter(pref => pref?.preference_category === category)\n .map(pref => pref.preference_code);\n};\n\nexport {\n isPLASource,\n filterAndUpdateSlideNavigation,\n updateGoalInFormData,\n getFormattedPreferences,\n getWeekdayAndStartTimeFromPreference,\n getFormattedStudentPersonalizedPreference,\n getPreferenceCodesByCategory,\n};\n"],"names":["isPLASource","source","updateGoalInFormData","goals","goalCategory","data","updatedGoals","goalIndex","goal","goalWithCategory","getFormattedPreferences","preferences","studentTimezone","todayTimestamp","timestampOffset","getOffsetBetweenTimezone","TEACHER_TIMEZONE","studentTimestamp","today","convertEpochToDateTime","currentDayIndex","DAYS","preference","selectedDay","selectedTime","hours","minutes","period","getTimeUnits","dayDifference","convertToMilliseconds","getWeekdayAndStartTimeFromPreference","pref","date","weekdayRaw","weekday","hour","minute","start_time","filterAndUpdateSlideNavigation","milestoneConfigData","trialHomeData","grade","student","demoInfo","studentGrade","enrollmentType","canShowTopicSelection","stream","regionData","countryCode","getGoals","getGoalsFromConfig","testPrepGoals","GOAL_CATEGORY","enrichmentGoals","isHighEnrollmentProgramSelected","g","HIGH_ENROLLMENT_PROGRAMS_MAP","updatedTrialHomeData","pagesMap","page","slideIdToUpdate","_b","_a","TrialPageId","_d","_c","_f","_e","_h","_g","updatedNextPageInfo","shouldRemoveSlide","slideId","filteredSlides","getFormattedStudentPersonalizedPreference","config","selectedCodes","preferenceConfig","preference_code","preference_name","preference_category","preference_description","getPreferenceCodesByCategory","category","returnFirstOnly","firstMatch"],"mappings":";;;;;AAkBM,MAAAA,IAAc,CAACC,MACZA,MAAW,OAGdC,IAAuB,CAACC,GAA6BC,GAAsBC,MAAiB;AAChG,QAAMC,IAAeH,IAAQ,CAAC,GAAGA,CAAK,IAAI,CAAA,GACpCI,IAAYD,EAAa,UAAU,CAAQE,MAAAA,EAAK,kBAAkBJ,CAAY,GAE9EK,IAAmB;AAAA,IACvB,GAAGJ;AAAA,IACH,eAAeD;AAAA,EAAA;AAGjB,SAAIG,MAAc,KAEhBD,EAAa,KAAKG,CAAgB,IAGlCH,EAAaC,CAAS,IAAI;AAAA,IACxB,GAAGD,EAAaC,CAAS;AAAA,IACzB,GAAGE;AAAA,EAAA,GAKAH,EAAa,OAAO,CAAQE,MAAAA,EAAK,SAAS;AACnD,GAEME,IAA0B,CAACC,GAA4BC,MAA6B;AACpF,MAAA,CAACA,EAAiB,QAAO;AAEvB,QAAAC,yBAAqB,QAAO,SAAS,GAAG,GAAG,GAAG,CAAC,GAC/CC,IAAkBC,EAAyBC,GAAkBJ,CAAe,GAC5EK,IAAmBJ,IAAiBC,GACpC,EAAE,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