UNPKG

@memberjunction/react-runtime

Version:

Platform-agnostic React component runtime for MemberJunction. Provides core compilation, registry, and execution capabilities for React components in any JavaScript environment.

99 lines 2.75 kB
import { ComponentLibraryEntity } from '@memberjunction/core-entities'; import { ComponentLibraryDependency, ComponentStyles } from '@memberjunction/interactive-component-types'; export interface CompiledComponent { component: any; id: string; name: string; compiledAt: Date; warnings?: string[]; } export interface CompileOptions { componentName: string; componentCode: string; styles?: ComponentStyles; production?: boolean; babelPlugins?: string[]; babelPresets?: string[]; libraries?: ComponentLibraryDependency[]; allLibraries: ComponentLibraryEntity[]; } export interface RegistryEntry { component: any; metadata: ComponentMetadata; lastAccessed: Date; refCount: number; } export interface ComponentMetadata { id: string; name: string; version: string; namespace: string; registeredAt: Date; tags?: string[]; } export interface ComponentError { message: string; stack?: string; componentName: string; phase: 'compilation' | 'registration' | 'render' | 'runtime'; details?: any; } export interface ComponentProps { data: any; userState: any; utilities: any; callbacks: ComponentCallbacks; components?: Record<string, any>; styles?: ComponentStyles; onStateChanged?: (stateUpdate: Record<string, any>) => void; } export interface ComponentCallbacks { RefreshData?: () => void; OpenEntityRecord?: (entityName: string, key: any) => void; UpdateUserState?: (state: any) => void; NotifyEvent?: (event: string, data: any) => void; } export interface CompilerConfig { babel: { presets: string[]; plugins: string[]; }; minify: boolean; sourceMaps: boolean; cache: boolean; maxCacheSize: number; } export interface RegistryConfig { maxComponents: number; cleanupInterval: number; useLRU: boolean; enableNamespaces: boolean; } export interface CompilationResult { success: boolean; component?: CompiledComponent; error?: ComponentError; duration: number; size?: number; } export interface RuntimeContext { React: any; ReactDOM?: any; libraries?: Record<string, any>; utilities?: Record<string, any>; } export interface ComponentLifecycle { beforeMount?: () => void; afterMount?: () => void; beforeUpdate?: (prevProps: any, nextProps: any) => void; afterUpdate?: (prevProps: any, currentProps: any) => void; beforeUnmount?: () => void; } export interface ErrorBoundaryOptions { onError?: (error: Error, errorInfo: any) => void; fallback?: any; logErrors?: boolean; recovery?: 'retry' | 'reset' | 'none'; } export * from './library-config'; //# sourceMappingURL=index.d.ts.map