Skip to content

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

feat: enable all functions for trial

Marc Seitz3ecd6cf33493
diff --git a/components/Sidebar.tsx b/components/Sidebar.tsx
index 581ef4e6..ee3bd78c 100644
--- a/components/Sidebar.tsx
+++ b/components/Sidebar.tsx
@@ -79,6 +79,7 @@ export const SidebarComponent = ({ className }: { className?: string }) => {
}, []);
const userPlan = plan;
+ const isTrial = !!userTrial;
const navigation = [
// {
@@ -158,6 +159,11 @@ export const SidebarComponent = ({ className }: { className?: string }) => {
{userPlan.charAt(0).toUpperCase() + userPlan.slice(1)}
</span>
) : null}
+ {isTrial ? (
+ <span className="ml-4 rounded-sm bg-foreground px-2 py-0.5 text-xs tracking-normal text-background ring-1 ring-gray-800">
+ Trial
+ </span>
+ ) : null}
</p>
</div>
diff --git a/components/billing/upgrade-plan-modal.tsx b/components/billing/upgrade-plan-modal.tsx
index 3134d629..49117b9b 100644
--- a/components/billing/upgrade-plan-modal.tsx
+++ b/components/billing/upgrade-plan-modal.tsx
@@ -41,9 +41,11 @@ export function UpgradePlanModal({
const [period, setPeriod] = useState<"yearly" | "monthly">("yearly");
const [clicked, setClicked] = useState<boolean>(false);
const teamInfo = useTeam();
- const { plan: teamPlan } = usePlan();
+ const { plan: teamPlan, trial } = usePlan();
const analytics = useAnalytics();
+ const isTrial = !!trial;
+
const features = useMemo(() => {
if (plan === "Pro") {
return [
@@ -291,13 +293,13 @@ export function UpgradePlanModal({
}}
>{`Upgrade to ${plan} ${capitalize(period)}`}</Button>
<div className="flex items-center justify-center space-x-2">
- {plan === "Business" ? (
+ {plan === "Business" && !isTrial ? (
<DataroomTrialModal>
<button
className="text-center text-xs text-muted-foreground underline-offset-4 transition-all hover:text-gray-800 hover:underline hover:dark:text-muted-foreground/80"
onClick={() => analytics.capture("Dataroom Trial Clicked")}
>
- Looking for a dataroom trial?
+ Looking for a trial?
</button>
</DataroomTrialModal>
) : (
diff --git a/components/links/link-sheet/agreement-section.tsx b/components/links/link-sheet/agreement-section.tsx
index 08e0db7d..5af4b34b 100644
--- a/components/links/link-sheet/agreement-section.tsx
+++ b/components/links/link-sheet/agreement-section.tsx
@@ -21,12 +21,12 @@ import { LinkUpgradeOptions } from "./link-options";
export default function AgreementSection({
data,
setData,
- hasFreePlan,
+ isAllowed,
handleUpgradeStateChange,
}: {
data: DEFAULT_LINK_TYPE;
setData: React.Dispatch<React.SetStateAction<DEFAULT_LINK_TYPE>>;
- hasFreePlan: boolean;
+ isAllowed: boolean;
handleUpgradeStateChange: ({
state,
trigger,
@@ -70,7 +70,7 @@ export default function AgreementSection({
title="Require NDA to view"
enabled={enabled}
action={handleAgreement}
- hasFreePlan={hasFreePlan}
+ isAllowed={isAllowed}
requiredPlan="datarooms"
upgradeAction={() =>
handleUpgradeStateChange({
diff --git a/components/links/link-sheet/allow-list-section.tsx b/components/links/link-sheet/allow-list-section.tsx
index ef2bf54b..669a4c8a 100644
--- a/components/links/link-sheet/allow-list-section.tsx
+++ b/components/links/link-sheet/allow-list-section.tsx
@@ -14,12 +14,12 @@ import { LinkUpgradeOptions } from "./link-options";
export default function AllowListSection({
data,
setData,
- hasFreePlan,
+ isAllowed,
handleUpgradeStateChange,
}: {
data: DEFAULT_LINK_TYPE;
setData: React.Dispatch<React.SetStateAction<DEFAULT_LINK_TYPE>>;
- hasFreePlan: boolean;
+ isAllowed: boolean;
handleUpgradeStateChange: ({
state,
trigger,
@@ -77,7 +77,7 @@ export default function AllowListSection({
<LinkItem
title="Allow specified viewers"
enabled={enabled}
- hasFreePlan={hasFreePlan}
+ isAllowed={isAllowed}
action={handleEnableAllowList}
requiredPlan="business"
upgradeAction={() =>
diff --git a/components/links/link-sheet/deny-list-section.tsx b/components/links/link-sheet/deny-list-section.tsx
index 93a93a96..e563d7af 100644
--- a/components/links/link-sheet/deny-list-section.tsx
+++ b/components/links/link-sheet/deny-list-section.tsx
@@ -14,12 +14,13 @@ import { LinkUpgradeOptions } from "./link-options";
export default function DenyListSection({
data,
setData,
- hasFreePlan,
+ isAllowed,
handleUpgradeStateChange,
}: {
data: DEFAULT_LINK_TYPE;
setData: React.Dispatch<React.SetStateAction<DEFAULT_LINK_TYPE>>;
- hasFreePlan: boolean;
+
+ isAllowed: boolean;
handleUpgradeStateChange: ({
state,
trigger,
@@ -77,7 +78,7 @@ export default function DenyListSection({
title="Block specified viewers"
enabled={enabled}
action={handleEnableDenyList}
- hasFreePlan={hasFreePlan}
+ isAllowed={isAllowed}
requiredPlan="business"
upgradeAction={() =>
handleUpgradeStateChange({
diff --git a/components/links/link-sheet/email-authentication-section.tsx b/components/links/link-sheet/email-authentication-section.tsx
index df88dd4f..6eede910 100644
--- a/components/links/link-sheet/email-authentication-section.tsx
+++ b/components/links/link-sheet/email-authentication-section.tsx
@@ -7,12 +7,12 @@ import { LinkUpgradeOptions } from "./link-options";
export default function EmailAuthenticationSection({
data,
setData,
- hasFreePlan,
+ isAllowed,
handleUpgradeStateChange,
}: {
data: DEFAULT_LINK_TYPE;
setData: React.Dispatch<React.SetStateAction<DEFAULT_LINK_TYPE>>;
- hasFreePlan: boolean;
+ isAllowed: boolean;
handleUpgradeStateChange: ({
state,
trigger,
@@ -42,7 +42,7 @@ export default function EmailAuthenticationSection({
title="Require email verification"
enabled={enabled}
action={handleEnableAuthentication}
- hasFreePlan={hasFreePlan}
+ isAllowed={isAllowed}
requiredPlan="pro"
upgradeAction={() =>
handleUpgradeStateChange({
diff --git a/components/links/link-sheet/link-item.tsx b/components/links/link-sheet/link-item.tsx
index 7e1d6f4f..55a2085f 100644
--- a/components/links/link-sheet/link-item.tsx
+++ b/components/links/link-sheet/link-item.tsx
@@ -7,14 +7,14 @@ export default function LinkItem({
title,
enabled,
action,
- hasFreePlan,
+ isAllowed = true,
requiredPlan,
upgradeAction,
}: {
title: string;
enabled: boolean;
action: () => void;
- hasFreePlan?: boolean;
+ isAllowed?: boolean;
requiredPlan?: string;
upgradeAction?: () => void;
}) {
@@ -26,17 +26,17 @@ export default function LinkItem({
"cursor-pointer text-sm font-medium leading-6",
enabled ? "text-foreground" : "text-muted-foreground",
)}
- onClick={hasFreePlan ? () => upgradeAction?.() : action}
+ onClick={isAllowed ? action : () => upgradeAction?.()}
>
{title}
- {hasFreePlan && requiredPlan && <PlanBadge plan={requiredPlan} />}
+ {!isAllowed && requiredPlan && <PlanBadge plan={requiredPlan} />}
</h2>
</div>
<Switch
checked={enabled}
- onClick={hasFreePlan ? () => upgradeAction?.() : undefined}
- className={hasFreePlan ? "opacity-50" : undefined}
- onCheckedChange={hasFreePlan ? undefined : action}
+ onClick={isAllowed ? undefined : () => upgradeAction?.()}
+ className={isAllowed ? undefined : "opacity-50"}
+ onCheckedChange={isAllowed ? action : undefined}
/>
</div>
);
diff --git a/components/links/link-sheet/link-options.tsx b/components/links/link-sheet/link-options.tsx
index 7f306af5..534846e6 100644
--- a/components/links/link-sheet/link-options.tsx
+++ b/components/links/link-sheet/link-options.tsx
@@ -38,11 +38,16 @@ export const LinkOptions = ({
setData: React.Dispatch<React.SetStateAction<DEFAULT_LINK_TYPE>>;
linkType: LinkType;
}) => {
- const { plan } = usePlan();
+ const { plan, trial } = usePlan();
const { limits } = useLimits();
- const hasFreePlan = plan === "free";
- const isNotBusiness = plan !== "business";
- const isNotDatarooms = plan !== "datarooms";
+
+ const isTrial = !!trial;
+ const isPro = plan === "pro";
+ const isBusiness = plan === "business";
+ const isDatarooms = plan === "datarooms";
+ const allowAdvancedLinkControls = limits
+ ? limits?.advancedLinkControlsOnPro
+ : false;
const [openUpgradeModal, setOpenUpgradeModal] = useState<boolean>(false);
const [trigger, setTrigger] = useState<string>("");
@@ -70,56 +75,73 @@ export const LinkOptions = ({
<ExpirationSection {...{ data, setData }} />
<OGSection
{...{ data, setData }}
- hasFreePlan={
- isNotBusiness && isNotDatarooms && !limits?.advancedLinkControlsOnPro
+ isAllowed={
+ isTrial ||
+ (isPro && allowAdvancedLinkControls) ||
+ isBusiness ||
+ isDatarooms
}
handleUpgradeStateChange={handleUpgradeStateChange}
/>
<EmailAuthenticationSection
{...{ data, setData }}
- hasFreePlan={hasFreePlan}
+ isAllowed={isTrial || isPro || isBusiness || isDatarooms}
handleUpgradeStateChange={handleUpgradeStateChange}
/>
<AllowListSection
{...{ data, setData }}
- hasFreePlan={
- isNotBusiness && isNotDatarooms && !limits?.advancedLinkControlsOnPro
+ isAllowed={
+ isTrial ||
+ (isPro && allowAdvancedLinkControls) ||
+ isBusiness ||
+ isDatarooms
}
handleUpgradeStateChange={handleUpgradeStateChange}
/>
<DenyListSection
{...{ data, setData }}
- hasFreePlan={
- isNotBusiness && isNotDatarooms && !limits?.advancedLinkControlsOnPro
+ isAllowed={
+ isTrial ||
+ (isPro && allowAdvancedLinkControls) ||
+ isBusiness ||
+ isDatarooms
}
handleUpgradeStateChange={handleUpgradeStateChange}
/>
<PasswordSection {...{ data, setData }} />
<ScreenshotProtectionSection
{...{ data, setData }}
- hasFreePlan={
- isNotBusiness && isNotDatarooms && !limits?.advancedLinkControlsOnPro
+ isAllowed={
+ isTrial ||
+ (isPro && allowAdvancedLinkControls) ||
+ isBusiness ||
+ isDatarooms
}
handleUpgradeStateChange={handleUpgradeStateChange}
/>
<FeedbackSection {...{ data, setData }} />
<QuestionSection
{...{ data, setData }}
- hasFreePlan={
- isNotBusiness && isNotDatarooms && !limits?.advancedLinkControlsOnPro
+ isAllowed={
+ isTrial ||
+ (isPro && allowAdvancedLinkControls) ||
+ isBusiness ||
+ isDatarooms
}
handleUpgradeStateChange={handleUpgradeStateChange}
/>
<AgreementSection
{...{ data, setData }}
- hasFreePlan={isNotDatarooms}
+ isAllowed={isTrial || isDatarooms}
handleUpgradeStateChange={handleUpgradeStateChange}
/>
{linkType === LinkType.DOCUMENT_LINK ? (
<ProBannerSection
{...{ data, setData }}
- hasFreePlan={hasFreePlan || plan === "starter"}
+ isAllowed={
+ isTrial || isPro || isBusiness || isDatarooms || plan === "starter"
+ }
handleUpgradeStateChange={handleUpgradeStateChange}
/>
) : null}
diff --git a/components/links/link-sheet/og-section.tsx b/components/links/link-sheet/og-section.tsx
index 0fa3d59b..328e0a65 100644
--- a/components/links/link-sheet/og-section.tsx
+++ b/components/links/link-sheet/og-section.tsx
@@ -17,12 +17,12 @@ import { LinkUpgradeOptions } from "./link-options";
export default function OGSection({
data,
setData,
- hasFreePlan,
+ isAllowed,
handleUpgradeStateChange,
}: {
data: DEFAULT_LINK_TYPE;
setData: React.Dispatch<React.SetStateAction<DEFAULT_LINK_TYPE>>;
- hasFreePlan: boolean;
+ isAllowed: boolean;
handleUpgradeStateChange: ({
state,
trigger,
@@ -76,7 +76,7 @@ export default function OGSection({
title="Custom social media cards"
enabled={enableCustomMetatag}
action={handleCustomMetatag}
- hasFreePlan={hasFreePlan}
+ isAllowed={isAllowed}
requiredPlan="Business"
upgradeAction={() =>
handleUpgradeStateChange({
diff --git a/components/links/link-sheet/pro-banner-section.tsx b/components/links/link-sheet/pro-banner-section.tsx
index 18e4b96f..29785332 100644
--- a/components/links/link-sheet/pro-banner-section.tsx
+++ b/components/links/link-sheet/pro-banner-section.tsx
@@ -7,12 +7,12 @@ import { LinkUpgradeOptions } from "./link-options";
export function ProBannerSection({
data,
setData,
- hasFreePlan,
+ isAllowed,
handleUpgradeStateChange,
}: {
data: DEFAULT_LINK_TYPE;
setData: React.Dispatch<React.SetStateAction<DEFAULT_LINK_TYPE>>;
- hasFreePlan: boolean;
+ isAllowed: boolean;
handleUpgradeStateChange: ({
state,
trigger,
@@ -39,7 +39,7 @@ export function ProBannerSection({
title="Show Visitor Statistics & Papermark Branding"
enabled={enabled}
action={handleShowBanner}
- hasFreePlan={hasFreePlan}
+ isAllowed={isAllowed}
requiredPlan="pro"
upgradeAction={() =>
handleUpgradeStateChange({
diff --git a/components/links/link-sheet/question-section.tsx b/components/links/link-sheet/question-section.tsx
index c6ad0d44..bf518ad4 100644
--- a/components/links/link-sheet/question-section.tsx
+++ b/components/links/link-sheet/question-section.tsx
@@ -21,12 +21,12 @@ import { LinkUpgradeOptions } from "./link-options";
export default function QuestionSection({
data,
setData,
- hasFreePlan,
+ isAllowed,
handleUpgradeStateChange,
}: {
data: DEFAULT_LINK_TYPE;
setData: React.Dispatch<React.SetStateAction<DEFAULT_LINK_TYPE>>;
- hasFreePlan: boolean;
+ isAllowed: boolean;
handleUpgradeStateChange: ({
state,
trigger,
@@ -53,7 +53,7 @@ export default function QuestionSection({
title="Feedback Question"
enabled={enabled}
action={handleQuestion}
- hasFreePlan={hasFreePlan}
+ isAllowed={isAllowed}
requiredPlan="business"
upgradeAction={() =>
handleUpgradeStateChange({
diff --git a/components/links/link-sheet/screenshot-protection-section.tsx b/components/links/link-sheet/screenshot-protection-section.tsx
index 1cd0d85c..88259676 100644
--- a/components/links/link-sheet/screenshot-protection-section.tsx
+++ b/components/links/link-sheet/screenshot-protection-section.tsx
@@ -7,12 +7,12 @@ import { LinkUpgradeOptions } from "./link-options";
export default function ScreenshotProtectionSection({
data,
setData,
- hasFreePlan,
+ isAllowed,
handleUpgradeStateChange,
}: {
data: DEFAULT_LINK_TYPE;
setData: React.Dispatch<React.SetStateAction<DEFAULT_LINK_TYPE>>;
- hasFreePlan: boolean;
+ isAllowed: boolean;
handleUpgradeStateChange: ({
state,
trigger,
@@ -41,7 +41,7 @@ export default function ScreenshotProtectionSection({
title="Enable screenshot protection"
enabled={enabled}
action={handleEnableScreenshotProtection}
- hasFreePlan={hasFreePlan}
+ isAllowed={isAllowed}
requiredPlan="business"
upgradeAction={() =>
handleUpgradeStateChange({
diff --git a/components/welcome/dataroom.tsx b/components/welcome/dataroom.tsx
index 06bffbe2..e918ed9f 100644
--- a/components/welcome/dataroom.tsx
+++ b/components/welcome/dataroom.tsx
@@ -78,7 +78,8 @@ export default function Dataroom() {
Get a data room trial
</Button>
<span className="text-xs text-muted-foreground">
- Data rooms are available on our `Business` plan. <br />
+ Data rooms are available on our `Business` and `Data Rooms` plan.{" "}
+ <br />
You receive a 7-day trial.
</span>
</motion.div>
diff --git a/ee/limits/constants.ts b/ee/limits/constants.ts
index df831c30..41510b26 100644
--- a/ee/limits/constants.ts
+++ b/ee/limits/constants.ts
@@ -26,7 +26,7 @@ export const BUSINESS_PLAN_LIMITS = {
};
export const DATAROOMS_PLAN_LIMITS = {
- users: 5,
+ users: 3,
domains: 10,
datarooms: 100,
customDomainOnPro: true,