PageSourceSearch

https://mindhive.ai/assets/Subscription-B8ui9Lk3.js

js mindhive.ai collected 2026-10-05 16:09:53 UTC 8,767 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FooterCompact-TJQFmCxW.js","assets/ui-vendor-CSAVI7Ye.js","assets/react-vendor-BRetysvv.js","assets/index-CZv1YWSu.js","assets/lucide-BFAHPz7J.js","assets/index-CH2TdbCI.css","assets/ThemeLogo-VXmcWFtD.js","assets/NewsletterBand-DE3WEt_o.js","assets/input-BFX0o15h.js","assets/AppToast-DLPgq1FT.js","assets/validation-BGwOzLTT.js","assets/iso27001-badge-DYKd0yjX.js","assets/gdpr-badge-CH_HipLZ.js","assets/vanta-badge-BXgdlC7I.js"])))=>i.map(i=>d[i]);
2import{A as F,m as M,_ as $,N as I,s as d,e as R,B as h,C}from"./index-CZv1YWSu.js";import{j as e}from"./ui-vendor-CSAVI7Ye.js";import{r as o,e as z}from"./react-vendor-BRetysvv.js";import{N as U}from"./Navigation-BN514u5B.js";import{F as O}from"./FooterSkeleton-aKTzLm7c.js";import{C as p,b as f,c as j,d as Y,a as b}from"./card-BpN9YV9t.js";import{B as g}from"./badge-UwAX9qXf.js";import{S as i,g as k}from"./subscription-tiers-YDsBAhrc.js";import{aX as H,I as _}from"./lucide-BFAHPz7J.js";import"./ThemeLogo-VXmcWFtD.js";import"./collapsible-DGJyrQIF.js";import"./dropdown-menu-Bo9afOu_.js";import"./skeleton-BTSaVNu1.js";const P=({price:l,className:u="",showDecimals:n=!1})=>{const m=n?l.toFixed(2):Math.round(l).toString();return e.jsx(F,{mode:"wait",children:e.jsxs(M.span,{initial:{opacity:0,y:-20,scale:.8},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:20,scale:.8},transition:{duration:.3,ease:[.4,0,.2,1],scale:{duration:.2}},className:`inline-block ${u}`,children:["$",m]},l)})},V=o.lazy(()=>$(()=>import("./FooterCompact-TJQFmCxW.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))),ae=()=>{var S,w;const[l,u]=o.useState(!0),[n,m]=o.useState("monthly"),[s,B]=o.useState(null),E=z(),{toast:N}=I();o.useEffect(()=>{L()},[]);const L=async()=>{try{const{data:{user:t}}=await d.auth.getUser();if(!t){E("/auth");return}await T()}catch(t){console.error("Error loading subscription:",t),N({title:"Error",description:"Failed to load subscription data",variant:"destructive"})}finally{u(!1)}},T=async()=>{try{const{data:{session:t}}=await d.auth.getSession();if(!t)return;const{data:r,error:c}=await d.functions.invoke("check-subscription",{headers:{Authorization:`Bearer ${t.access_token}`}});if(c)throw c;B(r)}catch(t){console.error("Error refreshing subscription:",t)}},A=async()=>{try{const{data:{session:t}}=await d.auth.getSession();if(!t)throw new Error("Not authenticated");const{data:r,error:c}=await d.functions.invoke("customer-portal",{headers:{Authorization:`Bearer ${t.access_token}`}});if(c)throw c;r!=null&&r.url&&window.open(r.url,"_blank")}catch(t){N({title:"Error",description:t.message||"Failed to open customer portal",variant:"destructive"})}},v=t=>{const r=i[t];return n==="monthly"?r.priceMonthly:r.priceAnnual},y=()=>n==="monthly"?"Billed monthly":"Billed yearly";if(l)return e.jsx("div",{id:"main-content",className:"min-h-screen bg-background flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"Loading subscription…"})]})});const a=(s==null?void 0:s.tier)||null,x=(s==null?void 0:s.subscribed)||!1;return e.jsxs(e.Fragment,{children:[e.jsx(R,{title:"Subscription | Mindhive",description:"Manage your Mindhive subscription",canonical:"https://mindhive.ai/subscription",noindex:!0}),e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(U,{}),e.jsx("main",{className:"pt-32 pb-20 px-4",children:e.jsxs("div",{className:"container mx-auto max-w-5xl",children:[x&&e.jsxs(p,{className:"mb-12",children:[e.jsx(f,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(j,{className:"text-2xl mb-2",children:"Current Subscription"}),e.jsx(Y,{children:"Your active plan"})]}),e.jsx(g,{variant:"default",className:"text-lg px-4 py-2",children:a==="starter"?"Starter":a==="pro"?"Pro":a})]})}),e.jsxs(b,{children:[e.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-muted-foreground mb-1",children:"Status"}),e.jsx("div",{className:"text-lg font-semibold capitalize",children:(s==null?void 0:s.status)||"Active"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-muted-foreground mb-1",children:"Tokens Used"}),e.jsxs("div",{className:"text-lg font-semibold",children:[((S=s==null?void 0:s.tokens_used)==null?void 0:S.toLocaleStr
2ing())||0," / ",((w=s==null?void 0:s.tokens_limit)==null?void 0:w.toLocaleString())||0]})]}),(s==null?void 0:s.subscription_end)&&e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-muted-foreground mb-1",children:"Renews"}),e.jsx("div",{className:"text-lg font-semibold",children:new Date(s.subscription_end).toLocaleDateString()})]})]}),e.jsx("div",{className:"mt-6",children:e.jsxs(h,{onClick:A,variant:"outline",children:[e.jsx(H,{className:"mr-2 h-4 w-4"}),"Manage Billing"]})})]})]}),e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("h2",{className:"text-4xl font-bold mb-4",children:x?"Change Your Plan":"Choose Your Plan"}),e.jsx("p",{className:"text-lg text-muted-foreground mb-6",children:"Simple, transparent plans with no hidden fees"}),e.jsxs("div",{className:"inline-flex items-center gap-1 p-1 bg-muted rounded-lg",children:[e.jsx("button",{onClick:()=>m("monthly"),className:`px-6 py-2.5 rounded-md transition-colors font-medium ${n==="monthly"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"}`,children:"Monthly"}),e.jsx("button",{onClick:()=>m("annual"),className:`px-6 py-2.5 rounded-md transition-colors font-medium flex items-center gap-2 ${n==="annual"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"}`,children:"Annual"})]})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-8",children:[e.jsxs(p,{className:a==="starter"?"border-2 border-primary":"border border-border relative",children:[a!=="starter"&&e.jsx("div",{className:"absolute -top-4 left-1/2 -translate-x-1/2 bg-accent text-accent-foreground px-4 py-1 rounded-full text-sm font-semibold",children:"Best to start"}),e.jsxs(f,{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx(j,{className:"text-2xl",children:"Starter"}),a==="starter"&&e.jsx(g,{children:"Current Plan"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:[i.starter.seats," seats · ",i.starter.credits.toLocaleString()," credits/month"]}),e.jsx("div",{className:"mb-2",children:e.jsx("span",{className:"text-4xl font-bold",children:e.jsx(P,{price:v("starter")})})}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:y()})]}),e.jsxs(b,{children:[e.jsx("ul",{className:"space-y-3 mb-6",children:i.starter.features.map((t,r)=>e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(_,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5"}),e.jsx("span",{className:"text-sm",children:t})]},r))}),a==="starter"?e.jsx(h,{className:"w-full",disabled:!0,variant:"secondary",children:"Current Plan"}):e.jsx(C,{ctaType:"stripe-trial",href:k("starter",n),label:x?"Switch to Starter":"Start Free Trial",className:"w-full",trackingLocation:"subscription_starter"})]})]}),e.jsxs(p,{className:a==="pro"?"border-2 border-primary":"border-2 border-border relative",children:[a!=="pro"&&e.jsx("div",{className:"absolute -top-4 left-1/2 -translate-x-1/2 bg-primary text-primary-foreground px-4 py-1 rounded-full text-sm font-semibold",children:"Most popular"}),e.jsxs(f,{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx(j,{className:"text-2xl",children:"Pro"}),a==="pro"&&e.jsx(g,{children:"Current Plan"})]}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:[i.pro.seats," seats · ",i.pro.credits.toLocaleString()," credits/month"]}),e.jsx("div",{className:"mb-2",children:e.jsx("span",{className:"text-4xl font-bold",children:e.jsx(P,{price:v("pro")})})}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:y()})]}),e.jsxs(b,{children:[e.jsx("ul",{className:"space-y-3 mb-6",children:i.pro.features.map((t,r)=>e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(_,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5"}),e.jsx("span",{className:"text-sm",children:t})]},r))}),a==="pro"?e.jsx(h,{className:"w-full",disabled:!0,variant:"secondary",children:"Current Plan"}):e.jsx(C,{ctaType:"stripe-trial",href:k("pro",n),label:x?"Upgrade to Pro":"Start Free Trial",className:"w-full",trackingLocation:"subscription_pro"})]})]})]})]})}),e.jsx(o.Suspense,{fallback:e.jsx(O,{}),children:e.jsx(V,{})})]})]})};export{ae 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.