This instance is hosted at {origin || 'this server'}.
We value your privacy. This application uses strictly necessary cookies for authentication
and anonymous analytics to improve performance. Your documents are stored securely and encrypted at rest.
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 (
);
}
/**
* Function to programmatically show the privacy popup
* This can be called from signin/signup components
*/
export function showPrivacyModal(options?: { authEnabled?: boolean }): 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 : '';
void options;
// 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();
}}
>
);
};
root.render(React.createElement(PopupWrapper));
});
});
}