@lxpack/runtime 0.1.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.
@@ -0,0 +1,32 @@
1
+ import type { CourseManifest, CourseProgress, LxpackAPI, RuntimeConfig, TrackEvent } from "./types.js";
2
+ export declare class LxpackRuntime {
3
+ private manifest;
4
+ private progress;
5
+ private scorm;
6
+ private completionThreshold;
7
+ private storageKey;
8
+ private mode;
9
+ private passedAssessments;
10
+ constructor(config: RuntimeConfig);
11
+ private restoreScormProgress;
12
+ private restoreLocalProgress;
13
+ private syncPassedAssessments;
14
+ private getAssessmentPassingScore;
15
+ getAPI(): LxpackAPI;
16
+ track(event: TrackEvent): void;
17
+ submitAssessment(assessmentId: string, score: number, passingScore: number): void;
18
+ completeLesson(lessonId: string): void;
19
+ setCurrentLesson(lessonId: string): void;
20
+ getProgress(): CourseProgress;
21
+ getManifest(): CourseManifest;
22
+ isLessonComplete(lessonId: string): boolean;
23
+ isAssessmentPassed(assessmentId: string): boolean;
24
+ getTotalUnits(): number;
25
+ getCompletionRatio(): number;
26
+ private updateCompletion;
27
+ private persist;
28
+ terminate(): void;
29
+ }
30
+ export { createScormConnection, findLmsApi, Scorm12Adapter, Scorm12Simulator, Scorm12API, installScormAPI, trimSuspendData, } from "./scorm-api.js";
31
+ export type { CourseManifest, CourseProgress, LxpackAPI, RuntimeConfig, TrackEvent };
32
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,SAAS,EACT,aAAa,EACb,UAAU,EACX,MAAM,YAAY,CAAC;AAoCpB,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,QAAQ,CAAiB;IACjC,OAAO,CAAC,KAAK,CAAgC;IAC7C,OAAO,CAAC,mBAAmB,CAAS;IACpC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,IAAI,CAAwB;IACpC,OAAO,CAAC,iBAAiB,CAAqB;gBAElC,MAAM,EAAE,aAAa;IAwBjC,OAAO,CAAC,oBAAoB;IAqB5B,OAAO,CAAC,oBAAoB;IAa5B,OAAO,CAAC,qBAAqB;IAS7B,OAAO,CAAC,yBAAyB;IAQjC,MAAM,IAAI,SAAS;IAenB,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAa9B,gBAAgB,CACd,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,MAAM,GACnB,IAAI;IAiBP,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAWtC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAQxC,WAAW,IAAI,cAAc;IAI7B,WAAW,IAAI,cAAc;IAI7B,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAI3C,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO;IAIjD,aAAa,IAAI,MAAM;IAKvB,kBAAkB,IAAI,MAAM;IAc5B,OAAO,CAAC,gBAAgB;IAkCxB,OAAO,CAAC,OAAO;IAiBf,SAAS,IAAI,IAAI;CAKlB;AAED,OAAO,EACL,qBAAqB,EACrB,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,411 @@
1
+ var R = Object.defineProperty;
2
+ var _ = (e, s, t) => s in e ? R(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
3
+ var i = (e, s, t) => _(e, typeof s != "symbol" ? s + "" : s, t);
4
+ const u = "lxpack_scorm12_preview";
5
+ function f(e = 500) {
6
+ let s = window, t = 0;
7
+ for (; s && t < e; ) {
8
+ try {
9
+ const r = s.API;
10
+ if (r && typeof r.LMSInitialize == "function")
11
+ return r;
12
+ } catch {
13
+ }
14
+ try {
15
+ if (s.parent && s.parent !== s)
16
+ s = s.parent;
17
+ else if (s.opener && !s.opener.closed)
18
+ s = s.opener;
19
+ else
20
+ break;
21
+ } catch {
22
+ break;
23
+ }
24
+ t++;
25
+ }
26
+ return null;
27
+ }
28
+ class E {
29
+ constructor(s) {
30
+ i(this, "api");
31
+ i(this, "initialized", !1);
32
+ i(this, "terminated", !1);
33
+ i(this, "lastError", "0");
34
+ this.api = s;
35
+ }
36
+ LMSInitialize() {
37
+ if (this.initialized)
38
+ return this.lastError = "301", "false";
39
+ const s = this.api.LMSInitialize("");
40
+ return s === "true" && (this.initialized = !0, this.terminated = !1, this.lastError = "0"), s;
41
+ }
42
+ LMSFinish() {
43
+ if (!this.initialized || this.terminated)
44
+ return this.lastError = "302", "false";
45
+ const s = this.api.LMSFinish("");
46
+ return s === "true" && (this.terminated = !0, this.lastError = "0"), s;
47
+ }
48
+ LMSGetValue(s) {
49
+ return !this.initialized || this.terminated ? (this.lastError = "301", "") : (this.lastError = "0", this.api.LMSGetValue(s));
50
+ }
51
+ LMSSetValue(s, t) {
52
+ return !this.initialized || this.terminated ? (this.lastError = "301", "false") : (this.lastError = "0", this.api.LMSSetValue(s, t));
53
+ }
54
+ LMSCommit() {
55
+ return !this.initialized || this.terminated ? (this.lastError = "301", "false") : (this.lastError = "0", this.api.LMSCommit(""));
56
+ }
57
+ LMSGetLastError() {
58
+ return this.lastError;
59
+ }
60
+ LMSGetErrorString(s) {
61
+ const t = s ?? this.lastError;
62
+ return t === "301" ? "Not initialized" : t === "302" ? "Already terminated" : this.api.LMSGetErrorString(t);
63
+ }
64
+ LMSGetDiagnostic(s) {
65
+ return this.api.LMSGetDiagnostic(s ?? this.lastError);
66
+ }
67
+ setLessonStatus(s) {
68
+ this.LMSSetValue("cmi.core.lesson_status", s);
69
+ }
70
+ setScore(s, t = 100) {
71
+ this.LMSSetValue("cmi.core.score.raw", String(s)), this.LMSSetValue("cmi.core.score.max", String(t)), this.LMSSetValue("cmi.core.score.min", "0");
72
+ }
73
+ setSuspendData(s) {
74
+ const t = l(s);
75
+ this.LMSSetValue("cmi.suspend_data", t);
76
+ }
77
+ setLessonLocation(s) {
78
+ this.LMSSetValue("cmi.core.lesson_location", s);
79
+ }
80
+ }
81
+ class h {
82
+ constructor(s = {}) {
83
+ i(this, "data", {
84
+ lessonStatus: "not attempted",
85
+ scoreRaw: 0,
86
+ scoreMin: 0,
87
+ scoreMax: 100,
88
+ suspendData: "",
89
+ lessonLocation: "",
90
+ entry: "ab-initio",
91
+ exit: "",
92
+ sessionTime: "00:00:00"
93
+ });
94
+ i(this, "initialized", !1);
95
+ i(this, "terminated", !1);
96
+ i(this, "lastError", "0");
97
+ i(this, "persistToStorage");
98
+ this.persistToStorage = s.persistToStorage ?? !1, s.initialData && (this.data = { ...this.data, ...s.initialData }), this.persistToStorage && this.loadFromStorage();
99
+ }
100
+ LMSInitialize() {
101
+ return this.initialized ? (this.lastError = "301", "false") : (this.initialized = !0, this.terminated = !1, this.lastError = "0", "true");
102
+ }
103
+ LMSFinish() {
104
+ return !this.initialized || this.terminated ? (this.lastError = "302", "false") : (this.data.exit = "suspend", this.terminated = !0, this.saveToStorage(), this.lastError = "0", "true");
105
+ }
106
+ LMSGetValue(s) {
107
+ if (!this.initialized || this.terminated)
108
+ return this.lastError = "301", "";
109
+ switch (this.lastError = "0", s) {
110
+ case "cmi.core.lesson_status":
111
+ return this.data.lessonStatus;
112
+ case "cmi.core.score.raw":
113
+ return String(this.data.scoreRaw);
114
+ case "cmi.core.score.min":
115
+ return String(this.data.scoreMin);
116
+ case "cmi.core.score.max":
117
+ return String(this.data.scoreMax);
118
+ case "cmi.suspend_data":
119
+ return this.data.suspendData;
120
+ case "cmi.core.lesson_location":
121
+ return this.data.lessonLocation;
122
+ case "cmi.core.student_id":
123
+ return "lxpack-learner";
124
+ case "cmi.core.student_name":
125
+ return "LXPack Learner";
126
+ case "cmi.core.entry":
127
+ return this.data.entry;
128
+ case "cmi.core.exit":
129
+ return this.data.exit;
130
+ case "cmi.core.session_time":
131
+ return this.data.sessionTime;
132
+ default:
133
+ return "";
134
+ }
135
+ }
136
+ LMSSetValue(s, t) {
137
+ if (!this.initialized || this.terminated)
138
+ return this.lastError = "301", "false";
139
+ switch (this.lastError = "0", s) {
140
+ case "cmi.core.lesson_status":
141
+ this.data.lessonStatus = t;
142
+ break;
143
+ case "cmi.core.score.raw":
144
+ this.data.scoreRaw = Number(t);
145
+ break;
146
+ case "cmi.core.score.min":
147
+ this.data.scoreMin = Number(t);
148
+ break;
149
+ case "cmi.core.score.max":
150
+ this.data.scoreMax = Number(t);
151
+ break;
152
+ case "cmi.suspend_data":
153
+ this.data.suspendData = l(t);
154
+ break;
155
+ case "cmi.core.lesson_location":
156
+ this.data.lessonLocation = t;
157
+ break;
158
+ case "cmi.core.exit":
159
+ this.data.exit = t;
160
+ break;
161
+ case "cmi.core.session_time":
162
+ this.data.sessionTime = t;
163
+ break;
164
+ default:
165
+ return "false";
166
+ }
167
+ return this.saveToStorage(), "true";
168
+ }
169
+ LMSCommit() {
170
+ return !this.initialized || this.terminated ? (this.lastError = "301", "false") : (this.saveToStorage(), this.lastError = "0", "true");
171
+ }
172
+ LMSGetLastError() {
173
+ return this.lastError;
174
+ }
175
+ LMSGetErrorString(s) {
176
+ const t = s ?? this.lastError;
177
+ return t === "301" ? "Not initialized" : t === "302" ? "Already terminated" : "No error";
178
+ }
179
+ LMSGetDiagnostic() {
180
+ return "";
181
+ }
182
+ setLessonStatus(s) {
183
+ this.data.lessonStatus = s, this.saveToStorage();
184
+ }
185
+ setScore(s, t = 100) {
186
+ this.data.scoreRaw = s, this.data.scoreMax = t, this.data.scoreMin = 0, this.saveToStorage();
187
+ }
188
+ setSuspendData(s) {
189
+ this.data.suspendData = l(s), this.saveToStorage();
190
+ }
191
+ setLessonLocation(s) {
192
+ this.data.lessonLocation = s, this.saveToStorage();
193
+ }
194
+ loadFromStorage() {
195
+ try {
196
+ const s = localStorage.getItem(u);
197
+ s && (this.data = { ...this.data, ...JSON.parse(s) });
198
+ } catch {
199
+ }
200
+ }
201
+ saveToStorage() {
202
+ if (this.persistToStorage)
203
+ try {
204
+ localStorage.setItem(u, JSON.stringify(this.data));
205
+ } catch {
206
+ }
207
+ }
208
+ }
209
+ class L extends h {
210
+ constructor() {
211
+ super({ persistToStorage: !0 });
212
+ }
213
+ }
214
+ function l(e) {
215
+ return e.length <= 4096 ? e : (console.warn(
216
+ "[lxpack] suspend_data exceeds 4096 chars; truncating"
217
+ ), e.slice(0, 4096));
218
+ }
219
+ function p(e) {
220
+ if (e === "preview")
221
+ return new h({ persistToStorage: !0 });
222
+ if (e === "scorm12") {
223
+ const s = f();
224
+ return s ? new E(s) : (console.warn(
225
+ "[lxpack] No LMS SCORM API found; using in-memory simulator (progress will not persist to LMS)"
226
+ ), new h({ persistToStorage: !1 }));
227
+ }
228
+ return new h({ persistToStorage: !1 });
229
+ }
230
+ function M(e = "preview") {
231
+ const s = p(e);
232
+ if (e === "preview") {
233
+ const t = window;
234
+ t.API = s;
235
+ }
236
+ return s;
237
+ }
238
+ function g(e) {
239
+ const s = `${e.title}::${e.version}`;
240
+ let t = 0;
241
+ for (let r = 0; r < s.length; r++)
242
+ t = (t << 5) - t + s.charCodeAt(r), t |= 0;
243
+ return `lxpack_progress_${Math.abs(t)}`;
244
+ }
245
+ function S(e, s) {
246
+ return {
247
+ ...e,
248
+ ...s,
249
+ completedLessons: s.completedLessons ?? e.completedLessons,
250
+ assessmentScores: {
251
+ ...e.assessmentScores,
252
+ ...s.assessmentScores
253
+ },
254
+ suspendData: {
255
+ ...e.suspendData,
256
+ ...s.suspendData
257
+ }
258
+ };
259
+ }
260
+ class N {
261
+ constructor(s) {
262
+ i(this, "manifest");
263
+ i(this, "progress");
264
+ i(this, "scorm", null);
265
+ i(this, "completionThreshold");
266
+ i(this, "storageKey");
267
+ i(this, "mode");
268
+ i(this, "passedAssessments", /* @__PURE__ */ new Set());
269
+ var r, a, o;
270
+ this.manifest = s.manifest, this.mode = s.mode, this.completionThreshold = ((a = (r = s.manifest.tracking) == null ? void 0 : r.completion) == null ? void 0 : a.threshold) ?? 0.9, this.storageKey = g(s.manifest);
271
+ const t = ((o = s.manifest.lessons[0]) == null ? void 0 : o.id) ?? "";
272
+ this.progress = s.progress ?? {
273
+ currentLessonId: t,
274
+ completedLessons: [],
275
+ assessmentScores: {},
276
+ suspendData: {}
277
+ }, s.mode === "scorm12" ? (this.scorm = p("scorm12"), this.scorm.LMSInitialize(), this.restoreScormProgress()) : (s.mode === "preview" || s.mode === "standalone") && this.restoreLocalProgress();
278
+ }
279
+ restoreScormProgress() {
280
+ if (!this.scorm) return;
281
+ const s = this.scorm.LMSGetValue("cmi.suspend_data");
282
+ if (s)
283
+ try {
284
+ const t = JSON.parse(s);
285
+ this.progress = S(this.progress, t);
286
+ } catch {
287
+ }
288
+ else {
289
+ const t = this.scorm.LMSGetValue("cmi.core.lesson_location");
290
+ t && (this.progress.currentLessonId = t);
291
+ }
292
+ this.syncPassedAssessments();
293
+ }
294
+ restoreLocalProgress() {
295
+ try {
296
+ const s = localStorage.getItem(this.storageKey);
297
+ if (s) {
298
+ const t = JSON.parse(s);
299
+ this.progress = S(this.progress, t);
300
+ }
301
+ } catch {
302
+ }
303
+ this.syncPassedAssessments();
304
+ }
305
+ syncPassedAssessments() {
306
+ this.passedAssessments.clear();
307
+ for (const [s, t] of Object.entries(this.progress.assessmentScores))
308
+ t >= this.getAssessmentPassingScore(s) && this.passedAssessments.add(s);
309
+ }
310
+ getAssessmentPassingScore(s) {
311
+ var a;
312
+ if (!((a = this.manifest.assessments) == null ? void 0 : a.find((o) => o.id === s))) return 0.7;
313
+ const r = this.progress.suspendData[`assessment_passing_${s}`];
314
+ return typeof r == "number" ? r : 0.7;
315
+ }
316
+ getAPI() {
317
+ return {
318
+ track: (s) => this.track(s),
319
+ completeLesson: (s) => this.completeLesson(s),
320
+ getProgress: () => ({ ...this.progress }),
321
+ setVariable: (s, t) => {
322
+ this.progress.suspendData[s] = t, this.persist();
323
+ },
324
+ getVariable: (s) => this.progress.suspendData[s],
325
+ submitAssessment: (s, t, r) => this.submitAssessment(s, t, r)
326
+ };
327
+ }
328
+ track(s) {
329
+ var t;
330
+ if (s.type === "interaction" && s.id && (this.progress.suspendData[`interaction_${s.id}`] = s.data ?? !0, console.debug("[lxpack] interaction:", s.id, s.data)), s.type === "assessment" && s.id && ((t = s.data) == null ? void 0 : t.score) != null) {
331
+ const r = Number(s.data.score);
332
+ this.progress.assessmentScores[s.id] = r;
333
+ }
334
+ this.persist();
335
+ }
336
+ submitAssessment(s, t, r) {
337
+ this.progress.assessmentScores[s] = t, this.progress.suspendData[`assessment_passing_${s}`] = r, t >= r ? this.passedAssessments.add(s) : this.passedAssessments.delete(s), this.track({
338
+ type: "assessment",
339
+ id: s,
340
+ data: { score: t, passingScore: r, passed: t >= r }
341
+ }), this.updateCompletion();
342
+ }
343
+ completeLesson(s) {
344
+ new Set(this.manifest.lessons.map((r) => r.id)).has(s) && (this.progress.completedLessons.includes(s) || this.progress.completedLessons.push(s), this.updateCompletion(), this.persist());
345
+ }
346
+ setCurrentLesson(s) {
347
+ this.progress.currentLessonId = s, this.scorm && this.scorm.setLessonLocation(s), this.persist();
348
+ }
349
+ getProgress() {
350
+ return { ...this.progress };
351
+ }
352
+ getManifest() {
353
+ return this.manifest;
354
+ }
355
+ isLessonComplete(s) {
356
+ return this.progress.completedLessons.includes(s);
357
+ }
358
+ isAssessmentPassed(s) {
359
+ return this.passedAssessments.has(s);
360
+ }
361
+ getTotalUnits() {
362
+ var t;
363
+ const s = ((t = this.manifest.assessments) == null ? void 0 : t.length) ?? 0;
364
+ return this.manifest.lessons.length + s;
365
+ }
366
+ getCompletionRatio() {
367
+ var c;
368
+ if (this.getTotalUnits() === 0) return 0;
369
+ const t = this.manifest.lessons.length, r = ((c = this.manifest.assessments) == null ? void 0 : c.length) ?? 0, a = this.progress.completedLessons.filter(
370
+ (m) => this.manifest.lessons.some((d) => d.id === m)
371
+ ).length, o = this.passedAssessments.size;
372
+ return (a + o) / (t + r);
373
+ }
374
+ updateCompletion() {
375
+ var r, a, o;
376
+ const s = this.getCompletionRatio(), t = Math.round(s * 100);
377
+ if (this.scorm) {
378
+ this.scorm.setScore(t);
379
+ const c = this.manifest.lessons.every(
380
+ (n) => this.progress.completedLessons.includes(n.id)
381
+ ), m = !((r = this.manifest.assessments) != null && r.length) || this.manifest.assessments.every((n) => this.passedAssessments.has(n.id));
382
+ ((a = this.manifest.assessments) == null ? void 0 : a.some(
383
+ (n) => n.id in this.progress.assessmentScores && !this.passedAssessments.has(n.id)
384
+ )) ? this.scorm.setLessonStatus("failed") : s >= this.completionThreshold && c && m ? this.scorm.setLessonStatus(
385
+ (((o = this.manifest.assessments) == null ? void 0 : o.length) ?? 0) > 0 ? "passed" : "completed"
386
+ ) : t > 0 && this.scorm.setLessonStatus("incomplete");
387
+ }
388
+ }
389
+ persist() {
390
+ const s = l(JSON.stringify(this.progress));
391
+ if (this.mode === "preview" || this.mode === "standalone")
392
+ try {
393
+ localStorage.setItem(this.storageKey, s);
394
+ } catch {
395
+ }
396
+ this.scorm && (this.scorm.setSuspendData(s), this.scorm.LMSCommit());
397
+ }
398
+ terminate() {
399
+ this.scorm && this.scorm.LMSFinish();
400
+ }
401
+ }
402
+ export {
403
+ N as LxpackRuntime,
404
+ L as Scorm12API,
405
+ E as Scorm12Adapter,
406
+ h as Scorm12Simulator,
407
+ p as createScormConnection,
408
+ f as findLmsApi,
409
+ M as installScormAPI,
410
+ l as trimSuspendData
411
+ };
@@ -0,0 +1,81 @@
1
+ /**
2
+ * SCORM 1.2 API — LMS discovery, adapter, and preview simulator.
3
+ * @see https://scorm.com/scorm-explained/technical-scorm/run-time/
4
+ */
5
+ export interface ScormData {
6
+ lessonStatus: "not attempted" | "incomplete" | "completed" | "passed" | "failed";
7
+ scoreRaw: number;
8
+ scoreMin: number;
9
+ scoreMax: number;
10
+ suspendData: string;
11
+ lessonLocation: string;
12
+ entry: string;
13
+ exit: string;
14
+ sessionTime: string;
15
+ }
16
+ export interface ScormApiLike {
17
+ LMSInitialize(param?: string): string;
18
+ LMSFinish(param?: string): string;
19
+ LMSGetValue(element: string): string;
20
+ LMSSetValue(element: string, value: string): string;
21
+ LMSCommit(param?: string): string;
22
+ LMSGetLastError(): string;
23
+ LMSGetErrorString(errorCode?: string): string;
24
+ LMSGetDiagnostic(errorCode?: string): string;
25
+ }
26
+ declare const SCORM_SUSPEND_DATA_MAX = 4096;
27
+ export declare function findLmsApi(maxDepth?: number): ScormApiLike | null;
28
+ export declare class Scorm12Adapter implements ScormApiLike {
29
+ private api;
30
+ private initialized;
31
+ private terminated;
32
+ private lastError;
33
+ constructor(api: ScormApiLike);
34
+ LMSInitialize(): string;
35
+ LMSFinish(): string;
36
+ LMSGetValue(element: string): string;
37
+ LMSSetValue(element: string, value: string): string;
38
+ LMSCommit(): string;
39
+ LMSGetLastError(): string;
40
+ LMSGetErrorString(errorCode?: string): string;
41
+ LMSGetDiagnostic(errorCode?: string): string;
42
+ setLessonStatus(status: ScormData["lessonStatus"]): void;
43
+ setScore(raw: number, max?: number): void;
44
+ setSuspendData(data: string): void;
45
+ setLessonLocation(location: string): void;
46
+ }
47
+ export declare class Scorm12Simulator implements ScormApiLike {
48
+ private data;
49
+ private initialized;
50
+ private terminated;
51
+ private lastError;
52
+ private persistToStorage;
53
+ constructor(options?: {
54
+ persistToStorage?: boolean;
55
+ initialData?: Partial<ScormData>;
56
+ });
57
+ LMSInitialize(): string;
58
+ LMSFinish(): string;
59
+ LMSGetValue(element: string): string;
60
+ LMSSetValue(element: string, value: string): string;
61
+ LMSCommit(): string;
62
+ LMSGetLastError(): string;
63
+ LMSGetErrorString(errorCode?: string): string;
64
+ LMSGetDiagnostic(): string;
65
+ setLessonStatus(status: ScormData["lessonStatus"]): void;
66
+ setScore(raw: number, max?: number): void;
67
+ setSuspendData(data: string): void;
68
+ setLessonLocation(location: string): void;
69
+ private loadFromStorage;
70
+ private saveToStorage;
71
+ }
72
+ /** @deprecated Use createScormConnection */
73
+ export declare class Scorm12API extends Scorm12Simulator {
74
+ constructor();
75
+ }
76
+ export type ScormConnection = Scorm12Adapter | Scorm12Simulator;
77
+ export declare function trimSuspendData(data: string): string;
78
+ export declare function createScormConnection(mode: "preview" | "standalone" | "scorm12"): ScormConnection;
79
+ export declare function installScormAPI(mode?: "preview" | "standalone" | "scorm12"): ScormConnection;
80
+ export { SCORM_SUSPEND_DATA_MAX };
81
+ //# sourceMappingURL=scorm-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scorm-api.d.ts","sourceRoot":"","sources":["../src/scorm-api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,SAAS;IACxB,YAAY,EAAE,eAAe,GAAG,YAAY,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACjF,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,aAAa,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtC,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAClC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACrC,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACpD,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,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