@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/index.js CHANGED
@@ -1941,17 +1941,27 @@ function generateLrsBridgeCode(options) {
1941
1941
  function updateCourseInfoFromApi(docData) {
1942
1942
  if (!docData || !LRS.courseInfo) return;
1943
1943
 
1944
- // Document GUID
1945
- if (docData.guid && !LRS.courseInfo.guid) {
1944
+ // Document GUID \u2014 Bravais API GUID ALWAYS overrides baked-in GUID.
1945
+ // The baked-in GUID is a random UUID from wrap time. The Bravais GUID is the
1946
+ // canonical document identifier that Analytics uses to link statements to documents.
1947
+ // Without this override, our statements have a different object.id than cloudplayer
1948
+ // statements, so Analytics treats them as unrelated to the document.
1949
+ if (docData.guid) {
1950
+ if (LRS.courseInfo.guid && LRS.courseInfo.guid !== docData.guid) {
1951
+ log('Overriding baked-in GUID with Bravais GUID:', LRS.courseInfo.guid, '->', docData.guid);
1952
+ }
1946
1953
  LRS.courseInfo.guid = docData.guid;
1947
1954
  LRS.courseInfo.id = 'http://xyleme.com/bravais/document/' + docData.guid;
1948
- log('Updated course guid from API:', docData.guid);
1955
+ log('Document GUID from API:', docData.guid);
1949
1956
  }
1950
1957
 
1951
- // Version GUID from latestVersion
1952
- if (docData.latestVersion && docData.latestVersion.guid && !LRS.courseInfo.versionGuid) {
1958
+ // Version GUID \u2014 same principle: Bravais version GUID must override baked-in
1959
+ if (docData.latestVersion && docData.latestVersion.guid) {
1960
+ if (LRS.courseInfo.versionGuid && LRS.courseInfo.versionGuid !== docData.latestVersion.guid) {
1961
+ log('Overriding baked-in version GUID:', LRS.courseInfo.versionGuid, '->', docData.latestVersion.guid);
1962
+ }
1953
1963
  LRS.courseInfo.versionGuid = docData.latestVersion.guid;
1954
- log('Updated version guid from API:', docData.latestVersion.guid);
1964
+ log('Version GUID from API:', docData.latestVersion.guid);
1955
1965
  }
1956
1966
 
1957
1967
  // Other metadata