// src/pwaInstall.js let deferredPrompt = null; // Stocke l'événement natif quand Chrome le déclenche window.addEventListener('beforeinstallprompt', (e) => { e.preventDefault(); deferredPrompt = e; console.log('PWA: Install prompt ready - button can trigger it'); }); // Fonction appelée par le bouton "Install" export function promptInstall() { if (deferredPrompt) { console.log('PWA: Triggering native install prompt'); deferredPrompt.prompt(); deferredPrompt.userChoice.then((choice) => { console.log('PWA Install outcome:', choice.outcome); deferredPrompt = null; }); } else { console.log('PWA: No prompt ready yet - scroll/click more'); alert('PWA not ready yet. Try scrolling the map, clicking filters or markers, then click Install again.'); } }