chore: update package-lock.json and refactor index.html for improved readability
- Updated dependencies in package-lock.json, downgrading several @esbuild packages to version 0.17.19 and adjusting node engine requirements to >=12. - Refactored index.html to enhance readability by consolidating script loading logic and improving formatting. - Removed unnecessary comments and whitespace for cleaner code structure.
This commit is contained in:
905
worklenz-backend/package-lock.json
generated
905
worklenz-backend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -21,21 +21,22 @@
|
|||||||
// Load the Google Analytics script
|
// Load the Google Analytics script
|
||||||
const script = document.createElement('script');
|
const script = document.createElement('script');
|
||||||
script.async = true;
|
script.async = true;
|
||||||
|
|
||||||
// Determine which tracking ID to use based on the environment
|
// Determine which tracking ID to use based on the environment
|
||||||
const isProduction = window.location.hostname === 'worklenz.com' ||
|
const isProduction =
|
||||||
window.location.hostname === 'app.worklenz.com';
|
window.location.hostname === 'worklenz.com' ||
|
||||||
|
window.location.hostname === 'app.worklenz.com';
|
||||||
const trackingId = isProduction
|
|
||||||
? 'G-XXXXXXXXXX'
|
const trackingId = isProduction ? 'G-XXXXXXXXXX' : 'G-3LM2HGWEXG'; // Open source tracking ID
|
||||||
: 'G-3LM2HGWEXG'; // Open source tracking ID
|
|
||||||
|
|
||||||
script.src = `https://www.googletagmanager.com/gtag/js?id=${trackingId}`;
|
script.src = `https://www.googletagmanager.com/gtag/js?id=${trackingId}`;
|
||||||
document.head.appendChild(script);
|
document.head.appendChild(script);
|
||||||
|
|
||||||
// Initialize Google Analytics
|
// Initialize Google Analytics
|
||||||
window.dataLayer = window.dataLayer || [];
|
window.dataLayer = window.dataLayer || [];
|
||||||
function gtag(){dataLayer.push(arguments);}
|
function gtag() {
|
||||||
|
dataLayer.push(arguments);
|
||||||
|
}
|
||||||
gtag('js', new Date());
|
gtag('js', new Date());
|
||||||
gtag('config', trackingId);
|
gtag('config', trackingId);
|
||||||
}
|
}
|
||||||
@@ -69,7 +70,7 @@
|
|||||||
document.body.appendChild(notice);
|
document.body.appendChild(notice);
|
||||||
// Add event listener to button
|
// Add event listener to button
|
||||||
const btn = notice.querySelector('#analytics-notice-btn');
|
const btn = notice.querySelector('#analytics-notice-btn');
|
||||||
btn.addEventListener('click', function(e) {
|
btn.addEventListener('click', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
localStorage.setItem('privacyNoticeShown', 'true');
|
localStorage.setItem('privacyNoticeShown', 'true');
|
||||||
notice.remove();
|
notice.remove();
|
||||||
@@ -77,12 +78,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Wait for DOM to be ready
|
// Wait for DOM to be ready
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
// Check if we should show the notice
|
// Check if we should show the notice
|
||||||
const isProduction = window.location.hostname === 'worklenz.com' ||
|
const isProduction =
|
||||||
window.location.hostname === 'app.worklenz.com';
|
window.location.hostname === 'worklenz.com' ||
|
||||||
|
window.location.hostname === 'app.worklenz.com';
|
||||||
const noticeShown = localStorage.getItem('privacyNoticeShown') === 'true';
|
const noticeShown = localStorage.getItem('privacyNoticeShown') === 'true';
|
||||||
|
|
||||||
// Show notice if not in production and not shown before
|
// Show notice if not in production and not shown before
|
||||||
if (!isProduction && !noticeShown) {
|
if (!isProduction && !noticeShown) {
|
||||||
showPrivacyNotice();
|
showPrivacyNotice();
|
||||||
@@ -91,64 +93,20 @@
|
|||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<head>
|
<body>
|
||||||
<meta charset="utf-8" />
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
<link rel="icon" href="./favicon.ico" />
|
<div id="root"></div>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<script type="module" src="./src/index.tsx"></script>
|
||||||
<meta name="theme-color" content="#2b2b2b" />
|
<script type="text/javascript">
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
if (window.location.hostname === 'app.worklenz.com') {
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
var hs = document.createElement('script');
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap"
|
hs.type = 'text/javascript';
|
||||||
rel="stylesheet" />
|
hs.id = 'hs-script-loader';
|
||||||
<title>Worklenz</title>
|
hs.async = true;
|
||||||
|
hs.defer = true;
|
||||||
<!-- Environment configuration -->
|
hs.src = '//js.hs-scripts.com/22348300.js';
|
||||||
<script src="/env-config.js"></script>
|
document.body.appendChild(hs);
|
||||||
<!-- Unregister service worker -->
|
}
|
||||||
<script src="/unregister-sw.js"></script>
|
</script>
|
||||||
<!-- Microsoft Clarity -->
|
</body>
|
||||||
<script type="text/javascript">
|
</html>
|
||||||
if (window.location.hostname === 'app.worklenz.com') {
|
|
||||||
(function (c, l, a, r, i, t, y) {
|
|
||||||
c[a] = c[a] || function () { (c[a].q = c[a].q || []).push(arguments) };
|
|
||||||
t = l.createElement(r); t.async = 1; t.src = "https://www.clarity.ms/tag/dx77073klh";
|
|
||||||
y = l.getElementsByTagName(r)[0]; y.parentNode.insertBefore(t, y);
|
|
||||||
})(window, document, "clarity", "script", "dx77073klh");
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<!-- Google Analytics (only on production) -->
|
|
||||||
<script type="text/javascript">
|
|
||||||
if (window.location.hostname === 'app.worklenz.com') {
|
|
||||||
var gaScript = document.createElement('script');
|
|
||||||
gaScript.async = true;
|
|
||||||
gaScript.src = 'https://www.googletagmanager.com/gtag/js?id=G-7KSRKQ1397';
|
|
||||||
document.head.appendChild(gaScript);
|
|
||||||
|
|
||||||
gaScript.onload = function() {
|
|
||||||
window.dataLayer = window.dataLayer || [];
|
|
||||||
function gtag(){dataLayer.push(arguments);}
|
|
||||||
gtag('js', new Date());
|
|
||||||
gtag('config', 'G-7KSRKQ1397');
|
|
||||||
};
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
||||||
<div id="root"></div>
|
|
||||||
<script type="module" src="./src/index.tsx"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
if (window.location.hostname === 'app.worklenz.com') {
|
|
||||||
var hs = document.createElement('script');
|
|
||||||
hs.type = 'text/javascript';
|
|
||||||
hs.id = 'hs-script-loader';
|
|
||||||
hs.async = true;
|
|
||||||
hs.defer = true;
|
|
||||||
hs.src = '//js.hs-scripts.com/22348300.js';
|
|
||||||
document.body.appendChild(hs);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user