@patch-adams/core 1.4.23 → 1.4.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1500,16 +1500,9 @@ function generateLrsBridgeCode(options) {
1500
1500
  name: scormLearnerId
1501
1501
  }
1502
1502
  };
1503
- if (scormLearnerName) {
1504
- // Handle "LastName, FirstName" format
1505
- if (scormLearnerName.indexOf(',') > -1) {
1506
- var parts = scormLearnerName.split(',');
1507
- actor.name = (parts[1] || '').trim() + ' ' + (parts[0] || '').trim();
1508
- } else {
1509
- actor.name = scormLearnerName;
1510
- }
1511
- }
1512
- log('Actor source: SCORM API');
1503
+ // Don't use SCORM student_name - it's unreliable ("Last, First" format varies by LMS).
1504
+ // The employee API lookup will provide the correct name and email.
1505
+ log('Actor source: SCORM API (id only, name from employee lookup)');
1513
1506
  LRS.actor = actor;
1514
1507
  return actor;
1515
1508
  }
@@ -3317,6 +3310,27 @@ function generateLrsBridgeCode(options) {
3317
3310
  * because the bridge initializes in <head> before LMSInitialize runs.
3318
3311
  */
3319
3312
  LRS.refreshActor = function(callback) {
3313
+ // If SCORM API wasn't found during <head> init, re-scan now
3314
+ // (some LMS inject window.API after page starts loading)
3315
+ if (!LRS.scormApi) {
3316
+ log('refreshActor: SCORM API missing, re-scanning...');
3317
+ var api2004 = findAPIInFrameHierarchy('API_1484_11', 10);
3318
+ if (api2004) {
3319
+ LRS.scormApi = api2004.api;
3320
+ LRS.scormApiFound = true;
3321
+ LRS.scormApiType = '2004';
3322
+ log('refreshActor: found SCORM 2004 API');
3323
+ } else {
3324
+ var api12 = findAPIInFrameHierarchy('API', 10);
3325
+ if (api12) {
3326
+ LRS.scormApi = api12.api;
3327
+ LRS.scormApiFound = true;
3328
+ LRS.scormApiType = '1.2';
3329
+ log('refreshActor: found SCORM 1.2 API');
3330
+ }
3331
+ }
3332
+ }
3333
+
3320
3334
  // Always-visible diagnostic: confirm refreshActor is being called and show SCORM data (TEMPORARY)
3321
3335
  if (window.console && window.console.info) {
3322
3336
  var scormId = 'n/a', scormName = 'n/a';