import { Trans, useTranslation } from 'react-i18next' import { useDetachCompileContext } from '../../../shared/context/detach-compile-context' import StartFreeTrialButton from '../../../shared/components/start-free-trial-button' import { memo, useCallback } from 'react' import PdfLogEntry from './pdf-log-entry' import { useStopOnFirstError } from '../../../shared/hooks/use-stop-on-first-error' import { Button } from 'react-bootstrap' import * as eventTracking from '../../../infrastructure/event-tracking' function TimeoutUpgradePromptNew() { const { startCompile, lastCompileOptions, setAnimateCompileDropdownArrow, showNewCompileTimeoutUI, isProjectOwner, } = useDetachCompileContext() const { enableStopOnFirstError } = useStopOnFirstError({ eventSource: 'timeout-new', }) const handleEnableStopOnFirstErrorClick = useCallback(() => { enableStopOnFirstError() startCompile({ stopOnFirstError: true }) setAnimateCompileDropdownArrow(true) }, [enableStopOnFirstError, startCompile, setAnimateCompileDropdownArrow]) if (!window.ExposedSettings.enableSubscriptions) { return null } const compileTimeChanging = showNewCompileTimeoutUI === 'changing' return ( <> ) } type CompileTimeoutProps = { compileTimeChanging?: boolean isProjectOwner: boolean } const CompileTimeout = memo(function CompileTimeout({ compileTimeChanging, isProjectOwner, }: CompileTimeoutProps) { const { t } = useTranslation() return (

{isProjectOwner ? t('your_project_exceeded_compile_timeout_limit_on_free_plan') : t('this_project_exceeded_compile_timeout_limit_on_free_plan')}

{isProjectOwner ? (

{compileTimeChanging ? ( <> {t('upgrade_for_plenty_more_compile_time')}{' '} {t( 'plus_additional_collaborators_document_history_track_changes_and_more' )} ) : ( <> {' '} )}

) : ( , ]} /> )} {isProjectOwner && (

{t('start_a_free_trial')}

)} } entryAriaLabel={t('your_compile_timed_out')} level="error" /> ) }) type PreventTimeoutHelpMessageProps = { compileTimeChanging?: boolean lastCompileOptions: any handleEnableStopOnFirstErrorClick: () => void } const PreventTimeoutHelpMessage = memo(function PreventTimeoutHelpMessage({ compileTimeChanging, lastCompileOptions, handleEnableStopOnFirstErrorClick, }: PreventTimeoutHelpMessageProps) { const { t } = useTranslation() function sendInfoClickEvent() { eventTracking.sendMB('paywall-info-click', { 'paywall-type': 'compile-timeout', content: 'blog', }) } return (

{t('you_may_be_able_to_prevent_a_compile_timeout')} {compileTimeChanging && ( <> {' '} , ]} values={{ date: 'October 6 2023' }} /> )}

{t('common_causes_of_compile_timeouts_are')}:

  • , ]} />
  • , ]} /> {!lastCompileOptions.stopOnFirstError && ( <> {' '} , // eslint-disable-next-line react/jsx-key , ]} />{' '} )}

, ]} />

} entryAriaLabel={t('other_ways_to_prevent_compile_timeouts')} level="raw" /> ) }) export default memo(TimeoutUpgradePromptNew)