mirror of https://github.com/kortix-ai/suna.git
chore(dev): told referrals
This commit is contained in:
parent
7c5eea5c34
commit
0e9aaa6789
|
@ -14,6 +14,8 @@ from services.supabase import DBConnection
|
|||
from utils.auth_utils import get_current_user_id_from_jwt
|
||||
from pydantic import BaseModel
|
||||
from utils.constants import MODEL_ACCESS_TIERS, MODEL_NAME_ALIASES
|
||||
import os
|
||||
|
||||
# Initialize Stripe
|
||||
stripe.api_key = config.STRIPE_SECRET_KEY
|
||||
|
||||
|
@ -542,7 +544,6 @@ async def create_checkout_session(
|
|||
logger.exception(f"Error updating subscription {existing_subscription.get('id') if existing_subscription else 'N/A'}: {str(e)}")
|
||||
raise HTTPException(status_code=500, detail=f"Error updating subscription: {str(e)}")
|
||||
else:
|
||||
# --- Create New Subscription via Checkout Session ---
|
||||
session = stripe.checkout.Session.create(
|
||||
customer=customer_id,
|
||||
payment_method_types=['card'],
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
import { Separator } from '@/components/ui/separator';
|
||||
import Link from 'next/link';
|
||||
import { usePathname } from 'next/navigation';
|
||||
import Script from 'next/script';
|
||||
|
||||
export default function PersonalAccountSettingsPage({
|
||||
children,
|
||||
|
@ -16,30 +17,31 @@ export default function PersonalAccountSettingsPage({
|
|||
{ name: 'Billing', href: '/settings/billing' },
|
||||
];
|
||||
return (
|
||||
<div className="space-y-6 w-full">
|
||||
<Separator className="border-subtle dark:border-white/10" />
|
||||
<div className="flex flex-col space-y-8 lg:flex-row lg:space-x-12 lg:space-y-0 w-full max-w-6xl mx-auto px-4">
|
||||
<aside className="lg:w-1/4 p-1">
|
||||
<nav className="flex flex-col space-y-1">
|
||||
{items.map((item) => (
|
||||
<Link
|
||||
key={item.href}
|
||||
href={item.href}
|
||||
className={`px-3 py-2 rounded-md text-sm font-medium transition-colors ${
|
||||
pathname === item.href
|
||||
? 'bg-accent text-accent-foreground'
|
||||
: 'text-muted-foreground hover:bg-accent/50 hover:text-accent-foreground'
|
||||
}`}
|
||||
>
|
||||
{item.name}
|
||||
</Link>
|
||||
))}
|
||||
</nav>
|
||||
</aside>
|
||||
<div className="flex-1 bg-card-bg dark:bg-background-secondary p-6 rounded-2xl border border-subtle dark:border-white/10 shadow-custom">
|
||||
{children}
|
||||
<>
|
||||
<Script async src="https://cdn.tolt.io/tolt.js" data-tolt="pk_svc8UjqvSEMSSpDuxKH63UmV"></Script>
|
||||
<div className="space-y-6 w-full">
|
||||
<Separator className="border-subtle dark:border-white/10" />
|
||||
<div className="flex flex-col space-y-8 lg:flex-row lg:space-x-12 lg:space-y-0 w-full max-w-6xl mx-auto px-4">
|
||||
<aside className="lg:w-1/4 p-1">
|
||||
<nav className="flex flex-col space-y-1">
|
||||
{items.map((item) => (
|
||||
<Link
|
||||
key={item.href}
|
||||
href={item.href}
|
||||
className={`px-3 py-2 rounded-md text-sm font-medium transition-colors ${pathname === item.href
|
||||
? 'bg-accent text-accent-foreground'
|
||||
: 'text-muted-foreground hover:bg-accent/50 hover:text-accent-foreground'}`}
|
||||
>
|
||||
{item.name}
|
||||
</Link>
|
||||
))}
|
||||
</nav>
|
||||
</aside>
|
||||
<div className="flex-1 bg-card-bg dark:bg-background-secondary p-6 rounded-2xl border border-subtle dark:border-white/10 shadow-custom">
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ export default function RootLayout({
|
|||
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
||||
})(window,document,'script','dataLayer','GTM-PCHSN4M2');`}
|
||||
</Script>
|
||||
{/* End Google Tag Manager */}
|
||||
<script async src="https://cdn.tolt.io/tolt.js" data-tolt="pk_svc8UjqvSEMSSpDuxKH63UmV"></script>
|
||||
</head>
|
||||
|
||||
<body
|
||||
|
|
|
@ -1500,6 +1500,7 @@ export interface CreateCheckoutSessionRequest {
|
|||
price_id: string;
|
||||
success_url: string;
|
||||
cancel_url: string;
|
||||
referral_id?: string;
|
||||
}
|
||||
|
||||
export interface CreatePortalSessionRequest {
|
||||
|
@ -1588,14 +1589,17 @@ export const createCheckoutSession = async (
|
|||
if (!session?.access_token) {
|
||||
throw new NoAccessTokenAvailableError();
|
||||
}
|
||||
|
||||
|
||||
// Add referral ID to request if available
|
||||
const requestBody = { ...request };
|
||||
|
||||
const response = await fetch(`${API_URL}/billing/create-checkout-session`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${session.access_token}`,
|
||||
},
|
||||
body: JSON.stringify(request),
|
||||
body: JSON.stringify(requestBody),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
|
|
Loading…
Reference in New Issue