/** * SDK Export Utilities — Barrel re-exports * Preserves the original public API so existing imports work unchanged. */ import { SDKState } from './types' export { exportToPDF } from './export-pdf' export type { ExportOptions } from './export-pdf' export { exportToZIP } from './export-zip' // ============================================================================= // EXPORT HELPER // ============================================================================= export async function downloadExport( state: SDKState, format: 'json' | 'pdf' | 'zip', options: import('./export-pdf').ExportOptions = {} ): Promise { let blob: Blob let filename: string const timestamp = new Date().toISOString().slice(0, 10) switch (format) { case 'json': blob = new Blob([JSON.stringify(state, null, 2)], { type: 'application/json' }) filename = `ai-compliance-sdk-${timestamp}.json` break case 'pdf': { const { exportToPDF } = await import('./export-pdf') blob = await exportToPDF(state, options) filename = `ai-compliance-sdk-${timestamp}.pdf` break } case 'zip': { const { exportToZIP } = await import('./export-zip') blob = await exportToZIP(state, options) filename = `ai-compliance-sdk-${timestamp}.zip` break } default: throw new Error(`Unknown export format: ${format}`) } // Create download link const url = URL.createObjectURL(blob) const link = document.createElement('a') link.href = url link.download = filename document.body.appendChild(link) link.click() document.body.removeChild(link) URL.revokeObjectURL(url) }