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