@patch-adams/core 1.4.27 → 1.4.30
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 +80 -7
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +80 -7
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +80 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +80 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1735,6 +1735,10 @@ function generateLrsBridgeCode(options) {
|
|
|
1735
1735
|
log('Looking up email for employee ID:', employeeId);
|
|
1736
1736
|
|
|
1737
1737
|
fetchEmployeeEmail(employeeId, function(employeeData) {
|
|
1738
|
+
console.info('[PA-LRS] Employee lookup result for ' + employeeId + ': ' +
|
|
1739
|
+
(employeeData ? 'name=' + employeeData.name + ', email=' + employeeData.email +
|
|
1740
|
+
', bravaisUserId=' + employeeData.bravaisUserId + ', tenantUrl=' + employeeData.tenantUrl
|
|
1741
|
+
: 'NO DATA'));
|
|
1738
1742
|
if (employeeData && employeeData.email) {
|
|
1739
1743
|
actor.mbox = 'mailto:' + employeeData.email;
|
|
1740
1744
|
log('Enhanced actor with email:', employeeData.email);
|
|
@@ -4440,14 +4444,83 @@ function generateLrsBridgeCode(options) {
|
|
|
4440
4444
|
// Launch events will NOT be sent until this completes
|
|
4441
4445
|
extractActorAsync(function(actor) {
|
|
4442
4446
|
log('Actor updated after async fetch:', actor);
|
|
4443
|
-
|
|
4444
|
-
//
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4447
|
+
|
|
4448
|
+
// Check if actor is still "Unknown Learner" - SCORM API might not be available yet
|
|
4449
|
+
// The SCORM API is often injected by scorm-calls.js AFTER <head> init completes
|
|
4450
|
+
var isUnknown = !actor || actor.name === 'Unknown Learner' ||
|
|
4451
|
+
!actor.account || actor.account.name === 'unknown';
|
|
4452
|
+
|
|
4453
|
+
if (isUnknown) {
|
|
4454
|
+
log('Actor is Unknown Learner - SCORM API likely not available yet, polling for it...');
|
|
4455
|
+
var scormPollCount = 0;
|
|
4456
|
+
var scormMaxPolls = 20; // wait up to 20 seconds
|
|
4457
|
+
|
|
4458
|
+
var scormPollTimer = setInterval(function() {
|
|
4459
|
+
scormPollCount++;
|
|
4460
|
+
|
|
4461
|
+
// Search parent frames for SCORM API (not just current window)
|
|
4462
|
+
var api2004 = findAPIInFrameHierarchy('API_1484_11', 10);
|
|
4463
|
+
var api12 = !api2004 ? findAPIInFrameHierarchy('API', 10) : null;
|
|
4464
|
+
var foundApi = api2004 || api12;
|
|
4465
|
+
|
|
4466
|
+
if (foundApi) {
|
|
4467
|
+
clearInterval(scormPollTimer);
|
|
4468
|
+
var foundType = api2004 ? '2004' : '1.2';
|
|
4469
|
+
log('SCORM API found on poll ' + scormPollCount + ' at level ' + foundApi.level);
|
|
4470
|
+
|
|
4471
|
+
// Update LRS SCORM API reference
|
|
4472
|
+
if (!LRS.scormApi) {
|
|
4473
|
+
LRS.scormApi = foundApi.api;
|
|
4474
|
+
LRS.scormApiFound = true;
|
|
4475
|
+
LRS.scormApiType = foundType;
|
|
4476
|
+
}
|
|
4477
|
+
|
|
4478
|
+
// Read learner_id right now for diagnostics
|
|
4479
|
+
var scormLearnerId = 'n/a', scormLearnerName = 'n/a';
|
|
4480
|
+
try {
|
|
4481
|
+
if (foundType === '2004') {
|
|
4482
|
+
scormLearnerId = foundApi.api.GetValue('cmi.learner_id');
|
|
4483
|
+
scormLearnerName = foundApi.api.GetValue('cmi.learner_name');
|
|
4484
|
+
} else {
|
|
4485
|
+
scormLearnerId = foundApi.api.LMSGetValue('cmi.core.student_id');
|
|
4486
|
+
scormLearnerName = foundApi.api.LMSGetValue('cmi.core.student_name');
|
|
4487
|
+
}
|
|
4488
|
+
} catch(e) { scormLearnerId = 'error'; scormLearnerName = 'error'; }
|
|
4489
|
+
console.info('[PA-LRS] SCORM API found (poll ' + scormPollCount + ', type=' + foundType +
|
|
4490
|
+
', level=' + foundApi.level + '): learner_id=' + scormLearnerId + ', learner_name=' + scormLearnerName);
|
|
4491
|
+
|
|
4492
|
+
// refreshActor re-reads learner_id from SCORM and runs employee lookup
|
|
4493
|
+
LRS.refreshActor(function(refreshedActor) {
|
|
4494
|
+
if (window.console && window.console.info) {
|
|
4495
|
+
console.info('[PA-LRS] Actor resolved (after SCORM wait, poll ' + scormPollCount + '): name=' +
|
|
4496
|
+
(refreshedActor ? refreshedActor.name : 'none') +
|
|
4497
|
+
', mbox=' + (refreshedActor ? refreshedActor.mbox : 'none') +
|
|
4498
|
+
', account=' + (refreshedActor && refreshedActor.account ? refreshedActor.account.name : 'none'));
|
|
4499
|
+
}
|
|
4500
|
+
actorReady = true;
|
|
4501
|
+
tryLaunchEvents();
|
|
4502
|
+
});
|
|
4503
|
+
} else if (scormPollCount >= scormMaxPolls) {
|
|
4504
|
+
clearInterval(scormPollTimer);
|
|
4505
|
+
log('SCORM API not found after ' + scormMaxPolls + 's, proceeding with Unknown Learner');
|
|
4506
|
+
if (window.console && window.console.info) {
|
|
4507
|
+
console.info('[PA-LRS] Actor resolved (timeout): name=' + (actor ? actor.name : 'none') +
|
|
4508
|
+
', account=' + (actor && actor.account ? actor.account.name : 'none'));
|
|
4509
|
+
}
|
|
4510
|
+
actorReady = true;
|
|
4511
|
+
tryLaunchEvents();
|
|
4512
|
+
}
|
|
4513
|
+
}, 1000);
|
|
4514
|
+
} else {
|
|
4515
|
+
// Actor is valid - proceed immediately
|
|
4516
|
+
if (window.console && window.console.info) {
|
|
4517
|
+
console.info('[PA-LRS] Actor resolved: name=' + (actor ? actor.name : 'none') +
|
|
4518
|
+
', mbox=' + (actor ? actor.mbox : 'none') +
|
|
4519
|
+
', account=' + (actor && actor.account ? actor.account.name : 'none'));
|
|
4520
|
+
}
|
|
4521
|
+
actorReady = true;
|
|
4522
|
+
tryLaunchEvents();
|
|
4449
4523
|
}
|
|
4450
|
-
tryLaunchEvents();
|
|
4451
4524
|
});
|
|
4452
4525
|
} else {
|
|
4453
4526
|
warn('Bridge setup failed - operating in offline mode');
|