import { SerializedJSONValue } from './utils'; export interface OpenAlertOptions { title: string; message: string; confirmLabel?: string; shouldCloseOnEscapePress?: boolean; shouldCloseOnOverlayClick?: boolean; } export type OpenConfirmOptions = OpenAlertOptions & { cancelLabel?: string; intent?: 'primary' | 'positive' | 'negative'; }; export interface OpenCustomWidgetOptions { id?: string; width?: number | 'small' | 'medium' | 'large' | 'fullWidth'; minHeight?: number | string; allowHeightOverflow?: boolean; position?: 'center' | 'top'; title?: string; shouldCloseOnOverlayClick?: boolean; shouldCloseOnEscapePress?: boolean; parameters?: SerializedJSONValue; } export interface EntityDialogOptions { locale?: string; contentTypes?: string[]; min?: number; max?: number; } export interface DialogsAPI { /** Opens a simple alert window (which can only be closed). */ openAlert: (options: OpenAlertOptions) => Promise; /** Opens a confirmation window. A user can either confirm or cancel the dialog. */ openConfirm: (options: OpenConfirmOptions) => Promise; /** Opens a prompt window. A user can either provide a string input or cancel the dialog. */ openPrompt: (options: OpenConfirmOptions & { defaultValue?: string; }) => Promise; /** Opens an extension in a dialog. */ openExtension: (options: OpenCustomWidgetOptions) => Promise; /** Opens the current app in a dialog */ openCurrentApp: (options?: Omit) => Promise; /** Opens the current app or extension in a dialog */ openCurrent: (options?: Omit | OpenCustomWidgetOptions) => Promise; /** Opens a dialog for selecting a single entry. */ selectSingleEntry: (options?: { locale?: string; contentTypes?: string[]; }) => Promise; /** Opens a dialog for selecting multiple entries. */ selectMultipleEntries: (options?: { locale?: string; contentTypes?: string[]; min?: number; max?: number; }) => Promise; /** Opens a dialog for selecting a single asset. */ selectSingleAsset: (options?: { locale?: string; mimetypeGroups?: string[]; }) => Promise; /** Opens a dialog for selecting multiple assets. */ selectMultipleAssets: (options?: { locale?: string; min?: number; max?: number; mimetypeGroups?: string[]; }) => Promise; /** Opens a dialog for selecting a single experience. * This is intentionally optional, until the actual implemenation */ selectSingleExperience?: (options?: { locale?: string; contentTypes?: string[]; }) => Promise; /** Opens a dialog for selecting multiple experiences. * This is intentionally optional, until the actual implemenation */ selectMultipleExperiences?: (options?: { locale?: string; contentTypes?: string[]; min?: number; max?: number; }) => Promise; /** Opens a dialog for selecting a single pattern. * This is intentionally optional, until the actual implemenation */ selectSinglePattern?: (options?: { locale?: string; contentTypes?: string[]; }) => Promise; /** Opens a dialog for selecting multiple patterns. * This is intentionally optional, until the actual implemenation */ selectMultiplePatterns?: (options?: { locale?: string; contentTypes?: string[]; min?: number; max?: number; }) => Promise; /** Opens a dialog for selecting a single component definition. * This is intentionally optional, until the actual implemenation */ selectSingleComponentDefinition?: (options?: { locale?: string; contentTypes?: string[]; }) => Promise; /** Opens a dialog for selecting multiple component definitions. * This is intentionally optional, until the actual implemenation */ selectMultipleComponentDefinitions?: (options?: { locale?: string; contentTypes?: string[]; min?: number; max?: number; }) => Promise; }