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