1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatbotAnalytics-DviTWs9p.js","assets/index-DKJ0tKwF.js","assets/index-C0MT_v4I.css","assets/App-CL-mfmhu.js","assets/V2Layout-DEbe2yZA.js","assets/button-DFML8rOM.js","assets/button-CdPmGQoi.css","assets/V2Layout-BdYjcMaq.css","assets/tracker-DzJH7QDt.js","assets/v3LegalOverrides-BUgTGJPl.js","assets/mouse-pointer-2-CzsmklB8.js","assets/index-BNGwt955.js","assets/SEOHead-B5IBZJEm.js","assets/types-DU7944Yl.js","assets/App-Bpu99X8N.css","assets/chart-CyswYVrv.js","assets/generateCategoricalChart-b5rLhkau.js","assets/value-DqH_WevB.js","assets/useChatbotAnalytics-BAZNcwOu.js","assets/getDay-CijkPZp6.js","assets/getHours-gr2mukhN.js","assets/useChatbotFeedback-B5BlBM5O.js","assets/AreaChart-BJYXKA2p.js","assets/YAxis-juuueSy8.js","assets/CartesianGrid-B9QQOuAa.js","assets/BarChart-CqmLOmE4.js","assets/ChatbotKnowledgeGaps-BP8z-wnW.js","assets/table-LmnZO84H.js","assets/ChatbotHistory-DLsCrGyF.js","assets/useChatbots-U3SvQC4t.js"])))=>i.map(i=>d[i]); 2import{j as e,r as f,u as _,_ as Ne}from"./index-DKJ0tKwF.js";import{u as ct}from"./useDesktopToolbarAction-BjAss24h.js";import{u as dt}from"./useDesktopStatusUpdate-V-hQXDku.js";import{g as ut,C as mt,O as Ke,am as De,al as Z,e as ae}from"./V2Layout-DEbe2yZA.js";import{f as X,t as A,d as oe,J as H,e as z,D as q,k as pt,l as ht,o as W,S as re,j as gt,U as yt,r as le,q as ft,L as Je,a6 as xt}from"./button-DFML8rOM.js";import{g as Ze,b1 as bt,dM as vt,C as wt,bR as jt,bS as Nt,eq as kt,bU as Ct,bV as U,dQ as Be,eb as ce,bW as Re,dI as qt,b$ as de,er as Xe,c0 as ue,c1 as me,c2 as pe,c3 as he,c4 as ge,c5 as ye,c6 as fe,dL as Ee,r as L,aE as et,bo as St,f as Me,$ as se,q as G,J as K,aI as xe,dq as be,aJ as ve,aK as we,fr as _t,ap as ke,cZ as At,aq as Ce,ar as qe,as as Se,at as _e,a0 as $e,a2 as Fe,fs as V,dr as Tt,ft as Pt,aQ as ie,dw as Ue,d as It,bj as Ye,a1 as Wt,bM as Ht,bN as Lt,bO as E,k as Dt,bP as M}from"./App-CL-mfmhu.js";import{E as Bt,I as Rt,C as Et,P as Mt}from"./PersonalityBuilder-DIP87I50.js";import{u as je,T as $t,E as Ft,k as Qe,H as ze,v as Ut,a as Ve}from"./v3LegalOverrides-BUgTGJPl.js";import{L as J,Z as tt}from"./tracker-DzJH7QDt.js";import{u as Yt}from"./useChatbots-U3SvQC4t.js";import{E as Qt}from"./EmbeddedCheckoutModal-E86fr6UD.js";import{I as zt}from"./InternalPageSEO-loZWkmv4.js";import{A as Vt,b as Ot,a as Gt}from"./alert-6VEnsWT3.js";import{S as $}from"./SectionErrorBoundary-DOx_VnMl.js";import{b as Kt}from"./empty-states-DvIFkHOB.js";import{g as Jt,s as Zt}from"./staffChatbotFlow-CT5gdJnP.js";import"./mouse-pointer-2-CzsmklB8.js";import"./index-BNGwt955.js";import"./SEOHead-B5IBZJEm.js";import"./types-DU7944Yl.js";import"./style-wgfdwS7H.js";import"./value-DqH_WevB.js";import"./useCustomFields-DUnacpJH.js";import"./useTeamMembers-CK4rx5Lj.js";import"./useQuoteTemplates-D3byJNM7.js";import"./useForms-CfpzKIWr.js";import"./useAutomations-CbVCA8Op.js";import"./ChatbotTestPanel-X5-oVi3U.js";import"./index-DuvzOiI3.js";import"./useWhiteLabelSettings-BSKuUw5y.js";import"./brandedHost-DwqqfaEy.js";import"./EndNode-CdsR58X9.js";import"./slider-wKlj6rAS.js";function Oe({readiness:a,onFix:s,compact:m}){return a.loading?e.jsx("div",{className:"text-xs text-muted-foreground animate-pulse",children:"Checking setupâ¦"}):e.jsx("div",{className:A("space-y-1.5",m?"text-xs":"text-sm"),children:a.items.map(i=>e.jsxs("button",{type:"button",onClick:r=>{r.stopPropagation(),!i.passed&&s&&s(i)},className:A("w-full flex items-start gap-2 text-left rounded-md px-2 py-1.5 transition-colors",!i.passed&&s&&"hover:bg-muted/60 cursor-pointer",i.passed&&"cursor-default"),children:[e.jsx("span",{className:A("mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-full",i.passed?"bg-green-500/20 text-green-500":i.critical?"bg-destructive/15 text-destructive":"bg-muted text-muted-foreground"),children:i.passed?e.jsx(X,{className:"h-3 w-3"}):i.critical?e.jsx(Ze,{className:"h-3 w-3"}):e.jsx(ut,{className:"h-3 w-3"})}),e.jsxs("span",{className:"flex-1 min-w-0",children:[e.jsxs("span",{className:A("font-medium block",i.passed&&"text-muted-foreground"),children:[i.label,i.critical&&!i.passed&&e.jsx("span",{className:"ml-1 text-[10px] uppercase tracking-wide text-destructive/80",children:"Required"})]}),!i.passed&&e.jsx("span",{className:"block text-muted-foreground text-[11px] leading-snug",children:i.hint})]}),!i.passed&&s&&e.jsx(oe,{className:"h-3 w-3 mt-1 text-muted-foreground shrink-0"})]},i.key))})}function Xt(a){const[s,m]=f.useState({items:[],passed:0,total:0,criticalPassed:!1,loading:!0,ready:!1});return f.useEffect(()=>{if(!a){m(r=>({...r,loading:!1}));return}let i=!1;return(async()=>{var N;const r=Array.isArray((N=a.flow_data)==null?void 0:N.nodes)?a.flow_data.nodes:[],u=r.filter(v=>{var g;return(v==null?void 0:v.type)!=="start"&&((g=v==null?void 0:v.data)==null?void 0:g.nodeType)!=="start"}),l=r.some(v=>{var o;const g=String(((o=v==null?void 0:v.data)==null?void 0:o.nodeType)||(v==null?void 0:v.type)||"").toLowerCase();return g.includes("book")||g.includes("meeting")||g.includes("calendar")}),p=a.personality_id,x=a.workspace_id,h=async(v,g,o)=>{let P=H.from(v).select("id",{count:"exact",head:!0});for(const[R,te]of g)P=P.eq(R,te);
2o&&(P=P.eq(o[0],o[1]));const{count:F}=await P;return F??0},[n,c,w,k]=await Promise.all([p?h("chatbot_knowledge_base",[["workspace_id",x],["personality_id",p]]):h("chatbot_knowledge_base",[["workspace_id",x]]),p?h("personality_documents",[["personality_id",p]]):Promise.resolve(0),h("workspace_calendars",[["workspace_id",x]]),h("user_availability",[["workspace_id",x]],["is_available",!0])]);if(i)return;const d=n+c,b=[{key:"personality",label:"Personality set",passed:!!p,critical:!0,hint:"Give your agent a name, tone and role so replies feel human.",fixTarget:"personality"},{key:"workflow",label:"Workflow has real steps",passed:u.length>0,critical:!0,hint:"Add at least one node after the Start so the bot knows what to do.",fixTarget:"flow"},{key:"knowledge",label:"Trained on your business",passed:d>0,critical:!1,hint:"Upload docs or crawl your site so the bot can answer real questions.",fixTarget:"knowledge"},...l?[{key:"calendar",label:"Calendar & availability connected",passed:w>0&&k>0,critical:!0,hint:"A BookMeeting step needs a calendar and staff availability.",fixTarget:"calendar"}]:[]],S=b.filter(v=>v.passed).length,y=b.filter(v=>v.critical).every(v=>v.passed);m({items:b,passed:S,total:b.length,criticalPassed:y,loading:!1,ready:y})})(),()=>{i=!0}},[a==null?void 0:a.id,a==null?void 0:a.personality_id,a==null?void 0:a.workspace_id,a==null?void 0:a.flow_data]),s}function Ge(a){try{return new Date(a).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})}catch{return""}}function ea({chatbots:a,isLoading:s,onSelect:m,onDelete:i,onStatusChange:r}){const[u,l]=f.useState({});return f.useEffect(()=>{if(!(a!=null&&a.length))return;const p=a.map(h=>h.id);let x=!1;return(async()=>{const{data:h,error:n}=await H.from("chatbot_conversations").select("chatbot_id").in("chatbot_id",p);if(n||x||!h)return;const c={};for(const w of h)c[w.chatbot_id]=(c[w.chatbot_id]||0)+1;l(c)})(),()=>{x=!0}},[a]),s?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(6)].map((p,x)=>e.jsx(bt,{className:"h-48 rounded-xl"},x))}):a.length===0?e.jsxs("div",{className:"glass-card p-12 text-center",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-full bg-primary/20 flex items-center justify-center",children:e.jsx(z,{className:"h-8 w-8 text-primary"})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No chatbots yet"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Create your first AI chatbot to start engaging with customers"})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:a.map(p=>e.jsx(ta,{bot:p,convCount:u[p.id]??0,onSelect:m,onDelete:i,onStatusChange:r},p.id))})}function ta({bot:a,convCount:s,onSelect:m,onDelete:i,onStatusChange:r}){var v,g;const u=Xt(a),[l,p]=f.useState(!1),[x,h]=f.useState(!1),[n,c]=f.useState(!1),[w,k]=f.useState(!1),[d,b]=f.useState(!1),S=o=>{navigator.clipboard.writeText(o).then(()=>{c(!0),_.success("Bot ID copied"),setTimeout(()=>c(!1),1500)})},y=()=>{if(!u.criticalPassed){b(!0);return}r(a.id,"active")},N=o=>{m(a.id),o.fixTarget==="personality"?_.info("Open the Personality tab to finish setup."):o.fixTarget==="knowledge"?_.info("Add docs or crawl your site in the Knowledge tab."):o.fixTarget==="calendar"?_.info("Connect a calendar and set staff availability."):_.info("Open the workflow to add nodes after the Start step.")};return e.jsxs("div",{className:"glass-card p-5 hover:border-primary/30 transition-all duration-300 cursor-pointer group flex flex-col",onClick:()=>m(a.id),children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-primary/30 to-primary/10 flex items-center justify-center",children:e.jsx(z,{className:"h-6 w-6 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold group-hover:text-primary transition-colors truncate",children:a.name}),e.jsxs("button",{type:"button",onClick:o=>{o.stopPropagation(),S(a.id)},className:"flex items-center gap-1 text-[10px] text-muted-foreground
2/80 hover:text-primary font-mono mt-0.5",title:"Copy bot ID",children:[e.jsx(vt,{className:"h-2.5 w-2.5"}),e.jsx("span",{children:a.id.slice(0,8)}),n?e.jsx(X,{className:"h-2.5 w-2.5"}):e.jsx(wt,{className:"h-2.5 w-2.5 opacity-50"})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[((g=(v=a.flow_data)==null?void 0:v.nodes)==null?void 0:g.length)||0," nodes"]})]})]}),e.jsxs(jt,{children:[e.jsx(Nt,{asChild:!0,onClick:o=>o.stopPropagation(),children:e.jsx(q,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(kt,{className:"h-4 w-4"})})}),e.jsxs(Ct,{align:"end",children:[e.jsxs(U,{onClick:o=>{o.stopPropagation(),h(!0)},children:[e.jsx(Be,{className:"h-4 w-4 mr-2"}),"Test bot"]}),a.status!=="active"&&e.jsxs(U,{onClick:o=>{o.stopPropagation(),y()},children:[e.jsx(je,{className:"h-4 w-4 mr-2"}),"Activate"]}),a.status==="active"&&e.jsxs(U,{onClick:o=>{o.stopPropagation(),r(a.id,"paused")},children:[e.jsx(ce,{className:"h-4 w-4 mr-2"}),"Pause"]}),e.jsx(Re,{}),e.jsxs(U,{onClick:o=>{o.stopPropagation(),p(!0)},children:[e.jsx(qt,{className:"h-4 w-4 mr-2"}),"Get Embed Code"]}),e.jsx(Re,{}),e.jsxs(de,{children:[e.jsx(Xe,{asChild:!0,children:e.jsxs(U,{className:"text-destructive",onSelect:o=>o.preventDefault(),onClick:o=>o.stopPropagation(),children:[e.jsx($t,{className:"h-4 w-4 mr-2"}),"Delete"]})}),e.jsxs(ue,{onClick:o=>o.stopPropagation(),children:[e.jsxs(me,{children:[e.jsx(pe,{children:"Delete chatbot?"}),e.jsxs(he,{children:['This will permanently delete "',a.name,'" and all its conversations.']})]}),e.jsxs(ge,{children:[e.jsx(ye,{children:"Cancel"}),e.jsx(fe,{onClick:o=>{o.stopPropagation(),i(a.id)},className:"bg-destructive hover:bg-destructive/90",children:"Delete"})]})]})]})]})]})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3 line-clamp-2",children:a.description||"No description"}),!u.loading&&u.total>0&&e.jsxs("button",{type:"button",onClick:o=>{o.stopPropagation(),k(P=>!P)},className:aa(u.criticalPassed,u.passed,u.total),children:[u.criticalPassed?e.jsxs(e.Fragment,{children:[e.jsx(X,{className:"h-3 w-3"})," Ready to publish · ",u.passed,"/",u.total]}):e.jsxs(e.Fragment,{children:[e.jsx(Ee,{className:"h-3 w-3"})," Setup incomplete · ",u.passed,"/",u.total]}),e.jsx("span",{className:"ml-auto text-[10px] opacity-70",children:w?"Hide":"Details"})]}),w&&e.jsx("div",{className:"mt-2 rounded-lg border border-border/50 bg-muted/30 p-2",onClick:o=>o.stopPropagation(),children:e.jsx(Oe,{readiness:u,onFix:N,compact:!0})}),e.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[e.jsxs(q,{size:"sm",variant:"outline",className:"flex-1",onClick:o=>{o.stopPropagation(),h(!0)},children:[e.jsx(Be,{className:"h-3.5 w-3.5 mr-1.5"}),"Test"]}),a.status!=="active"?e.jsxs(q,{size:"sm",className:"flex-1",onClick:o=>{o.stopPropagation(),y()},children:[e.jsx(je,{className:"h-3.5 w-3.5 mr-1.5"}),"Activate"]}):e.jsxs(q,{size:"sm",variant:"secondary",className:"flex-1",onClick:o=>{o.stopPropagation(),r(a.id,"paused")},children:[e.jsx(ce,{className:"h-3.5 w-3.5 mr-1.5"}),"Pause"]})]}),e.jsxs("div",{className:"flex items-center justify-between mt-3",children:[e.jsx(L,{variant:a.status==="active"?"default":"secondary",className:a.status==="active"?"bg-green-500/20 text-green-500 hover:bg-green-500/30":a.status==="paused"?"bg-yellow-500/20 text-yellow-500 hover:bg-yellow-500/30":"",children:a.status}),e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx(pt,{className:"h-3 w-3"}),e.jsxs("span",{children:[s," conversation",s===1?"":"s"]})]})]}),e.jsxs("div",{className:"flex items-center gap-1 text-[11px] text-muted-foreground/70 border-t border-border/40 pt-2 mt-2",children:[e.jsx(mt,{className:"h-3 w-3"}),e.jsxs("span",{children:["Created ",Ge(a.created_at)]}),a.updated_at&&a.updated_at!==a.created_at&&e.jsxs("span",{className:"ml-auto",children:["Updated ",Ge(a.updated_at)]})]}),l&&e.jsx(Bt,{open:l,onOpenChange:p,chatbotId:a.id,chatbotName:a.name}),e.jsx(Rt,{open:x,onOpenChange:h,chatbotId:a.id,chatbotName:a.name}),e.jsx(de,{open:d,onOpenChange:b,children:e.jsxs(ue,{onClick:o=>o.stopPropagation(),children:[e.jsxs(me,{children:[e.jsxs(pe,{className:"flex items-center gap-2",children:[e.jsx(Ee,{className:"h-5 w-5 text-destructive"}),"Setup isn't finished"]}),e.jsx(he,{children:"Activating this bot before setup is complete usually leads to weird replies and missed leads. Fix the items below first, or activate anyway if you know
2what you're doing."})]}),e.jsx("div",{className:"rounded-lg border border-border/50 bg-muted/30 p-3",children:e.jsx(Oe,{readiness:u,onFix:o=>{b(!1),N(o)}})}),e.jsxs(ge,{children:[e.jsx(ye,{children:"Go back and fix"}),e.jsx(fe,{onClick:()=>{b(!1),r(a.id,"active")},className:"bg-destructive hover:bg-destructive/90",children:"Activate anyway"})]})]})})]})}function aa(a,s,m){const i="w-full flex items-center gap-1.5 rounded-md px-2 py-1.5 text-[11px] font-medium transition-colors";return a?`${i} bg-green-500/10 text-green-500 hover:bg-green-500/20`:s===0?`${i} bg-destructive/10 text-destructive hover:bg-destructive/20`:`${i} bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 hover:bg-yellow-500/20`}const sa="id, workspace_id, user_id, provider, provider_user_id, metadata, connected_at, updated_at";function ia(){const{workspace:a}=et(),s=Ke(),{effectiveUserId:m}=St(),{data:i,isLoading:r}=Me({queryKey:["shopify-connection",a==null?void 0:a.id],queryFn:async()=>{if(!(a!=null&&a.id))return null;const{data:n,error:c}=await H.from("integration_connections_safe").select(sa).eq("workspace_id",a.id).eq("provider","shopify").maybeSingle();if(c)throw c;return n},enabled:!!(a!=null&&a.id)}),{data:u,isLoading:l}=Me({queryKey:["chatbot-products",a==null?void 0:a.id],queryFn:async()=>{if(!(a!=null&&a.id))return[];const{data:n,error:c}=await H.from("chatbot_products").select("*").eq("workspace_id",a.id).eq("is_active",!0).order("name");if(c)throw c;return n},enabled:!!(a!=null&&a.id)}),p=se({mutationFn:async n=>{if(!(a!=null&&a.id))throw new Error("No workspace selected");if(!m)throw new Error("Not authenticated");const{error:c}=await H.rpc("secure_store_shopify_connection",{_workspace_id:a.id,_store_url:n.storeUrl,_access_token:n.accessToken});if(c)throw c},onSuccess:()=>{s.invalidateQueries({queryKey:["shopify-connection"]}),_.success("Shopify store connected successfully")},onError:n=>{_.error("Failed to connect: "+n.message)}}),x=se({mutationFn:async()=>{if(!(a!=null&&a.id))throw new Error("No workspace selected");const{data:n,error:c}=await H.functions.invoke("shopify-sync",{body:{workspaceId:a.id}});if(c)throw c;return n},onSuccess:n=>{s.invalidateQueries({queryKey:["chatbot-products"]}),s.invalidateQueries({queryKey:["shopify-connection"]}),_.success(`Synced ${n.synced} products from Shopify`)},onError:n=>{_.error("Failed to sync: "+n.message)}}),h=se({mutationFn:async()=>{if(!(a!=null&&a.id))throw new Error("No workspace selected");const{error:n}=await H.from("integration_connections").delete().eq("workspace_id",a.id).eq("provider","shopify");if(n)throw n},onSuccess:()=>{s.invalidateQueries({queryKey:["shopify-connection"]}),_.success("Shopify store disconnected")},onError:n=>{_.error("Failed to disconnect: "+n.message)}});return{connection:i,products:u,isLoading:r||l,connect:p.mutateAsync,sync:x.mutateAsync,disconnect:h.mutateAsync,isSyncing:x.isPending,isConnecting:p.isPending}}function na(){const{connection:a,products:s,isLoading:m,connect:i,sync:r,disconnect:u,isSyncing:l,isConnecting:p}=ia(),[x,h]=f.useState(""),[n,c]=f.useState(""),[w,k]=f.useState(!1),d=async()=>{await i({storeUrl:x,accessToken:n}),k(!1),h(""),c("")},b=a==null?void 0:a.metadata,S=b==null?void 0:b.store_url;return m?e.jsx(G,{children:e.jsx(K,{className:"p-6",children:e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(J,{className:"h-6 w-6 animate-spin text-muted-foreground"})})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs(G,{children:[e.jsx(xe,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-green-500/20 flex items-center justify-center",children:e.jsx(be,{className:"h-5 w-5 text-green-500"})}),e.jsxs("div",{children:[e.jsx(ve,{className:"text-lg",children:"Shopify Integration"}),e.jsx(we,{children:"Connect your Shopify store to let AI agents showcase and sell products"})]})]}),a&&e.jsx(L,{variant:"outline",className:"bg-green-500/10 text-green-500 border-green-500/30",children:"Connected"})]})}),e.jsx(K,{children:a?e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-muted/50",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:S}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[(s==null?void 0:s.length)||0," products synced"]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(q,{variant:"outline",size:"sm",onClick:()=>r(),disabled:l,children:[l?e.jsx(J,{className:"h-4 w-4 animate-spin"}):e.jsx(ht,{className:"h-4 w-4"}),e.jsx("span",{className:"ml-2",children:"Sync"})]}),e.jsxs(de,{children:[e.jsx(Xe,{asChild:!0,children:e.jsx(q,{variant:"outline",size:"sm",className:"text-destructive",children:e.jsx(_t,{className:"h-4 w-4"})})}),e.jsxs(ue,{children:[e.jsxs(me,{children:[e.jsx(pe,{children:"Disconnect Shopify Store?"}),e.jsx(he,{children:"This will remove the connection to your Shopify store. Synced products will remain but won't be updated."})]}),e.jsxs(ge,{children:[e.jsx(ye,{children:"Cancel"}),e.jsx(fe,{onClick:()=>u(),children:"Disconnect"})]})]})]})]})]})}):e.jsxs(ke,{open:w,onOpenChange:k,children:[e.jsx(At,{asChild:!0,children:e.jsxs(q,{className:"w-full",children:[e.jsx(be,{className:"h-4 w-4 mr-2"}),"Connect Shopify Store"]})}),e.jsxs(Ce,{children:[e.jsxs(qe,{children:[e.jsx(Se,{children:"Connect Your Shopify Store"}),e.jsx(_e,{children:"Enter your Shopify store URL and Admin API access token to
2sync products."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(De,{htmlFor:"store-url",children:"Store URL"}),e.jsx(Z,{id:"store-url",placeholder:"your-store.myshopify.com",value:x,onChange:y=>h(y.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Your Shopify store domain (e.g., my-store.myshopify.com)"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(De,{htmlFor:"access-token",children:"Admin API Access Token"}),e.jsx(Z,{id:"access-token",type:"password",placeholder:"shpat_...",value:n,onChange:y=>c(y.target.value)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Create a private app in Shopify Admin â Settings â Apps â Develop apps"})]}),e.jsxs(q,{className:"w-full",onClick:d,disabled:!x||!n||p,children:[p?e.jsx(J,{className:"h-4 w-4 animate-spin mr-2"}):null,"Connect Store"]})]})]})]})})]}),s&&s.length>0&&e.jsxs(G,{children:[e.jsxs(xe,{children:[e.jsxs(ve,{className:"text-lg flex items-center gap-2",children:[e.jsx($e,{className:"h-5 w-5"}),"Synced Products (",s.length,")"]}),e.jsx(we,{children:"These products are available for your AI agents to showcase"})]}),e.jsx(K,{children:e.jsx("div",{className:"grid gap-3 max-h-[400px] overflow-y-auto",children:s.map(y=>{var N;return e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/50 hover:bg-muted transition-colors",children:[y.image_url?e.jsx("img",{src:y.image_url,alt:y.name,className:"w-12 h-12 rounded-lg object-cover"}):e.jsx("div",{className:"w-12 h-12 rounded-lg bg-muted flex items-center justify-center",children:e.jsx($e,{className:"h-5 w-5 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium truncate",children:y.name}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[y.currency," ",(N=y.price)==null?void 0:N.toFixed(2)]})]}),y.product_url&&e.jsx(q,{variant:"ghost",size:"icon",asChild:!0,children:e.jsx("a",{href:y.product_url,target:"_blank",rel:"noopener noreferrer",children:e.jsx(Ft,{className:"h-4 w-4"})})})]},y.id)})})})]})]})}const t=(a,s)=>`${a}-template-${s}`,O=[{id:"solar-lead-qualifier",name:"Solar Lead Qualifier",description:"Qualify solar installation leads by collecting property details, electricity bills, and homeownership status",industry:"Solar & Renewable Energy",icon:"âï¸",tags:["solar","energy","home improvement","lead qualification"],personalityPrompt:`You are a friendly and knowledgeable solar energy consultant. Your goal is to help homeowners understand the benefits of solar power and qualify leads for installation consultations. 3 4Key behaviors: 5- Be enthusiastic about solar energy and its benefits 6- Ask qualifying questions naturally (homeownership, electricity bills, roof condition) 7- Explain savings potential without being pushy 8- Qualify leads based on: owns home (required), electricity bill >£100/month (ideal), roof age <20 years 9- For high-quality leads, offer to schedule a free consultation 10- If they're renters, kindly explain solar requires property ownership 11 12Always be helpful even if they don't qualify - suggest alternatives like community solar programs.`,nodes:[{id:t("trigger",1),type:"trigger",position:{x:250,y:0},data:{label:"Chat Started"}},{id:t("message",1),type:"message",position:{x:250,y:100},data:{label:"Welcome Message",messageContent:"Hi there! âï¸ I'm here to help you explore solar energy options for your home. Are you interested in learning how much you could save on electricity with solar panels?"}},{id:t("question",1),type:"question",position:{x:250,y:220},data:{label:"Ask Homeownership",questionText:"First, do you own your home or are you renting?",mapsToField:"custom.homeowner_status",maxRetries:2}},{id:t("split",1),type:"split",position:{x:250,y:340},data:{label:"Check Homeowner",conditionField:"custom.homeowner_status",conditionOperator:"contains",conditionValue:"own"}},{id:t("question",2),type:"question",position:{x:100,y:460},data:{label:"Ask Electric Bill",questionText:"Great! What's your average monthly electricity bill? (approximate is fine)",mapsToField:"custom.monthly_electric_bill",maxRetries:2}},{id:t("message",2),type:"message",position:{x:400,y:460},data:{label:"Renter Response",messageContent:"Thanks for your interest! Unfortunately, solar panel installation requires property ownership. You might want to check if your landlord is interested, or look into community solar programs in your area. Would you like me to share some resources?"}},{id:t("question",3),type:"question",position:{x:100,y:580},data:{label:"Ask Roof Age",questionText:"When was your roof last replaced or repaired? (approximate year is fine)",mapsToField:"custom.roof_age",maxRetries:2}},{id:t("qualify",1),type:"qualify",position:{x:100,y:700},data:{label:"Score Lead",tagsToAdd:"Solar Interest, Website Lead",leadScore:75}},{id:t("ai",1),type:"ai",position:{x:100,y:820},data:{label:"AI Qualification",aiPrompt:"Based on the information collected, provide a brief summary of their solar potential and recommend next steps. If they seem like a good fit (homeowner, decent electricity bill, reasonable roof age), offer to schedule a free consultation."}},{id:t("createDeal",1),type:"createDeal",position:{x:-50,y:1060},data:{label:"Create Opportunity",dealName:"Solar Installation Inquiry",pipelineStage:"New Lead"}},{id:t("bookMeeting",1),type:"bookMeeting",position:{x:-50,y:1180},data:{label:"Book Consultation",meetingType:"Solar Consultation"}},{id:t("end",1),type:"end",position:{x:-50,y:1300},data:{label:"Qualified End"}},{id:t("end",2),type:"end",position:{x:400,y:580},data:{label:"Not Qualified"}}],edges:[{id:"e1",source:t("trigger",1),target:t("message",1)},{id:"e2",source:t("message",1),target:t("question",1)},{id:"e3",source:t("question",1),target:t("split",1)},{id:"e4",source:t("split",1),target:t("question",2),sourceHandle:"yes"},{id:"e5",source:t("split",1),target:t("message",2),sourceHandle:"no"},{id:"e6",source:t("question",2),target:t("question",3)},{id:"e7",source:t("question",3),target:t("qualify",1)},{id:"e8",source:t("qualify",1),target:t("ai",1)},{id:"e9",source:t("ai",1),target:t("createDeal",1)},{id:"e13",source:t("createDeal",1),target:t("bookMeeting",1)},{id:"e14",source:t("bookMeeting",1),target:t("end",1)},{id:"e15",source:t("message",2),target:t("end",2)}]},{id:"real-estate-buyer-qualifier",name:"Property Buyer Qualifier",description:"Qualify potential property buyers by understanding their preferences, budget, and timeline",industry:"Real Estate",icon:"ð ",tags:["real estate","property","buyer","lead qualification"],personalityPrompt:`You are a friendly and professional real estate assistant. Your goal is to help potential buyers find their perfect property and qualify leads for agent follow-up. 13 14Key behaviors: 15- Be warm and helpful, understanding that buying a home is a big decision 16- Ask qualifying questions naturally (budget, location preferences, timeline, financing) 17- Understand their must-haves vs nice-to-haves 18- Qualify based on: has mortgage pre-approval or cash buyer, timeline within 6 months, realistic budget 19- For qualified leads, offer to connect them with an agent or schedule a viewing 20- Be knowledgeable about the local market 21 22Always be patient and helpful even if they're just starting their search.`,nodes:[{id:t("trigger",1),type:"trigger",position:{x:250,y:0},data:{label:"Chat Started"}},{id:t("message",1),type:"message",position:{x:250,y:100},data:{label:"Welcome",messageContent:"Hello! ð Welcome to our property search. I'm here to help you find your perfect home. Are you looking to buy or sell a property today?"}},{id:t("question",1),type:"question",position:{x:250,y:220},data:{label:"Ask Budget",questionText:"What's your budget range for this property purchase?",mapsToField:"custom.property_budget",maxRetries:2}},{id:t("question",2),type:"question",position:{x:250,y:340},data:{label:"Ask Location",questionText:"Which areas or neighborhoods are you interested in?",mapsToField:"custom.preferred_location",maxRetries:2}},{id:t("question",3),type:"question",position:{x:250,y:460},data:{label:"Ask Property Type",questionText:"What type of property are you looking for? (House, Flat, Bungalow, etc.)",mapsToField:"custom.property_type",maxRetries:2}},{id:t("question",4),type:"question",position:{x:250,y:580},data:{label:"Ask Timeline",questionText:"When are you looking to move? (e.g., ASAP, 3 months, 6 months, just browsing)",mapsToField:"custom.purchase_timeline",maxRetries:2}},{id:t("question",5),type:"question",position:{x:250,y:700},data:{label:"Ask Financing",questionText:"Have you been pre-approved for a mortgage, or are you a cash buyer?",mapsToField:"custom.financing_status",maxRetries:2}},{id:t("qualify",1),type:"qualify",position:{x:250,y:820},data:{label:"Score Buyer",tagsToAdd:"Property Buyer, Website Inquiry",leadScore:70}},{id:t("ai",1),type:"ai",position:{x:250,y:940},data:{label:"AI Summary",aiPrompt:"Summarize what we've learned about their property search and suggest relevant next steps. If they seem ready to buy (have financing, reasonable timeline), offer to schedule a viewing or connect with an agent."}},{id:t("createDeal",1),type:"createDeal",position:{x:250,y:1060},data:{label:"Create Buyer Lead",dealName:"Property Buyer Inquiry",pipelineStage:"New Inquiry"}},{id:t("bookMeeting",1),type:"bookMeeting",position:{x:250,y:1180},data:{label:"Schedule Viewing",meetingType:"Property Viewing"}},{id:t("end",1),type:"end",position:{x:250,y:1300},data:{label:"Complete"}}],edges:[{id:"e1",source:t("trigger",1),target:t("message",1)},{id:"e2",source:t("message",1),target:t("question",1)},{id:"e3",source:t("question",1),target:t("question",2)},{id:"e4",source:t("question",2),target:t("question",3)},{id:"e5",source:t("question",3),target:t("question",4)},{id:"e6",source:t("question",4),target:t("question",5)},{id:"e7",source:t("question",5),target:t("qualify",1)},{id:"e8",source:t("qualify",1),target:t("ai",1)},{id:"e9",source:t("ai",1),target:t("createDeal",1)},{id:"e10",source:t("createDeal",1),target:t("bookMeeting",1)},{id:"e11",source:t("bookMeeting",1),target:t("end",1)}]},{id:"saas-demo-booker",name:"SaaS Demo Booker",description:"Qualify B2B prospects and book product demos with decision-makers",industry:"SaaS & Technology",icon:"ð»",tags:["saas","technology","b2b","demo","lead qualification"],personalityPrompt:`You are a knowledgeable and efficie
22nt SaaS product specialist. Your goal is to understand prospects' needs and qualify them for product demos. 23 24Key behaviors: 25- Be professional but approachable 26- Understand their current pain points and challenges 27- Ask about company size, role, and decision-making process 28- Qualify based on: company size (target segment), decision-maker or influencer, clear use case, timeline 29- For qualified leads, book a personalized demo 30- Handle technical questions confidently or offer to connect with technical team 31 32Focus on value and ROI rather than features.`,nodes:[{id:t("trigger",1),type:"trigger",position:{x:250,y:0},data:{label:"Chat Started"}},{id:t("message",1),type:"message",position:{x:250,y:100},data:{label:"Welcome",messageContent:"Hi there! ð Thanks for checking us out. I'm here to help you learn more about our platform and see if it's a good fit for your needs. What brings you here today?"}},{id:t("crmLookup",1),type:"crmLookup",position:{x:250,y:220},data:{label:"Check Existing",lookupField:"email"}},{id:t("question",1),type:"question",position:{x:250,y:340},data:{label:"Ask Company",questionText:"What company are you with, and what's your role there?",mapsToField:"company.name",maxRetries:2}},{id:t("question",2),type:"question",position:{x:250,y:460},data:{label:"Ask Team Size",questionText:"How large is your team? (This helps us understand which plan might work best)",mapsToField:"custom.team_size",maxRetries:2}},{id:t("question",3),type:"question",position:{x:250,y:580},data:{label:"Ask Pain Points",questionText:"What challenges are you currently facing that brought you to look for a solution like ours?",mapsToField:"custom.pain_points",maxRetries:2}},{id:t("question",4),type:"question",position:{x:250,y:700},data:{label:"Ask Timeline",questionText:"What's your timeline for implementing a new solution?",mapsToField:"custom.implementation_timeline",maxRetries:2}},{id:t("qualify",1),type:"qualify",position:{x:250,y:820},data:{label:"Score Prospect",tagsToAdd:"SaaS Prospect, Demo Request",leadScore:80}},{id:t("ai",1),type:"ai",position:{x:250,y:940},data:{label:"AI Response",aiPrompt:"Based on their pain points and requirements, briefly explain how our solution addresses their specific needs. Then offer to schedule a personalized demo."}},{id:t("createDeal",1),type:"createDeal",position:{x:250,y:1060},data:{label:"Create Opportunity",dealName:"Demo Request",pipelineStage:"Demo Scheduled"}},{id:t("bookMeeting",1),type:"bookMeeting",position:{x:250,y:1180},data:{label:"Book Demo",meetingType:"Product Demo"}},{id:t("end",1),type:"end",position:{x:250,y:1300},data:{label:"Demo Booked"}}],edges:[{id:"e1",source:t("trigger",1),target:t("message",1)},{id:"e2",source:t("message",1),target:t("crmLookup",1)},{id:"e3",source:t("crmLookup",1),target:t("question",1),sourceHandle:"not_found"},{id:"e4",source:t("crmLookup",1),target:t("question",3),sourceHandle:"found"},{id:"e5",source:t("question",1),target:t("question",2)},{id:"e6",source:t("question",2),target:t("question",3)},{id:"e7",source:t("question",3),target:t("question",4)},{id:"e8",source:t("question",4),target:t("qualify",1)},{id:"e9",source:t("qualify",1),target:t("ai",1)},{id:"e10",source:t("ai",1),target:t("createDeal",1)},{id:"e11",source:t("createDeal",1),target:t("bookMeeting",1)},{id:"e12",source:t("bookMeeting",1),target:t("end",1)}]},{id:"ecommerce-support-sales",name:"E-Commerce Assistant",description:"Handle customer support inquiries and assist with product recommendations and purchases",industry:"E-Commerce",icon:"ð",tags:["ecommerce","retail","support","sales"],personalityPrompt:`You are a helpful and enthusiastic e-commerce assistant. Your goals are to assist customers with their orders, answer product questions, and help them find what they're looking for. 33 34Key behaviors: 35- Be friendly, helpful, and efficient 36- Help with order status, returns, and shipping questions 37- Make personalized product recommendations 38- Handle complaints with empathy and offer solutions 39- Upsell and cross-sell naturally when appropriate
40- Escalate complex issues to human support 41 42Always prioritize customer satisfaction.`,nodes:[{id:t("trigger",1),type:"trigger",position:{x:250,y:0},data:{label:"Chat Started"}},{id:t("message",1),type:"message",position:{x:250,y:100},data:{label:"Welcome",messageContent:"Hi! ð Welcome to our store. I'm here to help with orders, product questions, or anything else. How can I assist you today?"}},{id:t("ai",1),type:"ai",position:{x:250,y:220},data:{label:"AI Conversation",aiPrompt:"Help the customer with their inquiry. Determine if they need: order support, product recommendations, or have a complaint. Respond helpfully and gather any needed information."}},{id:t("crmLookup",1),type:"crmLookup",position:{x:100,y:460},data:{label:"Find Customer",lookupField:"email"}},{id:t("ai",2),type:"ai",position:{x:100,y:580},data:{label:"Personalized Help",aiPrompt:"Based on their order history and inquiry, provide personalized assistance. For product questions, make relevant recommendations. For order issues, provide tracking or solutions."}},{id:t("qualify",1),type:"qualify",position:{x:100,y:700},data:{label:"Log Interaction",tagsToAdd:"Chat Support, Website Visitor"}},{id:t("waitReply",1),type:"waitReply",position:{x:100,y:820},data:{label:"Await Response",timeoutMinutes:5}},{id:t("message",2),type:"message",position:{x:250,y:940},data:{label:"Timeout Message",messageContent:"No worries if you're busy! Feel free to come back anytime, or reach out via email if you prefer. Have a great day! ð"}},{id:t("end",1),type:"end",position:{x:100,y:940},data:{label:"Continue Chat"}},{id:t("end",2),type:"end",position:{x:250,y:1060},data:{label:"Session End"}}],edges:[{id:"e1",source:t("trigger",1),target:t("message",1)},{id:"e2",source:t("message",1),target:t("ai",1)},{id:"e3",source:t("ai",1),target:t("crmLookup",1)},{id:"e7",source:t("crmLookup",1),target:t("ai",2),sourceHandle:"found"},{id:"e8",source:t("crmLookup",1),target:t("ai",2),sourceHandle:"not_found"},{id:"e9",source:t("ai",2),target:t("qualify",1)},{id:"e10",source:t("qualify",1),target:t("waitReply",1)},{id:"e11",source:t("waitReply",1),target:t("end",1),sourceHandle:"reply"},{id:"e12",source:t("waitReply",1),target:t("message",2),sourceHandle:"timeout"},{id:"e13",source:t("message",2),target:t("end",2)}]},{id:"healthcare-appointment-booker",name:"Healthcare Appointment Booker",description:"Help patients book appointments and answer common healthcare questions with appropriate disclaimers",industry:"Healthcare",icon:"ð¥",tags:["healthcare","medical","appointments","patient"],personalityPrompt:`You are a professional and empathetic healthcare assistant. Your goal is to help patients book appointments and answer general questions about services. 43 44Key behaviors: 45- Be warm, patient, and professional 46- NEVER provide medical advice or diagnoses 47- Always include appropriate disclaimers 48- Help with appointment scheduling, hours, and services 49- Collect basic information (name, contact, reason for visit) 50- Escalate urgent matters to staff immediately 51- Maintain patient privacy and confidentiality 52 53Remember: Always recommend they consult with a healthcare professional for medical questions.`,nodes:[{id:t("trigger",1),type:"trigger",position:{x:250,y:0},data:{label:"Chat Started"}},{id:t("message",1),type:"message",position:{x:250,y:100},data:{label:"Welcome",messageContent:`Hello! ð Welcome to our practice. I can help you book an appointment or answer questions about our services. How can I assist you today? 54 55*Please note: For medical emergencies, please call 999 immediately.*`}},{id:t("question",1),type:"question",position:{x:250,y:220},data:{label:"Ask Purpose",questionText:"Are you looking to book an appointment, or do you have a question about our services?",mapsToField:"custom.inquiry_type",maxRetries:2}},{id:t("question",2),type:"question",position:{x:250,y:340},data:{label:"Ask Patient Status",questionText:"Are you an existing patient with us, or would this be your first visit?",mapsToField:"custom.patient_status",maxRetries:2}},{id:t("question",3),type:"question",position:{x:250,y:460},data:{label:"Ask Visit Reason",questionText:"What type of appointment are you looking for? (e.g., general checkup, specific concern, follow-up)",mapsToField:"custom.visit_reason",maxRetries:2}},{id:t("leadVerification",1),type:"leadVerification",position:{x:250,y:580},data:{label:"Verify Patient",verificationLevel:"basic"}},{id:t("qualify",1),type:"qualify",position:{x:100,y:700},data:{label:"Log Patient",tagsToAdd:"Patient Inquiry, Appointment Request"}},{id:t("assignHuman",1),type:"assignHuman",position:{x:400,y:700},data:{label:"Staff Review",reason:"Verification needed for patient information"}},{id:t("bookMeeting",1),type:"bookMeeting",position:{x:100,y:820},data:{label:"Book Appointment",meetingType:"Medical Appointment"}},{id:t("message",2),type:"message",position:{x:100,y:940},data:{label:"Confirmation",messageContent:"Your appointment has been scheduled. You'll receive a confirmation email shortly. Please arrive 15 minutes early for check-in. If you need to reschedule, just let us know!"}},{id:t("end",1),type:"end",position:{x:100,y:1060},data:{label:"Appointment Booked"}}],edges:[{id:"e1",source:t("trigger",1),target:t("message",1)},{id:"e2",source:t("message",1),target:t("question",1)},{id:"e3",source:t("question",1),target:t("question",2)},{id:"e4",source:t("question",2),target:t("question",3)},{id:"e5",source:t("question",3),target:t("leadVerification",1)},{id:"e6",source:t("leadVerification",1),target:t("qualify",1),sourceHandle:"verified"},{id:"e7",source:t("leadVerification",1),target:t("assignHuman",1),sourceHandle:"suspicious"},{id:"e8",source:t("qualify",1),target:t("bookMeeting",1)},{id:"e9",source:t("bookMeeting",1),target:t("message",2)},{id:"e10",source:t("message",2),target:t("end",1)}]},{id:"legal-consultation-booker",name:"Legal Consultation Booker",description:"Qualify potential clients and schedule initial legal consultations with appropriate disclaimers",industry:"Legal Services",icon:"âï¸",tags:["legal","law firm","consultation","attorney"],personalityPrompt:`You are a professional and discreet legal intake specialist. Your goal is to help potential clients understand your firm's services and schedule consultations. 56 57Key behaviors: 58- Be professional, courteous, and discrete 59- NEVER provide specific legal advice 60- Always include legal disclaimers 61- Understand the nature of their legal matter (broadly) 62- Collect basic information for the consultation 63- Qualify based on practice areas your firm handles 64- Maintain strict confidentiality 65 66Remember: All legal advice must come from a licensed attorney during a proper consultation.`,nodes:[{id:t("trigger",1),type:"trigger",position:{x:250,y:0},data:{label:"Chat Started"}},{id:t("message",1),type:"message",position:{x:250,y:100}
66,data:{label:"Welcome",messageContent:`Good day. Thank you for contacting our law firm. I'm here to help you schedule a consultation with one of our attorneys. How may I assist you? 67 68*This conversation is for scheduling purposes only and does not constitute legal advice or create an attorney-client relationship.*`}},{id:t("question",1),type:"question",position:{x:250,y:220},data:{label:"Ask Legal Area",questionText:"What area of law does your matter relate to? (e.g., Family, Personal Injury, Business, Criminal, Real Estate)",mapsToField:"custom.legal_area",maxRetries:2}},{id:t("question",2),type:"question",position:{x:250,y:340},data:{label:"Brief Description",questionText:"Please provide a brief, general description of your situation. (No need for specific details at this stage)",mapsToField:"custom.matter_description",maxRetries:2}},{id:t("question",3),type:"question",position:{x:250,y:460},data:{label:"Ask Urgency",questionText:"Is this matter time-sensitive? Are there any upcoming court dates or deadlines?",mapsToField:"custom.urgency_level",maxRetries:2}},{id:t("qualify",1),type:"qualify",position:{x:250,y:580},data:{label:"Qualify Client",tagsToAdd:"Legal Inquiry, Consultation Request"}},{id:t("ai",1),type:"ai",position:{x:250,y:700},data:{label:"Match to Practice",aiPrompt:"Based on their legal area and description, confirm which practice area handles their type of case. Explain briefly what to expect in an initial consultation. Do NOT provide legal advice."}},{id:t("createDeal",1),type:"createDeal",position:{x:250,y:820},data:{label:"Create Matter",dealName:"Consultation Request",pipelineStage:"Initial Inquiry"}},{id:t("bookMeeting",1),type:"bookMeeting",position:{x:250,y:940},data:{label:"Book Consultation",meetingType:"Legal Consultation"}},{id:t("message",2),type:"message",position:{x:250,y:1060},data:{label:"Next Steps",messageContent:`Your consultation has been scheduled. You'll receive a confirmation email with details and any documents to prepare. Please note that the initial consultation does not create an attorney-client relationship until formally engaged. 69 70We look forward to speaking with you.`}},{id:t("end",1),type:"end",position:{x:250,y:1180},data:{label:"Consultation Booked"}}],edges:[{id:"e1",source:t("trigger",1),target:t("message",1)},{id:"e2",source:t("message",1),target:t("question",1)},{id:"e3",source:t("question",1),target:t("question",2)},{id:"e4",source:t("question",2),target:t("question",3)},{id:"e5",source:t("question",3),target:t("qualify",1)},{id:"e6",source:t("qualify",1),target:t("ai",1)},{id:"e7",source:t("ai",1),target:t("createDeal",1)},{id:"e8",source:t("createDeal",1),target:t("bookMeeting",1)},{id:"e9",source:t("bookMeeting",1),target:t("message",2)},{id:"e10",source:t("message",2),target:t("end",1)}]},...oa()];function oa(){return[{id:"insurance-lead-qualifier",name:"Insurance Lead Qualifier",description:"Qualify insurance leads by understanding coverage needs, current policies, and risk profile",industry:"Insurance",icon:"ð¡ï¸",tags:["insurance","coverage","policy","risk"],personality:"You are a friendly insurance advisor. Help clients understand their coverage needs without being pushy. Ask about current coverage, life stage, and budget. Never guarantee rates.",welcome:"Hi! ð¡ï¸ I can help you find the right insurance coverage. What type of insurance are you looking for?",questions:[{label:"Coverage Type",text:"What type of insurance coverage are you interested in?",field:"custom.coverage_type"},{label:"Current Coverage",text:"Do you currently have any coverage, or is this a new policy?",field:"custom.current_coverage"},{label:"Budget Range",text:"What's your monthly budget for insurance premiums?",field:"custom.insurance_budget"}]},{id:"financial-advisor-qualifier",name:"Financial Advisory Qualifier",description:"Qualify potential clients for financial planning and wealth management services",industry:"Financial Services",icon:"ð°",tags:["finance","investment","wealth","planning"],personality:"You are a professional financial advisor assistant. Be trustworthy and transparent. Never provide specific investment advice.",welcome:"Welcome! ð° I'm here to help you explore financial planning options. What's your primary financial goal?",questions:[{label:"Financial Goal",text:"What's your primary financial goal? (Retirement, investing, debt management, etc.)",field:"custom.financial_goal"},{label:"Investment Experience",text:"How would you describe your investment experience?",field:"custom.investment_experience"},{label:"Timeline",text:"What's your timeframe for achieving this goal?",field:"custom.financial_timeline"}]},{id:"auto-dealership-qualifier",name:"Auto Dealership Assistant",description:"Help car buyers find the right vehicle and schedule test drives",industry:"Automotive",icon:"ð",tags:["automotive","car","dealership","test drive"],personality:"You are an enthusiastic but honest car sales assistant. Help buyers find the perfect vehicle. Be transparent about pricing.",welcome:"Hey there! ð Welcome to our dealership. Are you looking for a new or pre-owned vehicle?",questions:[{label:"Vehicle Type",text:"What type of vehicle are you looking for? (SUV, sedan, truck, EV, etc.)",field:"custom.vehicle_type"},{label:"Budget",text:"What's your budget range? Are you looking to finance or pay cash?",field:"custom.vehicle_budget"},{label:"Trade-in",text:"Do you have a vehicle to trade in?",field:"custom.has_trade_in"}]},{id:"fitness-gym-qualifier",name:"Fitness & Gym Lead",description:"Qualify gym membership leads and book facility tours",industry:"Fitness & Wellness",icon:"ðª",tags:["fitness","gym","health","membership","wellness"],personality:"You are a motivating fitness consultant. Be enthusiastic and supportive. Never body-shame.",welcome:"Hey! ðª Ready to start your fitness journey? What are your fitness goals?",questions:[{label:"Fitness Goals",text:"What are your main fitness goals?",field:"custom.fitness_goals"},{label:"Experience Level",text:"What's your current fitness level?",field:"custom.fitness_level"},{label:"Preferred Times",text:"When do you typically prefer to work out?",field:"custom.workout_times"}]},{id:"restaurant-booking",name:"Restaurant Booking Bot",description:"Handle restaurant reservations, menu inquiries, and dietary requirements",industry:"Hospital
70ity & Food",icon:"ð½ï¸",tags:["restaurant","booking","food","hospitality","dining"],personality:"You are a warm restaurant host. Help guests make reservations and answer menu questions.",welcome:"Welcome! ð½ï¸ I can help you make a reservation or answer menu questions. How can I help?",questions:[{label:"Party Size",text:"How many guests will be dining?",field:"custom.party_size"},{label:"Date & Time",text:"When would you like to dine? (Date and preferred time)",field:"custom.reservation_datetime"},{label:"Dietary Needs",text:"Any dietary requirements or allergies?",field:"custom.dietary_needs"}]},{id:"education-enrollment",name:"Education Enrollment Advisor",description:"Guide prospective students through program selection and enrollment",industry:"Education",icon:"ð",tags:["education","university","enrollment","student","courses"],personality:"You are a helpful education advisor. Guide students in choosing the right program. Be encouraging.",welcome:"Hello! ð I'm here to help you explore our programs. What field of study interests you?",questions:[{label:"Field of Interest",text:"What subject area are you interested in?",field:"custom.study_field"},{label:"Study Level",text:"What level? (Certificate, undergraduate, postgraduate)",field:"custom.study_level"},{label:"Start Date",text:"When are you looking to start?",field:"custom.preferred_start"}]},{id:"travel-agency-qualifier",name:"Travel Agency Assistant",description:"Help travelers plan trips and qualify leads for custom travel packages",industry:"Travel & Tourism",icon:"âï¸",tags:["travel","tourism","vacation","holiday","booking"],personality:"You are an exciting travel consultant. Inspire wanderlust! Understand their style and budget.",welcome:"Hello, traveller! âï¸ Where in the world would you like to go?",questions:[{label:"Destination",text:"Do you have a destination in mind, or would you like suggestions?",field:"custom.destination"},{label:"Travel Dates",text:"When are you planning to travel and for how long?",field:"custom.travel_dates"},{label:"Budget & Style",text:"What's your budget range and travel style?",field:"custom.travel_style"}]},{id:"home-services-qualifier",name:"Home Services Lead",description:"Qualify leads for home improvement, plumbing, electrical, and maintenance",industry:"Home Services",icon:"ð¡",tags:["home improvement","plumbing","electrical","contractor"],personality:"You are a helpful home services coordinator. Be honest about timelines and pricing.",welcome:"Hi! ð¡ What home service do you need? (Plumbing, electrical, painting, roofing, repairs)",questions:[{label:"Service Needed",text:"What type of home service do you need?",field:"custom.service_type"},{label:"Urgency",text:"How urgent is this? (Emergency, this week, flexible)",field:"custom.urgency"},{label:"Property Type",text:"What type of property is this for?",field:"custom.property_type"}]},{id:"recruitment-qualifier",name:"Recruitment Screener",description:"Pre-screen job candidates by collecting experience, skills, and availability",industry:"Recruitment & HR",icon:"ð",tags:["recruitment","hiring","HR","jobs","candidates"],personality:"You are a professional recruiter. Screen candidates efficiently while being respectful.",welcome:"Hi! ð Thanks for your interest. What role are you interested in?",questions:[{label:"Role Interest",text:"Which position are you applying for?",field:"custom.target_role"},{label:"Experience",text:"How many years of relevant experience do you have?",field:"custom.years_experience"},{label:"Availability",text:"When could you start if offered a position?",field:"custom.start_availability"}]},{id:"wedding-planner-qualifier",name:"Wedding Planner Lead",description:"Qualify couples for wedding planning services",industry:"Events & Weddings",icon:"ð",tags:["wedding","events","planning","celebration"],personality:"You are an enthusiastic wedding planner assistant. Share their excitement!",welcome:"Congratulations! ð⨠I'd love to help plan your dream wedding. Tell me about your vision!",questions:[{label:"Wedding Date",text:"Do you have a date in mind?",field:"custom.wedding_date"},{label:"Guest Count",text:"Approximately how many guests?",field:"custom.guest_count"},{label:"Budget Range",text:"What's your overall wedding budget?",field:"custom.wedding_budget"}]},{id:"pet-services-qualifier",name:"Pet Services Assistant",description:"Help pet owners find grooming, boarding, veterinary, and training services",industry:"Pet Services",icon:"ð¾",tags:["pets","veterinary","grooming","boarding"],personality:"You are a warm pet-loving assistant. Show genuine care for animals.",welcome:"Hello, pet parent! ð¾ What can I help you with? (Grooming, boarding, vet, training)",questions:[{label:"Pet Type",text:"What type of pet do you have, and what's their name?",field:"custom.pet_type"},{label:"Service Needed",text:"What service are you looking for?",field:"custom.pet_service"},{label:"Timing",text:"When do you need this service?",field:"custom.service_timing"}]},{id:"beauty-salon-qualifier",name:"Beauty Salon Booker",description:"Book salon appointments and recommend beauty treatments",industry:"Beauty & Cosmetics",icon:"ð",tags:["beauty","salon","hair","spa","cosmetics"],personality:"You are a glamorous and friendly salon receptionist. Make them feel pampered.",welcome:"Welcome! ð Ready for some self-care? What treatment are you looking for?",questions:[{label:"Treatment Type",text:"What service? (Hair, nails, facial, massage, makeup)",field:"custom.treatment_type"},{label:"Preferred Date",text:"When would you like to come in?",field:"custom.preferred_date"},{label:"Stylist Preference",text:"Do you have a preferred stylist?",f
70ield:"custom.stylist_pref"}]},{id:"construction-qualifier",name:"Construction Project Lead",description:"Qualify construction and renovation project leads",industry:"Construction",icon:"ðï¸",tags:["construction","building","renovation","contractor"],personality:"You are a professional construction coordinator. Be transparent about timelines and costs.",welcome:"Hello! ðï¸ What type of construction project are you planning?",questions:[{label:"Project Type",text:"What kind of project? (New build, renovation, extension, fit-out)",field:"custom.project_type"},{label:"Project Size",text:"Approximate size or scope?",field:"custom.project_scope"},{label:"Budget & Timeline",text:"Budget range and desired completion date?",field:"custom.project_budget"}]},{id:"cleaning-services-qualifier",name:"Cleaning Services Lead",description:"Qualify residential and commercial cleaning service leads",industry:"Cleaning Services",icon:"ð§¹",tags:["cleaning","janitorial","housekeeping"],personality:"You are a helpful cleaning services coordinator. Be professional and detail-oriented.",welcome:"Hi! ð§¹ Is this for a home or business cleaning?",questions:[{label:"Property Type",text:"Residential or commercial cleaning?",field:"custom.cleaning_type"},{label:"Property Size",text:"How large is the space?",field:"custom.property_size"},{label:"Frequency",text:"How often? (One-time, weekly, biweekly, monthly)",field:"custom.cleaning_frequency"}]},{id:"accounting-qualifier",name:"Accounting & Tax Lead",description:"Qualify leads for accounting, bookkeeping, and tax services",industry:"Accounting",icon:"ð",tags:["accounting","tax","bookkeeping","CPA"],personality:"You are a professional accounting assistant. Never provide specific tax advice without qualification.",welcome:"Hello! ð Are you a business or individual seeking accounting services?",questions:[{label:"Client Type",text:"Business or individual?",field:"custom.client_type"},{label:"Service Needed",text:"What services? (Bookkeeping, tax, audit, payroll, advisory)",field:"custom.accounting_service"},{label:"Business Size",text:"Approximate employee count and revenue range?",field:"custom.business_size"}]},{id:"dental-practice-qualifier",name:"Dental Practice Assistant",description:"Help patients book dental appointments and understand treatments",industry:"Dental",icon:"ð¦·",tags:["dental","dentist","teeth","orthodontics"],personality:"You are a friendly dental receptionist. Put patients at ease and handle dental anxiety with care.",welcome:"Hello! 𦷠I can help you book an appointment. What brings you in?",questions:[{label:"Visit Purpose",text:"What brings you in? (Checkup, concern, cosmetic, emergency)",field:"custom.visit_purpose"},{label:"Patient Status",text:"Existing patient or new?",field:"custom.patient_status"},{label:"Insurance",text:"Do you have dental insurance?",field:"custom.has_insurance"}]},{id:"it-services-qualifier",name:"IT Services & MSP Lead",description:"Qualify businesses for managed IT services and cybersecurity",industry:"IT & Technology Services",icon:"ð¥ï¸",tags:["IT","managed services","cybersecurity","MSP"],personality:"You are a knowledgeable IT consultant. Understand their challenges without jargon.",welcome:"Hi! ð¥ï¸ What tech challenges is your business facing?",questions:[{label:"IT Challenge",text:"Primary concern? (Security, downtime, scaling, migration, support)",field:"custom.it_challenge"},{label:"Company Size",text:"How many employees and devices?",field:"custom.company_size"},{label:"Current Setup",text:"Do you have an IT team or MSP currently?",field:"custom.current_it_setup"}]},{id:"logistics-freight-qualifier",name:"Logistics & Freight Lead",description:"Qualify shipping and logistics leads with route and volume details",industry:"Logistics & Supply Chain",icon:"ð",tags:["logistics","freight","shipping","transport"],personality:"You are an efficient logistics coordinator. Be precise about capabilities.",welcome:"Hello! ð What shipping or logistics service do you need?",questions:[{label:"Shipment Type",text:"What are you shipping? (Pallets, containers, parcels, oversized)",field:"custom.shipment_type"},{label:"Route",text:"From and to where?",field:"custom.shipping_route"},{label:"Volume",text:"How often and what volumes?",field:"custom.shipping_volume"}]},{id:"photography-qualifier",name:"Photography Booker",description:"Qualify leads for photography services",industry:"Photography",icon:"ð¸",tags:["photography","portrait","wedding","commercial"],personality:"You are a creative photography assistant. Be enthusiastic about their vision.",welcome:"Hi! ð¸ What type of photography shoot are you looking for?",questions:[{label:"Shoot Type",text:"What type? (Wedding, portrait, corporate, product, event)",field:"custom.shoot_type"},{label:"Date & Location",text:"When and where?",field:"custom.shoot_details"},{label:"Style",text:"What style and how many final images?",field:"custom.photo_style"}]},{id:"moving-company-qualifier",name:"Moving Company Lead",description:"Qualify moving leads with property details and distance",industry:"Moving & Relocation",icon:"ð¦",tags:["moving","relocation","packing","removals"],personality:"You are a helpful moving coordinator. Be reassuring about the process.",welcome:"Hello! ð¦ Planning a move? Where are you moving from and to?",questions:[{label:"Move Details",text:"Where from and to? (Including floor/lift access)",field:"custom.move_locations"},{label:"Property Size",text:"How many bedrooms or how large?",field:"custom.move_size"},{label:"Move Date",text:"When do you need to move?",field:"custom.move_date"}]},{id:"marketing-agency-qualifier",name:"Marketing Agency Lead",description:"Qualify businesses for digital marketing and advertising services",industry:"Marketing & Advertising",icon:"ð¢",tags:["marketing","digital","SEO","advertising"],personality:"You are a strategic marketing consultant. Be results-focused and data-driven.",welcome:"Hi! ð¢ What's your biggest marketing challenge?",questions:[{label:"Marketing Goals",text:"Primary objective? (Brand awareness, leads, sales, retention)",field:"custom.marketing_goal"},{label:"Current Efforts",text:"What channels are you currently using?",f
70ield:"custom.current_marketing"},{label:"Budget",text:"Monthly marketing budget and timeline for results?",field:"custom.marketing_budget"}]},{id:"pharmacy-assistant",name:"Pharmacy Assistant",description:"Help customers with prescription queries and health product recommendations",industry:"Pharmacy",icon:"ð",tags:["pharmacy","health","prescription","medicine"],personality:"You are a helpful pharmacy assistant. NEVER provide medical advice. Always recommend consulting a pharmacist.",welcome:"Hello! ð I can help with prescription queries or product recommendations. How can I assist?",questions:[{label:"Query Type",text:"What can I help with? (Prescription, product, hours, delivery)",field:"custom.pharmacy_query"},{label:"Fulfillment",text:"Collect in-store or delivery?",field:"custom.fulfillment_pref"},{label:"Urgency",text:"Is this urgent or standard processing?",field:"custom.rx_urgency"}]},{id:"childcare-qualifier",name:"Childcare & Nursery Lead",description:"Help parents find childcare and schedule tours",industry:"Childcare & Education",icon:"ð¶",tags:["childcare","nursery","daycare","preschool"],personality:"You are a warm childcare advisor. Be reassuring about safety and quality.",welcome:"Hello! ð¶ Thank you for considering us. How old is your little one?",questions:[{label:"Child's Age",text:"How old is your child?",field:"custom.child_age"},{label:"Schedule Needs",text:"Full-time, part-time, or specific days?",field:"custom.schedule_needs"},{label:"Start Date",text:"When would you need care to start?",field:"custom.care_start_date"}]},{id:"roofing-qualifier",name:"Roofing Services Lead",description:"Qualify roofing leads for repairs, replacements, and installations",industry:"Roofing",icon:"ð ",tags:["roofing","roof repair","construction"],personality:"You are a helpful roofing specialist. Prioritize safety and quality.",welcome:"Hello! ð Is this a repair, replacement, or new installation?",questions:[{label:"Service Type",text:"What roofing service? (Repair, replacement, inspection, new build)",field:"custom.roofing_service"},{label:"Roof Details",text:"Property type and approximate roof size?",field:"custom.roof_details"},{label:"Issue",text:"What prompted this inquiry?",field:"custom.roof_issue"}]},{id:"landscaping-qualifier",name:"Landscaping & Garden Lead",description:"Qualify leads for landscaping design and garden services",industry:"Landscaping",icon:"ð¿",tags:["landscaping","garden","lawn","outdoor"],personality:"You are an enthusiastic landscaping consultant. Be creative about outdoor spaces.",welcome:"Hi! ð¿ Ready to transform your outdoor space? What do you have in mind?",questions:[{label:"Project Vision",text:"What are you looking for? (Design, maintenance, planting, hardscaping)",field:"custom.landscape_type"},{label:"Space Size",text:"How large is the area?",field:"custom.space_size"},{label:"Budget",text:"Budget range and when to start?",field:"custom.landscape_budget"}]},{id:"hvac-qualifier",name:"HVAC Services Lead",description:"Qualify leads for heating, cooling, and ventilation services",industry:"HVAC",icon:"âï¸",tags:["HVAC","heating","cooling","air conditioning"],personality:"You are a knowledgeable HVAC assistant. Be efficient, especially for emergencies.",welcome:"Hello! âï¸ Is this an emergency or a planned HVAC service?",questions:[{label:"Service",text:"Repair, installation, maintenance, or inspection?",field:"custom.hvac_service"},{label:"System Type",text:"What system? (Central air, heat pump, furnace, boiler)",field:"custom.system_type"},{label:"Urgency",text:"Is this urgent?",field:"custom.hvac_urgency"}]},{id:"nonprofit-qualifier",name:"Nonprofit Engagement Bot",description:"Engage potential donors and volunteers with your mission",industry:"Nonprofit",icon:"â¤ï¸",tags:["nonprofit","charity","volunteer","donation"],personality:"You are a passionate nonprofit ambassador. Be grateful and authentic. Never aggressive about donations.",welcome:"Hello! â¤ï¸ Would you like to learn about volunteering, donating, or our programs?",questions:[{label:"Interest",text:"How would you like to get involved?",field:"custom.involvement_type"},{label:"Availability",text:"How much time or resources can you contribute?",field:"custom.availability"},{label:"Cause Interest",text:"Which programs interest you most?",field:"custom.cause_interest"}]},{id:"manufacturing-qualifier",name:"Manufacturing Inquiry Bot",description:"Qualify manufacturing inquiries with specs and volume requirements",industry:"Manufacturing",icon:"ð",tags:["manufacturing","production","industrial","OEM"],personality:"You are a professional manufacturing sales engineer. Be technical but accessible.",welcome:"Hello! ð Custom production, bulk orders, or engineering consultation?",questions:[{label:"Product Type",text:"What product or component needs manufacturing?",field:"custom.product_type"},{label:"Volume",text:"Quantities? (Prototype, small batch, mass production)",field:"custom.production_volume"},{label:"Specs",text:"Do you have specifications or CAD files?",field:"custom.has_specs"}]},{id:"spa-wellness-qualifier",name:"Spa & Wellness Booker",description:"Help clients discover and book spa treatments",industry:"Spa & Wellness",icon:"ð§",tags:["spa","wellness","massage","relaxation"],personality:"You are a serene spa receptionist. Create a calming experience.",welcome:"Welcome! ð§â¨ What type of treatment interests you?",questions:[{label:"Treatment",text:"Massage, facial, body treatment, or package?",field:"custom.treatment_interest"},{label:"Date",text:"When would you like to visit?",field:"custom.spa_date"},{label:"Special Needs",text:"Any health conditions or special requests?",field:"custom.spa_needs"}]},{id:"plumbing-qualifier",name:"Plumbing Services Lead",description:"Qualify plumbing leads for emergency and scheduled services",industry:"Plumbing",icon:"ð§",tags:["plumbing","pipes","drainage","emergency"],personality:"You are a reliable plumbing coordinator. Prioritize emergencie
70s and be honest about costs.",welcome:"Hello! ð§ Do you have a plumbing emergency or need to schedule a service?",questions:[{label:"Issue Type",text:"What's the plumbing issue? (Leak, blockage, installation, boiler)",field:"custom.plumbing_issue"},{label:"Urgency",text:"Is this an emergency? (Water flooding, no hot water, etc.)",field:"custom.plumbing_urgency"},{label:"Property",text:"Residential or commercial property?",field:"custom.property_type"}]},{id:"music-lessons-qualifier",name:"Music Lessons Booker",description:"Help students find the right music lessons and schedule trial classes",industry:"Music & Arts",icon:"ðµ",tags:["music","lessons","instrument","education"],personality:"You are a passionate music educator. Be encouraging regardless of skill level.",welcome:"Hello! ðµ Interested in music lessons? What instrument or style appeals to you?",questions:[{label:"Instrument",text:"What instrument or type of music? (Piano, guitar, vocals, drums, etc.)",field:"custom.instrument"},{label:"Skill Level",text:"Complete beginner, some experience, or advanced?",field:"custom.skill_level"},{label:"Schedule",text:"Preferred lesson day and time?",field:"custom.lesson_schedule"}]},{id:"coworking-qualifier",name:"Coworking Space Lead",description:"Qualify leads for coworking space memberships and office rentals",industry:"Coworking & Office",icon:"ð¢",tags:["coworking","office","workspace","rental"],personality:"You are a friendly community manager. Highlight the community and amenities.",welcome:"Welcome! ð¢ Looking for a workspace? I can help find the perfect fit.",questions:[{label:"Space Need",text:"What do you need? (Hot desk, dedicated desk, private office, meeting room)",field:"custom.space_type"},{label:"Team Size",text:"How many people need workspace?",field:"custom.team_size"},{label:"Duration",text:"How long do you need the space? (Daily, monthly, annual)",field:"custom.rental_duration"}]},{id:"security-services-qualifier",name:"Security Services Lead",description:"Qualify leads for security guards, CCTV, and alarm systems",industry:"Security Services",icon:"ð",tags:["security","CCTV","alarm","guards"],personality:"You are a professional security consultant. Be thorough about safety needs.",welcome:"Hello! ð I can help with your security needs. What type of service are you looking for?",questions:[{label:"Service Type",text:"What security service? (Guards, CCTV, alarms, access control, events)",field:"custom.security_type"},{label:"Property Details",text:"What type of property or event needs security?",field:"custom.security_property"},{label:"Timeline",text:"When do you need this service to start?",field:"custom.security_timeline"}]},{id:"printing-qualifier",name:"Print Services Lead",description:"Qualify leads for printing, signage, and branded merchandise",industry:"Print & Signage",icon:"ð¨ï¸",tags:["printing","signage","merchandise","branding"],personality:"You are a creative print specialist. Help clients visualize their finished products.",welcome:"Hi! ð¨ï¸ What do you need printed? (Business cards, banners, signage, merch, flyers)",questions:[{label:"Product Type",text:"What type of print product do you need?",field:"custom.print_product"},{label:"Quantity",text:"How many do you need?",field:"custom.print_quantity"},{label:"Deadline",text:"When do you need them by?",field:"custom.print_deadline"}]},{id:"catering-qualifier",name:"Catering Services Lead",description:"Qualify catering leads for events, corporate, and private functions",industry:"Catering",icon:"ð´",tags:["catering","events","food","corporate"],personality:"You are an enthusiastic catering coordinator. Be creative with menu suggestions.",welcome:"Hello! ð´ Planning an event? I can help with catering. What's the occasion?",questions:[{label:"Event Type",text:"What type of event? (Corporate, wedding, birthday, conference)",field:"custom.event_type"},{label:"Guest Count",text:"How many guests?",field:"custom.catering_guests"},{label:"Cuisine & Budget",text:"Any cuisine preferences and budget per head?",field:"custom.catering_budget"}]},{id:"storage-qualifier",name:"Self Storage Lead",description:"Help customers find the right storage unit size and duration",industry:"Storage",icon:"ð¦",tags:["storage","self-storage","warehouse","units"],personality:"You are a helpful storage facility advisor. Help customers estimate the right unit size.",welcome:"Hi! ð¦ Need storage space? I can help find the right unit for you.",questions:[{label:"Items to Store",text:"What are you looking to store? (Furniture, boxes, vehicle, business stock)",field:"custom.storage_items"},{label:"Duration",text:"How long do you need storage? (Short-term, long-term)",field:"custom.storage_duration"},{label:"Access Needs",text:"Do you need frequent access to your items?",field:"custom.access_frequency"}]},{id:"tutoring-qualifier",name:"Tutoring Services Lead",description:"Match students with the right tutors based on subject and level",industry:"Tutoring",icon:"ð",tags:["tutoring","education","academic","exam prep"],personality:"You are a supportive academic advisor. Understand learning needs and goals.",welcome:"Hello! ð Looking for tutoring? What subject does the student need help with?",questions:[{label:"Subject",text:"What subject or exam are you preparing for?",field:"custom.subject"},{label:"Student Level",text:"What level? (Primary, secondary, GCSE, A-level, university)",field:"custom.student_level"},{label:"Frequency",text:"How often? (Weekly, twice weekly, intensive)",field:"custom.tutoring_frequency"}]},{id:"electrician-qualifier",name:"Electrical Services Lead",description:"Qualify leads for electrical repairs, installations, and inspections",industry:"Electrical Services",icon:"â¡",tags:["electrician","electrical","wiring","installation"],personality:"You are a professional electrical services coordinator. Prioritize safety.",welcome:"Hello! â¡ What electrical service do you need?",questions:[{label:"Service Type",text:"What do you need? (Repair, new installation, inspection, rewiring)",field:"custom.electrical_service"},{label:"Urgency",text:"Is this urgent or can it be scheduled?",field:"custom.electrical_urgency"},{label:"Property Details",text:"Residential or commercial? Approximate property age?",field:"custom.electrical_property"}]}].map(s=>{const i=[...[{label:"Capture Name",text:"Before we get started, what's your name?",field:"contact.first_name"},{label:"Capture Email",text:"Great to meet you! What's the best email to reach you on?",field:"contact.email"},{label:"Capture Phone",text:"And a phone number in case we need to follow up?",field:"contact.phone"}],...s.questions],r=[{id:`${s.id}-trigger`,type:"trigger",position:{x:250,y:0},data:{label:"Chat Started"}},{id:`${s.id}-welcome`,type:"message",position:{x:250,y:100},data:{label:"Welcome",messageContent:s.welcome}},...i.map((l,p)=>({id:`${s.id}-q${p}`,type:"question",position:{x:250,y:220+p*120},data:{label:l.label,questionText:l.text,mapsToField:l.field,maxRetries:2}})),{id:`${s.id}-qualify`,type:"qualify",position:{x:250,y:220+i.length*120},data:{label:"Score Lead",tagsToAdd:`${s.industry} Lead, Website Inquiry`,leadScore:70}},{id:`${s.id}-ai`,type:"ai",position:{x:250,y:340+i.length*120},data:{label:"AI Summary",aiPrompt:"Based on the information collected, provide a helpful summary and recommend next steps."}},{id:`${s.id}-deal`,type:"createDeal",position:{x:250,y:460+i.length*120},data:{label:"Create Lead",dealName:`${s.industry} Inquiry`,pipelineStage:"New Lead"}},{id:`${s.id}-book`,type:"bookMeeting",position:{x:250,y:580+i.length*120},data:{label:"Book Meeting",meetingType:"Consultation"}},{id:`${s.id}-end`,type:"end",position:{x:250,y:700+i.length*120},data:{label:"Complete"}}],u=[{id:`${s.id}-e0`,source:`${s.id}-trigger`,target:`${s.id}-welcome`},{id:`${s.id}-e1`,source:`${s.id}-welcome`,target:`${s.id}-q0`},...i.slice(1).map((l,p)=>({id:`${s.id}-e${p+2}`,source:`${s.id}-q${p}`,target:`${s.id}-q${p+1}`})),{id:`${s.id}-eq`,source:`${s.id}-q${i.length-1}`,target:`${s.id}-qualify`},{id:`${s.id}-ea`,source:`${s.id}-qualify`,target:`${s.id}-ai`},{id:`${s.id}-ed`,source:`${s.id}-ai`,target:`${s.id}-deal`},{id:`${s.id}-eb`,source:`${s.id}-deal`,target:`${s.id}-book`},{id:`${s.id}-ee`,source:`${s.id}-book`,target:`${s.id}-end`}];return{id:s.id,name:s.name,description:s.description,industry:s.industry,icon:s.icon,tags:s.tags,personalityPrompt:s.personality,nodes:r,edges:u}})}const ee={"Solar & Renewable Energy":{h1:38,h2:22},"Real Estate":{h1:200,h2:220},"SaaS & Technology":{h1:260,h2:240},"E-Commerce":{h1:330,h2:350},Healthcare:{h1:175,h2:195},"Legal Services":{h1:215,h2:220,sat:24},Insurance:{h1:220,h2:235},"Financial Services":{h1:145,h2:160},Automotive:{h1:0,h2:18},"Fitness & Wellness":{h1:95,h2:130}
70,"Hospitality & Food":{h1:25,h2:45},Education:{h1:245,h2:270},"Travel & Tourism":{h1:195,h2:215},"Home Services":{h1:30,h2:15},"Recruitment & HR":{h1:280,h2:295},"Events & Weddings":{h1:320,h2:340},"Pet Services":{h1:35,h2:50},"Beauty & Cosmetics":{h1:335,h2:320},Construction:{h1:35,h2:25},"Cleaning Services":{h1:185,h2:200},Accounting:{h1:215,h2:230,sat:35},Dental:{h1:195,h2:210},"IT & Technology Services":{h1:250,h2:230},"Logistics & Supply Chain":{h1:215,h2:200},Photography:{h1:280,h2:260},"Moving & Relocation":{h1:25,h2:40},"Marketing & Advertising":{h1:320,h2:295},Pharmacy:{h1:145,h2:160},"Childcare & Education":{h1:50,h2:35},Roofing:{h1:15,h2:0},Landscaping:{h1:110,h2:140},HVAC:{h1:200,h2:215},Nonprofit:{h1:350,h2:330},Manufacturing:{h1:220,h2:215,sat:28},"Spa & Wellness":{h1:165,h2:180},Plumbing:{h1:210,h2:225},"Music & Arts":{h1:290,h2:270},"Coworking & Office":{h1:240,h2:255},"Security Services":{h1:215,h2:220,sat:22},"Print & Signage":{h1:5,h2:20},Catering:{h1:30,h2:15},Storage:{h1:200,h2:215,sat:30},Tutoring:{h1:260,h2:280},"Electrical Services":{h1:48,h2:38}};function Y(a){const s=ee[a]??{h1:220,h2:240},m=s.sat??78;return`linear-gradient(135deg, hsl(${s.h1} ${m}% 58%), hsl(${s.h2} ${m}% 42%))`}function Q(a){return`hsl(${(ee[a]??{h1:220}).h1} 80% 50% / 0.35)`}function ra({open:a,onOpenChange:s,onSelectTemplate:m,onStartBlank:i}){const[r,u]=f.useState(""),[l,p]=f.useState(null),[x,h]=f.useState(null),n=f.useMemo(()=>[...new Set(O.map(d=>d.industry))],[]),c=r?O.filter(d=>d.name.toLowerCase().includes(r.toLowerCase())||d.description.toLowerCase().includes(r.toLowerCase())||d.industry.toLowerCase().includes(r.toLowerCase())||d.tags.some(b=>b.toLowerCase().includes(r.toLowerCase()))):O,w=x?c.filter(d=>d.industry===x):c,k=()=>{l&&(m(l),s(!1),p(null),u(""))};return e.jsx(ke,{open:a,onOpenChange:s,children:e.jsxs(Ce,{className:"max-w-6xl max-h-[92vh] p-0 gap-0 border-white/10 shadow-2xl overflow-hidden",style:{background:"linear-gradient(180deg, hsl(225 30% 9% / 0.96) 0%, hsl(225 25% 7% / 0.98) 100%)",backdropFilter:"blur(24px)",WebkitBackdropFilter:"blur(24px)"},children:[e.jsx("div",{"aria-hidden":!0,className:"absolute inset-0 pointer-events-none opacity-40",style:{background:"radial-gradient(800px 400px at 20% 0%, hsl(260 80% 50% / 0.18), transparent 60%), radial-gradient(600px 300px at 90% 100%, hsl(195 85% 50% / 0.15), transparent 55%)"}}),e.jsx(qe,{className:"relative px-7 pt-6 pb-5 border-b border-white/[0.06]",children:e.jsxs(Se,{className:"flex items-center gap-3 text-xl font-semibold text-white",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl shadow-lg",style:{background:"linear-gradient(135deg, hsl(260 80% 60%), hsl(290 75% 55%))",boxShadow:"0 6px 18px hsl(275 70% 45% / 0.45), inset 0 1px 0 rgba(255,255,255,0.2)"},children:e.jsx(W,{className:"h-5 w-5 text-white"})}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[15px] font-semibold tracking-tight",children:"Choose a Template"}),e.jsxs(_e,{className:"text-[12px] text-white/55 mt-0.5 font-normal",children:["Industry-tuned chatbots with built-in lead capture â ",O.length," templates across ",n.length," industries"]})]})]})}),e.jsxs("div",{className:"relative flex flex-1 overflow-hidden min-h-0",style:{height:"calc(92vh - 110px)"},children:[e.jsxs("div",{className:"w-[58%] border-r border-white/[0.06] flex flex-col",children:[e.jsxs("div",{className:"p-4 space-y-3 border-b border-white/[0.06]",children:[e.jsxs("div",{className:"relative",children:[e.jsx(re,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-white/40"}),e.jsx(Z,{placeholder:"Search templates by name, industry or keyword...",value:r,onChange:d=>{u(d.target.value),h(null)},className:"pl-9 h-9 bg-white/[0.04] border-white/10 text-white placeholder:text-white/35 focus:border-white/25 focus:ring-0"})]}),e.jsxs("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto",children:[e.jsx("button",{onClick:()=>h(null),className:`text-[11px] px-2.5 py-1 rounded-full transition-all ${x===null?"bg-white text-black font-medium shadow-md":"bg-white/[0.05] text-white/70 hover:bg-white/[0.1] border border-white/10"}`,children:"All"}),n.map(d=>{const b=x===d;return e.jsx("button",{onClick:()=>h(b?null:d),className:`text-[11px] px-2.5 py-1 rounded-full transition-all border ${b?"text-white font-medium border-transparent shadow-md":"bg-white/[0.04] text-white/65 hover:bg-white/[0.09] border-white/10"}
70`,style:b?{background:Y(d),boxShadow:`0 4px 14px ${Q(d)}`}:void 0,children:d},d)})]})]}),e.jsx(Fe,{className:"flex-1",children:e.jsxs("div",{className:"p-3 space-y-2",children:[e.jsx("button",{onClick:()=>{i(),s(!1)},className:"w-full text-left p-3 rounded-xl border border-dashed border-white/15 hover:border-white/30 hover:bg-white/[0.04] transition-all group",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-11 h-11 rounded-xl flex items-center justify-center shrink-0",style:{background:"linear-gradient(135deg, hsl(0 0% 25%), hsl(0 0% 15%))",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.08)"},children:e.jsx(tt,{className:"h-5 w-5 text-white/70 group-hover:text-white transition-colors"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"text-sm font-semibold text-white",children:"Start from Scratch"}),e.jsx("p",{className:"text-[11px] text-white/50 mt-0.5",children:"Build your own custom flow with the visual editor"})]}),e.jsx(oe,{className:"h-4 w-4 text-white/30 group-hover:text-white/70 group-hover:translate-x-0.5 transition-all"})]})}),w.map(d=>{var N,v;const b=(l==null?void 0:l.id)===d.id,S=Y(d.industry),y=Q(d.industry);return e.jsx("button",{onClick:()=>p(d),className:`w-full text-left p-3 rounded-xl border transition-all group ${b?"border-white/25 bg-white/[0.06]":"border-white/[0.06] hover:border-white/15 hover:bg-white/[0.03]"}`,style:b?{boxShadow:`0 0 0 1px ${y}, 0 8px 24px ${y}`}:void 0,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"w-11 h-11 rounded-xl flex items-center justify-center text-xl shrink-0 transition-transform group-hover:scale-105",style:{background:S,boxShadow:`0 6px 16px ${y}, inset 0 1px 0 rgba(255,255,255,0.18)`},children:e.jsx("span",{className:"drop-shadow-sm",children:d.icon})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h4",{className:"text-sm font-semibold text-white truncate",children:d.name}),e.jsx("p",{className:"text-[11px] text-white/55 line-clamp-1 mt-0.5",children:d.description}),e.jsxs("div",{className:"flex items-center gap-2 mt-1.5",children:[e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-md text-white/85 font-medium",style:{background:`linear-gradient(135deg, hsl(${((N=ee[d.industry])==null?void 0:N.h1)??220} 60% 30% / 0.8), hsl(${((v=ee[d.industry])==null?void 0:v.h2)??240} 60% 22% / 0.8))`,border:`1px solid ${y}`},children:d.industry}),e.jsxs("span",{className:"text-[10px] text-white/40 flex items-center gap-1",children:[e.jsx(Qe,{className:"h-2.5 w-2.5"}),d.nodes.length," nodes"]})]})]})]})},d.id)}),w.length===0&&e.jsxs("div",{className:"py-12 text-center text-white/40",children:[e.jsx(re,{className:"h-8 w-8 mx-auto mb-2 opacity-30"}),e.jsxs("p",{className:"text-sm",children:["No templates found",r?` for "${r}"`:""]}),e.jsx("p",{className:"text-xs mt-1 text-white/30",children:"Try a different search or filter"})]})]})})]}),e.jsx("div",{className:"w-[42%] flex flex-col",children:l?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative px-6 pt-6 pb-5 border-b border-white/[0.06] overflow-hidden",style:{background:`linear-gradient(135deg, ${Q(l.industry)}, transparent 70%)`},children:[e.jsx("div",{"aria-hidden":!0,className:"absolute -top-10 -right-10 w-40 h-40 rounded-full blur-3xl op
70acity-50 pointer-events-none",style:{background:Y(l.industry)}}),e.jsxs("div",{className:"relative flex items-start gap-4",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center text-3xl shrink-0",style:{background:Y(l.industry),boxShadow:`0 10px 30px ${Q(l.industry)}, inset 0 1px 0 rgba(255,255,255,0.2)`},children:e.jsx("span",{className:"drop-shadow",children:l.icon})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-semibold text-lg text-white",children:l.name}),e.jsx("p",{className:"text-xs text-white/60 mt-0.5",children:l.industry})]})]})]}),e.jsx(Fe,{className:"flex-1",children:e.jsxs("div",{className:"p-6 space-y-5",children:[e.jsx("p",{className:"text-sm text-white/75 leading-relaxed",children:l.description}),e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsx(ne,{icon:Qe,label:"Nodes",value:l.nodes.length}),e.jsx(ne,{icon:gt,label:"Steps",value:l.edges.length}),e.jsx(ne,{icon:yt,label:"Capture",value:l.nodes.some(d=>{var b,S,y;return(y=(S=(b=d.data)==null?void 0:b.mapsToField)==null?void 0:S.startsWith)==null?void 0:y.call(S,"contact.")})?"Yes":"â"})]}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-[10px] font-semibold text-white/50 uppercase tracking-wider mb-2",children:"Tags"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:l.tags.map(d=>e.jsx(L,{variant:"outline",className:"text-[10px] bg-white/[0.04] border-white/10 text-white/70",children:d},d))})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"text-[10px] font-semibold text-white/50 uppercase tracking-wider mb-2 flex items-center gap-1.5",children:[e.jsx(z,{className:"h-3 w-3"}),"AI Personality"]}),e.jsxs("div",{className:"rounded-xl p-3.5 text-xs text-white/70 border border-white/[0.06] max-h-40 overflow-auto leading-relaxed",style:{background:"rgba(255,255,255,0.025)"},children:[l.personalityPrompt.split(` 71`).slice(0,5).join(` 72`),l.personalityPrompt.split(` 73`).length>5&&"..."]})]})]})}),e.jsx("div",{className:"p-4 border-t border-white/[0.06]",children:e.jsxs(q,{onClick:k,className:"w-full gap-2 h-10 text-white font-semibold border-0",style:{background:Y(l.industry),boxShadow:`0 8px 22px ${Q(l.industry)}, inset 0 1px 0 rgba(255,255,255,0.2)`},children:["Use This Template",e.jsx(oe,{className:"h-4 w-4"})]})})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center p-6",children:e.jsxs("div",{className:"text-center text-white/40",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl mx-auto mb-3 flex items-center justify-center",style:{background:"linear-gradient(135deg, hsl(260 50% 30% / 0.4), hsl(220 50% 25% / 0.4))",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.08)"},children:e.jsx(W,{className:"h-6 w-6 text-white/50"})}),e.jsx("p",{className:"text-sm font-medium text-white/70",children:"Select a template to preview"}),e.jsx("p",{className:"text-xs mt-1 text-white/40",children:"or start from scratch"})]})})})]})]})})}function ne({icon:a,label:s,value:m}){return e.jsxs("div",{className:"rounded-xl p-2.5 border border-white/[0.06]",style:{background:"rgba(255,255,255,0.025)"},children:[e.jsx(a,{className:"h-3.5 w-3.5 text-white/50 mb-1.5"}),e.jsx("div",{className:"text-sm font-semibold text-white",children:m}),e.jsx("div",{className:"text-[10px] text-white/45",children:s})]})}function la({open:a,onOpenChange:s,triggerReason:m="upgrade"}){const{subscription:i,usage:r,getCheckoutProduct:u,isLoading:l,refetch:p}=V(),[x,h]=f.useState(!1),[n,c]=f.useState(null),w=(i==null?void 0:i.tier)||"free",k=y=>{const N=u(y);c(N),h(!0)},d=()=>{_.success("AI subscription activated!"),p(),s(!1)},b=[{id:"starter",icon:W,popular:!1},{id:"pro",icon:tt,popular:!0},{id:"enterprise",icon:Tt,popular:!1}],S={agent_limit:"You've reached your AI agent limit. Upgrade to create more agents.",conversation_limit:"You've used all your conversations this month. Upgrade for more.",upgrade:"Unlock the full power of AI agents with a premium plan."};return e.jsxs(ke,{open:a,onOpenChange:s,children:[e.jsxs(Ce,{className:"max-w-4xl",children:[e.jsxs(qe,{children:[e.jsxs(Se,{className:"text-2xl flex items-center gap-2",children:[e.jsx(W,{className:"h-6 w-6 text-primary"}),"Upgrade Your AI Agents"]}),e.jsx(_e,{children:S[m]})]}),r&&e.jsxs("div",{className:"flex gap-4 p-4 bg-muted rounded-lg mb-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl font-bold",children:r.activeAgents}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Active Agents"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl font-bold",children:r.conversationsUsed}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Conversations Used"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl font-bold capitalize",children:w}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Current Plan"})]})]}),e.jsx("div",{className:"grid md:grid-cols-3 gap-4",children:b.map(({id:y,icon:N,popular:v})=>{const g=Pt[y],o=w===y,P=w==="enterprise"||w==="pro"&&y==="starter";return e.jsxs(G,{className:A("relative",v&&"border-primary shadow-lg",o&&"bg-primary/5 border-primary"),children:[v&&e.jsx(L,{className:"absolute -top-3 left-1/2 -translate-x-1/2",children:"Most Popular"}),o&&e.jsx(L,{variant:"secondary",className:"absolute -top-3 left-1/2 -translate-x-1/2",children:"Current Plan"}),e.jsxs(xe,{className:"text-center pb-2",children:[e.jsx("div",{className:"mx-auto mb-2 p-3 rounded-full bg-primary/10",children:e.jsx(N,{className:"h-6 w-6 text-primary"})}),e.jsx(ve,{children:g.name}),e.jsxs(we,{children:[e.jsxs("span",{className:"text-3xl font-bold text-foreground",children:["£",g.price]}),e.jsx("span",{className:"text-muted-foreground",children:"/month"})]})]}),e.jsxs(K,{className:"space-y-4",children:[e.jsx("ul",{className:"space-y-2",children:g.features.map((F,R)=>e.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[e.jsx(X,{className:"h-4 w-4 text-green-500 shrink-0"}),F]},R))}),e.jsx(q,{className:"w-full",variant:v?"default":"outline",disabled:o||P||l,onClick:()=>k(y),children:o?"Current Plan":P?"Contact Support":"Upgrade Now"})]})]},y)})}),e.jsx("p",{className:"text-center text-sm text-muted-foreground mt-4",children:"All plans include a 7-day money-back guarantee. Cancel anytime."})]}),e.jsx(Qt,{open:x,onOpenChange:h,product:n,onSuccess:d})]})}function ca(){const{usage:a,limits:s,remaining:m,isUnlimited:i,subscription:r}=V(),u=f.useRef({conversationAlertShown:"none",agentAlertShown:"none"}),l=f.useCallback((h,n)=>{if(n<=0)return"safe";const c=h/n*100;return c>=100?"blocked":c>=90?"critical":c>=75?"warning":"safe"},[]),p=f.useCallback((h,n)=>{if(n<=0)return"bg-primary";const c=h/n*100;return c>=90?"bg-destructive":c>=75?"bg-amber-500":c>=50?"bg-yellow-500":"bg-primary"},[]),x=f.useCallback((h,n)=>{if(n<=0)return"";const c=h/n*100;return c>=90?"[&>div]:bg-destructive":c>=75?"[&>div]:bg-amber-500":c>=50?"[&>div]:bg-yellow-500":""},[]);return f.useEffect(()=>{if(i||!a||!s)return;const h=a.conversationsUsed||0,n=s.maxConversations||100,c=l(h,n),w=(m==null?void 0:m.conversations)??0;c!=="safe"&&c!==u.current.conversationAlertShown&&(c==="blocked"&&u.current.conversationAlertShown!=="blocked"?(_.error("Monthly conversation limit reached!",{description:"Upgrade your plan to continue using AI agents.",duration:1e4,action:{label:"Upgrade Now",onClick:()=>window.dispatchEvent(new CustomEvent("open-ai-paywall"))}}),u.current.conversationAlertShown="blocked"):c==="critical"&&u.current.conversationAlertShown==="none"?(_.warning(`Only ${w} conversations remaining!`,{description:"You're approaching your monthly limit. Consider upgrading.",duration:8e3,action:{label:"Upgrade",onClick:()=>window.dispatchEvent(new CustomEvent("open-ai-paywall"))}}),u.current.conversationAlertShown="critical"):c==="warning"&&u.current.conversationAlertShown==="none"&&(_.info("75% of monthly conversations used",{description:`${w} conversations remaining this billing period.`,duration:6e3}),u.current.conversationAlertShown="warning"));const k=a.activeAgents||0,d=s.maxAgents||1;l(k,d)==="blocked"&&u.current.agentAlertShown!=="blocked"&&(_.error("Maximum AI agents reached!",{description:`You have ${k}/${d} agents. Upgrade for more.`,duration:1e4,action:{label:"Upgrade",onClick:()=>window.dispatchEvent(new CustomEvent("open-ai-paywall"))}}),u.current.agentAlertShown="blocked")},[a,s,m,i,l]),f.useEffect(()=>{r!=null&&r.tier&&(u.current={conversationAlertShown:"none",agentAlertShown:"none"})},[r==null?void 0:r.tier]),{getUsageLevel:l,getUsageColor:p,getProgressColor:x,conversationLevel:a&&s?l(a.conversationsUsed||0,s.maxConversations||100):"safe",agentLevel:a&&s?l(a.activeAgents||0,s.maxAgents||1):"safe"}}function da({onUpgradeClick:a,compact:s=!1}){const{subscription:m,limits:i,usage:r,remaining:u,isUnlimited:l,isLoading:p}=V(),{getProgressColor:x,conversationLevel:h,agentLevel:n}=ca();if(p)return e.jsx("div",{className:A("animate-pulse bg-muted rounded-lg",s?"h-8":"h-20")});if(l)return e.jsxs("div",{className:A("flex items-center gap-2 p-3 bg-primary/10 rounded-lg border border-primary/20",s&&"p-2"),children:[e.jsx(W,{className:"h-4 w-4 text-primary"}),e.jsx("span",{className:"text-sm font-medium",children:"Enterprise Plan - Unlimited Usage"})]});const c=(r==null?void 0:r.conversationsUsed)||0,w=(i==null?void 0:i.maxConversations)||100,k=Math.min(c/w*100,100),d=(r==null?void 0:r.activeAgents)||0,b=(i==null?void 0:i.maxAgents)||0,S=b>0?Math.min(d/b*100,100):0,y=h!=="safe"||n!=="safe",N=h==="blocked"||n==="blocked",v=h==="critical"||n==="critical",g=()=>N?e.jsxs(L,{variant:"destructive",className:"gap-1",children:[e.jsx(Ze,{className:"h-3 w-3"}),"Limit Reached"]}):v?e.jsxs(L,{variant:"outline",className:"gap-1 border-destructive text-destructive",children:[e.jsx(le,{className:"h-3 w-3"}),"Critical"]}):h==="warning"||n==="warning"?e.jsxs(L,{variant:"outline",className:"gap-1 border-amber-500 text-amber-500",children:[e.jsx(ft,{className:"h-3 w-3"}),"75% Used"]}):null;return s?e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs mb-1",children:[e.jsx("span",{className:"text-muted-foreground",children:"Conversations"}),e.jsxs("span",{className:A(h==="warning"&&"text-amber-500",h==="critical"&&"text-orange-500",h==="blocked"&&"text-destructive"),children:[c,"/",w]})]}),e.jsx(ie,{value:k,className:A("h-1.5",x(c,w))})]}),(y||(m==null?void 0:m.tier)==="free")&&e.jsxs(q,{size:"sm",variant:N?"de
73structive":"outline",onClick:a,children:[e.jsx(W,{className:"h-3 w-3 mr-1"}),"Upgrade"]})]}):e.jsxs("div",{className:A("p-4 rounded-lg border space-y-4",N&&"border-destructive bg-destructive/5",v&&!N&&"border-orange-500 bg-orange-500/5",h==="warning"&&!v&&!N&&"border-amber-500 bg-amber-500/5"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(L,{variant:(m==null?void 0:m.tier)==="free"?"secondary":"default",className:"capitalize",children:[(m==null?void 0:m.tier)||"free"," Plan"]}),g()]}),e.jsxs(q,{size:"sm",variant:N?"destructive":"default",onClick:a,children:[e.jsx(W,{className:"h-4 w-4 mr-1"}),N?"Upgrade Now":"Upgrade"]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between text-sm mb-1",children:[e.jsx("span",{className:"text-muted-foreground",children:"Conversations this month"}),e.jsxs("span",{className:A("font-medium",h==="warning"&&"text-amber-500",h==="critical"&&"text-orange-500",h==="blocked"&&"text-destructive"),children:[c," / ",w]})]}),e.jsx(ie,{value:k,className:A("h-2",x(c,w))})]}),b>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between text-sm mb-1",children:[e.jsx("span",{className:"text-muted-foreground",children:"Active AI Agents"}),e.jsxs("span",{className:A("font-medium",n==="warning"&&"text-amber-500",n==="critical"&&"text-orange-500",n==="blocked"&&"text-destructive"),children:[d," / ",b]})]}),e.jsx(ie,{value:S,className:A("h-2",x(d,b))})]})]}),u&&e.jsx("p",{className:"text-xs text-muted-foreground",children:u.conversations===-1?"Unlimited conversations remaining":N?"Monthly limit reached. Upgrade to continue using AI agents.":`${u.conversations} conversations remaining this billing period`})]})}function ua({compact:a=!1,className:s}){const{billing:m,isLoading:i}=V(),r=Je();if(i||!m||m.isFree)return null;const u=m.estimatedMessagesRemaining,l=m.walletBalance,p=u<=0&&u!==-1,x=m.lowBalance;return!p&&!x?null:a?e.jsxs("div",{className:A("flex items-center gap-2 px-3 py-2 rounded-lg text-sm",p?"bg-destructive/10 text-destructive border border-destructive/20":"bg-amber-500/10 text-amber-600 border border-amber-500/20",s),children:[e.jsx(le,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:p?"AI credits depleted â top up to continue":`Low AI credits (~${u} messages left)`}),e.jsxs(q,{size:"sm",variant:p?"destructive":"outline",className:"shrink-0 h-7 text-xs",onClick:()=>r("/settings/billing"),children:[e.jsx(Ue,{className:"h-3 w-3 mr-1"}),"Top Up"]})]}):e.jsxs(Vt,{variant:p?"destructive":"default",className:A(!p&&"border-amber-500/50 bg-amber-500/5",s),children:[p?e.jsx(le,{className:"h-4 w-4"}):e.jsx(W,{className:"h-4 w-4"}),e.jsx(Ot,{children:p?"AI Credits Depleted":"Low AI Credits"}),e.jsxs(Gt,{className:"flex items-center justify-between gap-4",children:[e.jsx("span",{children:p?`Your wallet balance is £${l.toFixed(2)}. Top up to continue using AI agents.`:`You have approximately ${u} AI messages remaining (£${l.toFixed(2)} balance). Top up soon to avoid interruption.`}),e.jsxs(q,{size:"sm",variant:p?"destructive":"outline",onClick:()=>r("/settings/billing"),children:[e.jsx(Ue,{className:"h-4 w-4 mr-1"}),"Top Up Wallet"]})]})]})}const ma=f.lazy(()=>Ne(()=>import("./ChatbotAnalytics-DviTWs9p.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]))),pa=f.lazy(()=>Ne(()=>import("./ChatbotKnowledgeGaps-BP8z-wnW.js"),__vite__mapDeps([26,1,2,3,4,5,6,7,8,9,10,11,12,13,14,27]))),ha=f.lazy(()=>Ne(()=>import("./ChatbotHistory-DLsCrGyF.js"),__vite__mapDeps([28,1,2,3,4,5,6,7,8,9,10,11,12,13,14,21,29])));function Oa(){const a=Je(),s=Ke(),[m]=xt(),[i,r]=f.useState(null),[u,l]=f.useState(""),[p,x]=f.useState(!1),[h,n]=f.useState("upgrade"),[c,w]=f.useState(!1),[k,d]=f.useState(null),[b,S]=f.useState(!1),y=f.useRef(!1),[N,v]=f.useState(()=>m.get("tab")||"chatbots");f.useEffect(()=>{const j=m.get("tab");j&&j!==N&&v(j);const C=m.get("botId");C&&C!==i&&r(C)},[m]);const{chatbots:g,isLoading:o,createChatbot:P,deleteChatbot:F,updateChatbot:R,updateChatbotAsync:te}=Yt(),{workspace:T,loading:Ae}=et(),{user:D}=It(),{canCreateAgent:Te,trackUsage:Pe,subscription:I}=V();ct("chatbot",{"+ New Bot":()=>{if(!Te){n("agent_limit"),x(!0);return}w(!0)},Templates:()=>w(!0)}),dt("chatbot","AI Chatbots"),f.useEffect(()=>{(async()=>
73{if(!(y.current||Ae||o||!(T!=null&&T.id)||!(D!=null&&D.id)||b)){if(g&&g.length>0){y.current=!0;return}y.current=!0,S(!0);try{const C=T.name||"My Business";console.log(`[Chatbot] Auto-provisioning agent for workspace: ${T.id} (${C})`);const B=I!=null&&I.tier&&I.tier!=="free"?"active":"draft",nt=`You are a friendly and professional sales assistant for ${C}. Your primary goals are: 74 751. QUALIFY LEADS - Gather essential information: name, email, phone, and understand their needs 762. BOOK CALLBACKS - Schedule callback appointments at convenient times 773. BE HELPFUL - Answer basic questions about services using your knowledge base 78 79PERSONALITY: 80- Warm and professional 81- Efficient but not pushy 82- Focused on understanding the customer's needs 83- Always aim to capture contact details and book a callback 84 85IMPORTANT GUIDELINES: 86- Always collect name, email, and phone before ending any conversation 87- Qualify the lead's budget and timeline when appropriate 88- If someone has an urgent issue, escalate to a human immediately 89- Use the knowledge base to answer questions about services 90- Keep responses concise and focused`,{data:ot,error:He}=await H.from("chatbot_personalities").insert({workspace_id:T.id,name:`${C} Sales Agent`,description:"AI assistant for qualifying leads and booking callback appointments",system_prompt:nt,voice_tone:"professional",response_style:"balanced",greeting_message:`Hi there! ð Thanks for reaching out to ${C}! I'm here to help understand your needs and get you connected with our team.`,fallback_message:"I'm not sure I understand. Could you please rephrase that, or would you like me to connect you with a team member?",closing_message:"Thank you for chatting with us! We look forward to speaking with you soon.",emoji_enabled:!0,response_length:3,boundaries:{avoid_topics:["competitor pricing","internal processes"],escalate_topics:["complaints","urgent issues","complex questions"]},created_by:D.id}).select().single();if(He)throw He;const rt=Jt(C),{data:lt,error:Le}=await H.from("chatbots").insert({workspace_id:T.id,name:`${C} Sales Agent`,description:"Qualifies leads and books callback appointments automatically",personality_id:ot.id,status:B,flow_data:Zt(rt),settings:{channels:["web"],autoGreet:!0,collectAnalytics:!0,workingHours:{enabled:!1,timezone:"Europe/London"},handoffSettings:{enabled:!0,notifyTeam:!0,maxWaitTime:300},leadCapture:{enabled:!0,requiredFields:["name","email","phone"]}},created_by:D.id}).select().single();if(Le)throw Le;console.log(`[Chatbot] Created "${lt.name}" (status: ${B}) for workspace ${T.id}`),B==="draft"?_.success("Your AI Sales Agent has been created!",{description:"Upgrade to an AI subscription in Settings > Billing & Wallet to deploy it."}):_.success("Your AI Sales Agent is ready!"),s.invalidateQueries({queryKey:["chatbots",T.id]})}catch(C){console.error("[Chatbot] Provisioning error:",C)}finally{S(!1)}}})()},[T==null?void 0:T.id,T==null?void 0:T.name,Ae,o,g,D==null?void 0:D.id,b,I==null?void 0:I.tier]);const Ie=async()=>{if(!Te){n("agent_limit"),x(!0),_.error("Agent limit reached. Please upgrade your plan.");return}w(!0)},at=async()=>{const j=await P({name:"New Chatbot",description:"AI-powered assistant"});j&&(await Pe("agent"),r(j.id))},st=async j=>{const C=await P({name:j.name,description:j.description});C&&(await Pe("agent"),d(j),r(C.id))},it=async j=>{i&&await te({id:i,flow_data:{nodes:j.nodes,edges:j.edges},name:j.name})},We=(g==null?void 0:g.filter(j=>j.name.toLowerCase().includes(u.toLowerCase())))||[];if(g==null||g[0],b)return e.jsx(Ye,{children:e.jsxs("main",{className:"flex-1 p-6 flex items-center justify-center",children:[e.jsx(J,{className:"h-10 w-10 animate-spin text-primary mx-auto mb-4"}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Setting Up Your AI Chatbot"}),e.jsx("p",{className:"text-muted-foreground",children:"Creating your lead qualification bot..."})]})});if(i){const j=g==null?void 0:g.find(B=>B.id===i),C=k&&j?{...j,flow_data:{nodes:k.nodes,edges:k.edges}}:j;return k&&(R({id:i,flow_data:{nodes:k.nodes,edges:k.edges}}),d(null)),e.jsx(Et,{chatbot:C,onBack:()=>r(null),onSave:it})}return e.jsxs(Ye,{children:[e.jsx(zt,{title:"AI Chatbots",description:"Build and manage AI-powered chatbots"}),e.jsxs("main",{className:"flex-1 p-6",children:[e.jsx(ua,{className:"mb-4"}),e.jsx("div",{className:"mb-6",children:e.jsx(da,{onUpgradeClick:()=>x(!0)})}),e.jsxs("div",{className:"mb-8",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold gradient-text",children:"AI Chatbot Builder"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Create intelligent conversational agents with our visual node builder"})]}),e.jsxs("div",{className:"flex gap-2 items-center",children:[e.jsxs(q,{variant:"outline",onClick:()=>a("/chatbot/analytics"),className:"gap-2",children:[e.jsx(ae,{className:"h-4 w-4"}),"Analytics"]}),e.jsxs(q,{variant:"outline",onClick:()=>a("/chatbot/monitor"),className:"gap-2",children:[e.jsx(Wt,{className:"h-4 w-4"}),"Live Monitor"]}),e.jsxs(q,{variant:"outline",onClick:()=>a("/chatbot/history"),className:"gap-2",children:[e.jsx(ze,{className:"h-4 w-4"}),"History"]}),(I==null?void 0:I.tier)==="free"&&e.jsxs(q,{variant:"outline",onClick:()=>x(!0),className:"gap-2 border-primary text-primary hover:bg-primary/10",children:[e.jsx(W,{className:"h-4 w-4"}),"Upgrade"]}),e.jsxs(q,{onClick:Ie,className:"gap-2",children:[e.jsx(Ut,{className:"h-4 w-4"}),"Create New Bot"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4 mb-6",children:[e.jsx("div",{className:"glass-card p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/20 flex items-center justify-center",children:e.jsx(z,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:(g==null?void 0:g.length)||0}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Bots"})]})]})}),e.jsx("div",{className:"glass-card p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-green-500/20 flex items-center justify-center",children:e.jsx(je,{className:"h-5 w-5 text-green-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:(g==null?void 0:g.filter(j=>j.status==="active").length)||0}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Active"})]})]})}),e.jsx("div",{className:"glass-card p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-yellow-500/20 flex items-center justify-center",children:e.jsx(ce,{className:"h-5 w-5 text-yellow-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:(g==null?void 0:g.filter(j=>j.status==="draft").length)||0}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Draft"})]})]})}),e.jsx("div",{className:"glass-card p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-500/20 flex items-center justify-center",children:e.jsx(Ve,{className:"h-5 w-5 text-purple-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:"CRM"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Integrated"})]})]})}),e.jsx("div",{className:"glass-card p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-cyan-500/20 flex items-center justify-center",children:e.jsx(ae,{className:"h-5 w-5 text-cyan-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold",children:(g==null?void 0:g.length)||0}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Conversations"})]})]})}),e.jsx("div",{className:"glass-card p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-emerald-500/20 flex items-center justify-center",children:e.jsx(W,{className:"h-5 w-5 text-emerald-500"})}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-2xl font-bold",children:[g!=null&&g.length?Math.round(g.reduce((j,C)=>{var B;return j+(((B=C.settings)==null?void 0:B.resolution_rate)||72)},0)/g.length):0,"%"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Avg Resolution"})]})]})})]})]}),e.jsxs(Ht,{value:N,onValueChange:v,className:"space-y-6",children:[e.jsxs(Lt,{children:[e.jsxs(E,{value:"chatbots",className:"gap-2",children:[e.jsx(z,{className:"h-4 w-4"}),"Chatbots"]}),e.jsxs(E,{value:"personalities",className:"gap-2",children:[e.jsx(Ve,{className:"h-4 w-4"}),"AI Personalities"]}),e.jsxs(E,{value:"shopify",className:"gap-2",children:[e.jsx(be,{className:"h-4 w-4"}),"Shopify Products"]}),e.jsxs(E,{value:"analytics",className:"gap-2",children:[e.jsx(ae,{className:"h-4 w-4"}),"Analytics"]}),e.jsxs(E,{value:"knowledge-gaps",className:"gap-2",children:[e.jsx(Dt,{className:"h-4 w-4"}),"Knowledge Gaps"]}),e.jsxs(E,{value:"history",className:"gap-2",children:[e.jsx(ze,{className:"h-4 w-4"}),"History"]})]}),e.jsx(M,{value:"analytics",children:e.jsx($,{title:"Analytics failed to load",children:e.jsx(f.Suspense,{fallback:null,children:e.jsx(ma,{})})})}),e.jsx(M,{value:"knowledge-gaps",children:e.jsx($,{title:"Knowledge gaps failed to load",children:e.jsx(f.Suspense,{fallback:null,children:e.jsx(pa,{})})})}),e.jsx(M,{value:"history",children:e.jsx($,{title:"History failed to load",children:e.jsx(f.Suspense,{fallback:null,children:e.jsx(ha,{})})})}),e.jsx(M,{value:"personalities",children:e.jsx($,{title:"Personalities failed to load",children:e.jsx(Mt,{})})}),e.jsxs(M,{value:"chatbots",className:"space-y-6",children:[e.jsxs("div",{className:"relative max-w-md",children:[e.jsx(re,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(Z,{placeholder:"Search chatbots...",value:u,onChange:j=>l(j.target.value),className:"pl-10"})]}),e.jsx($,{title:"Chatbots failed to load",children:!o&&We.length===0&&!u?e.jsx(Kt,{onAction:Ie}):e.jsx(ea,{chatbots:We,isLoading:o,onSelect:r,onDelete:F,onStatusChange:(j,C)=>R({id:j,status:C})})})]}),e.jsx(M,{value:"shopify",children:e.jsx($,{title:"Shopify integration failed to load",children:e.jsx(na,{})})})]}),e.jsx(la,{open:p,onOpenChange:x,triggerReason:h}),e.jsx(ra,{open:c,onOpenChange:w,onSelectTemplate:st,onStartBlank:at})]})]})}export{Oa 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.