supermemory/apps/web/components/initial-header.tsx
MaheshtheDev ab068e2ba5 fix(web): restore Nova onboarding analytics events (#1023)
The onboarding rework moved the flow to app/(app)/onboarding and dropped the funnel tracking, so onboarding_completed stopped firing on 2026-05-02.

- Wire onboarding_step_viewed across idle/processing/done/error transitions
- Fire onboarding_completed on real completion (status=done) with source + memories_count
- onboarding_profile_submitted now carries { source }
- Add onboarding_skipped { from_step }
- Remove dead onboardingCompleted() from InitialHeader and unused name/relatable helpers
2026-05-29 19:54:13 +00:00

79 lines
2.1 KiB
TypeScript

"use client"
import { Logo } from "@ui/assets/Logo"
import { Button } from "@ui/components/button"
import { useRouter } from "next/navigation"
import { useOrgOnboarding } from "@hooks/use-org-onboarding"
import { consumePendingConnectUrl } from "@/lib/constants"
import { cn } from "@lib/utils"
export function InitialHeader({
showUserSupermemory,
showSkipOnboarding,
name,
}: {
showUserSupermemory?: boolean
showSkipOnboarding?: boolean
name?: string
}) {
const router = useRouter()
const { markOrgOnboarded, isLoading } = useOrgOnboarding()
const userName = name ? `${name.split(" ")[0]}'s` : "My"
const handleSkip = () => {
markOrgOnboarded()
const pendingPath = consumePendingConnectUrl()
router.push(pendingPath ?? "/")
}
return (
<div className="flex items-center justify-between p-4 sm:p-6">
<div className="flex items-center z-10! min-w-0">
<Logo className="h-6 sm:h-7 shrink-0" />
{showUserSupermemory ? (
<div className="flex flex-col items-start justify-center ml-2">
<p className="text-[#8B8B8B] text-[11px] leading-tight">
{userName}
</p>
<p className="text-white font-bold text-xl leading-none -mt-1">
supermemory
</p>
</div>
) : (
<p className="ml-2 truncate text-xl leading-none font-semibold text-white/90">
supermemory
</p>
)}
</div>
<div className="flex items-center gap-2 sm:gap-3 z-10! shrink-0">
{showSkipOnboarding && !isLoading && (
<button
type="button"
onClick={handleSkip}
className="text-sm text-white/40 hover:text-white/70 transition-colors cursor-pointer"
>
Skip Onboarding
</button>
)}
<Button
variant="newDefault"
className={cn(
"rounded-xl sm:rounded-2xl gap-1 h-9 sm:h-11 px-3 sm:px-4 text-sm sm:text-base",
)}
size="lg"
onClick={() =>
window.open(
"https://console.supermemory.ai",
"_blank",
"noopener,noreferrer",
)
}
>
<span className="sm:hidden">API</span>
<span className="hidden sm:inline">Memory API</span>{" "}
<span className="text-xs mt-[4px]"></span>
</Button>
</div>
</div>
)
}