PageSourceSearch

https://destination-estespark.com/assets/WeddingAiAssistant-BzA7VUtT.js

js destination-estespark.com collected 2026-10-10 02:12:17 UTC 5,799 bytes, 1 lines download raw bytes

1import{i as C,r as n,j as e}from"./index-A42Nt5u3.js";const b="/api/wedding-ai";async function N(){var t;const s=await((t=C.currentUser)==null?void 0:t.getIdToken());return{"Content-Type":"application/json",...s?{Authorization:`Bearer ${s}`}:{}}}async function I(s){const t=await fetch(`${b}/chat`,{method:"POST",headers:await N(),body:JSON.stringify({messages:s})});if(!t.ok)throw new Error((await t.json().catch(()=>({}))).detail||`Assistant unavailable (${t.status})`);return(await t.json()).reply}async function T(s,t,r){const l=await fetch(`${b}/escalate`,{method:"POST",headers:await N(),body:JSON.stringify({question:s,contactName:t,contactEmail:r})});if(!l.ok)throw new Error((await l.json().catch(()=>({}))).detail||`Could not send (${l.status})`);return(await l.json()).message}const H="Aloha! 🌺 I’m your Aloha Wedding Assistant. Ask me anything about planning your HawaiÊ»i wedding — venues and beaches, permits, timelines, budgets, the best season, or what kind of vendors to line up. I know your saved plan, so I can keep it specific.",W=["What’s the best month for a KauaÊ»i beach ceremony?","Build me a 12-month planning timeline.","What vendors do I still need to book?","How do beach permits and the marriage license differ?"];function O(){const[s,t]=n.useState([]),[r,l]=n.useState(""),[c,p]=n.useState(!1),[x,d]=n.useState(""),[v,h]=n.useState(!1),[j,k]=n.useState(""),[y,S]=n.useState(""),[g,f]=n.useState(""),m=n.useRef(null);n.useEffect(()=>{var a;(a=m.current)==null||a.scrollTo({top:m.current.scrollHeight,behavior:"smooth"})},[s,c]);async function u(a){const o=a.trim();if(!o||c)return;d(""),l("");const i=[...s,{role:"user",content:o}];t(i),p(!0);try{const w=await I(i);t(A=>[...A,{role:"assistant",content:w}])}catch(w){d(w.message)}finally{p(!1)}}async function E(){var o;const a=((o=s.filter(i=>i.role==="user").slice(-1)[0])==null?void 0:o.content)||"A couple would like to speak with the team about their HawaiÊ»i wedding.";d("");try{const i=await T(a,j.trim(),y.trim());f(i)}catch(i){d(i.message)}}return e.jsxs("div",{className:"wed-editorial wai-page",children:[e.jsxs("header",{className:"wai-head",children:[e.jsx("span",{className:"wed-eyebrow",children:"Aloha Wedding Elite"}),e.jsx("h1",{className:"wed-serif",children:"AI HawaiÊ»i Wedding Assistant"}),e.jsx("p",{className:"wai-lede",children:"Your always-on planning companion. It knows your saved plan and answers HawaiÊ»i-specific questions instantly. It’s an AI, not a person — when you’d rather talk to someone, just ask the team."})]}),e.jsxs("div",{className:"wai-chat",ref:m,children:[e.jsxs("div",{className:"wai-msg wai-msg-ai",children:[e.jsx("span",{className:"wai-avatar","aria-hidden":"true",children:"🌺"}),e.jsx("div",{className:"wai-bubble",children:H})]}),s.map((a,o)=>e.jsxs("div",{className:`wai-msg ${a.role==="user"?"wai-msg-user":"wai-msg-ai"}`,children:[a.role==="assistant"&&e.jsx("span",{className:"wai-avatar","aria-hidden":"true",children:"🌺"}),e.jsx("div",{className:"wai-bubble",children:a.content})]},o)),c&&e.jsxs("div",{className:"wai-msg wai-msg-ai",children:[e.jsx("span",{className:"wai-avatar","aria-hidden":"true",children:"🌺"}),e.jsxs("div",{className:"wai-bubble wai-typing",children:[e.jsx("span",{}),e.jsx("span",{}),e.jsx("span",{})]})]})]}),s.length===0&&e.jsx("div",{className:"wai-suggests",children:W.map(a=>e.jsx("button",{type:"button",className:"wai-chip",onClick:()=>u(a),children:a},a))}),x&&e.jsx("p",{className:"wai-err",role:"alert",children:x}),e.jsxs("form",{className:"wai-composer",onSubmit:a=>{a.preventDefault(),u(r)},children:[e.jsx("textarea",{value:r,onChange:a=>l(a.target.value),onKeyDown:a=>{a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),u(r))},placeholder:"Ask about your HawaiÊ»i wedding…",rows:2,maxLength:4e3}),e.jsx("button",{type:"submit",className:"wed-cta wed-cta-primary",disabled:c||!r.trim(),children:"Send"})]}),e.jsxs("div",{className:"wai-escalate-row",children:[e.jsx("span",{children:"Prefer to talk to a person?"}),e.jsx("button",{type:"button",className:"wai-linkbtn",onClick:()=>{h(!0),f("")},children:"Ask the team →"})]}),e.jsx("p",{className:"wai-disc",children:"The assistant offers planning guidance, not legal advice, and doesn’t book vendors or handle your day-of coordination. For beach permits and your marriage license, use the dedicated tools in your plan."}),v&&e.jsx("div",{className:"wai-modal-backdrop",onClick:()=>h(!1),children:e.jsx("div",{className:"wai-modal",role:"dialog","aria-modal":"true","aria-label":"Ask the team",onClick:a=>a.stopPropagation(),children:g?e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"wed-serif",children:"Message sent 🌺"}),e.jsx("p",{children:g}),e.jsx("div",{className:"wai-modal-actions",children:e.jsx("button",{type:"button",className:"wed-cta wed-cta-primary",onClick:()=>h(!1),children:"Close"})})]}):e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"wed-serif",children:"Ask the team"}),e.jsx("p",{children:"We’ll send your most recent question to the team, who’ll follow up by email. (This is a human fallback — response times vary.)"}),e.jsxs("label",{className:"wai-modal-field",children:[e.jsx("span",{children:"Your name"}),e.jsx("input",{type:"text",value:j,maxLength:120,onChange:a=>k(a.target.value)})]}),e.jsxs("label",{className:"wai-modal-field",children:[e.jsx("span",{children:"Email for a reply"}),e.jsx("input",{type:"email",value:y,maxLength:200,onChange:a=>S(a.target.value),placeholder:"[email protected]"})]}),e.jsxs("div",{className:"wai-modal-actions",children:[e.jsx("button",{type:"button",className:"wed-cta wed-cta-ghost",onClick:()=>h(!1),children:"Cancel"}),e.jsx("button",{type:"button",className:"wed-cta wed-cta-primary",onClick:E,children:"Send to team"})]})]})})})]})}export{O 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.