Make SSC base url dynamic#62790
Conversation
chrsmith
left a comment
There was a problem hiding this comment.
This LGTM, and thanks for taking care of it. But IMHO we should probably keep the specific URL we need the user to navigate to in the utils.ts file.
Just so that we have a single location where that exists in the code, and therefore can make any changes without unintentionally forgetting to update "all places" where we generate the URL and introduce bugs down the road.
There was a problem hiding this comment.
What is the purpose of ?team=1? It is probably worth calling out in a code comment, since it isn't entirely obvious why (or even if) that is required?
There was a problem hiding this comment.
?team=1 is the only difference between the actions of the "Create a Cody Pro team" and "Upgrade yourself to Pro" buttons. The checkout UI should initiate slightly differently. I don't remember the exact diff in the Figma, but there was something, maybe the initial value of the seat counter.
I'll call this out in a comment.
There was a problem hiding this comment.
There was a problem hiding this comment.
e.g.
// getManageSubscriptionUrl returns the URL that a user should navigate to in order
// to manage their Cody Pro subscription.
export function getManageSubscriptionUrl(): string {
...
}Having a "single source of truth" for something important like that seems like it would be in our best interest. Since otherwise, it's super easy to forget to find all places where we have code to generate the URL. (And therefore, could use a different name or do it in such a way we'd miss it when we need to modify the URL when we go live with the UI migrated to the Sourcegraph.com.)
There was a problem hiding this comment.
d9c8559 to
41964e8
Compare
For posterity, the "default" value in the (Which I guess is the purpose of |
For a long time, it was annoying that we couldn't properly test some SSC features because
https://accounts.sourcegraph.com/cody/subscription(production URL) was hard-coded for the "Manage subscription" links.This PR makes that setting dynamic.
Also:
?team=1argument which we'll handle on the checkout page.Note: If
sscBaseUrlis not configured in the site config, it falls back to the previously hard-coded URLhttps://accounts.sourcegraph.com/cody.The PR consists of four individual commits to make the PR review easier.
Test plan
Tested it manually: it works nicely.