PageSourceSearch

https://hotelvilainglesa.com.br/assets/WhatsAppAdmin-CyRUXBPT.js

js hotelvilainglesa.com.br collected 2026-09-26 10:28:13 UTC 14,604 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-query-CO_QYTkO.js";import{r as p}from"./vendor-react-DJfEFaqw.js";import{a7 as L,s as w,V as x,m as r,c as V,a2 as $,a3 as D,a4 as v,a5 as b,I as i,T as k,X as u,Y as j,Z as m,$ as g,a0 as n}from"./index-BuBFkYNO.js";import{C as d,a as c,b as t,d as h}from"./card-6llgUU3N.js";import{af as S,aM as R,a2 as F,aN as W,b6 as T,b7 as G,b8 as H}from"./vendor-icons-BmcpZVdY.js";import"./vendor-ui-CCUQhf4y.js";import"./vendor-supabase-MEHSyf2E.js";import"./vendor-router-CkFJCvFZ.js";import"./vendor-helmet-Cc4zoVvE.js";import"./vendor-sanitize-D9RiKzGB.js";import"./vendor-codemirror-kF8_xaBD.js";import"./vendor-dnd-Ds4KDHQQ.js";import"./vendor-carousel-DpjaRhUe.js";const E=[{value:"/",label:"Home"},{value:"/o-vila",label:"O Vila"},{value:"/acomodacoes",label:"Acomodações"},{value:"/experiencias",label:"Experiências"},{value:"/gastronomia",label:"Gastronomia"},{value:"/eventos",label:"Eventos"},{value:"/galeria",label:"Galeria"},{value:"/faq",label:"FAQ"},{value:"/trabalhe-conosco",label:"Trabalhe Conosco"},{value:"/politica-reservas",label:"Política de Reservas"},{value:"/politica-privacidade",label:"Política de Privacidade"}],re=()=>{const[a,N]=p.useState(null),[z,I]=p.useState(!0),[y,C]=p.useState(!1),{toast:_}=L();p.useEffect(()=>{P()},[]);const P=async()=>{try{const{data:s,error:o}=await w.from("whatsapp_button_config").select("*").limit(1).maybeSingle();if(o)throw o;s&&N(s)}catch(s){console.error("Error fetching config:",s),_({title:"Erro ao carregar configurações",variant:"destructive"})}finally{I(!1)}},A=async()=>{if(a){C(!0);try{const{error:s}=await w.from("whatsapp_button_config").update(a).eq("id",a.id);if(s)throw s;_({title:"Configurações salvas com sucesso!"})}catch(s){console.error("Error saving config:",s),_({title:"Erro ao salvar configurações",variant:"destructive"})}finally{C(!1)}}},l=(s,o)=>{a&&N({...a,[s]:o})},B=s=>{if(!a)return;const o=a.specific_pages||[];o.includes(s)?l("specific_pages",o.filter(f=>f!==s)):l("specific_pages",[...o,s])},M=s=>{if(!a)return;const o=a.excluded_pages||[];o.includes(s)?l("excluded_pages",o.filter(f=>f!==s)):l("excluded_pages",[...o,s])};return z?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):a?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(S,{className:"h-6 w-6 text-green-500"}),e.jsx("p",{className:"text-muted-foreground",children:"Configure o botão flutuante de WhatsApp"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x,{checked:a.is_active,onCheckedChange:s=>l("is_active",s)}),e.jsx(r,{children:a.is_active?"Ativo":"Inativo"})]}),e.jsx(V,{onClick:A,disabled:y,children:y?"Salvando...":"Salvar"})]})]}),e.jsxs($,{defaultValue:"general",className:"space-y-6",children:[e.jsxs(D,{children:[e.jsxs(v,{value:"general",children:[e.jsx(R,{className:"w-4 h-4 mr-2"}),"Geral"]}),e.jsxs(v,{value:"style",children:[e.jsx(F,{className:"w-4 h-4 mr-2"}),"Estilo"]}),e.jsxs(v,{value:"modal",children:[e.jsx(W,{className:"w-4 h-4 mr-2"}),"Modal"]}),e.jsxs(v,{value:"display",children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),"Exibição"]})]}),e.jsxs(b,{value:"general",className:"space-y-6",children:[e.jsxs(d,{children:[e.jsx(c,{children:e.jsx(t,{children:"Configurações do WhatsApp"})}),e.jsxs(h,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(r,{children:"Número do WhatsApp (com código do país)"}),e.jsx(i,{value:a.phone_number,onChange:s=>l("phone_number",s.target.value),placeholder:"5511999999999"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Formato: código do país + DDD + número (sem espaços ou símbolos)"})]}),e.jsxs("div",{children:[e.jsx(r,{children:"Mensagem Padrão"}),e.jsx(k,{value:a.default_message,onChange:s=>l("default_message",s.target.value),rows:3})]})]})]}),e.jsxs(d,{children:[e.jsx(c,{children:e.jsx(t,{children:"Posição do Botão"})}),e.jsxs(h,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(r,{children:"Lado da Tela"}),e.jsxs(u,{value:a.position_side,onValueChange:s=>l("position_side",s),children:[e.jsx(j,{children:e.jsx(m,{})}),e.jsxs(g,{children:[e.jsx(n,{value:"right",children:"Direita"}),e.jsx(n,{value:"left",children:"Esquerda"})]})]})]}),e.jsxs("div",{children:[e.jsx(r,{children:"Animação de Entrada"}),e.jsxs(u,{value:a.entry_animation,onValueChange:s=>l("entry_animation",s),children:[e.jsx(j,{children:e.jsx(m,{})}),e.jsxs(g,{children:[e.jsx(n,{value:"none",children:"Nenhuma"}),e.jsx(n,{value:"bounce",children:"Bounce"}),e.jsx(n,{value:"fade-in",children:"Fade In"}),e.jsx(n,{value:"slide-in",children:"Slide In"}),e.jsx(n,{value:"pulse",children:"Pulsar"}),e.jsx(n,{value:"zoom-in",children:"Zoom In"})]})]})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx(r,{children:"Distância Horizontal (px)"}),e.jsx(i,{type:"number",value:a.offset_horizontal,onChange:s=>l("offset_horizontal",parseInt(s.target.value)||0)})]}),e.jsxs("div",{children:[e.jsx(r,{children:"Distância do Rodapé (px)"}),e.jsx(i,{type:"number",value:a.offset_bottom,onChange:s=>l("offset_bottom",parseInt(s.target.value)||0)})]}),e.jsxs("div",{children:[e.jsx(r,{children:"Repetições da Animação"}),e.jsx(i,{type:"number",min:"1",max:"10",value:a.animation_repeat,onChange:s=>l("animation_repeat",parseInt(s.target.value)||3)})]})]})]})]}),e.jsxs(d,{children:[e.jsx(c,{children:e.jsx(t,{children:"Badge de Notificação"})}),e.jsxs(h,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x,{checked:a.show_badge,onCheckedChange:s=>l("show_badge",s)}),e.jsx(r,{children:"Exibir badge"})]}),a.show_badge&&e.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[e.jsxs("div",{children:[e.jsx(r,{children:"Texto"}),e.jsx(i,{value:a.badge_text,onChange:s=>l("badge_text",s.target.value),maxLength:3})]}),e.jsxs("div",{children:[e.jsx(r,{children:"Cor"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(i,{type:"color",value:a.badge_color,onChange:s=>l("badge_color",s.target.value),className:"w-12 h-10 p-1"}),e.jsx(i,{value:a.badge_color,onChange:s=>l("badge_color",s.target.value),className:"flex-1"})]})]}),e.jsxs("div",{children:[e.jsx(r,{children:"Tamanho (px)"}),e.jsx(i,{type:"number",value:a.badge_size,onChange:s=>l("badge_size",parseInt(s.target.value)||12)})]}),e.jsxs("div",{children:[e.jsx(r,{children:"Animação"}),e.jsxs(u,{value:a.badge_animation,onValueChange:s=>l("badge_animation",s),children:[e.jsx(j,{children:e.jsx(m,{})}),e.jsxs(g,{children:[e.jsx(n,{value:"none",children:"Nenhuma"}),e.jsx(n,{value:"pulse",children:"Pulsar"}),e.jsx(n,{value:"bounce",children:"Bounce"})]})]})]})]})]})]})]}),e.jsxs(b,{value:"style",className:"space-y-6",children:[e.jsxs(d,{children:[e.jsx(c,{children:e.jsx(t,{children:"Cores do Botão"})}),e.jsx(h,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(r,{children:"Cor de Fundo"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(i,{type:"color",value:a.button_bg_color,onChange:s=>l("button_bg_color",s.target.value),className:"w-12 h-10 p-1"}),e.jsx(i,{value:a.button_bg_color,onChange:s=>l("button_bg_color",s.target.value),className:"flex-1"})]})]}),e.jsxs("div",{children:[e.jsx(r,{children:"Cor do Ícone"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(i,{type:"color",value:a.button_icon_color,onChange:s=>l("button_icon_color",s.target.value),className:"w-12 h-10 p-1"}),e.jsx(i,{value:a.button_icon_color,onChange:s=>l("button_icon_color",s.target.value),className:"flex-1"})]})]})]})})]}),e.jsxs(d,{children:[e.jsx(c,{children:e.jsx(t,{children:"Tamanhos"})}),e.jsx(h,{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx(r,{children:"Tamanho do Botão (px)"}),e.jsx(i,{type:"number",value:a.button_size,onChange:s=>l("button_size",parseInt(s.target.value)||60)})]}),e.jsxs("div",{children:[e.jsx(r,{children:"Tamanho do Ícone (px)"}),e.jsx(i,{type:"number",value:a.icon_size,onChange:s=>l("icon_size",parseInt(s.target.value)||32)})]}),e.jsxs("div",{children:[e.jsx(r,{children:"Raio da Borda (%)"}),e.jsx(i,{type:"number",value:a.border_radius,onChange:s=>l("border_radius",parseInt(s.target.value)||50)})]})]})})]}),e.jsxs(d,{children:[e.jsx(c,{children:e.jsx(t,{children:"Sombra"})}),e.jsxs(h,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x,{checked:a.show_shadow,onCheckedChange:s=>l("show_shadow",s)}),e.jsx(r,{children:"Exibir sombra"})]}),a.show_shadow&&e.jsxs("div",{children:[e.jsx(r,{children:"Intensidade"}),e.jsxs(u,{value:a.shadow_intensity,onValueChange:s=>l("shadow_intensity",s),children:[e.jsx(j,{children:e.jsx(m,{})}),e.jsxs(g,{children:[e.jsx(n,{value:"light",children:"Leve"}),e.jsx(n,{value:"medium",children:"Média"}),e.jsx(n,{value:"strong",children:"Forte"})]})]})]})]})]}),e.jsxs(d,{children:[e.jsx(c,{children:e.jsx(t,{children:"Preview do Botão"})}),e.jsx(h,{className:"flex justify-center py-8",children:e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"flex items-center justify-center",style:{width:`${a.button_size}px`,height:`${a.button_size}px`,backgroundColor:a.button_bg_color,borderRadius:`${a.border_radius}%`,boxShadow:a.show_shadow?a.shadow_intensity==="light"?"0 4px 6px -1px rgba(0,0,0,0.1)":a.shadow_intensity==="strong"?"0 25px 50px -12px rgba(0,0,0,0.25)":"0 10px 15px -3px rgba(0,0,0,0.1)":"none"},children:e.jsx(S,{style:{width:`${a.icon_size}px`,height:`${a.icon_size}px`,color:a.button_icon_color},fill:a.button_icon_color})}),a.show_badge&&e.jsx("span",{className:"absolute -top-1 -right-1 rounded-full flex items-center justify-center text-white font-bold",style:{minWidth:`${a.badge_size}px`,height:`${a.badge_size}px`,backgroundColor:a.badge_color,fontSize:`${Math.max(a.badge_size*.6,10)}px`},children:a.badge_text})]})})]})]}),e.jsx(b,{value:"modal",className:"space-y-6",children:e.jsxs(d,{children:[e.jsx(c,{children:e.jsx(t,{children:"Configurações do Modal"})}),e.jsxs(h,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(r,{children:"Cor do Cabeçalho"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(i,{type:"color",value:a.modal_header_color,onChange:s=>l("modal_header_color",s.target.value),className:"w-12 h-10 p-1"}),e.jsx(i,{value:a.modal_header_color,onChange:s=>l("modal_header_color",s.target.value),className:"flex-1"})]})]}),e.jsxs("div",{children:[e.jsx(r,{children:"URL do Logo do Modal"}),e.jsx(i,{value:a.modal_logo_url||"",onChange:s=>l("modal_logo_url",s.target.value||null),placeholder:"https://..."})]}),e.jsxs("div",{children:[e.jsx(r,{children:"Texto Introdutório"}),e.jsx(k,{value:a.modal_intro_text,onChange:s=>l("modal_intro_text",s.target.value),rows:2})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(r,{children:"Raio da Borda (px)"}),e.jsx(i,{type:"number",value:a.modal_border_radius,onChange:s=>l("modal_border_radius",parseInt(s.target.value)||12)})]}),e.jsxs("div",{children:[e.jsx(r,{children:"Opacidade do Backdrop (0-1)"}),e.jsx(i,{type:"number",step:"0.1",min:"0",max:"1",value:a.modal_backdrop_opacity,onChange:s=>l("modal_backdrop_opacity",parseFloat(s.target.value)||.5)})]})]})]})]})}),e.jsxs(b,{value:"display",className:"space-y-6",children:[e.jsxs(d,{children:[e.jsx(c,{children:e.jsx(t,{children:"Onde Exibir"})}),e.jsxs(h,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(r,{children:"Exibir em"}),e.jsxs(u,{value:a.display_on,onValueChange:s=>l("display_on",s),children:[e.jsx(j,{children:e.jsx(m,{})}),e.jsxs(g,{children:[e.jsx(n,{value:"all",children:"Todas as páginas"}),e.jsx(n,{value:"home",children:"Somente na Home"}),e.jsx(n,{value:"specific",children:"Páginas específicas"})]})]})]}),a.display_on==="specific"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(r,{children:"Selecione as páginas"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:E.map(s=>e.jsxs("label",{className:"flex items-center gap-2 p-2 rounded border border-border 
1cursor-pointer hover:bg-muted transition-colors",children:[e.jsx("input",{type:"checkbox",checked:(a.specific_pages||[]).includes(s.value),onChange:()=>B(s.value),className:"rounded"}),e.jsx("span",{children:s.label})]},s.value))})]})]})]}),e.jsxs(d,{children:[e.jsx(c,{children:e.jsx(t,{children:"Excluir das Páginas"})}),e.jsxs(h,{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Selecione as páginas onde o botão NÃO deve aparecer"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:E.map(s=>e.jsxs("label",{className:"flex items-center gap-2 p-2 rounded border border-border cursor-pointer hover:bg-muted transition-colors",children:[e.jsx("input",{type:"checkbox",checked:(a.excluded_pages||[]).includes(s.value),onChange:()=>M(s.value),className:"rounded"}),e.jsx("span",{children:s.label})]},s.value))})]})]}),e.jsxs(d,{children:[e.jsx(c,{children:e.jsx(t,{children:"Dispositivos"})}),e.jsxs(h,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(T,{className:"w-5 h-5 text-muted-foreground"}),e.jsx("span",{children:"Desktop"})]}),e.jsx(x,{checked:a.show_on_desktop,onCheckedChange:s=>l("show_on_desktop",s)})]}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(G,{className:"w-5 h-5 text-muted-foreground"}),e.jsx("span",{children:"Tablet"})]}),e.jsx(x,{checked:a.show_on_tablet,onCheckedChange:s=>l("show_on_tablet",s)})]}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded border border-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"w-5 h-5 text-muted-foreground"}),e.jsx("span",{children:"Mobile"})]}),e.jsx(x,{checked:a.show_on_mobile,onCheckedChange:s=>l("show_on_mobile",s)})]})]})]})]})]})]}):e.jsx("div",{className:"text-center py-8",children:e.jsx("p",{className:"text-muted-foreground",children:"Nenhuma configuração encontrada."})})};export{re as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.