@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/cli.js CHANGED
@@ -3614,6 +3614,34 @@ function generateLrsBridgeCode(options) {
3614
3614
  sendStatement(statement);
3615
3615
  };
3616
3616
 
3617
+ /**
3618
+ * Re-extract actor from SCORM after LMSInitialize has been called.
3619
+ * Call this from the SCORM wrapper after scormInit() succeeds,
3620
+ * because the bridge initializes in <head> before LMSInitialize runs.
3621
+ */
3622
+ LRS.refreshActor = function(callback) {
3623
+ log('refreshActor called - re-extracting from SCORM...');
3624
+ var previousName = LRS.actor ? LRS.actor.name : 'none';
3625
+
3626
+ // Re-run sync extraction (SCORM data should now be available)
3627
+ var newActor = extractActor();
3628
+
3629
+ if (isValidActor(newActor) && newActor.account && newActor.account.name !== 'unknown') {
3630
+ log('refreshActor: got valid actor:', newActor.name, newActor.account ? newActor.account.name : '');
3631
+ // Enhance with email lookup (async)
3632
+ extractActorAsync(function(enhancedActor) {
3633
+ if (window.console && window.console.info) {
3634
+ console.info('[PA-LRS] Actor refreshed: ' + previousName + ' -> ' + enhancedActor.name +
3635
+ (enhancedActor.mbox ? ' (' + enhancedActor.mbox + ')' : ''));
3636
+ }
3637
+ if (callback) callback(enhancedActor);
3638
+ });
3639
+ } else {
3640
+ log('refreshActor: no valid actor found after re-extraction');
3641
+ if (callback) callback(LRS.actor);
3642
+ }
3643
+ };
3644
+
3617
3645
  // Course terminated/exited
3618
3646
  LRS.courseTerminated = function() {
3619
3647
  // Calculate duration