PageSourceSearch

https://itsbraingraph.ai/assets/settings-BCvF1bIC.js

js itsbraingraph.ai collected 2026-10-05 14:11:45 UTC 15,816 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BEp_fL1u.js","assets/index-QHIo9y4G.css"])))=>i.map(i=>d[i]);
2import{H as de,o as be,a as Ne,g as we,ac as Ce,b as Ae,h as ke,m as c,s as De,c as m,e as d,aU as Pe,L as x,j as W,C as Se,f as Te,d as Le,i as Be,Z as Ue,r as h,I as p,T as Z,B as V,l as T,_ as J}from"./index-BEp_fL1u.js";import{r,j as e}from"./markdown-Czq4JQ7n.js";import{C as f,b as g,c as j,a as y,d as X}from"./card-DLnJOhqy.js";import{P as ee}from"./progress-UtxBAvue.js";import{A as se,a as te,b as ae,c as re,d as ne,e as le,f as ie,g as oe}from"./alert-dialog-DhKujlU6.js";import{E as Ee}from"./external-link-DmhtyeB0.js";import{B as Oe}from"./briefcase-BIFPHWe3.js";import{T as Re}from"./triangle-alert-T3Y3AzwV.js";import{T as ce}from"./trash-2-Bhx__HYL.js";import"./supabase-stLXd1de.js";const _e=de("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);const Ie=de("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);function We(){const{user:v,signOut:L}=be(),{toast:n}=Ne(),b=we(),ue=Ce(),{data:t,isLoading:me}=Ae(),[N,B]=r.useState(""),[w,U]=r.useState(""),[C,E]=r.useState(""),[A,O]=r.useState(""),[k,R]=r.useState(""),[_,I]=r.useState(!1),[F,M]=r.useState(!1),[xe,D]=r.useState(!1),[he,Y]=r.useState(!1),[P,q]=r.useState(!1),[S,G]=r.useState(!1),[$,H]=r.useState(""),pe=async()=>{q(!0);try{const a=await(await T("POST","/api/account/clear-brain")).json();n({title:"Brain cleared",description:a.message??"Your knowledge graph has been wiped. Documents are kept."}),b.invalidateQueries(),D(!1)}catch(s){n({title:"Failed to clear brain",description:s.message,variant:"destructive"})}finally{q(!1)}},fe=async()=>{G(!0);try{await T("DELETE","/api/account"),n({title:"Account deleted",description:"Your account and all associated data have been permanently removed."}),await L()}catch(s){n({title:"Failed to delete account",description:s.message,variant:"destructive"}),G(!1)}};r.useEffect(()=>{const s=new URLSearchParams(ue),a=s.get("billing"),l=s.get("plan");if(a==="success"){n({title:`Welcome to ${l==="max"?"Max":"Pro"}!`,description:"Your subscription is now active."});const u=setInterval(()=>{b.invalidateQueries({queryKey:["/api/user/subscription"]})},2e3);setTimeout(()=>clearInterval(u),3e4),window.history.replaceState({},"","/settings")}else a==="canceled"&&(n({title:"Checkout canceled",description:"No charges were made."}),window.history.replaceState({},"","/settings"))},[]);const{data:i}=ke({queryKey:["business-profile"],queryFn:async()=>{const{getAuthToken:s}=await J(async()=>{const{getAuthToken:o}=await import("./index-BEp_fL1u.js").then(u=>u.bx);return{getAuthToken:o}},__vite__mapDeps([0,1])),a=await s(),l=await fetch("/api/user/business-profile",{headers:{Authorization:`Bearer ${a}`}});return l.ok?l.json():null}});r.useEffect(()=>{i&&(B(i.role||""),U(i.companyDescription||""),E(i.industry||""),O(i.businessGoals||""),R(i.additionalContext||""))},[i]);const ge=async()=>{I(!0);try{const{getAuthToken:s}=await J(async()=>{const{getAuthToken:o}=await import("./index-BEp_fL1u.js").then(u=>u.bx);return{getAuthToken:o}},__vite__mapDeps([0,1])),a=await s();if(!(await fetch("/api/user/business-profile",{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({role:N,companyDescription:w,industry:C,businessGoals:A,additionalContext:k})})).ok)throw new Error("Failed to save profile");b.invalidateQueries({queryKey:["business-profile"]}),n({title:"Business profile saved successfully"})}catch(s){n({title:"Error",description:s.message,variant:"destructive"})}finally{I(!1)}},je=async()=>{M(!0);try{const a=await(await T("POST","/api/stripe/create-portal")).json();a.url&&(window.location.href=a.url)}catch(s){n({title:"Error",description:s.message,variant:"destructive"}),M(!1)}},K=t?.plan==="pro"||t?.plan==="max",ye=t?.plan==="pro",Q=t?.plan==="max",z=!!t?.grantedUntil,ve=K&&t?.cancelAtPeriodEnd;return e.jsxs("div",{className:"p-6 lg:p-8 max-w-6xl mx-auto",children:[e.jsxs(c.div,{variants:De,initial:"initial",animate:"animate",className:"space-y-6",children:[e.jsxs(c.div,{variants:m,children:[e.jsx("h1",{className:"text-3xl font-bold",children:"Settings"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Manage your account, subscription, and profile"})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-5",children:[e.jsx(c.div,{variants:m,children:e.jsxs(f,{className:"rounded-3xl shadow-sm border-border/50 h-full",children:[e.jsx(g,{children:e.jsxs(j,{className:"flex items-center gap-2 text-base",children:[e.jsx("div",{className:"flex items-center justify-center h-8 w-8 rounded-xl bg-primary/10",children:e.jsx(Ie,{className:"h-4 w-4 text-primary"})}),"Account"]})}),e.jsx(y,{children:e.jsxs("div",{className:"flex flex-col items-start gap-3 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{className:"min-w-0 
2w-full sm:w-auto",children:[v?.user_metadata?.name&&e.jsx("p",{className:"text-lg font-semibold truncate",children:v.user_metadata.name}),e.jsx("p",{className:"text-sm font-medium truncate",children:v?.email}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Signed in"})]}),e.jsxs(d,{variant:"outline",onClick:()=>L(),className:"rounded-2xl shrink-0 w-full sm:w-auto",children:[e.jsx(Pe,{className:"h-4 w-4 mr-2"}),"Sign Out"]})]})})]})}),e.jsx(c.div,{variants:m,children:e.jsxs(f,{className:"rounded-3xl shadow-sm border-border/50 h-full",children:[e.jsx(g,{children:e.jsxs(j,{className:"flex items-center gap-2 text-base",children:[e.jsx("div",{className:"flex items-center justify-center h-8 w-8 rounded-xl bg-amber-500/10",children:e.jsx(_e,{className:"h-4 w-4 text-amber-500"})}),"Subscription"]})}),e.jsx(y,{children:me?e.jsx("div",{className:"flex items-center justify-center py-4",children:e.jsx(x,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):K?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(W,{className:`rounded-lg ${Q?"bg-purple-500/10 text-purple-600 border-purple-500/20":"bg-amber-500/10 text-amber-600 border-amber-500/20"}`,children:[e.jsx(Se,{className:"h-3 w-3 mr-1"})," ",Q?"Max":"Pro"]}),z&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(granted until ",new Date(t.grantedUntil).toLocaleDateString(),")"]})]}),t&&t.monthlyUploadLimit>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Documents this month"}),e.jsxs("span",{className:"font-medium",children:[t.monthlyUploadCount," of ",t.monthlyUploadLimit]})]}),e.jsx(ee,{value:t.monthlyUploadCount/t.monthlyUploadLimit*100,className:"h-2"}),t.monthlyUploadResetAt&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Resets on ",Te(t.monthlyUploadResetAt)," (",Le(t.monthlyUploadResetAt),")"]})]}),ve&&t?.currentPeriodEnd&&e.jsxs("p",{className:"text-sm text-amber-600",children:["Active until ",new Date(t.currentPeriodEnd).toLocaleDateString(),". You can resubscribe anytime."]}),!z&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(d,{variant:"outline",onClick:je,disabled:F,className:"rounded-2xl",children:[F&&e.jsx(x,{className:"mr-2 h-4 w-4 animate-spin"}),e.jsx(Ee,{className:"h-4 w-4 mr-2"}),"Manage Billing"]}),ye&&e.jsx(Be,{href:"/pricing",children:e.jsxs(d,{className:"rounded-2xl bg-purple-600 hover:bg-purple-700 text-white",children:[e.jsx(Ue,{className:"h-4 w-4 mr-2"}),"Upgrade to Max"]})})]})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(W,{variant:"secondary",className:"rounded-lg",children:"Free"})}),t&&t.freeUploadLimit>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Documents used"}),e.jsxs("span",{className:"font-medium",children:[t.totalUploadCount," of ",t.freeUploadLimit]})]}),e.jsx(ee,{value:t.totalUploadCount/t.freeUploadLimit*100,className:"h-2"})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t&&!t.canUpload?"You've used all your free documents. Upgrade to Pro for 60 new documents every month.":`Upload up to ${t?.freeUploadLimit??40} documents on the Free plan. No expiry — keep them forever.`})]})})]})})]}),e.jsx(c.div,{variants:m,children:e.jsxs(f,{className:"rounded-3xl shadow-sm border-border/50",children:[e.jsxs(g,{children:[e.jsxs(j,{className:"flex items-center gap-2 text-base",children:[e.jsx("div",{className:"flex items-center justify-center h-8 w-8 rounded-xl bg-accent/10",children:e.jsx(Oe,{className:"h-4 w-4 text-accent"})}),"Business Profile"]}),e.jsx(X,{children:"Help AI understand your expertise so it can think more like you"}),(()=>{const s=[N,w,C,A,k],a=s.filter(o=>o.trim().length>0).length,l=Math.round(a/s.length*100);return l>=100?null:e.jsxs("div",{className:"flex items-center gap-3 mt-2 pt-2 border-t border-border/30",children:[e.jsx("div",{className:"flex-1",children:e.jsx("div",{className:"w-full bg-muted rounded-full h-1.5",children:e.jsx("div",{className:"bg-accent h-1.5 rounded-full transition-all",style:{width:`${l}%`}})})}),e.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[l,"% complete — ",a<3?"fill in your role and industry for better AI responses":"almost there!"]})]})})()]}),e.jsxs(y,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"profile-role",className:"text-xs font-medium text-muted-foreground",children:"Your Role"}),e.jsx(p,{id:"profile-role",placeholder:"e.g., Executive Coach, Business Consultant",value:N,onChange:s=>B(s.target.value),className:"rounded-2xl h-10"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"profile-industry",className:"text-xs font-medium text-muted-foreground",children:"Industry"}),e.jsx(p,{id:"profile-industry",placeholder:"e.g., Leadership Development, Strategy Consulting",value:C,onChange:s=>E(s.target.value),className:"rounded-2xl h-10"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"profile-company",className:"text-xs font-medium text-muted-foreground",children:"Company Description"}),e.jsx(p,{id:"profile-company",placeholder:"e.g., Solo coaching practice helping CEOs scale",value:w,onChange:s=>U(s.target.value),className:"rounded-2xl h-10"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"profile-goals",className:"text-xs font-medium text-muted-foreground",children:"Business Goals"}),e.jsx(Z,{id:"profile-goals",placeholder:"e.g., Get more client referrals, scale 1:1 coaching to group programs, publish a book",value:A,onChange:s=>O(s.target.value),rows:3,className:"rounded-2xl"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"profile-context",className:"text-xs font-medium text-muted-foreground",children:"Additional Context"}),e.jsx(Z,{id:"profile-context",placeholder:"Anything else that helps us understand your business better...",value:k,onChange:s=>R(s.target.value),rows:2,className:"rounded-2xl"})]}),e.jsxs(d,{onClick:ge,disabled:_,className:"rounded-2xl bg-accent hover:bg-accent/90 text-accent-foreground",children:[_&&e.jsx(x,{className:"mr-2 h-4 w-4 animate-spin"}),"Save Business Profile"]})]})]})}),e.jsx(c.div,{variants:m,children:e.jsxs(f,{className:"rounded-3xl shadow-sm border-destructive/30",children:[e.jsxs(g,{children:[e.jsxs(j,{className:"flex items-center gap-2 text-base",children:[e.jsx("div",{className:"flex items-center justify-center h-8 w-8 rounded-xl bg-destructive/10",children:e.jsx(Re,{className:"h-4 w-4 text-destructive"})}),"Danger Zone"]}),e.jsx(X,{children:"Permanent actions that cannot be undone. Be careful."})]}),e.jsxs(y,{className:"space-y-5",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 p-4 rounded-2xl border border-border/50 bg-muted/30",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("h3",{className:"font-semibold flex items-center gap-2",children:[e.jsx(V,{className:"h-4 w-4 text-muted-foreground"}),"Clear my brain"]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"With this action, you're going to clear entirely your digital brain, which means that all the imported documents will remain in your account but your digital brain will forget all the knowledge coming out from that. This action cannot be undone and then you have to reupload the same documents in your account."})]}),e.jsxs(d,{variant:"outline",className:"rounded-2xl border-destructive/40 text-destructive hover:bg-destructive/5 hover:text-destructive shrink-0",onClick:()=>D(!0),"data-testid":"button-clear-brain",children:[e.jsx(V,{className:"h-4 w-4 mr-2"}),"Clear Brain"]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 p-4 rounded-2xl border border-destructive/40 bg-destructive/5",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-destructive",children:[e.jsx(ce,{className:"h-4 w-4"}),"Delete my account"]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Permanently deletes your account, every document you've uploaded, your knowledge graph, conversations, profile, and any active subscription. This cannot be undone."})]}),e.jsxs(d,{variant:"destructive",className:"rounded-2xl shrink-0",onClick:()=>Y(!0),"data-testid":"button-delete-account",children:[e.jsx(ce,{className:"h-4 w-4 mr-2"}),"Delete Account"]})]})]})]})})]}),e.jsx(se,{open:xe,onOpenChange:D,children:e.jsxs(te,{children:[e.jsxs(ae,{children:[e.jsx(re,{children:"Clear your brain?"}),e.jsx(ne,{children:"This will permanently wipe your knowledge graph, all chat conversations, nuggets, predictions, and AI-derived memory. Your uploaded documents will remain — you can delete them individually afterwards. This action cannot be undone."})]}),e.jsxs(le,{children:[e.jsx(ie,{disabled:P,children:"Cancel"}),e.jsxs(oe,{onClick:s=>{s.preventDefault(),pe()},disabled:P,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[P&&e.jsx(x,{className:"mr-2 h-4 w-4 animate-spin"}),"Yes, clear my brain"]})]})]})}),e.jsx(se,{open:he,onOpenChange:s=>{Y(s),s||H("")},children:e.jsxs(te,{children:[e.jsxs(ae,{children:[e.jsx(re,{children:"Delete your account?"}),e.jsxs(ne,{children:["This permanently deletes your account, every document you've uploaded, your knowledge graph, all conversations and nuggets, your profile, and any active subscription. We will also remove you from our authentication provider.",e.jsx("br",{}),e.jsx("br",{}),e.jsx("strong",{className:"text-foreground",children:"This cannot be undone."}),e.jsx("br",{}),e.jsx("br",{}),"Type ",e.jsx("span",{className:"font-mono font-semibold text-foreground",children:"delete my account"})," to confirm:"]})]}),e.jsx(p,{value:$,onChange:s=>H(s.target.value),placeholder:"delete my account",className:"rounded-2xl","data-testid":"input-delete-confirm",autoComplete:"off"}),e.jsxs(le,{children:[e.jsx(ie,{disabled:S,children:"Cancel"}),e.jsxs(oe,{onClick:s=>{s.preventDefault(),fe()},disabled:S||$.trim().toLowerCase()!=="delete my account",className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[S&&e.jsx(x,{className:"mr-2 h-4 w-4 animate-spin"}),"Permanently delete account"]})]})]})})]})}export{We 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.