@contractspec/example.integration-hub 1.57.0 → 1.58.0

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.
Files changed (190) hide show
  1. package/dist/browser/connection/connection.enum.js +12 -0
  2. package/dist/browser/connection/connection.operation.js +101 -0
  3. package/dist/browser/connection/connection.presentation.js +99 -0
  4. package/dist/browser/connection/connection.schema.js +48 -0
  5. package/dist/browser/connection/index.js +104 -0
  6. package/dist/browser/docs/index.js +104 -0
  7. package/dist/browser/docs/integration-hub.docblock.js +104 -0
  8. package/dist/browser/events.js +211 -0
  9. package/dist/browser/example.js +42 -0
  10. package/dist/browser/handlers/index.js +246 -0
  11. package/dist/browser/handlers/integration.handlers.js +246 -0
  12. package/dist/browser/index.js +1595 -0
  13. package/dist/browser/integration/index.js +92 -0
  14. package/dist/browser/integration/integration.enum.js +12 -0
  15. package/dist/browser/integration/integration.operations.js +89 -0
  16. package/dist/browser/integration/integration.presentation.js +117 -0
  17. package/dist/browser/integration/integration.schema.js +42 -0
  18. package/dist/browser/integration-hub.capability.js +40 -0
  19. package/dist/browser/integration-hub.feature.js +114 -0
  20. package/dist/browser/seeders/index.js +60 -0
  21. package/dist/browser/sync/index.js +332 -0
  22. package/dist/browser/sync/sync.enum.js +26 -0
  23. package/dist/browser/sync/sync.operations.js +321 -0
  24. package/dist/browser/sync/sync.presentation.js +298 -0
  25. package/dist/browser/sync/sync.schema.js +154 -0
  26. package/dist/browser/sync-engine/index.js +186 -0
  27. package/dist/browser/tests/operations.test-spec.js +85 -0
  28. package/dist/browser/ui/IntegrationDashboard.js +369 -0
  29. package/dist/browser/ui/hooks/index.js +57 -0
  30. package/dist/browser/ui/hooks/useIntegrationData.js +54 -0
  31. package/dist/browser/ui/index.js +644 -0
  32. package/dist/browser/ui/renderers/index.js +273 -0
  33. package/dist/browser/ui/renderers/integration.markdown.js +273 -0
  34. package/dist/connection/connection.enum.d.ts +1 -6
  35. package/dist/connection/connection.enum.d.ts.map +1 -1
  36. package/dist/connection/connection.enum.js +11 -15
  37. package/dist/connection/connection.operation.d.ts +78 -84
  38. package/dist/connection/connection.operation.d.ts.map +1 -1
  39. package/dist/connection/connection.operation.js +99 -60
  40. package/dist/connection/connection.presentation.d.ts +2 -7
  41. package/dist/connection/connection.presentation.d.ts.map +1 -1
  42. package/dist/connection/connection.presentation.js +96 -56
  43. package/dist/connection/connection.schema.d.ts +54 -59
  44. package/dist/connection/connection.schema.d.ts.map +1 -1
  45. package/dist/connection/connection.schema.js +46 -73
  46. package/dist/connection/index.d.ts +7 -4
  47. package/dist/connection/index.d.ts.map +1 -0
  48. package/dist/connection/index.js +104 -4
  49. package/dist/docs/index.d.ts +2 -1
  50. package/dist/docs/index.d.ts.map +1 -0
  51. package/dist/docs/index.js +105 -1
  52. package/dist/docs/integration-hub.docblock.d.ts +2 -1
  53. package/dist/docs/integration-hub.docblock.d.ts.map +1 -0
  54. package/dist/docs/integration-hub.docblock.js +45 -56
  55. package/dist/events.d.ts +137 -143
  56. package/dist/events.d.ts.map +1 -1
  57. package/dist/events.js +210 -287
  58. package/dist/example.d.ts +2 -6
  59. package/dist/example.d.ts.map +1 -1
  60. package/dist/example.js +41 -55
  61. package/dist/handlers/index.d.ts +2 -2
  62. package/dist/handlers/index.d.ts.map +1 -0
  63. package/dist/handlers/index.js +247 -3
  64. package/dist/handlers/integration.handlers.d.ts +114 -113
  65. package/dist/handlers/integration.handlers.d.ts.map +1 -1
  66. package/dist/handlers/integration.handlers.js +232 -267
  67. package/dist/index.d.ts +12 -19
  68. package/dist/index.d.ts.map +1 -0
  69. package/dist/index.js +1596 -20
  70. package/dist/integration/index.d.ts +7 -4
  71. package/dist/integration/index.d.ts.map +1 -0
  72. package/dist/integration/index.js +92 -4
  73. package/dist/integration/integration.enum.d.ts +1 -6
  74. package/dist/integration/integration.enum.d.ts.map +1 -1
  75. package/dist/integration/integration.enum.js +11 -15
  76. package/dist/integration/integration.operations.d.ts +74 -80
  77. package/dist/integration/integration.operations.d.ts.map +1 -1
  78. package/dist/integration/integration.operations.js +87 -54
  79. package/dist/integration/integration.presentation.d.ts +3 -8
  80. package/dist/integration/integration.presentation.d.ts.map +1 -1
  81. package/dist/integration/integration.presentation.js +114 -73
  82. package/dist/integration/integration.schema.d.ts +54 -59
  83. package/dist/integration/integration.schema.d.ts.map +1 -1
  84. package/dist/integration/integration.schema.js +40 -73
  85. package/dist/integration-hub.capability.d.ts +3 -8
  86. package/dist/integration-hub.capability.d.ts.map +1 -1
  87. package/dist/integration-hub.capability.js +41 -38
  88. package/dist/integration-hub.feature.d.ts +1 -6
  89. package/dist/integration-hub.feature.d.ts.map +1 -1
  90. package/dist/integration-hub.feature.js +113 -242
  91. package/dist/node/connection/connection.enum.js +12 -0
  92. package/dist/node/connection/connection.operation.js +101 -0
  93. package/dist/node/connection/connection.presentation.js +99 -0
  94. package/dist/node/connection/connection.schema.js +48 -0
  95. package/dist/node/connection/index.js +104 -0
  96. package/dist/node/docs/index.js +104 -0
  97. package/dist/node/docs/integration-hub.docblock.js +104 -0
  98. package/dist/node/events.js +211 -0
  99. package/dist/node/example.js +42 -0
  100. package/dist/node/handlers/index.js +246 -0
  101. package/dist/node/handlers/integration.handlers.js +246 -0
  102. package/dist/node/index.js +1595 -0
  103. package/dist/node/integration/index.js +92 -0
  104. package/dist/node/integration/integration.enum.js +12 -0
  105. package/dist/node/integration/integration.operations.js +89 -0
  106. package/dist/node/integration/integration.presentation.js +117 -0
  107. package/dist/node/integration/integration.schema.js +42 -0
  108. package/dist/node/integration-hub.capability.js +40 -0
  109. package/dist/node/integration-hub.feature.js +114 -0
  110. package/dist/node/seeders/index.js +60 -0
  111. package/dist/node/sync/index.js +332 -0
  112. package/dist/node/sync/sync.enum.js +26 -0
  113. package/dist/node/sync/sync.operations.js +321 -0
  114. package/dist/node/sync/sync.presentation.js +298 -0
  115. package/dist/node/sync/sync.schema.js +154 -0
  116. package/dist/node/sync-engine/index.js +186 -0
  117. package/dist/node/tests/operations.test-spec.js +85 -0
  118. package/dist/node/ui/IntegrationDashboard.js +369 -0
  119. package/dist/node/ui/hooks/index.js +57 -0
  120. package/dist/node/ui/hooks/useIntegrationData.js +54 -0
  121. package/dist/node/ui/index.js +644 -0
  122. package/dist/node/ui/renderers/index.js +273 -0
  123. package/dist/node/ui/renderers/integration.markdown.js +273 -0
  124. package/dist/seeders/index.d.ts +4 -8
  125. package/dist/seeders/index.d.ts.map +1 -1
  126. package/dist/seeders/index.js +54 -52
  127. package/dist/sync/index.d.ts +7 -4
  128. package/dist/sync/index.d.ts.map +1 -0
  129. package/dist/sync/index.js +332 -4
  130. package/dist/sync/sync.enum.d.ts +3 -8
  131. package/dist/sync/sync.enum.d.ts.map +1 -1
  132. package/dist/sync/sync.enum.js +23 -31
  133. package/dist/sync/sync.operations.d.ts +413 -419
  134. package/dist/sync/sync.operations.d.ts.map +1 -1
  135. package/dist/sync/sync.operations.js +316 -197
  136. package/dist/sync/sync.presentation.d.ts +6 -11
  137. package/dist/sync/sync.presentation.d.ts.map +1 -1
  138. package/dist/sync/sync.presentation.js +291 -160
  139. package/dist/sync/sync.schema.d.ts +317 -322
  140. package/dist/sync/sync.schema.d.ts.map +1 -1
  141. package/dist/sync/sync.schema.js +146 -295
  142. package/dist/sync-engine/index.d.ts +88 -91
  143. package/dist/sync-engine/index.d.ts.map +1 -1
  144. package/dist/sync-engine/index.js +181 -142
  145. package/dist/tests/operations.test-spec.d.ts +3 -8
  146. package/dist/tests/operations.test-spec.d.ts.map +1 -1
  147. package/dist/tests/operations.test-spec.js +82 -90
  148. package/dist/ui/IntegrationDashboard.d.ts +1 -6
  149. package/dist/ui/IntegrationDashboard.d.ts.map +1 -1
  150. package/dist/ui/IntegrationDashboard.js +365 -261
  151. package/dist/ui/hooks/index.d.ts +2 -2
  152. package/dist/ui/hooks/index.d.ts.map +1 -0
  153. package/dist/ui/hooks/index.js +57 -4
  154. package/dist/ui/hooks/useIntegrationData.d.ts +16 -20
  155. package/dist/ui/hooks/useIntegrationData.d.ts.map +1 -1
  156. package/dist/ui/hooks/useIntegrationData.js +51 -55
  157. package/dist/ui/index.d.ts +7 -6
  158. package/dist/ui/index.d.ts.map +1 -0
  159. package/dist/ui/index.js +644 -5
  160. package/dist/ui/renderers/index.d.ts +2 -2
  161. package/dist/ui/renderers/index.d.ts.map +1 -0
  162. package/dist/ui/renderers/index.js +274 -3
  163. package/dist/ui/renderers/integration.markdown.d.ts +13 -14
  164. package/dist/ui/renderers/integration.markdown.d.ts.map +1 -1
  165. package/dist/ui/renderers/integration.markdown.js +268 -264
  166. package/package.json +360 -71
  167. package/dist/connection/connection.enum.js.map +0 -1
  168. package/dist/connection/connection.operation.js.map +0 -1
  169. package/dist/connection/connection.presentation.js.map +0 -1
  170. package/dist/connection/connection.schema.js.map +0 -1
  171. package/dist/docs/integration-hub.docblock.js.map +0 -1
  172. package/dist/events.js.map +0 -1
  173. package/dist/example.js.map +0 -1
  174. package/dist/handlers/integration.handlers.js.map +0 -1
  175. package/dist/integration/integration.enum.js.map +0 -1
  176. package/dist/integration/integration.operations.js.map +0 -1
  177. package/dist/integration/integration.presentation.js.map +0 -1
  178. package/dist/integration/integration.schema.js.map +0 -1
  179. package/dist/integration-hub.capability.js.map +0 -1
  180. package/dist/integration-hub.feature.js.map +0 -1
  181. package/dist/seeders/index.js.map +0 -1
  182. package/dist/sync/sync.enum.js.map +0 -1
  183. package/dist/sync/sync.operations.js.map +0 -1
  184. package/dist/sync/sync.presentation.js.map +0 -1
  185. package/dist/sync/sync.schema.js.map +0 -1
  186. package/dist/sync-engine/index.js.map +0 -1
  187. package/dist/tests/operations.test-spec.js.map +0 -1
  188. package/dist/ui/IntegrationDashboard.js.map +0 -1
  189. package/dist/ui/hooks/useIntegrationData.js.map +0 -1
  190. package/dist/ui/renderers/integration.markdown.js.map +0 -1
@@ -1,266 +1,370 @@
1
- 'use client';
2
-
3
- import { useIntegrationData } from "./hooks/useIntegrationData.js";
4
- import { useState } from "react";
5
- import { Button, ErrorState, LoaderBlock, StatCard, StatCardGroup } from "@contractspec/lib.design-system";
6
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ // @bun
2
+ // src/ui/hooks/useIntegrationData.ts
3
+ import { useCallback, useEffect, useState } from "react";
4
+ import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
5
+ "use client";
6
+ function useIntegrationData(projectId = "local-project") {
7
+ const { handlers } = useTemplateRuntime();
8
+ const integration = handlers.integration;
9
+ const [integrations, setIntegrations] = useState([]);
10
+ const [connections, setConnections] = useState([]);
11
+ const [syncConfigs, setSyncConfigs] = useState([]);
12
+ const [loading, setLoading] = useState(true);
13
+ const [error, setError] = useState(null);
14
+ const fetchData = useCallback(async () => {
15
+ try {
16
+ setLoading(true);
17
+ setError(null);
18
+ const [integResult, connResult, syncResult] = await Promise.all([
19
+ integration.listIntegrations({ projectId, limit: 100 }),
20
+ integration.listConnections({ limit: 100 }),
21
+ integration.listSyncConfigs({ limit: 100 })
22
+ ]);
23
+ setIntegrations(integResult.integrations);
24
+ setConnections(connResult.connections);
25
+ setSyncConfigs(syncResult.configs);
26
+ } catch (err) {
27
+ setError(err instanceof Error ? err : new Error("Failed to load integrations"));
28
+ } finally {
29
+ setLoading(false);
30
+ }
31
+ }, [integration, projectId]);
32
+ useEffect(() => {
33
+ fetchData();
34
+ }, [fetchData]);
35
+ const stats = {
36
+ totalIntegrations: integrations.length,
37
+ activeIntegrations: integrations.filter((i) => i.status === "ACTIVE").length,
38
+ totalConnections: connections.length,
39
+ connectedCount: connections.filter((c) => c.status === "CONNECTED").length,
40
+ totalSyncs: syncConfigs.length,
41
+ activeSyncs: syncConfigs.filter((s) => s.status === "ACTIVE").length
42
+ };
43
+ return {
44
+ integrations,
45
+ connections,
46
+ syncConfigs,
47
+ loading,
48
+ error,
49
+ stats,
50
+ refetch: fetchData
51
+ };
52
+ }
7
53
 
8
- //#region src/ui/IntegrationDashboard.tsx
9
- /**
10
- * Integration Hub Dashboard
11
- *
12
- * Interactive dashboard for the integration-hub template.
13
- * Displays integrations, connections, and sync configurations.
14
- */
15
- const STATUS_COLORS = {
16
- ACTIVE: "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",
17
- INACTIVE: "bg-gray-100 text-gray-700 dark:bg-gray-900/30 dark:text-gray-400",
18
- CONNECTED: "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",
19
- DISCONNECTED: "bg-gray-100 text-gray-700 dark:bg-gray-900/30 dark:text-gray-400",
20
- PENDING: "bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400",
21
- ERROR: "bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400",
22
- PAUSED: "bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400"
54
+ // src/ui/IntegrationDashboard.tsx
55
+ import { useState as useState2 } from "react";
56
+ import {
57
+ Button,
58
+ ErrorState,
59
+ LoaderBlock,
60
+ StatCard,
61
+ StatCardGroup
62
+ } from "@contractspec/lib.design-system";
63
+ import { jsxDEV } from "react/jsx-dev-runtime";
64
+ "use client";
65
+ var STATUS_COLORS = {
66
+ ACTIVE: "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",
67
+ INACTIVE: "bg-gray-100 text-gray-700 dark:bg-gray-900/30 dark:text-gray-400",
68
+ CONNECTED: "bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",
69
+ DISCONNECTED: "bg-gray-100 text-gray-700 dark:bg-gray-900/30 dark:text-gray-400",
70
+ PENDING: "bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400",
71
+ ERROR: "bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400",
72
+ PAUSED: "bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400"
23
73
  };
24
- const TYPE_ICONS = {
25
- CRM: "📊",
26
- MARKETING: "📣",
27
- PAYMENT: "💳",
28
- COMMUNICATION: "💬",
29
- DATA: "🗄️",
30
- CUSTOM: "⚙️"
74
+ var TYPE_ICONS = {
75
+ CRM: "\uD83D\uDCCA",
76
+ MARKETING: "\uD83D\uDCE3",
77
+ PAYMENT: "\uD83D\uDCB3",
78
+ COMMUNICATION: "\uD83D\uDCAC",
79
+ DATA: "\uD83D\uDDC4\uFE0F",
80
+ CUSTOM: "\u2699\uFE0F"
31
81
  };
32
82
  function IntegrationDashboard() {
33
- const [activeTab, setActiveTab] = useState("integrations");
34
- const { integrations, connections, syncConfigs, loading, error, stats, refetch } = useIntegrationData();
35
- const tabs = [
36
- {
37
- id: "integrations",
38
- label: "Integrations",
39
- icon: "🔌"
40
- },
41
- {
42
- id: "connections",
43
- label: "Connections",
44
- icon: "🔗"
45
- },
46
- {
47
- id: "syncs",
48
- label: "Sync Configs",
49
- icon: "🔄"
50
- }
51
- ];
52
- if (loading) return /* @__PURE__ */ jsx(LoaderBlock, { label: "Loading Integrations..." });
53
- if (error) return /* @__PURE__ */ jsx(ErrorState, {
54
- title: "Failed to load Integrations",
55
- description: error.message,
56
- onRetry: refetch,
57
- retryLabel: "Retry"
58
- });
59
- return /* @__PURE__ */ jsxs("div", {
60
- className: "space-y-6",
61
- children: [
62
- /* @__PURE__ */ jsxs("div", {
63
- className: "flex items-center justify-between",
64
- children: [/* @__PURE__ */ jsx("h2", {
65
- className: "text-2xl font-bold",
66
- children: "Integration Hub"
67
- }), /* @__PURE__ */ jsxs(Button, {
68
- onClick: () => alert("Add integration modal"),
69
- children: [/* @__PURE__ */ jsx("span", {
70
- className: "mr-2",
71
- children: "+"
72
- }), " Add Integration"]
73
- })]
74
- }),
75
- /* @__PURE__ */ jsxs(StatCardGroup, { children: [
76
- /* @__PURE__ */ jsx(StatCard, {
77
- label: "Integrations",
78
- value: stats.totalIntegrations,
79
- hint: `${stats.activeIntegrations} active`
80
- }),
81
- /* @__PURE__ */ jsx(StatCard, {
82
- label: "Connections",
83
- value: stats.totalConnections,
84
- hint: `${stats.connectedCount} connected`
85
- }),
86
- /* @__PURE__ */ jsx(StatCard, {
87
- label: "Syncs",
88
- value: stats.totalSyncs,
89
- hint: `${stats.activeSyncs} active`
90
- })
91
- ] }),
92
- /* @__PURE__ */ jsx("nav", {
93
- className: "bg-muted flex gap-1 rounded-lg p-1",
94
- role: "tablist",
95
- children: tabs.map((tab) => /* @__PURE__ */ jsxs(Button, {
96
- type: "button",
97
- role: "tab",
98
- "aria-selected": activeTab === tab.id,
99
- onClick: () => setActiveTab(tab.id),
100
- 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"}`,
101
- children: [/* @__PURE__ */ jsx("span", { children: tab.icon }), tab.label]
102
- }, tab.id))
103
- }),
104
- /* @__PURE__ */ jsxs("div", {
105
- className: "min-h-[400px]",
106
- role: "tabpanel",
107
- children: [
108
- activeTab === "integrations" && /* @__PURE__ */ jsxs("div", {
109
- className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3",
110
- children: [integrations.map((integration) => /* @__PURE__ */ jsxs("div", {
111
- className: "border-border bg-card hover:bg-muted/50 cursor-pointer rounded-lg border p-4 transition-colors",
112
- children: [/* @__PURE__ */ jsxs("div", {
113
- className: "mb-3 flex items-center gap-3",
114
- children: [/* @__PURE__ */ jsx("span", {
115
- className: "text-2xl",
116
- children: TYPE_ICONS[integration.type] ?? "⚙️"
117
- }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
118
- className: "font-medium",
119
- children: integration.name
120
- }), /* @__PURE__ */ jsx("p", {
121
- className: "text-muted-foreground text-sm",
122
- children: integration.type
123
- })] })]
124
- }), /* @__PURE__ */ jsxs("div", {
125
- className: "flex items-center justify-between",
126
- children: [/* @__PURE__ */ jsx("span", {
127
- className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${STATUS_COLORS[integration.status] ?? ""}`,
128
- children: integration.status
129
- }), /* @__PURE__ */ jsx("span", {
130
- className: "text-muted-foreground text-xs",
131
- children: integration.createdAt.toLocaleDateString()
132
- })]
133
- })]
134
- }, integration.id)), integrations.length === 0 && /* @__PURE__ */ jsx("div", {
135
- className: "text-muted-foreground col-span-full flex h-64 items-center justify-center",
136
- children: "No integrations configured"
137
- })]
138
- }),
139
- activeTab === "connections" && /* @__PURE__ */ jsx("div", {
140
- className: "border-border rounded-lg border",
141
- children: /* @__PURE__ */ jsxs("table", {
142
- className: "w-full",
143
- children: [/* @__PURE__ */ jsx("thead", {
144
- className: "border-border bg-muted/30 border-b",
145
- children: /* @__PURE__ */ jsxs("tr", { children: [
146
- /* @__PURE__ */ jsx("th", {
147
- className: "px-4 py-3 text-left text-sm font-medium",
148
- children: "Connection"
149
- }),
150
- /* @__PURE__ */ jsx("th", {
151
- className: "px-4 py-3 text-left text-sm font-medium",
152
- children: "Status"
153
- }),
154
- /* @__PURE__ */ jsx("th", {
155
- className: "px-4 py-3 text-left text-sm font-medium",
156
- children: "Last Sync"
157
- })
158
- ] })
159
- }), /* @__PURE__ */ jsxs("tbody", {
160
- className: "divide-border divide-y",
161
- children: [connections.map((conn) => /* @__PURE__ */ jsxs("tr", {
162
- className: "hover:bg-muted/50",
163
- children: [
164
- /* @__PURE__ */ jsx("td", {
165
- className: "px-4 py-3",
166
- children: /* @__PURE__ */ jsx("div", {
167
- className: "font-medium",
168
- children: conn.name
169
- })
170
- }),
171
- /* @__PURE__ */ jsx("td", {
172
- className: "px-4 py-3",
173
- children: /* @__PURE__ */ jsx("span", {
174
- className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${STATUS_COLORS[conn.status] ?? ""}`,
175
- children: conn.status
176
- })
177
- }),
178
- /* @__PURE__ */ jsx("td", {
179
- className: "text-muted-foreground px-4 py-3 text-sm",
180
- children: conn.lastSyncAt?.toLocaleString() ?? "Never"
181
- })
182
- ]
183
- }, conn.id)), connections.length === 0 && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
184
- colSpan: 3,
185
- className: "text-muted-foreground px-4 py-8 text-center",
186
- children: "No connections found"
187
- }) })]
188
- })]
189
- })
190
- }),
191
- activeTab === "syncs" && /* @__PURE__ */ jsx("div", {
192
- className: "border-border rounded-lg border",
193
- children: /* @__PURE__ */ jsxs("table", {
194
- className: "w-full",
195
- children: [/* @__PURE__ */ jsx("thead", {
196
- className: "border-border bg-muted/30 border-b",
197
- children: /* @__PURE__ */ jsxs("tr", { children: [
198
- /* @__PURE__ */ jsx("th", {
199
- className: "px-4 py-3 text-left text-sm font-medium",
200
- children: "Sync Config"
201
- }),
202
- /* @__PURE__ */ jsx("th", {
203
- className: "px-4 py-3 text-left text-sm font-medium",
204
- children: "Frequency"
205
- }),
206
- /* @__PURE__ */ jsx("th", {
207
- className: "px-4 py-3 text-left text-sm font-medium",
208
- children: "Status"
209
- }),
210
- /* @__PURE__ */ jsx("th", {
211
- className: "px-4 py-3 text-left text-sm font-medium",
212
- children: "Records"
213
- })
214
- ] })
215
- }), /* @__PURE__ */ jsxs("tbody", {
216
- className: "divide-border divide-y",
217
- children: [syncConfigs.map((sync) => /* @__PURE__ */ jsxs("tr", {
218
- className: "hover:bg-muted/50",
219
- children: [
220
- /* @__PURE__ */ jsxs("td", {
221
- className: "px-4 py-3",
222
- children: [/* @__PURE__ */ jsx("div", {
223
- className: "font-medium",
224
- children: sync.name
225
- }), /* @__PURE__ */ jsxs("div", {
226
- className: "text-muted-foreground text-sm",
227
- children: [
228
- sync.sourceEntity,
229
- " ",
230
- sync.targetEntity
231
- ]
232
- })]
233
- }),
234
- /* @__PURE__ */ jsx("td", {
235
- className: "px-4 py-3 text-sm",
236
- children: sync.frequency
237
- }),
238
- /* @__PURE__ */ jsx("td", {
239
- className: "px-4 py-3",
240
- children: /* @__PURE__ */ jsx("span", {
241
- className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${STATUS_COLORS[sync.status] ?? ""}`,
242
- children: sync.status
243
- })
244
- }),
245
- /* @__PURE__ */ jsx("td", {
246
- className: "text-muted-foreground px-4 py-3 text-sm",
247
- children: sync.recordsSynced.toLocaleString()
248
- })
249
- ]
250
- }, sync.id)), syncConfigs.length === 0 && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
251
- colSpan: 4,
252
- className: "text-muted-foreground px-4 py-8 text-center",
253
- children: "No sync configurations found"
254
- }) })]
255
- })]
256
- })
257
- })
258
- ]
259
- })
260
- ]
261
- });
83
+ const [activeTab, setActiveTab] = useState2("integrations");
84
+ const {
85
+ integrations,
86
+ connections,
87
+ syncConfigs,
88
+ loading,
89
+ error,
90
+ stats,
91
+ refetch
92
+ } = useIntegrationData();
93
+ const tabs = [
94
+ { id: "integrations", label: "Integrations", icon: "\uD83D\uDD0C" },
95
+ { id: "connections", label: "Connections", icon: "\uD83D\uDD17" },
96
+ { id: "syncs", label: "Sync Configs", icon: "\uD83D\uDD04" }
97
+ ];
98
+ if (loading) {
99
+ return /* @__PURE__ */ jsxDEV(LoaderBlock, {
100
+ label: "Loading Integrations..."
101
+ }, undefined, false, undefined, this);
102
+ }
103
+ if (error) {
104
+ return /* @__PURE__ */ jsxDEV(ErrorState, {
105
+ title: "Failed to load Integrations",
106
+ description: error.message,
107
+ onRetry: refetch,
108
+ retryLabel: "Retry"
109
+ }, undefined, false, undefined, this);
110
+ }
111
+ return /* @__PURE__ */ jsxDEV("div", {
112
+ className: "space-y-6",
113
+ children: [
114
+ /* @__PURE__ */ jsxDEV("div", {
115
+ className: "flex items-center justify-between",
116
+ children: [
117
+ /* @__PURE__ */ jsxDEV("h2", {
118
+ className: "text-2xl font-bold",
119
+ children: "Integration Hub"
120
+ }, undefined, false, undefined, this),
121
+ /* @__PURE__ */ jsxDEV(Button, {
122
+ onClick: () => alert("Add integration modal"),
123
+ children: [
124
+ /* @__PURE__ */ jsxDEV("span", {
125
+ className: "mr-2",
126
+ children: "+"
127
+ }, undefined, false, undefined, this),
128
+ " Add Integration"
129
+ ]
130
+ }, undefined, true, undefined, this)
131
+ ]
132
+ }, undefined, true, undefined, this),
133
+ /* @__PURE__ */ jsxDEV(StatCardGroup, {
134
+ children: [
135
+ /* @__PURE__ */ jsxDEV(StatCard, {
136
+ label: "Integrations",
137
+ value: stats.totalIntegrations,
138
+ hint: `${stats.activeIntegrations} active`
139
+ }, undefined, false, undefined, this),
140
+ /* @__PURE__ */ jsxDEV(StatCard, {
141
+ label: "Connections",
142
+ value: stats.totalConnections,
143
+ hint: `${stats.connectedCount} connected`
144
+ }, undefined, false, undefined, this),
145
+ /* @__PURE__ */ jsxDEV(StatCard, {
146
+ label: "Syncs",
147
+ value: stats.totalSyncs,
148
+ hint: `${stats.activeSyncs} active`
149
+ }, undefined, false, undefined, this)
150
+ ]
151
+ }, undefined, true, undefined, this),
152
+ /* @__PURE__ */ jsxDEV("nav", {
153
+ className: "bg-muted flex gap-1 rounded-lg p-1",
154
+ role: "tablist",
155
+ children: tabs.map((tab) => /* @__PURE__ */ jsxDEV(Button, {
156
+ type: "button",
157
+ role: "tab",
158
+ "aria-selected": activeTab === tab.id,
159
+ onClick: () => setActiveTab(tab.id),
160
+ 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"}`,
161
+ children: [
162
+ /* @__PURE__ */ jsxDEV("span", {
163
+ children: tab.icon
164
+ }, undefined, false, undefined, this),
165
+ tab.label
166
+ ]
167
+ }, tab.id, true, undefined, this))
168
+ }, undefined, false, undefined, this),
169
+ /* @__PURE__ */ jsxDEV("div", {
170
+ className: "min-h-[400px]",
171
+ role: "tabpanel",
172
+ children: [
173
+ activeTab === "integrations" && /* @__PURE__ */ jsxDEV("div", {
174
+ className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-3",
175
+ children: [
176
+ integrations.map((integration) => /* @__PURE__ */ jsxDEV("div", {
177
+ className: "border-border bg-card hover:bg-muted/50 cursor-pointer rounded-lg border p-4 transition-colors",
178
+ children: [
179
+ /* @__PURE__ */ jsxDEV("div", {
180
+ className: "mb-3 flex items-center gap-3",
181
+ children: [
182
+ /* @__PURE__ */ jsxDEV("span", {
183
+ className: "text-2xl",
184
+ children: TYPE_ICONS[integration.type] ?? "\u2699\uFE0F"
185
+ }, undefined, false, undefined, this),
186
+ /* @__PURE__ */ jsxDEV("div", {
187
+ children: [
188
+ /* @__PURE__ */ jsxDEV("h3", {
189
+ className: "font-medium",
190
+ children: integration.name
191
+ }, undefined, false, undefined, this),
192
+ /* @__PURE__ */ jsxDEV("p", {
193
+ className: "text-muted-foreground text-sm",
194
+ children: integration.type
195
+ }, undefined, false, undefined, this)
196
+ ]
197
+ }, undefined, true, undefined, this)
198
+ ]
199
+ }, undefined, true, undefined, this),
200
+ /* @__PURE__ */ jsxDEV("div", {
201
+ className: "flex items-center justify-between",
202
+ children: [
203
+ /* @__PURE__ */ jsxDEV("span", {
204
+ className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${STATUS_COLORS[integration.status] ?? ""}`,
205
+ children: integration.status
206
+ }, undefined, false, undefined, this),
207
+ /* @__PURE__ */ jsxDEV("span", {
208
+ className: "text-muted-foreground text-xs",
209
+ children: integration.createdAt.toLocaleDateString()
210
+ }, undefined, false, undefined, this)
211
+ ]
212
+ }, undefined, true, undefined, this)
213
+ ]
214
+ }, integration.id, true, undefined, this)),
215
+ integrations.length === 0 && /* @__PURE__ */ jsxDEV("div", {
216
+ className: "text-muted-foreground col-span-full flex h-64 items-center justify-center",
217
+ children: "No integrations configured"
218
+ }, undefined, false, undefined, this)
219
+ ]
220
+ }, undefined, true, undefined, this),
221
+ activeTab === "connections" && /* @__PURE__ */ jsxDEV("div", {
222
+ className: "border-border rounded-lg border",
223
+ children: /* @__PURE__ */ jsxDEV("table", {
224
+ className: "w-full",
225
+ children: [
226
+ /* @__PURE__ */ jsxDEV("thead", {
227
+ className: "border-border bg-muted/30 border-b",
228
+ children: /* @__PURE__ */ jsxDEV("tr", {
229
+ children: [
230
+ /* @__PURE__ */ jsxDEV("th", {
231
+ className: "px-4 py-3 text-left text-sm font-medium",
232
+ children: "Connection"
233
+ }, undefined, false, undefined, this),
234
+ /* @__PURE__ */ jsxDEV("th", {
235
+ className: "px-4 py-3 text-left text-sm font-medium",
236
+ children: "Status"
237
+ }, undefined, false, undefined, this),
238
+ /* @__PURE__ */ jsxDEV("th", {
239
+ className: "px-4 py-3 text-left text-sm font-medium",
240
+ children: "Last Sync"
241
+ }, undefined, false, undefined, this)
242
+ ]
243
+ }, undefined, true, undefined, this)
244
+ }, undefined, false, undefined, this),
245
+ /* @__PURE__ */ jsxDEV("tbody", {
246
+ className: "divide-border divide-y",
247
+ children: [
248
+ connections.map((conn) => /* @__PURE__ */ jsxDEV("tr", {
249
+ className: "hover:bg-muted/50",
250
+ children: [
251
+ /* @__PURE__ */ jsxDEV("td", {
252
+ className: "px-4 py-3",
253
+ children: /* @__PURE__ */ jsxDEV("div", {
254
+ className: "font-medium",
255
+ children: conn.name
256
+ }, undefined, false, undefined, this)
257
+ }, undefined, false, undefined, this),
258
+ /* @__PURE__ */ jsxDEV("td", {
259
+ className: "px-4 py-3",
260
+ children: /* @__PURE__ */ jsxDEV("span", {
261
+ className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${STATUS_COLORS[conn.status] ?? ""}`,
262
+ children: conn.status
263
+ }, undefined, false, undefined, this)
264
+ }, undefined, false, undefined, this),
265
+ /* @__PURE__ */ jsxDEV("td", {
266
+ className: "text-muted-foreground px-4 py-3 text-sm",
267
+ children: conn.lastSyncAt?.toLocaleString() ?? "Never"
268
+ }, undefined, false, undefined, this)
269
+ ]
270
+ }, conn.id, true, undefined, this)),
271
+ connections.length === 0 && /* @__PURE__ */ jsxDEV("tr", {
272
+ children: /* @__PURE__ */ jsxDEV("td", {
273
+ colSpan: 3,
274
+ className: "text-muted-foreground px-4 py-8 text-center",
275
+ children: "No connections found"
276
+ }, undefined, false, undefined, this)
277
+ }, undefined, false, undefined, this)
278
+ ]
279
+ }, undefined, true, undefined, this)
280
+ ]
281
+ }, undefined, true, undefined, this)
282
+ }, undefined, false, undefined, this),
283
+ activeTab === "syncs" && /* @__PURE__ */ jsxDEV("div", {
284
+ className: "border-border rounded-lg border",
285
+ children: /* @__PURE__ */ jsxDEV("table", {
286
+ className: "w-full",
287
+ children: [
288
+ /* @__PURE__ */ jsxDEV("thead", {
289
+ className: "border-border bg-muted/30 border-b",
290
+ children: /* @__PURE__ */ jsxDEV("tr", {
291
+ children: [
292
+ /* @__PURE__ */ jsxDEV("th", {
293
+ className: "px-4 py-3 text-left text-sm font-medium",
294
+ children: "Sync Config"
295
+ }, undefined, false, undefined, this),
296
+ /* @__PURE__ */ jsxDEV("th", {
297
+ className: "px-4 py-3 text-left text-sm font-medium",
298
+ children: "Frequency"
299
+ }, undefined, false, undefined, this),
300
+ /* @__PURE__ */ jsxDEV("th", {
301
+ className: "px-4 py-3 text-left text-sm font-medium",
302
+ children: "Status"
303
+ }, undefined, false, undefined, this),
304
+ /* @__PURE__ */ jsxDEV("th", {
305
+ className: "px-4 py-3 text-left text-sm font-medium",
306
+ children: "Records"
307
+ }, undefined, false, undefined, this)
308
+ ]
309
+ }, undefined, true, undefined, this)
310
+ }, undefined, false, undefined, this),
311
+ /* @__PURE__ */ jsxDEV("tbody", {
312
+ className: "divide-border divide-y",
313
+ children: [
314
+ syncConfigs.map((sync) => /* @__PURE__ */ jsxDEV("tr", {
315
+ className: "hover:bg-muted/50",
316
+ children: [
317
+ /* @__PURE__ */ jsxDEV("td", {
318
+ className: "px-4 py-3",
319
+ children: [
320
+ /* @__PURE__ */ jsxDEV("div", {
321
+ className: "font-medium",
322
+ children: sync.name
323
+ }, undefined, false, undefined, this),
324
+ /* @__PURE__ */ jsxDEV("div", {
325
+ className: "text-muted-foreground text-sm",
326
+ children: [
327
+ sync.sourceEntity,
328
+ " \u2192 ",
329
+ sync.targetEntity
330
+ ]
331
+ }, undefined, true, undefined, this)
332
+ ]
333
+ }, undefined, true, undefined, this),
334
+ /* @__PURE__ */ jsxDEV("td", {
335
+ className: "px-4 py-3 text-sm",
336
+ children: sync.frequency
337
+ }, undefined, false, undefined, this),
338
+ /* @__PURE__ */ jsxDEV("td", {
339
+ className: "px-4 py-3",
340
+ children: /* @__PURE__ */ jsxDEV("span", {
341
+ className: `inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${STATUS_COLORS[sync.status] ?? ""}`,
342
+ children: sync.status
343
+ }, undefined, false, undefined, this)
344
+ }, undefined, false, undefined, this),
345
+ /* @__PURE__ */ jsxDEV("td", {
346
+ className: "text-muted-foreground px-4 py-3 text-sm",
347
+ children: sync.recordsSynced.toLocaleString()
348
+ }, undefined, false, undefined, this)
349
+ ]
350
+ }, sync.id, true, undefined, this)),
351
+ syncConfigs.length === 0 && /* @__PURE__ */ jsxDEV("tr", {
352
+ children: /* @__PURE__ */ jsxDEV("td", {
353
+ colSpan: 4,
354
+ className: "text-muted-foreground px-4 py-8 text-center",
355
+ children: "No sync configurations found"
356
+ }, undefined, false, undefined, this)
357
+ }, undefined, false, undefined, this)
358
+ ]
359
+ }, undefined, true, undefined, this)
360
+ ]
361
+ }, undefined, true, undefined, this)
362
+ }, undefined, false, undefined, this)
363
+ ]
364
+ }, undefined, true, undefined, this)
365
+ ]
366
+ }, undefined, true, undefined, this);
262
367
  }
263
-
264
- //#endregion
265
- export { IntegrationDashboard };
266
- //# sourceMappingURL=IntegrationDashboard.js.map
368
+ export {
369
+ IntegrationDashboard
370
+ };