/** * Template system contracts. Core sends TemplateConfig; SDK registers TemplateRegistryEntry per template. * Core has ZERO awareness of template internals. */ /** * What Core sends to the SDK at init time. * Core only passes this shape; it does not know about template internals. */ /** Full template visual variant (luna | erebus | neptune). */ export type FullVariant = 'luna' | 'erebus' | 'neptune'; /** @deprecated Use FullVariant. */ export type FullPageStyle = FullVariant; import type { WidgetFeatureOverrides } from '@/types/features'; import type { WidgetAccessToken } from '@/widget/auth/accessToken'; import type { WidgetScope } from '@/chat'; import type { WidgetSessionConfig } from '@/widget/types/session'; export interface TemplateConfig { template: string; theme?: Record; flowId: string; deploymentId?: string; /** Preview/trial mount (e.g. Core's deployment wizard Review step): no server session reads/writes, isolated localStorage. */ previewMode?: boolean; displayMode?: string; /** Full template: visual variant (default luna). */ variant?: FullVariant; /** @deprecated Use variant. Kept for backward compat. */ fullPageStyle?: FullVariant; /** Full template: true = sidebar layout, false = no sidebar + History button top-right. */ withSidebar?: boolean; /** Feature switches; only `false` has an effect. See `BotProps.features`. */ features?: WidgetFeatureOverrides; /** `'en'` (default) or `'ar'`. See `BotProps.language`. */ language?: string; /** The signed-in user's TORUK access token, or a function returning it. See `BotProps.accessToken`. */ accessToken?: WidgetAccessToken; /** Pin the widget to one conversation. See `BotProps.session`. */ session?: WidgetSessionConfig; /** Which part of the conversation to render. See `BotProps.scope`. */ scope?: WidgetScope; assistantName?: string; apiHost?: string; onRequest?: (request: RequestInit) => Promise; chatflowConfig?: Record; } /** * What the SDK registers for each template. * Contains the component factory and template-owned default theme. */ export interface TemplateRegistryEntry { /** The SolidJS component that renders this template */ component: (props: any) => any; /** Template-owned default theme (SDK-side, NOT from Core) */ defaultTheme: Record; } /** * How a template is displayed (popup, full-screen, embedded). * Wraps the template component with display-specific behavior. */ export interface DisplayStrategyEntry { /** Wrapper component that receives the inner template + config */ wrapper: (props: { children: any; config: TemplateConfig; }) => any; }