90 Commits
Author SHA1 Message Date
Ian CoutoandClaude Opus 5.5 899dd8c1d0 feat(followup): gatilho quando o negócio nasce
O lead criado por uma conversa não emitia lead.created, então nenhum fluxo
podia começar nesse momento. O seletor passa a oferecer Lead criado.

Recorte do PR #1471 (branch develop do fork de @IanCouto): só o gatilho
"Lead criado". A infraestrutura de deploy da VPS do fork
(.github/scripts/deploy-vps-develop.sh, .github/workflows/deploy-vps-develop.yml,
tests/unit/deploy-vps-develop.test.ts e as entradas dela em
workflows-tem-permissions e gatilho-dos-jobs-de-entrega) fica fora: é da
VPS dele, não do produto.

Refs: #1471
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N9fyW7pXJCsyDPtu5PoQpN
2026-09-22 23:02:19 -03:00
Ian Couto b20beec61f Merge branch 'melgarafael:main' into develop 2026-09-21 08:03:29 -03:00
Ian Couto 7b6f1cf38d Merge branch 'melgarafael:main' into develop 2026-09-20 18:09:52 -03:00
Ian Couto f90f236aaa fix(followup): uma resposta do lead nao dispara o fluxo inteiro
Occupancy de wait_started recem-estacionado nao e timeout; inbound_woke sem texto desta pergunta permanece na espera; o kick acorda a espera existente antes de aplicar o texto.
2026-09-20 16:47:09 -03:00
Ian Couto 36827ea36a fix(followup): a resposta do lead desbloqueia o próximo passo do fluxo
O wait_started ocupava a chave do passo; o tick da resposta era descartado e o inbound sumia no updated_at do wake.
2026-09-20 16:25:26 -03:00
Ian Couto ff000579a9 ci(fork): devolve o deploy da develop na VPS
Sem o workflow, a develop deste fork não publica imagem nem atualiza o servidor. Restaura o caminho que a VPS já usa.
2026-09-20 13:05:37 -03:00
Ian Couto dc99f92512 feat(followup): texto fixo dispara sem agente de IA
Grafo sem nó de modelo enrolla com agent_id nulo; classificação, espera smart e ai_message continuam exigindo agente publicado.
2026-09-20 12:59:06 -03:00
Ian Couto b90c641ff4 fix(ci): tira o deploy da VPS deste fork do PR
A cerca de gatilhos reprova job que nao esta no mapa. Esse workflow e customizacao do fork e o proprio arquivo pede para nao ir ao upstream.
2026-09-20 12:12:16 -03:00
Ian Couto 4a12a366d3 Merge remote-tracking branch 'origin/develop' into develop 2026-09-20 11:45:52 -03:00
Ian Couto d12ac3405d feat(followup): duplicar e renomear um fluxo pela lista
A copia nasce rascunho com o mesmo desenho; o nome interno muda sem republicar.
2026-09-20 11:45:36 -03:00
Ian Couto 9211a2d8d5 Merge branch 'melgarafael:main' into develop 2026-09-20 11:16:57 -03:00
Ian Couto 435c6174db fix(i18n): hora já existia no dicionário — a chave duplicada derrubava o build da VPS 2026-09-20 10:30:43 -03:00
Ian Couto 5e7a4ea638 ci(fork): devolver o deploy da develop na VPS depois do merge da main
O sync com a 1.41.0 apagou o workflow deste fork; sem ele o push não publica as imagens :develop nem atualiza o servidor.
2026-09-20 10:21:30 -03:00
Ian Couto 5bb4f2a2ce Merge branch 'melgarafael:main' into develop 2026-09-20 10:17:01 -03:00
Ian Couto 0b07bd0eef feat(followup): o cliente que volta dispara um fluxo, sem a IA por cima
Silêncio cobrava enquanto o contato sumia; o gatilho Cliente voltou fala só quando ele escreve de novo, com texto fixo neste request.
2026-09-20 10:06:36 -03:00
Ian Couto d8287797b5 Merge branch 'melgarafael:main' into develop 2026-09-18 18:48:36 -03:00
Ian Couto 2e1ecfe4bd Merge branch 'main' of https://github.com/IanCouto/DeskcommCRM into develop
# Conflicts:
#	app/app/agenda/_client.tsx
#	supabase/baseline.sql
2026-09-18 09:12:52 -03:00
Ian Couto 155b2308fb fix(agenda): o e-mail da ficha não derruba o Google, e o campo do cliente volta a ser o rotulado
O lint recusava ler ref no render dos cartões de lembrete — e isso escondia a suíte unitária. A leitura de contacts.email estourava nos invariantes (cliente só com rpc) e o Meet nascia failed. O rótulo 'Quem será atendido' não apontava para o input com o id do contato.
2026-09-18 08:56:15 -03:00
Ian Couto 79bfcd5aff Merge branch 'melgarafael:main' into develop 2026-09-17 20:56:06 -03:00
Ian Couto 38ac9f6473 Merge branch 'melgarafael:main' into develop 2026-09-17 19:26:34 -03:00
Ian Couto d5efd698a5 feat(agenda): enable scheduling beyond 30 days in calendar
Introduced a new feature that allows users to schedule appointments up to two months in advance. The calendar now dynamically adjusts to the visible month, ensuring that users can see available slots without the previous limitation of a 30-day window. Updated related components and added tests to verify the new functionality. Documentation has been updated to reflect these changes.
2026-09-17 19:04:35 -03:00
Ian Couto 483b859e66 feat(agenda): include client email in Google Calendar invites
Now, when scheduling an appointment, the client's email from their profile will receive a Google Calendar invite alongside any external guests. This change ensures that clients are notified via email, improving communication. Existing appointments will sync the client email in the next update. Updated related documentation and comments for clarity.
2026-09-17 18:28:49 -03:00
Ian Couto aae2a12cd1 Merge branch 'main' of https://github.com/IanCouto/DeskcommCRM into develop
# Conflicts:
#	supabase/baseline.sql
2026-09-17 17:57:37 -03:00
Ian Couto 22c9a1dbd3 feat(agenda): lembrete por degrau e endereços salvos da org
Cada aviso do tipo leva o próprio texto, e o endereço da marcação passa a ser lista da organização — quem marca não redigita o mesmo lugar.
2026-09-17 13:37:43 -03:00
Ian Couto d4a76b4155 feat(agenda): melhora na edição do tipo de agendamento para maior clareza
O formulário de edição foi reorganizado para separar claramente os campos de nome, duração e responsável dos campos de aviso no WhatsApp. Agora, os lembretes são apresentados em uma seção distinta, facilitando a leitura e a usabilidade. Além disso, foram adicionados testes para garantir que a disposição dos campos esteja correta.
2026-09-17 12:29:03 -03:00
Ian Couto f50e988521 feat(agenda): um só campo para escolher o cliente ao marcar
Busca e lista faziam a mesma pergunta; o painel passa a filtrar e escolher no mesmo combobox.
2026-09-17 12:11:19 -03:00
Ian Couto 5a23e11f85 Merge branch 'develop' into feat/mensagem-lembrete-no-tipo 2026-09-17 12:08:45 -03:00
Ian Couto 6146539da7 feat(agenda): o tipo de agendamento aceita texto próprio no lembrete
A frase do aviso no WhatsApp deixa de ser só a padrão do cron: quem edita o tipo escreve o texto, com {{nome}}, {{titulo}}, {{dia}}, {{hora}} e {{endereco}}. Em branco, continua a frase de antes.
2026-09-17 12:08:35 -03:00
Ian Couto 26ed2f178a feat(agenda): endereço e observação na hora de marcar 2026-09-17 11:10:21 -03:00
Ian Couto 765e3de159 feat(agenda): endereço e observação na hora de marcar
Os campos já existiam no banco e no calendário; a tela de marcar não os coletava, e a API gravava observação em notes, que não é publicada.
2026-09-17 11:09:39 -03:00
Ian Couto 4dcdcb44b7 Merge branch 'melgarafael:main' into develop 2026-09-17 11:08:07 -03:00
Ian Couto 64ed9cbbf6 Merge branch 'melgarafael:main' into develop 2026-09-17 09:06:13 -03:00
Ian Couto 0f4638e6fd ci(fork): a develop volta a publicar as imagens na VPS
O sync com o upstream apagou o workflow que constrói :develop e faz pull na HostGator. Sem ele o push na develop não gera artefato e o servidor fica na versão antiga sem erro.
2026-09-17 08:03:32 -03:00
Ian Couto e8e57aff8d Merge branch 'melgarafael:main' into develop 2026-09-14 18:55:05 -03:00
Ian Couto f2bc4f56c6 Merge branch 'main' of https://github.com/IanCouto/DeskcommCRM into develop 2026-09-14 18:21:24 -03:00
Ian Couto 08f8cde07d Merge branch 'melgarafael:main' into develop 2026-09-14 17:18:30 -03:00
Ian Couto e7435b2987 feat(followup): update followup_stale error handling to prevent infinite retries
The `followup_stale` error now raises a `P0001` instead of `40001`, which previously caused clients to retry indefinitely, leading to high CPU usage. This change includes updates to the follow-up engine and database functions to reflect the new error handling. Additionally, tests have been added to ensure the new behavior is enforced and that the system no longer attempts retries for permanent errors.
2026-09-14 17:08:00 -03:00
Ian Couto ce8dcff03c fix(ci): o git da VPS puxa a develop sem pedir usuário
Bearer no extraHeader fazia o fetch cair no prompt e o job morrer
depois do backup, com as imagens já publicadas.
2026-09-14 16:20:17 -03:00
Ian Couto 0d56830993 ci(fork): a develop chega na VPS sem construir lá
O GitHub constrói as três imagens e o servidor só puxa. Sem este
commit o canal da develop não liga.
2026-09-14 16:07:55 -03:00
Ian Couto e14fd8ea02 Merge branch 'melgarafael:main' into develop 2026-09-14 15:58:01 -03:00
Ian Couto 0670744532 Merge branch 'melgarafael:main' into develop 2026-09-14 15:09:31 -03:00
Ian Couto 1d86ce8939 Merge branch 'melgarafael:main' into develop 2026-09-14 14:13:43 -03:00
Ian Couto 04b4928ff3 Merge branch 'fix/criar-canal-qr-code' of https://github.com/IanCouto/DeskcommCRM into develop 2026-09-14 07:47:29 -03:00
Ian Couto d19f681b33 Merge pull request #8 from IanCouto/chore/vercel-pro-crons
feat: add enviarTextoFixoPendente to followup-flow-worker cron job
2026-09-13 11:00:02 -03:00
Ian Couto e073965868 feat: add enviarTextoFixoPendente to followup-flow-worker cron job
This update integrates the enviarTextoFixoPendente function into the followup-flow-worker, ensuring that pending fixed text is drained to prevent messages from getting stuck in a pending state. Additionally, tests have been updated to verify the correct invocation of this function under various scenarios.
2026-09-13 10:58:53 -03:00
Ian Couto a55416dc31 fix: crons do Pro entram no vercel.ts, nao num json ao lado
O deploy anterior caiu com 'Multiple configuration files found'. A lista completa fica no vercel.ts, que ja era o arquivo canonico.
2026-09-13 10:03:04 -03:00
Ian Couto e825a1a77b fix: no Pro da Vercel os crons de minuto passam a rodar
O follow-up ficava preso em waiting_reply porque so o cron diario de LGPD estava registrado. vercel.json na raiz agenda a mesma cadencia do scheduler, e o CRON_SECRET nativo deixa de tomar 403.
2026-09-13 10:01:24 -03:00
Ian Couto 51f2b4f734 Merge upstream/main into fix/criar-canal-qr-code
A main ja encurtava o nome da sessao WAHA no banco (0232, org_<8>_<32>).
Mantem esse SQL e o encurtamento no app, sem duplicar a migration.
2026-09-13 08:33:38 -03:00
Ian Couto 49e9bf7207 feat(waha): implement session name alignment to fit WAHA's 54 character limit
This update introduces a new function, alinharNomeAoTetoWaha, to ensure that session names conform to WAHA's maximum length requirement. The function generates a new session name if the current one exceeds the limit, preventing HTTP 400 errors during session creation. Additionally, tests have been added to validate the new naming constraints and ensure proper functionality across the application.
2026-09-12 10:52:29 -03:00
Ian Couto b73112728f test(e2e): o clique na aresta de follow-up deixa de cair debaixo do nó 2026-09-09 19:03:34 -03:00
Ian Couto df85ff4b08 feat(followup): organizar o canvas e excluir nó ou aresta sem apagar o fluxo 2026-09-09 17:53:30 -03:00
Ian Couto f380ca61bf Merge branch 'main' of https://github.com/IanCouto/DeskcommCRM into develop 2026-08-26 14:44:59 -03:00
Ian Couto b91afa2028 fix(ci): desbloquear verify e invariants do PR #346
ruleName faltava nos fixtures do ActionCtx; push_subscriptions entrava
com policy ALL sem role_at_least; o extrator de vocabulario lia o type
alias sem literais; o FakeQuery do webhook nao tinha .in(); e o kick
local quebrava o 200 da captacao depois do lead gravado.
2026-08-26 14:40:39 -03:00
Ian Couto 0fda528f1d feat(followup): enhance inbound message handling and tests
- Updated `inboundEhDestaPergunta` to utilize `enrollment.updated_at` for better message filtering.
- Modified `ultimoInboundDoContato` to return both message text and sent timestamp.
- Adjusted `aplicarTextoAosEnrollmentsEmEspera` to apply messages conditionally based on the new timestamp logic.
- Refactored tests to cover new behavior, ensuring proper handling of inbound messages without reusing old text.
- Improved test descriptions for clarity and added checks for message application logic.
2026-08-26 14:23:47 -03:00
Ian Couto 98adcf4afb chore: remove relogio workflow file
- Deleted the `relogio.yml` GitHub Actions workflow file, which was responsible for scheduling HTTP requests to a specified application. This file is no longer needed as part of the project configuration.
2026-08-26 14:04:48 -03:00
Ian Couto 95e3070b82 Merge branch 'develop' of https://github.com/IanCouto/DeskcommCRM into develop 2026-08-26 14:02:31 -03:00
Ian Couto 554486657d Merge branch 'main' of https://github.com/IanCouto/DeskcommCRM into develop 2026-08-26 14:02:13 -03:00
Ian Couto 86cb6b8da2 Merge pull request #6 from IanCouto/feat/inbox-campos-lead
feat(inbox): implement editable custom fields for leads in the conver…
2026-08-26 13:57:52 -03:00
Ian Couto 82a93229e9 feat(inbox): implement editable custom fields for leads in the conversation panel
- Enhanced the CRMSidePanel to display and edit custom fields for leads directly within the inbox conversation interface.
- Introduced a new InboxLeadEditor component to manage lead selection and custom field editing.
- Updated the CustomFieldsEditor to support dynamic class names and improved rendering of input fields based on lead data.
- Added functionality to save custom fields alongside lead updates, ensuring seamless integration with existing lead management processes.
- Implemented tests to validate the new functionality and ensure proper behavior of the custom fields editing feature.
2026-08-26 13:53:44 -03:00
Ian Couto bb785cc09d chore: remove out.txt containing application URLs
- Deleted `out.txt` as it was no longer needed for application configuration, streamlining the project structure.
2026-08-26 11:58:39 -03:00
Ian Couto 1633989698 feat(followup): implement action completion handling in enrollment processing
- Added `actionTurnCompleted` function to determine if an action has been completed based on event history.
- Updated `processNode` to advance enrollment when an action has been completed, preventing unnecessary rechecks.
- Enhanced tests for `actionTurnCompleted` and `processNode` to validate new behavior and ensure correct handling of action states.
- Introduced `out.txt` to store application URLs for easier configuration.
2026-08-26 11:58:25 -03:00
Ian Couto 4c3453a5ea fix(auth): allow Hobby clock tick through edge auth
/api/v1/system/relogio/tick authenticates with Bearer INTERNAL_SECRET
inside the route. Without a PUBLIC_PATHS entry the proxy returned 401
before the handler ran, so GitHub Actions could never advance follow-ups.
2026-08-26 08:43:31 -03:00
Ian Couto c68afd1a40 feat(relogio): enhance HTTP clock functionality and documentation
- Updated `relogio.yml` to clarify scheduling requirements and added concurrency settings for better job management.
- Introduced a new runbook `vercel-hobby-relogio.md` detailing setup instructions for external cron jobs and GitHub Actions.
- Enhanced `executarTickDoRelogio` to improve logging of follow-up advancements, ensuring better tracking of inbound responses.
- Added PowerShell and Bash scripts to facilitate the activation of the clock with necessary commands for GitHub Actions and cron-job.org.
- Implemented tests to validate the clock workflow and URL generation for external cron jobs, ensuring reliability in scheduled task execution.
2026-08-25 21:35:21 -03:00
Ian Couto f88aa227bf feat(followup): refactor text application for follow-ups and enhance tests
- Renamed `aplicarTextoNosFollowups` to `aplicarTextoAosEnrollmentsEmEspera` for clarity and updated its parameters to improve functionality.
- Introduced a new test suite for `aplicarTextoNosFollowups`, ensuring proper application of text to follow-ups and validating the expected behavior.
- Enhanced existing tests to verify the integration of the new text application logic, improving overall test coverage and reliability.
2026-08-25 19:23:27 -03:00
Ian Couto 249eedae08 refactor(followup): enhance matchNode function for flexible configuration
- Updated the `matchNode` function to accept an optional `extra` parameter, allowing for dynamic configuration of `FlowNode` properties.
- Simplified test cases by utilizing the updated `matchNode` function to create nodes with specific configurations, improving code readability and maintainability.
- Adjusted related tests to ensure correct behavior with the new flexible node creation approach.
2026-08-25 19:07:54 -03:00
Ian Couto 78d012d821 feat(relogio): implement HTTP clock functionality for scheduled tasks
- Introduced a new workflow `relogio.yml` to handle scheduled HTTP requests every 5 minutes, allowing for external triggering of tasks.
- Added a new endpoint `POST /api/v1/system/relogio/tick` to process clock ticks, supporting both admin session and bearer token authentication.
- Implemented task execution logic in `executarTickDoRelogio`, enabling the processing of follow-up tasks and event log drainage without relying on cron jobs.
- Enhanced audit logging for clock tick actions to track task execution and outcomes.
- Created tests for the clock functionality to ensure reliability and correctness of scheduled task processing.
2026-08-25 17:46:38 -03:00
Ian Couto b049106a63 feat(followup): implement DELETE endpoint for followup flows
- Added a DELETE endpoint to remove followup flows, including associated enrollments and versions, ensuring proper cascading deletion.
- Introduced `DeleteFollowupFlowButton` component for UI integration, allowing users to delete flows from the interface.
- Updated `FlowsList` to include the delete button for each flow, enhancing user experience.
- Implemented necessary hooks and error handling for the deletion process, including success and error notifications.
- Enhanced audit logging to track deletion actions for followup flows.
- Added tests to verify the functionality of the DELETE endpoint and its integration in the UI.
2026-08-25 14:48:39 -03:00
Ian Couto a14c43b423 refactor(pipeline): enhance local pipeline processing with contact-specific handling
- Updated `kickLocalPipeline` to accept an optional contact parameter, allowing for targeted processing of follow-ups for specific contacts.
- Modified `POST` request handling in `route.ts` to pass contact details to the pipeline, improving lead processing efficiency.
- Introduced `aplicarEfeitosPosEntrada` in the ingestion process to ensure follow-ups are correctly applied based on inbound messages, enhancing overall responsiveness.
- Enhanced unit tests to verify the new behavior and ensure proper handling of contact-specific follow-up actions.
2026-08-25 14:12:56 -03:00
Ian Couto d5a617d1d6 fix(followup): aplica a resposta do lead mesmo com cadastro duplicado pelo telefone
A captação e o WhatsApp geravam dois contatos (grafias do nono dígito BR); o enrollment ficava waiting_reply no cadastro errado e o job de confirmação reenviava a pergunta. Casa gêmeos de telefone no inbound, não avança match_reply no sent, e canoniza o número na ingestão.
2026-08-25 09:54:24 -03:00
Ian Couto 31349b8267 feat(followup): implement inbound text application to active follow-ups
- Added `aplicarTextoNosFollowups` function to apply inbound text to active follow-ups for a contact.
- Updated `kick-local-pipeline.ts` to handle errors when applying inbound text and waking up follow-ups, improving robustness.
- Introduced unit tests for `textoDoPayloadInbound` to ensure correct extraction of text from inbound payloads.
- Registered `followupReactivityHandler` to process inbound messages and apply text to follow-ups, enhancing event handling.
2026-08-25 08:49:53 -03:00
Ian Couto db63bb0a49 fix(followup): repair broken NodeResult import that failed the Vercel build 2026-08-24 20:09:21 -03:00
Ian Couto 438b1a2d20 feat(followup): enhance match reply handling with conditional logic
- Updated `MatchReplyForm` to include an `ifExists` state, allowing users to specify behavior when a value already exists (skip, overwrite, or confirm).
- Enhanced the `commit` function to handle the new `ifExists` parameter, ensuring proper processing of match replies based on user input.
- Modified the `describeNodeConfig` function to reflect the new conditional logic in the match reply configuration.
- Updated the `matchReplyConfigSchema` to validate the new `if_exists` field, ensuring correct schema enforcement.
- Enhanced unit tests to cover new scenarios for handling existing values in match replies, improving overall reliability.
2026-08-24 20:06:20 -03:00
Ian Couto aec9ac8c4b refactor(pipeline): enhance event acceleration and follow-up processing
- Updated `acelerarPipelineDeEventos` to accept an optional inbound parameter, allowing for targeted follow-up wake-up based on specific message context.
- Introduced `acordarFollowupPorInbound` to handle follow-up events more efficiently, improving responsiveness during inbound lead processing.
- Enhanced unit tests to verify the correct invocation of event acceleration with the new parameters, ensuring proper follow-up behavior.
2026-08-24 19:27:27 -03:00
Ian Couto 4f0a7f973a refactor(pipeline): enhance follow-up processing and error handling
- Updated `tickFollowupAteParar` to return the number of claimed jobs, improving tracking of processed follow-ups.
- Introduced `enviarTextoFixoPendente` to handle sending fixed messages without relying on cron jobs or agent workers.
- Enhanced error handling in message sending to ensure jobs return to pending status on failure, improving reliability.
- Adjusted `acelerarPipelineDeEventos` to iterate through follow-up ticks and fixed message sending, optimizing event processing.
2026-08-24 19:18:58 -03:00
Ian Couto 7dbe7b3516 refactor(webhooks): enhance lead processing and pipeline handling
- Updated comments in `route.ts` to clarify the lead capture process and its implications in production environments.
- Modified `kickLocalPipeline` to ensure immediate processing of events in Vercel's Hobby plan, addressing the lack of a cron job.
- Adjusted `enroll.ts` to omit `next_eval_at` during enrollment, allowing the database's default behavior to manage timing.
- Enhanced unit tests to reflect changes in enrollment behavior and ensure proper handling of lead processing.
2026-08-24 19:12:29 -03:00
Ian Couto 6186383c31 feat(followup): integrate event pipeline acceleration and enhance wait node handling
- Added `acelerarPipelineDeEventos` function to streamline event processing during inbound lead responses, improving responsiveness.
- Updated `kickLocalPipeline` to utilize the new event acceleration function.
- Enhanced `processNode` to allow early wake-up of wait nodes based on lead responses, ensuring timely follow-up actions.
- Added unit tests to verify the new behavior of wake-up conditions for wait nodes.
2026-08-24 18:07:58 -03:00
Ian Couto 1439c5431a refactor(tests): enhance fakePool query type definition for improved clarity
- Updated the type definition of the `query` function in the `fakePool` to return a more specific promise type, ensuring better type safety and clarity in unit tests.
- Added comments to clarify the behavior of SQL responses, enhancing the understanding of the test setup.
2026-08-24 17:52:37 -03:00
Ian Couto 945e02c932 refactor: streamline follow-up turn handling and enhance error management
- Removed redundant code for resolving conversation and channel session IDs in the follow-up turn handler.
- Introduced a new `resolveSendTarget` function to encapsulate logic for determining the appropriate send target, improving code clarity and maintainability.
- Updated error handling to provide clearer messages when a contact cannot be resumed or when a channel is archived.
- Enhanced unit tests to cover new scenarios for handling contacts without conversations and ensuring proper follow-up flow.
2026-08-24 17:51:43 -03:00
Ian Couto f6f85f7b53 refactor: clean up imports and enhance sound playback functionality
- Removed duplicate imports in _client.tsx and LeadFieldsForm.tsx for improved code clarity.
- Updated playSound function to accept a volume parameter, allowing for customizable sound playback levels.
- Adjusted beep function to utilize the new volume parameter, enhancing audio control during notifications.
- Added tests for new volume functionality in sounds.test.ts to ensure reliability.
2026-08-24 17:23:11 -03:00
Ian Couto a811d7eb7e refactor: remove agent logging from automation and webhook handling
- Eliminated redundant logging fetch calls from various automation functions and webhook routes to streamline code and improve performance.
- Added a new trigger kind "case_opened" in TriggerConfigControl for better categorization of follow-up actions.
- Cleaned up imports in LeadFieldsForm and KanbanBoard components to remove duplicates and enhance readability.
2026-08-24 17:15:54 -03:00
Ian Couto b3740a3e83 Merge branch 'main' of https://github.com/IanCouto/DeskcommCRM into feat/inbox-compartilhar-contato 2026-08-24 17:15:41 -03:00
Ian Couto 93e2481d3f feat(automation): add Web Push notifications and cron job configuration
- Introduced `VAPID_PUBLIC_KEY` and `VAPID_PRIVATE_KEY` to `.env.example` and `.env.hostgator.example` for enabling Web Push notifications.
- Updated `CHANGELOG.md` to document the addition of system alerts with the browser minimized.
- Enhanced `next.config.ts` to support Web Push by adding appropriate headers.
- Added a new script command `dev:crons` in `package.json` for local cron job development.
- Updated dependencies to include `web-push` and its types for TypeScript support.
- Created new design and specification documents for CRM automation flows, detailing the architecture and user stories for visual automation flows.
2026-08-24 17:07:14 -03:00
Ian Couto c16ccd31af feat(inbox): compartilhar contato no composer com cartao clicavel no WhatsApp
Permite enviar cartoes de contato pelo inbox (CRM ou telefone manual), com suporte WAHA e Meta Cloud, resolucao do wa_id via check-exists para o nono digito BR, e abertura da conversa ao tocar no cartao dentro do CRM.
2026-08-19 14:30:18 -03:00
Ian Couto a7afbdd382 fix(contacts): data fixa na ultima atividade apos ontem
Hoje e ontem continuam relativos; datas mais antigas exibem dd/MM/yyyy em vez do dia da semana.
2026-08-19 14:15:04 -03:00
Ian Couto 61dc7c3242 fix(contacts): atualiza ultima atividade e ordenacao no backend
Mensagens passam a carimbar contacts.last_activity_at via fn_mark_conversation_message (migration 0162) e envio pelo CRM. A lista /app/contacts ganha order_by/order_dir, cursor corrigido e UI com colunas ordenaveis e paginacao por backend.
2026-08-19 14:11:00 -03:00
Ian Couto 7230025f3c Merge pull request #2 from IanCouto/fix/inbox-unread-badge
fix(inbox): corrige badge de mensagens pendentes na fila
2026-08-19 13:55:55 -03:00
Ian Couto 4e2f756119 fix(inbox): corrige badge de mensagens pendentes na fila
O contador só subia em inbound e nunca zerava ao responder, inflando o badge (ex.: 6 com 1 mensagem pendente). Outbound passa a zerar unread, o envio CRM espelha isso, mark-read cobre leitura sem resposta, e a migration recalcula contadores stale.
2026-08-19 13:54:35 -03:00
Ian Couto 830896a66a Merge pull request #1 from IanCouto/fix/whatsapp-sessao-permanece-conectada
Fix/whatsapp sessao permanece conectada
2026-08-19 13:49:41 -03:00
Ian Couto 4776bfc189 feat(contacts): atalho para abrir conversa no Inbox
Lista e detalhe do contato passam a trazer a conversa mais recente e oferecem link direto para o Inbox. O composer também limpa o campo na hora do envio, sem travar até a API responder.
2026-08-19 13:48:18 -03:00
Ian Couto ba6de26b05 feat(docker): add WHATSAPP_RESTART_ALL_SESSIONS configuration to restart stopped sessions
Updated docker-compose files to include the WHATSAPP_RESTART_ALL_SESSIONS environment variable, set to "True" by default. This change ensures that stopped sessions are resumed automatically without requiring user intervention. Additionally, added unit tests to verify the behavior of session resumption logic in the session reconciler.
2026-08-17 16:01:30 -03:00