From b5f95a8abcd6f14df675cb4bc131e9036d185169 Mon Sep 17 00:00:00 2001 From: Usman Baig Date: Sun, 8 Feb 2026 14:42:52 +0100 Subject: [PATCH] feat: add integration setup options and script copying functionality to welcome page --- app/welcome/page.tsx | 102 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 94 insertions(+), 8 deletions(-) diff --git a/app/welcome/page.tsx b/app/welcome/page.tsx index f182db3..691780a 100644 --- a/app/welcome/page.tsx +++ b/app/welcome/page.tsx @@ -21,6 +21,8 @@ import { createSite, type Site } from '@/lib/api/sites' import { setSessionAction } from '@/app/actions/auth' import { useAuth } from '@/lib/auth/context' import { getAuthErrorMessage } from '@/lib/utils/authErrors' +import { API_URL, APP_URL } from '@/lib/api/client' +import { integrations, getIntegration } from '@/lib/integrations' import { trackWelcomeStepView, trackWelcomeWorkspaceSelected, @@ -35,6 +37,7 @@ import { LoadingOverlay, Button, Input } from '@ciphera-net/ui' import { toast } from '@ciphera-net/ui' import { CheckCircleIcon, + CheckIcon, ArrowRightIcon, ArrowLeftIcon, BarChartIcon, @@ -104,6 +107,9 @@ function WelcomeContent() { const [orgsLoading, setOrgsLoading] = useState(false) const [switchingOrgId, setSwitchingOrgId] = useState(null) + const [selectedIntegrationSlug, setSelectedIntegrationSlug] = useState(null) + const [scriptCopied, setScriptCopied] = useState(false) + const setStep = useCallback( (next: number) => { const s = Math.min(Math.max(1, next), TOTAL_STEPS) @@ -264,6 +270,17 @@ function WelcomeContent() { } const goToSite = () => createdSite && router.push(`/sites/${createdSite.id}`) + const copyScript = useCallback(() => { + if (!createdSite) return + const script = `` + navigator.clipboard.writeText(script) + setScriptCopied(true) + toast.success('Script copied to clipboard') + setTimeout(() => setScriptCopied(false), 2000) + }, [createdSite]) + + const popularIntegrations = integrations.filter((i) => i.category === 'framework').slice(0, 10) + const showPendingCheckoutInStep3 = hadPendingCheckout === true && !dismissedPendingCheckout @@ -688,16 +705,85 @@ function WelcomeContent() { ? `"${createdSite.name}" is ready. Add the script to your site to start collecting data.` : 'Head to your dashboard to add sites and view analytics.'}

-
- - {createdSite && ( - +
+ + {createdSite && ( +
+

+ Add the script to your site +

+

+ Choose your framework for setup instructions. +

+
+ {popularIntegrations.map((int) => ( + + ))} +
+

+ + View all integrations → + +

+ +
+ + {``} + + +
+ {selectedIntegrationSlug && getIntegration(selectedIntegrationSlug) && ( +

+ + See full {getIntegration(selectedIntegrationSlug)!.name} guide → + +

)}
+ )} + +
+ + {createdSite && ( + + )}
)}