Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ nosetests.xml
coverage.xml
*.cover
.hypothesis/
__tests__

# Translations
*.mo
Expand Down Expand Up @@ -313,3 +314,6 @@ output/*
.code-review-graph/
.claude/
jsconfig.json

# Local documentation
docs/
133 changes: 62 additions & 71 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 8 additions & 10 deletions src/components/app/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Footer from './Footer';
import DocumentTitle from "./DocumentTitle"
import SigninRedirect from './SigninRedirect'
import './App.scss';
import { hotjar } from 'react-hotjar';
import HotjarService from '../../services/HotjarService';
import APIService from '../../services/APIService'
import Header from './Header';
import OIDLoginCallback from '../users/OIDLoginCallback';
Expand Down Expand Up @@ -54,13 +54,6 @@ const App = props => {
const { alert, setAlert, setToggles } = React.useContext(OperationsContext);
const [authVersion, setAuthVersion] = React.useState(0)
const silentCheckRunning = React.useRef(false)
const setupHotJar = () => {
/*eslint no-undef: 0*/
const HID = window.HOTJAR_ID || process.env.HOTJAR_ID
if(HID)
hotjar.initialize(HID, 6);
}

const fetchToggles = async () => {
return new Promise(resolve => {
APIService.toggles().get().then(response => {
Expand Down Expand Up @@ -137,9 +130,14 @@ const App = props => {
fetchToggles()
addLogoutListenerForAllTabs()
GAService.recordPageView()
setupHotJar()
// Loads only after consent (PrivacyConsent); setup in services/HotjarService.js
HotjarService.initialize()
const unlisten = props.history.listen(location => HotjarService.recordPageView(location.pathname))

return () => unsubscribe()
return () => {
unsubscribe()
unlisten()
}
}, [])

const clearThrottlingError = React.useCallback(() => {
Expand Down
12 changes: 12 additions & 0 deletions src/components/app/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import {
getAppliedServerConfig
} from '../../common/utils';
import { TERMS_OF_USE_URL, PRIVACY_POLICY_URL } from '../../common/constants';
import HotjarService from '../../services/HotjarService';
import AppVersions from './AppVersions';
import PrivacyConsent from './PrivacyConsent';
import './Footer.scss';

const DEFAULT_FOOTER_TEXT = `${new Date().getFullYear()} Open Concept Lab`;
Expand All @@ -24,6 +26,7 @@ const EXTRA_HEIGHT_VAR = '--footer-extra-height';
const Footer = () => {
const { t } = useTranslation();
const ref = React.useRef(null);
const [privacyPreferencesOpen, setPrivacyPreferencesOpen] = React.useState(false);
const text = get(getAppliedServerConfig(), 'info.site.footerText', DEFAULT_FOOTER_TEXT);
const isDefault = text === DEFAULT_FOOTER_TEXT;

Expand All @@ -47,6 +50,14 @@ const Footer = () => {
<Link href={TERMS_OF_USE_URL} target='_blank' rel='noopener noreferrer' underline='hover' sx={LEGAL_LINK_SX}>{t('common.terms_of_use')}</Link>
<Divider orientation='vertical' className='footer-divider-vertical' />
<Link href={PRIVACY_POLICY_URL} target='_blank' rel='noopener noreferrer' underline='hover' sx={LEGAL_LINK_SX}>{t('common.privacy_policy')}</Link>
{
HotjarService.isConfigured() &&
<React.Fragment>
<Divider orientation='vertical' className='footer-divider-vertical' />
{/* Change or withdraw the consent PrivacyConsent asks for (ocl_online#533) */}
<Link component='button' type='button' underline='hover' sx={{...LEGAL_LINK_SX, fontSize: 'inherit', verticalAlign: 'baseline'}} onClick={() => setPrivacyPreferencesOpen(true)}>{t('privacy_consent.preferences')}</Link>
</React.Fragment>
}
</div>
<Divider orientation='vertical' className='footer-divider-vertical' />
<span className='flex-vertical-center'>
Expand All @@ -58,6 +69,7 @@ const Footer = () => {
</span>
<Divider orientation='vertical' className='footer-divider-vertical' />
<AppVersions />
<PrivacyConsent preferencesOpen={privacyPreferencesOpen} onPreferencesChange={setPrivacyPreferencesOpen} />
</footer>
);

Expand Down
Loading
Loading