File size: 5,856 Bytes
3129a87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Webhook Logs - HotmartFlow Integrator</title>
    <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
    <link rel="stylesheet" href="style.css">
    <script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-gray-50">
    <custom-navbar></custom-navbar>
    
    <main class="container mx-auto px-4 py-8">
        <div class="flex justify-between items-center mb-8">
            <h1 class="text-3xl font-bold text-gray-800">Webhook Logs</h1>
            <button class="bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded-lg transition duration-200">
                Test Webhook
            </button>
        </div>

        <!-- Webhook Logs -->
        <div class="bg-white rounded-lg shadow-md overflow-hidden">
            <div class="overflow-x-auto">
                <table class="min-w-full divide-y divide-gray-200">
                    <thead class="bg-gray-50">
                        <tr>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
                                Event Type
                            </th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
                                User Email
                            </th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
                                IP Address
                            </th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
                                Timestamp
                            </th>
                            <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
                                Status
                            </th>
                        </tr>
                    </thead>
                    <tbody class="bg-white divide-y divide-gray-200" id="webhookLogsBody">
                        <tr>
                            <td colspan="5" class="px-6 py-8 text-center">
                                <div class="animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600 mx-auto"></div>
                                <p class="text-gray-600 mt-2">Loading webhook logs...</p>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </main>

    <custom-footer></custom-footer>

    <script src="components/navbar.js"></script>
    <script src="components/footer.js"></script>
    <script src="script.js"></script>
    <script>
        // Mock webhook logs
        const mockWebhookLogs = [
            {
                id: 1,
                eventType: 'approved',
                userEmail: 'john@example.com',
                ipAddress: '192.168.1.1',
                timestamp: '2024-01-20 14:30:25',
                status: 'success'
            },
            {
                id: 2,
                eventType: 'canceled',
                userEmail: 'jane@example.com',
                ipAddress: '192.168.1.2',
                timestamp: '2024-01-20 12:15:10',
                status: 'warning'
            },
            {
                id: 3,
                eventType: 'refund',
                userEmail: 'mike@example.com',
                ipAddress: '192.168.1.3',
                timestamp: '2024-01-19 16:45:30',
                status: 'error'
            },
            {
                id: 4,
                eventType: 'approved',
                userEmail: 'sarah@example.com',
                ipAddress: '192.168.1.4',
                timestamp: '2024-01-19 10:20:15',
                status: 'success'
            }
        ];

        // Populate webhook logs table
        setTimeout(() => {
            const logsBody = document.getElementById('webhookLogsBody');
            if (logsBody) {
                logsBody.innerHTML = mockWebhookLogs.map(log => `
                    <tr class="hover:bg-gray-50">
                        <td class="px-6 py-4 whitespace-nowrap">
                            <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${
                                log.status === 'success' ? 'bg-green-100 text-green-800' :
                                log.status === 'warning' ? 'bg-yellow-100 text-yellow-800' : 'bg-red-100 text-red-800'
                            }">
                                ${log.eventType}
                            </span>
                        </td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">${log.userEmail}</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">${log.ipAddress}</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">${log.timestamp}</td>
                        <td class="px-6 py-4 whitespace-nowrap">
                            <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${
                                    log.status === 'success' ? 'bg-green-100 text-green-800' :
                                    log.status === 'warning' ? 'bg-yellow-100 text-yellow-800' : 'bg-red-100 text-red-800'
                                }">
                                    ${log.status}
                                </span>
                            </td>
                        </tr>
                    `).join('');
                }, 1500);
            });
    </script>
</body>
</html>