Skip to content

Commit

Permalink
Cloud calls-to-action -> Enterprise (sourcegraph#47858)
Browse files Browse the repository at this point in the history
This implements the proposed new [product naming and
hierarchy](https://docs.google.com/document/d/1te8D2hsa0UPdEUFKda6W2jy5RsaQx5JgZgvb2oRcCRI/edit#).
In this new naming scheme, "Sourcegraph Enterprise Cloud" is our
preferred way for users to continue, but we'll just refer to
"Sourcegraph Enterprise" in most cases (which technically also includes
self-hosted).

Also changes links from https://signup.sourcegraph.com to
https://about.sourcegraph.com.

## Test plan

Test with `SOURCEGRAPHDOTCOM_MODE=true` and see that CTAs are as
described above.
  • Loading branch information
sqs committed Feb 22, 2023
1 parent 8bfb202 commit 29a0cef
Show file tree
Hide file tree
Showing 22 changed files with 124 additions and 211 deletions.
9 changes: 4 additions & 5 deletions client/branded/src/search-ui/input/SearchContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { SearchContextMinimalFields } from '@sourcegraph/shared/src/graphql-oper
import { PlatformContextProps } from '@sourcegraph/shared/src/platform/context'
import { getDefaultSearchContextSpec, SearchContextInputProps } from '@sourcegraph/shared/src/search'
import { TelemetryProps } from '@sourcegraph/shared/src/telemetry/telemetryService'
import { buildCloudTrialURL } from '@sourcegraph/shared/src/util/url'
import {
Badge,
Button,
Expand Down Expand Up @@ -256,14 +255,14 @@ export const SearchContextMenu: FC<SearchContextMenuProps> = props => {
<Text className="mb-0">
To search across your team's private repositories,{' '}
<Link
to={buildCloudTrialURL(authenticatedUser, 'context')}
to="https://about.sourcegraph.com"
onClick={() =>
telemetryService.log('ClickedOnCloudCTA', {
cloudCtaType: 'ContextDropDown',
telemetryService.log('ClickedOnEnterpriseCTA', {
location: 'ContextDropDown',
})
}
>
try Sourcegraph Cloud
get Sourcegraph Enterprise
</Link>
.
</Text>
Expand Down
46 changes: 0 additions & 46 deletions client/shared/src/util/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
import { Position } from '@sourcegraph/extension-api-types'

import { WorkspaceRootWithMetadata } from '../api/extension/extensionHostApi'
import { AuthenticatedUser } from '../auth'
import { SearchPatternType } from '../graphql-operations'
import { discreteValueAliases } from '../search/query/filters'
import { findFilter, FilterKind } from '../search/query/query'
Expand Down Expand Up @@ -560,51 +559,6 @@ export function buildSearchURLQuery(
return searchParameters.toString().replace(/%2F/g, '/').replace(/%3A/g, ':')
}

/**
*
* @param cloudSignup - dotcom users are directed to Cloud Signup instead of SG signup
* @param authenticatedUser - User to pass to buildCloudTrialURL()
* @returns - Cloud Trial signup or SG signup URL string
*/
export function buildGetStartedURL(cloudSignup?: boolean, authenticatedUser?: AuthenticatedUser | null): string {
const path = cloudSignup ? buildCloudTrialURL(authenticatedUser) : 'https://sourcegraph.com/sign-up'

const url = new URL(path)

// Local sign-ups use relative URLs
if (!cloudSignup) {
return `${url.pathname}${url.search}`
}

return url.toString()
}

/**
*
* @param authenticatedUser - User email/name for Cloud form prefill
* @param product - CTA source product page, determines dynamic Cloud description
* @returns signup UR string with relevant params attached
*/
export const buildCloudTrialURL = (
authenticatedUser: Pick<AuthenticatedUser, 'displayName' | 'emails'> | null | undefined,
product?: string
): string => {
const url = new URL('https://signup.sourcegraph.com/')

if (product) {
url.searchParams.append('p', product)
}
const primaryEmail = authenticatedUser?.emails.find(email => email.isPrimary)
if (primaryEmail) {
url.searchParams.append('email', primaryEmail.email)
}
if (authenticatedUser?.displayName) {
url.searchParams.append('name', authenticatedUser.displayName)
}

return url.toString()
}

/** The results of parsing a repo-revision string like "my/repo@my/revision". */
export interface ParsedRepoRevision {
repoName: string
Expand Down
28 changes: 14 additions & 14 deletions client/web/src/auth/SignInPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,20 @@ export const SignInPage: React.FunctionComponent<React.PropsWithChildren<SignInP
</div>
{props.context.allowSignup ? (
<Text>
New to Sourcegraph?{' '}
{props.isSourcegraphDotCom ? (
<Link
to="https://signup.sourcegraph.com"
target="_blank"
rel="noopener noreferrer"
onClick={() =>
eventLogger.log('ClickedOnCloudCTA', { cloudCtaType: 'NavBarLoggedOut' })
}
>
Sign up
</Link>
) : (
<Link to="/sign-up">Sign up</Link>
New to Sourcegraph? <Link to="/sign-up">Sign up.</Link>{' '}
{props.isSourcegraphDotCom && (
<>
To use Sourcegraph on private repositories,
<Link
to="https://signup.sourcegraph.com"
onClick={() =>
eventLogger.log('ClickedOnEnterpriseCTA', { location: 'SignInPage' })
}
>
get Sourcegraph Enterprise
</Link>
.
</>
)}
</Text>
) : (
Expand Down
21 changes: 14 additions & 7 deletions client/web/src/auth/__snapshots__/SignInPage.test.tsx.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import classNames from 'classnames'

import { Icon, Text } from '@sourcegraph/wildcard'

import styles from './CloudCtaBanner.module.scss'
import styles from './CallToActionBanner.module.scss'

export interface CloudCtaBanner {
variant?: 'filled' | 'outlined' | 'underlined' | string | undefined
Expand All @@ -14,7 +14,7 @@ export interface CloudCtaBanner {
children: ReactNode
}

export const CloudCtaBanner: FunctionComponent<CloudCtaBanner> = ({ variant, small, className, children }) => (
export const CallToActionBanner: FunctionComponent<CloudCtaBanner> = ({ variant, small, className, children }) => (
<section
className={classNames(className, 'd-flex justify-content-center', {
[styles.filled]: variant === 'filled',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { dataOrThrowErrors, useQuery } from '@sourcegraph/http-client'
import { Settings } from '@sourcegraph/shared/src/schema/settings.schema'
import { SettingsCascadeProps } from '@sourcegraph/shared/src/settings/settings'
import { TelemetryProps } from '@sourcegraph/shared/src/telemetry/telemetryService'
import { buildCloudTrialURL } from '@sourcegraph/shared/src/util/url'
import { Button, PageHeader, Link, Container, H3, Text, screenReaderAnnounce } from '@sourcegraph/wildcard'

import { AuthenticatedUser } from '../../../auth'
Expand Down Expand Up @@ -157,13 +156,11 @@ export const BatchChangeListPage: React.FunctionComponent<React.PropsWithChildre
) : (
<Button
as={Link}
to={buildCloudTrialURL(authenticatedUser, 'batch')}
target="_blank"
rel="noopener noreferrer"
to="https://about.sourcegraph.com"
variant="primary"
onClick={() => eventLogger.log('ClickedOnCloudCTA', { cloudCtaType: 'TryBatchChanges' })}
onClick={() => eventLogger.log('ClickedOnEnterpriseCTA', { location: 'TryBatchChanges' })}
>
Try Batch Changes
Get Sourcegraph Enterprise
</Button>
)
}
Expand Down
19 changes: 9 additions & 10 deletions client/web/src/enterprise/batches/list/GettingStarted.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import React from 'react'
import { mdiOpenInNew } from '@mdi/js'

import { AuthenticatedUser } from '@sourcegraph/shared/src/auth'
import { buildCloudTrialURL } from '@sourcegraph/shared/src/util/url'
import { Container, H2, H3, Link, Text, Icon } from '@sourcegraph/wildcard'

import { BatchChangesIcon } from '../../../batches/icons'
import { CloudCtaBanner } from '../../../components/CloudCtaBanner'
import { CallToActionBanner } from '../../../components/CallToActionBanner'
import { CtaBanner } from '../../../components/CtaBanner'
import { eventLogger } from '../../../tracking/eventLogger'

Expand Down Expand Up @@ -78,18 +77,18 @@ export const GettingStarted: React.FunctionComponent<React.PropsWithChildren<Get
</div>
</Container>
{isSourcegraphDotCom ? (
<CloudCtaBanner variant="filled">
To automate changes across your team's private repos,{' '}
<CallToActionBanner variant="filled">
To automate changes across your team's private repositories,{' '}
<Link
to={buildCloudTrialURL(authenticatedUser, 'batch')}
target="_blank"
rel="noopener noreferrer"
onClick={() => eventLogger.log('ClickedOnCloudCTA', { cloudCtaType: 'BatchChangesGettingStarted' })}
to="https://about.sourcegraph.com"
onClick={() =>
eventLogger.log('ClickedOnEnterpriseCTA', { location: 'BatchChangesGettingStarted' })
}
>
try Sourcegraph Cloud
get Sourcegraph Enterprise
</Link>
.
</CloudCtaBanner>
</CallToActionBanner>
) : (
<div className="d-flex justify-content-start">
<CtaBanner
Expand Down
19 changes: 9 additions & 10 deletions client/web/src/enterprise/code-monitoring/CodeMonitorList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import React, { useCallback } from 'react'
import { useLocation } from 'react-router-dom'
import { of } from 'rxjs'

import { buildCloudTrialURL } from '@sourcegraph/shared/src/util/url'
import { Container, Link, H2, H3 } from '@sourcegraph/wildcard'

import { AuthenticatedUser } from '../../auth'
import { CloudCtaBanner } from '../../components/CloudCtaBanner'
import { CallToActionBanner } from '../../components/CallToActionBanner'
import { FilteredConnection } from '../../components/FilteredConnection'
import { CodeMonitorFields, ListUserCodeMonitorsResult, ListUserCodeMonitorsVariables } from '../../graphql-operations'
import { eventLogger } from '../../tracking/eventLogger'
Expand Down Expand Up @@ -62,18 +61,18 @@ export const CodeMonitorList: React.FunctionComponent<React.PropsWithChildren<Co
<div className="d-flex align-items-center justify-content-between">
<H3 className="mb-2">Your code monitors</H3>
{isSourcegraphDotCom && (
<CloudCtaBanner variant="outlined" small={true}>
To monitor changes across your private repos,{' '}
<CallToActionBanner variant="outlined" small={true}>
To monitor changes across your private repositories,{' '}
<Link
to={buildCloudTrialURL(authenticatedUser, 'monitoring')}
target="_blank"
rel="noopener noreferrer"
onClick={() => eventLogger.log('ClickedOnCloudCTA', { cloudCtaType: 'Monitoring' })}
to="https://about.sourcegraph.com"
onClick={() =>
eventLogger.log('ClickedOnEnterpriseCTA', { location: 'Monitoring' })
}
>
try Sourcegraph Cloud
get Sourcegraph Enterprise
</Link>
.
</CloudCtaBanner>
</CallToActionBanner>
)}
</div>
<Container className="py-3">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import classNames from 'classnames'

import { AuthenticatedUser } from '@sourcegraph/shared/src/auth'
import { ThemeProps } from '@sourcegraph/shared/src/theme'
import { buildCloudTrialURL } from '@sourcegraph/shared/src/util/url'
import { Link, Button, CardBody, Card, Icon, H2, H3, H4, Text } from '@sourcegraph/wildcard'

import { CloudCtaBanner } from '../../components/CloudCtaBanner'
import { CallToActionBanner } from '../../components/CallToActionBanner'
import { eventLogger } from '../../tracking/eventLogger'

import styles from './CodeMonitoringGettingStarted.module.scss'
Expand Down Expand Up @@ -104,20 +103,18 @@ export const CodeMonitoringGettingStarted: React.FunctionComponent<
</Card>

{isSourcegraphDotCom && (
<CloudCtaBanner variant="filled">
<CallToActionBanner variant="filled">
To monitor changes across your team's private repositories,{' '}
<Link
to={buildCloudTrialURL(authenticatedUser, 'monitoring')}
target="_blank"
rel="noopener noreferrer"
to="https://about.sourcegraph.com"
onClick={() =>
eventLogger.log('ClickedOnCloudCTA', { cloudCtaType: 'MonitoringGettingStarted' })
eventLogger.log('ClickedOnEnterpriseCTA', { location: 'MonitoringGettingStarted' })
}
>
try Sourcegraph Cloud
get Sourcegraph Enterprise
</Link>
.
</CloudCtaBanner>
</CallToActionBanner>
)}

<div>
Expand Down
Loading

0 comments on commit 29a0cef

Please sign in to comment.