Skip to content

Commit db65c20

Browse files
cursoragentmfts
andcommitted
feat: Add showBanner option to link presets
Co-authored-by: marcftone <[email protected]>
1 parent 7e94ee0 commit db65c20

File tree

8 files changed

+49
-3
lines changed

8 files changed

+49
-3
lines changed

components/links/link-sheet/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ export default function LinkSheet({
265265
enableScreenshotProtection:
266266
preset.enableScreenshotProtection || prev.enableScreenshotProtection,
267267
enableNotification: !!preset.enableNotification,
268+
showBanner: preset.showBanner ?? prev.showBanner,
268269
};
269270
});
270271

ee/features/permissions/components/dataroom-link-sheet.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ export function DataroomLinkSheet({
217217
enableScreenshotProtection:
218218
preset.enableScreenshotProtection || prev.enableScreenshotProtection,
219219
enableNotification: !!preset.enableNotification,
220+
showBanner: preset.showBanner ?? prev.showBanner,
220221
};
221222
});
222223

lib/zod/schemas/presets.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ export const presetDataSchema = z.object({
6161
// Agreement
6262
enableAgreement: z.boolean().optional(),
6363
agreementId: z.string().nullable().optional(),
64+
65+
// Banner
66+
showBanner: z.boolean().optional(),
6467
});
6568

6669
export type PresetDataSchema = z.infer<typeof presetDataSchema>;

pages/api/webhooks/services/[...path]/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ async function handleDocumentCreate(
488488
enableNotification: link.enableNotification,
489489
enableFeedback: link.enableFeedback,
490490
enableScreenshotProtection: link.enableScreenshotProtection,
491-
showBanner: link.showBanner,
491+
showBanner: link.showBanner ?? preset?.showBanner ?? false,
492492
audienceType: link.audienceType,
493493
groupId: isGroupAudience ? link.groupId : null,
494494
// For group links, ignore allow/deny lists from presets as access is controlled by group membership
@@ -700,7 +700,7 @@ async function handleLinkCreate(
700700
enableNotification: link.enableNotification,
701701
enableFeedback: link.enableFeedback,
702702
enableScreenshotProtection: link.enableScreenshotProtection,
703-
showBanner: link.showBanner,
703+
showBanner: link.showBanner ?? preset?.showBanner ?? false,
704704
audienceType: link.audienceType,
705705
groupId: isGroupAudience ? link.groupId : null,
706706
// For group links, ignore allow/deny lists from presets as access is controlled by group membership
@@ -877,7 +877,7 @@ async function handleDataroomCreate(
877877
enableNotification: link.enableNotification,
878878
enableFeedback: link.enableFeedback,
879879
enableScreenshotProtection: link.enableScreenshotProtection,
880-
showBanner: link.showBanner,
880+
showBanner: link.showBanner ?? preset?.showBanner ?? false,
881881
audienceType: link.audienceType,
882882
groupId: isGroupAudience ? link.groupId : null,
883883
allowList: link.allowList || preset?.allowList,

pages/settings/presets/[id].tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import ExpirationInSection from "@/components/links/link-sheet/expirationIn-sect
3131
import { LinkUpgradeOptions } from "@/components/links/link-sheet/link-options";
3232
import OGSection from "@/components/links/link-sheet/og-section";
3333
import PasswordSection from "@/components/links/link-sheet/password-section";
34+
import { ProBannerSection } from "@/components/links/link-sheet/pro-banner-section";
3435
import ScreenshotProtectionSection from "@/components/links/link-sheet/screenshot-protection-section";
3536
import WatermarkSection from "@/components/links/link-sheet/watermark-section";
3637
import Preview from "@/components/settings/og-preview";
@@ -138,6 +139,7 @@ export default function EditPreset() {
138139
enableCustomFields: customFields.length > 0,
139140
customFields: customFields,
140141
enableNotification: preset.enableNotification ?? false,
142+
showBanner: preset.showBanner ?? false,
141143
});
142144
}
143145
}, [preset]);
@@ -188,6 +190,7 @@ export default function EditPreset() {
188190
enableCustomFields: data.enableCustomFields,
189191
customFields: data.customFields,
190192
enableNotification: data.enableNotification,
193+
showBanner: data.showBanner,
191194
}),
192195
});
193196

@@ -476,6 +479,22 @@ export default function EditPreset() {
476479
presets={null}
477480
/>
478481
</div>
482+
483+
<div className="rounded-lg border p-6">
484+
<h3 className="mb-4 text-lg font-medium">Branding</h3>
485+
<ProBannerSection
486+
data={data as any}
487+
setData={setData as any}
488+
isAllowed={
489+
isTrial ||
490+
(isPro && allowAdvancedLinkControls) ||
491+
isBusiness ||
492+
isDatarooms ||
493+
isDataroomsPlus
494+
}
495+
handleUpgradeStateChange={handleUpgradeStateChange}
496+
/>
497+
</div>
479498
</div>
480499

481500
<div className="sticky top-0 md:overflow-auto">

pages/settings/presets/new.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import ExpirationInSection from "@/components/links/link-sheet/expirationIn-sect
3232
import { LinkUpgradeOptions } from "@/components/links/link-sheet/link-options";
3333
import OGSection from "@/components/links/link-sheet/og-section";
3434
import PasswordSection from "@/components/links/link-sheet/password-section";
35+
import { ProBannerSection } from "@/components/links/link-sheet/pro-banner-section";
3536
import ScreenshotProtectionSection from "@/components/links/link-sheet/screenshot-protection-section";
3637
import WatermarkSection from "@/components/links/link-sheet/watermark-section";
3738
import Preview from "@/components/settings/og-preview";
@@ -137,6 +138,7 @@ export default function NewPreset() {
137138
: false,
138139
customFields: data.customFields,
139140
enableNotification: data.enableNotification,
141+
showBanner: data.showBanner,
140142
}),
141143
});
142144

@@ -313,6 +315,22 @@ export default function NewPreset() {
313315
presets={null}
314316
/>
315317
</div>
318+
319+
<div className="rounded-lg border p-6">
320+
<h3 className="mb-4 text-lg font-medium">Branding</h3>
321+
<ProBannerSection
322+
data={data}
323+
setData={setData}
324+
isAllowed={
325+
isTrial ||
326+
(isPro && allowAdvancedLinkControls) ||
327+
isBusiness ||
328+
isDatarooms ||
329+
isDataroomsPlus
330+
}
331+
handleUpgradeStateChange={handleUpgradeStateChange}
332+
/>
333+
</div>
316334
</div>
317335

318336
<div className="sticky top-0 md:overflow-auto">
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- AlterTable
2+
ALTER TABLE "LinkPreset" ADD COLUMN "showBanner" BOOLEAN DEFAULT false;

prisma/schema/link.prisma

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ model LinkPreset {
125125
enableCustomFields Boolean? @default(false)
126126
customFields Json? //[{type: "SHORT_TEXT", identifier: "name", label: "Name", required: true}]
127127
128+
showBanner Boolean? @default(false) // Optional give user a option to show the "Powered by Papermark" banner
129+
128130
isDefault Boolean @default(false)
129131
130132
createdAt DateTime @default(now())

0 commit comments

Comments
 (0)