import type { AuthenticationChatOption, LoadPreviousSessionChatOption } from './types'; export function createPage({ instanceId, webhookUrl, showWelcomeScreen, loadPreviousSession, i18n: { en }, initialMessages, authentication, }: { instanceId: string; webhookUrl?: string; showWelcomeScreen?: boolean; loadPreviousSession?: LoadPreviousSessionChatOption; i18n: { en: Record; }; initialMessages: string[]; mode: 'test' | 'production'; authentication: AuthenticationChatOption; }) { const validAuthenticationOptions: AuthenticationChatOption[] = [ 'none', 'basicAuth', 'n8nUserAuth', ]; const validLoadPreviousSessionOptions: LoadPreviousSessionChatOption[] = [ 'manually', 'memory', 'notSupported', ]; const sanitizedAuthentication = validAuthenticationOptions.includes(authentication) ? authentication : 'none'; const sanitizedShowWelcomeScreen = !!showWelcomeScreen; const sanitizedLoadPreviousSession = validLoadPreviousSessionOptions.includes( loadPreviousSession as LoadPreviousSessionChatOption, ) ? loadPreviousSession : 'notSupported'; return ` Chat `; }