@patch-adams/core 1.4.20 → 1.4.21

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
@@ -3289,6 +3289,34 @@ function generateLrsBridgeCode(options) {
3289
3289
  sendStatement(statement);
3290
3290
  };
3291
3291
 
3292
+ /**
3293
+ * Re-extract actor from SCORM after LMSInitialize has been called.
3294
+ * Call this from the SCORM wrapper after scormInit() succeeds,
3295
+ * because the bridge initializes in <head> before LMSInitialize runs.
3296
+ */
3297
+ LRS.refreshActor = function(callback) {
3298
+ log('refreshActor called - re-extracting from SCORM...');
3299
+ var previousName = LRS.actor ? LRS.actor.name : 'none';
3300
+
3301
+ // Re-run sync extraction (SCORM data should now be available)
3302
+ var newActor = extractActor();
3303
+
3304
+ if (isValidActor(newActor) && newActor.account && newActor.account.name !== 'unknown') {
3305
+ log('refreshActor: got valid actor:', newActor.name, newActor.account ? newActor.account.name : '');
3306
+ // Enhance with email lookup (async)
3307
+ extractActorAsync(function(enhancedActor) {
3308
+ if (window.console && window.console.info) {
3309
+ console.info('[PA-LRS] Actor refreshed: ' + previousName + ' -> ' + enhancedActor.name +
3310
+ (enhancedActor.mbox ? ' (' + enhancedActor.mbox + ')' : ''));
3311
+ }
3312
+ if (callback) callback(enhancedActor);
3313
+ });
3314
+ } else {
3315
+ log('refreshActor: no valid actor found after re-extraction');
3316
+ if (callback) callback(LRS.actor);
3317
+ }
3318
+ };
3319
+
3292
3320
  // Course terminated/exited
3293
3321
  LRS.courseTerminated = function() {
3294
3322
  // Calculate duration