///
import { DekPluginSchema } from './plugins';
import { DekRegistry } from './registry';
import { DekApiStateType } from './state';
export type SetLocationFunc = (to: string, options?: {
replace?: boolean | undefined;
} | undefined) => void;
export type DekBoardProperty = {
key: string;
value: string;
};
export type DekComponent = {
integrationKey: string;
componentKey: string;
props: DekBoardProperty[];
containerProps: DekBoardProperty[];
};
export type DekCommand = DekComponent & {
title: string;
};
export type DekCommandGroup = {
key: string;
title: string;
commands: DekCommand[];
};
export type DekZone = DekComponent & {
key: string;
order?: number | null;
};
export type DekBoardBase = {
integration: string;
key: string;
};
export type DekBoard = {
title: string;
key: string;
layout?: string | null;
base?: DekBoardBase | null;
zones: DekZone[];
};
export type DekApiState = {
get: (key: string, defaultValue?: DekApiStateType) => DekApiStateType | undefined;
set: (key: string, value: DekApiStateType) => void;
};
export type DekApiInfo = {
components: string[];
screens: string[];
};
export type DekApiIntegration = {
available: boolean;
component: (key: string, props?: any) => JSX.Element | undefined;
componentSchema: (key: string) => DekPluginSchema;
screen: (path: string) => JSX.Element | undefined;
board: (key: string) => JSX.Element | undefined;
api: any;
state: DekApiState;
info: DekApiInfo;
};
export type DekApiMessageType = 'trace' | 'error' | 'warn';
export type DekApiMessage = {
type: DekApiMessageType;
body: string;
data?: any[];
at: number;
};
export type DekApiInternal = {
trace: (integrationKey: string, message: string, ...data: any[]) => void;
warn: (integrationKey: string, message: string, ...data: any[]) => void;
error: (integrationKey: string, message: string, ...data: any[]) => void;
messages: () => DekApiMessage[];
integration: (key: string) => DekApiIntegration;
registry: DekRegistry;
boardKey: string;
boards: DekBoard[];
board: DekBoard;
layout: string;
commandGroups: DekCommandGroup[];
commands: DekCommand[];
navigate: (path: string) => void;
navigateParams: Record;
navigateBack: () => void;
open: (boardKey: string) => void;
integrations: Record;
};
export type DekApi = {
trace: (message: string, ...data: any[]) => void;
warn: (message: string, ...data: any[]) => void;
error: (message: string, ...data: any[]) => void;
messages: () => DekApiMessage[];
integration: (key: string) => DekApiIntegration;
registry: DekRegistry;
boardKey: string;
boards: DekBoard[];
board: DekBoard;
layout: string;
commandGroups: DekCommandGroup[];
commands: DekCommand[];
navigate: (path: string) => void;
navigateParams: Record;
navigateBack: () => void;
open: (boardKey: string) => void;
integrations: Record;
};
export declare class Api implements DekApi {
integrationKey: string;
constructor(integrationKey: string);
get internal(): DekApiInternal;
trace(message: string, ...data: any[]): void;
warn(message: string, ...data: any[]): void;
error(message: string, ...data: any[]): void;
messages(): DekApiMessage[];
integration(key: string): DekApiIntegration;
get registry(): DekRegistry;
get boardKey(): string;
get boards(): DekBoard[];
get board(): DekBoard;
get layout(): string;
get commandGroups(): DekCommandGroup[];
get commands(): DekCommand[];
navigate(path: string): void;
get navigateParams(): Record;
navigateBack(): void;
open(boardKey: string): void;
get integrations(): Record;
get api(): any;
get state(): DekApiState;
get info(): DekApiInfo;
component(key: string, props?: any): JSX.Element | undefined;
componentSchema(key: string): DekPluginSchema;
screen(path: string): JSX.Element | undefined;
}
export declare class ApiInternal implements DekApiInternal {
trace(integrationKey: string, message: string, ...data: any[]): void;
warn(integrationKey: string, message: string, ...data: any[]): void;
error(integrationKey: string, message: string, ...data: any[]): void;
messages(): DekApiMessage[];
integration(key: string): DekApiIntegration;
get registry(): DekRegistry;
get boardKey(): string;
get boards(): DekBoard[];
get board(): DekBoard;
get layout(): string;
get commandGroups(): DekCommandGroup[];
get commands(): DekCommand[];
navigate(path: string): void;
get navigateParams(): Record;
navigateBack(): void;
open(boardKey: string): void;
private createIntegrationWrapper;
private get globals();
get integrations(): Record;
private getIntegrationInstance;
private getComponent;
private getComponentSchema;
private getScreen;
private getBoard;
}
declare const api: ApiInternal;
export default api;