Skip to content

Commit 024973b

Browse files
committed
Put it behind a posthog feature flag
1 parent f65fccf commit 024973b

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

webview-ui/src/components/welcome/WelcomeView.tsx

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { useCallback, useState } from "react"
1+
import { useCallback, useState, useEffect } from "react"
22
import knuthShuffle from "knuth-shuffle-seeded"
33
import { Trans } from "react-i18next"
44
import { VSCodeButton, VSCodeLink } from "@vscode/webview-ui-toolkit/react"
5+
import posthog from "posthog-js"
56

67
import type { ProviderSettings } from "@roo-code/types"
78

@@ -20,6 +21,14 @@ const WelcomeView = () => {
2021
const { apiConfiguration, currentApiConfigName, setApiConfiguration, uriScheme, machineId } = useExtensionState()
2122
const { t } = useAppTranslation()
2223
const [errorMessage, setErrorMessage] = useState<string | undefined>(undefined)
24+
const [showRooProvider, setShowRooProvider] = useState(false)
25+
26+
// Check PostHog feature flag for Roo provider
27+
useEffect(() => {
28+
posthog.onFeatureFlags(function () {
29+
setShowRooProvider(posthog?.getFeatureFlag("roo-provider-featured") === "test")
30+
})
31+
}, [])
2332

2433
// Memoize the setApiConfigurationField function to pass to ApiOptions
2534
const setApiConfigurationFieldForApiOptions = useCallback(
@@ -69,7 +78,7 @@ const WelcomeView = () => {
6978
{/* Define the providers */}
7079
{(() => {
7180
// Provider card configuration
72-
const providers = [
81+
const baseProviders = [
7382
{
7483
slug: "requesty",
7584
name: "Requesty",
@@ -83,15 +92,22 @@ const WelcomeView = () => {
8392
description: t("welcome:routers.openrouter.description"),
8493
authUrl: getOpenRouterAuthUrl(uriScheme),
8594
},
86-
{
87-
slug: "roo",
88-
name: "Roo Code Cloud",
89-
description: t("welcome:routers.roo.description"),
90-
incentive: t("welcome:routers.roo.incentive"),
91-
authUrl: "#", // Placeholder since onClick handler will prevent default
92-
},
9395
]
9496

97+
// Conditionally add Roo provider based on feature flag
98+
const providers = showRooProvider
99+
? [
100+
...baseProviders,
101+
{
102+
slug: "roo",
103+
name: "Roo Code Cloud",
104+
description: t("welcome:routers.roo.description"),
105+
incentive: t("welcome:routers.roo.incentive"),
106+
authUrl: "#", // Placeholder since onClick handler will prevent default
107+
},
108+
]
109+
: baseProviders
110+
95111
// Shuffle providers based on machine ID (will be consistent for the same machine)
96112
const orderedProviders = [...providers]
97113
knuthShuffle(orderedProviders, (machineId as any) || Date.now())

0 commit comments

Comments
 (0)