Stirling-PDF/frontend
ConnorYoh 960d48f80c
Customised Analytics for admins and users (#4687)
Adds granular privacy controls for analytics - splits single
enableAnalytics toggle into separate PostHog and Scarf controls with
improved admin
  UX.

  Backend Changes

  Configuration (ApplicationProperties.java)
  - Added enablePosthog and enableScarf boolean fields
- New methods: isPosthogEnabled(), isScarfEnabled() (null = enabled when
analytics is on)

  Services
- PostHogService: Now checks isPosthogEnabled() instead of
isAnalyticsEnabled()
  - ConfigController: Exposes new flags via API
- SettingsController: Changed endpoint from @RequestBody to
@RequestParam

  Frontend Changes

  Architecture
- Converted useAppConfig hook → AppConfigContext provider for global
access
  - Added refetch() method for config updates without reload

  New Features
1. AdminAnalyticsChoiceModal: First-launch modal when enableAnalytics
=== null
    - Enable/disable without editing YAML
    - Includes documentation link
  2. Scarf Tracking System: Modular utility with React hook wrapper
    - Respects config + per-service cookie consent
    - Works from any code location (React or vanilla JS)
3. Enhanced Cookie Consent: Per-service toggles (PostHog and Scarf
separate)

  Integration
  - App.tsx: Added AppConfigProvider + scarf initializer
  - HomePage.tsx: Shows admin modal when needed
  - index.tsx: PostHog opt-out by default, service-level consent

  Key Benefits

 Backward compatible (null defaults to enabled)
 Granular control per analytics service
 First-launch admin modal (no YAML editing)
 Privacy-focused with opt-out defaults
 API-based config updates

---------

Co-authored-by: Connor Yoh <connor@stirlingpdf.com>
2025-10-27 16:54:59 +00:00
..
public Customised Analytics for admins and users (#4687) 2025-10-27 16:54:59 +00:00
scripts Add onboarding flow using Reactour (#4635) 2025-10-20 15:07:40 +01:00
src Customised Analytics for admins and users (#4687) 2025-10-27 16:54:59 +00:00
.gitignore V2 Replace Google Fonts icons with locally bundled Iconify icons (#4283) 2025-08-25 16:07:55 +01:00
eslint.config.mjs Refactor to fix circular imports (#4700) 2025-10-21 14:53:18 +01:00
index.html path (#4488) 2025-09-24 20:37:51 +01:00
package-lock.json Customised Analytics for admins and users (#4687) 2025-10-27 16:54:59 +00:00
package.json Ban lint warnings (#4753) 2025-10-27 16:05:24 +00:00
playwright.config.ts V2: Convert Tool (#3828) 2025-08-01 16:08:04 +01:00
postcss.config.js Remove CRA and use Vite instead 2025-05-28 21:43:02 +01:00
README.md Revert "npm login" (#4299) 2025-08-26 14:06:29 +01:00
tailwind.config.js style(frontend): standardize semicolons across TS/JS configs and components (#4525) 2025-09-29 12:55:53 +01:00
tsconfig.json Feature/v2/embed pdf (#4437) 2025-09-19 15:35:51 +01:00
vite-env.d.ts Posthog, scarf and url navigation overhaul (#4318) 2025-08-28 15:42:33 +01:00
vite.config.ts V2: Login Feature (#4701) 2025-10-24 10:49:52 +01:00
vitest.config.ts style(frontend): standardize semicolons across TS/JS configs and components (#4525) 2025-09-29 12:55:53 +01:00
vitest.minimal.config.ts style(frontend): standardize semicolons across TS/JS configs and components (#4525) 2025-09-29 12:55:53 +01:00

Getting Started with Create React App

This project was bootstrapped with Create React App.

Docker Setup

For Docker deployments and configuration, see the Docker README.

Available Scripts

In the project directory, you can run:

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.

The page will reload when you make changes.
You may also see any lint errors in the console.

npm test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

npm run build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

See the section about deployment for more information.

npm run eject

Note: this is a one-way operation. Once you eject, you can't go back!

If you aren't satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.

You don't have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.

Learn More

You can learn more in the Create React App documentation.

To learn React, check out the React documentation.

Code Splitting

This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting

Analyzing the Bundle Size

This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

Making a Progressive Web App

This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app

Advanced Configuration

This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration

Deployment

This section has moved here: https://facebook.github.io/create-react-app/docs/deployment

npm run build fails to minify

This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify