@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.js CHANGED
@@ -948,6 +948,14 @@ function generateLrsBridgeCode(options) {
948
948
  });
949
949
  }
950
950
 
951
+ // Decode HTML entities (e.g., " " & ') to clean text
952
+ function decodeEntities(str) {
953
+ if (!str || typeof str !== 'string') return str;
954
+ var txt = document.createElement('textarea');
955
+ txt.innerHTML = str;
956
+ return txt.value;
957
+ }
958
+
951
959
  LRS.sessionId = generateUUID();
952
960
  LRS.courseAttemptId = generateUUID(); // Unique per session for Xyleme correlation
953
961
  LRS.launchTime = new Date().toISOString();
@@ -2539,6 +2547,10 @@ function generateLrsBridgeCode(options) {
2539
2547
  info.id = window.location.href.split('#')[0].split('?')[0];
2540
2548
  }
2541
2549
 
2550
+ // Decode any HTML entities in title/description
2551
+ if (info.title) info.title = decodeEntities(info.title);
2552
+ if (info.description) info.description = decodeEntities(info.description);
2553
+
2542
2554
  // Build shared link name if not provided
2543
2555
  if (!info.sharedLinkName && info.title && info.sharedLinkToken) {
2544
2556
  info.sharedLinkName = info.title + ' - LMS Thin Pack';
@@ -2718,7 +2730,7 @@ function generateLrsBridgeCode(options) {
2718
2730
  id: window.location.href.split('#')[0].split('?')[0],
2719
2731
  definition: {
2720
2732
  type: 'http://xyleme.com/bravais/activities/document',
2721
- name: { 'en-US': document.title || 'Rise Course' }
2733
+ name: { 'en-US': decodeEntities(document.title) || 'Rise Course' }
2722
2734
  }
2723
2735
  };
2724
2736
  }
@@ -2749,10 +2761,11 @@ function generateLrsBridgeCode(options) {
2749
2761
  courseObj.definition.extensions = courseObj.definition.extensions || {};
2750
2762
 
2751
2763
  if (activityDetails) {
2752
- // Merge activity details into extensions
2764
+ // Merge activity details into extensions, decoding any HTML entities in string values
2753
2765
  for (var key in activityDetails) {
2754
2766
  if (activityDetails.hasOwnProperty(key)) {
2755
- courseObj.definition.extensions[key] = activityDetails[key];
2767
+ var val = activityDetails[key];
2768
+ courseObj.definition.extensions[key] = typeof val === 'string' ? decodeEntities(val) : val;
2756
2769
  }
2757
2770
  }
2758
2771
  }
@@ -2831,7 +2844,7 @@ function generateLrsBridgeCode(options) {
2831
2844
  id: LRS.courseInfo.id,
2832
2845
  definition: {
2833
2846
  type: 'http://xyleme.com/bravais/activities/document',
2834
- name: { 'en-US': LRS.courseInfo.title }
2847
+ name: { 'en-US': decodeEntities(LRS.courseInfo.title) }
2835
2848
  }
2836
2849
  };
2837
2850
 
@@ -2881,7 +2894,7 @@ function generateLrsBridgeCode(options) {
2881
2894
  objectType: 'Activity',
2882
2895
  definition: {
2883
2896
  type: 'http://xyleme.com/bravais/activities/document',
2884
- name: { 'en-US': LRS.courseInfo.title || 'Rise Course' }
2897
+ name: { 'en-US': decodeEntities(LRS.courseInfo.title) || 'Rise Course' }
2885
2898
  }
2886
2899
  };
2887
2900
 
@@ -5155,15 +5168,6 @@ function generateJsAfterLoader(options) {
5155
5168
  window.pa_patcher.loaded.jsAfter = true;
5156
5169
  }
5157
5170
  console.log('[PA-Patcher] Loading complete, content revealed');
5158
-
5159
- // Add visual badge to indicate patching is active
5160
- var badge = document.createElement('div');
5161
- badge.setAttribute('data-pa', 'badge');
5162
- 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;';
5163
- badge.textContent = 'PA';
5164
- badge.title = 'PA-Patcher Active';
5165
- badge.onclick = function() { badge.style.display = 'none'; };
5166
- document.body.appendChild(badge);
5167
5171
  }
5168
5172
 
5169
5173
  function loadJSWithFallback() {