mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 17:31:43 +00:00
chore(plg): add useEmbeddedUI site config param (#63442)
Adds `dotcom.codyProConfig.useEmbeddedUI` site config param. This param defines whether the Cody Pro subscription and team management UI should be served from the connected instance running in the dotcom mode. The default value is `false`. This change allows us to enable the SSC proxy on the instance without enabling the new embedded Cody Pro UI. Previously whether the embedded Cody Pro UI is enabled was defined by the `dotcom.codyProConfig` being set, which prevented us from enabling the SSC proxy without enabling the embedded UI: > Whether the SSC proxy is enabled is [defined based on `dotcom.codyProConfig`](41fb56d619/cmd/frontend/internal/ssc/ssc_proxy.go (L227-L231)) being set in the site config. This value is also partially [propagated](41fb56d619/cmd/frontend/internal/app/jscontext/jscontext.go (L481)) to the frontend via jscontext. And the frontend [uses this value](41fb56d619/client/web/src/cody/util.ts (L8-L18)) to define whether to use new embedded UI or not. For more details see [this Slack thread](https://sourcegraph.slack.com/archives/C05PC7AKFQV/p1719010292837099?thread_ts=1719000927.962429&cid=C05PC7AKFQV). <!-- 💡 To write a useful PR description, make sure that your description covers: - WHAT this PR is changing: - How was it PREVIOUSLY. - How it will be from NOW on. - WHY this PR is needed. - CONTEXT, i.e. to which initiative, project or RFC it belongs. The structure of the description doesn't matter as much as covering these points, so use your best judgement based on your context. Learn how to write good pull request description: https://www.notion.so/sourcegraph/Write-a-good-pull-request-description-610a7fd3e613496eb76f450db5a49b6e?pvs=4 --> ## Test plan - CI - Tested manually: - Run Sourcegraoh instance locally in dotcom mode - Set `dotcom.codyProConfig` in the site config - Type `context. frontendCodyProConfig` that it returns the [correct values from the site config](184da4ce4a/cmd/frontend/internal/app/jscontext/jscontext.go (L711-L715)) <!-- All pull requests REQUIRE a test plan: https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles --> ## Changelog <!-- 1. Ensure your pull request title is formatted as: $type($domain): $what 2. Add bullet list items for each additional detail you want to cover (see example below) 3. You can edit this after the pull request was merged, as long as release shipping it hasn't been promoted to the public. 4. For more information, please see this how-to https://www.notion.so/sourcegraph/Writing-a-changelog-entry-dd997f411d524caabf0d8d38a24a878c? Audience: TS/CSE > Customers > Teammates (in that order). Cheat sheet: $type = chore|fix|feat $domain: source|search|ci|release|plg|cody|local|... --> <!-- Example: Title: fix(search): parse quotes with the appropriate context Changelog section: ## Changelog - When a quote is used with regexp pattern type, then ... - Refactored underlying code. -->
This commit is contained in:
parent
abe9ef1623
commit
345a06abb1
@ -13,8 +13,7 @@ export const manageSubscriptionRedirectURL = `${
|
||||
* for managing their Cody Pro subscription information.
|
||||
*/
|
||||
export function isEmbeddedCodyProUIEnabled(): boolean {
|
||||
return !!(window.context?.frontendCodyProConfig as { stripePublishableKey: string } | undefined)
|
||||
?.stripePublishableKey
|
||||
return !!window.context.frontendCodyProConfig?.useEmbeddedUI
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -314,6 +314,7 @@ export interface SourcegraphContext extends Pick<Required<SiteConfiguration>, 'e
|
||||
frontendCodyProConfig?: {
|
||||
stripePublishableKey: string
|
||||
sscBaseUrl: string
|
||||
useEmbeddedUI: boolean
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -153,6 +153,7 @@ type LicenseInfo struct {
|
||||
type FrontendCodyProConfig struct {
|
||||
StripePublishableKey string `json:"stripePublishableKey"`
|
||||
SscBaseUrl string `json:"sscBaseUrl"`
|
||||
UseEmbeddedUI bool `json:"useEmbeddedUI"`
|
||||
}
|
||||
|
||||
// JSContext is made available to JavaScript code via the
|
||||
@ -710,5 +711,6 @@ func makeFrontendCodyProConfig(config *schema.CodyProConfig) *FrontendCodyProCon
|
||||
return &FrontendCodyProConfig{
|
||||
StripePublishableKey: config.StripePublishableKey,
|
||||
SscBaseUrl: config.SscBaseUrl,
|
||||
UseEmbeddedUI: config.UseEmbeddedUI,
|
||||
}
|
||||
}
|
||||
|
||||
@ -656,6 +656,8 @@ type CodyProConfig struct {
|
||||
SscBaseUrl string `json:"sscBaseUrl,omitempty"`
|
||||
// StripePublishableKey description: Stripe Publishable Key for use in Stripe Checkout, Stripe Elements. This is not considered a secret.
|
||||
StripePublishableKey string `json:"stripePublishableKey,omitempty"`
|
||||
// UseEmbeddedUI description: Whether Cody Pro UI is served from sourcegraph.com. If false, users are directed to https://accounts.sourcegraph.com/cody to manage their Cody Pro subscription.
|
||||
UseEmbeddedUI bool `json:"useEmbeddedUI,omitempty"`
|
||||
}
|
||||
|
||||
// Completions description: Configuration for the completions service.
|
||||
|
||||
@ -2279,6 +2279,11 @@
|
||||
"type": "string",
|
||||
"default": "https://accounts.sourcegraph.com/cody",
|
||||
"description": "The base URL of the Self-Serve Cody site."
|
||||
},
|
||||
"useEmbeddedUI": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Whether Cody Pro UI is served from sourcegraph.com. If false, users are directed to https://accounts.sourcegraph.com/cody to manage their Cody Pro subscription."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user