{"webLayers":[{"_id":"685e1dd15120ef66e73024dc","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/red-de-concesionarios","type":"exact"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"685e25950198f0f8a6f525c4","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/posventa","type":"exact"},{"url":"https://divemotor.com.co/campa%C3%B1as-de-seguridad","type":"exact"},{"url":"https://divemotor.com.co/garantia","type":"exact"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"686fc1e0c8e07e4574c7ca38","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/","type":"exact"},{"url":"https://divemotor.com.co/home","type":"exact"},{"url":"https://divemotor.com.co/web/guest","type":"exact"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"once_per_visit","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"686ff6e32a1e4a72be867ffe","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/buses","type":"contains"},{"url":"https://divemotor.com.co/camiones","type":"contains"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"686ffbb623d74e65f1634942","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/w/canter-5-7","type":"exact"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"6870001e75e32e7f91f426a3","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/w/canter-6-5","type":"exact"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"6870017f21a9e06005f5598f","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/w/canter-6-5-d-c","type":"exact"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"687002a12db4eb2a669973b1","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/w/canter-7-5-m","type":"exact"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"6870037f9e7ec685f8776153","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/w/canter-7-5-l","type":"exact"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"6870049e2e07868f66df069e","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/w/fa-9-6","type":"exact"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"687005192a1e4a72be868558","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/w/fi-10-4","type":"exact"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"6870058286ab124ff4ed31bf","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/w/fi-11-9","type":"exact"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"6870096486ab124ff4ed357c","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/w/minibus-canter-7-5","type":"exact"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"68700a235d12586544ebec29","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/w/new-cascadia-mecanica-estandar","type":"exact"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"68700ab50bf0b56d74939b58","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/w/new-cascadia-mecanica-premium","type":"exact"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"68700b66ff185fb0e59f0b40","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/w/new-cascadia-automatizada-estandar","type":"exact"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"68700c236eb404f53ccb5e07","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/w/114-sd-plus-tracto","type":"exact"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"68700d5b23d74e65f1635088","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/w/114-sd-plus-volco","type":"exact"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"68700e0475e32e7f91f42bef","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/w/new-actros-2651-ls-stream-space","type":"exact"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"687012c36eb404f53ccb6270","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/w/arocs-3342-k","type":"exact"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"687013e8ff185fb0e59f0e38","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/w/arocs-4142-k","type":"exact"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"687017f72a1e4a72be868f16","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/w/lo-916","type":"exact"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"687018be9e7ec685f8776d7e","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/w/o500-rs-1938","type":"exact"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"6870196a86ab124ff4ed3bb3","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/w/atego-1726-c","type":"exact"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"68701a0a86ab124ff4ed3c0f","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/w/atego-1726-k","type":"exact"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"68701ace6eb404f53ccb6549","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"https://divemotor.com.co/w/atego-1726-l","type":"exact"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"6a053fc14b940b124db7eec4","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"divemotor.com.co/registro-jcb","type":"contains"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"6a4bb946d36a2ad8b819215d","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"divemotor.com.co/form-registro?utm_campaign=eventos","type":"contains"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"6a6991653e8642d632f2046d","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"divemotor.com.co/encuesta-nps?utm_campaign=servicios","type":"contains"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"6a6b7abc16caaff52bea50be","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"divemotor.com.co/encuesta-nps?utm_campaign=repuestos","type":"contains"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"6a6b7f519af6c764912057eb","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"divemotor.com.co/encuesta-nps?utm_campaign=unidades","type":"contains"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]},{"_id":"6abd4436a2c7ace6ebcf81c0","date_filter":{"enabled":false,"from_date":null,"to_date":null},"trigger":{"include_pages":[{"url":"divemotor.com.co/puertas-abiertas-divemotor-cali","type":"contains"}],"exclude_pages":null},"smart_trigger":null,"device_target":{"type":"any"},"frequency":"always","uses_personalization":true,"data":"","variables_target":null,"page_vars":[]}],"experiments":[],"constantManagedTags":[{"uses_overlay":false,"type":"js","parametrized_definition":"//console.log('tag: divemotor - formulario - Cotiza');\n\n// Función para verificar si un input tiene un mensaje de error visible\nfunction tieneError(input) {\n    const errorMsg = input.closest('div')?.querySelector('.error');\n    return errorMsg \u0026\u0026 getComputedStyle(errorMsg).display !== 'none';\n}\n\nlet iniciaCotizacionEjecutado = false;\n\n// Función para manejar la lógica de 'inicia_cotizacion'\nfunction check_inicia() {\n    const _tabTypePerson = document.querySelector('.mdc-tab-indicator--active')?.innerText;\n\n    if (_tabTypePerson === 'Soy una persona') {\n        //console.log('Persona Inicia');\n        const _email = document.getElementById('email')?.value.trim();\n        const emailValido = _email \u0026\u0026 _email !== '' \u0026\u0026 !tieneError(document.getElementById('email'));\n\n        if (emailValido \u0026\u0026 !iniciaCotizacionEjecutado) { // Solo ejecuta una vez\n            iniciaCotizacionEjecutado = true;\n            //exponea.identify({ email_id: _email.toLowerCase() });\n            exponea.update({ email: _email.toLowerCase() });\n            exponea.track('inicia_cotizacion', {\n                origen: 'formulario-divemotor-cotizador',\n                email: _email.toLowerCase()\n            });\n        }\n    } else if (_tabTypePerson === 'Soy una empresa') {\n        //console.log('Empresa Inicia');\n        const _emailEmpresa = document.getElementById('email-empresa')?.value.trim();\n        const emailEmpresaValido = _emailEmpresa \u0026\u0026 _emailEmpresa !== '' \u0026\u0026 !tieneError(document.getElementById('email-empresa'));\n\n        if (emailEmpresaValido \u0026\u0026 !iniciaCotizacionEjecutado) { // Solo ejecuta una vez\n            iniciaCotizacionEjecutado = true;\n            //exponea.identify({ email_id: _emailEmpresa.toLowerCase() });\n            exponea.update({ email: _emailEmpresa.toLowerCase() });\n            exponea.track('inicia_cotizacion', {\n                origen: 'formulario-divemotor-cotizador',\n                email: _emailEmpresa.toLowerCase()\n            });\n        }\n    }\n}\n\n// Función para inicializar los event listeners\nfunction setupEventListeners() {\n    const email_input = document.getElementById('email');\n    if (email_input) {\n        email_input.addEventListener('change', check_inicia);\n    } else {\n        console.warn(\"Input con ID 'email' no encontrado.\");\n    }\n\n    const emailEmpresa_input = document.getElementById('email-empresa');\n    if (emailEmpresa_input) {\n        emailEmpresa_input.addEventListener('change', check_inicia);\n    } else {\n        console.warn(\"Input con ID 'email-empresa' no encontrado.\");\n    }\n    \n    const tabs = document.querySelectorAll('.mdc-tab');\n    tabs.forEach(tab =\u003e {\n        tab.addEventListener('click', () =\u003e {\n            const tabText = tab.innerText.trim();\n            //console.log(`Tab clicada: ${tabText}`);\n            // Resetear la bandera para que `inicia_cotizacion` se pueda disparar de nuevo si el usuario cambia de tab y vuelve a llenar el email\n            iniciaCotizacionEjecutado = false;\n            \n            if(tabText === 'Soy una empresa'){\n            \tconst emailEmpresa_input = document.getElementById('email-empresa');\n\t\t\t    if (emailEmpresa_input) {\n\t\t\t        emailEmpresa_input.addEventListener('change', check_inicia);\n\t\t\t    } else {\n\t\t\t        console.warn(\"Input con ID 'email-empresa' no encontrado.\");\n\t\t\t    }\n            }else{\n            \tconst email_input = document.getElementById('email');\n\t\t\t    if (email_input) {\n\t\t\t        email_input.addEventListener('change', check_inicia);\n\t\t\t    } else {\n\t\t\t        console.warn(\"Input con ID 'email' no encontrado.\");\n\t\t\t    }\n            }\n            \n        });\n    });\n\n    const submitButton = document.getElementById('form-boton-enviar');\n    if (submitButton) {\n        // const form = submitButton.closest('form'); // No se usa esta variable en tu código\n        submitButton.addEventListener('click', (event) =\u003e {\n            //event.preventDefault();\n\n            const _tabTypePerson = document.querySelector('.mdc-tab-indicator--active')?.innerText;\n\n            let formData = {};\n            let isFormValid = true;\n\n            if (_tabTypePerson === 'Soy una persona') {\n                //console.log('persona track');\n                const _nombre = document.getElementById('Nombre')?.value.trim() || '';\n                const _apellido = document.getElementById('apellido')?.value.trim() || '';\n                const _cedula = document.getElementById('rut')?.value.trim() || '';\n                const _email = document.getElementById('email')?.value.trim() || '';\n                const _telefono = document.getElementById('telefono')?.value.trim() || '';\n                const _codAreaTelefono = document.getElementById('cod-telefono')?.value.trim() || '';\n                const _ciudadSelect = document.getElementById('ciudad');\n                const _ciudad = _ciudadSelect?.options[_ciudadSelect.selectedIndex]?.innerText || '';\n                const _sucursalSelect = document.getElementById('sucursal');\n                const _sucursal = _sucursalSelect?.options[_sucursalSelect.selectedIndex]?.innerText || '';\n                const _tipo = document.getElementById('tipo')?.value.trim() || '';\n                const _marca = document.getElementById('marca')?.value.trim() || '';\n                const _modeloSelect = document.getElementById('modelo');\n                const _modelo = _modeloSelect?.options[_modeloSelect.selectedIndex]?.innerText || '';\n                const _versionSelect = document.getElementById('version');\n                const _version = _versionSelect?.options[_versionSelect.selectedIndex]?.innerText || '';\n                const _terminos = document.getElementById('Terminos')?.checked || false;\n\n                if (!_nombre || !_apellido || !_cedula || !_email || !_telefono || !_ciudad || !_tipo || !_marca || !_modelo || !_version || !_terminos) {\n                    console.error(\"Algunos campos obligatorios no están llenos en el formulario de Persona. No se guardará en localStorage.\");\n                    isFormValid = false;\n                }\n\n                if (isFormValid) {\n                    formData = {\n                        'origen': 'formulario-divemotor-cotizador',\n                        nombre: _nombre.toLowerCase(),\n                        apellido: _apellido.toLowerCase(),\n                        cedula: _cedula,\n                        email: _email.toLowerCase(),\n                        telefono: `${_codAreaTelefono}${_telefono}`.trim(),\n                        ciudad: _ciudad.toLowerCase(),\n                        sucursal: _sucursal.toLowerCase(),\n                        tipoVehiculo: _tipo,\n                        marcaVehiculo: _marca,\n                        modeloVehiculo: _modelo,\n                        versionVehiculo: _version,\n                        aceptaTerminos: _terminos\n                    };\n                    \n                    exponea.identify({ registered: _cedula.toLowerCase() });\n                    \n            \t\texponea.update({ \n            \t\t\tfirst_name: _nombre.toLowerCase(),\n                        last_name: _apellido.toLowerCase(),\n                        cedula: _cedula,\n                        email: _email.toLowerCase(),\n                        phone: `${_codAreaTelefono}${_telefono}`.trim(),\n                        ciudad: _ciudad.toLowerCase(),\n                        sucursal: _sucursal.toLowerCase()\n            \t\t});\n                    \n                    \n                }\n\n            } else if (_tabTypePerson === 'Soy una empresa') {\n                //console.log('Empresa track');\n                const _nombre = document.getElementById('Nombre')?.value.trim() || '';\n                const _apellido = document.getElementById('apellido')?.value.trim() || '';\n                const _empresa = document.getElementById('nombreEmpresa')?.value.trim() || '';\n                const _nitEmpresa = document.getElementById('nitEmpresa')?.value.trim() || '';\n                const _emailEmpresa = document.getElementById('email-empresa')?.value.trim() || '';\n                const _telefonoEmpresa = document.getElementById('telefono-empresa')?.value.trim() || '';\n                const _codAreaTelefonoEmpresa = document.getElementById('cod-telefono-empresa')?.value.trim() || '';\n                const _ciudadSelect = document.getElementById('ciudad');\n                const _ciudad = _ciudadSelect?.options[_ciudadSelect.selectedIndex]?.innerText || '';\n                const _sucursalSelect = document.getElementById('sucursal');\n                const _sucursal = _sucursalSelect?.options[_sucursalSelect.selectedIndex]?.innerText || '';\n                const _tipo = document.getElementById('tipo')?.value.trim() || '';\n                const _marca = document.getElementById('marca')?.value.trim() || '';\n                const _modeloSelect = document.getElementById('modelo');\n                const _modelo = _modeloSelect?.options[_modeloSelect.selectedIndex]?.innerText || '';\n                const _versionSelect = document.getElementById('version');\n                const _version = _versionSelect?.options[_versionSelect.selectedIndex]?.innerText || '';\n                const _terminos = document.getElementById('Terminos')?.checked || false;\n\n                if (!_nombre || !_apellido || !_empresa || !_nitEmpresa || !_emailEmpresa || !_telefonoEmpresa || !_ciudad || !_tipo || !_marca || !_modelo || !_version || !_terminos) {\n                    console.error(\"Algunos campos obligatorios no están llenos en el formulario de Empresa. No se guardará en localStorage.\");\n                    isFormValid = false;\n                }\n\n                if (isFormValid) {\n                    formData = {\n                        'origen': 'formulario-divemotor-cotizador',\n                        nombre: _nombre.toLowerCase(),\n                        apellido: _apellido.toLowerCase(),\n                        empresa: _empresa.toLowerCase(),\n                        NIT: _nitEmpresa,\n                        email: _emailEmpresa.toLowerCase(),\n                        telefono: `${_codAreaTelefonoEmpresa}${_telefonoEmpresa}`.trim(),\n                        ciudad: _ciudad.toLowerCase(),\n                        sucursal: _sucursal.toLowerCase(),\n                        tipoVehiculo: _tipo,\n                        marcaVehiculo: _marca,\n                        modeloVehiculo: _modelo,\n                        versionVehiculo: _version,\n                        aceptaTerminos: _terminos\n                    };\n                    \n                    exponea.identify({ registered: NIT.toLowerCase() });\n                    \n            \t\texponea.update({ \n            \t\t\tfirst_name: _nombre.toLowerCase(),\n                        last_name: _apellido.toLowerCase(),\n                        NIT: _nitEmpresa,\n                        email: _emailEmpresa.toLowerCase(),\n                        phone: `${_codAreaTelefonoEmpresa}${_telefonoEmpresa}`.trim(),\n                        ciudad: _ciudad.toLowerCase(),\n                        sucursal: _sucursal.toLowerCase(),\n                        empresa: _empresa.toLowerCase()\n            \t\t});\n                }\n            } else {\n                //console.warn('Tipo de pestaña no reconocido o activo.');\n                isFormValid = false;\n            }\n\n            if (isFormValid) {\n                const formDataJSON = JSON.stringify(formData);\n                try {\n                    localStorage.setItem('cotiza_bloomreach', formDataJSON);\n                    //console.log('Datos guardados en localStorage bajo la clave \"cotiza_bloomreach\":', formData);\n                    if (typeof exponea !== 'undefined') {\n                        \n                        exponea.track('cotiza', formData);\n                        \n                        \n                        \n                    } else {\n                        //console.warn('Exponea no está definido. No se puede enviar el evento de cotización.');\n                    }\n                } catch (e) {\n                    //console.error('Error al guardar en localStorage:', e);\n                }\n            }\n        });\n    } else {\n        //console.warn(\"El botón de envío con ID 'form-boton-enviar' no fue encontrado. El script no se ejecutará.\");\n    }\n}\n\nsetupEventListeners()","trigger":{"include_pages":[{"url":"https://divemotor.com.co/cotizar","type":"contains"}],"exclude_pages":null},"_id":"68541ada2477d786902fb03a"},{"uses_overlay":false,"type":"js","parametrized_definition":"// Referencia al contexto del tag de Bloomreach (expone self.sdk, igual que en los weblayers)\nvar self = this || {};\n\n(function() {\n  // Usar self.sdk del tag; si no existe, caer al SDK global\n  self.sdk = self.sdk || window.exponea;\n  if (!self.sdk) {\n    console.warn('Bloomreach SDK (self.sdk / exponea) no está definido.');\n    return;\n  }\n\n  // Objeto para mantener el estado de los datos capturados entre pasos\n  var datosCotizacion = {\n    tipo_vehiculo: '',\n    modelo_vehiculo: '',\n    tipo_persona: '',\n    nombre_empresa: '',\n    first_name: '',\n    last_name: '',\n    rut: '',\n    telefono: '',\n    email: '',\n    region: '',\n    comuna: '',\n    sucursal: '',\n    financiamiento: ''\n  };\n\n  // --- PASO 1: Inicia Cotización ---\n  var botonesPaso1 = document.querySelectorAll('#siguiente-paso-1');\n  \n  botonesPaso1.forEach(function(boton) {\n    boton.addEventListener('click', function() {\n      var tipoSelect = document.getElementById('tipo-vehiculo');\n      var modeloSelect = document.getElementById('modelo-vehiculo');\n\n      if (tipoSelect \u0026\u0026 modeloSelect \u0026\u0026 tipoSelect.value !== 'null') {\n        datosCotizacion.tipo_vehiculo = tipoSelect.value;\n        datosCotizacion.modelo_vehiculo = modeloSelect.value === 'null' ? '' : modeloSelect.value;\n\n        self.sdk.track('inicia_cotizacion', {\n          tipo_vehiculo: datosCotizacion.tipo_vehiculo,\n          modelo_vehiculo: datosCotizacion.modelo_vehiculo\n        });\n      }\n    });\n  });\n\n  // --- PASO 2: Datos Personales / Empresa (Email change \u0026 Identificación) ---\n  var valorDe = function(id) {\n    var el = document.getElementById(id);\n    return el ? el.value.trim() : '';\n  };\n\n  var esEmpresa = function() {\n    var radio = document.querySelector('input[name=\"tipo-persona\"]:checked');\n    return !!radio \u0026\u0026 radio.value === 'empresa';\n  };\n\n  // El email existe en ambos formularios: #client-mail (persona) y #empresa-mail (empresa)\n  ['client-mail', 'empresa-mail'].forEach(function(id) {\n    var input = document.getElementById(id);\n    if (!input) return;\n    input.addEventListener('change', function() {\n      var emailVal = input.value.trim().toLowerCase();\n      if (emailVal) {\n        datosCotizacion.email = emailVal;\n        self.sdk.update({\n          email: datosCotizacion.email\n        });\n      }\n    });\n  });\n\n  const botonPaso2 = document.getElementById('siguiente-paso-2');\n  if (botonPaso2) {\n    botonPaso2.addEventListener('click', function() {\n      var empresa = esEmpresa();\n      var datos;\n\n      if (empresa) {\n        datos = {\n          nombre_empresa: valorDe('nombre-empresa'),\n          first_name: valorDe('nombre-contacto'),\n          last_name: '',\n          rut: valorDe('rut-empresa'),\n          telefono: valorDe('empresa-number'),\n          email: valorDe('empresa-mail').toLowerCase()\n        };\n      } else {\n        datos = {\n          nombre_empresa: '',\n          first_name: valorDe('nombre'),\n          last_name: valorDe('apellido'),\n          rut: valorDe('rut'),\n          telefono: valorDe('client-number'),\n          email: valorDe('client-mail').toLowerCase()\n        };\n      }\n\n      var completo = empresa\n        ? (datos.nombre_empresa \u0026\u0026 datos.first_name \u0026\u0026 datos.rut \u0026\u0026 datos.telefono \u0026\u0026 datos.email)\n        : (datos.first_name \u0026\u0026 datos.last_name \u0026\u0026 datos.rut \u0026\u0026 datos.telefono \u0026\u0026 datos.email);\n\n      if (completo) {\n        datosCotizacion.tipo_persona = empresa ? 'empresa' : 'persona';\n        datosCotizacion.nombre_empresa = datos.nombre_empresa;\n        datosCotizacion.first_name = datos.first_name;\n        datosCotizacion.last_name = datos.last_name;\n        datosCotizacion.rut = datos.rut;\n        datosCotizacion.telefono = datos.telefono;\n        datosCotizacion.email = datos.email;\n\n        // 1. self.sdk.identify (cédula para persona, NIT para empresa)\n        self.sdk.identify({\n          registered: datosCotizacion.rut\n        });\n\n        // 2. self.sdk.update\n        var atributos = {\n          first_name: datosCotizacion.first_name,\n          rut: datosCotizacion.rut,\n          phone: datosCotizacion.telefono,\n          email: datosCotizacion.email,\n          tipo_persona: datosCotizacion.tipo_persona\n        };\n        if (empresa) {\n          atributos.company_name = datosCotizacion.nombre_empresa;\n        } else {\n          atributos.last_name = datosCotizacion.last_name;\n        }\n        self.sdk.update(atributos);\n\n        console.table(atributos);\n      }\n    });\n  }\n\n  // --- PASO 3: Finalizar Cotización ---\n  var botonEnviar = document.getElementById('enviar');\n  var cotizaEnviado = false;\n  if (botonEnviar) {\n    // Fase de captura: corre antes que los listeners del sitio que envían el formulario\n    botonEnviar.addEventListener('click', function(e) {\n      // Segundo click (re-disparado tras el track): dejar que el sitio continúe normalmente\n      if (cotizaEnviado) return;\n\n      var regionSelect = document.getElementById('region');\n      var comunaSelect = document.getElementById('comuna');\n      var sucursalSelect = document.getElementById('sucursal');\n      var financiamientoRadio = document.querySelector('input[name=\"financiamiento\"]:checked');\n      var terminosCheckbox = document.getElementById('terms-and-conditions');\n\n      var tieneValor = function(select) {\n        return select \u0026\u0026 select.value !== '' \u0026\u0026 select.value !== 'null';\n      };\n\n      // En Andesmaq no existe #region: solo #comuna (Zona) y #sucursal\n      if (tieneValor(comunaSelect) \u0026\u0026\n          tieneValor(sucursalSelect) \u0026\u0026\n          terminosCheckbox \u0026\u0026 terminosCheckbox.checked) {\n\n        datosCotizacion.region = tieneValor(regionSelect) ? regionSelect.value : '';\n        datosCotizacion.comuna = comunaSelect.value;\n        datosCotizacion.sucursal = sucursalSelect.value;\n        datosCotizacion.financiamiento = financiamientoRadio ? financiamientoRadio.value : 'no-financiamiento';\n\n        // Estructura del evento final 'cotiza' con first_name y last_name\n        var propiedadesEvento = {\n          origen: 'andesmaq',\n          tipoVehiculo: datosCotizacion.tipo_vehiculo,\n          modeloVehiculo: datosCotizacion.modelo_vehiculo,\n          tipoPersona: datosCotizacion.tipo_persona,\n          nombreEmpresa: datosCotizacion.nombre_empresa,\n          nombre: datosCotizacion.first_name,\n          apellido: datosCotizacion.last_name,\n          cedula: datosCotizacion.rut,\n          telefono: datosCotizacion.telefono,\n          email: datosCotizacion.email,\n          region: datosCotizacion.region,\n          comuna: datosCotizacion.comuna,\n          sucursal: datosCotizacion.sucursal,\n          financiamiento: datosCotizacion.financiamiento\n        };\n\n        // Detener la navegación hasta que el evento llegue a Bloomreach\n        e.preventDefault();\n        e.stopImmediatePropagation();\n\n        var continuar = function() {\n          if (cotizaEnviado) return;\n          cotizaEnviado = true;\n          botonEnviar.click();\n        };\n\n        self.sdk.track('cotiza', propiedadesEvento, continuar, continuar);\n        // Respaldo por si el SDK no responde: no bloquear el envío del formulario\n        setTimeout(continuar, 1500);\n      }\n    }, true);\n  }\n})();","trigger":{"include_pages":[{"url":"https://andesmaq.com/co/cotizador","type":"contains"}],"exclude_pages":null},"_id":"6ab412dbf268a73d03ffb731"},{"uses_overlay":false,"type":"js","parametrized_definition":"// Referencia al contexto del tag de Bloomreach (expone self.sdk, igual que en los weblayers)\nvar self = this || {};\n\n(function() {\n  // Usar self.sdk del tag; si no existe, caer al SDK global\n  self.sdk = self.sdk || window.exponea;\n  if (!self.sdk) {\n    console.warn('Bloomreach SDK (self.sdk / exponea) no está definido.');\n    return;\n  }\n\n  var formulario = document.getElementById('contact_form');\n  var botonEnviar = document.getElementById('btnSubmit');\n  if (!formulario || !botonEnviar) return;\n\n  var valorDe = function(id) {\n    var el = document.getElementById(id);\n    return el \u0026\u0026 el.value ? el.value.trim() : '';\n  };\n\n  var esEmpresa = function() {\n    var radio = document.querySelector('input[name=\"tipo-persona\"]:checked');\n    return !!radio \u0026\u0026 radio.value === 'empresa';\n  };\n\n  // Mismas reglas que valida el sitio (form-validations.js de Colombia o su fallback)\n  var esCedulaValida = function(val) {\n    return typeof validateDocumentCo === 'function' ? validateDocumentCo(val) : /^\\d{6,10}$/.test(val);\n  };\n  var esNitValido = function(val) {\n    return typeof validateNitCo === 'function' ? validateNitCo(val) : /^\\d{10}$/.test(val);\n  };\n  var esTelefonoValido = function(val) {\n    return typeof validatePhoneCo === 'function' ? validatePhoneCo(val) : /^3\\d{9}$/.test(val);\n  };\n  var esEmailValido = function(val) {\n    return typeof validateEmail === 'function' ? validateEmail(val) : /^[^\\s@]+@[^\\s@]+\\.[^\\s@]{2,}$/.test(val);\n  };\n\n  // --- Email change: existe en ambos flujos, #correo (persona) y #correo-empresa (empresa) ---\n  ['correo', 'correo-empresa'].forEach(function(id) {\n    var input = document.getElementById(id);\n    if (!input) return;\n    input.addEventListener('change', function() {\n      var emailVal = input.value.trim().toLowerCase();\n      if (emailVal \u0026\u0026 esEmailValido(emailVal)) {\n        self.sdk.update({\n          email: emailVal\n        });\n      }\n    });\n  });\n\n  // --- Envío del formulario de contacto ---\n  var contactoEnviado = false;\n\n  // Fase de captura: corre antes que el listener del sitio que envía al CRM y redirige\n  botonEnviar.addEventListener('click', function(e) {\n    // Segundo click (re-disparado tras el track): dejar que el sitio continúe normalmente\n    if (contactoEnviado) return;\n\n    var empresa = esEmpresa();\n    var datos;\n\n    if (empresa) {\n      datos = {\n        tipo_persona: 'empresa',\n        nombre_empresa: valorDe('nombre-empresa'),\n        first_name: valorDe('nombre-contacto'),\n        last_name: '',\n        rut: valorDe('nit-empresa'),\n        telefono: valorDe('phone-empresa'),\n        email: valorDe('correo-empresa').toLowerCase()\n      };\n    } else {\n      datos = {\n        tipo_persona: 'persona',\n        nombre_empresa: '',\n        first_name: valorDe('nombre'),\n        last_name: valorDe('apellido'),\n        rut: valorDe('dni'),\n        telefono: valorDe('phone'),\n        email: valorDe('correo').toLowerCase()\n      };\n    }\n\n    datos.zona = valorDe('regionSelect');\n    datos.sucursal = valorDe('sucursalSelect');\n    datos.solicitud = valorDe('solicitudSelect');\n    datos.mensaje = valorDe('mensaje');\n\n    var terminosCheckbox = document.getElementById('autorizo');\n\n    var identificacionValida = empresa\n      ? (datos.nombre_empresa \u0026\u0026 datos.first_name \u0026\u0026 esNitValido(datos.rut))\n      : (datos.first_name \u0026\u0026 datos.last_name \u0026\u0026 esCedulaValida(datos.rut));\n\n    // Solo trackear si el formulario pasará la validación del sitio\n    if (!(identificacionValida \u0026\u0026\n          esTelefonoValido(datos.telefono) \u0026\u0026\n          esEmailValido(datos.email) \u0026\u0026\n          datos.zona \u0026\u0026 datos.sucursal \u0026\u0026 datos.solicitud \u0026\u0026 datos.mensaje \u0026\u0026\n          terminosCheckbox \u0026\u0026 terminosCheckbox.checked)) {\n      return;\n    }\n\n    // 1. self.sdk.identify (cédula para persona, NIT para empresa)\n    self.sdk.identify({\n      registered: datos.rut\n    });\n\n    // 2. self.sdk.update\n    var atributos = {\n      first_name: datos.first_name,\n      rut: datos.rut,\n      phone: datos.telefono,\n      email: datos.email,\n      tipo_persona: datos.tipo_persona\n    };\n    if (empresa) {\n      atributos.company_name = datos.nombre_empresa;\n    } else {\n      atributos.last_name = datos.last_name;\n    }\n    self.sdk.update(atributos);\n\n    console.table(atributos);\n\n    // 3. Evento final 'contacto_andes_mqa'\n    var propiedadesEvento = {\n      origen: 'andesmaq',\n      tipoPersona: datos.tipo_persona,\n      nombreEmpresa: datos.nombre_empresa,\n      nombre: datos.first_name,\n      apellido: datos.last_name,\n      cedula: datos.rut,\n      telefono: datos.telefono,\n      email: datos.email,\n      zona: datos.zona,\n      sucursal: datos.sucursal,\n      solicitud: datos.solicitud,\n      mensaje: datos.mensaje\n    };\n\n    // Detener el envío/redirección hasta que el evento llegue a Bloomreach\n    e.preventDefault();\n    e.stopImmediatePropagation();\n\n    var continuar = function() {\n      if (contactoEnviado) return;\n      contactoEnviado = true;\n      botonEnviar.click();\n    };\n\n    self.sdk.track('contacto_andes_maq', propiedadesEvento, continuar, continuar);\n    // Respaldo por si el SDK no responde: no bloquear el envío del formulario\n    setTimeout(continuar, 1500);\n  }, true);\n})();\n","trigger":{"include_pages":[{"url":"https://andesmaq.com/co/contacto","type":"contains"}],"exclude_pages":null},"_id":"6ac005d27c5d89be7f23115a"}],"vars":{"data":[]}}