@patch-adams/core 1.4.26 → 1.4.27
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 +36 -10
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +36 -10
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +36 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +36 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4090,6 +4090,19 @@ function generateLrsBridgeCode(options) {
|
|
|
4090
4090
|
// Setup connection
|
|
4091
4091
|
var bridgeReady = setupBridge();
|
|
4092
4092
|
|
|
4093
|
+
// Track async readiness: both actor and doc metadata must resolve before sending statements
|
|
4094
|
+
var actorReady = false;
|
|
4095
|
+
var docReady = false;
|
|
4096
|
+
var launchEventsSent = false;
|
|
4097
|
+
|
|
4098
|
+
function tryLaunchEvents() {
|
|
4099
|
+
if (launchEventsSent) return;
|
|
4100
|
+
if (!actorReady || !docReady) return;
|
|
4101
|
+
launchEventsSent = true;
|
|
4102
|
+
log('Both actor and doc metadata ready, sending launch events');
|
|
4103
|
+
setTimeout(sendLaunchEvents, 50);
|
|
4104
|
+
}
|
|
4105
|
+
|
|
4093
4106
|
if (bridgeReady) {
|
|
4094
4107
|
LRS.initialized = true;
|
|
4095
4108
|
|
|
@@ -4100,14 +4113,23 @@ function generateLrsBridgeCode(options) {
|
|
|
4100
4113
|
log('Actor:', LRS.actor);
|
|
4101
4114
|
log('Course:', LRS.courseInfo);
|
|
4102
4115
|
|
|
4103
|
-
// Then try async actor extraction
|
|
4104
|
-
//
|
|
4116
|
+
// Then try async actor extraction (employee lookup, Bravais session)
|
|
4117
|
+
// Launch events will NOT be sent until this completes
|
|
4105
4118
|
extractActorAsync(function(actor) {
|
|
4106
4119
|
log('Actor updated after async fetch:', actor);
|
|
4120
|
+
actorReady = true;
|
|
4121
|
+
// Log final actor state for diagnostics
|
|
4122
|
+
if (window.console && window.console.info) {
|
|
4123
|
+
console.info('[PA-LRS] Actor resolved: name=' + (actor ? actor.name : 'none') +
|
|
4124
|
+
', mbox=' + (actor ? actor.mbox : 'none') +
|
|
4125
|
+
', account=' + (actor && actor.account ? actor.account.name : 'none'));
|
|
4126
|
+
}
|
|
4127
|
+
tryLaunchEvents();
|
|
4107
4128
|
});
|
|
4108
4129
|
} else {
|
|
4109
4130
|
warn('Bridge setup failed - operating in offline mode');
|
|
4110
4131
|
LRS.mode = 'offline';
|
|
4132
|
+
actorReady = true; // No actor to wait for in offline mode
|
|
4111
4133
|
}
|
|
4112
4134
|
|
|
4113
4135
|
// Always-visible bridge summary (not gated by DEBUG)
|
|
@@ -4152,13 +4174,17 @@ function generateLrsBridgeCode(options) {
|
|
|
4152
4174
|
}
|
|
4153
4175
|
}
|
|
4154
4176
|
|
|
4155
|
-
function
|
|
4177
|
+
function onDocReady() {
|
|
4178
|
+
docReady = true;
|
|
4179
|
+
tryLaunchEvents();
|
|
4180
|
+
}
|
|
4181
|
+
|
|
4182
|
+
function fetchDocDataAndReady(docId) {
|
|
4156
4183
|
fetchDocumentMetadata(docId, function(docData) {
|
|
4157
4184
|
if (docData) {
|
|
4158
4185
|
updateCourseInfoFromApi(docData);
|
|
4159
4186
|
}
|
|
4160
|
-
|
|
4161
|
-
setTimeout(sendLaunchEvents, 100);
|
|
4187
|
+
onDocReady();
|
|
4162
4188
|
});
|
|
4163
4189
|
}
|
|
4164
4190
|
|
|
@@ -4178,20 +4204,20 @@ function generateLrsBridgeCode(options) {
|
|
|
4178
4204
|
} else {
|
|
4179
4205
|
warn('Could not fetch document data from shared API - statements may fail aggregation');
|
|
4180
4206
|
}
|
|
4181
|
-
|
|
4207
|
+
onDocReady();
|
|
4182
4208
|
});
|
|
4183
4209
|
} else if (documentId) {
|
|
4184
4210
|
// No shared link token, try with extracted document ID (requires auth)
|
|
4185
4211
|
log('No shared link token, fetching document data with ID:', documentId);
|
|
4186
|
-
|
|
4212
|
+
fetchDocDataAndReady(documentId);
|
|
4187
4213
|
} else {
|
|
4188
4214
|
// No identifiers available
|
|
4189
4215
|
warn('No shared link token or document ID - statements may fail aggregation');
|
|
4190
|
-
|
|
4216
|
+
onDocReady();
|
|
4191
4217
|
}
|
|
4192
4218
|
} else {
|
|
4193
|
-
// Already have GUID
|
|
4194
|
-
|
|
4219
|
+
// Already have GUID
|
|
4220
|
+
onDocReady();
|
|
4195
4221
|
}
|
|
4196
4222
|
|
|
4197
4223
|
// Setup beforeunload to send terminated
|