import type { PdfAnnotationPersistence } from "./pdf/pdf-annotation-types.js"; import type { ImageSignaturePersistence } from "./image/image-signature-types.js"; /** Community (MIT) feature identifiers. */ export type CommunityFeature = "file-preview" | "multi-document" | "renderer-registry" | "themes" | "loading-phases" | "request-headers" | "blob-and-file-upload"; /** Enterprise feature identifiers (require @doc-preview/enterprise licence). */ export type EnterpriseFeature = "annotations" | "watermark" | "split-view" | "password-pdf" | "print-with-watermark" | "search-in-document" | "redaction" | "document-diff"; export type PreviewPhase = "idle" | "loading" | "ready" | "error"; /** Enterprise audit events for SIEM / compliance hooks. */ export type EnterpriseAuditEventType = "print" | "search" | "redact" | "compare"; export type EnterpriseAuditEvent = { type: EnterpriseAuditEventType; at: string; fileName?: string; documentId?: string; details?: Record; }; export type EnterpriseAuditHandler = (event: EnterpriseAuditEvent) => void; export type PreviewDocument = { /** HTTP(S) URL, path, or `data:...;base64,...` data URL */ uri?: string; /** In-memory file — `File` from input or any `Blob` */ file?: File | Blob; /** Raw base64 payload or full data URL (see also `mimeType`) */ base64?: string; /** MIME type when using raw `base64` (not required for data URLs) */ mimeType?: string; arrayBuffer?: ArrayBuffer; fileName?: string; /** Extension (pdf) or MIME (application/pdf) */ fileType?: string; }; export type PreviewConfig = { header?: { disableHeader?: boolean; disableFileName?: boolean; }; /** Built-in file picker in the viewer header */ upload?: { enabled?: boolean; /** e.g. ".pdf,.png,.jpg,.txt,.html,.csv" */ accept?: string; multiple?: boolean; /** Label on the upload button */ buttonText?: string; /** Show drag-and-drop zone above the preview area */ showDropZone?: boolean; /** Open the file picker once when upload UI mounts (no documents yet) */ autoOpenPicker?: boolean; /** Show remove button next to filename when a document is loaded (default true) */ showClear?: boolean; }; csv?: { delimiter?: string; }; image?: { /** Enterprise: signature persistence on image previews (requires licence + enableAnnotations). */ signatures?: ImageSignaturePersistence; }; pdf?: { defaultZoom?: number; /** Show zoom / page navigation toolbar (default true). */ showControls?: boolean; /** Show thumbnail strip toggle (default true). */ showThumbnails?: boolean; /** Fit page width to container on first load. */ fitWidthOnLoad?: boolean; /** Fit the entire first page inside the viewport on first load (overrides fitWidthOnLoad). */ fitPageOnLoad?: boolean; /** Enterprise: password for encrypted PDFs (requires licence). */ password?: string; /** Show the Annotate toolbar (highlight, note, draw, signature, undo/redo). Default true. */ showAnnotateToolbar?: boolean; /** Show draft / approved / rejected review badge on the Annotate toolbar. Default true. */ showReviewBadge?: boolean; /** Enterprise: annotation persistence (requires licence + enableAnnotations). */ annotations?: PdfAnnotationPersistence; /** Enterprise: in-PDF text search (requires licence + enableSearch). */ enableSearch?: boolean; /** Enterprise: redaction rectangles (requires licence + enableRedaction). */ enableRedaction?: boolean; /** Called when a scanned PDF (no text layer) is detected. Use as an OCR hook. */ onScannedDetected?: (pdfDoc: import("pdfjs-dist").PDFDocumentProxy) => void; }; /** Optional server-side conversion when no client renderer matches. */ conversion?: { /** POST URL — receives multipart file, returns converted bytes. */ serverUrl?: string; headers?: Record; /** Custom conversion hook (e.g. call your API). */ convert?: (input: { blob: Blob; fileName: string; fileType: string; }) => Promise; /** When true (default), split diff retries legacy Office and scanned PDFs via conversion before native overlays. */ convertForNativePreview?: boolean; }; sanitizeHtml?: boolean; /** Apply the WCAG AA high-contrast theme (.dp-root--hc). */ highContrast?: boolean; /** IndexedDB document cache settings */ cache?: { /** Enable/disable the document cache (default: true when IndexedDB is available) */ enabled?: boolean; /** Cache TTL in milliseconds (default: 30 minutes) */ ttlMs?: number; }; /** Optional @doc-preview/office behaviour */ office?: { /** Public-URL cloud embed: microsoft, google, or auto (fallback between viewers). */ cloudViewer?: "microsoft" | "google" | "auto"; /** Legacy .doc preview: text extraction, HTML via officeparser, or auto. */ legacyDocPreview?: "text" | "html" | "auto"; /** Show yellow “Partial preview” banners on Office renderers (default true). Set false to hide in embeds. */ showPartialPreviewBanner?: boolean; }; /** Enterprise options — ignored without a valid @doc-preview/enterprise licence. */ enterprise?: { watermarkText?: string; /** Embed mode: hide annotations, print, compare, search, and redaction UI. */ viewOnly?: boolean; splitView?: boolean; splitDocuments?: [PreviewDocument, PreviewDocument]; /** Enterprise: line diff inside split-view panes (requires document-diff licence). */ splitDiffView?: boolean; enableAnnotations?: boolean; /** Enterprise: show Print button; applies watermark on print when watermarkText is set */ enablePrint?: boolean; /** Enterprise: show Compare doc button (modal diff vs uploaded second file). */ diffView?: boolean; enableSearch?: boolean; enableRedaction?: boolean; }; }; export type PreviewHostOptions = { documents: PreviewDocument[]; activeIndex?: number; config?: PreviewConfig; requestHeaders?: Record; prefetchMethod?: "GET" | "POST"; onPhaseChange?: (event: PreviewPhaseEvent) => void; onDocumentChange?: (document: PreviewDocument, index: number) => void; /** Fired when the user picks file(s) via the built-in upload control */ onFilesSelected?: (files: File[]) => void; /** Fired when the user removes the current document via the header clear control */ onDocumentClear?: () => void; /** Enterprise: audit hook for print, search, redact, and compare (SIEM integration). */ onEnterpriseEvent?: EnterpriseAuditHandler; }; export type PreviewPhaseEvent = { phase: PreviewPhase; document: PreviewDocument | null; index: number; rendererId?: string; errorText?: string; retry: () => void; actionUrl?: string; }; export type ResolvedPreviewDocument = PreviewDocument & { resolvedUri: string; detectedType: string; displayName: string; }; export type LoadedPreview = { blob?: Blob; text?: string; objectUrl?: string; revokeOnCleanup?: boolean; }; export type LoaderContext = { document: ResolvedPreviewDocument; signal: AbortSignal; requestHeaders?: Record; prefetchMethod?: "GET" | "POST"; config?: PreviewConfig; /** Called with byte progress during network fetch. `total` is 0 when unknown. */ onProgress?: (loaded: number, total: number) => void; }; /** Mirrors enterprise licence flags without a hard dependency on @doc-preview/enterprise. */ export type PreviewEnterpriseFlags = { canAnnotations: boolean; canWatermark: boolean; canSplitView: boolean; canPasswordPdf: boolean; canPrintWithWatermark: boolean; canSearchInDocument: boolean; canRedaction: boolean; canDocumentDiff: boolean; }; export declare const NO_PREVIEW_ENTERPRISE_FLAGS: PreviewEnterpriseFlags; export type RenderContext = { document: ResolvedPreviewDocument; loaded: LoadedPreview; config?: PreviewConfig; enterpriseFlags?: PreviewEnterpriseFlags; onEnterpriseEvent?: EnterpriseAuditHandler; onError: (message: string) => void; }; export type PreviewRenderer = { id: string; fileTypes: string[]; weight: number; strategy: "native" | "iframe" | "hybrid"; supports: (doc: ResolvedPreviewDocument) => boolean; load?: (ctx: LoaderContext) => Promise; render: (container: HTMLElement, ctx: RenderContext) => void | (() => void); }; export type PreviewThemeTokens = { primary?: string; secondary?: string; textPrimary?: string; }; export type PreviewSlots = { loading?: (ctx: PreviewPhaseEvent) => HTMLElement | string; error?: (ctx: PreviewPhaseEvent) => HTMLElement | string; }; //# sourceMappingURL=types.d.ts.map