import type { PRODUCT_LIFECYCLE_FACT_ATTRIBUTES } from "@opengeni/contracts"; import { type IntegrationConnectReturn } from "./integration-connect-return.js"; type ConnectionClass = (typeof PRODUCT_LIFECYCLE_FACT_ATTRIBUTES)["connection.created"][number]; type ModelClass = (typeof PRODUCT_LIFECYCLE_FACT_ATTRIBUTES)["model.connected"][number]; /** The `connection.created` provider classes (a test keeps them identical). */ export declare const INTEGRATION_CONNECTION_CLASSES: readonly ["slack", "github", "gitlab", "azure_devops", "bitbucket", "google", "microsoft", "linear", "atlassian", "notion", "supabase", "datadog", "posthog", "openai", "x", "other"]; /** The `model.connected` provider classes (a test keeps them identical). */ export declare const MODEL_CONNECTION_CLASSES: readonly ["codex", "supergrok", "vercel_gateway", "openrouter", "anthropic", "claude_subscription", "opper", "elevenlabs", "openai", "azure_openai"]; export type IntegrationClass = ConnectionClass | ModelClass; export declare const INTEGRATION_CONNECT_METHODS: readonly ["oauth", "api_key", "device_code", "app_install", "custom"]; export type IntegrationConnectMethod = (typeof INTEGRATION_CONNECT_METHODS)[number]; export declare const INTEGRATION_CONNECT_OUTCOMES: readonly ["connected", "denied", "provider_error", "cancelled", "abandoned", "outcome_unknown"]; export type IntegrationConnectOutcome = (typeof INTEGRATION_CONNECT_OUTCOMES)[number]; /** * The provider class of a connection domain or MCP host, mirroring * `opengeni_private.product_lifecycle_connection_class` (migration 0532). */ export declare function integrationClassFromDomain(domain: string | null | undefined): ConnectionClass; /** The provider class of a Connect API `providerId` (for example `slack-bot`). */ export declare function integrationClassFromConnectProvider(providerId: string): ConnectionClass; /** The `model.connected` class of a model provider name used in the console. */ export declare function modelConnectionClass(provider: string): ModelClass | null; /** The outcome of a failed connect request or authorization. */ export declare function integrationConnectErrorOutcome(error: unknown): IntegrationConnectOutcome; /** The outcome of a settled Connect API attempt, or null while it is still in progress. */ export declare function connectAttemptOutcome(attempt: { state: string; error?: { code: string; } | undefined; }): IntegrationConnectOutcome | null; export type IntegrationConnectTracker = { /** Report the outcome. Only the first call reports. */ finish(outcome: IntegrationConnectOutcome): void; /** * The page is about to leave for the provider. The journey finishes when * the browser returns (see `captureIntegrationConnectReturn`), so leaving * the page is not reported as `abandoned`. */ redirecting(options?: { returnsWithOutcome?: boolean | undefined; }): void; }; type Capture = (name: "integration_connect_started" | "integration_connect_finished", properties: Record) => boolean; /** * Start a connect journey. `capture` defaults to the consent-gated product * analytics; when collection is not allowed nothing is reported or stored. */ export declare function beginIntegrationConnect(integrationClass: IntegrationClass, method: IntegrationConnectMethod, options?: { capture?: Capture | undefined; storage?: Storage | null | undefined; now?: (() => number) | undefined; }): IntegrationConnectTracker; /** The closed outcome of a provider return parameter. */ export declare function integrationConnectReturnOutcome(value: IntegrationConnectReturn): IntegrationConnectOutcome; /** * Finish a redirect connect journey once analytics collection is active: * report the outcome of the provider return parameters this document loaded * with, or `abandoned` (`outcome_unknown` for flows whose return carries no * outcome) when a redirect started in this tab and the person came back * without one. */ export declare function captureIntegrationConnectReturn(options?: { returned?: IntegrationConnectReturn | null | undefined; capture?: Capture | undefined; storage?: Storage | null | undefined; now?: (() => number) | undefined; }): void; /** * A connect journey bound to a mounted setup surface: started on mount, * `abandoned` when it unmounts before `finish` was called. */ export declare function useIntegrationConnectJourney(integrationClass: IntegrationClass, method: IntegrationConnectMethod): (outcome: IntegrationConnectOutcome) => void; /** * A model-provider connect journey with the outcome vocabulary of * `trackModelConnection`, for flows that have no workspace-scoped tracker * (organization connections, Claude). `expired` is reported as `abandoned`. */ export declare function beginModelConnectJourney(provider: string, method: IntegrationConnectMethod): (outcome: "connected" | "expired" | "denied" | "outcome_unknown") => void; export {};