@patch-adams/core 1.5.17 → 1.5.18

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
@@ -2282,17 +2282,27 @@ function generateLrsBridgeCode(options) {
2282
2282
  function updateCourseInfoFromApi(docData) {
2283
2283
  if (!docData || !LRS.courseInfo) return;
2284
2284
 
2285
- // Document GUID
2286
- if (docData.guid && !LRS.courseInfo.guid) {
2285
+ // Document GUID \u2014 Bravais API GUID ALWAYS overrides baked-in GUID.
2286
+ // The baked-in GUID is a random UUID from wrap time. The Bravais GUID is the
2287
+ // canonical document identifier that Analytics uses to link statements to documents.
2288
+ // Without this override, our statements have a different object.id than cloudplayer
2289
+ // statements, so Analytics treats them as unrelated to the document.
2290
+ if (docData.guid) {
2291
+ if (LRS.courseInfo.guid && LRS.courseInfo.guid !== docData.guid) {
2292
+ log('Overriding baked-in GUID with Bravais GUID:', LRS.courseInfo.guid, '->', docData.guid);
2293
+ }
2287
2294
  LRS.courseInfo.guid = docData.guid;
2288
2295
  LRS.courseInfo.id = 'http://xyleme.com/bravais/document/' + docData.guid;
2289
- log('Updated course guid from API:', docData.guid);
2296
+ log('Document GUID from API:', docData.guid);
2290
2297
  }
2291
2298
 
2292
- // Version GUID from latestVersion
2293
- if (docData.latestVersion && docData.latestVersion.guid && !LRS.courseInfo.versionGuid) {
2299
+ // Version GUID \u2014 same principle: Bravais version GUID must override baked-in
2300
+ if (docData.latestVersion && docData.latestVersion.guid) {
2301
+ if (LRS.courseInfo.versionGuid && LRS.courseInfo.versionGuid !== docData.latestVersion.guid) {
2302
+ log('Overriding baked-in version GUID:', LRS.courseInfo.versionGuid, '->', docData.latestVersion.guid);
2303
+ }
2294
2304
  LRS.courseInfo.versionGuid = docData.latestVersion.guid;
2295
- log('Updated version guid from API:', docData.latestVersion.guid);
2305
+ log('Version GUID from API:', docData.latestVersion.guid);
2296
2306
  }
2297
2307
 
2298
2308
  // Other metadata