@cuemath/leap 3.5.30-link.4 → 3.5.31-as1
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/assets/illustrations/illustrations.js +43 -0
- package/dist/assets/illustrations/illustrations.js.map +1 -1
- package/dist/assets/images/images.js +0 -12
- package/dist/assets/images/images.js.map +1 -1
- package/dist/assets/line-icons/icons/carat-right.js +26 -0
- package/dist/assets/line-icons/icons/carat-right.js.map +1 -0
- package/dist/assets/line-icons/icons/dots-icon.js +21 -0
- package/dist/assets/line-icons/icons/dots-icon.js.map +1 -0
- package/dist/assets/line-icons/icons/pause-icon.js +24 -0
- package/dist/assets/line-icons/icons/pause-icon.js.map +1 -0
- package/dist/features/chapters/chapters-list/chapter-item/chapter-circular-progress/chapter-circular-progress.js +82 -0
- package/dist/features/chapters/chapters-list/chapter-item/chapter-circular-progress/chapter-circular-progress.js.map +1 -0
- package/dist/features/chapters/chapters-list/chapter-item/chapter-circular-progress/chapter-circular-progress.styled.js +77 -0
- package/dist/features/chapters/chapters-list/chapter-item/chapter-circular-progress/chapter-circular-progress.styled.js.map +1 -0
- package/dist/features/chapters/chapters-list/chapter-item/chapter-item-styled.js +18 -91
- package/dist/features/chapters/chapters-list/chapter-item/chapter-item-styled.js.map +1 -1
- package/dist/features/chapters/chapters-list/chapter-item/chapter-item.js +42 -58
- package/dist/features/chapters/chapters-list/chapter-item/chapter-item.js.map +1 -1
- package/dist/features/circle-games/game-launcher/comps/carousel/carousel-styled.js +16 -32
- package/dist/features/circle-games/game-launcher/comps/carousel/carousel-styled.js.map +1 -1
- package/dist/features/circle-games/game-launcher/comps/carousel/carousel.js +85 -87
- package/dist/features/circle-games/game-launcher/comps/carousel/carousel.js.map +1 -1
- package/dist/features/circle-games/game-launcher/hooks/use-game-launcher-journey/use-game-launcher-journey.js +35 -35
- package/dist/features/circle-games/game-launcher/hooks/use-game-launcher-journey/use-game-launcher-journey.js.map +1 -1
- package/dist/features/homework/card-title.js +8 -8
- package/dist/features/homework/card-title.js.map +1 -1
- package/dist/features/milestone/constants.js +15 -28
- package/dist/features/milestone/constants.js.map +1 -1
- package/dist/features/milestone/create/milestone-create-helpers.js +42 -43
- package/dist/features/milestone/create/milestone-create-helpers.js.map +1 -1
- package/dist/features/parent-dashboard/comps/compact-header/compact-header.js +5 -5
- package/dist/features/parent-dashboard/comps/compact-header/compact-header.js.map +1 -1
- package/dist/features/timeline/comps/constants.js +18 -18
- package/dist/features/timeline/comps/constants.js.map +1 -1
- package/dist/features/timeline/comps/daily-timeline-items/daily-timeline-items.js +14 -14
- package/dist/features/timeline/comps/daily-timeline-items/daily-timeline-items.js.map +1 -1
- package/dist/features/timeline/daily-timeline-styled.js +13 -9
- package/dist/features/timeline/daily-timeline-styled.js.map +1 -1
- package/dist/features/timeline/daily-timeline-types.js +4 -4
- package/dist/features/timeline/daily-timeline-types.js.map +1 -1
- package/dist/features/timeline/daily-timeline-view.js +9 -10
- package/dist/features/timeline/daily-timeline-view.js.map +1 -1
- package/dist/features/timeline/monthly-report/api/use-monthly-report-get.js +13 -0
- package/dist/features/timeline/monthly-report/api/use-monthly-report-get.js.map +1 -0
- package/dist/features/timeline/monthly-report/comps/achievements/achievements.js +59 -0
- package/dist/features/timeline/monthly-report/comps/achievements/achievements.js.map +1 -0
- package/dist/features/timeline/monthly-report/comps/achievements/achievements.styled.js +15 -0
- package/dist/features/timeline/monthly-report/comps/achievements/achievements.styled.js.map +1 -0
- package/dist/features/timeline/monthly-report/comps/achievements/constant.js +16 -0
- package/dist/features/timeline/monthly-report/comps/achievements/constant.js.map +1 -0
- package/dist/features/timeline/monthly-report/comps/activities/activities-card/activities-card.js +128 -0
- package/dist/features/timeline/monthly-report/comps/activities/activities-card/activities-card.js.map +1 -0
- package/dist/features/timeline/monthly-report/comps/activities/activities-card/activities-card.styled.js +53 -0
- package/dist/features/timeline/monthly-report/comps/activities/activities-card/activities-card.styled.js.map +1 -0
- package/dist/features/timeline/monthly-report/comps/activities/activities-card-puzzles/activities-card-puzzles.js +121 -0
- package/dist/features/timeline/monthly-report/comps/activities/activities-card-puzzles/activities-card-puzzles.js.map +1 -0
- package/dist/features/timeline/monthly-report/comps/activities/activities-card-puzzles/activities-card-puzzles.styled.js +58 -0
- package/dist/features/timeline/monthly-report/comps/activities/activities-card-puzzles/activities-card-puzzles.styled.js.map +1 -0
- package/dist/features/timeline/monthly-report/comps/activities/activities.js +27 -0
- package/dist/features/timeline/monthly-report/comps/activities/activities.js.map +1 -0
- package/dist/features/timeline/monthly-report/comps/activities/constants.js +96 -0
- package/dist/features/timeline/monthly-report/comps/activities/constants.js.map +1 -0
- package/dist/features/timeline/monthly-report/comps/activities/utils.js +15 -0
- package/dist/features/timeline/monthly-report/comps/activities/utils.js.map +1 -0
- package/dist/features/timeline/monthly-report/comps/attendance/attendance-constants.js +29 -0
- package/dist/features/timeline/monthly-report/comps/attendance/attendance-constants.js.map +1 -0
- package/dist/features/timeline/monthly-report/comps/attendance/attendance-utils.js +107 -0
- package/dist/features/timeline/monthly-report/comps/attendance/attendance-utils.js.map +1 -0
- package/dist/features/timeline/monthly-report/comps/attendance/attendance.js +44 -0
- package/dist/features/timeline/monthly-report/comps/attendance/attendance.js.map +1 -0
- package/dist/features/timeline/monthly-report/comps/attendance/attendance.styled.js +39 -0
- package/dist/features/timeline/monthly-report/comps/attendance/attendance.styled.js.map +1 -0
- package/dist/features/timeline/monthly-report/comps/attendance/attendence-view.js +52 -0
- package/dist/features/timeline/monthly-report/comps/attendance/attendence-view.js.map +1 -0
- package/dist/features/timeline/monthly-report/comps/feedback/feedback-styled.js +9 -0
- package/dist/features/timeline/monthly-report/comps/feedback/feedback-styled.js.map +1 -0
- package/dist/features/timeline/monthly-report/comps/feedback/feedback.js +94 -0
- package/dist/features/timeline/monthly-report/comps/feedback/feedback.js.map +1 -0
- package/dist/features/timeline/monthly-report/comps/goals/goals-card/goal-chapter-card.js +48 -0
- package/dist/features/timeline/monthly-report/comps/goals/goals-card/goal-chapter-card.js.map +1 -0
- package/dist/features/timeline/monthly-report/comps/goals/goals-card/goals-card-styled.js +28 -0
- package/dist/features/timeline/monthly-report/comps/goals/goals-card/goals-card-styled.js.map +1 -0
- package/dist/features/timeline/monthly-report/comps/goals/goals-card/goals-card.js +113 -0
- package/dist/features/timeline/monthly-report/comps/goals/goals-card/goals-card.js.map +1 -0
- package/dist/features/timeline/monthly-report/comps/goals/goals-constants.js +30 -0
- package/dist/features/timeline/monthly-report/comps/goals/goals-constants.js.map +1 -0
- package/dist/features/timeline/monthly-report/comps/goals/goals.js +22 -0
- package/dist/features/timeline/monthly-report/comps/goals/goals.js.map +1 -0
- package/dist/features/timeline/monthly-report/monthly-report-styled.js +14 -0
- package/dist/features/timeline/monthly-report/monthly-report-styled.js.map +1 -0
- package/dist/features/timeline/monthly-report/monthly-report-types.js +5 -0
- package/dist/features/timeline/monthly-report/monthly-report-types.js.map +1 -0
- package/dist/features/timeline/monthly-report/monthly-report.js +69 -0
- package/dist/features/timeline/monthly-report/monthly-report.js.map +1 -0
- package/dist/features/timeline/monthly-timeline/api/use-monthly-timeline-get.js +10 -0
- package/dist/features/timeline/monthly-timeline/api/use-monthly-timeline-get.js.map +1 -0
- package/dist/features/timeline/monthly-timeline/comps/monthly-card/monthly-card.js +87 -0
- package/dist/features/timeline/monthly-timeline/comps/monthly-card/monthly-card.js.map +1 -0
- package/dist/features/timeline/monthly-timeline/comps/monthly-card/monthly-card.styled.js +9 -0
- package/dist/features/timeline/monthly-timeline/comps/monthly-card/monthly-card.styled.js.map +1 -0
- package/dist/features/timeline/monthly-timeline/constants.js +40 -0
- package/dist/features/timeline/monthly-timeline/constants.js.map +1 -0
- package/dist/features/timeline/monthly-timeline/monthly-timeline-styled.js +13 -0
- package/dist/features/timeline/monthly-timeline/monthly-timeline-styled.js.map +1 -0
- package/dist/features/timeline/monthly-timeline/monthly-timeline-types.js +6 -0
- package/dist/features/timeline/monthly-timeline/monthly-timeline-types.js.map +1 -0
- package/dist/features/timeline/monthly-timeline/monthly-timeline-view.js +28 -0
- package/dist/features/timeline/monthly-timeline/monthly-timeline-view.js.map +1 -0
- package/dist/features/timeline/monthly-timeline/monthly-timeline.js +62 -0
- package/dist/features/timeline/monthly-timeline/monthly-timeline.js.map +1 -0
- package/dist/features/timeline/ptm-report/api/use-ptm-report-get.js +9 -0
- package/dist/features/timeline/ptm-report/api/use-ptm-report-get.js.map +1 -0
- package/dist/features/timeline/ptm-report/comps/key-need/key-need-styled.js +9 -0
- package/dist/features/timeline/ptm-report/comps/key-need/key-need-styled.js.map +1 -0
- package/dist/features/timeline/ptm-report/comps/key-need/key-need.js +35 -0
- package/dist/features/timeline/ptm-report/comps/key-need/key-need.js.map +1 -0
- package/dist/features/timeline/ptm-report/comps/parent-support/parent-support.js +53 -0
- package/dist/features/timeline/ptm-report/comps/parent-support/parent-support.js.map +1 -0
- package/dist/features/timeline/ptm-report/comps/real-world-projects/real-world-projects-styled.js +19 -0
- package/dist/features/timeline/ptm-report/comps/real-world-projects/real-world-projects-styled.js.map +1 -0
- package/dist/features/timeline/ptm-report/comps/real-world-projects/real-world-projects.js +50 -0
- package/dist/features/timeline/ptm-report/comps/real-world-projects/real-world-projects.js.map +1 -0
- package/dist/features/timeline/ptm-report/comps/report-card/report-card-styled.js +9 -0
- package/dist/features/timeline/ptm-report/comps/report-card/report-card-styled.js.map +1 -0
- package/dist/features/timeline/ptm-report/comps/report-card/report-card.js +22 -0
- package/dist/features/timeline/ptm-report/comps/report-card/report-card.js.map +1 -0
- package/dist/features/timeline/ptm-report/comps/school-support/school-support-styled.js +9 -0
- package/dist/features/timeline/ptm-report/comps/school-support/school-support-styled.js.map +1 -0
- package/dist/features/timeline/ptm-report/comps/school-support/school-support.js +84 -0
- package/dist/features/timeline/ptm-report/comps/school-support/school-support.js.map +1 -0
- package/dist/features/timeline/ptm-report/comps/strategies/strategies-constant.js +11 -0
- package/dist/features/timeline/ptm-report/comps/strategies/strategies-constant.js.map +1 -0
- package/dist/features/timeline/ptm-report/comps/strategies/strategies.js +36 -0
- package/dist/features/timeline/ptm-report/comps/strategies/strategies.js.map +1 -0
- package/dist/features/timeline/ptm-report/comps/strategy-card/strategy-card-styled.js +55 -0
- package/dist/features/timeline/ptm-report/comps/strategy-card/strategy-card-styled.js.map +1 -0
- package/dist/features/timeline/ptm-report/comps/strategy-card/strategy-card.js +35 -0
- package/dist/features/timeline/ptm-report/comps/strategy-card/strategy-card.js.map +1 -0
- package/dist/features/timeline/ptm-report/comps/student-info/student-info-styled.js +21 -0
- package/dist/features/timeline/ptm-report/comps/student-info/student-info-styled.js.map +1 -0
- package/dist/features/timeline/ptm-report/comps/student-info/student-info.js +21 -0
- package/dist/features/timeline/ptm-report/comps/student-info/student-info.js.map +1 -0
- package/dist/features/timeline/ptm-report/comps/support-card/support-card-styled.js +9 -0
- package/dist/features/timeline/ptm-report/comps/support-card/support-card-styled.js.map +1 -0
- package/dist/features/timeline/ptm-report/comps/support-card/support-card.js +30 -0
- package/dist/features/timeline/ptm-report/comps/support-card/support-card.js.map +1 -0
- package/dist/features/timeline/ptm-report/comps/teacher-observations/teacher-observations-constant.js +9 -0
- package/dist/features/timeline/ptm-report/comps/teacher-observations/teacher-observations-constant.js.map +1 -0
- package/dist/features/timeline/ptm-report/comps/teacher-observations/teacher-observations.js +56 -0
- package/dist/features/timeline/ptm-report/comps/teacher-observations/teacher-observations.js.map +1 -0
- package/dist/features/timeline/ptm-report/comps/upcoming-chapters/upcoming-chapters.js +15 -0
- package/dist/features/timeline/ptm-report/comps/upcoming-chapters/upcoming-chapters.js.map +1 -0
- package/dist/features/timeline/ptm-report/ptm-report-constants.js +16 -0
- package/dist/features/timeline/ptm-report/ptm-report-constants.js.map +1 -0
- package/dist/features/timeline/ptm-report/ptm-report-helpers.js +8 -0
- package/dist/features/timeline/ptm-report/ptm-report-helpers.js.map +1 -0
- package/dist/features/timeline/ptm-report/ptm-report-styled.js +11 -0
- package/dist/features/timeline/ptm-report/ptm-report-styled.js.map +1 -0
- package/dist/features/timeline/ptm-report/ptm-report-types.js +5 -0
- package/dist/features/timeline/ptm-report/ptm-report-types.js.map +1 -0
- package/dist/features/timeline/ptm-report/ptm-report.js +113 -0
- package/dist/features/timeline/ptm-report/ptm-report.js.map +1 -0
- package/dist/features/timeline/timeline-tabs/timeline-tabs-types.js +5 -0
- package/dist/features/timeline/timeline-tabs/timeline-tabs-types.js.map +1 -0
- package/dist/features/timeline/timeline-tabs/timeline-tabs.js +42 -0
- package/dist/features/timeline/timeline-tabs/timeline-tabs.js.map +1 -0
- package/dist/features/timeline/timeline-tabs/timeline-tabs.styled.js +37 -0
- package/dist/features/timeline/timeline-tabs/timeline-tabs.styled.js.map +1 -0
- package/dist/features/trial-session/comps/school-goals/school-goals.js +71 -82
- package/dist/features/trial-session/comps/school-goals/school-goals.js.map +1 -1
- package/dist/features/trial-session/comps/worksheet/worksheet.js +33 -42
- package/dist/features/trial-session/comps/worksheet/worksheet.js.map +1 -1
- package/dist/features/trial-session/helper.js +66 -69
- package/dist/features/trial-session/helper.js.map +1 -1
- package/dist/features/trial-session/hooks/use-slide-config-update.js +17 -22
- package/dist/features/trial-session/hooks/use-slide-config-update.js.map +1 -1
- package/dist/features/trial-session/hooks/use-trial-session-navigation.js +128 -139
- package/dist/features/trial-session/hooks/use-trial-session-navigation.js.map +1 -1
- package/dist/features/trial-session/left-panel/index.js.map +1 -1
- package/dist/features/trial-session/trial-session-constants.js +9 -16
- 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.js +66 -68
- package/dist/features/trial-session/trial-session.js.map +1 -1
- package/dist/features/ui/animated-arc/animated-arc-styled.js +7 -7
- package/dist/features/ui/animated-arc/animated-arc-styled.js.map +1 -1
- package/dist/features/ui/animated-arc/animated-arc.js +37 -26
- package/dist/features/ui/animated-arc/animated-arc.js.map +1 -1
- package/dist/features/ui/linear-progress-bar/linear-progress-bar.js +39 -0
- package/dist/features/ui/linear-progress-bar/linear-progress-bar.js.map +1 -0
- package/dist/features/ui/linear-progress-bar/linear-progress-bar.styled.js +23 -0
- package/dist/features/ui/linear-progress-bar/linear-progress-bar.styled.js.map +1 -0
- package/dist/features/ui/swipeable-carousel/constants.js +16 -0
- package/dist/features/ui/swipeable-carousel/constants.js.map +1 -0
- package/dist/features/ui/swipeable-carousel/swipeable-carousel-styled.js +57 -0
- package/dist/features/ui/swipeable-carousel/swipeable-carousel-styled.js.map +1 -0
- package/dist/features/ui/swipeable-carousel/swipeable-carousel.js +150 -0
- package/dist/features/ui/swipeable-carousel/swipeable-carousel.js.map +1 -0
- package/dist/features/ui/swipeable-component/swipeable-component-styled.js.map +1 -0
- package/dist/features/ui/swipeable-component/swipeable-component.js +27 -0
- package/dist/features/ui/swipeable-component/swipeable-component.js.map +1 -0
- package/dist/features/ui/theme/text.js +14 -0
- package/dist/features/ui/theme/text.js.map +1 -1
- package/dist/index.d.ts +246 -41
- package/dist/index.js +588 -568
- package/dist/index.js.map +1 -1
- package/dist/static/2021.2a1a2ec9.svg +1 -0
- package/dist/static/2022.2091553a.svg +1 -0
- package/dist/static/2023.ed718b4e.svg +1 -0
- package/dist/static/2024.aa60edc5.svg +1 -0
- package/dist/static/2025.014a8ad3.svg +1 -0
- package/dist/static/2026.95d70f27.svg +1 -0
- package/dist/static/2027.fe83a41c.svg +1 -0
- package/dist/static/2028.b1c253ef.svg +1 -0
- package/dist/static/apr.cd56f13d.svg +1 -0
- package/dist/static/aug.3ceade02.svg +1 -0
- package/dist/static/coding-report-icon.91a1e900.svg +1 -0
- package/dist/static/dec.90729a5e.svg +1 -0
- package/dist/static/elp-icon.d45b457d.svg +1 -0
- package/dist/static/empty-reports.fe92faad.svg +1 -0
- package/dist/static/english-icon.50c2e005.svg +1 -0
- package/dist/static/feb.a9ecd320.svg +1 -0
- package/dist/static/focus-blue.664be268.svg +1 -0
- package/dist/static/full-report.00112c74.svg +1 -0
- package/dist/static/jan.f8fb9c39.svg +1 -0
- package/dist/static/jul.04a98cf0.svg +1 -0
- package/dist/static/jun.9b6ab6bf.svg +1 -0
- package/dist/static/key.fa0b4c98.svg +1 -0
- package/dist/static/live-session-blue.ec7fa85f.svg +1 -0
- package/dist/static/mar.f8b372ef.svg +1 -0
- package/dist/static/math-fit-grey.c32f37b3.svg +1 -0
- package/dist/static/may.23adae48.svg +1 -0
- package/dist/static/no-report.4158fad3.svg +1 -0
- package/dist/static/nov.c44e4739.svg +1 -0
- package/dist/static/oct.856b3b3f.svg +1 -0
- package/dist/static/opened-book-green.faacda34.svg +1 -0
- package/dist/static/percentage-pattern-yellow.6a25e820.svg +1 -0
- package/dist/static/pi-orange.132b108d.svg +1 -0
- package/dist/static/ptm-report-icon.5089218f.svg +1 -0
- package/dist/static/puzzle-purple.60ff4884.svg +1 -0
- package/dist/static/question-mark-yellow.1925aa04.svg +1 -0
- package/dist/static/renewal-blue.1ab3b2d4.svg +1 -0
- package/dist/static/sat-report-icon.4331be86.svg +1 -0
- package/dist/static/science-report-icon.a0014c40.svg +1 -0
- package/dist/static/sep.2d547b31.svg +1 -0
- package/dist/static/thumbs-up-green.6a03b9d2.svg +1 -0
- package/dist/static/thumps-down.a1192a62.svg +1 -0
- package/dist/static/thumps-up.caa35a98.svg +1 -0
- package/dist/static/time-purple.ab1a458d.svg +1 -0
- package/package.json +3 -2
- package/dist/features/auth/comps/linear-progress-bar/linear-progress-bar-styled.js +0 -12
- package/dist/features/auth/comps/linear-progress-bar/linear-progress-bar-styled.js.map +0 -1
- package/dist/features/auth/comps/linear-progress-bar/linear-progress-bar.js +0 -34
- package/dist/features/auth/comps/linear-progress-bar/linear-progress-bar.js.map +0 -1
- package/dist/features/circle-games/game-launcher/comps/swipable-component/swipeable-component-styled.js.map +0 -1
- package/dist/features/circle-games/game-launcher/comps/swipable-component/swipeable-component.js +0 -26
- package/dist/features/circle-games/game-launcher/comps/swipable-component/swipeable-component.js.map +0 -1
- package/dist/static/apr.09a50ff7.png +0 -0
- package/dist/static/aug.7179d37e.png +0 -0
- package/dist/static/dec.09f7e315.png +0 -0
- package/dist/static/feb.9e72504d.png +0 -0
- package/dist/static/jan.da91944a.png +0 -0
- package/dist/static/jul.5a1c4932.png +0 -0
- package/dist/static/jun.62639c2f.png +0 -0
- package/dist/static/mar.f51bcfa6.png +0 -0
- package/dist/static/may.7c542020.png +0 -0
- package/dist/static/nov.058343e7.png +0 -0
- package/dist/static/oct.573ee19d.png +0 -0
- package/dist/static/sep.3ccb6468.png +0 -0
- /package/dist/features/{circle-games/game-launcher/comps/swipable-component → ui/swipeable-component}/swipeable-component-styled.js +0 -0
|
@@ -1,98 +1,95 @@
|
|
|
1
|
-
import { DAYS as
|
|
2
|
-
import { getOffsetBetweenTimezone as
|
|
3
|
-
import { GOAL_CATEGORY as
|
|
4
|
-
import { getGoalsFromConfig as
|
|
5
|
-
import {
|
|
6
|
-
const
|
|
7
|
-
const
|
|
1
|
+
import { DAYS as I } from "../../constants/date-time.js";
|
|
2
|
+
import { getOffsetBetweenTimezone as D, convertEpochToDateTime as O, getTimeUnits as R, convertToMilliseconds as x } from "../../helpers/date-time.js";
|
|
3
|
+
import { GOAL_CATEGORY as N } from "../milestone/constants.js";
|
|
4
|
+
import { getGoalsFromConfig as A } from "../milestone/create/milestone-create-helpers.js";
|
|
5
|
+
import { TrialPageId as u, TEACHER_TIMEZONE as C } from "./trial-session-constants.js";
|
|
6
|
+
const v = (n) => n === "PLA", U = (n, e, o) => {
|
|
7
|
+
const t = n ? [...n] : [], r = t == null ? void 0 : t.findIndex((s) => s.goal_category === e);
|
|
8
8
|
if (r === -1) {
|
|
9
|
-
const
|
|
9
|
+
const s = {
|
|
10
10
|
...o,
|
|
11
|
-
goal_category:
|
|
11
|
+
goal_category: e
|
|
12
12
|
};
|
|
13
|
-
|
|
13
|
+
t.push(s);
|
|
14
14
|
} else
|
|
15
|
-
|
|
16
|
-
...
|
|
15
|
+
t[r] = {
|
|
16
|
+
...t[r],
|
|
17
17
|
...o
|
|
18
18
|
};
|
|
19
|
-
return
|
|
20
|
-
},
|
|
21
|
-
if (!
|
|
22
|
-
const o = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0),
|
|
23
|
-
return n.length > 0 ? n.filter((
|
|
24
|
-
const { selectedDay:
|
|
19
|
+
return t;
|
|
20
|
+
}, b = (n, e) => {
|
|
21
|
+
if (!e) return [];
|
|
22
|
+
const o = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0), t = D(C, e), r = o + t, { day: s = "" } = O(r, e), l = I.indexOf(s);
|
|
23
|
+
return n.length > 0 ? n.filter((i) => i.selectedDay && i.selectedTime).map((i) => {
|
|
24
|
+
const { selectedDay: _, selectedTime: p } = i, { hours: f, minutes: c, period: d } = R(p), m = (I.indexOf(_) - l + 7) % 7;
|
|
25
25
|
return {
|
|
26
|
-
id: o +
|
|
27
|
-
value: `${
|
|
26
|
+
id: o + t + x({ days: m, hours: f, minutes: c }),
|
|
27
|
+
value: `${_}, ${p} - ${f + 1}:${c < 10 ? "0" : ""}${c} ${d}`
|
|
28
28
|
// Formatted the value string as required
|
|
29
29
|
};
|
|
30
30
|
}) : [];
|
|
31
|
-
},
|
|
32
|
-
const o = new Date(
|
|
33
|
-
return { weekday: r, start_time:
|
|
34
|
-
}),
|
|
31
|
+
}, F = (n) => n.filter((e) => typeof e.id == "number" && !isNaN(e.id)).map((e) => {
|
|
32
|
+
const o = new Date(e.id), t = I[o.getDay()], r = t ? t.toLowerCase() : "unknown", s = o.getHours(), l = o.getMinutes(), i = `${s.toString().padStart(2, "0")}:${l.toString().padStart(2, "0")}:00`;
|
|
33
|
+
return { weekday: r, start_time: i };
|
|
34
|
+
}), k = ({
|
|
35
35
|
milestoneConfigData: n,
|
|
36
|
-
trialHomeData:
|
|
37
|
-
grade: o
|
|
38
|
-
goal: e
|
|
36
|
+
trialHomeData: e,
|
|
37
|
+
grade: o
|
|
39
38
|
}) => {
|
|
40
|
-
var
|
|
41
|
-
const { student:
|
|
42
|
-
countryCode:
|
|
43
|
-
grade: o ||
|
|
44
|
-
goalCategory:
|
|
45
|
-
courseStream:
|
|
46
|
-
enrollmentType:
|
|
47
|
-
}),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
var _;
|
|
60
|
-
return a.id === S ? { ...a, nextPage: I } : a.id === I.pageId ? {
|
|
39
|
+
var h;
|
|
40
|
+
const { student: t, demo_info: r } = e, { grade: s, enrollment_type: l } = t || {}, { stream: i, region_data: _ } = r || {}, { opportunity_country: p = "US" } = _ || {}, f = (g) => A(n, {
|
|
41
|
+
countryCode: p,
|
|
42
|
+
grade: o || s || "",
|
|
43
|
+
goalCategory: g,
|
|
44
|
+
courseStream: i,
|
|
45
|
+
enrollmentType: l
|
|
46
|
+
}), c = f(N.TEST_PREP), d = f(N.ENRICHMENT);
|
|
47
|
+
if ((c == null ? void 0 : c.length) > 0 && (d == null ? void 0 : d.length) > 0)
|
|
48
|
+
return e;
|
|
49
|
+
const E = { ...e }, m = Object.fromEntries(E.pages.map((g) => [g.id, g])), T = (() => {
|
|
50
|
+
var g, P, a, S;
|
|
51
|
+
return ((P = (g = m[u.SCHOOL_GOALS]) == null ? void 0 : g.nextPage) == null ? void 0 : P.pageId) === u.TEST_PREP && c.length === 0 ? u.SCHOOL_GOALS : c.length > 0 && ((S = (a = m[u.TEST_PREP]) == null ? void 0 : a.nextPage) == null ? void 0 : S.pageId) === u.STUDENT_ENRICHMENT && d.length === 0 ? u.TEST_PREP : null;
|
|
52
|
+
})(), y = T ? (h = m[(d == null ? void 0 : d.length) === 0 ? u.STUDENT_ENRICHMENT : u.TEST_PREP]) == null ? void 0 : h.nextPage : null;
|
|
53
|
+
if (y && T) {
|
|
54
|
+
const g = (a) => c.length === 0 && a === u.TEST_PREP || d.length === 0 && a === u.STUDENT_ENRICHMENT, P = E.pages.filter((a) => !g(a.id));
|
|
55
|
+
E.pages = P.map((a) => {
|
|
56
|
+
var S;
|
|
57
|
+
return a.id === T ? { ...a, nextPage: y } : a.id === y.pageId ? {
|
|
61
58
|
...a,
|
|
62
59
|
prevPage: {
|
|
63
|
-
buttonLabel: ((
|
|
64
|
-
pageId:
|
|
60
|
+
buttonLabel: ((S = m[T]) == null ? void 0 : S.navigationLabel) ?? "",
|
|
61
|
+
pageId: T
|
|
65
62
|
}
|
|
66
63
|
} : a;
|
|
67
64
|
});
|
|
68
65
|
}
|
|
69
|
-
return
|
|
70
|
-
},
|
|
71
|
-
var
|
|
66
|
+
return E;
|
|
67
|
+
}, G = (n, e) => {
|
|
68
|
+
var t;
|
|
72
69
|
const { preference_config: o } = n;
|
|
73
|
-
return
|
|
74
|
-
({ preference_code: r, preference_name:
|
|
70
|
+
return e.length > 0 ? ((t = o == null ? void 0 : o.filter((r) => e.includes(r.preference_code))) == null ? void 0 : t.map(
|
|
71
|
+
({ preference_code: r, preference_name: s, preference_category: l, preference_description: i }) => ({
|
|
75
72
|
preference_code: r,
|
|
76
|
-
preference_name:
|
|
77
|
-
preference_category:
|
|
78
|
-
preference_description:
|
|
73
|
+
preference_name: s,
|
|
74
|
+
preference_category: l,
|
|
75
|
+
preference_description: i
|
|
79
76
|
})
|
|
80
77
|
)) || [] : [];
|
|
81
|
-
},
|
|
78
|
+
}, B = (n, e, o = !1) => {
|
|
82
79
|
if (!(n != null && n.length)) return [];
|
|
83
80
|
if (o) {
|
|
84
|
-
const
|
|
85
|
-
return
|
|
81
|
+
const t = n.find((r) => (r == null ? void 0 : r.preference_category) === e);
|
|
82
|
+
return t ? [t.preference_code] : [];
|
|
86
83
|
}
|
|
87
|
-
return n.filter((
|
|
84
|
+
return n.filter((t) => (t == null ? void 0 : t.preference_category) === e).map((t) => t.preference_code);
|
|
88
85
|
};
|
|
89
86
|
export {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
87
|
+
k as filterAndUpdateSlideNavigation,
|
|
88
|
+
b as getFormattedPreferences,
|
|
89
|
+
G as getFormattedStudentPersonalizedPreference,
|
|
90
|
+
B as getPreferenceCodesByCategory,
|
|
91
|
+
F as getWeekdayAndStartTimeFromPreference,
|
|
92
|
+
v as isPLASource,
|
|
93
|
+
U as updateGoalInFormData
|
|
97
94
|
};
|
|
98
95
|
//# 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 updateGoals = goals ? [...goals] : [];\n const goalIndex = updateGoals?.findIndex(goal => goal.goal_category === goalCategory);\n\n if (goalIndex === -1) {\n const schoolSuccessGoal = {\n ...data,\n goal_category: goalCategory,\n };\n\n updateGoals.push(schoolSuccessGoal);\n } else {\n updateGoals[goalIndex] = {\n ...updateGoals[goalIndex],\n ...data,\n };\n }\n\n return updateGoals;\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","updateGoals","goalIndex","goal","schoolSuccessGoal","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,IAAcH,IAAQ,CAAC,GAAGA,CAAK,IAAI,CAAA,GACnCI,IAAYD,KAAA,gBAAAA,EAAa,UAAU,CAAQE,MAAAA,EAAK,kBAAkBJ;AAExE,MAAIG,MAAc,IAAI;AACpB,UAAME,IAAoB;AAAA,MACxB,GAAGJ;AAAA,MACH,eAAeD;AAAA,IAAA;AAGjB,IAAAE,EAAY,KAAKG,CAAiB;AAAA,EAAA;AAElC,IAAA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E5C,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 { TEACHER_TIMEZONE, TrialPageId } 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 updateGoals = goals ? [...goals] : [];\n const goalIndex = updateGoals?.findIndex(goal => goal.goal_category === goalCategory);\n\n if (goalIndex === -1) {\n const schoolSuccessGoal = {\n ...data,\n goal_category: goalCategory,\n };\n\n updateGoals.push(schoolSuccessGoal);\n } else {\n updateGoals[goalIndex] = {\n ...updateGoals[goalIndex],\n ...data,\n };\n }\n\n return updateGoals;\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}: {\n milestoneConfigData: IMilestoneConfig;\n trialHomeData: ITrialHomeData;\n grade?: 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\n if (testPrepGoals?.length > 0 && enrichmentGoals?.length > 0) {\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 return null;\n })();\n\n // the new next page reference for slideIdToUpdate\n const updatedNextPageInfo = slideIdToUpdate\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\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","updateGoals","goalIndex","goal","schoolSuccessGoal","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","updatedTrialHomeData","pagesMap","page","slideIdToUpdate","_b","_a","TrialPageId","_d","_c","updatedNextPageInfo","shouldRemoveSlide","slideId","filteredSlides","getFormattedStudentPersonalizedPreference","config","selectedCodes","preferenceConfig","preference_code","preference_name","preference_category","preference_description","getPreferenceCodesByCategory","category","returnFirstOnly","firstMatch"],"mappings":";;;;;AAcM,MAAAA,IAAc,CAACC,MACZA,MAAW,OAGdC,IAAuB,CAACC,GAA6BC,GAAsBC,MAAiB;AAChG,QAAMC,IAAcH,IAAQ,CAAC,GAAGA,CAAK,IAAI,CAAA,GACnCI,IAAYD,KAAA,gBAAAA,EAAa,UAAU,CAAQE,MAAAA,EAAK,kBAAkBJ;AAExE,MAAIG,MAAc,IAAI;AACpB,UAAME,IAAoB;AAAA,MACxB,GAAGJ;AAAA,MACH,eAAeD;AAAA,IAAA;AAGjB,IAAAE,EAAY,KAAKG,CAAiB;AAAA,EAAA;AAElC,IAAAH,EAAYC,CAAS,IAAI;AAAA,MACvB,GAAGD,EAAYC,CAAS;AAAA,MACxB,GA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IAAapE,EAAY,KAAK,CAAQqB,OAAAA,KAAA,gBAAAA,EAAM,yBAAwB6C,CAAQ;AAElF,WAAOE,IAAa,CAACA,EAAW,eAAe,IAAI,CAAA;AAAA,EACrD;AAEO,SAAApE,EACJ,OAAO,CAAAqB,OAAQA,KAAA,gBAAAA,EAAM,yBAAwB6C,CAAQ,EACrD,IAAI,CAAQ7C,MAAAA,EAAK,eAAe;AACrC;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { useState as h, useCallback as
|
|
2
|
-
import { PREFERENCE_CATEGORY as
|
|
3
|
-
import { getGradesFromConfig as
|
|
1
|
+
import { useState as h, useCallback as O } from "react";
|
|
2
|
+
import { PREFERENCE_CATEGORY as p } from "../../milestone/constants.js";
|
|
3
|
+
import { getGradesFromConfig as T } from "../../milestone/create/milestone-create-helpers.js";
|
|
4
4
|
import { PREFERENCE_CODE_MAP as v } from "../comps/student-feedback/student-feedback-constants.js";
|
|
5
5
|
import { getPreferenceCodesByCategory as u } from "../helper.js";
|
|
6
|
-
const
|
|
6
|
+
const A = ({
|
|
7
7
|
teacherClassroomId: g,
|
|
8
8
|
milestoneConfig: n,
|
|
9
9
|
studentTimezone: o,
|
|
@@ -16,39 +16,34 @@ const F = ({
|
|
|
16
16
|
return !1;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
return { onRenderUpdateSlideConfig:
|
|
20
|
-
(
|
|
19
|
+
return { onRenderUpdateSlideConfig: O(
|
|
20
|
+
(E) => {
|
|
21
21
|
if (s)
|
|
22
22
|
return;
|
|
23
|
-
const { student:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
enrollment_type: P
|
|
27
|
-
} = E || {}, R = !!O(n).find(
|
|
28
|
-
(U) => U.id === c
|
|
29
|
-
), l = u(i, f.OBJECTIVES), e = u(
|
|
23
|
+
const { student: m, intel_student: S } = E, { student_preference: I } = S || {}, { preferences: i = [] } = I || {}, { name: P, grade: c } = m || {}, R = !!T(n).find(
|
|
24
|
+
(_) => _.id === c
|
|
25
|
+
), a = u(i, p.OBJECTIVES), e = u(
|
|
30
26
|
i,
|
|
31
|
-
|
|
27
|
+
p.POSITION,
|
|
32
28
|
!0
|
|
33
|
-
),
|
|
34
|
-
enrollmentType: P,
|
|
29
|
+
), d = a.length > 0 ? a : null, l = e.length > 0 ? e : null, f = e.length > 0 && e[0] ? [v[e[0]]] : null, U = {
|
|
35
30
|
studentTimezone: o,
|
|
36
|
-
name:
|
|
31
|
+
name: P,
|
|
37
32
|
grade: R ? c : "",
|
|
38
|
-
...
|
|
39
|
-
...
|
|
40
|
-
...
|
|
33
|
+
...d && { personalizedObjectives: d },
|
|
34
|
+
...l && { personalizedPosition: l },
|
|
35
|
+
...f && { personalizedLevel: f }
|
|
41
36
|
};
|
|
42
37
|
try {
|
|
43
38
|
window.localStorage.setItem(t, "true"), C(!0);
|
|
44
39
|
} catch {
|
|
45
40
|
}
|
|
46
|
-
r(
|
|
41
|
+
r(U);
|
|
47
42
|
},
|
|
48
43
|
[s, n, o, r, t]
|
|
49
44
|
) };
|
|
50
45
|
};
|
|
51
46
|
export {
|
|
52
|
-
|
|
47
|
+
A as useSlideConfigUpdate
|
|
53
48
|
};
|
|
54
49
|
//# sourceMappingURL=use-slide-config-update.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-slide-config-update.js","sources":["../../../../src/features/trial-session/hooks/use-slide-config-update.ts"],"sourcesContent":["import { useCallback, useState } from 'react';\n\nimport { PREFERENCE_CATEGORY } from '../../milestone/constants';\nimport { getGradesFromConfig } from '../../milestone/create/milestone-create-helpers';\nimport type { IMilestoneConfig } from '../../milestone/create/milestone-create-types';\nimport { PREFERENCE_CODE_MAP } from '../comps/student-feedback/student-feedback-constants';\nimport { getPreferenceCodesByCategory } from '../helper';\nimport type { ITrialHomeData, ITrialSessionFormFields } from '../trial-session-types';\n\ninterface UseSlideConfigUpdateProps {\n teacherClassroomId: string;\n milestoneConfig: IMilestoneConfig;\n studentTimezone?: string;\n updateSlideConfig: (config: Partial<ITrialSessionFormFields>) => void;\n}\n\nexport const useSlideConfigUpdate = ({\n teacherClassroomId,\n milestoneConfig,\n studentTimezone,\n updateSlideConfig,\n}: UseSlideConfigUpdateProps) => {\n const CACHE_KEY = `trialSessionConfigCache_${teacherClassroomId}`;\n\n // Check if config was already set for this student in localStorage\n const [isConfigSet, setIsConfigSet] = useState<boolean>(() => {\n try {\n return window.localStorage.getItem(CACHE_KEY) === 'true';\n } catch {\n return false;\n }\n });\n\n const onRenderUpdateSlideConfig = useCallback(\n (homeData: ITrialHomeData) => {\n // If config was already set for this student in this session, skip update\n if (isConfigSet) {\n return;\n }\n\n const { student, intel_student: intelStudent } = homeData;\n const { student_preference: studentPreference } = intelStudent || {};\n const { preferences = [] } = studentPreference || {};\n const {
|
|
1
|
+
{"version":3,"file":"use-slide-config-update.js","sources":["../../../../src/features/trial-session/hooks/use-slide-config-update.ts"],"sourcesContent":["import { useCallback, useState } from 'react';\n\nimport { PREFERENCE_CATEGORY } from '../../milestone/constants';\nimport { getGradesFromConfig } from '../../milestone/create/milestone-create-helpers';\nimport type { IMilestoneConfig } from '../../milestone/create/milestone-create-types';\nimport { PREFERENCE_CODE_MAP } from '../comps/student-feedback/student-feedback-constants';\nimport { getPreferenceCodesByCategory } from '../helper';\nimport type { ITrialHomeData, ITrialSessionFormFields } from '../trial-session-types';\n\ninterface UseSlideConfigUpdateProps {\n teacherClassroomId: string;\n milestoneConfig: IMilestoneConfig;\n studentTimezone?: string;\n updateSlideConfig: (config: Partial<ITrialSessionFormFields>) => void;\n}\n\nexport const useSlideConfigUpdate = ({\n teacherClassroomId,\n milestoneConfig,\n studentTimezone,\n updateSlideConfig,\n}: UseSlideConfigUpdateProps) => {\n const CACHE_KEY = `trialSessionConfigCache_${teacherClassroomId}`;\n\n // Check if config was already set for this student in localStorage\n const [isConfigSet, setIsConfigSet] = useState<boolean>(() => {\n try {\n return window.localStorage.getItem(CACHE_KEY) === 'true';\n } catch {\n return false;\n }\n });\n\n const onRenderUpdateSlideConfig = useCallback(\n (homeData: ITrialHomeData) => {\n // If config was already set for this student in this session, skip update\n if (isConfigSet) {\n return;\n }\n\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 const objectivesToUpdate = objectives.length > 0 ? objectives : null;\n const positionToUpdate = position.length > 0 ? position : null;\n const levelToUpdate =\n position.length > 0 && position[0]\n ? [PREFERENCE_CODE_MAP[position[0] as keyof typeof PREFERENCE_CODE_MAP]]\n : null;\n\n const configToUpdate: Partial<ITrialSessionFormFields> = {\n studentTimezone,\n name: studentName,\n grade: IsGradeExistInMilestoneConfig ? studentGrade : '',\n ...(objectivesToUpdate && { personalizedObjectives: objectivesToUpdate }),\n ...(positionToUpdate && { personalizedPosition: positionToUpdate }),\n ...(levelToUpdate && { personalizedLevel: levelToUpdate }),\n };\n\n // Mark config as set in window. and state\n try {\n window.localStorage.setItem(CACHE_KEY, 'true');\n setIsConfigSet(true);\n } catch {\n // Silent catch\n }\n\n updateSlideConfig(configToUpdate);\n },\n [isConfigSet, milestoneConfig, studentTimezone, updateSlideConfig, CACHE_KEY],\n );\n\n return { onRenderUpdateSlideConfig };\n};\n"],"names":["useSlideConfigUpdate","teacherClassroomId","milestoneConfig","studentTimezone","updateSlideConfig","CACHE_KEY","isConfigSet","setIsConfigSet","useState","useCallback","homeData","student","intelStudent","studentPreference","preferences","studentName","studentGrade","IsGradeExistInMilestoneConfig","getGradesFromConfig","element","objectives","getPreferenceCodesByCategory","PREFERENCE_CATEGORY","position","objectivesToUpdate","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