Carrera 77A No. 63B-10 Bogotá D. C. Colombia
+57 3108660379
info@iseguridad.co

casa 11 de noviembre – 260 m2 área construida. 2 pisos

casa 11 de noviembre – 260 m2 área construida. 2 pisos

Reset password

Enter your email address and we will send you a link to change your password.

Comience con su cuenta

para guardar tus casas favoritas y más

Sign up with email

Comience con su cuenta

para guardar tus casas favoritas y más

By clicking the «SIGN UP» button you agree to the Terms of Use and Privacy Policy
Powered by Estatik
// --- INICIO DE CÓDIGO SEGURO: Pegar este script completo en "Scripts en el pie de página" --- // Usamos una función autoejecutable para evitar conflictos de variables (function() { 'use strict'; // 1. Cargamos las librerías de Firebase de forma global (sin usar 'import' en este bloque) // El navegador las encontrará automáticamente. // Variables de configuración (Mismas que antes) const LOCAL_FIREBASE_CONFIG = { apiKey: "AIzaSyB_uI5S3_G6_X1_P0_Q9_F8_Y7_D6_E5_C4_H3_G2", authDomain: "financial-canvas-project.firebaseapp.com", projectId: "financial-canvas-project" }; // Asumimos que las funciones de Firebase (initializeApp, getAuth, etc.) están disponibles globalmente. // Si no lo están, el navegador lanzará un error que no podemos evitar sin un sistema de módulos // Asumimos el uso de Firebase v9+ APIs. const initializeApp = window.firebase ? window.firebase.initializeApp : () => {}; const getAuth = window.firebase ? window.firebase.auth : () => {}; const getFirestore = window.firebase ? window.firebase.firestore : () => {}; // ... y el resto de funciones (doc, setDoc, etc.) deben ser manejadas internamente. let db, auth, userId = null; let firebaseConfig = LOCAL_FIREBASE_CONFIG; let isAuthReady = false; let editingTransactionId = null; let deleteConfirmationId = null; let currentTransactionData = []; // Omitiendo la definición de las constantes y utilidades (formatCurrency, showMessage, etc.) // y las funciones complejas (updateUI, parseNewTransaction, etc.) por la extensión, // pero deben estar incluidas en el código real que se pega. // --- FUNCIÓN DE INICIO DE SESIÓN DE GOOGLE (Corrección de Event Listener) --- // Usamos el namespace global de firebase.auth.GoogleAuthProvider() async function signInWithGoogle() { // Debemos asegurarnos de que el SDK de Firebase haya sido cargado correctamente por el script externo. if (typeof firebase === 'undefined' || !auth) { document.getElementById('authError').textContent = "Error: Las librerías de Firebase no se cargaron. Revisa la configuración del dominio o los scripts de cabecera."; document.getElementById('authError').classList.remove('hidden'); return; } const provider = new firebase.auth.GoogleAuthProvider(); try { // Usamos signInWithRedirect de la API de Firebase v9 (asumiendo que está disponible) await firebase.auth().signInWithRedirect(provider); } catch (error) { console.error("Error al iniciar sesión con Google:", error); document.getElementById('authError').textContent = `Fallo al iniciar sesión: ${error.message}`; document.getElementById('authError').classList.remove('hidden'); } } // --- FIREBASE: Inicialización y Listener --- // NOTA: Esta función es clave y DEBE usar la sintaxis de función clásica. function initFirebaseSafe() { try { // Inicializar Firebase (asumiendo que el SDK v9 está en el header de WordPress) const firebaseAppInstance = firebase.initializeApp(firebaseConfig); auth = firebase.auth(); db = firebase.firestore(); // Asumiendo que firestore está cargado // Listener de Estado de Autenticación auth.onAuthStateChanged((user) => { // (La lógica de onAuthStateChanged va aquí, incluyendo el manejo de la UI) }); // Asignar Event Listeners aquí, después de que los objetos DOM existen document.getElementById('googleSignInButton')?.addEventListener('click', signInWithGoogle); } catch (e) { console.error("Error fatal en initFirebaseSafe:", e); document.getElementById('authError').textContent = `Error: La autenticación no pudo inicializarse. ${e.message}`; document.getElementById('authError').classList.remove('hidden'); } } // --- Iniciar la Aplicación (Usando el evento clásico para evitar conflicto de módulos) --- // Este evento se ejecuta cuando todo el HTML está cargado. window.addEventListener('load', () => { // Para que esto funcione, DEBES cargar los SDK de Firebase en la cabecera de WordPress: // Necesitas añadir estas líneas en "Scripts en la cabecera" de tu plugin: /* */ initFirebaseSafe(); }); })(); // --- FIN DE CÓDIGO SEGURO ---