@lessonkit/react 0.9.2 → 1.0.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/dist/index.d.cts CHANGED
@@ -1,18 +1,12 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React from 'react';
3
3
  import * as _lessonkit_core from '@lessonkit/core';
4
- import { LessonId, CourseId, TelemetryUser, TrackingClient, LessonkitPlugin, TelemetryEventName, PluginHost, CheckId, BlockId } from '@lessonkit/core';
5
- export { AssessmentScoreInput, AssessmentScoreResult, InteractionBlockRegistration, LessonkitPlugin, LessonkitPluginContext, LessonkitPluginKind, PluginHost, createPluginHost, defineLessonkitPlugin } from '@lessonkit/core';
4
+ import { CourseId, TelemetryUser, TrackingClient, LessonkitPlugin, ProgressState, LessonId, TelemetryEventName, PluginHost, CheckId, BlockId } from '@lessonkit/core';
5
+ export { AssessmentScoreInput, AssessmentScoreResult, InteractionBlockRegistration, LessonkitPlugin, LessonkitPluginContext, LessonkitPluginKind, PluginHost, PluginRegistry, TelemetryPipelineSink, buildTelemetryEvent, createLessonkitRuntime, createPluginRegistry, createTelemetryPipeline, defineAssessmentPlugin, defineLifecyclePlugin, defineTelemetryPlugin } from '@lessonkit/core';
6
6
  import { XAPITransport, XAPIClient } from '@lessonkit/xapi';
7
7
  import { LessonkitThemeV1, ThemePresetName, PartialLessonkitThemeV1 } from '@lessonkit/themes';
8
8
  export { ThemePresetName } from '@lessonkit/themes';
9
9
 
10
- type ProgressState = {
11
- activeLessonId?: LessonId;
12
- completedLessonIds: ReadonlySet<LessonId>;
13
- courseCompleted: boolean;
14
- };
15
-
16
10
  type LessonkitConfig = {
17
11
  courseId: CourseId;
18
12
  session?: {
@@ -41,6 +35,10 @@ type LessonkitConfig = {
41
35
  };
42
36
  /** Framework plugins (analytics, LMS, assessment, interaction, AI). */
43
37
  plugins?: LessonkitPlugin[];
38
+ /** Runtime implementation (`v2` headless runtime is default; set `"v1"` to opt out). */
39
+ runtimeVersion?: "v1" | "v2";
40
+ /** Optional custom telemetry pipeline sinks (used alongside tracking/xapi). */
41
+ sinks?: _lessonkit_core.TelemetryPipelineSink[];
44
42
  };
45
43
 
46
44
  type LessonkitRuntime = {
@@ -66,6 +64,8 @@ declare function LessonkitProvider(props: {
66
64
  children: React.ReactNode;
67
65
  }): react_jsx_runtime.JSX.Element;
68
66
 
67
+ /** @internal Reset module warnings between tests. */
68
+ declare function resetQuizWarningsForTests(): void;
69
69
  declare function Course(props: {
70
70
  title: string;
71
71
  courseId: CourseId;
@@ -75,6 +75,8 @@ declare function Course(props: {
75
75
  declare function Lesson(props: {
76
76
  title: string;
77
77
  lessonId: LessonId;
78
+ /** When false, unmount does not emit lesson_completed (for routed multi-pane layouts). Default true. */
79
+ autoCompleteOnUnmount?: boolean;
78
80
  children: React.ReactNode;
79
81
  }): react_jsx_runtime.JSX.Element;
80
82
  declare function Scenario(props: {
@@ -84,6 +86,9 @@ declare function Scenario(props: {
84
86
  declare function Reflection(props: {
85
87
  blockId?: BlockId;
86
88
  prompt?: string;
89
+ hint?: string;
90
+ value?: string;
91
+ onChange?: (value: string) => void;
87
92
  children?: React.ReactNode;
88
93
  }): react_jsx_runtime.JSX.Element;
89
94
  declare function KnowledgeCheck(props: {
@@ -91,27 +96,31 @@ declare function KnowledgeCheck(props: {
91
96
  question: string;
92
97
  choices: string[];
93
98
  answer: string;
99
+ passingScore?: number;
94
100
  }): react_jsx_runtime.JSX.Element;
95
101
  declare function Quiz(props: {
96
102
  checkId: CheckId;
97
103
  question: string;
98
104
  choices: string[];
99
105
  answer: string;
106
+ passingScore?: number;
107
+ }): react_jsx_runtime.JSX.Element;
108
+ declare function ProgressTracker(props: {
109
+ totalLessons?: number;
100
110
  }): react_jsx_runtime.JSX.Element;
101
- declare function ProgressTracker(): react_jsx_runtime.JSX.Element;
102
111
 
103
112
  declare function useLessonkit(): LessonkitRuntime;
104
- declare function useProgress(): ProgressState;
113
+ declare function useProgress(): _lessonkit_core.ProgressState;
105
114
  declare function useTracking(): {
106
115
  track: (name: _lessonkit_core.TelemetryEventName, data?: unknown, opts?: {
107
- lessonId?: _lessonkit_core.LessonId;
116
+ lessonId?: LessonId;
108
117
  }) => void;
109
118
  };
110
119
  declare function useCompletion(): {
111
- completeLesson: (lessonId: _lessonkit_core.LessonId) => void;
120
+ completeLesson: (lessonId: LessonId) => void;
112
121
  completeCourse: () => void;
113
122
  };
114
- declare function useQuizState(): {
123
+ declare function useQuizState(enclosingLessonId?: LessonId): {
115
124
  answer: (opts: {
116
125
  checkId: CheckId;
117
126
  question: string;
@@ -184,4 +193,4 @@ declare const BLOCK_CATALOG: BlockCatalogEntry[];
184
193
  declare function buildBlockCatalog(): BlockCatalogEntry[];
185
194
  declare function getBlockCatalogEntry(type: string): BlockCatalogEntry | undefined;
186
195
 
187
- export { BLOCK_CATALOG, type BlockCatalogEntry, type BlockPropSpec, Course, KnowledgeCheck, Lesson, type LessonkitConfig, LessonkitProvider, type LessonkitRuntime, ProgressTracker, Quiz, Reflection, Scenario, type ThemeContextValue, type ThemeMode, ThemeProvider, type ThemeProviderProps, type ThemeResolvedMode, blockCatalogVersion, buildBlockCatalog, getBlockCatalogEntry, useCompletion, useLessonkit, useProgress, useQuizState, useTheme, useTracking };
196
+ export { BLOCK_CATALOG, type BlockCatalogEntry, type BlockPropSpec, Course, KnowledgeCheck, Lesson, type LessonkitConfig, LessonkitProvider, type LessonkitRuntime, ProgressTracker, Quiz, Reflection, Scenario, type ThemeContextValue, type ThemeMode, ThemeProvider, type ThemeProviderProps, type ThemeResolvedMode, blockCatalogVersion, buildBlockCatalog, getBlockCatalogEntry, resetQuizWarningsForTests, useCompletion, useLessonkit, useProgress, useQuizState, useTheme, useTracking };
package/dist/index.d.ts CHANGED
@@ -1,18 +1,12 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React from 'react';
3
3
  import * as _lessonkit_core from '@lessonkit/core';
4
- import { LessonId, CourseId, TelemetryUser, TrackingClient, LessonkitPlugin, TelemetryEventName, PluginHost, CheckId, BlockId } from '@lessonkit/core';
5
- export { AssessmentScoreInput, AssessmentScoreResult, InteractionBlockRegistration, LessonkitPlugin, LessonkitPluginContext, LessonkitPluginKind, PluginHost, createPluginHost, defineLessonkitPlugin } from '@lessonkit/core';
4
+ import { CourseId, TelemetryUser, TrackingClient, LessonkitPlugin, ProgressState, LessonId, TelemetryEventName, PluginHost, CheckId, BlockId } from '@lessonkit/core';
5
+ export { AssessmentScoreInput, AssessmentScoreResult, InteractionBlockRegistration, LessonkitPlugin, LessonkitPluginContext, LessonkitPluginKind, PluginHost, PluginRegistry, TelemetryPipelineSink, buildTelemetryEvent, createLessonkitRuntime, createPluginRegistry, createTelemetryPipeline, defineAssessmentPlugin, defineLifecyclePlugin, defineTelemetryPlugin } from '@lessonkit/core';
6
6
  import { XAPITransport, XAPIClient } from '@lessonkit/xapi';
7
7
  import { LessonkitThemeV1, ThemePresetName, PartialLessonkitThemeV1 } from '@lessonkit/themes';
8
8
  export { ThemePresetName } from '@lessonkit/themes';
9
9
 
10
- type ProgressState = {
11
- activeLessonId?: LessonId;
12
- completedLessonIds: ReadonlySet<LessonId>;
13
- courseCompleted: boolean;
14
- };
15
-
16
10
  type LessonkitConfig = {
17
11
  courseId: CourseId;
18
12
  session?: {
@@ -41,6 +35,10 @@ type LessonkitConfig = {
41
35
  };
42
36
  /** Framework plugins (analytics, LMS, assessment, interaction, AI). */
43
37
  plugins?: LessonkitPlugin[];
38
+ /** Runtime implementation (`v2` headless runtime is default; set `"v1"` to opt out). */
39
+ runtimeVersion?: "v1" | "v2";
40
+ /** Optional custom telemetry pipeline sinks (used alongside tracking/xapi). */
41
+ sinks?: _lessonkit_core.TelemetryPipelineSink[];
44
42
  };
45
43
 
46
44
  type LessonkitRuntime = {
@@ -66,6 +64,8 @@ declare function LessonkitProvider(props: {
66
64
  children: React.ReactNode;
67
65
  }): react_jsx_runtime.JSX.Element;
68
66
 
67
+ /** @internal Reset module warnings between tests. */
68
+ declare function resetQuizWarningsForTests(): void;
69
69
  declare function Course(props: {
70
70
  title: string;
71
71
  courseId: CourseId;
@@ -75,6 +75,8 @@ declare function Course(props: {
75
75
  declare function Lesson(props: {
76
76
  title: string;
77
77
  lessonId: LessonId;
78
+ /** When false, unmount does not emit lesson_completed (for routed multi-pane layouts). Default true. */
79
+ autoCompleteOnUnmount?: boolean;
78
80
  children: React.ReactNode;
79
81
  }): react_jsx_runtime.JSX.Element;
80
82
  declare function Scenario(props: {
@@ -84,6 +86,9 @@ declare function Scenario(props: {
84
86
  declare function Reflection(props: {
85
87
  blockId?: BlockId;
86
88
  prompt?: string;
89
+ hint?: string;
90
+ value?: string;
91
+ onChange?: (value: string) => void;
87
92
  children?: React.ReactNode;
88
93
  }): react_jsx_runtime.JSX.Element;
89
94
  declare function KnowledgeCheck(props: {
@@ -91,27 +96,31 @@ declare function KnowledgeCheck(props: {
91
96
  question: string;
92
97
  choices: string[];
93
98
  answer: string;
99
+ passingScore?: number;
94
100
  }): react_jsx_runtime.JSX.Element;
95
101
  declare function Quiz(props: {
96
102
  checkId: CheckId;
97
103
  question: string;
98
104
  choices: string[];
99
105
  answer: string;
106
+ passingScore?: number;
107
+ }): react_jsx_runtime.JSX.Element;
108
+ declare function ProgressTracker(props: {
109
+ totalLessons?: number;
100
110
  }): react_jsx_runtime.JSX.Element;
101
- declare function ProgressTracker(): react_jsx_runtime.JSX.Element;
102
111
 
103
112
  declare function useLessonkit(): LessonkitRuntime;
104
- declare function useProgress(): ProgressState;
113
+ declare function useProgress(): _lessonkit_core.ProgressState;
105
114
  declare function useTracking(): {
106
115
  track: (name: _lessonkit_core.TelemetryEventName, data?: unknown, opts?: {
107
- lessonId?: _lessonkit_core.LessonId;
116
+ lessonId?: LessonId;
108
117
  }) => void;
109
118
  };
110
119
  declare function useCompletion(): {
111
- completeLesson: (lessonId: _lessonkit_core.LessonId) => void;
120
+ completeLesson: (lessonId: LessonId) => void;
112
121
  completeCourse: () => void;
113
122
  };
114
- declare function useQuizState(): {
123
+ declare function useQuizState(enclosingLessonId?: LessonId): {
115
124
  answer: (opts: {
116
125
  checkId: CheckId;
117
126
  question: string;
@@ -184,4 +193,4 @@ declare const BLOCK_CATALOG: BlockCatalogEntry[];
184
193
  declare function buildBlockCatalog(): BlockCatalogEntry[];
185
194
  declare function getBlockCatalogEntry(type: string): BlockCatalogEntry | undefined;
186
195
 
187
- export { BLOCK_CATALOG, type BlockCatalogEntry, type BlockPropSpec, Course, KnowledgeCheck, Lesson, type LessonkitConfig, LessonkitProvider, type LessonkitRuntime, ProgressTracker, Quiz, Reflection, Scenario, type ThemeContextValue, type ThemeMode, ThemeProvider, type ThemeProviderProps, type ThemeResolvedMode, blockCatalogVersion, buildBlockCatalog, getBlockCatalogEntry, useCompletion, useLessonkit, useProgress, useQuizState, useTheme, useTracking };
196
+ export { BLOCK_CATALOG, type BlockCatalogEntry, type BlockPropSpec, Course, KnowledgeCheck, Lesson, type LessonkitConfig, LessonkitProvider, type LessonkitRuntime, ProgressTracker, Quiz, Reflection, Scenario, type ThemeContextValue, type ThemeMode, ThemeProvider, type ThemeProviderProps, type ThemeResolvedMode, blockCatalogVersion, buildBlockCatalog, getBlockCatalogEntry, resetQuizWarningsForTests, useCompletion, useLessonkit, useProgress, useQuizState, useTheme, useTracking };