import type { Essentials, EssentialsOptions } from '@wix/fe-essentials/core';
import type { LogParams, ReportProps } from '@wix/fe-essentials/bi';
import type { errorHandler } from '@wix/essentials';
import type { Trans, useTranslation } from '@wix/fe-essentials/react';
import type { ShowToast } from './toast';
import type { Environment, EnvironmentBi, ErrorMonitor, Experiments, MonitorLogger, OnlineManager } from '../services';
import type { History } from 'history';
import type { QueryCache } from 'react-query/core';
import type { FunctionComponent } from 'react';
import type { DataCapsule } from './dataCapsule';
import { HttpClient } from './httpClient';
import type { SDK } from '@wix/dashboard';
export type OnSidePanelOpen = (listener: () => void) => {
    remove(): void;
};
export type CloseSidePanel = () => unknown;
export interface BiLogger {
    report(reportProps: ReportProps): Promise<any>;
}
export interface CairoBILoggerFactory {
    updateDefaults(params: LogParams): this;
    logger(): BiLogger;
}
export type PageLocation = {
    pageId: string;
    pathname: string;
    search?: string;
    hash?: string;
};
export interface PageProps {
    location: PageLocation;
}
export type OnNavigationPause = () => {
    resume(): void;
};
export type OnNavigationCallback = (pause: OnNavigationPause) => void;
export type OnNavigation = (callback: OnNavigationCallback) => {
    remove(): void;
};
export type NavigateToObject = {
    pageId: string;
    relativeUrl?: string;
    appState?: string;
    referrer?: string;
    /**
     * How the target page should be presented. `overlay` opens it as a layer on
     * top of the current page (e.g. the dashboard overlay). Hosts that don't
     * support layered navigation ignore this and navigate in place.
     */
    displayMode?: 'auto' | 'main' | 'overlay';
    /** Whether the navigation should push a new history entry or replace the current one. */
    history?: 'push' | 'replace';
};
export type NavigateOptions = {
    state?: any;
};
export type NavigateToFunc = (to: NavigateToObject) => void;
export type BeforeUnloadResponse = {
    remove: () => void;
};
export type OnBeforeUnload = (callback: (event: Event) => void) => BeforeUnloadResponse;
/** The layered-navigation state of the current page relative to the host. */
export type LayerState = 'background' | 'foreground';
/**
 * Subscribe to layer-state transitions of the current page. Fires `background`
 * when another layer (e.g. an overlay) is opened on top of the current page and
 * `foreground` when it returns to the top. Hosts without layered navigation
 * leave this undefined.
 */
export type OnLayerStateChange = (callback: (newState: LayerState) => void) => {
    remove: () => void;
};
export interface HostContainerExtension {
    appId?: string;
    componentId: string;
    title?: string;
    menuItem?: {
        IconComponent?: FunctionComponent;
        structuredAction: (params?: Record<string, any>) => unknown;
    };
    Component?: React.ComponentType;
    Extension?: React.ComponentType;
}
export type GetExtensions = () => HostContainerExtension[] | Promise<HostContainerExtension[]>;
interface HostContainer {
    getExtensions: GetExtensions;
}
export type GetHostContainer = (hostContainerId: string) => HostContainer;
export type GetDashboardMenuPlugins = SDK['getDashboardMenuPlugins'];
export type GetDashboardPlugins = SDK['getDashboardPlugins'];
export type OpenMediaManager = SDK['openMediaManager'];
type CreateEssentials = (options: EssentialsOptions) => {
    i18n: Essentials['i18n'];
    dataCapsule: Essentials['dataCapsule'];
    biLoggerFactory?: () => CairoBILoggerFactory;
    errorMonitor: ErrorMonitor;
    fedopsLogger?: MonitorLogger;
    experiments?: Experiments;
};
export type CreateComponentSettings = (container: {
    httpClient: HttpClient;
    queryCache: QueryCache;
    environment: Environment;
    createEssentials: CreateEssentials;
}) => (options: {
    namespace: string;
}) => DataCapsule;
export interface PatternsErrorHandler {
    withErrorHandler: errorHandler.ErrorHandler['withErrorHandler'];
    getResolvedError?: errorHandler.ErrorHandler['getResolvedError'];
    showError?: errorHandler.ErrorHandler['showError'];
    reportRetryAttempt?: errorHandler.ErrorHandler['reportRetryAttempt'];
}
export interface WixPatternsEssentials {
    httpClient: HttpClient;
    /** A `ErrorMonitor` instance `@wix/fe-essentials/error-monitor` */
    errorMonitor: ErrorMonitor;
    /** A `Experiments` instance `@wix/fe-essentials/experiments` */
    experiments: Experiments;
    errorHandler?: PatternsErrorHandler;
    biLogger?: BiLogger | null;
    /**
     * A function that returns the shape `{ i18n }` - should be compatible with `{createEssentials} from '@wix/fe-essentials'` */
    createEssentials: CreateEssentials;
    /** A `DataCapsule` to store component-level settings such as `Views` */
    createComponentSettings?: CreateComponentSettings;
    /** The user's environment
     * - `language` - preferable language for the user
     * - `artifactId` - App level identifier, usually the artifact ID
     * - `componentId` - Component/page level identifier (Optional)
     * - `componentName` - Readable component/page name (Optional)
     */
    environment: Pick<Environment, 'language'> & Partial<Omit<Environment, 'language'>> & {
        uiLibVersion?: string;
        msid?: string;
    };
    environmentBI: EnvironmentBi;
    /** `useTranslation` hook from `react-i18next` or `@wix/fe-essentials/react` */
    useTranslation: typeof useTranslation;
    /** `Trans` component from `react-i18next` or `@wix/fe-essentials/react */
    Trans: typeof Trans;
    user: {
        id?: string;
        permissions: string[];
    };
    /** `useExperiments` hook from `@wix/yoshi-flow-bm` or `@wix/fe-essentials/react` */
    useExperiments: () => {
        ready: boolean;
        experiments: {
            enabled: (key: string) => boolean;
        };
    };
    usePageLocation?: () => PageLocation | undefined;
    /** A function that shows a global toast. For BM usage, it should be `showToast` from `business-manager-api` */
    showToast?: ShowToast;
    /** A function to perform a navigation to a given pageId */
    navigateTo?: NavigateToFunc;
    useAppLoaded?: () => void;
    onSidePanelOpen?: OnSidePanelOpen;
    closeSidePanel?: CloseSidePanel;
    /** Custom [history](https://github.com/remix-run/history/tree/v5.3.0/packages/history) instance to sync custom consumer navigations with Cairo navigations */
    history?: History;
    /** An optional query cache instance for controlling the cache from other modules */
    queryCache?: QueryCache;
    /** A function that interrupts a navigation to another app inside wix platforms */
    onNavigation?: OnNavigation;
    getHostContainer?: GetHostContainer;
    onlineManager?: OnlineManager;
    /**
     * Deals with dirty state by setting up a listener that triggers a confirmation dialog when a user attempts to leave a page. The event listener is removed upon component unmount.
     * @param callback - called on navigation with an event object. Use event.preventDefault() within the callback to display the dialog.
     * @returns { remove: () => void } - object that includes a remove method. You can use this method to remove the listener whenever necessary.
     */
    onBeforeUnload?: OnBeforeUnload;
    /**
     * Subscribe to layer-state transitions of the current page (e.g. to refresh
     * data when an overlay opened on top of it is closed). Provided by hosts that
     * support layered navigation; left undefined otherwise.
     */
    onLayerStateChange?: OnLayerStateChange;
    /** Opens the Wix Media Manager. Provided by the Dashboard SDK via context. */
    openMediaManager?: OpenMediaManager;
}
export interface WixPatternsEssentialsOverrides extends Omit<Partial<WixPatternsEssentials>, 'environment'> {
    environment: Partial<WixPatternsEssentials['environment']>;
}
export type ContextType = 'ACCOUNT' | 'SITE';
export {};
//# sourceMappingURL=wixPatternsEssentials.d.ts.map