@cuemath/leap 3.3.26-j.2 → 3.3.26-j.3
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/parent-dashboard/hooks/use-fetch-parent-home.js.map +1 -1
- package/dist/features/parent-dashboard/hooks/use-parent-home-data.js +1 -1
- package/dist/features/parent-dashboard/hooks/use-parent-home-data.js.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.js +7 -7
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-fetch-parent-home.js","sources":["../../../../src/features/parent-dashboard/hooks/use-fetch-parent-home.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo } from 'react';\n\nimport { useParentHomeGet } from '../api/parent-home';\n\nconst useFetchParentHome = (studentId: string) => {\n const {\n get: getParentHome,\n data,\n isStale,\n isProcessing,\n isProcessingFailed,\n } = useParentHomeGet(studentId);\n\n const fetchData = useCallback(() => {\n studentId && getParentHome(studentId);\n }, [getParentHome, studentId]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n useEffect(() => {\n if (isStale) {\n fetchData();\n }\n }, [fetchData, isStale]);\n\n const result = useMemo(\n () => ({\n isLoading: isProcessing && !data,\n isProcessingFailed,\n }),\n [isProcessing, data, isProcessingFailed],\n );\n\n return result;\n};\n\nexport default useFetchParentHome;\n"],"names":["useFetchParentHome","studentId","getParentHome","data","isStale","isProcessing","isProcessingFailed","useParentHomeGet","fetchData","useCallback","useEffect","useMemo","useFetchParentHome$1"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"use-fetch-parent-home.js","sources":["../../../../src/features/parent-dashboard/hooks/use-fetch-parent-home.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo } from 'react';\n\nimport { useParentHomeGet } from '../api/parent-home';\n\n/**\n * This hook is intended only for **triggering** the Parent Home API\n * if it's needed outside the Parent Router.\n * This hook is being called at the level of the Parent Dashboard: <ParentRoutesWrapper />\n * To **consume** the parent home data elsewhere in the app,\n * use the `useParentHomeData()` hook instead.\n */\n\nconst useFetchParentHome = (studentId: string) => {\n const {\n get: getParentHome,\n data,\n isStale,\n isProcessing,\n isProcessingFailed,\n } = useParentHomeGet(studentId);\n\n const fetchData = useCallback(() => {\n studentId && getParentHome(studentId);\n }, [getParentHome, studentId]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n useEffect(() => {\n if (isStale) {\n fetchData();\n }\n }, [fetchData, isStale]);\n\n const result = useMemo(\n () => ({\n isLoading: isProcessing && !data,\n isProcessingFailed,\n }),\n [isProcessing, data, isProcessingFailed],\n );\n\n return result;\n};\n\nexport default useFetchParentHome;\n"],"names":["useFetchParentHome","studentId","getParentHome","data","isStale","isProcessing","isProcessingFailed","useParentHomeGet","fetchData","useCallback","useEffect","useMemo","useFetchParentHome$1"],"mappings":";;AAYA,MAAMA,IAAqB,CAACC,MAAsB;AAC1C,QAAA;AAAA,IACJ,KAAKC;AAAA,IACL,MAAAC;AAAA,IACA,SAAAC;AAAA,IACA,cAAAC;AAAA,IACA,oBAAAC;AAAA,EAAA,IACEC,EAAiBN,CAAS,GAExBO,IAAYC,EAAY,MAAM;AAClC,IAAAR,KAAaC,EAAcD,CAAS;AAAA,EAAA,GACnC,CAACC,GAAeD,CAAS,CAAC;AAE7B,SAAAS,EAAU,MAAM;AACJ,IAAAF;EAAA,GACT,CAACA,CAAS,CAAC,GAEdE,EAAU,MAAM;AACd,IAAIN,KACQI;EACZ,GACC,CAACA,GAAWJ,CAAO,CAAC,GAERO;AAAA,IACb,OAAO;AAAA,MACL,WAAWN,KAAgB,CAACF;AAAA,MAC5B,oBAAAG;AAAA,IAAA;AAAA,IAEF,CAACD,GAAcF,GAAMG,CAAkB;AAAA,EAAA;AAI3C,GAEAM,IAAeZ;"}
|
|
@@ -22,7 +22,7 @@ const M = (_) => {
|
|
|
22
22
|
upcoming_sessions: m = [],
|
|
23
23
|
student_demo_id: T = "",
|
|
24
24
|
user_attempt_id: E = ""
|
|
25
|
-
} = i, S = o ? `${o.first_name || ""} ${o.last_name || ""}`.trim() : "", D = e === s.TRIAL_COMPLETED_CARD_DECLINED, L = e === s.NO_CARD_ON_FILE, A = f.includes(e), u = e === s.TRIAL_TUTOR_NO_SHOW, C = e === s.TRIAL_STUDENT_NO_SHOW, a = g.includes(e), p = a && e !== s.REGULAR_CLASS_COMPLETED, N = e === s.REGULAR_CLASS_COMPLETED, O = e === s.TRIAL_COMPLETED_PAYMENT_PENDING;
|
|
25
|
+
} = i ?? {}, S = o ? `${o.first_name || ""} ${o.last_name || ""}`.trim() : "", D = e === s.TRIAL_COMPLETED_CARD_DECLINED, L = e === s.NO_CARD_ON_FILE, A = f.includes(e), u = e === s.TRIAL_TUTOR_NO_SHOW, C = e === s.TRIAL_STUDENT_NO_SHOW, a = g.includes(e), p = a && e !== s.REGULAR_CLASS_COMPLETED, N = e === s.REGULAR_CLASS_COMPLETED, O = e === s.TRIAL_COMPLETED_PAYMENT_PENDING;
|
|
26
26
|
return {
|
|
27
27
|
plaState: e,
|
|
28
28
|
sessionDetails: i,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-parent-home-data.js","sources":["../../../../src/features/parent-dashboard/hooks/use-parent-home-data.ts"],"sourcesContent":["import type { IUseParentHomeDataReturn } from '../parent-dashboard-types';\n\nimport { useMemo } from 'react';\n\nimport { useParentHomeGet } from '../api/parent-home';\nimport {\n DEFAULT_LOADING_STATE,\n SUBSCRIPTION_CANCELLED_STATES,\n TRIAL_COMPLETED_STATES,\n} from '../parent-dashboard-constants';\nimport { EPLAState } from '../parent-dashboard-types';\n\nconst useParentHomeData = (studentId: string): IUseParentHomeDataReturn => {\n const { data: parentHomeData, isProcessingFailed } = useParentHomeGet(studentId);\n\n const parentHomeDataMemoised = useMemo(() => {\n if (!parentHomeData?.pla_state) {\n return {\n ...DEFAULT_LOADING_STATE,\n isProcessingFailed,\n };\n }\n\n const {\n teacher_details: teacherDetails,\n session_details: sessionDetails,\n pla_state: plaState,\n billing_details: billingDetails,\n } = parentHomeData;\n\n const {\n completed_sessions: completedSessions = 0,\n next_session_end: nextSessionEnd = 0,\n next_session_start: nextSessionStart = 0,\n upcoming_sessions: upcomingSessions = [],\n student_demo_id: demoId = '',\n user_attempt_id: userAttemptId = '',\n } = sessionDetails;\n\n const teacherName = teacherDetails\n ? `${teacherDetails.first_name || ''} ${teacherDetails.last_name || ''}`.trim()\n : '';\n\n const isCardDeclined = plaState === EPLAState.TRIAL_COMPLETED_CARD_DECLINED;\n const cardOnFileNotAvailable = plaState === EPLAState.NO_CARD_ON_FILE;\n const isSubscriptionCancelled = SUBSCRIPTION_CANCELLED_STATES.includes(plaState);\n\n const isTutorNoShow = plaState === EPLAState.TRIAL_TUTOR_NO_SHOW;\n const isStudentNoShow = plaState === EPLAState.TRIAL_STUDENT_NO_SHOW;\n const isTrialDone = TRIAL_COMPLETED_STATES.includes(plaState);\n const isOnlyTrialDone = isTrialDone && plaState !== EPLAState.REGULAR_CLASS_COMPLETED;\n const isRegularClassDone = plaState === EPLAState.REGULAR_CLASS_COMPLETED;\n\n const canChangeTutor = plaState === EPLAState.TRIAL_COMPLETED_PAYMENT_PENDING;\n\n return {\n plaState,\n sessionDetails,\n teacherDetails,\n billingDetails,\n teacherName,\n completedSessions,\n nextSessionEnd,\n nextSessionStart,\n upcomingSessions,\n isTrialDone,\n isOnlyTrialDone,\n isRegularClassDone,\n isCardDeclined,\n isSubscriptionCancelled,\n cardOnFileNotAvailable,\n isTutorNoShow,\n isStudentNoShow,\n showLoading: false,\n demoId,\n userAttemptId,\n isProcessingFailed: false,\n canChangeTutor,\n };\n }, [parentHomeData, isProcessingFailed]);\n\n return parentHomeDataMemoised;\n};\n\nexport default useParentHomeData;\n"],"names":["useParentHomeData","studentId","parentHomeData","isProcessingFailed","useParentHomeGet","useMemo","DEFAULT_LOADING_STATE","teacherDetails","sessionDetails","plaState","billingDetails","completedSessions","nextSessionEnd","nextSessionStart","upcomingSessions","demoId","userAttemptId","teacherName","isCardDeclined","EPLAState","cardOnFileNotAvailable","isSubscriptionCancelled","SUBSCRIPTION_CANCELLED_STATES","isTutorNoShow","isStudentNoShow","isTrialDone","TRIAL_COMPLETED_STATES","isOnlyTrialDone","isRegularClassDone","canChangeTutor","useParentHomeData$1"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"use-parent-home-data.js","sources":["../../../../src/features/parent-dashboard/hooks/use-parent-home-data.ts"],"sourcesContent":["import type { IUseParentHomeDataReturn } from '../parent-dashboard-types';\n\nimport { useMemo } from 'react';\n\nimport { useParentHomeGet } from '../api/parent-home';\nimport {\n DEFAULT_LOADING_STATE,\n SUBSCRIPTION_CANCELLED_STATES,\n TRIAL_COMPLETED_STATES,\n} from '../parent-dashboard-constants';\nimport { EPLAState } from '../parent-dashboard-types';\n\n/**\n * Hook to consume processed parent home data.\n * - Automatically fetches on mount and when stale using useFetchParentHome() at <ParentRoutesWrapper/>.\n * - Use this to **read** parent home data.\n */\n\nconst useParentHomeData = (studentId: string): IUseParentHomeDataReturn => {\n const { data: parentHomeData, isProcessingFailed } = useParentHomeGet(studentId);\n\n const parentHomeDataMemoised = useMemo(() => {\n if (!parentHomeData?.pla_state) {\n return {\n ...DEFAULT_LOADING_STATE,\n isProcessingFailed,\n };\n }\n\n const {\n teacher_details: teacherDetails,\n session_details: sessionDetails,\n pla_state: plaState,\n billing_details: billingDetails,\n } = parentHomeData;\n\n const {\n completed_sessions: completedSessions = 0,\n next_session_end: nextSessionEnd = 0,\n next_session_start: nextSessionStart = 0,\n upcoming_sessions: upcomingSessions = [],\n student_demo_id: demoId = '',\n user_attempt_id: userAttemptId = '',\n } = sessionDetails ?? {};\n\n const teacherName = teacherDetails\n ? `${teacherDetails.first_name || ''} ${teacherDetails.last_name || ''}`.trim()\n : '';\n\n const isCardDeclined = plaState === EPLAState.TRIAL_COMPLETED_CARD_DECLINED;\n const cardOnFileNotAvailable = plaState === EPLAState.NO_CARD_ON_FILE;\n const isSubscriptionCancelled = SUBSCRIPTION_CANCELLED_STATES.includes(plaState);\n\n const isTutorNoShow = plaState === EPLAState.TRIAL_TUTOR_NO_SHOW;\n const isStudentNoShow = plaState === EPLAState.TRIAL_STUDENT_NO_SHOW;\n const isTrialDone = TRIAL_COMPLETED_STATES.includes(plaState);\n const isOnlyTrialDone = isTrialDone && plaState !== EPLAState.REGULAR_CLASS_COMPLETED;\n const isRegularClassDone = plaState === EPLAState.REGULAR_CLASS_COMPLETED;\n\n const canChangeTutor = plaState === EPLAState.TRIAL_COMPLETED_PAYMENT_PENDING;\n\n return {\n plaState,\n sessionDetails,\n teacherDetails,\n billingDetails,\n teacherName,\n completedSessions,\n nextSessionEnd,\n nextSessionStart,\n upcomingSessions,\n isTrialDone,\n isOnlyTrialDone,\n isRegularClassDone,\n isCardDeclined,\n isSubscriptionCancelled,\n cardOnFileNotAvailable,\n isTutorNoShow,\n isStudentNoShow,\n showLoading: false,\n demoId,\n userAttemptId,\n isProcessingFailed: false,\n canChangeTutor,\n };\n }, [parentHomeData, isProcessingFailed]);\n\n return parentHomeDataMemoised;\n};\n\nexport default useParentHomeData;\n"],"names":["useParentHomeData","studentId","parentHomeData","isProcessingFailed","useParentHomeGet","useMemo","DEFAULT_LOADING_STATE","teacherDetails","sessionDetails","plaState","billingDetails","completedSessions","nextSessionEnd","nextSessionStart","upcomingSessions","demoId","userAttemptId","teacherName","isCardDeclined","EPLAState","cardOnFileNotAvailable","isSubscriptionCancelled","SUBSCRIPTION_CANCELLED_STATES","isTutorNoShow","isStudentNoShow","isTrialDone","TRIAL_COMPLETED_STATES","isOnlyTrialDone","isRegularClassDone","canChangeTutor","useParentHomeData$1"],"mappings":";;;;AAkBA,MAAMA,IAAoB,CAACC,MAAgD;AACzE,QAAM,EAAE,MAAMC,GAAgB,oBAAAC,EAAmB,IAAIC,EAAiBH,CAAS;AAoExE,SAlEwBI,EAAQ,MAAM;AACvC,QAAA,EAACH,KAAA,QAAAA,EAAgB;AACZ,aAAA;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AAgBC,CAAkB,CAAC;AAGzC,GAEA2B,IAAe9B;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6892,6 +6892,13 @@ export declare const useClassTimeAlerts: ({ alertLevel, classStartedOn, classDur
|
|
|
6892
6892
|
|
|
6893
6893
|
export declare const useContextMenuClickHandler: IUseContextMenuClickHandler;
|
|
6894
6894
|
|
|
6895
|
+
/**
|
|
6896
|
+
* This hook is intended only for **triggering** the Parent Home API
|
|
6897
|
+
* if it's needed outside the Parent Router.
|
|
6898
|
+
* This hook is being called at the level of the Parent Dashboard: <ParentRoutesWrapper />
|
|
6899
|
+
* To **consume** the parent home data elsewhere in the app,
|
|
6900
|
+
* use the `useParentHomeData()` hook instead.
|
|
6901
|
+
*/
|
|
6895
6902
|
export declare const useFetchParentHome: (studentId: string) => {
|
|
6896
6903
|
isLoading: boolean;
|
|
6897
6904
|
isProcessingFailed: boolean;
|
|
@@ -7057,6 +7064,11 @@ export declare const useModalActions: IUseModalActions;
|
|
|
7057
7064
|
|
|
7058
7065
|
export declare const useModalParams: IUseModalParams;
|
|
7059
7066
|
|
|
7067
|
+
/**
|
|
7068
|
+
* Hook to consume processed parent home data.
|
|
7069
|
+
* - Automatically fetches on mount and when stale using useFetchParentHome() at <ParentRoutesWrapper/>.
|
|
7070
|
+
* - Use this to **read** parent home data.
|
|
7071
|
+
*/
|
|
7060
7072
|
export declare const useParentHomeData: (studentId: string) => IUseParentHomeDataReturn;
|
|
7061
7073
|
|
|
7062
7074
|
export declare const usePLASwitchUserJourney: () => (userAvatarRef: RefObject<HTMLDivElement>, avatar?: IAvatarLayer[] | null) => void;
|
package/dist/index.js
CHANGED
|
@@ -348,9 +348,9 @@ import { default as Ax } from "./features/parent-dashboard/modals/view-payment-m
|
|
|
348
348
|
import { default as _x } from "./features/parent-dashboard/parent-dashboard.js";
|
|
349
349
|
import { usePLASwitchUserJourney as Mx } from "./features/parent-dashboard/hooks/use-switch-user-journey.js";
|
|
350
350
|
import { default as Rx } from "./features/parent-dashboard/hooks/use-fetch-parent-home.js";
|
|
351
|
-
import {
|
|
352
|
-
import {
|
|
353
|
-
import {
|
|
351
|
+
import { default as Dx } from "./features/parent-dashboard/hooks/use-parent-home-data.js";
|
|
352
|
+
import { invalidateParentHome as Hx } from "./features/parent-dashboard/api/parent-home.js";
|
|
353
|
+
import { EPLAState as gx, ESummaryType as yx } from "./features/parent-dashboard/parent-dashboard-types.js";
|
|
354
354
|
import { default as Ux } from "./features/student-username/add/add-student-username.js";
|
|
355
355
|
import { COUNTRY_CODE_MAP as Bx } from "./constants/country.js";
|
|
356
356
|
export {
|
|
@@ -453,11 +453,11 @@ export {
|
|
|
453
453
|
Pu as EClassTimeAlertLevel,
|
|
454
454
|
ba as EDeviceType,
|
|
455
455
|
il as ELeaderboardType,
|
|
456
|
-
|
|
456
|
+
gx as EPLAState,
|
|
457
457
|
Zp as EPResourceAssign,
|
|
458
458
|
Em as EPostGameStat,
|
|
459
459
|
hu as ESessionStatus,
|
|
460
|
-
|
|
460
|
+
yx as ESummaryType,
|
|
461
461
|
du as EVENTS,
|
|
462
462
|
xe as Edit2Icon,
|
|
463
463
|
me as EditIcon,
|
|
@@ -690,7 +690,7 @@ export {
|
|
|
690
690
|
Uu as invalidateHomeworks,
|
|
691
691
|
mm as invalidateMilestoneResources,
|
|
692
692
|
om as invalidateMilestonesData,
|
|
693
|
-
|
|
693
|
+
Hx as invalidateParentHome,
|
|
694
694
|
am as invalidatePastMilestoneCount,
|
|
695
695
|
Hm as invalidatePuzzleToAssign,
|
|
696
696
|
lm as invalidateTestHelpData,
|
|
@@ -723,7 +723,7 @@ export {
|
|
|
723
723
|
Ta as useModalActions,
|
|
724
724
|
Ca as useModalParams,
|
|
725
725
|
Mx as usePLASwitchUserJourney,
|
|
726
|
-
|
|
726
|
+
Dx as useParentHomeData,
|
|
727
727
|
cm as usePointerSync,
|
|
728
728
|
xp as usePuzzleAttemptJourney,
|
|
729
729
|
ap as usePuzzleDashboardJourney,
|