import { type ComponentType } from "react"; type ProviderMode = "sandbox" | "test" | "live"; type ConnectionState = "pending_requirements" | "pending_verification" | "connected" | "restricted" | "error" | "disconnected"; interface CredentialField { key: string; label: string; kind: "text" | "secret" | "boolean" | "select"; required: boolean; placeholder?: string; helpText?: string; options?: { value: string; label: string; }[]; } interface ProviderDescriptor { id: string; displayName: string; description: string; connectionMethod: "credentials" | "embedded_onboarding" | "read_only"; credentialFieldSchema: CredentialField[]; availability: "available" | "coming_soon"; modes: ProviderMode[]; } interface ConnectionRequirement { code: string; message: string; deadlineAt?: string | null; } type ConnectionReadiness = "ready" | "not_ready" | "unknown"; interface ConnectionSummary { providerId: string; connectionId: string; displayName?: string; state: ConnectionState; readiness: ConnectionReadiness; mode: ProviderMode | null; active: boolean; requirements?: ConnectionRequirement[]; lastError?: string | null; readOnly?: boolean; } interface ConnectionStatus { activeProviderId: string | null; status: ConnectionState; mode: ProviderMode | null; activeConnectionId?: string | null; connections?: ConnectionSummary[]; requirements?: ConnectionRequirement[]; lastError?: string | null; readOnly?: boolean; } export interface PaymentEmbeddedOnboardingSession { type: "embedded_onboarding"; publishableKey: string; clientSecret: string; expiresAt: string; } interface OnboardingResult { ok: boolean; status: ConnectionStatus; session?: PaymentEmbeddedOnboardingSession; error?: string; } /** * Integration seam for Stripe Connect.js (or another approved hosted client). * The client asks for an ephemeral secret when it initializes and whenever * Connect.js refreshes an expired AccountSession. */ export interface PaymentEmbeddedOnboardingClientProps { publishableKey: string; fetchClientSecret: () => Promise; onExit: () => void; loadErrorTitle: string; loadErrorDescription: string; } export type PaymentEmbeddedOnboardingClient = ComponentType; interface PaymentEmbeddedOnboardingBoundaryProps { session: PaymentEmbeddedOnboardingSession; client?: PaymentEmbeddedOnboardingClient; refreshClientSecret: () => Promise; onExit: () => void; fallbackTitle: string; fallbackDescription: string; } /** * Keeps session secrets behind a callback and out of the DOM. The initial * secret is consumed once; every later call must mint a fresh AccountSession. */ export declare function PaymentEmbeddedOnboardingBoundary({ session, client: Client, refreshClientSecret, onExit, fallbackTitle, fallbackDescription, }: PaymentEmbeddedOnboardingBoundaryProps): import("react").JSX.Element; type PaymentSettingsFetcher = (input: string, init?: RequestInit) => Promise; /** Request the short-lived bootstrap without placing it in a query cache. */ export declare function requestPaymentOnboardingSession(fetcher: PaymentSettingsFetcher, baseUrl: string, providerId: string, mode: ProviderMode, failureMessage: string): Promise; export declare function paymentConnectionStatusLabel(state: ConnectionState, labels: Record): string; export declare function canConfigurePaymentProvider(provider: Pick): boolean; /** * Pick the first advertised mode that does not already have a connection. * Hosted providers can keep their setup action available when one mode is the * active default but another (for example Sandbox vs Live) still needs setup. */ export declare function firstUnconfiguredPaymentProviderMode(provider: { id: ProviderDescriptor["id"]; modes: readonly ProviderMode[]; }, connections: readonly Pick[] | undefined): ProviderMode | null; /** * A connection can be made the active default only when it is ready (its * lifecycle reached `connected`) and it is not already the active one. This * gates the "Make active" control so a not-ready or already-active connection * never offers activation. */ export declare function canActivatePaymentConnection(connection: Pick): boolean; /** * The four mutually-exclusive states the per-connection activation control can * be in. Pure so the pending/duplicate-prevention behavior is testable without * a DOM harness and stays in sync with what the component renders: * - `active` — this connection is already the default; no action. * - `activating` — this connection's activation request is in flight. * - `activatable` — ready + inactive; the "Make active" button is offered * (disabled while any activation is pending, preventing duplicate submits). * - `gated` — not ready / read-only; a disabled control + reason are shown. */ export type PaymentActivationControl = "active" | "activating" | "activatable" | "gated"; export declare function paymentActivationControlState(input: { summary: Pick; activatingConnectionId?: string | null; }): PaymentActivationControl; /** Hosted disconnect is fail-closed until the managed control plane exposes it. */ export declare function canDisconnectPaymentProvider(provider: Pick | undefined): boolean; export interface PaymentsSettingsPageProps { embeddedOnboardingClient?: PaymentEmbeddedOnboardingClient; } export declare function PaymentsSettingsPage({ embeddedOnboardingClient }?: PaymentsSettingsPageProps): import("react").JSX.Element; export {};