Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

feat(datarooms): enable Freeze Data Room archive via dataroomFreeze feature flag

Marc Seitz2d144010a8b1
diff --git a/lib/featureFlags/dataroom-freeze.ts b/lib/featureFlags/dataroom-freeze.ts
new file mode 100644
index 00000000..b5341ac5
--- /dev/null
+++ b/lib/featureFlags/dataroom-freeze.ts
@@ -0,0 +1,25 @@
+import { teamPlanIsDataroomPlusTier } from "@/lib/billing/team-plan-custom-messaging";
+
+import { getFeatureFlags } from "@/lib/featureFlags";
+
+/**
+ * Freeze Data Room — and the downloadable tamper-proof archive it generates —
+ * is included on the Data Rooms Plus tier and above. The Edge Config
+ * `dataroomFreeze` flag is an additional enablement path layered on top of the
+ * plan gate, so the feature can be turned on for a team on the base Data Rooms
+ * plan without upgrading. Enabled = Plus-tier plan OR the `dataroomFreeze`
+ * flag. Mirrors resolveDataroomIndexEnabledForViewer.
+ */
+export async function resolveDataroomFreezeEnabled(opts: {
+ teamId: string | null | undefined;
+ teamPlan: string | null | undefined;
+}): Promise<boolean> {
+ // Plan check first: cheap, and short-circuits the Edge Config lookup for
+ // teams whose plan already includes the feature.
+ if (teamPlanIsDataroomPlusTier(opts.teamPlan ?? undefined)) {
+ return true;
+ }
+
+ const flags = await getFeatureFlags({ teamId: opts.teamId || undefined });
+ return Boolean(flags.dataroomFreeze);
+}
diff --git a/lib/featureFlags/index.ts b/lib/featureFlags/index.ts
index a1a573f1..66f5499b 100644
--- a/lib/featureFlags/index.ts
+++ b/lib/featureFlags/index.ts
@@ -10,6 +10,7 @@ export type BetaFeatures =
| "inDocumentLinks"
| "usStorage"
| "dataroomIndex"
+ | "dataroomFreeze"
| "slack"
| "annotations"
| "dataroomInvitations"
@@ -35,6 +36,7 @@ export const getFeatureFlags = async ({ teamId }: { teamId?: string }) => {
inDocumentLinks: false,
usStorage: false,
dataroomIndex: false,
+ dataroomFreeze: false,
slack: false,
annotations: false,
dataroomInvitations: false,