PageSourceSearch

https://youthfireit.com/assets/app.onboarding-BB_CxnvR.js

js youthfireit.com collected 2026-10-05 02:43:50 UTC 13,510 bytes, 1 lines download raw bytes

1import{j as e}from"./radix-C7m_p3hd.js";import{t as x,d as f,u as te,a as re,k as ne,dv as oe,bS as ie,s as g}from"./index-QwT9_GrP.js";import{l as q,K as le,C as de,a as n,q as ce,af as U,ag as me,X as pe,at as D,x as O,B as ue,a7 as xe,s as he,A as ge}from"./icons-Byb5nA6I.js";import{C as fe,a as ye}from"./card-WJomPFy5.js";import{B as X}from"./button-aZOsfQvV.js";import{I as k}from"./input-BDda6t1w.js";import{L as u}from"./label-Cywe519D.js";import{T as je}from"./textarea-DIbiZgd6.js";import{P as be}from"./progress-Cg6BAPDU.js";import{b as Ne}from"./upload-adapters-BD5cyHR-.js";import"./pdf-BQaX5Z90.js";import"./editor-BVBPyX6q.js";import"./charts-CkbpeChh.js";import"./index-DpFz0cJn.js";import"./uploads-client-C3ba_q2K.js";function we({whatsapp:r,setWhatsapp:y,phone:a,setPhone:c,calendly:i,setCalendly:m}){return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Connect your channels"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Tell us where your customers reach you so we can connect your AI agents."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(u,{htmlFor:"whatsapp",className:"flex items-center gap-2",children:[e.jsx(q,{className:"h-4 w-4 text-primary-strong"})," WhatsApp Business number"]}),e.jsx(k,{id:"whatsapp",value:r,onChange:p=>y(p.target.value),placeholder:"+880 1XXX-XXXXXX"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(u,{htmlFor:"phone",className:"flex items-center gap-2",children:[e.jsx(le,{className:"h-4 w-4 text-primary-strong"})," Phone number"]}),e.jsx(k,{id:"phone",value:a,onChange:p=>c(p.target.value),placeholder:"+880 2-XXXXXXXX"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(u,{htmlFor:"calendly",className:"flex items-center gap-2",children:[e.jsx(de,{className:"h-4 w-4 text-primary-strong"})," Calendly / booking link (optional)"]}),e.jsx(k,{id:"calendly",value:i,onChange:p=>m(p.target.value),placeholder:"https://calendly.com/your-name"})]})]})}function ve({companyId:r,userId:y,files:a,setFiles:c}){const[i,m]=n.useState(!1),[p,b]=n.useState(!1),j=n.useCallback(async o=>{if(!o||o.length===0)return;if(!r){x.error("Company must be created first.");return}m(!0);const d=[];for(const l of Array.from(o)){if(l.size>10*1024*1024){x.error(`${l.name} exceeds 10 MB limit.`);continue}try{const h=await Ne(l,r);d.push({name:h.name,storagePath:h.path,type:l.type,size:h.size})}catch(h){x.error(`Upload failed: ${l.name}`),console.error(h);continue}}d.length>0&&(c([...a,...d]),x.success(`${d.length} file(s) uploaded.`)),m(!1)},[r,a,c]),I=o=>{c(a.filter((d,l)=>l!==o))};return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Upload knowledge base"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Drop FAQ documents, product lists, or process docs. Your AI agents will use these to answer questions."})]}),e.jsx("div",{onDragOver:o=>{o.preventDefault(),b(!0)},onDragLeave:()=>b(!1),onDrop:o=>{o.preventDefault(),b(!1),j(o.dataTransfer.files)},className:f("flex flex-col items-center justify-center gap-2 rounded-xl border-2 border-dashed p-8 text-center transition-colors",p?"border-primary bg-primary/5":"border-border"),children:i?e.jsx(ce,{className:"h-8 w-8 animate-spin text-muted-foreground"}):e.jsxs(e.Fragment,{children:[e.jsx(U,{className:"h-8 w-8 text-muted-foreground"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Drag & drop files here, or"," ",e.jsxs("label",{className:"cursor-pointer font-medium text-primary-strong underline-offset-2 hover:underline",children:["browse",e.jsx("input",{type:"file",multiple:!0,className:"hidden",accept:".pdf,.doc,.docx,.txt,.csv,.xlsx,.xls",onChange:o=>j(o.target.files)})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"PDF, DOC, TXT, CSV, XLS — max 10 MB each"})]})}),a.length>0&&e.jsx("ul",{className:"space-y-2",children:a.map((o,d)=>e.jsxs("li",{className:"flex items-center justify-between rounded-md border border-border px-3 py-2 text-sm",children:[e.jsxs("span",{className:"flex items-center gap-2 truncate",children:[e.jsx(me,{className:"h-4 w-4 shrink-0 text-primary-strong"}),o.name]}),e.jsx(X,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>I(d),children:e.jsx(pe,{className:"h-3 w-3"})})]},d))})]})}const Ce=[{id:"professional",label:"Professional",desc:"Formal, polished replies"},{id:"friendly",label:"Friendly",desc:"Warm and conversational"},{id:"concise",label:"Concise",desc:"Short, to-the-point answers"},{id:"bangla-mix",label:"Banglish",desc:"Bangla-English code-mixed"}];function Se({agentName:r,setAgentName:y,agentTone:a,setAgentTone:c}){return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold",children:"Configure your AI agent"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Give your agent a name and personality. You can change these anytime later."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(u,{htmlFor:"agentName",className:"flex items-center gap-2",children:[e.jsx(D,{className:"h-4 w-4 text-primary-strong"})," Agent name"]}),e.jsx(k,{id:"agentName",value:r,onChange:i=>y(i.target.value),placeholder:"e.g. Ayesha, BizBot, SupportGPT"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{children:"Voice & tone"}),e.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:Ce.map(i=>{const m=a===i.id;return e.jsxs("button",{type:"button",onClick:()=>c(i.id),className:f("flex items-center justify-between rounded-md border px-3 py-2.5 text-left text-sm transition-colors",m?"border-primary bg-primary/5 text-foreground":"border-border hover:bg-muted"),children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:i.label}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i.desc})]}),m&&e.jsx(O,{className:"h-4 w-4 shrink-0 text-primary-strong"})]},i.id)})})]}),e.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Preview"}),e.jsxs("div",{className:"mt-3 flex items-start gap-3",children:[e.jsx("div",{className:"grid h-8 w-8 shrink-0 place-items-center rounded-full bg-primary text-primary-foreground",children:e.jsx(D,{className:"h-4 w-4"})}),e.jsxs("div",{className:"rounded-lg bg-card p-3 text-sm shadow-sm",children:["Hi! I'm ",e.jsx("strong",{children:r||"your AI agent"}),". How can I help you today?"]})]})]})]})}const R=[{id:1,label:"Company",icon:ue},{id:2,label:"Goals",icon:xe},{id:3,label:"Channels",icon:q},{id:4,label:"Knowledge",icon:U},{id:5,label:"Agent",icon:D},{id:6,label:"Review",icon:he}],T=R.length;function Ue(){const{user:r}=te(),y=re(),[a,c]=n.useState(1),[i,m]=n.useState(!1),[p,b]=n.useState(),{data:j=ie}=ne(oe()),I=j.industries,o=j.sizes,d=j.focus_areas,[l,h]=n.useState(""),[N,K]=n.useState(""),[w,L]=n.useState(""),[v,$]=n.useState([]),[z,G]=n.useState(""),[A,M]=n.useState(""),[F,Y]=n.useState(""),[P,Q]=n.useState(""),[C,H]=n.useState([]),[S,V]=n.useState(""),[_,Z]=n.useState("friendly"),J=s=>$(t=>t.includes(s)?t.filter(B=>B!==s):[...t,s]),ee=a===1&&l.trim()&&N&&w||a===2&&v.length>0||a===3||a===4||a===5&&S.trim()&&_||a===6,E=async()=>
1{if(!r)return;const{data:s}=await g.from("companies").select("id").eq("owner_id",r.id).maybeSingle();let t=s?.id;if(t)await g.from("companies").update({name:l,industry:N,size:w}).eq("id",t);else{const{data:B,error:W}=await g.from("companies").insert({name:l,industry:N,size:w,owner_id:r.id}).select("id").single();if(W)throw W;t=B.id}return b(t),t&&await g.from("company_users").upsert({company_id:t,user_id:r.id,is_primary:!0,role:"owner"},{onConflict:"company_id,user_id"}),t},se=async()=>{if(a===1)try{await E()}catch{x.error("Could not save company info.");return}c(s=>s+1)},ae=async()=>{if(!r){x.error("Please sign in to continue.");return}m(!0);try{const s=p||await E();if(!s)throw new Error("Company not created");await g.from("companies").update({whatsapp_number:A||null,phone_number:F||null,calendly_link:P||null,agent_name:S,agent_tone:_,onboarding_step:T}).eq("id",s),C.length>0&&await g.from("knowledge_files").insert(C.map(t=>({company_id:s,file_name:t.name,storage_path:t.storagePath,file_type:t.type,size_bytes:t.size,uploaded_by:r.id}))),await g.from("activities").insert({company_id:s,actor_id:r.id,entity_type:"company",entity_id:s,action:"created",summary:`Onboarding completed — focus: ${v.join(", ")||"n/a"}, agent: ${S}`,metadata:{focus:v,goals:z,agentTone:_,channels:{whatsapp:A,phone:F,calendly:P},filesUploaded:C.length}}),x.success("Welcome aboard! We'll be in touch within one business day."),y({to:"/app"})}catch(s){console.error(s),x.error("Something went wrong. Please try again.")}finally{m(!1)}};return e.jsxs("div",{className:"mx-auto max-w-2xl space-y-8",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Welcome to YouthFireIT"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"A few quick steps so we can set up your AI workforce."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 overflow-x-auto text-xs font-medium text-muted-foreground",children:[R.map(s=>e.jsxs("div",{className:f("flex shrink-0 items-center gap-1.5",a>=s.id?"text-foreground":"text-muted-foreground/60"),children:[e.jsx("span",{className:f("grid h-6 w-6 place-items-center rounded-full border text-[10px]",a>s.id?"border-primary bg-primary text-primary-foreground":a===s.id?"border-primary text-primary-strong":"border-border"),children:a>s.id?e.jsx(O,{className:"h-3 w-3"}):s.id}),e.jsx("span",{className:"hidden sm:inline",children:s.label})]},s.id)),e.jsxs("span",{className:"ml-auto shrink-0",children:["Step ",a," of ",T]})]}),e.jsx(be,{value:a/T*100})]}),e.jsx(fe,{children:e.jsxs(ye,{className:"space-y-5 p-6",children:[a===1&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"company",children:"Company name"}),e.jsx(k,{id:"company",value:l,onChange:s=>h(s.target.value),placeholder:"Acme Ltd."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{children:"Industry"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:I.map(s=>e.jsx("button",{type:"button",onClick:()=>K(s),className:f("rounded-full border px-3 py-1.5 text-xs font-medium transition-colors",N===s?"border-primary bg-primary text-primary-foreground":"border-border hover:bg-muted"),children:s},s))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{children:"Team size"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:o.map(s=>e.jsx("button",{type:"button",onClick:()=>L(s),className:f("rounded-full border px-3 py-1.5 text-xs font-medium transition-colors",w===s?"border-primary bg-primary text-primary-foreground":"border-border hover:bg-muted"),children:s},s))})]})]}),a===2&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{children:"Where do you want AI to help first?"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Pick all that apply."}),e.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:d.map(s=>{const t=v.includes(s.id);return e.jsxs("button",{type:"button",onClick:()=>J(s.id),className:f("flex items-center justify-between rounded-md border px-3 py-2.5 text-left text-sm transition-colors",t?"border-primary bg-primary/5 text-foreground":"border-border hover:bg-muted"),children:[e.jsx("span",{children:s.label}),t&&e.jsx(O,{className:"h-4 w-4 text-primary-strong"})]},s.id)})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{htmlFor:"goals",children:"What's the #1 outcome you want this quarter? (optional)"}),e.jsx(je,{id:"goals",value:z,onChange:s=>G(s.target.value),placeholder:"e.g. Cut order-status replies by 80% on WhatsApp.",rows:3})]})]}
1),a===3&&e.jsx(we,{whatsapp:A,setWhatsapp:M,phone:F,setPhone:Y,calendly:P,setCalendly:Q}),a===4&&e.jsx(ve,{companyId:p,userId:r?.id??"",files:C,setFiles:H}),a===5&&e.jsx(Se,{agentName:S,setAgentName:V,agentTone:_,setAgentTone:Z}),a===6&&e.jsxs("div",{className:"space-y-4 text-sm",children:[e.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-4",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Summary"}),e.jsx("dl",{className:"mt-3 grid gap-2 text-sm",children:[["Company",l],["Industry",N],["Team size",w],["Focus areas",v.map(s=>d.find(t=>t.id===s)?.label).filter(Boolean).join(", ")],["WhatsApp",A],["Phone",F],["Knowledge files",`${C.length} file(s)`],["Agent name",S],["Agent tone",_]].map(([s,t])=>e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("dt",{className:"text-muted-foreground",children:s}),e.jsx("dd",{className:"font-medium text-right",children:t||"—"})]},s))})]}),e.jsx("p",{className:"text-muted-foreground",children:"We'll review your answers and reach out within one business day with a tailored recommendation."})]})]})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(X,{variant:"ghost",onClick:()=>c(s=>Math.max(1,s-1)),disabled:a===1||i,children:"Back"}),a<T?e.jsxs(X,{onClick:se,disabled:!ee,children:["Continue ",e.jsx(ge,{className:"h-4 w-4"})]}):e.jsx(X,{onClick:ae,disabled:i,children:i?"Saving...":"Finish onboarding"})]})]})}export{Ue as component};

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.