1import{u as T,c as B,r,j as e,Q as b,B as o,am as d}from"./index-_aijvlUq.js";const _=[{value:"too_expensive",label:"Too expensive for our budget"},{value:"not_using",label:"We're not using it enough"},{value:"switching",label:"Switching to a different tool"},{value:"missing_features",label:"Missing features we need"},{value:"org_dissolving",label:"Our organization is dissolving"},{value:"seasonal",label:"Seasonal â we'll be back later"},{value:"other",label:"Other reason"}];function M(){const c=T(),{showSuccess:m,showError:p}=B(),[l,f]=r.useState(null),[j,y]=r.useState(null),[v,N]=r.useState(!0),[a,w]=r.useState(""),[x,k]=r.useState(""),[n,u]=r.useState(null);r.useEffect(()=>{async function s(){try{const[t,L]=await Promise.all([d.getUsage(),d.getSubscription()]);f(t),y(L)}catch{}N(!1)}s()},[]);async function i(s){u(s);try{const t=await d.submitCancelSurvey({reason:a,reasonText:x,action:s});s==="pause"?(m(t.message||"Your next month is on us!"),c("/settings/billing",{replace:!0})):s==="cancel"&&t.portalUrl?window.location.href=t.portalUrl:s==="keep"?(m("Glad you're staying!"),c("/settings/billing",{replace:!0})):s==="downgrade"&&c("/settings/billing",{replace:!0})}catch(t){p(t.message||"Something went wrong")}finally{u(null)}}const h=j?.planTier||"essentials",g=b[h];if(v)return e.jsx("div",{className:"flex items-center justify-center py-24",children:e.jsx("div",{className:"animate-spin motion-reduce:!animate-spin h-8 w-8 border-2 border-band-500 border-t-transparent rounded-full"})});const S=l?.find(s=>s.metric==="members")?.current||0,C=l?.find(s=>s.metric==="musicPieces")?.current||0,P=l?.find(s=>s.metric==="ensembles")?.current||0,E=l?.find(s=>s.metric==="venues")?.current||0;return e.jsxs("div",{className:"max-w-2xl mx-auto py-8 px-4",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"We're sorry to see you go"}),e.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"Before you cancel, here's what you've built with Backstage Baton."})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6 mb-6",children:[e.jsx("h2",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide mb-4",children:"Your Organization Today"}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-3xl font-bold text-brand-primary",children:S}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Members"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-3xl font-bold text-brand-primary",children:C}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Music Pieces"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-3xl font-bold text-brand-primary",children:P}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Ensembles"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-3xl font-bold text-brand-primary",children:E}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Venues"})]})]})]}),g&&e.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-xl p-6 mb-6",children:[e.jsx("h2",{className:"text-sm font-semibold text-red-800 mb-3",children:"What you'll lose with cancellation"}),e.jsx("ul",{className:"space-y-2",children:g.highlights?.map((s,t)=>e.jsxs("li",{className:"flex items-start gap-2 text-sm text-red-700",children:[e.jsx("svg",{className:"h-4 w-4 text-red-400 shrink-0 mt-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),e.jsx("span",{children:s})]},t))})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6 mb-6",children:[e.jsx("h2",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide mb-4",children:"Help us improve â why are you leaving?"}),e.jsx("div",{className:"space-y-2",children:_.map(s=>e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer",children:[e.jsx("input",{type:"radio",name:"cancel-reason",value:s.value,checked:a===s.value,onChange:()=>
1w(s.value),className:"h-4 w-4 text-brand-primary focus:ring-brand-primary border-gray-300"}),e.jsx("span",{className:"text-sm text-gray-700",children:s.label})]},s.value))}),(a==="other"||a==="missing_features")&&e.jsx("textarea",{rows:3,value:x,onChange:s=>k(s.target.value),placeholder:a==="missing_features"?"What features are you looking for?":"Tell us more...",className:"w-full mt-3 text-sm border border-gray-300 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-brand-primary resize-none"})]}),e.jsxs("div",{className:"space-y-3 mb-6",children:[e.jsxs("div",{className:"bg-green-50 border border-green-200 rounded-xl p-5 flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-green-900",children:"Need a break? Pause for a month."}),e.jsx("p",{className:"text-xs text-green-700 mt-0.5",children:"Your next month is free. No changes to your plan. Come back refreshed."})]}),e.jsx(o,{variant:"primary",size:"sm",onClick:()=>i("pause"),isLoading:n==="pause",disabled:!!n,className:"shrink-0",children:"Pause â 1 month free"})]}),h==="complete"&&e.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-xl p-5 flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-blue-900",children:"Need a smaller plan?"}),e.jsxs("p",{className:"text-xs text-blue-700 mt-0.5",children:["Downgrade to Essentials and keep your data. $",b.essentials?.monthlyPrice,"/mo."]})]}),e.jsx(o,{variant:"secondary",size:"sm",onClick:()=>i("downgrade"),disabled:!!n,className:"shrink-0",children:"View plans"})]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-gray-200",children:[e.jsx(o,{variant:"primary",onClick:()=>i("keep"),disabled:!!n,children:"Keep my plan"}),e.jsx(o,{variant:"ghost",onClick:()=>i("cancel"),isLoading:n==="cancel",disabled:!!n||!a,className:"text-red-500 hover:text-red-700",children:"Continue to cancel"})]}),!a&&e.jsx("p",{className:"text-xs text-gray-400 text-right mt-1",children:"Please select a reason to continue"})]})}
1export{M as CancelRetentionPage};
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.