Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat(billing): replace legacy upgrade dialogs with shared gates (#8182)

Andrew Huangac3632338acc
diff --git a/backend/src/ee/routes/v1/license-v2-router.ts b/backend/src/ee/routes/v1/license-v2-router.ts
index 0df2266c9a..a476c52085 100644
--- a/backend/src/ee/routes/v1/license-v2-router.ts
+++ b/backend/src/ee/routes/v1/license-v2-router.ts
@@ -16,10 +16,26 @@ import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
const ReturnPathSchema = z
.string()
.trim()
+ .max(2048)
.startsWith("/")
.refine((path) => !path.startsWith("//") && !path.startsWith("/\\"), {
message: "must be a relative path"
})
+ .refine(
+ (path) =>
+ [...path].every((character) => {
+ const codePoint = character.charCodeAt(0);
+ return codePoint > 31 && codePoint !== 127 && character !== "\\";
+ }),
+ { message: "must not contain control characters or backslashes" }
+ )
+ .transform((path) => {
+ const url = new URL(path, "https://infisical.invalid");
+ return `${url.pathname}${url.search}${url.hash}`;
+ })
+ .refine((path) => !path.split(/[?#]/)[0].includes("//"), {
+ message: "must not contain repeated path separators"
+ })
.optional();
const BillingV2DimSchema = z.object({
@@ -708,8 +724,9 @@ export const registerLicenseV2Router = async (server: FastifyZodProvider) => {
schema: {
params: z.object({ organizationId: z.string().trim() }),
body: z.object({
- productId: z.string().trim(),
- plan: z.string().trim()
+ productId: z.string().trim().min(1).max(255),
+ plan: z.string().trim().min(1).max(255),
+ returnPath: ReturnPathSchema
}),
response: {
200: z.object({
@@ -728,6 +745,7 @@ export const registerLicenseV2Router = async (server: FastifyZodProvider) => {
actor: buildActor(req.permission),
productId: req.body.productId,
plan: req.body.plan,
+ returnPath: req.body.returnPath,
email
});
diff --git a/backend/src/ee/services/license-v2/license-v2-service.ts b/backend/src/ee/services/license-v2/license-v2-service.ts
index d46646c27c..b92759615f 100644
--- a/backend/src/ee/services/license-v2/license-v2-service.ts
+++ b/backend/src/ee/services/license-v2/license-v2-service.ts
@@ -1177,7 +1177,12 @@ export const licenseV2ServiceFactory = ({
}
const path = returnPath && returnPath.startsWith("/") ? returnPath : `/organizations/${orgId}/billing`;
try {
- return new URL(path, envConfig.SITE_URL).toString();
+ const siteUrl = new URL(envConfig.SITE_URL);
+ const returnUrl = new URL(path, siteUrl);
+ if (returnUrl.origin !== siteUrl.origin) {
+ throw new Error("Return URL must use the application origin");
+ }
+ return returnUrl.toString();
} catch {
throw new InternalServerError({ message: "Failed to build a billing return URL" });
}
@@ -1415,9 +1420,9 @@ export const licenseV2ServiceFactory = ({
return { outcome: "subscription_updated" as const, subscriptionId: result.subscriptionId };
};
- // Start a plan-scoped self-serve trial. The trial is granted immediately (no upfront charge);
- // cardSetupUrl, when present, is a best-effort card-setup checkout the client redirects to.
- const startTrial = async ({ orgId, actor, productId, plan, email }: TStartBillingV2TrialDTO) => {
+ // Start a plan-scoped self-serve trial. Existing-card customers are granted immediately; others
+ // must complete the returned card-setup checkout before the license server grants the trial.
+ const startTrial = async ({ orgId, actor, productId, plan, email, returnPath }: TStartBillingV2TrialDTO) => {
await ensureManageBilling(orgId, actor);
// The trial has no Stripe customer yet, so the server creates one from the org's own name + the
// authenticated user's email; neither is client-supplied.
@@ -1437,7 +1442,7 @@ export const licenseV2ServiceFactory = ({
name: organization?.name,
declaredUsage: resolved?.declaredUsage,
// The trial's card-setup checkout redirects here; built server-side from SITE_URL like checkout.
- returnUrl: buildReturnUrl(orgId)
+ returnUrl: buildReturnUrl(orgId, returnPath)
});
// awaiting_card redirects to a Stripe card-setup checkout; the trial is granted by webhook only
// after it's completed, so hold the revalidation window open longer than an immediate trial_started.
@@ -1467,8 +1472,14 @@ export const licenseV2ServiceFactory = ({
await licenseClient.markEntitlementsStale(orgId);
return { outcome: result.outcome };
}
+ const checkoutUrl = toHttpsUrl(result.checkoutUrl);
+ if (!checkoutUrl) {
+ throw new BadRequestError({
+ message: "We couldn't get a secure checkout link. Please try again or contact support."
+ });
+ }
await licenseClient.markEntitlementsStale(orgId, { checkout: true });
- return { outcome: result.outcome, redirectUrl: result.checkoutUrl };
+ return { outcome: result.outcome, redirectUrl: checkoutUrl };
};
// Remove a single product from a multi-product subscription, the operation the Stripe Customer
diff --git a/backend/src/ee/services/license-v2/license-v2-types.ts b/backend/src/ee/services/license-v2/license-v2-types.ts
index dd417f79c7..3cb39c6102 100644
--- a/backend/src/ee/services/license-v2/license-v2-types.ts
+++ b/backend/src/ee/services/license-v2/license-v2-types.ts
@@ -341,6 +341,7 @@ export type TStartBillingV2TrialDTO = {
plan: string;
// Billing email for the trial; a trial has no Stripe customer yet, so the server needs it up front.
email?: string;
+ returnPath?: string;
};
export type TCancelBillingV2TrialDTO = {
diff --git a/backend/src/ee/services/pam-account/pam-account-service.ts b/backend/src/ee/services/pam-account/pam-account-service.ts
index f20e098855..01042bf720 100644
--- a/backend/src/ee/services/pam-account/pam-account-service.ts
+++ b/backend/src/ee/services/pam-account/pam-account-service.ts
@@ -709,6 +709,7 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>
const currentPamAccountCount = await pamAccountDAL.countByOrgId(ctx.actorOrgId);
if (currentPamAccountCount >= plan.maxPamAccounts) {
throw new BadRequestError({
+ name: "PAM_ACCOUNT_LIMIT_REACHED",
message: "Failed to create PAM account due to plan limit reached. Upgrade plan to add more PAM accounts."
});
}
diff --git a/frontend/eslint.config.js b/frontend/eslint.config.js
index 4905f24c01..9c1faf7bec 100644
--- a/frontend/eslint.config.js
+++ b/frontend/eslint.config.js
@@ -155,7 +155,18 @@ export default tseslint.config(
],
"import/first": "error",
"import/newline-after-import": "error",
- "import/no-duplicates": "error"
+ "import/no-duplicates": "error",
+ "no-restricted-imports": [
+ "error",
+ {
+ patterns: [
+ {
+ group: ["**/UpgradePlanModal", "**/UpgradePlanModal/*"],
+ message: "Use the shared UpgradeGate with a product or capability intent."
+ }
+ ]
+ }
+ ]
}
},
{
diff --git a/frontend/src/components/agent-vault/AgentVaultSessionLogUpgradeModal.tsx b/frontend/src/components/agent-vault/AgentVaultSessionLogUpgradeModal.tsx
index 4a102e9657..b32ac05d11 100644
--- a/frontend/src/components/agent-vault/AgentVaultSessionLogUpgradeModal.tsx
+++ b/frontend/src/components/agent-vault/AgentVaultSessionLogUpgradeModal.tsx
@@ -1,4 +1,7 @@
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import {
+ AgentVaultSessionLogsUpgradeIntent,
+ UpgradeGate
+} from "@app/components/license/UpgradeGate";
type Props = {
isOpen: boolean;
@@ -6,11 +9,13 @@ type Props = {
};
export const AgentVaultSessionLogUpgradeModal = ({ isOpen, onOpenChange }: Props) => (
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="agent-vault.session-logs"
isOpen={isOpen}
onOpenChange={onOpenChange}
- isEnterpriseFeature
- text="Your current plan does not include session logs, which record every request your agents make. To unlock them, upgrade to the Infisical Enterprise plan."
+ intent={{
+ ...AgentVaultSessionLogsUpgradeIntent,
+ isEnterpriseFeature: true
+ }}
/>
);
diff --git a/frontend/src/components/auditLogSettings/AuditLogEventClassesForm.tsx b/frontend/src/components/auditLogSettings/AuditLogEventClassesForm.tsx
index e7e968d852..52d672725d 100644
--- a/frontend/src/components/auditLogSettings/AuditLogEventClassesForm.tsx
+++ b/frontend/src/components/auditLogSettings/AuditLogEventClassesForm.tsx
@@ -2,7 +2,7 @@ import { Controller, useForm } from "react-hook-form";
import { Link } from "@tanstack/react-router";
import { Info } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { AuditLogsUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import {
Alert,
@@ -208,11 +208,14 @@ export const AuditLogEventClassesForm = ({
</CardFooter>
)}
</Card>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey={paywallKey}
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="Your current plan does not include access to audit logs. To change which events are recorded, please upgrade to Infisical Pro plan."
+ intent={{
+ ...AuditLogsUpgradeIntent,
+ description: "Choose which audit events are recorded."
+ }}
/>
</form>
);
diff --git a/frontend/src/components/auth/AuthPageBackground.tsx b/frontend/src/components/auth/AuthPageBackground.tsx
index 3eefb73eaf..d8d186648a 100644
--- a/frontend/src/components/auth/AuthPageBackground.tsx
+++ b/frontend/src/components/auth/AuthPageBackground.tsx
@@ -1,6 +1,8 @@
+import { cn } from "@app/components/v3/utils";
+
/* eslint-disable react/no-array-index-key */
-export const AuthPageBackground = () => (
- <div className="pointer-events-none absolute inset-0 overflow-hidden">
+export const AuthPageBackground = ({ className }: { className?: string }) => (
+ <div className={cn("pointer-events-none absolute inset-0 overflow-hidden text-white", className)}>
<svg
viewBox="0 0 800 800"
className="absolute top-1/2 -left-[360px] h-[720px] w-[720px] -translate-y-1/2 opacity-[0.06] xl:-left-[400px] xl:h-[800px] xl:w-[800px]"
@@ -9,18 +11,18 @@ export const AuthPageBackground = () => (
aria-hidden="true"
>
<g className="[transform-origin:400px_400px] motion-safe:animate-[spin_140s_linear_infinite]">
- <circle cx="400" cy="400" r="380" stroke="white" strokeWidth="2" />
- <circle cx="400" cy="400" r="370" stroke="white" strokeWidth="0.5" />
+ <circle cx="400" cy="400" r="380" stroke="currentColor" strokeWidth="2" />
+ <circle cx="400" cy="400" r="370" stroke="currentColor" strokeWidth="0.5" />
{Array.from({ length: 24 }).map((_, i) => {
const angle = (i * 15 * Math.PI) / 180;
const x = 400 + 375 * Math.cos(angle);
const y = 400 + 375 * Math.sin(angle);
- return <circle key={`bolt-${i}`} cx={x} cy={y} r="4" fill="white" />;
+ return <circle key={`bolt-${i}`} cx={x} cy={y} r="4" fill="currentColor" />;
})}
</g>
<g className="[transform-origin:400px_400px] motion-safe:animate-[spin_95s_linear_infinite_reverse]">
- <circle cx="400" cy="400" r="300" stroke="white" strokeWidth="1.5" />
- <circle cx="400" cy="400" r="290" stroke="white" strokeWidth="0.5" />
+ <circle cx="400" cy="400" r="300" stroke="currentColor" strokeWidth="1.5" />
+ <circle cx="400" cy="400" r="290" stroke="currentColor" strokeWidth="0.5" />
{Array.from({ length: 60 }).map((_, i) => {
const angle = (i * 6 * Math.PI) / 180;
const innerR = i % 5 === 0 ? 280 : 285;
@@ -35,15 +37,15 @@ export const AuthPageBackground = () => (
y1={y1}
x2={x2}
y2={y2}
- stroke="white"
+ stroke="currentColor"
strokeWidth={i % 5 === 0 ? "1.5" : "0.5"}
/>
);
})}
</g>
<g className="[transform-origin:400px_400px] motion-safe:animate-[spin_70s_linear_infinite]">
- <circle cx="400" cy="400" r="200" stroke="white" strokeWidth="1" />
- <circle cx="400" cy="400" r="195" stroke="white" strokeWidth="0.3" />
+ <circle cx="400" cy="400" r="200" stroke="currentColor" strokeWidth="1" />
+ <circle cx="400" cy="400" r="195" stroke="currentColor" strokeWidth="0.3" />
{Array.from({ length: 8 }).map((_, i) => {
const angle = (i * 45 * Math.PI) / 180;
const x1 = 400 + 200 * Math.cos(angle);
@@ -57,7 +59,7 @@ export const AuthPageBackground = () => (
y1={y1}
x2={x2}
y2={y2}
- stroke="white"
+ stroke="currentColor"
strokeWidth="3"
strokeLinecap="round"
/>
@@ -65,15 +67,15 @@ export const AuthPageBackground = () => (
})}
</g>
<g className="[transform-origin:400px_400px] motion-safe:animate-[spin_45s_linear_infinite_reverse]">
- <circle cx="400" cy="400" r="100" stroke="white" strokeWidth="2" />
- <circle cx="400" cy="400" r="80" stroke="white" strokeWidth="0.5" />
- <circle cx="400" cy="400" r="15" fill="white" />
+ <circle cx="400" cy="400" r="100" stroke="currentColor" strokeWidth="2" />
+ <circle cx="400" cy="400" r="80" stroke="currentColor" strokeWidth="0.5" />
+ <circle cx="400" cy="400" r="15" fill="currentColor" />
<line
x1="320"
y1="400"
x2="480"
y2="400"
- stroke="white"
+ stroke="currentColor"
strokeWidth="4"
strokeLinecap="round"
/>
@@ -82,7 +84,7 @@ export const AuthPageBackground = () => (
y1="320"
x2="400"
y2="480"
- stroke="white"
+ stroke="currentColor"
strokeWidth="4"
strokeLinecap="round"
/>
diff --git a/frontend/src/components/license/ProductPlanSummaryList.tsx b/frontend/src/components/license/ProductPlanSummaryList.tsx
new file mode 100644
index 0000000000..0788b18e30
--- /dev/null
+++ b/frontend/src/components/license/ProductPlanSummaryList.tsx
@@ -0,0 +1,19 @@
+import { Badge } from "@app/components/v3";
+
+import { ProductPlanSummary } from "./product-plan-summary";
+
+export const ProductPlanSummaryList = ({ plans }: { plans: ProductPlanSummary[] }) => (
+ <ul className="space-y-3" aria-label="Product plans">
+ {plans.map((plan) => (
+ <li key={plan.productKey} className="flex items-start justify-between gap-3 text-sm">
+ <span>{plan.productName}</span>
+ <div className="flex flex-wrap justify-end gap-1">
+ <Badge variant="info">
+ {plan.planLabel}
+ {plan.isTrialing && " Trial"}
+ </Badge>
+ </div>
+ </li>
+ ))}
+ </ul>
+);
diff --git a/frontend/src/components/license/UpgradeGate/CapabilityUpgradeGate.tsx b/frontend/src/components/license/UpgradeGate/CapabilityUpgradeGate.tsx
new file mode 100644
index 0000000000..92adf6d611
--- /dev/null
+++ b/frontend/src/components/license/UpgradeGate/CapabilityUpgradeGate.tsx
@@ -0,0 +1,225 @@
+import { useEffect, useRef } from "react";
+import { useRouterState } from "@tanstack/react-router";
+import { Check, CircleAlert, Server, Shield, Vault } from "lucide-react";
+
+import {
+ getProductPlanSummaries,
+ ProductPlanSummary
+} from "@app/components/license/product-plan-summary";
+import { ProductPlanSummaryList } from "@app/components/license/ProductPlanSummaryList";
+import { Alert, AlertDescription, AlertTitle, Badge, Button, Separator } from "@app/components/v3";
+import {
+ OrgPermissionBillingActions,
+ OrgPermissionSubjects,
+ useOrganization,
+ useOrgPermission,
+ useSubscription
+} from "@app/context";
+import { analytics, AnalyticsEvent } from "@app/lib/analytics";
+
+import { CapabilityUpgradeIntent, getCapabilityUpgradeUrl } from "./capability-upgrade-intents";
+import { UpgradeDialogLayout } from "./UpgradeDialogLayout";
+
+type Props = {
+ intent: CapabilityUpgradeIntent;
+ paywallKey: string;
+ isOpen: boolean;
+ onOpenChange: (isOpen: boolean) => void;
+ onOpenAutoFocus?: (event: Event) => void;
+ onCloseAutoFocus?: (event: Event) => void;
+};
+
+const CapabilityUpgradeDialog = ({
+ intent,
+ paywallKey,
+ isOpen,
+ onOpenChange,
+ onOpenAutoFocus,
+ onCloseAutoFocus,
+ canManageBilling = false,
+ canReadBilling = false,
+ productPlans = []
+}: Props & {
+ canManageBilling?: boolean;
+ canReadBilling?: boolean;
+ productPlans?: ProductPlanSummary[];
+}) => {
+ const { currentOrg, isSubOrganization } = useOrganization();
+ const route = useRouterState({ select: (state) => state.matches.at(-1)?.routeId ?? "unknown" });
+ const eventPropertiesRef = useRef<{
+ paywallKey: string;
+ paywallText: string;
+ route: string;
+ isEnterpriseFeature: boolean;
+ } | null>(null);
+
+ useEffect(() => {
+ if (!isOpen) {
+ eventPropertiesRef.current = null;
+ return;
+ }
+
+ const eventProperties = {
+ paywallKey,
+ paywallText: intent.description,
+ route,
+ isEnterpriseFeature: intent.isEnterpriseFeature
+ };
+ eventPropertiesRef.current = eventProperties;
+ analytics.captureForOrganization(AnalyticsEvent.PaywallViewed, currentOrg.id, eventProperties);
+ // Capture the opening intent once, even when the triggering popup data changes.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [isOpen]);
+
+ if (!isOpen) return null;
+
+ const isInstance = intent.scope === "instance";
+ const isProduct = intent.scope === "product";
+ const openUpgradeDestination = () => {
+ if (eventPropertiesRef.current) {
+ analytics.captureForOrganization(
+ AnalyticsEvent.PaywallUpgradeClicked,
+ currentOrg.id,
+ eventPropertiesRef.current
+ );
+ }
+
+ if (isInstance) {
+ window.open(getCapabilityUpgradeUrl(intent, currentOrg), "_blank", "noopener,noreferrer");
+ return;
+ }
+
+ window.location.assign(getCapabilityUpgradeUrl(intent, currentOrg));
+ };
+
+ let scopeIcon = <Shield className="size-10 text-muted" />;
+ if (isInstance) scopeIcon = <Server className="size-10 text-muted" />;
+ else if (isProduct) scopeIcon = <Vault className="size-10 text-muted" />;
+
+ let actionLabel = isSubOrganization ? "Continue to Root Billing" : "View Plans";
+ if (isInstance) actionLabel = "Contact Sales";
+ else if (!canReadBilling) actionLabel = "Close";
+
+ let billingTitle = "Organization Subscription Required";
+ let billingDescription =
+ "This feature is shared across products. Review your billing options to find a subscription that includes it.";
+ if (isInstance) {
+ billingTitle = "Instance License Required";
+ billingDescription =
+ "This feature is licensed for the entire instance, not an individual product. Contact our team to discuss your deployment.";
+ } else if (!canReadBilling) {
+ billingTitle = "Billing Access Required";
+ billingDescription =
+ "Ask an organization member with billing access to review subscription options for this feature.";
+ } else if (isSubOrganization) {
+ billingTitle = "Root Organization Billing";
+ billingDescription =
+ "Sub-organizations share the root organization's subscription. Review available options in root billing.";
+ } else if (!canManageBilling) {
+ billingTitle = "Billing Management Required";
+ billingDescription =
+ "Ask an organization member with billing management permission to update the subscription.";
+ } else if (isProduct) {
+ billingTitle = "Product Subscription Required";
+ billingDescription =
+ "Review your billing options to find a subscription that includes this feature.";
+ }
+
+ const visiblePlans = isProduct
+ ? productPlans.filter((plan) => plan.productName === intent.productName)
+ : productPlans;
+ let scopeDescription = "Managed through your organization, across its products.";
+ if (isInstance) {
+ scopeDescription =
+ "Licensed for your entire self-hosted deployment, independently of organization product plans.";
+ } else if (isSubOrganization) {
+ scopeDescription = "Managed by your root organization and shared with its sub-organizations.";
+ } else if (isProduct) {
+ scopeDescription = `Managed through your organization's ${intent.productName} subscription.`;
+ }
+
+ return (
+ <UpgradeDialogLayout
+ scopeName={isInstance ? "Infisical Instance" : (intent.productName ?? "Infisical Platform")}
+ icon={scopeIcon}
+ title={intent.title}
+ description={scopeDescription}
+ onOpenChange={onOpenChange}
+ onOpenAutoFocus={onOpenAutoFocus}
+ onCloseAutoFocus={onCloseAutoFocus}
+ footer={
+ <Button
+ data-upgrade-cta
+ variant="org"
+ className="w-full"
+ onClick={
+ !isInstance && !canReadBilling ? () => onOpenChange(false) : openUpgradeDestination
+ }
+ >
+ {actionLabel}
+ </Button>
+ }
+ >
+ <section aria-label="Feature details" className="flex flex-col gap-4">
+ <div className="flex flex-wrap items-center justify-between gap-2">
+ <h3 className="text-sm font-medium">Feature Details</h3>
+ {intent.isEnterpriseFeature && <Badge variant="info">Enterprise Feature</Badge>}
+ </div>
+ <ul className="flex flex-col gap-4">
+ <li className="flex items-start gap-3">
+ <Check aria-hidden="true" className="mt-0.5 size-4 shrink-0 text-success" />
+ <div className="text-sm">
+ <p className="font-medium">{intent.title.replace(/^Unlock /, "")}</p>
+ <p className="mt-1 text-muted">{intent.description}</p>
+ </div>
+ </li>
+ </ul>
+ </section>
+ {!isInstance && visiblePlans.length > 0 && (
+ <>
+ <Separator />
+ <section aria-label="Current product plans" className="flex flex-col gap-4">
+ <h3 className="text-sm font-medium">Current Product Plans</h3>
+ <ProductPlanSummaryList plans={visiblePlans} />
+ </section>
+ </>
+ )}
+ <Alert variant="info">
+ <CircleAlert />
+ <AlertTitle>{billingTitle}</AlertTitle>
+ <AlertDescription>{billingDescription}</AlertDescription>
+ </Alert>
+ </UpgradeDialogLayout>
+ );
+};
+
+const PlatformCapabilityUpgradeGate = (props: Props) => {
+ const { permission } = useOrgPermission();
+ const { subscription } = useSubscription();
+ const canManageBilling = permission.can(
+ OrgPermissionBillingActions.ManageBilling,
+ OrgPermissionSubjects.Billing
+ );
+ const canReadBilling = permission.can(
+ OrgPermissionBillingActions.Read,
+ OrgPermissionSubjects.Billing
+ );
+ return (
+ <CapabilityUpgradeDialog
+ {...props}
+ canManageBilling={canManageBilling}
+ canReadBilling={canReadBilling}
+ productPlans={getProductPlanSummaries(subscription.productPlans)}
+ />
+ );
+};
+
+export const CapabilityUpgradeGate = ({ isOpen, intent, ...props }: Props) => {
+ if (!isOpen) return null;
+
+ return intent.scope === "instance" ? (
+ <CapabilityUpgradeDialog {...props} isOpen={isOpen} intent={intent} />
+ ) : (
+ <PlatformCapabilityUpgradeGate {...props} isOpen={isOpen} intent={intent} />
+ );
+};
diff --git a/frontend/src/components/license/UpgradeGate/ProductUpgradeDialog.tsx b/frontend/src/components/license/UpgradeGate/ProductUpgradeDialog.tsx
new file mode 100644
index 0000000000..9f4de0a0e6
--- /dev/null
+++ b/frontend/src/components/license/UpgradeGate/ProductUpgradeDialog.tsx
@@ -0,0 +1,116 @@
+import { ReactNode } from "react";
+import { Check, Infinity as InfinityIcon, Plus } from "lucide-react";
+
+import { Tabs, TabsContent, TabsList, TabsTrigger } from "@app/components/v3";
+import { BillingV2CatalogProduct, BillingV2Plan } from "@app/hooks/api";
+import { ProductIcon } from "@app/pages/organization/BillingV2Page/components/shared";
+
+import { UpgradeDialogLayout } from "./UpgradeDialogLayout";
+
+export { focusUpgradeContinuation } from "./UpgradeDialogLayout";
+
+export type PlanFeature = {
+ label: string;
+ value?: string;
+ description?: string;
+};
+
+type Props = {
+ product: BillingV2CatalogProduct;
+ upgradeLabel?: string;
+ requiredPlanName?: string;
+ plans: BillingV2Plan[];
+ selectedTier: string;
+ currentPlanTier?: string;
+ onTierChange: (tier: string) => void;
+ onOpenChange: (isOpen: boolean) => void;
+ features: PlanFeature[];
+ notice?: ReactNode;
+ billingDetails?: ReactNode;
+ footer: ReactNode;
+};
+
+const formatPlanFeatureTitle = ({ label, value }: PlanFeature) => {
+ if (!value) return label;
+
+ const dayValue = value.match(/^(\d+)\s+days?$/i);
+ if (dayValue) {
+ return `${dayValue[1]}-Day ${label}`;
+ }
+
+ return `${value} ${label}`;
+};
+
+const PlanFeatureIcon = ({ value }: { value?: string }) => {
+ const className = "mt-0.5 size-4 shrink-0 text-success";
+ if (value?.trim().toLowerCase() === "unlimited") {
+ return <InfinityIcon aria-hidden="true" className={className} />;
+ }
+ if (value) return <Plus aria-hidden="true" className={className} />;
+ return <Check aria-hidden="true" className={className} />;
+};
+
+export const ProductUpgradeDialog = ({
+ product,
+ upgradeLabel,
+ requiredPlanName,
+ plans,
+ selectedTier,
+ currentPlanTier,
+ onTierChange,
+ onOpenChange,
+ features,
+ notice,
+ billingDetails,
+ footer
+}: Props) => (
+ <UpgradeDialogLayout
+ scopeName={product.name}
+ icon={<ProductIcon product={product} size={64} />}
+ title={upgradeLabel}
+ description={
+ requiredPlanName
+ ? `Available with the ${requiredPlanName} plan and higher.`
+ : "Review available plans for your team."
+ }
+ color={product.color}
+ onOpenChange={onOpenChange}
+ footer={footer}
+ >
+ <Tabs value={selectedTier} onValueChange={onTierChange} className="gap-6">
+ <TabsList className="w-full" aria-label={`${product.name} plans`}>
+ {plans.map((candidate) => (
+ <TabsTrigger key={candidate.tier} value={candidate.tier} className="items-center">
+ {candidate.name}
+ {candidate.tier === currentPlanTier && <span className="text-muted">· Current</span>}
+ </TabsTrigger>
+ ))}
+ </TabsList>
+ <TabsContent value={selectedTier} className="mt-0 outline-none focus-visible:ring-0">
+ <section aria-label="Selected plan features" className="flex flex-col gap-6">
+ {notice}
+ {features.length > 0 && (
+ <ul className="grid gap-4">
+ {features.map((feature) => (
+ <li key={feature.label} className="flex min-w-0 items-start gap-3">
+ <PlanFeatureIcon value={feature.value} />
+ <div className="min-w-0">
+ <p className="text-sm font-medium text-foreground">
+ {formatPlanFeatureTitle(feature)}
+ </p>
+ {feature.description && (
+ <p className="mt-0.5 text-xs leading-relaxed text-muted">
+ {feature.description}
+ </p>
+ )}
+ </div>
+ </li>
+ ))}
+ </ul>
+ )}
+ {billingDetails}
+ </section>
+ </TabsContent>
+ </Tabs>
+ </UpgradeDialogLayout>
+);
diff --git a/frontend/src/components/license/UpgradeGate/ProductUpgradeSuccessDialog.tsx b/frontend/src/components/license/UpgradeGate/ProductUpgradeSuccessDialog.tsx
new file mode 100644
index 0000000000..7aa98beb58
--- /dev/null
+++ b/frontend/src/components/license/UpgradeGate/ProductUpgradeSuccessDialog.tsx
@@ -0,0 +1,72 @@
+import { CSSProperties } from "react";
+import { CircleCheck } from "lucide-react";
+
+import {
+ Button,
+ Dialog,
+ DialogBody,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle
+} from "@app/components/v3";
+import { BillingV2CatalogProduct, BillingV2Plan } from "@app/hooks/api";
+import { ProductIcon } from "@app/pages/organization/BillingV2Page/components/shared";
+
+import { focusUpgradeContinuation } from "./UpgradeDialogLayout";
+
+type Props = {
+ product: BillingV2CatalogProduct;
+ plan: BillingV2Plan;
+ isTrialing: boolean;
+ trialEndsAt?: string | null;
+ onOpenChange: (isOpen: boolean) => void;
+};
+
+export const ProductUpgradeSuccessDialog = ({
+ product,
+ plan,
+ isTrialing,
+ trialEndsAt,
+ onOpenChange
+}: Props) => (
+ <Dialog open onOpenChange={onOpenChange}>
+ <DialogContent
+ height="auto"
+ showCloseButton={false}
+ onOpenAutoFocus={focusUpgradeContinuation}
+ overlayClassName="z-[70]"
+ className="z-[70] max-w-sm gap-5"
+ >
+ <DialogBody role="status" className="flex flex-col items-center gap-4 text-center">
+ <div aria-hidden="true" className="relative shrink-0">
+ <ProductIcon product={product} size={48} />
+ <CircleCheck className="absolute -right-1 -bottom-1 size-5 rounded-full bg-popover text-success" />
+ </div>
+ <DialogHeader className="w-full items-center gap-2 text-center">
+ <DialogTitle className="leading-snug">
+ {product.name} {plan.name}
+ {!isTrialing && " Plan Activated"}
+ </DialogTitle>
+ <DialogDescription className={isTrialing && trialEndsAt ? undefined : "sr-only"}>
+ {isTrialing && trialEndsAt
+ ? `Trial ends ${trialEndsAt}.`
+ : `Your ${isTrialing ? "trial" : "plan"} is active.`}
+ </DialogDescription>
+ </DialogHeader>
+ </DialogBody>
+ <DialogFooter className="gap-4">
+ <Button
+ data-upgrade-cta
+ variant="product"
+ className="w-full justify-center"
+ style={{ "--product-color": product.color } as CSSProperties}
+ onClick={() => onOpenChange(false)}
+ >
+ Continue
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+);
diff --git a/frontend/src/components/license/UpgradeGate/UpgradeDialogLayout.tsx b/frontend/src/components/license/UpgradeGate/UpgradeDialogLayout.tsx
new file mode 100644
index 0000000000..b0b2a01251
--- /dev/null
+++ b/frontend/src/components/license/UpgradeGate/UpgradeDialogLayout.tsx
@@ -0,0 +1,94 @@
+import { CSSProperties, ReactNode } from "react";
+
+import { AuthPageBackground } from "@app/components/auth/AuthPageBackground";
+import {
+ Dialog,
+ DialogBody,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle
+} from "@app/components/v3";
+
+type Props = {
+ scopeName: string;
+ icon: ReactNode;
+ title?: string;
+ description: string;
+ color?: string;
+ onOpenChange: (isOpen: boolean) => void;
+ onOpenAutoFocus?: (event: Event) => void;
+ onCloseAutoFocus?: (event: Event) => void;
+ children: ReactNode;
+ footer: ReactNode;
+};
+
+export const focusUpgradeContinuation = (event: Event) => {
+ const action = (event.currentTarget as HTMLElement | null)?.querySelector<HTMLButtonElement>(
+ "button[data-upgrade-cta]:not(:disabled)"
+ );
+ if (!action) return;
+
+ event.preventDefault();
+ action.focus({ preventScroll: true });
+};
+
+export const UpgradeDialogLayout = ({
+ scopeName,
+ icon,
+ title,
+ description,
+ color,
+ onOpenChange,
+ onOpenAutoFocus,
+ onCloseAutoFocus,
+ children,
+ footer
+}: Props) => (
+ <Dialog open onOpenChange={onOpenChange}>
+ <DialogContent
+ onOpenAutoFocus={(event) => {
+ onOpenAutoFocus?.(event);
+ if (!event.defaultPrevented) focusUpgradeContinuation(event);
+ }}
+ onCloseAutoFocus={onCloseAutoFocus}
+ showCloseButton={false}
+ height="fixed"
+ overlayClassName="z-[70]"
+ className="@container z-[70] gap-0 overflow-hidden bg-container p-0 sm:max-w-4xl"
+ >
+ <div className="grid h-full min-h-0 grid-rows-[auto_minmax(0,1fr)] @min-[48rem]:grid-cols-[minmax(16rem,0.9fr)_minmax(0,1.25fr)] @min-[48rem]:grid-rows-1">
+ <aside
+ className="product-color relative flex min-h-40 flex-col overflow-hidden bg-container @min-[48rem]:min-h-0"
+ style={color ? ({ "--product-color": color } as CSSProperties) : undefined}
+ >
+ <AuthPageBackground className="text-foreground [&>svg]:-left-[22rem] [&>svg]:size-[40rem] xl:[&>svg]:-left-[22rem] xl:[&>svg]:size-[40rem]" />
+ <div className="relative z-10 flex flex-1 flex-col items-center justify-center px-8 py-6 text-center @min-[48rem]:py-12">
+ <div aria-hidden="true">{icon}</div>
+ <DialogHeader className="mt-6 items-center text-center">
+ <p
+ className={`${color ? "text-(--product-color-resolved)" : "text-muted"} text-xs font-medium tracking-wide uppercase`}
+ >
+ {scopeName}
+ </p>
+ <DialogTitle className={title ? "max-w-xs text-2xl leading-tight" : "sr-only"}>
+ {title ?? `Upgrade ${scopeName}`}
+ </DialogTitle>
+ <DialogDescription className="max-w-xs leading-relaxed">
+ {description}
+ </DialogDescription>
+ </DialogHeader>
+ </div>
+ </aside>
+
+ <div className="m-2 mt-0 flex min-h-0 min-w-0 flex-col overflow-hidden">
+ <DialogBody className="flex flex-col gap-6 p-6">{children}</DialogBody>
+ <DialogFooter className="mx-0 mt-0 flex-col items-stretch gap-4 rounded-md border border-border bg-card">
+ {footer}
+ </DialogFooter>
+ </div>
+ </div>
+ </DialogContent>
+ </Dialog>
+);
diff --git a/frontend/src/components/license/UpgradeGate/UpgradeGate.tsx b/frontend/src/components/license/UpgradeGate/UpgradeGate.tsx
new file mode 100644
index 0000000000..0794051df5
--- /dev/null
+++ b/frontend/src/components/license/UpgradeGate/UpgradeGate.tsx
@@ -0,0 +1,1032 @@
+import { CSSProperties, ReactNode, useCallback, useEffect, useRef, useState } from "react";
+import { useQueryClient } from "@tanstack/react-query";
+import { useRouterState } from "@tanstack/react-router";
+import { CircleAlert, ExternalLink } from "lucide-react";
+
+import { createNotification } from "@app/components/notifications";
+import {
+ Alert,
+ AlertDescription,
+ AlertTitle,
+ Badge,
+ Button,
+ Checkbox,
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+ Label,
+ Loader,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
+import {
+ OrgPermissionBillingActions,
+ OrgPermissionSubjects,
+ useOrganization,
+ useOrgPermission
+} from "@app/context";
+import { isInfisicalCloud } from "@app/helpers/platform";
+import {
+ BillingV2Cadence,
+ BillingV2CatalogProduct,
+ BillingV2Plan,
+ useGetBillingV2Catalog,
+ useGetBillingV2Overview,
+ useStartBillingV2Trial
+} from "@app/hooks/api";
+import { fetchOrgSubscription, subscriptionQueryKeys } from "@app/hooks/api/subscriptions/queries";
+import { analytics, AnalyticsEvent } from "@app/lib/analytics";
+import { ProductIcon } from "@app/pages/organization/BillingV2Page/components/shared";
+
+import { CapabilityUpgradeIntent } from "./capability-upgrade-intents";
+import { CapabilityUpgradeGate } from "./CapabilityUpgradeGate";
+import {
+ focusUpgradeContinuation,
+ PlanFeature,
+ ProductUpgradeDialog
+} from "./ProductUpgradeDialog";
+import { ProductUpgradeSuccessDialog } from "./ProductUpgradeSuccessDialog";
+import {
+ BillingPlan,
+ buildUpgradeReturnPath,
+ UpgradeFeature,
+ UpgradeIntent
+} from "./upgrade-intents";
+
+const CONTACT_SALES_URL = "https://infisical.com/talk-to-us";
+
+type Props = {
+ intent: UpgradeIntent;
+ paywallKey: string;
+ isOpen: boolean;
+ onOpenChange: (isOpen: boolean) => void;
+};
+
+type CapabilityProps = Omit<Props, "intent"> & {
+ intent: CapabilityUpgradeIntent;
+ onOpenAutoFocus?: (event: Event) => void;
+ onCloseAutoFocus?: (event: Event) => void;
+};
+
+type PlanPrice = {
+ amount: number;
+ unit: string;
+ compactUnit: string;
+ isMonthlyEquivalent: boolean;
+};
+
+const PLAN_FEATURE_DESCRIPTIONS: Record<string, string> = {
+ environments: "Organize secrets across development stages and deployment targets.",
+ integrations: "Connect Infisical with infrastructure, cloud, and developer tools.",
+ "audit log retention": "Keep organization activity history available for longer.",
+ "honey tokens": "Detect unauthorized access with decoy secrets.",
+ "secret versioning": "Track and restore previous versions of secrets.",
+ "point-in-time recovery": "Restore secrets to an earlier state after unwanted changes.",
+ rbac: "Control access with custom roles and granular permissions.",
+ "dynamic secrets": "Issue short-lived credentials on demand.",
+ "temporary access": "Grant time-bound access without permanent permissions.",
+ gateways: "Connect Infisical securely to private infrastructure.",
+ "sso/mfa enforcement": "Require centralized sign-in and stronger authentication.",
+ scim: "Provision and deprovision users from your identity provider.",
+ kmip: "Manage cryptographic keys through KMIP-compatible systems.",
+ "audit log streaming": "Send audit activity to external monitoring systems.",
+ "sub-organizations": "Separate teams or environments under one organization.",
+ "certificate authorities": "Connect or operate certificate authorities from one control plane.",
+ "internal certificate authorities":
+ "Operate Infisical-managed root and intermediate authorities.",
+ certificates: "Issue, renew, and centrally manage certificates.",
+ "wildcard certificates": "Issue certificates that secure multiple subdomains.",
+ "subject alternative names": "Secure additional hostnames and identities on one certificate.",
+ "certificate enrollment": "Enroll workloads and devices through standard certificate protocols.",
+ "certificate syncs": "Deliver certificates automatically to infrastructure and cloud providers.",
+ "certificate discovery": "Find and inventory certificates across your infrastructure.",
+ "code signing": "Protect software releases with centrally managed signing keys.",
+ "approval policies": "Require review before sensitive certificate operations proceed.",
+ "post-quantum cryptography": "Issue certificates with post-quantum key algorithms.",
+ "pam accounts": "Manage privileged accounts and their credentials centrally.",
+ "enterprise pam accounts":
+ "Connect enterprise account types such as Windows and Active Directory.",
+ "slack notifications": "Notify teams when privileged access is requested or changed."
+};
+
+const PAM_FEATURE_DESCRIPTIONS: Record<string, string> = {
+ "privileged accounts": "Manage privileged accounts and their credentials centrally.",
+ "access requests": "Request access to privileged accounts before starting a session.",
+ "approval workflows": "Require approval before privileged access is granted.",
+ "cli-based resource access": "Connect to privileged resources from the Infisical CLI.",
+ "ssh certificate authentication": "Authenticate SSH sessions with short-lived certificates.",
+ "privileged credential rotation":
+ "Rotate privileged credentials without distributing them to users.",
+ "command blocking": "Block restricted commands during privileged sessions.",
+ "automated privileged account discovery": "Find privileged accounts across your infrastructure.",
+ "enterprise resources (windows, rdp)":
+ "Connect to Windows servers and other enterprise resources.",
+ "audit logs": "Track privileged access requests and session activity.",
+ "session recording": "Record privileged sessions for review and investigation.",
+ "session-log masking": "Mask sensitive information in session logs.",
+ "log & session recording retention":
+ "Keep audit logs and session recordings available for review.",
+ "siem audit-log streaming": "Send audit activity to your security monitoring systems.",
+ ldap: "Connect your directory for centralized identity management."
+};
+
+const getPlanFeatureDescription = (label: string, productKey: string) => {
+ const key = label.trim().toLowerCase();
+ return (
+ (productKey === "pam" ? PAM_FEATURE_DESCRIPTIONS[key] : undefined) ??
+ PLAN_FEATURE_DESCRIPTIONS[key]
+ );
+};
+
+const planSupportsCadence = (plan: BillingV2Plan, cadence: BillingV2Cadence) => {
+ const basePrice = plan.base?.[cadence] ?? 0;
+ return basePrice > 0 || plan.dims.some((dimension) => dimension[cadence] > 0);
+};
+
+const getPlanPrice = (plan: BillingV2Plan, cadence: BillingV2Cadence): PlanPrice => {
+ const basePrice = plan.base?.[cadence] ?? 0;
+ if (basePrice > 0) {
+ return {
+ amount: cadence === "annual" ? basePrice / 12 : basePrice,
+ unit: "/ month",
+ compactUnit: "/mo",
+ isMonthlyEquivalent: true
+ };
+ }
+
+ const dimension = plan.dims.find((candidate) => candidate[cadence] > 0);
+ if (!dimension) {
+ return { amount: 0, unit: "", compactUnit: "", isMonthlyEquivalent: false };
+ }
+
+ const isMetered =
+ cadence === "annual" ? dimension.meteredAnnual === true : dimension.meteredMonthly === true;
+ const isMonthlyEquivalent = cadence === "monthly" || !isMetered;
+ const period = isMonthlyEquivalent ? "month" : "year";
+ const noun = dimension.key === "pam_identities" ? "PAM identity" : dimension.noun;
+
+ return {
+ amount: cadence === "annual" && !isMetered ? dimension.annual / 12 : dimension[cadence],
+ unit: `/ ${noun} / ${period}`,
+ compactUnit: `/${noun}/${period === "month" ? "mo" : "yr"}`,
+ isMonthlyEquivalent
+ };
+};
+
+const annualSavingsPercent = (plan: BillingV2Plan) => {
+ const monthly = getPlanPrice(plan, "monthly");
+ const annual = getPlanPrice(plan, "annual");
+ if (
+ monthly.amount <= 0 ||
+ annual.amount <= 0 ||
+ !monthly.isMonthlyEquivalent ||
+ !annual.isMonthlyEquivalent
+ ) {
+ return 0;
+ }
+
+ return Math.max(Math.round((1 - annual.amount / monthly.amount) * 100), 0);
+};
+
+const getEffectiveCadence = (plan: BillingV2Plan, cadence: BillingV2Cadence): BillingV2Cadence => {
+ if (planSupportsCadence(plan, cadence)) {
+ return cadence;
+ }
+ if (planSupportsCadence(plan, "annual")) {
+ return "annual";
+ }
+ return "monthly";
+};
+
+const getPlanFeatures = (product: BillingV2CatalogProduct, plan: BillingV2Plan): PlanFeature[] => {
+ const comparedFeatures = (product.compare ?? []).flatMap<PlanFeature>((row) => {
+ const value = row.cells[plan.tier];
+ if (value === false || value === undefined || value === 0) {
+ return [];
+ }
+ if (value === true) {
+ return [{ label: row.label, description: getPlanFeatureDescription(row.label, product.id) }];
+ }
+ return [
+ {
+ label: row.label,
+ value: typeof value === "number" ? value.toLocaleString("en-US") : String(value),
+ description: getPlanFeatureDescription(row.label, product.id)
+ }
+ ];
+ });
+
+ if (comparedFeatures.length > 0) {
+ return comparedFeatures;
+ }
+
+ return (product.includes ?? []).map((label) => ({
+ label,
+ description: getPlanFeatureDescription(label, product.id)
+ }));
+};
+
+const formatProductName = (productKey: string) =>
+ productKey
+ .split("_")
+ .map((word) => `${word.charAt(0).toUpperCase()}${word.slice(1)}`)
+ .join(" ");
+
+type ProductUpgradeHeaderProps = {
+ product?: BillingV2CatalogProduct;
+ productName: string;
+ description: string;
+};
+
+const ProductUpgradeHeader = ({ product, productName, description }: ProductUpgradeHeaderProps) => (
+ <DialogHeader className="flex-row items-start gap-3 pr-6">
+ {product && (
+ <div aria-hidden="true">
+ <ProductIcon product={product} size={36} />
+ </div>
+ )}
+ <div className="flex min-w-0 flex-1 flex-col gap-2">
+ <DialogTitle>Upgrade {productName}</DialogTitle>
+ <DialogDescription>{description}</DialogDescription>
+ </div>
+ </DialogHeader>
+);
+
+const ProductUpgradeGate = ({ intent, paywallKey, isOpen, onOpenChange }: Props) => {
+ const [selectedTier, setSelectedTier] = useState<string>();
+ const [cadence, setCadence] = useState<BillingV2Cadence>("annual");
+ const [startedTrial, setStartedTrial] = useState<BillingV2Plan | null>(null);
+ const refreshedReturn = useRef<string>();
+ const hasTrackedView = useRef(false);
+ const queryClient = useQueryClient();
+ const { currentOrg, isSubOrganization } = useOrganization();
+ const { permission } = useOrgPermission();
+ const billingOrgId = currentOrg.rootOrgId ?? currentOrg.id;
+ const canReadBilling = permission.can(
+ OrgPermissionBillingActions.Read,
+ OrgPermissionSubjects.Billing
+ );
+ const canManageBilling = permission.can(
+ OrgPermissionBillingActions.ManageBilling,
+ OrgPermissionSubjects.Billing
+ );
+ const canLoadBilling = isOpen && canReadBilling && !isSubOrganization;
+ const returnSearch = new URLSearchParams(window.location.search);
+ const returnedFromBilling =
+ returnSearch.get("card") === "setup_success" || returnSearch.get("checkout") === "success";
+ const overview = useGetBillingV2Overview(billingOrgId, {
+ enabled: canLoadBilling,
+ ...(returnedFromBilling ? { staleTime: 0 } : {})
+ });
+ const catalog = useGetBillingV2Catalog(billingOrgId, { enabled: canLoadBilling });
+ const startTrial = useStartBillingV2Trial();
+ const product = catalog.data?.find((candidate) => candidate.id === intent.productKey);
+ const productName = product?.name ?? formatProductName(intent.productKey);
+ const checkingBillingReturn =
+ returnedFromBilling &&
+ ((overview.isFetching && !overview.isFetchedAfterMount) ||
+ (catalog.isFetching && !catalog.isFetchedAfterMount));
+ const paidPlans = [...(product?.plans ?? [])]
+ .filter((candidate) => !candidate.deprecated)
+ .sort((left, right) => (left.displayOrder ?? 0) - (right.displayOrder ?? 0));
+ const entitlement = overview.data?.entitlements[intent.productKey];
+ const hasActiveTrial = Boolean(entitlement?.isTrialing || entitlement?.trialPlan);
+ const activeTier =
+ entitlement?.trialPlan ?? entitlement?.planTier ?? (entitlement?.entitled ? undefined : "free");
+ const activePlanIndex = paidPlans.findIndex((candidate) => candidate.tier === activeTier);
+ const honeyTokenQuota =
+ intent.featureKey === UpgradeFeature.HoneyTokens ? intent.quota : undefined;
+ const honeyTokenComparison = product?.compare?.find(
+ (row) => row.label.trim().toLowerCase() === "honey tokens"
+ );
+ const higherQuotaPlans = honeyTokenQuota
+ ? paidPlans.filter((candidate, index) => {
+ if (activePlanIndex < 0 && activeTier !== "free") return false;
+ if (index <= activePlanIndex) return false;
+ if (!candidate.upgradeable && !candidate.trialable && !candidate.salesLed) return false;
+ const allowance = honeyTokenComparison?.cells[candidate.tier];
+ if (typeof allowance === "string" && allowance.trim().toLowerCase() === "unlimited") {
+ return true;
+ }
+ const formattedAllowance =
+ typeof allowance === "string"
+ ? allowance.trim().match(/^(?:up to\s+)?(\d+|\d{1,3}(?:,\d{3})+)$/i)
+ : undefined;
+ const numericAllowance =
+ typeof allowance === "number"
+ ? allowance
+ : Number(formattedAllowance?.[1].replaceAll(",", "") ?? NaN);
+ return numericAllowance > Math.max(honeyTokenQuota.used, honeyTokenQuota.limit);
+ })
+ : [];
+ const requiredTier = honeyTokenQuota ? higherQuotaPlans[0]?.tier : intent.planKey;
+ const targetPlanIndex = paidPlans.findIndex((candidate) => candidate.tier === requiredTier);
+ const returnedPlan =
+ canLoadBilling &&
+ returnedFromBilling &&
+ (returnSearch.get("checkout") === "success" || hasActiveTrial) &&
+ !checkingBillingReturn &&
+ !overview.isError &&
+ !catalog.isError &&
+ !overview.isPlaceholderData &&
+ !catalog.isPlaceholderData &&
+ entitlement?.entitled &&
+ (entitlement.status === "active" || entitlement.status === "trialing") &&
+ targetPlanIndex >= 0 &&
+ activePlanIndex >= targetPlanIndex
+ ? paidPlans[activePlanIndex]
+ : undefined;
+ const returnedTier = returnedPlan?.tier;
+
+ useEffect(() => {
+ if (!returnedTier) return;
+ const returnKey = `${currentOrg.id}:${returnedTier}`;
+ if (refreshedReturn.current === returnKey) return;
+ refreshedReturn.current = returnKey;
+
+ // Sync the legacy product gate once after confirmed activation; do not poll or reopen actions.
+ queryClient
+ .fetchQuery({
+ queryKey: subscriptionQueryKeys.getOrgSubsription(currentOrg.id),
+ queryFn: () => fetchOrgSubscription(currentOrg.id, true),
+ staleTime: 0,
+ retry: false
+ })
+ .catch(() => undefined);
+ }, [currentOrg.id, queryClient, returnedTier]);
+ const route = useRouterState({
+ select: (state) => state.matches.at(-1)?.routeId ?? "unknown"
+ });
+
+ const trackPaywallView = useCallback(() => {
+ analytics.captureForOrganization(AnalyticsEvent.PaywallViewed, currentOrg.id, {
+ paywallKey,
+ paywallText: intent.description,
+ route,
+ isEnterpriseFeature: (requiredTier ?? intent.planKey) === BillingPlan.Enterprise
+ });
+ }, [currentOrg.id, paywallKey, intent.description, intent.planKey, route, requiredTier]);
+
+ useEffect(() => {
+ if (!isOpen) {
+ hasTrackedView.current = false;
+ return;
+ }
+ if (
+ hasTrackedView.current ||
+ (honeyTokenQuota && canLoadBilling && (overview.isPending || catalog.isPending))
+ ) {
+ return;
+ }
+ hasTrackedView.current = true;
+ trackPaywallView();
+ }, [
+ isOpen,
+ honeyTokenQuota,
+ canLoadBilling,
+ overview.isPending,
+ catalog.isPending,
+ trackPaywallView
+ ]);
+
+ const trackUpgradeClick = () => {
+ analytics.captureForOrganization(AnalyticsEvent.PaywallUpgradeClicked, currentOrg.id, {
+ paywallKey,
+ paywallText: intent.description,
+ route,
+ isEnterpriseFeature: (requiredTier ?? intent.planKey) === BillingPlan.Enterprise
+ });
+ };
+
+ useEffect(() => {
+ if (!isOpen) {
+ setSelectedTier(undefined);
+ setCadence("annual");
+ setStartedTrial(null);
+ }
+ }, [intent.planKey, isOpen]);
+
+ if (!isOpen) {
+ return null;
+ }
+
+ const returnPath = buildUpgradeReturnPath(window.location);
+ const openRootBilling = () => {
+ trackUpgradeClick();
+ const search = new URLSearchParams({
+ upgradeProduct: intent.productKey,
+ upgradeReturnPath: returnPath
+ });
+ window.location.assign(`/organizations/${billingOrgId}/billing?${search.toString()}`);
+ };
+
+ if (isSubOrganization && canReadBilling) {
+ return (
+ <Dialog open onOpenChange={onOpenChange}>
+ <DialogContent
+ overlayClassName="z-[70]"
+ onOpenAutoFocus={focusUpgradeContinuation}
+ showCloseButton={false}
+ className="z-[70] sm:max-w-xl"
+ >
+ <ProductUpgradeHeader
+ product={product}
+ productName={productName}
+ description="Review product plans and manage access for your team."
+ />
+ <Alert variant="info">
+ <CircleAlert />
+ <AlertTitle>Root Organization Billing</AlertTitle>
+ <AlertDescription>
+ Sub-organizations share the root organization&apos;s subscription. Continue to root
+ billing to start the trial or update the subscription.
+ </AlertDescription>
+ </Alert>
+ <DialogFooter>
+ <Button variant="outline" onClick={() => onOpenChange(false)}>
+ Close
+ </Button>
+ <Button data-upgrade-cta variant="org" onClick={openRootBilling}>
+ Continue to Root Billing
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ );
+ }
+
+ if (!canReadBilling) {
+ return (
+ <Dialog open onOpenChange={onOpenChange}>
+ <DialogContent
+ overlayClassName="z-[70]"
+ onOpenAutoFocus={focusUpgradeContinuation}
+ showCloseButton={false}
+ className="z-[70] sm:max-w-xl"
+ >
+ <ProductUpgradeHeader
+ product={product}
+ productName={productName}
+ description="Review product plans and manage access for your team."
+ />
+ <Alert variant="info">
+ <CircleAlert />
+ <AlertTitle>Billing Access Required</AlertTitle>
+ <AlertDescription>
+ Ask an organization member with billing access to review plans or update the
+ subscription.
+ </AlertDescription>
+ </Alert>
+ <DialogFooter>
+ <Button data-upgrade-cta variant="org" onClick={() => onOpenChange(false)}>
+ Close
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ );
+ }
+
+ const successPlan = startedTrial ?? returnedPlan;
+ if (product && successPlan) {
+ return (
+ <ProductUpgradeSuccessDialog
+ product={product}
+ plan={successPlan}
+ isTrialing={Boolean(startedTrial || hasActiveTrial)}
+ trialEndsAt={entitlement?.trialPlanEndsAt ?? entitlement?.trialEndsAt}
+ onOpenChange={(open) => {
+ if (!open && returnedFromBilling) {
+ window.history.replaceState(
+ window.history.state,
+ "",
+ buildUpgradeReturnPath(window.location)
+ );
+ }
+ onOpenChange(open);
+ }}
+ />
+ );
+ }
+
+ if (overview.isPending || catalog.isPending || checkingBillingReturn) {
+ return (
+ <Dialog
+ open
+ onOpenChange={(open) => {
+ if (!open && !hasTrackedView.current) {
+ hasTrackedView.current = true;
+ trackPaywallView();
+ }
+ onOpenChange(open);
+ }}
+ >
+ <DialogContent
+ overlayClassName="z-[70]"
+ key="loading"
+ showCloseButton={false}
+ className="z-[70] w-auto gap-0 border-0 bg-transparent p-0 shadow-none"
+ aria-describedby={undefined}
+ >
+ <DialogTitle className="sr-only">Loading {productName} plans</DialogTitle>
+ <Loader size="md" label={`Loading plan details for ${productName}`} />
+ </DialogContent>
+ </Dialog>
+ );
+ }
+
+ if (overview.isError || catalog.isError || !overview.data || !product) {
+ const isSelfHosted = overview.data ? !overview.data.isCloud : !isInfisicalCloud();
+ return (
+ <Dialog open onOpenChange={onOpenChange}>
+ <DialogContent
+ overlayClassName="z-[70]"
+ onOpenAutoFocus={(event) => {
+ const action = (event.currentTarget as HTMLElement | null)?.querySelector<HTMLElement>(
+ "[data-upgrade-cta]:not(:disabled)"
+ );
+ if (!action) return;
+ event.preventDefault();
+ action.focus({ preventScroll: true });
+ }}
+ showCloseButton={false}
+ className="z-[70] sm:max-w-xl"
+ >
+ <ProductUpgradeHeader
+ product={product}
+ productName={productName}
+ description="Review product plans and manage access for your team."
+ />
+ <Alert variant="danger">
+ <CircleAlert />
+ <AlertTitle>Plan Details Unavailable</AlertTitle>
+ <AlertDescription>
+ Plan details could not be loaded.{" "}
+ {isSelfHosted
+ ? "Try again, or contact our team for a self-hosted or offline license."
+ : "Try again, or contact Infisical if the problem continues."}
+ </AlertDescription>
+ </Alert>
+ <DialogFooter>
+ <Button
+ variant="outline"
+ className={isSelfHosted ? "mr-auto" : undefined}
+ onClick={() => onOpenChange(false)}
+ >
+ Close
+ </Button>
+ <Button
+ data-upgrade-cta={isSelfHosted ? undefined : true}
+ variant={isSelfHosted ? "ghost" : "org"}
+ onClick={() => {
+ overview.refetch();
+ catalog.refetch();
+ }}
+ >
+ {isSelfHosted ? "Retry" : "Try Again"}
+ </Button>
+ {isSelfHosted && (
+ <Button data-upgrade-cta variant="org" asChild>
+ <a
+ href={CONTACT_SALES_URL}
+ target="_blank"
+ rel="noopener noreferrer"
+ onClick={trackUpgradeClick}
+ >
+ Contact Sales
+ <ExternalLink />
+ </a>
+ </Button>
+ )}
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ );
+ }
+
+ if (returnedFromBilling) {
+ const dismissBillingReturn = (open: boolean) => {
+ if (!open) {
+ window.history.replaceState(window.history.state, "", returnPath);
+ }
+ onOpenChange(open);
+ };
+
+ return (
+ <Dialog open onOpenChange={dismissBillingReturn}>
+ <DialogContent
+ overlayClassName="z-[70]"
+ onOpenAutoFocus={focusUpgradeContinuation}
+ showCloseButton={false}
+ className="z-[70] sm:max-w-xl"
+ >
+ <DialogHeader>
+ <DialogTitle>Check Billing Status</DialogTitle>
+ <DialogDescription>
+ Your billing return has not confirmed access to {productName} yet. Refresh to check
+ again, or close this dialog and return later.
+ </DialogDescription>
+ </DialogHeader>
+ <DialogFooter>
+ <Button variant="outline" onClick={() => dismissBillingReturn(false)}>
+ Close
+ </Button>
+ <Button
+ data-upgrade-cta
+ variant="org"
+ isPending={overview.isFetching || catalog.isFetching}
+ isDisabled={overview.isFetching || catalog.isFetching}
+ onClick={() => {
+ overview.refetch();
+ catalog.refetch();
+ }}
+ >
+ Refresh Status
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ );
+ }
+
+ const currentEntitlement = overview.data.entitlements[product.id];
+ const currentPlanTier =
+ currentEntitlement?.planTier ?? (currentEntitlement?.entitled === true ? undefined : "free");
+ const baselinePlan =
+ currentPlanTier === "free" && !product.baselinePlan?.deprecated
+ ? product.baselinePlan
+ : undefined;
+ const plans = baselinePlan ? [baselinePlan, ...paidPlans] : paidPlans;
+ const requiredPlan = plans.find((candidate) => candidate.tier === requiredTier);
+ const plan =
+ plans.find((candidate) => candidate.tier === selectedTier) ?? requiredPlan ?? plans[0];
+ if (!plan || (honeyTokenQuota && !requiredPlan)) {
+ return (
+ <Dialog open onOpenChange={onOpenChange}>
+ <DialogContent
+ overlayClassName="z-[70]"
+ onOpenAutoFocus={focusUpgradeContinuation}
+ showCloseButton={false}
+ className="z-[70] sm:max-w-xl"
+ >
+ <ProductUpgradeHeader
+ product={product}
+ productName={productName}
+ description="Review product plans and manage access for your team."
+ />
+ <Alert variant={honeyTokenQuota ? "info" : "danger"}>
+ <CircleAlert />
+ <AlertTitle>{honeyTokenQuota ? "Plan Limit Reached" : "Plan Unavailable"}</AlertTitle>
+ <AlertDescription>
+ {honeyTokenQuota
+ ? `${intent.quotaNotice} Contact our team to discuss a higher honey token allowance.`
+ : "This plan is not available for your organization."}
+ </AlertDescription>
+ </Alert>
+ <DialogFooter>
+ <Button variant="outline" onClick={() => onOpenChange(false)}>
+ Close
+ </Button>
+ <Button
+ data-upgrade-cta
+ variant="org"
+ onClick={
+ honeyTokenQuota
+ ? () => {
+ trackUpgradeClick();
+ window.open(CONTACT_SALES_URL, "_blank", "noopener,noreferrer");
+ }
+ : openRootBilling
+ }
+ >
+ {honeyTokenQuota ? "Contact Sales" : "View Billing Options"}
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ );
+ }
+
+ const requiredPlanIndex = plans.findIndex((candidate) => candidate.tier === requiredTier);
+ const planMeetsRequirement =
+ Boolean(requiredPlan) &&
+ plans.indexOf(plan) >= requiredPlanIndex &&
+ (!honeyTokenQuota || higherQuotaPlans.includes(plan));
+ const selfServe = overview.data.mode !== "managed" && overview.data.selfServe;
+ const { checkoutFrozen } = overview.data;
+ const trialAvailable =
+ canManageBilling &&
+ !checkoutFrozen &&
+ planMeetsRequirement &&
+ selfServe &&
+ plan.selfServe &&
+ !plan.salesLed &&
+ !overview.data.trialedProductKeys.includes(product.id) &&
+ (!currentEntitlement?.entitled || plan.tier !== currentPlanTier) &&
+ plan.trialable;
+ const supportsAnnualCadence = plans.some((candidate) => planSupportsCadence(candidate, "annual"));
+ const supportsMonthlyCadence = plans.some((candidate) =>
+ planSupportsCadence(candidate, "monthly")
+ );
+ let visibleCadence = cadence;
+ if (
+ (cadence === "annual" && !supportsAnnualCadence) ||
+ (cadence === "monthly" && !supportsMonthlyCadence)
+ ) {
+ visibleCadence = supportsAnnualCadence ? "annual" : "monthly";
+ }
+ const effectiveCadence = trialAvailable ? "monthly" : getEffectiveCadence(plan, visibleCadence);
+ const comparePrice = getPlanPrice(plan, effectiveCadence);
+ const formattedPrice = `$${comparePrice.amount.toLocaleString("en-US", {
+ minimumFractionDigits: 2,
+ maximumFractionDigits: comparePrice.amount > 0 && comparePrice.amount < 0.01 ? 6 : 2
+ })}`;
+ const features = getPlanFeatures(product, plan);
+ const savingsPercent = Math.max(...plans.map(annualSavingsPercent));
+ const isUpgradeTrial =
+ Boolean(currentEntitlement?.entitled && currentEntitlement.planTier) &&
+ currentEntitlement?.planTier !== "free" &&
+ currentEntitlement?.planTier !== plan.tier;
+ const currentPlanName =
+ plans.find((candidate) => candidate.tier === currentEntitlement?.planTier)?.name ??
+ currentEntitlement?.planTier;
+ const trialDurationLabel = plan.trialDays === 14 ? "2-Week" : `${plan.trialDays}-Day`;
+ let trialPriceLabel = "FREE during trial";
+ if (plan.trialDays === 14) trialPriceLabel = "FREE for 2 Weeks";
+ else if (plan.trialDays > 0) trialPriceLabel = `FREE for ${plan.trialDays} Days`;
+ if (isUpgradeTrial) trialPriceLabel = `Trial Upgrade: ${trialPriceLabel}`;
+ const upgradeLabel = intent.upgradeLabel ?? `Unlock ${product.name}`;
+ const productStyle = { "--product-color": product.color } as CSSProperties;
+
+ const handleStartTrial = async () => {
+ trackUpgradeClick();
+ try {
+ const result = await startTrial.mutateAsync({
+ orgId: billingOrgId,
+ productId: product.id,
+ plan: plan.tier,
+ returnPath
+ });
+
+ if (result.outcome === "awaiting_card") {
+ if (result.cardSetupUrl) {
+ window.location.assign(result.cardSetupUrl);
+ return;
+ }
+ createNotification({
+ type: "error",
+ text: "Failed to open secure card setup. Please try again."
+ });
+ return;
+ }
+
+ setStartedTrial(plan);
+ } catch {
+ // The trial mutation reports errors through the shared notification handler.
+ }
+ };
+
+ let productUpgradeAction = (
+ <Button
+ data-upgrade-cta
+ variant="product"
+ className="w-full justify-center"
+ style={productStyle}
+ onClick={openRootBilling}
+ >
+ View Billing Options
+ </Button>
+ );
+ if (requiredPlan && !planMeetsRequirement) {
+ productUpgradeAction = (
+ <Button
+ data-upgrade-cta
+ variant="product"
+ className="w-full justify-center"
+ style={productStyle}
+ isDisabled
+ >
+ Select {requiredPlan?.name ?? intent.planKey} or higher
+ </Button>
+ );
+ } else if (requiredPlan && canManageBilling && (plan.salesLed || !selfServe)) {
+ productUpgradeAction = (
+ <Button
+ data-upgrade-cta
+ variant="product"
+ className="w-full justify-center"
+ style={productStyle}
+ onClick={() => {
+ trackUpgradeClick();
+ window.open(CONTACT_SALES_URL, "_blank", "noopener,noreferrer");
+ }}
+ >
+ Contact Sales
+ </Button>
+ );
+ } else if (requiredPlan && canManageBilling && checkoutFrozen) {
+ productUpgradeAction = (
+ <Button
+ data-upgrade-cta
+ variant="product"
+ className="w-full justify-center"
+ style={productStyle}
+ isDisabled
+ >
+ Billing Changes Paused
+ </Button>
+ );
+ } else if (trialAvailable) {
+ productUpgradeAction = (
+ <Button
+ data-upgrade-cta
+ variant="product"
+ className="w-full justify-center"
+ style={productStyle}
+ isPending={startTrial.isPending}
+ isDisabled={startTrial.isPending}
+ onClick={handleStartTrial}
+ >
+ Start Free {plan.name} Trial
+ </Button>
+ );
+ }
+
+ const hasUsedTrial = overview.data.trialedProductKeys.includes(product.id);
+ const hasPeriodOption =
+ !trialAvailable && planSupportsCadence(plan, "annual") && planSupportsCadence(plan, "monthly");
+ const showUsedTrialNotice =
+ selfServe &&
+ plan.selfServe &&
+ !plan.salesLed &&
+ planMeetsRequirement &&
+ !trialAvailable &&
+ hasUsedTrial &&
+ !currentEntitlement?.isTrialing;
+
+ const trialBillingTerms = isUpgradeTrial
+ ? `Your ${trialDurationLabel.toLowerCase()} trial upgrade is free. You'll keep paying for ${currentPlanName} during the trial. After it ends, you'll move to ${plan.name} and be charged the difference. End the trial before then to stay on ${currentPlanName}. The displayed monthly rate is a catalog reference, not your actual upgrade charge.`
+ : `Your ${trialDurationLabel.toLowerCase()} trial is free. A payment method is required. If you do not have one on file, secure card setup must finish before the trial starts. After the trial, billing continues monthly based on usage unless you cancel.`;
+
+ let notice: ReactNode;
+ if (!requiredPlan) {
+ notice = (
+ <Alert variant="info" appearance="borderless">
+ <CircleAlert />
+ <AlertTitle>Required Plan Unavailable</AlertTitle>
+ <AlertDescription>
+ This feature&apos;s required plan is unavailable. Review available options in billing.
+ </AlertDescription>
+ </Alert>
+ );
+ } else if (!canManageBilling) {
+ notice = (
+ <Alert variant="info" appearance="borderless">
+ <CircleAlert />
+ <AlertTitle>Billing Management Required</AlertTitle>
+ <AlertDescription>
+ You can compare plans. Ask a member with billing management permission to start a trial or
+ update the subscription.
+ </AlertDescription>
+ </Alert>
+ );
+ } else if (checkoutFrozen && selfServe && !plan.salesLed) {
+ notice = (
+ <Alert variant="warning" appearance="borderless">
+ <CircleAlert />
+ <AlertTitle>Plan Changes Temporarily Unavailable</AlertTitle>
+ <AlertDescription>
+ Purchases and plan changes are unavailable right now. Your current subscription is
+ unaffected; please check back shortly.
+ </AlertDescription>
+ </Alert>
+ );
+ } else if (!selfServe) {
+ notice = (
+ <Alert variant="info" appearance="borderless">
+ <CircleAlert />
+ <AlertTitle>Managed Subscription</AlertTitle>
+ <AlertDescription>
+ Contact your Infisical account manager to update this subscription.
+ </AlertDescription>
+ </Alert>
+ );
+ } else if (showUsedTrialNotice) {
+ notice = (
+ <Alert variant="info" appearance="borderless">
+ <CircleAlert />
+ <AlertTitle>Trial Already Used</AlertTitle>
+ <AlertDescription>Free trial for {product.name} has already been used.</AlertDescription>
+ </Alert>
+ );
+ }
+
+ return (
+ <ProductUpgradeDialog
+ product={product}
+ upgradeLabel={upgradeLabel}
+ requiredPlanName={requiredPlan?.name}
+ plans={plans}
+ selectedTier={plan.tier}
+ currentPlanTier={currentPlanTier}
+ onTierChange={setSelectedTier}
+ onOpenChange={onOpenChange}
+ features={features}
+ notice={
+ <>
+ {intent.quotaNotice && (
+ <Alert variant="info" appearance="borderless">
+ <CircleAlert />
+ <AlertTitle>Plan Limit Reached</AlertTitle>
+ <AlertDescription>{intent.quotaNotice}</AlertDescription>
+ </Alert>
+ )}
+ {notice}
+ </>
+ }
+ footer={
+ <>
+ {plan.tier === product.baselinePlan?.tier && (
+ <div className="flex items-center justify-center gap-3 px-1 text-sm">
+ <span className="text-muted">Current plan</span>
+ <span className="font-medium text-foreground">Free</span>
+ </div>
+ )}
+ {!plan.salesLed &&
+ plan.tier !== product.baselinePlan?.tier &&
+ (trialAvailable ? (
+ <Tooltip key={plan.tier}>
+ <TooltipTrigger asChild>
+ <button
+ type="button"
+ className="flex w-full items-baseline justify-between gap-3 rounded-sm px-1 text-sm tabular-nums outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ <span className="text-muted line-through">
+ {comparePrice.amount > 0
+ ? `${formattedPrice}${comparePrice.compactUnit}`
+ : "Usage-based"}
+ </span>
+ <span className="font-medium text-foreground">{trialPriceLabel}*</span>
+ </button>
+ </TooltipTrigger>
+ <TooltipContent
+ side="top"
+ className="w-96 max-w-(--radix-tooltip-content-available-width) leading-relaxed"
+ >
+ {trialBillingTerms}
+ </TooltipContent>
+ </Tooltip>
+ ) : (
+ <div
+ className={`flex flex-wrap items-center gap-3 px-1 ${hasPeriodOption ? "justify-between" : "justify-center"}`}
+ >
+ {hasPeriodOption ? (
+ <div className="flex items-center gap-2">
+ <Checkbox
+ id={`upgrade-cadence-${product.id}`}
+ variant="org"
+ isChecked={visibleCadence === "annual"}
+ isDisabled={startTrial.isPending}
+ onCheckedChange={(checked) =>
+ setCadence(checked === true ? "annual" : "monthly")
+ }
+ />
+ <Label htmlFor={`upgrade-cadence-${product.id}`}>Annual Billing</Label>
+ {visibleCadence === "annual" && savingsPercent > 0 && (
+ <Badge variant="success" className="min-h-4 px-1 py-0 text-[10px]">
+ -{savingsPercent}%
+ </Badge>
+ )}
+ </div>
+ ) : null}
+ <div
+ className={`flex items-baseline gap-2 text-sm tabular-nums ${hasPeriodOption ? "ml-auto" : ""}`}
+ >
+ {comparePrice.amount > 0 ? (
+ <span className="font-medium text-foreground">
+ {formattedPrice}
+ {comparePrice.compactUnit}
+ </span>
+ ) : (
+ <span className="font-medium text-foreground">Usage-based</span>
+ )}
+ </div>
+ </div>
+ ))}
+ {productUpgradeAction}
+ </>
+ }
+ />
+ );
+};
+
+export const UpgradeGate = ({ intent, ...props }: Props | CapabilityProps) => {
+ if ("scope" in intent) {
+ return <CapabilityUpgradeGate {...props} intent={intent} />;
+ }
+ return <ProductUpgradeGate {...props} intent={intent} />;
+};
diff --git a/frontend/src/components/license/UpgradeGate/capability-upgrade-intents.test.ts b/frontend/src/components/license/UpgradeGate/capability-upgrade-intents.test.ts
new file mode 100644
index 0000000000..4fbbcc8bb2
--- /dev/null
+++ b/frontend/src/components/license/UpgradeGate/capability-upgrade-intents.test.ts
@@ -0,0 +1,24 @@
+import { describe, expect, it } from "vitest";
+
+import {
+ getCapabilityUpgradeUrl,
+ GroupsUpgradeIntent,
+ InstanceUserManagementUpgradeIntent
+} from "./capability-upgrade-intents";
+
+describe("capability upgrade intents", () => {
+ it("routes platform capabilities to root organization billing", () => {
+ expect(getCapabilityUpgradeUrl(GroupsUpgradeIntent, { id: "child", rootOrgId: "root" })).toBe(
+ "/organizations/root/billing"
+ );
+ expect(getCapabilityUpgradeUrl(GroupsUpgradeIntent, { id: "org" })).toBe(
+ "/organizations/org/billing"
+ );
+ });
+
+ it("routes instance capabilities to sales instead of organization checkout", () => {
+ expect(getCapabilityUpgradeUrl(InstanceUserManagementUpgradeIntent, { id: "org" })).toBe(
+ "https://infisical.com/talk-to-us"
+ );
+ });
+});
diff --git a/frontend/src/components/license/UpgradeGate/capability-upgrade-intents.ts b/frontend/src/components/license/UpgradeGate/capability-upgrade-intents.ts
new file mode 100644
index 0000000000..4f0011d580
--- /dev/null
+++ b/frontend/src/components/license/UpgradeGate/capability-upgrade-intents.ts
@@ -0,0 +1,241 @@
+export type CapabilityUpgradeIntent = {
+ scope: "platform" | "instance" | "product";
+ featureKey:
+ | "groups"
+ | "rbac"
+ | "instance_user_management"
+ | "hsm"
+ | "workspace_limit"
+ | "sub_organization"
+ | "external_kms"
+ | "kmip"
+ | "audit_logs"
+ | "audit_log_retention_days"
+ | "audit_log_streams"
+ | "gateway_pool"
+ | "project_templates"
+ | "enterprise_app_connections"
+ | "enforce_mfa"
+ | "github_org_sync"
+ | "scim"
+ | "ldap"
+ | "saml_sso"
+ | "oidc_sso"
+ | "sso_enforcement"
+ | "machine_identity_auth_templates"
+ | "identity_auth"
+ | "agent_vault_byo_s3";
+ productName?: string;
+ title: string;
+ description: string;
+ isEnterpriseFeature: boolean;
+};
+
+export const getCapabilityUpgradeUrl = (
+ intent: CapabilityUpgradeIntent,
+ organization: { id: string; rootOrgId?: string | null }
+) =>
+ intent.scope === "instance"
+ ? "https://infisical.com/talk-to-us"
+ : `/organizations/${organization.rootOrgId ?? organization.id}/billing`;
+
+export const GroupsUpgradeIntent = {
+ scope: "platform",
+ featureKey: "groups",
+ title: "Unlock Groups",
+ description: "Manage access for teams by organizing members into groups.",
+ isEnterpriseFeature: true
+} satisfies CapabilityUpgradeIntent;
+
+export const CustomRolesUpgradeIntent = {
+ scope: "platform",
+ featureKey: "rbac",
+ title: "Unlock Custom Roles",
+ description: "Control access with custom roles and granular permissions.",
+ isEnterpriseFeature: true
+} satisfies CapabilityUpgradeIntent;
+
+export const InstanceUserManagementUpgradeIntent = {
+ scope: "instance",
+ featureKey: "instance_user_management",
+ title: "Unlock Instance User Management",
+ description: "Manage server administrators and user access across your Infisical instance.",
+ isEnterpriseFeature: false
+} satisfies CapabilityUpgradeIntent;
+
+export const InstanceHsmUpgradeIntent = {
+ scope: "instance",
+ featureKey: "hsm",
+ title: "Unlock Hardware Security Modules",
+ description: "Protect your instance's encryption keys with a Hardware Security Module (HSM).",
+ isEnterpriseFeature: true
+} satisfies CapabilityUpgradeIntent;
+
+export const ProjectLimitUpgradeIntent = {
+ scope: "platform",
+ featureKey: "workspace_limit",
+ title: "Unlock More Projects",
+ description: "Compare subscriptions to increase your organization's project allowance.",
+ isEnterpriseFeature: false
+} satisfies CapabilityUpgradeIntent;
+
+export const SubOrganizationsUpgradeIntent = {
+ scope: "platform",
+ featureKey: "sub_organization",
+ title: "Unlock Sub-Organizations",
+ description: "Separate teams under one organization with shared billing.",
+ isEnterpriseFeature: true
+} satisfies CapabilityUpgradeIntent;
+
+export const ExternalKmsUpgradeIntent = {
+ scope: "platform",
+ featureKey: "external_kms",
+ title: "Unlock External KMS",
+ description: "Use your own key management system to encrypt organization and project data.",
+ isEnterpriseFeature: true
+} satisfies CapabilityUpgradeIntent;
+
+export const HsmConnectorsUpgradeIntent = {
+ scope: "platform",
+ featureKey: "hsm",
+ title: "Unlock HSM Connectors",
+ description: "Connect Hardware Security Modules for protected cryptographic operations.",
+ isEnterpriseFeature: true
+} satisfies CapabilityUpgradeIntent;
+
+export const KmipUpgradeIntent = {
+ scope: "platform",
+ featureKey: "kmip",
+ title: "Unlock KMIP",
+ description: "Manage cryptographic keys through KMIP-compatible clients.",
+ isEnterpriseFeature: true
+} satisfies CapabilityUpgradeIntent;
+
+export const AuditLogsUpgradeIntent = {
+ scope: "platform",
+ featureKey: "audit_logs",
+ title: "Unlock Audit Logs",
+ description: "Review activity across your organization's products.",
+ isEnterpriseFeature: false
+} satisfies CapabilityUpgradeIntent;
+
+export const AuditRetentionUpgradeIntent = {
+ scope: "platform",
+ featureKey: "audit_log_retention_days",
+ title: "Unlock Audit Log Retention",
+ description: "Keep organization activity history available for longer.",
+ isEnterpriseFeature: false
+} satisfies CapabilityUpgradeIntent;
+
+export const AuditLogStreamsUpgradeIntent = {
+ scope: "platform",
+ featureKey: "audit_log_streams",
+ title: "Unlock Audit Log Streaming",
+ description: "Send audit activity to external monitoring systems.",
+ isEnterpriseFeature: true
+} satisfies CapabilityUpgradeIntent;
+
+export const GatewayPoolsUpgradeIntent = {
+ scope: "platform",
+ featureKey: "gateway_pool",
+ title: "Unlock Gateway Pools",
+ description: "Connect private infrastructure through shared gateway pools.",
+ isEnterpriseFeature: true
+} satisfies CapabilityUpgradeIntent;
+
+export const ProjectTemplatesUpgradeIntent = {
+ scope: "platform",
+ featureKey: "project_templates",
+ title: "Unlock Project Templates",
+ description: "Reuse project configuration across your organization.",
+ isEnterpriseFeature: true
+} satisfies CapabilityUpgradeIntent;
+
+export const EnterpriseAppConnectionsUpgradeIntent = {
+ scope: "platform",
+ featureKey: "enterprise_app_connections",
+ title: "Unlock Enterprise App Connections",
+ description: "Connect enterprise providers across your organization's products.",
+ isEnterpriseFeature: true
+} satisfies CapabilityUpgradeIntent;
+
+export const MfaEnforcementUpgradeIntent = {
+ scope: "platform",
+ featureKey: "enforce_mfa",
+ title: "Unlock MFA Enforcement",
+ description: "Require multi-factor authentication for organization members.",
+ isEnterpriseFeature: false
+} satisfies CapabilityUpgradeIntent;
+
+export const GithubSyncUpgradeIntent = {
+ scope: "platform",
+ featureKey: "github_org_sync",
+ title: "Unlock GitHub Organization Sync",
+ description: "Sync organization membership from GitHub.",
+ isEnterpriseFeature: true
+} satisfies CapabilityUpgradeIntent;
+
+export const ScimUpgradeIntent = {
+ scope: "platform",
+ featureKey: "scim",
+ title: "Unlock SCIM Provisioning",
+ description: "Provision and deprovision users from your identity provider.",
+ isEnterpriseFeature: true
+} satisfies CapabilityUpgradeIntent;
+
+export const LdapUpgradeIntent = {
+ scope: "platform",
+ featureKey: "ldap",
+ title: "Unlock LDAP Authentication",
+ description: "Connect your directory for centralized identity management.",
+ isEnterpriseFeature: true
+} satisfies CapabilityUpgradeIntent;
+
+export const SamlSsoUpgradeIntent = {
+ scope: "platform",
+ featureKey: "saml_sso",
+ title: "Unlock SAML SSO",
+ description: "Connect a SAML identity provider for organization sign-in.",
+ isEnterpriseFeature: false
+} satisfies CapabilityUpgradeIntent;
+
+export const OidcSsoUpgradeIntent = {
+ scope: "platform",
+ featureKey: "oidc_sso",
+ title: "Unlock OIDC SSO",
+ description: "Connect an OIDC identity provider for organization sign-in.",
+ isEnterpriseFeature: true
+} satisfies CapabilityUpgradeIntent;
+
+export const SsoEnforcementUpgradeIntent = {
+ scope: "platform",
+ featureKey: "sso_enforcement",
+ title: "Unlock SSO Enforcement",
+ description: "Configure required sign-in methods for your organization.",
+ isEnterpriseFeature: false
+} satisfies CapabilityUpgradeIntent;
+
+export const MachineIdentityTemplatesUpgradeIntent = {
+ scope: "platform",
+ featureKey: "machine_identity_auth_templates",
+ title: "Unlock Machine Identity Auth Templates",
+ description: "Reuse authentication configuration across machine identities.",
+ isEnterpriseFeature: true
+} satisfies CapabilityUpgradeIntent;
+
+export const IdentityAuthUpgradeIntent = {
+ scope: "platform",
+ featureKey: "identity_auth",
+ title: "Unlock Machine Identity Authentication",
+ description: "Review subscription options for this machine identity authentication method.",
+ isEnterpriseFeature: false
+} satisfies CapabilityUpgradeIntent;
+
+export const AgentVaultSessionLogsUpgradeIntent = {
+ scope: "product",
+ productName: "Agent Vault",
+ featureKey: "agent_vault_byo_s3",
+ title: "Unlock Agent Vault Session Logs",
+ description: "Record agent requests in your own storage for review and investigation.",
+ isEnterpriseFeature: true
+} satisfies CapabilityUpgradeIntent;
diff --git a/frontend/src/components/license/UpgradeGate/environment-limit.ts b/frontend/src/components/license/UpgradeGate/environment-limit.ts
new file mode 100644
index 0000000000..ac8a35183a
--- /dev/null
+++ b/frontend/src/components/license/UpgradeGate/environment-limit.ts
@@ -0,0 +1,4 @@
+export const hasEnvironmentCapacity = (
+ environmentLimit: number | null | undefined,
+ environmentCount: number
+) => !environmentLimit || environmentCount < environmentLimit;
diff --git a/frontend/src/components/license/UpgradeGate/index.ts b/frontend/src/components/license/UpgradeGate/index.ts
new file mode 100644
index 0000000000..8f5fe8e1c5
--- /dev/null
+++ b/frontend/src/components/license/UpgradeGate/index.ts
@@ -0,0 +1,69 @@
+export type { CapabilityUpgradeIntent } from "./capability-upgrade-intents";
+export {
+ AgentVaultSessionLogsUpgradeIntent,
+ AuditLogStreamsUpgradeIntent,
+ AuditLogsUpgradeIntent,
+ AuditRetentionUpgradeIntent,
+ CustomRolesUpgradeIntent,
+ EnterpriseAppConnectionsUpgradeIntent,
+ ExternalKmsUpgradeIntent,
+ GatewayPoolsUpgradeIntent,
+ GithubSyncUpgradeIntent,
+ GroupsUpgradeIntent,
+ HsmConnectorsUpgradeIntent,
+ IdentityAuthUpgradeIntent,
+ InstanceHsmUpgradeIntent,
+ InstanceUserManagementUpgradeIntent,
+ KmipUpgradeIntent,
+ LdapUpgradeIntent,
+ MachineIdentityTemplatesUpgradeIntent,
+ MfaEnforcementUpgradeIntent,
+ OidcSsoUpgradeIntent,
+ ProjectLimitUpgradeIntent,
+ ProjectTemplatesUpgradeIntent,
+ SamlSsoUpgradeIntent,
+ ScimUpgradeIntent,
+ SsoEnforcementUpgradeIntent,
+ SubOrganizationsUpgradeIntent
+} from "./capability-upgrade-intents";
+export { hasEnvironmentCapacity } from "./environment-limit";
+export type { UpgradeIntent } from "./upgrade-intents";
+export {
+ BillingPlan,
+ BillingProduct,
+ buildUpgradeReturnPath,
+ CertificateApprovalPoliciesUpgradeIntent,
+ CertificateAuthoritiesUpgradeIntent,
+ CertificateDiscoveryUpgradeIntent,
+ CertificateEnrollmentUpgradeIntent,
+ CertificateEnterpriseAlertingUpgradeIntent,
+ CertificateIssuanceLimitsUpgradeIntent,
+ CertificateManagementUpgradeIntent,
+ CertificateRevocationListsUpgradeIntent,
+ CertificateSyncsUpgradeIntent,
+ CodeSigningUpgradeIntent,
+ CrossProjectSecretSharingUpgradeIntent,
+ DynamicSecretsUpgradeIntent,
+ EnterprisePamAccountsUpgradeIntent,
+ EnterpriseSecretSyncsUpgradeIntent,
+ EnvironmentLimitUpgradeIntent,
+ ExternalCertificateAuthoritiesUpgradeIntent,
+ FolderAccessControlsUpgradeIntent,
+ getSafeUpgradeReturnPath,
+ HoneyTokensUpgradeIntent,
+ PamAccountLimitUpgradeIntent,
+ PamSlackNotificationsUpgradeIntent,
+ PamUpgradeIntent,
+ PointInTimeRecoveryUpgradeIntent,
+ PostQuantumCertificatesUpgradeIntent,
+ SecretAccessInsightsUpgradeIntent,
+ SecretAccessRequestsUpgradeIntent,
+ SecretApprovalPoliciesUpgradeIntent,
+ SecretImportReplicationUpgradeIntent,
+ SecretRotationsUpgradeIntent,
+ SecretsBrokeringUpgradeIntent,
+ SecretScanningUpgradeIntent,
+ UpgradeFeature
+} from "./upgrade-intents";
+export { UpgradeGate } from "./UpgradeGate";
+export { useUpgradeGate } from "./useUpgradeGate";
diff --git a/frontend/src/components/license/UpgradeGate/upgrade-intents.ts b/frontend/src/components/license/UpgradeGate/upgrade-intents.ts
new file mode 100644
index 0000000000..a6441391b3
--- /dev/null
+++ b/frontend/src/components/license/UpgradeGate/upgrade-intents.ts
@@ -0,0 +1,385 @@
+export const BillingProduct = {
+ SecretsManagement: "secrets_management",
+ CertificateManagement: "cert_management",
+ Pam: "pam"
+} as const;
+
+export const BillingPlan = {
+ Pro: "pro",
+ Advanced: "advanced",
+ Enterprise: "enterprise"
+} as const;
+
+export const UpgradeFeature = {
+ DynamicSecrets: "dynamic-secrets",
+ SecretRotations: "secret-rotations",
+ HoneyTokens: "honey-tokens",
+ SecretsBrokering: "secrets-brokering",
+ PointInTimeRecovery: "point-in-time-recovery",
+ FolderAccessControls: "folder-access-controls",
+ SecretImportReplication: "secret-import-replication",
+ SecretAccessInsights: "secret-access-insights",
+ EnterpriseSecretSyncs: "enterprise-secret-syncs",
+ SecretApprovalPolicies: "secret-approval-policies",
+ SecretAccessRequests: "secret-access-requests",
+ CrossProjectSecretSharing: "cross-project-secret-sharing",
+ EnvironmentLimit: "environment-limit",
+ SecretScanning: "secret-scanning",
+ CertificateManagement: "certificate-management",
+ CertificateSyncs: "certificate-syncs",
+ CertificateApprovalPolicies: "certificate-approval-policies",
+ CertificateRevocationLists: "certificate-revocation-lists",
+ CodeSigning: "code-signing",
+ CertificateDiscovery: "certificate-discovery",
+ CertificateEnrollment: "certificate-enrollment",
+ CertificateEnterpriseAlerting: "certificate-enterprise-alerting",
+ CertificateAuthorities: "certificate-authorities",
+ ExternalCertificateAuthorities: "external-certificate-authorities",
+ PostQuantumCertificates: "post-quantum-certificates",
+ CertificateIssuanceLimits: "certificate-issuance-limits",
+ Pam: "pam",
+ PamAccountLimit: "pam-account-limit",
+ PamSlackNotifications: "pam-slack-notifications",
+ EnterprisePamAccounts: "enterprise-pam-accounts"
+} as const;
+
+export type UpgradeIntent = {
+ featureKey: (typeof UpgradeFeature)[keyof typeof UpgradeFeature];
+ productKey: (typeof BillingProduct)[keyof typeof BillingProduct];
+ planKey: (typeof BillingPlan)[keyof typeof BillingPlan];
+ upgradeLabel?: string;
+ title: string;
+ description: string;
+ quotaNotice?: string;
+ quota?: { used: number; limit: number };
+};
+
+export const DynamicSecretsUpgradeIntent = {
+ featureKey: UpgradeFeature.DynamicSecrets,
+ productKey: BillingProduct.SecretsManagement,
+ planKey: BillingPlan.Advanced,
+ upgradeLabel: "Unlock Dynamic Secrets",
+ title: "Add Dynamic Secrets",
+ description:
+ "Dynamic secrets are included with Secrets Management Advanced. Review the plan or start a free trial to continue."
+} satisfies UpgradeIntent;
+
+export const EnvironmentLimitUpgradeIntent = {
+ featureKey: UpgradeFeature.EnvironmentLimit,
+ productKey: BillingProduct.SecretsManagement,
+ planKey: BillingPlan.Pro,
+ upgradeLabel: "Unlock More Environments",
+ title: "Create Environment",
+ description: "Compare Secrets Management plans to increase your project's environment allowance."
+} satisfies UpgradeIntent;
+
+export const SecretScanningUpgradeIntent = {
+ featureKey: UpgradeFeature.SecretScanning,
+ productKey: BillingProduct.SecretsManagement,
+ planKey: BillingPlan.Enterprise,
+ upgradeLabel: "Unlock Secret Scanning",
+ title: "Add Secret Scanning Data Source",
+ description: "Review Secrets Management plans to enable secret scanning data sources."
+} satisfies UpgradeIntent;
+
+export const SecretRotationsUpgradeIntent = {
+ featureKey: UpgradeFeature.SecretRotations,
+ productKey: BillingProduct.SecretsManagement,
+ planKey: BillingPlan.Pro,
+ upgradeLabel: "Unlock Secret Rotations",
+ title: "Add Secret Rotation",
+ description:
+ "Secret rotations are included with Secrets Management Pro. Review the plan or start a free trial to continue."
+} satisfies UpgradeIntent;
+
+export const HoneyTokensUpgradeIntent = {
+ featureKey: UpgradeFeature.HoneyTokens,
+ productKey: BillingProduct.SecretsManagement,
+ planKey: BillingPlan.Pro,
+ upgradeLabel: "Unlock Honey Tokens",
+ title: "Add Honey Token",
+ description:
+ "Honey tokens are included with Secrets Management Pro. Review the plan or start a free trial to continue."
+} satisfies UpgradeIntent;
+
+export const SecretsBrokeringUpgradeIntent = {
+ featureKey: UpgradeFeature.SecretsBrokering,
+ productKey: BillingProduct.SecretsManagement,
+ planKey: BillingPlan.Enterprise,
+ upgradeLabel: "Unlock Secrets Brokering",
+ title: "Add Proxied Service",
+ description:
+ "Secrets brokering is included with Secrets Management Enterprise. Review the plan to continue."
+} satisfies UpgradeIntent;
+
+export const PointInTimeRecoveryUpgradeIntent = {
+ featureKey: UpgradeFeature.PointInTimeRecovery,
+ productKey: BillingProduct.SecretsManagement,
+ planKey: BillingPlan.Pro,
+ upgradeLabel: "Unlock Point-in-Time Recovery",
+ title: "View Commit History",
+ description:
+ "Point-in-time recovery is included with Secrets Management Pro. Review the plan or start a free trial to continue."
+} satisfies UpgradeIntent;
+
+export const FolderAccessControlsUpgradeIntent = {
+ featureKey: UpgradeFeature.FolderAccessControls,
+ productKey: BillingProduct.SecretsManagement,
+ planKey: BillingPlan.Pro,
+ upgradeLabel: "Unlock Folder Access Controls",
+ title: "Manage Folder Access",
+ description:
+ "Folder-level access controls are included with Secrets Management Pro. Review the plan or start a free trial to continue."
+} satisfies UpgradeIntent;
+
+export const SecretImportReplicationUpgradeIntent = {
+ featureKey: UpgradeFeature.SecretImportReplication,
+ productKey: BillingProduct.SecretsManagement,
+ planKey: BillingPlan.Pro,
+ upgradeLabel: "Unlock Secret Import Replication",
+ title: "Replicate Secret Import",
+ description:
+ "Secret import replication is included with Secrets Management Pro. Review the plan or start a free trial to continue."
+} satisfies UpgradeIntent;
+
+export const SecretAccessInsightsUpgradeIntent = {
+ featureKey: UpgradeFeature.SecretAccessInsights,
+ productKey: BillingProduct.SecretsManagement,
+ planKey: BillingPlan.Pro,
+ upgradeLabel: "Unlock Secret Access Insights",
+ title: "View Secret Access",
+ description:
+ "Secret access insights are included with Secrets Management Pro. Review the plan or start a free trial to continue."
+} satisfies UpgradeIntent;
+
+export const EnterpriseSecretSyncsUpgradeIntent = {
+ featureKey: UpgradeFeature.EnterpriseSecretSyncs,
+ productKey: BillingProduct.SecretsManagement,
+ planKey: BillingPlan.Enterprise,
+ upgradeLabel: "Unlock Enterprise Secret Syncs",
+ title: "Choose Enterprise Secret Sync",
+ description:
+ "Enterprise Secret Sync destinations are included with Secrets Management Enterprise. Review the plan to continue."
+} satisfies UpgradeIntent;
+
+export const SecretApprovalPoliciesUpgradeIntent = {
+ featureKey: UpgradeFeature.SecretApprovalPolicies,
+ productKey: BillingProduct.SecretsManagement,
+ planKey: BillingPlan.Pro,
+ upgradeLabel: "Unlock Approval Policies",
+ title: "Add Approval Policy",
+ description:
+ "Approval policies are included with Secrets Management Pro. Review the plans to continue."
+} satisfies UpgradeIntent;
+
+export const SecretAccessRequestsUpgradeIntent = {
+ featureKey: UpgradeFeature.SecretAccessRequests,
+ productKey: BillingProduct.SecretsManagement,
+ planKey: BillingPlan.Pro,
+ upgradeLabel: "Unlock Access Requests",
+ title: "Request Secret Access",
+ description:
+ "Access requests are included with Secrets Management Pro. Review the plans to continue."
+} satisfies UpgradeIntent;
+
+export const CrossProjectSecretSharingUpgradeIntent = {
+ featureKey: UpgradeFeature.CrossProjectSecretSharing,
+ productKey: BillingProduct.SecretsManagement,
+ planKey: BillingPlan.Pro,
+ upgradeLabel: "Unlock Cross-Project Secret Sharing",
+ title: "Share Secrets Across Projects",
+ description:
+ "Cross-project secret sharing is included with Secrets Management Pro. Review the plans to continue."
+} satisfies UpgradeIntent;
+
+export const CertificateManagementUpgradeIntent = {
+ featureKey: UpgradeFeature.CertificateManagement,
+ productKey: BillingProduct.CertificateManagement,
+ planKey: BillingPlan.Pro,
+ upgradeLabel: "Unlock Certificate Management",
+ title: "Open Certificate Management",
+ description:
+ "Certificate Management is included with the Pro plan. Review the plans or start a free trial to continue."
+} satisfies UpgradeIntent;
+
+export const CertificateSyncsUpgradeIntent = {
+ featureKey: UpgradeFeature.CertificateSyncs,
+ productKey: BillingProduct.CertificateManagement,
+ planKey: BillingPlan.Enterprise,
+ upgradeLabel: "Unlock Certificate Syncs",
+ title: "Add Certificate Sync",
+ description:
+ "Certificate Syncs are included with the Enterprise plan. Review the plan to continue."
+} satisfies UpgradeIntent;
+
+export const CertificateApprovalPoliciesUpgradeIntent = {
+ featureKey: UpgradeFeature.CertificateApprovalPolicies,
+ productKey: BillingProduct.CertificateManagement,
+ planKey: BillingPlan.Enterprise,
+ upgradeLabel: "Unlock Approval Policies",
+ title: "Create Approval Policy",
+ description:
+ "Certificate approval policies are included with the Enterprise plan. Review the plan to continue."
+} satisfies UpgradeIntent;
+
+export const CertificateRevocationListsUpgradeIntent = {
+ featureKey: UpgradeFeature.CertificateRevocationLists,
+ productKey: BillingProduct.CertificateManagement,
+ planKey: BillingPlan.Enterprise,
+ upgradeLabel: "Unlock CRL Distribution Points",
+ title: "Add CRL Distribution Point",
+ description:
+ "Custom CRL distribution points are included with the Enterprise plan. Review the plan to continue."
+} satisfies UpgradeIntent;
+
+export const CodeSigningUpgradeIntent = {
+ featureKey: UpgradeFeature.CodeSigning,
+ productKey: BillingProduct.CertificateManagement,
+ planKey: BillingPlan.Enterprise,
+ upgradeLabel: "Unlock Code Signing",
+ title: "Create Code Signer",
+ description: "Code signing is included with the Enterprise plan. Review the plan to continue."
+} satisfies UpgradeIntent;
+
+export const CertificateDiscoveryUpgradeIntent = {
+ featureKey: UpgradeFeature.CertificateDiscovery,
+ productKey: BillingProduct.CertificateManagement,
+ planKey: BillingPlan.Enterprise,
+ upgradeLabel: "Unlock Certificate Discovery",
+ title: "Add Discovery Job",
+ description:
+ "Certificate discovery is included with the Enterprise plan. Review the plan to continue."
+} satisfies UpgradeIntent;
+
+export const CertificateEnrollmentUpgradeIntent = {
+ featureKey: UpgradeFeature.CertificateEnrollment,
+ productKey: BillingProduct.CertificateManagement,
+ planKey: BillingPlan.Enterprise,
+ upgradeLabel: "Unlock Certificate Enrollment",
+ title: "Manage Certificate Enrollment",
+ description:
+ "Advanced certificate enrollment methods are included with the Enterprise plan. Review the plan to continue."
+} satisfies UpgradeIntent;
+
+export const CertificateEnterpriseAlertingUpgradeIntent = {
+ featureKey: UpgradeFeature.CertificateEnterpriseAlerting,
+ productKey: BillingProduct.CertificateManagement,
+ planKey: BillingPlan.Enterprise,
+ upgradeLabel: "Unlock Enterprise Alert Channels",
+ title: "Add Enterprise Alert Channel",
+ description:
+ "Webhook, Slack, and PagerDuty certificate alert channels are included with the Enterprise plan. Review the plan to continue."
+} satisfies UpgradeIntent;
+
+export const CertificateAuthoritiesUpgradeIntent = {
+ featureKey: UpgradeFeature.CertificateAuthorities,
+ productKey: BillingProduct.CertificateManagement,
+ planKey: BillingPlan.Pro,
+ upgradeLabel: "Unlock More Certificate Authorities",
+ title: "Create Certificate Authority",
+ description:
+ "Compare Certificate Management plans to increase your certificate authority allowance."
+} satisfies UpgradeIntent;
+
+export const ExternalCertificateAuthoritiesUpgradeIntent = {
+ featureKey: UpgradeFeature.ExternalCertificateAuthorities,
+ productKey: BillingProduct.CertificateManagement,
+ planKey: BillingPlan.Enterprise,
+ upgradeLabel: "Unlock External Certificate Authorities",
+ title: "Configure External Certificate Authority",
+ description:
+ "External certificate authority integrations are included with the Enterprise plan. Review the plan to continue."
+} satisfies UpgradeIntent;
+
+export const PostQuantumCertificatesUpgradeIntent = {
+ featureKey: UpgradeFeature.PostQuantumCertificates,
+ productKey: BillingProduct.CertificateManagement,
+ planKey: BillingPlan.Enterprise,
+ upgradeLabel: "Unlock Post-Quantum Certificates",
+ title: "Select Post-Quantum Algorithm",
+ description:
+ "Post-quantum certificate algorithms are included with the Enterprise plan. Review the plan to continue."
+} satisfies UpgradeIntent;
+
+export const CertificateIssuanceLimitsUpgradeIntent = {
+ featureKey: UpgradeFeature.CertificateIssuanceLimits,
+ productKey: BillingProduct.CertificateManagement,
+ planKey: BillingPlan.Pro,
+ upgradeLabel: "Unlock Certificate Issuance",
+ title: "Configure Certificate Names",
+ description:
+ "Compare Certificate Management plans to increase certificate and subject alternative name allowances."
+} satisfies UpgradeIntent;
+
+export const PamUpgradeIntent = {
+ featureKey: UpgradeFeature.Pam,
+ productKey: BillingProduct.Pam,
+ planKey: BillingPlan.Pro,
+ upgradeLabel: "Unlock Privileged Access Management",
+ title: "Open Privileged Access Management",
+ description:
+ "Privileged Access Management is included with the Pro plan. Review the plans or start a free trial to continue."
+} satisfies UpgradeIntent;
+
+export const PamAccountLimitUpgradeIntent = {
+ featureKey: UpgradeFeature.PamAccountLimit,
+ productKey: BillingProduct.Pam,
+ planKey: BillingPlan.Pro,
+ upgradeLabel: "Unlock More PAM Accounts",
+ title: "Add PAM Account",
+ description: "Compare PAM plans to increase your organization-wide account allowance."
+} satisfies UpgradeIntent;
+
+export const PamSlackNotificationsUpgradeIntent = {
+ featureKey: UpgradeFeature.PamSlackNotifications,
+ productKey: BillingProduct.Pam,
+ planKey: BillingPlan.Enterprise,
+ upgradeLabel: "Unlock Slack Notifications",
+ title: "Configure Slack Notifications",
+ description:
+ "PAM Slack notifications are included with the Enterprise plan. Review the plan to continue."
+} satisfies UpgradeIntent;
+
+export const EnterprisePamAccountsUpgradeIntent = {
+ featureKey: UpgradeFeature.EnterprisePamAccounts,
+ productKey: BillingProduct.Pam,
+ planKey: BillingPlan.Enterprise,
+ upgradeLabel: "Unlock Enterprise Accounts",
+ title: "Add Enterprise Account",
+ description:
+ "Enterprise account types are included with the Enterprise plan. Review the plan to continue."
+} satisfies UpgradeIntent;
+
+export const buildUpgradeReturnPath = (location: Location) => {
+ const search = new URLSearchParams(location.search);
+ search.delete("checkout");
+ search.delete("card");
+ search.delete("upgradeContinuation");
+ search.delete("upgradeEnvironment");
+ search.delete("upgradeFolderPath");
+ const query = search.toString();
+ const fullPath = `${location.pathname}${query ? `?${query}` : ""}${location.hash}`;
+ return fullPath.length <= 2048 ? fullPath : location.pathname;
+};
+
+export const getSafeUpgradeReturnPath = (returnPath: string | null, origin: string) => {
+ if (!returnPath || returnPath.length > 2048 || !returnPath.startsWith("/")) {
+ return null;
+ }
+
+ const hasUnsafeCharacter = [...returnPath].some((character) => {
+ const codePoint = character.charCodeAt(0);
+ return codePoint <= 31 || codePoint === 127 || character === "\\";
+ });
+ if (hasUnsafeCharacter) {
+ return null;
+ }
+
+ try {
+ const url = new URL(returnPath, origin);
+ if (url.origin !== new URL(origin).origin || url.pathname.includes("//")) return null;
+ return `${url.pathname}${url.search}${url.hash}`;
+ } catch {
+ return null;
+ }
+};
diff --git a/frontend/src/components/license/UpgradeGate/useUpgradeGate.tsx b/frontend/src/components/license/UpgradeGate/useUpgradeGate.tsx
new file mode 100644
index 0000000000..4ba1abc8de
--- /dev/null
+++ b/frontend/src/components/license/UpgradeGate/useUpgradeGate.tsx
@@ -0,0 +1,29 @@
+import { useCallback, useState } from "react";
+
+import { UpgradeIntent } from "./upgrade-intents";
+import { UpgradeGate } from "./UpgradeGate";
+
+type UpgradeRequest = {
+ intent: UpgradeIntent;
+ paywallKey: string;
+};
+
+export const useUpgradeGate = () => {
+ const [request, setRequest] = useState<UpgradeRequest | null>(null);
+ const openUpgradeGate = useCallback((nextRequest: UpgradeRequest) => setRequest(nextRequest), []);
+
+ const upgradeGate = request ? (
+ <UpgradeGate
+ intent={request.intent}
+ paywallKey={request.paywallKey}
+ isOpen
+ onOpenChange={(isOpen) => {
+ if (!isOpen) {
+ setRequest(null);
+ }
+ }}
+ />
+ ) : null;
+
+ return { openUpgradeGate, upgradeGate };
+};
diff --git a/frontend/src/components/license/UpgradePlanModal/UpgradePlanModal.tsx b/frontend/src/components/license/UpgradePlanModal/UpgradePlanModal.tsx
deleted file mode 100644
index 9d76ac735e..0000000000
--- a/frontend/src/components/license/UpgradePlanModal/UpgradePlanModal.tsx
+++ /dev/null
@@ -1,109 +0,0 @@
-import { useEffect, useRef } from "react";
-import { Link, useRouterState } from "@tanstack/react-router";
-import { SparklesIcon } from "lucide-react";
-
-import {
- Button,
- Dialog,
- DialogContent,
- DialogDescription,
- DialogFooter,
- DialogHeader,
- DialogTitle,
- Separator
-} from "@app/components/v3";
-import { useOrganization } from "@app/context";
-import { useScopeVariant } from "@app/hooks";
-import { analytics, AnalyticsEvent } from "@app/lib/analytics";
-
-type Props = {
- isOpen?: boolean;
- onOpenChange?: (isOpen: boolean) => void;
- paywallKey: string;
- text: string;
- // akhilmhdh: We will come back to this late. Otherwise would need to change in a lot of places.
- // eslint-disable-next-line
- isEnterpriseFeature?: boolean;
-};
-
-export const UpgradePlanModal = ({
- text,
- isOpen,
- onOpenChange,
- paywallKey,
- isEnterpriseFeature
-}: Props): JSX.Element => {
- const { currentOrg } = useOrganization();
- const scopeVariant = useScopeVariant();
- const route = useRouterState({
- select: (state) => state.matches.at(-1)?.routeId ?? "unknown"
- });
- const eventPropertiesRef = useRef<{
- paywallKey: string;
- paywallText: string;
- route: string;
- isEnterpriseFeature: boolean;
- } | null>(null);
-
- useEffect(() => {
- if (isOpen) {
- const eventProperties = {
- paywallKey,
- paywallText: text,
- route,
- isEnterpriseFeature: Boolean(isEnterpriseFeature)
- };
- eventPropertiesRef.current = eventProperties;
- analytics.captureForOrganization(
- AnalyticsEvent.PaywallViewed,
- currentOrg.id,
- eventProperties
- );
- } else {
- eventPropertiesRef.current = null;
- }
- // The event should fire once per closed-to-open transition, not when copy or route context changes.
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [isOpen]);
-
- const handleUpgradeClick = () => {
- const eventProperties = eventPropertiesRef.current;
- if (!eventProperties) return;
-
- analytics.captureForOrganization(
- AnalyticsEvent.PaywallUpgradeClicked,
- currentOrg.id,
- eventProperties
- );
- };
-
- return (
- <Dialog open={isOpen} onOpenChange={onOpenChange}>
- {/* Keep upgrade prompts above the dialog or sheet that triggered them. */}
- <DialogContent className="z-[70] sm:max-w-xl" overlayClassName="z-[70]">
- <DialogHeader>
- <DialogTitle className="flex items-center gap-2.5">
- <SparklesIcon className="size-5 text-muted" />
- Unleash Infisical&apos;s Full Power
- </DialogTitle>
- <DialogDescription>
- Upgrade and get access to this, as well as to other powerful enhancements.
- </DialogDescription>
- </DialogHeader>
-
- <Separator />
- <p className="text-sm leading-relaxed text-foreground">{text}</p>
- <DialogFooter>
- <Button variant="ghost" onClick={() => onOpenChange?.(false)}>
- Cancel
- </Button>
- <Link to="/organizations/$orgId/billing" params={{ orgId: currentOrg.id }}>
- <Button variant={scopeVariant} onClick={handleUpgradeClick}>
- Upgrade Plan
- </Button>
- </Link>
- </DialogFooter>
- </DialogContent>
- </Dialog>
- );
-};
diff --git a/frontend/src/components/license/UpgradePlanModal/index.tsx b/frontend/src/components/license/UpgradePlanModal/index.tsx
deleted file mode 100644
index 09a53d31cf..0000000000
--- a/frontend/src/components/license/UpgradePlanModal/index.tsx
+++ /dev/null
@@ -1 +0,0 @@
-export { UpgradePlanModal } from "./UpgradePlanModal";
diff --git a/frontend/src/components/license/product-plan-summary.ts b/frontend/src/components/license/product-plan-summary.ts
new file mode 100644
index 0000000000..bd1729b59c
--- /dev/null
+++ b/frontend/src/components/license/product-plan-summary.ts
@@ -0,0 +1,58 @@
+import { SubscriptionPlan } from "@app/hooks/api/subscriptions/types";
+
+const PRODUCT_NAMES = new Map([
+ ["secrets_management", "Secrets Management"],
+ ["cert_management", "Certificate Management"],
+ ["pam", "Privileged Access Management"],
+ ["agent_vault", "Agent Vault"]
+]);
+
+const PLAN_LABELS = new Map([
+ ["free", "Free"],
+ ["pro", "Pro"],
+ ["advanced", "Advanced"],
+ ["enterprise", "Enterprise"],
+ ["legacy_pro_annual", "Pro"],
+ ["legacy_team", "Team"],
+ ["legacy_team_annual", "Team"],
+ ["legacy_enterprise", "Enterprise"]
+]);
+
+export type ProductPlanSummary = {
+ productKey: string;
+ productName: string;
+ planLabel: string;
+ isTrialing: boolean;
+};
+
+export const getProductPlanSummaries = (plans: SubscriptionPlan["productPlans"]) => {
+ const summaries = new Map<string, ProductPlanSummary>();
+ (plans ?? []).forEach((plan) => {
+ if (!["active", "trialing", "grace"].includes(plan.status ?? "")) return;
+
+ const isTrialing = Boolean(plan.trialPlanKey || plan.status === "trialing");
+ const planKey = isTrialing ? (plan.trialPlanKey ?? plan.planKey) : plan.planKey;
+ if (!planKey || planKey === "free") return;
+
+ const productKey =
+ plan.productKey === "legacy_secret_management" ? "secrets_management" : plan.productKey;
+ if (summaries.has(productKey) && plan.productKey !== productKey) return;
+
+ summaries.set(productKey, {
+ productKey,
+ productName:
+ PRODUCT_NAMES.get(productKey) ??
+ productKey
+ .split("_")
+ .map((word) =>
+ ["kms", "ai"].includes(word.toLowerCase())
+ ? word.toUpperCase()
+ : word.charAt(0).toUpperCase() + word.slice(1)
+ )
+ .join(" "),
+ planLabel: PLAN_LABELS.get(planKey) ?? planKey.replace(/_/g, " "),
+ isTrialing
+ });
+ });
+ return [...summaries.values()];
+};
diff --git a/frontend/src/components/pki-syncs/PkiSyncSelect.tsx b/frontend/src/components/pki-syncs/PkiSyncSelect.tsx
index 573cb38443..1b04381f5c 100644
--- a/frontend/src/components/pki-syncs/PkiSyncSelect.tsx
+++ b/frontend/src/components/pki-syncs/PkiSyncSelect.tsx
@@ -1,6 +1,7 @@
import { useMemo, useState } from "react";
import { Loader2Icon, Search } from "lucide-react";
+import { CertificateSyncsUpgradeIntent, useUpgradeGate } from "@app/components/license/UpgradeGate";
import {
Empty,
EmptyDescription,
@@ -14,11 +15,8 @@ import {
import { ProviderIcon } from "@app/components/v3/platform/ProviderIcon";
import { useSubscription } from "@app/context";
import { PKI_SYNC_MAP } from "@app/helpers/pkiSyncs";
-import { usePopUp } from "@app/hooks";
import { PkiSync, usePkiSyncOptions } from "@app/hooks/api/pkiSyncs";
-import { UpgradePlanModal } from "../license/UpgradePlanModal";
-
type Props = {
onSelect: (destination: PkiSync) => void;
};
@@ -51,14 +49,14 @@ const SyncCard = ({ destination, onClick }: { destination: PkiSync; onClick: ()
export const PkiSyncSelect = ({ onSelect }: Props) => {
const { subscription } = useSubscription();
const { isPending, data: pkiSyncOptions } = usePkiSyncOptions();
- const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["upgradePlan"] as const);
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
const [search, setSearch] = useState("");
const handleSelect = (destination: PkiSync) => {
if (!subscription.pkiSyncs) {
- handlePopUpOpen("upgradePlan", {
- isEnterpriseFeature: true,
- text: "Certificate Syncs can be unlocked if you switch to Infisical Enterprise plan."
+ openUpgradeGate({
+ intent: CertificateSyncsUpgradeIntent,
+ paywallKey: "pki.sync-provider"
});
return;
}
@@ -145,13 +143,7 @@ export const PkiSyncSelect = ({ onSelect }: Props) => {
.
</p>
- <UpgradePlanModal
- paywallKey="pki.sync-provider"
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
- text={popUp.upgradePlan.data?.text}
- />
+ {upgradeGate}
</div>
);
};
diff --git a/frontend/src/components/projects/NewProjectModal.tsx b/frontend/src/components/projects/NewProjectModal.tsx
index f2b7baa206..842ce2ba07 100644
--- a/frontend/src/components/projects/NewProjectModal.tsx
+++ b/frontend/src/components/projects/NewProjectModal.tsx
@@ -5,7 +5,7 @@ import { useNavigate } from "@tanstack/react-router";
import { InfoIcon, Plus } from "lucide-react";
import z from "zod";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { ExternalKmsUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import {
@@ -358,12 +358,14 @@ const NewProjectForm = ({ onOpenChange, projectType: fixedProjectType }: NewProj
Create Project
</Button>
</DialogFooter>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="project.external-kms"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="Your current plan does not include access to external KMS. To unlock this feature, please upgrade to Infisical Enterprise plan."
- isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
+ intent={{
+ ...ExternalKmsUpgradeIntent,
+ isEnterpriseFeature: Boolean(popUp.upgradePlan.data?.isEnterpriseFeature)
+ }}
/>
</form>
);
diff --git a/frontend/src/components/secret-syncs/CreateSecretSyncModal.tsx b/frontend/src/components/secret-syncs/CreateSecretSyncModal.tsx
index dddfb3c92a..afda3b998c 100644
--- a/frontend/src/components/secret-syncs/CreateSecretSyncModal.tsx
+++ b/frontend/src/components/secret-syncs/CreateSecretSyncModal.tsx
@@ -23,6 +23,7 @@ type Props = {
initialFormData?: Partial<TSecretSyncForm>;
initialFormDataIsDirty?: boolean;
startOnDestination?: boolean;
+ onEnterpriseUpgrade?: (onGranted: () => void) => void;
};
type ContentProps = {
@@ -33,6 +34,7 @@ type ContentProps = {
initialFormDataIsDirty?: boolean;
startOnDestination?: boolean;
onDirtyChange: (isDirty: boolean) => void;
+ onEnterpriseUpgrade?: (onGranted: () => void) => void;
};
const Content = ({
@@ -42,7 +44,8 @@ const Content = ({
initialFormData,
initialFormDataIsDirty,
startOnDestination,
- onDirtyChange
+ onDirtyChange,
+ onEnterpriseUpgrade
}: ContentProps) => {
if (selectedSync) {
return (
@@ -58,7 +61,7 @@ const Content = ({
);
}
- return <SecretSyncSelect onSelect={setSelectedSync} />;
+ return <SecretSyncSelect onSelect={setSelectedSync} onEnterpriseUpgrade={onEnterpriseUpgrade} />;
};
export const CreateSecretSyncModal = ({
@@ -67,7 +70,8 @@ export const CreateSecretSyncModal = ({
selectSync = null,
initialFormData,
initialFormDataIsDirty,
- startOnDestination
+ startOnDestination,
+ onEnterpriseUpgrade
}: Props) => {
const [selectedSync, setSelectedSync] = useState<SecretSync | null>(selectSync);
const [isDirty, setIsDirty] = useState(false);
@@ -127,6 +131,7 @@ export const CreateSecretSyncModal = ({
initialFormDataIsDirty={initialFormDataIsDirty}
startOnDestination={startOnDestination}
onDirtyChange={setIsDirty}
+ onEnterpriseUpgrade={onEnterpriseUpgrade}
/>
</div>
) : (
@@ -139,6 +144,7 @@ export const CreateSecretSyncModal = ({
initialFormDataIsDirty={initialFormDataIsDirty}
startOnDestination={startOnDestination}
onDirtyChange={setIsDirty}
+ onEnterpriseUpgrade={onEnterpriseUpgrade}
/>
</div>
)}
diff --git a/frontend/src/components/secret-syncs/SecretSyncSelect.tsx b/frontend/src/components/secret-syncs/SecretSyncSelect.tsx
index 9436b93731..2db4310f16 100644
--- a/frontend/src/components/secret-syncs/SecretSyncSelect.tsx
+++ b/frontend/src/components/secret-syncs/SecretSyncSelect.tsx
@@ -1,6 +1,10 @@
import { useMemo, useState } from "react";
import { Loader2Icon, Search } from "lucide-react";
+import {
+ EnterpriseSecretSyncsUpgradeIntent,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import {
Empty,
EmptyDescription,
@@ -14,13 +18,11 @@ import {
import { ProviderIcon } from "@app/components/v3/platform/ProviderIcon";
import { useSubscription } from "@app/context";
import { POPULAR_SECRET_SYNCS, SECRET_SYNC_MAP } from "@app/helpers/secretSyncs";
-import { usePopUp } from "@app/hooks";
import { SecretSync, useSecretSyncOptions } from "@app/hooks/api/secretSyncs";
-import { UpgradePlanModal } from "../license/UpgradePlanModal";
-
type Props = {
onSelect: (destination: SecretSync) => void;
+ onEnterpriseUpgrade?: (onGranted: () => void) => void;
};
type SyncOption = {
@@ -63,17 +65,21 @@ const SectionLabel = ({ children }: { children: React.ReactNode }) => (
<p className="mb-3 text-[11px] font-medium tracking-wider text-muted uppercase">{children}</p>
);
-export const SecretSyncSelect = ({ onSelect }: Props) => {
+export const SecretSyncSelect = ({ onSelect, onEnterpriseUpgrade }: Props) => {
const { subscription } = useSubscription();
const { isPending, data: secretSyncOptions } = useSecretSyncOptions();
- const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["upgradePlan"] as const);
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
const [search, setSearch] = useState("");
const handleSelect = (option: SyncOption) => {
if (option.enterprise && !subscription.enterpriseSecretSyncs) {
- handlePopUpOpen("upgradePlan", {
- isEnterpriseFeature: true,
- text: "All Secret Syncs can be unlocked if you switch to Infisical Enterprise plan."
+ if (onEnterpriseUpgrade) {
+ onEnterpriseUpgrade(() => onSelect(option.destination));
+ return;
+ }
+ openUpgradeGate({
+ intent: EnterpriseSecretSyncsUpgradeIntent,
+ paywallKey: "secret-manager.secret-sync-provider"
});
return;
}
@@ -192,13 +198,7 @@ export const SecretSyncSelect = ({ onSelect }: Props) => {
</>
)}
- <UpgradePlanModal
- paywallKey="secret-manager.secret-sync-provider"
- isOpen={popUp.upgradePlan.isOpen}
- isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text={popUp.upgradePlan.data?.text}
- />
+ {upgradeGate}
</div>
);
};
diff --git a/frontend/src/components/v3/platform/UpgradeGate/ProductUpgradeDialog.stories.tsx b/frontend/src/components/v3/platform/UpgradeGate/ProductUpgradeDialog.stories.tsx
new file mode 100644
index 0000000000..c965d9b47f
--- /dev/null
+++ b/frontend/src/components/v3/platform/UpgradeGate/ProductUpgradeDialog.stories.tsx
@@ -0,0 +1,342 @@
+import { CSSProperties, useState } from "react";
+import type { Meta, StoryObj } from "@storybook/react-vite";
+import { CircleAlert } from "lucide-react";
+import { expect, userEvent, waitFor, within } from "storybook/test";
+
+import { ProductUpgradeDialog } from "@app/components/license/UpgradeGate/ProductUpgradeDialog";
+import { ProductUpgradeSuccessDialog } from "@app/components/license/UpgradeGate/ProductUpgradeSuccessDialog";
+import {
+ Alert,
+ AlertDescription,
+ Badge,
+ Button,
+ Checkbox,
+ Label,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
+import { BillingV2CatalogProduct, BillingV2Plan } from "@app/hooks/api";
+import { fmtMoney } from "@app/pages/organization/BillingV2Page/billing-v2-format";
+
+const freePlan: BillingV2Plan = {
+ tier: "free",
+ name: "Free",
+ selfServe: false,
+ salesLed: false,
+ trialable: false,
+ upgradeable: false,
+ trialDays: 0,
+ dims: []
+};
+
+const proPlan: BillingV2Plan = {
+ ...freePlan,
+ tier: "pro",
+ name: "Pro",
+ selfServe: true,
+ trialable: true,
+ upgradeable: true,
+ trialDays: 14,
+ dims: [
+ {
+ key: "pam_identities",
+ label: "PAM identities",
+ noun: "PAM identity",
+ monthly: 20,
+ annual: 208,
+ included: 5,
+ meteredMonthly: true,
+ meteredAnnual: false
+ }
+ ]
+};
+
+const enterprisePlan: BillingV2Plan = {
+ ...freePlan,
+ tier: "enterprise",
+ name: "Enterprise",
+ salesLed: true
+};
+
+const product: BillingV2CatalogProduct = {
+ id: "pam",
+ name: "Privileged Access Management",
+ icon: "users",
+ color: "var(--color-product-pam)",
+ baselinePlan: freePlan,
+ plans: [proPlan, enterprisePlan],
+ compare: [
+ { label: "Privileged accounts", cells: { free: 5, pro: "Up to 50", enterprise: "Unlimited" } },
+ { label: "Approval workflows", cells: { free: false, pro: true, enterprise: true } },
+ { label: "Access requests", cells: { free: false, pro: true, enterprise: true } },
+ { label: "CLI-based resource access", cells: { free: false, pro: true, enterprise: true } },
+ {
+ label: "SSH certificate authentication",
+ cells: { free: false, pro: true, enterprise: true }
+ },
+ {
+ label: "Privileged credential rotation",
+ cells: { free: false, pro: true, enterprise: true }
+ },
+ { label: "Command blocking", cells: { free: false, pro: true, enterprise: true } },
+ {
+ label: "Session recording retention",
+ cells: { free: false, pro: "30 days", enterprise: "Custom" }
+ },
+ { label: "SCIM", cells: { free: false, pro: false, enterprise: true } }
+ ]
+};
+
+const descriptions: Record<string, string> = {
+ "Privileged accounts": "Manage privileged accounts and their credentials centrally.",
+ "Approval workflows": "Require approval before privileged access is granted.",
+ "Access requests": "Request access to privileged accounts before starting a session.",
+ "CLI-based resource access": "Connect to privileged resources from the Infisical CLI.",
+ "SSH certificate authentication": "Authenticate SSH sessions with short-lived certificates.",
+ "Privileged credential rotation":
+ "Rotate privileged credentials without distributing them to users.",
+ "Command blocking": "Block restricted commands during privileged sessions.",
+ "Session recording retention": "Keep session recordings available for review.",
+ SCIM: "Provision and deprovision users from your identity provider."
+};
+
+const meta = {
+ title: "License/Product Upgrade Dialog",
+ component: ProductUpgradeDialog,
+ parameters: {
+ layout: "centered",
+ docs: {
+ description: {
+ component:
+ "Minimal presentation states for the shared upgrade modal, using one illustrative catalog rather than separate examples per product. Trial pricing is monthly-only; paid pricing can switch cadence. The examples never perform billing mutations or reproduce backend eligibility checks. The enabled CTA receives initial focus, dismissal is interactive, and only the right-side body scrolls."
+ }
+ }
+ },
+ args: {
+ product,
+ plans: [freePlan, proPlan, enterprisePlan],
+ upgradeLabel: undefined,
+ requiredPlanName: "Pro",
+ selectedTier: "pro",
+ currentPlanTier: "free",
+ features: [],
+ footer: null,
+ onTierChange: () => undefined,
+ onOpenChange: () => undefined
+ },
+ render: function Render(args) {
+ const [isOpen, setIsOpen] = useState(true);
+ const [tier, setTier] = useState(args.selectedTier);
+ const [annual, setAnnual] = useState(true);
+ const plan = args.plans.find((candidate) => candidate.tier === tier) ?? args.plans[0];
+ const requiredIndex = args.plans.findIndex(
+ (candidate) => candidate.name === args.requiredPlanName
+ );
+ const meetsRequirement = args.plans.indexOf(plan) >= requiredIndex;
+ const features = (args.product.compare ?? []).flatMap((row) => {
+ const value = row.cells[plan.tier];
+ return value === false || value === undefined || value === 0
+ ? []
+ : [
+ {
+ label: row.label,
+ value: value === true ? undefined : String(value),
+ description: descriptions[row.label]
+ }
+ ];
+ });
+ const trialAvailable = meetsRequirement && plan.trialable && !plan.salesLed;
+ const contactSales = plan.salesLed || (!plan.selfServe && plan.tier !== "free");
+ const monthlyRate = plan.base?.monthly || plan.dims[0]?.monthly || 0;
+ const annualRate = plan.base?.annual || plan.dims[0]?.annual || 0;
+ const hasPeriodOption = !trialAvailable && monthlyRate > 0 && annualRate > 0;
+ const useAnnual = !trialAvailable && annual && annualRate > 0;
+ const meteredAnnual = !plan.base?.annual && plan.dims[0]?.meteredAnnual;
+ let price = monthlyRate;
+ if (useAnnual) price = meteredAnnual ? annualRate : annualRate / 12;
+ const noun = plan.dims[0]?.noun;
+ const unit = plan.base ? "/mo" : `/${noun}/${useAnnual && meteredAnnual ? "yr" : "mo"}`;
+ const priceLabel = price > 0 ? `${fmtMoney(price, 6)}${unit}` : "Usage-based";
+ const savingsPercent =
+ monthlyRate > 0 && annualRate > 0 && !meteredAnnual
+ ? Math.max(Math.round((1 - annualRate / 12 / monthlyRate) * 100), 0)
+ : 0;
+ const trialDuration = plan.trialDays === 14 ? "2-Week" : `${plan.trialDays}-Day`;
+ const trialPriceLabel =
+ plan.trialDays === 14 ? "FREE for 2 Weeks" : `FREE for ${plan.trialDays} Days`;
+ let action = "View Billing Options";
+ if (!meetsRequirement) action = `Select ${args.requiredPlanName} or higher`;
+ else if (contactSales) action = "Contact Sales";
+ else if (trialAvailable) action = `Start Free ${plan.name} Trial`;
+
+ if (!isOpen) {
+ return <Button onClick={() => setIsOpen(true)}>Open Upgrade Dialog</Button>;
+ }
+
+ return (
+ <ProductUpgradeDialog
+ {...args}
+ upgradeLabel={args.upgradeLabel ?? `Unlock ${args.product.name}`}
+ selectedTier={tier}
+ onTierChange={setTier}
+ onOpenChange={setIsOpen}
+ features={features}
+ notice={meetsRequirement && !trialAvailable && !plan.salesLed ? args.notice : undefined}
+ footer={
+ <>
+ {plan.tier === "free" && (
+ <div className="flex items-center justify-center gap-3 px-1 text-sm">
+ <span className="text-muted">Current plan</span>
+ <span className="font-medium text-foreground">FREE</span>
+ </div>
+ )}
+ {!plan.salesLed &&
+ plan.tier !== "free" &&
+ (trialAvailable ? (
+ <Tooltip key={plan.tier}>
+ <TooltipTrigger asChild>
+ <button
+ type="button"
+ className="flex w-full items-baseline justify-between gap-3 rounded-sm px-1 text-sm tabular-nums outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ <span className="text-muted line-through">{priceLabel}</span>
+ <span className="font-medium text-foreground">{trialPriceLabel}*</span>
+ </button>
+ </TooltipTrigger>
+ <TooltipContent
+ side="top"
+ className="w-96 max-w-(--radix-tooltip-content-available-width) leading-relaxed"
+ >
+ Your {trialDuration.toLowerCase()} trial is free. A payment method is required.
+ If you do not have one on file, secure card setup must finish before the trial
+ starts. After the trial, billing continues monthly based on usage unless you
+ cancel.
+ </TooltipContent>
+ </Tooltip>
+ ) : (
+ <div
+ className={`flex flex-wrap items-center gap-3 px-1 ${hasPeriodOption ? "justify-between" : "justify-center"}`}
+ >
+ {hasPeriodOption && (
+ <div className="flex items-center gap-2">
+ <Checkbox
+ id="story-annual-billing"
+ variant="org"
+ isChecked={annual}
+ onCheckedChange={(checked) => setAnnual(checked === true)}
+ />
+ <Label htmlFor="story-annual-billing">Annual Billing</Label>
+ {annual && savingsPercent > 0 && (
+ <Badge variant="success" className="min-h-4 px-1 py-0 text-[10px]">
+ -{savingsPercent}%
+ </Badge>
+ )}
+ </div>
+ )}
+ <div
+ className={`flex items-baseline gap-2 text-sm tabular-nums ${hasPeriodOption ? "ml-auto" : ""}`}
+ >
+ <span className="font-medium text-foreground">{priceLabel}</span>
+ </div>
+ </div>
+ ))}
+ <Button
+ data-upgrade-cta
+ variant="product"
+ className="w-full justify-center"
+ style={{ "--product-color": args.product.color } as CSSProperties}
+ isDisabled={!meetsRequirement}
+ >
+ {action}
+ </Button>
+ </>
+ }
+ />
+ );
+ }
+} satisfies Meta<typeof ProductUpgradeDialog>;
+
+export default meta;
+type Story = StoryObj<typeof meta>;
+
+export const Trial: Story = {
+ args: { upgradeLabel: "Unlock Approval Workflows" },
+ play: async ({ canvasElement }) => {
+ const body = within(canvasElement.ownerDocument.body);
+ const getAction = () => body.getByRole("button", { name: "Start Free Pro Trial" });
+
+ await waitFor(() => expect(getAction()).toHaveFocus());
+ await userEvent.click(body.getByRole("tab", { name: "Enterprise" }));
+ await expect(body.getByRole("tab", { name: "Enterprise" })).toHaveFocus();
+ await userEvent.click(body.getByRole("tab", { name: "Pro" }));
+ await expect(body.getByRole("tab", { name: "Pro" })).toHaveFocus();
+ await userEvent.keyboard("{Escape}");
+ await userEvent.click(await body.findByRole("button", { name: "Open Upgrade Dialog" }));
+ await waitFor(() => expect(getAction()).toHaveFocus());
+ }
+};
+
+export const Paid: Story = {
+ args: {
+ plans: [freePlan, { ...proPlan, trialable: false }, enterprisePlan],
+ notice: (
+ <Alert variant="info" appearance="borderless">
+ <CircleAlert />
+ <AlertDescription>
+ Free trial for Privileged Access Management has already been used.
+ </AlertDescription>
+ </Alert>
+ )
+ }
+};
+
+export const SalesLed: Story = {
+ args: { selectedTier: "enterprise" },
+ play: async ({ canvasElement }) => {
+ const body = within(canvasElement.ownerDocument.body);
+ await waitFor(() => expect(body.getByRole("button", { name: "Contact Sales" })).toHaveFocus());
+ }
+};
+
+export const BelowRequiredTier: Story = {
+ args: { selectedTier: "free" },
+ play: async ({ canvasElement }) => {
+ const body = within(canvasElement.ownerDocument.body);
+ await waitFor(() => expect(body.getByRole("tab", { name: "Free · Current" })).toHaveFocus());
+ await expect(body.getByRole("button", { name: "Select Pro or higher" })).not.toHaveFocus();
+ }
+};
+
+export const TrialSuccess: Story = {
+ render: function Render(args) {
+ const [isOpen, setIsOpen] = useState(true);
+ return isOpen ? (
+ <ProductUpgradeSuccessDialog
+ product={args.product}
+ plan={proPlan}
+ isTrialing
+ trialEndsAt="Oct 15, 2026"
+ onOpenChange={setIsOpen}
+ />
+ ) : (
+ <Button onClick={() => setIsOpen(true)}>Open Success Dialog</Button>
+ );
+ }
+};
+
+export const PlanActivated: Story = {
+ render: function Render(args) {
+ const [isOpen, setIsOpen] = useState(true);
+ return isOpen ? (
+ <ProductUpgradeSuccessDialog
+ product={args.product}
+ plan={proPlan}
+ isTrialing={false}
+ onOpenChange={setIsOpen}
+ />
+ ) : (
+ <Button onClick={() => setIsOpen(true)}>Open Success Dialog</Button>
+ );
+ }
+};
diff --git a/frontend/src/components/v3/platform/UpgradeGate/UpgradeDialogLayout.stories.tsx b/frontend/src/components/v3/platform/UpgradeGate/UpgradeDialogLayout.stories.tsx
new file mode 100644
index 0000000000..a691727c13
--- /dev/null
+++ b/frontend/src/components/v3/platform/UpgradeGate/UpgradeDialogLayout.stories.tsx
@@ -0,0 +1,100 @@
+import { useState } from "react";
+import type { Meta, StoryObj } from "@storybook/react-vite";
+import { CircleAlert, Server, Shield } from "lucide-react";
+
+import { UpgradeDialogLayout } from "@app/components/license/UpgradeGate/UpgradeDialogLayout";
+import { Alert, AlertDescription, Button } from "@app/components/v3";
+
+const meta = {
+ title: "License/Capability Upgrade Dialog",
+ component: UpgradeDialogLayout,
+ args: {
+ scopeName: "Infisical Platform",
+ icon: <Shield className="size-10 text-muted" />,
+ title: "Unlock Groups",
+ description: "Review your organization's subscription options.",
+ onOpenChange: () => undefined,
+ children: (
+ <>
+ <p className="text-sm text-foreground">
+ Manage access for teams by organizing members into groups.
+ </p>
+ <Alert variant="info">
+ <CircleAlert />
+ <AlertDescription>
+ This capability is shared across products. Review your billing options to find a
+ subscription that includes it.
+ </AlertDescription>
+ </Alert>
+ </>
+ ),
+ footer: (
+ <Button data-upgrade-cta variant="org" className="w-full">
+ View Plans
+ </Button>
+ )
+ },
+ render: function Render(args) {
+ const [isOpen, setIsOpen] = useState(true);
+ return isOpen ? (
+ <UpgradeDialogLayout {...args} onOpenChange={setIsOpen} />
+ ) : (
+ <Button onClick={() => setIsOpen(true)}>Open Upgrade Dialog</Button>
+ );
+ }
+} satisfies Meta<typeof UpgradeDialogLayout>;
+
+export default meta;
+type Story = StoryObj<typeof meta>;
+
+export const Platform: Story = {};
+
+export const SubOrganization: Story = {
+ args: {
+ children: (
+ <>
+ <p className="text-sm text-foreground">
+ Manage access for teams by organizing members into groups.
+ </p>
+ <Alert variant="info">
+ <CircleAlert />
+ <AlertDescription>
+ Sub-organizations share the root organization&apos;s subscription. Review available
+ options in root billing.
+ </AlertDescription>
+ </Alert>
+ </>
+ ),
+ footer: (
+ <Button data-upgrade-cta variant="org" className="w-full">
+ Continue to Root Billing
+ </Button>
+ )
+ }
+};
+
+export const Instance: Story = {
+ args: {
+ scopeName: "Infisical Instance",
+ icon: <Server className="size-10 text-muted" />,
+ title: "Unlock Instance User Management",
+ description: "Review licensing for your self-hosted instance.",
+ children: (
+ <>
+ <p className="text-sm text-foreground">Manage users across your self-hosted instance.</p>
+ <Alert variant="info">
+ <CircleAlert />
+ <AlertDescription>
+ This capability is licensed for the entire instance, not an individual product. Contact
+ our team to discuss your deployment.
+ </AlertDescription>
+ </Alert>
+ </>
+ ),
+ footer: (
+ <Button data-upgrade-cta variant="org" className="w-full">
+ Contact Sales
+ </Button>
+ )
+ }
+};
diff --git a/frontend/src/hooks/api/billingV2/mutations.tsx b/frontend/src/hooks/api/billingV2/mutations.tsx
index 3d132c1798..9aedffbe18 100644
--- a/frontend/src/hooks/api/billingV2/mutations.tsx
+++ b/frontend/src/hooks/api/billingV2/mutations.tsx
@@ -183,10 +183,10 @@ export const useChangeBillingV2Commitment = () => {
export const useStartBillingV2Trial = () => {
const queryClient = useQueryClient();
return useMutation({
- mutationFn: async ({ orgId, productId, plan }: TStartBillingV2TrialDTO) => {
+ mutationFn: async ({ orgId, productId, plan, returnPath }: TStartBillingV2TrialDTO) => {
const { data } = await apiRequest.post<BillingV2TrialResult>(
`/api/v1/organizations/${orgId}/billing/v2/trial`,
- { productId, plan }
+ { productId, plan, returnPath }
);
return data;
diff --git a/frontend/src/hooks/api/billingV2/queries.tsx b/frontend/src/hooks/api/billingV2/queries.tsx
index 13ccdf1870..e5818ae779 100644
--- a/frontend/src/hooks/api/billingV2/queries.tsx
+++ b/frontend/src/hooks/api/billingV2/queries.tsx
@@ -21,7 +21,10 @@ export const billingV2Keys = {
[{ orgId, search: search || undefined, ...rest }, "billing-v2-organizations"] as const
};
-export const useGetBillingV2Overview = (orgId: string) => {
+export const useGetBillingV2Overview = (
+ orgId: string,
+ options?: { enabled?: boolean; staleTime?: number }
+) => {
return useQuery({
queryKey: billingV2Keys.overview(orgId),
queryFn: async () => {
@@ -33,13 +36,14 @@ export const useGetBillingV2Overview = (orgId: string) => {
return overview;
},
- enabled: Boolean(orgId),
+ enabled: Boolean(orgId) && (options?.enabled ?? true),
+ ...(options?.staleTime !== undefined ? { staleTime: options.staleTime } : {}),
placeholderData: keepPreviousData,
refetchOnWindowFocus: "always"
});
};
-export const useGetBillingV2Catalog = (orgId: string) => {
+export const useGetBillingV2Catalog = (orgId: string, options?: { enabled?: boolean }) => {
return useQuery({
queryKey: billingV2Keys.catalog(orgId),
queryFn: async () => {
@@ -51,7 +55,7 @@ export const useGetBillingV2Catalog = (orgId: string) => {
return products;
},
- enabled: Boolean(orgId),
+ enabled: Boolean(orgId) && (options?.enabled ?? true),
placeholderData: keepPreviousData
});
};
diff --git a/frontend/src/hooks/api/billingV2/types.ts b/frontend/src/hooks/api/billingV2/types.ts
index 60818772d2..a7c9f3f66e 100644
--- a/frontend/src/hooks/api/billingV2/types.ts
+++ b/frontend/src/hooks/api/billingV2/types.ts
@@ -28,7 +28,8 @@ export type BillingV2Deprecation = {
daysLeft: number | null;
};
-// A single purchasable (or sales-led) plan of a product. The free tier is implicit and never listed.
+// A single product plan. Purchasable and sales-led plans are listed in product.plans; an optional
+// free plan is exposed separately as product.baselinePlan for comparison only.
export type BillingV2Plan = {
tier: string;
name: string;
@@ -62,6 +63,7 @@ export type BillingV2CatalogProduct = {
deprecation?: BillingV2Deprecation;
// Sort key across products; the product list renders in this order.
displayOrder?: number;
+ baselinePlan?: BillingV2Plan;
plans: BillingV2Plan[];
includes?: string[];
compare?: BillingV2CompareRow[];
@@ -348,6 +350,7 @@ export type TStartBillingV2TrialDTO = {
orgId: string;
productId: string;
plan: string;
+ returnPath?: string;
};
export type TCancelBillingV2TrialDTO = {
diff --git a/frontend/src/hooks/api/pam/mutations.tsx b/frontend/src/hooks/api/pam/mutations.tsx
index 426edd52c3..6454be2bd6 100644
--- a/frontend/src/hooks/api/pam/mutations.tsx
+++ b/frontend/src/hooks/api/pam/mutations.tsx
@@ -134,7 +134,7 @@ export const useCreatePamAccount = () => {
const queryClient = useQueryClient();
return useMutation({
// Validation errors are mapped onto the form fields
- meta: { skipValidationToast: true },
+ meta: { skipValidationToast: true, handledErrorCodes: ["PAM_ACCOUNT_LIMIT_REACHED"] },
mutationFn: async ({ accountType, ...params }: TCreatePamAccountDTO) => {
const { data } = await apiRequest.post(`/api/v1/pam/accounts/${accountType}`, params);
return { ...data.account, corsProbeUrl: data.corsProbeUrl as string | null | undefined };
diff --git a/frontend/src/hooks/api/subscriptions/types.ts b/frontend/src/hooks/api/subscriptions/types.ts
index 63f3b8621a..215fe04cdf 100644
--- a/frontend/src/hooks/api/subscriptions/types.ts
+++ b/frontend/src/hooks/api/subscriptions/types.ts
@@ -108,6 +108,8 @@ export type SubscriptionPlan = {
secretsBrokering: boolean;
agentVaultByoS3: boolean;
pam?: boolean | null;
+ enterprisePamAccount?: boolean | null;
+ maxPamAccounts?: number | null;
certManager?: boolean | null;
secretsFolderRbac: boolean;
crossProjectSecretSharing: boolean;
diff --git a/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx b/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx
index 9bc5827e8d..a1b2160d88 100644
--- a/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx
+++ b/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx
@@ -71,6 +71,7 @@ import { SidebarTrigger } from "@app/components/v3/generic/Sidebar";
import { type Theme, useTheme } from "@app/components/v3/platform/ThemeProvider";
import { envConfig } from "@app/config/env";
import {
+ OrgPermissionBillingActions,
OrgPermissionMemberActions,
OrgPermissionSubjects,
useOrganization,
@@ -103,6 +104,7 @@ import { navigateUserToOrg } from "@app/pages/auth/LoginPage/Login.utils";
import { ServerAdminsPanel } from "../ServerAdminsPanel/ServerAdminsPanel";
import { NotificationDropdown } from "./NotificationDropdown";
+import { OrganizationProductPlans } from "./OrganizationProductPlans";
import { VersionBadge } from "./VersionBadge";
const getFormattedSupportEmailLink = (variables: {
@@ -404,7 +406,7 @@ export const Navbar = () => {
<div
className={twMerge(
"flex h-full min-w-0 items-center overflow-hidden border-border-soft pr-2 pl-4 transition-all duration-300 ease-in-out",
- isProjectScope ? "mr-2 w-[72px] border-r" : "mr-4 w-96 max-w-96"
+ isProjectScope ? "mr-2 w-[72px] border-r" : "mr-4 max-w-96"
)}
>
<NavbarSwitcher open={isOrgSelectOpen} onOpenChange={setIsOrgSelectOpen}>
@@ -611,6 +613,20 @@ export const Navbar = () => {
</NavbarSwitcherContent>
</NavbarSwitcher>
</div>
+ {!isProjectScope && (
+ <OrgPermissionCan
+ I={OrgPermissionBillingActions.Read}
+ a={OrgPermissionSubjects.Billing}
+ >
+ {(isAllowed) => (
+ <OrganizationProductPlans
+ plans={subscription.productPlans}
+ isSubOrganization={isSubOrganization}
+ billingOrgId={isAllowed ? (currentOrg.rootOrgId ?? currentOrg.id) : undefined}
+ />
+ )}
+ </OrgPermissionCan>
+ )}
{isProjectScope && (
<>
<TypeSelect />
diff --git a/frontend/src/layouts/OrganizationLayout/components/NavBar/OrganizationProductPlans.tsx b/frontend/src/layouts/OrganizationLayout/components/NavBar/OrganizationProductPlans.tsx
new file mode 100644
index 0000000000..7404e2f75e
--- /dev/null
+++ b/frontend/src/layouts/OrganizationLayout/components/NavBar/OrganizationProductPlans.tsx
@@ -0,0 +1,53 @@
+import { Link } from "@tanstack/react-router";
+import { ChevronDown, CreditCard } from "lucide-react";
+
+import { getProductPlanSummaries } from "@app/components/license/product-plan-summary";
+import { ProductPlanSummaryList } from "@app/components/license/ProductPlanSummaryList";
+import { Button, Popover, PopoverContent, PopoverTrigger, Separator } from "@app/components/v3";
+import { SubscriptionPlan } from "@app/hooks/api/subscriptions/types";
+
+type Props = {
+ plans: SubscriptionPlan["productPlans"];
+ billingOrgId?: string;
+ isSubOrganization: boolean;
+};
+
+export const OrganizationProductPlans = ({ plans, billingOrgId, isSubOrganization }: Props) => {
+ const summaries = getProductPlanSummaries(plans);
+ if (!summaries.length) return null;
+
+ return (
+ <Popover>
+ <PopoverTrigger asChild>
+ <Button variant="ghost" size="xs" aria-label="View Product Plans" className="shrink-0">
+ <CreditCard />
+ <span className="max-sm:hidden">Product Plans</span>
+ <ChevronDown />
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent align="start" side="bottom" collisionPadding={16}>
+ <div className="flex flex-col gap-4">
+ <div>
+ <p className="text-sm font-medium">Product Plans</p>
+ <p className="mt-1 text-xs text-muted">
+ {isSubOrganization
+ ? "Shared with your root organization."
+ : "Your organization's current product subscriptions."}
+ </p>
+ </div>
+ <ProductPlanSummaryList plans={summaries} />
+ {billingOrgId && (
+ <>
+ <Separator />
+ <Button variant="outline" size="xs" className="self-end" asChild>
+ <Link to="/organizations/$orgId/billing" params={{ orgId: billingOrgId }}>
+ View Billing
+ </Link>
+ </Button>
+ </>
+ )}
+ </div>
+ </PopoverContent>
+ </Popover>
+ );
+};
diff --git a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/OrgSubmenuView.tsx b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/OrgSubmenuView.tsx
index ff7722d83c..fecad2a54f 100644
--- a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/OrgSubmenuView.tsx
+++ b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/OrgSubmenuView.tsx
@@ -10,7 +10,7 @@ import {
SlidersHorizontal
} from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { SubOrganizationsUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { SidebarGroup, SidebarGroupLabel, SidebarMenu, SubOrgIcon } from "@app/components/v3";
import { useOrganization, useSubscription } from "@app/context";
import { usePopUp } from "@app/hooks/usePopUp";
@@ -110,11 +110,14 @@ export const OrgSettingsSubmenuView = ({ onBack }: { onBack: () => void }) => {
/>
))}
</SidebarMenu>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.sub-organizations"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="You need to upgrade your plan to manage sub-organizations."
+ intent={{
+ ...SubOrganizationsUpgradeIntent,
+ isEnterpriseFeature: false
+ }}
/>
</SidebarGroup>
);
diff --git a/frontend/src/layouts/PamLayout/PamLayout.tsx b/frontend/src/layouts/PamLayout/PamLayout.tsx
index 77895d9cd1..eb26cb458c 100644
--- a/frontend/src/layouts/PamLayout/PamLayout.tsx
+++ b/frontend/src/layouts/PamLayout/PamLayout.tsx
@@ -1,28 +1,28 @@
-import { useEffect, useState } from "react";
+import { useEffect } from "react";
import { Outlet } from "@tanstack/react-router";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { PamUpgradeIntent, useUpgradeGate } from "@app/components/license/UpgradeGate";
import { useSubscription } from "@app/context";
export const PamLayout = () => {
const { subscription } = useSubscription();
const isPamGated = subscription?.pam === false;
- const [isUpgradeModalOpen, setIsUpgradeModalOpen] = useState(isPamGated);
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
useEffect(() => {
- if (isPamGated) setIsUpgradeModalOpen(true);
- }, [isPamGated]);
+ if (!isPamGated) return;
+
+ openUpgradeGate({
+ intent: PamUpgradeIntent,
+ paywallKey: "pam.product-access"
+ });
+ }, [isPamGated, openUpgradeGate]);
return (
<>
<Outlet />
- <UpgradePlanModal
- paywallKey="pam.product-access"
- isOpen={isUpgradeModalOpen}
- onOpenChange={setIsUpgradeModalOpen}
- text="PAM is not available on your current plan. Upgrade to continue using it."
- />
+ {upgradeGate}
</>
);
};
diff --git a/frontend/src/layouts/PkiManagerLayout/PkiManagerLayout.tsx b/frontend/src/layouts/PkiManagerLayout/PkiManagerLayout.tsx
index 38e5b1a45f..5f28f365b9 100644
--- a/frontend/src/layouts/PkiManagerLayout/PkiManagerLayout.tsx
+++ b/frontend/src/layouts/PkiManagerLayout/PkiManagerLayout.tsx
@@ -1,30 +1,33 @@
-import { useEffect, useState } from "react";
+import { useEffect } from "react";
import { Outlet } from "@tanstack/react-router";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import {
+ CertificateManagementUpgradeIntent,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import { useSubscription } from "@app/context";
export const PkiManagerLayout = () => {
const { subscription } = useSubscription();
const isCertManagerGated = subscription?.certManager === false;
- const [isUpgradeModalOpen, setIsUpgradeModalOpen] = useState(isCertManagerGated);
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
useEffect(() => {
- if (isCertManagerGated) setIsUpgradeModalOpen(true);
- }, [isCertManagerGated]);
+ if (!isCertManagerGated) return;
+
+ openUpgradeGate({
+ intent: CertificateManagementUpgradeIntent,
+ paywallKey: "cert-manager.product-access"
+ });
+ }, [isCertManagerGated, openUpgradeGate]);
return (
<div className="flex h-full w-full flex-col overflow-x-hidden">
<div className="flex-1 overflow-x-hidden overflow-y-auto p-6 md:p-10">
<Outlet />
</div>
- <UpgradePlanModal
- paywallKey="cert-manager.product-access"
- isOpen={isUpgradeModalOpen}
- onOpenChange={setIsUpgradeModalOpen}
- text="Certificate Manager is not available on your current plan. Upgrade to continue using it."
- />
+ {upgradeGate}
</div>
);
};
diff --git a/frontend/src/layouts/ProjectLayout/components/ProjectSelect/ProjectSelect.tsx b/frontend/src/layouts/ProjectLayout/components/ProjectSelect/ProjectSelect.tsx
index b942e0145b..9a10b6d22f 100644
--- a/frontend/src/layouts/ProjectLayout/components/ProjectSelect/ProjectSelect.tsx
+++ b/frontend/src/layouts/ProjectLayout/components/ProjectSelect/ProjectSelect.tsx
@@ -2,7 +2,7 @@ import { useMemo, useState } from "react";
import { Link, linkOptions, useParams } from "@tanstack/react-router";
import { Check, Plus, Star } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { ProjectLimitUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { OrgPermissionCan } from "@app/components/permissions";
import { NewProjectModal } from "@app/components/projects";
import {
@@ -254,11 +254,11 @@ const ProjectSelectInner = () => {
</Command>
</NavbarSwitcherContent>
</NavbarSwitcher>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="project.limit"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="You've reached the maximum number of projects available on the Free plan. Upgrade to the Infisical Pro plan to create more projects."
+ intent={ProjectLimitUpgradeIntent}
/>
<NewProjectModal
isOpen={popUp.addNewWs.isOpen}
diff --git a/frontend/src/layouts/ProjectLayout/components/TypeSelect/ProductPlanBadge.tsx b/frontend/src/layouts/ProjectLayout/components/TypeSelect/ProductPlanBadge.tsx
index ffdff1d417..6811b9b46a 100644
--- a/frontend/src/layouts/ProjectLayout/components/TypeSelect/ProductPlanBadge.tsx
+++ b/frontend/src/layouts/ProjectLayout/components/TypeSelect/ProductPlanBadge.tsx
@@ -1,51 +1,26 @@
+import { getProductPlanSummaries } from "@app/components/license/product-plan-summary";
import { Badge } from "@app/components/v3";
import { useSubscription } from "@app/context";
import { ProjectType } from "@app/hooks/api/projects/types";
const PRODUCT_KEYS: Partial<Record<ProjectType, string>> = {
- [ProjectType.SecretManager]: "secrets_manager",
+ [ProjectType.SecretManager]: "secrets_management",
[ProjectType.CertificateManager]: "cert_management",
[ProjectType.PAM]: "pam"
};
-const PLAN_LABELS = new Map([
- ["pro", "Pro"],
- ["advanced", "Advanced"],
- ["enterprise", "Enterprise"],
- ["legacy_pro_annual", "Pro"],
- ["legacy_team", "Team"],
- ["legacy_team_annual", "Team"],
- ["legacy_enterprise", "Enterprise"]
-]);
-
export const ProductPlanBadge = ({ type }: { type: ProjectType }) => {
const { subscription } = useSubscription();
const productKey = PRODUCT_KEYS[type];
- const plans = subscription.productPlans ?? [];
- const product =
- plans.find((plan) => plan.productKey === productKey) ??
- (type === ProjectType.SecretManager
- ? plans.find((plan) => plan.productKey === "legacy_secret_management")
- : undefined);
- const trialEndsAt = product?.trialEndsAt ? new Date(product.trialEndsAt).getTime() : null;
-
- if (!product || !["active", "trialing", "grace"].includes(product.status ?? "")) {
- return null;
- }
-
- const hasActiveTrial =
- Boolean(product.trialPlanKey || product.status === "trialing") &&
- (!product.trialEndsAt || (trialEndsAt !== null && trialEndsAt > Date.now()));
- if (product.status === "trialing" && !hasActiveTrial && !product.trialPlanKey) return null;
-
- const planKey = hasActiveTrial ? (product.trialPlanKey ?? product.planKey) : product.planKey;
- const label = planKey ? PLAN_LABELS.get(planKey) : undefined;
- if (!label) return null;
+ const product = getProductPlanSummaries(subscription.productPlans).find(
+ (plan) => plan.productKey === productKey
+ );
+ if (!product || product.planLabel === "Free") return null;
return (
<Badge variant="info" className="shrink-0 max-sm:hidden">
- {label}
+ {product.planLabel}
</Badge>
);
};
diff --git a/frontend/src/layouts/ProjectLayout/components/TypeSelect/TypeSelect.tsx b/frontend/src/layouts/ProjectLayout/components/TypeSelect/TypeSelect.tsx
index e8d4f3cc97..4005f45129 100644
--- a/frontend/src/layouts/ProjectLayout/components/TypeSelect/TypeSelect.tsx
+++ b/frontend/src/layouts/ProjectLayout/components/TypeSelect/TypeSelect.tsx
@@ -132,7 +132,7 @@ const TypeSelectInner = ({
});
}
}}
- className="group grid min-w-min cursor-pointer grid-flow-col grid-cols-[auto_minmax(0,1fr)] items-center gap-x-2 overflow-hidden text-sm text-foreground-inverse"
+ className="group grid min-w-min cursor-pointer grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-2 overflow-hidden text-sm text-foreground-inverse"
>
<ProductIcon className="h-[14px] w-[14px] shrink-0" />
<span className="truncate">{pillLabel}</span>
diff --git a/frontend/src/pages/admin/AccessManagementPage/components/ServerAdminsTable.tsx b/frontend/src/pages/admin/AccessManagementPage/components/ServerAdminsTable.tsx
index ff48a37e4c..3103b15608 100644
--- a/frontend/src/pages/admin/AccessManagementPage/components/ServerAdminsTable.tsx
+++ b/frontend/src/pages/admin/AccessManagementPage/components/ServerAdminsTable.tsx
@@ -10,7 +10,10 @@ import {
UsersIcon
} from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import {
+ InstanceUserManagementUpgradeIntent,
+ UpgradeGate
+} from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import {
Badge,
@@ -397,11 +400,13 @@ export const ServerAdminsTable = () => {
isOpen={popUp.addServerAdmin.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("addServerAdmin", isOpen)}
/>
- <UpgradePlanModal
+ <UpgradeGate
+ intent={{
+ ...InstanceUserManagementUpgradeIntent
+ }}
paywallKey="admin.server-admins"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="Your current plan does not allow removing server admins. To unlock this feature, please upgrade to Infisical Pro plan."
/>
<ConfirmActionDialog
isOpen={popUp.removeUsers.isOpen}
diff --git a/frontend/src/pages/admin/EncryptionPage/components/EncryptionPageForm.tsx b/frontend/src/pages/admin/EncryptionPage/components/EncryptionPageForm.tsx
index 2d192f8735..35e2c5b101 100644
--- a/frontend/src/pages/admin/EncryptionPage/components/EncryptionPageForm.tsx
+++ b/frontend/src/pages/admin/EncryptionPage/components/EncryptionPageForm.tsx
@@ -4,7 +4,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { InfoIcon } from "lucide-react";
import { z } from "zod";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { InstanceHsmUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import {
Badge,
@@ -71,10 +71,7 @@ export const EncryptionPageForm = () => {
if (!subscription) return;
if (!subscription.hsm) {
- handlePopUpOpen("upgradePlan", {
- isEnterpriseFeature: true,
- text: "Your current plan does not include access to Hardware Security Module (HSM). To unlock this feature, please upgrade to Infisical Enterprise plan."
- });
+ handlePopUpOpen("upgradePlan");
return;
}
@@ -157,12 +154,11 @@ export const EncryptionPageForm = () => {
</form>
</CardContent>
</Card>
- <UpgradePlanModal
+ <UpgradeGate
+ intent={InstanceHsmUpgradeIntent}
paywallKey="admin.encryption-page"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text={popUp.upgradePlan?.data?.text}
- isEnterpriseFeature={popUp.upgradePlan?.data?.isEnterpriseFeature}
/>
</>
);
diff --git a/frontend/src/pages/admin/ResourceOverviewPage/components/UserIdentitiesTable.tsx b/frontend/src/pages/admin/ResourceOverviewPage/components/UserIdentitiesTable.tsx
index dce902b750..34e69a12bd 100644
--- a/frontend/src/pages/admin/ResourceOverviewPage/components/UserIdentitiesTable.tsx
+++ b/frontend/src/pages/admin/ResourceOverviewPage/components/UserIdentitiesTable.tsx
@@ -12,7 +12,10 @@ import {
UsersIcon
} from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import {
+ InstanceUserManagementUpgradeIntent,
+ UpgradeGate
+} from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import {
Badge,
@@ -259,7 +262,7 @@ const UserPanelTable = ({
handlePopUpOpen("upgradePlan", {
username,
id,
- text: "Your current plan does not allow setting additional server admins. To unlock this feature, please upgrade to Infisical Pro plan."
+ text: "Your current plan does not allow setting additional server admins. Contact our team to update your instance license."
});
return;
}
@@ -281,7 +284,7 @@ const UserPanelTable = ({
handlePopUpOpen("upgradePlan", {
username,
id,
- text: "Your current plan does not allow removing server admins. To unlock this feature, please upgrade to Infisical Pro plan."
+ text: "Your current plan does not allow removing server admins. Contact our team to update your instance license."
});
return;
}
@@ -493,11 +496,13 @@ export const UserIdentitiesTable = () => {
onConfirm={handleRemoveServerAdminAccess}
confirmLabel="Remove Access"
/>
- <UpgradePlanModal
+ <UpgradeGate
+ intent={{
+ ...InstanceUserManagementUpgradeIntent
+ }}
paywallKey="admin.user-identities"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text={popUp.upgradePlan.data?.text}
/>
<ConfirmActionDialog
isOpen={popUp.removeUsers.isOpen}
diff --git a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx
index d7f6bc4edc..414b84336f 100644
--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx
@@ -7,7 +7,10 @@ import { Link, useParams } from "@tanstack/react-router";
import { formatDistance } from "date-fns";
import { MoreHorizontalIcon, PencilIcon, PlusIcon, Settings2Icon, Trash2Icon } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import {
+ CertificateApprovalPoliciesUpgradeIntent,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { DeleteActionModal } from "@app/components/v2";
import {
@@ -301,16 +304,16 @@ export const ApplicationSettingsTab = ({ application, profiles }: Props) => {
const { popUp, handlePopUpToggle, handlePopUpOpen, handlePopUpClose } = usePopUp([
"policy",
- "deletePolicy",
- "upgradePlan"
+ "deletePolicy"
] as const);
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
// Creation only; existing policies keep enforcing and their requests can still be approved.
const handleCreatePolicy = () => {
if (!subscription.pkiApprovals) {
- handlePopUpOpen("upgradePlan", {
- isEnterpriseFeature: true,
- text: "Certificate approval policies are available on Infisical's Enterprise plan."
+ openUpgradeGate({
+ intent: CertificateApprovalPoliciesUpgradeIntent,
+ paywallKey: "cert-manager.application-settings"
});
return;
}
@@ -637,12 +640,7 @@ export const ApplicationSettingsTab = ({ application, profiles }: Props) => {
handlePopUpToggle={handlePopUpToggle}
applicationId={application.id}
/>
- <UpgradePlanModal
- paywallKey="cert-manager.application-settings"
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text={(popUp.upgradePlan?.data as { text: string })?.text}
- />
+ {upgradeGate}
<DeleteActionModal
isOpen={popUp.deletePolicy.isOpen}
deleteKey="delete"
diff --git a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSyncsTab.tsx b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSyncsTab.tsx
index 65980bf0ba..606c41b6de 100644
--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSyncsTab.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSyncsTab.tsx
@@ -1,7 +1,7 @@
import { useState } from "react";
import { PlusIcon } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { CertificateSyncsUpgradeIntent, useUpgradeGate } from "@app/components/license/UpgradeGate";
import { CreatePkiSyncModal } from "@app/components/pki-syncs";
import {
Button,
@@ -21,7 +21,6 @@ import {
useGetPkiApplicationPermissions
} from "@app/hooks/api/pkiApplications";
import { useListPkiSyncs } from "@app/hooks/api/pkiSyncs";
-import { usePopUp } from "@app/hooks/usePopUp";
import { PkiSyncsTable } from "../../IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable";
import { PkiDocsUrls } from "../../pki-docs-urls";
@@ -31,12 +30,15 @@ type Props = { applicationId: string; applicationName: string; projectId: string
export const ApplicationSyncsTab = ({ applicationId, applicationName, projectId }: Props) => {
const [isAddSyncOpen, setIsAddSyncOpen] = useState(false);
const { subscription } = useSubscription();
- const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["upgradePlan"] as const);
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
// Every sync destination is enterprise, so refuse here rather than after the destination picker.
const handleAddSync = () => {
if (!subscription.pkiSyncs) {
- handlePopUpOpen("upgradePlan");
+ openUpgradeGate({
+ intent: CertificateSyncsUpgradeIntent,
+ paywallKey: "cert-manager.application-syncs"
+ });
return;
}
setIsAddSyncOpen(true);
@@ -88,12 +90,7 @@ export const ApplicationSyncsTab = ({ applicationId, applicationName, projectId
onOpenChange={setIsAddSyncOpen}
applicationId={applicationId}
/>
- <UpgradePlanModal
- paywallKey="cert-manager.application-syncs"
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="Certificate Syncs are available on Infisical's Enterprise plan."
- />
+ {upgradeGate}
</Card>
);
};
diff --git a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ConfigureEnrollmentModal.tsx b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ConfigureEnrollmentModal.tsx
index c314fca30a..b49adc6b5d 100644
--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ConfigureEnrollmentModal.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ConfigureEnrollmentModal.tsx
@@ -13,6 +13,10 @@ import {
} from "lucide-react";
import { AppConnectionOption } from "@app/components/app-connections";
+import {
+ CertificateEnrollmentUpgradeIntent,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { Spinner, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
import {
@@ -1399,6 +1403,7 @@ export const ConfigureEnrollmentModal = ({
const [dirtyMethods, setDirtyMethods] = useState<Partial<Record<EnrollmentMethod, boolean>>>({});
const { subscription } = useSubscription();
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
const ALL_ORDER: EnrollmentMethod[] = ["api", "est", "acme", "scep"];
const visibleMethods = ALL_ORDER.filter(
@@ -1443,6 +1448,18 @@ export const ConfigureEnrollmentModal = ({
setActiveTab(method);
};
+ const handleAddMethod = (method: EnrollmentMethod) => {
+ if (!lockedMethods[method]) {
+ handleAdd(method);
+ return;
+ }
+
+ openUpgradeGate({
+ intent: CertificateEnrollmentUpgradeIntent,
+ paywallKey: `cert-manager.application-enrollment.${method}`
+ });
+ };
+
const handleCancelPending = (method: EnrollmentMethod) =>
setPendingMethods((prev) => prev.filter((m) => m !== method));
@@ -1527,11 +1544,7 @@ export const ConfigureEnrollmentModal = ({
{addableMethods.map((m) => {
const isLocked = lockedMethods[m] ?? false;
return (
- <DropdownMenuItem
- key={m}
- isDisabled={isLocked}
- onClick={() => handleAdd(m)}
- >
+ <DropdownMenuItem key={m} onClick={() => handleAddMethod(m)}>
<div className="flex flex-col">
<span className="flex items-center gap-2 font-medium">
{METHOD_LABELS[m]}
@@ -1643,6 +1656,7 @@ export const ConfigureEnrollmentModal = ({
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
+ {upgradeGate}
</Dialog>
);
};
diff --git a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaRevocationSection.tsx b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaRevocationSection.tsx
index 34fa8cd603..7b8507dde7 100644
--- a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaRevocationSection.tsx
+++ b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaRevocationSection.tsx
@@ -4,7 +4,10 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { PencilIcon, PlusIcon, Trash2Icon } from "lucide-react";
import { z } from "zod";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import {
+ CertificateRevocationListsUpgradeIntent,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
@@ -96,8 +99,9 @@ const editSchema = z.object({
type EditFormData = z.infer<typeof editSchema>;
export const CaRevocationSection = ({ caId }: Props) => {
- const { popUp, handlePopUpToggle } = usePopUp(["editRevocation", "upgradePlan"] as const);
+ const { popUp, handlePopUpToggle } = usePopUp(["editRevocation"] as const);
const { subscription } = useSubscription();
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
const { data } = useGetCa({ caId, type: CaType.INTERNAL });
const ca = data as TInternalCertificateAuthority | undefined;
@@ -132,7 +136,10 @@ export const CaRevocationSection = ({ caId }: Props) => {
const handleAddCrlUrl = () => {
if (!subscription.caCrl) {
- handlePopUpToggle("upgradePlan", true);
+ openUpgradeGate({
+ intent: CertificateRevocationListsUpgradeIntent,
+ paywallKey: "cert-manager.ca-distribution-points"
+ });
return;
}
crlUrls.append({ value: "" });
@@ -371,12 +378,7 @@ export const CaRevocationSection = ({ caId }: Props) => {
</DialogContent>
</Dialog>
- <UpgradePlanModal
- paywallKey="cert-manager.ca-distribution-points"
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="Custom CRL distribution points are available on Infisical's Enterprise plan."
- />
+ {upgradeGate}
</>
);
};
diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/CaInstallCertModal.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/CaInstallCertModal.tsx
index 1ad5aab6cc..4c3e033d65 100644
--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/CaInstallCertModal.tsx
+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/CaInstallCertModal.tsx
@@ -7,6 +7,10 @@ import {
ShieldCheckIcon
} from "lucide-react";
+import {
+ ExternalCertificateAuthoritiesUpgradeIntent,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import { Modal, ModalContent } from "@app/components/v2";
import { Badge, Button } from "@app/components/v3";
import { useSubscription } from "@app/context";
@@ -118,11 +122,10 @@ const RadioCard = ({
<button
type="button"
onClick={onClick}
- disabled={isLocked}
- className={`flex items-center gap-4 rounded-md border px-4 py-4 text-left transition-colors disabled:cursor-not-allowed disabled:opacity-60 ${
+ className={`flex items-center gap-4 rounded-md border px-4 py-4 text-left transition-colors ${
isSelected
? "border-project/50 bg-project/5"
- : "border-border-control bg-surface-hover enabled:hover:bg-surface-active"
+ : "border-border-control bg-surface-hover hover:bg-surface-active"
} ${className ?? ""}`}
>
{icon}
@@ -149,6 +152,7 @@ export const CaInstallCertModal = ({ popUp, handlePopUpToggle }: Props) => {
const caId = popupData?.caId ?? "";
const { subscription } = useSubscription();
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
// Signing an intermediate outside Infisical: Manual is the CSR/import flow, Automated connects a
// third-party provider. Infisical CA stays available on every plan.
@@ -183,6 +187,18 @@ export const CaInstallCertModal = ({ popUp, handlePopUpToggle }: Props) => {
setStep(Step.Form);
};
+ const handleSelectMethod = (method: SigningMethod) => {
+ if (!lockedMethods[method]) {
+ setSelectedMethod(method);
+ return;
+ }
+
+ openUpgradeGate({
+ intent: ExternalCertificateAuthoritiesUpgradeIntent,
+ paywallKey: "cert-manager.intermediate-ca-signing"
+ });
+ };
+
const handleIntegrationContinue = () => {
if (!selectedIntegration) return;
setStep(Step.Form);
@@ -218,7 +234,7 @@ export const CaInstallCertModal = ({ popUp, handlePopUpToggle }: Props) => {
key={option.value}
isSelected={selectedMethod === option.value}
isLocked={lockedMethods[option.value]}
- onClick={() => setSelectedMethod(option.value)}
+ onClick={() => handleSelectMethod(option.value)}
icon={
<div className="flex h-10 w-10 shrink-0 items-center justify-center rounded-md bg-surface-active">
<option.icon className="h-5 w-5 text-label" />
@@ -364,23 +380,26 @@ export const CaInstallCertModal = ({ popUp, handlePopUpToggle }: Props) => {
const needsOverflowVisible = step === Step.Form && selectedMethod === SigningMethod.Automated;
return (
- <Modal
- isOpen={popUp?.installCaCert?.isOpen}
- onOpenChange={(isOpen) => {
- if (!isOpen) resetState();
- handlePopUpToggle("installCaCert", isOpen);
- }}
- >
- <ModalContent
- title={getTitle()}
- className="max-w-lg"
- bodyClassName={needsOverflowVisible ? "overflow-visible" : undefined}
- subTitle={getSubTitle()}
+ <>
+ <Modal
+ isOpen={popUp?.installCaCert?.isOpen}
+ onOpenChange={(isOpen) => {
+ if (!isOpen) resetState();
+ handlePopUpToggle("installCaCert", isOpen);
+ }}
>
- {step === Step.ChooseMethod && renderMethodSelection()}
- {step === Step.ChooseIntegration && renderIntegrationSelection()}
- {step === Step.Form && renderFormStep()}
- </ModalContent>
- </Modal>
+ <ModalContent
+ title={getTitle()}
+ className="max-w-lg"
+ bodyClassName={needsOverflowVisible ? "overflow-visible" : undefined}
+ subTitle={getSubTitle()}
+ >
+ {step === Step.ChooseMethod && renderMethodSelection()}
+ {step === Step.ChooseIntegration && renderIntegrationSelection()}
+ {step === Step.Form && renderFormStep()}
+ </ModalContent>
+ </Modal>
+ {upgradeGate}
+ </>
);
};
diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaSection.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaSection.tsx
index 4f56a337de..da9e893dd0 100644
--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaSection.tsx
+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaSection.tsx
@@ -1,7 +1,10 @@
import { useState } from "react";
import { PlusIcon } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import {
+ CertificateAuthoritiesUpgradeIntent,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import { DeleteActionModal } from "@app/components/v2";
@@ -48,20 +51,22 @@ export const CaSection = () => {
"caCert",
"installCaCert",
"deleteCa",
- "caStatus", // enable / disable
- "upgradePlan"
+ "caStatus" // enable / disable
] as const);
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
const { data: caQuota } = useGetCaQuota();
// An internal CA counts against both caps, so whichever runs out first blocks it. The message names
// that one, since "1 of 1 internal CAs" and "1 of 1 CAs" call for different upgrades.
const exhausted = [
{
+ key: "maxCas" as const,
one: "certificate authority",
many: "certificate authorities",
...caQuota?.certificateAuthorities
},
{
+ key: "maxInternalCas" as const,
one: "internal certificate authority",
many: "internal certificate authorities",
...caQuota?.internalCertificateAuthorities
@@ -72,8 +77,9 @@ export const CaSection = () => {
if (exhausted) {
// The allowance is shared across the organization and any sub-organizations, while this table
// shows one project, so the count is named rather than left to look like a mismatch.
- handlePopUpOpen("upgradePlan", {
- text: `Your plan includes ${exhausted.limit} ${exhausted.limit === 1 ? exhausted.one : exhausted.many}. Your organization is using ${exhausted.used}. Upgrade to add more.`
+ openUpgradeGate({
+ intent: CertificateAuthoritiesUpgradeIntent,
+ paywallKey: "cert-manager.ca"
});
return;
}
@@ -147,12 +153,7 @@ export const CaSection = () => {
<CaTable handlePopUpOpen={handlePopUpOpen} />
</CardContent>
<CreateCaWizard isOpen={isCreateWizardOpen} onOpenChange={setIsCreateWizardOpen} />
- <UpgradePlanModal
- paywallKey="cert-manager.ca"
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text={(popUp.upgradePlan?.data as { text: string })?.text}
- />
+ {upgradeGate}
<CaInstallCertModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} />
<CaCertModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} />
<DeleteActionModal
diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/KeyValidityStep.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/KeyValidityStep.tsx
index 7286424258..c98331ad2b 100644
--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/KeyValidityStep.tsx
+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CreateCaWizard/KeyValidityStep.tsx
@@ -1,5 +1,9 @@
import { Controller, UseFormReturn } from "react-hook-form";
+import {
+ PostQuantumCertificatesUpgradeIntent,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import {
Badge,
Field,
@@ -37,6 +41,7 @@ type Props = {
export const KeyValidityStep = ({ form, hsmConnectorOptions, isHsmConnectorsLoading }: Props) => {
const { subscription } = useSubscription();
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
const isHsmLicensed = Boolean(subscription?.hsm);
const { permission } = useProjectPermission();
const canAttachHsm = permission.can(
@@ -151,7 +156,19 @@ export const KeyValidityStep = ({ form, hsmConnectorOptions, isHsmConnectorsLoad
Key algorithm <span className="text-danger">*</span>
</FieldLabel>
<FieldContent>
- <Select value={field.value} onValueChange={field.onChange}>
+ <Select
+ value={field.value}
+ onValueChange={(value) => {
+ if (isPqcAlgorithm(value) && !subscription.pkiPqc) {
+ openUpgradeGate({
+ intent: PostQuantumCertificatesUpgradeIntent,
+ paywallKey: "cert-manager.ca-key-algorithm"
+ });
+ return;
+ }
+ field.onChange(value);
+ }}
+ >
<SelectTrigger className="w-full">
<SelectValue />
</SelectTrigger>
@@ -159,7 +176,7 @@ export const KeyValidityStep = ({ form, hsmConnectorOptions, isHsmConnectorsLoad
{options.map(({ label, value }) => {
const pqcLocked = isPqcAlgorithm(value) && !subscription?.pkiPqc;
return (
- <SelectItem key={value} value={value} disabled={pqcLocked}>
+ <SelectItem key={value} value={value}>
<div className="flex items-center gap-2">
{label}
{pqcLocked && <Badge variant="info">Enterprise</Badge>}
@@ -227,6 +244,7 @@ export const KeyValidityStep = ({ form, hsmConnectorOptions, isHsmConnectorsLoad
/>
</>
)}
+ {upgradeGate}
</FieldGroup>
);
};
diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsx
index c6fbfc0ae1..385165bf26 100644
--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsx
+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsx
@@ -3,6 +3,10 @@ import { Controller, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { ArrowLeftIcon, Loader2Icon, Lock, type LucideIcon, Search } from "lucide-react";
+import {
+ ExternalCertificateAuthoritiesUpgradeIntent,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import {
Badge,
@@ -193,8 +197,7 @@ const CaTypeCard = ({
<button
type="button"
onClick={onClick}
- disabled={isLocked}
- className="group flex cursor-pointer flex-col gap-3 rounded-md border border-border bg-card p-4 text-left transition-colors enabled:hover:border-border-strong enabled:hover:bg-surface-hover/50 disabled:cursor-not-allowed disabled:opacity-60"
+ className="group flex cursor-pointer flex-col gap-3 rounded-md border border-border bg-card p-4 text-left transition-colors hover:border-border-strong hover:bg-surface-hover/50"
>
<div className="flex items-start justify-between gap-2">
<div className="flex h-9 w-9 items-center justify-center rounded-md bg-surface-hover">
@@ -227,6 +230,7 @@ const CaTypeCard = ({
export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {
const { currentProject } = useProject();
const { subscription } = useSubscription();
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
const { data: ca, isLoading: isCaLoading } = useGetCa({
caId: (popUp?.ca?.data as { caId: string })?.caId || "",
@@ -356,7 +360,13 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {
type !== CaType.ACME && !subscription.pkiEnterpriseCaIntegrations;
const handleSelectType = (type: CaType) => {
- if (isCaTypeLocked(type)) return;
+ if (isCaTypeLocked(type)) {
+ openUpgradeGate({
+ intent: ExternalCertificateAuthoritiesUpgradeIntent,
+ paywallKey: "cert-manager.external-ca-type"
+ });
+ return;
+ }
reset(getInitialValuesForType(type));
setSelectedType(type);
};
@@ -907,211 +917,214 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {
});
return (
- <Sheet
- open={popUp?.ca?.isOpen}
- onOpenChange={(isOpen) => {
- if (!isOpen) {
- reset();
- setSelectedType(null);
- setSearch("");
- }
- handlePopUpToggle("ca", isOpen);
- }}
- >
- <SheetContent className="flex h-full max-h-full flex-col gap-y-0 p-0 sm:max-w-2xl">
- <SheetHeader className="border-b border-border">
+ <>
+ <Sheet
+ open={popUp?.ca?.isOpen}
+ onOpenChange={(isOpen) => {
+ if (!isOpen) {
+ reset();
+ setSelectedType(null);
+ setSearch("");
+ }
+ handlePopUpToggle("ca", isOpen);
+ }}
+ >
+ <SheetContent className="flex h-full max-h-full flex-col gap-y-0 p-0 sm:max-w-2xl">
+ <SheetHeader className="border-b border-border">
+ {showGrid ? (
+ <>
+ <SheetTitle>Connect External CA</SheetTitle>
+ <SheetDescription>
+ Select the third-party certificate authority to connect to. Infisical issues
+ through it rather than hosting the signing key.
+ </SheetDescription>
+ </>
+ ) : (
+ <>
+ {!isEditMode && (
+ <button
+ type="button"
+ onClick={() => setSelectedType(null)}
+ className="mb-1 flex w-fit cursor-pointer items-center gap-1 text-xs text-muted transition-colors hover:text-foreground hover:underline"
+ >
+ <ArrowLeftIcon className="size-3" />
+ Select Another CA
+ </button>
+ )}
+ <SheetTitle>
+ <ExternalCaHeader
+ name={headerTitle}
+ subtitle="Define the connection and credentials used to issue certificates from this CA."
+ image={activeTypeMedia?.image}
+ icon={activeTypeMedia?.icon}
+ />
+ </SheetTitle>
+ </>
+ )}
+ </SheetHeader>
+
+ {/* eslint-disable-next-line no-nested-ternary */}
{showGrid ? (
- <>
- <SheetTitle>Connect External CA</SheetTitle>
- <SheetDescription>
- Select the third-party certificate authority to connect to. Infisical issues through
- it rather than hosting the signing key.
- </SheetDescription>
- </>
- ) : (
- <>
- {!isEditMode && (
- <button
- type="button"
- onClick={() => setSelectedType(null)}
- className="mb-1 flex w-fit cursor-pointer items-center gap-1 text-xs text-muted transition-colors hover:text-foreground hover:underline"
- >
- <ArrowLeftIcon className="size-3" />
- Select Another CA
- </button>
- )}
- <SheetTitle>
- <ExternalCaHeader
- name={headerTitle}
- subtitle="Define the connection and credentials used to issue certificates from this CA."
- image={activeTypeMedia?.image}
- icon={activeTypeMedia?.icon}
+ <div className="flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto p-6">
+ <InputGroup>
+ <InputGroupAddon align="inline-start">
+ <Search />
+ </InputGroupAddon>
+ <InputGroupInput
+ value={search}
+ onChange={(e) => setSearch(e.target.value)}
+ placeholder="Search certificate authorities..."
/>
- </SheetTitle>
- </>
- )}
- </SheetHeader>
-
- {/* eslint-disable-next-line no-nested-ternary */}
- {showGrid ? (
- <div className="flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto p-6">
- <InputGroup>
- <InputGroupAddon align="inline-start">
- <Search />
- </InputGroupAddon>
- <InputGroupInput
- value={search}
- onChange={(e) => setSearch(e.target.value)}
- placeholder="Search certificate authorities..."
- />
- </InputGroup>
- <div className="grid grid-cols-2 gap-3">
- {filteredCaOptions.map((option) => (
- <CaTypeCard
- key={option.type}
- option={option}
- onClick={() => handleSelectType(option.type)}
- isLocked={isCaTypeLocked(option.type)}
- />
- ))}
+ </InputGroup>
+ <div className="grid grid-cols-2 gap-3">
+ {filteredCaOptions.map((option) => (
+ <CaTypeCard
+ key={option.type}
+ option={option}
+ onClick={() => handleSelectType(option.type)}
+ isLocked={isCaTypeLocked(option.type)}
+ />
+ ))}
+ </div>
</div>
- </div>
- ) : isEditMode && isCaLoading ? (
- <div className="flex min-h-0 flex-1 items-center justify-center">
- <Loader2Icon className="size-8 animate-spin text-accent" />
- </div>
- ) : (
- <form onSubmit={handleSubmit(onFormSubmit)} className="flex min-h-0 flex-1 flex-col">
- <div className="min-h-0 flex-1 overflow-y-auto px-6 py-6">
- {ca && (
- <Field className="mb-4">
- <FieldLabel>CA ID</FieldLabel>
- <Input value={ca.id} disabled />
- </Field>
- )}
- <Controller
- control={control}
- defaultValue=""
- name="name"
- render={({ field, fieldState: { error } }) => (
+ ) : isEditMode && isCaLoading ? (
+ <div className="flex min-h-0 flex-1 items-center justify-center">
+ <Loader2Icon className="size-8 animate-spin text-accent" />
+ </div>
+ ) : (
+ <form onSubmit={handleSubmit(onFormSubmit)} className="flex min-h-0 flex-1 flex-col">
+ <div className="min-h-0 flex-1 overflow-y-auto px-6 py-6">
+ {ca && (
<Field className="mb-4">
- <FieldLabel>
- Name <span className="text-danger">*</span>
- </FieldLabel>
- <Input
- {...field}
- placeholder="my-external-ca"
- disabled={Boolean(ca)}
- isError={Boolean(error)}
- autoComplete="off"
- name="certificate-authority-name"
- />
- {!error && (
- <FieldDescription>
- Must be slug-friendly: lowercase letters, numbers, and hyphens only.
- </FieldDescription>
- )}
- <FieldError errors={[error]} />
+ <FieldLabel>CA ID</FieldLabel>
+ <Input value={ca.id} disabled />
</Field>
)}
- />
- {caType === CaType.ACME && (
- <AcmeFields
- control={control}
- isExistingCa={Boolean(ca)}
- dnsProvider={dnsProvider}
- directoryUrl={directoryUrl}
- dnsAppConnection={dnsAppConnection}
- availableConnections={dnsAppConnections}
- isPending={isPending}
- zones={zones}
- isZonesPending={isZonesPending}
- setValue={setValue}
- onDnsSelectionChange={() =>
- setValue("configuration.dnsProviderConfig.hostedZoneId", "", {
- shouldDirty: true
- })
- }
- />
- )}
- {caType === CaType.AZURE_AD_CS && (
- <AzureAdCsFields
- control={control}
- availableConnections={availableConnections}
- isPending={isPending}
- />
- )}
- {caType === CaType.ADCS && (
- <AdcsFields
- control={control}
- availableConnections={availableConnections}
- isPending={isPending}
- />
- )}
- {caType === CaType.AWS_PCA && (
- <AwsPcaFields
- control={control}
- availableConnections={availableConnections}
- isPending={isPending}
- />
- )}
- {caType === CaType.DIGICERT && (
- <DigiCertFields
+ <Controller
control={control}
- setValue={setValue}
- configuration={configuration}
- availableConnections={availableConnections}
- isPending={isPending}
- digicertConnectionId={digicertConnectionId}
- digicertOrganizations={digicertOrganizations}
- isDigiCertOrgsPending={isDigiCertOrgsPending}
- digicertProducts={digicertProducts}
- isDigiCertProductsPending={isDigiCertProductsPending}
- csRequiresContact={csRequiresContact}
+ defaultValue=""
+ name="name"
+ render={({ field, fieldState: { error } }) => (
+ <Field className="mb-4">
+ <FieldLabel>
+ Name <span className="text-danger">*</span>
+ </FieldLabel>
+ <Input
+ {...field}
+ placeholder="my-external-ca"
+ disabled={Boolean(ca)}
+ isError={Boolean(error)}
+ autoComplete="off"
+ name="certificate-authority-name"
+ />
+ {!error && (
+ <FieldDescription>
+ Must be slug-friendly: lowercase letters, numbers, and hyphens only.
+ </FieldDescription>
+ )}
+ <FieldError errors={[error]} />
+ </Field>
+ )}
/>
- )}
- {caType === CaType.AWS_ACM_PUBLIC_CA && (
- <AwsAcmPublicCaFields
- control={control}
- availableConnections={availableConnections}
- isPending={isPending}
- />
- )}
- {caType === CaType.VENAFI_TPP && (
- <VenafiTppFields
- control={control}
- availableConnections={availableConnections}
- isPending={isPending}
- />
- )}
- {caType === CaType.GODADDY && (
- <GoDaddyFields
- control={control}
- availableConnections={availableConnections}
- isPending={isPending}
- />
- )}
- </div>
- <div className="flex shrink-0 items-center justify-end gap-3 border-t border-border px-6 py-4">
- <Button
- type="button"
- variant="outline"
- onClick={() => handlePopUpToggle("ca", false)}
- >
- Cancel
- </Button>
- <Button
- type="submit"
- variant="project"
- isPending={isSubmitting || isCheckingCsValidation}
- isDisabled={isSubmitting || isCheckingCsValidation}
- >
- {isEditMode ? "Update" : "Create"}
- </Button>
- </div>
- </form>
- )}
- </SheetContent>
- </Sheet>
+ {caType === CaType.ACME && (
+ <AcmeFields
+ control={control}
+ isExistingCa={Boolean(ca)}
+ dnsProvider={dnsProvider}
+ directoryUrl={directoryUrl}
+ dnsAppConnection={dnsAppConnection}
+ availableConnections={dnsAppConnections}
+ isPending={isPending}
+ zones={zones}
+ isZonesPending={isZonesPending}
+ setValue={setValue}
+ onDnsSelectionChange={() =>
+ setValue("configuration.dnsProviderConfig.hostedZoneId", "", {
+ shouldDirty: true
+ })
+ }
+ />
+ )}
+ {caType === CaType.AZURE_AD_CS && (
+ <AzureAdCsFields
+ control={control}
+ availableConnections={availableConnections}
+ isPending={isPending}
+ />
+ )}
+ {caType === CaType.ADCS && (
+ <AdcsFields
+ control={control}
+ availableConnections={availableConnections}
+ isPending={isPending}
+ />
+ )}
+ {caType === CaType.AWS_PCA && (
+ <AwsPcaFields
+ control={control}
+ availableConnections={availableConnections}
+ isPending={isPending}
+ />
+ )}
+ {caType === CaType.DIGICERT && (
+ <DigiCertFields
+ control={control}
+ setValue={setValue}
+ configuration={configuration}
+ availableConnections={availableConnections}
+ isPending={isPending}
+ digicertConnectionId={digicertConnectionId}
+ digicertOrganizations={digicertOrganizations}
+ isDigiCertOrgsPending={isDigiCertOrgsPending}
+ digicertProducts={digicertProducts}
+ isDigiCertProductsPending={isDigiCertProductsPending}
+ csRequiresContact={csRequiresContact}
+ />
+ )}
+ {caType === CaType.AWS_ACM_PUBLIC_CA && (
+ <AwsAcmPublicCaFields
+ control={control}
+ availableConnections={availableConnections}
+ isPending={isPending}
+ />
+ )}
+ {caType === CaType.VENAFI_TPP && (
+ <VenafiTppFields
+ control={control}
+ availableConnections={availableConnections}
+ isPending={isPending}
+ />
+ )}
+ {caType === CaType.GODADDY && (
+ <GoDaddyFields
+ control={control}
+ availableConnections={availableConnections}
+ isPending={isPending}
+ />
+ )}
+ </div>
+ <div className="flex shrink-0 items-center justify-end gap-3 border-t border-border px-6 py-4">
+ <Button
+ type="button"
+ variant="outline"
+ onClick={() => handlePopUpToggle("ca", false)}
+ >
+ Cancel
+ </Button>
+ <Button
+ type="submit"
+ variant="project"
+ isPending={isSubmitting || isCheckingCsValidation}
+ isDisabled={isSubmitting || isCheckingCsValidation}
+ >
+ {isEditMode ? "Update" : "Create"}
+ </Button>
+ </div>
+ </form>
+ )}
+ </SheetContent>
+ </Sheet>
+ {upgradeGate}
+ </>
);
};
diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaSection.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaSection.tsx
index a6d1744cc8..6a28249faf 100644
--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaSection.tsx
+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaSection.tsx
@@ -1,6 +1,9 @@
import { PlusIcon } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import {
+ CertificateAuthoritiesUpgradeIntent,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import { DeleteActionModal } from "@app/components/v2";
@@ -34,9 +37,9 @@ export const ExternalCaSection = () => {
const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
"ca",
"deleteCa",
- "caStatus", // enable / disable
- "upgradePlan"
+ "caStatus" // enable / disable
] as const);
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
// maxCas covers every CA type, so an external CA is capped the same way an internal one is.
// maxInternalCas is deliberately not consulted here: it caps INTERNAL only.
@@ -46,8 +49,9 @@ export const ExternalCaSection = () => {
const handleCreateCa = () => {
if (isAtCaLimit) {
- handlePopUpOpen("upgradePlan", {
- text: `Your plan includes ${caLimit.limit} certificate ${caLimit.limit === 1 ? "authority" : "authorities"}. Your organization is using ${caLimit.used}. Upgrade to add more.`
+ openUpgradeGate({
+ intent: CertificateAuthoritiesUpgradeIntent,
+ paywallKey: "cert-manager.external-ca"
});
return;
}
@@ -154,12 +158,7 @@ export const ExternalCaSection = () => {
}
/>
- <UpgradePlanModal
- paywallKey="cert-manager.external-ca"
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text={(popUp.upgradePlan?.data as { text: string })?.text}
- />
+ {upgradeGate}
</Card>
);
};
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/AlgorithmSelectors.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/AlgorithmSelectors.tsx
index f7408cfe9e..df6ac45d00 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/AlgorithmSelectors.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/AlgorithmSelectors.tsx
@@ -1,6 +1,10 @@
import { ReactNode } from "react";
import { Control, Controller } from "react-hook-form";
+import {
+ PostQuantumCertificatesUpgradeIntent,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import {
Badge,
Field,
@@ -51,7 +55,7 @@ const AlgorithmOptions = ({ options, nonePlaceholder, caKeyAlgorithm }: Algorith
<SelectItem
key={algorithm.value}
value={algorithm.value}
- disabled={isGated || Boolean(incompatibilityReason)}
+ disabled={Boolean(incompatibilityReason)}
>
<span className="flex items-center gap-2">
{algorithm.label}
@@ -107,38 +111,54 @@ const AlgorithmSelect = ({
selectPlaceholder,
children,
disabledReason
-}: AlgorithmSelectProps) => (
- <Controller
- control={control}
- name={name}
- shouldUnregister={shouldUnregister}
- render={({ field: { onChange, value } }) => (
- <Field>
- <FieldLabel>
- {label} {isRequired && <span className="text-danger">*</span>}
- </FieldLabel>
- <Select
- value={value ?? (nonePlaceholder ? NONE_VALUE : "")}
- onValueChange={(e) => onChange(e === NONE_VALUE ? null : e)}
- disabled={Boolean(disabledReason)}
- >
- <SelectTrigger className="w-full" isError={Boolean(error)}>
- {value ? (
- <SelectValue />
- ) : (
- <span className="text-muted">
- {options.length > 0 ? selectPlaceholder : "No algorithms available"}
- </span>
- )}
- </SelectTrigger>
- <SelectContent position="popper">{children}</SelectContent>
- </Select>
- {disabledReason && <FieldDescription>{disabledReason}</FieldDescription>}
- <FieldError>{error}</FieldError>
- </Field>
- )}
- />
-);
+}: AlgorithmSelectProps) => {
+ const { subscription } = useSubscription();
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
+
+ return (
+ <Controller
+ control={control}
+ name={name}
+ shouldUnregister={shouldUnregister}
+ render={({ field: { onChange, value } }) => (
+ <Field>
+ <FieldLabel>
+ {label} {isRequired && <span className="text-danger">*</span>}
+ </FieldLabel>
+ <Select
+ value={value ?? (nonePlaceholder ? NONE_VALUE : "")}
+ onValueChange={(nextValue) => {
+ const normalizedValue = nextValue === NONE_VALUE ? null : nextValue;
+ if (normalizedValue && isPqcAlgorithm(normalizedValue) && !subscription.pkiPqc) {
+ openUpgradeGate({
+ intent: PostQuantumCertificatesUpgradeIntent,
+ paywallKey: "cert-manager.certificate-algorithm"
+ });
+ return;
+ }
+ onChange(normalizedValue);
+ }}
+ disabled={Boolean(disabledReason)}
+ >
+ <SelectTrigger className="w-full" isError={Boolean(error)}>
+ {value ? (
+ <SelectValue />
+ ) : (
+ <span className="text-muted">
+ {options.length > 0 ? selectPlaceholder : "No algorithms available"}
+ </span>
+ )}
+ </SelectTrigger>
+ <SelectContent position="popper">{children}</SelectContent>
+ </Select>
+ {disabledReason && <FieldDescription>{disabledReason}</FieldDescription>}
+ <FieldError>{error}</FieldError>
+ {upgradeGate}
+ </Field>
+ )}
+ />
+ );
+};
type AlgorithmSelectorsProps = {
control: Control<any>;
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateTemplateModal.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateTemplateModal.tsx
deleted file mode 100644
index 29cb457726..0000000000
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateTemplateModal.tsx
+++ /dev/null
@@ -1,484 +0,0 @@
-import { useEffect } from "react";
-import { Controller, useForm } from "react-hook-form";
-import { faQuestionCircle } from "@fortawesome/free-regular-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { zodResolver } from "@hookform/resolvers/zod";
-import { z } from "zod";
-
-import { createNotification } from "@app/components/notifications";
-import {
- Accordion,
- AccordionContent,
- AccordionItem,
- AccordionTrigger,
- Button,
- Checkbox,
- FormControl,
- FormLabel,
- Input,
- Modal,
- ModalContent,
- Select,
- SelectItem,
- Tooltip
-} from "@app/components/v2";
-import { useProject } from "@app/context";
-import {
- CaStatus,
- useCreateCertTemplate,
- useGetCertTemplate,
- useGetInternalCaById,
- useListWorkspaceCas,
- useListWorkspacePkiCollections,
- useUpdateCertTemplate
-} from "@app/hooks/api";
-import { caTypeToNameMap } from "@app/hooks/api/ca/constants";
-import {
- buildExtendedKeyUsageToggleSchema,
- EXTENDED_KEY_USAGES_OPTIONS,
- KEY_USAGES_OPTIONS
-} from "@app/hooks/api/certificates/constants";
-import { CertKeyUsage } from "@app/hooks/api/certificates/enums";
-import { UsePopUpState } from "@app/hooks/usePopUp";
-
-const validateTemplateRegexField = z.string().trim().min(1).max(100);
-
-const schema = z.object({
- caId: z.string(),
- collectionId: z.string().optional(),
- name: z.string().min(1),
- commonName: validateTemplateRegexField,
- subjectAlternativeName: validateTemplateRegexField,
- ttl: z.string().trim().min(1),
- keyUsages: z.object({
- [CertKeyUsage.DIGITAL_SIGNATURE]: z.boolean().optional(),
- [CertKeyUsage.KEY_ENCIPHERMENT]: z.boolean().optional(),
- [CertKeyUsage.NON_REPUDIATION]: z.boolean().optional(),
- [CertKeyUsage.DATA_ENCIPHERMENT]: z.boolean().optional(),
- [CertKeyUsage.KEY_AGREEMENT]: z.boolean().optional(),
- [CertKeyUsage.KEY_CERT_SIGN]: z.boolean().optional(),
- [CertKeyUsage.CRL_SIGN]: z.boolean().optional(),
- [CertKeyUsage.ENCIPHER_ONLY]: z.boolean().optional(),
- [CertKeyUsage.DECIPHER_ONLY]: z.boolean().optional()
- }),
- extendedKeyUsages: z.object({
- ...buildExtendedKeyUsageToggleSchema(z.boolean().optional())
- })
-});
-
-export type FormData = z.infer<typeof schema>;
-
-type Props = {
- caId: string;
- popUp: UsePopUpState<["certificateTemplate"]>;
- handlePopUpToggle: (
- popUpName: keyof UsePopUpState<["certificateTemplate"]>,
- state?: boolean
- ) => void;
-};
-
-export const CertificateTemplateModal = ({ popUp, handlePopUpToggle, caId }: Props) => {
- const { currentProject } = useProject();
-
- const { data: ca } = useGetInternalCaById(caId);
-
- const { data: certTemplate } = useGetCertTemplate(
- (popUp?.certificateTemplate?.data as { id: string })?.id || ""
- );
-
- const { data: cas } = useListWorkspaceCas({
- projectId: currentProject?.id,
- status: CaStatus.ACTIVE
- });
-
- const { data: collectionsData } = useListWorkspacePkiCollections({
- projectId: currentProject?.id || ""
- });
-
- const { mutateAsync: createCertTemplate } = useCreateCertTemplate();
- const { mutateAsync: updateCertTemplate } = useUpdateCertTemplate();
-
- const {
- control,
- handleSubmit,
- reset,
- formState: { isSubmitting }
- } = useForm<FormData>({
- resolver: zodResolver(schema),
- defaultValues: {
- keyUsages: {
- [CertKeyUsage.DIGITAL_SIGNATURE]: true,
- [CertKeyUsage.KEY_ENCIPHERMENT]: true
- }
- }
- });
-
- useEffect(() => {
- if (certTemplate) {
- reset({
- caId: certTemplate.caId,
- name: certTemplate.name,
- commonName: certTemplate.commonName,
- subjectAlternativeName: certTemplate.subjectAlternativeName,
- collectionId: certTemplate.pkiCollectionId ?? undefined,
- ttl: certTemplate.ttl,
- keyUsages: Object.fromEntries(certTemplate.keyUsages.map((name) => [name, true]) ?? []),
- extendedKeyUsages: Object.fromEntries(
- certTemplate.extendedKeyUsages.map((name) => [name, true]) ?? []
- )
- });
- } else {
- reset({
- caId,
- name: "",
- commonName: "",
- ttl: "",
- keyUsages: {
- [CertKeyUsage.DIGITAL_SIGNATURE]: true,
- [CertKeyUsage.KEY_ENCIPHERMENT]: true
- },
- extendedKeyUsages: {}
- });
- }
- }, [certTemplate, ca]);
-
- const onFormSubmit = async ({
- collectionId,
- name,
- commonName,
- subjectAlternativeName,
- ttl,
- keyUsages,
- extendedKeyUsages
- }: FormData) => {
- if (!currentProject?.id) {
- return;
- }
-
- if (certTemplate) {
- await updateCertTemplate({
- id: certTemplate.id,
- projectId: currentProject.id,
- pkiCollectionId: collectionId,
- caId,
- name,
- commonName,
- subjectAlternativeName,
- ttl,
- keyUsages: Object.entries(keyUsages)
- .filter(([, value]) => value)
- .map(([key]) =>
- key === CertKeyUsage.CRL_SIGN
- ? "cRLSign"
- : key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase())
- ),
- extendedKeyUsages: Object.entries(extendedKeyUsages)
- .filter(([, value]) => value)
- .map(([key]) => key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase()))
- });
-
- createNotification({
- text: "Successfully updated certificate template",
- type: "success"
- });
- } else {
- await createCertTemplate({
- projectId: currentProject.id,
- pkiCollectionId: collectionId,
- caId,
- name,
- commonName,
- subjectAlternativeName,
- ttl,
- keyUsages: Object.entries(keyUsages)
- .filter(([, value]) => value)
- .map(([key]) =>
- key === CertKeyUsage.CRL_SIGN
- ? "cRLSign"
- : key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase())
- ),
- extendedKeyUsages: Object.entries(extendedKeyUsages)
- .filter(([, value]) => value)
- .map(([key]) => key.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase()))
- });
-
- createNotification({
- text: "Successfully created certificate template",
- type: "success"
- });
- }
-
- reset();
- handlePopUpToggle("certificateTemplate", false);
- };
-
- return (
- <Modal
- isOpen={popUp?.certificateTemplate?.isOpen}
- onOpenChange={(isOpen) => {
- handlePopUpToggle("certificateTemplate", isOpen);
- reset();
- }}
- >
- <ModalContent title={certTemplate ? "Certificate Template" : "Create Certificate Template"}>
- <form onSubmit={handleSubmit(onFormSubmit)}>
- {certTemplate && (
- <FormControl label="Certificate Template ID">
- <Input value={certTemplate.id} isDisabled className="bg-foreground-inverse/[0.07]" />
- </FormControl>
- )}
- <Controller
- control={control}
- defaultValue=""
- name="name"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Template Name"
- isError={Boolean(error)}
- errorText={error?.message}
- isRequired
- >
- <Input
- {...field}
- placeholder="My Certificate Template"
- autoComplete="off"
- name="certificate-template-name"
- />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="caId"
- defaultValue={caId}
- render={({ field: { onChange, ...field }, fieldState: { error } }) => (
- <FormControl
- label="Issuing CA"
- errorText={error?.message}
- isError={Boolean(error)}
- className="mt-4"
- isRequired
- >
- <Select
- defaultValue={field.value}
- {...field}
- onValueChange={(e) => onChange(e)}
- className="w-full"
- isDisabled
- >
- {(cas || []).map(({ id, type, dn }) => (
- <SelectItem value={id} key={`ca-${id}`}>
- {`${caTypeToNameMap[type]}: ${dn}`}
- </SelectItem>
- ))}
- </Select>
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="collectionId"
- render={({ field: { onChange, ...field }, fieldState: { error } }) => (
- <FormControl
- label="Certificate Collection (Optional)"
- errorText={error?.message}
- isError={Boolean(error)}
- className="mt-4"
- >
- <Select
- defaultValue={field.value}
- {...field}
- onValueChange={(e) => onChange(e)}
- className="w-full"
- >
- {(collectionsData?.collections || []).map(({ id, name }) => (
- <SelectItem value={id} key={`pki-collection-${id}`}>
- {name}
- </SelectItem>
- ))}
- </Select>
- </FormControl>
- )}
- />
- <Controller
- control={control}
- defaultValue=""
- name="commonName"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label={
- <div>
- <FormLabel
- isRequired
- label="Common Name (CN)"
- icon={
- <Tooltip
- className="text-center"
- content={
- <span>
- This field accepts limited regular expressions: spaces, *, ., @, -, \
- (for escaping), and alphanumeric characters only
- </span>
- }
- >
- <FontAwesomeIcon icon={faQuestionCircle} size="sm" />
- </Tooltip>
- }
- />
- </div>
- }
- isError={Boolean(error)}
- errorText={error?.message}
- isRequired
- >
- <Input {...field} placeholder=".*\.acme.com" />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- defaultValue=""
- name="subjectAlternativeName"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label={
- <div>
- <FormLabel
- isRequired
- label="Alternative Names (SAN)"
- icon={
- <Tooltip
- className="text-center"
- content={
- <span>
- This field accepts limited regular expressions: spaces, *, ., @, -, \
- (for escaping), and alphanumeric characters only
- </span>
- }
- >
- <FontAwesomeIcon icon={faQuestionCircle} size="sm" />
- </Tooltip>
- }
- />
- </div>
- }
- isError={Boolean(error)}
- errorText={error?.message}
- isRequired
- >
- <Input {...field} placeholder="service\.acme.\..*" />
- </FormControl>
- )}
- />
- <Controller
- control={control}
- name="ttl"
- render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Max TTL"
- isError={Boolean(error)}
- errorText={error?.message}
- isRequired
- >
- <Input {...field} placeholder="2 days, 1d, 2h, 1y, ..." />
- </FormControl>
- )}
- />
- <Accordion type="single" collapsible className="w-full">
- <AccordionItem value="key-usages" className="data-[state=open]:border-none">
- <AccordionTrigger className="h-fit flex-none pl-1 text-sm">
- <div className="order-1 ml-3">Key Usage</div>
- </AccordionTrigger>
- <AccordionContent>
- <Controller
- control={control}
- name="keyUsages"
- render={({ field: { onChange, value }, fieldState: { error } }) => {
- return (
- <FormControl
- label="Key Usage"
- errorText={error?.message}
- isError={Boolean(error)}
- >
- <div className="mt-2 mb-7 grid grid-cols-2 gap-2">
- {KEY_USAGES_OPTIONS.map(({ label, value: optionValue }) => {
- return (
- <Checkbox
- id={optionValue}
- key={optionValue}
- isChecked={value[optionValue]}
- onCheckedChange={(state) => {
- onChange({
- ...value,
- [optionValue]: state
- });
- }}
- >
- {label}
- </Checkbox>
- );
- })}
- </div>
- </FormControl>
- );
- }}
- />
- <Controller
- control={control}
- name="extendedKeyUsages"
- render={({ field: { onChange, value }, fieldState: { error } }) => {
- return (
- <FormControl
- label="Extended Key Usage"
- errorText={error?.message}
- isError={Boolean(error)}
- >
- <div className="mt-2 mb-7 grid grid-cols-2 gap-2">
- {EXTENDED_KEY_USAGES_OPTIONS.map(({ label, value: optionValue }) => {
- return (
- <Checkbox
- id={optionValue}
- key={optionValue}
- isChecked={value[optionValue]}
- onCheckedChange={(state) => {
- onChange({
- ...value,
- [optionValue]: state
- });
- }}
- >
- {label}
- </Checkbox>
- );
- })}
- </div>
- </FormControl>
- );
- }}
- />
- </AccordionContent>
- </AccordionItem>
- </Accordion>
- <div className="mt-4 flex items-center">
- <Button
- className="mr-4"
- size="sm"
- type="submit"
- isLoading={isSubmitting}
- isDisabled={isSubmitting}
- >
- Save
- </Button>
- <Button
- colorSchema="secondary"
- variant="plain"
- onClick={() => handlePopUpToggle("certificateTemplate", false)}
- >
- Cancel
- </Button>
- </div>
- </form>
- </ModalContent>
- </Modal>
- );
-};
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateTemplatesSection.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateTemplatesSection.tsx
deleted file mode 100644
index ad44966e32..0000000000
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateTemplatesSection.tsx
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * TODO (dangtony98): Reevaluate if this component should be in main
- * CertificateTab or under CA page in the future.
- */
-import { faPlus } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
-import { createNotification } from "@app/components/notifications";
-import { ProjectPermissionCan } from "@app/components/permissions";
-import { DeleteActionModal, IconButton } from "@app/components/v2";
-import {
- ProjectPermissionPkiTemplateActions,
- ProjectPermissionSub,
- useProject
-} from "@app/context";
-import { usePopUp } from "@app/hooks";
-import { useDeleteCertTemplate } from "@app/hooks/api";
-
-import { CertificateTemplateEnrollmentModal } from "./CertificateTemplateEnrollmentModal";
-import { CertificateTemplateModal } from "./CertificateTemplateModal";
-import { CertificateTemplatesTable } from "./CertificateTemplatesTable";
-
-type Props = {
- caId: string;
-};
-
-export const CertificateTemplatesSection = ({ caId }: Props) => {
- const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
- "certificateTemplate",
- "deleteCertificateTemplate",
- "enrollmentOptions",
- "upgradePlan"
- ] as const);
-
- const { currentProject } = useProject();
- const { mutateAsync: deleteCertTemplate } = useDeleteCertTemplate();
-
- const onRemoveCertificateTemplateSubmit = async (id: string) => {
- if (!currentProject?.id) {
- return;
- }
-
- await deleteCertTemplate({
- id,
- projectId: currentProject.id
- });
-
- createNotification({
- text: "Successfully deleted certificate template",
- type: "success"
- });
-
- handlePopUpClose("deleteCertificateTemplate");
- };
-
- return (
- <div className="mt-4 rounded-lg border border-border-control bg-surface-base p-4">
- <div className="flex items-center justify-between border-b border-border-emphasis pb-4">
- <h3 className="text-lg font-normal text-foreground">Certificate Templates</h3>
- <ProjectPermissionCan
- I={ProjectPermissionPkiTemplateActions.Create}
- a={ProjectPermissionSub.CertificateTemplates}
- >
- {(isAllowed) => (
- <IconButton
- ariaLabel="copy icon"
- variant="plain"
- className="group relative"
- onClick={() => handlePopUpOpen("certificateTemplate")}
- isDisabled={!isAllowed}
- >
- <FontAwesomeIcon icon={faPlus} />
- </IconButton>
- )}
- </ProjectPermissionCan>
- </div>
- <div className="py-4">
- <CertificateTemplatesTable handlePopUpOpen={handlePopUpOpen} caId={caId} />
- </div>
- <CertificateTemplateModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} caId={caId} />
- <CertificateTemplateEnrollmentModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} />
- <DeleteActionModal
- isOpen={popUp.deleteCertificateTemplate.isOpen}
- title={`Are you sure you want to delete the certificate template ${
- (popUp?.deleteCertificateTemplate?.data as { name: string })?.name || ""
- }?`}
- onChange={(isOpen) => handlePopUpToggle("deleteCertificateTemplate", isOpen)}
- deleteKey="confirm"
- onDeleteApproved={() =>
- onRemoveCertificateTemplateSubmit(
- (popUp?.deleteCertificateTemplate?.data as { id: string })?.id
- )
- }
- />
- <UpgradePlanModal
- paywallKey="cert-manager.certificate-templates"
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
- text="Your current plan does not include access to managing template enrollment options for EST. To unlock this feature, please upgrade to Infisical Enterprise plan."
- />
- </div>
- );
-};
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateTemplatesTable.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateTemplatesTable.tsx
deleted file mode 100644
index 0990d9b78f..0000000000
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateTemplatesTable.tsx
+++ /dev/null
@@ -1,153 +0,0 @@
-import { faEllipsis, faFileAlt, faTrash, faUserPlus } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { twMerge } from "tailwind-merge";
-
-import { ProjectPermissionCan } from "@app/components/permissions";
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
- EmptyState,
- Table,
- TableContainer,
- TableSkeleton,
- TBody,
- Td,
- Th,
- THead,
- Tooltip,
- Tr
-} from "@app/components/v2";
-import {
- ProjectPermissionPkiTemplateActions,
- ProjectPermissionSub,
- useSubscription
-} from "@app/context";
-import { useGetCaCertTemplates } from "@app/hooks/api";
-import { UsePopUpState } from "@app/hooks/usePopUp";
-
-type Props = {
- caId: string;
- handlePopUpOpen: (
- popUpName: keyof UsePopUpState<
- ["certificateTemplate", "deleteCertificateTemplate", "enrollmentOptions", "upgradePlan"]
- >,
- data?: {
- id?: string;
- name?: string;
- isEnterpriseFeature?: boolean;
- }
- ) => void;
-};
-
-export const CertificateTemplatesTable = ({ handlePopUpOpen, caId }: Props) => {
- const { subscription } = useSubscription();
-
- const { data, isPending } = useGetCaCertTemplates(caId);
-
- return (
- <div>
- <TableContainer>
- <Table>
- <THead>
- <Tr>
- <Th>Name</Th>
- <Th />
- </Tr>
- </THead>
- <TBody>
- {isPending && <TableSkeleton columns={2} innerKey="project-cas" />}
- {!isPending &&
- data?.certificateTemplates.map((certificateTemplate) => {
- return (
- <Tr className="h-10" key={`certificate-${certificateTemplate.id}`}>
- <Td>{certificateTemplate.name}</Td>
- <Td className="flex justify-end">
- <DropdownMenu>
- <DropdownMenuTrigger asChild className="rounded-lg">
- <div className="hover:text-project data-[state=open]:text-project">
- <Tooltip content="More options">
- <FontAwesomeIcon size="sm" icon={faEllipsis} />
- </Tooltip>
- </div>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="start" className="p-1">
- <DropdownMenuItem
- onClick={() =>
- handlePopUpOpen("certificateTemplate", {
- id: certificateTemplate.id
- })
- }
- icon={<FontAwesomeIcon icon={faFileAlt} size="sm" className="mr-1" />}
- >
- Manage Policies
- </DropdownMenuItem>
- <ProjectPermissionCan
- I={ProjectPermissionPkiTemplateActions.Edit}
- a={ProjectPermissionSub.CertificateTemplates}
- >
- {(isAllowed) => (
- <DropdownMenuItem
- onClick={() => {
- if (!subscription?.pkiEst) {
- handlePopUpOpen("upgradePlan", {
- isEnterpriseFeature: true
- });
- return;
- }
-
- handlePopUpOpen("enrollmentOptions", {
- id: certificateTemplate.id
- });
- }}
- className={twMerge(
- !isAllowed && "pointer-events-none cursor-not-allowed opacity-50"
- )}
- disabled={!isAllowed}
- icon={<FontAwesomeIcon icon={faUserPlus} size="sm" />}
- >
- Manage Enrollment
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- <ProjectPermissionCan
- I={ProjectPermissionPkiTemplateActions.Delete}
- a={ProjectPermissionSub.CertificateTemplates}
- >
- {(isAllowed) => (
- <DropdownMenuItem
- className={twMerge(
- !isAllowed && "pointer-events-none cursor-not-allowed opacity-50"
- )}
- disabled={!isAllowed}
- icon={<FontAwesomeIcon icon={faTrash} size="sm" className="mr-1" />}
- onClick={() =>
- handlePopUpOpen("deleteCertificateTemplate", {
- id: certificateTemplate.id,
- name: certificateTemplate.name
- })
- }
- >
- Delete Template
- </DropdownMenuItem>
- )}
- </ProjectPermissionCan>
- </DropdownMenuContent>
- </DropdownMenu>
- </Td>
- </Tr>
- );
- })}
- </TBody>
- </Table>
- {!isPending && !data?.certificateTemplates?.length && (
- <EmptyState
- title="No certificate templates have been created for this CA"
- icon={faFileAlt}
- />
- )}
- </TableContainer>
- </div>
- );
-};
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/SubjectAltNamesField.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/SubjectAltNamesField.tsx
index 27981edd78..7318ced0f4 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/SubjectAltNamesField.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/SubjectAltNamesField.tsx
@@ -1,6 +1,10 @@
import { Control, Controller } from "react-hook-form";
import { Plus, Trash2 } from "lucide-react";
+import {
+ CertificateIssuanceLimitsUpgradeIntent,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import {
Button,
Field,
@@ -50,118 +54,140 @@ export const SubjectAltNamesField = ({
}: SubjectAltNamesFieldProps) => {
const sanTypeLabels = getSanTypeLabels();
const { subscription } = useSubscription();
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
const { maxSansPerCertificate, maxWildcardCertificates } = subscription;
// 0 means the plan has no wildcard support at all, which the backend refuses before it counts
// anything, so it is the one cap this form can mirror exactly.
const areWildcardsUnavailable = maxWildcardCertificates === 0;
return (
- <Controller
- control={control}
- name={namePrefix}
- shouldUnregister={shouldUnregister}
- render={({ field: { onChange, value } }) => {
- const currentValues: SubjectAltName[] = value || [];
- const isAtSanLimit =
- typeof maxSansPerCertificate === "number" &&
- currentValues.length >= maxSansPerCertificate;
- return (
- <Field className="mb-4">
- <FieldLabel>Subject Alternative Names (SANs)</FieldLabel>
- <div className="space-y-3">
- {currentValues.map((san, index) => {
- const policy = policyRows?.[index];
- const isBlockedWildcard = areWildcardsUnavailable && san.value?.includes("*");
- const rowError =
- rowErrors?.[index] ??
- (isBlockedWildcard
- ? "Wildcard certificates are not available on your plan."
- : undefined) ??
- (revealPolicyErrors ? policy?.error : undefined);
+ <>
+ <Controller
+ control={control}
+ name={namePrefix}
+ shouldUnregister={shouldUnregister}
+ render={({ field: { onChange, value } }) => {
+ const currentValues: SubjectAltName[] = value || [];
+ const isAtSanLimit =
+ typeof maxSansPerCertificate === "number" &&
+ currentValues.length >= maxSansPerCertificate;
+ return (
+ <Field className="mb-4">
+ <FieldLabel>Subject Alternative Names (SANs)</FieldLabel>
+ <div className="space-y-3">
+ {currentValues.map((san, index) => {
+ const policy = policyRows?.[index];
+ const isBlockedWildcard = areWildcardsUnavailable && san.value?.includes("*");
+ const rowError =
+ rowErrors?.[index] ??
+ (isBlockedWildcard
+ ? "Wildcard certificates are not available on your plan."
+ : undefined) ??
+ (revealPolicyErrors ? policy?.error : undefined);
- return (
- // eslint-disable-next-line react/no-array-index-key
- <div key={`subject-alt-name-${index}`} className="flex items-start gap-2">
- <Select
- value={san.type}
- onValueChange={(newType) => {
- const newValue = [...currentValues];
- newValue[index] = {
- ...san,
- type: newType as CertSubjectAlternativeNameType
- };
- onChange(newValue);
- }}
- >
- <SelectTrigger className="w-32" disabled={policy?.isLocked}>
- <SelectValue />
- </SelectTrigger>
- <SelectContent position="popper">
- {allowedSanTypes.map((sanType) => (
- <SelectItem key={sanType} value={sanType}>
- {sanTypeLabels[sanType]}
- </SelectItem>
- ))}
- </SelectContent>
- </Select>
- <div className="min-w-0 flex-1">
- <Input
- value={san.value}
- onChange={(e) => {
+ return (
+ // eslint-disable-next-line react/no-array-index-key
+ <div key={`subject-alt-name-${index}`} className="flex items-start gap-2">
+ <Select
+ value={san.type}
+ onValueChange={(newType) => {
const newValue = [...currentValues];
- newValue[index] = { ...san, value: e.target.value };
+ newValue[index] = {
+ ...san,
+ type: newType as CertSubjectAlternativeNameType
+ };
onChange(newValue);
}}
- placeholder={getSanPlaceholder(san.type)}
- isError={Boolean(rowError)}
- className="w-full"
- />
- {rowError && <PolicyRowMessage isError lines={[rowError]} />}
- {!rowError && policy?.hint && <PolicyRowMessage lines={policy.hint} />}
- </div>
- {policy?.isLocked ? (
- <span className="w-9 shrink-0" />
- ) : (
- <IconButton
- type="button"
- variant="ghost"
- aria-label="Remove entry"
- onClick={() => onChange(currentValues.filter((_, i) => i !== index))}
>
- <Trash2 />
- </IconButton>
- )}
- </div>
- );
- })}
- <Button
- type="button"
- variant="outline"
- size="sm"
- isDisabled={isAtSanLimit}
- onClick={() => {
- const defaultType =
- allowedSanTypes.length > 0
- ? allowedSanTypes[0]
- : CertSubjectAlternativeNameType.DNS_NAME;
- onChange([...currentValues, { type: defaultType, value: "" }]);
- }}
- >
- <Plus className="size-4" /> Add SAN
- </Button>
- </div>
- {isAtSanLimit && (
- <PolicyRowMessage
- lines={[
- `Your plan allows up to ${maxSansPerCertificate} subject alternative names per certificate.`
- ]}
- />
- )}
- {error && <FieldError>{error}</FieldError>}
- {revealPolicyErrors && <PolicyNoticeList notices={policyNotices ?? []} />}
- </Field>
- );
- }}
- />
+ <SelectTrigger className="w-32" disabled={policy?.isLocked}>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent position="popper">
+ {allowedSanTypes.map((sanType) => (
+ <SelectItem key={sanType} value={sanType}>
+ {sanTypeLabels[sanType]}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ <div className="min-w-0 flex-1">
+ <Input
+ value={san.value}
+ onChange={(e) => {
+ const nextSanValue = e.target.value;
+ if (
+ areWildcardsUnavailable &&
+ nextSanValue.includes("*") &&
+ !san.value?.includes("*")
+ ) {
+ openUpgradeGate({
+ intent: CertificateIssuanceLimitsUpgradeIntent,
+ paywallKey: "cert-manager.certificate-wildcards"
+ });
+ return;
+ }
+ const newValue = [...currentValues];
+ newValue[index] = { ...san, value: nextSanValue };
+ onChange(newValue);
+ }}
+ placeholder={getSanPlaceholder(san.type)}
+ isError={Boolean(rowError)}
+ className="w-full"
+ />
+ {rowError && <PolicyRowMessage isError lines={[rowError]} />}
+ {!rowError && policy?.hint && <PolicyRowMessage lines={policy.hint} />}
+ </div>
+ {policy?.isLocked ? (
+ <span className="w-9 shrink-0" />
+ ) : (
+ <IconButton
+ type="button"
+ variant="ghost"
+ aria-label="Remove entry"
+ onClick={() => onChange(currentValues.filter((_, i) => i !== index))}
+ >
+ <Trash2 />
+ </IconButton>
+ )}
+ </div>
+ );
+ })}
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ onClick={() => {
+ const defaultType =
+ allowedSanTypes.length > 0
+ ? allowedSanTypes[0]
+ : CertSubjectAlternativeNameType.DNS_NAME;
+ if (isAtSanLimit) {
+ openUpgradeGate({
+ intent: CertificateIssuanceLimitsUpgradeIntent,
+ paywallKey: "cert-manager.certificate-san-limit"
+ });
+ return;
+ }
+ onChange([...currentValues, { type: defaultType, value: "" }]);
+ }}
+ >
+ <Plus className="size-4" /> Add SAN
+ </Button>
+ </div>
+ {isAtSanLimit && (
+ <PolicyRowMessage
+ lines={[
+ `Your plan allows up to ${maxSansPerCertificate} subject alternative names per certificate.`
+ ]}
+ />
+ )}
+ {error && <FieldError>{error}</FieldError>}
+ {revealPolicyErrors && <PolicyNoticeList notices={policyNotices ?? []} />}
+ </Field>
+ );
+ }}
+ />
+ {upgradeGate}
+ </>
);
};
diff --git a/frontend/src/pages/cert-manager/CodeSigningPage/components/SignersTable.tsx b/frontend/src/pages/cert-manager/CodeSigningPage/components/SignersTable.tsx
index 8f129f68a8..f77858fd08 100644
--- a/frontend/src/pages/cert-manager/CodeSigningPage/components/SignersTable.tsx
+++ b/frontend/src/pages/cert-manager/CodeSigningPage/components/SignersTable.tsx
@@ -3,7 +3,7 @@ import { useNavigate } from "@tanstack/react-router";
import { format } from "date-fns";
import { AlertTriangleIcon, PlusIcon, SearchIcon } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { CodeSigningUpgradeIntent, useUpgradeGate } from "@app/components/license/UpgradeGate";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
Badge,
@@ -47,7 +47,6 @@ import {
useListSigners
} from "@app/hooks/api/signers";
import { useDebounce } from "@app/hooks/useDebounce";
-import { usePopUp } from "@app/hooks/usePopUp";
import { PkiDocsUrls } from "../../pki-docs-urls";
@@ -60,11 +59,14 @@ export const SignersTable = ({ projectId, onCreateSigner }: Props) => {
const navigate = useNavigate();
const { currentOrg } = useOrganization();
const { subscription } = useSubscription();
- const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["upgradePlan"] as const);
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
const handleCreateSigner = () => {
if (!subscription.pkiCodeSigning) {
- handlePopUpOpen("upgradePlan");
+ openUpgradeGate({
+ intent: CodeSigningUpgradeIntent,
+ paywallKey: "cert-manager.signers"
+ });
return;
}
onCreateSigner();
@@ -227,12 +229,7 @@ export const SignersTable = ({ projectId, onCreateSigner }: Props) => {
/>
)}
</CardContent>
- <UpgradePlanModal
- paywallKey="cert-manager.signers"
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="Code signing is available on Infisical's Enterprise plan."
- />
+ {upgradeGate}
</Card>
);
};
diff --git a/frontend/src/pages/cert-manager/DiscoveryPage/components/DiscoveryJobsTab.tsx b/frontend/src/pages/cert-manager/DiscoveryPage/components/DiscoveryJobsTab.tsx
index 5bcdea10fc..9f26fbd47f 100644
--- a/frontend/src/pages/cert-manager/DiscoveryPage/components/DiscoveryJobsTab.tsx
+++ b/frontend/src/pages/cert-manager/DiscoveryPage/components/DiscoveryJobsTab.tsx
@@ -3,7 +3,10 @@ import { useNavigate } from "@tanstack/react-router";
import { format } from "date-fns";
import { MoreHorizontalIcon, PlusIcon, RefreshCwIcon, SearchIcon } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import {
+ CertificateDiscoveryUpgradeIntent,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import { ProjectPermissionCan } from "@app/components/permissions";
import { HoverCard, HoverCardContent, HoverCardTrigger, Tag } from "@app/components/v2";
import {
@@ -74,15 +77,15 @@ export const DiscoveryJobsTab = ({ projectId }: Props) => {
const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
"createJob",
"editJob",
- "deleteJob",
- "upgradePlan"
+ "deleteJob"
] as const);
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
const handleCreateJob = () => {
if (!subscription.pkiDiscovery) {
- handlePopUpOpen("upgradePlan", {
- isEnterpriseFeature: true,
- text: "Certificate discovery is available on Infisical's Enterprise plan."
+ openUpgradeGate({
+ intent: CertificateDiscoveryUpgradeIntent,
+ paywallKey: "cert-manager.discovery-jobs"
});
return;
}
@@ -363,12 +366,7 @@ export const DiscoveryJobsTab = ({ projectId }: Props) => {
discoveryName={(popUp.deleteJob.data as TPkiDiscovery)?.name || ""}
/>
- <UpgradePlanModal
- paywallKey="cert-manager.discovery-jobs"
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text={(popUp.upgradePlan?.data as { text: string })?.text}
- />
+ {upgradeGate}
</Card>
);
};
diff --git a/frontend/src/pages/cert-manager/PkiTemplateListPage/PkiTemplateListPage.tsx b/frontend/src/pages/cert-manager/PkiTemplateListPage/PkiTemplateListPage.tsx
index cc3d5e2a1a..44db60ca5e 100644
--- a/frontend/src/pages/cert-manager/PkiTemplateListPage/PkiTemplateListPage.tsx
+++ b/frontend/src/pages/cert-manager/PkiTemplateListPage/PkiTemplateListPage.tsx
@@ -14,7 +14,10 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { format } from "date-fns";
import { twMerge } from "tailwind-merge";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import {
+ CertificateEnrollmentUpgradeIntent,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
@@ -73,6 +76,7 @@ export const PkiTemplateListPage = () => {
"certificateFromTemplate",
"creationBlocked"
] as const);
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
const { subscription } = useSubscription();
const { currentProject } = useProject();
@@ -225,8 +229,9 @@ export const PkiTemplateListPage = () => {
onClick={(e) => {
e.stopPropagation();
if (!subscription.pkiEst) {
- handlePopUpOpen("estUpgradePlan", {
- isEnterpriseFeature: true
+ openUpgradeGate({
+ intent: CertificateEnrollmentUpgradeIntent,
+ paywallKey: "cert-manager.pki-template-list"
});
return;
}
@@ -338,13 +343,7 @@ export const PkiTemplateListPage = () => {
preselectedTemplate={popUp.certificateFromTemplate.data}
/>
</div>
- <UpgradePlanModal
- paywallKey="cert-manager.pki-template-list"
- isOpen={popUp.estUpgradePlan.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("estUpgradePlan", isOpen)}
- text="Your current plan does not include access to configuring template enrollment methods. To unlock this feature, please upgrade to Infisical Enterprise plan."
- isEnterpriseFeature={popUp.estUpgradePlan.data?.isEnterpriseFeature}
- />
+ {upgradeGate}
</>
);
};
diff --git a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificatePoliciesTab/CreatePolicyModal.tsx b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificatePoliciesTab/CreatePolicyModal.tsx
index 7d747357bf..f8e7f20c75 100644
--- a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificatePoliciesTab/CreatePolicyModal.tsx
+++ b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificatePoliciesTab/CreatePolicyModal.tsx
@@ -4,6 +4,10 @@ import { Controller, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { Info, PencilIcon, Plus, ShieldCheck, Trash2 } from "lucide-react";
+import {
+ PostQuantumCertificatesUpgradeIntent,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import {
Badge,
@@ -477,6 +481,7 @@ export const CertificatePolicyWizard = forwardRef<CertificatePolicyWizardHandle,
) => {
const { currentProject } = useProject();
const { subscription } = useSubscription();
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
const createPolicy = useCreateCertificatePolicy();
const updatePolicy = useUpdateCertificatePolicy();
@@ -1164,10 +1169,16 @@ export const CertificatePolicyWizard = forwardRef<CertificatePolicyWizardHandle,
id={`${fieldName}-${alg}`}
variant="project"
isChecked={isSelected}
- isDisabled={isPqcGated}
- onCheckedChange={(checked) =>
- toggleAlgorithm(fieldName, key, selected, alg, Boolean(checked))
- }
+ onCheckedChange={(checked) => {
+ if (isPqcGated && checked) {
+ openUpgradeGate({
+ intent: PostQuantumCertificatesUpgradeIntent,
+ paywallKey: "cert-manager.policy-algorithm"
+ });
+ return;
+ }
+ toggleAlgorithm(fieldName, key, selected, alg, Boolean(checked));
+ }}
/>
<label
htmlFor={`${fieldName}-${alg}`}
@@ -1827,6 +1838,7 @@ export const CertificatePolicyWizard = forwardRef<CertificatePolicyWizardHandle,
</SectionToggle>
</div>
)}
+ {upgradeGate}
</div>
);
}
diff --git a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CertificateProfilesTab.tsx b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CertificateProfilesTab.tsx
index 5e81a354ad..4342f1485f 100644
--- a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CertificateProfilesTab.tsx
+++ b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/CertificateProfilesTab.tsx
@@ -1,7 +1,6 @@
import { useState } from "react";
import { PlusIcon } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
@@ -19,7 +18,6 @@ import {
ProjectPermissionCertificateProfileActions,
ProjectPermissionSub
} from "@app/context/ProjectPermissionContext/types";
-import { usePopUp } from "@app/hooks";
import {
TCertificateProfileWithDetails,
useDeleteCertificateProfile
@@ -37,8 +35,6 @@ export const CertificateProfilesTab = () => {
const [selectedProfile, setSelectedProfile] = useState<TCertificateProfileWithDetails | null>(
null
);
- const { popUp, handlePopUpToggle } = usePopUp(["upgradePlan"] as const);
-
const deleteProfile = useDeleteCertificateProfile();
const handleEditProfile = (profile: TCertificateProfileWithDetails) => {
@@ -108,13 +104,6 @@ export const CertificateProfilesTab = () => {
</CardContent>
<CreateProfileModal isOpen={isCreateModalOpen} onClose={() => setIsCreateModalOpen(false)} />
- <UpgradePlanModal
- paywallKey="cert-manager.certificate-profiles"
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
- text="Your current plan does not include access to managing template enrollment options for ACME. To unlock this feature, please upgrade to Infisical Enterprise plan."
- />
{selectedProfile && (
<>
diff --git a/frontend/src/pages/cert-manager/SettingsPage/components/HsmConnectorsTab/HsmConnectorsTab.tsx b/frontend/src/pages/cert-manager/SettingsPage/components/HsmConnectorsTab/HsmConnectorsTab.tsx
index c661cbbee7..5c1590f488 100644
--- a/frontend/src/pages/cert-manager/SettingsPage/components/HsmConnectorsTab/HsmConnectorsTab.tsx
+++ b/frontend/src/pages/cert-manager/SettingsPage/components/HsmConnectorsTab/HsmConnectorsTab.tsx
@@ -13,7 +13,7 @@ import {
Trash2Icon
} from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { HsmConnectorsUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
@@ -116,11 +116,14 @@ export const HsmConnectorsTab = () => {
</p>
<Button onClick={() => setUpgradeOpen(true)}>Upgrade to Enterprise</Button>
</div>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="cert-manager.hsm-connectors"
isOpen={upgradeOpen}
onOpenChange={setUpgradeOpen}
- text="To use HSM Connectors, upgrade to Infisical's Enterprise plan."
+ intent={{
+ ...HsmConnectorsUpgradeIntent,
+ isEnterpriseFeature: false
+ }}
/>
</div>
);
diff --git a/frontend/src/pages/cert-manager/components/CertificateAlerts/ChannelsStep.tsx b/frontend/src/pages/cert-manager/components/CertificateAlerts/ChannelsStep.tsx
index 1adbbc8575..e7a6acc471 100644
--- a/frontend/src/pages/cert-manager/components/CertificateAlerts/ChannelsStep.tsx
+++ b/frontend/src/pages/cert-manager/components/CertificateAlerts/ChannelsStep.tsx
@@ -1,8 +1,10 @@
-import { useState } from "react";
import { FieldArrayWithId, UseFormReturn, useWatch } from "react-hook-form";
import { BellIcon } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import {
+ CertificateEnterpriseAlertingUpgradeIntent,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import {
Combobox,
Empty,
@@ -43,7 +45,7 @@ export const CertificateAlertAddChannelMenu = ({
onAdd: (channelType: AlertChannelType) => void;
}) => {
const { subscription } = useSubscription();
- const [isUpgradeOpen, setIsUpgradeOpen] = useState(false);
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
const isEnterpriseAllowed = Boolean(subscription?.pkiEnterpriseAlerting);
return (
@@ -52,17 +54,16 @@ export const CertificateAlertAddChannelMenu = ({
onAdd={onAdd}
isDisabled={channelCount >= MAX_CHANNELS}
lockedChannelTypes={isEnterpriseAllowed ? [] : ENTERPRISE_CHANNEL_TYPES}
- onLockedSelect={() => setIsUpgradeOpen(true)}
+ onLockedSelect={() =>
+ openUpgradeGate({
+ intent: CertificateEnterpriseAlertingUpgradeIntent,
+ paywallKey: "cert-manager.application-alert-channels"
+ })
+ }
label="Add Channel"
contentClassName="min-w-56"
/>
- <UpgradePlanModal
- isOpen={isUpgradeOpen}
- onOpenChange={setIsUpgradeOpen}
- paywallKey="cert-manager.application-alert-channels"
- text="Webhook, Slack, and PagerDuty alert channels are available on the Enterprise plan."
- isEnterpriseFeature
- />
+ {upgradeGate}
</>
);
};
diff --git a/frontend/src/pages/kms/KmipPage/components/KmipClientTable.tsx b/frontend/src/pages/kms/KmipPage/components/KmipClientTable.tsx
index a96d59ae84..dc474e35f6 100644
--- a/frontend/src/pages/kms/KmipPage/components/KmipClientTable.tsx
+++ b/frontend/src/pages/kms/KmipPage/components/KmipClientTable.tsx
@@ -8,7 +8,7 @@ import {
TrashIcon
} from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { KmipUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
Button,
@@ -352,12 +352,14 @@ export const KmipClientTable = () => {
onOpenChange={(isOpen) => handlePopUpToggle("displayKmipClientCert", isOpen)}
certificate={popUp.displayKmipClientCert.data}
/>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="kms.kmip-client"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="Your current plan does not include access to KMIP. To unlock this feature, please upgrade to Infisical Enterprise plan."
- isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
+ intent={{
+ ...KmipUpgradeIntent,
+ isEnterpriseFeature: Boolean(popUp.upgradePlan.data?.isEnterpriseFeature)
+ }}
/>
</Card>
);
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgGroupsTab/components/OrgGroupsSection/OrgGroupsSection.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgGroupsTab/components/OrgGroupsSection/OrgGroupsSection.tsx
index 2ab02c7610..c5ed4a390f 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgGroupsTab/components/OrgGroupsSection/OrgGroupsSection.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgGroupsTab/components/OrgGroupsSection/OrgGroupsSection.tsx
@@ -1,7 +1,7 @@
import { useState } from "react";
import { PlusIcon } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { GroupsUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import { DeleteActionModal } from "@app/components/v2";
@@ -45,10 +45,7 @@ export const OrgGroupsSection = () => {
const handleAddGroupModal = () => {
if (!subscription?.groups) {
- handlePopUpOpen("upgradePlan", {
- text: "Your current plan does not allow adding groups. To unlock this feature, please upgrade to Infisical Enterprise plan.",
- isEnterpriseFeature: true
- });
+ handlePopUpOpen("upgradePlan");
} else {
if (!isSubOrganization) {
setWizardStep(GroupWizardSteps.CreateGroup);
@@ -137,12 +134,11 @@ export const OrgGroupsSection = () => {
)
}
/>
- <UpgradePlanModal
+ <UpgradeGate
+ intent={GroupsUpgradeIntent}
paywallKey="organization.org-groups"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
- text={popUp.upgradePlan?.data?.text}
/>
</>
);
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/CreateOrgIdentitySheet.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/CreateOrgIdentitySheet.tsx
index 8e0d44c3c7..46b8ee6bc5 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/CreateOrgIdentitySheet.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/CreateOrgIdentitySheet.tsx
@@ -4,7 +4,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { useNavigate } from "@tanstack/react-router";
import { z } from "zod";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { CustomRolesUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { RoleOption } from "@app/components/roles";
import {
@@ -180,12 +180,14 @@ const CreateOrgIdentityForm = ({ onClose }: { onClose: () => void }) => {
Cancel
</Button>
</SheetFooter>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.create-org-identity-sheet"
isOpen={upgradePlanPopUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handleUpgradePlanPopUpToggle("upgradePlan", isOpen)}
- text="Assigning custom roles to machine identities can be unlocked if you upgrade to Infisical Enterprise plan."
- isEnterpriseFeature
+ intent={{
+ ...CustomRolesUpgradeIntent,
+ isEnterpriseFeature: true
+ }}
/>
</form>
);
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModal.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModal.tsx
index 3912cebae0..72eb965e4b 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModal.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModal.tsx
@@ -1,5 +1,6 @@
-import { useState } from "react";
+import { useRef, useState } from "react";
+import { IdentityAuthUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import {
Button,
Sheet,
@@ -27,6 +28,8 @@ type Props = {
export const IdentityAuthMethodModal = ({ popUp, handlePopUpOpen, handlePopUpToggle }: Props) => {
const [selectedAuthMethod, setSelectedAuthMethod] = useState<IdentityAuthMethod | null>(null);
const [isSubmitting, setIsSubmitting] = useState(false);
+ const sheetTriggerRef = useRef<HTMLElement | null>(null);
+ const upgradeTriggerRef = useRef<HTMLElement | null>(null);
const primaryVariant = useScopeVariant();
@@ -45,13 +48,22 @@ export const IdentityAuthMethodModal = ({ popUp, handlePopUpOpen, handlePopUpTog
if (!isOpen) setIsSubmitting(false);
}}
>
- <SheetContent side="right" className="flex flex-col gap-0 sm:max-w-lg">
+ <SheetContent
+ side="right"
+ className="flex flex-col gap-0 sm:max-w-lg"
+ aria-hidden={popUp.upgradePlan.isOpen || undefined}
+ onOpenAutoFocus={() => {
+ sheetTriggerRef.current = document.activeElement as HTMLElement | null;
+ }}
+ onCloseAutoFocus={(event) => {
+ if (popUp.upgradePlan.isOpen) event.preventDefault();
+ }}
+ >
<SheetHeader className="border-b">
<SheetTitle>{title}</SheetTitle>
</SheetHeader>
<div className="thin-scrollbar flex-1 overflow-y-auto p-4">
<IdentityAuthMethodModalContent
- popUp={popUp}
handlePopUpOpen={handlePopUpOpen}
handlePopUpToggle={handlePopUpToggle}
identity={{
@@ -85,6 +97,32 @@ export const IdentityAuthMethodModal = ({ popUp, handlePopUpOpen, handlePopUpTog
</Button>
</SheetFooter>
</SheetContent>
+ <UpgradeGate
+ paywallKey="organization.identity-auth-method-modal"
+ isOpen={popUp?.upgradePlan?.isOpen}
+ onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
+ onOpenAutoFocus={() => {
+ upgradeTriggerRef.current = document.activeElement as HTMLElement | null;
+ }}
+ onCloseAutoFocus={(event) => {
+ const target =
+ upgradeTriggerRef.current?.isConnected && upgradeTriggerRef.current !== document.body
+ ? upgradeTriggerRef.current
+ : sheetTriggerRef.current;
+ if (target?.isConnected) {
+ event.preventDefault();
+ target.focus({ preventScroll: true });
+ }
+ }}
+ intent={{
+ ...IdentityAuthUpgradeIntent,
+ description:
+ popUp.upgradePlan.data?.featureName === "LDAP authentication"
+ ? "Authenticate machine identities with LDAP."
+ : "Restrict machine identity access to trusted IP addresses.",
+ isEnterpriseFeature: Boolean(popUp.upgradePlan.data?.isEnterpriseFeature)
+ }}
+ />
</Sheet>
);
};
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModalContent.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModalContent.tsx
index bbcf800aed..83678cdc4a 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModalContent.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityAuthMethodModalContent.tsx
@@ -11,7 +11,6 @@ import {
} from "lucide-react";
import { z } from "zod";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
import { Badge, Combobox, Field, FieldError, FieldLabel, ProviderIcon } from "@app/components/v3";
import { MAX_IDENTITY_ACCESS_TOKEN_TTL_FALLBACK } from "@app/helpers/identityAuthSchemas";
import { IdentityAuthMethod } from "@app/hooks/api/identities";
@@ -33,7 +32,6 @@ import { IdentityTokenAuthForm } from "./IdentityTokenAuthForm";
import { IdentityUniversalAuthForm } from "./IdentityUniversalAuthForm";
type Props = {
- popUp: UsePopUpState<["identityAuthMethod", "upgradePlan"]>;
handlePopUpOpen: (popUpName: keyof UsePopUpState<["upgradePlan"]>) => void;
handlePopUpToggle: (
popUpName: keyof UsePopUpState<["identityAuthMethod", "upgradePlan"]>,
@@ -155,7 +153,6 @@ const schema = z
export type FormData = z.infer<typeof schema>;
export const IdentityAuthMethodModalContent = ({
- popUp,
handlePopUpOpen,
handlePopUpToggle,
identity,
@@ -447,13 +444,6 @@ export const IdentityAuthMethodModalContent = ({
}}
/>
{selectedMethodItem?.render ? selectedMethodItem.render() : <div />}
- <UpgradePlanModal
- paywallKey="organization.identity-auth-method-modal"
- isOpen={popUp?.upgradePlan?.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text={`Your current plan does not include access to ${popUp.upgradePlan.data?.featureName}. To unlock this feature, please upgrade to Infisical ${popUp.upgradePlan.data?.isEnterpriseFeature ? "Enterprise" : "Pro"} plan.`}
- isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
- />
</>
);
};
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentitySection.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentitySection.tsx
index c1fd66e434..f79b5b06be 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentitySection.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentitySection.tsx
@@ -1,7 +1,10 @@
import { useEffect, useState } from "react";
import { PlusIcon } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import {
+ MachineIdentityTemplatesUpgradeIntent,
+ UpgradeGate
+} from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import {
@@ -308,12 +311,14 @@ const IdentitySectionContent = ({ view = "identities" }: Props) => {
/>
</>
)}
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.identity"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text={popUp.upgradePlan.data?.text}
- isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
+ intent={{
+ ...MachineIdentityTemplatesUpgradeIntent,
+ isEnterpriseFeature: Boolean(popUp.upgradePlan.data?.isEnterpriseFeature)
+ }}
/>
</>
);
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/OrgIdentityModal.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/OrgIdentityModal.tsx
index b899faa422..7195022a9d 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/OrgIdentityModal.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/OrgIdentityModal.tsx
@@ -5,7 +5,7 @@ import { PlusIcon, TrashIcon } from "lucide-react";
import { twMerge } from "tailwind-merge";
import { z } from "zod";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { CustomRolesUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { RoleOption } from "@app/components/roles";
import {
@@ -303,12 +303,14 @@ export const OrgIdentityModal = ({ popUp, handlePopUpToggle }: Props) => {
Update
</Button>
</div>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.org-identity"
isOpen={upgradePlanPopUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handleUpgradePlanPopUpToggle("upgradePlan", isOpen)}
- text="Assigning custom roles to machine identities can be unlocked if you upgrade to Infisical Enterprise plan."
- isEnterpriseFeature
+ intent={{
+ ...CustomRolesUpgradeIntent,
+ isEnterpriseFeature: true
+ }}
/>
</form>
);
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgMembersTab/components/OrgMembersSection/OrgMembersSection.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgMembersTab/components/OrgMembersSection/OrgMembersSection.tsx
index 2de69fdb2d..7debcbfd77 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgMembersTab/components/OrgMembersSection/OrgMembersSection.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgMembersTab/components/OrgMembersSection/OrgMembersSection.tsx
@@ -3,7 +3,7 @@ import { useNavigate, useSearch } from "@tanstack/react-router";
import { BanIcon, TrashIcon, UserPlusIcon } from "lucide-react";
import { EmailServiceSetupModal } from "@app/components/auth/EmailServiceSetupModal";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { CustomRolesUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import { DeleteActionModal, Tooltip } from "@app/components/v2";
@@ -280,12 +280,14 @@ export const OrgMembersSection = () => {
</ul>
</div>
</DeleteActionModal>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.org-members"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text={popUp.upgradePlan?.data?.text}
- isEnterpriseFeature={popUp.upgradePlan?.data?.isEnterpriseFeature}
+ intent={{
+ ...CustomRolesUpgradeIntent,
+ isEnterpriseFeature: Boolean(popUp.upgradePlan?.data?.isEnterpriseFeature)
+ }}
/>
<EmailServiceSetupModal
isOpen={popUp.setUpEmail?.isOpen}
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgRoleTabSection/OrgRoleTable.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgRoleTabSection/OrgRoleTable.tsx
index 44a2bf6dfe..777f1cd05b 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgRoleTabSection/OrgRoleTable.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgRoleTabSection/OrgRoleTable.tsx
@@ -15,7 +15,7 @@ import {
} from "lucide-react";
import { twMerge } from "tailwind-merge";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { CustomRolesUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import { DeleteActionModal } from "@app/components/v2";
@@ -110,7 +110,7 @@ export const OrgRoleTable = () => {
if (isCustomRole && subscription && !subscription?.rbac) {
handlePopUpOpen("upgradePlan", {
- text: "Your current plan does not include access to set a custom default organization role. To unlock this feature, please upgrade to Infisical Enterprise plan.",
+ text: "Set a custom role as the default for new organization members.",
isEnterpriseFeature: true
});
return;
@@ -513,12 +513,13 @@ export const OrgRoleTable = () => {
onClose={() => handlePopUpClose("deleteRole")}
onDeleteApproved={handleRoleDelete}
/>
- <UpgradePlanModal
+ <UpgradeGate
+ intent={{
+ ...CustomRolesUpgradeIntent
+ }}
paywallKey="organization.org-role"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text={popUp.upgradePlan?.data?.text}
- isEnterpriseFeature={popUp.upgradePlan?.data?.isEnterpriseFeature}
/>
<DuplicateOrgRoleModal
isOpen={popUp.duplicateRole.isOpen}
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionList.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionList.tsx
index 65e2f2ad8f..2cbde1fefb 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionList.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionList.tsx
@@ -1,7 +1,10 @@
import { useMemo, useState } from "react";
import { Loader2Icon, Search } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import {
+ EnterpriseAppConnectionsUpgradeIntent,
+ UpgradeGate
+} from "@app/components/license/UpgradeGate";
import {
Empty,
EmptyDescription,
@@ -206,12 +209,14 @@ export const AppConnectionsSelect = ({ onSelect, projectType }: Props) => {
.
</p>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.app-connection-list"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="All App Connections can be unlocked if you switch to Infisical Enterprise plan."
- isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
+ intent={{
+ ...EnterpriseAppConnectionsUpgradeIntent,
+ isEnterpriseFeature: Boolean(popUp.upgradePlan.data?.isEnterpriseFeature)
+ }}
/>
</div>
);
diff --git a/frontend/src/pages/organization/AuditLogsPage/components/AuditLogStreamTab/AuditLogStreamTab.tsx b/frontend/src/pages/organization/AuditLogsPage/components/AuditLogStreamTab/AuditLogStreamTab.tsx
index 6d4631fd74..c76d3c55c0 100644
--- a/frontend/src/pages/organization/AuditLogsPage/components/AuditLogStreamTab/AuditLogStreamTab.tsx
+++ b/frontend/src/pages/organization/AuditLogsPage/components/AuditLogStreamTab/AuditLogStreamTab.tsx
@@ -1,6 +1,6 @@
import { PlusIcon } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { AuditLogStreamsUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { OrgPermissionCan } from "@app/components/permissions";
import {
Button,
@@ -71,12 +71,14 @@ export const AuditLogStreamsTab = withPermission(
isOpen={popUp.auditLogStreamForm.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("auditLogStreamForm", isOpen)}
/>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.audit-log-stream"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="Your current plan does not include access to audit log streams. To unlock this feature, please upgrade to Infisical Enterprise plan."
- isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
+ intent={{
+ ...AuditLogStreamsUpgradeIntent,
+ isEnterpriseFeature: Boolean(popUp.upgradePlan.data?.isEnterpriseFeature)
+ }}
/>
</>
);
diff --git a/frontend/src/pages/organization/AuditLogsPage/components/AuditLogStreamTab/components/LogStreamProviderSelect.tsx b/frontend/src/pages/organization/AuditLogsPage/components/AuditLogStreamTab/components/LogStreamProviderSelect.tsx
index 878375a17c..86a84ff34c 100644
--- a/frontend/src/pages/organization/AuditLogsPage/components/AuditLogStreamTab/components/LogStreamProviderSelect.tsx
+++ b/frontend/src/pages/organization/AuditLogsPage/components/AuditLogStreamTab/components/LogStreamProviderSelect.tsx
@@ -2,7 +2,7 @@ import { useMemo } from "react";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Loader2Icon } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { AuditLogStreamsUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { ProviderIcon } from "@app/components/v3";
import { AUDIT_LOG_STREAM_PROVIDER_MAP } from "@app/helpers/auditLogStreams";
import { usePopUp } from "@app/hooks";
@@ -83,12 +83,14 @@ export const LogStreamProviderSelect = ({ onSelect }: Props) => {
);
})}
</div>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.log-stream-provider-select"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="Your current plan does not include access to this audit log stream provider. To unlock this feature, please upgrade to Infisical Enterprise plan."
- isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
+ intent={{
+ ...AuditLogStreamsUpgradeIntent,
+ isEnterpriseFeature: Boolean(popUp.upgradePlan.data?.isEnterpriseFeature)
+ }}
/>
</div>
);
diff --git a/frontend/src/pages/organization/AuditLogsPage/components/LogsSection.tsx b/frontend/src/pages/organization/AuditLogsPage/components/LogsSection.tsx
index 01f79ae35b..49397cea58 100644
--- a/frontend/src/pages/organization/AuditLogsPage/components/LogsSection.tsx
+++ b/frontend/src/pages/organization/AuditLogsPage/components/LogsSection.tsx
@@ -1,6 +1,6 @@
import { useEffect, useMemo, useState } from "react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { AuditLogsUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import {
Alert,
AlertDescription,
@@ -217,13 +217,16 @@ const LogsSectionComponent = ({
timezone={timezone}
/>
</CardContent>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.logs"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => {
handlePopUpToggle("upgradePlan", isOpen);
}}
- text="Your current plan does not include access to audit logs. To unlock this feature, please upgrade to Infisical Pro plan."
+ intent={{
+ ...AuditLogsUpgradeIntent,
+ isEnterpriseFeature: false
+ }}
/>
</Card>
);
@@ -303,13 +306,16 @@ const LogsSectionComponent = ({
}}
timezone={timezone}
/>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.logs"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => {
handlePopUpToggle("upgradePlan", isOpen);
}}
- text="Your current plan does not include access to audit logs. To unlock this feature, please upgrade to Infisical Pro plan."
+ intent={{
+ ...AuditLogsUpgradeIntent,
+ isEnterpriseFeature: false
+ }}
/>
</div>
);
diff --git a/frontend/src/pages/organization/BillingV2Page/BillingV2Page.tsx b/frontend/src/pages/organization/BillingV2Page/BillingV2Page.tsx
index ad5efa72c6..2290722636 100644
--- a/frontend/src/pages/organization/BillingV2Page/BillingV2Page.tsx
+++ b/frontend/src/pages/organization/BillingV2Page/BillingV2Page.tsx
@@ -1,7 +1,8 @@
-import { useEffect, useState } from "react";
+import { useEffect, useRef, useState } from "react";
import { Helmet } from "react-helmet";
import { useTranslation } from "react-i18next";
+import { getSafeUpgradeReturnPath } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import { PageHeader } from "@app/components/v3/platform";
@@ -94,9 +95,29 @@ export const BillingV2Page = () => {
const showOrgFilter = rootOrgCount > 1;
const [flow, setFlow] = useState<BillingV2Flow | null>(null);
+ const openedUpgradeProduct = useRef(false);
const [removeProdId, setRemoveProdId] = useState<string | null>(null);
const [trialApproval, setTrialApproval] = useState<{ orgId: string; url: string } | null>(null);
const trialApprovalUrl = trialApproval?.orgId === selectedOrgId ? trialApproval.url : null;
+ const deepLinkSearch = new URLSearchParams(window.location.search);
+ const upgradeProduct = deepLinkSearch.get("upgradeProduct");
+ const upgradeReturnPath = getSafeUpgradeReturnPath(
+ deepLinkSearch.get("upgradeReturnPath"),
+ window.location.origin
+ );
+
+ useEffect(() => {
+ if (
+ flow ||
+ openedUpgradeProduct.current ||
+ !upgradeProduct ||
+ !catalog.some((product) => product.id === upgradeProduct)
+ ) {
+ return;
+ }
+ openedUpgradeProduct.current = true;
+ setFlow({ type: "sheet", prodId: upgradeProduct });
+ }, [catalog, flow, upgradeProduct]);
// Stripe redirects back with ?checkout=success|canceled; surface the outcome and refresh state.
useEffect(() => {
@@ -136,7 +157,20 @@ export const BillingV2Page = () => {
const removeProd = removeProdId ? catalogById(catalog, removeProdId) : undefined;
- const close = () => setFlow(null);
+ const close = () => {
+ setFlow(null);
+ if (openedUpgradeProduct.current) {
+ const url = new URL(window.location.href);
+ url.searchParams.delete("upgradeProduct");
+ url.searchParams.delete("upgradeReturnPath");
+ window.history.replaceState(
+ window.history.state,
+ "",
+ `${url.pathname}${url.search}${url.hash}`
+ );
+ openedUpgradeProduct.current = false;
+ }
+ };
const redirectToPortal = () => {
createPortalSession.mutate(
@@ -302,10 +336,15 @@ export const BillingV2Page = () => {
entitlement={overview?.entitlements[flow.prodId]}
hasActiveSubscription={hasActiveSubscription}
initialView={flow.view}
- returnPath={window.location.pathname}
+ returnPath={upgradeReturnPath ?? window.location.pathname}
renewsOn={overview?.entitlements[flow.prodId]?.renewsOn ?? null}
selfServe={overview?.selfServe ?? true}
onClose={close}
+ onEntitlementChanged={() => {
+ if (upgradeReturnPath) {
+ window.location.assign(upgradeReturnPath);
+ }
+ }}
onRemove={setRemoveProdId}
onContact={() => {
close();
diff --git a/frontend/src/pages/organization/BillingV2Page/components/ProductSheet.tsx b/frontend/src/pages/organization/BillingV2Page/components/ProductSheet.tsx
index 036ff2b7c2..0716ff6e36 100644
--- a/frontend/src/pages/organization/BillingV2Page/components/ProductSheet.tsx
+++ b/frontend/src/pages/organization/BillingV2Page/components/ProductSheet.tsx
@@ -462,6 +462,7 @@ type ProductSheetProps = {
// notice points to sales; the sales-led "Contact sales" path stays available.
selfServe: boolean;
onClose: () => void;
+ onEntitlementChanged?: () => void;
onRemove: (prodId: string) => void;
onContact: (prod: BillingV2CatalogProduct) => void;
};
@@ -478,6 +479,7 @@ export const ProductSheet = ({
renewsOn,
selfServe,
onClose,
+ onEntitlementChanged,
onRemove,
onContact
}: ProductSheetProps) => {
@@ -552,7 +554,8 @@ export const ProductSheet = ({
const result = await startTrial.mutateAsync({
orgId,
productId: prod.id,
- plan: trialConfirmTier
+ plan: trialConfirmTier,
+ returnPath
});
// Card-first: awaiting_card means no card is on file and the trial is NOT granted yet. Send the
// customer to the card-setup checkout; completing it grants the trial via webhook.
@@ -572,6 +575,7 @@ export const ProductSheet = ({
type: "success",
text: `Your ${prod.name} trial has started.`
});
+ onEntitlementChanged?.();
onClose();
} catch {
setTrialConfirmTier(null);
@@ -635,7 +639,10 @@ export const ProductSheet = ({
}
onStartTrial={() => setTrialConfirmTier(activatePlanObj.tier)}
onBack={() => setView("plans")}
- onDone={onClose}
+ onDone={() => {
+ onEntitlementChanged?.();
+ onClose();
+ }}
/>
)}
@@ -649,7 +656,10 @@ export const ProductSheet = ({
selfServe={selfServe}
isTrialConversion={entitlement?.trialPlan === upgradePlanObj.tier}
onBack={() => setView("plans")}
- onDone={onClose}
+ onDone={() => {
+ onEntitlementChanged?.();
+ onClose();
+ }}
/>
)}
diff --git a/frontend/src/pages/organization/BillingV2Page/components/TrialBanners.tsx b/frontend/src/pages/organization/BillingV2Page/components/TrialBanners.tsx
index 88526f52d8..24843e30cc 100644
--- a/frontend/src/pages/organization/BillingV2Page/components/TrialBanners.tsx
+++ b/frontend/src/pages/organization/BillingV2Page/components/TrialBanners.tsx
@@ -83,7 +83,9 @@ export const TrialBanners = ({
const isSuperseded = (trial: BillingV2Trial): boolean => {
const entitlement = overview.entitlements[trial.productKey];
return Boolean(
- entitlement?.trialPlan || entitlement?.isTrialing || entitlement?.status === "active"
+ entitlement?.trialPlan ||
+ entitlement?.isTrialing ||
+ (entitlement?.status === "active" && entitlement.planTier !== trial.basePlanTier)
);
};
const reverted = overview.trials
diff --git a/frontend/src/pages/organization/IdentityDetailsByIDPage/IdentityDetailsByIDPage.tsx b/frontend/src/pages/organization/IdentityDetailsByIDPage/IdentityDetailsByIDPage.tsx
index 50146cfae9..a9fffb5966 100644
--- a/frontend/src/pages/organization/IdentityDetailsByIDPage/IdentityDetailsByIDPage.tsx
+++ b/frontend/src/pages/organization/IdentityDetailsByIDPage/IdentityDetailsByIDPage.tsx
@@ -3,7 +3,6 @@ import { useTranslation } from "react-i18next";
import { Link, useNavigate, useParams } from "@tanstack/react-router";
import { ChevronLeftIcon, EllipsisIcon } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import { DeleteActionModal } from "@app/components/v2";
@@ -241,13 +240,6 @@ const Page = () => {
handlePopUpOpen={handlePopUpOpen}
handlePopUpToggle={handlePopUpToggle}
/>
- <UpgradePlanModal
- paywallKey="organization.identity-details-by-id"
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text={`Your current plan does not include access to ${popUp.upgradePlan.data?.featureName}. To unlock this feature, please upgrade to Infisical ${popUp.upgradePlan.data?.isEnterpriseFeature ? "Enterprise" : "Pro"} plan.`}
- isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
- />
<DeleteActionModal
isOpen={popUp.deleteIdentity.isOpen}
title={`Are you sure you want to delete ${
diff --git a/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/GatewayTab.tsx b/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/GatewayTab.tsx
index 07233a6c12..975728fdf5 100644
--- a/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/GatewayTab.tsx
+++ b/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/GatewayTab.tsx
@@ -13,7 +13,7 @@ import {
TrashIcon
} from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { GatewayPoolsUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import {
@@ -520,12 +520,14 @@ export const GatewayTab = withPermission(
isOpen={popUp.createPool.isOpen}
onToggle={(isOpen) => handlePopUpToggle("createPool", isOpen)}
/>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.gateway"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="Your current plan does not include access to gateway pools. To unlock this feature, please upgrade to Infisical Enterprise plan."
- isEnterpriseFeature
+ intent={{
+ ...GatewayPoolsUpgradeIntent,
+ isEnterpriseFeature: true
+ }}
/>
</Card>
<div className="flex flex-col gap-4">
diff --git a/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/components/GatewayPoliciesSection.tsx b/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/components/GatewayPoliciesSection.tsx
index 5a8fc5bc74..5cda76f24c 100644
--- a/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/components/GatewayPoliciesSection.tsx
+++ b/frontend/src/pages/organization/NetworkingPage/components/GatewayTab/components/GatewayPoliciesSection.tsx
@@ -1,6 +1,6 @@
import { ShieldCheck } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { GatewayPoolsUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import {
@@ -90,12 +90,11 @@ export const GatewayPoliciesSection = () => {
</FieldGroup>
</CardContent>
</Card>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.gateway.require-pools"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="Your current plan does not include access to gateway pools. To unlock this feature, please upgrade to Infisical Enterprise plan."
- isEnterpriseFeature
+ intent={GatewayPoolsUpgradeIntent}
/>
</>
);
diff --git a/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/ProductSettingsPage.tsx b/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/ProductSettingsPage.tsx
index 931693b4da..a38bd4264e 100644
--- a/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/ProductSettingsPage.tsx
+++ b/frontend/src/pages/organization/ProductSettingsPage/SecretsManagement/ProductSettingsPage.tsx
@@ -1,7 +1,10 @@
import { Helmet } from "react-helmet";
import { KeyRound } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import {
+ CrossProjectSecretSharingUpgradeIntent,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import {
@@ -24,7 +27,6 @@ import {
useOrganization,
useSubscription
} from "@app/context";
-import { usePopUp } from "@app/hooks";
import { useUpdateOrg } from "@app/hooks/api/organization/queries";
import { ProjectType } from "@app/hooks/api/projects/types";
@@ -35,7 +37,7 @@ export const ProductSettingsPage = () => {
const { currentOrg } = useOrganization();
const { mutateAsync: updateOrg, isPending } = useUpdateOrg();
const { subscription } = useSubscription();
- const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["upgradePlan"] as const);
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
const handleToggle = async (state: boolean) => {
if (!currentOrg?.id) return;
@@ -55,7 +57,10 @@ export const ProductSettingsPage = () => {
if (!currentOrg?.id) return;
if (state && !subscription?.crossProjectSecretSharing) {
- handlePopUpOpen("upgradePlan");
+ openUpgradeGate({
+ intent: CrossProjectSecretSharingUpgradeIntent,
+ paywallKey: "organization.product-settings"
+ });
return;
}
@@ -155,12 +160,7 @@ export const ProductSettingsPage = () => {
</div>
</div>
</div>
- <UpgradePlanModal
- paywallKey="organization.product-settings"
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="Cross-project secret sharing is not available on your plan. Upgrade to the Infisical Pro plan to enable this feature."
- />
+ {upgradeGate}
</>
);
};
diff --git a/frontend/src/pages/organization/ProductSettingsPage/project-templates/ProjectTemplatesSection.tsx b/frontend/src/pages/organization/ProductSettingsPage/project-templates/ProjectTemplatesSection.tsx
index 066ad503eb..7174214c11 100644
--- a/frontend/src/pages/organization/ProductSettingsPage/project-templates/ProjectTemplatesSection.tsx
+++ b/frontend/src/pages/organization/ProductSettingsPage/project-templates/ProjectTemplatesSection.tsx
@@ -1,6 +1,6 @@
import { LayoutTemplate, PlusIcon } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { ProjectTemplatesUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { OrgPermissionCan } from "@app/components/permissions";
import {
Button,
@@ -81,12 +81,14 @@ export const ProjectTemplatesSection = ({ projectType, onTemplateSelect }: Props
isOpen={popUp.addTemplate.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("addTemplate", isOpen)}
/>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.project-templates"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="Your current plan does not include access to project templates. To unlock this feature, please upgrade to Infisical Enterprise plan."
- isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
+ intent={{
+ ...ProjectTemplatesUpgradeIntent,
+ isEnterpriseFeature: Boolean(popUp.upgradePlan.data?.isEnterpriseFeature)
+ }}
/>
</>
);
diff --git a/frontend/src/pages/organization/ProjectsPage/ProjectTypePage/ProjectSearchInput.tsx b/frontend/src/pages/organization/ProjectsPage/ProjectTypePage/ProjectSearchInput.tsx
index b572e1eb04..550bf88b3c 100644
--- a/frontend/src/pages/organization/ProjectsPage/ProjectTypePage/ProjectSearchInput.tsx
+++ b/frontend/src/pages/organization/ProjectsPage/ProjectTypePage/ProjectSearchInput.tsx
@@ -1,7 +1,10 @@
import { FocusEvent, KeyboardEvent, useRef, useState } from "react";
import { KeyIcon, SearchIcon } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import {
+ SecretAccessInsightsUpgradeIntent,
+ UpgradeGate
+} from "@app/components/license/UpgradeGate";
import { SecretValueSearchSheet } from "@app/components/secrets/SecretValueSearchSheet";
import {
InputGroup,
@@ -129,11 +132,11 @@ export const ProjectSearchInput = ({ orgId, value, onChange, canSearchByValue }:
isOpen={isValueSearchOpen}
onOpenChange={setIsValueSearchOpen}
/>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.secret-insights"
isOpen={isUpgradeOpen}
onOpenChange={setIsUpgradeOpen}
- text="Your current plan does not include access to secret insights. To unlock this feature, please upgrade your Infisical plan."
+ intent={SecretAccessInsightsUpgradeIntent}
/>
</>
);
diff --git a/frontend/src/pages/organization/ProjectsPage/ProjectTypePage/ProjectTypePage.tsx b/frontend/src/pages/organization/ProjectsPage/ProjectTypePage/ProjectTypePage.tsx
index 8030c268d9..106c6b6371 100644
--- a/frontend/src/pages/organization/ProjectsPage/ProjectTypePage/ProjectTypePage.tsx
+++ b/frontend/src/pages/organization/ProjectsPage/ProjectTypePage/ProjectTypePage.tsx
@@ -17,7 +17,7 @@ import {
} from "lucide-react";
import { twMerge } from "tailwind-merge";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { ProjectLimitUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import { NewProjectModal } from "@app/components/projects";
@@ -382,11 +382,11 @@ const ProjectTypeContent = ({
onOpenChange={(isOpen) => handlePopUpToggle("addNewWs", isOpen)}
projectType={projectType}
/>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.project-type"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="You have reached the maximum number of projects allowed on your current plan. Upgrade to Infisical Pro plan to add more projects."
+ intent={ProjectLimitUpgradeIntent}
/>
</div>
);
diff --git a/frontend/src/pages/organization/RoleByIDPage/components/DuplicateOrgRoleModal.tsx b/frontend/src/pages/organization/RoleByIDPage/components/DuplicateOrgRoleModal.tsx
index 4fbd7e6dec..7e5aee465c 100644
--- a/frontend/src/pages/organization/RoleByIDPage/components/DuplicateOrgRoleModal.tsx
+++ b/frontend/src/pages/organization/RoleByIDPage/components/DuplicateOrgRoleModal.tsx
@@ -3,7 +3,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { useNavigate } from "@tanstack/react-router";
import { z } from "zod";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { CustomRolesUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import {
Button,
@@ -162,11 +162,14 @@ const Content = ({ role, onClose }: ContentProps) => {
</Button>
</DialogFooter>
</form>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.duplicate-org-role"
isOpen={upgradePlanPopUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handleUpgradePlanPopUpToggle("upgradePlan", isOpen)}
- text="Your current plan does not include custom roles. To unlock this feature, please upgrade to Infisical Advanced plan."
+ intent={{
+ ...CustomRolesUpgradeIntent,
+ isEnterpriseFeature: false
+ }}
/>
</>
);
diff --git a/frontend/src/pages/organization/RoleByIDPage/components/RoleModal.tsx b/frontend/src/pages/organization/RoleByIDPage/components/RoleModal.tsx
index c0513bfc9e..5eabe3801b 100644
--- a/frontend/src/pages/organization/RoleByIDPage/components/RoleModal.tsx
+++ b/frontend/src/pages/organization/RoleByIDPage/components/RoleModal.tsx
@@ -4,7 +4,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { useNavigate } from "@tanstack/react-router";
import { z } from "zod";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { CustomRolesUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import {
Button,
@@ -220,11 +220,14 @@ export const RoleModal = ({ popUp, handlePopUpToggle }: Props) => {
</form>
</DialogContent>
</Dialog>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.role"
isOpen={upgradePlanPopUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handleUpgradePlanPopUpToggle("upgradePlan", isOpen)}
- text="Your current plan does not include custom roles. To unlock this feature, please upgrade to Infisical Advanced plan."
+ intent={{
+ ...CustomRolesUpgradeIntent,
+ isEnterpriseFeature: false
+ }}
/>
</>
);
diff --git a/frontend/src/pages/organization/SecretInsightsPage/SecretInsightsPage.tsx b/frontend/src/pages/organization/SecretInsightsPage/SecretInsightsPage.tsx
index 6865a181f6..1b3c716d54 100644
--- a/frontend/src/pages/organization/SecretInsightsPage/SecretInsightsPage.tsx
+++ b/frontend/src/pages/organization/SecretInsightsPage/SecretInsightsPage.tsx
@@ -1,10 +1,13 @@
-import { useEffect, useMemo } from "react";
+import { useCallback, useEffect, useMemo } from "react";
import { Helmet } from "react-helmet";
import { Link } from "@tanstack/react-router";
import { format } from "date-fns";
import { FileTextIcon, LockIcon } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import {
+ SecretAccessInsightsUpgradeIntent,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import { OrgPermissionCan } from "@app/components/permissions";
import {
Alert,
@@ -76,6 +79,7 @@ export const SecretInsightsPage = withPermission(
const { currentOrg } = useOrganization();
const { config } = useServerConfig();
const { subscription } = useSubscription();
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
const isClickhouseEnabled = Boolean(config.isClickhouseAuditLogEnabled);
const hasInsightsPlan = Boolean(subscription?.secretAccessInsights);
@@ -121,10 +125,7 @@ export const SecretInsightsPage = withPermission(
{ enabled: isClickhouseEnabled && hasInsightsPlan }
);
- const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp([
- "requestOrgReport",
- "upgradePlan"
- ] as const);
+ const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["requestOrgReport"] as const);
// Reports are generated asynchronously and delivered by email; the list is newest-first
// and polls while a report is in flight (the backend allows one in-flight report per org).
const { data: orgReports } = useGetOrgAuditReports(
@@ -138,11 +139,18 @@ export const SecretInsightsPage = withPermission(
orgReports?.reports.some((report) => IN_FLIGHT_REPORT_STATUSES.includes(report.status))
);
+ const handleUpgrade = useCallback(() => {
+ openUpgradeGate({
+ intent: SecretAccessInsightsUpgradeIntent,
+ paywallKey: "organization.secret-insights"
+ });
+ }, [openUpgradeGate]);
+
useEffect(() => {
if (subscription && !subscription.secretAccessInsights) {
- handlePopUpOpen("upgradePlan");
+ handleUpgrade();
}
- }, [subscription]);
+ }, [handleUpgrade, subscription]);
const isSummaryLoading = hasInsightsPlan && isSummaryPending;
const isProjectsLoading = hasInsightsPlan && isProjectsPending;
@@ -190,9 +198,13 @@ export const SecretInsightsPage = withPermission(
variant="project"
size="xs"
isDisabled={!isAllowed || hasInFlightReport}
- onClick={() =>
- handlePopUpOpen(hasInsightsPlan ? "requestOrgReport" : "upgradePlan")
- }
+ onClick={() => {
+ if (hasInsightsPlan) {
+ handlePopUpOpen("requestOrgReport");
+ } else {
+ handleUpgrade();
+ }
+ }}
>
Generate Report
</Button>
@@ -280,12 +292,7 @@ export const SecretInsightsPage = withPermission(
onOpenChange={(isOpen) => handlePopUpToggle("requestOrgReport", isOpen)}
isAuditLogSupported={isClickhouseEnabled}
/>
- <UpgradePlanModal
- paywallKey="organization.secret-insights"
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="Your current plan does not include access to secret insights. To unlock this feature, please upgrade your Infisical plan."
- />
+ {upgradeGate}
</>
);
},
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgEncryptionTab/OrgEncryptionTab.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgEncryptionTab/OrgEncryptionTab.tsx
index 8d0b0cc2b0..ae7dc3e950 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgEncryptionTab/OrgEncryptionTab.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgEncryptionTab/OrgEncryptionTab.tsx
@@ -1,7 +1,7 @@
import { useState } from "react";
import { KeyRound, Plus, Trash2 } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { ExternalKmsUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import {
@@ -178,12 +178,14 @@ export const OrgEncryptionTab = withPermission(
</Table>
)}
</CardContent>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.org-encryption"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="Your current plan does not include access to external KMS. To unlock this feature, please upgrade to Infisical Enterprise plan."
- isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
+ intent={{
+ ...ExternalKmsUpgradeIntent,
+ isEnterpriseFeature: Boolean(popUp.upgradePlan.data?.isEnterpriseFeature)
+ }}
/>
<AddExternalKmsForm
isOpen={popUp.addExternalKms.isOpen}
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgProvisioningTab/OrgGithubSyncSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgProvisioningTab/OrgGithubSyncSection.tsx
index 1f0adbdd24..fdde8f18b5 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgProvisioningTab/OrgGithubSyncSection.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgProvisioningTab/OrgGithubSyncSection.tsx
@@ -1,7 +1,7 @@
import { useQuery } from "@tanstack/react-query";
import { GitBranch } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { GithubSyncUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import {
@@ -189,12 +189,14 @@ export const OrgGithubSyncSection = () => {
handlePopUpOpen={handlePopUpOpen}
handlePopUpToggle={handlePopUpToggle}
/>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.org-github-sync"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="Your current plan does not include access to GitHub Organization Sync. To unlock this feature, please upgrade to Infisical Enterprise plan."
- isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
+ intent={{
+ ...GithubSyncUpgradeIntent,
+ isEnterpriseFeature: Boolean(popUp.upgradePlan.data?.isEnterpriseFeature)
+ }}
/>
</>
);
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgProvisioningTab/OrgSCIMSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgProvisioningTab/OrgSCIMSection.tsx
index 9c73ce1dae..7e31c6932e 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgProvisioningTab/OrgSCIMSection.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgProvisioningTab/OrgSCIMSection.tsx
@@ -1,6 +1,6 @@
import { UserCog } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { ScimUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import {
@@ -122,12 +122,14 @@ export const OrgScimSection = () => {
handlePopUpOpen={handlePopUpOpen}
handlePopUpToggle={handlePopUpToggle}
/>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.org-scim"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="Your current plan does not include access to SCIM Provisioning. To unlock this feature, please upgrade to Infisical Enterprise plan."
- isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
+ intent={{
+ ...ScimUpgradeIntent,
+ isEnterpriseFeature: Boolean(popUp.upgradePlan.data?.isEnterpriseFeature)
+ }}
/>
</>
);
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSecurityTab/OrgGenericAuthSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSecurityTab/OrgGenericAuthSection.tsx
index 578fb89cd3..8242bbb28a 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSecurityTab/OrgGenericAuthSection.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSecurityTab/OrgGenericAuthSection.tsx
@@ -1,6 +1,6 @@
import { Fingerprint } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { MfaEnforcementUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import {
@@ -137,11 +137,14 @@ export const OrgGenericAuthSection = () => {
</FieldGroup>
</CardContent>
</Card>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.org-generic-auth"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="Your current plan does not include access to enforce user MFA. To unlock this feature, please upgrade to Infisical Advanced plan."
+ intent={{
+ ...MfaEnforcementUpgradeIntent,
+ isEnterpriseFeature: false
+ }}
/>
</>
);
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgGeneralAuthSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgGeneralAuthSection.tsx
index 5e9b7fdd61..70adfc7aae 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgGeneralAuthSection.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgGeneralAuthSection.tsx
@@ -2,7 +2,7 @@ import { useState } from "react";
import { AlertTriangle, Info, ShieldCheck } from "lucide-react";
import { twMerge } from "tailwind-merge";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { SsoEnforcementUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import {
@@ -47,6 +47,13 @@ enum EnforceAuthType {
OIDC = "oidc"
}
+const upgradeDescriptions: Record<string, string> = {
+ "enforce SAML SSO": "Require SAML single sign-on for organization members.",
+ "enforce Google OAuth": "Require Google sign-in for organization members.",
+ "OIDC SSO": "Authenticate organization members with OIDC single sign-on.",
+ "Admin SSO Bypass": "Allow organization admins to sign in without single sign-on."
+};
+
export const OrgGeneralAuthSection = ({
isSamlConfigured,
isOidcConfigured,
@@ -386,11 +393,17 @@ export const OrgGeneralAuthSection = ({
</CardContent>
</Card>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.org-general-auth"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text={`Your current plan does not include access to ${popUp.upgradePlan.data?.featureName ?? "enforce SAML SSO"}. To unlock this feature, please upgrade to Infisical ${popUp.upgradePlan.data?.planName ?? "Pro"} plan.`}
+ intent={{
+ ...SsoEnforcementUpgradeIntent,
+ description:
+ upgradeDescriptions[popUp.upgradePlan.data?.featureName ?? ""] ??
+ SsoEnforcementUpgradeIntent.description,
+ isEnterpriseFeature: popUp.upgradePlan.data?.planName === "Enterprise"
+ }}
/>
<Dialog
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgLDAPSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgLDAPSection.tsx
index c748394e82..eac2bef1d7 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgLDAPSection.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgLDAPSection.tsx
@@ -1,6 +1,6 @@
import { ArrowLeftRight, MoreHorizontal, Pencil } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { LdapUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import {
@@ -215,12 +215,14 @@ export const OrgLDAPSection = ({ onSwitchProvider }: Props): JSX.Element => {
handlePopUpOpen={handlePopUpOpen}
handlePopUpToggle={handlePopUpToggle}
/>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.org-ldap.section"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="Your current plan does not include access to LDAP authentication. To unlock this feature, please upgrade to Infisical Enterprise plan."
- isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
+ intent={{
+ ...LdapUpgradeIntent,
+ isEnterpriseFeature: Boolean(popUp.upgradePlan.data?.isEnterpriseFeature)
+ }}
/>
</>
);
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgOIDCSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgOIDCSection.tsx
index a4bdcc8531..ef6baa67d6 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgOIDCSection.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgOIDCSection.tsx
@@ -1,6 +1,6 @@
import { AlertTriangle, ArrowLeftRight, Info, MoreHorizontal, Pencil } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { OidcSsoUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import {
@@ -269,12 +269,14 @@ export const OrgOIDCSection = ({ onSwitchProvider }: Props): JSX.Element => {
handlePopUpClose={handlePopUpClose}
handlePopUpToggle={handlePopUpToggle}
/>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.org-oidc.section"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="Your current plan does not include access to OIDC SSO. To unlock this feature, please upgrade to Infisical Enterprise plan."
- isEnterpriseFeature
+ intent={{
+ ...OidcSsoUpgradeIntent,
+ isEnterpriseFeature: true
+ }}
/>
</>
);
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgSSOSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgSSOSection.tsx
index 2efc2ff800..58f51208b0 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgSSOSection.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgSSOSection.tsx
@@ -1,6 +1,6 @@
import { AlertTriangle, ArrowLeftRight, Info, MoreHorizontal, Pencil } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { SamlSsoUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import {
@@ -261,12 +261,14 @@ export const OrgSSOSection = ({ onSwitchProvider }: Props): JSX.Element => {
handlePopUpClose={handlePopUpClose}
handlePopUpToggle={handlePopUpToggle}
/>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.org-sso.section"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text={popUp.upgradePlan.data?.text}
- isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
+ intent={{
+ ...SamlSsoUpgradeIntent,
+ isEnterpriseFeature: Boolean(popUp.upgradePlan.data?.isEnterpriseFeature)
+ }}
/>
</>
);
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgSsoTab.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgSsoTab.tsx
index c34d4f7fc0..d7f888ea79 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgSsoTab.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgSsoTab/OrgSsoTab.tsx
@@ -1,7 +1,12 @@
import { useState } from "react";
import { ArrowLeftRight, IdCardIcon, Info, Plus } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import {
+ LdapUpgradeIntent,
+ OidcSsoUpgradeIntent,
+ SamlSsoUpgradeIntent,
+ UpgradeGate
+} from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import {
@@ -173,6 +178,16 @@ export const OrgSsoTab = withPermission(
shouldDisplaySection(LoginMethod.OIDC) ||
shouldDisplaySection(LoginMethod.LDAP);
+ let ssoUpgradeIntent:
+ | typeof SamlSsoUpgradeIntent
+ | typeof OidcSsoUpgradeIntent
+ | typeof LdapUpgradeIntent = SamlSsoUpgradeIntent;
+ if (popUp.upgradePlan.data?.featureName === "OIDC SSO") {
+ ssoUpgradeIntent = OidcSsoUpgradeIntent;
+ } else if (popUp.upgradePlan.data?.featureName === "LDAP") {
+ ssoUpgradeIntent = LdapUpgradeIntent;
+ }
+
const handleConnectSaml = async () => {
if (!subscription?.samlSSO) {
handlePopUpOpen("upgradePlan", {
@@ -579,12 +594,14 @@ export const OrgSsoTab = withPermission(
</AlertDialog>
</>
)}
- <UpgradePlanModal
+ <UpgradeGate
paywallKey={popUp.upgradePlan.data?.paywallKey ?? "organization.org-sso.chooser"}
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text={`Your current plan does not include access to ${popUp.upgradePlan.data?.featureName}. To unlock this feature, please upgrade to Infisical ${popUp.upgradePlan.data?.isEnterpriseFeature ? "Enterprise" : "Pro"} plan.`}
- isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
+ intent={{
+ ...ssoUpgradeIntent,
+ isEnterpriseFeature: Boolean(popUp.upgradePlan.data?.isEnterpriseFeature)
+ }}
/>
</>
);
diff --git a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/ProjectTemplatesSection.tsx b/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/ProjectTemplatesSection.tsx
index 92811f407c..4f4e8688c1 100644
--- a/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/ProjectTemplatesSection.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/ProjectTemplatesTab/components/ProjectTemplatesSection.tsx
@@ -2,7 +2,7 @@ import { useState } from "react";
import { faPlus } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { ProjectTemplatesUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { OrgPermissionCan } from "@app/components/permissions";
import { Button } from "@app/components/v2";
import { DocumentationLinkBadge } from "@app/components/v3";
@@ -68,12 +68,14 @@ export const ProjectTemplatesSection = () => {
isOpen={popUp.addTemplate.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("addTemplate", isOpen)}
/>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.project-templates"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="Your current plan does not include access to project templates. To unlock this feature, please upgrade to Infisical Enterprise plan."
- isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
+ intent={{
+ ...ProjectTemplatesUpgradeIntent,
+ isEnterpriseFeature: Boolean(popUp.upgradePlan.data?.isEnterpriseFeature)
+ }}
/>
</div>
</div>
diff --git a/frontend/src/pages/organization/UserDetailsByIDPage/UserDetailsByIDPage.tsx b/frontend/src/pages/organization/UserDetailsByIDPage/UserDetailsByIDPage.tsx
index e2f675129f..ee49e727a9 100644
--- a/frontend/src/pages/organization/UserDetailsByIDPage/UserDetailsByIDPage.tsx
+++ b/frontend/src/pages/organization/UserDetailsByIDPage/UserDetailsByIDPage.tsx
@@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next";
import { Link, useNavigate, useParams } from "@tanstack/react-router";
import { ChevronLeftIcon, EllipsisIcon } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { CustomRolesUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { OrgPermissionCan } from "@app/components/permissions";
import { DeleteActionModal } from "@app/components/v2";
@@ -254,12 +254,14 @@ const Page = withPermission(
buttonText="Deactivate"
/>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="organization.user-details-by-id"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text={popUp.upgradePlan?.data?.text}
- isEnterpriseFeature={popUp.upgradePlan?.data?.isEnterpriseFeature}
+ intent={{
+ ...CustomRolesUpgradeIntent,
+ isEnterpriseFeature: Boolean(popUp.upgradePlan?.data?.isEnterpriseFeature)
+ }}
/>
<UserOrgMembershipModal
popUp={popUp}
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/CreateAccountSheet.tsx b/frontend/src/pages/pam/PamAccountsPage/components/CreateAccountSheet.tsx
index 140ab47555..14b9052a38 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/CreateAccountSheet.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/CreateAccountSheet.tsx
@@ -5,6 +5,11 @@ import { useQuery } from "@tanstack/react-query";
import { Link } from "@tanstack/react-router";
import { AlertTriangle, ArrowUpRight, Plus, Search } from "lucide-react";
+import {
+ EnterprisePamAccountsUpgradeIntent,
+ PamAccountLimitUpgradeIntent,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { HighlightText } from "@app/components/utilities/HighlightText";
import {
@@ -47,7 +52,7 @@ import {
SheetTitle
} from "@app/components/v3/generic/Sheet";
import { TextArea } from "@app/components/v3/generic/TextArea";
-import { useOrganization } from "@app/context";
+import { useOrganization, useSubscription } from "@app/context";
import { gatewaysQueryKeys } from "@app/hooks/api/gateways/queries";
import {
accountTypeRequiresRecording,
@@ -118,6 +123,8 @@ export const CreateAccountSheet = ({
const createAccount = useCreatePamAccount();
const { currentOrg } = useOrganization();
+ const { subscription } = useSubscription();
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
const { data: capabilities } = useGetPamAccessCapabilities();
const isProductAdmin = Boolean(capabilities?.isProductAdmin);
@@ -246,6 +253,22 @@ export const CreateAccountSheet = ({
!templateUnusableReason(selectedTemplate)
);
+ const handleContinue = () => {
+ const isEnterpriseAccount =
+ selectedTemplate?.type === PamAccountType.Windows ||
+ selectedTemplate?.type === PamAccountType.WindowsAd;
+
+ if (isEnterpriseAccount && subscription.enterprisePamAccount === false) {
+ openUpgradeGate({
+ intent: EnterprisePamAccountsUpgradeIntent,
+ paywallKey: "pam.enterprise-account"
+ });
+ return;
+ }
+
+ setStep(2);
+ };
+
const onSubmit = (values: TAccountFormValues) => {
if (!selectedMetadata) return;
@@ -309,6 +332,19 @@ export const CreateAccountSheet = ({
onCreated?.(account.id);
},
onError: (error) => {
+ const serverError = (
+ error as { response?: { data?: { message?: string; error?: string } } }
+ ).response?.data;
+ if (
+ serverError?.error === "PAM_ACCOUNT_LIMIT_REACHED" ||
+ serverError?.message?.includes("plan limit reached")
+ ) {
+ openUpgradeGate({
+ intent: PamAccountLimitUpgradeIntent,
+ paywallKey: "pam.account-limit"
+ });
+ return;
+ }
const unmapped = applyServerValidationErrors(error, setError, knownFields);
if (unmapped.length) {
createNotification({
@@ -521,7 +557,7 @@ export const CreateAccountSheet = ({
type="button"
variant="pam"
isDisabled={!canProceed}
- onClick={() => setStep(2)}
+ onClick={handleContinue}
>
Next
</Button>
@@ -693,6 +729,7 @@ export const CreateAccountSheet = ({
onOpenChange={setCreateFolderOpen}
onCreated={(folderId) => setValue("folderId", folderId, { shouldDirty: true })}
/>
+ {upgradeGate}
</>
);
};
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsx b/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsx
index 3d78ba4fa0..cfaa7d81b6 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsx
@@ -10,6 +10,10 @@ import {
} from "lucide-react";
import { twMerge } from "tailwind-merge";
+import {
+ PamSlackNotificationsUpgradeIntent,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { DeleteActionModal } from "@app/components/v2";
import {
@@ -108,6 +112,7 @@ export const FolderApprovalsTab = ({ folderId, onDirtyChange }: Props) => {
const { currentOrg } = useOrganization();
const { subscription } = useSubscription();
const isPamSlackEnabled = Boolean(subscription?.pamSlackNotifications);
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
const { data: config, isLoading } = useGetPamApprovalConfig(folderId);
const { data: orgUsers } = useGetOrgUsers(currentOrg.id);
const { data: orgGroups } = useGetOrganizationGroups(currentOrg.id);
@@ -546,14 +551,38 @@ export const FolderApprovalsTab = ({ folderId, onDirtyChange }: Props) => {
</CardContent>
</Card>
- {isPamSlackEnabled && (
+ {isPamSlackEnabled ? (
<FolderNotificationsSection
configs={notificationConfigs}
integrationSlugById={integrationSlugById}
onChange={setNotificationConfigs}
/>
+ ) : (
+ <Card>
+ <CardHeader>
+ <CardTitle>Slack Notifications</CardTitle>
+ <CardDescription>
+ Notify Slack channels when PAM access is requested, approved, or revoked.
+ </CardDescription>
+ <CardAction>
+ <Button
+ variant="pam"
+ onClick={() =>
+ openUpgradeGate({
+ intent: PamSlackNotificationsUpgradeIntent,
+ paywallKey: "pam.folder-slack-notifications"
+ })
+ }
+ >
+ View Plans
+ </Button>
+ </CardAction>
+ </CardHeader>
+ </Card>
)}
+ {upgradeGate}
+
<Card>
<CardHeader className="border-b">
<CardTitle className="text-base">
diff --git a/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupRoles.tsx b/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupRoles.tsx
index 42503dd73d..089e0c2e04 100644
--- a/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupRoles.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupRoles.tsx
@@ -5,7 +5,7 @@ import { CheckIcon, ClockAlertIcon, ClockIcon, EditIcon } from "lucide-react";
import { twMerge } from "tailwind-merge";
import { z } from "zod";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { CustomRolesUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import {
Badge,
@@ -384,12 +384,14 @@ const GroupRolesForm = ({ projectRoles, roles, groupId, onClose }: FormProps) =>
Save
</Button>
</div>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="project.group-roles"
isOpen={upgradePlanPopUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handleUpgradePlanPopUpToggle("upgradePlan", isOpen)}
- text="Assigning custom roles to groups can be unlocked if you upgrade to Infisical Enterprise plan."
- isEnterpriseFeature
+ intent={{
+ ...CustomRolesUpgradeIntent,
+ isEnterpriseFeature: true
+ }}
/>
</form>
);
diff --git a/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupsSection.tsx b/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupsSection.tsx
index aab89b042c..022255a084 100644
--- a/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupsSection.tsx
+++ b/frontend/src/pages/project/AccessControlPage/components/GroupsTab/components/GroupsSection/GroupsSection.tsx
@@ -1,6 +1,6 @@
import { PlusIcon } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { GroupsUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
@@ -120,12 +120,14 @@ export const GroupsSection = () => {
if (groupToRemove?.id) await onRemoveGroupSubmit(groupToRemove.id);
}}
/>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="project.groups"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text={popUp.upgradePlan?.data?.text}
- isEnterpriseFeature={popUp.upgradePlan?.data?.isEnterpriseFeature}
+ intent={{
+ ...GroupsUpgradeIntent,
+ isEnterpriseFeature: Boolean(popUp.upgradePlan?.data?.isEnterpriseFeature)
+ }}
/>
</>
);
diff --git a/frontend/src/pages/project/AuditLogsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx b/frontend/src/pages/project/AuditLogsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx
index 053922b728..e5156a4ff8 100644
--- a/frontend/src/pages/project/AuditLogsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx
+++ b/frontend/src/pages/project/AuditLogsPage/components/AuditLogsRetentionSection/AuditLogsRetentionSection.tsx
@@ -2,7 +2,7 @@ import { Controller, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { AuditRetentionUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import {
Button,
@@ -136,11 +136,14 @@ export const AuditLogsRetentionSection = () => {
</CardFooter>
</Card>
</form>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="project.audit-logs-retention"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text={popUp.upgradePlan?.data?.text}
+ intent={{
+ ...AuditRetentionUpgradeIntent,
+ isEnterpriseFeature: false
+ }}
/>
</>
);
diff --git a/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityRoleDetailsSection/IdentityRoleModify.tsx b/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityRoleDetailsSection/IdentityRoleModify.tsx
index a713ea0cb0..09b83e415a 100644
--- a/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityRoleDetailsSection/IdentityRoleModify.tsx
+++ b/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityRoleDetailsSection/IdentityRoleModify.tsx
@@ -12,7 +12,7 @@ import { ChevronDownIcon, ClockIcon, PlusIcon, TrashIcon } from "lucide-react";
import ms from "ms";
import { TtlFormLabel } from "@app/components/features";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { CustomRolesUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
@@ -367,12 +367,14 @@ export const IdentityRoleModify = ({ identityProjectMembership, onClose }: Props
Cancel
</Button>
</SheetFooter>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="project.identity-role-modify"
isOpen={upgradePlanPopUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handleUpgradePlanPopUpToggle("upgradePlan", isOpen)}
- text="Assigning custom roles to machine identities can be unlocked if you upgrade to Infisical Enterprise plan."
- isEnterpriseFeature
+ intent={{
+ ...CustomRolesUpgradeIntent,
+ isEnterpriseFeature: true
+ }}
/>
</form>
);
diff --git a/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityRoleDetailsSection/IdentitySingleRoleModify.tsx b/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityRoleDetailsSection/IdentitySingleRoleModify.tsx
index 66136e0c8b..7d6f54a2c2 100644
--- a/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityRoleDetailsSection/IdentitySingleRoleModify.tsx
+++ b/frontend/src/pages/project/IdentityDetailsByIDPage/components/IdentityRoleDetailsSection/IdentitySingleRoleModify.tsx
@@ -1,7 +1,7 @@
import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { CustomRolesUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { Button, PageLoader } from "@app/components/v3";
import { useProject, useSubscription } from "@app/context";
@@ -100,12 +100,14 @@ export const IdentitySingleRoleModify = ({ identityProjectMembership, role, onSu
Save Role
</Button>
</div>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="project.identity-single-role-modify"
isOpen={upgradePlanPopUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handleUpgradePlanPopUpToggle("upgradePlan", isOpen)}
- text="Assigning custom roles to machine identities can be unlocked if you upgrade to Infisical Enterprise plan."
- isEnterpriseFeature
+ intent={{
+ ...CustomRolesUpgradeIntent,
+ isEnterpriseFeature: true
+ }}
/>
</form>
);
diff --git a/frontend/src/pages/project/IdentityDetailsByIDPage/components/ProjectIdentityAuthSection.tsx b/frontend/src/pages/project/IdentityDetailsByIDPage/components/ProjectIdentityAuthSection.tsx
index 7e6bccd931..49a3c7e389 100644
--- a/frontend/src/pages/project/IdentityDetailsByIDPage/components/ProjectIdentityAuthSection.tsx
+++ b/frontend/src/pages/project/IdentityDetailsByIDPage/components/ProjectIdentityAuthSection.tsx
@@ -1,7 +1,6 @@
import { subject } from "@casl/ability";
import { PlusIcon } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
Button,
@@ -138,13 +137,6 @@ export const ProjectIdentityAuthenticationSection = ({ identity, refetchIdentity
handlePopUpOpen={handlePopUpOpen}
handlePopUpToggle={handleAuthMethodPopUpToggle}
/>
- <UpgradePlanModal
- paywallKey="project.project-identity-auth"
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text={(popUp.upgradePlan?.data as { description: string })?.description}
- isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
- />
</>
);
};
diff --git a/frontend/src/pages/project/MemberDetailsByIDPage/MemberDetailsByIDPage.tsx b/frontend/src/pages/project/MemberDetailsByIDPage/MemberDetailsByIDPage.tsx
index 988f9e0e77..fe9e413a2b 100644
--- a/frontend/src/pages/project/MemberDetailsByIDPage/MemberDetailsByIDPage.tsx
+++ b/frontend/src/pages/project/MemberDetailsByIDPage/MemberDetailsByIDPage.tsx
@@ -13,7 +13,7 @@ import {
} from "lucide-react";
import { AssumePrivilegesDialog } from "@app/components/assume-privileges";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { CustomRolesUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
@@ -339,12 +339,14 @@ export const Page = () => {
actorType={ActorType.USER}
actorId={(popUp.assumePrivileges.data as { userId: string })?.userId}
/>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="project.member-details-by-id"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text={popUp.upgradePlan?.data?.text}
- isEnterpriseFeature={popUp.upgradePlan?.data?.isEnterpriseFeature}
+ intent={{
+ ...CustomRolesUpgradeIntent,
+ isEnterpriseFeature: Boolean(popUp.upgradePlan?.data?.isEnterpriseFeature)
+ }}
/>
{isPermissionAuditOpen && (
<MemberPermissionAuditSheet
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/DuplicateProjectRoleModal.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/DuplicateProjectRoleModal.tsx
index 7287a64e29..2e91bbbc7b 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/DuplicateProjectRoleModal.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/DuplicateProjectRoleModal.tsx
@@ -4,7 +4,7 @@ import slugify from "@sindresorhus/slugify";
import { useNavigate } from "@tanstack/react-router";
import { z } from "zod";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { CustomRolesUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import {
Button,
@@ -199,11 +199,14 @@ const Content = ({ role, onClose }: ContentProps) => {
</Button>
</SheetFooter>
</form>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="project.duplicate-project-role"
isOpen={upgradePlanPopUp.upgradePlan.isOpen}
onOpenChange={(open) => handleUpgradePlanPopUpToggle("upgradePlan", open)}
- text="Your current plan does not include custom roles. To unlock this feature, please upgrade to Infisical Advanced plan."
+ intent={{
+ ...CustomRolesUpgradeIntent,
+ isEnterpriseFeature: false
+ }}
/>
</>
);
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/EditProjectRoleDialog.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/EditProjectRoleDialog.tsx
index 3545968a58..a4222fa4f4 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/EditProjectRoleDialog.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/EditProjectRoleDialog.tsx
@@ -4,7 +4,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
import { useNavigate } from "@tanstack/react-router";
import { z } from "zod";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { CustomRolesUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import {
Button,
@@ -208,11 +208,14 @@ export const EditProjectRoleDialog = ({ isOpen, role, onOpenChange }: Props) =>
</form>
</SheetContent>
</Sheet>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="project.edit-project-role-dialog"
isOpen={upgradePlanPopUp.upgradePlan.isOpen}
onOpenChange={(open) => handleUpgradePlanPopUpToggle("upgradePlan", open)}
- text="Your current plan does not include custom roles. To unlock this feature, please upgrade to Infisical Advanced plan."
+ intent={{
+ ...CustomRolesUpgradeIntent,
+ isEnterpriseFeature: false
+ }}
/>
</>
);
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/RoleModal.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/RoleModal.tsx
index 8ce0385c98..50dabd96b8 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/RoleModal.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/RoleModal.tsx
@@ -4,7 +4,7 @@ import slugify from "@sindresorhus/slugify";
import { useNavigate } from "@tanstack/react-router";
import { z } from "zod";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { CustomRolesUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import {
Button,
@@ -200,11 +200,14 @@ export const RoleModal = ({ popUp, handlePopUpToggle }: Props) => {
</form>
</SheetContent>
</Sheet>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="project.role"
isOpen={upgradePlanPopUp.upgradePlan.isOpen}
onOpenChange={(open) => handleUpgradePlanPopUpToggle("upgradePlan", open)}
- text="Your current plan does not include custom roles. To unlock this feature, please upgrade to Infisical Advanced plan."
+ intent={{
+ ...CustomRolesUpgradeIntent,
+ isEnterpriseFeature: false
+ }}
/>
</>
);
diff --git a/frontend/src/pages/project/SettingsPage/components/CrossProjectSharingSection/CrossProjectSharingSection.tsx b/frontend/src/pages/project/SettingsPage/components/CrossProjectSharingSection/CrossProjectSharingSection.tsx
index 627e2ea3b9..fe8e614d3f 100644
--- a/frontend/src/pages/project/SettingsPage/components/CrossProjectSharingSection/CrossProjectSharingSection.tsx
+++ b/frontend/src/pages/project/SettingsPage/components/CrossProjectSharingSection/CrossProjectSharingSection.tsx
@@ -14,7 +14,10 @@ import {
TrashIcon
} from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import {
+ CrossProjectSecretSharingUpgradeIntent,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { PermissionDeniedBanner } from "@app/components/permissions";
import {
@@ -65,7 +68,6 @@ import {
useListProjectFolderGrants
} from "@app/hooks/api/projectFolderGrants";
import { projectFolderGrantKeys } from "@app/hooks/api/projectFolderGrants/queries";
-import { usePopUp } from "@app/hooks/usePopUp";
import { ShareSecretsEditData, ShareSecretsSheet } from "./ShareSecretsSheet";
@@ -204,7 +206,7 @@ export const CrossProjectSharingSection = () => {
const { currentProject } = useProject();
const { permission } = useProjectPermission();
const { subscription } = useSubscription();
- const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["upgradePlan"] as const);
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
const canEditGrants =
permission.can(
ProjectPermissionProjectFolderGrantActions.CreateGrant,
@@ -402,7 +404,10 @@ export const CrossProjectSharingSection = () => {
size="sm"
onClick={() => {
if (!subscription?.crossProjectSecretSharing) {
- handlePopUpOpen("upgradePlan");
+ openUpgradeGate({
+ intent: CrossProjectSecretSharingUpgradeIntent,
+ paywallKey: "project.cross-project-sharing"
+ });
return;
}
setEditData(null);
@@ -447,12 +452,7 @@ export const CrossProjectSharingSection = () => {
}}
sourceProjectId={currentProject.id}
/>
- <UpgradePlanModal
- paywallKey="project.cross-project-sharing"
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="Your current plan does not allow sharing secrets across projects. To unlock this feature, please upgrade to Infisical Pro plan."
- />
+ {upgradeGate}
</Card>
);
};
diff --git a/frontend/src/pages/secret-manager/InsightsPage/InsightsPage.tsx b/frontend/src/pages/secret-manager/InsightsPage/InsightsPage.tsx
index 8224993759..1c70245edd 100644
--- a/frontend/src/pages/secret-manager/InsightsPage/InsightsPage.tsx
+++ b/frontend/src/pages/secret-manager/InsightsPage/InsightsPage.tsx
@@ -9,7 +9,10 @@ import {
RefreshCwIcon
} from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import {
+ SecretAccessInsightsUpgradeIntent,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import { PageHeader } from "@app/components/v3/platform";
import {
ProjectPermissionInsightsActions,
@@ -22,7 +25,6 @@ import { ProjectPermissionHoneyTokenActions } from "@app/context/ProjectPermissi
import { withProjectPermission } from "@app/hoc";
import { ProjectType } from "@app/hooks/api/projects/types";
import { useGetInsightsCounts } from "@app/hooks/api/secretInsights/queries";
-import { usePopUp } from "@app/hooks/usePopUp";
import {
AuditReportsCard,
@@ -38,7 +40,7 @@ export const InsightsPage = withProjectPermission(
const { subscription } = useSubscription();
const { currentProject, projectId } = useProject();
const { permission } = useProjectPermission();
- const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["upgradePlan"] as const);
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
const { data: counts } = useGetInsightsCounts(
{ projectId },
@@ -47,9 +49,12 @@ export const InsightsPage = withProjectPermission(
useEffect(() => {
if (subscription && !subscription.secretAccessInsights) {
- handlePopUpOpen("upgradePlan");
+ openUpgradeGate({
+ intent: SecretAccessInsightsUpgradeIntent,
+ paywallKey: "secret-manager.insights"
+ });
}
- }, [subscription]);
+ }, [openUpgradeGate, subscription]);
const canReadHoneyTokens = permission.can(
ProjectPermissionHoneyTokenActions.Read,
@@ -140,14 +145,7 @@ export const InsightsPage = withProjectPermission(
<AuthMethodChart />
</div>
</div>
- <UpgradePlanModal
- paywallKey="secret-manager.insights"
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={(isOpen) => {
- handlePopUpToggle("upgradePlan", isOpen);
- }}
- text="Your current plan does not include access to secret insights. To unlock this feature, please upgrade your Infisical plan."
- />
+ {upgradeGate}
</>
);
},
diff --git a/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx b/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
index 774a0ff77d..5785e63b09 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/OverviewPage.tsx
@@ -39,7 +39,21 @@ import {
HoneyTokenDetailsDrawer,
RevokeHoneyTokenModal
} from "@app/components/honey-tokens";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import {
+ DynamicSecretsUpgradeIntent,
+ EnterpriseSecretSyncsUpgradeIntent,
+ EnvironmentLimitUpgradeIntent,
+ FolderAccessControlsUpgradeIntent,
+ hasEnvironmentCapacity,
+ HoneyTokensUpgradeIntent,
+ PointInTimeRecoveryUpgradeIntent,
+ SecretAccessInsightsUpgradeIntent,
+ SecretImportReplicationUpgradeIntent,
+ SecretRotationsUpgradeIntent,
+ SecretsBrokeringUpgradeIntent,
+ UpgradeIntent,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
@@ -346,6 +360,10 @@ const SECRET_SORT_OPTIONS = [
}
] as const;
+type UpgradeRequest = {
+ intent: UpgradeIntent;
+};
+
const OverviewPageContent = () => {
const { t } = useTranslation();
@@ -507,9 +525,10 @@ const OverviewPageContent = () => {
}, []);
const userAvailableEnvs = currentProject?.environments || [];
- const isMoreEnvironmentsAllowed = subscription?.environmentLimit
- ? userAvailableEnvs.length < subscription.environmentLimit
- : true;
+ const isMoreEnvironmentsAllowed = hasEnvironmentCapacity(
+ subscription?.environmentLimit,
+ userAvailableEnvs.length
+ );
const [storedEnvIds, setStoredEnvIds] = useLocalStorageState<string[]>(
`overview-selected-envs-${projectId}`,
userAvailableEnvs?.[0]?.id ? [userAvailableEnvs[0].id] : []
@@ -1032,6 +1051,7 @@ const OverviewPageContent = () => {
const [folderAccessTarget, setFolderAccessTarget] = useState<{
folderPath: string;
+ environmentSlug: string;
} | null>(null);
const [isCurrentFolderAccessOpen, setIsCurrentFolderAccessOpen] = useState(false);
@@ -1212,7 +1232,6 @@ const OverviewPageContent = () => {
"rotateSecretRotation",
"viewSecretRotationGeneratedCredentials",
"deleteSecretRotation",
- "upgradePlan",
"reconcileSecretRotation",
"importSecrets",
"editDynamicSecret",
@@ -1232,12 +1251,23 @@ const OverviewPageContent = () => {
"revokeHoneyToken",
"createEnvironment"
] as const);
-
- const [detailsDrawerHoneyTokenId, setDetailsDrawerHoneyTokenId] = useState<string | null>(null);
+ const { openUpgradeGate: openSharedUpgradeGate, upgradeGate } = useUpgradeGate();
const [commitHistoryEnv, setCommitHistoryEnv] = useState<{ slug: string; name: string } | null>(
null
);
+ const openUpgradeGate = useCallback(
+ (request: UpgradeRequest) => {
+ openSharedUpgradeGate({ ...request, paywallKey: "secret-manager.overview" });
+ },
+ [openSharedUpgradeGate]
+ );
+
+ const getEnvironmentUpgradeRequest = (): UpgradeRequest => ({
+ intent: EnvironmentLimitUpgradeIntent
+ });
+
+ const [detailsDrawerHoneyTokenId, setDetailsDrawerHoneyTokenId] = useState<string | null>(null);
// Auto-open honey token drawer when linked via notification/email
useEffect(() => {
if (routerSearch.honeyTokenId) {
@@ -1257,51 +1287,83 @@ const OverviewPageContent = () => {
}, [routerSearch.dynamicSecretId, dynamicSecrets?.map((ds) => ds.id).join(",")]);
const handleViewCommitHistory = (envSlug: string) => {
+ if (!canReadCommits) return;
+
+ const openCommitHistory = () => {
+ const env = userAvailableEnvs.find((el) => el.slug === envSlug);
+ setCommitHistoryEnv({ slug: envSlug, name: env?.name ?? envSlug });
+ };
+
if (!subscription?.pitRecovery) {
- handlePopUpOpen("upgradePlan", {
- text: "You can use point-in-time recovery if you upgrade your Infisical plan."
+ openUpgradeGate({
+ intent: PointInTimeRecoveryUpgradeIntent
});
return;
}
- if (!canReadCommits) return;
-
- const env = userAvailableEnvs.find((el) => el.slug === envSlug);
- setCommitHistoryEnv({ slug: envSlug, name: env?.name ?? envSlug });
+ openCommitHistory();
};
- const ensureFolderRbacPlan = useCallback(() => {
- if (subscription?.secretsFolderRbac) return true;
- handlePopUpOpen("upgradePlan", {
- text: "Folder-level access controls can be unlocked if you upgrade to Infisical Pro plan."
- });
- return false;
- }, [subscription?.secretsFolderRbac, handlePopUpOpen]);
-
const handleFolderAccessOpen = useCallback(
(folderName: string) => {
- if (!ensureFolderRbacPlan()) return;
- const folder = getFolderByNameAndEnv(folderName, singleEnvSlug);
- if (!folder) return;
- setFolderAccessTarget({
- folderPath: childFolderPath(folderName)
- });
- analytics.captureForOrganization(AnalyticsEvent.FolderAccessSheetOpened, orgId, {
- source: "folder_row",
- projectId
- });
+ const openFolderAccess = () => {
+ const folder = getFolderByNameAndEnv(folderName, singleEnvSlug);
+ if (!folder) return;
+ setFolderAccessTarget({
+ folderPath: childFolderPath(folderName),
+ environmentSlug: singleEnvSlug
+ });
+ analytics.captureForOrganization(AnalyticsEvent.FolderAccessSheetOpened, orgId, {
+ source: "folder_row",
+ projectId
+ });
+ };
+
+ if (!subscription?.secretsFolderRbac) {
+ openUpgradeGate({
+ intent: FolderAccessControlsUpgradeIntent
+ });
+ return;
+ }
+
+ openFolderAccess();
},
- [ensureFolderRbacPlan, getFolderByNameAndEnv, singleEnvSlug, childFolderPath, orgId, projectId]
+ [
+ getFolderByNameAndEnv,
+ singleEnvSlug,
+ childFolderPath,
+ orgId,
+ projectId,
+ subscription?.secretsFolderRbac,
+ openUpgradeGate
+ ]
);
const handleCurrentFolderAccessOpen = useCallback(() => {
- if (!ensureFolderRbacPlan()) return;
- setIsCurrentFolderAccessOpen(true);
- analytics.captureForOrganization(AnalyticsEvent.FolderAccessSheetOpened, orgId, {
- source: "breadcrumb",
- projectId
- });
- }, [ensureFolderRbacPlan, orgId, projectId]);
+ const openCurrentFolderAccess = () => {
+ setIsCurrentFolderAccessOpen(true);
+ analytics.captureForOrganization(AnalyticsEvent.FolderAccessSheetOpened, orgId, {
+ source: "breadcrumb",
+ projectId
+ });
+ };
+
+ if (!subscription?.secretsFolderRbac) {
+ openUpgradeGate({
+ intent: FolderAccessControlsUpgradeIntent
+ });
+ return;
+ }
+
+ openCurrentFolderAccess();
+ }, [
+ openUpgradeGate,
+ orgId,
+ projectId,
+ secretPath,
+ singleEnvSlug,
+ subscription?.secretsFolderRbac
+ ]);
const handleAddSecretImport = () => {
handlePopUpOpen("addSecretImport");
@@ -2812,6 +2874,44 @@ const OverviewPageContent = () => {
| (TDynamicSecret & { environment: string; isForced?: boolean })
| undefined;
+ async function handleAddHoneyToken(): Promise<void> {
+ if (!subscription?.honeyTokens) {
+ openUpgradeGate({
+ intent: HoneyTokensUpgradeIntent
+ });
+ return;
+ }
+
+ try {
+ const { data } = await apiRequest.get<{ used: number; limit: number }>(
+ "/api/v1/honey-tokens/limits",
+ {
+ params: { projectId }
+ }
+ );
+
+ if (data.used >= data.limit) {
+ openUpgradeGate({
+ intent: {
+ ...HoneyTokensUpgradeIntent,
+ upgradeLabel: "Increase Honey Token Limit",
+ quota: data,
+ quotaNotice: `You have used ${data.used} out of the ${data.limit} honey token limit.`
+ }
+ });
+ return;
+ }
+ } catch {
+ createNotification({
+ text: "Failed to check honey token limits. Please try again.",
+ type: "error"
+ });
+ return;
+ }
+
+ handlePopUpOpen("addHoneyToken");
+ }
+
const addResourceButtonsProps: AddResourceButtonsProps = {
onMenuOpen: (source, menuLevel) =>
analytics.captureForOrganization(AnalyticsEvent.SecretsAddResourceMenuOpened, orgId, {
@@ -2835,9 +2935,8 @@ const OverviewPageContent = () => {
handlePopUpOpen("addDynamicSecret");
return;
}
- handlePopUpOpen("upgradePlan", {
- isEnterpriseFeature: true,
- text: "Upgrade to the Infisical Secret Management advanced plan to unlock dynamic secrets."
+ openUpgradeGate({
+ intent: DynamicSecretsUpgradeIntent
});
},
onAddSecretRotation: () => {
@@ -2845,49 +2944,18 @@ const OverviewPageContent = () => {
handlePopUpOpen("addSecretRotation");
return;
}
- handlePopUpOpen("upgradePlan", {
- text: "Adding secret rotations can be unlocked if you upgrade to Infisical Pro plan."
- });
- },
- onAddHoneyToken: async () => {
- if (subscription?.honeyTokens) {
- try {
- const { data } = await apiRequest.get<{ used: number; limit: number }>(
- "/api/v1/honey-tokens/limits",
- {
- params: { projectId }
- }
- );
-
- if (data.used >= data.limit) {
- handlePopUpOpen("upgradePlan", {
- text: `You have used ${data.used} out of the ${data.limit} honey token limit.`
- });
- return;
- }
- } catch {
- createNotification({
- text: "Failed to check honey token limits. Please try again.",
- type: "error"
- });
- return;
- }
-
- handlePopUpOpen("addHoneyToken");
- return;
- }
- handlePopUpOpen("upgradePlan", {
- text: "Adding honey tokens can be unlocked if you upgrade to Infisical Pro plan."
+ openUpgradeGate({
+ intent: SecretRotationsUpgradeIntent
});
},
+ onAddHoneyToken: handleAddHoneyToken,
onAddProxiedService: () => {
if (subscription?.secretsBrokering) {
handlePopUpOpen("addProxiedService");
return;
}
- handlePopUpOpen("upgradePlan", {
- isEnterpriseFeature: true,
- text: "Secrets brokering can be unlocked if you upgrade to Infisical Enterprise plan."
+ openUpgradeGate({
+ intent: SecretsBrokeringUpgradeIntent
});
},
onCopySecrets: () =>
@@ -2947,6 +3015,7 @@ const OverviewPageContent = () => {
<EnvironmentSelect
selectedEnvs={filteredEnvs}
setSelectedEnvs={setFilteredEnvs}
+ onUpgradePlan={() => openUpgradeGate(getEnvironmentUpgradeRequest())}
isDisabled={
isBatchModeActive &&
(pendingChanges.secrets.length > 0 || pendingChanges.folders.length > 0)
@@ -3098,9 +3167,7 @@ const OverviewPageContent = () => {
if (isMoreEnvironmentsAllowed) {
handlePopUpOpen("createEnvironment");
} else {
- handlePopUpOpen("upgradePlan", {
- text: "Your current plan does not include access to adding custom environments. To unlock this feature, please upgrade to Infisical Pro plan."
- });
+ openUpgradeGate(getEnvironmentUpgradeRequest());
}
}}
/>
@@ -3726,6 +3793,11 @@ const OverviewPageContent = () => {
onBatchRevert={handleBatchRevert}
isSelectionDisabled={hasPendingBatchChanges}
onCopySecret={handleCopySecret}
+ onAccessInsightsUpgrade={() =>
+ openUpgradeGate({
+ intent: SecretAccessInsightsUpgradeIntent
+ })
+ }
activityId={getTableRowActivityId("secret", key)}
onActivityChange={handleTableRowActivityChange}
/>
@@ -4081,8 +4153,8 @@ const OverviewPageContent = () => {
}
}}
onUpgradePlan={() =>
- handlePopUpOpen("upgradePlan", {
- text: "Secret import replication requires an upgraded plan."
+ openUpgradeGate({
+ intent: SecretImportReplicationUpgradeIntent
})
}
/>
@@ -4096,16 +4168,13 @@ const OverviewPageContent = () => {
initialFormDataIsDirty={false}
startOnDestination={false}
onOpenChange={(isOpen) => handlePopUpToggle("addSecretSync", isOpen)}
+ onEnterpriseUpgrade={() =>
+ openUpgradeGate({
+ intent: EnterpriseSecretSyncsUpgradeIntent
+ })
+ }
/>
- {subscription && (
- <UpgradePlanModal
- paywallKey="secret-manager.overview"
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
- text={popUp.upgradePlan.data?.text}
- />
- )}
+ {upgradeGate}
<AddEnvironmentModal
isOpen={popUp.createEnvironment.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("createEnvironment", isOpen)}
@@ -4319,9 +4388,12 @@ const OverviewPageContent = () => {
if (!isOpen) setFolderAccessTarget(null);
}}
projectId={projectId}
- environmentSlug={singleEnvSlug}
+ environmentSlug={folderAccessTarget.environmentSlug}
folderPath={folderAccessTarget.folderPath}
- environmentName={singleEnvName}
+ environmentName={
+ userAvailableEnvs.find((env) => env.slug === folderAccessTarget.environmentSlug)
+ ?.name ?? folderAccessTarget.environmentSlug
+ }
/>
)}
{isCurrentFolderAccessOpen && (
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/EnvironmentSelect/EnvironmentSelect.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/EnvironmentSelect/EnvironmentSelect.tsx
index 74ec8deb61..b018764e97 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/components/EnvironmentSelect/EnvironmentSelect.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/components/EnvironmentSelect/EnvironmentSelect.tsx
@@ -2,7 +2,6 @@ import { SetStateAction, useState } from "react";
import { useQueryClient } from "@tanstack/react-query";
import { CheckIcon, ChevronsUpDownIcon, PlusIcon } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
Button,
@@ -37,9 +36,15 @@ type Props = {
selectedEnvs: ProjectEnv[];
setSelectedEnvs: (value: SetStateAction<ProjectEnv[]>) => void;
isDisabled?: boolean;
+ onUpgradePlan: () => void;
};
-export function EnvironmentSelect({ selectedEnvs, setSelectedEnvs, isDisabled }: Props) {
+export function EnvironmentSelect({
+ selectedEnvs,
+ setSelectedEnvs,
+ isDisabled,
+ onUpgradePlan
+}: Props) {
const [isOpen, setIsOpen] = useState(false);
const [inputValue, setInputValue] = useState("");
@@ -47,10 +52,7 @@ export function EnvironmentSelect({ selectedEnvs, setSelectedEnvs, isDisabled }:
currentProject: { environments: projectEnvs, id: projectId }
} = useProject();
const { subscription } = useSubscription();
- const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp([
- "createEnvironment",
- "upgradePlan"
- ] as const);
+ const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["createEnvironment"] as const);
const queryClient = useQueryClient();
const isMoreEnvironmentsAllowed =
@@ -63,7 +65,7 @@ export function EnvironmentSelect({ selectedEnvs, setSelectedEnvs, isDisabled }:
if (isMoreEnvironmentsAllowed) {
handlePopUpOpen("createEnvironment");
} else {
- handlePopUpOpen("upgradePlan");
+ onUpgradePlan();
}
};
@@ -114,12 +116,6 @@ export function EnvironmentSelect({ selectedEnvs, setSelectedEnvs, isDisabled }:
setSelectedEnvs([newEnv]);
}}
/>
- <UpgradePlanModal
- paywallKey="secret-manager.environment-select"
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={(open) => handlePopUpToggle("upgradePlan", open)}
- text="Your current plan does not include access to adding custom environments. To unlock this feature, please upgrade to Infisical Pro plan."
- />
<Popover open={isOpen} onOpenChange={setIsOpen}>
<Tooltip open={isDisabled ? undefined : false}>
<TooltipTrigger>
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/SecretTableRow/SecretEditTableRow.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/SecretTableRow/SecretEditTableRow.tsx
index 0e2c9c7534..a5c7a3b088 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/components/SecretTableRow/SecretEditTableRow.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/components/SecretTableRow/SecretEditTableRow.tsx
@@ -27,7 +27,6 @@ import {
} from "lucide-react";
import { twMerge } from "tailwind-merge";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
@@ -179,6 +178,7 @@ type Props = {
pendingKeyName?: string;
revokedProjectFolderGrant?: boolean;
onCopySecret?: () => void;
+ onAccessInsightsUpgrade: (onGranted: () => void) => void;
onExpandedChange?: (isExpanded: boolean) => void;
};
@@ -219,11 +219,11 @@ export const SecretEditTableRow = ({
pendingKeyName,
revokedProjectFolderGrant,
onCopySecret,
+ onAccessInsightsUpgrade,
onExpandedChange
}: Props) => {
const { handlePopUpOpen, handlePopUpToggle, handlePopUpClose, popUp } = usePopUp([
"editSecret",
- "accessInsightsUpgrade",
"createSharedSecret"
] as const);
@@ -1597,7 +1597,7 @@ export const SecretEditTableRow = ({
className="px-2.5 py-1.5"
onClick={() => {
if (!subscription?.secretAccessInsights) {
- handlePopUpOpen("accessInsightsUpgrade");
+ onAccessInsightsUpgrade(() => setIsAccessInsightsOpen(true));
} else {
setIsAccessInsightsOpen(true);
}
@@ -1910,13 +1910,6 @@ export const SecretEditTableRow = ({
)}
</SheetContent>
</Sheet>
- <UpgradePlanModal
- paywallKey="secret-manager.secret-edit-table-row"
- isOpen={popUp.accessInsightsUpgrade.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("accessInsightsUpgrade", isOpen)}
- text="Secret access insights can be unlocked if you upgrade to Infisical Pro plan."
- />
-
<AlertDialog
open={popUp.editSecret.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("editSecret", isOpen)}
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/SecretTableRow/SecretTableRow.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/SecretTableRow/SecretTableRow.tsx
index a6ce4b0cfc..8d53bcc932 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/components/SecretTableRow/SecretTableRow.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/components/SecretTableRow/SecretTableRow.tsx
@@ -116,6 +116,7 @@ type Props = {
source: { id: string; name: string; path: string; isValueHidden: boolean };
environmentSlug: string;
}) => void;
+ onAccessInsightsUpgrade: (onGranted: () => void) => void;
activityId: TableRowActivityId;
onActivityChange: TableRowActivityChangeHandler;
};
@@ -146,6 +147,7 @@ export const SecretTableRow = ({
onBatchRevert,
isSelectionDisabled,
onCopySecret,
+ onAccessInsightsUpgrade,
activityId,
onActivityChange
}: Props) => {
@@ -418,6 +420,7 @@ export const SecretTableRow = ({
})
: undefined
}
+ onAccessInsightsUpgrade={onAccessInsightsUpgrade}
onExpandedChange={setIsSingleEnvBaseActive}
/>
) : (
@@ -806,6 +809,7 @@ export const SecretTableRow = ({
})
: undefined
}
+ onAccessInsightsUpgrade={onAccessInsightsUpgrade}
/>
</TableCell>
</TableRow>
diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/AccessApprovalRequest.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/AccessApprovalRequest.tsx
index d24a9e4290..486feddea9 100644
--- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/AccessApprovalRequest.tsx
+++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/AccessApprovalRequest/AccessApprovalRequest.tsx
@@ -19,7 +19,10 @@ import {
TimerIcon
} from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import {
+ SecretAccessRequestsUpgradeIntent,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import {
Badge,
Button,
@@ -139,13 +142,13 @@ export const AccessApprovalRequest = ({
const { handlePopUpOpen, popUp, handlePopUpClose } = usePopUp([
"requestAccess",
- "reviewRequest",
- "upgradePlan"
+ "reviewRequest"
] as const);
const { permission } = useProjectPermission();
const { user } = useUser();
const { subscription } = useSubscription();
const { currentProject } = useProject();
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
const canReadMembers = permission.can(
ProjectPermissionMemberActions.Read,
ProjectPermissionSub.Member
@@ -551,8 +554,9 @@ export const AccessApprovalRequest = ({
<Button
onClick={() => {
if (subscription && !subscription?.secretApproval) {
- handlePopUpOpen("upgradePlan", {
- text: "Access requests feature can be unlocked if you upgrade to Infisical Pro plan."
+ openUpgradeGate({
+ intent: SecretAccessRequestsUpgradeIntent,
+ paywallKey: "secret-manager.access-approval-request"
});
return;
}
@@ -994,12 +998,7 @@ export const AccessApprovalRequest = ({
/>
)}
- <UpgradePlanModal
- paywallKey="secret-manager.access-approval-request"
- text={popUp.upgradePlan.data?.text}
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={() => handlePopUpClose("upgradePlan")}
- />
+ {upgradeGate}
</>
);
};
diff --git a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/ApprovalPolicyList.tsx b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/ApprovalPolicyList.tsx
index 79f0f28b71..13cf544051 100644
--- a/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/ApprovalPolicyList.tsx
+++ b/frontend/src/pages/secret-manager/SecretApprovalsPage/components/ApprovalPolicyList/ApprovalPolicyList.tsx
@@ -8,7 +8,10 @@ import {
SearchIcon
} from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import {
+ SecretApprovalPoliciesUpgradeIntent,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import {
AccessRestrictedNotice,
Alert,
@@ -152,24 +155,27 @@ export const ApprovalPolicyList = ({ projectId, openAddPolicy, onAddPolicyOpened
const [initialPolicyType, setInitialPolicyType] = useState<PolicyType>();
const { handlePopUpToggle, handlePopUpOpen, popUp } = usePopUp([
"policyForm",
- "deletePolicy",
- "upgradePlan"
+ "deletePolicy"
] as const);
const { permission } = useProjectPermission();
const { subscription } = useSubscription();
const { currentProject } = useProject();
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
useEffect(() => {
if (!openAddPolicy) return;
if (subscription && !subscription.secretApproval) {
- handlePopUpOpen("upgradePlan");
+ openUpgradeGate({
+ intent: SecretApprovalPoliciesUpgradeIntent,
+ paywallKey: "secret-manager.approval-policy-list"
+ });
} else {
setInitialPolicyType(openAddPolicy);
handlePopUpOpen("policyForm");
}
onAddPolicyOpened();
- }, [openAddPolicy, subscription, handlePopUpOpen, onAddPolicyOpened]);
+ }, [openAddPolicy, subscription, handlePopUpOpen, openUpgradeGate, onAddPolicyOpened]);
const canReadPolicies = permission.can(
ProjectPermissionActions.Read,
@@ -350,7 +356,10 @@ export const ApprovalPolicyList = ({ projectId, openAddPolicy, onAddPolicyOpened
<Button
onClick={() => {
if (subscription && !subscription?.secretApproval) {
- handlePopUpOpen("upgradePlan");
+ openUpgradeGate({
+ intent: SecretApprovalPoliciesUpgradeIntent,
+ paywallKey: "secret-manager.approval-policy-list"
+ });
return;
}
setInitialPolicyType(undefined);
@@ -567,7 +576,10 @@ export const ApprovalPolicyList = ({ projectId, openAddPolicy, onAddPolicyOpened
size="sm"
onClick={() => {
if (subscription && !subscription.secretApproval) {
- handlePopUpOpen("upgradePlan");
+ openUpgradeGate({
+ intent: SecretApprovalPoliciesUpgradeIntent,
+ paywallKey: "secret-manager.approval-policy-list"
+ });
} else {
setInitialPolicyType(undefined);
handlePopUpOpen("policyForm");
@@ -632,12 +644,7 @@ export const ApprovalPolicyList = ({ projectId, openAddPolicy, onAddPolicyOpened
policyId={popUp.deletePolicy.data.id}
/>
)}
- <UpgradePlanModal
- paywallKey="secret-manager.approval-policy-list"
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="Adding secret approval policies can be unlocked if you upgrade to Infisical Pro plan."
- />
+ {upgradeGate}
</>
);
};
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentSection.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentSection.tsx
index 7c2b7bfafd..9c4bb62384 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentSection.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentSection.tsx
@@ -2,7 +2,11 @@ import { useState } from "react";
import { addDays, format } from "date-fns";
import { PlusIcon, TriangleAlertIcon } from "lucide-react";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import {
+ EnvironmentLimitUpgradeIntent,
+ hasEnvironmentCapacity,
+ useUpgradeGate
+} from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
import { PermissionDeniedBanner, ProjectPermissionCan } from "@app/components/permissions";
import {
@@ -43,6 +47,7 @@ export const EnvironmentSection = () => {
const { subscription } = useSubscription();
const { currentProject } = useProject();
const { permission } = useProjectPermission();
+ const { openUpgradeGate, upgradeGate } = useUpgradeGate();
const deleteWsEnvironment = useDeleteWsEnvironment();
const restoreEnvironment = useRestoreEnvironment();
@@ -54,20 +59,24 @@ export const EnvironmentSection = () => {
const isRestorePending = restoreEnvironment.isPending || isRestoreSubmitting;
const isExternalMutationPending = isDeletePending || isRestorePending;
- const isMoreEnvironmentsAllowed =
- subscription?.environmentLimit && currentProject?.environments
- ? currentProject.environments.length < subscription.environmentLimit
- : true;
+ const isMoreEnvironmentsAllowed = hasEnvironmentCapacity(
+ subscription?.environmentLimit,
+ currentProject?.environments?.length ?? 0
+ );
const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
"createEnv",
"updateEnv",
"deleteEnv",
"restoreEnv",
- "hardDeleteEnv",
- "upgradePlan"
+ "hardDeleteEnv"
] as const);
+ const getEnvironmentUpgradeRequest = () => ({
+ intent: EnvironmentLimitUpgradeIntent,
+ paywallKey: "secret-manager.environment"
+ });
+
const deleteEnvData = popUp?.deleteEnv?.data as
| { name: string; slug: string; id: string }
| undefined;
@@ -175,7 +184,7 @@ export const EnvironmentSection = () => {
if (isMoreEnvironmentsAllowed) {
handlePopUpOpen("createEnv");
} else {
- handlePopUpOpen("upgradePlan");
+ openUpgradeGate(getEnvironmentUpgradeRequest());
}
}}
isDisabled={!isAllowed || isExternalMutationPending || isTableMutationPending}
@@ -338,12 +347,7 @@ export const EnvironmentSection = () => {
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
- <UpgradePlanModal
- paywallKey="secret-manager.environment"
- isOpen={popUp.upgradePlan.isOpen}
- onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="You have reached the maximum number of environments allowed on the free plan. Upgrade to Infisical Pro plan to add more environments."
- />
+ {upgradeGate}
</Card>
);
};
diff --git a/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentTable.tsx b/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentTable.tsx
index 3b1462a243..9faadedd10 100644
--- a/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentTable.tsx
+++ b/frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentTable.tsx
@@ -43,7 +43,7 @@ import { useUpdateWsEnvironment } from "@app/hooks/api";
import { ProjectDeletedEnvActor } from "@app/hooks/api/projects/types";
import { UsePopUpState } from "@app/hooks/usePopUp";
-type PopUpKeys = "updateEnv" | "deleteEnv" | "restoreEnv" | "hardDeleteEnv" | "upgradePlan";
+type PopUpKeys = "updateEnv" | "deleteEnv" | "restoreEnv" | "hardDeleteEnv";
type EnvPayload = { name: string; slug: string; id: string; deleteAfter?: string };
diff --git a/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/components/SecretScanningDataSourcesSection.tsx b/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/components/SecretScanningDataSourcesSection.tsx
index 371342ac19..8bb9df6d88 100644
--- a/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/components/SecretScanningDataSourcesSection.tsx
+++ b/frontend/src/pages/secret-scanning/SecretScanningDataSourcesPage/components/SecretScanningDataSourcesSection.tsx
@@ -1,7 +1,7 @@
import { faPlus } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { UpgradePlanModal } from "@app/components/license/UpgradePlanModal";
+import { SecretScanningUpgradeIntent, UpgradeGate } from "@app/components/license/UpgradeGate";
import { ProjectPermissionCan } from "@app/components/permissions";
import { CreateSecretScanningDataSourceModal } from "@app/components/secret-scanning";
import { Button, Spinner } from "@app/components/v2";
@@ -81,12 +81,11 @@ export const SecretScanningDataSourcesSection = () => {
isOpen={popUp.addDataSource.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("addDataSource", isOpen)}
/>
- <UpgradePlanModal
+ <UpgradeGate
paywallKey="secret-scanning.secret-scanning-data-sources"
isOpen={popUp.upgradePlan.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle("upgradePlan", isOpen)}
- text="Creating data sources can be unlocked if you upgrade to Infisical Enterprise plan."
- isEnterpriseFeature={popUp.upgradePlan.data?.isEnterpriseFeature}
+ intent={SecretScanningUpgradeIntent}
/>
</>
);