///
import { URL } from 'url';
import IPluginTypes, { PluginTypes } from './IPluginTypes';
import ICorePluginCreateOptions from './ICorePluginCreateOptions';
import { IInteractionGroups, IInteractionStep } from './IInteractions';
import IInteractionsHelper from './IInteractionsHelper';
import IPoint from './IPoint';
import IBrowserEngine from './IBrowserEngine';
import IUserAgentOption, { IVersion } from './IUserAgentOption';
import IDnsSettings from './IDnsSettings';
import ITcpSettings from './ITcpSettings';
import ITlsSettings from './ITlsSettings';
import IHttpResourceLoadDetails from './IHttpResourceLoadDetails';
import { IPuppetPage } from './IPuppetPage';
import { IPuppetWorker } from './IPuppetWorker';
import IDeviceProfile from './IDeviceProfile';
import IHttp2ConnectSettings from './IHttp2ConnectSettings';
import IHttpSocketAgent from './IHttpSocketAgent';
import ISessionCreateOptions from './ISessionCreateOptions';
import { IPuppetFrame } from './IPuppetFrame';
export default interface ICorePlugin extends ICorePluginMethods, IBrowserEmulatorMethods, IHumanEmulatorMethods {
id: string;
}
export interface ICorePluginClass {
id: string;
type: IPluginTypes;
new (createOptions: ICorePluginCreateOptions): ICorePlugin;
}
export interface ICorePluginMethods {
onClientCommand?(meta: IOnClientCommandMeta, ...args: any[]): Promise;
}
export interface IOnClientCommandMeta {
puppetPage: IPuppetPage;
puppetFrame: IPuppetFrame;
}
export declare function CorePluginClassDecorator(constructor: ICorePluginClass): void;
export interface IHumanEmulatorClass {
id: string;
type: PluginTypes.HumanEmulator;
new (createOptions: ICorePluginCreateOptions): IHumanEmulator;
}
export interface IHumanEmulator extends ICorePlugin {
id: string;
}
export interface IHumanEmulatorMethods {
playInteractions?(interactions: IInteractionGroups, runFn: (interaction: IInteractionStep) => Promise, helper?: IInteractionsHelper): Promise;
getStartingMousePoint?(helper?: IInteractionsHelper): Promise;
}
export declare function HumanEmulatorClassDecorator(constructor: IHumanEmulatorClass): void;
export interface IBrowserEmulatorClass {
id: string;
type: PluginTypes.BrowserEmulator;
selectBrowserMeta(userAgentSelector: string): ISelectBrowserMeta;
onBrowserWillLaunch?(browserEngine: IBrowserEngine, launchSettings: {
showBrowser?: boolean;
disableGpu?: boolean;
disableDevtools?: boolean;
}): Promise | void;
new (createOptions: ICorePluginCreateOptions): IBrowserEmulator;
}
export interface ISelectBrowserMeta {
userAgentOption: IUserAgentOption;
browserEngine: IBrowserEngine;
}
export interface IBrowserEmulator extends ICorePlugin {
id: string;
browserName: string;
browserVersion: IVersion;
operatingSystemPlatform: string;
operatingSystemName: string;
operatingSystemVersion: IVersion;
userAgentString: string;
deviceProfile: IDeviceProfile;
}
export interface IBrowserEmulatorMethods {
configure?(options: IBrowserEmulatorConfig): Promise | void;
onDnsConfiguration?(settings: IDnsSettings): Promise | void;
onTcpConfiguration?(settings: ITcpSettings): Promise | void;
onTlsConfiguration?(settings: ITlsSettings): Promise | void;
onHttpAgentInitialized?(agent: IHttpSocketAgent): Promise | void;
onHttp2SessionConnect?(request: IHttpResourceLoadDetails, settings: IHttp2ConnectSettings): Promise | void;
beforeHttpRequest?(request: IHttpResourceLoadDetails): Promise | void;
beforeHttpResponse?(resource: IHttpResourceLoadDetails): Promise | void;
onNewPuppetPage?(page: IPuppetPage): Promise;
onNewPuppetWorker?(worker: IPuppetWorker): Promise;
websiteHasFirstPartyInteraction?(url: URL): Promise | void;
}
export declare type IBrowserEmulatorConfig = Pick;
export declare function BrowserEmulatorClassDecorator(constructor: IBrowserEmulatorClass): void;