Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
feat: update link options
Marc Seitzd7a12def3182
diff --git a/components/links/link-sheet/index-file-section.tsx b/components/links/link-sheet/index-file-section.tsxindex e006cab2..0aac344b 100644--- a/components/links/link-sheet/index-file-section.tsx+++ b/components/links/link-sheet/index-file-section.tsx@@ -2,13 +2,22 @@ import { useEffect, useState } from "react";import { DEFAULT_LINK_TYPE } from ".";import LinkItem from "./link-item";+import { LinkUpgradeOptions } from "./link-options";export default function IndexFileSection({data,setData,+ isAllowed,+ handleUpgradeStateChange,}: {data: DEFAULT_LINK_TYPE;setData: React.Dispatch<React.SetStateAction<DEFAULT_LINK_TYPE>>;+ isAllowed: boolean;+ handleUpgradeStateChange: ({+ state,+ trigger,+ plan,+ }: LinkUpgradeOptions) => void;}) {const { enableIndexFile } = data;const [enabled, setEnabled] = useState<boolean>(false);@@ -30,6 +39,15 @@ export default function IndexFileSection({enabled={enabled}link="https://www.papermark.com/help/article/link-settings"action={handleEnableIndexFile}+ isAllowed={isAllowed}+ requiredPlan="Data Rooms Plus"+ upgradeAction={() =>+ handleUpgradeStateChange({+ state: true,+ trigger: "link_sheet_index_file_section",+ plan: "Data Rooms Plus",+ })+ }tooltipContent="Allow visitors to generate an index file of all documents in the dataroom."/></div>diff --git a/components/links/link-sheet/index.tsx b/components/links/link-sheet/index.tsxindex 7242faf9..f6a38247 100644--- a/components/links/link-sheet/index.tsx+++ b/components/links/link-sheet/index.tsx@@ -251,6 +251,7 @@ export default function LinkSheet({agreementId: preset.agreementId || prev.agreementId,enableScreenshotProtection:preset.enableScreenshotProtection || prev.enableScreenshotProtection,+ enableIndexFile: preset.enableIndexFile || prev.enableIndexFile,};});@@ -761,4 +762,4 @@ export default function LinkSheet({</SheetContent></Sheet>);-}\ No newline at end of file+}diff --git a/components/links/link-sheet/link-options.tsx b/components/links/link-sheet/link-options.tsxindex 374d276b..c699b5ac 100644--- a/components/links/link-sheet/link-options.tsx+++ b/components/links/link-sheet/link-options.tsx@@ -98,7 +98,11 @@ export const LinkOptions = ({/>) : null}{linkType === LinkType.DATAROOM_LINK ? (- <IndexFileSection {...{ data, setData }} />+ <IndexFileSection+ {...{ data, setData }}+ isAllowed={isDataroomsPlus}+ handleUpgradeStateChange={handleUpgradeStateChange}+ />) : null}<OGSection{...{ data, setData }}@@ -235,4 +239,4 @@ export const LinkOptions = ({/></div>);-};\ No newline at end of file+};diff --git a/pages/api/links/[id]/index.ts b/pages/api/links/[id]/index.tsindex 1d5d1b3d..69755543 100644--- a/pages/api/links/[id]/index.ts+++ b/pages/api/links/[id]/index.ts@@ -160,7 +160,6 @@ export default async function handle(password,expiresAt,teamId,- enableIndexFile,...linkDomainData} = req.body;@@ -273,7 +272,7 @@ export default async function handle(domainId: domainObj?.id || null,domainSlug: domain || null,slug: slug || null,- enableIndexFile: linkData.enableIndexFile,+ enableIndexFile: linkData.enableIndexFile || false,enableNotification: linkData.enableNotification,enableFeedback: linkData.enableFeedback,enableScreenshotProtection: linkData.enableScreenshotProtection,