PageSourceSearch

https://www.quieroajedrez.com/assets/ValentinWidget-CaPoNUic.js

js quieroajedrez.com collected 2026-10-02 01:40:21 UTC 6,202 bytes, 2 lines download raw bytes

1import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{i as t,r as n}from"./framework-CXnKph_e.js";import{c as r}from"./index-Czijx7pA.js";var i=e(t(),1),a={root:`_root_3ivrx_1`,launcher:`_launcher_3ivrx_2`,window:`_window_3ivrx_3`,counter:`_counter_3ivrx_4`,messages:`_messages_3ivrx_5`,quick:`_quick_3ivrx_6`,whatsapp:`_whatsapp_3ivrx_6`,privacy:`_privacy_3ivrx_7`,contact:`_contact_3ivrx_8`,contactHeading:`_contactHeading_3ivrx_8`,locationFields:`_locationFields_3ivrx_8`,contactButton:`_contactButton_3ivrx_8`},o=n(),s=e=>`https://wa.me/34674480125?text=${encodeURIComponent([`Hola Gustavo, soy ${e.name||``}.`,`He hablado con Valentín en Quiero Ajedrez y me interesa conocer la clase de prueba online de 30 minutos.`,e.city?`Ciudad: ${e.city}`:``,e.interest?`Interés: ${e.interest}`:``,`Me gustaría coordinar día y hora.`].filter(Boolean).join(`
2`))}`;function c(){let e=r(),[t,n]=(0,i.useState)(!1),[c,l]=(0,i.useState)(``),[u,d]=(0,i.useState)(!1),[f,p]=(0,i.useState)([{role:`valentin`,body:`¡Bienvenido! ♟️ Soy Valentín, el Peón Valiente de Quiero Ajedrez. Soy el asistente digital de la Academia; no soy Gustavo. ¿Cómo te llamas?`}]),[m,h]=(0,i.useState)(``),[g,_]=(0,i.useState)(``),[v,y]=(0,i.useState)({}),[b,x]=(0,i.useState)(!1),[S,C]=(0,i.useState)({name:``,email:``,phone:``,city:``,country:``}),[w,T]=(0,i.useState)(0),[E,D]=(0,i.useState)(!1),O=(0,i.useRef)(null);(0,i.useEffect)(()=>{_(localStorage.getItem(`qa-valentin-key`)||crypto.randomUUID())},[]),(0,i.useEffect)(()=>{g&&localStorage.setItem(`qa-valentin-key`,g)},[g]);let k=(0,i.useMemo)(()=>v.nextStep===`recommended`?[`Quiero conocer mi nivel`,`Me interesa una clase de prueba`,`Quiero aprender por mi cuenta`]:[],[v.nextStep]);if((0,i.useEffect)(()=>{let e=O.current;e&&requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight})}
2,[f,t]),e.startsWith(`/miembros`)||e.startsWith(`/membresias`))return null;async function A(e=c,t){let n=e.trim();if(!(!n||u||!g||E&&!t)){p(e=>[...e,{role:`visitor`,body:n}]),l(``),d(!0);try{let e=await fetch(`/api/valentin`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({conversationId:m,visitorKey:g,message:n,consent:!!t,contact:t})}),r=await e.json();if(!e.ok||!r.reply)throw Error(r.error||`No he podido responder.`);h(r.conversationId||``),_(r.visitorKey||g),y(r.profile||{}),T(typeof r.exchangesUsed==`number`?r.exchangesUsed:w),D(!!r.limitReached),p(e=>[...e,{role:`valentin`,body:r.reply}])}catch{p(e=>[...e,{role:`valentin`,body:`Ahora mismo se me ha escapado una pieza del tablero. Prueba de nuevo en un momento, por favor.`}])}finally{d(!1)}}}function j(e){e.preventDefault(),A()}return(0,o.jsxs)(`aside`,{className:a.root,"aria-live":`polite`,children:[t?(0,o.jsxs)(`section`,{className:a.window,"aria-label":`Chat con Valentín`,children:[(0,o.jsxs)(`header`,{children:[(0,o.jsx)(`img`,{src:`/images/peon-pensamiento.webp`,alt:`Valentín, el Peón Valiente`}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`strong`,{children:`Valentín`}),(0,o.jsx)(`small`,{children:`El Peón Valiente · Quiero Ajedrez`})]}),(0,o.jsx)(`button`,{type:`button`,onClick:()=>n(!1),"aria-label":`Cerrar chat`,children:`×`})]}),(0,o.jsxs)(`div`,{className:a.counter,children:[(0,o.jsx)(`b`,{children:`Orientación inicial`}),(0,o.jsxs)(`span`,{children:[w,` de 10 intercambios`]})]}),(0,o.jsx)(`div`,{className:a.messages,ref:O,children:f.map((e,t)=>(0,o.jsx)(`p`,{"data-role":e.role,children:e.body},`${e.role}-${t}`))}),k.length?(0,o.jsx)(`div`,{className:a.quick,children:k.map(e=>(0,o.jsx)(`button`,{type:`button`,onClick:()=>void A(e),children:e},e))}):null,b?(0,o.jsxs)(`form`,{className:a.contact,onSubmit:e=>{e.preventDefault(),!(!S.email||!S.phone)&&(x(!1),A(`Te comparto mis datos para que Gustavo pueda orientarme.`,S))},children:[(0,o.jsxs)(`div`,{className:a.contactHeading,children:[(0,o.jsx)(`b`,{children:`Que Gustavo pueda responderte`}),(0,o.jsx)(`small`,{children:`Déjanos estos datos solo si quieres recibir orientación.`})]}),(0,o.jsxs)(`label`,{children:[`Nombre`,(0,o.jsx)(`input`,{required:!0,placeholder:`Tu nombre`,value:S.name,onChange:e=>C({...S,name:e.target.value})})]}),(0,o.jsxs)(`label`,{children:[`Correo electrónico`,(0,o.jsx)(`input`,{required:!0,type:`email`,placeholder:`[email protected]`,value:S.email,onChange:e=>C({...S,email:e.target.value})})]}),(0,o.jsxs)(`label`,{children:[`WhatsApp`,(0,o.jsx)(`input`,{required:!0,placeholder:`+34 …`,value:S.phone,onChange:e=>C({...S,phone:e.target.value})})]}),(0,o.jsxs)(`div`,{className:a.locationFields,children:[(0,o.jsxs)(`label`,{children:[`Ciudad`,(0,o.jsx)(`input`,{placeholder:`Barcelona`,value:S.city,onChange:e=>C({...S,city:e.target.value})})]}),(0,o.jsxs)(`label`,{children:[`País`,(0,o.jsx)(`input`,{placeholder:`España`,value:S.country,onChange:e=>C({...S,country:e.target.value})})]})]}),(0,o.jsx)(`p`,{children:`Al enviarlo autorizas a Quiero Ajedrez a usar estos datos únicamente para atender tu solicitud.`}),(0,o.jsx)(`button`,{children:`Guardar y continuar`})]}):(0,o.jsx)(`button`,{className:a.contactButton,type:`button`,onClick:()=>x(!0),children:`Dejar mis datos para que Gustavo me contacte`}),v.nextStep===`whatsapp_ready`?(0,o.jsx)(`a`,{className:a.whatsapp,href:s(v),target:`_blank`,rel:`noreferrer`,children:`Preparar WhatsApp para Gustavo ↗`}):null,(0,o.jsxs)(`form`,{onSubmit:j,children:[(0,o.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),maxLength:1200,disabled:E,placeholder:E?`Conversación finalizada; puedes dejar tus datos.`:`Escribe tu mensaje…`,"aria-label":`Mensaje para Valentín`}),(0,o.jsx)(`button`,{disabled:u||E,children:u?`…`:`Enviar`})]}),(0,o.jsx)(`small`,{className:a.privacy,children:`Al escribir aceptas que el asistente digital de Quiero Ajedrez procese esta conversación para atender tu consulta. Solo el equipo autorizado puede revisarla.`})]}):null,(0,o.jsxs)(`button`,{className:a.launcher,type:`button`,onClick:()=>n(!0),"aria-label":`Hablar con Valentín`,children:[(0,o.jsx)(`img`,{src:`/images/peon-pensamiento.webp`,alt:``}),(0,o.jsxs)(`span`,{children:[(0,o.jsx)(`strong`,{children:`¿Hablamos?`}),(0,o.jsx)(`small`,{children:`Valentín · El Peón Valiente`})]})]})]})}export{c 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.