Skip to content

📈 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!

selfhosted prepare for release

Blue Moused681d0a53932
diff --git a/app/api/index.ts b/app/api/index.ts
index b1ae0438b..7dc72e35a 100644
--- a/app/api/index.ts
+++ b/app/api/index.ts
@@ -11,7 +11,7 @@ import { authActions } from 'redux/reducers/auth'
import sagaActions from 'redux/sagas/actions'
import { getAccessToken, removeAccessToken, setAccessToken } from 'utils/accessToken'
import { getRefreshToken, removeRefreshToken } from 'utils/refreshToken'
-import { DEFAULT_ALERTS_TAKE, isSelfhosted, isBrowser, API_URL } from 'redux/constants'
+import { DEFAULT_ALERTS_TAKE, API_URL } from 'redux/constants'
import { IUser } from 'redux/models/IUser'
import { IAuth } from 'redux/models/IAuth'
import { IProject, IOverall, IProjectNames } from 'redux/models/IProject'
@@ -21,16 +21,14 @@ import { ISubscribers } from 'redux/models/ISubscribers'
const debug = Debug('swetrix:api')
-const baseURL: string = isSelfhosted ? (isBrowser ? window.env.API_URL : null) : API_URL
-
const api = axios.create({
- baseURL,
+ baseURL: API_URL,
})
// Function that will be called to refresh authorization
const refreshAuthLogic = (failedRequest: { response: AxiosResponse }) =>
axios
- .post(`${baseURL}v1/auth/refresh-token`, null, {
+ .post(`${API_URL}v1/auth/refresh-token`, null, {
headers: {
Authorization: `Bearer ${getRefreshToken()}`,
},
@@ -78,7 +76,7 @@ export const authMe = () =>
export const logoutApi = (refreshToken: string | null) =>
axios
- .post(`${baseURL}v1/auth/logout`, null, {
+ .post(`${API_URL}v1/auth/logout`, null, {
headers: {
Authorization: `Bearer ${refreshToken}`,
},
@@ -95,7 +93,7 @@ export const logoutApi = (refreshToken: string | null) =>
export const logoutAllApi = () =>
api
- .post(`${baseURL}v1/auth/logout-all`)
+ .post(`${API_URL}v1/auth/logout-all`)
.then((response) => response.data)
.catch((error) => {
debug('%s', error)
diff --git a/app/components/Header/index.tsx b/app/components/Header/index.tsx
index 82f91bd8e..b389e5c57 100644
--- a/app/components/Header/index.tsx
+++ b/app/components/Header/index.tsx
@@ -226,18 +226,20 @@ const ProfileMenu = ({
)}
</Menu>
- <Menu.Item>
- {({ active }) => (
- <Link
- to={routesPath.changelog}
- className={cx('block px-4 py-2 text-sm text-gray-700 dark:text-gray-50', {
- 'bg-gray-100 dark:bg-slate-800': active,
- })}
- >
- {t('footer.changelog')}
- </Link>
- )}
- </Menu.Item>
+ {!isSelfhosted && (
+ <Menu.Item>
+ {({ active }) => (
+ <Link
+ to={routesPath.changelog}
+ className={cx('block px-4 py-2 text-sm text-gray-700 dark:text-gray-50', {
+ 'bg-gray-100 dark:bg-slate-800': active,
+ })}
+ >
+ {t('footer.changelog')}
+ </Link>
+ )}
+ </Menu.Item>
+ )}
<Menu.Item>
{({ active }) => (
<Link
@@ -368,12 +370,23 @@ const AuthedHeader = ({
{t('billing.inactive')}
</Link>
)}
- <Link
- to={routesPath.blog}
- className='font-semibold leading-6 text-base text-slate-800 hover:text-slate-700 dark:text-slate-200 dark:hover:text-white'
- >
- {t('footer.blog')}
- </Link>
+ {isSelfhosted ? (
+ <a
+ href={`https://swetrix.com${routesPath.blog}`}
+ target='_blank'
+ rel='noopener noreferrer'
+ className='font-semibold leading-6 text-base text-slate-800 hover:text-slate-700 dark:text-slate-200 dark:hover:text-white'
+ >
+ {t('footer.blog')}
+ </a>
+ ) : (
+ <Link
+ to={routesPath.blog}
+ className='font-semibold leading-6 text-base text-slate-800 hover:text-slate-700 dark:text-slate-200 dark:hover:text-white'
+ >
+ {t('footer.blog')}
+ </Link>
+ )}
<a
href={DOCS_URL}
className='font-semibold leading-6 text-base text-slate-800 hover:text-slate-700 dark:text-slate-200 dark:hover:text-white'
@@ -424,12 +437,23 @@ const AuthedHeader = ({
</div>
</div>
<div className='py-4 flex gap-4 flex-wrap justify-center space-x-2 lg:hidden'>
- <Link
- to={routesPath.blog}
- className='font-semibold leading-6 text-base text-slate-800 hover:text-slate-700 dark:text-slate-200 dark:hover:text-white'
- >
- {t('footer.blog')}
- </Link>
+ {isSelfhosted ? (
+ <a
+ href={`https://swetrix.com${routesPath.blog}`}
+ target='_blank'
+ rel='noopener noreferrer'
+ className='font-semibold leading-6 text-base text-slate-800 hover:text-slate-700 dark:text-slate-200 dark:hover:text-white'
+ >
+ {t('footer.blog')}
+ </a>
+ ) : (
+ <Link
+ to={routesPath.blog}
+ className='font-semibold leading-6 text-base text-slate-800 hover:text-slate-700 dark:text-slate-200 dark:hover:text-white'
+ >
+ {t('footer.blog')}
+ </Link>
+ )}
<a
href={DOCS_URL}
className='font-semibold leading-6 text-base text-slate-800 hover:text-slate-700 dark:text-slate-200 dark:hover:text-white'
@@ -501,12 +525,23 @@ const NotAuthedHeader = ({
{!refPage && (
<div className='hidden ml-10 space-x-1 lg:flex gap-4 items-center'>
- <Link
- to={routesPath.blog}
- className='font-semibold leading-6 text-base text-slate-800 hover:text-slate-700 dark:text-slate-200 dark:hover:text-white'
- >
- {t('footer.blog')}
- </Link>
+ {isSelfhosted ? (
+ <a
+ href={`https://swetrix.com${routesPath.blog}`}
+ target='_blank'
+ rel='noopener noreferrer'
+ className='font-semibold leading-6 text-base text-slate-800 hover:text-slate-700 dark:text-slate-200 dark:hover:text-white'
+ >
+ {t('footer.blog')}
+ </a>
+ ) : (
+ <Link
+ to={routesPath.blog}
+ className='font-semibold leading-6 text-base text-slate-800 hover:text-slate-700 dark:text-slate-200 dark:hover:text-white'
+ >
+ {t('footer.blog')}
+ </Link>
+ )}
{!isSelfhosted && (
<Link
to={`${routesPath.main}#pricing`}
@@ -596,12 +631,23 @@ const NotAuthedHeader = ({
</div>
{!refPage && (
<div className='py-4 flex gap-4 flex-wrap justify-center space-x-2 lg:hidden'>
- <Link
- to={routesPath.blog}
- className='flex items-center font-semibold leading-6 text-base text-slate-800 hover:text-slate-700 dark:text-slate-200 dark:hover:text-white'
- >
- {t('footer.blog')}
- </Link>
+ {isSelfhosted ? (
+ <a
+ href={`https://swetrix.com${routesPath.blog}`}
+ target='_blank'
+ rel='noopener noreferrer'
+ className='font-semibold leading-6 text-base text-slate-800 hover:text-slate-700 dark:text-slate-200 dark:hover:text-white'
+ >
+ {t('footer.blog')}
+ </a>
+ ) : (
+ <Link
+ to={routesPath.blog}
+ className='flex items-center font-semibold leading-6 text-base text-slate-800 hover:text-slate-700 dark:text-slate-200 dark:hover:text-white'
+ >
+ {t('footer.blog')}
+ </Link>
+ )}
<Link
to={`${routesPath.main}#pricing`}
className='flex items-center font-semibold leading-6 text-base text-slate-800 hover:text-slate-700 dark:text-slate-200 dark:hover:text-white'
diff --git a/app/modals/NewFunnel.tsx b/app/modals/NewFunnel.tsx
index 2b10bd7d2..b674509a1 100644
--- a/app/modals/NewFunnel.tsx
+++ b/app/modals/NewFunnel.tsx
@@ -75,7 +75,7 @@ const NewFunnel = ({
]
try {
- await Promise.all(promises)
+ await Promise.allSettled(promises)
} catch (reason) {
console.error('[ERROR] (NewFunnel -> getFiltersData):', reason)
}
diff --git a/app/modals/TrackingSnippet.tsx b/app/modals/TrackingSnippet.tsx
index 1e28171de..012d4aab7 100644
--- a/app/modals/TrackingSnippet.tsx
+++ b/app/modals/TrackingSnippet.tsx
@@ -59,7 +59,7 @@ const TrackingSnippet = ({ onClose, isOpened, pid }: ITrackingSnippet): JSX.Elem
pdocs: (
<a
href={SCRIPT_DOCS_URL}
- className='font-medium text-indigo-400 hover:underline hover:text-indigo-500 dark:text-indigo-400 dark:hover:text-indigo-500'
+ className='font-medium text-indigo-600 hover:underline dark:text-indigo-400'
target='_blank'
rel='noreferrer noopener'
/>
diff --git a/app/pages/Auth/CreateNewPassword/CreateNewPassword.tsx b/app/pages/Auth/CreateNewPassword/CreateNewPassword.tsx
index bbb2945cf..f1754c8f4 100644
--- a/app/pages/Auth/CreateNewPassword/CreateNewPassword.tsx
+++ b/app/pages/Auth/CreateNewPassword/CreateNewPassword.tsx
@@ -109,7 +109,7 @@ const CreateNewPassword = ({
return (
<div>
- <div className='min-h-[40rem] bg-gray-50 dark:bg-slate-900 flex flex-col py-6 px-4 sm:px-6 lg:px-8'>
+ <div className='min-h-min-footer bg-gray-50 dark:bg-slate-900 flex flex-col py-6 px-4 sm:px-6 lg:px-8'>
<div className='sm:mx-auto sm:w-full sm:max-w-md'>
<h2 className='text-center text-2xl font-bold leading-9 tracking-tight text-gray-900 dark:text-gray-50'>
{t('auth.recovery.title')}
diff --git a/app/pages/Auth/ForgotPassword/ForgotPassword.tsx b/app/pages/Auth/ForgotPassword/ForgotPassword.tsx
index c296d8e51..95def33b4 100644
--- a/app/pages/Auth/ForgotPassword/ForgotPassword.tsx
+++ b/app/pages/Auth/ForgotPassword/ForgotPassword.tsx
@@ -94,7 +94,7 @@ const ForgotPassword = ({
return (
<div>
- <div className='min-h-[40rem] bg-gray-50 dark:bg-slate-900 flex flex-col py-6 px-4 sm:px-6 lg:px-8'>
+ <div className='min-h-min-footer bg-gray-50 dark:bg-slate-900 flex flex-col py-6 px-4 sm:px-6 lg:px-8'>
<div className='sm:mx-auto sm:w-full sm:max-w-md'>
<h2 className='text-center text-2xl font-bold leading-9 tracking-tight text-gray-900 dark:text-gray-50'>
{t('titles.recovery')}
diff --git a/app/pages/Auth/Signin/Signin.tsx b/app/pages/Auth/Signin/Signin.tsx
index b588882e1..08db0347d 100644
--- a/app/pages/Auth/Signin/Signin.tsx
+++ b/app/pages/Auth/Signin/Signin.tsx
@@ -204,7 +204,7 @@ const Signin = ({ login, loginSuccess, loginFailed, authSSO, ssrTheme }: ISignin
}
return (
- <div className='bg-gray-50 dark:bg-slate-900 flex flex-col py-6 px-4 sm:px-6 lg:px-8'>
+ <div className='min-h-min-footer bg-gray-50 dark:bg-slate-900 flex flex-col py-6 px-4 sm:px-6 lg:px-8'>
<div className='sm:mx-auto sm:w-full sm:max-w-md'>
<h2 className='text-center text-2xl font-bold leading-9 tracking-tight text-gray-900 dark:text-gray-50'>
{t('auth.signin.title')}
@@ -242,14 +242,16 @@ const Signin = ({ login, loginSuccess, loginFailed, authSSO, ssrTheme }: ISignin
id='dontRemember'
label={t('auth.common.noRemember')}
/>
- <div className='text-sm leading-6'>
- <Link
- to={routes.reset_password}
- className='font-semibold text-indigo-600 hover:text-indigo-500 dark:text-indigo-400 dark:hover:text-indigo-500'
- >
- {t('auth.signin.forgot')}
- </Link>
- </div>
+ {!isSelfhosted && (
+ <div className='text-sm leading-6'>
+ <Link
+ to={routes.reset_password}
+ className='font-semibold text-indigo-600 hover:text-indigo-500 dark:text-indigo-400 dark:hover:text-indigo-500'
+ >
+ {t('auth.signin.forgot')}
+ </Link>
+ </div>
+ )}
</div>
<Button className='w-full justify-center' type='submit' loading={isLoading} primary giant>
@@ -288,26 +290,28 @@ const Signin = ({ login, loginSuccess, loginFailed, authSSO, ssrTheme }: ISignin
)}
</div>
- <p className='mt-10 mb-4 text-center text-sm text-gray-500 dark:text-gray-200'>
- <Trans
- // @ts-ignore
- t={t}
- i18nKey='auth.signin.notAMember'
- components={{
- // eslint-disable-next-line jsx-a11y/anchor-has-content
- url: (
- <Link
- to={routes.signup}
- className='font-semibold leading-6 text-indigo-600 hover:text-indigo-500 dark:text-indigo-400 dark:hover:text-indigo-500'
- aria-label={t('titles.signup')}
- />
- ),
- }}
- values={{
- amount: TRIAL_DAYS,
- }}
- />
- </p>
+ {!isSelfhosted && (
+ <p className='mt-10 mb-4 text-center text-sm text-gray-500 dark:text-gray-200'>
+ <Trans
+ // @ts-ignore
+ t={t}
+ i18nKey='auth.signin.notAMember'
+ components={{
+ // eslint-disable-next-line jsx-a11y/anchor-has-content
+ url: (
+ <Link
+ to={routes.signup}
+ className='font-semibold leading-6 text-indigo-600 hover:text-indigo-500 dark:text-indigo-400 dark:hover:text-indigo-500'
+ aria-label={t('titles.signup')}
+ />
+ ),
+ }}
+ values={{
+ amount: TRIAL_DAYS,
+ }}
+ />
+ </p>
+ )}
</div>
</div>
)
diff --git a/app/pages/Auth/Signup/Signup.tsx b/app/pages/Auth/Signup/Signup.tsx
index a56586be7..8ea73d060 100644
--- a/app/pages/Auth/Signup/Signup.tsx
+++ b/app/pages/Auth/Signup/Signup.tsx
@@ -159,7 +159,7 @@ const Signup = ({ signup, authSSO, ssrTheme, authenticated: reduxAuthenticated,
return (
<div>
- <div className='bg-gray-50 dark:bg-slate-900 flex flex-col py-6 px-4 sm:px-6 lg:px-8'>
+ <div className='min-h-min-footer bg-gray-50 dark:bg-slate-900 flex flex-col py-6 px-4 sm:px-6 lg:px-8'>
<div className='flex min-h-full flex-1 flex-col justify-center py-6 sm:px-6 lg:px-8'>
<div className='sm:mx-auto sm:w-full sm:max-w-md'>
<h2 className='text-center text-2xl font-bold leading-9 tracking-tight text-gray-900 dark:text-gray-50'>
diff --git a/app/pages/Dashboard/Dashboard.tsx b/app/pages/Dashboard/Dashboard.tsx
index bb9c63ff1..2a19ea03e 100644
--- a/app/pages/Dashboard/Dashboard.tsx
+++ b/app/pages/Dashboard/Dashboard.tsx
@@ -233,7 +233,7 @@ const ProjectCard = ({
))}
{isTransferring && <Badge colour='indigo' label={t('common.transferring')} />}
{isPublic && <Badge colour='green' label={t('dashboard.public')} />}
- {_isNumber(members) && (
+ {!isSelfhosted && _isNumber(members) && (
<Badge
colour='slate'
label={
@@ -297,6 +297,12 @@ interface INoProjects {
onClick: () => void
}
+interface IAddProject {
+ t: (key: string) => string
+ onClick: () => void
+ sitesCount: number
+}
+
const NoProjects = ({ t, onClick }: INoProjects): JSX.Element => (
<button
type='button'
@@ -310,10 +316,15 @@ const NoProjects = ({ t, onClick }: INoProjects): JSX.Element => (
</button>
)
-const AddProject = ({ t, onClick }: INoProjects): JSX.Element => (
+const AddProject = ({ t, onClick, sitesCount }: IAddProject): JSX.Element => (
<li
onClick={onClick}
- className='flex cursor-pointer justify-center items-center rounded-lg border-2 border-dashed h-auto min-h-[149.1px] lg:min-h-[auto] group border-gray-300 hover:border-gray-400'
+ className={cx(
+ 'flex cursor-pointer justify-center items-center rounded-lg border-2 border-dashed h-auto group border-gray-300 hover:border-gray-400 min-h-[153.1px]',
+ {
+ 'lg:min-h-[auto]': sitesCount % 3 !== 0,
+ },
+ )}
>
<div>
<FolderPlusIcon className='mx-auto h-12 w-12 text-gray-400 dark:text-gray-200 group-hover:text-gray-500 group-hover:dark:text-gray-400' />
@@ -705,7 +716,11 @@ const Dashboard = ({
/>
),
)}
- <AddProject t={t} onClick={onNewProject} />
+ <AddProject
+ sitesCount={_size(_filter(projects, ({ uiHidden }) => !uiHidden))}
+ t={t}
+ onClick={onNewProject}
+ />
</ul>
)}
</div>
@@ -741,7 +756,11 @@ const Dashboard = ({
/>
),
)}
- <AddProject t={t} onClick={onNewProject} />
+ <AddProject
+ sitesCount={_size(_filter(captchaProjects, ({ uiHidden }) => !uiHidden))}
+ t={t}
+ onClick={onNewProject}
+ />
</ul>
)}
</div>
diff --git a/app/pages/Project/Settings/ProjectSettings.tsx b/app/pages/Project/Settings/ProjectSettings.tsx
index 09ec281de..33d3aaa4e 100644
--- a/app/pages/Project/Settings/ProjectSettings.tsx
+++ b/app/pages/Project/Settings/ProjectSettings.tsx
@@ -316,6 +316,7 @@ const ProjectSettings = ({
name: '',
id,
public: false,
+ isPasswordProtected: false,
origins: null,
ipBlacklist: null,
})
@@ -531,11 +532,11 @@ const ProjectSettings = ({
})
}
- const onProtected = () => {
+ const onProtected = async () => {
setBeenSubmitted(true)
if (validated) {
- onSubmit({
+ await onSubmit({
...form,
isPasswordProtected: true,
})
@@ -544,6 +545,11 @@ const ProjectSettings = ({
setProjectProtectedPassword(form?.id || '', form?.password || '')
}
+ setForm((prev) => ({
+ ...prev,
+ isPasswordProtected: true,
+ }))
+
setShowProtected(false)
}
}
@@ -645,29 +651,27 @@ const ProjectSettings = ({
label={t('project.settings.public')}
hint={t('project.settings.publicHint')}
/>
- {!isSelfhosted && (
- <Checkbox
- checked={Boolean(form.isPasswordProtected)}
- onChange={() => {
- if (!form.public && form.isPasswordProtected) {
- setForm({
- ...form,
- isPasswordProtected: false,
- })
- return
- }
+ <Checkbox
+ checked={Boolean(form.isPasswordProtected)}
+ onChange={() => {
+ if (!form.public && form.isPasswordProtected) {
+ setForm({
+ ...form,
+ isPasswordProtected: false,
+ })
+ return
+ }
- if (!form.public) {
- setShowProtected(true)
- }
- }}
- name='isPasswordProtected'
- id='isPasswordProtected'
- className='mt-4'
- label={t('project.settings.protected')}
- hint={t('project.settings.protectedHint')}
- />
- )}
+ if (!form.public) {
+ setShowProtected(true)
+ }
+ }}
+ name='isPasswordProtected'
+ id='isPasswordProtected'
+ className='mt-4'
+ label={t('project.settings.protected')}
+ hint={t('project.settings.protectedHint')}
+ />
<div className='flex flex-wrap justify-center sm:justify-between gap-2 mt-8'>
<div className='flex flex-wrap items-center gap-2'>
<Button
@@ -768,7 +772,13 @@ const ProjectSettings = ({
isOpened={showReset}
/>
<Modal
- onClose={() => setShowProtected(false)}
+ onClose={() => {
+ setShowProtected(false)
+ setForm((prev) => ({
+ ...prev,
+ password: undefined,
+ }))
+ }}
onSubmit={onProtected}
submitText={t('common.save')}
closeText={t('common.cancel')}
diff --git a/app/pages/Project/View/ViewProject.tsx b/app/pages/Project/View/ViewProject.tsx
index ae6a5bae5..be3ca4b8d 100644
--- a/app/pages/Project/View/ViewProject.tsx
+++ b/app/pages/Project/View/ViewProject.tsx
@@ -72,7 +72,7 @@ import {
isSelfhosted,
tbPeriodPairsCompare,
PERIOD_PAIRS_COMPARE,
- filtersPeriodPairs,
+ FILTERS_PERIOD_PAIRS,
IS_ACTIVE_COMPARE,
PROJECTS_PROTECTED,
getProjectCacheCustomKeyPerf,
@@ -89,7 +89,8 @@ import {
ITBPeriodPairs,
ERROR_PANELS_ORDER,
ERRORS_FILTERS_PANELS_ORDER,
- errorPeriodPairs,
+ ERROR_PERIOD_PAIRS,
+ FUNNELS_PERIOD_PAIRS,
} from 'redux/constants'
import { IUser } from 'redux/models/IUser'
import {
@@ -672,17 +673,23 @@ const ViewProject = ({
const timeBucketSelectorItems = useMemo(() => {
if (activeTab === PROJECT_TABS.errors) {
return _filter(periodPairs, (el) => {
- return _includes(errorPeriodPairs, el.period)
+ return _includes(ERROR_PERIOD_PAIRS, el.period)
+ })
+ }
+
+ if (activeTab === PROJECT_TABS.funnels) {
+ return _filter(periodPairs, (el) => {
+ return _includes(FUNNELS_PERIOD_PAIRS, el.period)
})
}
if (isActiveCompare) {
return _filter(periodPairs, (el) => {
- return _includes(filtersPeriodPairs, el.period)
+ return _includes(FILTERS_PERIOD_PAIRS, el.period)
})
}
- if (_includes(filtersPeriodPairs, period)) {
+ if (_includes(FILTERS_PERIOD_PAIRS, period)) {
return periodPairs
}
@@ -892,6 +899,21 @@ const ViewProject = ({
label: t('dashboard.performance'),
icon: BoltIcon,
},
+ {
+ id: PROJECT_TABS.sessions,
+ label: t('dashboard.sessions'),
+ icon: UsersIcon,
+ },
+ {
+ id: PROJECT_TABS.errors,
+ label: t('dashboard.errors'),
+ icon: BugAntIcon,
+ },
+ {
+ id: PROJECT_TABS.funnels,
+ label: t('dashboard.funnels'),
+ icon: FunnelIcon,
+ },
]
const adminTabs = allowedToManage
@@ -910,21 +932,6 @@ const ViewProject = ({
const newTabs = [
...selfhostedOnly,
- {
- id: PROJECT_TABS.sessions,
- label: t('dashboard.sessions'),
- icon: UsersIcon,
- },
- {
- id: PROJECT_TABS.errors,
- label: t('dashboard.errors'),
- icon: BugAntIcon,
- },
- {
- id: PROJECT_TABS.funnels,
- label: t('dashboard.funnels'),
- icon: FunnelIcon,
- },
{
id: PROJECT_TABS.alerts,
label: t('dashboard.alerts'),
diff --git a/app/pages/UserSettings/UserSettings.tsx b/app/pages/UserSettings/UserSettings.tsx
index 87486c3ba..866df4830 100644
--- a/app/pages/UserSettings/UserSettings.tsx
+++ b/app/pages/UserSettings/UserSettings.tsx
@@ -43,7 +43,6 @@ import { withAuthentication, auth } from 'hoc/protected'
import Input from 'ui/Input'
import Button from 'ui/Button'
import Modal from 'ui/Modal'
-import Beta from 'ui/Beta'
import Select from 'ui/Select'
import Checkbox from 'ui/Checkbox'
import PaidFeature from 'modals/PaidFeature'
@@ -79,28 +78,45 @@ const TAB_MAPPING = {
COMMUNICATIONS: 'communications',
}
-const getTabs = (t: (key: string) => string) => [
- {
- id: TAB_MAPPING.ACCOUNT,
- label: t('profileSettings.account'),
- icon: UserIcon,
- },
- {
- id: TAB_MAPPING.COMMUNICATIONS,
- label: 'Communications',
- icon: ChatBubbleLeftEllipsisIcon,
- },
- {
- id: TAB_MAPPING.INTERFACE,
- label: 'Interface settings',
- icon: ComputerDesktopIcon,
- },
- {
- id: TAB_MAPPING.REFERRALS,
- label: t('profileSettings.referral.title'),
- icon: CursorArrowRaysIcon,
- },
-]
+const getTabs = (t: (key: string) => string) => {
+ if (isSelfhosted) {
+ return [
+ {
+ id: TAB_MAPPING.ACCOUNT,
+ label: t('profileSettings.account'),
+ icon: UserIcon,
+ },
+ {
+ id: TAB_MAPPING.INTERFACE,
+ label: 'Interface settings',
+ icon: ComputerDesktopIcon,
+ },
+ ]
+ }
+
+ return [
+ {
+ id: TAB_MAPPING.ACCOUNT,
+ label: t('profileSettings.account'),
+ icon: UserIcon,
+ },
+ {
+ id: TAB_MAPPING.COMMUNICATIONS,
+ label: 'Communications',
+ icon: ChatBubbleLeftEllipsisIcon,
+ },
+ {
+ id: TAB_MAPPING.INTERFACE,
+ label: 'Interface settings',
+ icon: ComputerDesktopIcon,
+ },
+ {
+ id: TAB_MAPPING.REFERRALS,
+ label: t('profileSettings.referral.title'),
+ icon: CursorArrowRaysIcon,
+ },
+ ]
+}
interface IProps {
onDelete: (t: (key: string) => string, deletionFeedback: string, callback: () => void) => void
@@ -845,9 +861,6 @@ const UserSettings = ({
{/* Timezone selector */}
<h3 className='mt-2 text-lg font-bold text-gray-900 dark:text-gray-50 flex items-center'>
{t('profileSettings.timezone')}
- <div className='ml-5'>
- <Beta />
- </div>
</h3>
<div className='grid grid-cols-1 gap-y-6 gap-x-4 lg:grid-cols-2 mt-4'>
<div>
diff --git a/app/redux/constants/index.ts b/app/redux/constants/index.ts
index c709a4805..9cb3ee176 100644
--- a/app/redux/constants/index.ts
+++ b/app/redux/constants/index.ts
@@ -195,11 +195,13 @@ export const captchaTbPeriodPairs = (
},
]
-export const filtersPeriodPairs = ['1h', '1d', '7d', '4w', '3M', '12M', 'custom', 'compare']
+export const FILTERS_PERIOD_PAIRS = ['1h', '1d', '7d', '4w', '3M', '12M', 'custom', 'compare']
// TODO: add 'custom' later after an issue with it is resolved
// currently if you select a date range - it will not display errors within the last day of the date range
-export const errorPeriodPairs = ['1h', '1d', '7d', '4w', '3M', '12M']
+export const ERROR_PERIOD_PAIRS = ['1h', '1d', '7d', '4w', '3M', '12M']
+
+export const FUNNELS_PERIOD_PAIRS = ['1h', '1d', '7d', '4w', '3M', '12M', 'custom']
export const tbPeriodPairsCompare = (
t: Function,
@@ -383,13 +385,14 @@ const isStaging = isBrowser ? window.REMIX_ENV?.STAGING : process.env.STAGING
const STAGING_API_URL = isBrowser ? window.REMIX_ENV?.API_STAGING_URL : process.env.API_STAGING_URL
const PRODUCTION_API_URL = isBrowser ? window.REMIX_ENV?.API_URL : process.env.API_URL
-export const API_URL = isStaging ? STAGING_API_URL : PRODUCTION_API_URL
+export const isSelfhosted = Boolean(isBrowser ? window.REMIX_ENV?.SELFHOSTED : process.env.SELFHOSTED)
+
+export const API_URL = isSelfhosted || !isStaging ? PRODUCTION_API_URL : STAGING_API_URL
export const AIAPI_URL = isBrowser ? window.REMIX_ENV?.AIAPI_URL : process.env.AIAPI_URL
export const CDN_URL = isBrowser ? window.REMIX_ENV?.CDN_URL : process.env.CDN_URL
export const NODE_ENV = isBrowser ? window.REMIX_ENV?.NODE_ENV : process.env.NODE_ENV
export const isDevelopment = !NODE_ENV || NODE_ENV === 'development'
-export const isSelfhosted = Boolean(isBrowser ? window.REMIX_ENV?.SELFHOSTED : process.env.SELFHOSTED)
export const getOgImageUrl = (title: string) => {
const apiUrl = _endsWith(API_URL, '/') ? API_URL.slice(0, -1) : API_URL
diff --git a/app/redux/sagas/ui/load_alerts.ts b/app/redux/sagas/ui/load_alerts.ts
index ff4146099..76bd137c8 100644
--- a/app/redux/sagas/ui/load_alerts.ts
+++ b/app/redux/sagas/ui/load_alerts.ts
@@ -10,6 +10,7 @@ const debug = Debug('swetrix:rx:s:load-extensions')
export default function* loadProjectAlerts({ payload: { take = DEFAULT_ALERTS_TAKE, skip = 0 } }) {
if (isSelfhosted) {
+ yield put(UIActions.setProjectAlertsLoading(false))
return
}
diff --git a/app/redux/sagas/ui/load_projects.ts b/app/redux/sagas/ui/load_projects.ts
index 1c4aa6244..111c961a7 100644
--- a/app/redux/sagas/ui/load_projects.ts
+++ b/app/redux/sagas/ui/load_projects.ts
@@ -6,7 +6,7 @@ import { getAccessToken } from 'utils/accessToken'
import UIActions from 'redux/reducers/ui'
-import { ENTRIES_PER_PAGE_DASHBOARD } from 'redux/constants'
+import { ENTRIES_PER_PAGE_DASHBOARD, isSelfhosted } from 'redux/constants'
import { IOverall } from 'redux/models/IProject'
const { getProjects, getOverallStats, getLiveVisitors, getOverallStatsCaptcha } = require('../../../api')
@@ -15,6 +15,11 @@ const debug = Debug('swetrix:rx:s:load-projects')
export default function* loadProjects({
payload: { take = ENTRIES_PER_PAGE_DASHBOARD, skip = 0, isCaptcha = false, search = '' },
}) {
+ if (isCaptcha && isSelfhosted) {
+ yield put(UIActions.setCaptchaLoading(false))
+ return
+ }
+
const token = getAccessToken()
if (!token) {
diff --git a/app/redux/sagas/ui/load_shared_projects.ts b/app/redux/sagas/ui/load_shared_projects.ts
index f16191497..990b2378e 100644
--- a/app/redux/sagas/ui/load_shared_projects.ts
+++ b/app/redux/sagas/ui/load_shared_projects.ts
@@ -13,6 +13,12 @@ const debug = Debug('swetrix:rx:s:load-projects')
export default function* loadSharedProjects({ payload: { take = ENTRIES_PER_PAGE_DASHBOARD, skip = 0, search = '' } }) {
if (isSelfhosted) {
+ yield put(
+ UIActions.setProjectsLoading({
+ isLoading: false,
+ shared: true,
+ }),
+ )
return
}
diff --git a/public/locales/en.json b/public/locales/en.json
index 95d71d056..e0646d0eb 100644
--- a/public/locales/en.json
+++ b/public/locales/en.json
@@ -762,9 +762,9 @@
"origins": "Allowed origins",
"originsHint": "A list of origins (domains) which are allowed to use script with your ProjectID, separated by commas.\nLeave it empty to allow all origins (default setting).\nExample: cornell.edu, app.example.com, *.gov.ua",
"enabled": "Project enabled",
- "public": "Dashboard is public",
+ "public": "Public dashboard",
"enabledHint": "Disabled projects will not count any newly incoming events or pageviews.\nYou will still be able to access the project's analytics in dashboard.",
- "publicHint": "By checking this, anyone on the internet (including Google) would be able to see this project's Dashboard.\nOnly project's administrator can edit the settings.",
+ "publicHint": "By checking this, anyone on the Internet (including Google) would be able to see this project's dashboard.\nOnly the project administrator can edit the settings.",
"createHint": "*you will be able to set up your project more thoroughly after you have created it",
"delete": "Delete project",
"reset": "Reset project",
@@ -817,8 +817,8 @@
"filtersPlaceholder": "Select filters",
"noFilters": "No filters selected or no data for the selected filter type"
},
- "protected": "Password protected Dashboard",
- "protectedHint": "You can make your Dashboard public & password protected. This way, only people who know the password will be able to access it.",
+ "protected": "Password protected",
+ "protectedHint": "You can protect your password. That way, people who know the password can access it through a shareable link.",
"password": "Dashboard password"
},
"captcha": {