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