@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.
Files changed (270) hide show
  1. package/dist/assets/illustrations/illustrations.js +43 -0
  2. package/dist/assets/illustrations/illustrations.js.map +1 -1
  3. package/dist/assets/images/images.js +0 -12
  4. package/dist/assets/images/images.js.map +1 -1
  5. package/dist/assets/line-icons/icons/carat-right.js +26 -0
  6. package/dist/assets/line-icons/icons/carat-right.js.map +1 -0
  7. package/dist/assets/line-icons/icons/dots-icon.js +21 -0
  8. package/dist/assets/line-icons/icons/dots-icon.js.map +1 -0
  9. package/dist/assets/line-icons/icons/pause-icon.js +24 -0
  10. package/dist/assets/line-icons/icons/pause-icon.js.map +1 -0
  11. package/dist/features/chapters/chapters-list/chapter-item/chapter-circular-progress/chapter-circular-progress.js +82 -0
  12. package/dist/features/chapters/chapters-list/chapter-item/chapter-circular-progress/chapter-circular-progress.js.map +1 -0
  13. package/dist/features/chapters/chapters-list/chapter-item/chapter-circular-progress/chapter-circular-progress.styled.js +77 -0
  14. package/dist/features/chapters/chapters-list/chapter-item/chapter-circular-progress/chapter-circular-progress.styled.js.map +1 -0
  15. package/dist/features/chapters/chapters-list/chapter-item/chapter-item-styled.js +18 -91
  16. package/dist/features/chapters/chapters-list/chapter-item/chapter-item-styled.js.map +1 -1
  17. package/dist/features/chapters/chapters-list/chapter-item/chapter-item.js +42 -58
  18. package/dist/features/chapters/chapters-list/chapter-item/chapter-item.js.map +1 -1
  19. package/dist/features/circle-games/game-launcher/comps/carousel/carousel-styled.js +16 -32
  20. package/dist/features/circle-games/game-launcher/comps/carousel/carousel-styled.js.map +1 -1
  21. package/dist/features/circle-games/game-launcher/comps/carousel/carousel.js +85 -87
  22. package/dist/features/circle-games/game-launcher/comps/carousel/carousel.js.map +1 -1
  23. package/dist/features/circle-games/game-launcher/hooks/use-game-launcher-journey/use-game-launcher-journey.js +35 -35
  24. package/dist/features/circle-games/game-launcher/hooks/use-game-launcher-journey/use-game-launcher-journey.js.map +1 -1
  25. package/dist/features/homework/card-title.js +8 -8
  26. package/dist/features/homework/card-title.js.map +1 -1
  27. package/dist/features/milestone/constants.js +15 -28
  28. package/dist/features/milestone/constants.js.map +1 -1
  29. package/dist/features/milestone/create/milestone-create-helpers.js +42 -43
  30. package/dist/features/milestone/create/milestone-create-helpers.js.map +1 -1
  31. package/dist/features/parent-dashboard/comps/compact-header/compact-header.js +5 -5
  32. package/dist/features/parent-dashboard/comps/compact-header/compact-header.js.map +1 -1
  33. package/dist/features/timeline/comps/constants.js +18 -18
  34. package/dist/features/timeline/comps/constants.js.map +1 -1
  35. package/dist/features/timeline/comps/daily-timeline-items/daily-timeline-items.js +14 -14
  36. package/dist/features/timeline/comps/daily-timeline-items/daily-timeline-items.js.map +1 -1
  37. package/dist/features/timeline/daily-timeline-styled.js +13 -9
  38. package/dist/features/timeline/daily-timeline-styled.js.map +1 -1
  39. package/dist/features/timeline/daily-timeline-types.js +4 -4
  40. package/dist/features/timeline/daily-timeline-types.js.map +1 -1
  41. package/dist/features/timeline/daily-timeline-view.js +9 -10
  42. package/dist/features/timeline/daily-timeline-view.js.map +1 -1
  43. package/dist/features/timeline/monthly-report/api/use-monthly-report-get.js +13 -0
  44. package/dist/features/timeline/monthly-report/api/use-monthly-report-get.js.map +1 -0
  45. package/dist/features/timeline/monthly-report/comps/achievements/achievements.js +59 -0
  46. package/dist/features/timeline/monthly-report/comps/achievements/achievements.js.map +1 -0
  47. package/dist/features/timeline/monthly-report/comps/achievements/achievements.styled.js +15 -0
  48. package/dist/features/timeline/monthly-report/comps/achievements/achievements.styled.js.map +1 -0
  49. package/dist/features/timeline/monthly-report/comps/achievements/constant.js +16 -0
  50. package/dist/features/timeline/monthly-report/comps/achievements/constant.js.map +1 -0
  51. package/dist/features/timeline/monthly-report/comps/activities/activities-card/activities-card.js +128 -0
  52. package/dist/features/timeline/monthly-report/comps/activities/activities-card/activities-card.js.map +1 -0
  53. package/dist/features/timeline/monthly-report/comps/activities/activities-card/activities-card.styled.js +53 -0
  54. package/dist/features/timeline/monthly-report/comps/activities/activities-card/activities-card.styled.js.map +1 -0
  55. package/dist/features/timeline/monthly-report/comps/activities/activities-card-puzzles/activities-card-puzzles.js +121 -0
  56. package/dist/features/timeline/monthly-report/comps/activities/activities-card-puzzles/activities-card-puzzles.js.map +1 -0
  57. package/dist/features/timeline/monthly-report/comps/activities/activities-card-puzzles/activities-card-puzzles.styled.js +58 -0
  58. package/dist/features/timeline/monthly-report/comps/activities/activities-card-puzzles/activities-card-puzzles.styled.js.map +1 -0
  59. package/dist/features/timeline/monthly-report/comps/activities/activities.js +27 -0
  60. package/dist/features/timeline/monthly-report/comps/activities/activities.js.map +1 -0
  61. package/dist/features/timeline/monthly-report/comps/activities/constants.js +96 -0
  62. package/dist/features/timeline/monthly-report/comps/activities/constants.js.map +1 -0
  63. package/dist/features/timeline/monthly-report/comps/activities/utils.js +15 -0
  64. package/dist/features/timeline/monthly-report/comps/activities/utils.js.map +1 -0
  65. package/dist/features/timeline/monthly-report/comps/attendance/attendance-constants.js +29 -0
  66. package/dist/features/timeline/monthly-report/comps/attendance/attendance-constants.js.map +1 -0
  67. package/dist/features/timeline/monthly-report/comps/attendance/attendance-utils.js +107 -0
  68. package/dist/features/timeline/monthly-report/comps/attendance/attendance-utils.js.map +1 -0
  69. package/dist/features/timeline/monthly-report/comps/attendance/attendance.js +44 -0
  70. package/dist/features/timeline/monthly-report/comps/attendance/attendance.js.map +1 -0
  71. package/dist/features/timeline/monthly-report/comps/attendance/attendance.styled.js +39 -0
  72. package/dist/features/timeline/monthly-report/comps/attendance/attendance.styled.js.map +1 -0
  73. package/dist/features/timeline/monthly-report/comps/attendance/attendence-view.js +52 -0
  74. package/dist/features/timeline/monthly-report/comps/attendance/attendence-view.js.map +1 -0
  75. package/dist/features/timeline/monthly-report/comps/feedback/feedback-styled.js +9 -0
  76. package/dist/features/timeline/monthly-report/comps/feedback/feedback-styled.js.map +1 -0
  77. package/dist/features/timeline/monthly-report/comps/feedback/feedback.js +94 -0
  78. package/dist/features/timeline/monthly-report/comps/feedback/feedback.js.map +1 -0
  79. package/dist/features/timeline/monthly-report/comps/goals/goals-card/goal-chapter-card.js +48 -0
  80. package/dist/features/timeline/monthly-report/comps/goals/goals-card/goal-chapter-card.js.map +1 -0
  81. package/dist/features/timeline/monthly-report/comps/goals/goals-card/goals-card-styled.js +28 -0
  82. package/dist/features/timeline/monthly-report/comps/goals/goals-card/goals-card-styled.js.map +1 -0
  83. package/dist/features/timeline/monthly-report/comps/goals/goals-card/goals-card.js +113 -0
  84. package/dist/features/timeline/monthly-report/comps/goals/goals-card/goals-card.js.map +1 -0
  85. package/dist/features/timeline/monthly-report/comps/goals/goals-constants.js +30 -0
  86. package/dist/features/timeline/monthly-report/comps/goals/goals-constants.js.map +1 -0
  87. package/dist/features/timeline/monthly-report/comps/goals/goals.js +22 -0
  88. package/dist/features/timeline/monthly-report/comps/goals/goals.js.map +1 -0
  89. package/dist/features/timeline/monthly-report/monthly-report-styled.js +14 -0
  90. package/dist/features/timeline/monthly-report/monthly-report-styled.js.map +1 -0
  91. package/dist/features/timeline/monthly-report/monthly-report-types.js +5 -0
  92. package/dist/features/timeline/monthly-report/monthly-report-types.js.map +1 -0
  93. package/dist/features/timeline/monthly-report/monthly-report.js +69 -0
  94. package/dist/features/timeline/monthly-report/monthly-report.js.map +1 -0
  95. package/dist/features/timeline/monthly-timeline/api/use-monthly-timeline-get.js +10 -0
  96. package/dist/features/timeline/monthly-timeline/api/use-monthly-timeline-get.js.map +1 -0
  97. package/dist/features/timeline/monthly-timeline/comps/monthly-card/monthly-card.js +87 -0
  98. package/dist/features/timeline/monthly-timeline/comps/monthly-card/monthly-card.js.map +1 -0
  99. package/dist/features/timeline/monthly-timeline/comps/monthly-card/monthly-card.styled.js +9 -0
  100. package/dist/features/timeline/monthly-timeline/comps/monthly-card/monthly-card.styled.js.map +1 -0
  101. package/dist/features/timeline/monthly-timeline/constants.js +40 -0
  102. package/dist/features/timeline/monthly-timeline/constants.js.map +1 -0
  103. package/dist/features/timeline/monthly-timeline/monthly-timeline-styled.js +13 -0
  104. package/dist/features/timeline/monthly-timeline/monthly-timeline-styled.js.map +1 -0
  105. package/dist/features/timeline/monthly-timeline/monthly-timeline-types.js +6 -0
  106. package/dist/features/timeline/monthly-timeline/monthly-timeline-types.js.map +1 -0
  107. package/dist/features/timeline/monthly-timeline/monthly-timeline-view.js +28 -0
  108. package/dist/features/timeline/monthly-timeline/monthly-timeline-view.js.map +1 -0
  109. package/dist/features/timeline/monthly-timeline/monthly-timeline.js +62 -0
  110. package/dist/features/timeline/monthly-timeline/monthly-timeline.js.map +1 -0
  111. package/dist/features/timeline/ptm-report/api/use-ptm-report-get.js +9 -0
  112. package/dist/features/timeline/ptm-report/api/use-ptm-report-get.js.map +1 -0
  113. package/dist/features/timeline/ptm-report/comps/key-need/key-need-styled.js +9 -0
  114. package/dist/features/timeline/ptm-report/comps/key-need/key-need-styled.js.map +1 -0
  115. package/dist/features/timeline/ptm-report/comps/key-need/key-need.js +35 -0
  116. package/dist/features/timeline/ptm-report/comps/key-need/key-need.js.map +1 -0
  117. package/dist/features/timeline/ptm-report/comps/parent-support/parent-support.js +53 -0
  118. package/dist/features/timeline/ptm-report/comps/parent-support/parent-support.js.map +1 -0
  119. package/dist/features/timeline/ptm-report/comps/real-world-projects/real-world-projects-styled.js +19 -0
  120. package/dist/features/timeline/ptm-report/comps/real-world-projects/real-world-projects-styled.js.map +1 -0
  121. package/dist/features/timeline/ptm-report/comps/real-world-projects/real-world-projects.js +50 -0
  122. package/dist/features/timeline/ptm-report/comps/real-world-projects/real-world-projects.js.map +1 -0
  123. package/dist/features/timeline/ptm-report/comps/report-card/report-card-styled.js +9 -0
  124. package/dist/features/timeline/ptm-report/comps/report-card/report-card-styled.js.map +1 -0
  125. package/dist/features/timeline/ptm-report/comps/report-card/report-card.js +22 -0
  126. package/dist/features/timeline/ptm-report/comps/report-card/report-card.js.map +1 -0
  127. package/dist/features/timeline/ptm-report/comps/school-support/school-support-styled.js +9 -0
  128. package/dist/features/timeline/ptm-report/comps/school-support/school-support-styled.js.map +1 -0
  129. package/dist/features/timeline/ptm-report/comps/school-support/school-support.js +84 -0
  130. package/dist/features/timeline/ptm-report/comps/school-support/school-support.js.map +1 -0
  131. package/dist/features/timeline/ptm-report/comps/strategies/strategies-constant.js +11 -0
  132. package/dist/features/timeline/ptm-report/comps/strategies/strategies-constant.js.map +1 -0
  133. package/dist/features/timeline/ptm-report/comps/strategies/strategies.js +36 -0
  134. package/dist/features/timeline/ptm-report/comps/strategies/strategies.js.map +1 -0
  135. package/dist/features/timeline/ptm-report/comps/strategy-card/strategy-card-styled.js +55 -0
  136. package/dist/features/timeline/ptm-report/comps/strategy-card/strategy-card-styled.js.map +1 -0
  137. package/dist/features/timeline/ptm-report/comps/strategy-card/strategy-card.js +35 -0
  138. package/dist/features/timeline/ptm-report/comps/strategy-card/strategy-card.js.map +1 -0
  139. package/dist/features/timeline/ptm-report/comps/student-info/student-info-styled.js +21 -0
  140. package/dist/features/timeline/ptm-report/comps/student-info/student-info-styled.js.map +1 -0
  141. package/dist/features/timeline/ptm-report/comps/student-info/student-info.js +21 -0
  142. package/dist/features/timeline/ptm-report/comps/student-info/student-info.js.map +1 -0
  143. package/dist/features/timeline/ptm-report/comps/support-card/support-card-styled.js +9 -0
  144. package/dist/features/timeline/ptm-report/comps/support-card/support-card-styled.js.map +1 -0
  145. package/dist/features/timeline/ptm-report/comps/support-card/support-card.js +30 -0
  146. package/dist/features/timeline/ptm-report/comps/support-card/support-card.js.map +1 -0
  147. package/dist/features/timeline/ptm-report/comps/teacher-observations/teacher-observations-constant.js +9 -0
  148. package/dist/features/timeline/ptm-report/comps/teacher-observations/teacher-observations-constant.js.map +1 -0
  149. package/dist/features/timeline/ptm-report/comps/teacher-observations/teacher-observations.js +56 -0
  150. package/dist/features/timeline/ptm-report/comps/teacher-observations/teacher-observations.js.map +1 -0
  151. package/dist/features/timeline/ptm-report/comps/upcoming-chapters/upcoming-chapters.js +15 -0
  152. package/dist/features/timeline/ptm-report/comps/upcoming-chapters/upcoming-chapters.js.map +1 -0
  153. package/dist/features/timeline/ptm-report/ptm-report-constants.js +16 -0
  154. package/dist/features/timeline/ptm-report/ptm-report-constants.js.map +1 -0
  155. package/dist/features/timeline/ptm-report/ptm-report-helpers.js +8 -0
  156. package/dist/features/timeline/ptm-report/ptm-report-helpers.js.map +1 -0
  157. package/dist/features/timeline/ptm-report/ptm-report-styled.js +11 -0
  158. package/dist/features/timeline/ptm-report/ptm-report-styled.js.map +1 -0
  159. package/dist/features/timeline/ptm-report/ptm-report-types.js +5 -0
  160. package/dist/features/timeline/ptm-report/ptm-report-types.js.map +1 -0
  161. package/dist/features/timeline/ptm-report/ptm-report.js +113 -0
  162. package/dist/features/timeline/ptm-report/ptm-report.js.map +1 -0
  163. package/dist/features/timeline/timeline-tabs/timeline-tabs-types.js +5 -0
  164. package/dist/features/timeline/timeline-tabs/timeline-tabs-types.js.map +1 -0
  165. package/dist/features/timeline/timeline-tabs/timeline-tabs.js +42 -0
  166. package/dist/features/timeline/timeline-tabs/timeline-tabs.js.map +1 -0
  167. package/dist/features/timeline/timeline-tabs/timeline-tabs.styled.js +37 -0
  168. package/dist/features/timeline/timeline-tabs/timeline-tabs.styled.js.map +1 -0
  169. package/dist/features/trial-session/comps/school-goals/school-goals.js +71 -82
  170. package/dist/features/trial-session/comps/school-goals/school-goals.js.map +1 -1
  171. package/dist/features/trial-session/comps/worksheet/worksheet.js +33 -42
  172. package/dist/features/trial-session/comps/worksheet/worksheet.js.map +1 -1
  173. package/dist/features/trial-session/helper.js +66 -69
  174. package/dist/features/trial-session/helper.js.map +1 -1
  175. package/dist/features/trial-session/hooks/use-slide-config-update.js +17 -22
  176. package/dist/features/trial-session/hooks/use-slide-config-update.js.map +1 -1
  177. package/dist/features/trial-session/hooks/use-trial-session-navigation.js +128 -139
  178. package/dist/features/trial-session/hooks/use-trial-session-navigation.js.map +1 -1
  179. package/dist/features/trial-session/left-panel/index.js.map +1 -1
  180. package/dist/features/trial-session/trial-session-constants.js +9 -16
  181. package/dist/features/trial-session/trial-session-constants.js.map +1 -1
  182. package/dist/features/trial-session/trial-session-types.js.map +1 -1
  183. package/dist/features/trial-session/trial-session.js +66 -68
  184. package/dist/features/trial-session/trial-session.js.map +1 -1
  185. package/dist/features/ui/animated-arc/animated-arc-styled.js +7 -7
  186. package/dist/features/ui/animated-arc/animated-arc-styled.js.map +1 -1
  187. package/dist/features/ui/animated-arc/animated-arc.js +37 -26
  188. package/dist/features/ui/animated-arc/animated-arc.js.map +1 -1
  189. package/dist/features/ui/linear-progress-bar/linear-progress-bar.js +39 -0
  190. package/dist/features/ui/linear-progress-bar/linear-progress-bar.js.map +1 -0
  191. package/dist/features/ui/linear-progress-bar/linear-progress-bar.styled.js +23 -0
  192. package/dist/features/ui/linear-progress-bar/linear-progress-bar.styled.js.map +1 -0
  193. package/dist/features/ui/swipeable-carousel/constants.js +16 -0
  194. package/dist/features/ui/swipeable-carousel/constants.js.map +1 -0
  195. package/dist/features/ui/swipeable-carousel/swipeable-carousel-styled.js +57 -0
  196. package/dist/features/ui/swipeable-carousel/swipeable-carousel-styled.js.map +1 -0
  197. package/dist/features/ui/swipeable-carousel/swipeable-carousel.js +150 -0
  198. package/dist/features/ui/swipeable-carousel/swipeable-carousel.js.map +1 -0
  199. package/dist/features/ui/swipeable-component/swipeable-component-styled.js.map +1 -0
  200. package/dist/features/ui/swipeable-component/swipeable-component.js +27 -0
  201. package/dist/features/ui/swipeable-component/swipeable-component.js.map +1 -0
  202. package/dist/features/ui/theme/text.js +14 -0
  203. package/dist/features/ui/theme/text.js.map +1 -1
  204. package/dist/index.d.ts +246 -41
  205. package/dist/index.js +588 -568
  206. package/dist/index.js.map +1 -1
  207. package/dist/static/2021.2a1a2ec9.svg +1 -0
  208. package/dist/static/2022.2091553a.svg +1 -0
  209. package/dist/static/2023.ed718b4e.svg +1 -0
  210. package/dist/static/2024.aa60edc5.svg +1 -0
  211. package/dist/static/2025.014a8ad3.svg +1 -0
  212. package/dist/static/2026.95d70f27.svg +1 -0
  213. package/dist/static/2027.fe83a41c.svg +1 -0
  214. package/dist/static/2028.b1c253ef.svg +1 -0
  215. package/dist/static/apr.cd56f13d.svg +1 -0
  216. package/dist/static/aug.3ceade02.svg +1 -0
  217. package/dist/static/coding-report-icon.91a1e900.svg +1 -0
  218. package/dist/static/dec.90729a5e.svg +1 -0
  219. package/dist/static/elp-icon.d45b457d.svg +1 -0
  220. package/dist/static/empty-reports.fe92faad.svg +1 -0
  221. package/dist/static/english-icon.50c2e005.svg +1 -0
  222. package/dist/static/feb.a9ecd320.svg +1 -0
  223. package/dist/static/focus-blue.664be268.svg +1 -0
  224. package/dist/static/full-report.00112c74.svg +1 -0
  225. package/dist/static/jan.f8fb9c39.svg +1 -0
  226. package/dist/static/jul.04a98cf0.svg +1 -0
  227. package/dist/static/jun.9b6ab6bf.svg +1 -0
  228. package/dist/static/key.fa0b4c98.svg +1 -0
  229. package/dist/static/live-session-blue.ec7fa85f.svg +1 -0
  230. package/dist/static/mar.f8b372ef.svg +1 -0
  231. package/dist/static/math-fit-grey.c32f37b3.svg +1 -0
  232. package/dist/static/may.23adae48.svg +1 -0
  233. package/dist/static/no-report.4158fad3.svg +1 -0
  234. package/dist/static/nov.c44e4739.svg +1 -0
  235. package/dist/static/oct.856b3b3f.svg +1 -0
  236. package/dist/static/opened-book-green.faacda34.svg +1 -0
  237. package/dist/static/percentage-pattern-yellow.6a25e820.svg +1 -0
  238. package/dist/static/pi-orange.132b108d.svg +1 -0
  239. package/dist/static/ptm-report-icon.5089218f.svg +1 -0
  240. package/dist/static/puzzle-purple.60ff4884.svg +1 -0
  241. package/dist/static/question-mark-yellow.1925aa04.svg +1 -0
  242. package/dist/static/renewal-blue.1ab3b2d4.svg +1 -0
  243. package/dist/static/sat-report-icon.4331be86.svg +1 -0
  244. package/dist/static/science-report-icon.a0014c40.svg +1 -0
  245. package/dist/static/sep.2d547b31.svg +1 -0
  246. package/dist/static/thumbs-up-green.6a03b9d2.svg +1 -0
  247. package/dist/static/thumps-down.a1192a62.svg +1 -0
  248. package/dist/static/thumps-up.caa35a98.svg +1 -0
  249. package/dist/static/time-purple.ab1a458d.svg +1 -0
  250. package/package.json +3 -2
  251. package/dist/features/auth/comps/linear-progress-bar/linear-progress-bar-styled.js +0 -12
  252. package/dist/features/auth/comps/linear-progress-bar/linear-progress-bar-styled.js.map +0 -1
  253. package/dist/features/auth/comps/linear-progress-bar/linear-progress-bar.js +0 -34
  254. package/dist/features/auth/comps/linear-progress-bar/linear-progress-bar.js.map +0 -1
  255. package/dist/features/circle-games/game-launcher/comps/swipable-component/swipeable-component-styled.js.map +0 -1
  256. package/dist/features/circle-games/game-launcher/comps/swipable-component/swipeable-component.js +0 -26
  257. package/dist/features/circle-games/game-launcher/comps/swipable-component/swipeable-component.js.map +0 -1
  258. package/dist/static/apr.09a50ff7.png +0 -0
  259. package/dist/static/aug.7179d37e.png +0 -0
  260. package/dist/static/dec.09f7e315.png +0 -0
  261. package/dist/static/feb.9e72504d.png +0 -0
  262. package/dist/static/jan.da91944a.png +0 -0
  263. package/dist/static/jul.5a1c4932.png +0 -0
  264. package/dist/static/jun.62639c2f.png +0 -0
  265. package/dist/static/mar.f51bcfa6.png +0 -0
  266. package/dist/static/may.7c542020.png +0 -0
  267. package/dist/static/nov.058343e7.png +0 -0
  268. package/dist/static/oct.573ee19d.png +0 -0
  269. package/dist/static/sep.3ccb6468.png +0 -0
  270. /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 R } from "../../constants/date-time.js";
2
- import { getOffsetBetweenTimezone as x, convertEpochToDateTime as C, getTimeUnits as H, convertToMilliseconds as M } from "../../helpers/date-time.js";
3
- import { GOAL_CATEGORY as L } from "../milestone/constants.js";
4
- import { getGoalsFromConfig as G } from "../milestone/create/milestone-create-helpers.js";
5
- import { HIGH_ENROLLMENT_PROGRAMS_MAP as v, TrialPageId as s, TEACHER_TIMEZONE as w } from "./trial-session-constants.js";
6
- const V = (n) => n === "PLA", j = (n, t, o) => {
7
- const e = n ? [...n] : [], r = e == null ? void 0 : e.findIndex((c) => c.goal_category === t);
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 c = {
9
+ const s = {
10
10
  ...o,
11
- goal_category: t
11
+ goal_category: e
12
12
  };
13
- e.push(c);
13
+ t.push(s);
14
14
  } else
15
- e[r] = {
16
- ...e[r],
15
+ t[r] = {
16
+ ...t[r],
17
17
  ...o
18
18
  };
19
- return e;
20
- }, B = (n, t) => {
21
- if (!t) return [];
22
- const o = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0), e = x(w, t), r = o + e, { day: c = "" } = C(r, t), u = R.indexOf(c);
23
- return n.length > 0 ? n.filter((d) => d.selectedDay && d.selectedTime).map((d) => {
24
- const { selectedDay: P, selectedTime: p } = d, { hours: y, minutes: m, period: l } = H(p), E = (R.indexOf(P) - u + 7) % 7;
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 + e + M({ days: E, hours: y, minutes: m }),
27
- value: `${P}, ${p} - ${y + 1}:${m < 10 ? "0" : ""}${m} ${l}`
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
- }, Y = (n) => n.filter((t) => typeof t.id == "number" && !isNaN(t.id)).map((t) => {
32
- const o = new Date(t.id), e = R[o.getDay()], r = e ? e.toLowerCase() : "unknown", c = o.getHours(), u = o.getMinutes(), d = `${c.toString().padStart(2, "0")}:${u.toString().padStart(2, "0")}:00`;
33
- return { weekday: r, start_time: d };
34
- }), W = ({
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: t,
37
- grade: o,
38
- goal: e
36
+ trialHomeData: e,
37
+ grade: o
39
38
  }) => {
40
- var O, h;
41
- const { student: r, demo_info: c } = t, { grade: u, enrollment_type: d } = r || {}, { stream: P, region_data: p } = c || {}, { opportunity_country: y = "US" } = p || {}, m = (i) => G(n, {
42
- countryCode: y,
43
- grade: o || u || "",
44
- goalCategory: i,
45
- courseStream: P,
46
- enrollmentType: d
47
- }), l = m(L.TEST_PREP), g = m(L.ENRICHMENT), E = m(L.SCHOOL_SUCCESS).some(
48
- (i) => i.id === e && Object.keys(v).includes(i.programCode ?? "")
49
- );
50
- if ((l == null ? void 0 : l.length) > 0 && (g == null ? void 0 : g.length) > 0 && !E)
51
- return t;
52
- const f = { ...t }, T = Object.fromEntries(f.pages.map((i) => [i.id, i])), S = (() => {
53
- var i, N, a, _, A, D;
54
- return ((N = (i = T[s.SCHOOL_GOALS]) == null ? void 0 : i.nextPage) == null ? void 0 : N.pageId) === s.TEST_PREP && l.length === 0 ? s.SCHOOL_GOALS : l.length > 0 && ((_ = (a = T[s.TEST_PREP]) == null ? void 0 : a.nextPage) == null ? void 0 : _.pageId) === s.STUDENT_ENRICHMENT && g.length === 0 ? s.TEST_PREP : E ? ((D = (A = T[s.LEARNING_LEVEL]) == null ? void 0 : A.prevPage) == null ? void 0 : D.pageId) ?? null : null;
55
- })(), I = S ? E ? (O = T[s.LEARNING_LEVEL]) == null ? void 0 : O.nextPage : (h = T[(g == null ? void 0 : g.length) === 0 ? s.STUDENT_ENRICHMENT : s.TEST_PREP]) == null ? void 0 : h.nextPage : null;
56
- if (I && S) {
57
- const i = (a) => l.length === 0 && a === s.TEST_PREP || g.length === 0 && a === s.STUDENT_ENRICHMENT || E && a === s.LEARNING_LEVEL, N = f.pages.filter((a) => !i(a.id));
58
- f.pages = N.map((a) => {
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: ((_ = T[S]) == null ? void 0 : _.navigationLabel) ?? "",
64
- pageId: S
60
+ buttonLabel: ((S = m[T]) == null ? void 0 : S.navigationLabel) ?? "",
61
+ pageId: T
65
62
  }
66
63
  } : a;
67
64
  });
68
65
  }
69
- return f;
70
- }, Z = (n, t) => {
71
- var e;
66
+ return E;
67
+ }, G = (n, e) => {
68
+ var t;
72
69
  const { preference_config: o } = n;
73
- return t.length > 0 ? ((e = o == null ? void 0 : o.filter((r) => t.includes(r.preference_code))) == null ? void 0 : e.map(
74
- ({ preference_code: r, preference_name: c, preference_category: u, preference_description: d }) => ({
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: c,
77
- preference_category: u,
78
- preference_description: d
73
+ preference_name: s,
74
+ preference_category: l,
75
+ preference_description: i
79
76
  })
80
77
  )) || [] : [];
81
- }, q = (n, t, o = !1) => {
78
+ }, B = (n, e, o = !1) => {
82
79
  if (!(n != null && n.length)) return [];
83
80
  if (o) {
84
- const e = n.find((r) => (r == null ? void 0 : r.preference_category) === t);
85
- return e ? [e.preference_code] : [];
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((e) => (e == null ? void 0 : e.preference_category) === t).map((e) => e.preference_code);
84
+ return n.filter((t) => (t == null ? void 0 : t.preference_category) === e).map((t) => t.preference_code);
88
85
  };
89
86
  export {
90
- W as filterAndUpdateSlideNavigation,
91
- B as getFormattedPreferences,
92
- Z as getFormattedStudentPersonalizedPreference,
93
- q as getPreferenceCodesByCategory,
94
- Y as getWeekdayAndStartTimeFromPreference,
95
- V as isPLASource,
96
- j as updateGoalInFormData
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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AA,QACH,UAAU;AAAA,UACR,eAAaG,IAAAJ,EAASE,CAAe,MAAxB,gBAAAE,EAA2B,oBAAmB;AAAA,UAC3D,QAAQF;AAAA,QACV;AAAA,MAAA,IAIGD;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 { 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,CA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B;AAAA,MACtF,iBAAAH;AAAA,MACA,iBAAAC;AAAA,MACA,qBAAAC;AAAA,MACA,wBAAAC;AAAA,IAAA;AAAA,QAEC,KAIJ;AACT,GAEMC,IAA+B,CACnCjE,GACAkE,GACAC,IAA2B,OACd;AACb,MAAI,EAACnE,KAAA,QAAAA,EAAa,QAAQ,QAAO;AAEjC,MAAImE,GAAiB;AACnB,UAAMC,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 y } from "react";
2
- import { PREFERENCE_CATEGORY as f } from "../../milestone/constants.js";
3
- import { getGradesFromConfig as O } from "../../milestone/create/milestone-create-helpers.js";
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 F = ({
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: y(
20
- (m) => {
19
+ return { onRenderUpdateSlideConfig: O(
20
+ (E) => {
21
21
  if (s)
22
22
  return;
23
- const { student: E, intel_student: S } = m, { student_preference: I } = S || {}, { preferences: i = [] } = I || {}, {
24
- name: _,
25
- grade: c,
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
- f.POSITION,
27
+ p.POSITION,
32
28
  !0
33
- ), a = l.length > 0 ? l : null, d = e.length > 0 ? e : null, p = e.length > 0 && e[0] ? [v[e[0]]] : null, T = {
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
- ...a && { personalizedObjectives: a },
39
- ...d && { personalizedPosition: d },
40
- ...p && { personalizedLevel: p }
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(T);
41
+ r(U);
47
42
  },
48
43
  [s, n, o, r, t]
49
44
  ) };
50
45
  };
51
46
  export {
52
- F as useSlideConfigUpdate
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 {\n name: studentName,\n grade: studentGrade,\n enrollment_type: enrollmentType,\n } = 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 enrollmentType,\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","enrollmentType","IsGradeExistInMilestoneConfig","getGradesFromConfig","element","objectives","getPreferenceCodesByCategory","PREFERENCE_CATEGORY","position","objectivesToUpdate","positionToUpdate","levelToUpdate","PREFERENCE_CODE_MAP","configToUpdate"],"mappings":";;;;;AAgBO,MAAMA,IAAuB,CAAC;AAAA,EACnC,oBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,mBAAAC;AACF,MAAiC;AACzB,QAAAC,IAAY,2BAA2BJ,CAAkB,IAGzD,CAACK,GAAaC,CAAc,IAAIC,EAAkB,MAAM;AACxD,QAAA;AACF,aAAO,OAAO,aAAa,QAAQH,CAAS,MAAM;AAAA,IAAA,QAC5C;AACC,aAAA;AAAA,IACT;AAAA,EAAA,CACD;AA2DD,SAAO,EAAE,2BAzDyBI;AAAA,IAChC,CAACC,MAA6B;AAE5B,UAAIJ;AACF;AAGF,YAAM,EAAE,SAAAK,GAAS,eAAeC,EAAA,IAAiBF,GAC3C,EAAE,oBAAoBG,MAAsBD,KAAgB,CAAA,GAC5D,EAAE,aAAAE,IAAc,CAAA,MAAOD,KAAqB,CAAA,GAC5C;AAAA,QACJ,MAAME;AAAA,QACN,OAAOC;AAAA,QACP,iBAAiBC;AAAA,MAAA,IACfN,KAAW,CAAA,GAETO,IAAgC,CAAC,CAACC,EAAoBjB,CAAe,EAAE;AAAA,QAC3E,CAAAkB,MAAWA,EAAQ,OAAOJ;AAAA,MAAA,GAGtBK,IAAaC,EAA6BR,GAAaS,EAAoB,UAAU,GACrFC,IAAWF;AAAA,QACfR;AAAA,QACAS,EAAoB;AAAA,QACpB;AAAA,MAAA,GAGIE,IAAqBJ,EAAW,SAAS,IAAIA,IAAa,MAC1DK,IAAmBF,EAAS,SAAS,IAAIA,IAAW,MACpDG,IACJH,EAAS,SAAS,KAAKA,EAAS,CAAC,IAC7B,CAACI,EAAoBJ,EAAS,CAAC,CAAqC,CAAC,IACrE,MAEAK,IAAmD;AAAA,QACvD,gBAAAZ;AAAA,QACA,iBAAAd;AAAA,QACA,MAAMY;AAAA,QACN,OAAOG,IAAgCF,IAAe;AAAA,QACtD,GAAIS,KAAsB,EAAE,wBAAwBA,EAAmB;AAAA,QACvE,GAAIC,KAAoB,EAAE,sBAAsBA,EAAiB;AAAA,QACjE,GAAIC,KAAiB,EAAE,mBAAmBA,EAAc;AAAA,MAAA;AAItD,UAAA;AACK,eAAA,aAAa,QAAQtB,GAAW,MAAM,GAC7CE,EAAe,EAAI;AAAA,MAAA,QACb;AAAA,MAER;AAEA,MAAAH,EAAkByB,CAAc;AAAA,IAClC;AAAA,IACA,CAACvB,GAAaJ,GAAiBC,GAAiBC,GAAmBC,CAAS;AAAA,EAAA,EAG3C;AACrC;"}
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","positionToUpdate","levelToUpdate","PREFERENCE_CODE_MAP","configToUpdate"],"mappings":";;;;;AAgBO,MAAMA,IAAuB,CAAC;AAAA,EACnC,oBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,mBAAAC;AACF,MAAiC;AACzB,QAAAC,IAAY,2BAA2BJ,CAAkB,IAGzD,CAACK,GAAaC,CAAc,IAAIC,EAAkB,MAAM;AACxD,QAAA;AACF,aAAO,OAAO,aAAa,QAAQH,CAAS,MAAM;AAAA,IAAA,QAC5C;AACC,aAAA;AAAA,IACT;AAAA,EAAA,CACD;AAsDD,SAAO,EAAE,2BApDyBI;AAAA,IAChC,CAACC,MAA6B;AAE5B,UAAIJ;AACF;AAGF,YAAM,EAAE,SAAAK,GAAS,eAAeC,EAAA,IAAiBF,GAC3C,EAAE,oBAAoBG,MAAsBD,KAAgB,CAAA,GAC5D,EAAE,aAAAE,IAAc,CAAA,MAAOD,KAAqB,CAAA,GAC5C,EAAE,MAAME,GAAa,OAAOC,EAAa,IAAIL,KAAW,IAExDM,IAAgC,CAAC,CAACC,EAAoBhB,CAAe,EAAE;AAAA,QAC3E,CAAAiB,MAAWA,EAAQ,OAAOH;AAAA,MAAA,GAGtBI,IAAaC,EAA6BP,GAAaQ,EAAoB,UAAU,GACrFC,IAAWF;AAAA,QACfP;AAAA,QACAQ,EAAoB;AAAA,QACpB;AAAA,MAAA,GAGIE,IAAqBJ,EAAW,SAAS,IAAIA,IAAa,MAC1DK,IAAmBF,EAAS,SAAS,IAAIA,IAAW,MACpDG,IACJH,EAAS,SAAS,KAAK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