From cd052976ebcfbd9aaa64aefd84f3ac7d289a825c Mon Sep 17 00:00:00 2001 From: Owen Date: Wed, 10 Jun 2026 20:38:59 -0700 Subject: [PATCH] Properly paywall the edit policy screen --- .../resource-policy/EditPolicyForm.tsx | 81 ++++++++++++++++--- 1 file changed, 68 insertions(+), 13 deletions(-) diff --git a/src/components/resource-policy/EditPolicyForm.tsx b/src/components/resource-policy/EditPolicyForm.tsx index 57dd12fdc..7ad92360d 100644 --- a/src/components/resource-policy/EditPolicyForm.tsx +++ b/src/components/resource-policy/EditPolicyForm.tsx @@ -8,13 +8,14 @@ import { usePaidStatus } from "@app/hooks/usePaidStatus"; import { orgQueries } from "@app/lib/queries"; import { build } from "@server/build"; -import { tierMatrix } from "@server/lib/billing/tierMatrix"; +import { TierFeature, tierMatrix } from "@server/lib/billing/tierMatrix"; import { useQuery } from "@tanstack/react-query"; import { useMemo } from "react"; import { EditPolicyNameSectionForm } from "./EditPolicyNameSectionForm"; import { PolicyAuthStackSection } from "./PolicyAuthStackSection"; import { PolicyAccessRulesSection } from "./PolicyAccessRulesSection"; +import { PaidFeaturesAlert } from "@app/components/PaidFeaturesAlert"; export type EditPolicyFormSection = "general" | "authentication" | "rules"; @@ -71,13 +72,17 @@ export function EditPolicyForm({ return <>; } + const policyTiers = tierMatrix[TierFeature.ResourcePolicies]; + const isDisabled = !isPaidUser(policyTiers); + const effectiveReadonly = readonly || isDisabled; + const authSection = ( ); @@ -87,32 +92,82 @@ export function EditPolicyForm({ mode="edit" isMaxmindAvailable={isMaxmindAvailable} isMaxmindAsnAvailable={isMaxmindASNAvailable} - readonly={readonly} + readonly={effectiveReadonly} resourceId={resourceId} /> ); if (section === "general") { - return ; + return ( + <> + +
+ +
+ + ); } if (section === "authentication") { - return authSection; + return ( + <> + +
+ {authSection} +
+ + ); } if (section === "rules") { - return rulesSection; + return ( + <> + +
+ {rulesSection} +
+ + ); } return ( - - {!hidePolicyNameForm && !isOverlay && ( - - )} + <> + +
+ + {!hidePolicyNameForm && !isOverlay && ( + + )} - {authSection} + {authSection} - {rulesSection} - + {rulesSection} + +
+ ); }