{"id":25964,"date":"2023-09-25T11:04:07","date_gmt":"2023-09-25T11:04:07","guid":{"rendered":"https:\/\/www.avenueeco.com\/teste-gratis-por-30-dias-novo\/"},"modified":"2023-09-25T17:14:05","modified_gmt":"2023-09-25T17:14:05","slug":"teste-gratis-por-30-dias-novo","status":"publish","type":"page","link":"https:\/\/www.avenueeco.com\/pt-br\/teste-gratis-por-30-dias-novo\/","title":{"rendered":"Teste gr\u00e1tis por 30 dias &#8211; Avenue Eco"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"25964\" class=\"elementor elementor-25964\" data-elementor-settings=\"{&quot;ha_cmc_init_switcher&quot;:&quot;no&quot;}\" data-elementor-post-type=\"page\">\n\t\t\t\t<div class=\"elementor-element elementor-element-adee8a8 engageSection e-con-full e-flex e-con e-parent\" data-id=\"adee8a8\" data-element_type=\"container\" data-settings=\"{&quot;background_background&quot;:&quot;classic&quot;,&quot;_ha_eqh_enable&quot;:false}\">\n\t\t<div class=\"elementor-element elementor-element-be1d77c e-flex e-con-boxed e-con e-child\" data-id=\"be1d77c\" data-element_type=\"container\" data-settings=\"{&quot;_ha_eqh_enable&quot;:false}\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-591daa3 jltma-glass-effect-no elementor-widget elementor-widget-heading\" data-id=\"591daa3\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Cadastre suas informa\u00e7\u00f5es e comece seu teste gratuito de 30 dias.\n<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-dc6b4cb e-con-full e-flex e-con e-child\" data-id=\"dc6b4cb\" data-element_type=\"container\" data-settings=\"{&quot;background_background&quot;:&quot;classic&quot;,&quot;_ha_eqh_enable&quot;:false}\">\n\t\t\t\t<div class=\"elementor-element elementor-element-9f875a4 elementor-widget__width-inherit jltma-glass-effect-no elementor-widget elementor-widget-html\" data-id=\"9f875a4\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t <div class=\"container\">\n        <section class=\"s-form-engage\">\n            <div class=\"header-image\">\n                <div class=\"product-image\">\n                    <img decoding=\"async\" id=\"product-image\" src=\"https:\/\/www.avenueeco.com\/wp-content\/uploads\/2023\/02\/logo_avenue_eco_animated.gif\" alt=\"\">\n                <\/div>\n            <\/div>\n            <form class=\"form\" id=\"form\">\n                <div class=\"row\">\n                    \n                        <div class=\"form-control-col-1 col-md-6\">\n                            <label for=\"username\">Nome*<\/label>\n                            <input type=\"text\" placeholder=\"Nome Completo\" id=\"username\">\n                            <i class=\"fas fa-check-circle\"><\/i>\n                            <i class=\"fas fa-exclamation-circle\"><\/i>\n                            <small>Ocorreu um erro.<\/small>\n                        <\/div>\n\n                        <div class=\"form-control-col-1 col-md-6\">\n                            <label for=\"email\">E-mail*<\/label>\n                            <input type=\"text\" placeholder=\"seu@e-mail.com\" id=\"email\">\n                            <i class=\"fas fa-check-circle\"><\/i>\n                            <i class=\"fas fa-exclamation-circle\"><\/i>\n                            <small>Ocorreu um erro.<\/small>\n                        <\/div>                    \n\n                    <div class=\"form-control-col-1 col-md-6\">\n                        <label for=\"phone\">Telefone *<\/label>\n                        <input type=\"text\" name=\"phone\" id=\"phone\" class=\"phone\" placeholder=\"+00 00 00000 0000\">\n                        <i class=\"fas fa-check-cicle\"><\/i>\n                        <i class=\"fas fa-exclamation-circle\"><\/i>\n                        <small>Ocorreu um erro.<\/small>\n                    <\/div>\n                    <div class=\"form-control-col-1 col-md-6\">\n                        <label for=\"country\">Pa\u00eds*<\/label>\n                        <select name=\"country\" id=\"country\" class=\"form-select\">\n                            <option value=\"\" disabled selected>Selecione um pa\u00eds...<\/option>\n                        <\/select>\n                        <i class=\"fas fa-check-circle\"><\/i>\n                        <i class=\"fas fa-exclamation-circle\"><\/i>\n                        <small>Ocorreu um erro.<\/small>\n                    <\/div>\n\n                    <div class=\"form-control-col-1 col-md-6\">\n                        <label for=\"companyName\">Nome da Empresa*<\/label>\n                        <input type=\"text\" placeholder=\"Sua empresa\" id=\"companyName\">\n                        <i class=\"fas fa-check-circle\"><\/i>\n                        <i class=\"fas fa-exclamation-circle\"><\/i>\n                        <small>Ocorreu um erro.<\/small>\n                    <\/div>\n\n                    <div class=\"form-control-col-1 col-md-6\">\n                        <label for=\"companySize\">Tamanho da Empresa<\/label>\n                        <select name=\"companySize\" class=\"form-select\" id=\"companySize\">\n                            <option value=\"\" disabled selected>-- Selecione --<\/option>\n                            <option value=\"At\u00e9 50\">At\u00e9 50<\/option>\n                            <option value=\"De 50 a 200\">De 50 a 200<\/option>\n                            <option value=\"De 200 a 500\">De 200 a 500<\/option>\n                            <option value=\"Acima de 500\">Acima de 500<\/option>\n                        <\/select>\n                        <i class=\"fas fa-check-circle\"><\/i>\n                        <i class=\"fas fa-exclamation-circle\"><\/i>                       \n                        <small>Ocorreu um erro.<\/small>\n                    <\/div>                    \n\n                    <div class=\"form-control-col-1 col-md-6\">\n                        <label for=\"product\">Produto*<\/label>\n                        <select type=\"text\" class=\"form-select\" id=\"product\">\n                            <option value=\"\" selected disabled>Selecione um produto<\/option>\n                            <!-- <option value=\"engage\">Engage<\/option>\n                            <option value=\"expand\">Expand<\/option>\n                            <option value=\"exceed\">Exceed<\/option> -->\n                        <\/select>\n                        <i class=\"fas fa-check-circle\"><\/i>\n                        <i class=\"fas fa-exclamation-circle\"><\/i>\n                        <small>Ocorreu um erro.<\/small>\n                    <\/div>\n                    \n                    <div class=\"form-control-col-1 col-md-6\">\n                        <label for=\"subdomain\">Subdom\u00ednio*<\/label>\n                        <input type=\"text\" id=\"subdomain\" placeholder=\"Seu subdom\u00ednio\">\n                        <span id=\"subdomainType\">.engage.avenueeco.com<\/span>\n                        <i class=\"fas fa-check-circle\"><\/i>\n                        <i class=\"fas fa-exclamation-circle\"><\/i>\n                        <small>Ocorreu um erro.<\/small>\n                    <\/div>   \n                    <div class=\"g-recaptcha\" id=\"g-recaptcha\" data-callback=\"recaptchaCallback\" data-sitekey=\"6LcL1qEmAAAAAH12DzCpFA-FyDKm4MSXkUxOKZCs\"><\/div>                 \n                    <input class=\"button\" type=\"submit\" value=\"Solicitar o teste\">\n                  \n                <\/div>\n            <\/form>\n        <\/section>\n    <\/div>\n    \n    <script>\n          \n    const API_BASE_URL = 'https:\/\/apis.avenueeco.com\/backend\/api\/external\/eco-trials';\n    const COUNTRIES_API_URL = 'https:\/\/apis.avenueeco.com\/geodata\/geonames\/countries';\n    \n    document.addEventListener('DOMContentLoaded', initialize);\n    \n    \/\/ DOM Elements\n    const form = document.getElementById('form');\n    const spanSubdomain = document.getElementById('subdomainType');\n    const productImage = document.getElementById('product-image');\n    const inputs = {\n    username: document.getElementById('username'),\n    country: document.getElementById('country'),\n    email: document.getElementById('email'),\n    phone: document.getElementById('phone'),\n    companyName: document.getElementById('companyName'),\n    product: document.getElementById('product'),\n    subdomain: document.getElementById('subdomain'),\n    companySize: document.getElementById('companySize'),\n    trialDays: 30,\n    };\n    \n    \n    \/\/ Event listeners\n    form.addEventListener('submit', handleSubmit);\n    inputs.product.addEventListener('change', handleProductChange);\n    inputs.phone.addEventListener('input', validatePhoneField);\n    \n    \n    async function initialize() {\n    await getCountries();  \n    }\n    \n    async function getCountries() {\n    \n    try {\n    const response = await fetch(COUNTRIES_API_URL);\n    const countries = await response.json();\n    setCountries(countries);\n    } catch (error) {\n    console.error('Error fetching countries:', error);\n    }\n    }\n    \n    function setCountries(countries) {\n    for (const country of countries) {\n    const option = document.createElement('option');\n    option.value = country.countryName.toString();\n    option.textContent = country.countryName;\n    inputs.country.appendChild(option);\n    }\n    }\n    \n    \n    function validateField(input, message) {\n    const value = input.value.trim();\n    if (value === '') {\n    setErrorFor(input, message);\n    return false;\n    } else {\n    setSuccessFor(input);\n    return true;\n    }\n    }\n    \n    function validatePhoneField(input) {\n    \/\/ const value = input.value.trim();\n    if (inputs.phone.value === '') {\n    setErrorFor(input, 'Por favor, digite o seu telefone');\n    return false;\n    } else {\n    setSuccessFor(input);\n    return true;\n    }\n    }\n    \n    function validateEmailField(input) {\n    const value = input.value.trim();\n    if (value === '') {\n    setErrorFor(input, 'Por favor, digite o seu e-mail');\n    return false;\n    } else if (!isEmail(value)) {\n    setErrorFor(input, 'Por favor, digite um e-mail v\u00e1lido');\n    return false;\n    } else {\n    setSuccessFor(input);\n    return true;\n    }\n    }\n    \n    function isEmail(email) {\n    const emailRegex = \/[a-z0-9\\._%+!$&*=^|~#%'`?{}\/\\-]+@([a-z0-9\\-]+\\.){1,}([a-z]{2,16})\/;\n    return emailRegex.test(email);\n    }\n\n    \/\/ FUNCTION TO CHANGE DOMAIN SPAN WHEN USERS SELECT THE PRODUCT AND PRODUCT IMAGE\n\/\/ GET URL PARAMS TO FILL SELECT ACCORDING TO DE PRODUCT SELECTED\n\nconst images = {\n  engage: 'https:\/\/www.avenueeco.com\/wp-content\/uploads\/2023\/09\/logo_engage_website_eco.svg',\n  expand: 'https:\/\/www.avenueeco.com\/wp-content\/uploads\/2023\/02\/logo_avenue_expand-1.svg',\n  \/\/ exceed: 'https:\/\/www.avenueeco.com\/wp-content\/uploads\/2023\/02\/logo_avenue_exceed.svg',\n};\n\nconst subdomains = {\n  engage: '.engage.avenueeco.com',\n  expand: '.expand.avenueeco.com',\n  \/\/ exceed: '.exceed.avenueeco.com',\n};\n\n\n\nfunction preencherSelectComBaseNaURL() {\n  const urlParams = new URLSearchParams(window.location.search);\n  const selectedOption = urlParams.get('product');\n  \n  for (const product in images) {\n      const option = document.createElement('option');\n      option.value = product;\n      option.text = product.charAt(0).toUpperCase() + product.slice(1);\n      if (product === selectedOption) {\n          option.selected = true;\n      }\n      inputs.product.appendChild(option);    \n      \n  }\n  \n  handleProductChange();\n}\n\nfunction handleProductChange() {\n  const selectedProduct = inputs.product.value;\n  const imageBox = document.querySelector('.s-form-engage .header-image')\n  productImage.src = images[selectedProduct] || images.default;\n  spanSubdomain.textContent = subdomains[selectedProduct] || '';\n\n  if(selectedProduct === ''){\n    imageBox.classList.add('hidden')\n  }else{\n    imageBox.classList.remove('hidden')\n  }\n}\n\nwindow.onload = preencherSelectComBaseNaURL;\n    \n    function setErrorFor(input, message) {\n    const formControl = input.parentElement;\n    const small = formControl.querySelector('small');\n    small.innerText = message;\n    formControl.classList.add('error');\n    formControl.classList.remove('success');\n    }\n    \n    function setSuccessFor(input) {\n    const formControl = input.parentElement;\n    formControl.classList.add('success');\n    formControl.classList.remove('error');\n    }\n    \n    async function handleSubmit(event) {\n    event.preventDefault();\n    const isFormValid = setupFormValidation();\n    if (isFormValid) {\n    try {\n    showLoading();\n    const isSubdomainAvailable = await checkSubDomainAvailability(inputs.subdomain.value);\n    if (isSubdomainAvailable) {\n    \n      const recaptchaResponse = grecaptcha.getResponse(); \/\/ Get reCAPTCHA response\n      if (!recaptchaResponse) {\n        Swal.fire({\n          icon: 'error',\n          title: 'reCAPTCHA',\n          text: 'Por favor, complete o reCAPTCHA.',\n        });\n        return;\n      }\n    \n      const result = await makeTrialRequest();\n      console.log(result);\n    } else {\n      setErrorFor(inputs.subdomain, 'Este subdom\u00ednio n\u00e3o est\u00e1 dispon\u00edvel.');\n      Swal.fire({\n        icon: 'error',\n        title: 'Oops...',\n        text: 'Este subdom\u00ednio j\u00e1 foi escolhido. Por favor, tente escolher um dispon\u00edvel. ',\n      });\n    }\n    } catch (error) {\n    console.error('Error during form submission:', error);\n    }\n    }\n    }\n    \n    function setupFormValidation() {\n    let isValid = true;\n    isValid = validateField(inputs.username, 'Por favor, digite o seu nome') && isValid;\n    isValid = validateField(inputs.country, 'Por favor, selecione o seu pa\u00eds') && isValid;\n    isValid = validateField(inputs.product, 'Por favor, selecione um produto') && isValid;\n    isValid = validateField(inputs.companyName, 'Por favor, digite o nome da sua empresa') && isValid;\n    isValid = validateField(inputs.subdomain, 'Por favor, digite o seu subdom\u00ednio') && isValid;\n    isValid = validateField(inputs.companySize, 'Por favor, selecione o tamanho da sua empresa') && isValid\n    isValid = validatePhoneField(inputs.phone) && isValid;\n    isValid = validateEmailField(inputs.email) && isValid;\n    return isValid;\n    }\n    \n    async function checkSubDomainAvailability(subdomain) {\n    try {\n    const response = await fetch(`${API_BASE_URL}\/check-tenant?name=${subdomain}`);\n    const data = await response.json();\n    return data === true;\n    } catch (error) {\n    console.error('Error during subdomain check:', error);\n    Swal.fire({\n    icon: 'error',\n    title: 'Error',\n    text: 'Ocorreu um erro ao verificar o subdom\u00ednio. Por favor, tente novamente mais tarde.',\n    });\n    return false;\n    }\n    }\n    \n    async function makeTrialRequest() {\n    try {\n    const requestData = {\n    name: inputs.username.value,\n    country: inputs.country.value,\n    phone: inputs.phone.value,\n    email: inputs.email.value,\n    companyName: inputs.companyName.value,\n    product: inputs.product.value,\n    tenant: inputs.subdomain.value,\n    trialDays: inputs.trialDays,\n    companySize: inputs.companySize.value,\n    };\n    \n    const response = await fetch(API_BASE_URL, {\n    method: 'POST',\n    headers: {\n      'Content-Type': 'application\/json',\n    },\n    body: JSON.stringify(requestData),\n    });\n    \n    if (response.status === 201) {\n    Swal.close();\n    showSuccessAlert();\n    clearFormField()\n    return 'Success: Trial request created.';\n    } else if (response.status === 409) {\n    Swal.fire({\n      icon: 'error',\n      title: 'Oops...',\n      text: 'E-mail digitado j\u00e1 est\u00e1 cadastrado. Forne\u00e7a um e-mail diferente.',\n    });\n    setErrorFor(inputs.email, 'E-mail digitado j\u00e1 est\u00e1 cadastrado.');\n    } else {\n    Swal.fire({\n      icon: 'error',\n      title: 'Oops...',\n      text: 'Ocorreu um erro ao fazer a solicita\u00e7\u00e3o de teste. Tente novamente em alguns minutos. ',\n    });\n    }\n    } catch (error) {\n    Swal.close();\n    Swal.fire({\n    icon: 'error',\n    title: 'Error',\n    text: 'Ocorreu um erro ao fazer a solicita\u00e7\u00e3o de teste.',\n    });\n    console.error('Error making trial request:', error);\n    return 'Error: Something went wrong.';\n    }\n    }\n    \n    function showLoading() {\n    Swal.fire({\n    title: 'Solicitando seu teste...',\n    allowOutsideClick: false,\n    showConfirmButton: false,\n    onBeforeOpen: () => {\n    Swal.showLoading();\n    },\n    });\n    }\n    \n    function showSuccessAlert() {\n    Swal.fire({\n    icon: 'success',\n    title: 'Solicita\u00e7\u00e3o enviada com sucesso!',\n    text: 'Em alguns minutos nosso time ir\u00e1 te encaminhar um e-mail de confirma\u00e7\u00e3o.',\n    });\n    }\n    \n    \/\/ FUNCTION TO CLEAR FORM AFTER SUBMIT\n    \n    function clearFormField() {\n    form.reset();\n    }\n    \n    \n    var onloadCallback = function() {\n    console.log('loaded() triggered.');\n    };\n    \n    \/\/ Chamada da fun\u00e7\u00e3o para inputs de telefone\n    mask('input[type=\"text\"]');\n\n    <\/script>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Cadastre suas informa\u00e7\u00f5es e comece seu teste gratuito de 30 dias. Nome* Ocorreu um erro. E-mail* Ocorreu um erro. Telefone * Ocorreu um erro. Pa\u00eds* Selecione um pa\u00eds&#8230; Ocorreu um erro. Nome da Empresa* Ocorreu um erro. Tamanho da Empresa &#8212; Selecione &#8212;At\u00e9 50De 50 a 200De 200 a 500Acima de 500 Ocorreu um erro. [&hellip;]<\/p>\n","protected":false},"author":26,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"content-type":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"site-sidebar-layout":"no-sidebar","site-content-layout":"page-builder","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"disabled","ast-breadcrumbs-content":"","ast-featured-img":"disabled","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"class_list":["post-25964","page","type-page","status-publish","hentry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.avenueeco.com\/pt-br\/wp-json\/wp\/v2\/pages\/25964","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.avenueeco.com\/pt-br\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.avenueeco.com\/pt-br\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.avenueeco.com\/pt-br\/wp-json\/wp\/v2\/users\/26"}],"replies":[{"embeddable":true,"href":"https:\/\/www.avenueeco.com\/pt-br\/wp-json\/wp\/v2\/comments?post=25964"}],"version-history":[{"count":6,"href":"https:\/\/www.avenueeco.com\/pt-br\/wp-json\/wp\/v2\/pages\/25964\/revisions"}],"predecessor-version":[{"id":25977,"href":"https:\/\/www.avenueeco.com\/pt-br\/wp-json\/wp\/v2\/pages\/25964\/revisions\/25977"}],"wp:attachment":[{"href":"https:\/\/www.avenueeco.com\/pt-br\/wp-json\/wp\/v2\/media?parent=25964"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}