Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
feat: migrate from www to app
Marc Seitz310c813c5ceb
diff --git a/.env.example b/.env.exampleindex c9bcc4ba..da1ef7e6 100644--- a/.env.example+++ b/.env.example@@ -12,6 +12,7 @@ GOOGLE_CLIENT_ID=GOOGLE_CLIENT_SECRET=NEXT_PUBLIC_BASE_URL=http://localhost:3000+NEXT_PUBLIC_MARKETING_URL=http://localhost:3000# This variable is from Resend to send emailsRESEND_API_KEY=diff --git a/components/documents/add-document-modal.tsx b/components/documents/add-document-modal.tsxindex ce4bab05..79332feb 100644--- a/components/documents/add-document-modal.tsx+++ b/components/documents/add-document-modal.tsx@@ -138,7 +138,7 @@ export function AddDocumentModal({if (!newVersion) {// copy the link to the clipboardcopyToClipboard(- `${process.env.NEXT_PUBLIC_BASE_URL}/view/${document.links[0].id}`,+ `${process.env.NEXT_PUBLIC_MARKETING_URL}/view/${document.links[0].id}`,"Document uploaded and link copied to clipboard. Redirecting to document page...",);@@ -309,7 +309,7 @@ export function AddDocumentModal({if (!newVersion) {// copy the link to the clipboardcopyToClipboard(- `${process.env.NEXT_PUBLIC_BASE_URL}/view/${document.links[0].id}`,+ `${process.env.NEXT_PUBLIC_MARKETING_URL}/view/${document.links[0].id}`,"Notion Page processed and link copied to clipboard. Redirecting to document page...",);diff --git a/components/documents/document-card.tsx b/components/documents/document-card.tsxindex 25125a5d..515681c2 100644--- a/components/documents/document-card.tsx+++ b/components/documents/document-card.tsx@@ -63,7 +63,7 @@ export default function DocumentsCard({function handleCopyToClipboard(id: string) {copyToClipboard(- `${process.env.NEXT_PUBLIC_BASE_URL}/view/${id}`,+ `${process.env.NEXT_PUBLIC_MARKETING_URL}/view/${id}`,"Link copied to clipboard.",);}diff --git a/components/emails/deleted-domain.tsx b/components/emails/deleted-domain.tsxindex 2ce49684..1a376d90 100644--- a/components/emails/deleted-domain.tsx+++ b/components/emails/deleted-domain.tsx@@ -43,7 +43,7 @@ export default function DomainDeleted({<Section className="my-8 text-center"><ButtonclassName="rounded bg-black text-center text-xs font-semibold text-white no-underline"- href={`https://www.papermark.io/settings/domains`}+ href={`https://app.papermark.io/settings/domains`}style={{ padding: "12px 20px" }}>Set up your custom domaindiff --git a/components/emails/invalid-domain.tsx b/components/emails/invalid-domain.tsxindex 5d939443..6825b2d3 100644--- a/components/emails/invalid-domain.tsx+++ b/components/emails/invalid-domain.tsx@@ -51,7 +51,7 @@ export default function InvalidDomain({<Section className="my-8 text-center"><ButtonclassName="rounded bg-black text-center text-xs font-semibold text-white no-underline"- href={`https://www.papermark.io/settings/domains`}+ href={`https://app.papermark.io/settings/domains`}style={{ padding: "12px 20px" }}>Configure domain@@ -60,7 +60,7 @@ export default function InvalidDomain({<Text className="text-sm leading-6 text-black">If you do not want to keep this domain on Papermark, you can{" "}<Link- href={`https://www.papermark.io/settings/domains`}+ href={`https://app.papermark.io/settings/domains`}className="font-medium text-blue-600 no-underline">delete itdiff --git a/components/emails/onboarding-1.tsx b/components/emails/onboarding-1.tsxindex b89eeb95..b5912a04 100644--- a/components/emails/onboarding-1.tsx+++ b/components/emails/onboarding-1.tsx@@ -53,7 +53,7 @@ const Onboarding1Email = () => {<Section className="mb-[32px] mt-[32px] text-center"><ButtonclassName="rounded bg-black text-center text-xs font-semibold text-white no-underline"- href={`https://www.papermark.io/documents?utm_source=onboarding&utm_medium=email&utm_campaign=20240723&utm_content=upload_documents`}+ href={`https://app.papermark.io/documents?utm_source=onboarding&utm_medium=email&utm_campaign=20240723&utm_content=upload_documents`}style={{ padding: "12px 20px" }}>Upload my documentsdiff --git a/components/emails/onboarding-2.tsx b/components/emails/onboarding-2.tsxindex 7ccae0d3..40d2c9af 100644--- a/components/emails/onboarding-2.tsx+++ b/components/emails/onboarding-2.tsx@@ -51,7 +51,7 @@ const Onboarding2Email = () => {<Section className="mb-[32px] mt-[32px] text-center"><ButtonclassName="rounded bg-black text-center text-xs font-semibold text-white no-underline"- href={`https://www.papermark.io/documents?utm_source=onboarding&utm_medium=email&utm_campaign=20240723&utm_content=upload_documents`}+ href={`https://app.papermark.io/documents?utm_source=onboarding&utm_medium=email&utm_campaign=20240723&utm_content=upload_documents`}style={{ padding: "12px 20px" }}>To my link settingsdiff --git a/components/emails/onboarding-3.tsx b/components/emails/onboarding-3.tsxindex 40a51df2..e06a88ea 100644--- a/components/emails/onboarding-3.tsx+++ b/components/emails/onboarding-3.tsx@@ -54,7 +54,7 @@ const Onboarding3Email = () => {<Section className="mb-[32px] mt-[32px] text-center"><ButtonclassName="rounded bg-black text-center text-xs font-semibold text-white no-underline"- href={`https://www.papermark.io/documents?utm_source=onboarding&utm_medium=email&utm_campaign=20240723&utm_content=upload_documents`}+ href={`https://app.papermark.io/documents?utm_source=onboarding&utm_medium=email&utm_campaign=20240723&utm_content=upload_documents`}style={{ padding: "12px 20px" }}>View your document activitydiff --git a/components/emails/onboarding-4.tsx b/components/emails/onboarding-4.tsxindex 1d709079..cbf30190 100644--- a/components/emails/onboarding-4.tsx+++ b/components/emails/onboarding-4.tsx@@ -53,7 +53,7 @@ const Onboarding4Email = () => {<Section className="mb-[32px] mt-[32px] text-center"><ButtonclassName="rounded bg-black text-center text-xs font-semibold text-white no-underline"- href={`https://www.papermark.io/documents?utm_source=onboarding&utm_medium=email&utm_campaign=20240723&utm_content=upload_documents`}+ href={`https://app.papermark.io/documents?utm_source=onboarding&utm_medium=email&utm_campaign=20240723&utm_content=upload_documents`}style={{ padding: "12px 20px" }}>Add your domain and brandingdiff --git a/components/emails/onboarding-5.tsx b/components/emails/onboarding-5.tsxindex 218bb223..28ca5301 100644--- a/components/emails/onboarding-5.tsx+++ b/components/emails/onboarding-5.tsx@@ -60,7 +60,7 @@ const Onboarding3Email = () => {<Section className="mb-[32px] mt-[32px] text-center"><ButtonclassName="rounded bg-black text-center text-xs font-semibold text-white no-underline"- href={`https://www.papermark.io/documents?utm_source=onboarding&utm_medium=email&utm_campaign=20240723&utm_content=upload_documents`}+ href={`https://app.papermark.io/documents?utm_source=onboarding&utm_medium=email&utm_campaign=20240723&utm_content=upload_documents`}style={{ padding: "12px 20px" }}>Create new data roomdiff --git a/components/emails/trial-end-final-reminder.tsx b/components/emails/trial-end-final-reminder.tsxindex c7a9af42..745b6a18 100644--- a/components/emails/trial-end-final-reminder.tsx+++ b/components/emails/trial-end-final-reminder.tsx@@ -39,7 +39,7 @@ const TrialEndFinalReminderEmail = ({ name }: TrialEndFinalReminderEmail) => {</Text><Text className="text-sm leading-6 text-black">Your Papermark Pro trial expires in 24 hours.{" "}- <Link href={`https://www.papermark.io/settings/billing`}>+ <Link href={`https://app.papermark.io/settings/billing`}>Upgrade now</Link>{" "}to:@@ -60,7 +60,7 @@ const TrialEndFinalReminderEmail = ({ name }: TrialEndFinalReminderEmail) => {<Section className="mb-[32px] mt-[32px] text-center"><ButtonclassName="rounded bg-black text-center text-xs font-semibold text-white no-underline"- href={`https://www.papermark.io/settings/billing`}+ href={`https://app.papermark.io/settings/billing`}style={{ padding: "12px 20px" }}>Upgrade nowdiff --git a/components/emails/trial-end-reminder.tsx b/components/emails/trial-end-reminder.tsxindex b2cfa789..af9145ad 100644--- a/components/emails/trial-end-reminder.tsx+++ b/components/emails/trial-end-reminder.tsx@@ -58,7 +58,7 @@ const TrialEndReminderEmail = ({ name }: TrialEndReminderEmail) => {<Section className="mb-[32px] mt-[32px] text-center"><ButtonclassName="rounded bg-black text-center text-xs font-semibold text-white no-underline"- href={`https://www.papermark.io/settings/billing`}+ href={`https://app.papermark.io/settings/billing`}style={{ padding: "12px 20px" }}>Upgrade your plandiff --git a/components/emails/viewed-dataroom.tsx b/components/emails/viewed-dataroom.tsxindex 82953b9b..28c02cec 100644--- a/components/emails/viewed-dataroom.tsx+++ b/components/emails/viewed-dataroom.tsx@@ -51,7 +51,7 @@ export default function ViewedDataroom({<Section className="my-8 text-center"><ButtonclassName="rounded bg-black text-center text-xs font-semibold text-white no-underline"- href={`https://www.papermark.io/datarooms/${dataroomId}`}+ href={`https://app.papermark.io/datarooms/${dataroomId}`}style={{ padding: "12px 20px" }}>See my dataroom insightsdiff --git a/components/emails/viewed-document.tsx b/components/emails/viewed-document.tsxindex 725aa2e4..3efa89f0 100644--- a/components/emails/viewed-document.tsx+++ b/components/emails/viewed-document.tsx@@ -51,7 +51,7 @@ export default function ViewedDocument({<Section className="my-8 text-center"><ButtonclassName="rounded bg-black text-center text-xs font-semibold text-white no-underline"- href={`https://www.papermark.io/documents/${documentId}`}+ href={`https://app.papermark.io/documents/${documentId}`}style={{ padding: "12px 20px" }}>See my document insightsdiff --git a/components/links/links-table.tsx b/components/links/links-table.tsxindex d77989d3..a2bfb128 100644--- a/components/links/links-table.tsx+++ b/components/links/links-table.tsx@@ -128,7 +128,7 @@ export default function LinksTable({}const { previewToken } = await response.json();- const previewLink = `https://${process.env.NEXT_PUBLIC_ROOT_DOMAIN}/view/${link.id}?previewToken=${previewToken}`;+ const previewLink = `${process.env.NEXT_PUBLIC_MARKETING_URL}/view/${link.id}?previewToken=${previewToken}`;window.open(previewLink, "_blank");};@@ -270,7 +270,7 @@ export default function LinksTable({<div className="flex w-full whitespace-nowrap text-xs group-hover/cell:opacity-0 md:text-sm">{link.domainId? `https://${link.domainSlug}/${link.slug}`- : `https://${process.env.NEXT_PUBLIC_ROOT_DOMAIN}/view/${link.id}`}+ : `${process.env.NEXT_PUBLIC_MARKETING_URL}/view/${link.id}`}</div>{link.domainId && hasFreePlan ? (@@ -290,7 +290,7 @@ export default function LinksTable({handleCopyToClipboard(link.domainId? `https://${link.domainSlug}/${link.slug}`- : `https://${process.env.NEXT_PUBLIC_ROOT_DOMAIN}/view/${link.id}`,+ : `${process.env.NEXT_PUBLIC_MARKETING_URL}/view/${link.id}`,)}title="Copy to clipboard"@@ -479,7 +479,7 @@ export default function LinksTable({<div className="flex items-center gap-x-4 whitespace-nowrap rounded-sm bg-secondary px-3 py-1.5 text-xs text-secondary-foreground sm:py-1 sm:text-sm">{link.domainId? `https://${link.domainSlug}/${link.slug}`- : `https://${process.env.NEXT_PUBLIC_ROOT_DOMAIN}/view/${link.id}`}+ : `${process.env.NEXT_PUBLIC_MARKETING_URL}/view/${link.id}`}</div></TableCell><TableCell>diff --git a/components/web/alternatives/docsendtext.tsx b/components/web/alternatives/docsendtext.tsxindex 84f51d29..6c51f862 100644--- a/components/web/alternatives/docsendtext.tsx+++ b/components/web/alternatives/docsendtext.tsx@@ -1340,7 +1340,7 @@ const DocSendAlternatives = () => {</><Link- href="https://papermark.io/login"+ href="https://www.papermark.io/login"target="_blank"rel="noopener noreferrer">@@ -1388,7 +1388,7 @@ const DocSendAlternatives = () => {</ul><Link- href="https://papermark.io/login"+ href="https://www.papermark.io/login"target="_blank"rel="noopener noreferrer">@@ -1629,7 +1629,7 @@ const DocSendAlternatives = () => {</div></Link><Link- href="https://papermark.io/login"+ href="https://www.papermark.io/login"target="_blank"rel="noopener noreferrer">@@ -1641,7 +1641,7 @@ const DocSendAlternatives = () => {</Button></Link><Link- href="https://papermark.io/pricing"+ href="https://www.papermark.io/pricing"target="_blank"rel="noopener noreferrer">diff --git a/components/web/footer.tsx b/components/web/footer.tsxindex 159d7b82..8dbd0cdf 100644--- a/components/web/footer.tsx+++ b/components/web/footer.tsx@@ -120,7 +120,7 @@ const navigation = {// },{name: "Virtual sales data room",- href: "https://www.papermark.io/solutions/virtual-sales-room",+ href: "/solutions/virtual-sales-room",},],support: [diff --git a/components/welcome/notion-form.tsx b/components/welcome/notion-form.tsxindex 25eb652f..76378ba3 100644--- a/components/welcome/notion-form.tsx+++ b/components/welcome/notion-form.tsx@@ -178,7 +178,7 @@ export default function NotionForm() {}copyToClipboard(- `${process.env.NEXT_PUBLIC_BASE_URL}/view/${currentLinkId}`,+ `${process.env.NEXT_PUBLIC_MARKETING_URL}/view/${currentLinkId}`,"Link copied to clipboard. Redirecting to document page...",);@@ -313,7 +313,7 @@ export default function NotionForm() {<div className="flex py-8"><div className="flex w-full max-w-xs focus-within:z-10 sm:max-w-lg"><p className="block w-full overflow-y-scroll rounded-md border-0 bg-secondary px-4 py-1.5 text-left leading-6 text-secondary-foreground md:min-w-[500px]">- {`${process.env.NEXT_PUBLIC_BASE_URL}/view/${currentLinkId}`}+ {`${process.env.NEXT_PUBLIC_MARKETING_URL}/view/${currentLinkId}`}</p></div></div>diff --git a/components/welcome/special-upload.tsx b/components/welcome/special-upload.tsxindex 24fc2d89..990df02c 100644--- a/components/welcome/special-upload.tsx+++ b/components/welcome/special-upload.tsx@@ -182,7 +182,7 @@ export default function DeckGeneratorUpload() {}copyToClipboard(- `${process.env.NEXT_PUBLIC_BASE_URL}/view/${currentLinkId}`,+ `${process.env.NEXT_PUBLIC_MARKETING_URL}/view/${currentLinkId}`,"Link copied to clipboard. Redirecting to document page...",);@@ -322,7 +322,7 @@ export default function DeckGeneratorUpload() {<div className="flex py-8"><div className="flex w-full max-w-xs focus-within:z-10 sm:max-w-lg"><p className="block w-full overflow-y-scroll rounded-md border-0 bg-secondary px-4 py-1.5 text-left leading-6 text-secondary-foreground md:min-w-[500px]">- {`${process.env.NEXT_PUBLIC_BASE_URL}/view/${currentLinkId}`}+ {`${process.env.NEXT_PUBLIC_MARKETING_URL}/view/${currentLinkId}`}</p></div></div>diff --git a/components/welcome/upload.tsx b/components/welcome/upload.tsxindex 93981ce6..2396b9a5 100644--- a/components/welcome/upload.tsx+++ b/components/welcome/upload.tsx@@ -162,7 +162,7 @@ export default function Upload() {}copyToClipboard(- `${process.env.NEXT_PUBLIC_BASE_URL}/view/${currentLinkId}`,+ `${process.env.NEXT_PUBLIC_MARKETING_URL}/view/${currentLinkId}`,"Link copied to clipboard. Redirecting to document page...",);@@ -302,7 +302,7 @@ export default function Upload() {<div className="flex py-8"><div className="flex w-full max-w-xs focus-within:z-10 sm:max-w-lg"><p className="block w-full overflow-y-scroll rounded-md border-0 bg-secondary px-4 py-1.5 text-left leading-6 text-secondary-foreground md:min-w-[500px]">- {`${process.env.NEXT_PUBLIC_BASE_URL}/view/${currentLinkId}`}+ {`${process.env.NEXT_PUBLIC_MARKETING_URL}/view/${currentLinkId}`}</p></div></div>diff --git a/lib/middleware/domain.ts b/lib/middleware/domain.tsindex 8b740a42..a1c87257 100644--- a/lib/middleware/domain.ts+++ b/lib/middleware/domain.ts@@ -21,6 +21,8 @@ export default async function DomainMiddleware(req: NextRequest) {return NextResponse.rewrite(url, PAPERMARK_HEADERS);} else {// redirect plain custom domain to papermark.io, eventually to it's own landing page- return NextResponse.redirect(new URL("https://www.papermark.io", req.url));+ return NextResponse.redirect(+ new URL("https://www.papermark.io/home", req.url),+ );}}diff --git a/next.config.mjs b/next.config.mjsindex 54b1372e..bac26af5 100644--- a/next.config.mjs+++ b/next.config.mjs@@ -1,3 +1,13 @@+const REDIRECT_SEGMENTS = [+ "documents",+ "datarooms",+ "settings",+ "api",+ "_static",+ "_icons",+ "_example",+];+/** @type {import('next').NextConfig} */const nextConfig = {reactStrictMode: true,@@ -20,11 +30,34 @@ const nextConfig = {},async redirects() {return [- {- source: "/view/d/:path*",- destination: "/view/:path*",- permanent: true,- },+ ...REDIRECT_SEGMENTS.map(+ (segment) => (+ {+ source: `/${segment}`,+ has: [+ {+ type: "host",+ value: "www.papermark.io",+ },+ ],+ destination: `https://app.papermark.io/${segment}`,+ permanent: true,+ statusCode: 301,+ },+ {+ source: `/${segment}/:path*`,+ has: [+ {+ type: "host",+ value: "www.papermark.io",+ },+ ],+ destination: `https://app.papermark.io/${segment}/:path*`,+ permanent: true,+ statusCode: 301,+ }+ ),+ ),];},async rewrites() {@@ -49,6 +82,7 @@ function prepareRemotePatterns() {{ protocol: "https", hostname: "lh3.googleusercontent.com" },// papermark img{ protocol: "https", hostname: "www.papermark.io" },+ { protocol: "https", hostname: "app.papermark.io" },// useragent img{ protocol: "https", hostname: "faisalman.github.io" },// special document pagesdiff --git a/pages/api/jobs/send-dataroom-new-document-notification.ts b/pages/api/jobs/send-dataroom-new-document-notification.tsindex e598e036..d7c5eeaa 100644--- a/pages/api/jobs/send-dataroom-new-document-notification.ts+++ b/pages/api/jobs/send-dataroom-new-document-notification.ts@@ -102,7 +102,7 @@ export default async function handle(senderEmail: user.email!,documentName: document?.document.name,to: viewer.email,- url: `${process.env.NEXTAUTH_URL}/view/${linkId}?email=${encodeURIComponent(viewer.email)}`,+ url: `${process.env.NEXT_PUBLIC_MARKETING_URL}/view/${linkId}?email=${encodeURIComponent(viewer.email)}`,});resdiff --git a/pages/api/jobs/send-dataroom-view-invitation.ts b/pages/api/jobs/send-dataroom-view-invitation.tsindex 9109d730..98080ce2 100644--- a/pages/api/jobs/send-dataroom-view-invitation.ts+++ b/pages/api/jobs/send-dataroom-view-invitation.ts@@ -85,7 +85,7 @@ export default async function handle(dataroomName: viewer.dataroom.name,senderEmail: user.email!,to: viewer.email,- url: `${process.env.NEXTAUTH_URL}/view/${linkId}?email=${encodeURIComponent(viewer.email)}`,+ url: `${process.env.NEXT_PUBLIC_MARKETING_URL}/view/${linkId}?email=${encodeURIComponent(viewer.email)}`,});resdiff --git a/pages/api/views-dataroom.ts b/pages/api/views-dataroom.tsindex 74124dd8..015e8e1c 100644--- a/pages/api/views-dataroom.ts+++ b/pages/api/views-dataroom.ts@@ -202,7 +202,7 @@ export default async function handle(});// set the default verification url- let verificationUrl: string = `${process.env.NEXT_PUBLIC_BASE_URL}/view/${linkId}/?token=${token}&email=${encodeURIComponent(email)}`;+ let verificationUrl: string = `${process.env.NEXT_PUBLIC_MARKETING_URL}/view/${linkId}/?token=${token}&email=${encodeURIComponent(email)}`;if (link.domainSlug && link.slug) {// if custom domain is enabled, use the custom domaindiff --git a/pages/api/views.ts b/pages/api/views.tsindex 1ad99044..43a90a07 100644--- a/pages/api/views.ts+++ b/pages/api/views.ts@@ -190,7 +190,7 @@ export default async function handle(// set the default verification urllet verificationUrl: string =- `${process.env.NEXT_PUBLIC_BASE_URL}/view/${linkId}/?token=${token}&email=${encodeURIComponent(email)}` ++ `${process.env.NEXT_PUBLIC_MARKETING_URL}/view/${linkId}/?token=${token}&email=${encodeURIComponent(email)}` +(previewToken ? `&previewToken=${previewToken}` : "");if (link.domainSlug && link.slug && !previewToken) {