2023-09-18 07:35:43 -04:00
|
|
|
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'
|
2024-04-02 10:06:16 -04:00
|
|
|
import { useSplitTestContext } from '@/shared/context/split-test-context'
|
2023-09-18 07:35:43 -04:00
|
|
|
|
|
|
|
function TimeoutUpgradePromptNew() {
|
|
|
|
const {
|
|
|
|
startCompile,
|
|
|
|
lastCompileOptions,
|
|
|
|
setAnimateCompileDropdownArrow,
|
|
|
|
isProjectOwner,
|
|
|
|
} = useDetachCompileContext()
|
|
|
|
|
|
|
|
const { enableStopOnFirstError } = useStopOnFirstError({
|
|
|
|
eventSource: 'timeout-new',
|
|
|
|
})
|
|
|
|
|
|
|
|
const handleEnableStopOnFirstErrorClick = useCallback(() => {
|
|
|
|
enableStopOnFirstError()
|
|
|
|
startCompile({ stopOnFirstError: true })
|
|
|
|
setAnimateCompileDropdownArrow(true)
|
|
|
|
}, [enableStopOnFirstError, startCompile, setAnimateCompileDropdownArrow])
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
2024-04-15 05:33:46 -04:00
|
|
|
<CompileTimeout isProjectOwner={isProjectOwner} />
|
|
|
|
{window.ExposedSettings.enableSubscriptions && (
|
|
|
|
<PreventTimeoutHelpMessage
|
|
|
|
handleEnableStopOnFirstErrorClick={handleEnableStopOnFirstErrorClick}
|
|
|
|
lastCompileOptions={lastCompileOptions}
|
|
|
|
isProjectOwner={isProjectOwner}
|
|
|
|
/>
|
|
|
|
)}
|
2023-09-18 07:35:43 -04:00
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
type CompileTimeoutProps = {
|
|
|
|
isProjectOwner: boolean
|
|
|
|
}
|
|
|
|
|
2023-09-19 09:23:19 -04:00
|
|
|
const CompileTimeout = memo(function CompileTimeout({
|
2023-09-18 07:35:43 -04:00
|
|
|
isProjectOwner,
|
|
|
|
}: CompileTimeoutProps) {
|
|
|
|
const { t } = useTranslation()
|
2024-04-02 10:06:16 -04:00
|
|
|
|
|
|
|
const { splitTestVariants } = useSplitTestContext()
|
|
|
|
const hasNewPaywallCta = splitTestVariants['paywall-cta'] === 'enabled'
|
|
|
|
|
2023-09-18 07:35:43 -04:00
|
|
|
return (
|
|
|
|
<PdfLogEntry
|
|
|
|
headerTitle={t('your_compile_timed_out')}
|
|
|
|
formattedContent={
|
2024-04-15 05:33:46 -04:00
|
|
|
window.ExposedSettings.enableSubscriptions && (
|
|
|
|
<>
|
2023-09-18 07:35:43 -04:00
|
|
|
<p>
|
2024-04-15 05:33:46 -04:00
|
|
|
{isProjectOwner
|
|
|
|
? t('your_project_exceeded_compile_timeout_limit_on_free_plan')
|
|
|
|
: t('this_project_exceeded_compile_timeout_limit_on_free_plan')}
|
2023-09-18 07:35:43 -04:00
|
|
|
</p>
|
2024-04-15 05:33:46 -04:00
|
|
|
{isProjectOwner ? (
|
|
|
|
<p>
|
|
|
|
<strong>{t('upgrade_for_12x_more_compile_time')}</strong>{' '}
|
|
|
|
{t(
|
|
|
|
'plus_additional_collaborators_document_history_track_changes_and_more'
|
|
|
|
)}
|
|
|
|
</p>
|
|
|
|
) : (
|
|
|
|
<Trans
|
|
|
|
i18nKey="tell_the_project_owner_and_ask_them_to_upgrade"
|
|
|
|
components={[
|
|
|
|
// eslint-disable-next-line react/jsx-key
|
|
|
|
<strong />,
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
|
|
|
|
{isProjectOwner && (
|
|
|
|
<p className="text-center">
|
|
|
|
<StartFreeTrialButton
|
|
|
|
source="compile-timeout"
|
|
|
|
buttonProps={{
|
|
|
|
bsStyle: 'success',
|
|
|
|
className: 'row-spaced-small',
|
|
|
|
block: true,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{hasNewPaywallCta
|
|
|
|
? t('get_more_compile_time')
|
|
|
|
: t('start_a_free_trial')}
|
|
|
|
</StartFreeTrialButton>
|
|
|
|
</p>
|
|
|
|
)}
|
|
|
|
</>
|
|
|
|
)
|
2023-09-18 07:35:43 -04:00
|
|
|
}
|
2023-10-19 04:27:45 -04:00
|
|
|
// @ts-ignore
|
2023-09-18 07:35:43 -04:00
|
|
|
entryAriaLabel={t('your_compile_timed_out')}
|
|
|
|
level="error"
|
|
|
|
/>
|
|
|
|
)
|
2023-09-19 09:23:19 -04:00
|
|
|
})
|
2023-09-18 07:35:43 -04:00
|
|
|
|
|
|
|
type PreventTimeoutHelpMessageProps = {
|
|
|
|
lastCompileOptions: any
|
|
|
|
handleEnableStopOnFirstErrorClick: () => void
|
2023-10-30 08:55:07 -04:00
|
|
|
isProjectOwner: boolean
|
2023-09-18 07:35:43 -04:00
|
|
|
}
|
|
|
|
|
2023-09-19 09:23:19 -04:00
|
|
|
const PreventTimeoutHelpMessage = memo(function PreventTimeoutHelpMessage({
|
2023-09-18 07:35:43 -04:00
|
|
|
lastCompileOptions,
|
|
|
|
handleEnableStopOnFirstErrorClick,
|
2023-10-30 08:55:07 -04:00
|
|
|
isProjectOwner,
|
2023-09-18 07:35:43 -04:00
|
|
|
}: PreventTimeoutHelpMessageProps) {
|
|
|
|
const { t } = useTranslation()
|
|
|
|
|
|
|
|
function sendInfoClickEvent() {
|
|
|
|
eventTracking.sendMB('paywall-info-click', {
|
|
|
|
'paywall-type': 'compile-timeout',
|
|
|
|
content: 'blog',
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2023-10-30 08:55:07 -04:00
|
|
|
const compileTimeoutChangesBlogLink = (
|
|
|
|
/* eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key */
|
|
|
|
<a
|
|
|
|
aria-label={t('read_more_about_free_compile_timeouts_servers')}
|
|
|
|
href="/blog/changes-to-free-compile-timeouts-and-servers"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
target="_blank"
|
|
|
|
onClick={sendInfoClickEvent}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
|
2023-09-18 07:35:43 -04:00
|
|
|
return (
|
|
|
|
<PdfLogEntry
|
2023-10-30 08:55:07 -04:00
|
|
|
headerTitle={t('reasons_for_compile_timeouts')}
|
2023-09-18 07:35:43 -04:00
|
|
|
formattedContent={
|
|
|
|
<>
|
2023-10-30 08:55:07 -04:00
|
|
|
<p>{t('common_causes_of_compile_timeouts_include')}:</p>
|
2023-09-18 07:35:43 -04:00
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
<Trans
|
|
|
|
i18nKey="large_or_high-resolution_images_taking_too_long"
|
|
|
|
components={[
|
|
|
|
// eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
|
|
|
|
<a
|
|
|
|
href="/learn/how-to/Optimising_very_large_image_files"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
target="_blank"
|
|
|
|
/>,
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<Trans
|
|
|
|
i18nKey="a_fatal_compile_error_that_completely_blocks_compilation"
|
|
|
|
components={[
|
|
|
|
// eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
|
|
|
|
<a
|
|
|
|
href="/learn/how-to/Fixing_and_preventing_compile_timeouts#Step_3:_Assess_your_project_for_time-consuming_tasks_and_fatal_errors"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
target="_blank"
|
|
|
|
/>,
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
{!lastCompileOptions.stopOnFirstError && (
|
|
|
|
<>
|
|
|
|
{' '}
|
|
|
|
<Trans
|
|
|
|
i18nKey="enable_stop_on_first_error_under_recompile_dropdown_menu"
|
|
|
|
components={[
|
|
|
|
// eslint-disable-next-line react/jsx-key
|
|
|
|
<Button
|
|
|
|
bsSize="xs"
|
|
|
|
bsStyle="info-ghost-inline"
|
|
|
|
onClick={handleEnableStopOnFirstErrorClick}
|
|
|
|
/>,
|
|
|
|
// eslint-disable-next-line react/jsx-key
|
|
|
|
<strong />,
|
|
|
|
]}
|
|
|
|
/>{' '}
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p>
|
|
|
|
<Trans
|
|
|
|
i18nKey="learn_more_about_other_causes_of_compile_timeouts"
|
|
|
|
components={[
|
|
|
|
// eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
|
|
|
|
<a
|
|
|
|
href="/learn/how-to/Fixing_and_preventing_compile_timeouts"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
target="_blank"
|
|
|
|
/>,
|
|
|
|
]}
|
|
|
|
/>
|
|
|
|
</p>
|
2024-04-10 04:42:43 -04:00
|
|
|
<p>
|
|
|
|
<em>
|
2024-04-15 05:33:46 -04:00
|
|
|
<>
|
|
|
|
{isProjectOwner ? (
|
|
|
|
<Trans
|
|
|
|
i18nKey="weve_recently_reduced_the_compile_timeout_limit_which_may_have_affected_your_project"
|
|
|
|
components={[compileTimeoutChangesBlogLink]}
|
|
|
|
/>
|
|
|
|
) : (
|
|
|
|
<Trans
|
|
|
|
i18nKey="weve_recently_reduced_the_compile_timeout_limit_which_may_have_affected_this_project"
|
|
|
|
components={[compileTimeoutChangesBlogLink]}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</>
|
2024-04-10 04:42:43 -04:00
|
|
|
</em>
|
|
|
|
</p>
|
2023-09-18 07:35:43 -04:00
|
|
|
</>
|
|
|
|
}
|
2023-10-19 04:27:45 -04:00
|
|
|
// @ts-ignore
|
2023-10-30 08:55:07 -04:00
|
|
|
entryAriaLabel={t('reasons_for_compile_timeouts')}
|
2023-09-18 07:35:43 -04:00
|
|
|
level="raw"
|
|
|
|
/>
|
|
|
|
)
|
2023-09-19 09:23:19 -04:00
|
|
|
})
|
2023-09-18 07:35:43 -04:00
|
|
|
|
|
|
|
export default memo(TimeoutUpgradePromptNew)
|