Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

chore: hide account creation on higher plans

Marc Seitz82ace1354da2
diff --git a/components/view/PagesViewerNew.tsx b/components/view/PagesViewerNew.tsx
index cb9a572a..dce92956 100644
--- a/components/view/PagesViewerNew.tsx
+++ b/components/view/PagesViewerNew.tsx
@@ -75,6 +75,7 @@ export default function PagesViewer({
dataroomId,
setDocumentData,
showPoweredByBanner,
+ showAccountCreationSlide,
enableQuestion = false,
feedback,
isVertical = false,
@@ -94,6 +95,7 @@ export default function PagesViewer({
dataroomId?: string;
setDocumentData?: React.Dispatch<React.SetStateAction<TDocumentData | null>>;
showPoweredByBanner?: boolean;
+ showAccountCreationSlide?: boolean;
enableQuestion?: boolean | null;
feedback?: {
id: string;
@@ -105,14 +107,18 @@ export default function PagesViewer({
const router = useRouter();
const { status: sessionStatus } = useSession();
+ const showStatsSlideWithAccountCreation =
+ showAccountCreationSlide && // if showAccountCreationSlide is enabled
+ sessionStatus !== "authenticated" && // and user is not authenticated
+ !dataroomId; // and it's not a dataroom
+
const numPages = pages.length;
const numPagesWithFeedback =
enableQuestion && feedback ? numPages + 1 : numPages;
- const numPagesWithAccountCreation =
- sessionStatus === "authenticated" && !dataroomId
- ? numPagesWithFeedback
- : numPagesWithFeedback + 1;
+ const numPagesWithAccountCreation = showStatsSlideWithAccountCreation
+ ? numPagesWithFeedback + 1
+ : numPagesWithFeedback;
const pageQuery = router.query.p ? Number(router.query.p) : 1;
@@ -659,8 +665,7 @@ export default function PagesViewer({
</div>
) : null}
- {sessionStatus !== "authenticated" &&
- !dataroomId &&
+ {showStatsSlideWithAccountCreation &&
(isVertical || pageNumber === numPagesWithAccountCreation) ? (
<div
className={cn("relative block h-screen w-full")}
diff --git a/components/view/document-view.tsx b/components/view/document-view.tsx
index 860575e2..7562bd93 100644
--- a/components/view/document-view.tsx
+++ b/components/view/document-view.tsx
@@ -45,6 +45,7 @@ export default function DocumentView({
token,
verifiedEmail,
showPoweredByBanner,
+ showAccountCreationSlide,
}: {
link: LinkWithDocument;
userEmail: string | null | undefined;
@@ -58,6 +59,7 @@ export default function DocumentView({
token?: string;
verifiedEmail?: string;
showPoweredByBanner?: boolean;
+ showAccountCreationSlide?: boolean;
}) {
const {
document,
@@ -220,6 +222,7 @@ export default function DocumentView({
notionData={notionData}
brand={brand}
showPoweredByBanner={showPoweredByBanner}
+ showAccountCreationSlide={showAccountCreationSlide}
viewerEmail={data.email ?? verifiedEmail ?? userEmail ?? undefined}
/>
) : (
diff --git a/components/view/view-data.tsx b/components/view/view-data.tsx
index c1ae488a..df53b52b 100644
--- a/components/view/view-data.tsx
+++ b/components/view/view-data.tsx
@@ -21,6 +21,7 @@ export default function ViewData({
notionData,
brand,
showPoweredByBanner,
+ showAccountCreationSlide,
viewerEmail,
}: {
viewData: DEFAULT_DOCUMENT_VIEW_TYPE;
@@ -31,6 +32,7 @@ export default function ViewData({
};
brand?: Partial<Brand> | null;
showPoweredByBanner?: boolean;
+ showAccountCreationSlide?: boolean;
viewerEmail?: string;
}) {
const { document } = link;
@@ -68,6 +70,7 @@ export default function ViewData({
versionNumber={document.versions[0].versionNumber}
brand={brand}
showPoweredByBanner={showPoweredByBanner}
+ showAccountCreationSlide={showAccountCreationSlide}
enableQuestion={link.enableQuestion}
feedback={link.feedback}
isVertical={document.versions[0].isVertical}
diff --git a/pages/view/[linkId]/index.tsx b/pages/view/[linkId]/index.tsx
index 0e2c49c8..ed1d232b 100644
--- a/pages/view/[linkId]/index.tsx
+++ b/pages/view/[linkId]/index.tsx
@@ -93,6 +93,7 @@ export const getStaticProps = async (context: GetStaticPropsContext) => {
metaUrl: `https://www.papermark.io/view/${linkId}`,
},
showPoweredByBanner: teamPlan === "free",
+ showAccountCreationSlide: teamPlan === "free" || teamPlan === "pro",
},
revalidate: brand ? 10 : false,
};
@@ -138,6 +139,7 @@ export const getStaticProps = async (context: GetStaticPropsContext) => {
metaUrl: `https://www.papermark.io/view/${linkId}`,
},
showPoweredByBanner: false,
+ showAccountCreationSlide: false,
},
revalidate: 10,
};
@@ -160,6 +162,7 @@ export default function ViewPage({
notionData,
meta,
showPoweredByBanner,
+ showAccountCreationSlide,
}: {
linkData: DocumentLinkData | DataroomLinkData;
notionData: {
@@ -174,6 +177,7 @@ export default function ViewPage({
metaUrl: string | null;
};
showPoweredByBanner: boolean;
+ showAccountCreationSlide: boolean;
}) {
const router = useRouter();
const { data: session, status } = useSession();
@@ -263,6 +267,7 @@ export default function ViewPage({
token={token}
verifiedEmail={verifiedEmail}
showPoweredByBanner={showPoweredByBanner}
+ showAccountCreationSlide={showAccountCreationSlide}
/>
</>
);
@@ -289,6 +294,7 @@ export default function ViewPage({
notionData={notionData}
brand={brand}
showPoweredByBanner={showPoweredByBanner}
+ showAccountCreationSlide={showAccountCreationSlide}
/>
</>
);
diff --git a/pages/view/domains/[domain]/[slug]/index.tsx b/pages/view/domains/[domain]/[slug]/index.tsx
index 99e5046d..3f4be0e5 100644
--- a/pages/view/domains/[domain]/[slug]/index.tsx
+++ b/pages/view/domains/[domain]/[slug]/index.tsx
@@ -98,6 +98,7 @@ export const getStaticProps = async (context: GetStaticPropsContext) => {
metaUrl: `https://${domain}/${slug}` || null,
},
showPoweredByBanner: teamPlan === "free",
+ showAccountCreationSlide: teamPlan === "free" || teamPlan === "pro",
},
revalidate: 10,
};
@@ -143,6 +144,7 @@ export const getStaticProps = async (context: GetStaticPropsContext) => {
metaUrl: `https://${domain}/${slug}` || null,
},
showPoweredByBanner: false,
+ showAccountCreationSlide: false,
},
revalidate: 10,
};
@@ -164,6 +166,7 @@ export default function ViewPage({
linkData,
notionData,
meta,
+ showAccountCreationSlide,
}: {
linkData: DocumentLinkData | DataroomLinkData;
notionData: {
@@ -177,6 +180,7 @@ export default function ViewPage({
metaImage: string | null;
metaUrl: string | null;
};
+ showAccountCreationSlide: boolean;
}) {
const router = useRouter();
const { data: session, status } = useSession();
@@ -264,6 +268,7 @@ export default function ViewPage({
brand={brand}
token={token}
verifiedEmail={verifiedEmail}
+ showAccountCreationSlide={showAccountCreationSlide}
/>
</>
);
@@ -289,6 +294,7 @@ export default function ViewPage({
isProtected={false}
notionData={notionData}
brand={brand}
+ showAccountCreationSlide={showAccountCreationSlide}
/>
</>
);