Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
feat:updates
Iuliia Shnai92c9264a1944
diff --git a/components/datarooms/add-dataroom-modal.tsx b/components/datarooms/add-dataroom-modal.tsxindex e5bcd998..6d140b1f 100644--- a/components/datarooms/add-dataroom-modal.tsx+++ b/components/datarooms/add-dataroom-modal.tsx@@ -148,7 +148,7 @@ export function AddDataroomModal({},{id: "fund-management",- name: "Fund Management",+ name: "Fundraising & Reporting",icon: BuildingIcon,},{diff --git a/components/settings/survey-settings.tsx b/components/settings/survey-settings.tsxindex 7a8d9700..6e5193b6 100644--- a/components/settings/survey-settings.tsx+++ b/components/settings/survey-settings.tsx@@ -3,7 +3,7 @@import { useEffect, useState } from "react";import { useTeam } from "@/context/team-context";-import { ArrowLeftIcon, CheckCircle2Icon, PencilIcon } from "lucide-react";+import { CheckCircleIcon, PencilIcon, XIcon } from "lucide-react";import { toast } from "sonner";import { Button } from "@/components/ui/button";@@ -14,16 +14,10 @@ import {CardHeader,CardTitle,} from "@/components/ui/card";-import {- Dialog,- DialogContent,- DialogHeader,- DialogTitle,-} from "@/components/ui/dialog";const DEAL_TYPE_OPTIONS = [{ value: "startup-fundraising", label: "Startup Fundraising" },- { value: "fund-management", label: "Fund Management" },+ { value: "fund-management", label: "Fundraising & Reporting" },{ value: "mergers-acquisitions", label: "Mergers & Acquisitions" },{ value: "financial-operations", label: "Financial Operations" },{ value: "real-estate", label: "Real Estate" },@@ -46,12 +40,10 @@ export function SurveySettings() {const [dealTypeOther, setDealTypeOther] = useState<string | null>(null);const [dealSize, setDealSize] = useState<string | null>(null);const [isLoading, setIsLoading] = useState(true);- const [isEditing, setIsEditing] = useState(false);- const [editStep, setEditStep] = useState(1);+ const [step, setStep] = useState<1 | 2 | 3>(1);const [editDealType, setEditDealType] = useState<string | null>(null);const [editDealTypeOther, setEditDealTypeOther] = useState<string>("");const [showOtherInput, setShowOtherInput] = useState(false);- const [editDealSize, setEditDealSize] = useState<string | null>(null);const [isSaving, setIsSaving] = useState(false);useEffect(() => {@@ -65,6 +57,17 @@ export function SurveySettings() {setDealType(data.dealType);setDealTypeOther(data.dealTypeOther);setDealSize(data.dealSize);++ // Set initial step based on existing data+ if (data.dealType && data.dealSize) {+ setStep(3); // Show completed state+ } else if (data.dealType) {+ setEditDealType(data.dealType);+ setEditDealTypeOther(data.dealTypeOther || "");+ setStep(2); // Show deal size question+ } else {+ setStep(1); // Show deal type question+ }}} catch (error) {console.error("Failed to fetch survey data:", error);@@ -92,20 +95,19 @@ export function SurveySettings() {const handleEdit = () => {setEditDealType(dealType);setEditDealTypeOther(dealTypeOther || "");- setEditDealSize(dealSize);- setEditStep(1);setShowOtherInput(false);- setIsEditing(true);+ setStep(1);};- const handleDealTypeSelect = (value: string) => {+ const handleDealTypeSelect = async (value: string) => {setEditDealType(value);setShowOtherInput(false);+if (value === "project-management") {- setEditDealSize(null);- handleSave(value, null, null);+ // Project management doesn't need deal size - save directly+ await handleSave(value, null, null);} else {- setEditStep(2);+ setStep(2);}};@@ -113,11 +115,15 @@ export function SurveySettings() {if (!editDealTypeOther.trim()) return;setEditDealType("other");setShowOtherInput(false);- setEditStep(2);+ setStep(2);+ };++ const handleDealSizeSelect = async (value: string) => {+ await handleSave(editDealType, value, editDealTypeOther || null);};const handleSave = async (- type?: string,+ type?: string | null,size?: string | null,otherText?: string | null,) => {@@ -133,9 +139,8 @@ export function SurveySettings() {},body: JSON.stringify({dealType: finalDealType,- dealTypeOther:- otherText !== undefined ? otherText : editDealTypeOther || null,- dealSize: size !== undefined ? size : editDealSize,+ dealTypeOther: otherText,+ dealSize: size,}),});@@ -144,12 +149,10 @@ export function SurveySettings() {}setDealType(finalDealType);- setDealTypeOther(- otherText !== undefined ? otherText : editDealTypeOther || null,- );- setDealSize(size !== undefined ? size : editDealSize);- setIsEditing(false);- toast.success("Survey answers updated!");+ setDealTypeOther(otherText || null);+ setDealSize(size || null);+ setStep(3);+ toast.success("Survey answers saved!");} catch (error) {console.error("Failed to save survey:", error);toast.error("Failed to save changes");@@ -158,274 +161,140 @@ export function SurveySettings() {}};- const hasAnswered = !!dealType;+ const getDealSizeQuestion = () => {+ switch (editDealType) {+ case "startup-fundraising":+ case "fund-management":+ return "How much are you raising?";+ case "mergers-acquisitions":+ case "real-estate":+ case "financial-operations":+ return "What's the deal size?";+ default:+ return "What's the typical deal size?";+ }+ };return (- <>- <Card>- <CardHeader>- <div className="flex items-center justify-between">- <div>- <CardTitle>Team Survey</CardTitle>- <CardDescription>- Information about your deal flow to help us improve Papermark- </CardDescription>- </div>- {hasAnswered && (- <Button variant="outline" size="sm" onClick={handleEdit}>- <PencilIcon className="mr-2 h-4 w-4" />- Edit- </Button>- )}+ <Card>+ <CardHeader>+ <div className="flex items-center justify-between">+ <div>+ <CardTitle>Team Survey</CardTitle>+ <CardDescription>+ This will help us tailor your Papermark experience+ </CardDescription></div>- </CardHeader>- <CardContent>- {isLoading ? (- <p className="text-sm text-muted-foreground">Loading...</p>- ) : hasAnswered ? (- <div className="space-y-4">- <div className="flex items-start gap-3">- <CheckCircle2Icon className="mt-0.5 h-5 w-5 text-green-500" />- <div>- <p className="text-sm font-medium">Deal Type</p>- <p className="text-sm text-muted-foreground">- {getDealTypeLabel(dealType, dealTypeOther)}- </p>- </div>- </div>- {dealSize && (- <div className="flex items-start gap-3">- <CheckCircle2Icon className="mt-0.5 h-5 w-5 text-green-500" />- <div>- <p className="text-sm font-medium">Deal Size</p>- <p className="text-sm text-muted-foreground">- {getDealSizeLabel(dealSize)}- </p>- </div>- </div>- )}- </div>- ) : editStep === 1 ? (- <div className="space-y-4">- <p className="text-sm font-medium">- What do you use Papermark for?- </p>- <div className="grid gap-2">- {DEAL_TYPE_OPTIONS.map((option) => (- <button- key={option.value}- onClick={() => handleDealTypeSelect(option.value)}- disabled={isSaving}- className="flex items-center justify-between rounded-lg border border-border px-4 py-3 text-left transition-all hover:border-primary/50 hover:bg-muted/50"- >- <span className="font-medium">{option.label}</span>- </button>- ))}- {/* Other - inline input */}- {showOtherInput ? (- <div className="flex gap-2">- <input- type="text"- value={editDealTypeOther}- onChange={(e) => setEditDealTypeOther(e.target.value)}- placeholder="Please specify..."- className="flex-1 rounded-lg border border-border bg-background px-4 py-3 text-sm focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary"- autoFocus- onKeyDown={(e) => {- if (e.key === "Enter" && editDealTypeOther.trim()) {- handleOtherSubmit();- }- }}- />- <Button- onClick={handleOtherSubmit}- disabled={!editDealTypeOther.trim() || isSaving}- >- →- </Button>- </div>- ) : (- <button- onClick={() => setShowOtherInput(true)}- disabled={isSaving}- className="flex items-center justify-between rounded-lg border border-border px-4 py-3 text-left transition-all hover:border-primary/50 hover:bg-muted/50"- >- <span className="font-medium">Other</span>- </button>- )}- </div>+ {step === 3 && (+ <Button variant="outline" size="sm" onClick={handleEdit}>+ <PencilIcon className="mr-2 h-4 w-4" />+ Edit+ </Button>+ )}+ </div>+ </CardHeader>+ <CardContent>+ {isLoading ? (+ <p className="text-sm text-muted-foreground">Loading...</p>+ ) : step === 1 ? (+ <>+ <div className="mb-4">+ <h3 className="text-lg font-semibold">What do you use Papermark for?</h3></div>- ) : (- <div className="space-y-4">- <div className="flex items-center gap-2">++ <div className="grid gap-2">+ {DEAL_TYPE_OPTIONS.map((option) => (<button- onClick={() => setEditStep(1)}- className="rounded-full p-1 hover:bg-muted"+ key={option.value}+ onClick={() => handleDealTypeSelect(option.value)}disabled={isSaving}+ className="flex items-center justify-between rounded-lg border border-border px-3 py-2 text-left text-sm transition-all hover:border-primary/50 hover:bg-muted/50">- <ArrowLeftIcon className="h-4 w-4" />+ <span className="font-medium">{option.label}</span></button>- <p className="text-sm font-medium">- {editDealType === "mergers-acquisitions" ||- editDealType === "real-estate" ||- editDealType === "financial-operations" ||- editDealType === "other"- ? "What's the deal size?"- : "How much are you raising?"}- </p>- </div>- <div className="grid gap-2">- {DEAL_SIZE_OPTIONS.map((option) => (+ ))}+ {/* Other - inline input */}+ {showOtherInput ? (+ <div className="flex gap-2">+ <input+ type="text"+ value={editDealTypeOther}+ onChange={(e) => setEditDealTypeOther(e.target.value)}+ placeholder="Please specify..."+ className="flex-1 rounded-lg border border-border bg-background px-3 py-2 text-sm focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary"+ autoFocus+ onKeyDown={(e) => {+ if (e.key === "Enter" && editDealTypeOther.trim()) {+ handleOtherSubmit();+ }+ }}+ /><button- key={option.value}- onClick={() => setEditDealSize(option.value)}- className={`flex items-center justify-between rounded-lg border px-4 py-3 text-left transition-all ${- editDealSize === option.value- ? "border-primary bg-primary/5 ring-1 ring-primary"- : "border-border hover:border-primary/50 hover:bg-muted/50"- }`}+ onClick={handleOtherSubmit}+ disabled={!editDealTypeOther.trim() || isSaving}+ className="rounded-lg bg-primary px-3 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 disabled:opacity-50">- <span className="font-medium">{option.label}</span>- <div- className={`h-4 w-4 rounded-full border-2 transition-colors ${- editDealSize === option.value- ? "border-primary bg-primary"- : "border-muted-foreground/30"- }`}- />+ →</button>- ))}- </div>- <div className="flex justify-end">- <Button- onClick={() => handleSave()}- disabled={!editDealSize || isSaving}+ </div>+ ) : (+ <button+ onClick={() => setShowOtherInput(true)}+ disabled={isSaving}+ className="flex items-center justify-between rounded-lg border border-border px-3 py-2 text-left text-sm transition-all hover:border-primary/50 hover:bg-muted/50">- {isSaving ? "Saving..." : "Save"}- </Button>- </div>+ <span className="font-medium">Other</span>+ </button>+ )}+ </div>+ </>+ ) : step === 2 ? (+ <>+ <div className="mb-4">+ <h3 className="text-lg font-semibold">+ {getDealSizeQuestion()}+ </h3></div>- )}- </CardContent>- </Card>-- {/* Edit Dialog */}- <Dialog open={isEditing} onOpenChange={setIsEditing}>- <DialogContent className="sm:max-w-md">- {editStep === 1 ? (- <>- <DialogHeader>- <DialogTitle>What do you use Papermark for?</DialogTitle>- </DialogHeader>-- <div className="grid gap-2 py-4">- {DEAL_TYPE_OPTIONS.map((option) => (- <button- key={option.value}- onClick={() => handleDealTypeSelect(option.value)}- disabled={isSaving}- className={`flex items-center justify-between rounded-lg border px-4 py-3 text-left transition-all ${- editDealType === option.value- ? "border-primary bg-primary/5 ring-1 ring-primary"- : "border-border hover:border-primary/50 hover:bg-muted/50"- }`}- >- <span className="font-medium">{option.label}</span>- </button>- ))}- {/* Other - inline input */}- {showOtherInput ? (- <div className="flex gap-2">- <input- type="text"- value={editDealTypeOther}- onChange={(e) => setEditDealTypeOther(e.target.value)}- placeholder="Please specify..."- className="flex-1 rounded-lg border border-border bg-background px-4 py-3 text-sm focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary"- autoFocus- onKeyDown={(e) => {- if (e.key === "Enter" && editDealTypeOther.trim()) {- handleOtherSubmit();- }- }}- />- <Button- onClick={handleOtherSubmit}- disabled={!editDealTypeOther.trim() || isSaving}- >- →- </Button>- </div>- ) : (- <button- onClick={() => setShowOtherInput(true)}- disabled={isSaving}- className={`flex items-center justify-between rounded-lg border px-4 py-3 text-left transition-all ${- editDealType === "other"- ? "border-primary bg-primary/5 ring-1 ring-primary"- : "border-border hover:border-primary/50 hover:bg-muted/50"- }`}- >- <span className="font-medium">Other</span>- </button>- )}- </div>- </>- ) : (- <>- <DialogHeader>- <DialogTitle>- {editDealType === "mergers-acquisitions" ||- editDealType === "real-estate" ||- editDealType === "financial-operations" ||- editDealType === "other"- ? "What's the deal size?"- : "How much are you raising?"}- </DialogTitle>- </DialogHeader>-- <div className="grid gap-2 py-4">- {DEAL_SIZE_OPTIONS.map((option) => (- <button- key={option.value}- onClick={() => setEditDealSize(option.value)}- className={`flex items-center justify-between rounded-lg border px-4 py-3 text-left transition-all ${- editDealSize === option.value- ? "border-primary bg-primary/5 ring-1 ring-primary"- : "border-border hover:border-primary/50 hover:bg-muted/50"- }`}- >- <span className="font-medium">{option.label}</span>- <div- className={`h-4 w-4 rounded-full border-2 transition-colors ${- editDealSize === option.value- ? "border-primary bg-primary"- : "border-muted-foreground/30"- }`}- />- </button>- ))}- </div>- <div className="flex items-center justify-between">- <Button- variant="outline"- onClick={() => setEditStep(1)}+ <div className="grid gap-2">+ {DEAL_SIZE_OPTIONS.map((option) => (+ <button+ key={option.value}+ onClick={() => handleDealSizeSelect(option.value)}disabled={isSaving}+ className="flex items-center justify-between rounded-lg border border-border px-3 py-2 text-left text-sm transition-all hover:border-primary/50 hover:bg-muted/50">- Back- </Button>- <Button- onClick={() => handleSave()}- disabled={!editDealSize || isSaving}- >- {isSaving ? "Saving..." : "Save"}- </Button>+ <span className="font-medium">{option.label}</span>+ </button>+ ))}+ </div>+ </>+ ) : (+ <>+ <div className="mb-4 flex items-center gap-3">+ <CheckCircleIcon className="h-6 w-6 text-green-500" />+ <h3 className="text-lg font-semibold">Thanks for sharing!</h3>+ </div>++ <div className="space-y-3">+ <div className="flex items-center justify-between rounded-lg border border-border px-3 py-2">+ <span className="text-sm text-muted-foreground">Use case</span>+ <span className="text-sm font-medium">+ {getDealTypeLabel(dealType, dealTypeOther)}+ </span></div>- </>- )}- </DialogContent>- </Dialog>- </>+ {dealSize && (+ <div className="flex items-center justify-between rounded-lg border border-border px-3 py-2">+ <span className="text-sm text-muted-foreground">Deal size</span>+ <span className="text-sm font-medium">+ {getDealSizeLabel(dealSize)}+ </span>+ </div>+ )}+ </div>+ </>+ )}+ </CardContent>+ </Card>);}diff --git a/components/shared/dealflow-popup.tsx b/components/shared/dealflow-popup.tsxindex b9666b76..b0200529 100644--- a/components/shared/dealflow-popup.tsx+++ b/components/shared/dealflow-popup.tsx@@ -12,7 +12,7 @@ import Link from "next/link";const DEAL_TYPE_OPTIONS = [{ value: "startup-fundraising", label: "Startup Fundraising" },- { value: "fund-management", label: "Fund Management" },+ { value: "fund-management", label: "Fundraising & Reporting" },{ value: "mergers-acquisitions", label: "Mergers & Acquisitions" },{ value: "financial-operations", label: "Financial Operations" },{ value: "real-estate", label: "Real Estate" },@@ -46,24 +46,36 @@ export function DealflowPopup() {useEffect(() => {// Don't show on onboarding pages- if (isOnboarding) return;+ if (isOnboarding) {+ console.log("[DealflowPopup] Skipping - on onboarding page");+ return;+ }// Don't show if no team context- if (!teamId) return;+ if (!teamId) {+ console.log("[DealflowPopup] Skipping - no teamId");+ return;+ }// Check if already dismissed in localStorage for this teamconst dismissed = localStorage.getItem(storageKey);- if (dismissed) return;+ if (dismissed) {+ console.log("[DealflowPopup] Skipping - dismissed in localStorage:", storageKey);+ return;+ }// Check if team already has survey dataconst checkSurvey = async () => {try {+ console.log("[DealflowPopup] Checking survey for team:", teamId);const response = await fetch(`/api/teams/${teamId}/survey`);if (response.ok) {const data = await response.json();+ console.log("[DealflowPopup] Survey data:", data);// If dealType is missing → show popup from question 1if (!data.dealType) {+ console.log("[DealflowPopup] No dealType - showing popup step 1");setTimeout(() => {setStep(1);setIsOpen(true);@@ -71,17 +83,22 @@ export function DealflowPopup() {}// If dealType exists but dealSize is missing (and not project-management) → show popup from question 2else if (!data.dealSize && data.dealType !== "project-management") {+ console.log("[DealflowPopup] Has dealType but no dealSize - showing popup step 2");setTimeout(() => {setDealType(data.dealType);setDealTypeOther(data.dealTypeOther || "");setStep(2);setIsOpen(true);}, 2000);+ } else {+ console.log("[DealflowPopup] Survey complete - not showing popup");}// If both are filled → don't show popup+ } else {+ console.log("[DealflowPopup] API response not ok:", response.status);}} catch (error) {- console.error("Failed to check survey status:", error);+ console.error("[DealflowPopup] Failed to check survey status:", error);}};@@ -251,7 +268,7 @@ export function DealflowPopup() {</div><p className="mt-3 text-xs text-muted-foreground">- This will help tailor your experience+ This will help us tailor your Papermark experience</p></>) : step === 2 ? (@@ -284,7 +301,7 @@ export function DealflowPopup() {</div><p className="mt-3 text-xs text-muted-foreground">- This will help tailor your experience+ This will help us tailor your Papermark experience</p></>) : (diff --git a/components/welcome/dataroom-trial.tsx b/components/welcome/dataroom-trial.tsxindex 460386be..a4966575 100644--- a/components/welcome/dataroom-trial.tsx+++ b/components/welcome/dataroom-trial.tsx@@ -54,8 +54,7 @@ export default function DataroomTrial() {// Check if use case needs deal size questionconst needsDealSize =- useCase &&- useCase !== "project-management";+ !!useCase && useCase !== "project-management";// Helper function to convert use case to proper dataroom nameconst getDataroomName = (useCaseValue: string, customValue: string = "") => {@@ -66,7 +65,7 @@ export default function DataroomTrial() {const useCaseNames: Record<string, string> = {"mergers-and-acquisitions": "Mergers & Acquisitions Data Room","startup-fundraising": "Startup Fundraising Data Room",- "fund-management": "Fund Management Data Room",+ "fund-management": "Fundraising & Reporting Data Room",sales: "Sales Data Room","project-management": "Project Management Data Room",operations: "Financial Operations Data Room",@@ -304,7 +303,7 @@ export default function DataroomTrial() {Startup Fundraising</SelectItem><SelectItem value="fund-management">- Fund Management+ Fundraising & Reporting</SelectItem><SelectItem value="sales">Sales</SelectItem><SelectItem value="project-management">diff --git a/components/welcome/select.tsx b/components/welcome/select.tsxindex 1e8087d7..13ff4d58 100644--- a/components/welcome/select.tsx+++ b/components/welcome/select.tsx@@ -12,7 +12,7 @@ import NotionIcon from "@/components/shared/icons/files/notion";const DEAL_TYPE_OPTIONS = [{ value: "startup-fundraising", label: "Startup Fundraising" },- { value: "fund-management", label: "Fund Management" },+ { value: "fund-management", label: "Fundraising & Reporting" },{ value: "mergers-acquisitions", label: "Mergers & Acquisitions" },{ value: "financial-operations", label: "Financial Operations" },{ value: "real-estate", label: "Real Estate" },diff --git a/pages/api/teams/[teamId]/survey.ts b/pages/api/teams/[teamId]/survey.tsindex 329c347c..bfdf6f80 100644--- a/pages/api/teams/[teamId]/survey.ts+++ b/pages/api/teams/[teamId]/survey.ts@@ -49,7 +49,6 @@ export default async function handler(try {await getTeamWithUsersAndDocument({teamId,- visitorId: undefined,userId,options: {},});