@cuemath/leap 2.8.57-rj-5 → 2.8.58
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/analytics-events/platform-events-teacher.js +11 -6
- package/dist/features/analytics-events/platform-events-teacher.js.map +1 -1
- package/dist/features/circle-games/game-launcher/api/update-circle-onboarding/constants.js +5 -0
- package/dist/features/circle-games/game-launcher/api/update-circle-onboarding/constants.js.map +1 -0
- package/dist/features/circle-games/game-launcher/api/update-circle-onboarding/post-circle-coachmark-api.js +9 -0
- package/dist/features/circle-games/game-launcher/api/update-circle-onboarding/post-circle-coachmark-api.js.map +1 -0
- package/dist/features/circle-games/game-launcher/dal/use-get-circle-home-details-dal/use-get-circle-home-details-dal.js +85 -77
- package/dist/features/circle-games/game-launcher/dal/use-get-circle-home-details-dal/use-get-circle-home-details-dal.js.map +1 -1
- package/dist/features/circle-games/game-launcher/dal/use-post-update-circle-journey-dal/use-post-update-circle-journey-dal.js +23 -0
- package/dist/features/circle-games/game-launcher/dal/use-post-update-circle-journey-dal/use-post-update-circle-journey-dal.js.map +1 -0
- package/dist/features/circle-games/game-launcher/game-launcher.js +76 -66
- package/dist/features/circle-games/game-launcher/game-launcher.js.map +1 -1
- package/dist/features/circle-games/game-launcher/hooks/use-game-launcher-journey/use-game-launcher-journey.js +38 -37
- package/dist/features/circle-games/game-launcher/hooks/use-game-launcher-journey/use-game-launcher-journey.js.map +1 -1
- package/dist/features/circle-games/game-launcher/hooks/use-table-launcher-journey/use-table-launcher-journey.js +50 -49
- package/dist/features/circle-games/game-launcher/hooks/use-table-launcher-journey/use-table-launcher-journey.js.map +1 -1
- package/dist/features/journey/use-journey/journey-context-provider.js +40 -78
- package/dist/features/journey/use-journey/journey-context-provider.js.map +1 -1
- package/dist/features/journey/use-journey/journey-styled.js +1 -1
- package/dist/features/journey/use-journey/journey-styled.js.map +1 -1
- package/dist/index.d.ts +43 -22
- package/dist/index.js +78 -78
- package/package.json +1 -1
- package/dist/features/journey/hooks/use-get-eligible-journeys-via-route.js +0 -13
- package/dist/features/journey/hooks/use-get-eligible-journeys-via-route.js.map +0 -1
- package/dist/features/journey/user-journey-api/user-journey-api.js +0 -12
- package/dist/features/journey/user-journey-api/user-journey-api.js.map +0 -1
@@ -1,109 +1,71 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { createContext as
|
3
|
-
import { Coachmark as
|
4
|
-
import {
|
5
|
-
|
6
|
-
const
|
7
|
-
const [k, v] = h([]), [n, c] = h([]), [g, p] = h(!1), a = C(-1), r = C(), f = C([]), { post: x } = M(), {
|
8
|
-
data: m = null,
|
9
|
-
get: _,
|
10
|
-
isProcessing: O
|
11
|
-
} = z(), U = (u === "" || m && !O) && n.length > 0, A = l(
|
1
|
+
import { jsxs as p, jsx as k } from "react/jsx-runtime";
|
2
|
+
import { createContext as $, useState as g, useRef as d, useCallback as i, useMemo as w } from "react";
|
3
|
+
import { Coachmark as A } from "../comps/coachmark/coachmark.js";
|
4
|
+
import { BlurOverlay as R } from "./journey-styled.js";
|
5
|
+
const b = $(null), j = ({ children: v }) => {
|
6
|
+
const [o, u] = g([]), c = d(-1), r = d(), l = d([]), y = i(
|
12
7
|
(e, t) => {
|
13
|
-
if (
|
8
|
+
if (o.length > 0) {
|
14
9
|
console.error(
|
15
10
|
`setJourney: Other Journey is already active, Current Journey: ${r.current}, New Journey Request: ${e}`
|
16
11
|
);
|
17
12
|
return;
|
18
13
|
}
|
19
|
-
|
14
|
+
r.current = e, c.current = -1, u([...t]);
|
20
15
|
},
|
21
|
-
[
|
22
|
-
),
|
23
|
-
|
16
|
+
[o.length]
|
17
|
+
), h = i(() => {
|
18
|
+
l.current.forEach((e) => {
|
24
19
|
clearTimeout(e);
|
25
|
-
}),
|
26
|
-
}, []),
|
27
|
-
(e) => {
|
28
|
-
v((t) => [...t, e]), x({
|
29
|
-
app_id: u,
|
30
|
-
user_id: s,
|
31
|
-
journey_id: e,
|
32
|
-
journey_status: "COMPLETED"
|
33
|
-
}), y();
|
34
|
-
},
|
35
|
-
[u, y, x, s]
|
36
|
-
), $ = l((e, t) => {
|
20
|
+
}), l.current = [], r.current = void 0, c.current = -1, u([]);
|
21
|
+
}, []), f = i((e, t) => {
|
37
22
|
if (!r.current || e !== r.current) {
|
38
23
|
console.error(
|
39
24
|
r.current ? `A Journey is already active, Current Journey: ${r.current}, New Journey Request: ${e}` : "addCoachmark was called before setJourney and Journey ID is undefined"
|
40
25
|
);
|
41
26
|
return;
|
42
27
|
}
|
43
|
-
|
44
|
-
}, []),
|
45
|
-
(e, t = !1,
|
28
|
+
u((s) => [...s, t]);
|
29
|
+
}, []), J = i(
|
30
|
+
(e, t = !1, s = 0) => {
|
46
31
|
if (!r.current || e !== r.current) {
|
47
32
|
console.error(
|
48
33
|
r.current ? "nextCoachmark was called before setJourney" : `A Journey is already active, Current Journey: ${r.current}, New Journey Request: ${e}`
|
49
34
|
);
|
50
35
|
return;
|
51
36
|
}
|
52
|
-
|
53
|
-
const
|
54
|
-
clearTimeout(
|
55
|
-
const
|
56
|
-
|
57
|
-
if (
|
58
|
-
return r.current = void 0,
|
59
|
-
|
60
|
-
const
|
61
|
-
return
|
37
|
+
s !== 0 && u((n) => n.map((a) => ({ ...a, isActive: !1 })));
|
38
|
+
const C = setTimeout(() => {
|
39
|
+
clearTimeout(C);
|
40
|
+
const n = c.current + 1;
|
41
|
+
u((a) => {
|
42
|
+
if (n >= a.length || a.length === 0)
|
43
|
+
return r.current = void 0, c.current = -1, [];
|
44
|
+
c.current = n;
|
45
|
+
const m = [...a];
|
46
|
+
return m[n].isActive = !0, n > 0 && (m[n - 1].isActive = t), m;
|
62
47
|
});
|
63
|
-
},
|
64
|
-
|
48
|
+
}, s);
|
49
|
+
l.current.push(C);
|
65
50
|
},
|
66
51
|
[]
|
67
|
-
),
|
52
|
+
), x = w(
|
68
53
|
() => ({
|
69
|
-
nextCoachmark:
|
70
|
-
setJourney:
|
71
|
-
addCoachmark:
|
72
|
-
clearJourney:
|
73
|
-
|
74
|
-
coachmarks: n,
|
75
|
-
userCompletedJourneyIds: k,
|
76
|
-
isJourneyActive: g
|
54
|
+
nextCoachmark: J,
|
55
|
+
setJourney: y,
|
56
|
+
addCoachmark: f,
|
57
|
+
clearJourney: h,
|
58
|
+
coachmarks: o
|
77
59
|
}),
|
78
|
-
[
|
79
|
-
w,
|
80
|
-
A,
|
81
|
-
$,
|
82
|
-
y,
|
83
|
-
P,
|
84
|
-
n,
|
85
|
-
k,
|
86
|
-
g
|
87
|
-
]
|
60
|
+
[J, y, f, h, o]
|
88
61
|
);
|
89
|
-
return
|
90
|
-
|
91
|
-
|
92
|
-
user_id: s,
|
93
|
-
journey_status: "COMPLETED"
|
94
|
-
});
|
95
|
-
}, [u, _, s]), R(() => {
|
96
|
-
if (m) {
|
97
|
-
const e = m.map((t) => t.journey_id);
|
98
|
-
v(e);
|
99
|
-
}
|
100
|
-
}, [m]), /* @__PURE__ */ q(S.Provider, { value: b, children: [
|
101
|
-
U && /* @__PURE__ */ j(G, { children: n.map((e, t) => /* @__PURE__ */ j(N, { coachmark: e }, `coachmark-${t}`)) }),
|
102
|
-
T
|
62
|
+
return /* @__PURE__ */ p(b.Provider, { value: x, children: [
|
63
|
+
o.length > 0 && /* @__PURE__ */ k(R, { children: o.map((e, t) => /* @__PURE__ */ k(A, { coachmark: e }, `coachmark-${t}`)) }),
|
64
|
+
v
|
103
65
|
] });
|
104
66
|
};
|
105
67
|
export {
|
106
|
-
|
107
|
-
|
68
|
+
b as JourneyContext,
|
69
|
+
j as JourneyProvider
|
108
70
|
};
|
109
71
|
//# sourceMappingURL=journey-context-provider.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"journey-context-provider.js","sources":["../../../../src/features/journey/use-journey/journey-context-provider.tsx"],"sourcesContent":["/* eslint-disable no-console */\nimport type { TJourneyId } from '../journey-id/journey-id-types';\nimport type {\n ICoachmarkProps,\n IJourneyContext,\n IJourneyProviderProps,\n} from './journey-context-types';\nimport type { FC } from 'react';\n\nimport { createContext, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { Coachmark } from '../comps/coachmark/coachmark';\nimport { useGetUserJourney, usePostUserJourney } from '../user-journey-api/user-journey-api';\nimport * as S from './journey-styled';\n\nexport const JourneyContext = createContext<IJourneyContext | null>(null);\n\nexport const JourneyProvider: FC<IJourneyProviderProps> = ({ children, appId, userId }) => {\n const [userCompletedJourneyIds, setUserCompletedJourneyIds] = useState<TJourneyId[]>([]);\n const [coachmarkList, setCoachmarkList] = useState<ICoachmarkProps[]>([]);\n const [isJourneyActive, setIsJourneyActive] = useState(false);\n const currentIndex = useRef(-1);\n const currentJourneyId = useRef<TJourneyId | undefined>();\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const { post: postJourneyCompletion } = usePostUserJourney();\n const {\n data: userCompletedJourneys = null,\n get: getJourneyProgress,\n isProcessing,\n } = useGetUserJourney();\n\n const showCoachmarks =\n appId === '' // Otherwise coachmark stories wont work\n ? coachmarkList.length > 0\n : userCompletedJourneys && !isProcessing && coachmarkList.length > 0;\n\n const setJourney = useCallback(\n (id: TJourneyId, coachmarks: ICoachmarkProps[]) => {\n if (coachmarkList.length > 0) {\n console.error(\n `setJourney: Other Journey is already active, Current Journey: ${currentJourneyId.current}, New Journey Request: ${id}`,\n );\n\n return;\n }\n setIsJourneyActive(true);\n currentJourneyId.current = id;\n currentIndex.current = -1;\n setCoachmarkList([...coachmarks]);\n },\n [coachmarkList.length],\n );\n\n const clearJourney = useCallback(() => {\n // Clear all timers\n timerRefs.current.forEach(timer => {\n clearTimeout(timer);\n });\n timerRefs.current = [];\n currentJourneyId.current = undefined;\n currentIndex.current = -1;\n setCoachmarkList([]);\n setIsJourneyActive(false);\n }, []);\n\n const endJourney = useCallback(\n (journeyId: TJourneyId) => {\n setUserCompletedJourneyIds(prev => [...prev, journeyId]);\n postJourneyCompletion({\n app_id: appId,\n user_id: userId,\n journey_id: journeyId,\n journey_status: 'COMPLETED',\n });\n clearJourney();\n },\n [appId, clearJourney, postJourneyCompletion, userId],\n );\n\n const addCoachmark = useCallback((id: TJourneyId, coachmark: ICoachmarkProps) => {\n if (!currentJourneyId.current || id !== currentJourneyId.current) {\n console.error(\n currentJourneyId.current\n ? `A Journey is already active, Current Journey: ${currentJourneyId.current}, New Journey Request: ${id}`\n : `addCoachmark was called before setJourney and Journey ID is undefined`,\n );\n\n return;\n }\n\n setCoachmarkList(prev => [...prev, coachmark]);\n }, []);\n\n const nextCoachmark = useCallback(\n (id: TJourneyId, keepPrevActive: boolean = false, delayInMs: number = 0) => {\n if (!currentJourneyId.current || id !== currentJourneyId.current) {\n console.error(\n currentJourneyId.current\n ? `nextCoachmark was called before setJourney`\n : `A Journey is already active, Current Journey: ${currentJourneyId.current}, New Journey Request: ${id}`,\n );\n\n return;\n }\n\n if (delayInMs !== 0) {\n // If delay is not 0, we will hide all them coachmarks and reveal only after the delay\n setCoachmarkList(prevList => {\n return prevList.map((item: ICoachmarkProps) => {\n return { ...item, isActive: false };\n });\n });\n }\n\n const timer = setTimeout(() => {\n clearTimeout(timer);\n const currIndex = currentIndex.current + 1;\n\n setCoachmarkList(prevList => {\n // Finish onboarding\n if (currIndex >= prevList.length || prevList.length === 0) {\n currentJourneyId.current = undefined;\n currentIndex.current = -1;\n\n return [];\n }\n\n currentIndex.current = currIndex;\n const updatedCoachmarkList = [...prevList];\n\n (updatedCoachmarkList[currIndex] as ICoachmarkProps).isActive = true;\n\n if (currIndex > 0) {\n (updatedCoachmarkList[currIndex - 1] as ICoachmarkProps).isActive = keepPrevActive;\n }\n\n return updatedCoachmarkList;\n });\n }, delayInMs);\n\n timerRefs.current.push(timer);\n },\n [],\n );\n\n const memoizedContextValue: IJourneyContext = useMemo(\n () => ({\n nextCoachmark,\n setJourney,\n addCoachmark,\n clearJourney,\n endJourney,\n coachmarks: coachmarkList,\n userCompletedJourneyIds,\n isJourneyActive,\n }),\n [\n nextCoachmark,\n setJourney,\n addCoachmark,\n clearJourney,\n endJourney,\n coachmarkList,\n userCompletedJourneyIds,\n isJourneyActive,\n ],\n );\n\n // Get the initial state of incompleteJourneys\n useEffect(() => {\n if (appId && userId) {\n getJourneyProgress(userId, {\n app_id: appId,\n user_id: userId,\n journey_status: 'COMPLETED',\n });\n }\n }, [appId, getJourneyProgress, userId]);\n\n // Set the data to context state initially\n useEffect(() => {\n if (userCompletedJourneys) {\n const completedUserJourneysIds = userCompletedJourneys.map(journey => journey.journey_id);\n\n setUserCompletedJourneyIds(completedUserJourneysIds);\n }\n }, [userCompletedJourneys]);\n\n return (\n <JourneyContext.Provider value={memoizedContextValue}>\n {showCoachmarks && (\n <S.Overlay>\n {coachmarkList.map((coachmark, index) => (\n <Coachmark key={`coachmark-${index}`} coachmark={coachmark} />\n ))}\n </S.Overlay>\n )}\n {children}\n </JourneyContext.Provider>\n );\n};\n"],"names":["JourneyContext","createContext","JourneyProvider","children","appId","userId","userCompletedJourneyIds","setUserCompletedJourneyIds","useState","coachmarkList","setCoachmarkList","isJourneyActive","setIsJourneyActive","currentIndex","useRef","currentJourneyId","timerRefs","postJourneyCompletion","usePostUserJourney","userCompletedJourneys","getJourneyProgress","isProcessing","useGetUserJourney","showCoachmarks","setJourney","useCallback","id","coachmarks","clearJourney","timer","endJourney","journeyId","prev","addCoachmark","coachmark","nextCoachmark","keepPrevActive","delayInMs","prevList","item","currIndex","updatedCoachmarkList","memoizedContextValue","useMemo","useEffect","completedUserJourneysIds","journey","jsxs","S.Overlay","index","jsx","Coachmark"],"mappings":";;;;;AAea,MAAAA,IAAiBC,EAAsC,IAAI,GAE3DC,IAA6C,CAAC,EAAE,UAAAC,GAAU,OAAAC,GAAO,QAAAC,QAAa;AACzF,QAAM,CAACC,GAAyBC,CAA0B,IAAIC,EAAuB,CAAE,CAAA,GACjF,CAACC,GAAeC,CAAgB,IAAIF,EAA4B,CAAE,CAAA,GAClE,CAACG,GAAiBC,CAAkB,IAAIJ,EAAS,EAAK,GACtDK,IAAe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AAAA,MACZ,yBAAAH;AAAA,MACA,iBAAAK;AAAA,IAAA;AAAA,IAEF;AAAA,MACEwB;AAAA,MACAX;AAAA,MACAS;AAAA,MACAL;AAAA,MACAE;AAAA,MACArB;AAAA,MACAH;AAAA,MACAK;AAAA,IACF;AAAA,EAAA;AAIF,SAAAiC,EAAU,MAAM;AACd,IAAIxC,KAASC,KACXe,EAAmBf,GAAQ;AAAA,MACzB,QAAQD;AAAA,MACR,SAASC;AAAA,MACT,gBAAgB;AAAA,IAAA,CACjB;AAAA,EAEF,GAAA,CAACD,GAAOgB,GAAoBf,CAAM,CAAC,GAGtCuC,EAAU,MAAM;AACd,QAAIzB,GAAuB;AACzB,YAAM0B,IAA2B1B,EAAsB,IAAI,CAAA2B,MAAWA,EAAQ,UAAU;AAExF,MAAAvC,EAA2BsC,CAAwB;AAAA,IACrD;AAAA,EAAA,GACC,CAAC1B,CAAqB,CAAC,GAGvB,gBAAA4B,EAAA/C,EAAe,UAAf,EAAwB,OAAO0C,GAC7B,UAAA;AAAA,IAAAnB,uBACEyB,GAAA,EACE,UAAAvC,EAAc,IAAI,CAACyB,GAAWe,MAC7B,gBAAAC,EAACC,KAAqC,WAAAjB,KAAtB,aAAae,CAAK,EAA0B,CAC7D,GACH;AAAA,IAED9C;AAAA,EACH,EAAA,CAAA;AAEJ;"}
|
1
|
+
{"version":3,"file":"journey-context-provider.js","sources":["../../../../src/features/journey/use-journey/journey-context-provider.tsx"],"sourcesContent":["/* eslint-disable no-console */\nimport type { TJourneyId } from '../journey-id/journey-id-types';\nimport type { ICoachmarkProps, IJourneyContext } from './journey-context-types';\nimport type { FC, ReactNode } from 'react';\n\nimport { createContext, useCallback, useMemo, useRef, useState } from 'react';\n\nimport { Coachmark } from '../comps/coachmark/coachmark';\nimport * as S from './journey-styled';\n\nexport const JourneyContext = createContext<IJourneyContext | null>(null);\n\nexport const JourneyProvider: FC<{ children: ReactNode }> = ({ children }) => {\n const [coachmarkList, setCoachmarkList] = useState<ICoachmarkProps[]>([]);\n const currentIndex = useRef(-1);\n const currentJourneyIdStudent = useRef<TJourneyId | undefined>();\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const setJourney = useCallback(\n (id: TJourneyId, coachmarks: ICoachmarkProps[]) => {\n if (coachmarkList.length > 0) {\n console.error(\n `setJourney: Other Journey is already active, Current Journey: ${currentJourneyIdStudent.current}, New Journey Request: ${id}`,\n );\n\n return;\n }\n currentJourneyIdStudent.current = id;\n currentIndex.current = -1;\n setCoachmarkList([...coachmarks]);\n },\n [coachmarkList.length],\n );\n\n const clearJourney = useCallback(() => {\n // Clear all timers\n timerRefs.current.forEach(timer => {\n clearTimeout(timer);\n });\n timerRefs.current = [];\n currentJourneyIdStudent.current = undefined;\n currentIndex.current = -1;\n setCoachmarkList([]);\n }, []);\n\n const addCoachmark = useCallback((id: TJourneyId, coachmark: ICoachmarkProps) => {\n if (!currentJourneyIdStudent.current || id !== currentJourneyIdStudent.current) {\n console.error(\n currentJourneyIdStudent.current\n ? `A Journey is already active, Current Journey: ${currentJourneyIdStudent.current}, New Journey Request: ${id}`\n : `addCoachmark was called before setJourney and Journey ID is undefined`,\n );\n\n return;\n }\n\n setCoachmarkList(prev => [...prev, coachmark]);\n }, []);\n\n const nextCoachmark = useCallback(\n (id: TJourneyId, keepPrevActive: boolean = false, delayInMs: number = 0) => {\n if (!currentJourneyIdStudent.current || id !== currentJourneyIdStudent.current) {\n console.error(\n currentJourneyIdStudent.current\n ? `nextCoachmark was called before setJourney`\n : `A Journey is already active, Current Journey: ${currentJourneyIdStudent.current}, New Journey Request: ${id}`,\n );\n\n return;\n }\n\n if (delayInMs !== 0) {\n // If delay is not 0, we will hide all them coachmarks and reveal only after the delay\n setCoachmarkList(prevList => {\n return prevList.map((item: ICoachmarkProps) => {\n return { ...item, isActive: false };\n });\n });\n }\n\n const timer = setTimeout(() => {\n clearTimeout(timer);\n const currIndex = currentIndex.current + 1;\n\n setCoachmarkList(prevList => {\n // Finish onboarding\n if (currIndex >= prevList.length || prevList.length === 0) {\n currentJourneyIdStudent.current = undefined;\n currentIndex.current = -1;\n\n return [];\n }\n\n currentIndex.current = currIndex;\n const updatedCoachmarkList = [...prevList];\n\n (updatedCoachmarkList[currIndex] as ICoachmarkProps).isActive = true;\n\n if (currIndex > 0) {\n (updatedCoachmarkList[currIndex - 1] as ICoachmarkProps).isActive = keepPrevActive;\n }\n\n return updatedCoachmarkList;\n });\n }, delayInMs);\n\n timerRefs.current.push(timer);\n },\n [],\n );\n\n const memoizedContextValue = useMemo(\n () => ({\n nextCoachmark,\n setJourney,\n addCoachmark,\n clearJourney,\n coachmarks: coachmarkList,\n }),\n [nextCoachmark, setJourney, addCoachmark, clearJourney, coachmarkList],\n );\n\n return (\n <JourneyContext.Provider value={memoizedContextValue}>\n {coachmarkList.length > 0 && (\n <S.BlurOverlay>\n {coachmarkList.map((coachmark, index) => (\n <Coachmark key={`coachmark-${index}`} coachmark={coachmark} />\n ))}\n </S.BlurOverlay>\n )}\n {children}\n </JourneyContext.Provider>\n );\n};\n"],"names":["JourneyContext","createContext","JourneyProvider","children","coachmarkList","setCoachmarkList","useState","currentIndex","useRef","currentJourneyIdStudent","timerRefs","setJourney","useCallback","id","coachmarks","clearJourney","timer","addCoachmark","coachmark","prev","nextCoachmark","keepPrevActive","delayInMs","prevList","item","currIndex","updatedCoachmarkList","memoizedContextValue","useMemo","jsxs","jsx","S.BlurOverlay","index","Coachmark"],"mappings":";;;;AAUa,MAAAA,IAAiBC,EAAsC,IAAI,GAE3DC,IAA+C,CAAC,EAAE,UAAAC,QAAe;AAC5E,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAA4B,CAAE,CAAA,GAClEC,IAAeC,EAAO,EAAE,GACxBC,IAA0BD,KAC1BE,IAAYF,EAAwC,CAAA,CAAE,GAEtDG,IAAaC;AAAA,IACjB,CAACC,GAAgBC,MAAkC;AAC7C,UAAAV,EAAc,SAAS,GAAG;AACpB,gBAAA;AAAA,UACN,iEAAiE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,EAAS,UAAUA,EAAS,WAAW;AACtD,mBAAAd,EAAwB,UAAU,QAClCF,EAAa,UAAU,IAEhB;AAGT,UAAAA,EAAa,UAAUkB;AACjB,gBAAAC,IAAuB,CAAC,GAAGH,CAAQ;AAExC,iBAAAG,EAAqBD,CAAS,EAAsB,WAAW,IAE5DA,IAAY,MACbC,EAAqBD,IAAY,CAAC,EAAsB,WAAWJ,IAG/DK;AAAA,QAAA,CACR;AAAA,SACAJ,CAAS;AAEF,MAAAZ,EAAA,QAAQ,KAAKM,CAAK;AAAA,IAC9B;AAAA,IACA,CAAC;AAAA,EAAA,GAGGW,IAAuBC;AAAA,IAC3B,OAAO;AAAA,MACL,eAAAR;AAAA,MACA,YAAAT;AAAA,MACA,cAAAM;AAAA,MACA,cAAAF;AAAA,MACA,YAAYX;AAAA,IAAA;AAAA,IAEd,CAACgB,GAAeT,GAAYM,GAAcF,GAAcX,CAAa;AAAA,EAAA;AAGvE,SACG,gBAAAyB,EAAA7B,EAAe,UAAf,EAAwB,OAAO2B,GAC7B,UAAA;AAAA,IAAAvB,EAAc,SAAS,KACtB,gBAAA0B,EAACC,GAAA,EACE,YAAc,IAAI,CAACb,GAAWc,wBAC5BC,GAAqC,EAAA,WAAAf,EAAA,GAAtB,aAAac,CAAK,EAA0B,CAC7D,GACH;AAAA,IAED7B;AAAA,EACH,EAAA,CAAA;AAEJ;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"journey-styled.js","sources":["../../../../src/features/journey/use-journey/journey-styled.tsx"],"sourcesContent":["import styled from 'styled-components';\n\nimport { BLUR_OVERLAY_Z_INDEX } from './constants';\n\nexport const
|
1
|
+
{"version":3,"file":"journey-styled.js","sources":["../../../../src/features/journey/use-journey/journey-styled.tsx"],"sourcesContent":["import styled from 'styled-components';\n\nimport { BLUR_OVERLAY_Z_INDEX } from './constants';\n\nexport const BlurOverlay = styled.div`\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: ${BLUR_OVERLAY_Z_INDEX};\n`;\n"],"names":["BlurOverlay","styled","BLUR_OVERLAY_Z_INDEX"],"mappings":";;AAIO,MAAMA,IAAcC,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAMrBC,CAAoB;AAAA;"}
|
package/dist/index.d.ts
CHANGED
@@ -842,6 +842,7 @@ export declare interface ICircleHomeDetails {
|
|
842
842
|
tournamentRank: number;
|
843
843
|
projects: IProjects;
|
844
844
|
timestamps: ITodaysContentTimeStamps;
|
845
|
+
coachmarkProgress: ICoachmarkProgress;
|
845
846
|
}
|
846
847
|
|
847
848
|
declare interface ICircularSteps {
|
@@ -905,6 +906,15 @@ declare interface ICoachMarkCompletion {
|
|
905
906
|
CIRCLE_TABLES_INTRO_JOURNEY: boolean;
|
906
907
|
}
|
907
908
|
|
909
|
+
export declare interface ICoachmarkProgress {
|
910
|
+
CIRCLE_ACTIVITIES_INTRO_JOURNEY: boolean;
|
911
|
+
CIRCLE_LEADERBOARD_INTRO_JOURNEY: boolean;
|
912
|
+
CIRCLE_POINTS_REWARD_JOURNEY: boolean;
|
913
|
+
CIRCLE_STREAK_UPDATE_JOURNEY: boolean;
|
914
|
+
CIRCLE_TUTORIAL_JOURNEY: boolean;
|
915
|
+
CIRCLE_TABLES_INTRO_JOURNEY: boolean;
|
916
|
+
}
|
917
|
+
|
908
918
|
/**
|
909
919
|
* Represents a coachmark, an interactive guidance element positioned over an existing element.
|
910
920
|
*/
|
@@ -1111,6 +1121,7 @@ declare interface IGameLauncherProps {
|
|
1111
1121
|
defaultIndex?: number;
|
1112
1122
|
journeyId?: TJourneyId;
|
1113
1123
|
isTutorialOnboardingDone?: boolean;
|
1124
|
+
onJourneyComplete: (journeyId: TJourneyId) => void;
|
1114
1125
|
}
|
1115
1126
|
|
1116
1127
|
declare interface IGetArrowTooltipConfig {
|
@@ -1284,7 +1295,6 @@ declare interface IIsOkayTypeQuestion {
|
|
1284
1295
|
* Context interface for managing onboarding journeys using coachmarks.
|
1285
1296
|
*/
|
1286
1297
|
export declare interface IJourneyContext {
|
1287
|
-
isJourneyActive: boolean;
|
1288
1298
|
/** List of all active coachmarks within the journey. */
|
1289
1299
|
coachmarks: ICoachmarkProps[];
|
1290
1300
|
/**
|
@@ -1317,23 +1327,6 @@ export declare interface IJourneyContext {
|
|
1317
1327
|
* @param delayInMs - Optional delay (in milliseconds) before rendering the current coachmark.
|
1318
1328
|
*/
|
1319
1329
|
nextCoachmark: (id: TJourneyId, keepPrevActive?: boolean, delayInMs?: number) => void;
|
1320
|
-
/**
|
1321
|
-
* Must be called to end journey and update the journey status on server.
|
1322
|
-
* @param id - The journey id.
|
1323
|
-
*/
|
1324
|
-
endJourney: (id: TJourneyId) => void;
|
1325
|
-
/**
|
1326
|
-
* Array of IDs representing the journeys that the user has completed.
|
1327
|
-
* This data is set only the component is mounted.
|
1328
|
-
* And thereafter it is updated when the user completes a journey, through the `endJourney` method.
|
1329
|
-
*/
|
1330
|
-
userCompletedJourneyIds: TJourneyId[];
|
1331
|
-
}
|
1332
|
-
|
1333
|
-
declare interface IJourneyProviderProps {
|
1334
|
-
children: React.ReactNode;
|
1335
|
-
appId: string;
|
1336
|
-
userId: string;
|
1337
1330
|
}
|
1338
1331
|
|
1339
1332
|
export declare interface ILayout {
|
@@ -2158,6 +2151,11 @@ export declare interface IPointsLeaderboardDetails extends IBaseLeaderboardDetai
|
|
2158
2151
|
leaderboardPlayers: ILeaderboardPlayerWithPoints[];
|
2159
2152
|
}
|
2160
2153
|
|
2154
|
+
declare interface IPostCircleOnboardingPayload {
|
2155
|
+
intelenrollment_id: string;
|
2156
|
+
completed_coachmarks: string[];
|
2157
|
+
}
|
2158
|
+
|
2161
2159
|
export declare interface IPostGameStat {
|
2162
2160
|
type: EPostGameStat;
|
2163
2161
|
value: number;
|
@@ -3435,7 +3433,9 @@ export declare enum JOURNEY_ID_STUDENT {
|
|
3435
3433
|
CIRCLE_STREAK_REDUCTION_JOURNEY = "CIRCLE_STREAK_REDUCTION_JOURNEY"
|
3436
3434
|
}
|
3437
3435
|
|
3438
|
-
export declare const JourneyProvider: FC<
|
3436
|
+
export declare const JourneyProvider: FC<{
|
3437
|
+
children: ReactNode;
|
3438
|
+
}>;
|
3439
3439
|
|
3440
3440
|
export declare const Leaderboard: ({ leaderboardData, type, userId, onClose, isLoading, streakInfo, }: ILeaderboardProps) => JSX_2.Element;
|
3441
3441
|
|
@@ -3720,7 +3720,12 @@ export declare enum PLATFORM_EVENTS_STUDENT {
|
|
3720
3720
|
|
3721
3721
|
export declare enum PLATFORM_EVENTS_TEACHER {
|
3722
3722
|
PAGE_VIEWED = "page_viewed",
|
3723
|
-
RESOURCE_ASSIGNED = "resource_assigned"
|
3723
|
+
RESOURCE_ASSIGNED = "resource_assigned",
|
3724
|
+
LESSON_FEEDBACK_POSITIVE = "lesson_feedback_positive",
|
3725
|
+
LESSON_FEEDBACK_NEGATIVE = "lesson_feedback_negative",
|
3726
|
+
LESSON_FEEDBACK_BACK_BUTTON = "lesson_feedback_back_button",
|
3727
|
+
LESSON_FEEDBACK_SUBMIT = "lesson_feedback_submit",
|
3728
|
+
LESSON_FEEDBACK_NEXT = "lesson_feedback_next"
|
3724
3729
|
}
|
3725
3730
|
|
3726
3731
|
export declare const Play2Icon: React_2.FC<React_2.SVGProps<SVGSVGElement>>;
|
@@ -4275,6 +4280,11 @@ export declare type TInclassMessage = {
|
|
4275
4280
|
attemptId: string;
|
4276
4281
|
itemType: TItemType;
|
4277
4282
|
};
|
4283
|
+
} | {
|
4284
|
+
eventName: 'STUDENT_LEARNING_WORKSHEET_COMPLETED';
|
4285
|
+
eventPayload: {
|
4286
|
+
worksheetId: string;
|
4287
|
+
};
|
4278
4288
|
} | {
|
4279
4289
|
eventName: typeof EVENTS.CHAPTER_UPDATED;
|
4280
4290
|
eventPayload: {
|
@@ -5012,8 +5022,6 @@ export declare const useGetCircleHomeDetailsDal: (userId: string, grade: string,
|
|
5012
5022
|
invalidateCircleHomeDetails: () => void;
|
5013
5023
|
};
|
5014
5024
|
|
5015
|
-
export declare const useGetEligibleJourneysViaRoute: (routeJourneyIds: TJourneyId[]) => JOURNEY_ID_STUDENT[];
|
5016
|
-
|
5017
5025
|
declare const useGetLeaderboard: (initialId?: string, initialQuery?: IGetLeaderboardPayloadModel | undefined) => {
|
5018
5026
|
get: (id: string, query: IGetLeaderboardPayloadModel, meta: void) => Promise<void>;
|
5019
5027
|
resource: ResourceModel<IGetLeaderboardResponseModel> | undefined;
|
@@ -5080,6 +5088,19 @@ export declare const useJourney: () => IJourneyContext;
|
|
5080
5088
|
|
5081
5089
|
export declare const usePointerSync: ({ userType, targetUserId, }: IusePointerSyncProps) => IusePointerSyncMethods;
|
5082
5090
|
|
5091
|
+
declare const usePostUpdateCircleCoachmark: (opts?: {
|
5092
|
+
onComplete?: ((errorMessage: string | null, data?: IGetCircleHomeResponseModel | undefined, permissions?: void | undefined) => void) | undefined;
|
5093
|
+
triggerOnComplete?: boolean | undefined;
|
5094
|
+
} | undefined) => {
|
5095
|
+
post: (body: IPostCircleOnboardingPayload, meta: void) => Promise<void>;
|
5096
|
+
isProcessing: boolean;
|
5097
|
+
onComplete: (() => void) | undefined;
|
5098
|
+
};
|
5099
|
+
|
5100
|
+
export declare const usePostUpdateCircleJourneyDal: () => Omit<ReturnType<typeof usePostUpdateCircleCoachmark>, "data" | "post"> & {
|
5101
|
+
postCircleJourneyCompletion: (userId: string, journeyCompletionIds: TJourneyId[]) => void;
|
5102
|
+
};
|
5103
|
+
|
5083
5104
|
export declare const User2Icon: React.FC<React.SVGProps<SVGSVGElement>>;
|
5084
5105
|
|
5085
5106
|
export declare const UserIcon: React.FC<React.SVGProps<SVGSVGElement>>;
|