PageSourceSearch

https://console.yupcha.com/assets/index-DHMLn2SF.js

js yupcha.com collected 2026-10-02 01:52:44 UTC 14,182 bytes, 1 lines download raw bytes

1import{Z as D,r as N,j as e,aU as L,B as i,g as b,cq as A,e as w,bg as v,be as M,bY as o,G as R,H as T,C as p,Y as $,ao as m,cr as z,ch as B,ci as I,cj as U,ck as F,cl as _,ak as j}from"./index-Cc6SKmJ5.js";import{D as q}from"./delete-confirmation-dialog-DAcydjxI.js";import{u as H}from"./hooks-CrZ9ok3g.js";import{P as y}from"./package-DZu5tn0Y.js";import{E as P}from"./external-link-CZRlA07R.js";import{R as O}from"./rocket-TczhyNXX.js";import{C as Q}from"./crown-DydiqV-B.js";import"./queries-DZQMPYx5.js";import"./keys-DuDDGVju.js";const V=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],Y=D("dollar-sign",V);const G=[["path",{d:"M10.5 3 8 9l4 13 4-13-2.5-6",key:"b3dvk1"}],["path",{d:"M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3z",key:"7w4byz"}],["path",{d:"M2 9h20",key:"16fsjt"}]],X=D("gem",G),Z={active:{label:"Active",color:"emerald",icon:w},trialing:{label:"Trial",color:"blue",icon:v},past_due:{label:"Past Due",color:"amber",icon:p},canceled:{label:"Canceled",color:"slate",icon:j},unpaid:{label:"Unpaid",color:"red",icon:p},incomplete:{label:"Incomplete",color:"orange",icon:p},incomplete_expired:{label:"Expired",color:"slate",icon:j},paused:{label:"Paused",color:"slate",icon:v},expired:{label:"Expired",color:"slate",icon:j}};function J({status:s}){const a=Z[s];return e.jsx("div",{className:m("inline-flex items-center px-2 py-1 rounded-md text-xs font-medium border",s==="active"&&"bg-emerald-50 text-emerald-700 border-emerald-200",s==="trialing"&&"bg-blue-50 text-blue-700 border-blue-200",s==="past_due"&&"bg-amber-50 text-amber-700 border-amber-200",s==="canceled"&&"bg-slate-50 text-slate-700 border-slate-200",s==="unpaid"&&"bg-red-50 text-red-700 border-red-200",s==="incomplete"&&"bg-orange-50 text-orange-700 border-orange-200",s==="incomplete_expired"&&"bg-slate-50 text-slate-700 border-slate-200",s==="paused"&&"bg-slate-50 text-slate-700 border-slate-200",s==="expired"&&"bg-slate-50 text-slate-700 border-slate-200"),children:a.label})}function K({planName:s}){const a=s.toLowerCase();return a.includes("enterprise")||a.includes("business")?e.jsx(O,{className:"w-5 h-5"}):a.includes("pro")||a.includes("professional")?e.jsx(Q,{className:"w-5 h-5"}):a.includes("premium")||a.includes("plus")?e.jsx(X,{className:"w-5 h-5"}):e.jsx(y,{className:"w-5 h-5"})}function W({subscription:s}){const[a,r]=N.useState(!1),[t,c]=N.useState(!1),n=s.current_period_end?new Date(s.current_period_end):null,d=n?Math.max(0,Math.ceil((n.getTime()-Date.now())/(1e3*60*60*24))):0,x=30,f=(x-d)/x*100,l=n?n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"N/A",u=(s.plan.price_cents/100).toFixed(2),k=s.plan.features&&typeof s.plan.features=="object"?Object.entries(s.plan.features).slice(0,3):[],{orgSlug:S}=z.useParams();return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"group bg-card rounded-lg border border-border/50 hover:border-border hover:shadow-md transition-all duration-200",children:[e.jsx("div",{className:m("h-1 w-full rounded-t-lg",s.status==="active"&&"bg-linear-to-r from-emerald-400 to-emerald-600",s.status==="trialing"&&"bg-linear-to-r from-blue-400 to-blue-600",s.status==="past_due"&&"bg-linear-to-r from-amber-400 to-amber-600",s.status==="canceled"&&"bg-linear-to-r from-slate-400 to-slate-600",s.status==="unpaid"&&"bg-linear-to-r from-red-400 to-red-600",s.status==="expired"&&"bg-linear-to-r from-slate-400 to-slate-600")}),e.jsxs("div",{className:"p-5",children:[e.jsxs("div",{className:"flex items-start justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-muted/50 flex items-center justify-center text-foreground",children:e.jsx(K,{planName:s.plan.name})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-foreground text-sm",children:s.plan.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:s.plan.slug})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(J,{status:s.status}),e.jsxs(B,{children:[e.jsx(I,{asChild:!0,children:e.jsx("button",{className:"p-1.5 hover:bg-muted rounded-md transition-colors",children:e.jsx(U,{className:"w-4 h-4 text-muted-foreground"})})}),e.jsxs(F,{align:"end",className:"w-40",children:[e.jsx(_,{asChild:!0,children:e.jsx(b,{to:`/org/${S}/billing`,children:"View Details"})}),!s.cancel_at_period_end&&e.jsx(_,{className:"text-red-600",onClick:()=>r(!0),children:"Cancel Plan"})]})]})]})]}),e.jsx("div",{className:"mb-2 pb-2",children:e.jsxs("div",{className:"flex items-baseline gap-1",children:[e.jsxs("span",{className:"text-2xl font-bold text-foreground",children:["$",u.split(".")[0]]}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[".",u.
1split(".")[1],"/",s.plan.billing_cycle]})]})}),n&&e.jsxs("div",{className:"mb-4 p-3 bg-muted/30 rounded-lg border border-border/30",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:s.cancel_at_period_end?"Ends On":"Next Renewal"}),e.jsx("span",{className:"text-xs font-semibold text-foreground",children:l})]}),e.jsx("div",{className:"w-full bg-border rounded-full h-1.5",children:e.jsx("div",{className:m("h-1.5 rounded-full transition-all",s.status==="active"&&"bg-emerald-500",s.status==="trialing"&&"bg-blue-500",s.status==="past_due"&&"bg-amber-500"),style:{width:`${Math.max(0,Math.min(100,f))}%`}})}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:[d," days remaining"]})]}),k.length>0&&e.jsx("div",{className:"space-y-2 mb-4",children:k.map(([h,E])=>e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx(w,{className:"w-3.5 h-3.5 text-emerald-500 shrink-0"}),e.jsxs("span",{className:"text-muted-foreground truncate",children:[e.jsx("strong",{className:"text-foreground",children:String(E)})," ",h.replace(/_/g," ")]})]},h))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(i,{className:"flex-1 text-xs h-9",asChild:!0,children:e.jsx(b,{to:`/org/${S}/billing`,children:"Manage"})}),s.product_domain&&e.jsx(i,{variant:"outline",className:"text-xs h-9 px-3",asChild:!0,children:e.jsx("a",{href:`https://${s.product_domain}`,target:"_blank",rel:"noopener noreferrer",children:e.jsx(P,{className:"w-3.5 h-3.5"})})})]})]})]}),e.jsx(q,{open:a,onOpenChange:r,title:"Cancel subscription",description:"Are you sure you want to cancel this subscription? This will stop future renewals.",isPending:t,confirmButtonText:"Cancel Subscription",onConfirm:async()=>{c(!0);try{console.warn("Cancel subscription not yet implemented for:",s.id),window.location.reload()}catch(h){console.error("Cancel failed",h)}finally{c(!1),r(!1)}}})]})}function g({icon:s,label:a,value:r,color:t="gray"}){return e.jsx("div",{className:"bg-card rounded-lg border border-border/30 p-4 shadow-xs",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:m("w-10 h-10 rounded-lg flex items-center justify-center",t==="blue"&&"bg-blue-100 dark:bg-blue-900/20",t==="emerald"&&"bg-emerald-100 dark:bg-emerald-900/20",t==="amber"&&"bg-amber-100 dark:bg-amber-900/20",t==="purple"&&"bg-purple-100 dark:bg-purple-900/20"),children:e.jsx(s,{className:m("w-5 h-5",t==="blue"&&"text-blue-600 dark:text-blue-400",t==="emerald"&&"text-emerald-600 dark:text-emerald-400",t==="amber"&&"text-amber-600 dark:text-amber-400",t==="purple"&&"text-purple-600 dark:text-purple-400")})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground font-medium",children:a}),e.jsx("p",{className:"text-xl font-bold text-foreground mt-0.5",children:r})]})]})})}function ee(){return e.jsx("div",{className:"min-h-screen flex flex-col bg-background",children:e.jsxs("div",{className:"w-full mx-auto flex flex-col p-2 flex-1 space-y-4",children:[e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{children:[e.jsx(o,{className:"h-8 w-48 mb-2"}),e.jsx(o,{className:"h-4 w-64"})]}),e.jsx(o,{className:"h-8 w-40"})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 gap-3",children:[1,2,3,4].map(s=>e.jsx(o,{className:"h-20 rounded-lg"},s))})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[1,2,3].map(s=>e.jsx(o,{className:"h-80 rounded-lg"},s))})]})})}function se({error:s,onRetry:a}){return e.jsx("div",{className:"min-h-screen flex flex-col bg-background items-center justify-center p-4",children:e.jsx(R,{className:"max-w-md w-full border-destructive/20",children:e.jsx(T,{className:"pt-8 pb-8",children:e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("div",{className:"mb-6 p-4 rounded-full bg-destructive/10",children:e.jsx(p,{className:"h-8 w-8 text-destructive"})}),e.jsx("h3",{className:"text-xl font-semibold text-foreground mb-2",children:"Failed to Load Subscriptions"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6 max-w-sm",children:s.message}),e.jsxs(i,{onClick:a,className:"gap-2",children:[e.jsx($,{className:"h-4 w-4"}),"Try Again"]})]})})})})}function ae(){return e.jsx("div",{className:"min-h-screen flex flex-col bg-background",children:e.jsxs("div",{className:"w-full mx-auto flex flex-col p-2 flex-1",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground",children:"Subscriptions"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Manage your active plans and billing"})]}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[e.jsx("div",{className:"relative flex h-16 w-16 items-center justify-center rounded-xl bg-muted border border-border/50 mb-6",children:e.jsx(y,{className:"h-8 w-8 text-muted-foreground opacity-40"})}),e.jsx("h3",{className:"text-lg font-semibold text-foreground mb-2",children:"No Active Subscriptions"}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-sm mb-6",children:"You haven't subscribed to any plans yet. Explore our products and find a plan that fits your needs."}),e.jsx(i,{asChild:!0,size:"sm",className:"gap-2",children:e.jsxs(b,{to:"/products",children:[e.jsx(M,{className:"h-4 w-4"}),e.jsx("span",{children:"Browse Plans"})]})})]})]})})}function xe(){const[s,a]=N.useState(""),{data:r,isLoading:t,error:c,refetch:n}=H();if(t)return e.jsx(ee,{});if(c)return e.jsx(se,{error:c,onRetry:()=>n()});if(!r||r.length===0)return e.jsx(ae,{});const d=r.filter(l=>l.status==="active").length,x=r.filter(l=>l.status==="trialing").length,C=r.reduce((l,u)=>l+u.plan.price_cents/100,0),f=r.filter(l=>s?l.plan.name.toLowerCase().includes(s.toLowerCase())||l.plan.slug.toLowerCase().includes(s.toLowerCase()):!0);return e.jsx("div",{className:"min-h-screen flex flex-col bg-background",children:e.jsxs("div",{className:"w-full mx-auto flex flex-col p-2 flex-1 space-y-4",children:[e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 mb-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h1",{className:"text-xl font-semibold tracking-tight text-foreground",children:"Subscriptions"}),d>0&&e.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full bg-secondary text-muted-foreground ml-1",children:[d," ",d===1?"Plan":"Plans"]})]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Manage your organization's active plans and project subscriptions"})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center gap-2 w-full sm:w-auto",children:[e.jsxs("div",{className:"relative w-full sm:min-w-[280px]",children:[e.jsx(L,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),e.jsx("input",{type:"text",placeholder:"Search subscriptions...",value:s,onChange:l=>a(l.target.value),className:"w-full pl-8 pr-4 h-8 text-sm border border-border rounded-lg bg-background/50 focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent"})]}),e.jsx(i,{asChild:!0,size:"sm",className:"h-8 gap-2 text-xs shrink-0",children:e.jsxs(b,{to:"/products",children:[e.jsx(A,{className:"h-4 w-4"}),e.jsx("span",{children:"New Subscription"})]})})]})]})}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 gap-3 mb-4",children:[e.jsx(g,{icon:y,label:"Total Plans",value:r.length,color:"blue"}),e.jsx(g,{icon:w,label:"Active",value:d,color:"emerald"}),e.jsx(g,{icon:v,label:"Trials",value:x,color:"amber"}),e.jsx(g,{icon:Y,label:"Monthly Spend",value:`$${C.toFixed(0)}`,color:"purple"})]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:f.map(l=>e.jsx(W,{subscription:l},l.id))}),e.jsx("div",{className:"mt-8",children:e.jsx("div",{className:"p-6 rounded-lg bg-card border border-border/30 shadow-xs",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-6",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-lg bg-blue-50 dark:bg-blue-900/10 text-blue-600 dar
1k:text-blue-400 border border-blue-100 dark:border-blue-900/20",children:e.jsx(M,{className:"h-6 w-6"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-base font-semibold text-foreground",children:"Need help with your subscriptions?"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Check our documentation for guides on plan management and billing."})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs(i,{variant:"outline",size:"sm",className:"h-8 gap-2 text-xs",children:[e.jsx("span",{children:"View Docs"}),e.jsx(P,{className:"h-3.5 w-3.5"})]}),e.jsx(i,{variant:"default",size:"sm",className:"h-8 gap-2 text-xs",children:e.jsx("span",{children:"Support"})})]})]})})})]})})}export{xe as component};

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.