Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
introduce starter plan and update modal and prices
Marc Seitzad6ba5547fed
diff --git a/components/billing/upgrade-plan-modal.tsx b/components/billing/upgrade-plan-modal.tsxindex 7e20cf2c..cfc0af80 100644--- a/components/billing/upgrade-plan-modal.tsx+++ b/components/billing/upgrade-plan-modal.tsx@@ -10,18 +10,31 @@ import { getStripe } from "@/lib/stripe/client";import { Badge } from "../ui/badge";import { useTeam } from "@/context/team-context";-export function UpgradePlanModal({ children }: { children: React.ReactNode }) {- const [plan, setPlan] = useState<"Pro">("Pro");+export function UpgradePlanModal({+ clickedPlan,+ children,+}: {+ clickedPlan: "Starter" | "Pro";+ children: React.ReactNode;+}) {+ const [plan, setPlan] = useState<"Starter" | "Pro">(clickedPlan);const [period, setPeriod] = useState<"monthly" | "yearly">("monthly");const [clicked, setClicked] = useState<boolean>(false);const teamInfo = useTeam();const features = useMemo(() => {return [- "Custom domain",+ "Custom domains",+ "Notion documents","Unlimited link views","Unlimited documents",- "Unlimited team members (ETA Nov 2023)",+ ...(plan === "Pro"+ ? [+ "AI Document Assistant incl. 1500 credits",+ "Unlimited team members",+ "Priority Support",+ ]+ : ["AI Document Assistant incl. 500 credits"]),];}, [plan]);@@ -75,7 +88,7 @@ export function UpgradePlanModal({ children }: { children: React.ReactNode }) {<Badgevariant="outline"className="text-sm font-normal normal-case"- >{`$${+ >{`€${PLANS.find((p) => p.name === plan)!.price[period].amount}/${period.replace("ly", "")}`}</Badge></div>@@ -143,6 +156,25 @@ export function UpgradePlanModal({ children }: { children: React.ReactNode }) {});}}>{`Upgrade to ${plan} ${capitalize(period)}`}</Button>+ <div className="flex items-center justify-center space-x-2">+ <button+ onClick={() => {+ setPlan(plan === "Pro" ? "Starter" : "Pro");+ }}+ className="text-center text-xs text-muted-foreground underline-offset-4 transition-all hover:text-gray-800 hover:dark:text-muted-foreground/80 hover:underline"+ >+ Papermark {plan === "Pro" ? "Starter" : "Pro"}+ </button>+ <p className="text-muted-foreground">•</p>+ <a+ href={`${process.env.NEXT_PUBLIC_BASE_URL}/pricing`}+ target="_blank"+ rel="noopener noreferrer"+ className="text-center text-xs text-muted-foreground underline-offset-4 transition-all hover:text-gray-800 hover:dark:text-muted-foreground/80 hover:underline"+ >+ Compare plans+ </a>+ </div></motion.div></div></DialogContent>diff --git a/lib/stripe/utils.ts b/lib/stripe/utils.tsindex 7280e54a..a5084f97 100644--- a/lib/stripe/utils.ts+++ b/lib/stripe/utils.ts@@ -45,14 +45,14 @@ export const PLANS = [slug: "pro",price: {monthly: {- amount: 29,+ amount: 30,priceIds: {test: "price_1NmHGzFJyGSZ96lhp946ODFI",production: "price_1NmMZ7FJyGSZ96lhyad2LW90",},},yearly: {- amount: 290,+ amount: 300,priceIds: {test: "price_1NmHHaFJyGSZ96lhXxg2fTr7",production: "price_1NmMZ7FJyGSZ96lhqZEkh50e",@@ -60,4 +60,24 @@ export const PLANS = [},},},+ {+ name: "Starter",+ slug: "starter",+ price: {+ monthly: {+ amount: 15,+ priceIds: {+ test: "price_1OIsDmFJyGSZ96lh2aIhaerk",+ production: "",+ },+ },+ yearly: {+ amount: 150,+ priceIds: {+ test: "price_1OIsDmFJyGSZ96lhVOYVN8PN",+ production: "",+ },+ },+ },+ },];diff --git a/pages/pricing.tsx b/pages/pricing.tsxindex d81857af..6ead036e 100644--- a/pages/pricing.tsx+++ b/pages/pricing.tsx@@ -24,8 +24,8 @@ export default function Pricing() {{id: 2,title: "Starter",- priceMonthly: "$15/mo",- description: "Use all freemium features+ ",+ priceMonthly: "€15/mo",+ description: "All free features + ",features: ["Custom domains","Unlimited documents",@@ -36,15 +36,15 @@ export default function Pricing() {{id: 3,title: "Pro",- priceMonthly: "$30/mo",- description: "Get more advanced plan",+ priceMonthly: "€30/mo",+ description: "All features and more",features: ["Team members","Priority Support","Custom Branding","Large file uploads","Papermark AI",- "2000 questions",+ "1500 questions",],},];diff --git a/pages/settings/billing.tsx b/pages/settings/billing.tsxindex 31a05def..124ba9c9 100644--- a/pages/settings/billing.tsx+++ b/pages/settings/billing.tsx@@ -45,7 +45,7 @@ export default function Billing() {{id: 1,title: "Free",- priceMonthly: "$0/mo",+ priceMonthly: "€0/mo",description: "Enjoy free access",currentPlan: plan && plan == "free" ? true : false,features: [@@ -62,10 +62,9 @@ export default function Billing() {{id: 2,title: "Starter",- priceMonthly: "$15/mo",- description: "Use all freemium features+ ",- currentPlan: plan && plan == "pro" ? true : false,- isTrial: plan && plan == "trial" ? true : false,+ priceMonthly: "€15/mo",+ description: "All free features +",+ currentPlan: plan && plan == "starter" ? true : false,features: ["Custom domains","Unlimited documents",@@ -76,16 +75,17 @@ export default function Billing() {{id: 3,title: "Pro",- priceMonthly: "$30/mo",- description: "Get more advanced plan",- currentPlan: false,+ priceMonthly: "€30/mo",+ description: "All features and more",+ currentPlan: plan && plan == "pro" ? true : false,+ isTrial: plan && plan == "trial" ? true : false,features: ["Team members","Priority Support","Custom Branding","Large file uploads","Papermark AI",- "2000 questions",+ "1500 questions",],},];@@ -106,11 +106,10 @@ export default function Billing() {href="https://cal.com/marcseitz/papermark"target="_blank"rel="noopener noreferrer"- className="text-white hover:underline"+ className="text-foreground hover:underline">- {" "}- contact us{" "}- </Link>+ contact us+ </Link>{" "}for support and enterprise requests</p></div>@@ -208,7 +207,40 @@ export default function Billing() {Manage Subscription</Button>) : (- <UpgradePlanModal>+ <UpgradePlanModal clickedPlan="Starter">+ <Button type="button">Upgrade to Starter</Button>+ </UpgradePlanModal>+ )+ ) : (+ <div className="h-10 w-24 animate-pulse rounded-md bg-border" />+ ))}+ {tier.id === 3 &&+ (plan ? (+ tier.currentPlan ? (+ <Button+ onClick={() => {+ setClicked(true);+ fetch(+ `/api/teams/${teamInfo?.currentTeam?.id}/billing/manage`,+ {+ method: "POST",+ },+ )+ .then(async (res) => {+ const url = await res.json();+ router.push(url);+ })+ .catch((err) => {+ alert(err);+ setClicked(false);+ });+ }}+ loading={clicked}+ >+ Manage Subscription+ </Button>+ ) : (+ <UpgradePlanModal clickedPlan="Pro"><Button type="button">{tier.isTrial? "Upgrade to remain on Pro"@@ -219,20 +251,6 @@ export default function Billing() {) : (<div className="h-10 w-24 animate-pulse rounded-md bg-border" />))}- {tier.id === 3 && (- <Link- href="https://cal.com/marcseitz/papermark"- target="_blank"- >- <Button- type="button"- variant="ghost"- className="border border-gray-700"- >- Contact us- </Button>- </Link>- )}</div></div>))}