import { AdapterDomain, AdapterStatusInfo, DomainAdapterConfig, AdapterStatusType, DbAdapter, AuthAdapter, PaymentsAdapter, AiAdapter, FileStorageAdapter, AdminAdapter, LoggerAdapter, AdapterError } from '@geenius/adapters'; import { JSX, ReactNode } from 'react'; import { ClassValue } from 'clsx'; /** * @module AdapterCard * @package @geenius/adapters/react * @description Renders the Tailwind-based adapter summary card for the React * variant. The card surfaces provider status, latency, and domain metadata for * one adapter domain in the dashboard views. */ /** * Props for rendering a single adapter summary card in the React dashboard grid. * * @property domain Adapter domain represented by the card. * @property status Current provider health and metadata for the domain. * @property onClick Optional callback fired when the card is activated. * @property className Optional class name merged into the card container. */ interface AdapterCardProps { domain: AdapterDomain; status: AdapterStatusInfo; onClick?: () => void; className?: string; } /** * Renders a clickable React summary card for one adapter domain. * * @param props Card props including the adapter domain, status payload, and click handler. * @returns A button element that summarizes provider state for the selected domain. */ declare function AdapterCard({ domain, status, onClick, className, }: AdapterCardProps): JSX.Element; /** * @module AdapterConfigForm * @package @geenius/adapters/react * @description Renders the Tailwind-based React adapter configuration form. * This component is used inside adapter pages and dialogs to collect the * provider-specific credentials required for each infrastructure domain. */ /** * Props accepted by the React adapter configuration form. * * @property domain Adapter domain being configured in the current dialog * @property initialConfig Existing configuration values used to hydrate the form * @property onSave Async or sync handler that persists the submitted configuration * @property onCancel Optional callback invoked when the user dismisses the form * @property className Optional class name merged onto the form root * @property titleId Optional identifier applied to the form title for dialog labelling */ interface AdapterConfigFormProps { domain: AdapterDomain; initialConfig?: DomainAdapterConfig; onSave: (config: DomainAdapterConfig) => Promise | void; onCancel?: () => void; className?: string; titleId?: string; } /** * Renders the adapter configuration workflow for a single adapter domain. * * @param props Component props controlling the selected domain and form callbacks * @returns A provider chooser and credential form styled with the React variant * @example * ```tsx * saveConfig('ai', config)} * onCancel={() => setOpen(false)} * /> * ``` */ declare function AdapterConfigForm({ domain, initialConfig, onSave, onCancel, className, titleId, }: AdapterConfigFormProps): JSX.Element; /** * @module AdapterList * @package @geenius/adapters/react * @description Renders the searchable adapter grid for the React variant. The * list consumes provider status from context and delegates selection events to * the hosting page or dashboard shell. */ /** * Props for rendering the React adapter list and optional status filter controls. * * @property onSelect Optional callback invoked when a domain card is selected. * @property filterStatus Optional status filter applied before rendering the grid. * @property className Optional class name merged into the outer wrapper. */ interface AdapterListProps { onSelect?: (domain: AdapterDomain) => void; filterStatus?: AdapterStatusType; className?: string; } /** * Renders the searchable React adapter list backed by shared provider state. * * @param props List props including selection callback, status filtering, and wrapper class names. * @returns The adapter grid or an empty/loading state when no entries are available. */ declare function AdapterList({ onSelect, filterStatus, className, }: AdapterListProps): JSX.Element; /** * @module AdapterStatusBadge * @package @geenius/adapters/react * @description Renders the Tailwind-based adapter status badge for the React * variant. The badge exposes the shared adapter status vocabulary in a compact, * themeable visual treatment. */ /** * Props for rendering the React adapter status badge. * * @property status Shared adapter status vocabulary value to display. * @property showLabel Whether the human-readable label should be rendered. * @property size Visual size variant for the badge and status dot. * @property className Optional class name merged into the badge wrapper. */ interface AdapterStatusBadgeProps { status: AdapterStatusType; showLabel?: boolean; size?: "sm" | "md"; className?: string; } /** * Renders a compact React badge for the current adapter lifecycle state. * * @param props Badge props including the status token, optional label visibility, and size variant. * @returns A styled badge element that mirrors the shared adapter status taxonomy. */ declare function AdapterStatusBadge({ status, showLabel, size, className, }: AdapterStatusBadgeProps): JSX.Element; /** * @module index * @package @geenius/adapters/react * @description Defines the React adapter hooks for reading adapter instances * and adapter status state from the React provider context. These hooks are * part of the public React runtime package and avoid unpublished shared * framework subpaths. */ /** * Reads the configured database adapter from the current React adapter context. * * @returns The active database adapter implementation for the provider tree. * @throws {AdapterContextError} When no React adapter provider is mounted. * * @example * ```tsx * function Users() { * const db = useDb() * return null * } * ``` */ declare function useDb(): DbAdapter; /** * Reads the configured authentication adapter from the current React context. * * @returns The active authentication adapter implementation. * @throws {AdapterContextError} When the auth adapter is unavailable. */ declare function useAuth(): AuthAdapter; /** * Reads the configured authentication adapter from the current React context. * * @returns The active authentication adapter implementation. * @throws {AdapterContextError} When the auth adapter is unavailable. */ declare function useAuthAdapter(): AuthAdapter; /** * Reads the configured payments adapter from the current React context. * * @returns The active payments adapter implementation. * @throws {AdapterContextError} When the payments adapter is unavailable. */ declare function usePayments(): PaymentsAdapter; /** * Reads the configured AI adapter from the current React context. * * @returns The active AI adapter implementation. * @throws {AdapterContextError} When the AI adapter is unavailable. */ declare function useAi(): AiAdapter; /** * Reads the configured file-storage adapter from the current React context. * * @returns The active file-storage adapter implementation. * @throws {AdapterContextError} When the storage adapter is unavailable. */ declare function useFileStorage(): FileStorageAdapter; /** * Reads the configured file-storage adapter from the current React context. * * @returns The active file-storage adapter implementation. * @throws {AdapterContextError} When the storage adapter is unavailable. */ declare function useStorage(): FileStorageAdapter; /** * Reads the configured admin adapter from the current React context. * * @returns The active admin adapter implementation. * @throws {AdapterContextError} When the admin adapter is unavailable. */ declare function useAdmin(): AdminAdapter; /** * Reads the configured logger adapter from the current React context. * * @returns The active logger adapter implementation. * @throws {AdapterContextError} When the logger adapter is unavailable. */ declare function useLogger(): LoggerAdapter; /** * Returns the full adapter status record from the current React context. * * @returns A status object keyed by adapter domain. */ declare function useAdapterStatuses(): Record; /** * Returns the current status for a single adapter domain. * * @param domain Adapter domain whose status should be returned. * @returns The latest status snapshot for the requested domain. */ declare function useAdapterStatus(domain: AdapterDomain): AdapterStatusInfo; /** * Reports whether a specific adapter domain is configured and connected. * * @param domain Adapter domain to inspect. * @returns `true` when the domain is ready for consumer use. */ declare function useIsAdapterReady(domain: AdapterDomain): boolean; /** * Accesses every adapter and status helper from the current provider context. * * @returns A memoized snapshot of adapters, statuses, and loading helpers. */ declare function useAdapters(): { db: DbAdapter; auth: AuthAdapter; payments: PaymentsAdapter; ai: AiAdapter; fileStorage: FileStorageAdapter; storage: FileStorageAdapter; admin: AdminAdapter; logger: LoggerAdapter; statuses: Record; isLoading: boolean; isReady: (domain: AdapterDomain) => boolean; }; /** * @module utils * @package @geenius/adapters/react * @description Provides React-specific utility helpers for composing Tailwind * class names. The module wraps `clsx` and `tailwind-merge` to keep React * component styling deterministic and ergonomic. */ /** * Merge CSS class names with Tailwind support. * Combines clsx (for conditional classes) with tailwind-merge (to resolve conflicts). * * This utility ensures that Tailwind classes override each other correctly: * cn('px-2', 'px-4') → 'px-4' (not both) * Also handles conditional classes: * cn('p-2', isActive && 'bg-primary') * * @param inputs - Class names, arrays, objects, or conditional values * @returns Merged and deduplicated class string * * @example * ```ts * cn('px-2 py-1', 'px-4') // 'py-1 px-4' * cn('p-2', isActive && 'bg-primary') // 'p-2 bg-primary' or 'p-2' * cn({ 'text-destructive': isError, 'text-primary': isSuccess }) // conditional classes * ``` */ declare function cn(...inputs: ClassValue[]): string; /** * @module AdapterDetailPage * @package @geenius/adapters/react * @description Renders the single-domain adapter detail view for the React * variant. The page surfaces current provider health, available providers, and * inline configuration for one adapter domain. */ /** * Props for rendering the React single-domain adapter detail page. * * @property domain Adapter domain whose provider details should be displayed. * @property onBack Optional callback for returning to the dashboard view. * @property onConfigure Optional callback invoked with submitted adapter configuration. * @property className Optional class name merged into the page container. */ interface AdapterDetailPageProps { domain: AdapterDomain; onBack?: () => void; onConfigure?: (domain: AdapterDomain, config: DomainAdapterConfig) => Promise | void; className?: string; } /** * Renders the React adapter detail page for one adapter domain. * * @param props Page props including the selected domain and optional back-navigation handler. * @returns The detail view with provider health, available providers, and configuration affordances. */ declare function AdapterDetailPage(props: AdapterDetailPageProps): JSX.Element; /** * @module AdaptersPage * @package @geenius/adapters/react * @description Renders the Tailwind-based adapters overview for the React * package. The page summarizes adapter health, supports status filtering, and * provides an accessible modal workflow for configuring each adapter domain. */ type RegistryEntry = { domain: AdapterDomain; provider: string; status: AdapterStatusType; }; /** * Props accepted by the React adapters overview page. * * @property onNavigateDetail Optional callback used instead of opening the inline modal * @property onConfigure Optional callback invoked with submitted adapter configuration * @property className Optional class name merged onto the page root * @property configByDomain Optional configuration snapshot used to hydrate modal forms * @property registryEntries Optional adapter registry snapshot rendered above the grid */ interface AdaptersPageProps { onNavigateDetail?: (domain: AdapterDomain) => void; onConfigure?: (domain: AdapterDomain, config: DomainAdapterConfig) => Promise | void; className?: string; configByDomain?: Partial>; registryEntries?: RegistryEntry[]; } /** * Renders the adapter management dashboard for the React variant. * * @param props Page props controlling navigation overrides and registry data * @returns A dashboard with status filters, adapter cards, and a modal editor * @example * ```tsx * navigate(`/adapters/${domain}`)} /> * ``` */ declare function AdaptersPage(props: AdaptersPageProps): JSX.Element; /** * @module index * @package @geenius/adapters/react * @description Implements the React adapter provider and context access * helpers. This module owns adapter status initialization for the React * runtime package while keeping the shared package framework-agnostic. */ type AnyAdapter = DbAdapter | AuthAdapter | PaymentsAdapter | AiAdapter | FileStorageAdapter | AdminAdapter | LoggerAdapter; type AdapterForDomain = D extends "db" ? DbAdapter : D extends "auth" ? AuthAdapter : D extends "payments" ? PaymentsAdapter : D extends "ai" ? AiAdapter : D extends "storage" ? FileStorageAdapter : D extends "admin" ? AdminAdapter : D extends "logger" ? LoggerAdapter : never; type AdapterByDomain = { [D in AdapterDomain]: AdapterForDomain; }; type ResolvedAdapterSet = AdapterByDomain & { fileStorage: FileStorageAdapter; }; /** * React adapter bag keyed by domain. * * @property db Database adapter implementation when configured. * @property auth Authentication adapter implementation when configured. * @property payments Payments adapter implementation when configured. * @property ai AI adapter implementation when configured. * @property storage File-storage adapter implementation when configured. * @property fileStorage File-storage adapter alias accepted by the public React provider. * @property admin Admin adapter implementation when configured. * @property logger Logger adapter implementation when configured. */ interface AdapterSet extends Partial> { db?: DbAdapter; auth?: AuthAdapter; payments?: PaymentsAdapter; ai?: AiAdapter; storage?: FileStorageAdapter; fileStorage?: FileStorageAdapter; admin?: AdminAdapter; logger?: LoggerAdapter; } /** Registry shape accepted by the public React provider. */ type AdapterRegistry = AdapterSet; /** * React adapter context value exposed to hooks and provider consumers. * * @property adapters Adapter bag passed into the provider. * @property statuses Current status record for each adapter domain. * @property getAdapter Returns a configured adapter for a specific domain or throws when missing. * @property isReady Reports whether a domain is configured and connected. * @property isLoading Indicates whether initial health checks are still running. */ interface AdapterContextValue { adapters: ResolvedAdapterSet; statuses: Record; getAdapter: (domain: K) => AdapterByDomain[K]; isReady: (domain: AdapterDomain) => boolean; isLoading: boolean; } /** * Per-domain custom health probe map accepted by the React adapter provider. * * Each key is an {@link AdapterDomain} and the value is a probe function that * receives the resolved adapter for that domain plus the full adapter set for * cross-domain assertions. The probe must return `void` or `Promise` — * throwing signals a health-check failure, which the provider surfaces as an * `"error"` status for that domain. * * @example * ```tsx * const healthProbes: AdapterHealthProbeMap = { * db: async (db) => { await db.count('users') }, * ai: async (ai) => { await ai.complete('ping') }, * } * * * {children} * * ``` */ type AdapterHealthProbeMap = Partial<{ [D in AdapterDomain]: (adapter: AdapterByDomain[D], adapters: ResolvedAdapterSet) => Promise | void; }>; /** * Props accepted by the React adapter provider. * * @property adapters Optional adapter bag made available to descendant hooks and components. * @property registry Optional registry alias for adapter overrides. * @property db Optional direct database adapter override. * @property auth Optional direct auth adapter override. * @property payments Optional direct payments adapter override. * @property ai Optional direct AI adapter override. * @property storage Optional direct file-storage adapter override. * @property fileStorage Optional public file-storage adapter alias. * @property admin Optional direct admin adapter override. * @property logger Optional direct logger adapter override. * @property children React subtree that should receive adapter context. * @property healthCheck Whether the provider should probe configured adapters on mount. * @property healthProbes Optional domain-specific health probes supplied by the host app. * @property statusOverrides Optional deterministic status overrides for tests and previews. * @property onError Optional typed error callback invoked when provider lifecycle checks fail. */ interface AdapterProviderProps extends Partial { adapters?: AdapterSet; registry?: Partial; children: ReactNode; healthCheck?: boolean; healthProbes?: AdapterHealthProbeMap; statusOverrides?: Partial, "domain">>>; onError?: (error: AdapterError) => void; } /** * Provides the React adapter context and optional health-check lifecycle. * * @param props Provider props including the adapter bag, child tree, and optional health-check settings. * @returns A React context provider that exposes adapters and derived status metadata. */ declare function AdapterProvider(props: AdapterProviderProps): JSX.Element; /** * Plural provider alias matching the public `@geenius/adapters/react` contract. */ declare const AdaptersProvider: typeof AdapterProvider; /** * Reads the React adapter context from the nearest provider. * * @returns The active adapter context value with adapters, statuses, and readiness helpers. * @throws {AdapterContextError} When called outside of an `` tree. */ declare function useAdapterContext(): AdapterContextValue; export { AdapterCard, type AdapterCardProps, AdapterConfigForm, type AdapterConfigFormProps, type AdapterContextValue, AdapterDetailPage, type AdapterDetailPageProps, type AdapterHealthProbeMap, AdapterList, type AdapterListProps, AdapterProvider, type AdapterProviderProps, type AdapterRegistry, type AdapterSet, AdapterStatusBadge, type AdapterStatusBadgeProps, AdaptersPage, type AdaptersPageProps, AdaptersProvider, cn, useAdapterContext, useAdapterStatus, useAdapterStatuses, useAdapters, useAdmin, useAi, useAuth, useAuthAdapter, useDb, useFileStorage, useIsAdapterReady, useLogger, usePayments, useStorage };