diff --git a/services/web/frontend/js/features/preview/components/preview-error.js b/services/web/frontend/js/features/preview/components/preview-error.js index 7919f795fb..d0eb4aac50 100644 --- a/services/web/frontend/js/features/preview/components/preview-error.js +++ b/services/web/frontend/js/features/preview/components/preview-error.js @@ -3,7 +3,6 @@ import PropTypes from 'prop-types' import { useTranslation } from 'react-i18next' import PreviewLogsPaneEntry from './preview-logs-pane-entry' import Icon from '../../../shared/components/icon' -import { useApplicationContext } from '../../../shared/context/application-context' import { useEditorContext } from '../../../shared/context/editor-context' import StartFreeTrialButton from '../../../shared/components/start-free-trial-button' @@ -11,12 +10,6 @@ function PreviewError({ name }) { const { hasPremiumCompile, isProjectOwner } = useEditorContext({ isProjectOwner: PropTypes.bool, }) - const { - exposedSettings: { enableSubscriptions }, - } = useApplicationContext({ - exposedSettings: PropTypes.shape({ enableSubscriptions: PropTypes.bool }) - .isRequired, - }) const { t } = useTranslation() let errorTitle @@ -74,7 +67,9 @@ function PreviewError({ name }) { entryAriaLabel={t('compile_error_entry_description')} level="error" /> - {name === 'timedout' && enableSubscriptions && !hasPremiumCompile ? ( + {name === 'timedout' && + window.ExposedSettings.enableSubscriptions && + !hasPremiumCompile ? ( ) : null} diff --git a/services/web/frontend/js/ide.js b/services/web/frontend/js/ide.js index b0bfe712cb..dfd72f83a5 100644 --- a/services/web/frontend/js/ide.js +++ b/services/web/frontend/js/ide.js @@ -60,7 +60,6 @@ import './services/wait-for' import './filters/formatDate' import './main/event' import './main/account-upgrade-angular' -import './main/exposed-settings-angular' import './main/system-messages' import '../../modules/modules-ide.js' import './shared/context/controllers/root-context-controller' diff --git a/services/web/frontend/js/main.js b/services/web/frontend/js/main.js index 0a7394a071..1685e16ce0 100644 --- a/services/web/frontend/js/main.js +++ b/services/web/frontend/js/main.js @@ -28,7 +28,6 @@ import './main/register-users' import './main/subscription/team-invite-controller' import './main/subscription/upgrade-subscription' import './main/learn' -import './main/exposed-settings-angular' import './main/affiliations/components/affiliationForm' import './main/affiliations/components/inputSuggestions' import './main/affiliations/controllers/UserAffiliationsController' diff --git a/services/web/frontend/js/main/exposed-settings-angular.js b/services/web/frontend/js/main/exposed-settings-angular.js deleted file mode 100644 index ac7d5623b4..0000000000 --- a/services/web/frontend/js/main/exposed-settings-angular.js +++ /dev/null @@ -1,3 +0,0 @@ -import App from '../base' - -App.constant('ExposedSettings', window.ExposedSettings) diff --git a/services/web/frontend/js/shared/context/application-context.js b/services/web/frontend/js/shared/context/application-context.js index 35526663ed..f7b8b14c9a 100644 --- a/services/web/frontend/js/shared/context/application-context.js +++ b/services/web/frontend/js/shared/context/application-context.js @@ -10,10 +10,6 @@ ApplicationContext.Provider.propTypes = { firstName: PropTypes.string, lastName: PropTypes.string, }), - exposedSettings: PropTypes.shape({ - appName: PropTypes.string.isRequired, - enableSubscriptions: PropTypes.bool, - }), gitBridgePublicBaseUrl: PropTypes.string.isRequired, }), } @@ -21,7 +17,6 @@ ApplicationContext.Provider.propTypes = { export function ApplicationProvider({ children }) { const applicationContextValue = { user: window.user, - exposedSettings: window.ExposedSettings, gitBridgePublicBaseUrl: window.gitBridgePublicBaseUrl, } return ( diff --git a/services/web/frontend/js/shared/context/editor-context.js b/services/web/frontend/js/shared/context/editor-context.js index c6b9ece81a..740b1cb95d 100644 --- a/services/web/frontend/js/shared/context/editor-context.js +++ b/services/web/frontend/js/shared/context/editor-context.js @@ -1,7 +1,6 @@ import React, { createContext, useCallback, useContext, useEffect } from 'react' import PropTypes from 'prop-types' import useScopeValue from './util/scope-value-hook' -import { useApplicationContext } from './application-context' import useBrowserWindow from '../hooks/use-browser-window' export const EditorContext = createContext() @@ -32,13 +31,6 @@ EditorContext.Provider.propTypes = { } export function EditorProvider({ children, ide, settings }) { - const { - exposedSettings: { appName }, - } = useApplicationContext({ - exposedSettings: PropTypes.shape({ appName: PropTypes.string.isRequired }) - .isRequired, - }) - const cobranding = window.brandVariation ? { logoImgUrl: window.brandVariation.logo_url, @@ -100,9 +92,11 @@ export function EditorProvider({ children, ide, settings }) { const { setTitle } = useBrowserWindow() useEffect(() => { setTitle( - `${projectName ? projectName + ' - ' : ''}Online LaTeX Editor ${appName}` + `${projectName ? projectName + ' - ' : ''}Online LaTeX Editor ${ + window.ExposedSettings.appName + }` ) - }, [appName, projectName, setTitle]) + }, [projectName, setTitle]) const editorContextValue = { cobranding, diff --git a/services/web/test/frontend/bootstrap.js b/services/web/test/frontend/bootstrap.js index d76b43f67c..679e6f9c3f 100644 --- a/services/web/test/frontend/bootstrap.js +++ b/services/web/test/frontend/bootstrap.js @@ -22,6 +22,7 @@ window.ExposedSettings = { appName: 'Overleaf', maxEntitiesPerProject: 10, maxUploadSize: 5 * 1024 * 1024, + siteUrl: 'https://www.dev-overleaf.com', } window.i18n = { currentLangCode: 'en' } diff --git a/services/web/test/frontend/features/share-project-modal/components/share-project-modal.test.js b/services/web/test/frontend/features/share-project-modal/components/share-project-modal.test.js index 0516eb01e8..ac868d8607 100644 --- a/services/web/test/frontend/features/share-project-modal/components/share-project-modal.test.js +++ b/services/web/test/frontend/features/share-project-modal/components/share-project-modal.test.js @@ -86,16 +86,6 @@ describe('', function () { handleHide: sinon.stub(), } - const originalExposedSettings = window.ExposedSettings - - before(function () { - window.ExposedSettings = { appName: 'Overleaf' } - }) - - after(function () { - window.ExposedSettings = originalExposedSettings - }) - beforeEach(function () { fetchMock.get('/user/contacts', { contacts }) }) diff --git a/services/web/test/frontend/helpers/render-with-context.js b/services/web/test/frontend/helpers/render-with-context.js index 3b1e1a8666..86378fc486 100644 --- a/services/web/test/frontend/helpers/render-with-context.js +++ b/services/web/test/frontend/helpers/render-with-context.js @@ -19,7 +19,6 @@ export function EditorProviders({ children, }) { window.user = user || window.user - window.ExposedSettings.appName = 'test' window.gitBridgePublicBaseUrl = 'git.overleaf.test' window.project_id = projectId != null ? projectId : window.project_id