Switch analytics privacy controls to opt-out
This commit is contained in:
@@ -1,20 +1,16 @@
|
||||
import { createContext, useContext } from "react";
|
||||
|
||||
export type ConsentChoice = "pending" | "granted" | "denied";
|
||||
|
||||
export interface AnalyticsConsentValue {
|
||||
choice: ConsentChoice;
|
||||
isSettingsOpen: boolean;
|
||||
accept: () => void;
|
||||
reject: () => void;
|
||||
openSettings: () => void;
|
||||
closeSettings: () => void;
|
||||
export interface AnalyticsPreferenceValue {
|
||||
enabled: boolean;
|
||||
disableAnalytics: () => void;
|
||||
enableAnalytics: () => void;
|
||||
toggleAnalytics: () => void;
|
||||
}
|
||||
|
||||
export const AnalyticsConsentContext =
|
||||
createContext<AnalyticsConsentValue | null>(null);
|
||||
createContext<AnalyticsPreferenceValue | null>(null);
|
||||
|
||||
export function useAnalyticsConsent(): AnalyticsConsentValue {
|
||||
export function useAnalyticsConsent(): AnalyticsPreferenceValue {
|
||||
const context = useContext(AnalyticsConsentContext);
|
||||
if (!context) {
|
||||
throw new Error(
|
||||
|
||||
Reference in New Issue
Block a user