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

@@ -22,7 +22,6 @@ interface PlatformSettings {
brand_favicon_url: string;
brand_primary_color: string;
brand_accent_color: string;
brand_email_from_name: string;
homepage_headline: string;
homepage_description: string;
homepage_features: HomepageFeature[];
@@ -41,7 +40,6 @@ const emptySettings: PlatformSettings = {
brand_favicon_url: '',
brand_primary_color: '#111827',
brand_accent_color: '#0F766E',
brand_email_from_name: '',
homepage_headline: 'Learn. Grow. Succeed.',
homepage_description: 'Access premium consulting, live webinars, and intensive bootcamps to accelerate your career.',
homepage_features: defaultFeatures,
@@ -84,7 +82,6 @@ export function BrandingTab() {
brand_favicon_url: data.brand_favicon_url || '',
brand_primary_color: data.brand_primary_color || '#111827',
brand_accent_color: data.brand_accent_color || '#0F766E',
brand_email_from_name: data.brand_email_from_name || '',
homepage_headline: data.homepage_headline || emptySettings.homepage_headline,
homepage_description: data.homepage_description || emptySettings.homepage_description,
homepage_features: features,
@@ -102,7 +99,6 @@ export function BrandingTab() {
brand_favicon_url: settings.brand_favicon_url,
brand_primary_color: settings.brand_primary_color,
brand_accent_color: settings.brand_accent_color,
brand_email_from_name: settings.brand_email_from_name,
homepage_headline: settings.homepage_headline,
homepage_description: settings.homepage_description,
homepage_features: settings.homepage_features,
@@ -280,22 +276,6 @@ export function BrandingTab() {
</div>
</div>
</div>
<div className="space-y-2">
<Label className="flex items-center gap-2">
<Mail className="w-4 h-4" />
Nama Pengirim Default Email
</Label>
<Input
value={settings.brand_email_from_name}
onChange={(e) => setSettings({ ...settings, brand_email_from_name: e.target.value })}
placeholder="LearnHub Team"
className="border-2"
/>
<p className="text-sm text-muted-foreground">
Digunakan jika SMTP from_name kosong
</p>
</div>
</CardContent>
</Card>

View File

@@ -6,6 +6,7 @@ import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
import { Alert, AlertDescription } from '@/components/ui/alert';
import { Switch } from '@/components/ui/switch';
import { toast } from '@/hooks/use-toast';
import { Puzzle, Webhook, MessageSquare, Calendar, Mail, Link as LinkIcon, Key, Send, AlertTriangle } from 'lucide-react';
@@ -19,6 +20,7 @@ interface IntegrationSettings {
integration_email_api_base_url: string;
integration_privacy_url: string;
integration_terms_url: string;
integration_n8n_test_mode: boolean;
// Mailketing specific settings
provider: 'mailketing' | 'smtp';
api_token: string;
@@ -35,6 +37,7 @@ const emptySettings: IntegrationSettings = {
integration_email_api_base_url: '',
integration_privacy_url: '/privacy',
integration_terms_url: '/terms',
integration_n8n_test_mode: false,
provider: 'mailketing',
api_token: '',
from_name: '',
@@ -75,6 +78,7 @@ export function IntegrasiTab() {
integration_email_api_base_url: platformData.integration_email_api_base_url || '',
integration_privacy_url: platformData.integration_privacy_url || '/privacy',
integration_terms_url: platformData.integration_terms_url || '/terms',
integration_n8n_test_mode: platformData.integration_n8n_test_mode || false,
// Email settings from notification_settings
provider: emailData?.provider || 'mailketing',
api_token: emailData?.api_token || '',
@@ -99,6 +103,7 @@ export function IntegrasiTab() {
integration_email_api_base_url: settings.integration_email_api_base_url,
integration_privacy_url: settings.integration_privacy_url,
integration_terms_url: settings.integration_terms_url,
integration_n8n_test_mode: settings.integration_n8n_test_mode,
};
if (settings.id) {
@@ -215,6 +220,28 @@ export function IntegrasiTab() {
Digunakan sebagai target default untuk webhook lanjutan. webhook_url per template tetap harus URL lengkap.
</p>
</div>
<div className="flex items-center justify-between p-4 border rounded-lg space-y-0">
<div className="space-y-0.5">
<Label>Mode Test n8n</Label>
<p className="text-sm text-muted-foreground">
Aktifkan untuk menggunakan webhook path /webhook-test/ instead of /webhook/
</p>
</div>
<Switch
checked={settings.integration_n8n_test_mode}
onCheckedChange={(checked) => setSettings({ ...settings, integration_n8n_test_mode: checked })}
/>
</div>
{settings.integration_n8n_test_mode && (
<Alert>
<AlertTriangle className="w-4 h-4" />
<AlertDescription>
Mode test aktif: Webhook akan menggunakan path <code>/webhook-test/</code>
</AlertDescription>
</Alert>
)}
</CardContent>
</Card>

View File

@@ -357,7 +357,7 @@ export class ShortcodeProcessor {
total: 'Rp 1.500.000',
metode_pembayaran: 'Transfer Bank',
status_pesanan: 'Diproses',
invoice_url: 'https://example.com/invoice/ORD-123456',
invoice_url: 'https://with.dwindi.com/orders/ORD-123456',
// Product information
produk: 'Digital Marketing Masterclass',
@@ -366,7 +366,7 @@ export class ShortcodeProcessor {
deskripsi_produk: 'Kelas lengkap digital marketing dari pemula hingga mahir',
// Access information
link_akses: 'https://example.com/access',
link_akses: 'https://with.dwindi.com/access',
username_akses: 'john.doe',
password_akses: 'Temp123!',
kadaluarsa_akses: '22 Desember 2026',
@@ -383,7 +383,7 @@ export class ShortcodeProcessor {
judul_event: 'Workshop Digital Marketing',
tanggal_event: '25 Desember 2025',
jam_event: '19:00',
link_event: 'https://event.example.com',
link_event: 'https://with.dwindi.com/events',
lokasi_event: 'Zoom Online',
kapasitas_event: '100 peserta',
@@ -392,12 +392,12 @@ export class ShortcodeProcessor {
progres_bootcamp: '75%',
modul_selesai: '15 dari 20 modul',
modul_selanjutnya: 'Final Assessment',
link_progress: 'https://example.com/progress',
link_progress: 'https://with.dwindi.com/bootcamp/progress',
// Company information
nama_perusahaan: 'ACCESS HUB',
website_perusahaan: 'https://accesshub.example.com',
email_support: 'support@accesshub.example.com',
website_perusahaan: 'https://with.dwindi.com',
email_support: 'support@with.dwindi.com',
telepon_support: '+62 812-3456-7890',
// Payment information
@@ -406,8 +406,8 @@ export class ShortcodeProcessor {
atas_nama: 'PT Access Hub Indonesia',
jumlah_pembayaran: 'Rp 1.500.000',
batas_pembayaran: '22 Desember 2025 23:59',
payment_link: 'https://accesshub.example.com/checkout',
thank_you_page: 'https://accesshub.example.com/orders/{order_id}'
payment_link: 'https://with.dwindi.com/checkout',
thank_you_page: 'https://with.dwindi.com/orders/{order_id}'
};
static process(content: string, customData: Record<string, string> = {}): string {