@cuemath/leap 3.5.0 → 3.5.1
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.
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsxs as W, jsx as
|
|
2
|
-
import { createContext as M, useState as s, useRef as
|
|
1
|
+
import { jsxs as W, jsx as O } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as M, useState as s, useRef as w, useCallback as c, useMemo as G, useEffect as T } from "react";
|
|
3
3
|
import { Coachmark as F } from "../comps/coachmark/coachmark.js";
|
|
4
4
|
import { usePostUserJourney as I, useGetUserJourney as K } from "../user-journey-api/user-journey-api.js";
|
|
5
5
|
import { Overlay as Q } from "./journey-styled.js";
|
|
6
6
|
const X = M(null), ne = ({ children: U, appId: l, userId: i }) => {
|
|
7
|
-
const [q, z] = s(!0), [D, H] = s(!1), [p, x] = s(null), [y, d] = s([]), [f, A] = s(!1),
|
|
8
|
-
height:
|
|
9
|
-
width:
|
|
10
|
-
}), { post: _ } = I(), { data:
|
|
7
|
+
const [q, z] = s(!0), [D, H] = s(!1), [p, x] = s(null), [y, d] = s([]), [f, A] = s(!1), h = w(-1), t = w(void 0), g = w([]), [L, N] = s(!1), [$, R] = s({
|
|
8
|
+
height: document.body.clientHeight,
|
|
9
|
+
width: document.body.clientWidth
|
|
10
|
+
}), { post: _ } = I(), { data: C = null, get: P } = K(), J = c(
|
|
11
11
|
(e) => {
|
|
12
12
|
_({
|
|
13
13
|
app_id: l,
|
|
@@ -17,37 +17,37 @@ const X = M(null), ne = ({ children: U, appId: l, userId: i }) => {
|
|
|
17
17
|
});
|
|
18
18
|
},
|
|
19
19
|
[l, _, i]
|
|
20
|
-
),
|
|
21
|
-
(e, r, o,
|
|
22
|
-
var
|
|
20
|
+
), b = c(
|
|
21
|
+
(e, r, o, k = !0) => {
|
|
22
|
+
var m, n;
|
|
23
23
|
if (y.length > 0) {
|
|
24
24
|
console.error(
|
|
25
25
|
`setJourney: Other Journey is already active, Current Journey: ${t.current}, New Journey Request: ${e}`
|
|
26
26
|
);
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
A(!0), z(
|
|
29
|
+
A(!0), z(k), t.current = e, h.current = -1, d(
|
|
30
30
|
r.map((u) => ({
|
|
31
31
|
...u,
|
|
32
32
|
isActive: !1
|
|
33
33
|
// New coachmarks are inactive by default
|
|
34
34
|
}))
|
|
35
35
|
), o && (R({
|
|
36
|
-
height: ((
|
|
36
|
+
height: ((m = o.current) == null ? void 0 : m.clientHeight) || window.innerHeight,
|
|
37
37
|
width: ((n = o.current) == null ? void 0 : n.clientWidth) || window.innerWidth
|
|
38
38
|
}), N(!0));
|
|
39
39
|
},
|
|
40
40
|
[y.length]
|
|
41
41
|
), a = c(() => {
|
|
42
|
-
|
|
42
|
+
g.current.forEach((e) => {
|
|
43
43
|
clearTimeout(e);
|
|
44
|
-
}),
|
|
45
|
-
}, []),
|
|
44
|
+
}), g.current = [], t.current = void 0, h.current = -1, d([]), A(!1);
|
|
45
|
+
}, []), B = c(
|
|
46
46
|
(e) => {
|
|
47
47
|
a(), x((r) => r && !r.includes(e) ? [...r, e] : r), J(e);
|
|
48
48
|
},
|
|
49
49
|
[a, J]
|
|
50
|
-
),
|
|
50
|
+
), E = c((e, r) => {
|
|
51
51
|
if (!t.current || e !== t.current) {
|
|
52
52
|
console.error(
|
|
53
53
|
t.current ? `A Journey is already active, Current Journey: ${t.current}, New Journey Request: ${e}` : "addCoachmark was called before setJourney and Journey ID is undefined"
|
|
@@ -62,71 +62,71 @@ const X = M(null), ne = ({ children: U, appId: l, userId: i }) => {
|
|
|
62
62
|
// New coachmarks are inactive by default
|
|
63
63
|
}
|
|
64
64
|
]);
|
|
65
|
-
}, []),
|
|
66
|
-
(e, r = !1, o = 0,
|
|
65
|
+
}, []), S = c(
|
|
66
|
+
(e, r = !1, o = 0, k = !1) => {
|
|
67
67
|
if (!t.current || e !== t.current) {
|
|
68
68
|
console.error(
|
|
69
69
|
t.current ? "nextCoachmark was called before setJourney" : `A Journey is already active, Current Journey: ${t.current}, New Journey Request: ${e}`
|
|
70
70
|
);
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
|
-
H(
|
|
74
|
-
const
|
|
75
|
-
clearTimeout(
|
|
76
|
-
const n =
|
|
73
|
+
H(k), o !== 0 && d((n) => n.map((u) => ({ ...u, isActive: !1 })));
|
|
74
|
+
const m = setTimeout(() => {
|
|
75
|
+
clearTimeout(m);
|
|
76
|
+
const n = h.current + 1;
|
|
77
77
|
d((u) => {
|
|
78
78
|
if (n >= u.length || u.length === 0)
|
|
79
79
|
return a(), [];
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
return
|
|
80
|
+
h.current = n;
|
|
81
|
+
const v = [...u];
|
|
82
|
+
return v[n].isActive = !0, n > 0 && (v[n - 1].isActive = r), v;
|
|
83
83
|
});
|
|
84
84
|
}, o);
|
|
85
|
-
|
|
85
|
+
g.current.push(m);
|
|
86
86
|
},
|
|
87
87
|
[a]
|
|
88
|
-
),
|
|
88
|
+
), j = c(
|
|
89
89
|
(e) => {
|
|
90
90
|
J(e);
|
|
91
91
|
},
|
|
92
92
|
[J]
|
|
93
93
|
), V = G(
|
|
94
94
|
() => ({
|
|
95
|
-
nextCoachmark:
|
|
96
|
-
setJourney:
|
|
97
|
-
addCoachmark:
|
|
95
|
+
nextCoachmark: S,
|
|
96
|
+
setJourney: b,
|
|
97
|
+
addCoachmark: E,
|
|
98
98
|
clearJourney: a,
|
|
99
|
-
endJourney:
|
|
99
|
+
endJourney: B,
|
|
100
100
|
coachmarks: y,
|
|
101
101
|
userCompletedJourneyIds: p,
|
|
102
102
|
isJourneyActive: f,
|
|
103
|
-
trackView:
|
|
103
|
+
trackView: j
|
|
104
104
|
}),
|
|
105
105
|
[
|
|
106
|
-
j,
|
|
107
|
-
B,
|
|
108
106
|
S,
|
|
109
|
-
|
|
107
|
+
b,
|
|
110
108
|
E,
|
|
109
|
+
a,
|
|
110
|
+
B,
|
|
111
111
|
y,
|
|
112
112
|
p,
|
|
113
113
|
f,
|
|
114
|
-
|
|
114
|
+
j
|
|
115
115
|
]
|
|
116
116
|
);
|
|
117
|
-
return
|
|
117
|
+
return T(() => {
|
|
118
118
|
l && i && P(i, {
|
|
119
119
|
app_id: l,
|
|
120
120
|
user_id: i,
|
|
121
121
|
journey_status: "COMPLETED"
|
|
122
122
|
});
|
|
123
|
-
}, [l, P, i]),
|
|
124
|
-
if (
|
|
125
|
-
const e =
|
|
123
|
+
}, [l, P, i]), T(() => {
|
|
124
|
+
if (C) {
|
|
125
|
+
const e = C.map((r) => r.journey_id);
|
|
126
126
|
x(e);
|
|
127
127
|
}
|
|
128
|
-
}, [
|
|
129
|
-
f && /* @__PURE__ */
|
|
128
|
+
}, [C]), /* @__PURE__ */ W(X.Provider, { value: V, children: [
|
|
129
|
+
f && /* @__PURE__ */ O(
|
|
130
130
|
Q,
|
|
131
131
|
{
|
|
132
132
|
about: "journey-overlay",
|
|
@@ -135,7 +135,7 @@ const X = M(null), ne = ({ children: U, appId: l, userId: i }) => {
|
|
|
135
135
|
$isJourneyBlurred: D,
|
|
136
136
|
$isBlockingJourney: q,
|
|
137
137
|
"data-testid": t.current,
|
|
138
|
-
children: y.map((e, r) => /* @__PURE__ */
|
|
138
|
+
children: y.map((e, r) => /* @__PURE__ */ O(
|
|
139
139
|
F,
|
|
140
140
|
{
|
|
141
141
|
coachmark: e,
|
|
@@ -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 { FC, RefObject } from 'react';\nimport { createContext, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { Coachmark } from '../comps/coachmark/coachmark';\nimport type { TJourneyId } from '../journey-id/journey-id-types';\nimport type { TTrackingId } from '../tracking-id/tracking-id-types';\nimport { useGetUserJourney, usePostUserJourney } from '../user-journey-api/user-journey-api';\nimport type {\n ICoachmarkProps,\n IJourneyContext,\n IJourneyProviderProps,\n TCoachmarkJourneyProps,\n} from './journey-context-types';\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 [isBlockingJourney, setIsBlockingJourney] = useState<boolean>(true);\n const [isJourneyBlurred, setIsJourneyBlurred] = useState<boolean>(false);\n const [userCompletedJourneyIds, setUserCompletedJourneyIds] = useState<TJourneyId[] | null>(null);\n const [coachmarkList, setCoachmarkList] = useState<ICoachmarkProps[]>([]);\n const [isJourneyActive, setIsJourneyActive] = useState(false);\n const currentIndex = useRef(-1);\n const currentJourneyId = useRef<TJourneyId | undefined>(undefined);\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const [isScrollableJourney, setIsScrollableJourney] = useState<boolean>(false);\n const [overlaySize, setOverlaySize] = useState({\n height: window.innerHeight,\n width: window.innerWidth,\n });\n\n const { post: postJourneyCompletion } = usePostUserJourney();\n const { data: userCompletedJourneys = null, get: getJourneyProgress } = useGetUserJourney();\n\n const saveProgress = useCallback(\n (journeyId: TJourneyId | TTrackingId) => {\n postJourneyCompletion({\n app_id: appId,\n user_id: userId,\n journey_id: journeyId,\n journey_status: 'COMPLETED',\n });\n },\n [appId, postJourneyCompletion, userId],\n );\n\n const setJourney = useCallback(\n (\n id: TJourneyId,\n coachmarks: TCoachmarkJourneyProps[],\n scrollableContRef?: RefObject<HTMLDivElement | null>,\n isBlocking: boolean = true,\n ) => {\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 setIsBlockingJourney(isBlocking);\n currentJourneyId.current = id;\n currentIndex.current = -1;\n setCoachmarkList(\n coachmarks.map((item: TCoachmarkJourneyProps) => {\n return {\n ...item,\n isActive: false, // New coachmarks are inactive by default\n } as ICoachmarkProps;\n }),\n );\n if (scrollableContRef) {\n setOverlaySize({\n height: scrollableContRef.current?.clientHeight || window.innerHeight,\n width: scrollableContRef.current?.clientWidth || window.innerWidth,\n });\n setIsScrollableJourney(true);\n }\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 clearJourney();\n setUserCompletedJourneyIds(prev => {\n if (prev && !prev.includes(journeyId)) {\n return [...prev, journeyId];\n }\n\n return prev;\n });\n saveProgress(journeyId);\n },\n [clearJourney, saveProgress],\n );\n\n const addCoachmark = useCallback((id: TJourneyId, coachmark: TCoachmarkJourneyProps) => {\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 => [\n ...prev,\n {\n ...coachmark,\n isActive: false, // New coachmarks are inactive by default\n } as ICoachmarkProps,\n ]);\n }, []);\n\n const nextCoachmark = useCallback(\n (\n id: TJourneyId,\n keepPrevActive: boolean = false,\n delayInMs: number = 0,\n shouldBlurNextJourney: boolean = false,\n ) => {\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 setIsJourneyBlurred(shouldBlurNextJourney);\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: TCoachmarkJourneyProps) => {\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 clearJourney();\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 [clearJourney],\n );\n\n const trackView = useCallback(\n (viewId: TTrackingId) => {\n saveProgress(viewId);\n },\n [saveProgress],\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 trackView,\n }),\n [\n nextCoachmark,\n setJourney,\n addCoachmark,\n clearJourney,\n endJourney,\n coachmarkList,\n userCompletedJourneyIds,\n isJourneyActive,\n trackView,\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 {isJourneyActive && (\n <S.Overlay\n about=\"journey-overlay\"\n height={overlaySize.height}\n width={overlaySize.width}\n $isJourneyBlurred={isJourneyBlurred}\n $isBlockingJourney={isBlockingJourney}\n data-testid={currentJourneyId.current}\n >\n {coachmarkList.map((coachmark, index) => (\n <Coachmark\n key={`coachmark-${index}`}\n coachmark={coachmark}\n isInsideScrollView={isScrollableJourney}\n />\n ))}\n </S.Overlay>\n )}\n {children}\n </JourneyContext.Provider>\n );\n};\n"],"names":["JourneyContext","createContext","JourneyProvider","children","appId","userId","isBlockingJourney","setIsBlockingJourney","useState","isJourneyBlurred","setIsJourneyBlurred","userCompletedJourneyIds","setUserCompletedJourneyIds","coachmarkList","setCoachmarkList","isJourneyActive","setIsJourneyActive","currentIndex","useRef","currentJourneyId","timerRefs","isScrollableJourney","setIsScrollableJourney","overlaySize","setOverlaySize","postJourneyCompletion","usePostUserJourney","userCompletedJourneys","getJourneyProgress","useGetUserJourney","saveProgress","useCallback","journeyId","setJourney","id","coachmarks","scrollableContRef","isBlocking","item","_a","_b","clearJourney","timer","endJourney","prev","addCoachmark","coachmark","nextCoachmark","keepPrevActive","delayInMs","shouldBlurNextJourney","prevList","currIndex","updatedCoachmarkList","trackView","viewId","memoizedContextValue","useMemo","useEffect","completedUserJourneysIds","journey","jsxs","jsx","S.Overlay","index","Coachmark"],"mappings":";;;;;AAgBa,MAAAA,IAAiBC,EAAsC,IAAI,GAE3DC,KAA6C,CAAC,EAAE,UAAAC,GAAU,OAAAC,GAAO,QAAAC,QAAa;AACzF,QAAM,CAACC,GAAmBC,CAAoB,IAAIC,EAAkB,EAAI,GAClE,CAACC,GAAkBC,CAAmB,IAAIF,EAAkB,EAAK,GACjE,CAACG,GAAyBC,CAA0B,IAAIJ,EAA8B,IAAI,GAC1F,CAACK,GAAeC,CAAgB,IAAIN,EAA4B,CAAE,CAAA,GAClE,CAACO,GAAiBC,CAAkB,IAAIR,EAAS,EAAK,GACtDS,IAAeC,EAAO,EAAE,GACxBC,IAAmBD,EAA+B,MAAS,GAC3DE,IAAYF,EAAwC,CAAA,CAAE,GAEtD,CAACG,GAAqBC,CAAsB,IAAId,EAAkB,EAAK,GACvE,CAACe,GAAaC,CAAc,IAAIhB,EAAS;AAAA,IAC7C,QAAQ,OAAO;AAAA,IACf,OAAO,OAAO;AA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AA+C;AAAA,MAACC;AAAAA,MAAA;AAAA,QACC,OAAM;AAAA,QACN,QAAQxC,EAAY;AAAA,QACpB,OAAOA,EAAY;AAAA,QACnB,mBAAmBd;AAAA,QACnB,oBAAoBH;AAAA,QACpB,eAAaa,EAAiB;AAAA,QAE7B,UAAcN,EAAA,IAAI,CAACiC,GAAWkB,MAC7B,gBAAAF;AAAA,UAACG;AAAA,UAAA;AAAA,YAEC,WAAAnB;AAAA,YACA,oBAAoBzB;AAAA,UAAA;AAAA,UAFf,aAAa2C,CAAK;AAAA,QAAA,CAI1B;AAAA,MAAA;AAAA,IACH;AAAA,IAED7D;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 { FC, RefObject } from 'react';\nimport { createContext, useCallback, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { Coachmark } from '../comps/coachmark/coachmark';\nimport type { TJourneyId } from '../journey-id/journey-id-types';\nimport type { TTrackingId } from '../tracking-id/tracking-id-types';\nimport { useGetUserJourney, usePostUserJourney } from '../user-journey-api/user-journey-api';\nimport type {\n ICoachmarkProps,\n IJourneyContext,\n IJourneyProviderProps,\n TCoachmarkJourneyProps,\n} from './journey-context-types';\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 [isBlockingJourney, setIsBlockingJourney] = useState<boolean>(true);\n const [isJourneyBlurred, setIsJourneyBlurred] = useState<boolean>(false);\n const [userCompletedJourneyIds, setUserCompletedJourneyIds] = useState<TJourneyId[] | null>(null);\n const [coachmarkList, setCoachmarkList] = useState<ICoachmarkProps[]>([]);\n const [isJourneyActive, setIsJourneyActive] = useState(false);\n const currentIndex = useRef(-1);\n const currentJourneyId = useRef<TJourneyId | undefined>(undefined);\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const [isScrollableJourney, setIsScrollableJourney] = useState<boolean>(false);\n const [overlaySize, setOverlaySize] = useState({\n height: document.body.clientHeight,\n width: document.body.clientWidth,\n });\n\n const { post: postJourneyCompletion } = usePostUserJourney();\n const { data: userCompletedJourneys = null, get: getJourneyProgress } = useGetUserJourney();\n\n const saveProgress = useCallback(\n (journeyId: TJourneyId | TTrackingId) => {\n postJourneyCompletion({\n app_id: appId,\n user_id: userId,\n journey_id: journeyId,\n journey_status: 'COMPLETED',\n });\n },\n [appId, postJourneyCompletion, userId],\n );\n\n const setJourney = useCallback(\n (\n id: TJourneyId,\n coachmarks: TCoachmarkJourneyProps[],\n scrollableContRef?: RefObject<HTMLDivElement | null>,\n isBlocking: boolean = true,\n ) => {\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 setIsBlockingJourney(isBlocking);\n currentJourneyId.current = id;\n currentIndex.current = -1;\n setCoachmarkList(\n coachmarks.map((item: TCoachmarkJourneyProps) => {\n return {\n ...item,\n isActive: false, // New coachmarks are inactive by default\n } as ICoachmarkProps;\n }),\n );\n if (scrollableContRef) {\n setOverlaySize({\n height: scrollableContRef.current?.clientHeight || window.innerHeight,\n width: scrollableContRef.current?.clientWidth || window.innerWidth,\n });\n setIsScrollableJourney(true);\n }\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 clearJourney();\n setUserCompletedJourneyIds(prev => {\n if (prev && !prev.includes(journeyId)) {\n return [...prev, journeyId];\n }\n\n return prev;\n });\n saveProgress(journeyId);\n },\n [clearJourney, saveProgress],\n );\n\n const addCoachmark = useCallback((id: TJourneyId, coachmark: TCoachmarkJourneyProps) => {\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 => [\n ...prev,\n {\n ...coachmark,\n isActive: false, // New coachmarks are inactive by default\n } as ICoachmarkProps,\n ]);\n }, []);\n\n const nextCoachmark = useCallback(\n (\n id: TJourneyId,\n keepPrevActive: boolean = false,\n delayInMs: number = 0,\n shouldBlurNextJourney: boolean = false,\n ) => {\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 setIsJourneyBlurred(shouldBlurNextJourney);\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: TCoachmarkJourneyProps) => {\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 clearJourney();\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 [clearJourney],\n );\n\n const trackView = useCallback(\n (viewId: TTrackingId) => {\n saveProgress(viewId);\n },\n [saveProgress],\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 trackView,\n }),\n [\n nextCoachmark,\n setJourney,\n addCoachmark,\n clearJourney,\n endJourney,\n coachmarkList,\n userCompletedJourneyIds,\n isJourneyActive,\n trackView,\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 {isJourneyActive && (\n <S.Overlay\n about=\"journey-overlay\"\n height={overlaySize.height}\n width={overlaySize.width}\n $isJourneyBlurred={isJourneyBlurred}\n $isBlockingJourney={isBlockingJourney}\n data-testid={currentJourneyId.current}\n >\n {coachmarkList.map((coachmark, index) => (\n <Coachmark\n key={`coachmark-${index}`}\n coachmark={coachmark}\n isInsideScrollView={isScrollableJourney}\n />\n ))}\n </S.Overlay>\n )}\n {children}\n </JourneyContext.Provider>\n );\n};\n"],"names":["JourneyContext","createContext","JourneyProvider","children","appId","userId","isBlockingJourney","setIsBlockingJourney","useState","isJourneyBlurred","setIsJourneyBlurred","userCompletedJourneyIds","setUserCompletedJourneyIds","coachmarkList","setCoachmarkList","isJourneyActive","setIsJourneyActive","currentIndex","useRef","currentJourneyId","timerRefs","isScrollableJourney","setIsScrollableJourney","overlaySize","setOverlaySize","postJourneyCompletion","usePostUserJourney","userCompletedJourneys","getJourneyProgress","useGetUserJourney","saveProgress","useCallback","journeyId","setJourney","id","coachmarks","scrollableContRef","isBlocking","item","_a","_b","clearJourney","timer","endJourney","prev","addCoachmark","coachmark","nextCoachmark","keepPrevActive","delayInMs","shouldBlurNextJourney","prevList","currIndex","updatedCoachmarkList","trackView","viewId","memoizedContextValue","useMemo","useEffect","completedUserJourneysIds","journey","jsxs","jsx","S.Overlay","index","Coachmark"],"mappings":";;;;;AAgBa,MAAAA,IAAiBC,EAAsC,IAAI,GAE3DC,KAA6C,CAAC,EAAE,UAAAC,GAAU,OAAAC,GAAO,QAAAC,QAAa;AACzF,QAAM,CAACC,GAAmBC,CAAoB,IAAIC,EAAkB,EAAI,GAClE,CAACC,GAAkBC,CAAmB,IAAIF,EAAkB,EAAK,GACjE,CAACG,GAAyBC,CAA0B,IAAIJ,EAA8B,IAAI,GAC1F,CAACK,GAAeC,CAAgB,IAAIN,EAA4B,CAAE,CAAA,GAClE,CAACO,GAAiBC,CAAkB,IAAIR,EAAS,EAAK,GACtDS,IAAeC,EAAO,EAAE,GACxBC,IAAmBD,EAA+B,MAAS,GAC3DE,IAAYF,EAAwC,CAAA,CAAE,GAEtD,CAACG,GAAqBC,CAAsB,IAAId,EAAkB,EAAK,GACvE,CAACe,GAAaC,CAAc,IAAIhB,EAAS;AAAA,IAC7C,QAAQ,SAAS,KAAK;AAAA,IACtB,OAAO,SAAS,KAAK;AAAA,EAAA,CACtB,GAEK,EAAE,MAAMiB,EAAsB,IAAIC,EAAmB,GACrD,EAAE,MAAMC,IAAwB,MAAM,KAAKC,EAAA,IAAuBC,KAElEC,IAAeC;AAAA,IACnB,CAACC,MAAwC;AACjB,MAAAP,EAAA;AAAA,QACpB,QAAQrB;AAAA,QACR,SAASC;AAAA,QACT,YAAY2B;AAAA,QACZ,gBAAgB;AAAA,MAAA,CACjB;AAAA,IACH;AAAA,IACA,CAAC5B,GAAOqB,GAAuBpB,CAAM;AAAA,EAAA,GAGjC4B,IAAaF;AAAA,IACjB,CACEG,GACAC,GACAC,GACAC,IAAsB,OACnB;;AACC,UAAAxB,EAAc,SAAS,GAAG;AACpB,gBAAA;AAAA,UACN,iEAAiEM,E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,40 @@
|
|
|
1
|
-
import { ButtonHTMLAttributes } from 'react';
|
|
2
|
-
import { Channel } from '@cuemath/cue-message-broker';
|
|
1
|
+
import type { ButtonHTMLAttributes } from 'react';
|
|
2
|
+
import type { Channel } from '@cuemath/cue-message-broker';
|
|
3
3
|
import { ChannelStatus } from '@cuemath/cue-message-broker';
|
|
4
4
|
import { ComponentType } from 'react';
|
|
5
|
-
import { Config } from '@lottiefiles/dotlottie-web';
|
|
5
|
+
import type { Config } from '@lottiefiles/dotlottie-web';
|
|
6
6
|
import { Context } from 'react';
|
|
7
|
-
import { Data } from '@lottiefiles/dotlottie-web';
|
|
8
|
-
import {
|
|
9
|
-
import { DefaultTheme } from 'styled-components';
|
|
7
|
+
import type { Data } from '@lottiefiles/dotlottie-web';
|
|
8
|
+
import type { DefaultTheme } from 'styled-components';
|
|
10
9
|
import { DetailedHTMLProps } from 'react';
|
|
11
|
-
import { Dispatch } from 'react';
|
|
12
|
-
import { EventListener as EventListener_2 } from '@lottiefiles/dotlottie-web';
|
|
13
|
-
import { EventType } from '@lottiefiles/dotlottie-web';
|
|
10
|
+
import type { Dispatch } from 'react';
|
|
11
|
+
import type { EventListener as EventListener_2 } from '@lottiefiles/dotlottie-web';
|
|
12
|
+
import type { EventType } from '@lottiefiles/dotlottie-web';
|
|
14
13
|
import { FC } from 'react';
|
|
15
|
-
import { FormEvent } from 'react';
|
|
14
|
+
import type { FormEvent } from 'react';
|
|
16
15
|
import { ForwardRefExoticComponent } from 'react';
|
|
17
16
|
import { HTMLAttributes } from 'react';
|
|
18
|
-
import { HTMLProps } from 'react';
|
|
17
|
+
import type { HTMLProps } from 'react';
|
|
19
18
|
import { IChannelMessage } from '@cuemath/cue-message-broker';
|
|
20
|
-
import { IframeHTMLAttributes } from 'react';
|
|
21
|
-
import { ImgHTMLAttributes } from 'react';
|
|
22
|
-
import { InputHTMLAttributes } from 'react';
|
|
19
|
+
import type { IframeHTMLAttributes } from 'react';
|
|
20
|
+
import type { ImgHTMLAttributes } from 'react';
|
|
21
|
+
import type { InputHTMLAttributes } from 'react';
|
|
23
22
|
import { IProvidedProps } from 'google-maps-react';
|
|
24
23
|
import { IStyledComponent } from 'styled-components';
|
|
25
24
|
import { JSX } from 'react/jsx-runtime';
|
|
26
25
|
import { MemoExoticComponent } from 'react';
|
|
27
|
-
import { MutableRefObject } from 'react';
|
|
26
|
+
import type { MutableRefObject } from 'react';
|
|
28
27
|
import { NamedExoticComponent } from 'react';
|
|
29
28
|
import { Omit as Omit_2 } from 'google-maps-react';
|
|
30
|
-
import { PLUGIN_NAME } from '@cuemath/analytics-v2/dist/constants';
|
|
29
|
+
import type { PLUGIN_NAME } from '@cuemath/analytics-v2/dist/constants';
|
|
31
30
|
import { PropsWithChildren } from 'react';
|
|
31
|
+
import { default as React_2 } from 'react';
|
|
32
32
|
import { ReactElement } from 'react';
|
|
33
33
|
import { ReactNode } from 'react';
|
|
34
34
|
import { RefAttributes } from 'react';
|
|
35
35
|
import { RefObject } from 'react';
|
|
36
36
|
import { ResourceModel } from '@cuemath/rest-api';
|
|
37
|
-
import { SetStateAction } from 'react';
|
|
37
|
+
import type { SetStateAction } from 'react';
|
|
38
38
|
import { Substitute } from 'styled-components/dist/types';
|
|
39
39
|
import { SVGProps } from 'react';
|
|
40
40
|
import { VideoHTMLAttributes } from 'react';
|
|
@@ -85,7 +85,7 @@ declare type AnimationSegment = [number, number];
|
|
|
85
85
|
export declare const AppLoader: FC<IAppLoaderProps>;
|
|
86
86
|
|
|
87
87
|
export declare const ArcButton: NamedExoticComponent<IArcButtonProps & {
|
|
88
|
-
children?: ReactNode | undefined;
|
|
88
|
+
children?: ReactNode | undefined;
|
|
89
89
|
} & RefAttributes<HTMLDivElement>>;
|
|
90
90
|
|
|
91
91
|
export declare const ArrowTooltip: NamedExoticComponent<IArrowTooltipProps>;
|
|
@@ -422,9 +422,9 @@ export declare const CueBoardFilledIcon: FC<SVGProps<SVGSVGElement>>;
|
|
|
422
422
|
|
|
423
423
|
export declare const CueBoardIcon: FC<SVGProps<SVGSVGElement>>;
|
|
424
424
|
|
|
425
|
-
export declare const CueCanvas:
|
|
425
|
+
export declare const CueCanvas: React_2.FC<ICueCanvas>;
|
|
426
426
|
|
|
427
|
-
export declare const CueCanvasController:
|
|
427
|
+
export declare const CueCanvasController: React_2.FC<IToolbarProps>;
|
|
428
428
|
|
|
429
429
|
export declare const CueCanvasHomeworkController: NamedExoticComponent<IHomeWorkControllerProps>;
|
|
430
430
|
|
|
@@ -441,7 +441,7 @@ declare interface CueCoinIconProps extends SVGProps<SVGSVGElement> {
|
|
|
441
441
|
variant?: 'gold' | 'silver';
|
|
442
442
|
}
|
|
443
443
|
|
|
444
|
-
export declare const CuemathAppFeatures: NamedExoticComponent<
|
|
444
|
+
export declare const CuemathAppFeatures: NamedExoticComponent<{}>;
|
|
445
445
|
|
|
446
446
|
export declare const CuemathLogo: FC<SVGProps<SVGSVGElement>>;
|
|
447
447
|
|
|
@@ -689,7 +689,7 @@ declare enum GENDER {
|
|
|
689
689
|
OTHER = "OTHER"
|
|
690
690
|
}
|
|
691
691
|
|
|
692
|
-
export declare const getActiveSATSheet: (sheets: TLPARSheetData[]) => TLPARSheetData
|
|
692
|
+
export declare const getActiveSATSheet: (sheets: TLPARSheetData[]) => TLPARSheetData;
|
|
693
693
|
|
|
694
694
|
declare const getArrowTooltipConfig: IGetArrowTooltipConfig;
|
|
695
695
|
|
|
@@ -785,7 +785,7 @@ export declare const HintFillIcon: FC<SVGProps<SVGSVGElement>>;
|
|
|
785
785
|
|
|
786
786
|
export declare const HomeIcon: FC<SVGProps<SVGSVGElement>>;
|
|
787
787
|
|
|
788
|
-
export declare const HomeworkCardList:
|
|
788
|
+
export declare const HomeworkCardList: React_2.NamedExoticComponent<HWCardListProps>;
|
|
789
789
|
|
|
790
790
|
declare const hues: readonly ["YELLOW", "ORANGE", "PURPLE", "GREEN", "BLUE"];
|
|
791
791
|
|
|
@@ -796,7 +796,7 @@ declare interface HWCardListProps extends INodeCardCallbacks {
|
|
|
796
796
|
onTestPreview?: (sheetData: INodeDataProps, milestoneId?: string) => void;
|
|
797
797
|
onTestStart?: (sheetData: INodeDataProps, homeworkId?: string) => void;
|
|
798
798
|
onTestReview?: (sheetData: INodeDataProps, milestoneId?: string) => void;
|
|
799
|
-
homeworkRef?:
|
|
799
|
+
homeworkRef?: React_2.RefObject<HTMLDivElement>;
|
|
800
800
|
startHomePageJourney?: ({ studentId, stream, userType }: IHomepageStartJourneyProps) => void;
|
|
801
801
|
canStartJourney?: boolean;
|
|
802
802
|
canStartPuzzleAssignedJourney?: boolean;
|
|
@@ -5222,7 +5222,7 @@ export declare const OTPInput: NamedExoticComponent<IOTPInputProps>;
|
|
|
5222
5222
|
export declare type OutcomeStage = keyof typeof STAGES;
|
|
5223
5223
|
|
|
5224
5224
|
export declare const OverlayLoader: MemoExoticComponent<({ isLoading }: {
|
|
5225
|
-
isLoading?: boolean | undefined;
|
|
5225
|
+
isLoading?: boolean | undefined;
|
|
5226
5226
|
}) => JSX.Element | null>;
|
|
5227
5227
|
|
|
5228
5228
|
export declare const ParentDashboard: MemoExoticComponent<(props: IParentDashboardProps) => JSX.Element>;
|
|
@@ -5545,7 +5545,7 @@ export declare const SheetIcon: FC<SVGProps<SVGSVGElement>>;
|
|
|
5545
5545
|
export declare const SheetList: FC<ISheetsListProps>;
|
|
5546
5546
|
|
|
5547
5547
|
export declare const SheetLocked: MemoExoticComponent<({ onHomeClick }: {
|
|
5548
|
-
onHomeClick: () => void;
|
|
5548
|
+
onHomeClick: () => void;
|
|
5549
5549
|
}) => JSX.Element>;
|
|
5550
5550
|
|
|
5551
5551
|
export declare const SignUp: ({ mathGymEnrolledUser, circleEnrolledUser, circleOnLeapPremiumDays, circleUsername, countryCode, grade: defaultGrade, state, circleOnLeapPremiumEnabled, studentId, isSignUpProcessing, onCreateUser, onUpdateUser, onSignupStepsComplete, isPLAStudent, }: ISignUpProps) => JSX.Element;
|
|
@@ -7063,8 +7063,8 @@ export declare const useGetMilestoneResources: (initialId?: string, initialQuery
|
|
|
7063
7063
|
|
|
7064
7064
|
export declare const useGetPastMilestoneCount: (initialId?: string, initialQuery?: void | undefined) => {
|
|
7065
7065
|
get: (id: string, query: void, meta: TQuery_2) => Promise<void>;
|
|
7066
|
-
resource: ResourceModel<
|
|
7067
|
-
|
|
7066
|
+
resource: ResourceModel<{
|
|
7067
|
+
user_milestones_count: number;
|
|
7068
7068
|
}> | undefined;
|
|
7069
7069
|
data: {
|
|
7070
7070
|
user_milestones_count: number;
|