PageSourceSearch

https://app.anvevoice.app/assets/QuickStart-CHD6tDsn.js

js anvevoice.app collected 2026-10-02 03:40:56 UTC 13,398 bytes, 1 lines download raw bytes

1import{r as n,a as B,p as Q,x as z,q as W,E as U,j as e,B as q,G as M,D as K,A as J,t as N,u as G,N as Z,H as X,m as _}from"./index-BKInu8Gb.js";import{A as ee,b as te,c as se,d as ae,e as re,f as ie,g as ne,h as oe}from"./alert-dialog-Fn0A1pde.js";import{C as I,a as T,b as E,c as V,d as L}from"./card-BP0uVGrg.js";import{T as le,a as ce,b as D}from"./tabs-DngqmqML.js";import{g as de}from"./embedGenerator-_n6aVVk5.js";import{g as me,P as ue}from"./previewPageTemplate-BCr7ofmb.js";import{u as pe}from"./useEmbeds-CpgIiDFX.js";import{C as $}from"./check-Bo92AKRy.js";import{C as xe}from"./copy-C06rTEVO.js";import{C as fe}from"./circle-check-Bljibo5l.js";import{R as Y}from"./rocket-Bq1EGkIQ.js";import{A as he}from"./arrow-right-CyjUFlGV.js";import{u as ge}from"./useQuickStart-CEwtJ8fJ.js";import{D as be}from"./costEstimator-nQbWfvy8.js";import{a as ye}from"./anvevoice-logo-C8ZQvCP0.js";import{L as ve}from"./loader-circle-CYXtu1pc.js";import"./index-Be2tF3Kx.js";import"./index-DyLHZbNU.js";import"./index-BuvS6xj3.js";import"./index-BdUYosLC.js";import"./config-BSf9rU-h.js";import"./useMutation-BRPD8YYR.js";function je({embed:a,onVerified:r,onStageChange:c}){const[u,C]=n.useState(!1),[y,k]=n.useState("html"),[v,O]=n.useState("business"),P=B(),t=Q(),{updateEmbed:R}=pe(),{toast:S}=z(),f=de(a.id,{position:a.widget_position||"bottom-right",theme:a.widget_theme||"light"}),F=me({widgetCode:f,widgetPosition:a.widget_position||"bottom-right",companyName:a.name||"Acme Corp",pageTitle:"Widget Preview",scenario:v}),[o,h]=n.useState(!1),[A,g]=n.useState(null),j=s=>{if(!s||s.startsWith("about:"))return!1;try{const l=new URL(s).hostname;return!(!l||l==="localhost"||l==="127.0.0.1"||l==="app.anvevoice.app")}catch{return!1}},w=s=>{o||(h(!0),g(s),c==null||c("verified"),r==null||r(s))},{data:b}=W({queryKey:["quickstart-verify",a.id],queryFn:async()=>{const{data:s,error:l}=await t.from("voice_sessions").select("id, page_url").eq("embed_id",a.id).not("page_url","is",null).order("started_at",{ascending:!1}).limit(10);if(l||!s)return null;const d=s.find(m=>j(m.page_url||""));if(d)try{const m=new URL(d.page_url).origin;return a.target_website||R.mutate({id:a.id,target_website:m}),o||U.track("bot.snippet.installed",{embed_id:a.id,install_url:m,session_id:d.id,detected_via:"voice_sessions_poll"}),w(m),{url:m}}catch{return null}return null},refetchInterval:o?!1:5e3,enabled:!o});W({queryKey:["quickstart-embed-watch",a.id],queryFn:async()=>{const{data:s,error:l}=await t.from("embeds").select("target_website").eq("id",a.id).maybeSingle();if(l||!s)return null;const d=s.target_website;if(d&&j(d))try{const m=new URL(d).origin;o||U.track("bot.snippet.installed",{embed_id:a.id,install_url:m,detected_via:"embed_target_website_poll"}),w(m)}catch{w(d)}return d},refetchInterval:o?!1:5e3,enabled:!o});const p=o||!!b||!!a.target_website&&j(a.target_website),H=async()=>{await navigator.clipboard.writeText(f),C(!0),c==null||c("copied"),U.track("bot.snippet.copied",{embed_id:a.id,platform:y,target_website:a.target_website||null}),S({title:"Copied!",description:"Embed code copied to clipboard."}),setTimeout(()=>C(!1),2e3)},x={html:{title:"HTML / Static Site",steps:["Open your HTML file in a code editor.","Paste the embed code just before the closing </body> tag.","Save and refresh your site."]},wordpress:{title:"WordPress",steps:["Go to Appearance → Theme File Editor.","Open footer.php (or header.php).","Paste the embed code before </body>.","Click Update File."]},shopify:{title:"Shopify",steps:["Go to Online Store → Themes → Edit Code.","Open theme.liquid.","Paste the code before </body>.","Click Save."]},wix:{title:"Wix",steps:["Go to Settings → Custom Code.","Click + Add Custom Code.","Paste the embed code.",'Set placement to "Body - end" on All pages.']}}[y];return e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-5",children:[e.jsxs(I,{children:[e.jsxs(T,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary text-primary-foreground text-xs font-bold",children:"1"}),e.jsx(E,{className:"text-base",children:"Copy Your Embed Code"})]}),e.jsx(V,{children:"One line of code — that's all you need."})]}),e.jsx(L,{children:e.jsxs("div",{className:"relative",children:[e.jsx("pre",{className:"bg-muted rounded-lg p-4 text-xs overflow-x-auto font-mono whitespace-pre-wrap break-all",children:f}),e.jsxs(q,{size:"sm",variant:u?"default":"secondary",className:"absolute top-2 right-2 gap-1.5",onClick:H,children:[u?e.jsx($,{className:"h-3.5 w-3.5"}):e.jsx(xe,{className:"h-3.5 w-3.5"}),u?"Copied":"Copy"]})]})})]}),e.jsxs(I,{children:[e.jsx(T,{className:"pb-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary text-primary-foreground text-xs font-bold",children:"2"}),e.jsx(E,{className:"text-base",children:"Add to Your Website"})]})}),e.jsxs(L,{className:"space-y-4",children:[e.jsx(le,{value:y,onValueChange:k,children:e.jsxs(ce,{className:"w-full",children:[e.jsx(D,{value:"html",className:"flex-1 text-xs",children:"HTML"}),e.jsx(D,{value:"wordpress",className:"flex-1 text-xs",children:"WordPress"}),e.jsx(D,{value:"shopify",className:"flex-1 text-xs",children:"Shopify"}),e.jsx(D,{value:"wix",className:"flex-1 text-xs",children:"Wix"})]})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:x.title}),e.jsx("ol",{className:"text-sm text-muted-foreground space-y-1.5 list-decimal list-inside",children:x.steps.map((s,l)=>e.jsx("li",{children:s},l))})]})]})]}),e.jsxs(I,{className:p?"border-green-500/40 bg-green-500/5":"",children:[e.jsx(T,{className:"pb-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`flex h-6 w-6 items-center justify-center rounded-full text-xs font-bold ${p?"bg-green-500 text-white":"bg-primary text-primary-foreground"}`,children:p?e.jsx($,{className:"h-3.5 w-3.5"}):"3"}),e.jsx(E,{className:"text-base",children:p?"Installation Verified!":"Verify Installation"})]})}),e.jsx(L,{children:p?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[e.jsx(fe,{className:"h-4 w-4"}),e.jsxs("span",{children:["Bot detected on ",e.jsx("strong",{children:A||(b==null?void 0:b.url)||a.target_website})]})]}),e.jsxs(q,{onClick:()=>P(`/embeds/${a.id}?tab=config`),className:"w-full bg-gradient-to-r from-primary to-secondary hover:opacity-90 gap-2",children:[e.jsx(Y,{className:"h-4 w-4"}),"Customize Your Bot",e.jsx(he,{className:"h-4 w-4"})]})]}):e.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"relative flex h-3 w-3",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),e.jsx("span",{className:"relative inline-flex rounded-full h-3 w-3 bg-primary"})]}),e.jsx("span",{children:"Waiting for first session on your website…"})]})})]})]}),e.jsx("div",{className:"space-y-2",children:e.jsxs(I,{className:"flex flex-col h-full min-h-[600px]",children:[e.jsxs(T,{className:"pb-3 shrink-0",children:[e.jsx(E,{className:"text-base",children:"Live Preview"}),e.jsx(V,{children:"Try your bot right here — click the widget button."})]}),e.jsxs(L,{className:"flex-1 min-h-0 flex flex-col gap-3",children:[e.jsx("div",{className:"flex gap-1.5 flex-wrap",children:ue.map(s=>e.jsxs("button",{onClick:()=>O(s.id),className:`px-3 py-1.5 rounded-full text-xs font-medium transition-colors border ${v===s.id?"bg-primary text-primary-foreground border-primary":"bg-muted text-muted-foreground border-border hover:bg-accent"}`,children:[s.icon," ",s.label]},s.id))}),e.jsx("div",{className:"border rounded-lg overflow-hidden flex-1 bg-white",children:e.jsx("iframe",{srcDoc:F,className:"border-0",style:{width:"133%",height:"133%",transform:"scale(0.75)",transformOrigin:"top left"}
1,allow:"microphone",sandbox:"allow-scripts allow-same-origin allow-modals"})})]})]})})]})}function $e(){const a=B(),{userId:r}=M(),c=Q(),u=K(),{isLoading:C,isCompleted:y,markCompleted:k,markSeen:v}=ge(),[O]=J(),P=O.get("force")==="1",[t,R]=n.useState(null),[S,f]=n.useState(!1),[F,o]=n.useState(!1),h=n.useRef("viewing"),A=n.useRef(Date.now()),g=n.useRef(!1);n.useEffect(()=>{N("quickstart_started",{userId:r},r??void 0),v(),A.current=Date.now()},[r,v]),n.useEffect(()=>{const i=()=>{if(g.current)return;const x=Math.round((Date.now()-A.current)/1e3);N("quickstart_abandoned",{stage:h.current,duration_seconds:x,embed_created:!!t,embedId:t==null?void 0:t.id},r??void 0),g.current=!0};return window.addEventListener("beforeunload",i),()=>{window.removeEventListener("beforeunload",i),i()}},[t,r]);const j=n.useCallback(async()=>{if(t)return t;if(!r)return null;f(!0);try{const{data:i,error:x}=await c.from("embeds").insert({user_id:r,name:"My First Anve",bot_type:"support",welcome_message:"Hello! How can I help you today?",system_prompt:"",widget_position:"bottom-right",widget_theme:"light",voice_id:"Zephyr",model_id:"gemini-live-2.5-flash-native-audio",status:"active",settings:JSON.parse(JSON.stringify({tools:be})),client_id:u.type==="client"?u.clientId:null}).select().single();if(x)throw x;const s=i;return R(s),s}catch(i){return console.error("[QuickStart] create failed",i),G.error("Couldn't set up your bot. Please try again."),null}finally{f(!1)}},[t,r,c,u]),w=n.useCallback(i=>{h.current=i},[]),b=async i=>{t&&(g.current=!0,N("embed_deployed",{userId:r,embedId:t.id,via:"quickstart",verifiedUrl:i},r??void 0),N("quickstart_completed",{userId:r,embedId:t.id,verifiedUrl:i},r??void 0),await k(),G.success(`Bot is live on ${i}!`),setTimeout(()=>a(`/embeds/${t.id}`),1500))},p=async()=>{if(g.current=!0,N("quickstart_skipped",{userId:r,embed_created:!!t,stage:h.current,intent:"install_later"},r??void 0),r)try{localStorage.setItem(`anvevoice_install_pending_${r}`,new Date().toISOString()),t!=null&&t.id&&localStorage.setItem(`anvevoice_install_pending_embed_${r}`,t.id)}catch{}await k(),a(t?`/embeds/${t.id}`:"/dashboard")},H=async()=>{await j()&&(h.current="viewing")};return C?e.jsx("div",{className:"min-h-screen bg-background"}):y&&!P?e.jsx(Z,{to:"/dashboard",replace:!0}):e.jsxs(e.Fragment,{children:[e.jsxs(X,{children:[e.jsx("title",{children:"Quick Start — Install Your Anve"}),e.jsx("meta",{name:"robots",content:"noindex,nofollow"})]}),e.jsxs("div",{className:"min-h-screen bg-background relative overflow-hidden",children:[e.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[e.jsx(_.div,{animate:{x:[0,50,0],y:[0,-30,0],scale:[1,1.2,1]},transition:{duration:20,repeat:1/0,ease:"easeInOut"},className:"absolute -top-40 -right-40 w-[500px] h-[500px] bg-gradient-to-br from-primary/20 via-secondary/10 to-transparent rounded-full blur-[100px]"}),e.jsx(_.div,{animate:{x:[0,-40,0],y:[0,40,0],scale:[1,1.1,1]},transition:{duration:18,repeat:1/0,ease:"easeInOut",delay:2},className:"absolute -bottom-40 -left-40 w-[600px] h-[600px] bg-gradient-to-tr from-secondary/20 via-primary/10 to-transparent rounded-full blur-[120px]"})]}),e.jsxs("div",{className:"relative z-10 max-w-7xl mx-auto px-4 sm:px-6 py-8",children:[e.jsxs(_.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},transition:{duration:.4},className:"flex flex-col items-center text-center mb-8",children:[e.jsx("img",{src:ye,alt:"AnveVoice",className:"h-10 w-auto object-contain mb-4"}),e.jsx("h1",{className:"text-2xl sm:text-3xl font-bold tracking-tight text-foreground",children:"Install your Anve"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"Paste one line of code on your site — we'll detect it automatically."})]}),t?e.jsx(_.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.3},children:e.jsx(je,{embed:t,onVerified:b,onStageChange:w})}):e.jsxs(_.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.3},className:"flex flex-col items-center justify-center py-16",children:[e.jsx("p",{className:"text-muted-foreground text-sm mb-6 text-center max-w-md",children:"Click below to generate your unique install snippet. We'll create your first Anve and walk you through pasting it onto your site."}),e.jsx(q,{onClick:H,disabled:S||!r,size:"lg",className:"bg-gradient-to-r from-primary to-secondary hover:opacity-90 gap-2",children:S?e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"h-4 w-4 animate-spin"}),"Setting up your Anve…"]}):e.jsxs(e.Fragment,{children:[e.jsx(Y,{className:"h-4 w-4"}),"Generate my install snippet"]})})]}),e.jsx("div",{className:"flex justify-center mt-6",children:e.jsx(q,{onClick:()=>o(!0),variant:"outline",size:"sm",className:"gap-2",children:"I'll install later"})})]})]}),e.jsx(ee,{open:F,onOpenChange:o,children:e.jsxs(te,{children:[e.jsxs(se,{children:[e.jsx(ae,{children:"Continue install later?"}),e.jsx(re,{children:"We'll email you reminders at 24 hours, 5 days, and 15 days so your Anve doesn't get forgotten. You can come back to this page anytime from your dashboard."})]}),e.jsxs(ie,{children:[e.jsx(ne,{children:"Keep installing"}),e.jsx(oe,{onClick:p,children:"Yes, remind me later"})]})]})})]})}export{$e 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.