Skip to content

Trial dataroom recreation#2106

Open
mfts wants to merge 1 commit intomainfrom
cursor/trial-dataroom-recreation-22e6
Open

Trial dataroom recreation#2106
mfts wants to merge 1 commit intomainfrom
cursor/trial-dataroom-recreation-22e6

Conversation

@mfts
Copy link
Owner

@mfts mfts commented Mar 7, 2026

Allow trial users to delete their single dataroom and create a new one, maintaining the limit of one dataroom.


Open in Web Open in Cursor 

Summary by CodeRabbit

Release Notes

  • New Features
    • Trial plan users can now create and manage datarooms
    • Improved onboarding experience: displays Create Dataroom option instead of upgrade prompts when no datarooms exist yet

- Set datarooms limit to 1 for trial plans in limits server (was 0 for free+drtrial)
- Show Delete Dataroom button in settings for trial users
- Show Create New Dataroom button for trial users with 0 datarooms
- Add free+drtrial to allowed plans in dataroom creation endpoints
- Skip upgrade modal in AddDataroomModal for trial users

Co-authored-by: Marc Seitz <mfts@users.noreply.github.com>
@cursor
Copy link

cursor bot commented Mar 7, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@vercel
Copy link

vercel bot commented Mar 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
papermark Ready Ready Preview, Comment Mar 7, 2026 2:07am

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 7, 2026

Walkthrough

The PR extends dataroom trial support by introducing isTrial to the usePlan() hook and updating plan eligibility checks across dataroom components and APIs. It includes trial plan variants in server-side plan filters and adjusts UI conditional logic to account for trial status.

Changes

Cohort / File(s) Summary
usePlan Hook Expansion
components/datarooms/add-dataroom-modal.tsx, pages/datarooms/[id]/settings/index.tsx
Added isTrial to usePlan() destructuring. Updated plan-check conditionals to prevent UpgradePlanModal display when users are on trial, and to enable DeleteDataroom visibility for trial users.
Plan Eligibility for APIs
ee/features/templates/api/datarooms/generate.ts, pages/api/teams/[teamId]/datarooms/index.ts
Extended allowed plan lists with dataroom trial variants: free+drtrial, datarooms+drtrial, business+drtrial, datarooms-plus+drtrial, and datarooms-premium+drtrial to broaden authorization for trial users.
Limits and Defaults
ee/limits/server.ts
Added dataroom limits handling to trial-specific responses and fallback defaults, ensuring minimum value of 1 for datarooms across both paths.
Dataroom List UI
pages/datarooms/index.tsx
Replaced static UpgradePlanModal with conditional rendering: shows AddDataroomModal when no datarooms exist, otherwise displays UpgradePlanModal.

Possibly Related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Trial dataroom recreation' clearly and concisely describes the main objective: enabling trial users to delete and recreate their single dataroom.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
pages/api/teams/[teamId]/datarooms/index.ts (1)

231-246: ⚠️ Potential issue | 🟠 Major

pro+drtrial is missing from the POST allowlist.

The modal is now intentionally reachable for isPro && isTrial, but this exact-match plan filter still rejects that state. Result: “Create from scratch” fails for Pro trial teams, and behavior diverges from pages/api/teams/[teamId]/datarooms/generate-ai.ts, which already accepts any *+drtrial plan.

Minimal fix
              "datarooms-plus+old",
              "datarooms-premium+old",
              "free+drtrial",
+             "pro+drtrial",
              "datarooms+drtrial",
              "business+drtrial",
              "datarooms-plus+drtrial",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pages/api/teams/`[teamId]/datarooms/index.ts around lines 231 - 246, The POST
request's plan allowlist (the "plan: { in: [...] }" validation) is missing
"pro+drtrial", causing Pro trial teams to be rejected; update that validation in
pages/api/teams/[teamId]/datarooms/index.ts by adding "pro+drtrial" to the array
(or broaden the check to accept any "*+drtrial" like the generate-ai handler) so
the isPro && isTrial combination is allowed and matches
pages/api/teams/[teamId]/datarooms/generate-ai.ts behavior.
ee/features/templates/api/datarooms/generate.ts (1)

51-66: ⚠️ Potential issue | 🟠 Major

pro+drtrial is still blocked here.

components/datarooms/add-dataroom-modal.tsx now skips the upgrade wall for isPro && isTrial, but this exact allowlist still excludes pro+drtrial. That means the “Create from template” path can still 401 for Pro trial teams, while pages/api/teams/[teamId]/datarooms/generate-ai.ts already accepts any *+drtrial plan.

Minimal fix
             "datarooms-plus+old",
             "datarooms-premium+old",
             "free+drtrial",
+            "pro+drtrial",
             "datarooms+drtrial",
             "business+drtrial",
             "datarooms-plus+drtrial",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ee/features/templates/api/datarooms/generate.ts` around lines 51 - 66, The
allowlist in the plan array inside
ee/features/templates/api/datarooms/generate.ts is missing "pro+drtrial",
causing Pro trial teams to be blocked; update that plan allowlist (the plan
array in this file) to include "pro+drtrial" (or expand the matching logic to
accept any "*+drtrial" like pages/api/teams/[teamId]/datarooms/generate-ai.ts
does) so the frontend path used by components/datarooms/add-dataroom-modal.tsx
(which bypasses the upgrade wall for isPro && isTrial) will not 401.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@pages/datarooms/index.tsx`:
- Around line 138-160: The CTA currently checks the filtered list length
(datarooms.length) which can be zero due to search/tags; change the gating logic
to use the unfiltered counts (totalDatarooms and limitDatarooms) so the
AddDataroomModal is shown only when the team is under its dataroom limit and
UpgradePlanModal is shown when at/exceeding the limit; update the conditional
around AddDataroomModal / UpgradePlanModal (where datarooms.length is used) to
compare totalDatarooms < limitDatarooms (or the appropriate limit check) and
keep the existing props like clickedPlan={PlanEnum.DataRooms} and
trigger="datarooms" intact.

---

Outside diff comments:
In `@ee/features/templates/api/datarooms/generate.ts`:
- Around line 51-66: The allowlist in the plan array inside
ee/features/templates/api/datarooms/generate.ts is missing "pro+drtrial",
causing Pro trial teams to be blocked; update that plan allowlist (the plan
array in this file) to include "pro+drtrial" (or expand the matching logic to
accept any "*+drtrial" like pages/api/teams/[teamId]/datarooms/generate-ai.ts
does) so the frontend path used by components/datarooms/add-dataroom-modal.tsx
(which bypasses the upgrade wall for isPro && isTrial) will not 401.

In `@pages/api/teams/`[teamId]/datarooms/index.ts:
- Around line 231-246: The POST request's plan allowlist (the "plan: { in: [...]
}" validation) is missing "pro+drtrial", causing Pro trial teams to be rejected;
update that validation in pages/api/teams/[teamId]/datarooms/index.ts by adding
"pro+drtrial" to the array (or broaden the check to accept any "*+drtrial" like
the generate-ai handler) so the isPro && isTrial combination is allowed and
matches pages/api/teams/[teamId]/datarooms/generate-ai.ts behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cf818767-d984-4ead-8ee4-26ebb136ee27

📥 Commits

Reviewing files that changed from the base of the PR and between 3cf4458 and 180284e.

📒 Files selected for processing (6)
  • components/datarooms/add-dataroom-modal.tsx
  • ee/features/templates/api/datarooms/generate.ts
  • ee/limits/server.ts
  • pages/api/teams/[teamId]/datarooms/index.ts
  • pages/datarooms/[id]/settings/index.tsx
  • pages/datarooms/index.tsx

Comment on lines +138 to +160
{datarooms.length === 0 ? (
<AddDataroomModal>
<Button
className="group flex flex-1 items-center justify-start gap-x-3 px-3 text-left"
title="Create New Dataroom"
>
<PlusIcon className="h-5 w-5 shrink-0" aria-hidden="true" />
<span>Create New Dataroom</span>
</Button>
</AddDataroomModal>
) : (
<UpgradePlanModal
clickedPlan={PlanEnum.DataRooms}
trigger="datarooms"
>
<span>Upgrade to Add Data Room</span>
</Button>
</UpgradePlanModal>
<Button
className="group flex flex-1 items-center justify-start gap-x-3 px-3 text-left"
title="Upgrade to Add Data Room"
>
<span>Upgrade to Add Data Room</span>
</Button>
</UpgradePlanModal>
)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Use the unfiltered count for this trial CTA.

datarooms.length is the filtered list on the page, so a search/tag combination that matches nothing will show “Create New Dataroom” even when the team already owns its single trial dataroom. Gate this on totalDatarooms/limitDatarooms instead, otherwise the CTA leads straight to the 403 limit error.

Suggested fix
-                {datarooms.length === 0 ? (
+                {totalDatarooms < limitDatarooms ? (
                   <AddDataroomModal>
                     <Button
                       className="group flex flex-1 items-center justify-start gap-x-3 px-3 text-left"
                       title="Create New Dataroom"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{datarooms.length === 0 ? (
<AddDataroomModal>
<Button
className="group flex flex-1 items-center justify-start gap-x-3 px-3 text-left"
title="Create New Dataroom"
>
<PlusIcon className="h-5 w-5 shrink-0" aria-hidden="true" />
<span>Create New Dataroom</span>
</Button>
</AddDataroomModal>
) : (
<UpgradePlanModal
clickedPlan={PlanEnum.DataRooms}
trigger="datarooms"
>
<span>Upgrade to Add Data Room</span>
</Button>
</UpgradePlanModal>
<Button
className="group flex flex-1 items-center justify-start gap-x-3 px-3 text-left"
title="Upgrade to Add Data Room"
>
<span>Upgrade to Add Data Room</span>
</Button>
</UpgradePlanModal>
)}
{totalDatarooms < limitDatarooms ? (
<AddDataroomModal>
<Button
className="group flex flex-1 items-center justify-start gap-x-3 px-3 text-left"
title="Create New Dataroom"
>
<PlusIcon className="h-5 w-5 shrink-0" aria-hidden="true" />
<span>Create New Dataroom</span>
</Button>
</AddDataroomModal>
) : (
<UpgradePlanModal
clickedPlan={PlanEnum.DataRooms}
trigger="datarooms"
>
<Button
className="group flex flex-1 items-center justify-start gap-x-3 px-3 text-left"
title="Upgrade to Add Data Room"
>
<span>Upgrade to Add Data Room</span>
</Button>
</UpgradePlanModal>
)}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pages/datarooms/index.tsx` around lines 138 - 160, The CTA currently checks
the filtered list length (datarooms.length) which can be zero due to
search/tags; change the gating logic to use the unfiltered counts
(totalDatarooms and limitDatarooms) so the AddDataroomModal is shown only when
the team is under its dataroom limit and UpgradePlanModal is shown when
at/exceeding the limit; update the conditional around AddDataroomModal /
UpgradePlanModal (where datarooms.length is used) to compare totalDatarooms <
limitDatarooms (or the appropriate limit check) and keep the existing props like
clickedPlan={PlanEnum.DataRooms} and trigger="datarooms" intact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants