Skip to content

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

fix: add viewer's email to watermark

Marc Seitz0808d8e26428
diff --git a/components/view/dataroom/dataroom-document-view.tsx b/components/view/dataroom/dataroom-document-view.tsx
index 14a94523..920bb5a8 100644
--- a/components/view/dataroom/dataroom-document-view.tsx
+++ b/components/view/dataroom/dataroom-document-view.tsx
@@ -54,6 +54,7 @@ type DEFAULT_DOCUMENT_VIEW_TYPE = {
isPreview?: boolean;
canDownload?: boolean;
verificationToken?: string;
+ viewerEmail?: string;
};
export default function DataroomDocumentView({
@@ -168,9 +169,10 @@ export default function DataroomDocumentView({
useAdvancedExcelViewer,
canDownload,
verificationToken,
+ viewerEmail,
} = fetchData as DEFAULT_DOCUMENT_VIEW_TYPE;
analytics.identify(
- userEmail ?? verifiedEmail ?? data.email ?? undefined,
+ userEmail ?? viewerEmail ?? verifiedEmail ?? data.email ?? undefined,
);
analytics.capture("Link Viewed", {
linkId: link.id,
@@ -178,7 +180,7 @@ export default function DataroomDocumentView({
dataroomId: link.dataroomId,
linkType: linkType,
viewerId: viewId,
- viewerEmail: data.email ?? verifiedEmail ?? userEmail,
+ viewerEmail: viewerEmail ?? data.email ?? verifiedEmail ?? userEmail,
isEmbedded,
});
@@ -206,6 +208,7 @@ export default function DataroomDocumentView({
ipAddress,
useAdvancedExcelViewer,
canDownload,
+ viewerEmail,
}));
setSubmitted(true);
setVerificationRequested(false);
@@ -314,8 +317,16 @@ export default function DataroomDocumentView({
brand={brand}
showPoweredByBanner={false}
showAccountCreationSlide={false}
- useAdvancedExcelViewer={useAdvancedExcelViewer}
- viewerEmail={data.email ?? verifiedEmail ?? userEmail ?? undefined}
+ useAdvancedExcelViewer={
+ viewData.useAdvancedExcelViewer ?? useAdvancedExcelViewer
+ }
+ viewerEmail={
+ viewData.viewerEmail ??
+ data.email ??
+ verifiedEmail ??
+ userEmail ??
+ undefined
+ }
/>
) : (
<div className="flex h-screen items-center justify-center">
diff --git a/pages/api/views-dataroom.ts b/pages/api/views-dataroom.ts
index e61a5f08..15254243 100644
--- a/pages/api/views-dataroom.ts
+++ b/pages/api/views-dataroom.ts
@@ -858,6 +858,7 @@ export default async function handle(
? "notion"
: undefined,
watermarkConfig: link.enableWatermark ? link.watermarkConfig : undefined,
+ viewerEmail: viewer?.email ?? email ?? verifiedEmail ?? null,
ipAddress:
link.enableWatermark &&
link.watermarkConfig &&