feat: welcome message, fix per_type save, add missing ciclos flows

- Show welcome_msg (button with "Ver menú") for all new sessions before category menu
- Fix saveConfig() AJAX to include per_type_menu DOM values so they survive individual saves
- Add welcome_menu field to General tab in admin (render + save)
- Add 'atras' command alias (→ show_main_menu)
- Add ciclos_plagas, ciclos_palm, ciclos_tratamientos flows to DB config
- Fix per_type in DB from [] to {} (proper JSON object)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-06-30 18:39:04 -05:00
co-authored by Claude Sonnet 4.6
parent e9bbf8efce
commit b288b07ff5
3 changed files with 31 additions and 2 deletions
+8 -1
View File
@@ -76,7 +76,14 @@ class NormalBot
return self::handleFlow($flows[$currentNode], $context, $company, $ctxId, $menus);
}
// 4. Per-type greeting menu — only for brand-new sessions (currentNode === null)
// 4. Welcome message — shown once for brand-new sessions before the category menu
$welcomeMenuKey = $config['welcome_menu'] ?? null;
if ($welcomeMenuKey && $currentNode === null && isset($menus[$welcomeMenuKey])) {
ConversationContext::updateNode($ctxId, '__greeted');
return self::buildMenuResponse($menus[$welcomeMenuKey], $context['from'], $company);
}
// 4b. Per-type greeting menu — only for brand-new sessions (currentNode === null)
$greetingMenuKey = $perType['greeting_menu'] ?? null;
if ($greetingMenuKey !== null && $currentNode === null && isset($menus[$greetingMenuKey])) {
ConversationContext::updateNode($ctxId, '__greeted'); // sentinel: evita re-envío del menú