@lessonkit/lxpack 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,32 +0,0 @@
1
- // src/telemetry.ts
2
- import { LESSONKIT_TELEMETRY_EVENTS } from "@lxpack/tracking-schema";
3
- var SUPPORTED = new Set(LESSONKIT_TELEMETRY_EVENTS);
4
- function telemetryEventToLessonkit(event) {
5
- if (!SUPPORTED.has(event.name)) {
6
- return null;
7
- }
8
- const name = event.name;
9
- const mapped = {
10
- name,
11
- lessonId: event.lessonId
12
- };
13
- if (name === "quiz_completed" || name === "quiz_answered") {
14
- const data = event.data;
15
- mapped.assessmentId = data?.checkId;
16
- if (data && "score" in data) {
17
- mapped.score = data.score;
18
- mapped.maxScore = data.maxScore;
19
- mapped.passingScore = data.passingScore;
20
- }
21
- if (data) {
22
- mapped.data = data;
23
- }
24
- } else if (name === "interaction" && event.data) {
25
- mapped.data = event.data;
26
- }
27
- return mapped;
28
- }
29
-
30
- export {
31
- telemetryEventToLessonkit
32
- };