diff --git a/src/app/icon.tsx b/src/app/icon.tsx new file mode 100644 index 0000000..7304679 --- /dev/null +++ b/src/app/icon.tsx @@ -0,0 +1,45 @@ +import { ImageResponse } from "next/og"; + +// Replaces the default Next.js favicon with the WaCRM mark — emerald +// rounded square + white chat-bubble glyph — matching the sidebar +// logo in `src/components/layout/sidebar.tsx`. Next.js renders this +// at build time and auto-injects into . +// +// This route takes precedence over src/app/favicon.ico, which is the +// Next.js default and can stay on disk harmlessly (or be removed). + +export const runtime = "edge"; +export const size = { width: 32, height: 32 }; +export const contentType = "image/png"; + +export default function Icon() { + return new ImageResponse( + ( +
+ + + +
+ ), + { ...size }, + ); +} diff --git a/src/components/settings/template-manager.tsx b/src/components/settings/template-manager.tsx index 70d9a77..727541d 100644 --- a/src/components/settings/template-manager.tsx +++ b/src/components/settings/template-manager.tsx @@ -53,15 +53,43 @@ interface TemplateFormData { footer_text: string; } +// Meta's language codes are exact — "en" and "en_US" are distinct and a +// template approved under one will be rejected if you send with the other +// (Graph API error #132001 "Template name does not exist in the +// translation"). Default to en_US to match the DB default on +// message_templates.language and the broadcasts sender's fallback. const emptyForm: TemplateFormData = { name: '', category: 'Marketing', - language: 'en', + language: 'en_US', body_text: '', header_type: '', footer_text: '', }; +// Common Meta template language codes. The field still accepts any +// string — this just offers autocomplete for the usual suspects. Full +// list: https://developers.facebook.com/docs/whatsapp/api/messages/message-templates#supported-languages +const COMMON_LANGUAGE_CODES = [ + 'en_US', + 'en_GB', + 'en', + 'es', + 'es_ES', + 'es_MX', + 'fr', + 'fr_FR', + 'de', + 'it', + 'pt_BR', + 'pt_PT', + 'nl', + 'pl', + 'ru', + 'tr', + 'lt', +]; + export function TemplateManager() { const supabase = createClient(); const { user, loading: authLoading } = useAuth(); @@ -123,7 +151,7 @@ export function TemplateManager() { user_id: user.id, name: form.name.trim(), category: form.category, - language: form.language.trim() || 'en', + language: form.language.trim() || 'en_US', body_text: form.body_text.trim(), header_type: form.header_type || null, footer_text: form.footer_text.trim() || null, @@ -285,11 +313,22 @@ export function TemplateManager() {
setForm({ ...form, language: e.target.value })} className="bg-slate-800 border-slate-700 text-white placeholder:text-slate-500" /> + + {COMMON_LANGUAGE_CODES.map((code) => ( + +

+ Must match the exact language code the template is approved + under on Meta — e.g. en_US and en{' '} + are distinct. +