"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4076],{78904:function(e,r,a){a.r(r),a.d(r,{default:function(){return p}});var i=a(57437),l=a(2265),n=a(57818),o=a(26317),t=a(87668),s=a(39343),d=a(42334);a(57824),a(92373),a(44541);var u=a(66648),c=a(7545);function m(e){let{pictures:r,reverseDirection:a=!1}=e,l=a?200:150;return(0,i.jsx)(d.tq,{className:"mySwiper bg-white-300 swiper-franquias z-10 h-full w-full md:w-full",direction:"vertical",slidesPerView:2.3,speed:2e3,autoplay:{delay:a?800:455,disableOnInteraction:!1,reverseDirection:a},loop:!0,loopFillGroupWithBlank:!0,modules:[c.pt],breakpoints:{320:{slidesPerView:3,spaceBetween:5,slidesOffsetBefore:l},1024:{slidesPerView:2.3,spaceBetween:0,slidesOffsetBefore:l}},children:r.map(e=>(0,i.jsx)(d.o5,{children:(0,i.jsx)("div",{className:"relative h-full w-full rounded-xl md:h-5/6",children:(0,i.jsx)(u.default,{className:"rounded-xl object-cover",src:e.src,fill:!0,alt:e.alt,priority:e.priority,sizes:e.sizes})})},null==e?void 0:e.key))})}let f=(0,n.default)(()=>Promise.all([a.e(7610),a.e(9496)]).then(a.bind(a,16688)),{loadableGenerated:{webpack:()=>[16688]},ssr:!1});function p(e){let{allPictures:r}=e,[a,n]=(0,l.useState)(!1),{register:d,handleSubmit:u,control:c,reset:p,setError:x,formState:{errors:h,isValid:b}}=(0,s.cI)({shouldFocusError:!0,mode:"onTouched"}),[v,g]=(0,l.useState)("idle"),w=(0,l.useCallback)(async e=>{g("loading");try{await fetch("/api/franquias",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then(async e=>{if(429==e.status){n(!0),g("error");return}let r=await e.json();e.ok?(window.dataLayer&&window.dataLayer.push({event:"LeadFranquia"}),g("success"),p({name:"",email:"",phone:"",profession:"",region:"",capital:"",already_partner:void 0})):(Array.isArray(r.errors)&&r.errors.forEach(e=>{x(e,{type:"value"})}),g("error"))})}catch(e){g("error")}},[p,x]);return(0,i.jsxs)(i.Fragment,{children:[a&&(0,i.jsx)(f,{handleTrigger:n,triggerState:a},"franquias-too-many"),(0,i.jsxs)("section",{id:"franquiaForm",className:"mx-auto mt-10 flex w-full max-w-7xl scroll-mt-14 flex-col items-center justify-center gap-8 rounded-xl px-8 py-10 lg:flex-row",children:[(0,i.jsxs)("div",{className:"mx-auto w-11/12 md:min-w-[22rem] md:w-3/6",children:[(0,i.jsx)("h2",{className:"text-center text-lg font-bold md:text-xl lg:text-left",children:"Junte-se \xe0 Embracon e empreenda com toda seguran\xe7a, solidez e o suporte de quem est\xe1 h\xe1 mais de 35 anos no mercado de cons\xf3rcios"}),(0,i.jsx)("div",{className:"mt-10 flex w-full max-w-md flex-col-reverse gap-20 md:flex-row lg:mt-5",children:(0,i.jsxs)("form",{id:"LeadForm",onSubmit:u(w),className:"w-full",children:[(0,i.jsx)("p",{children:"Preencha o formul\xe1rio abaixo e ent\xe3o nossa equipe entrar\xe1 em contato para explicar os pr\xf3ximos passos:"}),(0,i.jsxs)("div",{className:"my-6 flex flex-col gap-3",children:[(0,i.jsx)(o.CY,{type:"text",name:"nome",label:"Nome completo",hasError:!!(null==h?void 0:h.name),"aria-required":!0,errorMessage:"Digite seu nome completo",...d("name",{minLength:3,required:!0})}),(0,i.jsx)(o.CY,{type:"email",name:"email",label:"E-mail","aria-required":!0,hasError:!!(null==h?void 0:h.email),errorMessage:"Insira um e-mail v\xe1lido",...d("email",{pattern:/\S+@\S+\.\S+/,required:!0})}),(0,i.jsx)(s.Qr,{control:c,name:"phone",rules:{required:{value:!0,message:"Campo obrigat\xf3rio."},pattern:{value:/^\([\d{2}]+\)+ +(\d{5}|\d{4})\-\d{4}/,message:"Digite um n\xfamero v\xe1lido"}},render:e=>{var r;let{field:a}=e;return(0,i.jsx)(o.j2,{type:"tel",label:"Telefone",disabled:"loading"===v,hasError:!!(null==h?void 0:h.phone),errorMessage:null==h?void 0:null===(r=h.phone)||void 0===r?void 0:r.message,...a})}}),(0,i.jsx)(o.CY,{type:"text",name:"profession",label:"Profiss\xe3o",hasError:!!(null==h?void 0:h.profession),"aria-required":!0,errorMessage:"Digite sua profiss\xe3o",...d("profession",{minLength:3,required:!0})}),(0,i.jsxs)(o.UK,{defaultValue:"",name:"capital",...d("capital",{required:!0}),hasError:!!(null==h?void 0:h.capital),errorMessage:"Selecione uma op\xe7\xe3o",children:[(0,i.jsx)("option",{disabled:!0,value:"",children:"Capital dispon\xedvel"}),(0,i.jsx)("option",{value:"at\xe9 100mil",children:"at\xe9 100mil"}),(0,i.jsx)("option",{value:"100mil a 150mil",children:"100mil a 150mil"}),(0,i.jsx)("option",{value:"+ de 200mil",children:"+ de 200mil"})]}),(0,i.jsx)(o.CY,{type:"text",name:"regiao",label:"Regi\xe3o de interesse (Cidade/Estado)",hasError:!!(null==h?void 0:h.region),"aria-required":!0,errorMessage:"Digite sua regi\xe3o de interesse. (ex: Santana de Parna\xedba / SP)",...d("region",{minLength:3,required:!0})}),(0,i.jsx)(s.Qr,{control:c,name:"already_partner",rules:{required:{value:!0,message:"Campo obrigat\xf3rio."}},render:e=>{let{field:{onChange:r,value:a},fieldState:{error:l}}=e;return(0,i.jsx)(o.PG,{label:"J\xe1 foi parceiro Embracon?",onChange:r,defaultValue:a,value:a,options:[{name:"Sim",enable:!0},{name:"N\xe3o",enable:!0}],hasError:!!l,errorMessage:null==l?void 0:l.message})}})]}),(0,i.jsx)(o.Yo,{isLoading:"loading"===v,id:"continuar",type:"submit",enabled:b,className:"my-4",children:"Enviar"}),"error"===v&&(0,i.jsx)("p",{className:"animate-pulse rounded-xl border-2 border-error-default px-4 py-1 text-error-default",children:"Ocorreu um erro ao enviar seus dados, por favor tente novamente."}),"success"===v&&(0,i.jsxs)("p",{className:"flex items-center gap-2 rounded-lg bg-lime-600 py-2 pl-2 pr-4 font-bold text-white",children:[(0,i.jsx)(t.Z,{className:"h-7 w-7 animate-slide-in-up"}),"Dados enviados! Aguarde nosso contato."]})]})})]}),(0,i.jsxs)("div",{className:"mx-auto flex h-screen max-h-96 w-11/12 space-x-6 md:max-h-[47rem] md:w-3/6 lg:w-full",children:[(0,i.jsx)(m,{pictures:r.pictures}),(0,i.jsx)(m,{pictures:r.picturesInverted,reverseDirection:!0})]})]})]})}},83078:function(e,r,a){a.d(r,{d:function(){return i}});let i=(0,a(12218).j)("inline-flex items-center h-fit justify-center rounded-lg whitespace-nowrap focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand-default",{variants:{variant:{default:"bg-brand-default text-white no-underline hover:bg-brand-dark  w-fit px-4 py-2 font-semibold",inverted:"bg-white text-brand-dark hover:bg-zinc-100 focus-visible:outline-brand-default w-fit px-4 py-2 font-semibold",disabled:"bg-zinc-200 text-zinc-600 cursor-not-allowed no-underline hover:bg-zinc-200 focus-visible:outline-zinc-600 w-fit px-4 py-2 font-semibold",outline:"bg-transparent text-brand-dark hover:bg-brand-default/10 border-2 border-brand-default focus-visible:outline-brand-default w-fit px-3.5 py-1.5 font-semibold",outlineInverted:"bg-transparent text-white hover:bg-brand-default/30 border border-white focus-visible:outline-brand-default w-fit px-4 py-2 font-semibold",link:"underline-offset-4 hover:underline text-brand-dark",linkInverted:"underline-offset-4 hover:underline text-white"}},defaultVariants:{variant:"default"}})},82183:function(e,r,a){a.d(r,{cn:function(){return l}});var i=a(12218);function l(){for(var e=arguments.length,r=Array(e),a=0;a<e;a++)r[a]=arguments[a];return(0,i.cx)(r)}}}]);