Skip to content

Commit 3ecd6cf

Browse files
committed
feat: enable all functions for trial
1 parent a83ade1 commit 3ecd6cf

14 files changed

+85
-53
lines changed

components/Sidebar.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export const SidebarComponent = ({ className }: { className?: string }) => {
7979
}, []);
8080

8181
const userPlan = plan;
82+
const isTrial = !!userTrial;
8283

8384
const navigation = [
8485
// {
@@ -158,6 +159,11 @@ export const SidebarComponent = ({ className }: { className?: string }) => {
158159
{userPlan.charAt(0).toUpperCase() + userPlan.slice(1)}
159160
</span>
160161
) : null}
162+
{isTrial ? (
163+
<span className="ml-4 rounded-sm bg-foreground px-2 py-0.5 text-xs tracking-normal text-background ring-1 ring-gray-800">
164+
Trial
165+
</span>
166+
) : null}
161167
</p>
162168
</div>
163169

components/billing/upgrade-plan-modal.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ export function UpgradePlanModal({
4141
const [period, setPeriod] = useState<"yearly" | "monthly">("yearly");
4242
const [clicked, setClicked] = useState<boolean>(false);
4343
const teamInfo = useTeam();
44-
const { plan: teamPlan } = usePlan();
44+
const { plan: teamPlan, trial } = usePlan();
4545
const analytics = useAnalytics();
4646

47+
const isTrial = !!trial;
48+
4749
const features = useMemo(() => {
4850
if (plan === "Pro") {
4951
return [
@@ -291,13 +293,13 @@ export function UpgradePlanModal({
291293
}}
292294
>{`Upgrade to ${plan} ${capitalize(period)}`}</Button>
293295
<div className="flex items-center justify-center space-x-2">
294-
{plan === "Business" ? (
296+
{plan === "Business" && !isTrial ? (
295297
<DataroomTrialModal>
296298
<button
297299
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"
298300
onClick={() => analytics.capture("Dataroom Trial Clicked")}
299301
>
300-
Looking for a dataroom trial?
302+
Looking for a trial?
301303
</button>
302304
</DataroomTrialModal>
303305
) : (

components/links/link-sheet/agreement-section.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ import { LinkUpgradeOptions } from "./link-options";
2121
export default function AgreementSection({
2222
data,
2323
setData,
24-
hasFreePlan,
24+
isAllowed,
2525
handleUpgradeStateChange,
2626
}: {
2727
data: DEFAULT_LINK_TYPE;
2828
setData: React.Dispatch<React.SetStateAction<DEFAULT_LINK_TYPE>>;
29-
hasFreePlan: boolean;
29+
isAllowed: boolean;
3030
handleUpgradeStateChange: ({
3131
state,
3232
trigger,
@@ -70,7 +70,7 @@ export default function AgreementSection({
7070
title="Require NDA to view"
7171
enabled={enabled}
7272
action={handleAgreement}
73-
hasFreePlan={hasFreePlan}
73+
isAllowed={isAllowed}
7474
requiredPlan="datarooms"
7575
upgradeAction={() =>
7676
handleUpgradeStateChange({

components/links/link-sheet/allow-list-section.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ import { LinkUpgradeOptions } from "./link-options";
1414
export default function AllowListSection({
1515
data,
1616
setData,
17-
hasFreePlan,
17+
isAllowed,
1818
handleUpgradeStateChange,
1919
}: {
2020
data: DEFAULT_LINK_TYPE;
2121
setData: React.Dispatch<React.SetStateAction<DEFAULT_LINK_TYPE>>;
22-
hasFreePlan: boolean;
22+
isAllowed: boolean;
2323
handleUpgradeStateChange: ({
2424
state,
2525
trigger,
@@ -77,7 +77,7 @@ export default function AllowListSection({
7777
<LinkItem
7878
title="Allow specified viewers"
7979
enabled={enabled}
80-
hasFreePlan={hasFreePlan}
80+
isAllowed={isAllowed}
8181
action={handleEnableAllowList}
8282
requiredPlan="business"
8383
upgradeAction={() =>

components/links/link-sheet/deny-list-section.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ import { LinkUpgradeOptions } from "./link-options";
1414
export default function DenyListSection({
1515
data,
1616
setData,
17-
hasFreePlan,
17+
isAllowed,
1818
handleUpgradeStateChange,
1919
}: {
2020
data: DEFAULT_LINK_TYPE;
2121
setData: React.Dispatch<React.SetStateAction<DEFAULT_LINK_TYPE>>;
22-
hasFreePlan: boolean;
22+
23+
isAllowed: boolean;
2324
handleUpgradeStateChange: ({
2425
state,
2526
trigger,
@@ -77,7 +78,7 @@ export default function DenyListSection({
7778
title="Block specified viewers"
7879
enabled={enabled}
7980
action={handleEnableDenyList}
80-
hasFreePlan={hasFreePlan}
81+
isAllowed={isAllowed}
8182
requiredPlan="business"
8283
upgradeAction={() =>
8384
handleUpgradeStateChange({

components/links/link-sheet/email-authentication-section.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import { LinkUpgradeOptions } from "./link-options";
77
export default function EmailAuthenticationSection({
88
data,
99
setData,
10-
hasFreePlan,
10+
isAllowed,
1111
handleUpgradeStateChange,
1212
}: {
1313
data: DEFAULT_LINK_TYPE;
1414
setData: React.Dispatch<React.SetStateAction<DEFAULT_LINK_TYPE>>;
15-
hasFreePlan: boolean;
15+
isAllowed: boolean;
1616
handleUpgradeStateChange: ({
1717
state,
1818
trigger,
@@ -42,7 +42,7 @@ export default function EmailAuthenticationSection({
4242
title="Require email verification"
4343
enabled={enabled}
4444
action={handleEnableAuthentication}
45-
hasFreePlan={hasFreePlan}
45+
isAllowed={isAllowed}
4646
requiredPlan="pro"
4747
upgradeAction={() =>
4848
handleUpgradeStateChange({

components/links/link-sheet/link-item.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ export default function LinkItem({
77
title,
88
enabled,
99
action,
10-
hasFreePlan,
10+
isAllowed = true,
1111
requiredPlan,
1212
upgradeAction,
1313
}: {
1414
title: string;
1515
enabled: boolean;
1616
action: () => void;
17-
hasFreePlan?: boolean;
17+
isAllowed?: boolean;
1818
requiredPlan?: string;
1919
upgradeAction?: () => void;
2020
}) {
@@ -26,17 +26,17 @@ export default function LinkItem({
2626
"cursor-pointer text-sm font-medium leading-6",
2727
enabled ? "text-foreground" : "text-muted-foreground",
2828
)}
29-
onClick={hasFreePlan ? () => upgradeAction?.() : action}
29+
onClick={isAllowed ? action : () => upgradeAction?.()}
3030
>
3131
{title}
32-
{hasFreePlan && requiredPlan && <PlanBadge plan={requiredPlan} />}
32+
{!isAllowed && requiredPlan && <PlanBadge plan={requiredPlan} />}
3333
</h2>
3434
</div>
3535
<Switch
3636
checked={enabled}
37-
onClick={hasFreePlan ? () => upgradeAction?.() : undefined}
38-
className={hasFreePlan ? "opacity-50" : undefined}
39-
onCheckedChange={hasFreePlan ? undefined : action}
37+
onClick={isAllowed ? undefined : () => upgradeAction?.()}
38+
className={isAllowed ? undefined : "opacity-50"}
39+
onCheckedChange={isAllowed ? action : undefined}
4040
/>
4141
</div>
4242
);

components/links/link-sheet/link-options.tsx

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,16 @@ export const LinkOptions = ({
3838
setData: React.Dispatch<React.SetStateAction<DEFAULT_LINK_TYPE>>;
3939
linkType: LinkType;
4040
}) => {
41-
const { plan } = usePlan();
41+
const { plan, trial } = usePlan();
4242
const { limits } = useLimits();
43-
const hasFreePlan = plan === "free";
44-
const isNotBusiness = plan !== "business";
45-
const isNotDatarooms = plan !== "datarooms";
43+
44+
const isTrial = !!trial;
45+
const isPro = plan === "pro";
46+
const isBusiness = plan === "business";
47+
const isDatarooms = plan === "datarooms";
48+
const allowAdvancedLinkControls = limits
49+
? limits?.advancedLinkControlsOnPro
50+
: false;
4651

4752
const [openUpgradeModal, setOpenUpgradeModal] = useState<boolean>(false);
4853
const [trigger, setTrigger] = useState<string>("");
@@ -70,56 +75,73 @@ export const LinkOptions = ({
7075
<ExpirationSection {...{ data, setData }} />
7176
<OGSection
7277
{...{ data, setData }}
73-
hasFreePlan={
74-
isNotBusiness && isNotDatarooms && !limits?.advancedLinkControlsOnPro
78+
isAllowed={
79+
isTrial ||
80+
(isPro && allowAdvancedLinkControls) ||
81+
isBusiness ||
82+
isDatarooms
7583
}
7684
handleUpgradeStateChange={handleUpgradeStateChange}
7785
/>
7886

7987
<EmailAuthenticationSection
8088
{...{ data, setData }}
81-
hasFreePlan={hasFreePlan}
89+
isAllowed={isTrial || isPro || isBusiness || isDatarooms}
8290
handleUpgradeStateChange={handleUpgradeStateChange}
8391
/>
8492
<AllowListSection
8593
{...{ data, setData }}
86-
hasFreePlan={
87-
isNotBusiness && isNotDatarooms && !limits?.advancedLinkControlsOnPro
94+
isAllowed={
95+
isTrial ||
96+
(isPro && allowAdvancedLinkControls) ||
97+
isBusiness ||
98+
isDatarooms
8899
}
89100
handleUpgradeStateChange={handleUpgradeStateChange}
90101
/>
91102
<DenyListSection
92103
{...{ data, setData }}
93-
hasFreePlan={
94-
isNotBusiness && isNotDatarooms && !limits?.advancedLinkControlsOnPro
104+
isAllowed={
105+
isTrial ||
106+
(isPro && allowAdvancedLinkControls) ||
107+
isBusiness ||
108+
isDatarooms
95109
}
96110
handleUpgradeStateChange={handleUpgradeStateChange}
97111
/>
98112
<PasswordSection {...{ data, setData }} />
99113
<ScreenshotProtectionSection
100114
{...{ data, setData }}
101-
hasFreePlan={
102-
isNotBusiness && isNotDatarooms && !limits?.advancedLinkControlsOnPro
115+
isAllowed={
116+
isTrial ||
117+
(isPro && allowAdvancedLinkControls) ||
118+
isBusiness ||
119+
isDatarooms
103120
}
104121
handleUpgradeStateChange={handleUpgradeStateChange}
105122
/>
106123
<FeedbackSection {...{ data, setData }} />
107124
<QuestionSection
108125
{...{ data, setData }}
109-
hasFreePlan={
110-
isNotBusiness && isNotDatarooms && !limits?.advancedLinkControlsOnPro
126+
isAllowed={
127+
isTrial ||
128+
(isPro && allowAdvancedLinkControls) ||
129+
isBusiness ||
130+
isDatarooms
111131
}
112132
handleUpgradeStateChange={handleUpgradeStateChange}
113133
/>
114134
<AgreementSection
115135
{...{ data, setData }}
116-
hasFreePlan={isNotDatarooms}
136+
isAllowed={isTrial || isDatarooms}
117137
handleUpgradeStateChange={handleUpgradeStateChange}
118138
/>
119139
{linkType === LinkType.DOCUMENT_LINK ? (
120140
<ProBannerSection
121141
{...{ data, setData }}
122-
hasFreePlan={hasFreePlan || plan === "starter"}
142+
isAllowed={
143+
isTrial || isPro || isBusiness || isDatarooms || plan === "starter"
144+
}
123145
handleUpgradeStateChange={handleUpgradeStateChange}
124146
/>
125147
) : null}

components/links/link-sheet/og-section.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ import { LinkUpgradeOptions } from "./link-options";
1717
export default function OGSection({
1818
data,
1919
setData,
20-
hasFreePlan,
20+
isAllowed,
2121
handleUpgradeStateChange,
2222
}: {
2323
data: DEFAULT_LINK_TYPE;
2424
setData: React.Dispatch<React.SetStateAction<DEFAULT_LINK_TYPE>>;
25-
hasFreePlan: boolean;
25+
isAllowed: boolean;
2626
handleUpgradeStateChange: ({
2727
state,
2828
trigger,
@@ -76,7 +76,7 @@ export default function OGSection({
7676
title="Custom social media cards"
7777
enabled={enableCustomMetatag}
7878
action={handleCustomMetatag}
79-
hasFreePlan={hasFreePlan}
79+
isAllowed={isAllowed}
8080
requiredPlan="Business"
8181
upgradeAction={() =>
8282
handleUpgradeStateChange({

components/links/link-sheet/pro-banner-section.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import { LinkUpgradeOptions } from "./link-options";
77
export function ProBannerSection({
88
data,
99
setData,
10-
hasFreePlan,
10+
isAllowed,
1111
handleUpgradeStateChange,
1212
}: {
1313
data: DEFAULT_LINK_TYPE;
1414
setData: React.Dispatch<React.SetStateAction<DEFAULT_LINK_TYPE>>;
15-
hasFreePlan: boolean;
15+
isAllowed: boolean;
1616
handleUpgradeStateChange: ({
1717
state,
1818
trigger,
@@ -39,7 +39,7 @@ export function ProBannerSection({
3939
title="Show Visitor Statistics & Papermark Branding"
4040
enabled={enabled}
4141
action={handleShowBanner}
42-
hasFreePlan={hasFreePlan}
42+
isAllowed={isAllowed}
4343
requiredPlan="pro"
4444
upgradeAction={() =>
4545
handleUpgradeStateChange({

components/links/link-sheet/question-section.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ import { LinkUpgradeOptions } from "./link-options";
2121
export default function QuestionSection({
2222
data,
2323
setData,
24-
hasFreePlan,
24+
isAllowed,
2525
handleUpgradeStateChange,
2626
}: {
2727
data: DEFAULT_LINK_TYPE;
2828
setData: React.Dispatch<React.SetStateAction<DEFAULT_LINK_TYPE>>;
29-
hasFreePlan: boolean;
29+
isAllowed: boolean;
3030
handleUpgradeStateChange: ({
3131
state,
3232
trigger,
@@ -53,7 +53,7 @@ export default function QuestionSection({
5353
title="Feedback Question"
5454
enabled={enabled}
5555
action={handleQuestion}
56-
hasFreePlan={hasFreePlan}
56+
isAllowed={isAllowed}
5757
requiredPlan="business"
5858
upgradeAction={() =>
5959
handleUpgradeStateChange({

components/links/link-sheet/screenshot-protection-section.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import { LinkUpgradeOptions } from "./link-options";
77
export default function ScreenshotProtectionSection({
88
data,
99
setData,
10-
hasFreePlan,
10+
isAllowed,
1111
handleUpgradeStateChange,
1212
}: {
1313
data: DEFAULT_LINK_TYPE;
1414
setData: React.Dispatch<React.SetStateAction<DEFAULT_LINK_TYPE>>;
15-
hasFreePlan: boolean;
15+
isAllowed: boolean;
1616
handleUpgradeStateChange: ({
1717
state,
1818
trigger,
@@ -41,7 +41,7 @@ export default function ScreenshotProtectionSection({
4141
title="Enable screenshot protection"
4242
enabled={enabled}
4343
action={handleEnableScreenshotProtection}
44-
hasFreePlan={hasFreePlan}
44+
isAllowed={isAllowed}
4545
requiredPlan="business"
4646
upgradeAction={() =>
4747
handleUpgradeStateChange({

components/welcome/dataroom.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ export default function Dataroom() {
7878
Get a data room trial
7979
</Button>
8080
<span className="text-xs text-muted-foreground">
81-
Data rooms are available on our `Business` plan. <br />
81+
Data rooms are available on our `Business` and `Data Rooms` plan.{" "}
82+
<br />
8283
You receive a 7-day trial.
8384
</span>
8485
</motion.div>

0 commit comments

Comments
 (0)