feat(app.js): Ajoute le chatwoot SDK avec insertion de script dynamique.

🎨 style(ViteAssetExtension.php): Modifie le media du preload css en 'screen'.
This commit is contained in:
Serreau Jovann
2025-11-21 21:40:22 +01:00
parent d5349d0cc8
commit 4211b5b026
2 changed files with 12 additions and 20 deletions

View File

@@ -429,26 +429,18 @@ document.addEventListener('DOMContentLoaded', ()=>{
// Gère le bandeau de cookies (bottom-right)
handleCookieBanner()
(function(d, t) {
var BASE_URL = "https://app.chatwoot.com";
var g = d.createElement(t),
s = d.getElementsByTagName(t)[0];
var BASE_URL_WOOT = "https://app.chatwoot.com";
let script =document.createElement('script');
script.setAttribute('src',BASE_URL_WOOT + "/packs/js/sdk.js")
script.setAttribute('sync',true)
document.head.append(script)
script.onload = function() {
window.chatwootSDK.run({
websiteToken: '8SXvcdoWJVA77hug4mT5JhAP',
baseUrl: BASE_URL_WOOT
})
}
// Set the script source and make it async
g.src = BASE_URL + "/packs/js/sdk.js";
g.async = true;
// Insert the script element before the first existing script tag
s.parentNode.insertBefore(g, s);
// Initialize Chatwoot once the SDK script has loaded
g.onload = function() {
window.chatwootSDK.run({
websiteToken: '8SXvcdoWJVA77hug4mT5JhAP',
baseUrl: BASE_URL
})
}
})(document, "script");
Sentry.init({
dsn: "https://129785624e32fc0d4d7d8002a03b77b7@o4509563601092608.ingest.de.sentry.io/4510392640340048",
// Setting this option to true will send default PII data to Sentry.

View File

@@ -97,7 +97,7 @@ class ViteAssetExtension extends AbstractExtension
foreach ($css as $cssFile) {
$html .= <<<HTML
<link rel="stylesheet" rel="preload" media="print" onload="this.media = 'all '" href="/build/{$cssFile}"/>
<link rel="stylesheet" rel="preload" media="screen" href="/build/{$cssFile}"/>
HTML;
}