import { Caveat } from 'next/font/google'; import Link from 'next/link'; import { redirect } from 'next/navigation'; import { ArrowRight } from 'lucide-react'; import { redis } from '@documenso/lib/server-only/redis'; import { stripe } from '@documenso/lib/server-only/stripe'; import { prisma } from '@documenso/prisma'; import { cn } from '@documenso/ui/lib/utils'; import { Button } from '@documenso/ui/primitives/button'; import { PasswordReveal } from '~/components/(marketing)/password-reveal'; const fontCaveat = Caveat({ weight: ['500'], subsets: ['latin'], display: 'swap', }); export type ClaimedPlanPageProps = { searchParams?: { sessionId?: string; }; }; export default async function ClaimedPlanPage({ searchParams = {} }: ClaimedPlanPageProps) { const { sessionId } = searchParams; if (typeof sessionId !== 'string') { redirect('/'); } const session = await stripe.checkout.sessions.retrieve(sessionId); const customerId = typeof session.customer === 'string' ? session.customer : session.customer?.id; if (!customerId) { redirect('/'); } const customer = await stripe.customers.retrieve(customerId); if (!customer || customer.deleted) { redirect('/'); } const user = await prisma.user.findFirst({ where: { id: Number(customer.metadata.userId), }, }); if (!user) { redirect('/'); } const signatureText = session.metadata?.signatureText || user.name; let signatureDataUrl = ''; if (session.metadata?.signatureDataUrl) { const result = await redis.get(`signature:${session.metadata.signatureDataUrl}`); if (result) { signatureDataUrl = result; } } const password = await redis.get(`user:${user.id}:temp-password`); return (

Welcome to the open signing revolution{' '} {user.name}

It's not every day you get to be part of a revolution.

But today is that day, by signing up to Documenso, you're joining a movement of people who want to make the world a better place.

We're going to change the way people sign documents. We're going to make it easier, faster, and more secure. And we're going to do it together.

Let's do it together

Timur

Timur Ercan - Co Founder

Lucas

Lucas Smith - Co Founder

{signatureDataUrl && ( your-signature )} {!signatureDataUrl && (

{signatureText}

)}

{user.name} - Our new favourite customer

Your sign in details

Email: {user.email}

Password:{' '}

This is a temporary password. Please change it as soon as possible.

); }