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