"use client"; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"; import { cn } from "@/lib/utils"; import * as SliderPrimitive from "@radix-ui/react-slider"; import { HelpCircle, KeySquare, ListChecks } from "lucide-react"; import React, { useState } from "react"; import { SectionTitle } from "../../section-title"; import { Bullet, Color, Cost, FreeCardHighlight, PricingCard, PricingCardContent, PricingCardFooter, PricingCardHeader, Separator, } from "./components"; import { SubDiscoverySvg } from "./svgs"; const activeKeysSteps = [250, 1_000, 2_000, 5_000, 10_000, 50_000, 100_000, null]; const verificationsSteps = [ 150_000, 250_000, 500_000, 1_000_000, 10_000_000, 100_000_000, 1_000_000_000, null, ]; export const Discover: React.FC = () => { const [activeKeysIndex, setActiveKeysIndex] = useState(0); const activeKeys = activeKeysSteps[activeKeysIndex]; const billableKeys = Math.max(0, (activeKeys ?? 0) - 250); const activeKeysCost = billableKeys * 0.1; const activeKeysQuantityDisplay = fmtNumber(activeKeys ?? Number.POSITIVE_INFINITY); const activeKeysCostDisplay = activeKeys === null ? "Custom" : fmtDollar(activeKeysCost); const [verificationsIndex, setVerificationsIndex] = useState(0); const verifications = verificationsSteps[verificationsIndex]; const billableVerifications = Math.max(0, (verifications ?? 0) - 150_000); const verificationsCost = (billableVerifications * 10) / 100_000; const verificationsQuantityDisplay = fmtNumber(verifications ?? Number.POSITIVE_INFINITY); const verificationsCostDisplay = verifications === null ? "Custom" : fmtDollar(verificationsCost); const totalCostDisplay = verifications === null || activeKeys === null ? "Custom" : fmtDollar(25 + activeKeysCost + verificationsCost); return (
Discover your pricing.
Pay only what matters to you } text={ <> Find out exactly hwat your investment will be on Unkey, with our estimated cost calculator.
Explore the cost per active key and key verifications. } />

Cost break down:

{fmtDollar(25)} Base Plan {activeKeysCostDisplay} Active Keys {verificationsCostDisplay} Verifications

Resources are summed and billed monthly

} slider={ setActiveKeysIndex(v)} /> } quantity={
{activeKeysQuantityDisplay} Keys
} cost={} /> } slider={ setVerificationsIndex(v)} /> } quantity={
{verificationsQuantityDisplay} Verifications
} cost={} />
{" "}
); }; const Row: React.FC<{ label: React.ReactNode; slider: React.ReactNode; quantity: React.ReactNode; cost: React.ReactNode; }> = ({ label, slider, quantity, cost }) => { return (
{label}
{slider}
{quantity}
{cost}
); }; function fmtNumber(n: number): string { return Intl.NumberFormat(undefined, { notation: "compact" }).format(n); } function fmtDollar(n: number): string { return Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(n); } const PriceTag: React.FC<{ dollar: string }> = ({ dollar }) => { return (
{dollar}
); }; const Slider = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef >(({ className, ...props }, ref) => ( )); Slider.displayName = SliderPrimitive.Root.displayName;