'use client'; import { useState, useEffect } from 'react'; import { updateAppConfig } from '@/lib/client/dexie'; import { Button, ModalFrame, ModalTitle } from '@/components/ui'; interface PrivacyModalProps { isOpen: boolean; onAccept?: () => void; onDismiss?: () => void; } function PrivacyModalBody({ origin }: { origin: string }) { return (
Service Operator
This instance is hosted at {origin || 'this server'}.

We value your privacy. This application uses strictly necessary cookies for authentication and optional analytics only when consent allows it. Your documents are stored encrypted at rest.

OpenReader does not currently provide end-to-end encryption.

The owner of this instance may be able to access stored metadata and uploaded files needed to operate the service.

Passwords are not stored as readable plaintext.

For full details on data collection, processing, and your rights, please review our complete{' '} Privacy Policy.

); } export function PrivacyModal({ isOpen, onAccept, onDismiss }: PrivacyModalProps) { const [origin, setOrigin] = useState(''); const [agreed, setAgreed] = useState(false); useEffect(() => { if (typeof window === 'undefined') return; setOrigin(window.location.origin); }, []); useEffect(() => { if (isOpen) { setAgreed(false); } }, [isOpen]); const handleAccept = async () => { await updateAppConfig({ privacyAccepted: true }); if (typeof window !== 'undefined') { window.dispatchEvent(new Event('openreader:privacyAccepted')); } onAccept?.(); }; return ( {})} panelTestId="privacy-modal" className="z-[80]"> Privacy & Data Usage
setAgreed(e.target.checked)} className="h-4 w-4 rounded border-line text-accent focus:ring-accent-line bg-surface" />
{' '} Privacy Policy
); } /** * Function to programmatically show the privacy popup * This can be called from signin/signup components */ export function showPrivacyModal(): void { // Create a temporary container for the popup const container = document.createElement('div'); container.id = 'privacy-modal-container'; document.body.appendChild(container); const origin = typeof window !== 'undefined' ? window.location.origin : ''; // Import React and render the popup import('react-dom/client').then(({ createRoot }) => { import('react').then((React) => { const root = createRoot(container); const PopupWrapper = () => { const [show, setShow] = useState(true); const handleClose = () => { setShow(false); }; return ( { root.unmount(); container.remove(); }} > Privacy & Data Usage
); }; root.render(React.createElement(PopupWrapper)); }); }); }