scorm-again 3.0.0 → 3.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.
- package/dist/aicc.js.map +1 -0
- package/dist/aicc.min.js.map +1 -0
- package/dist/cross-frame-api.js +26 -11
- package/dist/cross-frame-api.js.map +1 -0
- package/dist/cross-frame-api.min.js +1 -1
- package/dist/cross-frame-api.min.js.map +1 -0
- package/dist/cross-frame-lms.js +16 -4
- package/dist/cross-frame-lms.js.map +1 -0
- package/dist/cross-frame-lms.min.js +1 -1
- package/dist/cross-frame-lms.min.js.map +1 -0
- package/dist/esm/aicc.js.map +1 -0
- package/dist/esm/aicc.min.js.map +1 -0
- package/dist/esm/cross-frame-api.js +115 -108
- package/dist/esm/cross-frame-api.js.map +1 -0
- package/dist/esm/cross-frame-api.min.js +1 -1
- package/dist/esm/cross-frame-api.min.js.map +1 -0
- package/dist/esm/cross-frame-lms.js +32 -30
- package/dist/esm/cross-frame-lms.js.map +1 -0
- package/dist/esm/cross-frame-lms.min.js +1 -1
- package/dist/esm/cross-frame-lms.min.js.map +1 -0
- package/dist/esm/scorm-again.js +804 -506
- package/dist/esm/scorm-again.js.map +1 -0
- package/dist/esm/scorm-again.min.js +1 -1
- package/dist/esm/scorm-again.min.js.map +1 -0
- package/dist/esm/scorm12.js +152 -373
- package/dist/esm/scorm12.js.map +1 -0
- package/dist/esm/scorm12.min.js +1 -1
- package/dist/esm/scorm12.min.js.map +1 -0
- package/dist/esm/scorm2004.js +582 -312
- package/dist/esm/scorm2004.js.map +1 -0
- package/dist/esm/scorm2004.min.js +1 -1
- package/dist/esm/scorm2004.min.js.map +1 -0
- package/dist/scorm-again.js +1205 -334
- package/dist/scorm-again.js.map +1 -0
- package/dist/scorm-again.min.js +1 -1
- package/dist/scorm-again.min.js.map +1 -0
- package/dist/scorm12.js +832 -71
- package/dist/scorm12.js.map +1 -0
- package/dist/scorm12.min.js +1 -1
- package/dist/scorm12.min.js.map +1 -0
- package/dist/scorm2004.js +1078 -292
- package/dist/scorm2004.js.map +1 -0
- package/dist/scorm2004.min.js +1 -1
- package/dist/scorm2004.min.js.map +1 -0
- package/dist/types/BaseAPI.d.ts +3 -3
- package/dist/types/Scorm2004API.d.ts +1 -0
- package/dist/types/cmi/scorm2004/sequencing/handlers/termination_handler.d.ts +2 -2
- package/dist/types/interfaces/services.d.ts +3 -2
- package/dist/types/services/EventService.d.ts +3 -3
- package/package.json +41 -44
package/dist/scorm12.js
CHANGED
|
@@ -3,7 +3,7 @@ this.Scorm12API = (function () {
|
|
|
3
3
|
|
|
4
4
|
const SECONDS_PER_MINUTE = 60;
|
|
5
5
|
const SECONDS_PER_HOUR = 60 * SECONDS_PER_MINUTE;
|
|
6
|
-
const getSecondsAsHHMMSS =
|
|
6
|
+
const getSecondsAsHHMMSS = totalSeconds => {
|
|
7
7
|
if (!totalSeconds || totalSeconds <= 0) {
|
|
8
8
|
return "00:00:00";
|
|
9
9
|
}
|
|
@@ -22,7 +22,7 @@ this.Scorm12API = (function () {
|
|
|
22
22
|
msStr = "." + msStr.split(".")[1];
|
|
23
23
|
}
|
|
24
24
|
return (hours + ":" + minutes + ":" + seconds).replace(/\b\d\b/g, "0$&") + msStr;
|
|
25
|
-
}
|
|
25
|
+
};
|
|
26
26
|
const getTimeAsSeconds = memoize((timeString, timeRegex) => {
|
|
27
27
|
if (typeof timeString === "number" || typeof timeString === "boolean") {
|
|
28
28
|
timeString = String(timeString);
|
|
@@ -161,6 +161,14 @@ this.Scorm12API = (function () {
|
|
|
161
161
|
};
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
+
var __defProp$m = Object.defineProperty;
|
|
165
|
+
var __defNormalProp$m = (obj, key, value) => key in obj ? __defProp$m(obj, key, {
|
|
166
|
+
enumerable: true,
|
|
167
|
+
configurable: true,
|
|
168
|
+
writable: true,
|
|
169
|
+
value
|
|
170
|
+
}) : obj[key] = value;
|
|
171
|
+
var __publicField$m = (obj, key, value) => __defNormalProp$m(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
164
172
|
class BaseCMI {
|
|
165
173
|
/**
|
|
166
174
|
* Constructor for BaseCMI
|
|
@@ -172,8 +180,9 @@ this.Scorm12API = (function () {
|
|
|
172
180
|
* When true, getters can be accessed before the API is initialized, which is necessary
|
|
173
181
|
* for serializing the CMI data structure to JSON format.
|
|
174
182
|
*/
|
|
175
|
-
this
|
|
176
|
-
this
|
|
183
|
+
__publicField$m(this, "jsonString", false);
|
|
184
|
+
__publicField$m(this, "_cmi_element");
|
|
185
|
+
__publicField$m(this, "_initialized", false);
|
|
177
186
|
this._cmi_element = cmi_element;
|
|
178
187
|
}
|
|
179
188
|
/**
|
|
@@ -191,6 +200,10 @@ this.Scorm12API = (function () {
|
|
|
191
200
|
}
|
|
192
201
|
}
|
|
193
202
|
class BaseRootCMI extends BaseCMI {
|
|
203
|
+
constructor() {
|
|
204
|
+
super(...arguments);
|
|
205
|
+
__publicField$m(this, "_start_time");
|
|
206
|
+
}
|
|
194
207
|
/**
|
|
195
208
|
* Start time of the session
|
|
196
209
|
* @type {number | undefined}
|
|
@@ -211,9 +224,18 @@ this.Scorm12API = (function () {
|
|
|
211
224
|
}
|
|
212
225
|
}
|
|
213
226
|
|
|
227
|
+
var __defProp$l = Object.defineProperty;
|
|
228
|
+
var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, {
|
|
229
|
+
enumerable: true,
|
|
230
|
+
configurable: true,
|
|
231
|
+
writable: true,
|
|
232
|
+
value
|
|
233
|
+
}) : obj[key] = value;
|
|
234
|
+
var __publicField$l = (obj, key, value) => __defNormalProp$l(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
214
235
|
class BaseScormValidationError extends Error {
|
|
215
236
|
constructor(CMIElement, errorCode) {
|
|
216
237
|
super(`${CMIElement} : ${errorCode.toString()}`);
|
|
238
|
+
__publicField$l(this, "_errorCode");
|
|
217
239
|
this._errorCode = errorCode;
|
|
218
240
|
Object.setPrototypeOf(this, BaseScormValidationError.prototype);
|
|
219
241
|
}
|
|
@@ -235,7 +257,8 @@ this.Scorm12API = (function () {
|
|
|
235
257
|
*/
|
|
236
258
|
constructor(CMIElement, errorCode, errorMessage, detailedMessage) {
|
|
237
259
|
super(CMIElement, errorCode);
|
|
238
|
-
this
|
|
260
|
+
__publicField$l(this, "_errorMessage");
|
|
261
|
+
__publicField$l(this, "_detailedMessage", "");
|
|
239
262
|
this.message = `${CMIElement} : ${errorMessage}`;
|
|
240
263
|
this._errorMessage = errorMessage;
|
|
241
264
|
if (detailedMessage) {
|
|
@@ -398,6 +421,14 @@ this.Scorm12API = (function () {
|
|
|
398
421
|
DEPENDENCY_NOT_ESTABLISHED: 408
|
|
399
422
|
};
|
|
400
423
|
|
|
424
|
+
var __defProp$k = Object.defineProperty;
|
|
425
|
+
var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, {
|
|
426
|
+
enumerable: true,
|
|
427
|
+
configurable: true,
|
|
428
|
+
writable: true,
|
|
429
|
+
value
|
|
430
|
+
}) : obj[key] = value;
|
|
431
|
+
var __publicField$k = (obj, key, value) => __defNormalProp$k(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
401
432
|
class CMIArray extends BaseCMI {
|
|
402
433
|
/**
|
|
403
434
|
* Constructor cmi *.n arrays
|
|
@@ -405,6 +436,10 @@ this.Scorm12API = (function () {
|
|
|
405
436
|
*/
|
|
406
437
|
constructor(params) {
|
|
407
438
|
super(params.CMIElement);
|
|
439
|
+
__publicField$k(this, "_errorCode");
|
|
440
|
+
__publicField$k(this, "_errorClass");
|
|
441
|
+
__publicField$k(this, "__children");
|
|
442
|
+
__publicField$k(this, "childArray");
|
|
408
443
|
this.__children = params.children;
|
|
409
444
|
this._errorCode = params.errorCode ?? scorm12_errors.GENERAL;
|
|
410
445
|
this._errorClass = params.errorClass || BaseScormValidationError;
|
|
@@ -866,6 +901,14 @@ this.Scorm12API = (function () {
|
|
|
866
901
|
progress_range: "0#1"
|
|
867
902
|
};
|
|
868
903
|
|
|
904
|
+
var __defProp$j = Object.defineProperty;
|
|
905
|
+
var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, {
|
|
906
|
+
enumerable: true,
|
|
907
|
+
configurable: true,
|
|
908
|
+
writable: true,
|
|
909
|
+
value
|
|
910
|
+
}) : obj[key] = value;
|
|
911
|
+
var __publicField$j = (obj, key, value) => __defNormalProp$j(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
869
912
|
class ScheduledCommit {
|
|
870
913
|
/**
|
|
871
914
|
* Constructor for ScheduledCommit
|
|
@@ -874,7 +917,10 @@ this.Scorm12API = (function () {
|
|
|
874
917
|
* @param {string} callback
|
|
875
918
|
*/
|
|
876
919
|
constructor(API, when, callback) {
|
|
877
|
-
this
|
|
920
|
+
__publicField$j(this, "_API");
|
|
921
|
+
__publicField$j(this, "_cancelled", false);
|
|
922
|
+
__publicField$j(this, "_timeout");
|
|
923
|
+
__publicField$j(this, "_callback");
|
|
878
924
|
this._API = API;
|
|
879
925
|
this._timeout = setTimeout(this.wrapper.bind(this), when);
|
|
880
926
|
this._callback = callback;
|
|
@@ -900,6 +946,16 @@ this.Scorm12API = (function () {
|
|
|
900
946
|
}
|
|
901
947
|
}
|
|
902
948
|
|
|
949
|
+
const HIDE_LMS_UI_TOKENS = ["continue", "previous", "exit", "exitAll", "abandon", "abandonAll", "suspendAll"];
|
|
950
|
+
|
|
951
|
+
var __defProp$i = Object.defineProperty;
|
|
952
|
+
var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, {
|
|
953
|
+
enumerable: true,
|
|
954
|
+
configurable: true,
|
|
955
|
+
writable: true,
|
|
956
|
+
value
|
|
957
|
+
}) : obj[key] = value;
|
|
958
|
+
var __publicField$i = (obj, key, value) => __defNormalProp$i(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
903
959
|
const _RuleCondition = class _RuleCondition extends BaseCMI {
|
|
904
960
|
/**
|
|
905
961
|
* Constructor for RuleCondition
|
|
@@ -912,10 +968,10 @@ this.Scorm12API = (function () {
|
|
|
912
968
|
let operator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
913
969
|
let parameters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : /* @__PURE__ */new Map();
|
|
914
970
|
super("ruleCondition");
|
|
915
|
-
this
|
|
916
|
-
this
|
|
917
|
-
this
|
|
918
|
-
this
|
|
971
|
+
__publicField$i(this, "_condition", "always" /* ALWAYS */);
|
|
972
|
+
__publicField$i(this, "_operator", null);
|
|
973
|
+
__publicField$i(this, "_parameters", /* @__PURE__ */new Map());
|
|
974
|
+
__publicField$i(this, "_referencedObjective", null);
|
|
919
975
|
this._condition = condition;
|
|
920
976
|
this._operator = operator;
|
|
921
977
|
this._parameters = parameters;
|
|
@@ -1186,10 +1242,187 @@ this.Scorm12API = (function () {
|
|
|
1186
1242
|
}
|
|
1187
1243
|
};
|
|
1188
1244
|
// Optional, overridable provider for current time (LMS may set via SequencingService)
|
|
1189
|
-
_RuleCondition
|
|
1245
|
+
__publicField$i(_RuleCondition, "_now", () => /* @__PURE__ */new Date());
|
|
1190
1246
|
// Optional, overridable hook for getting elapsed seconds
|
|
1191
|
-
_RuleCondition
|
|
1247
|
+
__publicField$i(_RuleCondition, "_getElapsedSecondsHook");
|
|
1248
|
+
|
|
1249
|
+
var SelectionTiming = /* @__PURE__ */(SelectionTiming2 => {
|
|
1250
|
+
SelectionTiming2["NEVER"] = "never";
|
|
1251
|
+
SelectionTiming2["ONCE"] = "once";
|
|
1252
|
+
SelectionTiming2["ON_EACH_NEW_ATTEMPT"] = "onEachNewAttempt";
|
|
1253
|
+
return SelectionTiming2;
|
|
1254
|
+
})(SelectionTiming || {});
|
|
1255
|
+
var RandomizationTiming = /* @__PURE__ */(RandomizationTiming2 => {
|
|
1256
|
+
RandomizationTiming2["NEVER"] = "never";
|
|
1257
|
+
RandomizationTiming2["ONCE"] = "once";
|
|
1258
|
+
RandomizationTiming2["ON_EACH_NEW_ATTEMPT"] = "onEachNewAttempt";
|
|
1259
|
+
return RandomizationTiming2;
|
|
1260
|
+
})(RandomizationTiming || {});
|
|
1192
1261
|
|
|
1262
|
+
class SelectionRandomization {
|
|
1263
|
+
/**
|
|
1264
|
+
* Select Children Process (SR.1)
|
|
1265
|
+
* Selects a subset of child activities based on selection controls
|
|
1266
|
+
* @param {Activity} activity - The parent activity whose children need to be selected
|
|
1267
|
+
* @return {Activity[]} - The selected child activities
|
|
1268
|
+
*/
|
|
1269
|
+
static selectChildrenProcess(activity) {
|
|
1270
|
+
const controls = activity.sequencingControls;
|
|
1271
|
+
const children = [...activity.children];
|
|
1272
|
+
if (controls.selectionTiming === SelectionTiming.NEVER) {
|
|
1273
|
+
return children;
|
|
1274
|
+
}
|
|
1275
|
+
if (controls.selectionTiming === SelectionTiming.ONCE && controls.selectionCountStatus) {
|
|
1276
|
+
return children;
|
|
1277
|
+
}
|
|
1278
|
+
if (controls.selectionTiming !== SelectionTiming.ONCE && !controls.selectionCountStatus) {
|
|
1279
|
+
return children;
|
|
1280
|
+
}
|
|
1281
|
+
const selectCount = controls.selectCount;
|
|
1282
|
+
if (selectCount === null || selectCount >= children.length) {
|
|
1283
|
+
if (controls.selectionTiming === SelectionTiming.ONCE) {
|
|
1284
|
+
controls.selectionCountStatus = true;
|
|
1285
|
+
}
|
|
1286
|
+
return children;
|
|
1287
|
+
}
|
|
1288
|
+
const selectedChildren = [];
|
|
1289
|
+
const availableIndices = children.map((_, index) => index);
|
|
1290
|
+
for (let i = 0; i < selectCount; i++) {
|
|
1291
|
+
if (availableIndices.length === 0) break;
|
|
1292
|
+
const randomIndex = Math.floor(Math.random() * availableIndices.length);
|
|
1293
|
+
const childIndex = availableIndices[randomIndex];
|
|
1294
|
+
if (childIndex !== void 0 && children[childIndex]) {
|
|
1295
|
+
selectedChildren.push(children[childIndex]);
|
|
1296
|
+
}
|
|
1297
|
+
availableIndices.splice(randomIndex, 1);
|
|
1298
|
+
}
|
|
1299
|
+
if (controls.selectionTiming === SelectionTiming.ONCE) {
|
|
1300
|
+
controls.selectionCountStatus = true;
|
|
1301
|
+
}
|
|
1302
|
+
for (const child of children) {
|
|
1303
|
+
if (!selectedChildren.includes(child)) {
|
|
1304
|
+
child.isHiddenFromChoice = true;
|
|
1305
|
+
child.isAvailable = false;
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
return selectedChildren;
|
|
1309
|
+
}
|
|
1310
|
+
/**
|
|
1311
|
+
* Randomize Children Process (SR.2)
|
|
1312
|
+
* Randomizes the order of child activities based on randomization controls
|
|
1313
|
+
* @param {Activity} activity - The parent activity whose children need to be randomized
|
|
1314
|
+
* @return {Activity[]} - The randomized child activities
|
|
1315
|
+
*/
|
|
1316
|
+
static randomizeChildrenProcess(activity) {
|
|
1317
|
+
const controls = activity.sequencingControls;
|
|
1318
|
+
const children = [...activity.children];
|
|
1319
|
+
if (controls.randomizationTiming === RandomizationTiming.NEVER) {
|
|
1320
|
+
return children;
|
|
1321
|
+
}
|
|
1322
|
+
if (controls.randomizationTiming === RandomizationTiming.ONCE && controls.reorderChildren) {
|
|
1323
|
+
return children;
|
|
1324
|
+
}
|
|
1325
|
+
if (!controls.randomizeChildren) {
|
|
1326
|
+
return children;
|
|
1327
|
+
}
|
|
1328
|
+
const randomizedChildren = [...children];
|
|
1329
|
+
for (let i = randomizedChildren.length - 1; i > 0; i--) {
|
|
1330
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
1331
|
+
const tempI = randomizedChildren[i];
|
|
1332
|
+
const tempJ = randomizedChildren[j];
|
|
1333
|
+
if (tempI && tempJ) {
|
|
1334
|
+
randomizedChildren[i] = tempJ;
|
|
1335
|
+
randomizedChildren[j] = tempI;
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
if (controls.randomizationTiming === RandomizationTiming.ONCE) {
|
|
1339
|
+
controls.reorderChildren = true;
|
|
1340
|
+
}
|
|
1341
|
+
activity.children.length = 0;
|
|
1342
|
+
activity.children.push(...randomizedChildren);
|
|
1343
|
+
return randomizedChildren;
|
|
1344
|
+
}
|
|
1345
|
+
/**
|
|
1346
|
+
* Apply selection and randomization to an activity
|
|
1347
|
+
* This combines both SR.1 and SR.2 processes
|
|
1348
|
+
* @param {Activity} activity - The parent activity
|
|
1349
|
+
* @param {boolean} isNewAttempt - Whether this is a new attempt on the activity
|
|
1350
|
+
* @return {Activity[]} - The processed child activities
|
|
1351
|
+
*/
|
|
1352
|
+
static applySelectionAndRandomization(activity) {
|
|
1353
|
+
let isNewAttempt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
1354
|
+
const controls = activity.sequencingControls;
|
|
1355
|
+
if (!isNewAttempt && (activity.isActive || activity.isSuspended)) {
|
|
1356
|
+
return activity.children;
|
|
1357
|
+
}
|
|
1358
|
+
let shouldApplySelection = false;
|
|
1359
|
+
let shouldApplyRandomization = false;
|
|
1360
|
+
if (controls.selectionTiming === SelectionTiming.ON_EACH_NEW_ATTEMPT) {
|
|
1361
|
+
shouldApplySelection = isNewAttempt;
|
|
1362
|
+
if (isNewAttempt) {
|
|
1363
|
+
controls.selectionCountStatus = true;
|
|
1364
|
+
}
|
|
1365
|
+
} else if (controls.selectionTiming === SelectionTiming.ONCE) {
|
|
1366
|
+
shouldApplySelection = !controls.selectionCountStatus;
|
|
1367
|
+
}
|
|
1368
|
+
if (controls.randomizationTiming === RandomizationTiming.ON_EACH_NEW_ATTEMPT) {
|
|
1369
|
+
shouldApplyRandomization = isNewAttempt;
|
|
1370
|
+
if (isNewAttempt) {
|
|
1371
|
+
controls.reorderChildren = false;
|
|
1372
|
+
}
|
|
1373
|
+
} else if (controls.randomizationTiming === RandomizationTiming.ONCE) {
|
|
1374
|
+
shouldApplyRandomization = !controls.reorderChildren;
|
|
1375
|
+
}
|
|
1376
|
+
if (shouldApplySelection) {
|
|
1377
|
+
this.selectChildrenProcess(activity);
|
|
1378
|
+
}
|
|
1379
|
+
if (shouldApplyRandomization) {
|
|
1380
|
+
this.randomizeChildrenProcess(activity);
|
|
1381
|
+
}
|
|
1382
|
+
const processedChildren = activity.children.filter(child => child.isAvailable);
|
|
1383
|
+
activity.setProcessedChildren(processedChildren);
|
|
1384
|
+
return processedChildren;
|
|
1385
|
+
}
|
|
1386
|
+
/**
|
|
1387
|
+
* Check if selection is needed for an activity
|
|
1388
|
+
* @param {Activity} activity - The activity to check
|
|
1389
|
+
* @return {boolean} - True if selection is needed
|
|
1390
|
+
*/
|
|
1391
|
+
static isSelectionNeeded(activity) {
|
|
1392
|
+
const controls = activity.sequencingControls;
|
|
1393
|
+
if (controls.selectionTiming === SelectionTiming.NEVER) {
|
|
1394
|
+
return false;
|
|
1395
|
+
}
|
|
1396
|
+
if (controls.selectionTiming === SelectionTiming.ONCE && controls.selectionCountStatus) {
|
|
1397
|
+
return false;
|
|
1398
|
+
}
|
|
1399
|
+
return controls.selectCount !== null && controls.selectCount < activity.children.length;
|
|
1400
|
+
}
|
|
1401
|
+
/**
|
|
1402
|
+
* Check if randomization is needed for an activity
|
|
1403
|
+
* @param {Activity} activity - The activity to check
|
|
1404
|
+
* @return {boolean} - True if randomization is needed
|
|
1405
|
+
*/
|
|
1406
|
+
static isRandomizationNeeded(activity) {
|
|
1407
|
+
const controls = activity.sequencingControls;
|
|
1408
|
+
if (controls.randomizationTiming === RandomizationTiming.NEVER) {
|
|
1409
|
+
return false;
|
|
1410
|
+
}
|
|
1411
|
+
if (controls.randomizationTiming === RandomizationTiming.ONCE && controls.reorderChildren) {
|
|
1412
|
+
return false;
|
|
1413
|
+
}
|
|
1414
|
+
return controls.randomizeChildren;
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
var __defProp$h = Object.defineProperty;
|
|
1419
|
+
var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, {
|
|
1420
|
+
enumerable: true,
|
|
1421
|
+
configurable: true,
|
|
1422
|
+
writable: true,
|
|
1423
|
+
value
|
|
1424
|
+
}) : obj[key] = value;
|
|
1425
|
+
var __publicField$h = (obj, key, value) => __defNormalProp$h(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1193
1426
|
class AsynchronousHttpService {
|
|
1194
1427
|
/**
|
|
1195
1428
|
* Constructor for AsynchronousHttpService
|
|
@@ -1197,6 +1430,8 @@ this.Scorm12API = (function () {
|
|
|
1197
1430
|
* @param {ErrorCode} error_codes - The error codes object
|
|
1198
1431
|
*/
|
|
1199
1432
|
constructor(settings, error_codes) {
|
|
1433
|
+
__publicField$h(this, "settings");
|
|
1434
|
+
__publicField$h(this, "error_codes");
|
|
1200
1435
|
this.settings = settings;
|
|
1201
1436
|
this.error_codes = error_codes;
|
|
1202
1437
|
}
|
|
@@ -1388,6 +1623,14 @@ this.Scorm12API = (function () {
|
|
|
1388
1623
|
}
|
|
1389
1624
|
}
|
|
1390
1625
|
|
|
1626
|
+
var __defProp$g = Object.defineProperty;
|
|
1627
|
+
var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, {
|
|
1628
|
+
enumerable: true,
|
|
1629
|
+
configurable: true,
|
|
1630
|
+
writable: true,
|
|
1631
|
+
value
|
|
1632
|
+
}) : obj[key] = value;
|
|
1633
|
+
var __publicField$g = (obj, key, value) => __defNormalProp$g(obj, key + "" , value);
|
|
1391
1634
|
const TARGET_ATTRIBUTE_PREFIX = "{target=";
|
|
1392
1635
|
function getErrorCode(errorCodes, key) {
|
|
1393
1636
|
const code = errorCodes[key];
|
|
@@ -1401,6 +1644,7 @@ this.Scorm12API = (function () {
|
|
|
1401
1644
|
}
|
|
1402
1645
|
class CMIValueAccessService {
|
|
1403
1646
|
constructor(context) {
|
|
1647
|
+
__publicField$g(this, "context");
|
|
1404
1648
|
this.context = context;
|
|
1405
1649
|
}
|
|
1406
1650
|
/**
|
|
@@ -1728,12 +1972,21 @@ this.Scorm12API = (function () {
|
|
|
1728
1972
|
}
|
|
1729
1973
|
}
|
|
1730
1974
|
|
|
1731
|
-
|
|
1975
|
+
var __defProp$f = Object.defineProperty;
|
|
1976
|
+
var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, {
|
|
1977
|
+
enumerable: true,
|
|
1978
|
+
configurable: true,
|
|
1979
|
+
writable: true,
|
|
1980
|
+
value
|
|
1981
|
+
}) : obj[key] = value;
|
|
1982
|
+
var __publicField$f = (obj, key, value) => __defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1983
|
+
const _LoggingService = class _LoggingService {
|
|
1732
1984
|
/**
|
|
1733
1985
|
* Private constructor to prevent direct instantiation
|
|
1734
1986
|
*/
|
|
1735
1987
|
constructor() {
|
|
1736
|
-
this
|
|
1988
|
+
__publicField$f(this, "_logLevel", LogLevelEnum.ERROR);
|
|
1989
|
+
__publicField$f(this, "_logHandler");
|
|
1737
1990
|
this._logHandler = defaultLogHandler;
|
|
1738
1991
|
}
|
|
1739
1992
|
/**
|
|
@@ -1742,10 +1995,10 @@ this.Scorm12API = (function () {
|
|
|
1742
1995
|
* @returns {LoggingService} The singleton instance
|
|
1743
1996
|
*/
|
|
1744
1997
|
static getInstance() {
|
|
1745
|
-
if (!
|
|
1746
|
-
|
|
1998
|
+
if (!_LoggingService._instance) {
|
|
1999
|
+
_LoggingService._instance = new _LoggingService();
|
|
1747
2000
|
}
|
|
1748
|
-
return
|
|
2001
|
+
return _LoggingService._instance;
|
|
1749
2002
|
}
|
|
1750
2003
|
/**
|
|
1751
2004
|
* Set the log level
|
|
@@ -1881,11 +2134,21 @@ this.Scorm12API = (function () {
|
|
|
1881
2134
|
return LogLevelEnum.ERROR;
|
|
1882
2135
|
}
|
|
1883
2136
|
}
|
|
1884
|
-
}
|
|
2137
|
+
};
|
|
2138
|
+
__publicField$f(_LoggingService, "_instance");
|
|
2139
|
+
let LoggingService = _LoggingService;
|
|
1885
2140
|
function getLoggingService() {
|
|
1886
2141
|
return LoggingService.getInstance();
|
|
1887
2142
|
}
|
|
1888
2143
|
|
|
2144
|
+
var __defProp$e = Object.defineProperty;
|
|
2145
|
+
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, {
|
|
2146
|
+
enumerable: true,
|
|
2147
|
+
configurable: true,
|
|
2148
|
+
writable: true,
|
|
2149
|
+
value
|
|
2150
|
+
}) : obj[key] = value;
|
|
2151
|
+
var __publicField$e = (obj, key, value) => __defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1889
2152
|
class ErrorHandlingService {
|
|
1890
2153
|
/**
|
|
1891
2154
|
* Constructor for ErrorHandlingService
|
|
@@ -1896,8 +2159,12 @@ this.Scorm12API = (function () {
|
|
|
1896
2159
|
* @param {ILoggingService} loggingService - Optional logging service instance
|
|
1897
2160
|
*/
|
|
1898
2161
|
constructor(errorCodes, apiLog, getLmsErrorMessageDetails, loggingService) {
|
|
1899
|
-
this
|
|
1900
|
-
this
|
|
2162
|
+
__publicField$e(this, "_lastErrorCode", "0");
|
|
2163
|
+
__publicField$e(this, "_lastDiagnostic", "");
|
|
2164
|
+
__publicField$e(this, "_errorCodes");
|
|
2165
|
+
__publicField$e(this, "_apiLog");
|
|
2166
|
+
__publicField$e(this, "_getLmsErrorMessageDetails");
|
|
2167
|
+
__publicField$e(this, "_loggingService");
|
|
1901
2168
|
this._errorCodes = errorCodes;
|
|
1902
2169
|
this._apiLog = apiLog;
|
|
1903
2170
|
this._getLmsErrorMessageDetails = getLmsErrorMessageDetails;
|
|
@@ -2039,6 +2306,14 @@ ${stackTrace}`);
|
|
|
2039
2306
|
return new ErrorHandlingService(errorCodes, apiLog, getLmsErrorMessageDetails, loggingService);
|
|
2040
2307
|
}
|
|
2041
2308
|
|
|
2309
|
+
var __defProp$d = Object.defineProperty;
|
|
2310
|
+
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, {
|
|
2311
|
+
enumerable: true,
|
|
2312
|
+
configurable: true,
|
|
2313
|
+
writable: true,
|
|
2314
|
+
value
|
|
2315
|
+
}) : obj[key] = value;
|
|
2316
|
+
var __publicField$d = (obj, key, value) => __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2042
2317
|
class EventService {
|
|
2043
2318
|
/**
|
|
2044
2319
|
* Constructor for EventService
|
|
@@ -2046,9 +2321,11 @@ ${stackTrace}`);
|
|
|
2046
2321
|
*/
|
|
2047
2322
|
constructor(apiLog) {
|
|
2048
2323
|
// Map of function names to listeners for faster lookups
|
|
2049
|
-
this
|
|
2324
|
+
__publicField$d(this, "listenerMap", /* @__PURE__ */new Map());
|
|
2050
2325
|
// Total count of listeners for logging
|
|
2051
|
-
this
|
|
2326
|
+
__publicField$d(this, "listenerCount", 0);
|
|
2327
|
+
// Function to log API messages
|
|
2328
|
+
__publicField$d(this, "apiLog");
|
|
2052
2329
|
this.apiLog = apiLog;
|
|
2053
2330
|
}
|
|
2054
2331
|
/**
|
|
@@ -2202,6 +2479,14 @@ ${stackTrace}`);
|
|
|
2202
2479
|
}
|
|
2203
2480
|
}
|
|
2204
2481
|
|
|
2482
|
+
var __defProp$c = Object.defineProperty;
|
|
2483
|
+
var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, {
|
|
2484
|
+
enumerable: true,
|
|
2485
|
+
configurable: true,
|
|
2486
|
+
writable: true,
|
|
2487
|
+
value
|
|
2488
|
+
}) : obj[key] = value;
|
|
2489
|
+
var __publicField$c = (obj, key, value) => __defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2205
2490
|
class OfflineStorageService {
|
|
2206
2491
|
/**
|
|
2207
2492
|
* Constructor for OfflineStorageService
|
|
@@ -2211,10 +2496,14 @@ ${stackTrace}`);
|
|
|
2211
2496
|
*/
|
|
2212
2497
|
constructor(settings, error_codes, apiLog) {
|
|
2213
2498
|
this.apiLog = apiLog;
|
|
2214
|
-
this
|
|
2215
|
-
this
|
|
2216
|
-
this
|
|
2217
|
-
this
|
|
2499
|
+
__publicField$c(this, "settings");
|
|
2500
|
+
__publicField$c(this, "error_codes");
|
|
2501
|
+
__publicField$c(this, "storeName", "scorm_again_offline_data");
|
|
2502
|
+
__publicField$c(this, "syncQueue", "scorm_again_sync_queue");
|
|
2503
|
+
__publicField$c(this, "isOnline", navigator.onLine);
|
|
2504
|
+
__publicField$c(this, "syncInProgress", false);
|
|
2505
|
+
__publicField$c(this, "boundOnlineStatusChangeHandler");
|
|
2506
|
+
__publicField$c(this, "boundCustomNetworkStatusHandler");
|
|
2218
2507
|
this.settings = settings;
|
|
2219
2508
|
this.error_codes = error_codes;
|
|
2220
2509
|
this.boundOnlineStatusChangeHandler = this.handleOnlineStatusChange.bind(this);
|
|
@@ -2458,7 +2747,9 @@ ${stackTrace}`);
|
|
|
2458
2747
|
localStorage.setItem(key, JSON.stringify(data));
|
|
2459
2748
|
} catch (error) {
|
|
2460
2749
|
if (error instanceof DOMException && error.name === "QuotaExceededError") {
|
|
2461
|
-
throw new Error("storage quota exceeded - localStorage is full"
|
|
2750
|
+
throw new Error("storage quota exceeded - localStorage is full", {
|
|
2751
|
+
cause: error
|
|
2752
|
+
});
|
|
2462
2753
|
}
|
|
2463
2754
|
throw error;
|
|
2464
2755
|
}
|
|
@@ -2532,6 +2823,341 @@ ${stackTrace}`);
|
|
|
2532
2823
|
// since it can't be stringified and doesn't affect the validation result
|
|
2533
2824
|
(CMIElement, value, rangePattern, errorCode, _errorClass) => `${CMIElement}:${value}:${rangePattern}:${errorCode}`);
|
|
2534
2825
|
|
|
2826
|
+
var __defProp$b = Object.defineProperty;
|
|
2827
|
+
var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, {
|
|
2828
|
+
enumerable: true,
|
|
2829
|
+
configurable: true,
|
|
2830
|
+
writable: true,
|
|
2831
|
+
value
|
|
2832
|
+
}) : obj[key] = value;
|
|
2833
|
+
var __publicField$b = (obj, key, value) => __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2834
|
+
class DeliveryRequest {
|
|
2835
|
+
constructor() {
|
|
2836
|
+
let valid = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
2837
|
+
let targetActivity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2838
|
+
let exception = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
2839
|
+
__publicField$b(this, "valid");
|
|
2840
|
+
__publicField$b(this, "targetActivity");
|
|
2841
|
+
__publicField$b(this, "exception");
|
|
2842
|
+
this.valid = valid;
|
|
2843
|
+
this.targetActivity = targetActivity;
|
|
2844
|
+
this.exception = exception;
|
|
2845
|
+
}
|
|
2846
|
+
}
|
|
2847
|
+
const _DeliveryHandler = class _DeliveryHandler {
|
|
2848
|
+
constructor(activityTree, rollupProcess, globalObjectiveMap) {
|
|
2849
|
+
let adlNav = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
2850
|
+
let eventCallback = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
2851
|
+
let options = arguments.length > 5 ? arguments[5] : undefined;
|
|
2852
|
+
__publicField$b(this, "activityTree");
|
|
2853
|
+
__publicField$b(this, "rollupProcess");
|
|
2854
|
+
__publicField$b(this, "globalObjectiveMap");
|
|
2855
|
+
__publicField$b(this, "adlNav");
|
|
2856
|
+
__publicField$b(this, "eventCallback");
|
|
2857
|
+
__publicField$b(this, "now");
|
|
2858
|
+
__publicField$b(this, "defaultHideLmsUi");
|
|
2859
|
+
__publicField$b(this, "defaultAuxiliaryResources");
|
|
2860
|
+
__publicField$b(this, "_deliveryInProgress", false);
|
|
2861
|
+
__publicField$b(this, "contentDelivered", false);
|
|
2862
|
+
__publicField$b(this, "checkActivityCallback", null);
|
|
2863
|
+
__publicField$b(this, "invalidateCacheCallback", null);
|
|
2864
|
+
__publicField$b(this, "updateNavigationValidityCallback", null);
|
|
2865
|
+
__publicField$b(this, "clearSuspendedActivityCallback", null);
|
|
2866
|
+
this.activityTree = activityTree;
|
|
2867
|
+
this.rollupProcess = rollupProcess;
|
|
2868
|
+
this.globalObjectiveMap = globalObjectiveMap;
|
|
2869
|
+
this.adlNav = adlNav;
|
|
2870
|
+
this.eventCallback = eventCallback;
|
|
2871
|
+
this.now = options?.now || (() => /* @__PURE__ */new Date());
|
|
2872
|
+
this.defaultHideLmsUi = options?.defaultHideLmsUi ? [...options.defaultHideLmsUi] : [];
|
|
2873
|
+
this.defaultAuxiliaryResources = options?.defaultAuxiliaryResources ? options.defaultAuxiliaryResources.map(resource => ({
|
|
2874
|
+
...resource
|
|
2875
|
+
})) : [];
|
|
2876
|
+
}
|
|
2877
|
+
/**
|
|
2878
|
+
* Set callback to check activity validity
|
|
2879
|
+
*/
|
|
2880
|
+
setCheckActivityCallback(callback) {
|
|
2881
|
+
this.checkActivityCallback = callback;
|
|
2882
|
+
}
|
|
2883
|
+
/**
|
|
2884
|
+
* Set callback to invalidate navigation cache after state changes
|
|
2885
|
+
*/
|
|
2886
|
+
setInvalidateCacheCallback(callback) {
|
|
2887
|
+
this.invalidateCacheCallback = callback;
|
|
2888
|
+
}
|
|
2889
|
+
/**
|
|
2890
|
+
* Set callback to update navigation validity
|
|
2891
|
+
*/
|
|
2892
|
+
setUpdateNavigationValidityCallback(callback) {
|
|
2893
|
+
this.updateNavigationValidityCallback = callback;
|
|
2894
|
+
}
|
|
2895
|
+
/**
|
|
2896
|
+
* Set callback to clear suspended activity
|
|
2897
|
+
*/
|
|
2898
|
+
setClearSuspendedActivityCallback(callback) {
|
|
2899
|
+
this.clearSuspendedActivityCallback = callback;
|
|
2900
|
+
}
|
|
2901
|
+
/**
|
|
2902
|
+
* Check if content delivery is currently in progress
|
|
2903
|
+
* Used to prevent re-entrant termination requests during delivery
|
|
2904
|
+
*/
|
|
2905
|
+
isDeliveryInProgress() {
|
|
2906
|
+
return this._deliveryInProgress;
|
|
2907
|
+
}
|
|
2908
|
+
/**
|
|
2909
|
+
* Check if content has been delivered
|
|
2910
|
+
*/
|
|
2911
|
+
hasContentBeenDelivered() {
|
|
2912
|
+
return this.contentDelivered;
|
|
2913
|
+
}
|
|
2914
|
+
/**
|
|
2915
|
+
* Reset content delivered flag
|
|
2916
|
+
*/
|
|
2917
|
+
resetContentDelivered() {
|
|
2918
|
+
this.contentDelivered = false;
|
|
2919
|
+
}
|
|
2920
|
+
/**
|
|
2921
|
+
* Set content delivered flag
|
|
2922
|
+
* @param {boolean} value - The value to set
|
|
2923
|
+
*/
|
|
2924
|
+
setContentDelivered(value) {
|
|
2925
|
+
this.contentDelivered = value;
|
|
2926
|
+
}
|
|
2927
|
+
/**
|
|
2928
|
+
* Delivery Request Process
|
|
2929
|
+
* Validates if an activity can be delivered
|
|
2930
|
+
* @spec SN Book: DB.1.1 (Delivery Request Process)
|
|
2931
|
+
* @param {Activity} activity - The activity to deliver
|
|
2932
|
+
* @return {DeliveryRequest} - The delivery validation result
|
|
2933
|
+
*/
|
|
2934
|
+
processDeliveryRequest(activity) {
|
|
2935
|
+
this.fireEvent("onDeliveryRequestProcessing", {
|
|
2936
|
+
activity: activity.id,
|
|
2937
|
+
timestamp: (/* @__PURE__ */new Date()).toISOString()
|
|
2938
|
+
});
|
|
2939
|
+
if (activity.children.length > 0) {
|
|
2940
|
+
return new DeliveryRequest(false, null, "DB.1.1-1");
|
|
2941
|
+
}
|
|
2942
|
+
const activityPath = this.getActivityPath(activity, true);
|
|
2943
|
+
if (activityPath.length === 0) {
|
|
2944
|
+
return new DeliveryRequest(false, null, "DB.1.1-2");
|
|
2945
|
+
}
|
|
2946
|
+
for (const pathActivity of activityPath) {
|
|
2947
|
+
const checkResult = this.checkActivityCallback ? this.checkActivityCallback(pathActivity) : true;
|
|
2948
|
+
if (!checkResult) {
|
|
2949
|
+
return new DeliveryRequest(false, null, "DB.1.1-3");
|
|
2950
|
+
}
|
|
2951
|
+
}
|
|
2952
|
+
return new DeliveryRequest(true, activity);
|
|
2953
|
+
}
|
|
2954
|
+
/**
|
|
2955
|
+
* Content Delivery Environment Process
|
|
2956
|
+
* Handles the delivery of content to the learner
|
|
2957
|
+
* @spec SN Book: DB.2 (Content Delivery Environment Process)
|
|
2958
|
+
* @param {Activity} activity - The activity to deliver
|
|
2959
|
+
*/
|
|
2960
|
+
contentDeliveryEnvironmentProcess(activity) {
|
|
2961
|
+
this._deliveryInProgress = true;
|
|
2962
|
+
try {
|
|
2963
|
+
const isResuming = activity.isSuspended;
|
|
2964
|
+
if (this.activityTree.suspendedActivity) {
|
|
2965
|
+
if (this.clearSuspendedActivityCallback) {
|
|
2966
|
+
this.clearSuspendedActivityCallback();
|
|
2967
|
+
}
|
|
2968
|
+
}
|
|
2969
|
+
const activityPath = this.getActivityPath(activity, true);
|
|
2970
|
+
for (const pathActivity of activityPath) {
|
|
2971
|
+
if (!pathActivity.isActive) {
|
|
2972
|
+
if (isResuming || pathActivity.isSuspended) {
|
|
2973
|
+
pathActivity.isSuspended = false;
|
|
2974
|
+
} else {
|
|
2975
|
+
pathActivity.incrementAttemptCount();
|
|
2976
|
+
}
|
|
2977
|
+
pathActivity.isActive = true;
|
|
2978
|
+
SelectionRandomization.applySelectionAndRandomization(pathActivity, pathActivity.attemptCount <= 1);
|
|
2979
|
+
}
|
|
2980
|
+
}
|
|
2981
|
+
this.activityTree.currentActivity = activity;
|
|
2982
|
+
this.initializeForDelivery(activity);
|
|
2983
|
+
this.setupAttemptTracking(activity);
|
|
2984
|
+
this.contentDelivered = true;
|
|
2985
|
+
if (this.adlNav && this.updateNavigationValidityCallback) {
|
|
2986
|
+
this.updateNavigationValidityCallback();
|
|
2987
|
+
}
|
|
2988
|
+
this.fireDeliveryEvent(activity);
|
|
2989
|
+
} finally {
|
|
2990
|
+
this._deliveryInProgress = false;
|
|
2991
|
+
}
|
|
2992
|
+
}
|
|
2993
|
+
/**
|
|
2994
|
+
* Initialize Activity For Delivery (DB.2.2)
|
|
2995
|
+
* Set up initial tracking states for a delivered activity
|
|
2996
|
+
* @param {Activity} activity - The activity being delivered
|
|
2997
|
+
*/
|
|
2998
|
+
initializeForDelivery(activity) {
|
|
2999
|
+
if (activity.completionStatus === "unknown") {
|
|
3000
|
+
if (activity.children.length === 0) {
|
|
3001
|
+
activity.completionStatus = "not attempted";
|
|
3002
|
+
}
|
|
3003
|
+
}
|
|
3004
|
+
if (activity.objectiveSatisfiedStatus === null) {
|
|
3005
|
+
activity.objectiveSatisfiedStatus = false;
|
|
3006
|
+
}
|
|
3007
|
+
if (activity.progressMeasure === null) {
|
|
3008
|
+
activity.progressMeasure = 0;
|
|
3009
|
+
activity.progressMeasureStatus = false;
|
|
3010
|
+
}
|
|
3011
|
+
if (activity.objectiveNormalizedMeasure === null) {
|
|
3012
|
+
activity.objectiveNormalizedMeasure = 0;
|
|
3013
|
+
activity.objectiveMeasureStatus = false;
|
|
3014
|
+
}
|
|
3015
|
+
activity.attemptAbsoluteDuration = "PT0H0M0S";
|
|
3016
|
+
activity.attemptExperiencedDuration = "PT0H0M0S";
|
|
3017
|
+
activity.isAvailable = true;
|
|
3018
|
+
}
|
|
3019
|
+
/**
|
|
3020
|
+
* Setup Activity Attempt Tracking
|
|
3021
|
+
* Initialize attempt tracking information per SCORM 2004 4th Edition
|
|
3022
|
+
* @param {Activity} activity - The activity being delivered
|
|
3023
|
+
*/
|
|
3024
|
+
setupAttemptTracking(activity) {
|
|
3025
|
+
activity.wasSkipped = false;
|
|
3026
|
+
activity.attemptAbsoluteStartTime = this.now().toISOString();
|
|
3027
|
+
if (!activity.location) {
|
|
3028
|
+
activity.location = "";
|
|
3029
|
+
}
|
|
3030
|
+
activity.activityAttemptActive = true;
|
|
3031
|
+
if (!activity.learnerPrefs) {
|
|
3032
|
+
activity.learnerPrefs = {
|
|
3033
|
+
audioCaptioning: "0",
|
|
3034
|
+
audioLevel: "1",
|
|
3035
|
+
deliverySpeed: "1",
|
|
3036
|
+
language: ""
|
|
3037
|
+
};
|
|
3038
|
+
}
|
|
3039
|
+
}
|
|
3040
|
+
/**
|
|
3041
|
+
* Fire Activity Delivery Event
|
|
3042
|
+
* Notify listeners that an activity has been delivered
|
|
3043
|
+
* @param {Activity} activity - The activity that was delivered
|
|
3044
|
+
*/
|
|
3045
|
+
fireDeliveryEvent(activity) {
|
|
3046
|
+
try {
|
|
3047
|
+
if (this.eventCallback) {
|
|
3048
|
+
this.eventCallback("onActivityDelivery", activity);
|
|
3049
|
+
}
|
|
3050
|
+
console.debug(`Activity delivered: ${activity.id} - ${activity.title}`);
|
|
3051
|
+
} catch (error) {
|
|
3052
|
+
console.warn(`Failed to fire activity delivery event: ${error}`);
|
|
3053
|
+
}
|
|
3054
|
+
}
|
|
3055
|
+
/**
|
|
3056
|
+
* Get effective hideLmsUi for an activity
|
|
3057
|
+
* Merges default and activity-specific hideLmsUi directives
|
|
3058
|
+
* @param {Activity | null} activity - The activity
|
|
3059
|
+
* @return {HideLmsUiItem[]} - Ordered list of hideLmsUi directives
|
|
3060
|
+
*/
|
|
3061
|
+
getEffectiveHideLmsUi(activity) {
|
|
3062
|
+
const seen = /* @__PURE__ */new Set();
|
|
3063
|
+
for (const directive of this.defaultHideLmsUi) {
|
|
3064
|
+
seen.add(directive);
|
|
3065
|
+
}
|
|
3066
|
+
let current = activity;
|
|
3067
|
+
while (current) {
|
|
3068
|
+
for (const directive of current.hideLmsUi) {
|
|
3069
|
+
seen.add(directive);
|
|
3070
|
+
}
|
|
3071
|
+
current = current.parent;
|
|
3072
|
+
}
|
|
3073
|
+
return _DeliveryHandler.HIDE_LMS_UI_ORDER.filter(directive => seen.has(directive));
|
|
3074
|
+
}
|
|
3075
|
+
/**
|
|
3076
|
+
* Get effective auxiliary resources for an activity
|
|
3077
|
+
* Merges default and activity-specific resources
|
|
3078
|
+
* @param {Activity | null} activity - The activity
|
|
3079
|
+
* @return {AuxiliaryResource[]} - Merged auxiliary resources
|
|
3080
|
+
*/
|
|
3081
|
+
getEffectiveAuxiliaryResources(activity) {
|
|
3082
|
+
const merged = /* @__PURE__ */new Map();
|
|
3083
|
+
for (const resource of this.defaultAuxiliaryResources) {
|
|
3084
|
+
if (resource.resourceId) {
|
|
3085
|
+
merged.set(resource.resourceId, {
|
|
3086
|
+
...resource
|
|
3087
|
+
});
|
|
3088
|
+
}
|
|
3089
|
+
}
|
|
3090
|
+
const lineage = [];
|
|
3091
|
+
let current = activity;
|
|
3092
|
+
while (current) {
|
|
3093
|
+
lineage.push(current);
|
|
3094
|
+
current = current.parent;
|
|
3095
|
+
}
|
|
3096
|
+
for (const node of lineage.reverse()) {
|
|
3097
|
+
for (const resource of node.auxiliaryResources) {
|
|
3098
|
+
if (resource.resourceId) {
|
|
3099
|
+
merged.set(resource.resourceId, {
|
|
3100
|
+
...resource
|
|
3101
|
+
});
|
|
3102
|
+
}
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3105
|
+
return Array.from(merged.values());
|
|
3106
|
+
}
|
|
3107
|
+
/**
|
|
3108
|
+
* Get content activity data for a delivered activity
|
|
3109
|
+
* @param {Activity} activity - The activity
|
|
3110
|
+
* @return {ContentActivityData} - Content activity data
|
|
3111
|
+
*/
|
|
3112
|
+
getContentActivityData(activity) {
|
|
3113
|
+
return {
|
|
3114
|
+
hideLmsUi: this.getEffectiveHideLmsUi(activity),
|
|
3115
|
+
auxiliaryResources: this.getEffectiveAuxiliaryResources(activity),
|
|
3116
|
+
location: activity.location || "",
|
|
3117
|
+
credit: activity.credit || "credit",
|
|
3118
|
+
launchData: activity.launchData || "",
|
|
3119
|
+
maxTimeAllowed: activity.attemptAbsoluteDurationLimit || "",
|
|
3120
|
+
completionThreshold: activity.completionThreshold?.toString() || "",
|
|
3121
|
+
timeLimitAction: activity.timeLimitAction || "continue,no message"
|
|
3122
|
+
};
|
|
3123
|
+
}
|
|
3124
|
+
/**
|
|
3125
|
+
* Get Activity Path (Helper for DB.1.1)
|
|
3126
|
+
* Forms the activity path from root to target activity, inclusive
|
|
3127
|
+
* @param {Activity} activity - The target activity
|
|
3128
|
+
* @param {boolean} includeActivity - Whether to include the target in the path
|
|
3129
|
+
* @return {Activity[]} - Array of activities from root to target
|
|
3130
|
+
*/
|
|
3131
|
+
getActivityPath(activity) {
|
|
3132
|
+
let includeActivity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
3133
|
+
const path = [];
|
|
3134
|
+
let current = activity;
|
|
3135
|
+
while (current !== null) {
|
|
3136
|
+
path.unshift(current);
|
|
3137
|
+
current = current.parent;
|
|
3138
|
+
}
|
|
3139
|
+
if (!includeActivity && path.length > 0) {
|
|
3140
|
+
path.pop();
|
|
3141
|
+
}
|
|
3142
|
+
return path;
|
|
3143
|
+
}
|
|
3144
|
+
/**
|
|
3145
|
+
* Fire a sequencing event
|
|
3146
|
+
* @param {string} eventType - The type of event
|
|
3147
|
+
* @param {any} data - Event data
|
|
3148
|
+
*/
|
|
3149
|
+
fireEvent(eventType, data) {
|
|
3150
|
+
try {
|
|
3151
|
+
if (this.eventCallback) {
|
|
3152
|
+
this.eventCallback(eventType, data);
|
|
3153
|
+
}
|
|
3154
|
+
} catch (error) {
|
|
3155
|
+
console.warn(`Failed to fire sequencing event ${eventType}: ${error}`);
|
|
3156
|
+
}
|
|
3157
|
+
}
|
|
3158
|
+
};
|
|
3159
|
+
__publicField$b(_DeliveryHandler, "HIDE_LMS_UI_ORDER", [...HIDE_LMS_UI_TOKENS]);
|
|
3160
|
+
|
|
2535
3161
|
class SerializationService {
|
|
2536
3162
|
/**
|
|
2537
3163
|
* Loads CMI data from a flattened JSON object with special handling for arrays and ordering.
|
|
@@ -2768,6 +3394,14 @@ ${stackTrace}`);
|
|
|
2768
3394
|
}
|
|
2769
3395
|
}
|
|
2770
3396
|
|
|
3397
|
+
var __defProp$a = Object.defineProperty;
|
|
3398
|
+
var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, {
|
|
3399
|
+
enumerable: true,
|
|
3400
|
+
configurable: true,
|
|
3401
|
+
writable: true,
|
|
3402
|
+
value
|
|
3403
|
+
}) : obj[key] = value;
|
|
3404
|
+
var __publicField$a = (obj, key, value) => __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2771
3405
|
class SynchronousHttpService {
|
|
2772
3406
|
/**
|
|
2773
3407
|
* Constructor for SynchronousHttpService
|
|
@@ -2775,6 +3409,8 @@ ${stackTrace}`);
|
|
|
2775
3409
|
* @param {ErrorCode} error_codes - The error codes object
|
|
2776
3410
|
*/
|
|
2777
3411
|
constructor(settings, error_codes) {
|
|
3412
|
+
__publicField$a(this, "settings");
|
|
3413
|
+
__publicField$a(this, "error_codes");
|
|
2778
3414
|
this.settings = settings;
|
|
2779
3415
|
this.error_codes = error_codes;
|
|
2780
3416
|
}
|
|
@@ -2966,6 +3602,14 @@ ${stackTrace}`);
|
|
|
2966
3602
|
}
|
|
2967
3603
|
const validationService = new ValidationService();
|
|
2968
3604
|
|
|
3605
|
+
var __defProp$9 = Object.defineProperty;
|
|
3606
|
+
var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, {
|
|
3607
|
+
enumerable: true,
|
|
3608
|
+
configurable: true,
|
|
3609
|
+
writable: true,
|
|
3610
|
+
value
|
|
3611
|
+
}) : obj[key] = value;
|
|
3612
|
+
var __publicField$9 = (obj, key, value) => __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
2969
3613
|
class BaseAPI {
|
|
2970
3614
|
/**
|
|
2971
3615
|
* Constructor for Base API class. Sets some shared API fields, as well as
|
|
@@ -2981,8 +3625,19 @@ ${stackTrace}`);
|
|
|
2981
3625
|
* @param {IOfflineStorageService} offlineStorageService - Optional Offline Storage service instance
|
|
2982
3626
|
*/
|
|
2983
3627
|
constructor(error_codes, settings, httpService, eventService, serializationService, cmiDataService, errorHandlingService, loggingService, offlineStorageService) {
|
|
2984
|
-
this
|
|
2985
|
-
this
|
|
3628
|
+
__publicField$9(this, "_timeout");
|
|
3629
|
+
__publicField$9(this, "_error_codes");
|
|
3630
|
+
__publicField$9(this, "_settings", DefaultSettings);
|
|
3631
|
+
__publicField$9(this, "_httpService");
|
|
3632
|
+
__publicField$9(this, "_eventService");
|
|
3633
|
+
__publicField$9(this, "_serializationService");
|
|
3634
|
+
__publicField$9(this, "_errorHandlingService");
|
|
3635
|
+
__publicField$9(this, "_loggingService");
|
|
3636
|
+
__publicField$9(this, "_offlineStorageService");
|
|
3637
|
+
__publicField$9(this, "_cmiValueAccessService");
|
|
3638
|
+
__publicField$9(this, "_courseId", "");
|
|
3639
|
+
__publicField$9(this, "startingData");
|
|
3640
|
+
__publicField$9(this, "currentState");
|
|
2986
3641
|
if (new.target === BaseAPI) {
|
|
2987
3642
|
throw new TypeError("Cannot construct BaseAPI instances directly");
|
|
2988
3643
|
}
|
|
@@ -3933,6 +4588,14 @@ ${stackTrace}`);
|
|
|
3933
4588
|
}
|
|
3934
4589
|
}
|
|
3935
4590
|
|
|
4591
|
+
var __defProp$8 = Object.defineProperty;
|
|
4592
|
+
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, {
|
|
4593
|
+
enumerable: true,
|
|
4594
|
+
configurable: true,
|
|
4595
|
+
writable: true,
|
|
4596
|
+
value
|
|
4597
|
+
}) : obj[key] = value;
|
|
4598
|
+
var __publicField$8 = (obj, key, value) => __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
3936
4599
|
class CMIScore extends BaseCMI {
|
|
3937
4600
|
/**
|
|
3938
4601
|
* Constructor for *.score
|
|
@@ -3957,8 +4620,21 @@ ${stackTrace}`);
|
|
|
3957
4620
|
*/
|
|
3958
4621
|
constructor(params) {
|
|
3959
4622
|
super(params.CMIElement);
|
|
3960
|
-
this
|
|
3961
|
-
|
|
4623
|
+
__publicField$8(this, "__children");
|
|
4624
|
+
/**
|
|
4625
|
+
* Score range validation pattern (e.g., "0#100" for SCORM 1.2).
|
|
4626
|
+
* Set to `false` to disable range validation (e.g., for SCORM 2004 where scores have no upper bound).
|
|
4627
|
+
* This property is intentionally unused in the base class but provides subclass flexibility.
|
|
4628
|
+
*/
|
|
4629
|
+
__publicField$8(this, "__score_range");
|
|
4630
|
+
__publicField$8(this, "__invalid_error_code");
|
|
4631
|
+
__publicField$8(this, "__invalid_type_code");
|
|
4632
|
+
__publicField$8(this, "__invalid_range_code");
|
|
4633
|
+
__publicField$8(this, "__decimal_regex");
|
|
4634
|
+
__publicField$8(this, "__error_class");
|
|
4635
|
+
__publicField$8(this, "_raw", "");
|
|
4636
|
+
__publicField$8(this, "_min", "");
|
|
4637
|
+
__publicField$8(this, "_max");
|
|
3962
4638
|
this.__children = params.score_children || scorm12_constants.score_children;
|
|
3963
4639
|
this.__score_range = !params.score_range ? false : scorm12_regex.score_range;
|
|
3964
4640
|
this._max = params.max || params.max === "" ? params.max : "100";
|
|
@@ -4081,24 +4757,33 @@ ${stackTrace}`);
|
|
|
4081
4757
|
}
|
|
4082
4758
|
}
|
|
4083
4759
|
|
|
4760
|
+
var __defProp$7 = Object.defineProperty;
|
|
4761
|
+
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, {
|
|
4762
|
+
enumerable: true,
|
|
4763
|
+
configurable: true,
|
|
4764
|
+
writable: true,
|
|
4765
|
+
value
|
|
4766
|
+
}) : obj[key] = value;
|
|
4767
|
+
var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4084
4768
|
class CMICore extends BaseCMI {
|
|
4085
4769
|
/**
|
|
4086
4770
|
* Constructor for `cmi.core`
|
|
4087
4771
|
*/
|
|
4088
4772
|
constructor() {
|
|
4089
4773
|
super("cmi.core");
|
|
4090
|
-
this
|
|
4091
|
-
this
|
|
4092
|
-
this
|
|
4093
|
-
this
|
|
4094
|
-
this
|
|
4095
|
-
this
|
|
4096
|
-
this
|
|
4097
|
-
this
|
|
4098
|
-
this
|
|
4099
|
-
this
|
|
4100
|
-
this
|
|
4101
|
-
this
|
|
4774
|
+
__publicField$7(this, "score");
|
|
4775
|
+
__publicField$7(this, "__children", scorm12_constants.core_children);
|
|
4776
|
+
__publicField$7(this, "_student_id", "");
|
|
4777
|
+
__publicField$7(this, "_student_name", "");
|
|
4778
|
+
__publicField$7(this, "_lesson_location", "");
|
|
4779
|
+
__publicField$7(this, "_credit", "");
|
|
4780
|
+
__publicField$7(this, "_lesson_status", "not attempted");
|
|
4781
|
+
__publicField$7(this, "_entry", "");
|
|
4782
|
+
__publicField$7(this, "_total_time", "");
|
|
4783
|
+
__publicField$7(this, "_lesson_mode", "normal");
|
|
4784
|
+
__publicField$7(this, "_exit", "");
|
|
4785
|
+
__publicField$7(this, "_session_time", "00:00:00");
|
|
4786
|
+
__publicField$7(this, "_suspend_data", "");
|
|
4102
4787
|
this.score = new CMIScore({
|
|
4103
4788
|
CMIElement: "cmi.core.score",
|
|
4104
4789
|
score_children: scorm12_constants.score_children,
|
|
@@ -4437,6 +5122,14 @@ ${stackTrace}`);
|
|
|
4437
5122
|
}
|
|
4438
5123
|
}
|
|
4439
5124
|
|
|
5125
|
+
var __defProp$6 = Object.defineProperty;
|
|
5126
|
+
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, {
|
|
5127
|
+
enumerable: true,
|
|
5128
|
+
configurable: true,
|
|
5129
|
+
writable: true,
|
|
5130
|
+
value
|
|
5131
|
+
}) : obj[key] = value;
|
|
5132
|
+
var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4440
5133
|
class CMIObjectives extends CMIArray {
|
|
4441
5134
|
/**
|
|
4442
5135
|
* Constructor for `cmi.objectives`
|
|
@@ -4456,8 +5149,9 @@ ${stackTrace}`);
|
|
|
4456
5149
|
*/
|
|
4457
5150
|
constructor() {
|
|
4458
5151
|
super("cmi.objectives.n");
|
|
4459
|
-
this
|
|
4460
|
-
this
|
|
5152
|
+
__publicField$6(this, "score");
|
|
5153
|
+
__publicField$6(this, "_id", "");
|
|
5154
|
+
__publicField$6(this, "_status", "");
|
|
4461
5155
|
this.score = new CMIScore({
|
|
4462
5156
|
CMIElement: "cmi.objectives.n.score",
|
|
4463
5157
|
score_children: scorm12_constants.score_children,
|
|
@@ -4543,6 +5237,14 @@ ${stackTrace}`);
|
|
|
4543
5237
|
}
|
|
4544
5238
|
}
|
|
4545
5239
|
|
|
5240
|
+
var __defProp$5 = Object.defineProperty;
|
|
5241
|
+
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, {
|
|
5242
|
+
enumerable: true,
|
|
5243
|
+
configurable: true,
|
|
5244
|
+
writable: true,
|
|
5245
|
+
value
|
|
5246
|
+
}) : obj[key] = value;
|
|
5247
|
+
var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4546
5248
|
function parseTimeAllowed(value, fieldName) {
|
|
4547
5249
|
try {
|
|
4548
5250
|
check12ValidFormat(fieldName, value, scorm12_regex.CMITimespan, true);
|
|
@@ -4563,9 +5265,10 @@ ${stackTrace}`);
|
|
|
4563
5265
|
*/
|
|
4564
5266
|
constructor(student_data_children) {
|
|
4565
5267
|
super("cmi.student_data");
|
|
4566
|
-
this
|
|
4567
|
-
this
|
|
4568
|
-
this
|
|
5268
|
+
__publicField$5(this, "__children");
|
|
5269
|
+
__publicField$5(this, "_mastery_score", "");
|
|
5270
|
+
__publicField$5(this, "_max_time_allowed", "");
|
|
5271
|
+
__publicField$5(this, "_time_limit_action", "");
|
|
4569
5272
|
this.__children = student_data_children ? student_data_children : scorm12_constants.student_data_children;
|
|
4570
5273
|
}
|
|
4571
5274
|
/**
|
|
@@ -4685,6 +5388,14 @@ ${stackTrace}`);
|
|
|
4685
5388
|
}
|
|
4686
5389
|
}
|
|
4687
5390
|
|
|
5391
|
+
var __defProp$4 = Object.defineProperty;
|
|
5392
|
+
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, {
|
|
5393
|
+
enumerable: true,
|
|
5394
|
+
configurable: true,
|
|
5395
|
+
writable: true,
|
|
5396
|
+
value
|
|
5397
|
+
}) : obj[key] = value;
|
|
5398
|
+
var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4688
5399
|
class CMIStudentPreference extends BaseCMI {
|
|
4689
5400
|
/**
|
|
4690
5401
|
* Constructor for cmi.student_preference
|
|
@@ -4692,10 +5403,11 @@ ${stackTrace}`);
|
|
|
4692
5403
|
*/
|
|
4693
5404
|
constructor(student_preference_children) {
|
|
4694
5405
|
super("cmi.student_preference");
|
|
4695
|
-
this
|
|
4696
|
-
this
|
|
4697
|
-
this
|
|
4698
|
-
this
|
|
5406
|
+
__publicField$4(this, "__children");
|
|
5407
|
+
__publicField$4(this, "_audio", "");
|
|
5408
|
+
__publicField$4(this, "_language", "");
|
|
5409
|
+
__publicField$4(this, "_speed", "");
|
|
5410
|
+
__publicField$4(this, "_text", "");
|
|
4699
5411
|
this.__children = student_preference_children ? student_preference_children : scorm12_constants.student_preference_children;
|
|
4700
5412
|
}
|
|
4701
5413
|
/**
|
|
@@ -4817,6 +5529,14 @@ ${stackTrace}`);
|
|
|
4817
5529
|
}
|
|
4818
5530
|
}
|
|
4819
5531
|
|
|
5532
|
+
var __defProp$3 = Object.defineProperty;
|
|
5533
|
+
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, {
|
|
5534
|
+
enumerable: true,
|
|
5535
|
+
configurable: true,
|
|
5536
|
+
writable: true,
|
|
5537
|
+
value
|
|
5538
|
+
}) : obj[key] = value;
|
|
5539
|
+
var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4820
5540
|
class CMIInteractions extends CMIArray {
|
|
4821
5541
|
/**
|
|
4822
5542
|
* Constructor for `cmi.interactions`
|
|
@@ -4836,13 +5556,15 @@ ${stackTrace}`);
|
|
|
4836
5556
|
*/
|
|
4837
5557
|
constructor() {
|
|
4838
5558
|
super("cmi.interactions.n");
|
|
4839
|
-
this
|
|
4840
|
-
this
|
|
4841
|
-
this
|
|
4842
|
-
this
|
|
4843
|
-
this
|
|
4844
|
-
this
|
|
4845
|
-
this
|
|
5559
|
+
__publicField$3(this, "objectives");
|
|
5560
|
+
__publicField$3(this, "correct_responses");
|
|
5561
|
+
__publicField$3(this, "_id", "");
|
|
5562
|
+
__publicField$3(this, "_time", "");
|
|
5563
|
+
__publicField$3(this, "_type", "");
|
|
5564
|
+
__publicField$3(this, "_weighting", "");
|
|
5565
|
+
__publicField$3(this, "_student_response", "");
|
|
5566
|
+
__publicField$3(this, "_result", "");
|
|
5567
|
+
__publicField$3(this, "_latency", "");
|
|
4846
5568
|
this.objectives = new CMIArray({
|
|
4847
5569
|
CMIElement: "cmi.interactions.n.objectives",
|
|
4848
5570
|
errorCode: scorm12_errors.INVALID_SET_VALUE,
|
|
@@ -5061,7 +5783,7 @@ ${stackTrace}`);
|
|
|
5061
5783
|
*/
|
|
5062
5784
|
constructor() {
|
|
5063
5785
|
super("cmi.interactions.n.objectives.n");
|
|
5064
|
-
this
|
|
5786
|
+
__publicField$3(this, "_id", "");
|
|
5065
5787
|
}
|
|
5066
5788
|
/**
|
|
5067
5789
|
* Called when the API has been reset
|
|
@@ -5112,7 +5834,7 @@ ${stackTrace}`);
|
|
|
5112
5834
|
*/
|
|
5113
5835
|
constructor() {
|
|
5114
5836
|
super("cmi.interactions.correct_responses.n");
|
|
5115
|
-
this
|
|
5837
|
+
__publicField$3(this, "_pattern", "");
|
|
5116
5838
|
}
|
|
5117
5839
|
/**
|
|
5118
5840
|
* Called when the API has been reset
|
|
@@ -5158,6 +5880,14 @@ ${stackTrace}`);
|
|
|
5158
5880
|
}
|
|
5159
5881
|
}
|
|
5160
5882
|
|
|
5883
|
+
var __defProp$2 = Object.defineProperty;
|
|
5884
|
+
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, {
|
|
5885
|
+
enumerable: true,
|
|
5886
|
+
configurable: true,
|
|
5887
|
+
writable: true,
|
|
5888
|
+
value
|
|
5889
|
+
}) : obj[key] = value;
|
|
5890
|
+
var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5161
5891
|
class CMI extends BaseRootCMI {
|
|
5162
5892
|
/**
|
|
5163
5893
|
* Constructor for the SCORM 1.2 cmi object
|
|
@@ -5167,11 +5897,16 @@ ${stackTrace}`);
|
|
|
5167
5897
|
*/
|
|
5168
5898
|
constructor(cmi_children, student_data, initialized) {
|
|
5169
5899
|
super("cmi");
|
|
5170
|
-
this
|
|
5171
|
-
this
|
|
5172
|
-
this
|
|
5173
|
-
this
|
|
5174
|
-
this
|
|
5900
|
+
__publicField$2(this, "__children", "");
|
|
5901
|
+
__publicField$2(this, "__version", "3.4");
|
|
5902
|
+
__publicField$2(this, "_launch_data", "");
|
|
5903
|
+
__publicField$2(this, "_comments", "");
|
|
5904
|
+
__publicField$2(this, "_comments_from_lms", "");
|
|
5905
|
+
__publicField$2(this, "core");
|
|
5906
|
+
__publicField$2(this, "objectives");
|
|
5907
|
+
__publicField$2(this, "student_data");
|
|
5908
|
+
__publicField$2(this, "student_preference");
|
|
5909
|
+
__publicField$2(this, "interactions");
|
|
5175
5910
|
if (initialized) this.initialize();
|
|
5176
5911
|
this.__children = cmi_children ? cmi_children : scorm12_constants.cmi_children;
|
|
5177
5912
|
this.core = new CMICore();
|
|
@@ -5361,13 +6096,21 @@ ${stackTrace}`);
|
|
|
5361
6096
|
}
|
|
5362
6097
|
}
|
|
5363
6098
|
|
|
6099
|
+
var __defProp$1 = Object.defineProperty;
|
|
6100
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, {
|
|
6101
|
+
enumerable: true,
|
|
6102
|
+
configurable: true,
|
|
6103
|
+
writable: true,
|
|
6104
|
+
value
|
|
6105
|
+
}) : obj[key] = value;
|
|
6106
|
+
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, key + "" , value);
|
|
5364
6107
|
class NAV extends BaseCMI {
|
|
5365
6108
|
/**
|
|
5366
6109
|
* Constructor for NAV object
|
|
5367
6110
|
*/
|
|
5368
6111
|
constructor() {
|
|
5369
6112
|
super("cmi.nav");
|
|
5370
|
-
this
|
|
6113
|
+
__publicField$1(this, "_event", "");
|
|
5371
6114
|
}
|
|
5372
6115
|
/**
|
|
5373
6116
|
* Called when the API has been reset
|
|
@@ -5418,6 +6161,14 @@ ${stackTrace}`);
|
|
|
5418
6161
|
}
|
|
5419
6162
|
}
|
|
5420
6163
|
|
|
6164
|
+
var __defProp = Object.defineProperty;
|
|
6165
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
6166
|
+
enumerable: true,
|
|
6167
|
+
configurable: true,
|
|
6168
|
+
writable: true,
|
|
6169
|
+
value
|
|
6170
|
+
}) : obj[key] = value;
|
|
6171
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5421
6172
|
const _Scorm12API = class _Scorm12API extends BaseAPI {
|
|
5422
6173
|
/**
|
|
5423
6174
|
* Constructor for SCORM 1.2 API
|
|
@@ -5434,7 +6185,17 @@ ${stackTrace}`);
|
|
|
5434
6185
|
}
|
|
5435
6186
|
}
|
|
5436
6187
|
super(scorm12_errors, settingsCopy, httpService);
|
|
5437
|
-
this
|
|
6188
|
+
__publicField(this, "statusSetByModule", false);
|
|
6189
|
+
__publicField(this, "cmi");
|
|
6190
|
+
__publicField(this, "nav");
|
|
6191
|
+
__publicField(this, "LMSInitialize");
|
|
6192
|
+
__publicField(this, "LMSFinish");
|
|
6193
|
+
__publicField(this, "LMSGetValue");
|
|
6194
|
+
__publicField(this, "LMSSetValue");
|
|
6195
|
+
__publicField(this, "LMSCommit");
|
|
6196
|
+
__publicField(this, "LMSGetLastError");
|
|
6197
|
+
__publicField(this, "LMSGetErrorString");
|
|
6198
|
+
__publicField(this, "LMSGetDiagnostic");
|
|
5438
6199
|
this.cmi = new CMI();
|
|
5439
6200
|
this.nav = new NAV();
|
|
5440
6201
|
if (this.settings.globalStudentPreferences && _Scorm12API._globalLearnerPrefs) {
|
|
@@ -5661,7 +6422,7 @@ ${stackTrace}`);
|
|
|
5661
6422
|
*/
|
|
5662
6423
|
setCMIValue(CMIElement, value) {
|
|
5663
6424
|
const result = this._commonSetCMIValue("LMSSetValue", false, CMIElement, value);
|
|
5664
|
-
if (this.settings.globalStudentPreferences) {
|
|
6425
|
+
if (result === global_constants.SCORM_TRUE && this.settings.globalStudentPreferences) {
|
|
5665
6426
|
if (CMIElement === "cmi.student_preference.audio") {
|
|
5666
6427
|
this._updateGlobalPreference("audio", value);
|
|
5667
6428
|
} else if (CMIElement === "cmi.student_preference.language") {
|
|
@@ -5769,7 +6530,7 @@ ${stackTrace}`);
|
|
|
5769
6530
|
const flattened = flatten(cmiExport);
|
|
5770
6531
|
switch (this.settings.dataCommitFormat) {
|
|
5771
6532
|
case "flattened":
|
|
5772
|
-
return
|
|
6533
|
+
return flattened;
|
|
5773
6534
|
case "params":
|
|
5774
6535
|
for (const item in flattened) {
|
|
5775
6536
|
if ({}.hasOwnProperty.call(flattened, item)) {
|
|
@@ -5892,7 +6653,7 @@ ${stackTrace}`);
|
|
|
5892
6653
|
* When globalStudentPreferences is enabled, preferences persist across SCO instances
|
|
5893
6654
|
* @private
|
|
5894
6655
|
*/
|
|
5895
|
-
_Scorm12API
|
|
6656
|
+
__publicField(_Scorm12API, "_globalLearnerPrefs", null);
|
|
5896
6657
|
let Scorm12API = _Scorm12API;
|
|
5897
6658
|
|
|
5898
6659
|
return Scorm12API;
|