📈 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
some update
Maksim Mrug8093bf23d22c
diff --git a/app/App.tsx b/app/App.tsxindex cac063400..c0e99f66d 100644--- a/app/App.tsx+++ b/app/App.tsx@@ -144,7 +144,7 @@ const App: React.FC<IApp> = ({ ssrTheme }) => {dispatch(authActions.finishLoading())} catch (e) {dispatch(authActions.logout())- dispatch(sagaActions.logout(false))+ dispatch(sagaActions.logout(false, false))}}})()diff --git a/app/api/index.ts b/app/api/index.tsindex 06447d5b2..26fb754fe 100644--- a/app/api/index.ts+++ b/app/api/index.ts@@ -44,7 +44,7 @@ const refreshAuthLogic = (failedRequest: { response: AxiosResponse }) =>}).catch((error) => {store.dispatch(authActions.logout())- store.dispatch(sagaActions.logout(true))+ store.dispatch(sagaActions.logout(true, false))return Promise.reject(error)})@@ -97,6 +97,19 @@ export const logoutApi = (refreshToken: string | null) =>: error.response.data.message})+export const logoutAllApi = (refreshToken: string | null) =>+ axios+ .post(`${baseURL}v1/auth/logout`, null, {+ headers: {+ Authorization: `Bearer ${refreshToken}`,+ },+ })+ .then((response) => response.data)+ .catch((error) => {+ debug('%s', error)+ throw new Error(error.respon)+ })+export const refreshToken = () =>api.post('v1/auth/refresh-token')@@ -1041,12 +1054,3 @@ export const getUsageInfo = () =>? error.response.data: error.response.data.message})--export const logoutAllApi = () =>- api- .get('v1/auth/logout-all')- .then((response) => response.data)- .catch((error) => {- debug('%s', error)- throw new Error(error.respon)- })diff --git a/app/components/Header/index.tsx b/app/components/Header/index.tsxindex 68898f4a5..f92255b1b 100644--- a/app/components/Header/index.tsx+++ b/app/components/Header/index.tsx@@ -627,7 +627,7 @@ const Header: React.FC<IHeader> = ({ ssrTheme }): JSX.Element => {const logoutHandler = () => {dispatch(authActions.logout())- _dispatch(sagaActions.logout(false))+ _dispatch(sagaActions.logout(false, false))}const switchTheme = (_theme?: string) => {diff --git a/app/pages/MainPage/Pricing.tsx b/app/pages/MainPage/Pricing.tsxindex 8ad276b85..6a54f49a6 100644--- a/app/pages/MainPage/Pricing.tsx+++ b/app/pages/MainPage/Pricing.tsx@@ -309,7 +309,7 @@ const Pricing = ({ t, language }: IPricing) => {dispatch(authActions.finishLoading())} catch (e) {dispatch(authActions.logout())- dispatch(sagaActions.logout(false))+ dispatch(sagaActions.logout(false, false))}dispatch(alertsActions.accountUpdated({diff --git a/app/pages/UserSettings/UserSettings.container.tsx b/app/pages/UserSettings/UserSettings.container.tsxindex 8ddf26374..472b8b2a3 100644--- a/app/pages/UserSettings/UserSettings.container.tsx+++ b/app/pages/UserSettings/UserSettings.container.tsx@@ -144,6 +144,9 @@ const mapDispatchToProps = (dispatch: AppDispatch) => ({updateShowLiveVisitorsInTitle: (show: boolean, callback: (isSuccess: boolean) => void) => {dispatch(sagaActions.updateShowLiveVisitorsInTitle(show, callback))},+ logoutAll: () => {+ dispatch(sagaActions.logout(false, true))+ },})export default connect(mapStateToProps, mapDispatchToProps)(UserSettings)diff --git a/app/pages/UserSettings/UserSettings.tsx b/app/pages/UserSettings/UserSettings.tsxindex 889357a5a..5667a2c13 100644--- a/app/pages/UserSettings/UserSettings.tsx+++ b/app/pages/UserSettings/UserSettings.tsx@@ -73,6 +73,7 @@ interface IProps {unlinkSSO: (t: (key: string) => string, callback: (e: any) => void, provider: string) => void,theme: string,updateShowLiveVisitorsInTitle: (show: boolean, callback: (isSuccess: boolean) => void) => void,+ logoutAll: () => void,}interface IForm extends Partial<IUser> {@@ -86,7 +87,7 @@ const UserSettings = ({setProjectsShareData, userSharedUpdate, sharedProjectError, updateUserData,genericError, onGDPRExportFailed, updateProfileFailed, updateUserProfileAsync,accountUpdated, setAPIKey, user, dontRemember, isPaidTierUsed, // setThemeType, themeType,- linkSSO, unlinkSSO, theme, updateShowLiveVisitorsInTitle,+ linkSSO, unlinkSSO, theme, updateShowLiveVisitorsInTitle, logoutAll,}: IProps): JSX.Element => {const navigate = useNavigate()const { t }: {@@ -391,49 +392,49 @@ const UserSettings = ({disabled={isSelfhosted}/>{!isSelfhosted && (- <>- <span- onClick={toggleShowPasswordFields}- className='flex items-center cursor-pointer max-w-max text-gray-900 dark:text-gray-50 hover:underline'- >- {t('auth.common.changePassword')}- <ChevronDownIcon- className={cx('w-4 h-4 ml-2', {- 'rotate-180': showPasswordFields,- })}- />- </span>- {showPasswordFields && (- <div className='grid grid-cols-1 gap-y-6 gap-x-4 sm:grid-cols-6 mt-4'>- <Input- name='password'- id='password'- type='password'- label={t('auth.common.password')}- hint={t('auth.common.hint', { amount: MIN_PASSWORD_CHARS })}- value={form.password}- placeholder={t('auth.common.password')}- className='sm:col-span-3'- onChange={handleInput}- error={beenSubmitted ? errors.password : null}- />- <Input- name='repeat'- id='repeat'- type='password'- label={t('auth.common.repeat')}- value={form.repeat}- placeholder={t('auth.common.repeat')}- className='sm:col-span-3'- onChange={handleInput}- error={beenSubmitted ? errors.repeat : null}- />- </div>- )}- <Button className='mt-4' type='submit' primary large>- {t('profileSettings.update')}- </Button>- </>+ <>+ <span+ onClick={toggleShowPasswordFields}+ className='flex items-center cursor-pointer max-w-max text-gray-900 dark:text-gray-50 hover:underline'+ >+ {t('auth.common.changePassword')}+ <ChevronDownIcon+ className={cx('w-4 h-4 ml-2', {+ 'rotate-180': showPasswordFields,+ })}+ />+ </span>+ {showPasswordFields && (+ <div className='grid grid-cols-1 gap-y-6 gap-x-4 sm:grid-cols-6 mt-4'>+ <Input+ name='password'+ id='password'+ type='password'+ label={t('auth.common.password')}+ hint={t('auth.common.hint', { amount: MIN_PASSWORD_CHARS })}+ value={form.password}+ placeholder={t('auth.common.password')}+ className='sm:col-span-3'+ onChange={handleInput}+ error={beenSubmitted ? errors.password : null}+ />+ <Input+ name='repeat'+ id='repeat'+ type='password'+ label={t('auth.common.repeat')}+ value={form.repeat}+ placeholder={t('auth.common.repeat')}+ className='sm:col-span-3'+ onChange={handleInput}+ error={beenSubmitted ? errors.repeat : null}+ />+ </div>+ )}+ <Button className='mt-4' type='submit' primary large>+ {t('profileSettings.update')}+ </Button>+ </>)}{/* Theme type switch */}{/* <hr className='mt-5 border-gray-200 dark:border-gray-600' />@@ -488,30 +489,30 @@ const UserSettings = ({</Button>{!isSelfhosted && (- <>- {/* Email reports frequency selector (e.g. monthly, weekly, etc.) */}- <hr className='mt-5 border-gray-200 dark:border-gray-600' />- <h3 className='mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>- {t('profileSettings.email')}- </h3>- <div className='grid grid-cols-1 gap-y-6 gap-x-4 lg:grid-cols-2 mt-4'>- <div>- <Select- title={t(`profileSettings.${reportFrequency}`)}- label={t('profileSettings.frequency')}- className='w-full'- items={translatedFrequencies}- iconExtractor={reportIconExtractor}- onSelect={(f) => _setReportFrequency(- reportFrequencies[_findIndex(translatedFrequencies, (freq) => freq === f)],- )}- />+ <>+ {/* Email reports frequency selector (e.g. monthly, weekly, etc.) */}+ <hr className='mt-5 border-gray-200 dark:border-gray-600' />+ <h3 className='mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>+ {t('profileSettings.email')}+ </h3>+ <div className='grid grid-cols-1 gap-y-6 gap-x-4 lg:grid-cols-2 mt-4'>+ <div>+ <Select+ title={t(`profileSettings.${reportFrequency}`)}+ label={t('profileSettings.frequency')}+ className='w-full'+ items={translatedFrequencies}+ iconExtractor={reportIconExtractor}+ onSelect={(f) => _setReportFrequency(+ reportFrequencies[_findIndex(translatedFrequencies, (freq) => freq === f)],+ )}+ />+ </div></div>- </div>- <Button className='mt-4' onClick={handleReportSave} primary large>- {t('common.save')}- </Button>- </>+ <Button className='mt-4' onClick={handleReportSave} primary large>+ {t('common.save')}+ </Button>+ </>)}{/* UI Settings */}@@ -530,191 +531,199 @@ const UserSettings = ({/>{!isSelfhosted && (- <>- <hr className='mt-5 border-gray-200 dark:border-gray-600' />- {/* Integrations setup */}- <h3 id='integrations' className='flex items-center mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>- {t('profileSettings.integrations')}- </h3>- <Integrations- user={user}- updateUserData={updateUserData}- handleIntegrationSave={handleIntegrationSave}- genericError={genericError}- />- <hr className='mt-5 border-gray-200 dark:border-gray-600' />-- {/* API access setup */}- <h3 className='flex items-center mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>- {t('profileSettings.apiKey')}- <div className='ml-5'>- <Beta />- </div>- </h3>- {user.apiKey ? (- <>- <p className='max-w-prose text-base text-gray-900 dark:text-gray-50'>- {t('profileSettings.apiKeyWarning')}- </p>- <p className='mt-4 max-w-prose text-base text-gray-900 dark:text-gray-50'>- {t('profileSettings.apiKey')}- </p>- <div className='grid grid-cols-1 gap-y-6 gap-x-4 lg:grid-cols-2'>- <div className='relative group'>- <Input- name='apiKey'- id='apiKey'- type='text'- className='pr-9'- value={user.apiKey}- onChange={handleInput}- disabled- />- <div className='absolute right-2 top-3'>- <div className='group relative'>- <Button- type='button'- onClick={() => setToClipboard(user.apiKey || '')}- className='opacity-70 hover:opacity-100'- noBorder- >- <>- <ClipboardDocumentIcon className='w-6 h-6' />- {copied && (- <div className='animate-appear bg-white dark:bg-slate-800 cursor-auto rounded p-1 absolute sm:top-0 top-0.5 right-8 text-xs text-green-600'>- {t('common.copied')}- </div>- )}- </>- </Button>+ <>+ <hr className='mt-5 border-gray-200 dark:border-gray-600' />+ {/* Integrations setup */}+ <h3 id='integrations' className='flex items-center mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>+ {t('profileSettings.integrations')}+ </h3>+ <Integrations+ user={user}+ updateUserData={updateUserData}+ handleIntegrationSave={handleIntegrationSave}+ genericError={genericError}+ />+ <hr className='mt-5 border-gray-200 dark:border-gray-600' />++ {/* API access setup */}+ <h3 className='flex items-center mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>+ {t('profileSettings.apiKey')}+ <div className='ml-5'>+ <Beta />+ </div>+ </h3>+ {user.apiKey ? (+ <>+ <p className='max-w-prose text-base text-gray-900 dark:text-gray-50'>+ {t('profileSettings.apiKeyWarning')}+ </p>+ <p className='mt-4 max-w-prose text-base text-gray-900 dark:text-gray-50'>+ {t('profileSettings.apiKey')}+ </p>+ <div className='grid grid-cols-1 gap-y-6 gap-x-4 lg:grid-cols-2'>+ <div className='relative group'>+ <Input+ name='apiKey'+ id='apiKey'+ type='text'+ className='pr-9'+ value={user.apiKey}+ onChange={handleInput}+ disabled+ />+ <div className='absolute right-2 top-3'>+ <div className='group relative'>+ <Button+ type='button'+ onClick={() => setToClipboard(user.apiKey || '')}+ className='opacity-70 hover:opacity-100'+ noBorder+ >+ <>+ <ClipboardDocumentIcon className='w-6 h-6' />+ {copied && (+ <div className='animate-appear bg-white dark:bg-slate-800 cursor-auto rounded p-1 absolute sm:top-0 top-0.5 right-8 text-xs text-green-600'>+ {t('common.copied')}+ </div>+ )}+ </>+ </Button>+ </div></div></div></div>- </div>- </>- ) : (- <p className='max-w-prose text-base text-gray-900 dark:text-gray-50'>- {t('profileSettings.noApiKey')}- </p>- )}- {user.apiKey ? (- <Button className='mt-4' onClick={() => setShowAPIDeleteModal(true)} danger large>- {t('profileSettings.deleteApiKeyBtn')}- </Button>- ) : (- <Button className='mt-4' onClick={onApiKeyGenerate} primary large>- {t('profileSettings.addApiKeyBtn')}- </Button>- )}+ </>+ ) : (+ <p className='max-w-prose text-base text-gray-900 dark:text-gray-50'>+ {t('profileSettings.noApiKey')}+ </p>+ )}+ {user.apiKey ? (+ <Button className='mt-4' onClick={() => setShowAPIDeleteModal(true)} danger large>+ {t('profileSettings.deleteApiKeyBtn')}+ </Button>+ ) : (+ <Button className='mt-4' onClick={onApiKeyGenerate} primary large>+ {t('profileSettings.addApiKeyBtn')}+ </Button>+ )}- {/* 2FA setting */}- <hr className='mt-5 border-gray-200 dark:border-gray-600' />- <h3 className='flex items-center mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>- {t('profileSettings.2fa')}- </h3>- <TwoFA- user={user}- dontRemember={dontRemember}- updateUserData={updateUserData}- genericError={genericError}- />-- {/* Socialisations setup */}- <hr className='mt-5 border-gray-200 dark:border-gray-600' />- <h3 id='socialisations' className='flex items-center mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>- {t('profileSettings.socialisations')}- </h3>- <Socialisations- user={user}- genericError={genericError}- linkSSO={linkSSO}- unlinkSSO={unlinkSSO}- theme={theme}- />-- {/* Shared projects setting */}- <hr className='mt-5 border-gray-200 dark:border-gray-600' />- <h3 className='flex items-center mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>- {t('profileSettings.shared')}- </h3>- <div>- {!_isEmpty(user.sharedProjects) ? (- <div className='mt-3 flex flex-col'>- <div className='-my-2 -mx-4 overflow-x-auto sm:-mx-6 lg:-mx-8'>- <div className='inline-block min-w-full py-2 align-middle md:px-6 lg:px-8'>- <div className='overflow-hidden shadow ring-1 ring-black ring-opacity-5 md:rounded-lg'>- <table className='min-w-full divide-y divide-gray-300 dark:divide-gray-600'>- <thead>- <tr className='dark:bg-slate-800'>- <th- scope='col'- className='py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6 dark:text-white'- >- {t('profileSettings.sharedTable.project')}- </th>- <th- scope='col'- className='px-3 py-3.5 text-left text-sm font-semibold text-gray-900 dark:text-white'- >- {t('profileSettings.sharedTable.role')}- </th>- <th- scope='col'- className='px-3 py-3.5 text-left text-sm font-semibold text-gray-900 dark:text-white'- >- {t('profileSettings.sharedTable.joinedOn')}- </th>- <th scope='col' className='relative py-3.5 pl-3 pr-4 sm:pr-6' />- </tr>- </thead>- <tbody className='divide-y divide-gray-300 dark:divide-gray-600'>- {_map(user.sharedProjects, (item) => (- <ProjectList- key={item.id}- item={item}- removeProject={removeProject}- removeShareProject={removeShareProject}- setUserShareData={setUserShareData}- setProjectsShareData={setProjectsShareData}- userSharedUpdate={userSharedUpdate}- sharedProjectError={sharedProjectError}- />- ))}- </tbody>- </table>+ {/* 2FA setting */}+ <hr className='mt-5 border-gray-200 dark:border-gray-600' />+ <h3 className='flex items-center mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>+ {t('profileSettings.2fa')}+ </h3>+ <TwoFA+ user={user}+ dontRemember={dontRemember}+ updateUserData={updateUserData}+ genericError={genericError}+ />++ {/* Socialisations setup */}+ <hr className='mt-5 border-gray-200 dark:border-gray-600' />+ <h3 id='socialisations' className='flex items-center mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>+ {t('profileSettings.socialisations')}+ </h3>+ <Socialisations+ user={user}+ genericError={genericError}+ linkSSO={linkSSO}+ unlinkSSO={unlinkSSO}+ theme={theme}+ />++ {/* Shared projects setting */}+ <hr className='mt-5 border-gray-200 dark:border-gray-600' />+ <h3 className='flex items-center mt-2 text-lg font-bold text-gray-900 dark:text-gray-50'>+ {t('profileSettings.shared')}+ </h3>+ <div>+ {!_isEmpty(user.sharedProjects) ? (+ <div className='mt-3 flex flex-col'>+ <div className='-my-2 -mx-4 overflow-x-auto sm:-mx-6 lg:-mx-8'>+ <div className='inline-block min-w-full py-2 align-middle md:px-6 lg:px-8'>+ <div className='overflow-hidden shadow ring-1 ring-black ring-opacity-5 md:rounded-lg'>+ <table className='min-w-full divide-y divide-gray-300 dark:divide-gray-600'>+ <thead>+ <tr className='dark:bg-slate-800'>+ <th+ scope='col'+ className='py-3.5 pl-4 pr-3 text-left text-sm font-semibold text-gray-900 sm:pl-6 dark:text-white'+ >+ {t('profileSettings.sharedTable.project')}+ </th>+ <th+ scope='col'+ className='px-3 py-3.5 text-left text-sm font-semibold text-gray-900 dark:text-white'+ >+ {t('profileSettings.sharedTable.role')}+ </th>+ <th+ scope='col'+ className='px-3 py-3.5 text-left text-sm font-semibold text-gray-900 dark:text-white'+ >+ {t('profileSettings.sharedTable.joinedOn')}+ </th>+ <th scope='col' className='relative py-3.5 pl-3 pr-4 sm:pr-6' />+ </tr>+ </thead>+ <tbody className='divide-y divide-gray-300 dark:divide-gray-600'>+ {_map(user.sharedProjects, (item) => (+ <ProjectList+ key={item.id}+ item={item}+ removeProject={removeProject}+ removeShareProject={removeShareProject}+ setUserShareData={setUserShareData}+ setProjectsShareData={setProjectsShareData}+ userSharedUpdate={userSharedUpdate}+ sharedProjectError={sharedProjectError}+ />+ ))}+ </tbody>+ </table>+ </div></div></div></div>+ ) : (+ <NoSharedProjects t={t} />+ )}+ </div>+ <hr className='mt-5 border-gray-200 dark:border-gray-600' />+ {!user.isActive && (+ <div+ className='flex cursor-pointer mt-4 pl-0 underline text-blue-600 hover:text-indigo-800 dark:hover:text-indigo-600'+ onClick={() => onEmailConfirm(setError)}+ >+ <EnvelopeIcon className='mt-0.5 mr-2 w-6 h-6 text-blue-500' />+ {t('profileSettings.noLink')}</div>- ) : (- <NoSharedProjects t={t} />)}- </div>- <hr className='mt-5 border-gray-200 dark:border-gray-600' />- {!user.isActive && (- <div- className='flex cursor-pointer mt-4 pl-0 underline text-blue-600 hover:text-indigo-800 dark:hover:text-indigo-600'- onClick={() => onEmailConfirm(setError)}- >- <EnvelopeIcon className='mt-0.5 mr-2 w-6 h-6 text-blue-500' />- {t('profileSettings.noLink')}- </div>- )}- <div className='flex justify-between mt-4'>- <Button onClick={() => setShowExportModal(true)} semiSmall primary>- <>- <ArrowDownTrayIcon className='w-5 h-5 mr-1' />- {t('profileSettings.requestExport')}- </>- </Button>- <Button className='ml-3' onClick={() => setShowModal(true)} semiSmall danger>- <>- <ExclamationTriangleIcon className='w-5 h-5 mr-1' />- {t('profileSettings.delete')}- </>- </Button>- </div>- </>+ <div className='flex justify-between mt-4'>+ <Button onClick={() => setShowExportModal(true)} semiSmall primary>+ <>+ <ArrowDownTrayIcon className='w-5 h-5 mr-1' />+ {t('profileSettings.requestExport')}+ </>+ </Button>+ <div>+ <Button className='ml-3' onClick={() => logoutAll()} semiSmall danger>+ <>+ <ExclamationTriangleIcon className='w-5 h-5 mr-1' />+ {t('profileSettings.logoutAll')}+ </>+ </Button>+ <Button className='ml-3' onClick={() => setShowModal(true)} semiSmall danger>+ <>+ <ExclamationTriangleIcon className='w-5 h-5 mr-1' />+ {t('profileSettings.delete')}+ </>+ </Button>+ </div>+ </div>+ </>)}</form>