@patch-adams/core 1.3.3 → 1.3.4

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
@@ -733,10 +733,11 @@ function generateLrsBridgeCode(options) {
733
733
  const employeeApiEndpoint = options.employeeApiEndpoint || "";
734
734
  return `
735
735
  // ==========================================================================
736
- // PATCH-ADAMS LRS BRIDGE v2.1.0
736
+ // PATCH-ADAMS LRS BRIDGE v2.2.0
737
737
  // Full xAPI support with direct LRS communication for Rise courses
738
- // ALL statements use COURSE as main object for Analytics searchability
738
+ // ALL statements use DOCUMENT as main object for Bravais aggregation
739
739
  // Activity type (video, assessment, etc.) stored in object.definition.type
740
+ // Page/lesson info stored in context.extensions for navigation tracking
740
741
  // ==========================================================================
741
742
  (function() {
742
743
  'use strict';
@@ -2605,24 +2606,41 @@ function generateLrsBridgeCode(options) {
2605
2606
  sendStatement(statement);
2606
2607
  };
2607
2608
 
2608
- // Content/Page viewed
2609
+ // Content/Page viewed - uses document as object for Bravais aggregation
2609
2610
  LRS.contentOpened = function(data) {
2610
2611
  if (!TRACK_NAVIGATION) return;
2611
2612
 
2612
- // Build page-level activity object for Xyleme format
2613
- var pageObject = buildPageActivityObject({
2614
- pageGuid: data.pageGuid || data.lessonId,
2615
- name: data.title || 'Page',
2616
- type: 'page'
2617
- });
2618
-
2619
2613
  var result = null;
2620
2614
  if (data.duration) {
2621
2615
  result = { duration: data.duration };
2622
2616
  }
2623
2617
 
2624
- // Use 'opened' verb for Xyleme compatibility (ActivityStrea.ms)
2625
- var statement = buildStatementXyleme('opened', pageObject, result);
2618
+ // Extract clean page/lesson ID from Rise hash paths
2619
+ var lessonId = data.pageGuid || data.lessonId || '';
2620
+ if (lessonId.indexOf('#/lessons/') === 0) {
2621
+ lessonId = lessonId.substring(10); // Remove '#/lessons/'
2622
+ } else if (lessonId.indexOf('#/') === 0) {
2623
+ lessonId = lessonId.substring(2); // Remove '#/'
2624
+ }
2625
+
2626
+ // Add page info to context extensions (not as main object)
2627
+ var additionalContext = {
2628
+ extensions: {
2629
+ pageId: lessonId || 'home',
2630
+ pageTitle: data.title || 'Page',
2631
+ pageUrl: data.url || window.location.href
2632
+ }
2633
+ };
2634
+
2635
+ // Use document as main object (required for Bravais aggregation)
2636
+ // Use 'experienced' verb which is standard xAPI for viewing content
2637
+ var statement = buildStatement(
2638
+ 'experienced',
2639
+ 'http://xyleme.com/bravais/activities/document',
2640
+ { event: 'page_viewed', pageId: lessonId },
2641
+ result,
2642
+ additionalContext
2643
+ );
2626
2644
  sendStatement(statement);
2627
2645
  };
2628
2646