Skip to content

πŸ™Œ OpenHands: AI-Driven Development

feat(frontend): removed PROJ_USER_JOURNEY feature flag (#13940)

HeyItsChloe22b91976fdf0
diff --git a/frontend/__tests__/components/features/auth/login-content.test.tsx b/frontend/__tests__/components/features/auth/login-content.test.tsx
index 176b15ea95..8aadc507cb 100644
--- a/frontend/__tests__/components/features/auth/login-content.test.tsx
+++ b/frontend/__tests__/components/features/auth/login-content.test.tsx
@@ -49,17 +49,34 @@ vi.mock("#/utils/custom-toast-handlers", () => ({
displayErrorToast: vi.fn(),
}));
-// Mock feature flags - we'll control the return value in each test
-const mockEnableProjUserJourney = vi.fn(() => true);
-vi.mock("#/utils/feature-flags", () => ({
- ENABLE_PROJ_USER_JOURNEY: () => mockEnableProjUserJourney(),
+const mockUseAppMode = vi.fn(() => ({
+ isOss: false,
+ isSaas: true,
+ isCloud: true,
+ isSelfHosted: false,
+ isEnterpriseSelfHosted: false,
+ isEnterpriseCloud: true,
+ appMode: "saas" as string | undefined,
+ deploymentMode: "cloud" as string | undefined,
+}));
+vi.mock("#/hooks/use-app-mode", () => ({
+ useAppMode: () => mockUseAppMode(),
}));
describe("LoginContent", () => {
beforeEach(() => {
vi.stubGlobal("location", { href: "" });
- // Reset mock to return true by default
- mockEnableProjUserJourney.mockReturnValue(true);
+ // Reset mock to return SaaS Cloud (CTA enabled) by default
+ mockUseAppMode.mockReturnValue({
+ isOss: false,
+ isSaas: true,
+ isCloud: true,
+ isSelfHosted: false,
+ isEnterpriseSelfHosted: false,
+ isEnterpriseCloud: true,
+ appMode: "saas",
+ deploymentMode: "cloud",
+ });
});
afterEach(() => {
@@ -282,7 +299,18 @@ describe("LoginContent", () => {
expect(screen.getByTestId("terms-and-privacy-notice")).toBeInTheDocument();
});
- it("should display the enterprise LoginCTA component when appMode is saas and feature flag enabled", () => {
+ it("should display the enterprise LoginCTA component when in SaaS Cloud mode", () => {
+ mockUseAppMode.mockReturnValue({
+ isOss: false,
+ isSaas: true,
+ isCloud: true,
+ isSelfHosted: false,
+ isEnterpriseSelfHosted: false,
+ isEnterpriseCloud: true,
+ appMode: "saas",
+ deploymentMode: "cloud",
+ });
+
render(
<MemoryRouter>
<LoginContent
@@ -296,26 +324,23 @@ describe("LoginContent", () => {
expect(screen.getByTestId("login-cta")).toBeInTheDocument();
});
- it("should not display the enterprise LoginCTA component when appMode is oss even with feature flag enabled", () => {
- render(
- <MemoryRouter>
- <LoginContent
- githubAuthUrl="https://github.com/oauth/authorize"
- appMode="oss"
- providersConfigured={["github"]}
- />
- </MemoryRouter>,
- );
-
- expect(screen.queryByTestId("login-cta")).not.toBeInTheDocument();
- });
+ it("should not display the enterprise LoginCTA component when in OSS mode", () => {
+ mockUseAppMode.mockReturnValue({
+ isOss: true,
+ isSaas: false,
+ isCloud: false,
+ isSelfHosted: false,
+ isEnterpriseSelfHosted: false,
+ isEnterpriseCloud: false,
+ appMode: "oss",
+ deploymentMode: undefined,
+ });
- it("should not display the enterprise LoginCTA component when appMode is null", () => {
render(
<MemoryRouter>
<LoginContent
githubAuthUrl="https://github.com/oauth/authorize"
- appMode={null}
+ appMode="oss"
providersConfigured={["github"]}
/>
</MemoryRouter>,
@@ -324,9 +349,17 @@ describe("LoginContent", () => {
expect(screen.queryByTestId("login-cta")).not.toBeInTheDocument();
});
- it("should not display the enterprise LoginCTA component when feature flag is disabled", () => {
- // Disable the feature flag
- mockEnableProjUserJourney.mockReturnValue(false);
+ it("should not display the enterprise LoginCTA component when in SaaS Self-hosted mode", () => {
+ mockUseAppMode.mockReturnValue({
+ isOss: false,
+ isSaas: true,
+ isCloud: false,
+ isSelfHosted: true,
+ isEnterpriseSelfHosted: true,
+ isEnterpriseCloud: false,
+ appMode: "saas",
+ deploymentMode: "self_hosted",
+ });
render(
<MemoryRouter>
diff --git a/frontend/__tests__/components/features/device-verify/enterprise-banner.test.tsx b/frontend/__tests__/components/features/device-verify/enterprise-banner.test.tsx
deleted file mode 100644
index 8471d87c3e..0000000000
--- a/frontend/__tests__/components/features/device-verify/enterprise-banner.test.tsx
+++ /dev/null
@@ -1,118 +0,0 @@
-import { screen } from "@testing-library/react";
-import { beforeEach, describe, expect, it, vi } from "vitest";
-import userEvent from "@testing-library/user-event";
-import { renderWithProviders } from "test-utils";
-import { EnterpriseBanner } from "#/components/features/device-verify/enterprise-banner";
-
-const mockCapture = vi.fn();
-vi.mock("posthog-js/react", () => ({
- usePostHog: () => ({
- capture: mockCapture,
- }),
-}));
-
-const { ENABLE_PROJ_USER_JOURNEY_MOCK } = vi.hoisted(() => ({
- ENABLE_PROJ_USER_JOURNEY_MOCK: vi.fn(() => true),
-}));
-
-vi.mock("#/utils/feature-flags", () => ({
- ENABLE_PROJ_USER_JOURNEY: () => ENABLE_PROJ_USER_JOURNEY_MOCK(),
-}));
-
-describe("EnterpriseBanner", () => {
- beforeEach(() => {
- vi.clearAllMocks();
- ENABLE_PROJ_USER_JOURNEY_MOCK.mockReturnValue(true);
- });
-
- describe("Feature Flag", () => {
- it("should not render when proj_user_journey feature flag is disabled", () => {
- ENABLE_PROJ_USER_JOURNEY_MOCK.mockReturnValue(false);
-
- const { container } = renderWithProviders(<EnterpriseBanner />);
-
- expect(container.firstChild).toBeNull();
- expect(screen.queryByText("ENTERPRISE$TITLE")).not.toBeInTheDocument();
- });
-
- it("should render when proj_user_journey feature flag is enabled", () => {
- ENABLE_PROJ_USER_JOURNEY_MOCK.mockReturnValue(true);
-
- renderWithProviders(<EnterpriseBanner />);
-
- expect(screen.getByText("ENTERPRISE$TITLE")).toBeInTheDocument();
- });
- });
-
- describe("Rendering", () => {
- it("should render the self-hosted label", () => {
- renderWithProviders(<EnterpriseBanner />);
-
- expect(screen.getByText("ENTERPRISE$SELF_HOSTED")).toBeInTheDocument();
- });
-
- it("should render the enterprise title", () => {
- renderWithProviders(<EnterpriseBanner />);
-
- expect(screen.getByText("ENTERPRISE$TITLE")).toBeInTheDocument();
- });
-
- it("should render the enterprise description", () => {
- renderWithProviders(<EnterpriseBanner />);
-
- expect(screen.getByText("ENTERPRISE$DESCRIPTION")).toBeInTheDocument();
- });
-
- it("should render all four enterprise feature items", () => {
- renderWithProviders(<EnterpriseBanner />);
-
- expect(
- screen.getByText("ENTERPRISE$FEATURE_DATA_PRIVACY"),
- ).toBeInTheDocument();
- expect(
- screen.getByText("ENTERPRISE$FEATURE_DEPLOYMENT"),
- ).toBeInTheDocument();
- expect(screen.getByText("ENTERPRISE$FEATURE_SSO")).toBeInTheDocument();
- expect(
- screen.getByText("ENTERPRISE$FEATURE_SUPPORT"),
- ).toBeInTheDocument();
- });
-
- it("should render the learn more link", () => {
- renderWithProviders(<EnterpriseBanner />);
-
- const link = screen.getByRole("link", {
- name: "ENTERPRISE$LEARN_MORE_ARIA",
- });
- expect(link).toBeInTheDocument();
- expect(link).toHaveTextContent("ENTERPRISE$LEARN_MORE");
- expect(link).toHaveAttribute("href", "https://openhands.dev/enterprise");
- expect(link).toHaveAttribute("target", "_blank");
- expect(link).toHaveAttribute("rel", "noopener noreferrer");
- });
- });
-
- describe("Learn More Link Interaction", () => {
- it("should capture PostHog event when learn more link is clicked", async () => {
- const user = userEvent.setup();
- renderWithProviders(<EnterpriseBanner />);
-
- const link = screen.getByRole("link", {
- name: "ENTERPRISE$LEARN_MORE_ARIA",
- });
- await user.click(link);
-
- expect(mockCapture).toHaveBeenCalledWith("saas_selfhosted_inquiry");
- });
-
- it("should have correct href attribute for opening in new tab", () => {
- renderWithProviders(<EnterpriseBanner />);
-
- const link = screen.getByRole("link", {
- name: "ENTERPRISE$LEARN_MORE_ARIA",
- });
- expect(link).toHaveAttribute("href", "https://openhands.dev/enterprise");
- expect(link).toHaveAttribute("target", "_blank");
- });
- });
-});
diff --git a/frontend/__tests__/components/features/user/user-context-menu.test.tsx b/frontend/__tests__/components/features/user/user-context-menu.test.tsx
index 48e1ac88b7..dd0706527c 100644
--- a/frontend/__tests__/components/features/user/user-context-menu.test.tsx
+++ b/frontend/__tests__/components/features/user/user-context-menu.test.tsx
@@ -23,12 +23,6 @@ vi.mock("#/hooks/use-breakpoint", () => ({
useBreakpoint: vi.fn(() => false), // Default to desktop (not mobile)
}));
-// Mock feature flags
-const mockEnableProjUserJourney = vi.fn(() => true);
-vi.mock("#/utils/feature-flags", () => ({
- ENABLE_PROJ_USER_JOURNEY: () => mockEnableProjUserJourney(),
-}));
-
// Mock useTracking hook for CTA
vi.mock("#/hooks/use-tracking", () => ({
useTracking: () => ({
@@ -144,9 +138,8 @@ describe("UserContextMenu", () => {
// Ensure clean state at the start of each test
vi.restoreAllMocks();
useSelectedOrganizationStore.setState({ organizationId: null });
- // Reset feature flag and breakpoint mocks to defaults
- mockEnableProjUserJourney.mockReturnValue(true);
- vi.mocked(breakpoint.useBreakpoint).mockReturnValue(false); // Desktop by default
+ // Reset breakpoint mock to desktop by default
+ vi.mocked(breakpoint.useBreakpoint).mockReturnValue(false);
});
afterEach(() => {
@@ -750,15 +743,26 @@ describe("UserContextMenu", () => {
});
describe("Context Menu CTA", () => {
- it("should render the CTA component in SaaS mode on desktop with feature flag enabled", async () => {
- // Set SaaS mode
+ it("should render the CTA component in SaaS Cloud mode on desktop", async () => {
vi.spyOn(OptionService, "getConfig").mockResolvedValue(
- createMockWebClientConfig({ app_mode: "saas" }),
+ createMockWebClientConfig({
+ app_mode: "saas",
+ feature_flags: {
+ deployment_mode: "cloud",
+ enable_billing: false,
+ hide_llm_settings: false,
+ enable_jira: false,
+ enable_jira_dc: false,
+ enable_linear: false,
+ hide_users_page: false,
+ hide_billing_page: false,
+ hide_integrations_page: false,
+ },
+ }),
);
renderUserContextMenu({ type: "member", onClose: vi.fn, onOpenInviteModal: vi.fn });
- // Wait for config to load
await waitFor(() => {
expect(screen.getByTestId("context-menu-cta")).toBeInTheDocument();
});
@@ -766,59 +770,73 @@ describe("UserContextMenu", () => {
expect(screen.getByText("CTA$LEARN_MORE")).toBeInTheDocument();
});
- it("should not render the CTA component in OSS mode even with feature flag enabled", async () => {
- // Set OSS mode
+ it("should not render the CTA component in OSS mode", async () => {
vi.spyOn(OptionService, "getConfig").mockResolvedValue(
createMockWebClientConfig({ app_mode: "oss" }),
);
renderUserContextMenu({ type: "member", onClose: vi.fn, onOpenInviteModal: vi.fn });
- // Wait for config to load
await waitFor(() => {
expect(screen.getByTestId("user-context-menu")).toBeInTheDocument();
});
-
expect(screen.queryByTestId("context-menu-cta")).not.toBeInTheDocument();
- expect(screen.queryByText("CTA$ENTERPRISE_TITLE")).not.toBeInTheDocument();
});
- it("should not render the CTA component on mobile even in SaaS mode with feature flag enabled", async () => {
- // Set SaaS mode
+ it("should not render the CTA component on mobile even in SaaS Cloud mode", async () => {
vi.spyOn(OptionService, "getConfig").mockResolvedValue(
- createMockWebClientConfig({ app_mode: "saas" }),
+ createMockWebClientConfig({
+ app_mode: "saas",
+ feature_flags: {
+ deployment_mode: "cloud",
+ enable_billing: false,
+ hide_llm_settings: false,
+ enable_jira: false,
+ enable_jira_dc: false,
+ enable_linear: false,
+ hide_users_page: false,
+ hide_billing_page: false,
+ hide_integrations_page: false,
+ },
+ }),
);
// Set mobile mode
vi.mocked(breakpoint.useBreakpoint).mockReturnValue(true);
renderUserContextMenu({ type: "member", onClose: vi.fn, onOpenInviteModal: vi.fn });
- // Wait for config to load
await waitFor(() => {
expect(screen.getByTestId("user-context-menu")).toBeInTheDocument();
});
expect(screen.queryByTestId("context-menu-cta")).not.toBeInTheDocument();
- expect(screen.queryByText("CTA$ENTERPRISE_TITLE")).not.toBeInTheDocument();
});
- it("should not render the CTA component when feature flag is disabled in SaaS mode", async () => {
- // Set SaaS mode
+ it("should not render the CTA component in SaaS Self-hosted mode", async () => {
vi.spyOn(OptionService, "getConfig").mockResolvedValue(
- createMockWebClientConfig({ app_mode: "saas" }),
+ createMockWebClientConfig({
+ app_mode: "saas",
+ feature_flags: {
+ deployment_mode: "self_hosted",
+ enable_billing: false,
+ hide_llm_settings: false,
+ enable_jira: false,
+ enable_jira_dc: false,
+ enable_linear: false,
+ hide_users_page: false,
+ hide_billing_page: false,
+ hide_integrations_page: false,
+ },
+ }),
);
- // Disable the feature flag
- mockEnableProjUserJourney.mockReturnValue(false);
renderUserContextMenu({ type: "member", onClose: vi.fn, onOpenInviteModal: vi.fn });
- // Wait for config to load
await waitFor(() => {
expect(screen.getByTestId("user-context-menu")).toBeInTheDocument();
});
expect(screen.queryByTestId("context-menu-cta")).not.toBeInTheDocument();
- expect(screen.queryByText("CTA$ENTERPRISE_TITLE")).not.toBeInTheDocument();
});
});
});
diff --git a/frontend/__tests__/routes/device-verify.test.tsx b/frontend/__tests__/routes/device-verify.test.tsx
index 4fef716e26..04f1f79ab8 100644
--- a/frontend/__tests__/routes/device-verify.test.tsx
+++ b/frontend/__tests__/routes/device-verify.test.tsx
@@ -5,12 +5,21 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { createRoutesStub } from "react-router";
import DeviceVerify from "#/routes/device-verify";
-const { useIsAuthedMock, ENABLE_PROJ_USER_JOURNEY_MOCK } = vi.hoisted(() => ({
+const { useIsAuthedMock, mockUseAppMode } = vi.hoisted(() => ({
useIsAuthedMock: vi.fn(() => ({
data: false as boolean | undefined,
isLoading: false,
})),
- ENABLE_PROJ_USER_JOURNEY_MOCK: vi.fn(() => true),
+ mockUseAppMode: vi.fn(() => ({
+ isOss: false,
+ isSaas: true,
+ isCloud: true,
+ isSelfHosted: false,
+ isEnterpriseSelfHosted: false,
+ isEnterpriseCloud: true,
+ appMode: "saas" as string | undefined,
+ deploymentMode: "cloud" as string | undefined,
+ })),
}));
vi.mock("#/hooks/query/use-is-authed", () => ({
@@ -23,8 +32,8 @@ vi.mock("posthog-js/react", () => ({
}),
}));
-vi.mock("#/utils/feature-flags", () => ({
- ENABLE_PROJ_USER_JOURNEY: () => ENABLE_PROJ_USER_JOURNEY_MOCK(),
+vi.mock("#/hooks/use-app-mode", () => ({
+ useAppMode: () => mockUseAppMode(),
}));
const RouterStub = createRoutesStub([
@@ -66,8 +75,17 @@ describe("DeviceVerify", () => {
}),
),
);
- // Enable feature flag by default
- ENABLE_PROJ_USER_JOURNEY_MOCK.mockReturnValue(true);
+ // Reset useAppMode to SaaS Cloud (CTA enabled) by default
+ mockUseAppMode.mockReturnValue({
+ isOss: false,
+ isSaas: true,
+ isCloud: true,
+ isSelfHosted: false,
+ isEnterpriseSelfHosted: false,
+ isEnterpriseCloud: true,
+ appMode: "saas",
+ deploymentMode: "cloud",
+ });
});
afterEach(() => {
@@ -235,7 +253,17 @@ describe("DeviceVerify", () => {
});
});
- it("should include the LoginCTA component when feature flag is enabled", async () => {
+ it("should include the LoginCTA component when in SaaS Cloud mode", async () => {
+ mockUseAppMode.mockReturnValue({
+ isOss: false,
+ isSaas: true,
+ isCloud: true,
+ isSelfHosted: false,
+ isEnterpriseSelfHosted: false,
+ isEnterpriseCloud: true,
+ appMode: "saas",
+ deploymentMode: "cloud",
+ });
useIsAuthedMock.mockReturnValue({
data: true,
isLoading: false,
@@ -253,8 +281,45 @@ describe("DeviceVerify", () => {
});
});
- it("should not include the LoginCTA and be center-aligned when feature flag is disabled", async () => {
- ENABLE_PROJ_USER_JOURNEY_MOCK.mockReturnValue(false);
+ it("should not include the LoginCTA component when in OSS mode", async () => {
+ mockUseAppMode.mockReturnValue({
+ isOss: true,
+ isSaas: false,
+ isCloud: false,
+ isSelfHosted: false,
+ isEnterpriseSelfHosted: false,
+ isEnterpriseCloud: false,
+ appMode: "oss",
+ deploymentMode: undefined,
+ });
+ useIsAuthedMock.mockReturnValue({
+ data: true,
+ isLoading: false,
+ });
+
+ render(
+ <RouterStub initialEntries={["/device-verify?user_code=ABC-123"]} />,
+ {
+ wrapper: createWrapper(),
+ },
+ );
+
+ await waitFor(() => {
+ expect(screen.queryByTestId("login-cta")).not.toBeInTheDocument();
+ });
+ });
+
+ it("should not include the LoginCTA and be center-aligned when in SaaS Self-hosted mode", async () => {
+ mockUseAppMode.mockReturnValue({
+ isOss: false,
+ isSaas: true,
+ isCloud: false,
+ isSelfHosted: true,
+ isEnterpriseSelfHosted: true,
+ isEnterpriseCloud: false,
+ appMode: "saas",
+ deploymentMode: "self_hosted",
+ });
useIsAuthedMock.mockReturnValue({
data: true,
isLoading: false,
diff --git a/frontend/__tests__/routes/home-screen.test.tsx b/frontend/__tests__/routes/home-screen.test.tsx
index 9ba7f076a1..c670c6f466 100644
--- a/frontend/__tests__/routes/home-screen.test.tsx
+++ b/frontend/__tests__/routes/home-screen.test.tsx
@@ -13,7 +13,7 @@ import AuthService from "#/api/auth-service/auth-service.api";
import MainApp from "#/routes/root-layout";
import { MOCK_DEFAULT_USER_SETTINGS } from "#/mocks/handlers";
-const { DEFAULT_FEATURE_FLAGS, useIsAuthedMock, useConfigMock } = vi.hoisted(
+const { DEFAULT_FEATURE_FLAGS, useIsAuthedMock, useConfigMock, mockUseAppMode } = vi.hoisted(
() => {
const defaultFeatureFlags = {
enable_billing: false,
@@ -41,6 +41,16 @@ const { DEFAULT_FEATURE_FLAGS, useIsAuthedMock, useConfigMock } = vi.hoisted(
},
isLoading: false,
}),
+ mockUseAppMode: vi.fn().mockReturnValue({
+ isOss: true,
+ isSaas: false,
+ isCloud: false,
+ isSelfHosted: false,
+ isEnterpriseSelfHosted: false,
+ isEnterpriseCloud: false,
+ appMode: "oss",
+ deploymentMode: undefined,
+ }),
};
},
);
@@ -53,6 +63,19 @@ vi.mock("#/hooks/query/use-config", () => ({
useConfig: () => useConfigMock(),
}));
+vi.mock("#/hooks/use-app-mode", () => ({
+ useAppMode: () => mockUseAppMode() ?? {
+ isOss: true,
+ isSaas: false,
+ isCloud: false,
+ isSelfHosted: false,
+ isEnterpriseSelfHosted: false,
+ isEnterpriseCloud: false,
+ appMode: "oss",
+ deploymentMode: undefined,
+ },
+}));
+
const RouterStub = createRoutesStub([
{
Component: MainApp,
@@ -612,14 +635,9 @@ describe("HomepageCTA visibility", () => {
getSettingsSpy.mockResolvedValue(MOCK_DEFAULT_USER_SETTINGS);
- // Mock localStorage to enable the PROJ_USER_JOURNEY feature flag (CTA dismissal also uses localStorage)
+ // Mock localStorage for CTA dismissal
vi.stubGlobal("localStorage", {
- getItem: vi.fn((key: string) => {
- if (key === "FEATURE_PROJ_USER_JOURNEY") {
- return "true";
- }
- return null;
- }),
+ getItem: vi.fn(() => null),
setItem: vi.fn(),
removeItem: vi.fn(),
clear: vi.fn(),
@@ -631,7 +649,7 @@ describe("HomepageCTA visibility", () => {
vi.unstubAllGlobals();
});
- it("should show HomepageCTA in SaaS mode when not dismissed and feature flag enabled", async () => {
+ it("should show HomepageCTA in SaaS Cloud mode when not dismissed", async () => {
useIsAuthedMock.mockReturnValue({
data: true,
isLoading: false,
@@ -639,16 +657,26 @@ describe("HomepageCTA visibility", () => {
isError: false,
});
useConfigMock.mockReturnValue({
- data: { app_mode: "saas", feature_flags: DEFAULT_FEATURE_FLAGS },
+ data: { app_mode: "saas", feature_flags: { ...DEFAULT_FEATURE_FLAGS, deployment_mode: "cloud" } },
isLoading: false,
});
+ mockUseAppMode.mockReturnValue({
+ isOss: false,
+ isSaas: true,
+ isCloud: true,
+ isSelfHosted: false,
+ isEnterpriseSelfHosted: false,
+ isEnterpriseCloud: true,
+ appMode: "saas",
+ deploymentMode: "cloud",
+ });
getConfigSpy.mockResolvedValue({
app_mode: "saas",
posthog_client_key: "test-posthog-key",
providers_configured: ["github"],
auth_url: "https://auth.example.com",
- feature_flags: DEFAULT_FEATURE_FLAGS,
+ feature_flags: { ...DEFAULT_FEATURE_FLAGS, deployment_mode: "cloud" },
maintenance_start_time: null,
recaptcha_site_key: null,
faulty_models: [],
@@ -665,7 +693,7 @@ describe("HomepageCTA visibility", () => {
expect(ctaLink).toBeInTheDocument();
});
- it("should not show HomepageCTA in OSS mode even with feature flag enabled", async () => {
+ it("should not show HomepageCTA in OSS mode", async () => {
useIsAuthedMock.mockReturnValue({
data: true,
isLoading: false,
@@ -676,6 +704,16 @@ describe("HomepageCTA visibility", () => {
data: { app_mode: "oss", feature_flags: DEFAULT_FEATURE_FLAGS },
isLoading: false,
});
+ mockUseAppMode.mockReturnValue({
+ isOss: true,
+ isSaas: false,
+ isCloud: false,
+ isSelfHosted: false,
+ isEnterpriseSelfHosted: false,
+ isEnterpriseCloud: false,
+ appMode: "oss",
+ deploymentMode: undefined,
+ });
getConfigSpy.mockResolvedValue({
app_mode: "oss",
@@ -695,18 +733,10 @@ describe("HomepageCTA visibility", () => {
await screen.findByTestId("home-screen");
- expect(screen.queryByText("CTA$ENTERPRISE_TITLE")).not.toBeInTheDocument();
+ expect(screen.queryByTestId("homepage-cta-learn-more")).not.toBeInTheDocument();
});
- it("should not show HomepageCTA when feature flag is disabled", async () => {
- // Override localStorage to disable the feature flag
- vi.stubGlobal("localStorage", {
- getItem: vi.fn(() => null), // No feature flags set
- setItem: vi.fn(),
- removeItem: vi.fn(),
- clear: vi.fn(),
- });
-
+ it("should not show HomepageCTA in SaaS Self-hosted mode", async () => {
useIsAuthedMock.mockReturnValue({
data: true,
isLoading: false,
@@ -714,16 +744,26 @@ describe("HomepageCTA visibility", () => {
isError: false,
});
useConfigMock.mockReturnValue({
- data: { app_mode: "saas", feature_flags: DEFAULT_FEATURE_FLAGS },
+ data: { app_mode: "saas", feature_flags: { ...DEFAULT_FEATURE_FLAGS, deployment_mode: "self_hosted" } },
isLoading: false,
});
+ mockUseAppMode.mockReturnValue({
+ isOss: false,
+ isSaas: true,
+ isCloud: false,
+ isSelfHosted: true,
+ isEnterpriseSelfHosted: true,
+ isEnterpriseCloud: false,
+ appMode: "saas",
+ deploymentMode: "self_hosted",
+ });
getConfigSpy.mockResolvedValue({
app_mode: "saas",
posthog_client_key: "test-posthog-key",
providers_configured: ["github"],
auth_url: "https://auth.example.com",
- feature_flags: DEFAULT_FEATURE_FLAGS,
+ feature_flags: { ...DEFAULT_FEATURE_FLAGS, deployment_mode: "self_hosted" },
maintenance_start_time: null,
recaptcha_site_key: null,
faulty_models: [],
@@ -736,7 +776,7 @@ describe("HomepageCTA visibility", () => {
await screen.findByTestId("home-screen");
- expect(screen.queryByText("CTA$ENTERPRISE_TITLE")).not.toBeInTheDocument();
+ expect(screen.queryByTestId("homepage-cta-learn-more")).not.toBeInTheDocument();
});
});
diff --git a/frontend/__tests__/routes/login.test.tsx b/frontend/__tests__/routes/login.test.tsx
index bc247f9d97..5d7a9f27d0 100644
--- a/frontend/__tests__/routes/login.test.tsx
+++ b/frontend/__tests__/routes/login.test.tsx
@@ -73,9 +73,18 @@ vi.mock("#/hooks/use-invitation", () => ({
useInvitation: () => useInvitationMock(),
}));
-// Mock feature flags - enable by default for tests
-vi.mock("#/utils/feature-flags", () => ({
- ENABLE_PROJ_USER_JOURNEY: () => true,
+// Mock useAppMode hook - enable CTA by default (SaaS Cloud mode)
+vi.mock("#/hooks/use-app-mode", () => ({
+ useAppMode: () => ({
+ isOss: false,
+ isSaas: true,
+ isCloud: true,
+ isSelfHosted: false,
+ isEnterpriseSelfHosted: false,
+ isEnterpriseCloud: true,
+ appMode: "saas",
+ deploymentMode: "cloud",
+ }),
}));
const RouterStub = createRoutesStub([
diff --git a/frontend/src/components/features/auth/login-content.tsx b/frontend/src/components/features/auth/login-content.tsx
index b317bd5543..73d0859751 100644
--- a/frontend/src/components/features/auth/login-content.tsx
+++ b/frontend/src/components/features/auth/login-content.tsx
@@ -14,8 +14,8 @@ import { useRecaptcha } from "#/hooks/use-recaptcha";
import { useConfig } from "#/hooks/query/use-config";
import { displayErrorToast } from "#/utils/custom-toast-handlers";
import { cn } from "#/utils/utils";
-import { ENABLE_PROJ_USER_JOURNEY } from "#/utils/feature-flags";
import { LoginCTA } from "./login-cta";
+import { useAppMode } from "#/hooks/use-app-mode";
export interface LoginContentProps {
githubAuthUrl: string | null;
@@ -45,6 +45,7 @@ export function LoginContent({
const { t } = useTranslation();
const { trackLoginButtonClick } = useTracking();
const { data: config } = useConfig();
+ const { isEnterpriseCloud } = useAppMode();
// reCAPTCHA - only need token generation, verification happens at backend callback
const { isReady: recaptchaReady, executeRecaptcha } = useRecaptcha({
@@ -306,7 +307,7 @@ export function LoginContent({
<TermsAndPrivacyNotice className="max-w-[320px] text-[#A3A3A3]" />
</div>
- {appMode === "saas" && ENABLE_PROJ_USER_JOURNEY() && <LoginCTA />}
+ {isEnterpriseCloud && <LoginCTA />}
</div>
);
}
diff --git a/frontend/src/components/features/device-verify/enterprise-banner.tsx b/frontend/src/components/features/device-verify/enterprise-banner.tsx
deleted file mode 100644
index 1bae456efd..0000000000
--- a/frontend/src/components/features/device-verify/enterprise-banner.tsx
+++ /dev/null
@@ -1,69 +0,0 @@
-import { useTranslation } from "react-i18next";
-import { usePostHog } from "posthog-js/react";
-import { I18nKey } from "#/i18n/declaration";
-import { H2, Text } from "#/ui/typography";
-import CheckCircleFillIcon from "#/icons/check-circle-fill.svg?react";
-import { ENABLE_PROJ_USER_JOURNEY } from "#/utils/feature-flags";
-
-const ENTERPRISE_FEATURE_KEYS: I18nKey[] = [
- I18nKey.ENTERPRISE$FEATURE_DATA_PRIVACY,
- I18nKey.ENTERPRISE$FEATURE_DEPLOYMENT,
- I18nKey.ENTERPRISE$FEATURE_SSO,
- I18nKey.ENTERPRISE$FEATURE_SUPPORT,
-];
-
-export function EnterpriseBanner() {
- const { t } = useTranslation();
- const posthog = usePostHog();
-
- if (!ENABLE_PROJ_USER_JOURNEY()) {
- return null;
- }
-
- const handleLearnMore = () => {
- posthog?.capture("saas_selfhosted_inquiry");
- };
-
- return (
- <div className="w-full max-w-md mx-auto lg:mx-0 lg:w-80 p-6 rounded-lg bg-gradient-to-b from-slate-800 to-slate-900 border border-slate-700 h-fit">
- {/* Self-Hosted Label */}
- <div className="flex justify-center mb-4">
- <div className="px-8 py-0.5 rounded-full bg-gradient-to-r from-blue-900 to-blue-950 border border-blue-800">
- <Text className="text-xs font-medium text-blue-400 tracking-wider uppercase">
- {t(I18nKey.ENTERPRISE$SELF_HOSTED)}
- </Text>
- </div>
- </div>
-
- {/* Title */}
- <H2 className="text-center mb-3">{t(I18nKey.ENTERPRISE$TITLE)}</H2>
-
- {/* Description */}
- <Text className="text-sm text-gray-400 text-center mb-6 block">
- {t(I18nKey.ENTERPRISE$DESCRIPTION)}
- </Text>
-
- {/* Features List */}
- <ul className="space-y-3 mb-6">
- {ENTERPRISE_FEATURE_KEYS.map((featureKey) => (
- <li key={featureKey} className="flex items-center gap-2">
- <CheckCircleFillIcon className="w-4 h-4 text-blue-400 flex-shrink-0" />
- <Text className="text-sm text-gray-300">{t(featureKey)}</Text>
- </li>
- ))}
- </ul>
-
- {/* Learn More Button */}
- <a
- href="https://openhands.dev/enterprise"
- target="_blank"
- rel="noopener noreferrer"
- onClick={handleLearnMore}
- aria-label={t(I18nKey.ENTERPRISE$LEARN_MORE_ARIA)}
- className="block w-full py-2.5 px-4 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-medium transition-colors text-center"
- >
- {t(I18nKey.ENTERPRISE$LEARN_MORE)}
- </a>
- </div>
- );
-}
diff --git a/frontend/src/components/features/user/user-context-menu.tsx b/frontend/src/components/features/user/user-context-menu.tsx
index efee79a3f9..89e85c624b 100644
--- a/frontend/src/components/features/user/user-context-menu.tsx
+++ b/frontend/src/components/features/user/user-context-menu.tsx
@@ -15,10 +15,9 @@ import { ContextMenuCTA } from "../context-menu/context-menu-cta";
import { ContextMenuNavLink } from "../context-menu/context-menu-nav-link";
import { useShouldHideOrgSelector } from "#/hooks/use-should-hide-org-selector";
import { useBreakpoint } from "#/hooks/use-breakpoint";
-import { useConfig } from "#/hooks/query/use-config";
-import { ENABLE_PROJ_USER_JOURNEY } from "#/utils/feature-flags";
import { SettingsNavHeader } from "../settings/settings-nav-header";
import { SettingsNavDivider } from "../settings/settings-nav-divider";
+import { useAppMode } from "#/hooks/use-app-mode";
// Shared className for context menu list items in the user context menu
const contextMenuListItemClassName = cn(
@@ -42,13 +41,12 @@ export function UserContextMenu({
const settingsNavItems = useSettingsNavItems();
const shouldHideSelector = useShouldHideOrgSelector();
const isMobile = useBreakpoint(768);
- const { data: config } = useConfig();
+ const { isSaas, isEnterpriseCloud } = useAppMode();
// Keep all nav items including headers and dividers for proper section grouping
const navItems = settingsNavItems;
const isMember = type === "member";
- const isSaasMode = config?.app_mode === "saas";
// Check if the ORG SETTINGS header exists in nav items
const hasOrgHeader = navItems.some(
@@ -60,8 +58,9 @@ export function UserContextMenu({
// Show invite button for admin/owner in team orgs
const showInviteButton = !isMember && !isPersonalOrg;
- // CTA only renders in SaaS desktop with feature flag enabled
- const showCta = isSaasMode && !isMobile && ENABLE_PROJ_USER_JOURNEY();
+ // CTA only renders in SaaS Cloud desktop mode
+ const isCTAEnabled = isEnterpriseCloud && !isMobile;
+
const handleLogout = () => {
logout();
onClose();
@@ -155,7 +154,7 @@ export function UserContextMenu({
</a>
{/* Only show logout in saas mode - oss mode has no session to invalidate */}
- {isSaasMode && (
+ {isSaas && (
<ContextMenuListItem
onClick={handleLogout}
className={contextMenuListItemClassName}
@@ -167,7 +166,7 @@ export function UserContextMenu({
</div>
</div>
- {showCta && <ContextMenuCTA />}
+ {isCTAEnabled && <ContextMenuCTA />}
</ContextMenuContainer>
);
}
diff --git a/frontend/src/hooks/use-app-mode.ts b/frontend/src/hooks/use-app-mode.ts
new file mode 100644
index 0000000000..b2ba9e83ae
--- /dev/null
+++ b/frontend/src/hooks/use-app-mode.ts
@@ -0,0 +1,43 @@
+import { useMemo } from "react";
+import { useConfig } from "#/hooks/query/use-config";
+
+/**
+ * Hook that provides boolean checks for app mode deployment mode.
+ *
+ * App Mode (app_mode):
+ * - "oss": Open source version running locally/self-hosted
+ * - "saas": All-Hands managed SaaS version
+ *
+ * Deployment Mode (deployment_mode):
+ * - "cloud": Enterprise customers running on All-Hands managed infrastructure (*.all-hands.dev, *.openhands.ai)
+ * - "self_hosted": Enterprise customers running on their own infrastructure
+ *
+ * Note: SaaS mode can have either cloud or self_hosted deployment mode.
+ */
+export function useAppMode() {
+ const { data: config } = useConfig();
+
+ return useMemo(() => {
+ const appMode = config?.app_mode;
+ const deploymentMode = config?.feature_flags?.deployment_mode;
+
+ return {
+ // App Mode checks
+ isOss: appMode === "oss",
+ isSaas: appMode === "saas",
+
+ // Deployment Mode checks
+ isCloud: deploymentMode === "cloud",
+ isSelfHosted: deploymentMode === "self_hosted",
+
+ /** Enterprise checks */
+ isEnterpriseSelfHosted:
+ appMode === "saas" && deploymentMode === "self_hosted",
+ isEnterpriseCloud: appMode === "saas" && deploymentMode === "cloud",
+
+ // Raw values (for cases where the actual value is needed)
+ appMode,
+ deploymentMode,
+ };
+ }, [config?.app_mode, config?.feature_flags?.deployment_mode]);
+}
diff --git a/frontend/src/hooks/use-is-all-hands-saas-environment.ts b/frontend/src/hooks/use-is-all-hands-saas-environment.ts
deleted file mode 100644
index 68ae66bd5d..0000000000
--- a/frontend/src/hooks/use-is-all-hands-saas-environment.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { useMemo } from "react";
-
-/**
- * Hook to check if the current domain is an All Hands SaaS environment
- * @returns True if the current domain contains "all-hands.dev" or "openhands.dev" postfix
- */
-export const useIsAllHandsSaaSEnvironment = (): boolean =>
- useMemo(() => {
- const { hostname } = window.location;
- return (
- hostname.endsWith("all-hands.dev") || hostname.endsWith("openhands.dev")
- );
- }, []);
diff --git a/frontend/src/routes/device-verify.tsx b/frontend/src/routes/device-verify.tsx
index 03459385ce..17b9eeb0b1 100644
--- a/frontend/src/routes/device-verify.tsx
+++ b/frontend/src/routes/device-verify.tsx
@@ -5,7 +5,7 @@ import { useIsAuthed } from "#/hooks/query/use-is-authed";
import { LoginCTA } from "#/components/features/auth/login-cta";
import { I18nKey } from "#/i18n/declaration";
import { H1 } from "#/ui/typography";
-import { ENABLE_PROJ_USER_JOURNEY } from "#/utils/feature-flags";
+import { useAppMode } from "#/hooks/use-app-mode";
export default function DeviceVerify() {
const { t } = useTranslation();
@@ -16,7 +16,7 @@ export default function DeviceVerify() {
messageKey: I18nKey;
} | null>(null);
const [isProcessing, setIsProcessing] = useState(false);
- const showEnterpriseBanner = ENABLE_PROJ_USER_JOURNEY();
+ const { isEnterpriseCloud } = useAppMode();
// Get user_code from URL parameters
const userCode = searchParams.get("user_code");
@@ -151,11 +151,11 @@ export default function DeviceVerify() {
return (
<div className="min-h-screen flex items-center justify-center bg-background p-4">
<div
- className={`flex flex-col lg:flex-row items-center lg:items-stretch gap-6 w-full ${showEnterpriseBanner ? "max-w-4xl" : "max-w-md"}`}
+ className={`flex flex-col lg:flex-row items-center lg:items-stretch gap-6 w-full ${isEnterpriseCloud ? "max-w-4xl" : "max-w-md"}`}
>
{/* Device Authorization Card */}
<div
- className={`flex-1 min-w-0 max-w-md w-full mx-auto p-6 bg-card rounded-2xl shadow-lg border border-[#242424] ${showEnterpriseBanner ? "lg:mx-0 lg:self-stretch" : ""}`}
+ className={`flex-1 min-w-0 max-w-md w-full mx-auto p-6 bg-card rounded-2xl shadow-lg border border-[#242424] ${isEnterpriseCloud ? "lg:mx-0 lg:self-stretch" : ""}`}
>
<H1 className="text-2xl mb-4 text-center">
{t(I18nKey.DEVICE$AUTHORIZATION_REQUEST)}
@@ -198,7 +198,7 @@ export default function DeviceVerify() {
</div>
{/* Login CTA */}
- {showEnterpriseBanner && (
+ {isEnterpriseCloud && (
<LoginCTA source="device_verify" className="lg:self-stretch" />
)}
</div>
diff --git a/frontend/src/routes/home.tsx b/frontend/src/routes/home.tsx
index 0d6069d62b..e7a7604e3e 100644
--- a/frontend/src/routes/home.tsx
+++ b/frontend/src/routes/home.tsx
@@ -8,13 +8,12 @@ import { NewConversation } from "#/components/features/home/new-conversation/new
import { RecentConversations } from "#/components/features/home/recent-conversations/recent-conversations";
import { HomepageCTA } from "#/components/features/home/homepage-cta";
import { isCTADismissed } from "#/utils/local-storage";
-import { useConfig } from "#/hooks/query/use-config";
-import { ENABLE_PROJ_USER_JOURNEY } from "#/utils/feature-flags";
+import { useAppMode } from "#/hooks/use-app-mode";
<PrefetchPageLinks page="/conversations/:conversationId" />;
function HomeScreen() {
- const { data: config } = useConfig();
+ const { isEnterpriseCloud } = useAppMode();
const [selectedRepo, setSelectedRepo] = React.useState<GitRepository | null>(
null,
);
@@ -23,8 +22,6 @@ function HomeScreen() {
() => !isCTADismissed("homepage"),
);
- const isSaasMode = config?.app_mode === "saas";
-
return (
<div
data-testid="home-screen"
@@ -52,7 +49,7 @@ function HomeScreen() {
</div>
</div>
- {isSaasMode && shouldShowCTA && ENABLE_PROJ_USER_JOURNEY() && (
+ {isEnterpriseCloud && shouldShowCTA && (
<div className="fixed bottom-4 right-8 z-50 md:bottom-6 md:right-12">
<HomepageCTA setShouldShowCTA={setShouldShowCTA} />
</div>
diff --git a/frontend/src/routes/information-request.tsx b/frontend/src/routes/information-request.tsx
index 81f207890f..c3c6911f06 100644
--- a/frontend/src/routes/information-request.tsx
+++ b/frontend/src/routes/information-request.tsx
@@ -1,6 +1,6 @@
import { useState, useEffect, useCallback } from "react";
import { useTranslation } from "react-i18next";
-import { Link, redirect } from "react-router";
+import { Link } from "react-router";
import { I18nKey } from "#/i18n/declaration";
import { Typography } from "#/ui/typography";
import {
@@ -17,14 +17,6 @@ import {
saveEnterpriseFormData,
} from "#/utils/local-storage";
import { cn } from "#/utils/utils";
-import { ENABLE_PROJ_USER_JOURNEY } from "#/utils/feature-flags";
-
-export const clientLoader = async () => {
- if (!ENABLE_PROJ_USER_JOURNEY()) {
- return redirect("/login");
- }
- return null;
-};
const DEFAULT_FORM_DATA: EnterpriseFormData = {
name: "",
diff --git a/frontend/src/utils/feature-flags.ts b/frontend/src/utils/feature-flags.ts
index aaaf2c5d8b..ad5fb5245e 100644
--- a/frontend/src/utils/feature-flags.ts
+++ b/frontend/src/utils/feature-flags.ts
@@ -18,8 +18,6 @@ export const VSCODE_IN_NEW_TAB = () => loadFeatureFlag("VSCODE_IN_NEW_TAB");
export const ENABLE_TRAJECTORY_REPLAY = () =>
loadFeatureFlag("TRAJECTORY_REPLAY");
export const ENABLE_ONBOARDING = () => loadFeatureFlag("ENABLE_ONBOARDING");
-export const ENABLE_PROJ_USER_JOURNEY = () =>
- loadFeatureFlag("PROJ_USER_JOURNEY");
export const ENABLE_SANDBOX_GROUPING = () =>
loadFeatureFlag("SANDBOX_GROUPING");
export const ENABLE_AUTOMATIONS = () => loadFeatureFlag("AUTOMATIONS");