feat(prices): Settings revocation toggle for price_fetching_consent #159

Closed
opened 2026-04-27 00:15:37 +00:00 by maximus · 0 comments
Owner

Goal

Add a "Révoquer le consentement de récupération de prix" toggle in SettingsPage.tsx Privacy section that deletes the price_fetching_consent key for the active profile.

Contract reference

docs/api-contract-prices.md §0 (UX cohérence privacy-first).

Fichiers concernés

  • src/pages/SettingsPage.tsx (extend Privacy section)
  • src/components/settings/PriceFetchConsentToggle.tsx (new component, ~60 lines)
  • src/components/settings/PriceFetchConsentToggle.test.tsx (new, ~50 lines)

Depends on

Scope

  • Create src/components/settings/PriceFetchConsentToggle.tsx:
    • Reads consent state from user_preferences key price_fetching_consent for active profile
    • Renders a toggle (using existing project Switch or Toggle component if available — grep src/components/shared first)
    • On toggle off (revoke) : confirmation dialog t('settings.privacy.priceFetchConsent.confirmRevoke') then DELETE FROM user_preferences WHERE key = 'price_fetching_consent' AND profile_id = ?
    • On toggle on (re-grant) : write {consented_at, version: 1} (same shape as #158)
    • Disabled if no active license OR not premium (avec tooltip explicatif)
  • Wire into SettingsPage.tsx — locate the Privacy section (look for existing t('settings.privacy.*') keys, or create a new <section> if none exists)
  • i18n keys all under settings.privacy.priceFetchConsent.*
  • Vitest tests:
    • reflects current consent state on mount
    • toggling off + confirming clears the key
    • cancelling the confirmation does NOT clear the key
    • disabled when not premium

Critères d'acceptation

  • All tests green
  • After revoke, next click on PriceFetchControl in the snapshot editor re-shows the consent modal (manual smoke)
  • Toggle correctly disabled for non-premium users

Décisions prises ce soir

  • Namespace i18n : settings.privacy.priceFetchConsent.*
  • Confirmation requise avant suppression (pour éviter clics involontaires)

Spec source

docs/api-contract-prices.md

## Goal Add a "Révoquer le consentement de récupération de prix" toggle in `SettingsPage.tsx` Privacy section that deletes the `price_fetching_consent` key for the active profile. ## Contract reference `docs/api-contract-prices.md` §0 (UX cohérence privacy-first). ## Fichiers concernés - `src/pages/SettingsPage.tsx` (extend Privacy section) - `src/components/settings/PriceFetchConsentToggle.tsx` (new component, ~60 lines) - `src/components/settings/PriceFetchConsentToggle.test.tsx` (new, ~50 lines) ## Depends on - #158 ## Scope - [ ] Create `src/components/settings/PriceFetchConsentToggle.tsx`: - Reads consent state from `user_preferences` key `price_fetching_consent` for active profile - Renders a toggle (using existing project `Switch` or `Toggle` component if available — grep `src/components/shared` first) - On toggle off (revoke) : confirmation dialog `t('settings.privacy.priceFetchConsent.confirmRevoke')` then `DELETE FROM user_preferences WHERE key = 'price_fetching_consent' AND profile_id = ?` - On toggle on (re-grant) : write `{consented_at, version: 1}` (same shape as #158) - Disabled if no active license OR not premium (avec tooltip explicatif) - [ ] Wire into `SettingsPage.tsx` — locate the Privacy section (look for existing `t('settings.privacy.*')` keys, or create a new `<section>` if none exists) - [ ] i18n keys all under `settings.privacy.priceFetchConsent.*` - [ ] Vitest tests: - reflects current consent state on mount - toggling off + confirming clears the key - cancelling the confirmation does NOT clear the key - disabled when not premium ## Critères d'acceptation - [ ] All tests green - [ ] After revoke, next click on PriceFetchControl in the snapshot editor re-shows the consent modal (manual smoke) - [ ] Toggle correctly disabled for non-premium users ## Décisions prises ce soir - Namespace i18n : `settings.privacy.priceFetchConsent.*` - Confirmation requise avant suppression (pour éviter clics involontaires) ## Spec source `docs/api-contract-prices.md`
maximus added this to the spec-price-fetching milestone 2026-04-27 00:15:37 +00:00
maximus added the
status:ready
type:feature
source:human
labels 2026-04-27 00:15:37 +00:00
maximus modified the milestone from spec-price-fetching to overnight-2026-04-27-prices 2026-04-27 00:32:02 +00:00
maximus added
status:in-progress
and removed
status:ready
source:human
labels 2026-04-27 12:41:38 +00:00
Sign in to join this conversation.
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: maximus/Simpl-Resultat#159
No description provided.