Skip to content

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

feat: Add showBanner option to link presets

Cursor Agentdb65c20ede3f
diff --git a/components/links/link-sheet/index.tsx b/components/links/link-sheet/index.tsx
index 987a92f8..c5776a97 100644
--- a/components/links/link-sheet/index.tsx
+++ b/components/links/link-sheet/index.tsx
@@ -265,6 +265,7 @@ export default function LinkSheet({
enableScreenshotProtection:
preset.enableScreenshotProtection || prev.enableScreenshotProtection,
enableNotification: !!preset.enableNotification,
+ showBanner: preset.showBanner ?? prev.showBanner,
};
});
diff --git a/ee/features/permissions/components/dataroom-link-sheet.tsx b/ee/features/permissions/components/dataroom-link-sheet.tsx
index e2396be0..bdd25e7f 100644
--- a/ee/features/permissions/components/dataroom-link-sheet.tsx
+++ b/ee/features/permissions/components/dataroom-link-sheet.tsx
@@ -217,6 +217,7 @@ export function DataroomLinkSheet({
enableScreenshotProtection:
preset.enableScreenshotProtection || prev.enableScreenshotProtection,
enableNotification: !!preset.enableNotification,
+ showBanner: preset.showBanner ?? prev.showBanner,
};
});
diff --git a/lib/zod/schemas/presets.ts b/lib/zod/schemas/presets.ts
index 8da7e07f..b3dbbbf6 100644
--- a/lib/zod/schemas/presets.ts
+++ b/lib/zod/schemas/presets.ts
@@ -61,6 +61,9 @@ export const presetDataSchema = z.object({
// Agreement
enableAgreement: z.boolean().optional(),
agreementId: z.string().nullable().optional(),
+
+ // Banner
+ showBanner: z.boolean().optional(),
});
export type PresetDataSchema = z.infer<typeof presetDataSchema>;
diff --git a/pages/api/webhooks/services/[...path]/index.ts b/pages/api/webhooks/services/[...path]/index.ts
index 1777fa6d..519cfee5 100644
--- a/pages/api/webhooks/services/[...path]/index.ts
+++ b/pages/api/webhooks/services/[...path]/index.ts
@@ -488,7 +488,7 @@ async function handleDocumentCreate(
enableNotification: link.enableNotification,
enableFeedback: link.enableFeedback,
enableScreenshotProtection: link.enableScreenshotProtection,
- showBanner: link.showBanner,
+ showBanner: link.showBanner ?? preset?.showBanner ?? false,
audienceType: link.audienceType,
groupId: isGroupAudience ? link.groupId : null,
// For group links, ignore allow/deny lists from presets as access is controlled by group membership
@@ -700,7 +700,7 @@ async function handleLinkCreate(
enableNotification: link.enableNotification,
enableFeedback: link.enableFeedback,
enableScreenshotProtection: link.enableScreenshotProtection,
- showBanner: link.showBanner,
+ showBanner: link.showBanner ?? preset?.showBanner ?? false,
audienceType: link.audienceType,
groupId: isGroupAudience ? link.groupId : null,
// For group links, ignore allow/deny lists from presets as access is controlled by group membership
@@ -877,7 +877,7 @@ async function handleDataroomCreate(
enableNotification: link.enableNotification,
enableFeedback: link.enableFeedback,
enableScreenshotProtection: link.enableScreenshotProtection,
- showBanner: link.showBanner,
+ showBanner: link.showBanner ?? preset?.showBanner ?? false,
audienceType: link.audienceType,
groupId: isGroupAudience ? link.groupId : null,
allowList: link.allowList || preset?.allowList,
diff --git a/pages/settings/presets/[id].tsx b/pages/settings/presets/[id].tsx
index 75ae1b08..701a1fd2 100644
--- a/pages/settings/presets/[id].tsx
+++ b/pages/settings/presets/[id].tsx
@@ -31,6 +31,7 @@ import ExpirationInSection from "@/components/links/link-sheet/expirationIn-sect
import { LinkUpgradeOptions } from "@/components/links/link-sheet/link-options";
import OGSection from "@/components/links/link-sheet/og-section";
import PasswordSection from "@/components/links/link-sheet/password-section";
+import { ProBannerSection } from "@/components/links/link-sheet/pro-banner-section";
import ScreenshotProtectionSection from "@/components/links/link-sheet/screenshot-protection-section";
import WatermarkSection from "@/components/links/link-sheet/watermark-section";
import Preview from "@/components/settings/og-preview";
@@ -138,6 +139,7 @@ export default function EditPreset() {
enableCustomFields: customFields.length > 0,
customFields: customFields,
enableNotification: preset.enableNotification ?? false,
+ showBanner: preset.showBanner ?? false,
});
}
}, [preset]);
@@ -188,6 +190,7 @@ export default function EditPreset() {
enableCustomFields: data.enableCustomFields,
customFields: data.customFields,
enableNotification: data.enableNotification,
+ showBanner: data.showBanner,
}),
});
@@ -476,6 +479,22 @@ export default function EditPreset() {
presets={null}
/>
</div>
+
+ <div className="rounded-lg border p-6">
+ <h3 className="mb-4 text-lg font-medium">Branding</h3>
+ <ProBannerSection
+ data={data as any}
+ setData={setData as any}
+ isAllowed={
+ isTrial ||
+ (isPro && allowAdvancedLinkControls) ||
+ isBusiness ||
+ isDatarooms ||
+ isDataroomsPlus
+ }
+ handleUpgradeStateChange={handleUpgradeStateChange}
+ />
+ </div>
</div>
<div className="sticky top-0 md:overflow-auto">
diff --git a/pages/settings/presets/new.tsx b/pages/settings/presets/new.tsx
index 969edd1c..fd6d7bbe 100644
--- a/pages/settings/presets/new.tsx
+++ b/pages/settings/presets/new.tsx
@@ -32,6 +32,7 @@ import ExpirationInSection from "@/components/links/link-sheet/expirationIn-sect
import { LinkUpgradeOptions } from "@/components/links/link-sheet/link-options";
import OGSection from "@/components/links/link-sheet/og-section";
import PasswordSection from "@/components/links/link-sheet/password-section";
+import { ProBannerSection } from "@/components/links/link-sheet/pro-banner-section";
import ScreenshotProtectionSection from "@/components/links/link-sheet/screenshot-protection-section";
import WatermarkSection from "@/components/links/link-sheet/watermark-section";
import Preview from "@/components/settings/og-preview";
@@ -137,6 +138,7 @@ export default function NewPreset() {
: false,
customFields: data.customFields,
enableNotification: data.enableNotification,
+ showBanner: data.showBanner,
}),
});
@@ -313,6 +315,22 @@ export default function NewPreset() {
presets={null}
/>
</div>
+
+ <div className="rounded-lg border p-6">
+ <h3 className="mb-4 text-lg font-medium">Branding</h3>
+ <ProBannerSection
+ data={data}
+ setData={setData}
+ isAllowed={
+ isTrial ||
+ (isPro && allowAdvancedLinkControls) ||
+ isBusiness ||
+ isDatarooms ||
+ isDataroomsPlus
+ }
+ handleUpgradeStateChange={handleUpgradeStateChange}
+ />
+ </div>
</div>
<div className="sticky top-0 md:overflow-auto">
diff --git a/prisma/migrations/20251017000000_add_show_banner_to_presets/migration.sql b/prisma/migrations/20251017000000_add_show_banner_to_presets/migration.sql
new file mode 100644
index 00000000..481e9cfe
--- /dev/null
+++ b/prisma/migrations/20251017000000_add_show_banner_to_presets/migration.sql
@@ -0,0 +1,2 @@
+-- AlterTable
+ALTER TABLE "LinkPreset" ADD COLUMN "showBanner" BOOLEAN DEFAULT false;
diff --git a/prisma/schema/link.prisma b/prisma/schema/link.prisma
index 8182eebe..940d6588 100644
--- a/prisma/schema/link.prisma
+++ b/prisma/schema/link.prisma
@@ -125,6 +125,8 @@ model LinkPreset {
enableCustomFields Boolean? @default(false)
customFields Json? //[{type: "SHORT_TEXT", identifier: "name", label: "Name", required: true}]
+ showBanner Boolean? @default(false) // Optional give user a option to show the "Powered by Papermark" banner
+
isDefault Boolean @default(false)
createdAt DateTime @default(now())