diff --git a/src/components/DeferredLoadTrigger.astro b/src/components/DeferredLoadTrigger.astro index 150d66179a..cbdd50df61 100644 --- a/src/components/DeferredLoadTrigger.astro +++ b/src/components/DeferredLoadTrigger.astro @@ -25,12 +25,41 @@ runCallback(cb); }; + // Default API: if the user already interacted earlier in the session, + // run immediately; otherwise wait for interaction on this page or the + // fallback timer. window.__deferOnInteraction = function (cb, fallbackMs) { if (fired) return runCallback(cb); const ms = typeof fallbackMs === 'number' ? fallbackMs : 2500; pending.set(cb, setTimeout(() => runOne(cb), ms)); }; + // Stricter sibling: ignore the session-engagement shortcut. Always wait + // for an interaction *on this page* (or the fallback timer). Use this + // for payloads heavy enough that even returning visitors shouldn't get + // them on the critical path — e.g. third-party chat widgets that + // inject their own font CSS. + window.__deferUntilInteraction = function (cb, fallbackMs) { + const ms = typeof fallbackMs === 'number' ? fallbackMs : 2500; + let cleanup = () => {}; + if (fired) { + // Already-engaged users still get the widget after a real + // interaction on this page; but since `fire` already ran and + // removed its listeners, re-arm a single lightweight listener + // just to flush whatever is now pending. + const flush = () => { + cleanup(); + for (const cb of [...pending.keys()]) runOne(cb); + }; + cleanup = () => events.forEach((e) => window.removeEventListener(e, flush)); + events.forEach((e) => window.addEventListener(e, flush, { once: true, passive: true })); + } + pending.set(cb, setTimeout(() => { + cleanup(); + runOne(cb); + }, ms)); + }; + const events = ['pointerdown', 'keydown', 'scroll', 'touchstart']; const fire = () => { if (fired) return; diff --git a/src/components/Pricing/CalculatorModal.astro b/src/components/Pricing/CalculatorModal.astro index 440af8fc1e..302e983f1d 100644 --- a/src/components/Pricing/CalculatorModal.astro +++ b/src/components/Pricing/CalculatorModal.astro @@ -1379,12 +1379,31 @@ const { id } = Astro.props as Props; // ─── Shared slider utilities (global) ─── + // Cache the two theme-dependent CSS custom properties on `window` so + // continuous slider `input` events don't force a fresh style recalc per call. + // State lives on `window` because this `is:inline` script is inlined once per + // instance on the page — a block-scoped `let` would throw + // "already declared" on the 2nd/3rd inlining. Bust the cache when Starlight + // flips `data-theme` on . + function _readSliderColors() { + const cs = getComputedStyle(document.documentElement); + window._sliderColors = { + primary: cs.getPropertyValue('--sl-color-text-accent').trim() || '#3D50F5', + track: cs.getPropertyValue('--sl-color-gray-5').trim() || '#E0E1E2', + }; + return window._sliderColors; + } + if (!window._sliderColorsObserved) { + window._sliderColorsObserved = true; + new MutationObserver(function() { window._sliderColors = null; }) + .observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme'] }); + } + /** Update slider track fill via background linear-gradient */ window.sliderProgress = function(slider) { const progress = ((parseFloat(slider.value) - parseFloat(slider.min)) / (parseFloat(slider.max) - parseFloat(slider.min))) * 100; - const primary = getComputedStyle(document.documentElement).getPropertyValue('--sl-color-text-accent').trim() || '#3D50F5'; - const track = getComputedStyle(document.documentElement).getPropertyValue('--sl-color-gray-5').trim() || '#E0E1E2'; - slider.style.background = 'linear-gradient(to right, ' + primary + ' ' + progress + '%, ' + track + ' ' + progress + '%)'; + const c = window._sliderColors || _readSliderColors(); + slider.style.background = 'linear-gradient(to right, ' + c.primary + ' ' + progress + '%, ' + c.track + ' ' + progress + '%)'; }; /** Position tick marks using JS (compensates for thumb width) */ diff --git a/src/components/Pricing/CommunityEditionCard.astro b/src/components/Pricing/CommunityEditionCard.astro index 1798903ae4..14db4c0d88 100644 --- a/src/components/Pricing/CommunityEditionCard.astro +++ b/src/components/Pricing/CommunityEditionCard.astro @@ -25,7 +25,13 @@ const { data } = Astro.props; ))}
- + {data.ctaText} {data.secondaryCtaText && ( @@ -34,7 +40,13 @@ const { data } = Astro.props; variant="outlined" size="sm" class="gtm_button" - onclick={data.secondaryCtaHref ? undefined : data.secondaryCtaOnclick} + onclick={ + data.secondaryCtaHref + ? undefined + : data.secondaryCtaOnclick + ? `event.preventDefault();${data.secondaryCtaOnclick}` + : undefined + } target={data.secondaryCtaHref ? '_blank' : undefined} rel={data.secondaryCtaHref ? 'noopener noreferrer' : undefined} > diff --git a/src/components/Pricing/ProductSubTabs.astro b/src/components/Pricing/ProductSubTabs.astro index 9ce3f57b84..9a08274bdb 100644 --- a/src/components/Pricing/ProductSubTabs.astro +++ b/src/components/Pricing/ProductSubTabs.astro @@ -22,7 +22,6 @@ const { product, tabs } = Astro.props; ---
-
{tabs.map((tab) => (