import Log from './shared/log'; export interface AffiliateConfigTag { hosts: string | string[]; query?: { [key: string]: string; }; replace?: { to: string; from: string; }[]; modify?: (url: URL) => URL | string; } export interface AffiliateConfig { tags: AffiliateConfigTag[]; log?: boolean; } /** * Manages stateful affiliation */ declare class Affiliate { state: { attached: boolean; config: AffiliateConfig; hosts: string[]; }; observer: MutationObserver | undefined; log: typeof Log; constructor(config?: Partial); /** * Manual function to search the DOM for unaffiliated links */ traverse(nodeSet?: HTMLElement): Affiliate; /** * Modify the URL of a matching link while preserving the original link state */ modifyURL: (url: URL, node: HTMLAnchorElement) => void; /** * Modify a manually provided URL */ convert: (url: string | URL) => string; /** * Attach the mutation observer */ attach: () => Affiliate; /** * Detach the mutation observer */ detach: () => Affiliate; } export default Affiliate;