diff --git a/vscode/src/chat/protocol.ts b/vscode/src/chat/protocol.ts index 309d7be41f7a..1640e650e021 100644 --- a/vscode/src/chat/protocol.ts +++ b/vscode/src/chat/protocol.ts @@ -264,7 +264,6 @@ export const SG_CHANGELOG_URL = new URL('https://sourcegraph.com/changelog') export const VSCODE_CHANGELOG_URL = new URL( 'https://github.com/sourcegraph/cody/blob/main/vscode/CHANGELOG.md' ) - // Community and support export const DISCORD_URL = new URL('https://discord.gg/s2qDtYGnAE') export const CODY_FEEDBACK_URL = new URL('https://github.com/sourcegraph/cody/issues/new/choose') @@ -273,6 +272,8 @@ export const CODY_OLLAMA_DOCS_URL = new URL( 'https://sourcegraph.com/docs/cody/clients/install-vscode#supported-local-ollama-models-with-cody' ) // Account +export const ENTERPRISE_PRICING_URL = new URL('https://sourcegraph.com/pricing') +export const CODY_PRO_SUBSCRIPTION_URL = new URL('https://accounts.sourcegraph.com/cody/subscription') export const ACCOUNT_UPGRADE_URL = new URL('https://sourcegraph.com/cody/subscription') export const ACCOUNT_USAGE_URL = new URL('https://sourcegraph.com/cody/manage') export const ACCOUNT_LIMITS_INFO_URL = new URL( diff --git a/vscode/webviews/CodyPanel.tsx b/vscode/webviews/CodyPanel.tsx index 0e304c025811..4775178bf21c 100644 --- a/vscode/webviews/CodyPanel.tsx +++ b/vscode/webviews/CodyPanel.tsx @@ -120,6 +120,7 @@ export const CodyPanel: FunctionComponent = ({ currentView={view} setView={setView} endpointHistory={config.endpointHistory ?? []} + isTeamsUpgradeCtaEnabled={isTeamsUpgradeCtaEnabled} /> )} {errorMessages && } diff --git a/vscode/webviews/components/UserMenu.tsx b/vscode/webviews/components/UserMenu.tsx index 6a541a3199c5..df2ed901753b 100644 --- a/vscode/webviews/components/UserMenu.tsx +++ b/vscode/webviews/components/UserMenu.tsx @@ -11,10 +11,17 @@ import { PlusIcon, Settings2Icon, UserCircleIcon, + ZapIcon, } from 'lucide-react' import { useCallback, useState } from 'react' import { URI } from 'vscode-uri' -import { ACCOUNT_USAGE_URL, isSourcegraphToken } from '../../src/chat/protocol' +import { + ACCOUNT_USAGE_URL, + CODY_PRO_SUBSCRIPTION_URL, + ENTERPRISE_PRICING_URL, + isSourcegraphToken, +} from '../../src/chat/protocol' +import { SourcegraphLogo } from '../icons/SourcegraphLogo' import { getVSCodeAPI } from '../utils/VSCodeApi' import { useTelemetryRecorder } from '../utils/telemetry' import { UserAvatar } from './UserAvatar' @@ -34,6 +41,8 @@ interface UserMenuProps { onCloseByEscape?: () => void allowEndpointChange: boolean __storybook__open?: boolean + // Whether to show the Sourcegraph Teams upgrade CTA or not. + isTeamsUpgradeCtaEnabled?: boolean } type MenuView = 'main' | 'switch' | 'add' | 'remove' @@ -46,6 +55,7 @@ export const UserMenu: React.FunctionComponent = ({ onCloseByEscape, allowEndpointChange, __storybook__open, + isTeamsUpgradeCtaEnabled, }) => { const telemetryRecorder = useTelemetryRecorder() const { displayName, username, primaryEmail, endpoint } = authStatus @@ -306,6 +316,49 @@ export const UserMenu: React.FunctionComponent = ({ Add another account + + {isTeamsUpgradeCtaEnabled && ( + + +
+ {/* TODO: Replace with new logo */} + + + Enterprise Starter + +
+
+
+ Unlock the Sourcegraph platform +
+
+ Create a workspace and connect GitHub repositories to + unlock Code Search, AI chat, autocompletes, inline edits + and more for your team. +
+
+ +
+
+ )} ) : ( @@ -344,6 +397,44 @@ export const UserMenu: React.FunctionComponent = ({ + {isDotComUser && !isProUser && ( + { + telemetryRecorder.recordEvent( + 'cody.userMenu.upgradeToProLink', + 'open', + {} + ) + close() + }} + > + + zapIconGradient + + + + + + + + + + Upgrade to Pro + + )} {isDotComUser && ( { @@ -384,6 +475,25 @@ export const UserMenu: React.FunctionComponent = ({ Extension Settings + {isDotComUser && ( + { + telemetryRecorder.recordEvent( + 'cody.userMenu.exploreEnterprisePlanLink', + 'open', + {} + ) + close() + }} + > + + Explore Enterprise Plans + + + )} @@ -429,7 +539,7 @@ export const UserMenu: React.FunctionComponent = ({ )} popoverRootProps={{ onOpenChange }} popoverContentProps={{ - className: '!tw-p-2', + className: '!tw-p-2 tw-mr-6', onKeyDown: onKeyDown, onCloseAutoFocus: event => { event.preventDefault() diff --git a/vscode/webviews/tabs/TabsBar.tsx b/vscode/webviews/tabs/TabsBar.tsx index 85263da0827c..7ae32244cbae 100644 --- a/vscode/webviews/tabs/TabsBar.tsx +++ b/vscode/webviews/tabs/TabsBar.tsx @@ -34,6 +34,8 @@ interface TabsBarProps { currentView: View setView: (view: View) => void endpointHistory: string[] + // Whether to show the Sourcegraph Teams upgrade CTA or not. + isTeamsUpgradeCtaEnabled?: boolean } type IconComponent = React.ForwardRefExoticComponent< @@ -157,6 +159,7 @@ export const TabsBar = memo(props => { endpointHistory={endpointHistory} allowEndpointChange={allowEndpointChange} className="!tw-opacity-100 tw-h-full" + isTeamsUpgradeCtaEnabled={props.isTeamsUpgradeCtaEnabled} /> )}