@cuemath/leap 2.8.63-akm-5 → 2.8.63-akm-8
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/assets/lib/lib.js +7 -0
- package/dist/assets/lib/lib.js.map +1 -0
- package/dist/features/chapters/lpar-chapter/block-section/sheet-item/rewards-n-actions/student-actions/student-actions.js +45 -46
- package/dist/features/chapters/lpar-chapter/block-section/sheet-item/rewards-n-actions/student-actions/student-actions.js.map +1 -1
- package/dist/features/chapters/lpar-chapter/block-section/sheet-item/rewards-n-actions/teacher-actions/teacher-actions.js +25 -26
- package/dist/features/chapters/lpar-chapter/block-section/sheet-item/rewards-n-actions/teacher-actions/teacher-actions.js.map +1 -1
- package/dist/features/circle-games/hooks/use-circle-sounds/use-circle-sounds.js +97 -77
- package/dist/features/circle-games/hooks/use-circle-sounds/use-circle-sounds.js.map +1 -1
- package/dist/features/cue-canvas/cue-canvas-provider.js.map +1 -1
- package/dist/features/sheets/lessons-list/lesson-item/lesson-item-cta-info.js +59 -60
- package/dist/features/sheets/lessons-list/lesson-item/lesson-item-cta-info.js.map +1 -1
- package/dist/features/sheets/resources-list/resource-item/resource-item.js +89 -90
- package/dist/features/sheets/resources-list/resource-item/resource-item.js.map +1 -1
- package/dist/features/sheets/sheets-list/sheet-item/reward-n-actions/student-actions/student-actions.js +60 -61
- package/dist/features/sheets/sheets-list/sheet-item/reward-n-actions/student-actions/student-actions.js.map +1 -1
- package/dist/features/sheets/sheets-list/sheet-item/reward-n-actions/teacher-actions/teacher-actions.js +63 -64
- package/dist/features/sheets/sheets-list/sheet-item/reward-n-actions/teacher-actions/teacher-actions.js.map +1 -1
- package/dist/features/sheets/utils/is-v3-worksheet.js +4 -14
- package/dist/features/sheets/utils/is-v3-worksheet.js.map +1 -1
- package/dist/features/worksheet/constants/events.js +3 -0
- package/dist/features/worksheet/constants/events.js.map +1 -1
- package/dist/features/worksheet/learnosity-preloader/learnosity-preloader.js +69 -50
- package/dist/features/worksheet/learnosity-preloader/learnosity-preloader.js.map +1 -1
- package/dist/index.d.ts +10 -13
- package/dist/index.js +74 -75
- package/dist/static/lib/polypad.js +34463 -0
- package/package.json +1 -1
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"lib.js","sources":["../../../src/assets/lib/lib.ts"],"sourcesContent":["declare global {\n interface Window {\n VITE_PUBLIC_URL: string;\n }\n}\n\nconst PREFIX = window.VITE_PUBLIC_URL ? window.VITE_PUBLIC_URL : '/';\n\nconst LIB = {\n POLYPAD: `${PREFIX}static/lib/polypad.js`,\n};\n\nexport { LIB };\n"],"names":["PREFIX","LIB"],"mappings":"AAMA,MAAMA,IAAS,OAAO,kBAAkB,OAAO,kBAAkB,KAE3DC,IAAM;AAAA,EACV,SAAS,GAAGD,CAAM;AACpB;"}
|
@@ -1,43 +1,42 @@
|
|
1
1
|
import { jsxs as u, jsx as e, Fragment as B } from "react/jsx-runtime";
|
2
2
|
import { useMemo as f, useCallback as $ } from "react";
|
3
|
-
import { getRewardsBadgeUrl as
|
4
|
-
import
|
5
|
-
import q from "../../../../../../ui/context
|
6
|
-
import
|
7
|
-
import
|
8
|
-
import
|
9
|
-
import K from "../../context-menu-helper/
|
10
|
-
import Q from "
|
11
|
-
import {
|
12
|
-
|
13
|
-
const we = ({ sheet: t, isLastSheet: O, onStartOrResume: m, onReview: l }) => {
|
3
|
+
import { getRewardsBadgeUrl as G } from "../../../../../../sheets/sheets-list/sheet-item/reward-n-actions/reward-n-actions-utils.js";
|
4
|
+
import Z from "../../../../../../ui/context-menu/context-menu.js";
|
5
|
+
import { useUIContext as q } from "../../../../../../ui/context/context.js";
|
6
|
+
import P from "../../../../../../ui/layout/flex-view.js";
|
7
|
+
import { checkIfPPTNodeType as H } from "../../../../utils/index.js";
|
8
|
+
import J from "../../context-menu-helper/menu-element.js";
|
9
|
+
import K from "../../context-menu-helper/target-element.js";
|
10
|
+
import { StyledButton as M, RewardImage as Q, RewardAccuracy as Y } from "../reward-n-actions-styled.js";
|
11
|
+
import { getPrimaryCtaLabel as ee } from "./student-actions-utils.js";
|
12
|
+
const ue = ({ sheet: n, isLastSheet: N, onStartOrResume: m, onReview: l }) => {
|
14
13
|
var A;
|
15
|
-
const { onEvent: w } =
|
16
|
-
permissions:
|
14
|
+
const { onEvent: w } = q(), {
|
15
|
+
permissions: O,
|
17
16
|
can_start: o,
|
18
17
|
can_resume: c,
|
19
18
|
can_review: i,
|
20
|
-
can_reattempt:
|
19
|
+
can_reattempt: S,
|
21
20
|
accuracy: y,
|
22
21
|
can_redo: j,
|
23
22
|
rewards: a,
|
24
23
|
attempt_state: _,
|
25
24
|
is_subjective: F,
|
26
|
-
is_turing:
|
25
|
+
is_turing: V,
|
27
26
|
completed_on: g,
|
28
27
|
node_type: d,
|
29
28
|
ceremony_completed_on_ts: R,
|
30
|
-
can_reattempt_block:
|
29
|
+
can_reattempt_block: W,
|
31
30
|
node_id: b,
|
32
|
-
id:
|
33
|
-
} =
|
31
|
+
id: C
|
32
|
+
} = n, { access: v } = O.can_do, t = H(d), r = V || t, h = a && G(a), U = a && ((A = a[0]) == null ? void 0 : A.performance), z = !o && !c && typeof y == "number" && !(F && _ && _ === "WAIT_FOR_REVIEW"), k = W && !g, I = o || c || j || S, L = v && I || !r && k, p = !!(i && g && !R), s = f(
|
34
33
|
() => ({
|
35
|
-
user_node_id:
|
34
|
+
user_node_id: C,
|
36
35
|
nodeId: b
|
37
36
|
}),
|
38
|
-
[b,
|
39
|
-
),
|
40
|
-
() =>
|
37
|
+
[b, C]
|
38
|
+
), T = f(
|
39
|
+
() => ee({
|
41
40
|
canStart: o,
|
42
41
|
canResume: c,
|
43
42
|
isInstructionNodeType: r,
|
@@ -48,67 +47,67 @@ const we = ({ sheet: t, isLastSheet: O, onStartOrResume: m, onReview: l }) => {
|
|
48
47
|
), x = $(() => {
|
49
48
|
if (typeof m != "function")
|
50
49
|
throw new Error("onStartOrResume is not a function");
|
51
|
-
m(
|
52
|
-
}, [m,
|
50
|
+
m(n);
|
51
|
+
}, [m, n]), E = $(() => {
|
53
52
|
if (typeof l != "function")
|
54
53
|
throw new Error("onReview is not a function");
|
55
54
|
w("clicked", {
|
56
|
-
cta:
|
55
|
+
cta: t ? "View" : "Review sheet",
|
57
56
|
...s
|
58
|
-
}), l(
|
59
|
-
}, [s,
|
57
|
+
}), l(n);
|
58
|
+
}, [s, t, l, n, w]), X = r ? !!R : i, D = f(
|
60
59
|
() => [
|
61
60
|
{
|
62
61
|
key: "review-sheet",
|
63
|
-
label:
|
62
|
+
label: t ? "View" : "Review sheet",
|
64
63
|
visible: !!i,
|
65
64
|
onClick: E
|
66
65
|
}
|
67
66
|
],
|
68
|
-
[i, E,
|
67
|
+
[i, E, t]
|
69
68
|
);
|
70
|
-
return
|
71
|
-
|
72
|
-
|
69
|
+
return t ? null : /* @__PURE__ */ u(P, { $flexDirection: "row", $alignItems: "center", $flexGap: 8, children: [
|
70
|
+
v && r ? /* @__PURE__ */ e(B, { children: (I || p) && /* @__PURE__ */ e(
|
71
|
+
M,
|
73
72
|
{
|
74
73
|
renderAs: "primary",
|
75
74
|
size: "small",
|
76
75
|
widthX: 6,
|
77
76
|
onClick: x,
|
78
|
-
label:
|
77
|
+
label: T,
|
79
78
|
analyticsProps: s
|
80
79
|
}
|
81
80
|
) }) : /* @__PURE__ */ u(B, { children: [
|
82
|
-
|
83
|
-
|
84
|
-
/* @__PURE__ */ e(
|
81
|
+
z && /* @__PURE__ */ u(P, { $justifyContent: "center", $alignItems: "center", children: [
|
82
|
+
h && /* @__PURE__ */ e(Q, { src: h, alt: "Reward" }),
|
83
|
+
/* @__PURE__ */ e(Y, { $renderAs: "eyebrow2", $align: "center", children: U || `${Math.ceil(y)}%` })
|
85
84
|
] }),
|
86
|
-
|
87
|
-
|
85
|
+
L && /* @__PURE__ */ e(
|
86
|
+
M,
|
88
87
|
{
|
89
88
|
renderAs: "primary",
|
90
89
|
size: "small",
|
91
90
|
widthX: 6,
|
92
|
-
label:
|
93
|
-
disabled:
|
91
|
+
label: T,
|
92
|
+
disabled: k,
|
94
93
|
onClick: x,
|
95
94
|
analyticsProps: s
|
96
95
|
}
|
97
96
|
)
|
98
97
|
] }),
|
99
|
-
|
100
|
-
|
98
|
+
X && /* @__PURE__ */ e(
|
99
|
+
Z,
|
101
100
|
{
|
102
|
-
targetElement: /* @__PURE__ */ e(
|
103
|
-
menuElement: /* @__PURE__ */ e(
|
101
|
+
targetElement: /* @__PURE__ */ e(K, {}),
|
102
|
+
menuElement: /* @__PURE__ */ e(J, { options: D }),
|
104
103
|
menuOffset: 5,
|
105
104
|
menuZIndex: 1,
|
106
|
-
placeTop:
|
105
|
+
placeTop: N
|
107
106
|
}
|
108
107
|
)
|
109
108
|
] });
|
110
109
|
};
|
111
110
|
export {
|
112
|
-
|
111
|
+
ue as default
|
113
112
|
};
|
114
113
|
//# sourceMappingURL=student-actions.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"student-actions.js","sources":["../../../../../../../../src/features/chapters/lpar-chapter/block-section/sheet-item/rewards-n-actions/student-actions/student-actions.tsx"],"sourcesContent":["import type { ILPARSheetCallbacks, TLPARSheetData } from '../../sheet-item-type';\n\nimport { useCallback, type FC, useMemo } from 'react';\n\nimport { getRewardsBadgeUrl } from '../../../../../../sheets/sheets-list/sheet-item/reward-n-actions/reward-n-actions-utils';\nimport
|
1
|
+
{"version":3,"file":"student-actions.js","sources":["../../../../../../../../src/features/chapters/lpar-chapter/block-section/sheet-item/rewards-n-actions/student-actions/student-actions.tsx"],"sourcesContent":["import type { ILPARSheetCallbacks, TLPARSheetData } from '../../sheet-item-type';\n\nimport { useCallback, type FC, useMemo } from 'react';\n\nimport { getRewardsBadgeUrl } from '../../../../../../sheets/sheets-list/sheet-item/reward-n-actions/reward-n-actions-utils';\nimport ContextMenu from '../../../../../../ui/context-menu/context-menu';\nimport { useUIContext } from '../../../../../../ui/context/context';\nimport FlexView from '../../../../../../ui/layout/flex-view';\nimport { checkIfPPTNodeType } from '../../../../utils';\nimport ContextMenuElement from '../../context-menu-helper/menu-element';\nimport ContextMenuTargetElement from '../../context-menu-helper/target-element';\nimport { RewardAccuracy, RewardImage, StyledButton } from '../reward-n-actions-styled';\nimport { getPrimaryCtaLabel } from './student-actions-utils';\n\ninterface IStudentActions extends ILPARSheetCallbacks {\n sheet: TLPARSheetData;\n isLastSheet: boolean;\n isClassOngoing: boolean;\n}\n\nconst StudentActions: FC<IStudentActions> = ({ sheet, isLastSheet, onStartOrResume, onReview }) => {\n const { onEvent: trackEvent } = useUIContext();\n\n const {\n permissions,\n can_start: canStart,\n can_resume: canResume,\n can_review: canReview,\n can_reattempt: canReattempt,\n accuracy,\n can_redo: canRedo,\n rewards,\n attempt_state: attemptState,\n is_subjective: isSubjective,\n is_turing: isTuring,\n completed_on: completedOn,\n node_type: nodeType,\n ceremony_completed_on_ts: ceremonyCompletedOnTS,\n can_reattempt_block: canReattemptBlock,\n node_id: nodeId,\n id: userNodeId,\n } = sheet;\n const { access } = permissions.can_do;\n const isPPTNodeType = checkIfPPTNodeType(nodeType);\n const isInstructionNodeType = isTuring || isPPTNodeType;\n const rewardsBadgeUrl = rewards && getRewardsBadgeUrl(rewards);\n\n const performance = rewards && rewards[0]?.performance;\n const isWaitingForReview = isSubjective && attemptState && attemptState === 'WAIT_FOR_REVIEW';\n const renderAccuracy =\n !canStart && !canResume && typeof accuracy === 'number' && !isWaitingForReview;\n const reattemptBlocked = canReattemptBlock && !completedOn;\n const canStartOrResume = canStart || canResume || canRedo || canReattempt;\n const renderAccuracyNPrimaryCta =\n (access && canStartOrResume) || (!isInstructionNodeType && reattemptBlocked);\n const reviewInstructionNodeType = Boolean(canReview && completedOn && !ceremonyCompletedOnTS);\n\n const analyticsProps = useMemo(\n () => ({\n user_node_id: userNodeId,\n nodeId: nodeId,\n }),\n [nodeId, userNodeId],\n );\n\n const primaryCtaLabel = useMemo(\n () =>\n getPrimaryCtaLabel({\n canStart,\n canResume,\n isInstructionNodeType,\n reviewInstructionNodeType,\n nodeType,\n }),\n [canResume, canStart, isInstructionNodeType, nodeType, reviewInstructionNodeType],\n );\n\n const handleOnActionClick = useCallback(() => {\n if (typeof onStartOrResume !== 'function') {\n throw new Error(`onStartOrResume is not a function`);\n }\n\n onStartOrResume(sheet);\n }, [onStartOrResume, sheet]);\n\n const handleOnReview = useCallback(() => {\n if (typeof onReview !== 'function') {\n throw new Error(`onReview is not a function`);\n }\n\n trackEvent('clicked', {\n cta: isPPTNodeType ? 'View' : 'Review sheet',\n ...analyticsProps,\n });\n\n onReview(sheet);\n }, [analyticsProps, isPPTNodeType, onReview, sheet, trackEvent]);\n\n const isMenuVisible = isInstructionNodeType ? Boolean(ceremonyCompletedOnTS) : canReview;\n const options = useMemo(\n () => [\n {\n key: 'review-sheet',\n label: isPPTNodeType ? 'View' : 'Review sheet',\n visible: Boolean(canReview),\n onClick: handleOnReview,\n },\n ],\n [canReview, handleOnReview, isPPTNodeType],\n );\n\n if (isPPTNodeType) return null;\n\n return (\n <FlexView $flexDirection=\"row\" $alignItems=\"center\" $flexGap={8}>\n {access && isInstructionNodeType ? (\n <>\n {(canStartOrResume || reviewInstructionNodeType) && (\n <StyledButton\n renderAs=\"primary\"\n size=\"small\"\n widthX={6}\n onClick={handleOnActionClick}\n label={primaryCtaLabel}\n analyticsProps={analyticsProps}\n />\n )}\n </>\n ) : (\n <>\n {renderAccuracy && (\n <FlexView $justifyContent=\"center\" $alignItems=\"center\">\n {rewardsBadgeUrl && <RewardImage src={rewardsBadgeUrl} alt=\"Reward\" />}\n <RewardAccuracy $renderAs=\"eyebrow2\" $align=\"center\">\n {performance || `${Math.ceil(accuracy)}%`}\n </RewardAccuracy>\n </FlexView>\n )}\n\n {renderAccuracyNPrimaryCta && (\n <StyledButton\n renderAs=\"primary\"\n size=\"small\"\n widthX={6}\n label={primaryCtaLabel}\n disabled={reattemptBlocked}\n onClick={handleOnActionClick}\n analyticsProps={analyticsProps}\n />\n )}\n </>\n )}\n\n {isMenuVisible && (\n <ContextMenu\n targetElement={<ContextMenuTargetElement />}\n menuElement={<ContextMenuElement options={options} />}\n menuOffset={5}\n menuZIndex={1}\n placeTop={isLastSheet}\n />\n )}\n </FlexView>\n );\n};\n\nexport default StudentActions;\n"],"names":["StudentActions","sheet","isLastSheet","onStartOrResume","onReview","trackEvent","useUIContext","permissions","canStart","canResume","canReview","canReattempt","accuracy","canRedo","rewards","attemptState","isSubjective","isTuring","completedOn","nodeType","ceremonyCompletedOnTS","canReattemptBlock","nodeId","userNodeId","access","isPPTNodeType","checkIfPPTNodeType","isInstructionNodeType","rewardsBadgeUrl","getRewardsBadgeUrl","performance","_a","renderAccuracy","reattemptBlocked","canStartOrResume","renderAccuracyNPrimaryCta","reviewInstructionNodeType","analyticsProps","useMemo","primaryCtaLabel","getPrimaryCtaLabel","handleOnActionClick","useCallback","handleOnReview","isMenuVisible","options","FlexView","jsx","Fragment","StyledButton","jsxs","RewardImage","RewardAccuracy","ContextMenu","ContextMenuTargetElement","ContextMenuElement"],"mappings":";;;;;;;;;;;AAoBA,MAAMA,KAAsC,CAAC,EAAE,OAAAC,GAAO,aAAAC,GAAa,iBAAAC,GAAiB,UAAAC,QAAe;;AACjG,QAAM,EAAE,SAASC,EAAW,IAAIC,EAAa,GAEvC;AAAA,IACJ,aAAAC;AAAA,IACA,WAAWC;AAAA,IACX,YAAYC;AAAA,IACZ,YAAYC;AAAA,IACZ,eAAeC;AAAA,IACf,UAAAC;AAAA,IACA,UAAUC;AAAA,IACV,SAAAC;AAAA,IACA,eAAeC;AAAA,IACf,eAAeC;AAAA,IACf,WAAWC;AAAA,IACX,cAAcC;AAAA,IACd,WAAWC;AAAA,IACX,0BAA0BC;AAAA,IAC1B,qBAAqBC;AAAA,IACrB,SAASC;AAAA,IACT,IAAIC;AAAA,EACF,IAAAtB,GACE,EAAE,QAAAuB,EAAO,IAAIjB,EAAY,QACzBkB,IAAgBC,EAAmBP,CAAQ,GAC3CQ,IAAwBV,KAAYQ,GACpCG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AAAA,QACZ,YAAY;AAAA,QACZ,UAAU3C;AAAA,MAAA;AAAA,IACZ;AAAA,EAEJ,EAAA,CAAA;AAEJ;"}
|
@@ -1,24 +1,23 @@
|
|
1
1
|
import { jsx as e, jsxs as x } from "react/jsx-runtime";
|
2
2
|
import { useMemo as E, useCallback as T } from "react";
|
3
|
-
import { NODE_TYPE as
|
3
|
+
import { NODE_TYPE as V } from "../../../../../../sheets/constants/sheet.js";
|
4
4
|
import { getRewardsBadgeUrl as G } from "../../../../../../sheets/sheets-list/sheet-item/reward-n-actions/reward-n-actions-utils.js";
|
5
|
-
import { isV3Worksheet as H } from "../../../../../../sheets/utils/is-v3-worksheet.js";
|
6
5
|
import R from "../../../../../../ui/buttons/button/button.js";
|
7
|
-
import
|
8
|
-
import { useUIContext as
|
6
|
+
import H from "../../../../../../ui/context-menu/context-menu.js";
|
7
|
+
import { useUIContext as j } from "../../../../../../ui/context/context.js";
|
9
8
|
import u from "../../../../../../ui/layout/flex-view.js";
|
10
|
-
import { checkIfIsHiddenUnlocked as
|
9
|
+
import { checkIfIsHiddenUnlocked as z, checkIfPPTNodeType as L } from "../../../../utils/index.js";
|
11
10
|
import F from "../../context-menu-helper/menu-element.js";
|
12
|
-
import
|
13
|
-
import { StyledEyeIcon as $, RewardImage as
|
14
|
-
const
|
11
|
+
import W from "../../context-menu-helper/target-element.js";
|
12
|
+
import { StyledEyeIcon as $, RewardImage as Y, RewardAccuracy as Z } from "../reward-n-actions-styled.js";
|
13
|
+
const le = ({
|
15
14
|
isLastSheet: M,
|
16
15
|
isClassOngoing: N,
|
17
|
-
sheet:
|
16
|
+
sheet: n,
|
18
17
|
...v
|
19
18
|
}) => {
|
20
19
|
var h;
|
21
|
-
const { onView: s, onMenuActionAttempt: m } = v, { onEvent: r } =
|
20
|
+
const { onView: s, onMenuActionAttempt: m } = v, { onEvent: r } = j(), {
|
22
21
|
accuracy: f,
|
23
22
|
can_teacher_review: k,
|
24
23
|
id: d,
|
@@ -29,7 +28,7 @@ const se = ({
|
|
29
28
|
completed_on: y,
|
30
29
|
can_reattempt_block: _,
|
31
30
|
node_id: g
|
32
|
-
} =
|
31
|
+
} = n, { code: p } = P.can_do, I = i === V.HIDDEN_BASIC, S = c && ((h = c[0]) == null ? void 0 : h.performance), A = c && G(c), C = L(i), B = k && typeof f == "number" && !C, U = d && !I, b = C && N && p === "IN_PROGRESS", O = !!(p && z(p)), t = E(
|
33
32
|
() => ({
|
34
33
|
node_id: g,
|
35
34
|
user_node_id: d
|
@@ -39,13 +38,13 @@ const se = ({
|
|
39
38
|
(o) => {
|
40
39
|
if (r("clicked", {
|
41
40
|
cta: o,
|
42
|
-
...
|
41
|
+
...t
|
43
42
|
}), typeof m != "function")
|
44
43
|
throw new Error("onMenuActionAttempt must be a function");
|
45
|
-
m(o,
|
44
|
+
m(o, n);
|
46
45
|
},
|
47
|
-
[
|
48
|
-
),
|
46
|
+
[t, m, n, r]
|
47
|
+
), D = E(
|
49
48
|
() => [
|
50
49
|
{
|
51
50
|
key: "change-location",
|
@@ -69,11 +68,11 @@ const se = ({
|
|
69
68
|
[_, y, w, i, l]
|
70
69
|
), a = T(
|
71
70
|
(o) => {
|
72
|
-
if (o && r(o,
|
71
|
+
if (o && r(o, t), typeof s != "function")
|
73
72
|
throw new Error("onView must be a function");
|
74
|
-
s(
|
73
|
+
s(n);
|
75
74
|
},
|
76
|
-
[
|
75
|
+
[t, s, n, r]
|
77
76
|
);
|
78
77
|
return I ? /* @__PURE__ */ e(u, { $flexGap: 8, $flexDirection: "row", $alignItems: "center", children: O ? /* @__PURE__ */ e($, { onClick: () => a("clicked") }) : /* @__PURE__ */ e(
|
79
78
|
R,
|
@@ -82,12 +81,12 @@ const se = ({
|
|
82
81
|
size: "small",
|
83
82
|
label: "Start",
|
84
83
|
onClick: a,
|
85
|
-
analyticsProps:
|
84
|
+
analyticsProps: t
|
86
85
|
}
|
87
86
|
) }) : /* @__PURE__ */ x(u, { $flexGap: 8, $flexDirection: "row", $alignItems: "center", children: [
|
88
87
|
B && /* @__PURE__ */ x(u, { $justifyContent: "center", $alignItems: "center", children: [
|
89
|
-
A && /* @__PURE__ */ e(
|
90
|
-
/* @__PURE__ */ e(
|
88
|
+
A && /* @__PURE__ */ e(Y, { src: A, alt: "Reward" }),
|
89
|
+
/* @__PURE__ */ e(Z, { $renderAs: "eyebrow2", $align: "center", children: S || `${Math.ceil(f)}%` })
|
91
90
|
] }),
|
92
91
|
k && b && /* @__PURE__ */ e(
|
93
92
|
R,
|
@@ -96,15 +95,15 @@ const se = ({
|
|
96
95
|
size: "small",
|
97
96
|
label: "Resume",
|
98
97
|
onClick: a,
|
99
|
-
analyticsProps:
|
98
|
+
analyticsProps: t
|
100
99
|
}
|
101
100
|
),
|
102
101
|
!b && /* @__PURE__ */ e($, { onClick: () => a("clicked") }),
|
103
102
|
U && /* @__PURE__ */ e(
|
104
|
-
|
103
|
+
H,
|
105
104
|
{
|
106
|
-
targetElement: /* @__PURE__ */ e(
|
107
|
-
menuElement: /* @__PURE__ */ e(F, { options:
|
105
|
+
targetElement: /* @__PURE__ */ e(W, {}),
|
106
|
+
menuElement: /* @__PURE__ */ e(F, { options: D }),
|
108
107
|
menuOffset: 5,
|
109
108
|
menuZIndex: 1,
|
110
109
|
placeTop: M
|
@@ -113,6 +112,6 @@ const se = ({
|
|
113
112
|
] });
|
114
113
|
};
|
115
114
|
export {
|
116
|
-
|
115
|
+
le as default
|
117
116
|
};
|
118
117
|
//# sourceMappingURL=teacher-actions.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"teacher-actions.js","sources":["../../../../../../../../src/features/chapters/lpar-chapter/block-section/sheet-item/rewards-n-actions/teacher-actions/teacher-actions.tsx"],"sourcesContent":["import type { ILPARSheetCallbacks, TLPARSheetData } from '../../sheet-item-type';\n\nimport { useCallback, type FC, useMemo } from 'react';\n\nimport { NODE_TYPE } from '../../../../../../sheets/constants/sheet';\nimport { getRewardsBadgeUrl } from '../../../../../../sheets/sheets-list/sheet-item/reward-n-actions/reward-n-actions-utils';\nimport
|
1
|
+
{"version":3,"file":"teacher-actions.js","sources":["../../../../../../../../src/features/chapters/lpar-chapter/block-section/sheet-item/rewards-n-actions/teacher-actions/teacher-actions.tsx"],"sourcesContent":["import type { ILPARSheetCallbacks, TLPARSheetData } from '../../sheet-item-type';\n\nimport { useCallback, type FC, useMemo } from 'react';\n\nimport { NODE_TYPE } from '../../../../../../sheets/constants/sheet';\nimport { getRewardsBadgeUrl } from '../../../../../../sheets/sheets-list/sheet-item/reward-n-actions/reward-n-actions-utils';\nimport Button from '../../../../../../ui/buttons/button/button';\nimport ContextMenu from '../../../../../../ui/context-menu/context-menu';\nimport { useUIContext } from '../../../../../../ui/context/context';\nimport FlexView from '../../../../../../ui/layout/flex-view';\nimport { checkIfIsHiddenUnlocked, checkIfPPTNodeType } from '../../../../utils';\nimport ContextMenuElement from '../../context-menu-helper/menu-element';\nimport ContextMenuTargetElement from '../../context-menu-helper/target-element';\nimport { RewardAccuracy, RewardImage, StyledEyeIcon } from '../reward-n-actions-styled';\n\nexport interface ITeacherActions extends ILPARSheetCallbacks {\n sheet: TLPARSheetData;\n isClassOngoing: boolean;\n isLastSheet: boolean;\n}\n\nconst TeacherActions: FC<ITeacherActions> = ({\n isLastSheet,\n isClassOngoing,\n sheet,\n ...restTeacherActionsProps\n}) => {\n const { onView, onMenuActionAttempt } = restTeacherActionsProps;\n\n const { onEvent: trackEvent } = useUIContext();\n\n const {\n accuracy,\n can_teacher_review: canTeacherReview,\n id: userNodeId,\n node_type: nodeType,\n permissions,\n rewards,\n is_turing: isTuring,\n completed_on: completedOn,\n can_reattempt_block: canReattemptBlock,\n node_id: nodeId,\n } = sheet;\n const { code } = permissions.can_do;\n const isHiddenNode = nodeType === NODE_TYPE.HIDDEN_BASIC;\n const performance = rewards && rewards[0]?.performance;\n const rewardsBadgeUrl = rewards && getRewardsBadgeUrl(rewards);\n const isPPTNodeType = checkIfPPTNodeType(nodeType);\n const renderAccuracy = canTeacherReview && typeof accuracy === 'number' && !isPPTNodeType;\n const isMenuVisible = userNodeId && !isHiddenNode;\n const pptNodeTypeSheetInProgress = isPPTNodeType && isClassOngoing && code === 'IN_PROGRESS';\n const isHiddenUnlocked = Boolean(code && checkIfIsHiddenUnlocked(code));\n\n const analyticsProps = useMemo(\n () => ({\n node_id: nodeId,\n user_node_id: userNodeId,\n }),\n [nodeId, userNodeId],\n );\n\n const handleOnMenuActionAttempt = useCallback(\n (action: string) => {\n trackEvent('clicked', {\n cta: action,\n ...analyticsProps,\n });\n\n if (typeof onMenuActionAttempt !== 'function') {\n throw new Error('onMenuActionAttempt must be a function');\n }\n\n onMenuActionAttempt(action, sheet);\n },\n [analyticsProps, onMenuActionAttempt, sheet, trackEvent],\n );\n\n const options = useMemo(\n () => [\n {\n key: 'change-location',\n label: 'Change Location',\n visible: true,\n onClick: () => handleOnMenuActionAttempt('change_attempt_location'),\n },\n {\n key: 'turing-option',\n label: completedOn && nodeType !== 'TURING_BASIC' ? 'Student Work Url' : 'Activity Link',\n visible: isTuring,\n onClick: () => handleOnMenuActionAttempt('turing_attempt'),\n },\n {\n key: 'allow-reattempt',\n label: 'Allow Reattempt',\n visible: canReattemptBlock,\n onClick: () => handleOnMenuActionAttempt('allow_reattempt'),\n },\n ],\n [canReattemptBlock, completedOn, isTuring, nodeType, handleOnMenuActionAttempt],\n );\n\n const handleOnView = useCallback(\n (action?: string) => {\n if (action) {\n trackEvent(action, analyticsProps);\n }\n\n if (typeof onView !== 'function') {\n throw new Error('onView must be a function');\n }\n\n onView(sheet);\n },\n [analyticsProps, onView, sheet, trackEvent],\n );\n\n if (isHiddenNode) {\n return (\n <FlexView $flexGap={8} $flexDirection=\"row\" $alignItems=\"center\">\n {isHiddenUnlocked ? (\n <StyledEyeIcon onClick={() => handleOnView('clicked')} />\n ) : (\n <Button\n renderAs=\"primary\"\n size=\"small\"\n label=\"Start\"\n onClick={handleOnView}\n analyticsProps={analyticsProps}\n />\n )}\n </FlexView>\n );\n }\n\n return (\n <FlexView $flexGap={8} $flexDirection=\"row\" $alignItems=\"center\">\n {renderAccuracy && (\n <FlexView $justifyContent=\"center\" $alignItems=\"center\">\n {rewardsBadgeUrl && <RewardImage src={rewardsBadgeUrl} alt=\"Reward\" />}\n <RewardAccuracy $renderAs=\"eyebrow2\" $align=\"center\">\n {performance || `${Math.ceil(accuracy)}%`}\n </RewardAccuracy>\n </FlexView>\n )}\n\n {canTeacherReview && pptNodeTypeSheetInProgress && (\n <Button\n renderAs=\"primary\"\n size=\"small\"\n label=\"Resume\"\n onClick={handleOnView}\n analyticsProps={analyticsProps}\n />\n )}\n\n {!pptNodeTypeSheetInProgress && <StyledEyeIcon onClick={() => handleOnView('clicked')} />}\n\n {isMenuVisible && (\n <ContextMenu\n targetElement={<ContextMenuTargetElement />}\n menuElement={<ContextMenuElement options={options} />}\n menuOffset={5}\n menuZIndex={1}\n placeTop={isLastSheet}\n />\n )}\n </FlexView>\n );\n};\n\nexport default TeacherActions;\n"],"names":["TeacherActions","isLastSheet","isClassOngoing","sheet","restTeacherActionsProps","onView","onMenuActionAttempt","trackEvent","useUIContext","accuracy","canTeacherReview","userNodeId","nodeType","permissions","rewards","isTuring","completedOn","canReattemptBlock","nodeId","code","isHiddenNode","NODE_TYPE","performance","_a","rewardsBadgeUrl","getRewardsBadgeUrl","isPPTNodeType","checkIfPPTNodeType","renderAccuracy","isMenuVisible","pptNodeTypeSheetInProgress","isHiddenUnlocked","checkIfIsHiddenUnlocked","analyticsProps","useMemo","handleOnMenuActionAttempt","useCallback","action","options","handleOnView","FlexView","jsx","StyledEyeIcon","Button","jsxs","RewardImage","RewardAccuracy","ContextMenu","ContextMenuTargetElement","ContextMenuElement"],"mappings":";;;;;;;;;;;;AAqBA,MAAMA,KAAsC,CAAC;AAAA,EAC3C,aAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACL,MAAM;;AACE,QAAA,EAAE,QAAAC,GAAQ,qBAAAC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DC,KAAoBoB,KACnB,gBAAAW;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,UAAS;AAAA,QACT,MAAK;AAAA,QACL,OAAM;AAAA,QACN,SAASJ;AAAA,QACT,gBAAAN;AAAA,MAAA;AAAA,IACF;AAAA,IAGD,CAACH,KAA+B,gBAAAW,EAAAC,GAAA,EAAc,SAAS,MAAMH,EAAa,SAAS,GAAG;AAAA,IAEtFV,KACC,gBAAAY;AAAA,MAACM;AAAA,MAAA;AAAA,QACC,iCAAgBC,GAAyB,EAAA;AAAA,QACzC,aAAc,gBAAAP,EAAAQ,GAAA,EAAmB,SAAAX,EAAkB,CAAA;AAAA,QACnD,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,UAAUrC;AAAA,MAAA;AAAA,IACZ;AAAA,EAEJ,EAAA,CAAA;AAEJ;"}
|
@@ -1,96 +1,116 @@
|
|
1
|
-
import { useCallback as
|
2
|
-
import { CircleSoundKeyMapper as
|
3
|
-
import { CircleSoundKey as
|
4
|
-
let
|
5
|
-
const
|
6
|
-
[
|
7
|
-
[
|
8
|
-
[
|
9
|
-
[
|
10
|
-
[
|
11
|
-
[
|
12
|
-
[
|
13
|
-
[
|
14
|
-
[
|
15
|
-
[
|
16
|
-
[
|
17
|
-
[
|
18
|
-
[
|
19
|
-
[
|
20
|
-
[
|
21
|
-
[
|
22
|
-
[
|
23
|
-
[
|
24
|
-
[
|
25
|
-
[
|
26
|
-
[
|
27
|
-
[
|
28
|
-
[
|
29
|
-
},
|
30
|
-
const
|
31
|
-
if (!
|
32
|
-
const e = new Audio(
|
33
|
-
|
1
|
+
import { useCallback as i, useRef as C, useEffect as A } from "react";
|
2
|
+
import { CircleSoundKeyMapper as O, SWIPE_SOUND_ORDER as E } from "./constants.js";
|
3
|
+
import { CircleSoundKey as n } from "./use-circle-sounds-enums.js";
|
4
|
+
let d = 0;
|
5
|
+
const u = {
|
6
|
+
[n.BACKGROUND]: null,
|
7
|
+
[n.BACKGROUND_RUSHHOUR]: null,
|
8
|
+
[n.TUTORIAL]: null,
|
9
|
+
[n.SWIPE_01]: null,
|
10
|
+
[n.SWIPE_02]: null,
|
11
|
+
[n.SWIPE_03]: null,
|
12
|
+
[n.SWIPE_04]: null,
|
13
|
+
[n.SWIPE_DOWN]: null,
|
14
|
+
[n.TOGGLE]: null,
|
15
|
+
[n.POINTS_AWARDED]: null,
|
16
|
+
[n.POINTS_ADDED]: null,
|
17
|
+
[n.GAME_CARD_CLICK]: null,
|
18
|
+
[n.CLOCK_IN]: null,
|
19
|
+
[n.CLOCK_OUT]: null,
|
20
|
+
[n.ACCURACY_IN]: null,
|
21
|
+
[n.ACCURACY_OUT]: null,
|
22
|
+
[n.STREAK_IN]: null,
|
23
|
+
[n.STREAK_OUT]: null,
|
24
|
+
[n.ACCURACY_INTRO]: null,
|
25
|
+
[n.ACCURACY_TARGET]: null,
|
26
|
+
[n.TIME_INTRO]: null,
|
27
|
+
[n.TIME_TARGET]: null,
|
28
|
+
[n.METER_FILL]: null
|
29
|
+
}, I = {}, D = () => {
|
30
|
+
const r = i((l) => {
|
31
|
+
if (!u[l]) {
|
32
|
+
const e = new Audio(O[l]);
|
33
|
+
u[l] = e;
|
34
34
|
}
|
35
|
-
}, []),
|
36
|
-
document.visibilityState === "hidden" ? Object.keys(
|
37
|
-
const e =
|
38
|
-
e && !e.paused && (e.pause(),
|
39
|
-
}) : document.visibilityState === "visible" && (
|
40
|
-
const e =
|
35
|
+
}, []), f = C(/* @__PURE__ */ new Set()), p = C({}), v = i(() => {
|
36
|
+
document.visibilityState === "hidden" ? Object.keys(u).forEach((l) => {
|
37
|
+
const e = u[l];
|
38
|
+
e && !e.paused && (e.pause(), f.current.add(l));
|
39
|
+
}) : document.visibilityState === "visible" && (f.current.forEach((l) => {
|
40
|
+
const e = u[l];
|
41
41
|
e == null || e.play();
|
42
|
-
}),
|
43
|
-
}, [])
|
42
|
+
}), f.current.clear());
|
43
|
+
}, []);
|
44
|
+
A(() => {
|
45
|
+
document.addEventListener("visibilitychange", v);
|
46
|
+
const l = p.current;
|
47
|
+
return () => {
|
48
|
+
document.removeEventListener("visibilitychange", v);
|
49
|
+
for (const e of Object.values(l))
|
50
|
+
e != null && clearInterval(e);
|
51
|
+
};
|
52
|
+
}, [v]);
|
53
|
+
const S = i(() => {
|
44
54
|
var e;
|
45
|
-
|
46
|
-
|
55
|
+
E.forEach((o) => {
|
56
|
+
r(o);
|
47
57
|
});
|
48
|
-
const
|
49
|
-
|
50
|
-
}, [
|
58
|
+
const l = E[d] || n.SWIPE_01;
|
59
|
+
d < E.length - 1 ? d++ : d = 0, (e = u[l]) == null || e.play();
|
60
|
+
}, [r]), m = i(() => {
|
51
61
|
var e;
|
52
|
-
return
|
53
|
-
}, [
|
54
|
-
(
|
55
|
-
|
56
|
-
const
|
57
|
-
if (!
|
58
|
-
if (
|
59
|
-
|
60
|
-
const a =
|
61
|
-
|
62
|
+
return r(n.TOGGLE), (e = u[n.TOGGLE]) == null ? void 0 : e.play();
|
63
|
+
}, [r]), _ = i(
|
64
|
+
(l, e = !0, o = !1) => {
|
65
|
+
r(l);
|
66
|
+
const t = u[l];
|
67
|
+
if (!t) return;
|
68
|
+
if (t.loop = o, e) {
|
69
|
+
t.volume = 1;
|
70
|
+
const a = t.play();
|
71
|
+
I[l] = a;
|
62
72
|
return;
|
63
73
|
}
|
64
|
-
|
65
|
-
const
|
66
|
-
|
67
|
-
const
|
68
|
-
if (!
|
69
|
-
|
70
|
-
|
74
|
+
t.volume = 0;
|
75
|
+
const s = t.play();
|
76
|
+
I[l] = s;
|
77
|
+
const c = setInterval(() => {
|
78
|
+
if (!t) {
|
79
|
+
clearInterval(c);
|
80
|
+
return;
|
81
|
+
}
|
82
|
+
const a = t.volume || 0;
|
83
|
+
a < 1 ? t.volume = Math.min(a + 0.1, 1) : clearInterval(c);
|
71
84
|
}, 100);
|
72
|
-
return
|
85
|
+
return p.current[l] = c, t;
|
73
86
|
},
|
74
|
-
[
|
75
|
-
), R =
|
76
|
-
var
|
77
|
-
const
|
78
|
-
|
87
|
+
[r]
|
88
|
+
), R = i((l, e = !0) => {
|
89
|
+
var t;
|
90
|
+
const o = u[l];
|
91
|
+
I[l] !== void 0 && ((t = I[l]) == null || t.then(() => {
|
92
|
+
if (!o) return;
|
79
93
|
if (e) {
|
80
|
-
|
94
|
+
o.pause();
|
81
95
|
return;
|
82
96
|
}
|
83
|
-
const
|
84
|
-
if (!
|
85
|
-
|
86
|
-
|
97
|
+
const s = setInterval(() => {
|
98
|
+
if (!o) {
|
99
|
+
clearInterval(s);
|
100
|
+
return;
|
101
|
+
}
|
102
|
+
const c = o.volume || 0;
|
103
|
+
c - 0.1 <= 0 ? (o.volume = 0, o.pause(), clearInterval(s)) : o.volume = c - 0.1;
|
87
104
|
}, 100);
|
105
|
+
p.current[l] = s;
|
106
|
+
}).catch((s) => {
|
107
|
+
console.log("sound not playing", s);
|
88
108
|
}));
|
89
109
|
}, []);
|
90
|
-
return { playSwipSound:
|
110
|
+
return { playSwipSound: S, play: _, stop: R, playButtonSound: m };
|
91
111
|
};
|
92
112
|
export {
|
93
|
-
|
94
|
-
|
113
|
+
u as soundMapper,
|
114
|
+
D as useCircleSounds
|
95
115
|
};
|
96
116
|
//# sourceMappingURL=use-circle-sounds.js.map
|