diff --git a/app/(dashboard)/settings/billing/page.tsx b/app/(dashboard)/settings/billing/page.tsx index 196f9a7c..d0101be5 100644 --- a/app/(dashboard)/settings/billing/page.tsx +++ b/app/(dashboard)/settings/billing/page.tsx @@ -1,83 +1,7 @@ -import { Check } from 'lucide-react' -import { createClient } from '@/lib/supabase/server' -import { getActiveCompanyId } from '@/lib/company/context' -import { statusGrantsAccess } from '@/lib/stripe/subscription-sync' -import { isStripeConfigured } from '@/lib/stripe/client' -import { BillingActions } from '@/components/settings/BillingActions' +import { BillingSettingsContent } from '@/components/settings/sections/BillingSettingsContent' export const metadata = { title: 'Abonnemang' } -// What the paid tier unlocks (mirrors lib/entitlements PAID_CAPABILITIES). -const INCLUDED = [ - 'AI-assistent: chatt, kategorisering och dokumenttolkning', - 'Bankkoppling och automatisk synk (PSD2)', - 'Skatteverket: moms- och AGI-inlämning', - 'E-postutskick av fakturor, påminnelser och lönebesked', -] - -// Free for everyone — reassures users that the core ledger is never withheld. -const ALWAYS_FREE = - 'All bokföring, fakturering, rapporter, SIE-export, org.nr-uppslag och momsnummerkontroll ingår alltid utan kostnad.' - -/** - * Upgrade / subscription page — the destination every "Uppgradera" affordance - * points to. Reads the active company's subscription status to show either the - * Checkout CTA or the manage-subscription portal; fulfilment itself happens via - * the Stripe webhook, never this page. - */ -export default async function BillingPage() { - const supabase = await createClient() - const { - data: { user }, - } = await supabase.auth.getUser() - - let isActive = false - if (user) { - const companyId = await getActiveCompanyId(supabase, user.id) - if (companyId) { - const { data: sub } = await supabase - .from('company_subscriptions') - .select('status') - .eq('company_id', companyId) - .maybeSingle() - isActive = statusGrantsAccess((sub as { status: string | null } | null)?.status) - } - } - const configured = isStripeConfigured() - - return ( -
- {isActive - ? 'Ditt abonnemang är aktivt. Du kan hantera eller avsluta det när som helst.' - : 'Lås upp AI-assistenten, bankkoppling, Skatteverket-inlämning och e-postutskick.'} -
- -- eller 1 999 kr per år (två månader gratis). -
- -{ALWAYS_FREE}
-