Merge pull request #4025 from overleaf/ae-timeout-upgrade
Only show upgrade message on timeout if not already premium GitOrigin-RevId: 1378b0a98c6b511d63f2ce1192d3fdca16e8db26
This commit is contained in:
@@ -8,7 +8,7 @@ import { useEditorContext } from '../../../shared/context/editor-context'
|
|||||||
import StartFreeTrialButton from '../../../shared/components/start-free-trial-button'
|
import StartFreeTrialButton from '../../../shared/components/start-free-trial-button'
|
||||||
|
|
||||||
function PreviewError({ name }) {
|
function PreviewError({ name }) {
|
||||||
const { isProjectOwner } = useEditorContext({
|
const { hasPremiumCompile, isProjectOwner } = useEditorContext({
|
||||||
isProjectOwner: PropTypes.bool,
|
isProjectOwner: PropTypes.bool,
|
||||||
})
|
})
|
||||||
const {
|
const {
|
||||||
@@ -74,7 +74,7 @@ function PreviewError({ name }) {
|
|||||||
entryAriaLabel={t('compile_error_entry_description')}
|
entryAriaLabel={t('compile_error_entry_description')}
|
||||||
level="error"
|
level="error"
|
||||||
/>
|
/>
|
||||||
{name === 'timedout' && enableSubscriptions ? (
|
{name === 'timedout' && enableSubscriptions && !hasPremiumCompile ? (
|
||||||
<TimeoutUpgradePrompt isProjectOwner={isProjectOwner} />
|
<TimeoutUpgradePrompt isProjectOwner={isProjectOwner} />
|
||||||
) : null}
|
) : null}
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ EditorContext.Provider.propTypes = {
|
|||||||
brandedMenu: PropTypes.string,
|
brandedMenu: PropTypes.string,
|
||||||
submitBtnHtml: PropTypes.string,
|
submitBtnHtml: PropTypes.string,
|
||||||
}),
|
}),
|
||||||
|
hasPremiumCompile: PropTypes.bool,
|
||||||
loading: PropTypes.bool,
|
loading: PropTypes.bool,
|
||||||
projectRootDocId: PropTypes.string,
|
projectRootDocId: PropTypes.string,
|
||||||
projectId: PropTypes.string.isRequired,
|
projectId: PropTypes.string.isRequired,
|
||||||
@@ -66,6 +67,11 @@ export function EditorProvider({ children, ide, settings }) {
|
|||||||
ide.$scope
|
ide.$scope
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const [compileGroup] = useScopeValue(
|
||||||
|
'project.features.compileGroup',
|
||||||
|
ide.$scope
|
||||||
|
)
|
||||||
|
|
||||||
const [rootFolder] = useScopeValue('rootFolder', ide.$scope)
|
const [rootFolder] = useScopeValue('rootFolder', ide.$scope)
|
||||||
|
|
||||||
const renameProject = useCallback(
|
const renameProject = useCallback(
|
||||||
@@ -98,6 +104,7 @@ export function EditorProvider({ children, ide, settings }) {
|
|||||||
|
|
||||||
const editorContextValue = {
|
const editorContextValue = {
|
||||||
cobranding,
|
cobranding,
|
||||||
|
hasPremiumCompile: compileGroup === 'priority',
|
||||||
loading,
|
loading,
|
||||||
projectId: window.project_id,
|
projectId: window.project_id,
|
||||||
projectRootDocId,
|
projectRootDocId,
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ export const TimedOutError = args => {
|
|||||||
owner: {
|
owner: {
|
||||||
_id: window.user.id,
|
_id: window.user.id,
|
||||||
},
|
},
|
||||||
|
features: {
|
||||||
|
compileGroup: 'standard',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -34,6 +37,39 @@ TimedOutError.args = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const TimedOutErrorWithPriorityCompile = args => {
|
||||||
|
useFetchMock(fetchMock => {
|
||||||
|
fetchMock.post('express:/event/:key', 202)
|
||||||
|
})
|
||||||
|
|
||||||
|
const ide = {
|
||||||
|
$scope: {
|
||||||
|
$watch: () => () => null,
|
||||||
|
project: {
|
||||||
|
owner: {
|
||||||
|
_id: window.user.id,
|
||||||
|
},
|
||||||
|
features: {
|
||||||
|
compileGroup: 'priority',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ApplicationProvider>
|
||||||
|
<EditorProvider ide={ide} settings={{}}>
|
||||||
|
<PreviewLogsPane {...args} />
|
||||||
|
</EditorProvider>
|
||||||
|
</ApplicationProvider>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
TimedOutErrorWithPriorityCompile.args = {
|
||||||
|
errors: {
|
||||||
|
timedout: {},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
title: 'Preview Logs / Pane',
|
title: 'Preview Logs / Pane',
|
||||||
component: PreviewLogsPane,
|
component: PreviewLogsPane,
|
||||||
|
|||||||
Reference in New Issue
Block a user