Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix(billing): show self-hosted billing guidance by license state (#8680)
Andrew Huang98a9ab2edd58
diff --git a/frontend/src/components/license/UpgradeGate/UpgradeGate.tsx b/frontend/src/components/license/UpgradeGate/UpgradeGate.tsxindex 0794051df5..c448de0267 100644--- a/frontend/src/components/license/UpgradeGate/UpgradeGate.tsx+++ b/frontend/src/components/license/UpgradeGate/UpgradeGate.tsx@@ -27,7 +27,8 @@ import {OrgPermissionBillingActions,OrgPermissionSubjects,useOrganization,- useOrgPermission+ useOrgPermission,+ useSubscription} from "@app/context";import { isInfisicalCloud } from "@app/helpers/platform";import {@@ -42,6 +43,7 @@ import { fetchOrgSubscription, subscriptionQueryKeys } from "@app/hooks/api/subsimport { analytics, AnalyticsEvent } from "@app/lib/analytics";import { ProductIcon } from "@app/pages/organization/BillingV2Page/components/shared";+import { getSelfHostedLicenseState, SELF_HOSTED_LICENSE_COPY } from "../self-hosted-license";import { CapabilityUpgradeIntent } from "./capability-upgrade-intents";import { CapabilityUpgradeGate } from "./CapabilityUpgradeGate";import {@@ -265,6 +267,8 @@ const ProductUpgradeGate = ({ intent, paywallKey, isOpen, onOpenChange }: Props)const queryClient = useQueryClient();const { currentOrg, isSubOrganization } = useOrganization();const { permission } = useOrgPermission();+ const { subscription } = useSubscription();+ const licenseCopy = SELF_HOSTED_LICENSE_COPY[getSelfHostedLicenseState(subscription)];const billingOrgId = currentOrg.rootOrgId ?? currentOrg.id;const canReadBilling = permission.can(OrgPermissionBillingActions.Read,@@ -567,7 +571,7 @@ const ProductUpgradeGate = ({ intent, paywallKey, isOpen, onOpenChange }: Props)<AlertDescription>Plan details could not be loaded.{" "}{isSelfHosted- ? "Try again, or contact our team for a self-hosted or offline license."+ ? licenseCopy.detail: "Try again, or contact Infisical if the problem continues."}</AlertDescription></Alert>@@ -905,6 +909,14 @@ const ProductUpgradeGate = ({ intent, paywallKey, isOpen, onOpenChange }: Props)</AlertDescription></Alert>);+ } else if (overview.data.mode === "managed") {+ notice = (+ <Alert variant="info" appearance="borderless">+ <CircleAlert />+ <AlertTitle>{licenseCopy.title}</AlertTitle>+ <AlertDescription>{licenseCopy.detail}</AlertDescription>+ </Alert>+ );} else if (!selfServe) {notice = (<Alert variant="info" appearance="borderless">diff --git a/frontend/src/components/license/self-hosted-license.ts b/frontend/src/components/license/self-hosted-license.tsnew file mode 100644index 0000000000..fc49efa9a2--- /dev/null+++ b/frontend/src/components/license/self-hosted-license.ts@@ -0,0 +1,63 @@+import { SubscriptionPlan } from "@app/hooks/api/subscriptions/types";++export type SelfHostedLicenseState = "unlicensed" | "online" | "offline" | "unavailable";++export const SELF_HOSTED_CONTACT_SALES_URL = "https://infisical.com/talk-to-us";+export const SELF_HOSTED_LICENSE_DOCS_URL = "https://infisical.com/docs/self-hosting/ee";++export const getSelfHostedLicenseState = (+ plan?: Pick<SubscriptionPlan, "isOffline" | "productPlans" | "slug"> | null+): SelfHostedLicenseState => {+ if (!plan) return "unavailable";+ if (plan.isOffline) return "offline";+ if (Array.isArray(plan.productPlans)) return "online";+ if (!plan.slug) return "unlicensed";+ return "unavailable";+};++type SelfHostedLicenseCopy = {+ method: string;+ methodHint: string;+ title: string;+ detail: string;+ pageDescription: string;+ inactiveProductNote: string;+};++export const SELF_HOSTED_LICENSE_COPY: Record<SelfHostedLicenseState, SelfHostedLicenseCopy> = {+ unlicensed: {+ method: "Free",+ methodHint: "No active license",+ title: "No License Active",+ detail:+ "No license is active, so paid features stay locked until you set LICENSE_KEY on the server and restart it.",+ pageDescription: "View products and usage for this unlicensed instance.",+ inactiveProductNote: "Requires a self-hosted license key from sales."+ },+ online: {+ method: "License",+ methodHint: "Synced from Infisical",+ title: "Set by Your License",+ detail:+ "Products and limits sync from your Infisical license, so contact sales to change them.",+ pageDescription: "View products and usage set by your Infisical license.",+ inactiveProductNote: "Not in your license, so contact sales to add it."+ },+ offline: {+ method: "Offline License",+ methodHint: "Set by your license key",+ title: "Offline License",+ detail:+ "To change your plan, get an updated key from sales, replace LICENSE_KEY on the server, and restart it.",+ pageDescription: "Your plan is set by an offline license.",+ inactiveProductNote: "Not in your offline license, so contact sales for an updated key."+ },+ unavailable: {+ method: "License",+ methodHint: "Details unavailable",+ title: "License Details Unavailable",+ detail: "License details couldn't be read, so contact sales to get or update a license key.",+ pageDescription: "View your products and usage.",+ inactiveProductNote: "Not active on this instance, so contact sales for licensing options."+ }+};diff --git a/frontend/src/pages/organization/BillingPage/OfflineBillingPage.tsx b/frontend/src/pages/organization/BillingPage/OfflineBillingPage.tsxindex 0ca8aa1de7..2a6cc5af99 100644--- a/frontend/src/pages/organization/BillingPage/OfflineBillingPage.tsx+++ b/frontend/src/pages/organization/BillingPage/OfflineBillingPage.tsx@@ -1,9 +1,13 @@import { Helmet } from "react-helmet";import { useTranslation } from "react-i18next";-import { TriangleAlert } from "lucide-react";+import { ExternalLink, TriangleAlert } from "lucide-react";+import {+ SELF_HOSTED_CONTACT_SALES_URL,+ SELF_HOSTED_LICENSE_COPY+} from "@app/components/license/self-hosted-license";import { OrgPermissionCan } from "@app/components/permissions";-import { Alert, AlertDescription, AlertTitle } from "@app/components/v3";+import { Alert, AlertDescription, AlertTitle, Button } from "@app/components/v3";import { PageHeader } from "@app/components/v3/platform";import { OrgPermissionBillingActions, OrgPermissionSubjects } from "@app/context";@@ -25,7 +29,7 @@ export const OfflineBillingPage = () => {<PageHeaderscope="org"title={t("billing.title")}- description="Your plan is provisioned through an offline license."+ description={SELF_HOSTED_LICENSE_COPY.offline.pageDescription}/><OrgPermissionCanpassThrough={false}@@ -34,11 +38,21 @@ export const OfflineBillingPage = () => {><Alert variant="info"><TriangleAlert />- <AlertTitle>Offline license</AlertTitle>+ <AlertTitle>{SELF_HOSTED_LICENSE_COPY.offline.title}</AlertTitle><AlertDescription>- This instance runs on an offline license, so subscription and billing management- isn't available here. Contact your Infisical account manager to make changes to- your plan.+ {SELF_HOSTED_LICENSE_COPY.offline.detail}+ <div className="mt-3">+ <Button variant="outline" size="sm" asChild>+ <a+ href={SELF_HOSTED_CONTACT_SALES_URL}+ target="_blank"+ rel="noopener noreferrer"+ >+ Contact Sales+ <ExternalLink />+ </a>+ </Button>+ </div></AlertDescription></Alert></OrgPermissionCan>diff --git a/frontend/src/pages/organization/BillingV2Page/BillingV2Page.tsx b/frontend/src/pages/organization/BillingV2Page/BillingV2Page.tsxindex 40b29fdba7..1e00eb658b 100644--- a/frontend/src/pages/organization/BillingV2Page/BillingV2Page.tsx+++ b/frontend/src/pages/organization/BillingV2Page/BillingV2Page.tsx@@ -2,6 +2,10 @@ import { useEffect, useRef, useState } from "react";import { Helmet } from "react-helmet";import { useTranslation } from "react-i18next";+import {+ getSelfHostedLicenseState,+ SELF_HOSTED_LICENSE_COPY+} from "@app/components/license/self-hosted-license";import { getSafeUpgradeReturnPath } from "@app/components/license/UpgradeGate";import { createNotification } from "@app/components/notifications";import { OrgPermissionCan } from "@app/components/permissions";@@ -10,7 +14,8 @@ import {OrgPermissionBillingActions,OrgPermissionSubjects,useOrganization,- useOrgPermission+ useOrgPermission,+ useSubscription} from "@app/context";import { isInfisicalCloud } from "@app/helpers/platform";import { useDebounce } from "@app/hooks";@@ -48,6 +53,7 @@ export const BillingV2Page = () => {const { t } = useTranslation();const { currentOrg } = useOrganization();const { permission } = useOrgPermission();+ const { subscription } = useSubscription();const orgId = currentOrg?.id ?? "";const hasManageBillingPermission = permission.can(OrgPermissionBillingActions.ManageBilling,@@ -275,10 +281,10 @@ export const BillingV2Page = () => {refetch();};- // A managed (self-hosted licensed) org can't self-serve through Stripe; its plan is set by the license.+ // A managed (self-hosted) org can't self-serve through Stripe; its plan is set by its license state.const isManaged = overview ? overview.mode === "managed" : !isInfisicalCloud();const pageDescription = isManaged- ? "View your subscription, products, and usage. Your plan is managed through your license."+ ? SELF_HOSTED_LICENSE_COPY[getSelfHostedLicenseState(subscription)].pageDescription: "Manage your subscription, products, and payment. Payment is handled securely through Stripe.";return (diff --git a/frontend/src/pages/organization/BillingV2Page/components/ProductOverviewCard.tsx b/frontend/src/pages/organization/BillingV2Page/components/ProductOverviewCard.tsxindex e8062a1cae..19ad7fbf51 100644--- a/frontend/src/pages/organization/BillingV2Page/components/ProductOverviewCard.tsx+++ b/frontend/src/pages/organization/BillingV2Page/components/ProductOverviewCard.tsx@@ -1,6 +1,10 @@import { CSSProperties, ReactNode, useEffect, useRef, useState } from "react";import { ChevronDownIcon, ChevronRightIcon, ChevronUpIcon, EllipsisIcon } from "lucide-react";+import {+ getSelfHostedLicenseState,+ SELF_HOSTED_LICENSE_COPY+} from "@app/components/license/self-hosted-license";import {Badge,Button,@@ -18,6 +22,7 @@ import {Skeleton} from "@app/components/v3";import { cn } from "@app/components/v3/utils";+import { useSubscription } from "@app/context";import {BillingV2BreakdownScopeKind,BillingV2CatalogProduct,@@ -798,6 +803,7 @@ export const InactiveProductCard = ({onManage: (productId: string) => void;onContact: (prod: BillingV2CatalogProduct) => void;}) => {+ const { subscription } = useSubscription();const trialPlan = prod.plans.find((plan) => plan.selfServe && plan.trialable);const hasSelfServePlan = prod.plans.some((plan) => plan.selfServe);const hasSalesLedPlan = prod.plans.some((plan) => plan.salesLed);@@ -811,7 +817,7 @@ export const InactiveProductCard = ({let note = "This product hasn't been activated for your organization.";if (isManaged) {- note = "Not included in your license. Contact your account manager to enable it.";+ note = SELF_HOSTED_LICENSE_COPY[getSelfHostedLicenseState(subscription)].inactiveProductNote;} else if (!selfServe && !canContactSales) {note = "Contact your account manager to enable this product.";}diff --git a/frontend/src/pages/organization/BillingV2Page/components/TabbedOverview.tsx b/frontend/src/pages/organization/BillingV2Page/components/TabbedOverview.tsxindex 4c710f734f..8eb299bb50 100644--- a/frontend/src/pages/organization/BillingV2Page/components/TabbedOverview.tsx+++ b/frontend/src/pages/organization/BillingV2Page/components/TabbedOverview.tsx@@ -1,6 +1,12 @@import { ReactNode, useState } from "react";-import { ChevronRightIcon, InfoIcon, RefreshCw } from "lucide-react";+import { ChevronRightIcon, ExternalLink, InfoIcon, RefreshCw } from "lucide-react";+import {+ getSelfHostedLicenseState,+ SELF_HOSTED_CONTACT_SALES_URL,+ SELF_HOSTED_LICENSE_COPY,+ SELF_HOSTED_LICENSE_DOCS_URL+} from "@app/components/license/self-hosted-license";import {CertificateManagementUpgradeIntent,PamUpgradeIntent,@@ -12,7 +18,6 @@ import { createNotification } from "@app/components/notifications";import {Badge,Card,- CardContent,IconButton,Separator,Skeleton,@@ -21,7 +26,7 @@ import {TooltipTrigger} from "@app/components/v3";import { cn } from "@app/components/v3/utils";-import { useOrganization } from "@app/context";+import { useOrganization, useSubscription } from "@app/context";import {BillingV2BreakdownScopeKind,BillingV2CatalogProduct,@@ -106,28 +111,80 @@ export const TabbedOverviewSkeleton = ({ orgFilter }: { orgFilter?: ReactNode })</div>);-const SummaryBlock = ({+const SUMMARY_BLOCK_CLASS =+ "flex min-w-36 flex-col gap-1 rounded-md bg-container px-3 py-2.5 text-left outline-0";+const SUMMARY_BLOCK_ACTION_CLASS =+ "cursor-pointer transition-colors hover:bg-container-hover focus-visible:ring-2 focus-visible:ring-ring";++const SummaryBlockBody = ({label,- onClick,+ icon,children}: {label: string;- onClick: () => void;+ icon?: ReactNode;children: ReactNode;}) => (- <button- type="button"- className="flex min-w-36 cursor-pointer flex-col gap-1 rounded-md bg-container px-3 py-2.5 text-left outline-0 transition-colors hover:bg-container-hover focus-visible:ring-2 focus-visible:ring-ring"- onClick={onClick}- >+ <><span className="text-xs text-accent">{label}</span><span className="flex min-w-0 items-center justify-between gap-2 text-sm"><span className="flex min-w-0 items-baseline gap-1.5 truncate">{children}</span>- <ChevronRightIcon className="size-3.5 shrink-0 text-muted" />+ {icon}</span>- </button>+ </>);+const SummaryBlock = ({+ label,+ onClick,+ href,+ children+}: {+ label: string;+ onClick?: () => void;+ href?: string;+ children: ReactNode;+}) => {+ if (href) {+ return (+ <a+ href={href}+ target="_blank"+ rel="noopener noreferrer"+ className={cn(SUMMARY_BLOCK_CLASS, SUMMARY_BLOCK_ACTION_CLASS)}+ >+ <SummaryBlockBody+ label={label}+ icon={<ExternalLink className="size-3.5 shrink-0 text-muted" />}+ >+ {children}+ </SummaryBlockBody>+ </a>+ );+ }+ if (onClick) {+ return (+ <button+ type="button"+ className={cn(SUMMARY_BLOCK_CLASS, SUMMARY_BLOCK_ACTION_CLASS)}+ onClick={onClick}+ >+ <SummaryBlockBody+ label={label}+ icon={<ChevronRightIcon className="size-3.5 shrink-0 text-muted" />}+ >+ {children}+ </SummaryBlockBody>+ </button>+ );+ }+ return (+ <div className={SUMMARY_BLOCK_CLASS}>+ <SummaryBlockBody label={label}>{children}</SummaryBlockBody>+ </div>+ );+};+export const TabbedOverview = ({overview,catalog,@@ -144,6 +201,8 @@ export const TabbedOverview = ({onContact}: TabbedOverviewProps) => {const { currentOrg } = useOrganization();+ const { subscription } = useSubscription();+ const licenseCopy = SELF_HOSTED_LICENSE_COPY[getSelfHostedLicenseState(subscription)];const refreshEntitlements = useRefreshBillingV2Entitlements();const [expanded, setExpanded] = useState<{ productId: string; dimensionKey?: string } | null>(null@@ -192,13 +251,7 @@ export const TabbedOverview = ({trialNote = `${trials.length} trials · first ends ${trials[0].endsAt}`;}let accountTeamNote: { label: string; detail: string } | null = null;- if (isManaged) {- accountTeamNote = {- label: "Managed by your account team",- detail:- "Products and limits on this organization are set by contract. Contact your account manager to make changes."- };- } else if (!overview.selfServe) {+ if (!isManaged && !overview.selfServe) {accountTeamNote = {label: "Managed Billing",detail:@@ -222,9 +275,16 @@ export const TabbedOverview = ({summaryLeft = (<div className="flex flex-col gap-1"><span className="text-xs text-accent">Billing Method</span>- <span className="flex items-baseline gap-2">- <span className="text-lg leading-6 font-medium">Contract</span>- <span className="text-xs text-muted">Set by your license</span>+ <span className="flex items-center gap-1">+ <span className="text-lg leading-6 font-medium">{licenseCopy.method}</span>+ <Tooltip>+ <TooltipTrigger asChild>+ <IconButton size="2xs" variant="ghost-muted" aria-label="About this license">+ <InfoIcon />+ </IconButton>+ </TooltipTrigger>+ <TooltipContent className="max-w-80">{licenseCopy.detail}</TooltipContent>+ </Tooltip></span></div>);@@ -291,10 +351,17 @@ export const TabbedOverview = ({let summaryRight: ReactNode = null;if (isManaged) {summaryRight = (- <span className="text-xs text-muted">- {billing.activeProductCount.toLocaleString()} active{" "}- {billing.activeProductCount === 1 ? "product" : "products"}- </span>+ <>+ <SummaryBlock label="Products">+ {billing.activeProductCount.toLocaleString()} active+ </SummaryBlock>+ <SummaryBlock label="License" href={SELF_HOSTED_LICENSE_DOCS_URL}>+ {licenseCopy.methodHint}+ </SummaryBlock>+ <SummaryBlock label="Plan Changes" href={SELF_HOSTED_CONTACT_SALES_URL}>+ Contact Sales+ </SummaryBlock>+ </>);}const latestInvoice = overview.invoices[0];@@ -385,14 +452,10 @@ export const TabbedOverview = ({</Card>{visible.length === 0 ? (- <Card>- <CardContent>- <CardEmpty- title="No products available"- description="Products will appear here once they're available."- />- </CardContent>- </Card>+ <CardEmpty+ title="No products available"+ description="Products will appear here once they're available."+ />) : (<>{activeProducts.length > 0 && (