@cuemath/leap 3.5.5-ashw2 → 3.5.5
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/homework/hw-card-list/hw-card-list-view.js +62 -64
- package/dist/features/homework/hw-card-list/hw-card-list-view.js.map +1 -1
- package/dist/features/trial-session/comps/navigation-bar/index.js +67 -50
- package/dist/features/trial-session/comps/navigation-bar/index.js.map +1 -1
- package/dist/features/trial-session/hooks/use-trial-session-navigation.js +56 -56
- package/dist/features/trial-session/hooks/use-trial-session-navigation.js.map +1 -1
- package/dist/index.d.ts +23 -23
- package/package.json +2 -3
|
@@ -1,73 +1,71 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { memo as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import J from "../../../assets/line-icons/icons/chevron-right.js";
|
|
1
|
+
import { jsxs as l, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { memo as Q, useState as y, useRef as V, useMemo as S, useCallback as d, useEffect as B } from "react";
|
|
3
|
+
import F from "../../../assets/line-icons/icons/chevron-left.js";
|
|
4
|
+
import q from "../../../assets/line-icons/icons/chevron-right.js";
|
|
6
5
|
import u from "../../ui/layout/flex-view.js";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { ContentWrapper as
|
|
10
|
-
import { getWaitForReviewSheetsCount as
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
userType: g,
|
|
6
|
+
import g from "../../ui/text/text.js";
|
|
7
|
+
import E from "../homework-card.js";
|
|
8
|
+
import { ContentWrapper as Y, ScrollButton as W, ScrollContainer as z, QueueWrapper as J, QueueText as P } from "./hw-card-list-styled.js";
|
|
9
|
+
import { getWaitForReviewSheetsCount as Z } from "./hw-card-list-utils.js";
|
|
10
|
+
const U = ({
|
|
11
|
+
userType: C,
|
|
14
12
|
studentId: _,
|
|
15
|
-
isHwProcessing:
|
|
16
|
-
hwDetails:
|
|
13
|
+
isHwProcessing: K,
|
|
14
|
+
hwDetails: s,
|
|
17
15
|
onTestStart: k,
|
|
18
16
|
onNodeAttempt: v,
|
|
19
|
-
onTestPreview:
|
|
20
|
-
onNodeView:
|
|
21
|
-
onTestReview:
|
|
22
|
-
onNodeReview:
|
|
17
|
+
onTestPreview: b,
|
|
18
|
+
onNodeView: x,
|
|
19
|
+
onTestReview: H,
|
|
20
|
+
onNodeReview: L,
|
|
23
21
|
onNodeUnassign: A,
|
|
24
|
-
puzzleHWCardRef:
|
|
22
|
+
puzzleHWCardRef: T
|
|
25
23
|
}) => {
|
|
26
|
-
const [j, a] =
|
|
24
|
+
const [j, a] = y(!1), [D, I] = y(!1), o = V(null), { assigned_homeworks: h = [], queued_homeworks: f = [] } = s || {}, R = S(
|
|
27
25
|
() => h.length + f.length,
|
|
28
26
|
[h, f]
|
|
29
|
-
),
|
|
27
|
+
), G = S(() => Z(s), [s]), t = d(() => {
|
|
30
28
|
if (o.current) {
|
|
31
|
-
const { scrollLeft: e, scrollWidth: i, clientWidth:
|
|
32
|
-
e > 1 && a(!0), e < i -
|
|
29
|
+
const { scrollLeft: e, scrollWidth: i, clientWidth: c } = o.current;
|
|
30
|
+
e > 1 && a(!0), e < i - c - 1 && I(!0);
|
|
33
31
|
}
|
|
34
|
-
}, []),
|
|
32
|
+
}, []), M = d(() => {
|
|
35
33
|
o.current && t();
|
|
36
|
-
}, [t]),
|
|
34
|
+
}, [t]), N = d(() => {
|
|
37
35
|
a(!1), I(!1);
|
|
38
|
-
}, []),
|
|
36
|
+
}, []), X = d(() => {
|
|
39
37
|
o.current && (o.current.scrollBy({ left: -200, behavior: "smooth" }), t());
|
|
40
|
-
}, [t]),
|
|
38
|
+
}, [t]), O = d(() => {
|
|
41
39
|
o.current && (o.current.scrollBy({ left: 200, behavior: "smooth" }), t());
|
|
42
40
|
}, [t]);
|
|
43
|
-
return
|
|
44
|
-
if (
|
|
41
|
+
return B(() => {
|
|
42
|
+
if (s && o.current) {
|
|
45
43
|
const { scrollLeft: e } = o.current;
|
|
46
44
|
e > 1 && a(!0);
|
|
47
45
|
}
|
|
48
|
-
}, [
|
|
46
|
+
}, [s]), B(() => {
|
|
49
47
|
const e = o.current;
|
|
50
48
|
if (e)
|
|
51
49
|
return e.addEventListener("scroll", t), () => {
|
|
52
50
|
e.removeEventListener("scroll", t);
|
|
53
51
|
};
|
|
54
|
-
}, [t]), R === 0 ? /* @__PURE__ */
|
|
55
|
-
/* @__PURE__ */ r(
|
|
56
|
-
/* @__PURE__ */ r(
|
|
57
|
-
] }) : /* @__PURE__ */
|
|
58
|
-
/* @__PURE__ */
|
|
52
|
+
}, [t]), R === 0 ? /* @__PURE__ */ l(u, { $flexRowGapX: 1, children: [
|
|
53
|
+
/* @__PURE__ */ r(g, { $renderAs: "ac4-black", $color: "BLACK_T_60", children: "Homework (0)" }),
|
|
54
|
+
/* @__PURE__ */ r(g, { $renderAs: "ab2", $color: "BLACK_T_60", children: "No Homework assigned yet" })
|
|
55
|
+
] }) : /* @__PURE__ */ l(Y, { $flexRowGapX: 1, $disablePointerEvents: K, children: [
|
|
56
|
+
/* @__PURE__ */ l(g, { $renderAs: "ac4-black", $color: "BLACK_T_60", children: [
|
|
59
57
|
"Homework (",
|
|
60
|
-
|
|
58
|
+
G,
|
|
61
59
|
"/",
|
|
62
60
|
R,
|
|
63
61
|
")"
|
|
64
62
|
] }),
|
|
65
|
-
/* @__PURE__ */
|
|
63
|
+
/* @__PURE__ */ l(
|
|
66
64
|
u,
|
|
67
65
|
{
|
|
68
66
|
$position: "relative",
|
|
69
|
-
onMouseEnter:
|
|
70
|
-
onMouseLeave:
|
|
67
|
+
onMouseEnter: M,
|
|
68
|
+
onMouseLeave: N,
|
|
71
69
|
children: [
|
|
72
70
|
/* @__PURE__ */ r(
|
|
73
71
|
W,
|
|
@@ -77,17 +75,17 @@ const te = ({
|
|
|
77
75
|
$justifyContent: "center",
|
|
78
76
|
$alignItems: "center",
|
|
79
77
|
$height: "100%",
|
|
80
|
-
onClick:
|
|
81
|
-
$visible:
|
|
78
|
+
onClick: X,
|
|
79
|
+
$visible: j,
|
|
82
80
|
left: "0px",
|
|
83
81
|
right: "auto",
|
|
84
|
-
children: /* @__PURE__ */ r(
|
|
82
|
+
children: /* @__PURE__ */ r(F, { width: 24, height: 24 })
|
|
85
83
|
}
|
|
86
84
|
),
|
|
87
|
-
/* @__PURE__ */ r(
|
|
85
|
+
/* @__PURE__ */ r(z, { ref: o, children: /* @__PURE__ */ l(u, { $flexDirection: "row", $flexGapX: 1, children: [
|
|
88
86
|
h.map((e, i) => {
|
|
89
87
|
const {
|
|
90
|
-
node_id:
|
|
88
|
+
node_id: c,
|
|
91
89
|
worksheet_id: m,
|
|
92
90
|
node_type: $,
|
|
93
91
|
title: p,
|
|
@@ -99,9 +97,9 @@ const te = ({
|
|
|
99
97
|
$flexDirection: "row",
|
|
100
98
|
$flexGapX: 1,
|
|
101
99
|
children: /* @__PURE__ */ r(
|
|
102
|
-
|
|
100
|
+
E,
|
|
103
101
|
{
|
|
104
|
-
userType:
|
|
102
|
+
userType: C,
|
|
105
103
|
header: p,
|
|
106
104
|
subHeader: w || "",
|
|
107
105
|
nodeData: e,
|
|
@@ -109,45 +107,45 @@ const te = ({
|
|
|
109
107
|
studentId: _,
|
|
110
108
|
onNodeAttempt: n ? k : v,
|
|
111
109
|
shouldOpenOnRight: !0,
|
|
112
|
-
onNodeView: n ?
|
|
113
|
-
onNodeReview: n ?
|
|
110
|
+
onNodeView: n ? b : x,
|
|
111
|
+
onNodeReview: n ? H : L,
|
|
114
112
|
onNodeUnassign: A,
|
|
115
|
-
puzzleHWCardRef:
|
|
113
|
+
puzzleHWCardRef: T
|
|
116
114
|
}
|
|
117
115
|
)
|
|
118
116
|
},
|
|
119
|
-
`${m}_${
|
|
117
|
+
`${m}_${c}_${i}`
|
|
120
118
|
);
|
|
121
119
|
}),
|
|
122
120
|
f.map((e, i) => {
|
|
123
121
|
const {
|
|
124
|
-
node_id:
|
|
122
|
+
node_id: c,
|
|
125
123
|
worksheet_id: m,
|
|
126
124
|
node_type: $,
|
|
127
125
|
title: p,
|
|
128
126
|
subtext: w
|
|
129
127
|
} = e, n = $ === "DYNAMIC";
|
|
130
|
-
return /* @__PURE__ */
|
|
128
|
+
return /* @__PURE__ */ l(
|
|
131
129
|
u,
|
|
132
130
|
{
|
|
133
131
|
$flexDirection: "row",
|
|
134
132
|
$flexGapX: 1,
|
|
135
133
|
children: [
|
|
136
134
|
i === 0 && /* @__PURE__ */ r(
|
|
137
|
-
|
|
135
|
+
J,
|
|
138
136
|
{
|
|
139
137
|
$background: "BLACK_4",
|
|
140
138
|
$justifyContent: "center",
|
|
141
139
|
$gutter: 4,
|
|
142
140
|
$gap: 8,
|
|
143
|
-
children: /* @__PURE__ */ r(
|
|
141
|
+
children: /* @__PURE__ */ r(P, { $renderAs: "ac3", $color: "WHITE", children: "In Queue" })
|
|
144
142
|
}
|
|
145
143
|
),
|
|
146
144
|
/* @__PURE__ */ r(
|
|
147
|
-
|
|
145
|
+
E,
|
|
148
146
|
{
|
|
149
147
|
isInQueue: !0,
|
|
150
|
-
userType:
|
|
148
|
+
userType: C,
|
|
151
149
|
header: p,
|
|
152
150
|
subHeader: w || "",
|
|
153
151
|
nodeData: e,
|
|
@@ -155,14 +153,14 @@ const te = ({
|
|
|
155
153
|
studentId: _,
|
|
156
154
|
onNodeAttempt: n ? k : v,
|
|
157
155
|
shouldOpenOnRight: !0,
|
|
158
|
-
onNodeView: n ?
|
|
159
|
-
onNodeReview: n ?
|
|
156
|
+
onNodeView: n ? b : x,
|
|
157
|
+
onNodeReview: n ? H : L,
|
|
160
158
|
onNodeUnassign: A
|
|
161
159
|
}
|
|
162
160
|
)
|
|
163
161
|
]
|
|
164
162
|
},
|
|
165
|
-
`${m}_${
|
|
163
|
+
`${m}_${c}_${i}`
|
|
166
164
|
);
|
|
167
165
|
})
|
|
168
166
|
] }) }),
|
|
@@ -175,19 +173,19 @@ const te = ({
|
|
|
175
173
|
$background: "BLACK_T_60",
|
|
176
174
|
$justifyContent: "center",
|
|
177
175
|
$alignItems: "center",
|
|
178
|
-
onClick:
|
|
179
|
-
$visible:
|
|
176
|
+
onClick: O,
|
|
177
|
+
$visible: D,
|
|
180
178
|
left: "auto",
|
|
181
179
|
right: "0px",
|
|
182
|
-
children: /* @__PURE__ */ r(
|
|
180
|
+
children: /* @__PURE__ */ r(q, { width: 24, height: 24 })
|
|
183
181
|
}
|
|
184
182
|
)
|
|
185
183
|
]
|
|
186
184
|
}
|
|
187
185
|
)
|
|
188
186
|
] });
|
|
189
|
-
},
|
|
187
|
+
}, de = Q(U);
|
|
190
188
|
export {
|
|
191
|
-
|
|
189
|
+
de as default
|
|
192
190
|
};
|
|
193
191
|
//# sourceMappingURL=hw-card-list-view.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hw-card-list-view.js","sources":["../../../../src/features/homework/hw-card-list/hw-card-list-view.tsx"],"sourcesContent":["import { memo, useCallback, useEffect, useMemo, useRef, useState, type FC } from 'react';\nimport { useTheme } from 'styled-components';\n\nimport ChevronLeftIcon from '../../../assets/line-icons/icons/chevron-left';\nimport ChevronRightIcon from '../../../assets/line-icons/icons/chevron-right';\nimport type {\n INodeCardCallbacks,\n INodeDataProps,\n} from '../../chapters-v2/comps/node-card/node-card-types';\nimport FlexView from '../../ui/layout/flex-view';\nimport Text from '../../ui/text/text';\nimport type { TUserTypes } from '../../ui/types';\nimport HomeworkCard from '../homework-card';\nimport type { IHomeworkDetails } from './api/get-homeworks';\nimport * as Styled from './hw-card-list-styled';\nimport { getWaitForReviewSheetsCount } from './hw-card-list-utils';\nimport { EDeviceType } from '../../ui/theme/constants';\n\ninterface IHwCardListView extends INodeCardCallbacks {\n userType: TUserTypes;\n studentId: string;\n isHwProcessing: boolean;\n hwDetails?: IHomeworkDetails;\n onTestPreview?: (sheetData: INodeDataProps, milestoneId?: string) => void;\n onTestStart?: (sheetData: INodeDataProps, homeworkId?: string) => void;\n onTestReview?: (sheetData: INodeDataProps, milestoneId?: string) => void;\n puzzleHWCardRef?: React.RefObject<HTMLDivElement>;\n}\n\nconst HwCardListView: FC<IHwCardListView> = ({\n userType,\n studentId,\n isHwProcessing,\n hwDetails,\n onTestStart,\n onNodeAttempt,\n onTestPreview,\n onNodeView,\n onTestReview,\n onNodeReview,\n onNodeUnassign,\n puzzleHWCardRef,\n}) => {\n const [isLeftHovered, setIsLeftHovered] = useState(false);\n const [isRightHovered, setIsRightHovered] = useState(false);\n const scrollRef = useRef<HTMLDivElement>(null);\n const { device } = useTheme();\n const isCompact = device <= EDeviceType.TABLET;\n const { assigned_homeworks: assignedHomeworks = [], queued_homeworks: queuedHomeworks = [] } =\n hwDetails || {};\n\n const totalHWSheetsCount = useMemo(\n () => assignedHomeworks.length + queuedHomeworks.length,\n [assignedHomeworks, queuedHomeworks],\n );\n const waitForReviewSheets = useMemo(() => getWaitForReviewSheetsCount(hwDetails), [hwDetails]);\n\n const updatedCanScroll = useCallback(() => {\n if (scrollRef.current) {\n const { scrollLeft, scrollWidth, clientWidth } = scrollRef.current;\n\n if (scrollLeft > 1) {\n setIsLeftHovered(true);\n }\n\n if (scrollLeft < scrollWidth - clientWidth - 1) {\n setIsRightHovered(true);\n }\n }\n }, []);\n const handleHoverEnter = useCallback(() => {\n if (!scrollRef.current) return;\n\n updatedCanScroll();\n }, [updatedCanScroll]);\n\n const handleHoverLeave = useCallback(() => {\n setIsLeftHovered(false);\n setIsRightHovered(false);\n }, []);\n\n const handleScrollLeft = useCallback(() => {\n if (scrollRef.current) {\n scrollRef.current.scrollBy({ left: -200, behavior: 'smooth' });\n updatedCanScroll();\n }\n }, [updatedCanScroll]);\n\n const handleScrollRight = useCallback(() => {\n if (scrollRef.current) {\n scrollRef.current.scrollBy({ left: 200, behavior: 'smooth' });\n updatedCanScroll();\n }\n }, [updatedCanScroll]);\n\n useEffect(() => {\n if (hwDetails && scrollRef.current) {\n const { scrollLeft } = scrollRef.current;\n\n if (scrollLeft > 1) {\n setIsLeftHovered(true);\n }\n }\n }, [hwDetails]);\n\n useEffect(() => {\n const scrollElement = scrollRef.current;\n\n if (scrollElement) {\n scrollElement.addEventListener('scroll', updatedCanScroll);\n\n return () => {\n scrollElement.removeEventListener('scroll', updatedCanScroll);\n };\n }\n }, [updatedCanScroll]);\n\n if (totalHWSheetsCount === 0) {\n return (\n <FlexView $flexRowGapX={1}>\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n Homework (0)\n </Text>\n <Text $renderAs=\"ab2\" $color=\"BLACK_T_60\">\n No Homework assigned yet\n </Text>\n </FlexView>\n );\n }\n\n return (\n <Styled.ContentWrapper $flexRowGapX={1} $disablePointerEvents={isHwProcessing}>\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n Homework ({waitForReviewSheets}/{totalHWSheetsCount})\n </Text>\n <FlexView\n $position=\"relative\"\n onMouseEnter={handleHoverEnter}\n onMouseLeave={handleHoverLeave}\n >\n <Styled.ScrollButton\n $position=\"absolute\"\n $background=\"BLACK_T_60\"\n $justifyContent=\"center\"\n $alignItems=\"center\"\n $height=\"100%\"\n onClick={handleScrollLeft}\n $visible={isCompact ? true : isLeftHovered}\n left=\"0px\"\n right=\"auto\"\n >\n <ChevronLeftIcon width={24} height={24} />\n </Styled.ScrollButton>\n\n <Styled.ScrollContainer ref={scrollRef}>\n <FlexView $flexDirection=\"row\" $flexGapX={1}>\n {assignedHomeworks.map((sheet, idx) => {\n const {\n node_id: nodeId,\n worksheet_id: worksheetId,\n node_type: nodeType,\n title,\n subtext,\n } = sheet;\n const isDynamicSheet = nodeType === 'DYNAMIC';\n\n return (\n <FlexView\n key={`${worksheetId}_${nodeId}_${idx}`}\n $flexDirection=\"row\"\n $flexGapX={1}\n >\n <HomeworkCard\n userType={userType}\n header={title}\n subHeader={subtext || ''}\n nodeData={sheet}\n renderAs=\"homework\"\n studentId={studentId}\n onNodeAttempt={isDynamicSheet ? onTestStart : onNodeAttempt}\n shouldOpenOnRight={true}\n onNodeView={isDynamicSheet ? onTestPreview : onNodeView}\n onNodeReview={isDynamicSheet ? onTestReview : onNodeReview}\n onNodeUnassign={onNodeUnassign}\n puzzleHWCardRef={puzzleHWCardRef}\n />\n </FlexView>\n );\n })}\n\n {queuedHomeworks.map((sheet, idx) => {\n const {\n node_id: nodeId,\n worksheet_id: worksheetId,\n node_type: nodeType,\n title,\n subtext,\n } = sheet;\n const isDynamicSheet = nodeType === 'DYNAMIC';\n\n return (\n <FlexView\n key={`${worksheetId}_${nodeId}_${idx}`}\n $flexDirection=\"row\"\n $flexGapX={1}\n >\n {idx === 0 && (\n <Styled.QueueWrapper\n $background=\"BLACK_4\"\n $justifyContent=\"center\"\n $gutter={4}\n $gap={8}\n >\n <Styled.QueueText $renderAs=\"ac3\" $color=\"WHITE\">\n In Queue\n </Styled.QueueText>\n </Styled.QueueWrapper>\n )}\n <HomeworkCard\n isInQueue\n userType={userType}\n header={title}\n subHeader={subtext || ''}\n nodeData={sheet}\n renderAs=\"homework\"\n studentId={studentId}\n onNodeAttempt={isDynamicSheet ? onTestStart : onNodeAttempt}\n shouldOpenOnRight={true}\n onNodeView={isDynamicSheet ? onTestPreview : onNodeView}\n onNodeReview={isDynamicSheet ? onTestReview : onNodeReview}\n onNodeUnassign={onNodeUnassign}\n />\n </FlexView>\n );\n })}\n </FlexView>\n </Styled.ScrollContainer>\n <Styled.ScrollButton\n $position=\"absolute\"\n $width=\"60px\"\n $height=\"100%\"\n $background=\"BLACK_T_60\"\n $justifyContent=\"center\"\n $alignItems=\"center\"\n onClick={handleScrollRight}\n $visible={isCompact ? true : isRightHovered}\n left=\"auto\"\n right=\"0px\"\n >\n <ChevronRightIcon width={24} height={24} />\n </Styled.ScrollButton>\n </FlexView>\n </Styled.ContentWrapper>\n );\n};\n\nexport default memo(HwCardListView);\n"],"names":["HwCardListView","userType","studentId","isHwProcessing","hwDetails","onTestStart","onNodeAttempt","onTestPreview","onNodeView","onTestReview","onNodeReview","onNodeUnassign","puzzleHWCardRef","isLeftHovered","setIsLeftHovered","useState","isRightHovered","setIsRightHovered","scrollRef","useRef","device","useTheme","isCompact","EDeviceType","assignedHomeworks","queuedHomeworks","totalHWSheetsCount","useMemo","waitForReviewSheets","getWaitForReviewSheetsCount","updatedCanScroll","useCallback","scrollLeft","scrollWidth","clientWidth","handleHoverEnter","handleHoverLeave","handleScrollLeft","handleScrollRight","useEffect","scrollElement","jsxs","FlexView","jsx","Text","Styled.ContentWrapper","Styled.ScrollButton","ChevronLeftIcon","Styled.ScrollContainer","sheet","idx","nodeId","worksheetId","nodeType","title","subtext","isDynamicSheet","HomeworkCard","Styled.QueueWrapper","Styled.QueueText","ChevronRightIcon","HwCardListView$1","memo"],"mappings":";;;;;;;;;;;AA6BA,MAAMA,KAAsC,CAAC;AAAA,EAC3C,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,YAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,iBAAAC;AACF,MAAM;AACJ,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAS,EAAK,GAClD,CAACC,GAAgBC,CAAiB,IAAIF,EAAS,EAAK,GACpDG,IAAYC,EAAuB,IAAI,GACvC,EAAE,QAAAC,MAAWC,KACbC,IAAYF,KAAUG,GAAY,QAClC,EAAE,oBAAoBC,IAAoB,IAAI,kBAAkBC,IAAkB,CAAC,EAAA,IACvFrB,KAAa,IAETsB,IAAqBC;AAAA,IACzB,MAAMH,EAAkB,SAASC,EAAgB;AAAA,IACjD,CAACD,GAAmBC,CAAe;AAAA,EAAA,GAE/BG,IAAsBD,EAAQ,MAAME,GAA4BzB,CAAS,GAAG,CAACA,CAAS,CAAC,GAEvF0B,IAAmBC,EAAY,MAAM;AACzC,QAAIb,EAAU,SAAS;AACrB,YAAM,EAAE,YAAAc,GA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D,IAAiB/C,IAAeC;AAAA,wBAC9C,gBAAAC;AAAA,sBAAA;AAAA,oBACF;AAAA,kBAAA;AAAA,gBAAA;AAAA,gBA7BK,GAAGyC,CAAW,IAAID,CAAM,IAAID,CAAG;AAAA,cAAA;AAAA,YA8BtC,CAEH;AAAA,UAAA,EAAA,CACH,EACF,CAAA;AAAA,UACA,gBAAAP;AAAA,YAACG;AAAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,QAAO;AAAA,cACP,SAAQ;AAAA,cACR,aAAY;AAAA,cACZ,iBAAgB;AAAA,cAChB,aAAY;AAAA,cACZ,SAASR;AAAA,cACT,UAAUhB,IAAY,KAAON;AAAA,cAC7B,MAAK;AAAA,cACL,OAAM;AAAA,cAEN,UAAC,gBAAA2B,EAAAiB,GAAA,EAAiB,OAAO,IAAI,QAAQ,IAAI;AAAA,YAAA;AAAA,UAC3C;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EACF,EAAA,CAAA;AAEJ,GAEeC,KAAAC,EAAK9D,EAAc;"}
|
|
1
|
+
{"version":3,"file":"hw-card-list-view.js","sources":["../../../../src/features/homework/hw-card-list/hw-card-list-view.tsx"],"sourcesContent":["import { memo, useCallback, useEffect, useMemo, useRef, useState, type FC } from 'react';\n\nimport ChevronLeftIcon from '../../../assets/line-icons/icons/chevron-left';\nimport ChevronRightIcon from '../../../assets/line-icons/icons/chevron-right';\nimport type {\n INodeCardCallbacks,\n INodeDataProps,\n} from '../../chapters-v2/comps/node-card/node-card-types';\nimport FlexView from '../../ui/layout/flex-view';\nimport Text from '../../ui/text/text';\nimport type { TUserTypes } from '../../ui/types';\nimport HomeworkCard from '../homework-card';\nimport type { IHomeworkDetails } from './api/get-homeworks';\nimport * as Styled from './hw-card-list-styled';\nimport { getWaitForReviewSheetsCount } from './hw-card-list-utils';\n\ninterface IHwCardListView extends INodeCardCallbacks {\n userType: TUserTypes;\n studentId: string;\n isHwProcessing: boolean;\n hwDetails?: IHomeworkDetails;\n onTestPreview?: (sheetData: INodeDataProps, milestoneId?: string) => void;\n onTestStart?: (sheetData: INodeDataProps, homeworkId?: string) => void;\n onTestReview?: (sheetData: INodeDataProps, milestoneId?: string) => void;\n puzzleHWCardRef?: React.RefObject<HTMLDivElement>;\n}\n\nconst HwCardListView: FC<IHwCardListView> = ({\n userType,\n studentId,\n isHwProcessing,\n hwDetails,\n onTestStart,\n onNodeAttempt,\n onTestPreview,\n onNodeView,\n onTestReview,\n onNodeReview,\n onNodeUnassign,\n puzzleHWCardRef,\n}) => {\n const [isLeftHovered, setIsLeftHovered] = useState(false);\n const [isRightHovered, setIsRightHovered] = useState(false);\n const scrollRef = useRef<HTMLDivElement>(null);\n\n const { assigned_homeworks: assignedHomeworks = [], queued_homeworks: queuedHomeworks = [] } =\n hwDetails || {};\n\n const totalHWSheetsCount = useMemo(\n () => assignedHomeworks.length + queuedHomeworks.length,\n [assignedHomeworks, queuedHomeworks],\n );\n const waitForReviewSheets = useMemo(() => getWaitForReviewSheetsCount(hwDetails), [hwDetails]);\n\n const updatedCanScroll = useCallback(() => {\n if (scrollRef.current) {\n const { scrollLeft, scrollWidth, clientWidth } = scrollRef.current;\n\n if (scrollLeft > 1) {\n setIsLeftHovered(true);\n }\n\n if (scrollLeft < scrollWidth - clientWidth - 1) {\n setIsRightHovered(true);\n }\n }\n }, []);\n const handleHoverEnter = useCallback(() => {\n if (!scrollRef.current) return;\n\n updatedCanScroll();\n }, [updatedCanScroll]);\n\n const handleHoverLeave = useCallback(() => {\n setIsLeftHovered(false);\n setIsRightHovered(false);\n }, []);\n\n const handleScrollLeft = useCallback(() => {\n if (scrollRef.current) {\n scrollRef.current.scrollBy({ left: -200, behavior: 'smooth' });\n updatedCanScroll();\n }\n }, [updatedCanScroll]);\n\n const handleScrollRight = useCallback(() => {\n if (scrollRef.current) {\n scrollRef.current.scrollBy({ left: 200, behavior: 'smooth' });\n updatedCanScroll();\n }\n }, [updatedCanScroll]);\n\n useEffect(() => {\n if (hwDetails && scrollRef.current) {\n const { scrollLeft } = scrollRef.current;\n\n if (scrollLeft > 1) {\n setIsLeftHovered(true);\n }\n }\n }, [hwDetails]);\n\n useEffect(() => {\n const scrollElement = scrollRef.current;\n\n if (scrollElement) {\n scrollElement.addEventListener('scroll', updatedCanScroll);\n\n return () => {\n scrollElement.removeEventListener('scroll', updatedCanScroll);\n };\n }\n }, [updatedCanScroll]);\n\n if (totalHWSheetsCount === 0) {\n return (\n <FlexView $flexRowGapX={1}>\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n Homework (0)\n </Text>\n <Text $renderAs=\"ab2\" $color=\"BLACK_T_60\">\n No Homework assigned yet\n </Text>\n </FlexView>\n );\n }\n\n return (\n <Styled.ContentWrapper $flexRowGapX={1} $disablePointerEvents={isHwProcessing}>\n <Text $renderAs=\"ac4-black\" $color=\"BLACK_T_60\">\n Homework ({waitForReviewSheets}/{totalHWSheetsCount})\n </Text>\n <FlexView\n $position=\"relative\"\n onMouseEnter={handleHoverEnter}\n onMouseLeave={handleHoverLeave}\n >\n <Styled.ScrollButton\n $position=\"absolute\"\n $background=\"BLACK_T_60\"\n $justifyContent=\"center\"\n $alignItems=\"center\"\n $height=\"100%\"\n onClick={handleScrollLeft}\n $visible={isLeftHovered}\n left=\"0px\"\n right=\"auto\"\n >\n <ChevronLeftIcon width={24} height={24} />\n </Styled.ScrollButton>\n\n <Styled.ScrollContainer ref={scrollRef}>\n <FlexView $flexDirection=\"row\" $flexGapX={1}>\n {assignedHomeworks.map((sheet, idx) => {\n const {\n node_id: nodeId,\n worksheet_id: worksheetId,\n node_type: nodeType,\n title,\n subtext,\n } = sheet;\n const isDynamicSheet = nodeType === 'DYNAMIC';\n\n return (\n <FlexView\n key={`${worksheetId}_${nodeId}_${idx}`}\n $flexDirection=\"row\"\n $flexGapX={1}\n >\n <HomeworkCard\n userType={userType}\n header={title}\n subHeader={subtext || ''}\n nodeData={sheet}\n renderAs=\"homework\"\n studentId={studentId}\n onNodeAttempt={isDynamicSheet ? onTestStart : onNodeAttempt}\n shouldOpenOnRight={true}\n onNodeView={isDynamicSheet ? onTestPreview : onNodeView}\n onNodeReview={isDynamicSheet ? onTestReview : onNodeReview}\n onNodeUnassign={onNodeUnassign}\n puzzleHWCardRef={puzzleHWCardRef}\n />\n </FlexView>\n );\n })}\n\n {queuedHomeworks.map((sheet, idx) => {\n const {\n node_id: nodeId,\n worksheet_id: worksheetId,\n node_type: nodeType,\n title,\n subtext,\n } = sheet;\n const isDynamicSheet = nodeType === 'DYNAMIC';\n\n return (\n <FlexView\n key={`${worksheetId}_${nodeId}_${idx}`}\n $flexDirection=\"row\"\n $flexGapX={1}\n >\n {idx === 0 && (\n <Styled.QueueWrapper\n $background=\"BLACK_4\"\n $justifyContent=\"center\"\n $gutter={4}\n $gap={8}\n >\n <Styled.QueueText $renderAs=\"ac3\" $color=\"WHITE\">\n In Queue\n </Styled.QueueText>\n </Styled.QueueWrapper>\n )}\n <HomeworkCard\n isInQueue\n userType={userType}\n header={title}\n subHeader={subtext || ''}\n nodeData={sheet}\n renderAs=\"homework\"\n studentId={studentId}\n onNodeAttempt={isDynamicSheet ? onTestStart : onNodeAttempt}\n shouldOpenOnRight={true}\n onNodeView={isDynamicSheet ? onTestPreview : onNodeView}\n onNodeReview={isDynamicSheet ? onTestReview : onNodeReview}\n onNodeUnassign={onNodeUnassign}\n />\n </FlexView>\n );\n })}\n </FlexView>\n </Styled.ScrollContainer>\n <Styled.ScrollButton\n $position=\"absolute\"\n $width=\"60px\"\n $height=\"100%\"\n $background=\"BLACK_T_60\"\n $justifyContent=\"center\"\n $alignItems=\"center\"\n onClick={handleScrollRight}\n $visible={isRightHovered}\n left=\"auto\"\n right=\"0px\"\n >\n <ChevronRightIcon width={24} height={24} />\n </Styled.ScrollButton>\n </FlexView>\n </Styled.ContentWrapper>\n );\n};\n\nexport default memo(HwCardListView);\n"],"names":["HwCardListView","userType","studentId","isHwProcessing","hwDetails","onTestStart","onNodeAttempt","onTestPreview","onNodeView","onTestReview","onNodeReview","onNodeUnassign","puzzleHWCardRef","isLeftHovered","setIsLeftHovered","useState","isRightHovered","setIsRightHovered","scrollRef","useRef","assignedHomeworks","queuedHomeworks","totalHWSheetsCount","useMemo","waitForReviewSheets","getWaitForReviewSheetsCount","updatedCanScroll","useCallback","scrollLeft","scrollWidth","clientWidth","handleHoverEnter","handleHoverLeave","handleScrollLeft","handleScrollRight","useEffect","scrollElement","jsxs","FlexView","jsx","Text","Styled.ContentWrapper","Styled.ScrollButton","ChevronLeftIcon","Styled.ScrollContainer","sheet","idx","nodeId","worksheetId","nodeType","title","subtext","isDynamicSheet","HomeworkCard","Styled.QueueWrapper","Styled.QueueText","ChevronRightIcon","HwCardListView$1","memo"],"mappings":";;;;;;;;;AA2BA,MAAMA,IAAsC,CAAC;AAAA,EAC3C,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,YAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,iBAAAC;AACF,MAAM;AACJ,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAS,EAAK,GAClD,CAACC,GAAgBC,CAAiB,IAAIF,EAAS,EAAK,GACpDG,IAAYC,EAAuB,IAAI,GAEvC,EAAE,oBAAoBC,IAAoB,IAAI,kBAAkBC,IAAkB,CAAC,EAAA,IACvFjB,KAAa,IAETkB,IAAqBC;AAAA,IACzB,MAAMH,EAAkB,SAASC,EAAgB;AAAA,IACjD,CAACD,GAAmBC,CAAe;AAAA,EAAA,GAE/BG,IAAsBD,EAAQ,MAAME,EAA4BrB,CAAS,GAAG,CAACA,CAAS,CAAC,GAEvFsB,IAAmBC,EAAY,MAAM;AACzC,QAAIT,EAAU,SAAS;AACrB,YAAM,EAAE,YAAAU,GAAY,aAAAC,GAAa,aAAAC,EAAA,IAAgBZ,EAAU;A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BACF;AAAA,kBAAA;AAAA,gBAAA;AAAA,gBA7BK,GAAGqC,CAAW,IAAID,CAAM,IAAID,CAAG;AAAA,cAAA;AAAA,YA8BtC,CAEH;AAAA,UAAA,EAAA,CACH,EACF,CAAA;AAAA,UACA,gBAAAP;AAAA,YAACG;AAAAA,YAAA;AAAA,cACC,WAAU;AAAA,cACV,QAAO;AAAA,cACP,SAAQ;AAAA,cACR,aAAY;AAAA,cACZ,iBAAgB;AAAA,cAChB,aAAY;AAAA,cACZ,SAASR;AAAA,cACT,UAAUlB;AAAA,cACV,MAAK;AAAA,cACL,OAAM;AAAA,cAEN,UAAC,gBAAAuB,EAAAiB,GAAA,EAAiB,OAAO,IAAI,QAAQ,IAAI;AAAA,YAAA;AAAA,UAC3C;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EACF,EAAA,CAAA;AAEJ,GAEeC,KAAAC,EAAK1D,CAAc;"}
|
|
@@ -1,87 +1,104 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useCallback as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { useTrialSessionContext as
|
|
9
|
-
import { isPLASource as
|
|
10
|
-
import { useTrialSessionNavigation as
|
|
11
|
-
import { Container as
|
|
12
|
-
import
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import { jsxs as c, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as s, useCallback as u } from "react";
|
|
3
|
+
import _ from "../../../ui/arrow-tooltip/arrow-tooltip.js";
|
|
4
|
+
import z from "../../../ui/buttons/button/button.js";
|
|
5
|
+
import b from "../../../ui/buttons/icon-button/icon-button.js";
|
|
6
|
+
import g from "../../../ui/layout/flex-view.js";
|
|
7
|
+
import h from "../../../ui/text/text.js";
|
|
8
|
+
import { useTrialSessionContext as E } from "../../context/use-trial-session-context.js";
|
|
9
|
+
import { isPLASource as S } from "../../helper.js";
|
|
10
|
+
import { useTrialSessionNavigation as F } from "../../hooks/use-trial-session-navigation.js";
|
|
11
|
+
import { Container as G, ForwardArrow as K } from "./navigation-bar-styled.js";
|
|
12
|
+
import M from "../../../../assets/line-icons/icons/back2.js";
|
|
13
|
+
const ee = () => {
|
|
14
|
+
var f;
|
|
15
|
+
const {
|
|
16
|
+
slideConfig: x,
|
|
17
|
+
buttonState: L,
|
|
18
|
+
openEndClassModal: C,
|
|
19
|
+
studentAbsentInClass: e,
|
|
20
|
+
trialHomeData: a,
|
|
21
|
+
formData: I
|
|
22
|
+
} = E(), { handleNavigation: o } = F(), {
|
|
23
|
+
left: { isDisabled: m, isLoading: $ },
|
|
24
|
+
right: { isDisabled: p, isLoading: B }
|
|
25
|
+
} = L || {}, { prevPage: A, nextPage: v } = x || {}, { buttonLabel: l, pageId: r } = A || {}, { buttonLabel: d, pageId: i } = v || {}, { numberInNameError: t } = I || {}, y = r && !i, w = S((f = a == null ? void 0 : a.intel_student) == null ? void 0 : f.source), D = s(
|
|
26
|
+
() => p || e || t,
|
|
27
|
+
[p, e, t]
|
|
28
|
+
), P = s(
|
|
29
|
+
() => m || e,
|
|
30
|
+
[m, e]
|
|
31
|
+
), T = s(() => t ? "Please enter a valid name" : "Waiting for student to join...", [t]), j = s(
|
|
32
|
+
() => e || t,
|
|
33
|
+
[e, t]
|
|
34
|
+
), k = u(() => {
|
|
35
|
+
o("next", i);
|
|
36
|
+
}, [o, i]), N = u(() => {
|
|
37
|
+
o("prev", r);
|
|
38
|
+
}, [o, r]);
|
|
39
|
+
return /* @__PURE__ */ c(
|
|
40
|
+
G,
|
|
24
41
|
{
|
|
25
42
|
$flexDirection: "row-reverse",
|
|
26
43
|
$justifyContent: "space-between",
|
|
27
44
|
$alignItems: "center",
|
|
28
45
|
children: [
|
|
29
|
-
|
|
30
|
-
|
|
46
|
+
y && /* @__PURE__ */ n(
|
|
47
|
+
z,
|
|
31
48
|
{
|
|
32
49
|
renderAs: "tertiary",
|
|
33
50
|
size: "small",
|
|
34
|
-
label:
|
|
51
|
+
label: w ? "End the session" : "End the class",
|
|
35
52
|
shape: "square",
|
|
36
|
-
onClick:
|
|
53
|
+
onClick: C
|
|
37
54
|
}
|
|
38
55
|
),
|
|
39
|
-
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
-
|
|
56
|
+
i && d && /* @__PURE__ */ c(g, { $flexDirection: "row", $alignItems: "center", $justifyContent: "center", $flexGap: 12, children: [
|
|
57
|
+
/* @__PURE__ */ n(h, { $renderAs: "ab2", $color: "BLACK_T_60", children: d }),
|
|
58
|
+
/* @__PURE__ */ n(
|
|
59
|
+
_,
|
|
43
60
|
{
|
|
44
61
|
widthX: 8,
|
|
45
62
|
zIndex: 2,
|
|
46
63
|
position: "top-left",
|
|
47
64
|
renderAs: "primary",
|
|
48
|
-
tooltipItem:
|
|
49
|
-
hidden: !
|
|
50
|
-
children: /* @__PURE__ */
|
|
51
|
-
|
|
65
|
+
tooltipItem: T,
|
|
66
|
+
hidden: !j,
|
|
67
|
+
children: /* @__PURE__ */ n(
|
|
68
|
+
b,
|
|
52
69
|
{
|
|
53
|
-
Icon:
|
|
70
|
+
Icon: K,
|
|
54
71
|
renderAs: "primary",
|
|
55
|
-
analyticsLabel:
|
|
72
|
+
analyticsLabel: d,
|
|
56
73
|
size: "small",
|
|
57
|
-
onClick:
|
|
58
|
-
disabled:
|
|
59
|
-
busy:
|
|
74
|
+
onClick: k,
|
|
75
|
+
disabled: D,
|
|
76
|
+
busy: B
|
|
60
77
|
}
|
|
61
78
|
)
|
|
62
79
|
}
|
|
63
80
|
)
|
|
64
81
|
] }),
|
|
65
|
-
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
|
|
82
|
+
r && l && /* @__PURE__ */ c(g, { $flexDirection: "row", $alignItems: "center", $justifyContent: "center", $flexGap: 12, children: [
|
|
83
|
+
/* @__PURE__ */ n(
|
|
84
|
+
b,
|
|
68
85
|
{
|
|
69
|
-
Icon:
|
|
86
|
+
Icon: M,
|
|
70
87
|
renderAs: "secondary",
|
|
71
|
-
analyticsLabel:
|
|
88
|
+
analyticsLabel: l,
|
|
72
89
|
size: "small",
|
|
73
|
-
onClick:
|
|
74
|
-
disabled:
|
|
75
|
-
busy:
|
|
90
|
+
onClick: N,
|
|
91
|
+
disabled: P,
|
|
92
|
+
busy: $
|
|
76
93
|
}
|
|
77
94
|
),
|
|
78
|
-
/* @__PURE__ */
|
|
95
|
+
/* @__PURE__ */ n(h, { $renderAs: "ab2", $color: "BLACK_T_60", children: l })
|
|
79
96
|
] })
|
|
80
97
|
]
|
|
81
98
|
}
|
|
82
99
|
);
|
|
83
100
|
};
|
|
84
101
|
export {
|
|
85
|
-
|
|
102
|
+
ee as default
|
|
86
103
|
};
|
|
87
104
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/features/trial-session/comps/navigation-bar/index.tsx"],"sourcesContent":["import { useCallback, type FC } from 'react';\n\nimport ArrowTooltip from '../../../ui/arrow-tooltip/arrow-tooltip';\nimport Button from '../../../ui/buttons/button/button';\nimport IconButton from '../../../ui/buttons/icon-button/icon-button';\nimport FlexView from '../../../ui/layout/flex-view';\nimport Text from '../../../ui/text/text';\nimport { useTrialSessionContext } from '../../context/use-trial-session-context';\nimport { isPLASource } from '../../helper';\nimport { useTrialSessionNavigation } from '../../hooks/use-trial-session-navigation';\nimport * as Styled from './navigation-bar-styled';\n\nconst NavigationBar: FC = () => {\n const {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/features/trial-session/comps/navigation-bar/index.tsx"],"sourcesContent":["import { useCallback, useMemo, type FC } from 'react';\n\nimport ArrowTooltip from '../../../ui/arrow-tooltip/arrow-tooltip';\nimport Button from '../../../ui/buttons/button/button';\nimport IconButton from '../../../ui/buttons/icon-button/icon-button';\nimport FlexView from '../../../ui/layout/flex-view';\nimport Text from '../../../ui/text/text';\nimport { useTrialSessionContext } from '../../context/use-trial-session-context';\nimport { isPLASource } from '../../helper';\nimport { useTrialSessionNavigation } from '../../hooks/use-trial-session-navigation';\nimport * as Styled from './navigation-bar-styled';\n\nconst NavigationBar: FC = () => {\n const {\n slideConfig,\n buttonState,\n openEndClassModal,\n studentAbsentInClass,\n trialHomeData,\n formData,\n } = useTrialSessionContext();\n\n const { handleNavigation } = useTrialSessionNavigation();\n\n const {\n left: { isDisabled: isLeftBtnDisabled, isLoading: isLeftBtnLoading },\n right: { isDisabled: isRightBtnDisabled, isLoading: isRightBtnLoading },\n } = buttonState || {};\n\n const { prevPage, nextPage } = slideConfig || {};\n const { buttonLabel: prevButtonLabel, pageId: prevPageId } = prevPage || {};\n const { buttonLabel: nextButtonLabel, pageId: nextPageId } = nextPage || {};\n const { numberInNameError } = formData || {};\n\n const isLastPage = prevPageId && !nextPageId;\n const isPLA = isPLASource(trialHomeData?.intel_student?.source);\n\n const nextButtonDisabled = useMemo(\n () => isRightBtnDisabled || studentAbsentInClass || numberInNameError,\n [isRightBtnDisabled, studentAbsentInClass, numberInNameError],\n );\n const prevButtonDisabled = useMemo(\n () => isLeftBtnDisabled || studentAbsentInClass,\n [isLeftBtnDisabled, studentAbsentInClass],\n );\n\n const tooltipContent = useMemo(() => {\n if (numberInNameError) return 'Please enter a valid name';\n return 'Waiting for student to join...';\n }, [numberInNameError]);\n const showTooltip = useMemo(\n () => studentAbsentInClass || numberInNameError,\n [studentAbsentInClass, numberInNameError],\n );\n\n const handleNext = useCallback(() => {\n handleNavigation('next', nextPageId);\n }, [handleNavigation, nextPageId]);\n\n const handlePrev = useCallback(() => {\n handleNavigation('prev', prevPageId);\n }, [handleNavigation, prevPageId]);\n\n return (\n <Styled.Container\n $flexDirection=\"row-reverse\"\n $justifyContent=\"space-between\"\n $alignItems=\"center\"\n >\n {isLastPage && (\n <Button\n renderAs=\"tertiary\"\n size=\"small\"\n label={isPLA ? 'End the session' : 'End the class'}\n shape=\"square\"\n onClick={openEndClassModal}\n />\n )}\n {nextPageId && nextButtonLabel && (\n <FlexView $flexDirection=\"row\" $alignItems=\"center\" $justifyContent=\"center\" $flexGap={12}>\n <Text $renderAs=\"ab2\" $color=\"BLACK_T_60\">\n {nextButtonLabel}\n </Text>\n <ArrowTooltip\n widthX={8}\n zIndex={2}\n position=\"top-left\"\n renderAs=\"primary\"\n tooltipItem={tooltipContent}\n hidden={!showTooltip}\n >\n <IconButton\n Icon={Styled.ForwardArrow}\n renderAs=\"primary\"\n analyticsLabel={nextButtonLabel}\n size=\"small\"\n onClick={handleNext}\n disabled={nextButtonDisabled}\n busy={isRightBtnLoading}\n />\n </ArrowTooltip>\n </FlexView>\n )}\n {prevPageId && prevButtonLabel && (\n <FlexView $flexDirection=\"row\" $alignItems=\"center\" $justifyContent=\"center\" $flexGap={12}>\n <IconButton\n Icon={Styled.BackwardArrow}\n renderAs=\"secondary\"\n analyticsLabel={prevButtonLabel}\n size=\"small\"\n onClick={handlePrev}\n disabled={prevButtonDisabled}\n busy={isLeftBtnLoading}\n />\n <Text $renderAs=\"ab2\" $color=\"BLACK_T_60\">\n {prevButtonLabel}\n </Text>\n </FlexView>\n )}\n </Styled.Container>\n );\n};\n\nexport default NavigationBar;\n"],"names":["NavigationBar","slideConfig","buttonState","openEndClassModal","studentAbsentInClass","trialHomeData","formData","useTrialSessionContext","handleNavigation","useTrialSessionNavigation","isLeftBtnDisabled","isLeftBtnLoading","isRightBtnDisabled","isRightBtnLoading","prevPage","nextPage","prevButtonLabel","prevPageId","nextButtonLabel","nextPageId","numberInNameError","isLastPage","isPLA","isPLASource","_a","nextButtonDisabled","useMemo","prevButtonDisabled","tooltipContent","showTooltip","handleNext","useCallback","handlePrev","jsxs","Styled.Container","jsx","Button","FlexView","Text","ArrowTooltip","IconButton","Styled.ForwardArrow","Styled.BackwardArr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AA,4BACC2B,GAAK,EAAA,WAAU,OAAM,QAAO,cAC1B,UACHtB,GAAA;AAAA,QAAA,GACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR;"}
|
|
@@ -1,65 +1,65 @@
|
|
|
1
1
|
import { useCallback as m, useEffect as te } from "react";
|
|
2
2
|
import { COURSE_STREAMS as oe } from "../../milestone/constants.js";
|
|
3
|
-
import { useMilestoneBulkPost as
|
|
4
|
-
import { usePostStudentPreferences as
|
|
3
|
+
import { useMilestoneBulkPost as ae } from "../../milestone/create/api/milestone-bulk.js";
|
|
4
|
+
import { usePostStudentPreferences as se } from "../api/course-stream.js";
|
|
5
5
|
import { usePatchStudentInformation as ne } from "../api/student-information.js";
|
|
6
|
-
import { usePostTeacherAvailability as
|
|
7
|
-
import { usePatchTrialHome as
|
|
6
|
+
import { usePostTeacherAvailability as re } from "../api/teacher-availability.js";
|
|
7
|
+
import { usePatchTrialHome as ie } from "../api/trial-home.js";
|
|
8
8
|
import { useTrialSessionContext as ce } from "../context/use-trial-session-context.js";
|
|
9
9
|
import { getFormattedPreferences as V, getWeekdayAndStartTimeFromPreference as le, getFormattedStudentPersonalizedPreference as de } from "../helper.js";
|
|
10
|
-
import { DEFAULT_BUTTON_STATE as
|
|
10
|
+
import { DEFAULT_BUTTON_STATE as f, TrialPageId as t } from "../trial-session-constants.js";
|
|
11
11
|
import W from "../../../node_modules/uuid/dist/esm-browser/v4.js";
|
|
12
12
|
const be = () => {
|
|
13
13
|
const {
|
|
14
14
|
updateSlideConfig: n,
|
|
15
15
|
slideConfig: Z,
|
|
16
16
|
formData: j,
|
|
17
|
-
updateButtonState:
|
|
18
|
-
teacherId:
|
|
19
|
-
studentId:
|
|
17
|
+
updateButtonState: s,
|
|
18
|
+
teacherId: r,
|
|
19
|
+
studentId: i,
|
|
20
20
|
milestoneConfig: A,
|
|
21
21
|
handleInfoMessage: _,
|
|
22
22
|
onTrialInformationUpdate: b,
|
|
23
23
|
trialHomeData: q,
|
|
24
24
|
worksheetNavigationPanel: I
|
|
25
25
|
} = ce(), { nextPage: J, id: u } = Z || {}, { demo_info: Q } = q, { stream: v, region_data: X } = Q, { opportunity_country: T = "US" } = X || {}, { pageId: c } = J || {}, {
|
|
26
|
-
name:
|
|
26
|
+
name: p,
|
|
27
27
|
grade: E,
|
|
28
28
|
goals: R,
|
|
29
29
|
curriculum: L,
|
|
30
|
-
studentTimezone:
|
|
31
|
-
preferences:
|
|
30
|
+
studentTimezone: N,
|
|
31
|
+
preferences: P = [],
|
|
32
32
|
personalizedLevel: k = [],
|
|
33
33
|
personalizedFocus: y = [],
|
|
34
34
|
personalizedBehaviors: D = [],
|
|
35
35
|
personalizedObjectives: O = [],
|
|
36
36
|
personalizedPosition: G = []
|
|
37
37
|
} = j || {}, l = m(() => {
|
|
38
|
-
|
|
38
|
+
s("both", {
|
|
39
39
|
left: { isDisabled: !0, isLoading: !1 },
|
|
40
40
|
right: { isDisabled: !0, isLoading: !0 }
|
|
41
41
|
});
|
|
42
|
-
}, [
|
|
42
|
+
}, [s]), S = (o) => {
|
|
43
43
|
if (!o) {
|
|
44
44
|
const e = {};
|
|
45
45
|
(c === t.CIRCLE_GAME || c === t.CIRCLE_PUZZLE || c === t.CIRCLE_SKILL) && (e.matchmakingId = W(), e.showCircleGameScreen = !0), n({ id: c, ...e });
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
}, { patch: z } =
|
|
49
|
-
onComplete:
|
|
50
|
-
}), { post: F } =
|
|
51
|
-
onComplete:
|
|
52
|
-
}), { post: M } =
|
|
53
|
-
onComplete:
|
|
47
|
+
s("both", f), u === t.LEARNING_LEVEL && (b == null || b());
|
|
48
|
+
}, { patch: z } = ie({ onComplete: S }), { patch: x } = ne({
|
|
49
|
+
onComplete: S
|
|
50
|
+
}), { post: F } = ae({
|
|
51
|
+
onComplete: S
|
|
52
|
+
}), { post: M } = se({
|
|
53
|
+
onComplete: S
|
|
54
54
|
}), Y = m(
|
|
55
55
|
(o, e) => {
|
|
56
|
-
if ((e ?? []).some((
|
|
56
|
+
if ((e ?? []).some((a) => !a.is_available)) {
|
|
57
57
|
const ee = (e ?? []).filter((C) => !C.is_available).map((C) => C.reason).join(`
|
|
58
58
|
`);
|
|
59
|
-
_ == null || _({ message: ee, position: "bottom" }),
|
|
59
|
+
_ == null || _({ message: ee, position: "bottom" }), s("both", f);
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
|
-
const h = V(
|
|
62
|
+
const h = V(P, N);
|
|
63
63
|
h.length > 0 ? z("trial-v3-patch", {
|
|
64
64
|
action: "UPDATE_DEMO",
|
|
65
65
|
action_data: {
|
|
@@ -67,72 +67,72 @@ const be = () => {
|
|
|
67
67
|
selected_regular_slots: h
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
|
-
teacher_id:
|
|
71
|
-
student_id:
|
|
72
|
-
}) :
|
|
70
|
+
teacher_id: r,
|
|
71
|
+
student_id: i
|
|
72
|
+
}) : s("both", f);
|
|
73
73
|
},
|
|
74
74
|
[
|
|
75
75
|
_,
|
|
76
76
|
z,
|
|
77
|
-
S,
|
|
78
|
-
r,
|
|
79
77
|
P,
|
|
80
78
|
i,
|
|
81
|
-
|
|
79
|
+
N,
|
|
80
|
+
r,
|
|
81
|
+
s
|
|
82
82
|
]
|
|
83
|
-
), { post: U } =
|
|
83
|
+
), { post: U } = re({
|
|
84
84
|
onComplete: Y
|
|
85
85
|
}), B = m(() => {
|
|
86
|
-
var
|
|
87
|
-
const [o, e] = ((
|
|
86
|
+
var a;
|
|
87
|
+
const [o, e] = ((a = p == null ? void 0 : p.trim()) == null ? void 0 : a.split(" ")) || [], d = {
|
|
88
88
|
first_name: o,
|
|
89
89
|
last_name: e,
|
|
90
90
|
grade: E,
|
|
91
91
|
board: L,
|
|
92
92
|
demo_type: "TRIAL_V3",
|
|
93
|
-
teacher_id:
|
|
93
|
+
teacher_id: r,
|
|
94
94
|
country_alpha_2: T
|
|
95
95
|
};
|
|
96
|
-
/\d/.test(
|
|
96
|
+
/\d/.test(p || "") ? n({ numberInNameError: !0 }) : (l(), x(i, d));
|
|
97
97
|
}, [
|
|
98
|
-
|
|
98
|
+
p,
|
|
99
99
|
E,
|
|
100
100
|
L,
|
|
101
|
-
|
|
101
|
+
r,
|
|
102
102
|
T,
|
|
103
103
|
l,
|
|
104
104
|
n,
|
|
105
105
|
x,
|
|
106
|
-
|
|
106
|
+
i
|
|
107
107
|
]), H = m(() => {
|
|
108
|
-
const o = V(
|
|
108
|
+
const o = V(P, N), e = le(o);
|
|
109
109
|
if (o.length > 0) {
|
|
110
110
|
const d = {
|
|
111
|
-
teacher_id:
|
|
111
|
+
teacher_id: r,
|
|
112
112
|
session_list: e
|
|
113
113
|
};
|
|
114
114
|
l(), U(d);
|
|
115
115
|
} else
|
|
116
|
-
n({ id: c }),
|
|
116
|
+
n({ id: c }), s("both", f);
|
|
117
117
|
}, [
|
|
118
|
-
S,
|
|
119
118
|
P,
|
|
120
|
-
|
|
119
|
+
N,
|
|
120
|
+
r,
|
|
121
121
|
U,
|
|
122
122
|
l,
|
|
123
123
|
n,
|
|
124
124
|
c,
|
|
125
|
-
|
|
125
|
+
s
|
|
126
126
|
]), w = m(() => {
|
|
127
127
|
const o = {
|
|
128
128
|
course_stream: v,
|
|
129
129
|
grade: E,
|
|
130
|
-
teacher_id:
|
|
130
|
+
teacher_id: r,
|
|
131
131
|
board: L,
|
|
132
132
|
goals: R
|
|
133
133
|
};
|
|
134
134
|
l(), F(o, {
|
|
135
|
-
studentId:
|
|
135
|
+
studentId: i
|
|
136
136
|
});
|
|
137
137
|
}, [
|
|
138
138
|
L,
|
|
@@ -141,8 +141,8 @@ const be = () => {
|
|
|
141
141
|
E,
|
|
142
142
|
F,
|
|
143
143
|
v,
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
i,
|
|
145
|
+
r
|
|
146
146
|
]), K = m(() => {
|
|
147
147
|
const e = { preferences: de(A, [
|
|
148
148
|
...k,
|
|
@@ -150,7 +150,7 @@ const be = () => {
|
|
|
150
150
|
...D,
|
|
151
151
|
...O,
|
|
152
152
|
...G
|
|
153
|
-
]) }, d = { stream: oe.MATH, studentId:
|
|
153
|
+
]) }, d = { stream: oe.MATH, studentId: i };
|
|
154
154
|
l(), M(e, d);
|
|
155
155
|
}, [
|
|
156
156
|
A,
|
|
@@ -159,21 +159,21 @@ const be = () => {
|
|
|
159
159
|
D,
|
|
160
160
|
O,
|
|
161
161
|
G,
|
|
162
|
-
|
|
162
|
+
i,
|
|
163
163
|
l,
|
|
164
164
|
M
|
|
165
165
|
]), g = m(
|
|
166
166
|
(o, e) => {
|
|
167
167
|
if (!n) return;
|
|
168
|
-
const d = u === t.STUDENT_PROFILE, h = u === t.LEARNING_PLAN,
|
|
169
|
-
if ((e === t.CIRCLE_GAME || e === t.CIRCLE_PUZZLE || e === t.CIRCLE_SKILL) && (
|
|
168
|
+
const d = u === t.STUDENT_PROFILE, h = u === t.LEARNING_PLAN, a = { numberInNameError: !1 };
|
|
169
|
+
if ((e === t.CIRCLE_GAME || e === t.CIRCLE_PUZZLE || e === t.CIRCLE_SKILL) && (a.matchmakingId = W(), a.showCircleGameScreen = !0), o === "prev" && (n({
|
|
170
170
|
id: e,
|
|
171
171
|
...d && { studentProfile: void 0 },
|
|
172
172
|
...h && {
|
|
173
173
|
chapterId: void 0
|
|
174
174
|
},
|
|
175
|
-
...
|
|
176
|
-
}),
|
|
175
|
+
...a
|
|
176
|
+
}), s("both", f)), o === "next")
|
|
177
177
|
switch (u) {
|
|
178
178
|
case t.STUDENT_INFORMATION:
|
|
179
179
|
case t.SCHOOL_GOALS:
|
|
@@ -189,16 +189,16 @@ const be = () => {
|
|
|
189
189
|
K();
|
|
190
190
|
break;
|
|
191
191
|
case t.LEARNING_PLAN:
|
|
192
|
-
n({ id: e, chapterId: void 0, ...
|
|
192
|
+
n({ id: e, chapterId: void 0, ...a });
|
|
193
193
|
break;
|
|
194
194
|
default:
|
|
195
|
-
n({ id: e, ...
|
|
195
|
+
n({ id: e, ...a }), s("both", f);
|
|
196
196
|
}
|
|
197
197
|
},
|
|
198
198
|
[
|
|
199
199
|
n,
|
|
200
200
|
u,
|
|
201
|
-
|
|
201
|
+
s,
|
|
202
202
|
B,
|
|
203
203
|
w,
|
|
204
204
|
H,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-trial-session-navigation.js","sources":["../../../../src/features/trial-session/hooks/use-trial-session-navigation.ts"],"sourcesContent":["import { 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 {\n usePostTeacherAvailability,\n type TTeacherAvailabilityResponse,\n} 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';\nimport type { ITrialSessionFormFields } from '../trial-session-types';\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,\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 = useCallback(\n (_: string | null, data?: TTeacherAvailabilityResponse) => {\n const hasNotAvailable = (data ?? []).some(item => !item.is_available);\n\n if (hasNotAvailable) {\n const notAvailable = (data ?? []).filter(item => !item.is_available);\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 handleInfoMessage,\n patchTrialSession,\n preferences,\n studentId,\n studentTimezone,\n teacherId,\n updateButtonState,\n ],\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?.trim()?.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","item","reason","selectedRegularSlots","getFormattedPreferences","postTeacherAvailability","usePostTeacherAvailability","handleStudentInformation","firstName","lastName","_a","payload","handleClassPreferences","sessionList","getWeekdayAndStartTimeFromPreference","availabilityPayload","handleMileStoneBulkPost","handleStudentPreferencesPatch","getFormattedStudentPersonalizedPreference","meta","COURSE_STREAMS","handleNavigation","dir","id","isStudentProfilePage","isLearningPlanSlide","sessionWorksheetNavigation","useEffect"],"mappings":";;;;;;;;;;;AAqBA,MAAMA,KAA4B,MAAM;AAChC,QAAA;AAAA,IACJ,mBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,UAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,WAAAC;AAAA,I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pB,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,MACAoD;AAAA,MACAS;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 { 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 {\n usePostTeacherAvailability,\n type TTeacherAvailabilityResponse,\n} 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';\nimport type { ITrialSessionFormFields } from '../trial-session-types';\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,\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 = useCallback(\n (_: string | null, data?: TTeacherAvailabilityResponse) => {\n const hasNotAvailable = (data ?? []).some(item => !item.is_available);\n\n if (hasNotAvailable) {\n const notAvailable = (data ?? []).filter(item => !item.is_available);\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 handleInfoMessage,\n patchTrialSession,\n preferences,\n studentId,\n studentTimezone,\n teacherId,\n updateButtonState,\n ],\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?.trim()?.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> = { numberInNameError: false };\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","item","reason","selectedRegularSlots","getFormattedPreferences","postTeacherAvailability","usePostTeacherAvailability","handleStudentInformation","firstName","lastName","_a","payload","handleClassPreferences","sessionList","getWeekdayAndStartTimeFromPreference","availabilityPayload","handleMileStoneBulkPost","handleStudentPreferencesPatch","getFormattedStudentPersonalizedPreference","meta","COURSE_STREAMS","handleNavigation","dir","id","isStudentProfilePage","isLearningPlanSlide","sessionWorksheetNavigation","useEffect"],"mappings":";;;;;;;;;;;AAqBA,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;AAAA,IACA,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,sBAAAC,IAAuB,CAAC;AAAA,EAAA,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;AACa,IAAAD;EAAA,GAE1B,CAAChE,CAAwB,CAAC,GAEtB,EAAE,kBAAA2D,EAAiB;AAC5B;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { ButtonHTMLAttributes } from 'react';
|
|
2
|
-
import { Channel } from '@cuemath/cue-message-broker';
|
|
1
|
+
import type { ButtonHTMLAttributes } from 'react';
|
|
2
|
+
import type { Channel } from '@cuemath/cue-message-broker';
|
|
3
3
|
import { ChannelStatus } from '@cuemath/cue-message-broker';
|
|
4
4
|
import { ComponentType } from 'react';
|
|
5
|
-
import { Config } from '@lottiefiles/dotlottie-web';
|
|
5
|
+
import type { Config } from '@lottiefiles/dotlottie-web';
|
|
6
6
|
import { Context } from 'react';
|
|
7
|
-
import { Data } from '@lottiefiles/dotlottie-web';
|
|
8
|
-
import { DefaultTheme } from 'styled-components';
|
|
7
|
+
import type { Data } from '@lottiefiles/dotlottie-web';
|
|
8
|
+
import type { DefaultTheme } from 'styled-components';
|
|
9
9
|
import { DetailedHTMLProps } from 'react';
|
|
10
|
-
import { Dispatch } from 'react';
|
|
11
|
-
import { EventListener as EventListener_2 } from '@lottiefiles/dotlottie-web';
|
|
12
|
-
import { EventType } from '@lottiefiles/dotlottie-web';
|
|
10
|
+
import type { Dispatch } from 'react';
|
|
11
|
+
import type { EventListener as EventListener_2 } from '@lottiefiles/dotlottie-web';
|
|
12
|
+
import type { EventType } from '@lottiefiles/dotlottie-web';
|
|
13
13
|
import { FC } from 'react';
|
|
14
|
-
import { FormEvent } from 'react';
|
|
14
|
+
import type { FormEvent } from 'react';
|
|
15
15
|
import { ForwardRefExoticComponent } from 'react';
|
|
16
16
|
import { HTMLAttributes } from 'react';
|
|
17
|
-
import { HTMLProps } from 'react';
|
|
17
|
+
import type { HTMLProps } from 'react';
|
|
18
18
|
import { IChannelMessage } from '@cuemath/cue-message-broker';
|
|
19
|
-
import { IframeHTMLAttributes } from 'react';
|
|
20
|
-
import { ImgHTMLAttributes } from 'react';
|
|
21
|
-
import { InputHTMLAttributes } from 'react';
|
|
19
|
+
import type { IframeHTMLAttributes } from 'react';
|
|
20
|
+
import type { ImgHTMLAttributes } from 'react';
|
|
21
|
+
import type { InputHTMLAttributes } from 'react';
|
|
22
22
|
import { IProvidedProps } from 'google-maps-react';
|
|
23
23
|
import { IStyledComponent } from 'styled-components';
|
|
24
24
|
import { JSX } from 'react/jsx-runtime';
|
|
25
25
|
import { MemoExoticComponent } from 'react';
|
|
26
|
-
import { MutableRefObject } from 'react';
|
|
26
|
+
import type { MutableRefObject } from 'react';
|
|
27
27
|
import { NamedExoticComponent } from 'react';
|
|
28
28
|
import { Omit as Omit_2 } from 'google-maps-react';
|
|
29
|
-
import { PLUGIN_NAME } from '@cuemath/analytics-v2/dist/constants';
|
|
29
|
+
import type { PLUGIN_NAME } from '@cuemath/analytics-v2/dist/constants';
|
|
30
30
|
import { PropsWithChildren } from 'react';
|
|
31
31
|
import { ReactElement } from 'react';
|
|
32
32
|
import { ReactNode } from 'react';
|
|
33
33
|
import { RefAttributes } from 'react';
|
|
34
34
|
import { RefObject } from 'react';
|
|
35
35
|
import { ResourceModel } from '@cuemath/rest-api';
|
|
36
|
-
import { SetStateAction } from 'react';
|
|
36
|
+
import type { SetStateAction } from 'react';
|
|
37
37
|
import { Substitute } from 'styled-components/dist/types';
|
|
38
38
|
import { SVGProps } from 'react';
|
|
39
39
|
import { VideoHTMLAttributes } from 'react';
|
|
@@ -84,7 +84,7 @@ declare type AnimationSegment = [number, number];
|
|
|
84
84
|
export declare const AppLoader: FC<IAppLoaderProps>;
|
|
85
85
|
|
|
86
86
|
export declare const ArcButton: NamedExoticComponent<IArcButtonProps & {
|
|
87
|
-
children?: ReactNode | undefined;
|
|
87
|
+
children?: ReactNode | undefined;
|
|
88
88
|
} & RefAttributes<HTMLDivElement>>;
|
|
89
89
|
|
|
90
90
|
export declare const ArrowTooltip: NamedExoticComponent<IArrowTooltipProps>;
|
|
@@ -440,7 +440,7 @@ declare interface CueCoinIconProps extends SVGProps<SVGSVGElement> {
|
|
|
440
440
|
variant?: 'gold' | 'silver';
|
|
441
441
|
}
|
|
442
442
|
|
|
443
|
-
export declare const CuemathAppFeatures: NamedExoticComponent<
|
|
443
|
+
export declare const CuemathAppFeatures: NamedExoticComponent<{}>;
|
|
444
444
|
|
|
445
445
|
export declare const CuemathLogo: FC<SVGProps<SVGSVGElement>>;
|
|
446
446
|
|
|
@@ -688,7 +688,7 @@ declare enum GENDER {
|
|
|
688
688
|
OTHER = "OTHER"
|
|
689
689
|
}
|
|
690
690
|
|
|
691
|
-
export declare const getActiveSATSheet: (sheets: TLPARSheetData[]) => TLPARSheetData
|
|
691
|
+
export declare const getActiveSATSheet: (sheets: TLPARSheetData[]) => TLPARSheetData;
|
|
692
692
|
|
|
693
693
|
declare const getArrowTooltipConfig: IGetArrowTooltipConfig;
|
|
694
694
|
|
|
@@ -5224,7 +5224,7 @@ export declare const OTPInput: NamedExoticComponent<IOTPInputProps>;
|
|
|
5224
5224
|
export declare type OutcomeStage = keyof typeof STAGES;
|
|
5225
5225
|
|
|
5226
5226
|
export declare const OverlayLoader: MemoExoticComponent<({ isLoading }: {
|
|
5227
|
-
isLoading?: boolean | undefined;
|
|
5227
|
+
isLoading?: boolean | undefined;
|
|
5228
5228
|
}) => JSX.Element | null>;
|
|
5229
5229
|
|
|
5230
5230
|
export declare const ParentDashboard: NamedExoticComponent<IParentDashboardProps>;
|
|
@@ -5547,7 +5547,7 @@ export declare const SheetIcon: FC<SVGProps<SVGSVGElement>>;
|
|
|
5547
5547
|
export declare const SheetList: FC<ISheetsListProps>;
|
|
5548
5548
|
|
|
5549
5549
|
export declare const SheetLocked: MemoExoticComponent<({ onHomeClick }: {
|
|
5550
|
-
onHomeClick: () => void;
|
|
5550
|
+
onHomeClick: () => void;
|
|
5551
5551
|
}) => JSX.Element>;
|
|
5552
5552
|
|
|
5553
5553
|
export declare const SignUp: ({ mathGymEnrolledUser, circleEnrolledUser, circleOnLeapPremiumDays, circleUsername, countryCode, grade: defaultGrade, state, circleOnLeapPremiumEnabled, studentId, isSignUpProcessing, onCreateUser, onUpdateUser, onSignupStepsComplete, isPLAStudent, }: ISignUpProps) => JSX.Element;
|
|
@@ -7072,8 +7072,8 @@ export declare const useGetMilestoneResources: (initialId?: string, initialQuery
|
|
|
7072
7072
|
|
|
7073
7073
|
export declare const useGetPastMilestoneCount: (initialId?: string, initialQuery?: void | undefined) => {
|
|
7074
7074
|
get: (id: string, query: void, meta: TQuery_2) => Promise<void>;
|
|
7075
|
-
resource: ResourceModel<
|
|
7076
|
-
|
|
7075
|
+
resource: ResourceModel<{
|
|
7076
|
+
user_milestones_count: number;
|
|
7077
7077
|
}> | undefined;
|
|
7078
7078
|
data: {
|
|
7079
7079
|
user_milestones_count: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cuemath/leap",
|
|
3
|
-
"version": "3.5.5
|
|
3
|
+
"version": "3.5.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -89,6 +89,5 @@
|
|
|
89
89
|
"vite-plugin-dts": "4.5.4",
|
|
90
90
|
"vite-plugin-svgr": "3.2.0",
|
|
91
91
|
"vite-tsconfig-paths": "^4.2.2"
|
|
92
|
-
}
|
|
93
|
-
"packageManager": "yarn@4.9.2"
|
|
92
|
+
}
|
|
94
93
|
}
|