{"id":26019,"date":"2023-09-27T19:10:39","date_gmt":"2023-09-27T19:10:39","guid":{"rendered":"https:\/\/www.avenueeco.com\/solution\/avenida-expandida-nova\/teste-gratis-por-30-dias\/"},"modified":"2024-02-01T16:18:56","modified_gmt":"2024-02-01T16:18:56","slug":"teste-gratis-por-30-dias","status":"publish","type":"solution","link":"https:\/\/www.avenueeco.com\/pt-br\/solucao\/avenue-expand-old\/teste-gratis-por-30-dias\/","title":{"rendered":"Teste gr\u00e1tis por 30 dias &#8211; Avenue Expand"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"26019\" class=\"elementor elementor-26019 elementor-26001\" data-elementor-settings=\"{&quot;ha_cmc_init_switcher&quot;:&quot;no&quot;}\" data-elementor-post-type=\"solution\">\n\t\t\t\t<div class=\"elementor-element elementor-element-14b86bc6 engageSection e-con-full e-flex e-con e-parent\" data-id=\"14b86bc6\" 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-3751d9cc e-flex e-con-boxed e-con e-child\" data-id=\"3751d9cc\" 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-1d490487 jltma-glass-effect-no elementor-widget elementor-widget-heading\" data-id=\"1d490487\" 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-c6cbf41 e-con-full e-flex e-con e-child\" data-id=\"c6cbf41\" 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-5f9cfc4f jltma-glass-effect-no elementor-widget elementor-widget-image\" data-id=\"5f9cfc4f\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"215\" height=\"58\" src=\"https:\/\/www.avenueeco.com\/wp-content\/uploads\/2023\/02\/logo_avenue_expand-1.svg\" class=\"attachment-full size-full wp-image-21508\" alt=\"\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-66b80714 elementor-widget__width-inherit jltma-glass-effect-no elementor-widget elementor-widget-html\" data-id=\"66b80714\" 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\"> <section class=\"s-form-engage\"> <!--<div class=\"header-image\">--> <!-- <div class=\"product-image\">--> <!-- <img id=\"product-image\"--> <!-- src=\"https:\/\/www.avenueeco.com\/wp-content\/uploads\/2023\/05\/logo_avenue_eco_engage.svg\"--> <!-- alt=\"\" \/>--> <!-- <\/div>--> <!--<\/div>--> <form class=\"form\" id=\"form\"> <div class=\"row\"> <div class=\"form-control-col-1 col-md-6\"> <label for=\"username\">Name*<\/label> <input type=\"text\" placeholder=\"Full Name\" id=\"username\" \/> <i class=\"fas fa-check-circle\"><\/i> <i class=\"fas fa-exclamation-circle\"><\/i> <small>Error message<\/small> <\/div> <div class=\"form-control-col-1 col-md-6\"> <label for=\"email\">Email*<\/label> <input type=\"text\" placeholder=\"your@email.com\" id=\"email\" \/> <i class=\"fas fa-check-circle\"><\/i> <i class=\"fas fa-exclamation-circle\"><\/i> <small>Error message<\/small> <\/div> <div class=\"form-control-col-1 col-md-6\"> <label for=\"phone\">Phone *<\/label> <input type=\"text\" name=\"phone\" id=\"phone\" class=\"phone\" placeholder=\"+00 00 00000 0000\"\/> <i class=\"fas fa-check-cicle\"><\/i> <i class=\"fas fa-exclamation-circle\"><\/i> <small>Error message<\/small> <\/div> <div class=\"form-control-col-1 col-md-6\"> <label for=\"country\">Country*<\/label> <select name=\"country\" id=\"country\" class=\"form-select\"> <option value=\"\" disabled selected>Select a country...<\/option> <\/select> <i class=\"fas fa-check-circle\"><\/i> <i class=\"fas fa-exclamation-circle\"><\/i> <small>Error message<\/small> <\/div> <div class=\"form-control-col-1 col-md-6\"> <label for=\"companyName\">Company Name*<\/label> <input type=\"text\" placeholder=\"Your company\" id=\"companyName\" \/> <i class=\"fas fa-check-circle\"><\/i> <i class=\"fas fa-exclamation-circle\"><\/i> <small>Error message<\/small> <\/div> <div class=\"form-control-col-1 col-md-6\"> <label for=\"companySize\">Company Size<\/label> <select name=\"companySize\" class=\"form-select\" id=\"companySize\"> <option value=\"\" disabled selected>-- Select --<\/option> <option value=\"up to 50\">Up to 50<\/option> <option value=\"50 to 200\">50 to 200<\/option> <option value=\"200 to 500\">200 to 500<\/option> <option value=\"over 500\">Over 500<\/option> <\/select> <i class=\"fas fa-check-circle\"><\/i> <i class=\"fas fa-exclamation-circle\"><\/i> <small>Error message<\/small> <\/div> <div class=\"form-control-col-1 col-md-6\"> <label for=\"product\">Product*<\/label> <input type=\"text\" id=\"product\" value=\"Expand\" disabled> <i class=\"fas fa-check-circle\"><\/i> <i class=\"fas fa-exclamation-circle\"><\/i> <small>Error message<\/small> <\/div> <div class=\"form-control-col-1 col-md-6\"> <label for=\"subdomain\">Subdomain*<\/label> <input type=\"text\" id=\"subdomain\" placeholder=\"Your subdomain\" \/> <span id=\"subdomainType\">.expand.avenueeco.com<\/span> <i class=\"fas fa-check-circle\"><\/i> <i class=\"fas fa-exclamation-circle\"><\/i> <small>Error message<\/small> <\/div> <div class=\"g-recaptcha\" data-callback=\"recaptchaCallback\" data-sitekey=\"6LcL1qEmAAAAAH12DzCpFA-FyDKm4MSXkUxOKZCs\"><\/div> <input class=\"button\" type=\"submit\" value=\"Submit for Trial\" \/> <\/div> <\/form> <\/section> <\/div> <script> const API_BASE_URL = 'https:\/\/apis.avenueeco.com\/backend\/api\/external\/eco-trials'; const COUNTRIES_API_URL = 'https:\/\/apis.avenueeco.com\/geodata\/geonames\/countries'; document.addEventListener('DOMContentLoaded', initialize); \/\/ DOM Elements const form = document.getElementById('form'); const spanSubdomain = document.getElementById('subdomainType'); const productImage = document.getElementById('product-image'); const inputs = { username: document.getElementById('username'), country: document.getElementById('country'), email: document.getElementById('email'), phone: document.getElementById('phone'), companyName: document.getElementById('companyName'), product: document.getElementById('product'), subdomain: document.getElementById('subdomain'), companySize: document.getElementById('companySize'), trialDays: 30, }; \/\/ Event listeners form.addEventListener('submit', handleSubmit); inputs.phone.addEventListener('input', validatePhoneField); async function initialize() { await getCountries(); } async function getCountries() { try { const response = await fetch(COUNTRIES_API_URL); const countries = await response.json(); setCountries(countries); } catch (error) { console.error('Error fetching countries:', error); } } function setCountries(countries) { for (const country of countries) { const option = document.createElement('option'); option.value = country.countryName.toString(); option.textContent = country.countryName; inputs.country.appendChild(option); } } function validateField(input, message) { const value = input.value.trim(); if (value === '') { setErrorFor(input, message); return false; } else { setSuccessFor(input); return true; } } function validatePhoneField(input) { \/\/ const value = input.value.trim(); if (inputs.phone.value === '') { setErrorFor(input, 'Please fill your phone number'); return false; } else { setSuccessFor(input); return true; } } function validateEmailField(input) { const value = input.value.trim(); if (value === '') { setErrorFor(input, 'Please fill your email address'); return false; } else if (!isEmail(value)) { setErrorFor(input, 'Please enter a valid email address'); return false; } else { setSuccessFor(input); return true; } } function isEmail(email) { const emailRegex = \/[a-z0-9\\._%+!$&*=^|~#%'`?{}\/\\-]+@([a-z0-9\\-]+\\.){1,}([a-z]{2,16})\/; return emailRegex.test(email); } function setErrorFor(input, message) { const formControl = input.parentElement; const small = formControl.querySelector('small'); small.innerText = message; formControl.classList.add('error'); formControl.classList.remove('success'); } function setSuccessFor(input) { const formControl = input.parentElement; formControl.classList.add('success'); formControl.classList.remove('error'); } async function handleSubmit(event) { event.preventDefault(); const isFormValid = setupFormValidation(); if (isFormValid) { try { showLoading(); const isSubdomainAvailable = await checkSubDomainAvailability(inputs.subdomain.value); if (isSubdomainAvailable) { const recaptchaResponse = grecaptcha.getResponse(); \/\/ Get reCAPTCHA response if (!recaptchaResponse) { Swal.fire({ icon: 'error', title: 'reCAPTCHA Validation', text: 'Please complete the reCAPTCHA challenge.', }); return; } const result = await makeTrialRequest(); console.log(result); } else { setErrorFor(inputs.subdomain, 'Subdomain is not available'); Swal.fire({ icon: 'error', title: 'Oops...', text: 'This subdomain was already chosen. Please try to choose an available one. ', }); } } catch (error) { console.error('Error during form submission:', error); } } } function setupFormValidation() { let isValid = true; isValid = validateField(inputs.username, 'Please fill your name') && isValid; isValid = validateField(inputs.country, 'Please choose your country') && isValid; isValid = validateField(inputs.companyName, 'Please fill your company name') && isValid; isValid = validateField(inputs.subdomain, 'Please fill your subdomain') && isValid; isValid = validateField(inputs.companySize, 'Please select your company size') && isValid isValid = validatePhoneField(inputs.phone) && isValid; isValid = validateEmailField(inputs.email) && isValid; return isValid; } async function checkSubDomainAvailability(subdomain) { try { const response = await fetch(`${API_BASE_URL}\/check-tenant?name=${subdomain}`); const data = await response.json(); return data === true; } catch (error) { console.error('Error during subdomain check:', error); Swal.fire({ icon: 'error', title: 'Error', text: 'An error occurred while checking subdomain. Please try again later.', }); return false; } } async function makeTrialRequest() { try { const requestData = { name: inputs.username.value, country: inputs.country.value, phone: inputs.phone.value, email: inputs.email.value, companyName: inputs.companyName.value, product: inputs.product.value, tenant: inputs.subdomain.value, trialDays: inputs.trialDays, companySize: inputs.companySize.value, }; const response = await fetch(API_BASE_URL, { method: 'POST', headers: { 'Content-Type': 'application\/json', }, body: JSON.stringify(requestData), }); if (response.status === 201) { Swal.close(); showSuccessAlert(); clearFormField() return 'Success: Trial request created.'; } else if (response.status === 409) { Swal.fire({ icon: 'error', title: 'Oops...', text: 'The email is already registered. Please provide a different email.', }); setErrorFor(inputs.email, 'Email is already registered.'); } else { Swal.fire({ icon: 'error', title: 'Oops...', text: 'An error occurred while making the trial request. Try again in few minutes. ', }); } } catch (error) { Swal.close(); Swal.fire({ icon: 'error', title: 'Error', text: 'An error occurred while making the trial request.', }); console.error('Error making trial request:', error); return 'Error: Something went wrong.'; } } function showLoading() { Swal.fire({ title: 'Requesting your trial', allowOutsideClick: false, showConfirmButton: false, onBeforeOpen: () => { Swal.showLoading(); }, }); } function showSuccessAlert() { Swal.fire({ icon: 'success', title: 'Data sent successfully!', text: 'Our team will send a confirmation email in a few minutes.', }); } \/\/ FUNCTION TO CLEAR FORM AFTER SUBMIT function clearFormField() { form.reset(); } var onloadCallback = function() { console.log('loaded() triggered.'); }; \/\/ Chamada da fun\u00e7\u00e3o para inputs de telefone mask('input[type=\"text\"]'); <\/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},"featured_media":0,"parent":25412,"menu_order":0,"template":"elementor_header_footer","format":"standard","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":""}}},"class_list":["post-26019","solution","type-solution","status-publish","format-standard","hentry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.avenueeco.com\/pt-br\/wp-json\/wp\/v2\/solution\/26019","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.avenueeco.com\/pt-br\/wp-json\/wp\/v2\/solution"}],"about":[{"href":"https:\/\/www.avenueeco.com\/pt-br\/wp-json\/wp\/v2\/types\/solution"}],"version-history":[{"count":18,"href":"https:\/\/www.avenueeco.com\/pt-br\/wp-json\/wp\/v2\/solution\/26019\/revisions"}],"predecessor-version":[{"id":27215,"href":"https:\/\/www.avenueeco.com\/pt-br\/wp-json\/wp\/v2\/solution\/26019\/revisions\/27215"}],"up":[{"embeddable":true,"href":"https:\/\/www.avenueeco.com\/pt-br\/wp-json\/wp\/v2\/solution\/25412"}],"wp:attachment":[{"href":"https:\/\/www.avenueeco.com\/pt-br\/wp-json\/wp\/v2\/media?parent=26019"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}