Add n8n test mode toggle and edge function improvements

- Add test/production toggle for n8n webhook URLs in IntegrasiTab
- Update create-meet-link function to use database test_mode setting
- Add send-email-v2 edge function for Mailketing API integration
- Update daily-reminders and send-consultation-reminder to use send-email-v2
- Remove deprecated branding field from BrandingTab
- Update domain references from hub.dwindi.com to with.dwindi.com
- Add environment variables for Coolify deployment
- Add comprehensive edge function test script
- Update payment flow redirect to order detail page

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
dwindown
2025-12-23 00:24:40 +07:00
parent f1cc2ba3f7
commit dfda71053c
11 changed files with 385 additions and 49 deletions

View File

@@ -52,16 +52,21 @@ serve(async (req: Request): Promise<Response> => {
// For now, this is a placeholder that returns a message
// In production, you would integrate with Google Calendar API via OAuth or service account
// Or call an n8n webhook to handle the calendar creation
const { data: integrationSettings } = await supabase
.from("platform_settings")
.select("integration_n8n_base_url")
.select("integration_n8n_base_url, integration_n8n_test_mode")
.single();
if (integrationSettings?.integration_n8n_base_url) {
// Call n8n webhook if configured
const n8nUrl = `${integrationSettings.integration_n8n_base_url}/webhook/create-meet`;
// Check if we're in test mode (controlled by the integration_n8n_test_mode setting)
const isTestMode = integrationSettings.integration_n8n_test_mode || false;
const webhookPath = isTestMode ? "/webhook-test/" : "/webhook/";
const n8nUrl = `${integrationSettings.integration_n8n_base_url}${webhookPath}create-meet`;
console.log(`Calling n8n webhook: ${n8nUrl} (Test mode: ${isTestMode})`);
try {
const n8nResponse = await fetch(n8nUrl, {
method: "POST",
@@ -77,6 +82,7 @@ serve(async (req: Request): Promise<Response> => {
notes: body.notes,
calendar_id: calendarId,
brand_name: brandName,
test_mode: isTestMode, // Add test_mode flag for n8n to use
}),
});