@patch-adams/core 1.5.6 → 1.5.7

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
@@ -616,6 +616,14 @@ function generateLrsBridgeCode(options) {
616
616
  });
617
617
  }
618
618
 
619
+ // Decode HTML entities (e.g., " " & ') to clean text
620
+ function decodeEntities(str) {
621
+ if (!str || typeof str !== 'string') return str;
622
+ var txt = document.createElement('textarea');
623
+ txt.innerHTML = str;
624
+ return txt.value;
625
+ }
626
+
619
627
  LRS.sessionId = generateUUID();
620
628
  LRS.courseAttemptId = generateUUID(); // Unique per session for Xyleme correlation
621
629
  LRS.launchTime = new Date().toISOString();
@@ -2207,6 +2215,10 @@ function generateLrsBridgeCode(options) {
2207
2215
  info.id = window.location.href.split('#')[0].split('?')[0];
2208
2216
  }
2209
2217
 
2218
+ // Decode any HTML entities in title/description
2219
+ if (info.title) info.title = decodeEntities(info.title);
2220
+ if (info.description) info.description = decodeEntities(info.description);
2221
+
2210
2222
  // Build shared link name if not provided
2211
2223
  if (!info.sharedLinkName && info.title && info.sharedLinkToken) {
2212
2224
  info.sharedLinkName = info.title + ' - LMS Thin Pack';
@@ -2386,7 +2398,7 @@ function generateLrsBridgeCode(options) {
2386
2398
  id: window.location.href.split('#')[0].split('?')[0],
2387
2399
  definition: {
2388
2400
  type: 'http://xyleme.com/bravais/activities/document',
2389
- name: { 'en-US': document.title || 'Rise Course' }
2401
+ name: { 'en-US': decodeEntities(document.title) || 'Rise Course' }
2390
2402
  }
2391
2403
  };
2392
2404
  }
@@ -2417,10 +2429,11 @@ function generateLrsBridgeCode(options) {
2417
2429
  courseObj.definition.extensions = courseObj.definition.extensions || {};
2418
2430
 
2419
2431
  if (activityDetails) {
2420
- // Merge activity details into extensions
2432
+ // Merge activity details into extensions, decoding any HTML entities in string values
2421
2433
  for (var key in activityDetails) {
2422
2434
  if (activityDetails.hasOwnProperty(key)) {
2423
- courseObj.definition.extensions[key] = activityDetails[key];
2435
+ var val = activityDetails[key];
2436
+ courseObj.definition.extensions[key] = typeof val === 'string' ? decodeEntities(val) : val;
2424
2437
  }
2425
2438
  }
2426
2439
  }
@@ -2499,7 +2512,7 @@ function generateLrsBridgeCode(options) {
2499
2512
  id: LRS.courseInfo.id,
2500
2513
  definition: {
2501
2514
  type: 'http://xyleme.com/bravais/activities/document',
2502
- name: { 'en-US': LRS.courseInfo.title }
2515
+ name: { 'en-US': decodeEntities(LRS.courseInfo.title) }
2503
2516
  }
2504
2517
  };
2505
2518
 
@@ -2549,7 +2562,7 @@ function generateLrsBridgeCode(options) {
2549
2562
  objectType: 'Activity',
2550
2563
  definition: {
2551
2564
  type: 'http://xyleme.com/bravais/activities/document',
2552
- name: { 'en-US': LRS.courseInfo.title || 'Rise Course' }
2565
+ name: { 'en-US': decodeEntities(LRS.courseInfo.title) || 'Rise Course' }
2553
2566
  }
2554
2567
  };
2555
2568