import type { ActionId, ProfileId, TenantId } from './ids.js'; export type ActionAudience = 'guest' | 'agent' | 'both'; export type ActionSurface = 'toolbar' | 'inline' | 'quick_reply'; export interface ActionInputField { name: string; label: string; type: 'text' | 'number' | 'date' | 'select'; required?: boolean; options?: string[]; } export type TerminalEffect = { type: 'webhook'; url: string; } | { type: 'state_transition'; target: 'conversation' | 'subject'; toState: string; } | { type: 'bot'; } | { type: 'builtin'; name: string; }; export type ActionEffect = TerminalEffect | { type: 'form'; fields: ActionInputField[]; then: TerminalEffect; }; export type ActionResult = { kind: 'system_message'; template?: string; } | { kind: 'card'; } | { kind: 'state_badge'; } | { kind: 'none'; }; export interface ActionDef { id: ActionId; label: string; icon?: string; confirm?: boolean; audience: ActionAudience; surface: ActionSurface; availableInStates?: string[]; effect: ActionEffect; result: ActionResult; } export interface ManifestAction { id: ActionId; label: string; icon?: string; confirm?: boolean; audience: ActionAudience; surface: ActionSurface; availableInStates?: string[]; input?: ActionInputField[]; } /** Project an internal action to its client-safe manifest form. */ export declare function toManifestAction(a: ActionDef): ManifestAction; /** Operating hours slot: 0=Sun … 6=Sat, times in "HH:MM" 24h local. */ export interface OperatingHoursSlot { day: 0 | 1 | 2 | 3 | 4 | 5 | 6; open: string; close: string; } export interface BehaviorProfile { id: ProfileId; tenantId: TenantId; name: string; actions: ActionDef[]; defaults: { greeting?: string; theme?: { accent: string; }; e2e?: boolean; persona?: string; /** Paid-tier flag: when true, hides the "Powered by Relay" footer in the widget. */ whiteLabel?: boolean; /** White-label: serve/embed the widget from this hostname (e.g. * "chat.acmeco.com"). Allowed automatically as a CORS origin for the * control-plane API so the widget works from the custom domain. */ customDomain?: string; }; states: string[]; initialState: string; version: number; welcomeMessage?: string; operatingHours?: OperatingHoursSlot[]; offlineMessage?: string; /** Base64-encoded ECDSA P-256 SPKI public key. When set, guest tokens must be * signed JWTs — unsigned opaque tokens are rejected. */ guestPublicKey?: string; createdAt: number; updatedAt: number; }