Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deploy: replaced various hardcoded values of the papermark.io domain #1425

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/emails/dataroom-trial-end.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const DataroomTrialEnd = ({ name }: DataroomTrialEnd) => {
</Text>
<Text className="text-sm leading-6 text-black">
Your Papermark dataroom trial has expired.{" "}
<Link href={`https://app.papermark.io/settings/billing`}>
<Link href={`${process.env.NEXT_PUBLIC_BASE_URL}/settings/billing`}>
Upgrade now
</Link>{" "}
to:
Expand All @@ -63,7 +63,7 @@ const DataroomTrialEnd = ({ name }: DataroomTrialEnd) => {
<Section className="mb-[32px] mt-[32px] text-center">
<Button
className="rounded bg-black text-center text-xs font-semibold text-white no-underline"
href={`https://app.papermark.io/settings/billing`}
href={`${process.env.NEXT_PUBLIC_BASE_URL}/settings/billing`}
style={{ padding: "12px 20px" }}
>
Upgrade now
Expand Down
2 changes: 1 addition & 1 deletion components/emails/deleted-domain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function DomainDeleted({
<Section className="my-8 text-center">
<Button
className="rounded bg-black text-center text-xs font-semibold text-white no-underline"
href={`https://app.papermark.io/settings/domains`}
href={`${process.env.NEXT_PUBLIC_BASE_URL}/settings/domains`}
style={{ padding: "12px 20px" }}
>
Set up your custom domain
Expand Down
18 changes: 8 additions & 10 deletions components/emails/invalid-domain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default function InvalidDomain({
<Section className="my-8 text-center">
<Button
className="rounded bg-black text-center text-xs font-semibold text-white no-underline"
href={`https://app.papermark.io/settings/domains`}
href={`${process.env.NEXT_PUBLIC_BASE_URL}/settings/domains`}
style={{ padding: "12px 20px" }}
>
Configure domain
Expand All @@ -60,21 +60,19 @@ 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://app.papermark.io/settings/domains`}
href={`${process.env.NEXT_PUBLIC_BASE_URL}/settings/domains`}
className="font-medium text-blue-600 no-underline"
>
delete it
</Link>{" "}
or simply ignore this email.{" "}
{invalidDays >= 14
? `To respect your inbox,${" "}
${
invalidDays < 28
? `we will only send you one more email about this in ${
28 - invalidDays
} days.`
: `this will be the last time we will email you about this.`
}`
? `To respect your inbox,${" "}
${invalidDays < 28
? `we will only send you one more email about this in ${28 - invalidDays
} days.`
: `this will be the last time we will email you about this.`
}`
: ""}
</Text>
<Hr />
Expand Down
2 changes: 1 addition & 1 deletion components/emails/onboarding-1.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const Onboarding1Email = () => {
<Section className="mb-[32px] mt-[32px] text-center">
<Button
className="rounded bg-black text-center text-xs font-semibold text-white no-underline"
href={`https://app.papermark.io/documents?utm_source=onboarding&utm_medium=email&utm_campaign=20240723&utm_content=upload_documents`}
href={`${process.env.NEXT_PUBLIC_BASE_URL}/documents?utm_source=onboarding&utm_medium=email&utm_campaign=20240723&utm_content=upload_documents`}
style={{ padding: "12px 20px" }}
>
Upload my documents
Expand Down
2 changes: 1 addition & 1 deletion components/emails/onboarding-2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const Onboarding2Email = () => {
<Section className="mb-[32px] mt-[32px] text-center">
<Button
className="rounded bg-black text-center text-xs font-semibold text-white no-underline"
href={`https://app.papermark.io/documents?utm_source=onboarding&utm_medium=email&utm_campaign=20240723&utm_content=upload_documents`}
href={`${process.env.NEXT_PUBLIC_BASE_URL}/documents?utm_source=onboarding&utm_medium=email&utm_campaign=20240723&utm_content=upload_documents`}
style={{ padding: "12px 20px" }}
>
To my link settings
Expand Down
2 changes: 1 addition & 1 deletion components/emails/onboarding-3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const Onboarding3Email = () => {
<Section className="mb-[32px] mt-[32px] text-center">
<Button
className="rounded bg-black text-center text-xs font-semibold text-white no-underline"
href={`https://app.papermark.io/documents?utm_source=onboarding&utm_medium=email&utm_campaign=20240723&utm_content=upload_documents`}
href={`${process.env.NEXT_PUBLIC_BASE_URL}/documents?utm_source=onboarding&utm_medium=email&utm_campaign=20240723&utm_content=upload_documents`}
style={{ padding: "12px 20px" }}
>
View your document activity
Expand Down
2 changes: 1 addition & 1 deletion components/emails/onboarding-4.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const Onboarding4Email = () => {
<Section className="mb-[32px] mt-[32px] text-center">
<Button
className="rounded bg-black text-center text-xs font-semibold text-white no-underline"
href={`https://app.papermark.io/documents?utm_source=onboarding&utm_medium=email&utm_campaign=20240723&utm_content=upload_documents`}
href={`${process.env.NEXT_PUBLIC_BASE_URL}/documents?utm_source=onboarding&utm_medium=email&utm_campaign=20240723&utm_content=upload_documents`}
style={{ padding: "12px 20px" }}
>
Add your domain and branding
Expand Down
2 changes: 1 addition & 1 deletion components/emails/onboarding-5.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const Onboarding3Email = () => {
<Section className="mb-[32px] mt-[32px] text-center">
<Button
className="rounded bg-black text-center text-xs font-semibold text-white no-underline"
href={`https://app.papermark.io/datarooms?utm_source=dataroom-info&utm_medium=email&utm_campaign=20240723&utm_content=upload_documents`}
href={`${process.env.NEXT_PUBLIC_BASE_URL}/datarooms?utm_source=dataroom-info&utm_medium=email&utm_campaign=20240723&utm_content=upload_documents`}
style={{ padding: "12px 20px" }}
>
Create new data room
Expand Down
4 changes: 2 additions & 2 deletions components/emails/trial-end-final-reminder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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://app.papermark.io/settings/billing`}>
<Link href={`${process.env.NEXT_PUBLIC_BASE_URL}/settings/billing`}>
Upgrade now
</Link>{" "}
to:
Expand All @@ -60,7 +60,7 @@ const TrialEndFinalReminderEmail = ({ name }: TrialEndFinalReminderEmail) => {
<Section className="mb-[32px] mt-[32px] text-center">
<Button
className="rounded bg-black text-center text-xs font-semibold text-white no-underline"
href={`https://app.papermark.io/settings/billing`}
href={`${process.env.NEXT_PUBLIC_BASE_URL}/settings/billing`}
style={{ padding: "12px 20px" }}
>
Upgrade now
Expand Down
2 changes: 1 addition & 1 deletion components/emails/trial-end-reminder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const TrialEndReminderEmail = ({ name }: TrialEndReminderEmail) => {
<Section className="mb-[32px] mt-[32px] text-center">
<Button
className="rounded bg-black text-center text-xs font-semibold text-white no-underline"
href={`https://app.papermark.io/settings/billing`}
href={`${process.env.NEXT_PUBLIC_BASE_URL}/settings/billing`}
style={{ padding: "12px 20px" }}
>
Upgrade your plan
Expand Down
2 changes: 1 addition & 1 deletion components/emails/viewed-dataroom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default function ViewedDataroom({
<Section className="my-8 text-center">
<Button
className="rounded bg-black text-center text-xs font-semibold text-white no-underline"
href={`https://app.papermark.io/datarooms/${dataroomId}`}
href={`${process.env.NEXT_PUBLIC_BASE_URL}/datarooms/${dataroomId}`}
style={{ padding: "12px 20px" }}
>
See my dataroom insights
Expand Down
2 changes: 1 addition & 1 deletion components/emails/viewed-document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default function ViewedDocument({
<Section className="my-8 text-center">
<Button
className="rounded bg-black text-center text-xs font-semibold text-white no-underline"
href={`https://app.papermark.io/documents/${documentId}`}
href={`${process.env.NEXT_PUBLIC_BASE_URL}/documents/${documentId}`}
style={{ padding: "12px 20px" }}
>
See my document insights
Expand Down
2 changes: 1 addition & 1 deletion components/emails/year-in-review-papermark.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export default function PapermarkYearInReviewEmail({
Share your stats
</Link>
<Link
href="https://app.papermark.io/documents"
href={`${process.env.NEXT_PUBLIC_BASE_URL}/documents`}
className="mt-4 block items-center text-center text-sm font-bold text-gray-900 no-underline"
>
Go to your dashboard
Expand Down
3 changes: 2 additions & 1 deletion components/settings/og-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import ReactTextareaAutosize from "react-textarea-autosize";
import { Facebook } from "../shared/icons/facebook";
import LinkedIn from "../shared/icons/linkedin";
import Twitter from "../shared/icons/twitter";
import { getApexDomain } from "@/lib/domains";

export default function Preview({
data,
Expand Down Expand Up @@ -33,7 +34,7 @@ export default function Preview({
metaFavicon: favicon,
} = data;

const hostname = "papermark.io";
const hostname = getApexDomain(process.env.NEXT_PUBLIC_MARKETING_URL ?? "papermark.io");

return (
<div>
Expand Down
3 changes: 2 additions & 1 deletion next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const nextConfig = {
skipTrailingSlashRedirect: true,
assetPrefix:
process.env.NODE_ENV === "production" &&
process.env.VERCEL_ENV === "production"
process.env.VERCEL_ENV === "production"
? process.env.NEXT_PUBLIC_BASE_URL
: undefined,
async redirects() {
Expand Down Expand Up @@ -159,6 +159,7 @@ function prepareRemotePatterns() {
// papermark img
{ protocol: "https", hostname: "www.papermark.io" },
{ protocol: "https", hostname: "app.papermark.io" },
{ protocol: "https", hostname: process.env.NEXT_PUBLIC_BASE_URL.replace(/^https?:\/\//, "") },
// useragent img
{ protocol: "https", hostname: "faisalman.github.io" },
// special document pages
Expand Down
3 changes: 2 additions & 1 deletion pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { CreateUserEmailProps, CustomUser } from "@/lib/types";
import { generateChecksum } from "@/lib/utils/generate-checksum";

const VERCEL_DEPLOYMENT = !!process.env.VERCEL_URL;
const COOKIE_DOMAIN = (process.env.NEXT_PUBLIC_BASE_URL ?? "https://papermark.io").replace(/^https?:\/\//, ".")

// This function can run for a maximum of 180 seconds
export const config = {
Expand Down Expand Up @@ -88,7 +89,7 @@ export const authOptions: NextAuthOptions = {
sameSite: "lax",
path: "/",
// When working on localhost, the cookie domain must be omitted entirely (https://stackoverflow.com/a/1188145)
domain: VERCEL_DEPLOYMENT ? ".papermark.io" : undefined,
domain: VERCEL_DEPLOYMENT ? COOKIE_DOMAIN : undefined,
secure: VERCEL_DEPLOYMENT,
},
},
Expand Down
4 changes: 2 additions & 2 deletions pages/view/[linkId]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const getStaticProps = async (context: GetStaticPropsContext) => {
metaDescription: link.metaDescription,
metaImage: link.metaImage,
metaFavicon: link.metaFavicon ?? "/favicon.ico",
metaUrl: `https://www.papermark.io/view/${linkId}`,
metaUrl: `${process.env.NEXT_PUBLIC_MARKETING_URL}/view/${linkId}`,
},
showPoweredByBanner: link.showBanner || teamPlan === "free",
showAccountCreationSlide: link.showBanner || teamPlan === "free",
Expand Down Expand Up @@ -178,7 +178,7 @@ export const getStaticProps = async (context: GetStaticPropsContext) => {
metaDescription: link.metaDescription,
metaImage: link.metaImage,
metaFavicon: link.metaFavicon ?? "/favicon.ico",
metaUrl: `https://www.papermark.io/view/${linkId}`,
metaUrl: `${process.env.NEXT_PUBLIC_MARKETING_URL}/view/${linkId}`,
},
showPoweredByBanner: false,
showAccountCreationSlide: false,
Expand Down
Loading