From 28795507707ac93be6f38e5b01948cee59dff1f4 Mon Sep 17 00:00:00 2001 From: Mathias Jakobsen Date: Tue, 16 Sep 2025 12:28:06 +0100 Subject: [PATCH] Merge pull request #28438 from overleaf/dp-itm-content Add itm-content param indicating split test variant to compile timeout paywalls GitOrigin-RevId: 809e13f8e548498d890c055d20d7ce30fd6ead7f --- .../compile-timeout-error-state.tsx | 23 ++++++++++++++++++- .../ide-redesign/utils/new-editor-utils.ts | 2 +- .../components/timeout-upgrade-prompt-new.tsx | 23 ++++++++++++++++++- .../web/frontend/js/main/account-upgrade.ts | 4 +++- .../components/start-free-trial-button.tsx | 6 +++-- 5 files changed, 52 insertions(+), 6 deletions(-) diff --git a/services/web/frontend/js/features/ide-redesign/components/pdf-preview/pdf-error-state/compile-timeout-error-state.tsx b/services/web/frontend/js/features/ide-redesign/components/pdf-preview/pdf-error-state/compile-timeout-error-state.tsx index e8dffbd406..736ad77a34 100644 --- a/services/web/frontend/js/features/ide-redesign/components/pdf-preview/pdf-error-state/compile-timeout-error-state.tsx +++ b/services/web/frontend/js/features/ide-redesign/components/pdf-preview/pdf-error-state/compile-timeout-error-state.tsx @@ -11,7 +11,11 @@ import { populateEditorRedesignSegmentation, useEditorAnalytics, } from '@/shared/hooks/use-editor-analytics' -import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils' +import { + isNewUser, + useIsNewEditorEnabled, +} from '@/features/ide-redesign/utils/new-editor-utils' +import { getSplitTestVariant } from '@/utils/splitTestUtils' export const ShortCompileTimeoutErrorState = () => { const { t } = useTranslation() @@ -41,6 +45,22 @@ export const ShortCompileTimeoutErrorState = () => { }) }, [segmentation, sendEvent]) + const extraSearchParams = useMemo(() => { + if (!isNewUser()) { + return undefined + } + + const variant = getSplitTestVariant('editor-redesign-new-users') + + if (!variant) { + return undefined + } + + return { + itm_content: variant, + } + }, []) + return ( { source="compile-timeout" buttonProps={{ variant: 'premium', size: 'sm' }} segmentation={segmentation} + extraSearchParams={extraSearchParams} > {t('start_a_free_trial')} diff --git a/services/web/frontend/js/features/ide-redesign/utils/new-editor-utils.ts b/services/web/frontend/js/features/ide-redesign/utils/new-editor-utils.ts index 5403cc8b1a..ac43a1ea27 100644 --- a/services/web/frontend/js/features/ide-redesign/utils/new-editor-utils.ts +++ b/services/web/frontend/js/features/ide-redesign/utils/new-editor-utils.ts @@ -5,7 +5,7 @@ import { isSplitTestEnabled, getSplitTestVariant } from '@/utils/splitTestUtils' // TODO: change this when we have a launch date const NEW_USER_CUTOFF_DATE = new Date('2100-01-01') -const isNewUser = () => { +export const isNewUser = () => { const user = getMeta('ol-user') if (!user.signUpDate) return false diff --git a/services/web/frontend/js/features/pdf-preview/components/timeout-upgrade-prompt-new.tsx b/services/web/frontend/js/features/pdf-preview/components/timeout-upgrade-prompt-new.tsx index 03ba63613a..1bebb8b694 100644 --- a/services/web/frontend/js/features/pdf-preview/components/timeout-upgrade-prompt-new.tsx +++ b/services/web/frontend/js/features/pdf-preview/components/timeout-upgrade-prompt-new.tsx @@ -11,7 +11,11 @@ import { populateEditorRedesignSegmentation, useEditorAnalytics, } from '@/shared/hooks/use-editor-analytics' -import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils' +import { + isNewUser, + useIsNewEditorEnabled, +} from '@/features/ide-redesign/utils/new-editor-utils' +import { getSplitTestVariant } from '@/utils/splitTestUtils' function TimeoutUpgradePromptNew() { const { @@ -75,6 +79,22 @@ const CompileTimeout = memo(function CompileTimeout({ }: CompileTimeoutProps) { const { t } = useTranslation() + const extraSearchParams = useMemo(() => { + if (!isNewUser()) { + return undefined + } + + const variant = getSplitTestVariant('editor-redesign-new-users') + + if (!variant) { + return undefined + } + + return { + itm_content: variant, + } + }, []) + return ( {t('start_a_free_trial')} diff --git a/services/web/frontend/js/main/account-upgrade.ts b/services/web/frontend/js/main/account-upgrade.ts index 79155e5c0d..370395d590 100644 --- a/services/web/frontend/js/main/account-upgrade.ts +++ b/services/web/frontend/js/main/account-upgrade.ts @@ -3,7 +3,8 @@ import * as eventTracking from '../infrastructure/event-tracking' export function startFreeTrial( source: string, variant?: string, - segmentation?: eventTracking.Segmentation + segmentation?: eventTracking.Segmentation, + extraSearchParams?: Record ) { const eventSegmentation: Record = { 'paywall-type': source, @@ -18,6 +19,7 @@ export function startFreeTrial( const searchParams = new URLSearchParams({ itm_campaign: source, + ...extraSearchParams, }) window.open(`/user/subscription/choose-your-plan?${searchParams.toString()}`) diff --git a/services/web/frontend/js/shared/components/start-free-trial-button.tsx b/services/web/frontend/js/shared/components/start-free-trial-button.tsx index 2e3e2a4d80..0226ced4d8 100644 --- a/services/web/frontend/js/shared/components/start-free-trial-button.tsx +++ b/services/web/frontend/js/shared/components/start-free-trial-button.tsx @@ -11,6 +11,7 @@ type StartFreeTrialButtonProps = { children?: React.ReactNode handleClick?: React.ComponentProps['onClick'] segmentation?: eventTracking.Segmentation + extraSearchParams?: Record } export default function StartFreeTrialButton({ @@ -22,6 +23,7 @@ export default function StartFreeTrialButton({ source, variant, segmentation, + extraSearchParams, }: StartFreeTrialButtonProps) { const { t } = useTranslation() @@ -44,9 +46,9 @@ export default function StartFreeTrialButton({ handleClick(event) } - startFreeTrial(source, variant, segmentation) + startFreeTrial(source, variant, segmentation, extraSearchParams) }, - [handleClick, source, variant, segmentation] + [handleClick, source, variant, segmentation, extraSearchParams] ) return (