Skip to content
Merged
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
1 change: 1 addition & 0 deletions components/links/link-sheet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ export default function LinkSheet({
enableScreenshotProtection:
preset.enableScreenshotProtection || prev.enableScreenshotProtection,
enableNotification: !!preset.enableNotification,
showBanner: preset.showBanner ?? prev.showBanner,
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ export function DataroomLinkSheet({
enableScreenshotProtection:
preset.enableScreenshotProtection || prev.enableScreenshotProtection,
enableNotification: !!preset.enableNotification,
showBanner: preset.showBanner ?? prev.showBanner,
};
});

Expand Down
3 changes: 3 additions & 0 deletions lib/zod/schemas/presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
6 changes: 3 additions & 3 deletions pages/api/webhooks/services/[...path]/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
19 changes: 19 additions & 0 deletions pages/settings/presets/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -138,6 +139,7 @@ export default function EditPreset() {
enableCustomFields: customFields.length > 0,
customFields: customFields,
enableNotification: preset.enableNotification ?? false,
showBanner: preset.showBanner ?? false,
});
}
}, [preset]);
Expand Down Expand Up @@ -188,6 +190,7 @@ export default function EditPreset() {
enableCustomFields: data.enableCustomFields,
customFields: data.customFields,
enableNotification: data.enableNotification,
showBanner: data.showBanner,
}),
});

Expand Down Expand Up @@ -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">
Expand Down
18 changes: 18 additions & 0 deletions pages/settings/presets/new.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -137,6 +138,7 @@ export default function NewPreset() {
: false,
customFields: data.customFields,
enableNotification: data.enableNotification,
showBanner: data.showBanner,
}),
});

Expand Down Expand Up @@ -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">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "LinkPreset" ADD COLUMN "showBanner" BOOLEAN DEFAULT false;
2 changes: 2 additions & 0 deletions prisma/schema/link.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down