export type Options = { identifier?: string; targetWindow?: Window; }; export declare enum Command { SHOW_SNACKBAR = "show_snackbar", SHOW_CONFIRMATION = "show_confirmation", RESIZE = "resize", INITIALIZE = "initialize", OPEN_MODAL = "open_modal", CLOSE_MODAL = "close_modal", GET_SIGNED_TOKEN = "get_signed_token", REDIRECT_TO = "redirect_to", SHOW_FLOATING_WINDOW = "show_floating_window", HIDE_FLOATING_WINDOW = "hide_floating_window", SET_NOTIFICATION = "set_notification", SET_FOCUS_MODE = "set_focus_mode", GET_METADATA = "get_metadata" } export declare enum Event { VISIBILITY = "visibility", CLOSE_CUSTOM_MODAL = "close_custom_modal", PAGE_VISIBILITY_STATE = "page_visibility_state", USER_SETTINGS_CHANGE = "user_settings_change" } export declare enum MessageType { COMMAND = "command", LISTENER = "listener", TRACK = "track" } export declare enum Color { PRIMARY = "primary", SECONDARY = "secondary", NEGATIVE = "negative" } export type Link = { url: string; label: string; }; export type SizeArgs = { height?: number; width?: number; }; export type InitializationOptions = { size?: SizeArgs; }; export declare enum Modal { DEAL = "deal", ORGANIZATION = "organization", PERSON = "person", ACTIVITY = "activity", JSON_MODAL = "json_modal", CUSTOM_MODAL = "custom_modal" } export type DealModalAttributes = { type: Modal.DEAL; prefill?: { title?: string; person?: string; organization?: string; }; }; export type PersonModalAttributes = { type: Modal.PERSON; prefill?: { name?: string; organization?: string; }; }; export type OrganizationModalAttributes = { type: Modal.ORGANIZATION; prefill?: { name?: string; }; }; export type ActivityModalAttributes = { type: Modal.ACTIVITY; prefill?: { subject?: string; dueDate?: string; dueTime?: string; duration?: string; note?: string; description?: string; deal?: number; organization?: number; }; }; export type JSONModalAttributes = { type: Modal.JSON_MODAL; action_id: string; }; export type CustomModalAttributes = { type: Modal.CUSTOM_MODAL; action_id: string; data?: { [key: string]: string; }; }; export type ModalAttributes = OrganizationModalAttributes | DealModalAttributes | PersonModalAttributes | ActivityModalAttributes | JSONModalAttributes | CustomModalAttributes; export declare enum ModalStatus { CLOSED = "closed", SUBMITTED = "submitted" } export declare enum TrackingEvent { FOCUSED = "focused" } export declare enum VisibilityEventInvoker { USER = "user", COMMAND = "command" } export declare enum UserSettingsTheme { DARK = "dark", LIGHT = "light" } export type UserSettings = { theme: UserSettingsTheme; }; export type Metadata = { windowHeight: number; windowWidth: number; }; export type Args = { [Command.INITIALIZE]: InitializationOptions; [Command.SHOW_SNACKBAR]: { message: string; link?: Link; }; [Command.SHOW_CONFIRMATION]: { title: string; description?: string; okText?: string; cancelText?: string; okColor?: Color; }; [Command.RESIZE]: SizeArgs; [Command.OPEN_MODAL]: ModalAttributes; [Command.CLOSE_MODAL]: void; [Command.GET_SIGNED_TOKEN]: void; [Command.REDIRECT_TO]: RedirectAttributes; [Command.SHOW_FLOATING_WINDOW]: { context?: Partial>; }; [Command.HIDE_FLOATING_WINDOW]: { context?: Partial>; }; [Command.SET_NOTIFICATION]: { number?: number; }; [Command.SET_FOCUS_MODE]: boolean; [Command.GET_METADATA]: void; }[T]; export type CommandResponse = { [Command.SHOW_SNACKBAR]: void; [Command.INITIALIZE]: void; [Command.RESIZE]: void; [Command.REDIRECT_TO]: void; [Command.SHOW_CONFIRMATION]: { confirmed: boolean; }; [Command.OPEN_MODAL]: { status: ModalStatus; id?: number; }; [Command.CLOSE_MODAL]: void; [Command.GET_SIGNED_TOKEN]: { token: string; }; [Command.SHOW_FLOATING_WINDOW]: void; [Command.HIDE_FLOATING_WINDOW]: void; [Command.SET_NOTIFICATION]: void; [Command.SET_FOCUS_MODE]: void; [Command.GET_METADATA]: Metadata; }[T]; export type MessageChannelCommandResponse = { data?: CommandResponse; error?: string; }; export type EventResponse = { error?: string; data?: { [Event.VISIBILITY]: { is_visible: boolean; context?: Partial & Record<'invoker', VisibilityEventInvoker>>; }; [Event.CLOSE_CUSTOM_MODAL]: void; [Event.PAGE_VISIBILITY_STATE]: { state: 'visible' | 'hidden'; }; [Event.USER_SETTINGS_CHANGE]: { theme: UserSettingsTheme; }; }[T]; }; export type Payload = { command: T; args: Args; type: MessageType; }; export type ExecuteCommandArgs = Args extends void ? [] : [Args]; export declare enum View { DEALS = "deals", LEADS = "leads", ORGANIZATIONS = "organizations", CONTACTS = "contacts", CAMPAIGNS = "campaigns", PROJECTS = "projects", SETTINGS = "settings" } export type RedirectAttributes = { view: View; id?: number | string; context?: Record; }; export type PageStateResponse = { data: { state: 'visible' | 'hidden'; }; };