1import{n as w,r as a,j as e}from"./react-vendor-CdbEkvHB.js";import{B as y,L as S,n as I}from"./index-D5ldX8nG.js";import{L as f}from"./label-BDZC01Zc.js";import{R as C,a as R}from"./radio-group-WKaS2sN7.js";import{T as _}from"./textarea-B3bO-cSJ.js";import{e as T}from"./icons-D5q0hyss.js";import"./radix-ui-CSxGpBRr.js";import"./supabase-CxM-nLeM.js";const g=[{value:"too_generic",label:"The reviews were too generic"},{value:"unclear_use_case",label:"I was not sure when to use it"},{value:"too_much_effort",label:"It took too much effort"},{value:"not_trading",label:"I was not trading recently"},{value:"trust_issue",label:"I did not trust the result enough"},{value:"missing_feature",label:"Something important was missing"},{value:"other",label:"Other"}],E=new Set(g.map(r=>r.value));function B(){const[r]=w(),o=r.get("token")||"",i=r.get("reason")||"",p=E.has(i)?i:"other",[c,v]=a.useState(p),[u,j]=a.useState(""),[m,d]=a.useState(!1),[l,k]=a.useState(null),[h,n]=a.useState(""),x=a.useMemo(()=>o.length>=24,[o]),N=async t=>{if(t.preventDefault(),!x){n("This feedback link is invalid.");return}d(!0),n("");try{const{data:s,error:b}=await I.functions.invoke("submit-churn-feedback",{body:{token:o,reason:c,details:u.trim()||null}});if(b||s?.error){n(s?.error||b?.message||"Feedback could not be saved.");return}k(s||{success:!0})}catch(s){n(s instanceof Error?s.message:"Network error while saving feedback.")}finally{d(!1)}};return l?.success?e.jsx("main",{id:"main-content",tabIndex:-1,className:"min-h-screen bg-background px-4 py-16",children:e.jsxs("section",{className:"mx-auto flex min-h-[70vh] max-w-xl flex-col justify-center",children:[e.jsx("div",{className:"mb-6 flex h-11 w-11 items-center justify-center rounded-md bg-emerald-500/10 text-emerald-600",children:e.jsx(T,{className:"h-6 w-6"})}),e.jsx("p",{className:"mb-2 text-sm font-semibold text-muted-foreground",children:"ChartMentor"}),e.jsx("h1",{className:"mb-4 text-3xl font-bold tracking-normal text-foreground",children:"Thanks. That helps."}),l.rewardGranted?e.jsxs("p",{className:"text-base leading-7 text-muted-foreground",children:["I added ",l.scansGranted||5," extra AI chart checks to your account. Iâll use this feedback to make the chart checks more useful."]}):e.jsx("p",{className:"text-base leading-7 text-muted-foreground",children:"Iâll review it and use it to improve ChartMentor."})]})}):e.jsx("main",{id:"main-content",tabIndex:-1,className:"min-h-screen bg-background px-4 py-12",children:e.jsxs("section",{className:"mx-auto flex min-h-[76vh] max-w-2xl flex-col justify-center",children:[e.jsx("p",{className:"mb-2 text-sm font-semibold text-muted-foreground",children:"ChartMentor"}),e.jsx("h1",{className:"mb-3 text-3xl font-bold tracking-normal text-foreground",children:"What made you stop using it?"}),e.jsx("p",{className:"mb-8 max-w-xl text-base leading-7 text-muted-foreground",children:"Pick the closest reason. You can add detail if you want."}),e.jsxs("form",{onSubmit:N,className:"space-y-6",children:[e.jsx(C,{value:c,onValueChange:v,className:"grid gap-3",children:g.map(t=>e.jsxs(f,{htmlFor:`reason-${t.value}`,className:"flex cursor-pointer items-center gap-3 rounded-md border border-border bg-card px-4 py-3 text-sm font-medium text-foreground transition-colors hover:bg-muted",children:[e.jsx(R,{id:`reason-${t.value}`,value:t.value}),e.jsx("span",{children:t.label})]},t.value))}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"details",children:"Optional detail"}),e.jsx(_,{id:"details",value:u,onChange:t=>j(t.target.value.slice(0,2e3)),placeholder:"What would make ChartMentor useful enough to use again?",className:"min-h-28 resize-y"})]}),h?e.jsx("p",{className:"text-sm text-destructive",children:h}):null,e.jsxs(y,{type:"submit",disabled:m||!x,className:"min-w-32",children:[m?e.jsx(S,{className:"mr-2 h-4 w-4"}):null,"Submit feedback"]})]})]})})}export{B 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.