scorm-again 2.4.1 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +23 -23
  2. package/dist/aicc.js +55 -35
  3. package/dist/aicc.js.map +1 -1
  4. package/dist/aicc.min.js +1 -1
  5. package/dist/aicc.min.js.map +1 -1
  6. package/dist/esm/aicc.js +55 -35
  7. package/dist/esm/aicc.js.map +1 -1
  8. package/dist/esm/aicc.min.js +1 -1
  9. package/dist/esm/aicc.min.js.map +1 -1
  10. package/dist/esm/scorm-again.js +68 -42
  11. package/dist/esm/scorm-again.js.map +1 -1
  12. package/dist/esm/scorm-again.min.js +1 -1
  13. package/dist/esm/scorm-again.min.js.map +1 -1
  14. package/dist/esm/scorm12.js +55 -35
  15. package/dist/esm/scorm12.js.map +1 -1
  16. package/dist/esm/scorm12.min.js +1 -1
  17. package/dist/esm/scorm12.min.js.map +1 -1
  18. package/dist/esm/scorm2004.js +68 -42
  19. package/dist/esm/scorm2004.js.map +1 -1
  20. package/dist/esm/scorm2004.min.js +1 -1
  21. package/dist/esm/scorm2004.min.js.map +1 -1
  22. package/dist/scorm-again.js +68 -42
  23. package/dist/scorm-again.js.map +1 -1
  24. package/dist/scorm-again.min.js +1 -1
  25. package/dist/scorm-again.min.js.map +1 -1
  26. package/dist/scorm12.js +55 -35
  27. package/dist/scorm12.js.map +1 -1
  28. package/dist/scorm12.min.js +1 -1
  29. package/dist/scorm12.min.js.map +1 -1
  30. package/dist/scorm2004.js +68 -42
  31. package/dist/scorm2004.js.map +1 -1
  32. package/dist/scorm2004.min.js +1 -1
  33. package/dist/scorm2004.min.js.map +1 -1
  34. package/package.json +4 -4
  35. package/src/BaseAPI.ts +27 -65
  36. package/src/Scorm2004API.ts +8 -4
  37. package/src/constants/api_constants.ts +0 -10
  38. package/src/constants/default_settings.ts +20 -7
  39. package/src/constants/enums.ts +9 -0
  40. package/src/constants/regex.ts +1 -1
  41. package/src/exceptions.ts +1 -5
  42. package/src/types/api_types.ts +26 -3
  43. package/test/types/api_types.spec.ts +38 -45
package/README.md CHANGED
@@ -89,29 +89,29 @@ the `window` object, because that's where modules are supposed to look.
89
89
 
90
90
  The APIs include several settings to customize the functionality of each API:
91
91
 
92
- | Setting | Default | Values | Description |
93
- |----------------------------|:--------------------------------:|:--------------------------------------------------------------------------:|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
94
- | `autocommit` | false | true/false | Determines whether the API schedules an autocommit to the LMS after setting a value. |
95
- | `autocommitSeconds` | 60 | int | Number of seconds to wait before autocommiting. Timer is restarted if another value is set. |
96
- | `asyncCommit` | false | true/false | Determines whether the API should send the request to the `lmsCommitUrl` asynchronously. |
97
- | `sendFullCommit` | true | true/false | Determines whether the API sends the full CMI object as part of the commit, or of it only sends the fields that actually contains values. |
98
- | `lmsCommitUrl` | false | url | The URL endpoint of the LMS where data should be sent upon commit. If no value is provided, modules will run as usual, but all method calls will be logged to the console. |
99
- | `dataCommitFormat` | `json` | `json`, `flattened`, `params` | `json` will send a JSON object to the lmsCommitUrl in the format of <br>`{'cmi': {'core': {...}}`<br><br> `flattened` will send the data in the format <br>`{'cmi.core.exit': 'suspend', 'cmi.core.mode': 'normal'...}`<br><br> `params` will send the data as <br>`?cmi.core.exit=suspend&cmi.core.mode=normal...` |
100
- | `commitRequestDataType` | 'application/json;charset=UTF-8' | string | This setting is provided in case your LMS expects a different content type or character set. |
101
- | `renderCommonCommitFields` | false | true/false | Determines whether the API should render the common fields in the commit object. Common fields are `successStatus`, `completionStatus`, `totalTimeSeconds`, `score`, and `runtimeData`. The `runtimeData` field contains the render CMI object. This allows for easier processing on the LMS. |
102
- | `autoProgress` | false | true/false | In case Sequencing is being used, you can tell the API to automatically throw the `SequenceNext` event. |
103
- | `logLevel` | 4 | int<br><br>1 => DEBUG<br>2 => INFO<br>3 => WARN<br>4 => ERROR<br>5 => NONE | By default, the APIs only log error messages. |
104
- | `mastery_override` | false | true/false | (SCORM 1.2) Used to override a module's `cmi.core.lesson_status` so that a pass/fail is determined based on a mastery score and the user's raw score, rather than using whatever status is provided by the module. An example of this would be if a module is published using a `Complete/Incomplete` final status, but the LMS always wants to receive a `Passed/Failed` for quizzes, then we can use this setting to override the given final status. |
105
- | `selfReportSessionTime` | false | true/false | Should the API override the default `session_time` reported by the module? Useful when modules don't properly report time. |
106
- | `alwaysSendTotalTime` | false | true/false | Should the API always send `total_time` when committing to the LMS |
107
- | `fetchMode` | 'cors' | 'cors', 'no-cors', 'same-origin', 'navigate' | The fetch mode to use when sending requests to the LMS. |
108
- | `xhrWithCredentials` | false | true/false | Sets the withCredentials flag on the request to the LMS |
109
- | `xhrHeaders` | {} | Object | This allows setting of additional headers on the request to the LMS where the key should be the header name and the value is the value of the header you want to send |
110
- | `responseHandler` | function | | A function to properly transform the response from the LMS to the correct format. The APIs expect the result from the LMS to be in the following format (errorCode is optional): `{ "result": true, "errorCode": 0 }` |
111
- | `requestHandler` | function | | A function to transform the commit object before sending it to `lmsCommitUrl`. By default it's the identity function (no transformation). |
112
- | `onLogMessage` | function | | A function to be called whenever a message is logged. Defaults to console.{error,warn,info,debug,log} |
113
- | `scoItemIds` | [] | string[] | A list of valid SCO IDs to be used for choice/jump sequence validation. |
114
- | `scoItemIdValidator` | false | false / function | A function to be called during choice/jump sequence checks to determine if a SCO ID is valid. Could be used to call an API to check validity. |
92
+ | Setting | Default | Values | Description |
93
+ |----------------------------|:--------------------------------:|:-----------------------------------------------------------------------------------------------------------------:|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
94
+ | `autocommit` | false | true/false | Determines whether the API schedules an autocommit to the LMS after setting a value. |
95
+ | `autocommitSeconds` | 60 | int | Number of seconds to wait before autocommiting. Timer is restarted if another value is set. |
96
+ | `asyncCommit` | false | true/false | Determines whether the API should send the request to the `lmsCommitUrl` asynchronously. |
97
+ | `sendFullCommit` | true | true/false | Determines whether the API sends the full CMI object as part of the commit, or of it only sends the fields that actually contains values. |
98
+ | `lmsCommitUrl` | false | url | The URL endpoint of the LMS where data should be sent upon commit. If no value is provided, modules will run as usual, but all method calls will be logged to the console. |
99
+ | `dataCommitFormat` | `json` | `json`, `flattened`, `params` | `json` will send a JSON object to the lmsCommitUrl in the format of <br>`{'cmi': {'core': {...}}`<br><br> `flattened` will send the data in the format <br>`{'cmi.core.exit': 'suspend', 'cmi.core.mode': 'normal'...}`<br><br> `params` will send the data as <br>`?cmi.core.exit=suspend&cmi.core.mode=normal...` |
100
+ | `commitRequestDataType` | 'application/json;charset=UTF-8' | string | This setting is provided in case your LMS expects a different content type or character set. |
101
+ | `renderCommonCommitFields` | false | true/false | Determines whether the API should render the common fields in the commit object. Common fields are `successStatus`, `completionStatus`, `totalTimeSeconds`, `score`, and `runtimeData`. The `runtimeData` field contains the render CMI object. This allows for easier processing on the LMS. |
102
+ | `autoProgress` | false | true/false | In case Sequencing is being used, you can tell the API to automatically throw the `SequenceNext` event. |
103
+ | `logLevel` | 4 | number \| string \| LogLevelEnum<br><br>`1` => DEBUG<br>`2` => INFO<br>`3` => WARN<br>`4` => ERROR<br>`5` => NONE | By default, the APIs only log error messages. |
104
+ | `mastery_override` | false | true/false | (SCORM 1.2) Used to override a module's `cmi.core.lesson_status` so that a pass/fail is determined based on a mastery score and the user's raw score, rather than using whatever status is provided by the module. An example of this would be if a module is published using a `Complete/Incomplete` final status, but the LMS always wants to receive a `Passed/Failed` for quizzes, then we can use this setting to override the given final status. |
105
+ | `selfReportSessionTime` | false | true/false | Should the API override the default `session_time` reported by the module? Useful when modules don't properly report time. |
106
+ | `alwaysSendTotalTime` | false | true/false | Should the API always send `total_time` when committing to the LMS |
107
+ | `fetchMode` | 'cors' | 'cors', 'no-cors', 'same-origin', 'navigate' | The fetch mode to use when sending requests to the LMS. |
108
+ | `xhrWithCredentials` | false | true/false | Sets the withCredentials flag on the request to the LMS |
109
+ | `xhrHeaders` | {} | Object | This allows setting of additional headers on the request to the LMS where the key should be the header name and the value is the value of the header you want to send |
110
+ | `responseHandler` | function | | A function to properly transform the response from the LMS to the correct format. The APIs expect the result from the LMS to be in the following format (errorCode is optional): `{ "result": true, "errorCode": 0 }` |
111
+ | `requestHandler` | function | | A function to transform the commit object before sending it to `lmsCommitUrl`. By default it's the identity function (no transformation). |
112
+ | `onLogMessage` | function | | A function to be called whenever a message is logged. Defaults to console.{error,warn,info,debug,log} |
113
+ | `scoItemIds` | [] | string[] | A list of valid SCO IDs to be used for choice/jump sequence validation. |
114
+ | `scoItemIdValidator` | false | false / function | A function to be called during choice/jump sequence checks to determine if a SCO ID is valid. Could be used to call an API to check validity. |
115
115
 
116
116
  ## Settings Function Examples
117
117
 
package/dist/aicc.js CHANGED
@@ -23,9 +23,12 @@ var error_codes = __webpack_require__(797);
23
23
  var api_constants = __webpack_require__(340);
24
24
  // EXTERNAL MODULE: ./src/utilities.ts
25
25
  var utilities = __webpack_require__(864);
26
+ // EXTERNAL MODULE: ./src/constants/enums.ts
27
+ var enums = __webpack_require__(56);
26
28
  ;// ./src/constants/default_settings.ts
27
29
 
28
30
 
31
+
29
32
  var DefaultSettings = {
30
33
  autocommit: false,
31
34
  autocommitSeconds: 10,
@@ -35,7 +38,7 @@ var DefaultSettings = {
35
38
  dataCommitFormat: "json",
36
39
  commitRequestDataType: "application/json;charset=UTF-8",
37
40
  autoProgress: false,
38
- logLevel: api_constants/* default */.A.global.LOG_LEVEL_ERROR,
41
+ logLevel: enums/* LogLevelEnum */.Mb.ERROR,
39
42
  selfReportSessionTime: false,
40
43
  alwaysSendTotalTime: false,
41
44
  renderCommonCommitFields: false,
@@ -96,16 +99,28 @@ var DefaultSettings = {
96
99
  },
97
100
  onLogMessage: function (messageLevel, logMessage) {
98
101
  switch (messageLevel) {
99
- case api_constants/* default */.A.global.LOG_LEVEL_ERROR:
102
+ case "4":
103
+ case 4:
104
+ case "ERROR":
105
+ case enums/* LogLevelEnum */.Mb.ERROR:
100
106
  console.error(logMessage);
101
107
  break;
102
- case api_constants/* default */.A.global.LOG_LEVEL_WARNING:
108
+ case "3":
109
+ case 3:
110
+ case "WARN":
111
+ case enums/* LogLevelEnum */.Mb.WARN:
103
112
  console.warn(logMessage);
104
113
  break;
105
- case api_constants/* default */.A.global.LOG_LEVEL_INFO:
114
+ case "2":
115
+ case 2:
116
+ case "INFO":
117
+ case enums/* LogLevelEnum */.Mb.INFO:
106
118
  console.info(logMessage);
107
119
  break;
108
- case api_constants/* default */.A.global.LOG_LEVEL_DEBUG:
120
+ case "1":
121
+ case 1:
122
+ case "DEBUG":
123
+ case enums/* LogLevelEnum */.Mb.DEBUG:
109
124
  if (console.debug) {
110
125
  console.debug(logMessage);
111
126
  }
@@ -158,6 +173,7 @@ var ScheduledCommit = (function () {
158
173
 
159
174
 
160
175
 
176
+
161
177
  var BaseAPI = (function () {
162
178
  function BaseAPI(error_codes, settings) {
163
179
  var _newTarget = this.constructor;
@@ -174,6 +190,9 @@ var BaseAPI = (function () {
174
190
  }
175
191
  this.apiLogLevel = this.settings.logLevel;
176
192
  this.selfReportSessionTime = this.settings.selfReportSessionTime;
193
+ if (this.apiLogLevel === undefined) {
194
+ this.apiLogLevel = enums/* LogLevelEnum */.Mb.NONE;
195
+ }
177
196
  }
178
197
  BaseAPI.prototype.commonReset = function (settings) {
179
198
  this.settings = (0,tslib_es6/* __assign */.Cl)((0,tslib_es6/* __assign */.Cl)({}, this.settings), settings);
@@ -198,7 +217,7 @@ var BaseAPI = (function () {
198
217
  returnValue = api_constants/* default */.A.global.SCORM_TRUE;
199
218
  this.processListeners(callbackName);
200
219
  }
201
- this.apiLog(callbackName, "returned: " + returnValue, api_constants/* default */.A.global.LOG_LEVEL_INFO);
220
+ this.apiLog(callbackName, "returned: " + returnValue, enums/* LogLevelEnum */.Mb.INFO);
202
221
  this.clearSCORMError(returnValue);
203
222
  return returnValue;
204
223
  };
@@ -250,7 +269,7 @@ var BaseAPI = (function () {
250
269
  this.processListeners(callbackName);
251
270
  _a.label = 2;
252
271
  case 2:
253
- this.apiLog(callbackName, "returned: " + returnValue, api_constants/* default */.A.global.LOG_LEVEL_INFO);
272
+ this.apiLog(callbackName, "returned: " + returnValue, enums/* LogLevelEnum */.Mb.INFO);
254
273
  this.clearSCORMError(returnValue);
255
274
  return [2, returnValue];
256
275
  }
@@ -270,7 +289,7 @@ var BaseAPI = (function () {
270
289
  }
271
290
  this.processListeners(callbackName, CMIElement);
272
291
  }
273
- this.apiLog(callbackName, ": returned: " + returnValue, api_constants/* default */.A.global.LOG_LEVEL_INFO, CMIElement);
292
+ this.apiLog(callbackName, ": returned: " + returnValue, enums/* LogLevelEnum */.Mb.INFO, CMIElement);
274
293
  if (returnValue === undefined) {
275
294
  return "";
276
295
  }
@@ -301,7 +320,7 @@ var BaseAPI = (function () {
301
320
  this.scheduleCommit(this.settings.autocommitSeconds * 1000, commitCallback);
302
321
  }
303
322
  }
304
- this.apiLog(callbackName, ": " + value + ": result: " + returnValue, api_constants/* default */.A.global.LOG_LEVEL_INFO, CMIElement);
323
+ this.apiLog(callbackName, ": " + value + ": result: " + returnValue, enums/* LogLevelEnum */.Mb.INFO, CMIElement);
305
324
  this.clearSCORMError(returnValue);
306
325
  return returnValue;
307
326
  };
@@ -312,7 +331,6 @@ var BaseAPI = (function () {
312
331
  return (0,tslib_es6/* __generator */.YH)(this, function (_a) {
313
332
  switch (_a.label) {
314
333
  case 0:
315
- console.log("commit");
316
334
  this.clearScheduledCommit();
317
335
  returnValue = api_constants/* default */.A.global.SCORM_FALSE;
318
336
  if (!this.checkState(checkTerminated, this._error_codes.COMMIT_BEFORE_INIT, this._error_codes.COMMIT_AFTER_TERM)) return [3, 2];
@@ -326,13 +344,13 @@ var BaseAPI = (function () {
326
344
  typeof result !== "undefined" && result.result
327
345
  ? result.result
328
346
  : api_constants/* default */.A.global.SCORM_FALSE;
329
- this.apiLog(callbackName, " Result: " + returnValue, api_constants/* default */.A.global.LOG_LEVEL_DEBUG, "HttpRequest");
347
+ this.apiLog(callbackName, " Result: " + returnValue, enums/* LogLevelEnum */.Mb.DEBUG, "HttpRequest");
330
348
  if (checkTerminated)
331
349
  this.lastErrorCode = "0";
332
350
  this.processListeners(callbackName);
333
351
  _a.label = 2;
334
352
  case 2:
335
- this.apiLog(callbackName, "returned: " + returnValue, api_constants/* default */.A.global.LOG_LEVEL_INFO);
353
+ this.apiLog(callbackName, "returned: " + returnValue, enums/* LogLevelEnum */.Mb.INFO);
336
354
  this.clearSCORMError(returnValue);
337
355
  return [2, returnValue];
338
356
  }
@@ -342,7 +360,7 @@ var BaseAPI = (function () {
342
360
  BaseAPI.prototype.getLastError = function (callbackName) {
343
361
  var returnValue = String(this.lastErrorCode);
344
362
  this.processListeners(callbackName);
345
- this.apiLog(callbackName, "returned: " + returnValue, api_constants/* default */.A.global.LOG_LEVEL_INFO);
363
+ this.apiLog(callbackName, "returned: " + returnValue, enums/* LogLevelEnum */.Mb.INFO);
346
364
  return returnValue;
347
365
  };
348
366
  BaseAPI.prototype.getErrorString = function (callbackName, CMIErrorCode) {
@@ -351,7 +369,7 @@ var BaseAPI = (function () {
351
369
  returnValue = this.getLmsErrorMessageDetails(CMIErrorCode);
352
370
  this.processListeners(callbackName);
353
371
  }
354
- this.apiLog(callbackName, "returned: " + returnValue, api_constants/* default */.A.global.LOG_LEVEL_INFO);
372
+ this.apiLog(callbackName, "returned: " + returnValue, enums/* LogLevelEnum */.Mb.INFO);
355
373
  return returnValue;
356
374
  };
357
375
  BaseAPI.prototype.getDiagnostic = function (callbackName, CMIErrorCode) {
@@ -360,7 +378,7 @@ var BaseAPI = (function () {
360
378
  returnValue = this.getLmsErrorMessageDetails(CMIErrorCode, true);
361
379
  this.processListeners(callbackName);
362
380
  }
363
- this.apiLog(callbackName, "returned: " + returnValue, api_constants/* default */.A.global.LOG_LEVEL_INFO);
381
+ this.apiLog(callbackName, "returned: " + returnValue, enums/* LogLevelEnum */.Mb.INFO);
364
382
  return returnValue;
365
383
  };
366
384
  BaseAPI.prototype.checkState = function (checkTerminated, beforeInitError, afterTermError) {
@@ -454,7 +472,7 @@ var BaseAPI = (function () {
454
472
  }
455
473
  }
456
474
  if (returnValue === api_constants/* default */.A.global.SCORM_FALSE) {
457
- this.apiLog(methodName, "There was an error setting the value for: ".concat(CMIElement, ", value of: ").concat(value), api_constants/* default */.A.global.LOG_LEVEL_WARNING);
475
+ this.apiLog(methodName, "There was an error setting the value for: ".concat(CMIElement, ", value of: ").concat(value), enums/* LogLevelEnum */.Mb.WARN);
458
476
  }
459
477
  return returnValue;
460
478
  };
@@ -552,7 +570,7 @@ var BaseAPI = (function () {
552
570
  CMIElement: CMIElement,
553
571
  callback: callback,
554
572
  });
555
- this.apiLog("on", "Added event listener: ".concat(this.listenerArray.length), api_constants/* default */.A.global.LOG_LEVEL_INFO, functionName);
573
+ this.apiLog("on", "Added event listener: ".concat(this.listenerArray.length), enums/* LogLevelEnum */.Mb.INFO, functionName);
556
574
  }
557
575
  };
558
576
  BaseAPI.prototype.off = function (listenerName, callback) {
@@ -575,7 +593,7 @@ var BaseAPI = (function () {
575
593
  });
576
594
  if (removeIndex !== -1) {
577
595
  this_1.listenerArray.splice(removeIndex, 1);
578
- this_1.apiLog("off", "Removed event listener: ".concat(this_1.listenerArray.length), api_constants/* default */.A.global.LOG_LEVEL_INFO, functionName);
596
+ this_1.apiLog("off", "Removed event listener: ".concat(this_1.listenerArray.length), enums/* LogLevelEnum */.Mb.INFO, functionName);
579
597
  }
580
598
  };
581
599
  var this_1 = this;
@@ -608,7 +626,7 @@ var BaseAPI = (function () {
608
626
  }
609
627
  };
610
628
  BaseAPI.prototype.processListeners = function (functionName, CMIElement, value) {
611
- this.apiLog(functionName, value, api_constants/* default */.A.global.LOG_LEVEL_INFO, CMIElement);
629
+ this.apiLog(functionName, value, enums/* LogLevelEnum */.Mb.INFO, CMIElement);
612
630
  for (var i = 0; i < this.listenerArray.length; i++) {
613
631
  var listener = this.listenerArray[i];
614
632
  var functionsMatch = listener.functionName === functionName;
@@ -624,7 +642,7 @@ var BaseAPI = (function () {
624
642
  CMIElementsMatch = listener.CMIElement === CMIElement;
625
643
  }
626
644
  if (functionsMatch && (!listenerHasCMIElement || CMIElementsMatch)) {
627
- this.apiLog("processListeners", "Processing listener: ".concat(listener.functionName), api_constants/* default */.A.global.LOG_LEVEL_INFO, CMIElement);
645
+ this.apiLog("processListeners", "Processing listener: ".concat(listener.functionName), enums/* LogLevelEnum */.Mb.INFO, CMIElement);
628
646
  listener.callback(CMIElement, value);
629
647
  }
630
648
  }
@@ -633,7 +651,7 @@ var BaseAPI = (function () {
633
651
  if (!message) {
634
652
  message = this.getLmsErrorMessageDetails(errorNumber);
635
653
  }
636
- this.apiLog("throwSCORMError", errorNumber + ": " + message, api_constants/* default */.A.global.LOG_LEVEL_ERROR);
654
+ this.apiLog("throwSCORMError", errorNumber + ": " + message, enums/* LogLevelEnum */.Mb.ERROR);
637
655
  this.lastErrorCode = String(errorNumber);
638
656
  };
639
657
  BaseAPI.prototype.clearSCORMError = function (success) {
@@ -784,7 +802,7 @@ var BaseAPI = (function () {
784
802
  return [2, this.transformResponse(response)];
785
803
  case 2:
786
804
  e_1 = _a.sent();
787
- this.apiLog("processHttpRequest", e_1, api_constants/* default */.A.global.LOG_LEVEL_ERROR);
805
+ this.apiLog("processHttpRequest", e_1, enums/* LogLevelEnum */.Mb.ERROR);
788
806
  api.processListeners("CommitError");
789
807
  return [2, genericError];
790
808
  case 3: return [2];
@@ -800,14 +818,14 @@ var BaseAPI = (function () {
800
818
  BaseAPI.prototype.scheduleCommit = function (when, callback) {
801
819
  if (!this._timeout) {
802
820
  this._timeout = new ScheduledCommit(this, when, callback);
803
- this.apiLog("scheduleCommit", "scheduled", api_constants/* default */.A.global.LOG_LEVEL_DEBUG, "");
821
+ this.apiLog("scheduleCommit", "scheduled", enums/* LogLevelEnum */.Mb.DEBUG, "");
804
822
  }
805
823
  };
806
824
  BaseAPI.prototype.clearScheduledCommit = function () {
807
825
  if (this._timeout) {
808
826
  this._timeout.cancel();
809
827
  this._timeout = undefined;
810
- this.apiLog("clearScheduledCommit", "cleared", api_constants/* default */.A.global.LOG_LEVEL_DEBUG, "");
828
+ this.apiLog("clearScheduledCommit", "cleared", enums/* LogLevelEnum */.Mb.DEBUG, "");
811
829
  }
812
830
  };
813
831
  BaseAPI.prototype._checkObjectHasProperty = function (refObject, attribute) {
@@ -836,7 +854,7 @@ var BaseAPI = (function () {
836
854
  var commitObject = this.settings.renderCommonCommitFields
837
855
  ? this.renderCommitObject(shouldTerminateCommit)
838
856
  : this.renderCommitCMI(shouldTerminateCommit);
839
- if (this.apiLogLevel === api_constants/* default */.A.global.LOG_LEVEL_DEBUG) {
857
+ if ([enums/* LogLevelEnum */.Mb.DEBUG, "1", 1, "DEBUG"].includes(this.apiLogLevel)) {
840
858
  console.debug("Commit (terminated: " + (terminateCommit ? "yes" : "no") + "): ");
841
859
  console.debug(commitObject);
842
860
  }
@@ -2533,11 +2551,6 @@ var global = {
2533
2551
  STATE_NOT_INITIALIZED: 0,
2534
2552
  STATE_INITIALIZED: 1,
2535
2553
  STATE_TERMINATED: 2,
2536
- LOG_LEVEL_DEBUG: 1,
2537
- LOG_LEVEL_INFO: 2,
2538
- LOG_LEVEL_WARNING: 3,
2539
- LOG_LEVEL_ERROR: 4,
2540
- LOG_LEVEL_NONE: 5,
2541
2554
  };
2542
2555
  var scorm12 = {
2543
2556
  cmi_children: "core,suspend_data,launch_data,comments,objectives,student_data,student_preference,interactions",
@@ -2740,6 +2753,7 @@ var APIConstants = {
2740
2753
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2741
2754
 
2742
2755
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2756
+ /* harmony export */ Mb: function() { return /* binding */ LogLevelEnum; },
2743
2757
  /* harmony export */ YE: function() { return /* binding */ SuccessStatus; },
2744
2758
  /* harmony export */ lC: function() { return /* binding */ CompletionStatus; }
2745
2759
  /* harmony export */ });
@@ -2762,6 +2776,15 @@ var CompletionStatus;
2762
2776
  CompletionStatus["incomplete"] = "incomplete";
2763
2777
  CompletionStatus["unknown"] = "unknown";
2764
2778
  })(CompletionStatus || (CompletionStatus = {}));
2779
+ var LogLevelEnum;
2780
+ (function (LogLevelEnum) {
2781
+ LogLevelEnum[LogLevelEnum["_"] = 0] = "_";
2782
+ LogLevelEnum[LogLevelEnum["DEBUG"] = 1] = "DEBUG";
2783
+ LogLevelEnum[LogLevelEnum["INFO"] = 2] = "INFO";
2784
+ LogLevelEnum[LogLevelEnum["WARN"] = 3] = "WARN";
2785
+ LogLevelEnum[LogLevelEnum["ERROR"] = 4] = "ERROR";
2786
+ LogLevelEnum[LogLevelEnum["NONE"] = 5] = "NONE";
2787
+ })(LogLevelEnum || (LogLevelEnum = {}));
2765
2788
 
2766
2789
 
2767
2790
  /***/ }),
@@ -2870,7 +2893,7 @@ var scorm2004 = {
2870
2893
  CMIExit: "^(time-out|suspend|logout|normal)$",
2871
2894
  CMIType: "^(true-false|choice|fill-in|long-fill-in|matching|performance|sequencing|likert|numeric|other)$",
2872
2895
  CMIResult: "^(correct|incorrect|unanticipated|neutral|-?([0-9]{1,4})(\\.[0-9]{1,18})?)$",
2873
- NAVEvent: "^(previous|continue|exit|exitAll|abandon|abandonAll|suspendAll|_none_|(\\{target=\\S{0,}[a-zA-Z0-9-_]+})?choice|(\\{target=\\S{0,}[a-zA-Z0-9-_]+})?jump)$",
2896
+ NAVEvent: "^(previous|continue|exit|exitAll|abandon|abandonAll|suspendAll|_none_|(\\{target=(?<choice_target>\\S{0,}[a-zA-Z0-9-_]+)})?choice|(\\{target=(?<jump_target>\\S{0,}[a-zA-Z0-9-_]+)})?jump)$",
2874
2897
  NAVBoolean: "^(unknown|true|false$)",
2875
2898
  NAVTarget: "^{target=\\S{0,}[a-zA-Z0-9-_]+}$",
2876
2899
  scaled_range: "-1#1",
@@ -2921,9 +2944,6 @@ var BaseScormValidationError = (function (_super) {
2921
2944
  enumerable: false,
2922
2945
  configurable: true
2923
2946
  });
2924
- BaseScormValidationError.prototype.setMessage = function (message) {
2925
- this.message = message;
2926
- };
2927
2947
  return BaseScormValidationError;
2928
2948
  }(Error));
2929
2949
 
@@ -2932,7 +2952,7 @@ var ValidationError = (function (_super) {
2932
2952
  function ValidationError(errorCode, errorMessage, detailedMessage) {
2933
2953
  var _this = _super.call(this, errorCode) || this;
2934
2954
  _this._detailedMessage = "";
2935
- _this.setMessage(errorMessage);
2955
+ _this.message = errorMessage;
2936
2956
  _this._errorMessage = errorMessage;
2937
2957
  if (detailedMessage) {
2938
2958
  _this._detailedMessage = detailedMessage;