@cuemath/leap 3.3.34 → 3.3.35-m

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 (224) hide show
  1. package/dist/assets/gif/gif.js +1 -4
  2. package/dist/assets/gif/gif.js.map +1 -1
  3. package/dist/assets/illustrations/illustrations.js +1 -1
  4. package/dist/assets/illustrations/illustrations.js.map +1 -1
  5. package/dist/assets/line-icons/icons/chevron-right.js.map +1 -1
  6. package/dist/features/auth/comps/animated-avatar-message/animated-avatar-message.js +1 -1
  7. package/dist/features/auth/comps/animated-avatar-message/animated-avatar-message.js.map +1 -1
  8. package/dist/features/auth/comps/otp-input/otp-input.js +29 -35
  9. package/dist/features/auth/comps/otp-input/otp-input.js.map +1 -1
  10. package/dist/features/auth/pla-signup/pla-analytics-events.js +3 -12
  11. package/dist/features/auth/pla-signup/pla-analytics-events.js.map +1 -1
  12. package/dist/features/chapters-v2/chapter-details/block-sections/block-sections.js +34 -43
  13. package/dist/features/chapters-v2/chapter-details/block-sections/block-sections.js.map +1 -1
  14. package/dist/features/chapters-v2/chapter-details/chapter-details.js +101 -140
  15. package/dist/features/chapters-v2/chapter-details/chapter-details.js.map +1 -1
  16. package/dist/features/chapters-v2/utils/index.js +16 -20
  17. package/dist/features/chapters-v2/utils/index.js.map +1 -1
  18. package/dist/features/circle-games/game-launcher/api/get-content-for-today/get-circle-home-api.js +6 -6
  19. package/dist/features/circle-games/game-launcher/api/get-content-for-today/get-circle-home-api.js.map +1 -1
  20. package/dist/features/circle-games/game-launcher/dal/use-get-circle-home-details-dal/use-get-circle-home-details-dal.js +21 -20
  21. package/dist/features/circle-games/game-launcher/dal/use-get-circle-home-details-dal/use-get-circle-home-details-dal.js.map +1 -1
  22. package/dist/features/circle-games/games/web-view/web-view-types.js.map +1 -1
  23. package/dist/features/circle-games/sign-up/sign-up.js +6 -6
  24. package/dist/features/circle-games/sign-up/sign-up.js.map +1 -1
  25. package/dist/features/homework/hw-card-list/hw-card-list-view.js +17 -17
  26. package/dist/features/journey/journey-id/journey-id-student.js +1 -1
  27. package/dist/features/journey/journey-id/journey-id-student.js.map +1 -1
  28. package/dist/features/journey/journey-id/journey-id-teacher.js +2 -2
  29. package/dist/features/journey/journey-id/journey-id-teacher.js.map +1 -1
  30. package/dist/features/journey/mocks/chapter-page-journey-mock-data.js +0 -400
  31. package/dist/features/journey/mocks/chapter-page-journey-mock-data.js.map +1 -1
  32. package/dist/features/milestone/constants.js +15 -28
  33. package/dist/features/milestone/constants.js.map +1 -1
  34. package/dist/features/milestone/create/comps/goal-completion-date-selector/goal-completion-date-selector.js +6 -6
  35. package/dist/features/milestone/create/comps/sheets-list/sheets-list-styled.js +2 -2
  36. package/dist/features/milestone/create/comps/test-type-step/test-type-utils.js +16 -23
  37. package/dist/features/milestone/create/comps/test-type-step/test-type-utils.js.map +1 -1
  38. package/dist/features/milestone/create/milestone-create-helpers.js +7 -13
  39. package/dist/features/milestone/create/milestone-create-helpers.js.map +1 -1
  40. package/dist/features/parent-dashboard/comps/pla-first-session-introduction/pla-first-session-introduction.js +22 -28
  41. package/dist/features/parent-dashboard/comps/pla-first-session-introduction/pla-first-session-introduction.js.map +1 -1
  42. package/dist/features/parent-dashboard/hooks/use-fetch-parent-home.js +1 -1
  43. package/dist/features/parent-dashboard/hooks/use-fetch-parent-home.js.map +1 -1
  44. package/dist/features/parent-dashboard/hooks/use-parent-home-data.js +46 -48
  45. package/dist/features/parent-dashboard/hooks/use-parent-home-data.js.map +1 -1
  46. package/dist/features/parent-dashboard/modals/student-profile-summary/student-profile-summary-styled.js +12 -0
  47. package/dist/features/parent-dashboard/modals/student-profile-summary/student-profile-summary-styled.js.map +1 -0
  48. package/dist/features/parent-dashboard/modals/student-profile-summary/student-profile-summary.js +17 -16
  49. package/dist/features/parent-dashboard/modals/student-profile-summary/student-profile-summary.js.map +1 -1
  50. package/dist/features/parent-dashboard/modals/trial-report/trial-report-styled.js +8 -4
  51. package/dist/features/parent-dashboard/modals/trial-report/trial-report-styled.js.map +1 -1
  52. package/dist/features/parent-dashboard/modals/tutor-change/tutor-change-styled.js +3 -3
  53. package/dist/features/parent-dashboard/modals/tutor-change/tutor-change-styled.js.map +1 -1
  54. package/dist/features/parent-dashboard/parent-dashboard-constants.js +4 -45
  55. package/dist/features/parent-dashboard/parent-dashboard-constants.js.map +1 -1
  56. package/dist/features/parent-dashboard/parent-dashboard-types.js +3 -3
  57. package/dist/features/parent-dashboard/parent-dashboard-types.js.map +1 -1
  58. package/dist/features/parent-dashboard/parent-dashboard-view.js +174 -197
  59. package/dist/features/parent-dashboard/parent-dashboard-view.js.map +1 -1
  60. package/dist/features/stickers/sticker-selector/hooks/use-handle-sticker-send.js +32 -0
  61. package/dist/features/stickers/sticker-selector/hooks/use-handle-sticker-send.js.map +1 -0
  62. package/dist/features/stickers/sticker-selector/hooks/use-stickers-journey/use-stickers-journey.js +72 -0
  63. package/dist/features/stickers/sticker-selector/hooks/use-stickers-journey/use-stickers-journey.js.map +1 -0
  64. package/dist/features/stickers/sticker-selector/sticker-selector.js +58 -57
  65. package/dist/features/stickers/sticker-selector/sticker-selector.js.map +1 -1
  66. package/dist/features/stickers/stickers-effects/comps/sticker-with-fallback.js +34 -0
  67. package/dist/features/stickers/stickers-effects/comps/sticker-with-fallback.js.map +1 -0
  68. package/dist/features/stickers/stickers-effects/constants.js +26 -0
  69. package/dist/features/stickers/stickers-effects/constants.js.map +1 -0
  70. package/dist/features/stickers/stickers-effects/context/sticker-provider.js +28 -0
  71. package/dist/features/stickers/stickers-effects/context/sticker-provider.js.map +1 -0
  72. package/dist/features/stickers/stickers-effects/hooks/use-stickers.js +12 -0
  73. package/dist/features/stickers/stickers-effects/hooks/use-stickers.js.map +1 -0
  74. package/dist/features/stickers/stickers-effects/stickers-effects-helper.js.map +1 -1
  75. package/dist/features/stickers/stickers-effects/stickers-effects-styled.js +32 -17
  76. package/dist/features/stickers/stickers-effects/stickers-effects-styled.js.map +1 -1
  77. package/dist/features/stickers/stickers-effects/stickers-effects-types.js +6 -0
  78. package/dist/features/stickers/stickers-effects/stickers-effects-types.js.map +1 -0
  79. package/dist/features/stickers/stickers-effects/stickers-effects.js +40 -56
  80. package/dist/features/stickers/stickers-effects/stickers-effects.js.map +1 -1
  81. package/dist/features/student-details/class-details/class-details-utils.js +6 -6
  82. package/dist/features/trial-session/comps/class-preference/class-preference.js +58 -74
  83. package/dist/features/trial-session/comps/class-preference/class-preference.js.map +1 -1
  84. package/dist/features/trial-session/comps/learning-plan/index.js +45 -47
  85. package/dist/features/trial-session/comps/learning-plan/index.js.map +1 -1
  86. package/dist/features/trial-session/comps/navigation-bar/index.js +40 -41
  87. package/dist/features/trial-session/comps/navigation-bar/index.js.map +1 -1
  88. package/dist/features/{parent-dashboard/comps → trial-session/comps/pla}/next-steps/next-steps-constants.js +1 -1
  89. package/dist/features/trial-session/comps/pla/next-steps/next-steps-constants.js.map +1 -0
  90. package/dist/features/{parent-dashboard/comps → trial-session/comps/pla}/next-steps/next-steps-styled.js +1 -1
  91. package/dist/features/trial-session/comps/pla/next-steps/next-steps-styled.js.map +1 -0
  92. package/dist/features/{parent-dashboard/comps → trial-session/comps/pla}/next-steps/next-steps.js +5 -5
  93. package/dist/features/trial-session/comps/pla/next-steps/next-steps.js.map +1 -0
  94. package/dist/features/trial-session/comps/pla/session-status/hooks/use-session-countdown.js +29 -0
  95. package/dist/features/trial-session/comps/pla/session-status/hooks/use-session-countdown.js.map +1 -0
  96. package/dist/features/trial-session/comps/pla/session-status/hooks/use-session-status-config.js +132 -0
  97. package/dist/features/trial-session/comps/pla/session-status/hooks/use-session-status-config.js.map +1 -0
  98. package/dist/features/trial-session/comps/pla/session-status/session-status-constants.js +11 -0
  99. package/dist/features/trial-session/comps/pla/session-status/session-status-constants.js.map +1 -0
  100. package/dist/features/trial-session/comps/pla/session-status/session-status-helpers.js +19 -0
  101. package/dist/features/trial-session/comps/pla/session-status/session-status-helpers.js.map +1 -0
  102. package/dist/features/{parent-dashboard/comps → trial-session/comps/pla}/session-status/session-status-styled.js +2 -2
  103. package/dist/features/trial-session/comps/pla/session-status/session-status-styled.js.map +1 -0
  104. package/dist/features/trial-session/comps/pla/session-status/session-status.js +127 -0
  105. package/dist/features/trial-session/comps/pla/session-status/session-status.js.map +1 -0
  106. package/dist/features/{parent-dashboard/comps → trial-session/comps/pla}/session-summary/session-summary-constants.js +12 -18
  107. package/dist/features/trial-session/comps/pla/session-summary/session-summary-constants.js.map +1 -0
  108. package/dist/features/trial-session/comps/pla/session-summary/session-summary.js +53 -0
  109. package/dist/features/trial-session/comps/pla/session-summary/session-summary.js.map +1 -0
  110. package/dist/features/{parent-dashboard/comps → trial-session/comps/pla}/session-summary/summary-card/summary-card-styled.js +1 -1
  111. package/dist/features/trial-session/comps/pla/session-summary/summary-card/summary-card-styled.js.map +1 -0
  112. package/dist/features/trial-session/comps/pla/session-summary/summary-card/summary-card.js +56 -0
  113. package/dist/features/trial-session/comps/pla/session-summary/summary-card/summary-card.js.map +1 -0
  114. package/dist/features/trial-session/comps/pla/upcoming-sessions/upcoming-sessions-constants.js.map +1 -0
  115. package/dist/features/{parent-dashboard/comps → trial-session/comps/pla}/upcoming-sessions/upcoming-sessions-styled.js +1 -1
  116. package/dist/features/trial-session/comps/pla/upcoming-sessions/upcoming-sessions-styled.js.map +1 -0
  117. package/dist/features/trial-session/comps/pla/upcoming-sessions/upcoming-sessions-types.js.map +1 -0
  118. package/dist/features/{parent-dashboard/comps → trial-session/comps/pla}/upcoming-sessions/upcoming-sessions.js +14 -14
  119. package/dist/features/trial-session/comps/pla/upcoming-sessions/upcoming-sessions.js.map +1 -0
  120. package/dist/features/trial-session/comps/school-goals/school-goals.js +57 -59
  121. package/dist/features/trial-session/comps/school-goals/school-goals.js.map +1 -1
  122. package/dist/features/trial-session/comps/session-report/session-report.js +15 -15
  123. package/dist/features/trial-session/comps/session-report/session-report.js.map +1 -1
  124. package/dist/features/trial-session/comps/student-enrichment/student-enrichment.js +40 -41
  125. package/dist/features/trial-session/comps/student-enrichment/student-enrichment.js.map +1 -1
  126. package/dist/features/trial-session/comps/student-feedback/student-feedback-constants.js +0 -5
  127. package/dist/features/trial-session/comps/student-feedback/student-feedback-constants.js.map +1 -1
  128. package/dist/features/trial-session/comps/student-feedback/student-feedback.js +51 -96
  129. package/dist/features/trial-session/comps/student-feedback/student-feedback.js.map +1 -1
  130. package/dist/features/trial-session/comps/student-profile/student-profile.js +63 -70
  131. package/dist/features/trial-session/comps/student-profile/student-profile.js.map +1 -1
  132. package/dist/features/trial-session/comps/teacher-intro/teacher-profile/teacher-profile.js +44 -43
  133. package/dist/features/trial-session/comps/teacher-intro/teacher-profile/teacher-profile.js.map +1 -1
  134. package/dist/features/trial-session/comps/test-prep/test-prep.js +40 -41
  135. package/dist/features/trial-session/comps/test-prep/test-prep.js.map +1 -1
  136. package/dist/features/trial-session/comps/trial-circle-game/trial-circle-game.js +61 -60
  137. package/dist/features/trial-session/comps/trial-circle-game/trial-circle-game.js.map +1 -1
  138. package/dist/features/trial-session/helper.js +61 -76
  139. package/dist/features/trial-session/helper.js.map +1 -1
  140. package/dist/features/trial-session/hooks/use-trial-session-navigation.js +144 -174
  141. package/dist/features/trial-session/hooks/use-trial-session-navigation.js.map +1 -1
  142. package/dist/features/trial-session/trial-session-types.js.map +1 -1
  143. package/dist/features/trial-session/trial-session-view.js +110 -99
  144. package/dist/features/trial-session/trial-session-view.js.map +1 -1
  145. package/dist/features/ui/accordion/accordion-items/accordion-items.js +13 -13
  146. package/dist/features/ui/accordion/accordion-items/accordion-items.js.map +1 -1
  147. package/dist/features/ui/modals/modal-styled.js +13 -45
  148. package/dist/features/ui/modals/modal-styled.js.map +1 -1
  149. package/dist/features/ui/modals/modal.js +31 -31
  150. package/dist/features/ui/modals/modal.js.map +1 -1
  151. package/dist/features/utils/utils.js +1 -1
  152. package/dist/features/utils/utils.js.map +1 -1
  153. package/dist/index.d.ts +145 -94
  154. package/dist/index.js +301 -292
  155. package/dist/index.js.map +1 -1
  156. package/dist/node_modules/date-fns/_lib/getRoundingMethod.js +10 -0
  157. package/dist/node_modules/date-fns/_lib/getRoundingMethod.js.map +1 -0
  158. package/dist/node_modules/date-fns/differenceInMilliseconds.js +9 -0
  159. package/dist/node_modules/date-fns/differenceInMilliseconds.js.map +1 -0
  160. package/dist/node_modules/date-fns/differenceInSeconds.js +11 -0
  161. package/dist/node_modules/date-fns/differenceInSeconds.js.map +1 -0
  162. package/dist/static/trophy.a8ea85ef.json +6813 -0
  163. package/package.json +3 -2
  164. package/dist/features/journey/hooks/use-chapter-page-journey/use-download-block-journey.js +0 -86
  165. package/dist/features/journey/hooks/use-chapter-page-journey/use-download-block-journey.js.map +0 -1
  166. package/dist/features/journey/hooks/use-chapter-page-journey/use-download-node-journey.js +0 -140
  167. package/dist/features/journey/hooks/use-chapter-page-journey/use-download-node-journey.js.map +0 -1
  168. package/dist/features/parent-dashboard/api/cancel-subscription.js +0 -9
  169. package/dist/features/parent-dashboard/api/cancel-subscription.js.map +0 -1
  170. package/dist/features/parent-dashboard/comps/billing-information/billing-information-styled.js +0 -20
  171. package/dist/features/parent-dashboard/comps/billing-information/billing-information-styled.js.map +0 -1
  172. package/dist/features/parent-dashboard/comps/billing-information/billing-information.js +0 -74
  173. package/dist/features/parent-dashboard/comps/billing-information/billing-information.js.map +0 -1
  174. package/dist/features/parent-dashboard/comps/next-steps/next-steps-constants.js.map +0 -1
  175. package/dist/features/parent-dashboard/comps/next-steps/next-steps-styled.js.map +0 -1
  176. package/dist/features/parent-dashboard/comps/next-steps/next-steps.js.map +0 -1
  177. package/dist/features/parent-dashboard/comps/session-status/hooks/use-countdown.js +0 -34
  178. package/dist/features/parent-dashboard/comps/session-status/hooks/use-countdown.js.map +0 -1
  179. package/dist/features/parent-dashboard/comps/session-status/hooks/use-session-status-config.js +0 -137
  180. package/dist/features/parent-dashboard/comps/session-status/hooks/use-session-status-config.js.map +0 -1
  181. package/dist/features/parent-dashboard/comps/session-status/session-status-constants.js +0 -20
  182. package/dist/features/parent-dashboard/comps/session-status/session-status-constants.js.map +0 -1
  183. package/dist/features/parent-dashboard/comps/session-status/session-status-helpers.js +0 -19
  184. package/dist/features/parent-dashboard/comps/session-status/session-status-helpers.js.map +0 -1
  185. package/dist/features/parent-dashboard/comps/session-status/session-status-styled.js.map +0 -1
  186. package/dist/features/parent-dashboard/comps/session-status/session-status.js +0 -124
  187. package/dist/features/parent-dashboard/comps/session-status/session-status.js.map +0 -1
  188. package/dist/features/parent-dashboard/comps/session-summary/session-summary-constants.js.map +0 -1
  189. package/dist/features/parent-dashboard/comps/session-summary/session-summary.js +0 -54
  190. package/dist/features/parent-dashboard/comps/session-summary/session-summary.js.map +0 -1
  191. package/dist/features/parent-dashboard/comps/session-summary/summary-card/summary-card-styled.js.map +0 -1
  192. package/dist/features/parent-dashboard/comps/session-summary/summary-card/summary-card.js +0 -72
  193. package/dist/features/parent-dashboard/comps/session-summary/summary-card/summary-card.js.map +0 -1
  194. package/dist/features/parent-dashboard/comps/upcoming-sessions/upcoming-sessions-constants.js.map +0 -1
  195. package/dist/features/parent-dashboard/comps/upcoming-sessions/upcoming-sessions-styled.js.map +0 -1
  196. package/dist/features/parent-dashboard/comps/upcoming-sessions/upcoming-sessions-types.js.map +0 -1
  197. package/dist/features/parent-dashboard/comps/upcoming-sessions/upcoming-sessions.js.map +0 -1
  198. package/dist/features/parent-dashboard/modals/cancel-subscription/cancel-subscription-constants.js +0 -21
  199. package/dist/features/parent-dashboard/modals/cancel-subscription/cancel-subscription-constants.js.map +0 -1
  200. package/dist/features/parent-dashboard/modals/cancel-subscription/cancel-subscription.js +0 -85
  201. package/dist/features/parent-dashboard/modals/cancel-subscription/cancel-subscription.js.map +0 -1
  202. package/dist/features/parent-dashboard/modals/cancellation-confirmation/cancellation-confirmation.js +0 -23
  203. package/dist/features/parent-dashboard/modals/cancellation-confirmation/cancellation-confirmation.js.map +0 -1
  204. package/dist/features/parent-dashboard/modals/cancellation-reason/cancellation-reason-constant.js +0 -55
  205. package/dist/features/parent-dashboard/modals/cancellation-reason/cancellation-reason-constant.js.map +0 -1
  206. package/dist/features/parent-dashboard/modals/cancellation-reason/cancellation-reason-styled.js +0 -71
  207. package/dist/features/parent-dashboard/modals/cancellation-reason/cancellation-reason-styled.js.map +0 -1
  208. package/dist/features/parent-dashboard/modals/cancellation-reason/cancellation-reason.js +0 -119
  209. package/dist/features/parent-dashboard/modals/cancellation-reason/cancellation-reason.js.map +0 -1
  210. package/dist/features/parent-dashboard/modals/hooks/use-pla-model-handlers.js +0 -58
  211. package/dist/features/parent-dashboard/modals/hooks/use-pla-model-handlers.js.map +0 -1
  212. package/dist/features/parent-dashboard/modals/view-payment-method/view-payment-method.js +0 -76
  213. package/dist/features/parent-dashboard/modals/view-payment-method/view-payment-method.js.map +0 -1
  214. package/dist/features/trial-session/api/teacher-availability.js +0 -9
  215. package/dist/features/trial-session/api/teacher-availability.js.map +0 -1
  216. package/dist/features/trial-session/comps/class-preference/helpers.js +0 -28
  217. package/dist/features/trial-session/comps/class-preference/helpers.js.map +0 -1
  218. package/dist/features/trial-session/hooks/use-slide-config-update.js +0 -49
  219. package/dist/features/trial-session/hooks/use-slide-config-update.js.map +0 -1
  220. package/dist/static/learning-session-grid-bg-mobile.8d2b7258.gif +0 -0
  221. package/dist/static/way-forward-grid-bg-mobile.374043d7.gif +0 -0
  222. package/dist/static/your-goals-grid-bg-mobile.62557024.gif +0 -0
  223. /package/dist/features/{parent-dashboard/comps → trial-session/comps/pla}/upcoming-sessions/upcoming-sessions-constants.js +0 -0
  224. /package/dist/features/{parent-dashboard/comps → trial-session/comps/pla}/upcoming-sessions/upcoming-sessions-types.js +0 -0
@@ -1,67 +1,51 @@
1
- import { jsx as n, Fragment as x } from "react/jsx-runtime";
2
- import { memo as p, useState as l, useEffect as d } from "react";
3
- import E from "../../ui/dot-lottie-animations/dot-lottie-animation.js";
4
- import { preloadLottieFile as F } from "./stickers-effects-cache.js";
5
- import { generateStickerData as y } from "./stickers-effects-helper.js";
6
- import { Container as z, Sticker as L } from "./stickers-effects-styled.js";
7
- const T = p(({ url: t, sticker: i, size: o }) => {
8
- const [r, f] = l(), [c, e] = l(!1), s = {
9
- loop: !0,
10
- autoplay: !0
11
- };
12
- return d(() => {
13
- let a = !0;
14
- if (t)
15
- return F(t).then((m) => {
16
- a && (m ? f(m) : e(!0));
17
- }).catch(() => {
18
- a && e(!0);
19
- }), () => {
20
- a = !1;
21
- };
22
- }, [t]), !t || c || !r ? /* @__PURE__ */ n(x, { children: i }) : /* @__PURE__ */ n(
23
- E,
24
- {
25
- data: r,
26
- width: o,
27
- height: o,
28
- settings: s,
29
- onError: () => e(!0)
30
- }
31
- );
32
- }), $ = ({ stickerId: t, effect: i, count: o, duration: r }) => {
33
- const [f, c] = l([]);
34
- return d(() => {
35
- const e = y({
36
- count: o,
37
- effect: i,
38
- stickerId: t,
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { memo as E, useState as T, useEffect as s } from "react";
3
+ import g from "./comps/sticker-with-fallback.js";
4
+ import { EFFECTS_MAP as x } from "./constants.js";
5
+ import { generateStickerData as D } from "./stickers-effects-helper.js";
6
+ import { StickersWrapper as y, Container as z, Sticker as F } from "./stickers-effects-styled.js";
7
+ const j = ({
8
+ stickerId: c,
9
+ effectType: u,
10
+ duration: n = 3500,
11
+ onClose: i
12
+ }) => {
13
+ const [f, m] = T([]), t = x[u];
14
+ return s(() => {
15
+ if (!i) return;
16
+ const e = setTimeout(i, n);
17
+ return () => clearTimeout(e);
18
+ }, [i, n]), s(() => {
19
+ const e = D({
20
+ count: t.count,
21
+ effect: t.effect,
22
+ stickerId: c,
39
23
  minSize: 48,
40
24
  maxSize: 72
41
25
  });
42
- c(e);
43
- const s = setTimeout(() => c([]), r);
44
- return () => clearTimeout(s);
45
- }, [i, o, r, t]), /* @__PURE__ */ n(z, { children: f.map((e, s) => {
46
- const { id: a, sticker: m, lottie: h, x: k, y: S, size: u, fromX: D, fromY: g } = e;
47
- return /* @__PURE__ */ n(
48
- L,
26
+ m(e);
27
+ const o = setTimeout(() => m([]), t.duration);
28
+ return () => clearTimeout(o);
29
+ }, [t, c]), f.length === 0 ? null : /* @__PURE__ */ r(y, { $alignItems: "top", $justifyContent: "center", $inherit: !0, children: /* @__PURE__ */ r(z, { children: f.map((e, o) => {
30
+ const { id: l, sticker: p, lottie: S, x: k, y: d, size: a, fromX: h, fromY: $ } = e;
31
+ return /* @__PURE__ */ r(
32
+ F,
49
33
  {
50
- effect: i,
51
- duration: r,
34
+ effect: t.effect,
35
+ duration: t.duration,
52
36
  delay: 500,
53
- fromX: D,
54
- fromY: g,
37
+ fromX: h,
38
+ fromY: $,
55
39
  x: k,
56
- y: S,
57
- size: u,
58
- children: /* @__PURE__ */ n(T, { url: h, sticker: m, size: u })
40
+ y: d,
41
+ size: a,
42
+ children: /* @__PURE__ */ r(g, { url: S, sticker: p, size: a })
59
43
  },
60
- `${a}-${s}`
44
+ `${l}-${o}`
61
45
  );
62
- }) });
63
- }, W = p($);
46
+ }) }) });
47
+ }, X = E(j);
64
48
  export {
65
- W as default
49
+ X as default
66
50
  };
67
51
  //# sourceMappingURL=stickers-effects.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stickers-effects.js","sources":["../../../../src/features/stickers/stickers-effects/stickers-effects.tsx"],"sourcesContent":["import type { TStickerData, IStickersProps } from './stickers-effects-types';\nimport type { Data } from '@lottiefiles/dotlottie-web';\nimport type { FC } from 'react';\n\nimport React, { memo, useEffect, useState } from 'react';\n\nimport DotLottieAnimation from '../../ui/dot-lottie-animations/dot-lottie-animation';\nimport { preloadLottieFile } from './stickers-effects-cache';\nimport { generateStickerData } from './stickers-effects-helper';\nimport * as Styled from './stickers-effects-styled';\n\nconst StickerWithFallback: FC<{\n url?: string;\n sticker: string;\n size: number;\n}> = memo(({ url, sticker, size }) => {\n const [data, setData] = useState<Data>();\n const [failed, setFailed] = useState(false);\n const renderSettings = {\n loop: true,\n autoplay: true,\n };\n\n useEffect(() => {\n let isMounted = true;\n\n if (!url) return;\n\n preloadLottieFile(url)\n .then(result => {\n if (isMounted) {\n if (result) {\n setData(result);\n } else {\n setFailed(true);\n }\n }\n })\n .catch(() => {\n if (isMounted) setFailed(true);\n });\n\n return () => {\n isMounted = false;\n };\n }, [url]);\n\n if (!url || failed || !data) {\n return <>{sticker}</>;\n }\n\n return (\n <DotLottieAnimation\n data={data}\n width={size}\n height={size}\n settings={renderSettings}\n onError={() => setFailed(true)}\n />\n );\n});\n\nconst StickersEffects: React.FC<IStickersProps> = ({ stickerId, effect, count, duration }) => {\n const [stickersData, setStickersData] = useState<ReturnType<typeof generateStickerData>>([]);\n\n useEffect(() => {\n const stickerData = generateStickerData({\n count,\n effect,\n stickerId,\n minSize: 48,\n maxSize: 72,\n });\n\n setStickersData(stickerData);\n\n const timeout = setTimeout(() => setStickersData([]), duration);\n\n return () => clearTimeout(timeout);\n }, [effect, count, duration, stickerId]);\n\n return (\n <Styled.Container>\n {stickersData.map((data: TStickerData, i) => {\n const { id, sticker, lottie, x, y, size, fromX, fromY } = data;\n\n return (\n <Styled.Sticker\n key={`${id}-${i}`}\n effect={effect}\n duration={duration}\n delay={500}\n fromX={fromX}\n fromY={fromY}\n x={x}\n y={y}\n size={size}\n >\n <StickerWithFallback url={lottie} sticker={sticker} size={size} />\n </Styled.Sticker>\n );\n })}\n </Styled.Container>\n );\n};\n\nexport default memo(StickersEffects);\n"],"names":["StickerWithFallback","memo","url","sticker","size","data","setData","useState","failed","setFailed","renderSettings","useEffect","isMounted","preloadLottieFile","result","jsx","DotLottieAnimation","StickersEffects","stickerId","effect","count","duration","stickersData","setStickersData","stickerData","generateStickerData","timeout","Styled.Container","i","id","lottie","x","y","fromX","fromY","Styled.Sticker","stickersEffects"],"mappings":";;;;;;AAWA,MAAMA,IAIDC,EAAK,CAAC,EAAE,KAAAC,GAAK,SAAAC,GAAS,MAAAC,QAAW;AACpC,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAe,GACjC,CAACC,GAAQC,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AAA1B,GAAS,QAAA2B,GAAQ,GAAAC,GAAG,GAAAC,GAAG,MAAA5B,GAAM,OAAA6B,GAAO,OAAAC,EAAU,IAAA7B;AAGxD,WAAA,gBAAAU;AAAA,MAACoB;AAAAA,MAAA;AAAA,QAEC,QAAAhB;AAAA,QACA,UAAAE;AAAA,QACA,OAAO;AAAA,QACP,OAAAY;AAAA,QACA,OAAAC;AAAA,QACA,GAAAH;AAAA,QACA,GAAAC;AAAA,QACA,MAAA5B;AAAA,QAEA,UAAC,gBAAAW,EAAAf,GAAA,EAAoB,KAAK8B,GAAQ,SAAA3B,GAAkB,MAAAC,GAAY;AAAA,MAAA;AAAA,MAV3D,GAAGyB,CAAE,IAAID,CAAC;AAAA,IAAA;AAAA,EAapB,CAAA,EACH,CAAA;AAEJ,GAEeQ,IAAAnC,EAAKgB,CAAe;"}
1
+ {"version":3,"file":"stickers-effects.js","sources":["../../../../src/features/stickers/stickers-effects/stickers-effects.tsx"],"sourcesContent":["import type { StickersEffectProps, TStickerAnimationData } from './stickers-effects-types';\n\nimport React, { memo, useEffect, useState } from 'react';\n\nimport StickerWithFallback from './comps/sticker-with-fallback';\nimport { EFFECTS_MAP } from './constants';\nimport { generateStickerData } from './stickers-effects-helper';\nimport * as Styled from './stickers-effects-styled';\n\nconst StickersEffect: React.FC<StickersEffectProps> = ({\n stickerId,\n effectType,\n duration = 3500,\n onClose,\n}) => {\n const [stickersData, setStickersData] = useState<ReturnType<typeof generateStickerData>>([]);\n\n const effectConfig = EFFECTS_MAP[effectType];\n\n useEffect(() => {\n if (!onClose) return;\n\n const timeout = setTimeout(onClose, duration);\n\n return () => clearTimeout(timeout);\n }, [onClose, duration]);\n\n useEffect(() => {\n const stickerData = generateStickerData({\n count: effectConfig.count,\n effect: effectConfig.effect,\n stickerId,\n minSize: 48,\n maxSize: 72,\n });\n\n setStickersData(stickerData);\n\n const timeout = setTimeout(() => setStickersData([]), effectConfig.duration);\n\n return () => clearTimeout(timeout);\n }, [effectConfig, stickerId]);\n\n if (stickersData.length === 0) return null;\n\n return (\n <Styled.StickersWrapper $alignItems=\"top\" $justifyContent=\"center\" $inherit>\n <Styled.Container>\n {stickersData.map((data: TStickerAnimationData, i) => {\n const { id, sticker, lottie, x, y, size, fromX, fromY } = data;\n\n return (\n <Styled.Sticker\n key={`${id}-${i}`}\n effect={effectConfig.effect}\n duration={effectConfig.duration}\n delay={500}\n fromX={fromX}\n fromY={fromY}\n x={x}\n y={y}\n size={size}\n >\n <StickerWithFallback url={lottie} sticker={sticker} size={size} />\n </Styled.Sticker>\n );\n })}\n </Styled.Container>\n </Styled.StickersWrapper>\n );\n};\n\nexport default memo(StickersEffect);\n"],"names":["StickersEffect","stickerId","effectType","duration","onClose","stickersData","setStickersData","useState","effectConfig","EFFECTS_MAP","useEffect","timeout","stickerData","generateStickerData","Styled.StickersWrapper","jsx","Styled.Container","data","i","id","sticker","lottie","x","y","size","fromX","fromY","Styled.Sticker","StickerWithFallback","StickersEffect$1","memo"],"mappings":";;;;;;AASA,MAAMA,IAAgD,CAAC;AAAA,EACrD,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,SAAAC;AACF,MAAM;AACJ,QAAM,CAACC,GAAcC,CAAe,IAAIC,EAAiD,CAAE,CAAA,GAErFC,IAAeC,EAAYP,CAAU;AA0BvC,SAxBJQ,EAAU,MAAM;AACd,QAAI,CAACN,EAAS;AAER,UAAAO,IAAU,WAAWP,GAASD,CAAQ;AAErC,WAAA,MAAM,aAAaQ,CAAO;AAAA,EAAA,GAChC,CAACP,GAASD,CAAQ,CAAC,GAEtBO,EAAU,MAAM;AACd,UAAME,IAAcC,EAAoB;AAAA,MACtC,OAAOL,EAAa;AAAA,MACpB,QAAQA,EAAa;AAAA,MACrB,WAAAP;AAAA,MACA,SAAS;AAAA,MACT,SAAS;AAAA,IAAA,CACV;AAED,IAAAK,EAAgBM,CAAW;AAErB,UAAAD,IAAU,WAAW,MAAML,EAAgB,CAAA,CAAE,GAAGE,EAAa,QAAQ;AAEpE,WAAA,MAAM,aAAaG,CAAO;AAAA,EAAA,GAChC,CAACH,GAAcP,CAAS,CAAC,GAExBI,EAAa,WAAW,IAAU,yBAGnCS,GAAA,EAAuB,aAAY,OAAM,iBAAgB,UAAS,UAAQ,IACzE,UAAA,gBAAAC,EAACC,GAAA,EACE,YAAa,IAAI,CAACC,GAA6BC,MAAM;AAC9C,UAAA,EAAE,IAAAC,GAAI,SAAAC,GAAS,QAAAC,GAAQ,GAAAC,GAAG,GAAAC,GAAG,MAAAC,GAAM,OAAAC,GAAO,OAAAC,EAAU,IAAAT;AAGxD,WAAA,gBAAAF;AAAA,MAACY;AAAAA,MAAA;AAAA,QAEC,QAAQnB,EAAa;AAAA,QACrB,UAAUA,EAAa;AAAA,QACvB,OAAO;AAAA,QACP,OAAAiB;AAAA,QACA,OAAAC;AAAA,QACA,GAAAJ;AAAA,QACA,GAAAC;AAAA,QACA,MAAAC;AAAA,QAEA,UAAC,gBAAAT,EAAAa,GAAA,EAAoB,KAAKP,GAAQ,SAAAD,GAAkB,MAAAI,GAAY;AAAA,MAAA;AAAA,MAV3D,GAAGL,CAAE,IAAID,CAAC;AAAA,IAAA;AAAA,EAWjB,CAEH,GACH,EACF,CAAA;AAEJ,GAEeW,IAAAC,EAAK9B,CAAc;"}
@@ -1,12 +1,12 @@
1
1
  import { startOfDay as s } from "../../../node_modules/date-fns/startOfDay.js";
2
- import { isToday as n } from "../../../node_modules/date-fns/isToday.js";
3
- import { isAfter as i } from "../../../node_modules/date-fns/isAfter.js";
4
- import { isBefore as f } from "../../../node_modules/date-fns/isBefore.js";
5
- import { addDays as d } from "../../../node_modules/date-fns/addDays.js";
2
+ import { isAfter as n } from "../../../node_modules/date-fns/isAfter.js";
3
+ import { isBefore as i } from "../../../node_modules/date-fns/isBefore.js";
4
+ import { addDays as f } from "../../../node_modules/date-fns/addDays.js";
5
+ import { isToday as d } from "../../../node_modules/date-fns/isToday.js";
6
6
  import { formatDate as m } from "../../../node_modules/date-fns/format.js";
7
7
  const u = (e) => {
8
- const o = /* @__PURE__ */ new Date(), t = new Date(e), r = d(s(o), 7);
9
- return n(t) ? `Today, ${m(t, "hh:mm a")}` : i(t, o) && f(t, r) ? m(t, "eee, hh:mm a") : m(t, "MMM dd, hh:mm a");
8
+ const o = /* @__PURE__ */ new Date(), t = new Date(e), r = f(s(o), 7);
9
+ return d(t) ? `Today, ${m(t, "hh:mm a")}` : n(t, o) && i(t, r) ? m(t, "eee, hh:mm a") : m(t, "MMM dd, hh:mm a");
10
10
  }, M = (e, o, t) => {
11
11
  const r = m(e * 1e3, "hh:mm a"), a = m((e + o + t) * 1e3, "hh:mm a");
12
12
  return `${r} - ${a}`;
@@ -1,65 +1,49 @@
1
- import { jsxs as m, jsx as c } from "react/jsx-runtime";
2
- import { memo as j, useMemo as W, useCallback as z, useEffect as _ } from "react";
3
- import { DAYS as h } from "../../../../constants/date-time.js";
4
- import { getTimeUnits as M, getOffsetBetweenTimezone as Y, convertEpochToDateTime as b, convertToMilliseconds as K } from "../../../../helpers/date-time.js";
5
- import A from "../../../ui/inputs/select-input/select-input.js";
6
- import T from "../../../ui/layout/flex-view.js";
7
- import R from "../../../ui/separator/separator.js";
8
- import q from "../../../ui/text/text.js";
9
- import { useTrialSessionContext as G } from "../../context/use-trial-session-context.js";
10
- import { isPLASource as N } from "../../helper.js";
11
- import { TEACHER_TIMEZONE as L } from "../../trial-session-constants.js";
12
- import U from "../slide-header/index.js";
13
- import { timeSlots as Z } from "./class-preference-constants.js";
14
- import { Container as J, PreferenceWrapper as Q, FixedLineSeparator as V } from "./class-preference-styled.js";
15
- import { extractDayAndTimeFromEpoch as ee } from "./helpers.js";
16
- const y = [
1
+ import { jsxs as d, jsx as a } from "react/jsx-runtime";
2
+ import { memo as A, useCallback as O, useEffect as w } from "react";
3
+ import { DAYS as f } from "../../../../constants/date-time.js";
4
+ import { getTimeUnits as j, getOffsetBetweenTimezone as v, convertEpochToDateTime as g, convertToMilliseconds as H } from "../../../../helpers/date-time.js";
5
+ import $ from "../../../ui/inputs/select-input/select-input.js";
6
+ import u from "../../../ui/layout/flex-view.js";
7
+ import P from "../../../ui/separator/separator.js";
8
+ import W from "../../../ui/text/text.js";
9
+ import { useTrialSessionContext as z } from "../../context/use-trial-session-context.js";
10
+ import { TEACHER_TIMEZONE as y } from "../../trial-session-constants.js";
11
+ import B from "../slide-header/index.js";
12
+ import { timeSlots as Y } from "./class-preference-constants.js";
13
+ import { Container as F, PreferenceWrapper as K, FixedLineSeparator as M } from "./class-preference-styled.js";
14
+ const C = [
17
15
  { id: 1, selectedDay: "", selectedTime: "" },
18
16
  { id: 2, selectedDay: "", selectedTime: "" }
19
- ], ge = j(({ miniScreenDevice: S }) => {
20
- const { isTeacher: o, formData: E, trialHomeData: I, updateSlideConfig: f, updateButtonState: g } = G(), { preferences: r, studentTimezone: s } = E || {}, { demo_info: P, intel_student: u } = I || {}, { scheduled_start_time: D } = P || {}, X = h.map((e) => ({ id: e, label: e })), $ = o ? L : s, l = W(
21
- () => o && s ? ee(D, s) : void 0,
22
- [o, D, s]
23
- ), C = !!(!N(u == null ? void 0 : u.source) || r && r.length > 0 && r.every((e) => e.selectedDay && e.selectedTime)), x = (e, t, i) => {
24
- f({
25
- preferences: (r ?? y).map(
26
- (n) => n.id === e ? { ...n, [t]: i } : n
17
+ ], se = A(({ miniScreenDevice: D }) => {
18
+ const { isTeacher: n, formData: x, updateSlideConfig: p } = z(), { preferences: o, studentTimezone: c } = x || {}, b = f.map((e) => ({ id: e, label: e })), h = n ? y : c, T = (e, t, s) => {
19
+ p({
20
+ preferences: (o ?? C).map(
21
+ (r) => r.id === e ? { ...r, [t]: s } : r
27
22
  )
28
23
  });
29
- }, k = (e, t) => {
30
- x(e, "selectedDay", t);
31
- }, w = (e, t) => {
32
- x(e, "selectedTime", t);
33
- }, O = z(
24
+ }, _ = (e, t) => {
25
+ T(e, "selectedDay", t);
26
+ }, S = (e, t) => {
27
+ T(e, "selectedTime", t);
28
+ }, E = O(
34
29
  (e, t) => {
35
- if (e && t && s) {
36
- const { hours: i, minutes: n } = M(t), d = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0), p = Y(L, s), a = o ? d + p : d, { day: v = "" } = b(a, s), B = h.indexOf(v), F = (h.indexOf(e) - B + 7) % 7, H = a + K({ days: F, hours: i, minutes: n });
37
- return b(H, $);
30
+ if (e && t && c) {
31
+ const { hours: s, minutes: r } = j(t), m = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0), l = v(y, c), i = n ? m + l : m, { day: L = "" } = g(i, c), I = f.indexOf(L), X = (f.indexOf(e) - I + 7) % 7, k = i + H({ days: X, hours: s, minutes: r });
32
+ return g(k, h);
38
33
  }
39
34
  return {};
40
35
  },
41
- [o, s, $]
36
+ [n, c, h]
42
37
  );
43
- return _(() => {
44
- if (o && (!r || !Array.isArray(r) || r.length === 0)) {
45
- let e = y;
46
- l && (e = y.map(
47
- (t) => t.id === 1 ? {
48
- ...t,
49
- selectedDay: l.day,
50
- selectedTime: l.time
51
- } : t
52
- )), f({ preferences: e });
53
- }
54
- }, [o, r, l, f]), _(() => {
55
- g("right", { isDisabled: !C, isLoading: !1 });
56
- }, [C, g]), /* @__PURE__ */ m(J, { children: [
57
- /* @__PURE__ */ c(R, { height: 60 }),
58
- /* @__PURE__ */ c(U, {}),
59
- /* @__PURE__ */ m(
60
- Q,
38
+ return w(() => {
39
+ n && !o && p({ preferences: C });
40
+ }, [n, o, p]), /* @__PURE__ */ d(F, { children: [
41
+ /* @__PURE__ */ a(P, { height: 60 }),
42
+ /* @__PURE__ */ a(B, {}),
43
+ /* @__PURE__ */ d(
44
+ K,
61
45
  {
62
- $gapX: S ? 2.2 : 3.75,
46
+ $gapX: D ? 2.2 : 3.75,
63
47
  $gutterX: 4.6875,
64
48
  $background: "YELLOW_4",
65
49
  $borderColor: "BLACK_1",
@@ -67,51 +51,51 @@ const y = [
67
51
  $justifyContent: "space-between",
68
52
  $alignItems: "center",
69
53
  children: [
70
- /* @__PURE__ */ c(V, {}),
71
- r == null ? void 0 : r.map((e) => {
72
- const { id: t, selectedDay: i, selectedTime: n } = e, { day: d, time: p } = O(i, n);
73
- return /* @__PURE__ */ m(T, { $widthX: 15, $background: "YELLOW_1", $borderColor: "BLACK_1", children: [
74
- /* @__PURE__ */ m(T, { $gapX: 1.65, $gutterX: 2, $flexGapX: 0.25, children: [
75
- /* @__PURE__ */ c(
76
- A,
54
+ /* @__PURE__ */ a(M, {}),
55
+ o == null ? void 0 : o.map((e) => {
56
+ const { id: t, selectedDay: s, selectedTime: r } = e, { day: m, time: l } = E(s, r);
57
+ return /* @__PURE__ */ d(u, { $widthX: 15, $background: "YELLOW_1", $borderColor: "BLACK_1", children: [
58
+ /* @__PURE__ */ d(u, { $gapX: 1.65, $gutterX: 2, $flexGapX: 0.25, children: [
59
+ /* @__PURE__ */ a(
60
+ $,
77
61
  {
78
62
  renderAs: "primary",
79
63
  label: `Day ${t}`,
80
- value: i,
81
- options: X,
64
+ value: s,
65
+ options: b,
82
66
  theme: "dark",
83
67
  shape: "borderLess",
84
68
  isTransparent: !0,
85
- onChange: (a) => k(t, a)
69
+ onChange: (i) => _(t, i)
86
70
  }
87
71
  ),
88
- /* @__PURE__ */ c(
89
- A,
72
+ /* @__PURE__ */ a(
73
+ $,
90
74
  {
91
75
  renderAs: "primary",
92
76
  label: "Time",
93
- value: n,
94
- options: Z,
77
+ value: r,
78
+ options: Y,
95
79
  shape: "borderLess",
96
80
  isTransparent: !0,
97
81
  theme: "dark",
98
- onChange: (a) => w(t, a)
82
+ onChange: (i) => S(t, i)
99
83
  }
100
84
  )
101
85
  ] }),
102
- /* @__PURE__ */ c(
103
- T,
86
+ /* @__PURE__ */ a(
87
+ u,
104
88
  {
105
89
  $heightX: 3.125,
106
90
  $gutterX: 2,
107
91
  $justifyContent: "center",
108
92
  $background: "WHITE_T_60",
109
- children: o ? /* @__PURE__ */ m(q, { $renderAs: "ac4-black", $align: "center", children: [
110
- d ? d.slice(0, 3) : "__",
93
+ children: n ? /* @__PURE__ */ d(W, { $renderAs: "ac4-black", $align: "center", children: [
94
+ m ? m.slice(0, 3) : "__",
111
95
  ", ",
112
- p || "__",
96
+ l || "__",
113
97
  " ",
114
- o ? "(IST)" : ""
98
+ n ? "(IST)" : ""
115
99
  ] }) : null
116
100
  }
117
101
  )
@@ -123,6 +107,6 @@ const y = [
123
107
  ] });
124
108
  });
125
109
  export {
126
- ge as default
110
+ se as default
127
111
  };
128
112
  //# sourceMappingURL=class-preference.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"class-preference.js","sources":["../../../../../src/features/trial-session/comps/class-preference/class-preference.tsx"],"sourcesContent":["import type { IClassPreference, TPreference } from './class-preference-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback, useEffect, useMemo } from 'react';\n\nimport { DAYS } from '../../../../constants/date-time';\nimport {\n convertEpochToDateTime,\n convertToMilliseconds,\n getOffsetBetweenTimezone,\n getTimeUnits,\n} from '../../../../helpers/date-time';\nimport SelectInput from '../../../ui/inputs/select-input/select-input';\nimport FlexView from '../../../ui/layout/flex-view';\nimport Separator from '../../../ui/separator/separator';\nimport Text from '../../../ui/text/text';\nimport { useTrialSessionContext } from '../../context/use-trial-session-context';\nimport { isPLASource } from '../../helper';\nimport { TEACHER_TIMEZONE as teacherTimezone } from '../../trial-session-constants';\nimport SlideHeader from '../slide-header';\nimport { timeSlots } from './class-preference-constants';\nimport * as Styled from './class-preference-styled';\nimport { extractDayAndTimeFromEpoch } from './helpers';\n\nconst defaultPreferences = [\n { id: 1, selectedDay: '', selectedTime: '' },\n { id: 2, selectedDay: '', selectedTime: '' },\n];\n\nconst ClassPreference: FC<IClassPreference> = memo(({ miniScreenDevice }) => {\n const { isTeacher, formData, trialHomeData, updateSlideConfig, updateButtonState } =\n useTrialSessionContext();\n const { preferences, studentTimezone } = formData || {};\n const { demo_info: demoInfo, intel_student: intelStudent } = trialHomeData || {};\n const { scheduled_start_time: scheduledStartTime } = demoInfo || {};\n\n const daySlots = DAYS.map(day => ({ id: day, label: day }));\n const timezone = isTeacher ? teacherTimezone : studentTimezone;\n\n const preSelectedDateTimeFromEpoch = useMemo(\n () =>\n isTeacher && studentTimezone\n ? extractDayAndTimeFromEpoch(scheduledStartTime, studentTimezone)\n : undefined,\n [isTeacher, scheduledStartTime, studentTimezone],\n );\n\n const isPLA = isPLASource(intelStudent?.source);\n const hasRequiredFields = Boolean(\n isPLA\n ? preferences &&\n preferences.length > 0 &&\n preferences.every(preference => preference.selectedDay && preference.selectedTime)\n : true,\n );\n\n const handlePreferenceChange = (\n id: number,\n field: 'selectedDay' | 'selectedTime',\n value: string,\n ) => {\n updateSlideConfig({\n preferences: (preferences ?? defaultPreferences).map((preference: TPreference) =>\n preference.id === id ? { ...preference, [field]: value } : preference,\n ),\n });\n };\n\n const handleDayChange = (id: number, value: string) => {\n handlePreferenceChange(id, 'selectedDay', value);\n };\n\n const handleTimeChange = (id: number, value: string) => {\n handlePreferenceChange(id, 'selectedTime', value);\n };\n\n const getDisplayDateTimeValue = useCallback(\n (dayValue: string, timeValue: string) => {\n if (dayValue && timeValue && studentTimezone) {\n // Extracting hours, minutes, and period from the selected time.\n const { hours, minutes } = getTimeUnits(timeValue);\n const todayTimestamp = new Date().setHours(0, 0, 0, 0); // Setting current date to midnight\n\n // Calculating offset between the teacher's and student's timezone.\n const timestampOffset = getOffsetBetweenTimezone(teacherTimezone, studentTimezone);\n const studentTimestamp = isTeacher ? todayTimestamp + timestampOffset : todayTimestamp; // Current timestamp at student's timezone\n const { day: today = '' } = convertEpochToDateTime(studentTimestamp, studentTimezone); // Current day at student's timezone.\n\n // Calculating current and selected day index to get day difference.\n const currentDayIndex = DAYS.indexOf(today);\n const selectedDayIndex = DAYS.indexOf(dayValue);\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 studentTimestamp + convertToMilliseconds({ days: dayDifference, hours, minutes });\n\n // Returning date, time value with respect to both teacher and student timezone.\n return convertEpochToDateTime(epochTimestamp, timezone);\n }\n\n return {};\n },\n [isTeacher, studentTimezone, timezone],\n );\n\n useEffect(() => {\n // Only set preferences if teacher and preferences are not set\n if (isTeacher && (!preferences || !Array.isArray(preferences) || preferences.length === 0)) {\n let newPreferences = defaultPreferences;\n\n if (preSelectedDateTimeFromEpoch) {\n newPreferences = defaultPreferences.map((preference: TPreference) =>\n preference.id === 1\n ? {\n ...preference,\n selectedDay: preSelectedDateTimeFromEpoch.day,\n selectedTime: preSelectedDateTimeFromEpoch.time,\n }\n : preference,\n );\n }\n updateSlideConfig({ preferences: newPreferences });\n }\n }, [isTeacher, preferences, preSelectedDateTimeFromEpoch, updateSlideConfig]);\n\n useEffect(() => {\n updateButtonState('right', { isDisabled: !hasRequiredFields, isLoading: false });\n }, [hasRequiredFields, updateButtonState]);\n\n return (\n <Styled.Container>\n <Separator height={60} />\n <SlideHeader />\n <Styled.PreferenceWrapper\n $gapX={miniScreenDevice ? 2.2 : 3.75}\n $gutterX={4.6875}\n $background=\"YELLOW_4\"\n $borderColor=\"BLACK_1\"\n $flexDirection=\"row\"\n $justifyContent=\"space-between\"\n $alignItems=\"center\"\n >\n <Styled.FixedLineSeparator />\n {preferences?.map(preference => {\n const { id, selectedDay, selectedTime } = preference;\n const { day, time } = getDisplayDateTimeValue(selectedDay, selectedTime);\n\n return (\n <FlexView key={`slot-${id}`} $widthX={15} $background=\"YELLOW_1\" $borderColor=\"BLACK_1\">\n <FlexView $gapX={1.65} $gutterX={2} $flexGapX={0.25}>\n <SelectInput\n renderAs=\"primary\"\n label={`Day ${id}`}\n value={selectedDay}\n options={daySlots}\n theme=\"dark\"\n shape=\"borderLess\"\n isTransparent\n onChange={value => handleDayChange(id, value)}\n />\n <SelectInput\n renderAs=\"primary\"\n label=\"Time\"\n value={selectedTime}\n options={timeSlots}\n shape=\"borderLess\"\n isTransparent\n theme=\"dark\"\n onChange={value => handleTimeChange(id, value)}\n />\n </FlexView>\n <FlexView\n $heightX={3.125}\n $gutterX={2}\n $justifyContent=\"center\"\n $background=\"WHITE_T_60\"\n >\n {isTeacher ? (\n <Text $renderAs=\"ac4-black\" $align=\"center\">\n {day ? day.slice(0, 3) : '__'}, {time ? time : '__'} {isTeacher ? '(IST)' : ''}\n </Text>\n ) : null}\n </FlexView>\n </FlexView>\n );\n })}\n </Styled.PreferenceWrapper>\n </Styled.Container>\n );\n});\n\nexport default ClassPreference;\n"],"names":["defaultPreferences","ClassPreference","memo","miniScreenDevice","isTeacher","formData","trialHomeData","updateSlideConfig","updateButtonState","useTrialSessionContext","preferences","studentTimezone","demoInfo","intelStudent","scheduledStartTime","daySlots","DAYS","day","timezone","teacherTimezone","preSelectedDateTimeFromEpoch","useMemo","extractDayAndTimeFromEpoch","hasRequiredFields","isPLASource","preference","handlePreferenceChange","id","field","value","handleDayChange","handleTimeChange","getDisplayDateTimeValue","useCallback","dayValue","timeValue","hours","minutes","getTimeUnits","todayTimestamp","timestampOffset","getOffsetBetweenTimezone","studentTimestamp","today","convertEpochToDateTime","currentDayIndex","dayDifference","epochTimestamp","convertToMilliseconds","useEffect","newPreferences","jsxs","Styled.Container","jsx","Separator","SlideHeader","Styled.PreferenceWrapper","Styled.FixedLineSeparator","selectedDay","selectedTime","time","FlexView","SelectInput","timeSlots","Text"],"mappings":";;;;;;;;;;;;;;;AAwBA,MAAMA,IAAqB;AAAA,EACzB,EAAE,IAAI,GAAG,aAAa,IAAI,cAAc,GAAG;AAAA,EAC3C,EAAE,IAAI,GAAG,aAAa,IAAI,cAAc,GAAG;AAC7C,GAEMC,KAAwCC,EAAK,CAAC,EAAE,kBAAAC,QAAuB;AAC3E,QAAM,EAAE,WAAAC,GAAW,UAAAC,GAAU,eAAAC,GAAe,mBAAAC,GAAmB,mBAAAC,EAAA,IAC7DC,KACI,EAAE,aAAAC,GAAa,iBAAAC,MAAoBN,KAAY,CAAA,GAC/C,EAAE,WAAWO,GAAU,eAAe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AA,CAC9E,IACE;AAAA,gBAAA;AAAA,cACN;AAAA,YAlCa,EAAA,GAAA,QAAQuB,CAAE,EAmCzB;AAAA,UAAA;AAAA,QAEH;AAAA,MAAA;AAAA,IACH;AAAA,EACF,EAAA,CAAA;AAEJ,CAAC;"}
1
+ {"version":3,"file":"class-preference.js","sources":["../../../../../src/features/trial-session/comps/class-preference/class-preference.tsx"],"sourcesContent":["import type { IClassPreference, TPreference } from './class-preference-types';\nimport type { FC } from 'react';\n\nimport { memo, useCallback, useEffect } from 'react';\n\nimport { DAYS } from '../../../../constants/date-time';\nimport {\n convertEpochToDateTime,\n convertToMilliseconds,\n getOffsetBetweenTimezone,\n getTimeUnits,\n} from '../../../../helpers/date-time';\nimport SelectInput from '../../../ui/inputs/select-input/select-input';\nimport FlexView from '../../../ui/layout/flex-view';\nimport Separator from '../../../ui/separator/separator';\nimport Text from '../../../ui/text/text';\nimport { useTrialSessionContext } from '../../context/use-trial-session-context';\nimport { TEACHER_TIMEZONE as teacherTimezone } from '../../trial-session-constants';\nimport SlideHeader from '../slide-header';\nimport { timeSlots } from './class-preference-constants';\nimport * as Styled from './class-preference-styled';\n\nconst defaultPreferences = [\n { id: 1, selectedDay: '', selectedTime: '' },\n { id: 2, selectedDay: '', selectedTime: '' },\n];\n\nconst ClassPreference: FC<IClassPreference> = memo(({ miniScreenDevice }) => {\n const { isTeacher, formData, updateSlideConfig } = useTrialSessionContext();\n const { preferences, studentTimezone } = formData || {};\n\n const daySlots = DAYS.map(day => ({ id: day, label: day }));\n const timezone = isTeacher ? teacherTimezone : studentTimezone;\n\n const handlePreferenceChange = (\n id: number,\n field: 'selectedDay' | 'selectedTime',\n value: string,\n ) => {\n updateSlideConfig({\n preferences: (preferences ?? defaultPreferences).map((preference: TPreference) =>\n preference.id === id ? { ...preference, [field]: value } : preference,\n ),\n });\n };\n\n const handleDayChange = (id: number, value: string) => {\n handlePreferenceChange(id, 'selectedDay', value);\n };\n\n const handleTimeChange = (id: number, value: string) => {\n handlePreferenceChange(id, 'selectedTime', value);\n };\n\n const getDisplayDateTimeValue = useCallback(\n (dayValue: string, timeValue: string) => {\n if (dayValue && timeValue && studentTimezone) {\n // Extracting hours, minutes, and period from the selected time.\n const { hours, minutes } = getTimeUnits(timeValue);\n const todayTimestamp = new Date().setHours(0, 0, 0, 0); // Setting current date to midnight\n\n // Calculating offset between the teacher's and student's timezone.\n const timestampOffset = getOffsetBetweenTimezone(teacherTimezone, studentTimezone);\n const studentTimestamp = isTeacher ? todayTimestamp + timestampOffset : todayTimestamp; // Current timestamp at student's timezone\n const { day: today = '' } = convertEpochToDateTime(studentTimestamp, studentTimezone); // Current day at student's timezone.\n\n // Calculating current and selected day index to get day difference.\n const currentDayIndex = DAYS.indexOf(today);\n const selectedDayIndex = DAYS.indexOf(dayValue);\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 studentTimestamp + convertToMilliseconds({ days: dayDifference, hours, minutes });\n\n // Returning date, time value with respect to both teacher and student timezone.\n return convertEpochToDateTime(epochTimestamp, timezone);\n }\n\n return {};\n },\n [isTeacher, studentTimezone, timezone],\n );\n\n useEffect(() => {\n if (isTeacher && !preferences) {\n updateSlideConfig({ preferences: defaultPreferences });\n }\n }, [isTeacher, preferences, updateSlideConfig]);\n\n return (\n <Styled.Container>\n <Separator height={60} />\n <SlideHeader />\n <Styled.PreferenceWrapper\n $gapX={miniScreenDevice ? 2.2 : 3.75}\n $gutterX={4.6875}\n $background=\"YELLOW_4\"\n $borderColor=\"BLACK_1\"\n $flexDirection=\"row\"\n $justifyContent=\"space-between\"\n $alignItems=\"center\"\n >\n <Styled.FixedLineSeparator />\n {preferences?.map(preference => {\n const { id, selectedDay, selectedTime } = preference;\n const { day, time } = getDisplayDateTimeValue(selectedDay, selectedTime);\n\n return (\n <FlexView key={`slot-${id}`} $widthX={15} $background=\"YELLOW_1\" $borderColor=\"BLACK_1\">\n <FlexView $gapX={1.65} $gutterX={2} $flexGapX={0.25}>\n <SelectInput\n renderAs=\"primary\"\n label={`Day ${id}`}\n value={selectedDay}\n options={daySlots}\n theme=\"dark\"\n shape=\"borderLess\"\n isTransparent\n onChange={value => handleDayChange(id, value)}\n />\n <SelectInput\n renderAs=\"primary\"\n label=\"Time\"\n value={selectedTime}\n options={timeSlots}\n shape=\"borderLess\"\n isTransparent\n theme=\"dark\"\n onChange={value => handleTimeChange(id, value)}\n />\n </FlexView>\n <FlexView\n $heightX={3.125}\n $gutterX={2}\n $justifyContent=\"center\"\n $background=\"WHITE_T_60\"\n >\n {isTeacher ? (\n <Text $renderAs=\"ac4-black\" $align=\"center\">\n {day ? day.slice(0, 3) : '__'}, {time ? time : '__'} {isTeacher ? '(IST)' : ''}\n </Text>\n ) : null}\n </FlexView>\n </FlexView>\n );\n })}\n </Styled.PreferenceWrapper>\n </Styled.Container>\n );\n});\n\nexport default ClassPreference;\n"],"names":["defaultPreferences","ClassPreference","memo","miniScreenDevice","isTeacher","formData","updateSlideConfig","useTrialSessionContext","preferences","studentTimezone","daySlots","DAYS","day","timezone","teacherTimezone","handlePreferenceChange","id","field","value","preference","handleDayChange","handleTimeChange","getDisplayDateTimeValue","useCallback","dayValue","timeValue","hours","minutes","getTimeUnits","todayTimestamp","timestampOffset","getOffsetBetweenTimezone","studentTimestamp","today","convertEpochToDateTime","currentDayIndex","dayDifference","epochTimestamp","convertToMilliseconds","useEffect","jsxs","Styled.Container","jsx","Separator","SlideHeader","Styled.PreferenceWrapper","Styled.FixedLineSeparator","selectedDay","selectedTime","time","FlexView","SelectInput","timeSlots","Text"],"mappings":";;;;;;;;;;;;;AAsBA,MAAMA,IAAqB;AAAA,EACzB,EAAE,IAAI,GAAG,aAAa,IAAI,cAAc,GAAG;AAAA,EAC3C,EAAE,IAAI,GAAG,aAAa,IAAI,cAAc,GAAG;AAC7C,GAEMC,KAAwCC,EAAK,CAAC,EAAE,kBAAAC,QAAuB;AAC3E,QAAM,EAA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AA;AAAA,oBACC,UAAS;AAAA,oBACT,OAAM;AAAA,oBACN,OAAOH;AAAA,oBACP,SAASI;AAAA,oBACT,OAAM;AAAA,oBACN,eAAa;AAAA,oBACb,OAAM;AAAA,oBACN,UAAU,CAAAlC,MAASG,EAAiBL,GAAIE,CAAK;AAAA,kBAAA;AAAA,gBAC/C;AAAA,cAAA,GACF;AAAA,cACA,gBAAAwB;AAAA,gBAACQ;AAAA,gBAAA;AAAA,kBACC,UAAU;AAAA,kBACV,UAAU;AAAA,kBACV,iBAAgB;AAAA,kBAChB,aAAY;AAAA,kBAEX,cACE,gBAAAV,EAAAa,GAAA,EAAK,WAAU,aAAY,QAAO,UAChC,UAAA;AAAA,oBAAAzC,IAAMA,EAAI,MAAM,GAAG,CAAC,IAAI;AAAA,oBAAK;AAAA,oBAAGqC,KAAc;AAAA,oBAAK;AAAA,oBAAE7C,IAAY,UAAU;AAAA,kBAAA,EAAA,CAC9E,IACE;AAAA,gBAAA;AAAA,cACN;AAAA,YAlCa,EAAA,GAAA,QAAQY,CAAE,EAmCzB;AAAA,UAAA;AAAA,QAEH;AAAA,MAAA;AAAA,IACH;AAAA,EACF,EAAA,CAAA;AAEJ,CAAC;"}
@@ -1,65 +1,63 @@
1
- import { jsx as o, Fragment as D } from "react/jsx-runtime";
2
- import N from "../../../../node_modules/lodash.throttle/index.js";
3
- import { useRef as S, useCallback as s, useMemo as O, useEffect as m } from "react";
4
- import x from "../../../chapters-v2/chapter-details/chapter-details.js";
5
- import $ from "../../../milestone/milestone-list-container/milestone-list-container.js";
6
- import { useTrialSessionContext as H } from "../../context/use-trial-session-context.js";
7
- import { isPLASource as M } from "../../helper.js";
8
- import { Container as F, Wrapper as U, ChapterWrapper as W } from "./learning-plan-styled.js";
9
- import { useLearningPlanScrollSync as j } from "./use-learning-plan-scroll-sync.js";
10
- const Q = () => {
11
- const { trialHomeData: v, studentId: l, formData: A, isTeacher: r, updateSlideConfig: c } = H(), {
12
- demo_info: { student_classroom_id: C, stream: I },
13
- intel_student: d
14
- } = v || {}, { name: g = "", chapterId: i } = A || {}, t = S(null), a = S([]), p = S(!1), R = M(d == null ? void 0 : d.source), {
15
- publishScrollEvents: f,
16
- closeChannel: T,
1
+ import { jsx as o, Fragment as _ } from "react/jsx-runtime";
2
+ import k from "../../../../node_modules/lodash.throttle/index.js";
3
+ import { useRef as h, useCallback as l, useMemo as D, useEffect as m } from "react";
4
+ import N from "../../../chapters-v2/chapter-details/chapter-details.js";
5
+ import O from "../../../milestone/milestone-list-container/milestone-list-container.js";
6
+ import { useTrialSessionContext as x } from "../../context/use-trial-session-context.js";
7
+ import { Container as $, Wrapper as H, ChapterWrapper as M } from "./learning-plan-styled.js";
8
+ import { useLearningPlanScrollSync as F } from "./use-learning-plan-scroll-sync.js";
9
+ const z = () => {
10
+ const { trialHomeData: P, studentId: s, formData: L, isTeacher: r, updateSlideConfig: c } = x(), {
11
+ demo_info: { student_classroom_id: S, stream: g }
12
+ } = P || {}, { name: I = "", chapterId: i } = L || {}, t = h(null), a = h([]), d = h(!1), {
13
+ publishScrollEvents: p,
14
+ closeChannel: C,
17
15
  scrollPoints: n
18
- } = j(C), E = s(() => {
19
- if (i && l) {
16
+ } = F(S), T = l(() => {
17
+ if (i && s) {
20
18
  const e = t.current;
21
19
  e == null || e.scrollTo({
22
20
  top: 0,
23
21
  behavior: "smooth"
24
22
  });
25
23
  }
26
- }, [l, i]), _ = s(
24
+ }, [s, i]), R = l(
27
25
  (e) => {
28
26
  c({
29
27
  chapterId: e.id
30
28
  });
31
29
  },
32
30
  [c]
33
- ), b = s(() => {
31
+ ), A = l(() => {
34
32
  c({
35
33
  chapterId: void 0
36
34
  });
37
- }, [c]), P = s(() => {
38
- a.current.length === 0 || p.current || (p.current = !0, f && f({
35
+ }, [c]), E = l(() => {
36
+ a.current.length === 0 || d.current || (d.current = !0, p && p({
39
37
  eventName: "TRIAL_SESSION_GOAL_PLAN_SCROLL",
40
38
  eventPayload: {
41
39
  scrollPoints: a.current
42
40
  }
43
- }), a.current = [], p.current = !1);
44
- }, [f]), L = O(() => N(P, 500), [P]), h = s(() => {
41
+ }), a.current = [], d.current = !1);
42
+ }, [p]), v = D(() => k(E, 500), [E]), f = l(() => {
45
43
  var u;
46
44
  const e = ((u = t.current) == null ? void 0 : u.scrollTop) || 0;
47
- a.current.push(e), L();
48
- }, [L]);
45
+ a.current.push(e), v();
46
+ }, [v]);
49
47
  return m(() => {
50
- E();
51
- }, [E]), m(() => {
48
+ T();
49
+ }, [T]), m(() => {
52
50
  if (t.current && r) {
53
51
  const e = t.current;
54
- return e.addEventListener("scroll", h), () => {
55
- e && e.removeEventListener("scroll", h);
52
+ return e.addEventListener("scroll", f), () => {
53
+ e && e.removeEventListener("scroll", f);
56
54
  };
57
55
  }
58
- }, [r, h]), m(() => {
56
+ }, [r, f]), m(() => {
59
57
  const e = t.current;
60
58
  if (n && Array.isArray(n) && !r && e) {
61
59
  const u = Math.floor(
62
- n.reduce((y, k) => y + k, 0) / n.length
60
+ n.reduce((b, y) => b + y, 0) / n.length
63
61
  );
64
62
  e.scrollTo({
65
63
  top: u,
@@ -67,32 +65,32 @@ const Q = () => {
67
65
  });
68
66
  }
69
67
  }, [n, r]), m(() => () => {
70
- T();
71
- }, [T]), /* @__PURE__ */ o(F, { ref: t, $isScrollable: r, children: /* @__PURE__ */ o(
72
- U,
68
+ C();
69
+ }, [C]), /* @__PURE__ */ o($, { ref: t, $isScrollable: r, children: /* @__PURE__ */ o(
70
+ H,
73
71
  {
74
72
  $clickable: r,
75
73
  $gutterX: 2,
76
74
  $isScrollable: r,
77
75
  id: "milestone-list-element-container",
78
- children: i ? /* @__PURE__ */ o(D, { children: /* @__PURE__ */ o(W, { children: /* @__PURE__ */ o(
79
- x,
76
+ children: i ? /* @__PURE__ */ o(_, { children: /* @__PURE__ */ o(M, { children: /* @__PURE__ */ o(
77
+ N,
80
78
  {
81
79
  userChapterId: i,
82
- studentId: l,
80
+ studentId: s,
83
81
  userType: r ? "TEACHER" : "STUDENT",
84
- onExit: b
82
+ onExit: A
85
83
  }
86
84
  ) }) }) : /* @__PURE__ */ o(
87
- $,
85
+ O,
88
86
  {
89
87
  userType: r ? "TEACHER" : "STUDENT",
90
- studentName: g,
91
- studentId: l,
92
- studentClassroomId: C,
93
- milestoneType: R ? "ACTIVE" : "DRAFT",
94
- onChapterClick: _,
95
- courseStream: I,
88
+ studentName: I,
89
+ studentId: s,
90
+ studentClassroomId: S,
91
+ milestoneType: "DRAFT",
92
+ onChapterClick: R,
93
+ courseStream: g,
96
94
  isTrialSession: !0
97
95
  }
98
96
  )
@@ -100,6 +98,6 @@ const Q = () => {
100
98
  ) });
101
99
  };
102
100
  export {
103
- Q as default
101
+ z as default
104
102
  };
105
103
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/features/trial-session/comps/learning-plan/index.tsx"],"sourcesContent":["import type { IChapterDataProps } from '../../../chapters/chapter/chapter-types';\n\nimport throttle from 'lodash.throttle';\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport ChapterDetails from '../../../chapters-v2/chapter-details/chapter-details';\nimport MilestoneList from '../../../milestone/milestone-list-container/milestone-list-container';\nimport { useTrialSessionContext } from '../../context/use-trial-session-context';\nimport { isPLASource } from '../../helper';\nimport * as Styled from './learning-plan-styled';\nimport { useLearningPlanScrollSync } from './use-learning-plan-scroll-sync';\n\nconst LearningPlan: React.FC = () => {\n const { trialHomeData, studentId, formData, isTeacher, updateSlideConfig } =\n useTrialSessionContext();\n const {\n demo_info: { student_classroom_id: studentClassroomId, stream },\n intel_student: intelStudent,\n } = trialHomeData || {};\n const { name = '', chapterId } = formData || {};\n\n const containerRef = useRef<HTMLDivElement>(null);\n const scrollPointsRef = useRef<number[]>([]);\n const isSendingScrollPointsRef = useRef(false);\n const isPLA = isPLASource(intelStudent?.source);\n\n const {\n publishScrollEvents,\n closeChannel,\n scrollPoints: receivedScrollPoints,\n } = useLearningPlanScrollSync(studentClassroomId);\n\n const fetchChapter = useCallback(() => {\n if (chapterId && studentId) {\n const scrollElement = containerRef.current;\n\n scrollElement?.scrollTo({\n top: 0,\n behavior: 'smooth',\n });\n }\n }, [studentId, chapterId]);\n\n const handleOnChapterClick = useCallback(\n (chapter: IChapterDataProps) => {\n updateSlideConfig({\n chapterId: chapter.id,\n });\n },\n [updateSlideConfig],\n );\n\n const handleOnBackIconClick = useCallback(() => {\n updateSlideConfig({\n chapterId: undefined,\n });\n }, [updateSlideConfig]);\n\n const sendScrollPoints = useCallback(() => {\n if (scrollPointsRef.current.length === 0 || isSendingScrollPointsRef.current) return;\n\n isSendingScrollPointsRef.current = true;\n\n if (publishScrollEvents) {\n publishScrollEvents({\n eventName: 'TRIAL_SESSION_GOAL_PLAN_SCROLL',\n eventPayload: {\n scrollPoints: scrollPointsRef.current,\n },\n });\n }\n\n scrollPointsRef.current = [];\n isSendingScrollPointsRef.current = false;\n }, [publishScrollEvents]);\n\n const throttleSend = useMemo(() => throttle(sendScrollPoints, 500), [sendScrollPoints]);\n\n const handleScroll = useCallback(() => {\n const scrollPoint = containerRef.current?.scrollTop || 0;\n\n scrollPointsRef.current.push(scrollPoint);\n\n throttleSend();\n }, [throttleSend]);\n\n useEffect(() => {\n fetchChapter();\n }, [fetchChapter]);\n\n useEffect(() => {\n if (containerRef.current) {\n if (isTeacher) {\n const scrollElement = containerRef.current;\n\n scrollElement.addEventListener('scroll', handleScroll);\n\n return () => {\n if (scrollElement) {\n scrollElement.removeEventListener('scroll', handleScroll);\n }\n };\n }\n }\n }, [isTeacher, handleScroll]);\n\n useEffect(() => {\n const scrollElement = containerRef.current;\n\n if (\n receivedScrollPoints &&\n Array.isArray(receivedScrollPoints) &&\n !isTeacher &&\n scrollElement\n ) {\n const averageScroll = Math.floor(\n receivedScrollPoints.reduce((a, b) => a + b, 0) / receivedScrollPoints.length,\n );\n\n scrollElement.scrollTo({\n top: averageScroll,\n behavior: 'smooth',\n });\n }\n }, [receivedScrollPoints, isTeacher]);\n\n useEffect(() => {\n return () => {\n closeChannel();\n };\n }, [closeChannel]);\n\n return (\n <Styled.Container ref={containerRef} $isScrollable={isTeacher}>\n <Styled.Wrapper\n $clickable={isTeacher}\n $gutterX={2}\n $isScrollable={isTeacher}\n id=\"milestone-list-element-container\"\n >\n {chapterId ? (\n <>\n <Styled.ChapterWrapper>\n <ChapterDetails\n userChapterId={chapterId}\n studentId={studentId}\n userType={isTeacher ? 'TEACHER' : 'STUDENT'}\n onExit={handleOnBackIconClick}\n />\n </Styled.ChapterWrapper>\n </>\n ) : (\n <MilestoneList\n userType={isTeacher ? 'TEACHER' : 'STUDENT'}\n studentName={name}\n studentId={studentId}\n studentClassroomId={studentClassroomId}\n milestoneType={isPLA ? 'ACTIVE' : 'DRAFT'}\n onChapterClick={handleOnChapterClick}\n courseStream={stream}\n isTrialSession\n />\n )}\n </Styled.Wrapper>\n </Styled.Container>\n );\n};\n\nexport default LearningPlan;\n"],"names":["LearningPlan","trialHomeData","studentId","formData","isTeacher","updateSlideConfig","useTrialSessionContext","studentClassroomId","stream","intelStudent","name","chapterId","containerRef","useRef","scrollPointsRef","isSendingScrollPointsRef","isPLA","isPLASource","publishScrollEvents","closeChannel","receivedScrollPoints","useLearningPlanScrollSync","fetchChapter","useCallback","scrollElement","handleOnChapterClick","chapter","handleOnBackIconClick","sendScrollPoints","throttleSend","useMemo","throttle","handleScroll","scrollPoint","_a","useEffect","averageScroll","a","b","Styled.Container","jsx","Styled.Wrapper","Fragment","Styled.ChapterWrapper","ChapterDetails","MilestoneList"],"mappings":";;;;;;;;;AAYA,MAAMA,IAAyB,MAAM;AACnC,QAAM,EAAE,eAAAC,GAAe,WAAAC,GAAW,UAAAC,GAAU,WAAAC,GAAW,mBAAAC,EAAA,IACrDC,KACI;AAAA,IACJ,WAAW,EAAE,sBAAsBC,GAAoB,QAAAC,EAAO;AAAA,IAC9D,eAAeC;AAAA,EAAA,IACbR,KAAiB,CAAA,GACf,EAAE,MAAAS,IAA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;AAAA,QAAA;AAAA,MAAA,EAEZ,CAAA,EACF,CAAA,IAEA,gBAAAa;AAAA,QAACK;AAAAA,QAAA;AAAA,UACC,UAAUzC,IAAY,YAAY;AAAA,UAClC,aAAaM;AAAA,UACb,WAAAR;AAAA,UACA,oBAAAK;AAAA,UACA,eAAeS,IAAQ,WAAW;AAAA,UAClC,gBAAgBS;AAAA,UAChB,cAAcjB;AAAA,UACd,gBAAc;AAAA,QAAA;AAAA,MAChB;AAAA,IAAA;AAAA,EAGN,EAAA,CAAA;AAEJ;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/features/trial-session/comps/learning-plan/index.tsx"],"sourcesContent":["import type { IChapterDataProps } from '../../../chapters/chapter/chapter-types';\n\nimport throttle from 'lodash.throttle';\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport ChapterDetails from '../../../chapters-v2/chapter-details/chapter-details';\nimport MilestoneList from '../../../milestone/milestone-list-container/milestone-list-container';\nimport { useTrialSessionContext } from '../../context/use-trial-session-context';\nimport * as Styled from './learning-plan-styled';\nimport { useLearningPlanScrollSync } from './use-learning-plan-scroll-sync';\n\nconst LearningPlan: React.FC = () => {\n const { trialHomeData, studentId, formData, isTeacher, updateSlideConfig } =\n useTrialSessionContext();\n const {\n demo_info: { student_classroom_id: studentClassroomId, stream },\n } = trialHomeData || {};\n const { name = '', chapterId } = formData || {};\n\n const containerRef = useRef<HTMLDivElement>(null);\n const scrollPointsRef = useRef<number[]>([]);\n const isSendingScrollPointsRef = useRef(false);\n\n const {\n publishScrollEvents,\n closeChannel,\n scrollPoints: receivedScrollPoints,\n } = useLearningPlanScrollSync(studentClassroomId);\n\n const fetchChapter = useCallback(() => {\n if (chapterId && studentId) {\n const scrollElement = containerRef.current;\n\n scrollElement?.scrollTo({\n top: 0,\n behavior: 'smooth',\n });\n }\n }, [studentId, chapterId]);\n\n const handleOnChapterClick = useCallback(\n (chapter: IChapterDataProps) => {\n updateSlideConfig({\n chapterId: chapter.id,\n });\n },\n [updateSlideConfig],\n );\n\n const handleOnBackIconClick = useCallback(() => {\n updateSlideConfig({\n chapterId: undefined,\n });\n }, [updateSlideConfig]);\n\n const sendScrollPoints = useCallback(() => {\n if (scrollPointsRef.current.length === 0 || isSendingScrollPointsRef.current) return;\n\n isSendingScrollPointsRef.current = true;\n\n if (publishScrollEvents) {\n publishScrollEvents({\n eventName: 'TRIAL_SESSION_GOAL_PLAN_SCROLL',\n eventPayload: {\n scrollPoints: scrollPointsRef.current,\n },\n });\n }\n\n scrollPointsRef.current = [];\n isSendingScrollPointsRef.current = false;\n }, [publishScrollEvents]);\n\n const throttleSend = useMemo(() => throttle(sendScrollPoints, 500), [sendScrollPoints]);\n\n const handleScroll = useCallback(() => {\n const scrollPoint = containerRef.current?.scrollTop || 0;\n\n scrollPointsRef.current.push(scrollPoint);\n\n throttleSend();\n }, [throttleSend]);\n\n useEffect(() => {\n fetchChapter();\n }, [fetchChapter]);\n\n useEffect(() => {\n if (containerRef.current) {\n if (isTeacher) {\n const scrollElement = containerRef.current;\n\n scrollElement.addEventListener('scroll', handleScroll);\n\n return () => {\n if (scrollElement) {\n scrollElement.removeEventListener('scroll', handleScroll);\n }\n };\n }\n }\n }, [isTeacher, handleScroll]);\n\n useEffect(() => {\n const scrollElement = containerRef.current;\n\n if (\n receivedScrollPoints &&\n Array.isArray(receivedScrollPoints) &&\n !isTeacher &&\n scrollElement\n ) {\n const averageScroll = Math.floor(\n receivedScrollPoints.reduce((a, b) => a + b, 0) / receivedScrollPoints.length,\n );\n\n scrollElement.scrollTo({\n top: averageScroll,\n behavior: 'smooth',\n });\n }\n }, [receivedScrollPoints, isTeacher]);\n\n useEffect(() => {\n return () => {\n closeChannel();\n };\n }, [closeChannel]);\n\n return (\n <Styled.Container ref={containerRef} $isScrollable={isTeacher}>\n <Styled.Wrapper\n $clickable={isTeacher}\n $gutterX={2}\n $isScrollable={isTeacher}\n id=\"milestone-list-element-container\"\n >\n {chapterId ? (\n <>\n <Styled.ChapterWrapper>\n <ChapterDetails\n userChapterId={chapterId}\n studentId={studentId}\n userType={isTeacher ? 'TEACHER' : 'STUDENT'}\n onExit={handleOnBackIconClick}\n />\n </Styled.ChapterWrapper>\n </>\n ) : (\n <MilestoneList\n userType={isTeacher ? 'TEACHER' : 'STUDENT'}\n studentName={name}\n studentId={studentId}\n studentClassroomId={studentClassroomId}\n milestoneType=\"DRAFT\"\n onChapterClick={handleOnChapterClick}\n courseStream={stream}\n isTrialSession\n />\n )}\n </Styled.Wrapper>\n </Styled.Container>\n );\n};\n\nexport default LearningPlan;\n"],"names":["LearningPlan","trialHomeData","studentId","formData","isTeacher","updateSlideConfig","useTrialSessionContext","studentClassroomId","stream","name","chapterId","containerRef","useRef","scrollPointsRef","isSendingScrollPointsRef","publishScrollEvents","closeChannel","receivedScrollPoints","useLearningPlanScrollSync","fetchChapter","useCallback","scrollElement","handleOnChapterClick","chapter","handleOnBackIconClick","sendScrollPoints","throttleSend","useMemo","throttle","handleScroll","scrollPoint","_a","useEffect","averageScroll","a","b","Styled.Container","jsx","Styled.Wrapper","Fragment","Styled.ChapterWrapper","ChapterDetails","MilestoneList"],"mappings":";;;;;;;;AAWA,MAAMA,IAAyB,MAAM;AACnC,QAAM,EAAE,eAAAC,GAAe,WAAAC,GAAW,UAAAC,GAAU,WAAAC,GAAW,mBAAAC,EAAA,IACrDC,KACI;AAAA,IACJ,WAAW,EAAE,sBAAsBC,GAAoB,QAAAC,EAAO;AAAA,EAAA,IAC5DP,KAAiB,CAAA,GACf,EAAE,MAAAQ,IAAO,IAAI,WAAAC,EAAU,IAAIP,KAAY,CAAA,GAEvCQ,IAAeC,EAAuB,IAAI,GAC1CC,IAAkBD,EAAiB,CAAA,CAAE,GACrCE,IAA2BF,EAAO,EAAK,GAEvC;AAAA,IACJ,qBAAAG;AAAA,IACA,cAAAC;AAAA,IACA,cAAcC;AAAA,EAAA,IACZC,EAA0BX,CAAkB,GAE1CY,IAAeC,EAAY,MAAM;AACrC,QAAIV,KA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