From 13f0fa4875cfc93e584db07f79bacaeddeafb663 Mon Sep 17 00:00:00 2001 From: isabellaenriquez Date: Wed, 19 Nov 2025 13:28:05 -0500 Subject: [PATCH 1/3] ref(checkout): Update route --- src/sentry/organizations/absolute_url.py | 1 + static/app/utils/url/normalizeUrl.tsx | 1 + static/gsApp/hooks/rootRoutes.tsx | 14 +++++++++++++- static/gsApp/views/amCheckout/index.tsx | 16 ++++++---------- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/sentry/organizations/absolute_url.py b/src/sentry/organizations/absolute_url.py index a4e2c62a7154ba..615719044c808a 100644 --- a/src/sentry/organizations/absolute_url.py +++ b/src/sentry/organizations/absolute_url.py @@ -27,6 +27,7 @@ re.compile(r"^\/?(?!settings)[^/]+\/([^/]+)\/getting-started\/(.*)"), r"/getting-started/\1/\2", ), + (re.compile(r"^\/?checkout\/[^/]+\/(.*)"), r"/checkout/\1"), ] diff --git a/static/app/utils/url/normalizeUrl.tsx b/static/app/utils/url/normalizeUrl.tsx index 8429cab1329af4..e82e3390763337 100644 --- a/static/app/utils/url/normalizeUrl.tsx +++ b/static/app/utils/url/normalizeUrl.tsx @@ -22,6 +22,7 @@ const NORMALIZE_PATTERNS: Array<[pattern: RegExp, replacement: string]> = [ // Handles /org-slug/project-slug/getting-started/platform/ -> /getting-started/project-slug/platform/ [/^\/?(?!settings)[^/]+\/([^/]+)\/getting-started\/(.*)/, '/getting-started/$1/$2'], [/^\/?accept-terms\/[^/]*\/?$/, '/accept-terms/'], + [/^\/?checkout\/[^/]+\/(.*)/, '/checkout/$1'], ]; type NormalizeUrlOptions = { diff --git a/static/gsApp/hooks/rootRoutes.tsx b/static/gsApp/hooks/rootRoutes.tsx index 9e13c9b649f6ce..cae91612c715fb 100644 --- a/static/gsApp/hooks/rootRoutes.tsx +++ b/static/gsApp/hooks/rootRoutes.tsx @@ -1,6 +1,7 @@ import {makeLazyloadComponent as make} from 'sentry/makeLazyloadComponent'; import type {SentryRouteObject} from 'sentry/router/types'; import errorHandler from 'sentry/utils/errorHandler'; +import withDomainRedirect from 'sentry/utils/withDomainRedirect'; import OrganizationSubscriptionContext from 'getsentry/components/organizationSubscriptionContext'; @@ -8,7 +9,7 @@ const rootRoutes = (): SentryRouteObject => ({ children: [ { // TODO(checkout v3): rename this to /checkout/ when the legacy checkout route is removed - path: '/checkout-v3/', + path: '/checkout/', component: errorHandler(OrganizationSubscriptionContext), deprecatedRouteProps: true, customerDomainOnlyRoute: true, @@ -19,6 +20,17 @@ const rootRoutes = (): SentryRouteObject => ({ }, ], }, + { + path: '/checkout/:orgId/', + component: withDomainRedirect(errorHandler(OrganizationSubscriptionContext)), + deprecatedRouteProps: true, + children: [ + { + index: true, + component: make(() => import('getsentry/views/decideCheckout')), + }, + ], + }, ], }); diff --git a/static/gsApp/views/amCheckout/index.tsx b/static/gsApp/views/amCheckout/index.tsx index 4600bc73b59263..4322c77256a9ba 100644 --- a/static/gsApp/views/amCheckout/index.tsx +++ b/static/gsApp/views/amCheckout/index.tsx @@ -138,16 +138,12 @@ class AMCheckout extends Component { const queryString = query && Object.keys(query).length > 0 ? `?${qs.stringify(query)}` : ''; - // TODO(checkout v3): remove these checks once checkout v3 is GA'd and we've remove the legacy checkout route - if (props.location?.pathname.includes('checkout-v3') && !props.isNewCheckout) { - props.navigate( - `/settings/${props.organization.slug}/billing/checkout/${queryString}`, - { - replace: true, - } - ); - } else if (!props.location?.pathname.includes('checkout-v3') && props.isNewCheckout) { - props.navigate(`/checkout-v3/${queryString}`, {replace: true}); + // TODO(checkout v3): remove this check once we properly redirect from the legacy routes + if ( + props.location?.pathname.includes('/settings/billing/checkout/') && + props.isNewCheckout + ) { + props.navigate(`/checkout/${queryString}`, {replace: true}); } let step = 1; if (props.location?.hash) { From 9504c3ce8c59d35733566d740934f6e3bfb8848b Mon Sep 17 00:00:00 2001 From: isabellaenriquez Date: Wed, 19 Nov 2025 13:34:34 -0500 Subject: [PATCH 2/3] rm backend change + write test --- src/sentry/organizations/absolute_url.py | 1 - static/app/utils/url/normalizeUrl.spec.tsx | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sentry/organizations/absolute_url.py b/src/sentry/organizations/absolute_url.py index 615719044c808a..a4e2c62a7154ba 100644 --- a/src/sentry/organizations/absolute_url.py +++ b/src/sentry/organizations/absolute_url.py @@ -27,7 +27,6 @@ re.compile(r"^\/?(?!settings)[^/]+\/([^/]+)\/getting-started\/(.*)"), r"/getting-started/\1/\2", ), - (re.compile(r"^\/?checkout\/[^/]+\/(.*)"), r"/checkout/\1"), ] diff --git a/static/app/utils/url/normalizeUrl.spec.tsx b/static/app/utils/url/normalizeUrl.spec.tsx index 0122580ef2335d..01662a4fa5106f 100644 --- a/static/app/utils/url/normalizeUrl.spec.tsx +++ b/static/app/utils/url/normalizeUrl.spec.tsx @@ -78,6 +78,8 @@ describe('normalizeUrl', () => { ['/join-request/acme/', '/join-request/'], ['/onboarding/acme/', '/onboarding/'], ['/onboarding/acme/project/', '/onboarding/project/'], + ['/checkout/acme/', '/checkout/'], + ['/checkout/acme/?query=value', '/checkout/?query=value'], ['/organizations/new/', '/organizations/new/'], ['/organizations/albertos-organizations/issues/', '/issues/'], From e1fad56b1f966fc325daa671467f4d0aed21a84e Mon Sep 17 00:00:00 2001 From: isabellaenriquez Date: Wed, 19 Nov 2025 13:45:07 -0500 Subject: [PATCH 3/3] add withDomainRequired --- static/gsApp/hooks/rootRoutes.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/static/gsApp/hooks/rootRoutes.tsx b/static/gsApp/hooks/rootRoutes.tsx index cae91612c715fb..f6cb1816353a3f 100644 --- a/static/gsApp/hooks/rootRoutes.tsx +++ b/static/gsApp/hooks/rootRoutes.tsx @@ -2,6 +2,7 @@ import {makeLazyloadComponent as make} from 'sentry/makeLazyloadComponent'; import type {SentryRouteObject} from 'sentry/router/types'; import errorHandler from 'sentry/utils/errorHandler'; import withDomainRedirect from 'sentry/utils/withDomainRedirect'; +import withDomainRequired from 'sentry/utils/withDomainRequired'; import OrganizationSubscriptionContext from 'getsentry/components/organizationSubscriptionContext'; @@ -10,7 +11,7 @@ const rootRoutes = (): SentryRouteObject => ({ { // TODO(checkout v3): rename this to /checkout/ when the legacy checkout route is removed path: '/checkout/', - component: errorHandler(OrganizationSubscriptionContext), + component: withDomainRequired(errorHandler(OrganizationSubscriptionContext)), deprecatedRouteProps: true, customerDomainOnlyRoute: true, children: [