-
Notifications
You must be signed in to change notification settings - Fork 40
feat(manager): adiciona mergeBrazilContacts, corrige signDelimiter, add Toast no botão Reiniciar da instancia todos com as traduções #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideImplements user feedback toasts on instance restart and adds a new mergeBrazilContacts toggle to the Chatwoot configuration form, including corresponding i18n strings. Sequence diagram for instance restart with success/error toast feedbacksequenceDiagram
actor User
participant DashboardInstance
participant InstanceService as restartService
participant Toast
User->>DashboardInstance: clickRestartButton(instanceName)
DashboardInstance->>InstanceService: restart(instanceName)
DashboardInstance->>InstanceService: reloadInstance()
alt restartSuccess
DashboardInstance->>Toast: toast.success(t(instance.dashboard.toast.restart.success))
else restartError
DashboardInstance->>Toast: toast.error(t(instance.dashboard.toast.restart.error))
end
Toast-->>User: displayToast(autoDismiss=3s)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes - here's some feedback:
- In the restart handler, consider adding a
finallyblock (or shared helper) so any future UI state changes (e.g., loading indicators, button disable/enable) are consistently reset regardless of success or error, instead of only handling toasts intry/catch. - The new
FormSwitchuses themergeBrazilContactsfield name while the description and feature name mentionmergeBrazil; double-check the field naming aligns with the backend/DTO property to avoid silent mismatch when persisting this value.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In the restart handler, consider adding a `finally` block (or shared helper) so any future UI state changes (e.g., loading indicators, button disable/enable) are consistently reset regardless of success or error, instead of only handling toasts in `try/catch`.
- The new `FormSwitch` uses the `mergeBrazilContacts` field name while the description and feature name mention `mergeBrazil`; double-check the field naming aligns with the backend/DTO property to avoid silent mismatch when persisting this value.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Sobre o finally block: O código já implementa o padrão recomendado usando o callback onSettled da mutation, que funciona exatamente como um finally block: await createChatwoot( O onSettled é chamado após onSuccess ou onError, garantindo que o estado da UI seja resetado consistentemente. Este é o padrão recomendado pelo React Query/TanStack Query para gerenciamento de estado de loading em mutations. Não há handler de "restart" neste arquivo - o comentário parece ser genérico ou aplicável a outro componente. |
📋 Description
Este PR adiciona duas melhorias na interface do Evolution Manager:
Toast de Sucesso/Erro: Implementa feedback visual ao usuário após reiniciar uma instancia que antes tava sem aparecer nada, melhorando a UX ao confirmar se a operação foi bem-sucedida ou se houve erro.
Campo mergeBrazil: Adiciona checkbox no formulário de configuração do Chatwoot para habilitar/desabilitar a funcionalidade de merge de contatos brasileiros (unifica números com/sem 9º dígito).
Correção do bug no campo signDelimiter
Problema:
O campo
signDelimiterestava enviandonullpara a API mesmo quando o usuário preenchia o valor\nou deixava vazio, causando problemas na formatação das mensagens assinadas no Chatwoot.Solução:
.trim()para remover espaços em branco desnecessários\nquando o campo estiver vazionullComportamento após correção:
\n(padrão)\n→ envia\ncorretamente-) → envia o valor digitado\npara quebra de linha real nas mensagensAgora o delimitador de assinatura funciona corretamente em todas as situações.
🔗 Related Issues
N/A (melhoria de UX não vinculada a issue específica)
🧪 Type of Change
[x] ✨ New feature (non-breaking change which adds functionality)
[x] 🎨 Style/UI changes
🧪 Testing
Test Environment
[x] Local development
[ ] Staging environment
[ ] Production-like environment
Test Cases
[x] Manual testing completed
[x] Cross-browser testing (if applicable)
Test Instructions
Testando Toast de Feedback:
Acesse a página da instância
Clique no Botão "Reiniciar"
Verifique se aparece toast verde de sucesso no canto superior direito
Teste com dados inválidos para verificar toast vermelho de erro
Testando campo mergeBrazil:
Acesse a página de configuração do Chatwoot

Localize o checkbox "Merge Brazil" no formulário
Marque/desmarque a opção
Salve a configuração
Verifique se o valor é persistido corretamente ao recarregar a página
📸 Screenshots
Before
Sem feedback visual após salvar (usuário não sabia se salvou)
Campo mergeBrazil não existia no formulário
After
Toast de sucesso/erro aparece após salvar
Checkbox mergeBrazil disponível no formulário

✅ Checklist
Code Quality
[x] My code follows the project's style guidelines
[x] I have performed a self-review of my code
[x] My changes generate no new warnings or errors
[x] I have run npm run lint and fixed any issues
Testing
[x] I have tested the changes in multiple browsers (if applicable)
[x] New and existing unit tests pass locally with my changes
Documentation
[x] I have commented my code, particularly in hard-to-understand areas
Internationalization
[x] I have added translations for new text strings (mergeBrazil label)
Breaking Changes
[ ] This PR introduces breaking changes
📝 Additional Notes
Toast Implementation:
Utiliza biblioteca de toast já presente no projeto
Timeout de 3 segundos para auto-dismiss
Cores seguem o padrão do design system (verde=sucesso, vermelho=erro)
mergeBrazil Feature:
Quando habilitado, unifica contatos brasileiros que diferem apenas no 9º dígito
Útil para evitar conversas duplicadas no Chatwoot
Padrão: desabilitado (backward compatible)
🤝 Reviewer Guidelines
Focus Areas
[x] Code logic and correctness
[x] User experience
[x] Browser compatibility
Testing Checklist for Reviewers
[ ] Pull and test the branch locally
[ ] Verify the fix/feature works as described
[ ] Check for edge cases
[ ] Verify no regressions in existing functionality
Summary by Sourcery
Add user feedback to instance restart actions and expose a new Chatwoot configuration option for merging Brazilian contacts.
New Features: