Skip to content

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

743 B
Raw Blame
import { SubscriptionPlan, SubscriptionPlanTypes } from "./types";

// Derive the plan label from the real plan slug, not feature booleans. Inferring "Enterprise" from a
// single entitled feature (e.g. groups) mislabels Pro orgs that bought an add-on granting it.
export const getSubscriptionPlanLabel = (subscription: SubscriptionPlan, suffix = "") => {
  const { slug } = subscription;
  if (
    slug === SubscriptionPlanTypes.Enterprise ||
    slug === SubscriptionPlanTypes.OnPremEnterprise
  ) {
    return `Enterprise${suffix}`;
  }
  if (!slug || slug === SubscriptionPlanTypes.Starter) {
    return `Free${suffix}`;
  }
  if (slug === SubscriptionPlanTypes.Advanced) {
    return `Advanced${suffix}`;
  }
  return `Pro${suffix}`;
};