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 8a21187145..e8dffbd406 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 @@ -7,28 +7,39 @@ import { useCallback, useMemo } from 'react' import ErrorState from './error-state' import StartFreeTrialButton from '@/shared/components/start-free-trial-button' import getMeta from '@/utils/meta' -import { sendMB } from '@/infrastructure/event-tracking' +import { + populateEditorRedesignSegmentation, + useEditorAnalytics, +} from '@/shared/hooks/use-editor-analytics' +import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils' export const ShortCompileTimeoutErrorState = () => { const { t } = useTranslation() const { isProjectOwner } = useCompileContext() + const { sendEvent } = useEditorAnalytics() + const newEditor = useIsNewEditorEnabled() const { compileTimeout } = getMeta('ol-compileSettings') const segmentation = useMemo( - () => ({ - 'is-owner': isProjectOwner, - compileTime: compileTimeout, - }), - [isProjectOwner, compileTimeout] + () => + populateEditorRedesignSegmentation( + { + 'is-owner': isProjectOwner, + compileTime: compileTimeout, + location: 'error-state', + }, + newEditor + ), + [isProjectOwner, compileTimeout, newEditor] ) const sendInfoClickEvent = useCallback(() => { - sendMB('paywall-info-click', { + sendEvent('paywall-info-click', { ...segmentation, 'paywall-type': 'compile-timeout', content: 'blog', }) - }, [segmentation]) + }, [segmentation, sendEvent]) return ( ({ - 'is-owner': isProjectOwner, - compileTime: compileTimeout, - }), - [isProjectOwner, compileTimeout] + () => + populateEditorRedesignSegmentation( + { + 'is-owner': isProjectOwner, + compileTime: compileTimeout, + location: 'logs', + }, + newEditor + ), + [isProjectOwner, compileTimeout, newEditor] ) return ( @@ -126,9 +137,10 @@ const PreventTimeoutHelpMessage = memo(function PreventTimeoutHelpMessage({ segmentation, }: PreventTimeoutHelpMessageProps) { const { t } = useTranslation() + const { sendEvent } = useEditorAnalytics() function sendInfoClickEvent() { - eventTracking.sendMB('paywall-info-click', { + sendEvent('paywall-info-click', { ...segmentation, 'paywall-type': 'compile-timeout', content: 'blog',