@@ -18,6 +18,8 @@ import { BetweenHorizonalStart, GitBranchIcon, LockIcon } from "lucide-react";
1818import { hasEntitlement } from "@sourcebot/shared" ;
1919import { env } from "@/env.mjs" ;
2020import { GcpIapAuth } from "@/app/[domain]/components/gcpIapAuth" ;
21+ import { headers } from "next/headers" ;
22+ import { getBaseUrl , createInviteLink } from "@/lib/utils" ;
2123
2224interface OnboardingProps {
2325 searchParams ?: { step ?: string } ;
@@ -47,6 +49,11 @@ export default async function Onboarding({ searchParams }: OnboardingProps) {
4749 return < div > Error loading organization</ div > ;
4850 }
4951
52+ // Get the current URL to construct the full invite link
53+ const headersList = headers ( ) ;
54+ const baseUrl = getBaseUrl ( headersList ) ;
55+ const inviteLink = createInviteLink ( baseUrl , org . inviteLinkId ) ;
56+
5057 if ( org && org . isOnboarded ) {
5158 redirect ( '/' ) ;
5259 }
@@ -149,7 +156,7 @@ export default async function Onboarding({ searchParams }: OnboardingProps) {
149156 subtitle : "Set up your organization's security settings." ,
150157 component : (
151158 < div className = "space-y-6" >
152- < MemberApprovalRequiredToggle memberApprovalRequired = { org . memberApprovalRequired } inviteLinkEnabled = { org . inviteLinkEnabled } inviteLinkId = { org . inviteLinkId } />
159+ < MemberApprovalRequiredToggle memberApprovalRequired = { org . memberApprovalRequired } inviteLinkEnabled = { org . inviteLinkEnabled } inviteLink = { inviteLink } />
153160 < Button asChild className = "w-full h-11 bg-primary hover:bg-primary/90 text-primary-foreground transition-all duration-200 font-medium" >
154161 < a href = "/onboard?step=3" > Continue →</ a >
155162 </ Button >
0 commit comments