From c5298d5d45fa1ae8fd5488cc539a4f505ff75b7b Mon Sep 17 00:00:00 2001 From: Chairil Fauzi Firmansyah Date: Thu, 4 Sep 2025 18:00:28 +0700 Subject: [PATCH 1/3] fix(hash): improve URL normalization and handling in tracking functions --- src/tracker/index.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/tracker/index.js b/src/tracker/index.js index 76d29a1dd..b05d90859 100644 --- a/src/tracker/index.js +++ b/src/tracker/index.js @@ -38,6 +38,18 @@ /* Helper functions */ + const normalize = raw => { + if (!raw) return raw; + try { + const u = new URL(raw, location.href); + if (excludeSearch) u.search = ''; + if (excludeHash) u.hash = ''; + return u.toString(); + } catch (e) { + return raw; + } + }; + const getPayload = () => ({ website, screen, @@ -61,11 +73,7 @@ if (!url) return; currentRef = currentUrl; - currentUrl = new URL(url, location.href); - - if (excludeSearch) currentUrl.search = ''; - if (excludeHash) currentUrl.hash = ''; - currentUrl = currentUrl.toString(); + currentUrl = normalize(new URL(url, location.href).toString()); if (currentUrl !== currentRef) { setTimeout(track, delayDuration); @@ -210,8 +218,9 @@ }; } - let currentUrl = href; - let currentRef = referrer.startsWith(origin) ? '' : referrer; + let currentUrl = normalize(href); + let currentRef = normalize(referrer.startsWith(origin) ? '' : referrer); + let initialized = false; let disabled = false; let cache; From 0ae5c28da71837067403a5aa3058dd39c235a895 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Wed, 17 Sep 2025 22:03:58 -0700 Subject: [PATCH 2/3] Export preference components. Updates for cloud. --- package.components.json | 2 +- src/app/(main)/websites/[websiteId]/WebsiteMenu.tsx | 2 +- .../(main)/websites/[websiteId]/settings/WebsiteData.tsx | 2 +- src/components/common/ActionForm.tsx | 8 ++++---- src/components/hooks/queries/useUserTeamsQuery.ts | 2 +- src/components/input/SettingsButton.tsx | 2 +- src/index.ts | 5 +++++ 7 files changed, 14 insertions(+), 9 deletions(-) diff --git a/package.components.json b/package.components.json index 8dda25887..ba951df99 100644 --- a/package.components.json +++ b/package.components.json @@ -1,6 +1,6 @@ { "name": "@umami/components", - "version": "0.123.0", + "version": "0.125.0", "description": "Umami React components.", "author": "Mike Cao ", "license": "MIT", diff --git a/src/app/(main)/websites/[websiteId]/WebsiteMenu.tsx b/src/app/(main)/websites/[websiteId]/WebsiteMenu.tsx index 6aa67df1b..03c72008b 100644 --- a/src/app/(main)/websites/[websiteId]/WebsiteMenu.tsx +++ b/src/app/(main)/websites/[websiteId]/WebsiteMenu.tsx @@ -25,7 +25,7 @@ export function WebsiteMenu({ websiteId }: { websiteId: string }) { if (id === 'compare') { router.push(updateParams({ compare: 'prev' })); } else if (id === 'edit') { - router.push(renderUrl(`/settings/websites/${websiteId}`)); + router.push(renderUrl(`/websites/${websiteId}`)); } }; diff --git a/src/app/(main)/websites/[websiteId]/settings/WebsiteData.tsx b/src/app/(main)/websites/[websiteId]/settings/WebsiteData.tsx index c9c42558b..1c1863859 100644 --- a/src/app/(main)/websites/[websiteId]/settings/WebsiteData.tsx +++ b/src/app/(main)/websites/[websiteId]/settings/WebsiteData.tsx @@ -39,7 +39,7 @@ export function WebsiteData({ websiteId, onSave }: { websiteId: string; onSave?: const handleSave = () => { touch('websites'); onSave?.(); - router.push(renderUrl(`/settings/websites`)); + router.push(renderUrl(`/websites`)); }; const handleReset = async () => { diff --git a/src/components/common/ActionForm.tsx b/src/components/common/ActionForm.tsx index 3d3d8dc6f..d97064757 100644 --- a/src/components/common/ActionForm.tsx +++ b/src/components/common/ActionForm.tsx @@ -2,12 +2,12 @@ import { Row, Column, Text } from '@umami/react-zen'; export function ActionForm({ label, description, children }) { return ( - - + + {label} - {description} + {description} - + {children} diff --git a/src/components/hooks/queries/useUserTeamsQuery.ts b/src/components/hooks/queries/useUserTeamsQuery.ts index 6e9971e40..82f65496b 100644 --- a/src/components/hooks/queries/useUserTeamsQuery.ts +++ b/src/components/hooks/queries/useUserTeamsQuery.ts @@ -8,7 +8,7 @@ export function useUserTeamsQuery(userId: string) { return useQuery({ queryKey: ['teams', { userId, modified }], queryFn: () => { - return get(`/users/${userId}/teams`, { userId }); + return get(`/users/${userId}/teams`); }, enabled: !!userId, }); diff --git a/src/components/input/SettingsButton.tsx b/src/components/input/SettingsButton.tsx index e717e1357..3536d1d54 100644 --- a/src/components/input/SettingsButton.tsx +++ b/src/components/input/SettingsButton.tsx @@ -24,7 +24,7 @@ export function SettingsButton() { const handleAction = (id: Key) => { if (id === 'settings') { if (cloudMode) { - window.location.href = `${cloudUrl}/dashboard`; + window.location.href = `${cloudUrl}/settings`; return; } } diff --git a/src/index.ts b/src/index.ts index ab6f0946c..5dd342a68 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,8 @@ +export * from '@/app/(main)/settings/preferences/LanguageSetting'; +export * from '@/app/(main)/settings/preferences/PreferenceSettings'; +export * from '@/app/(main)/settings/preferences/PreferencesPage'; +export * from '@/app/(main)/settings/preferences/ThemeSetting'; + export * from '@/app/(main)/teams/[teamId]/TeamMemberEditButton'; export * from '@/app/(main)/teams/[teamId]/TeamMemberEditForm'; export * from '@/app/(main)/teams/[teamId]/TeamMemberRemoveButton'; From 1c7f9da320470c00fb3524ec5e98b88a310c11a4 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Wed, 17 Sep 2025 22:41:54 -0700 Subject: [PATCH 3/3] Updated redirect config. --- next.config.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/next.config.ts b/next.config.ts index e229cb44a..40c94fa2b 100644 --- a/next.config.ts +++ b/next.config.ts @@ -117,22 +117,22 @@ const redirects = [ { source: '/settings', destination: '/settings/preferences', - permanent: true, + permanent: false, }, { source: '/teams/:id', destination: '/teams/:id/websites', - permanent: true, + permanent: false, }, { source: '/teams/:id/settings', destination: '/teams/:id/settings/preferences', - permanent: true, + permanent: false, }, { source: '/admin', destination: '/admin/users', - permanent: true, + permanent: false, }, ];