email-scrubber-core
Version:
A privacy-focused email sanitizer that removes trackers and cleans URLs, powered by the ClearURLs ruleset.
67 lines • 2.19 kB
TypeScript
import { type ClearUrlRules } from "./cleaners/LinkCleaner.js";
import { type TrackerPixelRemoverOptions } from "./cleaners/TrackerPixelRemover.js";
/**
* Options for the email sanitizer.
*/
export interface SanitizeEmailOptions {
/**
* Options for the tracker pixel remover.
*/
trackerPixelOptions?: TrackerPixelRemoverOptions;
/**
* Whether to clean URLs in the email.
* Default: true
*/
cleanUrls?: boolean;
/**
* Whether to remove tracking pixels from the email.
* Default: true
*/
removeTrackingPixels?: boolean;
/**
* Whether to preserve the original document structure.
* If false, only the body content will be returned.
* Default: true
*/
preserveDocumentStructure?: boolean;
}
/**
* Result of the email sanitization process.
*/
export interface SanitizeEmailResult {
/**
* The sanitized HTML content.
*/
html: string;
/**
* Number of URLs that were cleaned.
*/
urlsCleaned: number;
/**
* Number of tracking pixels that were removed.
*/
trackingPixelsRemoved: number;
/**
* Whether any modifications were made to the original content.
*/
wasModified: boolean;
}
/**
* Sanitizes email HTML content by cleaning URLs and removing tracking pixels.
*
* @param html The HTML content to sanitize.
* @param clearUrlRules The ClearURLs rules for cleaning URLs.
* @param options Configuration options for the sanitization process.
* @returns The sanitization result with cleaned HTML and statistics.
*/
export declare function sanitizeEmail(html: string, clearUrlRules: ClearUrlRules, options?: SanitizeEmailOptions): SanitizeEmailResult;
/**
* A simplified version of sanitizeEmail that only returns the cleaned HTML.
*
* @param html The HTML content to sanitize.
* @param clearUrlRules The ClearURLs rules for cleaning URLs.
* @param options Configuration options for the sanitization process.
* @returns The sanitized HTML content.
*/
export declare function sanitizeEmailSimple(html: string, clearUrlRules: ClearUrlRules, options?: SanitizeEmailOptions): string;
//# sourceMappingURL=sanitizer.d.ts.map