@contractspec/example.integration-hub 2.5.0 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -0
- package/dist/docs/index.js +2 -0
- package/dist/docs/integration-hub.docblock.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +149 -0
- package/dist/mcp-example.d.ts +16 -0
- package/dist/mcp-example.js +151 -0
- package/dist/node/docs/index.js +2 -0
- package/dist/node/docs/integration-hub.docblock.js +2 -0
- package/dist/node/index.js +149 -0
- package/dist/node/mcp-example.js +150 -0
- package/dist/node/run-mcp.js +155 -0
- package/dist/run-mcp.d.ts +1 -0
- package/dist/run-mcp.js +156 -0
- package/package.json +34 -94
- package/dist/browser/connection/connection.enum.js +0 -12
- package/dist/browser/connection/connection.operation.js +0 -101
- package/dist/browser/connection/connection.presentation.js +0 -102
- package/dist/browser/connection/connection.schema.js +0 -48
- package/dist/browser/connection/index.js +0 -104
- package/dist/browser/docs/index.js +0 -104
- package/dist/browser/docs/integration-hub.docblock.js +0 -104
- package/dist/browser/events.js +0 -211
- package/dist/browser/example.js +0 -42
- package/dist/browser/handlers/index.js +0 -246
- package/dist/browser/handlers/integration.handlers.js +0 -246
- package/dist/browser/index.js +0 -1595
- package/dist/browser/integration/index.js +0 -92
- package/dist/browser/integration/integration.enum.js +0 -12
- package/dist/browser/integration/integration.operations.js +0 -89
- package/dist/browser/integration/integration.presentation.js +0 -120
- package/dist/browser/integration/integration.schema.js +0 -42
- package/dist/browser/integration-hub.capability.js +0 -43
- package/dist/browser/integration-hub.feature.js +0 -114
- package/dist/browser/seeders/index.js +0 -60
- package/dist/browser/sync/index.js +0 -332
- package/dist/browser/sync/sync.enum.js +0 -26
- package/dist/browser/sync/sync.operations.js +0 -321
- package/dist/browser/sync/sync.presentation.js +0 -301
- package/dist/browser/sync/sync.schema.js +0 -154
- package/dist/browser/sync-engine/index.js +0 -186
- package/dist/browser/tests/operations.test-spec.js +0 -85
- package/dist/browser/ui/IntegrationDashboard.js +0 -369
- package/dist/browser/ui/hooks/index.js +0 -57
- package/dist/browser/ui/hooks/useIntegrationData.js +0 -54
- package/dist/browser/ui/index.js +0 -644
- package/dist/browser/ui/renderers/index.js +0 -273
- package/dist/browser/ui/renderers/integration.markdown.js +0 -273
package/dist/browser/ui/index.js
DELETED
|
@@ -1,644 +0,0 @@
|
|
|
1
|
-
// src/ui/renderers/integration.markdown.ts
|
|
2
|
-
var mockIntegrations = [
|
|
3
|
-
{
|
|
4
|
-
id: "int-1",
|
|
5
|
-
name: "Salesforce",
|
|
6
|
-
type: "CRM",
|
|
7
|
-
status: "ACTIVE",
|
|
8
|
-
connectionCount: 3
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
id: "int-2",
|
|
12
|
-
name: "HubSpot",
|
|
13
|
-
type: "MARKETING",
|
|
14
|
-
status: "ACTIVE",
|
|
15
|
-
connectionCount: 2
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
id: "int-3",
|
|
19
|
-
name: "Stripe",
|
|
20
|
-
type: "PAYMENT",
|
|
21
|
-
status: "ACTIVE",
|
|
22
|
-
connectionCount: 1
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
id: "int-4",
|
|
26
|
-
name: "Slack",
|
|
27
|
-
type: "COMMUNICATION",
|
|
28
|
-
status: "INACTIVE",
|
|
29
|
-
connectionCount: 0
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
id: "int-5",
|
|
33
|
-
name: "Google Sheets",
|
|
34
|
-
type: "DATA",
|
|
35
|
-
status: "ACTIVE",
|
|
36
|
-
connectionCount: 5
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
id: "int-6",
|
|
40
|
-
name: "PostHog",
|
|
41
|
-
type: "ANALYTICS",
|
|
42
|
-
status: "ACTIVE",
|
|
43
|
-
connectionCount: 1
|
|
44
|
-
}
|
|
45
|
-
];
|
|
46
|
-
var mockConnections = [
|
|
47
|
-
{
|
|
48
|
-
id: "conn-1",
|
|
49
|
-
integrationId: "int-1",
|
|
50
|
-
name: "Production Salesforce",
|
|
51
|
-
status: "CONNECTED",
|
|
52
|
-
lastSyncAt: "2024-01-16T10:00:00Z"
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
id: "conn-2",
|
|
56
|
-
integrationId: "int-1",
|
|
57
|
-
name: "Sandbox Salesforce",
|
|
58
|
-
status: "CONNECTED",
|
|
59
|
-
lastSyncAt: "2024-01-15T14:00:00Z"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
id: "conn-3",
|
|
63
|
-
integrationId: "int-2",
|
|
64
|
-
name: "Marketing HubSpot",
|
|
65
|
-
status: "CONNECTED",
|
|
66
|
-
lastSyncAt: "2024-01-16T08:00:00Z"
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
id: "conn-4",
|
|
70
|
-
integrationId: "int-3",
|
|
71
|
-
name: "Stripe Live",
|
|
72
|
-
status: "CONNECTED",
|
|
73
|
-
lastSyncAt: "2024-01-16T12:00:00Z"
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
id: "conn-5",
|
|
77
|
-
integrationId: "int-5",
|
|
78
|
-
name: "Analytics Sheet",
|
|
79
|
-
status: "ERROR",
|
|
80
|
-
lastSyncAt: "2024-01-14T09:00:00Z",
|
|
81
|
-
error: "Authentication expired"
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
id: "conn-6",
|
|
85
|
-
integrationId: "int-6",
|
|
86
|
-
name: "PostHog Workspace",
|
|
87
|
-
status: "CONNECTED",
|
|
88
|
-
lastSyncAt: "2024-01-16T11:45:00Z"
|
|
89
|
-
}
|
|
90
|
-
];
|
|
91
|
-
var mockSyncConfigs = [
|
|
92
|
-
{
|
|
93
|
-
id: "sync-1",
|
|
94
|
-
connectionId: "conn-1",
|
|
95
|
-
name: "Contacts Sync",
|
|
96
|
-
frequency: "HOURLY",
|
|
97
|
-
lastRunAt: "2024-01-16T10:00:00Z",
|
|
98
|
-
status: "SUCCESS",
|
|
99
|
-
recordsSynced: 1250
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
id: "sync-2",
|
|
103
|
-
connectionId: "conn-1",
|
|
104
|
-
name: "Opportunities Sync",
|
|
105
|
-
frequency: "DAILY",
|
|
106
|
-
lastRunAt: "2024-01-16T00:00:00Z",
|
|
107
|
-
status: "SUCCESS",
|
|
108
|
-
recordsSynced: 340
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
id: "sync-3",
|
|
112
|
-
connectionId: "conn-3",
|
|
113
|
-
name: "Orders Sync",
|
|
114
|
-
frequency: "REALTIME",
|
|
115
|
-
lastRunAt: "2024-01-16T12:30:00Z",
|
|
116
|
-
status: "SUCCESS",
|
|
117
|
-
recordsSynced: 89
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
id: "sync-4",
|
|
121
|
-
connectionId: "conn-5",
|
|
122
|
-
name: "Metrics Export",
|
|
123
|
-
frequency: "DAILY",
|
|
124
|
-
lastRunAt: "2024-01-14T09:00:00Z",
|
|
125
|
-
status: "FAILED",
|
|
126
|
-
recordsSynced: 0
|
|
127
|
-
}
|
|
128
|
-
];
|
|
129
|
-
var integrationDashboardMarkdownRenderer = {
|
|
130
|
-
target: "markdown",
|
|
131
|
-
render: async (desc) => {
|
|
132
|
-
if (desc.source.type !== "component" || desc.source.componentKey !== "IntegrationDashboard") {
|
|
133
|
-
throw new Error("integrationDashboardMarkdownRenderer: not IntegrationDashboard");
|
|
134
|
-
}
|
|
135
|
-
const integrations = mockIntegrations;
|
|
136
|
-
const connections = mockConnections;
|
|
137
|
-
const syncs = mockSyncConfigs;
|
|
138
|
-
const activeIntegrations = integrations.filter((i) => i.status === "ACTIVE");
|
|
139
|
-
const connectedConnections = connections.filter((c) => c.status === "CONNECTED");
|
|
140
|
-
const errorConnections = connections.filter((c) => c.status === "ERROR");
|
|
141
|
-
const successfulSyncs = syncs.filter((s) => s.status === "SUCCESS");
|
|
142
|
-
const totalRecordsSynced = successfulSyncs.reduce((sum, s) => sum + s.recordsSynced, 0);
|
|
143
|
-
const lines = [
|
|
144
|
-
"# Integration Hub",
|
|
145
|
-
"",
|
|
146
|
-
"> Connect and sync data with external services",
|
|
147
|
-
"",
|
|
148
|
-
"## Overview",
|
|
149
|
-
"",
|
|
150
|
-
"| Metric | Value |",
|
|
151
|
-
"|--------|-------|",
|
|
152
|
-
`| Active Integrations | ${activeIntegrations.length} |`,
|
|
153
|
-
`| Connected Services | ${connectedConnections.length} |`,
|
|
154
|
-
`| Error Connections | ${errorConnections.length} |`,
|
|
155
|
-
`| Sync Configs | ${syncs.length} |`,
|
|
156
|
-
`| Records Synced (24h) | ${totalRecordsSynced.toLocaleString()} |`,
|
|
157
|
-
"",
|
|
158
|
-
"## Integrations",
|
|
159
|
-
"",
|
|
160
|
-
"| Name | Type | Connections | Status |",
|
|
161
|
-
"|------|------|-------------|--------|"
|
|
162
|
-
];
|
|
163
|
-
for (const integration of integrations) {
|
|
164
|
-
const statusIcon = integration.status === "ACTIVE" ? "\uD83D\uDFE2" : "⚫";
|
|
165
|
-
lines.push(`| ${integration.name} | ${integration.type} | ${integration.connectionCount} | ${statusIcon} ${integration.status} |`);
|
|
166
|
-
}
|
|
167
|
-
lines.push("");
|
|
168
|
-
lines.push("## Recent Sync Activity");
|
|
169
|
-
lines.push("");
|
|
170
|
-
lines.push("| Sync | Frequency | Last Run | Records | Status |");
|
|
171
|
-
lines.push("|------|-----------|----------|---------|--------|");
|
|
172
|
-
for (const sync of syncs) {
|
|
173
|
-
const lastRun = new Date(sync.lastRunAt).toLocaleString();
|
|
174
|
-
const statusIcon = sync.status === "SUCCESS" ? "✅" : "❌";
|
|
175
|
-
lines.push(`| ${sync.name} | ${sync.frequency} | ${lastRun} | ${sync.recordsSynced} | ${statusIcon} ${sync.status} |`);
|
|
176
|
-
}
|
|
177
|
-
if (errorConnections.length > 0) {
|
|
178
|
-
lines.push("");
|
|
179
|
-
lines.push("## ⚠️ Connections with Errors");
|
|
180
|
-
lines.push("");
|
|
181
|
-
for (const conn of errorConnections) {
|
|
182
|
-
const integration = integrations.find((i) => i.id === conn.integrationId);
|
|
183
|
-
lines.push(`- **${conn.name}** (${integration?.name ?? "Unknown"}): ${conn.error ?? "Unknown error"}`);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
return {
|
|
187
|
-
mimeType: "text/markdown",
|
|
188
|
-
body: lines.join(`
|
|
189
|
-
`)
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
var connectionListMarkdownRenderer = {
|
|
194
|
-
target: "markdown",
|
|
195
|
-
render: async (desc) => {
|
|
196
|
-
if (desc.source.type !== "component" || desc.source.componentKey !== "ConnectionList") {
|
|
197
|
-
throw new Error("connectionListMarkdownRenderer: not ConnectionList");
|
|
198
|
-
}
|
|
199
|
-
const connections = mockConnections;
|
|
200
|
-
const integrations = mockIntegrations;
|
|
201
|
-
const lines = [
|
|
202
|
-
"# Connections",
|
|
203
|
-
"",
|
|
204
|
-
"> Manage connections to external services",
|
|
205
|
-
""
|
|
206
|
-
];
|
|
207
|
-
for (const integration of integrations) {
|
|
208
|
-
const intConnections = connections.filter((c) => c.integrationId === integration.id);
|
|
209
|
-
if (intConnections.length === 0)
|
|
210
|
-
continue;
|
|
211
|
-
lines.push(`## ${integration.name}`);
|
|
212
|
-
lines.push("");
|
|
213
|
-
lines.push("| Connection | Status | Last Sync |");
|
|
214
|
-
lines.push("|------------|--------|-----------|");
|
|
215
|
-
for (const conn of intConnections) {
|
|
216
|
-
const lastSync = new Date(conn.lastSyncAt).toLocaleString();
|
|
217
|
-
const statusIcon = conn.status === "CONNECTED" ? "\uD83D\uDFE2" : conn.status === "ERROR" ? "\uD83D\uDD34" : "⚫";
|
|
218
|
-
lines.push(`| ${conn.name} | ${statusIcon} ${conn.status} | ${lastSync} |`);
|
|
219
|
-
}
|
|
220
|
-
lines.push("");
|
|
221
|
-
}
|
|
222
|
-
return {
|
|
223
|
-
mimeType: "text/markdown",
|
|
224
|
-
body: lines.join(`
|
|
225
|
-
`)
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
var syncConfigMarkdownRenderer = {
|
|
230
|
-
target: "markdown",
|
|
231
|
-
render: async (desc) => {
|
|
232
|
-
if (desc.source.type !== "component" || desc.source.componentKey !== "SyncConfigEditor") {
|
|
233
|
-
throw new Error("syncConfigMarkdownRenderer: not SyncConfigEditor");
|
|
234
|
-
}
|
|
235
|
-
const syncs = mockSyncConfigs;
|
|
236
|
-
const connections = mockConnections;
|
|
237
|
-
const lines = [
|
|
238
|
-
"# Sync Configurations",
|
|
239
|
-
"",
|
|
240
|
-
"> Configure automated data synchronization",
|
|
241
|
-
""
|
|
242
|
-
];
|
|
243
|
-
for (const sync of syncs) {
|
|
244
|
-
const connection = connections.find((c) => c.id === sync.connectionId);
|
|
245
|
-
const statusIcon = sync.status === "SUCCESS" ? "✅" : "❌";
|
|
246
|
-
lines.push(`## ${sync.name}`);
|
|
247
|
-
lines.push("");
|
|
248
|
-
lines.push(`**Connection:** ${connection?.name ?? "Unknown"}`);
|
|
249
|
-
lines.push(`**Frequency:** ${sync.frequency}`);
|
|
250
|
-
lines.push(`**Status:** ${statusIcon} ${sync.status}`);
|
|
251
|
-
lines.push(`**Last Run:** ${new Date(sync.lastRunAt).toLocaleString()}`);
|
|
252
|
-
lines.push(`**Records Synced:** ${sync.recordsSynced.toLocaleString()}`);
|
|
253
|
-
lines.push("");
|
|
254
|
-
}
|
|
255
|
-
lines.push("## Frequency Options");
|
|
256
|
-
lines.push("");
|
|
257
|
-
lines.push("- **REALTIME**: Sync on every change");
|
|
258
|
-
lines.push("- **HOURLY**: Sync every hour");
|
|
259
|
-
lines.push("- **DAILY**: Sync once per day");
|
|
260
|
-
lines.push("- **WEEKLY**: Sync once per week");
|
|
261
|
-
lines.push("- **MANUAL**: Sync only when triggered");
|
|
262
|
-
return {
|
|
263
|
-
mimeType: "text/markdown",
|
|
264
|
-
body: lines.join(`
|
|
265
|
-
`)
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
// src/ui/hooks/useIntegrationData.ts
|
|
270
|
-
import { useCallback, useEffect, useState } from "react";
|
|
271
|
-
import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
|
|
272
|
-
"use client";
|
|
273
|
-
function useIntegrationData(projectId = "local-project") {
|
|
274
|
-
const { handlers } = useTemplateRuntime();
|
|
275
|
-
const integration = handlers.integration;
|
|
276
|
-
const [integrations, setIntegrations] = useState([]);
|
|
277
|
-
const [connections, setConnections] = useState([]);
|
|
278
|
-
const [syncConfigs, setSyncConfigs] = useState([]);
|
|
279
|
-
const [loading, setLoading] = useState(true);
|
|
280
|
-
const [error, setError] = useState(null);
|
|
281
|
-
const fetchData = useCallback(async () => {
|
|
282
|
-
try {
|
|
283
|
-
setLoading(true);
|
|
284
|
-
setError(null);
|
|
285
|
-
const [integResult, connResult, syncResult] = await Promise.all([
|
|
286
|
-
integration.listIntegrations({ projectId, limit: 100 }),
|
|
287
|
-
integration.listConnections({ limit: 100 }),
|
|
288
|
-
integration.listSyncConfigs({ limit: 100 })
|
|
289
|
-
]);
|
|
290
|
-
setIntegrations(integResult.integrations);
|
|
291
|
-
setConnections(connResult.connections);
|
|
292
|
-
setSyncConfigs(syncResult.configs);
|
|
293
|
-
} catch (err) {
|
|
294
|
-
setError(err instanceof Error ? err : new Error("Failed to load integrations"));
|
|
295
|
-
} finally {
|
|
296
|
-
setLoading(false);
|
|
297
|
-
}
|
|
298
|
-
}, [integration, projectId]);
|
|
299
|
-
useEffect(() => {
|
|
300
|
-
fetchData();
|
|
301
|
-
}, [fetchData]);
|
|
302
|
-
const stats = {
|
|
303
|
-
totalIntegrations: integrations.length,
|
|
304
|
-
activeIntegrations: integrations.filter((i) => i.status === "ACTIVE").length,
|
|
305
|
-
totalConnections: connections.length,
|
|
306
|
-
connectedCount: connections.filter((c) => c.status === "CONNECTED").length,
|
|
307
|
-
totalSyncs: syncConfigs.length,
|
|
308
|
-
activeSyncs: syncConfigs.filter((s) => s.status === "ACTIVE").length
|
|
309
|
-
};
|
|
310
|
-
return {
|
|
311
|
-
integrations,
|
|
312
|
-
connections,
|
|
313
|
-
syncConfigs,
|
|
314
|
-
loading,
|
|
315
|
-
error,
|
|
316
|
-
stats,
|
|
317
|
-
refetch: fetchData
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
// src/ui/IntegrationDashboard.tsx
|
|
322
|
-
import { useState as useState2 } from "react";
|
|
323
|
-
import {
|
|
324
|
-
Button,
|
|
325
|
-
ErrorState,
|
|
326
|
-
LoaderBlock,
|
|
327
|
-
StatCard,
|
|
328
|
-
StatCardGroup
|
|
329
|
-
} from "@contractspec/lib.design-system";
|
|
330
|
-
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
331
|
-
"use client";
|
|
332
|
-
var STATUS_COLORS = {
|
|
333
|
-
ACTIVE: "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",
|
|
334
|
-
INACTIVE: "bg-gray-100 text-gray-700 dark:bg-gray-900/30 dark:text-gray-400",
|
|
335
|
-
CONNECTED: "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",
|
|
336
|
-
DISCONNECTED: "bg-gray-100 text-gray-700 dark:bg-gray-900/30 dark:text-gray-400",
|
|
337
|
-
PENDING: "bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400",
|
|
338
|
-
ERROR: "bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400",
|
|
339
|
-
PAUSED: "bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400"
|
|
340
|
-
};
|
|
341
|
-
var TYPE_ICONS = {
|
|
342
|
-
CRM: "\uD83D\uDCCA",
|
|
343
|
-
MARKETING: "\uD83D\uDCE3",
|
|
344
|
-
PAYMENT: "\uD83D\uDCB3",
|
|
345
|
-
COMMUNICATION: "\uD83D\uDCAC",
|
|
346
|
-
DATA: "\uD83D\uDDC4️",
|
|
347
|
-
CUSTOM: "⚙️"
|
|
348
|
-
};
|
|
349
|
-
function IntegrationDashboard() {
|
|
350
|
-
const [activeTab, setActiveTab] = useState2("integrations");
|
|
351
|
-
const {
|
|
352
|
-
integrations,
|
|
353
|
-
connections,
|
|
354
|
-
syncConfigs,
|
|
355
|
-
loading,
|
|
356
|
-
error,
|
|
357
|
-
stats,
|
|
358
|
-
refetch
|
|
359
|
-
} = useIntegrationData();
|
|
360
|
-
const tabs = [
|
|
361
|
-
{ id: "integrations", label: "Integrations", icon: "\uD83D\uDD0C" },
|
|
362
|
-
{ id: "connections", label: "Connections", icon: "\uD83D\uDD17" },
|
|
363
|
-
{ id: "syncs", label: "Sync Configs", icon: "\uD83D\uDD04" }
|
|
364
|
-
];
|
|
365
|
-
if (loading) {
|
|
366
|
-
return /* @__PURE__ */ jsxDEV(LoaderBlock, {
|
|
367
|
-
label: "Loading Integrations..."
|
|
368
|
-
}, undefined, false, undefined, this);
|
|
369
|
-
}
|
|
370
|
-
if (error) {
|
|
371
|
-
return /* @__PURE__ */ jsxDEV(ErrorState, {
|
|
372
|
-
title: "Failed to load Integrations",
|
|
373
|
-
description: error.message,
|
|
374
|
-
onRetry: refetch,
|
|
375
|
-
retryLabel: "Retry"
|
|
376
|
-
}, undefined, false, undefined, this);
|
|
377
|
-
}
|
|
378
|
-
return /* @__PURE__ */ jsxDEV("div", {
|
|
379
|
-
className: "space-y-6",
|
|
380
|
-
children: [
|
|
381
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
382
|
-
className: "flex items-center justify-between",
|
|
383
|
-
children: [
|
|
384
|
-
/* @__PURE__ */ jsxDEV("h2", {
|
|
385
|
-
className: "text-2xl font-bold",
|
|
386
|
-
children: "Integration Hub"
|
|
387
|
-
}, undefined, false, undefined, this),
|
|
388
|
-
/* @__PURE__ */ jsxDEV(Button, {
|
|
389
|
-
onClick: () => alert("Add integration modal"),
|
|
390
|
-
children: [
|
|
391
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
392
|
-
className: "mr-2",
|
|
393
|
-
children: "+"
|
|
394
|
-
}, undefined, false, undefined, this),
|
|
395
|
-
" Add Integration"
|
|
396
|
-
]
|
|
397
|
-
}, undefined, true, undefined, this)
|
|
398
|
-
]
|
|
399
|
-
}, undefined, true, undefined, this),
|
|
400
|
-
/* @__PURE__ */ jsxDEV(StatCardGroup, {
|
|
401
|
-
children: [
|
|
402
|
-
/* @__PURE__ */ jsxDEV(StatCard, {
|
|
403
|
-
label: "Integrations",
|
|
404
|
-
value: stats.totalIntegrations,
|
|
405
|
-
hint: `${stats.activeIntegrations} active`
|
|
406
|
-
}, undefined, false, undefined, this),
|
|
407
|
-
/* @__PURE__ */ jsxDEV(StatCard, {
|
|
408
|
-
label: "Connections",
|
|
409
|
-
value: stats.totalConnections,
|
|
410
|
-
hint: `${stats.connectedCount} connected`
|
|
411
|
-
}, undefined, false, undefined, this),
|
|
412
|
-
/* @__PURE__ */ jsxDEV(StatCard, {
|
|
413
|
-
label: "Syncs",
|
|
414
|
-
value: stats.totalSyncs,
|
|
415
|
-
hint: `${stats.activeSyncs} active`
|
|
416
|
-
}, undefined, false, undefined, this)
|
|
417
|
-
]
|
|
418
|
-
}, undefined, true, undefined, this),
|
|
419
|
-
/* @__PURE__ */ jsxDEV("nav", {
|
|
420
|
-
className: "bg-muted flex gap-1 rounded-lg p-1",
|
|
421
|
-
role: "tablist",
|
|
422
|
-
children: tabs.map((tab) => /* @__PURE__ */ jsxDEV(Button, {
|
|
423
|
-
type: "button",
|
|
424
|
-
role: "tab",
|
|
425
|
-
"aria-selected": activeTab === tab.id,
|
|
426
|
-
onClick: () => setActiveTab(tab.id),
|
|
427
|
-
className: `flex flex-1 items-center justify-center gap-2 rounded-md px-4 py-2 text-sm font-medium transition-colors ${activeTab === tab.id ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"}`,
|
|
428
|
-
children: [
|
|
429
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
430
|
-
children: tab.icon
|
|
431
|
-
}, undefined, false, undefined, this),
|
|
432
|
-
tab.label
|
|
433
|
-
]
|
|
434
|
-
}, tab.id, true, undefined, this))
|
|
435
|
-
}, undefined, false, undefined, this),
|
|
436
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
437
|
-
className: "min-h-[400px]",
|
|
438
|
-
role: "tabpanel",
|
|
439
|
-
children: [
|
|
440
|
-
activeTab === "integrations" && /* @__PURE__ */ jsxDEV("div", {
|
|
441
|
-
className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3",
|
|
442
|
-
children: [
|
|
443
|
-
integrations.map((integration) => /* @__PURE__ */ jsxDEV("div", {
|
|
444
|
-
className: "border-border bg-card hover:bg-muted/50 cursor-pointer rounded-lg border p-4 transition-colors",
|
|
445
|
-
children: [
|
|
446
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
447
|
-
className: "mb-3 flex items-center gap-3",
|
|
448
|
-
children: [
|
|
449
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
450
|
-
className: "text-2xl",
|
|
451
|
-
children: TYPE_ICONS[integration.type] ?? "⚙️"
|
|
452
|
-
}, undefined, false, undefined, this),
|
|
453
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
454
|
-
children: [
|
|
455
|
-
/* @__PURE__ */ jsxDEV("h3", {
|
|
456
|
-
className: "font-medium",
|
|
457
|
-
children: integration.name
|
|
458
|
-
}, undefined, false, undefined, this),
|
|
459
|
-
/* @__PURE__ */ jsxDEV("p", {
|
|
460
|
-
className: "text-muted-foreground text-sm",
|
|
461
|
-
children: integration.type
|
|
462
|
-
}, undefined, false, undefined, this)
|
|
463
|
-
]
|
|
464
|
-
}, undefined, true, undefined, this)
|
|
465
|
-
]
|
|
466
|
-
}, undefined, true, undefined, this),
|
|
467
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
468
|
-
className: "flex items-center justify-between",
|
|
469
|
-
children: [
|
|
470
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
471
|
-
className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${STATUS_COLORS[integration.status] ?? ""}`,
|
|
472
|
-
children: integration.status
|
|
473
|
-
}, undefined, false, undefined, this),
|
|
474
|
-
/* @__PURE__ */ jsxDEV("span", {
|
|
475
|
-
className: "text-muted-foreground text-xs",
|
|
476
|
-
children: integration.createdAt.toLocaleDateString()
|
|
477
|
-
}, undefined, false, undefined, this)
|
|
478
|
-
]
|
|
479
|
-
}, undefined, true, undefined, this)
|
|
480
|
-
]
|
|
481
|
-
}, integration.id, true, undefined, this)),
|
|
482
|
-
integrations.length === 0 && /* @__PURE__ */ jsxDEV("div", {
|
|
483
|
-
className: "text-muted-foreground col-span-full flex h-64 items-center justify-center",
|
|
484
|
-
children: "No integrations configured"
|
|
485
|
-
}, undefined, false, undefined, this)
|
|
486
|
-
]
|
|
487
|
-
}, undefined, true, undefined, this),
|
|
488
|
-
activeTab === "connections" && /* @__PURE__ */ jsxDEV("div", {
|
|
489
|
-
className: "border-border rounded-lg border",
|
|
490
|
-
children: /* @__PURE__ */ jsxDEV("table", {
|
|
491
|
-
className: "w-full",
|
|
492
|
-
children: [
|
|
493
|
-
/* @__PURE__ */ jsxDEV("thead", {
|
|
494
|
-
className: "border-border bg-muted/30 border-b",
|
|
495
|
-
children: /* @__PURE__ */ jsxDEV("tr", {
|
|
496
|
-
children: [
|
|
497
|
-
/* @__PURE__ */ jsxDEV("th", {
|
|
498
|
-
className: "px-4 py-3 text-left text-sm font-medium",
|
|
499
|
-
children: "Connection"
|
|
500
|
-
}, undefined, false, undefined, this),
|
|
501
|
-
/* @__PURE__ */ jsxDEV("th", {
|
|
502
|
-
className: "px-4 py-3 text-left text-sm font-medium",
|
|
503
|
-
children: "Status"
|
|
504
|
-
}, undefined, false, undefined, this),
|
|
505
|
-
/* @__PURE__ */ jsxDEV("th", {
|
|
506
|
-
className: "px-4 py-3 text-left text-sm font-medium",
|
|
507
|
-
children: "Last Sync"
|
|
508
|
-
}, undefined, false, undefined, this)
|
|
509
|
-
]
|
|
510
|
-
}, undefined, true, undefined, this)
|
|
511
|
-
}, undefined, false, undefined, this),
|
|
512
|
-
/* @__PURE__ */ jsxDEV("tbody", {
|
|
513
|
-
className: "divide-border divide-y",
|
|
514
|
-
children: [
|
|
515
|
-
connections.map((conn) => /* @__PURE__ */ jsxDEV("tr", {
|
|
516
|
-
className: "hover:bg-muted/50",
|
|
517
|
-
children: [
|
|
518
|
-
/* @__PURE__ */ jsxDEV("td", {
|
|
519
|
-
className: "px-4 py-3",
|
|
520
|
-
children: /* @__PURE__ */ jsxDEV("div", {
|
|
521
|
-
className: "font-medium",
|
|
522
|
-
children: conn.name
|
|
523
|
-
}, undefined, false, undefined, this)
|
|
524
|
-
}, undefined, false, undefined, this),
|
|
525
|
-
/* @__PURE__ */ jsxDEV("td", {
|
|
526
|
-
className: "px-4 py-3",
|
|
527
|
-
children: /* @__PURE__ */ jsxDEV("span", {
|
|
528
|
-
className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${STATUS_COLORS[conn.status] ?? ""}`,
|
|
529
|
-
children: conn.status
|
|
530
|
-
}, undefined, false, undefined, this)
|
|
531
|
-
}, undefined, false, undefined, this),
|
|
532
|
-
/* @__PURE__ */ jsxDEV("td", {
|
|
533
|
-
className: "text-muted-foreground px-4 py-3 text-sm",
|
|
534
|
-
children: conn.lastSyncAt?.toLocaleString() ?? "Never"
|
|
535
|
-
}, undefined, false, undefined, this)
|
|
536
|
-
]
|
|
537
|
-
}, conn.id, true, undefined, this)),
|
|
538
|
-
connections.length === 0 && /* @__PURE__ */ jsxDEV("tr", {
|
|
539
|
-
children: /* @__PURE__ */ jsxDEV("td", {
|
|
540
|
-
colSpan: 3,
|
|
541
|
-
className: "text-muted-foreground px-4 py-8 text-center",
|
|
542
|
-
children: "No connections found"
|
|
543
|
-
}, undefined, false, undefined, this)
|
|
544
|
-
}, undefined, false, undefined, this)
|
|
545
|
-
]
|
|
546
|
-
}, undefined, true, undefined, this)
|
|
547
|
-
]
|
|
548
|
-
}, undefined, true, undefined, this)
|
|
549
|
-
}, undefined, false, undefined, this),
|
|
550
|
-
activeTab === "syncs" && /* @__PURE__ */ jsxDEV("div", {
|
|
551
|
-
className: "border-border rounded-lg border",
|
|
552
|
-
children: /* @__PURE__ */ jsxDEV("table", {
|
|
553
|
-
className: "w-full",
|
|
554
|
-
children: [
|
|
555
|
-
/* @__PURE__ */ jsxDEV("thead", {
|
|
556
|
-
className: "border-border bg-muted/30 border-b",
|
|
557
|
-
children: /* @__PURE__ */ jsxDEV("tr", {
|
|
558
|
-
children: [
|
|
559
|
-
/* @__PURE__ */ jsxDEV("th", {
|
|
560
|
-
className: "px-4 py-3 text-left text-sm font-medium",
|
|
561
|
-
children: "Sync Config"
|
|
562
|
-
}, undefined, false, undefined, this),
|
|
563
|
-
/* @__PURE__ */ jsxDEV("th", {
|
|
564
|
-
className: "px-4 py-3 text-left text-sm font-medium",
|
|
565
|
-
children: "Frequency"
|
|
566
|
-
}, undefined, false, undefined, this),
|
|
567
|
-
/* @__PURE__ */ jsxDEV("th", {
|
|
568
|
-
className: "px-4 py-3 text-left text-sm font-medium",
|
|
569
|
-
children: "Status"
|
|
570
|
-
}, undefined, false, undefined, this),
|
|
571
|
-
/* @__PURE__ */ jsxDEV("th", {
|
|
572
|
-
className: "px-4 py-3 text-left text-sm font-medium",
|
|
573
|
-
children: "Records"
|
|
574
|
-
}, undefined, false, undefined, this)
|
|
575
|
-
]
|
|
576
|
-
}, undefined, true, undefined, this)
|
|
577
|
-
}, undefined, false, undefined, this),
|
|
578
|
-
/* @__PURE__ */ jsxDEV("tbody", {
|
|
579
|
-
className: "divide-border divide-y",
|
|
580
|
-
children: [
|
|
581
|
-
syncConfigs.map((sync) => /* @__PURE__ */ jsxDEV("tr", {
|
|
582
|
-
className: "hover:bg-muted/50",
|
|
583
|
-
children: [
|
|
584
|
-
/* @__PURE__ */ jsxDEV("td", {
|
|
585
|
-
className: "px-4 py-3",
|
|
586
|
-
children: [
|
|
587
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
588
|
-
className: "font-medium",
|
|
589
|
-
children: sync.name
|
|
590
|
-
}, undefined, false, undefined, this),
|
|
591
|
-
/* @__PURE__ */ jsxDEV("div", {
|
|
592
|
-
className: "text-muted-foreground text-sm",
|
|
593
|
-
children: [
|
|
594
|
-
sync.sourceEntity,
|
|
595
|
-
" → ",
|
|
596
|
-
sync.targetEntity
|
|
597
|
-
]
|
|
598
|
-
}, undefined, true, undefined, this)
|
|
599
|
-
]
|
|
600
|
-
}, undefined, true, undefined, this),
|
|
601
|
-
/* @__PURE__ */ jsxDEV("td", {
|
|
602
|
-
className: "px-4 py-3 text-sm",
|
|
603
|
-
children: sync.frequency
|
|
604
|
-
}, undefined, false, undefined, this),
|
|
605
|
-
/* @__PURE__ */ jsxDEV("td", {
|
|
606
|
-
className: "px-4 py-3",
|
|
607
|
-
children: /* @__PURE__ */ jsxDEV("span", {
|
|
608
|
-
className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${STATUS_COLORS[sync.status] ?? ""}`,
|
|
609
|
-
children: sync.status
|
|
610
|
-
}, undefined, false, undefined, this)
|
|
611
|
-
}, undefined, false, undefined, this),
|
|
612
|
-
/* @__PURE__ */ jsxDEV("td", {
|
|
613
|
-
className: "text-muted-foreground px-4 py-3 text-sm",
|
|
614
|
-
children: sync.recordsSynced.toLocaleString()
|
|
615
|
-
}, undefined, false, undefined, this)
|
|
616
|
-
]
|
|
617
|
-
}, sync.id, true, undefined, this)),
|
|
618
|
-
syncConfigs.length === 0 && /* @__PURE__ */ jsxDEV("tr", {
|
|
619
|
-
children: /* @__PURE__ */ jsxDEV("td", {
|
|
620
|
-
colSpan: 4,
|
|
621
|
-
className: "text-muted-foreground px-4 py-8 text-center",
|
|
622
|
-
children: "No sync configurations found"
|
|
623
|
-
}, undefined, false, undefined, this)
|
|
624
|
-
}, undefined, false, undefined, this)
|
|
625
|
-
]
|
|
626
|
-
}, undefined, true, undefined, this)
|
|
627
|
-
]
|
|
628
|
-
}, undefined, true, undefined, this)
|
|
629
|
-
}, undefined, false, undefined, this)
|
|
630
|
-
]
|
|
631
|
-
}, undefined, true, undefined, this)
|
|
632
|
-
]
|
|
633
|
-
}, undefined, true, undefined, this);
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
// src/ui/hooks/index.ts
|
|
637
|
-
"use client";
|
|
638
|
-
export {
|
|
639
|
-
useIntegrationData,
|
|
640
|
-
syncConfigMarkdownRenderer,
|
|
641
|
-
integrationDashboardMarkdownRenderer,
|
|
642
|
-
connectionListMarkdownRenderer,
|
|
643
|
-
IntegrationDashboard
|
|
644
|
-
};
|