📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
Added per-user mailing preferences; not allowing unverified users to create new projects
Blue Mouse86a950625cb4
diff --git a/package.json b/package.jsonindex 513daf8bc..523e2cf58 100644--- a/package.json+++ b/package.json@@ -18,6 +18,7 @@"debug": "^4.3.2","dom-to-image": "^2.6.0","file-saver": "^2.0.5",+ "i18n-iso-countries": "^6.8.0","lodash": "^4.17.21","nanoid": "^3.1.22","node-sass": "^5.0.0",@@ -25,6 +26,7 @@"react": "^17.0.1","react-alert": "^7.0.2","react-dom": "^17.0.1",+ "react-flagkit": "^2.0.4","react-helmet": "^6.1.0","react-redux": "^7.2.2","react-router-dom": "^5.2.0",diff --git a/src/App.js b/src/App.jsindex 44f80d155..87a6b47a0 100644--- a/src/App.js+++ b/src/App.js@@ -38,7 +38,7 @@ const ProtectedProjectSettings = isAuthenticated(ProjectSettings)const ProtectedViewProject = isAuthenticated(ViewProject)const minimalFooterPages = [- '/projects', '/dashboard',+ '/projects', '/dashboard', '/settings']const App = () => {@@ -50,8 +50,6 @@ const App = () => {const { message, type } = useSelector(state => state.alerts)const accessToken = getAccessToken()- console.log(location.pathname)-useEffect(() => {(async () => {if (accessToken) {diff --git a/src/components/Footer/index.jsx b/src/components/Footer/index.jsxindex 5ba38621b..71f188f43 100644--- a/src/components/Footer/index.jsx+++ b/src/components/Footer/index.jsx@@ -79,7 +79,7 @@ const Footer = ({ minimal }) => {<div className='w-11/12 mx-auto py-12 px-4 sm:px-6 lg:px-8'><div className='xl:grid xl:grid-cols-3 xl:gap-8'><div className='space-y-8 xl:col-span-1'>- <img className='h-10' src='assets/logo_white.png' alt='Swetrix Analytics' />+ <img className='h-10' src='/assets/logo_white.png' alt='Swetrix Analytics' /><p className='text-gray-300 text-base'>The best apps need the best services.<br />Swetrix is a powerful analytics platform that respects user privacy.diff --git a/src/components/Header/index.jsx b/src/components/Header/index.jsxindex 05dca0bee..76af66158 100644--- a/src/components/Header/index.jsx+++ b/src/components/Header/index.jsx@@ -20,7 +20,7 @@ const Header = ({ authenticated }) => {<div className='flex items-center'><Link to={routes.main}><span className='sr-only'>Swetrix</span>- <img className='h-10 w-auto' src='assets/logo_white.png' alt='' />+ <img className='h-10 w-auto' src='/assets/logo_white.png' alt='' /></Link><div className='hidden ml-10 space-x-1 lg:block'><NavLink to={routes.features} className='text-base select-none font-medium text-white hover:text-indigo-50 py-2 px-3 hover:bg-indigo-500 rounded-md' activeClassName='bg-indigo-700 hover:bg-indigo-700' key='Features'>Features</NavLink>diff --git a/src/pages/Dashboard/Dashboard.container.jsx b/src/pages/Dashboard/Dashboard.container.jsxindex 927401a45..d64f7f401 100644--- a/src/pages/Dashboard/Dashboard.container.jsx+++ b/src/pages/Dashboard/Dashboard.container.jsx@@ -3,6 +3,7 @@ import Dashboard from './Dashboard'const mapStateToProps = (state) => ({projects: state.ui.projects.projects,+ user: state.auth.user,isLoading: state.ui.projects.isLoading,error: state.ui.projects.error,})diff --git a/src/pages/Dashboard/Dashboard.jsx b/src/pages/Dashboard/Dashboard.jsxindex ace461da2..89fe205ea 100644--- a/src/pages/Dashboard/Dashboard.jsx+++ b/src/pages/Dashboard/Dashboard.jsx@@ -1,5 +1,5 @@-import React, { memo } from 'react'-import { Link } from 'react-router-dom'+import React, { memo, useState } from 'react'+import { Link, useHistory } from 'react-router-dom'import cx from 'classnames'import dayjs from 'dayjs'import PropTypes from 'prop-types'@@ -12,6 +12,7 @@ import { ArrowSmUpIcon } from '@heroicons/react/solid'import { ArrowSmDownIcon } from '@heroicons/react/solid'import { XCircleIcon } from '@heroicons/react/solid'+import Modal from 'ui/Modal'import Title from 'components/Title'import Loader from 'ui/Loader'import { ActivePin, InactivePin } from 'ui/Pin'@@ -102,7 +103,18 @@ const NoProjects = () => (</div>)-const Dashboard = ({ projects, isLoading, error }) => {+const Dashboard = ({ projects, isLoading, error, user }) => {+ const [showActivateEmailModal, setShowActivateEmailModal] = useState(false)+ const history = useHistory()++ const onNewProject = () => {+ if (user.isActive) {+ history.push(routes.new_project)+ } else {+ setShowActivateEmailModal(true)+ }+ }+if (error && !isLoading) {return (<Title title='Dashboard'>@@ -129,9 +141,9 @@ const Dashboard = ({ projects, isLoading, error }) => {<div className='max-w-7xl w-full mx-auto'><div className='flex justify-between'><h2 className='mt-2 text-3xl font-extrabold text-gray-900'>Dashboard</h2>- <Link to={routes.new_project} className='inline-flex items-center border border-transparent leading-4 font-medium rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 px-4 py-2 text-sm'>+ <span onClick={onNewProject} className='inline-flex cursor-pointer items-center border border-transparent leading-4 font-medium rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 px-4 py-2 text-sm'>New project- </Link>+ </span></div>{_isEmpty(projects) ? (<NoProjects />@@ -146,6 +158,15 @@ const Dashboard = ({ projects, isLoading, error }) => {)}</div></div>+ <Modal+ onClose={() => setShowActivateEmailModal(false)}+ onSubmit={() => setShowActivateEmailModal(false)}+ submitText='Got it'+ title='Please, verify the email address first'+ type='info'+ message={'To start using our service and creating your projects, you first need to confirm your email address.\n\nA link to confirm your account was sent to the email address you provided during registration, if it was not delivered - you can request the link again in your account settings.'}+ isOpened={showActivateEmailModal}+ /></Title>)}@@ -161,6 +182,7 @@ const Dashboard = ({ projects, isLoading, error }) => {Dashboard.propTypes = {projects: PropTypes.arrayOf(PropTypes.object).isRequired,+ user: PropTypes.object.isRequired,isLoading: PropTypes.bool.isRequired,error: PropTypes.string,}diff --git a/src/pages/Project/Settings/ProjectSettings.container.jsx b/src/pages/Project/Settings/ProjectSettings.container.jsxindex 894dda1ad..4565a444d 100644--- a/src/pages/Project/Settings/ProjectSettings.container.jsx+++ b/src/pages/Project/Settings/ProjectSettings.container.jsx@@ -8,6 +8,7 @@ import ProjectSettings from './ProjectSettings'const mapStateToProps = (state) => ({projects: state.ui.projects.projects,isLoading: state.ui.projects.isLoading,+ user: state.auth.user,})const mapDispatchToProps = (dispatch) => ({diff --git a/src/pages/Project/Settings/ProjectSettings.jsx b/src/pages/Project/Settings/ProjectSettings.jsxindex f9e1d225a..2892fbe0d 100644--- a/src/pages/Project/Settings/ProjectSettings.jsx+++ b/src/pages/Project/Settings/ProjectSettings.jsx@@ -19,7 +19,7 @@ import routes from 'routes'const ProjectSettings = ({updateProjectFailed, createNewProjectFailed, newProject, projectDeleted, deleteProjectFailed,- loadProjects, isLoading, projects, showError, removeProject,+ loadProjects, isLoading, projects, showError, removeProject, user,}) => {const { pathname } = useLocation()const { id } = useParams()@@ -39,6 +39,11 @@ const ProjectSettings = ({const [projectSaving, setProjectSaving] = useState(false)useEffect(() => {+ if (!user.isActive) {+ showError('Please, verify your email address first')+ history.push(routes.dashboard)+ }+if (!isLoading && isSettings && !projectDeleting) {if (_isEmpty(project)) {showError('The selected project does not exist')@@ -50,7 +55,7 @@ const ProjectSettings = ({})}}- }, [project, isLoading, isSettings, history, showError, projectDeleting])+ }, [user, project, isLoading, isSettings, history, showError, projectDeleting])const onSubmit = async (data) => {if (!projectSaving) {@@ -73,9 +78,9 @@ const ProjectSettings = ({history.push(routes.dashboard)} catch (e) {if (isSettings) {- updateProjectFailed(e.message)+ updateProjectFailed(e)} else {- createNewProjectFailed(e.message)+ createNewProjectFailed(e)}} finally {setProjectSaving(false)@@ -93,7 +98,7 @@ const ProjectSettings = ({projectDeleted()history.push(routes.dashboard)} catch (e) {- deleteProjectFailed(e.message)+ deleteProjectFailed(e)} finally {setProjectDeleting(false)}@@ -249,6 +254,7 @@ ProjectSettings.propTypes = {projects: PropTypes.arrayOf(PropTypes.object).isRequired,showError: PropTypes.func.isRequired,isLoading: PropTypes.bool.isRequired,+ user: PropTypes.object.isRequired,}export default ProjectSettingsdiff --git a/src/pages/Project/View/Panels.jsx b/src/pages/Project/View/Panels.jsxindex ac454f8b9..6f9468614 100644--- a/src/pages/Project/View/Panels.jsx+++ b/src/pages/Project/View/Panels.jsx@@ -1,8 +1,10 @@import React, { memo, useState, useMemo, Fragment } from 'react'import cx from 'classnames'+import PropTypes from 'prop-types'import _keys from 'lodash/keys'import _map from 'lodash/map'import _isEmpty from 'lodash/isEmpty'+import _isFunction from 'lodash/isFunction'import _reduce from 'lodash/reduce'import _round from 'lodash/round'import _floor from 'lodash/floor'@@ -13,7 +15,9 @@ import Progress from 'ui/Progress'const ENTRIES_PER_PANEL = 5-const Panel = ({ name, data }) => {+const Panel = ({+ name, data, rowMapper, capitalize,+}) => {const [page, setPage] = useState(0)const currentIndex = page * ENTRIES_PER_PANELconst keys = useMemo(() => _keys(data).sort((a, b) => data[b] - data[a]), [data])@@ -47,9 +51,12 @@ const Panel = ({ name, data }) => {return (<Fragment key={key}><div className='flex justify-between mt-1'>- <span className='label'>{key}</span>+ <span className={cx('flex label', { capitalize })}>+ {_isFunction(rowMapper) ? rowMapper(key) : key}+ </span><span className='ml-3'>- {data[key]} + {data[key]}+ <span className='text-gray-500 font-light'>({perc}%)</span></span></div>@@ -88,6 +95,18 @@ const Panel = ({ name, data }) => {)}+Panel.propTypes = {+ name: PropTypes.string.isRequired,+ data: PropTypes.objectOf(PropTypes.number).isRequired,+ rowMapper: PropTypes.func,+ capitalize: PropTypes.bool,+}++Panel.defaultProps = {+ rowMapper: null,+ capitalize: false,+}+const PanelMemo = memo(Panel)export {diff --git a/src/pages/Project/View/ViewProject.jsx b/src/pages/Project/View/ViewProject.jsxindex d7f8e71e2..3cb07d91f 100644--- a/src/pages/Project/View/ViewProject.jsx+++ b/src/pages/Project/View/ViewProject.jsx@@ -3,6 +3,9 @@ import { useHistory, useParams } from 'react-router-dom'import domToImage from 'dom-to-image'import { saveAs } from 'file-saver'import bb, { area, zoom } from 'billboard.js'+import Flag from 'react-flagkit'+import countries from 'i18n-iso-countries'+import countriesEn from 'i18n-iso-countries/langs/en.json'import cx from 'classnames'import * as d3 from 'd3'import dayjs from 'dayjs'@@ -27,6 +30,8 @@ import { Panel } from './Panels'import routes from 'routes'import { getProjectData } from 'api'+countries.registerLocale(countriesEn)+const getJSON = (chart, showTotal) => ({x: _map(chart.x, el => dayjs(el).toDate()),'Unique visitors': chart.uniques,@@ -71,7 +76,9 @@ const typeNameMapping = {pg: 'Page',lc: 'Locale',ref: 'Referrer',- sw: 'Screen width',+ dv: 'Device type',+ br: 'Browser',+ os: 'OS name',so: 'utm_source',me: 'utm_medium',ca: 'utm_campaign',@@ -197,6 +204,8 @@ const ViewProject = ({}}+ const isPanelsDataEmpty = _isEmpty(panelsData)+if (!isLoading) {return (<Title title={name}>@@ -237,32 +246,49 @@ const ViewProject = ({</div></div></div>- {_isEmpty(panelsData) ? (+ {isPanelsDataEmpty && (analyticsLoading ? (<Loader />) : (<NoEvents />)- ) : (- <>- <div className='flex flex-row items-center justify-center md:justify-end h-10 mt-16 md:mt-5 mb-4'>- <Checkbox label='Show all views' id='views' checked={showTotal} onChange={(e) => setShowTotal(e.target.checked)} />- <div className='h-full ml-3'>- <Button onClick={exportAsImageHandler} className='py-2.5 px-3 md:px-4 text-sm' secondary>- Export as image- </Button>- </div>- </div>- <div className='pt-4 md:pt-0'>- <div id='dataChart' />- <div className='mt-5 grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-3'>- {_map(panelsData.types, type => (- <Panel key={type} name={typeNameMapping[type]} data={panelsData.data[type]} />- ))}- </div>- </div>- </>)}+ <div className={cx('flex flex-row items-center justify-center md:justify-end h-10 mt-16 md:mt-5 mb-4', { hidden: isPanelsDataEmpty })}>+ <Checkbox label='Show all views' id='views' checked={showTotal} onChange={(e) => setShowTotal(e.target.checked)} />+ <div className='h-full ml-3'>+ <Button onClick={exportAsImageHandler} className='py-2.5 px-3 md:px-4 text-sm' secondary>+ Export as image+ </Button>+ </div>+ </div>+ <div className={cx('pt-4 md:pt-0', { hidden: isPanelsDataEmpty })}>+ <div className='h-80' id='dataChart' />+ <div className='mt-5 grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-3'>+ {_map(panelsData.types, type => {+ if (type === 'cc') {+ return (+ <Panel key={type} name={typeNameMapping[type]} data={panelsData.data[type]} rowMapper={(name) => (+ <>+ <Flag className='rounded-md' country={name} size={21} alt='' />+ + {countries.getName(name, 'en')}+ </>+ )} />+ )+ }++ if (type === 'dv') {+ return (+ <Panel key={type} name={typeNameMapping[type]} data={panelsData.data[type]} capitalize />+ )+ }++ return (+ <Panel key={type} name={typeNameMapping[type]} data={panelsData.data[type]} />+ )+ })}+ </div>+ </div></div></Title>)@@ -270,7 +296,9 @@ const ViewProject = ({return (<Title title={name}>- <Loader />+ <div className='min-h-min-footer'>+ <Loader />+ </div></Title>)}diff --git a/src/pages/UserSettings/UserSettings.container.jsx b/src/pages/UserSettings/UserSettings.container.jsxindex 6ecbac8c2..dc295d346 100644--- a/src/pages/UserSettings/UserSettings.container.jsx+++ b/src/pages/UserSettings/UserSettings.container.jsx@@ -1,6 +1,12 @@import React from 'react'import { useDispatch } from 'react-redux'+import dayjs from 'dayjs'+import utc from 'dayjs/plugin/utc'+import _isNull from 'lodash/isNull'+import {+ CONFIRMATION_TIMEOUT, GDPR_REQUEST, GDPR_EXPORT_TIMEFRAME,+} from 'redux/constants'import { authActions } from 'redux/actions/auth'import { errorsActions } from 'redux/actions/errors'import { alertsActions } from 'redux/actions/alerts'@@ -9,6 +15,8 @@ import { confirmEmail, exportUserData } from 'api'import UserSettings from './UserSettings'+dayjs.extend(utc)+const UserSettingsContainer = () => {const dispatch = useDispatch()@@ -16,17 +24,22 @@ const UserSettingsContainer = () => {dispatch(authActions.deleteAccountAsync((error) => dispatch(- errorsActions.deleteAccountFailed(error.description)+ errorsActions.deleteAccountFailed(error.description),)))}- const onExport = async () => {+ const onExport = async (exportedAt) => {try {+ if (getCookie(GDPR_REQUEST) || (!_isNull(exportedAt) && !dayjs().isAfter(dayjs.utc(exportedAt).add(GDPR_EXPORT_TIMEFRAME, 'day'), 'day'))) {+ dispatch(errorsActions.GDPRExportFailed(`Please, try again later. You can request a GDPR Export only once per ${GDPR_EXPORT_TIMEFRAME} days.`))+ return+ }await exportUserData()- // TODO: Use cookies to make sure user is not able to request more than 1 request per day- dispatch(alertsActions.accountUpdated('The GDPR data report has been sent to your email address'))++ dispatch(alertsActions.accountUpdated('The GDPR data report has been sent to your email address.'))+ setCookie(GDPR_REQUEST, true, 1209600) // setting cookie for 14 days} catch (e) {dispatch(errorsActions.updateProfileFailed(e))}@@ -51,7 +64,7 @@ const UserSettingsContainer = () => {}const onEmailConfirm = async (errorCallback) => {- if (getCookie('confirmation_timeout')) {+ if (getCookie(CONFIRMATION_TIMEOUT)) {dispatch(errorsActions.updateProfileFailed('An email has already been sent, check your mailbox or try again in a few minutes'))return}@@ -60,7 +73,7 @@ const UserSettingsContainer = () => {const res = await confirmEmail()if (res) {- setCookie('confirmation_timeout', true, 600)+ setCookie(CONFIRMATION_TIMEOUT, true, 600)dispatch(alertsActions.accountUpdated('An account confirmation link has been sent to your email'))} else {errorCallback('Unfortunately, you\'ve ran out of your email confirmation requests.\nPlease make sure you are able to receive e-mails and check your SPAM folder again for messages.\nYou may try to use a different email address or contact our customer support service.')diff --git a/src/pages/UserSettings/UserSettings.jsx b/src/pages/UserSettings/UserSettings.jsxindex 98dc93634..b325b4515 100644--- a/src/pages/UserSettings/UserSettings.jsx+++ b/src/pages/UserSettings/UserSettings.jsx@@ -4,10 +4,12 @@ import _size from 'lodash/size'import _isEmpty from 'lodash/isEmpty'import { MailIcon } from '@heroicons/react/outline'+import { reportFrequencies } from 'redux/constants'import Title from 'components/Title'import Input from 'ui/Input'import Button from 'ui/Button'import Modal from 'ui/Modal'+import Select from 'ui/Select'import { isValidEmail, isValidPassword } from 'utils/validator'const UserSettings = ({ onDelete, onExport, onSubmit, onEmailConfirm }) => {@@ -18,6 +20,7 @@ const UserSettings = ({ onDelete, onExport, onSubmit, onEmailConfirm }) => {password: '',repeat: '',})+ const [reportFrequency, setReportFrequency] = useState(user.reportFrequency)const [validated, setValidated] = useState(false)const [errors, setErrors] = useState({})const [beenSubmitted, setBeenSubmitted] = useState(false)@@ -49,6 +52,17 @@ const UserSettings = ({ onDelete, onExport, onSubmit, onEmailConfirm }) => {}}+ const handleReportSave = () => {+ setBeenSubmitted(true)++ if (validated) {+ onSubmit({+ ...form,+ reportFrequency,+ })+ }+ }+const validate = () => {const allErrors = {}@@ -72,11 +86,14 @@ const UserSettings = ({ onDelete, onExport, onSubmit, onEmailConfirm }) => {return (<Title title='Profile settings'>- <div className='min-h-page bg-gray-50 flex flex-col py-6 px-4 sm:px-6 lg:px-8'>+ <div className='min-h-min-footer bg-gray-50 flex flex-col py-6 px-4 sm:px-6 lg:px-8'><form className='max-w-7xl w-full mx-auto' onSubmit={handleSubmit}><h2 className='mt-2 text-3xl font-extrabold text-gray-900'>Profile settings- </h2>+ </h2>+ <h3 className='mt-2 text-lg font-bold text-gray-900'>+ General settings+ </h3><Inputname='email'id='email'@@ -116,11 +133,29 @@ const UserSettings = ({ onDelete, onExport, onSubmit, onEmailConfirm }) => {<Button className='mt-4' type='submit' primary large>Update profile</Button>- <hr className='mt-3' />- {!user?.isActive && (+ <hr className='mt-5' />+ <h3 className='mt-2 text-lg font-bold text-gray-900'>+ Email reports+ </h3>+ <div className='grid grid-cols-1 gap-y-6 gap-x-4 lg:grid-cols-2 mt-4'>+ <div>+ <Select+ title={reportFrequency}+ label='How often should we send you an email summary about your websites?'+ className='w-full'+ items={reportFrequencies}+ onSelect={setReportFrequency}+ />+ </div>+ </div>+ <Button className='mt-4' onClick={handleReportSave} primary large>+ Save+ </Button>+ <hr className='mt-5' />+ {!user.isActive && (<div href='#' className='flex cursor-pointer mt-4 pl-0 underline text-blue-600 hover:text-indigo-800' onClick={() => onEmailConfirm(setError)}><MailIcon className='mt-0.5 mr-2 w-6 h-6 text-blue-500' />- Didn't receive a link to confirm the email address? Request a new one!+ Didn't receive a link to confirm the email address? Request a new one!</div>)}<div className='flex justify-between mt-4'>@@ -130,7 +165,7 @@ const UserSettings = ({ onDelete, onExport, onSubmit, onEmailConfirm }) => {primary>Request data export- </Button>+ </Button><ButtonclassName='ml-3'onClick={() => setShowModal(true)}@@ -138,13 +173,13 @@ const UserSettings = ({ onDelete, onExport, onSubmit, onEmailConfirm }) => {danger>Delete account- </Button>+ </Button></div></form><ModalonClose={() => setShowExportModal(false)}- onSubmit={() => { setShowExportModal(false); onExport() }}+ onSubmit={() => { setShowExportModal(false); onExport(user.exportedAt) }}submitText='Continue'closeText='Close'title='Data export'diff --git a/src/pages/UserSettings/index.jsx b/src/pages/UserSettings/index.jsxindex 118904206..85d6b6853 100644--- a/src/pages/UserSettings/index.jsx+++ b/src/pages/UserSettings/index.jsx@@ -1 +1 @@-export { default } from './UserSettings.container'\ No newline at end of file+export { default } from './UserSettings.container'diff --git a/src/redux/actions/errors/index.js b/src/redux/actions/errors/index.jsindex 2d2ad2bb5..107fb5f35 100644--- a/src/redux/actions/errors/index.js+++ b/src/redux/actions/errors/index.js@@ -30,13 +30,6 @@ export const errorsActions = {}},- canteensErrors(error) {- return {- type: types.CANTEENS_ERRORS,- payload: { error },- }- },-deleteAccountFailed(error) {return {type: types.DELETE_ACCOUNT_FAILED,@@ -65,6 +58,13 @@ export const errorsActions = {}},+ GDPRExportFailed(error) {+ return {+ type: types.GDPR_EXPORT_FAILED,+ payload: { error },+ }+ },+genericError(error) {return {type: types.GENERIC_ERROR,diff --git a/src/redux/actions/errors/types.js b/src/redux/actions/errors/types.jsindex 61418b6e1..c22ebe891 100644--- a/src/redux/actions/errors/types.js+++ b/src/redux/actions/errors/types.js@@ -6,6 +6,9 @@ export const types = {CREATE_NEW_PASSWORD_FAILED: 'CREATE_NEW_PASSWORD_FAILED',DELETE_ACCOUNT_FAILED: 'DELETE_ACCOUNT_FAILED',+ // User+ GDPR_EXPORT_FAILED: 'GDPR_EXPORT_FAILED',+// ProjectsCREATE_NEW_PROJECT_FAILED: 'CREATE_NEW_PROJECT_FAILED',UPDATE_PROJECT_FAILED: 'UPDATE_PROJECT_FAILED',diff --git a/src/redux/constants/index.js b/src/redux/constants/index.jsindex 86c8eebe8..1f6cacc06 100644--- a/src/redux/constants/index.js+++ b/src/redux/constants/index.js@@ -37,9 +37,17 @@ export const tbsFormatMapper = {'month': '%d %B',}+export const reportFrequencies = ['weekly', 'monthly', 'never']++export const GDPR_EXPORT_TIMEFRAME = 14 // days+export const TOKEN = 'access_token'export const TITLE_SUFFIX = process.env.REACT_APP_TITLE_SUFFIX// Functionsexport const getProjectCacheKey = (period, timeBucket) => `${period}${timeBucket}`++// Cookies+export const GDPR_REQUEST = 'gdpr_request'+export const CONFIRMATION_TIMEOUT = 'confirmation_timeout'diff --git a/src/redux/reducers/errors.js b/src/redux/reducers/errors.jsindex 4d8629d93..3adfeb7a9 100644--- a/src/redux/reducers/errors.js+++ b/src/redux/reducers/errors.js@@ -15,6 +15,7 @@ const errorsReducer = (state = initialState, { type, payload }) => {case types.CREATE_NEW_PROJECT_FAILED:case types.UPDATE_PROJECT_FAILED:case types.DELETE_PROJECT_FAILED:+ case types.GDPR_EXPORT_FAILED:return { ...state, error: payload.error }case types.CLEAR_ERRORS: