Contexto profundo del frontend PWA de YAGA: dashboard cockpit, GPS tracking, consentimientos, offline-first, y patrones React/TS.
frontend/
├── src/
│ ├── components/
│ │ ├── Dashboard/ # Cockpit principal
│ │ ├── Auth/ # Login, registro
│ │ ├── ARCO/ # Acceso, rectificación, cancelación
│ │ └── GPS/ # GpsDashboard.js
│ ├── hooks/
│ │ ├── useAuth.ts # JWT en memoria, refresh automático
│ │ └── useGps.ts # Geolocation wrapper
│ ├── store/ # Zustand stores
│ ├── services/ # API calls
│ └── App.tsx
├── public/
│ ├── manifest.json # PWA manifest
│ └── sw.js # Service worker offline
└── vite.config.ts
// Parámetros anti-drenaje
const GPS_CONFIG = {
enableHighAccuracy: false, // 3× menos batería
maximumAge: 10000, // Reutiliza caché 10s
timeout: 15000
};
const THROTTLE_MS = 5000; // 1 punto cada 5s
const FLUSH_INTERVAL = 30000; // Batch cada 30s
const IDLE_THRESHOLD = 60000; // Pausa si <2 km/h por 60s
access_token (15min) + refresh_token (HttpOnly cookie, 7 días)access_token se guarda en variable Zustand (NUNCA localStorage)operacion: toggle deshabilitado (obligatoria)marketing: toggle activo, default OFFinvestigacion: toggle activo, default OFFany en TypeScriptconsole.log en producción (usar logger service)