import { ReactNode } from 'react'; /** * Where a Mordn action is handled. Keep this small and explicit: browser-local * UI work, the host's createChatHandler server, or a hosted/server-side action * plane. Payloads are always untrusted until the chosen handler validates them. */ type MordnActionHandler = 'client' | 'server' | 'hosted'; /** How an action should mark the UI while it is in flight. */ type MordnActionLoadingBehavior = 'auto' | 'none' | 'self' | 'container'; /** How much confirmation a consequential action requires before execution. */ type MordnActionConfirmationPolicy = 'none' | 'recommended' | 'required'; /** Optional risk hint for dashboards, docs, and confirmation cards. */ type MordnActionRiskLevel = 'ui' | 'read' | 'capture' | 'mutation' | 'regulated'; /** JSON-schema-lite shape used by manifests and hosted config without pulling a validator into the client bundle. */ interface MordnActionSchema { type?: 'object'; required?: string[]; properties?: Record; additionalProperties?: boolean; } interface MordnActionSchemaProperty { type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'; title?: string; description?: string; enum?: Array; default?: unknown; format?: 'email' | 'uri' | 'date' | 'date-time' | 'time' | 'tel'; items?: MordnActionSchemaProperty; properties?: Record; /** Mark fields that should be redacted from audit/event display. */ redact?: boolean; } /** * Declarative action config that can be attached to cards, chips, forms, or * host-rendered widgets. It intentionally mirrors ChatKit-style action ideas * while staying framework-neutral for Mordn's hosted/self-hosted modes. */ interface MordnActionConfig { /** Namespaced action type, e.g. ecommerce.cart.add or restaurant.reservation.request. */ type: string; /** Data supplied by the rendered UI. Treat as untrusted on the server. */ payload?: TPayload; /** Defaults to server for mutations, client for purely local UI when explicitly set. */ handler?: MordnActionHandler; /** Defaults to auto. */ loadingBehavior?: MordnActionLoadingBehavior; /** Defaults to none for read/UI actions; required for consequential mutations. */ confirmation?: MordnActionConfirmationPolicy; /** Stable client-generated key for duplicate-click / retry safety. */ idempotencyKey?: string; /** Optional display label used by dashboards and generic confirmation UI. */ label?: string; /** Risk hint used by templates and hosted policy. */ risk?: MordnActionRiskLevel; /** Optional analytics name; defaults to type. */ analyticsName?: string; /** Optional schema for form/dashboard generation. Server must still validate authoritatively. */ schema?: MordnActionSchema; } type MordnActionStatus = 'idle' | 'pending' | 'requires_confirmation' | 'requires_input' | 'success' | 'error'; interface MordnActionEvent { action: MordnActionConfig; /** Component or message item that emitted the action, when known. */ source?: string; /** Current form values merged by ActionForm/ActionCard. */ values?: Record; } interface MordnActionResult { status: MordnActionStatus; title?: string; message?: string; data?: TData; /** Optional next UI part/template state for a later renderer. */ ui?: unknown; errorCode?: string; } type MordnActionDispatcher = (event: MordnActionEvent) => void | Promise; type MordnTemplateVertical = 'docs' | 'lead-capture' | 'services-booking' | 'restaurant' | 'ecommerce' | 'travel' | 'support' | 'internal-ops' | (string & {}); interface MordnTemplateActionDefinition { type: string; label: string; description: string; handler?: MordnActionHandler; risk?: MordnActionRiskLevel; confirmation?: MordnActionConfirmationPolicy; schema?: MordnActionSchema; } interface MordnTemplateCardDefinition { type: 'entity-card' | 'entity-carousel' | 'action-form' | 'selection-group' | 'summary-card' | 'status-tracker' | 'handoff-card' | (string & {}); label: string; description: string; } interface MordnTemplateStarterPrompt { title: string; subtitle?: string; message?: string; } interface MordnTemplateManifest { id: string; name: string; description: string; vertical: MordnTemplateVertical; version: string; minWidgetVersion?: string; starterPrompts: MordnTemplateStarterPrompt[]; promptFragment?: string; cards: MordnTemplateCardDefinition[]; actions: MordnTemplateActionDefinition[]; recommendedKnowledge?: string[]; demoData?: Record; notes?: string[]; } interface MordnActionPrimitiveProps { action?: MordnActionConfig; onAction?: MordnActionDispatcher; disabled?: boolean; loading?: boolean; } interface MordnEntityAttribute { label: string; value: ReactNode; } interface MordnEntityAction { label: string; action?: MordnActionConfig; href?: string; variant?: 'primary' | 'secondary' | 'ghost'; } interface MordnEntityItem { id: string; title: string; subtitle?: string; description?: ReactNode; imageUrl?: string; price?: string; badge?: string; attributes?: MordnEntityAttribute[]; actions?: MordnEntityAction[]; } interface MordnStatusStep { id: string; label: string; description?: string; status?: 'complete' | 'current' | 'pending' | 'error'; } declare const docsAssistantTemplate: MordnTemplateManifest; declare const leadCaptureTemplate: MordnTemplateManifest; declare const servicesBookingTemplate: MordnTemplateManifest; declare const restaurantAssistantTemplate: MordnTemplateManifest; declare const ecommerceConciergeTemplate: MordnTemplateManifest; declare const travelPlannerTemplate: MordnTemplateManifest; declare const defaultMordnTemplates: MordnTemplateManifest[]; declare function getMordnTemplate(id: string): MordnTemplateManifest | undefined; export { type MordnActionConfig, type MordnActionConfirmationPolicy, type MordnActionDispatcher, type MordnActionEvent, type MordnActionHandler, type MordnActionLoadingBehavior, type MordnActionPrimitiveProps, type MordnActionResult, type MordnActionRiskLevel, type MordnActionSchema, type MordnActionSchemaProperty, type MordnActionStatus, type MordnEntityAction, type MordnEntityAttribute, type MordnEntityItem, type MordnStatusStep, type MordnTemplateActionDefinition, type MordnTemplateCardDefinition, type MordnTemplateManifest, type MordnTemplateStarterPrompt, type MordnTemplateVertical, defaultMordnTemplates, docsAssistantTemplate, ecommerceConciergeTemplate, getMordnTemplate, leadCaptureTemplate, restaurantAssistantTemplate, servicesBookingTemplate, travelPlannerTemplate };