/** * Chat live: prima identificazione (email → link/codice), poi sessione. * * `entryUrl`: dove aprire la chat dopo l’accesso (es. `/#contatti`, widget https, wa.me). * `prechat`: invio richiesta con Formspree (`actionUrl`) o `mailto:` se l’URL è vuoto. * `prechat.openChatAfterSubmit`: se `true`, dopo invio riuscito apre subito `entryUrl` (es. prova interna); * con flusso token via email lasciare `false` e usare `successMessage`. */ import type { SupportedLocale } from './navigation'; /** Destinazione della chat dopo identificazione / click su «Entra» (path IT). */ const entryPath = '/#contatti'; // Esempio WhatsApp: `https://wa.me/TUO_NUMERO?text=` + encodeURIComponent('Ciao NexStudio...'); const chatShared = { /** Nuova scheda solo per link esterni (wa.me, widget, ecc.) */ openInNewTab: entryPath.startsWith('http'), prechat: { /** Formspree dedicato alla richiesta accesso chat — vuoto = prova `mailto` */ actionUrl: '', /** Se `actionUrl` è vuoto */ mailto: '', successRedirect: '', fieldName: 'name', fieldEmail: 'email', /** * Dopo POST Formspree riuscito: apri subito `entryUrl` (es. test con pagina contatti). * Con invio token via email da backend: `false`. */ openChatAfterSubmit: false, }, } as const; const entryUrlFor = (locale: SupportedLocale) => { if (entryPath.startsWith('http') || locale === 'it') return entryPath; if (entryPath.startsWith('/#')) return `/${locale}${entryPath}`; if (entryPath.startsWith('/')) return `/${locale}${entryPath}`; return entryPath; }; const chatCopyByLocale = { it: { linkTitle: 'Accesso alla chat NexStudio: stato canale, email di verifica e assistenza in più lingue.', availability: { badge: 'Operatore umano in orario · chatbot sempre attivo', body: 'In orario lavorativo un operatore NexStudio può intervenire in chat; all’ingresso il chatbot può raccogliere il contesto iniziale e smistare la richiesta. Fuori orario la conversazione può proseguire con il solo chatbot fino al rientro del team. Lo stato effettivo è indicato qui sopra prima di procedere.', }, prechat: { title: 'Prima della chat', intro: 'Per evitare attese inutili chiediamo l’indirizzo email a cui inviarti un link o un codice monouso per aprire la sessione in modo sicuro. Dopo la verifica potrai usare la chat dal canale che ti indicheremo.', nameLabel: 'Nome (facoltativo)', emailLabel: 'Email', submitLabel: 'Richiedi accesso alla chat', enterChatLabel: 'Ho ricevuto il messaggio — apri la chat', closeLabel: 'Chiudi', successMessage: 'Controlla la posta in arrivo: ti abbiamo inviato le istruzioni (link o codice) per entrare in chat. Se non vedi nulla, controlla anche lo spam.', notifySubject: 'Richiesta accesso chat — sito NexStudio', }, }, en: { linkTitle: 'NexStudio chat access: channel status, verification email, and multilingual support.', availability: { badge: 'Human operator during hours · chatbot always on', body: 'During business hours a NexStudio operator can join the chat; at entry the chatbot can gather initial context and route the request. Outside hours the conversation may continue with the chatbot alone until the team is back. The live status is shown above before you proceed.', }, prechat: { title: 'Before chat', intro: 'To avoid unnecessary waiting we ask for the email address where we can send a one-time link or code to open the session securely. After verification you can use chat on the channel we indicate.', nameLabel: 'Name (optional)', emailLabel: 'Email', submitLabel: 'Request chat access', enterChatLabel: 'I received the message — open chat', closeLabel: 'Close', successMessage: 'Check your inbox: we sent instructions (link or code) to enter the chat. If you see nothing, also check spam.', notifySubject: 'Chat access request — NexStudio website', }, }, th: { linkTitle: 'เข้าใช้งานแชท NexStudio: สถานะช่องทาง อีเมลยืนยัน และการช่วยเหลือหลายภาษา', availability: { badge: 'มีเจ้าหน้าที่ในเวลาทำการ · แชทบอตพร้อมตลอดเวลา', body: 'ในเวลาทำการ เจ้าหน้าที่ NexStudio สามารถเข้าร่วมแชทได้ และตอนเริ่มต้นแชทบอตอาจเก็บบริบทเบื้องต้นแล้วส่งต่อคำขอ นอกเวลาทำการ การสนทนาอาจดำเนินต่อด้วยแชทบอตจนกว่าทีมจะกลับมา สถานะจริงจะแสดงด้านบนก่อนดำเนินการต่อ', }, prechat: { title: 'ก่อนเริ่มแชท', intro: 'เพื่อลดการรอที่ไม่จำเป็น เราขอที่อยู่อีเมลสำหรับส่งลิงก์หรือรหัสแบบใช้ครั้งเดียวเพื่อเปิดเซสชันอย่างปลอดภัย หลังยืนยันแล้ว คุณจะใช้แชทผ่านช่องทางที่เราระบุได้', nameLabel: 'ชื่อ (ไม่บังคับ)', emailLabel: 'อีเมล', submitLabel: 'ขอเข้าใช้งานแชท', enterChatLabel: 'ได้รับข้อความแล้ว — เปิดแชท', closeLabel: 'ปิด', successMessage: 'โปรดตรวจสอบกล่องจดหมาย: เราได้ส่งคำแนะนำ (ลิงก์หรือรหัส) สำหรับเข้าแชทแล้ว หากไม่พบ ให้ตรวจสแปมด้วย', notifySubject: 'คำขอเข้าใช้งานแชท — เว็บไซต์ NexStudio', }, }, } as const; export const getChat = (locale: SupportedLocale) => { const copy = chatCopyByLocale[locale]; return { ...chatShared, entryUrl: entryUrlFor(locale), linkTitle: copy.linkTitle, availability: copy.availability, prechat: { ...chatShared.prechat, ...copy.prechat, }, }; }; /** Retro-compatibilità: fallback italiano. */ export const chat = getChat('it');