mirror of
https://github.com/hanzoai/dataroom.git
synced 2026-10-30 18:41:07 +00:00
Drop the dual-licensed `ee/` tree entirely. All features previously
locked behind the Hanzo Dataroom Commercial License are now part of the
AGPL-3.0 core and freely available — custom domains, branded viewing,
advanced analytics, watermarks, access controls, Q&A, AI vector stores,
workflows, SAML SSO, dataroom invitations, conversations, templates.
Layout changes:
* `ee/features/{ai,conversations,workflows,permissions,storage,templates,
dataroom-invitations,access-notifications,security,conversions}/` →
`features/<name>/` (AGPL).
* `ee/limits/` → `lib/billing/limits/` with every plan resolving to an
unlimited profile (no users/links/documents/domains/datarooms cap,
conversations and watermarks always on).
* `ee/stripe/` → `lib/billing/legacy/` (already a compat shim over
`@hanzoai/commerce`; renewal-reminder webhook is now a no-op).
* `ee/features/billing/cancellation/` deleted. Pause/unpause/cancel/
retention routes now compile against `lib/billing/cancellation.ts`
stubs that return 410 Gone; `isTeamPaused`/`isTeamPausedById` in
`lib/billing/paused.ts` always report active. `CancellationModal` is
a no-op shim in `components/billing/`.
* `app/(ee)/api/*` route group folded into `app/api/*` (SAML auth,
SCIM, AI chat, workflows, FAQ, link-upload).
Build: `npm run build` green.
119 lines
3.5 KiB
TypeScript
119 lines
3.5 KiB
TypeScript
import { Dispatch, SetStateAction, useEffect, useState } from "react";
|
|
|
|
import { useTeam } from "@/context/team-context";
|
|
import { PlanEnum } from "@/lib/billing/legacy/constants";
|
|
import Cookies from "js-cookie";
|
|
import { CrownIcon } from "lucide-react";
|
|
|
|
import { usePlan } from "@/lib/swr/use-billing";
|
|
import useDataroomsSimple from "@/lib/swr/use-datarooms-simple";
|
|
import { daysLeft } from "@/lib/utils";
|
|
|
|
import { UpgradePlanModal } from "@/components/billing/upgrade-plan-modal";
|
|
import {
|
|
Alert,
|
|
AlertClose,
|
|
AlertDescription,
|
|
AlertTitle,
|
|
} from "@/components/ui/alert";
|
|
|
|
export default function TrialBanner() {
|
|
const { trial } = usePlan();
|
|
const isTrial = !!trial;
|
|
const [showTrialBanner, setShowTrialBanner] = useState<boolean | null>(null);
|
|
|
|
useEffect(() => {
|
|
if (Cookies.get("hideTrialBanner") !== "trial-banner" && isTrial) {
|
|
setShowTrialBanner(true);
|
|
} else {
|
|
setShowTrialBanner(false);
|
|
}
|
|
}, []);
|
|
|
|
if (isTrial && showTrialBanner) {
|
|
return <TrialBannerComponent setShowTrialBanner={setShowTrialBanner} />;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
function TrialBannerComponent({
|
|
setShowTrialBanner,
|
|
}: {
|
|
setShowTrialBanner: Dispatch<SetStateAction<boolean | null>>;
|
|
}) {
|
|
const teamInfo = useTeam();
|
|
|
|
const handleHideBanner = () => {
|
|
setShowTrialBanner(false);
|
|
Cookies.set("hideTrialBanner", "trial-banner", {
|
|
expires: 1,
|
|
});
|
|
};
|
|
|
|
const { datarooms } = useDataroomsSimple();
|
|
|
|
const trialDaysLeft = datarooms
|
|
? daysLeft(
|
|
new Date(
|
|
datarooms[0]?.createdAt ??
|
|
teamInfo?.currentTeam?.createdAt ??
|
|
new Date(),
|
|
),
|
|
7,
|
|
)
|
|
: 0;
|
|
|
|
const isExpired = trialDaysLeft <= 0;
|
|
|
|
return (
|
|
<div className="mx-2 my-2 mb-2">
|
|
<Alert
|
|
variant="default"
|
|
className={
|
|
isExpired ? "border-2 border-red-500 dark:border-red-600" : ""
|
|
}
|
|
>
|
|
<CrownIcon className="h-4 w-4" />
|
|
<AlertTitle>
|
|
{isExpired
|
|
? "Your Data Room trial has expired"
|
|
: `Data Room trial: ${trialDaysLeft} days left`}
|
|
</AlertTitle>
|
|
<AlertDescription>
|
|
{isExpired ? (
|
|
<>
|
|
<UpgradePlanModal
|
|
clickedPlan={PlanEnum.DataRooms}
|
|
trigger={"trial_navbar"}
|
|
>
|
|
<span className="cursor-pointer font-bold text-black underline underline-offset-4 hover:text-gray-700 dark:text-white dark:hover:text-gray-300">
|
|
Upgrade to keep access
|
|
</span>
|
|
</UpgradePlanModal>{" "}
|
|
to unlimited data rooms, custom domains, advanced access controls,
|
|
and granular file permissions ✨
|
|
</>
|
|
) : (
|
|
<>
|
|
You are on the <span className="font-bold">Data Rooms</span> plan
|
|
trial, you have access to advanced access controls, granular file
|
|
permissions, and data room. <br />
|
|
<UpgradePlanModal
|
|
clickedPlan={PlanEnum.DataRooms}
|
|
trigger={"trial_navbar"}
|
|
>
|
|
<span className="cursor-pointer font-bold text-orange-500 underline underline-offset-4 hover:text-orange-600">
|
|
Upgrade to keep access
|
|
</span>
|
|
</UpgradePlanModal>
|
|
, unlock unlimited data rooms and custom domains ✨
|
|
</>
|
|
)}
|
|
</AlertDescription>
|
|
<AlertClose onClick={handleHideBanner} />
|
|
</Alert>
|
|
</div>
|
|
);
|
|
}
|