@aller/blink
Version:
A library for tracking user behaviour.
30 lines (27 loc) • 763 B
text/typescript
import { VERSION } from '../config/config';
import { CONSENT_V2 } from '../actions';
export interface ConsentState {
uuid?: string;
tcfV2?: string;
kind?: string; // 'gdpr' or other type
consentGranted?: boolean; // Aller Media consent
consentedToAll?: boolean;
applies?: boolean;
}
export default function consent(state: ConsentState = {}, action: any) {
switch (action.type) {
case CONSENT_V2: {
return {
...state,
uuid: action.payload.uuid,
tcfV2: action.payload.tcfV2,
kind: action.payload.kind,
consentGranted: action.payload.consentGranted,
consentedToAll: action.payload.consentedToAll,
applies: action.payload.applies,
};
}
default:
return state;
}
}