PageSourceSearch

https://suvorovo.bg/_next/static/chunks/app/(public)/contact/page-2848a84a8b3c7589.js

js suvorovo.bg collected 2026-10-01 13:02:20 UTC 11,732 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6344],{1918:(e,r,t)=>{"use strict";t.d(r,{default:()=>i});var s=t(5155),a=t(2115),n=t(4185);let o=/^(?:\+359|00359|0)\d{9}$/;function i(e){let{recaptchaSiteKey:r}=e,[t,i]=(0,a.useState)("idle"),[c,l]=(0,a.useState)(""),[d,m]=(0,a.useState)({}),[x,u]=(0,a.useState)(!1),h=(0,a.useRef)(null),p=(0,a.useRef)(null),b=(0,a.useCallback)(e=>{h.current=e},[]);async function g(e){e.preventDefault(),l(""),m({});let r=e.currentTarget,t=new FormData(r),s=function(e){let r={},t=(e.get("name")||"").trim(),s=(e.get("email")||"").trim(),a=(e.get("phone")||"").replace(/\s+/g,""),n=(e.get("subject")||"").trim(),i=(e.get("message")||"").trim();return t?t.length>100&&(r.name="Името не може да е повече от 100 символа."):r.name="Моля, въведете Вашето име.",s?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s)||(r.email="Моля, въведете валиден имейл адрес."):r.email="Моля, въведете имейл адрес.",a?o.test(a)||(r.phone="Въведете валиден български телефонен номер (напр. 0888123456 или +359888123456)."):r.phone="Моля, въведете телефонен номер.",n?n.length>200&&(r.subject="Темата не може да е повече от 200 символа."):r.subject="Моля, въведете тема.",i?i.length<10?r.message="Съобщението трябва да е поне 10 символа.":i.length>5e3&&(r.message="Съобщението не може да е повече от 5000 символа."):r.message="Моля, въведете съобщение.",r}(t);if(Object.keys(s).length>0){m(s),i("idle"),requestAnimationFrame(()=>(function(e){for(let t of["name","email","phone","subject","message"])if(e[t]){var r;let e=null==(r=p.current)?void 0:r.querySelector('[name="'.concat(t,'"]'));null==e||e.focus();break}})(s));return}if(!(x||(m(e=>({...e,gdpr:"Трябва да се съгласите с обработката на личните Ви данни."})),0)))return;i("sending");let a=Object.fromEntries(t);h.current&&(a.recaptchaToken=h.current);try{let e=await fetch("/api/contact",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!e.ok){let r=await e.json().catch(()=>({}));l(r.error||"Възникна грешка. Моля, опитайте отново."),i("error");return}i("success"),r.reset()}catch(e){l("Няма връзка със сървъра. Моля, опитайте по-късно."),i("error")}}return(0,s.jsxs)("form",{ref:p,onSubmit:g,noValidate:!0,className:"space-y-5",children:[(0,s.jsxs)("div",{className:"absolute -left-[9999px]","aria-hidden":"true",children:[(0,s.jsx)("label",{htmlFor:"website",children:"Не попълвайте"}),(0,s.jsx)("input",{type:"text",id:"website",name:"website",tabIndex:-1,autoComplete:"off"})]}),"success"===t&&(0,s.jsx)("div",{role:"status",className:"rounded-lg bg-success/10 border border-success/20 px-4 py-3 text-sm text-success",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("svg",{className:"h-5 w-5 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[(0,s.jsx)("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),(0,s.jsx)("polyline",{points:"22 4 12 14.01 9 11.01"})]}),(0,s.jsx)("span",{children:"Съобщението е изпратено успешно! Ще се свържем с Вас в най-кратък срок."})]})}),"error"===t&&c&&(0,s.jsx)("div",{role:"alert",className:"rounded-lg bg-error/10 border border-error/20 px-4 py-3 text-sm text-error",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("svg",{className:"h-5 w-5 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,s.jsx)("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),(0,s.jsx)("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),(0,s.jsx)("span",{children:c})]})}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{htmlFor:"contact-name",className:"mb-1.5 block text-sm font-medium text-text-main",children:["Вашето име ",(0,s.jsx)("span",{className:"text-error",children:"*"})]}),(0,s.jsx)("input",{id:"contact-name",name:"name",type:"text",required:!0,maxLength:100,placeholder:"Иван Иванов","aria-invalid":!!d.name,"aria-describedby":d.name?"error-name":void 0,className:"w-full rounded-lg border bg-background px-4 py-2.5 text-sm text-text-main placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary transition-colors ".concat(d.name?"border-error":"border-border")}),d.name&&(0,s.jsx)("p",{id:"error-name",role:"alert",className:"mt-1 text-xs text-error",children:d.name})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{htmlFor:"contact-email",className:"mb-1.5 block text-sm font-medium text-text-main",children:["Имейл адрес ",(0,s.jsx)("span",{className:"text-error",children:"*"})]}),(0,s.jsx)("input",{id:"contact-email",name:"email",type:"email",required:!0,maxLength:254,placeholder:"[email protected]","aria-invalid":!!d.email,"aria-describedby":d.email?"error-email":void 0,className:"w-full rounded-lg border bg-background px-4 py-2.5 text-sm text-text-main placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary transition-colors ".concat(d.email?"border-error":"border-border")}),d.email&&(0,s.jsx)("p",{id:"error-email",role:"alert",className:"mt-1 text-xs text-error",children:d.email})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{htmlFor:"contact-phone",className:"mb-1.5 block text-sm font-medium text-text-main",children:["Телефон ",(0,s.jsx)("span",{className:"text-error",children:"*"})]}),(0,s.jsx)("input",{id:"contact-phone",name:"phone",type:"tel",required:!0,maxLength:20,placeholder:"0888 123 456","aria-invalid":!!d.phone,"aria-describedby":d.p
1hone?"error-phone":"phone-hint",className:"w-full rounded-lg border bg-background px-4 py-2.5 text-sm text-text-main placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary transition-colors ".concat(d.phone?"border-error":"border-border")}),d.phone?(0,s.jsx)("p",{id:"error-phone",role:"alert",className:"mt-1 text-xs text-error",children:d.phone}):(0,s.jsx)("p",{id:"phone-hint",className:"mt-1 text-xs text-text-muted",children:"Формат: 0888123456 или +359888123456"})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{htmlFor:"contact-subject",className:"mb-1.5 block text-sm font-medium text-text-main",children:["Тема ",(0,s.jsx)("span",{className:"text-error",children:"*"})]}),(0,s.jsx)("input",{id:"contact-subject",name:"subject",type:"text",required:!0,maxLength:200,placeholder:"Относно...","aria-invalid":!!d.subject,"aria-describedby":d.subject?"error-subject":void 0,className:"w-full rounded-lg border bg-background px-4 py-2.5 text-sm text-text-main placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary transition-colors ".concat(d.subject?"border-error":"border-border")}),d.subject&&(0,s.jsx)("p",{id:"error-subject",role:"alert",className:"mt-1 text-xs text-error",children:d.subject})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{htmlFor:"contact-message",className:"mb-1.5 block text-sm font-medium text-text-main",children:["Съобщение ",(0,s.jsx)("span",{className:"text-error",children:"*"})]}),(0,s.jsx)("textarea",{id:"contact-message",name:"message",required:!0,minLength:10,maxLength:5e3,rows:6,placeholder:"Вашето съобщение...","aria-invalid":!!d.message,"aria-describedby":d.message?"error-message":"message-hint",className:"w-full rounded-lg border bg-background px-4 py-2.5 text-sm text-text-main placeholder:text-text-muted focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary transition-colors resize-y ".concat(d.message?"border-error":"border-border")}),d.message?(0,s.jsx)("p",{id:"error-message",role:"alert",className:"mt-1 text-xs text-error",children:d.message}):(0,s.jsx)("p",{id:"message-hint",className:"mt-1 text-xs text-text-muted",children:"Минимум 10 символа"})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("input",{id:"contact-gdpr",type:"checkbox",checked:x,onChange:e=>{u(e.target.checked),e.target.checked&&m(e=>({...e,gdpr:void 0}))},"aria-invalid":!!d.gdpr,"aria-describedby":d.gdpr?"error-gdpr":void 0,className:"mt-0.5 h-4 w-4 shrink-0 cursor-pointer accent-primary"}),(0,s.jsxs)("label",{htmlFor:"contact-gdpr",className:"text-sm text-text-main leading-snug cursor-pointer",children:["Съгласен/а съм личните ми данни да бъдат обработени за целите на запитването съгласно"," ",(0,s.jsx)("a",{href:"/privacy",className:"text-primary underline hover:no-underline focus:outline-none focus:ring-1 focus:ring-primary rounded",children:"Политиката за поверителност"})," ","и изискванията на GDPR. ",(0,s.jsx)("span",{className:"text-error",children:"*"})]})]}),d.gdpr&&(0,s.jsx)("p",{id:"error-gdpr",role:"alert",className:"mt-1 text-xs text-error",children:d.gdpr})]}),r&&(0,s.jsx)(n.A,{siteKey:r,onToken:b}),(0,s.jsx)("button",{type:"submit",disabled:"sending"===t,className:"inline-flex items-center gap-2 rounded-lg bg-primary px-6 py-3 text-sm font-semibold text-white shadow-sm hover:bg-primary-hover focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 disabled:opacity-60 transition-colors",children:"sending"===t?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("svg",{className:"h-4 w-4 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Изпращане…"]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,children:[(0,s.jsx)("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),(0,s.jsx)("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]}),"Изпрати съобщение"]})}),(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"Вашите данни ще бъдат използвани единствено за отговор на запитването и няма да бъдат споделяни с трети страни."})]})}},4185:(e,r,t)=>{"use strict";t.d(r,{A:()=>c});var s=t(5155),a=t(2115);let n=!1,o=!1,i=[];function c(e){let{siteKey:r,onToken:t}=e,c=(0,a.useRef)(null),l=(0,a.useRef)(null),d=(0,a.useRef)(!1),m=(0,a.useCallback)(()=>{var e;c.current&&!d.current&&(null==(e=window.grecaptcha)?void 0:e.render)&&(d.current=!0,l.current=window.grecaptcha.render(c.current,{sitekey:r,callback:e=>t(e),"expired-callback":()=>t(null)}))},[r,t]);return(0,a.useEffect)(()=>
1(n?m():(i.push(m),!function(){if(n){i.forEach(e=>e()),i.length=0;return}if(o)return;o=!0,window.onRecaptchaLoaded=()=>{n=!0,o=!1,i.forEach(e=>e()),i.length=0};let e=document.createElement("script");e.src="https://www.google.com/recaptcha/api.js?onload=onRecaptchaLoaded&render=explicit",e.async=!0,e.defer=!0,document.head.appendChild(e)}()),()=>{let e=i.indexOf(m);e>=0&&i.splice(e,1)}),[m]),(0,s.jsx)("div",{ref:c,className:"mt-2"})}},7916:(e,r,t)=>{Promise.resolve().then(t.bind(t,1918)),Promise.resolve().then(t.t.bind(t,2619,23))}},e=>{e.O(0,[2619,8441,1255,7358],()=>e(e.s=7916)),_N_E=e.O()}]);

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.