`;
document.getElementById('installation-script').textContent = scriptContent;
}
function updatePreviewFrame() {
if (!userId) {
console.error('No user ID available for preview');
return;
}
const previewFrame = document.getElementById('preview-frame');
if (previewFrame) {
// Create a custom preview page URL with the user's actual ID
const previewContent = generatePreviewHTML();
const blob = new Blob([previewContent], { type: 'text/html' });
const url = URL.createObjectURL(blob);
previewFrame.src = url;
// Clean up the blob URL after a delay
setTimeout(() => URL.revokeObjectURL(url), 1000);
}
}
function generatePreviewHTML() {
if (!userId) return 'Error: No user ID';
return `
Banner Preview
Preview Mode: This shows how your cookie banner will appear on your website.
${currentUser?.status === 'active' ? 'Your subscription is active.' : 'Note: Your subscription needs to be active for the banner to work on live websites.'}
Sample Website
This is a preview of how your cookie banner will appear on your website.
The banner should appear based on your current settings below.