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