@lessonkit/lxpack 1.4.0 → 1.5.0
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/README.md +35 -7
- package/dist/bridge.cjs +160 -41
- package/dist/bridge.d.cts +27 -9
- package/dist/bridge.d.ts +27 -9
- package/dist/bridge.js +96 -27
- package/dist/chunk-HTZR4CF3.js +94 -0
- package/dist/index.cjs +434 -111
- package/dist/index.d.cts +23 -5
- package/dist/index.d.ts +23 -5
- package/dist/index.js +401 -98
- package/dist/telemetry-0fIWoomS.d.cts +17 -0
- package/dist/telemetry-0fIWoomS.d.ts +17 -0
- package/package.json +5 -5
- package/dist/chunk-DYQI222N.js +0 -41
- package/dist/telemetry-gCxlwc7I.d.cts +0 -9
- package/dist/telemetry-gCxlwc7I.d.ts +0 -9
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TelemetryEvent } from '@lessonkit/core';
|
|
2
|
+
import { LessonkitTelemetryEvent } from '@lxpack/tracking-schema';
|
|
3
|
+
|
|
4
|
+
/** Branch events added in LessonKit 1.5; forwarded until @lxpack/tracking-schema includes them. */
|
|
5
|
+
declare const BRANCH_TELEMETRY_EVENTS: readonly ["branch_node_viewed", "branch_selected"];
|
|
6
|
+
/**
|
|
7
|
+
* Map a `@lessonkit/core` telemetry event to the LXPack LessonKit telemetry shape.
|
|
8
|
+
*/
|
|
9
|
+
declare function telemetryEventToLessonkit(event: TelemetryEvent): LessonkitTelemetryEvent | null;
|
|
10
|
+
/** Bridge-safe track payload for branch telemetry (schema pre-1.5). */
|
|
11
|
+
declare function branchTelemetryToBridgeTrackEvent(event: TelemetryEvent): {
|
|
12
|
+
type: "interaction";
|
|
13
|
+
id: string;
|
|
14
|
+
data: Record<string, unknown>;
|
|
15
|
+
} | null;
|
|
16
|
+
|
|
17
|
+
export { BRANCH_TELEMETRY_EVENTS as B, branchTelemetryToBridgeTrackEvent as b, telemetryEventToLessonkit as t };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TelemetryEvent } from '@lessonkit/core';
|
|
2
|
+
import { LessonkitTelemetryEvent } from '@lxpack/tracking-schema';
|
|
3
|
+
|
|
4
|
+
/** Branch events added in LessonKit 1.5; forwarded until @lxpack/tracking-schema includes them. */
|
|
5
|
+
declare const BRANCH_TELEMETRY_EVENTS: readonly ["branch_node_viewed", "branch_selected"];
|
|
6
|
+
/**
|
|
7
|
+
* Map a `@lessonkit/core` telemetry event to the LXPack LessonKit telemetry shape.
|
|
8
|
+
*/
|
|
9
|
+
declare function telemetryEventToLessonkit(event: TelemetryEvent): LessonkitTelemetryEvent | null;
|
|
10
|
+
/** Bridge-safe track payload for branch telemetry (schema pre-1.5). */
|
|
11
|
+
declare function branchTelemetryToBridgeTrackEvent(event: TelemetryEvent): {
|
|
12
|
+
type: "interaction";
|
|
13
|
+
id: string;
|
|
14
|
+
data: Record<string, unknown>;
|
|
15
|
+
} | null;
|
|
16
|
+
|
|
17
|
+
export { BRANCH_TELEMETRY_EVENTS as B, branchTelemetryToBridgeTrackEvent as b, telemetryEventToLessonkit as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lessonkit/lxpack",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "LXPack export adapter for LessonKit courses (SCORM, standalone, xAPI, cmi5).",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"typecheck": "tsc -p tsconfig.json",
|
|
53
53
|
"test": "vitest run --passWithNoTests",
|
|
54
54
|
"test:coverage": "vitest run --coverage --passWithNoTests=false",
|
|
55
|
-
"lint": "
|
|
55
|
+
"lint": "eslint --max-warnings 0 \"src/**/*.{ts,tsx}\" \"test/**/*.{ts,tsx}\""
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@lessonkit/core": "1.
|
|
59
|
-
"@lessonkit/themes": "1.
|
|
58
|
+
"@lessonkit/core": "1.5.0",
|
|
59
|
+
"@lessonkit/themes": "1.5.0",
|
|
60
60
|
"@lxpack/api": "0.6.4",
|
|
61
61
|
"@lxpack/spa-bridge": "0.6.4",
|
|
62
62
|
"@lxpack/tracking-schema": "0.6.4",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@types/node": "^25.9.2",
|
|
67
67
|
"tsup": "^8.5.0",
|
|
68
|
-
"typescript": "^
|
|
68
|
+
"typescript": "^6.0.3",
|
|
69
69
|
"vitest": "^4.1.8"
|
|
70
70
|
}
|
|
71
71
|
}
|
package/dist/chunk-DYQI222N.js
DELETED
|
@@ -1,41 +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 isQuizAnsweredData(data) {
|
|
5
|
-
return typeof data === "object" && data !== null && typeof data.checkId === "string";
|
|
6
|
-
}
|
|
7
|
-
function isQuizCompletedData(data) {
|
|
8
|
-
return typeof data === "object" && data !== null && typeof data.checkId === "string";
|
|
9
|
-
}
|
|
10
|
-
function isInteractionData(data) {
|
|
11
|
-
return typeof data === "object" && data !== null;
|
|
12
|
-
}
|
|
13
|
-
function telemetryEventToLessonkit(event) {
|
|
14
|
-
if (!SUPPORTED.has(event.name)) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
const name = event.name;
|
|
18
|
-
const mapped = {
|
|
19
|
-
name,
|
|
20
|
-
lessonId: event.lessonId
|
|
21
|
-
};
|
|
22
|
-
if (name === "quiz_completed" || name === "quiz_answered") {
|
|
23
|
-
const data = event.data;
|
|
24
|
-
if (isQuizAnsweredData(data) || isQuizCompletedData(data)) {
|
|
25
|
-
mapped.assessmentId = data.checkId;
|
|
26
|
-
if ("score" in data) {
|
|
27
|
-
mapped.score = data.score;
|
|
28
|
-
mapped.maxScore = data.maxScore;
|
|
29
|
-
mapped.passingScore = data.passingScore;
|
|
30
|
-
}
|
|
31
|
-
mapped.data = data;
|
|
32
|
-
}
|
|
33
|
-
} else if (name === "interaction" && event.data && isInteractionData(event.data)) {
|
|
34
|
-
mapped.data = event.data;
|
|
35
|
-
}
|
|
36
|
-
return mapped;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export {
|
|
40
|
-
telemetryEventToLessonkit
|
|
41
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { TelemetryEvent } from '@lessonkit/core';
|
|
2
|
-
import { LessonkitTelemetryEvent } from '@lxpack/tracking-schema';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Map a `@lessonkit/core` telemetry event to the LXPack LessonKit telemetry shape.
|
|
6
|
-
*/
|
|
7
|
-
declare function telemetryEventToLessonkit(event: TelemetryEvent): LessonkitTelemetryEvent | null;
|
|
8
|
-
|
|
9
|
-
export { telemetryEventToLessonkit as t };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { TelemetryEvent } from '@lessonkit/core';
|
|
2
|
-
import { LessonkitTelemetryEvent } from '@lxpack/tracking-schema';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Map a `@lessonkit/core` telemetry event to the LXPack LessonKit telemetry shape.
|
|
6
|
-
*/
|
|
7
|
-
declare function telemetryEventToLessonkit(event: TelemetryEvent): LessonkitTelemetryEvent | null;
|
|
8
|
-
|
|
9
|
-
export { telemetryEventToLessonkit as t };
|