@lessonkit/cli 1.4.0 → 1.6.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.
@@ -1,12 +1,12 @@
1
1
  import React from "react";
2
2
  import { Course, Lesson, Quiz, Scenario, ThemeProvider } from "@lessonkit/react";
3
- import { createCourseConfig } from "./courseConfig";
3
+ import { createCourseConfig, COURSE_THEME_PRESET } from "./courseConfig";
4
4
 
5
5
  const courseConfig = createCourseConfig();
6
6
 
7
7
  export default function App() {
8
8
  return (
9
- <ThemeProvider preset="default" mode="light">
9
+ <ThemeProvider preset={COURSE_THEME_PRESET} mode="light">
10
10
  <div className="app-shell">
11
11
  <Course title="{{courseTitle}}" courseId="my-course" config={courseConfig}>
12
12
  <Lesson title="My first lesson" lessonId="lesson-1">
@@ -44,6 +44,8 @@ describe("createCourseConfig", () => {
44
44
  courseId: "my-course",
45
45
  } as TelemetryEvent);
46
46
  config.observability?.onXapiTransportError?.(new Error("transport"));
47
+ config.observability?.onXapiMappingError?.(new Error("mapping"));
48
+ config.observability?.onLxpackBridgeError?.(new Error("bridge"));
47
49
 
48
50
  expect(warn).toHaveBeenCalled();
49
51
  warn.mockRestore();
@@ -31,7 +31,9 @@ function createObservability(): NonNullable<LessonkitConfig["observability"]> {
31
31
  },
32
32
  onXapiQueueCap: () => report("xapi-queue-cap", {}),
33
33
  onLxpackBridgeMiss: (event) => report("lxpack-bridge-miss", { event: event.name }),
34
+ onLxpackBridgeError: (err) => report("lxpack-bridge-error", { err }),
34
35
  onXapiTransportError: (err) => report("xapi-transport", { err }),
36
+ onXapiMappingError: (err) => report("xapi-mapping", { err }),
35
37
  };
36
38
  }
37
39
 
@@ -98,13 +100,21 @@ function productionXapi(xapiProxyUrl: string | undefined): LessonkitConfig["xapi
98
100
  };
99
101
  }
100
102
 
103
+ /** Theme preset — keep in sync with lessonkit.json `course.theme.preset`. */
104
+ export const COURSE_THEME_PRESET = "default" as const;
105
+
101
106
  export function createCourseConfig(): LessonkitConfig {
102
107
  const { xapiProxyUrl, analyticsUrl } = readProxyUrls();
103
108
  const useProductionTransports = import.meta.env.PROD || (xapiProxyUrl && analyticsUrl);
104
109
 
105
110
  const config: LessonkitConfig = {
106
111
  courseId: "my-course",
107
- lxpack: { bridge: "off" },
112
+ lxpack: {
113
+ // Set bridge: "auto" when packaging for LMS (SCORM/xAPI/cmi5). In production, allowedParentOrigins
114
+ // is required — see https://lessonkit.readthedocs.io/en/latest/guides/react-developers/production-checklist.html
115
+ bridge: "off",
116
+ // allowedParentOrigins: ["https://your-lms.example"],
117
+ },
108
118
  observability: createObservability(),
109
119
  tracking: useProductionTransports ? productionTracking(analyticsUrl) : devConsoleTracking(),
110
120
  xapi: useProductionTransports ? productionXapi(xapiProxyUrl) : devConsoleXapi(),
@@ -0,0 +1,3 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ declare module "*.css";