@patch-adams/core 1.4.25 → 1.4.26

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
@@ -622,13 +622,13 @@ html.${htmlClass}.${loadingClass} body {
622
622
  var link = loadCSSSync(REMOTE_URL);
623
623
 
624
624
  link.onerror = function() {
625
- console.warn('[Patch-Adams] CSS before failed to load from remote, using local fallback');
625
+ console.warn('[PA-Patcher] CSS before failed to load from remote, using local fallback');
626
626
  document.head.removeChild(link);
627
627
  loadCSSSync(LOCAL_PATH);
628
628
  };
629
629
 
630
630
  link.onload = function() {
631
- console.log('[Patch-Adams] CSS before loaded from remote:', REMOTE_URL);
631
+ console.log('[PA-Patcher] CSS before loaded from remote:', REMOTE_URL);
632
632
  };
633
633
  })();
634
634
  </script>`;
@@ -682,7 +682,7 @@ function generateCssAfterLoader(options) {
682
682
  if (loaded) return;
683
683
  loaded = true;
684
684
  clearTimeout(timeoutId);
685
- console.log('[Patch-Adams] CSS after loaded from remote:', REMOTE_URL);
685
+ console.log('[PA-Patcher] CSS after loaded from remote:', REMOTE_URL);
686
686
  },
687
687
  function() {
688
688
  if (loaded) return;
@@ -696,7 +696,7 @@ function generateCssAfterLoader(options) {
696
696
  timeoutId = setTimeout(function() {
697
697
  if (loaded) return;
698
698
  loaded = true;
699
- console.warn('[Patch-Adams] CSS after timed out, using local fallback');
699
+ console.warn('[PA-Patcher] CSS after timed out, using local fallback');
700
700
  if (remoteLink.parentNode) {
701
701
  document.head.removeChild(remoteLink);
702
702
  }
@@ -708,10 +708,10 @@ function generateCssAfterLoader(options) {
708
708
  loadCSS(
709
709
  LOCAL_PATH,
710
710
  function() {
711
- console.log('[Patch-Adams] CSS after loaded from local fallback:', LOCAL_PATH);
711
+ console.log('[PA-Patcher] CSS after loaded from local fallback:', LOCAL_PATH);
712
712
  },
713
713
  function() {
714
- console.error('[Patch-Adams] CSS after failed to load from both remote and local');
714
+ console.error('[PA-Patcher] CSS after failed to load from both remote and local');
715
715
  }
716
716
  );
717
717
  }
@@ -1676,7 +1676,9 @@ function generateLrsBridgeCode(options) {
1676
1676
  ((employee.fname || employee.firstName || '') + ' ' + (employee.lname || employee.lastName || '')).trim(),
1677
1677
  firstName: employee.fname || employee.firstName || employee.first_name,
1678
1678
  lastName: employee.lname || employee.lastName || employee.last_name,
1679
- employeeId: employee.emp_id || employee.employeeId || employee.employee_id || employeeId
1679
+ employeeId: employee.emp_id || employee.employeeId || employee.employee_id || employeeId,
1680
+ bravaisUserId: employee.bravaisUserId || null,
1681
+ tenantUrl: employee.tenantUrl || null
1680
1682
  };
1681
1683
  log('Parsed employee data:', employeeLookupData);
1682
1684
  // Persist to localStorage for cross-session caching
@@ -1750,6 +1752,16 @@ function generateLrsBridgeCode(options) {
1750
1752
  if (employeeData.name && (!actor.name || actor.name === 'Unknown Learner')) {
1751
1753
  actor.name = employeeData.name;
1752
1754
  }
1755
+
1756
+ // Update account with Bravais user ID and tenant URL if available
1757
+ if (employeeData.bravaisUserId) {
1758
+ var originalAccountName = actor.account ? actor.account.name : null;
1759
+ actor.account = {
1760
+ name: employeeData.bravaisUserId,
1761
+ homePage: employeeData.tenantUrl || (actor.account && actor.account.homePage) || window.location.origin
1762
+ };
1763
+ log('Updated actor account: bravaisUserId=' + employeeData.bravaisUserId + ', homePage=' + actor.account.homePage + ' (was: ' + originalAccountName + ')');
1764
+ }
1753
1765
  }
1754
1766
  callback(actor);
1755
1767
  });
@@ -2414,7 +2426,7 @@ function generateLrsBridgeCode(options) {
2414
2426
  tenantHomepage: null // https://{tenant}.bravais.com format
2415
2427
  };
2416
2428
 
2417
- // 0. Use baked-in GUIDs from Patch-Adams config (highest priority - set at wrap time)
2429
+ // 0. Use baked-in GUIDs from PA-Patcher config (highest priority - set at wrap time)
2418
2430
  if (DOCUMENT_GUID) {
2419
2431
  info.guid = DOCUMENT_GUID;
2420
2432
  info.id = 'http://xyleme.com/bravais/document/' + DOCUMENT_GUID;
@@ -2923,6 +2935,11 @@ function generateLrsBridgeCode(options) {
2923
2935
  // Publish index (default to 1)
2924
2936
  ctx.extensions['publishIndex'] = (LRS.courseInfo && LRS.courseInfo.publishIndex) ? LRS.courseInfo.publishIndex : 1;
2925
2937
 
2938
+ // Employee ID from employee lookup (if available)
2939
+ if (employeeLookupData && employeeLookupData.employeeId) {
2940
+ ctx.extensions['employeeId'] = employeeLookupData.employeeId;
2941
+ }
2942
+
2926
2943
  // Xyleme schema version and PII flag
2927
2944
  ctx.extensions['http://xyleme.com/bravais/extensions/statement-schema'] = 'xyleme_10';
2928
2945
  ctx.extensions['http://xyleme.com/bravais/extensions/protect_pii'] = false;
@@ -4591,7 +4608,7 @@ ${courseLines.join("\n")}
4591
4608
  },` : "";
4592
4609
  return `<!-- === PATCH-ADAMS: JS BEFORE (blocking) === -->
4593
4610
  <script data-pa="js-before-loader">
4594
- // Initialize Patch-Adams global namespace IMMEDIATELY (before IIFE)
4611
+ // Initialize PA-Patcher global namespace IMMEDIATELY (before IIFE)
4595
4612
  window.pa_patcher = window.pa_patcher || {
4596
4613
  version: '1.0.25',
4597
4614
  htmlClass: '${htmlClass}',
@@ -4636,7 +4653,7 @@ window.pa_patcher = window.pa_patcher || {
4636
4653
  if (isExtensionError(event.reason)) {
4637
4654
  event.preventDefault();
4638
4655
  event.stopImmediatePropagation();
4639
- console.debug('[Patch-Adams] Suppressed browser extension error:', event.reason);
4656
+ console.debug('[PA-Patcher] Suppressed browser extension error:', event.reason);
4640
4657
  return false;
4641
4658
  }
4642
4659
  }, true);
@@ -4646,7 +4663,7 @@ window.pa_patcher = window.pa_patcher || {
4646
4663
  if (isExtensionError(event.error || event.message)) {
4647
4664
  event.preventDefault();
4648
4665
  event.stopImmediatePropagation();
4649
- console.debug('[Patch-Adams] Suppressed browser extension error:', event.message);
4666
+ console.debug('[PA-Patcher] Suppressed browser extension error:', event.message);
4650
4667
  return false;
4651
4668
  }
4652
4669
  }, true);
@@ -4671,17 +4688,17 @@ window.pa_patcher = window.pa_patcher || {
4671
4688
  var script = loadJSSync(REMOTE_URL);
4672
4689
 
4673
4690
  script.onerror = function() {
4674
- console.warn('[Patch-Adams] JS before failed to load from remote, using local fallback');
4691
+ console.warn('[PA-Patcher] JS before failed to load from remote, using local fallback');
4675
4692
  document.head.removeChild(script);
4676
4693
  var fallback = loadJSSync(LOCAL_PATH);
4677
4694
  fallback.onload = function() {
4678
4695
  if (window.pa_patcher && window.pa_patcher.loaded) {
4679
4696
  window.pa_patcher.loaded.jsBefore = true;
4680
4697
  }
4681
- console.log('[Patch-Adams] JS before loaded from local fallback:', LOCAL_PATH);
4698
+ console.log('[PA-Patcher] JS before loaded from local fallback:', LOCAL_PATH);
4682
4699
  };
4683
4700
  fallback.onerror = function() {
4684
- console.error('[Patch-Adams] JS before failed to load from both remote and local');
4701
+ console.error('[PA-Patcher] JS before failed to load from both remote and local');
4685
4702
  };
4686
4703
  };
4687
4704
 
@@ -4689,7 +4706,7 @@ window.pa_patcher = window.pa_patcher || {
4689
4706
  if (window.pa_patcher && window.pa_patcher.loaded) {
4690
4707
  window.pa_patcher.loaded.jsBefore = true;
4691
4708
  }
4692
- console.log('[Patch-Adams] JS before loaded from remote:', REMOTE_URL);
4709
+ console.log('[PA-Patcher] JS before loaded from remote:', REMOTE_URL);
4693
4710
  };
4694
4711
  })();
4695
4712
  ${lrsBridgeCode}
@@ -4760,14 +4777,14 @@ function generateJsAfterLoader(options) {
4760
4777
  if (window.pa_patcher && window.pa_patcher.loaded) {
4761
4778
  window.pa_patcher.loaded.jsAfter = true;
4762
4779
  }
4763
- console.log('[Patch-Adams] Loading complete, content revealed');
4780
+ console.log('[PA-Patcher] Loading complete, content revealed');
4764
4781
 
4765
4782
  // Add visual badge to indicate patching is active
4766
4783
  var badge = document.createElement('div');
4767
4784
  badge.setAttribute('data-pa', 'badge');
4768
4785
  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;';
4769
4786
  badge.textContent = 'PA';
4770
- badge.title = 'Patch-Adams Active';
4787
+ badge.title = 'PA-Patcher Active';
4771
4788
  badge.onclick = function() { badge.style.display = 'none'; };
4772
4789
  document.body.appendChild(badge);
4773
4790
  }
@@ -4783,7 +4800,7 @@ function generateJsAfterLoader(options) {
4783
4800
  if (loaded) return;
4784
4801
  loaded = true;
4785
4802
  clearTimeout(timeoutId);
4786
- console.log('[Patch-Adams] JS after loaded from remote:', REMOTE_URL);
4803
+ console.log('[PA-Patcher] JS after loaded from remote:', REMOTE_URL);
4787
4804
  // Give the script a moment to execute, then remove loading class
4788
4805
  setTimeout(removeLoadingClass, 50);
4789
4806
  },
@@ -4799,7 +4816,7 @@ function generateJsAfterLoader(options) {
4799
4816
  timeoutId = setTimeout(function() {
4800
4817
  if (loaded) return;
4801
4818
  loaded = true;
4802
- console.warn('[Patch-Adams] JS after timed out, using local fallback');
4819
+ console.warn('[PA-Patcher] JS after timed out, using local fallback');
4803
4820
  if (remoteScript.parentNode) {
4804
4821
  document.body.removeChild(remoteScript);
4805
4822
  }
@@ -4811,11 +4828,11 @@ function generateJsAfterLoader(options) {
4811
4828
  loadJS(
4812
4829
  LOCAL_PATH,
4813
4830
  function() {
4814
- console.log('[Patch-Adams] JS after loaded from local fallback:', LOCAL_PATH);
4831
+ console.log('[PA-Patcher] JS after loaded from local fallback:', LOCAL_PATH);
4815
4832
  setTimeout(removeLoadingClass, 50);
4816
4833
  },
4817
4834
  function() {
4818
- console.error('[Patch-Adams] JS after failed to load from both remote and local');
4835
+ console.error('[PA-Patcher] JS after failed to load from both remote and local');
4819
4836
  // Still remove loading class so content is visible even if JS fails
4820
4837
  removeLoadingClass();
4821
4838
  }
@@ -5275,7 +5292,7 @@ var ManifestUpdater = class {
5275
5292
  const resourceClosePattern = /(\s*)<\/resource>/i;
5276
5293
  const match = xmlContent.match(resourceClosePattern);
5277
5294
  if (!match) {
5278
- console.warn("[Patch-Adams] Could not find </resource> tag in imsmanifest.xml");
5295
+ console.warn("[PA-Patcher] Could not find </resource> tag in imsmanifest.xml");
5279
5296
  return [];
5280
5297
  }
5281
5298
  const updatedXml = xmlContent.replace(
@@ -5287,7 +5304,7 @@ $1</resource>`
5287
5304
  zip.updateFile("imsmanifest.xml", Buffer.from(updatedXml, "utf-8"));
5288
5305
  return ["imsmanifest.xml"];
5289
5306
  } catch (error) {
5290
- console.error("[Patch-Adams] Failed to update imsmanifest.xml:", error);
5307
+ console.error("[PA-Patcher] Failed to update imsmanifest.xml:", error);
5291
5308
  return [];
5292
5309
  }
5293
5310
  }
@@ -5609,7 +5626,7 @@ ${js.after}
5609
5626
  var pluginRegistry = new PluginRegistry();
5610
5627
 
5611
5628
  // src/patcher/index.ts
5612
- var DEFAULT_CSS_BEFORE = `/* Patch-Adams: CSS Before (blocking)
5629
+ var DEFAULT_CSS_BEFORE = `/* PA-Patcher: CSS Before (blocking)
5613
5630
  * This file loads at the start of <head> and blocks rendering.
5614
5631
  * Use it to hide content and prevent flash of unstyled content.
5615
5632
  *
@@ -5619,7 +5636,7 @@ var DEFAULT_CSS_BEFORE = `/* Patch-Adams: CSS Before (blocking)
5619
5636
  * }
5620
5637
  */
5621
5638
  `;
5622
- var DEFAULT_CSS_AFTER = `/* Patch-Adams: CSS After (async)
5639
+ var DEFAULT_CSS_AFTER = `/* PA-Patcher: CSS After (async)
5623
5640
  * This file loads at the end of <head> with remote fallback.
5624
5641
  * Use it for style overrides that take precedence over Rise styles.
5625
5642
  *
@@ -5629,7 +5646,7 @@ var DEFAULT_CSS_AFTER = `/* Patch-Adams: CSS After (async)
5629
5646
  * }
5630
5647
  */
5631
5648
  `;
5632
- var DEFAULT_JS_BEFORE = `// Patch-Adams: JS Before (blocking)
5649
+ var DEFAULT_JS_BEFORE = `// PA-Patcher: JS Before (blocking)
5633
5650
  // This file loads at the start of <head> and blocks rendering.
5634
5651
  // Use it for setup, API interception, and preparing globals.
5635
5652
  //
@@ -5639,9 +5656,9 @@ var DEFAULT_JS_BEFORE = `// Patch-Adams: JS Before (blocking)
5639
5656
  // analytics: true
5640
5657
  // };
5641
5658
 
5642
- console.log('[Patch-Adams] JS Before loaded');
5659
+ console.log('[PA-Patcher] JS Before loaded');
5643
5660
  `;
5644
- var DEFAULT_JS_AFTER = `// Patch-Adams: JS After (async)
5661
+ var DEFAULT_JS_AFTER = `// PA-Patcher: JS After (async)
5645
5662
  // This file loads at the end of <body> with remote fallback.
5646
5663
  // Use it for DOM manipulation after Rise has initialized.
5647
5664
  //
@@ -5653,7 +5670,7 @@ var DEFAULT_JS_AFTER = `// Patch-Adams: JS After (async)
5653
5670
  // // Your modifications here
5654
5671
  // });
5655
5672
 
5656
- console.log('[Patch-Adams] JS After loaded');
5673
+ console.log('[PA-Patcher] JS After loaded');
5657
5674
  `;
5658
5675
  var Patcher = class {
5659
5676
  config;