Commit Graph

165 Commits

Author SHA1 Message Date
Usman Baig
3fc0dec9d9 fix: show branded icons for UA-inferred referrers instead of broken favicons
Plain name referrers like "Instagram" or "WhatsApp" (inferred from
User-Agent) were being passed to the favicon service as invalid
domains, returning a generic globe. Now skips favicon fetch for
any referrer without a dot, falling through to Phosphor icons.
2026-03-12 12:31:21 +01:00
Usman Baig
7bd922a012 feat: add shared link referrer icon and new social platform icons
Add branded icons for WhatsApp, Telegram, Snapchat, Pinterest, Threads.
Add link icon for new "Shared Link" referrer category. Update changelog.
2026-03-12 12:08:07 +01:00
Usman Baig
c2d5935394 security: send X-CSRF-Token on all state-changing API requests (F-01) 2026-03-11 21:54:24 +01:00
Usman Baig
205cdf314c perf: bound SWR cache, clean stale storage, cap annotations
Add LRU cache provider (200 entries) to prevent unbounded SWR memory
growth. Clean up stale PKCE localStorage keys on app init. Cap chart
annotations to 20 visible reference lines with overflow indicator.
2026-03-10 21:19:33 +01:00
Usman Baig
bcaa5c25f8 perf: replace real-time polling with SSE streaming
Replace 5-second setInterval polling with EventSource connection to the
new /realtime/stream SSE endpoint. The server pushes visitor updates
instead of each client independently polling. Auto-reconnects on
connection drops.
2026-03-10 18:33:17 +01:00
Usman Baig
d863004d5f perf: consolidate 7 dashboard hooks into single batch request
Replace useDashboardOverview, useDashboardPages, useDashboardLocations,
useDashboardDevices, useDashboardReferrers, useDashboardPerformance, and
useDashboardGoals with a single useDashboard hook that calls the existing
/dashboard batch endpoint. This endpoint runs all queries in parallel on
the backend and caches the result in Redis (30s TTL).

Reduces dashboard requests from 12 to 6 per refresh cycle (50% reduction).
At 1,000 concurrent users: ~6,000 req/min instead of 12,000.
2026-03-10 17:55:29 +01:00
Usman Baig
033d735c3a Replace dashboard BarChart with 21st.dev LineChart component
Swap the main site dashboard chart from a bar chart to a line chart
using 21st.dev's line-charts-6 component with dot grid background,
glow shadow, and animated active dots. Add Badge trend indicators
on metric cards using Phosphor icons. All existing features preserved
(annotations, comparison, export, live indicator, interval controls).

New UI primitives: line-charts-6, badge-2, card, button-1, avatar.
Added shadcn-compatible CSS variables and Tailwind color mappings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 22:53:35 +01:00
Usman Baig
6ccc26ab48 Replace WorldMap with Magic UI DottedMap for visitor locations
- New DottedMap component using svg-dotted-map with country centroid markers
- Marker size scales by pageview proportion (brand orange)
- Static country-centroids.ts lookup (~200 ISO codes)
- Remove react-simple-maps, i18n-iso-countries, world-atlas CDN dependency
2026-03-09 14:17:35 +01:00
Usman Baig
5fc6f183db feat: annotation UX improvements
- Custom calendar (DatePicker) instead of native date input
- Custom dropdown (Select) instead of native select
- EU date format (DD/MM/YYYY) in tooltips and form
- Right-click context menu on chart to add annotations
- Optional time field (HH:MM) for precise timestamps
- Escape key to dismiss, loading state on save
- Bump @ciphera-net/ui to 0.0.95
2026-03-09 04:17:58 +01:00
Usman Baig
4d99334bcf feat: add chart annotations
Inline annotation markers on the dashboard chart with create/edit/delete UI.
Color-coded categories: deploy, campaign, incident, other.
2026-03-09 03:44:05 +01:00
Usman Baig
a05e2e94b8 feat: add hide unknown locations toggle in site settings
Adds toggle in Data & Privacy > Filtering section to exclude entries
where geographic data could not be resolved from location stats.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 02:26:15 +01:00
Usman Baig
7f9ad0e977 refactor: switch icons from react-icons to Phosphor
Replace react-icons and @radix-ui/react-icons with @phosphor-icons/react
for a consistent icon style across all dashboard panels.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 00:23:31 +01:00
Usman Baig
ad806e0427 fix: remove reload-based stale build recovery to stop login loop
window.location.reload() causes infinite loops when the CDN keeps
serving cached assets. Instead, silently treat Server Action failures
as no-session — the OAuth flow uses full navigations (window.location.href)
which naturally fetch fresh content from the server on return.
2026-03-07 20:02:58 +01:00
Usman Baig
6338d1dfe7 fix: prevent infinite reload loop on stale build recovery
Use sessionStorage guard so the hard reload only fires once. If the
reload doesn't fix it (CDN still serving stale JS), fall through
gracefully instead of looping forever.
2026-03-07 19:55:16 +01:00
Usman Baig
d2dfe62993 fix: recover gracefully from stale Server Action hashes after deployment
Wrap all Server Action calls (getSessionAction, exchangeAuthCode,
logoutAction) in try-catch so a cached browser bundle with old action
IDs triggers a hard reload instead of an infinite loading spinner.
2026-03-07 19:37:41 +01:00
Usman Baig
2c82c1a52a fix: load full filter suggestions (up to 100) and fix Direct referrer duplicate
Filter dropdowns previously only showed ~10 values from cached dashboard
data. Now lazy-loads up to 100 values per dimension when the dropdown
opens. Also removes duplicate "Direct" entry from referrer suggestions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 23:27:54 +01:00
Usman Baig
0809c37067 fix: prevent duplicate filters, support Direct referrer, pass filters to Campaigns
- Deduplicate filters so clicking the same item twice doesn't stack identical pills
- Normalize "Direct" referrer to empty string so direct traffic filtering works
- Pass active filters through to Campaigns component so it respects dashboard filters
2026-03-06 22:40:57 +01:00
Usman Baig
5677f30f3b feat: add dashboard dimension filtering and custom event properties
Dashboard filtering: FilterBar pills, AddFilterDropdown with dimension/
operator/value steps, URL-serialized filters, all SWR hooks filter-aware.

Custom event properties: pulse.track() accepts props object, EventProperties
panel with auto-discovered key tabs and value bar charts, clickable goal rows.

Updated changelog with both features under v0.13.0-alpha.
2026-03-06 21:02:14 +01:00
Usman Baig
e72e6f2ec5 feat: add AI traffic source identification
Display proper brand icons and names for AI referrers (ChatGPT,
Perplexity, Claude, Gemini, Copilot, DeepSeek, Grok, Meta AI,
You.com, Phind) in Top Referrers panel.
2026-03-06 19:25:05 +01:00
Usman Baig
48cf9a1f62 feat: replace settings page with SettingsModal
- Add SettingsModalProvider context and SettingsModalWrapper
- Wire Header onOpenSettings callback via LayoutInner pattern
- Remove old /settings page and SettingsPageClient
- Bump @ciphera-net/ui to ^0.0.88
2026-03-05 22:16:36 +01:00
Usman Baig
7d3f1cb10a refactor: reduce stats.ts duplication with factory pattern (F-10, F-21)
Introduce buildQuery helper and createListFetcher factory to eliminate
near-identical param building and list endpoint boilerplate. File reduced
from ~600 to ~310 lines (~48% reduction) with identical runtime behavior.
2026-03-01 21:25:05 +01:00
Usman Baig
b7426d6128 fix: login loading overlay, deduplicate getCookieDomain (F-18, F-11)
- Login page shows LoadingOverlay during redirect instead of blank screen
- Extract getCookieDomain() to shared lib/utils/cookies.ts
2026-03-01 21:02:28 +01:00
Usman Baig
dfa887147a fix: stabilize auth context effect deps and batch uptime cleanup
Extract stable primitives (isAuthenticated, userOrgId) from user object
for the checkOrg effect dependency array to prevent unnecessary re-runs
on every render. Batch uptime cleanup deletion (1000 rows/batch) to
avoid lock contention and WAL bloat.
2026-03-01 19:56:14 +01:00
Usman Baig
4de4e05ccb fix: standardize funnel date format to YYYY-MM-DD and update changelog
Funnel stats API now uses start_date/end_date params consistent with
all other endpoints. Removed RFC3339 conversion helper. Added changelog
entries for audit fixes (B-7, B-11, B-23, B-38, B-42).
2026-03-01 19:36:38 +01:00
Usman Baig
8a7076ee1b refactor: migrate dashboard to SWR hooks, eliminate all any[] state
Replace 22 manual useState + useEffect + setInterval polling with 11
focused SWR hooks. Removes ~85 lines of polling/visibility logic that
SWR handles natively. All any[] types replaced with proper interfaces
(TopPage, CountryStat, BrowserStat, etc.). Organization state in layout
typed as OrganizationMember[].

Resolves F-7, F-8, F-15 from audit report.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 18:42:14 +01:00
Usman Baig
c9123832a5 fix: fix broken images from CSP, remove dead code, upgrade React types
- Add ciphera.net and *.gstatic.com to CSP img-src (fixes app switcher
  icons and site favicons blocked by Content Security Policy)
- Delete 6 unused component/utility files and orphaned test
- Upgrade @types/react and @types/react-dom to v19 (matches React 19 runtime)
- Fix logger test to use vi.stubEnv for React 19 type compatibility
2026-03-01 15:33:37 +01:00
Usman Baig
27158f7bfc fix: enhance billing operations and session management in API 2026-03-01 14:33:28 +01:00
Usman Baig
b3a303d6df fix: improve session management and UI highlights 2026-03-01 13:53:54 +01:00
Usman Baig
b5f83ce582 feat: add unit tests and CI configuration 2026-03-01 00:11:54 +01:00
Usman Baig
bce56fa64d feat: implement refresh token functionality and update local storage management 2026-02-28 23:02:43 +01:00
Usman Baig
5ef6eafc63 feat: update notification preferences to include granular security alerts 2026-02-28 21:18:57 +01:00
Usman Baig
7053cf5d5e feat: add security activity and trusted devices management to settings page 2026-02-28 19:58:49 +01:00
Usman Baig
22bc18a7cc chore: update CHANGELOG.md to include Request ID tracing for debugging, enhancing request tracking across services, and update API client to propagate Request ID in headers 2026-02-27 17:26:08 +01:00
Usman Baig
8589842f16 chore: update CHANGELOG.md to include session expiration warning feature, enhancing user awareness, and update @ciphera-net/ui dependency to version 0.0.73 in package.json and package-lock.json 2026-02-27 14:24:07 +01:00
Usman Baig
3ff5ee4b6c chore: update CHANGELOG.md to include session synchronization across tabs feature, enhancing user experience, and update @ciphera-net/ui dependency to version 0.0.72 in package.json and package-lock.json 2026-02-27 14:15:40 +01:00
Usman
335cfc1a00 Merge branch 'main' into staging 2026-02-27 13:26:49 +01:00
Usman Baig
b4b1348a94 chore: update CHANGELOG.md to include improvements in authentication flow, addressing CSRF handling and cookie management for seamless sign-in and enhanced security 2026-02-27 11:52:20 +01:00
Usman Baig
704a38f3df chore: update CHANGELOG.md to include lighter dashboard data transfers for improved loading times and new focused dashboard endpoints for efficient data retrieval 2026-02-27 09:24:01 +01:00
Usman Baig
4cff0c621d feat: implement request deduplication and caching in API client for improved performance 2026-02-27 09:17:51 +01:00
Usman Baig
36774cc995 chore: update CHANGELOG.md to include smarter data fetching with request deduplication and caching for improved performance 2026-02-27 09:13:29 +01:00
Usman Baig
3efd23b386 chore: update CHANGELOG.md to include enhancements for dashboard performance, including smarter updates, real-time visitor tracking, and faster event processing 2026-02-27 09:10:08 +01:00
Usman Baig
3fe20a4b1b [Feat] Pulse Admin Dashboard - manually grant plans to organizations
- Add admin layout with /api/admin/me check and access denial
- Add admin pages: dashboard, orgs list, org detail with grant form
- Add lib/api/admin.ts client for admin endpoints

Made-with: Cursor
2026-02-25 21:58:23 +01:00
Usman Baig
801dc1d773 chore: add @simplewebauthn/browser dependency to package.json and package-lock.json for WebAuthn support 2026-02-23 20:18:18 +01:00
Usman Baig
3cb5416251 fix: implement automatic token refresh to prevent frequent re-logins, enhancing user experience during inactivity 2026-02-23 18:57:03 +01:00
Usman Baig
27b3aa8380 feat: add 2FA recovery codes regeneration and backup functionality, enhancing account security 2026-02-23 11:43:57 +01:00
Usman Baig
b54af6c03a fix: require password confirmation to disable 2FA, enhancing security against session hijacking 2026-02-23 11:35:02 +01:00
Usman Baig
39eac4100e feat: update favicon retrieval to use a centralized service URL for consistency across the application 2026-02-22 21:02:11 +01:00
Usman Baig
2d0307d328 fix: enhance error logging by replacing console.error with a centralized logger across the application to improve security and maintainability 2026-02-22 20:57:21 +01:00
Usman Baig
8007900940 feat: enhance accessibility across the application by improving keyboard navigation and screen reader support for various components 2026-02-22 20:39:18 +01:00
Usman Baig
06f54176f1 refactor: enhance type safety by replacing any types with stricter types across the codebase, improving error handling and reducing potential bugs 2026-02-22 20:29:16 +01:00