/** * The event half of an automation's "When": one block per trigger (where the * events come from, which events, and optional conditions), plus "Run once". * Controlled and data-agnostic: the host passes the sources it can read and a * loader for each source's event types. */ import { type ReactNode } from "react"; import type { EventSource, EventTypeDescriptor } from "@opengeni/sdk"; import { type EventSourceChoice } from "./event-source-model.js"; import { type EventSourceLogoResolver } from "./event-source-tile.js"; import { type EventConditionDraft, type EventTriggerDraft, type EventTriggerIssues, type EventTriggersDraft, type EventTriggersIssues } from "./event-trigger-model.js"; /** A source's event types, or why they couldn't be read. */ export type EventTypesState = { status: "loading"; } | { status: "ready"; eventTypes: EventTypeDescriptor[]; } | { status: "error"; message: string; }; /** * Reads each picked source's event types once and keeps them, so switching a * trigger's source back and forth never refetches. */ export declare function useEventTypes(sourceIds: readonly string[], load: (sourceId: string) => Promise): Record; export interface EventTriggersFieldProps { value: EventTriggersDraft; onChange: (next: EventTriggersDraft) => void; /** Sources the person can point triggers at; undefined while loading. */ sources: EventSource[] | undefined; /** Reads one source's event types. */ loadEventTypes: (sourceId: string) => Promise; issues?: EventTriggersIssues | undefined; /** The source's brand logo, from the host's connector catalog. */ sourceLogo?: EventSourceLogoResolver | undefined; /** * Opens the host's "Add a source" page; offered when no source fits. Gets * the kind a template's trigger asks for, when it asks for one. */ onAddSource?: ((choice?: EventSourceChoice) => void) | undefined; /** Offer "Run once, then finish" (default true). */ allowOnce?: boolean | undefined; /** * Arguments a new MCP subscription starts with, by name, such as the * project the host's chat belongs to. Only arguments the event takes apply. */ argumentDefaults?: Readonly> | undefined; /** More buttons beside Add an event, such as the host's Add a schedule. */ actions?: ReactNode | undefined; disabled?: boolean | undefined; } export declare function EventTriggersField({ value, onChange, sources, loadEventTypes, issues, sourceLogo, onAddSource, allowOnce, argumentDefaults, actions, disabled, }: EventTriggersFieldProps): import("react").JSX.Element; export interface EventTriggerEditorProps { value: EventTriggerDraft; onChange: (next: EventTriggerDraft) => void; onRemove: () => void; /** Position in the list, for accessible names. */ index: number; sources: EventSource[] | undefined; /** The chosen source's event types; undefined before a source is chosen. */ eventTypes: EventTypesState | undefined; issues?: EventTriggerIssues | undefined; sourceLogo?: EventSourceLogoResolver | undefined; onAddSource?: ((choice?: EventSourceChoice) => void) | undefined; /** Arguments a new MCP subscription starts with; see `EventTriggersField`. */ argumentDefaults?: Readonly> | undefined; /** Move focus to the source picker when the block appears. */ autoFocus?: boolean | undefined; disabled?: boolean | undefined; } export declare function EventTriggerEditor({ value, onChange, onRemove, index, sources, eventTypes, issues, sourceLogo, onAddSource, argumentDefaults, autoFocus, disabled, }: EventTriggerEditorProps): import("react").JSX.Element; export declare function EventTypePicker({ value, onChange, state, sourceName, single, grouped, invalid, disabled, }: { value: string[]; onChange: (eventTypes: string[]) => void; state: EventTypesState | undefined; /** The source's name, which the reasons a type can't be picked mention. */ sourceName?: string | undefined; /** Only one type (MCP triggers); picking replaces it. */ single?: boolean | undefined; /** Headings for "This workspace" types: Chats, Usage and Meetings. */ grouped?: boolean | undefined; invalid?: boolean | undefined; disabled?: boolean | undefined; }): import("react").JSX.Element; export declare function EventConditionsEditor({ value, onChange, suggestions, issues, disabled, }: { value: EventConditionDraft[]; onChange: (conditions: EventConditionDraft[]) => void; /** Fields worth matching, for autocomplete. */ suggestions: ReadonlyArray<{ field: string; description: string; }>; /** By condition key. */ issues?: Record | undefined; disabled?: boolean | undefined; }): import("react").JSX.Element;