/** * @file * This file is part of Adguard API MV3 library (https://github.com/AdguardTeam/tsurlfilter/packages/adguard-api-mv3). * * Adguard API MV3 is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Adguard API MV3 is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Adguard API MV3. If not, see . */ import { type ContentType, type EventChannelListener } from '@adguard/tswebextension/mv3'; export type RequestBlockingEvent = { /** * Tab identifier. */ tabId: number; /** * Blocked request id. */ requestId: string; /** * Blocked request URL. */ requestUrl: string; /** * Referrer URL. */ referrerUrl: string; /** * Request mime type. */ requestType: ContentType; /** * Assumed Filtering rule, which has blocked this request. May not be provided if request is blocked by DNR rule. */ assumedRuleIndex?: number; /** * Assumed rule's filter identifier. May not be provided if request is blocked by DNR rule. */ assumedFilterId?: number; /** * Company category name for requests blocked by DNR rule. Provided if request is blocked by DNR rule. */ companyCategoryName?: string; }; export interface RequestBlockingLoggerInterface { addListener(listener: EventChannelListener): void; removeListener(listener: EventChannelListener): void; } /** * API for adding and removing listeners for request blocking events. * Wraps {@link defaultFilteringLog} {@link EventChannel} for {@link ApplyBasicRuleEvent}. */ export declare class RequestBlockingLogger implements RequestBlockingLoggerInterface { private channel; /** * Create instance of {@link RequestBlockingLogger}. */ constructor(); /** * Register listener for {@link RequestBlockingEvent}. * * @param listener Function to be called when {@link RequestBlockingEvent} is dispatched. */ addListener(listener: EventChannelListener): void; /** * Unregister listener for {@link RequestBlockingEvent}. * * @param listener Function to be called when {@link RequestBlockingEvent} is dispatched. */ removeListener(listener: EventChannelListener): void; /** * Handles {@link ApplyBasicRuleEvent}, gets extra data for {@link requestContextStorage} * and dispatch new {@link RequestBlockingEvent}. * * @param event {@link ApplyBasicRuleEvent}. */ private onBasicRuleApply; }