/** * Gating Privacy/GDPR Consent Component * * GDPR-compliant privacy policy and terms consent checkbox. */ import React from 'react'; import type { GatingConfig } from '../types/gating'; import { t } from '../i18n/config'; export interface GatingPrivacyConsentProps { /** Whether user has consented */ consented: boolean; /** Called when consent changes */ onConsentChange: (consented: boolean) => void; /** Error message (translated) */ error?: string; /** Gating configuration */ config: GatingConfig; } /** * Privacy/GDPR consent component */ export function GatingPrivacyConsent( props: GatingPrivacyConsentProps ): React.ReactElement { const { consented, onConsentChange, error, config } = props; // Get custom translations or defaults const privacyText = config.translations?.privacyText || t('privacy.text'); const policyLink = config.translations?.privacyText || t('privacy.policyLink'); const termsLink = config.translations?.termsText || t('privacy.termsLink'); const consentText = config.translations?.consentText || t('privacy.consentText'); return (
{/* Privacy Policy Links (if provided) */} {(config.privacyPolicyUrl || config.termsOfServiceUrl) && (

{privacyText}{' '} {config.privacyPolicyUrl && ( <> {policyLink} {config.termsOfServiceUrl && and } )} {config.termsOfServiceUrl && ( {termsLink} )} .

)} {/* Consent Checkbox (GDPR requirement) */} {config.gdprCompliant && ( )} {/* Error Message */} {error && ( )}
); }