Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
feat: templates added
Marc Seitz39318a3b87e2
diff --git a/components/billing/upgrade-plan-modal.tsx b/components/billing/upgrade-plan-modal.tsxindex df551df5..d73d7126 100644--- a/components/billing/upgrade-plan-modal.tsx+++ b/components/billing/upgrade-plan-modal.tsx@@ -39,7 +39,7 @@ const StartDataRoomTrialButton = ({ teamId }: { teamId?: string }) => {onClick={handleStartTrial}className="cursor-pointer underline underline-offset-4 hover:text-foreground">- Start free Data Room trial+ Start free data room trial</span>);};diff --git a/components/welcome/dataroom-choice.tsx b/components/welcome/dataroom-choice.tsxnew file mode 100644index 00000000..25c49df1--- /dev/null+++ b/components/welcome/dataroom-choice.tsx@@ -0,0 +1,82 @@+import { useRouter } from "next/router";++import { FolderIcon, SparklesIcon } from "lucide-react";+import { motion } from "motion/react";++import { STAGGER_CHILD_VARIANTS } from "@/lib/constants";++export default function DataroomChoice({ dataroomId }: { dataroomId: string }) {+ const router = useRouter();+ return (+ <motion.div+ className="z-10 mx-5 flex flex-col items-center space-y-10 text-center sm:mx-auto"+ variants={{+ hidden: { opacity: 0, scale: 0.95 },+ show: {+ opacity: 1,+ scale: 1,+ transition: {+ staggerChildren: 0.2,+ },+ },+ }}+ initial="hidden"+ animate="show"+ exit="hidden"+ transition={{ duration: 0.3, type: "spring" }}+ >+ <motion.div+ variants={STAGGER_CHILD_VARIANTS}+ className="flex flex-col items-center space-y-10 text-center"+ >+ <p className="text-2xl font-bold tracking-tighter text-foreground">+ Papermark+ </p>+ <h1 className="font-display max-w-md text-3xl font-semibold transition-colors sm:text-4xl">+ How would you like to set up your data room?+ </h1>+ </motion.div>+ <motion.div+ variants={STAGGER_CHILD_VARIANTS}+ className="grid w-full grid-cols-1 divide-y divide-border rounded-md border border-border text-foreground md:grid-cols-2 md:divide-x"+ >+ <button+ onClick={() =>+ router.push({+ pathname: "/welcome",+ query: {+ type: "dataroom-upload",+ dataroomId,+ },+ })+ }+ className="flex min-h-[200px] flex-col items-center justify-center space-y-5 overflow-hidden p-5 transition-colors hover:bg-gray-200 hover:dark:bg-gray-800 md:p-10"+ >+ <FolderIcon className="pointer-events-none h-auto w-12 sm:w-12" />+ <p className="text-lg font-medium">Create from Scratch</p>+ <p className="text-sm text-muted-foreground">+ Start with an empty data room and add documents+ </p>+ </button>+ <button+ onClick={() =>+ router.push({+ pathname: "/welcome",+ query: {+ type: "dataroom-templates",+ dataroomId,+ },+ })+ }+ className="flex min-h-[200px] flex-col items-center justify-center space-y-5 overflow-hidden p-5 transition-colors hover:bg-gray-200 hover:dark:bg-gray-800 md:p-10"+ >+ <SparklesIcon className="pointer-events-none h-auto w-12 sm:w-12" />+ <p className="text-lg font-medium">Use a Template</p>+ <p className="text-sm text-muted-foreground">+ Start with pre-configured folders for your use case+ </p>+ </button>+ </motion.div>+ </motion.div>+ );+}diff --git a/components/welcome/dataroom-templates.tsx b/components/welcome/dataroom-templates.tsxnew file mode 100644index 00000000..96ddb9bd--- /dev/null+++ b/components/welcome/dataroom-templates.tsx@@ -0,0 +1,182 @@+import { useRouter } from "next/router";++import { useState } from "react";++import { useTeam } from "@/context/team-context";+import {+ BriefcaseIcon,+ BuildingIcon,+ FileTextIcon,+ FolderKanbanIcon,+ HomeIcon,+ LineChartIcon,+ RocketIcon,+ ShoppingCartIcon,+ TrendingUpIcon,+} from "lucide-react";+import { motion } from "motion/react";+import { toast } from "sonner";++import { useAnalytics } from "@/lib/analytics";+import { STAGGER_CHILD_VARIANTS } from "@/lib/constants";++const TEMPLATES = [+ {+ id: "startup-fundraising",+ name: "Startup Fundraising",+ icon: RocketIcon,+ },+ {+ id: "series-a-plus",+ name: "Series A+ Fundraising",+ icon: TrendingUpIcon,+ },+ {+ id: "raising-first-fund",+ name: "Raising a Fund",+ icon: LineChartIcon,+ },+ {+ id: "ma-acquisition",+ name: "M&A / Acquisition",+ icon: BriefcaseIcon,+ },+ {+ id: "sales-dataroom",+ name: "Sales Data Room",+ icon: ShoppingCartIcon,+ },+ {+ id: "real-estate-transaction",+ name: "Real Estate",+ icon: HomeIcon,+ },+ {+ id: "fund-management",+ name: "Fund Management",+ icon: BuildingIcon,+ },+ {+ id: "portfolio-management",+ name: "Portfolio Management",+ icon: FolderKanbanIcon,+ },+ {+ id: "project-management",+ name: "Project Management",+ icon: FileTextIcon,+ },+];++export default function DataroomTemplates({+ dataroomId,+}: {+ dataroomId: string;+}) {+ const router = useRouter();+ const teamInfo = useTeam();+ const analytics = useAnalytics();+ const [selectedTemplate, setSelectedTemplate] = useState<string | null>(null);+ const [loading, setLoading] = useState(false);++ const handleTemplateSelect = async (templateType: string) => {+ setSelectedTemplate(templateType);+ setLoading(true);++ try {+ const response = await fetch(+ `/api/teams/${teamInfo?.currentTeam?.id}/datarooms/${dataroomId}/apply-template`,+ {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ },+ body: JSON.stringify({+ type: templateType,+ }),+ },+ );++ if (!response.ok) {+ const { message } = await response.json();+ toast.error(message);+ setLoading(false);+ setSelectedTemplate(null);+ return;+ }++ analytics.capture("Dataroom Template Applied", {+ dataroomId,+ templateType,+ });++ toast.success("Template applied successfully! 🎉");+ router.push(`/datarooms/${dataroomId}/documents`);+ } catch (error) {+ console.error("Error applying template:", error);+ toast.error("Error applying template. Please try again.");+ setLoading(false);+ setSelectedTemplate(null);+ }+ };++ return (+ <motion.div+ className="z-10 mx-5 flex flex-col items-center space-y-10 text-center sm:mx-auto"+ variants={{+ hidden: { opacity: 0, scale: 0.95 },+ show: {+ opacity: 1,+ scale: 1,+ transition: {+ staggerChildren: 0.2,+ },+ },+ }}+ initial="hidden"+ animate="show"+ exit="hidden"+ transition={{ duration: 0.3, type: "spring" }}+ >+ <motion.div+ variants={STAGGER_CHILD_VARIANTS}+ className="flex flex-col items-center space-y-10 text-center"+ >+ <p className="text-2xl font-bold tracking-tighter text-foreground">+ Papermark+ </p>+ <h1 className="font-display max-w-md text-3xl font-semibold transition-colors sm:text-4xl">+ Which template do you want to use?+ </h1>+ </motion.div>++ <motion.div+ variants={STAGGER_CHILD_VARIANTS}+ className="grid w-full grid-cols-3 divide-x divide-y divide-border overflow-hidden rounded-md border border-border text-foreground"+ >+ {TEMPLATES.map((template) => {+ const Icon = template.icon;+ const isSelected = selectedTemplate === template.id;+ const isLoading = loading && isSelected;++ return (+ <button+ key={template.id}+ onClick={() => handleTemplateSelect(template.id)}+ disabled={loading}+ className="relative flex min-h-[200px] flex-col items-center justify-center space-y-5 overflow-hidden p-5 transition-colors hover:bg-gray-200 hover:dark:bg-gray-800 md:p-10"+ >+ <Icon className="pointer-events-none h-auto w-12 sm:w-12" />+ <p>{template.name}</p>+ {isLoading && (+ <div className="absolute inset-0 flex items-center justify-center bg-white/50 dark:bg-gray-900/50">+ <div className="h-6 w-6 animate-spin rounded-full border-2 border-gray-300 border-t-[#fb7a00]" />+ </div>+ )}+ </button>+ );+ })}+ </motion.div>+ </motion.div>+ );+}diff --git a/components/welcome/dataroom-trial.tsx b/components/welcome/dataroom-trial.tsxindex 8d7451df..4d8fca28 100644--- a/components/welcome/dataroom-trial.tsx+++ b/components/welcome/dataroom-trial.tsx@@ -93,8 +93,8 @@ export default function DataroomTrial() {await mutate(`/api/teams/${teamInfo?.currentTeam?.id}/datarooms`);- // Instead of redirecting to "/datarooms", we'll navigate to the dataroom-upload page- router.push(`/welcome?type=dataroom-upload&dataroomId=${dataroomId}`);+ // Navigate to dataroom choice page (scratch vs templates)+ router.push(`/welcome?type=dataroom-choice&dataroomId=${dataroomId}`);} catch (error) {toast.error("Error adding dataroom. Please try again.");console.error("Error creating dataroom:", error);@@ -131,6 +131,9 @@ export default function DataroomTrial() {<h1 className="font-display max-w-lg text-3xl font-semibold transition-colors sm:text-4xl">Start a 7-day free trial!</h1>+ {/* <p className="mt-2 text-lg text-muted-foreground">+ Data Room Plan Trial+ </p> */}</motion.div><motion.divvariants={STAGGER_CHILD_VARIANTS}@@ -306,10 +309,12 @@ export default function DataroomTrial() {</UpgradePlanModal>{" "}plan. <br /> */}No credit card is required. After the trial, upgrade to{" "}- <UpgradePlanModal clickedPlan={PlanEnum.Business}>- <button className="underline">- Papermark Business or Data Rooms- </button>+ <UpgradePlanModal+ clickedPlan={PlanEnum.Business}+ highlightItem={["datarooms"]}+ trigger="dataroom_trial_form"+ >+ <button className="underline">Papermark Data Rooms</button></UpgradePlanModal>{" "}to continue using data rooms.</div>diff --git a/components/welcome/dataroom.tsx b/components/welcome/dataroom.tsxindex c1d2af98..f57971ec 100644--- a/components/welcome/dataroom.tsx+++ b/components/welcome/dataroom.tsx@@ -76,8 +76,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` and `Data Rooms` plans.{" "}- <br />+ Data rooms are available on our `Data Rooms` plans and on the+ `Business` plan. <br />You receive a 7-day trial.</span></motion.div>diff --git a/lib/constants/dataroom-templates.ts b/lib/constants/dataroom-templates.tsnew file mode 100644index 00000000..1fc19f80--- /dev/null+++ b/lib/constants/dataroom-templates.ts@@ -0,0 +1,596 @@+// Shared dataroom templates used for both generation and application++export interface FolderTemplate {+ name: string;+ subfolders?: FolderTemplate[];+}++export const DATAROOM_TEMPLATES: Record<+ string,+ { name: string; folders: FolderTemplate[] }+> = {+ "startup-fundraising": {+ name: "Startup Fundraising",+ folders: [+ { name: "Corporate or Investment Memo" },+ {+ name: "Corporate Documents",+ subfolders: [+ { name: "Company Registration" },+ { name: "Group Structure" },+ { name: "Shareholder Overview" },+ ],+ },+ {+ name: "Financial Forecast and Actuals",+ subfolders: [{ name: "Forecasts" }, { name: "Actuals" }],+ },+ {+ name: "Legal and Tax Documents",+ subfolders: [+ { name: "Contracts" },+ { name: "IP Agreements" },+ { name: "Capitalization Table" },+ ],+ },+ {+ name: "Go-to-Market and Marketing Strategy",+ subfolders: [+ { name: "Business Plan" },+ { name: "Organizational Chart" },+ ],+ },+ { name: "Product Roadmap" },+ { name: "Pitch Deck" },+ ],+ },+ "raising-first-fund": {+ name: "Raising First Fund",+ folders: [+ {+ name: "1 Introduction",+ subfolders: [{ name: "Presentations" }],+ },+ {+ name: "2 Team",+ subfolders: [{ name: "CVs & References" }],+ },+ {+ name: "3 Track Record",+ subfolders: [{ name: "Track record & portfolio references" }],+ },+ {+ name: "4 Fund Model",+ subfolders: [{ name: "XLSX grantular track record" }],+ },+ {+ name: "5 Legal",+ subfolders: [{ name: "Executed LPA, bylaws" }],+ },+ {+ name: "6 Portfolio",+ subfolders: [{ name: "Investment memos of portfolio companies" }],+ },+ ],+ },+ "ma-acquisition": {+ name: "M&A / Acquisition",+ folders: [+ {+ name: "1 Executive Summary",+ subfolders: [+ { name: "Transaction Overview" },+ { name: "Investment Highlights" },+ ],+ },+ {+ name: "2 Corporate Structure & Governance",+ subfolders: [+ { name: "Corporate Documents" },+ { name: "Board Materials" },+ { name: "Shareholder Agreements" },+ ],+ },+ {+ name: "3 Financial Information",+ subfolders: [+ { name: "Historical Financials" },+ { name: "Audited Statements" },+ { name: "Management Accounts" },+ { name: "Financial Projections" },+ ],+ },+ {+ name: "4 Legal & Compliance",+ subfolders: [+ { name: "Material Contracts" },+ { name: "Litigation & Disputes" },+ { name: "Regulatory Compliance" },+ { name: "Permits & Licenses" },+ ],+ },+ {+ name: "5 Intellectual Property",+ subfolders: [+ { name: "Patents & Trademarks" },+ { name: "Licenses & Assignments" },+ { name: "IP Agreements" },+ ],+ },+ {+ name: "6 Contracts & Agreements",+ subfolders: [+ { name: "Customer Contracts" },+ { name: "Supplier Agreements" },+ { name: "Partnership Agreements" },+ ],+ },+ {+ name: "7 Human Resources",+ subfolders: [+ { name: "Employee List" },+ { name: "Employment Agreements" },+ { name: "Benefits & Compensation" },+ { name: "Organization Chart" },+ ],+ },+ {+ name: "8 Tax Documents",+ subfolders: [{ name: "Tax Returns" }, { name: "Tax Assessments" }],+ },+ {+ name: "9 Assets & Liabilities",+ subfolders: [+ { name: "Real Estate" },+ { name: "Equipment & Inventory" },+ { name: "Debt & Obligations" },+ ],+ },+ {+ name: "10 Insurance",+ subfolders: [+ { name: "Insurance Policies" },+ { name: "Claims History" },+ ],+ },+ ],+ },+ "series-a-plus": {+ name: "Series A+ Fundraising",+ folders: [+ {+ name: "1 Investment Memorandum",+ subfolders: [{ name: "Executive Summary" }, { name: "Pitch Deck" }],+ },+ {+ name: "2 Financial Information",+ subfolders: [+ { name: "Historical Financials" },+ { name: "Financial Projections" },+ { name: "Unit Economics" },+ { name: "KPI Dashboard" },+ ],+ },+ {+ name: "3 Corporate Documents",+ subfolders: [+ { name: "Incorporation Documents" },+ { name: "Board Materials" },+ { name: "Shareholder Agreements" },+ ],+ },+ {+ name: "4 Cap Table & Term Sheets",+ subfolders: [+ { name: "Capitalization Table" },+ { name: "Previous Rounds" },+ { name: "Stock Option Pool" },+ ],+ },+ {+ name: "5 Product & Technology",+ subfolders: [+ { name: "Product Roadmap" },+ { name: "Technical Documentation" },+ { name: "Product Demos" },+ ],+ },+ {+ name: "6 Market & Traction",+ subfolders: [+ { name: "Market Analysis" },+ { name: "Customer Data" },+ { name: "Growth Metrics" },+ { name: "Case Studies" },+ ],+ },+ {+ name: "7 Team & Organization",+ subfolders: [+ { name: "Team Bios" },+ { name: "Organizational Chart" },+ { name: "Advisory Board" },+ { name: "Key Hires Plan" },+ ],+ },+ {+ name: "8 Legal & IP",+ subfolders: [+ { name: "IP Portfolio" },+ { name: "Material Contracts" },+ { name: "Compliance Documents" },+ ],+ },+ {+ name: "9 Competitive Analysis",+ subfolders: [+ { name: "Competitive Landscape" },+ { name: "Differentiation" },+ ],+ },+ {+ name: "10 Use of Funds",+ subfolders: [{ name: "Budget Allocation" }, { name: "Milestones" }],+ },+ ],+ },+ "real-estate-transaction": {+ name: "Real Estate Transaction",+ folders: [+ {+ name: "1 Property Information",+ subfolders: [+ { name: "Property Overview" },+ { name: "Location & Site Plans" },+ { name: "Building Specifications" },+ ],+ },+ {+ name: "2 Title & Ownership",+ subfolders: [+ { name: "Title Documents" },+ { name: "Ownership Structure" },+ { name: "Deed & Transfer Documents" },+ ],+ },+ {+ name: "3 Legal Documents",+ subfolders: [+ { name: "Purchase Agreements" },+ { name: "Easements & Restrictions" },+ { name: "Zoning & Permits" },+ ],+ },+ {+ name: "4 Financial Information",+ subfolders: [+ { name: "Operating Statements" },+ { name: "Rent Roll" },+ { name: "Expense Reports" },+ { name: "Tax Assessments" },+ ],+ },+ {+ name: "5 Leases & Tenancies",+ subfolders: [+ { name: "Tenant Leases" },+ { name: "Tenant Correspondence" },+ { name: "Lease Abstracts" },+ ],+ },+ {+ name: "6 Property Surveys & Plans",+ subfolders: [+ { name: "Survey Reports" },+ { name: "Floor Plans" },+ { name: "As-Built Drawings" },+ ],+ },+ {+ name: "7 Environmental Reports",+ subfolders: [+ { name: "Environmental Assessments" },+ { name: "Soil Reports" },+ { name: "Remediation Documents" },+ ],+ },+ {+ name: "8 Building Inspections",+ subfolders: [+ { name: "Structural Inspections" },+ { name: "Engineering Reports" },+ { name: "Maintenance Records" },+ ],+ },+ {+ name: "9 Property Management",+ subfolders: [+ { name: "Management Agreements" },+ { name: "Vendor Contracts" },+ { name: "Service Agreements" },+ ],+ },+ {+ name: "10 Insurance & Warranties",+ subfolders: [+ { name: "Insurance Policies" },+ { name: "Warranties" },+ { name: "Claims History" },+ ],+ },+ ],+ },+ "fund-management": {+ name: "Fund Management",+ folders: [+ {+ name: "1 Fund Documents",+ subfolders: [+ { name: "Fund Formation Documents" },+ { name: "LPA & Side Letters" },+ { name: "Fund Policies" },+ ],+ },+ {+ name: "2 LP Relations",+ subfolders: [+ { name: "LP Commitments" },+ { name: "Capital Calls" },+ { name: "Distribution Notices" },+ { name: "LP Communications" },+ ],+ },+ {+ name: "3 Financial Reporting",+ subfolders: [+ { name: "Quarterly Reports" },+ { name: "Annual Reports" },+ { name: "NAV Statements" },+ { name: "Cash Flow Reports" },+ ],+ },+ {+ name: "4 Compliance & Legal",+ subfolders: [+ { name: "Regulatory Filings" },+ { name: "Audit Reports" },+ { name: "Tax Documents" },+ { name: "Legal Opinions" },+ ],+ },+ {+ name: "5 Investment Activities",+ subfolders: [+ { name: "Investment Memos" },+ { name: "Deal Pipeline" },+ { name: "Investment Committee Materials" },+ ],+ },+ {+ name: "6 Portfolio Monitoring",+ subfolders: [+ { name: "Portfolio Company Updates" },+ { name: "Board Materials" },+ { name: "Valuations" },+ ],+ },+ {+ name: "7 Operations",+ subfolders: [+ { name: "Fund Administration" },+ { name: "Service Provider Agreements" },+ { name: "Policies & Procedures" },+ ],+ },+ {+ name: "8 Investor Communications",+ subfolders: [+ { name: "Investor Letters" },+ { name: "Meeting Materials" },+ { name: "AGM Documents" },+ ],+ },+ ],+ },+ "portfolio-management": {+ name: "Portfolio Management",+ folders: [+ {+ name: "1 Portfolio Overview",+ subfolders: [+ { name: "Portfolio Summary" },+ { name: "Portfolio Strategy" },+ { name: "Performance Dashboard" },+ ],+ },+ {+ name: "2 Portfolio Companies",+ subfolders: [+ { name: "Company Profiles" },+ { name: "Investment Theses" },+ { name: "Ownership Information" },+ ],+ },+ {+ name: "3 Financial Performance",+ subfolders: [+ { name: "Company Financials" },+ { name: "KPI Reports" },+ { name: "Valuations" },+ { name: "Return Analysis" },+ ],+ },+ {+ name: "4 Board & Governance",+ subfolders: [+ { name: "Board Decks" },+ { name: "Meeting Minutes" },+ { name: "Board Observer Rights" },+ ],+ },+ {+ name: "5 Operational Support",+ subfolders: [+ { name: "Value Creation Plans" },+ { name: "Strategic Initiatives" },+ { name: "Operational Reviews" },+ ],+ },+ {+ name: "6 Deal Documents",+ subfolders: [+ { name: "Investment Agreements" },+ { name: "Shareholder Agreements" },+ { name: "Cap Tables" },+ ],+ },+ {+ name: "7 Follow-on & Exits",+ subfolders: [+ { name: "Follow-on Analysis" },+ { name: "Exit Planning" },+ { name: "M&A Materials" },+ ],+ },+ {+ name: "8 Portfolio Monitoring",+ subfolders: [+ { name: "Monthly Updates" },+ { name: "Risk Assessments" },+ { name: "Action Items" },+ ],+ },+ ],+ },+ "project-management": {+ name: "Project Management",+ folders: [+ {+ name: "1 Project Overview",+ subfolders: [+ { name: "Project Charter" },+ { name: "Scope & Objectives" },+ { name: "Project Plan" },+ ],+ },+ {+ name: "2 Requirements & Specifications",+ subfolders: [+ { name: "Requirements Documentation" },+ { name: "Technical Specifications" },+ { name: "User Stories" },+ ],+ },+ {+ name: "3 Project Planning",+ subfolders: [+ { name: "Work Breakdown Structure" },+ { name: "Timeline & Milestones" },+ { name: "Resource Plan" },+ { name: "Budget" },+ ],+ },+ {+ name: "4 Team & Stakeholders",+ subfolders: [+ { name: "Team Directory" },+ { name: "Roles & Responsibilities" },+ { name: "Stakeholder Matrix" },+ ],+ },+ {+ name: "5 Project Execution",+ subfolders: [+ { name: "Sprint Plans" },+ { name: "Task Tracking" },+ { name: "Deliverables" },+ ],+ },+ {+ name: "6 Communication",+ subfolders: [+ { name: "Status Reports" },+ { name: "Meeting Notes" },+ { name: "Stakeholder Updates" },+ ],+ },+ {+ name: "7 Risk & Issues",+ subfolders: [+ { name: "Risk Register" },+ { name: "Issue Log" },+ { name: "Change Requests" },+ ],+ },+ {+ name: "8 Quality & Testing",+ subfolders: [+ { name: "Quality Standards" },+ { name: "Test Plans" },+ { name: "Acceptance Criteria" },+ ],+ },+ {+ name: "9 Documentation",+ subfolders: [+ { name: "Process Documentation" },+ { name: "User Guides" },+ { name: "Training Materials" },+ ],+ },+ {+ name: "10 Project Closure",+ subfolders: [+ { name: "Final Reports" },+ { name: "Lessons Learned" },+ { name: "Handover Documents" },+ ],+ },+ ],+ },+ "sales-dataroom": {+ name: "Sales Data Room",+ folders: [+ {+ name: "1 Sales Materials",+ subfolders: [+ { name: "Sales Decks" },+ { name: "Product Brochures" },+ { name: "One Pagers" },+ ],+ },+ {+ name: "2 Proposals & Quotes",+ subfolders: [{ name: "Proposals" }, { name: "Pricing" }],+ },+ {+ name: "3 Contracts & Agreements",+ subfolders: [+ { name: "Master Service Agreements" },+ { name: "NDAs" },+ { name: "Terms & Conditions" },+ ],+ },+ {+ name: "4 Product Information",+ subfolders: [+ { name: "Product Specs" },+ { name: "Demo Videos" },+ { name: "Case Studies" },+ ],+ },+ {+ name: "5 Customer References",+ subfolders: [{ name: "Testimonials" }, { name: "Reference Letters" }],+ },+ {+ name: "6 Security & Compliance",+ subfolders: [+ { name: "Security Documentation" },+ { name: "Compliance Certificates" },+ { name: "Insurance Certificates" },+ ],+ },+ ],+ },+};diff --git a/pages/api/teams/[teamId]/datarooms/[id]/apply-template.ts b/pages/api/teams/[teamId]/datarooms/[id]/apply-template.tsnew file mode 100644index 00000000..71d40ac5--- /dev/null+++ b/pages/api/teams/[teamId]/datarooms/[id]/apply-template.ts@@ -0,0 +1,104 @@+import type { NextApiRequest, NextApiResponse } from "next";++import { authOptions } from "@/pages/api/auth/[...nextauth]";+import slugify from "@sindresorhus/slugify";+import { getServerSession } from "next-auth/next";++import {+ DATAROOM_TEMPLATES,+ FolderTemplate,+} from "@/lib/constants/dataroom-templates";+import prisma from "@/lib/prisma";+import { CustomUser } from "@/lib/types";++export default async function handle(+ req: NextApiRequest,+ res: NextApiResponse,+) {+ if (req.method === "POST") {+ const session = await getServerSession(req, res, authOptions);+ if (!session) {+ res.status(401).end("Unauthorized");+ return;+ }++ const userId = (session.user as CustomUser).id;+ const { teamId, id: dataroomId } = req.query as {+ teamId: string;+ id: string;+ };+ const { type } = req.body as { type: string };++ // Validate the type+ if (!type || !DATAROOM_TEMPLATES[type]) {+ return res.status(400).json({+ message: "Invalid template type.",+ });+ }++ try {+ // Check if the user is part of the team and has access to the dataroom+ const dataroom = await prisma.dataroom.findUnique({+ where: {+ id: dataroomId,+ teamId: teamId,+ team: {+ users: {+ some: {+ userId: userId,+ },+ },+ },+ },+ });++ if (!dataroom) {+ return res.status(401).end("Unauthorized");+ }++ const template = DATAROOM_TEMPLATES[type];++ // Helper function to create folders recursively+ const createFolders = async (+ folders: FolderTemplate[],+ parentPath: string = "",+ parentId: string | null = null,+ ): Promise<void> => {+ for (const folder of folders) {+ const folderPath = parentPath + "/" + slugify(folder.name);++ // Create the folder+ const createdFolder = await prisma.dataroomFolder.create({+ data: {+ name: folder.name,+ path: folderPath,+ parentId: parentId,+ dataroomId: dataroom.id,+ },+ });++ // If the folder has subfolders, create them recursively+ if (folder.subfolders && folder.subfolders.length > 0) {+ await createFolders(+ folder.subfolders,+ folderPath,+ createdFolder.id,+ );+ }+ }+ };++ await createFolders(template.folders);++ res.status(200).json({+ message: "Template applied successfully",+ });+ } catch (error) {+ console.error("Error applying template:", error);+ return res.status(500).json({ error: "Error applying template" });+ }+ } else {+ res.setHeader("Allow", ["POST"]);+ return res.status(405).end(`Method ${req.method} Not Allowed`);+ }+}diff --git a/pages/api/teams/[teamId]/datarooms/generate.ts b/pages/api/teams/[teamId]/datarooms/generate.tsindex 75779674..e099ccea 100644--- a/pages/api/teams/[teamId]/datarooms/generate.ts+++ b/pages/api/teams/[teamId]/datarooms/generate.ts@@ -5,606 +5,14 @@ import { authOptions } from "@/pages/api/auth/[...nextauth]";import slugify from "@sindresorhus/slugify";import { getServerSession } from "next-auth/next";+import {+ DATAROOM_TEMPLATES,+ FolderTemplate,+} from "@/lib/constants/dataroom-templates";import { newId } from "@/lib/id-helper";import prisma from "@/lib/prisma";import { CustomUser } from "@/lib/types";-// Define folder templates for each dataroom type-interface FolderTemplate {- name: string;- subfolders?: FolderTemplate[];-}--const DATAROOM_TEMPLATES: Record<- string,- { name: string; folders: FolderTemplate[] }-> = {- "startup-fundraising": {- name: "Startup Fundraising",- folders: [- { name: "Corporate or Investment Memo" },- {- name: "Corporate Documents",- subfolders: [- { name: "Company Registration" },- { name: "Group Structure" },- { name: "Shareholder Overview" },- ],- },- {- name: "Financial Forecast and Actuals",- subfolders: [{ name: "Forecasts" }, { name: "Actuals" }],- },- {- name: "Legal and Tax Documents",- subfolders: [- { name: "Contracts" },- { name: "IP Agreements" },- { name: "Capitalization Table" },- ],- },- {- name: "Go-to-Market and Marketing Strategy",- subfolders: [- { name: "Business Plan" },- { name: "Organizational Chart" },- ],- },- { name: "Product Roadmap" },- { name: "Pitch Deck" },- ],- },- "raising-first-fund": {- name: "Raising First Fund",- folders: [- {- name: "1 Introduction",- subfolders: [{ name: "Presentations" }],- },- {- name: "2 Team",- subfolders: [{ name: "CVs & References" }],- },- {- name: "3 Track Record",- subfolders: [{ name: "Track record & portfolio references" }],- },- {- name: "4 Fund Model",- subfolders: [{ name: "XLSX grantular track record" }],- },- {- name: "5 Legal",- subfolders: [{ name: "Executed LPA, bylaws" }],- },- {- name: "6 Portfolio",- subfolders: [{ name: "Investment memos of portfolio companies" }],- },- ],- },- "ma-acquisition": {- name: "M&A / Acquisition",- folders: [- {- name: "1 Executive Summary",- subfolders: [- { name: "Transaction Overview" },- { name: "Investment Highlights" },- ],- },- {- name: "2 Corporate Structure & Governance",- subfolders: [- { name: "Corporate Documents" },- { name: "Board Materials" },- { name: "Shareholder Agreements" },- ],- },- {- name: "3 Financial Information",- subfolders: [- { name: "Historical Financials" },- { name: "Audited Statements" },- { name: "Management Accounts" },- { name: "Financial Projections" },- ],- },- {- name: "4 Legal & Compliance",- subfolders: [- { name: "Material Contracts" },- { name: "Litigation & Disputes" },- { name: "Regulatory Compliance" },- { name: "Permits & Licenses" },- ],- },- {- name: "5 Intellectual Property",- subfolders: [- { name: "Patents & Trademarks" },- { name: "Licenses & Assignments" },- { name: "IP Agreements" },- ],- },- {- name: "6 Contracts & Agreements",- subfolders: [- { name: "Customer Contracts" },- { name: "Supplier Agreements" },- { name: "Partnership Agreements" },- ],- },- {- name: "7 Human Resources",- subfolders: [- { name: "Employee List" },- { name: "Employment Agreements" },- { name: "Benefits & Compensation" },- { name: "Organization Chart" },- ],- },- {- name: "8 Tax Documents",- subfolders: [{ name: "Tax Returns" }, { name: "Tax Assessments" }],- },- {- name: "9 Assets & Liabilities",- subfolders: [- { name: "Real Estate" },- { name: "Equipment & Inventory" },- { name: "Debt & Obligations" },- ],- },- {- name: "10 Insurance",- subfolders: [- { name: "Insurance Policies" },- { name: "Claims History" },- ],- },- ],- },- "series-a-plus": {- name: "Series A+ Fundraising",- folders: [- {- name: "1 Investment Memorandum",- subfolders: [{ name: "Executive Summary" }, { name: "Pitch Deck" }],- },- {- name: "2 Financial Information",- subfolders: [- { name: "Historical Financials" },- { name: "Financial Projections" },- { name: "Unit Economics" },- { name: "KPI Dashboard" },- ],- },- {- name: "3 Corporate Documents",- subfolders: [- { name: "Incorporation Documents" },- { name: "Board Materials" },- { name: "Shareholder Agreements" },- ],- },- {- name: "4 Cap Table & Term Sheets",- subfolders: [- { name: "Capitalization Table" },- { name: "Previous Rounds" },- { name: "Stock Option Pool" },- ],- },- {- name: "5 Product & Technology",- subfolders: [- { name: "Product Roadmap" },- { name: "Technical Documentation" },- { name: "Product Demos" },- ],- },- {- name: "6 Market & Traction",- subfolders: [- { name: "Market Analysis" },- { name: "Customer Data" },- { name: "Growth Metrics" },- { name: "Case Studies" },- ],- },- {- name: "7 Team & Organization",- subfolders: [- { name: "Team Bios" },- { name: "Organizational Chart" },- { name: "Advisory Board" },- { name: "Key Hires Plan" },- ],- },- {- name: "8 Legal & IP",- subfolders: [- { name: "IP Portfolio" },- { name: "Material Contracts" },- { name: "Compliance Documents" },- ],- },- {- name: "9 Competitive Analysis",- subfolders: [- { name: "Competitive Landscape" },- { name: "Differentiation" },- ],- },- {- name: "10 Use of Funds",- subfolders: [{ name: "Budget Allocation" }, { name: "Milestones" }],- },- ],- },- "real-estate-transaction": {- name: "Real Estate Transaction",- folders: [- {- name: "1 Property Information",- subfolders: [- { name: "Property Overview" },- { name: "Location & Site Plans" },- { name: "Building Specifications" },- ],- },- {- name: "2 Title & Ownership",- subfolders: [- { name: "Title Documents" },- { name: "Ownership Structure" },- { name: "Deed & Transfer Documents" },- ],- },- {- name: "3 Legal Documents",- subfolders: [- { name: "Purchase Agreements" },- { name: "Easements & Restrictions" },- { name: "Zoning & Permits" },- ],- },- {- name: "4 Financial Information",- subfolders: [- { name: "Operating Statements" },- { name: "Rent Roll" },- { name: "Expense Reports" },- { name: "Tax Assessments" },- ],- },- {- name: "5 Leases & Tenancies",- subfolders: [- { name: "Tenant Leases" },- { name: "Tenant Correspondence" },- { name: "Lease Abstracts" },- ],- },- {- name: "6 Property Surveys & Plans",- subfolders: [- { name: "Survey Reports" },- { name: "Floor Plans" },- { name: "As-Built Drawings" },- ],- },- {- name: "7 Environmental Reports",- subfolders: [- { name: "Environmental Assessments" },- { name: "Soil Reports" },- { name: "Remediation Documents" },- ],- },- {- name: "8 Building Inspections",- subfolders: [- { name: "Structural Inspections" },- { name: "Engineering Reports" },- { name: "Maintenance Records" },- ],- },- {- name: "9 Property Management",- subfolders: [- { name: "Management Agreements" },- { name: "Vendor Contracts" },- { name: "Service Agreements" },- ],- },- {- name: "10 Insurance & Warranties",- subfolders: [- { name: "Insurance Policies" },- { name: "Warranties" },- { name: "Claims History" },- ],- },- ],- },- "fund-management": {- name: "Fund Management",- folders: [- {- name: "1 Fund Documents",- subfolders: [- { name: "Fund Formation Documents" },- { name: "LPA & Side Letters" },- { name: "Fund Policies" },- ],- },- {- name: "2 LP Relations",- subfolders: [- { name: "LP Commitments" },- { name: "Capital Calls" },- { name: "Distribution Notices" },- { name: "LP Communications" },- ],- },- {- name: "3 Financial Reporting",- subfolders: [- { name: "Quarterly Reports" },- { name: "Annual Reports" },- { name: "NAV Statements" },- { name: "Cash Flow Reports" },- ],- },- {- name: "4 Compliance & Legal",- subfolders: [- { name: "Regulatory Filings" },- { name: "Audit Reports" },- { name: "Tax Documents" },- { name: "Legal Opinions" },- ],- },- {- name: "5 Investment Activities",- subfolders: [- { name: "Investment Memos" },- { name: "Deal Pipeline" },- { name: "Investment Committee Materials" },- ],- },- {- name: "6 Portfolio Monitoring",- subfolders: [- { name: "Portfolio Company Updates" },- { name: "Board Materials" },- { name: "Valuations" },- ],- },- {- name: "7 Operations",- subfolders: [- { name: "Fund Administration" },- { name: "Service Provider Agreements" },- { name: "Policies & Procedures" },- ],- },- {- name: "8 Investor Communications",- subfolders: [- { name: "Investor Letters" },- { name: "Meeting Materials" },- { name: "AGM Documents" },- ],- },- ],- },- "portfolio-management": {- name: "Portfolio Management",- folders: [- {- name: "1 Portfolio Overview",- subfolders: [- { name: "Portfolio Summary" },- { name: "Portfolio Strategy" },- { name: "Performance Dashboard" },- ],- },- {- name: "2 Portfolio Companies",- subfolders: [- { name: "Company Profiles" },- { name: "Investment Theses" },- { name: "Ownership Information" },- ],- },- {- name: "3 Financial Performance",- subfolders: [- { name: "Company Financials" },- { name: "KPI Reports" },- { name: "Valuations" },- { name: "Return Analysis" },- ],- },- {- name: "4 Board & Governance",- subfolders: [- { name: "Board Decks" },- { name: "Meeting Minutes" },- { name: "Board Observer Rights" },- ],- },- {- name: "5 Operational Support",- subfolders: [- { name: "Value Creation Plans" },- { name: "Strategic Initiatives" },- { name: "Operational Reviews" },- ],- },- {- name: "6 Deal Documents",- subfolders: [- { name: "Investment Agreements" },- { name: "Shareholder Agreements" },- { name: "Cap Tables" },- ],- },- {- name: "7 Follow-on & Exits",- subfolders: [- { name: "Follow-on Analysis" },- { name: "Exit Planning" },- { name: "M&A Materials" },- ],- },- {- name: "8 Portfolio Monitoring",- subfolders: [- { name: "Monthly Updates" },- { name: "Risk Assessments" },- { name: "Action Items" },- ],- },- ],- },- "project-management": {- name: "Project Management",- folders: [- {- name: "1 Project Overview",- subfolders: [- { name: "Project Charter" },- { name: "Scope & Objectives" },- { name: "Project Plan" },- ],- },- {- name: "2 Requirements & Specifications",- subfolders: [- { name: "Requirements Documentation" },- { name: "Technical Specifications" },- { name: "User Stories" },- ],- },- {- name: "3 Project Planning",- subfolders: [- { name: "Work Breakdown Structure" },- { name: "Timeline & Milestones" },- { name: "Resource Plan" },- { name: "Budget" },- ],- },- {- name: "4 Team & Stakeholders",- subfolders: [- { name: "Team Directory" },- { name: "Roles & Responsibilities" },- { name: "Stakeholder Matrix" },- ],- },- {- name: "5 Project Execution",- subfolders: [- { name: "Sprint Plans" },- { name: "Task Tracking" },- { name: "Deliverables" },- ],- },- {- name: "6 Communication",- subfolders: [- { name: "Status Reports" },- { name: "Meeting Notes" },- { name: "Stakeholder Updates" },- ],- },- {- name: "7 Risk & Issues",- subfolders: [- { name: "Risk Register" },- { name: "Issue Log" },- { name: "Change Requests" },- ],- },- {- name: "8 Quality & Testing",- subfolders: [- { name: "Quality Standards" },- { name: "Test Plans" },- { name: "Acceptance Criteria" },- ],- },- {- name: "9 Documentation",- subfolders: [- { name: "Process Documentation" },- { name: "User Guides" },- { name: "Training Materials" },- ],- },- {- name: "10 Project Closure",- subfolders: [- { name: "Final Reports" },- { name: "Lessons Learned" },- { name: "Handover Documents" },- ],- },- ],- },- "sales-dataroom": {- name: "Sales Data Room",- folders: [- {- name: "1 Sales Materials",- subfolders: [- { name: "Sales Decks" },- { name: "Product Brochures" },- { name: "One Pagers" },- ],- },- {- name: "2 Proposals & Quotes",- subfolders: [{ name: "Proposals" }, { name: "Pricing" }],- },- {- name: "3 Contracts & Agreements",- subfolders: [- { name: "Master Service Agreements" },- { name: "NDAs" },- { name: "Terms & Conditions" },- ],- },- {- name: "4 Product Information",- subfolders: [- { name: "Product Specs" },- { name: "Demo Videos" },- { name: "Case Studies" },- ],- },- {- name: "5 Customer References",- subfolders: [{ name: "Testimonials" }, { name: "Reference Letters" }],- },- {- name: "6 Security & Compliance",- subfolders: [- { name: "Security Documentation" },- { name: "Compliance Certificates" },- { name: "Insurance Certificates" },- ],- },- ],- },-};-export default async function handle(req: NextApiRequest,res: NextApiResponse,diff --git a/pages/welcome.tsx b/pages/welcome.tsxindex dcba7bf6..814373b1 100644--- a/pages/welcome.tsx+++ b/pages/welcome.tsx@@ -14,6 +14,8 @@ import { cn } from "@/lib/utils";import { GTMComponent } from "@/components/gtm-component";import { Button } from "@/components/ui/button";import Dataroom from "@/components/welcome/dataroom";+import DataroomChoice from "@/components/welcome/dataroom-choice";+import DataroomTemplates from "@/components/welcome/dataroom-templates";import DataroomTrial from "@/components/welcome/dataroom-trial";import DataroomUpload from "@/components/welcome/dataroom-upload";import Intro from "@/components/welcome/intro";@@ -52,12 +54,16 @@ export default function Welcome() {}, [session]);const isDataroomUpload = router.query.type === "dataroom-upload";+ const isDataroomChoice = router.query.type === "dataroom-choice";+ const isDataroomTemplates = router.query.type === "dataroom-templates";- const skipButtonText = isDataroomUpload- ? "Skip to dataroom"- : "Skip to dashboard";+ const skipButtonText =+ isDataroomUpload || isDataroomChoice || isDataroomTemplates+ ? "Skip to dataroom"+ : "Skip to dashboard";const skipButtonPath =- isDataroomUpload && router.query.dataroomId+ (isDataroomUpload || isDataroomChoice || isDataroomTemplates) &&+ router.query.dataroomId? `/datarooms/${router.query.dataroomId}`: "/documents";@@ -101,6 +107,20 @@ export default function Welcome() {{router.query.type === "dataroom-trial" && (<DataroomTrial key="dataroom-trial" />)}+ {router.query.type === "dataroom-choice" &&+ router.query.dataroomId && (+ <DataroomChoice+ key="dataroom-choice"+ dataroomId={router.query.dataroomId as string}+ />+ )}+ {router.query.type === "dataroom-templates" &&+ router.query.dataroomId && (+ <DataroomTemplates+ key="dataroom-templates"+ dataroomId={router.query.dataroomId as string}+ />+ )}{router.query.type === "dataroom-upload" &&router.query.dataroomId && (<DataroomUpload