--- import { getChat } from '../data/home'; import type { SupportedLocale } from '../data/home/navigation'; const path = Astro.url.pathname; const localeMatch = path.match(/^\/(en|th)(\/|$)/); const currentLocale = (localeMatch?.[1] ?? 'it') as SupportedLocale; const chat = getChat(currentLocale); const pc = chat.prechat; const hasFormspree = typeof pc.actionUrl === 'string' && pc.actionUrl.length > 0; const nextUrl = typeof pc.successRedirect === 'string' && pc.successRedirect.length > 0 ? pc.successRedirect : ''; const notifySubject = typeof pc.notifySubject === 'string' && pc.notifySubject.length > 0 ? pc.notifySubject : ''; const model = { entryUrl: chat.entryUrl, openInNewTab: chat.openInNewTab, actionUrl: pc.actionUrl, mailto: pc.mailto, notifySubject: pc.notifySubject, successRedirect: pc.successRedirect, fieldName: pc.fieldName, fieldEmail: pc.fieldEmail, openChatAfterSubmit: pc.openChatAfterSubmit, }; ---