Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/sentry/organizations/absolute_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
re.compile(r"^\/?(?!settings)[^/]+\/([^/]+)\/getting-started\/(.*)"),
r"/getting-started/\1/\2",
),
(re.compile(r"^\/?checkout\/[^/]+\/?.*"), r"/checkout/"),
]


Expand Down
3 changes: 3 additions & 0 deletions static/app/utils/url/normalizeUrl.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ describe('normalizeUrl', () => {
['/onboarding/acme/', '/onboarding/'],
['/onboarding/acme/project/', '/onboarding/project/'],

['/checkout/', '/checkout/'],
['/checkout/acme/', '/checkout/'],

['/organizations/new/', '/organizations/new/'],
['/organizations/albertos-organizations/issues/', '/issues/'],
[
Expand Down
1 change: 1 addition & 0 deletions static/app/utils/url/normalizeUrl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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/'],
];

type NormalizeUrlOptions = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ function PerformanceQuotaExceededWarning(props: ErrorOnlyWarningsProps) {
props.tree.shape
);
browserHistory.push({
pathname: `/settings/billing/checkout/?referrer=trace-view`,
pathname: `/checkout/?referrer=trace-view`,
query: {
skipBundles: true,
},
Expand Down
2 changes: 1 addition & 1 deletion static/gsApp/components/addEventsCTA.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function AddEventsCTA(props: Props) {
}, 0);
};

const checkoutUrl = `/settings/${organization.slug}/billing/checkout/?referrer=${referrer}`;
const checkoutUrl = `/checkout/?referrer=${referrer}`;
const subscriptionUrl = `/settings/${organization.slug}/billing/overview/`;

switch (action) {
Expand Down
4 changes: 2 additions & 2 deletions static/gsApp/components/ai/AiSetupDataConsent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function AiSetupDataConsent({groupId}: AiSetupDataConsentProps) {
const autofixAcknowledgeMutation = useSeerAcknowledgeMutation();

function handlePurchaseSeer() {
navigate(`/settings/billing/checkout/?referrer=ai_setup_data_consent`);
navigate(`/checkout/?referrer=ai_setup_data_consent`);
}

function handleAddBudget() {
Expand All @@ -93,7 +93,7 @@ function AiSetupDataConsent({groupId}: AiSetupDataConsentProps) {
}
if (isPerCategoryOnDemand) {
// Seer does not support per category on demand budgets, so we need to redirect to the checkout page to prompt the user to switch
navigate(`/settings/billing/checkout/?referrer=ai_setup_data_consent#step3`);
navigate('/checkout/?referrer=ai_setup_data_consent#step3');
return;
}
openOnDemandBudgetEditModal({
Expand Down
2 changes: 1 addition & 1 deletion static/gsApp/components/crons/cronsBannerUpgradeCTA.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function CronsBannerUpgradeCTA({hasBillingAccess}: UpgradeCTAProps) {
if (hasBillingAccess) {
return (
<LinkButton
href={normalizeUrl(`/settings/${organization.slug}/billing/checkout/`)}
href={normalizeUrl('/checkout/?referrer=crons_banner_upgrade_cta')}
size="xs"
analyticsEventName="Crons: Clicked Trial Banner CTA"
analyticsEventKey="crons.clicked_trial_banner_cta"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ function DateRangeQueryLimitFooter({
subscription,
upsellDefaultSelection,
}: Props) {
const checkoutUrl = normalizeUrl(
`/settings/${organization.slug}/billing/checkout/?referrer=checkout-${source}`
);
const checkoutUrl = normalizeUrl(`/checkout/?referrer=checkout-${source}`);

const canTrial = subscription.canTrial;

Expand Down
5 changes: 1 addition & 4 deletions static/gsApp/components/features/disabledPerformancePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@ function DisabledPerformancePage({
id: 'disabled-performance-page',
title: t('Upgrade Now'),
shortTitle: t('Upgrade'),
url: new URL(
`/settings/${organization.slug}/billing/checkout/`,
window.location.origin
).toString(),
url: new URL(`/checkout/`, window.location.origin).toString(),
},
}}
>
Expand Down
2 changes: 1 addition & 1 deletion static/gsApp/components/gsBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ class GSBanner extends Component<Props, State> {
// if there are deactivated members, than anyone who doesn't have org:billing will be
// prevented from accessing this view anyways cause they will be deactivated
if (isOverMemberLimit && !deactivatedMemberDismissed && this.hasBillingPerms) {
const checkoutUrl = `/settings/${organization.slug}/billing/checkout/?referrer=deactivated_member_header`;
const checkoutUrl = '/checkout/?referrer=deactivated_member_header';
const wrappedNumber = <strong>{membersDeactivatedFromLimit}</strong>;
// only disabling members if the plan allows exactly one member
return (
Expand Down
2 changes: 1 addition & 1 deletion static/gsApp/components/partnerPlanEndingBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function PartnerPlanEndingBanner({
analyticsEventName="Partner Plan Ending Banner: Manage Subscription"
size="md"
onClick={() => handleAnalytics()}
to={`/settings/${organization.slug}/billing/checkout/?referrer=partner_plan_ending_banner`}
to="/checkout/?referrer=partner_plan_ending_banner"
>
{t('Upgrade to %s', planToUpgradeTo)}
</LinkButton>
Expand Down
2 changes: 1 addition & 1 deletion static/gsApp/components/partnerPlanEndingModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function PartnerPlanEndingModal({organization, subscription, closeModal}: Props)
{hasBillingAccess ? (
<LinkButton
size="md"
to={`/settings/${organization.slug}/billing/checkout/?referrer=partner_plan_ending_modal`}
to="/checkout/?referrer=partner_plan_ending_modal"
aria-label="Upgrade Now"
priority="primary"
onClick={() =>
Expand Down
10 changes: 2 additions & 8 deletions static/gsApp/components/performance/quotaExceededAlert.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,7 @@ describe('Renders QuotaExceededAlert correctly for spans', () => {

expect(
screen.getByRole('link', {name: /increase your on-demand budget/})
).toHaveAttribute(
'href',
'/settings/billing/checkout/?referrer=trace-view&skipBundles=true'
);
).toHaveAttribute('href', '/checkout/?referrer=trace-view&skipBundles=true');
});

it('renders alert when quota is exceeded for logs', async () => {
Expand Down Expand Up @@ -176,9 +173,6 @@ describe('Renders QuotaExceededAlert correctly for spans', () => {

expect(
screen.getByRole('link', {name: /increase your on-demand budget/})
).toHaveAttribute(
'href',
'/settings/billing/checkout/?referrer=trace-view&skipBundles=true'
);
).toHaveAttribute('href', '/checkout/?referrer=trace-view&skipBundles=true');
});
});
2 changes: 1 addition & 1 deletion static/gsApp/components/performance/quotaExceededAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function useQuotaExceededAlertMessage(
const billingPageLink = (
<Link
to={{
pathname: `/settings/billing/checkout/?referrer=${referrer}`,
pathname: `/checkout/?referrer=${referrer}`,
query: {
skipBundles: true,
},
Expand Down
6 changes: 2 additions & 4 deletions static/gsApp/components/productTrial/productTrialAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function ProductTrialAlert(props: ProductTrialAlertProps) {
priority="primary"
onClick={() => {
browserHistory.push(
normalizeUrl(`/settings/${organization.slug}/billing/checkout/`)
normalizeUrl('/checkout/?referrer=product-trial-alert')
);
}}
>
Expand Down Expand Up @@ -212,9 +212,7 @@ function ProductTrialAlert(props: ProductTrialAlertProps) {
<Button
priority="primary"
onClick={() => {
browserHistory.push(
normalizeUrl(`/settings/${organization.slug}/billing/checkout/`)
);
browserHistory.push(normalizeUrl('/checkout/?referrer=product-trial-alert'));
}}
>
{t('Update Plan')}
Expand Down
6 changes: 3 additions & 3 deletions static/gsApp/components/profiling/profilingUpgradeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function UpsellModal(props: Props) {
if (error && hasBillingAccess) {
// Redirect the user to the subscriptions page, where they will find important information.
// If they wish to update their plan, we ask them to contact our sales/support team.
redirectToManage(organization);
redirectToManage();
}
}, [error, hasBillingAccess, organization]);

Expand Down Expand Up @@ -222,7 +222,7 @@ function ActionButtons({
});
} catch (err) {
Sentry.captureException(err);
redirectToManage(organization);
redirectToManage();
}
}, [api, organization, subscription, plan, reservations, onComplete, hasPriceChange]);

Expand All @@ -249,7 +249,7 @@ function ActionButtons({
{t('Update Now')}
</Button>
<LinkButton
to={`/settings/${organization.slug}/billing/checkout/?referrer=profiling_onboard_modal-owner-modal`}
to="/checkout/?referrer=profiling_onboard_modal-owner-modal"
onClick={onClickManageSubscription}
>
{t('Manage Subscription')}
Expand Down
2 changes: 1 addition & 1 deletion static/gsApp/components/replayOnboardingCTA.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function ReplayOnboardingCTAUpsell({
if (hasBillingAccess) {
// Redirect the user to the subscriptions page, where they will find important information.
// If they wish to update their plan, we ask them to contact our sales/support team.
redirectToManage(organization);
redirectToManage();
}
return;
}
Expand Down
6 changes: 3 additions & 3 deletions static/gsApp/components/upgradeNowModal/actionButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function ActionButtons({
});
} catch (err) {
Sentry.captureException(err);
redirectToManage(organization);
redirectToManage();
}
}, [
api,
Expand Down Expand Up @@ -114,7 +114,7 @@ function ActionButtons({
});
},
onError: () => {
redirectToManage(organization);
redirectToManage();
},
});
}, [api, organization, subscription, surface, onComplete]);
Expand Down Expand Up @@ -142,7 +142,7 @@ function ActionButtons({
{t('Update Now')}
</Button>
<LinkButton
to={`/settings/${organization.slug}/billing/checkout/?referrer=replay_onboard_modal-owner-modal`}
to="/checkout/?referrer=replay_onboard_modal-owner-modal"
onClick={onClickManageSubscription}
>
{t('Manage Subscription')}
Expand Down
2 changes: 1 addition & 1 deletion static/gsApp/components/upgradeNowModal/modalSamePrice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function UpgradeNowModal({
});
} catch (err) {
Sentry.captureException(err);
redirectToManage(organization);
redirectToManage();
addErrorMessage(
t(
'Oops! Unable to update Subscription automatically. Click through to update manually.'
Expand Down
5 changes: 2 additions & 3 deletions static/gsApp/components/upgradeNowModal/utils.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import type {Organization} from 'sentry/types/organization';
import {browserHistory} from 'sentry/utils/browserHistory';
import normalizeUrl from 'sentry/utils/url/normalizeUrl';

export function redirectToManage(organization: Organization) {
export function redirectToManage() {
browserHistory.replace(
normalizeUrl({
pathname: `/settings/${organization.slug}/billing/checkout/`,
pathname: '/checkout/',
query: {
referrer: 'replay_onboard-error-redirect',
},
Expand Down
2 changes: 1 addition & 1 deletion static/gsApp/components/upgradeOrTrialButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function UpgradeOrTrialButton({
if (hasAccess) {
// send self-serve directly to checkout
const baseUrl = subscription.canSelfServe
? `/settings/${slug}/billing/checkout/`
? '/checkout/'
: `/settings/${slug}/billing/overview/`;

return (
Expand Down
2 changes: 1 addition & 1 deletion static/gsApp/components/upsellModal/footer.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('Business Landing Footer', () => {
const organization = OrganizationFixture({access: ['org:billing']});
const subscription = SubscriptionFixture({organization});

const checkoutPage = `/settings/${organization.slug}/billing/checkout/?referrer=upgrade-business-landing.unknown`;
const checkoutPage = '/checkout/?referrer=upgrade-business-landing.unknown';

beforeEach(() => {
MockApiClient.clearMockResponses();
Expand Down
2 changes: 1 addition & 1 deletion static/gsApp/components/upsellProvider.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ describe('UpsellProvider', () => {

expect(router.location).toEqual(
expect.objectContaining({
pathname: `/settings/${org.slug}/billing/checkout/`,
pathname: '/checkout/',
query: {
referrer: 'upsell-test-abc',
},
Expand Down
2 changes: 1 addition & 1 deletion static/gsApp/components/upsellProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ function UpsellProvider({
} else {
// for self-serve can send them to checkout
const baseUrl = subscription.canSelfServe
? `/settings/${organization.slug}/billing/checkout/`
? '/checkout/'
: `/settings/${organization.slug}/billing/overview/`;
browserHistory.push(`${normalizeUrl(baseUrl)}?referrer=upsell-${source}`);
}
Expand Down
4 changes: 1 addition & 3 deletions static/gsApp/hooks/dashboardsLimit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ export function useDashboardsLimit(): UseDashboardsLimitResult {
? tct(
'You have reached the maximum number of Dashboards available on your plan. To add more, [link:upgrade your plan]',
{
link: (
<Link to="/settings/billing/checkout/?referrer=dashboards-limit-upsell" />
),
link: <Link to="/checkout/?referrer=dashboards-limit-upsell" />,
}
)
: null;
Expand Down
24 changes: 20 additions & 4 deletions static/gsApp/hooks/rootRoutes.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,37 @@
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';

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,
deprecatedRouteProps: true,
children: [
{
index: true,
component: withDomainRequired(
make(() => import('getsentry/views/decideCheckout'))
),
},
],
},
{
path: '/checkout/:orgId/',
component: errorHandler(OrganizationSubscriptionContext),
deprecatedRouteProps: true,
children: [
{
index: true,
component: make(() => import('getsentry/views/decideCheckout')),
component: withDomainRedirect(
make(() => import('getsentry/views/decideCheckout'))
),
},
],
},
Expand Down
12 changes: 2 additions & 10 deletions static/gsApp/hooks/settingsRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,10 @@ const settingsRoutes = (): SentryRouteObject => ({
redirectTo: 'overview/',
},
{
// TODO(checkout v3): This should be removed when checkout v3 is GA'd
// NOTE: This route is retained for legacy linking
path: 'checkout/',
name: 'Change',
component: errorHandler(SubscriptionContext),
deprecatedRouteProps: true,
children: [
{
index: true,
component: make(() => import('../views/decideCheckout')),
deprecatedRouteProps: true,
},
],
redirectTo: '/checkout/',
},
{
path: 'cancel/',
Expand Down
4 changes: 1 addition & 3 deletions static/gsApp/hooks/targetedOnboardingHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ function TargetedOnboardingHeader({source, subscription}: Props) {
<SecondaryCTAWrapper>{cta}</SecondaryCTAWrapper>
<LinkButton
onClick={trackClickUpgrade}
href={normalizeUrl(
`/settings/${organization.slug}/billing/checkout/?referrer=upgrade-${source}`
)}
href={normalizeUrl(`/checkout/?referrer=upgrade-${source}`)}
external
size="sm"
icon={<IconBusiness />}
Expand Down
2 changes: 1 addition & 1 deletion static/gsApp/views/amCheckout/checkoutSuccess.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ function CheckoutSuccess({
</LinkButton>
<LinkButton
aria-label={t('Edit plan')}
to="/settings/billing/checkout/?referrer=checkout_success"
to="/checkout/?referrer=checkout_success"
>
{t('Edit plan')}
</LinkButton>
Expand Down
Loading
Loading