Files
outline/shared/utils/PlanHelper.test.ts
Tom Moor 41abdbec3f Add upsell settings pages for paid plan features (#14631)
* 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.
2026-11-20 08:29:16 -05:00

61 lines
1.8 KiB
TypeScript

import { Plan, PlanFeature } from "../types";
import { PlanHelper } from "./PlanHelper";
describe("PlanHelper", () => {
it("should define features for every plan", () => {
for (const plan of Object.values(Plan)) {
expect(PlanHelper.features[plan]).toBeDefined();
}
});
it("should not offer the legacy plan", () => {
expect(PlanHelper.plans).not.toContain(Plan.Legacy);
});
it("should check if a plan has a feature", () => {
expect(PlanHelper.hasFeature(Plan.Community, PlanFeature.AuditLog)).toBe(
false
);
expect(PlanHelper.hasFeature(Plan.Business, PlanFeature.AuditLog)).toBe(
true
);
});
it("should return the lowest plan with a feature", () => {
expect(PlanHelper.getMinimumPlan(PlanFeature.AuditLog)).toBe(Plan.Business);
});
it("should include AI answers in business and legacy plans", () => {
expect(PlanHelper.hasFeature(Plan.Standard, PlanFeature.AIAnswers)).toBe(
false
);
expect(PlanHelper.hasFeature(Plan.Business, PlanFeature.AIAnswers)).toBe(
true
);
expect(PlanHelper.hasFeature(Plan.Legacy, PlanFeature.AIAnswers)).toBe(
true
);
expect(PlanHelper.getMinimumPlan(PlanFeature.AIAnswers)).toBe(
Plan.Business
);
});
it("should include data attributes in business and above", () => {
expect(
PlanHelper.hasFeature(Plan.Standard, PlanFeature.DataAttributes)
).toBe(false);
expect(
PlanHelper.hasFeature(Plan.Business, PlanFeature.DataAttributes)
).toBe(true);
expect(
PlanHelper.hasFeature(Plan.Enterprise, PlanFeature.DataAttributes)
).toBe(true);
expect(PlanHelper.hasFeature(Plan.Legacy, PlanFeature.DataAttributes)).toBe(
false
);
expect(PlanHelper.getMinimumPlan(PlanFeature.DataAttributes)).toBe(
Plan.Business
);
});
});