PageSourceSearch

https://bepay.money/_next/static/chunks/2711.7baea75200cf3680.js

js bepay.money collected 2026-10-05 00:58:46 UTC 9,673 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2711],{12486:(e,t,a)=>{a.d(t,{A:()=>s});let s=(0,a(19946).A)("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]])},51154:(e,t,a)=>{a.d(t,{A:()=>s});let s=(0,a(19946).A)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},72711:(e,t,a)=>{a.r(t),a.d(t,{default:()=>b});var s=a(95155),n=a(12115),r=a(58918),l=a(60760),i=a(54416),o=a(19946);let c=(0,o.A)("message-circle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]),d=(0,o.A)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);var u=a(51154),p=a(12486);let h=/\r\n\r\n|\n\n|\r\r/,x="bepay_ai_conversation_id";function m(e){let t=()=>{var e,t,a;return null!=(a=null==(t=globalThis.crypto)||null==(e=t.randomUUID)?void 0:e.call(t))?a:"".concat(Date.now().toString(36),"-").concat(Math.random().toString(36).slice(2,10))};try{let a=window.localStorage.getItem(e);if(a)return a;let s=t();return window.localStorage.setItem(e,s),s}catch(e){return t()}}var y=a(78874);let g=["What is bepay money?","How do I accept crypto payments?","Which currencies do you support?","How do I get started?"];function b(){var e;let[t,a]=(0,n.useState)(!1),[o,b]=(0,n.useState)(""),{messages:f,isStreaming:v,toolActivity:w,error:j,send:N,reset:k}=function(){let[e,t]=(0,n.useState)([]),[a,s]=(0,n.useState)(!1),[r,l]=(0,n.useState)(null),[i,o]=(0,n.useState)(null),c=(0,n.useRef)({visitorId:null,conversationId:null}),d=(0,n.useRef)(null);(0,n.useEffect)(()=>{c.current={visitorId:m("bepay_ai_visitor_id"),conversationId:m(x)}},[]),(0,n.useEffect)(()=>()=>{var e;return null==(e=d.current)?void 0:e.abort()},[]);let u=(0,n.useCallback)(()=>{var e,a,n,r;null==(e=d.current)||e.abort(),t([]),o(null),l(null),s(!1);let i=null!=(r=null==(n=globalThis.crypto)||null==(a=n.randomUUID)?void 0:a.call(n))?r:"".concat(Date.now().toString(36),"-").concat(Math.random().toString(36).slice(2,10));c.current.conversationId=i;try{window.localStorage.setItem(x,i)}catch(e){}},[]),p=(0,n.useCallback)(async e=>{let n=e.trim();if(!n||a)return;o(null),t(e=>[...e,{id:"u-".concat(Date.now()),role:"user",content:n},{id:"a-".concat(Date.now()),role:"assistant",content:""}]),s(!0);let r=new AbortController;d.current=r;let i=e=>{t(t=>{let a=[...t],s=a[a.length-1];return(null==s?void 0:s.role)==="assistant"&&(a[a.length-1]={...s,content:s.content+e}),a})};try{let e=await fetch("/api/ai/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:n,conversationId:c.current.conversationId,visitorId:c.current.visitorId}),signal:r.signal});if(!e.ok||!e.body){let t=await e.json().catch(()=>null);throw Error((null==t?void 0:t.message)||"The assistant is unavailable right now.")}let a=e.body.getReader(),s=new TextDecoder,o="";for(;;){var u,p,x;let{done:e,value:n}=await a.read();if(e)break;let r=(o+=s.decode(n,{stream:!0})).split(h);for(let e of(o=null!=(u=r.pop())?u:"",r)){let a,s="message",n="";for(let t of e.split(/\r?\n/))t.startsWith("event:")?s=t.slice(6).trim():t.startsWith("data:")&&(n+=t.slice(5).trim());if(n){try{a=JSON.parse(n)}catch(e){continue}if("delta"===s)l(null),i(null!=(p=a.text)?p:"");else if("tool"===s)l(null!=(x=a.name)?x:null);else if("done"===s)l(null),a.escalation&&t(e=>{let t=[...e],a=t[t.length-1];return(null==a?void 0:a.role)==="assistant"&&(t[t.length-1]={...a,escalated:!0}),t});else if("error"===s)throw Error(a.message||"Something went wrong.")}}}}catch(e){if("AbortError"===e.name)return;o(e.message||"Something went wrong."),t(e=>{let t=[...e],a=t[t.length-1];return(null==a?void 0:a.role)!=="assistant"||a.content||t.pop(),t})}finally{s(!1),l(null),d.current=null}},[a]);return{messages:e,isStreaming:a,toolActivity:r,error:i,send:p,reset:u}}(),_=(0,n.useRef)(null),S=(0,n.useRef)(null);(0,n.useEffect)(()=>{var e;null==(e=_.current)||e.scrollTo({top:_.current.scrollHeight,behavior:"smooth"})},[f,w]),(0,n.useEffect)(()=>{var e;t&&(null==(e=S.current)||e.focus())},[t]),(0,n.useEffect)(()=>
1{if(!t)return;let e=e=>{"Escape"===e.key&&a(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t]);let A=()=>{a(e=>(y.c.sendEvent(e?"ai_chat_closed":"ai_chat_opened"),!e))},I=e=>{v||(y.c.sendEvent("ai_chat_suggestion_clicked"),N(e))};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.P.button,{type:"button",onClick:A,"aria-label":t?"Close support assistant":"Open support assistant","aria-expanded":t,className:"fixed bottom-5 right-5 z-[60] flex h-14 w-14 items-center justify-center rounded-full bg-[#080808] text-white shadow-lg transition-colors hover:bg-[#2a2a2a] focus:outline-none focus-visible:ring-2 focus-visible:ring-black focus-visible:ring-offset-2",whileTap:{scale:.94},children:(0,s.jsx)(l.N,{mode:"wait",initial:!1,children:(0,s.jsx)(r.P.span,{initial:{opacity:0,rotate:-45},animate:{opacity:1,rotate:0},exit:{opacity:0,rotate:45},transition:{duration:.15},children:t?(0,s.jsx)(i.A,{size:22}):(0,s.jsx)(c,{size:22})},t?"close":"open")})}),(0,s.jsx)(l.N,{children:t&&(0,s.jsxs)(r.P.div,{role:"dialog","aria-label":"bepay support assistant","data-lenis-prevent":!0,initial:{opacity:0,y:16,scale:.98},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:16,scale:.98},transition:{duration:.18,ease:"easeOut"},className:"fixed bottom-24 right-2 left-2 z-[60] flex h-[min(70dvh,560px)] flex-col overflow-hidden rounded-2xl border border-gray-200 bg-white shadow-2xl sm:left-auto sm:right-5 sm:w-[400px]",children:[(0,s.jsxs)("div",{className:"flex shrink-0 items-center justify-between border-b border-gray-100 px-4 py-3",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"truncate text-sm font-semibold text-[#080808]",children:"bepay assistant"}),(0,s.jsx)("p",{className:"truncate text-xs text-gray-500",children:"Answers about bepay money"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("button",{type:"button",onClick:k,"aria-label":"Start a new conversation",title:"New conversation",className:"rounded-lg p-2 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-700",children:(0,s.jsx)(d,{size:16})}),(0,s.jsx)("button",{type:"button",onClick:A,"aria-label":"Close",className:"rounded-lg p-2 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-700",children:(0,s.jsx)(i.A,{size:16})})]})]}),(0,s.jsxs)("div",{ref:_,className:"min-h-0 flex-1 space-y-3 overflow-y-auto overscroll-contain px-4 py-4",children:[0===f.length&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"Hi — ask me anything about bepay money: payments, fees, supported currencies, getting set up, or how the app works."}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:g.map(e=>(0,s.jsx)("button",{type:"button",onClick:()=>I(e),className:"rounded-full border border-gray-200 px-3 py-1.5 text-xs text-gray-700 transition-colors hover:border-gray-400 hover:bg-gray-50",children:e},e))})]}),f.map(e=>(0,s.jsx)("div",{className:"user"===e.role?"flex justify-end":"flex justify-start",children:(0,s.jsxs)("div",{className:"user"===e.role?"max-w-[85%] rounded-2xl rounded-br-sm bg-[#080808] px-3.5 py-2.5 text-sm text-white":"max-w-[85%] rounded-2xl rounded-bl-sm bg-gray-100 px-3.5 py-2.5 text-sm text-[#080808]",children:[(0,s.jsx)("p",{className:"whitespace-pre-wrap break-words",children:e.content}),e.escalated&&(0,s.jsxs)("p",{className:"mt-2 border-t border-gray-300 pt-2 text-xs text-gray-600",children:["You can also email"," ",(0,s.jsx)("a",{className:"underline",href:"mailto:[email protected]",children:"[email protected]"}),"."]})]})},e.id)),w&&(0,s.jsxs)("div",{className:"flex items-center gap-2 px-1 text-xs text-gray-500",children:[(0,s.jsx)(u.A,{size:12,className:"animate-spin"}),function(e){switch(e){case"search_bepay_knowledge":return"Looking that up…";case"escalate_to_human":return"Connecting you with support…";default:return"Working on it…"}}(w)]}),v&&!w&&!(null==(e=f[f.length-1])?void 0:e.content)&&(0,s.jsxs)("div",{className:"flex items-center gap-2 px-1 text-xs text-gray-500",children:[(0,s.jsx)(u.A,{size:12,className:"animate-spin"}),"Thinking…"]}),j&&(0,s.jsx)("p",{role:"alert",className:"rounded-lg bg-red-50 px-3 py-2 text-xs text-red-700",children:j})]}),(0,s.jsxs)("form",{onSubmit:e=>{e.preventDefault(),o.trim()&&!v&&(b(""),y.c.sendEvent("ai_chat_message_sent"),N(o))},className:"shrink-0 border-t border-gray-100 p-3",children:[(0,s.jsxs)("div",{className:"flex items-end gap-2",children:[(0,s.jsx)("label",{htmlFor:"bepay-ai-input",className:"sr-only",children:"Message the bepay assistant"}),(0,s.jsx)("input",{id:"bepay-ai-input",ref:S,value:o,onChange:e=>b(e.target.value),placeholder:"Ask about bepay…",maxLength:4e3,disabled:v,className:"min-w-0 flex-1 rounded-xl border border-gray-200 px-3 py-2.5 text-sm outline-none transition-colors focus:border-gray-400 disabled:bg-gray-50"}),(0,s.jsx)("button",{type:"submit",disabled:v||!o.trim(),"aria-label":"Send message",className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-[#080808] text-white transition-opacity disabled:opacity-40",children:v?(0,s.jsx)(u.A,{size:16,className:"animate-spin"}):(0,s.jsx)(p.A,{size:16})})]}),(0,s.jsx)("p",{className:"mt-2 text-center text-[10px] leading-tight text-gray-400",children:"AI assistant — may be inaccurate. For account help, sign in to the bepay app."})]})]})})]})}}}]);

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.