@cuemath/leap 3.3.24-link.2 → 3.3.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/features/auth/account-selector/account-selector-styled.js +5 -6
- package/dist/features/auth/account-selector/account-selector-styled.js.map +1 -1
- package/dist/features/auth/account-selector/account-selector.js +57 -51
- package/dist/features/auth/account-selector/account-selector.js.map +1 -1
- package/dist/features/auth/comps/user-list/user-list-styled.js +2 -3
- package/dist/features/auth/comps/user-list/user-list-styled.js.map +1 -1
- package/dist/features/auth/pla-signup/pla-analytics-events.js +3 -9
- package/dist/features/auth/pla-signup/pla-analytics-events.js.map +1 -1
- package/dist/features/auth/signup/circular-step-wrapper/circular-step-wrapper.js.map +1 -1
- package/dist/features/auth/signup/custom-input-field/custom-input-field.js +8 -8
- package/dist/features/auth/signup/custom-input-field/custom-input-field.js.map +1 -1
- package/dist/features/journey/use-journey/use-journey.js +6 -18
- package/dist/features/journey/use-journey/use-journey.js.map +1 -1
- package/dist/features/milestone/create/milestone-create-helpers.js +7 -13
- package/dist/features/milestone/create/milestone-create-helpers.js.map +1 -1
- package/dist/features/parent-dashboard/hooks/use-parent-home-data.js +34 -40
- package/dist/features/parent-dashboard/hooks/use-parent-home-data.js.map +1 -1
- package/dist/features/parent-dashboard/modals/tutor-change/tutor-change-styled.js +3 -3
- package/dist/features/parent-dashboard/modals/tutor-change/tutor-change-styled.js.map +1 -1
- package/dist/features/parent-dashboard/parent-dashboard-types.js.map +1 -1
- package/dist/features/parent-dashboard/parent-dashboard-view.js +138 -161
- package/dist/features/parent-dashboard/parent-dashboard-view.js.map +1 -1
- package/dist/features/stickers/constants.js +235 -0
- package/dist/features/stickers/constants.js.map +1 -0
- package/dist/features/{ui/sticker-grid/sticker-grid-styles.js → stickers/sticker-selector/comps/sticker/sticker-styled.js} +15 -45
- package/dist/features/stickers/sticker-selector/comps/sticker/sticker-styled.js.map +1 -0
- package/dist/features/stickers/sticker-selector/comps/sticker/sticker.js +49 -0
- package/dist/features/stickers/sticker-selector/comps/sticker/sticker.js.map +1 -0
- package/dist/features/stickers/sticker-selector/comps/stiker-selector-grid/sticker-selector-grid-styled.js +28 -0
- package/dist/features/stickers/sticker-selector/comps/stiker-selector-grid/sticker-selector-grid-styled.js.map +1 -0
- package/dist/features/stickers/sticker-selector/comps/stiker-selector-grid/sticker-selector-grid.js +26 -0
- package/dist/features/stickers/sticker-selector/comps/stiker-selector-grid/sticker-selector-grid.js.map +1 -0
- package/dist/features/stickers/sticker-selector/sticker-selector-styled.js +13 -0
- package/dist/features/stickers/sticker-selector/sticker-selector-styled.js.map +1 -0
- package/dist/features/stickers/sticker-selector/sticker-selector.js +86 -0
- package/dist/features/stickers/sticker-selector/sticker-selector.js.map +1 -0
- package/dist/features/stickers/stickers-effects/stickers-effects-animations.js +82 -0
- package/dist/features/stickers/stickers-effects/stickers-effects-animations.js.map +1 -0
- package/dist/features/stickers/stickers-effects/stickers-effects-cache.js +19 -0
- package/dist/features/stickers/stickers-effects/stickers-effects-cache.js.map +1 -0
- package/dist/features/stickers/stickers-effects/stickers-effects-helper.js +105 -0
- package/dist/features/stickers/stickers-effects/stickers-effects-helper.js.map +1 -0
- package/dist/features/stickers/stickers-effects/stickers-effects-styled.js +37 -0
- package/dist/features/stickers/stickers-effects/stickers-effects-styled.js.map +1 -0
- package/dist/features/stickers/stickers-effects/stickers-effects.js +67 -0
- package/dist/features/stickers/stickers-effects/stickers-effects.js.map +1 -0
- package/dist/features/trial-session/comps/class-preference/class-preference.js +49 -61
- package/dist/features/trial-session/comps/class-preference/class-preference.js.map +1 -1
- package/dist/features/trial-session/comps/session-report/session-report.js +15 -15
- package/dist/features/trial-session/comps/session-report/session-report.js.map +1 -1
- package/dist/features/trial-session/comps/student-feedback/student-feedback-constants.js +0 -5
- package/dist/features/trial-session/comps/student-feedback/student-feedback-constants.js.map +1 -1
- package/dist/features/trial-session/comps/student-feedback/student-feedback.js +51 -96
- package/dist/features/trial-session/comps/student-feedback/student-feedback.js.map +1 -1
- package/dist/features/trial-session/comps/student-profile/student-profile.js +63 -70
- package/dist/features/trial-session/comps/student-profile/student-profile.js.map +1 -1
- package/dist/features/trial-session/helper.js +54 -71
- package/dist/features/trial-session/helper.js.map +1 -1
- package/dist/features/trial-session/hooks/use-trial-session-navigation.js +130 -149
- package/dist/features/trial-session/hooks/use-trial-session-navigation.js.map +1 -1
- package/dist/features/trial-session/trial-session-types.js.map +1 -1
- package/dist/features/trial-session/trial-session-view.js +98 -107
- package/dist/features/trial-session/trial-session-view.js.map +1 -1
- package/dist/features/ui/dot-lottie-animations/dot-lottie-animation.js +88 -75
- package/dist/features/ui/dot-lottie-animations/dot-lottie-animation.js.map +1 -1
- package/dist/features/ui/lottie-animation/lottie-animation.js +55 -46
- package/dist/features/ui/lottie-animation/lottie-animation.js.map +1 -1
- package/dist/features/ui/modals/modal-styled.js +48 -15
- package/dist/features/ui/modals/modal-styled.js.map +1 -1
- package/dist/features/ui/modals/modal.js +46 -38
- package/dist/features/ui/modals/modal.js.map +1 -1
- package/dist/index.d.ts +71 -66
- package/dist/index.js +391 -401
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/dist/features/auth/account-selector/comps/compact-header/account-selector-header.js +0 -31
- package/dist/features/auth/account-selector/comps/compact-header/account-selector-header.js.map +0 -1
- package/dist/features/parent-dashboard/api/cancel-subscription.js +0 -9
- package/dist/features/parent-dashboard/api/cancel-subscription.js.map +0 -1
- package/dist/features/parent-dashboard/comps/billing-information/billing-information-styled.js +0 -20
- package/dist/features/parent-dashboard/comps/billing-information/billing-information-styled.js.map +0 -1
- package/dist/features/parent-dashboard/comps/billing-information/billing-information.js +0 -96
- package/dist/features/parent-dashboard/comps/billing-information/billing-information.js.map +0 -1
- package/dist/features/parent-dashboard/modals/cancel-subscription/cancel-subscription-constants.js +0 -21
- package/dist/features/parent-dashboard/modals/cancel-subscription/cancel-subscription-constants.js.map +0 -1
- package/dist/features/parent-dashboard/modals/cancel-subscription/cancel-subscription.js +0 -80
- package/dist/features/parent-dashboard/modals/cancel-subscription/cancel-subscription.js.map +0 -1
- package/dist/features/parent-dashboard/modals/cancellation-confirmation/cancellation-confirmation.js +0 -23
- package/dist/features/parent-dashboard/modals/cancellation-confirmation/cancellation-confirmation.js.map +0 -1
- package/dist/features/parent-dashboard/modals/cancellation-reason/cancellation-reason-constant.js +0 -55
- package/dist/features/parent-dashboard/modals/cancellation-reason/cancellation-reason-constant.js.map +0 -1
- package/dist/features/parent-dashboard/modals/cancellation-reason/cancellation-reason-styled.js +0 -59
- package/dist/features/parent-dashboard/modals/cancellation-reason/cancellation-reason-styled.js.map +0 -1
- package/dist/features/parent-dashboard/modals/cancellation-reason/cancellation-reason.js +0 -93
- package/dist/features/parent-dashboard/modals/cancellation-reason/cancellation-reason.js.map +0 -1
- package/dist/features/parent-dashboard/modals/hooks/use-pla-model-handlers.js +0 -63
- package/dist/features/parent-dashboard/modals/hooks/use-pla-model-handlers.js.map +0 -1
- package/dist/features/parent-dashboard/modals/view-payment-method/view-payment-method.js +0 -65
- package/dist/features/parent-dashboard/modals/view-payment-method/view-payment-method.js.map +0 -1
- package/dist/features/student-username/add/add-student-username-constants.js +0 -6
- package/dist/features/student-username/add/add-student-username-constants.js.map +0 -1
- package/dist/features/student-username/add/add-student-username-helpers.js +0 -6
- package/dist/features/student-username/add/add-student-username-helpers.js.map +0 -1
- package/dist/features/student-username/add/add-student-username-styled.js +0 -10
- package/dist/features/student-username/add/add-student-username-styled.js.map +0 -1
- package/dist/features/student-username/add/add-student-username.js +0 -78
- package/dist/features/student-username/add/add-student-username.js.map +0 -1
- package/dist/features/student-username/add/api/update-username.js +0 -9
- package/dist/features/student-username/add/api/update-username.js.map +0 -1
- package/dist/features/student-username/add/api/username-availability.js +0 -10
- package/dist/features/student-username/add/api/username-availability.js.map +0 -1
- package/dist/features/student-username/add/hooks/use-check-username-availability.js +0 -41
- package/dist/features/student-username/add/hooks/use-check-username-availability.js.map +0 -1
- package/dist/features/trial-session/api/teacher-availability.js +0 -9
- package/dist/features/trial-session/api/teacher-availability.js.map +0 -1
- package/dist/features/trial-session/comps/class-preference/helpers.js +0 -28
- package/dist/features/trial-session/comps/class-preference/helpers.js.map +0 -1
- package/dist/features/ui/sticker-grid/sticker-grid-styles.js.map +0 -1
- package/dist/features/ui/sticker-grid/sticker-grid.js +0 -24
- package/dist/features/ui/sticker-grid/sticker-grid.js.map +0 -1
- package/dist/features/ui/sticker-grid/sticker.js +0 -57
- package/dist/features/ui/sticker-grid/sticker.js.map +0 -1
- package/dist/features/ui/stickers/constants.js +0 -6
- package/dist/features/ui/stickers/constants.js.map +0 -1
- package/dist/features/ui/stickers/stickers-effects.js +0 -64
- package/dist/features/ui/stickers/stickers-effects.js.map +0 -1
- package/dist/features/ui/stickers/stickers-styled.js +0 -29
- package/dist/features/ui/stickers/stickers-styled.js.map +0 -1
- package/dist/features/ui/stickers/stickers-utils.js +0 -91
- package/dist/features/ui/stickers/stickers-utils.js.map +0 -1
- package/dist/features/ui/stickers/stickers.js +0 -40
- package/dist/features/ui/stickers/stickers.js.map +0 -1
|
@@ -1,97 +1,80 @@
|
|
|
1
|
-
import { DAYS as
|
|
2
|
-
import { getOffsetBetweenTimezone as
|
|
3
|
-
import { GOAL_CATEGORY as
|
|
4
|
-
import { getGoalsFromConfig as
|
|
5
|
-
import { TrialPageId as
|
|
6
|
-
const
|
|
7
|
-
const e =
|
|
8
|
-
if (
|
|
9
|
-
const
|
|
10
|
-
...
|
|
1
|
+
import { DAYS as N } from "../../constants/date-time.js";
|
|
2
|
+
import { getOffsetBetweenTimezone as y, convertEpochToDateTime as O, getTimeUnits as x, convertToMilliseconds as D } from "../../helpers/date-time.js";
|
|
3
|
+
import { GOAL_CATEGORY as h } from "../milestone/constants.js";
|
|
4
|
+
import { getGoalsFromConfig as R } from "../milestone/create/milestone-create-helpers.js";
|
|
5
|
+
import { TrialPageId as a, TEACHER_TIMEZONE as L } from "./trial-session-constants.js";
|
|
6
|
+
const U = (c, t, r) => {
|
|
7
|
+
const e = c ? [...c] : [], s = e == null ? void 0 : e.findIndex((d) => d.goal_category === t);
|
|
8
|
+
if (s === -1) {
|
|
9
|
+
const d = {
|
|
10
|
+
...r,
|
|
11
11
|
goal_category: t,
|
|
12
12
|
publish: !1
|
|
13
13
|
};
|
|
14
|
-
e.push(
|
|
14
|
+
e.push(d);
|
|
15
15
|
} else
|
|
16
|
-
e[
|
|
17
|
-
...e[
|
|
18
|
-
...
|
|
16
|
+
e[s] = {
|
|
17
|
+
...e[s],
|
|
18
|
+
...r
|
|
19
19
|
};
|
|
20
20
|
return e;
|
|
21
|
-
},
|
|
21
|
+
}, $ = (c, t) => {
|
|
22
22
|
if (!t) return [];
|
|
23
|
-
const
|
|
24
|
-
return
|
|
25
|
-
const { selectedDay:
|
|
23
|
+
const r = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0), e = y(L, t), s = r + e, { day: d = "" } = O(s, t), m = N.indexOf(d);
|
|
24
|
+
return c.length > 0 ? c.filter((f) => f.selectedDay && f.selectedTime).map((f) => {
|
|
25
|
+
const { selectedDay: P, selectedTime: u } = f, { hours: i, minutes: o, period: g } = x(u), T = (N.indexOf(P) - m + 7) % 7;
|
|
26
26
|
return {
|
|
27
|
-
id:
|
|
28
|
-
value: `${
|
|
27
|
+
id: r + e + D({ days: T, hours: i, minutes: o }),
|
|
28
|
+
value: `${P}, ${u} - ${i + 1}:${o < 10 ? "0" : ""}${o} ${g}`
|
|
29
29
|
// Formatted the value string as required
|
|
30
30
|
};
|
|
31
31
|
}) : [];
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
return { weekday: o, start_time: d };
|
|
35
|
-
}), U = ({
|
|
36
|
-
milestoneConfigData: r,
|
|
32
|
+
}, b = ({
|
|
33
|
+
milestoneConfigData: c,
|
|
37
34
|
trialHomeData: t,
|
|
38
|
-
grade:
|
|
35
|
+
grade: r
|
|
39
36
|
}) => {
|
|
40
|
-
var
|
|
41
|
-
const { student: e, demo_info:
|
|
42
|
-
countryCode:
|
|
43
|
-
grade:
|
|
37
|
+
var I;
|
|
38
|
+
const { student: e, demo_info: s } = t, { grade: d } = e || {}, { stream: m, region_data: f } = s || {}, { opportunity_country: P = "US" } = f || {}, u = (l) => R(c, {
|
|
39
|
+
countryCode: P,
|
|
40
|
+
grade: r || d || "",
|
|
44
41
|
goalCategory: l,
|
|
45
|
-
courseStream:
|
|
42
|
+
courseStream: m,
|
|
46
43
|
enrollmentType: "ONLINE"
|
|
47
|
-
}),
|
|
48
|
-
if ((
|
|
44
|
+
}), i = u(h.TEST_PREP), o = u(h.ENRICHMENT);
|
|
45
|
+
if ((i == null ? void 0 : i.length) > 0 && (o == null ? void 0 : o.length) > 0)
|
|
49
46
|
return t;
|
|
50
|
-
const
|
|
51
|
-
var l, _,
|
|
52
|
-
return ((_ = (l = p[
|
|
53
|
-
})(),
|
|
54
|
-
if (
|
|
55
|
-
const l = (
|
|
56
|
-
|
|
47
|
+
const g = { ...t }, p = Object.fromEntries(g.pages.map((l) => [l.id, l])), T = (() => {
|
|
48
|
+
var l, _, n, E;
|
|
49
|
+
return ((_ = (l = p[a.SCHOOL_GOALS]) == null ? void 0 : l.nextPage) == null ? void 0 : _.pageId) === a.TEST_PREP && i.length === 0 ? a.SCHOOL_GOALS : i.length > 0 && ((E = (n = p[a.TEST_PREP]) == null ? void 0 : n.nextPage) == null ? void 0 : E.pageId) === a.STUDENT_ENRICHMENT && o.length === 0 ? a.TEST_PREP : null;
|
|
50
|
+
})(), S = T ? (I = p[(o == null ? void 0 : o.length) === 0 ? a.STUDENT_ENRICHMENT : a.TEST_PREP]) == null ? void 0 : I.nextPage : null;
|
|
51
|
+
if (S && T) {
|
|
52
|
+
const l = (n) => i.length === 0 && n === a.TEST_PREP || o.length === 0 && n === a.STUDENT_ENRICHMENT, _ = g.pages.filter((n) => !l(n.id));
|
|
53
|
+
g.pages = _.map((n) => {
|
|
57
54
|
var E;
|
|
58
|
-
return
|
|
59
|
-
...
|
|
55
|
+
return n.id === T ? { ...n, nextPage: S } : n.id === S.pageId ? {
|
|
56
|
+
...n,
|
|
60
57
|
prevPage: {
|
|
61
|
-
buttonLabel: ((E = p[
|
|
62
|
-
pageId:
|
|
58
|
+
buttonLabel: ((E = p[T]) == null ? void 0 : E.navigationLabel) ?? "",
|
|
59
|
+
pageId: T
|
|
63
60
|
}
|
|
64
|
-
} :
|
|
61
|
+
} : n;
|
|
65
62
|
});
|
|
66
63
|
}
|
|
67
|
-
return
|
|
68
|
-
},
|
|
64
|
+
return g;
|
|
65
|
+
}, F = (c, t) => {
|
|
69
66
|
var e;
|
|
70
|
-
const { preference_config:
|
|
71
|
-
return t.length > 0 ? ((e =
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
preference_description: d
|
|
77
|
-
})
|
|
78
|
-
)) || [] : [];
|
|
79
|
-
}, F = (r, t, n = !1) => {
|
|
80
|
-
const e = [];
|
|
81
|
-
if (!r || r.length === 0) return [];
|
|
82
|
-
for (let o = 0; o < r.length; o++) {
|
|
83
|
-
const s = r[o];
|
|
84
|
-
if (s && s.preference_category === t && (e.push(s.preference_code), n))
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
87
|
-
return n ? e[0] ? [e[0]] : [] : e;
|
|
67
|
+
const { preference_config: r } = c;
|
|
68
|
+
return t.length > 0 ? ((e = r == null ? void 0 : r.filter((s) => t.includes(s.preference_code))) == null ? void 0 : e.map(({ preference_code: s, preference_name: d, preference_category: m }) => ({
|
|
69
|
+
preference_code: s,
|
|
70
|
+
preference_name: d,
|
|
71
|
+
preference_category: m
|
|
72
|
+
}))) || [] : [];
|
|
88
73
|
};
|
|
89
74
|
export {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
v as getWeekdayAndStartTimeFromPreference,
|
|
95
|
-
$ as updateGoalInFormData
|
|
75
|
+
b as filterAndUpdateSlideNavigation,
|
|
76
|
+
$ as getFormattedPreferences,
|
|
77
|
+
F as getFormattedStudentPersonalizedPreference,
|
|
78
|
+
U as updateGoalInFormData
|
|
96
79
|
};
|
|
97
80
|
//# sourceMappingURL=helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","sources":["../../../src/features/trial-session/helper.ts"],"sourcesContent":["import type { IMilestoneConfig } from '../milestone/create/milestone-create-types';\nimport type { TPreference } from './comps/class-preference/class-preference-types';\nimport type { ITrialHomeData, TGoals, TPreferenceSchema } from './trial-session-types';\n\nimport { 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 { TEACHER_TIMEZONE, TrialPageId } from './trial-session-constants';\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 publish: false,\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 } = 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: 'ONLINE',\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 const filteredCodes = [];\n\n if (!preferences || preferences.length === 0) return [];\n\n for (let i = 0; i < preferences.length; i++) {\n const pref = preferences[i];\n\n if (pref && pref.preference_category === category) {\n filteredCodes.push(pref.preference_code);\n if (returnFirstOnly) break;\n }\n }\n\n return returnFirstOnly ? (filteredCodes[0] ? [filteredCodes[0]] : []) : filteredCodes;\n};\n\nexport {\n filterAndUpdateSlideNavigation,\n updateGoalInFormData,\n getFormattedPreferences,\n getWeekdayAndStartTimeFromPreference,\n getFormattedStudentPersonalizedPreference,\n getPreferenceCodesByCategory,\n};\n"],"names":["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","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","filteredCodes","i"],"mappings":";;;;;AAeA,MAAMA,IAAuB,CAACC,GAA6BC,GAAsBC,MAAiB;AAChG,QAAMC,IAAcH,IAAQ,CAAC,GAAGA,CAAK,IAAI,CAAA,GACnCI,IAAYD,KAAA,gBAAAA,EAAa,UAAU,CAAQE,MAAAA,EAAK,kBAAkBJ;AAExE,MAAIG,MAAc,IAAI;AACpB,UAAME,IAAoB;AAAA,MACxB,GAAGJ;AAAA,MACH,eAAeD;AAAA,MACf,SAAS;AAAA,IAAA;AAGX,IAAAE,EAAY,KAAKG,CAAiB;AAAA,EAAA;AAElC,IAAAH,EAAYC,CAAS,IAAI;AAAA,MACvB,GAAGD,EAAYC,CAAS;AAAA,MACxB,GAAGF;AAAA,IAAA;AAIA,SAAAC;AACT,GAEMI,IAA0B,CAACC,GAA4BC,MAA6B;AACpF,MAAA,CAACA,EAAiB,QAAO;AAEvB,QAAAC,yBAAqB,QAAO,SAAS,GAAG,GAAG,GAAG,CAAC,GAC/CC,IAAkBC,EAAyBC,GAAkBJ,CAAe,GAC5EK,IAAmBJ,IAAiBC,GACpC,EAAE,KAAKI,IAAQ,GAAO,IAAAC,EAAuBF,GAAkBL,CAAe,GAC9EQ,IAAkBC,EAAK,QAAQH,CAAK;AAE1C,SAAOP,EAAY,SAAS,IACxBA,EACG,OAAO,CAAAW,MAAcA,EAAW,eAAeA,EAAW,YAAY,EACtE,IAAI,CAAcA,MAAA;AACX,UAAA,EAAE,aAAAC,GAAa,cAAAC,EAAiB,IAAAF,GAEhC,EAAE,OAAAG,GAAO,SAAAC,GAAS,QAAAC,EAAO,IAAIC,EAAaJ,CAAY,GAItDK,KADmBR,EAAK,QAAQE,CAAW,IACPH,IAAkB,KAAK;AAQ1D,WA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AIGD;AAAA,IAAA,CACR;AAAA,EACH;AAEO,SAAAF;AACT,GAEMa,IAA4C,CAChDC,GACAC,MACG;;AACG,QAAA,EAAE,mBAAmBC,EAAqB,IAAAF;AAE5C,SAAAC,EAAc,SAAS,MAEvBV,IAAAW,KAAA,gBAAAA,EACI,OAAO,CAAQtC,MAAAqC,EAAc,SAASrC,EAAK,eAAe,OAD9D,gBAAA2B,EAEI;AAAA,IACA,CAAC,EAAE,iBAAAY,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,CACnChE,GACAiE,GACAC,IAA2B,OACd;AACb,QAAMC,IAAgB,CAAA;AAEtB,MAAI,CAACnE,KAAeA,EAAY,WAAW,UAAU,CAAA;AAErD,WAASoE,IAAI,GAAGA,IAAIpE,EAAY,QAAQoE,KAAK;AACrC,UAAA/C,IAAOrB,EAAYoE,CAAC;AAEtB,QAAA/C,KAAQA,EAAK,wBAAwB4C,MACzBE,EAAA,KAAK9C,EAAK,eAAe,GACnC6C;AAAiB;AAAA,EAEzB;AAEO,SAAAA,IAAmBC,EAAc,CAAC,IAAI,CAACA,EAAc,CAAC,CAAC,IAAI,CAAM,IAAAA;AAC1E;"}
|
|
1
|
+
{"version":3,"file":"helper.js","sources":["../../../src/features/trial-session/helper.ts"],"sourcesContent":["import type { IMilestoneConfig } from '../milestone/create/milestone-create-types';\nimport type { TPreference } from './comps/class-preference/class-preference-types';\nimport type { ITrialHomeData, TGoals } from './trial-session-types';\n\nimport { 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 { TEACHER_TIMEZONE, TrialPageId } from './trial-session-constants';\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 publish: false,\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\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 } = 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: 'ONLINE',\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(({ preference_code, preference_name, preference_category }) => ({\n preference_code,\n preference_name,\n preference_category,\n })) || []\n );\n }\n\n return [];\n};\n\nexport {\n filterAndUpdateSlideNavigation,\n updateGoalInFormData,\n getFormattedPreferences,\n getFormattedStudentPersonalizedPreference,\n};\n"],"names":["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","filterAndUpdateSlideNavigation","milestoneConfigData","trialHomeData","grade","student","demoInfo","studentGrade","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","pref","preference_code","preference_name","preference_category"],"mappings":";;;;;AAeA,MAAMA,IAAuB,CAACC,GAA6BC,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C/E,MAFA,gBAAAD,EAEG,WACH;AAGJ,MAAII,KAAuBN,GAAiB;AAC1C,UAAMO,IAAoB,CAACC,MACxBd,EAAc,WAAW,KAAKc,MAAYL,EAAY,aACtDP,EAAgB,WAAW,KAAKY,MAAYL,EAAY,oBAErDM,IAAiBZ,EAAqB,MAAM,OAAO,OAAQ,CAACU,EAAkBR,EAAK,EAAE,CAAC;AAEvE,IAAAF,EAAA,QAAQY,EAAe,IAAI,CAAQV,MAAA;;AAClD,aAAAA,EAAK,OAAOC,IACP,EAAE,GAAGD,GAAM,UAAUO,EAAoB,IAG9CP,EAAK,OAAOO,EAAoB,SAC3B;AAAA,QACL,GAAGP;AAAA,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,GAEMa,IAA4C,CAChDC,GACAC,MACG;;AACG,QAAA,EAAE,mBAAmBC,EAAqB,IAAAF;AAE5C,SAAAC,EAAc,SAAS,MAEvBV,IAAAW,KAAA,gBAAAA,EACI,OAAO,CAAQC,MAAAF,EAAc,SAASE,EAAK,eAAe,OAD9D,gBAAAZ,EAEI,IAAI,CAAC,EAAE,iBAAAa,GAAiB,iBAAAC,GAAiB,qBAAAC,SAA2B;AAAA,IACpE,iBAAAF;AAAA,IACA,iBAAAC;AAAA,IACA,qBAAAC;AAAA,EAAA,QACK,CAAA,IAIN;AACT;"}
|
|
@@ -1,206 +1,187 @@
|
|
|
1
|
-
import { useCallback as
|
|
2
|
-
import { COURSE_STREAMS as
|
|
3
|
-
import { useMilestoneBulkPost as
|
|
4
|
-
import { usePostStudentPreferences as
|
|
5
|
-
import { usePatchStudentInformation as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
const ge = () => {
|
|
1
|
+
import { useCallback as d, useEffect as q } from "react";
|
|
2
|
+
import { COURSE_STREAMS as J } from "../../milestone/constants.js";
|
|
3
|
+
import { useMilestoneBulkPost as Q } from "../../milestone/create/api/milestone-bulk.js";
|
|
4
|
+
import { usePostStudentPreferences as X } from "../api/course-stream.js";
|
|
5
|
+
import { usePatchStudentInformation as Y } from "../api/student-information.js";
|
|
6
|
+
import { usePatchTrialHome as $ } from "../api/trial-home.js";
|
|
7
|
+
import { useTrialSessionContext as ee } from "../context/use-trial-session-context.js";
|
|
8
|
+
import { getFormattedPreferences as te, getFormattedStudentPersonalizedPreference as oe } from "../helper.js";
|
|
9
|
+
import { DEFAULT_BUTTON_STATE as S, TrialPageId as e } from "../trial-session-constants.js";
|
|
10
|
+
import B from "../../../node_modules/uuid/dist/esm-browser/v4.js";
|
|
11
|
+
const fe = () => {
|
|
13
12
|
const {
|
|
14
13
|
updateSlideConfig: s,
|
|
15
|
-
slideConfig:
|
|
16
|
-
formData:
|
|
17
|
-
updateButtonState:
|
|
14
|
+
slideConfig: H,
|
|
15
|
+
formData: w,
|
|
16
|
+
updateButtonState: n,
|
|
18
17
|
teacherId: l,
|
|
19
|
-
studentId:
|
|
20
|
-
milestoneConfig:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
goals: R,
|
|
18
|
+
studentId: a,
|
|
19
|
+
milestoneConfig: N,
|
|
20
|
+
onTrialInformationUpdate: h,
|
|
21
|
+
trialHomeData: K,
|
|
22
|
+
worksheetNavigationPanel: I
|
|
23
|
+
} = ee(), { nextPage: Z, id: r } = H || {}, { demo_info: W } = K, { stream: P, region_data: V } = W, { opportunity_country: C = "US" } = V || {}, { pageId: i } = Z || {}, {
|
|
24
|
+
name: m,
|
|
25
|
+
grade: p,
|
|
26
|
+
goals: g,
|
|
29
27
|
curriculum: E,
|
|
30
|
-
studentTimezone:
|
|
31
|
-
preferences:
|
|
32
|
-
personalizedLevel:
|
|
33
|
-
personalizedFocus:
|
|
34
|
-
personalizedBehaviors:
|
|
35
|
-
personalizedObjectives:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
a("both", {
|
|
28
|
+
studentTimezone: T,
|
|
29
|
+
preferences: R = [],
|
|
30
|
+
personalizedLevel: A = [],
|
|
31
|
+
personalizedFocus: b = [],
|
|
32
|
+
personalizedBehaviors: O = [],
|
|
33
|
+
personalizedObjectives: v = []
|
|
34
|
+
} = w || {}, c = d(() => {
|
|
35
|
+
n("both", {
|
|
39
36
|
left: { isDisabled: !0, isLoading: !1 },
|
|
40
37
|
right: { isDisabled: !0, isLoading: !0 }
|
|
41
38
|
});
|
|
42
|
-
}, [
|
|
39
|
+
}, [n]), _ = (o) => {
|
|
43
40
|
if (!o) {
|
|
44
|
-
const
|
|
45
|
-
(i ===
|
|
41
|
+
const t = {};
|
|
42
|
+
(i === e.CIRCLE_GAME || i === e.CIRCLE_PUZZLE || i === e.CIRCLE_SKILL) && (t.matchmakingId = B(), t.showCircleGameScreen = !0), s({ id: i, ...t });
|
|
46
43
|
}
|
|
47
|
-
|
|
48
|
-
}, { patch:
|
|
49
|
-
onComplete:
|
|
50
|
-
}), { post:
|
|
51
|
-
onComplete:
|
|
52
|
-
}), { post:
|
|
53
|
-
onComplete:
|
|
54
|
-
}),
|
|
55
|
-
const
|
|
56
|
-
if (n.length > 0) {
|
|
57
|
-
const r = n.map(($) => $.reason).join(`
|
|
58
|
-
`);
|
|
59
|
-
P == null || P({ message: r, position: "bottom" }), a("both", p);
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const h = w(N, I);
|
|
63
|
-
h.length > 0 ? Q("trial-v3-patch", {
|
|
64
|
-
action: "UPDATE_DEMO",
|
|
65
|
-
action_data: {
|
|
66
|
-
trial_details: {
|
|
67
|
-
selected_regular_slots: h
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
teacher_id: l,
|
|
71
|
-
student_id: d
|
|
72
|
-
}) : a("both", p);
|
|
73
|
-
}, { post: F } = ne({
|
|
74
|
-
onComplete: X
|
|
75
|
-
}), M = u(() => {
|
|
76
|
-
const [o, e] = (f == null ? void 0 : f.split(" ")) || [], n = {
|
|
44
|
+
n("both", S), (r === e.STUDENT_INFORMATION || r === e.SCHOOL_GOALS) && (h == null || h());
|
|
45
|
+
}, { patch: k } = $({ onComplete: _ }), { patch: D } = Y({
|
|
46
|
+
onComplete: _
|
|
47
|
+
}), { post: G } = Q({
|
|
48
|
+
onComplete: _
|
|
49
|
+
}), { post: M } = X({
|
|
50
|
+
onComplete: _
|
|
51
|
+
}), U = d(() => {
|
|
52
|
+
const [o, t] = (m == null ? void 0 : m.split(" ")) || [], u = {
|
|
77
53
|
first_name: o,
|
|
78
|
-
last_name:
|
|
79
|
-
grade:
|
|
54
|
+
last_name: t,
|
|
55
|
+
grade: p,
|
|
80
56
|
board: E,
|
|
81
57
|
demo_type: "TRIAL_V3",
|
|
82
58
|
teacher_id: l,
|
|
83
|
-
country_alpha_2:
|
|
59
|
+
country_alpha_2: C
|
|
84
60
|
};
|
|
85
|
-
/\d/.test(
|
|
61
|
+
/\d/.test(m || "") ? s({ numberInNameError: !0 }) : (c(), D(a, u));
|
|
86
62
|
}, [
|
|
87
|
-
|
|
88
|
-
|
|
63
|
+
m,
|
|
64
|
+
p,
|
|
89
65
|
E,
|
|
90
66
|
l,
|
|
91
|
-
|
|
67
|
+
C,
|
|
92
68
|
c,
|
|
93
69
|
s,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
]),
|
|
97
|
-
const o =
|
|
70
|
+
D,
|
|
71
|
+
a
|
|
72
|
+
]), x = d(() => {
|
|
73
|
+
const o = te(R, T);
|
|
98
74
|
if (o.length > 0) {
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
75
|
+
const t = {
|
|
76
|
+
trial_details: {
|
|
77
|
+
selected_regular_slots: o
|
|
78
|
+
}
|
|
102
79
|
};
|
|
103
|
-
c(),
|
|
80
|
+
c(), k("trial-v3-patch", {
|
|
81
|
+
action: "UPDATE_DEMO",
|
|
82
|
+
action_data: t,
|
|
83
|
+
teacher_id: l,
|
|
84
|
+
student_id: a
|
|
85
|
+
});
|
|
104
86
|
} else
|
|
105
|
-
s({ id: i }),
|
|
87
|
+
s({ id: i }), n("both", S);
|
|
106
88
|
}, [
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
l,
|
|
110
|
-
F,
|
|
89
|
+
R,
|
|
90
|
+
T,
|
|
111
91
|
c,
|
|
92
|
+
k,
|
|
93
|
+
l,
|
|
94
|
+
a,
|
|
112
95
|
s,
|
|
113
96
|
i,
|
|
114
|
-
|
|
115
|
-
]),
|
|
97
|
+
n
|
|
98
|
+
]), y = d(() => {
|
|
116
99
|
const o = {
|
|
117
|
-
course_stream:
|
|
118
|
-
grade:
|
|
100
|
+
course_stream: P,
|
|
101
|
+
grade: p,
|
|
119
102
|
teacher_id: l,
|
|
120
103
|
board: E,
|
|
121
|
-
goals:
|
|
104
|
+
goals: g
|
|
122
105
|
};
|
|
123
|
-
c(),
|
|
124
|
-
studentId:
|
|
106
|
+
c(), G(o, {
|
|
107
|
+
studentId: a
|
|
125
108
|
});
|
|
126
109
|
}, [
|
|
127
110
|
E,
|
|
128
111
|
c,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
112
|
+
g,
|
|
113
|
+
p,
|
|
114
|
+
G,
|
|
115
|
+
P,
|
|
116
|
+
a,
|
|
134
117
|
l
|
|
135
|
-
]),
|
|
136
|
-
const
|
|
137
|
-
...
|
|
138
|
-
...
|
|
139
|
-
...
|
|
140
|
-
...
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
c(), x(e, n);
|
|
118
|
+
]), z = d(() => {
|
|
119
|
+
const t = { preferences: oe(N, [
|
|
120
|
+
...A,
|
|
121
|
+
...b,
|
|
122
|
+
...O,
|
|
123
|
+
...v
|
|
124
|
+
]) }, u = { stream: J.MATH, studentId: a };
|
|
125
|
+
c(), M(t, u);
|
|
144
126
|
}, [
|
|
127
|
+
c,
|
|
128
|
+
N,
|
|
129
|
+
O,
|
|
145
130
|
b,
|
|
131
|
+
A,
|
|
132
|
+
M,
|
|
146
133
|
v,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
O,
|
|
151
|
-
d,
|
|
152
|
-
c,
|
|
153
|
-
x
|
|
154
|
-
]), C = u(
|
|
155
|
-
(o, e) => {
|
|
134
|
+
a
|
|
135
|
+
]), L = d(
|
|
136
|
+
(o, t) => {
|
|
156
137
|
if (!s) return;
|
|
157
|
-
const
|
|
158
|
-
if ((
|
|
159
|
-
id:
|
|
160
|
-
...
|
|
161
|
-
...
|
|
138
|
+
const u = r === e.STUDENT_PROFILE, F = r === e.LEARNING_PLAN, f = {};
|
|
139
|
+
if ((t === e.CIRCLE_GAME || t === e.CIRCLE_PUZZLE || t === e.CIRCLE_SKILL) && (f.matchmakingId = B(), f.showCircleGameScreen = !0), o === "prev" && (s({
|
|
140
|
+
id: t,
|
|
141
|
+
...u && { studentProfile: void 0 },
|
|
142
|
+
...F && {
|
|
162
143
|
chapterId: void 0
|
|
163
144
|
},
|
|
164
|
-
...
|
|
165
|
-
}),
|
|
166
|
-
switch (
|
|
167
|
-
case
|
|
168
|
-
case
|
|
169
|
-
|
|
145
|
+
...f
|
|
146
|
+
}), n("both", S)), o === "next")
|
|
147
|
+
switch (r) {
|
|
148
|
+
case e.STUDENT_INFORMATION:
|
|
149
|
+
case e.SCHOOL_GOALS:
|
|
150
|
+
U();
|
|
170
151
|
break;
|
|
171
|
-
case
|
|
172
|
-
|
|
152
|
+
case e.LEARNING_WORKSHEET:
|
|
153
|
+
y();
|
|
173
154
|
break;
|
|
174
|
-
case
|
|
175
|
-
|
|
155
|
+
case e.CLASS_PREFERENCE:
|
|
156
|
+
x();
|
|
176
157
|
break;
|
|
177
|
-
case
|
|
178
|
-
|
|
158
|
+
case e.LEARNING_LEVEL:
|
|
159
|
+
z();
|
|
179
160
|
break;
|
|
180
|
-
case
|
|
181
|
-
s({ id:
|
|
161
|
+
case e.LEARNING_PLAN:
|
|
162
|
+
s({ id: t, chapterId: void 0, ...f });
|
|
182
163
|
break;
|
|
183
164
|
default:
|
|
184
|
-
s({ id:
|
|
165
|
+
s({ id: t, ...f }), n("both", S);
|
|
185
166
|
}
|
|
186
167
|
},
|
|
187
168
|
[
|
|
188
169
|
s,
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
M,
|
|
192
|
-
B,
|
|
170
|
+
r,
|
|
171
|
+
n,
|
|
193
172
|
U,
|
|
194
|
-
|
|
173
|
+
y,
|
|
174
|
+
x,
|
|
175
|
+
z
|
|
195
176
|
]
|
|
196
|
-
),
|
|
197
|
-
!
|
|
198
|
-
}, [
|
|
199
|
-
return
|
|
200
|
-
|
|
201
|
-
}, [
|
|
177
|
+
), j = d(() => {
|
|
178
|
+
!I && r === e.LEARNING_WORKSHEET && L("next", i);
|
|
179
|
+
}, [r, L, i, I]);
|
|
180
|
+
return q(() => {
|
|
181
|
+
j();
|
|
182
|
+
}, [I]), { handleNavigation: L };
|
|
202
183
|
};
|
|
203
184
|
export {
|
|
204
|
-
|
|
185
|
+
fe as useTrialSessionNavigation
|
|
205
186
|
};
|
|
206
187
|
//# sourceMappingURL=use-trial-session-navigation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-trial-session-navigation.js","sources":["../../../../src/features/trial-session/hooks/use-trial-session-navigation.ts"],"sourcesContent":["import type { TTeacherAvailabilityResponse } from '../api/teacher-availability';\nimport type { ITrialSessionFormFields } from '../trial-session-types';\n\nimport { useCallback, useEffect } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport { COURSE_STREAMS } from '../../milestone/constants';\nimport { useMilestoneBulkPost } from '../../milestone/create/api/milestone-bulk';\nimport { usePostStudentPreferences } from '../api/course-stream';\nimport { usePatchStudentInformation } from '../api/student-information';\nimport { usePostTeacherAvailability } from '../api/teacher-availability';\nimport { usePatchTrialHome } from '../api/trial-home';\nimport { useTrialSessionContext } from '../context/use-trial-session-context';\nimport {\n getFormattedPreferences,\n getFormattedStudentPersonalizedPreference,\n getWeekdayAndStartTimeFromPreference,\n} from '../helper';\nimport { DEFAULT_BUTTON_STATE, TrialPageId } from '../trial-session-constants';\n\nconst useTrialSessionNavigation = () => {\n const {\n updateSlideConfig,\n slideConfig,\n formData,\n updateButtonState,\n teacherId,\n studentId,\n milestoneConfig,\n handleInfoMessage,\n onTrialInformationUpdate,\n trialHomeData,\n worksheetNavigationPanel,\n } = useTrialSessionContext();\n const { nextPage, id: currentPageId } = slideConfig || {};\n const { demo_info: demoInfo } = trialHomeData;\n const { stream, region_data: regionData } = demoInfo;\n const { opportunity_country: countryCode = 'US' } = regionData || {};\n const { pageId: nextPageId } = nextPage || {};\n const {\n name,\n grade,\n goals,\n curriculum,\n studentTimezone = 'Asia/Calcutta',\n preferences = [],\n personalizedLevel = [],\n personalizedFocus = [],\n personalizedBehaviors = [],\n personalizedObjectives = [],\n personalizedPosition = [],\n } = formData || {};\n\n const disableNavButtons = useCallback(() => {\n updateButtonState('both', {\n left: { isDisabled: true, isLoading: false },\n right: { isDisabled: true, isLoading: true },\n });\n }, [updateButtonState]);\n\n const onAcknowledge = (errorMessage: string | null) => {\n if (!errorMessage) {\n const overrides: Partial<ITrialSessionFormFields> = {};\n\n if (\n nextPageId === TrialPageId.CIRCLE_GAME ||\n nextPageId === TrialPageId.CIRCLE_PUZZLE ||\n nextPageId === TrialPageId.CIRCLE_SKILL\n ) {\n overrides.matchmakingId = uuidv4();\n overrides.showCircleGameScreen = true;\n }\n\n updateSlideConfig({ id: nextPageId, ...overrides });\n }\n updateButtonState('both', DEFAULT_BUTTON_STATE);\n\n if (currentPageId === TrialPageId.LEARNING_LEVEL) {\n onTrialInformationUpdate?.();\n }\n };\n\n // API specifications\n const { patch: patchTrialSession } = usePatchTrialHome({ onComplete: onAcknowledge });\n const { patch: patchStudentInformation } = usePatchStudentInformation({\n onComplete: onAcknowledge,\n });\n const { post: postMilestoneBulk } = useMilestoneBulkPost({\n onComplete: onAcknowledge,\n });\n const { post: postStudentPreferences } = usePostStudentPreferences({\n onComplete: onAcknowledge,\n });\n\n const onTeacherAvailabilityValidate = (_: string | null, data?: TTeacherAvailabilityResponse) => {\n const notAvailable = data?.filter(item => !item.is_available) ?? [];\n\n if (notAvailable.length > 0) {\n const reason = notAvailable.map(item => item.reason).join('\\n');\n\n handleInfoMessage?.({ message: reason, position: 'bottom' });\n updateButtonState('both', DEFAULT_BUTTON_STATE);\n\n return;\n }\n\n const selectedRegularSlots = getFormattedPreferences(preferences, studentTimezone);\n\n if (selectedRegularSlots.length > 0) {\n const actionData = {\n trial_details: {\n selected_regular_slots: selectedRegularSlots,\n },\n };\n\n patchTrialSession('trial-v3-patch', {\n action: 'UPDATE_DEMO',\n action_data: actionData,\n teacher_id: teacherId,\n student_id: studentId,\n });\n } else updateButtonState('both', DEFAULT_BUTTON_STATE);\n };\n\n const { post: postTeacherAvailability } = usePostTeacherAvailability({\n onComplete: onTeacherAvailabilityValidate,\n });\n\n // Function to call API and updates states\n const handleStudentInformation = useCallback(() => {\n const [firstName, lastName] = name?.split(' ') || [];\n const payload = {\n first_name: firstName,\n last_name: lastName,\n grade,\n board: curriculum,\n demo_type: 'TRIAL_V3',\n teacher_id: teacherId,\n country_alpha_2: countryCode,\n };\n const isNumberExistsInName = /\\d/.test(name || '');\n\n if (isNumberExistsInName) {\n updateSlideConfig({ numberInNameError: true });\n } else {\n disableNavButtons();\n patchStudentInformation(studentId, payload);\n }\n }, [\n name,\n grade,\n curriculum,\n teacherId,\n countryCode,\n disableNavButtons,\n updateSlideConfig,\n patchStudentInformation,\n studentId,\n ]);\n\n const handleClassPreferences = useCallback(() => {\n const selectedRegularSlots = getFormattedPreferences(preferences, studentTimezone);\n const sessionList = getWeekdayAndStartTimeFromPreference(selectedRegularSlots);\n\n if (selectedRegularSlots.length > 0) {\n const availabilityPayload = {\n teacher_id: teacherId,\n session_list: sessionList,\n };\n\n disableNavButtons();\n postTeacherAvailability(availabilityPayload);\n } else {\n updateSlideConfig({ id: nextPageId });\n updateButtonState('both', DEFAULT_BUTTON_STATE);\n }\n }, [\n preferences,\n studentTimezone,\n teacherId,\n postTeacherAvailability,\n disableNavButtons,\n updateSlideConfig,\n nextPageId,\n updateButtonState,\n ]);\n\n const handleMileStoneBulkPost = useCallback(() => {\n const payload = {\n course_stream: stream,\n grade,\n teacher_id: teacherId,\n board: curriculum,\n goals,\n };\n\n disableNavButtons();\n postMilestoneBulk(payload, {\n studentId,\n });\n }, [\n curriculum,\n disableNavButtons,\n goals,\n grade,\n postMilestoneBulk,\n stream,\n studentId,\n teacherId,\n ]);\n\n const handleStudentPreferencesPatch = useCallback(() => {\n const personalizedPreferences = getFormattedStudentPersonalizedPreference(milestoneConfig, [\n ...personalizedLevel,\n ...personalizedFocus,\n ...personalizedBehaviors,\n ...personalizedObjectives,\n ...personalizedPosition,\n ]);\n\n const payload = { preferences: personalizedPreferences };\n const meta = { stream: COURSE_STREAMS.MATH, studentId };\n\n disableNavButtons();\n postStudentPreferences(payload, meta);\n }, [\n milestoneConfig,\n personalizedLevel,\n personalizedFocus,\n personalizedBehaviors,\n personalizedObjectives,\n personalizedPosition,\n studentId,\n disableNavButtons,\n postStudentPreferences,\n ]);\n\n // Navigation logic\n const handleNavigation = useCallback(\n (dir: string, id?: string) => {\n if (!updateSlideConfig) return;\n\n const isStudentProfilePage = currentPageId === TrialPageId.STUDENT_PROFILE;\n const isLearningPlanSlide = currentPageId === TrialPageId.LEARNING_PLAN;\n const overrides: Partial<ITrialSessionFormFields> = {};\n\n if (\n id === TrialPageId.CIRCLE_GAME ||\n id === TrialPageId.CIRCLE_PUZZLE ||\n id === TrialPageId.CIRCLE_SKILL\n ) {\n overrides.matchmakingId = uuidv4();\n overrides.showCircleGameScreen = true;\n }\n\n if (dir === 'prev') {\n updateSlideConfig({\n id,\n ...(isStudentProfilePage && { studentProfile: undefined }),\n ...(isLearningPlanSlide && {\n chapterId: undefined,\n }),\n ...overrides,\n });\n updateButtonState('both', DEFAULT_BUTTON_STATE);\n }\n\n if (dir === 'next') {\n switch (currentPageId) {\n //TODO: remove STUDENT_INFORMATION\n case TrialPageId.STUDENT_INFORMATION:\n case TrialPageId.SCHOOL_GOALS:\n handleStudentInformation();\n break;\n case TrialPageId.LEARNING_WORKSHEET:\n handleMileStoneBulkPost();\n break;\n case TrialPageId.CLASS_PREFERENCE:\n handleClassPreferences();\n break;\n case TrialPageId.LEARNING_LEVEL:\n handleStudentPreferencesPatch();\n break;\n case TrialPageId.LEARNING_PLAN:\n updateSlideConfig({ id, chapterId: undefined, ...overrides });\n break;\n default: {\n updateSlideConfig({ id, ...overrides });\n updateButtonState('both', DEFAULT_BUTTON_STATE);\n }\n }\n }\n },\n [\n updateSlideConfig,\n currentPageId,\n updateButtonState,\n handleStudentInformation,\n handleMileStoneBulkPost,\n handleClassPreferences,\n handleStudentPreferencesPatch,\n ],\n );\n\n const sessionWorksheetNavigation = useCallback(() => {\n if (!worksheetNavigationPanel && currentPageId === TrialPageId.LEARNING_WORKSHEET) {\n handleNavigation('next', nextPageId);\n }\n }, [currentPageId, handleNavigation, nextPageId, worksheetNavigationPanel]);\n\n useEffect(() => {\n sessionWorksheetNavigation();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [worksheetNavigationPanel]);\n\n return { handleNavigation };\n};\n\nexport { useTrialSessionNavigation };\n"],"names":["useTrialSessionNavigation","updateSlideConfig","slideConfig","formData","updateButtonState","teacherId","studentId","milestoneConfig","handleInfoMessage","onTrialInformationUpdate","trialHomeData","worksheetNavigationPanel","useTrialSessionContext","nextPage","currentPageId","demoInfo","stream","regionData","countryCode","nextPageId","name","grade","goals","curriculum","studentTimezone","preferences","personalizedLevel","personalizedFocus","personalizedBehaviors","personalizedObjectives","personalizedPosition","disableNavButtons","useCallback","onAcknowledge","errorMessage","overrides","TrialPageId","uuidv4","DEFAULT_BUTTON_STATE","patchTrialSession","usePatchTrialHome","patchStudentInformation","usePatchStudentInformation","postMilestoneBulk","useMilestoneBulkPost","postStudentPreferences","usePostStudentPreferences","onTeacherAvailabilityValidate","_","data","notAvailable","item","reason","selectedRegularSlots","getFormattedPreferences","postTeacherAvailability","usePostTeacherAvailability","handleStudentInformation","firstName","lastName","payload","handleClassPreferences","sessionList","getWeekdayAndStartTimeFromPreference","availabilityPayload","handleMileStoneBulkPost","handleStudentPreferencesPatch","getFormattedStudentPersonalizedPreference","meta","COURSE_STREAMS","handleNavigation","dir","id","isStudentProfilePage","isLearningPlanSlide","sessionWorksheetNavigation","useEffect"],"mappings":";;;;;;;;;;;AAoBA,MAAMA,KAA4B,MAAM;AAChC,QAAA;AAAA,IACJ,mBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,UAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,eAAAC;AAAA,IACA,0BAAAC;AAAA,MACEC,GAAuB,GACrB,EAAE,UAAAC,GAAU,IAAIC,EAAc,IAAIZ,KAAe,CAAA,GACjD,EAAE,WAAWa,EAAa,IAAAL,GAC1B,EAAE,QAAAM,GAAQ,aAAaC,EAAA,IAAeF,GACtC,EAAE,qBAAqBG,IAAc,KAAK,IAAID,KAAc,CAAA,GAC5D,EAAE,QAAQE,MAAeN,KAAY,CAAA,GACrC;AAAA,IACJ,MAAAO;AAAA,IACA,OAAAC;AAAA,IACA,OAAAC;AAAA,IACA,YAAAC;AAAA,IACA,iBAAAC,IAAkB;AAAA,IAClB,aAAAC,IAAc,CAAC;AAAA,IACf,mBAAAC,IAAoB,CAAC;AAAA,IACrB,mBAAAC,IAAoB,CAAC;AAAA,IACrB,uBAAAC,IAAwB,CAAC;AAAA,IACzB,wBAAAC,IAAyB,CAAC;AAAA,IAC1B,sBAA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,EAAY,iBACnBoC,MAAOpC,EAAY,kBAEnBD,EAAU,gBAAgBE,KAC1BF,EAAU,uBAAuB,KAG/BoC,MAAQ,WACQtE,EAAA;AAAA,QAChB,IAAAuE;AAAA,QACA,GAAIC,KAAwB,EAAE,gBAAgB,OAAU;AAAA,QACxD,GAAIC,KAAuB;AAAA,UACzB,WAAW;AAAA,QACb;AAAA,QACA,GAAGvC;AAAA,MAAA,CACJ,GACD/B,EAAkB,QAAQkC,CAAoB,IAG5CiC,MAAQ;AACV,gBAAQzD,GAAe;AAAA,UAErB,KAAKsB,EAAY;AAAA,UACjB,KAAKA,EAAY;AACU,YAAAqB;AACzB;AAAA,UACF,KAAKrB,EAAY;AACS,YAAA6B;AACxB;AAAA,UACF,KAAK7B,EAAY;AACQ,YAAAyB;AACvB;AAAA,UACF,KAAKzB,EAAY;AACe,YAAA8B;AAC9B;AAAA,UACF,KAAK9B,EAAY;AACf,YAAAnC,EAAkB,EAAE,IAAAuE,GAAI,WAAW,QAAW,GAAGrC,GAAW;AAC5D;AAAA,UACF;AACE,YAAAlC,EAAkB,EAAE,IAAAuE,GAAI,GAAGrC,EAAW,CAAA,GACtC/B,EAAkB,QAAQkC,CAAoB;AAAA,QAElD;AAAA,IAEJ;AAAA,IACA;AAAA,MACErC;AAAA,MACAa;AAAA,MACAV;AAAA,MACAqD;AAAA,MACAQ;AAAA,MACAJ;AAAA,MACAK;AAAA,IACF;AAAA,EAAA,GAGIS,IAA6B3C,EAAY,MAAM;AACnD,IAAI,CAACrB,KAA4BG,MAAkBsB,EAAY,sBAC7DkC,EAAiB,QAAQnD,CAAU;AAAA,KAEpC,CAACL,GAAewD,GAAkBnD,GAAYR,CAAwB,CAAC;AAE1E,SAAAiE,GAAU,MAAM;AACa,IAAAD;EAAA,GAE1B,CAAChE,CAAwB,CAAC,GAEtB,EAAE,kBAAA2D,EAAiB;AAC5B;"}
|
|
1
|
+
{"version":3,"file":"use-trial-session-navigation.js","sources":["../../../../src/features/trial-session/hooks/use-trial-session-navigation.ts"],"sourcesContent":["import type { ITrialSessionFormFields } from '../trial-session-types';\n\nimport { useCallback, useEffect } from 'react';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport { COURSE_STREAMS } from '../../milestone/constants';\nimport { useMilestoneBulkPost } from '../../milestone/create/api/milestone-bulk';\nimport { usePostStudentPreferences } from '../api/course-stream';\nimport { usePatchStudentInformation } from '../api/student-information';\nimport { usePatchTrialHome } from '../api/trial-home';\nimport { useTrialSessionContext } from '../context/use-trial-session-context';\nimport { getFormattedPreferences, getFormattedStudentPersonalizedPreference } from '../helper';\nimport { DEFAULT_BUTTON_STATE, TrialPageId } from '../trial-session-constants';\n\nconst useTrialSessionNavigation = () => {\n const {\n updateSlideConfig,\n slideConfig,\n formData,\n updateButtonState,\n teacherId,\n studentId,\n milestoneConfig,\n onTrialInformationUpdate,\n trialHomeData,\n worksheetNavigationPanel,\n } = useTrialSessionContext();\n const { nextPage, id: currentPageId } = slideConfig || {};\n const { demo_info: demoInfo } = trialHomeData;\n const { stream, region_data: regionData } = demoInfo;\n const { opportunity_country: countryCode = 'US' } = regionData || {};\n const { pageId: nextPageId } = nextPage || {};\n const {\n name,\n grade,\n goals,\n curriculum,\n studentTimezone,\n preferences = [],\n personalizedLevel = [],\n personalizedFocus = [],\n personalizedBehaviors = [],\n personalizedObjectives = [],\n } = formData || {};\n\n const disableNavButtons = useCallback(() => {\n updateButtonState('both', {\n left: { isDisabled: true, isLoading: false },\n right: { isDisabled: true, isLoading: true },\n });\n }, [updateButtonState]);\n\n const onAcknowledge = (errorMessage: string | null) => {\n if (!errorMessage) {\n const overrides: Partial<ITrialSessionFormFields> = {};\n\n if (\n nextPageId === TrialPageId.CIRCLE_GAME ||\n nextPageId === TrialPageId.CIRCLE_PUZZLE ||\n nextPageId === TrialPageId.CIRCLE_SKILL\n ) {\n overrides.matchmakingId = uuidv4();\n overrides.showCircleGameScreen = true;\n }\n\n updateSlideConfig({ id: nextPageId, ...overrides });\n }\n updateButtonState('both', DEFAULT_BUTTON_STATE);\n\n if (\n currentPageId === TrialPageId.STUDENT_INFORMATION ||\n currentPageId === TrialPageId.SCHOOL_GOALS\n ) {\n //TODO: remove TrialPageId.STUDENT_INFORMATION\n onTrialInformationUpdate?.();\n }\n };\n\n // API specifications\n const { patch: patchTrialSession } = usePatchTrialHome({ onComplete: onAcknowledge });\n const { patch: patchStudentInformation } = usePatchStudentInformation({\n onComplete: onAcknowledge,\n });\n const { post: postMilestoneBulk } = useMilestoneBulkPost({\n onComplete: onAcknowledge,\n });\n const { post: postStudentPreferences } = usePostStudentPreferences({\n onComplete: onAcknowledge,\n });\n\n // Function to call API and updates states\n const handleStudentInformation = useCallback(() => {\n const [firstName, lastName] = name?.split(' ') || [];\n const payload = {\n first_name: firstName,\n last_name: lastName,\n grade,\n board: curriculum,\n demo_type: 'TRIAL_V3',\n teacher_id: teacherId,\n country_alpha_2: countryCode,\n };\n const isNumberExistsInName = /\\d/.test(name || '');\n\n if (isNumberExistsInName) {\n updateSlideConfig({ numberInNameError: true });\n } else {\n disableNavButtons();\n patchStudentInformation(studentId, payload);\n }\n }, [\n name,\n grade,\n curriculum,\n teacherId,\n countryCode,\n disableNavButtons,\n updateSlideConfig,\n patchStudentInformation,\n studentId,\n ]);\n\n const handleClassPreferences = useCallback(() => {\n const selectedRegularSlots = getFormattedPreferences(preferences, studentTimezone);\n\n if (selectedRegularSlots.length > 0) {\n const actionData = {\n trial_details: {\n selected_regular_slots: selectedRegularSlots,\n },\n };\n\n disableNavButtons();\n patchTrialSession('trial-v3-patch', {\n action: 'UPDATE_DEMO',\n action_data: actionData,\n teacher_id: teacherId,\n student_id: studentId,\n });\n } else {\n updateSlideConfig({ id: nextPageId });\n updateButtonState('both', DEFAULT_BUTTON_STATE);\n }\n }, [\n preferences,\n studentTimezone,\n disableNavButtons,\n patchTrialSession,\n teacherId,\n studentId,\n updateSlideConfig,\n nextPageId,\n updateButtonState,\n ]);\n\n const handleMileStoneBulkPost = useCallback(() => {\n const payload = {\n course_stream: stream,\n grade,\n teacher_id: teacherId,\n board: curriculum,\n goals,\n };\n\n disableNavButtons();\n postMilestoneBulk(payload, {\n studentId,\n });\n }, [\n curriculum,\n disableNavButtons,\n goals,\n grade,\n postMilestoneBulk,\n stream,\n studentId,\n teacherId,\n ]);\n\n const handleStudentPreferencesPatch = useCallback(() => {\n const personalizedPreferences = getFormattedStudentPersonalizedPreference(milestoneConfig, [\n ...personalizedLevel,\n ...personalizedFocus,\n ...personalizedBehaviors,\n ...personalizedObjectives,\n ]);\n\n const payload = { preferences: personalizedPreferences };\n const meta = { stream: COURSE_STREAMS.MATH, studentId };\n\n disableNavButtons();\n postStudentPreferences(payload, meta);\n }, [\n disableNavButtons,\n milestoneConfig,\n personalizedBehaviors,\n personalizedFocus,\n personalizedLevel,\n postStudentPreferences,\n personalizedObjectives,\n studentId,\n ]);\n\n // Navigation logic\n const handleNavigation = useCallback(\n (dir: string, id?: string) => {\n if (!updateSlideConfig) return;\n\n const isStudentProfilePage = currentPageId === TrialPageId.STUDENT_PROFILE;\n const isLearningPlanSlide = currentPageId === TrialPageId.LEARNING_PLAN;\n const overrides: Partial<ITrialSessionFormFields> = {};\n\n if (\n id === TrialPageId.CIRCLE_GAME ||\n id === TrialPageId.CIRCLE_PUZZLE ||\n id === TrialPageId.CIRCLE_SKILL\n ) {\n overrides.matchmakingId = uuidv4();\n overrides.showCircleGameScreen = true;\n }\n\n if (dir === 'prev') {\n updateSlideConfig({\n id,\n ...(isStudentProfilePage && { studentProfile: undefined }),\n ...(isLearningPlanSlide && {\n chapterId: undefined,\n }),\n ...overrides,\n });\n updateButtonState('both', DEFAULT_BUTTON_STATE);\n }\n\n if (dir === 'next') {\n switch (currentPageId) {\n //TODO: remove STUDENT_INFORMATION\n case TrialPageId.STUDENT_INFORMATION:\n case TrialPageId.SCHOOL_GOALS:\n handleStudentInformation();\n break;\n case TrialPageId.LEARNING_WORKSHEET:\n handleMileStoneBulkPost();\n break;\n case TrialPageId.CLASS_PREFERENCE:\n handleClassPreferences();\n break;\n case TrialPageId.LEARNING_LEVEL:\n handleStudentPreferencesPatch();\n break;\n case TrialPageId.LEARNING_PLAN:\n updateSlideConfig({ id, chapterId: undefined, ...overrides });\n break;\n default: {\n updateSlideConfig({ id, ...overrides });\n updateButtonState('both', DEFAULT_BUTTON_STATE);\n }\n }\n }\n },\n [\n updateSlideConfig,\n currentPageId,\n updateButtonState,\n handleStudentInformation,\n handleMileStoneBulkPost,\n handleClassPreferences,\n handleStudentPreferencesPatch,\n ],\n );\n\n const sessionWorksheetNavigation = useCallback(() => {\n if (!worksheetNavigationPanel && currentPageId === TrialPageId.LEARNING_WORKSHEET) {\n handleNavigation('next', nextPageId);\n }\n }, [currentPageId, handleNavigation, nextPageId, worksheetNavigationPanel]);\n\n useEffect(() => {\n sessionWorksheetNavigation();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [worksheetNavigationPanel]);\n\n return { handleNavigation };\n};\n\nexport { useTrialSessionNavigation };\n"],"names":["useTrialSessionNavigation","updateSlideConfig","slideConfig","formData","updateButtonState","teacherId","studentId","milestoneConfig","onTrialInformationUpdate","trialHomeData","worksheetNavigationPanel","useTrialSessionContext","nextPage","currentPageId","demoInfo","stream","regionData","countryCode","nextPageId","name","grade","goals","curriculum","studentTimezone","preferences","personalizedLevel","personalizedFocus","personalizedBehaviors","personalizedObjectives","disableNavButtons","useCallback","onAcknowledge","errorMessage","overrides","TrialPageId","uuidv4","DEFAULT_BUTTON_STATE","patchTrialSession","usePatchTrialHome","patchStudentInformation","usePatchStudentInformation","postMilestoneBulk","useMilestoneBulkPost","postStudentPreferences","usePostStudentPreferences","handleStudentInformation","firstName","lastName","payload","handleClassPreferences","selectedRegularSlots","getFormattedPreferences","actionData","handleMileStoneBulkPost","handleStudentPreferencesPatch","getFormattedStudentPersonalizedPreference","meta","COURSE_STREAMS","handleNavigation","dir","id","isStudentProfilePage","isLearningPlanSlide","sessionWorksheetNavigation","useEffect"],"mappings":";;;;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