Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Fixed components build. Renamed validations to permissions.

Mike Caoc916e4ff9cc0
diff --git a/esbuild.mjs b/esbuild.mjs
deleted file mode 100644
index ca090255d..000000000
--- a/esbuild.mjs
+++ /dev/null
@@ -1,36 +0,0 @@
-import esbuild from 'esbuild';
-import { commonjs } from '@hyrious/esbuild-plugin-commonjs';
-import fs from 'node:fs';
-
-fs.copyFileSync('./package.components.json', './dist/package.json');
-
-esbuild
- .build({
- entryPoints: ['src/index.client.ts'],
- outfile: 'dist/client/index.js',
- platform: 'browser',
- bundle: true,
- jsx: 'automatic',
- format: 'esm',
- plugins: [commonjs()],
- external: ['react', 'react-dom', 'react-jsx/runtime', '@swc/helpers'],
- })
- .catch(e => {
- // eslint-disable-next-line
- console.error(e);
- process.exit(1);
- });
-
-esbuild
- .build({
- entryPoints: ['src/index.server.ts'],
- outfile: 'dist/server/index.js',
- platform: 'node',
- bundle: true,
- format: 'esm',
- })
- .catch(e => {
- // eslint-disable-next-line
- console.error(e);
- process.exit(1);
- });
diff --git a/package.components.json b/package.components.json
index 29abe59a2..04eca82ee 100644
--- a/package.components.json
+++ b/package.components.json
@@ -1,23 +1,10 @@
{
"name": "@umami/components",
- "version": "0.103.0",
+ "version": "0.111.0",
"description": "Umami React components.",
"author": "Mike Cao <[email protected]>",
"license": "MIT",
"type": "module",
"main": "./index.js",
- "types": "./index.d.ts",
- "peerDependencies": {
- "@tanstack/react-query": "^4.33.0",
- "classnames": "^2.3.1",
- "colord": "^2.9.2",
- "date-fns-tz": "^1.1.4",
- "immer": "^9.0.12",
- "next": "^13.4.0",
- "next-basics": "^0.36.0",
- "react": "^18.2.0",
- "react-dom": "^18.2.0",
- "react-intl": "^5.24.7",
- "zustand": "^4.3.8"
- }
+ "types": "./index.d.ts"
}
diff --git a/package.json b/package.json
index 2dc733dd3..6661b38e1 100644
--- a/package.json
+++ b/package.json
@@ -23,7 +23,7 @@
"build-app": "next build",
"build-app-turbo": "next build --turbo",
"build-icons": "svgr ./src/assets --out-dir src/components/svg --typescript",
- "build-components": "npm-run-all types esbuild",
+ "build-components": "tsup",
"build-tracker": "rollup -c rollup.tracker.config.js",
"build-prisma-client": "node scripts/build-prisma-client.js",
"build-lang": "npm-run-all format-lang compile-lang download-country-names download-language-names clean-lang",
@@ -51,10 +51,7 @@
"postbuild": "node scripts/postbuild.js",
"test": "jest",
"cypress-open": "cypress open cypress run",
- "cypress-run": "cypress run cypress run",
- "rollup": "rollup -c rollup.components.config.js",
- "esbuild": "node esbuild.mjs",
- "types": "tsup"
+ "cypress-run": "cypress run cypress run"
},
"lint-staged": {
"**/*.{js,jsx,ts,tsx}": [
@@ -86,7 +83,7 @@
"@svgr/cli": "^8.1.0",
"@tanstack/react-query": "^5.85.5",
"@umami/react-zen": "^0.175.0",
- "@umami/redis-client": "^0.27.0",
+ "@umami/redis-client": "^0.29.0",
"bcryptjs": "^3.0.2",
"chalk": "^5.6.0",
"chart.js": "^4.5.0",
@@ -139,7 +136,6 @@
},
"devDependencies": {
"@formatjs/cli": "^4.2.29",
- "@hyrious/esbuild-plugin-commonjs": "^0.2.6",
"@netlify/plugin-nextjs": "^5.12.1",
"@rollup/plugin-alias": "^5.0.0",
"@rollup/plugin-commonjs": "^25.0.4",
@@ -155,12 +151,10 @@
"@types/react-window": "^1.8.8",
"@typescript-eslint/eslint-plugin": "^8.41.0",
"@typescript-eslint/parser": "^8.41.0",
- "@umami/esbuild-plugin-css-modules": "^0.4.0",
"@umami/prisma-client": "^0.19.0",
"babel-plugin-react-compiler": "19.1.0-rc.2",
"cross-env": "^10.0.0",
"cypress": "^13.6.6",
- "esbuild": "^0.25.8",
"eslint": "^8.33.0",
"eslint-config-next": "^14.2.32",
"eslint-config-prettier": "^10.1.8",
@@ -184,7 +178,6 @@
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-delete": "^3.0.1",
"rollup-plugin-dts": "^6.2.3",
- "rollup-plugin-esbuild": "^6.2.1",
"rollup-plugin-node-externals": "^8.1.0",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-postcss": "^4.0.2",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index c78d6868f..db820df35 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -48,8 +48,8 @@ importers:
specifier: ^0.175.0
'@umami/redis-client':
- specifier: ^0.27.0
- version: 0.27.0
+ specifier: ^0.29.0
+ version: 0.29.0
bcryptjs:
specifier: ^3.0.2
version: 3.0.2
@@ -201,9 +201,6 @@ importers:
'@formatjs/cli':
specifier: ^4.2.29
- '@hyrious/esbuild-plugin-commonjs':
- specifier: ^0.2.6
'@netlify/plugin-nextjs':
specifier: ^5.12.1
version: 5.12.1
@@ -249,9 +246,6 @@ importers:
'@typescript-eslint/parser':
specifier: ^8.41.0
- '@umami/esbuild-plugin-css-modules':
- specifier: ^0.4.0
- version: 0.4.0
'@umami/prisma-client':
specifier: ^0.19.0
@@ -264,9 +258,6 @@ importers:
cypress:
specifier: ^13.6.6
version: 13.17.0
- esbuild:
- specifier: ^0.25.8
- version: 0.25.9
eslint:
specifier: ^8.33.0
version: 8.57.1
@@ -336,9 +327,6 @@ importers:
rollup-plugin-dts:
specifier: ^6.2.3
- rollup-plugin-esbuild:
- specifier: ^6.2.1
rollup-plugin-node-externals:
specifier: ^8.1.0
version: 8.1.0([email protected])
@@ -1207,16 +1195,6 @@ packages:
resolution: {integrity: sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==}
deprecated: Use @eslint/object-schema instead
- '@hyrious/[email protected]':
- resolution: {integrity: sha512-LIPT8Y6EbNaHdV7lS9Ki6nnK0G1fP4bhzlMU1fgbOEJkR+yOA6FCORnPhjbQyeRTjG/ALPXdqCMRxTGwroL9CQ==}
- engines: {node: '>=14'}
- peerDependencies:
- cjs-module-lexer: '*'
- esbuild: '*'
- peerDependenciesMeta:
- cjs-module-lexer:
- optional: true
-
resolution: {integrity: sha512-ryFMfvxxpQRsgZJqBd4wsttYQbCxsJksrv9Lw/v798JcQ8+w84mBWuXwl+TT0WJ/WrYOLaYpwQXi3sA9nTIaIg==}
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
@@ -2879,9 +2857,6 @@ packages:
resolution: {integrity: sha512-+GeGMebMCy0elMNg67LRNoVnUFPIm37iu5CmHESVx56/9Jsfdpsvbv605DQ81Pi/x11IdKUsS5nzgTYbCQU9fg==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
- '@umami/[email protected]':
- resolution: {integrity: sha512-OcFbipBJZCmMnJ52/eHkZxpXGQT8Q5bAePgkhpxlreT4zP98grZ6iLzaIkDPFqURQwM/llDhPyNEFRzkSfVYFw==}
-
resolution: {integrity: sha512-Vnys7MMAPexxmxrC+0q68B/iYmM1LFaP9RjKjffHbLfgZJ3moklJ2ea91cr8+m0CA3+3mqN38WEJI/o/ohOxYQ==}
peerDependencies:
@@ -2892,8 +2867,8 @@ packages:
resolution: {integrity: sha512-iOUCZwmr09RnqIm01wnjcSTTJ5iJdXRmFlmja2Qf42di/SOOTSBJmu1fKiYESp4dLrXXcmMeDfDqtJli0PPSRw==}
- '@umami/[email protected]':
- resolution: {integrity: sha512-SbHTpxhgeZyTBUSp2zdZM+XUtpsaSL4Tad8QXIEhEtjWhvvfoornyT5kLuyYCVtzSAT4daALeGmOO1z6EE1KcA==}
+ '@umami/[email protected]':
+ resolution: {integrity: sha512-Jaqh++jskqDB7ny75pfC02OvKp1JTS4asGDsFrRL3qy8sxL3PAl9+/mybCJe4/6vWrXDJKqpgkSfUDJq2bFjyw==}
resolution: {integrity: sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==}
@@ -4006,9 +3981,6 @@ packages:
resolution: {integrity: sha512-uDn+FE1yrDzyC0pCo961B2IHbdM8y/ACZsKD4dG6WqrjV53BADjwa7D+1aom2rsNVfLyDgU/eigvlJGJ08OQ4w==}
engines: {node: '>= 0.4'}
- resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==}
-
resolution: {integrity: sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==}
engines: {node: '>= 0.4'}
@@ -6230,11 +6202,6 @@ packages:
peerDependencies:
postcss: ^8.0.0
- resolution: {integrity: sha512-zyo2sAkVvuZFFy0gc2+4O+xar5dYlaVy/ebO24KT0ftk/iJevSNyPyQellsBLlnccwh7f6V6Y4GvuKRYToNgpQ==}
- peerDependencies:
- postcss: ^8.0.0
-
resolution: {integrity: sha512-EwMkYchxiDiKUhlJGzWsD9b2zvq/r2SSubcRrgP+jujMXFzqvANLt16lJANC+5uZ6hjI7lpRmI6O8JIl+8l1KA==}
engines: {node: ^12 || ^14 || >=16}
@@ -6762,13 +6729,6 @@ packages:
rollup: ^3.29.4 || ^4
typescript: ^4.5 || ^5.0
- resolution: {integrity: sha512-jTNOMGoMRhs0JuueJrJqbW8tOwxumaWYq+V5i+PD+8ecSCVkuX27tGW7BXqDgoULQ55rO7IdNxPcnsWtshz3AA==}
- engines: {node: '>=14.18.0'}
- peerDependencies:
- esbuild: '>=0.18.0'
- rollup: ^1.20.0 || ^2.0.0 || ^3.0.0 || ^4.0.0
-
resolution: {integrity: sha512-0D3S0E0Dl1V3Q6Cywnc7wt88VAfOB9AC5QHwVdgvP1vByRHW2wnEXoK0x3VYZzJ/EmGsR5Uix5HUmMJNG+hz2Q==}
engines: {node: '>= 21 || ^20.6.0 || ^18.19.0'}
@@ -7491,10 +7451,6 @@ packages:
resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==}
engines: {node: '>= 10.0.0'}
- resolution: {integrity: sha512-gwXJnPRewT4rT7sBi/IvxKTjsms7jX7QIDLOClApuZwR49SXbrB1z2NLUZ+vDHyqCj/n58OzRRqaW+B8OZi8vg==}
- engines: {node: '>=18.12.0'}
-
resolution: {integrity: sha512-bSjt9pjaEBnNiGgc9rUiHGKv5l4/TGzDmYw3RhnkJGtLhbnnA/5qJj7x3dNDCRx/PJxu774LlH8lCOlB4hEfKg==}
@@ -8504,12 +8460,6 @@ snapshots:
'@humanwhocodes/[email protected]': {}
- dependencies:
- esbuild: 0.25.9
- optionalDependencies:
- cjs-module-lexer: 1.4.3
-
optionalDependencies:
'@img/sharp-libvips-darwin-arm64': 1.2.0
@@ -10680,11 +10630,6 @@ snapshots:
'@typescript-eslint/types': 8.41.0
eslint-visitor-keys: 4.2.1
- '@umami/[email protected]':
- dependencies:
- postcss: 8.5.6
- postcss-modules: 6.0.1([email protected])
-
dependencies:
'@prisma/adapter-pg': 6.15.0
@@ -10724,7 +10669,7 @@ snapshots:
- sass
- use-sync-external-store
- '@umami/[email protected]':
+ '@umami/[email protected]':
dependencies:
debug: 4.4.1([email protected])
redis: 4.7.1
@@ -11983,8 +11928,6 @@ snapshots:
iterator.prototype: 1.1.5
safe-array-concat: 1.1.3
-
dependencies:
es-errors: 1.3.0
@@ -14523,18 +14466,6 @@ snapshots:
postcss-modules-values: 4.0.0([email protected])
string-hash: 1.1.3
- dependencies:
- generic-names: 4.0.0
- icss-utils: 5.1.0([email protected])
- lodash.camelcase: 4.3.0
- postcss: 8.5.6
- postcss-modules-extract-imports: 3.1.0([email protected])
- postcss-modules-local-by-default: 4.2.0([email protected])
- postcss-modules-scope: 3.2.1([email protected])
- postcss-modules-values: 4.0.0([email protected])
- string-hash: 1.1.3
-
dependencies:
'@csstools/selector-specificity': 2.2.0([email protected])
@@ -15200,17 +15131,6 @@ snapshots:
optionalDependencies:
'@babel/code-frame': 7.27.1
- dependencies:
- debug: 4.4.1([email protected])
- es-module-lexer: 1.7.0
- esbuild: 0.25.9
- get-tsconfig: 4.10.1
- rollup: 4.49.0
- unplugin-utils: 0.2.5
- transitivePeerDependencies:
- - supports-color
-
dependencies:
rollup: 4.49.0
@@ -16069,11 +15989,6 @@ snapshots:
- dependencies:
- pathe: 2.0.3
- picomatch: 4.0.3
-
dependencies:
napi-postinstall: 0.3.3
diff --git a/rollup.components.config.js b/rollup.components.config.js
deleted file mode 100644
index 04f23955e..000000000
--- a/rollup.components.config.js
+++ /dev/null
@@ -1,77 +0,0 @@
-import path from 'path';
-import crypto from 'crypto';
-import resolve from '@rollup/plugin-node-resolve';
-import alias from '@rollup/plugin-alias';
-import json from '@rollup/plugin-json';
-import postcss from 'rollup-plugin-postcss';
-import copy from 'rollup-plugin-copy';
-import del from 'rollup-plugin-delete';
-import nodeExternals from 'rollup-plugin-node-externals';
-import esbuild from 'rollup-plugin-esbuild';
-
-const md5 = str => crypto.createHash('md5').update(str).digest('hex');
-
-const customResolver = resolve({
- extensions: ['.js', '.jsx', '.ts', '.tsx'],
-});
-
-const aliasConfig = {
- entries: [
- { find: /^@/, replacement: path.resolve('./src/') },
- { find: /^public/, replacement: path.resolve('./public') },
- ],
- customResolver,
-};
-
-const clientConfig = {
- input: 'src/index.client.ts',
- output: [
- {
- file: 'dist/client/index.js',
- format: 'es',
- sourcemap: true,
- },
- ],
- plugins: [
- del({ targets: 'dist/*', runOnce: true }),
- copy({ targets: [{ src: './package.components.json', dest: 'dist', rename: 'package.json' }] }),
- postcss({
- config: false,
- extract: 'styles.css',
- sourceMap: true,
- minimize: true,
- modules: {
- generateScopedName: function (name, filename, css) {
- const file = path.basename(filename, '.css').replace('.module', '');
- const hash = Buffer.from(md5(`${name}:${filename}:${css}`))
- .toString('base64')
- .substring(0, 5);
-
- return `${file}-${name}--${hash}`;
- },
- },
- }),
- alias(aliasConfig),
- nodeExternals(),
- json(),
- esbuild({
- target: 'es6',
- jsx: 'automatic',
- loaders: {
- '.js': 'jsx',
- },
- }),
- ],
-};
-
-const serverConfig = {
- input: 'src/index.server.ts',
- output: {
- file: 'dist/server/index.ts',
- format: 'es',
- },
- plugins: [alias(aliasConfig), nodeExternals(), json()],
- external: [/\.css/],
-};
-
-export default [clientConfig, serverConfig];
diff --git a/src/app/api/admin/teams/route.ts b/src/app/api/admin/teams/route.ts
index a47930b85..fa203a299 100644
--- a/src/app/api/admin/teams/route.ts
+++ b/src/app/api/admin/teams/route.ts
@@ -2,7 +2,7 @@ import { z } from 'zod';
import { parseRequest } from '@/lib/request';
import { json, unauthorized } from '@/lib/response';
import { pagingParams, searchParams } from '@/lib/schema';
-import { canViewAllTeams } from '@/validations';
+import { canViewAllTeams } from '@/permissions';
import { getTeams } from '@/queries/prisma/team';
export async function GET(request: Request) {
diff --git a/src/app/api/admin/users/route.ts b/src/app/api/admin/users/route.ts
index ec074e019..2e5226157 100644
--- a/src/app/api/admin/users/route.ts
+++ b/src/app/api/admin/users/route.ts
@@ -2,7 +2,7 @@ import { z } from 'zod';
import { parseRequest } from '@/lib/request';
import { json, unauthorized } from '@/lib/response';
import { pagingParams, searchParams } from '@/lib/schema';
-import { canViewUsers } from '@/validations';
+import { canViewUsers } from '@/permissions';
import { getUsers } from '@/queries/prisma/user';
export async function GET(request: Request) {
diff --git a/src/app/api/admin/websites/route.ts b/src/app/api/admin/websites/route.ts
index fda98a47a..8d6d81bfc 100644
--- a/src/app/api/admin/websites/route.ts
+++ b/src/app/api/admin/websites/route.ts
@@ -2,7 +2,7 @@ import { z } from 'zod';
import { parseRequest } from '@/lib/request';
import { json, unauthorized } from '@/lib/response';
import { pagingParams, searchParams } from '@/lib/schema';
-import { canViewAllWebsites } from '@/validations';
+import { canViewAllWebsites } from '@/permissions';
import { getWebsites } from '@/queries/prisma/website';
import { ROLES } from '@/lib/constants';
diff --git a/src/app/api/links/[linkId]/route.ts b/src/app/api/links/[linkId]/route.ts
index 9647961c7..f0598b8b1 100644
--- a/src/app/api/links/[linkId]/route.ts
+++ b/src/app/api/links/[linkId]/route.ts
@@ -1,5 +1,5 @@
import { z } from 'zod';
-import { canUpdateLink, canDeleteLink, canViewLink } from '@/validations';
+import { canUpdateLink, canDeleteLink, canViewLink } from '@/permissions';
import { parseRequest } from '@/lib/request';
import { ok, json, unauthorized, serverError, badRequest } from '@/lib/response';
import { deleteLink, getLink, updateLink } from '@/queries';
diff --git a/src/app/api/links/route.ts b/src/app/api/links/route.ts
index 2ab561b6f..4f10a8fd6 100644
--- a/src/app/api/links/route.ts
+++ b/src/app/api/links/route.ts
@@ -1,5 +1,5 @@
import { z } from 'zod';
-import { canCreateTeamWebsite, canCreateWebsite } from '@/validations';
+import { canCreateTeamWebsite, canCreateWebsite } from '@/permissions';
import { json, unauthorized } from '@/lib/response';
import { uuid } from '@/lib/crypto';
import { getQueryFilters, parseRequest } from '@/lib/request';
diff --git a/src/app/api/pixels/[pixelId]/route.ts b/src/app/api/pixels/[pixelId]/route.ts
index 7a4bcfda6..0926372a6 100644
--- a/src/app/api/pixels/[pixelId]/route.ts
+++ b/src/app/api/pixels/[pixelId]/route.ts
@@ -1,5 +1,5 @@
import { z } from 'zod';
-import { canUpdatePixel, canDeletePixel, canViewPixel } from '@/validations';
+import { canUpdatePixel, canDeletePixel, canViewPixel } from '@/permissions';
import { parseRequest } from '@/lib/request';
import { ok, json, unauthorized, serverError, badRequest } from '@/lib/response';
import { deletePixel, getPixel, updatePixel } from '@/queries';
diff --git a/src/app/api/pixels/route.ts b/src/app/api/pixels/route.ts
index 07f05d6b6..038d3660b 100644
--- a/src/app/api/pixels/route.ts
+++ b/src/app/api/pixels/route.ts
@@ -1,5 +1,5 @@
import { z } from 'zod';
-import { canCreateTeamWebsite, canCreateWebsite } from '@/validations';
+import { canCreateTeamWebsite, canCreateWebsite } from '@/permissions';
import { json, unauthorized } from '@/lib/response';
import { uuid } from '@/lib/crypto';
import { getQueryFilters, parseRequest } from '@/lib/request';
diff --git a/src/app/api/realtime/[websiteId]/route.ts b/src/app/api/realtime/[websiteId]/route.ts
index baca763dc..635a1bf25 100644
--- a/src/app/api/realtime/[websiteId]/route.ts
+++ b/src/app/api/realtime/[websiteId]/route.ts
@@ -1,6 +1,6 @@
import { json, unauthorized } from '@/lib/response';
import { getRealtimeData } from '@/queries';
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { startOfMinute, subMinutes } from 'date-fns';
import { REALTIME_RANGE } from '@/lib/constants';
import { parseRequest, getQueryFilters } from '@/lib/request';
diff --git a/src/app/api/reports/[reportId]/route.ts b/src/app/api/reports/[reportId]/route.ts
index 1c93028cf..8f3e0c006 100644
--- a/src/app/api/reports/[reportId]/route.ts
+++ b/src/app/api/reports/[reportId]/route.ts
@@ -1,6 +1,6 @@
import { parseRequest } from '@/lib/request';
import { deleteReport, getReport, updateReport } from '@/queries';
-import { canDeleteReport, canUpdateReport, canViewReport } from '@/validations';
+import { canDeleteReport, canUpdateReport, canViewReport } from '@/permissions';
import { unauthorized, json, notFound, ok } from '@/lib/response';
import { reportSchema } from '@/lib/schema';
diff --git a/src/app/api/reports/attribution/route.ts b/src/app/api/reports/attribution/route.ts
index d80322458..4c5003773 100644
--- a/src/app/api/reports/attribution/route.ts
+++ b/src/app/api/reports/attribution/route.ts
@@ -1,4 +1,4 @@
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { getQueryFilters, parseRequest, setWebsiteDate } from '@/lib/request';
import { json, unauthorized } from '@/lib/response';
import { reportResultSchema } from '@/lib/schema';
diff --git a/src/app/api/reports/breakdown/route.ts b/src/app/api/reports/breakdown/route.ts
index 7db9f9234..128229ac9 100644
--- a/src/app/api/reports/breakdown/route.ts
+++ b/src/app/api/reports/breakdown/route.ts
@@ -1,4 +1,4 @@
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { unauthorized, json } from '@/lib/response';
import { getQueryFilters, parseRequest, setWebsiteDate } from '@/lib/request';
import { BreakdownParameters, getBreakdown } from '@/queries';
diff --git a/src/app/api/reports/funnel/route.ts b/src/app/api/reports/funnel/route.ts
index d3e386ccb..cef2752a8 100644
--- a/src/app/api/reports/funnel/route.ts
+++ b/src/app/api/reports/funnel/route.ts
@@ -1,4 +1,4 @@
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { unauthorized, json } from '@/lib/response';
import { parseRequest, getQueryFilters, setWebsiteDate } from '@/lib/request';
import { FunnelParameters, getFunnel } from '@/queries';
diff --git a/src/app/api/reports/goal/route.ts b/src/app/api/reports/goal/route.ts
index 47e5ba918..f9848fa7e 100644
--- a/src/app/api/reports/goal/route.ts
+++ b/src/app/api/reports/goal/route.ts
@@ -1,4 +1,4 @@
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { unauthorized, json } from '@/lib/response';
import { getQueryFilters, parseRequest, setWebsiteDate } from '@/lib/request';
import { getGoal, GoalParameters } from '@/queries/sql/reports/getGoal';
diff --git a/src/app/api/reports/journey/route.ts b/src/app/api/reports/journey/route.ts
index 37a470f4e..d512a1919 100644
--- a/src/app/api/reports/journey/route.ts
+++ b/src/app/api/reports/journey/route.ts
@@ -1,4 +1,4 @@
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { unauthorized, json } from '@/lib/response';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { getJourney } from '@/queries';
diff --git a/src/app/api/reports/retention/route.ts b/src/app/api/reports/retention/route.ts
index 7297d7441..f016c4fe5 100644
--- a/src/app/api/reports/retention/route.ts
+++ b/src/app/api/reports/retention/route.ts
@@ -1,4 +1,4 @@
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { unauthorized, json } from '@/lib/response';
import { parseRequest, getQueryFilters, setWebsiteDate } from '@/lib/request';
import { getRetention, RetentionParameters } from '@/queries';
diff --git a/src/app/api/reports/revenue/route.ts b/src/app/api/reports/revenue/route.ts
index 7e1137bc6..75930adcb 100644
--- a/src/app/api/reports/revenue/route.ts
+++ b/src/app/api/reports/revenue/route.ts
@@ -1,4 +1,4 @@
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { unauthorized, json } from '@/lib/response';
import { parseRequest, getQueryFilters, setWebsiteDate } from '@/lib/request';
import { reportResultSchema } from '@/lib/schema';
diff --git a/src/app/api/reports/route.ts b/src/app/api/reports/route.ts
index ce7ba50c0..8777f6455 100644
--- a/src/app/api/reports/route.ts
+++ b/src/app/api/reports/route.ts
@@ -2,7 +2,7 @@ import { z } from 'zod';
import { uuid } from '@/lib/crypto';
import { pagingParams, reportSchema } from '@/lib/schema';
import { parseRequest } from '@/lib/request';
-import { canViewWebsite, canUpdateWebsite } from '@/validations';
+import { canViewWebsite, canUpdateWebsite } from '@/permissions';
import { unauthorized, json } from '@/lib/response';
import { getReports, createReport } from '@/queries';
diff --git a/src/app/api/reports/utm/route.ts b/src/app/api/reports/utm/route.ts
index 73009c299..a46d3858c 100644
--- a/src/app/api/reports/utm/route.ts
+++ b/src/app/api/reports/utm/route.ts
@@ -1,4 +1,4 @@
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { unauthorized, json } from '@/lib/response';
import { getQueryFilters, parseRequest, setWebsiteDate } from '@/lib/request';
import { getUTM, UTMParameters } from '@/queries';
diff --git a/src/app/api/teams/[teamId]/links/route.ts b/src/app/api/teams/[teamId]/links/route.ts
index b3be8a5cc..115316a6c 100644
--- a/src/app/api/teams/[teamId]/links/route.ts
+++ b/src/app/api/teams/[teamId]/links/route.ts
@@ -1,6 +1,6 @@
import { z } from 'zod';
import { unauthorized, json } from '@/lib/response';
-import { canViewTeam } from '@/validations';
+import { canViewTeam } from '@/permissions';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { pagingParams, searchParams } from '@/lib/schema';
import { getTeamLinks } from '@/queries';
diff --git a/src/app/api/teams/[teamId]/pixels/route.ts b/src/app/api/teams/[teamId]/pixels/route.ts
index 41d9ce0fd..5a904adb7 100644
--- a/src/app/api/teams/[teamId]/pixels/route.ts
+++ b/src/app/api/teams/[teamId]/pixels/route.ts
@@ -1,6 +1,6 @@
import { z } from 'zod';
import { unauthorized, json } from '@/lib/response';
-import { canViewTeam } from '@/validations';
+import { canViewTeam } from '@/permissions';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { pagingParams, searchParams } from '@/lib/schema';
import { getTeamPixels } from '@/queries';
diff --git a/src/app/api/teams/[teamId]/route.ts b/src/app/api/teams/[teamId]/route.ts
index caa167e31..da5e4a016 100644
--- a/src/app/api/teams/[teamId]/route.ts
+++ b/src/app/api/teams/[teamId]/route.ts
@@ -1,6 +1,6 @@
import { z } from 'zod';
import { unauthorized, json, notFound, ok } from '@/lib/response';
-import { canDeleteTeam, canUpdateTeam, canViewTeam } from '@/validations';
+import { canDeleteTeam, canUpdateTeam, canViewTeam } from '@/permissions';
import { parseRequest } from '@/lib/request';
import { deleteTeam, getTeam, updateTeam } from '@/queries';
diff --git a/src/app/api/teams/[teamId]/users/[userId]/route.ts b/src/app/api/teams/[teamId]/users/[userId]/route.ts
index 62e0a32c7..71cf1bd80 100644
--- a/src/app/api/teams/[teamId]/users/[userId]/route.ts
+++ b/src/app/api/teams/[teamId]/users/[userId]/route.ts
@@ -1,4 +1,4 @@
-import { canDeleteTeamUser, canUpdateTeam } from '@/validations';
+import { canDeleteTeamUser, canUpdateTeam } from '@/permissions';
import { parseRequest } from '@/lib/request';
import { badRequest, json, ok, unauthorized } from '@/lib/response';
import { deleteTeamUser, getTeamUser, updateTeamUser } from '@/queries';
diff --git a/src/app/api/teams/[teamId]/users/route.ts b/src/app/api/teams/[teamId]/users/route.ts
index 93e41f603..2bd40e35d 100644
--- a/src/app/api/teams/[teamId]/users/route.ts
+++ b/src/app/api/teams/[teamId]/users/route.ts
@@ -1,6 +1,6 @@
import { z } from 'zod';
import { unauthorized, json, badRequest } from '@/lib/response';
-import { canAddUserToTeam, canViewTeam } from '@/validations';
+import { canAddUserToTeam, canViewTeam } from '@/permissions';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { pagingParams, teamRoleParam, searchParams } from '@/lib/schema';
import { createTeamUser, getTeamUser, getTeamUsers } from '@/queries';
diff --git a/src/app/api/teams/[teamId]/websites/route.ts b/src/app/api/teams/[teamId]/websites/route.ts
index 594416fa5..d9188f39d 100644
--- a/src/app/api/teams/[teamId]/websites/route.ts
+++ b/src/app/api/teams/[teamId]/websites/route.ts
@@ -1,6 +1,6 @@
import { z } from 'zod';
import { unauthorized, json } from '@/lib/response';
-import { canViewTeam } from '@/validations';
+import { canViewTeam } from '@/permissions';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { pagingParams, searchParams } from '@/lib/schema';
import { getTeamWebsites } from '@/queries';
diff --git a/src/app/api/teams/join/route.ts b/src/app/api/teams/join/route.ts
index b17a2c087..6f64d4db0 100644
--- a/src/app/api/teams/join/route.ts
+++ b/src/app/api/teams/join/route.ts
@@ -1,6 +1,6 @@
import { z } from 'zod';
import { unauthorized, json, badRequest, notFound } from '@/lib/response';
-import { canCreateTeam } from '@/validations';
+import { canCreateTeam } from '@/permissions';
import { parseRequest } from '@/lib/request';
import { ROLES } from '@/lib/constants';
import { createTeamUser, findTeam, getTeamUser } from '@/queries';
diff --git a/src/app/api/teams/route.ts b/src/app/api/teams/route.ts
index 5ea1064b6..024f39ef2 100644
--- a/src/app/api/teams/route.ts
+++ b/src/app/api/teams/route.ts
@@ -1,7 +1,7 @@
import { z } from 'zod';
import { getRandomChars } from '@/lib/generate';
import { unauthorized, json } from '@/lib/response';
-import { canCreateTeam } from '@/validations';
+import { canCreateTeam } from '@/permissions';
import { uuid } from '@/lib/crypto';
import { parseRequest } from '@/lib/request';
import { createTeam } from '@/queries';
diff --git a/src/app/api/users/[userId]/route.ts b/src/app/api/users/[userId]/route.ts
index 2a822e1d0..3fe7ecf42 100644
--- a/src/app/api/users/[userId]/route.ts
+++ b/src/app/api/users/[userId]/route.ts
@@ -1,5 +1,5 @@
import { z } from 'zod';
-import { canUpdateUser, canViewUser, canDeleteUser } from '@/validations';
+import { canUpdateUser, canViewUser, canDeleteUser } from '@/permissions';
import { getUser, getUserByUsername, updateUser, deleteUser } from '@/queries';
import { json, unauthorized, badRequest, ok } from '@/lib/response';
import { hashPassword } from '@/lib/auth';
diff --git a/src/app/api/users/route.ts b/src/app/api/users/route.ts
index 4b7f4d49b..3ebaeac19 100644
--- a/src/app/api/users/route.ts
+++ b/src/app/api/users/route.ts
@@ -1,6 +1,6 @@
import { z } from 'zod';
import { hashPassword } from '@/lib/auth';
-import { canCreateUser } from '@/validations';
+import { canCreateUser } from '@/permissions';
import { ROLES } from '@/lib/constants';
import { uuid } from '@/lib/crypto';
import { parseRequest } from '@/lib/request';
diff --git a/src/app/api/websites/[websiteId]/active/route.ts b/src/app/api/websites/[websiteId]/active/route.ts
index c30ce910e..08dc958f1 100644
--- a/src/app/api/websites/[websiteId]/active/route.ts
+++ b/src/app/api/websites/[websiteId]/active/route.ts
@@ -1,4 +1,4 @@
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { json, unauthorized } from '@/lib/response';
import { getActiveVisitors } from '@/queries';
import { parseRequest } from '@/lib/request';
diff --git a/src/app/api/websites/[websiteId]/daterange/route.ts b/src/app/api/websites/[websiteId]/daterange/route.ts
index 7c208308a..8b5f41d0a 100644
--- a/src/app/api/websites/[websiteId]/daterange/route.ts
+++ b/src/app/api/websites/[websiteId]/daterange/route.ts
@@ -1,4 +1,4 @@
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { getWebsiteDateRange } from '@/queries';
import { json, unauthorized } from '@/lib/response';
import { parseRequest } from '@/lib/request';
diff --git a/src/app/api/websites/[websiteId]/event-data/[eventId]/route.ts b/src/app/api/websites/[websiteId]/event-data/[eventId]/route.ts
index 01258bb4d..9135f70dc 100644
--- a/src/app/api/websites/[websiteId]/event-data/[eventId]/route.ts
+++ b/src/app/api/websites/[websiteId]/event-data/[eventId]/route.ts
@@ -1,6 +1,6 @@
import { parseRequest } from '@/lib/request';
import { unauthorized, json } from '@/lib/response';
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { getEventData } from '@/queries/sql/events/getEventData';
export async function GET(
diff --git a/src/app/api/websites/[websiteId]/event-data/events/route.ts b/src/app/api/websites/[websiteId]/event-data/events/route.ts
index 9511d0d10..b55d1d2e7 100644
--- a/src/app/api/websites/[websiteId]/event-data/events/route.ts
+++ b/src/app/api/websites/[websiteId]/event-data/events/route.ts
@@ -1,7 +1,7 @@
import { z } from 'zod';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { unauthorized, json } from '@/lib/response';
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { getEventDataEvents } from '@/queries/sql/events/getEventDataEvents';
export async function GET(
diff --git a/src/app/api/websites/[websiteId]/event-data/fields/route.ts b/src/app/api/websites/[websiteId]/event-data/fields/route.ts
index 371d8ec46..51458706c 100644
--- a/src/app/api/websites/[websiteId]/event-data/fields/route.ts
+++ b/src/app/api/websites/[websiteId]/event-data/fields/route.ts
@@ -1,7 +1,7 @@
import { z } from 'zod';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { unauthorized, json } from '@/lib/response';
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { getEventDataFields } from '@/queries';
export async function GET(
diff --git a/src/app/api/websites/[websiteId]/event-data/properties/route.ts b/src/app/api/websites/[websiteId]/event-data/properties/route.ts
index 001d5b61e..b20230b50 100644
--- a/src/app/api/websites/[websiteId]/event-data/properties/route.ts
+++ b/src/app/api/websites/[websiteId]/event-data/properties/route.ts
@@ -1,7 +1,7 @@
import { z } from 'zod';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { unauthorized, json } from '@/lib/response';
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { getEventDataProperties } from '@/queries';
export async function GET(
diff --git a/src/app/api/websites/[websiteId]/event-data/stats/route.ts b/src/app/api/websites/[websiteId]/event-data/stats/route.ts
index 5b7991539..6c173cc27 100644
--- a/src/app/api/websites/[websiteId]/event-data/stats/route.ts
+++ b/src/app/api/websites/[websiteId]/event-data/stats/route.ts
@@ -1,7 +1,7 @@
import { z } from 'zod';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { unauthorized, json } from '@/lib/response';
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { getEventDataStats } from '@/queries';
export async function GET(
diff --git a/src/app/api/websites/[websiteId]/event-data/values/route.ts b/src/app/api/websites/[websiteId]/event-data/values/route.ts
index 1d8438b76..e70ae198d 100644
--- a/src/app/api/websites/[websiteId]/event-data/values/route.ts
+++ b/src/app/api/websites/[websiteId]/event-data/values/route.ts
@@ -1,7 +1,7 @@
import { z } from 'zod';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { unauthorized, json } from '@/lib/response';
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { getEventDataValues } from '@/queries';
export async function GET(
diff --git a/src/app/api/websites/[websiteId]/events/route.ts b/src/app/api/websites/[websiteId]/events/route.ts
index b863fa9c0..2f6a7a343 100644
--- a/src/app/api/websites/[websiteId]/events/route.ts
+++ b/src/app/api/websites/[websiteId]/events/route.ts
@@ -1,7 +1,7 @@
import { z } from 'zod';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { unauthorized, json } from '@/lib/response';
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { dateRangeParams, pagingParams, filterParams, searchParams } from '@/lib/schema';
import { getWebsiteEvents } from '@/queries';
diff --git a/src/app/api/websites/[websiteId]/events/series/route.ts b/src/app/api/websites/[websiteId]/events/series/route.ts
index 542fe07b1..05ee5f19a 100644
--- a/src/app/api/websites/[websiteId]/events/series/route.ts
+++ b/src/app/api/websites/[websiteId]/events/series/route.ts
@@ -1,7 +1,7 @@
import { z } from 'zod';
import { parseRequest, getQueryFilters } from '@/lib/request';
import { unauthorized, json } from '@/lib/response';
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { filterParams, timezoneParam, unitParam } from '@/lib/schema';
import { getEventStats } from '@/queries';
diff --git a/src/app/api/websites/[websiteId]/export/route.ts b/src/app/api/websites/[websiteId]/export/route.ts
index 4247da7d6..8d4a09761 100644
--- a/src/app/api/websites/[websiteId]/export/route.ts
+++ b/src/app/api/websites/[websiteId]/export/route.ts
@@ -3,7 +3,7 @@ import JSZip from 'jszip';
import Papa from 'papaparse';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { unauthorized, json } from '@/lib/response';
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { pagingParams, dateRangeParams } from '@/lib/schema';
import { getEventMetrics, getPageviewMetrics, getSessionMetrics } from '@/queries';
diff --git a/src/app/api/websites/[websiteId]/metrics/expanded/route.ts b/src/app/api/websites/[websiteId]/metrics/expanded/route.ts
index e0b62ffd0..b60e70127 100644
--- a/src/app/api/websites/[websiteId]/metrics/expanded/route.ts
+++ b/src/app/api/websites/[websiteId]/metrics/expanded/route.ts
@@ -1,4 +1,4 @@
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { EVENT_COLUMNS, SESSION_COLUMNS } from '@/lib/constants';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { badRequest, json, unauthorized } from '@/lib/response';
diff --git a/src/app/api/websites/[websiteId]/metrics/route.ts b/src/app/api/websites/[websiteId]/metrics/route.ts
index ea76b4e84..840359d73 100644
--- a/src/app/api/websites/[websiteId]/metrics/route.ts
+++ b/src/app/api/websites/[websiteId]/metrics/route.ts
@@ -1,4 +1,4 @@
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { EVENT_COLUMNS, SESSION_COLUMNS } from '@/lib/constants';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { badRequest, json, unauthorized } from '@/lib/response';
diff --git a/src/app/api/websites/[websiteId]/pageviews/route.ts b/src/app/api/websites/[websiteId]/pageviews/route.ts
index bfcc8f071..54705f1a4 100644
--- a/src/app/api/websites/[websiteId]/pageviews/route.ts
+++ b/src/app/api/websites/[websiteId]/pageviews/route.ts
@@ -1,5 +1,5 @@
import { z } from 'zod';
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { dateRangeParams, filterParams } from '@/lib/schema';
import { getCompareDate } from '@/lib/date';
diff --git a/src/app/api/websites/[websiteId]/reports/route.ts b/src/app/api/websites/[websiteId]/reports/route.ts
index 60e9b2d9f..89c7f7353 100644
--- a/src/app/api/websites/[websiteId]/reports/route.ts
+++ b/src/app/api/websites/[websiteId]/reports/route.ts
@@ -1,5 +1,5 @@
import { z } from 'zod';
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { getReports } from '@/queries';
import { filterParams, pagingParams } from '@/lib/schema';
import { parseRequest } from '@/lib/request';
diff --git a/src/app/api/websites/[websiteId]/reset/route.ts b/src/app/api/websites/[websiteId]/reset/route.ts
index 36732205c..9dae72e50 100644
--- a/src/app/api/websites/[websiteId]/reset/route.ts
+++ b/src/app/api/websites/[websiteId]/reset/route.ts
@@ -1,4 +1,4 @@
-import { canUpdateWebsite } from '@/validations';
+import { canUpdateWebsite } from '@/permissions';
import { resetWebsite } from '@/queries';
import { unauthorized, ok } from '@/lib/response';
import { parseRequest } from '@/lib/request';
diff --git a/src/app/api/websites/[websiteId]/route.ts b/src/app/api/websites/[websiteId]/route.ts
index 466711ad2..66dc3d0bd 100644
--- a/src/app/api/websites/[websiteId]/route.ts
+++ b/src/app/api/websites/[websiteId]/route.ts
@@ -1,5 +1,5 @@
import { z } from 'zod';
-import { canUpdateWebsite, canDeleteWebsite, canViewWebsite } from '@/validations';
+import { canUpdateWebsite, canDeleteWebsite, canViewWebsite } from '@/permissions';
import { SHARE_ID_REGEX } from '@/lib/constants';
import { parseRequest } from '@/lib/request';
import { ok, json, unauthorized, serverError, badRequest } from '@/lib/response';
diff --git a/src/app/api/websites/[websiteId]/segments/[segmentId]/route.ts b/src/app/api/websites/[websiteId]/segments/[segmentId]/route.ts
index 588a4cac9..4418cfe57 100644
--- a/src/app/api/websites/[websiteId]/segments/[segmentId]/route.ts
+++ b/src/app/api/websites/[websiteId]/segments/[segmentId]/route.ts
@@ -1,4 +1,4 @@
-import { canDeleteWebsite, canUpdateWebsite, canViewWebsite } from '@/validations';
+import { canDeleteWebsite, canUpdateWebsite, canViewWebsite } from '@/permissions';
import { parseRequest } from '@/lib/request';
import { json, notFound, ok, unauthorized } from '@/lib/response';
import { segmentTypeParam } from '@/lib/schema';
diff --git a/src/app/api/websites/[websiteId]/segments/route.ts b/src/app/api/websites/[websiteId]/segments/route.ts
index 75d992896..fcc2e0a3c 100644
--- a/src/app/api/websites/[websiteId]/segments/route.ts
+++ b/src/app/api/websites/[websiteId]/segments/route.ts
@@ -1,4 +1,4 @@
-import { canUpdateWebsite, canViewWebsite } from '@/validations';
+import { canUpdateWebsite, canViewWebsite } from '@/permissions';
import { uuid } from '@/lib/crypto';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { json, unauthorized } from '@/lib/response';
diff --git a/src/app/api/websites/[websiteId]/session-data/properties/route.ts b/src/app/api/websites/[websiteId]/session-data/properties/route.ts
index 5c7e2c478..9abdcf818 100644
--- a/src/app/api/websites/[websiteId]/session-data/properties/route.ts
+++ b/src/app/api/websites/[websiteId]/session-data/properties/route.ts
@@ -1,7 +1,7 @@
import { z } from 'zod';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { unauthorized, json } from '@/lib/response';
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { getSessionDataProperties } from '@/queries';
export async function GET(
diff --git a/src/app/api/websites/[websiteId]/session-data/values/route.ts b/src/app/api/websites/[websiteId]/session-data/values/route.ts
index 27e952510..ab9abb0d9 100644
--- a/src/app/api/websites/[websiteId]/session-data/values/route.ts
+++ b/src/app/api/websites/[websiteId]/session-data/values/route.ts
@@ -1,4 +1,4 @@
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { json, unauthorized } from '@/lib/response';
import { getSessionDataValues } from '@/queries';
diff --git a/src/app/api/websites/[websiteId]/sessions/[sessionId]/activity/route.ts b/src/app/api/websites/[websiteId]/sessions/[sessionId]/activity/route.ts
index ca2261202..453ed002d 100644
--- a/src/app/api/websites/[websiteId]/sessions/[sessionId]/activity/route.ts
+++ b/src/app/api/websites/[websiteId]/sessions/[sessionId]/activity/route.ts
@@ -1,7 +1,7 @@
import { z } from 'zod';
import { parseRequest, getQueryFilters } from '@/lib/request';
import { unauthorized, json } from '@/lib/response';
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { getSessionActivity } from '@/queries';
export async function GET(
diff --git a/src/app/api/websites/[websiteId]/sessions/[sessionId]/properties/route.ts b/src/app/api/websites/[websiteId]/sessions/[sessionId]/properties/route.ts
index 216634626..9ccd1f85a 100644
--- a/src/app/api/websites/[websiteId]/sessions/[sessionId]/properties/route.ts
+++ b/src/app/api/websites/[websiteId]/sessions/[sessionId]/properties/route.ts
@@ -1,5 +1,5 @@
import { unauthorized, json } from '@/lib/response';
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { getSessionData } from '@/queries';
import { parseRequest } from '@/lib/request';
diff --git a/src/app/api/websites/[websiteId]/sessions/[sessionId]/route.ts b/src/app/api/websites/[websiteId]/sessions/[sessionId]/route.ts
index d110ebeb6..468597ad1 100644
--- a/src/app/api/websites/[websiteId]/sessions/[sessionId]/route.ts
+++ b/src/app/api/websites/[websiteId]/sessions/[sessionId]/route.ts
@@ -1,5 +1,5 @@
import { unauthorized, json } from '@/lib/response';
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { getWebsiteSession } from '@/queries';
import { parseRequest } from '@/lib/request';
diff --git a/src/app/api/websites/[websiteId]/sessions/route.ts b/src/app/api/websites/[websiteId]/sessions/route.ts
index 6a8c071ba..532506339 100644
--- a/src/app/api/websites/[websiteId]/sessions/route.ts
+++ b/src/app/api/websites/[websiteId]/sessions/route.ts
@@ -1,7 +1,7 @@
import { z } from 'zod';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { unauthorized, json } from '@/lib/response';
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { dateRangeParams, filterParams, pagingParams, searchParams } from '@/lib/schema';
import { getWebsiteSessions } from '@/queries';
diff --git a/src/app/api/websites/[websiteId]/sessions/stats/route.ts b/src/app/api/websites/[websiteId]/sessions/stats/route.ts
index 619a05ad1..af76aca24 100644
--- a/src/app/api/websites/[websiteId]/sessions/stats/route.ts
+++ b/src/app/api/websites/[websiteId]/sessions/stats/route.ts
@@ -1,7 +1,7 @@
import { z } from 'zod';
import { parseRequest, getQueryFilters } from '@/lib/request';
import { unauthorized, json } from '@/lib/response';
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { filterParams } from '@/lib/schema';
import { getWebsiteSessionStats } from '@/queries';
diff --git a/src/app/api/websites/[websiteId]/sessions/weekly/route.ts b/src/app/api/websites/[websiteId]/sessions/weekly/route.ts
index fa52e19c2..395b4555a 100644
--- a/src/app/api/websites/[websiteId]/sessions/weekly/route.ts
+++ b/src/app/api/websites/[websiteId]/sessions/weekly/route.ts
@@ -1,7 +1,7 @@
import { z } from 'zod';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { unauthorized, json } from '@/lib/response';
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { pagingParams, timezoneParam } from '@/lib/schema';
import { getWeeklyTraffic } from '@/queries';
diff --git a/src/app/api/websites/[websiteId]/stats/route.ts b/src/app/api/websites/[websiteId]/stats/route.ts
index 302346c21..f3b1a7081 100644
--- a/src/app/api/websites/[websiteId]/stats/route.ts
+++ b/src/app/api/websites/[websiteId]/stats/route.ts
@@ -1,7 +1,7 @@
import { z } from 'zod';
import { parseRequest, getQueryFilters } from '@/lib/request';
import { unauthorized, json } from '@/lib/response';
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { dateRangeParams, filterParams } from '@/lib/schema';
import { getWebsiteStats } from '@/queries';
import { getCompareDate } from '@/lib/date';
diff --git a/src/app/api/websites/[websiteId]/transfer/route.ts b/src/app/api/websites/[websiteId]/transfer/route.ts
index 2a2826ae5..1bb0a0f54 100644
--- a/src/app/api/websites/[websiteId]/transfer/route.ts
+++ b/src/app/api/websites/[websiteId]/transfer/route.ts
@@ -1,5 +1,5 @@
import { z } from 'zod';
-import { canTransferWebsiteToTeam, canTransferWebsiteToUser } from '@/validations';
+import { canTransferWebsiteToTeam, canTransferWebsiteToUser } from '@/permissions';
import { updateWebsite } from '@/queries';
import { parseRequest } from '@/lib/request';
import { badRequest, unauthorized, json } from '@/lib/response';
diff --git a/src/app/api/websites/[websiteId]/values/route.ts b/src/app/api/websites/[websiteId]/values/route.ts
index 80f965099..b6526d94f 100644
--- a/src/app/api/websites/[websiteId]/values/route.ts
+++ b/src/app/api/websites/[websiteId]/values/route.ts
@@ -1,4 +1,4 @@
-import { canViewWebsite } from '@/validations';
+import { canViewWebsite } from '@/permissions';
import { EVENT_COLUMNS, FILTER_COLUMNS, SEGMENT_TYPES, SESSION_COLUMNS } from '@/lib/constants';
import { getQueryFilters, parseRequest } from '@/lib/request';
import { badRequest, json, unauthorized } from '@/lib/response';
diff --git a/src/app/api/websites/route.ts b/src/app/api/websites/route.ts
index 963f85312..f9b18be86 100644
--- a/src/app/api/websites/route.ts
+++ b/src/app/api/websites/route.ts
@@ -1,5 +1,5 @@
import { z } from 'zod';
-import { canCreateTeamWebsite, canCreateWebsite } from '@/validations';
+import { canCreateTeamWebsite, canCreateWebsite } from '@/permissions';
import { json, unauthorized } from '@/lib/response';
import { uuid } from '@/lib/crypto';
import { parseRequest } from '@/lib/request';
diff --git a/src/components/common/FilterLink.module.css b/src/components/common/FilterLink.module.css
deleted file mode 100644
index 038986864..000000000
--- a/src/components/common/FilterLink.module.css
+++ /dev/null
@@ -1,38 +0,0 @@
-.row {
- display: flex;
- align-items: center;
- gap: 10px;
- width: 100%;
-}
-
-.row.inactive {
- color: var(--base500);
-}
-
-.row.inactive img {
- opacity: 0.35;
-}
-
-.row.active {
- color: var(--base900);
- font-weight: 600;
-}
-
-.row .link {
- display: none;
- margin-inline-start: 20px;
-}
-
-.row .label {
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
-}
-
-.row:hover .link {
- display: block;
-}
-
-.icon {
- cursor: pointer;
-}
diff --git a/src/components/common/HamburgerButton.module.css b/src/components/common/HamburgerButton.module.css
deleted file mode 100644
index 603985855..000000000
--- a/src/components/common/HamburgerButton.module.css
+++ /dev/null
@@ -1,9 +0,0 @@
-.button {
- display: none;
-}
-
-@media only screen and (max-width: 768px) {
- .button {
- display: flex;
- }
-}
diff --git a/src/components/common/PageBody.tsx b/src/components/common/PageBody.tsx
index 0733a10dc..7478280a4 100644
--- a/src/components/common/PageBody.tsx
+++ b/src/components/common/PageBody.tsx
@@ -3,8 +3,10 @@ import { ReactNode } from 'react';
import { AlertBanner, Loading, Column, ColumnProps } from '@umami/react-zen';
import { useMessages } from '@/components/hooks';
+const DEFAULT_WIDTH = '1320px';
+
export function PageBody({
- maxWidth = '1320px',
+ maxWidth = DEFAULT_WIDTH,
error,
isLoading,
children,
diff --git a/src/components/hooks/useApi.ts b/src/components/hooks/useApi.ts
index 5b6b54820..fd0e26c6c 100644
--- a/src/components/hooks/useApi.ts
+++ b/src/components/hooks/useApi.ts
@@ -10,7 +10,7 @@ const selector = (state: { shareToken: { token?: string } }) => state.shareToken
async function handleResponse(res: FetchResponse): Promise<any> {
if (res.error) {
const { message, code } = res?.error?.error || {};
- return Promise.reject(new Error(code || message || 'Unexpectd error.'));
+ return Promise.reject(new Error(code || message || 'Unexpected error.'));
}
return Promise.resolve(res.data);
}
diff --git a/src/index.server.ts b/src/index.server.ts
deleted file mode 100644
index 3b999f5e3..000000000
--- a/src/index.server.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-export * as auth from '@/lib/auth';
-export * as clickhouse from '@/lib/clickhouse';
-export * as client from '@/lib/client';
-export { ROLES } from '@/lib/constants';
-export * as fetch from '@/lib/fetch';
-export * as prisma from '@/lib/prisma';
-export * as redis from '@/lib/redis';
-export * as request from '@/lib/request';
-export * as response from '@/lib/response';
-export * as storage from '@/lib/storage';
-export * as url from '@/lib/url';
-export * as utils from '@/lib/utils';
diff --git a/src/index.client.ts b/src/index.ts
similarity index 84%
rename from src/index.client.ts
rename to src/index.ts
index ab8faa3a4..5ef1fe13b 100644
--- a/src/index.client.ts
+++ b/src/index.ts
@@ -40,15 +40,24 @@ export * from '@/app/(main)/websites/WebsitesTable';
export * from '@/app/(main)/websites/WebsiteProvider';
+export * from '@/components/common/ActionForm';
export * from '@/components/common/ConfirmationForm';
export * from '@/components/common/DataGrid';
+export * from '@/components/common/DateDisplay';
+export * from '@/components/common/DateDistance';
export * from '@/components/common/Empty';
+export * from '@/components/common/EmptyPlaceholder';
export * from '@/components/common/ErrorBoundary';
export * from '@/components/common/ErrorMessage';
+export * from '@/components/common/ExternalLink';
export * from '@/components/common/Favicon';
-export * from '@/components/common/FilterLink';
export * from '@/components/common/LinkButton';
+export * from '@/components/common/PageBody';
+export * from '@/components/common/PageHeader';
export * from '@/components/common/Pager';
+export * from '@/components/common/Panel';
+export * from '@/components/common/SectionHeader';
+export * from '@/components/common/SideMenu';
export * from '@/components/common/TypeConfirmationForm';
export * from '@/components/input/FilterButtons';
diff --git a/src/lib/redis.ts b/src/lib/redis.ts
index c440f5f1e..edde3d653 100644
--- a/src/lib/redis.ts
+++ b/src/lib/redis.ts
@@ -4,7 +4,7 @@ const REDIS = 'redis';
const enabled = !!process.env.REDIS_URL;
function getClient() {
- const redis = new UmamiRedisClient(process.env.REDIS_URL);
+ const redis = new UmamiRedisClient({ url: process.env.REDIS_URL });
if (process.env.NODE_ENV !== 'production') {
globalThis[REDIS] = redis;
diff --git a/src/validations/index.ts b/src/permissions/index.ts
similarity index 100%
rename from src/validations/index.ts
rename to src/permissions/index.ts
diff --git a/src/validations/link.ts b/src/permissions/link.ts
similarity index 100%
rename from src/validations/link.ts
rename to src/permissions/link.ts
diff --git a/src/validations/pixel.ts b/src/permissions/pixel.ts
similarity index 100%
rename from src/validations/pixel.ts
rename to src/permissions/pixel.ts
diff --git a/src/validations/report.ts b/src/permissions/report.ts
similarity index 100%
rename from src/validations/report.ts
rename to src/permissions/report.ts
diff --git a/src/validations/team.ts b/src/permissions/team.ts
similarity index 100%
rename from src/validations/team.ts
rename to src/permissions/team.ts
diff --git a/src/validations/user.ts b/src/permissions/user.ts
similarity index 100%
rename from src/validations/user.ts
rename to src/permissions/user.ts
diff --git a/src/validations/website.ts b/src/permissions/website.ts
similarity index 100%
rename from src/validations/website.ts
rename to src/permissions/website.ts
diff --git a/tsup.config.js b/tsup.config.js
new file mode 100644
index 000000000..73a5dfea3
--- /dev/null
+++ b/tsup.config.js
@@ -0,0 +1,15 @@
+import { defineConfig } from 'tsup';
+
+export default defineConfig({
+ entry: { index: 'src/index.ts' },
+ format: ['esm'],
+ outDir: 'dist',
+ dts: true,
+ splitting: false,
+ sourcemap: false,
+ clean: true,
+ external: ['react', 'react-dom', 'react/jsx-runtime', '@swc/helpers'],
+ esbuildOptions(options) {
+ options.jsx = 'automatic';
+ },
+});
diff --git a/tsup.config.ts b/tsup.config.ts
deleted file mode 100644
index 29ff733ce..000000000
--- a/tsup.config.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { defineConfig } from 'tsup';
-
-export default defineConfig([
- {
- entry: { index: 'src/index.client.ts' },
- format: ['esm'],
- outDir: 'dist/client',
- dts: true,
- splitting: false,
- sourcemap: false,
- clean: true,
- external: ['react', 'react-dom', 'react/jsx-runtime'],
- },
- {
- entry: { index: 'src/index.server.ts' },
- format: ['esm'],
- outDir: 'dist/server',
- dts: true,
- splitting: false,
- sourcemap: false,
- clean: true,
- },
-]);