From 1fda8649acf461e0459342bea9df972c6e68cf99 Mon Sep 17 00:00:00 2001 From: Sean Steimer Date: Thu, 27 Aug 2026 07:45:34 -0700 Subject: [PATCH 1/2] fix(test): update stale codeBasePath expectation in setup test PR #205 changed codeBasePath derivation to import.meta.url but left one assertion expecting the old DOM-based path. Co-Authored-By: Sean Steimer --- test/setup/setup.test.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/setup/setup.test.html b/test/setup/setup.test.html index acacab4..aa3cd58 100644 --- a/test/setup/setup.test.html +++ b/test/setup/setup.test.html @@ -42,7 +42,7 @@ it('init - sets sampleRUM.collectBaseURL to include the codeBasePath', () => { init(); - expect(sampleRUM.collectBaseURL.href).to.be.equal(`${window.origin}/some/path/`); + expect(sampleRUM.collectBaseURL.href).to.be.equal(`${window.origin}/src/setup.js/`); }); }); From 7e4c13f1c81d5f6324538327ab029d331cecdec5 Mon Sep 17 00:00:00 2001 From: Sean Steimer Date: Thu, 27 Aug 2026 07:45:59 -0700 Subject: [PATCH 2/2] chore: rebuild dist dist/aem.js was stale relative to src changes in #205 and #242. Co-Authored-By: Sean Steimer --- dist/aem.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/dist/aem.js b/dist/aem.js index 3723b0d..81c6d47 100644 --- a/dist/aem.js +++ b/dist/aem.js @@ -28,7 +28,6 @@ function sampleRUM(checkpoint, data) { on: 1, off: 0, high: 10, - medium: 100, low: 1000, }[rate]; const weight = rateValue !== undefined ? rateValue : 100; @@ -94,18 +93,14 @@ function sampleRUM(checkpoint, data) { sampleRUM.baseURL = sampleRUM.baseURL || new URL(window.RUM_BASE || '/', new URL('https://ot.aem.live')); sampleRUM.collectBaseURL = sampleRUM.collectBaseURL || sampleRUM.baseURL; sampleRUM.sendPing = (ck, time, pingData = {}) => { - const uaExtra = navigator.webdriver && !navigator.userAgent.includes('+http') - ? { ua: `${navigator.userAgent} +http://navigator.webdriver` } - : {}; // eslint-disable-next-line max-len, object-curly-newline const rumData = JSON.stringify({ weight, id, - referer: window.location.origin + window.location.pathname, + referer: window.location.href, checkpoint: ck, t: time, ...pingData, - ...uaExtra, }); const urlParams = window.RUM_PARAMS ? new URLSearchParams(window.RUM_PARAMS).toString() || '' @@ -125,9 +120,7 @@ function sampleRUM(checkpoint, data) { sampleRUM.enhance = () => { // only enhance once - if (document.querySelector('script[src*="rum-enhancer"]')) { - return; - } + if (document.querySelector('script[src*="rum-enhancer"]')) return; const { enhancerVersion, enhancerHash } = sampleRUM.enhancerContext || {}; const script = document.createElement('script'); if (enhancerHash) { @@ -157,22 +150,21 @@ function sampleRUM(checkpoint, data) { /** * Setup block utils. */ -function setup() { +function setup(importUrl = import.meta.url) { window.hlx = window.hlx || {}; window.hlx.RUM_MASK_URL = 'full'; window.hlx.RUM_MANUAL_ENHANCE = true; window.hlx.lighthouse = new URLSearchParams(window.location.search).get('lighthouse') === 'on'; - [window.hlx.codeBasePath] = new URL(import.meta.url).pathname.split('/scripts/'); + [window.hlx.codeBasePath] = new URL(importUrl).pathname.split('/scripts/'); } /** * Auto initialization. */ - function init() { setup(); - sampleRUM.collectBaseURL = window.origin; + sampleRUM.collectBaseURL = new URL(`${window.hlx.codeBasePath}/`, window.origin); sampleRUM(); }