"use client";
import type React from "react";
import type { CSSProperties, ReactNode } from "react";
import Link from "next/link";
import { motion } from "framer-motion";
import { X } from "lucide-react";
import { TeamPlanQuota } from "@/config/team";
import { cn, nFormatter } from "@/lib/utils";
import { Icons } from "../shared/icons";
import { Button } from "../ui/button";
const getBenefits = (plan) => [
{
text: `${nFormatter(plan.SL_TrackedClicks)} tracked clicks/mo`,
checked: true,
icon: ,
},
{
text: `${nFormatter(plan.SL_NewLinks)} new links/mo`,
checked: true,
icon: ,
},
{
text: `${plan.SL_AnalyticsRetention}-day analytics retention`,
checked: true,
icon: ,
},
{
text: `Customize short link QR code`,
checked: plan.SL_CustomQrCodeLogo,
icon: ,
},
{
text: `${nFormatter(plan.EM_EmailAddresses)} email addresses/mo`,
checked: true,
icon: ,
},
{
text: `${nFormatter(plan.EM_SendEmails)} send emails/mo`,
checked: true,
icon: ,
},
{
text: `${plan.SL_Domains === 1 ? "One" : plan.SL_Domains} domain${plan.SL_Domains > 1 ? "s" : ""}`,
checked: true,
icon: ,
},
{
text: "Advanced analytics",
checked: plan.SL_AdvancedAnalytics,
icon: ,
},
{
text: `${plan.APP_Support.charAt(0).toUpperCase() + plan.APP_Support.slice(1)} support`,
checked: true,
icon: ,
},
{
text: "Open API Access",
checked: plan.APP_ApiAccess,
icon: ,
},
];
export const PricingSection = () => {
return (
Pricing
Use it for free for yourself, upgrade when your team needs advanced
control.
}
benefits={getBenefits(TeamPlanQuota.free)}
/>
}
benefits={getBenefits(TeamPlanQuota.premium)}
/>
}
benefits={getBenefits(TeamPlanQuota.business)}
/>
);
};
const PriceCard = ({ tier, price, bestFor, CTA, benefits }: PriceCardProps) => {
return (
{tier}
{price}
{bestFor}
{benefits.map((b, i) => (
))}
{CTA}
);
};
const Benefit = ({ text, checked, icon }: BenefitType) => {
return (
{checked ? (
{icon}
) : (
)}
{text}
);
};
const Card = ({ className, children, style = {} }: CardProps) => {
return (
{children}
);
};
type PriceCardProps = {
tier: string;
price: string;
bestFor: string;
CTA: ReactNode;
benefits: BenefitType[];
};
type CardProps = {
className?: string;
children?: ReactNode;
style?: CSSProperties;
};
type BenefitType = {
text: string;
checked: boolean;
icon: ReactNode;
};