@geenius/adapters 0.1.0 → 0.3.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.
- package/README.md +79 -42
- package/package.json +23 -4
- package/packages/convex/README.md +1 -1
- package/packages/convex/dist/index.cjs +300 -0
- package/packages/convex/dist/index.cjs.map +1 -0
- package/packages/convex/dist/index.d.cts +231 -0
- package/packages/convex/dist/index.d.ts +231 -0
- package/packages/convex/dist/index.js +263 -0
- package/packages/convex/dist/index.js.map +1 -0
- package/packages/react/README.md +1 -1
- package/packages/react/dist/index.d.mts +106 -0
- package/packages/react/dist/index.d.ts +106 -0
- package/packages/react/dist/index.js +611 -0
- package/packages/react/dist/index.js.map +1 -0
- package/packages/react/dist/index.mjs +570 -0
- package/packages/react/dist/index.mjs.map +1 -0
- package/packages/react-css/README.md +1 -1
- package/packages/react-css/dist/index.cjs +515 -0
- package/packages/react-css/dist/index.cjs.map +1 -0
- package/packages/react-css/dist/index.d.cts +105 -0
- package/packages/react-css/dist/index.d.ts +105 -0
- package/packages/react-css/dist/index.js +467 -0
- package/packages/react-css/dist/index.js.map +1 -0
- package/packages/shared/README.md +1 -1
- package/packages/shared/dist/index.d.mts +625 -0
- package/packages/shared/dist/index.d.ts +625 -0
- package/packages/shared/dist/index.js +1567 -0
- package/packages/shared/dist/index.js.map +1 -0
- package/packages/shared/dist/index.mjs +1489 -0
- package/packages/shared/dist/index.mjs.map +1 -0
- package/packages/solidjs/README.md +1 -1
- package/packages/solidjs/dist/index.d.mts +97 -0
- package/packages/solidjs/dist/index.d.ts +97 -0
- package/packages/solidjs/dist/index.js +250 -0
- package/packages/solidjs/dist/index.js.map +1 -0
- package/packages/solidjs/dist/index.mjs +202 -0
- package/packages/solidjs/dist/index.mjs.map +1 -0
- package/packages/solidjs-css/README.md +1 -1
- package/packages/solidjs-css/dist/index.cjs +343 -0
- package/packages/solidjs-css/dist/index.cjs.map +1 -0
- package/packages/solidjs-css/dist/index.d.cts +67 -0
- package/packages/solidjs-css/dist/index.d.ts +67 -0
- package/packages/solidjs-css/dist/index.js +326 -0
- package/packages/solidjs-css/dist/index.js.map +1 -0
- package/.changeset/config.json +0 -11
- package/.github/CODEOWNERS +0 -1
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -16
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -11
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -10
- package/.github/dependabot.yml +0 -11
- package/.github/workflows/ci.yml +0 -23
- package/.github/workflows/release.yml +0 -29
- package/.nvmrc +0 -1
- package/.project/ACCOUNT.yaml +0 -4
- package/.project/IDEAS.yaml +0 -7
- package/.project/PROJECT.yaml +0 -11
- package/.project/ROADMAP.yaml +0 -15
- package/CODE_OF_CONDUCT.md +0 -16
- package/CONTRIBUTING.md +0 -26
- package/SECURITY.md +0 -15
- package/SUPPORT.md +0 -8
- package/packages/convex/package.json +0 -42
- package/packages/convex/src/adapter.ts +0 -39
- package/packages/convex/src/index.ts +0 -19
- package/packages/convex/src/mutations.ts +0 -142
- package/packages/convex/src/queries.ts +0 -106
- package/packages/convex/src/schema.ts +0 -54
- package/packages/convex/src/types.ts +0 -20
- package/packages/convex/tsconfig.json +0 -11
- package/packages/convex/tsup.config.ts +0 -10
- package/packages/react/package.json +0 -45
- package/packages/react/src/components/AdapterCard.tsx +0 -49
- package/packages/react/src/components/AdapterConfigForm.tsx +0 -118
- package/packages/react/src/components/AdapterList.tsx +0 -84
- package/packages/react/src/components/AdapterStatusBadge.tsx +0 -30
- package/packages/react/src/components/index.ts +0 -4
- package/packages/react/src/hooks/index.ts +0 -75
- package/packages/react/src/index.tsx +0 -44
- package/packages/react/src/pages/AdapterDetailPage.tsx +0 -133
- package/packages/react/src/pages/AdaptersPage.tsx +0 -111
- package/packages/react/src/pages/index.ts +0 -2
- package/packages/react/src/provider/AdapterProvider.tsx +0 -115
- package/packages/react/src/provider/index.ts +0 -2
- package/packages/react/tsconfig.json +0 -18
- package/packages/react/tsup.config.ts +0 -10
- package/packages/react-css/package.json +0 -44
- package/packages/react-css/src/adapters.css +0 -1576
- package/packages/react-css/src/components/AdapterCard.tsx +0 -34
- package/packages/react-css/src/components/AdapterConfigForm.tsx +0 -63
- package/packages/react-css/src/components/AdapterList.tsx +0 -40
- package/packages/react-css/src/components/AdapterStatusBadge.tsx +0 -21
- package/packages/react-css/src/components/index.ts +0 -4
- package/packages/react-css/src/hooks/index.ts +0 -75
- package/packages/react-css/src/index.tsx +0 -25
- package/packages/react-css/src/pages/AdapterDetailPage.tsx +0 -133
- package/packages/react-css/src/pages/AdaptersPage.tsx +0 -111
- package/packages/react-css/src/pages/index.ts +0 -2
- package/packages/react-css/src/provider/AdapterProvider.tsx +0 -115
- package/packages/react-css/src/provider/index.ts +0 -2
- package/packages/react-css/src/styles.css +0 -494
- package/packages/react-css/tsconfig.json +0 -19
- package/packages/react-css/tsup.config.ts +0 -2
- package/packages/shared/package.json +0 -39
- package/packages/shared/src/__tests__/adapters.test.ts +0 -545
- package/packages/shared/src/admin/index.ts +0 -2
- package/packages/shared/src/admin/interface.ts +0 -34
- package/packages/shared/src/admin/localStorage.ts +0 -109
- package/packages/shared/src/ai/anthropic.ts +0 -123
- package/packages/shared/src/ai/cloudflare-gateway.ts +0 -130
- package/packages/shared/src/ai/gemini.ts +0 -181
- package/packages/shared/src/ai/index.ts +0 -14
- package/packages/shared/src/ai/interface.ts +0 -11
- package/packages/shared/src/ai/localStorage.ts +0 -78
- package/packages/shared/src/ai/ollama.ts +0 -143
- package/packages/shared/src/ai/openai.ts +0 -120
- package/packages/shared/src/ai/vercel-ai.ts +0 -101
- package/packages/shared/src/auth/better-auth.ts +0 -118
- package/packages/shared/src/auth/clerk.ts +0 -151
- package/packages/shared/src/auth/convex-auth.ts +0 -125
- package/packages/shared/src/auth/index.ts +0 -10
- package/packages/shared/src/auth/interface.ts +0 -17
- package/packages/shared/src/auth/localStorage.ts +0 -125
- package/packages/shared/src/auth/supabase-auth.ts +0 -136
- package/packages/shared/src/config.ts +0 -57
- package/packages/shared/src/constants.ts +0 -122
- package/packages/shared/src/db/convex.ts +0 -146
- package/packages/shared/src/db/index.ts +0 -10
- package/packages/shared/src/db/interface.ts +0 -13
- package/packages/shared/src/db/localStorage.ts +0 -91
- package/packages/shared/src/db/mongodb.ts +0 -125
- package/packages/shared/src/db/neon.ts +0 -171
- package/packages/shared/src/db/supabase.ts +0 -158
- package/packages/shared/src/index.ts +0 -117
- package/packages/shared/src/payments/index.ts +0 -4
- package/packages/shared/src/payments/interface.ts +0 -11
- package/packages/shared/src/payments/localStorage.ts +0 -81
- package/packages/shared/src/payments/stripe.ts +0 -177
- package/packages/shared/src/storage/convex.ts +0 -113
- package/packages/shared/src/storage/index.ts +0 -14
- package/packages/shared/src/storage/interface.ts +0 -11
- package/packages/shared/src/storage/localStorage.ts +0 -95
- package/packages/shared/src/storage/minio.ts +0 -47
- package/packages/shared/src/storage/r2.ts +0 -123
- package/packages/shared/src/storage/s3.ts +0 -128
- package/packages/shared/src/storage/supabase-storage.ts +0 -116
- package/packages/shared/src/storage/uploadthing.ts +0 -126
- package/packages/shared/src/styles/adapters.css +0 -494
- package/packages/shared/src/tier-gate.ts +0 -119
- package/packages/shared/src/types.ts +0 -162
- package/packages/shared/tsconfig.json +0 -18
- package/packages/shared/tsup.config.ts +0 -9
- package/packages/shared/vitest.config.ts +0 -14
- package/packages/solidjs/package.json +0 -44
- package/packages/solidjs/src/components/AdapterCard.tsx +0 -24
- package/packages/solidjs/src/components/AdapterConfigForm.tsx +0 -54
- package/packages/solidjs/src/components/AdapterList.tsx +0 -28
- package/packages/solidjs/src/components/AdapterStatusBadge.tsx +0 -20
- package/packages/solidjs/src/components/index.ts +0 -4
- package/packages/solidjs/src/index.tsx +0 -17
- package/packages/solidjs/src/pages/AdapterDetailPage.tsx +0 -38
- package/packages/solidjs/src/pages/AdaptersPage.tsx +0 -39
- package/packages/solidjs/src/pages/index.ts +0 -2
- package/packages/solidjs/src/primitives/index.ts +0 -78
- package/packages/solidjs/src/provider/AdapterProvider.tsx +0 -62
- package/packages/solidjs/src/provider/index.ts +0 -2
- package/packages/solidjs/tsconfig.json +0 -20
- package/packages/solidjs/tsup.config.ts +0 -10
- package/packages/solidjs-css/package.json +0 -43
- package/packages/solidjs-css/src/adapters.css +0 -1576
- package/packages/solidjs-css/src/components/AdapterCard.tsx +0 -43
- package/packages/solidjs-css/src/components/AdapterConfigForm.tsx +0 -119
- package/packages/solidjs-css/src/components/AdapterList.tsx +0 -68
- package/packages/solidjs-css/src/components/AdapterStatusBadge.tsx +0 -24
- package/packages/solidjs-css/src/components/index.ts +0 -8
- package/packages/solidjs-css/src/index.tsx +0 -30
- package/packages/solidjs-css/src/pages/AdapterDetailPage.tsx +0 -107
- package/packages/solidjs-css/src/pages/AdaptersPage.tsx +0 -94
- package/packages/solidjs-css/src/pages/index.ts +0 -4
- package/packages/solidjs-css/src/primitives/index.ts +0 -1
- package/packages/solidjs-css/src/provider/AdapterProvider.tsx +0 -61
- package/packages/solidjs-css/src/provider/index.ts +0 -2
- package/packages/solidjs-css/tsconfig.json +0 -20
- package/packages/solidjs-css/tsup.config.ts +0 -2
- package/pnpm-workspace.yaml +0 -2
- package/tsconfig.json +0 -17
|
@@ -0,0 +1,570 @@
|
|
|
1
|
+
// src/index.tsx
|
|
2
|
+
import {
|
|
3
|
+
ADAPTER_DOMAINS as ADAPTER_DOMAINS4,
|
|
4
|
+
DOMAIN_LABELS as DOMAIN_LABELS7,
|
|
5
|
+
DOMAIN_ICONS as DOMAIN_ICONS3,
|
|
6
|
+
DOMAIN_DESCRIPTIONS as DOMAIN_DESCRIPTIONS3,
|
|
7
|
+
getProvidersForDomain as getProvidersForDomain3,
|
|
8
|
+
getProviderMeta,
|
|
9
|
+
configureAdapters,
|
|
10
|
+
getAdapterConfig,
|
|
11
|
+
isAdaptersConfigured
|
|
12
|
+
} from "@geenius/adapters-shared";
|
|
13
|
+
|
|
14
|
+
// src/provider/AdapterProvider.tsx
|
|
15
|
+
import { createContext, useContext, useState, useCallback, useEffect, useMemo } from "react";
|
|
16
|
+
import { ADAPTER_DOMAINS, DOMAIN_LABELS } from "@geenius/adapters-shared";
|
|
17
|
+
import { jsx } from "react/jsx-runtime";
|
|
18
|
+
var AdapterContext = createContext(null);
|
|
19
|
+
function AdapterProvider({ adapters, children, healthCheck = false }) {
|
|
20
|
+
const [isLoading, setIsLoading] = useState(healthCheck);
|
|
21
|
+
const [statuses, setStatuses] = useState(() => {
|
|
22
|
+
const initial = {};
|
|
23
|
+
for (const domain of ADAPTER_DOMAINS) {
|
|
24
|
+
const adapter = adapters[domain];
|
|
25
|
+
initial[domain] = {
|
|
26
|
+
domain,
|
|
27
|
+
provider: adapter ? "configured" : "none",
|
|
28
|
+
status: adapter ? "connected" : "disconnected",
|
|
29
|
+
lastCheckedAt: Date.now()
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return initial;
|
|
33
|
+
});
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (!healthCheck) return;
|
|
36
|
+
setIsLoading(true);
|
|
37
|
+
const checks = ADAPTER_DOMAINS.map(async (domain) => {
|
|
38
|
+
const adapter = adapters[domain];
|
|
39
|
+
if (!adapter) return;
|
|
40
|
+
try {
|
|
41
|
+
setStatuses((prev) => ({ ...prev, [domain]: { ...prev[domain], status: "initializing" } }));
|
|
42
|
+
if (domain === "auth" && adapter.getSession) {
|
|
43
|
+
await adapter.getSession();
|
|
44
|
+
}
|
|
45
|
+
setStatuses((prev) => ({
|
|
46
|
+
...prev,
|
|
47
|
+
[domain]: { ...prev[domain], status: "connected", lastCheckedAt: Date.now() }
|
|
48
|
+
}));
|
|
49
|
+
} catch (e) {
|
|
50
|
+
setStatuses((prev) => ({
|
|
51
|
+
...prev,
|
|
52
|
+
[domain]: {
|
|
53
|
+
...prev[domain],
|
|
54
|
+
status: "error",
|
|
55
|
+
error: e instanceof Error ? e.message : "Health check failed",
|
|
56
|
+
lastCheckedAt: Date.now()
|
|
57
|
+
}
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
Promise.allSettled(checks).finally(() => setIsLoading(false));
|
|
62
|
+
}, [adapters, healthCheck]);
|
|
63
|
+
const getAdapter = useCallback((domain) => {
|
|
64
|
+
const adapter = adapters[domain];
|
|
65
|
+
if (!adapter) throw new Error(`${DOMAIN_LABELS[domain] ?? domain} adapter not configured in <AdapterProvider>`);
|
|
66
|
+
return adapter;
|
|
67
|
+
}, [adapters]);
|
|
68
|
+
const isReady = useCallback((domain) => {
|
|
69
|
+
return !!adapters[domain] && statuses[domain]?.status === "connected";
|
|
70
|
+
}, [adapters, statuses]);
|
|
71
|
+
const value = useMemo(() => ({
|
|
72
|
+
adapters,
|
|
73
|
+
statuses,
|
|
74
|
+
getAdapter,
|
|
75
|
+
isReady,
|
|
76
|
+
isLoading
|
|
77
|
+
}), [adapters, statuses, getAdapter, isReady, isLoading]);
|
|
78
|
+
return /* @__PURE__ */ jsx(AdapterContext.Provider, { value, children });
|
|
79
|
+
}
|
|
80
|
+
function useAdapterContext() {
|
|
81
|
+
const ctx = useContext(AdapterContext);
|
|
82
|
+
if (!ctx) throw new Error("useAdapterContext must be used within <AdapterProvider>");
|
|
83
|
+
return ctx;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// src/hooks/index.ts
|
|
87
|
+
import { useMemo as useMemo2 } from "react";
|
|
88
|
+
function useDb() {
|
|
89
|
+
return useAdapterContext().getAdapter("db");
|
|
90
|
+
}
|
|
91
|
+
function useAuth() {
|
|
92
|
+
return useAdapterContext().getAdapter("auth");
|
|
93
|
+
}
|
|
94
|
+
function usePayments() {
|
|
95
|
+
return useAdapterContext().getAdapter("payments");
|
|
96
|
+
}
|
|
97
|
+
function useAi() {
|
|
98
|
+
return useAdapterContext().getAdapter("ai");
|
|
99
|
+
}
|
|
100
|
+
function useStorage() {
|
|
101
|
+
return useAdapterContext().getAdapter("storage");
|
|
102
|
+
}
|
|
103
|
+
function useAdmin() {
|
|
104
|
+
return useAdapterContext().getAdapter("admin");
|
|
105
|
+
}
|
|
106
|
+
function useAdapterStatuses() {
|
|
107
|
+
return useAdapterContext().statuses;
|
|
108
|
+
}
|
|
109
|
+
function useAdapterStatus(domain) {
|
|
110
|
+
return useAdapterContext().statuses[domain];
|
|
111
|
+
}
|
|
112
|
+
function useIsAdapterReady(domain) {
|
|
113
|
+
return useAdapterContext().isReady(domain);
|
|
114
|
+
}
|
|
115
|
+
function useAdapters() {
|
|
116
|
+
const ctx = useAdapterContext();
|
|
117
|
+
return useMemo2(() => ({
|
|
118
|
+
db: ctx.adapters.db,
|
|
119
|
+
auth: ctx.adapters.auth,
|
|
120
|
+
payments: ctx.adapters.payments,
|
|
121
|
+
ai: ctx.adapters.ai,
|
|
122
|
+
storage: ctx.adapters.storage,
|
|
123
|
+
admin: ctx.adapters.admin,
|
|
124
|
+
statuses: ctx.statuses,
|
|
125
|
+
isLoading: ctx.isLoading,
|
|
126
|
+
isReady: ctx.isReady
|
|
127
|
+
}), [ctx]);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// src/components/AdapterStatusBadge.tsx
|
|
131
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
132
|
+
var STATUS_STYLES = {
|
|
133
|
+
connected: { bg: "bg-emerald-500/10", text: "text-emerald-400", dot: "bg-emerald-400", label: "Connected" },
|
|
134
|
+
disconnected: { bg: "bg-white/5", text: "text-white/40", dot: "bg-white/30", label: "Disconnected" },
|
|
135
|
+
error: { bg: "bg-red-500/10", text: "text-red-400", dot: "bg-red-400", label: "Error" },
|
|
136
|
+
initializing: { bg: "bg-amber-500/10", text: "text-amber-400", dot: "bg-amber-400", label: "Initializing" }
|
|
137
|
+
};
|
|
138
|
+
function AdapterStatusBadge({ status, showLabel = true, size = "sm", className = "" }) {
|
|
139
|
+
const s = STATUS_STYLES[status];
|
|
140
|
+
const dotSize = size === "sm" ? "h-1.5 w-1.5" : "h-2 w-2";
|
|
141
|
+
const textSize = size === "sm" ? "text-[0.625rem]" : "text-xs";
|
|
142
|
+
return /* @__PURE__ */ jsxs("span", { className: `inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 ${s.bg} ${className}`, children: [
|
|
143
|
+
/* @__PURE__ */ jsx2("span", { className: `${dotSize} rounded-full ${s.dot} ${status === "initializing" ? "animate-pulse" : ""}` }),
|
|
144
|
+
showLabel && /* @__PURE__ */ jsx2("span", { className: `${textSize} font-semibold uppercase tracking-wider ${s.text}`, children: s.label })
|
|
145
|
+
] });
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// src/components/AdapterCard.tsx
|
|
149
|
+
import { DOMAIN_LABELS as DOMAIN_LABELS2, DOMAIN_ICONS, DOMAIN_DESCRIPTIONS } from "@geenius/adapters-shared";
|
|
150
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
151
|
+
function AdapterCard({ domain, status, onClick, className = "" }) {
|
|
152
|
+
const label = DOMAIN_LABELS2[domain];
|
|
153
|
+
const icon = DOMAIN_ICONS[domain];
|
|
154
|
+
const desc = DOMAIN_DESCRIPTIONS[domain];
|
|
155
|
+
return /* @__PURE__ */ jsxs2(
|
|
156
|
+
"button",
|
|
157
|
+
{
|
|
158
|
+
type: "button",
|
|
159
|
+
onClick,
|
|
160
|
+
className: `group flex w-full items-start gap-4 rounded-2xl border border-white/10 bg-white/[0.03] p-5 text-left backdrop-blur-sm transition-all hover:border-white/15 hover:bg-white/[0.05] ${className}`,
|
|
161
|
+
"aria-label": `${label} adapter \u2014 ${status.status}`,
|
|
162
|
+
children: [
|
|
163
|
+
/* @__PURE__ */ jsx3("div", { className: "flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-xl bg-white/5 text-2xl transition-transform group-hover:scale-105", children: icon }),
|
|
164
|
+
/* @__PURE__ */ jsxs2("div", { className: "min-w-0 flex-1", children: [
|
|
165
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between gap-2", children: [
|
|
166
|
+
/* @__PURE__ */ jsx3("h3", { className: "truncate text-sm font-bold text-white/90", children: label }),
|
|
167
|
+
/* @__PURE__ */ jsx3(AdapterStatusBadge, { status: status.status })
|
|
168
|
+
] }),
|
|
169
|
+
/* @__PURE__ */ jsx3("p", { className: "mt-0.5 text-xs text-white/40 line-clamp-2", children: desc }),
|
|
170
|
+
status.provider && status.provider !== "none" && /* @__PURE__ */ jsxs2("div", { className: "mt-2 flex items-center gap-2", children: [
|
|
171
|
+
/* @__PURE__ */ jsx3("span", { className: "rounded-md bg-white/5 px-2 py-0.5 text-[0.625rem] font-semibold text-white/50", children: status.provider }),
|
|
172
|
+
status.latency && /* @__PURE__ */ jsxs2("span", { className: "text-[0.625rem] text-white/30", children: [
|
|
173
|
+
status.latency,
|
|
174
|
+
"ms"
|
|
175
|
+
] })
|
|
176
|
+
] }),
|
|
177
|
+
status.error && /* @__PURE__ */ jsx3("p", { className: "mt-1.5 truncate text-[0.625rem] text-red-400/80", children: status.error })
|
|
178
|
+
] })
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// src/components/AdapterList.tsx
|
|
185
|
+
import { useState as useState2, useMemo as useMemo3 } from "react";
|
|
186
|
+
import { ADAPTER_DOMAINS as ADAPTER_DOMAINS2, DOMAIN_LABELS as DOMAIN_LABELS3 } from "@geenius/adapters-shared";
|
|
187
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
188
|
+
function AdapterList({ onSelect, filterStatus, className = "" }) {
|
|
189
|
+
const { statuses, isLoading } = useAdapters();
|
|
190
|
+
const [search, setSearch] = useState2("");
|
|
191
|
+
const filteredDomains = useMemo3(() => {
|
|
192
|
+
let domains = [...ADAPTER_DOMAINS2];
|
|
193
|
+
if (search) {
|
|
194
|
+
const q = search.toLowerCase();
|
|
195
|
+
domains = domains.filter((d) => {
|
|
196
|
+
const label = DOMAIN_LABELS3[d].toLowerCase();
|
|
197
|
+
const provider = statuses[d]?.provider?.toLowerCase() ?? "";
|
|
198
|
+
return label.includes(q) || provider.includes(q) || d.includes(q);
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
if (filterStatus) {
|
|
202
|
+
domains = domains.filter((d) => statuses[d]?.status === filterStatus);
|
|
203
|
+
}
|
|
204
|
+
return domains;
|
|
205
|
+
}, [search, filterStatus, statuses]);
|
|
206
|
+
if (isLoading) {
|
|
207
|
+
return /* @__PURE__ */ jsx4("div", { className: `space-y-3 ${className}`, role: "status", "aria-label": "Loading adapters", children: [1, 2, 3, 4].map((i) => /* @__PURE__ */ jsx4("div", { className: "animate-pulse rounded-2xl border border-white/5 bg-white/[0.02] p-5", children: /* @__PURE__ */ jsxs3("div", { className: "flex items-start gap-4", children: [
|
|
208
|
+
/* @__PURE__ */ jsx4("div", { className: "h-12 w-12 rounded-xl bg-white/10" }),
|
|
209
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex-1 space-y-2", children: [
|
|
210
|
+
/* @__PURE__ */ jsx4("div", { className: "h-3 w-24 rounded bg-white/10" }),
|
|
211
|
+
/* @__PURE__ */ jsx4("div", { className: "h-2 w-48 rounded bg-white/5" })
|
|
212
|
+
] })
|
|
213
|
+
] }) }, i)) });
|
|
214
|
+
}
|
|
215
|
+
return /* @__PURE__ */ jsxs3("div", { className, children: [
|
|
216
|
+
/* @__PURE__ */ jsx4("div", { className: "mb-4", children: /* @__PURE__ */ jsx4(
|
|
217
|
+
"input",
|
|
218
|
+
{
|
|
219
|
+
type: "text",
|
|
220
|
+
value: search,
|
|
221
|
+
onChange: (e) => setSearch(e.target.value),
|
|
222
|
+
placeholder: "Search adapters...",
|
|
223
|
+
"aria-label": "Search adapters",
|
|
224
|
+
className: "w-full rounded-xl border border-white/10 bg-white/[0.02] px-4 py-2.5 text-sm text-white/90 placeholder:text-white/20 focus:border-indigo-500/50 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
225
|
+
}
|
|
226
|
+
) }),
|
|
227
|
+
filteredDomains.length === 0 ? /* @__PURE__ */ jsx4("div", { className: "rounded-xl border border-white/5 bg-white/[0.01] p-8 text-center", children: /* @__PURE__ */ jsx4("p", { className: "text-sm text-white/40", children: search ? "No adapters match your search" : "No adapters configured" }) }) : /* @__PURE__ */ jsx4("div", { className: "grid gap-3 sm:grid-cols-2", role: "list", "aria-label": "Adapter list", children: filteredDomains.map((domain) => /* @__PURE__ */ jsx4(
|
|
228
|
+
AdapterCard,
|
|
229
|
+
{
|
|
230
|
+
domain,
|
|
231
|
+
status: statuses[domain],
|
|
232
|
+
onClick: () => onSelect?.(domain)
|
|
233
|
+
},
|
|
234
|
+
domain
|
|
235
|
+
)) })
|
|
236
|
+
] });
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// src/components/AdapterConfigForm.tsx
|
|
240
|
+
import { useState as useState3 } from "react";
|
|
241
|
+
import { DOMAIN_LABELS as DOMAIN_LABELS4, getProvidersForDomain } from "@geenius/adapters-shared";
|
|
242
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
243
|
+
function AdapterConfigForm({ domain, initialConfig, onSave, onCancel, className = "" }) {
|
|
244
|
+
const providers = getProvidersForDomain(domain);
|
|
245
|
+
const [provider, setProvider] = useState3(initialConfig?.provider ?? providers[0]?.id ?? "");
|
|
246
|
+
const [apiKey, setApiKey] = useState3(initialConfig?.apiKey ?? "");
|
|
247
|
+
const [baseUrl, setBaseUrl] = useState3(initialConfig?.baseUrl ?? "");
|
|
248
|
+
const [isSaving, setIsSaving] = useState3(false);
|
|
249
|
+
const [error, setError] = useState3(null);
|
|
250
|
+
const selectedMeta = providers.find((p) => p.id === provider);
|
|
251
|
+
const needsApiKey = !["localStorage", "noop"].includes(provider);
|
|
252
|
+
const needsBaseUrl = ["ollama", "minio", "neon", "supabase"].includes(provider);
|
|
253
|
+
const handleSubmit = async (e) => {
|
|
254
|
+
e.preventDefault();
|
|
255
|
+
setError(null);
|
|
256
|
+
if (!provider) {
|
|
257
|
+
setError("Select a provider");
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
if (needsApiKey && !apiKey.trim()) {
|
|
261
|
+
setError("API key is required");
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
setIsSaving(true);
|
|
265
|
+
try {
|
|
266
|
+
await onSave({ provider, apiKey: apiKey || void 0, baseUrl: baseUrl || void 0 });
|
|
267
|
+
} catch (e2) {
|
|
268
|
+
setError(e2 instanceof Error ? e2.message : "Failed to save");
|
|
269
|
+
} finally {
|
|
270
|
+
setIsSaving(false);
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
return /* @__PURE__ */ jsxs4("form", { onSubmit: handleSubmit, className: `space-y-5 rounded-2xl border border-white/10 bg-white/[0.03] p-6 backdrop-blur-sm ${className}`, noValidate: true, children: [
|
|
274
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
275
|
+
/* @__PURE__ */ jsxs4("h3", { className: "text-lg font-bold text-white/90", children: [
|
|
276
|
+
"Configure ",
|
|
277
|
+
DOMAIN_LABELS4[domain]
|
|
278
|
+
] }),
|
|
279
|
+
/* @__PURE__ */ jsx5("p", { className: "mt-1 text-xs text-white/40", children: "Select and configure your preferred provider." })
|
|
280
|
+
] }),
|
|
281
|
+
error && /* @__PURE__ */ jsx5("div", { className: "rounded-lg border border-red-500/20 bg-red-500/10 px-4 py-3 text-sm text-red-400", role: "alert", children: error }),
|
|
282
|
+
/* @__PURE__ */ jsxs4("div", { children: [
|
|
283
|
+
/* @__PURE__ */ jsx5("label", { htmlFor: `adapter-${domain}-provider`, className: "mb-1.5 block text-xs font-semibold uppercase tracking-wider text-white/40", children: "Provider" }),
|
|
284
|
+
/* @__PURE__ */ jsx5("div", { className: "grid gap-2 sm:grid-cols-2", children: providers.map((p) => /* @__PURE__ */ jsxs4(
|
|
285
|
+
"button",
|
|
286
|
+
{
|
|
287
|
+
type: "button",
|
|
288
|
+
onClick: () => setProvider(p.id),
|
|
289
|
+
className: `flex flex-col rounded-xl border p-3 text-left transition-all ${provider === p.id ? "border-indigo-500/30 bg-indigo-500/10" : "border-white/10 bg-white/[0.02] hover:bg-white/[0.04]"}`,
|
|
290
|
+
children: [
|
|
291
|
+
/* @__PURE__ */ jsx5("span", { className: "text-xs font-semibold text-white/80", children: p.name }),
|
|
292
|
+
/* @__PURE__ */ jsx5("span", { className: "mt-0.5 text-[0.625rem] text-white/40", children: p.description }),
|
|
293
|
+
/* @__PURE__ */ jsx5("span", { className: `mt-1 self-start rounded px-1.5 py-0.5 text-[0.5625rem] font-bold uppercase ${p.tier === "pronto" ? "bg-emerald-500/10 text-emerald-400" : p.tier === "lancio" ? "bg-blue-500/10 text-blue-400" : "bg-purple-500/10 text-purple-400"}`, children: p.tier })
|
|
294
|
+
]
|
|
295
|
+
},
|
|
296
|
+
p.id
|
|
297
|
+
)) })
|
|
298
|
+
] }),
|
|
299
|
+
needsApiKey && /* @__PURE__ */ jsxs4("div", { children: [
|
|
300
|
+
/* @__PURE__ */ jsx5("label", { htmlFor: `adapter-${domain}-apiKey`, className: "mb-1.5 block text-xs font-semibold uppercase tracking-wider text-white/40", children: "API Key" }),
|
|
301
|
+
/* @__PURE__ */ jsx5(
|
|
302
|
+
"input",
|
|
303
|
+
{
|
|
304
|
+
id: `adapter-${domain}-apiKey`,
|
|
305
|
+
type: "password",
|
|
306
|
+
value: apiKey,
|
|
307
|
+
onChange: (e) => setApiKey(e.target.value),
|
|
308
|
+
placeholder: `Enter ${selectedMeta?.name ?? provider} API key`,
|
|
309
|
+
autoComplete: "off",
|
|
310
|
+
className: "w-full rounded-xl border border-white/10 bg-white/[0.02] px-4 py-3 text-sm text-white/90 placeholder:text-white/20 focus:border-indigo-500/50 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
311
|
+
}
|
|
312
|
+
)
|
|
313
|
+
] }),
|
|
314
|
+
needsBaseUrl && /* @__PURE__ */ jsxs4("div", { children: [
|
|
315
|
+
/* @__PURE__ */ jsx5("label", { htmlFor: `adapter-${domain}-url`, className: "mb-1.5 block text-xs font-semibold uppercase tracking-wider text-white/40", children: "Base URL" }),
|
|
316
|
+
/* @__PURE__ */ jsx5(
|
|
317
|
+
"input",
|
|
318
|
+
{
|
|
319
|
+
id: `adapter-${domain}-url`,
|
|
320
|
+
type: "url",
|
|
321
|
+
value: baseUrl,
|
|
322
|
+
onChange: (e) => setBaseUrl(e.target.value),
|
|
323
|
+
placeholder: `https://...`,
|
|
324
|
+
className: "w-full rounded-xl border border-white/10 bg-white/[0.02] px-4 py-3 text-sm text-white/90 placeholder:text-white/20 focus:border-indigo-500/50 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"
|
|
325
|
+
}
|
|
326
|
+
)
|
|
327
|
+
] }),
|
|
328
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-end gap-3 pt-2", children: [
|
|
329
|
+
onCancel && /* @__PURE__ */ jsx5("button", { type: "button", onClick: onCancel, className: "rounded-xl px-5 py-2.5 text-sm font-semibold text-white/50 hover:text-white/70", children: "Cancel" }),
|
|
330
|
+
/* @__PURE__ */ jsx5(
|
|
331
|
+
"button",
|
|
332
|
+
{
|
|
333
|
+
type: "submit",
|
|
334
|
+
disabled: isSaving || !provider,
|
|
335
|
+
className: "flex items-center gap-2 rounded-xl bg-indigo-500 px-6 py-2.5 text-sm font-semibold text-white hover:bg-indigo-400 disabled:opacity-50",
|
|
336
|
+
children: isSaving ? "Saving\u2026" : "Save Configuration"
|
|
337
|
+
}
|
|
338
|
+
)
|
|
339
|
+
] })
|
|
340
|
+
] });
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// src/pages/AdaptersPage.tsx
|
|
344
|
+
import { useState as useState4 } from "react";
|
|
345
|
+
import { ADAPTER_DOMAINS as ADAPTER_DOMAINS3, ADAPTER_STATUSES } from "@geenius/adapters-shared";
|
|
346
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
347
|
+
function AdaptersPage({ onNavigateDetail, className = "" }) {
|
|
348
|
+
const { statuses, isLoading } = useAdapters();
|
|
349
|
+
const [selectedDomain, setSelectedDomain] = useState4(null);
|
|
350
|
+
const [filterStatus, setFilterStatus] = useState4();
|
|
351
|
+
const counts = {
|
|
352
|
+
connected: ADAPTER_DOMAINS3.filter((d) => statuses[d]?.status === "connected").length,
|
|
353
|
+
error: ADAPTER_DOMAINS3.filter((d) => statuses[d]?.status === "error").length,
|
|
354
|
+
total: ADAPTER_DOMAINS3.length
|
|
355
|
+
};
|
|
356
|
+
if (isLoading) {
|
|
357
|
+
return /* @__PURE__ */ jsx6("div", { className: `max-w-4xl mx-auto space-y-6 ${className}`, children: /* @__PURE__ */ jsxs5("div", { className: "animate-pulse space-y-4", children: [
|
|
358
|
+
/* @__PURE__ */ jsx6("div", { className: "h-8 w-48 rounded bg-white/10" }),
|
|
359
|
+
/* @__PURE__ */ jsx6("div", { className: "h-4 w-72 rounded bg-white/5" }),
|
|
360
|
+
/* @__PURE__ */ jsx6("div", { className: "grid gap-3 sm:grid-cols-3", children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx6("div", { className: "h-20 rounded-2xl bg-white/[0.03]" }, i)) }),
|
|
361
|
+
/* @__PURE__ */ jsx6("div", { className: "grid gap-3 sm:grid-cols-2", children: [1, 2, 3, 4].map((i) => /* @__PURE__ */ jsx6("div", { className: "h-28 rounded-2xl bg-white/[0.03]" }, i)) })
|
|
362
|
+
] }) });
|
|
363
|
+
}
|
|
364
|
+
return /* @__PURE__ */ jsxs5("div", { className: `max-w-4xl mx-auto space-y-8 ${className}`, children: [
|
|
365
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
366
|
+
/* @__PURE__ */ jsx6("h1", { className: "text-2xl font-extrabold text-white/95 tracking-tight", children: "Adapters" }),
|
|
367
|
+
/* @__PURE__ */ jsx6("p", { className: "mt-1 text-sm text-white/40", children: "Manage your infrastructure adapters \u2014 database, auth, AI, storage, payments, and admin." })
|
|
368
|
+
] }),
|
|
369
|
+
/* @__PURE__ */ jsxs5("div", { className: "grid gap-3 sm:grid-cols-3", children: [
|
|
370
|
+
/* @__PURE__ */ jsxs5("div", { className: "rounded-2xl border border-white/10 bg-white/[0.03] p-4 backdrop-blur-sm", children: [
|
|
371
|
+
/* @__PURE__ */ jsx6("p", { className: "text-xs font-semibold uppercase tracking-wider text-white/30", children: "Total" }),
|
|
372
|
+
/* @__PURE__ */ jsx6("p", { className: "mt-1 text-2xl font-extrabold text-white/90", children: counts.total }),
|
|
373
|
+
/* @__PURE__ */ jsx6("p", { className: "text-[0.625rem] text-white/30", children: "adapter domains" })
|
|
374
|
+
] }),
|
|
375
|
+
/* @__PURE__ */ jsxs5("div", { className: "rounded-2xl border border-emerald-500/10 bg-emerald-500/[0.03] p-4 backdrop-blur-sm", children: [
|
|
376
|
+
/* @__PURE__ */ jsx6("p", { className: "text-xs font-semibold uppercase tracking-wider text-emerald-400/60", children: "Connected" }),
|
|
377
|
+
/* @__PURE__ */ jsx6("p", { className: "mt-1 text-2xl font-extrabold text-emerald-400", children: counts.connected }),
|
|
378
|
+
/* @__PURE__ */ jsx6("p", { className: "text-[0.625rem] text-emerald-400/40", children: "active adapters" })
|
|
379
|
+
] }),
|
|
380
|
+
counts.error > 0 && /* @__PURE__ */ jsxs5("div", { className: "rounded-2xl border border-red-500/10 bg-red-500/[0.03] p-4 backdrop-blur-sm", children: [
|
|
381
|
+
/* @__PURE__ */ jsx6("p", { className: "text-xs font-semibold uppercase tracking-wider text-red-400/60", children: "Errors" }),
|
|
382
|
+
/* @__PURE__ */ jsx6("p", { className: "mt-1 text-2xl font-extrabold text-red-400", children: counts.error }),
|
|
383
|
+
/* @__PURE__ */ jsx6("p", { className: "text-[0.625rem] text-red-400/40", children: "need attention" })
|
|
384
|
+
] })
|
|
385
|
+
] }),
|
|
386
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2", children: [
|
|
387
|
+
/* @__PURE__ */ jsx6(
|
|
388
|
+
"button",
|
|
389
|
+
{
|
|
390
|
+
onClick: () => setFilterStatus(void 0),
|
|
391
|
+
className: `rounded-lg px-3 py-1.5 text-xs font-semibold transition-all ${!filterStatus ? "bg-white/10 text-white/80" : "text-white/30 hover:text-white/50"}`,
|
|
392
|
+
children: "All"
|
|
393
|
+
}
|
|
394
|
+
),
|
|
395
|
+
ADAPTER_STATUSES.map((s) => /* @__PURE__ */ jsxs5(
|
|
396
|
+
"button",
|
|
397
|
+
{
|
|
398
|
+
onClick: () => setFilterStatus(s),
|
|
399
|
+
className: `flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-xs font-semibold transition-all ${filterStatus === s ? "bg-white/10 text-white/80" : "text-white/30 hover:text-white/50"}`,
|
|
400
|
+
children: [
|
|
401
|
+
/* @__PURE__ */ jsx6(AdapterStatusBadge, { status: s, showLabel: false, size: "sm" }),
|
|
402
|
+
s
|
|
403
|
+
]
|
|
404
|
+
},
|
|
405
|
+
s
|
|
406
|
+
))
|
|
407
|
+
] }),
|
|
408
|
+
/* @__PURE__ */ jsx6(
|
|
409
|
+
AdapterList,
|
|
410
|
+
{
|
|
411
|
+
onSelect: (domain) => {
|
|
412
|
+
if (onNavigateDetail) {
|
|
413
|
+
onNavigateDetail(domain);
|
|
414
|
+
} else {
|
|
415
|
+
setSelectedDomain(domain);
|
|
416
|
+
}
|
|
417
|
+
},
|
|
418
|
+
filterStatus
|
|
419
|
+
}
|
|
420
|
+
),
|
|
421
|
+
selectedDomain && /* @__PURE__ */ jsx6("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm", onClick: () => setSelectedDomain(null), children: /* @__PURE__ */ jsx6("div", { className: "max-w-lg w-full mx-4", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx6(
|
|
422
|
+
AdapterConfigForm,
|
|
423
|
+
{
|
|
424
|
+
domain: selectedDomain,
|
|
425
|
+
onSave: async () => {
|
|
426
|
+
setSelectedDomain(null);
|
|
427
|
+
},
|
|
428
|
+
onCancel: () => setSelectedDomain(null)
|
|
429
|
+
}
|
|
430
|
+
) }) })
|
|
431
|
+
] });
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// src/pages/AdapterDetailPage.tsx
|
|
435
|
+
import { useState as useState5 } from "react";
|
|
436
|
+
import { DOMAIN_LABELS as DOMAIN_LABELS6, DOMAIN_ICONS as DOMAIN_ICONS2, DOMAIN_DESCRIPTIONS as DOMAIN_DESCRIPTIONS2, getProvidersForDomain as getProvidersForDomain2 } from "@geenius/adapters-shared";
|
|
437
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
438
|
+
function AdapterDetailPage({ domain, onBack, className = "" }) {
|
|
439
|
+
const { isLoading } = useAdapters();
|
|
440
|
+
const status = useAdapterStatus(domain);
|
|
441
|
+
const [isEditing, setIsEditing] = useState5(false);
|
|
442
|
+
const providers = getProvidersForDomain2(domain);
|
|
443
|
+
const label = DOMAIN_LABELS6[domain];
|
|
444
|
+
const icon = DOMAIN_ICONS2[domain];
|
|
445
|
+
const desc = DOMAIN_DESCRIPTIONS2[domain];
|
|
446
|
+
if (isLoading) {
|
|
447
|
+
return /* @__PURE__ */ jsx7("div", { className: `max-w-3xl mx-auto space-y-6 ${className}`, children: /* @__PURE__ */ jsxs6("div", { className: "animate-pulse space-y-4", children: [
|
|
448
|
+
/* @__PURE__ */ jsx7("div", { className: "h-6 w-32 rounded bg-white/10" }),
|
|
449
|
+
/* @__PURE__ */ jsx7("div", { className: "h-40 rounded-2xl bg-white/[0.03]" }),
|
|
450
|
+
/* @__PURE__ */ jsx7("div", { className: "h-60 rounded-2xl bg-white/[0.03]" })
|
|
451
|
+
] }) });
|
|
452
|
+
}
|
|
453
|
+
return /* @__PURE__ */ jsxs6("div", { className: `max-w-3xl mx-auto space-y-8 ${className}`, children: [
|
|
454
|
+
onBack && /* @__PURE__ */ jsxs6("button", { onClick: onBack, className: "flex items-center gap-1.5 text-sm text-white/30 hover:text-white/60 transition-colors", children: [
|
|
455
|
+
/* @__PURE__ */ jsx7("span", { children: "\u2190" }),
|
|
456
|
+
" Back to Adapters"
|
|
457
|
+
] }),
|
|
458
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-start gap-5", children: [
|
|
459
|
+
/* @__PURE__ */ jsx7("div", { className: "flex h-16 w-16 items-center justify-center rounded-2xl bg-white/5 text-3xl", children: icon }),
|
|
460
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex-1", children: [
|
|
461
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-3", children: [
|
|
462
|
+
/* @__PURE__ */ jsx7("h1", { className: "text-2xl font-extrabold text-white/95 tracking-tight", children: label }),
|
|
463
|
+
/* @__PURE__ */ jsx7(AdapterStatusBadge, { status: status.status, size: "md" })
|
|
464
|
+
] }),
|
|
465
|
+
/* @__PURE__ */ jsx7("p", { className: "mt-1 text-sm text-white/40", children: desc })
|
|
466
|
+
] })
|
|
467
|
+
] }),
|
|
468
|
+
/* @__PURE__ */ jsxs6("div", { className: "rounded-2xl border border-white/10 bg-white/[0.03] p-6 backdrop-blur-sm", children: [
|
|
469
|
+
/* @__PURE__ */ jsx7("h2", { className: "text-xs font-semibold uppercase tracking-wider text-white/30 mb-4", children: "Current Status" }),
|
|
470
|
+
/* @__PURE__ */ jsxs6("div", { className: "grid gap-4 sm:grid-cols-3", children: [
|
|
471
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
472
|
+
/* @__PURE__ */ jsx7("p", { className: "text-[0.625rem] text-white/30 uppercase", children: "Provider" }),
|
|
473
|
+
/* @__PURE__ */ jsx7("p", { className: "mt-0.5 text-sm font-semibold text-white/80", children: status.provider !== "none" ? status.provider : "\u2014" })
|
|
474
|
+
] }),
|
|
475
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
476
|
+
/* @__PURE__ */ jsx7("p", { className: "text-[0.625rem] text-white/30 uppercase", children: "Status" }),
|
|
477
|
+
/* @__PURE__ */ jsx7("p", { className: "mt-0.5", children: /* @__PURE__ */ jsx7(AdapterStatusBadge, { status: status.status }) })
|
|
478
|
+
] }),
|
|
479
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
480
|
+
/* @__PURE__ */ jsx7("p", { className: "text-[0.625rem] text-white/30 uppercase", children: "Last Checked" }),
|
|
481
|
+
/* @__PURE__ */ jsx7("p", { className: "mt-0.5 text-sm text-white/60", children: status.lastCheckedAt ? new Date(status.lastCheckedAt).toLocaleTimeString() : "\u2014" })
|
|
482
|
+
] })
|
|
483
|
+
] }),
|
|
484
|
+
status.error && /* @__PURE__ */ jsxs6("div", { className: "mt-4 rounded-lg border border-red-500/20 bg-red-500/10 px-4 py-3 text-sm text-red-400", children: [
|
|
485
|
+
/* @__PURE__ */ jsx7("span", { className: "font-semibold", children: "Error:" }),
|
|
486
|
+
" ",
|
|
487
|
+
status.error
|
|
488
|
+
] }),
|
|
489
|
+
status.latency && /* @__PURE__ */ jsxs6("div", { className: "mt-4", children: [
|
|
490
|
+
/* @__PURE__ */ jsx7("p", { className: "text-[0.625rem] text-white/30 uppercase mb-1", children: "Latency" }),
|
|
491
|
+
/* @__PURE__ */ jsx7("div", { className: "h-2 w-full rounded-full bg-white/5 overflow-hidden", children: /* @__PURE__ */ jsx7(
|
|
492
|
+
"div",
|
|
493
|
+
{
|
|
494
|
+
className: `h-full rounded-full transition-all ${status.latency < 100 ? "bg-emerald-400" : status.latency < 500 ? "bg-amber-400" : "bg-red-400"}`,
|
|
495
|
+
style: { width: `${Math.min(100, status.latency / 1e3 * 100)}%` }
|
|
496
|
+
}
|
|
497
|
+
) }),
|
|
498
|
+
/* @__PURE__ */ jsxs6("p", { className: "mt-1 text-xs text-white/40", children: [
|
|
499
|
+
status.latency,
|
|
500
|
+
"ms"
|
|
501
|
+
] })
|
|
502
|
+
] })
|
|
503
|
+
] }),
|
|
504
|
+
/* @__PURE__ */ jsxs6("div", { className: "rounded-2xl border border-white/10 bg-white/[0.03] p-6 backdrop-blur-sm", children: [
|
|
505
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between mb-4", children: [
|
|
506
|
+
/* @__PURE__ */ jsx7("h2", { className: "text-xs font-semibold uppercase tracking-wider text-white/30", children: "Available Providers" }),
|
|
507
|
+
/* @__PURE__ */ jsxs6("span", { className: "text-xs text-white/20", children: [
|
|
508
|
+
providers.length,
|
|
509
|
+
" providers"
|
|
510
|
+
] })
|
|
511
|
+
] }),
|
|
512
|
+
/* @__PURE__ */ jsx7("div", { className: "divide-y divide-white/5", children: providers.map((p) => /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between py-3 first:pt-0 last:pb-0", children: [
|
|
513
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
514
|
+
/* @__PURE__ */ jsx7("p", { className: "text-sm font-semibold text-white/80", children: p.name }),
|
|
515
|
+
/* @__PURE__ */ jsx7("p", { className: "text-xs text-white/30", children: p.description })
|
|
516
|
+
] }),
|
|
517
|
+
/* @__PURE__ */ jsx7("span", { className: `self-start rounded px-2 py-0.5 text-[0.625rem] font-bold uppercase ${p.tier === "pronto" ? "bg-emerald-500/10 text-emerald-400" : p.tier === "lancio" ? "bg-blue-500/10 text-blue-400" : "bg-purple-500/10 text-purple-400"}`, children: p.tier })
|
|
518
|
+
] }, p.id)) })
|
|
519
|
+
] }),
|
|
520
|
+
/* @__PURE__ */ jsx7("div", { children: isEditing ? /* @__PURE__ */ jsx7(
|
|
521
|
+
AdapterConfigForm,
|
|
522
|
+
{
|
|
523
|
+
domain,
|
|
524
|
+
onSave: async () => setIsEditing(false),
|
|
525
|
+
onCancel: () => setIsEditing(false)
|
|
526
|
+
}
|
|
527
|
+
) : /* @__PURE__ */ jsxs6(
|
|
528
|
+
"button",
|
|
529
|
+
{
|
|
530
|
+
onClick: () => setIsEditing(true),
|
|
531
|
+
className: "w-full rounded-2xl border border-dashed border-white/10 bg-white/[0.01] p-6 text-center text-sm text-white/30 hover:border-white/20 hover:text-white/50 transition-all",
|
|
532
|
+
children: [
|
|
533
|
+
"\u2699\uFE0F Configure ",
|
|
534
|
+
label,
|
|
535
|
+
" Adapter"
|
|
536
|
+
]
|
|
537
|
+
}
|
|
538
|
+
) })
|
|
539
|
+
] });
|
|
540
|
+
}
|
|
541
|
+
export {
|
|
542
|
+
ADAPTER_DOMAINS4 as ADAPTER_DOMAINS,
|
|
543
|
+
AdapterCard,
|
|
544
|
+
AdapterConfigForm,
|
|
545
|
+
AdapterDetailPage,
|
|
546
|
+
AdapterList,
|
|
547
|
+
AdapterProvider,
|
|
548
|
+
AdapterStatusBadge,
|
|
549
|
+
AdaptersPage,
|
|
550
|
+
DOMAIN_DESCRIPTIONS3 as DOMAIN_DESCRIPTIONS,
|
|
551
|
+
DOMAIN_ICONS3 as DOMAIN_ICONS,
|
|
552
|
+
DOMAIN_LABELS7 as DOMAIN_LABELS,
|
|
553
|
+
configureAdapters,
|
|
554
|
+
getAdapterConfig,
|
|
555
|
+
getProviderMeta,
|
|
556
|
+
getProvidersForDomain3 as getProvidersForDomain,
|
|
557
|
+
isAdaptersConfigured,
|
|
558
|
+
useAdapterContext,
|
|
559
|
+
useAdapterStatus,
|
|
560
|
+
useAdapterStatuses,
|
|
561
|
+
useAdapters,
|
|
562
|
+
useAdmin,
|
|
563
|
+
useAi,
|
|
564
|
+
useAuth,
|
|
565
|
+
useDb,
|
|
566
|
+
useIsAdapterReady,
|
|
567
|
+
usePayments,
|
|
568
|
+
useStorage
|
|
569
|
+
};
|
|
570
|
+
//# sourceMappingURL=index.mjs.map
|