Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

next
tsx 101 lines 3.46 KB
Raw
1 import { KeyRound, Link2, Play, RefreshCw } from 'lucide-react';
2 import type { ReactNode } from 'react';
3
4 const STEPS: {
5 n: string;
6 icon: ReactNode;
7 title: string;
8 note: string;
9 }[] = [
10 {
11 n: '01',
12 icon: <KeyRound className="size-3.5" aria-hidden="true" />,
13 title: 'Create auth config',
14 note: 'Define the scheme for the toolkit you import into',
15 },
16 {
17 n: '02',
18 icon: <Link2 className="size-3.5" aria-hidden="true" />,
19 title: 'Create the connection',
20 note: 'Pass your existing API key or bearer token',
21 },
22 {
23 n: '03',
24 icon: <Play className="size-3.5" aria-hidden="true" />,
25 title: 'Use it in a session',
26 note: 'The connected account is active immediately',
27 },
28 {
29 n: '04',
30 icon: <RefreshCw className="size-3.5" aria-hidden="true" />,
31 title: 'Update when it rotates',
32 note: 'PATCH new credentials in place, no re-auth',
33 },
34 ];
35
36 /**
37 * ImportConnectionFlow — branded replacement for the import pipeline mermaid
38 * diagram on the "Importing existing connections" page.
39 *
40 * Four steps to bring credentials you already hold into Composio without
41 * making users re-authenticate: define the auth config, create the connection
42 * with the existing credential, use it, and patch it when it rotates. Server
43 * component, light/dark via fd-* tokens.
44 */
45 export function ImportConnectionFlow() {
46 return (
47 <div className="not-prose my-6 overflow-hidden rounded-sm border border-fd-border bg-fd-background">
48 {/* header strip */}
49 <div className="flex items-center justify-between border-b border-fd-border px-3 py-1.5 font-mono text-[10px] uppercase tracking-[0.06em] text-fd-foreground/45">
50 <span>connection.import</span>
51 <span className="text-fd-foreground/55">no re-authentication</span>
52 </div>
53
54 {/* the pipeline */}
55 <div className="grid items-stretch gap-px bg-fd-border md:grid-cols-4">
56 {STEPS.map((step, i) => {
57 const last = i === STEPS.length - 1;
58 return (
59 <div
60 key={step.title}
61 className="relative flex flex-col gap-2 bg-fd-background p-3"
62 >
63 <div className="flex items-center gap-2">
64 <span className="flex size-6 shrink-0 items-center justify-center rounded-sm bg-fd-foreground/[0.06] font-mono text-[10px] font-medium text-fd-foreground/55">
65 {step.n}
66 </span>
67 <span className="flex size-6 shrink-0 items-center justify-center rounded-sm bg-[var(--composio-brand)]/10 text-[var(--composio-brand)]">
68 {step.icon}
69 </span>
70 </div>
71 <div className="min-w-0">
72 <span className="block text-[12px] font-medium leading-tight text-fd-foreground">
73 {step.title}
74 </span>
75 <p className="mt-1 text-[11px] leading-snug text-fd-foreground/55">
76 {step.note}
77 </p>
78 </div>
79 {!last && <Connector />}
80 </div>
81 );
82 })}
83 </div>
84 </div>
85 );
86 }
87
88 function Connector() {
89 return (
90 <div
91 aria-hidden="true"
92 className="pointer-events-none absolute z-10 hidden md:block"
93 style={{ right: '-7px', top: '50%' }}
94 >
95 <div className="flex items-center">
96 <span className="h-px w-3 bg-fd-border" />
97 <span className="size-0 border-y-[3px] border-l-[5px] border-y-transparent border-l-fd-border" />
98 </div>
99 </div>
100 );
101 }