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