import { Dialog, Transition } from "@headlessui/react"; import { Fragment, useState } from "react"; import { useAtom } from "jotai"; import paywallAtom from "~/atoms/paywallAtom"; import { CloseIcon } from "next/dist/client/components/react-dev-overlay/internal/icons/CloseIcon"; import { api } from "~/utils/api"; import { useRouter } from "next/router"; import { CheckIcon } from "@heroicons/react/20/solid"; import Tooltip from "~/components/Tooltip"; import { usePostHog } from "posthog-js/react"; import recordVideoModalOpen from "~/atoms/recordVideoModalOpen"; export default function Paywall() { const [recordModalOpen] = useAtom(recordVideoModalOpen); const { mutateAsync: createCheckoutSession } = api.stripe.createCheckoutSession.useMutation(); const router = useRouter(); const [open, setOpen] = useAtom(paywallAtom); const [billedAnnually, setBilledAnnually] = useState(true); const posthog = usePostHog(); function closeModal() { setOpen(false); posthog?.capture("close paywall"); } const handleCheckout = async () => { const { checkoutUrl } = await createCheckoutSession({ billedAnnually }); if (checkoutUrl) { if (recordModalOpen) { window.open(checkoutUrl, "_blank", "noreferrer,width=500,height=500"); } else { void router.push(checkoutUrl); } } }; const toggleBillingCycle = () => { setBilledAnnually(!billedAnnually); posthog?.capture("change billing cycle"); }; return (

Upgrade your plan

Replace unnecessary meetings that leave you with limited time to focus on more valuable things.

No contract. Cancel any time

Monthly Annually 20% Off
Pro
{billedAnnually ? "$8" : "$10"} / mo.
{billedAnnually ? "billed annually" : "billed monthly"}
{[ { feature: "Unlimited recordings", description: "Make and store unlimited recordings of your tab, desktop, and any application.", }, { feature: "Video download", description: "Download your recorded videos for offline viewing or sharing with others.", }, { feature: "External video upload", description: "Upload videos recorded using other tools or platforms to your Snapify library.", }, ].map(({ feature, description }) => (
{feature}
))}
); }