@cuemath/leap 3.5.4-mb → 3.5.4-mb-2
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/stickers/hooks/use-handle-sticker-send/use-handle-sticker-send.js +46 -0
- package/dist/features/stickers/hooks/use-handle-sticker-send/use-handle-sticker-send.js.map +1 -0
- package/dist/features/stickers/sticker-selector/sticker-selector.js +57 -56
- package/dist/features/stickers/sticker-selector/sticker-selector.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-sidebar/question-guide.js +7 -7
- package/dist/features/worksheet/worksheet/worksheet-sidebar/question-guide.js.map +1 -1
- package/dist/index.d.ts +31 -25
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/features/stickers/hooks/use-handle-sticker-send.js +0 -44
- package/dist/features/stickers/hooks/use-handle-sticker-send.js.map +0 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useCallback as m } from "react";
|
|
2
|
+
import E from "../../../communication/hooks/use-inclass-message-broker/use-inclass-message-broker.js";
|
|
3
|
+
import { useUIContext as d } from "../../../ui/context/context.js";
|
|
4
|
+
import { STICKERS_ANALYTICS_EVENT as p } from "../../stickers-analytics-events.js";
|
|
5
|
+
import { useStickers as g } from "../../stickers-effects/hooks/use-stickers.js";
|
|
6
|
+
import { useStickersErrorLogger as k } from "../use-stickers-error-logger.js";
|
|
7
|
+
const u = (t, s) => {
|
|
8
|
+
const { publish: e } = E({
|
|
9
|
+
studentClassroomId: t
|
|
10
|
+
}), { onEvent: c } = d(), n = k(), { showSticker: a } = g();
|
|
11
|
+
return m(
|
|
12
|
+
(o, S) => {
|
|
13
|
+
const i = {
|
|
14
|
+
classroom_id: t,
|
|
15
|
+
sticker: o.id,
|
|
16
|
+
teacherClassroomId: s.teacherClassroomId,
|
|
17
|
+
triggerType: s.triggerType
|
|
18
|
+
};
|
|
19
|
+
try {
|
|
20
|
+
const r = {
|
|
21
|
+
message: {
|
|
22
|
+
data: {
|
|
23
|
+
selectedSticker: {
|
|
24
|
+
id: o.id,
|
|
25
|
+
name: o.name
|
|
26
|
+
},
|
|
27
|
+
effectId: S
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
type: "STICKERS"
|
|
31
|
+
};
|
|
32
|
+
a(r), e == null || e({
|
|
33
|
+
eventName: "STICKERS",
|
|
34
|
+
eventPayload: r
|
|
35
|
+
}), c(p.STICKER_SENT, i);
|
|
36
|
+
} catch (r) {
|
|
37
|
+
n(r, { baseEventData: i });
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
[n, e, a, t, c]
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
u as useHandleStickerSend
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=use-handle-sticker-send.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-handle-sticker-send.js","sources":["../../../../../src/features/stickers/hooks/use-handle-sticker-send/use-handle-sticker-send.tsx"],"sourcesContent":["import { useCallback } from 'react';\n\nimport useInClassMessageBroker from '../../../communication/hooks/use-inclass-message-broker/use-inclass-message-broker';\nimport { useUIContext } from '../../../ui/context/context';\nimport { STICKERS_ANALYTICS_EVENT } from '../../stickers-analytics-events';\nimport { useStickers } from '../../stickers-effects/hooks/use-stickers';\nimport type { IStickerData, TStickerAnimationEffects, TStickersPayload } from '../../stickers-types';\nimport { useStickersErrorLogger } from '../use-stickers-error-logger';\nimport { TUseStickerSendMetaData } from './use-handle-sticker-send-types';\n\nexport const useHandleStickerSend = (studentClassroomId: string, metaData: TUseStickerSendMetaData) => {\n const { publish } = useInClassMessageBroker({\n studentClassroomId,\n });\n\n const { onEvent: trackEvent } = useUIContext();\n const logError = useStickersErrorLogger();\n\n const { showSticker } = useStickers();\n\n const sendSticker = useCallback(\n (sticker: IStickerData, effect: TStickerAnimationEffects) => {\n const baseEventData = {\n classroom_id: studentClassroomId,\n sticker: sticker.id,\n teacherClassroomId: metaData.teacherClassroomId,\n triggerType: metaData.triggerType\n };\n\n try {\n const payload: TStickersPayload = {\n message: {\n data: {\n selectedSticker: {\n id: sticker.id,\n name: sticker.name,\n },\n effectId: effect,\n },\n },\n type: 'STICKERS',\n };\n\n showSticker(payload);\n\n publish?.({\n eventName: 'STICKERS',\n eventPayload: payload,\n });\n\n trackEvent(STICKERS_ANALYTICS_EVENT.STICKER_SENT, baseEventData);\n } catch (error) {\n logError(error, { baseEventData });\n }\n },\n [logError, publish, showSticker, studentClassroomId, trackEvent],\n );\n\n return sendSticker;\n};\n"],"names":["useHandleStickerSend","studentClassroomId","metaData","publish","useInClassMessageBroker","trackEvent","useUIContext","logError","useStickersErrorLogger","showSticker","useStickers","useCallback","sticker","effect","baseEventData","payload","STICKERS_ANALYTICS_EVENT","error"],"mappings":";;;;;;AAUa,MAAAA,IAAuB,CAACC,GAA4BC,MAAsC;AAC/F,QAAA,EAAE,SAAAC,EAAQ,IAAIC,EAAwB;AAAA,IAC1C,oBAAAH;AAAA,EAAA,CACD,GAEK,EAAE,SAASI,EAAW,IAAIC,EAAa,GACvCC,IAAWC,KAEX,EAAE,aAAAC,MAAgBC;AAwCjB,SAtCaC;AAAA,IAClB,CAACC,GAAuBC,MAAqC;AAC3D,YAAMC,IAAgB;AAAA,QACpB,cAAcb;AAAA,QACd,SAASW,EAAQ;AAAA,QACjB,oBAAoBV,EAAS;AAAA,QAC7B,aAAaA,EAAS;AAAA,MAAA;AAGpB,UAAA;AACF,cAAMa,IAA4B;AAAA,UAChC,SAAS;AAAA,YACP,MAAM;AAAA,cACJ,iBAAiB;AAAA,gBACf,IAAIH,EAAQ;AAAA,gBACZ,MAAMA,EAAQ;AAAA,cAChB;AAAA,cACA,UAAUC;AAAA,YACZ;AAAA,UACF;AAAA,UACA,MAAM;AAAA,QAAA;AAGR,QAAAJ,EAAYM,CAAO,GAETZ,KAAA,QAAAA,EAAA;AAAA,UACR,WAAW;AAAA,UACX,cAAcY;AAAA,QAAA,IAGLV,EAAAW,EAAyB,cAAcF,CAAa;AAAA,eACxDG,GAAO;AACL,QAAAV,EAAAU,GAAO,EAAE,eAAAH,EAAA,CAAe;AAAA,MACnC;AAAA,IACF;AAAA,IACA,CAACP,GAAUJ,GAASM,GAAaR,GAAoBI,CAAU;AAAA,EAAA;AAInE;"}
|
|
@@ -1,49 +1,50 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { memo as
|
|
3
|
-
import
|
|
4
|
-
import { useHandleStickerSend as
|
|
5
|
-
import
|
|
6
|
-
import { TriggerWrapper as
|
|
7
|
-
const
|
|
2
|
+
import { memo as j, useState as B, useCallback as G, useMemo as H } from "react";
|
|
3
|
+
import K from "../../ui/arrow-tooltip/arrow-tooltip.js";
|
|
4
|
+
import { useHandleStickerSend as R } from "../hooks/use-handle-sticker-send/use-handle-sticker-send.js";
|
|
5
|
+
import _ from "./comps/stiker-selector-grid/sticker-selector-grid.js";
|
|
6
|
+
import { TriggerWrapper as $ } from "./sticker-selector-styled.js";
|
|
7
|
+
const q = ({
|
|
8
8
|
triggerNode: d,
|
|
9
9
|
studentClassroomId: c,
|
|
10
10
|
gridConfig: m,
|
|
11
11
|
tooltipConfig: p,
|
|
12
|
-
visible: f
|
|
12
|
+
visible: f,
|
|
13
|
+
metaData: u
|
|
13
14
|
}) => {
|
|
14
15
|
const { columns: e = 4, gap: i = 8, stickerSize: s = 48 } = m, {
|
|
15
|
-
isAnimated:
|
|
16
|
-
arrowColor:
|
|
17
|
-
arrowSize:
|
|
18
|
-
arrowXCoOrdinates:
|
|
19
|
-
arrowYCoOrdinates:
|
|
20
|
-
backgroundColor:
|
|
21
|
-
borderColor:
|
|
22
|
-
position:
|
|
23
|
-
renderAs:
|
|
24
|
-
textVariant:
|
|
25
|
-
tooltipOffset:
|
|
26
|
-
tooltipXCoOrdinates:
|
|
27
|
-
tooltipYCoOrdinates:
|
|
28
|
-
width:
|
|
29
|
-
widthX:
|
|
30
|
-
zIndex:
|
|
31
|
-
parentWidth:
|
|
32
|
-
isBlocking:
|
|
33
|
-
} = p, [o, a] =
|
|
34
|
-
(
|
|
16
|
+
isAnimated: S,
|
|
17
|
+
arrowColor: C,
|
|
18
|
+
arrowSize: b,
|
|
19
|
+
arrowXCoOrdinates: h,
|
|
20
|
+
arrowYCoOrdinates: k,
|
|
21
|
+
backgroundColor: w,
|
|
22
|
+
borderColor: T,
|
|
23
|
+
position: g = "bottom",
|
|
24
|
+
renderAs: x = "primary",
|
|
25
|
+
textVariant: O,
|
|
26
|
+
tooltipOffset: y,
|
|
27
|
+
tooltipXCoOrdinates: E,
|
|
28
|
+
tooltipYCoOrdinates: I,
|
|
29
|
+
width: z,
|
|
30
|
+
widthX: A,
|
|
31
|
+
zIndex: M,
|
|
32
|
+
parentWidth: X,
|
|
33
|
+
isBlocking: D = !1
|
|
34
|
+
} = p, [o, a] = B(!1), r = R(c, u), n = G(
|
|
35
|
+
(V) => {
|
|
35
36
|
if (o) return;
|
|
36
|
-
const l = ["burst-from-edges", "pop-expand", "float-up", "fall-down"],
|
|
37
|
-
r == null || r(
|
|
38
|
-
const
|
|
37
|
+
const l = ["burst-from-edges", "pop-expand", "float-up", "fall-down"], W = l[Math.floor(Math.random() * l.length)];
|
|
38
|
+
r == null || r(V, W), a(!0);
|
|
39
|
+
const Y = setTimeout(() => {
|
|
39
40
|
a(!1);
|
|
40
41
|
}, 5e3);
|
|
41
|
-
return () => clearTimeout(
|
|
42
|
+
return () => clearTimeout(Y);
|
|
42
43
|
},
|
|
43
44
|
[r, o]
|
|
44
|
-
),
|
|
45
|
+
), F = H(
|
|
45
46
|
() => /* @__PURE__ */ t(
|
|
46
|
-
|
|
47
|
+
_,
|
|
47
48
|
{
|
|
48
49
|
columns: e,
|
|
49
50
|
gap: i,
|
|
@@ -55,34 +56,34 @@ const $ = ({
|
|
|
55
56
|
[e, i, s, n, o]
|
|
56
57
|
);
|
|
57
58
|
return /* @__PURE__ */ t(
|
|
58
|
-
|
|
59
|
+
K,
|
|
59
60
|
{
|
|
60
61
|
alwaysVisible: !0,
|
|
61
62
|
hidden: !f,
|
|
62
|
-
tooltipItem:
|
|
63
|
-
renderAs:
|
|
64
|
-
position:
|
|
65
|
-
isBlocking:
|
|
66
|
-
isAnimated:
|
|
67
|
-
zIndex:
|
|
68
|
-
width:
|
|
69
|
-
widthX:
|
|
70
|
-
parentWidth:
|
|
71
|
-
backgroundColor:
|
|
72
|
-
borderColor:
|
|
73
|
-
textVariant:
|
|
74
|
-
tooltipOffset:
|
|
75
|
-
arrowColor:
|
|
76
|
-
arrowSize:
|
|
77
|
-
arrowXCoOrdinates:
|
|
78
|
-
arrowYCoOrdinates:
|
|
79
|
-
tooltipXCoOrdinates:
|
|
80
|
-
tooltipYCoOrdinates:
|
|
81
|
-
children: /* @__PURE__ */ t(
|
|
63
|
+
tooltipItem: F,
|
|
64
|
+
renderAs: x,
|
|
65
|
+
position: g,
|
|
66
|
+
isBlocking: D,
|
|
67
|
+
isAnimated: S,
|
|
68
|
+
zIndex: M,
|
|
69
|
+
width: z,
|
|
70
|
+
widthX: A,
|
|
71
|
+
parentWidth: X,
|
|
72
|
+
backgroundColor: w,
|
|
73
|
+
borderColor: T,
|
|
74
|
+
textVariant: O,
|
|
75
|
+
tooltipOffset: y,
|
|
76
|
+
arrowColor: C,
|
|
77
|
+
arrowSize: b,
|
|
78
|
+
arrowXCoOrdinates: h,
|
|
79
|
+
arrowYCoOrdinates: k,
|
|
80
|
+
tooltipXCoOrdinates: E,
|
|
81
|
+
tooltipYCoOrdinates: I,
|
|
82
|
+
children: /* @__PURE__ */ t($, { $disabled: o, children: d })
|
|
82
83
|
}
|
|
83
84
|
);
|
|
84
|
-
},
|
|
85
|
+
}, U = j(q);
|
|
85
86
|
export {
|
|
86
|
-
|
|
87
|
+
U as default
|
|
87
88
|
};
|
|
88
89
|
//# sourceMappingURL=sticker-selector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sticker-selector.js","sources":["../../../../src/features/stickers/sticker-selector/sticker-selector.tsx"],"sourcesContent":["import { memo, useMemo, useState, useCallback, type FC } from 'react';\n\nimport ArrowTooltip from '../../ui/arrow-tooltip/arrow-tooltip';\nimport { useHandleStickerSend } from '../hooks/use-handle-sticker-send';\nimport type { IStickerData, TStickerAnimationEffects } from '../stickers-types';\nimport StickerSelectorGrid from './comps/stiker-selector-grid/sticker-selector-grid';\nimport * as Styled from './sticker-selector-styled';\nimport type { IStickerSelectorProps } from './sticker-selector-types';\n\nconst StickerSelector: FC<IStickerSelectorProps> = ({\n triggerNode,\n studentClassroomId,\n gridConfig,\n tooltipConfig,\n visible,\n}) => {\n const { columns = 4, gap = 8, stickerSize = 48 } = gridConfig;\n const {\n isAnimated,\n arrowColor,\n arrowSize,\n arrowXCoOrdinates,\n arrowYCoOrdinates,\n backgroundColor,\n borderColor,\n position = 'bottom',\n renderAs = 'primary',\n textVariant,\n tooltipOffset,\n tooltipXCoOrdinates,\n tooltipYCoOrdinates,\n width,\n widthX,\n zIndex,\n parentWidth,\n isBlocking = false,\n } = tooltipConfig;\n\n const [isTemporarilyDisabled, setIsTemporarilyDisabled] = useState(false);\n\n const sendSticker = useHandleStickerSend(studentClassroomId);\n\n const handleStickerSend = useCallback(\n (sticker: IStickerData) => {\n if (isTemporarilyDisabled) return;\n\n const STICKER_EFFECTS = ['burst-from-edges', 'pop-expand', 'float-up', 'fall-down'] as const;\n\n const randomEffect: TStickerAnimationEffects =\n STICKER_EFFECTS[Math.floor(Math.random() * STICKER_EFFECTS.length)]!;\n\n sendSticker?.(sticker, randomEffect);\n setIsTemporarilyDisabled(true);\n\n const timeout = setTimeout(() => {\n setIsTemporarilyDisabled(false);\n }, 5000);\n\n return () => clearTimeout(timeout);\n },\n [sendSticker, isTemporarilyDisabled],\n );\n\n const tooltipItem = useMemo(\n () => (\n <StickerSelectorGrid\n columns={columns}\n gap={gap}\n stickerSize={stickerSize}\n onStickerClick={handleStickerSend}\n disabled={isTemporarilyDisabled}\n />\n ),\n [columns, gap, stickerSize, handleStickerSend, isTemporarilyDisabled],\n );\n\n return (\n <ArrowTooltip\n alwaysVisible\n hidden={!visible}\n tooltipItem={tooltipItem}\n renderAs={renderAs}\n position={position}\n isBlocking={isBlocking}\n isAnimated={isAnimated}\n zIndex={zIndex}\n width={width}\n widthX={widthX}\n parentWidth={parentWidth}\n backgroundColor={backgroundColor}\n borderColor={borderColor}\n textVariant={textVariant}\n tooltipOffset={tooltipOffset}\n arrowColor={arrowColor}\n arrowSize={arrowSize}\n arrowXCoOrdinates={arrowXCoOrdinates}\n arrowYCoOrdinates={arrowYCoOrdinates}\n tooltipXCoOrdinates={tooltipXCoOrdinates}\n tooltipYCoOrdinates={tooltipYCoOrdinates}\n >\n <Styled.TriggerWrapper $disabled={isTemporarilyDisabled}>{triggerNode}</Styled.TriggerWrapper>\n </ArrowTooltip>\n );\n};\n\nexport default memo(StickerSelector);\n"],"names":["StickerSelector","triggerNode","studentClassroomId","gridConfig","tooltipConfig","visible","columns","gap","stickerSize","isAnimated","arrowColor","arrowSize","arrowXCoOrdinates","arrowYCoOrdinates","backgroundColor","borderColor","position","renderAs","textVariant","tooltipOffset","tooltipXCoOrdinates","tooltipYCoOrdinates","width","widthX","zIndex","parentWidth","isBlocking","isTemporarilyDisabled","setIsTemporarilyDisabled","useState","sendSticker","useHandleStickerSend","handleStickerSend","useCallback","sticker","STICKER_EFFECTS","randomEffect","timeout","tooltipItem","useMemo","jsx","StickerSelectorGrid","ArrowTooltip","Styled.TriggerWrapper","stickerSelector","memo"],"mappings":";;;;;;AASA,MAAMA,IAA6C,CAAC;AAAA,EAClD,aAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,eAAAC;AAAA,EACA,SAAAC;AACF,MAAM;AACJ,QAAM,EAAE,SAAAC,IAAU,GAAG,KAAAC,IAAM,GAAG,aAAAC,IAAc,GAAO,
|
|
1
|
+
{"version":3,"file":"sticker-selector.js","sources":["../../../../src/features/stickers/sticker-selector/sticker-selector.tsx"],"sourcesContent":["import { memo, useMemo, useState, useCallback, type FC } from 'react';\n\nimport ArrowTooltip from '../../ui/arrow-tooltip/arrow-tooltip';\nimport { useHandleStickerSend } from '../hooks/use-handle-sticker-send/use-handle-sticker-send';\nimport type { IStickerData, TStickerAnimationEffects } from '../stickers-types';\nimport StickerSelectorGrid from './comps/stiker-selector-grid/sticker-selector-grid';\nimport * as Styled from './sticker-selector-styled';\nimport type { IStickerSelectorProps } from './sticker-selector-types';\n\nconst StickerSelector: FC<IStickerSelectorProps> = ({\n triggerNode,\n studentClassroomId,\n gridConfig,\n tooltipConfig,\n visible,\n metaData,\n}) => {\n const { columns = 4, gap = 8, stickerSize = 48 } = gridConfig;\n const {\n isAnimated,\n arrowColor,\n arrowSize,\n arrowXCoOrdinates,\n arrowYCoOrdinates,\n backgroundColor,\n borderColor,\n position = 'bottom',\n renderAs = 'primary',\n textVariant,\n tooltipOffset,\n tooltipXCoOrdinates,\n tooltipYCoOrdinates,\n width,\n widthX,\n zIndex,\n parentWidth,\n isBlocking = false,\n } = tooltipConfig;\n\n const [isTemporarilyDisabled, setIsTemporarilyDisabled] = useState(false);\n\n const sendSticker = useHandleStickerSend(studentClassroomId, metaData);\n\n const handleStickerSend = useCallback(\n (sticker: IStickerData) => {\n if (isTemporarilyDisabled) return;\n\n const STICKER_EFFECTS = ['burst-from-edges', 'pop-expand', 'float-up', 'fall-down'] as const;\n\n const randomEffect: TStickerAnimationEffects =\n STICKER_EFFECTS[Math.floor(Math.random() * STICKER_EFFECTS.length)]!;\n\n sendSticker?.(sticker, randomEffect);\n setIsTemporarilyDisabled(true);\n\n const timeout = setTimeout(() => {\n setIsTemporarilyDisabled(false);\n }, 5000);\n\n return () => clearTimeout(timeout);\n },\n [sendSticker, isTemporarilyDisabled],\n );\n\n const tooltipItem = useMemo(\n () => (\n <StickerSelectorGrid\n columns={columns}\n gap={gap}\n stickerSize={stickerSize}\n onStickerClick={handleStickerSend}\n disabled={isTemporarilyDisabled}\n />\n ),\n [columns, gap, stickerSize, handleStickerSend, isTemporarilyDisabled],\n );\n\n return (\n <ArrowTooltip\n alwaysVisible\n hidden={!visible}\n tooltipItem={tooltipItem}\n renderAs={renderAs}\n position={position}\n isBlocking={isBlocking}\n isAnimated={isAnimated}\n zIndex={zIndex}\n width={width}\n widthX={widthX}\n parentWidth={parentWidth}\n backgroundColor={backgroundColor}\n borderColor={borderColor}\n textVariant={textVariant}\n tooltipOffset={tooltipOffset}\n arrowColor={arrowColor}\n arrowSize={arrowSize}\n arrowXCoOrdinates={arrowXCoOrdinates}\n arrowYCoOrdinates={arrowYCoOrdinates}\n tooltipXCoOrdinates={tooltipXCoOrdinates}\n tooltipYCoOrdinates={tooltipYCoOrdinates}\n >\n <Styled.TriggerWrapper $disabled={isTemporarilyDisabled}>{triggerNode}</Styled.TriggerWrapper>\n </ArrowTooltip>\n );\n};\n\nexport default memo(StickerSelector);\n"],"names":["StickerSelector","triggerNode","studentClassroomId","gridConfig","tooltipConfig","visible","metaData","columns","gap","stickerSize","isAnimated","arrowColor","arrowSize","arrowXCoOrdinates","arrowYCoOrdinates","backgroundColor","borderColor","position","renderAs","textVariant","tooltipOffset","tooltipXCoOrdinates","tooltipYCoOrdinates","width","widthX","zIndex","parentWidth","isBlocking","isTemporarilyDisabled","setIsTemporarilyDisabled","useState","sendSticker","useHandleStickerSend","handleStickerSend","useCallback","sticker","STICKER_EFFECTS","randomEffect","timeout","tooltipItem","useMemo","jsx","StickerSelectorGrid","ArrowTooltip","Styled.TriggerWrapper","stickerSelector","memo"],"mappings":";;;;;;AASA,MAAMA,IAA6C,CAAC;AAAA,EAClD,aAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,eAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AACF,MAAM;AACJ,QAAM,EAAE,SAAAC,IAAU,GAAG,KAAAC,IAAM,GAAG,aAAAC,IAAc,GAAO,IAAAN,GAC7C;AAAA,IAC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UAAArB;AAAA,MACA,UAAAD;AAAA,MACA,YAAAU;AAAA,MACA,YAAAjB;AAAA,MACA,QAAAe;AAAA,MACA,OAAAF;AAAA,MACA,QAAAC;AAAA,MACA,aAAAE;AAAA,MACA,iBAAAX;AAAA,MACA,aAAAC;AAAA,MACA,aAAAG;AAAA,MACA,eAAAC;AAAA,MACA,YAAAT;AAAA,MACA,WAAAC;AAAA,MACA,mBAAAC;AAAA,MACA,mBAAAC;AAAA,MACA,qBAAAO;AAAA,MACA,qBAAAC;AAAA,MAEA,4BAACsB,GAAA,EAAsB,WAAWhB,GAAwB,UAAY3B,GAAA;AAAA,IAAA;AAAA,EAAA;AAG5E,GAEe4C,IAAAC,EAAK9C,CAAe;"}
|
|
@@ -46,25 +46,25 @@ const ot = y(
|
|
|
46
46
|
N,
|
|
47
47
|
{
|
|
48
48
|
renderAs: "primary",
|
|
49
|
-
children: /* @__PURE__ */ t(p, { label: "hints", onClick: w, disabled: !d, children: /* @__PURE__ */ n(r, { $alignItems: "center", $justifyContent: "center", ref: E, children: [
|
|
50
|
-
/* @__PURE__ */ t(j, { width: 32, height: 32, $disabled: !d }),
|
|
51
|
-
/* @__PURE__ */ t(r, { $gap: 8, $alignItems: "center", children: /* @__PURE__ */ t(P, { width: 24, height: 1, background: "GREY_2" }) })
|
|
52
|
-
] }) }),
|
|
53
49
|
tooltipItem: /* @__PURE__ */ t(m, { $renderAs: "ab3", $color: "WHITE", children: "HINT" }),
|
|
54
50
|
position: "left",
|
|
55
51
|
tooltipXCoOrdinates: "32.5%",
|
|
56
|
-
tooltipYCoOrdinates: "-20%"
|
|
52
|
+
tooltipYCoOrdinates: "-20%",
|
|
53
|
+
children: /* @__PURE__ */ t(p, { label: "hints", onClick: w, disabled: !d, children: /* @__PURE__ */ n(r, { $alignItems: "center", $justifyContent: "center", ref: E, children: [
|
|
54
|
+
/* @__PURE__ */ t(j, { width: 32, height: 32, $disabled: !d }),
|
|
55
|
+
/* @__PURE__ */ t(r, { $gap: 8, $alignItems: "center", children: /* @__PURE__ */ t(P, { width: 24, height: 1, background: "GREY_2" }) })
|
|
56
|
+
] }) })
|
|
57
57
|
}
|
|
58
58
|
),
|
|
59
59
|
/* @__PURE__ */ t(
|
|
60
60
|
N,
|
|
61
61
|
{
|
|
62
62
|
renderAs: "primary",
|
|
63
|
-
children: /* @__PURE__ */ t(p, { label: "solution", onClick: R, disabled: !s, children: /* @__PURE__ */ t(r, { $alignItems: "center", $justifyContent: "center", ref: C, children: /* @__PURE__ */ t(x, { width: 32, height: 32, $disabled: !s }) }) }),
|
|
64
63
|
tooltipItem: /* @__PURE__ */ t(m, { $renderAs: "ab3", $color: "WHITE", children: "SOL" }),
|
|
65
64
|
position: "left",
|
|
66
65
|
tooltipXCoOrdinates: "32.5%",
|
|
67
|
-
tooltipYCoOrdinates: "5%"
|
|
66
|
+
tooltipYCoOrdinates: "5%",
|
|
67
|
+
children: /* @__PURE__ */ t(p, { label: "solution", onClick: R, disabled: !s, children: /* @__PURE__ */ t(r, { $alignItems: "center", $justifyContent: "center", ref: C, children: /* @__PURE__ */ t(x, { width: 32, height: 32, $disabled: !s }) }) })
|
|
68
68
|
}
|
|
69
69
|
),
|
|
70
70
|
e && T && b && /* @__PURE__ */ t(B, { topValue: T, leftValue: b }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question-guide.js","sources":["../../../../../src/features/worksheet/worksheet/worksheet-sidebar/question-guide.tsx"],"sourcesContent":["import type { RefObject, FC } from 'react';\nimport { memo, useCallback, useEffect, useMemo, useState, useRef } from 'react';\n\nimport ArrowTooltip from '../../../ui/arrow-tooltip/arrow-tooltip';\nimport Clickable from '../../../ui/buttons/clickable/clickable';\nimport FlexView from '../../../ui/layout/flex-view';\nimport Separator from '../../../ui/separator/separator';\nimport Text from '../../../ui/text/text';\nimport EVENTS from '../../constants/events';\nimport type { ILearnosity, IWorksheetProps, IWorksheetQuestion } from '../worksheet-types';\nimport {\n Section,\n GuideContainer,\n CloseIcon,\n SolIcon,\n HintIcon,\n SectionContainer,\n Guide,\n Pointer,\n} from './worksheet-sidebar-styled';\n\ntype TSections = 'HINT' | 'SOL';\n\ninterface IQuestionGuideProps extends Pick<IWorksheetProps, 'loggerRef'> {\n questionWidth: number;\n questions: IWorksheetQuestion[];\n activeQuestionIndex: number;\n learnosity: ILearnosity;\n actionbarHeight: number;\n plugins?: IWorksheetProps['plugins'];\n}\n\nconst QuestionGuide: FC<IQuestionGuideProps> = memo(\n ({\n questionWidth,\n questions,\n activeQuestionIndex,\n learnosity,\n actionbarHeight,\n loggerRef,\n plugins,\n }) => {\n const [activeSection, setActiveSection] = useState<TSections | undefined>();\n const [pointerPosition, setPointerPosition] = useState({\n top: 0,\n left: 0,\n });\n const { top, left } = pointerPosition;\n\n const handleHintClick = useCallback(() => {\n setActiveSection('HINT');\n loggerRef.current(EVENTS.WORKSHEET_V3_HINT_SEEN);\n }, [loggerRef]);\n const handleSolClick = useCallback(() => {\n setActiveSection('SOL');\n loggerRef.current(EVENTS.WORKSHEET_V3_SOLUTION_SEEN);\n }, [loggerRef]);\n const handleClose = useCallback(() => {\n setActiveSection(() => undefined);\n }, []);\n\n const { hints, solution } = questions[activeQuestionIndex]?.metadata || {};\n\n const activeSectionData = useMemo(() => {\n return activeSection === undefined ? undefined : activeSection === 'HINT' ? hints : solution;\n }, [activeSection, hints, solution]);\n\n const sqlRef = useRef<HTMLDivElement>(null) as RefObject<HTMLDivElement>;\n const hintRef = useRef<HTMLDivElement>(null) as RefObject<HTMLDivElement>;\n\n const updatePointerPosition = useCallback((ref: RefObject<HTMLDivElement>) => {\n if (ref.current) {\n const rect = ref.current.getBoundingClientRect();\n\n setPointerPosition({\n top: rect.top + rect.height / 2 - 8,\n left: rect.right - 78, // 52px (sidebar width) + 16px (gutter) + 10px\n });\n }\n }, []);\n\n if (activeSection && activeSectionData && learnosity) {\n learnosity.renderMath('mathjax');\n }\n\n useEffect(() => {\n if (activeSection === 'HINT') {\n updatePointerPosition(hintRef);\n } else if (activeSection === 'SOL') {\n updatePointerPosition(sqlRef);\n } else if (!activeSectionData) {\n setActiveSection(undefined);\n }\n }, [activeSection, updatePointerPosition, activeSectionData]);\n\n return (\n <GuideContainer $background=\"WHITE\">\n {plugins?.stickers ?? null}\n <ArrowTooltip\n renderAs=\"primary\"\n children={\n <Clickable label=\"hints\" onClick={handleHintClick} disabled={!hints}>\n <FlexView $alignItems=\"center\" $justifyContent=\"center\" ref={hintRef}>\n <HintIcon width={32} height={32} $disabled={!hints} />\n <FlexView $gap={8} $alignItems=\"center\">\n <Separator width={24} height={1} background=\"GREY_2\" />\n </FlexView>\n </FlexView>\n </Clickable>\n }\n tooltipItem={<Text $renderAs=\"ab3\" $color=\"WHITE\">HINT</Text>}\n position=\"left\"\n tooltipXCoOrdinates={'32.5%'}\n tooltipYCoOrdinates={'-20%'}\n />\n <ArrowTooltip\n renderAs=\"primary\"\n children={\n <Clickable label=\"solution\" onClick={handleSolClick} disabled={!solution}>\n <FlexView $alignItems=\"center\" $justifyContent=\"center\" ref={sqlRef}>\n <SolIcon width={32} height={32} $disabled={!solution} />\n </FlexView>\n </Clickable>\n }\n tooltipItem={<Text $renderAs=\"ab3\" $color=\"WHITE\">SOL</Text>}\n position=\"left\"\n tooltipXCoOrdinates={'32.5%'}\n tooltipYCoOrdinates={'5%'}\n />\n {activeSection && top && left && <Pointer topValue={top} leftValue={left} />}\n {activeSection && (\n <SectionContainer\n $background=\"WHITE\"\n $questionWidth={questionWidth}\n $actionbarHeight={actionbarHeight}\n $borderRadius={10}\n >\n <Section\n $gutterX={1}\n $gapX={1}\n $questionWidth={questionWidth}\n $actionbarHeight={actionbarHeight}\n >\n <Clickable label=\"close\" onClick={handleClose}>\n <CloseIcon />\n </Clickable>\n <FlexView $gutterX={0.5}>\n <Text $renderAs=\"eyebrow2\" $color=\"ORANGE_5\" $marginBottomX={0.25}>\n {activeSection === 'HINT' ? 'HINTS:' : 'SOLUTION:'}\n </Text>\n </FlexView>\n {activeSectionData &&\n activeSectionData.map((item, index) => (\n <FlexView $gutterX={0.5} $gapX={0.5} key={index.toString()}>\n {activeSectionData.length > 1 && (\n <Text $renderAs=\"eyebrow2\" $color=\"ORANGE_5\" $marginBottomX={0.25}>\n {activeSection} {index + 1}:\n </Text>\n )}\n <Guide\n dangerouslySetInnerHTML={{\n __html: item,\n }}\n />\n </FlexView>\n ))}\n </Section>\n </SectionContainer>\n )}\n </GuideContainer>\n );\n },\n);\n\nexport default QuestionGuide;\n"],"names":["QuestionGuide","memo","questionWidth","questions","activeQuestionIndex","learnosity","actionbarHeight","loggerRef","plugins","activeSection","setActiveSection","useState","pointerPosition","setPointerPosition","top","left","handleHintClick","useCallback","EVENTS","handleSolClick","handleClose","hints","solution","_a","activeSectionData","useMemo","sqlRef","useRef","hintRef","updatePointerPosition","ref","rect","useEffect","jsxs","GuideContainer","jsx","ArrowTooltip","Clickable","FlexView","HintIcon","Separator","Text","SolIcon","Pointer","SectionContainer","Section","CloseIcon","item","index","Guide"],"mappings":";;;;;;;;;AAgCA,MAAMA,KAAyCC;AAAA,EAC7C,CAAC;AAAA,IACC,eAAAC;AAAA,IACA,WAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,EAAA,MACI;;AACJ,UAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAgC,GACpE,CAACC,GAAiBC,CAAkB,IAAIF,EAAS;AAAA,MACrD,KAAK;AAAA,MACL,MAAM;AAAA,IAAA,CACP,GACK,EAAE,KAAAG,GAAK,MAAAC,EAAS,IAAAH,GAEhBI,IAAkBC,EAAY,MAAM;AACxC,MAAAP,EAAiB,MAAM,GACbH,EAAA,QAAQW,EAAO,sBAAsB;AAAA,IAAA,GAC9C,CAACX,CAAS,CAAC,GACRY,IAAiBF,EAAY,MAAM;AACvC,MAAAP,EAAiB,KAAK,GACZH,EAAA,QAAQW,EAAO,0BAA0B;AAAA,IAAA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BAAkBI;AAAA,cAElB,UAAA;AAAA,gBAAA,gBAAA6B,EAACE,KAAU,OAAM,SAAQ,SAASjB,GAChC,UAAA,gBAAAe,EAACW,KAAU,EACb,CAAA;AAAA,kCACCR,GAAS,EAAA,UAAU,KAClB,UAAA,gBAAAH,EAACM,KAAK,WAAU,YAAW,QAAO,YAAW,gBAAgB,MAC1D,UAAAhC,MAAkB,SAAS,WAAW,YACzC,CAAA,GACF;AAAA,gBACCe,KACCA,EAAkB,IAAI,CAACuB,GAAMC,MAC3B,gBAAAf,EAACK,GAAS,EAAA,UAAU,KAAK,OAAO,KAC7B,UAAA;AAAA,kBAAkBd,EAAA,SAAS,KACzB,gBAAAS,EAAAQ,GAAA,EAAK,WAAU,YAAW,QAAO,YAAW,gBAAgB,MAC1D,UAAA;AAAA,oBAAAhC;AAAA,oBAAc;AAAA,oBAAEuC,IAAQ;AAAA,oBAAE;AAAA,kBAAA,GAC7B;AAAA,kBAEF,gBAAAb;AAAA,oBAACc;AAAA,oBAAA;AAAA,sBACC,yBAAyB;AAAA,wBACvB,QAAQF;AAAA,sBACV;AAAA,oBAAA;AAAA,kBACF;AAAA,gBAAA,KAVwCC,EAAM,SAAS,CAWzD,CACD;AAAA,cAAA;AAAA,YAAA;AAAA,UACL;AAAA,QAAA;AAAA,MACF;AAAA,IAEJ,EAAA,CAAA;AAAA,EAEJ;AACF;"}
|
|
1
|
+
{"version":3,"file":"question-guide.js","sources":["../../../../../src/features/worksheet/worksheet/worksheet-sidebar/question-guide.tsx"],"sourcesContent":["import {\n type RefObject,\n type FC,\n memo,\n useCallback,\n useEffect,\n useMemo,\n useState,\n useRef,\n} from 'react';\n\nimport ArrowTooltip from '../../../ui/arrow-tooltip/arrow-tooltip';\nimport Clickable from '../../../ui/buttons/clickable/clickable';\nimport FlexView from '../../../ui/layout/flex-view';\nimport Separator from '../../../ui/separator/separator';\nimport Text from '../../../ui/text/text';\nimport EVENTS from '../../constants/events';\nimport type { ILearnosity, IWorksheetProps, IWorksheetQuestion } from '../worksheet-types';\nimport {\n Section,\n GuideContainer,\n CloseIcon,\n SolIcon,\n HintIcon,\n SectionContainer,\n Guide,\n Pointer,\n} from './worksheet-sidebar-styled';\n\ntype TSections = 'HINT' | 'SOL';\n\ninterface IQuestionGuideProps extends Pick<IWorksheetProps, 'loggerRef'> {\n questionWidth: number;\n questions: IWorksheetQuestion[];\n activeQuestionIndex: number;\n learnosity: ILearnosity;\n actionbarHeight: number;\n plugins?: IWorksheetProps['plugins'];\n}\n\nconst QuestionGuide: FC<IQuestionGuideProps> = memo(\n ({\n questionWidth,\n questions,\n activeQuestionIndex,\n learnosity,\n actionbarHeight,\n loggerRef,\n plugins,\n }) => {\n const [activeSection, setActiveSection] = useState<TSections | undefined>();\n const [pointerPosition, setPointerPosition] = useState({\n top: 0,\n left: 0,\n });\n const { top, left } = pointerPosition;\n\n const handleHintClick = useCallback(() => {\n setActiveSection('HINT');\n loggerRef.current(EVENTS.WORKSHEET_V3_HINT_SEEN);\n }, [loggerRef]);\n const handleSolClick = useCallback(() => {\n setActiveSection('SOL');\n loggerRef.current(EVENTS.WORKSHEET_V3_SOLUTION_SEEN);\n }, [loggerRef]);\n const handleClose = useCallback(() => {\n setActiveSection(() => undefined);\n }, []);\n\n const { hints, solution } = questions[activeQuestionIndex]?.metadata || {};\n\n const activeSectionData = useMemo(() => {\n return activeSection === undefined ? undefined : activeSection === 'HINT' ? hints : solution;\n }, [activeSection, hints, solution]);\n\n const sqlRef = useRef<HTMLDivElement>(null) as RefObject<HTMLDivElement>;\n const hintRef = useRef<HTMLDivElement>(null) as RefObject<HTMLDivElement>;\n\n const updatePointerPosition = useCallback((ref: RefObject<HTMLDivElement>) => {\n if (ref.current) {\n const rect = ref.current.getBoundingClientRect();\n\n setPointerPosition({\n top: rect.top + rect.height / 2 - 8,\n left: rect.right - 78, // 52px (sidebar width) + 16px (gutter) + 10px\n });\n }\n }, []);\n\n if (activeSection && activeSectionData && learnosity) {\n learnosity.renderMath('mathjax');\n }\n\n useEffect(() => {\n if (activeSection === 'HINT') {\n updatePointerPosition(hintRef);\n } else if (activeSection === 'SOL') {\n updatePointerPosition(sqlRef);\n } else if (!activeSectionData) {\n setActiveSection(undefined);\n }\n }, [activeSection, updatePointerPosition, activeSectionData]);\n\n return (\n <GuideContainer $background=\"WHITE\">\n {plugins?.stickers ?? null}\n <ArrowTooltip\n renderAs=\"primary\"\n tooltipItem={\n <Text $renderAs=\"ab3\" $color=\"WHITE\">\n HINT\n </Text>\n }\n position=\"left\"\n tooltipXCoOrdinates={'32.5%'}\n tooltipYCoOrdinates={'-20%'}\n >\n <Clickable label=\"hints\" onClick={handleHintClick} disabled={!hints}>\n <FlexView $alignItems=\"center\" $justifyContent=\"center\" ref={hintRef}>\n <HintIcon width={32} height={32} $disabled={!hints} />\n <FlexView $gap={8} $alignItems=\"center\">\n <Separator width={24} height={1} background=\"GREY_2\" />\n </FlexView>\n </FlexView>\n </Clickable>\n </ArrowTooltip>\n <ArrowTooltip\n renderAs=\"primary\"\n tooltipItem={\n <Text $renderAs=\"ab3\" $color=\"WHITE\">\n SOL\n </Text>\n }\n position=\"left\"\n tooltipXCoOrdinates={'32.5%'}\n tooltipYCoOrdinates={'5%'}\n >\n <Clickable label=\"solution\" onClick={handleSolClick} disabled={!solution}>\n <FlexView $alignItems=\"center\" $justifyContent=\"center\" ref={sqlRef}>\n <SolIcon width={32} height={32} $disabled={!solution} />\n </FlexView>\n </Clickable>\n </ArrowTooltip>\n {activeSection && top && left && <Pointer topValue={top} leftValue={left} />}\n {activeSection && (\n <SectionContainer\n $background=\"WHITE\"\n $questionWidth={questionWidth}\n $actionbarHeight={actionbarHeight}\n $borderRadius={10}\n >\n <Section\n $gutterX={1}\n $gapX={1}\n $questionWidth={questionWidth}\n $actionbarHeight={actionbarHeight}\n >\n <Clickable label=\"close\" onClick={handleClose}>\n <CloseIcon />\n </Clickable>\n <FlexView $gutterX={0.5}>\n <Text $renderAs=\"eyebrow2\" $color=\"ORANGE_5\" $marginBottomX={0.25}>\n {activeSection === 'HINT' ? 'HINTS:' : 'SOLUTION:'}\n </Text>\n </FlexView>\n {activeSectionData &&\n activeSectionData.map((item, index) => (\n <FlexView $gutterX={0.5} $gapX={0.5} key={index.toString()}>\n {activeSectionData.length > 1 && (\n <Text $renderAs=\"eyebrow2\" $color=\"ORANGE_5\" $marginBottomX={0.25}>\n {activeSection} {index + 1}:\n </Text>\n )}\n <Guide\n dangerouslySetInnerHTML={{\n __html: item,\n }}\n />\n </FlexView>\n ))}\n </Section>\n </SectionContainer>\n )}\n </GuideContainer>\n );\n },\n);\n\nexport default QuestionGuide;\n"],"names":["QuestionGuide","memo","questionWidth","questions","activeQuestionIndex","learnosity","actionbarHeight","loggerRef","plugins","activeSection","setActiveSection","useState","pointerPosition","setPointerPosition","top","left","handleHintClick","useCallback","EVENTS","handleSolClick","handleClose","hints","solution","_a","activeSectionData","useMemo","sqlRef","useRef","hintRef","updatePointerPosition","ref","rect","useEffect","jsxs","GuideContainer","jsx","ArrowTooltip","Text","Clickable","FlexView","HintIcon","Separator","SolIcon","Pointer","SectionContainer","Section","CloseIcon","item","index","Guide"],"mappings":";;;;;;;;;AAwCA,MAAMA,KAAyCC;AAAA,EAC7C,CAAC;AAAA,IACC,eAAAC;AAAA,IACA,WAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,EAAA,MACI;;AACJ,UAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAgC,GACpE,CAACC,GAAiBC,CAAkB,IAAIF,EAAS;AAAA,MACrD,KAAK;AAAA,MACL,MAAM;AAAA,IAAA,CACP,GACK,EAAE,KAAAG,GAAK,MAAAC,EAAS,IAAAH,GAEhBI,IAAkBC,EAAY,MAAM;AACxC,MAAAP,EAAiB,MAAM,GACbH,EAAA,QAAQW,EAAO,sBAAsB;AAAA,IAAA,GAC9C,CAACX,CAAS,CAAC,GACRY,IAA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A,YAAA;AAAA,cACC,UAAU;AAAA,cACV,OAAO;AAAA,cACP,gBAAgB3C;AAAA,cAChB,kBAAkBI;AAAA,cAElB,UAAA;AAAA,gBAAA,gBAAA6B,EAACG,KAAU,OAAM,SAAQ,SAASlB,GAChC,UAAA,gBAAAe,EAACW,KAAU,EACb,CAAA;AAAA,kCACCP,GAAS,EAAA,UAAU,KAClB,UAAA,gBAAAJ,EAACE,KAAK,WAAU,YAAW,QAAO,YAAW,gBAAgB,MAC1D,UAAA5B,MAAkB,SAAS,WAAW,YACzC,CAAA,GACF;AAAA,gBACCe,KACCA,EAAkB,IAAI,CAACuB,GAAMC,MAC3B,gBAAAf,EAACM,GAAS,EAAA,UAAU,KAAK,OAAO,KAC7B,UAAA;AAAA,kBAAkBf,EAAA,SAAS,KACzB,gBAAAS,EAAAI,GAAA,EAAK,WAAU,YAAW,QAAO,YAAW,gBAAgB,MAC1D,UAAA;AAAA,oBAAA5B;AAAA,oBAAc;AAAA,oBAAEuC,IAAQ;AAAA,oBAAE;AAAA,kBAAA,GAC7B;AAAA,kBAEF,gBAAAb;AAAA,oBAACc;AAAA,oBAAA;AAAA,sBACC,yBAAyB;AAAA,wBACvB,QAAQF;AAAA,sBACV;AAAA,oBAAA;AAAA,kBACF;AAAA,gBAAA,KAVwCC,EAAM,SAAS,CAWzD,CACD;AAAA,cAAA;AAAA,YAAA;AAAA,UACL;AAAA,QAAA;AAAA,MACF;AAAA,IAEJ,EAAA,CAAA;AAAA,EAEJ;AACF;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { ButtonHTMLAttributes } from 'react';
|
|
2
|
+
import { Channel } from '@cuemath/cue-message-broker';
|
|
3
3
|
import { ChannelStatus } from '@cuemath/cue-message-broker';
|
|
4
4
|
import { ComponentType } from 'react';
|
|
5
|
-
import
|
|
5
|
+
import { Config } from '@lottiefiles/dotlottie-web';
|
|
6
6
|
import { Context } from 'react';
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import { Data } from '@lottiefiles/dotlottie-web';
|
|
8
|
+
import { DefaultTheme } from 'styled-components';
|
|
9
9
|
import { DetailedHTMLProps } from 'react';
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
10
|
+
import { Dispatch } from 'react';
|
|
11
|
+
import { EventListener as EventListener_2 } from '@lottiefiles/dotlottie-web';
|
|
12
|
+
import { EventType } from '@lottiefiles/dotlottie-web';
|
|
13
13
|
import { FC } from 'react';
|
|
14
|
-
import
|
|
14
|
+
import { FormEvent } from 'react';
|
|
15
15
|
import { ForwardRefExoticComponent } from 'react';
|
|
16
16
|
import { HTMLAttributes } from 'react';
|
|
17
|
-
import
|
|
17
|
+
import { HTMLProps } from 'react';
|
|
18
18
|
import { IChannelMessage } from '@cuemath/cue-message-broker';
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
19
|
+
import { IframeHTMLAttributes } from 'react';
|
|
20
|
+
import { ImgHTMLAttributes } from 'react';
|
|
21
|
+
import { 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
|
|
26
|
+
import { MutableRefObject } from 'react';
|
|
27
27
|
import { NamedExoticComponent } from 'react';
|
|
28
28
|
import { Omit as Omit_2 } from 'google-maps-react';
|
|
29
|
-
import
|
|
29
|
+
import { 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
|
|
36
|
+
import { 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
|
-
|
|
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 | undefined;
|
|
692
692
|
|
|
693
693
|
declare const getArrowTooltipConfig: IGetArrowTooltipConfig;
|
|
694
694
|
|
|
@@ -3771,7 +3771,8 @@ declare interface IStickerSelectorProps {
|
|
|
3771
3771
|
tooltipConfig: Omit<Partial<IArrowTooltipProps>, 'children' | 'tooltipItem' | 'hidden' | 'alwaysVisible'>;
|
|
3772
3772
|
visible: boolean;
|
|
3773
3773
|
onToggle: () => void;
|
|
3774
|
-
studentClassroomId
|
|
3774
|
+
studentClassroomId: string;
|
|
3775
|
+
metaData: TUseStickerSendMetaData;
|
|
3775
3776
|
}
|
|
3776
3777
|
|
|
3777
3778
|
declare interface IStickersProviderProps {
|
|
@@ -5221,7 +5222,7 @@ export declare const OTPInput: NamedExoticComponent<IOTPInputProps>;
|
|
|
5221
5222
|
export declare type OutcomeStage = keyof typeof STAGES;
|
|
5222
5223
|
|
|
5223
5224
|
export declare const OverlayLoader: MemoExoticComponent<({ isLoading }: {
|
|
5224
|
-
|
|
5225
|
+
isLoading?: boolean | undefined;
|
|
5225
5226
|
}) => JSX.Element | null>;
|
|
5226
5227
|
|
|
5227
5228
|
export declare const ParentDashboard: MemoExoticComponent<(props: IParentDashboardProps) => JSX.Element>;
|
|
@@ -5544,7 +5545,7 @@ export declare const SheetIcon: FC<SVGProps<SVGSVGElement>>;
|
|
|
5544
5545
|
export declare const SheetList: FC<ISheetsListProps>;
|
|
5545
5546
|
|
|
5546
5547
|
export declare const SheetLocked: MemoExoticComponent<({ onHomeClick }: {
|
|
5547
|
-
|
|
5548
|
+
onHomeClick: () => void;
|
|
5548
5549
|
}) => JSX.Element>;
|
|
5549
5550
|
|
|
5550
5551
|
export declare const SignUp: ({ mathGymEnrolledUser, circleEnrolledUser, circleOnLeapPremiumDays, circleUsername, countryCode, grade: defaultGrade, state, circleOnLeapPremiumEnabled, studentId, isSignUpProcessing, onCreateUser, onUpdateUser, onSignupStepsComplete, isPLAStudent, }: ISignUpProps) => JSX.Element;
|
|
@@ -6891,6 +6892,11 @@ declare type TUserProgram = {
|
|
|
6891
6892
|
|
|
6892
6893
|
export declare type TUserTypes = 'TEACHER' | 'STUDENT';
|
|
6893
6894
|
|
|
6895
|
+
declare type TUseStickerSendMetaData = {
|
|
6896
|
+
teacherClassroomId?: string;
|
|
6897
|
+
triggerType?: "worksheet" | "default";
|
|
6898
|
+
};
|
|
6899
|
+
|
|
6894
6900
|
export declare const TutorChangeModal: MemoExoticComponent<() => JSX.Element>;
|
|
6895
6901
|
|
|
6896
6902
|
export declare const Tutorial: ({ src, title, onCross, showProgress, onTutorialPlayedOnce, isJourneyActive, }: ITutorialProps) => JSX.Element;
|
|
@@ -7062,8 +7068,8 @@ export declare const useGetMilestoneResources: (initialId?: string, initialQuery
|
|
|
7062
7068
|
|
|
7063
7069
|
export declare const useGetPastMilestoneCount: (initialId?: string, initialQuery?: void | undefined) => {
|
|
7064
7070
|
get: (id: string, query: void, meta: TQuery_2) => Promise<void>;
|
|
7065
|
-
resource: ResourceModel<{
|
|
7066
|
-
|
|
7071
|
+
resource: ResourceModel< {
|
|
7072
|
+
user_milestones_count: number;
|
|
7067
7073
|
}> | undefined;
|
|
7068
7074
|
data: {
|
|
7069
7075
|
user_milestones_count: number;
|
|
@@ -7124,7 +7130,7 @@ export declare const useGetTestHelpData: (initialId?: string, initialQuery?: voi
|
|
|
7124
7130
|
} & Record<string, unknown>) | undefined;
|
|
7125
7131
|
};
|
|
7126
7132
|
|
|
7127
|
-
export declare const useHandleStickerSend: (studentClassroomId
|
|
7133
|
+
export declare const useHandleStickerSend: (studentClassroomId: string, metaData: TUseStickerSendMetaData) => (sticker: IStickerData, effect: TStickerAnimationEffects) => void;
|
|
7128
7134
|
|
|
7129
7135
|
export declare const useHomePageJourney: () => {
|
|
7130
7136
|
homepageRef: RefObject<HTMLDivElement>;
|
package/dist/index.js
CHANGED
|
@@ -320,7 +320,7 @@ import { default as Id } from "./features/stickers/stickers-effects/stickers-eff
|
|
|
320
320
|
import { default as Td } from "./features/stickers/sticker-selector/sticker-selector.js";
|
|
321
321
|
import { StickersProvider as Cd } from "./features/stickers/stickers-effects/context/sticker-provider.js";
|
|
322
322
|
import { useStickers as Ad } from "./features/stickers/stickers-effects/hooks/use-stickers.js";
|
|
323
|
-
import { useHandleStickerSend as hd } from "./features/stickers/hooks/use-handle-sticker-send.js";
|
|
323
|
+
import { useHandleStickerSend as hd } from "./features/stickers/hooks/use-handle-sticker-send/use-handle-sticker-send.js";
|
|
324
324
|
import { useStickersJourney as Rd } from "./features/stickers/hooks/use-stickers-journey/use-stickers-journey.js";
|
|
325
325
|
import { default as kd } from "./features/student-details/student-details.js";
|
|
326
326
|
import { default as Nd } from "./features/utils/load-script.js";
|
package/package.json
CHANGED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { useCallback as i } from "react";
|
|
2
|
-
import m from "../../communication/hooks/use-inclass-message-broker/use-inclass-message-broker.js";
|
|
3
|
-
import { useUIContext as E } from "../../ui/context/context.js";
|
|
4
|
-
import { STICKERS_ANALYTICS_EVENT as d } from "../stickers-analytics-events.js";
|
|
5
|
-
import { useStickers as k } from "../stickers-effects/hooks/use-stickers.js";
|
|
6
|
-
import { useStickersErrorLogger as f } from "./use-stickers-error-logger.js";
|
|
7
|
-
const u = (t) => {
|
|
8
|
-
const { publish: e } = m({
|
|
9
|
-
studentClassroomId: t
|
|
10
|
-
}), { onEvent: c } = E(), n = f(), { showSticker: s } = k();
|
|
11
|
-
return i(
|
|
12
|
-
(o, S) => {
|
|
13
|
-
const a = {
|
|
14
|
-
classroom_id: t,
|
|
15
|
-
sticker: o.id
|
|
16
|
-
};
|
|
17
|
-
try {
|
|
18
|
-
const r = {
|
|
19
|
-
message: {
|
|
20
|
-
data: {
|
|
21
|
-
selectedSticker: {
|
|
22
|
-
id: o.id,
|
|
23
|
-
name: o.name
|
|
24
|
-
},
|
|
25
|
-
effectId: S
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
type: "STICKERS"
|
|
29
|
-
};
|
|
30
|
-
s(r), e == null || e({
|
|
31
|
-
eventName: "STICKERS",
|
|
32
|
-
eventPayload: r
|
|
33
|
-
}), c(d.STICKER_SENT, a);
|
|
34
|
-
} catch (r) {
|
|
35
|
-
n(r, { baseEventData: a });
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
[n, e, s, t, c]
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
export {
|
|
42
|
-
u as useHandleStickerSend
|
|
43
|
-
};
|
|
44
|
-
//# sourceMappingURL=use-handle-sticker-send.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-handle-sticker-send.js","sources":["../../../../src/features/stickers/hooks/use-handle-sticker-send.tsx"],"sourcesContent":["import { useCallback } from 'react';\n\nimport useInClassMessageBroker from '../../communication/hooks/use-inclass-message-broker/use-inclass-message-broker';\nimport { useUIContext } from '../../ui/context/context';\nimport { STICKERS_ANALYTICS_EVENT } from '../stickers-analytics-events';\nimport { useStickers } from '../stickers-effects/hooks/use-stickers';\nimport type { IStickerData, TStickerAnimationEffects, TStickersPayload } from '../stickers-types';\nimport { useStickersErrorLogger } from './use-stickers-error-logger';\n\nexport const useHandleStickerSend = (studentClassroomId?: string) => {\n const { publish } = useInClassMessageBroker({\n studentClassroomId,\n });\n\n const { onEvent: trackEvent } = useUIContext();\n const logError = useStickersErrorLogger();\n\n const { showSticker } = useStickers();\n\n const sendSticker = useCallback(\n (sticker: IStickerData, effect: TStickerAnimationEffects) => {\n const baseEventData = {\n classroom_id: studentClassroomId,\n sticker: sticker.id,\n };\n\n try {\n const payload: TStickersPayload = {\n message: {\n data: {\n selectedSticker: {\n id: sticker.id,\n name: sticker.name,\n },\n effectId: effect,\n },\n },\n type: 'STICKERS',\n };\n\n showSticker(payload);\n\n publish?.({\n eventName: 'STICKERS',\n eventPayload: payload,\n });\n\n trackEvent(STICKERS_ANALYTICS_EVENT.STICKER_SENT, baseEventData);\n } catch (error) {\n logError(error, { baseEventData });\n }\n },\n [logError, publish, showSticker, studentClassroomId, trackEvent],\n );\n\n return sendSticker;\n};\n"],"names":["useHandleStickerSend","studentClassroomId","publish","useInClassMessageBroker","trackEvent","useUIContext","logError","useStickersErrorLogger","showSticker","useStickers","useCallback","sticker","effect","baseEventData","payload","STICKERS_ANALYTICS_EVENT","error"],"mappings":";;;;;;AASa,MAAAA,IAAuB,CAACC,MAAgC;AAC7D,QAAA,EAAE,SAAAC,EAAQ,IAAIC,EAAwB;AAAA,IAC1C,oBAAAF;AAAA,EAAA,CACD,GAEK,EAAE,SAASG,EAAW,IAAIC,EAAa,GACvCC,IAAWC,KAEX,EAAE,aAAAC,MAAgBC;AAsCjB,SApCaC;AAAA,IAClB,CAACC,GAAuBC,MAAqC;AAC3D,YAAMC,IAAgB;AAAA,QACpB,cAAcZ;AAAA,QACd,SAASU,EAAQ;AAAA,MAAA;AAGf,UAAA;AACF,cAAMG,IAA4B;AAAA,UAChC,SAAS;AAAA,YACP,MAAM;AAAA,cACJ,iBAAiB;AAAA,gBACf,IAAIH,EAAQ;AAAA,gBACZ,MAAMA,EAAQ;AAAA,cAChB;AAAA,cACA,UAAUC;AAAA,YACZ;AAAA,UACF;AAAA,UACA,MAAM;AAAA,QAAA;AAGR,QAAAJ,EAAYM,CAAO,GAETZ,KAAA,QAAAA,EAAA;AAAA,UACR,WAAW;AAAA,UACX,cAAcY;AAAA,QAAA,IAGLV,EAAAW,EAAyB,cAAcF,CAAa;AAAA,eACxDG,GAAO;AACL,QAAAV,EAAAU,GAAO,EAAE,eAAAH,EAAA,CAAe;AAAA,MACnC;AAAA,IACF;AAAA,IACA,CAACP,GAAUJ,GAASM,GAAaP,GAAoBG,CAAU;AAAA,EAAA;AAInE;"}
|