@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/cli.cjs CHANGED
@@ -958,6 +958,14 @@ function generateLrsBridgeCode(options) {
958
958
  });
959
959
  }
960
960
 
961
+ // Decode HTML entities (e.g., " " & ') to clean text
962
+ function decodeEntities(str) {
963
+ if (!str || typeof str !== 'string') return str;
964
+ var txt = document.createElement('textarea');
965
+ txt.innerHTML = str;
966
+ return txt.value;
967
+ }
968
+
961
969
  LRS.sessionId = generateUUID();
962
970
  LRS.courseAttemptId = generateUUID(); // Unique per session for Xyleme correlation
963
971
  LRS.launchTime = new Date().toISOString();
@@ -2549,6 +2557,10 @@ function generateLrsBridgeCode(options) {
2549
2557
  info.id = window.location.href.split('#')[0].split('?')[0];
2550
2558
  }
2551
2559
 
2560
+ // Decode any HTML entities in title/description
2561
+ if (info.title) info.title = decodeEntities(info.title);
2562
+ if (info.description) info.description = decodeEntities(info.description);
2563
+
2552
2564
  // Build shared link name if not provided
2553
2565
  if (!info.sharedLinkName && info.title && info.sharedLinkToken) {
2554
2566
  info.sharedLinkName = info.title + ' - LMS Thin Pack';
@@ -2728,7 +2740,7 @@ function generateLrsBridgeCode(options) {
2728
2740
  id: window.location.href.split('#')[0].split('?')[0],
2729
2741
  definition: {
2730
2742
  type: 'http://xyleme.com/bravais/activities/document',
2731
- name: { 'en-US': document.title || 'Rise Course' }
2743
+ name: { 'en-US': decodeEntities(document.title) || 'Rise Course' }
2732
2744
  }
2733
2745
  };
2734
2746
  }
@@ -2759,10 +2771,11 @@ function generateLrsBridgeCode(options) {
2759
2771
  courseObj.definition.extensions = courseObj.definition.extensions || {};
2760
2772
 
2761
2773
  if (activityDetails) {
2762
- // Merge activity details into extensions
2774
+ // Merge activity details into extensions, decoding any HTML entities in string values
2763
2775
  for (var key in activityDetails) {
2764
2776
  if (activityDetails.hasOwnProperty(key)) {
2765
- courseObj.definition.extensions[key] = activityDetails[key];
2777
+ var val = activityDetails[key];
2778
+ courseObj.definition.extensions[key] = typeof val === 'string' ? decodeEntities(val) : val;
2766
2779
  }
2767
2780
  }
2768
2781
  }
@@ -2841,7 +2854,7 @@ function generateLrsBridgeCode(options) {
2841
2854
  id: LRS.courseInfo.id,
2842
2855
  definition: {
2843
2856
  type: 'http://xyleme.com/bravais/activities/document',
2844
- name: { 'en-US': LRS.courseInfo.title }
2857
+ name: { 'en-US': decodeEntities(LRS.courseInfo.title) }
2845
2858
  }
2846
2859
  };
2847
2860
 
@@ -2891,7 +2904,7 @@ function generateLrsBridgeCode(options) {
2891
2904
  objectType: 'Activity',
2892
2905
  definition: {
2893
2906
  type: 'http://xyleme.com/bravais/activities/document',
2894
- name: { 'en-US': LRS.courseInfo.title || 'Rise Course' }
2907
+ name: { 'en-US': decodeEntities(LRS.courseInfo.title) || 'Rise Course' }
2895
2908
  }
2896
2909
  };
2897
2910
 
@@ -5165,15 +5178,6 @@ function generateJsAfterLoader(options) {
5165
5178
  window.pa_patcher.loaded.jsAfter = true;
5166
5179
  }
5167
5180
  console.log('[PA-Patcher] Loading complete, content revealed');
5168
-
5169
- // Add visual badge to indicate patching is active
5170
- var badge = document.createElement('div');
5171
- badge.setAttribute('data-pa', 'badge');
5172
- 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;';
5173
- badge.textContent = 'PA';
5174
- badge.title = 'PA-Patcher Active';
5175
- badge.onclick = function() { badge.style.display = 'none'; };
5176
- document.body.appendChild(badge);
5177
5181
  }
5178
5182
 
5179
5183
  function loadJSWithFallback() {