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