Commit Graph

87 Commits

Author SHA1 Message Date
gpt-engineer-app[bot]
12e6cda1df Feat: Fetch WhatsApp instance on mount
Adds functionality to fetch a WhatsApp instance from the Evolution API when the "Conectar WhatsApp" menu is accessed. The request uses the instance name entered in the form, includes the necessary headers, and displays the instance information. It also handles cases where the user is not logged in and when the instance is not found.
2025-05-20 16:01:08 +00:00
gpt-engineer-app[bot]
002103e676 Refactor: Improve chart visuals
Improve the visual appearance of the pie chart and the "Receitas vs Despesas" chart, aiming for a more modern look, without affecting other functionalities.
2025-05-20 14:35:43 +00:00
gpt-engineer-app[bot]
67c4d2e318 Refactor: Use Supabase Edge Function for workflow creation
Implement workflow creation using a Supabase Edge Function, addressing CORS issues and enhancing security. The frontend now calls the Edge Function, which handles the n8n API interaction and Supabase updates.
2025-05-20 11:40:32 +00:00
gpt-engineer-app[bot]
9d35dfb518 Fix: Prevent modification of package.json
The AI was attempting to modify the `package.json` file, which is not allowed. This commit removes any changes that would have affected this file.
2025-05-20 11:12:52 +00:00
gpt-engineer-app[bot]
12c178aeb7 Fix: Supabase client access in n8nWorkflowService
The commit addresses two TypeScript errors in `n8nWorkflowService.ts`. The first error, TS2445, arises from attempting to access the protected `supabaseUrl` property directly. The second error, TS2339, occurs because the `session` property is not directly available on the `SupabaseAuthClient`. The fix involves adjusting how the Supabase client and its properties are accessed to align with the Supabase library's intended usage.
2025-05-20 10:56:58 +00:00
gpt-engineer-app[bot]
8ec8b4a5c6 Refactor: Move n8n workflow creation to backend
The frontend now calls a backend endpoint to create n8n workflows, addressing CORS issues. The backend handles the n8n API request, updates Supabase, and returns the result to the frontend.
2025-05-20 10:54:37 +00:00
gpt-engineer-app[bot]
71d2ef79c0 Refactor: Split WhatsApp group service
Split `gruposWhatsAppService.ts` into smaller, more maintainable service files: `n8nWorkflowService.ts` and `whatsAppGroupsService.ts`. This improves code organization and readability.
2025-05-20 10:44:22 +00:00
gpt-engineer-app[bot]
e0f6bc4b86 Fix: Cadastrar Grupo button failing quickly
The "Cadastrar Grupo" button now fails immediately. The priority is to ensure the n8n workflow creation request succeeds. This commit reviews the button's context and related code to address the issue.
2025-05-20 10:37:55 +00:00
gpt-engineer-app[bot]
7736ab1452 Fix: Log n8n API HTTP status code
Log the HTTP status code returned by the n8n API to help debug the "Cadastrar Grupo" button errors.
2025-05-20 10:33:25 +00:00
gpt-engineer-app[bot]
84b22ae8bd Fix: Ensure n8n workflow creation
The code was updated to create the n8n workflow when the "Cadastrar Grupo" button is pressed. It now makes a POST request to the n8n API with the user's email in the request body.
2025-05-20 10:28:24 +00:00
gpt-engineer-app[bot]
9d6319c1b3 Fix: Determine error stage for "Cadastrar Grupo"
The user reported an error when clicking the "Cadastrar Grupo" button. This commit aims to identify the specific stage where the error occurs to facilitate debugging.
2025-05-20 10:25:14 +00:00
gpt-engineer-app[bot]
e5dbce2562 Fix: Resolve group registration error
Investigate and fix the "Não foi possível registrar o grupo" error, likely related to n8n workflow creation. Check API key and other potential causes.
2025-05-20 10:19:49 +00:00
gpt-engineer-app[bot]
aae413643d Fix: Implement group creation workflow
The "Cadastrar Grupo" button now creates a group in Supabase and attempts to create an empty workflow in n8n. If the workflow creation is successful, the workflow ID is saved. If it fails, the group is still created, but a specific error message is displayed.
2025-05-20 10:13:27 +00:00
gpt-engineer-app[bot]
edccfbde36 feat: Create n8n workflow on group registration
Implement n8n API call to create an empty workflow when a new WhatsApp group is registered. Save the returned workflow ID to the Supabase record upon successful creation. Display success message to the user.
2025-05-20 10:01:01 +00:00
gpt-engineer-app[bot]
4f84ab9a9f Add workflow integration for WhatsApp groups
Integrate n8n workflow cloning upon WhatsApp group registration.  Adds a `workflow_id` column to the `grupos_whatsapp` table and updates the `cadastrarGrupoWhatsApp` function to call the n8n webhook, capturing the returned workflow ID and saving it to the database.  The button "Cadastrar Grupo" is only visible when the user is logged in.
2025-05-20 02:24:58 +00:00
gpt-engineer-app[bot]
9331f37ec5 Fix: gruposWhatsAppService.ts insert error
The `cadastrarGrupoWhatsApp` function in `gruposWhatsAppService.ts` was updated to include the `remote_jid` field when inserting a new group into the `grupos_whatsapp` table. This resolves the TypeScript error related to missing properties in the insert call.
2025-05-20 01:10:04 +00:00
gpt-engineer-app[bot]
6a38fd0bf1 Refactor: Use email (login) for user identification
Update the system to use the user's email (login) as the primary identifier for linking users, WhatsApp groups, and transactions. This includes changes to the `grupos_whatsapp` and `transacoes` tables, as well as adjustments to queries and data retrieval logic. The `user_id` field is maintained for compatibility.
2025-05-20 01:08:48 +00:00
gpt-engineer-app[bot]
8435c03464 Run SQL to add WhatsApp group features. 2025-05-20 00:59:19 +00:00
gpt-engineer-app[bot]
5a16246b23 Apply Supabase schema changes
Apply the SQL schema changes to Supabase, including the creation of the `grupos_whatsapp` table and the addition of the `grupo_id` column to the `transacoes` table.
2025-05-20 00:04:49 +00:00
gpt-engineer-app[bot]
908904f9b9 Refactor: Split useWhatsAppInstances hook
Split the `useWhatsAppInstances.ts` hook into smaller, more manageable files to improve code organization and readability.
2025-05-19 23:59:46 +00:00
gpt-engineer-app[bot]
96426e8d8d Fix: Sidebar and page visibility issues
The user reported that no pages were visible and the menu had disappeared. This commit likely addresses the root cause of these issues, potentially related to layout, routing, or component rendering.
2025-05-19 23:12:25 +00:00
gpt-engineer-app[bot]
fa5ff08d71 Fix: Resolve infinite re-render loop
The AI identified and fixed an infinite re-render loop in `useWhatsAppInstances.ts` and `WhatsApp.tsx` by adding state checks, delays, and improving useEffect dependencies.
2025-05-19 23:10:31 +00:00
gpt-engineer-app[bot]
9cd9dcca3a Fix: Resolve React rendering errors
The AI will address two runtime errors: a minified React error (likely related to incorrect component usage or props) and a "too many re-renders" error (indicating an infinite loop). The AI will analyze the code, particularly the `WhatsApp` component and its related hooks and components, to identify and fix the root causes of these errors.
2025-05-19 23:09:26 +00:00
gpt-engineer-app[bot]
f476c1422b Fix: Access instance property in instanceManagement
The code was updated to correctly access the 'instance' property, resolving a TypeScript error.
2025-05-19 23:07:16 +00:00
gpt-engineer-app[bot]
2eba5aa7b1 Refactor: Split WhatsApp service into modules
Split `whatsAppService.ts` into smaller files for API calls, local storage, and types to improve maintainability.
2025-05-19 23:05:13 +00:00
gpt-engineer-app[bot]
90b3030ebb Reverted to commit b8d0db98bb 2025-05-19 18:42:59 +00:00
gpt-engineer-app[bot]
ba5d3c92a3 Refactor: Split useWhatsAppActions into smaller files
Refactor useWhatsAppActions.ts into smaller, more manageable files.
2025-05-19 18:41:01 +00:00
gpt-engineer-app[bot]
88150d84e4 Refactor: Split useWhatsAppInstances hook
Split the large useWhatsAppInstances hook into smaller, more manageable files to improve code organization and readability.
2025-05-19 18:39:02 +00:00
gpt-engineer-app[bot]
8922c07e41 Fix: Incorrect type for onViewQrCode prop
The `onViewQrCode` prop in `InstanceList` was expecting a function with two arguments, but the `handleViewQrCode` function only provided one. This commit fixes the type mismatch.
2025-05-19 18:32:11 +00:00
gpt-engineer-app[bot]
b06373115b Fix: Resolve import error in Sidebar.tsx
The commit fixes an import error in `Sidebar.tsx` related to the `@/config/site` module. The error message indicates that the module cannot be resolved. The fix likely involves ensuring the correct path to the module or creating the missing file.
2025-05-19 18:30:40 +00:00
gpt-engineer-app[bot]
119a8af96a Run SQL migration
Apply the provided SQL to create the `rodrigo_audio_messages` table.
2025-05-19 18:29:45 +00:00
gpt-engineer-app[bot]
e208e7e373 Fix: Resolve import path error
The commit addresses a "Failed to resolve import" error in `src/pages/WhatsApp.tsx`. The error message indicates that the module `@/components/whatsapp` could not be found. This likely means the import path is incorrect, or the file does not exist at the specified location.
2025-05-19 18:24:30 +00:00
gpt-engineer-app[bot]
6100374e56 Add user filtering to database queries
Implement user-based filtering in database queries to retrieve data associated with specific users. Determine the users registered today.
2025-05-19 18:22:18 +00:00
gpt-engineer-app[bot]
b8d0db98bb Fix: Type mismatch in useWhatsAppInstances
The commit fixes a TypeScript error in `useWhatsAppInstances.ts` where the `setInstances` function was receiving an array with incorrect types. The error occurred because the `connectionState` property was sometimes a string instead of the expected union type. The fix ensures that the `connectionState` is always of the correct type.
2025-05-19 18:10:59 +00:00
gpt-engineer-app[bot]
dec494083c Fix: Address instance deletion, disappearing instances, and update errors
- Fixed instance deletion failures.
- Resolved the issue of instances appearing and disappearing in a loop.
- Addressed errors during instance updates.
- Check for missing information.
2025-05-19 18:07:25 +00:00
gpt-engineer-app[bot]
f26e41707a Fix: Instance cards not rendering
The commit addresses the issue where instance cards were not appearing after creation. It revisits the `WhatsApp.tsx` file and related components to ensure instances are correctly added to the state and displayed.
2025-05-19 15:16:50 +00:00
gpt-engineer-app[bot]
66a2cc47a8 Refactor: Extract WhatsApp logic into hooks and components
Refactor WhatsApp.tsx to use custom hooks and smaller components, preserving all existing functionality.
2025-05-19 15:09:59 +00:00
gpt-engineer-app[bot]
b0d6e88a76 Add advanced instance management features
Implement instance listing, restart, disconnect, delete, and presence setting functionalities with confirmation dialogs and UI updates.
2025-05-19 15:07:24 +00:00
gpt-engineer-app[bot]
686b682c19 Fix: Instance card not appearing
The fix ensures instance cards are displayed after creation.
2025-05-19 15:01:37 +00:00
gpt-engineer-app[bot]
926d3a37ef Refactor: Split WhatsApp.tsx into smaller components
This commit refactors the `WhatsApp.tsx` file into smaller, more manageable components. The form, instance list, QR code dialog, and API functions are separated into their own files to improve code organization and maintainability. No functionality changes were made.
2025-05-19 14:57:22 +00:00
gpt-engineer-app[bot]
f25b820437 Fix: Instance card not updating after creation
The fix ensures that when a new instance is created, even if the QR code isn't scanned immediately, the instance card appears in the "Desconectado" state, allowing the user to connect later.
2025-05-19 14:54:02 +00:00
gpt-engineer-app[bot]
11628031a3 Fix: Ensure instance cards appear after creation
The instance cards were not appearing after creation. This commit fixes the issue, ensuring that the cards are displayed whether the instance is connected or disconnected.
2025-05-19 14:48:52 +00:00
gpt-engineer-app[bot]
54310bd204 feat: Implement user-specific WhatsApp instances
- Associate WhatsApp instances with logged-in users.
- Store user ID/email with instance data.
- Filter instance cards to show only the user's instances.
- Clear instances on logout/login.
2025-05-19 14:41:04 +00:00
gpt-engineer-app[bot]
44e8569b6c Add instance connection status check
Implement automatic connection status checks for each instance card, displaying "Conectado" or "Desconectado" based on the API response. Includes periodic updates and visual status indication.
2025-05-19 14:33:33 +00:00
gpt-engineer-app[bot]
e7b86b26ea Fix: QR code not rendering
The QR code was not appearing, likely due to a base64 conversion issue.
2025-05-19 14:22:31 +00:00
gpt-engineer-app[bot]
ae584bce96 Fix: Update QR code retrieval flow
Update the "Ver QR Code" button to fetch the QR code from the /instance/connect/{instanceName} endpoint, display the QR code, and handle errors.
2025-05-19 14:20:07 +00:00
gpt-engineer-app[bot]
0b36a1bda5 feat: Display created WhatsApp instances
Adds a section to display created WhatsApp instances as cards, each with a "View QR Code" button. Implements local storage for instance data and fetches QR codes from the API.
2025-05-19 13:40:23 +00:00
gpt-engineer-app[bot]
490ac533ac feat: Implement WhatsApp QR code flow
- Store instanceId and instanceName after instance creation.
- Add "Ver QR Code" button to fetch and display QR code from API.
- Implement QR code refresh functionality.
- Display success/error messages.
2025-05-19 13:30:19 +00:00
gpt-engineer-app[bot]
70dd4fc790 Fix: Update WhatsApp API request
Update the API endpoint and apikey for the WhatsApp instance creation request.
2025-05-19 13:22:42 +00:00
gpt-engineer-app[bot]
991964846a feat: Add "Connect WhatsApp" menu and integration
Adds a "Connect WhatsApp" menu item to the sidebar. Implements a form to input instance name and WhatsApp number, and a button to create a WhatsApp instance via a POST request to the Evolution API. Saves the returned instanceId and displays success/error messages.
2025-05-19 13:12:27 +00:00