import{aD as x,e as p,j as e,r as j,T as a,B as o,L as g}from"./main-TIUJvpaR.js";import{b}from"./billing-queries-D1QXfRse.js";import{B as f,a as m}from"./breadcrumb-B7oVkzG6.js";import{F as h}from"./formatted-date-CsxGDhkC.js";import{F as v}from"./formatted-price-BnJL0Dzb.js";import{B as y}from"./billing-plan-panel-DBYIXcfr.js";import{u as w}from"./use-resume-subscription-BIkNdA4R.js";import{u as B,i as N}from"./use-billing-user-De1g37WG.js";import"./useEffectEvent-Bgk8rSJ3.js";import"./ChevronRight-BaJkMP9s.js";import"./MoreHoriz-Cm8ZCxuL.js";import"./use-date-formatter-hhGEq_P-.js";const t="/billing";function E(){const r=x(),c=p(b.products.index()),{subscription:s}=B(),n=w(),i=s==null?void 0:s.product,l=s==null?void 0:s.price;if(!c.data)return null;if(!s||!i||!l)return r(t),null;const d=e.jsxs("span",{className:"whitespace-nowrap",children:[e.jsx(h,{date:s.ends_at,preset:"long"}),";"]}),u=()=>{n.mutate({subscriptionId:s.id},{onSuccess:()=>{N(),r("/billing")}})};return e.jsxs(j.Fragment,{children:[e.jsxs(f,{children:[e.jsx(m,{isLink:!0,onSelected:()=>r(t),children:e.jsx(a,{message:"Billing"})}),e.jsx(m,{children:e.jsx(a,{message:"Renew"})})]}),e.jsx("h1",{className:"my-32 text-3xl font-bold md:my-64",children:e.jsx(a,{message:"Renew your plan"})}),e.jsx(y,{title:e.jsx(a,{message:"Current plan"}),children:e.jsxs("div",{className:"max-w-[464px]",children:[e.jsx("div",{className:"text-xl font-bold",children:i.name}),e.jsx(v,{price:l,className:"text-lg"}),e.jsx("div",{className:"mb-48 mt-12 border-b pb-24 text-base",children:e.jsx(a,{message:"This plan will no longer be canceled. It will renew on :date",values:{date:d}})}),e.jsx(o,{variant:"flat",color:"primary",size:"md",className:"mb-16 w-full",onClick:u,disabled:n.isPending,children:e.jsx(a,{message:"Renew plan"})}),e.jsx(o,{variant:"outline",className:"w-full",to:t,elementType:g,children:e.jsx(a,{message:"Go back"})}),e.jsx("div",{className:"mt-12 text-xs text-muted",children:e.jsx(a,{message:"By renewing your plan, you agree to our terms of service and privacy policy."})})]})})]})}export{E as Component};
