GDPR: privacy policy link, customer data export/correct/erase, retention, no third parties on load #4

Merged
reudy merged 4 commits from privacy-gdpr into main 2026-10-24 13:22:03 +02:00
Member

Implements the software side of the contract's data protection clause (§14): a privacy policy page and notice, admin tools to export, correct and erase customer data, and automatic retention. It also stops the public site sending visitors' IPs to third parties.

What changed

No third parties on page load

  • Fonts are bundled (@fontsource/dm-sans, @fontsource/playfair-display) and no longer come from Google Fonts. Google Fonts sent every visitor's IP to Google; a German court fined a site for this in 2022.
  • Stripe.js loads from @stripe/stripe-js/pure, so it's fetched only when the customer presses Pay. The default import injected it on every page.

Privacy policy and checkout

  • Site design → Footer → Privacy policy page sets the page that's linked from the footer and from a short notice above Pay.
  • Create a privacy policy draft makes an unpublished privacy page that describes what this software does with customer data. The studio fills in the [gaps] and is responsible for the content.
  • A hint under the notes field asks customers not to write health details, which are special-category data under Art. 9.
  • Both texts are editable in the Checkout block.
  • There's deliberately no "I consent" checkbox. Booking data is processed to perform the contract (Art. 6(1)(b)), and a required consent box would be legally wrong. The contract's §14 wording should change to match.

Customers page (admin, new)

  • Search by name, email, phone or notes, across orders and unpaid checkouts. Records are grouped by email, ignoring case.
  • Export data (JSON): everything stored about a customer, for access and portability requests.
  • Correct: change name, email or phone, or remove notes, on every record.
  • Erase:
    • Anonymises the customer's orders: email, details and email error are cleared, and anonymisedAt is set. Amounts, services and dates stay for the accounts.
    • Deletes their unpaid checkouts.
    • Warns first if they still have a booking ahead.
  • The Orders page shows "Anonymised customer" for erased orders and hides their email resend buttons. Its email addresses link to the customer.

Retention (pocketbase/pb_hooks/privacy)

  • Runs daily at 03:15 UTC and on PocketBase start.
    • Unpaid checkouts are deleted after N days (default 30).
    • Orders are anonymised after M months (default 0 = off until the studio's accountant gives a period). Orders with a booking still ahead are skipped.
  • A paid basket's copy of the details is now cleared when its order is created, so only the order keeps one.
  • Migration 1793000000_orders_anonymise makes orders.email optional and adds orders.anonymisedAt and an email index. It's mirrored in pb_schema.json.

Tested

On a local stack (PocketBase 0.23.12 + both apps rebuilt), with seeded customers:

  • Migration: applied to an existing database.
  • Startup retention: deleted a 40-day-old unpaid checkout and cleared a leftover copy on a paid basket.
    • With months set to 12, it anonymised a 14-month-old order and skipped one of the same age that has a booking in 2027.
  • Admin, in a headless browser:
    • Search, including by notes. Alice@Example.com and alice@example.com merge into one customer.
    • Export downloads 2 orders + 1 unpaid checkout.
    • Saving phone and removing notes updated 3 records.
    • An email change moved to the new address.
    • Erase anonymised 2 orders and deleted 1 checkout, and the dialog mentioned the upcoming booking.
    • Retention settings saved, and invalid values were rejected.
    • The draft page was created and opened in the editor.
  • Public site:
    • The footer and checkout link to /privacy, and the notes hint is wired with aria-describedby.
    • All 6 font faces load from the app itself.
    • Zero third-party requests on / and /book. Before this change both loaded js.stripe.com.
  • svelte-check: 0 errors in both apps (warnings unchanged: 18 admin, 3 public). No console errors.

Not tested: a real Stripe payment after the pure import switch. The test stack has no publishable key. The API is the same function, and it type-checks.

Not in this PR (follow-ups)

  • MFA for the admin login (PocketBase supports email OTP; it needs SMTP set up in PocketBase).
  • Encrypted, time-limited backups of the PocketBase volume.
  • A data processing agreement (DPA) annex and revised §14 wording in the contract.
  • When the Google Calendar sync is built, it must be covered by export, erase and retention, and put minimal details in events.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VaXE9U7AmW3dfD2w6cbLfk

Implements the software side of the contract's data protection clause (§14): a privacy policy page and notice, admin tools to export, correct and erase customer data, and automatic retention. It also stops the public site sending visitors' IPs to third parties. ## What changed **No third parties on page load** - Fonts are bundled (`@fontsource/dm-sans`, `@fontsource/playfair-display`) and no longer come from Google Fonts. Google Fonts sent every visitor's IP to Google; a German court fined a site for this in 2022. - Stripe.js loads from `@stripe/stripe-js/pure`, so it's fetched only when the customer presses Pay. The default import injected it on every page. **Privacy policy and checkout** - *Site design → Footer → Privacy policy page* sets the page that's linked from the footer and from a short notice above Pay. - *Create a privacy policy draft* makes an unpublished `privacy` page that describes what this software does with customer data. The studio fills in the `[gaps]` and is responsible for the content. - A hint under the notes field asks customers not to write health details, which are special-category data under Art. 9. - Both texts are editable in the Checkout block. - There's deliberately **no "I consent" checkbox**. Booking data is processed to perform the contract (Art. 6(1)(b)), and a required consent box would be legally wrong. The contract's §14 wording should change to match. **Customers page (admin, new)** - Search by name, email, phone or notes, across orders and unpaid checkouts. Records are grouped by email, ignoring case. - **Export data (JSON):** everything stored about a customer, for access and portability requests. - **Correct:** change name, email or phone, or remove notes, on every record. - **Erase:** - Anonymises the customer's orders: email, details and email error are cleared, and `anonymisedAt` is set. Amounts, services and dates stay for the accounts. - Deletes their unpaid checkouts. - Warns first if they still have a booking ahead. - The Orders page shows "Anonymised customer" for erased orders and hides their email resend buttons. Its email addresses link to the customer. **Retention (`pocketbase/pb_hooks/privacy`)** - Runs daily at 03:15 UTC and on PocketBase start. - Unpaid checkouts are deleted after N days (default 30). - Orders are anonymised after M months (default **0 = off** until the studio's accountant gives a period). Orders with a booking still ahead are skipped. - A paid basket's copy of the details is now cleared when its order is created, so only the order keeps one. - Migration `1793000000_orders_anonymise` makes `orders.email` optional and adds `orders.anonymisedAt` and an email index. It's mirrored in `pb_schema.json`. ## Tested On a local stack (PocketBase 0.23.12 + both apps rebuilt), with seeded customers: - **Migration:** applied to an existing database. - **Startup retention:** deleted a 40-day-old unpaid checkout and cleared a leftover copy on a paid basket. - With months set to 12, it anonymised a 14-month-old order and skipped one of the same age that has a booking in 2027. - **Admin, in a headless browser:** - Search, including by notes. `Alice@Example.com` and `alice@example.com` merge into one customer. - Export downloads 2 orders + 1 unpaid checkout. - Saving phone and removing notes updated 3 records. - An email change moved to the new address. - Erase anonymised 2 orders and deleted 1 checkout, and the dialog mentioned the upcoming booking. - Retention settings saved, and invalid values were rejected. - The draft page was created and opened in the editor. - **Public site:** - The footer and checkout link to `/privacy`, and the notes hint is wired with `aria-describedby`. - All 6 font faces load from the app itself. - **Zero third-party requests** on `/` and `/book`. Before this change both loaded `js.stripe.com`. - `svelte-check`: 0 errors in both apps (warnings unchanged: 18 admin, 3 public). No console errors. **Not tested:** a real Stripe payment after the `pure` import switch. The test stack has no publishable key. The API is the same function, and it type-checks. ## Not in this PR (follow-ups) - MFA for the admin login (PocketBase supports email OTP; it needs SMTP set up in PocketBase). - Encrypted, time-limited backups of the PocketBase volume. - A data processing agreement (DPA) annex and revised §14 wording in the contract. - When the Google Calendar sync is built, it must be covered by export, erase and retention, and put minimal details in events. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VaXE9U7AmW3dfD2w6cbLfk
agent added 4 commits 2026-10-24 12:45:06 +02:00
Google Fonts and Stripe.js (imported from @stripe/stripe-js, which injects the script on import) sent every visitor's IP address to Google and Stripe on every page. Fonts now come from @fontsource packages bundled into each app; Stripe.js loads from the 'pure' entry point, only when the customer presses Pay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VaXE9U7AmW3dfD2w6cbLfk
Site design → Footer picks the privacy policy page; it is linked from the footer and from a short notice above Pay. The notes field asks customers not to write health details (special-category data). 'Create a privacy policy draft' makes an unpublished page describing what this software does with customer data, with gaps for the studio to fill in. No consent checkbox: booking data is processed to perform the contract. Also adds the PrivacyGlobal type used by the retention settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VaXE9U7AmW3dfD2w6cbLfk
Admin /customers finds a customer by name, email, phone or notes (orders and unpaid checkouts), exports everything stored as JSON, corrects details on every record, and erases them — anonymising orders (amounts, services and dates stay for the accounts) and deleting unpaid checkouts. A daily cron (and PocketBase start) deletes unpaid checkouts after N days and, when set, anonymises orders after M months, skipping orders with a booking ahead. A paid basket's copy of the details is cleared when its order is created. All writes are in pocketbase/pb_hooks/privacy (orders and baskets are superuser-only); migration 1793000000 makes orders.email optional and adds orders.anonymisedAt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VaXE9U7AmW3dfD2w6cbLfk
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VaXE9U7AmW3dfD2w6cbLfk
reudy merged commit de8d29beb4 into main 2026-10-24 13:22:03 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: reudy-net/domaino#4
No description provided.