%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/opti/public_html/startup-life/assets/
Upload File :
Create Path :
Current File : /home/opti/public_html/startup-life/assets/index-d27576e3.js

import{e as p,d,f as m,j as e,Q as l,u as h,aJ as b,r as f}from"./index-5492fbe1.js";import{D as y}from"./dashboard-footer-navigation-f658b457.js";import{u as N}from"./useQuery-0abbcf43.js";import{C as u}from"./index-2c4b8b3c.js";import"./joinClasses-adfcc520.js";import"./motion-4a110d9b.js";const j=()=>N({queryFn:async()=>{var n;try{const s=await p.get("/subscription/plans",{params:{status:"ACTIVE"}});return s==null?void 0:s.data}catch(s){return(n=s.response)==null?void 0:n.data}},queryKey:["get_all_plans"]}),C=()=>d({mutationFn:async()=>{var n;try{return(await p.post("/subscription/subscribe/cancel")).data}catch(s){return(n=s.response)==null?void 0:n.data}}}),v=()=>d({mutationFn:async n=>{var s;try{return(await p.post(`/subscription/subscribe/${n.id}`,n)).data}catch(o){return(s=o.response)==null?void 0:s.data}}}),P=({plan:a})=>{var c;const{mutateAsync:t,isLoading:n}=v(),{mutateAsync:s}=C(),o=(c=JSON.parse(localStorage.getItem("user")))==null?void 0:c.currentPlan,{handleLogout:i}=m();return e.jsxs("div",{className:"plan p-[20px] shadow-lg rounded-lg",children:[e.jsx("div",{className:"name mb-[40px]",children:a.name}),e.jsx("div",{className:"amt-interval mb-[5px]",children:e.jsxs("h1",{className:"text-[#000] text-[1.8rem]",children:["NGN ",a.amount," ",e.jsxs("span",{className:"text-[.9rem] capitalize",children:["/ ",a.interval]})]})}),e.jsx("hr",{}),(o==null?void 0:o.planCode)===a.planCode?e.jsx("button",{onClick:()=>{console.log("on it"),s().then(r=>{if(console.log(r),r.message==="Subscription with code not found or already inactive"){l.error("error cancelling subscription");return}l.success(r.message),setTimeout(()=>{l.success("you will be logged out for data update"),i()},3e3)})},className:"bg-[#000] w-full mt-[20px] text-[#fff]",children:"Cancel"}):e.jsx("button",{onClick:()=>{console.log("on it"),t({id:a.id}).then(r=>{console.log(r),window.open(r.authorization_url,"_blank")})},className:"bg-[#A8CF45] w-full mt-[20px] text-[#fff]",children:n?"Loading...":"Get Started"})]})},T=()=>{const a=h(),{data:t,isLoading:n,isError:s}=j();console.log(t);const[o]=b(),c=o.get("trxref")==="",{handleLogout:r}=m();return f.useEffect(()=>{c&&(l.success("Subscibed Successfully!"),setTimeout(()=>{l.success("you will be logged out for data update"),r()},3e3))},[c]),console.log(t),e.jsxs("div",{className:"subscribe p-[40px] mb-[100px]",children:[e.jsxs("div",{className:"title flex flex-col gap-[5px] text-center !text-[#000]",children:[e.jsx("h2",{className:"text-[2.5rem]",children:"Choose your right plan!"}),e.jsx("p",{children:"select from best plans, ensuring a perfect match. Need more or less?"}),e.jsx("p",{children:"Customize your subscription for seemless fit!"})]}),e.jsxs("div",{className:"all-plans mt-[60px]",children:[e.jsx(u,{appear:n,children:"Loading plans..."}),e.jsx(u,{appear:s,children:"ERROR: INTERNET_CONNECTION_REFUSED"}),e.jsx(u,{appear:(t==null?void 0:t.length)>0,children:e.jsx("div",{className:"various-plans grid grid-cols-3 gap-[20px]",children:t==null?void 0:t.map((x,g)=>e.jsx(P,{plan:x},g))})})]}),e.jsx(y,{backBtnText:"back",cancelEventHandler:()=>a(-1),hideContinueBtn:!0})]})};export{T as default};

Zerion Mini Shell 1.0