@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/index.cjs CHANGED
@@ -397,10 +397,11 @@ function generateLrsBridgeCode(options) {
397
397
  const employeeApiEndpoint = options.employeeApiEndpoint || "";
398
398
  return `
399
399
  // ==========================================================================
400
- // PATCH-ADAMS LRS BRIDGE v2.1.0
400
+ // PATCH-ADAMS LRS BRIDGE v2.2.0
401
401
  // Full xAPI support with direct LRS communication for Rise courses
402
- // ALL statements use COURSE as main object for Analytics searchability
402
+ // ALL statements use DOCUMENT as main object for Bravais aggregation
403
403
  // Activity type (video, assessment, etc.) stored in object.definition.type
404
+ // Page/lesson info stored in context.extensions for navigation tracking
404
405
  // ==========================================================================
405
406
  (function() {
406
407
  'use strict';
@@ -2269,24 +2270,41 @@ function generateLrsBridgeCode(options) {
2269
2270
  sendStatement(statement);
2270
2271
  };
2271
2272
 
2272
- // Content/Page viewed
2273
+ // Content/Page viewed - uses document as object for Bravais aggregation
2273
2274
  LRS.contentOpened = function(data) {
2274
2275
  if (!TRACK_NAVIGATION) return;
2275
2276
 
2276
- // Build page-level activity object for Xyleme format
2277
- var pageObject = buildPageActivityObject({
2278
- pageGuid: data.pageGuid || data.lessonId,
2279
- name: data.title || 'Page',
2280
- type: 'page'
2281
- });
2282
-
2283
2277
  var result = null;
2284
2278
  if (data.duration) {
2285
2279
  result = { duration: data.duration };
2286
2280
  }
2287
2281
 
2288
- // Use 'opened' verb for Xyleme compatibility (ActivityStrea.ms)
2289
- var statement = buildStatementXyleme('opened', pageObject, result);
2282
+ // Extract clean page/lesson ID from Rise hash paths
2283
+ var lessonId = data.pageGuid || data.lessonId || '';
2284
+ if (lessonId.indexOf('#/lessons/') === 0) {
2285
+ lessonId = lessonId.substring(10); // Remove '#/lessons/'
2286
+ } else if (lessonId.indexOf('#/') === 0) {
2287
+ lessonId = lessonId.substring(2); // Remove '#/'
2288
+ }
2289
+
2290
+ // Add page info to context extensions (not as main object)
2291
+ var additionalContext = {
2292
+ extensions: {
2293
+ pageId: lessonId || 'home',
2294
+ pageTitle: data.title || 'Page',
2295
+ pageUrl: data.url || window.location.href
2296
+ }
2297
+ };
2298
+
2299
+ // Use document as main object (required for Bravais aggregation)
2300
+ // Use 'experienced' verb which is standard xAPI for viewing content
2301
+ var statement = buildStatement(
2302
+ 'experienced',
2303
+ 'http://xyleme.com/bravais/activities/document',
2304
+ { event: 'page_viewed', pageId: lessonId },
2305
+ result,
2306
+ additionalContext
2307
+ );
2290
2308
  sendStatement(statement);
2291
2309
  };
2292
2310