@patch-adams/core 1.5.5 → 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.cjs CHANGED
@@ -625,6 +625,14 @@ function generateLrsBridgeCode(options) {
625
625
  });
626
626
  }
627
627
 
628
+ // Decode HTML entities (e.g., " " & ') to clean text
629
+ function decodeEntities(str) {
630
+ if (!str || typeof str !== 'string') return str;
631
+ var txt = document.createElement('textarea');
632
+ txt.innerHTML = str;
633
+ return txt.value;
634
+ }
635
+
628
636
  LRS.sessionId = generateUUID();
629
637
  LRS.courseAttemptId = generateUUID(); // Unique per session for Xyleme correlation
630
638
  LRS.launchTime = new Date().toISOString();
@@ -2216,6 +2224,10 @@ function generateLrsBridgeCode(options) {
2216
2224
  info.id = window.location.href.split('#')[0].split('?')[0];
2217
2225
  }
2218
2226
 
2227
+ // Decode any HTML entities in title/description
2228
+ if (info.title) info.title = decodeEntities(info.title);
2229
+ if (info.description) info.description = decodeEntities(info.description);
2230
+
2219
2231
  // Build shared link name if not provided
2220
2232
  if (!info.sharedLinkName && info.title && info.sharedLinkToken) {
2221
2233
  info.sharedLinkName = info.title + ' - LMS Thin Pack';
@@ -2395,7 +2407,7 @@ function generateLrsBridgeCode(options) {
2395
2407
  id: window.location.href.split('#')[0].split('?')[0],
2396
2408
  definition: {
2397
2409
  type: 'http://xyleme.com/bravais/activities/document',
2398
- name: { 'en-US': document.title || 'Rise Course' }
2410
+ name: { 'en-US': decodeEntities(document.title) || 'Rise Course' }
2399
2411
  }
2400
2412
  };
2401
2413
  }
@@ -2426,10 +2438,11 @@ function generateLrsBridgeCode(options) {
2426
2438
  courseObj.definition.extensions = courseObj.definition.extensions || {};
2427
2439
 
2428
2440
  if (activityDetails) {
2429
- // Merge activity details into extensions
2441
+ // Merge activity details into extensions, decoding any HTML entities in string values
2430
2442
  for (var key in activityDetails) {
2431
2443
  if (activityDetails.hasOwnProperty(key)) {
2432
- courseObj.definition.extensions[key] = activityDetails[key];
2444
+ var val = activityDetails[key];
2445
+ courseObj.definition.extensions[key] = typeof val === 'string' ? decodeEntities(val) : val;
2433
2446
  }
2434
2447
  }
2435
2448
  }
@@ -2508,7 +2521,7 @@ function generateLrsBridgeCode(options) {
2508
2521
  id: LRS.courseInfo.id,
2509
2522
  definition: {
2510
2523
  type: 'http://xyleme.com/bravais/activities/document',
2511
- name: { 'en-US': LRS.courseInfo.title }
2524
+ name: { 'en-US': decodeEntities(LRS.courseInfo.title) }
2512
2525
  }
2513
2526
  };
2514
2527
 
@@ -2558,7 +2571,7 @@ function generateLrsBridgeCode(options) {
2558
2571
  objectType: 'Activity',
2559
2572
  definition: {
2560
2573
  type: 'http://xyleme.com/bravais/activities/document',
2561
- name: { 'en-US': LRS.courseInfo.title || 'Rise Course' }
2574
+ name: { 'en-US': decodeEntities(LRS.courseInfo.title) || 'Rise Course' }
2562
2575
  }
2563
2576
  };
2564
2577
 
@@ -4832,15 +4845,6 @@ function generateJsAfterLoader(options) {
4832
4845
  window.pa_patcher.loaded.jsAfter = true;
4833
4846
  }
4834
4847
  console.log('[PA-Patcher] Loading complete, content revealed');
4835
-
4836
- // Add visual badge to indicate patching is active
4837
- var badge = document.createElement('div');
4838
- badge.setAttribute('data-pa', 'badge');
4839
- badge.style.cssText = 'position:fixed;bottom:10px;right:10px;background:#4CAF50;color:white;padding:4px 8px;border-radius:4px;font-size:11px;font-family:sans-serif;z-index:999999;opacity:0.8;cursor:pointer;';
4840
- badge.textContent = 'PA';
4841
- badge.title = 'PA-Patcher Active';
4842
- badge.onclick = function() { badge.style.display = 'none'; };
4843
- document.body.appendChild(badge);
4844
4848
  }
4845
4849
 
4846
4850
  function loadJSWithFallback() {