mirror of
https://github.com/outline/outline.git
synced 2026-11-20 21:23:06 +03:00
* Add enterprise upsell plugin with placeholder settings pages Introduces a new client-only `upsell` plugin that surfaces Enterprise-only features as placeholder settings pages in the community edition, encouraging self-hosted users to upgrade. The plugin is gated to non-cloud deployments since the cloud edition already ships these features. Adds: - UpsellScene: a reusable upsell page (header, pitch, upgrade CTAs, and a preview of the locked settings). - UpsellSettingRow: an upsell variant of SettingRow that renders an Enterprise-only setting in a locked, non-interactive state. - EnterpriseBadge: a small badge denoting Enterprise-only features. - Placeholder pages for Audit Log, Data Attributes, and Glean. - A pricing URL on UrlHelper for the upgrade call to action. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ca46gcmqU5HGgoK8SFHUx * Add Security upsell rows and Collections upsell page Surfaces more Enterprise-only features in the community edition: - Adds locked upsell rows to the Security settings page for two-factor authentication, automatic sign-out, and an IP allowlist. These only render on self-hosted instances, where the real settings are not available. - Adds a Collections placeholder page to the upsell plugin advertising workspace-wide collection administration. Relocates the shared EnterpriseBadge and UpsellSettingRow components from the plugin into app/scenes/Settings/components so core settings pages and the plugin can both consume them without inverting the app/plugin dependency. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015ca46gcmqU5HGgoK8SFHUx * Show plan requirement on upsell pages and sidebar Replace the placeholder Enterprise rows with a single callout that names the minimum plan for each feature, mark upsell items in the settings sidebar with a muted lock, and sync PlanHelper with the plan entitlements. * Hide entitled upsells, show Glean upsell, fix billing link * Render upsell for settings pages without the entitlement Settings items can declare the plan feature they need. Without it, the page shows the upsell scene in place of the real one, and upsell plugin placeholders give way to a real page for the same feature.
70 lines
2.2 KiB
TypeScript
70 lines
2.2 KiB
TypeScript
import { Plan, PlanFeature } from "../types";
|
|
|
|
/**
|
|
* Describes the features that are included in each plan.
|
|
*
|
|
* IMPORTANT NOTICE: Bypassing or modifying license controls is a breach of
|
|
* the license agreement, and will automatically terminate your rights under
|
|
* the license for the current and all other versions.
|
|
*/
|
|
export class PlanHelper {
|
|
/** Plans that can be chosen, ordered from lowest to highest. */
|
|
public static readonly plans: Plan[] = [
|
|
Plan.Community,
|
|
Plan.Standard,
|
|
Plan.Business,
|
|
Plan.Enterprise,
|
|
];
|
|
|
|
/** The plan that a team gets when no other plan applies. */
|
|
public static readonly defaultPlan = Plan.Community;
|
|
|
|
/** The features that are included in each plan. */
|
|
public static readonly features: Record<Plan, PlanFeature[]> = {
|
|
[Plan.Community]: [],
|
|
[Plan.Standard]: [PlanFeature.Guests],
|
|
[Plan.Business]: Object.values(PlanFeature),
|
|
[Plan.Enterprise]: Object.values(PlanFeature),
|
|
[Plan.Legacy]: [
|
|
PlanFeature.AuditLog,
|
|
PlanFeature.AdvancedSecurity,
|
|
PlanFeature.Guests,
|
|
PlanFeature.ApiKeyManagement,
|
|
PlanFeature.ContentManagement,
|
|
PlanFeature.AIAnswers,
|
|
PlanFeature.CustomDomain,
|
|
],
|
|
};
|
|
|
|
/**
|
|
* Get the features that are included in a plan.
|
|
*
|
|
* @param plan the plan to get the features for.
|
|
* @returns the features included in the plan.
|
|
*/
|
|
public static getFeatures(plan: Plan): PlanFeature[] {
|
|
return this.features[plan] ?? [];
|
|
}
|
|
|
|
/**
|
|
* Check if a plan includes a feature.
|
|
*
|
|
* @param plan the plan to check.
|
|
* @param feature the feature to check for.
|
|
* @returns true if the plan includes the feature.
|
|
*/
|
|
public static hasFeature(plan: Plan, feature: PlanFeature): boolean {
|
|
return this.getFeatures(plan).includes(feature);
|
|
}
|
|
|
|
/**
|
|
* Get the lowest plan that can be chosen and includes a feature, for example to show in an upgrade prompt.
|
|
*
|
|
* @param feature the feature to find a plan for.
|
|
* @returns the lowest plan that includes the feature, or undefined if no plan does.
|
|
*/
|
|
public static getMinimumPlan(feature: PlanFeature): Plan | undefined {
|
|
return this.plans.find((plan) => this.hasFeature(plan, feature));
|
|
}
|
|
}
|