@@ -53,38 +53,142 @@ const shouldRenderSearch =
5353 }
5454</style >
5555
56- <script type =" text/javascript" defer is:inline >
57- /* eslint @typescript-eslint/no-unused-expressions: "off" */
58- !(function (e, t, n) {
59- function a() {
60- var e = t.getElementsByTagName('script')[0],
61- n = t.createElement('script');
62- ((n.type = 'text/javascript'),
63- (n.async = !0),
64- (n.src = 'https://beacon-v2.helpscout.net'),
65- e.parentNode.insertBefore(n, e));
66- }
67- if (
68- ((e.Beacon = n =
69- function (t, n, a) {
70- e.Beacon.readyQueue.push({ method: t, options: n, data: a });
71- }),
72- (n.readyQueue = []),
73- 'complete' === t.readyState)
74- )
75- return a();
76- e.attachEvent ? e.attachEvent('onload', a) : e.addEventListener('load', a, !1);
77- })(window, document, window.Beacon || function () {});
78- </script >
79- {
80- import .meta .env .MODE === ' production' && (
81- <script type = " text/javascript" defer is :inline >
82- window.Beacon('init', '57a7245e-772c-4d51-bdb1-6b898f34f2cb');
83- </script >
84- )
85- }
86-
8756<script >
8857 import '/src/v1/scripts/lenis-parallax.js';
8958 import '/src/v1/scripts/glossary-tooltip.js';
9059</script >
60+
61+ { /* HelpScout Beacon open trigger handler */ }
62+ <script >
63+ document.addEventListener('DOMContentLoaded', function () {
64+ const beaconTriggers = document.querySelectorAll('.open-beacon');
65+ beaconTriggers.forEach((trigger) => {
66+ trigger.addEventListener('click', function (e) {
67+ e.preventDefault();
68+ // @ts-expect-error Beacon is loaded from HelpScout script
69+ if (window.Beacon) {
70+ // @ts-expect-error Beacon is loaded from HelpScout script
71+ window.Beacon('open');
72+ }
73+ });
74+ });
75+ });
76+ </script >
77+
78+ { /* Hyperping Status Badge - Load on idle to not block main thread */ }
79+ <script is:inline >
80+ /* eslint-disable no-undef */
81+ (function () {
82+ function initHyperping() {
83+ var script = document.createElement('script');
84+ script.src = 'https://hyperping.com/badge.js';
85+ script.async = true;
86+ script.onload = function () {
87+ if (typeof Hyperping !== 'undefined') {
88+ Hyperping.init({
89+ statuspage: 'https://www.datumstatus.com',
90+ border: 'none',
91+ borderColor: '#30363D',
92+ uptime: false,
93+ dot: true,
94+ dotSize: 10,
95+ isNeutral: false,
96+ dotOk: '#2BAC76',
97+ dotIncident: '#FFAF36',
98+ dotOutage: '#E95858',
99+ dotMaintenance: '#0070F3',
100+ dotNeutral: '#0070F3',
101+ operational: 'All systems normal',
102+ incident: 'Under investigation',
103+ outage: 'System outage',
104+ maintenance: 'Under maintenance',
105+ });
106+ }
107+ };
108+ document.body.appendChild(script);
109+ }
110+ // Load on idle or after 3s timeout (whichever comes first)
111+ if ('requestIdleCallback' in window) {
112+ requestIdleCallback(initHyperping, { timeout: 3000 });
113+ } else {
114+ setTimeout(initHyperping, 2000);
115+ }
116+ })();
117+ </script >
118+
119+ { /* HelpScout Beacon - Deferred loading on idle */ }
120+ <script is:inline data-production ={ import .meta .env .PROD ? ' true' : ' false' } >
121+ (function () {
122+ var isProduction = document.currentScript.getAttribute('data-production') === 'true';
123+ if (!isProduction) return;
124+
125+ function loadHelpScout() {
126+ if (window.__helpScoutLoaded) return;
127+ window.__helpScoutLoaded = true;
128+
129+ // Initialize Beacon stub
130+ window.Beacon =
131+ window.Beacon ||
132+ function (method, options, data) {
133+ window.Beacon.readyQueue = window.Beacon.readyQueue || [];
134+ window.Beacon.readyQueue.push({ method: method, options: options, data: data });
135+ };
136+ window.Beacon.readyQueue = [];
137+
138+ // Load HelpScout script
139+ var script = document.createElement('script');
140+ script.type = 'text/javascript';
141+ script.async = true;
142+ script.src = 'https://beacon-v2.helpscout.net';
143+ script.onload = function () {
144+ window.Beacon('init', '57a7245e-772c-4d51-bdb1-6b898f34f2cb');
145+ };
146+ document.body.appendChild(script);
147+ }
148+
149+ // Load HelpScout on first user interaction or after 5s
150+ var events = ['mousemove', 'touchstart', 'scroll', 'keydown'];
151+ var loaded = false;
152+
153+ function onInteraction() {
154+ if (loaded) return;
155+ loaded = true;
156+ events.forEach(function (e) {
157+ document.removeEventListener(e, onInteraction);
158+ });
159+ loadHelpScout();
160+ }
161+
162+ events.forEach(function (e) {
163+ document.addEventListener(e, onInteraction, { once: true, passive: true });
164+ });
165+
166+ // Fallback: load after 5 seconds if no interaction
167+ setTimeout(function () {
168+ if (!loaded) {
169+ loaded = true;
170+ loadHelpScout();
171+ }
172+ }, 5000);
173+ })();
174+ </script >
175+
176+ { /* Marker.io - Load on idle for feedback collection */ }
177+ <script is:inline data-production ={ import .meta .env .PROD ? ' true' : ' false' } >
178+ (function () {
179+ var isProduction = document.currentScript.getAttribute('data-production') === 'true';
180+ if (!isProduction) return;
181+
182+ function loadMarker() {
183+ var script = document.createElement('script');
184+ script.src = '/scripts/markerio.js';
185+ script.defer = true;
186+ document.body.appendChild(script);
187+ }
188+ if ('requestIdleCallback' in window) {
189+ requestIdleCallback(loadMarker, { timeout: 4000 });
190+ } else {
191+ setTimeout(loadMarker, 3000);
192+ }
193+ })();
194+ </script >
0 commit comments