The Open Source DocuSign Alternative.
TypeScript digital-signaturedocument-signingdocusign-alternativee-signatureesignesignaturenext-authnextjsopen-sourcepades-standardpdfpdf-signpdf-signaturepostgresqlprismaself-hostedsigningtypescript
fix: build issues
Lucas Smith20e297673168
diff --git a/apps/marketing/content/blog/commodifying-signing.mdx b/apps/marketing/content/blog/commodifying-signing.mdxindex 0a9cf4050..2bf1b2799 100644--- a/apps/marketing/content/blog/commodifying-signing.mdx+++ b/apps/marketing/content/blog/commodifying-signing.mdx@@ -5,7 +5,7 @@ authorName: 'Timur Ercan'authorImage: '/blog/blog-author-timur.jpeg'authorRole: 'Co-Founder'date: 2024-01-25-Tags:+tags:- Vision- Mission- Open Sourcediff --git a/apps/marketing/content/blog/linear-gh.mdx b/apps/marketing/content/blog/linear-gh.mdxindex 1267931d6..fc5282851 100644--- a/apps/marketing/content/blog/linear-gh.mdx+++ b/apps/marketing/content/blog/linear-gh.mdx@@ -5,7 +5,7 @@ authorName: 'Timur Ercan'authorImage: '/blog/blog-author-timur.jpeg'authorRole: 'Co-Founder'date: 2024-01-10-Tags:+tags:- GitHub- Backlog- Roadmapdiff --git a/apps/marketing/content/blog/why-i-started-documenso.mdx b/apps/marketing/content/blog/why-i-started-documenso.mdxindex 2fceddd25..9ef83b8d1 100644--- a/apps/marketing/content/blog/why-i-started-documenso.mdx+++ b/apps/marketing/content/blog/why-i-started-documenso.mdx@@ -5,7 +5,7 @@ authorName: 'Timur Ercan'authorImage: '/blog/blog-author-timur.jpeg'authorRole: 'Co-Founder'date: 2024-02-06-Tags:+tags:- Founders- Mission- Open Sourcediff --git a/apps/marketing/src/app/(marketing)/[content]/page.tsx b/apps/marketing/src/app/(marketing)/[content]/page.tsxindex 62c83f400..ba23e6b81 100644--- a/apps/marketing/src/app/(marketing)/[content]/page.tsx+++ b/apps/marketing/src/app/(marketing)/[content]/page.tsx@@ -12,7 +12,7 @@ export const generateMetadata = ({ params }: { params: { content: string } }) =>const document = allDocuments.find((post) => post._raw.flattenedPath === params.content);if (!document) {- notFound();+ return { title: 'Not Found' };}return { title: document.title };diff --git a/apps/marketing/src/app/(marketing)/blog/[post]/page.tsx b/apps/marketing/src/app/(marketing)/blog/[post]/page.tsxindex 866539a92..495b8946e 100644--- a/apps/marketing/src/app/(marketing)/blog/[post]/page.tsx+++ b/apps/marketing/src/app/(marketing)/blog/[post]/page.tsx@@ -7,6 +7,8 @@ import { ChevronLeft } from 'lucide-react';import type { MDXComponents } from 'mdx/types';import { useMDXComponent } from 'next-contentlayer/hooks';+export const dynamic = 'force-dynamic';+export const generateStaticParams = () =>allBlogPosts.map((post) => ({ post: post._raw.flattenedPath }));@@ -14,7 +16,9 @@ export const generateMetadata = ({ params }: { params: { post: string } }) => {const blogPost = allBlogPosts.find((post) => post._raw.flattenedPath === `blog/${params.post}`);if (!blogPost) {- notFound();+ return {+ title: 'Not Found',+ };}return {diff --git a/apps/marketing/src/app/(marketing)/claimed/page.tsx b/apps/marketing/src/app/(marketing)/claimed/page.tsxindex 7f85b5d2e..730a99377 100644--- a/apps/marketing/src/app/(marketing)/claimed/page.tsx+++ b/apps/marketing/src/app/(marketing)/claimed/page.tsx@@ -13,6 +13,8 @@ import { Button } from '@documenso/ui/primitives/button';import { PasswordReveal } from '~/components/(marketing)/password-reveal';+export const dynamic = 'force-dynamic';+const fontCaveat = Caveat({weight: ['500'],subsets: ['latin'],diff --git a/apps/marketing/src/app/(marketing)/pricing/page.tsx b/apps/marketing/src/app/(marketing)/pricing/page.tsxindex e4c7b776a..d926ec675 100644--- a/apps/marketing/src/app/(marketing)/pricing/page.tsx+++ b/apps/marketing/src/app/(marketing)/pricing/page.tsx@@ -15,6 +15,8 @@ export const metadata: Metadata = {title: 'Pricing',};+export const dynamic = 'force-dynamic';+export type PricingPageProps = {searchParams?: {planId?: string;diff --git a/apps/marketing/src/app/(marketing)/singleplayer/page.tsx b/apps/marketing/src/app/(marketing)/singleplayer/page.tsxindex aafad32a8..5e8a07040 100644--- a/apps/marketing/src/app/(marketing)/singleplayer/page.tsx+++ b/apps/marketing/src/app/(marketing)/singleplayer/page.tsx@@ -7,6 +7,7 @@ export const metadata: Metadata = {};export const revalidate = 0;+export const dynamic = 'force-dynamic';// !: This entire file is a hack to get around failed prerendering of// !: the Single Player Mode page. This regression was introduced duringdiff --git a/apps/marketing/src/app/layout.tsx b/apps/marketing/src/app/layout.tsxindex 1745149c6..57da42c3f 100644--- a/apps/marketing/src/app/layout.tsx+++ b/apps/marketing/src/app/layout.tsx@@ -3,6 +3,7 @@ import { Suspense } from 'react';import { Caveat, Inter } from 'next/font/google';import { FeatureFlagProvider } from '@documenso/lib/client-only/providers/feature-flag';+import { NEXT_PUBLIC_MARKETING_URL } from '@documenso/lib/constants/app';import { getAllAnonymousFlags } from '@documenso/lib/universal/get-feature-flag';import { TrpcProvider } from '@documenso/trpc/react';import { cn } from '@documenso/ui/lib/utils';@@ -17,32 +18,35 @@ import './globals.css';const fontInter = Inter({ subsets: ['latin'], variable: '--font-sans' });const fontCaveat = Caveat({ subsets: ['latin'], variable: '--font-signature' });-export const metadata = {- title: {- template: '%s - Documenso',- default: 'Documenso',- },- description:- 'Join Documenso, the open signing infrastructure, and get a 10x better signing experience. Pricing starts at $30/mo. forever! Sign in now and enjoy a faster, smarter, and more beautiful document signing process. Integrates with your favorite tools, customizable, and expandable. Support our mission and become a part of our open-source community.',- keywords:- 'Documenso, open source, DocuSign alternative, document signing, open signing infrastructure, open-source community, fast signing, beautiful signing, smart templates',- authors: { name: 'Documenso, Inc.' },- robots: 'index, follow',- openGraph: {- title: 'Documenso - The Open Source DocuSign Alternative',+export function generateMetadata() {+ return {+ title: {+ template: '%s - Documenso',+ default: 'Documenso',+ },description:'Join Documenso, the open signing infrastructure, and get a 10x better signing experience. Pricing starts at $30/mo. forever! Sign in now and enjoy a faster, smarter, and more beautiful document signing process. Integrates with your favorite tools, customizable, and expandable. Support our mission and become a part of our open-source community.',- type: 'website',- images: [`${process.env.NEXT_PUBLIC_MARKETING_URL}/opengraph-image.jpg`],- },- twitter: {- site: '@documenso',- card: 'summary_large_image',- images: [`${process.env.NEXT_PUBLIC_MARKETING_URL}/opengraph-image.jpg`],- description:- 'Join Documenso, the open signing infrastructure, and get a 10x better signing experience. Pricing starts at $30/mo. forever! Sign in now and enjoy a faster, smarter, and more beautiful document signing process. Integrates with your favorite tools, customizable, and expandable. Support our mission and become a part of our open-source community.',- },-};+ keywords:+ 'Documenso, open source, DocuSign alternative, document signing, open signing infrastructure, open-source community, fast signing, beautiful signing, smart templates',+ authors: { name: 'Documenso, Inc.' },+ robots: 'index, follow',+ metadataBase: new URL(NEXT_PUBLIC_MARKETING_URL() ?? 'http://localhost:3000'),+ openGraph: {+ title: 'Documenso - The Open Source DocuSign Alternative',+ description:+ 'Join Documenso, the open signing infrastructure, and get a 10x better signing experience. Pricing starts at $30/mo. forever! Sign in now and enjoy a faster, smarter, and more beautiful document signing process. Integrates with your favorite tools, customizable, and expandable. Support our mission and become a part of our open-source community.',+ type: 'website',+ images: ['/opengraph-image.jpg'],+ },+ twitter: {+ site: '@documenso',+ card: 'summary_large_image',+ images: ['/opengraph-image.jpg'],+ description:+ 'Join Documenso, the open signing infrastructure, and get a 10x better signing experience. Pricing starts at $30/mo. forever! Sign in now and enjoy a faster, smarter, and more beautiful document signing process. Integrates with your favorite tools, customizable, and expandable. Support our mission and become a part of our open-source community.',+ },+ };+}export default async function RootLayout({ children }: { children: React.ReactNode }) {const flags = await getAllAnonymousFlags();diff --git a/apps/web/src/app/(share)/share/[slug]/page.tsx b/apps/web/src/app/(share)/share/[slug]/page.tsxindex 80d991934..efcd75a41 100644--- a/apps/web/src/app/(share)/share/[slug]/page.tsx+++ b/apps/web/src/app/(share)/share/[slug]/page.tsx@@ -2,7 +2,7 @@ import type { Metadata } from 'next';import { headers } from 'next/headers';import { redirect } from 'next/navigation';-import { APP_BASE_URL, NEXT_PUBLIC_MARKETING_URL } from '@documenso/lib/constants/app';+import { NEXT_PUBLIC_MARKETING_URL } from '@documenso/lib/constants/app';type SharePageProps = {params: { slug: string };@@ -16,12 +16,12 @@ export function generateMetadata({ params: { slug } }: SharePageProps) {title: 'Documenso - Join the open source signing revolution',description: 'I just signed with Documenso!',type: 'website',- images: [`${APP_BASE_URL()}/share/${slug}/opengraph`],+ images: [`/share/${slug}/opengraph`],},twitter: {site: '@documenso',card: 'summary_large_image',- images: [`${APP_BASE_URL()}/share/${slug}/opengraph`],+ images: [`/share/${slug}/opengraph`],description: 'I just signed with Documenso!',},} satisfies Metadata;diff --git a/apps/web/src/app/(unauthenticated)/signin/page.tsx b/apps/web/src/app/(unauthenticated)/signin/page.tsxindex 71a558bc0..50356a5bb 100644--- a/apps/web/src/app/(unauthenticated)/signin/page.tsx+++ b/apps/web/src/app/(unauthenticated)/signin/page.tsx@@ -21,7 +21,7 @@ type SignInPageProps = {export default function SignInPage({ searchParams }: SignInPageProps) {const NEXT_PUBLIC_DISABLE_SIGNUP = env('NEXT_PUBLIC_DISABLE_SIGNUP');-+const rawEmail = typeof searchParams.email === 'string' ? searchParams.email : undefined;const email = rawEmail ? decryptSecondaryData(rawEmail) : null;diff --git a/apps/web/src/app/layout.tsx b/apps/web/src/app/layout.tsxindex 606aa0f10..7753e1e53 100644--- a/apps/web/src/app/layout.tsx+++ b/apps/web/src/app/layout.tsx@@ -22,32 +22,35 @@ import './globals.css';const fontInter = Inter({ subsets: ['latin'], variable: '--font-sans' });const fontCaveat = Caveat({ subsets: ['latin'], variable: '--font-signature' });-export const metadata = {- title: {- template: '%s - Documenso',- default: 'Documenso',- },- description:- 'Join Documenso, the open signing infrastructure, and get a 10x better signing experience. Pricing starts at $30/mo. forever! Sign in now and enjoy a faster, smarter, and more beautiful document signing process. Integrates with your favorite tools, customizable, and expandable. Support our mission and become a part of our open-source community.',- keywords:- 'Documenso, open source, DocuSign alternative, document signing, open signing infrastructure, open-source community, fast signing, beautiful signing, smart templates',- authors: { name: 'Documenso, Inc.' },- robots: 'index, follow',- openGraph: {- title: 'Documenso - The Open Source DocuSign Alternative',+export function generateMetadata() {+ return {+ title: {+ template: '%s - Documenso',+ default: 'Documenso',+ },description:'Join Documenso, the open signing infrastructure, and get a 10x better signing experience. Pricing starts at $30/mo. forever! Sign in now and enjoy a faster, smarter, and more beautiful document signing process. Integrates with your favorite tools, customizable, and expandable. Support our mission and become a part of our open-source community.',- type: 'website',- images: [`${NEXT_PUBLIC_WEBAPP_URL()}/opengraph-image.jpg`],- },- twitter: {- site: '@documenso',- card: 'summary_large_image',- images: [`${NEXT_PUBLIC_WEBAPP_URL()}/opengraph-image.jpg`],- description:- 'Join Documenso, the open signing infrastructure, and get a 10x better signing experience. Pricing starts at $30/mo. forever! Sign in now and enjoy a faster, smarter, and more beautiful document signing process. Integrates with your favorite tools, customizable, and expandable. Support our mission and become a part of our open-source community.',- },-};+ keywords:+ 'Documenso, open source, DocuSign alternative, document signing, open signing infrastructure, open-source community, fast signing, beautiful signing, smart templates',+ authors: { name: 'Documenso, Inc.' },+ robots: 'index, follow',+ metadataBase: new URL(NEXT_PUBLIC_WEBAPP_URL() ?? 'http://localhost:3000'),+ openGraph: {+ title: 'Documenso - The Open Source DocuSign Alternative',+ description:+ 'Join Documenso, the open signing infrastructure, and get a 10x better signing experience. Pricing starts at $30/mo. forever! Sign in now and enjoy a faster, smarter, and more beautiful document signing process. Integrates with your favorite tools, customizable, and expandable. Support our mission and become a part of our open-source community.',+ type: 'website',+ images: ['/opengraph-image.jpg'],+ },+ twitter: {+ site: '@documenso',+ card: 'summary_large_image',+ images: ['/opengraph-image.jpg'],+ description:+ 'Join Documenso, the open signing infrastructure, and get a 10x better signing experience. Pricing starts at $30/mo. forever! Sign in now and enjoy a faster, smarter, and more beautiful document signing process. Integrates with your favorite tools, customizable, and expandable. Support our mission and become a part of our open-source community.',+ },+ };+}export default async function RootLayout({ children }: { children: React.ReactNode }) {const flags = await getServerComponentAllFlags();diff --git a/apps/web/src/components/(teams)/dialogs/transfer-team-dialog.tsx b/apps/web/src/components/(teams)/dialogs/transfer-team-dialog.tsxindex e5dd8ca17..fb2d1bdfd 100644--- a/apps/web/src/components/(teams)/dialogs/transfer-team-dialog.tsx+++ b/apps/web/src/components/(teams)/dialogs/transfer-team-dialog.tsx@@ -238,7 +238,7 @@ export const TransferTeamDialog = ({<Alert variant="neutral"><AlertDescription><ul className="list-outside list-disc space-y-2 pl-4">- {IS_BILLING_ENABLED && (+ {IS_BILLING_ENABLED() && (// Temporary removed.// <li>// {form.getValues('clearPaymentMethods')diff --git a/apps/web/src/components/(teams)/settings/layout/desktop-nav.tsx b/apps/web/src/components/(teams)/settings/layout/desktop-nav.tsxindex be68f6c03..98df7416e 100644--- a/apps/web/src/components/(teams)/settings/layout/desktop-nav.tsx+++ b/apps/web/src/components/(teams)/settings/layout/desktop-nav.tsx@@ -48,7 +48,7 @@ export const DesktopNav = ({ className, ...props }: DesktopNavProps) => {</Button></Link>- {IS_BILLING_ENABLED && (+ {IS_BILLING_ENABLED() && (<Link href={billingPath}><Buttonvariant="ghost"diff --git a/apps/web/src/components/(teams)/settings/layout/mobile-nav.tsx b/apps/web/src/components/(teams)/settings/layout/mobile-nav.tsxindex de01ca9bf..cb46be105 100644--- a/apps/web/src/components/(teams)/settings/layout/mobile-nav.tsx+++ b/apps/web/src/components/(teams)/settings/layout/mobile-nav.tsx@@ -56,7 +56,7 @@ export const MobileNav = ({ className, ...props }: MobileNavProps) => {</Button></Link>- {IS_BILLING_ENABLED && (+ {IS_BILLING_ENABLED() && (<Link href={billingPath}><Buttonvariant="ghost"diff --git a/packages/ee/server-only/limits/server.ts b/packages/ee/server-only/limits/server.tsindex e48eb7187..4904f0271 100644--- a/packages/ee/server-only/limits/server.ts+++ b/packages/ee/server-only/limits/server.ts@@ -16,7 +16,7 @@ export type GetServerLimitsOptions = {};export const getServerLimits = async ({ email, teamId }: GetServerLimitsOptions) => {- if (!IS_BILLING_ENABLED) {+ if (!IS_BILLING_ENABLED()) {return {quota: SELFHOSTED_PLAN_LIMITS,remaining: SELFHOSTED_PLAN_LIMITS,diff --git a/packages/lib/constants/app.ts b/packages/lib/constants/app.tsindex 2355c4b07..1adb4effb 100644--- a/packages/lib/constants/app.ts+++ b/packages/lib/constants/app.ts@@ -9,7 +9,7 @@ export const NEXT_PUBLIC_MARKETING_URL = () => env('NEXT_PUBLIC_MARKETING_URL');export const IS_APP_MARKETING = () => NEXT_PUBLIC_PROJECT() === 'marketing';export const IS_APP_WEB = () => NEXT_PUBLIC_PROJECT() === 'web';-export const IS_BILLING_ENABLED = () => env('NEXT_PUBLIC_FEATURE_BILLING_ENABLED');+export const IS_BILLING_ENABLED = () => env('NEXT_PUBLIC_FEATURE_BILLING_ENABLED') === 'true';export const APP_FOLDER = () => (IS_APP_MARKETING() ? 'marketing' : 'web');diff --git a/packages/lib/server-only/document/send-document.tsx b/packages/lib/server-only/document/send-document.tsxindex 5f0fe8557..25c56f547 100644--- a/packages/lib/server-only/document/send-document.tsx+++ b/packages/lib/server-only/document/send-document.tsx@@ -8,9 +8,8 @@ import { renderCustomEmailTemplate } from '@documenso/lib/utils/render-custom-emimport { prisma } from '@documenso/prisma';import { DocumentStatus, RecipientRole, SendStatus } from '@documenso/prisma/client';-import { RECIPIENT_ROLES_DESCRIPTION } from '../../constants/recipient-roles';-import { NEXT_PUBLIC_WEBAPP_URL } from '../../constants/app';+import { RECIPIENT_ROLES_DESCRIPTION } from '../../constants/recipient-roles';export type SendDocumentOptions = {documentId: number;@@ -76,10 +75,6 @@ export const sendDocument = async ({ documentId, userId }: SendDocumentOptions)'document.name': document.title,};- if (recipient.sendStatus === SendStatus.SENT) {- return;- }-const assetBaseUrl = NEXT_PUBLIC_WEBAPP_URL() || 'http://localhost:3000';const signDocumentLink = `${NEXT_PUBLIC_WEBAPP_URL()}/sign/${recipient.token}`;diff --git a/packages/lib/server-only/team/accept-team-invitation.ts b/packages/lib/server-only/team/accept-team-invitation.tsindex a69a79ecd..4bfd31dfa 100644--- a/packages/lib/server-only/team/accept-team-invitation.ts+++ b/packages/lib/server-only/team/accept-team-invitation.ts@@ -46,7 +46,7 @@ export const acceptTeamInvitation = async ({ userId, teamId }: AcceptTeamInvitat},});- if (IS_BILLING_ENABLED && team.subscription) {+ if (IS_BILLING_ENABLED() && team.subscription) {const numberOfSeats = await tx.teamMember.count({where: {teamId: teamMemberInvite.teamId,diff --git a/packages/lib/server-only/team/create-team-billing-portal.ts b/packages/lib/server-only/team/create-team-billing-portal.tsindex d394f2720..3c96b4e8c 100644--- a/packages/lib/server-only/team/create-team-billing-portal.ts+++ b/packages/lib/server-only/team/create-team-billing-portal.ts@@ -12,7 +12,7 @@ export const createTeamBillingPortal = async ({userId,teamId,}: CreateTeamBillingPortalOptions) => {- if (!IS_BILLING_ENABLED) {+ if (!IS_BILLING_ENABLED()) {throw new Error('Billing is not enabled');}diff --git a/packages/lib/server-only/team/create-team.ts b/packages/lib/server-only/team/create-team.tsindex f1d245523..4d26a161a 100644--- a/packages/lib/server-only/team/create-team.ts+++ b/packages/lib/server-only/team/create-team.ts@@ -57,10 +57,10 @@ export const createTeam = async ({},});- let isPaymentRequired = IS_BILLING_ENABLED;+ let isPaymentRequired = IS_BILLING_ENABLED();let customerId: string | null = null;- if (IS_BILLING_ENABLED) {+ if (IS_BILLING_ENABLED()) {const communityPlanPriceIds = await getCommunityPlanPriceIds();isPaymentRequired = !subscriptionsContainsActiveCommunityPlan(diff --git a/packages/lib/server-only/team/delete-team-members.ts b/packages/lib/server-only/team/delete-team-members.tsindex 7e282af5a..162d7de53 100644--- a/packages/lib/server-only/team/delete-team-members.ts+++ b/packages/lib/server-only/team/delete-team-members.ts@@ -85,7 +85,7 @@ export const deleteTeamMembers = async ({},});- if (IS_BILLING_ENABLED && team.subscription) {+ if (IS_BILLING_ENABLED() && team.subscription) {const numberOfSeats = await tx.teamMember.count({where: {teamId,diff --git a/packages/lib/server-only/team/leave-team.ts b/packages/lib/server-only/team/leave-team.tsindex d0c6fe145..509c38950 100644--- a/packages/lib/server-only/team/leave-team.ts+++ b/packages/lib/server-only/team/leave-team.ts@@ -42,7 +42,7 @@ export const leaveTeam = async ({ userId, teamId }: LeaveTeamOptions) => {},});- if (IS_BILLING_ENABLED && team.subscription) {+ if (IS_BILLING_ENABLED() && team.subscription) {const numberOfSeats = await tx.teamMember.count({where: {teamId,diff --git a/packages/lib/server-only/team/transfer-team-ownership.ts b/packages/lib/server-only/team/transfer-team-ownership.tsindex bb14eec55..7b886d323 100644--- a/packages/lib/server-only/team/transfer-team-ownership.ts+++ b/packages/lib/server-only/team/transfer-team-ownership.ts@@ -49,7 +49,7 @@ export const transferTeamOwnership = async ({ token }: TransferTeamOwnershipOptilet teamSubscription: Stripe.Subscription | null = null;- if (IS_BILLING_ENABLED) {+ if (IS_BILLING_ENABLED()) {teamSubscription = await transferTeamSubscription({user: newOwnerUser,team,diff --git a/packages/lib/server-only/user/create-user.ts b/packages/lib/server-only/user/create-user.tsindex 42a9f128c..9a40696db 100644--- a/packages/lib/server-only/user/create-user.ts+++ b/packages/lib/server-only/user/create-user.ts@@ -68,7 +68,7 @@ export const createUser = async ({ name, email, password, signature }: CreateUse},});- if (!IS_BILLING_ENABLED) {+ if (!IS_BILLING_ENABLED()) {return;}@@ -108,7 +108,7 @@ export const createUser = async ({ name, email, password, signature }: CreateUse);// Update the user record with a new or existing Stripe customer record.- if (IS_BILLING_ENABLED) {+ if (IS_BILLING_ENABLED()) {try {return await getStripeCustomerByUser(user).then((session) => session.user);} catch (err) {