1import{ai as D,A as R,al as w,a4 as y,U as g,a5 as B,j as e,aM as $,C as u,G as t,b3 as F,$ as S,W as E,T as n,a0 as v,aa as P,D as C,E as p,X as x,J as M,_ as A,a8 as T,ae as L,aw as _,ac as z,F as k,K as N}from"./index-dE8a1mPK.js";import{E as X}from"./ErrorState-gVNyx0--.js";import{I as q}from"./IconExternalLink-DcQXcLz7.js";import{S as K}from"./SimpleGrid-DkEuk0DW.js";import{I as W}from"./IconUserPlus-zPvIjFMg.js";import{I as G}from"./IconMinus-BVycA7-_.js";import{I as Q}from"./IconPlus-B47PY1MC.js";import"./IconCopy-B63sUmw8.js";import"./Code-YtMEZkZ5.js";function I({height:s=18}){return e.jsx("img",{src:"/stripe-wordmark.svg",alt:"Stripe",height:s,style:{height:s,width:"auto",display:"inline-block",verticalAlign:"middle"}})}const O=[{id:"starter",label:"Starter",price:"$39",priceSub:"/month",accountLimit:1,bullets:["1 connected X account","Compose, threads, intent feed","Assisted DM Co-pilot","Auto-Posts · DM Outreach · Follow/Unfollow campaigns","3 triggers · 1 smart list · 1 competitor watch","Lead scraper + AI scoring","Bulk DM from intent"]},{id:"pro",label:"Pro",price:"$99",priceSub:"/month",accountLimit:5,popular:!0,bullets:["Up to 5 connected X accounts","Everything in Starter","Full-auto DM Co-pilot","Auto-Engage · Bait · Sequence campaigns","10 triggers · 5 smart lists · 3 competitor watches","Audience snapshots + Discover (30/day)","Priority chat support"]},{id:"agency",label:"Agency",price:"$249",priceSub:"/month",accountLimit:15,bullets:["Up to 15 connected X accounts","Everything in Pro","Unlimited triggers, smart lists, competitors","Unlimited Discover","Higher daily caps per account","Dedicated success manager"]}];function ae(){var j;const s=D(),o=R({queryKey:["billing"],queryFn:()=>g.getBilling()}),l=w({mutationFn:i=>g.billingCheckout({planId:i,successUrl:`${window.location.origin}/billing?upgraded=1`,cancelUrl:`${window.location.origin}/billing?canceled=1`}),onSuccess:i=>{i!=null&&i.url&&(window.location.href=i.url)},onError:i=>y(i)}),m=w({mutationFn:()=>g.billingPortal({returnUrl:`${window.location.origin}/billing`}),onSuccess:i=>{i!=null&&i.url&&(window.location.href=i.url)},onError:i=>y(i)}),h=w({mutationFn:i=>g.billingSetAccountSlots(i),onSuccess:()=>{B("Account slots updated â prorated on next invoice"),s.invalidateQueries({queryKey:["billing"]})},onError:i=>y(i)}),a=w({mutationFn:()=>g.billingBuyAiCredits({successUrl:`${window.location.origin}/billing?credits=1`,cancelUrl:`${window.location.origin}/billing?canceled=1`}),onSuccess:i=>{i!=null&&i.url&&(window.location.href=i.url)},onError:i=>y(i)});if(o.isLoading)return e.jsx($,{});if(o.error)return e.jsx(X,{error:o.error,onRetry:()=>o.refetch()});const r=o.data;if(!r)return null;const d=Math.min(100,r.usage.accounts/Math.max(r.caps.accountLimit,1)*100);return e.jsxs(u,{gap:"md",children:[e.jsxs("div",{children:[e.jsxs(t,{justify:"space-between",align:"center",wrap:"wrap",gap:"xs",children:[e.jsxs(t,{gap:"xs",align:"center",children:[e.jsx(F,{size:20}),e.jsx(S,{order:2,children:"Billing"})]}),e.jsx(E,{label:"Payments are processed by Stripe â we never see or store your card.",withArrow:!0,children:e.jsxs(t,{gap:6,style:{opacity:.85},children:[e.jsx(n,{size:"xs",c:"dimmed",children:"Powered by"}),e.jsx(I,{height:18})]})})]}),e.jsx(n,{c:"dimmed",size:"sm",children:"Plan and usage. Upgrades open Stripe Checkout in a redirect; manage payment + cancellation through the customer portal."})]}),!r.stripeConfigured&&e.jsxs(v,{color:"yellow",icon:e.jsx(P,{size:16}),variant:"light",children:["Stripe isn't configured on the server (no ",e.jsx("code",{children:"STRIPE_SECRET_KEY"}),"). Free plan works as-is; upgrades require the operator to set the env vars."]}),r.stripeConfigured&&!r.upgradeReady&&e.jsxs(v,{color:"yellow",icon:e.jsx(P,{size:16}),variant:"light",children:["Stripe is connected but no ",e.jsx("code",{children:"STRIPE_PRICE_PRO"})," /",e.jsx("code",{children:"STRIPE_PRICE_SCALE"})," price IDs are set. Upgrade buttons stay disabled until the operator pastes price IDs into the env."]}),e.jsx(C,{withBorder:!0,children:e.jsxs(u,{gap:"xs",children:[e.jsxs(t,{justify:"space-between",wrap:"wrap",gap:"sm",children:[e.jsxs(t,{gap:"xs",children:[e.jsxs(n,{fw:700,children:["Current plan: ",r.planLabel]}),e.jsx(p,{color:H(r.subscriptionStatus),children:r.subscriptionStatus})]}),r.plan!=="free"&&e.jsx(x,{variant:"default",rightSection:e.jsx(q,{size:14}),onClick:()=>m.mutate(),loading:m.isPending,children:"Manage subscription"})]}),r.currentPeriodEnd&&e.jsxs(n,{size:"xs",c:"dimmed",children:["Next renewal: ",new Date(r.currentPeriodEnd).toLocaleDateString()]}),e.jsxs(t,{justify:"space-between",mt:"sm",children:[e.jsx(n,{size:"sm",children:"X accounts"}),e.jsxs(n,{size:"sm",c:"dimmed",children:[r.usage.accounts," / ",r.caps.accountLimit,((j=r.addons)==null?void 0:j.extraAccountSlots)>0&&r.caps.baseAccountLimit!=null&&e.jsxs(n,{component:"span",size:"xs",c:"dimmed",ml:6,children:["(",r.caps.baseAccountLimit," plan + ",r.addons.extraAccountSlots," add-on)"]})]})]}),e.jsx(M,{value:d,color:d>=100?"red":d>=80?"yellow":"blue",size:"sm"}),r.remaining.accounts===0&&e.jsx(n,{size:"xs",c:"orange",children:"Account limit reached. Upgrade or remove an account before connecting another."})]})}),e.jsx(Y,{billing:r,onSetSlots:i=>h.mutate(i),setSlotsPending:h.isPending,onBuyCredits:()=>a.mutate(),buyCreditsPending:a.isPending}),e.jsx(K,{cols:{base:1,sm:3},spacing:"md",children:O.map(i=>{const c=r.plan===i.id,f=i.id!=="free"&&!c&&r.stripeConfigured&&r.upgradeReady;return e.jsx(C,{withBorder:!0,p:"lg",style:{borderColor:i.popular?"var(--mantine-color-dark-5)":void 0,borderWidth:i.popular?2:1},children:e.jsxs(u,{gap:"xs",h:"100%",children:[e.jsxs(t,{justify:"space-between",align:"flex-start",children:[e.jsx(S,{order:4,children:i.label}),c&&e.jsx(p,{color:"dark",children:"current"}),i.popular&&!c&&e.jsx(p,{variant:"filled",color:"dark",children:"most popular"})]}),e.jsxs(t,{gap:4,align:"baseline",children:[e.jsx(S,{order:2,children:i.price}),e.jsx(n,{size:"sm",c:"dimmed",children:i.priceSub})]}),e.jsxs(n,{size:"sm",c:"dimmed",children:["Up to ",i.accountLimit," X account",i.accountLimit===1?"":"s"]}),e.jsx(A,{spacing:4,size:"sm",icon:e.jsx(T,{size:14,color:"var(--mantine-color-green-6)"}),mt:"xs",children:i.bullets.map((b,U)=>e.jsx(A.Item,{children:b},U))}),e.jsx("div",{style:{flex:1}}),i.id==="free"?e.jsx(x,{variant:"default",disabled:!0,mt:"md",children:c?"Current plan":"Free tier"}):c?e.jsx(x,{variant:"default",disabled:!0,mt:"md",children:"Current plan"}):e.jsx(x,{leftSection:e.jsx(L,{size:16}),onClick:()=>l.mutate(i.id),loading:l.isPending&&l.variables===i.id,disabled:!f,mt:"md",children:f?`Upgrade to ${i.label}`:"Not configured"})]})},i.id)})}),e.jsxs(t,{justify:"center",gap:6,mt:"xs",style:{opacity:.7},children:[e.jsx(_,{size:12}),e.jsx(n,{size:"xs",c:"dimmed",children:"Secured by"}),e.jsx(I,{height:14})]})]})}function Y({billing:s,onSetSlots:o,setSlotsPending:l,onBuyCredits:m,buyCreditsPending:h}){var b;const a=(s==null?void 0:s.addons)||{},r=Number(a.extraAccountSlots||0),d=Number(((b=s==null?void 0:s.credits)==null?void 0:b.bonus)??a.bonusAiCredits??0),j=Number(a.pricePerExtraSlotUsd||15),i=Number(a.aiCreditsPackUsd||15),c=Number(a.aiCreditsPerPack||1e4),f=s.plan!=="free"&&s.subscriptionStatus!=="inactive"&&s.subscriptionStatus!=="c
1anceled";return!a.accountSlotConfigured&&!a.aiCreditsConfigured?null:e.jsx(C,{withBorder:!0,children:e.jsxs(u,{gap:"sm",children:[e.jsxs(t,{gap:"xs",children:[e.jsx(z,{size:16}),e.jsx(n,{fw:600,children:"Add-ons"}),e.jsx(p,{variant:"light",size:"xs",children:"top-ups"})]}),a.accountSlotConfigured&&e.jsxs(t,{justify:"space-between",wrap:"wrap",gap:"sm",children:[e.jsxs(u,{gap:2,style:{flex:"1 1 240px",minWidth:0},children:[e.jsxs(t,{gap:"xs",children:[e.jsx(W,{size:14}),e.jsx(n,{size:"sm",fw:500,children:"Extra X account slots"})]}),e.jsxs(n,{size:"xs",c:"dimmed",children:["$",j,"/mo per slot. Adds on top of your plan's base limit. Prorated on the next invoice."]})]}),e.jsx(t,{gap:6,align:"center",children:f?e.jsxs(e.Fragment,{children:[e.jsx(k,{variant:"default","aria-label":"Remove a slot",disabled:r<=0||l,onClick:()=>o(Math.max(0,r-1)),children:e.jsx(G,{size:14})}),e.jsx(n,{fw:700,w:32,ta:"center",children:r}),e.jsx(k,{variant:"filled","aria-label":"Add a slot",disabled:l,onClick:()=>o(r+1),children:e.jsx(Q,{size:14})})]}):e.jsx(E,{label:"Subscribe to Pro or Scale before buying extra slots",withArrow:!0,children:e.jsx(p,{color:"gray",variant:"light",children:"Requires paid plan"})})})]}),a.accountSlotConfigured&&a.aiCreditsConfigured&&e.jsx(N,{}),a.aiCreditsConfigured&&e.jsxs(t,{justify:"space-between",wrap:"wrap",gap:"sm",children:[e.jsxs(u,{gap:2,style:{flex:"1 1 240px",minWidth:0},children:[e.jsxs(t,{gap:"xs",children:[e.jsx(z,{size:14}),e.jsx(n,{size:"sm",fw:500,children:"Credit top-up"})]}),e.jsxs(n,{size:"xs",c:"dimmed",children:["$",i," for +",c.toLocaleString()," credits. Credits cover every API + AI call (1 credit per X data lookup, 3 per AI generation). Top-ups never expire and kick in when your monthly plan budget runs out."]})]}),e.jsxs(t,{gap:8,align:"center",children:[e.jsxs(p,{variant:"light",color:d>0?"green":"gray",children:[d.toLocaleString()," top-up left"]}),e.jsx(x,{size:"xs",leftSection:e.jsx(L,{size:14}),onClick:m,loading:h,children:"Buy pack"})]})]})]})})}function H(s){return s==="active"||s==="trialing"?"green":s==="past_due"||s==="unpaid"?"red":"gray"}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.