PageSourceSearch

https://ultimatevpn.ai/assets/SupportChat-CAwFPuHb.js

js ultimatevpn.ai collected 2026-10-05 14:14:07 UTC 5,916 bytes, 21 lines download raw bytes

1import{j as e,r as s}from"./vendor-BQJdWDr0.js";import{c as h,u as O,A,i as P}from"./index-D5e-0Yhj.js";/**
2 * @license lucide-react v0.562.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const V=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],z=h("bot",V);/**
7 * @license lucide-react v0.562.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const L=[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]],D=h("mail-check",L);/**
12 * @license lucide-react v0.562.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const H=[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]],U=h("send-horizontal",H);/**
17 * @license lucide-react v0.562.0 - ISC
18 *
19 * This source code is licensed under the ISC license.
20 * See the LICENSE file in the root directory of this source tree.
21 */const q=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],K=h("user-round",q),$="uvpn_support_conversation",B="uvpn_support_conversation_user_",G=5e3,Y=(o,l)=>async(p,n)=>{if(o)return l(n===void 0?"GET":"POST",p,n);const c=await fetch(`${A}${p}`,{method:n===void 0?"GET":"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:n===void 0?void 0:JSON.stringify(n)}),u=await c.json();if(!c.ok||!P(u))throw new Error("Support chat is unavailable right now.");return u.data};function I(o,l){return o&&l?`${B}${l}`:$}const T=({authenticated:o})=>{const{apiCall:l,user:p}=O(),n=p?.id??"",[c,u]=s.useState(()=>{try{return localStorage.getItem($)??""}catch{return""}}),[m,b]=s.useState([]),[S,v]=s.useState("open"),[x,w]=s.useState(""),[N,_]=s.useState(!1),[j,k]=s.useState(null),E=s.useRef(null),d=s.useRef("");s.useEffect(()=>{if(o)try{u(localStorage.getItem(I(!0,n))??"")}catch{}},[o,n]);const f=Y(o,l),y=o?"/user/support/chat":"/support/chat",g=s.useCallback(async()=>{if(c)try{const t=d.current?`?after=${encodeURIComponent(d.current)}`:"",r=await f(`${y}/${c}/messages${t}`);if(r.messages.length>0){const a=r.messages[r.messages.length-1];a&&(d.current=a.created_at),b(i=>[...i,...r.messages])}v(r.status)}catch{}},[c,f,y]);s.useEffect(()=>{if(!c)return;d.current="",g();const t=setInterval(()=>void g(),G);return()=>clearInterval(t)},[c,g]),s.useEffect(()=>{const t=E.current;t&&typeof t.scrollTo=="function"&&t.scrollTo({top:t.scrollHeight})},[m]);const C=async t=>{t.preventDefault();const r=x.trim();if(!(!r||N)){_(!0),k(null);try{const a=await f(y,{conversation_id:c,message:r});w(""),u(a.conversation_id),d.current="";try{localStorage.setItem(I(o,n),a.conversation_id)}catch{}v(a.status),b(i=>[...i,{author:"customer",body:r,created_at:new Date().toISOString()},{author:"ai",body:a.reply,created_at:new Date().toISOString()}])}catch(a){k(a instanceof Error?a.message:"Support chat is unavailable right now.")}finally{_(!1)}}},M=S==="escalated"||S==="answered";return e.jsxs("section",{className:"glass rounded-[2rem] border border-white/10 p-6 space-y-4","aria-label":"Support chat",children:[M&&e.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-amber-500/20 bg-amber-950/10 px-4 py-2 text-sm text-amber-400",children:[e.jsx(D,{className:"w-4 h-4 shrink-0"}),"Escalated — our team will reply by email and here."]}),e.jsxs("div",{ref:E,className:"max-h-96 space-y-3 overflow-y-auto pr-1",children:[m.length===0&&e.jsx("p",{className:"text-sm text-slate-500",children:"Ask anything about UltimateVPN — plans, regions, connection issues."}),m.map((t,r)=>{const a=t.author==="admin",i=t.author==="customer",R=i?"ml-auto bg-blue-600/80 text-white":a?"mr-auto bg-emerald-900/60 border border-emerald-500/30 text-emerald-50":"mr-auto bg-slate-900/80 text-slate-200";return e.jsxs("div",{className:`flex items-start gap-2 ${i?"flex-row-reverse":""}`,children:[e.jsx("span",{className:"mt-1 shrink-0 text-slate-500",children:t.author==="ai"?e.jsx(z,{className:"w-4 h-4"}):e.jsx(K,{className:"w-4 h-4"})}),e.jsx("div",{className:`max-w-[75%] whitespace-pre-wrap rounded-2xl px-4 py-2 text-sm ${R}`,children:t.body})]},`${t.created_at}-${r}`)})]}),e.jsxs("form",{onSubmit:C,className:"flex gap-2",children:[e.jsx("input",{value:x,onChange:t=>w(t.target.value),placeholder:"Type your question…","aria-label":"Support chat message",className:"w-full rounded-xl border border-white/10 bg-slate-900/60 px-4 py-3 text-sm text-white placeholder:text-slate-600 focus:border-blue-400 focus:outline-none"}),e.jsx("button",{type:"submit",disabled:N||!x.trim(),"aria-label":"Send message",className:"rounded-xl bg-blue-600 px-4 py-3 text-sm font-bold text-white disabled:opacity-40",children:e.jsx(U,{className:"w-4 h-4"})})]}),j&&e.jsx("p",{className:"text-sm text-red-400",children:j})]})},X=()=>e.jsxs("main",{className:"mx-auto max-w-3xl space-y-6 px-4 py-10",children:[e.jsx("h1",{className:"text-3xl font-black italic uppercase tracking-tighter text-white",children:"Support page"}),e.jsx(T,{authenticated:!1})]}),Q=()=>e.jsxs("main",{className:"mx-auto max-w-3xl space-y-6",children:[e.jsx("h1",{className:"text-4xl font-black italic uppercase tracking-tighter text-white",children:"Support page"}),e.jsx(T,{authenticated:!0})]});
21export{Q as PortalSupportPage,X as PublicSupportPage,T 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.