@cuemath/leap 2.8.57-rj-2 → 2.8.57-rj-3
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/journey/use-get-eligible-journeys-via-route.js +13 -0
- package/dist/features/journey/use-get-eligible-journeys-via-route.js.map +1 -0
- package/dist/features/journey/use-journey/journey-context-provider.js +62 -62
- package/dist/features/journey/use-journey/journey-context-provider.js.map +1 -1
- package/dist/features/journey/user-journey-api/user-journey-api.js +12 -0
- package/dist/features/journey/user-journey-api/user-journey-api.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +20 -20
- package/package.json +1 -1
- package/dist/features/journey/journey-progress-api/journey-progress-api.js +0 -12
- package/dist/features/journey/journey-progress-api/journey-progress-api.js.map +0 -1
- package/dist/features/journey/use-get-eligible-journey.js +0 -13
- package/dist/features/journey/use-get-eligible-journey.js.map +0 -1
@@ -0,0 +1,13 @@
|
|
1
|
+
import { useMemo as i } from "react";
|
2
|
+
import { useJourney as s } from "./use-journey/use-journey.js";
|
3
|
+
const n = (e) => {
|
4
|
+
const { userCompletedJourneyIds: o } = s();
|
5
|
+
return i(
|
6
|
+
() => e.filter((r) => !o.includes(r)),
|
7
|
+
[e, o]
|
8
|
+
);
|
9
|
+
};
|
10
|
+
export {
|
11
|
+
n as useGetEligibleJourneysViaRoute
|
12
|
+
};
|
13
|
+
//# sourceMappingURL=use-get-eligible-journeys-via-route.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"use-get-eligible-journeys-via-route.js","sources":["../../../src/features/journey/use-get-eligible-journeys-via-route.tsx"],"sourcesContent":["import type { TJourneyId } from './journey-id/journey-id-types';\n\nimport { useMemo } from 'react';\n\nimport { useJourney } from './use-journey/use-journey';\n\nexport const useGetEligibleJourneysViaRoute = (routeJourneyIds: TJourneyId[]) => {\n const { userCompletedJourneyIds } = useJourney();\n\n const eligibleJourneys = useMemo(\n () => routeJourneyIds.filter(journeyId => !userCompletedJourneyIds.includes(journeyId)),\n [routeJourneyIds, userCompletedJourneyIds],\n );\n\n return eligibleJourneys;\n};\n"],"names":["useGetEligibleJourneysViaRoute","routeJourneyIds","userCompletedJourneyIds","useJourney","useMemo","journeyId"],"mappings":";;AAMa,MAAAA,IAAiC,CAACC,MAAkC;AACzE,QAAA,EAAE,yBAAAC,MAA4BC;AAO7B,SALkBC;AAAA,IACvB,MAAMH,EAAgB,OAAO,CAAAI,MAAa,CAACH,EAAwB,SAASG,CAAS,CAAC;AAAA,IACtF,CAACJ,GAAiBC,CAAuB;AAAA,EAAA;AAI7C;"}
|
@@ -1,107 +1,107 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { createContext as
|
1
|
+
import { jsxs as D, jsx as P } from "react/jsx-runtime";
|
2
|
+
import { createContext as O, useState as w, useRef as C, useCallback as l, useMemo as U, useEffect as A } from "react";
|
3
3
|
import { Coachmark as b } from "../comps/coachmark/coachmark.js";
|
4
|
-
import {
|
5
|
-
import { BlurOverlay as
|
6
|
-
const
|
7
|
-
const [
|
4
|
+
import { usePostUserJourney as j, useGetUserJourney as q } from "../user-journey-api/user-journey-api.js";
|
5
|
+
import { BlurOverlay as L } from "./journey-styled.js";
|
6
|
+
const N = O(null), V = ({ children: R, appId: c, userId: o }) => {
|
7
|
+
const [m, p] = w([]), [u, s] = w([]), a = C(-1), r = C(), d = C([]), { post: k } = j(), { data: f = null, get: v } = q(), x = l(
|
8
8
|
(e, t) => {
|
9
|
-
if (
|
9
|
+
if (u.length > 0) {
|
10
10
|
console.error(
|
11
11
|
`setJourney: Other Journey is already active, Current Journey: ${r.current}, New Journey Request: ${e}`
|
12
12
|
);
|
13
13
|
return;
|
14
14
|
}
|
15
|
-
r.current = e,
|
15
|
+
r.current = e, a.current = -1, s([...t]);
|
16
16
|
},
|
17
|
-
[
|
18
|
-
),
|
19
|
-
|
17
|
+
[u.length]
|
18
|
+
), y = l(() => {
|
19
|
+
d.current.forEach((e) => {
|
20
20
|
clearTimeout(e);
|
21
|
-
}),
|
22
|
-
}, []),
|
21
|
+
}), d.current = [], r.current = void 0, a.current = -1, s([]);
|
22
|
+
}, []), g = l(
|
23
23
|
(e) => {
|
24
|
-
if (
|
24
|
+
if (m.includes(e)) {
|
25
25
|
console.error(`endJourney: Journey ID ${e} is already completed.`);
|
26
26
|
return;
|
27
27
|
}
|
28
|
-
p((t) => [...t, e]),
|
29
|
-
app_id:
|
30
|
-
user_id:
|
28
|
+
p((t) => [...t, e]), k({
|
29
|
+
app_id: c,
|
30
|
+
user_id: o,
|
31
31
|
journey_id: e,
|
32
32
|
journey_status: "COMPLETED"
|
33
|
-
}),
|
33
|
+
}), y();
|
34
34
|
},
|
35
|
-
[
|
36
|
-
),
|
35
|
+
[c, y, k, m, o]
|
36
|
+
), _ = l((e, t) => {
|
37
37
|
if (!r.current || e !== r.current) {
|
38
38
|
console.error(
|
39
39
|
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
40
|
);
|
41
41
|
return;
|
42
42
|
}
|
43
|
-
|
44
|
-
}, []),
|
45
|
-
(e, t = !1,
|
43
|
+
s((J) => [...J, t]);
|
44
|
+
}, []), $ = l(
|
45
|
+
(e, t = !1, J = 0) => {
|
46
46
|
if (!r.current || e !== r.current) {
|
47
47
|
console.error(
|
48
48
|
r.current ? "nextCoachmark was called before setJourney" : `A Journey is already active, Current Journey: ${r.current}, New Journey Request: ${e}`
|
49
49
|
);
|
50
50
|
return;
|
51
51
|
}
|
52
|
-
|
53
|
-
const
|
54
|
-
clearTimeout(
|
55
|
-
const
|
56
|
-
|
57
|
-
if (
|
58
|
-
return r.current = void 0,
|
59
|
-
|
60
|
-
const h = [...
|
61
|
-
return h[
|
52
|
+
J !== 0 && s((n) => n.map((i) => ({ ...i, isActive: !1 })));
|
53
|
+
const E = setTimeout(() => {
|
54
|
+
clearTimeout(E);
|
55
|
+
const n = a.current + 1;
|
56
|
+
s((i) => {
|
57
|
+
if (n >= i.length || i.length === 0)
|
58
|
+
return r.current = void 0, a.current = -1, [];
|
59
|
+
a.current = n;
|
60
|
+
const h = [...i];
|
61
|
+
return h[n].isActive = !0, n > 0 && (h[n - 1].isActive = t), h;
|
62
62
|
});
|
63
|
-
},
|
64
|
-
|
63
|
+
}, J);
|
64
|
+
d.current.push(E);
|
65
65
|
},
|
66
66
|
[]
|
67
|
-
),
|
67
|
+
), T = U(
|
68
68
|
() => ({
|
69
|
-
nextCoachmark:
|
70
|
-
setJourney:
|
71
|
-
addCoachmark:
|
72
|
-
clearJourney:
|
73
|
-
endJourney:
|
74
|
-
coachmarks:
|
75
|
-
|
69
|
+
nextCoachmark: $,
|
70
|
+
setJourney: x,
|
71
|
+
addCoachmark: _,
|
72
|
+
clearJourney: y,
|
73
|
+
endJourney: g,
|
74
|
+
coachmarks: u,
|
75
|
+
userCompletedJourneyIds: m
|
76
76
|
}),
|
77
77
|
[
|
78
|
-
|
79
|
-
v,
|
80
|
-
E,
|
81
|
-
d,
|
78
|
+
$,
|
82
79
|
x,
|
83
|
-
|
84
|
-
|
80
|
+
_,
|
81
|
+
y,
|
82
|
+
g,
|
83
|
+
u,
|
84
|
+
m
|
85
85
|
]
|
86
86
|
);
|
87
|
-
return
|
88
|
-
|
89
|
-
app_id:
|
90
|
-
user_id:
|
87
|
+
return A(() => {
|
88
|
+
c && o && v(o, {
|
89
|
+
app_id: c,
|
90
|
+
user_id: o,
|
91
91
|
journey_status: "COMPLETED"
|
92
92
|
});
|
93
|
-
}, [
|
94
|
-
if (
|
95
|
-
const
|
96
|
-
p(
|
93
|
+
}, [c, v, o]), A(() => {
|
94
|
+
if (f) {
|
95
|
+
const e = f.map((t) => t.journey_id);
|
96
|
+
p(e);
|
97
97
|
}
|
98
|
-
}, [
|
99
|
-
|
100
|
-
|
98
|
+
}, [f]), /* @__PURE__ */ D(N.Provider, { value: T, children: [
|
99
|
+
u.length > 0 && /* @__PURE__ */ P(L, { children: u.map((e, t) => /* @__PURE__ */ P(b, { coachmark: e }, `coachmark-${t}`)) }),
|
100
|
+
R
|
101
101
|
] });
|
102
102
|
};
|
103
103
|
export {
|
104
|
-
|
105
|
-
|
104
|
+
N as JourneyContext,
|
105
|
+
V as JourneyProvider
|
106
106
|
};
|
107
107
|
//# 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 {\n useGetJourneyProgress,\n usePostJourneyProgress,\n} from '../journey-progress-api/journey-progress-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 [completedJourneys, setCompletedJourneys] = useState<TJourneyId[]>([]);\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 { post: postJourneyCompletion } = usePostJourneyProgress();\n const { data: journeyProgressData = null, get: getJourneyProgress } = useGetJourneyProgress();\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 endJourney = useCallback(\n (journeyId: TJourneyId) => {\n if (completedJourneys.includes(journeyId)) {\n console.error(`endJourney: Journey ID ${journeyId} is already completed.`);\n\n return;\n }\n setCompletedJourneys(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, completedJourneys, postJourneyCompletion, userId],\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 endJourney,\n coachmarks: coachmarkList,\n completedJourneys,\n }),\n [\n nextCoachmark,\n setJourney,\n addCoachmark,\n clearJourney,\n endJourney,\n coachmarkList,\n completedJourneys,\n ],\n );\n\n // Get the initial state of incompleteJourneys\n useEffect(() => {\n if (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 (journeyProgressData && completedJourneys.length === 0) {\n const completedJourneysList = journeyProgressData?.filter(journey => {\n return journey.status === 'COMPLETED';\n });\n const completedJourneysIds = completedJourneysList.map(journey => journey.journey_id);\n\n setCompletedJourneys(completedJourneysIds);\n }\n }, [completedJourneys.length, journeyProgressData]);\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","appId","userId","completedJourneys","setCompletedJourneys","useState","coachmarkList","setCoachmarkList","currentIndex","useRef","currentJourneyIdStudent","timerRefs","postJourneyCompletion","usePostJourneyProgress","journeyProgressData","getJourneyProgress","useGetJourneyProgress","setJourney","useCallback","id","coachmarks","clearJourney","timer","endJourney","journeyId","prev","addCoachmark","coachmark","nextCoachmark","keepPrevActive","delayInMs","prevList","item","currIndex","updatedCoachmarkList","memoizedContextValue","useMemo","useEffect","completedJourneysIds","journey","jsxs","jsx","S.BlurOverlay","index","Coachmark"],"mappings":";;;;;AAkBa,MAAAA,IAAiBC,EAAsC,IAAI,GAE3DC,IAA6C,CAAC,EAAE,UAAAC,GAAU,OAAAC,GAAO,QAAAC,QAAa;AACzF,QAAM,CAACC,GAAmBC,CAAoB,IAAIC,EAAuB,CAAE,CAAA,GACrE,CAACC,GAAeC,CAAgB,IAAIF,EAA4B,CAAE,CAAA,GAClEG,IAAeC,EAAO,EAAE,GACxBC,IAA0BD,KAC1BE,IAAYF,EAAwC,CAAA,CAAE,GAEtD,EAAE,MAAMG,EAAsB,IAAIC,EAAuB,GACzD,EAAE,MAAMC,IAAsB,MAAM,KAAKC,EAAA,IAAuBC,KAEhEC,IAAaC;AAAA,IACjB,CAACC,GAAgBC,MAAkC;AAC7C,UAAAd,EAAc,SAAS,GAAG;AACpB,gBAAA;AAAA,UACN,iEAAiEI,EAAwB,OAAO,0BAA0BS,CAAE;AAAA,QAAA;AAG9H;AAAA,MACF;AACA,MAAAT,EAAwB,UAAUS,GAClCX,EAAa,UAAU,IACND,EAAA,CAAC,GAAGa,CAAU,CAAC;AAAA,IAClC;AAAA,IACA,CAACd,EAAc,MAAM;AAAA,EAAA,GAGjBe,IAAeH,EAAY,MAAM;AAE3B,IAAAP,EAAA,QAAQ,QAAQ,CAASW,MAAA;AACjC,mBAAaA,CAAK;AAAA,IAAA,CACnB,GACDX,EAAU,UAAU,IACpBD,EAAwB,UAAU,QAClCF,EAAa,UAAU,IACvBD,EAAiB,CAAE,CAAA;AAAA,EACrB,GAAG,CAAE,CAAA,GAECgB,IAAaL;AAAA,IACjB,CAACM,MAA0B;AACrB,UAAArB,EAAkB,SAASqB,CAAS,GAAG;AACjC,gBAAA,MAAM,0BAA0BA,CAAS,wBAAwB;AAEzE;AAAA,MACF;AACA,MAAApB,EAAqB,CAAQqB,MAAA,CAAC,GAAGA,GAAMD,CAAS,CA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../../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 currentIndex = useRef(-1);\n const currentJourneyIdStudent = useRef<TJourneyId | undefined>();\n const timerRefs = useRef<ReturnType<typeof setTimeout>[]>([]);\n\n const { post: postJourneyCompletion } = usePostUserJourney();\n const { data: userCompletedJourneys = null, get: getJourneyProgress } = useGetUserJourney();\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 endJourney = useCallback(\n (journeyId: TJourneyId) => {\n if (userCompletedJourneyIds.includes(journeyId)) {\n console.error(`endJourney: Journey ID ${journeyId} is already completed.`);\n\n return;\n }\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, userCompletedJourneyIds, userId],\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 endJourney,\n coachmarks: coachmarkList,\n userCompletedJourneyIds,\n }),\n [\n nextCoachmark,\n setJourney,\n addCoachmark,\n clearJourney,\n endJourney,\n coachmarkList,\n userCompletedJourneyIds,\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 {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","appId","userId","userCompletedJourneyIds","setUserCompletedJourneyIds","useState","coachmarkList","setCoachmarkList","currentIndex","useRef","currentJourneyIdStudent","timerRefs","postJourneyCompletion","usePostUserJourney","userCompletedJourneys","getJourneyProgress","useGetUserJourney","setJourney","useCallback","id","coachmarks","clearJourney","timer","endJourney","journeyId","prev","addCoachmark","coachmark","nextCoachmark","keepPrevActive","delayInMs","prevList","item","currIndex","updatedCoachmarkList","memoizedContextValue","useMemo","useEffect","completedUserJourneysIds","journey","jsxs","jsx","S.BlurOverlay","index","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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AAH;AAAA,IAAA;AAAA,IAEF;AAAA,MACEyB;AAAA,MACAX;AAAA,MACAS;AAAA,MACAL;AAAA,MACAE;AAAA,MACAjB;AAAA,MACAH;AAAA,IACF;AAAA,EAAA;AAIF,SAAAkC,EAAU,MAAM;AACd,IAAIpC,KAASC,KACXa,EAAmBb,GAAQ;AAAA,MACzB,QAAQD;AAAA,MACR,SAASC;AAAA,MACT,gBAAgB;AAAA,IAAA,CACjB;AAAA,EAEF,GAAA,CAACD,GAAOc,GAAoBb,CAAM,CAAC,GAGtCmC,EAAU,MAAM;AACd,QAAIvB,GAAuB;AACzB,YAAMwB,IAA2BxB,EAAsB,IAAI,CAAAyB,MAAWA,EAAQ,UAAU;AAExF,MAAAnC,EAA2BkC,CAAwB;AAAA,IACrD;AAAA,EAAA,GACC,CAACxB,CAAqB,CAAC,GAGvB,gBAAA0B,EAAA3C,EAAe,UAAf,EAAwB,OAAOsC,GAC7B,UAAA;AAAA,IAAA7B,EAAc,SAAS,KACtB,gBAAAmC,EAACC,GAAA,EACE,YAAc,IAAI,CAACf,GAAWgB,wBAC5BC,GAAqC,EAAA,WAAAjB,EAAA,GAAtB,aAAagB,CAAK,EAA0B,CAC7D,GACH;AAAA,IAED3C;AAAA,EACH,EAAA,CAAA;AAEJ;"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { createGetAPI as o, createPostAPI as u } from "@cuemath/rest-api";
|
2
|
+
import { BASE_URL_V1 as e } from "../../../constants/api.js";
|
3
|
+
const { useGet: p } = o({
|
4
|
+
getURL: (n, { app_id: t, journey_status: s, user_id: r }) => `${e}/task/user-journey/?app_id=${t}&journey_status=${s}&user_id=${r}`
|
5
|
+
}), { usePost: y } = u({
|
6
|
+
getURL: () => `${e}/task/user-journey/`
|
7
|
+
});
|
8
|
+
export {
|
9
|
+
p as useGetUserJourney,
|
10
|
+
y as usePostUserJourney
|
11
|
+
};
|
12
|
+
//# sourceMappingURL=user-journey-api.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"user-journey-api.js","sources":["../../../../src/features/journey/user-journey-api/user-journey-api.ts"],"sourcesContent":["import type {\n TGetJourneyProgressPayloadModel,\n TGetJourneyProgressResponseModel,\n TPostJourneyProgressPayloadModel,\n TPostJourneyProgressResponseModel,\n} from './user-journey-api-types';\n\nimport { createGetAPI, createPostAPI } from '@cuemath/rest-api';\n\nimport { BASE_URL_V1 } from '../../../constants/api';\n\nconst { useGet: useGetUserJourney } = createGetAPI<\n TGetJourneyProgressResponseModel,\n TGetJourneyProgressPayloadModel\n>({\n getURL: (_, { app_id, journey_status, user_id }) =>\n `${BASE_URL_V1}/task/user-journey/?app_id=${app_id}&journey_status=${journey_status}&user_id=${user_id}`,\n});\n\nconst { usePost: usePostUserJourney } = createPostAPI<\n TPostJourneyProgressResponseModel,\n TPostJourneyProgressPayloadModel\n>({\n getURL: () => `${BASE_URL_V1}/task/user-journey/`,\n});\n\nexport { useGetUserJourney, usePostUserJourney };\n"],"names":["useGetUserJourney","createGetAPI","_","app_id","journey_status","user_id","BASE_URL_V1","usePostUserJourney","createPostAPI"],"mappings":";;AAWA,MAAM,EAAE,QAAQA,EAAkB,IAAIC,EAGpC;AAAA,EACA,QAAQ,CAACC,GAAG,EAAE,QAAAC,GAAQ,gBAAAC,GAAgB,SAAAC,EAAA,MACpC,GAAGC,CAAW,8BAA8BH,CAAM,mBAAmBC,CAAc,YAAYC,CAAO;AAC1G,CAAC,GAEK,EAAE,SAASE,EAAmB,IAAIC,EAGtC;AAAA,EACA,QAAQ,MAAM,GAAGF,CAAW;AAC9B,CAAC;"}
|
package/dist/index.d.ts
CHANGED
@@ -1327,7 +1327,7 @@ export declare interface IJourneyContext {
|
|
1327
1327
|
*/
|
1328
1328
|
nextCoachmark: (id: TJourneyId, keepPrevActive?: boolean, delayInMs?: number) => void;
|
1329
1329
|
endJourney: (id: TJourneyId) => void;
|
1330
|
-
|
1330
|
+
userCompletedJourneyIds: TJourneyId[];
|
1331
1331
|
}
|
1332
1332
|
|
1333
1333
|
declare interface IJourneyProviderProps {
|
@@ -5017,7 +5017,7 @@ export declare const useGetCircleHomeDetailsDal: (userId: string, grade: string,
|
|
5017
5017
|
invalidateCircleHomeDetails: () => void;
|
5018
5018
|
};
|
5019
5019
|
|
5020
|
-
export declare const
|
5020
|
+
export declare const useGetEligibleJourneysViaRoute: (routeJourneyIds: TJourneyId[]) => JOURNEY_ID_STUDENT[];
|
5021
5021
|
|
5022
5022
|
declare const useGetLeaderboard: (initialId?: string, initialQuery?: IGetLeaderboardPayloadModel | undefined) => {
|
5023
5023
|
get: (id: string, query: IGetLeaderboardPayloadModel, meta: void) => Promise<void>;
|
package/dist/index.js
CHANGED
@@ -12,7 +12,7 @@ import { default as _ } from "./assets/line-icons/icons/book.js";
|
|
12
12
|
import { default as h } from "./assets/line-icons/icons/book2.js";
|
13
13
|
import { default as k } from "./assets/line-icons/icons/bookmark.js";
|
14
14
|
import { default as N } from "./assets/line-icons/icons/bulb.js";
|
15
|
-
import { default as
|
15
|
+
import { default as R } from "./assets/line-icons/icons/bulb2.js";
|
16
16
|
import { default as D } from "./assets/line-icons/icons/calendar.js";
|
17
17
|
import { default as y } from "./assets/line-icons/icons/check.js";
|
18
18
|
import { default as B } from "./assets/line-icons/icons/check2.js";
|
@@ -39,7 +39,7 @@ import { default as _e } from "./assets/line-icons/icons/highlighter.js";
|
|
39
39
|
import { default as he } from "./assets/line-icons/icons/home.js";
|
40
40
|
import { default as ke } from "./assets/line-icons/icons/image.js";
|
41
41
|
import { default as Ne } from "./assets/line-icons/icons/info.js";
|
42
|
-
import { default as
|
42
|
+
import { default as Re } from "./assets/line-icons/icons/info2.js";
|
43
43
|
import { default as De } from "./assets/line-icons/icons/left.js";
|
44
44
|
import { default as ye } from "./assets/line-icons/icons/lock.js";
|
45
45
|
import { default as Be } from "./assets/line-icons/icons/lock2.js";
|
@@ -66,7 +66,7 @@ import { default as Po } from "./assets/line-icons/icons/search.js";
|
|
66
66
|
import { default as Lo } from "./assets/line-icons/icons/sheet.js";
|
67
67
|
import { default as Mo } from "./assets/line-icons/icons/star.js";
|
68
68
|
import { default as Oo } from "./assets/line-icons/icons/skip.js";
|
69
|
-
import { default as
|
69
|
+
import { default as Ho } from "./assets/line-icons/icons/skip2.js";
|
70
70
|
import { default as Go } from "./assets/line-icons/icons/star2.js";
|
71
71
|
import { default as go } from "./assets/line-icons/icons/striked-eye.js";
|
72
72
|
import { default as bo } from "./assets/line-icons/icons/switch-icon.js";
|
@@ -92,7 +92,7 @@ import { default as _r } from "./features/hooks/use-zoom-disable.js";
|
|
92
92
|
import { default as hr } from "./features/hooks/use-force-reload.js";
|
93
93
|
import { default as kr } from "./features/ui/accordion-section/accordion-section.js";
|
94
94
|
import { default as Nr } from "./features/ui/arrow-tooltip/arrow-tooltip.js";
|
95
|
-
import { default as
|
95
|
+
import { default as Rr } from "./features/ui/context-menu/context-menu.js";
|
96
96
|
import { default as Dr } from "./features/ui/timers/countdown-timer/countdown-timer.js";
|
97
97
|
import { default as yr } from "./features/ui/nudge/nudge.js";
|
98
98
|
import { default as Br } from "./features/ui/buttons/button/button.js";
|
@@ -119,7 +119,7 @@ import { default as _t } from "./features/ui/radio-cards/radio-cards.js";
|
|
119
119
|
import { default as ht } from "./features/ui/section-list/section-list.js";
|
120
120
|
import { default as kt } from "./features/ui/text/text.js";
|
121
121
|
import { default as Nt } from "./features/ui/tag/tag.js";
|
122
|
-
import { default as
|
122
|
+
import { default as Rt } from "./features/ui/callout/callout.js";
|
123
123
|
import { default as Dt, useUIContext as Gt } from "./features/ui/context/context.js";
|
124
124
|
import { default as gt } from "./features/ui/context/use-tracking-context.js";
|
125
125
|
import { default as bt } from "./features/ui/hooks/use-context-menu-click-handler.js";
|
@@ -146,7 +146,7 @@ import { GAME_LAUNCHER_ASSET_PADDING as Pa } from "./features/circle-games/game-
|
|
146
146
|
import { GAME_LAUNCHER_SIZE as La } from "./features/circle-games/game-launcher/comps/card-container/constants.js";
|
147
147
|
import { useCircleSounds as Ma } from "./features/circle-games/hooks/use-circle-sounds/use-circle-sounds.js";
|
148
148
|
import { CircleSoundKey as Oa } from "./features/circle-games/hooks/use-circle-sounds/use-circle-sounds-enums.js";
|
149
|
-
import { useGetLeaderboardDal as
|
149
|
+
import { useGetLeaderboardDal as Ha } from "./features/circle-games/leaderboard/dal/use-get-leaderboard-dal/use-get-leaderboard-dal.js";
|
150
150
|
import { ELeaderboardType as Ga } from "./features/circle-games/leaderboard/enums/leaderboard-type-enum.js";
|
151
151
|
import { StreakReductionLocalStorageUtil as ga } from "./features/circle-games/utils/streak-reduction-localstorage-util.js";
|
152
152
|
import { Tutorial as ba } from "./features/circle-games/games/tutorial/tutorial.js";
|
@@ -172,7 +172,7 @@ import { default as Pf } from "./features/cue-canvas/hooks/use-canvas-sync-broke
|
|
172
172
|
import { default as Lf } from "./features/communication/hooks/use-inclass-message-broker/use-inclass-message-broker.js";
|
173
173
|
import { default as Mf } from "./features/communication/hooks/use-trial-session-message-broker/use-trial-session-message-broker.js";
|
174
174
|
import { EVENTS as Of } from "./features/communication/pub-sub/constants.js";
|
175
|
-
import { useInClassActionDispatcher as
|
175
|
+
import { useInClassActionDispatcher as Hf, useInClassActionListener as Df } from "./features/communication/pub-sub/hooks.js";
|
176
176
|
import { default as yf } from "./features/trial-session/trial-session.js";
|
177
177
|
import { EClassTimeAlertLevel as Bf } from "./features/trial-session/trial-session-types.js";
|
178
178
|
import { useClassTimeAlerts as Uf } from "./features/trial-session/hooks/use-class-time-alerts.js";
|
@@ -181,7 +181,7 @@ import { default as wf } from "./features/extra-practice/extra-practice.js";
|
|
181
181
|
import { useAutoPlayPermission as Yf } from "./features/hooks/use-auto-play-permission/use-auto-play-permission.js";
|
182
182
|
import { JOURNEY_ID_STUDENT as Kf } from "./features/journey/journey-id/journey-id-student.js";
|
183
183
|
import { useJourney as jf } from "./features/journey/use-journey/use-journey.js";
|
184
|
-
import {
|
184
|
+
import { useGetEligibleJourneysViaRoute as qf } from "./features/journey/use-get-eligible-journeys-via-route.js";
|
185
185
|
import { JourneyProvider as Xf } from "./features/journey/use-journey/journey-context-provider.js";
|
186
186
|
import { IndicatorType as es } from "./features/journey/use-journey/constants.js";
|
187
187
|
import { Coachmark as rs } from "./features/journey/comps/coachmark/coachmark.js";
|
@@ -198,7 +198,7 @@ import { default as _s } from "./features/milestone/edit/goal-edit-container.js"
|
|
198
198
|
import { default as hs } from "./features/milestone/edit/milestone-edit-container.js";
|
199
199
|
import { default as ks } from "./features/milestone/milestone-list-container/milestone-list-container.js";
|
200
200
|
import { default as Ns } from "./features/milestone/milestone-action-widget/milestone-action-widget.js";
|
201
|
-
import { default as
|
201
|
+
import { default as Rs } from "./features/milestone/start/milestone-start.js";
|
202
202
|
import { default as Ds } from "./features/milestone/milestone-tests/tests-creation/tests-creation.js";
|
203
203
|
import { default as ys } from "./features/milestone/milestone-resources/resources-assign/resources-assign.js";
|
204
204
|
import { ACHIEVEMENT_ACTIONS as Bs, STAGES as bs } from "./features/milestone/outcome/milestone-outcome-constants.js";
|
@@ -217,7 +217,7 @@ import { default as ul } from "./features/sheets/reference-sheet/reference-sheet
|
|
217
217
|
import { isV3Worksheet as dl, isV3WorksheetAttempt as nl } from "./features/sheets/utils/is-v3-worksheet.js";
|
218
218
|
import { COMPLETED_SHEET_STATE as Il, NODE_LABELS as il, NODE_SUB_GROUP as Tl, NODE_TYPE as El, PYTHON_NODE_TYPES as Sl, REWARDS_LIST as Cl, SHEET_ACTIONS as Al, SHEET_ATTEMPT_LOCATION as _l, SHEET_ATTEMPT_LOCATION_MAP as Pl, SHEET_ATTEMPT_STATE as hl, SHEET_DATA_TYPE as Ll, SHEET_STATE as kl } from "./features/sheets/constants/sheet.js";
|
219
219
|
import { default as Nl } from "./features/student-details/student-details.js";
|
220
|
-
import { default as
|
220
|
+
import { default as Rl } from "./features/utils/load-script.js";
|
221
221
|
import { ACTION_BAR_HEIGHT as Dl, QUESTIONS_GAP as Gl, QUESTION_WIDTH as yl, TOP_NAVIGATION_HEIGHT as gl } from "./features/worksheet/worksheet/constants.js";
|
222
222
|
import { isOkayTypeQuestion as bl } from "./features/worksheet/worksheet/worksheet-helpers.js";
|
223
223
|
import { default as vl } from "./features/worksheet/worksheet/worksheet-container.js";
|
@@ -248,14 +248,14 @@ export {
|
|
248
248
|
C as BookClosedIcon,
|
249
249
|
_ as BookIcon,
|
250
250
|
k as BookmarkIcon,
|
251
|
-
|
251
|
+
R as Bulb2Icon,
|
252
252
|
N as BulbIcon,
|
253
253
|
Br as Button,
|
254
254
|
$a as CIRCLE_ACTION_IDS,
|
255
255
|
za as CIRCLE_ONBOARDING_ANALYTICS_STEPS,
|
256
256
|
Il as COMPLETED_SHEET_STATE,
|
257
257
|
D as CalendarIcon,
|
258
|
-
|
258
|
+
Rt as Callout,
|
259
259
|
pt as CascadingSelectInput,
|
260
260
|
xa as Chapter,
|
261
261
|
ps as ChapterClearanceConfirmationModal,
|
@@ -277,7 +277,7 @@ export {
|
|
277
277
|
W as ClockIcon,
|
278
278
|
rs as Coachmark,
|
279
279
|
Y as CodeIcon,
|
280
|
-
|
280
|
+
Rr as ContextMenu,
|
281
281
|
K as CopyIcon,
|
282
282
|
Dr as CountdownTimer,
|
283
283
|
j as CrossIcon,
|
@@ -327,7 +327,7 @@ export {
|
|
327
327
|
Wr as IconButton,
|
328
328
|
ke as ImageIcon,
|
329
329
|
es as IndicatorType,
|
330
|
-
|
330
|
+
Re as Info2Icon,
|
331
331
|
Ne as InfoIcon,
|
332
332
|
Kf as JOURNEY_ID_STUDENT,
|
333
333
|
Xf as JourneyProvider,
|
@@ -345,7 +345,7 @@ export {
|
|
345
345
|
hs as MilestoneEdit,
|
346
346
|
ks as MilestoneList,
|
347
347
|
cs as MilestoneOutcome,
|
348
|
-
|
348
|
+
Rs as MilestoneStart,
|
349
349
|
We as Minus2Icon,
|
350
350
|
Ue as MinusIcon,
|
351
351
|
we as MistakeIcon,
|
@@ -408,7 +408,7 @@ export {
|
|
408
408
|
Ql as SheetLocked,
|
409
409
|
cf as SignUp,
|
410
410
|
er as SketchIcon,
|
411
|
-
|
411
|
+
Ho as Skip2Icon,
|
412
412
|
Oo as SkipIcon,
|
413
413
|
df as SplashScreen,
|
414
414
|
Go as Star2Icon,
|
@@ -456,7 +456,7 @@ export {
|
|
456
456
|
bl as isOkayTypeQuestion,
|
457
457
|
dl as isV3Worksheet,
|
458
458
|
nl as isV3WorksheetAttempt,
|
459
|
-
|
459
|
+
Rl as loadScript,
|
460
460
|
Yf as useAutoPlayPermission,
|
461
461
|
Pf as useCanvasSyncBroker,
|
462
462
|
Ma as useCircleSounds,
|
@@ -465,11 +465,11 @@ export {
|
|
465
465
|
hr as useForceReload,
|
466
466
|
Ws as useGetAllMilestonesdata,
|
467
467
|
tf as useGetCircleHomeDetailsDal,
|
468
|
-
qf as
|
469
|
-
|
468
|
+
qf as useGetEligibleJourneysViaRoute,
|
469
|
+
Ha as useGetLeaderboardDal,
|
470
470
|
Ks as useGetMilestoneResources,
|
471
471
|
Qs as useGetTestHelpData,
|
472
|
-
|
472
|
+
Hf as useInClassActionDispatcher,
|
473
473
|
Df as useInClassActionListener,
|
474
474
|
Lf as useInClassMessageBroker,
|
475
475
|
Zl as useIsLearnosityLoaded,
|
package/package.json
CHANGED
@@ -1,12 +0,0 @@
|
|
1
|
-
import { createGetAPI as o, createPostAPI as u } from "@cuemath/rest-api";
|
2
|
-
import { BASE_URL_V1 as e } from "../../../constants/api.js";
|
3
|
-
const { useGet: _ } = o({
|
4
|
-
getURL: (n, { app_id: s, journey_status: r, user_id: t }) => `${e}/task/user-journey/?app_id=${s}&journey_status=${r}&user_id=${t}`
|
5
|
-
}), { usePost: p } = u({
|
6
|
-
getURL: () => `${e}/task/user-journey/`
|
7
|
-
});
|
8
|
-
export {
|
9
|
-
_ as useGetJourneyProgress,
|
10
|
-
p as usePostJourneyProgress
|
11
|
-
};
|
12
|
-
//# sourceMappingURL=journey-progress-api.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"journey-progress-api.js","sources":["../../../../src/features/journey/journey-progress-api/journey-progress-api.ts"],"sourcesContent":["import type {\n TGetJourneyProgressPayloadModel,\n TGetJourneyProgressResponseModel,\n TPostJourneyProgressPayloadModel,\n TPostJourneyProgressResponseModel,\n} from './journey-progress-api-types';\n\nimport { createGetAPI, createPostAPI } from '@cuemath/rest-api';\n\nimport { BASE_URL_V1 } from '../../../constants/api';\n\nconst { useGet: useGetJourneyProgress } = createGetAPI<\n TGetJourneyProgressResponseModel,\n TGetJourneyProgressPayloadModel\n>({\n getURL: (_, { app_id, journey_status, user_id }) =>\n `${BASE_URL_V1}/task/user-journey/?app_id=${app_id}&journey_status=${journey_status}&user_id=${user_id}`,\n});\n\nconst { usePost: usePostJourneyProgress } = createPostAPI<\n TPostJourneyProgressResponseModel,\n TPostJourneyProgressPayloadModel\n>({\n getURL: () => `${BASE_URL_V1}/task/user-journey/`,\n});\n\nexport { useGetJourneyProgress, usePostJourneyProgress };\n"],"names":["useGetJourneyProgress","createGetAPI","_","app_id","journey_status","user_id","BASE_URL_V1","usePostJourneyProgress","createPostAPI"],"mappings":";;AAWA,MAAM,EAAE,QAAQA,EAAsB,IAAIC,EAGxC;AAAA,EACA,QAAQ,CAACC,GAAG,EAAE,QAAAC,GAAQ,gBAAAC,GAAgB,SAAAC,EAAA,MACpC,GAAGC,CAAW,8BAA8BH,CAAM,mBAAmBC,CAAc,YAAYC,CAAO;AAC1G,CAAC,GAEK,EAAE,SAASE,EAAuB,IAAIC,EAG1C;AAAA,EACA,QAAQ,MAAM,GAAGF,CAAW;AAC9B,CAAC;"}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import { useMemo as n } from "react";
|
2
|
-
import { useJourney as u } from "./use-journey/use-journey.js";
|
3
|
-
const s = (e) => {
|
4
|
-
const { completedJourneys: o } = u(), r = n(
|
5
|
-
() => e.filter((t) => !o.includes(t)),
|
6
|
-
[e, o]
|
7
|
-
);
|
8
|
-
return r.length > 0 ? r[0] : null;
|
9
|
-
};
|
10
|
-
export {
|
11
|
-
s as useGetEligibleJourney
|
12
|
-
};
|
13
|
-
//# sourceMappingURL=use-get-eligible-journey.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"use-get-eligible-journey.js","sources":["../../../src/features/journey/use-get-eligible-journey.tsx"],"sourcesContent":["import type { TJourneyId } from './journey-id/journey-id-types';\n\nimport { useMemo } from 'react';\n\nimport { useJourney } from './use-journey/use-journey';\n\nexport const useGetEligibleJourney = (allJourneyIds: TJourneyId[]) => {\n const { completedJourneys } = useJourney();\n\n const eligibleJourneys = useMemo(\n () => allJourneyIds.filter(journeyId => !completedJourneys.includes(journeyId)),\n [allJourneyIds, completedJourneys],\n );\n\n if (eligibleJourneys.length > 0) {\n return eligibleJourneys[0];\n }\n\n return null;\n};\n"],"names":["useGetEligibleJourney","allJourneyIds","completedJourneys","useJourney","eligibleJourneys","useMemo","journeyId"],"mappings":";;AAMa,MAAAA,IAAwB,CAACC,MAAgC;AAC9D,QAAA,EAAE,mBAAAC,MAAsBC,KAExBC,IAAmBC;AAAA,IACvB,MAAMJ,EAAc,OAAO,CAAAK,MAAa,CAACJ,EAAkB,SAASI,CAAS,CAAC;AAAA,IAC9E,CAACL,GAAeC,CAAiB;AAAA,EAAA;AAG/B,SAAAE,EAAiB,SAAS,IACrBA,EAAiB,CAAC,IAGpB;AACT;"}
|